Add advanced features for Huawei hinic pmd
Subsystems (2)
v3 cover Add advanced features for Huawei hinic pmd
This patch set adds advanced features for Huawei hinic pmd, such as VLAN filter and VLAN offload, SR-IOV, FW version get, set link down and up, Flow director for LACP, VRRP, BGP and so on.
--
v2:
- Fix RSS bugs for vxlan packets inner type
- Add comments for new added func interface
- Fix code review comments from patch v1
- Fix code style problems
- Remove ceq interfaces and definitions that not used
- Fix aeq init bugs, firstly alloc aeq resource, then set aeq ctrl len
- Fix bar map bugs for VF Page size larger than PF
- Modify link state set, add enable or disable fiber in tx direction
- Fix mbox and mgmt channel sync lock mechanism to reduce CPU usage
- Fix FDIR bugs for VRRP packets
- Fit ABI changes from dpdk lib
v3:
- Split hinic.ini and hinic.rst to related feature patches
- Add min_mtu & max_mtu initialization for hinic_dev_infos_get
- Fix fdir config patch with net/hinic/base
- Split link patch into link and fw version getting 2 patches
- Update pmd doc files to new next version
- Add comments for cover letter patch
- Add rxq & txq info getting interfaces
- Fix load intrinsics for receiving packets
Xiaoyun wang (19):
net/hinic/base: add mbox command channel for SRIOV net/hinic/base: add HW interfaces for SR-IOV net/hinic: add VF PMD operation interfaces net/hinic: add VLAN filter and offload net/hinic: add allmulticast mode and MTU set net/hinic: add unicast and multicast MAC set net/hinic/base: add fdir config interface net/hinic: add fdir validate flow operations net/hinic: create and destroy ntuple filter net/hinic: create and destroy fdir filter net/hinic: flush fdir filter
net/hinic: set link down and up
net/hinic: get firmware version
net/hinic: support inner L3 checksum offload net/hinic: support LRO offload
net/hinic: add hinic PMD doc files net/hinic/base: optimize aeq interfaces net/hinic: optimize RX performance net/hinic: add support for getting rxq or txq info
doc/guides/nics/features/hinic.ini | 12 +- doc/guides/nics/hinic.rst | 10 + doc/guides/rel_notes/release_19_11.rst | 9 + drivers/net/hinic/Makefile | 2 + drivers/net/hinic/base/hinic_compat.h | 62 +- drivers/net/hinic/base/hinic_csr.h | 29 +- drivers/net/hinic/base/hinic_pmd_api_cmd.c | 60 +- drivers/net/hinic/base/hinic_pmd_cfg.c | 35 + drivers/net/hinic/base/hinic_pmd_cmd.h | 26 +- drivers/net/hinic/base/hinic_pmd_eqs.c | 245 +-- drivers/net/hinic/base/hinic_pmd_eqs.h | 5 +- drivers/net/hinic/base/hinic_pmd_hwdev.c | 198 ++- drivers/net/hinic/base/hinic_pmd_hwdev.h | 9 +- drivers/net/hinic/base/hinic_pmd_hwif.c | 85 +- drivers/net/hinic/base/hinic_pmd_hwif.h | 15 +- drivers/net/hinic/base/hinic_pmd_mbox.c | 938 +++++++++++ drivers/net/hinic/base/hinic_pmd_mbox.h | 93 ++ drivers/net/hinic/base/hinic_pmd_mgmt.c | 83 +- drivers/net/hinic/base/hinic_pmd_mgmt.h | 2 +- drivers/net/hinic/base/hinic_pmd_niccfg.c | 777 ++++++++- drivers/net/hinic/base/hinic_pmd_niccfg.h | 203 +++ drivers/net/hinic/base/hinic_pmd_nicio.c | 15 +- drivers/net/hinic/base/hinic_pmd_nicio.h | 3 +- drivers/net/hinic/base/meson.build | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 1020 ++++++++++-- drivers/net/hinic/hinic_pmd_ethdev.h | 139 +- drivers/net/hinic/hinic_pmd_flow.c | 2385 ++++++++++++++++++++++++++++ drivers/net/hinic/hinic_pmd_rx.c | 15 +- drivers/net/hinic/hinic_pmd_rx.h | 11 + drivers/net/hinic/hinic_pmd_tx.c | 190 ++- drivers/net/hinic/meson.build | 1 + 31 files changed, 6050 insertions(+), 628 deletions(-) create mode 100644 drivers/net/hinic/base/hinic_pmd_mbox.c create mode 100644 drivers/net/hinic/base/hinic_pmd_mbox.h create mode 100644 drivers/net/hinic/hinic_pmd_flow.c
Signature · 1 line
1.8.3.1
PATCH v3 1/19 net/hinic/base: add mbox command channel for SRIOV
Add mbox command channel for SR-IOV, which is used to communicate between VF and VF, VF and PF. This patch introduces data structures, initialization, interfaces and commands of mbox channel.
--- doc/guides/nics/features/hinic.ini | 1 + doc/guides/nics/hinic.rst | 1 + drivers/net/hinic/Makefile | 1 + drivers/net/hinic/base/hinic_compat.h | 34 +- drivers/net/hinic/base/hinic_pmd_hwdev.h | 5 +- drivers/net/hinic/base/hinic_pmd_mbox.c | 938 +++++++++++++++++++++++++++++++ drivers/net/hinic/base/hinic_pmd_mbox.h | 93 +++ drivers/net/hinic/base/meson.build | 1 + 8 files changed, 1071 insertions(+), 3 deletions(-) create mode 100644 drivers/net/hinic/base/hinic_pmd_mbox.c create mode 100644 drivers/net/hinic/base/hinic_pmd_mbox.h
doc/guides/nics/features/hinic.ini +1 -0
@@ -19,6 +19,7 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +SR-IOV = Y CRC offload = Y L3 checksum offload = Y L4 checksum offload = Y
doc/guides/nics/hinic.rst +1 -0
@@ -24,6 +24,7 @@ Features - Link state information - Link flow control - Scattered and gather for TX and RX +- SR-IOV - Partially supported at this point, VFIO only Prerequisites -------------
drivers/net/hinic/Makefile +1 -0
@@ -59,6 +59,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_mgmt.c SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_niccfg.c SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_nicio.c SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_wq.c +SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_mbox.c SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_rx.c
drivers/net/hinic/base/hinic_compat.h +32 -2
@@ -227,7 +227,7 @@ static inline u16 ilog2(u32 n)* hinic_cpu_to_be32 - convert data to big endian 32 bit format * @data: the data to convert * @len: length of data to convert, must be Multiple of 4B -**/ +*/ static inline void hinic_cpu_to_be32 (void *data,u32 len) {u32 i;
@@ -243,7 +243,7 @@ static inline void hinic_cpu_to_be32(void *data, u32 len)* hinic_be32_to_cpu - convert data from big endian 32 bit format * @data: the data to convert * @len: length of data to convert, must be Multiple of 4B -**/ +*/ static inline void hinic_be32_to_cpu (void *data,u32 len) {u32 i;
@@ -278,4 +278,34 @@ static inline int hinic_mutex_destroy(pthread_mutex_t *pthreadmutex)return err; } +static inline int hinic_mutex_lock (pthread_mutex_t *pthreadmutex) +{ +int err; + + err =pthread_mutex_lock (pthreadmutex); +if (!err) { +return err; + }else if (err ==EOWNERDEAD ) { +PMD_DRV_LOG (ERR ,"Mutex lock failed. (ErrorNo=%d)" , errno); +#if defined(__GLIBC__) +#if __GLIBC_PREREQ (2 ,12 ) + (void )pthread_mutex_consistent (pthreadmutex); +#else + (void )pthread_mutex_consistent_np (pthreadmutex); +#endif +#else + (void )pthread_mutex_consistent (pthreadmutex); +#endif + }else { +PMD_DRV_LOG (ERR ,"Mutex lock failed. (ErrorNo=%d)" , errno); + } + +return err; +} + +static inline int hinic_mutex_unlock (pthread_mutex_t *pthreadmutex) +{ +return pthread_mutex_unlock (pthreadmutex); +} +#endif /* _HINIC_COMPAT_H_ */
drivers/net/hinic/base/hinic_pmd_hwdev.h +4 -1
@@ -7,13 +7,15 @@#include "hinic_pmd_cmd.h" -#define HINIC_PAGE_SIZE_MAX 20 +#define HINIC_PAGE_SIZE_MAX 20#define HINIC_MGMT_CMD_UNSUPPORTED 0xFF#define HINIC_PF_SET_VF_ALREADY 0x4#define MAX_PCIE_DFX_BUF_SIZE 1024 +#define HINIC_DEV_BUSY_ACTIVE_FW 0xFE +/* dma pool */ struct dma_pool {u32 inuse;
@@ -436,6 +438,7 @@ struct hinic_hwdev {struct hinic_hwif *hwif;struct cfg_mgmt_info *cfg_mgmt;struct hinic_aeqs *aeqs; +struct hinic_mbox_func_to_func *func_to_func;struct hinic_msg_pf_to_mgmt *pf_to_mgmt;struct hinic_cmdqs *cmdqs;struct hinic_nic_io *nic_io;
drivers/net/hinic/base/hinic_pmd_mbox.c new file +938 -0
938 lines not on this page · raw message
drivers/net/hinic/base/hinic_pmd_mbox.h new file +93 -0
93 lines not on this page · raw message
drivers/net/hinic/base/meson.build +1 -0
@@ -12,6 +12,7 @@ sources = [ 'hinic_pmd_niccfg.c', 'hinic_pmd_nicio.c', 'hinic_pmd_wq.c', + 'hinic_pmd_mbox.c', ] extra_flags = []
Signature · 1 line
1.8.3.1
PATCH v3 2/19 net/hinic/base: add HW interfaces for SR-IOV
In reply to Xiaoyun wangThis patch introduces some HW interfaces required for SR-IOV function,
including: init hwdev, set port state, get default cos,
vf dma attribute table, vf txrx flush and so on.
--- drivers/net/hinic/base/hinic_compat.h | 32 ---- drivers/net/hinic/base/hinic_pmd_api_cmd.c | 60 +++---- drivers/net/hinic/base/hinic_pmd_cfg.c | 35 ++++ drivers/net/hinic/base/hinic_pmd_cmd.h | 14 +- drivers/net/hinic/base/hinic_pmd_hwdev.c | 198 ++++++++++++++++----- drivers/net/hinic/base/hinic_pmd_hwdev.h | 4 + drivers/net/hinic/base/hinic_pmd_hwif.c | 85 ++++++++- drivers/net/hinic/base/hinic_pmd_hwif.h | 15 +- drivers/net/hinic/base/hinic_pmd_mgmt.c | 83 +++++---- drivers/net/hinic/base/hinic_pmd_mgmt.h | 2 +- drivers/net/hinic/base/hinic_pmd_niccfg.c | 268 +++++++++++++++++++++++------ drivers/net/hinic/base/hinic_pmd_niccfg.h | 4 + drivers/net/hinic/base/hinic_pmd_nicio.c | 15 +- drivers/net/hinic/base/hinic_pmd_nicio.h | 3 +- 14 files changed, 606 insertions(+), 212 deletions(-)
drivers/net/hinic/base/hinic_compat.h +0 -32
@@ -223,38 +223,6 @@ static inline u16 ilog2(u32 n)return res; } -/** -* hinic_cpu_to_be32 - convert data to big endian 32 bit format -* @data: the data to convert -* @len: length of data to convert, must be Multiple of 4B -*/ -static inline void hinic_cpu_to_be32 (void *data,u32 len) -{ -u32 i; -u32 *mem = (u32 *)data; - -for (i =0 ; i < (len >>2 ); i++) { - *mem =cpu_to_be32 (*mem); - mem++; - } -} - -/** -* hinic_be32_to_cpu - convert data from big endian 32 bit format -* @data: the data to convert -* @len: length of data to convert, must be Multiple of 4B -*/ -static inline void hinic_be32_to_cpu (void *data,u32 len) -{ -u32 i; -u32 *mem = (u32 *)data; - -for (i =0 ; i < (len >>2 ); i++) { - *mem =be32_to_cpu (*mem); - mem++; - } -} -static inline int hinic_mutex_init (pthread_mutex_t *pthreadmutex,const pthread_mutexattr_t *mattr) {
drivers/net/hinic/base/hinic_pmd_api_cmd.c +30 -30
240 lines not on this page · raw message
drivers/net/hinic/base/hinic_pmd_cfg.c +35 -0
@@ -8,6 +8,7 @@#include "hinic_pmd_mgmt.h" #include "hinic_pmd_eqs.h" #include "hinic_pmd_cfg.h" +#include "hinic_pmd_mbox.h" bool hinic_support_nic (struct hinic_hwdev *hwdev,struct nic_service_cap *cap) {
@@ -122,6 +123,10 @@ static void hinic_parse_pub_res_cap(struct service_cap *cap, cap->vf_id_start = dev_cap->vf_id_start; cap->max_sqs = dev_cap->nic_max_sq +1 ; cap->max_rqs = dev_cap->nic_max_rq +1 ; + }else { + cap->max_vf =0 ; + cap->max_sqs = dev_cap->nic_max_sq; + cap->max_rqs = dev_cap->nic_max_rq; } cap->chip_svc_type =CFG_SVC_NIC_BIT0 ;
@@ -180,6 +185,28 @@ static int get_cap_from_fw(struct hinic_hwdev *dev, enum func_type type)return 0 ; } +static int get_cap_from_pf (struct hinic_hwdev *dev,enum func_type type) +{ +int err; +u16 in_len, out_len; +struct hinic_dev_cap dev_cap; + +memset (&dev_cap,0 ,sizeof (dev_cap)); + in_len =sizeof (dev_cap); + out_len = in_len; + err =hinic_mbox_to_pf (dev,HINIC_MOD_CFGM ,HINIC_CFG_MBOX_CAP , + &dev_cap, in_len, &dev_cap, &out_len, +CFG_MAX_CMD_TIMEOUT ); +if (err || dev_cap.mgmt_msg_head.status || !out_len) { +PMD_DRV_LOG (ERR ,"Get capability from PF failed, err: %d, status: %d, out_len: %d" , + err, dev_cap.mgmt_msg_head.status, out_len); +return -EFAULT ; + } + +parse_dev_cap (dev, &dev_cap, type); +return 0 ; +} +static int get_dev_cap (struct hinic_hwdev *dev) {int err;
@@ -194,6 +221,14 @@ static int get_dev_cap(struct hinic_hwdev *dev)return err; }break ; +case TYPE_VF : + err =get_cap_from_pf (dev, type); +if (err) { +PMD_DRV_LOG (ERR ,"Get VF capability failed, err: %d" , + err); +return err; + } +break ;default :PMD_DRV_LOG (ERR ,"Unsupported PCI function type" );return -EINVAL ;
drivers/net/hinic/base/hinic_pmd_cmd.h +10 -4
@@ -25,6 +25,12 @@ enum hinic_mod_type {HINIC_MOD_MAX =15 }; +/* only used by VFD communicating with PFD to register or unregister, +* command mode type is HINIC_MOD_L2NIC +*/ +#define HINIC_PORT_CMD_VF_REGISTER 0x0 +#define HINIC_PORT_CMD_VF_UNREGISTER 0x1 +/* cmd of mgmt CPU message for NIC module */ enum hinic_port_cmd {HINIC_PORT_CMD_MGMT_RESET =0x0 ,
@@ -416,12 +422,12 @@ enum hinic_pf_status { };/* total doorbell or direct wqe size is 512kB, db num: 128, dwqe: 128 */ -#define HINIC_DB_DWQE_SIZE 0x00080000 +#define HINIC_DB_DWQE_SIZE 0x00080000 -/* db/dwqe page size: 4K */ -#define HINIC_DB_PAGE_SIZE 0x00001000ULL +/* db page size: 4K */ +#define HINIC_DB_PAGE_SIZE 0x00001000ULL -#define HINIC_DB_MAX_AREAS (HINIC_DB_DWQE_SIZE / HINIC_DB_PAGE_SIZE) +#define HINIC_DB_MAX_AREAS (HINIC_DB_DWQE_SIZE / HINIC_DB_PAGE_SIZE)#define HINIC_PCI_MSIX_ENTRY_SIZE 16#define HINIC_PCI_MSIX_ENTRY_VECTOR_CTRL 12
drivers/net/hinic/base/hinic_pmd_hwdev.c +158 -40
323 lines not on this page · raw message
drivers/net/hinic/base/hinic_pmd_hwdev.h +4 -0
@@ -485,4 +485,8 @@ void hinic_hilink_async_event_handle(struct hinic_hwdev *hwdev, u8 cmd,int hinic_set_pagesize (void *hwdev,u8 page_size); +void hinic_cpu_to_be32 (void *data,u32 len); + +void hinic_be32_to_cpu (void *data,u32 len); +#endif /* _HINIC_PMD_HWDEV_H_ */
drivers/net/hinic/base/hinic_pmd_hwif.c +77 -8
169 lines not on this page · raw message
drivers/net/hinic/base/hinic_pmd_hwif.h +10 -5
@@ -31,7 +31,7 @@ enum hinic_msix_state { HINIC_MSIX_DISABLE, }; -/* Defines the IRQ information structure*/ +/* Defines the IRQ information structure */ struct irq_info {u16 msix_entry_idx;/* IRQ corresponding index number */ u32 irq_id;/* the IRQ number from OS */
@@ -59,11 +59,11 @@ struct hinic_func_attr {u8 ppf_idx; -u16 num_irqs;/* max: 2 ^ 15 */ -u8 num_aeqs;/* max: 2 ^ 3 */ -u8 num_ceqs;/* max: 2 ^ 7 */ +u16 num_irqs;/* max: 2 ^ 15 */ +u8 num_aeqs;/* max: 2 ^ 3 */ +u8 num_ceqs;/* max: 2 ^ 7 */ -u8 num_dma_attr;/* max: 2 ^ 6 */ +u8 num_dma_attr;/* max: 2 ^ 6 */ u16 global_vf_id_of_pf; };
@@ -104,6 +104,9 @@ static inline u32 hinic_hwif_read_reg(struct hinic_hwif *hwif, u32 reg)void hinic_free_db_addr (void *hwdev,void __iomem *db_base); +int wait_until_doorbell_flush_states (struct hinic_hwif *hwif, +enum hinic_doorbell_ctrl states); +void hinic_set_msix_state (void *hwdev,u16 msix_idx,enum hinic_msix_state flag);
@@ -116,4 +119,6 @@ void hinic_misx_intr_clear_resend_bit(void *hwdev, u16 msix_idx,void hinic_hwif_res_free (struct hinic_hwdev *hwdev); +u8 hinic_dma_attr_entry_num (void *hwdev); +#endif /* _HINIC_PMD_HWIF_H_ */
drivers/net/hinic/base/hinic_pmd_mgmt.c +53 -30
274 lines not on this page · raw message
drivers/net/hinic/base/hinic_pmd_mgmt.h +1 -1
@@ -82,7 +82,7 @@ struct hinic_msg_pf_to_mgmt {struct hinic_hwdev *hwdev;/* mutex for sync message */ -pthread_mutex_t sync_msg_lock; +pthread_mutex_t sync_msg_mutex;void *async_msg_buf;void *sync_msg_buf;
drivers/net/hinic/base/hinic_pmd_niccfg.c +212 -56
409 lines not on this page · raw message
drivers/net/hinic/base/hinic_pmd_niccfg.h +4 -0
@@ -655,4 +655,8 @@ int hinic_set_link_status_follow(void *hwdev,int hinic_clear_phy_port_stats (struct hinic_hwdev *hwdev); +int hinic_vf_func_init (struct hinic_hwdev *hwdev); + +void hinic_vf_func_free (struct hinic_hwdev *hwdev); +#endif /* _HINIC_PMD_NICCFG_H_ */
drivers/net/hinic/base/hinic_pmd_nicio.c +11 -4
@@ -442,7 +442,7 @@ static int clean_qp_offload_ctxt(struct hinic_nic_io *nic_io)* @rx_buf_sz: receive buffer size * @return * hw rx buffer size -**/ +*/ static u16 get_hw_rx_buf_size (u32 rx_buf_sz) {u16 num_hw_types =sizeof (hinic_hw_rx_buf_size)
@@ -466,7 +466,7 @@ static u16 get_hw_rx_buf_size(u32 rx_buf_sz)* @sq_depth: the depth of transmit queue * @rx_buf_sz: receive buffer size from app * Return: 0 on success, negative error value otherwise. -**/ +*/ static int hinic_set_root_ctxt (void *hwdev,u16 rq_depth,u16 sq_depth,int rx_buf_sz) {
@@ -495,7 +495,7 @@ static u16 get_hw_rx_buf_size(u32 rx_buf_sz)* @return * 0 on success, * negative error value otherwise. -**/ +*/ static int hinic_clean_root_ctxt (void *hwdev) {struct hinic_root_ctxt root_ctxt;
@@ -618,6 +618,12 @@ static int hinic_init_nic_hwdev(struct hinic_hwdev *hwdev) goto err_init_nic_hwdev; } + err =hinic_vf_func_init (hwdev); +if (err) { +PMD_DRV_LOG (ERR ,"Failed to init nic mbox" ); + goto err_init_nic_hwdev; + } + err =hinic_set_fast_recycle_mode (hwdev,RECYCLE_MODE_DPDK );if (err) {PMD_DRV_LOG (ERR ,"Failed to set fast recycle mode" );
@@ -632,6 +638,7 @@ static int hinic_init_nic_hwdev(struct hinic_hwdev *hwdev)static void hinic_free_nic_hwdev (struct hinic_hwdev *hwdev) { +hinic_vf_func_free (hwdev); hwdev->nic_io =NULL ; }
@@ -861,7 +868,7 @@ void hinic_deinit_nicio(struct hinic_hwdev *hwdev)* @return * 0 on success, * negative error value otherwise. -**/ +*/ int hinic_convert_rx_buf_size (u32 rx_buf_sz,u32 *match_sz) {u32 i, num_hw_types, best_match_sz;
drivers/net/hinic/base/hinic_pmd_nicio.h +1 -2
@@ -217,7 +217,7 @@ struct hinic_nic_io {u16 vhd_mode;struct hinic_qp *qps; -/* sq ci mem base addr of the function*/ +/* sq ci mem base addr of the function */ void *ci_vaddr_base;dma_addr_t ci_dma_base;
@@ -229,7 +229,6 @@ struct hinic_sq_db {u32 db_info; }; -int hinic_init_qp_ctxts (struct hinic_hwdev *hwdev);void hinic_free_qp_ctxts (struct hinic_hwdev *hwdev);
Signature · 1 line
1.8.3.1
PATCH v3 3/19 net/hinic: add VF PMD operation interfaces
In reply to Xiaoyun wangThis patch adds VF PMD operation interfaces to support SR-IOV.
--- drivers/net/hinic/base/hinic_pmd_niccfg.c | 35 ++++ drivers/net/hinic/base/hinic_pmd_niccfg.h | 14 ++ drivers/net/hinic/hinic_pmd_ethdev.c | 255 ++++++++++++++++++++---------- 3 files changed, 223 insertions(+), 81 deletions(-)
drivers/net/hinic/base/hinic_pmd_niccfg.c +35 -0
@@ -1436,3 +1436,38 @@ int hinic_flush_qp_res(void *hwdev)return 0 ; } + +/** +* hinic_vf_get_default_cos - Get default cos of VF. +* +* @param hwdev +* The hardware interface of a nic device. +* @param cos_id +* Cos value. +* +* @return +* 0 on success. +* negative error value otherwise. +*/ +int hinic_vf_get_default_cos (struct hinic_hwdev *hwdev,u8 *cos_id) +{ +struct hinic_vf_default_cos vf_cos; +u16 out_size =sizeof (vf_cos); +int err; + +memset (&vf_cos,0 ,sizeof (vf_cos)); + vf_cos.mgmt_msg_head.resp_aeq_num =HINIC_AEQ1 ; + + err =hinic_msg_to_mgmt_sync (hwdev,HINIC_MOD_L2NIC , +HINIC_PORT_CMD_GET_VF_COS , &vf_cos, +sizeof (vf_cos), &vf_cos, + &out_size,0 ); +if (err || !out_size || vf_cos.mgmt_msg_head.status) { +PMD_DRV_LOG (ERR ,"Get VF default cos failed, err: %d, status: 0x%x, out size: 0x%x" , + err, vf_cos.mgmt_msg_head.status, out_size); +return -EFAULT ; + } + *cos_id = vf_cos.state.default_cos; + +return 0 ; +}
drivers/net/hinic/base/hinic_pmd_niccfg.h +14 -0
@@ -562,6 +562,18 @@ struct hinic_clear_qp_resource {u16 rsvd1; }; +struct hinic_dcb_state { +u8 dcb_on; +u8 default_cos; +u8 up_cos[8 ]; +}; + +struct hinic_vf_default_cos { +struct hinic_mgmt_msg_head mgmt_msg_head; + +struct hinic_dcb_state state; +}; +/* set physical port Anti-Attack rate */ struct hinic_port_anti_attack_rate {struct hinic_mgmt_msg_head mgmt_msg_head;
@@ -659,4 +671,6 @@ int hinic_set_link_status_follow(void *hwdev,void hinic_vf_func_free (struct hinic_hwdev *hwdev); +int hinic_vf_get_default_cos (struct hinic_hwdev *hwdev,u8 *cos_id); +#endif /* _HINIC_PMD_NICCFG_H_ */
drivers/net/hinic/hinic_pmd_ethdev.c +174 -81
400 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 4/19 net/hinic: add VLAN filter and offload
In reply to Xiaoyun wangThis patch adds support for VLAN filter and VLAN offload.
--- doc/guides/nics/features/hinic.ini | 2 + doc/guides/nics/hinic.rst | 1 + drivers/net/hinic/base/hinic_pmd_cmd.h | 1 + drivers/net/hinic/base/hinic_pmd_niccfg.c | 136 +++++++++++++++++++++ drivers/net/hinic/base/hinic_pmd_niccfg.h | 29 +++++ drivers/net/hinic/hinic_pmd_ethdev.c | 194 +++++++++++++++++++++++++++++- drivers/net/hinic/hinic_pmd_ethdev.h | 15 ++- 7 files changed, 372 insertions(+), 6 deletions(-)
doc/guides/nics/features/hinic.ini +2 -0
@@ -20,6 +20,8 @@ RSS key update = Y RSS reta update = Y Inner RSS = Y SR-IOV = Y +VLAN filter = Y +VLAN offload = Y CRC offload = Y L3 checksum offload = Y L4 checksum offload = Y
doc/guides/nics/hinic.rst +1 -0
@@ -25,6 +25,7 @@ Features - Link flow control - Scattered and gather for TX and RX - SR-IOV - Partially supported at this point, VFIO only +- VLAN filter and VLAN offload Prerequisites -------------
drivers/net/hinic/base/hinic_pmd_cmd.h +1 -0
@@ -140,6 +140,7 @@ enum hinic_port_cmd {HINIC_PORT_CMD_SET_VHD_CFG =0xF7 ,HINIC_PORT_CMD_SET_LINK_FOLLOW =0xF8 , + HINIC_PORT_CMD_SET_VLAN_FILTER = 0xFF };/* cmd of mgmt CPU message for HW module */
drivers/net/hinic/base/hinic_pmd_niccfg.c +136 -0
142 lines not on this page · raw message
drivers/net/hinic/base/hinic_pmd_niccfg.h +29 -0
@@ -380,6 +380,29 @@ struct hinic_mtu {u32 mtu; }; +struct hinic_vlan_config { +struct hinic_mgmt_msg_head mgmt_msg_head; + +u16 func_id; +u16 vlan_id; +}; + +struct hinic_vlan_filter { +struct hinic_mgmt_msg_head mgmt_msg_head; + +u16 func_id; +u8 rsvd1[2 ]; +u32 vlan_filter_ctrl; +}; + +struct hinic_vlan_offload { +struct hinic_mgmt_msg_head mgmt_msg_head; + +u16 func_id; +u8 vlan_rx_offload; +u8 rsvd1[5 ]; +}; +struct hinic_get_link {struct hinic_mgmt_msg_head mgmt_msg_head;
@@ -597,6 +620,12 @@ int hinic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,int hinic_set_port_mtu (void *hwdev,u32 new_mtu); +int hinic_add_remove_vlan (void *hwdev,u16 vlan_id,u16 func_id,bool add); + +int hinic_config_vlan_filter (void *hwdev,u32 vlan_filter_ctrl); + +int hinic_set_rx_vlan_offload (void *hwdev,u8 en); +int hinic_set_vport_enable (void *hwdev,bool enable);int hinic_set_port_enable (void *hwdev,bool enable);
drivers/net/hinic/hinic_pmd_ethdev.c +193 -1
248 lines not on this page · raw message
drivers/net/hinic/hinic_pmd_ethdev.h +10 -5
@@ -11,12 +11,12 @@#include "base/hinic_compat.h" #include "base/hinic_pmd_cfg.h" -#define HINIC_DEV_NAME_LEN (32) -#define HINIC_MAX_RX_QUEUES (64) +#define HINIC_DEV_NAME_LEN 32 +#define HINIC_MAX_RX_QUEUES 64/* mbuf pool for copy invalid mbuf segs */ -#define HINIC_COPY_MEMPOOL_DEPTH (128) -#define HINIC_COPY_MBUF_SIZE (4096) +#define HINIC_COPY_MEMPOOL_DEPTH 128 +#define HINIC_COPY_MBUF_SIZE 4096#define SIZE_8BYTES (size) (ALIGN((u32)(size), 8) >> 3)
@@ -31,6 +31,9 @@#define HINIC_TXD_ALIGN 1#define HINIC_RXD_ALIGN 1 +#define HINIC_UINT32_BIT_SIZE (CHAR_BIT * sizeof(uint32_t)) +#define HINIC_VFTA_SIZE (4096 / HINIC_UINT32_BIT_SIZE) +enum hinic_dev_status {HINIC_DEV_INIT ,HINIC_DEV_CLOSE ,
@@ -54,10 +57,12 @@ struct hinic_nic_dev {u8 num_rss;u8 rx_queue_list[HINIC_MAX_RX_QUEUES ]; +u32 vfta[HINIC_VFTA_SIZE ];/* VLAN bitmap */ +/* info */ unsigned int flags;struct nic_service_cap nic_cap; -u32 rx_mode_status;/* promisc allmulticast */ +u32 rx_mode_status;/* promisc or allmulticast */ unsigned long dev_status;/* dpdk only */
Signature · 1 line
1.8.3.1
PATCH v3 5/19 net/hinic: add allmulticast mode and MTU set
In reply to Xiaoyun wangWhen enable allmulticast mode, all multicast packets can be received. This patch also adds support for mtu set, the range of MTU is from 256 to 9600.
--- doc/guides/nics/features/hinic.ini | 4 +- doc/guides/nics/hinic.rst | 2 + drivers/net/hinic/hinic_pmd_ethdev.c | 110 ++++++++++++++++++++++++++++++++++- drivers/net/hinic/hinic_pmd_ethdev.h | 3 - 4 files changed, 114 insertions(+), 5 deletions(-)
doc/guides/nics/features/hinic.ini +3 -1
@@ -9,10 +9,12 @@ Link status = Y Link status event = Y Free Tx mbuf on demand = Y Queue start/stop = Y -Jumbo frame = N +MTU update = Y +Jumbo frame = Y Scattered Rx = Y TSO = Y Promiscuous mode = Y +Allmulticast mode = Y Unicast MAC filter = Y Multicast MAC filter = Y RSS hash = Y
doc/guides/nics/hinic.rst +2 -0
@@ -26,6 +26,8 @@ Features - Scattered and gather for TX and RX - SR-IOV - Partially supported at this point, VFIO only - VLAN filter and VLAN offload +- Allmulticast mode +- MTU update Prerequisites -------------
drivers/net/hinic/hinic_pmd_ethdev.c +109 -1
156 lines not on this page · raw message
drivers/net/hinic/hinic_pmd_ethdev.h +0 -3
@@ -20,9 +20,6 @@#define SIZE_8BYTES (size) (ALIGN((u32)(size), 8) >> 3) -#define HINIC_PKTLEN_TO_MTU (pktlen) \ - ((pktlen) - (ETH_HLEN + ETH_CRC_LEN)) -#define HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev) \ ((struct hinic_nic_dev *)(dev)->data->dev_private)
Signature · 1 line
1.8.3.1
PATCH v3 6/19 net/hinic: add unicast and multicast MAC set
In reply to Xiaoyun wangThis patch adds unicast and multicast set interfaces. Application can add or remove unicast MAC address, also can set multicast MAC address, tha maximum multicast list size is 2048.
--- doc/guides/nics/hinic.rst | 2 + drivers/net/hinic/base/hinic_pmd_niccfg.c | 55 +++++++ drivers/net/hinic/hinic_pmd_ethdev.c | 260 +++++++++++++++++++++++++++--- drivers/net/hinic/hinic_pmd_ethdev.h | 2 + 4 files changed, 298 insertions(+), 21 deletions(-)
doc/guides/nics/hinic.rst +2 -0
@@ -28,6 +28,8 @@ Features - VLAN filter and VLAN offload - Allmulticast mode - MTU update +- Unicast MAC filter +- Multicast MAC filter Prerequisites -------------
drivers/net/hinic/base/hinic_pmd_niccfg.c +55 -0
61 lines not on this page · raw message
drivers/net/hinic/hinic_pmd_ethdev.c +239 -21
343 lines not on this page · raw message
drivers/net/hinic/hinic_pmd_ethdev.h +2 -0
@@ -56,6 +56,8 @@ struct hinic_nic_dev {u32 vfta[HINIC_VFTA_SIZE ];/* VLAN bitmap */ +struct rte_ether_addr default_addr; +struct rte_ether_addr *mc_list;/* info */ unsigned int flags;struct nic_service_cap nic_cap;
Signature · 1 line
1.8.3.1
PATCH v3 7/19 net/hinic/base: add fdir config interface
In reply to Xiaoyun wangThis patch adds fdir config operation, including set fdir filter, normal filter, set and clear fdir tcam.
--- doc/guides/nics/features/hinic.ini | 1 + doc/guides/nics/hinic.rst | 1 + drivers/net/hinic/base/hinic_pmd_cmd.h | 2 + drivers/net/hinic/base/hinic_pmd_niccfg.c | 205 ++++++++++++++++++++++++++++++ drivers/net/hinic/base/hinic_pmd_niccfg.h | 134 +++++++++++++++++++ 5 files changed, 343 insertions(+)
doc/guides/nics/features/hinic.ini +1 -0
@@ -32,6 +32,7 @@ Inner L4 checksum = Y Basic stats = Y Extended stats = Y Stats per queue = Y +Flow director = Y Linux UIO = Y Linux VFIO = Y BSD nic_uio = N
doc/guides/nics/hinic.rst +1 -0
@@ -30,6 +30,7 @@ Features - MTU update - Unicast MAC filter - Multicast MAC filter +- Flow director Prerequisites -------------
drivers/net/hinic/base/hinic_pmd_cmd.h +2 -0
@@ -140,6 +140,8 @@ enum hinic_port_cmd {HINIC_PORT_CMD_SET_VHD_CFG =0xF7 ,HINIC_PORT_CMD_SET_LINK_FOLLOW =0xF8 , +HINIC_PORT_CMD_Q_FILTER =0xFC , +HINIC_PORT_CMD_TCAM_FILTER =0xFE , HINIC_PORT_CMD_SET_VLAN_FILTER = 0xFF };
drivers/net/hinic/base/hinic_pmd_niccfg.c +205 -0
214 lines not on this page · raw message
drivers/net/hinic/base/hinic_pmd_niccfg.h +134 -0
144 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 8/19 net/hinic: add fdir validate flow operations
In reply to Xiaoyun wangThis patch is to validate the filter rules, which includes ntuple filter, ethertype filter and fdir filter. The packets type that supported are BGP,VRRP,LACP,ARP and ICMP.
--- drivers/net/hinic/Makefile | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 42 ++ drivers/net/hinic/hinic_pmd_ethdev.h | 24 + drivers/net/hinic/hinic_pmd_flow.c | 1172 ++++++++++++++++++++++++++++++++++ drivers/net/hinic/meson.build | 1 + 5 files changed, 1240 insertions(+) create mode 100644 drivers/net/hinic/hinic_pmd_flow.c
drivers/net/hinic/Makefile +1 -0
@@ -60,6 +60,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_niccfg.c SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_nicio.c SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_wq.c SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_mbox.c +SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_flow.c SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_rx.c
drivers/net/hinic/hinic_pmd_ethdev.c +42 -0
60 lines not on this page · raw message
drivers/net/hinic/hinic_pmd_ethdev.h +24 -0
@@ -38,6 +38,30 @@ enum hinic_dev_status { HINIC_DEV_INTR_EN, }; +/* Information about the fdir mode. */ +struct hinic_hw_fdir_mask { +uint32_t src_ipv4_mask; +uint32_t dst_ipv4_mask; +uint16_t src_port_mask; +uint16_t dst_port_mask; +}; + +/* Flow Director attribute */ +struct hinic_atr_input { +u32 dst_ip; +u32 src_ip; +u16 src_port; +u16 dst_port; +}; + +struct hinic_fdir_rule { +struct hinic_hw_fdir_mask mask; +struct hinic_atr_input hinic_fdir;/* key of fdir filter */ +uint8_t queue;/* queue assigned when matched */ +}; + +extern const struct rte_flow_ops hinic_flow_ops; +/* hinic nic_device */ struct hinic_nic_dev {/* hardware device */
drivers/net/hinic/hinic_pmd_flow.c new file +1172 -0
1,172 lines not on this page · raw message
drivers/net/hinic/meson.build +1 -0
@@ -8,6 +8,7 @@ sources = files( 'hinic_pmd_ethdev.c', 'hinic_pmd_rx.c', 'hinic_pmd_tx.c', + 'hinic_pmd_flow.c', ) includes += include_directories('base')
Signature · 1 line
1.8.3.1
PATCH v3 9/19 net/hinic: create and destroy ntuple filter
In reply to Xiaoyun wangAdd support for creating/destroying ntuple filter. The filter rule includes BGP and VRRP packet type.
--- drivers/net/hinic/hinic_pmd_ethdev.h | 75 ++++ drivers/net/hinic/hinic_pmd_flow.c | 684 +++++++++++++++++++++++++++++++++++ 2 files changed, 759 insertions(+)
drivers/net/hinic/hinic_pmd_ethdev.h +75 -0
@@ -38,6 +38,57 @@ enum hinic_dev_status { HINIC_DEV_INTR_EN, }; +#define HINIC_MAX_Q_FILTERS 64/* hinic just support 64 filter types */ +#define HINIC_PKT_TYPE_FIND_ID (pkt_type) ((pkt_type) - HINIC_MAX_Q_FILTERS) + +/* 5tuple filter info */ +struct hinic_5tuple_filter_info { +uint32_t dst_ip; +uint32_t src_ip; +uint16_t dst_port; +uint16_t src_port; +uint8_t proto;/* l4 protocol. */ +/* +* seven levels (001b-111b), 111b is highest, +* used when more than one filter matches. +*/ +uint8_t priority; +uint8_t dst_ip_mask:1 ,/* if mask is 1b, do not compare dst ip. */ + src_ip_mask:1 ,/* if mask is 1b, do not compare src ip. */ + dst_port_mask:1 ,/* if mask is 1b, do not compare dst port. */ + src_port_mask:1 ,/* if mask is 1b, do not compare src port. */ + proto_mask:1 ;/* if mask is 1b, do not compare protocol. */ +}; + +/* 5tuple filter structure */ +struct hinic_5tuple_filter { +TAILQ_ENTRY (hinic_5tuple_filter) entries; +uint16_t index;/* the index of 5tuple filter */ +struct hinic_5tuple_filter_info filter_info; +uint16_t queue;/* rx queue assigned to */ +}; + +TAILQ_HEAD (hinic_5tuple_filter_list, hinic_5tuple_filter); + +/* +* If this filter is added by configuration, +* it should not be removed. +*/ +struct hinic_pkt_filter { +uint16_t pkt_proto; +uint8_t qid; +bool enable; +}; + +/* Structure to store filters' info. */ +struct hinic_filter_info { +uint8_t pkt_type; +uint8_t qid; +uint64_t type_mask;/* Bit mask for every used filter */ +struct hinic_5tuple_filter_list fivetuple_list; +struct hinic_pkt_filter pkt_filters[HINIC_MAX_Q_FILTERS ]; +}; +/* Information about the fdir mode. */ struct hinic_hw_fdir_mask {uint32_t src_ipv4_mask;
@@ -60,6 +111,26 @@ struct hinic_fdir_rule {uint8_t queue;/* queue assigned when matched */ }; +/* ntuple filter list structure */ +struct hinic_ntuple_filter_ele { +TAILQ_ENTRY (hinic_ntuple_filter_ele) entries; +struct rte_eth_ntuple_filter filter_info; +}; + +struct rte_flow { +enum rte_filter_type filter_type; +void *rule; +}; + +/* hinic_flow memory list structure */ +struct hinic_flow_mem { +TAILQ_ENTRY (hinic_flow_mem) entries; +struct rte_flow *flow; +}; + +TAILQ_HEAD (hinic_ntuple_filter_list, hinic_ntuple_filter_ele); +TAILQ_HEAD (hinic_flow_mem_list, hinic_flow_mem); +extern const struct rte_flow_ops hinic_flow_ops;/* hinic nic_device */
@@ -94,6 +165,10 @@ struct hinic_nic_dev {* vf: the same with associate pf */ u32 default_cos; + +struct hinic_filter_info filter; +struct hinic_ntuple_filter_list filter_ntuple_list; + struct hinic_flow_mem_list hinic_flow_list; };#endif /* _HINIC_PMD_ETHDEV_H_ */
drivers/net/hinic/hinic_pmd_flow.c +684 -0
705 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 10/19 net/hinic: create and destroy fdir filter
In reply to Xiaoyun wangAdd support for creating/destroying fdir filter. The filter rule includes LACP,ARP and ICMP packet type.
--- drivers/net/hinic/hinic_pmd_ethdev.h | 16 ++ drivers/net/hinic/hinic_pmd_flow.c | 423 +++++++++++++++++++++++++++++++++-- 2 files changed, 422 insertions(+), 17 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.h +16 -0
@@ -117,6 +117,18 @@ struct hinic_ntuple_filter_ele {struct rte_eth_ntuple_filter filter_info; }; +/* ethertype filter list structure */ +struct hinic_ethertype_filter_ele { +TAILQ_ENTRY (hinic_ethertype_filter_ele) entries; +struct rte_eth_ethertype_filter filter_info; +}; + +/* fdir filter list structure */ +struct hinic_fdir_rule_ele { +TAILQ_ENTRY (hinic_fdir_rule_ele) entries; +struct hinic_fdir_rule filter_info; +}; +struct rte_flow {enum rte_filter_type filter_type;void *rule;
@@ -129,6 +141,8 @@ struct hinic_flow_mem { };TAILQ_HEAD (hinic_ntuple_filter_list, hinic_ntuple_filter_ele); +TAILQ_HEAD (hinic_ethertype_filter_list, hinic_ethertype_filter_ele); +TAILQ_HEAD (hinic_fdir_rule_filter_list, hinic_fdir_rule_ele);TAILQ_HEAD (hinic_flow_mem_list, hinic_flow_mem);extern const struct rte_flow_ops hinic_flow_ops;
@@ -168,6 +182,8 @@ struct hinic_nic_dev {struct hinic_filter_info filter;struct hinic_ntuple_filter_list filter_ntuple_list; +struct hinic_ethertype_filter_list filter_ethertype_list; +struct hinic_fdir_rule_filter_list filter_fdir_rule_list;struct hinic_flow_mem_list hinic_flow_list; };
drivers/net/hinic/hinic_pmd_flow.c +406 -17
474 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 11/19 net/hinic: flush fdir filter
In reply to Xiaoyun wangSupports to flush fdir filter.
Destroy all flow rules associated with a port on hinic.
--- drivers/net/hinic/hinic_pmd_ethdev.c | 16 ++++ drivers/net/hinic/hinic_pmd_ethdev.h | 3 +- drivers/net/hinic/hinic_pmd_flow.c | 140 +++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+), 1 deletion(-)
drivers/net/hinic/hinic_pmd_ethdev.c +16 -0
@@ -341,6 +341,9 @@ static int hinic_dev_configure(struct rte_eth_dev *dev)return err; } +/*clear fdir filter flag in function table*/ +hinic_free_fdir_filter (nic_dev); +return HINIC_OK ; }
@@ -1115,6 +1118,8 @@ static void hinic_dev_stop(struct rte_eth_dev *dev)/* clean root context */ hinic_free_qp_ctxts (nic_dev->hwdev); +hinic_free_fdir_filter (nic_dev); +/* free mbuf */ hinic_free_all_rx_mbuf (dev);hinic_free_all_tx_mbuf (dev);
@@ -2816,6 +2821,7 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)struct rte_pci_device *pci_dev;struct rte_ether_addr *eth_addr;struct hinic_nic_dev *nic_dev; +struct hinic_filter_info *filter_info;u32 mac_size;int rc;
@@ -2907,6 +2913,16 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev) }hinic_set_bit (HINIC_DEV_INTR_EN , &nic_dev->dev_status); +/* initialize filter info */ + filter_info = &nic_dev->filter; +memset (filter_info,0 ,sizeof (struct hinic_filter_info )); +/* initialize 5tuple filter list */ +TAILQ_INIT (&filter_info->fivetuple_list); +TAILQ_INIT (&nic_dev->filter_ntuple_list); +TAILQ_INIT (&nic_dev->filter_ethertype_list); +TAILQ_INIT (&nic_dev->filter_fdir_rule_list); +TAILQ_INIT (&nic_dev->hinic_flow_list); +hinic_set_bit (HINIC_DEV_INIT , &nic_dev->dev_status);PMD_DRV_LOG (INFO ,"Initialize %s in primary successfully" , eth_dev->data->name);
drivers/net/hinic/hinic_pmd_ethdev.h +2 -1
@@ -173,7 +173,6 @@ struct hinic_nic_dev {u32 rx_mode_status;/* promisc or allmulticast */ unsigned long dev_status; -/* dpdk only */ char proc_dev_name[HINIC_DEV_NAME_LEN ];/* PF0->COS4, PF1->COS5, PF2->COS6, PF3->COS7, * vf: the same with associate pf
@@ -187,4 +186,6 @@ struct hinic_nic_dev { struct hinic_flow_mem_list hinic_flow_list; }; +void hinic_free_fdir_filter (struct hinic_nic_dev *nic_dev); +#endif /* _HINIC_PMD_ETHDEV_H_ */
drivers/net/hinic/hinic_pmd_flow.c +140 -0
154 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 12/19 net/hinic: set link down and up
In reply to Xiaoyun wangThis patch supports setting link down and up.
--- doc/guides/nics/hinic.rst | 1 + drivers/net/hinic/base/hinic_pmd_cmd.h | 2 + drivers/net/hinic/base/hinic_pmd_niccfg.c | 38 +++++++++++++++++++ drivers/net/hinic/base/hinic_pmd_niccfg.h | 9 +++++ drivers/net/hinic/hinic_pmd_ethdev.c | 62 +++++++++++++++++++++++++++++++ 5 files changed, 112 insertions(+)
doc/guides/nics/hinic.rst +1 -0
@@ -31,6 +31,7 @@ Features - Unicast MAC filter - Multicast MAC filter - Flow director +- Set Link down or up Prerequisites -------------
drivers/net/hinic/base/hinic_pmd_cmd.h +2 -0
@@ -119,6 +119,8 @@ enum hinic_port_cmd {HINIC_PORT_CMD_SET_IPSU_MAC =0xcb ,HINIC_PORT_CMD_GET_IPSU_MAC =0xcc , +HINIC_PORT_CMD_SET_XSFP_STATUS =0xD4 , +HINIC_PORT_CMD_GET_LINK_MODE =0xD9 ,HINIC_PORT_CMD_SET_SPEED =0xDA , HINIC_PORT_CMD_SET_AUTONEG = 0xDB,
drivers/net/hinic/base/hinic_pmd_niccfg.c +38 -0
@@ -1613,6 +1613,44 @@ int hinic_get_link_mode(void *hwdev, u32 *supported, u32 *advertised) }/** +* hinic_set_xsfp_tx_status - Enable or disable the fiber in +* tx direction when set link up or down. +* +* @param hwdev +* The hardware interface of a nic device. +* @param enable +* Enable or Disable. +* +* @return +* 0 on success. +* negative error value otherwise. +*/ +int hinic_set_xsfp_tx_status (void *hwdev,bool enable) +{ +struct hinic_set_xsfp_status xsfp_status; +u16 out_size =sizeof (struct hinic_set_xsfp_status ); +int err; + +memset (&xsfp_status,0 ,sizeof (xsfp_status)); + xsfp_status.mgmt_msg_head.resp_aeq_num =HINIC_AEQ1 ; + xsfp_status.port_id =hinic_global_func_id (hwdev); + xsfp_status.xsfp_tx_dis = ((enable ==0 ) ?1 :0 ); + + err =l2nic_msg_to_mgmt_sync (hwdev,HINIC_PORT_CMD_SET_XSFP_STATUS , + &xsfp_status,sizeof (struct hinic_set_xsfp_status ), + &xsfp_status, &out_size); +if (err || !out_size || xsfp_status.mgmt_msg_head.status) { +PMD_DRV_LOG (ERR , +"Failed to %s port xsfp status, err: %d, status: 0x%x, out size: 0x%x\n" , + enable ?"Disable" :"Enable" , err, + xsfp_status.mgmt_msg_head.status, out_size); +return -EFAULT ; + } + +return 0 ; +} + +/** * hinic_flush_qp_res - Flush tx && rx chip resources in case of set vport * fake failed when device start. *
drivers/net/hinic/base/hinic_pmd_niccfg.h +9 -0
@@ -578,6 +578,13 @@ struct hinic_link_mode_cmd {u16 advertised; }; +struct hinic_set_xsfp_status { +struct hinic_mgmt_msg_head mgmt_msg_head; + +u32 port_id; +u32 xsfp_tx_dis;/* 0: tx enable; 1: tx disable */ +}; +struct hinic_clear_qp_resource {struct hinic_mgmt_msg_head mgmt_msg_head;
@@ -807,6 +814,8 @@ int hinic_set_link_status_follow(void *hwdev,int hinic_get_link_mode (void *hwdev,u32 *supported,u32 *advertised); +int hinic_set_xsfp_tx_status (void *hwdev,bool enable); +int hinic_flush_qp_res (void *hwdev);int hinic_init_function_table (void *hwdev,u16 rx_buf_sz);
drivers/net/hinic/hinic_pmd_ethdev.c +62 -0
74 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 13/19 net/hinic: get firmware version
In reply to Xiaoyun wangThis patch adds support for getting firmware version.
--- doc/guides/nics/features/hinic.ini | 1 + doc/guides/nics/hinic.rst | 1 + drivers/net/hinic/base/hinic_pmd_cmd.h | 2 ++ drivers/net/hinic/base/hinic_pmd_niccfg.c | 40 +++++++++++++++++++++++++++++++ drivers/net/hinic/base/hinic_pmd_niccfg.h | 13 ++++++++++ drivers/net/hinic/hinic_pmd_ethdev.c | 23 ++++++++++++++++++ 6 files changed, 80 insertions(+)
doc/guides/nics/features/hinic.ini +1 -0
@@ -33,6 +33,7 @@ Basic stats = Y Extended stats = Y Stats per queue = Y Flow director = Y +FW version = Y Linux UIO = Y Linux VFIO = Y BSD nic_uio = N
doc/guides/nics/hinic.rst +1 -0
@@ -32,6 +32,7 @@ Features - Multicast MAC filter - Flow director - Set Link down or up +- FW version Prerequisites -------------
drivers/net/hinic/base/hinic_pmd_cmd.h +2 -0
@@ -85,6 +85,8 @@ enum hinic_port_cmd {HINIC_PORT_CMD_GET_JUMBO_FRAME_SIZE =0x4a ,HINIC_PORT_CMD_SET_JUMBO_FRAME_SIZE , +HINIC_PORT_CMD_GET_MGMT_VERSION =0x58 , +HINIC_PORT_CMD_GET_PORT_TYPE =0x5b , HINIC_PORT_CMD_GET_VPORT_ENABLE = 0x5c,
drivers/net/hinic/base/hinic_pmd_niccfg.c +40 -0
@@ -1293,6 +1293,46 @@ int hinic_set_rx_mode(void *hwdev, u32 enable)return 0 ; } +/** +* hinic_get_mgmt_version - Get mgmt module version from chip. +* +* @param hwdev +* The hardware interface of a nic device. +* @param fw +* Firmware version. +* +* @return +* 0 on success. +* negative error value otherwise. +*/ +int hinic_get_mgmt_version (void *hwdev,char *fw) +{ +struct hinic_version_info fw_ver; +u16 out_size =sizeof (fw_ver); +int err; + +if (!hwdev || !fw) { +PMD_DRV_LOG (ERR ,"Hwdev or fw is NULL" ); +return -EINVAL ; + } + +memset (&fw_ver,0 ,sizeof (fw_ver)); + fw_ver.mgmt_msg_head.resp_aeq_num =HINIC_AEQ1 ; + + err =l2nic_msg_to_mgmt_sync (hwdev,HINIC_PORT_CMD_GET_MGMT_VERSION , + &fw_ver,sizeof (fw_ver), &fw_ver, + &out_size); +if (err || !out_size || fw_ver.mgmt_msg_head.status) { +PMD_DRV_LOG (ERR ,"Failed to get mgmt version, err: %d, status: 0x%x, out size: 0x%x\n" , + err, fw_ver.mgmt_msg_head.status, out_size); +return -EINVAL ; + } + +snprintf (fw,HINIC_MGMT_VERSION_MAX_LEN ,"%s" , fw_ver.ver); + +return 0 ; +} +int hinic_set_rx_csum_offload (void *hwdev,u32 en) {struct hinic_checksum_offload rx_csum_cfg;
drivers/net/hinic/base/hinic_pmd_niccfg.h +13 -0
@@ -471,6 +471,17 @@ struct hinic_rx_mode_config {u32 rx_mode; }; +#define HINIC_MGMT_VERSION_MAX_LEN 32 +#define HINIC_COMPILE_TIME_LEN 20 +#define HINIC_FW_VERSION_NAME 16 + +struct hinic_version_info { +struct hinic_mgmt_msg_head mgmt_msg_head; + +u8 ver[HINIC_FW_VERSION_NAME ]; +u8 time[HINIC_COMPILE_TIME_LEN ]; +}; +/* rss */ struct nic_rss_indirect_tbl {u32 group_index;
@@ -807,6 +818,8 @@ int hinic_get_rss_type(void *hwdev, u32 tmpl_idx,int hinic_set_rx_mode (void *hwdev,u32 enable); +int hinic_get_mgmt_version (void *hwdev,char *fw); +int hinic_set_rx_csum_offload (void *hwdev,u32 en); int hinic_set_link_status_follow(void *hwdev,
drivers/net/hinic/hinic_pmd_ethdev.c +23 -0
@@ -752,6 +752,27 @@ static void hinic_get_speed_capa(struct rte_eth_dev *dev, uint32_t *speed_capa)return 0 ; } +static int hinic_fw_version_get (struct rte_eth_dev *dev,char *fw_version, +size_t fw_size) +{ +struct hinic_nic_dev *nic_dev =HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +char fw_ver[HINIC_MGMT_VERSION_MAX_LEN ] = {0 }; +int err; + + err =hinic_get_mgmt_version (nic_dev->hwdev, fw_ver); +if (err) { +PMD_DRV_LOG (ERR ,"Failed to get fw version\n" ); +return -EINVAL ; + } + +if (fw_size <strlen (fw_ver) +1 ) +return (strlen (fw_ver) +1 ); + +snprintf (fw_version, fw_size,"%s" , fw_ver); + +return 0 ; +} +static int hinic_config_rx_mode (struct hinic_nic_dev *nic_dev,u32 rx_mode_ctrl) {int err;
@@ -2813,6 +2834,7 @@ static void hinic_dev_close(struct rte_eth_dev *dev)static const struct eth_dev_ops hinic_pmd_ops = { .dev_configure = hinic_dev_configure, .dev_infos_get = hinic_dev_infos_get, + .fw_version_get = hinic_fw_version_get, .rx_queue_setup = hinic_rx_queue_setup, .tx_queue_setup = hinic_tx_queue_setup, .dev_start = hinic_dev_start,
@@ -2849,6 +2871,7 @@ static void hinic_dev_close(struct rte_eth_dev *dev)static const struct eth_dev_ops hinic_pmd_vf_ops = { .dev_configure = hinic_dev_configure, .dev_infos_get = hinic_dev_infos_get, + .fw_version_get = hinic_fw_version_get, .rx_queue_setup = hinic_rx_queue_setup, .tx_queue_setup = hinic_tx_queue_setup, .dev_start = hinic_dev_start,
Signature · 1 line
1.8.3.1
PATCH v3 14/19 net/hinic: support inner L3 checksum offload
In reply to Xiaoyun wangThis patch supports inner L3 checksum offload for VXLAN packets, modifies rx checksum offload.
--- drivers/net/hinic/hinic_pmd_ethdev.h | 1 + drivers/net/hinic/hinic_pmd_rx.c | 10 +- drivers/net/hinic/hinic_pmd_tx.c | 190 ++++++++++++++++++++++------------- 3 files changed, 127 insertions(+), 74 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.h +1 -0
@@ -178,6 +178,7 @@ struct hinic_nic_dev {* vf: the same with associate pf */ u32 default_cos; +u32 rx_csum_en;struct hinic_filter_info filter;struct hinic_ntuple_filter_list filter_ntuple_list;
drivers/net/hinic/hinic_pmd_rx.c +7 -3
@@ -658,7 +658,6 @@ int hinic_rx_configure(struct rte_eth_dev *dev)struct hinic_nic_dev *nic_dev =HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev);struct rte_eth_rss_conf rss_conf = dev->data->dev_conf.rx_adv_conf.rss_conf; -u32 csum_en =0 ;int err;if (nic_dev->flags Ð_MQ_RX_RSS_FLAG ) {
@@ -678,9 +677,10 @@ int hinic_rx_configure(struct rte_eth_dev *dev)/* Enable both L3/L4 rx checksum offload */ if (dev->data->dev_conf.rxmode.offloads &DEV_RX_OFFLOAD_CHECKSUM ) - csum_en =HINIC_RX_CSUM_OFFLOAD_EN ; + nic_dev->rx_csum_en =HINIC_RX_CSUM_OFFLOAD_EN ; - err =hinic_set_rx_csum_offload (nic_dev->hwdev, csum_en); + err =hinic_set_rx_csum_offload (nic_dev->hwdev, +HINIC_RX_CSUM_OFFLOAD_EN );if (err) goto rx_csum_ofl_err;
@@ -781,6 +781,10 @@ static inline uint64_t hinic_rx_csum(uint32_t status, struct hinic_rxq *rxq) {uint32_t checksum_err;uint64_t flags; +struct hinic_nic_dev *nic_dev = rxq->nic_dev; + +if (unlikely (!(nic_dev->rx_csum_en &HINIC_RX_CSUM_OFFLOAD_EN ))) +return PKT_RX_IP_CKSUM_UNKNOWN ;/* most case checksum is ok */ checksum_err =HINIC_GET_RX_CSUM_ERR (status);
drivers/net/hinic/hinic_pmd_tx.c +119 -71
258 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 15/19 net/hinic: support LRO offload
In reply to Xiaoyun wangThis patch supports LRO offload.
--- doc/guides/nics/features/hinic.ini | 1 + doc/guides/nics/hinic.rst | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 24 ++++++++++++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-)
doc/guides/nics/features/hinic.ini +1 -0
@@ -13,6 +13,7 @@ MTU update = Y Jumbo frame = Y Scattered Rx = Y TSO = Y +LRO = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y
doc/guides/nics/hinic.rst +1 -0
@@ -33,6 +33,7 @@ Features - Flow director - Set Link down or up - FW version +- LRO Prerequisites -------------
drivers/net/hinic/hinic_pmd_ethdev.c +18 -6
@@ -70,6 +70,9 @@#define HINIC_PKTLEN_TO_MTU (pktlen) \ ((pktlen) - (ETH_HLEN + ETH_CRC_LEN)) +/* lro numer limit for one packet */ +#define HINIC_LRO_WQE_NUM_DEFAULT 8 +/* Driver-specific log messages type */ int hinic_logtype;
@@ -731,7 +734,8 @@ static void hinic_get_speed_capa(struct rte_eth_dev *dev, uint32_t *speed_capa)DEV_RX_OFFLOAD_TCP_CKSUM |DEV_RX_OFFLOAD_VLAN_FILTER |DEV_RX_OFFLOAD_SCATTER | -DEV_RX_OFFLOAD_JUMBO_FRAME ; +DEV_RX_OFFLOAD_JUMBO_FRAME | +DEV_RX_OFFLOAD_TCP_LRO ; info->tx_queue_offload_capa =0 ; info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
@@ -792,6 +796,7 @@ static int hinic_rxtx_configure(struct rte_eth_dev *dev) {int err;struct hinic_nic_dev *nic_dev =HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV (dev); +bool lro_en;/* rx configure, if rss enable, need to init default configuration */ err =hinic_rx_configure (dev);
@@ -808,6 +813,18 @@ static int hinic_rxtx_configure(struct rte_eth_dev *dev) goto set_rx_mode_fail; } +/* config lro */ + lro_en = dev->data->dev_conf.rxmode.offloads &DEV_RX_OFFLOAD_TCP_LRO ? + true : false; + + err =hinic_set_rx_lro (nic_dev->hwdev, lro_en, lro_en, +HINIC_LRO_WQE_NUM_DEFAULT ); +if (err) { +PMD_DRV_LOG (ERR ,"%s lro failed, err: %d" , + lro_en ?"Enable" :"Disable" , err); + goto set_rx_mode_fail; + } +return HINIC_OK ; set_rx_mode_fail:
@@ -2478,11 +2495,6 @@ static int hinic_set_default_hw_feature(struct hinic_nic_dev *nic_dev)if (err)return err; -/* disable LRO */ - err =hinic_set_rx_lro (nic_dev->hwdev,0 ,0 , (u8 )0 ); -if (err) -return err; -/* Set pause enable, and up will disable pfc. */ err =hinic_set_default_pause_feature (nic_dev);if (err)
Signature · 1 line
1.8.3.1
PATCH v3 16/19 net/hinic: add hinic PMD doc files
In reply to Xiaoyun wangAdd new supported features to rst file and add features to ini file.
--- doc/guides/nics/features/hinic.ini | 2 ++ doc/guides/rel_notes/release_19_11.rst | 9 +++++++++ 2 files changed, 11 insertions(+)
doc/guides/nics/features/hinic.ini +2 -0
@@ -34,7 +34,9 @@ Basic stats = Y Extended stats = Y Stats per queue = Y Flow director = Y +Flow control = Y FW version = Y +Multiprocess aware = Y Linux UIO = Y Linux VFIO = Y BSD nic_uio = N
doc/guides/rel_notes/release_19_11.rst +9 -0
@@ -287,3 +287,12 @@ Tested Platforms * Added support for VLAN set PCP offload command. * Added support for VLAN set VID offload command. +* **Updated the Huawei hinic driver.** + + Updated the Huawei hinic driver with new features and improvements, including: + + * Enabled SR-IOV - Partially supported at this point, VFIO only. + * Supported VLAN filter and VLAN offload. + * Supported Unicast MAC filter and Multicast MAC filter. + * Supported FW version get. + * Supported Flow director for LACP, VRRP, BGP and so on.
Signature · 1 line
1.8.3.1
PATCH v3 17/19 net/hinic/base: optimize aeq interfaces
In reply to Xiaoyun wangThis patch deletes ceq interfaces that not needed, fix aeq buges in some scenarios.
--- drivers/net/hinic/base/hinic_csr.h | 29 +--- drivers/net/hinic/base/hinic_pmd_cmd.h | 5 +- drivers/net/hinic/base/hinic_pmd_eqs.c | 245 +++++++++------------------------ drivers/net/hinic/base/hinic_pmd_eqs.h | 5 +- 4 files changed, 67 insertions(+), 217 deletions(-)
drivers/net/hinic/base/hinic_csr.h +2 -27
@@ -48,16 +48,12 @@/* EQ registers */ #define HINIC_AEQ_MTT_OFF_BASE_ADDR 0x200 -#define HINIC_CEQ_MTT_OFF_BASE_ADDR 0x400#define HINIC_EQ_MTT_OFF_STRIDE 0x40#define HINIC_CSR_AEQ_MTT_OFF (id) \ (HINIC_AEQ_MTT_OFF_BASE_ADDR + (id) * HINIC_EQ_MTT_OFF_STRIDE) -#define HINIC_CSR_CEQ_MTT_OFF (id) \ - (HINIC_CEQ_MTT_OFF_BASE_ADDR + (id) * HINIC_EQ_MTT_OFF_STRIDE) -#define HINIC_CSR_EQ_PAGE_OFF_STRIDE 8#define HINIC_AEQ_HI_PHYS_ADDR_REG (q_id, pg_num) \
@@ -68,23 +64,11 @@ (HINIC_CSR_AEQ_MTT_OFF (q_id) + \ (pg_num) * HINIC_CSR_EQ_PAGE_OFF_STRIDE + 4) -#define HINIC_CEQ_HI_PHYS_ADDR_REG (q_id, pg_num) \ - (HINIC_CSR_CEQ_MTT_OFF(q_id) + \ - (pg_num) * HINIC_CSR_EQ_PAGE_OFF_STRIDE) - -#define HINIC_CEQ_LO_PHYS_ADDR_REG (q_id, pg_num) \ - (HINIC_CSR_CEQ_MTT_OFF(q_id) + \ - (pg_num) * HINIC_CSR_EQ_PAGE_OFF_STRIDE + 4) -#define HINIC_EQ_HI_PHYS_ADDR_REG (type, q_id, pg_num) \ - ((u32)((type == HINIC_AEQ) ? \ - HINIC_AEQ_HI_PHYS_ADDR_REG(q_id, pg_num) : \ - HINIC_CEQ_HI_PHYS_ADDR_REG(q_id, pg_num))) + ((u32)(HINIC_AEQ_HI_PHYS_ADDR_REG(q_id, pg_num)))#define HINIC_EQ_LO_PHYS_ADDR_REG (type, q_id, pg_num) \ - ((u32)((type == HINIC_AEQ) ? \ - HINIC_AEQ_LO_PHYS_ADDR_REG(q_id, pg_num) : \ - HINIC_CEQ_LO_PHYS_ADDR_REG(q_id, pg_num))) + ((u32)(HINIC_AEQ_LO_PHYS_ADDR_REG(q_id, pg_num)))#define HINIC_AEQ_CTRL_0_ADDR_BASE 0xE00#define HINIC_AEQ_CTRL_1_ADDR_BASE 0xE04
@@ -105,15 +89,6 @@#define HINIC_CSR_AEQ_PROD_IDX_ADDR (idx) \ (HINIC_AEQ_CONS_IDX_1_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE) -#define HINIC_CEQ_CONS_IDX_0_ADDR_BASE 0x1008 -#define HINIC_CEQ_CONS_IDX_1_ADDR_BASE 0x100C - -#define HINIC_CSR_CEQ_CONS_IDX_ADDR (idx) \ - (HINIC_CEQ_CONS_IDX_0_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE) - -#define HINIC_CSR_CEQ_PROD_IDX_ADDR (idx) \ - (HINIC_CEQ_CONS_IDX_1_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE) -/* API CMD registers */ #define HINIC_CSR_API_CMD_BASE 0xF000
drivers/net/hinic/base/hinic_pmd_cmd.h +1 -4
@@ -5,10 +5,7 @@#ifndef _HINIC_PORT_CMD_H_#define _HINIC_PORT_CMD_H_ -enum hinic_eq_type { -HINIC_AEQ , -HINIC_CEQ -}; +#define HINIC_AEQ 0enum hinic_resp_aeq_num { HINIC_AEQ0 = 0,
drivers/net/hinic/base/hinic_pmd_eqs.c +63 -182
401 lines not on this page · raw message
drivers/net/hinic/base/hinic_pmd_eqs.h +1 -4
@@ -21,9 +21,6 @@#define HINIC_DEFAULT_AEQ_LEN 64 -#define HINIC_RECV_NEXT_AEQE HINIC_ERROR -#define HINIC_RECV_DONE HINIC_OK -#define GET_EQ_ELEMENT (eq, idx) \ (((u8 *)(eq)->virt_addr[(idx) / (eq)->num_elem_in_pg]) + \ (((u32)(idx) & ((eq)->num_elem_in_pg - 1)) * (eq)->elem_size))
@@ -58,7 +55,7 @@ enum hinic_aeq_type {struct hinic_eq {struct hinic_hwdev *hwdev;u16 q_id; -enum hinic_eq_type type; +u16 type;u32 page_size;u16 eq_len;
Signature · 1 line
1.8.3.1
PATCH v3 18/19 net/hinic: optimize RX performance
In reply to Xiaoyun wangThis patch optimizes receive packets performance
on arm platform.
--- drivers/net/hinic/hinic_pmd_rx.c | 5 +---- drivers/net/hinic/hinic_pmd_rx.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/net/hinic/hinic_pmd_rx.c +1 -4
@@ -972,13 +972,10 @@ u16 hinic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, u16 nb_pkts)while (pkts < nb_pkts) {/* 2. current ci is done */ rx_cqe = &rxq->rx_cqe[sw_ci]; - status = rx_cqe->status; + status =__atomic_load_n (&rx_cqe->status, __ATOMIC_ACQUIRE);if (!HINIC_GET_RX_DONE_BE (status))break ; -/* read other cqe member after status */ -rte_rmb (); -/* convert cqe and get packet length */ hinic_rq_cqe_be_to_cpu32 (&cqe, (volatile void *)rx_cqe); vlan_len = cqe.vlan_len;
drivers/net/hinic/hinic_pmd_rx.h +11 -0
@@ -28,6 +28,7 @@ struct hinic_rq_ctrl {u32 ctrl_fmt; }; +#if defined(__X86_64_SSE__) struct hinic_rq_cqe { u32 status; u32 vlan_len;
@@ -36,6 +37,16 @@ struct hinic_rq_cqe {u32 rsvd[4 ]; }; +#elif defined(__ARM64_NEON__) +struct hinic_rq_cqe { +u32 status; +u32 vlan_len; +u32 offload_type; +u32 rss_hash; + +u32 rsvd[4 ]; +} __rte_cache_aligned; +#endif struct hinic_rq_cqe_sect {struct hinic_sge sge;
Signature · 1 line
1.8.3.1
Re: [dpdk-dev] [PATCH v3 18/19] net/hinic: optimize RX performance
Quoted 4 lines · Xiaoyun wang
This patch optimizes receive packets performance
on arm platform.Signed-off-by Xiaoyun wang <[email protected]>
<...>
Quoted 12 lines
drivers/net/hinic/hinic_pmd_rx.h +1
-0@@ -28,6 +28,7 @@ struct hinic_rq_ctrl {u32 ctrl_fmt; }; +#if defined(__X86_64_SSE__) struct hinic_rq_cqe { u32 status; u32 vlan_len;@@ -36,6 +37,16 @@ struct hinic_rq_cqe {u32 rsvd[4 ]; };
drivers/net/hinic/hinic_pmd_rx.h struct hinic_rq_cqe { · line 49
Quoted 10 lines
drivers/net/hinic/hinic_pmd_rx.h +10
-0+#elif defined(__ARM64_NEON__) +struct hinic_rq_cqe { +u32 status; +u32 vlan_len; +u32 offload_type; +u32 rss_hash; + +u32 rsvd[4 ]; +} __rte_cache_aligned; +#endif
This change makes "struct hinic_rq_cqe" only exist for 'x86_64' and 'ARM64', if the intention is to add '__rte_cache_aligned' for the neon, would following work, which will also work for all archs:
struct hinic_rq_cqe {
u32 status;
u32 vlan_len;
u32 offload_type;
u32 rss_hash;
u32 rsvd[4];
#if defined(__ARM64_NEON__)
} __rte_cache_aligned;
#else
};
#endif
If this works, can you please send a new version with this update?
Re: [dpdk-dev] [PATCH v3 18/19] net/hinic: optimize RX performance
Hi Ferruh,
Thanks for your comments. I think you're right, i will modify it with Patch V4. Also I change it with the same structure
for X86-64 and ARM platform with cache-aligned, and test the RX performance, all is OK.
Best Regards
Xiaoyun Wang
Quoted 49 lines · Ferruh Yigit
Quoted 4 lines · Xiaoyun wang
This patch optimizes receive packets performance
on arm platform.Signed-off-by Xiaoyun wang <[email protected]><...>
Quoted 12 lines
drivers/net/hinic/hinic_pmd_rx.h +1
-0@@ -28,6 +28,7 @@ struct hinic_rq_ctrl {u32 ctrl_fmt; }; +#if defined(__X86_64_SSE__) struct hinic_rq_cqe { u32 status; u32 vlan_len;@@ -36,6 +37,16 @@ struct hinic_rq_cqe {u32 rsvd[4 ]; };drivers/net/hinic/hinic_pmd_rx.h struct hinic_rq_cqe { · line 49
Quoted 10 lines
drivers/net/hinic/hinic_pmd_rx.h +10
-0+#elif defined(__ARM64_NEON__) +struct hinic_rq_cqe { +u32 status; +u32 vlan_len; +u32 offload_type; +u32 rss_hash; + +u32 rsvd[4 ]; +} __rte_cache_aligned; +#endif This change makes "struct
hinic_rq_cqe" only exist for 'x86_64' and 'ARM64', if the intention is to add '__rte_cache_aligned' for the neon, would following work, which will also work for all archs:struct hinic_rq_cqe { u32 status; u32 vlan_len; u32 offload_type; u32 rss_hash; u32 rsvd[4]; #if defined(__ARM64_NEON__) } __rte_cache_aligned; #else }; #endifIf this works, can you please send a new version with this update?
PATCH v3 19/19 net/hinic: add support for getting rxq or txq info
In reply to Xiaoyun wangThis patch adds support for getting rxq or txq info.
--- drivers/net/hinic/hinic_pmd_ethdev.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/net/hinic/hinic_pmd_ethdev.c +34 -0
@@ -53,6 +53,11 @@#define HINIC_MIN_RX_BUF_SIZE 1024#define HINIC_MAX_UC_MAC_ADDRS 128#define HINIC_MAX_MC_MAC_ADDRS 2048 + +#define HINIC_DEFAULT_BURST_SIZE 32 +#define HINIC_DEFAULT_NB_QUEUES 1 +#define HINIC_DEFAULT_RING_SIZE 1024 +/* * vlan_id is a 12 bit number. * The VFTA array is actually a 4096 bit array, 128 of 32bit elements.
@@ -753,6 +758,14 @@ static void hinic_get_speed_capa(struct rte_eth_dev *dev, uint32_t *speed_capa) info->rx_desc_lim = hinic_rx_desc_lim; info->tx_desc_lim = hinic_tx_desc_lim; +/* Driver-preferred Rx/Tx parameters */ + info->default_rxportconf.burst_size =HINIC_DEFAULT_BURST_SIZE ; + info->default_txportconf.burst_size =HINIC_DEFAULT_BURST_SIZE ; + info->default_rxportconf.nb_queues =HINIC_DEFAULT_NB_QUEUES ; + info->default_txportconf.nb_queues =HINIC_DEFAULT_NB_QUEUES ; + info->default_rxportconf.ring_size =HINIC_DEFAULT_RING_SIZE ; + info->default_txportconf.ring_size =HINIC_DEFAULT_RING_SIZE ; +return 0 ; }
@@ -2157,6 +2170,23 @@ static int hinic_dev_xstats_get(struct rte_eth_dev *dev,return count; } +static void hinic_rxq_info_get (struct rte_eth_dev *dev,uint16_t queue_id, +struct rte_eth_rxq_info *qinfo) +{ +struct hinic_rxq *rxq = dev->data->rx_queues[queue_id]; + + qinfo->mp = rxq->mb_pool; + qinfo->nb_desc = rxq->q_depth; +} + +static void hinic_txq_info_get (struct rte_eth_dev *dev,uint16_t queue_id, +struct rte_eth_txq_info *qinfo) +{ +struct hinic_txq *txq = dev->data->tx_queues[queue_id]; + + qinfo->nb_desc = txq->q_depth; +} +/** * DPDK callback to retrieve names of extended device statistics *
@@ -2873,6 +2903,8 @@ static void hinic_dev_close(struct rte_eth_dev *dev) .xstats_get = hinic_dev_xstats_get, .xstats_reset = hinic_dev_xstats_reset, .xstats_get_names = hinic_dev_xstats_get_names, + .rxq_info_get = hinic_rxq_info_get, + .txq_info_get = hinic_txq_info_get, .mac_addr_set = hinic_set_mac_addr, .mac_addr_remove = hinic_mac_addr_remove, .mac_addr_add = hinic_mac_addr_add,
@@ -2906,6 +2938,8 @@ static void hinic_dev_close(struct rte_eth_dev *dev) .xstats_get = hinic_dev_xstats_get, .xstats_reset = hinic_dev_xstats_reset, .xstats_get_names = hinic_dev_xstats_get_names, + .rxq_info_get = hinic_rxq_info_get, + .txq_info_get = hinic_txq_info_get, .mac_addr_set = hinic_set_mac_addr, .mac_addr_remove = hinic_mac_addr_remove, .mac_addr_add = hinic_mac_addr_add,
Signature · 1 line
1.8.3.1
Quoted 40 lines · Xiaoyun wang
This patch set adds advanced features for Huawei hinic pmd, such as VLAN filter and VLAN offload, SR-IOV, FW version get, set link down and up, Flow director for LACP, VRRP, BGP and so on.
--
v2:
- Fix RSS bugs for vxlan packets inner type
- Add comments for new added func interface
- Fix code review comments from patch v1
- Fix code style problems
- Remove ceq interfaces and definitions that not used
- Fix aeq init bugs, firstly alloc aeq resource, then set aeq ctrl len
- Fix bar map bugs for VF Page size larger than PF
- Modify link state set, add enable or disable fiber in tx direction
- Fix mbox and mgmt channel sync lock mechanism to reduce CPU usage
- Fix FDIR bugs for VRRP packets
- Fit ABI changes from dpdk libv3:
- Split hinic.ini andhinic.rstto related feature patches
- Addmin_mtu&max_mtuinitialization forhinic_dev_infos_get
- Fix fdir config patch withnet/hinic/base
- Split link patch into link and fw version getting 2 patches
- Update pmd doc files to new next version
- Add comments for cover letter patch
- Add rxq & txq info getting interfaces
- Fix load intrinsics for receiving packetsXiaoyun wang (19):
net/hinic/base: add mbox command channel for SRIOVnet/hinic/base: add HW interfaces for SR-IOV net/hinic: add VF PMD operation interfaces net/hinic: add VLAN filter and offload net/hinic: add allmulticast mode and MTU set net/hinic: add unicast and multicast MAC setnet/hinic/base: add fdir config interface net/hinic: add fdir validate flow operations net/hinic: create and destroy ntuple filter net/hinic: create and destroy fdir filter net/hinic: flush fdir filter
Quoted 8 lines
net/hinic: set link down and up
net/hinic: get firmware version
net/hinic: support inner L3 checksum offload net/hinic: support LRO offload
net/hinic: add hinic PMD doc filesnet/hinic/base: optimize aeq interfaces net/hinic: optimize RX performance net/hinic: add support for getting rxq or txq info
There is following 32-bit build error because of the log formatting [1], can you please check it?
[1]
.../drivers/net/hinic/base/hinic_pmd_mbox.c(659):
error #181: argument of type "unsigned long long" is incompatible with format "%lx", expecting argument of type "unsigned long"
PMD_DRV_LOG(ERR, "Fail to send mbox seg, seq_id: 0x%lx,
err: %d",
Hi Ferruh,
Thanks for your comments. hinic pmd driver doesn't support 32-bit build, we add descriptions with config file "defconfig_x86_x32-native-linuxapp-gcc".
and “defconfig_x86_x32-native-linux-gcc”. I don't know why it also build in 32-bit platform, can you tell me where also need me to add configuration. Also I build it on 64-bit platform,That's OK.
Best regards
Xiaoyun Wang
Quoted 61 lines · Ferruh Yigit
Quoted 40 lines · Xiaoyun wang
This patch set adds advanced features for Huawei hinic pmd, such as VLAN filter and VLAN offload, SR-IOV, FW version get, set link down and up, Flow director for LACP, VRRP, BGP and so on.
--
v2:
- Fix RSS bugs for vxlan packets inner type
- Add comments for new added func interface
- Fix code review comments from patch v1
- Fix code style problems
- Remove ceq interfaces and definitions that not used
- Fix aeq init bugs, firstly alloc aeq resource, then set aeq ctrl len
- Fix bar map bugs for VF Page size larger than PF
- Modify link state set, add enable or disable fiber in tx direction
- Fix mbox and mgmt channel sync lock mechanism to reduce CPU usage
- Fix FDIR bugs for VRRP packets
- Fit ABI changes from dpdk libv3:
- Split hinic.ini andhinic.rstto related feature patches
- Addmin_mtu&max_mtuinitialization forhinic_dev_infos_get
- Fix fdir config patch withnet/hinic/base
- Split link patch into link and fw version getting 2 patches
- Update pmd doc files to new next version
- Add comments for cover letter patch
- Add rxq & txq info getting interfaces
- Fix load intrinsics for receiving packetsXiaoyun wang (19):
net/hinic/base: add mbox command channel for SRIOVnet/hinic/base: add HW interfaces for SR-IOV net/hinic: add VF PMD operation interfaces net/hinic: add VLAN filter and offload net/hinic: add allmulticast mode and MTU set net/hinic: add unicast and multicast MAC setnet/hinic/base: add fdir config interface net/hinic: add fdir validate flow operations net/hinic: create and destroy ntuple filter net/hinic: create and destroy fdir filter net/hinic: flush fdir filterQuoted 8 lines
net/hinic: set link down and up
net/hinic: get firmware version
net/hinic: support inner L3 checksum offload net/hinic: support LRO offload
net/hinic: add hinic PMD doc filesnet/hinic/base: optimize aeq interfaces net/hinic: optimize RX performance net/hinic: add support for getting rxq or txq infoThere is following 32-bit build error because of the log formatting [1], can you please check it?
[1]
.../drivers/net/hinic/base/hinic_pmd_mbox.c(659):
error #181: argument of type "unsigned long long" is incompatible with format "%lx", expecting argument of type "unsigned long"PMD_DRV_LOG(ERR, "Fail to send mbox seg, seq_id: 0x%lx,err: %d",
.
Quoted 4 lines · Network Chip Application Development Dept)
Hi Ferruh,
Thanks for your comments. hinic pmd driver doesn't support 32-bit build, we add descriptions with config file "defconfig_x86_x32-native-linuxapp-gcc".
and “defconfig_x86_x32-native-linux-gcc”. I don't know why it also build in 32-bit platform, can you tell me where also need me to add configuration. Also I build it on 64-bit platform,That's OK.
Hi Xiaoyun,
You are right, driver doesn't support 32bit, I am force enabling it, just for build.
Since the build error is only in the logging format identifiers, I think it make sense to fix it, and it is better to use more proper format identifiers.
Quoted 66 lines
Best regards
Xiaoyun WangQuoted 61 lines · Ferruh Yigit
Quoted 40 lines · Xiaoyun wang
This patch set adds advanced features for Huawei hinic pmd, such as VLAN filter and VLAN offload, SR-IOV, FW version get, set link down and up, Flow director for LACP, VRRP, BGP and so on.
--
v2:
- Fix RSS bugs for vxlan packets inner type
- Add comments for new added func interface
- Fix code review comments from patch v1
- Fix code style problems
- Remove ceq interfaces and definitions that not used
- Fix aeq init bugs, firstly alloc aeq resource, then set aeq ctrl len
- Fix bar map bugs for VF Page size larger than PF
- Modify link state set, add enable or disable fiber in tx direction
- Fix mbox and mgmt channel sync lock mechanism to reduce CPU usage
- Fix FDIR bugs for VRRP packets
- Fit ABI changes from dpdk libv3:
- Split hinic.ini andhinic.rstto related feature patches
- Addmin_mtu&max_mtuinitialization forhinic_dev_infos_get
- Fix fdir config patch withnet/hinic/base
- Split link patch into link and fw version getting 2 patches
- Update pmd doc files to new next version
- Add comments for cover letter patch
- Add rxq & txq info getting interfaces
- Fix load intrinsics for receiving packetsXiaoyun wang (19):
net/hinic/base: add mbox command channel for SRIOVnet/hinic/base: add HW interfaces for SR-IOV net/hinic: add VF PMD operation interfaces net/hinic: add VLAN filter and offload net/hinic: add allmulticast mode and MTU set net/hinic: add unicast and multicast MAC setnet/hinic/base: add fdir config interface net/hinic: add fdir validate flow operations net/hinic: create and destroy ntuple filter net/hinic: create and destroy fdir filter net/hinic: flush fdir filterQuoted 8 lines
net/hinic: set link down and up
net/hinic: get firmware version
net/hinic: support inner L3 checksum offload net/hinic: support LRO offload
net/hinic: add hinic PMD doc filesnet/hinic/base: optimize aeq interfaces net/hinic: optimize RX performance net/hinic: add support for getting rxq or txq infoThere is following 32-bit build error because of the log formatting [1], can you please check it?
[1]
.../drivers/net/hinic/base/hinic_pmd_mbox.c(659):
error #181: argument of type "unsigned long long" is incompatible with format "%lx", expecting argument of type "unsigned long"PMD_DRV_LOG(ERR, "Fail to send mbox seg, seq_id: 0x%lx,err: %d",
.
Hi Ferruh,
I have deleted the seq_id getting logs, and we can get the infos by other method, which is updated by Patch V4.
Best Regards,
Xiaoyun Wang
Quoted 80 lines · Ferruh Yigit
Quoted 4 lines · Network Chip Application Development Dept)
Hi Ferruh,
Thanks for your comments. hinic pmd driver doesn't support 32-bit build, we add descriptions with config file "defconfig_x86_x32-native-linuxapp-gcc".
and “defconfig_x86_x32-native-linux-gcc”. I don't know why it also build in 32-bit platform, can you tell me where also need me to add configuration. Also I build it on 64-bit platform,That's OK.Hi Xiaoyun,
You are right, driver doesn't support 32bit, I am force enabling it, just for build.
Since the build error is only in the logging format identifiers, I think it make sense to fix it, and it is better to use more proper format identifiers.
Quoted 65 lines
Best regards
Xiaoyun WangQuoted 61 lines · Ferruh Yigit
Quoted 40 lines · Xiaoyun wang
This patch set adds advanced features for Huawei hinic pmd, such as VLAN filter and VLAN offload, SR-IOV, FW version get, set link down and up, Flow director for LACP, VRRP, BGP and so on.
--
v2:
- Fix RSS bugs for vxlan packets inner type
- Add comments for new added func interface
- Fix code review comments from patch v1
- Fix code style problems
- Remove ceq interfaces and definitions that not used
- Fix aeq init bugs, firstly alloc aeq resource, then set aeq ctrl len
- Fix bar map bugs for VF Page size larger than PF
- Modify link state set, add enable or disable fiber in tx direction
- Fix mbox and mgmt channel sync lock mechanism to reduce CPU usage
- Fix FDIR bugs for VRRP packets
- Fit ABI changes from dpdk libv3:
- Split hinic.ini andhinic.rstto related feature patches
- Addmin_mtu&max_mtuinitialization forhinic_dev_infos_get
- Fix fdir config patch withnet/hinic/base
- Split link patch into link and fw version getting 2 patches
- Update pmd doc files to new next version
- Add comments for cover letter patch
- Add rxq & txq info getting interfaces
- Fix load intrinsics for receiving packetsXiaoyun wang (19):
net/hinic/base: add mbox command channel for SRIOVnet/hinic/base: add HW interfaces for SR-IOV net/hinic: add VF PMD operation interfaces net/hinic: add VLAN filter and offload net/hinic: add allmulticast mode and MTU set net/hinic: add unicast and multicast MAC setnet/hinic/base: add fdir config interface net/hinic: add fdir validate flow operations net/hinic: create and destroy ntuple filter net/hinic: create and destroy fdir filter net/hinic: flush fdir filterQuoted 8 lines
net/hinic: set link down and up net/hinic: get firmware version net/hinic: support inner L3 checksum offload net/hinic: support LRO offload
net/hinic: add hinic PMD doc filesnet/hinic/base: optimize aeq interfaces net/hinic: optimize RX performance net/hinic: add support for getting rxq or txq infoThere is following 32-bit build error because of the log formatting [1], can you please check it?
[1]
.../drivers/net/hinic/base/hinic_pmd_mbox.c(659):
error #181: argument of type "unsigned long long" is incompatible with format "%lx", expecting argument of type "unsigned long"PMD_DRV_LOG(ERR, "Fail to send mbox seg, seq_id: 0x%lx,err: %d",
.
.