Skip to contentSkip to conversation

Fix LRO issue and support Flow Control

PATCH In review Xiaoyun wang 2 participants 9 messages Mar 17, 2020 – Mar 20, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

v2 cover Fix LRO issue and support Flow Control

This patch fixes LRO and hotupdate firmware problems, optimize doorbell area initialization without const macro definition, Optimize log files, support pause flow control and inner vxlan or non vxlan dport filter type.

--
v1->v2:
- Fix LRO problems
- Fix hotupdate firmware problem
- Optimize doorbell area initialization
- Remove 40GE Mezz card id
- Add Fdir filter type
- Optimize log files
- Support pause flow control

v1:
- Allocate IO memory with socketid

Xiaoyun wang (7):
net/hinic: fix LRO problems
net/hinic/base: fix hotupdate firmware problem net/hinic/base: optimize doorbell area initialization net/hinic: remove 40GE Mezz card id net/hinic: Add Fdir filter type net/hinic/base: Optimize log files net/hinic/base: Support Pause flow control

 drivers/net/hinic/base/hinic_pmd_cmd.h    |   6 +
 drivers/net/hinic/base/hinic_pmd_cmdq.c   |   4 +
 drivers/net/hinic/base/hinic_pmd_cmdq.h   |   1 +
 drivers/net/hinic/base/hinic_pmd_hwif.c   |  23 +-
 drivers/net/hinic/base/hinic_pmd_hwif.h   |   1 +
 drivers/net/hinic/base/hinic_pmd_mbox.c   |   3 +-
 drivers/net/hinic/base/hinic_pmd_mgmt.c   |   9 +-
 drivers/net/hinic/base/hinic_pmd_niccfg.c | 233 +++++++-
 drivers/net/hinic/base/hinic_pmd_niccfg.h |  83 +++
 drivers/net/hinic/base/hinic_pmd_nicio.c  |  26 +-
 drivers/net/hinic/hinic_pmd_ethdev.c      | 145 +++--
 drivers/net/hinic/hinic_pmd_ethdev.h      | 113 +++-
 drivers/net/hinic/hinic_pmd_flow.c        | 961 ++++++++++++++++++++++++++----
 drivers/net/hinic/hinic_pmd_rx.c          |  42 +-
 drivers/net/hinic/hinic_pmd_tx.c          |   1 +
 15 files changed, 1433 insertions(+), 218 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/7 net/hinic: fix LRO problems

Pmd driver should change the max_lro_pkt_size parameter into lro_wqe_num that used for hardware, and when packets are coalesced by hardware, PKT_RX_LRO flag should be set in the RX mbuf.

Fixes 9d4878ef0897 ("net/hinic: support LRO offload")
---
 drivers/net/hinic/hinic_pmd_ethdev.c | 17 ++-------------
 drivers/net/hinic/hinic_pmd_rx.c     | 42 +++++++++++++++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 16 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +2 -15
index 8493f6e..b81ecd0 100644
@@ -736,6 +736,7 @@ static void hinic_get_speed_capa(struct rte_eth_dev *dev, uint32_t *speed_capa)
 	info->max_mac_addrs  = HINIC_MAX_UC_MAC_ADDRS;
 	info->min_mtu = HINIC_MIN_MTU_SIZE;
 	info->max_mtu = HINIC_MAX_MTU_SIZE;
+	info->max_lro_pkt_size = HINIC_MAX_LRO_SIZE;
 
 	hinic_get_speed_capa(dev, &info->speed_capa);
 	info->rx_queue_offload_capa = 0;
@@ -811,12 +812,10 @@ static int hinic_config_rx_mode(struct hinic_nic_dev *nic_dev, u32 rx_mode_ctrl)
 	return 0;
 }
 
-
 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;
+	int err;
 
 	/* rx configure, if rss enable, need to init default configuration */
 	err = hinic_rx_configure(dev);
@@ -833,18 +832,6 @@ 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:
drivers/net/hinic/hinic_pmd_rx.c +41 -1

81 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v2 2/7 net/hinic/base: fix hotupdate firmware problem

In reply to Xiaoyun wang

When repeatedly hotupdate firmware and start/stop port at the same time, port start may be failed when cmdq reinit failed at the fw active phase, so if deteted status of cmdq is fail, then reinit the cmdq when port start.

Fixes d9ce1917941c ("net/hinic/base: add hardware operation")
---
 drivers/net/hinic/base/hinic_pmd_cmdq.c  | 4 ++++
 drivers/net/hinic/base/hinic_pmd_cmdq.h  | 1 +
 drivers/net/hinic/base/hinic_pmd_nicio.c | 9 +++++++++
 3 files changed, 14 insertions(+)
drivers/net/hinic/base/hinic_pmd_cmdq.c +4 -0
index d73e2bf..685498e 100644
@@ -7,6 +7,7 @@
 #include "hinic_pmd_hwif.h"
 #include "hinic_pmd_wq.h"
 #include "hinic_pmd_mgmt.h"
