Skip to contentSkip to conversation

features for hns3 PMD

PATCH Superseded Min Hu (Connor) 2 participants 15 messages Jun 13, 2021 – Jul 13, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

cover features for hns3 PMD

This patch set contains 4 features for hns3 PMD:
add query basic info support for VF support for VF modify VLAN filter state support multiple TC MAC pause
supports disabling PFC by dev configure API

Chengchang Tang (2):
net/hns3: add query basic info support for VF net/hns3: support for VF modify VLAN filter state

Huisong Li (2):
net/hns3: support multiple TC MAC pause net/hns3: supports disabling PFC by dev configure API

 drivers/net/hns3/hns3_cmd.h       |  9 ++++
 drivers/net/hns3/hns3_dcb.c       | 61 +++++++++++++------------
 drivers/net/hns3/hns3_ethdev.c    |  5 +-
 drivers/net/hns3/hns3_ethdev.h    |  7 +++
 drivers/net/hns3/hns3_ethdev_vf.c | 96 ++++++++++++++++++++++++++++++---------
 drivers/net/hns3/hns3_mbx.h       | 11 ++++-
 6 files changed, 138 insertions(+), 51 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 net/hns3: add query basic info support for VF

From: Chengchang Tang <[email protected]>

There are some feautres of VF depend on PF, so it's necessary for VF to know whether current PF supports. Therefore, the final capability set of VF will be composed of the capability set of hardware and the capability set of PF.

For comatibility reasons, the mailbox HNS3_MBX_GET_TCINFO has been modified to obatin more basic information about the current PF, including the communication interface version and current PF capabilities set.

---
 drivers/net/hns3/hns3_ethdev.h    |  1 +
 drivers/net/hns3/hns3_ethdev_vf.c | 48 ++++++++++++++++++++++++---------------
 drivers/net/hns3/hns3_mbx.h       | 10 +++++++-
 3 files changed, 40 insertions(+), 19 deletions(-)
