Add xsc PMD framework, doc and build infrastructure, supporting PCI probe. Signed-off-by: Renyong Wan <wa...@yunsilicon.com>
--- v7: * Change the name of Wanrenyong to Renyong Wan. v6: * Delete the included header file net/if.h. * Rebase the main branch to merge release notes. --- .mailmap | 5 ++ MAINTAINERS | 10 +++ doc/guides/nics/features/xsc.ini | 9 +++ doc/guides/nics/index.rst | 1 + doc/guides/nics/xsc.rst | 31 +++++++++ doc/guides/rel_notes/release_25_03.rst | 4 ++ drivers/net/meson.build | 1 + drivers/net/xsc/meson.build | 11 ++++ drivers/net/xsc/xsc_defs.h | 15 +++++ drivers/net/xsc/xsc_ethdev.c | 88 ++++++++++++++++++++++++++ drivers/net/xsc/xsc_ethdev.h | 15 +++++ drivers/net/xsc/xsc_log.h | 24 +++++++ 12 files changed, 214 insertions(+) create mode 100644 doc/guides/nics/features/xsc.ini create mode 100644 doc/guides/nics/xsc.rst create mode 100644 drivers/net/xsc/meson.build create mode 100644 drivers/net/xsc/xsc_defs.h create mode 100644 drivers/net/xsc/xsc_ethdev.c create mode 100644 drivers/net/xsc/xsc_ethdev.h create mode 100644 drivers/net/xsc/xsc_log.h diff --git a/.mailmap b/.mailmap index ebead7f072..a0e77d45c9 100644 --- a/.mailmap +++ b/.mailmap @@ -371,6 +371,7 @@ Dongdong Liu <liudongdo...@huawei.com> Dongsheng Rong <rongdongsh...@baidu.com> Dongsu Han <dong...@cs.cmu.edu> Dong Wang <dong1.w...@intel.com> +Dongwei Xu <x...@yunsilicon.com> Dongyang Pan <197020...@qq.com> Dong Zhou <dongz...@nvidia.com> <do...@mellanox.com> Don Provan <dpro...@bivio.net> @@ -1065,6 +1066,7 @@ Nagadheeraj Rottela <rnagadhee...@marvell.com> Naga Harish K S V <s.v.naga.haris...@intel.com> Naga Suresh Somarowthu <naga.sureshx.somarow...@intel.com> Nalla Pradeep <pna...@marvell.com> +Na Na <n...@yunsilicon.com> Na Na <nana...@alibaba-inc.com> Nan Chen <whutchen...@gmail.com> Nandini Persad <nandinipersad...@gmail.com> @@ -1273,6 +1275,7 @@ Remi Pommarel <r...@triplefau.lt> Remigiusz Konca <remigiuszx.ko...@intel.com> Remy Horton <remy.hor...@intel.com> Renata Saiakhova <renata.saiakh...@ekinops.com> +Renyong Wan <wa...@yunsilicon.com> Reshma Pattan <reshma.pat...@intel.com> <reshma.pat...@gmail.com> Ricardo Roldan <rrol...@bequant.com> Ricardo Salveti <ricardo.salv...@linaro.org> @@ -1309,6 +1312,7 @@ Ronak Doshi <ronak.do...@broadcom.com> <dos...@vmware.com> Ron Beider <rbei...@amazon.com> Ronghua Zhang <rzh...@vmware.com> RongQiang Xie <xie.rongqi...@zte.com.cn> +Rong Qian <qi...@yunsilicon.com> RongQing Li <lirongq...@baidu.com> Rongwei Liu <rongw...@nvidia.com> Rory Sexton <rory.sex...@intel.com> @@ -1689,6 +1693,7 @@ Xiaonan Zhang <xiaonanx.zh...@intel.com> Xiao Wang <xiao.w.w...@intel.com> Xiaoxiao Zeng <xiaoxiaox.z...@intel.com> Xiaoxin Peng <xiaoxin.p...@broadcom.com> +Xiaoxiong Zhang <zhan...@yunsilicon.com> Xiaoyu Min <jack...@nvidia.com> <jack...@mellanox.com> Xiaoyun Li <xiaoyun...@intel.com> Xiaoyun Wang <cloud.wangxiao...@huawei.com> diff --git a/MAINTAINERS b/MAINTAINERS index b86cdd266b..4ee8098f10 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1075,6 +1075,16 @@ F: drivers/net/avp/ F: doc/guides/nics/avp.rst F: doc/guides/nics/features/avp.ini +Yunsilicon xsc +M: Renyong Wan <wa...@yunsilicon.com> +M: Na Na <n...@yunsilicon.com> +M: Rong Qian <qi...@yunsilicon.com> +M: Xiaoxiong Zhang <zhan...@yunsilicon.com> +M: Dongwei Xu <x...@yunsilicon.com> +F: drivers/net/xsc/ +F: doc/guides/nics/xsc.rst +F: doc/guides/nics/features/xsc.ini + ZTE zxdh - EXPERIMENTAL M: Junlong Wang <wang.junlo...@zte.com.cn> M: Lijie Shan <shan.li...@zte.com.cn> diff --git a/doc/guides/nics/features/xsc.ini b/doc/guides/nics/features/xsc.ini new file mode 100644 index 0000000000..b5c44ce535 --- /dev/null +++ b/doc/guides/nics/features/xsc.ini @@ -0,0 +1,9 @@ +; +; Supported features of the 'xsc' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux = Y +ARMv8 = Y +x86-64 = Y diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst index 50688d9f64..10a2eca3b0 100644 --- a/doc/guides/nics/index.rst +++ b/doc/guides/nics/index.rst @@ -70,4 +70,5 @@ Network Interface Controller Drivers vhost virtio vmxnet3 + xsc zxdh diff --git a/doc/guides/nics/xsc.rst b/doc/guides/nics/xsc.rst new file mode 100644 index 0000000000..8e189db541 --- /dev/null +++ b/doc/guides/nics/xsc.rst @@ -0,0 +1,31 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2024 Yunsilicon Technology Co., Ltd + +XSC Poll Mode Driver +====================== + +The xsc PMD (**librte_net_xsc**) provides poll mode driver support for +10/25/50/100/200 Gbps Yunsilicon metaScale Series Network Adapters. + +Supported NICs +-------------- + +The following Yunsilicon device models are supported by the same xsc driver: + + - metaScale-200S + - metaScale-200 + - metaScale-100Q + - metaScale-50 + +Prerequisites +-------------- + +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment. + +- Learning about Yunsilicon metaScale Series NICs using + `<https://www.yunsilicon.com/#/productInformation>`_. + +Limitations or Known issues +--------------------------- +32bit ARCHs are not supported. +Windows and BSD are not supported yet. diff --git a/doc/guides/rel_notes/release_25_03.rst b/doc/guides/rel_notes/release_25_03.rst index 931fe98879..3710493aad 100644 --- a/doc/guides/rel_notes/release_25_03.rst +++ b/doc/guides/rel_notes/release_25_03.rst @@ -72,6 +72,10 @@ New Features * Added support for virtual function VF (ngbe_vf). +* **Added Yunsilicon xsc net driver [EXPERIMENTAL].** + + * Added the PMD for Yunsilicon metaScale serials NICs. + Removed Items ------------- diff --git a/drivers/net/meson.build b/drivers/net/meson.build index dafd637ba4..c1ca7b0b39 100644 --- a/drivers/net/meson.build +++ b/drivers/net/meson.build @@ -63,6 +63,7 @@ drivers = [ 'vhost', 'virtio', 'vmxnet3', + 'xsc', 'zxdh', ] std_deps = ['ethdev', 'kvargs'] # 'ethdev' also pulls in mbuf, net, eal etc diff --git a/drivers/net/xsc/meson.build b/drivers/net/xsc/meson.build new file mode 100644 index 0000000000..84a09a23de --- /dev/null +++ b/drivers/net/xsc/meson.build @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2025 Yunsilicon Technology Co., Ltd. + +if not is_linux or not dpdk_conf.get('RTE_ARCH_64') + build = false + reason = 'only supported on 64bit Linux' +endif + +sources = files( + 'xsc_ethdev.c', +) diff --git a/drivers/net/xsc/xsc_defs.h b/drivers/net/xsc/xsc_defs.h new file mode 100644 index 0000000000..7c91d3443f --- /dev/null +++ b/drivers/net/xsc/xsc_defs.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2025 Yunsilicon Technology Co., Ltd. + */ + +#ifndef XSC_DEFS_H_ +#define XSC_DEFS_H_ + +#define XSC_PCI_VENDOR_ID 0x1f67 +#define XSC_PCI_DEV_ID_MS 0x1111 +#define XSC_PCI_DEV_ID_MSVF 0x1112 +#define XSC_PCI_DEV_ID_MVH 0x1151 +#define XSC_PCI_DEV_ID_MVHVF 0x1152 +#define XSC_PCI_DEV_ID_MVS 0x1153 + +#endif /* XSC_DEFS_H_ */ diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c new file mode 100644 index 0000000000..14aca98f5f --- /dev/null +++ b/drivers/net/xsc/xsc_ethdev.c @@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2025 Yunsilicon Technology Co., Ltd. + */ + +#include <ethdev_pci.h> + +#include "xsc_log.h" +#include "xsc_defs.h" +#include "xsc_ethdev.h" + +static int +xsc_ethdev_init(struct rte_eth_dev *eth_dev) +{ + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(eth_dev); + + PMD_INIT_FUNC_TRACE(); + + priv->eth_dev = eth_dev; + priv->pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); + + return 0; +} + +static int +xsc_ethdev_uninit(struct rte_eth_dev *eth_dev) +{ + RTE_SET_USED(eth_dev); + + PMD_INIT_FUNC_TRACE(); + + return 0; +} + +static int +xsc_ethdev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + struct rte_pci_device *pci_dev) +{ + int ret; + + PMD_INIT_FUNC_TRACE(); + + ret = rte_eth_dev_pci_generic_probe(pci_dev, + sizeof(struct xsc_ethdev_priv), + xsc_ethdev_init); + if (ret) { + PMD_DRV_LOG(ERR, "Failed to probe ethdev: %s", pci_dev->name); + return ret; + } + + return 0; +} + +static int +xsc_ethdev_pci_remove(struct rte_pci_device *pci_dev) +{ + int ret; + + PMD_INIT_FUNC_TRACE(); + + ret = rte_eth_dev_pci_generic_remove(pci_dev, xsc_ethdev_uninit); + if (ret) { + PMD_DRV_LOG(ERR, "Could not remove ethdev: %s", pci_dev->name); + return ret; + } + + return 0; +} + +static const struct rte_pci_id xsc_ethdev_pci_id_map[] = { + { RTE_PCI_DEVICE(XSC_PCI_VENDOR_ID, XSC_PCI_DEV_ID_MS) }, + { RTE_PCI_DEVICE(XSC_PCI_VENDOR_ID, XSC_PCI_DEV_ID_MSVF) }, + { RTE_PCI_DEVICE(XSC_PCI_VENDOR_ID, XSC_PCI_DEV_ID_MVH) }, + { RTE_PCI_DEVICE(XSC_PCI_VENDOR_ID, XSC_PCI_DEV_ID_MVHVF) }, + { RTE_PCI_DEVICE(XSC_PCI_VENDOR_ID, XSC_PCI_DEV_ID_MVS) }, + { RTE_PCI_DEVICE(0, 0) }, +}; + +static struct rte_pci_driver xsc_ethdev_pci_driver = { + .id_table = xsc_ethdev_pci_id_map, + .probe = xsc_ethdev_pci_probe, + .remove = xsc_ethdev_pci_remove, +}; + +RTE_PMD_REGISTER_PCI(net_xsc, xsc_ethdev_pci_driver); +RTE_PMD_REGISTER_PCI_TABLE(net_xsc, xsc_ethdev_pci_id_map); + +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_init, init, NOTICE); +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_driver, driver, NOTICE); diff --git a/drivers/net/xsc/xsc_ethdev.h b/drivers/net/xsc/xsc_ethdev.h new file mode 100644 index 0000000000..508f5a86de --- /dev/null +++ b/drivers/net/xsc/xsc_ethdev.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2025 Yunsilicon Technology Co., Ltd. + */ + +#ifndef _XSC_ETHDEV_H_ +#define _XSC_ETHDEV_H_ + +struct xsc_ethdev_priv { + struct rte_eth_dev *eth_dev; + struct rte_pci_device *pci_dev; +}; + +#define TO_XSC_ETHDEV_PRIV(dev) ((struct xsc_ethdev_priv *)(dev)->data->dev_private) + +#endif /* _XSC_ETHDEV_H_ */ diff --git a/drivers/net/xsc/xsc_log.h b/drivers/net/xsc/xsc_log.h new file mode 100644 index 0000000000..16de436edb --- /dev/null +++ b/drivers/net/xsc/xsc_log.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2025 Yunsilicon Technology Co., Ltd. + */ + +#ifndef _XSC_LOG_H_ +#define _XSC_LOG_H_ + +#include <rte_log.h> + +extern int xsc_logtype_init; +extern int xsc_logtype_driver; + +#define RTE_LOGTYPE_XSC_INIT xsc_logtype_init +#define RTE_LOGTYPE_XSC_DRV xsc_logtype_driver + +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, XSC_INIT, "%s(): ", __func__, __VA_ARGS__) + +#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") + +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, XSC_DRV, "%s(): ", __func__, __VA_ARGS__) + +#endif /* _XSC_LOG_H_ */ -- 2.25.1