+#include "hinic_pmd_mbox.h"
 #include "hinic_pmd_cmdq.h"
 
 #define CMDQ_CMD_TIMEOUT				5000 /* millisecond */
@@ -439,11 +440,14 @@ static int hinic_set_cmdq_ctxts(struct hinic_hwdev *hwdev)
 					     cmdq_ctxt, in_size, NULL,
 					     NULL, 0);
 		if (err) {
+			if (err == HINIC_MBOX_PF_BUSY_ACTIVE_FW)
+				cmdqs->status |= HINIC_CMDQ_SET_FAIL;
 			PMD_DRV_LOG(ERR, "Set cmdq ctxt failed");
 			return -EFAULT;
 		}
 	}
 
+	cmdqs->status &= ~HINIC_CMDQ_SET_FAIL;
 	cmdqs->status |= HINIC_CMDQ_ENABLE;
 
 	return 0;
drivers/net/hinic/base/hinic_pmd_cmdq.h +1 -0
index da939e1..4ce0a4c 100644
@@ -170,6 +170,7 @@ struct hinic_cmdq_ctxt {
 
 enum hinic_cmdq_status {
 	HINIC_CMDQ_ENABLE = BIT(0),
+	HINIC_CMDQ_SET_FAIL = BIT(1)
 };
 
 enum hinic_cmdq_cmd_type {
drivers/net/hinic/base/hinic_pmd_nicio.c +9 -0
index 59e39ed..31a13fb 100644
@@ -533,6 +533,15 @@ int hinic_init_qp_ctxts(struct hinic_hwdev *hwdev)
 		return err;
 	}
 
+	if (hwdev->cmdqs->status & HINIC_CMDQ_SET_FAIL) {
+		err = hinic_reinit_cmdq_ctxts(hwdev);
+		if (err) {
+			PMD_DRV_LOG(ERR, "Reinit cmdq context failed, rc: %d\n",
+				err);
+			return err;
+		}
+	}
+
 	err = init_qp_ctxts(nic_io);
 	if (err) {
 		PMD_DRV_LOG(ERR, "Init QP ctxts failed, rc: %d", err);
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH v2 3/7 net/hinic/base: optimize doorbell area initialization

In reply to Xiaoyun wang

The maximum doorbell area is inited from hardware param, and not uses const macro param.

---
 drivers/net/hinic/base/hinic_pmd_hwif.c | 23 +++++++++++++++++------
 drivers/net/hinic/base/hinic_pmd_hwif.h |  1 +
 2 files changed, 18 insertions(+), 6 deletions(-)
drivers/net/hinic/base/hinic_pmd_hwif.c +17 -6
index 8a01fbc..0fced5b 100644
@@ -183,17 +183,19 @@ static void set_ppf(struct hinic_hwif *hwif)
 		attr->func_type = TYPE_PPF;
 }
 
-static void init_db_area_idx(struct hinic_free_db_area *free_db_area)
+static void init_db_area_idx(struct hinic_hwif *hwif)
 {
+	struct hinic_free_db_area *free_db_area = &hwif->free_db_area;
+	u32 db_max_areas = hwif->db_max_areas;
 	u32 i;
 
-	for (i = 0; i < HINIC_DB_MAX_AREAS; i++)
+	for (i = 0; i < db_max_areas; i++)
 		free_db_area->db_idx[i] = i;
 
 	free_db_area->alloc_pos = 0;
 	free_db_area->return_pos = 0;
 
-	free_db_area->num_free = HINIC_DB_MAX_AREAS;
+	free_db_area->num_free = db_max_areas;
 
 	spin_lock_init(&free_db_area->idx_lock);
 }
@@ -214,7 +216,7 @@ static int get_db_idx(struct hinic_hwif *hwif, u32 *idx)
 	free_db_area->num_free--;
 
 	pos = free_db_area->alloc_pos++;
-	pos &= HINIC_DB_MAX_AREAS - 1;
+	pos &= (hwif->db_max_areas - 1);
 
 	pg_idx = free_db_area->db_idx[pos];
 
@@ -235,7 +237,7 @@ static void free_db_idx(struct hinic_hwif *hwif, u32 idx)
 	spin_lock(&free_db_area->idx_lock);
 
 	pos = free_db_area->return_pos++;
-	pos &= HINIC_DB_MAX_AREAS - 1;
+	pos &= (hwif->db_max_areas - 1);
 
 	free_db_area->db_idx[pos] = idx;
 
@@ -391,8 +393,13 @@ static int hinic_init_hwif(struct hinic_hwdev *hwdev, void *cfg_reg_base,
 		    void *db_base, __rte_unused void *dwqe_mapping)
 {
 	struct hinic_hwif *hwif;
+	struct rte_pci_device *pci_dev;
+	u64 db_bar_len;
 	int err;
 
+	pci_dev = (struct rte_pci_device *)(hwdev->pcidev_hdl);
+	db_bar_len = pci_dev->mem_resource[HINIC_DB_MEM_BAR].len;
+
 	hwif = hwdev->hwif;
 
 	hwif->cfg_regs_base = (u8 __iomem *)cfg_reg_base;
@@ -400,7 +407,11 @@ static int hinic_init_hwif(struct hinic_hwdev *hwdev, void *cfg_reg_base,
 
 	hwif->db_base_phy = db_base_phy;
 	hwif->db_base = (u8 __iomem *)db_base;
-	init_db_area_idx(&hwif->free_db_area);
+	hwif->db_max_areas = db_bar_len / HINIC_DB_PAGE_SIZE;
+	if (hwif->db_max_areas > HINIC_DB_MAX_AREAS)
+		hwif->db_max_areas = HINIC_DB_MAX_AREAS;
+
+	init_db_area_idx(hwif);
 
 	get_hwif_attr(hwif);
 
drivers/net/hinic/base/hinic_pmd_hwif.h +1 -0
index 6752587..de99507 100644
@@ -73,6 +73,7 @@ struct hinic_hwif {
 	u8 __iomem			*intr_regs_base;
 	u64				db_base_phy;
 	u8 __iomem			*db_base;
+	u64				db_max_areas;
 	struct hinic_free_db_area	free_db_area;
 	struct hinic_func_attr		attr;
 };
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH v2 4/7 net/hinic: remove 40GE Mezz card id

In reply to Xiaoyun wang

The 40GE Mezz card is not support, so remove it from the pmd driver.

---
 drivers/net/hinic/hinic_pmd_ethdev.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +0 -2
index b81ecd0..37aa042 100644
@@ -36,7 +36,6 @@
 
 /* Mezz card for Blade Server */
 #define HINIC_DEV_ID_MEZZ_25GE		0x0210
-#define HINIC_DEV_ID_MEZZ_40GE		0x020D
 #define HINIC_DEV_ID_MEZZ_100GE		0x0205
 
 /* 2*25G and 2*100G card */
@@ -3122,7 +3121,6 @@ static int hinic_dev_uninit(struct rte_eth_dev *dev)
 static struct rte_pci_id pci_id_hinic_map[] = {
 	{ RTE_PCI_DEVICE(HINIC_HUAWEI_VENDOR_ID, HINIC_DEV_ID_PRD) },
 	{ RTE_PCI_DEVICE(HINIC_HUAWEI_VENDOR_ID, HINIC_DEV_ID_MEZZ_25GE) },
-	{ RTE_PCI_DEVICE(HINIC_HUAWEI_VENDOR_ID, HINIC_DEV_ID_MEZZ_40GE) },
 	{ RTE_PCI_DEVICE(HINIC_HUAWEI_VENDOR_ID, HINIC_DEV_ID_MEZZ_100GE) },
 	{ RTE_PCI_DEVICE(HINIC_HUAWEI_VENDOR_ID, HINIC_DEV_ID_VF) },
 	{ RTE_PCI_DEVICE(HINIC_HUAWEI_VENDOR_ID, HINIC_DEV_ID_VF_HV) },
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH v2 5/7 net/hinic: Add Fdir filter type

In reply to Xiaoyun wang

The patch supports filter type of inner VXLAN or non vxlan dport, and use TCAM method to config these rules.

---
 drivers/net/hinic/base/hinic_pmd_cmd.h    |   6 +
 drivers/net/hinic/base/hinic_pmd_niccfg.c | 184 +++++-
 drivers/net/hinic/base/hinic_pmd_niccfg.h |  81 +++
 drivers/net/hinic/hinic_pmd_ethdev.c      |   6 +-
 drivers/net/hinic/hinic_pmd_ethdev.h      | 110 +++-
 drivers/net/hinic/hinic_pmd_flow.c        | 961 ++++++++++++++++++++++++++----
 6 files changed, 1199 insertions(+), 149 deletions(-)
drivers/net/hinic/base/hinic_pmd_cmd.h +6 -0
index c025851..09918a7 100644
@@ -115,6 +115,12 @@ enum hinic_port_cmd {
 
 	HINIC_PORT_CMD_GET_PORT_INFO		= 0xaa,
 
+	HINIC_PORT_CMD_UP_TC_ADD_FLOW		= 0xaf,
+	HINIC_PORT_CMD_UP_TC_DEL_FLOW		= 0xb0,
+	HINIC_PORT_CMD_UP_TC_GET_FLOW		= 0xb1,
+	HINIC_PORT_CMD_UP_TC_FLUSH_TCAM		= 0xb2,
+	HINIC_PORT_CMD_UP_TC_CTRL_TCAM_BLOCK	= 0xb3,
+
 	HINIC_PORT_CMD_SET_IPSU_MAC		= 0xcb,
 	HINIC_PORT_CMD_GET_IPSU_MAC		= 0xcc,
 
drivers/net/hinic/base/hinic_pmd_niccfg.c +166 -18

205 lines not on this page · raw message

drivers/net/hinic/base/hinic_pmd_niccfg.h +81 -0

91 lines not on this page · raw message

drivers/net/hinic/hinic_pmd_ethdev.c +5 -1
index 37aa042..9e90056 100644
@@ -1222,7 +1222,7 @@ 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);
+	hinic_destroy_fdir_filter(dev);
 
 	/* free mbuf */
 	hinic_free_all_rx_mbuf(dev);
@@ -2946,6 +2946,7 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
 	struct rte_ether_addr *eth_addr;
 	struct hinic_nic_dev *nic_dev;
 	struct hinic_filter_info *filter_info;
+	struct hinic_tcam_info *tcam_info;
 	u32 mac_size;
 	int rc;
 
@@ -3035,9 +3036,12 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
 
 	/* initialize filter info */
 	filter_info = &nic_dev->filter;
+	tcam_info = &nic_dev->tcam;
 	memset(filter_info, 0, sizeof(struct hinic_filter_info));
+	memset(tcam_info, 0, sizeof(struct hinic_tcam_info));
 	/* initialize 5tuple filter list */
 	TAILQ_INIT(&filter_info->fivetuple_list);
+	TAILQ_INIT(&tcam_info->tcam_list);
 	TAILQ_INIT(&nic_dev->filter_ntuple_list);
 	TAILQ_INIT(&nic_dev->filter_ethertype_list);
 	TAILQ_INIT(&nic_dev->filter_fdir_rule_list);
drivers/net/hinic/hinic_pmd_ethdev.h +106 -4

142 lines not on this page · raw message

drivers/net/hinic/hinic_pmd_flow.c +835 -126

1,246 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#6 lore raw

PATCH v2 6/7 net/hinic/base: Optimize log files

In reply to Xiaoyun wang

The patch optimizes log files without "\n".

---
 drivers/net/hinic/base/hinic_pmd_mbox.c   |  3 +--
 drivers/net/hinic/base/hinic_pmd_mgmt.c   |  9 ++++-----
 drivers/net/hinic/base/hinic_pmd_niccfg.c | 20 +++++++++-----------
 drivers/net/hinic/base/hinic_pmd_nicio.c  | 19 ++++++++-----------
 drivers/net/hinic/hinic_pmd_ethdev.c      | 31 +++++++++++++++----------------
 5 files changed, 37 insertions(+), 45 deletions(-)
drivers/net/hinic/base/hinic_pmd_mbox.c +1 -2
index 935d60b..bf83fbd 100644
@@ -191,8 +191,7 @@ static int recv_vf_mbox_handler(struct hinic_mbox_func_to_func *func_to_func,
 						buf_out, out_size);
 		break;
 	default:
-		PMD_DRV_LOG(ERR, "No handler, mod = %d",
-				recv_mbox->mod);
+		PMD_DRV_LOG(ERR, "No handler, mod: %d", recv_mbox->mod);
 		rc = HINIC_MBOX_VF_CMD_ERROR;
 		break;
 	}
drivers/net/hinic/base/hinic_pmd_mgmt.c +4 -5
index eee50a8..addc9d2 100644
@@ -449,7 +449,7 @@ static void hinic_pf_to_mgmt_free(struct hinic_hwdev *hwdev)
 			       recv_msg->msg_len);
 			*out_size = recv_msg->msg_len;
 		} else {
-			PMD_DRV_LOG(ERR, "Mgmt rsp's msg len:%u overflow.",
+			PMD_DRV_LOG(ERR, "Mgmt rsp's msg len: %u overflow.",
 				recv_msg->msg_len);
 			err = -ERANGE;
 		}
@@ -577,7 +577,7 @@ static void hinic_mgmt_recv_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt,
 						buf_out, &out_size);
 		break;
 	default:
-		PMD_DRV_LOG(ERR, "No handler, mod = %d", recv_msg->mod);
+		PMD_DRV_LOG(ERR, "No handler, mod: %d", recv_msg->mod);
 		break;
 	}
 
