Skip to contentSkip to conversation

Add advanced features for Huawei hinic pmd

PATCH Superseded Xiaoyun wang 3 participants 31 messages Sep 25, 2019 – Sep 30, 2019

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 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.

Xiaoyun wang (17):
net/hinic/base: add mbox command channel for SRIOV net/hinic/base: add HW interfaces for SRIOV 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: 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: 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 tx&rx performance

 doc/guides/nics/features/hinic.ini         |   12 +-
 doc/guides/nics/hinic.rst                  |    6 +
 doc/guides/rel_notes/release_19_11.rst     |   45 +-
 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       |  992 ++++++++++--
 drivers/net/hinic/hinic_pmd_ethdev.h       |  139 +-
 drivers/net/hinic/hinic_pmd_flow.c         | 2385 ++++++++++++++++++++++++++++
 drivers/net/hinic/hinic_pmd_rx.c           |   27 +-
 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, 6029 insertions(+), 665 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
#1 lore raw

PATCH v2 1/17 net/hinic/base: add mbox command channel for SRIOV

Add mbox command channel for SRIOV, which is used to communicate between VF and VF, VF and PF. This patch introduces data structures, initialization, interfaces and commands of mbox channel.

---
 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 +
 6 files changed, 1069 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
drivers/net/hinic/Makefile +1 -0
index 42b4a78..20a338e 100644
@@ -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
index f599947..db60a51 100644
@@ -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
index 6c21c47..fc5bdf9 100644
@@ -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
index cde394a..6cf947f 100644
@@ -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
#2 lore raw

PATCH v2 2/17 net/hinic/base: add HW interfaces for SRIOV

In reply to Xiaoyun wang

This patch introduces some HW interfaces required for SRIOV 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
index db60a51..85cbb5b 100644
@@ -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
index 61537b1..aa883e0 100644
@@ -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
index 7a9e9f6..c8750b8 100644
@@ -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
index fc5bdf9..c37771b 100644
@@ -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
index c1289b5..6752587 100644
@@ -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
index 7804708..cc18843 100644
@@ -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
index 174b40f..dcb9602 100644
@@ -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
index 248211f..f6cc033 100644
@@ -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
index 487e440..9a487d0 100644
@@ -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
#3 lore raw

PATCH v2 3/17 net/hinic: add VF PMD operation interfaces

In reply to Xiaoyun wang

This patch adds VF PMD operation interfaces to support SRIOV.

---
 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
index d3bbc3d..0a20ade 100644
@@ -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
index dcb9602..94371bb 100644
@@ -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
#4 lore raw

PATCH v2 4/17 net/hinic: add VLAN filter and offload

In reply to Xiaoyun wang

This patch adds support for VLAN filter and VLAN offload.

---
 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 ++-
 5 files changed, 369 insertions(+), 6 deletions(-)
drivers/net/hinic/base/hinic_pmd_cmd.h +1 -0
index c8750b8..5c38b5f 100644
@@ -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
index 94371bb..d19a834 100644
@@ -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
index 4aeddc2..66eaf20 100644
@@ -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
#5 lore raw

PATCH v2 5/17 net/hinic: add allmulticast mode and MTU set

In reply to Xiaoyun wang

When 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.

---
 drivers/net/hinic/hinic_pmd_ethdev.c | 108 ++++++++++++++++++++++++++++++++++-
 drivers/net/hinic/hinic_pmd_ethdev.h |   3 -
 2 files changed, 107 insertions(+), 4 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +107 -1
index 4e2a69c..8eeeaea 100644
@@ -64,6 +64,12 @@
 
 #define HINIC_VLAN_FILTER_EN		(1U << 0)
 
+#define HINIC_MTU_TO_PKTLEN(mtu)	\
+	((mtu) + ETH_HLEN + ETH_CRC_LEN)
+
+#define HINIC_PKTLEN_TO_MTU(pktlen)	\
+	((pktlen) - (ETH_HLEN + ETH_CRC_LEN))
+
 /* Driver-specific log messages type */
 int hinic_logtype;
 
@@ -718,7 +724,9 @@ static void hinic_get_speed_capa(struct rte_eth_dev *dev, uint32_t *speed_capa)
 				DEV_RX_OFFLOAD_IPV4_CKSUM |
 				DEV_RX_OFFLOAD_UDP_CKSUM |
 				DEV_RX_OFFLOAD_TCP_CKSUM |
-				DEV_RX_OFFLOAD_VLAN_FILTER;
+				DEV_RX_OFFLOAD_VLAN_FILTER |
+				DEV_RX_OFFLOAD_SCATTER |
+				DEV_RX_OFFLOAD_JUMBO_FRAME;
 
 	info->tx_queue_offload_capa = 0;
 	info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
@@ -1376,6 +1384,33 @@ static void hinic_deinit_mac_addr(struct rte_eth_dev *eth_dev)
 			    eth_dev->data->name);
 }
 
+static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	int ret = 0;
+	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+
+	PMD_DRV_LOG(INFO, "Set port mtu, port_id: %d, mtu: %d, max_pkt_len: %d",
+			dev->data->port_id, mtu, HINIC_MTU_TO_PKTLEN(mtu));
+
+	if (mtu < HINIC_MIN_MTU_SIZE || mtu > HINIC_MAX_MTU_SIZE) {
+		PMD_DRV_LOG(ERR, "Invalid mtu: %d, must between %d and %d",
+				mtu, HINIC_MIN_MTU_SIZE, HINIC_MAX_MTU_SIZE);
+		return -EINVAL;
+	}
+
+	ret = hinic_set_port_mtu(nic_dev->hwdev, mtu);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Set port mtu failed, ret: %d", ret);
+		return ret;
+	}
+
+	/* update max frame size */
+	dev->data->dev_conf.rxmode.max_rx_pkt_len = HINIC_MTU_TO_PKTLEN(mtu);
+	nic_dev->mtu_size = mtu;
+
+	return ret;
+}
+
 static void hinic_store_vlan_filter(struct hinic_nic_dev *nic_dev,
 					u16 vlan_id, bool on)
 {
@@ -1540,6 +1575,71 @@ static void hinic_remove_all_vlanid(struct rte_eth_dev *eth_dev)
 	}
 }
 
