All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] i40e: sync next_to_clean and next_to_process for programming status desc
@ 2023-10-19 20:38 Jacob Keller
  2023-10-20 10:56 ` Maciej Fijalkowski
  2023-10-21  2:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 6+ messages in thread
From: Jacob Keller @ 2023-10-19 20:38 UTC (permalink / raw)
  To: netdev, David Miller, Jakub Kicinski
  Cc: Tirthendu Sarkar, Maciej Fijalkowski, hq.dev+kernel,
	Arpana Arland, Jacob Keller

From: Tirthendu Sarkar <tirthendu.sarkar@intel.com>

When a programming status desc is encountered on the rx_ring,
next_to_process is bumped along with cleaned_count but next_to_clean is
not. This causes I40E_DESC_UNUSED() macro to misbehave resulting in
overwriting whole ring with new buffers.

Update next_to_clean to point to next_to_process on seeing a programming
status desc if not in the middle of handling a multi-frag packet. Also,
bump cleaned_count only for such case as otherwise next_to_clean buffer
may be returned to hardware on reaching clean_threshold.

Fixes: e9031f2da1ae ("i40e: introduce next_to_process to i40e_ring")
Suggested-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reported-by: hq.dev+kernel@msdfc.xyz
Reported by: Solomon Peachy <pizza@shaftnet.org>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217678
Tested-by: hq.dev+kernel@msdfc.xyz
Tested by: Indrek Järve <incx@dustbite.net>
Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel)
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 0b3a27f118fb..50c70a8e470a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2544,7 +2544,14 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget,
 			rx_buffer = i40e_rx_bi(rx_ring, ntp);
 			i40e_inc_ntp(rx_ring);
 			i40e_reuse_rx_page(rx_ring, rx_buffer);
-			cleaned_count++;
+			/* Update ntc and bump cleaned count if not in the
+			 * middle of mb packet.
+			 */
+			if (rx_ring->next_to_clean == ntp) {
+				rx_ring->next_to_clean =
+					rx_ring->next_to_process;
+				cleaned_count++;
+			}
 			continue;
 		}
 

base-commit: ce55c22ec8b223a90ff3e084d842f73cfba35588
-- 
2.41.0


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

* Re: [PATCH net] i40e: sync next_to_clean and next_to_process for programming status desc
  2023-10-19 20:38 [PATCH net] i40e: sync next_to_clean and next_to_process for programming status desc Jacob Keller
@ 2023-10-20 10:56 ` Maciej Fijalkowski
  2023-10-20 17:19   ` Jacob Keller
  2023-10-21  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 6+ messages in thread
From: Maciej Fijalkowski @ 2023-10-20 10:56 UTC (permalink / raw)
  To: Jacob Keller
  Cc: netdev, David Miller, Jakub Kicinski, Tirthendu Sarkar,
	hq.dev+kernel, Arpana Arland

On Thu, Oct 19, 2023 at 01:38:52PM -0700, Jacob Keller wrote:
> From: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
> 
> When a programming status desc is encountered on the rx_ring,
> next_to_process is bumped along with cleaned_count but next_to_clean is
> not. This causes I40E_DESC_UNUSED() macro to misbehave resulting in
> overwriting whole ring with new buffers.
> 
> Update next_to_clean to point to next_to_process on seeing a programming
> status desc if not in the middle of handling a multi-frag packet. Also,
> bump cleaned_count only for such case as otherwise next_to_clean buffer
> may be returned to hardware on reaching clean_threshold.
> 
> Fixes: e9031f2da1ae ("i40e: introduce next_to_process to i40e_ring")
> Suggested-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> Reported-by: hq.dev+kernel@msdfc.xyz
> Reported by: Solomon Peachy <pizza@shaftnet.org>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217678
> Tested-by: hq.dev+kernel@msdfc.xyz
> Tested by: Indrek Järve <incx@dustbite.net>
> Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
> Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel)
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>

You missed my ack, so:
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

> ---
>  drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> index 0b3a27f118fb..50c70a8e470a 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> @@ -2544,7 +2544,14 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget,
>  			rx_buffer = i40e_rx_bi(rx_ring, ntp);
>  			i40e_inc_ntp(rx_ring);
>  			i40e_reuse_rx_page(rx_ring, rx_buffer);
> -			cleaned_count++;
> +			/* Update ntc and bump cleaned count if not in the
> +			 * middle of mb packet.
> +			 */
> +			if (rx_ring->next_to_clean == ntp) {
> +				rx_ring->next_to_clean =
> +					rx_ring->next_to_process;
> +				cleaned_count++;
> +			}
>  			continue;
>  		}
>  
> 
> base-commit: ce55c22ec8b223a90ff3e084d842f73cfba35588
> -- 
> 2.41.0
> 

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

* Re: [PATCH net] i40e: sync next_to_clean and next_to_process for programming status desc
  2023-10-20 10:56 ` Maciej Fijalkowski
