BPF Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock
@ 2019-09-13 10:39 Ciara Loftus
  2019-09-13 10:39 ` [PATCH bpf-next v2 1/3] i40e: fix xdp handle calculations Ciara Loftus
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ciara Loftus @ 2019-09-13 10:39 UTC (permalink / raw)
  To: netdev, ast, daniel, bjorn.topel, magnus.karlsson, jonathan.lemon
  Cc: bruce.richardson, bpf, intel-wired-lan, kevin.laatz, Ciara Loftus

This patch set contains some fixes for AF_XDP zero copy in the i40e and
ixgbe drivers as well as a fix for the 'xdpsock' sample application when
running in unaligned mode.

Patches 1 and 2 fix a regression for the i40e and ixgbe drivers which
caused the umem headroom to be added to the xdp handle twice, resulting in
an incorrect value being received by the user for the case where the umem
headroom is non-zero.

Patch 3 fixes an issue with the xdpsock sample application whereby the
start of the tx packet data (offset) was not being set correctly when the
application was being run in unaligned mode.

This patch set has been applied against commit a2c11b034142 ("kcm: use
BPF_PROG_RUN")

---
v2:
- Rearranged local variable order in i40e_run_xdp_zc and ixgbe_run_xdp_zc
to comply with coding standards.

Ciara Loftus (3):
  i40e: fix xdp handle calculations
  ixgbe: fix xdp handle calculations
  samples/bpf: fix xdpsock l2fwd tx for unaligned mode

 drivers/net/ethernet/intel/i40e/i40e_xsk.c   | 4 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 4 ++--
 samples/bpf/xdpsock_user.c                   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH bpf-next v2 1/3] i40e: fix xdp handle calculations
  2019-09-13 10:39 [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock Ciara Loftus
@ 2019-09-13 10:39 ` Ciara Loftus
  2019-09-13 10:39 ` [PATCH bpf-next v2 2/3] ixgbe: " Ciara Loftus
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ciara Loftus @ 2019-09-13 10:39 UTC (permalink / raw)
  To: netdev, ast, daniel, bjorn.topel, magnus.karlsson, jonathan.lemon
  Cc: bruce.richardson, bpf, intel-wired-lan, kevin.laatz, Ciara Loftus

Commit 4c5d9a7fa149 ("i40e: fix xdp handle calculations") reintroduced
the addition of the umem headroom to the xdp handle in the i40e_zca_free,
i40e_alloc_buffer_slow_zc and i40e_alloc_buffer_zc functions. However,
the headroom is already added to the handle in the function i40_run_xdp_zc.
This commit removes the latter addition and fixes the case where the
headroom is non-zero.

Fixes: 4c5d9a7fa149 ("i40e: fix xdp handle calculations")
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_xsk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
index 0373bc6c7e61..a05dfecdd9b4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
@@ -192,9 +192,9 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
 {
 	struct xdp_umem *umem = rx_ring->xsk_umem;
 	int err, result = I40E_XDP_PASS;
-	u64 offset = umem->headroom;
 	struct i40e_ring *xdp_ring;
 	struct bpf_prog *xdp_prog;
+	u64 offset;
 	u32 act;
 
 	rcu_read_lock();
@@ -203,7 +203,7 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
 	 */
 	xdp_prog = READ_ONCE(rx_ring->xdp_prog);
 	act = bpf_prog_run_xdp(xdp_prog, xdp);
-	offset += xdp->data - xdp->data_hard_start;
+	offset = xdp->data - xdp->data_hard_start;
 
 	xdp->handle = xsk_umem_adjust_offset(umem, xdp->handle, offset);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH bpf-next v2 2/3] ixgbe: fix xdp handle calculations
  2019-09-13 10:39 [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock Ciara Loftus
  2019-09-13 10:39 ` [PATCH bpf-next v2 1/3] i40e: fix xdp handle calculations Ciara Loftus
@ 2019-09-13 10:39 ` " Ciara Loftus
  2019-09-13 10:39 ` [PATCH bpf-next v2 3/3] samples/bpf: fix xdpsock l2fwd tx for unaligned mode Ciara Loftus
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ciara Loftus @ 2019-09-13 10:39 UTC (permalink / raw)
  To: netdev, ast, daniel, bjorn.topel, magnus.karlsson, jonathan.lemon
  Cc: bruce.richardson, bpf, intel-wired-lan, kevin.laatz, Ciara Loftus