+static int hinic_set_dev_allmulticast(struct hinic_nic_dev *nic_dev,
+				bool enable)
+{
+	u32 rx_mode_ctrl = nic_dev->rx_mode_status;
+
+	if (enable)
+		rx_mode_ctrl |= HINIC_RX_MODE_MC_ALL;
+	else
+		rx_mode_ctrl &= (~HINIC_RX_MODE_MC_ALL);
+
+	return hinic_config_rx_mode(nic_dev, rx_mode_ctrl);
+}
+
+/**
+ * DPDK callback to enable allmulticast mode.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success,
+ *   negative error value otherwise.
+ */
+static int hinic_dev_allmulticast_enable(struct rte_eth_dev *dev)
+{
+	int ret = HINIC_OK;
+	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+
+	ret = hinic_set_dev_allmulticast(nic_dev, true);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Enable allmulticast failed, error: %d", ret);
+		return ret;
+	}
+
+	PMD_DRV_LOG(INFO, "Enable allmulticast succeed, nic_dev: %s, port_id: %d",
+		nic_dev->proc_dev_name, dev->data->port_id);
+	return 0;
+}
+
+/**
+ * DPDK callback to disable allmulticast mode.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success,
+ *   negative error value otherwise.
+ */
+static int hinic_dev_allmulticast_disable(struct rte_eth_dev *dev)
+{
+	int ret = HINIC_OK;
+	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+
+	ret = hinic_set_dev_allmulticast(nic_dev, false);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Disable allmulticast failed, error: %d", ret);
+		return ret;
+	}
+
+	PMD_DRV_LOG(INFO, "Disable allmulticast succeed, nic_dev: %s, port_id: %d",
+		nic_dev->proc_dev_name, dev->data->port_id);
+	return 0;
+}
+
 /**
  * DPDK callback to enable promiscuous mode.
  *
@@ -2421,8 +2521,11 @@ static void hinic_dev_close(struct rte_eth_dev *dev)
 	.tx_queue_release              = hinic_tx_queue_release,
 	.dev_stop                      = hinic_dev_stop,
 	.dev_close                     = hinic_dev_close,
+	.mtu_set                       = hinic_dev_set_mtu,
 	.vlan_filter_set               = hinic_vlan_filter_set,
 	.vlan_offload_set              = hinic_vlan_offload_set,
+	.allmulticast_enable           = hinic_dev_allmulticast_enable,
+	.allmulticast_disable          = hinic_dev_allmulticast_disable,
 	.promiscuous_enable            = hinic_dev_promiscuous_enable,
 	.promiscuous_disable           = hinic_dev_promiscuous_disable,
 	.rss_hash_update               = hinic_rss_hash_update,
@@ -2447,8 +2550,11 @@ static void hinic_dev_close(struct rte_eth_dev *dev)
 	.tx_queue_release              = hinic_tx_queue_release,
 	.dev_stop                      = hinic_dev_stop,
 	.dev_close                     = hinic_dev_close,
+	.mtu_set                       = hinic_dev_set_mtu,
 	.vlan_filter_set               = hinic_vlan_filter_set,
 	.vlan_offload_set              = hinic_vlan_offload_set,
+	.allmulticast_enable           = hinic_dev_allmulticast_enable,
+	.allmulticast_disable          = hinic_dev_allmulticast_disable,
 	.rss_hash_update               = hinic_rss_hash_update,
 	.rss_hash_conf_get             = hinic_rss_conf_get,
 	.reta_update                   = hinic_rss_indirtbl_update,
drivers/net/hinic/hinic_pmd_ethdev.h +0 -3
index 66eaf20..f7a1167 100644
@@ -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
#6 lore raw

Re: [dpdk-dev] [PATCH v2 05/17] net/hinic: add allmulticast mode and MTU set

Quoted 5 lines · Xiaoyun wang

When 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.

<...>

Quoted 16 lines
drivers/net/hinic/hinic_pmd_ethdev.c +16 -0
+static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	int ret = 0;
+	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+
+	PMD_DRV_LOG(INFO, "Set port mtu, port_id: %d, mtu: %d, max_pkt_len: %d",
+			dev->data->port_id, mtu, HINIC_MTU_TO_PKTLEN(mtu));
+
+	if (mtu < HINIC_MIN_MTU_SIZE || mtu > HINIC_MAX_MTU_SIZE) {
+		PMD_DRV_LOG(ERR, "Invalid mtu: %d, must between %d and %d",
+				mtu, HINIC_MIN_MTU_SIZE, HINIC_MAX_MTU_SIZE);
+		return -EINVAL;
+	}
+
+	ret = hinic_set_port_mtu(nic_dev->hwdev, mtu);
+	if (ret) {

drivers/net/hinic/hinic_pmd_ethdev.c static void hinic_deinit_mac_addr(struct rte_eth_dev *eth_dev) · line 1412

Quoted 10 lines
drivers/net/hinic/hinic_pmd_ethdev.c +10 -0
+		PMD_DRV_LOG(ERR, "Set port mtu failed, ret: %d", ret);
+		return ret;
+	}
+
+	/* update max frame size */
+	dev->data->dev_conf.rxmode.max_rx_pkt_len = HINIC_MTU_TO_PKTLEN(mtu);
+	nic_dev->mtu_size = mtu;
+
+	return ret;
+}

There are (relatively) new 'min_mtu' & 'max_mtu' in 'struct rte_eth_dev_info', since MTU is enabled you may prefer to set them in "hinic_dev_infos_get()'

