DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem
@ 2020-06-27  3:55 Xiaoyun wang
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 1/5] net/hinic/base: add out parameter for mgmt sync channel Xiaoyun wang
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Xiaoyun wang @ 2020-06-27  3:55 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bluca, luoxianjun, luoxingyu, zhouguoyang,
	yin.yinshi, david.yangxiaoliang, zhaohui8, zhengjingzhou,
	Xiaoyun wang

This patch adds multi-thread resource protection when 
setting promiscuous or allmulticast mode, adds bufout
and out size parameter for mgmt sync channel and removes
unused parameters for mgmt channel with no ack, adds TCAM
filter switch for FDIR, and modifies return errors.

--
v1:
  - add out parameter for mgmt sync channel
  - remove unused parameter
  - fix setting promiscuous mode problem
  - add tcam filter switch for FDIR
  - modify return errors

Xiaoyun wang (5):
  net/hinic/base: add out parameter for mgmt sync channel
  net/hinic/base: remove unused parameter
  net/hinic: fix setting promiscuous mode problem
  net/hinic: add tcam filter switch for FDIR
  net/hinic/base: modify return errors

 drivers/net/hinic/base/hinic_pmd_cfg.c    |   4 +-
 drivers/net/hinic/base/hinic_pmd_cmd.h    |   1 +
 drivers/net/hinic/base/hinic_pmd_cmdq.c   |  31 ++++--
 drivers/net/hinic/base/hinic_pmd_hwdev.c  | 147 +++++++++++++++++---------
 drivers/net/hinic/base/hinic_pmd_hwif.c   |   4 +-
 drivers/net/hinic/base/hinic_pmd_mgmt.c   |   3 +-
 drivers/net/hinic/base/hinic_pmd_mgmt.h   |   3 +-
 drivers/net/hinic/base/hinic_pmd_niccfg.c | 170 ++++++++++++++++++------------
 drivers/net/hinic/base/hinic_pmd_niccfg.h |  11 ++
 drivers/net/hinic/base/hinic_pmd_nicio.c  |  42 ++++++--
 drivers/net/hinic/hinic_pmd_ethdev.c      |  34 +++++-
 drivers/net/hinic/hinic_pmd_ethdev.h      |   1 +
 drivers/net/hinic/hinic_pmd_flow.c        |  13 +++
 13 files changed, 316 insertions(+), 148 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v1 1/5] net/hinic/base: add out parameter for mgmt sync channel
  2020-06-27  3:55 [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem Xiaoyun wang
@ 2020-06-27  3:55 ` Xiaoyun wang
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 2/5] net/hinic/base: remove unused parameter Xiaoyun wang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Xiaoyun wang @ 2020-06-27  3:55 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bluca, luoxianjun, luoxingyu, zhouguoyang,
	yin.yinshi, david.yangxiaoliang, zhaohui8, zhengjingzhou,
	Xiaoyun wang, stable

Add bufout and out size info for some cmds that use mgmt
sync channel, which can improve dfx capability when send
msg failed.

Fixes: 7fcd6b05b923 ("net/hinic/base: support cmdq mechanism")

Cc: stable@dpdk.org
Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 drivers/net/hinic/base/hinic_pmd_cmdq.c   |  31 ++++---
 drivers/net/hinic/base/hinic_pmd_hwdev.c  | 129 +++++++++++++++++++++---------
 drivers/net/hinic/base/hinic_pmd_niccfg.c |  27 +++----
 drivers/net/hinic/base/hinic_pmd_nicio.c  |  36 +++++++--
 4 files changed, 151 insertions(+), 72 deletions(-)

diff --git a/drivers/net/hinic/base/hinic_pmd_cmdq.c b/drivers/net/hinic/base/hinic_pmd_cmdq.c
index 2e98b9c..1816636 100644
--- a/drivers/net/hinic/base/hinic_pmd_cmdq.c
+++ b/drivers/net/hinic/base/hinic_pmd_cmdq.c
@@ -426,27 +426,31 @@ static int hinic_set_cmdq_ctxts(struct hinic_hwdev *hwdev)
 {
 	struct hinic_cmdqs *cmdqs = hwdev->cmdqs;
 	struct hinic_cmdq_ctxt *cmdq_ctxt;
+	struct hinic_cmdq_ctxt cmdq_ctxt_out;
 	enum hinic_cmdq_type cmdq_type;
+	u16 out_size = sizeof(cmdq_ctxt_out);
 	u16 in_size;
 	int err;
 
 	cmdq_type = HINIC_CMDQ_SYNC;
+	memset(&cmdq_ctxt_out, 0, out_size);
 	for (; cmdq_type < HINIC_MAX_CMDQ_TYPES; cmdq_type++) {
 		cmdq_ctxt = &cmdqs->cmdq[cmdq_type].cmdq_ctxt;
 		cmdq_ctxt->resp_aeq_num = HINIC_AEQ1;
 		in_size = sizeof(*cmdq_ctxt);
 		err = hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
 					     HINIC_MGMT_CMD_CMDQ_CTXT_SET,
-					     cmdq_ctxt, in_size, NULL,
-					     NULL, 0);
-		if (err) {
+					     cmdq_ctxt, in_size, &cmdq_ctxt_out,
+					     &out_size, 0);
+		if (err || !out_size || cmdq_ctxt_out.status) {
 			if (err == HINIC_MBOX_PF_BUSY_ACTIVE_FW ||
 				err == HINIC_DEV_BUSY_ACTIVE_FW) {
 				cmdqs->status |= HINIC_CMDQ_SET_FAIL;
 				PMD_DRV_LOG(ERR, "PF or VF fw is hot active");
 			}
-			PMD_DRV_LOG(ERR, "Set cmdq ctxt failed, err: %d", err);
-			return -EFAULT;
+			PMD_DRV_LOG(ERR, "Set cmdq ctxt failed, err: %d, status: 0x%x, out_size: 0x%x",
+				err, cmdq_ctxt_out.status, out_size);
+			return -EIO;
 		}
 	}
 
@@ -631,6 +635,8 @@ static void hinic_cmdqs_free(struct hinic_hwdev *hwdev)
 static int hinic_set_cmdq_depth(struct hinic_hwdev *hwdev, u16 cmdq_depth)
 {
 	struct hinic_root_ctxt root_ctxt;
+	u16 out_size = sizeof(root_ctxt);
+	int err;
 
 	memset(&root_ctxt, 0, sizeof(root_ctxt));
 	root_ctxt.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
@@ -638,10 +644,17 @@ static int hinic_set_cmdq_depth(struct hinic_hwdev *hwdev, u16 cmdq_depth)
 	root_ctxt.ppf_idx = hinic_ppf_idx(hwdev);
 	root_ctxt.set_cmdq_depth = 1;
 	root_ctxt.cmdq_depth = (u8)ilog2(cmdq_depth);
-	return hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
-				      HINIC_MGMT_CMD_VAT_SET,
-				      &root_ctxt, sizeof(root_ctxt),
-				      NULL, NULL, 0);
+	err = hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
+				     HINIC_MGMT_CMD_VAT_SET,
+				     &root_ctxt, sizeof(root_ctxt),
+				     &root_ctxt, &out_size, 0);
+	if (err || !out_size || root_ctxt.mgmt_msg_head.status) {
+		PMD_DRV_LOG(ERR, "Set cmdq depth failed, err: %d, status: 0x%x, out_size: 0x%x",
+			err, root_ctxt.mgmt_msg_head.status, out_size);
+		return -EIO;
+	}
+
+	return 0;
 }
 
 int hinic_comm_cmdqs_init(struct hinic_hwdev *hwdev)
diff --git a/drivers/net/hinic/base/hinic_pmd_hwdev.c b/drivers/net/hinic/base/hinic_pmd_hwdev.c
index cc42076..c132de0 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwdev.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwdev.c
@@ -390,6 +390,8 @@ void hinic_osdep_deinit(struct hinic_hwdev *hwdev)
 int hinic_set_ci_table(void *hwdev, u16 q_id, struct hinic_sq_attr *attr)
 {
 	struct hinic_cons_idx_attr cons_idx_attr;
+	u16 out_size = sizeof(cons_idx_attr);
+	int err;
 
 	memset(&cons_idx_attr, 0, sizeof(cons_idx_attr));
 	cons_idx_attr.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
@@ -406,10 +408,17 @@ int hinic_set_ci_table(void *hwdev, u16 q_id, struct hinic_sq_attr *attr)
 	cons_idx_attr.sq_id = q_id;
 	cons_idx_attr.ci_addr = attr->ci_dma_base;
 
-	return hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
+	err = hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
 				      HINIC_MGMT_CMD_L2NIC_SQ_CI_ATTR_SET,
 				      &cons_idx_attr, sizeof(cons_idx_attr),
-				      NULL, NULL, 0);
+				      &cons_idx_attr, &out_size, 0);
+	if (err || !out_size || cons_idx_attr.mgmt_msg_head.status) {
+		PMD_DRV_LOG(ERR, "Set ci attribute table failed, err: %d, status: 0x%x, out_size: 0x%x",
+			err, cons_idx_attr.mgmt_msg_head.status, out_size);
+		return -EIO;
+	}
+
+	return 0;
 }
 
 /**
@@ -422,7 +431,9 @@ int hinic_set_ci_table(void *hwdev, u16 q_id, struct hinic_sq_attr *attr)
  */
 int hinic_set_pagesize(void *hwdev, u8 page_size)
 {
-	struct hinic_page_size cmd;
+	struct hinic_page_size page_size_info;
+	u16 out_size = sizeof(page_size_info);
+	int err;
 
 	if (page_size > HINIC_PAGE_SIZE_MAX) {
 		PMD_DRV_LOG(ERR, "Invalid page_size %u, bigger than %u",
@@ -430,16 +441,23 @@ int hinic_set_pagesize(void *hwdev, u8 page_size)
 		return -EINVAL;
 	}
 
-	memset(&cmd, 0, sizeof(cmd));
-	cmd.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
-	cmd.func_idx = hinic_global_func_id(hwdev);
-	cmd.ppf_idx = hinic_ppf_idx(hwdev);
-	cmd.page_size = page_size;
+	memset(&page_size_info, 0, sizeof(page_size_info));
+	page_size_info.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
+	page_size_info.func_idx = hinic_global_func_id(hwdev);
+	page_size_info.ppf_idx = hinic_ppf_idx(hwdev);
+	page_size_info.page_size = page_size;
 
-	return hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
-					HINIC_MGMT_CMD_PAGESIZE_SET,
-					&cmd, sizeof(cmd),
-					NULL, NULL, 0);
+	err = hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
+				     HINIC_MGMT_CMD_PAGESIZE_SET,
+				     &page_size_info, sizeof(page_size_info),
+				     &page_size_info, &out_size, 0);
+	if (err || !out_size || page_size_info.mgmt_msg_head.status) {
+		PMD_DRV_LOG(ERR, "Set wq page size failed, err: %d, status: 0x%x, out_size: 0x%0x",
+			err, page_size_info.mgmt_msg_head.status, out_size);
+		return -EIO;
+	}
+
+	return 0;
 }
 
 static int wait_for_flr_finish(struct hinic_hwif *hwif)
@@ -546,7 +564,9 @@ static int hinic_pf_rx_tx_flush(struct hinic_hwdev *hwdev)
 	struct hinic_hwif *hwif = hwdev->hwif;
 	struct hinic_clear_doorbell clear_db;
 	struct hinic_clear_resource clr_res;
+	u16 out_size;
 	int err;
+	int ret = 0;
 
 	rte_delay_ms(100);
 
@@ -557,15 +577,19 @@ static int hinic_pf_rx_tx_flush(struct hinic_hwdev *hwdev)
 	}
 
 	hinic_disable_doorbell(hwif);
+	out_size = sizeof(clear_db);
 	memset(&clear_db, 0, sizeof(clear_db));
 	clear_db.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
 	clear_db.func_idx = HINIC_HWIF_GLOBAL_IDX(hwif);
 	clear_db.ppf_idx  = HINIC_HWIF_PPF_IDX(hwif);
 	err = hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
 				     HINIC_MGMT_CMD_FLUSH_DOORBELL, &clear_db,
-				     sizeof(clear_db), NULL, NULL, 0);
-	if (err)
-		PMD_DRV_LOG(WARNING, "Flush doorbell failed");
+				     sizeof(clear_db), &clear_db, &out_size, 0);
+	if (err || !out_size || clear_db.mgmt_msg_head.status) {
+		PMD_DRV_LOG(WARNING, "Flush doorbell failed, err: %d, status: 0x%x, out_size: 0x%x",
+			 err, clear_db.mgmt_msg_head.status, out_size);
+		ret = err ? err : (-EIO);
+	}
 
 	hinic_set_pf_status(hwif, HINIC_PF_STATUS_FLR_START_FLAG);
 	memset(&clr_res, 0, sizeof(clr_res));
@@ -576,20 +600,27 @@ static int hinic_pf_rx_tx_flush(struct hinic_hwdev *hwdev)
 	err = hinic_msg_to_mgmt_no_ack(hwdev, HINIC_MOD_COMM,
 				       HINIC_MGMT_CMD_START_FLR, &clr_res,
 				       sizeof(clr_res), NULL, NULL);
-	if (err)
-		PMD_DRV_LOG(WARNING, "Notice flush message failed");
+	if (err) {
+		PMD_DRV_LOG(WARNING, "Notice flush msg failed, err: %d", err);
+		ret = err;
+	}
 
 	err = wait_for_flr_finish(hwif);
-	if (err)
-		PMD_DRV_LOG(WARNING, "Wait firmware FLR timeout");
+	if (err) {
+		PMD_DRV_LOG(WARNING, "Wait firmware FLR timeout, err: %d", err);
+		ret = err;
+	}
 
 	hinic_enable_doorbell(hwif);
 
 	err = hinic_reinit_cmdq_ctxts(hwdev);
-	if (err)
-		PMD_DRV_LOG(WARNING, "Reinit cmdq failed when pf flush");
+	if (err) {
+		PMD_DRV_LOG(WARNING,
+			    "Reinit cmdq failed when pf flush, err: %d", err);
+		ret = err;
+	}
 
-	return 0;
+	return ret;
 }
 
 int hinic_func_rx_tx_flush(struct hinic_hwdev *hwdev)
@@ -623,9 +654,9 @@ static int hinic_get_interrupt_cfg(struct hinic_hwdev *hwdev,
 				     &msix_cfg, sizeof(msix_cfg),
 				     &msix_cfg, &out_size, 0);
 	if (err || !out_size || msix_cfg.mgmt_msg_head.status) {
-		PMD_DRV_LOG(ERR, "Get interrupt config failed, ret: %d",
-			msix_cfg.mgmt_msg_head.status);
-		return -EINVAL;
+		PMD_DRV_LOG(ERR, "Get interrupt config failed, err: %d, status: 0x%x, out size: 0x%x",
+			err, msix_cfg.mgmt_msg_head.status, out_size);
+		return -EIO;
 	}
 
 	interrupt_info->lli_credit_limit = msix_cfg.lli_credit_cnt;
@@ -683,9 +714,9 @@ int hinic_set_interrupt_cfg(struct hinic_hwdev *hwdev,
 				     &msix_cfg, sizeof(msix_cfg),
 				     &msix_cfg, &out_size, 0);
 	if (err || !out_size || msix_cfg.mgmt_msg_head.status) {
-		PMD_DRV_LOG(ERR, "Set interrupt config failed, ret: %d",
-			msix_cfg.mgmt_msg_head.status);
-		return -EINVAL;
+		PMD_DRV_LOG(ERR, "Set interrupt config failed, err: %d, status: 0x%x, out size: 0x%x",
+			err, msix_cfg.mgmt_msg_head.status, out_size);
+		return -EIO;
 	}
 
 	return 0;
@@ -770,6 +801,8 @@ static int set_vf_dma_attr_entry(struct hinic_hwdev *hwdev, u8 entry_idx,
 				enum hinic_pcie_tph tph_en)
 {
 	struct hinic_vf_dma_attr_table attr;
+	u16 out_size = sizeof(attr);
+	int err;
 
 	memset(&attr, 0, sizeof(attr));
 	attr.func_idx = hinic_global_func_id(hwdev);
@@ -782,9 +815,16 @@ static int set_vf_dma_attr_entry(struct hinic_hwdev *hwdev, u8 entry_idx,
 	attr.no_snooping = no_snooping;
 	attr.tph_en = tph_en;
 
-	return hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
-					HINIC_MGMT_CMD_DMA_ATTR_SET,
-					&attr, sizeof(attr), NULL, NULL, 0);
+	err = hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
+				     HINIC_MGMT_CMD_DMA_ATTR_SET,
+				     &attr, sizeof(attr), &attr, &out_size, 0);
+	if (err || !out_size || attr.mgmt_msg_head.status) {
+		PMD_DRV_LOG(ERR, "Set dma attribute failed, err: %d, status: 0x%x, out_size: 0x%x",
+			err, attr.mgmt_msg_head.status, out_size);
+		return -EIO;
+	}
+
+	return 0;
 }
 
 /**
@@ -926,17 +966,26 @@ static void fault_report_show(struct hinic_hwdev *hwdev,
 static int resources_state_set(struct hinic_hwdev *hwdev,
 			       enum hinic_res_state state)
 {
-	struct hinic_hwif *hwif = hwdev->hwif;
 	struct hinic_cmd_set_res_state res_state;
+	u16 out_size = sizeof(res_state);
+	int err;
 
 	memset(&res_state, 0, sizeof(res_state));
 	res_state.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
-	res_state.func_idx = HINIC_HWIF_GLOBAL_IDX(hwif);
+	res_state.func_idx = HINIC_HWIF_GLOBAL_IDX(hwdev->hwif);
 	res_state.state = state;
 
-	return hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
+	err = hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
 				 HINIC_MGMT_CMD_RES_STATE_SET,
-				 &res_state, sizeof(res_state), NULL, NULL, 0);
+				 &res_state, sizeof(res_state),
+				 &res_state, &out_size, 0);
+	if (err || !out_size || res_state.mgmt_msg_head.status) {
+		PMD_DRV_LOG(ERR, "Set resources state failed, err: %d, status: 0x%x, out_size: 0x%x",
+			err, res_state.mgmt_msg_head.status, out_size);
+		return -EIO;
+	}
+
+	return 0;
 }
 
 /**
@@ -1020,6 +1069,7 @@ int hinic_l2nic_reset(struct hinic_hwdev *hwdev)
 {
 	struct hinic_hwif *hwif = hwdev->hwif;
 	struct hinic_l2nic_reset l2nic_reset;
+	u16 out_size = sizeof(l2nic_reset);
 	int err = 0;
 
 	err = hinic_set_vport_enable(hwdev, false);
@@ -1036,10 +1086,11 @@ int hinic_l2nic_reset(struct hinic_hwdev *hwdev)
 	err = hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
 				     HINIC_MGMT_CMD_L2NIC_RESET,
 				     &l2nic_reset, sizeof(l2nic_reset),
-				     NULL, NULL, 0);
-	if (err || l2nic_reset.mgmt_msg_head.status) {
-		PMD_DRV_LOG(ERR, "Reset L2NIC resources failed");
-		return -EFAULT;
+				     &l2nic_reset, &out_size, 0);
+	if (err || !out_size || l2nic_reset.mgmt_msg_head.status) {
+		PMD_DRV_LOG(ERR, "Reset L2NIC resources failed, err: %d, status: 0x%x, out_size: 0x%x",
+			err, l2nic_reset.mgmt_msg_head.status, out_size);
+		return -EIO;
 	}
 
 	return 0;
diff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.c b/drivers/net/hinic/base/hinic_pmd_niccfg.c
index c5663df..e894503 100644
--- a/drivers/net/hinic/base/hinic_pmd_niccfg.c
+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.c
@@ -18,7 +18,6 @@
 			buf_in, in_size,			\
 			buf_out, out_size, 0)
 
-
 /**
  * hinic_init_function_table - Initialize function table.
  *
@@ -380,9 +379,8 @@ int hinic_add_remove_vlan(void *hwdev, u16 vlan_id, u16 func_id, bool add)
 	vlan_info.func_id = func_id;
 	vlan_info.vlan_id = vlan_id;
 
-	err = l2nic_msg_to_mgmt_sync(hwdev, cmd, &vlan_info,
-				     sizeof(vlan_info), &vlan_info,
-				     &out_size);
+	err = l2nic_msg_to_mgmt_sync(hwdev, cmd, &vlan_info, sizeof(vlan_info),
+				     &vlan_info, &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",
@@ -469,8 +467,8 @@ int hinic_set_rx_vlan_offload(void *hwdev, u8 en)
 	vlan_cfg.vlan_rx_offload = en;
 
 	err = l2nic_msg_to_mgmt_sync(hwdev, HINIC_PORT_CMD_SET_RX_VLAN_OFFLOAD,
-					&vlan_cfg, sizeof(vlan_cfg),
-					&vlan_cfg, &out_size);
+				     &vlan_cfg, sizeof(vlan_cfg),
+				     &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",
@@ -626,7 +624,7 @@ int hinic_get_port_info(void *hwdev, struct nic_port_info *port_info)
 		PMD_DRV_LOG(ERR,
 			"Failed to get port info, err: %d, status: 0x%x, out size: 0x%x",
 			err, port_msg.mgmt_msg_head.status, out_size);
-		return err;
+		return -EIO;
 	}
 
 	port_info->autoneg_cap = port_msg.autoneg_cap;
@@ -1270,7 +1268,6 @@ int hinic_set_rx_vhd_mode(void *hwdev, u16 vhd_mode, u16 rx_buf_sz)
 		PMD_DRV_LOG(ERR,
 			"Failed to set vhd mode, err: %d, status: 0x%x, out size: 0x%x",
 			err, vhd_mode_cfg.mgmt_msg_head.status, out_size);
-
 		return -EIO;
 	}
 
@@ -1425,8 +1422,7 @@ int hinic_set_anti_attack(void *hwdev, bool enable)
 	rate.xbs = ANTI_ATTACK_DEFAULT_XBS;
 
 	err = l2nic_msg_to_mgmt_sync(hwdev, HINIC_PORT_CMD_SET_ANTI_ATTACK_RATE,
-				     &rate, sizeof(rate), &rate,
-				     &out_size);
+				     &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",
 			(enable ? "enable" : "disable"), err,
@@ -1530,9 +1526,9 @@ 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",
-			fast_recycled_mode.mgmt_msg_head.status);
-		return -EFAULT;
+		PMD_DRV_LOG(ERR, "Failed to set recycle mode, err: %d, status: 0x%x, out size: 0x%x",
+			err, fast_recycled_mode.mgmt_msg_head.status, out_size);
+		return -EIO;
 	}
 
 	return 0;
@@ -1756,12 +1752,11 @@ int hinic_vf_get_default_cos(struct hinic_hwdev *hwdev, u8 *cos_id)
 
 	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);
+				     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;
+		return -EIO;
 	}
 	*cos_id = vf_cos.state.default_cos;
 
diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c
index 7f7e11d..7ec3e4c 100644
--- a/drivers/net/hinic/base/hinic_pmd_nicio.c
+++ b/drivers/net/hinic/base/hinic_pmd_nicio.c
@@ -471,6 +471,8 @@ static u16 get_hw_rx_buf_size(u32 rx_buf_sz)
 hinic_set_root_ctxt(void *hwdev, u16 rq_depth, u16 sq_depth, int rx_buf_sz)
 {
 	struct hinic_root_ctxt root_ctxt;
+	u16 out_size = sizeof(root_ctxt);
+	int err;
 
 	memset(&root_ctxt, 0, sizeof(root_ctxt));
 	root_ctxt.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
@@ -483,10 +485,18 @@ static u16 get_hw_rx_buf_size(u32 rx_buf_sz)
 	root_ctxt.rx_buf_sz = get_hw_rx_buf_size(rx_buf_sz);
 	root_ctxt.sq_depth  = (u16)ilog2(sq_depth);
 
-	return hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
-				      HINIC_MGMT_CMD_VAT_SET,
-				      &root_ctxt, sizeof(root_ctxt),
-				      NULL, NULL, 0);
+	err = hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
+				     HINIC_MGMT_CMD_VAT_SET,
+				     &root_ctxt, sizeof(root_ctxt),
+				     &root_ctxt, &out_size, 0);
+	if (err || !out_size || root_ctxt.mgmt_msg_head.status) {
+		PMD_DRV_LOG(ERR,
+			"Set root context failed, err: %d, status: 0x%x, out_size: 0x%x",
+			err, root_ctxt.mgmt_msg_head.status, out_size);
+		return -EIO;
+	}
+
+	return 0;
 }
 
 /**
@@ -499,6 +509,8 @@ static u16 get_hw_rx_buf_size(u32 rx_buf_sz)
 static int hinic_clean_root_ctxt(void *hwdev)
 {
 	struct hinic_root_ctxt root_ctxt;
+	u16 out_size = sizeof(root_ctxt);
+	int err;
 
 	memset(&root_ctxt, 0, sizeof(root_ctxt));
 	root_ctxt.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
@@ -511,10 +523,18 @@ static int hinic_clean_root_ctxt(void *hwdev)
 	root_ctxt.rx_buf_sz = 0;
 	root_ctxt.sq_depth  = 0;
 
-	return hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
-				      HINIC_MGMT_CMD_VAT_SET,
-				      &root_ctxt, sizeof(root_ctxt),
-				      NULL, NULL, 0);
+	err = hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_COMM,
+				     HINIC_MGMT_CMD_VAT_SET,
+				     &root_ctxt, sizeof(root_ctxt),
+				     &root_ctxt, &out_size, 0);
+	if (err || !out_size || root_ctxt.mgmt_msg_head.status) {
+		PMD_DRV_LOG(ERR,
+			"Clean root context failed, err: %d, status: 0x%x, out_size: 0x%x",
+			err, root_ctxt.mgmt_msg_head.status, out_size);
+		return -EIO;
+	}
+
+	return 0;
 }
 
 /* init qps ctxt and set sq ci attr and arm all sq and set vat page_size */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v1 2/5] net/hinic/base: remove unused parameter
  2020-06-27  3:55 [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem Xiaoyun wang
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 1/5] net/hinic/base: add out parameter for mgmt sync channel Xiaoyun wang
@ 2020-06-27  3:55 ` Xiaoyun wang
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 3/5] net/hinic: fix setting promiscuous mode problem Xiaoyun wang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Xiaoyun wang @ 2020-06-27  3:55 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bluca, luoxianjun, luoxingyu, zhouguoyang,
	yin.yinshi, david.yangxiaoliang, zhaohui8, zhengjingzhou,
	Xiaoyun wang, stable

