Skip to contentSkip to conversation

support full function of DCF

PATCH Superseded Kevin Liu 2 participants 170 messages Apr 7, 2022 – May 11, 2022 Network drivers Page 2 of 2

lore
Share & tools
lore
author
#144 lore raw

PATCH v6 7/12 net/ice: support dcf MAC configuration

In reply to Kevin Liu

Below PMD ops are supported in this patch:

    .mac_addr_add      = dcf_dev_add_mac_addr
    .mac_addr_remove   = dcf_dev_del_mac_addr
    .set_mc_addr_list  = dcf_set_mc_addr_list
    .mac_addr_set      = dcf_dev_set_default_mac_addr
---
 doc/guides/nics/features/ice_dcf.ini   |   1 +
 doc/guides/rel_notes/release_22_07.rst |   1 +
 drivers/net/ice/ice_dcf.c              |   9 +-
 drivers/net/ice/ice_dcf.h              |   4 +-
 drivers/net/ice/ice_dcf_ethdev.c       | 218 ++++++++++++++++++++++++-
 drivers/net/ice/ice_dcf_ethdev.h       |   5 +-
 6 files changed, 228 insertions(+), 10 deletions(-)
doc/guides/nics/features/ice_dcf.ini +1 -0
index fe3ada8733..c9bdbcd6cc 100644
@@ -20,6 +20,7 @@ RSS key update       = Y
 MTU update           = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
+Unicast MAC filter   = Y
 Basic stats          = Y
 Linux                = Y
 x86-32               = Y
doc/guides/rel_notes/release_22_07.rst +1 -0
index c7ba4453ff..e29ec16720 100644
@@ -68,6 +68,7 @@ New Features
  * Added add ops MTU-SET to dcf.
  * Added add ops dev-supported-ptypes-get to dcf.
  * Added support dcf promisc configuration.
+ * Added support dcf MAC configuration.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf.c +5 -4
index 89c0203ba3..55ae68c456 100644
@@ -1089,10 +1089,11 @@ ice_dcf_query_stats(struct ice_dcf_hw *hw,
 }
 
 int
-ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
+ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw,
+			     struct rte_ether_addr *addr,
+			     bool add, uint8_t type)
 {
 	struct virtchnl_ether_addr_list *list;
-	struct rte_ether_addr *addr;
 	struct dcf_virtchnl_cmd args;
 	int len, err = 0;
 
@@ -1105,7 +1106,6 @@ ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
 	}
 
 	len = sizeof(struct virtchnl_ether_addr_list);
-	addr = hw->eth_dev->data->mac_addrs;
 	len += sizeof(struct virtchnl_ether_addr);
 
 	list = rte_zmalloc(NULL, len, 0);
@@ -1116,9 +1116,10 @@ ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
 
 	rte_memcpy(list->list[0].addr, addr->addr_bytes,
 			sizeof(addr->addr_bytes));
+
 	PMD_DRV_LOG(DEBUG, "add/rm mac:" RTE_ETHER_ADDR_PRT_FMT,
 			    RTE_ETHER_ADDR_BYTES(addr));
-
+	list->list[0].type = type;
 	list->vsi_id = hw->vsi_res->vsi_id;
 	list->num_elements = 1;
 
drivers/net/ice/ice_dcf.h +3 -1
index f0b45af5ae..78df202a77 100644
@@ -131,7 +131,9 @@ int ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on);
 int ice_dcf_disable_queues(struct ice_dcf_hw *hw);
 int ice_dcf_query_stats(struct ice_dcf_hw *hw,
 			struct virtchnl_eth_stats *pstats);
-int ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add);
+int ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw,
+				 struct rte_ether_addr *addr, bool add,
+				 uint8_t type);
 int ice_dcf_link_update(struct rte_eth_dev *dev,
 		    __rte_unused int wait_to_complete);
 void ice_dcf_tm_conf_init(struct rte_eth_dev *dev);
drivers/net/ice/ice_dcf_ethdev.c +215 -3

259 lines not on this page · raw message

drivers/net/ice/ice_dcf_ethdev.h +3 -2
index 22e450527b..27f6402786 100644
@@ -14,7 +14,7 @@
 #include "ice_dcf.h"
 
 #define ICE_DCF_MAX_RINGS  1
-
+#define DCF_NUM_MACADDR_MAX	64
 #define ICE_DCF_FRAME_SIZE_MAX       9728
 #define ICE_DCF_VLAN_TAG_SIZE               4
 #define ICE_DCF_ETH_OVERHEAD \
@@ -35,7 +35,8 @@ struct ice_dcf_adapter {
 
 	bool promisc_unicast_enabled;
 	bool promisc_multicast_enabled;
-
+	uint32_t mc_addrs_num;
+	struct rte_ether_addr mc_addrs[DCF_NUM_MACADDR_MAX];
 	int num_reprs;
 	struct ice_dcf_repr_info *repr_infos;
 };
Signature · 1 line
2.33.1
author
#145 lore raw

PATCH v6 8/12 net/ice: support dcf VLAN filter and offload configuration

In reply to Kevin Liu

From: Alvin Zhang <[email protected]>

Below PMD ops are supported in this patch:
.vlan_filter_set = dcf_dev_vlan_filter_set
.vlan_offload_set = dcf_dev_vlan_offload_set

---
 doc/guides/nics/features/ice_dcf.ini   |   2 +
 doc/guides/rel_notes/release_22_07.rst |   1 +
 drivers/net/ice/ice_dcf_ethdev.c       | 101 +++++++++++++++++++++++++
 3 files changed, 104 insertions(+)
doc/guides/nics/features/ice_dcf.ini +2 -0
index c9bdbcd6cc..01e7527915 100644
@@ -21,6 +21,8 @@ MTU update           = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
+VLAN filter          = Y
+VLAN offload         = Y
 Basic stats          = Y
 Linux                = Y
 x86-32               = Y
doc/guides/rel_notes/release_22_07.rst +1 -0
index e29ec16720..268f3bba9a 100644
@@ -69,6 +69,7 @@ New Features
  * Added add ops dev-supported-ptypes-get to dcf.
  * Added support dcf promisc configuration.
  * Added support dcf MAC configuration.
+ * Added support dcf VLAN filter and offload configuration.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf_ethdev.c +101 -0

113 lines not on this page · raw message

Signature · 1 line
2.33.1
author
#146 lore raw

PATCH v6 9/12 net/ice: add extended stats

In reply to Kevin Liu

Add implementation of xstats() functions in DCF PMD.

---
 doc/guides/nics/features/ice_dcf.ini   |  1 +
 doc/guides/rel_notes/release_22_07.rst |  1 +
 drivers/net/ice/ice_dcf.h              | 22 ++++++++
 drivers/net/ice/ice_dcf_ethdev.c       | 75 ++++++++++++++++++++++++++
 4 files changed, 99 insertions(+)
doc/guides/nics/features/ice_dcf.ini +1 -0
index 01e7527915..54ea7f150c 100644
@@ -23,6 +23,7 @@ Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
 VLAN offload         = Y
+Extended stats       = Y
 Basic stats          = Y
 Linux                = Y
 x86-32               = Y
doc/guides/rel_notes/release_22_07.rst +1 -0
index 268f3bba9a..1f404a6ee5 100644
@@ -70,6 +70,7 @@ New Features
  * Added support dcf promisc configuration.
  * Added support dcf MAC configuration.
  * Added support dcf VLAN filter and offload configuration.
+ * Added add extended stats.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf.h +22 -0
index 78df202a77..44a61404c3 100644
@@ -15,6 +15,12 @@
 #include "base/ice_type.h"
 #include "ice_logs.h"
 