#7 lore raw

Re: [dpdk-dev] [PATCH v2 05/17] net/hinic: add allmulticast mode and MTU set

Hi Ferruh,

Thanks for your comments, I have added min_mtu & max_mtu to hinic_dev_infos_get interface, which will be shown in Patch V3.

Best regards
Xiaoyun Wang

Quoted 37 lines · Ferruh Yigit
Quoted 5 lines · Xiaoyun wang

When 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.

<...>

Quoted 16 lines
drivers/net/hinic/hinic_pmd_ethdev.c +16 -0
+static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	int ret = 0;
+	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
+
+	PMD_DRV_LOG(INFO, "Set port mtu, port_id: %d, mtu: %d, max_pkt_len: %d",
+			dev->data->port_id, mtu, HINIC_MTU_TO_PKTLEN(mtu));
+
+	if (mtu < HINIC_MIN_MTU_SIZE || mtu > HINIC_MAX_MTU_SIZE) {
+		PMD_DRV_LOG(ERR, "Invalid mtu: %d, must between %d and %d",
+				mtu, HINIC_MIN_MTU_SIZE, HINIC_MAX_MTU_SIZE);
+		return -EINVAL;
+	}
+
+	ret = hinic_set_port_mtu(nic_dev->hwdev, mtu);
+	if (ret) {

drivers/net/hinic/hinic_pmd_ethdev.c static void hinic_deinit_mac_addr(struct rte_eth_dev *eth_dev) · line 1412

Quoted 10 lines
drivers/net/hinic/hinic_pmd_ethdev.c +10 -0
+		PMD_DRV_LOG(ERR, "Set port mtu failed, ret: %d", ret);
+		return ret;
+	}
+
+	/* update max frame size */
+	dev->data->dev_conf.rxmode.max_rx_pkt_len = HINIC_MTU_TO_PKTLEN(mtu);
+	nic_dev->mtu_size = mtu;
+
+	return ret;
+}

There are (relatively) new 'min_mtu' & 'max_mtu' in 'struct rte_eth_dev_info', since MTU is enabled you may prefer to set them in "hinic_dev_infos_get()'

#8 lore raw

PATCH v2 6/17 net/hinic: add unicast and multicast MAC set

In reply to Xiaoyun wang

This 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.

---
 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 +
 3 files changed, 296 insertions(+), 21 deletions(-)
