All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] gve: Modify rx_buf_alloc_fail counter centrally and closer to failure
@ 2024-01-24 20:54 nktgrg
  2024-01-26  1:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: nktgrg @ 2024-01-24 20:54 UTC (permalink / raw)
  To: netdev, jeroendb, pkaligineedi, shailend, davem, edumazet, kuba,
	pabeni, jfraker, linux-kernel
  Cc: stable, Ankit Garg

From: Ankit Garg <nktgrg@google.com>

Previously, each caller of gve_rx_alloc_buffer had to increase counter
 and as a result one caller was not tracking those failure. Increasing
 counters at a common location now so callers don't have to duplicate
 code or miss counter management.

Signed-off-by: Ankit Garg <nktgrg@google.com>
---
 drivers/net/ethernet/google/gve/gve_rx.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/google/gve/gve_rx.c b/drivers/net/ethernet/google/gve/gve_rx.c
index 3cb3a9a..eb67ea9 100644
--- a/drivers/net/ethernet/google/gve/gve_rx.c
+++ b/drivers/net/ethernet/google/gve/gve_rx.c
@@ -93,7 +93,8 @@ static void gve_setup_rx_buffer(struct gve_rx_slot_page_info *page_info,
 
 static int gve_rx_alloc_buffer(struct gve_priv *priv, struct device *dev,
 			       struct gve_rx_slot_page_info *page_info,
-			       union gve_rx_data_slot *data_slot)
+			       union gve_rx_data_slot *data_slot,
+			       struct gve_rx_ring *rx)
 {
 	struct page *page;
 	dma_addr_t dma;
@@ -101,8 +102,12 @@ static int gve_rx_alloc_buffer(struct gve_priv *priv, struct device *dev,
 
 	err = gve_alloc_page(priv, dev, &page, &dma, DMA_FROM_DEVICE,
 			     GFP_ATOMIC);
-	if (err)
+	if (err) {
+		u64_stats_update_begin(&rx->statss);
+		rx->rx_buf_alloc_fail++;
+		u64_stats_update_end(&rx->statss);
 		return err;
+	}
 
 	gve_setup_rx_buffer(page_info, dma, page, &data_slot->addr);
 	return 0;
@@ -143,8 +148,9 @@ static int gve_prefill_rx_pages(struct gve_rx_ring *rx)
 					    &rx->data.data_ring[i].qpl_offset);
 			continue;
 		}
-		err = gve_rx_alloc_buffer(priv, &priv->pdev->dev, &rx->data.page_info[i],
-					  &rx->data.data_ring[i]);
+		err = gve_rx_alloc_buffer(priv, &priv->pdev->dev,
+					  &rx->data.page_info[i],
+					  &rx->data.data_ring[i], rx);
 		if (err)
 			goto alloc_err_rda;
 	}
@@ -895,10 +901,7 @@ static bool gve_rx_refill_buffers(struct gve_priv *priv, struct gve_rx_ring *rx)
 				gve_rx_free_buffer(dev, page_info, data_slot);
 				page_info->page = NULL;
 				if (gve_rx_alloc_buffer(priv, dev, page_info,
-							data_slot)) {
-					u64_stats_update_begin(&rx->statss);
-					rx->rx_buf_alloc_fail++;
-					u64_stats_update_end(&rx->statss);
+							data_slot, rx)) {
 					break;
 				}
 			}
-- 
2.43.0.429.g432eaa2c6b-goog


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

* Re: [PATCH net-next] gve: Modify rx_buf_alloc_fail counter centrally and closer to failure
  2024-01-24 20:54 [PATCH net-next] gve: Modify rx_buf_alloc_fail counter centrally and closer to failure nktgrg
@ 2024-01-26  1:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-01-26  1:20 UTC (permalink / raw)
  To: nktgrg
  Cc: netdev, jeroendb, pkaligineedi, shailend, davem, edumazet, kuba,
	pabeni, jfraker, linux-kernel, stable

Hello:

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

On Wed, 24 Jan 2024 20:54:35 +0000 you wrote:
> From: Ankit Garg <nktgrg@google.com>
> 
> Previously, each caller of gve_rx_alloc_buffer had to increase counter
>  and as a result one caller was not tracking those failure. Increasing
>  counters at a common location now so callers don't have to duplicate
>  code or miss counter management.
> 
> [...]

Here is the summary with links:
  - [net-next] gve: Modify rx_buf_alloc_fail counter centrally and closer to failure
    https://git.kernel.org/netdev/net-next/c/3df18416267b

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] 2+ messages in thread

end of thread, other threads:[~2024-01-26  1:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-24 20:54 [PATCH net-next] gve: Modify rx_buf_alloc_fail counter centrally and closer to failure nktgrg
2024-01-26  1:20 ` patchwork-bot+netdevbpf

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.