+/* ICE_DCF_DEV_PRIVATE_TO */
+#define ICE_DCF_DEV_PRIVATE_TO_ADAPTER(adapter) \
+	((struct ice_dcf_adapter *)adapter)
+#define ICE_DCF_DEV_PRIVATE_TO_VF(adapter) \
+	(&((struct ice_dcf_adapter *)adapter)->vf)
+
 struct dcf_virtchnl_cmd {
 	TAILQ_ENTRY(dcf_virtchnl_cmd) next;
 
@@ -74,6 +80,22 @@ struct ice_dcf_tm_conf {
 	bool committed;
 };
 
+struct ice_dcf_eth_stats {
+	u64 rx_bytes;			/* gorc */
+	u64 rx_unicast;			/* uprc */
+	u64 rx_multicast;		/* mprc */
+	u64 rx_broadcast;		/* bprc */
+	u64 rx_discards;		/* rdpc */
+	u64 rx_unknown_protocol;	/* rupp */
+	u64 tx_bytes;			/* gotc */
+	u64 tx_unicast;			/* uptc */
+	u64 tx_multicast;		/* mptc */
+	u64 tx_broadcast;		/* bptc */
+	u64 tx_discards;		/* tdpc */
+	u64 tx_errors;			/* tepc */
+	u64 rx_no_desc;			/* repc */
+	u64 rx_errors;			/* repc */
+};
 struct ice_dcf_hw {
 	struct iavf_hw avf;
 
drivers/net/ice/ice_dcf_ethdev.c +75 -0

93 lines not on this page · raw message

Signature · 1 line
2.33.1
author
#147 lore raw

PATCH v6 10/12 net/ice: support queue information getting

In reply to Kevin Liu

Add below ops,
rxq_info_get
txq_info_get

---
 doc/guides/rel_notes/release_22_07.rst | 1 +
 drivers/net/ice/ice_dcf_ethdev.c       | 2 ++
 2 files changed, 3 insertions(+)
doc/guides/rel_notes/release_22_07.rst +1 -0
index 1f404a6ee5..0d6577cd74 100644
@@ -71,6 +71,7 @@ New Features
  * Added support dcf MAC configuration.
  * Added support dcf VLAN filter and offload configuration.
  * Added add extended stats.
+ * Added support queue information getting.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf_ethdev.c +2 -0
index 6503700e02..9217392d04 100644
@@ -1698,6 +1698,8 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = {
 	.tx_queue_start           = ice_dcf_tx_queue_start,
 	.rx_queue_stop            = ice_dcf_rx_queue_stop,
 	.tx_queue_stop            = ice_dcf_tx_queue_stop,
+	.rxq_info_get             = ice_rxq_info_get,
+	.txq_info_get             = ice_txq_info_get,
 	.link_update              = ice_dcf_link_update,
 	.stats_get                = ice_dcf_stats_get,
 	.stats_reset              = ice_dcf_stats_reset,
Signature · 1 line
2.33.1
author
#148 lore raw

PATCH v6 11/12 net/ice: implement power management

In reply to Kevin Liu

Implement support for the power management API by implementing a 'get_monitor_addr' function that will return an address of an RX ring's status bit.

---
 doc/guides/nics/features/ice_dcf.ini   | 1 +
 doc/guides/rel_notes/release_22_07.rst | 1 +
 drivers/net/ice/ice_dcf_ethdev.c       | 1 +
 3 files changed, 3 insertions(+)
doc/guides/nics/features/ice_dcf.ini +1 -0
index 54ea7f150c..3b11622d4c 100644
@@ -25,6 +25,7 @@ VLAN filter          = Y
 VLAN offload         = Y
 Extended stats       = Y
 Basic stats          = Y
+Power mgmt address monitor = Y
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
doc/guides/rel_notes/release_22_07.rst +1 -0
index 0d6577cd74..004a6d3343 100644
@@ -72,6 +72,7 @@ New Features
  * Added support dcf VLAN filter and offload configuration.
  * Added add extended stats.
  * Added support queue information getting.
+ * Added implement power management.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf_ethdev.c +1 -0
index 9217392d04..236c0395e0 100644
@@ -1700,6 +1700,7 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = {
 	.tx_queue_stop            = ice_dcf_tx_queue_stop,
 	.rxq_info_get             = ice_rxq_info_get,
 	.txq_info_get             = ice_txq_info_get,
+	.get_monitor_addr         = ice_get_monitor_addr,
 	.link_update              = ice_dcf_link_update,
 	.stats_get                = ice_dcf_stats_get,
 	.stats_reset              = ice_dcf_stats_reset,
Signature · 1 line
2.33.1
author
#149 lore raw

PATCH v6 12/12 net/ice: support DCF new VLAN capabilities

In reply to Kevin Liu

From: Alvin Zhang <[email protected]>

The new VLAN virtchnl opcodes introduce new capabilities like VLAN filtering, stripping and insertion.

The DCF needs to query the VLAN capabilities based on current device configuration firstly.

DCF is able to configure inner VLAN filter when port VLAN is enabled base on negotiation; and DCF is able to configure outer VLAN (0x8100) if port VLAN is disabled to be compatible with legacy mode.

When port VLAN is updated by DCF, the DCF needs to reset to query the new VLAN capabilities.

---
 doc/guides/rel_notes/release_22_07.rst |   1 +
 drivers/net/ice/ice_dcf.c              |  27 ++++
 drivers/net/ice/ice_dcf.h              |   1 +
 drivers/net/ice/ice_dcf_ethdev.c       | 171 ++++++++++++++++++++++---
 4 files changed, 183 insertions(+), 17 deletions(-)
doc/guides/rel_notes/release_22_07.rst +1 -0
index 004a6d3343..7c932a7c8a 100644
@@ -73,6 +73,7 @@ New Features
  * Added add extended stats.
  * Added support queue information getting.
  * Added implement power management.
+ * Added support DCF new VLAN capabilities.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf.c +27 -0
index 55ae68c456..885d58c0f4 100644
@@ -587,6 +587,29 @@ ice_dcf_get_supported_rxdid(struct ice_dcf_hw *hw)
 	return 0;
 }
 
+static int
+dcf_get_vlan_offload_caps_v2(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_vlan_caps vlan_v2_caps;
+	struct dcf_virtchnl_cmd args;
+	int ret;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS;
+	args.rsp_msgbuf = (uint8_t *)&vlan_v2_caps;
+	args.rsp_buflen = sizeof(vlan_v2_caps);
+
+	ret = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (ret) {
+		PMD_DRV_LOG(ERR,
+			    "Failed to execute command of VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS");
+		return ret;
+	}
+
+	rte_memcpy(&hw->vlan_v2_caps, &vlan_v2_caps, sizeof(vlan_v2_caps));
+	return 0;
+}
+
 int
 ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 {
@@ -701,6 +724,10 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	rte_intr_enable(pci_dev->intr_handle);
 	ice_dcf_enable_irq0(hw);
 
+	if ((hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) &&
+	    dcf_get_vlan_offload_caps_v2(hw))
+		goto err_rss;
+
 	return 0;
 
 err_rss:
drivers/net/ice/ice_dcf.h +1 -0
index 44a61404c3..7f42ebabe9 100644
@@ -129,6 +129,7 @@ struct ice_dcf_hw {
 	uint16_t nb_msix;
 	uint16_t rxq_map[16];
 	struct virtchnl_eth_stats eth_stats_offset;
+	struct virtchnl_vlan_caps vlan_v2_caps;
 
 	/* Link status */
 	bool link_up;
drivers/net/ice/ice_dcf_ethdev.c +154 -17

196 lines not on this page · raw message

Signature · 1 line
2.33.1
#150 lore raw

RE: [PATCH v6 12/12] net/ice: support DCF new VLAN capabilities

Quoted 41 lines

-----Original Message-----
From: Liu, KevinX <[email protected]>
Sent: Thursday, April 28, 2022 2:13 AM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Yang, SteveX <[email protected]>; Alvin Zhang <[email protected]>; Liu, KevinX <[email protected]>
Subject: [PATCH v6 12/12] net/ice: support DCF new VLAN capabilities

From: Alvin Zhang <[email protected]>

The new VLAN virtchnl opcodes introduce new capabilities like VLAN filtering, stripping and insertion.

The DCF needs to query the VLAN capabilities based on current device configuration firstly.

DCF is able to configure inner VLAN filter when port VLAN is enabled base on negotiation; and DCF is able to configure outer VLAN (0x8100) if port VLAN is disabled to be compatible with legacy mode.

When port VLAN is updated by DCF, the DCF needs to reset to query the new VLAN capabilities.

---
 doc/guides/rel_notes/release_22_07.rst |   1 +
 drivers/net/ice/ice_dcf.c              |  27 ++++
 drivers/net/ice/ice_dcf.h              |   1 +
 drivers/net/ice/ice_dcf_ethdev.c       | 171 ++++++++++++++++++++++---
 4 files changed, 183 insertions(+), 17 deletions(-)
doc/guides/rel_notes/release_22_07.rst +0 -0
index 004a6d3343..7c932a7c8a 100644

doc/guides/rel_notes/release_22_07.rst New Features · line 76

Quoted 4 lines
doc/guides/rel_notes/release_22_07.rst +1 -0
@@ -73,6 +73,7 @@ New Features
  * Added add extended stats.
  * Added support queue information getting.
  * Added implement power management.
+ * Added support DCF new VLAN capabilities.

This feature is not exposed to user, no need release note update.

Quoted 267 lines
doc/guides/rel_notes/release_22_07.rst +0 -0
 Removed Items
 -------------
drivers/net/ice/ice_dcf.c index renamed from drivers/net/ice/ice_dcf.c +0 -0

55ae68c456..885d58c0f4 100644

drivers/net/ice/ice_dcf.c +22 -0
@@ -587,6 +587,29 @@ ice_dcf_get_supported_rxdid(struct ice_dcf_hw *hw)
 	return 0;
 }
 
+static int
+dcf_get_vlan_offload_caps_v2(struct ice_dcf_hw *hw) {
+	struct virtchnl_vlan_caps vlan_v2_caps;
+	struct dcf_virtchnl_cmd args;
+	int ret;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS;
+	args.rsp_msgbuf = (uint8_t *)&vlan_v2_caps;
+	args.rsp_buflen = sizeof(vlan_v2_caps);
+
+	ret = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (ret) {
+		PMD_DRV_LOG(ERR,
+			    "Failed to execute command of
 VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS");
+		return ret;
+	}
+
+	rte_memcpy(&hw->vlan_v2_caps, &vlan_v2_caps,
 sizeof(vlan_v2_caps));
+	return 0;
+}
+
 int
 ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)  { @@ -

701,6 +724,10 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)

drivers/net/ice/ice_dcf.c +1 -0
 	rte_intr_enable(pci_dev->intr_handle);
 	ice_dcf_enable_irq0(hw);
 
+	if ((hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2)

&&

drivers/net/ice/ice_dcf.c +3 -0
+	    dcf_get_vlan_offload_caps_v2(hw))
+		goto err_rss;
+
 	return 0;
 
 err_rss:
drivers/net/ice/ice_dcf.h index renamed from drivers/net/ice/ice_dcf.h +0 -0

44a61404c3..7f42ebabe9 100644

drivers/net/ice/ice_dcf.h +1 -0
@@ -129,6 +129,7 @@ struct ice_dcf_hw {
 	uint16_t nb_msix;
 	uint16_t rxq_map[16];
 	struct virtchnl_eth_stats eth_stats_offset;
+	struct virtchnl_vlan_caps vlan_v2_caps;
 
 	/* Link status */
 	bool link_up;
drivers/net/ice/ice_dcf_ethdev.c +39 -0
index 236c0395e0..8005eb2ab8 100644
@@ -1050,6 +1050,46 @@ dcf_dev_set_default_mac_addr(struct
 rte_eth_dev *dev,
 	return 0;
 }
 
+static int
+dcf_add_del_vlan_v2(struct ice_dcf_hw *hw, uint16_t vlanid, bool add) {
+	struct virtchnl_vlan_supported_caps *supported_caps =
+			&hw->vlan_v2_caps.filtering.filtering_support;
+	struct virtchnl_vlan *vlan_setting;
+	struct virtchnl_vlan_filter_list_v2 vlan_filter;
+	struct dcf_virtchnl_cmd args;
+	uint32_t filtering_caps;
+	int err;
+
+	if (supported_caps->outer) {
+		filtering_caps = supported_caps->outer;
+		vlan_setting = &vlan_filter.filters[0].outer;
+	} else {
+		filtering_caps = supported_caps->inner;
+		vlan_setting = &vlan_filter.filters[0].inner;
+	}
+
+	if (!(filtering_caps & VIRTCHNL_VLAN_ETHERTYPE_8100))
+		return -ENOTSUP;
+
+	memset(&vlan_filter, 0, sizeof(vlan_filter));
+	vlan_filter.vport_id = hw->vsi_res->vsi_id;
+	vlan_filter.num_elements = 1;
+	vlan_setting->tpid = RTE_ETHER_TYPE_VLAN;
+	vlan_setting->tci = vlanid;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = add ? VIRTCHNL_OP_ADD_VLAN_V2 :
 VIRTCHNL_OP_DEL_VLAN_V2;
+	args.req_msg = (uint8_t *)&vlan_filter;
+	args.req_msglen = sizeof(vlan_filter);
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command %s",
+			    add ? "OP_ADD_VLAN_V2" :  "OP_DEL_VLAN_V2");
+
+	return err;
+}
+
 static int
 dcf_add_del_vlan(struct ice_dcf_hw *hw, uint16_t vlanid, bool add)  { @@ -

1076,6 +1116,116 @@ dcf_add_del_vlan(struct ice_dcf_hw *hw, uint16_t vlanid, bool add)

drivers/net/ice/ice_dcf_ethdev.c +56 -0
 	return err;
 }
 
+static int
+dcf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int
+on) {
+	struct ice_dcf_adapter *adapter = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &adapter->real_hw;
+	int err;
+
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) {
+		err = dcf_add_del_vlan_v2(hw, vlan_id, on);
+		if (err)
+			return -EIO;
+		return 0;
+	}
+
+	if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
+		return -ENOTSUP;
+
+	err = dcf_add_del_vlan(hw, vlan_id, on);
+	if (err)
+		return -EIO;
+	return 0;
+}
+
+static void
+dcf_iterate_vlan_filters_v2(struct rte_eth_dev *dev, bool enable) {
+	struct rte_vlan_filter_conf *vfc = &dev->data->vlan_filter_conf;
+	struct ice_dcf_adapter *adapter = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &adapter->real_hw;
+	uint32_t i, j;
+	uint64_t ids;
+
+	for (i = 0; i < RTE_DIM(vfc->ids); i++) {
+		if (vfc->ids[i] == 0)
+			continue;
+
+		ids = vfc->ids[i];
+		for (j = 0; ids != 0 && j < 64; j++, ids >>= 1) {
+			if (ids & 1)
+				dcf_add_del_vlan_v2(hw, 64 * i + j, enable);
+		}
+	}
+}
+
+static int
+dcf_config_vlan_strip_v2(struct ice_dcf_hw *hw, bool enable) {
+	struct virtchnl_vlan_supported_caps *stripping_caps =
+			&hw->vlan_v2_caps.offloads.stripping_support;
+	struct virtchnl_vlan_setting vlan_strip;
+	struct dcf_virtchnl_cmd args;
+	uint32_t *ethertype;
+	int ret;
+
+	if ((stripping_caps->outer & VIRTCHNL_VLAN_ETHERTYPE_8100) &&
+	    (stripping_caps->outer & VIRTCHNL_VLAN_TOGGLE))
+		ethertype = &vlan_strip.outer_ethertype_setting;
+	else if ((stripping_caps->inner & VIRTCHNL_VLAN_ETHERTYPE_8100)

&&

drivers/net/ice/ice_dcf_ethdev.c +18 -0
+		 (stripping_caps->inner & VIRTCHNL_VLAN_TOGGLE))
+		ethertype = &vlan_strip.inner_ethertype_setting;
+	else
+		return -ENOTSUP;
+
+	memset(&vlan_strip, 0, sizeof(vlan_strip));
+	vlan_strip.vport_id = hw->vsi_res->vsi_id;
+	*ethertype = VIRTCHNL_VLAN_ETHERTYPE_8100;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = enable ? VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2 :
+			    VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2;
+	args.req_msg = (uint8_t *)&vlan_strip;
+	args.req_msglen = sizeof(vlan_strip);
+	ret = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (ret)
+		PMD_DRV_LOG(ERR, "fail to execute command %s",
+			    enable ?

"VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2" :
+
"VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2");

drivers/net/ice/ice_dcf_ethdev.c +14 -0
+
+	return ret;
+}
+
+static int
+dcf_dev_vlan_offload_set_v2(struct rte_eth_dev *dev, int mask) {
+	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
+	struct ice_dcf_adapter *adapter = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &adapter->real_hw;
+	bool enable;
+	int err;
+
+	if (mask & RTE_ETH_VLAN_FILTER_MASK) {
+		enable = !!(rxmode->offloads &

RTE_ETH_RX_OFFLOAD_VLAN_FILTER);

drivers/net/ice/ice_dcf_ethdev.c +6 -0
+
+		dcf_iterate_vlan_filters_v2(dev, enable);
+	}
+
+	if (mask & RTE_ETH_VLAN_STRIP_MASK) {
+		enable = !!(rxmode->offloads &

RTE_ETH_RX_OFFLOAD_VLAN_STRIP);

drivers/net/ice/ice_dcf_ethdev.c +12 -0
+
+		err = dcf_config_vlan_strip_v2(hw, enable);
+		/* If not support, the stripping is already disabled by PF */
+		if (err == -ENOTSUP && !enable)
+			err = 0;
+		if (err)
+			return -EIO;
+	}
+
+	return 0;
+}
+
 static int
 dcf_enable_vlan_strip(struct ice_dcf_hw *hw)  { @@ -1108,30 +1258,17 @@

dcf_disable_vlan_strip(struct ice_dcf_hw *hw)

drivers/net/ice/ice_dcf_ethdev.c +4 -17
 	return ret;
 }
 
-static int
-dcf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) -{
-	struct ice_dcf_adapter *adapter = dev->data->dev_private;
-	struct ice_dcf_hw *hw = &adapter->real_hw;
-	int err;
-
-	if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
-		return -ENOTSUP;
-
-	err = dcf_add_del_vlan(hw, vlan_id, on);
-	if (err)
-		return -EIO;
-	return 0;
-}
-
 static int
 dcf_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)  {
+	struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
 	struct ice_dcf_adapter *adapter = dev->data->dev_private;
 	struct ice_dcf_hw *hw = &adapter->real_hw;
-	struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
 	int err;
 
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2)
+		return dcf_dev_vlan_offload_set_v2(dev, mask);
+
 	if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
 		return -ENOTSUP;
 
