bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH intel-net 0/3] intel: Rx headroom fixes
@ 2021-03-03 15:39 Maciej Fijalkowski
  2021-03-03 15:39 ` [PATCH intel-net 1/3] i40e: move headroom initialization to i40e_configure_rx_ring Maciej Fijalkowski
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Maciej Fijalkowski @ 2021-03-03 15:39 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: netdev, bpf, brouer, anthony.l.nguyen, kuba, bjorn.topel,
	magnus.karlsson, Maciej Fijalkowski

Fix Rx headroom by calling *_rx_offset() after the build_skb Rx ring
flag is set.

It was reported by Jesper in [0] that XDP_REDIRECT stopped working after
[1] patch in i40e.

Thanks and sorry!
Maciej

[0]: https://lore.kernel.org/netdev/20210301131832.0d765179@carbon/
[1]: https://lore.kernel.org/bpf/20210118151318.12324-10-maciej.fijalkowski@intel.com/

Maciej Fijalkowski (3):
  i40e: move headroom initialization to i40e_configure_rx_ring
  ice: move headroom initialization to ice_setup_rx_ctx
  ixgbe: move headroom initialization to ixgbe_configure_rx_ring

 drivers/net/ethernet/intel/i40e/i40e_main.c   | 13 +++++++++++++
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 12 ------------
 drivers/net/ethernet/intel/ice/ice_base.c     | 18 ++++++++++++++++++
 drivers/net/ethernet/intel/ice/ice_txrx.c     | 17 -----------------
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  3 ++-
 5 files changed, 33 insertions(+), 30 deletions(-)

-- 
2.20.1


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

* [PATCH intel-net 1/3] i40e: move headroom initialization to i40e_configure_rx_ring
  2021-03-03 15:39 [PATCH intel-net 0/3] intel: Rx headroom fixes Maciej Fijalkowski
@ 2021-03-03 15:39 ` Maciej Fijalkowski
  2021-03-04  8:53   ` Jesper Dangaard Brouer
  2021-03-09 14:04   ` [Intel-wired-lan] " Bhandare, KiranX
  2021-03-03 15:39 ` [PATCH intel-net 2/3] ice: move headroom initialization to ice_setup_rx_ctx Maciej Fijalkowski
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Maciej Fijalkowski @ 2021-03-03 15:39 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: netdev, bpf, brouer, anthony.l.nguyen, kuba, bjorn.topel,
	magnus.karlsson, Maciej Fijalkowski

i40e_rx_offset(), that is supposed to initialize the Rx buffer headroom,
relies on I40E_RXR_FLAGS_BUILD_SKB_ENABLED flag.

Currently, the callsite of mentioned function is placed incorrectly
within i40e_setup_rx_descriptors() where Rx ring's build skb flag is not
set yet. This causes the XDP_REDIRECT to be partially broken due to
inability to create xdp_frame in the headroom space, as the headroom is
0.

For the record, below is the call graph:

i40e_vsi_open
 i40e_vsi_setup_rx_resources
  i40e_setup_rx_descriptors
   i40e_rx_offset() <-- sets offset to 0 as build_skb flag is set below

 i40e_vsi_configure_rx
  i40e_configure_rx_ring
   set_ring_build_skb_enabled(ring) <-- set build_skb flag

Fix this by moving i40e_rx_offset() to i40e_configure_rx_ring() after
the flag setting.

Fixes: f7bb0d71d658 ("i40e: store the result of i40e_rx_offset() onto i40e_ring")
Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
Co-developed-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 13 +++++++++++++
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 12 ------------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 2966b4766afd..472750e69259 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -3273,6 +3273,17 @@ static int i40e_configure_tx_ring(struct i40e_ring *ring)
 	return 0;
 }
 
+/**
+ * i40e_rx_offset - Return expected offset into page to access data
+ * @rx_ring: Ring we are requesting offset of
+ *
+ * Returns the offset value for ring into the data buffer.
+ */
+static unsigned int i40e_rx_offset(struct i40e_ring *rx_ring)
+{
+	return ring_uses_build_skb(rx_ring) ? I40E_SKB_PAD : 0;
+}
+
 /**
  * i40e_configure_rx_ring - Configure a receive ring context
  * @ring: The Rx ring to configure
@@ -3387,6 +3398,8 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
 	else
 		set_ring_build_skb_enabled(ring);
 
+	ring->rx_offset = i40e_rx_offset(ring);
+
 	/* cache tail for quicker writes, and clear the reg before use */
 	ring->tail = hw->hw_addr + I40E_QRX_TAIL(pf_q);
 	writel(0, ring->tail);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index b2008f72494d..bffb881f7102 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -1569,17 +1569,6 @@ void i40e_free_rx_resources(struct i40e_ring *rx_ring)
 	}
 }
 
-/**
- * i40e_rx_offset - Return expected offset into page to access data
- * @rx_ring: Ring we are requesting offset of
- *
- * Returns the offset value for ring into the data buffer.
- */
-static unsigned int i40e_rx_offset(struct i40e_ring *rx_ring)
-{
-	return ring_uses_build_skb(rx_ring) ? I40E_SKB_PAD : 0;
-}
-
 /**
  * i40e_setup_rx_descriptors - Allocate Rx descriptors
  * @rx_ring: Rx descriptor ring (for a specific queue) to setup
@@ -1608,7 +1597,6 @@ int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring)
 	rx_ring->next_to_alloc = 0;
 	rx_ring->next_to_clean = 0;
 	rx_ring->next_to_use = 0;
-	rx_ring->rx_offset = i40e_rx_offset(rx_ring);
 
 	/* XDP RX-queue info only needed for RX rings exposed to XDP */
 	if (rx_ring->vsi->type == I40E_VSI_MAIN) {
-- 
2.20.1


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

* [PATCH intel-net 2/3] ice: move headroom initialization to ice_setup_rx_ctx
  2021-03-03 15:39 [PATCH intel-net 0/3] intel: Rx headroom fixes Maciej Fijalkowski
  2021-03-03 15:39 ` [PATCH intel-net 1/3] i40e: move headroom initialization to i40e_configure_rx_ring Maciej Fijalkowski