@ 2023-10-20 17:19   ` Jacob Keller
  0 siblings, 0 replies; 6+ messages in thread
From: Jacob Keller @ 2023-10-20 17:19 UTC (permalink / raw)
  To: Maciej Fijalkowski
  Cc: netdev, David Miller, Jakub Kicinski, Tirthendu Sarkar,
	hq.dev+kernel, Arpana Arland



On 10/20/2023 3:56 AM, Maciej Fijalkowski wrote:
> On Thu, Oct 19, 2023 at 01:38:52PM -0700, Jacob Keller wrote:
>> From: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
>>
>> When a programming status desc is encountered on the rx_ring,
>> next_to_process is bumped along with cleaned_count but next_to_clean is
>> not. This causes I40E_DESC_UNUSED() macro to misbehave resulting in
>> overwriting whole ring with new buffers.
>>
>> Update next_to_clean to point to next_to_process on seeing a programming
>> status desc if not in the middle of handling a multi-frag packet. Also,
>> bump cleaned_count only for such case as otherwise next_to_clean buffer
>> may be returned to hardware on reaching clean_threshold.
>>
>> Fixes: e9031f2da1ae ("i40e: introduce next_to_process to i40e_ring")
>> Suggested-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
>> Reported-by: hq.dev+kernel@msdfc.xyz
>> Reported by: Solomon Peachy <pizza@shaftnet.org>
>> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217678
>> Tested-by: hq.dev+kernel@msdfc.xyz
>> Tested by: Indrek Järve <incx@dustbite.net>
>> Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
>> Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel)
>> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> 
> You missed my ack, so:
> Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> 

not sure why patchwork didn't pick this one up. Sorry about missing it.
Thanks!

-Jake

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

* Re: [PATCH net] i40e: sync next_to_clean and next_to_process for programming status desc
  2023-10-19 20:38 [PATCH net] i40e: sync next_to_clean and next_to_process for programming status desc Jacob Keller
  2023-10-20 10:56 ` Maciej Fijalkowski
@ 2023-10-21  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-21  2:00 UTC (permalink / raw)
  To: Jacob Keller
  Cc: netdev, davem, kuba, tirthendu.sarkar, maciej.fijalkowski,
	hq.dev+kernel, arpanax.arland

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 19 Oct 2023 13:38:52 -0700 you wrote:
> From: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
> 
> When a programming status desc is encountered on the rx_ring,
> next_to_process is bumped along with cleaned_count but next_to_clean is
> not. This causes I40E_DESC_UNUSED() macro to misbehave resulting in
> overwriting whole ring with new buffers.
> 
> [...]

Here is the summary with links:
  - [net] i40e: sync next_to_clean and next_to_process for programming status desc
    https://git.kernel.org/netdev/net/c/068d8b75c1ae

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net] i40e: sync next_to_clean and next_to_process for programming status desc
  2023-10-04  8:34 Tirthendu Sarkar