drivers/net/hns3/hns3_ethdev.h +1 -0
index 575bacd..ee84519 100644
@@ -488,6 +488,7 @@ struct hns3_hw {
 	struct hns3_rx_missed_stats imissed_stats;
 	uint64_t oerror_stats;
 	uint32_t fw_version;
+	uint16_t pf_vf_if_version;  /* version of communication interface */
 
 	uint16_t num_msi;
 	uint16_t total_tqps_num;    /* total task queue pairs of this PF */
drivers/net/hns3/hns3_ethdev_vf.c +30 -18

74 lines not on this page · raw message

drivers/net/hns3/hns3_mbx.h +9 -1
index 86d32e6..f07dbe3 100644
@@ -18,7 +18,7 @@ enum HNS3_MBX_OPCODE {
 	HNS3_MBX_API_NEGOTIATE,         /* (VF -> PF) negotiate API version */
 	HNS3_MBX_GET_QINFO,             /* (VF -> PF) get queue config */
 	HNS3_MBX_GET_QDEPTH,            /* (VF -> PF) get queue depth */
-	HNS3_MBX_GET_TCINFO,            /* (VF -> PF) get TC config */
+	HNS3_MBX_GET_BASIC_INFO,        /* (VF -> PF) get basic info */
 	HNS3_MBX_GET_RETA,              /* (VF -> PF) get RETA */
 	HNS3_MBX_GET_RSS_KEY,           /* (VF -> PF) get RSS key */
 	HNS3_MBX_GET_MAC_ADDR,          /* (VF -> PF) get MAC addr */
@@ -47,6 +47,14 @@ enum HNS3_MBX_OPCODE {
 	HNS3_MBX_PUSH_LINK_STATUS = 201, /* (IMP -> PF) get port link status */
 };
 
+struct hns3_basic_info {
+	uint8_t hw_tc_map;
+	uint8_t rsv;
+	uint16_t pf_vf_if_version;
+	/* capabilities of VF dependent on PF */
+	uint32_t caps;
+};
+
 /* below are per-VF mac-vlan subcodes */
 enum hns3_mbx_mac_vlan_subcode {
 	HNS3_MBX_MAC_VLAN_UC_MODIFY = 0,        /* modify UC mac addr */
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 net/hns3: support for VF modify VLAN filter state

In reply to Min Hu (Connor)

From: Chengchang Tang <[email protected]>

Since the HW limitation for VF, the VLAN filter is default enabled, and is not allowed to be closed. Now, the limitation has been removed in Kunpeng930 network engine, so this patch add support for VF to modify the VLAN filter state.

A capabilities bit is added to differentiate between different platforms and achieve compatibility. When the VF runs on an incomatible platform or an incompatible kernel-mode driver version is used, the VF behavior is the same as that before.

---
 drivers/net/hns3/hns3_cmd.h       |  9 ++++++++
 drivers/net/hns3/hns3_ethdev.h    |  4 ++++
 drivers/net/hns3/hns3_ethdev_vf.c | 48 ++++++++++++++++++++++++++++++++++++---
 drivers/net/hns3/hns3_mbx.h       |  1 +
 4 files changed, 59 insertions(+), 3 deletions(-)
drivers/net/hns3/hns3_cmd.h +9 -0
index eafa365..a762158 100644
@@ -321,6 +321,15 @@ enum HNS3_CAPS_BITS {
 	HNS3_CAPS_RXD_ADV_LAYOUT_B = 15,
 };
 
+/* Capabilities of VF dependent on the PF */
+enum HNS3VF_CAPS_BITS {
+	/*
+	 * The following capability index definitions must be the same as those
+	 * in kernel side PF.
+	 */
+	HNS3VF_CAPS_VLAN_FLT_MOD_B = 0,
+};
+
 enum HNS3_API_CAP_BITS {
 	HNS3_API_CAP_FLEX_RSS_TBL_B,
 };
drivers/net/hns3/hns3_ethdev.h +4 -0
index ee84519..b8347c2 100644
@@ -869,8 +869,12 @@ enum {
 	HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B,
 	HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B,
 	HNS3_DEV_SUPPORT_RAS_IMP_B,
+	HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B,
 };
 
+#define hns3_dev_vf_vlan_flt_supported(hw) \
+		hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B)
+
 #define hns3_dev_dcb_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B)
 
drivers/net/hns3/hns3_ethdev_vf.c +45 -3

79 lines not on this page · raw message

drivers/net/hns3/hns3_mbx.h +1 -0
index f07dbe3..f868e33 100644
@@ -71,6 +71,7 @@ enum hns3_mbx_vlan_cfg_subcode {
 	HNS3_MBX_VLAN_TX_OFF_CFG,               /* set tx side vlan offload */
 	HNS3_MBX_VLAN_RX_OFF_CFG,               /* set rx side vlan offload */
 	HNS3_MBX_GET_PORT_BASE_VLAN_STATE = 4,  /* get port based vlan state */
+	HNS3_MBX_ENABLE_VLAN_FILTER,            /* set vlan filter state */
 };
 
 enum hns3_mbx_tbl_cfg_subcode {
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/4 net/hns3: support multiple TC MAC pause

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

MAC PAUSE can take effect on a single TC or multiple TCs, depending on the hardware. For example, the Kunpeng 920 supports MAC pause in a single TC, and the Kunpeng 930 supports MAC pause in multiple TCs. This patch supports MAC PAUSE in multiple TC for some hardware.

---
 drivers/net/hns3/hns3_ethdev.c | 5 ++++-
 drivers/net/hns3/hns3_ethdev.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/hns3/hns3_ethdev.c +4 -1
index e515125..17b995a 100644
@@ -3317,6 +3317,7 @@ hns3_get_capability(struct hns3_hw *hw)
 		pf->tqp_config_mode = HNS3_FIXED_MAX_TQP_NUM_MODE;
 		hw->rss_info.ipv6_sctp_offload_supported = false;
 		hw->udp_cksum_mode = HNS3_SPECIAL_PORT_SW_CKSUM_MODE;
+		pf->support_multi_tc_pause = false;
 		return 0;
 	}
 
@@ -3337,6 +3338,7 @@ hns3_get_capability(struct hns3_hw *hw)
 	pf->tqp_config_mode = HNS3_FLEX_MAX_TQP_NUM_MODE;
 	hw->rss_info.ipv6_sctp_offload_supported = true;
 	hw->udp_cksum_mode = HNS3_SPECIAL_PORT_HW_CKSUM_MODE;
+	pf->support_multi_tc_pause = true;
 
 	return 0;
 }
@@ -6103,6 +6105,7 @@ static int
 hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	int ret;
 
 	if (fc_conf->high_water || fc_conf->low_water ||
@@ -6132,7 +6135,7 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		return -EOPNOTSUPP;
 	}
 
-	if (hw->num_tc > 1) {
+	if (hw->num_tc > 1 && !pf->support_multi_tc_pause) {
 		hns3_err(hw, "in multi-TC scenarios, MAC pause is not supported.");
 		return -EOPNOTSUPP;
 	}
drivers/net/hns3/hns3_ethdev.h +1 -0
index b8347c2..5f448af 100644
@@ -783,6 +783,7 @@ struct hns3_pf {
 	uint8_t prio_tc[HNS3_MAX_USER_PRIO]; /* TC indexed by prio */
 	uint16_t pause_time;
 	bool support_fc_autoneg;       /* support FC autonegotiate */
+	bool support_multi_tc_pause;
 
 	uint16_t wanted_umv_size;
 	uint16_t max_umv_size;
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/4 net/hns3: supports disabling PFC by dev configure API

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

If "dcb_capability_en" in "data->dev_conf" delivered from the dev_configure does not have the ETH_DCB_PFC_SUPPORT flag, the user wants to disable PFC, and only enable ETS. Therefore, this patch supports the function of disabling PFC by the field. In addition, this patch updates "current_fc_status" of the driver based on the flow control mode requested by user so as to enable the flow control mode in multi-TC scenarios.

---
 drivers/net/hns3/hns3_dcb.c    | 61 +++++++++++++++++++++++-------------------
 drivers/net/hns3/hns3_ethdev.h |  1 +
 2 files changed, 34 insertions(+), 28 deletions(-)
drivers/net/hns3/hns3_dcb.c +33 -28
index 90c0d04..234a3e8 100644
@@ -1427,10 +1427,12 @@ hns3_dcb_cfg_validate(struct hns3_adapter *hns, uint8_t *tc, bool *changed)
 	 * We ensure that dcb information can be reconfigured
 	 * after the hns3_priority_flow_ctrl_set function called.
 	 */
-	if (hw->requested_fc_mode != HNS3_FC_FULL)
+	if (hw->requested_fc_mode != HNS3_FC_FULL ||
+		hw->requested_fc_mode != HNS3_FC_NONE)
 		*changed = true;
 	pfc_en = RTE_LEN2MASK((uint8_t)dcb_rx_conf->nb_tcs, uint8_t);
-	if (hw->dcb_info.pfc_en != pfc_en)
+	if (hw->dcb_info.pfc_en != pfc_en || hw->dcb_info.dcb_capability_en !=
+		hw->data->dev_conf.dcb_capability_en)
 		*changed = true;
 
 	/* tx/rx queue number is reconfigured. */
@@ -1567,36 +1569,32 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)
 		hw->dcb_info.hw_pfc_map =
 				hns3_dcb_undrop_tc_map(hw, hw->dcb_info.pfc_en);
 
-		ret = hns3_buffer_alloc(hw);
-		if (ret)
-			goto buffer_alloc_fail;
-
 		hw->current_fc_status = HNS3_FC_STATUS_PFC;
 		hw->requested_fc_mode = HNS3_FC_FULL;
-		ret = hns3_dcb_pause_setup_hw(hw);
-		if (ret) {
-			hns3_err(hw, "setup pfc failed! ret = %d", ret);
-			goto pfc_setup_fail;
-		}
 	} else {
-		/*
-		 * Although dcb_capability_en is lack of ETH_DCB_PFC_SUPPORT
-		 * flag, the DCB information is configured, such as tc numbers.
-		 * Therefore, refreshing the allocation of packet buffer is
-		 * necessary.
-		 */
-		ret = hns3_buffer_alloc(hw);
-		if (ret)
-			return ret;
+		hw->current_fc_status = HNS3_FC_STATUS_NONE;
+		hw->requested_fc_mode = HNS3_FC_NONE;
+		hw->dcb_info.pfc_en = 0;
+		hw->dcb_info.hw_pfc_map = 0;
 	}
 
+	ret = hns3_buffer_alloc(hw);
+	if (ret)
+		goto cfg_fail;
+
+	ret = hns3_dcb_pause_setup_hw(hw);
+	if (ret) {
+		hns3_err(hw, "setup pfc failed! ret = %d", ret);
+		goto cfg_fail;
+	}
+
+	hw->dcb_info.dcb_capability_en = hw->data->dev_conf.dcb_capability_en;
+
 	return 0;
 
-pfc_setup_fail:
+cfg_fail:
 	hw->requested_fc_mode = requested_fc_mode;
 	hw->current_fc_status = fc_status;
-
-buffer_alloc_fail:
 	hw->dcb_info.pfc_en = pfc_en;
 	hw->dcb_info.hw_pfc_map = hw_pfc_map;
 
@@ -1781,15 +1779,21 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)
 	uint16_t pause_time = pf->pause_time;
 	int ret;
 
