From: Leon Romanovsky <leon@kernel.org>
To: Xin Tian <tianx@yunsilicon.com>
Cc: netdev@vger.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 07/14] xsc: Init auxiliary device
Date: Wed, 26 Feb 2025 09:22:15 +0200 [thread overview]
Message-ID: <20250226072215.GI53094@unreal> (raw)
In-Reply-To: <20250224172429.2455751-8-tianx@yunsilicon.com>
On Tue, Feb 25, 2025 at 01:24:31AM +0800, Xin Tian wrote:
> Our device supports both Ethernet and RDMA functionalities, and
> leveraging the auxiliary bus perfectly addresses our needs for
> managing these distinct features. This patch utilizes auxiliary
> device to handle the Ethernet functionality, while defining
> xsc_adev_list to reserve expansion space for future RDMA
> capabilities.
>
> 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>
> ---
> .../ethernet/yunsilicon/xsc/common/xsc_core.h | 14 +++
> .../net/ethernet/yunsilicon/xsc/pci/Makefile | 3 +-
> .../net/ethernet/yunsilicon/xsc/pci/adev.c | 112 ++++++++++++++++++
> .../net/ethernet/yunsilicon/xsc/pci/adev.h | 14 +++
> .../net/ethernet/yunsilicon/xsc/pci/main.c | 10 ++
> 5 files changed, 152 insertions(+), 1 deletion(-)
> create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/adev.c
> create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/adev.h
<...>
> +// adev
Please follow standard C comment style // -> /* ... */ for one line
comments. Also this "adev" comment doesn't add any information.
> +#define XSC_PCI_DRV_NAME "xsc_pci"
> +#define XSC_ETH_ADEV_NAME "eth"
> +
> +struct xsc_adev {
> + struct auxiliary_device adev;
> + struct xsc_core_device *xdev;
> +
> + int idx;
> +};
> +
> // hw
> struct xsc_reg_addr {
> u64 tx_db;
> @@ -354,6 +366,8 @@ enum xsc_interface_state {
> struct xsc_core_device {
> struct pci_dev *pdev;
> struct device *device;
> + int adev_id;
> + struct xsc_adev **xsc_adev_list;
> void *eth_priv;
> struct xsc_dev_resource *dev_res;
> int numa_node;
> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/Makefile b/drivers/net/ethernet/yunsilicon/xsc/pci/Makefile
> index 3525d1c74..ad0ecc122 100644
> --- a/drivers/net/ethernet/yunsilicon/xsc/pci/Makefile
> +++ b/drivers/net/ethernet/yunsilicon/xsc/pci/Makefile
> @@ -6,4 +6,5 @@ ccflags-y += -I$(srctree)/drivers/net/ethernet/yunsilicon/xsc
>
> obj-$(CONFIG_YUNSILICON_XSC_PCI) += xsc_pci.o
>
> -xsc_pci-y := main.o cmdq.o hw.o qp.o cq.o alloc.o eq.o pci_irq.o
> +xsc_pci-y := main.o cmdq.o hw.o qp.o cq.o alloc.o eq.o pci_irq.o adev.o
> +
> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/adev.c b/drivers/net/ethernet/yunsilicon/xsc/pci/adev.c
> new file mode 100644
> index 000000000..94db3893a
> --- /dev/null
> +++ b/drivers/net/ethernet/yunsilicon/xsc/pci/adev.c
> @@ -0,0 +1,112 @@
> +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
> +/*
> + * Copyright (C) 2021-2025, Shanghai Yunsilicon Technology Co., Ltd.
> + * All rights reserved.
> + */
> +
> +#include <linux/auxiliary_bus.h>
> +#include <linux/idr.h>
> +
> +#include "adev.h"
> +
> +static DEFINE_IDA(xsc_adev_ida);
> +
> +enum xsc_adev_idx {
> + XSC_ADEV_IDX_ETH,
> + XSC_ADEV_IDX_MAX
There is no need in XSC_ADEV_IDX_MAX, please rely on ARRAY_SIZE(xsc_adev_name).
> +};
> +
> +static const char * const xsc_adev_name[] = {
> + [XSC_ADEV_IDX_ETH] = XSC_ETH_ADEV_NAME,
> +};
<...>
> +int xsc_adev_init(struct xsc_core_device *xdev)
> +{
> + struct xsc_adev **xsc_adev_list;
> + int adev_id;
> + int ret;
> +
> + xsc_adev_list = kzalloc(sizeof(void *) * XSC_ADEV_IDX_MAX, GFP_KERNEL);
kcalloc(ARRAY_SIZE(xsc_adev_name), sizeof(struct xsc_adev *), GFP_KERNEL);
Thanks
next prev parent reply other threads:[~2025-02-26 7:22 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 [this message]
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
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=20250226072215.GI53094@unreal \
--to=leon@kernel.org \
--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=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 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.