From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E137245FD7; Fri, 3 Jan 2025 16:04:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7690B402B4; Fri, 3 Jan 2025 16:04:16 +0100 (CET) Received: from lf-2-19.ptr.blmpb.com (lf-2-19.ptr.blmpb.com [101.36.218.19]) by mails.dpdk.org (Postfix) with ESMTP id 297A74021E for ; Fri, 3 Jan 2025 16:04:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1735916648; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=zN4JJgxL2LNKPo+/O4XaiMONnu2LfErUp37zbqkDRcA=; b=EhTdKt69byuXHVpwZfiNXtyUVJoSal09Q5+mNZpCdFYWrLqB5O+w2kkmTwBfMqCsjh6pVK oGsYE0BOe9X56OXOi7hwbrChm9tCbVjnCGy51OoXjhQSXi5Yyz/wpOLUucpnrinVJS81Os 7+Cho6dgQ65hzDLcNEmxXRZsCa8i2LRjWsWNhDhH36xnKzeOakGNl/cPH5NHiLUDSrBRcS EqQ/fwVr52KBMUF4S6GTyjbyI+P0eIj3B+4MWtGWmIiivUBFhc/Wy9W1EqVBY8guIm0ePA XPQJyK40JSHeGDbe9n2kzlPdNe+JG+1VCJzyBUJGgirM8aJ3CpbZw/XBWUb1RA== X-Original-From: WanRenyong In-Reply-To: <20250103150404.1529663-1-wanry@yunsilicon.com> Content-Transfer-Encoding: 7bit Cc: , , , , , , , , , Date: Fri, 03 Jan 2025 23:04:06 +0800 X-Mailer: git-send-email 2.25.1 To: From: "WanRenyong" Received: from ubuntu-liun.yunsilicon.com ([58.34.192.114]) by smtp.feishu.cn with ESMTPS; Fri, 03 Jan 2025 23:04:05 +0800 Subject: [PATCH v4 01/15] net/xsc: add xsc PMD framework Message-Id: <20250103150404.1529663-2-wanry@yunsilicon.com> Mime-Version: 1.0 X-Lms-Return-Path: Content-Type: text/plain; charset=UTF-8 References: <20250103150404.1529663-1-wanry@yunsilicon.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add xsc PMD framework, doc and build infrastructure, supporting PCI probe. Signed-off-by: WanRenyong --- .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 | 89 ++++++++++++++++++++++++++ drivers/net/xsc/xsc_ethdev.h | 15 +++++ drivers/net/xsc/xsc_log.h | 24 +++++++ 12 files changed, 215 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 818798273f..18293215c3 100644 --- a/.mailmap +++ b/.mailmap @@ -370,6 +370,7 @@ Dongdong Liu Dongsheng Rong Dongsu Han Dong Wang +Dongwei Xu Dongyang Pan <197020236@qq.com> Dong Zhou Don Provan @@ -1062,6 +1063,7 @@ Nagadheeraj Rottela Naga Harish K S V Naga Suresh Somarowthu Nalla Pradeep +Na Na Na Na Nan Chen Nandini Persad @@ -1306,6 +1308,7 @@ Ronak Doshi Ron Beider Ronghua Zhang RongQiang Xie +Rong Qian RongQing Li Rongwei Liu Rory Sexton @@ -1633,6 +1636,7 @@ Waldemar Dworakowski Walter Heymans Wang Sheng-Hui Wangyu (Eric) +WanRenyong Waterman Cao Wathsala Vithanage Weichun Chen @@ -1686,6 +1690,7 @@ Xiaonan Zhang Xiao Wang Xiaoxiao Zeng Xiaoxin Peng +Xiaoxiong Zhang Xiaoyu Min Xiaoyun Li Xiaoyun Wang diff --git a/MAINTAINERS b/MAINTAINERS index 60bdcce543..3426658486 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: WanRenyong +M: Na Na +M: Rong Qian +M: Xiaoxiong Zhang +M: Dongwei Xu +F: drivers/net/xsc/ +F: doc/guides/nics/xsc.rst +F: doc/guides/nics/features/xsc.ini + ZTE zxdh - EXPERIMENTAL M: Junlong Wang M: Lijie Shan 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 ` to setup the basic DPDK environment. + +- Learning about Yunsilicon metaScale Series NICs using + ``_. + +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 426dfcd982..6f766add72 100644 --- a/doc/guides/rel_notes/release_25_03.rst +++ b/doc/guides/rel_notes/release_25_03.rst @@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **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..a7dca46127 --- /dev/null +++ b/drivers/net/xsc/xsc_ethdev.c @@ -0,0 +1,89 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2025 Yunsilicon Technology Co., Ltd. + */ + +#include +#include + +#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 + +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