--

2.33.1

author
#151 lore raw

v7 cover complete common VF features for DCF

In reply to Kevin Liu

The DCF PMD support the below dev ops,
dev_supported_ptypes_get
dev_link_update
xstats_get
xstats_get_names
xstats_reset
promiscuous_enable
promiscuous_disable
allmulticast_enable
allmulticast_disable
mac_addr_add
mac_addr_remove
set_mc_addr_list
vlan_filter_set
vlan_offload_set
mac_addr_set
reta_update
reta_query
rss_hash_update
rss_hash_conf_get
rxq_info_get
txq_info_get
mtu_set
tx_done_cleanup
get_monitor_addr

v7:
* Update release note and patch title.

v6:
* add patch:
1.net/ice: support DCF new VLAN capabilities
* remove patch:
1.doc: update for ice DCF datapath configuration
* Split doc into specific patch.

v5:
* remove patch:
1.complete common VF features for DCF
2.net/ice: enable CVL DCF device reset API 3.net/ice: support IPv6 NVGRE tunnel
4.net/ice: support new pattern of IPv4
5.net/ice: treat unknown package as OS default package 6.net/ice: handle virtchnl event message without interrupt 7.net/ice: add DCF request queues function 8.net/ice: negotiate large VF and request more queues 9.net/ice: enable multiple queues configurations for large VF 10.net/ice: enable IRQ mapping configuration for large VF 11.net/ice: add enable/disable queues for DCF large VF

v4:
* remove patch:
1.testpmd: force flow flush
2.net/ice: fix DCF ACL flow engine 3.net/ice: fix DCF reset
* add patch:
1.net/ice: add extended stats 2.net/ice: support queue information getting 3.net/ice: implement power management 4.doc: update for ice DCF datapath configuration

v3:
* remove patch:
1.net/ice/base: add VXLAN support for switch filter 2.net/ice: add VXLAN support for switch filter 3.common/iavf: support flushing rules and reporting DCF id 4.net/ice/base: fix ethertype filter input set 5.net/ice/base: support IPv6 GRE UDP pattern 6.net/ice/base: support new patterns of TCP and UDP 7.net/ice: support new patterns of TCP and UDP 8.net/ice/base: support IPv4 GRE tunnel 9.net/ice: support IPv4 GRE raw pattern type 10.net/ice/base: update Profile ID table for VXLAN 11.net/ice/base: update Protocol ID table to match DVM DDP

v2:
* remove patch:
1.net/iavf: support checking if device is an MDCF instance 2.net/ice: support MDCF(multi-DCF) instance 3.net/ice/base: support custom DDP buildin recipe 4.net/ice: support buildin recipe configuration 5.net/ice/base: support custom ddp package version 6.net/ice: disable ACL function for MDCF instance

Alvin Zhang (3):
net/ice: support dcf promisc configuration net/ice: support dcf VLAN filter and offload configuration net/ice: support DCF new VLAN capabilities

Jie Wang (2):
net/ice: support for MTU configure in DCF mode net/ice: add ops dev-supported-ptypes-get to dcf

Kevin Liu (4):
net/ice: support dcf MAC configuration
net/ice: add extended stats
net/ice: support queue information getting
net/ice: add implement power management

Robin Zhang (1):
net/ice: support cleanup Tx buffers in DCF mode

Steve Yang (2):
net/ice: support for RSS RETA configure in DCF mode net/ice: support for RSS HASH configure in DCF mode

 doc/guides/nics/features/ice_dcf.ini   |  10 +
 doc/guides/rel_notes/release_22_07.rst |   8 +
 drivers/net/ice/ice_dcf.c              |  40 +-
 drivers/net/ice/ice_dcf.h              |  29 +-
 drivers/net/ice/ice_dcf_ethdev.c       | 820 ++++++++++++++++++++++++-
 drivers/net/ice/ice_dcf_ethdev.h       |  10 +
 6 files changed, 879 insertions(+), 38 deletions(-)
Signature · 1 line
2.33.1
author
#152 lore raw

PATCH v7 1/12 net/ice: support for RSS RETA configure in DCF mode

From: Steve Yang <[email protected]>

RSS RETA should be updated and queried by application, Add related ops ('.reta_update', '.reta_query') for DCF.