Commit 7cbbf9f1fa23 ("ixgbe: fix xdp handle calculations") reintroduced
the addition of the umem headroom to the xdp handle in the ixgbe_zca_free,
ixgbe_alloc_buffer_slow_zc and ixgbe_alloc_buffer_zc functions. However,
the headroom is already added to the handle in the function
ixgbe_run_xdp_zc. This commit removes the latter addition and fixes the
case where the headroom is non-zero.

Fixes: 7cbbf9f1fa23 ("ixgbe: fix xdp handle calculations")
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
index ad802a8909e0..fd45d12b5a98 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
@@ -145,15 +145,15 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter,
 {
 	struct xdp_umem *umem = rx_ring->xsk_umem;
 	int err, result = IXGBE_XDP_PASS;
-	u64 offset = umem->headroom;
 	struct bpf_prog *xdp_prog;
 	struct xdp_frame *xdpf;
+	u64 offset;
 	u32 act;
 
 	rcu_read_lock();
 	xdp_prog = READ_ONCE(rx_ring->xdp_prog);
 	act = bpf_prog_run_xdp(xdp_prog, xdp);
-	offset += xdp->data - xdp->data_hard_start;
+	offset = xdp->data - xdp->data_hard_start;
 
 	xdp->handle = xsk_umem_adjust_offset(umem, xdp->handle, offset);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH bpf-next v2 3/3] samples/bpf: fix xdpsock l2fwd tx for unaligned mode
  2019-09-13 10:39 [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock Ciara Loftus
  2019-09-13 10:39 ` [PATCH bpf-next v2 1/3] i40e: fix xdp handle calculations Ciara Loftus
  2019-09-13 10:39 ` [PATCH bpf-next v2 2/3] ixgbe: " Ciara Loftus
@ 2019-09-13 10:39 ` Ciara Loftus
  2019-09-13 11:16 ` [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock Björn Töpel
  2019-09-16  8:18 ` Daniel Borkmann
  4 siblings, 0 replies; 6+ messages in thread
From: Ciara Loftus @ 2019-09-13 10:39 UTC (permalink / raw)
  To: netdev, ast, daniel, bjorn.topel, magnus.karlsson, jonathan.lemon
  Cc: bruce.richardson, bpf, intel-wired-lan, kevin.laatz, Ciara Loftus

Preserve the offset of the address of the received descriptor, and include
it in the address set for the tx descriptor, so the kernel can correctly
locate the start of the packet data.

Fixes: 03895e63ff97 ("samples/bpf: add buffer recycling for unaligned chunks to xdpsock")
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
 samples/bpf/xdpsock_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c
index 102eace22956..df011ac33402 100644
--- a/samples/bpf/xdpsock_user.c
+++ b/samples/bpf/xdpsock_user.c
@@ -685,7 +685,7 @@ static void l2fwd(struct xsk_socket_info *xsk, struct pollfd *fds)
 	for (i = 0; i < rcvd; i++) {
 		u64 addr = xsk_ring_cons__rx_desc(&xsk->rx, idx_rx)->addr;
 		u32 len = xsk_ring_cons__rx_desc(&xsk->rx, idx_rx++)->len;
-		u64 orig = xsk_umem__extract_addr(addr);
+		u64 orig = addr;
 
 		addr = xsk_umem__add_offset_to_addr(addr);
 		char *pkt = xsk_umem__get_data(xsk->umem->buffer, addr);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock
  2019-09-13 10:39 [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock Ciara Loftus
                   ` (2 preceding siblings ...)
  2019-09-13 10:39 ` [PATCH bpf-next v2 3/3] samples/bpf: fix xdpsock l2fwd tx for unaligned mode Ciara Loftus
@ 2019-09-13 11:16 ` Björn Töpel
  2019-09-16  8:18 ` Daniel Borkmann
  4 siblings, 0 replies; 6+ messages in thread
From: Björn Töpel @ 2019-09-13 11:16 UTC (permalink / raw)
  To: Ciara Loftus, netdev, ast, daniel, magnus.karlsson, jonathan.lemon
  Cc: bruce.richardson, bpf, intel-wired-lan, kevin.laatz

On 2019-09-13 12:39, Ciara Loftus wrote:
> This patch set contains some fixes for AF_XDP zero copy in the i40e and
> ixgbe drivers as well as a fix for the 'xdpsock' sample application when
> running in unaligned mode.
> 
> Patches 1 and 2 fix a regression for the i40e and ixgbe drivers which
> caused the umem headroom to be added to the xdp handle twice, resulting in
> an incorrect value being received by the user for the case where the umem
> headroom is non-zero.
> 
> Patch 3 fixes an issue with the xdpsock sample application whereby the
> start of the tx packet data (offset) was not being set correctly when the
> application was being run in unaligned mode.
> 
> This patch set has been applied against commit a2c11b034142 ("kcm: use
> BPF_PROG_RUN")
> 
> ---
> v2:
> - Rearranged local variable order in i40e_run_xdp_zc and ixgbe_run_xdp_zc
> to comply with coding standards.
>

Thanks Ciara!

Acked-by: Björn Töpel <bjorn.topel@intel.com>


> Ciara Loftus (3):
>    i40e: fix xdp handle calculations
>    ixgbe: fix xdp handle calculations
>    samples/bpf: fix xdpsock l2fwd tx for unaligned mode
> 
>   drivers/net/ethernet/intel/i40e/i40e_xsk.c   | 4 ++--
>   drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 4 ++--
>   samples/bpf/xdpsock_user.c                   | 2 +-
>   3 files changed, 5 insertions(+), 5 deletions(-)
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock
  2019-09-13 10:39 [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock Ciara Loftus
                   ` (3 preceding siblings ...)
  2019-09-13 11:16 ` [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock Björn Töpel
@ 2019-09-16  8:18 ` Daniel Borkmann
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Borkmann @ 2019-09-16  8:18 UTC (permalink / raw)
  To: Ciara Loftus, netdev, ast, bjorn.topel, magnus.karlsson, jonathan.lemon
  Cc: bruce.richardson, bpf, intel-wired-lan, kevin.laatz

On 9/13/19 12:39 PM, Ciara Loftus wrote:
> This patch set contains some fixes for AF_XDP zero copy in the i40e and
> ixgbe drivers as well as a fix for the 'xdpsock' sample application when
> running in unaligned mode.
> 
> Patches 1 and 2 fix a regression for the i40e and ixgbe drivers which
> caused the umem headroom to be added to the xdp handle twice, resulting in
> an incorrect value being received by the user for the case where the umem
> headroom is non-zero.
> 
> Patch 3 fixes an issue with the xdpsock sample application whereby the
> start of the tx packet data (offset) was not being set correctly when the
> application was being run in unaligned mode.
> 
> This patch set has been applied against commit a2c11b034142 ("kcm: use
> BPF_PROG_RUN")
> 
> ---
> v2:
> - Rearranged local variable order in i40e_run_xdp_zc and ixgbe_run_xdp_zc
> to comply with coding standards.
> 
> Ciara Loftus (3):
>    i40e: fix xdp handle calculations
>    ixgbe: fix xdp handle calculations
>    samples/bpf: fix xdpsock l2fwd tx for unaligned mode
> 
>   drivers/net/ethernet/intel/i40e/i40e_xsk.c   | 4 ++--
>   drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 4 ++--
>   samples/bpf/xdpsock_user.c                   | 2 +-
>   3 files changed, 5 insertions(+), 5 deletions(-)
> 

Applied, thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13 10:39 [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock Ciara Loftus
2019-09-13 10:39 ` [PATCH bpf-next v2 1/3] i40e: fix xdp handle calculations Ciara Loftus
2019-09-13 10:39 ` [PATCH bpf-next v2 2/3] ixgbe: " Ciara Loftus
2019-09-13 10:39 ` [PATCH bpf-next v2 3/3] samples/bpf: fix xdpsock l2fwd tx for unaligned mode Ciara Loftus
2019-09-13 11:16 ` [PATCH bpf-next v2 0/3] AF_XDP fixes for i40e, ixgbe and xdpsock Björn Töpel
2019-09-16  8:18 ` Daniel Borkmann

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org bpf@archiver.kernel.org
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/ public-inbox