[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e56eaf35-6ea7-3082-2549-fc2fe17ebacf@gmail.com>
Date: Wed, 20 Jun 2018 17:28:00 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Saeed Mahameed <saeedm@...lanox.com>,
"eric.dumazet@...il.com" <eric.dumazet@...il.com>,
"kafai@...com" <kafai@...com>, Tariq Toukan <tariqt@...lanox.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"edumazet@...gle.com" <edumazet@...gle.com>
Subject: Re: [net RFC] net/mlx4_en: Use frag stride in crossing page boundary
condition
On 06/20/2018 04:41 PM, Saeed Mahameed wrote:
>
> I see, I wanted to use _stride_ as grantee for how much a page frag can
> grow, for example in mlx5 we need the whole stride to build_skb around
> the frag, since we always need the trailer, but it is different in here
> and we can avoid resource waste.
>
> so how a bout this: (As suggested by Martin).
> currently as mlx4_en_complete_rx_desc assumes that priv->rx_headroom
> is always 0 in non-XDP setup, hence:
>
> frags->page_offset += sz_align;
>
> where it really should be:
> frags->page_offset += sz_align + priv->rx_headroom;
>
> we can use it as a hint to not reuse as below:
> what do you think ?
>
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> index 9f54ccbddea7..f14c7a574cc8 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> @@ -474,10 +474,10 @@ static int mlx4_en_complete_rx_desc(struct
> mlx4_en_priv *priv,
> {
> const struct mlx4_en_frag_info *frag_info = priv->frag_info;
> unsigned int truesize = 0;
> + bool release = true;
> int nr, frag_size;
> struct page *page;
> dma_addr_t dma;
> - bool release;
> index 9f54ccbddea7..f14c7a574cc8 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
>
> /* Collect used fragments while replacing them in the HW
> descriptors */
> for (nr = 0;; frags++) {
> @@ -500,7 +500,7 @@ static int mlx4_en_complete_rx_desc(struct
> mlx4_en_priv *priv,
> release = page_count(page) != 1 ||
> page_is_pfmemalloc(page) ||
> page_to_nid(page) != numa_mem_id();
> - } else {
> + } elseif(!priv->rx_headroom) {
> u32 sz_align = ALIGN(frag_size,
> SMP_CACHE_BYTES);
>
> frags->page_offset += sz_align;
>
I guess that would work, please double check priv->rx_headroom wont need another cache line,
thanks !
Powered by blists - more mailing lists