---
 doc/guides/nics/features/ice_dcf.ini   |  1 +
 doc/guides/rel_notes/release_22_07.rst |  3 +
 drivers/net/ice/ice_dcf.c              |  2 +-
 drivers/net/ice/ice_dcf.h              |  1 +
 drivers/net/ice/ice_dcf_ethdev.c       | 77 ++++++++++++++++++++++++++
 5 files changed, 83 insertions(+), 1 deletion(-)
doc/guides/nics/features/ice_dcf.ini +1 -0
index 54073f0b88..5221c99a9c 100644
@@ -15,6 +15,7 @@ L3 checksum offload  = P
 L4 checksum offload  = P
 Inner L3 checksum    = P
 Inner L4 checksum    = P
+RSS reta update      = Y
 Basic stats          = Y
 Linux                = Y
 x86-32               = Y
doc/guides/rel_notes/release_22_07.rst +3 -0
index 90123bb807..1f07d3e1b3 100644
@@ -60,6 +60,9 @@ New Features
   * Added Tx QoS queue rate limitation support.
   * Added quanta size configuration support.
 
+* **Updated Intel ice driver.**
+
+ * Added support for RSS RETA configure in DCF mode.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf.c +1 -1
index 7f0c074b01..070d1b71ac 100644
@@ -790,7 +790,7 @@ ice_dcf_configure_rss_key(struct ice_dcf_hw *hw)
 	return err;
 }
 
-static int
+int
 ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw)
 {
 	struct virtchnl_rss_lut *rss_lut;
drivers/net/ice/ice_dcf.h +1 -0
index 6ec766ebda..b2c6aa2684 100644
@@ -122,6 +122,7 @@ int ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,
 int ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw);
 int ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw);
 void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw);
+int ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw);
 int ice_dcf_init_rss(struct ice_dcf_hw *hw);
 int ice_dcf_configure_queues(struct ice_dcf_hw *hw);
 int ice_dcf_config_irq_map(struct ice_dcf_hw *hw);
drivers/net/ice/ice_dcf_ethdev.c +77 -0

89 lines not on this page · raw message

Signature · 1 line
2.33.1
author
#153 lore raw

PATCH v7 2/12 net/ice: support for RSS HASH configure in DCF mode

In reply to Kevin Liu

From: Steve Yang <[email protected]>

RSS HASH should be updated and queried by application, Add related ops ('.rss_hash_update', '.rss_hash_conf_get') for DCF.

Because DCF doesn't support configure RSS HASH, only HASH key can be updated within ops '.rss_hash_update'.

---
 doc/guides/nics/features/ice_dcf.ini   |  1 +
 doc/guides/rel_notes/release_22_07.rst |  1 +
 drivers/net/ice/ice_dcf.c              |  2 +-
 drivers/net/ice/ice_dcf.h              |  1 +
 drivers/net/ice/ice_dcf_ethdev.c       | 51 ++++++++++++++++++++++++++
 5 files changed, 55 insertions(+), 1 deletion(-)
doc/guides/nics/features/ice_dcf.ini +1 -0
index 5221c99a9c..d9c1b25407 100644
@@ -16,6 +16,7 @@ L4 checksum offload  = P
 Inner L3 checksum    = P
 Inner L4 checksum    = P
 RSS reta update      = Y
+RSS key update       = Y
 Basic stats          = Y
 Linux                = Y
 x86-32               = Y
doc/guides/rel_notes/release_22_07.rst +1 -0
index 1f07d3e1b3..866af8c0b3 100644
@@ -63,6 +63,7 @@ New Features
 * **Updated Intel ice driver.**
 
  * Added support for RSS RETA configure in DCF mode.
+ * Added support for RSS HASH configure in DCF mode.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf.c +1 -1
index 070d1b71ac..89c0203ba3 100644
@@ -758,7 +758,7 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	hw->ets_config = NULL;
 }
 
-static int
+int
 ice_dcf_configure_rss_key(struct ice_dcf_hw *hw)
 {
 	struct virtchnl_rss_key *rss_key;
drivers/net/ice/ice_dcf.h +1 -0
index b2c6aa2684..f0b45af5ae 100644
@@ -122,6 +122,7 @@ int ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,
 int ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw);
 int ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw);
 void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw);
+int ice_dcf_configure_rss_key(struct ice_dcf_hw *hw);
 int ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw);
 int ice_dcf_init_rss(struct ice_dcf_hw *hw);
 int ice_dcf_configure_queues(struct ice_dcf_hw *hw);
drivers/net/ice/ice_dcf_ethdev.c +51 -0

63 lines not on this page · raw message

Signature · 1 line
2.33.1
author
#154 lore raw

PATCH v7 3/12 net/ice: support cleanup Tx buffers in DCF mode

In reply to Kevin Liu

From: Robin Zhang <[email protected]>

Add support for ops rte_eth_tx_done_cleanup in dcf

---
 drivers/net/ice/ice_dcf_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ice/ice_dcf_ethdev.c +1 -0
index ccad7fc304..d8b5961514 100644
@@ -1235,6 +1235,7 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = {
 	.reta_query              = ice_dcf_dev_rss_reta_query,
 	.rss_hash_update         = ice_dcf_dev_rss_hash_update,
 	.rss_hash_conf_get       = ice_dcf_dev_rss_hash_conf_get,
+	.tx_done_cleanup         = ice_tx_done_cleanup,
 };
 
 static int
Signature · 1 line
2.33.1
author
#155 lore raw

PATCH v7 4/12 net/ice: support for MTU configure in DCF mode

In reply to Kevin Liu

From: Jie Wang <[email protected]>

add API "mtu_set" to dcf, and it can configure the port mtu through cmdline.

---
 doc/guides/nics/features/ice_dcf.ini   |  1 +
 doc/guides/rel_notes/release_22_07.rst |  1 +
 drivers/net/ice/ice_dcf_ethdev.c       | 14 ++++++++++++++
 drivers/net/ice/ice_dcf_ethdev.h       |  6 ++++++
 4 files changed, 22 insertions(+)
doc/guides/nics/features/ice_dcf.ini +1 -0
index d9c1b25407..be34ab4692 100644
@@ -17,6 +17,7 @@ Inner L3 checksum    = P
 Inner L4 checksum    = P
 RSS reta update      = Y
 RSS key update       = Y
+MTU update           = Y
 Basic stats          = Y
 Linux                = Y
 x86-32               = Y
doc/guides/rel_notes/release_22_07.rst +1 -0
index 866af8c0b3..3c8412c82e 100644
@@ -64,6 +64,7 @@ New Features
 
  * Added support for RSS RETA configure in DCF mode.
  * Added support for RSS HASH configure in DCF mode.
+ * Added support for MTU configure in DCF mode.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf_ethdev.c +14 -0
index d8b5961514..06d752fd61 100644
@@ -1081,6 +1081,19 @@ ice_dcf_link_update(struct rte_eth_dev *dev,
 	return rte_eth_linkstatus_set(dev, &new_link);
 }
 
+static int
+ice_dcf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused)
+{
+	/* mtu setting is forbidden if port is start */
+	if (dev->data->dev_started != 0) {
+		PMD_DRV_LOG(ERR, "port %d must be stopped before configuration",
+			    dev->data->port_id);
+		return -EBUSY;
+	}
+
+	return 0;
+}
+
 bool
 ice_dcf_adminq_need_retry(struct ice_adapter *ad)
 {
@@ -1236,6 +1249,7 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = {
 	.rss_hash_update         = ice_dcf_dev_rss_hash_update,
 	.rss_hash_conf_get       = ice_dcf_dev_rss_hash_conf_get,
 	.tx_done_cleanup         = ice_tx_done_cleanup,
+	.mtu_set                 = ice_dcf_dev_mtu_set,
 };
 
 static int
drivers/net/ice/ice_dcf_ethdev.h +6 -0
index 11a1305038..f2faf26f58 100644
@@ -15,6 +15,12 @@
 
 #define ICE_DCF_MAX_RINGS  1
 
+#define ICE_DCF_FRAME_SIZE_MAX       9728
+#define ICE_DCF_VLAN_TAG_SIZE               4
+#define ICE_DCF_ETH_OVERHEAD \
+	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_DCF_VLAN_TAG_SIZE * 2)
+#define ICE_DCF_ETH_MAX_LEN (RTE_ETHER_MTU + ICE_DCF_ETH_OVERHEAD)
+
 struct ice_dcf_queue {
 	uint64_t dummy;
 };
Signature · 1 line
2.33.1
author
#156 lore raw

PATCH v7 5/12 net/ice: add ops dev-supported-ptypes-get to dcf

In reply to Kevin Liu

From: Jie Wang <[email protected]>

add API "dev_supported_ptypes_get" to dcf, that dcf pmd can get ptypes through the new API.

---
 drivers/net/ice/ice_dcf_ethdev.c | 80 +++++++++++++++++++-------------
 1 file changed, 49 insertions(+), 31 deletions(-)
drivers/net/ice/ice_dcf_ethdev.c +49 -31
index 06d752fd61..6a577a6582 100644
@@ -1218,38 +1218,56 @@ ice_dcf_dev_reset(struct rte_eth_dev *dev)
 	return ret;
 }
 
