[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <ca44497f-84ef-4f16-81ff-ca39a2b7a936@yunsilicon.com>
Date: Wed, 26 Feb 2025 17:50:03 +0800
From: "Xin Tian" <tianx@...silicon.com>
To: "Leon Romanovsky" <leon@...nel.org>
Cc: <netdev@...r.kernel.org>, <andrew+netdev@...n.ch>, <kuba@...nel.org>,
<pabeni@...hat.com>, <edumazet@...gle.com>, <davem@...emloft.net>,
<jeff.johnson@....qualcomm.com>, <przemyslaw.kitszel@...el.com>,
<weihg@...silicon.com>, <wanry@...silicon.com>, <horms@...nel.org>,
<parthiban.veerasooran@...rochip.com>, <masahiroy@...nel.org>
Subject: Re: [PATCH net-next v5 07/14] xsc: Init auxiliary device
On 2025/2/26 15:22, Leon Romanovsky wrote:
> 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@...silicon.com>
>> Signed-off-by: Honggang Wei <weihg@...silicon.com>
>> Co-developed-by: Lei Yan <jacky@...silicon.com>
>> Signed-off-by: Lei Yan <jacky@...silicon.com>
>> Signed-off-by: Xin Tian <tianx@...silicon.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.
The |xsc_core.h| file is quite large and includes definitions from
various modules,
so I added markers to separate them. I'll modify the commenting style.
>> +#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).
OK, I'll change, thanks.
>> +};
>> +
>> +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
Ack.
Thanks
Powered by blists - more mailing lists