Remove unused parameters for mgmt channel with no ack.

Fixes: a4957d87e05a ("net/hinic/base: add mgmt module")

Cc: stable@dpdk.org
Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 drivers/net/hinic/base/hinic_pmd_hwdev.c | 2 +-
 drivers/net/hinic/base/hinic_pmd_mgmt.c  | 3 +--
 drivers/net/hinic/base/hinic_pmd_mgmt.h  | 3 +--
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/hinic/base/hinic_pmd_hwdev.c b/drivers/net/hinic/base/hinic_pmd_hwdev.c
index c132de0..a93f240 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwdev.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwdev.c
@@ -599,7 +599,7 @@ static int hinic_pf_rx_tx_flush(struct hinic_hwdev *hwdev)
 
 	err = hinic_msg_to_mgmt_no_ack(hwdev, HINIC_MOD_COMM,
 				       HINIC_MGMT_CMD_START_FLR, &clr_res,
-				       sizeof(clr_res), NULL, NULL);
+				       sizeof(clr_res));
 	if (err) {
 		PMD_DRV_LOG(WARNING, "Notice flush msg failed, err: %d", err);
 		ret = err;
diff --git a/drivers/net/hinic/base/hinic_pmd_mgmt.c b/drivers/net/hinic/base/hinic_pmd_mgmt.c
index 94bc45f..babb93a 100644
--- a/drivers/net/hinic/base/hinic_pmd_mgmt.c
+++ b/drivers/net/hinic/base/hinic_pmd_mgmt.c
@@ -504,8 +504,7 @@ int hinic_msg_to_mgmt_sync(void *hwdev, enum hinic_mod_type mod, u8 cmd,
 }
 
 int hinic_msg_to_mgmt_no_ack(void *hwdev, enum hinic_mod_type mod, u8 cmd,
-		     void *buf_in, u16 in_size, __rte_unused void *buf_out,
-		     __rte_unused u16 *out_size)
+			     void *buf_in, u16 in_size)
 {
 	struct hinic_msg_pf_to_mgmt *pf_to_mgmt =
 				((struct hinic_hwdev *)hwdev)->pf_to_mgmt;
diff --git a/drivers/net/hinic/base/hinic_pmd_mgmt.h b/drivers/net/hinic/base/hinic_pmd_mgmt.h
index 52b319e..0f32865 100644
--- a/drivers/net/hinic/base/hinic_pmd_mgmt.h
+++ b/drivers/net/hinic/base/hinic_pmd_mgmt.h
@@ -101,8 +101,7 @@ struct hinic_msg_pf_to_mgmt {
 };
 
 int hinic_msg_to_mgmt_no_ack(void *hwdev, enum hinic_mod_type mod, u8 cmd,
-			     void *buf_in, u16 in_size, void *buf_out,
-			     u16 *out_size);
+			     void *buf_in, u16 in_size);
 
 int hinic_comm_pf_to_mgmt_init(struct hinic_hwdev *hwdev);
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v1 3/5] net/hinic: fix setting promiscuous mode problem
  2020-06-27  3:55 [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem Xiaoyun wang
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 1/5] net/hinic/base: add out parameter for mgmt sync channel Xiaoyun wang
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 2/5] net/hinic/base: remove unused parameter Xiaoyun wang
@ 2020-06-27  3:55 ` Xiaoyun wang
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 4/5] net/hinic: add tcam filter switch for FDIR Xiaoyun wang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Xiaoyun wang @ 2020-06-27  3:55 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bluca, luoxianjun, luoxingyu, zhouguoyang,
	yin.yinshi, david.yangxiaoliang, zhaohui8, zhengjingzhou,
	Xiaoyun wang, stable

When setting promiscuous or allmulticast mode, increase
multi-thread resource protection, because the patch
"net/bonding: prefer allmulti to promiscuous for LACP"
adds trying to use allmulti when adding a slave, and
EVS bond driver also sets promisc with another thread,
which may lead to thread reentry and cause failure to
set promiscuous mode.

Fixes: cb7b6606ebff ("net/hinic: add RSS stats and promiscuous ops")

Cc: stable@dpdk.org
Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 drivers/net/hinic/hinic_pmd_ethdev.c | 34 ++++++++++++++++++++++++++++++----
 drivers/net/hinic/hinic_pmd_ethdev.h |  1 +
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 0c3e1c0..8de9714 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -1271,14 +1271,25 @@ static void hinic_disable_interrupt(struct rte_eth_dev *dev)
 
 static int hinic_set_dev_promiscuous(struct hinic_nic_dev *nic_dev, bool enable)
 {
-	u32 rx_mode_ctrl = nic_dev->rx_mode_status;
+	u32 rx_mode_ctrl;
+	int err;
+
+	err = hinic_mutex_lock(&nic_dev->rx_mode_mutex);
+	if (err)
+		return err;
+
+	rx_mode_ctrl = nic_dev->rx_mode_status;
 
 	if (enable)
 		rx_mode_ctrl |= HINIC_RX_MODE_PROMISC;
 	else
 		rx_mode_ctrl &= (~HINIC_RX_MODE_PROMISC);
 
-	return hinic_config_rx_mode(nic_dev, rx_mode_ctrl);
+	err = hinic_config_rx_mode(nic_dev, rx_mode_ctrl);
+
+	(void)hinic_mutex_unlock(&nic_dev->rx_mode_mutex);
+
+	return err;
 }
 
 /**
@@ -1731,14 +1742,25 @@ 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;
+	u32 rx_mode_ctrl;
+	int err;
+
+	err = hinic_mutex_lock(&nic_dev->rx_mode_mutex);
+	if (err)
+		return err;
+
+	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);
+	err = hinic_config_rx_mode(nic_dev, rx_mode_ctrl);
+
+	(void)hinic_mutex_unlock(&nic_dev->rx_mode_mutex);
+
+	return err;
 }
 
 /**
@@ -3130,6 +3152,8 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
 	}
 	rte_bit_relaxed_set32(HINIC_DEV_INTR_EN, &nic_dev->dev_status);
 
+	hinic_mutex_init(&nic_dev->rx_mode_mutex, NULL);
+
 	/* initialize filter info */
 	filter_info = &nic_dev->filter;
 	tcam_info = &nic_dev->tcam;
@@ -3204,6 +3228,8 @@ static int hinic_dev_uninit(struct rte_eth_dev *dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	hinic_mutex_destroy(&nic_dev->rx_mode_mutex);
+
 	hinic_dev_close(dev);
 
 	dev->dev_ops = NULL;
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h
index 77b4b91..3f2d51d 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.h
+++ b/drivers/net/hinic/hinic_pmd_ethdev.h
@@ -329,6 +329,7 @@ struct hinic_nic_dev {
 	unsigned int flags;
 	struct nic_service_cap nic_cap;
 	u32 rx_mode_status;	/* promisc or allmulticast */
+	pthread_mutex_t rx_mode_mutex;
 	u32 dev_status;
 
 	char proc_dev_name[HINIC_DEV_NAME_LEN];
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v1 4/5] net/hinic: add tcam filter switch for FDIR
  2020-06-27  3:55 [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem Xiaoyun wang
                   ` (2 preceding siblings ...)
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 3/5] net/hinic: fix setting promiscuous mode problem Xiaoyun wang
@ 2020-06-27  3:55 ` Xiaoyun wang
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 5/5] net/hinic/base: modify return errors Xiaoyun wang
  2020-07-03 16:22 ` [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem Ferruh Yigit
  5 siblings, 0 replies; 8+ messages in thread
From: Xiaoyun wang @ 2020-06-27  3:55 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bluca, luoxianjun, luoxingyu, zhouguoyang,
	yin.yinshi, david.yangxiaoliang, zhaohui8, zhengjingzhou,
	Xiaoyun wang, stable

When the filter rule needs to use the TCAM method, PMD driver
enables the TCAM filter switch, otherwise disables it, which
can improve the performance of microcode in FDIR scenarios that
not use TCAM method.

Fixes: 1fe89aa37f36 ("net/hinic: add flow director filter")

Cc: stable@dpdk.org
Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 drivers/net/hinic/base/hinic_pmd_cmd.h    |  1 +
 drivers/net/hinic/base/hinic_pmd_niccfg.c | 41 +++++++++++++++++++++++++++++++
 drivers/net/hinic/base/hinic_pmd_niccfg.h | 11 +++++++++
 drivers/net/hinic/hinic_pmd_flow.c        | 13 ++++++++++
 4 files changed, 66 insertions(+)

diff --git a/drivers/net/hinic/base/hinic_pmd_cmd.h b/drivers/net/hinic/base/hinic_pmd_cmd.h
index 09918a7..9ecb712 100644
--- a/drivers/net/hinic/base/hinic_pmd_cmd.h
+++ b/drivers/net/hinic/base/hinic_pmd_cmd.h
@@ -120,6 +120,7 @@ enum hinic_port_cmd {
 	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_UP_TC_ENABLE		= 0xb4,
 
 	HINIC_PORT_CMD_SET_IPSU_MAC		= 0xcb,
 	HINIC_PORT_CMD_GET_IPSU_MAC		= 0xcc,
diff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.c b/drivers/net/hinic/base/hinic_pmd_niccfg.c
index e894503..67f6bc4 100644
--- a/drivers/net/hinic/base/hinic_pmd_niccfg.c
+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.c
@@ -2114,3 +2114,44 @@ int hinic_flush_tcam_rule(void *hwdev)
 	return err;
 }
 
+int hinic_set_fdir_tcam_rule_filter(void *hwdev, bool enable)
+{
+	struct hinic_port_tcam_info port_tcam_cmd;
+	u16 out_size = sizeof(port_tcam_cmd);
+	int err;
+
+	if (!hwdev)
+		return -EINVAL;
+
+	memset(&port_tcam_cmd, 0, sizeof(port_tcam_cmd));
+	port_tcam_cmd.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
+	port_tcam_cmd.func_id = hinic_global_func_id(hwdev);
+	port_tcam_cmd.tcam_enable = (u8)enable;
+
+	err = l2nic_msg_to_mgmt_sync(hwdev, HINIC_PORT_CMD_UP_TC_ENABLE,
+			&port_tcam_cmd, sizeof(port_tcam_cmd),
+			&port_tcam_cmd, &out_size);
+	if ((port_tcam_cmd.mgmt_msg_head.status != HINIC_MGMT_CMD_UNSUPPORTED &&
+		port_tcam_cmd.mgmt_msg_head.status) || err || !out_size) {
+		if (err == HINIC_MBOX_VF_CMD_ERROR &&
+			HINIC_IS_VF((struct hinic_hwdev *)hwdev)) {
+			err = HINIC_MGMT_CMD_UNSUPPORTED;
+			PMD_DRV_LOG(WARNING, "VF doesn't support setting fdir tcam filter");
+			return err;
+		}
+		PMD_DRV_LOG(ERR, "Set fdir tcam filter failed, err: %d, "
+			"status: 0x%x, out size: 0x%x, enable: 0x%x",
+			err, port_tcam_cmd.mgmt_msg_head.status, out_size,
+			enable);
+		return -EFAULT;
+	}
+
+	if (port_tcam_cmd.mgmt_msg_head.status == HINIC_MGMT_CMD_UNSUPPORTED) {
+		err = HINIC_MGMT_CMD_UNSUPPORTED;
+		PMD_DRV_LOG(WARNING, "Fw doesn't support setting fdir tcam filter");
+	}
+
+	return err;
+}
+
+
diff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.h b/drivers/net/hinic/base/hinic_pmd_niccfg.h
index 846b597..73b16b4 100644
--- a/drivers/net/hinic/base/hinic_pmd_niccfg.h
+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.h
@@ -766,6 +766,15 @@ struct hinic_port_qfilter_info {
 	u32 key;
 };
 
+struct hinic_port_tcam_info {
+	struct hinic_mgmt_msg_head mgmt_msg_head;
+
+	u16 func_id;
+	u8 tcam_enable;
+	u8 rsvd1;
+	u32 rsvd2;
+};
+
 #define HINIC_MAX_TCAM_RULES_NUM   (10240)
 #define HINIC_TCAM_BLOCK_ENABLE      1
 #define HINIC_TCAM_BLOCK_DISABLE     0
@@ -941,4 +950,6 @@ int hinic_set_fdir_tcam(void *hwdev, u16 type_mask,
 
 int hinic_flush_tcam_rule(void *hwdev);
 
+int hinic_set_fdir_tcam_rule_filter(void *hwdev, bool enable);
+
 #endif /* _HINIC_PMD_NICCFG_H_ */
diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c
index cc0744d..a7bad57 100644
--- a/drivers/net/hinic/hinic_pmd_flow.c
+++ b/drivers/net/hinic/hinic_pmd_flow.c
@@ -1900,6 +1900,8 @@ void hinic_free_fdir_filter(struct hinic_nic_dev *nic_dev)
 {
 	(void)hinic_set_fdir_filter(nic_dev->hwdev, 0, 0, 0, false);
 
+	(void)hinic_set_fdir_tcam_rule_filter(nic_dev->hwdev, false);
+
 	(void)hinic_clear_fdir_tcam(nic_dev->hwdev, TCAM_PKT_BGP_DPORT);
 
 	(void)hinic_clear_fdir_tcam(nic_dev->hwdev, TCAM_PKT_BGP_SPORT);
@@ -2801,6 +2803,15 @@ static int hinic_add_tcam_filter(struct rte_eth_dev *dev,
 						fdir_tcam_rule->index);
 			return rc;
 		}
+
+		rc = hinic_set_fdir_tcam_rule_filter(nic_dev->hwdev, true);
+		if (rc && rc != HINIC_MGMT_CMD_UNSUPPORTED) {
+			(void)hinic_set_fdir_filter(nic_dev->hwdev, 0, 0, 0,
+						false);
+			(void)hinic_del_tcam_rule(nic_dev->hwdev,
+						fdir_tcam_rule->index);
+			return rc;
+		}
 	}
 
 	TAILQ_INSERT_TAIL(&tcam_info->tcam_list, tcam_filter, entries);
@@ -3197,6 +3208,8 @@ static void hinic_clear_all_fdir_filter(struct rte_eth_dev *dev)
 
 	(void)hinic_set_fdir_filter(nic_dev->hwdev, 0, 0, 0, false);
 
+	(void)hinic_set_fdir_tcam_rule_filter(nic_dev->hwdev, false);
+
 	(void)hinic_flush_tcam_rule(nic_dev->hwdev);
 }
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v1 5/5] net/hinic/base: modify return errors
  2020-06-27  3:55 [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem Xiaoyun wang
                   ` (3 preceding siblings ...)
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 4/5] net/hinic: add tcam filter switch for FDIR Xiaoyun wang
@ 2020-06-27  3:55 ` Xiaoyun wang
  2020-07-07 19:42   ` Ferruh Yigit
  2020-07-03 16:22 ` [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem Ferruh Yigit
  5 siblings, 1 reply; 8+ messages in thread
From: Xiaoyun wang @ 2020-06-27  3:55 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bluca, luoxianjun, luoxingyu, zhouguoyang,
	yin.yinshi, david.yangxiaoliang, zhaohui8, zhengjingzhou,
	Xiaoyun wang

Modify return errors with linux system errors when
system requests fail.

Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 drivers/net/hinic/base/hinic_pmd_cfg.c    |   4 +-
 drivers/net/hinic/base/hinic_pmd_hwdev.c  |  16 ++---
 drivers/net/hinic/base/hinic_pmd_hwif.c   |   4 +-
 drivers/net/hinic/base/hinic_pmd_niccfg.c | 104 +++++++++++++++---------------
 drivers/net/hinic/base/hinic_pmd_nicio.c  |   6 +-
 5 files changed, 66 insertions(+), 68 deletions(-)

diff --git a/drivers/net/hinic/base/hinic_pmd_cfg.c b/drivers/net/hinic/base/hinic_pmd_cfg.c
index 2d25dc9..a0cc16d 100644
--- a/drivers/net/hinic/base/hinic_pmd_cfg.c
+++ b/drivers/net/hinic/base/hinic_pmd_cfg.c
@@ -179,7 +179,7 @@ static int get_cap_from_fw(struct hinic_hwdev *dev, enum func_type type)
 	if (err || dev_cap.mgmt_msg_head.status || !out_len) {
 		PMD_DRV_LOG(ERR, "Get capability from FW failed, err: %d, status: %d, out_len: %d",
 			err, dev_cap.mgmt_msg_head.status, out_len);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	parse_dev_cap(dev, &dev_cap, type);
@@ -201,7 +201,7 @@ static int get_cap_from_pf(struct hinic_hwdev *dev, enum func_type type)
 	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;
+		return -EIO;
 	}
 
 	parse_dev_cap(dev, &dev_cap, type);
diff --git a/drivers/net/hinic/base/hinic_pmd_hwdev.c b/drivers/net/hinic/base/hinic_pmd_hwdev.c
index a93f240..2af3bd9 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwdev.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwdev.c
@@ -475,7 +475,7 @@ static int wait_for_flr_finish(struct hinic_hwif *hwif)
 		rte_delay_ms(10);
 	} while (time_before(jiffies, end));
 
-	return -EFAULT;
+	return -ETIME;
 }
 
 #define HINIC_WAIT_CMDQ_IDLE_TIMEOUT		1000