+static const uint32_t *
+ice_dcf_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
+{
+	static const uint32_t ptypes[] = {
+		RTE_PTYPE_L2_ETHER,
+		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN,
+		RTE_PTYPE_L4_FRAG,
+		RTE_PTYPE_L4_ICMP,
+		RTE_PTYPE_L4_NONFRAG,
+		RTE_PTYPE_L4_SCTP,
+		RTE_PTYPE_L4_TCP,
+		RTE_PTYPE_L4_UDP,
+		RTE_PTYPE_UNKNOWN
+	};
+	return ptypes;
+}
+
 static const struct eth_dev_ops ice_dcf_eth_dev_ops = {
-	.dev_start               = ice_dcf_dev_start,
-	.dev_stop                = ice_dcf_dev_stop,
-	.dev_close               = ice_dcf_dev_close,
-	.dev_reset               = ice_dcf_dev_reset,
-	.dev_configure           = ice_dcf_dev_configure,
-	.dev_infos_get           = ice_dcf_dev_info_get,
-	.rx_queue_setup          = ice_rx_queue_setup,
-	.tx_queue_setup          = ice_tx_queue_setup,
-	.rx_queue_release        = ice_dev_rx_queue_release,
-	.tx_queue_release        = ice_dev_tx_queue_release,
-	.rx_queue_start          = ice_dcf_rx_queue_start,
-	.tx_queue_start          = ice_dcf_tx_queue_start,
-	.rx_queue_stop           = ice_dcf_rx_queue_stop,
-	.tx_queue_stop           = ice_dcf_tx_queue_stop,
-	.link_update             = ice_dcf_link_update,
-	.stats_get               = ice_dcf_stats_get,
-	.stats_reset             = ice_dcf_stats_reset,
-	.promiscuous_enable      = ice_dcf_dev_promiscuous_enable,
-	.promiscuous_disable     = ice_dcf_dev_promiscuous_disable,
-	.allmulticast_enable     = ice_dcf_dev_allmulticast_enable,
-	.allmulticast_disable    = ice_dcf_dev_allmulticast_disable,
-	.flow_ops_get            = ice_dcf_dev_flow_ops_get,
-	.udp_tunnel_port_add	 = ice_dcf_dev_udp_tunnel_port_add,
-	.udp_tunnel_port_del	 = ice_dcf_dev_udp_tunnel_port_del,
-	.tm_ops_get              = ice_dcf_tm_ops_get,
-	.reta_update             = ice_dcf_dev_rss_reta_update,
-	.reta_query              = ice_dcf_dev_rss_reta_query,
-	.rss_hash_update         = ice_dcf_dev_rss_hash_update,
-	.rss_hash_conf_get       = ice_dcf_dev_rss_hash_conf_get,
-	.tx_done_cleanup         = ice_tx_done_cleanup,
-	.mtu_set                 = ice_dcf_dev_mtu_set,
+	.dev_start                = ice_dcf_dev_start,
+	.dev_stop                 = ice_dcf_dev_stop,
+	.dev_close                = ice_dcf_dev_close,
+	.dev_reset                = ice_dcf_dev_reset,
+	.dev_configure            = ice_dcf_dev_configure,
+	.dev_infos_get            = ice_dcf_dev_info_get,
+	.dev_supported_ptypes_get = ice_dcf_dev_supported_ptypes_get,
+	.rx_queue_setup           = ice_rx_queue_setup,
+	.tx_queue_setup           = ice_tx_queue_setup,
+	.rx_queue_release         = ice_dev_rx_queue_release,
+	.tx_queue_release         = ice_dev_tx_queue_release,
+	.rx_queue_start           = ice_dcf_rx_queue_start,
+	.tx_queue_start           = ice_dcf_tx_queue_start,
+	.rx_queue_stop            = ice_dcf_rx_queue_stop,
+	.tx_queue_stop            = ice_dcf_tx_queue_stop,
+	.link_update              = ice_dcf_link_update,
+	.stats_get                = ice_dcf_stats_get,
+	.stats_reset              = ice_dcf_stats_reset,
+	.promiscuous_enable       = ice_dcf_dev_promiscuous_enable,
+	.promiscuous_disable      = ice_dcf_dev_promiscuous_disable,
+	.allmulticast_enable      = ice_dcf_dev_allmulticast_enable,
+	.allmulticast_disable     = ice_dcf_dev_allmulticast_disable,
+	.flow_ops_get             = ice_dcf_dev_flow_ops_get,
+	.udp_tunnel_port_add	  = ice_dcf_dev_udp_tunnel_port_add,
+	.udp_tunnel_port_del	  = ice_dcf_dev_udp_tunnel_port_del,
+	.tm_ops_get               = ice_dcf_tm_ops_get,
+	.reta_update              = ice_dcf_dev_rss_reta_update,
+	.reta_query               = ice_dcf_dev_rss_reta_query,
+	.rss_hash_update          = ice_dcf_dev_rss_hash_update,
+	.rss_hash_conf_get        = ice_dcf_dev_rss_hash_conf_get,
+	.tx_done_cleanup          = ice_tx_done_cleanup,
+	.mtu_set                  = ice_dcf_dev_mtu_set,
 };
 
 static int
Signature · 1 line
2.33.1
author
#157 lore raw

PATCH v7 6/12 net/ice: support dcf promisc configuration

In reply to Kevin Liu

From: Alvin Zhang <[email protected]>

Support configuration of unicast and multicast promisc on dcf.

---
 doc/guides/nics/features/ice_dcf.ini   |  2 +
 doc/guides/rel_notes/release_22_07.rst |  1 +
 drivers/net/ice/ice_dcf_ethdev.c       | 77 ++++++++++++++++++++++++--
 drivers/net/ice/ice_dcf_ethdev.h       |  3 +
 4 files changed, 79 insertions(+), 4 deletions(-)
doc/guides/nics/features/ice_dcf.ini +2 -0
index be34ab4692..fe3ada8733 100644
@@ -18,6 +18,8 @@ Inner L4 checksum    = P
 RSS reta update      = Y
 RSS key update       = Y
 MTU update           = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
 Basic stats          = Y
 Linux                = Y
 x86-32               = Y
doc/guides/rel_notes/release_22_07.rst +1 -0
index 3c8412c82e..f23e5cafd1 100644
@@ -65,6 +65,7 @@ New Features
  * Added support for RSS RETA configure in DCF mode.
  * Added support for RSS HASH configure in DCF mode.
  * Added support for MTU configure in DCF mode.
+ * Added support for promisc configuration in DCF mode.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf_ethdev.c +73 -4

106 lines not on this page · raw message

drivers/net/ice/ice_dcf_ethdev.h +3 -0
index f2faf26f58..22e450527b 100644
@@ -33,6 +33,9 @@ struct ice_dcf_adapter {
 	struct ice_adapter parent; /* Must be first */
 	struct ice_dcf_hw real_hw;
 
+	bool promisc_unicast_enabled;
+	bool promisc_multicast_enabled;
+
 	int num_reprs;
 	struct ice_dcf_repr_info *repr_infos;
 };
Signature · 1 line
2.33.1
author
#158 lore raw

PATCH v7 7/12 net/ice: support dcf MAC configuration

In reply to Kevin Liu

Below PMD ops are supported in this patch:

    .mac_addr_add      = dcf_dev_add_mac_addr
    .mac_addr_remove   = dcf_dev_del_mac_addr
    .set_mc_addr_list  = dcf_set_mc_addr_list
    .mac_addr_set      = dcf_dev_set_default_mac_addr
---
 doc/guides/nics/features/ice_dcf.ini   |   1 +
 doc/guides/rel_notes/release_22_07.rst |   1 +
 drivers/net/ice/ice_dcf.c              |   9 +-
 drivers/net/ice/ice_dcf.h              |   4 +-
 drivers/net/ice/ice_dcf_ethdev.c       | 218 ++++++++++++++++++++++++-
 drivers/net/ice/ice_dcf_ethdev.h       |   5 +-
 6 files changed, 228 insertions(+), 10 deletions(-)
doc/guides/nics/features/ice_dcf.ini +1 -0
index fe3ada8733..c9bdbcd6cc 100644
@@ -20,6 +20,7 @@ RSS key update       = Y
 MTU update           = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
+Unicast MAC filter   = Y
 Basic stats          = Y
 Linux                = Y
 x86-32               = Y
doc/guides/rel_notes/release_22_07.rst +1 -0
index f23e5cafd1..97517d303e 100644
@@ -66,6 +66,7 @@ New Features
  * Added support for RSS HASH configure in DCF mode.
  * Added support for MTU configure in DCF mode.
  * Added support for promisc configuration in DCF mode.
+ * Added support for MAC configuration in DCF mode.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf.c +5 -4
index 89c0203ba3..55ae68c456 100644
@@ -1089,10 +1089,11 @@ ice_dcf_query_stats(struct ice_dcf_hw *hw,
 }
 
 int
-ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
+ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw,
+			     struct rte_ether_addr *addr,
+			     bool add, uint8_t type)
 {
 	struct virtchnl_ether_addr_list *list;
-	struct rte_ether_addr *addr;
 	struct dcf_virtchnl_cmd args;
 	int len, err = 0;
 
@@ -1105,7 +1106,6 @@ ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
 	}
 
 	len = sizeof(struct virtchnl_ether_addr_list);
-	addr = hw->eth_dev->data->mac_addrs;
 	len += sizeof(struct virtchnl_ether_addr);
 
 	list = rte_zmalloc(NULL, len, 0);
@@ -1116,9 +1116,10 @@ ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
 
 	rte_memcpy(list->list[0].addr, addr->addr_bytes,
 			sizeof(addr->addr_bytes));
+
 	PMD_DRV_LOG(DEBUG, "add/rm mac:" RTE_ETHER_ADDR_PRT_FMT,
 			    RTE_ETHER_ADDR_BYTES(addr));
-
+	list->list[0].type = type;
 	list->vsi_id = hw->vsi_res->vsi_id;
 	list->num_elements = 1;
 
drivers/net/ice/ice_dcf.h +3 -1
index f0b45af5ae..78df202a77 100644
@@ -131,7 +131,9 @@ int ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on);
 int ice_dcf_disable_queues(struct ice_dcf_hw *hw);
 int ice_dcf_query_stats(struct ice_dcf_hw *hw,
 			struct virtchnl_eth_stats *pstats);
-int ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add);
+int ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw,
+				 struct rte_ether_addr *addr, bool add,
+				 uint8_t type);
 int ice_dcf_link_update(struct rte_eth_dev *dev,
 		    __rte_unused int wait_to_complete);
 void ice_dcf_tm_conf_init(struct rte_eth_dev *dev);
drivers/net/ice/ice_dcf_ethdev.c +215 -3

259 lines not on this page · raw message

drivers/net/ice/ice_dcf_ethdev.h +3 -2
index 22e450527b..27f6402786 100644
@@ -14,7 +14,7 @@
 #include "ice_dcf.h"
 
 #define ICE_DCF_MAX_RINGS  1
-
+#define DCF_NUM_MACADDR_MAX	64
 #define ICE_DCF_FRAME_SIZE_MAX       9728
 #define ICE_DCF_VLAN_TAG_SIZE               4
 #define ICE_DCF_ETH_OVERHEAD \
@@ -35,7 +35,8 @@ struct ice_dcf_adapter {
 
 	bool promisc_unicast_enabled;
 	bool promisc_multicast_enabled;
-
+	uint32_t mc_addrs_num;
+	struct rte_ether_addr mc_addrs[DCF_NUM_MACADDR_MAX];
 	int num_reprs;
 	struct ice_dcf_repr_info *repr_infos;
 };