@@ -617,7 +617,7 @@ static int recv_mgmt_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt,
 
 	if (!check_mgmt_seq_id_and_seg_len(recv_msg, seq_id, seq_len)) {
 		PMD_DRV_LOG(ERR,
-			"Mgmt msg sequence and segment check fail, "
+			"Mgmt msg sequence and segment check failed, "
 			"func id: 0x%x, front id: 0x%x, current id: 0x%x, seg len: 0x%x",
 			hinic_global_func_id(pf_to_mgmt->hwdev),
 			recv_msg->sed_id, seq_id, seq_len);
@@ -741,8 +741,7 @@ int hinic_aeq_poll_msg(struct hinic_eq *eq, u32 timeout, void *param)
 
 		event = EQ_ELEM_DESC_GET(aeqe_desc, TYPE);
 		if (EQ_ELEM_DESC_GET(aeqe_desc, SRC)) {
-			PMD_DRV_LOG(ERR, "AEQ sw event not support %d",
-				event);
+			PMD_DRV_LOG(ERR, "AEQ sw event not support %d", event);
 			return -ENODEV;
 
 		} else {
drivers/net/hinic/base/hinic_pmd_niccfg.c +9 -11
index 9c273ad..a724211 100644
@@ -276,7 +276,7 @@ int hinic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,
 	int err;
 
 	if (!hwdev || !old_mac || !new_mac) {
-		PMD_DRV_LOG(ERR, "Hwdev, old_mac or new_mac is NULL\n");
+		PMD_DRV_LOG(ERR, "Hwdev, old_mac or new_mac is NULL");
 		return -EINVAL;
 	}
 
@@ -293,12 +293,12 @@ int hinic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,
 	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",
+		PMD_DRV_LOG(ERR, "Failed to update MAC, err: %d, status: 0x%x, out size: 0x%x",
 			    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");
+		PMD_DRV_LOG(WARNING, "PF has already set vf mac, Ignore update operation");
 		return HINIC_PF_SET_VF_ALREADY;
 	}
 
@@ -385,7 +385,7 @@ int hinic_add_remove_vlan(void *hwdev, u16 vlan_id, u16 func_id, bool add)
 				     &out_size);
 	if (err || !out_size || vlan_info.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR,
-			"Failed to %s vlan, err: %d, status: 0x%x, out size: 0x%x\n",
+			"Failed to %s vlan, err: %d, status: 0x%x, out size: 0x%x",
 			add ? "add" : "remove", err,
 			vlan_info.mgmt_msg_head.status, out_size);
 		return -EINVAL;
@@ -431,7 +431,7 @@ int hinic_config_vlan_filter(void *hwdev, u32 vlan_filter_ctrl)
 		err = HINIC_MGMT_CMD_UNSUPPORTED;
 	} else if (err || !out_size || vlan_filter.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR,
-			"Failed to config vlan filter, vlan_filter_ctrl: 0x%x, err: %d, status: 0x%x, out size: 0x%x\n",
+			"Failed to config vlan filter, vlan_filter_ctrl: 0x%x, err: %d, status: 0x%x, out size: 0x%x",
 			vlan_filter_ctrl, err,
 			vlan_filter.mgmt_msg_head.status, out_size);
 		err = -EINVAL;