@@ -681,17 +681,15 @@ int hinic_set_interrupt_cfg(struct hinic_hwdev *hwdev,
 	u16 out_size = sizeof(msix_cfg);
 	int err;
 
-	memset(&msix_cfg, 0, sizeof(msix_cfg));
-	msix_cfg.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
-	msix_cfg.func_id = hinic_global_func_id(hwdev);
-	msix_cfg.msix_index = (u16)interrupt_info.msix_index;
-
 	temp_info.msix_index = interrupt_info.msix_index;
-
 	err = hinic_get_interrupt_cfg(hwdev, &temp_info);
 	if (err)
-		return -EINVAL;
+		return -EIO;
 
+	memset(&msix_cfg, 0, sizeof(msix_cfg));
+	msix_cfg.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
+	msix_cfg.func_id = hinic_global_func_id(hwdev);
+	msix_cfg.msix_index = (u16)interrupt_info.msix_index;
 	msix_cfg.lli_credit_cnt = temp_info.lli_credit_limit;
 	msix_cfg.lli_tmier_cnt = temp_info.lli_timer_cfg;
 	msix_cfg.pending_cnt = temp_info.pending_limt;
@@ -1051,7 +1049,7 @@ int hinic_get_board_info(void *hwdev, struct hinic_board_info *info)
 	if (err || board_info.mgmt_msg_head.status || !out_size) {
 		PMD_DRV_LOG(ERR, "Failed to get board info, err: %d, status: 0x%x, out size: 0x%x",
 			err, board_info.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	memcpy(info, &board_info.info, sizeof(*info));
diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c
index 4578b68..a485cf0 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwif.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwif.c
@@ -321,7 +321,7 @@ int wait_until_doorbell_flush_states(struct hinic_hwif *hwif,
 		rte_delay_ms(1);
 	} while (time_before(jiffies, end));
 
-	return -EFAULT;
+	return -ETIME;
 }
 
 static int wait_until_doorbell_and_outbound_enabled(struct hinic_hwif *hwif)
@@ -343,7 +343,7 @@ static int wait_until_doorbell_and_outbound_enabled(struct hinic_hwif *hwif)
 		rte_delay_ms(1);
 	} while (time_before(jiffies, end));
 
-	return -EFAULT;
+	return -ETIME;
 }
 
 u16 hinic_global_func_id(void *hwdev)
