netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
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, parthiban.veerasooran@microchip.com,
	masahiroy@kernel.org
Subject: Re: [PATCH v4 04/14] net-next/yunsilicon: Add qp and cq management
Date: Tue, 18 Feb 2025 16:31:22 +0000	[thread overview]
Message-ID: <20250218163122.GA1615191@kernel.org> (raw)
In-Reply-To: <20250213091410.2067626-5-tianx@yunsilicon.com>

On Thu, Feb 13, 2025 at 05:14:11PM +0800, Xin Tian wrote:
> Add qp(queue pair) and cq(completion queue) resource management APIs
> 
> Co-developed-by: Honggang Wei <weihg@yunsilicon.com>
> Signed-off-by: Honggang Wei <weihg@yunsilicon.com>
> Co-developed-by: Lei Yan <jacky@yunsilicon.com>
> Signed-off-by: Lei Yan <jacky@yunsilicon.com>
> Signed-off-by: Xin Tian <tianx@yunsilicon.com>

Some general remark regarding this patchset:

1. "xsc" is probably a more appropriate prefix than "net-next/yunsilicon"
   in the patch subjects: it seems to be the name of the driver, and
   conveniently is nice and short.

2. Please provide more descriptive patch descriptions, ideally
   explaining why changes are being made. As this is a new driver
   I think it is appropriate for the "why" to to describe how
   the patches fill-out the driver, leading to something users
   can use.

...

> diff --git a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
> index 4c8b26660..4e19b0989 100644
> --- a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
> +++ b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
> @@ -29,6 +29,14 @@
>  
>  #define XSC_REG_ADDR(dev, offset)	\
>  	(((dev)->bar) + ((offset) - 0xA0000000))
> +#define XSC_SET_FIELD(value, field)	\
> +	(((value) << field ## _SHIFT) & field ## _MASK)
> +#define XSC_GET_FIELD(word, field)	\
> +	(((word)  & field ## _MASK) >> field ## _SHIFT)

I did not try, but I expect that if you express XSC_SET_FIELD() and
XSC_GET_FIELD() in terms of FIELD_PREP() and FIELD_GET() then the _SHIFT
part disappears. And, ideally, the corresponding _SHIFT defines don't need
to be defined.

> +
> +enum {
> +	XSC_MAX_EQ_NAME	= 20
> +};
>  
>  enum {
>  	XSC_MAX_PORTS	= 2,
> @@ -44,6 +52,147 @@ enum {
>  	XSC_MAX_UUARS		= XSC_MAX_UAR_PAGES * XSC_BF_REGS_PER_PAGE,
>  };
>  
> +// alloc
> +struct xsc_buf_list {
> +	void		       *buf;
> +	dma_addr_t		map;
> +};
> +
> +struct xsc_buf {
> +	struct xsc_buf_list	direct;
> +	struct xsc_buf_list	*page_list;
> +	int			nbufs;
> +	int			npages;
> +	int			page_shift;
> +	int			size;

Looking over the way the fields are used in this patchset
I think that unsigned long would be slightly better types
for nbufs, npages, and size.

And more generally, I think it would be nice to use unsigned
types throughout this patchset for, in structure members, function
parameters, and local variables, to hold unsigned values.

And likewise to use unsigned long (instead of unsigned int) as
appropriate, e.g. the size parameter of xsc_buf_alloc() which
is passed to get_order() in a subsequent patch in this series.

> +};
> +
> +struct xsc_frag_buf {
> +	struct xsc_buf_list	*frags;
> +	int			npages;
> +	int			size;
> +	u8			page_shift;
> +};
> +
> +struct xsc_frag_buf_ctrl {
> +	struct xsc_buf_list	*frags;
> +	u32			sz_m1;
> +	u16			frag_sz_m1;
> +	u16			strides_offset;
> +	u8			log_sz;
> +	u8			log_stride;
> +	u8			log_frag_strides;
> +};

...

  reply	other threads:[~2025-02-18 16:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13  9:14 [PATCH v4 00/14] net-next/yunsilicon: ADD Yunsilicon XSC Ethernet Driver Xin Tian
2025-02-13  9:14 ` [PATCH v4 01/14] net-next/yunsilicon: Add xsc driver basic framework Xin Tian
2025-02-13  9:14 ` [PATCH v4 02/14] net-next/yunsilicon: Enable CMDQ Xin Tian
2025-02-13  9:14 ` [PATCH v4 03/14] net-next/yunsilicon: Add hardware setup APIs Xin Tian
2025-02-13  9:14 ` [PATCH v4 04/14] net-next/yunsilicon: Add qp and cq management Xin Tian
2025-02-18 16:31   ` Simon Horman [this message]
2025-02-20  8:58     ` tianx
2025-02-13  9:14 ` [PATCH v4 05/14] net-next/yunsilicon: Add eq and alloc Xin Tian
2025-02-18 17:10   ` Simon Horman
2025-02-20 15:35     ` tianx
2025-02-24 18:58       ` Simon Horman
2025-02-25  2:34         ` Xin Tian
2025-02-25 10:22           ` Simon Horman
2025-02-13  9:14 ` [PATCH v4 06/14] net-next/yunsilicon: Add pci irq Xin Tian
2025-02-13  9:14 ` [PATCH v4 07/14] net-next/yunsilicon: Init auxiliary device Xin Tian
2025-02-13 14:37   ` Leon Romanovsky
2025-02-14  3:14     ` tianx
2025-02-16  9:59       ` Leon Romanovsky
2025-02-17  2:16         ` tianx
2025-02-13  9:14 ` [PATCH v4 08/14] net-next/yunsilicon: Add ethernet interface Xin Tian
2025-02-13  9:14 ` [PATCH v4 09/14] net-next/yunsilicon: Init net device Xin Tian
2025-02-13  9:14 ` [PATCH v4 10/14] net-next/yunsilicon: Add eth needed qp and cq apis Xin Tian
2025-02-13  9:14 ` [PATCH v4 11/14] net-next/yunsilicon: ndo_open and ndo_stop Xin Tian
2025-02-13  9:14 ` [PATCH v4 12/14] net-next/yunsilicon: Add ndo_start_xmit Xin Tian
2025-02-13  9:14 ` [PATCH v4 13/14] net-next/yunsilicon: Add eth rx Xin Tian
2025-02-13  9:14 ` [PATCH v4 14/14] net-next/yunsilicon: 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=20250218163122.GA1615191@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --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).