Net/SPNIC: support SPNIC into DPDK 22.03
Subsystems (2)
v6 cover Net/SPNIC: support SPNIC into DPDK 22.03
The patchsets introduce SPNIC driver for Ramaxel's SPNxx serial NIC cards into DPDK 22.03. Ramaxel Memory Technology is a company which supply a lot of electric products:
storage, communication, PCB...
SPNxxx is a serial PCIE interface NIC cards:
SPN110: 2 PORTs *25G
SPN120: 4 PORTs *25G
SPN130: 2 PORTs *100G
The following is main features of our SPNIC:
- TSO
- LRO
- Flow control
- SR-IOV(Partially supported)
- VLAN offload
- VLAN filter
- CRC offload
- Promiscuous mode
- RSS
v6->v5, No real changes:
1. Move the fix of RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS from patch 26 to patch 2;
2. Change the description of patch 26.
v5->v4:
1. Add prefix "spinc_" for external functions;
2. Remove temporary MACRO: RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS
3. Do not use void* for keeping the type information
v3->v4:
1. Fix ABI test failure;
2. Remove some descriptions in spnic.rst.
v2->v3:
1. Fix clang compiling failure.
v1->v2:
1. Fix coding style issues and compiling failures;
2. Only support linux in meson.build;
3. Use CLOCK_MONOTONIC_COARSE instead of CLOCK_MONOTONIC/CLOCK_MONOTONIC_RAW;
4. Fix time_before();
5. Remove redundant checks in spnic_dev_configure();
Yanling Song (26):
drivers/net: introduce a new PMD driver net/spnic: initialize the HW interface net/spnic: add mbox message channel
net/spnic: introduce event queue
net/spnic: add mgmt module
net/spnic: add cmdq and work queue
net/spnic: add interface handling cmdq message net/spnic: add hardware info initialization net/spnic: support MAC and link event handling net/spnic: add function info initialization net/spnic: add queue pairs context initialization net/spnic: support mbuf handling of Tx/Rx net/spnic: support Rx congfiguration
net/spnic: add port/vport enable
net/spnic: support IO packets handling net/spnic: add device configure/version/info net/spnic: support RSS configuration update and get net/spnic: support VLAN filtering and offloading net/spnic: support promiscuous and allmulticast Rx modes net/spnic: support flow control
net/spnic: support getting Tx/Rx queues info net/spnic: net/spnic: support xstats statistics net/spnic: support VFIO interrupt
net/spnic: support Tx/Rx queue start/stop net/spnic: add doc infrastructure
net/spnic: fixes unsafe C style code
MAINTAINERS | 6 + doc/guides/nics/features/spnic.ini | 39 + doc/guides/nics/index.rst | 1 + doc/guides/nics/spnic.rst | 55 + drivers/net/meson.build | 1 + drivers/net/spnic/base/meson.build | 37 + drivers/net/spnic/base/spnic_cmd.h | 222 ++ drivers/net/spnic/base/spnic_cmdq.c | 875 ++++++ drivers/net/spnic/base/spnic_cmdq.h | 248 ++ drivers/net/spnic/base/spnic_compat.h | 184 ++ drivers/net/spnic/base/spnic_csr.h | 104 + drivers/net/spnic/base/spnic_eqs.c | 661 +++++ drivers/net/spnic/base/spnic_eqs.h | 102 + drivers/net/spnic/base/spnic_hw_cfg.c | 201 ++ drivers/net/spnic/base/spnic_hw_cfg.h | 125 + drivers/net/spnic/base/spnic_hw_comm.c | 483 ++++ drivers/net/spnic/base/spnic_hw_comm.h | 204 ++ drivers/net/spnic/base/spnic_hwdev.c | 514 ++++ drivers/net/spnic/base/spnic_hwdev.h | 143 + drivers/net/spnic/base/spnic_hwif.c | 770 ++++++ drivers/net/spnic/base/spnic_hwif.h | 155 ++ drivers/net/spnic/base/spnic_mbox.c | 1194 ++++++++ drivers/net/spnic/base/spnic_mbox.h | 202 ++ drivers/net/spnic/base/spnic_mgmt.c | 366 +++ drivers/net/spnic/base/spnic_mgmt.h | 110 + drivers/net/spnic/base/spnic_nic_cfg.c | 1348 +++++++++ drivers/net/spnic/base/spnic_nic_cfg.h | 1110 ++++++++ drivers/net/spnic/base/spnic_nic_event.c | 183 ++ drivers/net/spnic/base/spnic_nic_event.h | 24 + drivers/net/spnic/base/spnic_wq.c | 138 + drivers/net/spnic/base/spnic_wq.h | 123 + drivers/net/spnic/meson.build | 20 + drivers/net/spnic/spnic_ethdev.c | 3211 ++++++++++++++++++++++ drivers/net/spnic/spnic_ethdev.h | 95 + drivers/net/spnic/spnic_io.c | 728 +++++ drivers/net/spnic/spnic_io.h | 154 ++ drivers/net/spnic/spnic_rx.c | 937 +++++++ drivers/net/spnic/spnic_rx.h | 326 +++ drivers/net/spnic/spnic_tx.c | 858 ++++++ drivers/net/spnic/spnic_tx.h | 297 ++ drivers/net/spnic/version.map | 3 + 41 files changed, 16557 insertions(+) create mode 100644 doc/guides/nics/features/spnic.ini create mode 100644 doc/guides/nics/spnic.rst create mode 100644 drivers/net/spnic/base/meson.build create mode 100644 drivers/net/spnic/base/spnic_cmd.h create mode 100644 drivers/net/spnic/base/spnic_cmdq.c create mode 100644 drivers/net/spnic/base/spnic_cmdq.h create mode 100644 drivers/net/spnic/base/spnic_compat.h create mode 100644 drivers/net/spnic/base/spnic_csr.h create mode 100644 drivers/net/spnic/base/spnic_eqs.c create mode 100644 drivers/net/spnic/base/spnic_eqs.h create mode 100644 drivers/net/spnic/base/spnic_hw_cfg.c create mode 100644 drivers/net/spnic/base/spnic_hw_cfg.h create mode 100644 drivers/net/spnic/base/spnic_hw_comm.c create mode 100644 drivers/net/spnic/base/spnic_hw_comm.h create mode 100644 drivers/net/spnic/base/spnic_hwdev.c create mode 100644 drivers/net/spnic/base/spnic_hwdev.h create mode 100644 drivers/net/spnic/base/spnic_hwif.c create mode 100644 drivers/net/spnic/base/spnic_hwif.h create mode 100644 drivers/net/spnic/base/spnic_mbox.c create mode 100644 drivers/net/spnic/base/spnic_mbox.h create mode 100644 drivers/net/spnic/base/spnic_mgmt.c create mode 100644 drivers/net/spnic/base/spnic_mgmt.h create mode 100644 drivers/net/spnic/base/spnic_nic_cfg.c create mode 100644 drivers/net/spnic/base/spnic_nic_cfg.h create mode 100644 drivers/net/spnic/base/spnic_nic_event.c create mode 100644 drivers/net/spnic/base/spnic_nic_event.h create mode 100644 drivers/net/spnic/base/spnic_wq.c create mode 100644 drivers/net/spnic/base/spnic_wq.h create mode 100644 drivers/net/spnic/meson.build create mode 100644 drivers/net/spnic/spnic_ethdev.c create mode 100644 drivers/net/spnic/spnic_ethdev.h create mode 100644 drivers/net/spnic/spnic_io.c create mode 100644 drivers/net/spnic/spnic_io.h create mode 100644 drivers/net/spnic/spnic_rx.c create mode 100644 drivers/net/spnic/spnic_rx.h create mode 100644 drivers/net/spnic/spnic_tx.c create mode 100644 drivers/net/spnic/spnic_tx.h create mode 100644 drivers/net/spnic/version.map
Signature · 1 line
2.32.0
PATCH v6 1/26 drivers/net: introduce a new PMD driver
Introduce a new PMD driver which names spnic.
Now, this driver only implements module entry
without doing anything else.
--- drivers/net/meson.build | 1 + drivers/net/spnic/base/meson.build | 26 ++++ drivers/net/spnic/base/spnic_compat.h | 184 ++++++++++++++++++++++++++ drivers/net/spnic/meson.build | 17 +++ drivers/net/spnic/spnic_ethdev.c | 107 +++++++++++++++ drivers/net/spnic/spnic_ethdev.h | 28 ++++ drivers/net/spnic/version.map | 3 + 7 files changed, 366 insertions(+) create mode 100644 drivers/net/spnic/base/meson.build create mode 100644 drivers/net/spnic/base/spnic_compat.h create mode 100644 drivers/net/spnic/meson.build create mode 100644 drivers/net/spnic/spnic_ethdev.c create mode 100644 drivers/net/spnic/spnic_ethdev.h create mode 100644 drivers/net/spnic/version.map
drivers/net/meson.build +1 -0
@@ -53,6 +53,7 @@ drivers = [ 'ring', 'sfc', 'softnic', + 'spnic', 'tap', 'thunderx', 'txgbe',
drivers/net/spnic/base/meson.build new file +26 -0
@@ -0,0 +1,26 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2021 Ramaxel Memory Technology, Ltd + +sources = [ +] + +extra_flags = [] +# The driver runs only on arch64 machine, remove 32bit warnings +if not dpdk_conf.get('RTE_ARCH_64') + extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast'] +endif + +foreach flag: extra_flags + if cc.has_argument(flag) + cflags += flag + endif +endforeach + +deps += ['hash'] +cflags += ['-DHW_CONVERT_ENDIAN'] +c_args = cflags + +base_lib = static_library('spnic_base', sources, + dependencies: [static_rte_eal, static_rte_ethdev, static_rte_bus_pci, static_rte_hash], + c_args: c_args) +base_objs = base_lib.extract_all_objects()
drivers/net/spnic/base/spnic_compat.h new file +184 -0
184 lines not on this page · raw message
drivers/net/spnic/meson.build new file +17 -0
@@ -0,0 +1,17 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2021 Ramaxel Memory Technology, Ltd + +if not (is_linux) + build = false + reason = 'only supported on Linux' + subdir_done() +endif + +subdir('base') +objs = [base_objs] + +sources = files( + 'spnic_ethdev.c', + ) + +includes += include_directories('base')
drivers/net/spnic/spnic_ethdev.c new file +107 -0
107 lines not on this page · raw message
drivers/net/spnic/spnic_ethdev.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2021 Ramaxel Memory Technology, Ltd +*/ + +#ifndef _SPNIC_ETHDEV_H_ +#define _SPNIC_ETHDEV_H_ + +/* Vendor id */ +#define PCI_VENDOR_ID_RAMAXEL 0x1E81 + +/* Device ids */ +#define SPNIC_DEV_ID_PF 0x9020 +#define SPNIC_DEV_ID_VF 0x9001 + +enum spnic_dev_status { +SPNIC_DEV_INIT +}; + +#define SPNIC_DEV_NAME_LEN 32 +struct spnic_nic_dev { +u32 dev_status; +char dev_name[SPNIC_DEV_NAME_LEN ]; +}; + +#define SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev) \ + ((struct spnic_nic_dev *)(dev)->data->dev_private) + +#endif /* _SPNIC_ETHDEV_H_ */
drivers/net/spnic/version.map new file +3 -0
@@ -0,0 +1,3 @@ +DPDK_22 { + local: *; +};
Signature · 1 line
2.32.0
Re: [PATCH v6 01/26] drivers/net: introduce a new PMD driver
Quoted 1 line · Yanling Song
Introduce a new PMD driver which names spnic.
PMD stands for "Poll mode driver", so "PMD driver" usage is wrong, can you please update it in the patch title too?
Also domain for patch title can be "net/spnic: ".
Quoted 13 lines
Now, this driver only implements module entry
without doing anything else.Signed-off-by Yanling Song <[email protected]>--- drivers/net/meson.build | 1 + drivers/net/spnic/base/meson.build | 26 ++++ drivers/net/spnic/base/spnic_compat.h | 184 ++++++++++++++++++++++++++ drivers/net/spnic/meson.build | 17 +++ drivers/net/spnic/spnic_ethdev.c | 107 +++++++++++++++ drivers/net/spnic/spnic_ethdev.h | 28 ++++ drivers/net/spnic/version.map | 3 + 7 files changed, 366 insertions(+)
Quoted 6 lines
create mode 100644
drivers/net/spnic/base/meson.buildcreate mode 100644drivers/net/spnic/base/spnic_compat.hcreate mode 100644drivers/net/spnic/meson.buildcreate mode 100644drivers/net/spnic/spnic_ethdev.ccreate mode 100644drivers/net/spnic/spnic_ethdev.hcreate mode 100644drivers/net/spnic/version.map
Can you please add/update following files in this first patch:
- MAINTAINERS (sorted by vendor name)
- doc/guides/nics/spnic.rst
- doc/guides/nics/features/spnic.ini
- doc/guides/nics/index.rst
- doc/guides/rel_notes/release_22_03.rst
Most of them are already in the patch 25/26, so please squash it in this patch, and I put some comment on the documentation.
drivers/net/meson.build drivers = [ · line 56
Quoted 10 lines
drivers/net/meson.build +1
-0@@ -53,6 +53,7 @@ drivers = [ 'ring', 'sfc', 'softnic', + 'spnic',
The indentation in the meson files needs to be fixed, please run 'check-meson.py' Comment is valid for all meson file updates in other patches.
$ ./devtools/check-meson.py Error parsing drivers/net/meson.build:54, got some tabulation Error: Incorrect indent at drivers/net/meson.build:55 Error parsing drivers/net/spnic/meson.build:13, got some tabulation Error: Incorrect indent at drivers/net/spnic/meson.build:14 Error parsing drivers/net/spnic/meson.build:14, got some tabulation Error parsing drivers/net/spnic/base/meson.build:23, got some tabulation Error parsing drivers/net/spnic/base/meson.build:24, got some tabulation
Quoted 10 lines
drivers/net/meson.build +0
-0'tap', 'thunderx', 'txgbe',drivers/net/spnic/base/meson.build new file +1
-0@@ -0,0 +1,26 @@ +# SPDX-License-Identifier: BSD-3-Clause
drivers/net/spnic/base/meson.build line 11
Quoted 10 lines
drivers/net/spnic/base/meson.build new file +10
-0+# Copyright(c) 2021 Ramaxel Memory Technology, Ltd + +sources = [ +] + +extra_flags = [] +# The driver runs only on arch64 machine, remove 32bit warnings +if not dpdk_conf.get('RTE_ARCH_64') + extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast'] +endif
Why disabling compiler warning even without having any source file. Please start with empty meson file, and develop it as needed.
drivers/net/spnic/base/meson.build line 21
Quoted 10 lines
drivers/net/spnic/base/meson.build new file +10
-0+ +foreach flag: extra_flags + if cc.has_argument(flag) + cflags += flag + endif +endforeach + +deps += ['hash'] +cflags += ['-DHW_CONVERT_ENDIAN'] +c_args = cflags
ditto
Quoted 25 lines
drivers/net/spnic/base/meson.build new file +5
-0+ +base_lib = static_library('spnic_base', sources, + dependencies: [static_rte_eal, static_rte_ethdev, static_rte_bus_pci, static_rte_hash], + c_args: c_args) +base_objs = base_lib.extract_all_objects()drivers/net/spnic/base/spnic_compat.h new file +14
-0@@ -0,0 +1,184 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2021 Ramaxel Memory Technology, Ltd +*/ + +#ifndef _SPNIC_COMPAT_H_ +#define _SPNIC_COMPAT_H_ + +#include <stdint.h> +#include <stdbool.h> +#include <sys/time.h> +#include <unistd.h> +#include <pthread.h> +#include <rte_common.h> +#include <rte_byteorder.h>
drivers/net/spnic/base/spnic_compat.h line 24
Quoted 10 lines
drivers/net/spnic/base/spnic_compat.h new file +10
-0+#include <rte_memzone.h> +#include <rte_memcpy.h> +#include <rte_malloc.h> +#include <rte_atomic.h> +#include <rte_spinlock.h> +#include <rte_cycles.h> +#include <rte_log.h> +#include <rte_config.h> +#include <rte_io.h> +
Do you need to include all these headers at this stage? Can you please add them as needed?
drivers/net/spnic/base/spnic_compat.h line 35
Quoted 11 lines
drivers/net/spnic/base/spnic_compat.h new file +11
-0+typedef uint8_t u8 ; +typedef int8_t s8 ; +typedef uint16_t u16 ; +typedef uint32_t u32 ; +typedef int32_t s32 ; +typedef uint64_t u64 ; + +#ifndef BIT +#define BIT (n) (1 << (n)) +#endif +
There is already RTE_BIT64 / RTE_BIT32 in DPDK, those can be used.
Quoted 15 lines
drivers/net/spnic/base/spnic_compat.h new file +15
-0+#define upper_32_bits (n) ((u32)(((n) >> 16) >> 16)) +#define lower_32_bits (n) ((u32)(n)) + +#define SPNIC_MEM_ALLOC_ALIGN_MIN 1 + +#define SPNIC_DRIVER_NAME "spnic" + +extern int spnic_logtype; + +#define PMD_DRV_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, spnic_logtype, \ + SPNIC_DRIVER_NAME ": " fmt "\n", ##args) + +/* Bit order interface */ +#define cpu_to_be16 (o) rte_cpu_to_be_16(o)
drivers/net/spnic/base/spnic_compat.h line 60
Quoted 10 lines
drivers/net/spnic/base/spnic_compat.h new file +10
-0+#define cpu_to_be32 (o) rte_cpu_to_be_32(o) +#define cpu_to_be64 (o) rte_cpu_to_be_64(o) +#define cpu_to_le32 (o) rte_cpu_to_le_32(o) +#define be16_to_cpu (o) rte_be_to_cpu_16(o) +#define be32_to_cpu (o) rte_be_to_cpu_32(o) +#define be64_to_cpu (o) rte_be_to_cpu_64(o) +#define le32_to_cpu (o) rte_le_to_cpu_32(o) + +#define ARRAY_LEN (arr) ((sizeof(arr) / sizeof((arr)[0]))) +
There is DPDK 'RTE_DIM' for it.
Quoted 5 lines
drivers/net/spnic/base/spnic_compat.h new file +5
-0+#define SPNIC_MUTEX_TIMEOUT 10 +#define SPNIC_S_TO_MS_UNIT 1000 +#define SPNIC_S_TO_NS_UNIT 1000000 + +static inline unsigned long clock_gettime_ms (void )
drivers/net/spnic/base/spnic_compat.h line 75
Quoted 10 lines
drivers/net/spnic/base/spnic_compat.h new file +10
-0+{ +struct timespec tv; + + (void )clock_gettime (CLOCK_MONOTONIC_COARSE , &tv); + +return (unsigned long )tv.tv_sec *SPNIC_S_TO_MS_UNIT + + (unsigned long )tv.tv_nsec /SPNIC_S_TO_NS_UNIT ; +} + +#define jiffies clock_gettime_ms()
Is 'jiffies' used at all?
<...>
drivers/net/spnic/base/spnic_compat.h line 82
Quoted 7 lines
drivers/net/spnic/base/spnic_compat.h new file +7
-0+ +RTE_INIT (spnic_init_log) +{ + spnic_logtype =rte_log_register ("pmd.net.spnic" ); +if (spnic_logtype >=0 ) +rte_log_set_level (spnic_logtype,RTE_LOG_INFO ); +}
Can you please use 'RTE_LOG_REGISTER_DEFAULT' macro instead?
<...>
PATCH v6 2/26 net/spnic: initialize the HW interface
In reply to Yanling SongAdd HW interface registers and initialize the HW
interface.
--- drivers/net/spnic/base/meson.build | 2 + drivers/net/spnic/base/spnic_csr.h | 104 ++++ drivers/net/spnic/base/spnic_hwdev.c | 41 ++ drivers/net/spnic/base/spnic_hwdev.h | 29 + drivers/net/spnic/base/spnic_hwif.c | 774 +++++++++++++++++++++++++++ drivers/net/spnic/base/spnic_hwif.h | 155 ++++++ drivers/net/spnic/spnic_ethdev.c | 65 +++ drivers/net/spnic/spnic_ethdev.h | 48 +- 8 files changed, 1211 insertions(+), 7 deletions(-) create mode 100644 drivers/net/spnic/base/spnic_csr.h create mode 100644 drivers/net/spnic/base/spnic_hwdev.c create mode 100644 drivers/net/spnic/base/spnic_hwdev.h create mode 100644 drivers/net/spnic/base/spnic_hwif.c create mode 100644 drivers/net/spnic/base/spnic_hwif.h
drivers/net/spnic/base/meson.build +2 -0
@@ -2,6 +2,8 @@ # Copyright(c) 2021 Ramaxel Memory Technology, Ltd sources = [ + 'spnic_hwdev.c', + 'spnic_hwif.c' ] extra_flags = []
drivers/net/spnic/base/spnic_csr.h new file +104 -0
104 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwdev.c new file +41 -0
41 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwdev.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2021 Ramaxel Memory Technology, Ltd +*/ + +#ifndef _SPNIC_HWDEV_H_ +#define _SPNIC_HWDEV_H_ + +#include <rte_ether.h> + +#define SPNIC_CHIP_FAULT_SIZE (110 * 1024) + +struct spnic_hwdev { +void *dev_handle;/* Pointer to spnic_nic_dev */ +void *pci_dev;/* Pointer to rte_pci_device */ +void *eth_dev;/* Pointer to rte_eth_dev */ + +uint16_t port_id; + +struct spnic_hwif *hwif; +u8 *chip_fault_stats; + +u16 max_vfs; +u16 link_status; +}; + +int spnic_init_hwdev (struct spnic_hwdev *hwdev); + +void spnic_free_hwdev (struct spnic_hwdev *hwdev); +#endif /* _SPNIC_HWDEV_H_ */
drivers/net/spnic/base/spnic_hwif.c new file +774 -0
774 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwif.h new file +155 -0
155 lines not on this page · raw message
drivers/net/spnic/spnic_ethdev.c +65 -0
97 lines not on this page · raw message
drivers/net/spnic/spnic_ethdev.h +41 -7
62 lines not on this page · raw message
Signature · 1 line
2.32.0
Re: [PATCH v6 02/26] net/spnic: initialize the HW interface
Quoted 4 lines · Yanling Song
Add HW interface registers and initialize the HW
interface.Signed-off-by Yanling Song <[email protected]>
<...>
Quoted 6 lines
drivers/net/spnic/base/spnic_hwdev.h new file +0
-0
drivers/net/spnic/base/spnic_hwdev.h line 9
Quoted 9 lines
drivers/net/spnic/base/spnic_hwdev.h new file +9
-0@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2021 Ramaxel Memory Technology, Ltd +*/ + +#ifndef _SPNIC_HWDEV_H_ +#define _SPNIC_HWDEV_H_ + +#include <rte_ether.h> +
Why is this header required in this file?
<...>
Quoted 12 lines
drivers/net/spnic/base/spnic_hwdev.h new file +12
-0+#ifdef SPNIC_RELEASE +static int wait_until_doorbell_flush_states (struct spnic_hwif *hwif, +enum spnic_doorbell_ctrl states) +{ +enum spnic_doorbell_ctrl db_ctrl; +u32 cnt =0 ; + +if (!hwif) +return -EINVAL ; + +while (cnt <SPNIC_WAIT_DOORBELL_AND_OUTBOUND_TIMEOUT ) { + db_ctrl =spnic_get_doorbell_ctrl_status (hwif);
drivers/net/spnic/base/spnic_hwdev.h
Quoted 10 lines
drivers/net/spnic/base/spnic_hwdev.h new file +10
-0+if (db_ctrl == states) +return 0 ; + +rte_delay_ms (1 ); + cnt++; + } + +return -EFAULT ; +} +#endif
What is this 'SPNIC_RELEASE' macro and why it exists?
Please get rid of all all compile time macros, if the code is not required you can delete it while upstreaming.
<...>
Quoted 28 lines
struct spnic_nic_dev {drivers/net/spnic/base/spnic_hwdev.h new file +26
-0+struct spnic_hwdev *hwdev;/* Hardware device */ + +struct spnic_txq **txqs; +struct spnic_rxq **rxqs; +struct rte_mempool *cpy_mpool; + +u16 num_sqs; +u16 num_rqs; +u16 max_sqs; +u16 max_rqs; + +u16 rx_buff_len; +u16 mtu_size; + +u16 rss_state; +u8 num_rss; +u8 rsvd0; + +u32 rx_mode; +u8 rx_queue_list[SPNIC_MAX_QUEUE_NUM ]; +rte_spinlock_t queue_list_lock; +pthread_mutex_t rx_mode_mutex; + +u32 default_cos; +u32 rx_csum_en; +u32 dev_status;
drivers/net/spnic/base/spnic_hwdev.h
Quoted 10 lines
drivers/net/spnic/base/spnic_hwdev.h new file +8
-0+ +bool pause_set; +pthread_mutex_t pause_mutuex; + +struct rte_ether_addr default_addr; +struct rte_ether_addr *mc_list; +char dev_name[SPNIC_DEV_NAME_LEN ]; +u32 vfta[SPNIC_VFTA_SIZE ];/* VLAN bitmap */ };
Most of these additions to the struct is not used at all, can you please add them when they are used?
Re: [PATCH v6 02/26] net/spnic: initialize the HW interface
Quoted 17 lines · On Wed, 19 Jan 2022 17:05:14 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 4 lines · Yanling Song
Add HW interface registers and initialize the HW
interface.Signed-off-by Yanling Song <[email protected]><...>
Quoted 9 lines
(quoted diff) +0
-0
b/drivers/net/spnic/base/spnic_hwdev.hnew file mode 100644 index 0000000000..c89a4fa840drivers/net/spnic/base/spnic_hwdev.h new file +3
-0@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2021 Ramaxel Memory Technology, Ltd +*/
Quoted 9 lines
drivers/net/spnic/base/spnic_hwdev.h line 9
Quoted 6 lines
drivers/net/spnic/base/spnic_hwdev.h new file +6
-0+ +#ifndef _SPNIC_HWDEV_H_ +#define _SPNIC_HWDEV_H_ + +#include <rte_ether.h> +Why is this header required in this file?
It is a mistake. Will be removed in the next version.
Quoted 29 lines
<...>
Quoted 13 lines
drivers/net/spnic/base/spnic_hwdev.h new file +2
-0+#ifdef SPNIC_RELEASE +static int wait_until_doorbell_flush_states(struct spnic_hwif*hwif,
drivers/net/spnic/base/spnic_hwdev.h new file +1
-0+ enum
spnic_doorbell_ctrlstates) +{drivers/net/spnic/base/spnic_hwdev.h new file +8
-0+enum spnic_doorbell_ctrl db_ctrl; +u32 cnt =0 ; + +if (!hwif) +return -EINVAL ; + +while (cnt <SPNIC_WAIT_DOORBELL_AND_OUTBOUND_TIMEOUT ) { + db_ctrl =spnic_get_doorbell_ctrl_status (hwif);drivers/net/spnic/base/spnic_hwdev.h
Quoted 10 lines
drivers/net/spnic/base/spnic_hwdev.h new file +10
-0+if (db_ctrl == states) +return 0 ; + +rte_delay_ms (1 ); + cnt++; + } + +return -EFAULT ; +} +#endif What is this '
SPNIC_RELEASE' macro and why it exists?
Quoted 2 lines
Please get rid of all all compile time macros, if the code is not required you can delete it while upstreaming.
OK. 'SPNIC_RELEASE' will be removed.
Quoted 37 lines
<...>
Quoted 34 lines
struct spnic_nic_dev {drivers/net/spnic/base/spnic_hwdev.h new file +32
-0+struct spnic_hwdev *hwdev;/* Hardware device */ + +struct spnic_txq **txqs; +struct spnic_rxq **rxqs; +struct rte_mempool *cpy_mpool; + +u16 num_sqs; +u16 num_rqs; +u16 max_sqs; +u16 max_rqs; + +u16 rx_buff_len; +u16 mtu_size; + +u16 rss_state; +u8 num_rss; +u8 rsvd0; + +u32 rx_mode; +u8 rx_queue_list[SPNIC_MAX_QUEUE_NUM ]; +rte_spinlock_t queue_list_lock; +pthread_mutex_t rx_mode_mutex; + +u32 default_cos; +u32 rx_csum_en; +u32 dev_status; + +bool pause_set; +pthread_mutex_t pause_mutuex; + +struct rte_ether_addr default_addr; +struct rte_ether_addr *mc_list;
Quoted 8 lines
drivers/net/spnic/base/spnic_hwdev.h
Quoted 4 lines
drivers/net/spnic/base/spnic_hwdev.h new file +2
-0+char dev_name[SPNIC_DEV_NAME_LEN ]; +u32 vfta[SPNIC_VFTA_SIZE ];/* VLAN bitmap */ };Most of these additions to the struct is not used at all, can you please add them when they are used?
Ok. Will be changed in the next version.
PATCH v6 3/26 net/spnic: add mbox message channel
In reply to Yanling SongThis patch adds a message channel named mbox which can send message form PF/VF driver to hardware or sned message from VF to PF.
--- drivers/net/spnic/base/meson.build | 3 +- drivers/net/spnic/base/spnic_hwdev.c | 69 ++ drivers/net/spnic/base/spnic_hwdev.h | 6 + drivers/net/spnic/base/spnic_mbox.c | 1158 ++++++++++++++++++++++++++ drivers/net/spnic/base/spnic_mbox.h | 202 +++++ drivers/net/spnic/base/spnic_mgmt.h | 36 + 6 files changed, 1473 insertions(+), 1 deletion(-) create mode 100644 drivers/net/spnic/base/spnic_mbox.c create mode 100644 drivers/net/spnic/base/spnic_mbox.h create mode 100644 drivers/net/spnic/base/spnic_mgmt.h
drivers/net/spnic/base/meson.build +2 -1
@@ -3,7 +3,8 @@ sources = [ 'spnic_hwdev.c', - 'spnic_hwif.c' + 'spnic_hwif.c', + 'spnic_mbox.c' ] extra_flags = []
drivers/net/spnic/base/spnic_hwdev.c +69 -0
91 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwdev.h +6 -0
@@ -17,12 +17,18 @@ struct spnic_hwdev {uint16_t port_id;struct spnic_hwif *hwif; +struct spnic_mbox *func_to_func;u8 *chip_fault_stats;u16 max_vfs;u16 link_status; }; +int spnic_vf_handle_pf_comm_mbox(void *handle, __rte_unused void *pri_handle, + __rte_unused u16 cmd, __rte_unused void *buf_in, + __rte_unused u16 in_size, __rte_unused void *buf_out, + __rte_unused u16 *out_size); +int spnic_init_hwdev (struct spnic_hwdev *hwdev);void spnic_free_hwdev (struct spnic_hwdev *hwdev);
drivers/net/spnic/base/spnic_mbox.c new file +1158 -0
1,158 lines not on this page · raw message
drivers/net/spnic/base/spnic_mbox.h new file +202 -0
202 lines not on this page · raw message
drivers/net/spnic/base/spnic_mgmt.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2021 Ramaxel Memory Technology, Ltd +*/ + +#ifndef _SPNIC_MGMT_H_ +#define _SPNIC_MGMT_H_ + +#define SPNIC_MSG_HANDLER_RES (-1) + +/* Cmdq module type */ +enum spnic_mod_type { +SPNIC_MOD_COMM =0 ,/* HW communication module */ +SPNIC_MOD_L2NIC =1 ,/* L2NIC module */ +SPNIC_MOD_ROCE =2 , +SPNIC_MOD_PLOG =3 , +SPNIC_MOD_TOE =4 , +SPNIC_MOD_FLR =5 , +SPNIC_MOD_FC =6 , +SPNIC_MOD_CFGM =7 ,/* Configuration module */ +SPNIC_MOD_CQM =8 , +SPNIC_MOD_VSWITCH =9 , +COMM_MOD_FC =10 , +SPNIC_MOD_OVS =11 , +SPNIC_MOD_DSW =12 , +SPNIC_MOD_MIGRATE =13 , +SPNIC_MOD_HILINK =14 , +SPNIC_MOD_CRYPT =15 ,/* Secure crypto module */ +SPNIC_MOD_HW_MAX =16 ,/* Hardware max module id */ + +/* Software module id, for PF/VF and multi-host */ +SPNIC_MOD_SW_FUNC =17 , +SPNIC_MOD_IOE =18 , +SPNIC_MOD_MAX +}; + +#endif /* _SPNIC_MGMT_H_ */
Signature · 1 line
2.32.0
PATCH v6 4/26 net/spnic: introduce event queue
In reply to Yanling SongThis patch introduce event queue to receive response message from hardware or destiation function when a source function send mbox to it. This commit implements the related data structure, initialization and interfaces handling the message.
--- drivers/net/spnic/base/meson.build | 1 + drivers/net/spnic/base/spnic_eqs.c | 606 +++++++++++++++++++++++++++ drivers/net/spnic/base/spnic_eqs.h | 102 +++++ drivers/net/spnic/base/spnic_hwdev.c | 44 +- drivers/net/spnic/base/spnic_hwdev.h | 22 + drivers/net/spnic/base/spnic_mbox.c | 20 +- 6 files changed, 790 insertions(+), 5 deletions(-) create mode 100644 drivers/net/spnic/base/spnic_eqs.c create mode 100644 drivers/net/spnic/base/spnic_eqs.h
drivers/net/spnic/base/meson.build +1 -0
@@ -2,6 +2,7 @@ # Copyright(c) 2021 Ramaxel Memory Technology, Ltd sources = [ + 'spnic_eqs.c', 'spnic_hwdev.c', 'spnic_hwif.c', 'spnic_mbox.c'
drivers/net/spnic/base/spnic_eqs.c new file +606 -0
606 lines not on this page · raw message
drivers/net/spnic/base/spnic_eqs.h new file +102 -0
102 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwdev.c +43 -1
74 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwdev.h +22 -0
@@ -8,6 +8,21 @@#include <rte_ether.h> #define SPNIC_CHIP_FAULT_SIZE (110 * 1024) +struct cfg_mgmt_info ; +struct spnic_hwif ; +struct spnic_aeqs ; +struct spnic_mbox ; +struct spnic_msg_pf_to_mgmt ; + +struct ffm_intr_info { +u8 node_id; +/* Error level of the interrupt source */ +u8 err_level; +/* Classification by interrupt source properties */ +u16 err_type; +u32 err_csr_addr; +u32 err_csr_value; +};struct spnic_hwdev {void *dev_handle;/* Pointer to spnic_nic_dev */
@@ -18,6 +33,9 @@ struct spnic_hwdev {struct spnic_hwif *hwif;struct spnic_mbox *func_to_func; +struct cfg_mgmt_info *cfg_mgmt; +struct spnic_aeqs *aeqs; +struct spnic_msg_pf_to_mgmt *pf_to_mgmt;u8 *chip_fault_stats;u16 max_vfs;
@@ -29,6 +47,10 @@ int spnic_vf_handle_pf_comm_mbox(void *handle, __rte_unused void *pri_handle, __rte_unused u16 in_size, __rte_unused void *buf_out, __rte_unused u16 *out_size); +void spnic_pf_handle_mgmt_comm_event(void *handle, __rte_unused void *pri_handle, +u16 cmd,void *buf_in,u16 in_size, +void *buf_out,u16 *out_size); +int spnic_init_hwdev (struct spnic_hwdev *hwdev);void spnic_free_hwdev (struct spnic_hwdev *hwdev);
drivers/net/spnic/base/spnic_mbox.c +16 -4
@@ -2,13 +2,13 @@* Copyright(c) 2021 Ramaxel Memory Technology, Ltd */ -#include <rte_atomic.h> #include <ethdev_driver.h> #include "spnic_compat.h" #include "spnic_hwdev.h" #include "spnic_csr.h" -#include "spnic_hwif.h" #include "spnic_mgmt.h" +#include "spnic_hwif.h" +#include "spnic_eqs.h" #include "spnic_mbox.h" #define SPNIC_MBOX_INT_DST_FUNC_SHIFT 0
@@ -713,7 +713,9 @@ static int spnic_mbox_to_func(struct spnic_mbox *func_to_func,/* Use mbox_resp to hole data which responded from other function */ struct spnic_recv_mbox *mbox_for_resp =NULL ;struct mbox_msg_info msg_info = {0 }; +struct spnic_eq *aeq =NULL ;u16 mbox_rsp_idx; +u32 time;int err; mbox_rsp_idx = (dst_func == SPNIC_MGMT_SRC_ID) ?
@@ -748,9 +750,19 @@ static int spnic_mbox_to_func(struct spnic_mbox *func_to_func, goto send_err; } + time =msecs_to_jiffies (timeout ? timeout :SPNIC_MBOX_COMP_TIME ); + aeq = &func_to_func->hwdev->aeqs->aeq[SPNIC_MBOX_RSP_MSG_AEQ ]; + err =spnic_aeq_poll_msg (aeq, time,NULL ); +if (err) { +set_mbox_to_func_event (func_to_func,EVENT_TIMEOUT ); +PMD_DRV_LOG (ERR ,"Send mailbox message time out" ); + err = -ETIMEDOUT ; + goto send_err; + } +if (mod != mbox_for_resp->mod || cmd != mbox_for_resp->cmd) { -PMD_DRV_LOG (ERR ,"Invalid response mbox message, mod: 0x%x, cmd: 0x%x, expect mod: 0x%x, cmd: 0x%x, timeout0x%x\n" , - mbox_for_resp->mod, mbox_for_resp->cmd, mod, cmd, timeout); +PMD_DRV_LOG (ERR ,"Invalid response mbox message, mod: 0x%x, cmd: 0x%x, expect mod: 0x%x, cmd: 0x%x\n" , + mbox_for_resp->mod, mbox_for_resp->cmd, mod, cmd); err = -EFAULT ; goto send_err; }
Signature · 1 line
2.32.0
PATCH v6 5/26 net/spnic: add mgmt module
In reply to Yanling SongMgmt module manage the message gerenated from the hardware. This patch implements mgmt module initialization, related event processing and message command definition.
--- drivers/net/spnic/base/meson.build | 4 +- drivers/net/spnic/base/spnic_cmd.h | 222 ++++++++++++++ drivers/net/spnic/base/spnic_eqs.c | 46 ++- drivers/net/spnic/base/spnic_hwdev.c | 91 +++++- drivers/net/spnic/base/spnic_hwdev.h | 66 +++- drivers/net/spnic/base/spnic_mbox.c | 16 + drivers/net/spnic/base/spnic_mgmt.c | 367 +++++++++++++++++++++++ drivers/net/spnic/base/spnic_mgmt.h | 74 +++++ drivers/net/spnic/base/spnic_nic_event.c | 162 ++++++++++ drivers/net/spnic/base/spnic_nic_event.h | 29 ++ 10 files changed, 1066 insertions(+), 11 deletions(-) create mode 100644 drivers/net/spnic/base/spnic_cmd.h create mode 100644 drivers/net/spnic/base/spnic_mgmt.c create mode 100644 drivers/net/spnic/base/spnic_nic_event.c create mode 100644 drivers/net/spnic/base/spnic_nic_event.h
drivers/net/spnic/base/meson.build +3 -1
@@ -5,7 +5,9 @@ sources = [ 'spnic_eqs.c', 'spnic_hwdev.c', 'spnic_hwif.c', - 'spnic_mbox.c' + 'spnic_mbox.c', + 'spnic_mgmt.c', + 'spnic_nic_event.c' ] extra_flags = []
drivers/net/spnic/base/spnic_cmd.h new file +222 -0
222 lines not on this page · raw message
drivers/net/spnic/base/spnic_eqs.c +45 -1
69 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwdev.c +83 -8
135 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwdev.h +65 -1
84 lines not on this page · raw message
drivers/net/spnic/base/spnic_mbox.c +16 -0
@@ -6,10 +6,12 @@#include "spnic_compat.h" #include "spnic_hwdev.h" #include "spnic_csr.h" +#include "spnic_cmd.h" #include "spnic_mgmt.h" #include "spnic_hwif.h" #include "spnic_eqs.h" #include "spnic_mbox.h" +#include "spnic_nic_event.h" #define SPNIC_MBOX_INT_DST_FUNC_SHIFT 0#define SPNIC_MBOX_INT_DST_AEQN_SHIFT 10
@@ -148,6 +150,20 @@ static int recv_vf_mbox_handler(struct spnic_mbox *func_to_func, recv_mbox->mbox_len, buf_out, out_size);break ; +case SPNIC_MOD_L2NIC : + err =spnic_vf_event_handler (func_to_func->hwdev, + func_to_func->hwdev->cfg_mgmt, + recv_mbox->cmd, recv_mbox->mbox, + recv_mbox->mbox_len, + buf_out, out_size); +break ; +case SPNIC_MOD_HILINK : + err =spnic_vf_mag_event_handler (func_to_func->hwdev, + recv_mbox->cmd, + recv_mbox->mbox, + recv_mbox->mbox_len, + buf_out, out_size); +break ;default :PMD_DRV_LOG (ERR ,"No handler, mod: %d" , recv_mbox->mod); err =SPNIC_MBOX_VF_CMD_ERROR ;
drivers/net/spnic/base/spnic_mgmt.c new file +367 -0
367 lines not on this page · raw message
drivers/net/spnic/base/spnic_mgmt.h +74 -0
84 lines not on this page · raw message
drivers/net/spnic/base/spnic_nic_event.c new file +162 -0
162 lines not on this page · raw message
drivers/net/spnic/base/spnic_nic_event.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2021 Ramaxel Memory Technology, Ltd +*/ + +#ifndef _SPNIC_NIC_EVENT_H_ +#define _SPNIC_NIC_EVENT_H_ + +struct spnic_cmd_link_state { +struct mgmt_msg_head msg_head; + +u8 port_id; +u8 state; +u16 rsvd1; +}; + +void spnic_pf_event_handler(void *hwdev, __rte_unused void *pri_handle, +u16 cmd,void *buf_in,u16 in_size, +void *buf_out,u16 *out_size); + +int spnic_vf_event_handler(void *hwdev, __rte_unused void *pri_handle, +u16 cmd,void *buf_in,u16 in_size, +void *buf_out,u16 *out_size); + +int spnic_vf_mag_event_handler (void *hwdev,u16 cmd,void *buf_in,u16 in_size,void *buf_out, +u16 *out_size); + +u8 spnic_nic_sw_aeqe_handler(__rte_unused void *hwdev, u8 event, u8 *data); + +#endif /* _SPNIC_NIC_EVENT_H_ */
Signature · 1 line
2.32.0
Re: [PATCH v6 05/26] net/spnic: add mgmt module
Quoted 5 lines · Yanling Song
Mgmt module manage the message gerenated from the hardware. This patch implements mgmt module initialization, related event processing and message command definition.
Signed-off-by Yanling Song <[email protected]>
<...>
drivers/net/spnic/base/spnic_nic_event.c line 22
Quoted 8 lines
drivers/net/spnic/base/spnic_nic_event.c new file +8
-0+static void spnic_get_port_link_info (u8 link_state,struct rte_eth_link *link) +{ +if (!link_state) { + link->link_status =ETH_LINK_DOWN ; + link->link_speed =ETH_SPEED_NUM_NONE ; + link->link_duplex =ETH_LINK_HALF_DUPLEX ; + link->link_autoneg =ETH_LINK_FIXED ; + }
The driver is using deprecated macros. If you can rebase on top of latest next-net, you will get the warnings.
Since it is hard to continue with bunch of build errors, I will wait for next version and can continue the reviews with it.
Re: [PATCH v6 05/26] net/spnic: add mgmt module
Quoted 21 lines · On Wed, 19 Jan 2022 17:22:51 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 5 lines · Yanling Song
Mgmt module manage the message gerenated from the hardware. This patch implements mgmt module initialization, related event processing and message command definition.
Signed-off-by Yanling Song <[email protected]><...>
drivers/net/spnic/base/spnic_nic_event.c line 22
Quoted 8 lines
+static void
spnic_get_port_link_info(u8 link_state, struct rte_eth_link *link)+{drivers/net/spnic/base/spnic_nic_event.c new file +6
-0+if (!link_state) { + link->link_status =ETH_LINK_DOWN ; + link->link_speed =ETH_SPEED_NUM_NONE ; + link->link_duplex =ETH_LINK_HALF_DUPLEX ; + link->link_autoneg =ETH_LINK_FIXED ; + }The driver is using deprecated macros. If you can rebase on top of latest next-net, you will get the warnings.
Quoted 2 lines
Since it is hard to continue with bunch of build errors, I will wait for next version and can continue the reviews with it.
Thanks for pointing it out. Will use new macros to replace the old ones in the next version.
PATCH v6 6/26 net/spnic: add cmdq and work queue
In reply to Yanling SongThis commit introduce cmdq and work queue which can be used to send bulk message data(up to 2KB) to hardware. cmdq provides a mechanism to encapsulate the message to be sent and handle the response data or status. work queue is used to manager the wqe in which includes message data buffer description, ctrl info, header info and response message data buffer. This patch implements the initialization and data structure.
--- drivers/net/spnic/base/meson.build | 4 +- drivers/net/spnic/base/spnic_cmdq.c | 202 ++++++++++++++++++++++ drivers/net/spnic/base/spnic_cmdq.h | 228 +++++++++++++++++++++++++ drivers/net/spnic/base/spnic_hw_comm.c | 222 ++++++++++++++++++++++++ drivers/net/spnic/base/spnic_hw_comm.h | 176 +++++++++++++++++++ drivers/net/spnic/base/spnic_hwdev.c | 215 +++++++++++++++++++++++ drivers/net/spnic/base/spnic_hwdev.h | 8 +- drivers/net/spnic/base/spnic_wq.h | 57 +++++++ 8 files changed, 1109 insertions(+), 3 deletions(-) create mode 100644 drivers/net/spnic/base/spnic_cmdq.c create mode 100644 drivers/net/spnic/base/spnic_cmdq.h create mode 100644 drivers/net/spnic/base/spnic_hw_comm.c create mode 100644 drivers/net/spnic/base/spnic_hw_comm.h create mode 100644 drivers/net/spnic/base/spnic_wq.h
drivers/net/spnic/base/meson.build +3 -1
@@ -7,7 +7,9 @@ sources = [ 'spnic_hwif.c', 'spnic_mbox.c', 'spnic_mgmt.c', - 'spnic_nic_event.c' + 'spnic_nic_event.c', + 'spnic_cmdq.c', + 'spnic_hw_comm.c', ] extra_flags = []
drivers/net/spnic/base/spnic_cmdq.c new file +202 -0
202 lines not on this page · raw message
drivers/net/spnic/base/spnic_cmdq.h new file +228 -0
228 lines not on this page · raw message
drivers/net/spnic/base/spnic_hw_comm.c new file +222 -0
222 lines not on this page · raw message
drivers/net/spnic/base/spnic_hw_comm.h new file +176 -0
176 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwdev.c +215 -0
251 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwdev.h +6 -2
@@ -91,13 +91,17 @@ struct spnic_hwdev {void *dev_handle;/* Pointer to spnic_nic_dev */ void *pci_dev;/* Pointer to rte_pci_device */ void *eth_dev;/* Pointer to rte_eth_dev */ - +struct spnic_hwif *hwif;uint16_t port_id; -struct spnic_hwif *hwif; +u32 wq_page_size; +struct spnic_mbox *func_to_func;struct cfg_mgmt_info *cfg_mgmt; + +struct spnic_cmdqs *cmdqs;struct spnic_aeqs *aeqs; +struct spnic_msg_pf_to_mgmt *pf_to_mgmt;u8 *chip_fault_stats;struct spnic_hw_stats hw_stats;
drivers/net/spnic/base/spnic_wq.h new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
2.32.0
PATCH v6 7/26 net/spnic: add interface handling cmdq message
In reply to Yanling SongThis commit adds cmdq_sync_cmd_direct_resp() and cmdq_sync_cmd_detail_resp() interfaces by which driver can send cmdq message using wqe a data structure describe the buffer.
--- drivers/net/spnic/base/meson.build | 1 + drivers/net/spnic/base/spnic_cmdq.c | 673 +++++++++++++++++++++++++ drivers/net/spnic/base/spnic_cmdq.h | 20 + drivers/net/spnic/base/spnic_hw_comm.c | 41 ++ drivers/net/spnic/base/spnic_hwdev.c | 8 +- drivers/net/spnic/base/spnic_hwdev.h | 13 + drivers/net/spnic/base/spnic_wq.c | 139 +++++ drivers/net/spnic/base/spnic_wq.h | 70 ++- 8 files changed, 960 insertions(+), 5 deletions(-) create mode 100644 drivers/net/spnic/base/spnic_wq.c
drivers/net/spnic/base/meson.build +1 -0
@@ -10,6 +10,7 @@ sources = [ 'spnic_nic_event.c', 'spnic_cmdq.c', 'spnic_hw_comm.c', + 'spnic_wq.c' ] extra_flags = []
drivers/net/spnic/base/spnic_cmdq.c +673 -0
735 lines not on this page · raw message
drivers/net/spnic/base/spnic_cmdq.h +20 -0
@@ -93,6 +93,7 @@ struct spnic_scmd_bufdesc { };struct spnic_lcmd_bufdesc { +struct spnic_sge sge;u32 rsvd1;u64 saved_async_buf;u64 rsvd3;
@@ -112,6 +113,7 @@ struct spnic_ctrl { };struct spnic_sge_resp { +struct spnic_sge sge;u32 rsvd; };
@@ -221,6 +223,24 @@ struct spnic_cmd_buf {int spnic_reinit_cmdq_ctxts (struct spnic_hwdev *hwdev); +bool spnic_cmdq_idle (struct spnic_cmdq *cmdq); + +struct spnic_cmd_buf *spnic_alloc_cmd_buf (void *hwdev); + +void spnic_free_cmd_buf (struct spnic_cmd_buf *cmd_buf); + +/* +* PF/VF sends cmd to ucode by cmdq, and return 0 if success. +* timeout=0, use default timeout. +*/ +int spnic_cmdq_direct_resp (void *hwdev,enum spnic_mod_type mod,u8 cmd, +struct spnic_cmd_buf *buf_in,u64 *out_param, +u32 timeout); + +int spnic_cmdq_detail_resp (void *hwdev,enum spnic_mod_type mod,u8 cmd, +struct spnic_cmd_buf *buf_in, +struct spnic_cmd_buf *buf_out,u32 timeout); +int spnic_cmdqs_init (struct spnic_hwdev *hwdev);void spnic_cmdqs_free (struct spnic_hwdev *hwdev);
drivers/net/spnic/base/spnic_hw_comm.c +41 -0
53 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwdev.c +5 -3
@@ -9,6 +9,7 @@#include "spnic_mgmt.h" #include "spnic_cmd.h" #include "spnic_mbox.h" +#include "spnic_wq.h" #include "spnic_cmdq.h" #include "spnic_hwdev.h" #include "spnic_hw_comm.h"
@@ -322,9 +323,6 @@ static void free_mgmt_channel(struct spnic_hwdev *hwdev)spnic_aeqs_free (hwdev); } -#define SPNIC_DEFAULT_WQ_PAGE_SIZE 0x100000 -#define SPNIC_HW_WQ_PAGE_SIZE 0x1000 -static int init_cmdqs_channel (struct spnic_hwdev *hwdev) {int err;
@@ -394,6 +392,10 @@ static int spnic_init_comm_ch(struct spnic_hwdev *hwdev)static void spnic_uninit_comm_ch (struct spnic_hwdev *hwdev) {spnic_comm_cmdqs_free (hwdev); + +if (SPNIC_FUNC_TYPE (hwdev) !=TYPE_VF ) +spnic_set_wq_page_size (hwdev,spnic_global_func_id (hwdev), +SPNIC_HW_WQ_PAGE_SIZE );free_mgmt_channel (hwdev); }
drivers/net/spnic/base/spnic_hwdev.h +13 -0
@@ -13,6 +13,19 @@ struct spnic_aeqs;struct spnic_mbox ;struct spnic_msg_pf_to_mgmt ; +#define MGMT_VERSION_MAX_LEN 32 + +enum spnic_set_arm_type { +SPNIC_SET_ARM_CMDQ , +SPNIC_SET_ARM_SQ , +SPNIC_SET_ARM_TYPE_NUM +}; + +struct spnic_page_addr { +void *virt_addr; +u64 phys_addr; +}; +struct ffm_intr_info {u8 node_id;/* Error level of the interrupt source */
drivers/net/spnic/base/spnic_wq.c new file +139 -0
139 lines not on this page · raw message
drivers/net/spnic/base/spnic_wq.h +68 -2
99 lines not on this page · raw message
Signature · 1 line
2.32.0
PATCH v6 8/26 net/spnic: add hardware info initialization
In reply to Yanling SongThis commits add hardware info initialization, including that device capability initialization, common feature negotiation, and two interfaces spnic_get_board_info(), spnic_get_mgmt_version() to get hardware info and firmware version.
--- drivers/net/spnic/base/meson.build | 3 +- drivers/net/spnic/base/spnic_hw_cfg.c | 157 +++++++++++++++++++++++++ drivers/net/spnic/base/spnic_hw_cfg.h | 117 ++++++++++++++++++ drivers/net/spnic/base/spnic_hw_comm.c | 121 +++++++++++++++++++ drivers/net/spnic/base/spnic_hw_comm.h | 22 ++++ drivers/net/spnic/base/spnic_hwdev.c | 70 +++++++++++ drivers/net/spnic/base/spnic_hwdev.h | 5 + drivers/net/spnic/base/spnic_mbox.c | 8 ++ 8 files changed, 502 insertions(+), 1 deletion(-) create mode 100644 drivers/net/spnic/base/spnic_hw_cfg.c create mode 100644 drivers/net/spnic/base/spnic_hw_cfg.h
drivers/net/spnic/base/meson.build +2 -1
@@ -10,7 +10,8 @@ sources = [ 'spnic_nic_event.c', 'spnic_cmdq.c', 'spnic_hw_comm.c', - 'spnic_wq.c' + 'spnic_wq.c', + 'spnic_hw_cfg.c' ] extra_flags = []
drivers/net/spnic/base/spnic_hw_cfg.c new file +157 -0
157 lines not on this page · raw message
drivers/net/spnic/base/spnic_hw_cfg.h new file +117 -0
117 lines not on this page · raw message
drivers/net/spnic/base/spnic_hw_comm.c +121 -0
130 lines not on this page · raw message
drivers/net/spnic/base/spnic_hw_comm.h +22 -0
@@ -96,6 +96,18 @@ enum spnic_fw_ver_type { SPNIC_FW_VER_TYPE_CFG, }; +#define MGMT_MSG_CMD_OP_SET 1 +#define MGMT_MSG_CMD_OP_GET 0 + +struct comm_cmd_feature_nego { +struct mgmt_msg_head head; + +u16 func_id; +u8 opcode;/* 1: set, 0: get */ +u8 rsvd; +u64 s_feature[MAX_FEATURE_QWORD ]; +}; +struct comm_cmd_dma_attr_config {struct mgmt_msg_head head;
@@ -162,6 +174,12 @@ struct interrupt_info {u8 resend_timer_cfg; }; +int spnic_func_reset (void *hwdev,u64 reset_flag); + +int spnic_get_mgmt_version (void *hwdev,char *mgmt_ver,int max_mgmt_len); + +int spnic_get_board_info (void *hwdev,struct spnic_board_info *info); +int spnic_get_interrupt_cfg (void *dev,struct interrupt_info *info);int spnic_set_interrupt_cfg (void *dev,struct interrupt_info info);
@@ -170,6 +188,10 @@ int spnic_set_wq_page_size(void *hwdev, u16 func_idx, u32 page_size);int spnic_set_cmdq_depth (void *hwdev,u16 cmdq_depth); +int spnic_get_comm_features (void *hwdev,u64 *s_feature,u16 size); + +int spnic_set_comm_features (void *hwdev,u64 *s_feature,u16 size); +int spnic_set_dma_attr_tbl (struct spnic_hwdev *hwdev,u32 entry_idx,u8 st,u8 at,u8 ph,u8 no_snooping,u8 tph_en);
drivers/net/spnic/base/spnic_hwdev.c +70 -0
122 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwdev.h +5 -0
@@ -100,6 +100,7 @@ struct spnic_board_info {u32 cfg_addr; }; +#define MAX_FEATURE_QWORD 4struct spnic_hwdev {void *dev_handle;/* Pointer to spnic_nic_dev */ void *pci_dev;/* Pointer to rte_pci_device */
@@ -117,7 +118,11 @@ struct spnic_hwdev {struct spnic_msg_pf_to_mgmt *pf_to_mgmt;u8 *chip_fault_stats; +struct spnic_hw_stats hw_stats; +struct spnic_board_info board_info; +char mgmt_ver[MGMT_VERSION_MAX_LEN ]; +u64 features[MAX_FEATURE_QWORD ];u16 max_vfs;u16 link_status;
drivers/net/spnic/base/spnic_mbox.c +8 -0
@@ -10,6 +10,7 @@#include "spnic_mgmt.h" #include "spnic_hwif.h" #include "spnic_eqs.h" +#include "spnic_hw_cfg.h" #include "spnic_mbox.h" #include "spnic_nic_event.h"
@@ -150,6 +151,13 @@ static int recv_vf_mbox_handler(struct spnic_mbox *func_to_func, recv_mbox->mbox_len, buf_out, out_size);break ; +case SPNIC_MOD_CFGM : + err =spnic_cfg_mbx_vf_proc_msg (func_to_func->hwdev, + func_to_func->hwdev->cfg_mgmt, + recv_mbox->cmd, recv_mbox->mbox, + recv_mbox->mbox_len, + buf_out, out_size); +break ;case SPNIC_MOD_L2NIC : err = spnic_vf_event_handler(func_to_func->hwdev, func_to_func->hwdev->cfg_mgmt,
Signature · 1 line
2.32.0
PATCH v6 9/26 net/spnic: support MAC and link event handling
In reply to Yanling SongThis commit adds interfaces to add/remove MAC addresses and registers related ops to struct eth_dev_ops. Furthermore, this commit adds callback to handle link events.
--- drivers/net/spnic/base/meson.build | 3 +- drivers/net/spnic/base/spnic_hw_cfg.c | 12 + drivers/net/spnic/base/spnic_hw_cfg.h | 2 + drivers/net/spnic/base/spnic_nic_cfg.c | 291 +++++++++++++++++++ drivers/net/spnic/base/spnic_nic_cfg.h | 180 ++++++++++++ drivers/net/spnic/base/spnic_nic_event.c | 27 +- drivers/net/spnic/base/spnic_nic_event.h | 9 +- drivers/net/spnic/spnic_ethdev.c | 348 ++++++++++++++++++++++- 8 files changed, 861 insertions(+), 11 deletions(-) create mode 100644 drivers/net/spnic/base/spnic_nic_cfg.c create mode 100644 drivers/net/spnic/base/spnic_nic_cfg.h
drivers/net/spnic/base/meson.build +2 -1
@@ -11,7 +11,8 @@ sources = [ 'spnic_cmdq.c', 'spnic_hw_comm.c', 'spnic_wq.c', - 'spnic_hw_cfg.c' + 'spnic_hw_cfg.c', + 'spnic_nic_cfg.c' ] extra_flags = []
drivers/net/spnic/base/spnic_hw_cfg.c +12 -0
@@ -155,3 +155,15 @@ void spnic_free_capability(void *dev) {rte_free (((struct spnic_hwdev *)dev)->cfg_mgmt); } + +u8 spnic_physical_port_id (void *hwdev) +{ +struct spnic_hwdev *dev = hwdev; + +if (!dev) { +PMD_DRV_LOG (INFO ,"Hwdev is NULL for getting physical port id" ); +return 0 ; + } + +return dev->cfg_mgmt->svc_cap.port_id; +}
drivers/net/spnic/base/spnic_hw_cfg.h +2 -0
@@ -112,6 +112,8 @@ struct spnic_cfg_cmd_dev_cap {int spnic_init_capability (void *dev);void spnic_free_capability (void *dev); +u8 spnic_physical_port_id (void *hwdev); +int spnic_cfg_mbx_vf_proc_msg (void *hwdev,void *pri_handle,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size);#endif /* _SPNIC_HW_CFG_H_ */
drivers/net/spnic/base/spnic_nic_cfg.c new file +291 -0
291 lines not on this page · raw message
drivers/net/spnic/base/spnic_nic_cfg.h new file +180 -0
180 lines not on this page · raw message
drivers/net/spnic/base/spnic_nic_event.c +25 -2
@@ -9,16 +9,39 @@#include "spnic_hwif.h" #include "spnic_hwdev.h" #include "spnic_mgmt.h" +#include "spnic_nic_cfg.h" #include "spnic_hwdev.h" #include "spnic_nic_event.h" -static void spnic_get_port_link_info (u8 link_state,struct rte_eth_link *link) +void spnic_get_port_link_info (struct spnic_hwdev *hwdev,u8 link_state, +struct rte_eth_link *link) { +uint32_t port_speed[LINK_SPEED_LEVELS ] = {ETH_SPEED_NUM_10M , +ETH_SPEED_NUM_100M ,ETH_SPEED_NUM_1G , +ETH_SPEED_NUM_10G ,ETH_SPEED_NUM_25G , +ETH_SPEED_NUM_40G ,ETH_SPEED_NUM_100G }; +struct nic_port_info port_info = {0 }; +int err; +if (!link_state) { link->link_status =ETH_LINK_DOWN ; link->link_speed =ETH_SPEED_NUM_NONE ; link->link_duplex =ETH_LINK_HALF_DUPLEX ; link->link_autoneg =ETH_LINK_FIXED ; + }else { + link->link_status =ETH_LINK_UP ; + + err =spnic_get_port_info (hwdev, &port_info); +if (err) { + link->link_speed =ETH_SPEED_NUM_NONE ; + link->link_duplex =ETH_LINK_FULL_DUPLEX ; + link->link_autoneg =ETH_LINK_FIXED ; + }else { + link->link_speed = port_speed[port_info.speed % +LINK_SPEED_LEVELS ]; + link->link_duplex = port_info.duplex; + link->link_autoneg = port_info.autoneg_state; + } } }
@@ -51,7 +74,7 @@ static void link_status_event_handler(void *hwdev, void *buf_in,spnic_link_event_stats (hwdev, link_status->state);/* Link event reported only after set vport enable */ -spnic_get_port_link_info (link_status->state, &link); +spnic_get_port_link_info (dev, link_status->state, &link); err =rte_eth_linkstatus_set ((struct rte_eth_dev *)(dev->eth_dev), &link);if (!err)
drivers/net/spnic/base/spnic_nic_event.h +2 -7
@@ -5,13 +5,8 @@#ifndef _SPNIC_NIC_EVENT_H_#define _SPNIC_NIC_EVENT_H_ -struct spnic_cmd_link_state { -struct mgmt_msg_head msg_head; - -u8 port_id; -u8 state; -u16 rsvd1; -}; +void spnic_get_port_link_info (struct spnic_hwdev *hwdev,u8 link_state, +struct rte_eth_link *link); void spnic_pf_event_handler(void *hwdev, __rte_unused void *pri_handle, u16 cmd, void *buf_in, u16 in_size,
drivers/net/spnic/spnic_ethdev.c +347 -1
408 lines not on this page · raw message
Signature · 1 line
2.32.0
Re: [PATCH v6 09/26] net/spnic: support MAC and link event handling
Quoted 4 lines · Yanling Song
This commit adds interfaces to add/remove MAC addresses and registers related ops to struct
eth_dev_ops. Furthermore, this commit adds callback to handle link events.
The patch also adds the VF dev_ops.
It would be more clear to support PF first and add mbox support and VF later. But VF support is crept into the code from early patches, I assume that is because the driver is already complete and spliting it is hard at this stage..
Similarly the primary/secondary support seems spread through the patches, hard to separate the feature.
Above are sign of the patches are not split logically which makes harder to review them and detect any issues, and future fixes references won't be clear.
If you can clarify the split more, that would be great but I can see it is hard with an existing driver.
Quoted 1 line
Signed-off-by Yanling Song <[email protected]>
Re: [PATCH v6 09/26] net/spnic: support MAC and link event handling
Quoted 6 lines · On Wed, 19 Jan 2022 17:26:47 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 4 lines · Yanling Song
This commit adds interfaces to add/remove MAC addresses and registers related ops to struct
eth_dev_ops. Furthermore, this commit adds callback to handle link events.
Quoted 7 lines
The patch also adds the VF
dev_ops.It would be more clear to support PF first and add mbox support and VF later. But VF support is crept into the code from early patches, I assume that is because the driver is already complete and spliting it is hard at this stage..
Yes. it is.
Quoted 11 lines
Similarly the primary/secondary support seems spread through the patches, hard to separate the feature.
Above are sign of the patches are not split logically which makes harder to review them and detect any issues, and future fixes references won't be clear.
If you can clarify the split more, that would be great but I can see it is hard with an existing driver.
Sorry for the inconvenient. Will split the patches clearly in the next version.
Quoted 2 lines
Quoted 1 line
Signed-off-by Yanling Song <[email protected]>
PATCH v6 10/26 net/spnic: add function info initialization
In reply to Yanling SongThis patch mainly implements function info initialization including mtu, link state, port state, port info and cos as well as the definition of the corresponding data structure.
--- drivers/net/spnic/base/spnic_hw_cfg.c | 43 +++ drivers/net/spnic/base/spnic_hw_cfg.h | 6 + drivers/net/spnic/base/spnic_nic_cfg.c | 221 ++++++++++++++ drivers/net/spnic/base/spnic_nic_cfg.h | 213 ++++++++++++++ drivers/net/spnic/spnic_ethdev.c | 382 ++++++++++++++++++++++++- drivers/net/spnic/spnic_ethdev.h | 22 +- 6 files changed, 876 insertions(+), 11 deletions(-)
drivers/net/spnic/base/spnic_hw_cfg.c +43 -0
@@ -156,6 +156,49 @@ void spnic_free_capability(void *dev)rte_free (((struct spnic_hwdev *)dev)->cfg_mgmt); } +/* * +* @brief spnic_support_nic - function support nic +* @param hwdev: device pointer to hwdev +* @retval true: function support nic +* @retval false: function not support nic +*/ +bool spnic_support_nic (void *hwdev) +{ +struct spnic_hwdev *dev = (struct spnic_hwdev *)hwdev; + +if (!hwdev) +return false; + +if (!IS_NIC_TYPE (dev)) +return false; + +return true; +} + +u16 spnic_func_max_sqs (void *hwdev) +{ +struct spnic_hwdev *dev = hwdev; + +if (!dev) { +PMD_DRV_LOG (INFO ,"Hwdev is NULL for getting max_sqs" ); +return 0 ; + } + +return dev->cfg_mgmt->svc_cap.nic_cap.max_sqs; +} + +u16 spnic_func_max_rqs (void *hwdev) +{ +struct spnic_hwdev *dev = hwdev; + +if (!dev) { +PMD_DRV_LOG (INFO ,"Hwdev is NULL for getting max_rqs" ); +return 0 ; + } + +return dev->cfg_mgmt->svc_cap.nic_cap.max_rqs; +} +u8 spnic_physical_port_id (void *hwdev) {struct spnic_hwdev *dev = hwdev;
drivers/net/spnic/base/spnic_hw_cfg.h +6 -0
@@ -112,8 +112,14 @@ struct spnic_cfg_cmd_dev_cap {int spnic_init_capability (void *dev);void spnic_free_capability (void *dev); +u16 spnic_func_max_sqs (void *hwdev); +u16 spnic_func_max_rqs (void *hwdev); +u8 spnic_physical_port_id (void *hwdev);int spnic_cfg_mbx_vf_proc_msg (void *hwdev,void *pri_handle,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size); + +bool spnic_support_nic (void *hwdev); +#endif /* _SPNIC_HW_CFG_H_ */
drivers/net/spnic/base/spnic_nic_cfg.c +221 -0
227 lines not on this page · raw message
drivers/net/spnic/base/spnic_nic_cfg.h +213 -0
235 lines not on this page · raw message
drivers/net/spnic/spnic_ethdev.c +372 -10
466 lines not on this page · raw message
drivers/net/spnic/spnic_ethdev.h +21 -1
@@ -4,6 +4,7 @@#ifndef _SPNIC_ETHDEV_H_#define _SPNIC_ETHDEV_H_ +#define SPNIC_DEV_NAME_LEN 32#define SPNIC_UINT32_BIT_SIZE (CHAR_BIT * sizeof(uint32_t))#define SPNIC_VFTA_SIZE (4096 / SPNIC_UINT32_BIT_SIZE)
@@ -16,7 +17,25 @@ enum spnic_dev_status {SPNIC_DEV_INTR_EN }; -#define SPNIC_DEV_NAME_LEN 32 +enum nic_feature_cap { +NIC_F_CSUM =BIT (0 ), +NIC_F_SCTP_CRC =BIT (1 ), +NIC_F_TSO =BIT (2 ), +NIC_F_LRO =BIT (3 ), +NIC_F_UFO =BIT (4 ), +NIC_F_RSS =BIT (5 ), +NIC_F_RX_VLAN_FILTER =BIT (6 ), +NIC_F_RX_VLAN_STRIP =BIT (7 ), +NIC_F_TX_VLAN_INSERT =BIT (8 ), +NIC_F_VXLAN_OFFLOAD =BIT (9 ), +NIC_F_IPSEC_OFFLOAD =BIT (10 ), +NIC_F_FDIR =BIT (11 ), +NIC_F_PROMISC =BIT (12 ), +NIC_F_ALLMULTI =BIT (13 ), +}; + +#define DEFAULT_DRV_FEATURE 0x3FFF +struct spnic_nic_dev {struct spnic_hwdev *hwdev;/* Hardware device */
@@ -53,6 +72,7 @@ struct spnic_nic_dev {struct rte_ether_addr *mc_list;char dev_name[SPNIC_DEV_NAME_LEN ]; +u64 feature_cap;u32 vfta[SPNIC_VFTA_SIZE ];/* VLAN bitmap */ };
Signature · 1 line
2.32.0
PATCH v6 11/26 net/spnic: add queue pairs context initialization
In reply to Yanling SongThis patch adds the initialization of Tx/Rx queues context and negotiation of NIC features.
--- drivers/net/spnic/base/spnic_hw_comm.c | 101 ++++ drivers/net/spnic/base/spnic_hw_comm.h | 6 + drivers/net/spnic/base/spnic_nic_cfg.c | 76 +++ drivers/net/spnic/base/spnic_nic_cfg.h | 65 ++- drivers/net/spnic/meson.build | 3 +- drivers/net/spnic/spnic_ethdev.c | 57 +- drivers/net/spnic/spnic_io.c | 738 +++++++++++++++++++++++++ drivers/net/spnic/spnic_io.h | 154 ++++++ drivers/net/spnic/spnic_rx.h | 113 ++++ drivers/net/spnic/spnic_tx.h | 62 +++ 10 files changed, 1370 insertions(+), 5 deletions(-) create mode 100644 drivers/net/spnic/spnic_io.c create mode 100644 drivers/net/spnic/spnic_io.h create mode 100644 drivers/net/spnic/spnic_rx.h create mode 100644 drivers/net/spnic/spnic_tx.h
drivers/net/spnic/base/spnic_hw_comm.c +101 -0
@@ -217,6 +217,107 @@ int spnic_func_reset(void *hwdev, u64 reset_flag)return 0 ; } +int spnic_convert_rx_buf_size (u32 rx_buf_sz,u32 *match_sz) +{ +u32 i, num_hw_types, best_match_sz; + +if (unlikely (!match_sz || rx_buf_sz <SPNIC_RX_BUF_SIZE_32B )) +return -EINVAL ; + +if (rx_buf_sz >=SPNIC_RX_BUF_SIZE_16K ) { + best_match_sz =SPNIC_RX_BUF_SIZE_16K ; + goto size_matched; + } + + num_hw_types =sizeof (spnic_hw_rx_buf_size) / +sizeof (spnic_hw_rx_buf_size[0 ]); + best_match_sz = spnic_hw_rx_buf_size[0 ]; +for (i =0 ; i < num_hw_types; i++) { +if (rx_buf_sz == spnic_hw_rx_buf_size[i]) { + best_match_sz = spnic_hw_rx_buf_size[i]; +break ; + }else if (rx_buf_sz < spnic_hw_rx_buf_size[i]) { +break ; + } + best_match_sz = spnic_hw_rx_buf_size[i]; + } + +size_matched: + *match_sz = best_match_sz; + +return 0 ; +} + +static u16 get_hw_rx_buf_size (u32 rx_buf_sz) +{ +u16 num_hw_types =sizeof (spnic_hw_rx_buf_size) / +sizeof (spnic_hw_rx_buf_size[0 ]); +u16 i; + +for (i =0 ; i < num_hw_types; i++) { +if (spnic_hw_rx_buf_size[i] == rx_buf_sz) +return i; + } + +PMD_DRV_LOG (WARNING ,"Chip can't support rx buf size of %d" , rx_buf_sz); + +return DEFAULT_RX_BUF_SIZE ;/* Default 2K */ +} + +int spnic_set_root_ctxt (void *hwdev,u32 rq_depth,u32 sq_depth,u16 rx_buf_sz) +{ +struct spnic_cmd_root_ctxt root_ctxt; +u16 out_size =sizeof (root_ctxt); +int err; + +if (!hwdev) +return -EINVAL ; + +memset (&root_ctxt,0 ,sizeof (root_ctxt)); + root_ctxt.func_idx =spnic_global_func_id (hwdev); + root_ctxt.set_cmdq_depth =0 ; + root_ctxt.cmdq_depth =0 ; + root_ctxt.lro_en =1 ; + root_ctxt.rq_depth = (u16 )ilog2 (rq_depth); + root_ctxt.rx_buf_sz =get_hw_rx_buf_size (rx_buf_sz); + root_ctxt.sq_depth = (u16 )ilog2 (sq_depth); + + err =spnic_msg_to_mgmt_sync (hwdev,SPNIC_MOD_COMM ,MGMT_CMD_SET_VAT , + &root_ctxt,sizeof (root_ctxt), + &root_ctxt, &out_size,0 ); +if (err || !out_size || root_ctxt.status) { +PMD_DRV_LOG (ERR ,"Set root context failed, err: %d, status: 0x%x, out_size: 0x%x" , + err, root_ctxt.status, out_size); +return -EFAULT ; + } + +return 0 ; +} + +int spnic_clean_root_ctxt (void *hwdev) +{ +struct spnic_cmd_root_ctxt root_ctxt; +u16 out_size =sizeof (root_ctxt); +int err; + +if (!hwdev) +return -EINVAL ; + +memset (&root_ctxt,0 ,sizeof (root_ctxt)); + root_ctxt.func_idx =spnic_global_func_id (hwdev); + + err =spnic_msg_to_mgmt_sync (hwdev,SPNIC_MOD_COMM ,MGMT_CMD_SET_VAT , + &root_ctxt,sizeof (root_ctxt), + &root_ctxt, &out_size,0 ); +if (err || !out_size || root_ctxt.status) { +PMD_DRV_LOG (ERR ,"Clean root context failed, err: %d, status: 0x%x, out_size: 0x%x" , + err, root_ctxt.status, out_size); +return -EFAULT ; + } + +return 0 ; +} +int spnic_set_cmdq_depth (void *hwdev,u16 cmdq_depth) {struct spnic_cmd_root_ctxt root_ctxt;
drivers/net/spnic/base/spnic_hw_comm.h +6 -0
@@ -180,6 +180,10 @@ int spnic_get_mgmt_version(void *hwdev, char *mgmt_ver, int max_mgmt_len);int spnic_get_board_info (void *hwdev,struct spnic_board_info *info); +int spnic_set_root_ctxt (void *hwdev,u32 rq_depth,u32 sq_depth,u16 rx_buf_sz); + +int spnic_clean_root_ctxt (void *hwdev); +int spnic_get_interrupt_cfg (void *dev,struct interrupt_info *info);int spnic_set_interrupt_cfg (void *dev,struct interrupt_info info);
@@ -188,6 +192,8 @@ int spnic_set_wq_page_size(void *hwdev, u16 func_idx, u32 page_size);int spnic_set_cmdq_depth (void *hwdev,u16 cmdq_depth); +int spnic_convert_rx_buf_size (u32 rx_buf_sz,u32 *match_sz); +int spnic_get_comm_features (void *hwdev,u64 *s_feature,u16 size);int spnic_set_comm_features (void *hwdev,u64 *s_feature,u16 size);
drivers/net/spnic/base/spnic_nic_cfg.c +76 -0
88 lines not on this page · raw message
drivers/net/spnic/base/spnic_nic_cfg.h +64 -1
99 lines not on this page · raw message
drivers/net/spnic/meson.build +2 -1
@@ -12,6 +12,7 @@ objs = [base_objs] sources = files( 'spnic_ethdev.c', - ) + 'spnic_io.c', +) includes += include_directories('base')
drivers/net/spnic/spnic_ethdev.c +54 -3
131 lines not on this page · raw message
drivers/net/spnic/spnic_io.c new file +738 -0
738 lines not on this page · raw message
drivers/net/spnic/spnic_io.h new file +154 -0
154 lines not on this page · raw message
drivers/net/spnic/spnic_rx.h new file +113 -0
113 lines not on this page · raw message
drivers/net/spnic/spnic_tx.h new file +62 -0
62 lines not on this page · raw message
Signature · 1 line
2.32.0
PATCH v6 12/26 net/spnic: support mbuf handling of Tx/Rx
In reply to Yanling SongThis patch defines a wqe data structure for hardware to learn the sge info and offload info of packet. Furthermore, this commit implements the interfaces to fill wqe with DPDK mbuf.
--- drivers/net/spnic/base/spnic_nic_cfg.c | 23 ++ drivers/net/spnic/base/spnic_nic_cfg.h | 23 ++ drivers/net/spnic/meson.build | 2 + drivers/net/spnic/spnic_ethdev.c | 502 ++++++++++++++++++++++++- drivers/net/spnic/spnic_rx.c | 283 ++++++++++++++ drivers/net/spnic/spnic_rx.h | 41 ++ drivers/net/spnic/spnic_tx.c | 334 ++++++++++++++++ drivers/net/spnic/spnic_tx.h | 228 +++++++++++ 8 files changed, 1435 insertions(+), 1 deletion(-) create mode 100644 drivers/net/spnic/spnic_rx.c create mode 100644 drivers/net/spnic/spnic_tx.c
drivers/net/spnic/base/spnic_nic_cfg.c +23 -0
@@ -378,6 +378,29 @@ int spnic_set_port_enable(void *hwdev, bool enable)return 0 ; } +int spnic_flush_qps_res (void *hwdev) +{ +struct spnic_cmd_clear_qp_resource sq_res; +u16 out_size =sizeof (sq_res); +int err; + +if (!hwdev) +return -EINVAL ; + +memset (&sq_res,0 ,sizeof (sq_res)); + sq_res.func_id =spnic_global_func_id (hwdev); + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_CLEAR_QP_RESOURCE , &sq_res, +sizeof (sq_res), &sq_res, &out_size); +if (err || !out_size || sq_res.msg_head.status) { +PMD_DRV_LOG (ERR ,"Clear sq resources failed, err: %d, status: 0x%x, out size: 0x%x" , + err, sq_res.msg_head.status, out_size); +return -EIO ; + } + +return 0 ; +} +static int spnic_set_function_table (void *hwdev,u32 cfg_bitmap,struct spnic_func_tbl_cfg *cfg) {
drivers/net/spnic/base/spnic_nic_cfg.h +23 -0
@@ -255,6 +255,17 @@ struct spnic_cmd_register_vf {u8 rsvd[39 ]; }; + +struct spnic_cmd_set_rq_flush { +union { +struct { +u16 global_rq_id; +u16 local_rq_id; + }; +u32 value; + }; +}; +int spnic_l2nic_msg_to_mgmt_sync (void *hwdev,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size);
@@ -381,6 +392,18 @@ int spnic_set_port_enable(void *hwdev, bool enable);*/ int spnic_get_link_state (void *hwdev,u8 *link_state); +/** +* Flush queue pairs resource in hardware +* +* @param[in] hwdev +* Device pointer to hwdev +* +* @retval zero : Success +* @retval non-zero : Failure +*/ +int spnic_flush_qps_res (void *hwdev); + +/** * Init nic hwdev *
drivers/net/spnic/meson.build +2 -0
@@ -13,6 +13,8 @@ objs = [base_objs] sources = files( 'spnic_ethdev.c', 'spnic_io.c', + 'spnic_rx.c', + 'spnic_tx.c' ) includes += include_directories('base')
drivers/net/spnic/spnic_ethdev.c +501 -1
566 lines not on this page · raw message
drivers/net/spnic/spnic_rx.c new file +283 -0
283 lines not on this page · raw message
drivers/net/spnic/spnic_rx.h +41 -0
45 lines not on this page · raw message
drivers/net/spnic/spnic_tx.c new file +334 -0
334 lines not on this page · raw message
drivers/net/spnic/spnic_tx.h +228 -0
238 lines not on this page · raw message
Signature · 1 line
2.32.0
PATCH v6 13/26 net/spnic: support Rx congfiguration
In reply to Yanling SongThis patch Rx/Tx configuration including Rx csum offload, LRO, RSS, VLAN filter and VLAN offload.
--- drivers/net/spnic/base/spnic_nic_cfg.c | 525 +++++++++++++++++++++++++ drivers/net/spnic/base/spnic_nic_cfg.h | 387 ++++++++++++++++++ drivers/net/spnic/spnic_ethdev.c | 187 ++++++++- drivers/net/spnic/spnic_ethdev.h | 2 + drivers/net/spnic/spnic_rx.c | 221 +++++++++++ drivers/net/spnic/spnic_rx.h | 31 ++ 6 files changed, 1349 insertions(+), 4 deletions(-)
drivers/net/spnic/base/spnic_nic_cfg.c +525 -0
@@ -271,6 +271,37 @@ int spnic_get_default_mac(void *hwdev, u8 *mac_addr, int ether_len)return 0 ; } +static int spnic_config_vlan (void *hwdev,u8 opcode,u16 vlan_id,u16 func_id) +{ +struct spnic_cmd_vlan_config vlan_info; +u16 out_size =sizeof (vlan_info); +int err; + +memset (&vlan_info,0 ,sizeof (vlan_info)); + vlan_info.opcode = opcode; + vlan_info.func_id = func_id; + vlan_info.vlan_id = vlan_id; + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_CFG_FUNC_VLAN , &vlan_info, +sizeof (vlan_info), &vlan_info, &out_size); +if (err || !out_size || vlan_info.msg_head.status) { +PMD_DRV_LOG (ERR ,"%s vlan failed, err: %d, status: 0x%x, out size: 0x%x" , + opcode ==SPNIC_CMD_OP_ADD ?"Add" :"Delete" , + err, vlan_info.msg_head.status, out_size); +return -EINVAL ; + } + +return 0 ; +} + +int spnic_del_vlan (void *hwdev,u16 vlan_id,u16 func_id) +{ +if (!hwdev) +return -EINVAL ; + +return spnic_config_vlan (hwdev,SPNIC_CMD_OP_DEL , vlan_id, func_id); +} +int spnic_get_port_info (void *hwdev,struct nic_port_info *port_info) {struct spnic_cmd_port_info port_msg;
@@ -564,6 +595,500 @@ void spnic_free_nic_hwdev(void *hwdev)spnic_vf_func_free (hwdev); } +int spnic_set_rx_mode (void *hwdev,u32 enable) +{ +struct spnic_rx_mode_config rx_mode_cfg; +u16 out_size =sizeof (rx_mode_cfg); +int err; + +if (!hwdev) +return -EINVAL ; + +memset (&rx_mode_cfg,0 ,sizeof (rx_mode_cfg)); + rx_mode_cfg.func_id =spnic_global_func_id (hwdev); + rx_mode_cfg.rx_mode = enable; + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_SET_RX_MODE , + &rx_mode_cfg,sizeof (rx_mode_cfg), + &rx_mode_cfg, &out_size); +if (err || !out_size || rx_mode_cfg.msg_head.status) { +PMD_DRV_LOG (ERR ,"Set rx mode failed, err: %d, status: 0x%x, out size: 0x%x" , + err, rx_mode_cfg.msg_head.status, out_size); +return -EIO ; + } + +return 0 ; +} + +int spnic_set_rx_vlan_offload (void *hwdev,u8 en) +{ +struct spnic_cmd_vlan_offload vlan_cfg; +u16 out_size =sizeof (vlan_cfg); +int err; + +if (!hwdev) +return -EINVAL ; + +memset (&vlan_cfg,0 ,sizeof (vlan_cfg)); + vlan_cfg.func_id =spnic_global_func_id (hwdev); + vlan_cfg.vlan_offload = en; + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_SET_RX_VLAN_OFFLOAD , + &vlan_cfg,sizeof (vlan_cfg), + &vlan_cfg, &out_size); +if (err || !out_size || vlan_cfg.msg_head.status) { +PMD_DRV_LOG (ERR ,"Set rx vlan offload failed, err: %d, status: 0x%x, out size: 0x%x" , + err, vlan_cfg.msg_head.status, out_size); +return -EIO ; + } + +return 0 ; +} + +int spnic_set_vlan_fliter (void *hwdev,u32 vlan_filter_ctrl) +{ +struct spnic_cmd_set_vlan_filter vlan_filter; +u16 out_size =sizeof (vlan_filter); +int err; + +if (!hwdev) +return -EINVAL ; + +memset (&vlan_filter,0 ,sizeof (vlan_filter)); + vlan_filter.func_id =spnic_global_func_id (hwdev); + vlan_filter.vlan_filter_ctrl = vlan_filter_ctrl; + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_SET_VLAN_FILTER_EN , + &vlan_filter,sizeof (vlan_filter), + &vlan_filter, &out_size); +if (err || !out_size || vlan_filter.msg_head.status) { +PMD_DRV_LOG (ERR ,"Failed to set vlan filter, err: %d, status: 0x%x, out size: 0x%x" , + err, vlan_filter.msg_head.status, out_size); +return -EIO ; + } + +return 0 ; +} + +static int spnic_set_rx_lro (void *hwdev,u8 ipv4_en,u8 ipv6_en, +u8 lro_max_pkt_len) +{ +struct spnic_cmd_lro_config lro_cfg; +u16 out_size =sizeof (lro_cfg); +int err; + +if (!hwdev) +return -EINVAL ; + +memset (&lro_cfg,0 ,sizeof (lro_cfg)); + lro_cfg.func_id =spnic_global_func_id (hwdev); + lro_cfg.opcode =SPNIC_CMD_OP_SET ; + lro_cfg.lro_ipv4_en = ipv4_en; + lro_cfg.lro_ipv6_en = ipv6_en; + lro_cfg.lro_max_pkt_len = lro_max_pkt_len; + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_CFG_RX_LRO , &lro_cfg, +sizeof (lro_cfg), &lro_cfg, &out_size); +if (err || !out_size || lro_cfg.msg_head.status) { +PMD_DRV_LOG (ERR ,"Set lro offload failed, err: %d, status: 0x%x, out size: 0x%x" , + err, lro_cfg.msg_head.status, out_size); +return -EIO ; + } + +return 0 ; +} + +static int spnic_set_rx_lro_timer (void *hwdev,u32 timer_value) +{ +struct spnic_cmd_lro_timer lro_timer; +u16 out_size =sizeof (lro_timer); +int err; + +if (!hwdev) +return -EINVAL ; + +memset (&lro_timer,0 ,sizeof (lro_timer)); + lro_timer.opcode =SPNIC_CMD_OP_SET ; + lro_timer.timer = timer_value; + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_CFG_LRO_TIMER , &lro_timer, +sizeof (lro_timer), &lro_timer, &out_size); +if (err || !out_size || lro_timer.msg_head.status) { +PMD_DRV_LOG (ERR ,"Set lro timer failed, err: %d, status: 0x%x, out size: 0x%x" , + err, lro_timer.msg_head.status, out_size); + +return -EIO ; + } + +return 0 ; +} + +int spnic_set_rx_lro_state (void *hwdev,u8 lro_en,u32 lro_timer, +u32 lro_max_pkt_len) +{ +u8 ipv4_en =0 , ipv6_en =0 ; +int err; + +if (!hwdev) +return -EINVAL ; + + ipv4_en = lro_en ?1 :0 ; + ipv6_en = lro_en ?1 :0 ; + +PMD_DRV_LOG (INFO ,"Set LRO max coalesce packet size to %uK" , + lro_max_pkt_len); + + err =spnic_set_rx_lro (hwdev, ipv4_en, ipv6_en, (u8 )lro_max_pkt_len); +if (err) +return err; + +/* We don't set LRO timer for VF */ +if (spnic_func_type (hwdev) ==TYPE_VF ) +return 0 ; + +PMD_DRV_LOG (INFO ,"Set LRO timer to %u" , lro_timer); + +return spnic_set_rx_lro_timer (hwdev, lro_timer); +} + +/* RSS config */ +int spnic_rss_template_alloc (void *hwdev) +{ +struct spnic_rss_template_mgmt template_mgmt; +u16 out_size =sizeof (template_mgmt); +int err; + +if (!hwdev) +return -EINVAL ; + +memset (&template_mgmt,0 ,sizeof (struct spnic_rss_template_mgmt )); + template_mgmt.func_id =spnic_global_func_id (hwdev); + template_mgmt.cmd =NIC_RSS_CMD_TEMP_ALLOC ; + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_RSS_TEMP_MGR , + &template_mgmt,sizeof (template_mgmt), + &template_mgmt, &out_size); +if (err || !out_size || template_mgmt.msg_head.status) { +if (template_mgmt.msg_head.status == +SPNIC_MGMT_STATUS_TABLE_FULL ) { +PMD_DRV_LOG (ERR ,"There is no more template available" ); +return -ENOSPC ; + } +PMD_DRV_LOG (ERR ,"Alloc rss template failed, err: %d, " +"status: 0x%x, out size: 0x%x" , + err, template_mgmt.msg_head.status, out_size); +return -EFAULT ; + } + +return 0 ; +} + +int spnic_rss_template_free (void *hwdev) +{ +struct spnic_rss_template_mgmt template_mgmt; +u16 out_size =sizeof (template_mgmt); +int err; + +if (!hwdev) +return -EINVAL ; + +memset (&template_mgmt,0 ,sizeof (struct spnic_rss_template_mgmt )); + template_mgmt.func_id =spnic_global_func_id (hwdev); + template_mgmt.cmd =NIC_RSS_CMD_TEMP_FREE ; + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_RSS_TEMP_MGR , + &template_mgmt,sizeof (template_mgmt), + &template_mgmt, &out_size); +if (err || !out_size || template_mgmt.msg_head.status) { +PMD_DRV_LOG (ERR ,"Free rss template failed, err: %d, " +"status: 0x%x, out size: 0x%x" , + err, template_mgmt.msg_head.status, out_size); +return -EFAULT ; + } + +return 0 ; +} + +static int spnic_rss_cfg_hash_key (void *hwdev,u8 opcode,u8 *key) +{ +struct spnic_cmd_rss_hash_key hash_key; +u16 out_size =sizeof (hash_key); +int err; + +if (!hwdev || !key) +return -EINVAL ; + +memset (&hash_key,0 ,sizeof (struct spnic_cmd_rss_hash_key )); + hash_key.func_id =spnic_global_func_id (hwdev); + hash_key.opcode = opcode; +if (opcode ==SPNIC_CMD_OP_SET ) +memcpy (hash_key.key, key,SPNIC_RSS_KEY_SIZE ); + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_CFG_RSS_HASH_KEY , + &hash_key,sizeof (hash_key), + &hash_key, &out_size); +if (err || !out_size || hash_key.msg_head.status) { +PMD_DRV_LOG (ERR ,"%s hash key failed, err: %d, " +"status: 0x%x, out size: 0x%x" , + opcode ==SPNIC_CMD_OP_SET ?"Set" :"Get" , + err, hash_key.msg_head.status, out_size); +return -EFAULT ; + } + +if (opcode ==SPNIC_CMD_OP_GET ) +memcpy (key, hash_key.key,SPNIC_RSS_KEY_SIZE ); + +return 0 ; +} + +int spnic_rss_set_hash_key (void *hwdev,u8 *key) +{ +if (!hwdev || !key) +return -EINVAL ; + +return spnic_rss_cfg_hash_key (hwdev,SPNIC_CMD_OP_SET , key); +} + +int spnic_rss_get_hash_key (void *hwdev,u8 *key) +{ +if (!hwdev || !key) +return -EINVAL ; + +return spnic_rss_cfg_hash_key (hwdev,SPNIC_CMD_OP_GET , key); +} + +int spnic_rss_get_indir_tbl (void *hwdev,u32 *indir_table) +{ +struct spnic_cmd_buf *cmd_buf =NULL ; +u16 *indir_tbl =NULL ; +int err, i; + +if (!hwdev || !indir_table) +return -EINVAL ; + + cmd_buf =spnic_alloc_cmd_buf (hwdev); +if (!cmd_buf) { +PMD_DRV_LOG (ERR ,"Allocate cmd buf failed" ); +return -ENOMEM ; + } + + cmd_buf->size =sizeof (struct nic_rss_indirect_tbl ); + err =spnic_cmdq_detail_resp (hwdev,SPNIC_MOD_L2NIC , +SPNIC_UCODE_CMD_GET_RSS_INDIR_TABLE , + cmd_buf, cmd_buf,0 ); +if (err) { +PMD_DRV_LOG (ERR ,"Get rss indir table failed" ); +spnic_free_cmd_buf (cmd_buf); +return err; + } + + indir_tbl = (u16 *)cmd_buf->buf; +for (i =0 ; i <SPNIC_RSS_INDIR_SIZE ; i++) + indir_table[i] = *(indir_tbl + i); + +spnic_free_cmd_buf (cmd_buf); +return 0 ; +} + +int spnic_rss_set_indir_tbl (void *hwdev,const u32 *indir_table) +{ +struct nic_rss_indirect_tbl *indir_tbl =NULL ; +struct spnic_cmd_buf *cmd_buf =NULL ; +u32 i, size; +u32 *temp =NULL ; +u64 out_param =0 ; +int err; + +if (!hwdev || !indir_table) +return -EINVAL ; + + cmd_buf =spnic_alloc_cmd_buf (hwdev); +if (!cmd_buf) { +PMD_DRV_LOG (ERR ,"Allocate cmd buf failed" ); +return -ENOMEM ; + } + + cmd_buf->size =sizeof (struct nic_rss_indirect_tbl ); + indir_tbl = (struct nic_rss_indirect_tbl *)cmd_buf->buf; +memset (indir_tbl,0 ,sizeof (*indir_tbl)); + +for (i =0 ; i <SPNIC_RSS_INDIR_SIZE ; i++) + indir_tbl->entry[i] = (u16)(*(indir_table + i)); + + size = (sizeof (indir_tbl->entry)) / (sizeof (u32)); + temp = (u32 *)indir_tbl->entry; +for (i =0 ; i < size; i++) + temp[i] =cpu_to_be32 (temp[i]); + + err =spnic_cmdq_direct_resp (hwdev,SPNIC_MOD_L2NIC , +SPNIC_UCODE_CMD_SET_RSS_INDIR_TABLE , + cmd_buf, &out_param,0 ); +if (err || out_param !=0 ) { +PMD_DRV_LOG (ERR ,"Set rss indir table failed" ); + err = -EFAULT ; + } + +spnic_free_cmd_buf (cmd_buf); +return err; +} + +int spnic_set_rss_type (void *hwdev,struct spnic_rss_type rss_type) +{ +struct nic_rss_context_tbl *ctx_tbl =NULL ; +struct spnic_cmd_buf *cmd_buf =NULL ; +u32 ctx =0 ; +u64 out_param =0 ; +int err; + +if (!hwdev) +return -EINVAL ; + + cmd_buf =spnic_alloc_cmd_buf (hwdev); +if (!cmd_buf) { +PMD_DRV_LOG (ERR ,"Allocate cmd buf failed" ); +return -ENOMEM ; + } + + ctx |=SPNIC_RSS_TYPE_SET (1 ,VALID ) | +SPNIC_RSS_TYPE_SET (rss_type.ipv4,IPV4 ) | +SPNIC_RSS_TYPE_SET (rss_type.ipv6,IPV6 ) | +SPNIC_RSS_TYPE_SET (rss_type.ipv6_ext,IPV6_EXT ) | +SPNIC_RSS_TYPE_SET (rss_type.tcp_ipv4,TCP_IPV4 ) | +SPNIC_RSS_TYPE_SET (rss_type.tcp_ipv6,TCP_IPV6 ) | +SPNIC_RSS_TYPE_SET (rss_type.tcp_ipv6_ext,TCP_IPV6_EXT ) | +SPNIC_RSS_TYPE_SET (rss_type.udp_ipv4,UDP_IPV4 ) | +SPNIC_RSS_TYPE_SET (rss_type.udp_ipv6,UDP_IPV6 ); + + cmd_buf->size =sizeof (struct nic_rss_context_tbl ); + ctx_tbl = (struct nic_rss_context_tbl *)cmd_buf->buf; +memset (ctx_tbl,0 ,sizeof (*ctx_tbl)); + ctx_tbl->ctx =cpu_to_be32 (ctx); + +/* Cfg the RSS context table by command queue */ + err =spnic_cmdq_direct_resp (hwdev,SPNIC_MOD_L2NIC , +SPNIC_UCODE_CMD_SET_RSS_CONTEXT_TABLE , + cmd_buf, &out_param,0 ); + +spnic_free_cmd_buf (cmd_buf); + +if (err || out_param !=0 ) { +PMD_DRV_LOG (ERR ,"Set rss context table failed, err: %d" , err); +return -EFAULT ; + } + +return 0 ; +} + +int spnic_get_rss_type (void *hwdev,struct spnic_rss_type *rss_type) +{ +struct spnic_rss_context_table ctx_tbl; +u16 out_size =sizeof (ctx_tbl); +int err; + +if (!hwdev || !rss_type) +return -EINVAL ; + +memset (&ctx_tbl,0 ,sizeof (struct spnic_rss_context_table )); + ctx_tbl.func_id =spnic_global_func_id (hwdev); + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_GET_RSS_CTX_TBL , + &ctx_tbl,sizeof (ctx_tbl), + &ctx_tbl, &out_size); +if (err || !out_size || ctx_tbl.msg_head.status) { +PMD_DRV_LOG (ERR ,"Get hash type failed, err: %d, status: 0x%x, out size: 0x%x" , + err, ctx_tbl.msg_head.status, out_size); +return -EFAULT ; + } + + rss_type->ipv4 =SPNIC_RSS_TYPE_GET (ctx_tbl.context,IPV4 ); + rss_type->ipv6 =SPNIC_RSS_TYPE_GET (ctx_tbl.context,IPV6 ); + rss_type->ipv6_ext =SPNIC_RSS_TYPE_GET (ctx_tbl.context,IPV6_EXT ); + rss_type->tcp_ipv4 =SPNIC_RSS_TYPE_GET (ctx_tbl.context,TCP_IPV4 ); + rss_type->tcp_ipv6 =SPNIC_RSS_TYPE_GET (ctx_tbl.context,TCP_IPV6 ); + rss_type->tcp_ipv6_ext =SPNIC_RSS_TYPE_GET (ctx_tbl.context, +TCP_IPV6_EXT ); + rss_type->udp_ipv4 =SPNIC_RSS_TYPE_GET (ctx_tbl.context,UDP_IPV4 ); + rss_type->udp_ipv6 =SPNIC_RSS_TYPE_GET (ctx_tbl.context,UDP_IPV6 ); + +return 0 ; +} + +static int spnic_rss_cfg_hash_engine (void *hwdev,u8 opcode,u8 *type) +{ +struct spnic_cmd_rss_engine_type hash_type; +u16 out_size =sizeof (hash_type); +int err; + +if (!hwdev || !type) +return -EINVAL ; + +memset (&hash_type,0 ,sizeof (struct spnic_cmd_rss_engine_type )); + hash_type.func_id =spnic_global_func_id (hwdev); + hash_type.opcode = opcode; +if (opcode ==SPNIC_CMD_OP_SET ) + hash_type.hash_engine = *type; + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_CFG_RSS_HASH_ENGINE , + &hash_type,sizeof (hash_type), + &hash_type, &out_size); +if (err || !out_size || hash_type.msg_head.status) { +PMD_DRV_LOG (ERR ,"%s hash engine failed, err: %d, " +"status: 0x%x, out size: 0x%x" , + opcode ==SPNIC_CMD_OP_SET ?"Set" :"Get" , + err, hash_type.msg_head.status, out_size); +return -EFAULT ; + } + +if (opcode ==SPNIC_CMD_OP_GET ) + *type = hash_type.hash_engine; + +return 0 ; +} + +int spnic_rss_get_hash_engine (void *hwdev,u8 *type) +{ +if (!hwdev || !type) +return -EINVAL ; + +return spnic_rss_cfg_hash_engine (hwdev,SPNIC_CMD_OP_GET , type); +} + +int spnic_rss_set_hash_engine (void *hwdev,u8 type) +{ +if (!hwdev) +return -EINVAL ; + +return spnic_rss_cfg_hash_engine (hwdev,SPNIC_CMD_OP_SET , &type); +} + +int spnic_rss_cfg (void *hwdev,u8 rss_en,u8 tc_num,u8 *prio_tc) +{ +struct spnic_cmd_rss_config rss_cfg; +u16 out_size =sizeof (rss_cfg); +int err; + +/* Ucode requires number of TC should be power of 2 */ +if (!hwdev || !prio_tc || (tc_num & (tc_num -1 ))) +return -EINVAL ; + +memset (&rss_cfg,0 ,sizeof (struct spnic_cmd_rss_config )); + rss_cfg.func_id =spnic_global_func_id (hwdev); + rss_cfg.rss_en = rss_en; + rss_cfg.rq_priority_number = tc_num ? (u8 )ilog2 (tc_num) :0 ; + +memcpy (rss_cfg.prio_tc, prio_tc,SPNIC_DCB_UP_MAX ); + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_RSS_CFG , &rss_cfg, +sizeof (rss_cfg), &rss_cfg, &out_size); +if (err || !out_size || rss_cfg.msg_head.status) { +PMD_DRV_LOG (ERR ,"Set rss cfg failed, err: %d, " +"status: 0x%x, out size: 0x%x" , + err, rss_cfg.msg_head.status, out_size); +return -EFAULT ; + } + +return 0 ; +} +int spnic_vf_get_default_cos (void *hwdev,u8 *cos_id) {struct spnic_cmd_vf_dcb_state vf_dcb;
drivers/net/spnic/base/spnic_nic_cfg.h +387 -0
426 lines not on this page · raw message
drivers/net/spnic/spnic_ethdev.c +183 -4
234 lines not on this page · raw message
drivers/net/spnic/spnic_ethdev.h +2 -0
@@ -63,6 +63,8 @@ struct spnic_nic_dev {u32 default_cos;u32 rx_csum_en; +u8 rss_key[SPNIC_RSS_KEY_SIZE ]; +u32 dev_status;bool pause_set;
drivers/net/spnic/spnic_rx.c +221 -0
240 lines not on this page · raw message
drivers/net/spnic/spnic_rx.h +31 -0
@@ -5,6 +5,23 @@ #ifndef _SPNIC_RX_H_ #define _SPNIC_RX_H_ +#define SPNIC_DEFAULT_RX_CSUM_OFFLOAD 0xFFF + +#define SPNIC_RSS_OFFLOAD_ALL ( \ + ETH_RSS_IPV4 | \ + ETH_RSS_FRAG_IPV4 | \ + ETH_RSS_NONFRAG_IPV4_TCP | \ + ETH_RSS_NONFRAG_IPV4_UDP | \ + ETH_RSS_NONFRAG_IPV4_OTHER | \ + ETH_RSS_IPV6 | \ + ETH_RSS_FRAG_IPV6 | \ + ETH_RSS_NONFRAG_IPV6_TCP | \ + ETH_RSS_NONFRAG_IPV6_UDP | \ + ETH_RSS_NONFRAG_IPV6_OTHER | \ + ETH_RSS_IPV6_EX | \ + ETH_RSS_IPV6_TCP_EX | \ + ETH_RSS_IPV6_UDP_EX) + struct spnic_rxq_stats { u64 packets; u64 bytes;
@@ -118,7 +135,21 @@ void spnic_free_rxq_mbufs(struct spnic_rxq *rxq);void spnic_free_all_rxq_mbufs (struct spnic_nic_dev *nic_dev); +int spnic_update_rss_config (struct rte_eth_dev *dev, +struct rte_eth_rss_conf *rss_conf); +int spnic_start_all_rqs (struct rte_eth_dev *eth_dev); + +void spnic_add_rq_to_rx_queue_list (struct spnic_nic_dev *nic_dev, +u16 queue_id); + +int spnic_refill_indir_rqid (struct spnic_rxq *rxq); + +void spnic_init_rx_queue_list (struct spnic_nic_dev *nic_dev); + +void spnic_remove_rq_from_rx_queue_list (struct spnic_nic_dev *nic_dev, +u16 queue_id); +/** * Get receive queue local ci *
Signature · 1 line
2.32.0
PATCH v6 14/26 net/spnic: add port/vport enable
In reply to Yanling SongThis patch adds interface to enable port/vport so that the hardware would receive packets to host.
--- drivers/net/spnic/spnic_ethdev.c | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
drivers/net/spnic/spnic_ethdev.c +46 -0
@@ -855,8 +855,10 @@ static void spnic_deinit_sw_rxtxqs(struct spnic_nic_dev *nic_dev)static int spnic_dev_start (struct rte_eth_dev *eth_dev) {struct spnic_nic_dev *nic_dev; +struct spnic_rxq *rxq =NULL ;u64 nic_features;int err; +u16 i; nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (eth_dev);
@@ -916,6 +918,22 @@ static int spnic_dev_start(struct rte_eth_dev *eth_dev)spnic_start_all_sqs (eth_dev); +/* Open virtual port and ready to start packet receiving */ + err =spnic_set_vport_enable (nic_dev->hwdev, true); +if (err) { +PMD_DRV_LOG (ERR ,"Enable vport failed, dev_name: %s" , + eth_dev->data->name); + goto en_vport_fail; + } + +/* Open physical port and start packet receiving */ + err =spnic_set_port_enable (nic_dev->hwdev, true); +if (err) { +PMD_DRV_LOG (ERR ,"Enable physical port failed, dev_name: %s" , + eth_dev->data->name); + goto en_port_fail; + } +/* Update eth_dev link status */ if (eth_dev->data->dev_conf.intr_conf.lsc !=0 ) (void )spnic_link_update (eth_dev,0 );
@@ -924,6 +942,20 @@ static int spnic_dev_start(struct rte_eth_dev *eth_dev)return 0 ; +en_port_fail: + (void )spnic_set_vport_enable (nic_dev->hwdev, false); + +en_vport_fail: +/* Flush tx && rx chip resources in case of setting vport fake fail */ + (void )spnic_flush_qps_res (nic_dev->hwdev); +rte_delay_ms (100 ); +for (i =0 ; i < nic_dev->num_rqs; i++) { + rxq = nic_dev->rxqs[i]; +spnic_remove_rq_from_rx_queue_list (nic_dev, rxq->q_id); +spnic_free_rxq_mbufs (rxq); + eth_dev->data->rx_queue_state[i] =RTE_ETH_QUEUE_STATE_STOPPED ; + eth_dev->data->tx_queue_state[i] =RTE_ETH_QUEUE_STATE_STOPPED ; + } start_rqs_fail:spnic_remove_rxtx_configure (eth_dev);
@@ -951,6 +983,7 @@ static int spnic_dev_stop(struct rte_eth_dev *dev) {struct spnic_nic_dev *nic_dev;struct rte_eth_link link; +int err; nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev);if (!rte_bit_relaxed_test_and_clear32 (SPNIC_DEV_START , &nic_dev->dev_status)) {
@@ -959,6 +992,19 @@ static int spnic_dev_stop(struct rte_eth_dev *dev)return 0 ; } +/* Stop phy port and vport */ + err =spnic_set_port_enable (nic_dev->hwdev, false); +if (err) +PMD_DRV_LOG (WARNING ,"Disable phy port failed, error: %d, " +"dev_name: %s, port_id: %d" , err, dev->data->name, + dev->data->port_id); + + err =spnic_set_vport_enable (nic_dev->hwdev, false); +if (err) +PMD_DRV_LOG (WARNING ,"Disable vport failed, error: %d, " +"dev_name: %s, port_id: %d" , err, dev->data->name, + dev->data->port_id); +/* Clear recorded link status */ memset (&link,0 ,sizeof (link)); (void )rte_eth_linkstatus_set (dev, &link);
Signature · 1 line
2.32.0
PATCH v6 15/26 net/spnic: support IO packets handling
In reply to Yanling SongThis patch implements rx_pkt_burst() and tx_pkt_burst() to hanld IO packets.
For Tx packets, this commit implements parsing ol_flags of mbuf and filling those offload info on wqe so that hardware can process the packets correctly. Furthermore, this commit allocates a mempool to cover scenes with too many mbufs for one packet.
For Rx packets, this commit implements filling ol_flags of mbuf and rearming new mbuf and rq wqe.
--- drivers/net/spnic/spnic_ethdev.c | 48 +++ drivers/net/spnic/spnic_ethdev.h | 7 + drivers/net/spnic/spnic_rx.c | 209 ++++++++++++ drivers/net/spnic/spnic_rx.h | 137 ++++++++ drivers/net/spnic/spnic_tx.c | 524 +++++++++++++++++++++++++++++++ drivers/net/spnic/spnic_tx.h | 7 + 6 files changed, 932 insertions(+)
drivers/net/spnic/spnic_ethdev.c +48 -0
@@ -970,6 +970,32 @@ static int spnic_dev_start(struct rte_eth_dev *eth_dev)return err; } +static int spnic_copy_mempool_init (struct spnic_nic_dev *nic_dev) +{ + nic_dev->cpy_mpool =rte_mempool_lookup (nic_dev->dev_name); +if (nic_dev->cpy_mpool ==NULL ) { + nic_dev->cpy_mpool = +rte_pktmbuf_pool_create (nic_dev->dev_name, +SPNIC_COPY_MEMPOOL_DEPTH ,0 ,0 , +SPNIC_COPY_MBUF_SIZE ,rte_socket_id ()); +if (nic_dev->cpy_mpool ==NULL ) { +PMD_DRV_LOG (ERR ,"Create copy mempool failed, errno: %d, dev_name: %s" , + rte_errno, nic_dev->dev_name); +return -ENOMEM ; + } + } + +return 0 ; +} + +static void spnic_copy_mempool_uninit (struct spnic_nic_dev *nic_dev) +{ +if (nic_dev->cpy_mpool !=NULL ) { +rte_mempool_free (nic_dev->cpy_mpool); + nic_dev->cpy_mpool =NULL ; + } +} +/** * Stop the device. *
@@ -986,6 +1012,9 @@ static int spnic_dev_stop(struct rte_eth_dev *dev)int err; nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +if (!nic_dev || !spnic_support_nic (nic_dev->hwdev)) +return 0 ; +if (!rte_bit_relaxed_test_and_clear32 (SPNIC_DEV_START , &nic_dev->dev_status)) {PMD_DRV_LOG (INFO ,"Device %s already stopped" , nic_dev->dev_name);
@@ -1014,6 +1043,11 @@ static int spnic_dev_stop(struct rte_eth_dev *dev)spnic_flush_qps_res (nic_dev->hwdev); +/* +* After set vport disable 100ms, no packets will be send to host +*/ +rte_delay_ms (100 ); +/* Clean RSS table and rx_mode */ spnic_remove_rxtx_configure (dev);
@@ -1054,6 +1088,7 @@ static int spnic_dev_close(struct rte_eth_dev *eth_dev)for (qid =0 ; qid < nic_dev->num_rqs; qid++)spnic_rx_queue_release (eth_dev, qid); +spnic_copy_mempool_uninit (nic_dev);spnic_deinit_sw_rxtxqs (nic_dev);spnic_deinit_mac_addr (eth_dev);rte_free (nic_dev->mc_list);
@@ -1067,6 +1102,8 @@ static int spnic_dev_close(struct rte_eth_dev *eth_dev)spnic_free_nic_hwdev (nic_dev->hwdev);spnic_free_hwdev (nic_dev->hwdev); + eth_dev->rx_pkt_burst =NULL ; + eth_dev->tx_pkt_burst =NULL ; eth_dev->dev_ops =NULL ;rte_free (nic_dev->hwdev);
@@ -1547,6 +1584,13 @@ static int spnic_func_init(struct rte_eth_dev *eth_dev) goto set_default_feature_fail; } + err =spnic_copy_mempool_init (nic_dev); +if (err) { +PMD_DRV_LOG (ERR ,"Create copy mempool failed, dev_name: %s" , + eth_dev->data->name); + goto init_mpool_fail; + } +spnic_mutex_init (&nic_dev->rx_mode_mutex,NULL );rte_bit_relaxed_set32 (SPNIC_DEV_INTR_EN , &nic_dev->dev_status);
@@ -1557,6 +1601,7 @@ static int spnic_func_init(struct rte_eth_dev *eth_dev)return 0 ; +init_mpool_fail: set_default_feature_fail:spnic_deinit_mac_addr (eth_dev);
@@ -1601,6 +1646,9 @@ static int spnic_dev_init(struct rte_eth_dev *eth_dev) (rte_eal_process_type () ==RTE_PROC_PRIMARY ) ? "primary" : "secondary"); + eth_dev->rx_pkt_burst = spnic_recv_pkts; + eth_dev->tx_pkt_burst = spnic_xmit_pkts; +return spnic_func_init (eth_dev); }
drivers/net/spnic/spnic_ethdev.h +7 -0
@@ -4,6 +4,9 @@#ifndef _SPNIC_ETHDEV_H_#define _SPNIC_ETHDEV_H_ + +#define SPNIC_COPY_MEMPOOL_DEPTH 128 +#define SPNIC_COPY_MBUF_SIZE 4096#define SPNIC_DEV_NAME_LEN 32#define SPNIC_UINT32_BIT_SIZE (CHAR_BIT * sizeof(uint32_t))
@@ -17,6 +20,10 @@ enum spnic_dev_status {SPNIC_DEV_INTR_EN }; +enum spnic_tx_cvlan_type { +SPNIC_TX_TPID0 , +}; +enum nic_feature_cap {NIC_F_CSUM =BIT (0 ),NIC_F_SCTP_CRC =BIT (1 ),
drivers/net/spnic/spnic_rx.c +209 -0
218 lines not on this page · raw message
drivers/net/spnic/spnic_rx.h +137 -0
151 lines not on this page · raw message
drivers/net/spnic/spnic_tx.c +524 -0
536 lines not on this page · raw message
drivers/net/spnic/spnic_tx.h +7 -0
@@ -4,6 +4,13 @@ #ifndef _SPNIC_TX_H_ #define _SPNIC_TX_H_ +#define MAX_SINGLE_SGE_SIZE 65536 +#define SPNIC_NONTSO_PKT_MAX_SGE 38 +#define SPNIC_NONTSO_SEG_NUM_VALID(num) \ + ((num) <= SPNIC_NONTSO_PKT_MAX_SGE) + +#define SPNIC_TSO_PKT_MAX_SGE 127 +#define SPNIC_TSO_SEG_NUM_INVALID(num) ((num) > SPNIC_TSO_PKT_MAX_SGE) /* Tx offload info */ struct spnic_tx_offload_info { u8 outer_l2_len;
Signature · 1 line
2.32.0
PATCH v6 16/26 net/spnic: add device configure/version/info
In reply to Yanling SongThis commit adds the callbacks to configure queue number and mtu as well as query configuration information and firmware version.
--- drivers/net/spnic/spnic_ethdev.c | 129 ++++++++++++++++++++++++++++++- 1 file changed, 127 insertions(+), 2 deletions(-)
drivers/net/spnic/spnic_ethdev.c +127 -2
@@ -71,12 +71,131 @@ enum spnic_rx_mod {#define SPNIC_TXD_ALIGN 1#define SPNIC_RXD_ALIGN 1 +static const struct rte_eth_desc_lim spnic_rx_desc_lim = { + .nb_max =SPNIC_MAX_QUEUE_DEPTH , + .nb_min =SPNIC_MIN_QUEUE_DEPTH , + .nb_align =SPNIC_RXD_ALIGN , +}; + +static const struct rte_eth_desc_lim spnic_tx_desc_lim = { + .nb_max =SPNIC_MAX_QUEUE_DEPTH , + .nb_min =SPNIC_MIN_QUEUE_DEPTH , + .nb_align =SPNIC_TXD_ALIGN , +}; +/** -* Deinit mac_vlan table in hardware. +* Ethernet device configuration. * -* @param[in] eth_dev +* Prepare the driver for a given number of TX and RX queues, mtu size +* and configure RSS. +* +* @param[in] dev +* Pointer to ethernet device structure. +* +* @retval zero : Success +* @retval non-zero : Failure. +*/ +static int spnic_dev_configure (struct rte_eth_dev *dev) +{ +struct spnic_nic_dev *nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); + + nic_dev->num_sqs = dev->data->nb_tx_queues; + nic_dev->num_rqs = dev->data->nb_rx_queues; + + nic_dev->mtu_size = +SPNIC_PKTLEN_TO_MTU (dev->data->dev_conf.rxmode.mtu); + +if (dev->data->dev_conf.rxmode.mq_mode Ð_MQ_RX_RSS_FLAG ) + dev->data->dev_conf.rxmode.offloads |=DEV_RX_OFFLOAD_RSS_HASH ; + +return 0 ; +} + +/** +* Get information about the device. +* +* @param[in] dev * Pointer to ethernet device structure. +* @param[out] info +* Info structure for ethernet device. +* +* @retval zero : Success +* @retval non-zero : Failure. */ +static int spnic_dev_infos_get (struct rte_eth_dev *dev, +struct rte_eth_dev_info *info) +{ +struct spnic_nic_dev *nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); + + info->max_rx_queues = nic_dev->max_rqs; + info->max_tx_queues = nic_dev->max_sqs; + info->min_rx_bufsize =SPNIC_MIN_RX_BUF_SIZE ; + info->max_rx_pktlen =SPNIC_MAX_JUMBO_FRAME_SIZE ; + info->max_mac_addrs =SPNIC_MAX_UC_MAC_ADDRS ; + info->min_mtu =SPNIC_MIN_MTU_SIZE ; + info->max_mtu =SPNIC_MAX_MTU_SIZE ; + info->max_lro_pkt_size =SPNIC_MAX_LRO_SIZE ; + + info->rx_queue_offload_capa =0 ; + info->rx_offload_capa =DEV_RX_OFFLOAD_VLAN_STRIP | +DEV_RX_OFFLOAD_IPV4_CKSUM | +DEV_RX_OFFLOAD_UDP_CKSUM | +DEV_RX_OFFLOAD_TCP_CKSUM | +DEV_RX_OFFLOAD_SCTP_CKSUM | +DEV_RX_OFFLOAD_VLAN_FILTER | +DEV_RX_OFFLOAD_SCATTER | +DEV_RX_OFFLOAD_TCP_LRO | +DEV_RX_OFFLOAD_RSS_HASH ; + + info->tx_queue_offload_capa =0 ; + info->tx_offload_capa =DEV_TX_OFFLOAD_VLAN_INSERT | +DEV_TX_OFFLOAD_IPV4_CKSUM | +DEV_TX_OFFLOAD_UDP_CKSUM | +DEV_TX_OFFLOAD_TCP_CKSUM | +DEV_TX_OFFLOAD_SCTP_CKSUM | +DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | +DEV_TX_OFFLOAD_TCP_TSO | +DEV_TX_OFFLOAD_MULTI_SEGS ; + + info->hash_key_size =SPNIC_RSS_KEY_SIZE ; + info->reta_size =SPNIC_RSS_INDIR_SIZE ; + info->flow_type_rss_offloads =SPNIC_RSS_OFFLOAD_ALL ; + + info->rx_desc_lim = spnic_rx_desc_lim; + info->tx_desc_lim = spnic_tx_desc_lim; + +/* Driver-preferred rx/tx parameters */ + info->default_rxportconf.burst_size =SPNIC_DEFAULT_BURST_SIZE ; + info->default_txportconf.burst_size =SPNIC_DEFAULT_BURST_SIZE ; + info->default_rxportconf.nb_queues =SPNIC_DEFAULT_NB_QUEUES ; + info->default_txportconf.nb_queues =SPNIC_DEFAULT_NB_QUEUES ; + info->default_rxportconf.ring_size =SPNIC_DEFAULT_RING_SIZE ; + info->default_txportconf.ring_size =SPNIC_DEFAULT_RING_SIZE ; + +return 0 ; +} + +static int spnic_fw_version_get (struct rte_eth_dev *dev,char *fw_version, +size_t fw_size) +{ +struct spnic_nic_dev *nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +char mgmt_ver[MGMT_VERSION_MAX_LEN ] = {0 }; +int err; + + err =spnic_get_mgmt_version (nic_dev->hwdev, mgmt_ver, +SPNIC_MGMT_VERSION_MAX_LEN ); +if (err) { +PMD_DRV_LOG (ERR ,"Get fw version failed" ); +return -EIO ; + } + +if (fw_size <strlen (mgmt_ver) +1 ) +return (strlen (mgmt_ver) +1 ); + +snprintf (fw_version, fw_size,"%s" , mgmt_ver); + +return 0 ; +}/** * Set ethernet device link state up.
@@ -1332,6 +1451,9 @@ static int spnic_set_mc_addr_list(struct rte_eth_dev *dev, }static const struct eth_dev_ops spnic_pmd_ops = { + .dev_configure = spnic_dev_configure, + .dev_infos_get = spnic_dev_infos_get, + .fw_version_get = spnic_fw_version_get, .dev_set_link_up = spnic_dev_set_link_up, .dev_set_link_down = spnic_dev_set_link_down, .link_update = spnic_link_update,
@@ -1350,6 +1472,9 @@ static const struct eth_dev_ops spnic_pmd_ops = { };static const struct eth_dev_ops spnic_pmd_vf_ops = { + .dev_configure = spnic_dev_configure, + .dev_infos_get = spnic_dev_infos_get, + .fw_version_get = spnic_fw_version_get, .rx_queue_setup = spnic_rx_queue_setup, .tx_queue_setup = spnic_tx_queue_setup, .dev_start = spnic_dev_start,
Signature · 1 line
2.32.0
PATCH v6 17/26 net/spnic: support RSS configuration update and get
In reply to Yanling SongThis commit implements rss_hash_update and rss_hash_conf_get.
--- drivers/net/spnic/spnic_ethdev.c | 235 +++++++++++++++++++++++++++++++ 1 file changed, 235 insertions(+)
drivers/net/spnic/spnic_ethdev.c +235 -0
@@ -1258,6 +1258,233 @@ static int spnic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)return err; } + +/** +* Update the RSS hash key and RSS hash type. +* +* @param[in] dev +* Pointer to ethernet device structure. +* @param[in] rss_conf +* RSS configuration data. +* +* @retval zero: Success +* @retval non-zero: Failure +*/ +static int spnic_rss_hash_update (struct rte_eth_dev *dev, +struct rte_eth_rss_conf *rss_conf) +{ +struct spnic_nic_dev *nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +struct spnic_rss_type rss_type = {0 }; +u64 rss_hf = rss_conf->rss_hf; +int err =0 ; + +if (nic_dev->rss_state ==SPNIC_RSS_DISABLE ) { +if (rss_hf !=0 ) +return -EINVAL ; + +PMD_DRV_LOG (INFO ,"RSS is not enabled" ); +return 0 ; + } + +if (rss_conf->rss_key_len >SPNIC_RSS_KEY_SIZE ) { +PMD_DRV_LOG (ERR ,"Invalid RSS key, rss_key_len: %d" , + rss_conf->rss_key_len); +return -EINVAL ; + } + +if (rss_conf->rss_key) { + err =spnic_rss_set_hash_key (nic_dev->hwdev, nic_dev->rss_key); +if (err) { +PMD_DRV_LOG (ERR ,"Set RSS hash key failed" ); +return err; + } +memcpy (nic_dev->rss_key, rss_conf->rss_key, + rss_conf->rss_key_len); + } + + rss_type.ipv4 = (rss_hf & (ETH_RSS_IPV4 |ETH_RSS_FRAG_IPV4 | +ETH_RSS_NONFRAG_IPV4_OTHER )) ?1 :0 ; + rss_type.tcp_ipv4 = (rss_hf Ð_RSS_NONFRAG_IPV4_TCP ) ?1 :0 ; + rss_type.ipv6 = (rss_hf & (ETH_RSS_IPV6 |ETH_RSS_FRAG_IPV6 | +ETH_RSS_NONFRAG_IPV6_OTHER )) ?1 :0 ; + rss_type.ipv6_ext = (rss_hf Ð_RSS_IPV6_EX ) ?1 :0 ; + rss_type.tcp_ipv6 = (rss_hf Ð_RSS_NONFRAG_IPV6_TCP ) ?1 :0 ; + rss_type.tcp_ipv6_ext = (rss_hf Ð_RSS_IPV6_TCP_EX ) ?1 :0 ; + rss_type.udp_ipv4 = (rss_hf Ð_RSS_NONFRAG_IPV4_UDP ) ?1 :0 ; + rss_type.udp_ipv6 = (rss_hf Ð_RSS_NONFRAG_IPV6_UDP ) ?1 :0 ; + + err =spnic_set_rss_type (nic_dev->hwdev, rss_type); +if (err) +PMD_DRV_LOG (ERR ,"Set RSS type failed" ); + +return err; +} + +/** +* Get the RSS hash configuration. +* +* @param[in] dev +* Pointer to ethernet device structure. +* @param[out] rss_conf +* RSS configuration data. +* +* @retval zero: Success +* @retval non-zero: Failure +*/ +static int spnic_rss_conf_get (struct rte_eth_dev *dev, +struct rte_eth_rss_conf *rss_conf) +{ +struct spnic_nic_dev *nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +struct spnic_rss_type rss_type = {0 }; +int err; + +if (!rss_conf) +return -EINVAL ; + +if (nic_dev->rss_state ==SPNIC_RSS_DISABLE ) { + rss_conf->rss_hf =0 ; +PMD_DRV_LOG (INFO ,"RSS is not enabled" ); +return 0 ; + } + +if (rss_conf->rss_key && + rss_conf->rss_key_len >=SPNIC_RSS_KEY_SIZE ) { +/* +* Get RSS key from driver to reduce the frequency of the MPU +* accessing the RSS memory. +*/ + rss_conf->rss_key_len =sizeof (nic_dev->rss_key); +memcpy (rss_conf->rss_key, nic_dev->rss_key, + rss_conf->rss_key_len); + } + + err =spnic_get_rss_type (nic_dev->hwdev, &rss_type); +if (err) +return err; + + rss_conf->rss_hf =0 ; + rss_conf->rss_hf |= rss_type.ipv4 ? (ETH_RSS_IPV4 | +ETH_RSS_FRAG_IPV4 |ETH_RSS_NONFRAG_IPV4_OTHER ) :0 ; + rss_conf->rss_hf |= rss_type.tcp_ipv4 ?ETH_RSS_NONFRAG_IPV4_TCP :0 ; + rss_conf->rss_hf |= rss_type.ipv6 ? (ETH_RSS_IPV6 | +ETH_RSS_FRAG_IPV6 |ETH_RSS_NONFRAG_IPV6_OTHER ) :0 ; + rss_conf->rss_hf |= rss_type.ipv6_ext ?ETH_RSS_IPV6_EX :0 ; + rss_conf->rss_hf |= rss_type.tcp_ipv6 ?ETH_RSS_NONFRAG_IPV6_TCP :0 ; + rss_conf->rss_hf |= rss_type.tcp_ipv6_ext ?ETH_RSS_IPV6_TCP_EX :0 ; + rss_conf->rss_hf |= rss_type.udp_ipv4 ?ETH_RSS_NONFRAG_IPV4_UDP :0 ; + rss_conf->rss_hf |= rss_type.udp_ipv6 ?ETH_RSS_NONFRAG_IPV6_UDP :0 ; + +return 0 ; +} + +/** +* Get the RETA indirection table. +* +* @param[in] dev +* Pointer to ethernet device structure. +* @param[out] reta_conf +* Pointer to RETA configuration structure array. +* @param[in] reta_size +* Size of the RETA table. +* +* @retval zero: Success +* @retval non-zero: Failure +*/ +static int spnic_rss_reta_query (struct rte_eth_dev *dev, +struct rte_eth_rss_reta_entry64 *reta_conf, +uint16_t reta_size) +{ +struct spnic_nic_dev *nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +u32 indirtbl[SPNIC_RSS_INDIR_SIZE ] = {0 }; +u16 idx, shift; +u16 i; +int err; + +if (nic_dev->rss_state ==SPNIC_RSS_DISABLE ) { +PMD_DRV_LOG (INFO ,"RSS is not enabled" ); +return 0 ; + } + +if (reta_size !=SPNIC_RSS_INDIR_SIZE ) { +PMD_DRV_LOG (ERR ,"Invalid reta size, reta_size: %d" , reta_size); +return -EINVAL ; + } + + err =spnic_rss_get_indir_tbl (nic_dev->hwdev, indirtbl); +if (err) { +PMD_DRV_LOG (ERR ,"Get RSS retas table failed, error: %d" , + err); +return err; + } + +for (i =0 ; i < reta_size; i++) { + idx = i /RTE_RETA_GROUP_SIZE ; + shift = i %RTE_RETA_GROUP_SIZE ; +if (reta_conf[idx].mask & (1ULL << shift)) + reta_conf[idx].reta[shift] = (uint16_t )indirtbl[i]; + } + +return 0 ; +} + +/** +* Update the RETA indirection table. +* +* @param[in] dev +* Pointer to ethernet device structure. +* @param[in] reta_conf +* Pointer to RETA configuration structure array. +* @param[in] reta_size +* Size of the RETA table. +* +* @retval zero: Success +* @retval non-zero: Failure +*/ +static int spnic_rss_reta_update (struct rte_eth_dev *dev, +struct rte_eth_rss_reta_entry64 *reta_conf, +uint16_t reta_size) +{ +struct spnic_nic_dev *nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +u32 indirtbl[SPNIC_RSS_INDIR_SIZE ] = {0 }; +u16 idx, shift; +u16 i; +int err; + +if (nic_dev->rss_state ==SPNIC_RSS_DISABLE ) +return 0 ; + +if (reta_size !=SPNIC_RSS_INDIR_SIZE ) { +PMD_DRV_LOG (ERR ,"Invalid reta size, reta_size: %d" , reta_size); +return -EINVAL ; + } + + err =spnic_rss_get_indir_tbl (nic_dev->hwdev, indirtbl); +if (err) +return err; + +/* Update RSS reta table */ +for (i =0 ; i < reta_size; i++) { + idx = i /RTE_RETA_GROUP_SIZE ; + shift = i %RTE_RETA_GROUP_SIZE ; +if (reta_conf[idx].mask & (1ULL << shift)) + indirtbl[i] = reta_conf[idx].reta[shift]; + } + +for (i =0 ; i < reta_size; i++) { +if (indirtbl[i] >= nic_dev->num_rqs) { +PMD_DRV_LOG (ERR ,"Invalid reta entry, index: %d, num_rqs: %d" , + indirtbl[i], nic_dev->num_rqs); +return -EFAULT ; + } + } + + err =spnic_rss_set_indir_tbl (nic_dev->hwdev, indirtbl); +if (err) +PMD_DRV_LOG (ERR ,"Set RSS reta table failed" ); + +return err; +} +/** * Update MAC address *
@@ -1465,6 +1692,10 @@ static const struct eth_dev_ops spnic_pmd_ops = { .dev_stop = spnic_dev_stop, .dev_close = spnic_dev_close, .mtu_set = spnic_dev_set_mtu, + .rss_hash_update = spnic_rss_hash_update, + .rss_hash_conf_get = spnic_rss_conf_get, + .reta_update = spnic_rss_reta_update, + .reta_query = spnic_rss_reta_query, .mac_addr_set = spnic_set_mac_addr, .mac_addr_remove = spnic_mac_addr_remove, .mac_addr_add = spnic_mac_addr_add,
@@ -1484,6 +1715,10 @@ static const struct eth_dev_ops spnic_pmd_vf_ops = { .dev_stop = spnic_dev_stop, .dev_close = spnic_dev_close, .mtu_set = spnic_dev_set_mtu, + .rss_hash_update = spnic_rss_hash_update, + .rss_hash_conf_get = spnic_rss_conf_get, + .reta_update = spnic_rss_reta_update, + .reta_query = spnic_rss_reta_query, .mac_addr_set = spnic_set_mac_addr, .mac_addr_remove = spnic_mac_addr_remove, .mac_addr_add = spnic_mac_addr_add,
Signature · 1 line
2.32.0
PATCH v6 18/26 net/spnic: support VLAN filtering and offloading
In reply to Yanling SongThis commit implements vlan_filter_set() and vlan_offload_set() to support VLAN filtering and offloading.
--- drivers/net/spnic/base/spnic_nic_cfg.c | 8 ++ drivers/net/spnic/spnic_ethdev.c | 121 +++++++++++++++++++++++++ 2 files changed, 129 insertions(+)
drivers/net/spnic/base/spnic_nic_cfg.c +8 -0
@@ -294,6 +294,14 @@ static int spnic_config_vlan(void *hwdev, u8 opcode, u16 vlan_id, u16 func_id)return 0 ; } +int spnic_add_vlan (void *hwdev,u16 vlan_id,u16 func_id) +{ +if (!hwdev) +return -EINVAL ; + +return spnic_config_vlan (hwdev,SPNIC_CMD_OP_ADD , vlan_id, func_id); +} +int spnic_del_vlan (void *hwdev,u16 vlan_id,u16 func_id) {if (!hwdev)
drivers/net/spnic/spnic_ethdev.c +121 -0
139 lines not on this page · raw message
Signature · 1 line
2.32.0
PATCH v6 19/26 net/spnic: support promiscuous and allmulticast Rx modes
In reply to Yanling SongThis commit implements promiscuous_enable/disable() and allmulticast_enable/disable() to configure promiscuous or allmulticast Rx modes. Note: promiscuous rx mode is only supported by PF.
--- drivers/net/spnic/spnic_ethdev.c | 156 +++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+)
drivers/net/spnic/spnic_ethdev.c +156 -0
@@ -1375,6 +1375,156 @@ static int spnic_vlan_offload_set(struct rte_eth_dev *dev, int mask)return 0 ; } +/** +* Enable allmulticast mode. +* +* @param[in] dev +* Pointer to ethernet device structure. +* +* @retval zero: Success +* @retval non-zero: Failure +*/ +static int spnic_dev_allmulticast_enable (struct rte_eth_dev *dev) +{ +struct spnic_nic_dev *nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +u32 rx_mode; +int err; + + err =spnic_mutex_lock (&nic_dev->rx_mode_mutex); +if (err) +return err; + + rx_mode = nic_dev->rx_mode |SPNIC_RX_MODE_MC_ALL ; + + err =spnic_set_rx_mode (nic_dev->hwdev, rx_mode); +if (err) { + (void )spnic_mutex_unlock (&nic_dev->rx_mode_mutex); +PMD_DRV_LOG (ERR ,"Enable allmulticast failed, error: %d" , err); +return err; + } + + nic_dev->rx_mode = rx_mode; + + (void )spnic_mutex_unlock (&nic_dev->rx_mode_mutex); + +PMD_DRV_LOG (INFO ,"Enable allmulticast succeed, nic_dev: %s, port_id: %d" , + nic_dev->dev_name, dev->data->port_id); +return 0 ; +} + +/** +* Disable allmulticast mode. +* +* @param[in] dev +* Pointer to ethernet device structure. +* +* @retval zero: Success +* @retval non-zero: Failure +*/ +static int spnic_dev_allmulticast_disable (struct rte_eth_dev *dev) +{ +struct spnic_nic_dev *nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +u32 rx_mode; +int err; + + err =spnic_mutex_lock (&nic_dev->rx_mode_mutex); +if (err) +return err; + + rx_mode = nic_dev->rx_mode & (~SPNIC_RX_MODE_MC_ALL ); + + err =spnic_set_rx_mode (nic_dev->hwdev, rx_mode); +if (err) { + (void )spnic_mutex_unlock (&nic_dev->rx_mode_mutex); +PMD_DRV_LOG (ERR ,"Disable allmulticast failed, error: %d" , err); +return err; + } + + nic_dev->rx_mode = rx_mode; + + (void )spnic_mutex_unlock (&nic_dev->rx_mode_mutex); + +PMD_DRV_LOG (INFO ,"Disable allmulticast succeed, nic_dev: %s, port_id: %d" , + nic_dev->dev_name, dev->data->port_id); +return 0 ; +} + +/** +* Enable promiscuous mode. +* +* @param[in] dev +* Pointer to ethernet device structure. +* +* @retval zero: Success +* @retval non-zero: Failure +*/ +static int spnic_dev_promiscuous_enable (struct rte_eth_dev *dev) +{ +struct spnic_nic_dev *nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +u32 rx_mode; +int err; + + err =spnic_mutex_lock (&nic_dev->rx_mode_mutex); +if (err) +return err; + + rx_mode = nic_dev->rx_mode |SPNIC_RX_MODE_PROMISC ; + + err =spnic_set_rx_mode (nic_dev->hwdev, rx_mode); +if (err) { + (void )spnic_mutex_unlock (&nic_dev->rx_mode_mutex); +PMD_DRV_LOG (ERR ,"Enable promiscuous failed" ); +return err; + } + + nic_dev->rx_mode = rx_mode; + + (void )spnic_mutex_unlock (&nic_dev->rx_mode_mutex); + +PMD_DRV_LOG (INFO ,"Enable promiscuous, nic_dev: %s, port_id: %d, promisc: %d" , + nic_dev->dev_name, dev->data->port_id, + dev->data->promiscuous); +return 0 ; +} + +/** +* Disable promiscuous mode. +* +* @param[in] dev +* Pointer to ethernet device structure. +* +* @retval zero: Success +* @retval non-zero: Failure +*/ +static int spnic_dev_promiscuous_disable (struct rte_eth_dev *dev) +{ +struct spnic_nic_dev *nic_dev =SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +u32 rx_mode; +int err; + + err =spnic_mutex_lock (&nic_dev->rx_mode_mutex); +if (err) +return err; + + rx_mode = nic_dev->rx_mode & (~SPNIC_RX_MODE_PROMISC ); + + err =spnic_set_rx_mode (nic_dev->hwdev, rx_mode); +if (err) { + (void )spnic_mutex_unlock (&nic_dev->rx_mode_mutex); +PMD_DRV_LOG (ERR ,"Disable promiscuous failed" ); +return err; + } + + nic_dev->rx_mode = rx_mode; + + (void )spnic_mutex_unlock (&nic_dev->rx_mode_mutex); + +PMD_DRV_LOG (INFO ,"Disable promiscuous, nic_dev: %s, port_id: %d, promisc: %d" , + nic_dev->dev_name, dev->data->port_id, + dev->data->promiscuous); +return 0 ; +} +/** * Update the RSS hash key and RSS hash type.
@@ -1811,6 +1961,10 @@ static const struct eth_dev_ops spnic_pmd_ops = { .mtu_set = spnic_dev_set_mtu, .vlan_filter_set = spnic_vlan_filter_set, .vlan_offload_set = spnic_vlan_offload_set, + .allmulticast_enable = spnic_dev_allmulticast_enable, + .allmulticast_disable = spnic_dev_allmulticast_disable, + .promiscuous_enable = spnic_dev_promiscuous_enable, + .promiscuous_disable = spnic_dev_promiscuous_disable, .rss_hash_update = spnic_rss_hash_update, .rss_hash_conf_get = spnic_rss_conf_get, .reta_update = spnic_rss_reta_update,
@@ -1836,6 +1990,8 @@ static const struct eth_dev_ops spnic_pmd_vf_ops = { .mtu_set = spnic_dev_set_mtu, .vlan_filter_set = spnic_vlan_filter_set, .vlan_offload_set = spnic_vlan_offload_set, + .allmulticast_enable = spnic_dev_allmulticast_enable, + .allmulticast_disable = spnic_dev_allmulticast_disable, .rss_hash_update = spnic_rss_hash_update, .rss_hash_conf_get = spnic_rss_conf_get, .reta_update = spnic_rss_reta_update,
Signature · 1 line
2.32.0
PATCH v6 20/26 net/spnic: support flow control
In reply to Yanling SongThis commit implements flow control operations
to support related syscalls.
--- drivers/net/spnic/base/spnic_nic_cfg.c | 53 ++++++++++++++++++ drivers/net/spnic/base/spnic_nic_cfg.h | 25 +++++++++ drivers/net/spnic/spnic_ethdev.c | 77 ++++++++++++++++++++++++++ drivers/net/spnic/spnic_ethdev.h | 1 + 4 files changed, 156 insertions(+)
drivers/net/spnic/base/spnic_nic_cfg.c +53 -0
@@ -440,6 +440,59 @@ int spnic_flush_qps_res(void *hwdev)return 0 ; } +static int spnic_cfg_hw_pause (void *hwdev,u8 opcode, +struct nic_pause_config *nic_pause) +{ +struct spnic_cmd_pause_config pause_info; +u16 out_size =sizeof (pause_info); +int err; + +memset (&pause_info,0 ,sizeof (pause_info)); + + pause_info.port_id =spnic_physical_port_id (hwdev); + pause_info.opcode = opcode; +if (opcode ==SPNIC_CMD_OP_SET ) { + pause_info.auto_neg = nic_pause->auto_neg; + pause_info.rx_pause = nic_pause->rx_pause; + pause_info.tx_pause = nic_pause->tx_pause; + } + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_CFG_PAUSE_INFO , + &pause_info,sizeof (pause_info), + &pause_info, &out_size); +if (err || !out_size || pause_info.msg_head.status) { +PMD_DRV_LOG (ERR ,"%s pause info failed, err: %d, status: 0x%x, out size: 0x%x\n" , + opcode ==SPNIC_CMD_OP_SET ?"Set" :"Get" , + err, pause_info.msg_head.status, out_size); +return -EIO ; + } + +if (opcode ==SPNIC_CMD_OP_GET ) { + nic_pause->auto_neg = pause_info.auto_neg; + nic_pause->rx_pause = pause_info.rx_pause; + nic_pause->tx_pause = pause_info.tx_pause; + } + +return 0 ; +} + +int spnic_set_pause_info (void *hwdev,struct nic_pause_config nic_pause) +{ +if (!hwdev) +return -EINVAL ; + +return spnic_cfg_hw_pause (hwdev,SPNIC_CMD_OP_SET , &nic_pause); +} + +int spnic_get_pause_info (void *hwdev,struct nic_pause_config *nic_pause) +{ +if (!hwdev || !nic_pause) +return -EINVAL ; + + +return spnic_cfg_hw_pause (hwdev,SPNIC_CMD_OP_GET , nic_pause); +} +static int spnic_set_function_table (void *hwdev,u32 cfg_bitmap,struct spnic_func_tbl_cfg *cfg) {
drivers/net/spnic/base/spnic_nic_cfg.h +25 -0
@@ -560,6 +560,31 @@ int spnic_get_link_state(void *hwdev, u8 *link_state);*/ int spnic_flush_qps_res (void *hwdev); +/** +* Set pause info +* +* @param[in] hwdev +* Device pointer to hwdev +* @param[in] nic_pause +* Pause info +* +* @retval zero : Success +* @retval non-zero : Failure +*/ +int spnic_set_pause_info (void *hwdev,struct nic_pause_config nic_pause); + +/** +* Get pause info +* +* @param[in] hwdev +* Device pointer to hwdev +* @param[out] nic_pause +* Pause info +* +* @retval zero : Success +* @retval non-zero : Failure +*/ +int spnic_get_pause_info (void *hwdev,struct nic_pause_config *nic_pause);/** * Init nic hwdev
drivers/net/spnic/spnic_ethdev.c +77 -0
89 lines not on this page · raw message
drivers/net/spnic/spnic_ethdev.h +1 -0
@@ -76,6 +76,7 @@ struct spnic_nic_dev {bool pause_set;pthread_mutex_t pause_mutuex; +struct nic_pause_config nic_pause;struct rte_ether_addr default_addr;struct rte_ether_addr *mc_list;
Signature · 1 line
2.32.0
PATCH v6 21/26 net/spnic: support getting Tx/Rx queues info
In reply to Yanling SongThis patch implements rxq_info_get() and txq_info_get() to support getting queue depth and mbuf pool info of specified Tx/Rx queue.
--- drivers/net/spnic/spnic_ethdev.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/net/spnic/spnic_ethdev.c +21 -0
@@ -1827,6 +1827,23 @@ static int spnic_rss_reta_update(struct rte_eth_dev *dev,return err; } +static void spnic_rxq_info_get (struct rte_eth_dev *dev,uint16_t queue_id, +struct rte_eth_rxq_info *rxq_info) +{ +struct spnic_rxq *rxq = dev->data->rx_queues[queue_id]; + + rxq_info->mp = rxq->mb_pool; + rxq_info->nb_desc = rxq->q_depth; +} + +static void spnic_txq_info_get (struct rte_eth_dev *dev,uint16_t queue_id, +struct rte_eth_txq_info *txq_qinfo) +{ +struct spnic_txq *txq = dev->data->tx_queues[queue_id]; + + txq_qinfo->nb_desc = txq->q_depth; +} +/** * Update MAC address *
@@ -2046,6 +2063,8 @@ static const struct eth_dev_ops spnic_pmd_ops = { .rss_hash_conf_get = spnic_rss_conf_get, .reta_update = spnic_rss_reta_update, .reta_query = spnic_rss_reta_query, + .rxq_info_get = spnic_rxq_info_get, + .txq_info_get = spnic_txq_info_get, .mac_addr_set = spnic_set_mac_addr, .mac_addr_remove = spnic_mac_addr_remove, .mac_addr_add = spnic_mac_addr_add,
@@ -2073,6 +2092,8 @@ static const struct eth_dev_ops spnic_pmd_vf_ops = { .rss_hash_conf_get = spnic_rss_conf_get, .reta_update = spnic_rss_reta_update, .reta_query = spnic_rss_reta_query, + .rxq_info_get = spnic_rxq_info_get, + .txq_info_get = spnic_txq_info_get, .mac_addr_set = spnic_set_mac_addr, .mac_addr_remove = spnic_mac_addr_remove, .mac_addr_add = spnic_mac_addr_add,
Signature · 1 line
2.32.0
PATCH v6 22/26 net/spnic: net/spnic: support xstats statistics
In reply to Yanling SongThis commit implements DFX statistics of physical port, function, Rx queues and Tx queues, which includes MAC statistic, unicast/multicast/broadcast packets statistic, rx_mbuf, tx_busy and etc.
--- drivers/net/spnic/base/spnic_nic_cfg.c | 118 ++++++ drivers/net/spnic/base/spnic_nic_cfg.h | 206 +++++++++++ drivers/net/spnic/spnic_ethdev.c | 474 +++++++++++++++++++++++++ 3 files changed, 798 insertions(+)
drivers/net/spnic/base/spnic_nic_cfg.c +118 -0
@@ -493,6 +493,124 @@ int spnic_get_pause_info(void *hwdev, struct nic_pause_config *nic_pause)return spnic_cfg_hw_pause (hwdev,SPNIC_CMD_OP_GET , nic_pause); } +int spnic_get_vport_stats (void *hwdev,struct spnic_vport_stats *stats) +{ +struct spnic_port_stats_info stats_info; +struct spnic_cmd_vport_stats vport_stats; +u16 out_size =sizeof (vport_stats); +int err; + +if (!hwdev || !stats) +return -EINVAL ; + +memset (&stats_info,0 ,sizeof (stats_info)); +memset (&vport_stats,0 ,sizeof (vport_stats)); + + stats_info.func_id =spnic_global_func_id (hwdev); + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_GET_VPORT_STAT , + &stats_info,sizeof (stats_info), + &vport_stats, &out_size); +if (err || !out_size || vport_stats.msg_head.status) { +PMD_DRV_LOG (ERR ,"Get function stats failed, err: %d, status: 0x%x, out size: 0x%x" , + err, vport_stats.msg_head.status, out_size); +return -EIO ; + } + +memcpy (stats, &vport_stats.stats,sizeof (*stats)); + +return 0 ; +} + +int spnic_get_phy_port_stats (void *hwdev,struct mag_phy_port_stats *stats) +{ +struct mag_cmd_get_port_stat *port_stats =NULL ; +struct mag_cmd_port_stats_info stats_info; +u16 out_size =sizeof (*port_stats); +int err; + + port_stats =rte_zmalloc ("port_stats" ,sizeof (*port_stats),0 ); +if (!port_stats) +return -ENOMEM ; + +memset (&stats_info,0 ,sizeof (stats_info)); + stats_info.port_id =spnic_physical_port_id (hwdev); + + err =mag_msg_to_mgmt_sync (hwdev,MAG_CMD_GET_PORT_STAT , + &stats_info,sizeof (stats_info), + port_stats, &out_size); +if (err || !out_size || port_stats->head.status) { +PMD_DRV_LOG (ERR , +"Failed to get port statistics, err: %d, status: 0x%x, out size: 0x%x\n" , + err, port_stats->head.status, out_size); + err = -EIO ; + goto out; + } + +memcpy (stats, &port_stats->counter,sizeof (*stats)); + +out: +rte_free (port_stats); + +return err; +} + +int spnic_clear_vport_stats (void *hwdev) +{ +struct spnic_cmd_clear_vport_stats clear_vport_stats; +u16 out_size =sizeof (clear_vport_stats); +int err; + +if (!hwdev) { +PMD_DRV_LOG (ERR ,"Hwdev is NULL" ); +return -EINVAL ; + } + +memset (&clear_vport_stats,0 ,sizeof (clear_vport_stats)); + clear_vport_stats.func_id =spnic_global_func_id (hwdev); + + err =spnic_l2nic_msg_to_mgmt_sync (hwdev,SPNIC_CMD_CLEAN_VPORT_STAT , + &clear_vport_stats, +sizeof (clear_vport_stats), + &clear_vport_stats, &out_size); +if (err || !out_size || clear_vport_stats.msg_head.status) { +PMD_DRV_LOG (ERR ,"Clear vport stats failed, err: %d, status: 0x%x, out size: 0x%x" , + err, clear_vport_stats.msg_head.status, out_size); +return -EIO ; + } + +return 0 ; +} + +int spnic_clear_phy_port_stats (void *hwdev) +{ +struct mag_cmd_clr_port_stat *port_stats =NULL ; +u16 out_size =sizeof (*port_stats); +int err; + + port_stats =rte_zmalloc ("port_stats" ,sizeof (*port_stats),0 ); +if (!port_stats) +return -ENOMEM ; + + port_stats->port_id =spnic_physical_port_id (hwdev); + + err =mag_msg_to_mgmt_sync (hwdev,MAG_CMD_GET_PORT_STAT , + &port_stats,sizeof (port_stats), + port_stats, &out_size); +if (err || !out_size || port_stats->head.status) { +PMD_DRV_LOG (ERR , +"Failed to get port statistics, err: %d, status: 0x%x, out size: 0x%x\n" , + err, port_stats->head.status, out_size); + err = -EIO ; + goto out; + } + +out: +rte_free (port_stats); + +return err; +} +static int spnic_set_function_table (void *hwdev,u32 cfg_bitmap,struct spnic_func_tbl_cfg *cfg) {
drivers/net/spnic/base/spnic_nic_cfg.h +206 -0
218 lines not on this page · raw message
drivers/net/spnic/spnic_ethdev.c +474 -0
498 lines not on this page · raw message
Signature · 1 line
2.32.0
PATCH v6 23/26 net/spnic: support VFIO interrupt
In reply to Yanling SongThis commit supports VFIO interrupt for Rx queue and asynchronous event, and implements rx_queue_intr_disable() and rx_queue_intr_enable() to disable/enable the interrupt of specified Rx queue.
--- drivers/net/spnic/base/spnic_eqs.c | 11 ++ drivers/net/spnic/spnic_ethdev.c | 218 ++++++++++++++++++++++++++++- drivers/net/spnic/spnic_ethdev.h | 3 + drivers/net/spnic/spnic_rx.c | 2 + 4 files changed, 233 insertions(+), 1 deletion(-)
drivers/net/spnic/base/spnic_eqs.c +11 -0
@@ -12,6 +12,7 @@#include "spnic_eqs.h" #include "spnic_mgmt.h" #include "spnic_mbox.h" +#include "spnic_hw_comm.h" #include "spnic_nic_event.h" #define AEQ_CTRL_0_INTR_IDX_SHIFT 0
@@ -648,3 +649,13 @@ int spnic_aeq_poll_msg(struct spnic_eq *eq, u32 timeout, void *param)return err; } + +void spnic_dev_handle_aeq_event (struct spnic_hwdev *hwdev,void *param) +{ +struct spnic_eq *aeq = &hwdev->aeqs->aeq[0 ]; + +/* Clear resend timer cnt register */ +spnic_misx_intr_clear_resend_bit (hwdev, aeq->eq_irq.msix_entry_idx, +EQ_MSIX_RESEND_TIMER_CLEAR ); + (void )spnic_aeq_poll_msg (aeq,0 , param); +}
drivers/net/spnic/spnic_ethdev.c +217 -1
296 lines not on this page · raw message
drivers/net/spnic/spnic_ethdev.h +3 -0
@@ -89,4 +89,7 @@ struct spnic_nic_dev {#define SPNIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev) \ ((struct spnic_nic_dev *)(dev)->data->dev_private) +int spnic_dev_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id); +int spnic_dev_rx_queue_intr_disable (struct rte_eth_dev *dev, +uint16_t queue_id);#endif /* _SPNIC_ETHDEV_H_ */
drivers/net/spnic/spnic_rx.c +2 -0
@@ -591,6 +591,7 @@ int spnic_start_all_rqs(struct rte_eth_dev *eth_dev) rxq = eth_dev->data->rx_queues[i];spnic_add_rq_to_rx_queue_list (nic_dev, rxq->q_id);spnic_rearm_rxq_mbuf (rxq); +spnic_dev_rx_queue_intr_enable (eth_dev, rxq->q_id); eth_dev->data->rx_queue_state[i] =RTE_ETH_QUEUE_STATE_STARTED ; }
@@ -609,6 +610,7 @@ int spnic_start_all_rqs(struct rte_eth_dev *eth_dev) rxq = eth_dev->data->rx_queues[i];spnic_remove_rq_from_rx_queue_list (nic_dev, rxq->q_id);spnic_free_rxq_mbufs (rxq); +spnic_dev_rx_queue_intr_disable (eth_dev, rxq->q_id); eth_dev->data->rx_queue_state[i] =RTE_ETH_QUEUE_STATE_STOPPED ; }return err;
Signature · 1 line
2.32.0
PATCH v6 24/26 net/spnic: support Tx/Rx queue start/stop
In reply to Yanling SongThis commit support starting or stopping a specified Rx/Tx queue For Rx queue:
when starting rx queue, mbuf will be allocated and fill rq
wqe with mbuf info, then add the qid to indirect table of RSS. if the first rx queue is started, the valid bit in function table will be set so that the packets can be received to host.
when stopping rx queue, the PMD driver will poll the rx queue
until it is empty and release the mbuf, then the PMD driver will remove the qid for RSS indirect table. if the last rx queue is stopped, the valid bit in function table will be cleared.
For Rx queue:
when stopping tx queue, the PMD driver will wait until all tx
packets are sent and then releases all mbuf.
--- drivers/net/spnic/base/spnic_nic_cfg.c | 33 ++++ drivers/net/spnic/base/spnic_nic_cfg.h | 13 ++ drivers/net/spnic/spnic_ethdev.c | 82 +++++++++ drivers/net/spnic/spnic_rx.c | 222 +++++++++++++++++++++++++ drivers/net/spnic/spnic_rx.h | 4 + 5 files changed, 354 insertions(+)
drivers/net/spnic/base/spnic_nic_cfg.c +33 -0
@@ -1289,6 +1289,39 @@ int spnic_vf_get_default_cos(void *hwdev, u8 *cos_id)return 0 ; } +int spnic_set_rq_flush (void *hwdev,u16 q_id) +{ +struct spnic_cmd_set_rq_flush *rq_flush_msg =NULL ; +struct spnic_cmd_buf *cmd_buf =NULL ; +u64 out_param =EIO ; +int err; + + cmd_buf =spnic_alloc_cmd_buf (hwdev); +if (!cmd_buf) { +PMD_DRV_LOG (ERR ,"Failed to allocate cmd buf\n" ); +return -ENOMEM ; + } + + cmd_buf->size =sizeof (*rq_flush_msg); + + rq_flush_msg = cmd_buf->buf; + rq_flush_msg->local_rq_id = q_id; + rq_flush_msg->value =cpu_to_be32 (rq_flush_msg->value); + + err =spnic_cmdq_direct_resp (hwdev,SPNIC_MOD_L2NIC , +SPNIC_UCODE_CMD_SET_RQ_FLUSH , cmd_buf, + &out_param,0 ); +if (err || out_param !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to set rq flush, err:%d, out_param: %" PRIu64"" , + err, out_param); + err = -EFAULT ; + } + +spnic_free_cmd_buf (cmd_buf); + +return err; +} +static int _mag_msg_to_mgmt_sync (void *hwdev,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size) {
drivers/net/spnic/base/spnic_nic_cfg.h +13 -0
@@ -1069,6 +1069,19 @@ int spnic_set_vlan_fliter(void *hwdev, u32 vlan_filter_ctrl);*/ int spnic_vf_get_default_cos (void *hwdev,u8 *cos_id); +/** +* Flush rx queue resource +* +* @param[in] hwdev +* Device pointer to hwdev +* @param[in] q_id +* rx queue id +* +* @retval zero : Success +* @retval non-zero : Failure +*/ +int spnic_set_rq_flush (void *hwdev,u16 q_id); +/** * Get service feature HW supported *
drivers/net/spnic/spnic_ethdev.c +82 -0
100 lines not on this page · raw message
drivers/net/spnic/spnic_rx.c +222 -0
228 lines not on this page · raw message
drivers/net/spnic/spnic_rx.h +4 -0
@@ -273,6 +273,10 @@ void spnic_dump_cqe_status(struct spnic_rxq *rxq, u32 *cqe_done_cnt, u32 *cqe_hole_cnt, u32 *head_ci, u32 *head_done); +int spnic_stop_rq (struct rte_eth_dev *eth_dev,struct spnic_rxq *rxq); + +int spnic_start_rq (struct rte_eth_dev *eth_dev,struct spnic_rxq *rxq); +int spnic_start_all_rqs (struct rte_eth_dev *eth_dev);u16 spnic_recv_pkts (void *rx_queue,struct rte_mbuf **rx_pkts,u16 nb_pkts);
Signature · 1 line
2.32.0
PATCH v6 25/26 net/spnic: add doc infrastructure
In reply to Yanling SongThis patch adds doc infrastructure for spnic PMD driver.
--- MAINTAINERS | 6 ++++ doc/guides/nics/features/spnic.ini | 39 +++++++++++++++++++++ doc/guides/nics/index.rst | 1 + doc/guides/nics/spnic.rst | 55 ++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 doc/guides/nics/features/spnic.ini create mode 100644 doc/guides/nics/spnic.rst
MAINTAINERS +6 -0
@@ -919,6 +919,12 @@ F: drivers/net/qede/ F: doc/guides/nics/qede.rst F: doc/guides/nics/features/qede*.ini +Ramaxel SPNIC +M: Yanling Song <[email protected]> +F: drivers/net/spnic/ +F: doc/guides/nics/spnic.rst +F: doc/guides/nics/features/spnic.ini + Solarflare sfc_efx M: Andrew Rybchenko <[email protected]> F: drivers/common/sfc_efx/
doc/guides/nics/features/spnic.ini new file +39 -0
@@ -0,0 +1,39 @@ +; +; Supported features of 'spnic' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Speed capabilities = Y +Link status = Y +Link status event = Y +Queue start/stop = Y +MTU update = Y +Scattered Rx = Y +LRO = Y +TSO = Y +Promiscuous mode = Y +Allmulticast mode = Y +Unicast MAC filter = Y +Multicast MAC filter = Y +RSS hash = Y +RSS key update = Y +RSS reta update = Y +Inner RSS = Y +SR-IOV = Y +Flow control = Y +CRC offload = Y +VLAN filter = Y +VLAN offload = Y +L3 checksum offload = Y +L4 checksum offload = Y +Inner L3 checksum = Y +Inner L4 checksum = Y +Basic stats = Y +Extended stats = Y +Stats per queue = Y +FW version = Y +Multiprocess aware = Y +Linux = Y +x86-64 = Y +ARMv8 = Y
doc/guides/nics/index.rst +1 -0
@@ -57,6 +57,7 @@ Network Interface Controller Drivers pfe qede sfc_efx + spnic softnic tap thunderx
doc/guides/nics/spnic.rst new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.32.0
Re: [PATCH v6 25/26] net/spnic: add doc infrastructure
Quoted 3 lines · Yanling Song
This patch adds doc infrastructure for spnic PMD driver.
Signed-off-by Yanling Song <[email protected]>
<...>
Quoted 6 lines
doc/guides/nics/spnic.rst new file +0
-0
doc/guides/nics/spnic.rst line 10
Quoted 10 lines
doc/guides/nics/spnic.rst new file +10
-0@@ -0,0 +1,55 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2021 Ramaxel Memory Technology, Ltd + + +SPNIC Poll Mode Driver +====================== + +The spnic PMD (**librte_net_spnic**) provides poll mode driver support +for 25Gbps/100Gbps SPNxxx Network Adapters. +
Can you please provide more information to the device, and add a link to the product page?
Quoted 15 lines
doc/guides/nics/spnic.rst new file +15
-0+ +Features +-------- + +- Multiple queues for TX and RX +- Receiver Side Scaling(RSS) +- RSS supports IPv4, IPv6, TCPv4, TCPv6, UDPv4 and UDPv6, use inner type for VXLAN as default +- MAC/VLAN filtering +- Checksum offload +- TSO offload +- LRO offload +- Promiscuous mode +- Port hardware statistics +- Link state information +- Link flow control(pause frame)
doc/guides/nics/spnic.rst line 35
Quoted 10 lines
doc/guides/nics/spnic.rst new file +10
-0+- Scattered and gather for TX and RX +- SR-IOV - Partially supported VFIO only +- VLAN filter and VLAN offload +- Allmulticast mode +- MTU update +- Unicast MAC filter +- Multicast MAC filter +- Set Link down or up +- FW version +- Multi arch support: x86_64, ARMv8.
Please build this list in each patch as these features are added. So have the base documentation in first patch, later as above features added update this file in that patch.
Same for above .ini file.
Quoted 20 lines
doc/guides/nics/spnic.rst new file +20
-0+ +Prerequisites +------------- + +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment. + + +Driver compilation and testing +------------------------------ + +Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>` +for details. + +It is highly recommended to upgrade the spnic driver and firmware to avoid the compatibility issues, +and check the work mode with the latest product documents. + +Limitations or Known issues +--------------------------- +Build with ICC is not supported yet. +X86-32, Power8, ARMv7 and BSD are not supported yet.
Re: [PATCH v6 25/26] net/spnic: add doc infrastructure
Quoted 18 lines · On Wed, 19 Jan 2022 17:27:56 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 3 lines · Yanling Song
This patch adds doc infrastructure for spnic PMD driver.
Signed-off-by Yanling Song <[email protected]><...>
Quoted 11 lines
doc/guides/nics/spnic.rst new file +5
-0@@ -0,0 +1,55 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2021 Ramaxel Memory Technology, Ltd + + +SPNIC Poll Mode Driver
Quoted 9 lines
Quoted 5 lines
doc/guides/nics/spnic.rst new file +3
-0+====================== + +The spnic PMD (**librte_net_spnic**) provides poll mode driversupport +for 25Gbps/100Gbps SPNxxx Network Adapters. +
Can you please provide more information to the device, and add a link to the product page?
More information will be supplied in the next version. But the web page is still under construction.
Quoted 31 lines
Quoted 17 lines
doc/guides/nics/spnic.rst new file +7
-0+ +Features +-------- + +- Multiple queues for TX and RX +- Receiver Side Scaling(RSS) +- RSS supports IPv4, IPv6, TCPv4, TCPv6, UDPv4 and UDPv6, useinner type for VXLAN as default +- MAC/VLAN filtering
+- Checksum offload +- TSO offload +- LRO offload +- Promiscuous mode +- Port hardware statistics +- Link state information +- Link flow control(pause frame) +- Scattered and gather for TX and RX +- SR-IOV - Partially supported VFIO onlyQuoted 8 lines
+- VLAN filter and VLAN offload +- Allmulticast mode +- MTU update +- Unicast MAC filter +- Multicast MAC filter +- Set Link down or up +- FW version +- Multi arch support: x86_64, ARMv8.Please build this list in each patch as these features are added. So have the base documentation in first patch, later as above features added update this file in that patch.
Quoted 2 lines
Same for above .ini file.
Ok. Will do it this way in the next version.
Quoted 21 lines
Quoted 20 lines
doc/guides/nics/spnic.rst new file +5
-0+ +Prerequisites +------------- + +- Follow the DPDK :ref:`Getting Started Guide for Linux<linux_gsg>` to setup the basic DPDK environment. +
doc/guides/nics/spnic.rst new file +5
-0+ +Driver compilation and testing +------------------------------ + +Refer to the document :ref:`compiling and testing a PMD for a NIC<pmd_build_and_test>` +for details.
doc/guides/nics/spnic.rst new file +2
-0+ +It is highly recommended to upgrade the spnic driver and firmwareto avoid the compatibility issues, +and check the work mode with the latest product documents. +
doc/guides/nics/spnic.rst new file +4
-0+Limitations or Known issues +--------------------------- +Build with ICC is not supported yet. +X86-32, Power8, ARMv7 and BSD are not supported yet.
PATCH v6 26/26 net/spnic: fixes unsafe C style code
In reply to Yanling SongUse the hardware structure instead of void* as parameter of function to keep the type information
--- drivers/net/spnic/base/spnic_cmdq.c | 14 +-- drivers/net/spnic/base/spnic_cmdq.h | 6 +- drivers/net/spnic/base/spnic_hw_cfg.c | 49 ++++------ drivers/net/spnic/base/spnic_hw_cfg.h | 16 ++-- drivers/net/spnic/base/spnic_hw_comm.c | 32 ++++--- drivers/net/spnic/base/spnic_hw_comm.h | 22 ++--- drivers/net/spnic/base/spnic_hwdev.c | 8 +- drivers/net/spnic/base/spnic_hwif.c | 52 +++++------ drivers/net/spnic/base/spnic_hwif.h | 22 ++--- drivers/net/spnic/base/spnic_mgmt.c | 9 +- drivers/net/spnic/base/spnic_mgmt.h | 4 +- drivers/net/spnic/base/spnic_nic_cfg.c | 110 +++++++++++------------ drivers/net/spnic/base/spnic_nic_cfg.h | 84 ++++++++--------- drivers/net/spnic/base/spnic_nic_event.c | 30 +++---- drivers/net/spnic/base/spnic_nic_event.h | 10 +-- drivers/net/spnic/base/spnic_wq.c | 3 +- drivers/net/spnic/base/spnic_wq.h | 2 +- drivers/net/spnic/spnic_ethdev.c | 10 +-- drivers/net/spnic/spnic_io.c | 34 +++---- drivers/net/spnic/spnic_io.h | 10 +-- drivers/net/spnic/spnic_rx.c | 4 +- drivers/net/spnic/spnic_tx.c | 4 +- 22 files changed, 252 insertions(+), 283 deletions(-)
drivers/net/spnic/base/spnic_cmdq.c +7 -7
@@ -160,9 +160,9 @@ bool spnic_cmdq_idle(struct spnic_cmdq *cmdq) true : false); } -struct spnic_cmd_buf *spnic_alloc_cmd_buf (void *hwdev) +struct spnic_cmd_buf *spnic_alloc_cmd_buf (struct spnic_hwdev *hwdev) { -struct spnic_cmdqs *cmdqs = ((struct spnic_hwdev *)hwdev)->cmdqs; +struct spnic_cmdqs *cmdqs = hwdev->cmdqs;struct spnic_cmd_buf *cmd_buf; cmd_buf =rte_zmalloc (NULL ,sizeof (*cmd_buf),0 );
@@ -491,7 +491,7 @@ static int cmdq_sync_cmd_detail_resp(struct spnic_cmdq *cmdq,return err; } -static int cmdq_params_valid (void *hwdev,struct spnic_cmd_buf *buf_in) +static int cmdq_params_valid (struct spnic_hwdev *hwdev,struct spnic_cmd_buf *buf_in) {if (!buf_in || !hwdev) {PMD_DRV_LOG (ERR ,"Invalid CMDQ buffer or hwdev is NULL" );
@@ -520,11 +520,11 @@ static int wait_cmdqs_enable(struct spnic_cmdqs *cmdqs)return -EBUSY ; } -int spnic_cmdq_direct_resp (void *hwdev,enum spnic_mod_type mod,u8 cmd, +int spnic_cmdq_direct_resp (struct spnic_hwdev *hwdev,enum spnic_mod_type mod,u8 cmd,struct spnic_cmd_buf *buf_in,u64 *out_param,u32 timeout) { -struct spnic_cmdqs *cmdqs = ((struct spnic_hwdev *)hwdev)->cmdqs; +struct spnic_cmdqs *cmdqs = hwdev->cmdqs;int err; err =cmdq_params_valid (hwdev, buf_in);
@@ -543,11 +543,11 @@ int spnic_cmdq_direct_resp(void *hwdev, enum spnic_mod_type mod, u8 cmd, mod, cmd, buf_in, out_param, timeout); } -int spnic_cmdq_detail_resp (void *hwdev,enum spnic_mod_type mod,u8 cmd, +int spnic_cmdq_detail_resp (struct spnic_hwdev *hwdev,enum spnic_mod_type mod,u8 cmd,struct spnic_cmd_buf *buf_in,struct spnic_cmd_buf *buf_out,u32 timeout) { -struct spnic_cmdqs *cmdqs = ((struct spnic_hwdev *)hwdev)->cmdqs; +struct spnic_cmdqs *cmdqs = hwdev->cmdqs;int err; err =cmdq_params_valid (hwdev, buf_in);
drivers/net/spnic/base/spnic_cmdq.h +3 -3
@@ -225,7 +225,7 @@ int spnic_reinit_cmdq_ctxts(struct spnic_hwdev *hwdev);bool spnic_cmdq_idle (struct spnic_cmdq *cmdq); -struct spnic_cmd_buf *spnic_alloc_cmd_buf (void *hwdev); +struct spnic_cmd_buf *spnic_alloc_cmd_buf (struct spnic_hwdev *hwdev);void spnic_free_cmd_buf (struct spnic_cmd_buf *cmd_buf);
@@ -233,11 +233,11 @@ void spnic_free_cmd_buf(struct spnic_cmd_buf *cmd_buf);* PF/VF sends cmd to ucode by cmdq, and return 0 if success. * timeout=0, use default timeout. */ -int spnic_cmdq_direct_resp (void *hwdev,enum spnic_mod_type mod,u8 cmd, +int spnic_cmdq_direct_resp (struct spnic_hwdev *hwdev,enum spnic_mod_type mod,u8 cmd,struct spnic_cmd_buf *buf_in,u64 *out_param,u32 timeout); -int spnic_cmdq_detail_resp (void *hwdev,enum spnic_mod_type mod,u8 cmd, +int spnic_cmdq_detail_resp (struct spnic_hwdev *hwdev,enum spnic_mod_type mod,u8 cmd,struct spnic_cmd_buf *buf_in,struct spnic_cmd_buf *buf_out,u32 timeout);
drivers/net/spnic/base/spnic_hw_cfg.c +19 -30
116 lines not on this page · raw message
drivers/net/spnic/base/spnic_hw_cfg.h +8 -8
@@ -60,7 +60,7 @@ struct service_cap { };struct cfg_mgmt_info { -void *hwdev; +struct spnic_hwdev *hwdev;struct service_cap svc_cap; };
@@ -109,17 +109,17 @@ struct spnic_cfg_cmd_dev_cap {#define IS_NIC_TYPE (dev) \ (((u32)(dev)->cfg_mgmt->svc_cap.chip_svc_type) & CFG_SVC_NIC_BIT0) -int spnic_init_capability (void *dev); -void spnic_free_capability (void *dev); +int spnic_init_capability (struct spnic_hwdev *hwdev); +void spnic_free_capability (struct spnic_hwdev *hwdev); -u16 spnic_func_max_sqs (void *hwdev); -u16 spnic_func_max_rqs (void *hwdev); +u16 spnic_func_max_sqs (struct spnic_hwdev *hwdev); +u16 spnic_func_max_rqs (struct spnic_hwdev *hwdev); -u8 spnic_physical_port_id (void *hwdev); +u8 spnic_physical_port_id (struct spnic_hwdev *hwdev); -int spnic_cfg_mbx_vf_proc_msg (void *hwdev,void *pri_handle,u16 cmd,void *buf_in, +int spnic_cfg_mbx_vf_proc_msg (struct spnic_hwdev *hwdev,void *pri_handle,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size); -bool spnic_support_nic (void *hwdev); +bool spnic_support_nic (struct spnic_hwdev *hwdev);#endif /* _SPNIC_HW_CFG_H_ */
drivers/net/spnic/base/spnic_hw_comm.c +15 -17
@@ -69,9 +69,8 @@ const u32 spnic_hw_rx_buf_size[] = { SPNIC_RX_BUF_SIZE_16K, }; -int spnic_get_interrupt_cfg (void *dev,struct interrupt_info *info) +int spnic_get_interrupt_cfg (struct spnic_hwdev *hwdev,struct interrupt_info *info) { -struct spnic_hwdev *hwdev = dev;struct spnic_cmd_msix_config msix_cfg;u16 out_size =sizeof (msix_cfg);int err;
@@ -107,17 +106,16 @@ int spnic_get_interrupt_cfg(void *dev, struct interrupt_info *info)/** * Set interrupt cfg * -* @param[in] dev -* The pointer to the private hardware device object +* @param[in] hwdev +* The device pointer to hwdev * @param[in] info * Interrupt info * * @retval zero : Success * @retval negative : Failure. */ -int spnic_set_interrupt_cfg (void *dev,struct interrupt_info info) +int spnic_set_interrupt_cfg (struct spnic_hwdev *hwdev,struct interrupt_info info) { -struct spnic_hwdev *hwdev = dev;struct spnic_cmd_msix_config msix_cfg;struct interrupt_info temp_info;u16 out_size =sizeof (msix_cfg);
@@ -167,7 +165,7 @@ int spnic_set_interrupt_cfg(void *dev, struct interrupt_info info)return 0 ; } -int spnic_set_wq_page_size (void *hwdev,u16 func_idx,u32 page_size) +int spnic_set_wq_page_size (struct spnic_hwdev *hwdev,u16 func_idx,u32 page_size) {struct spnic_cmd_wq_page_size page_size_info;u16 out_size =sizeof (page_size_info);
@@ -192,10 +190,10 @@ int spnic_set_wq_page_size(void *hwdev, u16 func_idx, u32 page_size)return 0 ; } -int spnic_func_reset (void *hwdev,u64 reset_flag) +int spnic_func_reset (struct spnic_hwdev *hwdev,u64 reset_flag) {struct spnic_reset func_reset; -struct spnic_hwif *hwif = ((struct spnic_hwdev *)hwdev)->hwif; +struct spnic_hwif *hwif = hwdev->hwif;u16 out_size =sizeof (func_reset);int err =0 ;
@@ -264,7 +262,7 @@ static u16 get_hw_rx_buf_size(u32 rx_buf_sz)return DEFAULT_RX_BUF_SIZE ;/* Default 2K */ } -int spnic_set_root_ctxt (void *hwdev,u32 rq_depth,u32 sq_depth,u16 rx_buf_sz) +int spnic_set_root_ctxt (struct spnic_hwdev *hwdev,u32 rq_depth,u32 sq_depth,u16 rx_buf_sz) {struct spnic_cmd_root_ctxt root_ctxt;u16 out_size =sizeof (root_ctxt);
@@ -294,7 +292,7 @@ int spnic_set_root_ctxt(void *hwdev, u32 rq_depth, u32 sq_depth, u16 rx_buf_sz)return 0 ; } -int spnic_clean_root_ctxt (void *hwdev) +int spnic_clean_root_ctxt (struct spnic_hwdev *hwdev) {struct spnic_cmd_root_ctxt root_ctxt;u16 out_size =sizeof (root_ctxt);
@@ -318,7 +316,7 @@ int spnic_clean_root_ctxt(void *hwdev)return 0 ; } -int spnic_set_cmdq_depth (void *hwdev,u16 cmdq_depth) +int spnic_set_cmdq_depth (struct spnic_hwdev *hwdev,u16 cmdq_depth) {struct spnic_cmd_root_ctxt root_ctxt;u16 out_size =sizeof (root_ctxt);
@@ -388,7 +386,7 @@ int spnic_set_dma_attr_tbl(struct spnic_hwdev *hwdev, u32 entry_idx, u8 st,return 0 ; } -int spnic_get_mgmt_version (void *hwdev,char *mgmt_ver,int max_mgmt_len) +int spnic_get_mgmt_version (struct spnic_hwdev *hwdev,char *mgmt_ver,int max_mgmt_len) {struct spnic_cmd_get_fw_version fw_ver;u16 out_size =sizeof (fw_ver);
@@ -415,7 +413,7 @@ int spnic_get_mgmt_version(void *hwdev, char *mgmt_ver, int max_mgmt_len)return 0 ; } -int spnic_get_board_info (void *hwdev,struct spnic_board_info *info) +int spnic_get_board_info (struct spnic_hwdev *hwdev,struct spnic_board_info *info) {struct spnic_cmd_board_info board_info;u16 out_size =sizeof (board_info);
@@ -440,7 +438,7 @@ int spnic_get_board_info(void *hwdev, struct spnic_board_info *info)return 0 ; } -static int spnic_comm_features_nego (void *hwdev,u8 opcode,u64 *s_feature, +static int spnic_comm_features_nego (struct spnic_hwdev *hwdev,u8 opcode,u64 *s_feature,u16 size) {struct comm_cmd_feature_nego feature_nego;
@@ -472,13 +470,13 @@ static int spnic_comm_features_nego(void *hwdev, u8 opcode, u64 *s_feature,return 0 ; } -int spnic_get_comm_features (void *hwdev,u64 *s_feature,u16 size) +int spnic_get_comm_features (struct spnic_hwdev *hwdev,u64 *s_feature,u16 size) {return spnic_comm_features_nego (hwdev,MGMT_MSG_CMD_OP_GET , s_feature, size); } -int spnic_set_comm_features (void *hwdev,u64 *s_feature,u16 size) +int spnic_set_comm_features (struct spnic_hwdev *hwdev,u64 *s_feature,u16 size) {return spnic_comm_features_nego (hwdev,MGMT_MSG_CMD_OP_SET , s_feature, size);
drivers/net/spnic/base/spnic_hw_comm.h +11 -11
@@ -174,29 +174,29 @@ struct interrupt_info {u8 resend_timer_cfg; }; -int spnic_func_reset (void *hwdev,u64 reset_flag); +int spnic_func_reset (struct spnic_hwdev *hwdev,u64 reset_flag); -int spnic_get_mgmt_version (void *hwdev,char *mgmt_ver,int max_mgmt_len); +int spnic_get_mgmt_version (struct spnic_hwdev *hwdev,char *mgmt_ver,int max_mgmt_len); -int spnic_get_board_info (void *hwdev,struct spnic_board_info *info); +int spnic_get_board_info (struct spnic_hwdev *hwdev,struct spnic_board_info *info); -int spnic_set_root_ctxt (void *hwdev,u32 rq_depth,u32 sq_depth,u16 rx_buf_sz); +int spnic_set_root_ctxt (struct spnic_hwdev *hwdev,u32 rq_depth,u32 sq_depth,u16 rx_buf_sz); -int spnic_clean_root_ctxt (void *hwdev); +int spnic_clean_root_ctxt (struct spnic_hwdev *hwdev); -int spnic_get_interrupt_cfg (void *dev,struct interrupt_info *info); +int spnic_get_interrupt_cfg (struct spnic_hwdev *hwdev,struct interrupt_info *info); -int spnic_set_interrupt_cfg (void *dev,struct interrupt_info info); +int spnic_set_interrupt_cfg (struct spnic_hwdev *hwdev,struct interrupt_info info); -int spnic_set_wq_page_size (void *hwdev,u16 func_idx,u32 page_size); +int spnic_set_wq_page_size (struct spnic_hwdev *hwdev,u16 func_idx,u32 page_size); -int spnic_set_cmdq_depth (void *hwdev,u16 cmdq_depth); +int spnic_set_cmdq_depth (struct spnic_hwdev *hwdev,u16 cmdq_depth);int spnic_convert_rx_buf_size (u32 rx_buf_sz,u32 *match_sz); -int spnic_get_comm_features (void *hwdev,u64 *s_feature,u16 size); +int spnic_get_comm_features (struct spnic_hwdev *hwdev,u64 *s_feature,u16 size); -int spnic_set_comm_features (void *hwdev,u64 *s_feature,u16 size); +int spnic_set_comm_features (struct spnic_hwdev *hwdev,u64 *s_feature,u16 size);int spnic_set_dma_attr_tbl (struct spnic_hwdev *hwdev,u32 entry_idx,u8 st,u8 at,u8 ph,u8 no_snooping,u8 tph_en);
drivers/net/spnic/base/spnic_hwdev.c +4 -4
@@ -4,7 +4,6 @@#include "spnic_compat.h" #include "spnic_csr.h" -#include "spnic_hwif.h" #include "spnic_eqs.h" #include "spnic_mgmt.h" #include "spnic_cmd.h"
@@ -13,6 +12,7 @@#include "spnic_cmdq.h" #include "spnic_hw_cfg.h" #include "spnic_hwdev.h" +#include "spnic_hwif.h" #include "spnic_hw_comm.h" enum spnic_pcie_nosnoop {
@@ -70,7 +70,7 @@ enum spnic_pcie_tph {#define SPNIC_DEAULT_EQ_MSIX_COALESC_TIMER_CFG 0xFF#define SPNIC_DEAULT_EQ_MSIX_RESEND_TIMER_CFG 7 -typedef void (*mgmt_event_cb )(void *handle,void *buf_in,u16 in_size, +typedef void (*mgmt_event_cb )(struct spnic_hwdev *hwdev,void *buf_in,u16 in_size,void *buf_out,u16 *out_size);struct mgmt_event_handle {
@@ -93,7 +93,7 @@ int spnic_vf_handle_pf_comm_mbox(void *handle, __rte_unused void *pri_handle,return 0 ; } -static void fault_event_handler(__rte_unused void *hwdev, +static void fault_event_handler(__rte_unused struct spnic_hwdev *hwdev, __rte_unused void *buf_in, __rte_unused u16 in_size, __rte_unused void *buf_out,
@@ -102,7 +102,7 @@ static void fault_event_handler(__rte_unused void *hwdev,PMD_DRV_LOG (WARNING ,"Unsupported fault event handler" ); } -static void ffm_event_msg_handler(__rte_unused void *hwdev, +static void ffm_event_msg_handler(__rte_unused struct spnic_hwdev *hwdev,void *buf_in,u16 in_size, __rte_unused void *buf_out, u16 *out_size) {
drivers/net/spnic/base/spnic_hwif.c +24 -28
178 lines not on this page · raw message
drivers/net/spnic/base/spnic_hwif.h +11 -11
@@ -118,38 +118,38 @@ u32 spnic_hwif_read_reg(struct spnic_hwif *hwif, u32 reg);void spnic_hwif_write_reg (struct spnic_hwif *hwif,u32 reg,u32 val); -void spnic_set_msix_state (void *hwdev,u16 msix_idx, +void spnic_set_msix_state (struct spnic_hwdev *hwdev,u16 msix_idx,enum spnic_msix_state flag); -void spnic_misx_intr_clear_resend_bit (void *hwdev,u16 msix_idx, +void spnic_misx_intr_clear_resend_bit (struct spnic_hwdev *hwdev,u16 msix_idx,u8 clear_resend_en); -u16 spnic_global_func_id (void *hwdev); +u16 spnic_global_func_id (struct spnic_hwdev *hwdev); -u8 spnic_pf_id_of_vf (void *hwdev); +u8 spnic_pf_id_of_vf (struct spnic_hwdev *hwdev); -u8 spnic_pcie_itf_id (void *hwdev); +u8 spnic_pcie_itf_id (struct spnic_hwdev *hwdev); -enum func_type spnic_func_type (void *hwdev); +enum func_type spnic_func_type (struct spnic_hwdev *hwdev); -u16 spnic_glb_pf_vf_offset (void *hwdev); +u16 spnic_glb_pf_vf_offset (struct spnic_hwdev *hwdev);void spnic_set_pf_status (struct spnic_hwif *hwif,enum spnic_pf_status status);enum spnic_pf_status spnic_get_pf_status (struct spnic_hwif *hwif); -int spnic_alloc_db_addr (void *hwdev,void **db_base,void **dwqe_base); +int spnic_alloc_db_addr (struct spnic_hwdev *hwdev,void **db_base,void **dwqe_base); -void spnic_free_db_addr (void *hwdev,const void *db_base, +void spnic_free_db_addr (struct spnic_hwdev *hwdev,const void *db_base, __rte_unused void *dwqe_base);void spnic_disable_doorbell (struct spnic_hwif *hwif);void spnic_enable_doorbell (struct spnic_hwif *hwif); -int spnic_init_hwif (void *dev); +int spnic_init_hwif (struct spnic_hwdev *hwdev); -void spnic_free_hwif (void *dev); +void spnic_free_hwif (struct spnic_hwdev *hwdev);#endif /* _SPNIC_HWIF_H_ */
drivers/net/spnic/base/spnic_mgmt.c +4 -5
@@ -35,7 +35,7 @@#define MGMT_MSG_TIMEOUT 300000/* Millisecond */ -int spnic_msg_to_mgmt_sync (void *hwdev,enum spnic_mod_type mod,u16 cmd, +int spnic_msg_to_mgmt_sync (struct spnic_hwdev *hwdev,enum spnic_mod_type mod,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size,u32 timeout) {
@@ -186,7 +186,7 @@ static int recv_mgmt_msg_handler(struct spnic_msg_pf_to_mgmt *pf_to_mgmt,* Handler for a mgmt message event * * @param[in] hwdev -* The pointer to the private hardware device object +* The device pointer to hwdev * @param[in] header * The header of the message * @param[in] size
@@ -197,9 +197,8 @@ static int recv_mgmt_msg_handler(struct spnic_msg_pf_to_mgmt *pf_to_mgmt,* @retval zero : When aeqe is response message * @retval negative : When wrong message or not last message. */ -int spnic_mgmt_msg_aeqe_handler (void *hwdev,u8 *header,u8 size,void *param) +int spnic_mgmt_msg_aeqe_handler (struct spnic_hwdev *hwdev,u8 *header,u8 size,void *param) { -struct spnic_hwdev *dev = (struct spnic_hwdev *)hwdev;struct spnic_msg_pf_to_mgmt *pf_to_mgmt =NULL ;struct spnic_recv_msg *recv_msg =NULL ;bool is_send_dir = false;
@@ -209,7 +208,7 @@ int spnic_mgmt_msg_aeqe_handler(void *hwdev, u8 *header, u8 size, void *param)return spnic_mbox_func_aeqe_handler (hwdev, header, size, param); } - pf_to_mgmt = dev->pf_to_mgmt; + pf_to_mgmt = hwdev->pf_to_mgmt; is_send_dir = (SPNIC_MSG_HEADER_GET (*(u64 *)header,DIRECTION ) ==SPNIC_MSG_DIRECT_SEND ) ? true : false;
drivers/net/spnic/base/spnic_mgmt.h +2 -2
@@ -97,13 +97,13 @@ struct spnic_msg_pf_to_mgmt {u16 sync_msg_id; }; -int spnic_mgmt_msg_aeqe_handler (void *hwdev,u8 *header,u8 size,void *param); +int spnic_mgmt_msg_aeqe_handler (struct spnic_hwdev *hwdev,u8 *header,u8 size,void *param);int spnic_pf_to_mgmt_init (struct spnic_hwdev *hwdev);void spnic_pf_to_mgmt_free (struct spnic_hwdev *hwdev); -int spnic_msg_to_mgmt_sync (void *hwdev,enum spnic_mod_type mod,u16 cmd, +int spnic_msg_to_mgmt_sync (struct spnic_hwdev *hwdev,enum spnic_mod_type mod,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size,u32 timeout);
drivers/net/spnic/base/spnic_nic_cfg.c +55 -55
430 lines not on this page · raw message
drivers/net/spnic/base/spnic_nic_cfg.h +42 -42
326 lines not on this page · raw message
drivers/net/spnic/base/spnic_nic_event.c +14 -16
@@ -6,10 +6,10 @@#include "spnic_compat.h" #include "spnic_cmd.h" -#include "spnic_hwif.h" #include "spnic_hwdev.h" #include "spnic_mgmt.h" #include "spnic_nic_cfg.h" +#include "spnic_hwif.h" #include "spnic_hwdev.h" #include "spnic_nic_event.h"
@@ -45,9 +45,8 @@ void spnic_get_port_link_info(struct spnic_hwdev *hwdev, u8 link_state, } } -static void spnic_link_event_stats (void *dev,u8 link) +static void spnic_link_event_stats (struct spnic_hwdev *hwdev,u8 link) { -struct spnic_hwdev *hwdev = dev;struct link_event_stats *stats = &hwdev->hw_stats.link_event_stats;if (link)
@@ -56,14 +55,13 @@ static void spnic_link_event_stats(void *dev, u8 link)__atomic_fetch_add (&stats->link_down_stats,1 , __ATOMIC_RELAXED); } -static void link_status_event_handler (void *hwdev,void *buf_in, +static void link_status_event_handler (struct spnic_hwdev *hwdev,void *buf_in, __rte_unused u16 in_size, __rte_unused void *buf_out, __rte_unused u16 *out_size) {struct spnic_cmd_link_state *link_status =NULL ;struct rte_eth_link link; -struct spnic_hwdev *dev = hwdev;int err; link_status = buf_in;
@@ -74,24 +72,24 @@ static void link_status_event_handler(void *hwdev, void *buf_in,spnic_link_event_stats (hwdev, link_status->state);/* Link event reported only after set vport enable */ -spnic_get_port_link_info (dev, link_status->state, &link); - err =rte_eth_linkstatus_set ((struct rte_eth_dev *)(dev->eth_dev), +spnic_get_port_link_info (hwdev, link_status->state, &link); + err =rte_eth_linkstatus_set ((struct rte_eth_dev *)(hwdev->eth_dev), &link);if (!err) -rte_eth_dev_callback_process (dev->eth_dev, +rte_eth_dev_callback_process (hwdev->eth_dev,RTE_ETH_EVENT_INTR_LSC ,NULL ); }struct nic_event_handler {u16 cmd; -void (*handler)(void *hwdev,void *buf_in,u16 in_size, +void (*handler)(struct spnic_hwdev *hwdev,void *buf_in,u16 in_size,void *buf_out,u16 *out_size); };struct nic_event_handler nic_cmd_handler[] = { }; -static void nic_event_handler (void *hwdev,u16 cmd,void *buf_in,u16 in_size, +static void nic_event_handler (struct spnic_hwdev *hwdev,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size) {u32 i, size =ARRAY_LEN (nic_cmd_handler);
@@ -119,7 +117,7 @@ static void nic_event_handler(void *hwdev, u16 cmd, void *buf_in, u16 in_size,* VF link change event * VF fault report event */ -int spnic_vf_event_handler(void *hwdev, __rte_unused void *pri_handle, +int spnic_vf_event_handler(struct spnic_hwdev *hwdev, __rte_unused void *pri_handle,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size) {
@@ -128,7 +126,7 @@ int spnic_vf_event_handler(void *hwdev, __rte_unused void *pri_handle, }/* NIC event of PF/PPF handler reported by mgmt cpu */ -void spnic_pf_event_handler(void *hwdev, __rte_unused void *pri_handle, +void spnic_pf_event_handler(struct spnic_hwdev *hwdev, __rte_unused void *pri_handle,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size) {
@@ -142,7 +140,7 @@ static struct nic_event_handler mag_cmd_handler[] = { }, }; -static int spnic_mag_event_handler (void *hwdev,u16 cmd,void *buf_in, +static int spnic_mag_event_handler (struct spnic_hwdev *hwdev,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size) {
@@ -168,14 +166,14 @@ static int spnic_mag_event_handler(void *hwdev, u16 cmd, void *buf_in,return 0 ; } -int spnic_vf_mag_event_handler (void *hwdev,u16 cmd,void *buf_in,u16 in_size,void *buf_out, -u16 *out_size) +int spnic_vf_mag_event_handler (struct spnic_hwdev *hwdev,u16 cmd,void *buf_in, +u16 in_size,void *buf_out,u16 *out_size) {return spnic_mag_event_handler (hwdev, cmd, buf_in, in_size, buf_out, out_size); } -u8 spnic_nic_sw_aeqe_handler(__rte_unused void *hwdev, u8 event, u8 *data) +u8 spnic_nic_sw_aeqe_handler(__rte_unused struct spnic_hwdev *hwdev, u8 event, u8 *data) { PMD_DRV_LOG(ERR, "Received nic ucode aeq event type: 0x%x, data: %" PRIu64 "",
drivers/net/spnic/base/spnic_nic_event.h +5 -5
@@ -8,17 +8,17 @@void spnic_get_port_link_info (struct spnic_hwdev *hwdev,u8 link_state,struct rte_eth_link *link); -void spnic_pf_event_handler(void *hwdev, __rte_unused void *pri_handle, +void spnic_pf_event_handler(struct spnic_hwdev *hwdev, __rte_unused void *pri_handle,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size); -int spnic_vf_event_handler(void *hwdev, __rte_unused void *pri_handle, +int spnic_vf_event_handler(struct spnic_hwdev *hwdev, __rte_unused void *pri_handle,u16 cmd,void *buf_in,u16 in_size,void *buf_out,u16 *out_size); -int spnic_vf_mag_event_handler (void *hwdev,u16 cmd,void *buf_in,u16 in_size,void *buf_out, -u16 *out_size); +int spnic_vf_mag_event_handler (struct spnic_hwdev *hwdev,u16 cmd,void *buf_in, +u16 in_size,void *buf_out,u16 *out_size); -u8 spnic_nic_sw_aeqe_handler(__rte_unused void *hwdev, u8 event, u8 *data); +u8 spnic_nic_sw_aeqe_handler(__rte_unused struct spnic_hwdev *hwdev, u8 event, u8 *data);#endif /* _SPNIC_NIC_EVENT_H_ */
drivers/net/spnic/base/spnic_wq.c +1 -2
@@ -67,10 +67,9 @@ void *spnic_read_wqe(struct spnic_wq *wq, int num_wqebbs, u16 *cons_idx)return WQ_WQE_ADDR (wq, (u32)(*cons_idx)); } -int spnic_cmdq_alloc (struct spnic_wq *wq,void *dev,int cmdq_blocks, +int spnic_cmdq_alloc (struct spnic_wq *wq,struct spnic_hwdev *hwdev,int cmdq_blocks,u32 wq_buf_size,u32 wqebb_shift,u16 q_depth) { -struct spnic_hwdev *hwdev = (struct spnic_hwdev *)dev;int i, j;int err;
drivers/net/spnic/base/spnic_wq.h +1 -1
@@ -107,7 +107,7 @@ struct spnic_wq {void spnic_wq_wqe_pg_clear (struct spnic_wq *wq); -int spnic_cmdq_alloc (struct spnic_wq *wq,void *dev,int cmdq_blocks, +int spnic_cmdq_alloc (struct spnic_wq *wq,struct spnic_hwdev *hwdev,int cmdq_blocks,u32 wq_buf_size,u32 wqebb_shift,u16 q_depth);void spnic_cmdq_free (struct spnic_wq *wq,int cmdq_blocks);
drivers/net/spnic/spnic_ethdev.c +5 -5
@@ -15,20 +15,20 @@#include "base/spnic_compat.h" #include "base/spnic_cmd.h" #include "base/spnic_csr.h" +#include "base/spnic_hwdev.h" #include "base/spnic_wq.h" #include "base/spnic_eqs.h" #include "base/spnic_mgmt.h" #include "base/spnic_cmdq.h" -#include "base/spnic_hwdev.h" #include "base/spnic_hwif.h" #include "base/spnic_hw_cfg.h" #include "base/spnic_hw_comm.h" #include "base/spnic_nic_cfg.h" #include "base/spnic_nic_event.h" +#include "spnic_ethdev.h" #include "spnic_io.h" #include "spnic_tx.h" #include "spnic_rx.h" -#include "spnic_ethdev.h" #define SPNIC_MIN_RX_BUF_SIZE 1024
@@ -1252,7 +1252,7 @@ static void spnic_enable_interrupt(struct rte_eth_dev *dev)#define SPNIC_TXRX_MSIX_COALESC_TIMER 2#define SPNIC_TXRX_MSIX_RESEND_TIMER_CFG 7 -static int spnic_init_rxq_msix_attr (void *hwdev,u16 msix_index) +static int spnic_init_rxq_msix_attr (struct spnic_hwdev *hwdev,u16 msix_index) {struct interrupt_info info = {0 };int err;
@@ -1400,9 +1400,9 @@ static int spnic_dev_start(struct rte_eth_dev *eth_dev) goto init_func_tbl_fail; } - nic_features =spnic_get_driver_feature (nic_dev->hwdev); + nic_features =spnic_get_driver_feature (nic_dev); nic_features &=DEFAULT_DRV_FEATURE ; -spnic_update_driver_feature (nic_dev->hwdev, nic_features); +spnic_update_driver_feature (nic_dev, nic_features); err =spnic_set_feature_to_hw (nic_dev->hwdev, &nic_dev->feature_cap,1 );if (err) {
drivers/net/spnic/spnic_io.c +12 -22
@@ -17,17 +17,17 @@#include "base/spnic_compat.h" #include "base/spnic_cmd.h" -#include "base/spnic_wq.h" #include "base/spnic_mgmt.h" -#include "base/spnic_cmdq.h" #include "base/spnic_hwdev.h" +#include "base/spnic_wq.h" +#include "base/spnic_cmdq.h" #include "base/spnic_hw_comm.h" #include "base/spnic_nic_cfg.h" #include "base/spnic_hw_cfg.h" -#include "spnic_io.h" #include "spnic_tx.h" -#include "spnic_rx.h" #include "spnic_ethdev.h" +#include "spnic_io.h" +#include "spnic_rx.h" #define SPNIC_DEAULT_TX_CI_PENDING_LIMIT 0#define SPNIC_DEAULT_TX_CI_COALESCING_TIME 0
@@ -616,9 +616,8 @@ static int clean_qp_offload_ctxt(struct spnic_nic_dev *nic_dev) clean_queue_offload_ctxt(nic_dev, SPNIC_QP_CTXT_TYPE_RQ)); } -void spnic_get_func_rx_buf_size (void *dev) +void spnic_get_func_rx_buf_size (struct spnic_nic_dev *nic_dev) { -struct spnic_nic_dev *nic_dev = (struct spnic_nic_dev *)dev;struct spnic_rxq *rxq =NULL ;u16 q_id;u16 buf_size =0 ;
@@ -639,19 +638,17 @@ void spnic_get_func_rx_buf_size(void *dev) }/* Init qps ctxt and set sq ci attr and arm all sq */ -int spnic_init_qp_ctxts (void *dev) +int spnic_init_qp_ctxts (struct spnic_nic_dev *nic_dev) { -struct spnic_nic_dev *nic_dev =NULL ;struct spnic_hwdev *hwdev =NULL ;struct spnic_sq_attr sq_attr;u32 rq_depth;u16 q_id;int err; -if (!dev) +if (!nic_dev)return -EINVAL ; - nic_dev = (struct spnic_nic_dev *)dev; hwdev = nic_dev->hwdev; err =init_sq_ctxts (nic_dev);
@@ -703,7 +700,7 @@ int spnic_init_qp_ctxts(void *dev)return err; } -void spnic_free_qp_ctxts (void *hwdev) +void spnic_free_qp_ctxts (struct spnic_hwdev *hwdev) {if (!hwdev)return ;
@@ -711,28 +708,21 @@ void spnic_free_qp_ctxts(void *hwdev)spnic_clean_root_ctxt (hwdev); } -void spnic_update_driver_feature (void *dev,u64 s_feature) +void spnic_update_driver_feature (struct spnic_nic_dev *nic_dev,u64 s_feature) { -struct spnic_nic_dev *nic_dev =NULL ; - -if (!dev) +if (!nic_dev)return ; - nic_dev = (struct spnic_nic_dev *)dev; nic_dev->feature_cap = s_feature;PMD_DRV_LOG (INFO ,"Update nic feature to %" PRIu64"\n" , nic_dev->feature_cap); } -u64 spnic_get_driver_feature (void *dev) +u64 spnic_get_driver_feature (struct spnic_nic_dev *nic_dev) { -struct spnic_nic_dev *nic_dev =NULL ; - -if (!dev) +if (!nic_dev)return -EINVAL ; - nic_dev = (struct spnic_nic_dev *)dev; -return nic_dev->feature_cap; }
drivers/net/spnic/spnic_io.h +5 -5
@@ -107,7 +107,7 @@ static inline void spnic_write_db(void *db_addr, u16 q_id, int cos, u8 cflag,rte_write64 (*((u64 *)&db),DB_ADDR (db_addr, pi)); } -void spnic_get_func_rx_buf_size (void *dev); +void spnic_get_func_rx_buf_size (struct spnic_nic_dev *nic_dev);/** * Init queue pair context
@@ -118,7 +118,7 @@ void spnic_get_func_rx_buf_size(void *dev);* @retval zero: Success * @retval non-zero: Failure */ -int spnic_init_qp_ctxts (void *dev); +int spnic_init_qp_ctxts (struct spnic_nic_dev *nic_dev);/** * Free queue pair context
@@ -126,7 +126,7 @@ int spnic_init_qp_ctxts(void *dev);* @param[in] hwdev * Device pointer to hwdev */ -void spnic_free_qp_ctxts (void *hwdev); +void spnic_free_qp_ctxts (struct spnic_hwdev *hwdev);/** * Update service feature driver supported
@@ -138,7 +138,7 @@ void spnic_free_qp_ctxts(void *hwdev);* @retval zero: Success * @retval non-zero: Failure */ -void spnic_update_driver_feature (void *dev,u64 s_feature); +void spnic_update_driver_feature (struct spnic_nic_dev *nic_dev,u64 s_feature);/** * Get service feature driver supported
@@ -150,5 +150,5 @@ void spnic_update_driver_feature(void *dev, u64 s_feature);* @retval zero: Success * @retval non-zero: Failure */ -u64 spnic_get_driver_feature (void *dev); +u64 spnic_get_driver_feature (struct spnic_nic_dev *nic_dev);#endif /* _SPNIC_IO_H_ */
drivers/net/spnic/spnic_rx.c +2 -2
@@ -8,14 +8,14 @@#include "base/spnic_compat.h" #include "base/spnic_cmd.h" -#include "base/spnic_hwif.h" #include "base/spnic_hwdev.h" +#include "base/spnic_hwif.h" #include "base/spnic_wq.h" #include "base/spnic_mgmt.h" #include "base/spnic_nic_cfg.h" +#include "spnic_ethdev.h" #include "spnic_io.h" #include "spnic_rx.h" -#include "spnic_ethdev.h" /** * Get receive queue wqe
drivers/net/spnic/spnic_tx.c +2 -2
@@ -9,13 +9,13 @@#include "base/spnic_compat.h" #include "base/spnic_cmd.h" +#include "base/spnic_hwdev.h" #include "base/spnic_wq.h" #include "base/spnic_mgmt.h" -#include "base/spnic_hwdev.h" #include "base/spnic_nic_cfg.h" -#include "spnic_io.h" #include "spnic_tx.h" #include "spnic_ethdev.h" +#include "spnic_io.h" #define SPNIC_TX_TASK_WRAPPED 1#define SPNIC_TX_BD_DESC_WRAPPED 2
Signature · 1 line
2.32.0
Re: [PATCH v6 26/26] net/spnic: fixes unsafe C style code
Quoted 2 lines · Yanling Song
Use the hardware structure instead of void* as parameter of function to keep the type information
Hi Yanling,
This is a new driver and first patchset for it. Instead of fixing it in the set, why not update old patches to introduce them correct at first place?
Quoted 26 lines
Signed-off-by Yanling Song <[email protected]>--- drivers/net/spnic/base/spnic_cmdq.c | 14 +-- drivers/net/spnic/base/spnic_cmdq.h | 6 +- drivers/net/spnic/base/spnic_hw_cfg.c | 49 ++++------ drivers/net/spnic/base/spnic_hw_cfg.h | 16 ++-- drivers/net/spnic/base/spnic_hw_comm.c | 32 ++++--- drivers/net/spnic/base/spnic_hw_comm.h | 22 ++--- drivers/net/spnic/base/spnic_hwdev.c | 8 +- drivers/net/spnic/base/spnic_hwif.c | 52 +++++------ drivers/net/spnic/base/spnic_hwif.h | 22 ++--- drivers/net/spnic/base/spnic_mgmt.c | 9 +- drivers/net/spnic/base/spnic_mgmt.h | 4 +- drivers/net/spnic/base/spnic_nic_cfg.c | 110 +++++++++++------------ drivers/net/spnic/base/spnic_nic_cfg.h | 84 ++++++++--------- drivers/net/spnic/base/spnic_nic_event.c | 30 +++---- drivers/net/spnic/base/spnic_nic_event.h | 10 +-- drivers/net/spnic/base/spnic_wq.c | 3 +- drivers/net/spnic/base/spnic_wq.h | 2 +- drivers/net/spnic/spnic_ethdev.c | 10 +-- drivers/net/spnic/spnic_io.c | 34 +++---- drivers/net/spnic/spnic_io.h | 10 +-- drivers/net/spnic/spnic_rx.c | 4 +- drivers/net/spnic/spnic_tx.c | 4 +- 22 files changed, 252 insertions(+), 283 deletions(-)
<...>
Re: [PATCH v6 26/26] net/spnic: fixes unsafe C style code
Quoted 10 lines · On Wed, 19 Jan 2022 17:28:11 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 2 lines · Yanling Song
Use the hardware structure instead of void* as parameter of function to keep the type information
Hi Yanling,
This is a new driver and first patchset for it. Instead of fixing it in the set, why not update old patches to introduce them correct at first place?
Thanks for the guide. Will do it this way in the next version.
Quoted 30 lines
Quoted 26 lines
Signed-off-by Yanling Song <[email protected]>--- drivers/net/spnic/base/spnic_cmdq.c | 14 +-- drivers/net/spnic/base/spnic_cmdq.h | 6 +- drivers/net/spnic/base/spnic_hw_cfg.c | 49 ++++------ drivers/net/spnic/base/spnic_hw_cfg.h | 16 ++-- drivers/net/spnic/base/spnic_hw_comm.c | 32 ++++--- drivers/net/spnic/base/spnic_hw_comm.h | 22 ++--- drivers/net/spnic/base/spnic_hwdev.c | 8 +- drivers/net/spnic/base/spnic_hwif.c | 52 +++++------ drivers/net/spnic/base/spnic_hwif.h | 22 ++--- drivers/net/spnic/base/spnic_mgmt.c | 9 +- drivers/net/spnic/base/spnic_mgmt.h | 4 +- drivers/net/spnic/base/spnic_nic_cfg.c | 110 +++++++++++------------ drivers/net/spnic/base/spnic_nic_cfg.h | 84 ++++++++--------- drivers/net/spnic/base/spnic_nic_event.c | 30 +++---- drivers/net/spnic/base/spnic_nic_event.h | 10 +-- drivers/net/spnic/base/spnic_wq.c | 3 +- drivers/net/spnic/base/spnic_wq.h | 2 +- drivers/net/spnic/spnic_ethdev.c | 10 +-- drivers/net/spnic/spnic_io.c | 34 +++---- drivers/net/spnic/spnic_io.h | 10 +-- drivers/net/spnic/spnic_rx.c | 4 +- drivers/net/spnic/spnic_tx.c | 4 +- 22 files changed, 252 insertions(+), 283 deletions(-)<...>
Quoted 8 lines · Yanling Song
The patchsets introduce SPNIC driver for Ramaxel's SPNxx serial NIC cards into DPDK 22.03. Ramaxel Memory Technology is a company which supply a lot of electric products:
storage, communication, PCB...
SPNxxx is a serial PCIE interface NIC cards:
SPN110: 2 PORTs *25G
SPN120: 4 PORTs *25G
SPN130: 2 PORTs *100G
Hi Yanling,
As far as I can see hnic (from Huawei) and this spnic drivers are alike, what is the relation between these two?
Quoted 61 lines
The following is main features of our SPNIC:
- TSO
- LRO
- Flow control
- SR-IOV(Partially supported)
- VLAN offload
- VLAN filter
- CRC offload
- Promiscuous mode
- RSS
v6->v5, No real changes:
1. Move the fix ofRTE_ETH_DEV_AUTOFILL_QUEUE_XSTATSfrom patch 26 to patch 2;
2. Change the description of patch 26.
v5->v4:
1. Add prefix "spinc_" for external functions;
2. Remove temporary MACRO:RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS
3. Do not use void* for keeping the type information
v3->v4:
1. Fix ABI test failure;
2. Remove some descriptions inspnic.rst.
v2->v3:
1. Fix clang compiling failure.
v1->v2:
1. Fix coding style issues and compiling failures;
2. Only support linux in meson.build;
3. UseCLOCK_MONOTONIC_COARSEinstead of CLOCK_MONOTONIC/CLOCK_MONOTONIC_RAW;
4. Fixtime_before();
5. Remove redundant checks inspnic_dev_configure();Yanling Song (26):
drivers/net: introduce a new PMD driver net/spnic: initialize the HW interface net/spnic: add mbox message channel
net/spnic: introduce event queue
net/spnic: add mgmt module
net/spnic: add cmdq and work queue
net/spnic: add interface handling cmdq message net/spnic: add hardware info initialization net/spnic: support MAC and link event handling net/spnic: add function info initialization net/spnic: add queue pairs context initialization net/spnic: support mbuf handling of Tx/Rx net/spnic: support Rx congfiguration
net/spnic: add port/vport enable
net/spnic: support IO packets handling net/spnic: add device configure/version/info net/spnic: support RSS configuration update and get net/spnic: support VLAN filtering and offloading net/spnic: support promiscuous and allmulticast Rx modes net/spnic: support flow control
net/spnic: support getting Tx/Rx queues info net/spnic: net/spnic: support xstats statistics net/spnic: support VFIO interrupt
net/spnic: support Tx/Rx queue start/stop net/spnic: add doc infrastructure
net/spnic: fixes unsafe C style code
<...>
Quoted 10 lines · On Wed, 19 Jan 2022 16:56:52 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 8 lines · Yanling Song
The patchsets introduce SPNIC driver for Ramaxel's SPNxx serial NIC cards into DPDK 22.03. Ramaxel Memory Technology is a company which supply a lot of electric products: storage, communication, PCB... SPNxxx is a serial PCIE interface NIC cards:
SPN110: 2 PORTs *25G
SPN120: 4 PORTs *25G
SPN130: 2 PORTs *100G
Quoted 5 lines
Hi Yanling,
As far as I can see hnic (from Huawei) and this spnic drivers are alike, what is the relation between these two?
It is hard to create a brand new driver from scratch, so we referenced to hinic driver when developing spnic.
Quoted 63 lines
Quoted 61 lines
The following is main features of our SPNIC:
- TSO
- LRO
- Flow control
- SR-IOV(Partially supported)
- VLAN offload
- VLAN filter
- CRC offload
- Promiscuous mode
- RSS
v6->v5, No real changes:
1. Move the fix ofRTE_ETH_DEV_AUTOFILL_QUEUE_XSTATSfrom patch 26 to patch 2; 2. Change the description of patch 26.
v5->v4:
1. Add prefix "spinc_" for external functions;
2. Remove temporary MACRO:RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS
3. Do not use void* for keeping the type information
v3->v4:
1. Fix ABI test failure;
2. Remove some descriptions inspnic.rst.
v2->v3:
1. Fix clang compiling failure.
v1->v2:
1. Fix coding style issues and compiling failures;
2. Only support linux in meson.build;
3. UseCLOCK_MONOTONIC_COARSEinstead of CLOCK_MONOTONIC/CLOCK_MONOTONIC_RAW; 4. Fixtime_before();
5. Remove redundant checks inspnic_dev_configure();Yanling Song (26):
drivers/net: introduce a new PMD driver net/spnic: initialize the HW interface net/spnic: add mbox message channel
net/spnic: introduce event queue
net/spnic: add mgmt module
net/spnic: add cmdq and work queue
net/spnic: add interface handling cmdq message net/spnic: add hardware info initialization net/spnic: support MAC and link event handling net/spnic: add function info initialization net/spnic: add queue pairs context initialization net/spnic: support mbuf handling of Tx/Rx net/spnic: support Rx congfiguration
net/spnic: add port/vport enable
net/spnic: support IO packets handling net/spnic: add device configure/version/info net/spnic: support RSS configuration update and get net/spnic: support VLAN filtering and offloading net/spnic: support promiscuous and allmulticast Rx modes net/spnic: support flow control
net/spnic: support getting Tx/Rx queues info net/spnic: net/spnic: support xstats statistics net/spnic: support VFIO interrupt
net/spnic: support Tx/Rx queue start/stop net/spnic: add doc infrastructure
net/spnic: fixes unsafe C style code<...>
Quoted 13 lines · Yanling Song
Quoted 10 lines · On Wed, 19 Jan 2022 16:56:52 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 8 lines · Yanling Song
The patchsets introduce SPNIC driver for Ramaxel's SPNxx serial NIC cards into DPDK 22.03. Ramaxel Memory Technology is a company which supply a lot of electric products: storage, communication, PCB... SPNxxx is a serial PCIE interface NIC cards:
SPN110: 2 PORTs *25G
SPN120: 4 PORTs *25G
SPN130: 2 PORTs *100G
Quoted 8 lines
Quoted 5 lines
Hi Yanling,
As far as I can see hnic (from Huawei) and this spnic drivers are alike, what is the relation between these two?
It is hard to create a brand new driver from scratch, so we referenced to hinic driver when developing spnic.
That is OK, but based on the familiarity of the code you may consider keeping the original code Copyright, I didn't investigate in that level but cc'ed hinic maintainers for info.
Also cc'ed Hemant for guidance.
But my question was more related to the HW, is there any relation between the hinic HW and spnic HW? Like one is derived from other etc...
Quoted 64 lines
Quoted 63 lines
Quoted 61 lines
The following is main features of our SPNIC:
- TSO
- LRO
- Flow control
- SR-IOV(Partially supported)
- VLAN offload
- VLAN filter
- CRC offload
- Promiscuous mode
- RSS
v6->v5, No real changes:
1. Move the fix ofRTE_ETH_DEV_AUTOFILL_QUEUE_XSTATSfrom patch 26 to patch 2; 2. Change the description of patch 26.
v5->v4:
1. Add prefix "spinc_" for external functions;
2. Remove temporary MACRO:RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS
3. Do not use void* for keeping the type information
v3->v4:
1. Fix ABI test failure;
2. Remove some descriptions inspnic.rst.
v2->v3:
1. Fix clang compiling failure.
v1->v2:
1. Fix coding style issues and compiling failures;
2. Only support linux in meson.build;
3. UseCLOCK_MONOTONIC_COARSEinstead of CLOCK_MONOTONIC/CLOCK_MONOTONIC_RAW; 4. Fixtime_before();
5. Remove redundant checks inspnic_dev_configure();Yanling Song (26):
drivers/net: introduce a new PMD driver net/spnic: initialize the HW interface net/spnic: add mbox message channel
net/spnic: introduce event queue
net/spnic: add mgmt module
net/spnic: add cmdq and work queue
net/spnic: add interface handling cmdq message net/spnic: add hardware info initialization net/spnic: support MAC and link event handling net/spnic: add function info initialization net/spnic: add queue pairs context initialization net/spnic: support mbuf handling of Tx/Rx net/spnic: support Rx congfiguration net/spnic: add port/vport enable
net/spnic: support IO packets handling net/spnic: add device configure/version/info net/spnic: support RSS configuration update and get net/spnic: support VLAN filtering and offloading net/spnic: support promiscuous and allmulticast Rx modes net/spnic: support flow control
net/spnic: support getting Tx/Rx queues info net/spnic: net/spnic: support xstats statistics net/spnic: support VFIO interrupt
net/spnic: support Tx/Rx queue start/stop net/spnic: add doc infrastructure
net/spnic: fixes unsafe C style code<...>
Quoted 18 lines · Ferruh Yigit
Quoted 17 lines · Yanling Song
Quoted 14 lines · On Wed, 19 Jan 2022 16:56:52 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 7 lines · Yanling Song
The patchsets introduce SPNIC driver for Ramaxel's SPNxx serial NIC cards into DPDK 22.03. Ramaxel Memory Technology is a company which supply a lot of electric products: storage, communication, PCB... SPNxxx is a serial PCIE interface NIC cards:
SPN110: 2 PORTs *25G
SPN120: 4 PORTs *25G
SPN130: 2 PORTs *100GHi Yanling,
As far as I can see hnic (from Huawei) and this spnic drivers are alike, what is the relation between these two?
Quoted 10 lines
Quoted 3 lines
It is hard to create a brand new driver from scratch, so we referenced to hinic driver when developing spnic.
That is OK, but based on the familiarity of the code you may consider keeping the original code Copyright, I didn't investigate in that level but cc'ed hinic maintainers for info.
Also cc'ed Hemant for guidance.
Yes, if large part of code is driven from an existing driver, it is advisable to keep the original copyright. You can add your copyright as well, if you have changed the code.
Alternately, you provide reference in the file header, that this file id driver from xx file having license type Y.
Quoted 68 lines
But my question was more related to the HW, is there any relation between the hinic HW and spnic HW? Like one is derived from other etc...
Quoted 64 lines
Quoted 63 lines
Quoted 61 lines
The following is main features of our SPNIC:
- TSO
- LRO
- Flow control
- SR-IOV(Partially supported)
- VLAN offload
- VLAN filter
- CRC offload
- Promiscuous mode
- RSS
v6->v5, No real changes:
1. Move the fix ofRTE_ETH_DEV_AUTOFILL_QUEUE_XSTATSfrom patch 26 to patch 2; 2. Change the description of patch 26.
v5->v4:
1. Add prefix "spinc_" for external functions;
2. Remove temporary MACRO:RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS
3. Do not use void* for keeping the type information
v3->v4:
1. Fix ABI test failure;
2. Remove some descriptions inspnic.rst.
v2->v3:
1. Fix clang compiling failure.
v1->v2:
1. Fix coding style issues and compiling failures;
2. Only support linux in meson.build;
3. UseCLOCK_MONOTONIC_COARSEinstead of CLOCK_MONOTONIC/CLOCK_MONOTONIC_RAW; 4. Fixtime_before();
5. Remove redundant checks inspnic_dev_configure();Yanling Song (26):
drivers/net: introduce a new PMD driver net/spnic: initialize the HW interface net/spnic: add mbox message channel
net/spnic: introduce event queue
net/spnic: add mgmt module
net/spnic: add cmdq and work queue
net/spnic: add interface handling cmdq message net/spnic: add hardware info initialization net/spnic: support MAC and link event handling net/spnic: add function info initialization net/spnic: add queue pairs context initialization net/spnic: support mbuf handling of Tx/Rx net/spnic: support Rx congfiguration net/spnic: add port/vport enable
net/spnic: support IO packets handling net/spnic: add device configure/version/info net/spnic: support RSS configuration update and get net/spnic: support VLAN filtering and offloading net/spnic: support promiscuous and allmulticast Rx modes net/spnic: support flow control
net/spnic: support getting Tx/Rx queues info net/spnic: net/spnic: support xstats statistics net/spnic: support VFIO interrupt
net/spnic: support Tx/Rx queue start/stop net/spnic: add doc infrastructure
net/spnic: fixes unsafe C style code<...>
Quoted 19 lines · On Fri, 21 Jan 2022 10:22:10 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 18 lines · Yanling Song
Quoted 15 lines · On Wed, 19 Jan 2022 16:56:52 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 8 lines · Yanling Song
The patchsets introduce SPNIC driver for Ramaxel's SPNxx serial NIC cards into DPDK 22.03. Ramaxel Memory Technology is a company which supply a lot of electric products: storage, communication, PCB... SPNxxx is a serial PCIE interface NIC cards:
SPN110: 2 PORTs *25G
SPN120: 4 PORTs *25G
SPN130: 2 PORTs *100GHi Yanling,
As far as I can see hnic (from Huawei) and this spnic drivers are alike, what is the relation between these two?
Quoted 10 lines
Quoted 3 lines
It is hard to create a brand new driver from scratch, so we referenced to hinic driver when developing spnic.
That is OK, but based on the familiarity of the code you may consider keeping the original code Copyright, I didn't investigate in that level but cc'ed hinic maintainers for info.
Also cc'ed Hemant for guidance.
Sorry for late reponse since it was Spring Festival and I was in vacation, just back to work.
Hemant gave the guidance already, but we do not want to keep another company's copyright in our code. How should we modify code so that the code meet DPDK's requirment and can be accepted with our copyright only?
Quoted 3 lines
But my question was more related to the HW, is there any relation between the hinic HW and spnic HW? Like one is derived from other etc...
I'm not clear what's the relation between hinic/spnic hw since we do not know what's the hinic hw.
Quoted 66 lines
Quoted 65 lines
Quoted 64 lines
Quoted 62 lines
The following is main features of our SPNIC:
- TSO
- LRO
- Flow control
- SR-IOV(Partially supported)
- VLAN offload
- VLAN filter
- CRC offload
- Promiscuous mode
- RSS
v6->v5, No real changes:
1. Move the fix ofRTE_ETH_DEV_AUTOFILL_QUEUE_XSTATSfrom patch 26 to patch 2; 2. Change the description of patch 26.
v5->v4:
1. Add prefix "spinc_" for external functions;
2. Remove temporary MACRO:RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS
3. Do not use void* for keeping the type information
v3->v4:
1. Fix ABI test failure;
2. Remove some descriptions inspnic.rst.
v2->v3:
1. Fix clang compiling failure.
v1->v2:
1. Fix coding style issues and compiling failures;
2. Only support linux in meson.build;
3. UseCLOCK_MONOTONIC_COARSEinstead of CLOCK_MONOTONIC/CLOCK_MONOTONIC_RAW; 4. Fixtime_before();
5. Remove redundant checks inspnic_dev_configure();Yanling Song (26):
drivers/net: introduce a new PMD driver net/spnic: initialize the HW interface net/spnic: add mbox message channel
net/spnic: introduce event queue
net/spnic: add mgmt module
net/spnic: add cmdq and work queue
net/spnic: add interface handling cmdq message net/spnic: add hardware info initialization net/spnic: support MAC and link event handling net/spnic: add function info initialization net/spnic: add queue pairs context initialization net/spnic: support mbuf handling of Tx/Rx net/spnic: support Rx congfiguration net/spnic: add port/vport enable
net/spnic: support IO packets handling net/spnic: add device configure/version/info net/spnic: support RSS configuration update and get net/spnic: support VLAN filtering and offloading net/spnic: support promiscuous and allmulticast Rx modes net/spnic: support flow control
net/spnic: support getting Tx/Rx queues info net/spnic: net/spnic: support xstats statistics net/spnic: support VFIO interrupt
net/spnic: support Tx/Rx queue start/stop net/spnic: add doc infrastructure
net/spnic: fixes unsafe C style code<...>
12/02/2022 15:01, Yanling Song:
Quoted 22 lines
Quoted 19 lines · On Fri, 21 Jan 2022 10:22:10 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 18 lines · Yanling Song
Quoted 14 lines · On Wed, 19 Jan 2022 16:56:52 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 8 lines · Yanling Song
The patchsets introduce SPNIC driver for Ramaxel's SPNxx serial NIC cards into DPDK 22.03. Ramaxel Memory Technology is a company which supply a lot of electric products: storage, communication, PCB... SPNxxx is a serial PCIE interface NIC cards:
SPN110: 2 PORTs *25G
SPN120: 4 PORTs *25G
SPN130: 2 PORTs *100GHi Yanling,
As far as I can see hnic (from Huawei) and this spnic drivers are alike, what is the relation between these two?
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
It is hard to create a brand new driver from scratch, so we referenced to hinic driver when developing spnic.
That is OK, but based on the familiarity of the code you may consider keeping the original code Copyright, I didn't investigate in that level but cc'ed hinic maintainers for info.
Also cc'ed Hemant for guidance.
What is the percentage of familiarity in the code?
Quoted 8 lines
Sorry for late reponse since it was Spring Festival and I was in vacation, just back to work.
Hemant gave the guidance already, but we do not want to keep another company's copyright in our code.
How should we modify code so that the
code meet DPDK's requirment and can be accepted with our copyright only?
If you don't want to keep a copyright, don't copy the code.
Quoted 6 lines
Quoted 3 lines
But my question was more related to the HW, is there any relation between the hinic HW and spnic HW? Like one is derived from other etc...
I'm not clear what's the relation between hinic/spnic hw since we do not know what's the hinic hw.
Do you mean you are copying a driver and its design choices without understanding what it does?
Quoted 26 lines · On Sun, 13 Feb 2022 19:07:09 +0100 Thomas Monjalon <[email protected]> wrote:
12/02/2022 15:01, Yanling Song:
Quoted 25 lines
Quoted 22 lines · On Fri, 21 Jan 2022 10:22:10 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 20 lines · Yanling Song
Quoted 10 lines · On Wed, 19 Jan 2022 16:56:52 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 8 lines · Yanling Song
The patchsets introduce SPNIC driver for Ramaxel's SPNxx serial NIC cards into DPDK 22.03. Ramaxel Memory Technology is a company which supply a lot of electric products:
storage, communication, PCB... SPNxxx is a serial PCIE interface NIC cards: SPN110: 2 PORTs *25G
SPN120: 4 PORTs *25G
SPN130: 2 PORTs *100GQuoted 4 lines
Hi Yanling,
As far as I can see hnic (from Huawei) and this spnic drivers are alike, what is the relation between these two?
It is hard to create a brand new driver from scratch, so we referenced to hinic driver when developing spnic.
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
That is OK, but based on the familiarity of the code you may consider keeping the original code Copyright, I didn't investigate in that level but cc'ed hinic maintainers for info. Also cc'ed Hemant for guidance.
What is the percentage of familiarity in the code?
Scanned by tools: There are 0.8k similar code.
Quoted 11 lines
Quoted 8 lines
Sorry for late reponse since it was Spring Festival and I was in vacation, just back to work.
Hemant gave the guidance already, but we do not want to keep another company's copyright in our code.
How should we modify code so that the
code meet DPDK's requirment and can be accepted with our copyright only?If you don't want to keep a copyright, don't copy the code.
Got it. We will modify the code to meet the requirement of community and upstream it again. Since the change is great, I'm afraid that the new code maybe cannot meet the schedule of 22.03.
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
But my question was more related to the HW, is there any relation between the hinic HW and spnic HW? Like one is derived from other etc...
I'm not clear what's the relation between hinic/spnic hw since we do not know what's the hinic hw.
Do you mean you are copying a driver and its design choices without understanding what it does?
In my opinion, it does not conflict with open source: we can develop the driver on our own without referring to other driver and will do it this way.
Quoted 47 lines · Yanling Song
Quoted 26 lines · On Sun, 13 Feb 2022 19:07:09 +0100 Thomas Monjalon <[email protected]> wrote:
12/02/2022 15:01, Yanling Song:
Quoted 25 lines
Quoted 22 lines · On Fri, 21 Jan 2022 10:22:10 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 20 lines · Yanling Song
Quoted 10 lines · On Wed, 19 Jan 2022 16:56:52 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 8 lines · Yanling Song
The patchsets introduce SPNIC driver for Ramaxel's SPNxx serial NIC cards into DPDK 22.03. Ramaxel Memory Technology is a company which supply a lot of electric products:
storage, communication, PCB... SPNxxx is a serial PCIE interface NIC cards: SPN110: 2 PORTs *25G
SPN120: 4 PORTs *25G
SPN130: 2 PORTs *100GQuoted 4 lines
Hi Yanling,
As far as I can see hnic (from Huawei) and this spnic drivers are alike, what is the relation between these two?
It is hard to create a brand new driver from scratch, so we referenced to hinic driver when developing spnic.
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
That is OK, but based on the familiarity of the code you may consider keeping the original code Copyright, I didn't investigate in that level but cc'ed hinic maintainers for info. Also cc'ed Hemant for guidance.
What is the percentage of familiarity in the code?
Scanned by tools: There are 0.8k similar code.
Quoted 9 lines
Quoted 8 lines
Sorry for late reponse since it was Spring Festival and I was in vacation, just back to work.
Hemant gave the guidance already, but we do not want to keep another company's copyright in our code.
How should we modify code so that the
code meet DPDK's requirment and can be accepted with our copyright only?
Quoted 6 lines
Quoted 2 lines
If you don't want to keep a copyright, don't copy the code.
Got it. We will modify the code to meet the requirement of community and upstream it again. Since the change is great, I'm afraid that the new code maybe cannot meet the schedule of 22.03.
Hi Yanling,
What is the status of the driver? Will there be a new version?
13/04/2023 11:02, Ferruh Yigit:
Quoted 5 lines · Yanling Song
Quoted 4 lines
Quoted 2 lines · On Sun, 13 Feb 2022 19:07:09 +0100 Thomas Monjalon <[email protected]> wrote:
If you don't want to keep a copyright, don't copy the code.
Quoted 7 lines
Quoted 3 lines
Got it. We will modify the code to meet the requirement of community and upstream it again. Since the change is great, I'm afraid that the new code maybe cannot meet the schedule of 22.03.
Hi Yanling,
What is the status of the driver? Will there be a new version?
It seems this patch was abandoned.
Anyway it was a lot of copy/pasting from hinic driver without keeping the copyright.
Tell us in case I say something wrong.
Quoted 6 lines · Yanling Song
Quoted 3 lines
But my question was more related to the HW, is there any relation between the hinic HW and spnic HW? Like one is derived from other etc...
I'm not clear what's the relation between hinic/spnic hw since we do not know what's the hinic hw.
So there is no relation between HW, thanks for clarification.