-	pf->pause_time = pfc_conf->fc.pause_time;
-	hns3_get_fc_mode(hw, pfc_conf->fc.mode);
-	hw->current_fc_status = HNS3_FC_STATUS_PFC;
 	hw->dcb_info.pfc_en |= BIT(priority);
 	hw->dcb_info.hw_pfc_map =
 			hns3_dcb_undrop_tc_map(hw, hw->dcb_info.pfc_en);
 	ret = hns3_buffer_alloc(hw);
-	if (ret)
-		goto pfc_setup_fail;
+	if (ret) {
+		hns3_err(hw, "update packet buffer failed, ret = %d", ret);
+		goto buffer_alloc_fail;
+	}
+
+	pf->pause_time = pfc_conf->fc.pause_time;
+	hns3_get_fc_mode(hw, pfc_conf->fc.mode);
+	if (hw->requested_fc_mode == HNS3_FC_NONE)
+		hw->current_fc_status = HNS3_FC_STATUS_NONE;
+	else
+		hw->current_fc_status = HNS3_FC_STATUS_PFC;
 
 	/*
 	 * The flow control mode of all UPs will be changed based on
@@ -1807,6 +1811,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)
 	hw->requested_fc_mode = old_fc_mode;
 	hw->current_fc_status = fc_status;
 	pf->pause_time = pause_time;
+buffer_alloc_fail:
 	hw->dcb_info.pfc_en = pfc_en;
 	hw->dcb_info.hw_pfc_map = hw_pfc_map;
 
drivers/net/hns3/hns3_ethdev.h +1 -0
index 5f448af..7ff8762 100644
@@ -139,6 +139,7 @@ struct hns3_dcb_info {
 	struct hns3_tc_info tc_info[HNS3_MAX_TC_NUM];
 	uint8_t hw_pfc_map; /* Allow for packet drop or not on this TC */
 	uint8_t pfc_en; /* Pfc enabled or not for user priority */