Signature · 1 line
2.33.1
author
#159 lore raw

PATCH v7 8/12 net/ice: support dcf VLAN filter and offload configuration

In reply to Kevin Liu

From: Alvin Zhang <[email protected]>

Below PMD ops are supported in this patch:
.vlan_filter_set = dcf_dev_vlan_filter_set
.vlan_offload_set = dcf_dev_vlan_offload_set

---
 doc/guides/nics/features/ice_dcf.ini   |   2 +
 doc/guides/rel_notes/release_22_07.rst |   1 +
 drivers/net/ice/ice_dcf_ethdev.c       | 101 +++++++++++++++++++++++++
 3 files changed, 104 insertions(+)
doc/guides/nics/features/ice_dcf.ini +2 -0
index c9bdbcd6cc..01e7527915 100644
@@ -21,6 +21,8 @@ MTU update           = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
+VLAN filter          = Y
+VLAN offload         = Y
 Basic stats          = Y
 Linux                = Y
 x86-32               = Y
doc/guides/rel_notes/release_22_07.rst +1 -0
index 97517d303e..e66f84db9c 100644
@@ -67,6 +67,7 @@ New Features
  * Added support for MTU configure in DCF mode.
  * Added support for promisc configuration in DCF mode.
  * Added support for MAC configuration in DCF mode.
+ * Added support for VLAN filter and offload configuration in DCF mode.
 
 Removed Items
 -------------
drivers/net/ice/ice_dcf_ethdev.c +101 -0

113 lines not on this page · raw message

Signature · 1 line
2.33.1
author
#160 lore raw

PATCH v7 9/12 net/ice: add extended stats

In reply to Kevin Liu

Add implementation of xstats() functions in DCF PMD.

---
 doc/guides/nics/features/ice_dcf.ini |  1 +
 drivers/net/ice/ice_dcf.h            | 22 ++++++++
 drivers/net/ice/ice_dcf_ethdev.c     | 75 ++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+)
doc/guides/nics/features/ice_dcf.ini +1 -0
index 01e7527915..54ea7f150c 100644
@@ -23,6 +23,7 @@ Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
 VLAN offload         = Y
+Extended stats       = Y
 Basic stats          = Y
 Linux                = Y
 x86-32               = Y
drivers/net/ice/ice_dcf.h +22 -0
index 78df202a77..44a61404c3 100644
@@ -15,6 +15,12 @@
 #include "base/ice_type.h"
 #include "ice_logs.h"
 
