stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Ben Hutchings <bhutchings@solarflare.com>,
	David Miller <davem@davemloft.net>
Subject: [ 16/17] sfc: Fix efx_rx_buf_offset() for recycled pages
Date: Sun, 29 Sep 2013 12:26:55 -0700	[thread overview]
Message-ID: <20130929190758.245268941@linuxfoundation.org> (raw)
In-Reply-To: <20130929190757.138351117@linuxfoundation.org>

3.0-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ben Hutchings <bhutchings@solarflare.com>

This bug fix is only for stable branches older than 3.10.  The bug was
fixed upstream by commit 2768935a4660 ('sfc: reuse pages to avoid DMA
mapping/unmapping costs'), but that change is totally unsuitable for
stable.

Commit b590ace09d51 ('sfc: Fix efx_rx_buf_offset() in the presence of
swiotlb') added an explicit page_offset member to struct
efx_rx_buffer, which must be set consistently with the u.page and
dma_addr fields.  However, it failed to add the necessary assignment
in efx_resurrect_rx_buffer().  It also did not correct the calculation
of efx_rx_buffer::dma_addr in efx_resurrect_rx_buffer(), which assumes
that DMA-mapping a page will result in a page-aligned DMA address
(exactly what swiotlb violates).

Add the assignment of efx_rx_buffer::page_offset and change the
calculation of dma_addr to make use of it.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/sfc/rx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/net/sfc/rx.c
+++ b/drivers/net/sfc/rx.c
@@ -311,8 +311,9 @@ static void efx_resurrect_rx_buffer(stru
 
 	index = rx_queue->added_count & rx_queue->ptr_mask;
 	new_buf = efx_rx_buffer(rx_queue, index);
-	new_buf->dma_addr = rx_buf->dma_addr ^ (PAGE_SIZE >> 1);
 	new_buf->u.page = rx_buf->u.page;
+	new_buf->page_offset = rx_buf->page_offset ^ (PAGE_SIZE >> 1);
+	new_buf->dma_addr = state->dma_addr + new_buf->page_offset;
 	new_buf->len = rx_buf->len;
 	new_buf->is_page = true;
 	++rx_queue->added_count;



  parent reply	other threads:[~2013-09-29 19:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-29 19:26 [ 00/17] 3.0.98-stable review Greg Kroah-Hartman
2013-09-29 19:26 ` [ 01/17] Revert "sctp: fix call to SCTP_CMD_PROCESS_SACK in sctp_cmd_interpreter()" Greg Kroah-Hartman
2013-09-29 19:26 ` [ 02/17] net: usb: cdc_ether: Use wwan interface for Telit modules Greg Kroah-Hartman
2013-09-29 19:26 ` [ 03/17] rt2800: fix wrong TX power compensation Greg Kroah-Hartman
2013-09-29 19:26 ` [ 04/17] HID: provide a helper for validating hid reports Greg Kroah-Hartman
2013-09-29 19:26 ` [ 05/17] HID: zeroplus: validate output report details Greg Kroah-Hartman
2013-09-29 19:26 ` [ 06/17] drm/radeon: fix LCD record parsing Greg Kroah-Hartman
2013-09-29 19:26 ` [ 07/17] drm/radeon: update line buffer allocation for dce4.1/5 Greg Kroah-Hartman
2013-09-29 19:26 ` [ 08/17] drm/radeon: fix resume on some rs4xx boards (v2) Greg Kroah-Hartman
2013-09-29 19:26 ` [ 09/17] drm/radeon: fix handling of variable sized arrays for router objects Greg Kroah-Hartman
2013-09-29 19:26 ` [ 10/17] SCSI: iscsi: dont hang in endless loop if no targets present Greg Kroah-Hartman
2013-09-29 19:26 ` [ 11/17] cgroup: fail if monitored file and event_control are in different cgroup Greg Kroah-Hartman
2013-09-29 19:26 ` [ 12/17] perf: Clarify perf_cpu_context::active_pmu usage by renaming it to ::unique_pmu Greg Kroah-Hartman
2013-09-29 19:26 ` [ 13/17] perf: Fix perf_cgroup_switch for sw-events Greg Kroah-Hartman
2013-09-29 19:26 ` [ 14/17] fanotify: dont merge permission events Greg Kroah-Hartman
2013-09-29 19:26 ` [ 15/17] perf tools: Handle JITed code in shared memory Greg Kroah-Hartman
2013-09-29 19:26 ` Greg Kroah-Hartman [this message]
2013-09-29 19:26 ` [ 17/17] kernel-doc: bugfix - multi-line macros Greg Kroah-Hartman
2013-09-30  1:24 ` [ 00/17] 3.0.98-stable review Guenter Roeck
2013-09-30  1:50   ` Greg Kroah-Hartman
2013-10-01 19:24 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130929190758.245268941@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).