@ 2023-10-04 13:16 ` Maciej Fijalkowski
  0 siblings, 0 replies; 6+ messages in thread
From: Maciej Fijalkowski @ 2023-10-04 13:16 UTC (permalink / raw)
  To: Tirthendu Sarkar
  Cc: intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, netdev, bpf,
	magnus.karlsson

On Wed, Oct 04, 2023 at 02:04:54PM +0530, Tirthendu Sarkar wrote:
> When a programming status desc is encountered on the rx_ring,
> next_to_process is bumped along with cleaned_count but next_to_clean is
> not. This causes I40E_DESC_UNUSED() macro to misbehave resulting in
> overwriting whole ring with new buffers.
> 
> Update next_to_clean to point to next_to_process on seeing a programming
> status desc if not in the middle of handling a multi-frag packet. Also,
> bump cleaned_count only for such case as otherwise next_to_clean buffer
> may be returned to hardware on reaching clean_threshold.
> 
> Fixes: e9031f2da1ae ("i40e: introduce next_to_process to i40e_ring")
> Suggested-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> Reported-by: hq.dev+kernel@msdfc.xyz
> Reported by: Solomon Peachy <pizza@shaftnet.org>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217678
> Tested-by: hq.dev+kernel@msdfc.xyz

Could you ask for a name of that someone?

> Tested by: Indrek Järve <incx@dustbite.net>
> Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com>

Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

> ---
>  drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> index 0b3a27f118fb..50c70a8e470a 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> @@ -2544,7 +2544,14 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget,
>  			rx_buffer = i40e_rx_bi(rx_ring, ntp);
>  			i40e_inc_ntp(rx_ring);
>  			i40e_reuse_rx_page(rx_ring, rx_buffer);
> -			cleaned_count++;
> +			/* Update ntc and bump cleaned count if not in the
> +			 * middle of mb packet.
> +			 */
> +			if (rx_ring->next_to_clean == ntp) {
> +				rx_ring->next_to_clean =
> +					rx_ring->next_to_process;
> +				cleaned_count++;
> +			}
>  			continue;
>  		}
>  
> -- 
> 2.34.1
> 

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

* [PATCH net] i40e: sync next_to_clean and next_to_process for programming status desc
@ 2023-10-04  8:34 Tirthendu Sarkar
  2023-10-04 13:16 ` Maciej Fijalkowski
  0 siblings, 1 reply; 6+ messages in thread
From: Tirthendu Sarkar @ 2023-10-04  8:34 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: jesse.brandeburg, anthony.l.nguyen, netdev, bpf, magnus.karlsson,
	maciej.fijalkowski

When a programming status desc is encountered on the rx_ring,
next_to_process is bumped along with cleaned_count but next_to_clean is
not. This causes I40E_DESC_UNUSED() macro to misbehave resulting in
overwriting whole ring with new buffers.

Update next_to_clean to point to next_to_process on seeing a programming
status desc if not in the middle of handling a multi-frag packet. Also,
bump cleaned_count only for such case as otherwise next_to_clean buffer
may be returned to hardware on reaching clean_threshold.

Fixes: e9031f2da1ae ("i40e: introduce next_to_process to i40e_ring")
Suggested-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reported-by: hq.dev+kernel@msdfc.xyz
Reported by: Solomon Peachy <pizza@shaftnet.org>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217678
Tested-by: hq.dev+kernel@msdfc.xyz
Tested by: Indrek Järve <incx@dustbite.net>
Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 0b3a27f118fb..50c70a8e470a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2544,7 +2544,14 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget,
 			rx_buffer = i40e_rx_bi(rx_ring, ntp);
 			i40e_inc_ntp(rx_ring);
 			i40e_reuse_rx_page(rx_ring, rx_buffer);
-			cleaned_count++;
+			/* Update ntc and bump cleaned count if not in the
+			 * middle of mb packet.
+			 */
+			if (rx_ring->next_to_clean == ntp) {
+				rx_ring->next_to_clean =
+					rx_ring->next_to_process;
+				cleaned_count++;
+			}
 			continue;
 		}
 
-- 
2.34.1


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

end of thread, other threads:[~2023-10-21  2:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-19 20:38 [PATCH net] i40e: sync next_to_clean and next_to_process for programming status desc Jacob Keller
2023-10-20 10:56 ` Maciej Fijalkowski
2023-10-20 17:19   ` Jacob Keller
2023-10-21  2:00 ` patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2023-10-04  8:34 Tirthendu Sarkar
2023-10-04 13:16 ` Maciej Fijalkowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.