+/* ICE_DCF_DEV_PRIVATE_TO */
+#define ICE_DCF_DEV_PRIVATE_TO_ADAPTER(adapter) \
+	((struct ice_dcf_adapter *)adapter)
+#define ICE_DCF_DEV_PRIVATE_TO_VF(adapter) \
+	(&((struct ice_dcf_adapter *)adapter)->vf)
+
 struct dcf_virtchnl_cmd {
 	TAILQ_ENTRY(dcf_virtchnl_cmd) next;
 
@@ -74,6 +80,22 @@ struct ice_dcf_tm_conf {
 	bool committed;
 };
 
+struct ice_dcf_eth_stats {
+	u64 rx_bytes;			/* gorc */
+	u64 rx_unicast;			/* uprc */
+	u64 rx_multicast;		/* mprc */
+	u64 rx_broadcast;		/* bprc */
+	u64 rx_discards;		/* rdpc */
+	u64 rx_unknown_protocol;	/* rupp */
+	u64 tx_bytes;			/* gotc */
+	u64 tx_unicast;			/* uptc */
+	u64 tx_multicast;		/* mptc */
+	u64 tx_broadcast;		/* bptc */
+	u64 tx_discards;		/* tdpc */
+	u64 tx_errors;			/* tepc */
+	u64 rx_no_desc;			/* repc */
+	u64 rx_errors;			/* repc */
+};
 struct ice_dcf_hw {
 	struct iavf_hw avf;
 
drivers/net/ice/ice_dcf_ethdev.c +75 -0

93 lines not on this page · raw message

Signature · 1 line
2.33.1
author
#161 lore raw

PATCH v7 10/12 net/ice: support queue information getting

In reply to Kevin Liu

Add below ops,
rxq_info_get
txq_info_get

---
 drivers/net/ice/ice_dcf_ethdev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ice/ice_dcf_ethdev.c +2 -0
index 6503700e02..9217392d04 100644
@@ -1698,6 +1698,8 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = {
 	.tx_queue_start           = ice_dcf_tx_queue_start,
 	.rx_queue_stop            = ice_dcf_rx_queue_stop,
 	.tx_queue_stop            = ice_dcf_tx_queue_stop,
+	.rxq_info_get             = ice_rxq_info_get,
+	.txq_info_get             = ice_txq_info_get,
 	.link_update              = ice_dcf_link_update,
 	.stats_get                = ice_dcf_stats_get,
 	.stats_reset              = ice_dcf_stats_reset,
Signature · 1 line
2.33.1
author
#162 lore raw

PATCH v7 11/12 net/ice: add implement power management

In reply to Kevin Liu

Implement support for the power management API by implementing a 'get_monitor_addr' function that will return an address of an RX ring's status bit.

---
 doc/guides/nics/features/ice_dcf.ini | 1 +
 drivers/net/ice/ice_dcf_ethdev.c     | 1 +
 2 files changed, 2 insertions(+)
doc/guides/nics/features/ice_dcf.ini +1 -0
index 54ea7f150c..3b11622d4c 100644
@@ -25,6 +25,7 @@ VLAN filter          = Y
 VLAN offload         = Y
 Extended stats       = Y
 Basic stats          = Y
+Power mgmt address monitor = Y
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/ice/ice_dcf_ethdev.c +1 -0
index 9217392d04..236c0395e0 100644
@@ -1700,6 +1700,7 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = {
 	.tx_queue_stop            = ice_dcf_tx_queue_stop,
 	.rxq_info_get             = ice_rxq_info_get,
 	.txq_info_get             = ice_txq_info_get,
+	.get_monitor_addr         = ice_get_monitor_addr,
 	.link_update              = ice_dcf_link_update,
 	.stats_get                = ice_dcf_stats_get,
 	.stats_reset              = ice_dcf_stats_reset,
Signature · 1 line
2.33.1
author
#163 lore raw

PATCH v7 12/12 net/ice: support DCF new VLAN capabilities

In reply to Kevin Liu

From: Alvin Zhang <[email protected]>

The new VLAN virtchnl opcodes introduce new capabilities like VLAN filtering, stripping and insertion.

The DCF needs to query the VLAN capabilities based on current device configuration firstly.

DCF is able to configure inner VLAN filter when port VLAN is enabled base on negotiation; and DCF is able to configure outer VLAN (0x8100) if port VLAN is disabled to be compatible with legacy mode.

When port VLAN is updated by DCF, the DCF needs to reset to query the new VLAN capabilities.

---
 drivers/net/ice/ice_dcf.c        |  27 +++++
 drivers/net/ice/ice_dcf.h        |   1 +
 drivers/net/ice/ice_dcf_ethdev.c | 171 ++++++++++++++++++++++++++++---
 3 files changed, 182 insertions(+), 17 deletions(-)
drivers/net/ice/ice_dcf.c +27 -0
index 55ae68c456..885d58c0f4 100644
@@ -587,6 +587,29 @@ ice_dcf_get_supported_rxdid(struct ice_dcf_hw *hw)
 	return 0;
 }
 
+static int
+dcf_get_vlan_offload_caps_v2(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_vlan_caps vlan_v2_caps;
+	struct dcf_virtchnl_cmd args;
+	int ret;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS;
+	args.rsp_msgbuf = (uint8_t *)&vlan_v2_caps;
+	args.rsp_buflen = sizeof(vlan_v2_caps);
+
+	ret = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (ret) {
+		PMD_DRV_LOG(ERR,
+			    "Failed to execute command of VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS");
+		return ret;
+	}
+
+	rte_memcpy(&hw->vlan_v2_caps, &vlan_v2_caps, sizeof(vlan_v2_caps));
+	return 0;
+}
+
 int
 ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 {
@@ -701,6 +724,10 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	rte_intr_enable(pci_dev->intr_handle);
 	ice_dcf_enable_irq0(hw);
 
+	if ((hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) &&
+	    dcf_get_vlan_offload_caps_v2(hw))
+		goto err_rss;
+
 	return 0;
 
 err_rss:
drivers/net/ice/ice_dcf.h +1 -0
index 44a61404c3..7f42ebabe9 100644
@@ -129,6 +129,7 @@ struct ice_dcf_hw {
 	uint16_t nb_msix;
 	uint16_t rxq_map[16];
 	struct virtchnl_eth_stats eth_stats_offset;
+	struct virtchnl_vlan_caps vlan_v2_caps;
 
 	/* Link status */
 	bool link_up;
drivers/net/ice/ice_dcf_ethdev.c +154 -17

196 lines not on this page · raw message

Signature · 1 line
2.33.1
#164 lore raw

RE: [PATCH v7 12/12] net/ice: support DCF new VLAN capabilities

Quoted 10 lines

-----Original Message-----
From: Liu, KevinX <[email protected]>
Sent: Friday, April 29, 2022 5:20 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Yang, SteveX <[email protected]>; Alvin Zhang <[email protected]>; Liu, KevinX <[email protected]>
Subject: [PATCH v7 12/12] net/ice: support DCF new VLAN capabilities

Refine the title as " complete VLAN offload capability for DCF" in dpdk-next-net-intel. As it does not introduce any new VLAN offload capability

Acked-by on the v7 series Applied
#165 lore raw

RE: [PATCH v7 00/12] complete common VF features for DCF

In reply to Kevin Liu
Quoted 125 lines

-----Original Message-----
From: Liu, KevinX <[email protected]>
Sent: Friday, April 29, 2022 5:20 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Yang, SteveX <[email protected]>; Liu, KevinX <[email protected]>
Subject: [PATCH v7 00/12] complete common VF features for DCF

The DCF PMD support the below dev ops,
dev_supported_ptypes_get
dev_link_update
xstats_get
xstats_get_names
xstats_reset
promiscuous_enable
promiscuous_disable
allmulticast_enable
allmulticast_disable
mac_addr_add
mac_addr_remove
set_mc_addr_list
vlan_filter_set
vlan_offload_set
mac_addr_set
reta_update
reta_query
rss_hash_update
rss_hash_conf_get
rxq_info_get
txq_info_get
mtu_set
tx_done_cleanup
get_monitor_addr

v7:
* Update release note and patch title.

v6:
* add patch:
1.net/ice: support DCF new VLAN capabilities
* remove patch:
1.doc: update for ice DCF datapath configuration
* Split doc into specific patch.

v5:
* remove patch:
1.complete common VF features for DCF
2.net/ice: enable CVL DCF device reset API 3.net/ice: support IPv6 NVGRE tunnel
4.net/ice: support new pattern of IPv4
5.net/ice: treat unknown package as OS default package 6.net/ice: handle virtchnl event message without interrupt 7.net/ice: add DCF request queues function 8.net/ice: negotiate large VF and request more queues 9.net/ice: enable multiple queues configurations for large VF 10.net/ice: enable IRQ mapping configuration for large VF 11.net/ice: add enable/disable queues for DCF large VF

v4:
* remove patch:
1.testpmd: force flow flush
2.net/ice: fix DCF ACL flow engine 3.net/ice: fix DCF reset
* add patch:
1.net/ice: add extended stats 2.net/ice: support queue information getting 3.net/ice: implement power management 4.doc: update for ice DCF datapath configuration

v3:
* remove patch:
1.net/ice/base: add VXLAN support for switch filter 2.net/ice: add VXLAN support for switch filter 3.common/iavf: support flushing rules and reporting DCF id 4.net/ice/base: fix ethertype filter input set 5.net/ice/base: support IPv6 GRE UDP pattern 6.net/ice/base: support new patterns of TCP and UDP 7.net/ice: support new patterns of TCP and UDP 8.net/ice/base: support IPv4 GRE tunnel 9.net/ice: support IPv4 GRE raw pattern type 10.net/ice/base: update Profile ID table for VXLAN 11.net/ice/base: update Protocol ID table to match DVM DDP

v2:
* remove patch:
1.net/iavf: support checking if device is an MDCF instance 2.net/ice: support MDCF(multi-DCF) instance 3.net/ice/base: support custom DDP buildin recipe 4.net/ice: support buildin recipe configuration 5.net/ice/base: support custom ddp package version 6.net/ice: disable ACL function for MDCF instance

Alvin Zhang (3):
net/ice: support dcf promisc configuration net/ice: support dcf VLAN filter and offload configuration net/ice: support DCF new VLAN capabilities

Jie Wang (2):
net/ice: support for MTU configure in DCF mode net/ice: add ops dev-supported-ptypes-get to dcf

Kevin Liu (4):
net/ice: support dcf MAC configuration
net/ice: add extended stats
net/ice: support queue information getting
net/ice: add implement power management

Robin Zhang (1):
net/ice: support cleanup Tx buffers in DCF mode

Steve Yang (2):
net/ice: support for RSS RETA configure in DCF mode net/ice: support for RSS HASH configure in DCF mode

 doc/guides/nics/features/ice_dcf.ini   |  10 +
 doc/guides/rel_notes/release_22_07.rst |   8 +
 drivers/net/ice/ice_dcf.c              |  40 +-
 drivers/net/ice/ice_dcf.h              |  29 +-
 drivers/net/ice/ice_dcf_ethdev.c       | 820 ++++++++++++++++++++++++-
 drivers/net/ice/ice_dcf_ethdev.h       |  10 +
 6 files changed, 879 insertions(+), 38 deletions(-)
Quoted 2 lines

--
2.33.1

Applied to dpdk-next-net-intel.

Thanks
Qi

author
#166 lore raw

v4 cover fix DCF function defect

In reply to Kevin Liu

Some modifications of associated complete common VF features for DCF.

v4:
Transfer the fix patch from the feature cover-letter to here.

v3:
* remove patch:
1.net/ice/base: add VXLAN support for switch filter 2.net/ice: add VXLAN support for switch filter 3.common/iavf: support flushing rules and reporting DCF id 4.net/ice/base: fix ethertype filter input set 5.net/ice/base: support IPv6 GRE UDP pattern 6.net/ice/base: support new patterns of TCP and UDP 7.net/ice: support new patterns of TCP and UDP 8.net/ice/base: support IPv4 GRE tunnel 9.net/ice: support IPv4 GRE raw pattern type 10.net/ice/base: update Profile ID table for VXLAN 11.net/ice/base: update Protocol ID table to match DVM DDP

v2:
* remove patch:
1.net/iavf: support checking if device is an MDCF instance 2.net/ice: support MDCF(multi-DCF) instance 3.net/ice/base: support custom DDP buildin recipe 4.net/ice: support buildin recipe configuration 5.net/ice/base: support custom ddp package version 6.net/ice: disable ACL function for MDCF instance

Alvin Zhang (1):
net/ice: fix DCF ACL flow engine

Kevin Liu (1):
net/ice: fix DCF reset

 drivers/net/ice/base/ice_common.c  |  4 +++-
 drivers/net/ice/ice_acl_filter.c   | 20 ++++++++++++++----
 drivers/net/ice/ice_dcf.c          |  2 +-
 drivers/net/ice/ice_dcf_ethdev.c   | 17 ++++++++++++++-
 drivers/net/ice/ice_dcf_parent.c   |  3 +++
 drivers/net/ice/ice_generic_flow.c | 34 +++++++++++++++++++++++-------
 6 files changed, 65 insertions(+), 15 deletions(-)
Signature · 1 line
2.33.1
author
#167 lore raw

PATCH v4 1/2 net/ice: fix DCF ACL flow engine

From: Alvin Zhang <[email protected]>

ACL is not a necessary feature for DCF, it may not be supported by the ice kernel driver, so in this patch the program does not return the ACL initiation fails to high level functions, as substitute it prints some error logs, cleans the related resources and unregisters the ACL engine.

Fixes 40d466fa9f76 ("net/ice: support ACL filter in DCF")
---
 drivers/net/ice/ice_acl_filter.c   | 20 ++++++++++++++----
 drivers/net/ice/ice_generic_flow.c | 34 +++++++++++++++++++++++-------
 2 files changed, 42 insertions(+), 12 deletions(-)
drivers/net/ice/ice_acl_filter.c +16 -4
index 8fe6f5aeb0..20a1f86c43 100644
@@ -56,6 +56,8 @@ ice_pattern_match_item ice_acl_pattern[] = {
 	{pattern_eth_ipv4_sctp,	ICE_ACL_INSET_ETH_IPV4_SCTP,	ICE_INSET_NONE,	ICE_INSET_NONE},
 };
 
+static void ice_acl_prof_free(struct ice_hw *hw);
+
 static int
 ice_acl_prof_alloc(struct ice_hw *hw)
 {
@@ -1007,17 +1009,27 @@ ice_acl_init(struct ice_adapter *ad)
 
 	ret = ice_acl_setup(pf);
 	if (ret)
-		return ret;
+		goto deinit_acl;
 
 	ret = ice_acl_bitmap_init(pf);
 	if (ret)
-		return ret;
+		goto deinit_acl;
 
 	ret = ice_acl_prof_init(pf);
 	if (ret)
-		return ret;
+		goto deinit_acl;
 
-	return ice_register_parser(parser, ad);
+	ret = ice_register_parser(parser, ad);
+	if (ret)
+		goto deinit_acl;
+
+	return 0;
+
+deinit_acl:
+	ice_deinit_acl(pf);
+	ice_acl_prof_free(hw);
+	PMD_DRV_LOG(ERR, "ACL init failed, may not supported!");
+	return ret;
 }
 
 static void
drivers/net/ice/ice_generic_flow.c +26 -8
index 57eb002bde..cfdc4bd697 100644
@@ -1817,6 +1817,12 @@ ice_register_flow_engine(struct ice_flow_engine *engine)
 	TAILQ_INSERT_TAIL(&engine_list, engine, node);
 }
 
+static void
+ice_unregister_flow_engine(struct ice_flow_engine *engine)
+{
+	TAILQ_REMOVE(&engine_list, engine, node);
+}
+
 int
 ice_flow_init(struct ice_adapter *ad)
 {
@@ -1843,9 +1849,18 @@ ice_flow_init(struct ice_adapter *ad)
 
 		ret = engine->init(ad);
 		if (ret) {
-			PMD_INIT_LOG(ERR, "Failed to initialize engine %d",
-					engine->type);
-			return ret;
+			/**
+			 * ACL may not supported in kernel driver,
+			 * so just unregister the engine.
+			 */
+			if (engine->type == ICE_FLOW_ENGINE_ACL) {
+				ice_unregister_flow_engine(engine);
+			} else {
+				PMD_INIT_LOG(ERR,
+					     "Failed to initialize engine %d",
+					     engine->type);
+				return ret;
+			}
 		}
 	}
 	return 0;
@@ -1937,7 +1952,7 @@ ice_register_parser(struct ice_flow_parser *parser,
 
 	list = ice_get_parser_list(parser, ad);
 	if (list == NULL)
-		return -EINVAL;
+		goto err;
 
 	if (ad->devargs.pipe_mode_support) {
 		TAILQ_INSERT_TAIL(list, parser_node, node);
@@ -1949,7 +1964,7 @@ ice_register_parser(struct ice_flow_parser *parser,
 				    ICE_FLOW_ENGINE_ACL) {
 					TAILQ_INSERT_AFTER(list, existing_node,
 							   parser_node, node);
-					goto DONE;
+					return 0;
 				}
 			}
 			TAILQ_INSERT_HEAD(list, parser_node, node);
@@ -1960,7 +1975,7 @@ ice_register_parser(struct ice_flow_parser *parser,
 				    ICE_FLOW_ENGINE_SWITCH) {
 					TAILQ_INSERT_AFTER(list, existing_node,
 							   parser_node, node);
-					goto DONE;
+					return 0;
 				}
 			}
 			TAILQ_INSERT_HEAD(list, parser_node, node);
@@ -1969,11 +1984,14 @@ ice_register_parser(struct ice_flow_parser *parser,
 		} else if (parser->engine->type == ICE_FLOW_ENGINE_ACL) {
 			TAILQ_INSERT_HEAD(list, parser_node, node);
 		} else {
-			return -EINVAL;
+			goto err;
 		}
 	}
-DONE:
 	return 0;
+err:
+	rte_free(parser_node);
+	PMD_DRV_LOG(ERR, "%s failed.", __func__);
+	return -EINVAL;
 }
 
 void
Signature · 1 line
2.33.1
#168 lore raw

RE: [PATCH v4 1/2] net/ice: fix DCF ACL flow engine

Quoted 59 lines

-----Original Message-----
From: Liu, KevinX <[email protected]>
Sent: Wednesday, April 20, 2022 12:02 AM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Yang, SteveX <[email protected]>; Alvin Zhang <[email protected]>; Liu, KevinX <[email protected]>
Subject: [PATCH v4 1/2] net/ice: fix DCF ACL flow engine

From: Alvin Zhang <[email protected]>

ACL is not a necessary feature for DCF, it may not be supported by the ice kernel driver, so in this patch the program does not return the ACL initiation fails to high level functions, as substitute it prints some error logs, cleans the related resources and unregisters the ACL engine.

Fixes 40d466fa9f76 ("net/ice: support ACL filter in DCF")
---
 drivers/net/ice/ice_acl_filter.c   | 20 ++++++++++++++----
 drivers/net/ice/ice_generic_flow.c | 34 +++++++++++++++++++++++-------
 2 files changed, 42 insertions(+), 12 deletions(-)
drivers/net/ice/ice_acl_filter.c +2 -0
index 8fe6f5aeb0..20a1f86c43 100644
@@ -56,6 +56,8 @@ ice_pattern_match_item ice_acl_pattern[] = {
 	{pattern_eth_ipv4_sctp,	ICE_ACL_INSET_ETH_IPV4_SCTP,
 	ICE_INSET_NONE,	ICE_INSET_NONE},
 };
 
+static void ice_acl_prof_free(struct ice_hw *hw);
+
 static int
 ice_acl_prof_alloc(struct ice_hw *hw)

{

drivers/net/ice/ice_acl_filter.c +3 -4
@@ -1007,17 +1009,27 @@ ice_acl_init(struct ice_adapter *ad)
 
 	ret = ice_acl_setup(pf);
 	if (ret)
-		return ret;
+		goto deinit_acl;
 
 	ret = ice_acl_bitmap_init(pf);
 	if (ret)
-		return ret;
+		goto deinit_acl;
 
 	ret = ice_acl_prof_init(pf);
 	if (ret)
-		return ret;
+		goto deinit_acl;
 
-	return ice_register_parser(parser, ad);

drivers/net/ice/ice_acl_filter.c ice_acl_init(struct ice_adapter *ad) · line 1031

Quoted 10 lines
drivers/net/ice/ice_acl_filter.c +10 -0
+	ret = ice_register_parser(parser, ad);
+	if (ret)
+		goto deinit_acl;
+
+	return 0;
+
+deinit_acl:
+	ice_deinit_acl(pf);
+	ice_acl_prof_free(hw);
+	PMD_DRV_LOG(ERR, "ACL init failed, may not supported!");

Better to print the error message at the place where the error happens, for easy debugging.

Quoted 21 lines
drivers/net/ice/ice_acl_filter.c +1 -0
+	return ret;
 }
 
 static void
drivers/net/ice/ice_generic_flow.c +4 -0
index 57eb002bde..cfdc4bd697 100644
@@ -1817,6 +1817,12 @@ ice_register_flow_engine(struct ice_flow_engine
 *engine)
 	TAILQ_INSERT_TAIL(&engine_list, engine, node);  }
 
+static void
+ice_unregister_flow_engine(struct ice_flow_engine *engine) {
+	TAILQ_REMOVE(&engine_list, engine, node); }
+
 int
 ice_flow_init(struct ice_adapter *ad)
 {

drivers/net/ice/ice_generic_flow.c ice_flow_init(struct ice_adapter *ad) · line 1853

Quoted 8 lines
drivers/net/ice/ice_generic_flow.c +2 -3
@@ -1843,9 +1849,18 @@ ice_flow_init(struct ice_adapter *ad)
 
 		ret = engine->init(ad);
 		if (ret) {
-			PMD_INIT_LOG(ERR, "Failed to initialize engine %d",
-					engine->type);
-			return ret;
+			/**
+			 * ACL may not supported in kernel driver,

may not be supported

Quoted 61 lines
drivers/net/ice/ice_generic_flow.c +12 -1
+			 * so just unregister the engine.
+			 */
+			if (engine->type == ICE_FLOW_ENGINE_ACL) {
+				ice_unregister_flow_engine(engine);
+			} else {
+				PMD_INIT_LOG(ERR,
+					     "Failed to initialize engine %d",
+					     engine->type);
+				return ret;
+			}
 		}
 	}
 	return 0;
@@ -1937,7 +1952,7 @@ ice_register_parser(struct ice_flow_parser *parser,
 
 	list = ice_get_parser_list(parser, ad);
 	if (list == NULL)
-		return -EINVAL;
+		goto err;
 
 	if (ad->devargs.pipe_mode_support) {
 		TAILQ_INSERT_TAIL(list, parser_node, node); @@ -1949,7
+1964,7 @@ ice_register_parser(struct ice_flow_parser *parser,
 				    ICE_FLOW_ENGINE_ACL) {
 					TAILQ_INSERT_AFTER(list,

existing_node,

drivers/net/ice/ice_generic_flow.c +1 -1
 							   parser_node, node);
-					goto DONE;
+					return 0;
 				}
 			}
 			TAILQ_INSERT_HEAD(list, parser_node, node); @@ -

1960,7 +1975,7 @@ ice_register_parser(struct ice_flow_parser *parser,

drivers/net/ice/ice_generic_flow.c +0 -0
 				    ICE_FLOW_ENGINE_SWITCH) {
 					TAILQ_INSERT_AFTER(list,

existing_node,

drivers/net/ice/ice_generic_flow.c +1 -1
 							   parser_node, node);
-					goto DONE;
+					return 0;
 				}
 			}
 			TAILQ_INSERT_HEAD(list, parser_node, node); @@ -

1969,11 +1984,14 @@ ice_register_parser(struct ice_flow_parser *parser,

drivers/net/ice/ice_generic_flow.c +5 -3
 		} else if (parser->engine->type == ICE_FLOW_ENGINE_ACL) {
 			TAILQ_INSERT_HEAD(list, parser_node, node);
 		} else {
-			return -EINVAL;
+			goto err;
 		}
 	}