drivers/net/hinic/base/hinic_pmd_niccfg.c +55 -0
index 8bd7ed6..054925c 100644
@@ -250,6 +250,61 @@ int hinic_get_default_mac(void *hwdev, u8 *mac_addr)
 }
 
 /**
+*  hinic_update_mac - Update mac address to hardware.
+*
+* @param hwdev
+*   The hardware interface of a nic device.
+* @param old_mac
+*   Old mac address.
+* @param new_mac
+*   New mac address.
+* @param vlan_id
+*   Set 0 for mac_vlan table initialization.
+* @param func_id
+*   Global function id of NIC.
+*
+* @return
+*   0 on success.
+*   negative error value otherwise.
+*/
+int hinic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,
+		     u16 func_id)
+{
+	struct hinic_port_mac_update mac_info;
+	u16 out_size = sizeof(mac_info);
+	int err;
+
+	if (!hwdev || !old_mac || !new_mac) {
+		PMD_DRV_LOG(ERR, "Hwdev, old_mac or new_mac is NULL\n");
+		return -EINVAL;
+	}
+
+	memset(&mac_info, 0, sizeof(mac_info));
+	mac_info.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
+	mac_info.func_id = func_id;
+	mac_info.vlan_id = vlan_id;
+	memcpy(mac_info.old_mac, old_mac, ETH_ALEN);
+	memcpy(mac_info.new_mac, new_mac, ETH_ALEN);
+
+	err = l2nic_msg_to_mgmt_sync(hwdev, HINIC_PORT_CMD_UPDATE_MAC,
+				     &mac_info, sizeof(mac_info),
+				     &mac_info, &out_size);
+	if (err || !out_size ||
+	    (mac_info.mgmt_msg_head.status &&
+	     mac_info.mgmt_msg_head.status != HINIC_PF_SET_VF_ALREADY)) {
+		PMD_DRV_LOG(ERR, "Failed to update MAC, err: %d, status: 0x%x, out size: 0x%x\n",
+			    err, mac_info.mgmt_msg_head.status, out_size);
+		return -EINVAL;
+	}
+	if (mac_info.mgmt_msg_head.status == HINIC_PF_SET_VF_ALREADY) {
+		PMD_DRV_LOG(WARNING, "PF has already set vf mac, Ignore update operation.\n");
+		return HINIC_PF_SET_VF_ALREADY;
+	}
+
+	return 0;
+}
+
+/**
  * hinic_set_port_mtu -  Set MTU to port.
  *
  * @param hwdev
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
index f7a1167..b4f93ad 100644
@@ -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
#9 lore raw

PATCH v2 7/17 net/hinic: add fdir config interface

In reply to Xiaoyun wang

This patch adds fdir config operation, including set fdir filter, normal filter, set and clear fdir tcam.

---
 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 +++++++++++++++++++
 3 files changed, 341 insertions(+)
drivers/net/hinic/base/hinic_pmd_cmd.h +2 -0
index 5c38b5f..6b3dcf3 100644
@@ -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
#10 lore raw

Re: [dpdk-dev] [PATCH v2 07/17] net/hinic: add fdir config interface

Quoted 8 lines · Xiaoyun wang

This patch adds fdir config operation, including set fdir filter, normal filter, set and clear fdir tcam.

---
 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 +++++++++++++++++++

This looks like base code update to prepare driver for rte_flow, may be better to use "net/hinic/base:" in the patch title.

#11 lore raw

Re: [dpdk-dev] [PATCH v2 07/17] net/hinic: add fdir config interface

Hi Ferruh,
Thanks for your comments, I have fixed the patch comments with "net/hinic/base: add fdir config interface", and send a new patch V3 to you.

Best regards
Xiaoyun Wang

Quoted 13 lines · Ferruh Yigit
Quoted 8 lines · Xiaoyun wang

This patch adds fdir config operation, including set fdir filter, normal filter, set and clear fdir tcam.

---
  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 +++++++++++++++++++

This looks like base code update to prepare driver for rte_flow, may be better to use "net/hinic/base:" in the patch title.

#12 lore raw

PATCH v2 8/17 net/hinic: add fdir validate flow operations

In reply to Xiaoyun wang

This 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
index 20a338e..b78fd8d 100644
@@ -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
index b4f93ad..58a38d9 100644
@@ -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
index 87c8d16..bc7e246 100644
@@ -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
#13 lore raw

PATCH v2 9/17 net/hinic: create and destroy ntuple filter

In reply to Xiaoyun wang

Add 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
index 58a38d9..93cd6a7 100644
@@ -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
#14 lore raw

PATCH v2 10/17 net/hinic: create and destroy fdir filter

In reply to Xiaoyun wang

Add 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
index 93cd6a7..b7fcef6 100644
@@ -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
#15 lore raw

PATCH v2 11/17 net/hinic: flush fdir filter

In reply to Xiaoyun wang

Supports 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
index 9f7e6f5..2c329d1 100644
@@ -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;
 }
 
@@ -1113,6 +1116,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);
@@ -2814,6 +2819,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;
 
@@ -2905,6 +2911,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
index b7fcef6..dd96667 100644
@@ -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
#16 lore raw

PATCH v2 12/17 net/hinic: set link down and up

In reply to Xiaoyun wang

This patch supports setting link down and up,
Also adds support for geting firmware version.

---
 drivers/net/hinic/base/hinic_pmd_cmd.h    |  4 ++
 drivers/net/hinic/base/hinic_pmd_niccfg.c | 78 ++++++++++++++++++++++++++++
 drivers/net/hinic/base/hinic_pmd_niccfg.h | 22 ++++++++
 drivers/net/hinic/hinic_pmd_ethdev.c      | 85 +++++++++++++++++++++++++++++++
 4 files changed, 189 insertions(+)
drivers/net/hinic/base/hinic_pmd_cmd.h +4 -0
index 6b3dcf3..e0633bd 100644
@@ -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,
@@ -119,6 +121,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 +78 -0

90 lines not on this page · raw message

drivers/net/hinic/base/hinic_pmd_niccfg.h +22 -0
index e8ce332..b9e037e 100644
@@ -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;
@@ -578,6 +589,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;
 
@@ -800,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,
@@ -807,6 +827,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 +85 -0

112 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#17 lore raw

Re: [dpdk-dev] [PATCH v2 12/17] net/hinic: set link down and up

Quoted 4 lines · Xiaoyun wang

This patch supports setting link down and up,
Also adds support for geting firmware version.

<...>

Quoted 15 lines
drivers/net/hinic/hinic_pmd_ethdev.c +3 -0
@@ -2751,9 +2832,12 @@ 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,
+	.dev_set_link_up               = hinic_dev_set_link_up,
+	.dev_set_link_down             = hinic_dev_set_link_down,
 	.link_update                   = hinic_link_update,
 	.rx_queue_release              = hinic_rx_queue_release,
 	.tx_queue_release              = hinic_tx_queue_release,

drivers/net/hinic/hinic_pmd_ethdev.c static void hinic_dev_close(struct rte_eth_dev *dev) · line 2875

Quoted 7 lines
drivers/net/hinic/hinic_pmd_ethdev.c +1 -0
@@ -2785,6 +2869,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,

Patch is also updating fw version get support, can you please mention from it in the commit log? Or separate the patch..

#18 lore raw

[dpdk-dev] 答复: [PATCH v2 12/17] net/hinic: set link down and up

-----邮件原件-----
发件人: Ferruh Yigit [mailto:[email protected]]
发送时间: 2019年9月27日 2:48
收件人: Wangxiaoyun (Cloud, Network Chip Application Development Dept)
抄送: [email protected]; Xuanziyang (William); Shahar Belkar; Luoxianjun; Tanya Brokhman; zhouguoyang; Wulike (Collin) 主题: Re: [PATCH v2 12/17] net/hinic: set link down and up

Quoted 4 lines · Xiaoyun wang

This patch supports setting link down and up,
Also adds support for geting firmware version.

<...>

Quoted 15 lines
drivers/net/hinic/hinic_pmd_ethdev.c +3 -0
@@ -2751,9 +2832,12 @@ 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,
+	.dev_set_link_up               = hinic_dev_set_link_up,
+	.dev_set_link_down             = hinic_dev_set_link_down,
 	.link_update                   = hinic_link_update,
 	.rx_queue_release              = hinic_rx_queue_release,
 	.tx_queue_release              = hinic_tx_queue_release,

drivers/net/hinic/hinic_pmd_ethdev.c static void hinic_dev_close(struct rte_eth_dev *dev) · line 2875

Quoted 7 lines
drivers/net/hinic/hinic_pmd_ethdev.c +1 -0
@@ -2785,6 +2869,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,

Patch is also updating fw version get support, can you please mention from it in the commit log? Or separate the patch..

Hi, Ferruh,
Thanks for your comments. I will separate this patch to 2 patches, one is "set link down and up" , the other is "get firmware version".
And I will fix it by patch V3.

Best regards
Xiaoyun Wang

#19 lore raw

Re: [dpdk-dev] [PATCH v2 12/17] net/hinic: set link down and up

In reply to Ferruh Yigit

Thanks for your comments, I have splited this patch into 2 patched, one is for link down and up,the other is for getting fw version.

Quoted 33 lines · Ferruh Yigit
Quoted 4 lines · Xiaoyun wang

This patch supports setting link down and up,
Also adds support for geting firmware version.

<...>

Quoted 15 lines
drivers/net/hinic/hinic_pmd_ethdev.c +3 -0
@@ -2751,9 +2832,12 @@ 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,
+	.dev_set_link_up               = hinic_dev_set_link_up,
+	.dev_set_link_down             = hinic_dev_set_link_down,
  	.link_update                   = hinic_link_update,
  	.rx_queue_release              = hinic_rx_queue_release,
  	.tx_queue_release              = hinic_tx_queue_release,

drivers/net/hinic/hinic_pmd_ethdev.c static void hinic_dev_close(struct rte_eth_dev *dev) · line 2875

Quoted 7 lines
drivers/net/hinic/hinic_pmd_ethdev.c +1 -0
@@ -2785,6 +2869,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,

Patch is also updating fw version get support, can you please mention from it in the commit log? Or separate the patch..

#20 lore raw

PATCH v2 13/17 net/hinic: support inner L3 checksum offload

In reply to Xiaoyun wang

This patch supports inner L3 checksum offload,
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
index dd96667..3e3f3b3 100644
@@ -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
index 08e02ae..37b4f5c 100644
@@ -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 & ETH_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
#21 lore raw

PATCH v2 14/17 net/hinic: support LRO offload

In reply to Xiaoyun wang

This patch supports LRO offload.

---
 drivers/net/hinic/hinic_pmd_ethdev.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +18 -6
index 8ea5998..6f3eb18 100644
@@ -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;
 
@@ -729,7 +732,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 |
@@ -790,6 +794,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);
@@ -806,6 +811,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:
@@ -2476,11 +2493,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
#22 lore raw

PATCH v2 15/17 net/hinic: add hinic PMD doc files

In reply to Xiaoyun wang

Add doc files about new features and modification.

---
 doc/guides/nics/features/hinic.ini     | 12 ++++++++-
 doc/guides/nics/hinic.rst              |  6 +++++
 doc/guides/rel_notes/release_19_11.rst | 45 ++++++----------------------------
 3 files changed, 25 insertions(+), 38 deletions(-)
doc/guides/nics/features/hinic.ini +11 -1
index fe063d6..dc02b4b 100644
@@ -9,16 +9,22 @@ 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
+LRO                  = 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
+VLAN filter          = Y
+VLAN offload         = Y
 CRC offload          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
@@ -27,6 +33,10 @@ Inner L4 checksum    = Y
 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/nics/hinic.rst +6 -0
index c9329bc..f036fc5 100644
@@ -24,6 +24,12 @@ Features
 - Link state information
 - Link flow control
 - Scattered and gather for TX and RX
+- SR�CIOV - Partially supported at this point, VFIO only
+- Allmulticast mode
+- Unicast MAC filter
+- Multicast MAC filter
+- FW version
+- Flow director
 
 Prerequisites
 -------------
doc/guides/rel_notes/release_19_11.rst +8 -37

68 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#23 lore raw

Re: [dpdk-dev] [PATCH v2 15/17] net/hinic: add hinic PMD doc files

Quoted 53 lines · Xiaoyun wang

Add doc files about new features and modification.

---
 doc/guides/nics/features/hinic.ini     | 12 ++++++++-
 doc/guides/nics/hinic.rst              |  6 +++++
 doc/guides/rel_notes/release_19_11.rst | 45 ++++++----------------------------
 3 files changed, 25 insertions(+), 38 deletions(-)
doc/guides/nics/features/hinic.ini +11 -1
index fe063d6..dc02b4b 100644
@@ -9,16 +9,22 @@ 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
+LRO                  = 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
+VLAN filter          = Y
+VLAN offload         = Y
 CRC offload          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
@@ -27,6 +33,10 @@ Inner L4 checksum    = Y
 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/nics/hinic.rst +0 -0
index c9329bc..f036fc5 100644

doc/guides/nics/hinic.rst Features · line 27

Quoted 4 lines
doc/guides/nics/hinic.rst +1 -0
@@ -24,6 +24,12 @@ Features
 - Link state information
 - Link flow control
 - Scattered and gather for TX and RX
+- SR�CIOV - Partially supported at this point, VFIO only

Can you fix the char is SR-IOV?

Quoted 18 lines
doc/guides/nics/hinic.rst +5 -0
+- Allmulticast mode
+- Unicast MAC filter
+- Multicast MAC filter
+- FW version
+- Flow director
 
 Prerequisites
 -------------
doc/guides/rel_notes/release_19_11.rst +1 -1
index 65361c4..6c6f27f 100644
@@ -56,11 +56,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
-* **Updated the Intel ice driver.**
+* **Updated the Huawei hinic driver.**

doc/guides/rel_notes/release_19_11.rst New Features · line 67

Quoted 10 lines
doc/guides/rel_notes/release_19_11.rst +6 -2
 
-  Updated the Intel ice driver with new features and improvements, including:
+  Updated the Huawei hinic driver with new features and improvements, including:
 
-  * Added support for device-specific DDP package loading.
+  * 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.

Can you please distribute the doc patches in to the related patches that introduces the feature, for all three document, it helps by documenting what has been added in the patch.

Quoted 47 lines
doc/guides/rel_notes/release_19_11.rst +1 -25
 Removed Items
 -------------
@@ -99,30 +103,6 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =========================================================
 
-* ethdev: changed ``rte_eth_dev_infos_get`` return value from ``void`` to
-  ``int`` to provide a way to report various error conditions.
-
-* ethdev: changed ``rte_eth_promiscuous_enable`` and
-  ``rte_eth_promiscuous_disable`` return value from ``void`` to ``int`` to
-  provide a way to report various error conditions.
-
-* ethdev: changed ``rte_eth_allmulticast_enable`` and
-  ``rte_eth_allmulticast_disable`` return value from ``void`` to ``int`` to
-  provide a way to report various error conditions.
-
-* ethdev: changed ``rte_eth_dev_xstats_reset`` return value from ``void`` to
-  ``int`` to provide a way to report various error conditions.
-
-* ethdev: changed ``rte_eth_link_get`` and ``rte_eth_link_get_nowait``
-  return value from ``void`` to ``int`` to provide a way to report various
-  error conditions.
-
-* ethdev: changed ``rte_eth_macaddr_get`` return value from ``void`` to
-  ``int`` to provide a way to report various error conditions.
-
-* ethdev: changed ``rte_eth_dev_owner_delete`` return value from ``void`` to
-  ``int`` to provide a way to report various error conditions.
-
 
 ABI Changes
 -----------
@@ -174,7 +154,7 @@ The libraries prepended with a plus sign were incremented in this version.
      librte_distributor.so.1
      librte_eal.so.11
      librte_efd.so.1
-   + librte_ethdev.so.13
+     librte_ethdev.so.12
      librte_eventdev.so.7
      librte_flow_classify.so.1
      librte_gro.so.1
@@ -252,12 +232,3 @@ Tested Platforms
    Also, make sure to start the actual text at the margin.
    =========================================================

doc/guides/rel_notes/release_19_11.rst Tested Platforms · line 263

Quoted 10 lines
doc/guides/rel_notes/release_19_11.rst +0 -9
 
-* **Updated Mellanox mlx5 driver.**
-
-  Updated Mellanox mlx5 driver with new features and improvements, including:
-
-  * Added support for VLAN pop flow offload command.
-  * Added support for VLAN push flow offload command.
-  * Added support for VLAN set PCP offload command.
-  * Added support for VLAN set VID offload command.
-

I guess above changes are git mistake, please check in next version.

#24 lore raw

Re: [dpdk-dev] [PATCH v2 15/17] net/hinic: add hinic PMD doc files

Hi Ferruh,
Thanks for your comments. I send to you a new patch V3 with the following review comments fixed.
1) I have fixed SR-IOV with unix style;
2) I splited the hinic.ini and hinic.rst into releated feature patches;
3) I have updated the release_19_11.rst with next version.

Best regards
Xiaoyun Wang

Quoted 153 lines · Ferruh Yigit
Quoted 53 lines · Xiaoyun wang

Add doc files about new features and modification.

---
  doc/guides/nics/features/hinic.ini     | 12 ++++++++-
  doc/guides/nics/hinic.rst              |  6 +++++
  doc/guides/rel_notes/release_19_11.rst | 45 ++++++----------------------------
  3 files changed, 25 insertions(+), 38 deletions(-)
doc/guides/nics/features/hinic.ini +11 -1
index fe063d6..dc02b4b 100644
@@ -9,16 +9,22 @@ 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
+LRO                  = 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
+VLAN filter          = Y
+VLAN offload         = Y
  CRC offload          = Y
  L3 checksum offload  = Y
  L4 checksum offload  = Y
@@ -27,6 +33,10 @@ Inner L4 checksum    = Y
  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/nics/hinic.rst +0 -0
index c9329bc..f036fc5 100644

doc/guides/nics/hinic.rst Features · line 27

Quoted 4 lines
doc/guides/nics/hinic.rst +1 -0
@@ -24,6 +24,12 @@ Features
  - Link state information
  - Link flow control
  - Scattered and gather for TX and RX
+- SR�CIOV - Partially supported at this point, VFIO only

Can you fix the char is SR-IOV?

Quoted 18 lines
doc/guides/nics/hinic.rst +5 -0
+- Allmulticast mode
+- Unicast MAC filter
+- Multicast MAC filter
+- FW version
+- Flow director
 
  Prerequisites
  -------------
doc/guides/rel_notes/release_19_11.rst +1 -1
index 65361c4..6c6f27f 100644
@@ -56,11 +56,15 @@ New Features
       Also, make sure to start the actual text at the margin.
       =========================================================
 
-* **Updated the Intel ice driver.**
+* **Updated the Huawei hinic driver.**

doc/guides/rel_notes/release_19_11.rst New Features · line 67

Quoted 10 lines
doc/guides/rel_notes/release_19_11.rst +6 -2
 
-  Updated the Intel ice driver with new features and improvements, including:
+  Updated the Huawei hinic driver with new features and improvements, including:
 
-  * Added support for device-specific DDP package loading.
+  * 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.

Can you please distribute the doc patches in to the related patches that introduces the feature, for all three document, it helps by documenting what has been added in the patch.

Quoted 47 lines
doc/guides/rel_notes/release_19_11.rst +1 -25
  Removed Items
  -------------
@@ -99,30 +103,6 @@ API Changes
     Also, make sure to start the actual text at the margin.
     =========================================================
 
-* ethdev: changed ``rte_eth_dev_infos_get`` return value from ``void`` to
-  ``int`` to provide a way to report various error conditions.
-
-* ethdev: changed ``rte_eth_promiscuous_enable`` and
-  ``rte_eth_promiscuous_disable`` return value from ``void`` to ``int`` to
-  provide a way to report various error conditions.
-
-* ethdev: changed ``rte_eth_allmulticast_enable`` and
-  ``rte_eth_allmulticast_disable`` return value from ``void`` to ``int`` to
-  provide a way to report various error conditions.
-
-* ethdev: changed ``rte_eth_dev_xstats_reset`` return value from ``void`` to
-  ``int`` to provide a way to report various error conditions.
-
-* ethdev: changed ``rte_eth_link_get`` and ``rte_eth_link_get_nowait``
-  return value from ``void`` to ``int`` to provide a way to report various
-  error conditions.
-
-* ethdev: changed ``rte_eth_macaddr_get`` return value from ``void`` to
-  ``int`` to provide a way to report various error conditions.
-
-* ethdev: changed ``rte_eth_dev_owner_delete`` return value from ``void`` to
-  ``int`` to provide a way to report various error conditions.
-
 
  ABI Changes
  -----------
@@ -174,7 +154,7 @@ The libraries prepended with a plus sign were incremented in this version.
       librte_distributor.so.1
       librte_eal.so.11
       librte_efd.so.1
-   + librte_ethdev.so.13
+     librte_ethdev.so.12
       librte_eventdev.so.7
       librte_flow_classify.so.1
       librte_gro.so.1
@@ -252,12 +232,3 @@ Tested Platforms
     Also, make sure to start the actual text at the margin.
     =========================================================

doc/guides/rel_notes/release_19_11.rst Tested Platforms · line 263

Quoted 10 lines
doc/guides/rel_notes/release_19_11.rst +0 -9
 
-* **Updated Mellanox mlx5 driver.**
-
-  Updated Mellanox mlx5 driver with new features and improvements, including:
-
-  * Added support for VLAN pop flow offload command.
-  * Added support for VLAN push flow offload command.
-  * Added support for VLAN set PCP offload command.
-  * Added support for VLAN set VID offload command.
-

I guess above changes are git mistake, please check in next version.

.

#25 lore raw

PATCH v2 16/17 net/hinic/base: optimize aeq interfaces

In reply to Xiaoyun wang

This 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
index b63e52b..2626f69 100644
@@ -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
index e0633bd..c025851 100644
@@ -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	0
 
 enum 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
index fdb9854..16046ec 100644
@@ -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
#26 lore raw

PATCH v2 17/17 net/hinic: optimize tx&rx performance

In reply to Xiaoyun wang

This patch optimizes receive packets performance
in arm platform.

---
 drivers/net/hinic/hinic_pmd_rx.c | 17 +++++++++++++++++
 drivers/net/hinic/hinic_pmd_rx.h | 11 +++++++++++
 2 files changed, 28 insertions(+)
drivers/net/hinic/hinic_pmd_rx.c +17 -0
index 37b4f5c..94071ee 100644
@@ -950,6 +950,19 @@ void hinic_rx_alloc_pkts(struct hinic_rxq *rxq)
 	}
 }
 
+#if defined(__ARM64_NEON__)
+static inline uint32_t __attribute__((always_inline))
+hinic_read_cqe_status(uintptr_t addr)
+{
+	uint32_t val;
+
+	asm volatile("ldar %x[val], [%x[addr]]"
+		: [val] "=r" (val)
+		: [addr] "r" (addr));
+	return val;
+}
+#endif
+
 u16 hinic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, u16 nb_pkts)
 {
 	struct rte_mbuf *rxm;
@@ -972,7 +985,11 @@ 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];
+#if defined(__X86_64_SSE__)
 		status = rx_cqe->status;
+#elif defined(__ARM64_NEON__)
+		status = hinic_read_cqe_status((uintptr_t)&rxq->rx_cqe[sw_ci]);
+#endif
 		if (!HINIC_GET_RX_DONE_BE(status))
 			break;
 
drivers/net/hinic/hinic_pmd_rx.h +11 -0
index fe2735b..fa27e91 100644
@@ -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
#27 lore raw

Re: [dpdk-dev] [PATCH v2 17/17] net/hinic: optimize tx&rx performance

Hi Xiaoyun,

Quoted 26 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Xiaoyun wang
Sent: Wednesday, September 25, 2019 10:31 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Xiaoyun wang <[email protected]>
Subject: [dpdk-dev] [PATCH v2 17/17] net/hinic: optimize tx&rx performance

This patch optimizes receive packets performance
in arm platform.

---
 drivers/net/hinic/hinic_pmd_rx.c | 17 +++++++++++++++++
 drivers/net/hinic/hinic_pmd_rx.h | 11 +++++++++++
 2 files changed, 28 insertions(+)
drivers/net/hinic/hinic_pmd_rx.c +0 -0
index 37b4f5c..94071ee 100644

drivers/net/hinic/hinic_pmd_rx.c void hinic_rx_alloc_pkts(struct hinic_rxq *rxq) · line 953

Quoted 4 lines
drivers/net/hinic/hinic_pmd_rx.c +1 -0
@@ -950,6 +950,19 @@ void hinic_rx_alloc_pkts(struct hinic_rxq *rxq)
 	}
 }
 
+#if defined(__ARM64_NEON__)

No NEON intrinsics used, maybe RTE_ARCH_ARM64 is better.
In the following line __rte_always_inline is commonly used in DPDK, the effect is same. /Gavin

drivers/net/hinic/hinic_pmd_rx.c void hinic_rx_alloc_pkts(struct hinic_rxq *rxq) · line 964

Quoted 11 lines
drivers/net/hinic/hinic_pmd_rx.c +11 -0
+static inline uint32_t __attribute__((always_inline))
+hinic_read_cqe_status(uintptr_t addr)
+{
+	uint32_t val;
+
+	asm volatile("ldar %x[val], [%x[addr]]"
+		: [val] "=r" (val)
+		: [addr] "r" (addr));
+	return val;
+}
+#endif

I understand your intention is the reading of the status is observed before the following reads. This can be fulfilled by __atomic_load_n(...) with __ATOMIC_ACQUIRE semantics. This C11 way applies to all the arches, and you don't need the differentiation of arches. /Gavin

Quoted 51 lines
drivers/net/hinic/hinic_pmd_rx.c +1 -0
+
 u16 hinic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, u16
 nb_pkts)
 {
drivers/net/hinic/hinic_pmd_rx.c +4 -0
 	struct rte_mbuf *rxm;
@@ -972,7 +985,11 @@ 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];
+#if defined(__X86_64_SSE__)
 		status = rx_cqe->status;
+#elif defined(__ARM64_NEON__)
+		status = hinic_read_cqe_status((uintptr_t)&rxq-
 >rx_cqe[sw_ci]);
+#endif
 		if (!HINIC_GET_RX_DONE_BE(status))
drivers/net/hinic/hinic_pmd_rx.c +0 -0
 			break;
drivers/net/hinic/hinic_pmd_rx.h +11 -1
index fe2735b..fa27e91 100644
@@ -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;
--

1.8.3.1

#28 lore raw

Re: [dpdk-dev] [PATCH v2 17/17] net/hinic: optimize tx&rx performance

Hi Gavin,
Thanks for your comments.

+#if defined(__ARM64_NEON__)

No NEON intrinsics used, maybe RTE_ARCH_ARM64 is better.
In the following line __rte_always_inline is commonly used in DPDK, the effect is same. /Gavin

For this patch, we don't use NEON intrinsics, but for tx& rx process, we use NEON intrinsics for wqebb bigend conversion on arm platform, so in order to keep ingres, all intrinsics optimization on arm we use __ARM64_NEON__ definitation.

I understand your intention is the reading of the status is observed before the following reads. This can be fulfilled by __atomic_load_n(...) with __ATOMIC_ACQUIRE semantics. This C11 way applies to all the arches, and you don't need the differentiation of arches. /Gavin

Thanks, i have changed it to __atomic_load_n(...) with __ATOMIC_ACQUIRE semantics, and send a new patch V3.

Best regards
Xiaoyun Wang

Quoted 103 lines · Gavin Hu (Arm Technology China)

Hi Xiaoyun,

Quoted 26 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Xiaoyun wang
Sent: Wednesday, September 25, 2019 10:31 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Xiaoyun wang <[email protected]>
Subject: [dpdk-dev] [PATCH v2 17/17] net/hinic: optimize tx&rx performance

This patch optimizes receive packets performance
in arm platform.

---
  drivers/net/hinic/hinic_pmd_rx.c | 17 +++++++++++++++++
  drivers/net/hinic/hinic_pmd_rx.h | 11 +++++++++++
  2 files changed, 28 insertions(+)
drivers/net/hinic/hinic_pmd_rx.c +0 -0
index 37b4f5c..94071ee 100644

drivers/net/hinic/hinic_pmd_rx.c void hinic_rx_alloc_pkts(struct hinic_rxq *rxq) · line 953

Quoted 4 lines
drivers/net/hinic/hinic_pmd_rx.c +1 -0
@@ -950,6 +950,19 @@ void hinic_rx_alloc_pkts(struct hinic_rxq *rxq)
  	}
  }
 
+#if defined(__ARM64_NEON__)

No NEON intrinsics used, maybe RTE_ARCH_ARM64 is better.
In the following line __rte_always_inline is commonly used in DPDK, the effect is same. /Gavin

drivers/net/hinic/hinic_pmd_rx.c void hinic_rx_alloc_pkts(struct hinic_rxq *rxq) · line 964

Quoted 11 lines
drivers/net/hinic/hinic_pmd_rx.c +11 -0
+static inline uint32_t __attribute__((always_inline))
+hinic_read_cqe_status(uintptr_t addr)
+{
+	uint32_t val;
+
+	asm volatile("ldar %x[val], [%x[addr]]"
+		: [val] "=r" (val)
+		: [addr] "r" (addr));
+	return val;
+}
+#endif

I understand your intention is the reading of the status is observed before the following reads. This can be fulfilled by __atomic_load_n(...) with __ATOMIC_ACQUIRE semantics. This C11 way applies to all the arches, and you don't need the differentiation of arches. /Gavin

Quoted 51 lines
drivers/net/hinic/hinic_pmd_rx.c +1 -0
+
  u16 hinic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, u16
 nb_pkts)
  {

struct rte_mbuf *rxm;

drivers/net/hinic/hinic_pmd_rx.c +4 -0
@@ -972,7 +985,11 @@ 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];
+#if defined(__X86_64_SSE__)
  		status = rx_cqe->status;
+#elif defined(__ARM64_NEON__)
+		status = hinic_read_cqe_status((uintptr_t)&rxq-
 > rx_cqe[sw_ci]);
+#endif
  		if (!HINIC_GET_RX_DONE_BE(status))

break;

drivers/net/hinic/hinic_pmd_rx.h +11 -1
index fe2735b..fa27e91 100644
@@ -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;
--

1.8.3.1

#29 lore raw
In reply to Xiaoyun wang
Quoted 14 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.

Xiaoyun wang (17):
net/hinic/base: add mbox command channel for SRIOV net/hinic/base: add HW interfaces for SRIOV 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: add fdir config interface net/hinic: add fdir validate flow operations net/hinic: create and destroy ntuple filter

Quoted 8 lines

net/hinic: create and destroy fdir filter
net/hinic: flush fdir filter
net/hinic: set link down and up
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 tx&rx performance

Hi Xiaoyun,

Overall patchset lgtm, only there are a few minor comments, also can you please send a new version on top of latest next-net because of the ethdev API updates?

Thanks,
ferruh

#30 lore raw

Hi Ferruh,
Thanks for your comments, I have sent a new patch V3 with new API changes, and add comments
for every patch version, which is show in cover-letter patch, please check it.

Best regards
Xiaoyun Wang

Quoted 31 lines · Ferruh Yigit
Quoted 14 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.

Xiaoyun wang (17):
net/hinic/base: add mbox command channel for SRIOV net/hinic/base: add HW interfaces for SRIOV 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: add fdir config interface net/hinic: add fdir validate flow operations net/hinic: create and destroy ntuple filter

Quoted 8 lines

net/hinic: create and destroy fdir filter
net/hinic: flush fdir filter
net/hinic: set link down and up
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 tx&rx performance

Hi Xiaoyun,

Overall patchset lgtm, only there are a few minor comments, also can you please send a new version on top of latest next-net because of the ethdev API updates?

Thanks,
ferruh