@ 2021-03-03 15:39 ` Maciej Fijalkowski
  2021-03-09 14:02   ` [Intel-wired-lan] " Bhandare, KiranX
  2021-03-03 15:39 ` [PATCH intel-net 3/3] ixgbe: move headroom initialization to ixgbe_configure_rx_ring Maciej Fijalkowski
  2021-03-03 18:36 ` [Intel-wired-lan] [PATCH intel-net 0/3] intel: Rx headroom fixes Jesse Brandeburg
  3 siblings, 1 reply; 9+ messages in thread
From: Maciej Fijalkowski @ 2021-03-03 15:39 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: netdev, bpf, brouer, anthony.l.nguyen, kuba, bjorn.topel,
	magnus.karlsson, Maciej Fijalkowski

ice_rx_offset(), that is supposed to initialize the Rx buffer headroom,
relies on ICE_RX_FLAGS_RING_BUILD_SKB flag as well as XDP prog presence.

Currently, the callsite of mentioned function is placed incorrectly
within ice_setup_rx_ring() where Rx ring's build skb flag is not
set yet. This causes the XDP_REDIRECT to be partially broken due to
inability to create xdp_frame in the headroom space, as the headroom is
0.

Fix this by moving ice_rx_offset() to ice_setup_rx_ctx() after the flag
setting.

Fixes: f1b1f409bf79 ("ice: store the result of ice_rx_offset() onto ice_ring")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_base.c | 18 ++++++++++++++++++
 drivers/net/ethernet/intel/ice/ice_txrx.c | 17 -----------------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
index 3124a3bf519a..95f674bd52c3 100644
--- a/drivers/net/ethernet/intel/ice/ice_base.c
+++ b/drivers/net/ethernet/intel/ice/ice_base.c
@@ -274,6 +274,22 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)
 	tlan_ctx->legacy_int = ICE_TX_LEGACY;
 }
 
