net/rnp: add skeleton
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v11 1/28 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/index.rst | 1 + doc/guides/nics/rnp.rst | 82 ++++++++++++++++++++++++++++++++ drivers/net/meson.build | 1 + drivers/net/rnp/meson.build | 18 +++++++ drivers/net/rnp/rnp_ethdev.c | 3 ++ 8 files changed, 120 insertions(+) create mode 100644 doc/guides/nics/features/rnp.ini 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
@@ -1651,6 +1651,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/index.rst +1 -0
@@ -61,6 +61,7 @@ Network Interface Controller Drivers pfe qede r8169 + rnp sfc_efx softnic tap
doc/guides/nics/rnp.rst new file +82 -0
82 lines not on this page · raw message
drivers/net/meson.build +1 -0
@@ -54,6 +54,7 @@ drivers = [ 'qede', 'r8169', 'ring', + 'rnp', 'sfc', 'softnic', 'tap',
drivers/net/rnp/meson.build new file +18 -0
@@ -0,0 +1,18 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2023 Mucse IC Design Ltd. +# +if not is_linux + build = false + reason = 'only supported on Linux' + subdir_done() +endif + +if arch_subdir == 'riscv' + build = false + reason = 'not supported on RISC-V' + subdir_done() +endif + +sources = files( + 'rnp_ethdev.c', +)
drivers/net/rnp/rnp_ethdev.c new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/
Signature · 1 line
2.34.1
PATCH v11 2/28 net/rnp: add ethdev probe and remove
In reply to a message not in the archiveAdd basic PCIe ethdev probe and remove.
--- drivers/net/rnp/rnp.h | 13 +++++++ drivers/net/rnp/rnp_ethdev.c | 74 ++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 drivers/net/rnp/rnp.h
drivers/net/rnp/rnp.h new file +13 -0
@@ -0,0 +1,13 @@ +/* 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 (0x1000) + +struct rnp_eth_port { +}; + +#endif /* __RNP_H__ */
drivers/net/rnp/rnp_ethdev.c +74 -0
77 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v11 3/28 net/rnp: add log
In reply to a message not in the archiveadd 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
@@ -72,6 +72,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.34.1
PATCH v11 4/28 net/rnp: support mailbox basic operate
In reply to a message not in the archiveThis 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 | 11 + drivers/net/rnp/base/rnp_hw.h | 76 +++++ drivers/net/rnp/base/rnp_mbx.c | 512 +++++++++++++++++++++++++++++++ drivers/net/rnp/base/rnp_mbx.h | 58 ++++ drivers/net/rnp/base/rnp_osdep.h | 51 +++ drivers/net/rnp/meson.build | 5 + drivers/net/rnp/rnp.h | 19 ++ 7 files changed, 732 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 +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2023 Mucse IC Design Ltd. + +sources = [ + 'rnp_mbx.c', +] + +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 +76 -0
76 lines not on this page · raw message
drivers/net/rnp/base/rnp_mbx.c new file +512 -0
512 lines not on this page · raw message
drivers/net/rnp/base/rnp_mbx.h new file +58 -0
58 lines not on this page · raw message
drivers/net/rnp/base/rnp_osdep.h new file +51 -0
51 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
@@ -4,10 +4,29 @@#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 (0x1000) +#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.34.1
PATCH v11 5/28 net/rnp: add device init and uninit
In reply to a message not in the archiveadd firmware communic method and basic device
init, uninit and close resource function.
--- 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 | 338 ++++++++++++++++++++++++++++ drivers/net/rnp/base/rnp_mbx_fw.h | 18 ++ drivers/net/rnp/base/rnp_osdep.h | 87 +++++++ drivers/net/rnp/meson.build | 1 + drivers/net/rnp/rnp.h | 40 ++++ drivers/net/rnp/rnp_ethdev.c | 318 +++++++++++++++++++++++++- 16 files changed, 1283 insertions(+), 8 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
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', ] base_lib = static_library('rnp_base', sources,
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
@@ -6,6 +6,8 @@#include "rnp_osdep.h" +#define RNP_MAX_PORT_OF_PF (4) +struct rnp_hw ;/* Mailbox Operate Info */ enum RNP_MBX_ID {
@@ -55,7 +57,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 {
@@ -69,8 +98,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_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 +338 -0
338 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 +87 -0
115 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 +40 -0
@@ -13,20 +13,60 @@#define RNP_DEV_ID_N10G (0x1000)#define RNP_MAX_VF_NUM (64)#define RNP_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET +/* maximum frame size supported */ +#define RNP_MAC_MAXFRM_SIZE (9590) + +struct rnp_port_attr { +uint16_t max_mac_addrs;/* max support mac address */ +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 */ +uint16_t nr_lane;/* phy lane of This PF:0~3 */ +};struct rnp_proc_priv { +const struct rnp_mac_ops *mac_ops;const struct rnp_mbx_ops *mbx_ops; };struct rnp_eth_port { +struct rnp_proc_priv *proc_priv; +struct rte_ether_addr mac_addr; +struct rte_eth_dev *eth_dev; +struct rnp_port_attr attr; +struct rnp_hw *hw; };struct rnp_eth_adapter {struct rnp_hw hw; +struct rte_pci_device *pdev;struct rte_eth_dev *eth_dev;/* alloc eth_dev by platform */ + +struct rnp_eth_port *ports[RNP_MAX_PORT_OF_PF ]; +uint16_t closed_ports; +uint16_t inited_ports; +bool intr_registered; }; +#define RNP_DEV_TO_PORT (eth_dev) \ + ((struct rnp_eth_port *)(eth_dev)->data->dev_private) +#define RNP_DEV_TO_ADAPTER (eth_dev) \ + ((struct rnp_eth_adapter *)(RNP_DEV_TO_PORT(eth_dev))->hw->back)#define RNP_DEV_TO_PROC_PRIV (eth_dev) \ ((struct rnp_proc_priv *)(eth_dev)->process_private) +#define RNP_DEV_PP_TO_MBX_OPS (priv) \ + (((RNP_DEV_TO_PROC_PRIV(priv))->mbx_ops)) +#define RNP_DEV_PP_TO_MAC_OPS (priv) \ + (((RNP_DEV_TO_PROC_PRIV(priv))->mac_ops)) + +#define RNP_PF_OWN_PORTS (id) (((id) == 0) ? 1 : (((id) == 1) ? 2 : 4)) + +static inline int +rnp_pf_is_multiple_ports (uint32_t device_id) +{ +uint32_t verbit = (device_id >>5 ) &0x3 ; + +return RNP_PF_OWN_PORTS (verbit) ==1 ?0 :1 ; +}#endif /* __RNP_H__ */
drivers/net/rnp/rnp_ethdev.c +310 -8
349 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v11 6/28 net/rnp: add get device information operation
In reply to a message not in the archiveadd get device hardware capability function
--- doc/guides/nics/features/rnp.ini | 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 | 58 ++++++++++++++++ drivers/net/rnp/base/rnp_mbx_fw.h | 1 + drivers/net/rnp/rnp.h | 73 ++++++++++++++++++- drivers/net/rnp/rnp_ethdev.c | 112 +++++++++++++++++++++++++++++- 7 files changed, 343 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
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 +58 -0
61 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 +111 -1
134 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v11 7/28 net/rnp: add support MAC promisc mode
In reply to a message not in the archiveadd support two method of MAC unicast promisc
mulcast promisc broadcast promisc mode
--- doc/guides/nics/features/rnp.ini | 2 + doc/guides/nics/rnp.rst | 5 ++ drivers/net/rnp/base/rnp_common.c | 5 ++ drivers/net/rnp/base/rnp_eth_regs.h | 15 ++++ drivers/net/rnp/base/rnp_hw.h | 12 ++- drivers/net/rnp/base/rnp_mac.c | 114 +++++++++++++++++++++++++++- 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, 240 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 +5 -0
@@ -7,6 +7,11 @@ RNP Poll Mode driver The RNP ETHDEV PMD (**librte_net_rnp**) provides poll mode ethdev driver support for the inbuilt network device found in the **Mucse RNP** +Features +-------- + +- Promiscuous mode + Prerequisites ------------- More information can be found at `Mucse, Official Website
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 +11 -1
@@ -59,9 +59,18 @@ struct rnp_mbx_info {struct rnp_eth_port ;/* mac operations */ +enum rnp_mpf_modes { +RNP_MPF_MODE_NONE =0 , +RNP_MPF_MODE_MULTI ,/* Multitle Filter */ +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 ;
@@ -91,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 +113 -1
132 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
@@ -45,6 +45,7 @@ typedef rte_iova_t dma_addr_t;#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
@@ -134,5 +135,9 @@ rnp_dma_mem_free(__rte_unused struct rnp_hw *hw,#define RNP_REG_WR (base, offset, value) rnp_reg_write32(base, offset, value)#define RNP_E_REG_WR (hw, off, value) rnp_reg_write32((hw)->e_ctrl, (off), (value))#define RNP_E_REG_RD (hw, off) rnp_reg_read32((hw)->e_ctrl, (off)) +#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.34.1
PATCH v11 8/28 net/rnp: add queue setup and release operations
In reply to a message not in the archivesupport tx/rx queue setup and release add hw bd
queue reset,sw queue reset.
--- doc/guides/nics/rnp.rst | 1 + 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 | 3 + drivers/net/rnp/base/rnp_osdep.h | 13 + 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, 1252 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 +1 -0
@@ -10,6 +10,7 @@ driver support for the inbuilt network device found in the **Mucse RNP** Features -------- +- Multiple queues for TX and RX - Promiscuous mode Prerequisites
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', ] base_lib = static_library('rnp_base', sources,
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 +3 -0
@@ -120,6 +120,9 @@ 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_H__*/
drivers/net/rnp/base/rnp_osdep.h +13 -0
@@ -33,16 +33,29 @@ typedef rte_iova_t dma_addr_t;#define mb () rte_mb()#define wmb () rte_wmb() +#define rmb () rte_rmb() +#define ffs (x) ({ unsigned long __t = (x); rte_fls_u32(__t & -__t); })#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
@@ -105,6 +105,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; };
@@ -113,6 +114,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)
@@ -176,7 +177,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 ,
@@ -237,6 +245,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
@@ -329,6 +342,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) {
@@ -424,6 +457,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.34.1
PATCH v11 9/28 net/rnp: add queue stop and start operations
In reply to a message not in the archivesupport 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 + drivers/net/rnp/base/rnp_common.c | 3 + drivers/net/rnp/rnp_link.c | 340 ++++++++++++++++++++++++++++++ drivers/net/rnp/rnp_link.h | 36 ++++ drivers/net/rnp/rnp_rxtx.c | 167 +++++++++++++++ drivers/net/rnp/rnp_rxtx.h | 9 + 6 files changed, 556 insertions(+) create mode 100644 drivers/net/rnp/rnp_link.c create mode 100644 drivers/net/rnp/rnp_link.h
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
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_link.c new file +340 -0
340 lines not on this page · raw message
drivers/net/rnp/rnp_link.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(C) 2023 Mucse IC Design Ltd. +*/ + +#ifndef _RNP_LINK_H_ +#define _RNP_LINK_H_ + +#define RNP_DEVICE_LINK (0x3000c) +#define RNP_DEVICE_LINK_EX (0xa800 + 64 * 64 - 4) +#define RNP_LINK_NOCHANGED (lane_bit, change_lane) \ + (!((RTE_BIT32(lane_bit)) & (change_lane))) +#define RNP_LINK_DUPLEX_ATTR_EN (0xA0000000) +#define RNP_SPEED_META_VALID (magic) (!!(magic) == 0xA0000000) +#define RNP_LINK_STATE (n) RTE_BIT32(n) +#define RNP_LINK_SPEED_CODE (sp, n) \ + (((sp) & RTE_GENMASK32((11) + ((4) * (n)), \ + (8) + ((4) * (n)))) >> (8 + 4 * (n))) +#define RNP_LINK_DUPLEX_STATE (sp, n) ((sp) & RTE_BIT32((24) + (n))) +#define RNP_ALARM_INTERVAL (50000)/* unit us */ +enum rnp_lane_speed { +RNP_LANE_SPEED_10M =0 , +RNP_LANE_SPEED_100M , +RNP_LANE_SPEED_1G , +RNP_LANE_SPEED_10G , +RNP_LANE_SPEED_25G , +RNP_LANE_SPEED_40G , +}; + +void rnp_link_event (struct rnp_eth_adapter *adapter, +struct rnp_mbx_fw_cmd_req *req); +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); + +#endif /* _RNP_LINK_H_ */
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.34.1
PATCH v11 10/28 net/rnp: add support device start stop operations
In reply to a message not in the archiveadd basic support for device to start/stop function
--- 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 | 274 +++++++++++++++++++++++++++- 9 files changed, 371 insertions(+), 1 deletion(-)
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
@@ -107,6 +107,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 +273 -1
306 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v11 11/28 net/rnp: add RSS support operations
In reply to a message not in the archiveadd 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 | 3 + 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 | 43 ++++ 8 files changed, 464 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 +3 -0
@@ -11,6 +11,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
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
@@ -108,6 +108,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);
@@ -504,6 +521,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,
@@ -519,6 +537,11 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .rx_queue_release = rnp_dev_rx_queue_release, .tx_queue_setup = rnp_tx_queue_setup, .tx_queue_release = rnp_dev_tx_queue_release, +/* 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 +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v11 12/28 net/rnp: add support link update operations
In reply to a message not in the archiveThis patch add support poll/irq link get mode.
--- doc/guides/nics/features/rnp.ini | 2 + doc/guides/nics/rnp.rst | 1 + 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 | 1 + 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 | 117 ++++++++++++++++++++++++++++-- drivers/net/rnp/rnp_link.h | 2 +- 11 files changed, 304 insertions(+), 8 deletions(-)
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 +1 -0
@@ -15,6 +15,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 -------------
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 +1 -0
@@ -124,6 +124,7 @@ struct rnp_hw {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_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
@@ -89,6 +89,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 */
@@ -119,6 +124,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;
@@ -126,6 +137,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 +111 -6
199 lines not on this page · raw message
drivers/net/rnp/rnp_link.h +1 -1
@@ -10,7 +10,7 @@#define RNP_LINK_NOCHANGED (lane_bit, change_lane) \ (!((RTE_BIT32(lane_bit)) & (change_lane)))#define RNP_LINK_DUPLEX_ATTR_EN (0xA0000000) -#define RNP_SPEED_META_VALID (magic) (!!(magic) == 0xA0000000) +#define RNP_SPEED_META_VALID (magic) (!!((magic) == 0xA0000000))#define RNP_LINK_STATE (n) RTE_BIT32(n)#define RNP_LINK_SPEED_CODE (sp, n) \ (((sp) & RTE_GENMASK32((11) + ((4) * (n)), \
Signature · 1 line
2.34.1
PATCH v11 13/28 net/rnp: add support link setup operations
In reply to a message not in the archiveadd set link_down/link_up implement
--- 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 | 4 ++ drivers/net/rnp/rnp_link.c | 99 +++++++++++++++++++++++++++++ drivers/net/rnp/rnp_link.h | 2 + 8 files changed, 170 insertions(+)
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
@@ -464,3 +464,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 +4 -0
@@ -326,6 +326,7 @@ static int rnp_dev_start(struct rte_eth_dev *eth_dev)rnp_mbx_fw_lane_link_event_en (port, lsc);if (!lsc)rnp_run_link_poll_task (port); +rnp_dev_set_link_up (eth_dev);/* enable eth rx flow */ RNP_RX_ETH_ENABLE (hw, lane); port->port_stopped =0 ;
@@ -411,6 +412,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);rnp_disable_all_tx_queue (eth_dev);rnp_disable_all_rx_queue (eth_dev);rnp_mac_tx_disable (eth_dev);
@@ -647,6 +649,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 +99 -0
102 lines not on this page · raw message
drivers/net/rnp/rnp_link.h +2 -0
@@ -32,5 +32,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.34.1
PATCH v11 14/28 net/rnp: add Rx burst simple support
In reply to a message not in the archiveadd only support simple recv pkts.
--- drivers/net/rnp/rnp_ethdev.c | 7 ++ drivers/net/rnp/rnp_rxtx.c | 129 +++++++++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.h | 5 ++ 3 files changed, 141 insertions(+)
drivers/net/rnp/rnp_ethdev.c +7 -0
@@ -329,6 +329,8 @@ static int rnp_dev_start(struct rte_eth_dev *eth_dev)rnp_dev_set_link_up (eth_dev);/* 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 ;
@@ -577,6 +579,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 +129 -0
132 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.34.1
PATCH v11 15/28 net/rnp: add Tx burst simple support
In reply to a message not in the archiveadd 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
@@ -588,6 +588,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.34.1
PATCH v11 16/28 net/rnp: add MTU set operation
In reply to a message not in the archiveadd 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 | 1 + drivers/net/rnp/base/rnp_eth_regs.h | 3 + drivers/net/rnp/rnp.h | 3 + drivers/net/rnp/rnp_ethdev.c | 148 +++++++++++++++++++++++++++- 5 files changed, 155 insertions(+), 1 deletion(-)
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 +1 -0
@@ -16,6 +16,7 @@ Features Inner RSS is only support for vxlan/nvgre - Promiscuous mode - Link state information +- MTU update Prerequisites -------------
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
@@ -120,6 +120,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 +147 -1
196 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v11 17/28 net/rnp: add Rx scatter segment version
In reply to a message not in the archiveadd support scatter multi segment received.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 2 + drivers/net/rnp/rnp_rxtx.c | 131 ++++++++++++++++++++++++++++++- drivers/net/rnp/rnp_rxtx.h | 2 + 4 files changed, 134 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
@@ -17,6 +17,8 @@ Features - Promiscuous mode - Link state information - MTU update +- Jumbo frames +- Scatter-Gather IO support Prerequisites -------------
drivers/net/rnp/rnp_rxtx.c +129 -2
145 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.34.1
PATCH v11 18/28 net/rnp: add Tx multiple segment version
In reply to a message not in the archiveadd support multiple segs mbuf send.
--- drivers/net/rnp/rnp_rxtx.c | 126 ++++++++++++++++++++++++++++++++++++- drivers/net/rnp/rnp_rxtx.h | 3 +- 2 files changed, 126 insertions(+), 3 deletions(-)
drivers/net/rnp/rnp_rxtx.c +124 -2
@@ -369,9 +369,11 @@ rnp_tx_queue_sw_reset(struct rnp_tx_queue *txq) sw_ring[prev].next_id = idx; prev = idx; } + txq->last_desc_cleaned = txq->attr.nb_desc -1 ; txq->nb_tx_free = txq->attr.nb_desc -1 ; txq->tx_next_dd = txq->tx_rs_thresh -1 ; txq->tx_next_rs = txq->tx_rs_thresh -1 ; + txq->nb_tx_used =0 ; txq->tx_tail =0 ; size = (txq->attr.nb_desc +RNP_TX_MAX_BURST_SIZE );
@@ -855,6 +857,7 @@ rnp_rxq_bulk_alloc(struct rnp_rx_queue *rxq, rxe->mbuf = nmb; rxbd->d.pkt_addr =rnp_get_dma_addr (&rxq->attr, nmb); } + rxq->rxrearm_nb++;if (rxq->rxrearm_nb > rxq->rx_free_thresh) { rxq->rxrearm_nb -= rxq->rx_free_thresh; rxq->rxrearm_start += rxq->rx_free_thresh;
@@ -922,7 +925,6 @@ rnp_scattered_rx(void *rx_queue, struct rte_mbuf **rx_pkts, first_seg->nb_segs++; last_seg->next = rxm; } - rxq->rxrearm_nb++;if (!(rx_status &rte_cpu_to_le_16 (RNP_CMD_EOP ))) { last_seg = rxm;continue ;
@@ -945,6 +947,106 @@ rnp_scattered_rx(void *rx_queue, struct rte_mbuf **rx_pkts,return nb_rx; } +static __rte_always_inline uint16_t +rnp_multiseg_clean_txq (struct rnp_tx_queue *txq) +{ +uint16_t last_desc_cleaned = txq->last_desc_cleaned; +struct rnp_txsw_entry *sw_ring = txq->sw_ring; +volatile struct rnp_tx_desc *txbd; +uint16_t desc_to_clean_to; +uint16_t nb_tx_to_clean; + + desc_to_clean_to = (uint16_t )(last_desc_cleaned + txq->tx_rs_thresh); + desc_to_clean_to = desc_to_clean_to & (txq->attr.nb_desc -1 ); + + desc_to_clean_to = sw_ring[desc_to_clean_to].last_id; + txbd = &txq->tx_bdr[desc_to_clean_to]; +if (!(txbd->d.cmd &RNP_CMD_DD )) +return txq->nb_tx_free; + +if (last_desc_cleaned > desc_to_clean_to) + nb_tx_to_clean = (uint16_t )((txq->attr.nb_desc - + last_desc_cleaned) + desc_to_clean_to); +else + nb_tx_to_clean = (uint16_t )(desc_to_clean_to - + last_desc_cleaned); + + txbd->d.cmd =0 ; + + txq->last_desc_cleaned = desc_to_clean_to; + txq->nb_tx_free = (uint16_t )(txq->nb_tx_free + nb_tx_to_clean); + +return txq->nb_tx_free; +} + +static __rte_always_inline uint16_t +rnp_multiseg_xmit_pkts (void *_txq,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) +{ +struct rnp_tx_queue *txq = (struct rnp_tx_queue *)_txq; +volatile struct rnp_tx_desc *txbd; +struct rnp_txsw_entry *txe, *txn; +struct rte_mbuf *tx_pkt, *m_seg; +uint16_t send_pkts =0 ; +uint16_t nb_used_bd; +uint16_t tx_last; +uint16_t nb_tx; +uint16_t tx_id; + +if (unlikely (!txq->txq_started || !txq->tx_link)) +return 0 ; +if (txq->nb_tx_free < txq->tx_free_thresh) +rnp_multiseg_clean_txq (txq); +if (unlikely (txq->nb_tx_free ==0 )) +return 0 ; + tx_id = txq->tx_tail; + txbd = &txq->tx_bdr[tx_id]; + txe = &txq->sw_ring[tx_id]; +for (nb_tx =0 ; nb_tx < nb_pkts; nb_tx++) { + tx_pkt = tx_pkts[nb_tx]; + nb_used_bd = tx_pkt->nb_segs; + tx_last = (uint16_t )(tx_id + nb_used_bd -1 ); +if (tx_last >= txq->attr.nb_desc) + tx_last = (uint16_t )(tx_last - txq->attr.nb_desc); +if (nb_used_bd > txq->nb_tx_free) +if (nb_used_bd >rnp_multiseg_clean_txq (txq)) +break ; + m_seg = tx_pkt; +do { + txbd = &txq->tx_bdr[tx_id]; + txn = &txq->sw_ring[txe->next_id]; +if (txe->mbuf) { +rte_pktmbuf_free_seg (txe->mbuf); + txe->mbuf =NULL ; + } + txe->mbuf = m_seg; + txe->last_id = tx_last; + txbd->d.addr =rnp_get_dma_addr (&txq->attr, m_seg); + txbd->d.blen =rte_cpu_to_le_32 (m_seg->data_len); + txbd->d.cmd &= ~RNP_CMD_EOP ; + txbd->d.cmd |=RNP_DATA_DESC ; + m_seg = m_seg->next; + tx_id = txe->next_id; + txe = txn; + }while (m_seg !=NULL ); + 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; +if (txq->nb_tx_used >= txq->tx_rs_thresh) { + txq->nb_tx_used =0 ; + txbd->d.cmd |=RNP_CMD_RS ; + } + send_pkts++; + } +if (!send_pkts) +return 0 ; + txq->tx_tail = tx_id; + +rte_wmb (); +RNP_REG_WR (txq->tx_tailreg,0 , tx_id); + +return send_pkts; +} +static int rnp_check_rx_simple_valid (struct rte_eth_dev *dev) {
@@ -968,9 +1070,29 @@ int rnp_rx_func_select(struct rte_eth_dev *dev)return 0 ; } +static int +rnp_check_tx_simple_valid (struct rte_eth_dev *dev,struct rnp_tx_queue *txq) +{ +RTE_SET_USED (txq); +if (dev->data->scattered_rx) +return -ENOTSUP ; +return 0 ; +} +int rnp_tx_func_select (struct rte_eth_dev *dev) { - dev->tx_pkt_burst = rnp_xmit_simple; +bool simple_allowed = false; +struct rnp_tx_queue *txq; +int idx =0 ; + +for (idx =0 ; idx < dev->data->nb_tx_queues; idx++) { + txq = dev->data->tx_queues[idx]; + simple_allowed =rnp_check_tx_simple_valid (dev, txq) ==0 ; + } +if (simple_allowed) + dev->tx_pkt_burst = rnp_xmit_simple; +else + dev->tx_pkt_burst = rnp_multiseg_xmit_pkts; dev->tx_pkt_prepare = rte_eth_pkt_burst_dummy;return 0 ;
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.34.1
PATCH v11 19/28 net/rnp: add support basic stats operation
In reply to a message not in the archiveadd support hw-missed rx/tx packets bytes.
--- doc/guides/nics/features/rnp.ini | 2 + doc/guides/nics/rnp.rst | 1 + drivers/net/rnp/base/rnp_eth_regs.h | 3 + drivers/net/rnp/rnp.h | 10 +- drivers/net/rnp/rnp_ethdev.c | 147 ++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.c | 9 ++ drivers/net/rnp/rnp_rxtx.h | 10 ++ 7 files changed, 181 insertions(+), 1 deletion(-)
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 +1 -0
@@ -19,6 +19,7 @@ Features - MTU update - Jumbo frames - Scatter-Gather IO support +- Port hardware statistic Prerequisites -------------
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 +9 -1
@@ -10,7 +10,7 @@#include "base/rnp_hw.h" #define PCI_VENDOR_ID_MUCSE (0x8848) -#define RNP_DEV_ID_N10G (0x1000) +#define RNP_DEV_ID_N10G (0x1020)#define RNP_MAX_VF_NUM (64)#define RNP_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET/* maximum frame size supported */
@@ -105,6 +105,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;
@@ -113,6 +118,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 +147 -0
159 lines not on this page · raw message
drivers/net/rnp/rnp_rxtx.c +9 -0
@@ -736,6 +736,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;
@@ -747,6 +749,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;
@@ -816,6 +819,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;
@@ -827,6 +831,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 ();
@@ -931,6 +936,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));
@@ -939,6 +945,7 @@ rnp_scattered_rx(void *rx_queue, struct rte_mbuf **rx_pkts, }if (!nb_rx)return 0 ; + rxq->stats.ipackets += nb_rx;/* update sw record point */ rxq->rx_tail = rx_id; rxq->pkt_first_seg = first_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.34.1
PATCH v11 20/28 net/rnp: add support xstats operation
In reply to a message not in the archiveadd support mac eth rx tx hw xstats.
--- doc/guides/nics/features/rnp.ini | 1 + drivers/net/rnp/base/rnp_eth_regs.h | 3 + drivers/net/rnp/base/rnp_mac_regs.h | 80 +++++++++ drivers/net/rnp/rnp.h | 51 ++++++ drivers/net/rnp/rnp_ethdev.c | 243 ++++++++++++++++++++++++++++ 5 files changed, 378 insertions(+)
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
drivers/net/rnp/base/rnp_eth_regs.h +3 -0
@@ -25,6 +25,9 @@#define RNP_RING_FC_THRESH (n) _ETH_(0x8a00 + ((0x4) * (n)))/* ETH Statistic */ #define RNP_ETH_RXTRANS_DROP _ETH_(0x8904) +#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 +51 -0
63 lines not on this page · raw message
drivers/net/rnp/rnp_ethdev.c +243 -0
284 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v11 21/28 net/rnp: add unicast MAC filter operation
In reply to a message not in the archiveadd mac filter for single/multiple port.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 1 + 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 | 5 +- drivers/net/rnp/rnp.h | 4 ++ drivers/net/rnp/rnp_ethdev.c | 61 +++++++++++++++++-- 9 files changed, 166 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 +1 -0
@@ -17,6 +17,7 @@ Features - Promiscuous mode - Link state information - MTU update +- MAC filtering - Jumbo frames - Scatter-Gather IO support - Port hardware statistic
drivers/net/rnp/base/rnp_eth_regs.h +4 -0
@@ -63,5 +63,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,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 -1
@@ -77,7 +77,10 @@#define RNP_MAC_PLSDIS RTE_BIT32(18)/* 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
@@ -56,6 +56,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_UC_HASH_TB (8) +#define RNP_PORT_MAX_UC_MAC_SIZE (RNP_PORT_MAX_UC_HASH_TB * 32)/* hardware media type */ enum rnp_media_type {RNP_MEDIA_TYPE_UNKNOWN ,
drivers/net/rnp/rnp_ethdev.c +56 -5
85 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v11 22/28 net/rnp: add supported packet types
In reply to a message not in the archiveadd support parse hw packet types result.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 1 + drivers/net/rnp/base/rnp_bdq_if.h | 4 +++ drivers/net/rnp/rnp_rxtx.c | 45 +++++++++++++++++++++++++++++++ 4 files changed, 51 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 +1 -0
@@ -21,6 +21,7 @@ Features - Jumbo frames - Scatter-Gather IO support - Port hardware statistic +- Packet type parsing Prerequisites -------------
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_rxtx.c +45 -0
63 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v11 23/28 net/rnp: add support Rx checksum offload
In reply to a message not in the archiveAdd 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 | 64 +++++++++++++++++++ drivers/net/rnp/rnp_rxtx.c | 97 ++++++++++++++++++++++++++++- 6 files changed, 185 insertions(+), 1 deletion(-)
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
@@ -22,6 +22,7 @@ Features - Scatter-Gather IO support - Port hardware statistic - Packet type parsing +- Checksum offload Prerequisites -------------
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
@@ -42,6 +42,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 -0
82 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.34.1
PATCH v11 24/28 net/rnp: add support Tx TSO offload
In reply to a message not in the archiveAdd 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 | 16 ++ drivers/net/rnp/rnp_rxtx.c | 457 +++++++++++++++++++++++++++++- drivers/net/rnp/rnp_rxtx.h | 1 + 7 files changed, 473 insertions(+), 6 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
@@ -23,6 +23,7 @@ Features - Port hardware statistic - Packet type parsing - Checksum offload +- TSO offload Prerequisites -------------
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
@@ -17,7 +17,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 +16 -0
@@ -652,6 +652,17 @@ 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 =RNP_RX_CHECKSUM_SUPPORT ; +/* tx support offload cap */ + 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 ;
@@ -1097,13 +1108,18 @@ rnp_dev_stats_get(struct rte_eth_dev *dev, (data->tx_queues))[i]->stats.opackets; stats->q_obytes[i] = ((struct rnp_tx_queue **) (data->tx_queues))[i]->stats.obytes; + stats->oerrors += ((struct rnp_tx_queue **) + (data->tx_queues))[i]->stats.errors; stats->opackets += stats->q_opackets[i]; stats->obytes += stats->q_obytes[i]; + }else { stats->opackets += ((struct rnp_tx_queue **) (data->tx_queues))[i]->stats.opackets; stats->obytes += ((struct rnp_tx_queue **) (data->tx_queues))[i]->stats.obytes; + stats->oerrors += ((struct rnp_tx_queue **) + (data->tx_queues))[i]->stats.errors; } } stats->imissed = eth_stats->rx_trans_drop + eth_stats->rx_trunc_drop;
drivers/net/rnp/rnp_rxtx.c +452 -5
507 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.34.1
PATCH v11 25/28 net/rnp: support VLAN offloads
In reply to a message not in the archiveadd support rx vlan strip,filter,tx vlan/qinq insert.
--- doc/guides/nics/features/rnp.ini | 2 + doc/guides/nics/rnp.rst | 1 + 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 | 176 +++++++++++++++++++++++++++- drivers/net/rnp/rnp_rxtx.c | 22 +++- 11 files changed, 305 insertions(+), 7 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 +1 -0
@@ -24,6 +24,7 @@ Features - Packet type parsing - Checksum offload - TSO offload +- VLAN stripping and VLAN/QINQ insertion Prerequisites -------------
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
@@ -56,6 +56,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,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
@@ -171,6 +171,11 @@ struct rnp_hw_mac_stats {uint64_t tx_bad_pkts; }; +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;
@@ -193,6 +198,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 +174 -2
217 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 ) {
@@ -1316,6 +1329,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.34.1
PATCH v11 26/28 net/rnp: add support VLAN filters operations
In reply to a message not in the archiveadd support to update vid for vlan filter.
--- doc/guides/nics/features/rnp.ini | 1 + doc/guides/nics/rnp.rst | 2 +- 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 | 84 +++++++++++++++++++++++++++++ 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, 242 insertions(+), 1 deletion(-) 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 +1 -1
@@ -17,7 +17,7 @@ Features - Promiscuous mode - Link state information - MTU update -- MAC filtering +- MAC/VLAN filtering - Jumbo frames - Scatter-Gather IO support - Port hardware statistic
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', ] base_lib = static_library('rnp_base', sources,
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
@@ -61,6 +61,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 +84 -0
114 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
@@ -50,6 +50,19 @@ typedef rte_iova_t dma_addr_t;#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
@@ -63,6 +63,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_UC_HASH_TB (8)
@@ -176,6 +177,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;
@@ -200,6 +210,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
@@ -393,6 +393,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);
@@ -814,6 +823,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_VLAN_EXTEND ; dev_info->rx_offload_capa |= dev_info->rx_queue_offload_capa;/* tx support offload cap */
@@ -1491,6 +1501,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, }; static void
Signature · 1 line
2.34.1
PATCH v11 27/28 net/rnp: add queue info operation
In reply to a message not in the archiveadd support get queue configure info for user debug
--- drivers/net/rnp/rnp_ethdev.c | 2 ++ drivers/net/rnp/rnp_rxtx.c | 42 ++++++++++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.h | 4 ++++ 3 files changed, 48 insertions(+)
drivers/net/rnp/rnp_ethdev.c +2 -0
@@ -1479,6 +1479,8 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .rx_queue_release = rnp_dev_rx_queue_release, .tx_queue_setup = rnp_tx_queue_setup, .tx_queue_release = rnp_dev_tx_queue_release, + .rxq_info_get = rnp_rx_queue_info_get, + .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.34.1
PATCH v11 28/28 net/rnp: support Rx/Tx burst mode info
In reply to a message not in the archiveadd platform method for get rx/tx burst function select by upload func name.
--- drivers/net/rnp/rnp_ethdev.c | 2 ++ drivers/net/rnp/rnp_rxtx.c | 58 ++++++++++++++++++++++++++++++++++++ drivers/net/rnp/rnp_rxtx.h | 6 ++++ 3 files changed, 66 insertions(+)
drivers/net/rnp/rnp_ethdev.c +2 -0
@@ -1481,6 +1481,8 @@ static const struct eth_dev_ops rnp_eth_dev_ops = { .tx_queue_release = rnp_dev_tx_queue_release, .rxq_info_get = rnp_rx_queue_info_get, .txq_info_get = rnp_tx_queue_info_get, + .rx_burst_mode_get = rnp_rx_burst_mode_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.34.1