drivers/net Add Support mucse N10 Pmd Driver
Subsystems (2)
v17 cover drivers/net Add Support mucse N10 Pmd Driver
For This patchset just to support the basic chip init work and user can just found the eth_dev, but can't control more. For Now just support 2*10g nic,the chip can support 2*10g,4*10g,4*1g,8*1g,8*10g.
The Feature rx side can support rx-cksum-offload,rss,vlan-filter flow_clow,uncast_filter,mcast_filter,1588,Jumbo-frame The Feature tx side can support tx-cksum-offload,tso,vxlan-tso flow director base on ntuple pattern of tcp/udp/ip/ eth_hdr->type for sriov is also support.
Because of the chip design defect, for multiple-port mode one pci-bdf will have multiple-port (max can have four ports) so this code must be care of one bdf init multiple-port.
v17
* base 25.07 porting
* change rte_memcpy to memcpy
* doc rnp.rst remove ocp support, change nic-card description
v16
* fixed rxq/txq stop/start not add to eth_ops as rnp doc descript.
v15:
* fixed scatter recv for jumbo frame test by dts mtu.
v14:
* add multicast mac filter feature for basic nic feature.
* fixed pvs studio low,media,high level warning as the below cmd pvs-studio-analyzer analyze -f build/compile_commands.json -j 8 plog-converter -a GA:1,2,3 -t fullhtml PVS-Studio.log -o /root/report
v13:
* Supplementary document about n10 network card characteristics.
* update release_25_03.rst.
* fixed the code style advisea Stephen Hemminger.
* fixed the code issue check PVS-stdio for Static compilation error.
v12:
* fixed __rte_packed __deprecated__ compile issue.
v11:
* fixed array-bounds issue when used rte_memcpy src addr is
* not enough to hold align dst.
* improve efficient_code advised by Stephen
v10:
* fixed mingw windows meson issue
* rnp not support windows for now.
v9:
* fixed commit log format check by devtools.
* fixed code compile issue.
v8:
* fixed codespell issue.
* fixed MAINTAINERS file
v7:
* add support nic basic feature such as rss vlan strip/filter,
* mtu-change recv/send scater-recv/mutltiple-send.
* fixed code rationality, advised by Ferruh Yigit.
v6:
* fixed the doc(rst) format problem advise by Thomas Monjalon
v5:
* fixed the symbol name require by the style documentation
v4:
* one patch has been forgot to upload :(
v3:
* fixed http://dpdk.org/patch/129830 FreeBSD 13 compile Issue
* change iobar type to void suggest by Stephen Hemminger
* add KMOD_DEP support for vfio-pci
* change run-cmd argument parse check for invalid extra_args
v2:
* fixed MAINTAIN maillist fullname format
* fixed driver/net/meson the order issue of new driver to driver list
* improve virtual point function usage suggest by Stephen Hemminger
Wenbo Cao (29):
net/rnp: add skeleton
net/rnp: add ethdev probe and remove net/rnp: add log
net/rnp: support mailbox basic operate net/rnp: add device init and uninit net/rnp: add get device information operation net/rnp: add support MAC promisc mode net/rnp: add queue setup and release operations net/rnp: add queue stop and start operations net/rnp: add support device start stop operations net/rnp: add RSS support operations net/rnp: add support link update operations net/rnp: add support link setup operations net/rnp: add Rx burst simple support net/rnp: add Tx burst simple support net/rnp: add MTU set operation
net/rnp: add Rx scatter segment version net/rnp: add Tx multiple segment version net/rnp: add support basic stats operation net/rnp: add support xstats operation net/rnp: add unicast MAC filter operation net/rnp: add supported packet types net/rnp: add support Rx checksum offload net/rnp: add support Tx TSO offload net/rnp: support VLAN offloads
net/rnp: add support VLAN filters operations net/rnp: add queue info operation net/rnp: support Rx/Tx burst mode info net/rnp: add multicast MAC filter operation
.mailmap | 1 + MAINTAINERS | 6 + doc/guides/nics/features/rnp.ini | 34 + doc/guides/nics/img/mucse_nic_port.svg | 4023 ++++++++++++++++++++++++ doc/guides/nics/index.rst | 1 + doc/guides/nics/rnp.rst | 123 + doc/guides/rel_notes/release_25_07.rst | 5 + drivers/net/meson.build | 1 + drivers/net/rnp/base/meson.build | 18 + drivers/net/rnp/base/rnp_bdq_if.c | 398 +++ drivers/net/rnp/base/rnp_bdq_if.h | 154 + drivers/net/rnp/base/rnp_bitrev.h | 64 + drivers/net/rnp/base/rnp_common.c | 103 + drivers/net/rnp/base/rnp_common.h | 17 + drivers/net/rnp/base/rnp_crc32.c | 53 + drivers/net/rnp/base/rnp_crc32.h | 11 + drivers/net/rnp/base/rnp_dma_regs.h | 68 + drivers/net/rnp/base/rnp_eth_regs.h | 94 + drivers/net/rnp/base/rnp_fw_cmd.c | 162 + drivers/net/rnp/base/rnp_fw_cmd.h | 357 +++ drivers/net/rnp/base/rnp_hw.h | 141 + drivers/net/rnp/base/rnp_mac.c | 480 +++ drivers/net/rnp/base/rnp_mac.h | 36 + drivers/net/rnp/base/rnp_mac_regs.h | 210 ++ drivers/net/rnp/base/rnp_mbx.c | 507 +++ drivers/net/rnp/base/rnp_mbx.h | 59 + drivers/net/rnp/base/rnp_mbx_fw.c | 495 +++ drivers/net/rnp/base/rnp_mbx_fw.h | 24 + drivers/net/rnp/base/rnp_osdep.h | 176 ++ drivers/net/rnp/meson.build | 27 + drivers/net/rnp/rnp.h | 262 ++ drivers/net/rnp/rnp_ethdev.c | 1868 +++++++++++ drivers/net/rnp/rnp_link.c | 436 +++ drivers/net/rnp/rnp_link.h | 52 + drivers/net/rnp/rnp_logs.h | 36 + drivers/net/rnp/rnp_rss.c | 367 +++ drivers/net/rnp/rnp_rss.h | 44 + drivers/net/rnp/rnp_rxtx.c | 1822 +++++++++++ drivers/net/rnp/rnp_rxtx.h | 162 + 39 files changed, 12897 insertions(+) create mode 100644 doc/guides/nics/features/rnp.ini create mode 100644 doc/guides/nics/img/mucse_nic_port.svg create mode 100644 doc/guides/nics/rnp.rst create mode 100644 drivers/net/rnp/base/meson.build create mode 100644 drivers/net/rnp/base/rnp_bdq_if.c create mode 100644 drivers/net/rnp/base/rnp_bdq_if.h create mode 100644 drivers/net/rnp/base/rnp_bitrev.h create mode 100644 drivers/net/rnp/base/rnp_common.c create mode 100644 drivers/net/rnp/base/rnp_common.h create mode 100644 drivers/net/rnp/base/rnp_crc32.c create mode 100644 drivers/net/rnp/base/rnp_crc32.h create mode 100644 drivers/net/rnp/base/rnp_dma_regs.h create mode 100644 drivers/net/rnp/base/rnp_eth_regs.h create mode 100644 drivers/net/rnp/base/rnp_fw_cmd.c create mode 100644 drivers/net/rnp/base/rnp_fw_cmd.h create mode 100644 drivers/net/rnp/base/rnp_hw.h create mode 100644 drivers/net/rnp/base/rnp_mac.c create mode 100644 drivers/net/rnp/base/rnp_mac.h create mode 100644 drivers/net/rnp/base/rnp_mac_regs.h create mode 100644 drivers/net/rnp/base/rnp_mbx.c create mode 100644 drivers/net/rnp/base/rnp_mbx.h create mode 100644 drivers/net/rnp/base/rnp_mbx_fw.c create mode 100644 drivers/net/rnp/base/rnp_mbx_fw.h create mode 100644 drivers/net/rnp/base/rnp_osdep.h create mode 100644 drivers/net/rnp/meson.build create mode 100644 drivers/net/rnp/rnp.h create mode 100644 drivers/net/rnp/rnp_ethdev.c create mode 100644 drivers/net/rnp/rnp_link.c create mode 100644 drivers/net/rnp/rnp_link.h create mode 100644 drivers/net/rnp/rnp_logs.h create mode 100644 drivers/net/rnp/rnp_rss.c create mode 100644 drivers/net/rnp/rnp_rss.h create mode 100644 drivers/net/rnp/rnp_rxtx.c create mode 100644 drivers/net/rnp/rnp_rxtx.h
Signature · 1 line
2.25.1
PATCH v17 1/29 net/rnp: add skeleton
Add basic PMD library and doc build infrastructure Update maintainers file to claim responsibility.
--- .mailmap | 1 + MAINTAINERS | 6 + doc/guides/nics/features/rnp.ini | 8 + doc/guides/nics/img/mucse_nic_port.svg | 4023 ++++++++++++++++++++++++ doc/guides/nics/index.rst | 1 + doc/guides/nics/rnp.rst | 39 + doc/guides/rel_notes/release_25_07.rst | 5 + drivers/net/meson.build | 1 + drivers/net/rnp/meson.build | 18 + drivers/net/rnp/rnp_ethdev.c | 3 + 10 files changed, 4105 insertions(+) create mode 100644 doc/guides/nics/features/rnp.ini create mode 100644 doc/guides/nics/img/mucse_nic_port.svg create mode 100644 doc/guides/nics/rnp.rst create mode 100644 drivers/net/rnp/meson.build create mode 100644 drivers/net/rnp/rnp_ethdev.c
.mailmap +1 -0
@@ -1672,6 +1672,7 @@ Wei Xie <[email protected]> Weiyuan Li <[email protected]> Wei Zhao <[email protected]> Wen Chiu <[email protected]> +Wenbo Cao <[email protected]> Wen-Chi Yang <[email protected]> Wenfeng Liu <[email protected]> Wenjie Li <[email protected]>
MAINTAINERS +6 -0
@@ -1011,6 +1011,12 @@ F: drivers/net/r8169/ F: doc/guides/nics/r8169.rst F: doc/guides/nics/features/r8169.ini +Mucse rnp +M: Wenbo Cao <[email protected]> +F: drivers/net/rnp +F: doc/guides/nics/rnp.rst +F: doc/guides/nics/features/rnp.ini + Solarflare sfc_efx M: Andrew Rybchenko <[email protected]> F: drivers/common/sfc_efx/
doc/guides/nics/features/rnp.ini new file +8 -0
@@ -0,0 +1,8 @@ +; +; Supported features of the 'rnp' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux = Y +x86-64 = Y
doc/guides/nics/img/mucse_nic_port.svg new file +4023 -0
2,973 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.25.1
Part of the diff is not shown here. View the raw message.
PATCH v17 2/29 net/rnp: add ethdev probe and remove
In reply to Wenbo CaoAdd basic PCIe ethdev probe and remove.
--- doc/guides/nics/rnp.rst | 10 ++++++ drivers/net/rnp/rnp.h | 16 +++++++++ drivers/net/rnp/rnp_ethdev.c | 66 ++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 drivers/net/rnp/rnp.h
doc/guides/nics/rnp.rst +10 -0
@@ -14,6 +14,16 @@ Supported Chipsets and NICs - MUCSE Ethernet Controller N10 Series for 10GbE or 40GbE (Dual-port) +Support of Ethernet Network Controllers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +PCIE NICS +^^^^^^^^^ + +* ``N10G-X2-DC .... Dual-port 10 Gigabit SFP Ethernet Adapter`` +* ``N10G-X4-QC .... Quad-port 10 Gigabit SFP Ethernet Adapter`` +* ``N10G-X8-OC .... Octa-port 10 Gigabit SFP Ethernet Adapter`` + Chip Basic Overview ------------------- N10 has two functions, each function support muiple ports(1 to 8),which not same as normal pcie network card(one pf for each port).
drivers/net/rnp/rnp.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#ifndef __RNP_H__ +#define __RNP_H__ + +#define PCI_VENDOR_ID_MUCSE (0x8848) +#define RNP_DEV_ID_N10G_X2 (0x1000) +#define RNP_DEV_ID_N10G_X4 (0x1020) +#define RNP_DEV_ID_N10G_X8 (0x1060) + +struct rnp_eth_port { +}; + +#endif /* __RNP_H__ */
drivers/net/rnp/rnp_ethdev.c +66 -0
69 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 3/29 net/rnp: add log
In reply to Wenbo Caoadd log function for trace or debug
--- drivers/net/rnp/rnp_ethdev.c | 2 ++ drivers/net/rnp/rnp_logs.h | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 drivers/net/rnp/rnp_logs.h
drivers/net/rnp/rnp_ethdev.c +2 -0
@@ -64,6 +64,8 @@ static struct rte_pci_driver rte_rnp_pmd = { .remove = rnp_pci_remove, }; +RTE_LOG_REGISTER_SUFFIX (rnp_init_logtype, init,NOTICE ); +RTE_PMD_REGISTER_PCI (net_rnp, rte_rnp_pmd);RTE_PMD_REGISTER_PCI_TABLE (net_rnp, pci_id_rnp_map);RTE_PMD_REGISTER_KMOD_DEP (net_rnp,"igb_uio | uio_pci_generic | vfio-pci" );
drivers/net/rnp/rnp_logs.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#ifndef __RNP_LOGS_H__ +#define __RNP_LOGS_H__ + +#include <rte_log.h> + +extern int rnp_init_logtype; +#define RTE_LOGTYPE_RNP_INIT rnp_init_logtype +#define RNP_PMD_INIT_LOG (level, ...) \ + RTE_LOG_LINE_PREFIX(level, RNP_INIT, "%s(): ", __func__, __VA_ARGS__) +#define PMD_INIT_FUNC_TRACE () RNP_PMD_INIT_LOG(DEBUG, " >>") +#define RNP_PMD_DRV_LOG (level, ...) \ + RTE_LOG_LINE_PREFIX(level, RNP_INIT, \ + "%s(): ", __func__, __VA_ARGS__) +#define RNP_PMD_LOG (level, ...) \ + RTE_LOG_LINE_PREFIX(level, RNP_INIT, \ + "rnp_net: (%d) ", __LINE__, __VA_ARGS__) +#define RNP_PMD_ERR (fmt, ...) \ + RNP_PMD_LOG(ERR, fmt, ## __VA_ARGS__) +#define RNP_PMD_WARN (fmt, ...) \ + RNP_PMD_LOG(WARNING, fmt, ## __VA_ARGS__) +#define RNP_PMD_INFO (fmt, ...) \ + RNP_PMD_LOG(INFO, fmt, ## __VA_ARGS__) + +#ifdef RTE_LIBRTE_RNP_REG_DEBUG +#define RNP_PMD_REG_LOG (level, ...) \ + RTE_LOG_LINE_PREFIX(level, RNP_INIT, \ + "%s(): ", __func__, __VA_ARGS__) +#else +#define RNP_PMD_REG_LOG (...) do { } while (0) +#endif + +#endif /* __RNP_LOGS_H__ */
Signature · 1 line
2.25.1
PATCH v17 4/29 net/rnp: support mailbox basic operate
In reply to Wenbo CaoThis patch adds support for mailbox of rnp PMD driver, mailbox is used for communication between pf with fw and vf driver.
--- drivers/net/rnp/base/meson.build | 12 + drivers/net/rnp/base/rnp_hw.h | 77 +++++ drivers/net/rnp/base/rnp_mbx.c | 507 +++++++++++++++++++++++++++++++ drivers/net/rnp/base/rnp_mbx.h | 59 ++++ drivers/net/rnp/base/rnp_osdep.h | 55 ++++ drivers/net/rnp/meson.build | 5 + drivers/net/rnp/rnp.h | 19 ++ 7 files changed, 734 insertions(+) create mode 100644 drivers/net/rnp/base/meson.build create mode 100644 drivers/net/rnp/base/rnp_hw.h create mode 100644 drivers/net/rnp/base/rnp_mbx.c create mode 100644 drivers/net/rnp/base/rnp_mbx.h create mode 100644 drivers/net/rnp/base/rnp_osdep.h
drivers/net/rnp/base/meson.build new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2023 Mucse IC Design Ltd. + +sources = [ + 'rnp_mbx.c', +] + +c_args = cflags +base_lib = static_library('rnp_base', sources, + dependencies: [static_rte_eal, static_rte_net, static_rte_ethdev], + c_args: c_args) +base_objs = base_lib.extract_all_objects(recursive: true)
drivers/net/rnp/base/rnp_hw.h new file +77 -0
77 lines not on this page · raw message
drivers/net/rnp/base/rnp_mbx.c new file +507 -0
507 lines not on this page · raw message
drivers/net/rnp/base/rnp_mbx.h new file +59 -0
59 lines not on this page · raw message
drivers/net/rnp/base/rnp_osdep.h new file +55 -0
55 lines not on this page · raw message
drivers/net/rnp/meson.build +5 -0
@@ -13,6 +13,11 @@ if arch_subdir == 'riscv' subdir_done() endif +subdir('base') +objs = [base_objs] + +includes += include_directories('base') + sources = files( 'rnp_ethdev.c', )
drivers/net/rnp/rnp.h +19 -0
@@ -5,12 +5,31 @@#ifndef __RNP_H__#define __RNP_H__ +#include <ethdev_driver.h> +#include <rte_interrupts.h> + +#include "base/rnp_hw.h" +#define PCI_VENDOR_ID_MUCSE (0x8848)#define RNP_DEV_ID_N10G_X2 (0x1000)#define RNP_DEV_ID_N10G_X4 (0x1020)#define RNP_DEV_ID_N10G_X8 (0x1060) +#define RNP_MAX_VF_NUM (64) +#define RNP_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET + +struct rnp_proc_priv { +const struct rnp_mbx_ops *mbx_ops; +};struct rnp_eth_port { }; +struct rnp_eth_adapter { +struct rnp_hw hw; +struct rte_eth_dev *eth_dev;/* alloc eth_dev by platform */ +}; + +#define RNP_DEV_TO_PROC_PRIV (eth_dev) \ + ((struct rnp_proc_priv *)(eth_dev)->process_private) +#endif /* __RNP_H__ */
Signature · 1 line
2.25.1
PATCH v17 5/29 net/rnp: add device init and uninit
In reply to Wenbo Caoadd firmware communic method and basic device
init, uninit and close resource function.
--- doc/guides/nics/rnp.rst | 10 + drivers/net/rnp/base/meson.build | 4 + drivers/net/rnp/base/rnp_common.c | 73 ++++++ drivers/net/rnp/base/rnp_common.h | 12 + drivers/net/rnp/base/rnp_dma_regs.h | 13 ++ drivers/net/rnp/base/rnp_eth_regs.h | 15 ++ drivers/net/rnp/base/rnp_fw_cmd.c | 75 +++++++ drivers/net/rnp/base/rnp_fw_cmd.h | 216 ++++++++++++++++++ drivers/net/rnp/base/rnp_hw.h | 39 ++++ drivers/net/rnp/base/rnp_mac.c | 28 +++ drivers/net/rnp/base/rnp_mac.h | 14 ++ drivers/net/rnp/base/rnp_mbx_fw.c | 337 ++++++++++++++++++++++++++++ drivers/net/rnp/base/rnp_mbx_fw.h | 18 ++ drivers/net/rnp/base/rnp_osdep.h | 91 ++++++++ drivers/net/rnp/meson.build | 1 + drivers/net/rnp/rnp.h | 44 ++++ drivers/net/rnp/rnp_ethdev.c | 321 +++++++++++++++++++++++++- 17 files changed, 1302 insertions(+), 9 deletions(-) create mode 100644 drivers/net/rnp/base/rnp_common.c create mode 100644 drivers/net/rnp/base/rnp_common.h create mode 100644 drivers/net/rnp/base/rnp_dma_regs.h create mode 100644 drivers/net/rnp/base/rnp_eth_regs.h create mode 100644 drivers/net/rnp/base/rnp_fw_cmd.c create mode 100644 drivers/net/rnp/base/rnp_fw_cmd.h create mode 100644 drivers/net/rnp/base/rnp_mac.c create mode 100644 drivers/net/rnp/base/rnp_mac.h create mode 100644 drivers/net/rnp/base/rnp_mbx_fw.c create mode 100644 drivers/net/rnp/base/rnp_mbx_fw.h
doc/guides/nics/rnp.rst +10 -0
@@ -47,3 +47,13 @@ Limitations or Known issues --------------------------- X86-32, BSD, Armv7, RISC-V, Windows, are not supported yet. + +Supported APIs +-------------- + +rte_eth APIs +~~~~~~~~~~~~ + +Listed below are the rte_eth functions supported: +* ``rte_eth_dev_close`` +* ``rte_eth_dev_stop``
drivers/net/rnp/base/meson.build +4 -0
@@ -3,6 +3,10 @@ sources = [ 'rnp_mbx.c', + 'rnp_fw_cmd.c', + 'rnp_mbx_fw.c', + 'rnp_common.c', + 'rnp_mac.c', ] c_args = cflags
drivers/net/rnp/base/rnp_common.c new file +73 -0
73 lines not on this page · raw message
drivers/net/rnp/base/rnp_common.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#ifndef _RNP_COMMON_H_ +#define _RNP_COMMON_H_ + +#define RNP_NIC_RESET _NIC_(0x0010) +int rnp_init_hw (struct rnp_hw *hw); +int rnp_setup_common_ops (struct rnp_hw *hw); + +#endif /* _RNP_COMMON_H_ */
drivers/net/rnp/base/rnp_dma_regs.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#ifndef _RNP_DMA_REGS_H_ +#define _RNP_DMA_REGS_H_ + +#define RNP_DMA_VERSION (0) +#define RNP_DMA_HW_EN (0x10) +#define RNP_DMA_EN_ALL (0b1111) +#define RNP_DMA_HW_STATE (0x14) + +#endif /* _RNP_DMA_REGS_H_ */
drivers/net/rnp/base/rnp_eth_regs.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#ifndef _RNP_ETH_REGS_H +#define _RNP_ETH_REGS_H + +#define RNP_E_ENG_BYPASS _ETH_(0x8000) +#define RNP_E_VXLAN_PARSE_EN _ETH_(0x8004) +#define RNP_E_FILTER_EN _ETH_(0x801c) +#define RNP_E_REDIR_EN _ETH_(0x8030) + +#define RNP_TC_PORT_OFFSET (lane) _ETH_(0xe840 + 0x04 * (lane)) + +#endif /* _RNP_ETH_REGS_H */
drivers/net/rnp/base/rnp_fw_cmd.c new file +75 -0
75 lines not on this page · raw message
drivers/net/rnp/base/rnp_fw_cmd.h new file +216 -0
216 lines not on this page · raw message
drivers/net/rnp/base/rnp_hw.h +39 -0
@@ -7,6 +7,8 @@#include "rnp_osdep.h" +#define RNP_MAX_PORT_OF_PF (4) +struct rnp_hw ;/* Mailbox Operate Info */ enum RNP_MBX_ID {
@@ -56,7 +58,34 @@ struct rnp_mbx_info {struct rnp_mbx_sync syncs[RNP_MBX_FW +1 ]; }; +struct rnp_eth_port ; +/* mac operations */ +struct rnp_mac_ops { +/* update mac packet filter mode */ +int (*get_macaddr)(struct rnp_eth_port *port,u8 *mac); +}; +struct rnp_eth_adapter ; +struct rnp_fw_info { +char cookie_name[RTE_MEMZONE_NAMESIZE ]; +struct rnp_dma_mem mem; +void *cookie_pool; +bool fw_irq_en; +bool msg_alloced; + +u64 fw_features; +spinlock_t fw_lock;/* mc-sp Protect firmware logic */ +}; + +#define rnp_call_hwif_impl(port, f, arg...) \ + (((f) != NULL) ? ((f) (port, arg)) : (-ENODEV)) + +enum rnp_nic_mode { +RNP_SINGLE_40G =0 , +RNP_SINGLE_10G =1 , +RNP_DUAL_10G =2 , +RNP_QUAD_10G =3 , +};/* hw device description */ struct rnp_hw {
@@ -70,8 +99,18 @@ struct rnp_hw {u16 vendor_id;u16 max_vfs;/* device max support vf */ +char device_name[RTE_DEV_NAME_MAX_LEN ]; + +u8 max_port_num;/* max sub port of this nic */ +u8 lane_mask;/* lane enabled bit */ +u8 nic_mode;u16 pf_vf_num; +/* hardware port sequence info */ +u8 phy_port_ids[RNP_MAX_PORT_OF_PF ];/* port id: for lane0~3: value:0 ~ 7*/ +u8 lane_of_port[RNP_MAX_PORT_OF_PF ];/* lane_id: hw lane map port 1:0 0:1 or 0:0 1:1 */ +bool lane_is_sgmii[RNP_MAX_PORT_OF_PF ];struct rnp_mbx_info mbx; + struct rnp_fw_info fw_info; };#endif /* _RNP_HW_H_ */
drivers/net/rnp/base/rnp_mac.c new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#include "rnp_osdep.h" + +#include "rnp_mbx_fw.h" +#include "rnp_mac.h" +#include "../rnp.h" + +const struct rnp_mac_ops rnp_mac_ops_pf = { + .get_macaddr = rnp_mbx_fw_get_macaddr, +}; + +int rnp_get_mac_addr (struct rnp_eth_port *port,u8 *mac) +{ +const struct rnp_mac_ops *mac_ops = +RNP_DEV_PP_TO_MAC_OPS (port->eth_dev); + +return rnp_call_hwif_impl (port, mac_ops->get_macaddr, mac); +} + +void rnp_mac_ops_init (struct rnp_hw *hw) +{ +struct rnp_proc_priv *proc_priv =RNP_DEV_TO_PROC_PRIV (hw->back->eth_dev); + + proc_priv->mac_ops = &rnp_mac_ops_pf; +}
drivers/net/rnp/base/rnp_mac.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#ifndef _RNP_MAC_H_ +#define _RNP_MAC_H_ + +#include "rnp_osdep.h" +#include "rnp_hw.h" + +void rnp_mac_ops_init (struct rnp_hw *hw); +int rnp_get_mac_addr (struct rnp_eth_port *port,u8 *mac); + +#endif /* _RNP_MAC_H_ */
drivers/net/rnp/base/rnp_mbx_fw.c new file +337 -0
337 lines not on this page · raw message
drivers/net/rnp/base/rnp_mbx_fw.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#ifndef _RNP_MBX_FW_H_ +#define _RNP_MBX_FW_H_ + +#include "rnp_osdep.h" +#include "rnp_hw.h" + +struct rnp_eth_port ; + +int rnp_mbx_fw_get_macaddr (struct rnp_eth_port *port,u8 *mac_addr); +int rnp_mbx_fw_get_capability (struct rnp_eth_port *port); +int rnp_mbx_fw_reset_phy (struct rnp_hw *hw); +int rnp_fw_init (struct rnp_hw *hw); + +#endif /* _RNP_MBX_FW_H_ */
drivers/net/rnp/base/rnp_osdep.h +91 -0
119 lines not on this page · raw message
drivers/net/rnp/meson.build +1 -0
@@ -16,6 +16,7 @@ endif subdir('base') objs = [base_objs] +deps += ['net'] includes += include_directories('base') sources = files(
drivers/net/rnp/rnp.h +44 -0
64 lines not on this page · raw message
drivers/net/rnp/rnp_ethdev.c +312 -9
349 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 6/29 net/rnp: add get device information operation
In reply to Wenbo Caoadd get device hardware capability function
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 1 + drivers/net/rnp/base/rnp_fw_cmd.c | 20 ++++++ drivers/net/rnp/base/rnp_fw_cmd.h | 80 +++++++++++++++++++++ drivers/net/rnp/base/rnp_mbx_fw.c | 55 ++++++++++++++ drivers/net/rnp/base/rnp_mbx_fw.h | 1 + drivers/net/rnp/rnp.h | 73 ++++++++++++++++++- drivers/net/rnp/rnp_ethdev.c | 115 +++++++++++++++++++++++++++++- 8 files changed, 344 insertions(+), 2 deletions(-)
doc/guides/nics/features/rnp.ini +1 -0
@@ -4,5 +4,6 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Speed capabilities = Y Linux = Y x86-64 = Y
doc/guides/nics/rnp.rst +1 -0
@@ -57,3 +57,4 @@ rte_eth APIs Listed below are the rte_eth functions supported: * ``rte_eth_dev_close`` * ``rte_eth_dev_stop`` +* ``rte_eth_dev_infos_get``
drivers/net/rnp/base/rnp_fw_cmd.c +20 -0
@@ -51,6 +51,23 @@ rnp_build_get_macaddress_req(struct rnp_mbx_fw_cmd_req *req, arg->pfvf_num = req_arg->param1; } +static inline void +rnp_build_get_lane_status_req (struct rnp_mbx_fw_cmd_req *req, +struct rnp_fw_req_arg *req_arg, +void *cookie) +{ +struct rnp_get_lane_st_req *arg = (struct rnp_get_lane_st_req *)req->data; + + req->flags =0 ; + req->opcode =RNP_GET_LANE_STATUS ; + req->datalen =sizeof (*arg); + req->cookie = cookie; + req->reply_lo =0 ; + req->reply_hi =0 ; + + arg->nr_lane = req_arg->param0; +} +int rnp_build_fwcmd_req (struct rnp_mbx_fw_cmd_req *req,struct rnp_fw_req_arg *arg,void *cookie)
@@ -67,6 +84,9 @@ int rnp_build_fwcmd_req(struct rnp_mbx_fw_cmd_req *req,case RNP_GET_MAC_ADDRESS :rnp_build_get_macaddress_req (req, arg, cookie);break ; +case RNP_GET_LANE_STATUS : +rnp_build_get_lane_status_req (req, arg, cookie); +break ;default : err = -EOPNOTSUPP ; }
drivers/net/rnp/base/rnp_fw_cmd.h +80 -0
92 lines not on this page · raw message
drivers/net/rnp/base/rnp_mbx_fw.c +55 -0
58 lines not on this page · raw message
drivers/net/rnp/base/rnp_mbx_fw.h +1 -0
@@ -12,6 +12,7 @@ struct rnp_eth_port;int rnp_mbx_fw_get_macaddr (struct rnp_eth_port *port,u8 *mac_addr);int rnp_mbx_fw_get_capability (struct rnp_eth_port *port); +int rnp_mbx_fw_get_lane_stat (struct rnp_eth_port *port);int rnp_mbx_fw_reset_phy (struct rnp_hw *hw);int rnp_fw_init (struct rnp_hw *hw);
drivers/net/rnp/rnp.h +72 -1
82 lines not on this page · raw message
drivers/net/rnp/rnp_ethdev.c +114 -1
137 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 7/29 net/rnp: add support MAC promisc mode
In reply to Wenbo Caoadd support two method of MAC unicast promisc
mulcast promisc broadcast promisc mode
--- doc/guides/nics/features/rnp.ini | 2 + doc/guides/nics/rnp.rst | 11 +++ drivers/net/rnp/base/rnp_common.c | 5 ++ drivers/net/rnp/base/rnp_eth_regs.h | 15 ++++ drivers/net/rnp/base/rnp_hw.h | 11 ++- drivers/net/rnp/base/rnp_mac.c | 107 +++++++++++++++++++++++++++- drivers/net/rnp/base/rnp_mac.h | 2 + drivers/net/rnp/base/rnp_mac_regs.h | 39 ++++++++++ drivers/net/rnp/base/rnp_osdep.h | 5 ++ drivers/net/rnp/rnp_ethdev.c | 43 +++++++++++ 10 files changed, 238 insertions(+), 2 deletions(-) create mode 100644 drivers/net/rnp/base/rnp_mac_regs.h
doc/guides/nics/features/rnp.ini +2 -0
@@ -5,5 +5,7 @@ ; [Features] Speed capabilities = Y +Promiscuous mode = Y +Allmulticast mode = Y Linux = Y x86-64 = Y
doc/guides/nics/rnp.rst +11 -0
@@ -34,6 +34,11 @@ N10 has two functions, each function support muiple ports(1 to 8),which not same rnp mucse nic port. +Features +-------- + +- Promiscuous mode + Prerequisites and Pre-conditions -------------------------------- - Prepare the system as recommended by DPDK suite.
@@ -58,3 +63,9 @@ Listed below are the rte_eth functions supported: * ``rte_eth_dev_close`` * ``rte_eth_dev_stop`` * ``rte_eth_dev_infos_get`` +* ``rte_eth_promiscuous_disable`` +* ``rte_eth_promiscuous_enable`` +* ``rte_eth_allmulticast_enable`` +* ``rte_eth_allmulticast_disable`` +* ``rte_eth_promiscuous_get`` +* ``rte_eth_allmulticast_get``
drivers/net/rnp/base/rnp_common.c +5 -0
@@ -4,6 +4,7 @@#include "rnp_osdep.h" #include "rnp_hw.h" +#include "rnp_mac_regs.h" #include "rnp_eth_regs.h" #include "rnp_dma_regs.h" #include "rnp_common.h"
@@ -28,6 +29,7 @@ int rnp_init_hw(struct rnp_hw *hw)struct rnp_eth_port *port =RNP_DEV_TO_PORT (hw->back->eth_dev);u32 version =0 ;int ret =-1 ; +u32 idx =0 ;u32 state;PMD_INIT_FUNC_TRACE ();
@@ -60,6 +62,9 @@ int rnp_init_hw(struct rnp_hw *hw)if (hw->nic_mode ==RNP_DUAL_10G && hw->max_port_num ==2 )RNP_E_REG_WR (hw,RNP_TC_PORT_OFFSET (RNP_TARGET_TC_PORT ),RNP_PORT_OFF_QUEUE_NUM ); +/* setup mac resiger ctrl base */ +for (idx =0 ; idx < hw->max_port_num; idx++) + hw->mac_base[idx] = (u8 *)hw->e_ctrl +RNP_MAC_BASE_OFFSET (idx);return 0 ; }
drivers/net/rnp/base/rnp_eth_regs.h +15 -0
@@ -10,6 +10,21 @@#define RNP_E_FILTER_EN _ETH_(0x801c)#define RNP_E_REDIR_EN _ETH_(0x8030) +/* Mac Host Filter */ +#define RNP_MAC_FCTRL _ETH_(0x9110) +#define RNP_MAC_FCTRL_MPE RTE_BIT32(8)/* Multicast Promiscuous En */ +#define RNP_MAC_FCTRL_UPE RTE_BIT32(9)/* Unicast Promiscuous En */ +#define RNP_MAC_FCTRL_BAM RTE_BIT32(10)/* Broadcast Accept Mode */ +#define RNP_MAC_FCTRL_BYPASS (\ + RNP_MAC_FCTRL_MPE | \ + RNP_MAC_FCTRL_UPE | \ + RNP_MAC_FCTRL_BAM) +/* Mucast unicast mac hash filter ctrl */ +#define RNP_MAC_MCSTCTRL _ETH_(0x9114) +#define RNP_MAC_HASH_MASK RTE_GENMASK32(11, 0) +#define RNP_MAC_MULTICASE_TBL_EN RTE_BIT32(2) +#define RNP_MAC_UNICASE_TBL_EN RTE_BIT32(3) +#define RNP_TC_PORT_OFFSET (lane) _ETH_(0xe840 + 0x04 * (lane))#endif /* _RNP_ETH_REGS_H */
drivers/net/rnp/base/rnp_hw.h +10 -1
@@ -60,9 +60,17 @@ struct rnp_mbx_info {struct rnp_eth_port ;/* mac operations */ +enum rnp_mpf_modes { +RNP_MPF_MODE_NONE =0 , +RNP_MPF_MODE_ALLMULTI ,/* Multitle Promisc */ +RNP_MPF_MODE_PROMISC ,/* Unicast Promisc */ +}; +struct rnp_mac_ops { -/* update mac packet filter mode */ +/* get default mac address */ int (*get_macaddr)(struct rnp_eth_port *port,u8 *mac); +/* update mac packet filter mode */ +int (*update_mpfm)(struct rnp_eth_port *port,u32 mode,bool en); };struct rnp_eth_adapter ;
@@ -92,6 +100,7 @@ struct rnp_hw {struct rnp_eth_adapter *back;/* backup to the adapter handle */ void __iomem *e_ctrl;/* ethernet control bar */ void __iomem *c_ctrl;/* crypto control bar */ +void __iomem *mac_base[RNP_MAX_PORT_OF_PF ];/* mac ctrl register base */ u32 c_blen;/* crypto bar size */ /* pci device info */
drivers/net/rnp/base/rnp_mac.c +106 -1
125 lines not on this page · raw message
drivers/net/rnp/base/rnp_mac.h +2 -0
@@ -10,5 +10,7 @@void rnp_mac_ops_init (struct rnp_hw *hw);int rnp_get_mac_addr (struct rnp_eth_port *port,u8 *mac); +int rnp_update_mpfm (struct rnp_eth_port *port, +u32 mode,bool en);#endif /* _RNP_MAC_H_ */
drivers/net/rnp/base/rnp_mac_regs.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#ifndef _RNP_MAC_REGS_H_ +#define _RNP_MAC_REGS_H_ + +#define RNP_MAC_BASE_OFFSET (n) (_MAC_(0) + ((0x10000) * (n))) + +#define RNP_MAC_PKT_FLT_CTRL (0x8) +/* Receive All */ +#define RNP_MAC_RA RTE_BIT32(31) +/* Pass Control Packets */ +#define RNP_MAC_PCF RTE_GENMASK32(7, 6) +#define RNP_MAC_PCF_S (6) +/* Mac Filter ALL Ctrl Frame */ +#define RNP_MAC_PCF_FAC (0) +/* Mac Forward ALL Ctrl Frame Except Pause */ +#define RNP_MAC_PCF_NO_PAUSE (1) +/* Mac Forward All Ctrl Pkt */ +#define RNP_MAC_PCF_PA (2) +/* Mac Forward Ctrl Frame Match Unicast */ +#define RNP_MAC_PCF_PUN (3) +/* Promiscuous Mode */ +#define RNP_MAC_PROMISC_EN RTE_BIT32(0) +/* Hash Unicast */ +#define RNP_MAC_HUC RTE_BIT32(1) +/* Hash Multicast */ +#define RNP_MAC_HMC RTE_BIT32(2) +/* Pass All Multicast */ +#define RNP_MAC_PM RTE_BIT32(4) +/* Disable Broadcast Packets */ +#define RNP_MAC_DBF RTE_BIT32(5) +/* Hash or Perfect Filter */ +#define RNP_MAC_HPF RTE_BIT32(10) +#define RNP_MAC_VTFE RTE_BIT32(16) + + +#endif /* _RNP_MAC_REGS_H_ */
drivers/net/rnp/base/rnp_osdep.h +5 -0
@@ -49,6 +49,7 @@ typedef uint64_t u64;#define _ETH_ (off) ((off) + (0x10000))#define _NIC_ (off) ((off) + (0x30000)) +#define _MAC_ (off) ((off) + (0x60000))#define _MSI_ (off) ((off) + (0xA0000))#if RTE_BYTE_ORDER ==RTE_BIG_ENDIAN
@@ -142,5 +143,9 @@ rnp_dma_mem_free(__rte_unused struct rnp_hw *hw, rnp_reg_write32((hw)->c_ctrl, ((off) & ((hw)->c_blen - 1)), (value))#define RNP_C_REG_RD (hw, off) \ rnp_reg_read32((hw)->c_ctrl, ((off) & ((hw)->c_blen - 1))) +#define RNP_MAC_REG_WR (hw, lane, off, value) \ + rnp_reg_write32((hw)->mac_base[lane], (off), (value)) +#define RNP_MAC_REG_RD (hw, lane, off) \ + rnp_reg_read32((hw)->mac_base[lane], (off))#endif /* _RNP_OSDEP_H_ */
drivers/net/rnp/rnp_ethdev.c +43 -0
54 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 8/29 net/rnp: add queue setup and release operations
In reply to Wenbo Caosupport tx/rx queue setup and release add hw bd
queue reset,sw queue reset.
--- doc/guides/nics/rnp.rst | 3 + drivers/net/rnp/base/meson.build | 1 + drivers/net/rnp/base/rnp_bdq_if.c | 398 +++++++++++++++++++++++ drivers/net/rnp/base/rnp_bdq_if.h | 149 +++++++++ drivers/net/rnp/base/rnp_common.h | 4 + drivers/net/rnp/base/rnp_dma_regs.h | 45 +++ drivers/net/rnp/base/rnp_eth_regs.h | 4 + drivers/net/rnp/base/rnp_hw.h | 4 + drivers/net/rnp/base/rnp_osdep.h | 12 + drivers/net/rnp/meson.build | 1 + drivers/net/rnp/rnp.h | 2 + drivers/net/rnp/rnp_ethdev.c | 38 ++- drivers/net/rnp/rnp_rxtx.c | 471 ++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.h | 123 ++++++++ 14 files changed, 1254 insertions(+), 1 deletion(-) create mode 100644 drivers/net/rnp/base/rnp_bdq_if.c create mode 100644 drivers/net/rnp/base/rnp_bdq_if.h create mode 100644 drivers/net/rnp/rnp_rxtx.c create mode 100644 drivers/net/rnp/rnp_rxtx.h
doc/guides/nics/rnp.rst +3 -0
@@ -37,6 +37,7 @@ N10 has two functions, each function support muiple ports(1 to 8),which not same Features -------- +- Multiple queues for TX and RX - Promiscuous mode Prerequisites and Pre-conditions
@@ -69,3 +70,5 @@ Listed below are the rte_eth functions supported: * ``rte_eth_allmulticast_disable`` * ``rte_eth_promiscuous_get`` * ``rte_eth_allmulticast_get`` +* ``rte_eth_rx_queue_setup`` +* ``rte_eth_tx_queue_setup``
drivers/net/rnp/base/meson.build +1 -0
@@ -7,6 +7,7 @@ sources = [ 'rnp_mbx_fw.c', 'rnp_common.c', 'rnp_mac.c', + 'rnp_bdq_if.c', ] c_args = cflags
drivers/net/rnp/base/rnp_bdq_if.c new file +398 -0
398 lines not on this page · raw message
drivers/net/rnp/base/rnp_bdq_if.h new file +149 -0
149 lines not on this page · raw message
drivers/net/rnp/base/rnp_common.h +4 -0
@@ -6,6 +6,10 @@#define _RNP_COMMON_H_#define RNP_NIC_RESET _NIC_(0x0010) +#define RNP_GET_MAC_HI (macaddr) (((macaddr[0]) << 8) | (macaddr[1])) +#define RNP_GET_MAC_LO (macaddr) \ + ((macaddr[2] << 24) | (macaddr[3] << 16) | \ + ((macaddr[4] << 8)) | (macaddr[5]))int rnp_init_hw (struct rnp_hw *hw);int rnp_setup_common_ops (struct rnp_hw *hw);
drivers/net/rnp/base/rnp_dma_regs.h +45 -0
50 lines not on this page · raw message
drivers/net/rnp/base/rnp_eth_regs.h +4 -0
@@ -10,6 +10,10 @@#define RNP_E_FILTER_EN _ETH_(0x801c)#define RNP_E_REDIR_EN _ETH_(0x8030) +/* rx queue flow ctrl */ +#define RNP_RX_FC_ENABLE _ETH_(0x8520) +#define RNP_RING_FC_EN (n) _ETH_(0x8524 + ((0x4) * ((n) / 32))) +#define RNP_RING_FC_THRESH (n) _ETH_(0x8a00 + ((0x4) * (n)))/* Mac Host Filter */ #define RNP_MAC_FCTRL _ETH_(0x9110)#define RNP_MAC_FCTRL_MPE RTE_BIT32(8)/* Multicast Promiscuous En */
drivers/net/rnp/base/rnp_hw.h +4 -0
@@ -120,6 +120,10 @@ struct rnp_hw {bool lane_is_sgmii[RNP_MAX_PORT_OF_PF ];struct rnp_mbx_info mbx;struct rnp_fw_info fw_info; + +spinlock_t rxq_reset_lock;/* reset op isn't thread safe */ + spinlock_t txq_reset_lock; /* reset op isn't thread safe */ + };#endif /* _RNP_HW_H_ */
drivers/net/rnp/base/rnp_osdep.h +12 -0
@@ -35,6 +35,7 @@ typedef uint64_t u64;#define mb () rte_mb()#define wmb () rte_wmb() +#define rmb () rte_rmb()#ifndef ffs#define ffs (x) (rte_fls_u32((x) & (-x)))#endif
@@ -42,11 +43,22 @@ typedef uint64_t u64;#define udelay (x) rte_delay_us(x)#define mdelay (x) rte_delay_ms(x) +#ifndef upper_32_bits +#define upper_32_bits (n) ((u32)(((n) >> 16) >> 16)) +#define lower_32_bits (n) ((u32)((n) & 0xffffffff)) +#endif + +#ifndef cpu_to_le32 +#define cpu_to_le16 (v) rte_cpu_to_le_16((u16)(v)) +#define cpu_to_le32 (v) rte_cpu_to_le_32((u32)(v)) +#endif +#define spinlock_t rte_spinlock_t#define spin_lock_init (spinlock_v) rte_spinlock_init(spinlock_v)#define spin_lock (spinlock_v) rte_spinlock_lock(spinlock_v)#define spin_unlock (spinlock_v) rte_spinlock_unlock(spinlock_v) +#define _RING_ (off) ((off) + (0x08000))#define _ETH_ (off) ((off) + (0x10000))#define _NIC_ (off) ((off) + (0x30000))#define _MAC_ (off) ((off) + (0x60000))
drivers/net/rnp/meson.build +1 -0
@@ -21,4 +21,5 @@ includes += include_directories('base') sources = files( 'rnp_ethdev.c', + 'rnp_rxtx.c', )
drivers/net/rnp/rnp.h +2 -0
@@ -108,6 +108,7 @@ struct rnp_eth_port {struct rte_ether_addr mac_addr;struct rte_eth_dev *eth_dev;struct rnp_port_attr attr; +struct rnp_tx_queue *tx_queues[RNP_MAX_RX_QUEUE_NUM ];struct rnp_hw *hw; };
@@ -116,6 +117,7 @@ struct rnp_eth_adapter {struct rte_pci_device *pdev;struct rte_eth_dev *eth_dev;/* alloc eth_dev by platform */ +struct rte_mempool *reset_pool;struct rnp_eth_port *ports[RNP_MAX_PORT_OF_PF ];uint16_t closed_ports;uint16_t inited_ports;
drivers/net/rnp/rnp_ethdev.c +37 -1
@@ -15,6 +15,7 @@#include "base/rnp_mac.h" #include "base/rnp_eth_regs.h" #include "base/rnp_common.h" +#include "rnp_rxtx.h" static struct rte_eth_dev *rnp_alloc_eth_port (struct rte_pci_device *pci,char *name)
@@ -177,7 +178,14 @@ static int rnp_dev_infos_get(struct rte_eth_dev *eth_dev, dev_info->reta_size =RNP_RSS_INDIR_SIZE ;/* speed cap info */ dev_info->speed_capa =rnp_get_speed_caps (eth_dev); - +/* default ring configure */ + dev_info->default_rxportconf.burst_size =32 ; + dev_info->default_txportconf.burst_size =32 ; + dev_info->default_rxportconf.nb_queues =1 ; + dev_info->default_txportconf.nb_queues =1 ; + dev_info->default_rxportconf.ring_size =256 ; + dev_info->default_txportconf.ring_size =256 ; +/* default port configure */ dev_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_drop_en =0 , .offloads =0 ,
@@ -238,6 +246,11 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .promiscuous_disable = rnp_promiscuous_disable, .allmulticast_enable = rnp_allmulticast_enable, .allmulticast_disable = rnp_allmulticast_disable, + + .rx_queue_setup = rnp_rx_queue_setup, + .rx_queue_release = rnp_dev_rx_queue_release, + .tx_queue_setup = rnp_tx_queue_setup, + .tx_queue_release = rnp_dev_tx_queue_release, }; static void
@@ -330,6 +343,26 @@ rnp_proc_priv_init(struct rte_eth_dev *dev)return 0 ; } +static int +rnp_rx_reset_pool_setup (struct rnp_eth_adapter *adapter) +{ +struct rte_eth_dev *eth_dev = adapter->eth_dev; +char name[RTE_MEMPOOL_NAMESIZE ]; + +snprintf (name,sizeof (name),"rx_reset_pool_%d:%d" , + eth_dev->data->port_id, eth_dev->device->numa_node); + + adapter->reset_pool =rte_pktmbuf_pool_create (name,2 , +0 ,0 ,RTE_MBUF_DEFAULT_BUF_SIZE , + eth_dev->device->numa_node); +if (adapter->reset_pool ==NULL ) { +RNP_PMD_ERR ("mempool %s create failed" , name); +return -ENOMEM ; + } + +return 0 ; +} +static int rnp_eth_dev_init (struct rte_eth_dev *eth_dev) {
@@ -426,6 +459,9 @@ rnp_eth_dev_init(struct rte_eth_dev *eth_dev)rte_eth_dev_probing_finish (sub_eth_dev); } } + ret =rnp_rx_reset_pool_setup (adapter); +if (ret) + goto eth_alloc_error;/* enable link update event interrupt */ rte_intr_callback_register (intr_handle, rnp_dev_interrupt_handler, adapter);
drivers/net/rnp/rnp_rxtx.c new file +471 -0
471 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.h new file +123 -0
123 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 9/29 net/rnp: add queue stop and start operations
In reply to Wenbo Caosupport rx/tx queue stop/start,for rx queue stop need to reset a queue,must stop all rx queue during reset this queue.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 4 + drivers/net/rnp/base/rnp_common.c | 3 + drivers/net/rnp/rnp_ethdev.c | 4 + drivers/net/rnp/rnp_rxtx.c | 167 ++++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.h | 9 ++ 6 files changed, 188 insertions(+)
doc/guides/nics/features/rnp.ini +1 -0
@@ -5,6 +5,7 @@ ; [Features] Speed capabilities = Y +Queue start/stop = Y Promiscuous mode = Y Allmulticast mode = Y Linux = Y
doc/guides/nics/rnp.rst +4 -0
@@ -64,6 +64,10 @@ Listed below are the rte_eth functions supported: * ``rte_eth_dev_close`` * ``rte_eth_dev_stop`` * ``rte_eth_dev_infos_get`` +* ``rte_eth_dev_rx_queue_start`` +* ``rte_eth_dev_rx_queue_stop`` +* ``rte_eth_dev_tx_queue_start`` +* ``rte_eth_dev_tx_queue_stop`` * ``rte_eth_promiscuous_disable`` * ``rte_eth_promiscuous_enable`` * ``rte_eth_allmulticast_enable``
drivers/net/rnp/base/rnp_common.c +3 -0
@@ -65,6 +65,9 @@ int rnp_init_hw(struct rnp_hw *hw)/* setup mac resiger ctrl base */ for (idx =0 ; idx < hw->max_port_num; idx++) hw->mac_base[idx] = (u8 *)hw->e_ctrl +RNP_MAC_BASE_OFFSET (idx); +/* tx all hw queue must be started */ +for (idx =0 ; idx <RNP_MAX_RX_QUEUE_NUM ; idx++) +RNP_E_REG_WR (hw,RNP_TXQ_START (idx), true);return 0 ; }
drivers/net/rnp/rnp_ethdev.c +4 -0
@@ -249,8 +249,12 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .rx_queue_setup = rnp_rx_queue_setup, .rx_queue_release = rnp_dev_rx_queue_release, + .rx_queue_stop = rnp_rx_queue_stop, + .rx_queue_start = rnp_rx_queue_start, .tx_queue_setup = rnp_tx_queue_setup, .tx_queue_release = rnp_dev_tx_queue_release, + .tx_queue_stop = rnp_tx_queue_stop, + .tx_queue_start = rnp_tx_queue_start, }; static void
drivers/net/rnp/rnp_rxtx.c +167 -0
194 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.h +9 -0
@@ -65,11 +65,14 @@ struct rnp_rx_queue {uint32_t nodesc_tm_thresh;/* rx queue no desc timeout thresh */ uint8_t rx_deferred_start;/* do not start queue with dev_start(). */ +uint8_t rxq_started;/* rx queue is started */ +uint8_t rx_link;/* device link state */ uint8_t pthresh;/* rx desc prefetch threshold */ uint8_t pburst;/* rx desc prefetch burst */ uint64_t rx_offloads;/* user set hw offload features */ struct rte_mbuf **free_mbufs;/* rx bulk alloc reserve of free mbufs */ +struct rte_mbuf fake_mbuf;/* dummy mbuf */ };struct rnp_txsw_entry {
@@ -98,6 +101,8 @@ struct rnp_tx_queue {uint16_t tx_free_thresh;/* thresh to free tx desc resource */ uint8_t tx_deferred_start;/*< Do not start queue with dev_start(). */ +uint8_t txq_started;/* tx queue is started */ +uint8_t tx_link;/* device link state */ uint8_t pthresh;/* rx desc prefetch threshold */ uint8_t pburst;/* rx desc burst*/
@@ -115,9 +120,13 @@ int rnp_rx_queue_setup(struct rte_eth_dev *eth_dev,unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool); +int rnp_tx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t qidx); +int rnp_tx_queue_start (struct rte_eth_dev *eth_dev,uint16_t qidx);int rnp_tx_queue_setup (struct rte_eth_dev *dev,uint16_t qidx,uint16_t nb_desc,unsigned int socket_id,const struct rte_eth_txconf *tx_conf); +int rnp_rx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t qidx); +int rnp_rx_queue_start (struct rte_eth_dev *eth_dev,uint16_t qidx);#endif /* _RNP_RXTX_H_ */
Signature · 1 line
2.25.1
PATCH v17 10/29 net/rnp: add support device start stop operations
In reply to Wenbo Caoadd basic support for device to start/stop function.
--- doc/guides/nics/rnp.rst | 2 + drivers/net/rnp/base/rnp_common.c | 22 +++ drivers/net/rnp/base/rnp_common.h | 1 + drivers/net/rnp/base/rnp_dma_regs.h | 10 + drivers/net/rnp/base/rnp_eth_regs.h | 5 + drivers/net/rnp/base/rnp_hw.h | 1 + drivers/net/rnp/base/rnp_mac.h | 14 ++ drivers/net/rnp/base/rnp_mac_regs.h | 42 ++++ drivers/net/rnp/rnp.h | 3 + drivers/net/rnp/rnp_ethdev.c | 284 +++++++++++++++++++++++++++- 10 files changed, 383 insertions(+), 1 deletion(-)
doc/guides/nics/rnp.rst +2 -0
@@ -68,6 +68,8 @@ Listed below are the rte_eth functions supported: * ``rte_eth_dev_rx_queue_stop`` * ``rte_eth_dev_tx_queue_start`` * ``rte_eth_dev_tx_queue_stop`` +* ``rte_eth_dev_start`` +* ``rte_eth_dev_stop`` * ``rte_eth_promiscuous_disable`` * ``rte_eth_promiscuous_enable`` * ``rte_eth_allmulticast_enable``
drivers/net/rnp/base/rnp_common.c +22 -0
@@ -79,3 +79,25 @@ rnp_setup_common_ops(struct rnp_hw *hw)return 0 ; } + +int rnp_clock_valid_check (struct rnp_hw *hw,u16 nr_lane) +{ +uint16_t timeout =0 ; + +do { +RNP_E_REG_WR (hw,RNP_RSS_REDIR_TB (nr_lane,0 ),0x7f ); +udelay (10 ); + timeout++; +if (timeout >=1000 ) +break ; + }while (RNP_E_REG_RD (hw,RNP_RSS_REDIR_TB (nr_lane,0 )) !=0x7f ); + +if (timeout >=1000 ) { +RNP_PMD_ERR ("ethernet[%d] eth reg can't be write" , nr_lane); +return -EPERM ; + } +/* clear the dirty value */ +RNP_E_REG_WR (hw,RNP_RSS_REDIR_TB (nr_lane,0 ),0 ); + +return 0 ; +}
drivers/net/rnp/base/rnp_common.h +1 -0
@@ -12,5 +12,6 @@ ((macaddr[4] << 8)) | (macaddr[5]))int rnp_init_hw (struct rnp_hw *hw);int rnp_setup_common_ops (struct rnp_hw *hw); +int rnp_clock_valid_check (struct rnp_hw *hw,u16 nr_lane);#endif /* _RNP_COMMON_H_ */
drivers/net/rnp/base/rnp_dma_regs.h +10 -0
@@ -6,9 +6,19 @@#define _RNP_DMA_REGS_H_#define RNP_DMA_VERSION (0) +#define RNP_DMA_CTRL (0x4) +/* 1bit <-> 16 bytes dma addr size */ +#define RNP_DMA_SCATTER_MEM_MASK RTE_GENMASK32(31, 16) +#define RNP_DMA_SCATTER_MEN_S (16) +#define RNP_DMA_RX_MEM_PAD_EN RTE_BIT32(8) +#define RTE_DMA_VEB_BYPASS RTE_BIT32(4) +#define RNP_DMA_TXRX_LOOP RTE_BIT32(1) +#define RNP_DMA_TXMRX_LOOP RTE_BIT32(0) +#define RNP_DMA_HW_EN (0x10)#define RNP_DMA_EN_ALL (0b1111)#define RNP_DMA_HW_STATE (0x14) +/* --- queue register --- */ /* queue enable */ #define RNP_RXQ_START (qid) _RING_(0x0010 + 0x100 * (qid))
drivers/net/rnp/base/rnp_eth_regs.h +5 -0
@@ -10,6 +10,9 @@#define RNP_E_FILTER_EN _ETH_(0x801c)#define RNP_E_REDIR_EN _ETH_(0x8030) +#define RNP_RX_ETH_F_CTRL (n) _ETH_(0x8070 + ((n) * 0x8)) +#define RNP_RX_ETH_F_OFF (0x7ff) +#define RNP_RX_ETH_F_ON (0x270)/* rx queue flow ctrl */ #define RNP_RX_FC_ENABLE _ETH_(0x8520)#define RNP_RING_FC_EN (n) _ETH_(0x8524 + ((0x4) * ((n) / 32)))
@@ -28,6 +31,8 @@#define RNP_MAC_HASH_MASK RTE_GENMASK32(11, 0)#define RNP_MAC_MULTICASE_TBL_EN RTE_BIT32(2)#define RNP_MAC_UNICASE_TBL_EN RTE_BIT32(3) +/* rss function ctrl */ +#define RNP_RSS_REDIR_TB (n, id) _ETH_(0xe000 + ((n) * 0x200) + ((id) * 0x4))#define RNP_TC_PORT_OFFSET (lane) _ETH_(0xe840 + 0x04 * (lane))
drivers/net/rnp/base/rnp_hw.h +1 -0
@@ -120,6 +120,7 @@ struct rnp_hw {bool lane_is_sgmii[RNP_MAX_PORT_OF_PF ];struct rnp_mbx_info mbx;struct rnp_fw_info fw_info; +u16 min_dma_size;spinlock_t rxq_reset_lock;/* reset op isn't thread safe */ spinlock_t txq_reset_lock;/* reset op isn't thread safe */
drivers/net/rnp/base/rnp_mac.h +14 -0
@@ -7,6 +7,20 @@#include "rnp_osdep.h" #include "rnp_hw.h" +#include "rnp_eth_regs.h" + +#define RNP_RX_ETH_DISABLE (hw, nr_lane) do { \ + wmb(); \ + RNP_E_REG_WR(hw, RNP_RX_ETH_F_CTRL(nr_lane), \ + RNP_RX_ETH_F_OFF); \ +} while (0) + +#define RNP_RX_ETH_ENABLE (hw, nr_lane) do { \ + wmb(); \ + RNP_E_REG_WR(hw, RNP_RX_ETH_F_CTRL(nr_lane), \ + RNP_RX_ETH_F_ON); \ +} while (0) +void rnp_mac_ops_init (struct rnp_hw *hw);int rnp_get_mac_addr (struct rnp_eth_port *port,u8 *mac);
drivers/net/rnp/base/rnp_mac_regs.h +42 -0
53 lines not on this page · raw message
drivers/net/rnp/rnp.h +3 -0
@@ -110,6 +110,9 @@ struct rnp_eth_port {struct rnp_port_attr attr;struct rnp_tx_queue *tx_queues[RNP_MAX_RX_QUEUE_NUM ];struct rnp_hw *hw; + +rte_spinlock_t rx_mac_lock; +bool port_stopped; };struct rnp_eth_adapter {
drivers/net/rnp/rnp_ethdev.c +283 -1
316 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 11/29 net/rnp: add RSS support operations
In reply to Wenbo Caoadd support rss reta updata/query rss hash update/get dev_configure add rss conf check.
--- doc/guides/nics/features/rnp.ini | 4 + doc/guides/nics/rnp.rst | 7 + drivers/net/rnp/base/rnp_eth_regs.h | 16 ++ drivers/net/rnp/meson.build | 1 + drivers/net/rnp/rnp.h | 7 + drivers/net/rnp/rnp_ethdev.c | 23 ++ drivers/net/rnp/rnp_rss.c | 367 ++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rss.h | 44 ++++ 8 files changed, 469 insertions(+) create mode 100644 drivers/net/rnp/rnp_rss.c create mode 100644 drivers/net/rnp/rnp_rss.h
doc/guides/nics/features/rnp.ini +4 -0
@@ -8,5 +8,9 @@ Speed capabilities = Y Queue start/stop = Y Promiscuous mode = Y Allmulticast mode = Y +RSS hash = Y +RSS key update = Y +RSS reta update = Y +Inner RSS = Y Linux = Y x86-64 = Y
doc/guides/nics/rnp.rst +7 -0
@@ -38,6 +38,9 @@ Features -------- - Multiple queues for TX and RX +- Receiver Side Steering (RSS) + Receiver Side Steering (RSS) on IPv4, IPv6, IPv4-TCP/UDP/SCTP, IPv6-TCP/UDP/SCTP + Inner RSS is only support for vxlan/nvgre - Promiscuous mode Prerequisites and Pre-conditions
@@ -70,6 +73,10 @@ Listed below are the rte_eth functions supported: * ``rte_eth_dev_tx_queue_stop`` * ``rte_eth_dev_start`` * ``rte_eth_dev_stop`` +* ``rte_eth_dev_rss_hash_conf_get`` +* ``rte_eth_dev_rss_hash_update`` +* ``rte_eth_dev_rss_reta_query`` +* ``rte_eth_dev_rss_reta_update`` * ``rte_eth_promiscuous_disable`` * ``rte_eth_promiscuous_enable`` * ``rte_eth_allmulticast_enable``
drivers/net/rnp/base/rnp_eth_regs.h +16 -0
@@ -32,7 +32,23 @@#define RNP_MAC_MULTICASE_TBL_EN RTE_BIT32(2)#define RNP_MAC_UNICASE_TBL_EN RTE_BIT32(3)/* rss function ctrl */ +#define RNP_RSS_INNER_CTRL _ETH_(0x805c) +#define RNP_INNER_RSS_EN (1) +#define RNP_INNER_RSS_DIS (0)#define RNP_RSS_REDIR_TB (n, id) _ETH_(0xe000 + ((n) * 0x200) + ((id) * 0x4)) +#define RNP_RSS_MRQC_ADDR _ETH_(0x92a0) +/* RSS policy */ +#define RNP_RSS_HASH_CFG_MASK (0x3F30000) +#define RNP_RSS_HASH_IPV4_TCP RTE_BIT32(16) +#define RNP_RSS_HASH_IPV4 RTE_BIT32(17) +#define RNP_RSS_HASH_IPV6 RTE_BIT32(20) +#define RNP_RSS_HASH_IPV6_TCP RTE_BIT32(21) +#define RNP_RSS_HASH_IPV4_UDP RTE_BIT32(22) +#define RNP_RSS_HASH_IPV6_UDP RTE_BIT32(23) +#define RNP_RSS_HASH_IPV4_SCTP RTE_BIT32(24) +#define RNP_RSS_HASH_IPV6_SCTP RTE_BIT32(25) +/* rss hash key */ +#define RNP_RSS_KEY_TABLE (idx) _ETH_(0x92d0 + ((idx) * 0x4))#define RNP_TC_PORT_OFFSET (lane) _ETH_(0xe840 + 0x04 * (lane))
drivers/net/rnp/meson.build +1 -0
@@ -22,4 +22,5 @@ includes += include_directories('base') sources = files( 'rnp_ethdev.c', 'rnp_rxtx.c', + 'rnp_rss.c', )
drivers/net/rnp/rnp.h +7 -0
@@ -111,6 +111,13 @@ struct rnp_eth_port {struct rnp_tx_queue *tx_queues[RNP_MAX_RX_QUEUE_NUM ];struct rnp_hw *hw; +struct rte_eth_rss_conf rss_conf; +uint16_t last_rx_num; +bool rxq_num_changed; +bool reta_has_cfg; +bool hw_rss_en; +uint32_t indirtbl[RNP_RSS_INDIR_SIZE ]; +rte_spinlock_t rx_mac_lock;bool port_stopped; };
drivers/net/rnp/rnp_ethdev.c +23 -0
@@ -18,6 +18,7 @@#include "base/rnp_dma_regs.h" #include "base/rnp_mac_regs.h" #include "rnp_rxtx.h" +#include "rnp_rss.h" static struct rte_eth_dev *rnp_alloc_eth_port (struct rte_pci_device *pci,char *name)
@@ -235,6 +236,9 @@ static int rnp_dev_start(struct rte_eth_dev *eth_dev) }/* disable eth rx flow */ RNP_RX_ETH_DISABLE (hw, lane); + ret =rnp_dev_rss_configure (eth_dev); +if (ret) +return ret; ret =rnp_rx_scattered_setup (eth_dev);if (ret)return ret;
@@ -302,6 +306,19 @@ static int rnp_disable_all_tx_queue(struct rte_eth_dev *dev)return ret; } +static int rnp_dev_configure (struct rte_eth_dev *eth_dev) +{ +struct rnp_eth_port *port =RNP_DEV_TO_PORT (eth_dev); + +if (port->last_rx_num != eth_dev->data->nb_rx_queues) + port->rxq_num_changed = true; +else + port->rxq_num_changed = false; + port->last_rx_num = eth_dev->data->nb_rx_queues; + +return 0 ; +} +static int rnp_dev_stop (struct rte_eth_dev *eth_dev) {struct rnp_eth_port *port =RNP_DEV_TO_PORT (eth_dev);
@@ -515,6 +532,7 @@ static int rnp_allmulticast_disable(struct rte_eth_dev *eth_dev)/* Features supported by this driver */ static const struct eth_dev_ops rnp_eth_dev_ops = { + .dev_configure = rnp_dev_configure, .dev_close = rnp_dev_close, .dev_start = rnp_dev_start, .dev_stop = rnp_dev_stop,
@@ -534,6 +552,11 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .tx_queue_release = rnp_dev_tx_queue_release, .tx_queue_stop = rnp_tx_queue_stop, .tx_queue_start = rnp_tx_queue_start, +/* rss impl */ + .reta_update = rnp_dev_rss_reta_update, + .reta_query = rnp_dev_rss_reta_query, + .rss_hash_update = rnp_dev_rss_hash_update, + .rss_hash_conf_get = rnp_dev_rss_hash_conf_get, }; static void
drivers/net/rnp/rnp_rss.c new file +367 -0
367 lines not on this page · raw message
drivers/net/rnp/rnp_rss.h new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 12/29 net/rnp: add support link update operations
In reply to Wenbo CaoThis patch add support poll/irq link get mode.
--- doc/guides/nics/features/rnp.ini | 2 + doc/guides/nics/rnp.rst | 3 + drivers/net/rnp/base/rnp_fw_cmd.c | 45 ++++ drivers/net/rnp/base/rnp_fw_cmd.h | 55 +++++ drivers/net/rnp/base/rnp_hw.h | 3 +- drivers/net/rnp/base/rnp_mbx_fw.c | 72 ++++++- drivers/net/rnp/base/rnp_mbx_fw.h | 4 + drivers/net/rnp/meson.build | 1 + drivers/net/rnp/rnp.h | 12 ++ drivers/net/rnp/rnp_ethdev.c | 118 ++++++++++- drivers/net/rnp/rnp_link.c | 339 ++++++++++++++++++++++++++++++ drivers/net/rnp/rnp_link.h | 50 +++++ 12 files changed, 697 insertions(+), 7 deletions(-) create mode 100644 drivers/net/rnp/rnp_link.c create mode 100644 drivers/net/rnp/rnp_link.h
doc/guides/nics/features/rnp.ini +2 -0
@@ -5,6 +5,8 @@ ; [Features] Speed capabilities = Y +Link status = Y +Link status event = Y Queue start/stop = Y Promiscuous mode = Y Allmulticast mode = Y
doc/guides/nics/rnp.rst +3 -0
@@ -42,6 +42,7 @@ Features Receiver Side Steering (RSS) on IPv4, IPv6, IPv4-TCP/UDP/SCTP, IPv6-TCP/UDP/SCTP Inner RSS is only support for vxlan/nvgre - Promiscuous mode +- Link state information Prerequisites and Pre-conditions --------------------------------
@@ -85,3 +86,5 @@ Listed below are the rte_eth functions supported: * ``rte_eth_allmulticast_get`` * ``rte_eth_rx_queue_setup`` * ``rte_eth_tx_queue_setup`` +* ``rte_eth_link_get`` +* ``rte_eth_link_get_nowait``
drivers/net/rnp/base/rnp_fw_cmd.c +45 -0
57 lines not on this page · raw message
drivers/net/rnp/base/rnp_fw_cmd.h +55 -0
79 lines not on this page · raw message
drivers/net/rnp/base/rnp_hw.h +2 -1
@@ -122,9 +122,10 @@ struct rnp_hw {struct rnp_fw_info fw_info;u16 min_dma_size; +uint8_t msgbuf[64 ];spinlock_t rxq_reset_lock;/* reset op isn't thread safe */ spinlock_t txq_reset_lock;/* reset op isn't thread safe */ - + spinlock_t link_sync; /* link info update must be one user */ };#endif /* _RNP_HW_H_ */
drivers/net/rnp/base/rnp_mbx_fw.c +71 -1
81 lines not on this page · raw message
drivers/net/rnp/base/rnp_mbx_fw.h +4 -0
@@ -14,6 +14,10 @@ int rnp_mbx_fw_get_macaddr(struct rnp_eth_port *port, u8 *mac_addr);int rnp_mbx_fw_get_capability (struct rnp_eth_port *port);int rnp_mbx_fw_get_lane_stat (struct rnp_eth_port *port);int rnp_mbx_fw_reset_phy (struct rnp_hw *hw); +int rnp_mbx_fw_pf_link_event_en (struct rnp_eth_port *port,bool en);int rnp_fw_init (struct rnp_hw *hw); +int rnp_rcv_msg_from_fw (struct rnp_eth_adapter *adapter,u32 *msgbuf); +int rnp_fw_mbx_ifup_down (struct rnp_eth_port *port,int up); +int rnp_mbx_fw_lane_link_event_en (struct rnp_eth_port *port,bool en);#endif /* _RNP_MBX_FW_H_ */
drivers/net/rnp/meson.build +1 -0
@@ -23,4 +23,5 @@ sources = files( 'rnp_ethdev.c', 'rnp_rxtx.c', 'rnp_rss.c', + 'rnp_link.c', )
drivers/net/rnp/rnp.h +12 -0
@@ -92,6 +92,11 @@ struct rnp_port_attr {struct rnp_phy_meta phy_meta; +bool link_ready; +bool pre_link; +bool duplex; +uint32_t speed; +uint16_t port_id;/* platform manage port sequence id */ uint8_t port_offset;/* port queue offset */ uint8_t sw_id;/* software port init sequence id */
@@ -122,6 +127,12 @@ struct rnp_eth_port {bool port_stopped; }; +enum rnp_pf_op { +RNP_PF_OP_DONE , +RNP_PF_OP_CLOSING =1 , +RNP_PF_OP_PROCESS , +}; +struct rnp_eth_adapter {struct rnp_hw hw;struct rte_pci_device *pdev;
@@ -129,6 +140,7 @@ struct rnp_eth_adapter {struct rte_mempool *reset_pool;struct rnp_eth_port *ports[RNP_MAX_PORT_OF_PF ]; +RTE_ATOMIC (uint16_t ) pf_op;uint16_t closed_ports;uint16_t inited_ports;bool intr_registered;
drivers/net/rnp/rnp_ethdev.c +113 -5
201 lines not on this page · raw message
drivers/net/rnp/rnp_link.c new file +339 -0
339 lines not on this page · raw message
drivers/net/rnp/rnp_link.h new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 13/29 net/rnp: add support link setup operations
In reply to Wenbo Caoadd set link_down/link_up implement
--- doc/guides/nics/rnp.rst | 2 + drivers/net/rnp/base/rnp_eth_regs.h | 3 + drivers/net/rnp/base/rnp_fw_cmd.c | 22 +++++++ drivers/net/rnp/base/rnp_fw_cmd.h | 6 ++ drivers/net/rnp/base/rnp_mbx_fw.c | 33 ++++++++++ drivers/net/rnp/base/rnp_mbx_fw.h | 1 + drivers/net/rnp/rnp_ethdev.c | 10 ++- drivers/net/rnp/rnp_link.c | 97 +++++++++++++++++++++++++++++ drivers/net/rnp/rnp_link.h | 2 + 9 files changed, 175 insertions(+), 1 deletion(-)
doc/guides/nics/rnp.rst +2 -0
@@ -78,6 +78,8 @@ Listed below are the rte_eth functions supported: * ``rte_eth_dev_rss_hash_update`` * ``rte_eth_dev_rss_reta_query`` * ``rte_eth_dev_rss_reta_update`` +* ``rte_eth_dev_set_link_down`` +* ``rte_eth_dev_set_link_up`` * ``rte_eth_promiscuous_disable`` * ``rte_eth_promiscuous_enable`` * ``rte_eth_allmulticast_enable``
drivers/net/rnp/base/rnp_eth_regs.h +3 -0
@@ -5,6 +5,9 @@#ifndef _RNP_ETH_REGS_H#define _RNP_ETH_REGS_H +#define RNP_ETH_TX_FIFO_STATE _ETH_(0x0330) +#define RNP_ETH_TX_FIFO_EMPT (lane) ((1 << (lane)) | (1 << ((lane) + 4))) +#define RNP_E_ENG_BYPASS _ETH_(0x8000)#define RNP_E_VXLAN_PARSE_EN _ETH_(0x8004)#define RNP_E_FILTER_EN _ETH_(0x801c)
drivers/net/rnp/base/rnp_fw_cmd.c +22 -0
@@ -107,6 +107,25 @@ rnp_build_lane_evet_mask(struct rnp_mbx_fw_cmd_req *req, arg->event_en = req_arg->param2; } +static void +rnp_build_ifup_down (struct rnp_mbx_fw_cmd_req *req, +struct rnp_fw_req_arg *req_arg, +void *cookie) +{ +struct rnp_ifup_down_req *arg = + (struct rnp_ifup_down_req *)req->data; + + req->flags =0 ; + req->opcode =RNP_IFUP_DOWN ; + req->datalen =sizeof (*arg); + req->cookie = cookie; + req->reply_lo =0 ; + req->reply_hi =0 ; + + arg->nr_lane = req_arg->param0; + arg->up = req_arg->param1; +} +int rnp_build_fwcmd_req (struct rnp_mbx_fw_cmd_req *req,struct rnp_fw_req_arg *arg,void *cookie)
@@ -132,6 +151,9 @@ int rnp_build_fwcmd_req(struct rnp_mbx_fw_cmd_req *req,case RNP_SET_LANE_EVENT_EN :rnp_build_lane_evet_mask (req, arg, cookie);break ; +case RNP_IFUP_DOWN : +rnp_build_ifup_down (req, arg, cookie); +break ;default : err = -EOPNOTSUPP ; }
drivers/net/rnp/base/rnp_fw_cmd.h +6 -0
@@ -309,6 +309,12 @@ struct rnp_link_stat_req {struct rnp_port_stat states[RNP_MAX_PORT_OF_PF ]; }; +struct rnp_ifup_down_req { +u32 nr_lane; +u32 up; +u8 rsvd[24 ]; +}; +struct rnp_mbx_fw_cmd_req {u16 flags;u16 opcode;
drivers/net/rnp/base/rnp_mbx_fw.c +33 -0
@@ -460,3 +460,36 @@ rnp_rcv_msg_from_fw(struct rnp_eth_adapter *adapter, u32 *msgbuf)return 0 ; } + +static void rnp_link_stat_reset (struct rnp_hw *hw,u16 lane) +{ +u32 state; + +spin_lock (&hw->link_sync); + state =RNP_E_REG_RD (hw,RNP_FW_LINK_SYNC ); + state &= ~RNP_LINK_MAGIC_MASK ; + state |=RNP_LINK_MAGIC_CODE ; + state &= ~RTE_BIT32 (lane); + +RNP_E_REG_WR (hw,RNP_FW_LINK_SYNC , state); +rte_spinlock_unlock (&hw->link_sync); +} + +int rnp_mbx_fw_ifup_down (struct rnp_eth_port *port,bool up) +{ +u16 nr_lane = port->attr.nr_lane; +struct rnp_hw *hw = port->hw; +struct rnp_fw_req_arg arg; +int err; + +memset (&arg,0 ,sizeof (arg)); + arg.opcode =RNP_IFUP_DOWN ; + arg.param0 = nr_lane; + arg.param1 = up; + + err =rnp_fw_send_norep_cmd (port, &arg); +/* force firmware send irq event to dpdk */ +if (!err && up) +rnp_link_stat_reset (hw, nr_lane); +return err; +}
drivers/net/rnp/base/rnp_mbx_fw.h +1 -0
@@ -19,5 +19,6 @@ int rnp_fw_init(struct rnp_hw *hw);int rnp_rcv_msg_from_fw (struct rnp_eth_adapter *adapter,u32 *msgbuf);int rnp_fw_mbx_ifup_down (struct rnp_eth_port *port,int up);int rnp_mbx_fw_lane_link_event_en (struct rnp_eth_port *port,bool en); +int rnp_mbx_fw_ifup_down (struct rnp_eth_port *port,bool up);#endif /* _RNP_MBX_FW_H_ */
drivers/net/rnp/rnp_ethdev.c +9 -1
@@ -325,9 +325,14 @@ static int rnp_dev_start(struct rte_eth_dev *eth_dev)if (ret) goto rxq_start_failed;rnp_mac_init (eth_dev); -rnp_mbx_fw_lane_link_event_en (port, lsc); + ret =rnp_mbx_fw_lane_link_event_en (port, lsc); +if (ret <0 ) + goto rxq_start_failed;if (!lsc)rnp_run_link_poll_task (port); + ret =rnp_dev_set_link_up (eth_dev); +if (ret <0 ) + goto rxq_start_failed;/* enable eth rx flow */ RNP_RX_ETH_ENABLE (hw, lane); port->port_stopped =0 ;
@@ -415,6 +420,7 @@ static int rnp_dev_stop(struct rte_eth_dev *eth_dev)/* clear the recorded link status */ memset (&link,0 ,sizeof (link));rte_eth_linkstatus_set (eth_dev, &link); +rnp_dev_set_link_down (eth_dev); ret =rnp_disable_all_tx_queue (eth_dev);if (ret <0 ) {RNP_PMD_ERR ("port[%u] disable tx queue failed" , data->port_id);
@@ -665,6 +671,8 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .rss_hash_conf_get = rnp_dev_rss_hash_conf_get, /* link impl */ .link_update = rnp_dev_link_update, + .dev_set_link_up = rnp_dev_set_link_up, + .dev_set_link_down = rnp_dev_set_link_down, }; static void
drivers/net/rnp/rnp_link.c +97 -0
100 lines not on this page · raw message
drivers/net/rnp/rnp_link.h +2 -0
@@ -46,5 +46,7 @@ int rnp_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);void rnp_run_link_poll_task (struct rnp_eth_port *port);void rnp_cancel_link_poll_task (struct rnp_eth_port *port); +int rnp_dev_set_link_up (struct rte_eth_dev *eth_dev); +int rnp_dev_set_link_down (struct rte_eth_dev *eth_dev);#endif /* _RNP_LINK_H_ */
Signature · 1 line
2.25.1
PATCH v17 14/29 net/rnp: add Rx burst simple support
In reply to Wenbo Caoadd only support simple recv pkts.
--- drivers/net/rnp/rnp_ethdev.c | 7 ++ drivers/net/rnp/rnp_rxtx.c | 130 +++++++++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.h | 5 ++ 3 files changed, 142 insertions(+)
drivers/net/rnp/rnp_ethdev.c +7 -0
@@ -335,6 +335,8 @@ static int rnp_dev_start(struct rte_eth_dev *eth_dev) goto rxq_start_failed;/* enable eth rx flow */ RNP_RX_ETH_ENABLE (hw, lane); +rnp_rx_func_select (eth_dev); +rnp_tx_func_select (eth_dev); port->port_stopped =0 ;return 0 ;
@@ -595,6 +597,11 @@ static int rnp_dev_infos_get(struct rte_eth_dev *eth_dev,/* default port configure */ dev_info->default_rxconf = (struct rte_eth_rxconf ) { .rx_drop_en =0 , + .rx_thresh = { + .pthresh =RNP_RX_DESC_FETCH_TH , + .hthresh =RNP_RX_DESC_FETCH_BURST , + }, + .rx_free_thresh =RNP_DEFAULT_RX_FREE_THRESH , .offloads =0 , };
drivers/net/rnp/rnp_rxtx.c +130 -0
133 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.h +5 -0
@@ -63,6 +63,9 @@ struct rnp_rx_queue {uint16_t rx_free_thresh;/* rx free desc desource thresh */ uint16_t rx_tail; +uint16_t rxrearm_start; +uint16_t rxrearm_nb; +uint32_t nodesc_tm_thresh;/* rx queue no desc timeout thresh */ uint8_t rx_deferred_start;/* do not start queue with dev_start(). */ uint8_t rxq_started;/* rx queue is started */
@@ -128,5 +131,7 @@ int rnp_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf);int rnp_rx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t qidx);int rnp_rx_queue_start (struct rte_eth_dev *eth_dev,uint16_t qidx); +int rnp_rx_func_select (struct rte_eth_dev *dev); +int rnp_tx_func_select (struct rte_eth_dev *dev);#endif /* _RNP_RXTX_H_ */
Signature · 1 line
2.25.1
PATCH v17 15/29 net/rnp: add Tx burst simple support
In reply to Wenbo Caoadd only support simple send pkts.
--- drivers/net/rnp/rnp_ethdev.c | 6 +++ drivers/net/rnp/rnp_rxtx.c | 85 +++++++++++++++++++++++++++++++++++- drivers/net/rnp/rnp_rxtx.h | 1 + 3 files changed, 91 insertions(+), 1 deletion(-)
drivers/net/rnp/rnp_ethdev.c +6 -0
@@ -606,6 +606,12 @@ static int rnp_dev_infos_get(struct rte_eth_dev *eth_dev, }; dev_info->default_txconf = (struct rte_eth_txconf ) { + .tx_thresh = { + .pthresh =RNP_TX_DESC_FETCH_TH , + .hthresh =RNP_TX_DESC_FETCH_BURST , + }, + .tx_free_thresh =RNP_DEFAULT_TX_FREE_THRESH , + .tx_rs_thresh =RNP_DEFAULT_TX_RS_THRESH , .offloads =0 , };
drivers/net/rnp/rnp_rxtx.c +84 -1
97 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.h +1 -0
@@ -89,6 +89,7 @@ struct rnp_tx_queue {const struct rte_memzone *rz;uint64_t ring_phys_addr;/* tx dma ring physical addr */ volatile struct rnp_tx_desc *tx_bdr;/* tx dma ring virtual addr */ +volatile struct rnp_tx_desc zero_desc;struct rnp_txsw_entry *sw_ring;/* tx software ring addr */ volatile void *tx_tailreg;/* hw desc tail register */ volatile void *tx_headreg;/* hw desc head register*/
Signature · 1 line
2.25.1
PATCH v17 16/29 net/rnp: add MTU set operation
In reply to Wenbo Caoadd mtu update limit for multiple port mode.
multiple mode just used the max-mtu of ports
to limit receive.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 3 + drivers/net/rnp/base/rnp_eth_regs.h | 3 + drivers/net/rnp/rnp.h | 3 + drivers/net/rnp/rnp_ethdev.c | 145 ++++++++++++++++++++++++++++ 5 files changed, 155 insertions(+)
doc/guides/nics/features/rnp.ini +1 -0
@@ -10,6 +10,7 @@ Link status event = Y Queue start/stop = Y Promiscuous mode = Y Allmulticast mode = Y +MTU update = Y RSS hash = Y RSS key update = Y RSS reta update = Y
doc/guides/nics/rnp.rst +3 -0
@@ -43,6 +43,7 @@ Features Inner RSS is only support for vxlan/nvgre - Promiscuous mode - Link state information +- MTU update Prerequisites and Pre-conditions --------------------------------
@@ -80,6 +81,8 @@ Listed below are the rte_eth functions supported: * ``rte_eth_dev_rss_reta_update`` * ``rte_eth_dev_set_link_down`` * ``rte_eth_dev_set_link_up`` +* ``rte_eth_dev_get_mtu`` +* ``rte_eth_dev_set_mtu`` * ``rte_eth_promiscuous_disable`` * ``rte_eth_promiscuous_enable`` * ``rte_eth_allmulticast_enable``
drivers/net/rnp/base/rnp_eth_regs.h +3 -0
@@ -16,6 +16,9 @@#define RNP_RX_ETH_F_CTRL (n) _ETH_(0x8070 + ((n) * 0x8))#define RNP_RX_ETH_F_OFF (0x7ff)#define RNP_RX_ETH_F_ON (0x270) +/* max/min pkts length receive limit ctrl */ +#define RNP_MIN_FRAME_CTRL _ETH_(0x80f0) +#define RNP_MAX_FRAME_CTRL _ETH_(0x80f4)/* rx queue flow ctrl */ #define RNP_RX_FC_ENABLE _ETH_(0x8520)#define RNP_RING_FC_EN (n) _ETH_(0x8524 + ((0x4) * ((n) / 32)))
drivers/net/rnp/rnp.h +3 -0
@@ -123,6 +123,9 @@ struct rnp_eth_port {bool hw_rss_en;uint32_t indirtbl[RNP_RSS_INDIR_SIZE ]; +uint16_t cur_mtu; +bool jumbo_en; +rte_spinlock_t rx_mac_lock;bool port_stopped; };
drivers/net/rnp/rnp_ethdev.c +145 -0
193 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 17/29 net/rnp: add Rx scatter segment version
In reply to Wenbo Caoadd support scatter multi segment received.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 2 + drivers/net/rnp/rnp_ethdev.c | 2 + drivers/net/rnp/rnp_rxtx.c | 130 ++++++++++++++++++++++++++++++- drivers/net/rnp/rnp_rxtx.h | 2 + 5 files changed, 135 insertions(+), 2 deletions(-)
doc/guides/nics/features/rnp.ini +1 -0
@@ -15,5 +15,6 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +Scattered Rx = Y Linux = Y x86-64 = Y
doc/guides/nics/rnp.rst +2 -0
@@ -44,6 +44,8 @@ Features - Promiscuous mode - Link state information - MTU update +- Jumbo frames +- Scatter-Gather IO support Prerequisites and Pre-conditions --------------------------------
drivers/net/rnp/rnp_ethdev.c +2 -0
@@ -606,6 +606,8 @@ static int rnp_dev_infos_get(struct rte_eth_dev *eth_dev, dev_info->reta_size =RNP_RSS_INDIR_SIZE ;/* speed cap info */ dev_info->speed_capa =rnp_get_speed_caps (eth_dev); +/* rx support offload cap */ + dev_info->rx_offload_capa =RTE_ETH_RX_OFFLOAD_SCATTER ;/* default ring configure */ dev_info->default_rxportconf.burst_size =32 ; dev_info->default_txportconf.burst_size =32 ;
drivers/net/rnp/rnp_rxtx.c +128 -2
144 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.h +2 -0
@@ -76,6 +76,8 @@ struct rnp_rx_queue {uint64_t rx_offloads;/* user set hw offload features */ struct rte_mbuf **free_mbufs;/* rx bulk alloc reserve of free mbufs */ struct rte_mbuf fake_mbuf;/* dummy mbuf */ +struct rte_mbuf *pkt_first_seg;/**< First segment of current packet. */ +struct rte_mbuf *pkt_last_seg;/**< Last segment of current packet. */ };struct rnp_txsw_entry {
Signature · 1 line
2.25.1
PATCH v17 18/29 net/rnp: add Tx multiple segment version
In reply to Wenbo Caoadd support multiple segs mbuf send.
--- drivers/net/rnp/rnp_ethdev.c | 2 + drivers/net/rnp/rnp_rxtx.c | 126 ++++++++++++++++++++++++++++++++++- drivers/net/rnp/rnp_rxtx.h | 3 +- 3 files changed, 128 insertions(+), 3 deletions(-)
drivers/net/rnp/rnp_ethdev.c +2 -0
@@ -608,6 +608,8 @@ static int rnp_dev_infos_get(struct rte_eth_dev *eth_dev, dev_info->speed_capa =rnp_get_speed_caps (eth_dev);/* rx support offload cap */ dev_info->rx_offload_capa =RTE_ETH_RX_OFFLOAD_SCATTER ; +/* tx support offload cap */ + dev_info->tx_offload_capa =RTE_ETH_TX_OFFLOAD_MULTI_SEGS ;/* default ring configure */ dev_info->default_rxportconf.burst_size =32 ; dev_info->default_txportconf.burst_size =32 ;
drivers/net/rnp/rnp_rxtx.c +124 -2
161 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.h +2 -1
@@ -98,7 +98,8 @@ struct rnp_tx_queue {struct rnp_queue_attr attr;uint16_t nb_tx_free;/* avail desc to set pkts */ -uint16_t nb_tx_used; +uint16_t nb_tx_used;/* multiseg mbuf used num */ +uint16_t last_desc_cleaned;uint16_t tx_tail;uint16_t tx_next_dd;/* next to scan writeback dd bit */
Signature · 1 line
2.25.1
PATCH v17 19/29 net/rnp: add support basic stats operation
In reply to Wenbo Caoadd support hw-missed rx/tx packets bytes.
--- doc/guides/nics/features/rnp.ini | 2 + doc/guides/nics/rnp.rst | 3 + drivers/net/rnp/base/rnp_eth_regs.h | 3 + drivers/net/rnp/rnp.h | 8 ++ drivers/net/rnp/rnp_ethdev.c | 136 ++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.c | 9 ++ drivers/net/rnp/rnp_rxtx.h | 10 ++ 7 files changed, 171 insertions(+)
doc/guides/nics/features/rnp.ini +2 -0
@@ -7,6 +7,8 @@ Speed capabilities = Y Link status = Y Link status event = Y +Basic stats = Y +Stats per queue = Y Queue start/stop = Y Promiscuous mode = Y Allmulticast mode = Y
doc/guides/nics/rnp.rst +3 -0
@@ -46,6 +46,7 @@ Features - MTU update - Jumbo frames - Scatter-Gather IO support +- Port hardware statistic Prerequisites and Pre-conditions --------------------------------
@@ -95,3 +96,5 @@ Listed below are the rte_eth functions supported: * ``rte_eth_tx_queue_setup`` * ``rte_eth_link_get`` * ``rte_eth_link_get_nowait`` +* ``rte_eth_stats_get`` +* ``rte_eth_stats_reset``
drivers/net/rnp/base/rnp_eth_regs.h +3 -0
@@ -23,6 +23,9 @@#define RNP_RX_FC_ENABLE _ETH_(0x8520)#define RNP_RING_FC_EN (n) _ETH_(0x8524 + ((0x4) * ((n) / 32)))#define RNP_RING_FC_THRESH (n) _ETH_(0x8a00 + ((0x4) * (n))) +/* ETH Statistic */ +#define RNP_ETH_RXTRANS_DROP _ETH_(0x8904) +#define RNP_ETH_RXTRUNC_DROP _ETH_(0x8928)/* Mac Host Filter */ #define RNP_MAC_FCTRL _ETH_(0x9110)#define RNP_MAC_FCTRL_MPE RTE_BIT32(8)/* Multicast Promiscuous En */
drivers/net/rnp/rnp.h +8 -0
@@ -108,6 +108,11 @@ struct rnp_proc_priv {const struct rnp_mbx_ops *mbx_ops; }; +struct rnp_hw_eth_stats { +uint64_t rx_trans_drop;/* rx eth to dma fifo full drop */ +uint64_t rx_trunc_drop;/* rx mac to eth to host copy fifo full drop */ +}; +struct rnp_eth_port {struct rnp_proc_priv *proc_priv;struct rte_ether_addr mac_addr;
@@ -116,6 +121,9 @@ struct rnp_eth_port {struct rnp_tx_queue *tx_queues[RNP_MAX_RX_QUEUE_NUM ];struct rnp_hw *hw; +struct rnp_hw_eth_stats eth_stats_old; +struct rnp_hw_eth_stats eth_stats; +struct rte_eth_rss_conf rss_conf;uint16_t last_rx_num;bool rxq_num_changed;
drivers/net/rnp/rnp_ethdev.c +136 -0
148 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.c +9 -0
@@ -737,6 +737,8 @@ rnp_recv_pkts(void *_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) nmb->packet_type =0 ; nmb->ol_flags =0 ; nmb->nb_segs =1 ; + + rxq->stats.ibytes += nmb->data_len; }for (j =0 ; j < nb_dd; ++j) { rx_pkts[i + j] = rx_swbd[j].mbuf;
@@ -748,6 +750,7 @@ rnp_recv_pkts(void *_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)if (nb_dd !=RNP_CACHE_FETCH_RX )break ; } + rxq->stats.ipackets += nb_rx; rxq->rx_tail = (rxq->rx_tail + nb_rx) & rxq->attr.nb_desc_mask; rxq->rxrearm_nb = rxq->rxrearm_nb + nb_rx;
@@ -817,6 +820,7 @@ rnp_xmit_simple(void *_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) txbd->d.blen = tx_swbd->mbuf->data_len; txbd->d.cmd =RNP_CMD_EOP ; + txq->stats.obytes += txbd->d.blen; i = (i +1 ) & txq->attr.nb_desc_mask; } txq->nb_tx_free -= start;
@@ -828,6 +832,7 @@ rnp_xmit_simple(void *_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)if (txq->tx_next_rs > txq->attr.nb_desc) txq->tx_next_rs = txq->tx_rs_thresh -1 ; } + txq->stats.opackets += start; txq->tx_tail = i;rte_wmb ();
@@ -933,6 +938,7 @@ rnp_scattered_rx(void *rx_queue, struct rte_mbuf **rx_pkts, } rxm->next =NULL ; first_seg->port = rxq->attr.port_id; + rxq->stats.ibytes += first_seg->pkt_len;/* this the end of packet the large pkt has been recv finish */ rte_prefetch0 (RTE_PTR_ADD (first_seg->buf_addr, first_seg->data_off));
@@ -940,6 +946,7 @@ rnp_scattered_rx(void *rx_queue, struct rte_mbuf **rx_pkts, first_seg =NULL ; }/* update sw record point */ + rxq->stats.ipackets += nb_rx; rxq->rx_tail = rx_id; rxq->pkt_first_seg = first_seg; rxq->pkt_last_seg = last_seg;
@@ -1028,6 +1035,7 @@ rnp_multiseg_xmit_pkts(void *_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) tx_id = txe->next_id; txe = txn; }while (m_seg !=NULL ); + txq->stats.obytes += tx_pkt->pkt_len; txbd->d.cmd |=RNP_CMD_EOP ; txq->nb_tx_used = (uint16_t )txq->nb_tx_used + nb_used_bd; txq->nb_tx_free = (uint16_t )txq->nb_tx_free - nb_used_bd;
@@ -1039,6 +1047,7 @@ rnp_multiseg_xmit_pkts(void *_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) }if (!send_pkts)return 0 ; + txq->stats.opackets += send_pkts; txq->tx_tail = tx_id;rte_wmb ();
drivers/net/rnp/rnp_rxtx.h +10 -0
@@ -47,6 +47,14 @@ struct rnp_rxsw_entry {struct rte_mbuf *mbuf; }; +struct rnp_queue_stats { +uint64_t obytes; +uint64_t opackets; + +uint64_t ibytes; +uint64_t ipackets; +}; +struct rnp_rx_queue {struct rte_mempool *mb_pool;/* mbuf pool to populate rx ring. */ const struct rte_memzone *rz;/* rx hw ring base alloc memzone */
@@ -73,6 +81,7 @@ struct rnp_rx_queue {uint8_t pthresh;/* rx desc prefetch threshold */ uint8_t pburst;/* rx desc prefetch burst */ +struct rnp_queue_stats stats;uint64_t rx_offloads;/* user set hw offload features */ struct rte_mbuf **free_mbufs;/* rx bulk alloc reserve of free mbufs */ struct rte_mbuf fake_mbuf;/* dummy mbuf */
@@ -113,6 +122,7 @@ struct rnp_tx_queue {uint8_t pthresh;/* rx desc prefetch threshold */ uint8_t pburst;/* rx desc burst*/ +struct rnp_queue_stats stats;uint64_t tx_offloads;/* tx offload features */ struct rte_mbuf **free_mbufs;/* tx bulk free reserve of free mbufs */ };
Signature · 1 line
2.25.1
PATCH v17 20/29 net/rnp: add support xstats operation
In reply to Wenbo Caoadd support mac eth rx tx hw xstats.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 3 + drivers/net/rnp/base/rnp_eth_regs.h | 4 + drivers/net/rnp/base/rnp_mac_regs.h | 80 ++++++++++ drivers/net/rnp/rnp.h | 44 ++++++ drivers/net/rnp/rnp_ethdev.c | 226 +++++++++++++++++++++++++++- 6 files changed, 353 insertions(+), 5 deletions(-)
doc/guides/nics/features/rnp.ini +1 -0
@@ -9,6 +9,7 @@ Link status = Y Link status event = Y Basic stats = Y Stats per queue = Y +Extended stats = Y Queue start/stop = Y Promiscuous mode = Y Allmulticast mode = Y
doc/guides/nics/rnp.rst +3 -0
@@ -98,3 +98,6 @@ Listed below are the rte_eth functions supported: * ``rte_eth_link_get_nowait`` * ``rte_eth_stats_get`` * ``rte_eth_stats_reset`` +* ``rte_eth_xstats_get`` +* ``rte_eth_xstats_reset`` +* ``rte_eth_xstats_get_names``
drivers/net/rnp/base/rnp_eth_regs.h +4 -0
@@ -25,6 +25,10 @@#define RNP_RING_FC_THRESH (n) _ETH_(0x8a00 + ((0x4) * (n)))/* ETH Statistic */ #define RNP_ETH_RXTRANS_DROP _ETH_(0x8904) +#define RNP_ETH_RXSLAN_DROP _ETH_(0x8914) +#define RNP_ETH_RXGLAN_DROP _ETH_(0x8918) +#define RNP_ETH_RXIPH_E_DROP _ETH_(0x891c) +#define RNP_ETH_RXCKSUM_E_DROP _ETH_(0x8920)#define RNP_ETH_RXTRUNC_DROP _ETH_(0x8928)/* Mac Host Filter */ #define RNP_MAC_FCTRL _ETH_(0x9110)
drivers/net/rnp/base/rnp_mac_regs.h +80 -0
84 lines not on this page · raw message
drivers/net/rnp/rnp.h +44 -0
56 lines not on this page · raw message
drivers/net/rnp/rnp_ethdev.c +221 -5
281 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 21/29 net/rnp: add unicast MAC filter operation
In reply to Wenbo Caoadd mac filter for single/multiple port.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 6 ++ drivers/net/rnp/base/rnp_eth_regs.h | 4 ++ drivers/net/rnp/base/rnp_hw.h | 3 + drivers/net/rnp/base/rnp_mac.c | 91 +++++++++++++++++++++++++++++ drivers/net/rnp/base/rnp_mac.h | 2 + drivers/net/rnp/base/rnp_mac_regs.h | 4 ++ drivers/net/rnp/rnp.h | 4 ++ drivers/net/rnp/rnp_ethdev.c | 62 ++++++++++++++++++-- 9 files changed, 171 insertions(+), 6 deletions(-)
doc/guides/nics/features/rnp.ini +1 -0
@@ -14,6 +14,7 @@ Queue start/stop = Y Promiscuous mode = Y Allmulticast mode = Y MTU update = Y +Unicast MAC filter = Y RSS hash = Y RSS key update = Y RSS reta update = Y
doc/guides/nics/rnp.rst +6 -0
@@ -44,6 +44,7 @@ Features - Promiscuous mode - Link state information - MTU update +- MAC filtering - Jumbo frames - Scatter-Gather IO support - Port hardware statistic
@@ -86,6 +87,9 @@ Listed below are the rte_eth functions supported: * ``rte_eth_dev_set_link_up`` * ``rte_eth_dev_get_mtu`` * ``rte_eth_dev_set_mtu`` +* ``rte_eth_dev_default_mac_addr_set`` +* ``rte_eth_dev_mac_addr_add`` +* ``rte_eth_dev_mac_addr_remove`` * ``rte_eth_promiscuous_disable`` * ``rte_eth_promiscuous_enable`` * ``rte_eth_allmulticast_enable``
@@ -101,3 +105,5 @@ Listed below are the rte_eth functions supported: * ``rte_eth_xstats_get`` * ``rte_eth_xstats_reset`` * ``rte_eth_xstats_get_names`` +* ``rte_eth_macaddr_get`` +* ``rte_eth_macaddrs_get``
drivers/net/rnp/base/rnp_eth_regs.h +4 -0
@@ -64,5 +64,9 @@#define RNP_RSS_KEY_TABLE (idx) _ETH_(0x92d0 + ((idx) * 0x4))#define RNP_TC_PORT_OFFSET (lane) _ETH_(0xe840 + 0x04 * (lane)) +/* host mac address filter */ +#define RNP_RAL_BASE_ADDR (n) _ETH_(0xA000 + (0x04 * (n))) +#define RNP_RAH_BASE_ADDR (n) _ETH_(0xA400 + (0x04 * (n))) +#define RNP_MAC_FILTER_EN RTE_BIT32(31)#endif /* _RNP_ETH_REGS_H */
drivers/net/rnp/base/rnp_hw.h +3 -0
@@ -71,6 +71,9 @@ struct rnp_mac_ops {int (*get_macaddr)(struct rnp_eth_port *port,u8 *mac);/* update mac packet filter mode */ int (*update_mpfm)(struct rnp_eth_port *port,u32 mode,bool en); +/* Receive Address Filter table */ +int (*set_rafb)(struct rnp_eth_port *port,const u8 *mac,u32 index); +int (*clear_rafb)(struct rnp_eth_port *port,u32 index); };struct rnp_eth_adapter ;
drivers/net/rnp/base/rnp_mac.c +91 -0
111 lines not on this page · raw message
drivers/net/rnp/base/rnp_mac.h +2 -0
@@ -24,6 +24,8 @@void rnp_mac_ops_init (struct rnp_hw *hw);int rnp_get_mac_addr (struct rnp_eth_port *port,u8 *mac); +int rnp_set_macaddr (struct rnp_eth_port *port,u8 *mac,u32 index); +int rnp_clear_macaddr (struct rnp_eth_port *port,u32 index);int rnp_update_mpfm (struct rnp_eth_port *port,u32 mode,bool en);
drivers/net/rnp/base/rnp_mac_regs.h +4 -0
@@ -78,6 +78,10 @@/* PHY Link Status */ #define RNP_MAC_PLS RTE_BIT32(17) +/* Rx macaddr filter ctrl */ +#define RNP_MAC_ADDR_HI (n) (0x0300 + ((n) * 0x8)) +#define RNP_MAC_AE RTE_BIT32(31) +#define RNP_MAC_ADDR_LO (n) (0x0304 + ((n) * 0x8))/* Mac Manage Counts */ #define RNP_MMC_CTRL (0x0800)#define RNP_MMC_RSTONRD RTE_BIT32(2)
drivers/net/rnp/rnp.h +4 -0
@@ -59,6 +59,10 @@#define RNP_MAX_HASH_MC_MAC_SIZE (4096)/* max multicast hash mac num */ #define RNP_MAX_UC_HASH_TABLE (128)/* max unicast hash mac filter table */ #define RNP_MAC_MC_HASH_TABLE (128)/* max multicast hash mac filter table*/ +/* Peer port own independent resource */ +#define RNP_PORT_MAX_MACADDR (32) +#define RNP_PORT_MAX_MC_HASH_TB (8) +#define RNP_PORT_MAX_MC_MAC_SIZE (RNP_PORT_MAX_MC_HASH_TB * 32)/* hardware media type */ enum rnp_media_type {RNP_MEDIA_TYPE_UNKNOWN ,
drivers/net/rnp/rnp_ethdev.c +56 -6
92 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 22/29 net/rnp: add supported packet types
In reply to Wenbo Caoadd support parse hw packet types result.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 2 ++ drivers/net/rnp/base/rnp_bdq_if.h | 4 +++ drivers/net/rnp/rnp_ethdev.c | 31 +++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.c | 45 +++++++++++++++++++++++++++++++ 5 files changed, 83 insertions(+)
doc/guides/nics/features/rnp.ini +1 -0
@@ -7,6 +7,7 @@ Speed capabilities = Y Link status = Y Link status event = Y +Packet type parsing = Y Basic stats = Y Stats per queue = Y Extended stats = Y
doc/guides/nics/rnp.rst +2 -0
@@ -48,6 +48,7 @@ Features - Jumbo frames - Scatter-Gather IO support - Port hardware statistic +- Packet type parsing Prerequisites and Pre-conditions --------------------------------
@@ -90,6 +91,7 @@ Listed below are the rte_eth functions supported: * ``rte_eth_dev_default_mac_addr_set`` * ``rte_eth_dev_mac_addr_add`` * ``rte_eth_dev_mac_addr_remove`` +* ``rte_eth_dev_get_supported_ptypes`` * ``rte_eth_promiscuous_disable`` * ``rte_eth_promiscuous_enable`` * ``rte_eth_allmulticast_enable``
drivers/net/rnp/base/rnp_bdq_if.h +4 -0
@@ -73,6 +73,7 @@ struct rnp_tx_desc {#define RNP_RX_L3TYPE_IPV4 (0x00UL << RNP_RX_L3TYPE_S)#define RNP_RX_L3TYPE_IPV6 (0x01UL << RNP_RX_L3TYPE_S)#define RNP_RX_L4TYPE_S (6) +#define RNP_RX_L4TYPE_MASK RTE_GENMASK32(7, 6)#define RNP_RX_L4TYPE_TCP (0x01UL << RNP_RX_L4TYPE_S)#define RNP_RX_L4TYPE_SCTP (0x02UL << RNP_RX_L4TYPE_S)#define RNP_RX_L4TYPE_UDP (0x03UL << RNP_RX_L4TYPE_S)
@@ -83,9 +84,12 @@ struct rnp_tx_desc {#define RNP_RX_IN_L3_ERR RTE_BIT32(11)#define RNP_RX_IN_L4_ERR RTE_BIT32(12)#define RNP_RX_TUNNEL_TYPE_S (13) +#define RNP_RX_TUNNEL_MASK RTE_GENMASK32(14, 13)#define RNP_RX_PTYPE_VXLAN (0x01UL << RNP_RX_TUNNEL_TYPE_S)#define RNP_RX_PTYPE_NVGRE (0x02UL << RNP_RX_TUNNEL_TYPE_S)#define RNP_RX_PTYPE_VLAN RTE_BIT32(15) +/* mark_data */ +#define RNP_RX_L3TYPE_VALID RTE_BIT32(31)/* tx data cmd */ #define RNP_TX_TSO_EN RTE_BIT32(4)#define RNP_TX_L3TYPE_S (5)
drivers/net/rnp/rnp_ethdev.c +31 -0
@@ -1186,6 +1186,36 @@ rnp_dev_mac_addr_remove(struct rte_eth_dev *dev,rnp_clear_macaddr (port, index); } +static uint32_t *rnp_support_ptypes_get (void ) +{ +static uint32_t ptypes[] = { +RTE_PTYPE_L2_ETHER , +RTE_PTYPE_L2_ETHER_TIMESYNC , +RTE_PTYPE_L3_IPV4_EXT_UNKNOWN , +RTE_PTYPE_L3_IPV6_EXT_UNKNOWN , +RTE_PTYPE_L4_TCP , +RTE_PTYPE_L4_UDP , +RTE_PTYPE_L4_SCTP , +RTE_PTYPE_TUNNEL_VXLAN , +RTE_PTYPE_TUNNEL_GRE , +RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN , +RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN , +RTE_PTYPE_INNER_L4_TCP , +RTE_PTYPE_INNER_L4_UDP , +RTE_PTYPE_INNER_L4_SCTP , +RTE_PTYPE_UNKNOWN , + }; + +return ptypes; +} + +static const uint32_t * +rnp_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused, + size_t *no_of_elements __rte_unused) +{ +return rnp_support_ptypes_get (); +} +/* Features supported by this driver */ static const struct eth_dev_ops rnp_eth_dev_ops = { .dev_configure = rnp_dev_configure,
@@ -1228,6 +1258,7 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .mac_addr_set = rnp_dev_mac_addr_set, .mac_addr_add = rnp_dev_mac_addr_add, .mac_addr_remove = rnp_dev_mac_addr_remove, + .dev_supported_ptypes_get = rnp_dev_supported_ptypes_get, }; static void
drivers/net/rnp/rnp_rxtx.c +45 -0
63 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 23/29 net/rnp: add support Rx checksum offload
In reply to Wenbo CaoAdd support Rx l3/l4 checum and tunnel
inner l3/l4, out l3 chksum.
--- doc/guides/nics/features/rnp.ini | 4 ++ doc/guides/nics/rnp.rst | 1 + drivers/net/rnp/base/rnp_eth_regs.h | 13 ++++ drivers/net/rnp/rnp.h | 7 +++ drivers/net/rnp/rnp_ethdev.c | 65 ++++++++++++++++++- drivers/net/rnp/rnp_rxtx.c | 97 ++++++++++++++++++++++++++++- 6 files changed, 185 insertions(+), 2 deletions(-)
doc/guides/nics/features/rnp.ini +4 -0
@@ -8,6 +8,10 @@ Speed capabilities = Y Link status = Y Link status event = Y Packet type parsing = Y +L3 checksum offload = P +L4 checksum offload = P +Inner L3 checksum = P +Inner L4 checksum = P Basic stats = Y Stats per queue = Y Extended stats = Y
doc/guides/nics/rnp.rst +1 -0
@@ -49,6 +49,7 @@ Features - Scatter-Gather IO support - Port hardware statistic - Packet type parsing +- Checksum offload Prerequisites and Pre-conditions --------------------------------
drivers/net/rnp/base/rnp_eth_regs.h +13 -0
@@ -16,6 +16,19 @@#define RNP_RX_ETH_F_CTRL (n) _ETH_(0x8070 + ((n) * 0x8))#define RNP_RX_ETH_F_OFF (0x7ff)#define RNP_RX_ETH_F_ON (0x270) +/* rx checksum ctrl */ +#define RNP_HW_SCTP_CKSUM_CTRL _ETH_(0x8038) +#define RNP_HW_CHECK_ERR_CTRL _ETH_(0x8060) +#define RNP_HW_ERR_HDR_LEN RTE_BIT32(0) +#define RNP_HW_ERR_PKTLEN RTE_BIT32(1) +#define RNP_HW_L3_CKSUM_ERR RTE_BIT32(2) +#define RNP_HW_L4_CKSUM_ERR RTE_BIT32(3) +#define RNP_HW_SCTP_CKSUM_ERR RTE_BIT32(4) +#define RNP_HW_INNER_L3_CKSUM_ERR RTE_BIT32(5) +#define RNP_HW_INNER_L4_CKSUM_ERR RTE_BIT32(6) +#define RNP_HW_CKSUM_ERR_MASK RTE_GENMASK32(6, 2) +#define RNP_HW_CHECK_ERR_MASK RTE_GENMASK32(6, 0) +#define RNP_HW_ERR_RX_ALL_MASK RTE_GENMASK32(1, 0)/* max/min pkts length receive limit ctrl */ #define RNP_MIN_FRAME_CTRL _ETH_(0x80f0)#define RNP_MAX_FRAME_CTRL _ETH_(0x80f4)
drivers/net/rnp/rnp.h +7 -0
@@ -45,6 +45,13 @@ RTE_ETH_RSS_NONFRAG_IPV6_UDP | \ RTE_ETH_RSS_IPV6_UDP_EX | \ RTE_ETH_RSS_NONFRAG_IPV6_SCTP) +/* rx checksum offload */ +#define RNP_RX_CHECKSUM_SUPPORT ( \ + RTE_ETH_RX_OFFLOAD_IPV4_CKSUM | \ + RTE_ETH_RX_OFFLOAD_UDP_CKSUM | \ + RTE_ETH_RX_OFFLOAD_TCP_CKSUM | \ + RTE_ETH_RX_OFFLOAD_SCTP_CKSUM | \ + RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM)/* Ring info special */ #define RNP_MAX_BD_COUNT (4096)#define RNP_MIN_BD_COUNT (128)
drivers/net/rnp/rnp_ethdev.c +64 -1
83 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.c +96 -1
110 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v17 24/29 net/rnp: add support Tx TSO offload
In reply to Wenbo CaoAdd support tx tso and tunnel tso
for tunnel just support vxlan/nvgre.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 1 + drivers/net/rnp/base/rnp_bdq_if.h | 1 + drivers/net/rnp/rnp.h | 2 +- drivers/net/rnp/rnp_ethdev.c | 14 +- drivers/net/rnp/rnp_rxtx.c | 464 +++++++++++++++++++++++++++++- drivers/net/rnp/rnp_rxtx.h | 1 + 7 files changed, 476 insertions(+), 8 deletions(-)
doc/guides/nics/features/rnp.ini +1 -0
@@ -25,5 +25,6 @@ RSS key update = Y RSS reta update = Y Inner RSS = Y Scattered Rx = Y +TSO = Y Linux = Y x86-64 = Y
doc/guides/nics/rnp.rst +1 -0
@@ -50,6 +50,7 @@ Features - Port hardware statistic - Packet type parsing - Checksum offload +- TSO offload Prerequisites and Pre-conditions --------------------------------
drivers/net/rnp/base/rnp_bdq_if.h +1 -0
@@ -111,6 +111,7 @@ struct rnp_tx_desc {#define RNP_TX_VLAN_VALID RTE_BIT32(15)/* tx data mac_ip len */ #define RNP_TX_MAC_LEN_S (9) +#define RNP_TX_MAC_LEN_MASK RTE_GENMASK32(15, 9)/* tx ctrl cmd */ #define RNP_TX_LEN_PAD_S (8)#define RNP_TX_OFF_MAC_PAD (0x01UL << RNP_TX_LEN_PAD_S)
drivers/net/rnp/rnp.h +1 -1
@@ -20,7 +20,7 @@#define RNP_ETH_OVERHEAD \ (RTE_ETHER_HDR_LEN + RTE_VLAN_HLEN * 2)#define RNP_MAC_MAXFRM_SIZE (9590) - +#define RNP_MAX_TSO_PKT (16 * 1024)#define RNP_RX_MAX_MTU_SEG (64)#define RNP_TX_MAX_MTU_SEG (32)#define RNP_RX_MAX_SEG (150)
drivers/net/rnp/rnp_ethdev.c +12 -2
@@ -671,7 +671,16 @@ static int rnp_dev_infos_get(struct rte_eth_dev *eth_dev, dev_info->rx_offload_capa =RNP_RX_CHECKSUM_SUPPORT |RTE_ETH_RX_OFFLOAD_SCATTER ;/* tx support offload cap */ - dev_info->tx_offload_capa =RTE_ETH_TX_OFFLOAD_MULTI_SEGS ; + dev_info->tx_offload_capa =0 | +RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | +RTE_ETH_TX_OFFLOAD_UDP_CKSUM | +RTE_ETH_TX_OFFLOAD_TCP_CKSUM | +RTE_ETH_TX_OFFLOAD_SCTP_CKSUM | +RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM | +RTE_ETH_TX_OFFLOAD_TCP_TSO | +RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | +RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | +RTE_ETH_TX_OFFLOAD_MULTI_SEGS ;/* default ring configure */ dev_info->default_rxportconf.burst_size =32 ; dev_info->default_txportconf.burst_size =32 ;
@@ -1083,6 +1092,7 @@ rnp_dev_stats_get(struct rte_eth_dev *dev,continue ; stats->opackets += txq->stats.opackets; stats->obytes += txq->stats.obytes; + stats->oerrors += txq->stats.errors;if (i <RTE_ETHDEV_QUEUE_STAT_CNTRS ) { stats->q_opackets[i] = txq->stats.opackets; stats->q_obytes[i] = txq->stats.obytes;
@@ -1091,7 +1101,7 @@ rnp_dev_stats_get(struct rte_eth_dev *dev, stats->imissed = eth_stats->rx_trans_drop + eth_stats->rx_trunc_drop; stats->ierrors = mac_stats->rx_crc_err + mac_stats->rx_len_err; stats->ierrors += mac_stats->rx_watchdog_err; - stats->oerrors = mac_stats->tx_underflow_err; + stats->oerrors += mac_stats->tx_underflow_err;return 0 ; }
drivers/net/rnp/rnp_rxtx.c +459 -5
515 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.h +1 -0
@@ -53,6 +53,7 @@ struct rnp_queue_stats {uint64_t ibytes;uint64_t ipackets; +uint64_t errors; };struct rnp_rx_queue {
Signature · 1 line
2.25.1
PATCH v17 25/29 net/rnp: support VLAN offloads
In reply to Wenbo Caoadd support rx vlan strip,filter,tx vlan/qinq insert.
--- doc/guides/nics/features/rnp.ini | 2 + doc/guides/nics/rnp.rst | 4 + drivers/net/rnp/base/rnp_bdq_if.h | 2 +- drivers/net/rnp/base/rnp_eth_regs.h | 5 + drivers/net/rnp/base/rnp_hw.h | 2 + drivers/net/rnp/base/rnp_mac.c | 53 ++++++++- drivers/net/rnp/base/rnp_mac.h | 1 + drivers/net/rnp/base/rnp_mac_regs.h | 41 ++++++- drivers/net/rnp/rnp.h | 7 ++ drivers/net/rnp/rnp_ethdev.c | 170 +++++++++++++++++++++++++++- drivers/net/rnp/rnp_rxtx.c | 22 +++- 11 files changed, 303 insertions(+), 6 deletions(-)
doc/guides/nics/features/rnp.ini +2 -0
@@ -20,6 +20,8 @@ Promiscuous mode = Y Allmulticast mode = Y MTU update = Y Unicast MAC filter = Y +VLAN offload = Y +QinQ offload = P RSS hash = Y RSS key update = Y RSS reta update = Y
doc/guides/nics/rnp.rst +4 -0
@@ -51,6 +51,7 @@ Features - Packet type parsing - Checksum offload - TSO offload +- VLAN stripping and VLAN/QINQ insertion Prerequisites and Pre-conditions --------------------------------
@@ -94,6 +95,9 @@ Listed below are the rte_eth functions supported: * ``rte_eth_dev_mac_addr_add`` * ``rte_eth_dev_mac_addr_remove`` * ``rte_eth_dev_get_supported_ptypes`` +* ``rte_eth_dev_get_vlan_offload`` +* ``rte_eth_dev_set_vlan_offload`` +* ``rte_eth_dev_set_vlan_strip_on_queue`` * ``rte_eth_promiscuous_disable`` * ``rte_eth_promiscuous_enable`` * ``rte_eth_allmulticast_enable``
drivers/net/rnp/base/rnp_bdq_if.h +1 -1
@@ -87,7 +87,7 @@ struct rnp_tx_desc {#define RNP_RX_TUNNEL_MASK RTE_GENMASK32(14, 13)#define RNP_RX_PTYPE_VXLAN (0x01UL << RNP_RX_TUNNEL_TYPE_S)#define RNP_RX_PTYPE_NVGRE (0x02UL << RNP_RX_TUNNEL_TYPE_S) -#define RNP_RX_PTYPE_VLAN RTE_BIT32(15) +#define RNP_RX_STRIP_VLAN RTE_BIT32(15)/* mark_data */ #define RNP_RX_L3TYPE_VALID RTE_BIT32(31)/* tx data cmd */
drivers/net/rnp/base/rnp_eth_regs.h +5 -0
@@ -57,6 +57,11 @@#define RNP_MAC_HASH_MASK RTE_GENMASK32(11, 0)#define RNP_MAC_MULTICASE_TBL_EN RTE_BIT32(2)#define RNP_MAC_UNICASE_TBL_EN RTE_BIT32(3) +/* vlan strip ctrl */ +#define RNP_VLAN_Q_STRIP_CTRL (n) _ETH_(0x8040 + 0x4 * ((n) / 32)) +/* vlan filter ctrl */ +#define RNP_VLAN_FILTER_CTRL _ETH_(0x9118) +#define RNP_VLAN_FILTER_EN RTE_BIT32(30)/* rss function ctrl */ #define RNP_RSS_INNER_CTRL _ETH_(0x805c)#define RNP_INNER_RSS_EN (1)
drivers/net/rnp/base/rnp_hw.h +2 -0
@@ -74,6 +74,8 @@ struct rnp_mac_ops {/* Receive Address Filter table */ int (*set_rafb)(struct rnp_eth_port *port,const u8 *mac,u32 index);int (*clear_rafb)(struct rnp_eth_port *port,u32 index); +/* receive vlan filter */ +int (*vlan_f_en)(struct rnp_eth_port *port,bool en); };struct rnp_eth_adapter ;
drivers/net/rnp/base/rnp_mac.c +52 -1
75 lines not on this page · raw message
drivers/net/rnp/base/rnp_mac.h +1 -0
@@ -28,5 +28,6 @@ int rnp_set_macaddr(struct rnp_eth_port *port, u8 *mac, u32 index);int rnp_clear_macaddr (struct rnp_eth_port *port,u32 index);int rnp_update_mpfm (struct rnp_eth_port *port,u32 mode,bool en); +int rnp_rx_vlan_filter_en (struct rnp_eth_port *port,bool en);#endif /* _RNP_MAC_H_ */
drivers/net/rnp/base/rnp_mac_regs.h +39 -2
47 lines not on this page · raw message
drivers/net/rnp/rnp.h +7 -0
@@ -167,6 +167,11 @@ struct rnp_hw_mac_stats {uint64_t tx_underflow_err; }; +enum rnp_vlan_type { +RNP_CVLAN_TYPE =0 , +RNP_SVLAN_TYPE =1 , +}; +struct rnp_eth_port {struct rnp_proc_priv *proc_priv;struct rte_ether_addr mac_addr;
@@ -189,6 +194,8 @@ struct rnp_eth_port {uint16_t cur_mtu;bool jumbo_en; +enum rnp_vlan_type outvlan_type; +enum rnp_vlan_type invlan_type;rte_spinlock_t rx_mac_lock;bool port_stopped; };
drivers/net/rnp/rnp_ethdev.c +169 -1
213 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.c +21 -1
@@ -716,6 +716,7 @@ rnp_dev_rx_offload(struct rnp_rx_queue *rxq, volatile struct rnp_rx_desc rxbd) {uint32_t rss =rte_le_to_cpu_32 (rxbd.wb.qword0.rss_hash); +uint16_t vlan_tci = rxbd.wb.qword1.vlan_tci;uint16_t cmd = rxbd.wb.qword1.cmd;if (rxq->rx_offloads &RNP_RX_CHECKSUM_SUPPORT ) {
@@ -731,6 +732,13 @@ rnp_dev_rx_offload(struct rnp_rx_queue *rxq, m->hash.rss = rss; m->ol_flags |=RTE_MBUF_F_RX_RSS_HASH ; } +if (rxq->rx_offloads &RTE_ETH_RX_OFFLOAD_VLAN_STRIP ) { +if (vlan_tci && cmd &RNP_RX_STRIP_VLAN ) { + m->ol_flags |=RTE_MBUF_F_RX_VLAN | +RTE_MBUF_F_RX_VLAN_STRIPPED ; + m->vlan_tci = vlan_tci; + } + } }static __rte_always_inline void
@@ -1144,7 +1152,8 @@ rnp_need_ctrl_desc(uint64_t flags)static uint64_t mask =RTE_MBUF_F_TX_OUTER_IP_CKSUM |RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_TUNNEL_VXLAN | -RTE_MBUF_F_TX_TUNNEL_GRE ; +RTE_MBUF_F_TX_TUNNEL_GRE | +RTE_MBUF_F_TX_QINQ ;return (flags & mask) ?1 :0 ; }
@@ -1171,6 +1180,10 @@ rnp_build_tx_control_desc(struct rnp_tx_queue *txq, txbd->c.qword0.mss =rnp_cal_tso_seg (mbuf); txbd->c.qword0.l4_len = mbuf->l4_len; } +if (flags &RTE_MBUF_F_TX_QINQ ) { + txbd->c.qword0.vlan_tci = mbuf->vlan_tci; + txbd->c.qword1.cmd |=RNP_TX_QINQ_INSERT ; + }#define GRE_TUNNEL_KEY (4)#define GRE_TUNNEL_SEQ (4)switch (flags &RTE_MBUF_F_TX_TUNNEL_MASK ) {
@@ -1317,6 +1330,13 @@ rnp_setup_tx_offload(struct rnp_tx_queue *txq, flags & RTE_MBUF_F_TX_TCP_SEG || flags & RTE_MBUF_F_TX_IP_CKSUM)rnp_setup_csum_offload (tx_pkt, txbd); +if (flags & (RTE_MBUF_F_TX_VLAN | +RTE_MBUF_F_TX_QINQ )) { + txbd->d.cmd |=RNP_TX_VLAN_VALID ; + txbd->d.vlan_tci = (flags &RTE_MBUF_F_TX_QINQ ) ? + tx_pkt->vlan_tci_outer : tx_pkt->vlan_tci; + txbd->d.cmd |=RNP_TX_VLAN_INSERT ; + } }static __rte_always_inline uint16_t
Signature · 1 line
2.25.1
PATCH v17 26/29 net/rnp: add support VLAN filters operations
In reply to Wenbo Caoadd support to update vid for vlan filter.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 3 +- drivers/net/rnp/base/meson.build | 1 + drivers/net/rnp/base/rnp_bitrev.h | 64 ++++++++++++++++++++ drivers/net/rnp/base/rnp_crc32.c | 37 ++++++++++++ drivers/net/rnp/base/rnp_crc32.h | 10 ++++ drivers/net/rnp/base/rnp_eth_regs.h | 1 + drivers/net/rnp/base/rnp_hw.h | 1 + drivers/net/rnp/base/rnp_mac.c | 90 ++++++++++++++++++++++++++++- drivers/net/rnp/base/rnp_mac.h | 1 + drivers/net/rnp/base/rnp_mac_regs.h | 6 ++ drivers/net/rnp/base/rnp_osdep.h | 13 +++++ drivers/net/rnp/rnp.h | 11 ++++ drivers/net/rnp/rnp_ethdev.c | 11 ++++ 14 files changed, 247 insertions(+), 3 deletions(-) create mode 100644 drivers/net/rnp/base/rnp_bitrev.h create mode 100644 drivers/net/rnp/base/rnp_crc32.c create mode 100644 drivers/net/rnp/base/rnp_crc32.h
doc/guides/nics/features/rnp.ini +1 -0
@@ -20,6 +20,7 @@ Promiscuous mode = Y Allmulticast mode = Y MTU update = Y Unicast MAC filter = Y +VLAN filter = Y VLAN offload = Y QinQ offload = P RSS hash = Y
doc/guides/nics/rnp.rst +2 -1
@@ -44,7 +44,7 @@ Features - Promiscuous mode - Link state information - MTU update -- MAC filtering +- MAC/VLAN filtering - Jumbo frames - Scatter-Gather IO support - Port hardware statistic
@@ -98,6 +98,7 @@ Listed below are the rte_eth functions supported: * ``rte_eth_dev_get_vlan_offload`` * ``rte_eth_dev_set_vlan_offload`` * ``rte_eth_dev_set_vlan_strip_on_queue`` +* ``rte_eth_dev_vlan_filter`` * ``rte_eth_promiscuous_disable`` * ``rte_eth_promiscuous_enable`` * ``rte_eth_allmulticast_enable``
drivers/net/rnp/base/meson.build +1 -0
@@ -8,6 +8,7 @@ sources = [ 'rnp_common.c', 'rnp_mac.c', 'rnp_bdq_if.c', + 'rnp_crc32.c', ] c_args = cflags
drivers/net/rnp/base/rnp_bitrev.h new file +64 -0
64 lines not on this page · raw message
drivers/net/rnp/base/rnp_crc32.c new file +37 -0
@@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#include "rnp_osdep.h" +#include "rnp_crc32.h" + +static inline int get_bitmask_order (u32 count) +{ +int order; + + order =fls (count); + +return order;/* We could be slightly more clever with -1 here... */ +} + +u32 rnp_vid_crc32_calc (u32 crc_init,u16 vid_le) +{ +u8 *data = (u8 *)&vid_le; +u32 crc = crc_init; +u8 data_byte =0 ; +u32 temp =0 ; +int i, bits; + + bits =get_bitmask_order (VLAN_VID_MASK ); +for (i =0 ; i < bits; i++) { +if ((i %8 ) ==0 ) + data_byte = data[i /8 ]; + temp = ((crc &1 ) ^ data_byte) &1 ; + crc >>=1 ; + data_byte >>=1 ; +if (temp) + crc ^=0xedb88320 ; + } + +return crc; +}
drivers/net/rnp/base/rnp_crc32.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#ifndef _RNP_CRC32_H_ +#define _RNP_CRC32_H_ + +u32 rnp_vid_crc32_calc (u32 crc_init,u16 vid_le); + +#endif /* _RNP_CRC32_H_ */
drivers/net/rnp/base/rnp_eth_regs.h +1 -0
@@ -62,6 +62,7 @@/* vlan filter ctrl */ #define RNP_VLAN_FILTER_CTRL _ETH_(0x9118)#define RNP_VLAN_FILTER_EN RTE_BIT32(30) +#define RNP_VFTA_HASH_TABLE (id) _ETH_(0xB000 + 0x4 * (id))/* rss function ctrl */ #define RNP_RSS_INNER_CTRL _ETH_(0x805c)#define RNP_INNER_RSS_EN (1)
drivers/net/rnp/base/rnp_hw.h +1 -0
@@ -76,6 +76,7 @@ struct rnp_mac_ops {int (*clear_rafb)(struct rnp_eth_port *port,u32 index);/* receive vlan filter */ int (*vlan_f_en)(struct rnp_eth_port *port,bool en); +int (*update_vlan)(struct rnp_eth_port *port,u16 vid,bool en); };struct rnp_eth_adapter ;
drivers/net/rnp/base/rnp_mac.c +88 -2
129 lines not on this page · raw message
drivers/net/rnp/base/rnp_mac.h +1 -0
@@ -29,5 +29,6 @@ int rnp_clear_macaddr(struct rnp_eth_port *port, u32 index);int rnp_update_mpfm (struct rnp_eth_port *port,u32 mode,bool en);int rnp_rx_vlan_filter_en (struct rnp_eth_port *port,bool en); +int rnp_update_vlan_filter (struct rnp_eth_port *port,u16 vid,bool en);#endif /* _RNP_MAC_H_ */
drivers/net/rnp/base/rnp_mac_regs.h +6 -0
@@ -85,6 +85,12 @@#define RNP_MAC_VLAN_ETV RTE_BIT32(16)/* enable vid valid */ #define RNP_MAC_VLAN_HASH_EN RTE_GENMASK32(15, 0) +/* mac vlan hash filter */ +#define RNP_MAC_VLAN_HASH (0x58) +#define RNP_MAC_VLAN_HASH_MASK RTE_GENMASK32(15, 0) +#define RNP_MAC_VLAN_HASH_SHIFT (28) +#define RNP_VLAN_BITMAP_BIT (vlan_id) (1UL << ((vlan_id) & 0x3F)) +#define RNP_VLAN_BITMAP_IDX (vlan_id) ((vlan_id) >> 6)/* MAC VLAN CTRL INSERT REG */ #define RNP_MAC_VLAN_INCL (0x60)#define RNP_MAC_INNER_VLAN_INCL (0x64)
drivers/net/rnp/base/rnp_osdep.h +13 -0
@@ -53,6 +53,19 @@ typedef uint64_t u64;#define cpu_to_le32 (v) rte_cpu_to_le_32((u32)(v))#endif +#ifndef DIV_ROUND_UP +#define DIV_ROUND_UP (n, d) (((n) + (d) - 1) / (d)) +#define BITS_PER_BYTE (8) +#define BITS_TO_LONGS (nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) +#endif + +#define fls (n) rte_fls_u32(n) + +#ifndef VLAN_N_VID +#define VLAN_N_VID (4096) +#define VLAN_VID_MASK (0x0fff) +#endif +#define spinlock_t rte_spinlock_t#define spin_lock_init (spinlock_v) rte_spinlock_init(spinlock_v)#define spin_lock (spinlock_v) rte_spinlock_lock(spinlock_v)
drivers/net/rnp/rnp.h +11 -0
@@ -66,6 +66,7 @@#define RNP_MAX_HASH_MC_MAC_SIZE (4096)/* max multicast hash mac num */ #define RNP_MAX_UC_HASH_TABLE (128)/* max unicast hash mac filter table */ #define RNP_MAC_MC_HASH_TABLE (128)/* max multicast hash mac filter table*/ +#define RNP_MAX_VFTA_SIZE (128)/* max pf vlan hash table size */ /* Peer port own independent resource */ #define RNP_PORT_MAX_MACADDR (32)#define RNP_PORT_MAX_MC_HASH_TB (8)
@@ -172,6 +173,15 @@ enum rnp_vlan_type { RNP_SVLAN_TYPE = 1, }; +struct rnp_vlan_filter { +union { +/* indep vlan hash filter table used */ +uint64_t vlans_bitmap[BITS_TO_LONGS (VLAN_N_VID )]; +/* PF vlan filter table used */ +uint32_t vfta_entries[RNP_MAX_VFTA_SIZE ]; + }; +}; +struct rnp_eth_port {struct rnp_proc_priv *proc_priv;struct rte_ether_addr mac_addr;
@@ -196,6 +206,7 @@ struct rnp_eth_port {enum rnp_vlan_type outvlan_type;enum rnp_vlan_type invlan_type; +struct rnp_vlan_filter vfta;rte_spinlock_t rx_mac_lock;bool port_stopped; };
drivers/net/rnp/rnp_ethdev.c +11 -0
@@ -395,6 +395,15 @@ rnp_vlan_offload_set(struct rte_eth_dev *dev, int mask)return 0 ; } +static int +rnp_vlan_filter_set (struct rte_eth_dev *dev, +uint16_t vlan_id,int on) +{ +struct rnp_eth_port *port =RNP_DEV_TO_PORT (dev); + +return rnp_update_vlan_filter (port, vlan_id, on); +} +static int rnp_dev_start (struct rte_eth_dev *eth_dev) {struct rnp_eth_port *port =RNP_DEV_TO_PORT (eth_dev);
@@ -828,6 +837,7 @@ static int rnp_dev_infos_get(struct rte_eth_dev *eth_dev, dev_info->rx_queue_offload_capa =RTE_ETH_RX_OFFLOAD_VLAN_STRIP ;/* rx support offload cap */ dev_info->rx_offload_capa =RNP_RX_CHECKSUM_SUPPORT | +RTE_ETH_RX_OFFLOAD_VLAN_FILTER |RTE_ETH_RX_OFFLOAD_SCATTER ; dev_info->rx_offload_capa |= dev_info->rx_queue_offload_capa;/* tx support offload cap */
@@ -1496,6 +1506,7 @@ static const struct eth_dev_ops rnp_eth_dev_ops = {/* vlan offload */ .vlan_offload_set = rnp_vlan_offload_set, .vlan_strip_queue_set = rnp_vlan_strip_queue_set, + .vlan_filter_set = rnp_vlan_filter_set, .dev_supported_ptypes_get = rnp_dev_supported_ptypes_get, };
Signature · 1 line
2.25.1
PATCH v17 27/29 net/rnp: add queue info operation
In reply to Wenbo Caoadd support get queue configure info for user debug
--- doc/guides/nics/rnp.rst | 2 ++ drivers/net/rnp/rnp_ethdev.c | 2 ++ drivers/net/rnp/rnp_rxtx.c | 42 ++++++++++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.h | 4 ++++ 4 files changed, 50 insertions(+)
doc/guides/nics/rnp.rst +2 -0
@@ -106,7 +106,9 @@ Listed below are the rte_eth functions supported: * ``rte_eth_promiscuous_get`` * ``rte_eth_allmulticast_get`` * ``rte_eth_rx_queue_setup`` +* ``rte_eth_rx_queue_info_get`` * ``rte_eth_tx_queue_setup`` +* ``rte_eth_tx_queue_info_get`` * ``rte_eth_link_get`` * ``rte_eth_link_get_nowait`` * ``rte_eth_stats_get``
drivers/net/rnp/rnp_ethdev.c +2 -0
@@ -1480,10 +1480,12 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .rx_queue_release = rnp_dev_rx_queue_release, .rx_queue_stop = rnp_rx_queue_stop, .rx_queue_start = rnp_rx_queue_start, + .rxq_info_get = rnp_rx_queue_info_get, .tx_queue_setup = rnp_tx_queue_setup, .tx_queue_release = rnp_dev_tx_queue_release, .tx_queue_stop = rnp_tx_queue_stop, .tx_queue_start = rnp_tx_queue_start, + .txq_info_get = rnp_tx_queue_info_get,/* rss impl */ .reta_update = rnp_dev_rss_reta_update, .reta_query = rnp_dev_rss_reta_query,
drivers/net/rnp/rnp_rxtx.c +42 -0
45 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.h +4 -0
@@ -148,5 +148,9 @@ int rnp_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx);int rnp_rx_queue_start (struct rte_eth_dev *eth_dev,uint16_t qidx);int rnp_rx_func_select (struct rte_eth_dev *dev);int rnp_tx_func_select (struct rte_eth_dev *dev); +void rnp_rx_queue_info_get (struct rte_eth_dev *dev,uint16_t queue_id, +struct rte_eth_rxq_info *qinfo); +void rnp_tx_queue_info_get (struct rte_eth_dev *dev,uint16_t queue_id, +struct rte_eth_txq_info *qinfo);#endif /* _RNP_RXTX_H_ */
Signature · 1 line
2.25.1
PATCH v17 28/29 net/rnp: support Rx/Tx burst mode info
In reply to Wenbo Caoadd platform method for get rx/tx burst function select by upload func name.
--- doc/guides/nics/rnp.rst | 2 ++ drivers/net/rnp/rnp_ethdev.c | 2 ++ drivers/net/rnp/rnp_rxtx.c | 58 ++++++++++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.h | 6 ++++ 4 files changed, 68 insertions(+)
doc/guides/nics/rnp.rst +2 -0
@@ -107,8 +107,10 @@ Listed below are the rte_eth functions supported: * ``rte_eth_allmulticast_get`` * ``rte_eth_rx_queue_setup`` * ``rte_eth_rx_queue_info_get`` +* ``rte_eth_rx_burst_mode_get`` * ``rte_eth_tx_queue_setup`` * ``rte_eth_tx_queue_info_get`` +* ``rte_eth_tx_burst_mode_get`` * ``rte_eth_link_get`` * ``rte_eth_link_get_nowait`` * ``rte_eth_stats_get``
drivers/net/rnp/rnp_ethdev.c +2 -0
@@ -1481,11 +1481,13 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .rx_queue_stop = rnp_rx_queue_stop, .rx_queue_start = rnp_rx_queue_start, .rxq_info_get = rnp_rx_queue_info_get, + .rx_burst_mode_get = rnp_rx_burst_mode_get, .tx_queue_setup = rnp_tx_queue_setup, .tx_queue_release = rnp_dev_tx_queue_release, .tx_queue_stop = rnp_tx_queue_stop, .tx_queue_start = rnp_tx_queue_start, .txq_info_get = rnp_tx_queue_info_get, + .tx_burst_mode_get = rnp_tx_burst_mode_get,/* rss impl */ .reta_update = rnp_dev_rss_reta_update, .reta_query = rnp_dev_rss_reta_query,
drivers/net/rnp/rnp_rxtx.c +58 -0
61 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.h +6 -0
@@ -152,5 +152,11 @@ void rnp_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_rxq_info *qinfo);void rnp_tx_queue_info_get (struct rte_eth_dev *dev,uint16_t queue_id,struct rte_eth_txq_info *qinfo); +int rnp_rx_burst_mode_get (struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, +struct rte_eth_burst_mode *mode); +int rnp_tx_burst_mode_get (struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, +struct rte_eth_burst_mode *mode);#endif /* _RNP_RXTX_H_ */
Signature · 1 line
2.25.1
PATCH v17 29/29 net/rnp: add multicast MAC filter operation
In reply to Wenbo Caoadd mac filter for single/multiple port.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 1 + drivers/net/rnp/base/rnp_crc32.c | 18 ++++- drivers/net/rnp/base/rnp_crc32.h | 1 + drivers/net/rnp/base/rnp_eth_regs.h | 3 + drivers/net/rnp/base/rnp_hw.h | 4 + drivers/net/rnp/base/rnp_mac.c | 121 +++++++++++++++++++++++++++- drivers/net/rnp/base/rnp_mac.h | 2 + drivers/net/rnp/base/rnp_mac_regs.h | 2 + drivers/net/rnp/rnp.h | 4 + drivers/net/rnp/rnp_ethdev.c | 26 ++++++ 11 files changed, 181 insertions(+), 2 deletions(-)
doc/guides/nics/features/rnp.ini +1 -0
@@ -20,6 +20,7 @@ Promiscuous mode = Y Allmulticast mode = Y MTU update = Y Unicast MAC filter = Y +Multicast MAC filter = Y VLAN filter = Y VLAN offload = Y QinQ offload = P
doc/guides/nics/rnp.rst +1 -0
@@ -94,6 +94,7 @@ Listed below are the rte_eth functions supported: * ``rte_eth_dev_default_mac_addr_set`` * ``rte_eth_dev_mac_addr_add`` * ``rte_eth_dev_mac_addr_remove`` +* ``rte_eth_dev_set_mc_addr_list`` * ``rte_eth_dev_get_supported_ptypes`` * ``rte_eth_dev_get_vlan_offload`` * ``rte_eth_dev_set_vlan_offload``
drivers/net/rnp/base/rnp_crc32.c +17 -1
@@ -5,6 +5,7 @@#include "rnp_osdep.h" #include "rnp_crc32.h" +#define RNP_CRC32_POLY_LE 0xedb88320static inline int get_bitmask_order (u32 count) {int order;
@@ -30,7 +31,22 @@ u32 rnp_vid_crc32_calc(u32 crc_init, u16 vid_le) crc >>=1 ; data_byte >>=1 ;if (temp) - crc ^=0xedb88320 ; + crc ^=RNP_CRC32_POLY_LE ; + } + +return crc; +} + +u32 rnp_calc_crc32 (u32 seed,u8 *mac,u32 len) +{ +u32 crc = seed; +u32 i; + +while (len--) { + crc ^= *mac++; +for (i =0 ; i <8 ; i++) + crc = (crc >>1 ) ^ ((crc &1 ) ? +RNP_CRC32_POLY_LE :0 ); }return crc;
drivers/net/rnp/base/rnp_crc32.h +1 -0
@@ -6,5 +6,6 @@#define _RNP_CRC32_H_u32 rnp_vid_crc32_calc (u32 crc_init,u16 vid_le); +u32 rnp_calc_crc32 (u32 seed,u8 *mac,u32 len);#endif /* _RNP_CRC32_H_ */
drivers/net/rnp/base/rnp_eth_regs.h +3 -0
@@ -57,6 +57,8 @@#define RNP_MAC_HASH_MASK RTE_GENMASK32(11, 0)#define RNP_MAC_MULTICASE_TBL_EN RTE_BIT32(2)#define RNP_MAC_UNICASE_TBL_EN RTE_BIT32(3) +#define RNP_HTA_BIT_SHIFT (5) +#define RNP_HTA_BIT_MASK ((1 << RNP_HTA_BIT_SHIFT) - 1)/* vlan strip ctrl */ #define RNP_VLAN_Q_STRIP_CTRL (n) _ETH_(0x8040 + 0x4 * ((n) / 32))/* vlan filter ctrl */
@@ -87,5 +89,6 @@#define RNP_RAL_BASE_ADDR (n) _ETH_(0xA000 + (0x04 * (n)))#define RNP_RAH_BASE_ADDR (n) _ETH_(0xA400 + (0x04 * (n)))#define RNP_MAC_FILTER_EN RTE_BIT32(31) +#define RNP_MC_HASH_TABLE (n) _ETH_(0xAC00 + ((0x04) * ((n))))#endif /* _RNP_ETH_REGS_H */
drivers/net/rnp/base/rnp_hw.h +4 -0
@@ -74,6 +74,10 @@ struct rnp_mac_ops {/* Receive Address Filter table */ int (*set_rafb)(struct rnp_eth_port *port,const u8 *mac,u32 index);int (*clear_rafb)(struct rnp_eth_port *port,u32 index); +/* update multicast address table */ +int (*update_mta)(struct rnp_eth_port *port,u8 *mc_addr); +/* clear all multicast hash table */ +int (*clear_mta)(struct rnp_eth_port *port,bool en);/* receive vlan filter */ int (*vlan_f_en)(struct rnp_eth_port *port,bool en);int (*update_vlan)(struct rnp_eth_port *port,u16 vid,bool en);
drivers/net/rnp/base/rnp_mac.c +120 -1
150 lines not on this page · raw message
drivers/net/rnp/base/rnp_mac.h +2 -0
@@ -26,6 +26,8 @@ void rnp_mac_ops_init(struct rnp_hw *hw);int rnp_get_mac_addr (struct rnp_eth_port *port,u8 *mac);int rnp_set_macaddr (struct rnp_eth_port *port,u8 *mac,u32 index);int rnp_clear_macaddr (struct rnp_eth_port *port,u32 index); +int rnp_update_mc_hash (struct rnp_eth_port *port,u8 *mc_addr); +int rnp_clear_mc_hash (struct rnp_eth_port *port);int rnp_update_mpfm (struct rnp_eth_port *port,u32 mode,bool en);int rnp_rx_vlan_filter_en (struct rnp_eth_port *port,bool en);
drivers/net/rnp/base/rnp_mac_regs.h +2 -0
@@ -114,6 +114,8 @@#define RNP_MAC_VLAN_VLC_REPLACE (0x3 << RNP_MAC_VLAN_VLC_SHIFT)/* VLAN Tag for Transmit Packets For Insert/Remove */ #define RNP_MAC_VLAN_VLT RTE_GENMASK32(15, 0) +/* Mac Hash Table */ +#define RNP_MAC_ADDR_HASH_TB (n) (0x10 + ((n) * 0x4))/* mac link ctrl */ #define RNP_MAC_LPI_CTRL (0xd0)/* PHY Link Status Disable */
drivers/net/rnp/rnp.h +4 -0
@@ -71,6 +71,7 @@#define RNP_PORT_MAX_MACADDR (32)#define RNP_PORT_MAX_MC_HASH_TB (8)#define RNP_PORT_MAX_MC_MAC_SIZE (RNP_PORT_MAX_MC_HASH_TB * 32) +#define RNP_PORT_HASH_SHIFT (26 - (RNP_PORT_MAX_MC_MAC_SIZE >> 7))/* hardware media type */ enum rnp_media_type {RNP_MEDIA_TYPE_UNKNOWN ,
@@ -99,6 +100,7 @@ struct rnp_port_attr {uint16_t max_mc_mac_hash;/* max hash multicast mac size */ uint16_t uc_hash_tb_size;/* max unicast hash table block num */ uint16_t mc_hash_tb_size;/* max multicast hash table block num */ +uint16_t hash_table_shift;/* hash mac table shift num */ uint16_t max_rx_queues;/* belong to this port rxq resource */ uint16_t max_tx_queues;/* belong to this port txq resource */
@@ -200,6 +202,8 @@ struct rnp_eth_port {bool reta_has_cfg;bool hw_rss_en;uint32_t indirtbl[RNP_RSS_INDIR_SIZE ]; +uint32_t mc_hash_table[RNP_MAC_MC_HASH_TABLE ]; +uint8_t hash_filter_type;uint16_t cur_mtu;bool jumbo_en;
drivers/net/rnp/rnp_ethdev.c +26 -0
@@ -1431,6 +1431,29 @@ rnp_dev_mac_addr_remove(struct rte_eth_dev *dev,rnp_clear_macaddr (port, index); } +static int +rnp_dev_set_mc_addr_list (struct rte_eth_dev *dev, +struct rte_ether_addr *mc_addr_list, +uint32_t nb_mc_addr) +{ +struct rnp_eth_port *port =RNP_DEV_TO_PORT (dev); +uint32_t idx =0 ; + +if (nb_mc_addr > port->attr.max_mc_mac_hash) +return -EINVAL ; +rnp_clear_mc_hash (port); +for (idx =0 ; idx < nb_mc_addr; idx++) { +if (!rte_is_multicast_ether_addr (&mc_addr_list[idx])) { +RNP_PMD_ERR ("mc_list[%d] isn't a valid multicast" , idx); +return -EINVAL ; + } + } +for (idx =0 ; idx < nb_mc_addr; idx++) +rnp_update_mc_hash (port, (uint8_t *)&mc_addr_list[idx]); + +return 0 ; +} +static uint32_t *rnp_support_ptypes_get (void ) {static uint32_t ptypes[] = {
@@ -1507,6 +1530,7 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .mac_addr_set = rnp_dev_mac_addr_set, .mac_addr_add = rnp_dev_mac_addr_add, .mac_addr_remove = rnp_dev_mac_addr_remove, + .set_mc_addr_list = rnp_dev_set_mc_addr_list,/* vlan offload */ .vlan_offload_set = rnp_vlan_offload_set, .vlan_strip_queue_set = rnp_vlan_strip_queue_set,
@@ -1540,12 +1564,14 @@ rnp_setup_port_attr(struct rnp_eth_port *port, attr->max_mc_mac_hash =RNP_PORT_MAX_MC_MAC_SIZE ; attr->uc_hash_tb_size =0 ; attr->mc_hash_tb_size =RNP_PORT_MAX_MC_HASH_TB ; + attr->hash_table_shift =RNP_PORT_HASH_SHIFT ; }else { attr->max_mac_addrs =RNP_MAX_MAC_ADDRS ; attr->max_uc_mac_hash =RNP_MAX_HASH_UC_MAC_SIZE ; attr->max_mc_mac_hash =RNP_MAX_HASH_MC_MAC_SIZE ; attr->uc_hash_tb_size =RNP_MAX_UC_HASH_TABLE ; attr->mc_hash_tb_size =RNP_MAC_MC_HASH_TABLE ; + attr->hash_table_shift =0 ; } port->outvlan_type =RNP_SVLAN_TYPE ; port->invlan_type =RNP_CVLAN_TYPE ;
Signature · 1 line
2.25.1