[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0f3cf321-3c23-43df-b6eb-55dd0a1fec64@redhat.com>
Date: Tue, 3 Sep 2024 14:08:25 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Jijie Shao <shaojijie@...wei.com>, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org
Cc: shenjian15@...wei.com, wangpeiyang1@...wei.com, liuyonglong@...wei.com,
chenhao418@...wei.com, sudongming1@...wei.com, xujunsheng@...wei.com,
shiyongbang@...wei.com, libaihan@...wei.com, andrew@...n.ch,
jdamato@...tly.com, horms@...nel.org, jonathan.cameron@...wei.com,
shameerali.kolothum.thodi@...wei.com, salil.mehta@...wei.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V6 net-next 07/11] net: hibmcge: Implement rx_poll
function to receive packets
On 8/30/24 14:16, Jijie Shao wrote:
> @@ -119,6 +122,20 @@ static void hbg_buffer_free_skb(struct hbg_buffer *buffer)
> buffer->skb = NULL;
> }
>
> +static int hbg_buffer_alloc_skb(struct hbg_buffer *buffer)
> +{
> + u32 len = hbg_spec_max_frame_len(buffer->priv, buffer->dir);
> + struct hbg_priv *priv = buffer->priv;
> +
> + buffer->skb = netdev_alloc_skb(priv->netdev, len);
> + if (unlikely(!buffer->skb))
> + return -ENOMEM;
It's preferable to allocate the skbuff at packet reception time, inside
the poll() function, just before passing the skb to the upper stack, so
that the header contents are fresh in the cache. Additionally that
increases the change for the allocator could hit its fastpath.
> +
> + buffer->skb_len = len;
> + memset(buffer->skb->data, 0, HBG_PACKET_HEAD_SIZE);
Out of sheer ignorace, why do you need to clear the packet data?
thanks,
Paolo
Powered by blists - more mailing lists