diff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.c b/drivers/net/hinic/base/hinic_pmd_niccfg.c
index 67f6bc4..be6445d 100644
--- a/drivers/net/hinic/base/hinic_pmd_niccfg.c
+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.c
@@ -55,7 +55,7 @@ int hinic_init_function_table(void *hwdev, u16 rx_buf_sz)
 		PMD_DRV_LOG(ERR,
 			"Failed to init func table, err: %d, status: 0x%x, out size: 0x%x",
 			err, function_table.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	return 0;
@@ -96,7 +96,7 @@ int hinic_get_base_qpn(void *hwdev, u16 *global_qpn)
 		PMD_DRV_LOG(ERR,
 			"Failed to get base qpn, err: %d, status: 0x%x, out size: 0x%x",
 			err, cmd_qpn.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	*global_qpn = cmd_qpn.base_qpn;
@@ -143,7 +143,7 @@ int hinic_set_mac(void *hwdev, u8 *mac_addr, u16 vlan_id, u16 func_id)
 	    mac_info.mgmt_msg_head.status != HINIC_PF_SET_VF_ALREADY)) {
 		PMD_DRV_LOG(ERR, "Failed to set MAC, err: %d, status: 0x%x, out size: 0x%x",
 			err, mac_info.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	if (mac_info.mgmt_msg_head.status == HINIC_PF_SET_VF_ALREADY) {
@@ -198,7 +198,7 @@ int hinic_del_mac(void *hwdev, u8 *mac_addr, u16 vlan_id, u16 func_id)
 		mac_info.mgmt_msg_head.status != HINIC_PF_SET_VF_ALREADY)) {
 		PMD_DRV_LOG(ERR, "Failed to delete MAC, err: %d, status: 0x%x, out size: 0x%x",
 			err, mac_info.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 	if (mac_info.mgmt_msg_head.status == HINIC_PF_SET_VF_ALREADY) {
 		PMD_DRV_LOG(WARNING, "PF has already set vf mac, Ignore delete operation.");
@@ -241,7 +241,7 @@ int hinic_get_default_mac(void *hwdev, u8 *mac_addr)
 	if (err || !out_size || mac_info.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to get mac, err: %d, status: 0x%x, out size: 0x%x",
 			err, mac_info.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	memmove(mac_addr, mac_info.mac, ETH_ALEN);
@@ -294,7 +294,7 @@ int hinic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,
 	     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",
 			    err, mac_info.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 	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");
@@ -338,7 +338,7 @@ int hinic_set_port_mtu(void *hwdev, u32 new_mtu)
 	if (err || !out_size || mtu_info.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to set mtu, err: %d, status: 0x%x, out size: 0x%x",
 			err, mtu_info.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -386,7 +386,7 @@ int hinic_add_remove_vlan(void *hwdev, u16 vlan_id, u16 func_id, bool add)
 			"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;
+		return -EIO;
 	}
 
 	return 0;
@@ -432,7 +432,7 @@ int hinic_config_vlan_filter(void *hwdev, u32 vlan_filter_ctrl)
 			"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;
+		err = -EIO;
 	}
 
 	return err;
@@ -473,7 +473,7 @@ int hinic_set_rx_vlan_offload(void *hwdev, u8 en)
 		PMD_DRV_LOG(ERR,
 			"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;
+		return -EIO;
 	}
 
 	return 0;
@@ -512,7 +512,7 @@ int hinic_get_link_status(void *hwdev, u8 *link_state)
 	if (err || !out_size || get_link.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to get link state, err: %d, status: 0x%x, out size: 0x%x",
 			err, get_link.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	*link_state = get_link.link_status;
@@ -554,7 +554,7 @@ int hinic_set_vport_enable(void *hwdev, bool enable)
 	if (err || !out_size || en_state.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to set vport state, err: %d, status: 0x%x, out size: 0x%x",
 			err, en_state.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -596,7 +596,7 @@ int hinic_set_port_enable(void *hwdev, bool enable)
 	if (err || !out_size || en_state.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to set phy port state, err: %d, status: 0x%x, out size: 0x%x",
 			err, en_state.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -660,7 +660,7 @@ int hinic_set_pause_config(void *hwdev, struct nic_pause_config nic_pause)
 	if (err || !out_size || pause_info.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to set pause info, err: %d, status: 0x%x, out size: 0x%x",
 			err, pause_info.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -685,7 +685,7 @@ int hinic_get_pause_info(void *hwdev, struct nic_pause_config *nic_pause)
 	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;
+		return -EIO;
 	}
 
 	nic_pause->auto_neg = pause_info.auto_neg;
@@ -741,7 +741,7 @@ int hinic_dcb_set_ets(void *hwdev, u8 *up_tc, u8 *pg_bw,
 		PMD_DRV_LOG(ERR,
 			"Failed to set ets, err: %d, status: 0x%x, out size: 0x%x",
 			err, ets.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -773,7 +773,7 @@ int hinic_get_vport_stats(void *hwdev, struct hinic_vport_stats *stats)
 		PMD_DRV_LOG(ERR,
 			"Get vport stats from fw failed, err: %d, status: 0x%x, out size: 0x%x",
 			err, vport_stats_rsp.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	memcpy(stats, &vport_stats_rsp.stats, sizeof(*stats));
@@ -806,7 +806,7 @@ int hinic_get_phy_port_stats(void *hwdev, struct hinic_phy_port_stats *stats)
 		PMD_DRV_LOG(ERR,
 			"Failed to get port statistics, err: %d, status: 0x%x, out size: 0x%x",
 			err, port_stats_rsp.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	memcpy(stats, &port_stats_rsp.stats, sizeof(*stats));
@@ -863,7 +863,7 @@ int hinic_set_rss_type(void *hwdev, u32 tmpl_idx, struct nic_rss_type rss_type)
 
 	if (err || out_param != 0) {
 		PMD_DRV_LOG(ERR, "Failed to set rss context table");
-		return -EFAULT;
+		return -EIO;
 	}
 
 	return 0;
@@ -891,7 +891,7 @@ int hinic_get_rss_type(void *hwdev, u32 tmpl_idx, struct nic_rss_type *rss_type)
 		PMD_DRV_LOG(ERR,
 			"Failed to get hash type, err: %d, status: 0x%x, out size: 0x%x",
 			err, ctx_tbl.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	rss_type->ipv4 = HINIC_RSS_TYPE_GET(ctx_tbl.context, IPV4);
@@ -931,7 +931,7 @@ int hinic_rss_set_template_tbl(void *hwdev, u32 tmpl_idx, u8 *temp)
 		PMD_DRV_LOG(ERR,
 			"Failed to set hash key, err: %d, status: 0x%x, out size: 0x%x",
 			err, temp_key.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -959,7 +959,7 @@ int hinic_rss_get_template_tbl(void *hwdev, u32 tmpl_idx, u8 *temp)
 	if (err || !out_size || temp_key.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to get hash key, err: %d, status: 0x%x, out size: 0x%x",
 			err, temp_key.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	memcpy(temp, temp_key.key, HINIC_RSS_KEY_SIZE);
@@ -1004,7 +1004,7 @@ int hinic_rss_set_hash_engine(void *hwdev, u8 tmpl_idx, u8 type)
 	if (err || !out_size || hash_type.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to get hash engine, err: %d, status: 0x%x, out size: 0x%x",
 			err, hash_type.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -1055,7 +1055,7 @@ int hinic_rss_set_indir_tbl(void *hwdev, u32 tmpl_idx, u32 *indir_table)
 				     cmd_buf, &out_param, 0);
 	if (err || out_param != 0) {
 		PMD_DRV_LOG(ERR, "Failed to set rss indir table");
-		err = -EFAULT;
+		err = -EIO;
 		goto free_buf;
 	}
 
@@ -1069,7 +1069,7 @@ int hinic_rss_set_indir_tbl(void *hwdev, u32 tmpl_idx, u32 *indir_table)
 				     cmd_buf, &out_param, 0);
 	if (err || out_param != 0) {
 		PMD_DRV_LOG(ERR, "Failed to set rss indir table");
-		err = -EFAULT;
+		err = -EIO;
 	}
 
 free_buf:
@@ -1101,7 +1101,7 @@ int hinic_rss_get_indir_tbl(void *hwdev, u32 tmpl_idx, u32 *indir_table)
 	if (err || !out_size || rss_cfg.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to get indir table, err: %d, status: 0x%x, out size: 0x%x",
 			err, rss_cfg.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	hinic_be32_to_cpu(rss_cfg.indir, HINIC_RSS_INDIR_SIZE);
@@ -1139,7 +1139,7 @@ int hinic_rss_cfg(void *hwdev, u8 rss_en, u8 tmpl_idx, u8 tc_num, u8 *prio_tc)
 	if (err || !out_size || rss_cfg.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to set rss cfg, err: %d, status: 0x%x, out size: 0x%x",
 			err, rss_cfg.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -1180,7 +1180,7 @@ int hinic_rss_template_alloc(void *hwdev, u8 *tmpl_idx)
 	if (err || !out_size || template_mgmt.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to alloc rss template, err: %d, status: 0x%x, out size: 0x%x",
 			err, template_mgmt.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	*tmpl_idx = template_mgmt.template_id;
@@ -1223,7 +1223,7 @@ int hinic_rss_template_free(void *hwdev, u8 tmpl_idx)
 	if (err || !out_size || template_mgmt.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to free rss template, err: %d, status: 0x%x, out size: 0x%x",
 			err, template_mgmt.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -1296,7 +1296,7 @@ int hinic_set_rx_mode(void *hwdev, u32 enable)
 	if (err || !out_size || rx_mode_cfg.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to set rx mode, err: %d, status: 0x%x, out size: 0x%x",
 			err, rx_mode_cfg.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -1334,7 +1334,7 @@ int hinic_get_mgmt_version(void *hwdev, char *fw)
 	if (err || !out_size || fw_ver.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to get mgmt version, err: %d, status: 0x%x, out size: 0x%x\n",
 			err, fw_ver.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	snprintf(fw, HINIC_MGMT_VERSION_MAX_LEN, "%s", fw_ver.ver);
@@ -1365,7 +1365,7 @@ int hinic_set_rx_csum_offload(void *hwdev, u32 en)
 		PMD_DRV_LOG(ERR,
 			"Failed to set rx csum offload, err: %d, status: 0x%x, out size: 0x%x",
 			err, rx_csum_cfg.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -1395,7 +1395,7 @@ int hinic_set_rx_lro(void *hwdev, u8 ipv4_en, u8 ipv6_en, u8 max_wqe_num)
 	if (err || !out_size || lro_cfg.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to set lro offload, err: %d, status: 0x%x, out size: 0x%x",
 			err, lro_cfg.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -1427,7 +1427,7 @@ int hinic_set_anti_attack(void *hwdev, bool enable)
 		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;
+		return -EIO;
 	}
 
 	return 0;
@@ -1450,7 +1450,7 @@ int hinic_reset_port_link_cfg(void *hwdev)
 	if (err || !out_size || reset_cfg.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Reset port link configure failed, err: %d, status: 0x%x, out size: 0x%x",
 			err, reset_cfg.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	return 0;
@@ -1556,7 +1556,7 @@ int hinic_clear_vport_stats(struct hinic_hwdev *hwdev)
 	if (err || !out_size || clear_vport_stats.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to clear vport statistics, err: %d, status: 0x%x, out size: 0x%x",
 			err, clear_vport_stats.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -1586,7 +1586,7 @@ int hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev)
 		PMD_DRV_LOG(ERR, "Failed to clear phy port statistics, err: %d, status: 0x%x, out size: 0x%x",
 			err, clear_phy_port_stats.mgmt_msg_head.status,
 			out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -1623,7 +1623,7 @@ int hinic_set_link_status_follow(void *hwdev,
 		PMD_DRV_LOG(ERR,
 			"Failed to set link status follow phy port status, err: %d, status: 0x%x, out size: 0x%x",
 			err, follow.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	return follow.mgmt_msg_head.status;
@@ -1649,7 +1649,7 @@ int hinic_get_link_mode(void *hwdev, u32 *supported, u32 *advertised)
 		PMD_DRV_LOG(ERR,
 			"Failed to get link mode, err: %d, status: 0x%x, out size: 0x%x",
 			err, link_mode.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	*supported = link_mode.supported;
@@ -1690,7 +1690,7 @@ int hinic_set_xsfp_tx_status(void *hwdev, bool enable)
 			"Failed to %s port xsfp status, err: %d, status: 0x%x, out size: 0x%x\n",
 			enable ? "Disable" : "Enable", err,
 			xsfp_status.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	return 0;
@@ -1723,7 +1723,7 @@ int hinic_flush_qp_res(void *hwdev)
 	if (err || !out_size || qp_res.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Failed to clear sq resources, err: %d, status: 0x%x, out size: 0x%x",
 			err, qp_res.mgmt_msg_head.status, out_size);
-		return -EINVAL;
+		return -EIO;
 	}
 
 	return 0;
@@ -1808,7 +1808,7 @@ int hinic_set_fdir_filter(void *hwdev, u8 filter_type, u8 qid, u8 type_enable,
 			" enable: 0x%x, qid: 0x%x, filter_type_enable: 0x%x\n",
 			err, port_filer_cmd.mgmt_msg_head.status, out_size,
 			filter_type, enable, qid, type_enable);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	return 0;
@@ -1860,7 +1860,7 @@ int hinic_set_normal_filter(void *hwdev, u8 qid, u8 normal_type_enable,
 			" enable: 0x%x, qid: 0x%x, normal_type_enable: 0x%x, key:0x%x\n",
 			err, port_filer_cmd.mgmt_msg_head.status, out_size,
 			flag, enable, qid, normal_type_enable, key);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	return 0;
@@ -1908,7 +1908,7 @@ int hinic_set_fdir_tcam(void *hwdev, u16 type_mask,
 	if (err || !out_size || port_tcam_cmd.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Set tcam table failed, err: %d, status: 0x%x, out size: 0x%x",
 			err, port_tcam_cmd.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	return 0;
@@ -1945,7 +1945,7 @@ int hinic_clear_fdir_tcam(void *hwdev, u16 type_mask)
 	if (err || !out_size || port_tcam_cmd.mgmt_msg_head.status) {
 		PMD_DRV_LOG(ERR, "Clear tcam table failed, err: %d, status: 0x%x, out size: 0x%x",
 			err, port_tcam_cmd.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	return 0;
@@ -1964,7 +1964,7 @@ int hinic_add_tcam_rule(void *hwdev, struct tag_tcam_cfg_rule *tcam_rule)
 
 	if (tcam_rule->index >= HINIC_MAX_TCAM_RULES_NUM) {
 		PMD_DRV_LOG(ERR, "Tcam rules num to add is invalid");
-		return -EFAULT;
+		return -EINVAL;
 	}
 
 	memset(&tcam_cmd, 0, sizeof(struct tag_fdir_add_rule_cmd));
@@ -1979,7 +1979,7 @@ int hinic_add_tcam_rule(void *hwdev, struct tag_tcam_cfg_rule *tcam_rule)
 		PMD_DRV_LOG(ERR,
 			"Add tcam rule failed, err: %d, status: 0x%x, out size: 0x%x",
 			err, tcam_cmd.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	return 0;
@@ -1998,7 +1998,7 @@ int hinic_del_tcam_rule(void *hwdev, u32 index)
 
 	if (index >= HINIC_MAX_TCAM_RULES_NUM) {
 		PMD_DRV_LOG(ERR, "Tcam rules num to del is invalid");
-		return -EFAULT;
+		return -EINVAL;
 	}
 
 	memset(&tcam_cmd, 0, sizeof(struct tag_fdir_del_rule_cmd));
@@ -2013,7 +2013,7 @@ int hinic_del_tcam_rule(void *hwdev, u32 index)
 		PMD_DRV_LOG(ERR,
 			"Del tcam rule failed, err: %d, status: 0x%x, out size: 0x%x",
 			err, tcam_cmd.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	return 0;
@@ -2057,7 +2057,7 @@ static int hinic_mgmt_tcam_block(void *hwdev, u8 alloc_en,
 		PMD_DRV_LOG(ERR,
 			"Set tcam block failed, err: %d, status: 0x%x, out size: 0x%x",
 			err, tcam_block_info.mgmt_msg_head.status, out_size);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	if (alloc_en)
@@ -2108,7 +2108,7 @@ int hinic_flush_tcam_rule(void *hwdev)
 		PMD_DRV_LOG(ERR,
 			"Flush tcam fdir rules failed, err: %d, status: 0x%x, out size: 0x%x",
 			err, tcam_flush.mgmt_msg_head.status, out_size);
-		err = -EFAULT;
+		err = -EIO;
 	}
 
 	return err;
@@ -2143,7 +2143,7 @@ int hinic_set_fdir_tcam_rule_filter(void *hwdev, bool enable)
 			"status: 0x%x, out size: 0x%x, enable: 0x%x",
 			err, port_tcam_cmd.mgmt_msg_head.status, out_size,
 			enable);
-		return -EFAULT;
+		return -EIO;
 	}
 
 	if (port_tcam_cmd.mgmt_msg_head.status == HINIC_MGMT_CMD_UNSUPPORTED) {
diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c
index 7ec3e4c..2914e99 100644
--- a/drivers/net/hinic/base/hinic_pmd_nicio.c
+++ b/drivers/net/hinic/base/hinic_pmd_nicio.c
@@ -314,7 +314,7 @@ static int init_sq_ctxts(struct hinic_nic_io *nic_io)
 		if (err || out_param != 0) {
 			PMD_DRV_LOG(ERR, "Failed to set SQ ctxts, err: %d",
 				err);
-			err = -EFAULT;
+			err = -EIO;
 			break;
 		}
 
@@ -371,7 +371,7 @@ static int init_rq_ctxts(struct hinic_nic_io *nic_io)
 					     cmd_buf, &out_param, 0);
 		if ((err) || out_param != 0) {
 			PMD_DRV_LOG(ERR, "Failed to set RQ ctxts");
-			err = -EFAULT;
+			err = -EIO;
 			break;
 		}
 
@@ -422,7 +422,7 @@ static int clean_queue_offload_ctxt(struct hinic_nic_io *nic_io,
 
 	if ((err) || (out_param)) {
 		PMD_DRV_LOG(ERR, "Failed to clean queue offload ctxts");
-		err = -EFAULT;
+		err = -EIO;
 	}
 
 	hinic_free_cmd_buf(hwdev, cmd_buf);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem
  2020-06-27  3:55 [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem Xiaoyun wang
                   ` (4 preceding siblings ...)
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 5/5] net/hinic/base: modify return errors Xiaoyun wang
@ 2020-07-03 16:22 ` Ferruh Yigit
  5 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2020-07-03 16:22 UTC (permalink / raw)
  To: Xiaoyun wang, dev
  Cc: bluca, luoxianjun, luoxingyu, zhouguoyang, yin.yinshi,
	david.yangxiaoliang, zhaohui8, zhengjingzhou

On 6/27/2020 4:55 AM, Xiaoyun wang wrote:
> This patch adds multi-thread resource protection when 
> setting promiscuous or allmulticast mode, adds bufout
> and out size parameter for mgmt sync channel and removes
> unused parameters for mgmt channel with no ack, adds TCAM
> filter switch for FDIR, and modifies return errors.
> 
> --
> v1:
>   - add out parameter for mgmt sync channel
>   - remove unused parameter
>   - fix setting promiscuous mode problem
>   - add tcam filter switch for FDIR
>   - modify return errors
> 
> Xiaoyun wang (5):
>   net/hinic/base: add out parameter for mgmt sync channel
>   net/hinic/base: remove unused parameter
>   net/hinic: fix setting promiscuous mode problem
>   net/hinic: add tcam filter switch for FDIR
>   net/hinic/base: modify return errors

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v1 5/5] net/hinic/base: modify return errors
  2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 5/5] net/hinic/base: modify return errors Xiaoyun wang
@ 2020-07-07 19:42   ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2020-07-07 19:42 UTC (permalink / raw)
  To: Xiaoyun wang, dev
  Cc: bluca, luoxianjun, luoxingyu, zhouguoyang, yin.yinshi,
	david.yangxiaoliang, zhaohui8, zhengjingzhou

On 6/27/2020 4:55 AM, Xiaoyun wang wrote:
> Modify return errors with linux system errors when
> system requests fail.
> 
> Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>

<...>

> @@ -475,7 +475,7 @@ static int wait_for_flr_finish(struct hinic_hwif *hwif)
>  		rte_delay_ms(10);
>  	} while (time_before(jiffies, end));
>  
> -	return -EFAULT;
> +	return -ETIME;
>  }

Hi Xiaoyun,

'ETIME' is not defined in FreeBSD and was causing build error [1].
I have reverted the 'ETIME' changes in this patch (3 occurances) back.

Can you please do an incremental patch if 'EFAULT' errors needs to be replaced?

Thanks,
ferruh

[1]
http://mails.dpdk.org/archives/test-report/2020-July/142068.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-07-07 19:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27  3:55 [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem Xiaoyun wang
2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 1/5] net/hinic/base: add out parameter for mgmt sync channel Xiaoyun wang
2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 2/5] net/hinic/base: remove unused parameter Xiaoyun wang
2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 3/5] net/hinic: fix setting promiscuous mode problem Xiaoyun wang
2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 4/5] net/hinic: add tcam filter switch for FDIR Xiaoyun wang
2020-06-27  3:55 ` [dpdk-dev] [PATCH v1 5/5] net/hinic/base: modify return errors Xiaoyun wang
2020-07-07 19:42   ` Ferruh Yigit
2020-07-03 16:22 ` [dpdk-dev] [PATCH v1 0/5] fix promisc and tcam problem Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).