+	uint32_t dcb_capability_en;
 };
 
 enum hns3_fc_status {
Signature · 1 line
2.7.4
#5 lore raw

Re: [dpdk-dev] [PATCH 4/4] net/hns3: supports disabling PFC by dev configure API

Quoted 11 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

If "dcb_capability_en" in "data->dev_conf" delivered from the dev_configure does not have the ETH_DCB_PFC_SUPPORT flag, the user wants to disable PFC, and only enable ETS. Therefore, this patch supports the function of disabling PFC by the field. In addition, this patch updates "current_fc_status" of the driver based on the flow control mode requested by user so as to enable the flow control mode in multi-TC scenarios.

It looks like Clang 12 on Fedora 12 does not like the patch and build fails. Please, take a look and fix it.

#6 lore raw
In reply to Min Hu (Connor)
Quoted 14 lines · Min Hu (Connor)

This patch set contains 4 features for hns3 PMD:
add query basic info support for VF support for VF modify VLAN filter state support multiple TC MAC pause
supports disabling PFC by dev configure API

Chengchang Tang (2):
net/hns3: add query basic info support for VF net/hns3: support for VF modify VLAN filter state

Huisong Li (2):
net/hns3: support multiple TC MAC pause net/hns3: supports disabling PFC by dev configure API

Quoted 8 lines
  drivers/net/hns3/hns3_cmd.h       |  9 ++++
  drivers/net/hns3/hns3_dcb.c       | 61 +++++++++++++------------
  drivers/net/hns3/hns3_ethdev.c    |  5 +-
  drivers/net/hns3/hns3_ethdev.h    |  7 +++
  drivers/net/hns3/hns3_ethdev_vf.c | 96 ++++++++++++++++++++++++++++++---------
  drivers/net/hns3/hns3_mbx.h       | 11 ++++-
  6 files changed, 138 insertions(+), 51 deletions(-)

Overall LGTM, but build breakage must be fixed.

#7 lore raw

Thanks Andrew,
"net/hns3: supports disabling PFC by dev configure API" this patch could be abandoned.

The other three can be applied.

Quoted 27 lines · Andrew Rybchenko
Quoted 14 lines · Min Hu (Connor)

This patch set contains 4 features for hns3 PMD:
add query basic info support for VF support for VF modify VLAN filter state support multiple TC MAC pause
supports disabling PFC by dev configure API

Chengchang Tang (2):
   net/hns3: add query basic info support for VF net/hns3: support for VF modify VLAN filter state

Huisong Li (2):
   net/hns3: support multiple TC MAC pause net/hns3: supports disabling PFC by dev configure API

Quoted 9 lines

  drivers/net/hns3/hns3_cmd.h       |  9 ++++ drivers/net/hns3/hns3_dcb.c       | 61 +++++++++++++------------ drivers/net/hns3/hns3_ethdev.c    |  5 +- drivers/net/hns3/hns3_ethdev.h    |  7 +++ drivers/net/hns3/hns3_ethdev_vf.c | 96
++++++++++++++++++++++++++++++---------
  drivers/net/hns3/hns3_mbx.h       | 11 ++++-

  6 files changed, 138 insertions(+), 51 deletions(-)

Overall LGTM, but build breakage must be fixed.
.

#8 lore raw
Quoted 4 lines · Min Hu (Connor)

Thanks Andrew,
"net/hns3: supports disabling PFC by dev configure API" this patch could be abandoned.

Quoted 31 lines

The other three can be applied.

Quoted 27 lines · Andrew Rybchenko
Quoted 14 lines · Min Hu (Connor)

This patch set contains 4 features for hns3 PMD:
add query basic info support for VF support for VF modify VLAN filter state support multiple TC MAC pause
supports disabling PFC by dev configure API

Chengchang Tang (2):
   net/hns3: add query basic info support for VF net/hns3: support for VF modify VLAN filter state

Huisong Li (2):
   net/hns3: support multiple TC MAC pause net/hns3: supports disabling PFC by dev configure API

Quoted 9 lines

  drivers/net/hns3/hns3_cmd.h       |  9 ++++ drivers/net/hns3/hns3_dcb.c       | 61 +++++++++++++------------ drivers/net/hns3/hns3_ethdev.c    |  5 +- drivers/net/hns3/hns3_ethdev.h    |  7 +++ drivers/net/hns3/hns3_ethdev_vf.c | 96
++++++++++++++++++++++++++++++---------
  drivers/net/hns3/hns3_mbx.h       | 11 ++++-

  6 files changed, 138 insertions(+), 51 deletions(-)

Overall LGTM, but build breakage must be fixed.
.

Please, send a new version with the patch dropped. I'd like patchwork automation to check it once again.

#9 lore raw
Quoted 34 lines · Andrew Rybchenko
Quoted 33 lines · Min Hu (Connor)

Thanks Andrew,
"net/hns3: supports disabling PFC by dev configure API" this patch could be abandoned.

The other three can be applied.

Quoted 25 lines · Andrew Rybchenko
Quoted 23 lines · Min Hu (Connor)

This patch set contains 4 features for hns3 PMD:
add query basic info support for VF support for VF modify VLAN filter state support multiple TC MAC pause
supports disabling PFC by dev configure API

Chengchang Tang (2):
   net/hns3: add query basic info support for VF net/hns3: support for VF modify VLAN filter state

Huisong Li (2):
   net/hns3: support multiple TC MAC pause net/hns3: supports disabling PFC by dev configure API

   drivers/net/hns3/hns3_cmd.h       |  9 ++++
   drivers/net/hns3/hns3_dcb.c       | 61 +++++++++++++------------
   drivers/net/hns3/hns3_ethdev.c    |  5 +-
   drivers/net/hns3/hns3_ethdev.h    |  7 +++
   drivers/net/hns3/hns3_ethdev_vf.c | 96
++++++++++++++++++++++++++++++---------
   drivers/net/hns3/hns3_mbx.h       | 11 ++++-
   6 files changed, 138 insertions(+), 51 deletions(-)
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Overall LGTM, but build breakage must be fixed.
.

Please, send a new version with the patch dropped. I'd like patchwork automation to check it once again.

Hi, v2 has been sent, please check it out.

Quoted 2 lines

.

#10 lore raw

v2 cover features for hns3 PMD

In reply to Min Hu (Connor)

This patchset contains 3 features for hns3 PMD:
add query basic info support for VF
support for VF modify VLAN filter state
support multiple TC MAC pause

Chengchang Tang (2):
net/hns3: add query basic info support for VF net/hns3: support for VF modify VLAN filter state

Huisong Li (1):
net/hns3: support multiple TC MAC pause
---
v2:
* Abandon the last patch "supports disabling PFC by dev configure API".

 drivers/net/hns3/hns3_cmd.h       |  9 ++++
 drivers/net/hns3/hns3_ethdev.c    |  5 +-
 drivers/net/hns3/hns3_ethdev.h    |  6 +++
 drivers/net/hns3/hns3_ethdev_vf.c | 96 ++++++++++++++++++++++++++++++---------
 drivers/net/hns3/hns3_mbx.h       | 11 ++++-
 5 files changed, 104 insertions(+), 23 deletions(-)
Signature · 1 line
2.7.4
#11 lore raw

PATCH v2 1/3 net/hns3: add query basic info support for VF

From: Chengchang Tang <[email protected]>

There are some feautres of VF depend on PF, so it's necessary for VF to know whether current PF supports. Therefore, the final capability set of VF will be composed of the capability set of hardware and the capability set of PF.

For comatibility reasons, the mailbox HNS3_MBX_GET_TCINFO has been modified to obatin more basic information about the current PF, including the communication interface version and current PF capabilities set.

---
 drivers/net/hns3/hns3_ethdev.h    |  1 +
 drivers/net/hns3/hns3_ethdev_vf.c | 48 ++++++++++++++++++++++++---------------
 drivers/net/hns3/hns3_mbx.h       | 10 +++++++-
 3 files changed, 40 insertions(+), 19 deletions(-)
drivers/net/hns3/hns3_ethdev.h +1 -0
index 87baa3c..a9a199a 100644
@@ -488,6 +488,7 @@ struct hns3_hw {
 	struct hns3_rx_missed_stats imissed_stats;
 	uint64_t oerror_stats;
 	uint32_t fw_version;
+	uint16_t pf_vf_if_version;  /* version of communication interface */
 
 	uint16_t num_msi;
 	uint16_t total_tqps_num;    /* total task queue pairs of this PF */
drivers/net/hns3/hns3_ethdev_vf.c +30 -18

74 lines not on this page · raw message

drivers/net/hns3/hns3_mbx.h +9 -1
index 86d32e6..f07dbe3 100644
@@ -18,7 +18,7 @@ enum HNS3_MBX_OPCODE {
 	HNS3_MBX_API_NEGOTIATE,         /* (VF -> PF) negotiate API version */
 	HNS3_MBX_GET_QINFO,             /* (VF -> PF) get queue config */
 	HNS3_MBX_GET_QDEPTH,            /* (VF -> PF) get queue depth */
-	HNS3_MBX_GET_TCINFO,            /* (VF -> PF) get TC config */
+	HNS3_MBX_GET_BASIC_INFO,        /* (VF -> PF) get basic info */
 	HNS3_MBX_GET_RETA,              /* (VF -> PF) get RETA */
 	HNS3_MBX_GET_RSS_KEY,           /* (VF -> PF) get RSS key */
 	HNS3_MBX_GET_MAC_ADDR,          /* (VF -> PF) get MAC addr */
@@ -47,6 +47,14 @@ enum HNS3_MBX_OPCODE {
 	HNS3_MBX_PUSH_LINK_STATUS = 201, /* (IMP -> PF) get port link status */
 };
 
+struct hns3_basic_info {
+	uint8_t hw_tc_map;
+	uint8_t rsv;
+	uint16_t pf_vf_if_version;
+	/* capabilities of VF dependent on PF */
+	uint32_t caps;
+};
+
 /* below are per-VF mac-vlan subcodes */
 enum hns3_mbx_mac_vlan_subcode {
 	HNS3_MBX_MAC_VLAN_UC_MODIFY = 0,        /* modify UC mac addr */
Signature · 1 line
2.7.4
#12 lore raw

PATCH v2 2/3 net/hns3: support for VF modify VLAN filter state

In reply to Min Hu (Connor)

From: Chengchang Tang <[email protected]>

Since the HW limitation for VF, the VLAN filter is default enabled, and is not allowed to be closed. Now, the limitation has been removed in Kunpeng930 network engine, so this patch add support for VF to modify the VLAN filter state.

A capabilities bit is added to differentiate between different platforms and achieve compatibility. When the VF runs on an incomatible platform or an incompatible kernel-mode driver version is used, the VF behavior is the same as that before.

---
 drivers/net/hns3/hns3_cmd.h       |  9 ++++++++
 drivers/net/hns3/hns3_ethdev.h    |  4 ++++
 drivers/net/hns3/hns3_ethdev_vf.c | 48 ++++++++++++++++++++++++++++++++++++---
 drivers/net/hns3/hns3_mbx.h       |  1 +
 4 files changed, 59 insertions(+), 3 deletions(-)
drivers/net/hns3/hns3_cmd.h +9 -0
index 0c9b8fc..88683df 100644
@@ -325,6 +325,15 @@ enum HNS3_CAPS_BITS {
 	HNS3_CAPS_TM_B = 17,
 };
 
+/* Capabilities of VF dependent on the PF */
+enum HNS3VF_CAPS_BITS {
+	/*
+	 * The following capability index definitions must be the same as those
+	 * in kernel side PF.
+	 */
+	HNS3VF_CAPS_VLAN_FLT_MOD_B = 0,
+};
+
 enum HNS3_API_CAP_BITS {
 	HNS3_API_CAP_FLEX_RSS_TBL_B,
 };
drivers/net/hns3/hns3_ethdev.h +4 -0
index a9a199a..729e1c3 100644
@@ -870,6 +870,7 @@ enum {
 	HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B,
 	HNS3_DEV_SUPPORT_RAS_IMP_B,
 	HNS3_DEV_SUPPORT_TM_B,
+	HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B,
 };
 
 #define hns3_dev_dcb_supported(hw) \
@@ -909,6 +910,9 @@ enum {
 #define hns3_dev_tm_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TM_B)
 
+#define hns3_dev_vf_vlan_flt_supported(hw) \
+	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B)
+
 #define HNS3_DEV_PRIVATE_TO_HW(adapter) \
 	(&((struct hns3_adapter *)adapter)->hw)
 #define HNS3_DEV_PRIVATE_TO_PF(adapter) \
drivers/net/hns3/hns3_ethdev_vf.c +45 -3

79 lines not on this page · raw message

drivers/net/hns3/hns3_mbx.h +1 -0
index f07dbe3..f868e33 100644
@@ -71,6 +71,7 @@ enum hns3_mbx_vlan_cfg_subcode {
 	HNS3_MBX_VLAN_TX_OFF_CFG,               /* set tx side vlan offload */
 	HNS3_MBX_VLAN_RX_OFF_CFG,               /* set rx side vlan offload */
 	HNS3_MBX_GET_PORT_BASE_VLAN_STATE = 4,  /* get port based vlan state */
+	HNS3_MBX_ENABLE_VLAN_FILTER,            /* set vlan filter state */
 };
 
 enum hns3_mbx_tbl_cfg_subcode {
Signature · 1 line
2.7.4
#13 lore raw

PATCH v2 3/3 net/hns3: support multiple TC MAC pause

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

MAC PAUSE can take effect on a single TC or multiple TCs, depending on the hardware. For example, the Kunpeng 920 supports MAC pause in a single TC, and the Kunpeng 930 supports MAC pause in multiple TCs. This patch supports MAC PAUSE in multiple TC for some hardware.

---
 drivers/net/hns3/hns3_ethdev.c | 5 ++++-
 drivers/net/hns3/hns3_ethdev.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/hns3/hns3_ethdev.c +4 -1
index e515125..17b995a 100644
@@ -3317,6 +3317,7 @@ hns3_get_capability(struct hns3_hw *hw)
 		pf->tqp_config_mode = HNS3_FIXED_MAX_TQP_NUM_MODE;
 		hw->rss_info.ipv6_sctp_offload_supported = false;
 		hw->udp_cksum_mode = HNS3_SPECIAL_PORT_SW_CKSUM_MODE;
+		pf->support_multi_tc_pause = false;
 		return 0;
 	}
 
@@ -3337,6 +3338,7 @@ hns3_get_capability(struct hns3_hw *hw)
 	pf->tqp_config_mode = HNS3_FLEX_MAX_TQP_NUM_MODE;
 	hw->rss_info.ipv6_sctp_offload_supported = true;
 	hw->udp_cksum_mode = HNS3_SPECIAL_PORT_HW_CKSUM_MODE;
+	pf->support_multi_tc_pause = true;
 
 	return 0;
 }
@@ -6103,6 +6105,7 @@ static int
 hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	int ret;
 
 	if (fc_conf->high_water || fc_conf->low_water ||
@@ -6132,7 +6135,7 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		return -EOPNOTSUPP;
 	}
 
-	if (hw->num_tc > 1) {
+	if (hw->num_tc > 1 && !pf->support_multi_tc_pause) {
 		hns3_err(hw, "in multi-TC scenarios, MAC pause is not supported.");
 		return -EOPNOTSUPP;
 	}
drivers/net/hns3/hns3_ethdev.h +1 -0
index 729e1c3..3485614 100644
@@ -783,6 +783,7 @@ struct hns3_pf {
 	uint8_t prio_tc[HNS3_MAX_USER_PRIO]; /* TC indexed by prio */
 	uint16_t pause_time;
 	bool support_fc_autoneg;       /* support FC autonegotiate */
+	bool support_multi_tc_pause;
 
 	uint16_t wanted_umv_size;
 	uint16_t max_umv_size;
Signature · 1 line
2.7.4
#14 lore raw
In reply to Min Hu (Connor)
Quoted 15 lines · Min Hu (Connor)

This patchset contains 3 features for hns3 PMD:
add query basic info support for VF
support for VF modify VLAN filter state
support multiple TC MAC pause

Chengchang Tang (2):
net/hns3: add query basic info support for VF net/hns3: support for VF modify VLAN filter state

Huisong Li (1):
net/hns3: support multiple TC MAC pause
---
v2:
* Abandon the last patch "supports disabling PFC by dev configure API".

Quoted 7 lines
 drivers/net/hns3/hns3_cmd.h       |  9 ++++
 drivers/net/hns3/hns3_ethdev.c    |  5 +-
 drivers/net/hns3/hns3_ethdev.h    |  6 +++
 drivers/net/hns3/hns3_ethdev_vf.c | 96 ++++++++++++++++++++++++++++++---------
 drivers/net/hns3/hns3_mbx.h       | 11 ++++-
 5 files changed, 104 insertions(+), 23 deletions(-)

Applied, thanks.