@@ -473,7 +473,7 @@ int hinic_set_rx_vlan_offload(void *hwdev, u8 en)
 					&vlan_cfg, &out_size);
 	if (err || !out_size || vlan_cfg.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR,
-			"Failed to set rx vlan offload, err: %d, status: 0x%x, out size: 0x%x\n",
+			"Failed to set rx vlan offload, err: %d, status: 0x%x, out size: 0x%x",
 			err, vlan_cfg.mgmt_msg_head.status, out_size);
 		return -EINVAL;
 	}
@@ -687,8 +687,7 @@ int hinic_dcb_set_ets(void *hwdev, u8 *up_tc, u8 *pg_bw,
 		pg_bw_t += *(pg_bw + i);
 
 		if (*(up_tc + i) > HINIC_DCB_TC_MAX) {
-			PMD_DRV_LOG(ERR,
-				"Invalid up %d mapping tc: %d", i,
+			PMD_DRV_LOG(ERR, "Invalid up %d mapping tc: %d", i,
 				*(up_tc + i));
 			return -EINVAL;
 		}
@@ -1400,7 +1399,7 @@ int hinic_set_anti_attack(void *hwdev, bool enable)
 				     &rate, sizeof(rate), &rate,
 				     &out_size);
 	if (err || !out_size || rate.mgmt_msg_head.status) {
-		PMD_DRV_LOG(ERR, "can't %s port Anti-Attack rate limit, err: %d, status: 0x%x, out size: 0x%x",
+		PMD_DRV_LOG(ERR, "Can't %s port Anti-Attack rate limit, err: %d, status: 0x%x, out size: 0x%x",
 			(enable ? "enable" : "disable"), err,
 			rate.mgmt_msg_head.status, out_size);
 		return -EINVAL;
@@ -1502,8 +1501,7 @@ int hinic_set_fast_recycle_mode(void *hwdev, u8 mode)
 				     sizeof(fast_recycled_mode),
 				     &fast_recycled_mode, &out_size, 0);
 	if (err || fast_recycled_mode.mgmt_msg_head.status || !out_size) {
-		PMD_DRV_LOG(ERR,
-			"Failed to set recycle mode, ret = %d",
+		PMD_DRV_LOG(ERR, "Failed to set recycle mode, ret: %d",
 			fast_recycled_mode.mgmt_msg_head.status);
 		return -EFAULT;
 	}
drivers/net/hinic/base/hinic_pmd_nicio.c +8 -11
index 31a13fb..fd34b03 100644
@@ -312,7 +312,8 @@ static int init_sq_ctxts(struct hinic_nic_io *nic_io)
 					     HINIC_UCODE_CMD_MDY_QUEUE_CONTEXT,
 					     cmd_buf, &out_param, 0);
 		if (err || out_param != 0) {
-			PMD_DRV_LOG(ERR, "Failed to set SQ ctxts, err:%d", err);
+			PMD_DRV_LOG(ERR, "Failed to set SQ ctxts, err: %d",
+				err);
 			err = -EFAULT;
 			break;
 		}
@@ -536,7 +537,7 @@ int hinic_init_qp_ctxts(struct hinic_hwdev *hwdev)
 	if (hwdev->cmdqs->status & HINIC_CMDQ_SET_FAIL) {
 		err = hinic_reinit_cmdq_ctxts(hwdev);
 		if (err) {
-			PMD_DRV_LOG(ERR, "Reinit cmdq context failed, rc: %d\n",
+			PMD_DRV_LOG(ERR, "Reinit cmdq context failed, rc: %d",
 				err);
 			return err;
 		}
@@ -551,8 +552,7 @@ int hinic_init_qp_ctxts(struct hinic_hwdev *hwdev)
 	/* clean LRO/TSO context space */
 	err = clean_qp_offload_ctxt(nic_io);
 	if (err) {
-		PMD_DRV_LOG(ERR, "Clean qp offload ctxts failed, rc: %d",
-			err);
+		PMD_DRV_LOG(ERR, "Clean qp offload ctxts failed, rc: %d", err);
 		return err;
 	}
 
@@ -561,16 +561,14 @@ int hinic_init_qp_ctxts(struct hinic_hwdev *hwdev)
 	/* update rx buf size to function table */
 	err = hinic_set_rx_vhd_mode(hwdev, 0, rx_buf_sz);
 	if (err) {
-		PMD_DRV_LOG(ERR, "Set rx vhd mode failed, rc: %d",
-			err);
+		PMD_DRV_LOG(ERR, "Set rx vhd mode failed, rc: %d", err);
 		return err;
 	}
 
 	err = hinic_set_root_ctxt(hwdev, nic_io->rq_depth,
 				  nic_io->sq_depth, rx_buf_sz);
 	if (err) {
-		PMD_DRV_LOG(ERR, "Set root context failed, rc: %d",
-			err);
+		PMD_DRV_LOG(ERR, "Set root context failed, rc: %d", err);
 		return err;
 	}
 
@@ -585,8 +583,7 @@ int hinic_init_qp_ctxts(struct hinic_hwdev *hwdev)
 		sq_attr.dma_attr_off = 0;
 		err = hinic_set_ci_table(hwdev, q_id, &sq_attr);
 		if (err) {
-			PMD_DRV_LOG(ERR, "Set ci table failed, rc: %d",
-				err);
+			PMD_DRV_LOG(ERR, "Set ci table failed, rc: %d", err);
 			goto set_cons_idx_table_err;
 		}
 	}
@@ -744,7 +741,7 @@ static int hinic_alloc_nicio(struct hinic_hwdev *hwdev)
 
 	max_qps = hinic_func_max_qnum(hwdev);
 	if ((max_qps & (max_qps - 1))) {
-		PMD_DRV_LOG(ERR, "wrong number of max_qps: %d",
+		PMD_DRV_LOG(ERR, "Wrong number of max_qps: %d",
 			max_qps);
 		return -EINVAL;
 	}
drivers/net/hinic/hinic_pmd_ethdev.c +15 -16
index 9e90056..22e3efa 100644
@@ -347,7 +347,7 @@ static int hinic_dev_configure(struct rte_eth_dev *dev)
 	err = hinic_vlan_offload_set(dev,
 				ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK);
 	if (err) {
-		PMD_DRV_LOG(ERR, "Initialize vlan filter and strip failed\n");
+		PMD_DRV_LOG(ERR, "Initialize vlan filter and strip failed");
 		(void)hinic_config_mq_mode(dev, FALSE);
 		return err;
 	}
@@ -785,7 +785,7 @@ static int hinic_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 
 	err = hinic_get_mgmt_version(nic_dev->hwdev, fw_ver);
 	if (err) {
-		PMD_DRV_LOG(ERR, "Failed to get fw version\n");
+		PMD_DRV_LOG(ERR, "Failed to get fw version");
 		return -EINVAL;
 	}
 
@@ -1198,7 +1198,7 @@ static void hinic_dev_stop(struct rte_eth_dev *dev)
 	/* just stop phy port and vport */
 	rc = hinic_set_port_enable(nic_dev->hwdev, false);
 	if (rc)
-		PMD_DRV_LOG(WARNING, "Disable phy port failed, error: %d, dev_name:%s, port_id:%d",
+		PMD_DRV_LOG(WARNING, "Disable phy port failed, error: %d, dev_name: %s, port_id: %d",
 			  rc, name, port_id);
 
 	rc = hinic_set_vport_enable(nic_dev->hwdev, false);
@@ -1861,7 +1861,7 @@ static int hinic_rss_hash_update(struct rte_eth_dev *dev,
 	}
 
 	if (rss_conf->rss_key_len > HINIC_RSS_KEY_SIZE) {
-		PMD_DRV_LOG(ERR, "Invalid rss key, rss_key_len:%d",
+		PMD_DRV_LOG(ERR, "Invalid rss key, rss_key_len: %d",
 			    rss_conf->rss_key_len);
 		return HINIC_ERROR;
 	}
@@ -1982,7 +1982,7 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev,
 		return HINIC_OK;
 
 	if (reta_size != NIC_RSS_INDIR_SIZE) {
-		PMD_DRV_LOG(ERR, "Invalid reta size, reta_size:%d", reta_size);
+		PMD_DRV_LOG(ERR, "Invalid reta size, reta_size: %d", reta_size);
 		return HINIC_ERROR;
 	}
 
@@ -2000,7 +2000,7 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev,
 
 	for (i = 0 ; i < reta_size; i++) {
 		if (indirtbl[i] >= nic_dev->num_rq) {
-			PMD_DRV_LOG(ERR, "Invalid reta entry, index:%d, num_rq:%d",
+			PMD_DRV_LOG(ERR, "Invalid reta entry, index: %d, num_rq: %d",
 				    i, nic_dev->num_rq);
 			goto disable_rss;
 		}
@@ -2047,13 +2047,13 @@ static int hinic_rss_indirtbl_query(struct rte_eth_dev *dev,
 	u16 i = 0;
 
 	if (reta_size != NIC_RSS_INDIR_SIZE) {
-		PMD_DRV_LOG(ERR, "Invalid reta size, reta_size:%d", reta_size);
+		PMD_DRV_LOG(ERR, "Invalid reta size, reta_size: %d", reta_size);
 		return HINIC_ERROR;
 	}
 
 	err = hinic_rss_get_indir_tbl(nic_dev->hwdev, tmpl_idx, indirtbl);
 	if (err) {
-		PMD_DRV_LOG(ERR, "Get rss indirect table failed, error:%d",
+		PMD_DRV_LOG(ERR, "Get rss indirect table failed, error: %d",
 			    err);
 		return err;
 	}
@@ -2272,7 +2272,7 @@ static int hinic_set_mac_addr(struct rte_eth_dev *dev,
 
 	rte_ether_addr_copy(addr, &nic_dev->default_addr);
 
-	PMD_DRV_LOG(INFO, "Set new mac address %02x:%02x:%02x:%02x:%02x:%02x\n",
+	PMD_DRV_LOG(INFO, "Set new mac address %02x:%02x:%02x:%02x:%02x:%02x",
 		    addr->addr_bytes[0], addr->addr_bytes[1],
 		    addr->addr_bytes[2], addr->addr_bytes[3],
 		    addr->addr_bytes[4], addr->addr_bytes[5]);
@@ -2286,7 +2286,7 @@ static int hinic_set_mac_addr(struct rte_eth_dev *dev,
  * @param dev
  *   Pointer to Ethernet device structure.
  * @param index
- *   MAC address index.
+ *   MAC address index, should less than 128.
  */
 static void hinic_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
 {
@@ -2315,16 +2315,15 @@ static void hinic_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
  * @param dev
  *   Pointer to Ethernet device structure.
  * @param mac_addr
- *   MAC address to register.
+ *   Pointer to MAC address
  * @param index
- *   MAC address index.
+ *   MAC address index, should less than 128.
  * @param vmdq
- *   VMDq pool index to associate address with (ignored).
+ *   VMDq pool index(not used).
  *
  * @return
- *   0 on success, a negative errno value otherwise and rte_errno is set.
+ *   0 on success, negative error value otherwise.
  */
-
 static int hinic_mac_addr_add(struct rte_eth_dev *dev,
 			      struct rte_ether_addr *mac_addr, uint32_t index,
 			      __rte_unused uint32_t vmdq)
@@ -2335,7 +2334,7 @@ static int hinic_mac_addr_add(struct rte_eth_dev *dev,
 	int ret;
 
 	if (index >= HINIC_MAX_UC_MAC_ADDRS) {
-		PMD_DRV_LOG(INFO, "Add mac index(%u) is out of range,", index);
+		PMD_DRV_LOG(INFO, "Add mac index(%u) is out of range", index);
 		return -EINVAL;
 	}
 
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH v2 7/7 net/hinic/base: Support Pause flow control

In reply to Xiaoyun wang

The patch supports pause flow control, including getting or setting rx_pasue, tx_pause and auto_neg, auto_neg is just for Electric port type.

---
 drivers/net/hinic/base/hinic_pmd_niccfg.c | 29 ++++++++++
 drivers/net/hinic/base/hinic_pmd_niccfg.h |  2 +
 drivers/net/hinic/hinic_pmd_ethdev.c      | 89 ++++++++++++++++++++++++++++++-
 drivers/net/hinic/hinic_pmd_ethdev.h      |  3 ++
 drivers/net/hinic/hinic_pmd_tx.c          |  1 +
 5 files changed, 123 insertions(+), 1 deletion(-)
drivers/net/hinic/base/hinic_pmd_niccfg.c +29 -0
index a724211..ceb1319 100644
@@ -668,6 +668,35 @@ int hinic_set_pause_config(void *hwdev, struct nic_pause_config nic_pause)
 	return 0;
 }
 
+int hinic_get_pause_info(void *hwdev, struct nic_pause_config *nic_pause)
+{
+	struct hinic_pause_config pause_info;
+	u16 out_size = sizeof(pause_info);
+	int err;
+
+	if (!hwdev || !nic_pause)
+		return -EINVAL;
+
+	memset(&pause_info, 0, sizeof(pause_info));
+	pause_info.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
+	pause_info.func_id = hinic_global_func_id(hwdev);
+
+	err = l2nic_msg_to_mgmt_sync(hwdev, HINIC_PORT_CMD_GET_PAUSE_INFO,
+				     &pause_info, sizeof(pause_info),
+				     &pause_info, &out_size);
+	if (err || !out_size || pause_info.mgmt_msg_head.status) {
+		PMD_DRV_LOG(ERR, "Failed to get pause info, err: %d, status: 0x%x, out size: 0x%x\n",
+			err, pause_info.mgmt_msg_head.status, out_size);
+		return -EINVAL;
+	}
+
+	nic_pause->auto_neg = pause_info.auto_neg;
+	nic_pause->rx_pause = pause_info.rx_pause;
+	nic_pause->tx_pause = pause_info.tx_pause;
+
+	return 0;
+}
+
 int hinic_dcb_set_ets(void *hwdev, u8 *up_tc, u8 *pg_bw,
 		      u8 *pgid, u8 *up_bw, u8 *prio)
 {
drivers/net/hinic/base/hinic_pmd_niccfg.h +2 -0
index be6b320..846b597 100644
@@ -850,6 +850,8 @@ int hinic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,
 
 int hinic_set_pause_config(void *hwdev, struct nic_pause_config nic_pause);
 
+int hinic_get_pause_info(void *hwdev, struct nic_pause_config *nic_pause);
+
 int hinic_reset_port_link_cfg(void *hwdev);
 
 int hinic_dcb_set_ets(void *hwdev, u8 *up_tc, u8 *pg_bw, u8 *pgid, u8 *up_bw,
drivers/net/hinic/hinic_pmd_ethdev.c +88 -1

112 lines not on this page · raw message

drivers/net/hinic/hinic_pmd_ethdev.h +3 -0
index 910a57b..c23d3cf 100644
@@ -263,6 +263,9 @@ struct hinic_nic_dev {
 	u8 num_rss;
 	u8 rx_queue_list[HINIC_MAX_RX_QUEUES];
 
+	bool pause_set;
+	struct nic_pause_config nic_pause;
+
 	u32 vfta[HINIC_VFTA_SIZE];	/* VLAN bitmap */
 
 	struct rte_ether_addr default_addr;
drivers/net/hinic/hinic_pmd_tx.c +1 -0
index 64ec2c1..f24e3e4 100644
@@ -16,6 +16,7 @@
 #include "base/hinic_pmd_hwif.h"
 #include "base/hinic_pmd_wq.h"
 #include "base/hinic_pmd_nicio.h"
+#include "base/hinic_pmd_niccfg.h"
 #include "hinic_pmd_ethdev.h"
 #include "hinic_pmd_tx.h"
 
Signature · 1 line
1.8.3.1
#8 lore raw
In reply to Xiaoyun wang
Quoted 18 lines · Xiaoyun wang

This patch fixes LRO and hotupdate firmware problems, optimize doorbell area initialization without const macro definition, Optimize log files, support pause flow control and inner vxlan or non vxlan dport filter type.

--
v1->v2:
- Fix LRO problems
- Fix hotupdate firmware problem
- Optimize doorbell area initialization
- Remove 40GE Mezz card id
- Add Fdir filter type
- Optimize log files
- Support pause flow control

v1:
- Allocate IO memory with socketid

Quoted 9 lines

Xiaoyun wang (7):
net/hinic: fix LRO problems
net/hinic/base: fix hotupdate firmware problem net/hinic/base: optimize doorbell area initialization net/hinic: remove 40GE Mezz card id net/hinic: Add Fdir filter type net/hinic/base: Optimize log files net/hinic/base: Support Pause flow control

Series applied to dpdk-next-net/master, thanks.