netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Lemon <jonathan.lemon@gmail.com>
To: <netdev@vger.kernel.org>, <bjorn.topel@intel.com>,
	<magnus.karlsson@intel.com>, <saeedm@mellanox.com>,
	<maximmi@mellanox.com>, <brouer@redhat.com>
Cc: <kernel-team@fb.com>
Subject: [PATCH 1/6 bpf-next] Have xsk_umem_peek_addr_rq() return chunk-aligned handles.
Date: Thu, 27 Jun 2019 15:08:31 -0700	[thread overview]
Message-ID: <20190627220836.2572684-2-jonathan.lemon@gmail.com> (raw)
In-Reply-To: <20190627220836.2572684-1-jonathan.lemon@gmail.com>

xkq_peek_addr() returns chunk-aligned handles, so have the rq behave
the same way.  Clean up callsites.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
---
 drivers/net/ethernet/intel/i40e/i40e_xsk.c          | 2 --
 drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c        | 2 --
 drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c | 2 +-
 include/net/xdp_sock.h                              | 2 +-
 4 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
index 32bad014d76c..3b84fca1c11d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
@@ -289,8 +289,6 @@ static bool i40e_alloc_buffer_slow_zc(struct i40e_ring *rx_ring,
 		return false;
 	}
 
-	handle &= rx_ring->xsk_umem->chunk_mask;
-
 	hr = umem->headroom + XDP_PACKET_HEADROOM;
 
 	bi->dma = xdp_umem_get_dma(umem, handle);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
index 6b609553329f..a9cab3271ac9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
@@ -293,8 +293,6 @@ static bool ixgbe_alloc_buffer_slow_zc(struct ixgbe_ring *rx_ring,
 		return false;
 	}
 
-	handle &= rx_ring->xsk_umem->chunk_mask;
-
 	hr = umem->headroom + XDP_PACKET_HEADROOM;
 
 	bi->dma = xdp_umem_get_dma(umem, handle);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c
index 6a55573ec8f2..85440b1c1c3f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c
@@ -44,7 +44,7 @@ int mlx5e_xsk_page_alloc_umem(struct mlx5e_rq *rq,
 
 static inline void mlx5e_xsk_recycle_frame(struct mlx5e_rq *rq, u64 handle)
 {
-	xsk_umem_fq_reuse(rq->umem, handle & rq->umem->chunk_mask);
+	xsk_umem_fq_reuse(rq->umem, handle);
 }
 
 /* XSKRQ uses pages from UMEM, they must not be released. They are returned to
diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
index 057b159ff8b9..39516d960636 100644
--- a/include/net/xdp_sock.h
+++ b/include/net/xdp_sock.h
@@ -117,7 +117,7 @@ static inline u64 *xsk_umem_peek_addr_rq(struct xdp_umem *umem, u64 *addr)
 	if (!rq->length)
 		return xsk_umem_peek_addr(umem, addr);
 
-	*addr = rq->handles[rq->length - 1];
+	*addr = rq->handles[rq->length - 1] & umem->chunk_mask;
 	return addr;
 }
 
-- 
2.17.1


  reply	other threads:[~2019-06-27 22:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-27 22:08 [PATCH 0/6 bpf-next] xsk: reuseq cleanup Jonathan Lemon
2019-06-27 22:08 ` Jonathan Lemon [this message]
2019-06-27 22:08 ` [PATCH 2/6 bpf-next] Clean up xsk reuseq API Jonathan Lemon
2019-06-27 22:38   ` Jakub Kicinski
2019-06-28  2:31     ` Jonathan Lemon
2019-06-28 20:41       ` Jakub Kicinski
2019-06-28 21:08         ` Jonathan Lemon
2019-07-01  9:58           ` Magnus Karlsson
2019-06-27 22:08 ` [PATCH 3/6 bpf-next] Always check the recycle stack when using the umem fq Jonathan Lemon
2019-06-27 22:08 ` [PATCH 4/6 bfp-next] Simplify AF_XDP umem allocation path for Intel drivers Jonathan Lemon
2019-06-27 22:42   ` Jakub Kicinski
2019-06-28  2:36     ` Jonathan Lemon
2019-06-28 20:48       ` Jakub Kicinski
2019-06-28 21:06         ` Jonathan Lemon
2019-06-27 22:08 ` [PATCH 5/6 bpf-next] Remove use of umem _rq variants from Mellanox driver Jonathan Lemon
2019-07-01 10:04 ` [PATCH 0/6 bpf-next] xsk: reuseq cleanup Magnus Karlsson

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=20190627220836.2572684-2-jonathan.lemon@gmail.com \
    --to=jonathan.lemon@gmail.com \
    --cc=bjorn.topel@intel.com \
    --cc=brouer@redhat.com \
    --cc=kernel-team@fb.com \
    --cc=magnus.karlsson@intel.com \
    --cc=maximmi@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    /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).