-DONE:
 	return 0;
+err:
+	rte_free(parser_node);
+	PMD_DRV_LOG(ERR, "%s failed.", __func__);
+	return -EINVAL;
 }
 
 void
--

2.33.1

author
#169 lore raw

PATCH v4 2/2 net/ice: fix DCF reset

In reply to Kevin Liu

After the PF triggers the VF reset, before the VF PMD can perform any operations on the hardware, it must reinitialize the all resources.

This patch adds a flag to indicate whether the VF has been reset by PF, and update the DCF resetting operations according to this flag.

Fixes 1a86f4dbdf42 ("net/ice: support DCF device reset")
---
 drivers/net/ice/base/ice_common.c |  4 +++-
 drivers/net/ice/ice_dcf.c         |  2 +-
 drivers/net/ice/ice_dcf_ethdev.c  | 17 ++++++++++++++++-
 drivers/net/ice/ice_dcf_parent.c  |  3 +++
 4 files changed, 23 insertions(+), 3 deletions(-)
drivers/net/ice/base/ice_common.c +3 -1
index db87bacd97..13feb55469 100644
@@ -755,6 +755,7 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)
 	status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list);
 	if (status) {
 		ice_free(hw, hw->switch_info);
+		hw->switch_info = NULL;
 		return status;
 	}
 	return ICE_SUCCESS;
@@ -823,7 +824,6 @@ ice_cleanup_fltr_mgmt_single(struct ice_hw *hw, struct ice_switch_info *sw)
 	}
 	ice_rm_sw_replay_rule_info(hw, sw);
 	ice_free(hw, sw->recp_list);
-	ice_free(hw, sw);
 }
 
 /**
@@ -833,6 +833,8 @@ ice_cleanup_fltr_mgmt_single(struct ice_hw *hw, struct ice_switch_info *sw)
 void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)
 {
 	ice_cleanup_fltr_mgmt_single(hw, hw->switch_info);
+	ice_free(hw, hw->switch_info);
+	hw->switch_info = NULL;
 }
 
 /**
drivers/net/ice/ice_dcf.c +1 -1
index 23edfd09b1..35773e2acd 100644
@@ -1429,7 +1429,7 @@ ice_dcf_cap_reset(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	int ret;
 
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
 
 	ice_dcf_disable_irq0(hw);
 	rte_intr_disable(intr_handle);
drivers/net/ice/ice_dcf_ethdev.c +16 -1
index 0a7ae54079..08306442a2 100644
@@ -1028,6 +1028,15 @@ dcf_add_del_mc_addr_list(struct ice_dcf_hw *hw,
 	uint32_t i;
 	int len, err = 0;
 
+	if (hw->resetting) {
+		if (!add)
+			return 0;
+
+		PMD_DRV_LOG(ERR,
+			    "fail to add multicast MACs for VF resetting");
+		return -EIO;
+	}
+
 	len = sizeof(struct virtchnl_ether_addr_list);
 	len += sizeof(struct virtchnl_ether_addr) * mc_addrs_num;
 
@@ -1714,7 +1723,13 @@ ice_dcf_dev_close(struct rte_eth_dev *dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	(void)ice_dcf_dev_stop(dev);
+	if (adapter->parent.pf.adapter_stopped)
+		(void)ice_dcf_dev_stop(dev);
+
+	if (adapter->real_hw.resetting) {
+		ice_dcf_uninit_hw(dev, &adapter->real_hw);
+		ice_dcf_init_hw(dev, &adapter->real_hw);
+	}
 
 	ice_free_queues(dev);
 
drivers/net/ice/ice_dcf_parent.c +3 -0
index 2f96dedcce..7f7ed796e2 100644
@@ -240,6 +240,9 @@ ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw,
 	case VIRTCHNL_EVENT_RESET_IMPENDING:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event");
 		dcf_hw->resetting = true;
+		rte_eth_dev_callback_process(dcf_hw->eth_dev,
+					     RTE_ETH_EVENT_INTR_RESET,
+					     NULL);
 		break;
 	case VIRTCHNL_EVENT_LINK_CHANGE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event");
Signature · 1 line
2.33.1