From: Jakub Kicinski <kuba@kernel.org>
To: Jijie Shao <shaojijie@huawei.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <pabeni@redhat.com>,
<shenjian15@huawei.com>, <wangpeiyang1@huawei.com>,
<liuyonglong@huawei.com>, <chenhao418@huawei.com>,
<sudongming1@huawei.com>, <xujunsheng@huawei.com>,
<shiyongbang@huawei.com>, <libaihan@huawei.com>, <andrew@lunn.ch>,
<jdamato@fastly.com>, <horms@kernel.org>,
<kalesh-anakkur.purayil@broadcom.com>,
<jonathan.cameron@huawei.com>,
<shameerali.kolothum.thodi@huawei.com>, <salil.mehta@huawei.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V10 net-next 07/10] net: hibmcge: Implement rx_poll function to receive packets
Date: Sun, 15 Sep 2024 17:18:45 +0200 [thread overview]
Message-ID: <20240915171845.4f233a0c@kernel.org> (raw)
In-Reply-To: <20240912025127.3912972-8-shaojijie@huawei.com>
On Thu, 12 Sep 2024 10:51:24 +0800 Jijie Shao wrote:
> +static int hbg_napi_rx_poll(struct napi_struct *napi, int budget)
> +{
> + struct hbg_ring *ring = container_of(napi, struct hbg_ring, napi);
> + struct hbg_priv *priv = ring->priv;
> + struct hbg_rx_desc *rx_desc;
> + struct hbg_buffer *buffer;
> + u32 packet_done = 0;
> + u32 pkt_len;
> +
> + while (packet_done < budget) {
> + if (unlikely(hbg_queue_is_empty(ring->ntc, ring->ntu, ring)))
> + break;
> +
> + buffer = &ring->queue[ring->ntc];
> + if (unlikely(!buffer->skb))
> + goto next_buffer;
> +
> + if (unlikely(!hbg_sync_data_from_hw(priv, buffer)))
> + break;
> +
> + hbg_dma_unmap(buffer);
> +
> + skb_reserve(buffer->skb, HBG_PACKET_HEAD_SIZE + NET_IP_ALIGN);
> +
> + rx_desc = (struct hbg_rx_desc *)buffer->skb->data;
> + pkt_len = FIELD_GET(HBG_RX_DESC_W2_PKT_LEN_M, rx_desc->word2);
> + skb_put(buffer->skb, pkt_len);
> + buffer->skb->protocol = eth_type_trans(buffer->skb, priv->netdev);
> +
> + dev_sw_netstats_rx_add(priv->netdev, pkt_len);
> + netif_receive_skb(buffer->skb);
why not napi_gro_receive() ?
> + buffer->skb = NULL;
> + hbg_rx_fill_one_buffer(priv);
> +
> +next_buffer:
> + hbg_queue_move_next(ntc, ring);
> + packet_done++;
> + }
> +
> + hbg_rx_fill_buffers(priv);
don't try to refill the buffers if budget is 0, if budget is 0 we
should only do Tx processing (IOW this function should do nothing)
> + if (likely(napi_complete_done(napi, packet_done)))
same comment as on Tx, don't call if not done
> + hbg_hw_irq_enable(priv, HBG_INT_MSK_RX_B, true);
> +
> + return packet_done;
> +}
next prev parent reply other threads:[~2024-09-15 15:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 2:51 [PATCH V10 net-next 00/10] Add support of HIBMCGE Ethernet Driver Jijie Shao
2024-09-12 2:51 ` [PATCH V10 net-next 01/10] net: hibmcge: Add pci table supported in this module Jijie Shao
2024-09-15 15:10 ` Jakub Kicinski
2024-09-12 2:51 ` [PATCH V10 net-next 02/10] net: hibmcge: Add read/write registers supported through the bar space Jijie Shao
2024-09-12 2:51 ` [PATCH V10 net-next 03/10] net: hibmcge: Add mdio and hardware configuration supported in this module Jijie Shao
2024-09-15 15:36 ` Christophe JAILLET
2024-09-12 2:51 ` [PATCH V10 net-next 04/10] net: hibmcge: Add interrupt " Jijie Shao
2024-09-15 15:40 ` Christophe JAILLET
2024-09-12 2:51 ` [PATCH V10 net-next 05/10] net: hibmcge: Implement some .ndo functions Jijie Shao
2024-09-15 15:14 ` Jakub Kicinski
2024-09-12 2:51 ` [PATCH V10 net-next 06/10] net: hibmcge: Implement .ndo_start_xmit function Jijie Shao
2024-09-15 15:08 ` Jakub Kicinski
2024-09-15 15:16 ` Jakub Kicinski
2024-09-15 15:52 ` Christophe JAILLET
2024-09-12 2:51 ` [PATCH V10 net-next 07/10] net: hibmcge: Implement rx_poll function to receive packets Jijie Shao
2024-09-15 15:18 ` Jakub Kicinski [this message]
2024-09-12 2:51 ` [PATCH V10 net-next 08/10] net: hibmcge: Implement some ethtool_ops functions Jijie Shao
2024-09-12 2:51 ` [PATCH V10 net-next 09/10] net: hibmcge: Add a Makefile and update Kconfig for hibmcge Jijie Shao
2024-09-15 15:05 ` Jakub Kicinski
2024-09-12 2:51 ` [PATCH V10 net-next 10/10] net: hibmcge: Add maintainer " Jijie Shao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240915171845.4f233a0c@kernel.org \
--to=kuba@kernel.org \
--cc=andrew@lunn.ch \
--cc=chenhao418@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jdamato@fastly.com \
--cc=jonathan.cameron@huawei.com \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=libaihan@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=salil.mehta@huawei.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=shaojijie@huawei.com \
--cc=shenjian15@huawei.com \
--cc=shiyongbang@huawei.com \
--cc=sudongming1@huawei.com \
--cc=wangpeiyang1@huawei.com \
--cc=xujunsheng@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.