netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Damato <jdamato@fastly.com>
To: Xin Tian <tianx@yunsilicon.com>
Cc: netdev@vger.kernel.org, leon@kernel.org, andrew+netdev@lunn.ch,
	kuba@kernel.org, pabeni@redhat.com, edumazet@google.com,
	davem@davemloft.net, jeff.johnson@oss.qualcomm.com,
	przemyslaw.kitszel@intel.com, weihg@yunsilicon.com,
	wanry@yunsilicon.com, horms@kernel.org,
	parthiban.veerasooran@microchip.com, masahiroy@kernel.org
Subject: Re: [PATCH net-next v5 13/14] xsc: Add eth reception data path
Date: Mon, 24 Feb 2025 22:34:40 -0500	[thread overview]
Message-ID: <Z706ULnEoemYWdvQ@LQ3V64L9R2> (raw)
In-Reply-To: <20250224172443.2455751-14-tianx@yunsilicon.com>

On Tue, Feb 25, 2025 at 01:24:44AM +0800, Xin Tian wrote:
> rx data path:

[...]

> diff --git a/drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_rx.c b/drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_rx.c
> index 72f33bb53..b87105c26 100644
> --- a/drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_rx.c
> +++ b/drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_rx.c
> @@ -5,44 +5,594 @@

[...]

>  struct sk_buff *xsc_skb_from_cqe_linear(struct xsc_rq *rq,
>  					struct xsc_wqe_frag_info *wi,
>  					u32 cqe_bcnt, u8 has_pph)
>  {
> -	// TBD
> -	return NULL;
> +	int pph_len = has_pph ? XSC_PPH_HEAD_LEN : 0;
> +	u16 rx_headroom = rq->buff.headroom;
> +	struct xsc_dma_info *di = wi->di;
> +	struct sk_buff *skb;
> +	void *va, *data;
> +	u32 frag_size;
> +
> +	va = page_address(di->page) + wi->offset;
> +	data = va + rx_headroom + pph_len;
> +	frag_size = XSC_SKB_FRAG_SZ(rx_headroom + cqe_bcnt);
> +
> +	dma_sync_single_range_for_cpu(rq->cq.xdev->device, di->addr, wi->offset,
> +				      frag_size, DMA_FROM_DEVICE);
> +	prefetchw(va); /* xdp_frame data area */
> +	prefetch(data);

net_prefetchw and net_prefetch, possibly?

[...]

>  struct sk_buff *xsc_skb_from_cqe_nonlinear(struct xsc_rq *rq,
>  					   struct xsc_wqe_frag_info *wi,
>  					   u32 cqe_bcnt, u8 has_pph)
>  {
> -	// TBD
> -	return NULL;
> +	struct xsc_rq_frag_info *frag_info = &rq->wqe.info.arr[0];
> +	u16 headlen  = min_t(u32, XSC_RX_MAX_HEAD, cqe_bcnt);
> +	struct xsc_wqe_frag_info *head_wi = wi;
> +	struct xsc_wqe_frag_info *rx_wi = wi;
> +	u16 head_offset = head_wi->offset;
> +	u16 byte_cnt = cqe_bcnt - headlen;
> +	u16 frag_consumed_bytes = 0;
> +	u16 frag_headlen = headlen;
> +	struct net_device *netdev;
> +	struct xsc_channel *c;
> +	struct sk_buff *skb;
> +	struct device *dev;
> +	u8 fragcnt = 0;
> +	int i = 0;
> +
> +	c = rq->cq.channel;
> +	dev = c->adapter->dev;
> +	netdev = c->adapter->netdev;
> +
> +	skb = napi_alloc_skb(rq->cq.napi, ALIGN(XSC_RX_MAX_HEAD, sizeof(long)));
> +	if (unlikely(!skb))
> +		return NULL;
> +
> +	prefetchw(skb->data);

Same as above: net_prefetchw ?

  reply	other threads:[~2025-02-25  3:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 17:24 [PATCH net-next v5 00/14] : xsc: ADD Yunsilicon XSC Ethernet Driver Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 01/14] xsc: Add xsc driver basic framework Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 02/14] xsc: Enable command queue Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 03/14] xsc: Add hardware setup APIs Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 04/14] xsc: Add qp and cq management Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 05/14] xsc: Add eq and alloc Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 06/14] xsc: Init pci irq Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 07/14] xsc: Init auxiliary device Xin Tian
2025-02-26  1:12   ` Jakub Kicinski
2025-02-26  9:39     ` Xin Tian
2025-02-26  7:22   ` Leon Romanovsky
2025-02-26  9:50     ` Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 08/14] xsc: Add ethernet interface Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 09/14] xsc: Init net device Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 10/14] xsc: Add eth needed qp and cq apis Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 11/14] xsc: ndo_open and ndo_stop Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 12/14] xsc: Add ndo_start_xmit Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 13/14] xsc: Add eth reception data path Xin Tian
2025-02-25  3:34   ` Joe Damato [this message]
2025-02-26  9:38     ` Xin Tian
2025-02-24 17:24 ` [PATCH net-next v5 14/14] xsc: add ndo_get_stats64 Xin Tian

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=Z706ULnEoemYWdvQ@LQ3V64L9R2 \
    --to=jdamato@fastly.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jeff.johnson@oss.qualcomm.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parthiban.veerasooran@microchip.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=tianx@yunsilicon.com \
    --cc=wanry@yunsilicon.com \
    --cc=weihg@yunsilicon.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).