+/**
+ * ice_rx_offset - Return expected offset into page to access data
+ * @rx_ring: Ring we are requesting offset of
+ *
+ * Returns the offset value for ring into the data buffer.
+ */
+static unsigned int ice_rx_offset(struct ice_ring *rx_ring)
+{
+	if (ice_ring_uses_build_skb(rx_ring))
+		return ICE_SKB_PAD;
+	else if (ice_is_xdp_ena_vsi(rx_ring->vsi))
+		return XDP_PACKET_HEADROOM;
+
+	return 0;
+}
+
 /**
  * ice_setup_rx_ctx - Configure a receive ring context
  * @ring: The Rx ring to configure
@@ -413,6 +429,8 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
 	else
 		ice_set_ring_build_skb_ena(ring);
 
+	ring->rx_offset = ice_rx_offset(ring);
+
 	/* init queue specific tail register */
 	ring->tail = hw->hw_addr + QRX_TAIL(pf_q);
 	writel(0, ring->tail);
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c
index b7dc25da1202..b91dcfd12727 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
@@ -443,22 +443,6 @@ void ice_free_rx_ring(struct ice_ring *rx_ring)
 	}
 }
 
-/**
- * ice_rx_offset - Return expected offset into page to access data
- * @rx_ring: Ring we are requesting offset of
- *
- * Returns the offset value for ring into the data buffer.
- */
-static unsigned int ice_rx_offset(struct ice_ring *rx_ring)
-{
-	if (ice_ring_uses_build_skb(rx_ring))
-		return ICE_SKB_PAD;
-	else if (ice_is_xdp_ena_vsi(rx_ring->vsi))
-		return XDP_PACKET_HEADROOM;
-
-	return 0;
-}
-
 /**
  * ice_setup_rx_ring - Allocate the Rx descriptors
  * @rx_ring: the Rx ring to set up
@@ -493,7 +477,6 @@ int ice_setup_rx_ring(struct ice_ring *rx_ring)
 
 	rx_ring->next_to_use = 0;
 	rx_ring->next_to_clean = 0;
-	rx_ring->rx_offset = ice_rx_offset(rx_ring);
 
 	if (ice_is_xdp_ena_vsi(rx_ring->vsi))
 		WRITE_ONCE(rx_ring->xdp_prog, rx_ring->vsi->xdp_prog);
-- 
2.20.1


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

* [PATCH intel-net 3/3] ixgbe: move headroom initialization to ixgbe_configure_rx_ring
  2021-03-03 15:39 [PATCH intel-net 0/3] intel: Rx headroom fixes Maciej Fijalkowski
  2021-03-03 15:39 ` [PATCH intel-net 1/3] i40e: move headroom initialization to i40e_configure_rx_ring Maciej Fijalkowski
  2021-03-03 15:39 ` [PATCH intel-net 2/3] ice: move headroom initialization to ice_setup_rx_ctx Maciej Fijalkowski
@ 2021-03-03 15:39 ` Maciej Fijalkowski
  2021-03-09 16:27   ` [Intel-wired-lan] " Jambekar, Vishakha
  2021-03-03 18:36 ` [Intel-wired-lan] [PATCH intel-net 0/3] intel: Rx headroom fixes Jesse Brandeburg
  3 siblings, 1 reply; 9+ messages in thread
From: Maciej Fijalkowski @ 2021-03-03 15:39 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: netdev, bpf, brouer, anthony.l.nguyen, kuba, bjorn.topel,
	magnus.karlsson, Maciej Fijalkowski

ixgbe_rx_offset(), that is supposed to initialize the Rx buffer headroom,
relies on __IXGBE_RX_BUILD_SKB_ENABLED flag.

Currently, the callsite of mentioned function is placed incorrectly
within ixgbe_setup_rx_resources() where Rx ring's build skb flag is not
set yet. This causes the XDP_REDIRECT to be partially broken due to
inability to create xdp_frame in the headroom space, as the headroom is
0.

Fix this by moving ixgbe_rx_offset() to ixgbe_configure_rx_ring() after
the flag setting, which happens to be set in ixgbe_set_rx_buffer_len.

Fixes: c0d4e9d223c5 ("ixgbe: store the result of ixgbe_rx_offset() onto ixgbe_ring")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index fae84202d870..ac0d7a80de0d 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -4118,6 +4118,8 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter,
 #endif
 	}
 
+	ring->rx_offset = ixgbe_rx_offset(ring);
+
 	if (ring->xsk_pool && hw->mac.type != ixgbe_mac_82599EB) {
 		u32 xsk_buf_len = xsk_pool_get_rx_frame_size(ring->xsk_pool);
 
@@ -6578,7 +6580,6 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
 
 	rx_ring->next_to_clean = 0;
 	rx_ring->next_to_use = 0;
-	rx_ring->rx_offset = ixgbe_rx_offset(rx_ring);
 
 	/* XDP RX-queue info */
 	if (xdp_rxq_info_reg(&rx_ring->xdp_rxq, adapter->netdev,
-- 
2.20.1


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

* Re: [Intel-wired-lan] [PATCH intel-net 0/3] intel: Rx headroom fixes
  2021-03-03 15:39 [PATCH intel-net 0/3] intel: Rx headroom fixes Maciej Fijalkowski
                   ` (2 preceding siblings ...)
  2021-03-03 15:39 ` [PATCH intel-net 3/3] ixgbe: move headroom initialization to ixgbe_configure_rx_ring Maciej Fijalkowski
@ 2021-03-03 18:36 ` Jesse Brandeburg
  3 siblings, 0 replies; 9+ messages in thread
From: Jesse Brandeburg @ 2021-03-03 18:36 UTC (permalink / raw)
  To: Maciej Fijalkowski
  Cc: intel-wired-lan, netdev, brouer, kuba, bpf, bjorn.topel, magnus.karlsson

Maciej Fijalkowski wrote:

> Fix Rx headroom by calling *_rx_offset() after the build_skb Rx ring
> flag is set.
> 
> It was reported by Jesper in [0] that XDP_REDIRECT stopped working after
> [1] patch in i40e.

Looks good to me, thanks for the fixes Maciej, and especially to
Jesper for the report of the issue.

For the series: 
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>

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

* Re: [PATCH intel-net 1/3] i40e: move headroom initialization to i40e_configure_rx_ring
  2021-03-03 15:39 ` [PATCH intel-net 1/3] i40e: move headroom initialization to i40e_configure_rx_ring Maciej Fijalkowski
@ 2021-03-04  8:53   ` Jesper Dangaard Brouer
  2021-03-09 14:04   ` [Intel-wired-lan] " Bhandare, KiranX
  1 sibling, 0 replies; 9+ messages in thread
From: Jesper Dangaard Brouer @ 2021-03-04  8:53 UTC (permalink / raw)
  To: Maciej Fijalkowski
  Cc: intel-wired-lan, netdev, bpf, anthony.l.nguyen, kuba,
	bjorn.topel, magnus.karlsson, brouer, Zhiqian Guan, Jean Hsiao

On Wed,  3 Mar 2021 16:39:26 +0100
Maciej Fijalkowski <maciej.fijalkowski@intel.com> wrote:

> i40e_rx_offset(), that is supposed to initialize the Rx buffer headroom,
> relies on I40E_RXR_FLAGS_BUILD_SKB_ENABLED flag.
> 
> Currently, the callsite of mentioned function is placed incorrectly
> within i40e_setup_rx_descriptors() where Rx ring's build skb flag is not
> set yet. This causes the XDP_REDIRECT to be partially broken due to
> inability to create xdp_frame in the headroom space, as the headroom is
> 0.
> 
> For the record, below is the call graph:
> 
> i40e_vsi_open
>  i40e_vsi_setup_rx_resources
>   i40e_setup_rx_descriptors
>    i40e_rx_offset() <-- sets offset to 0 as build_skb flag is set below
> 
>  i40e_vsi_configure_rx
>   i40e_configure_rx_ring
>    set_ring_build_skb_enabled(ring) <-- set build_skb flag
> 
> Fix this by moving i40e_rx_offset() to i40e_configure_rx_ring() after
> the flag setting.
> 
> Fixes: f7bb0d71d658 ("i40e: store the result of i40e_rx_offset() onto i40e_ring")
> Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Co-developed-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 13 +++++++++++++
>  drivers/net/ethernet/intel/i40e/i40e_txrx.c | 12 ------------
>  2 files changed, 13 insertions(+), 12 deletions(-)

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Tested-by: Jesper Dangaard Brouer <brouer@redhat.com>

I'm currently looking at extending samples/bpf/ xdp_redirect_map to
detect the situation.  As with this bug the redirect tests/sample
programs will just report really high performance numbers (because
packets are dropped earlier due to err).   Knowing what performance
numbers to expect, I could see that they were out-of-spec, and
investigated the root-cause.

I assume Intel QA tested XDP-redirect and didn't find the bug due to
this.  Red Hat QA also use samples/bpf/xdp* and based on the reports I
get from them, I could not blame them if this bug would slip through,
as the tool reports "good" results.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer


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

* RE: [Intel-wired-lan] [PATCH intel-net 2/3] ice: move headroom initialization to ice_setup_rx_ctx
  2021-03-03 15:39 ` [PATCH intel-net 2/3] ice: move headroom initialization to ice_setup_rx_ctx Maciej Fijalkowski
@ 2021-03-09 14:02   ` Bhandare, KiranX
  0 siblings, 0 replies; 9+ messages in thread
From: Bhandare, KiranX @ 2021-03-09 14:02 UTC (permalink / raw)
  To: Fijalkowski, Maciej, intel-wired-lan
  Cc: netdev, brouer, kuba, bpf, Topel, Bjorn, Karlsson, Magnus

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Maciej Fijalkowski
> Sent: Wednesday, March 3, 2021 9:09 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; brouer@redhat.com; kuba@kernel.org;
> bpf@vger.kernel.org; Topel, Bjorn <bjorn.topel@intel.com>; Karlsson,
> Magnus <magnus.karlsson@intel.com>
> Subject: [Intel-wired-lan] [PATCH intel-net 2/3] ice: move headroom
> initialization to ice_setup_rx_ctx
> 
> ice_rx_offset(), that is supposed to initialize the Rx buffer headroom, relies
> on ICE_RX_FLAGS_RING_BUILD_SKB flag as well as XDP prog presence.
> 
> Currently, the callsite of mentioned function is placed incorrectly within
> ice_setup_rx_ring() where Rx ring's build skb flag is not set yet. This causes
> the XDP_REDIRECT to be partially broken due to inability to create xdp_frame
> in the headroom space, as the headroom is 0.
> 
> Fix this by moving ice_rx_offset() to ice_setup_rx_ctx() after the flag setting.
> 
> Fixes: f1b1f409bf79 ("ice: store the result of ice_rx_offset() onto ice_ring")
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_base.c | 18 ++++++++++++++++++
> drivers/net/ethernet/intel/ice/ice_txrx.c | 17 -----------------
>  2 files changed, 18 insertions(+), 17 deletions(-)
> 

Tested-by: Kiran Bhandare <kiranx.bhandare@intel.com>  A Contingent Worker at Intel

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

* RE: [Intel-wired-lan] [PATCH intel-net 1/3] i40e: move headroom initialization to i40e_configure_rx_ring
  2021-03-03 15:39 ` [PATCH intel-net 1/3] i40e: move headroom initialization to i40e_configure_rx_ring Maciej Fijalkowski
  2021-03-04  8:53   ` Jesper Dangaard Brouer
@ 2021-03-09 14:04   ` Bhandare, KiranX
  1 sibling, 0 replies; 9+ messages in thread
From: Bhandare, KiranX @ 2021-03-09 14:04 UTC (permalink / raw)
  To: Fijalkowski, Maciej, intel-wired-lan
  Cc: netdev, brouer, kuba, bpf, Topel, Bjorn, Karlsson, Magnus

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Maciej Fijalkowski
> Sent: Wednesday, March 3, 2021 9:09 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; brouer@redhat.com; kuba@kernel.org;
> bpf@vger.kernel.org; Topel, Bjorn <bjorn.topel@intel.com>; Karlsson,
> Magnus <magnus.karlsson@intel.com>
> Subject: [Intel-wired-lan] [PATCH intel-net 1/3] i40e: move headroom
> initialization to i40e_configure_rx_ring
> 
> i40e_rx_offset(), that is supposed to initialize the Rx buffer headroom, relies
> on I40E_RXR_FLAGS_BUILD_SKB_ENABLED flag.
> 
> Currently, the callsite of mentioned function is placed incorrectly within
> i40e_setup_rx_descriptors() where Rx ring's build skb flag is not set yet. This
> causes the XDP_REDIRECT to be partially broken due to inability to create
> xdp_frame in the headroom space, as the headroom is 0.
> 
> For the record, below is the call graph:
> 
> i40e_vsi_open
>  i40e_vsi_setup_rx_resources
>   i40e_setup_rx_descriptors
>    i40e_rx_offset() <-- sets offset to 0 as build_skb flag is set below
> 
>  i40e_vsi_configure_rx
>   i40e_configure_rx_ring
>    set_ring_build_skb_enabled(ring) <-- set build_skb flag
> 
> Fix this by moving i40e_rx_offset() to i40e_configure_rx_ring() after the flag
> setting.
> 
> Fixes: f7bb0d71d658 ("i40e: store the result of i40e_rx_offset() onto
> i40e_ring")
> Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Co-developed-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 13 +++++++++++++
> drivers/net/ethernet/intel/i40e/i40e_txrx.c | 12 ------------
>  2 files changed, 13 insertions(+), 12 deletions(-)
> 

Tested-by: Kiran Bhandare <kiranx.bhandare@intel.com>  A Contingent Worker at Intel

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

* RE: [Intel-wired-lan] [PATCH intel-net 3/3] ixgbe: move headroom initialization to ixgbe_configure_rx_ring
  2021-03-03 15:39 ` [PATCH intel-net 3/3] ixgbe: move headroom initialization to ixgbe_configure_rx_ring Maciej Fijalkowski
@ 2021-03-09 16:27   ` Jambekar, Vishakha
  0 siblings, 0 replies; 9+ messages in thread
From: Jambekar, Vishakha @ 2021-03-09 16:27 UTC (permalink / raw)
  To: Fijalkowski, Maciej, intel-wired-lan
  Cc: netdev, brouer, kuba, bpf, Topel, Bjorn, Karlsson, Magnus

> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Maciej Fijalkowski
> Sent: Wednesday, March 3, 2021 9:09 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; brouer@redhat.com; kuba@kernel.org;
> bpf@vger.kernel.org; Topel, Bjorn <bjorn.topel@intel.com>; Karlsson,
> Magnus <magnus.karlsson@intel.com>
> Subject: [Intel-wired-lan] [PATCH intel-net 3/3] ixgbe: move headroom
> initialization to ixgbe_configure_rx_ring
> 
> ixgbe_rx_offset(), that is supposed to initialize the Rx buffer headroom, relies
> on __IXGBE_RX_BUILD_SKB_ENABLED flag.
> 
> Currently, the callsite of mentioned function is placed incorrectly within
> ixgbe_setup_rx_resources() where Rx ring's build skb flag is not set yet. This
> causes the XDP_REDIRECT to be partially broken due to inability to create
> xdp_frame in the headroom space, as the headroom is 0.
> 
> Fix this by moving ixgbe_rx_offset() to ixgbe_configure_rx_ring() after the
> flag setting, which happens to be set in ixgbe_set_rx_buffer_len.
> 
> Fixes: c0d4e9d223c5 ("ixgbe: store the result of ixgbe_rx_offset() onto
> ixgbe_ring")
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
Tested-by: Vishakha Jambekar <vishakha.jambekar@intel.com>

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

end of thread, other threads:[~2021-03-09 16:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03 15:39 [PATCH intel-net 0/3] intel: Rx headroom fixes Maciej Fijalkowski
2021-03-03 15:39 ` [PATCH intel-net 1/3] i40e: move headroom initialization to i40e_configure_rx_ring Maciej Fijalkowski
2021-03-04  8:53   ` Jesper Dangaard Brouer
2021-03-09 14:04   ` [Intel-wired-lan] " Bhandare, KiranX
2021-03-03 15:39 ` [PATCH intel-net 2/3] ice: move headroom initialization to ice_setup_rx_ctx Maciej Fijalkowski
2021-03-09 14:02   ` [Intel-wired-lan] " Bhandare, KiranX
2021-03-03 15:39 ` [PATCH intel-net 3/3] ixgbe: move headroom initialization to ixgbe_configure_rx_ring Maciej Fijalkowski
2021-03-09 16:27   ` [Intel-wired-lan] " Jambekar, Vishakha
2021-03-03 18:36 ` [Intel-wired-lan] [PATCH intel-net 0/3] intel: Rx headroom fixes Jesse Brandeburg

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).