Skip to contentSkip to conversation

enable DCF datapath configuration

PATCH Superseded Ting Xu 4 participants 65 messages Jun 5, 2020 – Jun 29, 2020 Network drivers

lore
Share & tools
lore

Ting Xu

author
#0 lore raw

cover enable DCF datapath configuration

This patchset adds support to configure DCF datapath, including Rx/Tx queues setup, start and stop, device configuration, RSS and flexible descriptor RXDID initialization and MAC filter setup.

Qi Zhang (11):
net/ice: init RSS and supported RXDID in DCF net/ice: complete device info get in DCF net/ice: complete dev configure in DCF net/ice: complete queue setup in DCF net/ice: add stop flag for device start / stop net/ice: add Rx queue init in DCF net/ice: init RSS during DCF start net/ice: add queue config in DCF net/ice: add queue start and stop for DCF net/ice: enable stats for DCF
net/ice: set MAC filter during dev start for DCF

Ting Xu (1):
doc: enable DCF datapath configuration

 doc/guides/rel_notes/release_20_08.rst |   5 +
 drivers/net/ice/ice_dcf.c              | 412 +++++++++++++-
 drivers/net/ice/ice_dcf.h              |  17 +
 drivers/net/ice/ice_dcf_ethdev.c       | 759 +++++++++++++++++++++++--
 drivers/net/ice/ice_dcf_ethdev.h       |   3 -
 drivers/net/ice/ice_dcf_parent.c       |   8 +
 6 files changed, 1151 insertions(+), 53 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/12 net/ice: init RSS and supported RXDID in DCF

From: Qi Zhang <[email protected]>

Enable RSS parameters initialization and get the supported flexible descriptor RXDIDs bitmap from PF during DCF init.

---
 drivers/net/ice/ice_dcf.c | 54 ++++++++++++++++++++++++++++++++++++++-
 drivers/net/ice/ice_dcf.h |  3 +++
 2 files changed, 56 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +53 -1
index 0cd5d1bf6..93fabd5f7 100644
@@ -233,7 +233,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)
 
 	caps = VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | VIRTCHNL_VF_OFFLOAD_RX_POLLING |
 	       VIRTCHNL_VF_CAP_ADV_LINK_SPEED | VIRTCHNL_VF_CAP_DCF |
-	       VF_BASE_MODE_OFFLOADS;
+	       VF_BASE_MODE_OFFLOADS | VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC;
 
 	err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES,
 					  (uint8_t *)&caps, sizeof(caps));
@@ -547,6 +547,30 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw)
 	return err;
 }
 
+static int
+ice_dcf_get_supported_rxdid(struct ice_dcf_hw *hw)
+{
+	int err;
+
+	err = ice_dcf_send_cmd_req_no_irq(hw,
+					  VIRTCHNL_OP_GET_SUPPORTED_RXDIDS,
+					  NULL, 0);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to send OP_GET_SUPPORTED_RXDIDS");
+		return -1;
+	}
+
+	err = ice_dcf_recv_cmd_rsp_no_irq(hw, VIRTCHNL_OP_GET_SUPPORTED_RXDIDS,
+					  (uint8_t *)&hw->supported_rxdid,
+					  sizeof(uint64_t), NULL);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to get response of OP_GET_SUPPORTED_RXDIDS");
+		return -1;
+	}
+
+	return 0;
+}
+
 int
 ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 {
@@ -620,6 +644,29 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 		goto err_alloc;
 	}
 
+	/* Allocate memory for RSS info */
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
+		hw->rss_key = rte_zmalloc(NULL,
+					  hw->vf_res->rss_key_size, 0);
+		if (!hw->rss_key) {
+			PMD_INIT_LOG(ERR, "unable to allocate rss_key memory");
+			goto err_alloc;
+		}
+		hw->rss_lut = rte_zmalloc("rss_lut",
+					  hw->vf_res->rss_lut_size, 0);
+		if (!hw->rss_lut) {
+			PMD_INIT_LOG(ERR, "unable to allocate rss_lut memory");
+			goto err_rss;
+		}
+	}
+
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) {
+		if (ice_dcf_get_supported_rxdid(hw) != 0) {
+			PMD_INIT_LOG(ERR, "failed to do get supported rxdid");
+			goto err_rss;
+		}
+	}
+
 	hw->eth_dev = eth_dev;
 	rte_intr_callback_register(&pci_dev->intr_handle,
 				   ice_dcf_dev_interrupt_handler, hw);
@@ -628,6 +675,9 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 
 	return 0;
 
+err_rss:
+	rte_free(hw->rss_key);
+	rte_free(hw->rss_lut);
 err_alloc:
 	rte_free(hw->vf_res);
 err_api:
@@ -655,4 +705,6 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	rte_free(hw->arq_buf);
 	rte_free(hw->vf_vsi_map);
 	rte_free(hw->vf_res);
+	rte_free(hw->rss_lut);
+	rte_free(hw->rss_key);
 }
drivers/net/ice/ice_dcf.h +3 -0
index d2e447b48..152266e3c 100644
@@ -50,6 +50,9 @@ struct ice_dcf_hw {
 	uint16_t vsi_id;
 
 	struct rte_eth_dev *eth_dev;
+	uint8_t *rss_lut;
+	uint8_t *rss_key;
+	uint64_t supported_rxdid;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/12 net/ice: complete device info get in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to get complete device information for DCF, including Rx/Tx offload capabilities and default configuration.

---
 drivers/net/ice/ice_dcf_ethdev.c | 72 ++++++++++++++++++++++++++++++--
 1 file changed, 69 insertions(+), 3 deletions(-)
drivers/net/ice/ice_dcf_ethdev.c +69 -3
index e5ba1a61f..7f24ef81a 100644
@@ -24,6 +24,7 @@
 
 #include "ice_generic_flow.h"
 #include "ice_dcf_ethdev.h"
+#include "ice_rxtx.h"
 
 static uint16_t
 ice_dcf_recv_pkts(__rte_unused void *rx_queue,
@@ -66,11 +67,76 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev,
 		     struct rte_eth_dev_info *dev_info)
 {
 	struct ice_dcf_adapter *adapter = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &adapter->real_hw;
 
 	dev_info->max_mac_addrs = 1;
-	dev_info->max_rx_pktlen = (uint32_t)-1;
-	dev_info->max_rx_queues = RTE_DIM(adapter->rxqs);
-	dev_info->max_tx_queues = RTE_DIM(adapter->txqs);
+	dev_info->max_rx_queues = hw->vsi_res->num_queue_pairs;
+	dev_info->max_tx_queues = hw->vsi_res->num_queue_pairs;
+	dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN;
+	dev_info->max_rx_pktlen = ICE_FRAME_SIZE_MAX;
+	dev_info->hash_key_size = hw->vf_res->rss_key_size;
+	dev_info->reta_size = hw->vf_res->rss_lut_size;
+	dev_info->flow_type_rss_offloads = ICE_RSS_OFFLOAD_ALL;
+
+	dev_info->rx_offload_capa =
+		DEV_RX_OFFLOAD_VLAN_STRIP |
+		DEV_RX_OFFLOAD_QINQ_STRIP |
+		DEV_RX_OFFLOAD_IPV4_CKSUM |
+		DEV_RX_OFFLOAD_UDP_CKSUM |
+		DEV_RX_OFFLOAD_TCP_CKSUM |
+		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
+		DEV_RX_OFFLOAD_SCATTER |
+		DEV_RX_OFFLOAD_JUMBO_FRAME |
+		DEV_RX_OFFLOAD_VLAN_FILTER |
+		DEV_RX_OFFLOAD_RSS_HASH;
+	dev_info->tx_offload_capa =
+		DEV_TX_OFFLOAD_VLAN_INSERT |
+		DEV_TX_OFFLOAD_QINQ_INSERT |
+		DEV_TX_OFFLOAD_IPV4_CKSUM |
+		DEV_TX_OFFLOAD_UDP_CKSUM |
+		DEV_TX_OFFLOAD_TCP_CKSUM |
+		DEV_TX_OFFLOAD_SCTP_CKSUM |
+		DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+		DEV_TX_OFFLOAD_TCP_TSO |
+		DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+		DEV_TX_OFFLOAD_GRE_TNL_TSO |
+		DEV_TX_OFFLOAD_IPIP_TNL_TSO |
+		DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
+		DEV_TX_OFFLOAD_MULTI_SEGS;
+
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_thresh = {
+			.pthresh = ICE_DEFAULT_RX_PTHRESH,
+			.hthresh = ICE_DEFAULT_RX_HTHRESH,
+			.wthresh = ICE_DEFAULT_RX_WTHRESH,
+		},
+		.rx_free_thresh = ICE_DEFAULT_RX_FREE_THRESH,
+		.rx_drop_en = 0,
+		.offloads = 0,
+	};
+
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_thresh = {
+			.pthresh = ICE_DEFAULT_TX_PTHRESH,
+			.hthresh = ICE_DEFAULT_TX_HTHRESH,
+			.wthresh = ICE_DEFAULT_TX_WTHRESH,
+		},
+		.tx_free_thresh = ICE_DEFAULT_TX_FREE_THRESH,
+		.tx_rs_thresh = ICE_DEFAULT_TX_RSBIT_THRESH,
+		.offloads = 0,
+	};
+
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = ICE_MAX_RING_DESC,
+		.nb_min = ICE_MIN_RING_DESC,
+		.nb_align = ICE_ALIGN_RING_DESC,
+	};
+
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = ICE_MAX_RING_DESC,
+		.nb_min = ICE_MIN_RING_DESC,
+		.nb_align = ICE_ALIGN_RING_DESC,
+	};
 
 	return 0;
 }
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH 3/12 net/ice: complete dev configure in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable device configuration function in DCF.

---
 drivers/net/ice/ice_dcf_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/ice/ice_dcf_ethdev.c +9 -0
index 7f24ef81a..e8bed1362 100644
@@ -59,6 +59,15 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 static int
 ice_dcf_dev_configure(__rte_unused struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
#4 lore raw

Re: [dpdk-dev] [PATCH v1 03/12] net/ice: complete dev configure in DCF

Quoted 14 lines · Ting Xu

From: Qi Zhang <[email protected]>

Enable device configuration function in DCF.

---
drivers/net/ice/ice_dcf_ethdev.c | 9 +++++++++

1 file changed, 9 insertions(+)
drivers/net/ice/ice_dcf_ethdev.c +0 -0
index 7f24ef81a..e8bed1362 100644
@@ -59,6 +59,15 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
Quoted 2 lines

static int
ice_dcf_dev_configure(__rte_unused struct rte_eth_dev *dev)

__rte_unused tag should be removed.

Quoted 16 lines

{

drivers/net/ice/ice_dcf_ethdev.c +9 -0
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+
	return 0;
}
Signature · 1 line
2.17.1
author
#5 lore raw

PATCH 4/12 net/ice: complete queue setup in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Delete original DCF queue setup functions and use ice queue setup and release functions instead.

---
 drivers/net/ice/ice_dcf_ethdev.c | 42 +++-----------------------------
 drivers/net/ice/ice_dcf_ethdev.h |  3 ---
 drivers/net/ice/ice_dcf_parent.c |  7 ++++++
 3 files changed, 11 insertions(+), 41 deletions(-)
drivers/net/ice/ice_dcf_ethdev.c +4 -38
index e8bed1362..df906cd54 100644
@@ -231,11 +231,6 @@ ice_dcf_dev_close(struct rte_eth_dev *dev)
 	ice_dcf_uninit_hw(dev, &adapter->real_hw);
 }
 
-static void
-ice_dcf_queue_release(__rte_unused void *q)
-{
-}
-
 static int
 ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev,
 		    __rte_unused int wait_to_complete)
@@ -243,45 +238,16 @@ ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev,
 	return 0;
 }
 
-static int
-ice_dcf_rx_queue_setup(struct rte_eth_dev *dev,
-		       uint16_t rx_queue_id,
-		       __rte_unused uint16_t nb_rx_desc,
-		       __rte_unused unsigned int socket_id,
-		       __rte_unused const struct rte_eth_rxconf *rx_conf,
-		       __rte_unused struct rte_mempool *mb_pool)
-{
-	struct ice_dcf_adapter *adapter = dev->data->dev_private;
-
-	dev->data->rx_queues[rx_queue_id] = &adapter->rxqs[rx_queue_id];
-
-	return 0;
-}
-
-static int
-ice_dcf_tx_queue_setup(struct rte_eth_dev *dev,
-		       uint16_t tx_queue_id,
-		       __rte_unused uint16_t nb_tx_desc,
-		       __rte_unused unsigned int socket_id,
-		       __rte_unused const struct rte_eth_txconf *tx_conf)
-{
-	struct ice_dcf_adapter *adapter = dev->data->dev_private;
-
-	dev->data->tx_queues[tx_queue_id] = &adapter->txqs[tx_queue_id];
-
-	return 0;
-}
-
 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_configure           = ice_dcf_dev_configure,
 	.dev_infos_get           = ice_dcf_dev_info_get,
-	.rx_queue_setup          = ice_dcf_rx_queue_setup,
-	.tx_queue_setup          = ice_dcf_tx_queue_setup,
-	.rx_queue_release        = ice_dcf_queue_release,
-	.tx_queue_release        = ice_dcf_queue_release,
+	.rx_queue_setup          = ice_rx_queue_setup,
+	.tx_queue_setup          = ice_tx_queue_setup,
+	.rx_queue_release        = ice_rx_queue_release,
+	.tx_queue_release        = ice_tx_queue_release,
 	.link_update             = ice_dcf_link_update,
 	.stats_get               = ice_dcf_stats_get,
 	.stats_reset             = ice_dcf_stats_reset,
drivers/net/ice/ice_dcf_ethdev.h +0 -3
index e60e808d8..b54528bea 100644
@@ -19,10 +19,7 @@ struct ice_dcf_queue {
 
 struct ice_dcf_adapter {
 	struct ice_adapter parent; /* Must be first */
-
 	struct ice_dcf_hw real_hw;
-	struct ice_dcf_queue rxqs[ICE_DCF_MAX_RINGS];
-	struct ice_dcf_queue txqs[ICE_DCF_MAX_RINGS];
 };
 
 void ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw,
drivers/net/ice/ice_dcf_parent.c +7 -0
index bdfc7d430..f9c7d9737 100644
@@ -335,6 +335,13 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)
 	parent_adapter->eth_dev = eth_dev;
 	parent_adapter->pf.adapter = parent_adapter;
 	parent_adapter->pf.dev_data = eth_dev->data;
+	/* create a dummy main_vsi */
+	parent_adapter->pf.main_vsi =
+		rte_zmalloc(NULL, sizeof(struct ice_vsi), 0);
+	if (!parent_adapter->pf.main_vsi)
+		return -ENOMEM;
+	parent_adapter->pf.main_vsi->adapter = parent_adapter;
+
 	parent_hw->back = parent_adapter;
 	parent_hw->mac_type = ICE_MAC_GENERIC;
 	parent_hw->vendor_id = ICE_INTEL_VENDOR_ID;
Signature · 1 line
2.17.1
author
#6 lore raw

PATCH 5/12 net/ice: add stop flag for device start / stop

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add stop flag for DCF device start and stop.

---
 drivers/net/ice/ice_dcf_ethdev.c | 12 ++++++++++++
 drivers/net/ice/ice_dcf_parent.c |  1 +
 2 files changed, 13 insertions(+)
drivers/net/ice/ice_dcf_ethdev.c +12 -0
index df906cd54..62ef71ddb 100644
@@ -45,6 +45,11 @@ ice_dcf_xmit_pkts(__rte_unused void *tx_queue,
 static int
 ice_dcf_dev_start(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	ad->pf.adapter_stopped = 0;
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
@@ -53,7 +58,14 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 static void
 ice_dcf_dev_stop(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	if (ad->pf.adapter_stopped == 1)
+		return;
+
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
+	ad->pf.adapter_stopped = 1;
 }
 
 static int
drivers/net/ice/ice_dcf_parent.c +1 -0
index f9c7d9737..8ad8bea1a 100644
@@ -341,6 +341,7 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)
 	if (!parent_adapter->pf.main_vsi)
 		return -ENOMEM;
 	parent_adapter->pf.main_vsi->adapter = parent_adapter;
+	parent_adapter->pf.adapter_stopped = 1;
 
 	parent_hw->back = parent_adapter;
 	parent_hw->mac_type = ICE_MAC_GENERIC;
Signature · 1 line
2.17.1
author
#7 lore raw

PATCH 6/12 net/ice: add Rx queue init in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable Rx queues initialization during device start in DCF.

---
 drivers/net/ice/ice_dcf.h        |  1 +
 drivers/net/ice/ice_dcf_ethdev.c | 83 ++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)
drivers/net/ice/ice_dcf.h +1 -0
index 152266e3c..dcb2a0283 100644
@@ -53,6 +53,7 @@ struct ice_dcf_hw {
 	uint8_t *rss_lut;
 	uint8_t *rss_key;
 	uint64_t supported_rxdid;
+	uint16_t num_queue_pairs;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
drivers/net/ice/ice_dcf_ethdev.c +83 -0

97 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#8 lore raw

PATCH 7/12 net/ice: init RSS during DCF start

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable RSS initialization during DCF start. Add RSS LUT and RSS key configuration functions.

---
 drivers/net/ice/ice_dcf.c        | 123 +++++++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |   1 +
 drivers/net/ice/ice_dcf_ethdev.c |  14 +++-
 3 files changed, 135 insertions(+), 3 deletions(-)
drivers/net/ice/ice_dcf.c +123 -0
index 93fabd5f7..8d078163e 100644
@@ -708,3 +708,126 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	rte_free(hw->rss_lut);
 	rte_free(hw->rss_key);
 }
+
+static int
+ice_dcf_configure_rss_key(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_rss_key *rss_key;
+	struct dcf_virtchnl_cmd args;
+	int len, err;
+
+	len = sizeof(*rss_key) + hw->vf_res->rss_key_size - 1;
+	rss_key = rte_zmalloc("rss_key", len, 0);
+	if (!rss_key)
+		return -ENOMEM;
+
+	rss_key->vsi_id = hw->vsi_res->vsi_id;
+	rss_key->key_len = hw->vf_res->rss_key_size;
+	rte_memcpy(rss_key->key, hw->rss_key, hw->vf_res->rss_key_size);
+
+	args.v_op = VIRTCHNL_OP_CONFIG_RSS_KEY;
+	args.req_msglen = len;
+	args.req_msg = (uint8_t *)rss_key;
+	args.rsp_msglen = 0;
+	args.rsp_buflen = 0;
+	args.rsp_msgbuf = NULL;
+	args.pending = 0;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_KEY");
+		return err;
+	}
+
+	rte_free(rss_key);
+	return 0;
+}
+
+static int
+ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_rss_lut *rss_lut;
+	struct dcf_virtchnl_cmd args;
+	int len, err;
+
+	len = sizeof(*rss_lut) + hw->vf_res->rss_lut_size - 1;
+	rss_lut = rte_zmalloc("rss_lut", len, 0);
+	if (!rss_lut)
+		return -ENOMEM;
+
+	rss_lut->vsi_id = hw->vsi_res->vsi_id;
+	rss_lut->lut_entries = hw->vf_res->rss_lut_size;
+	rte_memcpy(rss_lut->lut, hw->rss_lut, hw->vf_res->rss_lut_size);
+
+	args.v_op = VIRTCHNL_OP_CONFIG_RSS_LUT;
+	args.req_msglen = len;
+	args.req_msg = (uint8_t *)rss_lut;
+	args.rsp_msglen = 0;
+	args.rsp_buflen = 0;
+	args.rsp_msgbuf = NULL;
+	args.pending = 0;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_LUT");
+		return err;
+	}
+
+	rte_free(rss_lut);
+	return 0;
+}
+
+int
+ice_dcf_init_rss(struct ice_dcf_hw *hw)
+{
+	struct rte_eth_dev *dev = hw->eth_dev;
+	struct rte_eth_rss_conf *rss_conf;
+	uint8_t i, j, nb_q;
+	int ret;
+
+	rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = dev->data->nb_rx_queues;
+
+	if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF)) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+	if (dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
+		PMD_DRV_LOG(WARNING, "RSS is enabled by PF by default");
+		/* set all lut items to default queue */
+		for (i = 0; i < hw->vf_res->rss_lut_size; i++)
+			hw->rss_lut[i] = 0;
+		ret = ice_dcf_configure_rss_lut(hw);
+		return ret;
+	}
+
+	/* In IAVF, RSS enablement is set by PF driver. It is not supported
+	 * to set based on rss_conf->rss_hf.
+	 */
+
+	/* configure RSS key */
+	if (!rss_conf->rss_key)
+		/* Calculate the default hash key */
+		for (i = 0; i <= hw->vf_res->rss_key_size; i++)
+			hw->rss_key[i] = (uint8_t)rte_rand();
+	else
+		rte_memcpy(hw->rss_key, rss_conf->rss_key,
+			   RTE_MIN(rss_conf->rss_key_len,
+				   hw->vf_res->rss_key_size));
+
+	/* init RSS LUT table */
+	for (i = 0, j = 0; i < hw->vf_res->rss_lut_size; i++, j++) {
+		if (j >= nb_q)
+			j = 0;
+		hw->rss_lut[i] = j;
+	}
+	/* send virtchnnl ops to configure rss*/
+	ret = ice_dcf_configure_rss_lut(hw);
+	if (ret)
+		return ret;
+	ret = ice_dcf_configure_rss_key(hw);
+	if (ret)
+		return ret;
+
+	return 0;
+}
drivers/net/ice/ice_dcf.h +1 -0
index dcb2a0283..eea4b286b 100644
@@ -63,5 +63,6 @@ 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_init_rss(struct ice_dcf_hw *hw);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +11 -3
index 1f7474dc3..5fbf70803 100644
@@ -51,9 +51,9 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq)
 	uint16_t buf_size, max_pkt_len, len;
 
 	buf_size = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM;
-
-	/* Calculate the maximum packet length allowed */
-	len = rxq->rx_buf_len * IAVF_MAX_CHAINED_RX_BUFFERS;
+	rxq->rx_hdr_len = 0;
+	rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << ICE_RLAN_CTX_DBUF_S));
+	len = ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len;
 	max_pkt_len = RTE_MIN(len, dev->data->dev_conf.rxmode.max_rx_pkt_len);
 
 	/* Check if the jumbo frame and maximum packet length are set
@@ -133,6 +133,14 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
+		ret = ice_dcf_init_rss(hw);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "Failed to configure RSS");
+			return ret;
+		}
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
Signature · 1 line
2.17.1
#9 lore raw

Re: [dpdk-dev] [PATCH v1 07/12] net/ice: init RSS during DCF start

Quoted 38 lines · Ting Xu

From: Qi Zhang <[email protected]>

Enable RSS initialization during DCF start. Add RSS LUT and RSS key configuration functions.

---

drivers/net/ice/ice_dcf.c        | 123 +++++++++++++++++++++++++++++++
drivers/net/ice/ice_dcf.h        |   1 +
drivers/net/ice/ice_dcf_ethdev.c |  14 +++-
3 files changed, 135 insertions(+), 3 deletions(-)
drivers/net/ice/ice_dcf.c +18 -0
index 93fabd5f7..8d078163e 100644
@@ -708,3 +708,126 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	rte_free(hw->rss_lut);
 	rte_free(hw->rss_key);
 }
+
+static int
+ice_dcf_configure_rss_key(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_rss_key *rss_key;
+	struct dcf_virtchnl_cmd args;
+	int len, err;
+
+	len = sizeof(*rss_key) + hw->vf_res->rss_key_size - 1;
+	rss_key = rte_zmalloc("rss_key", len, 0);
+	if (!rss_key)
+		return -ENOMEM;
+
+	rss_key->vsi_id = hw->vsi_res->vsi_id;
+	rss_key->key_len = hw->vf_res->rss_key_size;
+	rte_memcpy(rss_key->key, hw->rss_key, hw->vf_res->rss_key_size);
+
+	args.v_op = VIRTCHNL_OP_CONFIG_RSS_KEY;

drivers/net/ice/ice_dcf.c ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) · line 738

Quoted 10 lines
drivers/net/ice/ice_dcf.c +10 -0
+	args.req_msglen = len;
+	args.req_msg = (uint8_t *)rss_key;
+	args.rsp_msglen = 0;
+	args.rsp_buflen = 0;
+	args.rsp_msgbuf = NULL;
+	args.pending = 0;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_KEY");

Need to free rss_key in error handling as well.

Quoted 24 lines
drivers/net/ice/ice_dcf.c +24 -0
+		return err;
+	}
+
+	rte_free(rss_key);
+	return 0;
+}
+
+static int
+ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_rss_lut *rss_lut;
+	struct dcf_virtchnl_cmd args;
+	int len, err;
+
+	len = sizeof(*rss_lut) + hw->vf_res->rss_lut_size - 1;
+	rss_lut = rte_zmalloc("rss_lut", len, 0);
+	if (!rss_lut)
+		return -ENOMEM;
+
+	rss_lut->vsi_id = hw->vsi_res->vsi_id;
+	rss_lut->lut_entries = hw->vf_res->rss_lut_size;
+	rte_memcpy(rss_lut->lut, hw->rss_lut, hw->vf_res->rss_lut_size);
+
+	args.v_op = VIRTCHNL_OP_CONFIG_RSS_LUT;

drivers/net/ice/ice_dcf.c ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) · line 772

Quoted 10 lines
drivers/net/ice/ice_dcf.c +10 -0
+	args.req_msglen = len;
+	args.req_msg = (uint8_t *)rss_lut;
+	args.rsp_msglen = 0;
+	args.rsp_buflen = 0;
+	args.rsp_msgbuf = NULL;
+	args.pending = 0;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_LUT");

Need to free rss_lut here.

Quoted 17 lines
drivers/net/ice/ice_dcf.c +17 -0
+		return err;
+	}
+
+	rte_free(rss_lut);
+	return 0;
+}
+
+int
+ice_dcf_init_rss(struct ice_dcf_hw *hw)
+{
+	struct rte_eth_dev *dev = hw->eth_dev;
+	struct rte_eth_rss_conf *rss_conf;
+	uint8_t i, j, nb_q;
+	int ret;
+
+	rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = dev->data->nb_rx_queues;

drivers/net/ice/ice_dcf.c ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) · line 799

Quoted 10 lines
drivers/net/ice/ice_dcf.c +10 -0
+
+	if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF)) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+	if (dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
+		PMD_DRV_LOG(WARNING, "RSS is enabled by PF by default");
+		/* set all lut items to default queue */
+		for (i = 0; i < hw->vf_res->rss_lut_size; i++)
+			hw->rss_lut[i] = 0;

How about memset(hw->rss_lut, 0, hw->vf_res->rss_lut_size);

drivers/net/ice/ice_dcf.c ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) · line 801

Quoted 2 lines
drivers/net/ice/ice_dcf.c +2 -0
+		ret = ice_dcf_configure_rss_lut(hw);
+		return ret;

return ice_dcf_configure_rss_lut(hw);

drivers/net/ice/ice_dcf.c ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) · line 812

Quoted 11 lines
drivers/net/ice/ice_dcf.c +11 -0
+	}
+
+	/* In IAVF, RSS enablement is set by PF driver. It is not supported
+	 * to set based on rss_conf->rss_hf.
+	 */
+
+	/* configure RSS key */
+	if (!rss_conf->rss_key)
+		/* Calculate the default hash key */
+		for (i = 0; i <= hw->vf_res->rss_key_size; i++)
+			hw->rss_key[i] = (uint8_t)rte_rand();

Why use <=, will it cause out-of-bounds access?

Quoted 37 lines
drivers/net/ice/ice_dcf.c +21 -0
+	else
+		rte_memcpy(hw->rss_key, rss_conf->rss_key,
+			   RTE_MIN(rss_conf->rss_key_len,
+				   hw->vf_res->rss_key_size));
+
+	/* init RSS LUT table */
+	for (i = 0, j = 0; i < hw->vf_res->rss_lut_size; i++, j++) {
+		if (j >= nb_q)
+			j = 0;
+		hw->rss_lut[i] = j;
+	}
+	/* send virtchnnl ops to configure rss*/
+	ret = ice_dcf_configure_rss_lut(hw);
+	if (ret)
+		return ret;
+	ret = ice_dcf_configure_rss_key(hw);
+	if (ret)
+		return ret;
+
+	return 0;
+}
drivers/net/ice/ice_dcf.h +1 -0
index dcb2a0283..eea4b286b 100644
@@ -63,5 +63,6 @@ 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_init_rss(struct ice_dcf_hw *hw);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +0 -0
index 1f7474dc3..5fbf70803 100644

drivers/net/ice/ice_dcf_ethdev.c ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq) · line 56

Quoted 9 lines
drivers/net/ice/ice_dcf_ethdev.c +3 -3
@@ -51,9 +51,9 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq)
 	uint16_t buf_size, max_pkt_len, len;
 
 	buf_size = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM;
-
-	/* Calculate the maximum packet length allowed */
-	len = rxq->rx_buf_len * IAVF_MAX_CHAINED_RX_BUFFERS;
+	rxq->rx_hdr_len = 0;
+	rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << ICE_RLAN_CTX_DBUF_S));
+	len = ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len;

Above change seems unrelated to this patch, what about squashing it to patch 6?

Thanks,
Xiaolong

Quoted 21 lines
drivers/net/ice/ice_dcf_ethdev.c +8 -0
 	max_pkt_len = RTE_MIN(len, dev->data->dev_conf.rxmode.max_rx_pkt_len);
 
 	/* Check if the jumbo frame and maximum packet length are set
@@ -133,6 +133,14 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
+		ret = ice_dcf_init_rss(hw);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "Failed to configure RSS");
+			return ret;
+		}
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
Signature · 1 line
2.17.1
author
#10 lore raw

PATCH 8/12 net/ice: add queue config in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add queues and Rx queue irqs configuration during device start in DCF. The setup is sent to PF via virtchnl.

---
 drivers/net/ice/ice_dcf.c        | 109 +++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |   6 ++
 drivers/net/ice/ice_dcf_ethdev.c | 125 +++++++++++++++++++++++++++++++
 3 files changed, 240 insertions(+)
drivers/net/ice/ice_dcf.c +109 -0
index 8d078163e..d864ae894 100644
@@ -24,6 +24,7 @@
 #include <rte_dev.h>
 
 #include "ice_dcf.h"
+#include "ice_rxtx.h"
 
 #define ICE_DCF_AQ_LEN     32
 #define ICE_DCF_AQ_BUF_SZ  4096
@@ -831,3 +832,111 @@ ice_dcf_init_rss(struct ice_dcf_hw *hw)
 
 	return 0;
 }
+
+#define IAVF_RXDID_LEGACY_1 1
+#define IAVF_RXDID_COMMS_GENERIC 16
+
+int
+ice_dcf_configure_queues(struct ice_dcf_hw *hw)
+{
+	struct ice_rx_queue **rxq =
+		(struct ice_rx_queue **)hw->eth_dev->data->rx_queues;
+	struct ice_tx_queue **txq =
+		(struct ice_tx_queue **)hw->eth_dev->data->tx_queues;
+	struct virtchnl_vsi_queue_config_info *vc_config;
+	struct virtchnl_queue_pair_info *vc_qp;
+	struct dcf_virtchnl_cmd args;
+	uint16_t i, size;
+	int err;
+
+	size = sizeof(*vc_config) +
+	       sizeof(vc_config->qpair[0]) * hw->num_queue_pairs;
+	vc_config = rte_zmalloc("cfg_queue", size, 0);
+	if (!vc_config)
+		return -ENOMEM;
+
+	vc_config->vsi_id = hw->vsi_res->vsi_id;
+	vc_config->num_queue_pairs = hw->num_queue_pairs;
+
+	for (i = 0, vc_qp = vc_config->qpair;
+	     i < hw->num_queue_pairs;
+	     i++, vc_qp++) {
+		vc_qp->txq.vsi_id = hw->vsi_res->vsi_id;
+		vc_qp->txq.queue_id = i;
+		if (i < hw->eth_dev->data->nb_tx_queues) {
+			vc_qp->txq.ring_len = txq[i]->nb_tx_desc;
+			vc_qp->txq.dma_ring_addr = txq[i]->tx_ring_dma;
+		}
+		vc_qp->rxq.vsi_id = hw->vsi_res->vsi_id;
+		vc_qp->rxq.queue_id = i;
+		vc_qp->rxq.max_pkt_size = rxq[i]->max_pkt_len;
+		if (i < hw->eth_dev->data->nb_rx_queues) {
+			vc_qp->rxq.ring_len = rxq[i]->nb_rx_desc;
+			vc_qp->rxq.dma_ring_addr = rxq[i]->rx_ring_dma;
+			vc_qp->rxq.databuffer_size = rxq[i]->rx_buf_len;
+
+			if (hw->vf_res->vf_cap_flags &
+			    VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC &&
+			    hw->supported_rxdid &
+			    BIT(IAVF_RXDID_COMMS_GENERIC)) {
+				vc_qp->rxq.rxdid = IAVF_RXDID_COMMS_GENERIC;
+				PMD_DRV_LOG(NOTICE, "request RXDID == %d in "
+					    "Queue[%d]", vc_qp->rxq.rxdid, i);
+			} else {
+				PMD_DRV_LOG(ERR, "RXDID 16 is not supported");
+				return -EINVAL;
+			}
+		}
+	}
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_CONFIG_VSI_QUEUES;
+	args.req_msg = (uint8_t *)vc_config;
+	args.req_msglen = size;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "Failed to execute command of"
+			    " VIRTCHNL_OP_CONFIG_VSI_QUEUES");
+
+	rte_free(vc_config);
+	return err;
+}
+
+int
+ice_dcf_config_irq_map(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_irq_map_info *map_info;
+	struct virtchnl_vector_map *vecmap;
+	struct dcf_virtchnl_cmd args;
+	int len, i, err;
+
+	len = sizeof(struct virtchnl_irq_map_info) +
+	      sizeof(struct virtchnl_vector_map) * hw->nb_msix;
+
+	map_info = rte_zmalloc("map_info", len, 0);
+	if (!map_info)
+		return -ENOMEM;
+
+	map_info->num_vectors = hw->nb_msix;
+	for (i = 0; i < hw->nb_msix; i++) {
+		vecmap = &map_info->vecmap[i];
+		vecmap->vsi_id = hw->vsi_res->vsi_id;
+		vecmap->rxitr_idx = 0;
+		vecmap->vector_id = hw->msix_base + i;
+		vecmap->txq_map = 0;
+		vecmap->rxq_map = hw->rxq_map[hw->msix_base + i];
+	}
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_CONFIG_IRQ_MAP;
+	args.req_msg = (u8 *)map_info;
+	args.req_msglen = len;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command OP_CONFIG_IRQ_MAP");
+
+	rte_free(map_info);
+	return err;
+}
drivers/net/ice/ice_dcf.h +6 -0
index eea4b286b..9470d1df7 100644
@@ -54,6 +54,10 @@ struct ice_dcf_hw {
 	uint8_t *rss_key;
 	uint64_t supported_rxdid;
 	uint16_t num_queue_pairs;
+
+	uint16_t msix_base;
+	uint16_t nb_msix;
+	uint16_t rxq_map[16];
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
@@ -64,5 +68,7 @@ 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_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);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +125 -0

141 lines not on this page · raw message

Signature · 1 line
2.17.1
#11 lore raw

Re: [dpdk-dev] [PATCH v1 08/12] net/ice: add queue config in DCF

Quoted 57 lines · Ting Xu

From: Qi Zhang <[email protected]>

Add queues and Rx queue irqs configuration during device start in DCF. The setup is sent to PF via virtchnl.

---

drivers/net/ice/ice_dcf.c        | 109 +++++++++++++++++++++++++++
drivers/net/ice/ice_dcf.h        |   6 ++
drivers/net/ice/ice_dcf_ethdev.c | 125 +++++++++++++++++++++++++++++++
3 files changed, 240 insertions(+)
drivers/net/ice/ice_dcf.c +30 -0
index 8d078163e..d864ae894 100644
@@ -24,6 +24,7 @@
 #include <rte_dev.h>
 
 #include "ice_dcf.h"
+#include "ice_rxtx.h"
 
 #define ICE_DCF_AQ_LEN     32
 #define ICE_DCF_AQ_BUF_SZ  4096
@@ -831,3 +832,111 @@ ice_dcf_init_rss(struct ice_dcf_hw *hw)
 
 	return 0;
 }
+
+#define IAVF_RXDID_LEGACY_1 1
+#define IAVF_RXDID_COMMS_GENERIC 16
+
+int
+ice_dcf_configure_queues(struct ice_dcf_hw *hw)
+{
+	struct ice_rx_queue **rxq =
+		(struct ice_rx_queue **)hw->eth_dev->data->rx_queues;
+	struct ice_tx_queue **txq =
+		(struct ice_tx_queue **)hw->eth_dev->data->tx_queues;
+	struct virtchnl_vsi_queue_config_info *vc_config;
+	struct virtchnl_queue_pair_info *vc_qp;
+	struct dcf_virtchnl_cmd args;
+	uint16_t i, size;
+	int err;
+
+	size = sizeof(*vc_config) +
+	       sizeof(vc_config->qpair[0]) * hw->num_queue_pairs;
+	vc_config = rte_zmalloc("cfg_queue", size, 0);
+	if (!vc_config)
+		return -ENOMEM;
+
+	vc_config->vsi_id = hw->vsi_res->vsi_id;
+	vc_config->num_queue_pairs = hw->num_queue_pairs;
+
+	for (i = 0, vc_qp = vc_config->qpair;
+	     i < hw->num_queue_pairs;
+	     i++, vc_qp++) {

drivers/net/ice/ice_dcf.c ice_dcf_init_rss(struct ice_dcf_hw *hw) · line 873

Quoted 10 lines
drivers/net/ice/ice_dcf.c +10 -0
+		vc_qp->txq.vsi_id = hw->vsi_res->vsi_id;
+		vc_qp->txq.queue_id = i;
+		if (i < hw->eth_dev->data->nb_tx_queues) {
+			vc_qp->txq.ring_len = txq[i]->nb_tx_desc;
+			vc_qp->txq.dma_ring_addr = txq[i]->tx_ring_dma;
+		}
+		vc_qp->rxq.vsi_id = hw->vsi_res->vsi_id;
+		vc_qp->rxq.queue_id = i;
+		vc_qp->rxq.max_pkt_size = rxq[i]->max_pkt_len;
+		if (i < hw->eth_dev->data->nb_rx_queues) {

What about changing as below to reduce the nested level of if blocks.

		if (i >= hw->eth_dev->data->nb_rx_queues)
			break;

		vc_qp->rxq.ring_len = rxq[i]->nb_rx_desc;
		vc_qp->rxq.dma_ring_addr = rxq[i]->rx_ring_dma;
		vc_qp->rxq.databuffer_size = rxq[i]->rx_buf_len;

		...
		}
Quoted 10 lines
drivers/net/ice/ice_dcf.c +10 -0
+			vc_qp->rxq.ring_len = rxq[i]->nb_rx_desc;
+			vc_qp->rxq.dma_ring_addr = rxq[i]->rx_ring_dma;
+			vc_qp->rxq.databuffer_size = rxq[i]->rx_buf_len;
+
+			if (hw->vf_res->vf_cap_flags &
+			    VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC &&
+			    hw->supported_rxdid &
+			    BIT(IAVF_RXDID_COMMS_GENERIC)) {
+				vc_qp->rxq.rxdid = IAVF_RXDID_COMMS_GENERIC;
+				PMD_DRV_LOG(NOTICE, "request RXDID == %d in "

[snip]

drivers/net/ice/ice_dcf.c

Quoted 12 lines
drivers/net/ice/ice_dcf.c +12 -0
+static inline uint16_t
+iavf_calc_itr_interval(int16_t interval)
+{
+	if (interval < 0 || interval > IAVF_QUEUE_ITR_INTERVAL_MAX)
+		interval = IAVF_QUEUE_ITR_INTERVAL_DEFAULT;
+
+	/* Convert to hardware count, as writing each 1 represents 2 us */
+	return interval / 2;
+}
+
+static int ice_dcf_config_rx_queues_irqs(struct rte_eth_dev *dev,
+				     struct rte_intr_handle *intr_handle)

put the return type in a separate line.

Quoted 79 lines
drivers/net/ice/ice_dcf.c +79 -0
+{
+	struct ice_dcf_adapter *adapter = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &adapter->real_hw;
+	uint16_t interval, i;
+	int vec;
+
+	if (rte_intr_cap_multiple(intr_handle) &&
+	    dev->data->dev_conf.intr_conf.rxq) {
+		if (rte_intr_efd_enable(intr_handle, dev->data->nb_rx_queues))
+			return -1;
+	}
+
+	if (rte_intr_dp_is_en(intr_handle) && !intr_handle->intr_vec) {
+		intr_handle->intr_vec =
+			rte_zmalloc("intr_vec",
+				    dev->data->nb_rx_queues * sizeof(int), 0);
+		if (!intr_handle->intr_vec) {
+			PMD_DRV_LOG(ERR, "Failed to allocate %d rx intr_vec",
+				    dev->data->nb_rx_queues);
+			return -1;
+		}
+	}
+
+	if (!dev->data->dev_conf.intr_conf.rxq ||
+	    !rte_intr_dp_is_en(intr_handle)) {
+		/* Rx interrupt disabled, Map interrupt only for writeback */
+		hw->nb_msix = 1;
+		if (hw->vf_res->vf_cap_flags &
+		    VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) {
+			/* If WB_ON_ITR supports, enable it */
+			hw->msix_base = IAVF_RX_VEC_START;
+			IAVF_WRITE_REG(&hw->avf,
+				       IAVF_VFINT_DYN_CTLN1(hw->msix_base - 1),
+				       IAVF_VFINT_DYN_CTLN1_ITR_INDX_MASK |
+				       IAVF_VFINT_DYN_CTLN1_WB_ON_ITR_MASK);
+		} else {
+			/* If no WB_ON_ITR offload flags, need to set
+			 * interrupt for descriptor write back.
+			 */
+			hw->msix_base = IAVF_MISC_VEC_ID;
+
+			/* set ITR to max */
+			interval =
+			iavf_calc_itr_interval(IAVF_QUEUE_ITR_INTERVAL_MAX);
+			IAVF_WRITE_REG(&hw->avf, IAVF_VFINT_DYN_CTL01,
+				       IAVF_VFINT_DYN_CTL01_INTENA_MASK |
+				       (IAVF_ITR_INDEX_DEFAULT <<
+					IAVF_VFINT_DYN_CTL01_ITR_INDX_SHIFT) |
+				       (interval <<
+					IAVF_VFINT_DYN_CTL01_INTERVAL_SHIFT));
+		}
+		IAVF_WRITE_FLUSH(&hw->avf);
+		/* map all queues to the same interrupt */
+		for (i = 0; i < dev->data->nb_rx_queues; i++)
+			hw->rxq_map[hw->msix_base] |= 1 << i;
+	} else {
+		if (!rte_intr_allow_others(intr_handle)) {
+			hw->nb_msix = 1;
+			hw->msix_base = IAVF_MISC_VEC_ID;
+			for (i = 0; i < dev->data->nb_rx_queues; i++) {
+				hw->rxq_map[hw->msix_base] |= 1 << i;
+				intr_handle->intr_vec[i] = IAVF_MISC_VEC_ID;
+			}
+			PMD_DRV_LOG(DEBUG,
+				    "vector %u are mapping to all Rx queues",
+				    hw->msix_base);
+		} else {
+			/* If Rx interrupt is reuquired, and we can use
+			 * multi interrupts, then the vec is from 1
+			 */
+			hw->nb_msix = RTE_MIN(hw->vf_res->max_vectors,
+					      intr_handle->nb_efd);
+			hw->msix_base = IAVF_MISC_VEC_ID;
+			vec = IAVF_MISC_VEC_ID;
+			for (i = 0; i < dev->data->nb_rx_queues; i++) {
+				hw->rxq_map[vec] |= 1 << i;
+				intr_handle->intr_vec[i] = vec++;
+				if (vec >= hw->nb_msix)
+					vec = IAVF_RX_VEC_START;

drivers/net/ice/ice_dcf.c

Quoted 10 lines
drivers/net/ice/ice_dcf.c +10 -0
+			}
+			PMD_DRV_LOG(DEBUG,
+				    "%u vectors are mapping to %u Rx queues",
+				    hw->nb_msix, dev->data->nb_rx_queues);
+		}
+	}
+
+	if (ice_dcf_config_irq_map(hw)) {
+		PMD_DRV_LOG(ERR, "config interrupt mapping failed");
+		return -1;

Do we need to free intr_handle->intr_vec here?

Quoted 34 lines
drivers/net/ice/ice_dcf.c +4 -0
+	}
+	return 0;
+}
+

static int
ice_dcf_dev_start(struct rte_eth_dev *dev)

{
	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
drivers/net/ice/ice_dcf.c +1 -0
+	struct rte_intr_handle *intr_handle = dev->intr_handle;
	struct ice_adapter *ad = &dcf_ad->parent;
	struct ice_dcf_hw *hw = &dcf_ad->real_hw;
	int ret;
drivers/net/ice/ice_dcf.c +12 -0
@@ -141,6 +254,18 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
+	ret = ice_dcf_configure_queues(hw);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Fail to config queues");
+		return ret;
+	}
+
+	ret = ice_dcf_config_rx_queues_irqs(dev, intr_handle);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Fail to config rx queues' irqs");
+		return ret;
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
Signature · 1 line
2.17.1
author
#12 lore raw

PATCH 9/12 net/ice: add queue start and stop for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add queue start and stop in DCF. Support queue enable and disable through virtual channel. Add support for Rx queue mbufs allocation and queue reset.

---
 drivers/net/ice/ice_dcf.c        |  57 ++++++
 drivers/net/ice/ice_dcf.h        |   3 +-
 drivers/net/ice/ice_dcf_ethdev.c | 309 +++++++++++++++++++++++++++++++
 3 files changed, 368 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +57 -0
index d864ae894..56b8c0d25 100644
@@ -940,3 +940,60 @@ ice_dcf_config_irq_map(struct ice_dcf_hw *hw)
 	rte_free(map_info);
 	return err;
 }
+
+int
+ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on)
+{
+	struct virtchnl_queue_select queue_select;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&queue_select, 0, sizeof(queue_select));
+	queue_select.vsi_id = hw->vsi_res->vsi_id;
+	if (rx)
+		queue_select.rx_queues |= 1 << qid;
+	else
+		queue_select.tx_queues |= 1 << qid;
+
+	memset(&args, 0, sizeof(args));
+	if (on)
+		args.v_op = VIRTCHNL_OP_ENABLE_QUEUES;
+	else
+		args.v_op = VIRTCHNL_OP_DISABLE_QUEUES;
+
+	args.req_msg = (u8 *)&queue_select;
+	args.req_msglen = sizeof(queue_select);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "Failed to execute command of %s",
+			    on ? "OP_ENABLE_QUEUES" : "OP_DISABLE_QUEUES");
+	return err;
+}
+
+int
+ice_dcf_disable_queues(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_queue_select queue_select;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&queue_select, 0, sizeof(queue_select));
+	queue_select.vsi_id = hw->vsi_res->vsi_id;
+
+	queue_select.rx_queues = BIT(hw->eth_dev->data->nb_rx_queues) - 1;
+	queue_select.tx_queues = BIT(hw->eth_dev->data->nb_tx_queues) - 1;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_DISABLE_QUEUES;
+	args.req_msg = (u8 *)&queue_select;
+	args.req_msglen = sizeof(queue_select);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err) {
+		PMD_DRV_LOG(ERR,
+			    "Failed to execute command of OP_DISABLE_QUEUES");
+		return err;
+	}
+	return 0;
+}
drivers/net/ice/ice_dcf.h +2 -1
index 9470d1df7..68e1661c0 100644
@@ -70,5 +70,6 @@ void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, 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);
-
+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);
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +309 -0

341 lines not on this page · raw message

Signature · 1 line
2.17.1
#13 lore raw

Re: [dpdk-dev] [PATCH v1 09/12] net/ice: add queue start and stop for DCF

Quoted 5 lines · Ting Xu

From: Qi Zhang <[email protected]>

Add queue start and stop in DCF. Support queue enable and disable through virtual channel. Add support for Rx queue mbufs allocation and queue reset.

There is one i40e patch [1] from qiming to correct the queue behavior as "when one queue fails to start, all following queues start action should be skipped and previous started queues should be cleaned, and for queue stop case, one queue stop failure shouldn't skip following queues stop action", I think it applies to this patch as well, add Qiming for more comments.

[1] https://patches.dpdk.org/patch/70362/

Quoted 62 lines

---

drivers/net/ice/ice_dcf.c        |  57 ++++++
drivers/net/ice/ice_dcf.h        |   3 +-
drivers/net/ice/ice_dcf_ethdev.c | 309 +++++++++++++++++++++++++++++++
3 files changed, 368 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +46 -0
index d864ae894..56b8c0d25 100644
@@ -940,3 +940,60 @@ ice_dcf_config_irq_map(struct ice_dcf_hw *hw)
 	rte_free(map_info);
 	return err;
 }
+
+int
+ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on)
+{
+	struct virtchnl_queue_select queue_select;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&queue_select, 0, sizeof(queue_select));
+	queue_select.vsi_id = hw->vsi_res->vsi_id;
+	if (rx)
+		queue_select.rx_queues |= 1 << qid;
+	else
+		queue_select.tx_queues |= 1 << qid;
+
+	memset(&args, 0, sizeof(args));
+	if (on)
+		args.v_op = VIRTCHNL_OP_ENABLE_QUEUES;
+	else
+		args.v_op = VIRTCHNL_OP_DISABLE_QUEUES;
+
+	args.req_msg = (u8 *)&queue_select;
+	args.req_msglen = sizeof(queue_select);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "Failed to execute command of %s",
+			    on ? "OP_ENABLE_QUEUES" : "OP_DISABLE_QUEUES");
+	return err;
+}
+
+int
+ice_dcf_disable_queues(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_queue_select queue_select;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&queue_select, 0, sizeof(queue_select));
+	queue_select.vsi_id = hw->vsi_res->vsi_id;
+
+	queue_select.rx_queues = BIT(hw->eth_dev->data->nb_rx_queues) - 1;
+	queue_select.tx_queues = BIT(hw->eth_dev->data->nb_tx_queues) - 1;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_DISABLE_QUEUES;

drivers/net/ice/ice_dcf.c ice_dcf_config_irq_map(struct ice_dcf_hw *hw) · line 998

Quoted 10 lines
drivers/net/ice/ice_dcf.c +10 -0
+	args.req_msg = (u8 *)&queue_select;
+	args.req_msglen = sizeof(queue_select);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err) {
+		PMD_DRV_LOG(ERR,
+			    "Failed to execute command of OP_DISABLE_QUEUES");
+		return err;
+	}
+	return 0;

Better to align with above ice_dcf_switch_queue, one 'return err' in the end is enough.

Thanks,
Xiaolong

#14 lore raw

Re: [dpdk-dev] [PATCH v1 09/12] net/ice: add queue start and stop for DCF

In reply to Ting Xu
Quoted 24 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Saturday, June 6, 2020 04:18
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Mcnamara, John <[email protected]>; Kovacevic, Marko <[email protected]>
Subject: [PATCH v1 09/12] net/ice: add queue start and stop for DCF

From: Qi Zhang <[email protected]>

Add queue start and stop in DCF. Support queue enable and disable through virtual channel. Add support for Rx queue mbufs allocation and queue reset.

---
 drivers/net/ice/ice_dcf.c        |  57 ++++++
 drivers/net/ice/ice_dcf.h        |   3 +-
 drivers/net/ice/ice_dcf_ethdev.c | 309
+++++++++++++++++++++++++++++++
 3 files changed, 368 insertions(+), 1 deletion(-)

Snip...

Quoted 19 lines
(quoted diff) +1 -0
+}
drivers/net/ice/ice_dcf.h index renamed from drivers/net/ice/ice_dcf.h +0 -0

9470d1df7..68e1661c0 100644

drivers/net/ice/ice_dcf.h +0 -0
@@ -70,5 +70,6 @@ void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev,

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.h +2 -1
-
+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);
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +0 -0
index 9605fb8ed..59113fc4b 100644

drivers/net/ice/ice_dcf_ethdev.c static int ice_dcf_config_rx_queues_irqs(struct · line 229

Quoted 4 lines
drivers/net/ice/ice_dcf_ethdev.c +0 -0
@@ -226,6 +226,259 @@ static int ice_dcf_config_rx_queues_irqs(struct
 rte_eth_dev *dev,
 	return 0;
 }
 

.

drivers/net/ice/ice_dcf_ethdev.c static int ice_dcf_config_rx_queues_irqs(struct rte_eth_dev *dev, · line 465

Quoted 13 lines
drivers/net/ice/ice_dcf_ethdev.c +13 -0
+static int
+ice_dcf_start_queues(struct rte_eth_dev *dev) {
+	struct ice_rx_queue *rxq;
+	struct ice_tx_queue *txq;
+	int i;
+
+	for (i = 0; i < dev->data->nb_tx_queues; i++) {
+		txq = dev->data->tx_queues[i];
+		if (txq->tx_deferred_start)
+			continue;
+		if (ice_dcf_tx_queue_start(dev, i) != 0) {
+			PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
+			return -1;

If queue start fail, should stop the queue already started

Quoted 105 lines
drivers/net/ice/ice_dcf_ethdev.c +16 -0
+		}
+	}
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		if (rxq->rx_deferred_start)
+			continue;
+		if (ice_dcf_rx_queue_start(dev, i) != 0) {
+			PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
 static int
 ice_dcf_dev_start(struct rte_eth_dev *dev)  { @@ -266,20 +519,72 @@

ice_dcf_dev_start(struct rte_eth_dev *dev)

drivers/net/ice/ice_dcf_ethdev.c +31 -0
 		return ret;
 	}
 
+	if (dev->data->dev_conf.intr_conf.rxq != 0) {
+		rte_intr_disable(intr_handle);
+		rte_intr_enable(intr_handle);
+	}
+
+	ret = ice_dcf_start_queues(dev);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to enable queues");
+		return ret;
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
 }
 
+static void
+ice_dcf_stop_queues(struct rte_eth_dev *dev) {
+	struct ice_dcf_adapter *ad = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &ad->real_hw;
+	struct ice_rx_queue *rxq;
+	struct ice_tx_queue *txq;
+	int ret, i;
+
+	/* Stop All queues */
+	ret = ice_dcf_disable_queues(hw);
+	if (ret)
+		PMD_DRV_LOG(WARNING, "Fail to stop queues");
+
+	for (i = 0; i < dev->data->nb_tx_queues; i++) {
+		txq = dev->data->tx_queues[i];
+		if (!txq)
+			continue;
+		txq->tx_rel_mbufs(txq);
+		reset_tx_queue(txq);
+		dev->data->tx_queue_state[i] =

RTE_ETH_QUEUE_STATE_STOPPED;

drivers/net/ice/ice_dcf_ethdev.c +8 -0
+	}
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		if (!rxq)
+			continue;
+		rxq->rx_rel_mbufs(rxq);
+		reset_rx_queue(rxq);
+		dev->data->rx_queue_state[i] =

RTE_ETH_QUEUE_STATE_STOPPED;

drivers/net/ice/ice_dcf_ethdev.c +16 -0
+	}
+}
+
 static void
 ice_dcf_dev_stop(struct rte_eth_dev *dev)  {
 	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct rte_intr_handle *intr_handle = dev->intr_handle;
 	struct ice_adapter *ad = &dcf_ad->parent;
 
 	if (ad->pf.adapter_stopped == 1)
 		return;
 
+	ice_dcf_stop_queues(dev);
+
+	rte_intr_efd_disable(intr_handle);
+	if (intr_handle->intr_vec) {
+		rte_free(intr_handle->intr_vec);
+		intr_handle->intr_vec = NULL;
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	ad->pf.adapter_stopped = 1;
 }
@@ -476,6 +781,10 @@ static const struct eth_dev_ops
 ice_dcf_eth_dev_ops = {
 	.tx_queue_setup          = ice_tx_queue_setup,
 	.rx_queue_release        = ice_rx_queue_release,
 	.tx_queue_release        = ice_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,
--
2.17.1

author
#15 lore raw

Re: [dpdk-dev] [PATCH v1 09/12] net/ice: add queue start and stop for DCF

Hi, Qiming,

Quoted 61 lines

-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Monday, June 8, 2020 3:36 PM
To: Xu, Ting <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Mcnamara, John <[email protected]>; Kovacevic, Marko <[email protected]>
Subject: RE: [PATCH v1 09/12] net/ice: add queue start and stop for DCF

Quoted 9 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Saturday, June 6, 2020 04:18
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Mcnamara, John <[email protected]>; Kovacevic, Marko <[email protected]>
Subject: [PATCH v1 09/12] net/ice: add queue start and stop for DCF

Quoted 4 lines

From: Qi Zhang <[email protected]>

Add queue start and stop in DCF. Support queue enable and disable through virtual channel. Add support for Rx queue mbufs allocation and

queue reset.

Quoted 9 lines
---
 drivers/net/ice/ice_dcf.c        |  57 ++++++
 drivers/net/ice/ice_dcf.h        |   3 +-
 drivers/net/ice/ice_dcf_ethdev.c | 309
+++++++++++++++++++++++++++++++
 3 files changed, 368 insertions(+), 1 deletion(-)

Snip...

Quoted 20 lines
(quoted diff) +1 -0
+}
drivers/net/ice/ice_dcf.h +0 -0

index
9470d1df7..68e1661c0 100644

drivers/net/ice/ice_dcf.h +0 -0
@@ -70,5 +70,6 @@ void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev,
 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.h +2 -1
-
+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);
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +0 -0
index 9605fb8ed..59113fc4b 100644

drivers/net/ice/ice_dcf_ethdev.c static int ice_dcf_config_rx_queues_irqs(struct · line 229

Quoted 4 lines
drivers/net/ice/ice_dcf_ethdev.c +0 -0
@@ -226,6 +226,259 @@ static int ice_dcf_config_rx_queues_irqs(struct
 rte_eth_dev *dev,
 return 0;
 }
 

.

Quoted 11 lines

drivers/net/ice/ice_dcf_ethdev.c static int ice_dcf_config_rx_queues_irqs(struct · line 237

Quoted 8 lines
drivers/net/ice/ice_dcf_ethdev.c +8 -0
+static int
+ice_dcf_start_queues(struct rte_eth_dev *dev) { struct ice_rx_queue
+*rxq; struct ice_tx_queue *txq; int i;
+
+for (i = 0; i < dev->data->nb_tx_queues; i++) { txq =
+dev->data->tx_queues[i]; if (txq->tx_deferred_start) continue; if
+(ice_dcf_tx_queue_start(dev, i) != 0) { PMD_DRV_LOG(ERR, "Fail to
+start queue %u", i); return -1;

If queue start fail, should stop the queue already started

This operation can only be seen in ice and i40e PF driver. In iavf or even earlier i40evf, they did not stop the already started queues when failed. I am not sure if this operation is suitable for DCF? Or we should not follow the current iavf, since it actually needs this modification to stop started queues as well?

Quoted 86 lines
Quoted 85 lines
drivers/net/ice/ice_dcf_ethdev.c +11 -0
+}
+}
+
+for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq =
+dev->data->rx_queues[i]; if (rxq->rx_deferred_start) continue; if
+(ice_dcf_rx_queue_start(dev, i) != 0) { PMD_DRV_LOG(ERR, "Fail to
+start queue %u", i); return -1; } }
+
+return 0;
+}
+
 static int
 ice_dcf_dev_start(struct rte_eth_dev *dev)  { @@ -266,20 +519,72 @@

ice_dcf_dev_start(struct rte_eth_dev *dev) return ret; }

drivers/net/ice/ice_dcf_ethdev.c +22 -0
+if (dev->data->dev_conf.intr_conf.rxq != 0) {
+rte_intr_disable(intr_handle); rte_intr_enable(intr_handle); }
+
+ret = ice_dcf_start_queues(dev);
+if (ret) {
+PMD_DRV_LOG(ERR, "Failed to enable queues"); return ret; }
+
 dev->data->dev_link.link_status = ETH_LINK_UP;
 
 return 0;
 }
 
+static void
+ice_dcf_stop_queues(struct rte_eth_dev *dev) { struct ice_dcf_adapter
+*ad = dev->data->dev_private; struct ice_dcf_hw *hw = &ad->real_hw;
+struct ice_rx_queue *rxq; struct ice_tx_queue *txq; int ret, i;
+
+/* Stop All queues */
+ret = ice_dcf_disable_queues(hw);
+if (ret)
+PMD_DRV_LOG(WARNING, "Fail to stop queues");
+
+for (i = 0; i < dev->data->nb_tx_queues; i++) { txq =
+dev->data->tx_queues[i]; if (!txq) continue;
+txq->tx_rel_mbufs(txq);
+reset_tx_queue(txq);
+dev->data->tx_queue_state[i] =

RTE_ETH_QUEUE_STATE_STOPPED;

drivers/net/ice/ice_dcf_ethdev.c +6 -0
+}
+for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq =
+dev->data->rx_queues[i]; if (!rxq) continue;
+rxq->rx_rel_mbufs(rxq);
+reset_rx_queue(rxq);
+dev->data->rx_queue_state[i] =

RTE_ETH_QUEUE_STATE_STOPPED;

drivers/net/ice/ice_dcf_ethdev.c +3 -0
+}
+}
+
 static void
 ice_dcf_dev_stop(struct rte_eth_dev *dev)  {  struct ice_dcf_adapter

*dcf_ad = dev->data->dev_private;

drivers/net/ice/ice_dcf_ethdev.c +9 -0
+struct rte_intr_handle *intr_handle = dev->intr_handle;
 struct ice_adapter *ad = &dcf_ad->parent;
 
 if (ad->pf.adapter_stopped == 1)
 return;
 
+ice_dcf_stop_queues(dev);
+
+rte_intr_efd_disable(intr_handle);
+if (intr_handle->intr_vec) {
+rte_free(intr_handle->intr_vec);
+intr_handle->intr_vec = NULL;
+}
+
 dev->data->dev_link.link_status = ETH_LINK_DOWN;

ad->pf.adapter_stopped = 1; } @@ -476,6 +781,10 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = {

 .tx_queue_setup          = ice_tx_queue_setup,
 .rx_queue_release        = ice_rx_queue_release,
 .tx_queue_release        = ice_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,

--
2.17.1

#16 lore raw

Re: [dpdk-dev] [PATCH v1 09/12] net/ice: add queue start and stop for DCF

Quoted 91 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Tuesday, June 9, 2020 15:35
To: Yang, Qiming <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Mcnamara, John <[email protected]>; Kovacevic, Marko <[email protected]>; Ye, Xiaolong <[email protected]>
Subject: RE: [PATCH v1 09/12] net/ice: add queue start and stop for DCF

Hi, Qiming,

Quoted 18 lines

-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Monday, June 8, 2020 3:36 PM
To: Xu, Ting <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Mcnamara, John <[email protected]>; Kovacevic, Marko <[email protected]>
Subject: RE: [PATCH v1 09/12] net/ice: add queue start and stop for DCF

Quoted 6 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Saturday, June 6, 2020 04:18
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Mcnamara, John

<[email protected]>;

Quoted 47 lines
Quoted 8 lines

Kovacevic, Marko <[email protected]>
Subject: [PATCH v1 09/12] net/ice: add queue start and stop for DCF

From: Qi Zhang <[email protected]>

Add queue start and stop in DCF. Support queue enable and disable through virtual channel. Add support for Rx queue mbufs allocation and

queue reset.

Quoted 9 lines
---
 drivers/net/ice/ice_dcf.c        |  57 ++++++
 drivers/net/ice/ice_dcf.h        |   3 +-
 drivers/net/ice/ice_dcf_ethdev.c | 309
+++++++++++++++++++++++++++++++
 3 files changed, 368 insertions(+), 1 deletion(-)

Snip...

Quoted 20 lines
(quoted diff) +1 -0
+}
drivers/net/ice/ice_dcf.h +0 -0

index
9470d1df7..68e1661c0 100644

drivers/net/ice/ice_dcf.h +0 -0
@@ -70,5 +70,6 @@ void ice_dcf_uninit_hw(struct rte_eth_dev
 *eth_dev, 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.h +2 -1
-
+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);
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +0 -0
index 9605fb8ed..59113fc4b 100644
@@ -226,6 +226,259 @@ static int
Quoted 5 lines

ice_dcf_config_rx_queues_irqs(struct
rte_eth_dev *dev,
return 0;
}

.

Quoted 11 lines

drivers/net/ice/ice_dcf_ethdev.c

Quoted 8 lines
drivers/net/ice/ice_dcf_ethdev.c +8 -0
+static int
+ice_dcf_start_queues(struct rte_eth_dev *dev) { struct ice_rx_queue
+*rxq; struct ice_tx_queue *txq; int i;
+
+for (i = 0; i < dev->data->nb_tx_queues; i++) { txq =
+dev->data->tx_queues[i]; if (txq->tx_deferred_start) continue; if
+(ice_dcf_tx_queue_start(dev, i) != 0) { PMD_DRV_LOG(ERR, "Fail to
+start queue %u", i); return -1;

If queue start fail, should stop the queue already started

Quoted 6 lines

This operation can only be seen in ice and i40e PF driver. In iavf or even earlier i40evf, they did not stop the already started queues when failed. I am not sure if this operation is suitable for DCF? Or we should not follow the current iavf, since it actually needs this modification to stop started queues as well?

I think that's the correct behavior. We'd better fix the gap if iavf and i40evf not act as that.

Quoted 88 lines
Quoted 87 lines
Quoted 86 lines
drivers/net/ice/ice_dcf_ethdev.c +11 -0
+}
+}
+
+for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq =
+dev->data->rx_queues[i]; if (rxq->rx_deferred_start) continue; if
+(ice_dcf_rx_queue_start(dev, i) != 0) { PMD_DRV_LOG(ERR, "Fail to
+start queue %u", i); return -1; } }
+
+return 0;
+}
+
 static int
 ice_dcf_dev_start(struct rte_eth_dev *dev)  { @@ -266,20 +519,72 @@

ice_dcf_dev_start(struct rte_eth_dev *dev) return ret; }

drivers/net/ice/ice_dcf_ethdev.c +23 -0
+if (dev->data->dev_conf.intr_conf.rxq != 0) {
+rte_intr_disable(intr_handle); rte_intr_enable(intr_handle); }
+
+ret = ice_dcf_start_queues(dev);
+if (ret) {
+PMD_DRV_LOG(ERR, "Failed to enable queues"); return ret; }
+
 dev->data->dev_link.link_status = ETH_LINK_UP;
 
 return 0;
 }
 
+static void
+ice_dcf_stop_queues(struct rte_eth_dev *dev) { struct
+ice_dcf_adapter *ad = dev->data->dev_private; struct ice_dcf_hw *hw
+= &ad->real_hw; struct ice_rx_queue *rxq; struct ice_tx_queue *txq;
+int ret, i;
+
+/* Stop All queues */
+ret = ice_dcf_disable_queues(hw);
+if (ret)
+PMD_DRV_LOG(WARNING, "Fail to stop queues");
+
+for (i = 0; i < dev->data->nb_tx_queues; i++) { txq =
+dev->data->tx_queues[i]; if (!txq) continue;
+txq->tx_rel_mbufs(txq);
+reset_tx_queue(txq);
+dev->data->tx_queue_state[i] =

RTE_ETH_QUEUE_STATE_STOPPED;

drivers/net/ice/ice_dcf_ethdev.c +6 -0
+}
+for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq =
+dev->data->rx_queues[i]; if (!rxq) continue;
+rxq->rx_rel_mbufs(rxq);
+reset_rx_queue(rxq);
+dev->data->rx_queue_state[i] =

RTE_ETH_QUEUE_STATE_STOPPED;

drivers/net/ice/ice_dcf_ethdev.c +3 -0
+}
+}
+
 static void
 ice_dcf_dev_stop(struct rte_eth_dev *dev)  {  struct

ice_dcf_adapter *dcf_ad = dev->data->dev_private;

drivers/net/ice/ice_dcf_ethdev.c +9 -0
+struct rte_intr_handle *intr_handle = dev->intr_handle;
 struct ice_adapter *ad = &dcf_ad->parent;
 
 if (ad->pf.adapter_stopped == 1)
 return;
 
+ice_dcf_stop_queues(dev);
+
+rte_intr_efd_disable(intr_handle);
+if (intr_handle->intr_vec) {
+rte_free(intr_handle->intr_vec);
+intr_handle->intr_vec = NULL;
+}
+
 dev->data->dev_link.link_status = ETH_LINK_DOWN;

ad->pf.adapter_stopped = 1; } @@ -476,6 +781,10 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = {

 .tx_queue_setup          = ice_tx_queue_setup,
 .rx_queue_release        = ice_rx_queue_release,
 .tx_queue_release        = ice_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,

--
2.17.1

author
#17 lore raw

PATCH 10/12 net/ice: enable stats for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to get and reset Rx/Tx stats in DCF. Query stats from PF.

---
 drivers/net/ice/ice_dcf.c        |  27 ++++++++
 drivers/net/ice/ice_dcf.h        |   4 ++
 drivers/net/ice/ice_dcf_ethdev.c | 102 +++++++++++++++++++++++++++----
 3 files changed, 120 insertions(+), 13 deletions(-)
drivers/net/ice/ice_dcf.c +27 -0
index 56b8c0d25..2338b46cf 100644
@@ -997,3 +997,30 @@ ice_dcf_disable_queues(struct ice_dcf_hw *hw)
 	}
 	return 0;
 }
+
+int
+ice_dcf_query_stats(struct ice_dcf_hw *hw,
+		    struct virtchnl_eth_stats *pstats)
+{
+	struct virtchnl_queue_select q_stats;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&q_stats, 0, sizeof(q_stats));
+	q_stats.vsi_id = hw->vsi_res->vsi_id;
+
+	args.v_op = VIRTCHNL_OP_GET_STATS;
+	args.req_msg = (uint8_t *)&q_stats;
+	args.req_msglen = sizeof(q_stats);
+	args.rsp_msglen = sizeof(*pstats);
+	args.rsp_msgbuf = (uint8_t *)pstats;
+	args.rsp_buflen = sizeof(*pstats);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err) {
+		PMD_DRV_LOG(ERR, "fail to execute command OP_GET_STATS");
+		return err;
+	}
+
+	return 0;
+}
drivers/net/ice/ice_dcf.h +4 -0
index 68e1661c0..e82bc7748 100644
@@ -58,6 +58,7 @@ struct ice_dcf_hw {
 	uint16_t msix_base;
 	uint16_t nb_msix;
 	uint16_t rxq_map[16];
+	struct virtchnl_eth_stats eth_stats_offset;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
@@ -72,4 +73,7 @@ int ice_dcf_configure_queues(struct ice_dcf_hw *hw);
 int ice_dcf_config_irq_map(struct ice_dcf_hw *hw);
 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);
+
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +89 -13

114 lines not on this page · raw message

Signature · 1 line
2.17.1
#18 lore raw

Re: [dpdk-dev] [PATCH v1 10/12] net/ice: enable stats for DCF

Quoted 13 lines · Ting Xu

From: Qi Zhang <[email protected]>

Add support to get and reset Rx/Tx stats in DCF. Query stats from PF.

---

drivers/net/ice/ice_dcf.c        |  27 ++++++++
drivers/net/ice/ice_dcf.h        |   4 ++
drivers/net/ice/ice_dcf_ethdev.c | 102 +++++++++++++++++++++++++++----
3 files changed, 120 insertions(+), 13 deletions(-)
drivers/net/ice/ice_dcf.c +0 -0

[snip]

Quoted 14 lines
drivers/net/ice/ice_dcf.c +14 -0
+static int
+ice_dcf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+{
+	struct ice_dcf_adapter *ad = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &ad->real_hw;
+	struct virtchnl_eth_stats pstats;
+	int ret;
+
+	ret = ice_dcf_query_stats(hw, &pstats);
+	if (ret == 0) {
+		ice_dcf_update_stats(&hw->eth_stats_offset, &pstats);
+		stats->ipackets = pstats.rx_unicast + pstats.rx_multicast +
+				pstats.rx_broadcast - pstats.rx_discards;
+		stats->opackets = pstats.tx_broadcast + pstats.tx_multicast +

drivers/net/ice/ice_dcf.c

Quoted 10 lines
drivers/net/ice/ice_dcf.c +10 -0
+						pstats.tx_unicast;
+		stats->imissed = pstats.rx_discards;
+		stats->oerrors = pstats.tx_errors + pstats.tx_discards;
+		stats->ibytes = pstats.rx_bytes;
+		stats->ibytes -= stats->ipackets * RTE_ETHER_CRC_LEN;
+		stats->obytes = pstats.tx_bytes;
+	} else {
+		PMD_DRV_LOG(ERR, "Get statistics failed");
+	}
+	return -EIO;

Return -EIO even on success seems not correct.

Quoted 27 lines
drivers/net/ice/ice_dcf.c +21 -0
+}
+
+static int
+ice_dcf_stats_reset(struct rte_eth_dev *dev)
+{
+	struct ice_dcf_adapter *ad = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &ad->real_hw;
+	struct virtchnl_eth_stats pstats;
+	int ret;
+
+	/* read stat values to clear hardware registers */
+	ret = ice_dcf_query_stats(hw, &pstats);
+	if (ret != 0)
+		return ret;
+
+	/* set stats offset base on current values */
+	hw->eth_stats_offset = pstats;
+
+	return 0;
+}
+

static void
ice_dcf_dev_close(struct rte_eth_dev *dev)
{

Signature · 1 line
2.17.1
author
#19 lore raw

PATCH 11/12 net/ice: set MAC filter during dev start for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to add and delete MAC address filter in DCF.

---
 drivers/net/ice/ice_dcf.c        | 42 ++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |  1 +
 drivers/net/ice/ice_dcf_ethdev.c |  7 ++++++
 3 files changed, 50 insertions(+)
drivers/net/ice/ice_dcf.c +42 -0
index 2338b46cf..7fd70a394 100644
@@ -1024,3 +1024,45 @@ ice_dcf_query_stats(struct ice_dcf_hw *hw,
 
 	return 0;
 }
+
+int
+ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
+{
+	struct virtchnl_ether_addr_list *list;
+	struct rte_ether_addr *addr;
+	struct dcf_virtchnl_cmd args;
+	int len, err = 0;
+
+	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);
+	if (!list) {
+		PMD_DRV_LOG(ERR, "fail to allocate memory");
+		return -ENOMEM;
+	}
+
+	rte_memcpy(list->list[0].addr, addr->addr_bytes,
+			sizeof(addr->addr_bytes));
+	PMD_DRV_LOG(DEBUG, "add/rm mac:%x:%x:%x:%x:%x:%x",
+			    addr->addr_bytes[0], addr->addr_bytes[1],
+			    addr->addr_bytes[2], addr->addr_bytes[3],
+			    addr->addr_bytes[4], addr->addr_bytes[5]);
+
+	list->vsi_id = hw->vsi_res->vsi_id;
+	list->num_elements = 1;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = add ? VIRTCHNL_OP_ADD_ETH_ADDR :
+			VIRTCHNL_OP_DEL_ETH_ADDR;
+	args.req_msg = (uint8_t *)list;
+	args.req_msglen  = len;
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command %s",
+			    add ? "OP_ADD_ETHER_ADDRESS" :
+			    "OP_DEL_ETHER_ADDRESS");
+	rte_free(list);
+	return err;
+}
drivers/net/ice/ice_dcf.h +1 -0
index e82bc7748..a44a01e90 100644
@@ -75,5 +75,6 @@ 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);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +7 -0
index 869af0e45..a1b1ffb56 100644
@@ -530,6 +530,12 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	ret = ice_dcf_add_del_all_mac_addr(hw, true);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to add mac addr");
+		return ret;
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
@@ -585,6 +591,7 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 		intr_handle->intr_vec = NULL;
 	}
 
+	ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false);
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	ad->pf.adapter_stopped = 1;
 }
Signature · 1 line
2.17.1
author
#20 lore raw

PATCH 12/12 doc: enable DCF datapath configuration

In reply to Ting Xu

Add doc for DCF datapath configuration in DPDK 20.08 release note.

---
 doc/guides/rel_notes/release_20_08.rst | 5 +++++
 1 file changed, 5 insertions(+)
doc/guides/rel_notes/release_20_08.rst +5 -0
index 39064afbe..3cda6111c 100644
@@ -56,6 +56,11 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated the Intel ice driver.**
+
+  Updated the Intel ice driver with new features and improvements, including:
+
+  * Added support for DCF datapath configuration.
 
 Removed Items
 -------------
Signature · 1 line
2.17.1
#21 lore raw

Re: [dpdk-dev] [PATCH v1 12/12] doc: enable DCF datapath configuration

Hi, Ting

Quoted 2 lines · Ting Xu

Add doc for DCF datapath configuration in DPDK 20.08 release note.

It'd be better to also add some document update in ice.rst.

Thanks,
Xiaolong

Quoted 24 lines

---
doc/guides/rel_notes/release_20_08.rst | 5 +++++

1 file changed, 5 insertions(+)
doc/guides/rel_notes/release_20_08.rst +5 -0
index 39064afbe..3cda6111c 100644
@@ -56,6 +56,11 @@ New Features
     Also, make sure to start the actual text at the margin.
     =========================================================
 
+* **Updated the Intel ice driver.**
+
+  Updated the Intel ice driver with new features and improvements, including:
+
+  * Added support for DCF datapath configuration.
 

Removed Items
-------------

Signature · 1 line
2.17.1
author
#22 lore raw

Re: [dpdk-dev] [PATCH v1 12/12] doc: enable DCF datapath configuration

Hi, Xiaolong

Quoted 12 lines

-----Original Message-----
From: Ye, Xiaolong <[email protected]>
Sent: Friday, June 5, 2020 10:42 PM
To: Xu, Ting <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Mcnamara, John <[email protected]>; Kovacevic, Marko <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 12/12] doc: enable DCF datapath configuration

Hi, Ting

Quoted 9 lines
Quoted 2 lines · Ting Xu

Add doc for DCF datapath configuration in DPDK 20.08 release note.

It'd be better to also add some document update in ice.rst.

Thanks,
Xiaolong

I find that there is no additional information need to be added in ice.rst for datapath configure. For multiple VF and buildin recipe in DCF, I update ice.rst in their RFC patchset.

Thanks!

Quoted 26 lines

Review

Quoted 6 lines

---
doc/guides/rel_notes/release_20_08.rst | 5 +++++

1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/doc/guides/rel_notes/release_20_08.rst

doc/guides/rel_notes/release_20_08.rst New Features · line 61

Quoted 10 lines

index 39064afbe..3cda6111c 100644

doc/guides/rel_notes/release_20_08.rst +3 -0
@@ -56,6 +56,11 @@ New Features
     Also, make sure to start the actual text at the margin.
     =========================================================
 
+* **Updated the Intel ice driver.**
+
+  Updated the Intel ice driver with new features and improvements,

including:

Quoted 8 lines
doc/guides/rel_notes/release_20_08.rst +2 -0
+
+  * Added support for DCF datapath configuration.
 

Removed Items
-------------
--
2.17.1

author
#23 lore raw

v2 cover enable DCF datapath configuration

In reply to Ting Xu

This patchset adds support to configure DCF datapath, including Rx/Tx queues setup, start and stop, device configuration, RSS and flexible descriptor RXDID initialization and MAC filter setup.

Qi Zhang (11):
net/ice: init RSS and supported RXDID in DCF net/ice: complete device info get in DCF net/ice: complete dev configure in DCF net/ice: complete queue setup in DCF net/ice: add stop flag for device start / stop net/ice: add Rx queue init in DCF net/ice: init RSS during DCF start net/ice: add queue config in DCF net/ice: add queue start and stop for DCF net/ice: enable stats for DCF
net/ice: set MAC filter during dev start for DCF

Ting Xu (1):
doc: enable DCF datapath configuration

 doc/guides/rel_notes/release_20_08.rst |   6 +
 drivers/net/ice/ice_dcf.c              | 408 ++++++++++++-
 drivers/net/ice/ice_dcf.h              |  17 +
 drivers/net/ice/ice_dcf_ethdev.c       | 771 +++++++++++++++++++++++--
 drivers/net/ice/ice_dcf_ethdev.h       |   3 -
 drivers/net/ice/ice_dcf_parent.c       |   8 +
 6 files changed, 1160 insertions(+), 53 deletions(-)

---

v2->v1:
Optimize coding style
Correct some return values
Add support to stop started queues when queue start failed

Signature · 1 line
2.17.1
author
#24 lore raw

PATCH v2 1/12 net/ice: init RSS and supported RXDID in DCF

From: Qi Zhang <[email protected]>

Enable RSS parameters initialization and get the supported flexible descriptor RXDIDs bitmap from PF during DCF init.

---
 drivers/net/ice/ice_dcf.c | 54 ++++++++++++++++++++++++++++++++++++++-
 drivers/net/ice/ice_dcf.h |  3 +++
 2 files changed, 56 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +53 -1
index 0cd5d1bf6..93fabd5f7 100644
@@ -233,7 +233,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)
 
 	caps = VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | VIRTCHNL_VF_OFFLOAD_RX_POLLING |
 	       VIRTCHNL_VF_CAP_ADV_LINK_SPEED | VIRTCHNL_VF_CAP_DCF |
-	       VF_BASE_MODE_OFFLOADS;
+	       VF_BASE_MODE_OFFLOADS | VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC;
 
 	err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES,
 					  (uint8_t *)&caps, sizeof(caps));
@@ -547,6 +547,30 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw)
 	return err;
 }
 
+static int
+ice_dcf_get_supported_rxdid(struct ice_dcf_hw *hw)
+{
+	int err;
+
+	err = ice_dcf_send_cmd_req_no_irq(hw,
+					  VIRTCHNL_OP_GET_SUPPORTED_RXDIDS,
+					  NULL, 0);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to send OP_GET_SUPPORTED_RXDIDS");
+		return -1;
+	}
+
+	err = ice_dcf_recv_cmd_rsp_no_irq(hw, VIRTCHNL_OP_GET_SUPPORTED_RXDIDS,
+					  (uint8_t *)&hw->supported_rxdid,
+					  sizeof(uint64_t), NULL);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to get response of OP_GET_SUPPORTED_RXDIDS");
+		return -1;
+	}
+
+	return 0;
+}
+
 int
 ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 {
@@ -620,6 +644,29 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 		goto err_alloc;
 	}
 
+	/* Allocate memory for RSS info */
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
+		hw->rss_key = rte_zmalloc(NULL,
+					  hw->vf_res->rss_key_size, 0);
+		if (!hw->rss_key) {
+			PMD_INIT_LOG(ERR, "unable to allocate rss_key memory");
+			goto err_alloc;
+		}
+		hw->rss_lut = rte_zmalloc("rss_lut",
+					  hw->vf_res->rss_lut_size, 0);
+		if (!hw->rss_lut) {
+			PMD_INIT_LOG(ERR, "unable to allocate rss_lut memory");
+			goto err_rss;
+		}
+	}
+
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) {
+		if (ice_dcf_get_supported_rxdid(hw) != 0) {
+			PMD_INIT_LOG(ERR, "failed to do get supported rxdid");
+			goto err_rss;
+		}
+	}
+
 	hw->eth_dev = eth_dev;
 	rte_intr_callback_register(&pci_dev->intr_handle,
 				   ice_dcf_dev_interrupt_handler, hw);
@@ -628,6 +675,9 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 
 	return 0;
 
+err_rss:
+	rte_free(hw->rss_key);
+	rte_free(hw->rss_lut);
 err_alloc:
 	rte_free(hw->vf_res);
 err_api:
@@ -655,4 +705,6 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	rte_free(hw->arq_buf);
 	rte_free(hw->vf_vsi_map);
 	rte_free(hw->vf_res);
+	rte_free(hw->rss_lut);
+	rte_free(hw->rss_key);
 }
drivers/net/ice/ice_dcf.h +3 -0
index d2e447b48..152266e3c 100644
@@ -50,6 +50,9 @@ struct ice_dcf_hw {
 	uint16_t vsi_id;
 
 	struct rte_eth_dev *eth_dev;
+	uint8_t *rss_lut;
+	uint8_t *rss_key;
+	uint64_t supported_rxdid;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
Signature · 1 line
2.17.1
author
#25 lore raw

PATCH v2 2/12 net/ice: complete device info get in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to get complete device information for DCF, including Rx/Tx offload capabilities and default configuration.

---
 drivers/net/ice/ice_dcf_ethdev.c | 72 ++++++++++++++++++++++++++++++--
 1 file changed, 69 insertions(+), 3 deletions(-)
drivers/net/ice/ice_dcf_ethdev.c +69 -3
index e5ba1a61f..7f24ef81a 100644
@@ -24,6 +24,7 @@
 
 #include "ice_generic_flow.h"
 #include "ice_dcf_ethdev.h"
+#include "ice_rxtx.h"
 
 static uint16_t
 ice_dcf_recv_pkts(__rte_unused void *rx_queue,
@@ -66,11 +67,76 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev,
 		     struct rte_eth_dev_info *dev_info)
 {
 	struct ice_dcf_adapter *adapter = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &adapter->real_hw;
 
 	dev_info->max_mac_addrs = 1;
-	dev_info->max_rx_pktlen = (uint32_t)-1;
-	dev_info->max_rx_queues = RTE_DIM(adapter->rxqs);
-	dev_info->max_tx_queues = RTE_DIM(adapter->txqs);
+	dev_info->max_rx_queues = hw->vsi_res->num_queue_pairs;
+	dev_info->max_tx_queues = hw->vsi_res->num_queue_pairs;
+	dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN;
+	dev_info->max_rx_pktlen = ICE_FRAME_SIZE_MAX;
+	dev_info->hash_key_size = hw->vf_res->rss_key_size;
+	dev_info->reta_size = hw->vf_res->rss_lut_size;
+	dev_info->flow_type_rss_offloads = ICE_RSS_OFFLOAD_ALL;
+
+	dev_info->rx_offload_capa =
+		DEV_RX_OFFLOAD_VLAN_STRIP |
+		DEV_RX_OFFLOAD_QINQ_STRIP |
+		DEV_RX_OFFLOAD_IPV4_CKSUM |
+		DEV_RX_OFFLOAD_UDP_CKSUM |
+		DEV_RX_OFFLOAD_TCP_CKSUM |
+		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
+		DEV_RX_OFFLOAD_SCATTER |
+		DEV_RX_OFFLOAD_JUMBO_FRAME |
+		DEV_RX_OFFLOAD_VLAN_FILTER |
+		DEV_RX_OFFLOAD_RSS_HASH;
+	dev_info->tx_offload_capa =
+		DEV_TX_OFFLOAD_VLAN_INSERT |
+		DEV_TX_OFFLOAD_QINQ_INSERT |
+		DEV_TX_OFFLOAD_IPV4_CKSUM |
+		DEV_TX_OFFLOAD_UDP_CKSUM |
+		DEV_TX_OFFLOAD_TCP_CKSUM |
+		DEV_TX_OFFLOAD_SCTP_CKSUM |
+		DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+		DEV_TX_OFFLOAD_TCP_TSO |
+		DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+		DEV_TX_OFFLOAD_GRE_TNL_TSO |
+		DEV_TX_OFFLOAD_IPIP_TNL_TSO |
+		DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
+		DEV_TX_OFFLOAD_MULTI_SEGS;
+
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_thresh = {
+			.pthresh = ICE_DEFAULT_RX_PTHRESH,
+			.hthresh = ICE_DEFAULT_RX_HTHRESH,
+			.wthresh = ICE_DEFAULT_RX_WTHRESH,
+		},
+		.rx_free_thresh = ICE_DEFAULT_RX_FREE_THRESH,
+		.rx_drop_en = 0,
+		.offloads = 0,
+	};
+
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_thresh = {
+			.pthresh = ICE_DEFAULT_TX_PTHRESH,
+			.hthresh = ICE_DEFAULT_TX_HTHRESH,
+			.wthresh = ICE_DEFAULT_TX_WTHRESH,
+		},
+		.tx_free_thresh = ICE_DEFAULT_TX_FREE_THRESH,
+		.tx_rs_thresh = ICE_DEFAULT_TX_RSBIT_THRESH,
+		.offloads = 0,
+	};
+
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = ICE_MAX_RING_DESC,
+		.nb_min = ICE_MIN_RING_DESC,
+		.nb_align = ICE_ALIGN_RING_DESC,
+	};
+
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = ICE_MAX_RING_DESC,
+		.nb_min = ICE_MIN_RING_DESC,
+		.nb_align = ICE_ALIGN_RING_DESC,
+	};
 
 	return 0;
 }
Signature · 1 line
2.17.1
author
#26 lore raw

PATCH v2 3/12 net/ice: complete dev configure in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable device configuration function in DCF.

---
 drivers/net/ice/ice_dcf_ethdev.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf_ethdev.c +10 -1
index 7f24ef81a..41d130cd9 100644
@@ -57,8 +57,17 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 }
 
 static int
-ice_dcf_dev_configure(__rte_unused struct rte_eth_dev *dev)
+ice_dcf_dev_configure(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
author
#27 lore raw

PATCH v2 4/12 net/ice: complete queue setup in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Delete original DCF queue setup functions and use ice queue setup and release functions instead.

---
 drivers/net/ice/ice_dcf_ethdev.c | 42 +++-----------------------------
 drivers/net/ice/ice_dcf_ethdev.h |  3 ---
 drivers/net/ice/ice_dcf_parent.c |  7 ++++++
 3 files changed, 11 insertions(+), 41 deletions(-)
drivers/net/ice/ice_dcf_ethdev.c +4 -38
index 41d130cd9..0c3013228 100644
@@ -231,11 +231,6 @@ ice_dcf_dev_close(struct rte_eth_dev *dev)
 	ice_dcf_uninit_hw(dev, &adapter->real_hw);
 }
 
-static void
-ice_dcf_queue_release(__rte_unused void *q)
-{
-}
-
 static int
 ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev,
 		    __rte_unused int wait_to_complete)
@@ -243,45 +238,16 @@ ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev,
 	return 0;
 }
 
-static int
-ice_dcf_rx_queue_setup(struct rte_eth_dev *dev,
-		       uint16_t rx_queue_id,
-		       __rte_unused uint16_t nb_rx_desc,
-		       __rte_unused unsigned int socket_id,
-		       __rte_unused const struct rte_eth_rxconf *rx_conf,
-		       __rte_unused struct rte_mempool *mb_pool)
-{
-	struct ice_dcf_adapter *adapter = dev->data->dev_private;
-
-	dev->data->rx_queues[rx_queue_id] = &adapter->rxqs[rx_queue_id];
-
-	return 0;
-}
-
-static int
-ice_dcf_tx_queue_setup(struct rte_eth_dev *dev,
-		       uint16_t tx_queue_id,
-		       __rte_unused uint16_t nb_tx_desc,
-		       __rte_unused unsigned int socket_id,
-		       __rte_unused const struct rte_eth_txconf *tx_conf)
-{
-	struct ice_dcf_adapter *adapter = dev->data->dev_private;
-
-	dev->data->tx_queues[tx_queue_id] = &adapter->txqs[tx_queue_id];
-
-	return 0;
-}
-
 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_configure           = ice_dcf_dev_configure,
 	.dev_infos_get           = ice_dcf_dev_info_get,
-	.rx_queue_setup          = ice_dcf_rx_queue_setup,
-	.tx_queue_setup          = ice_dcf_tx_queue_setup,
-	.rx_queue_release        = ice_dcf_queue_release,
-	.tx_queue_release        = ice_dcf_queue_release,
+	.rx_queue_setup          = ice_rx_queue_setup,
+	.tx_queue_setup          = ice_tx_queue_setup,
+	.rx_queue_release        = ice_rx_queue_release,
+	.tx_queue_release        = ice_tx_queue_release,
 	.link_update             = ice_dcf_link_update,
 	.stats_get               = ice_dcf_stats_get,
 	.stats_reset             = ice_dcf_stats_reset,
drivers/net/ice/ice_dcf_ethdev.h +0 -3
index e60e808d8..b54528bea 100644
@@ -19,10 +19,7 @@ struct ice_dcf_queue {
 
 struct ice_dcf_adapter {
 	struct ice_adapter parent; /* Must be first */
-
 	struct ice_dcf_hw real_hw;
-	struct ice_dcf_queue rxqs[ICE_DCF_MAX_RINGS];
-	struct ice_dcf_queue txqs[ICE_DCF_MAX_RINGS];
 };
 
 void ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw,
drivers/net/ice/ice_dcf_parent.c +7 -0
index d13e19d78..322a5273f 100644
@@ -335,6 +335,13 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)
 	parent_adapter->eth_dev = eth_dev;
 	parent_adapter->pf.adapter = parent_adapter;
 	parent_adapter->pf.dev_data = eth_dev->data;
+	/* create a dummy main_vsi */
+	parent_adapter->pf.main_vsi =
+		rte_zmalloc(NULL, sizeof(struct ice_vsi), 0);
+	if (!parent_adapter->pf.main_vsi)
+		return -ENOMEM;
+	parent_adapter->pf.main_vsi->adapter = parent_adapter;
+
 	parent_hw->back = parent_adapter;
 	parent_hw->mac_type = ICE_MAC_GENERIC;
 	parent_hw->vendor_id = ICE_INTEL_VENDOR_ID;
Signature · 1 line
2.17.1
author
#28 lore raw

PATCH v2 5/12 net/ice: add stop flag for device start / stop

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add stop flag for DCF device start and stop.

---
 drivers/net/ice/ice_dcf_ethdev.c | 12 ++++++++++++
 drivers/net/ice/ice_dcf_parent.c |  1 +
 2 files changed, 13 insertions(+)
drivers/net/ice/ice_dcf_ethdev.c +12 -0
index 0c3013228..ff2cab054 100644
@@ -45,6 +45,11 @@ ice_dcf_xmit_pkts(__rte_unused void *tx_queue,
 static int
 ice_dcf_dev_start(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	ad->pf.adapter_stopped = 0;
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
@@ -53,7 +58,14 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 static void
 ice_dcf_dev_stop(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	if (ad->pf.adapter_stopped == 1)
+		return;
+
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
+	ad->pf.adapter_stopped = 1;
 }
 
 static int
drivers/net/ice/ice_dcf_parent.c +1 -0
index 322a5273f..c5dfdd36e 100644
@@ -341,6 +341,7 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)
 	if (!parent_adapter->pf.main_vsi)
 		return -ENOMEM;
 	parent_adapter->pf.main_vsi->adapter = parent_adapter;
+	parent_adapter->pf.adapter_stopped = 1;
 
 	parent_hw->back = parent_adapter;
 	parent_hw->mac_type = ICE_MAC_GENERIC;
Signature · 1 line
2.17.1
author
#29 lore raw

PATCH v2 6/12 net/ice: add Rx queue init in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable Rx queues initialization during device start in DCF.

---
 drivers/net/ice/ice_dcf.h        |  1 +
 drivers/net/ice/ice_dcf_ethdev.c | 83 ++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)
drivers/net/ice/ice_dcf.h +1 -0
index 152266e3c..dcb2a0283 100644
@@ -53,6 +53,7 @@ struct ice_dcf_hw {
 	uint8_t *rss_lut;
 	uint8_t *rss_key;
 	uint64_t supported_rxdid;
+	uint16_t num_queue_pairs;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
drivers/net/ice/ice_dcf_ethdev.c +83 -0

97 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#30 lore raw

PATCH v2 7/12 net/ice: init RSS during DCF start

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable RSS initialization during DCF start. Add RSS LUT and RSS key configuration functions.

---
 drivers/net/ice/ice_dcf.c        | 117 +++++++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |   1 +
 drivers/net/ice/ice_dcf_ethdev.c |   8 +++
 3 files changed, 126 insertions(+)
drivers/net/ice/ice_dcf.c +117 -0
index 93fabd5f7..f285323dd 100644
@@ -708,3 +708,120 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	rte_free(hw->rss_lut);
 	rte_free(hw->rss_key);
 }
+
+static int
+ice_dcf_configure_rss_key(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_rss_key *rss_key;
+	struct dcf_virtchnl_cmd args;
+	int len, err;
+
+	len = sizeof(*rss_key) + hw->vf_res->rss_key_size - 1;
+	rss_key = rte_zmalloc("rss_key", len, 0);
+	if (!rss_key)
+		return -ENOMEM;
+
+	rss_key->vsi_id = hw->vsi_res->vsi_id;
+	rss_key->key_len = hw->vf_res->rss_key_size;
+	rte_memcpy(rss_key->key, hw->rss_key, hw->vf_res->rss_key_size);
+
+	args.v_op = VIRTCHNL_OP_CONFIG_RSS_KEY;
+	args.req_msglen = len;
+	args.req_msg = (uint8_t *)rss_key;
+	args.rsp_msglen = 0;
+	args.rsp_buflen = 0;
+	args.rsp_msgbuf = NULL;
+	args.pending = 0;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_KEY");
+
+	rte_free(rss_key);
+	return err;
+}
+
+static int
+ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_rss_lut *rss_lut;
+	struct dcf_virtchnl_cmd args;
+	int len, err;
+
+	len = sizeof(*rss_lut) + hw->vf_res->rss_lut_size - 1;
+	rss_lut = rte_zmalloc("rss_lut", len, 0);
+	if (!rss_lut)
+		return -ENOMEM;
+
+	rss_lut->vsi_id = hw->vsi_res->vsi_id;
+	rss_lut->lut_entries = hw->vf_res->rss_lut_size;
+	rte_memcpy(rss_lut->lut, hw->rss_lut, hw->vf_res->rss_lut_size);
+
+	args.v_op = VIRTCHNL_OP_CONFIG_RSS_LUT;
+	args.req_msglen = len;
+	args.req_msg = (uint8_t *)rss_lut;
+	args.rsp_msglen = 0;
+	args.rsp_buflen = 0;
+	args.rsp_msgbuf = NULL;
+	args.pending = 0;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_LUT");
+
+	rte_free(rss_lut);
+	return err;
+}
+
+int
+ice_dcf_init_rss(struct ice_dcf_hw *hw)
+{
+	struct rte_eth_dev *dev = hw->eth_dev;
+	struct rte_eth_rss_conf *rss_conf;
+	uint8_t i, j, nb_q;
+	int ret;
+
+	rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = dev->data->nb_rx_queues;
+
+	if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF)) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+	if (dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
+		PMD_DRV_LOG(WARNING, "RSS is enabled by PF by default");
+		/* set all lut items to default queue */
+		memset(hw->rss_lut, 0, hw->vf_res->rss_lut_size);
+		return ice_dcf_configure_rss_lut(hw);
+	}
+
+	/* In IAVF, RSS enablement is set by PF driver. It is not supported
+	 * to set based on rss_conf->rss_hf.
+	 */
+
+	/* configure RSS key */
+	if (!rss_conf->rss_key)
+		/* Calculate the default hash key */
+		for (i = 0; i < hw->vf_res->rss_key_size; i++)
+			hw->rss_key[i] = (uint8_t)rte_rand();
+	else
+		rte_memcpy(hw->rss_key, rss_conf->rss_key,
+			   RTE_MIN(rss_conf->rss_key_len,
+				   hw->vf_res->rss_key_size));
+
+	/* init RSS LUT table */
+	for (i = 0, j = 0; i < hw->vf_res->rss_lut_size; i++, j++) {
+		if (j >= nb_q)
+			j = 0;
+		hw->rss_lut[i] = j;
+	}
+	/* send virtchnnl ops to configure rss*/
+	ret = ice_dcf_configure_rss_lut(hw);
+	if (ret)
+		return ret;
+	ret = ice_dcf_configure_rss_key(hw);
+	if (ret)
+		return ret;
+
+	return 0;
+}
drivers/net/ice/ice_dcf.h +1 -0
index dcb2a0283..eea4b286b 100644
@@ -63,5 +63,6 @@ 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_init_rss(struct ice_dcf_hw *hw);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +8 -0
index 6d0f93ca7..e021d779a 100644
@@ -133,6 +133,14 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
+		ret = ice_dcf_init_rss(hw);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "Failed to configure RSS");
+			return ret;
+		}
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
Signature · 1 line
2.17.1
author
#31 lore raw

PATCH v2 8/12 net/ice: add queue config in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add queues and Rx queue irqs configuration during device start in DCF. The setup is sent to PF via virtchnl.

---
 drivers/net/ice/ice_dcf.c        | 111 +++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |   6 ++
 drivers/net/ice/ice_dcf_ethdev.c | 126 +++++++++++++++++++++++++++++++
 3 files changed, 243 insertions(+)
drivers/net/ice/ice_dcf.c +111 -0
index f285323dd..8869e0d1c 100644
@@ -24,6 +24,7 @@
 #include <rte_dev.h>
 
 #include "ice_dcf.h"
+#include "ice_rxtx.h"
 
 #define ICE_DCF_AQ_LEN     32
 #define ICE_DCF_AQ_BUF_SZ  4096
@@ -825,3 +826,113 @@ ice_dcf_init_rss(struct ice_dcf_hw *hw)
 
 	return 0;
 }
+
+#define IAVF_RXDID_LEGACY_1 1
+#define IAVF_RXDID_COMMS_GENERIC 16
+
+int
+ice_dcf_configure_queues(struct ice_dcf_hw *hw)
+{
+	struct ice_rx_queue **rxq =
+		(struct ice_rx_queue **)hw->eth_dev->data->rx_queues;
+	struct ice_tx_queue **txq =
+		(struct ice_tx_queue **)hw->eth_dev->data->tx_queues;
+	struct virtchnl_vsi_queue_config_info *vc_config;
+	struct virtchnl_queue_pair_info *vc_qp;
+	struct dcf_virtchnl_cmd args;
+	uint16_t i, size;
+	int err;
+
+	size = sizeof(*vc_config) +
+	       sizeof(vc_config->qpair[0]) * hw->num_queue_pairs;
+	vc_config = rte_zmalloc("cfg_queue", size, 0);
+	if (!vc_config)
+		return -ENOMEM;
+
+	vc_config->vsi_id = hw->vsi_res->vsi_id;
+	vc_config->num_queue_pairs = hw->num_queue_pairs;
+
+	for (i = 0, vc_qp = vc_config->qpair;
+	     i < hw->num_queue_pairs;
+	     i++, vc_qp++) {
+		vc_qp->txq.vsi_id = hw->vsi_res->vsi_id;
+		vc_qp->txq.queue_id = i;
+		if (i < hw->eth_dev->data->nb_tx_queues) {
+			vc_qp->txq.ring_len = txq[i]->nb_tx_desc;
+			vc_qp->txq.dma_ring_addr = txq[i]->tx_ring_dma;
+		}
+		vc_qp->rxq.vsi_id = hw->vsi_res->vsi_id;
+		vc_qp->rxq.queue_id = i;
+		vc_qp->rxq.max_pkt_size = rxq[i]->max_pkt_len;
+
+		if (i >= hw->eth_dev->data->nb_rx_queues)
+			continue;
+
+		vc_qp->rxq.ring_len = rxq[i]->nb_rx_desc;
+		vc_qp->rxq.dma_ring_addr = rxq[i]->rx_ring_dma;
+		vc_qp->rxq.databuffer_size = rxq[i]->rx_buf_len;
+
+		if (hw->vf_res->vf_cap_flags &
+		    VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC &&
+		    hw->supported_rxdid &
+		    BIT(IAVF_RXDID_COMMS_GENERIC)) {
+			vc_qp->rxq.rxdid = IAVF_RXDID_COMMS_GENERIC;
+			PMD_DRV_LOG(NOTICE, "request RXDID == %d in "
+				    "Queue[%d]", vc_qp->rxq.rxdid, i);
+		} else {
+			PMD_DRV_LOG(ERR, "RXDID 16 is not supported");
+			return -EINVAL;
+		}
+	}
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_CONFIG_VSI_QUEUES;
+	args.req_msg = (uint8_t *)vc_config;
+	args.req_msglen = size;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "Failed to execute command of"
+			    " VIRTCHNL_OP_CONFIG_VSI_QUEUES");
+
+	rte_free(vc_config);
+	return err;
+}
+
+int
+ice_dcf_config_irq_map(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_irq_map_info *map_info;
+	struct virtchnl_vector_map *vecmap;
+	struct dcf_virtchnl_cmd args;
+	int len, i, err;
+
+	len = sizeof(struct virtchnl_irq_map_info) +
+	      sizeof(struct virtchnl_vector_map) * hw->nb_msix;
+
+	map_info = rte_zmalloc("map_info", len, 0);
+	if (!map_info)
+		return -ENOMEM;
+
+	map_info->num_vectors = hw->nb_msix;
+	for (i = 0; i < hw->nb_msix; i++) {
+		vecmap = &map_info->vecmap[i];
+		vecmap->vsi_id = hw->vsi_res->vsi_id;
+		vecmap->rxitr_idx = 0;
+		vecmap->vector_id = hw->msix_base + i;
+		vecmap->txq_map = 0;
+		vecmap->rxq_map = hw->rxq_map[hw->msix_base + i];
+	}
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_CONFIG_IRQ_MAP;
+	args.req_msg = (u8 *)map_info;
+	args.req_msglen = len;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command OP_CONFIG_IRQ_MAP");
+
+	rte_free(map_info);
+	return err;
+}
drivers/net/ice/ice_dcf.h +6 -0
index eea4b286b..9470d1df7 100644
@@ -54,6 +54,10 @@ struct ice_dcf_hw {
 	uint8_t *rss_key;
 	uint64_t supported_rxdid;
 	uint16_t num_queue_pairs;
+
+	uint16_t msix_base;
+	uint16_t nb_msix;
+	uint16_t rxq_map[16];
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
@@ -64,5 +68,7 @@ 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_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);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +126 -0

142 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#32 lore raw

PATCH v2 9/12 net/ice: add queue start and stop for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add queue start and stop in DCF. Support queue enable and disable through virtual channel. Add support for Rx queue mbufs allocation and queue reset.

---
 drivers/net/ice/ice_dcf.c        |  57 ++++++
 drivers/net/ice/ice_dcf.h        |   3 +-
 drivers/net/ice/ice_dcf_ethdev.c | 320 +++++++++++++++++++++++++++++++
 3 files changed, 379 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +57 -0
index 8869e0d1c..f18c0f16a 100644
@@ -936,3 +936,60 @@ ice_dcf_config_irq_map(struct ice_dcf_hw *hw)
 	rte_free(map_info);
 	return err;
 }
+
+int
+ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on)
+{
+	struct virtchnl_queue_select queue_select;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&queue_select, 0, sizeof(queue_select));
+	queue_select.vsi_id = hw->vsi_res->vsi_id;
+	if (rx)
+		queue_select.rx_queues |= 1 << qid;
+	else
+		queue_select.tx_queues |= 1 << qid;
+
+	memset(&args, 0, sizeof(args));
+	if (on)
+		args.v_op = VIRTCHNL_OP_ENABLE_QUEUES;
+	else
+		args.v_op = VIRTCHNL_OP_DISABLE_QUEUES;
+
+	args.req_msg = (u8 *)&queue_select;
+	args.req_msglen = sizeof(queue_select);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "Failed to execute command of %s",
+			    on ? "OP_ENABLE_QUEUES" : "OP_DISABLE_QUEUES");
+
+	return err;
+}
+
+int
+ice_dcf_disable_queues(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_queue_select queue_select;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&queue_select, 0, sizeof(queue_select));
+	queue_select.vsi_id = hw->vsi_res->vsi_id;
+
+	queue_select.rx_queues = BIT(hw->eth_dev->data->nb_rx_queues) - 1;
+	queue_select.tx_queues = BIT(hw->eth_dev->data->nb_tx_queues) - 1;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_DISABLE_QUEUES;
+	args.req_msg = (u8 *)&queue_select;
+	args.req_msglen = sizeof(queue_select);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR,
+			    "Failed to execute command of OP_DISABLE_QUEUES");
+
+	return err;
+}
drivers/net/ice/ice_dcf.h +2 -1
index 9470d1df7..68e1661c0 100644
@@ -70,5 +70,6 @@ void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, 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);
-
+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);
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +320 -0

352 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#33 lore raw

PATCH v2 10/12 net/ice: enable stats for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to get and reset Rx/Tx stats in DCF. Query stats from PF.

---
 drivers/net/ice/ice_dcf.c        |  27 ++++++++
 drivers/net/ice/ice_dcf.h        |   4 ++
 drivers/net/ice/ice_dcf_ethdev.c | 102 +++++++++++++++++++++++++++----
 3 files changed, 120 insertions(+), 13 deletions(-)
drivers/net/ice/ice_dcf.c +27 -0
index f18c0f16a..bb848bed1 100644
@@ -993,3 +993,30 @@ ice_dcf_disable_queues(struct ice_dcf_hw *hw)
 
 	return err;
 }
+
+int
+ice_dcf_query_stats(struct ice_dcf_hw *hw,
+				   struct virtchnl_eth_stats *pstats)
+{
+	struct virtchnl_queue_select q_stats;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&q_stats, 0, sizeof(q_stats));
+	q_stats.vsi_id = hw->vsi_res->vsi_id;
+
+	args.v_op = VIRTCHNL_OP_GET_STATS;
+	args.req_msg = (uint8_t *)&q_stats;
+	args.req_msglen = sizeof(q_stats);
+	args.rsp_msglen = sizeof(*pstats);
+	args.rsp_msgbuf = (uint8_t *)pstats;
+	args.rsp_buflen = sizeof(*pstats);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err) {
+		   PMD_DRV_LOG(ERR, "fail to execute command OP_GET_STATS");
+		   return err;
+	}
+
+	return 0;
+}
drivers/net/ice/ice_dcf.h +4 -0
index 68e1661c0..e82bc7748 100644
@@ -58,6 +58,7 @@ struct ice_dcf_hw {
 	uint16_t msix_base;
 	uint16_t nb_msix;
 	uint16_t rxq_map[16];
+	struct virtchnl_eth_stats eth_stats_offset;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
@@ -72,4 +73,7 @@ int ice_dcf_configure_queues(struct ice_dcf_hw *hw);
 int ice_dcf_config_irq_map(struct ice_dcf_hw *hw);
 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);
+
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +89 -13

114 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#34 lore raw

PATCH v2 11/12 net/ice: set MAC filter during dev start for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to add and delete MAC address filter in DCF.

---
 drivers/net/ice/ice_dcf.c        | 42 ++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |  1 +
 drivers/net/ice/ice_dcf_ethdev.c |  7 ++++++
 3 files changed, 50 insertions(+)
drivers/net/ice/ice_dcf.c +42 -0
index bb848bed1..0e430bd76 100644
@@ -1020,3 +1020,45 @@ ice_dcf_query_stats(struct ice_dcf_hw *hw,
 
 	return 0;
 }
+
+int
+ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
+{
+	struct virtchnl_ether_addr_list *list;
+	struct rte_ether_addr *addr;
+	struct dcf_virtchnl_cmd args;
+	int len, err = 0;
+
+	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);
+	if (!list) {
+		PMD_DRV_LOG(ERR, "fail to allocate memory");
+		return -ENOMEM;
+	}
+
+	rte_memcpy(list->list[0].addr, addr->addr_bytes,
+			sizeof(addr->addr_bytes));
+	PMD_DRV_LOG(DEBUG, "add/rm mac:%x:%x:%x:%x:%x:%x",
+			    addr->addr_bytes[0], addr->addr_bytes[1],
+			    addr->addr_bytes[2], addr->addr_bytes[3],
+			    addr->addr_bytes[4], addr->addr_bytes[5]);
+
+	list->vsi_id = hw->vsi_res->vsi_id;
+	list->num_elements = 1;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = add ? VIRTCHNL_OP_ADD_ETH_ADDR :
+			VIRTCHNL_OP_DEL_ETH_ADDR;
+	args.req_msg = (uint8_t *)list;
+	args.req_msglen  = len;
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command %s",
+			    add ? "OP_ADD_ETHER_ADDRESS" :
+			    "OP_DEL_ETHER_ADDRESS");
+	rte_free(list);
+	return err;
+}
drivers/net/ice/ice_dcf.h +1 -0
index e82bc7748..a44a01e90 100644
@@ -75,5 +75,6 @@ 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);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +7 -0
index 1a675064a..7912dc18a 100644
@@ -542,6 +542,12 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	ret = ice_dcf_add_del_all_mac_addr(hw, true);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to add mac addr");
+		return ret;
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
@@ -597,6 +603,7 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 		intr_handle->intr_vec = NULL;
 	}
 
+	ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false);
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	ad->pf.adapter_stopped = 1;
 }
Signature · 1 line
2.17.1
author
#35 lore raw

PATCH v2 12/12 doc: enable DCF datapath configuration

In reply to Ting Xu

Add doc for DCF datapath configuration in DPDK 20.08 release note.

---
 doc/guides/rel_notes/release_20_08.rst | 6 ++++++
 1 file changed, 6 insertions(+)
doc/guides/rel_notes/release_20_08.rst +6 -0
index dee4ccbb5..1a3a4cdb2 100644
@@ -56,6 +56,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated the Intel ice driver.**
+
+  Updated the Intel ice driver with new features and improvements, including:
+
+  * Added support for DCF datapath configuration.
+
 * **Updated Mellanox mlx5 driver.**
 
   Updated Mellanox mlx5 driver with new features and improvements, including:
Signature · 1 line
2.17.1
author
#36 lore raw

v4 cover enable DCF datapath configuration

In reply to Ting Xu

From: Xu Ting <[email protected]>

This patchset adds support to configure DCF datapath, including Rx/Tx queues setup, start and stop, device configuration, RSS and flexible descriptor RXDID initialization and MAC filter setup.

Qi Zhang (11):
net/ice: init RSS and supported RXDID in DCF net/ice: complete device info get in DCF net/ice: complete dev configure in DCF net/ice: complete queue setup in DCF net/ice: add stop flag for device start / stop net/ice: add Rx queue init in DCF net/ice: init RSS during DCF start net/ice: add queue config in DCF net/ice: add queue start and stop for DCF net/ice: enable stats for DCF
net/ice: set MAC filter during dev start for DCF

Ting Xu (1):
doc: enable DCF datapath configuration

---
v3->v4:
Clean codes based on comments

v2->v3:
Correct coding style issue

v1->v2:
Optimize coding style
Correct some return values
Add support to stop started queues when queue start failed

 doc/guides/rel_notes/release_20_08.rst |   6 +
 drivers/net/ice/ice_dcf.c              | 408 ++++++++++++-
 drivers/net/ice/ice_dcf.h              |  17 +
 drivers/net/ice/ice_dcf_ethdev.c       | 773 +++++++++++++++++++++++--
 drivers/net/ice/ice_dcf_ethdev.h       |   3 -
 drivers/net/ice/ice_dcf_parent.c       |   8 +
 6 files changed, 1162 insertions(+), 53 deletions(-)
Signature · 1 line
2.17.1
author
#37 lore raw

PATCH v4 1/12 net/ice: init RSS and supported RXDID in DCF

From: Qi Zhang <[email protected]>

Enable RSS parameters initialization and get the supported flexible descriptor RXDIDs bitmap from PF during DCF init.

---
 drivers/net/ice/ice_dcf.c | 54 ++++++++++++++++++++++++++++++++++++++-
 drivers/net/ice/ice_dcf.h |  3 +++
 2 files changed, 56 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +53 -1
index 0cd5d1bf6..93fabd5f7 100644
@@ -233,7 +233,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)
 
 	caps = VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | VIRTCHNL_VF_OFFLOAD_RX_POLLING |
 	       VIRTCHNL_VF_CAP_ADV_LINK_SPEED | VIRTCHNL_VF_CAP_DCF |
-	       VF_BASE_MODE_OFFLOADS;
+	       VF_BASE_MODE_OFFLOADS | VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC;
 
 	err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES,
 					  (uint8_t *)&caps, sizeof(caps));
@@ -547,6 +547,30 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw)
 	return err;
 }
 
+static int
+ice_dcf_get_supported_rxdid(struct ice_dcf_hw *hw)
+{
+	int err;
+
+	err = ice_dcf_send_cmd_req_no_irq(hw,
+					  VIRTCHNL_OP_GET_SUPPORTED_RXDIDS,
+					  NULL, 0);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to send OP_GET_SUPPORTED_RXDIDS");
+		return -1;
+	}
+
+	err = ice_dcf_recv_cmd_rsp_no_irq(hw, VIRTCHNL_OP_GET_SUPPORTED_RXDIDS,
+					  (uint8_t *)&hw->supported_rxdid,
+					  sizeof(uint64_t), NULL);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to get response of OP_GET_SUPPORTED_RXDIDS");
+		return -1;
+	}
+
+	return 0;
+}
+
 int
 ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 {
@@ -620,6 +644,29 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 		goto err_alloc;
 	}
 
+	/* Allocate memory for RSS info */
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
+		hw->rss_key = rte_zmalloc(NULL,
+					  hw->vf_res->rss_key_size, 0);
+		if (!hw->rss_key) {
+			PMD_INIT_LOG(ERR, "unable to allocate rss_key memory");
+			goto err_alloc;
+		}
+		hw->rss_lut = rte_zmalloc("rss_lut",
+					  hw->vf_res->rss_lut_size, 0);
+		if (!hw->rss_lut) {
+			PMD_INIT_LOG(ERR, "unable to allocate rss_lut memory");
+			goto err_rss;
+		}
+	}
+
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) {
+		if (ice_dcf_get_supported_rxdid(hw) != 0) {
+			PMD_INIT_LOG(ERR, "failed to do get supported rxdid");
+			goto err_rss;
+		}
+	}
+
 	hw->eth_dev = eth_dev;
 	rte_intr_callback_register(&pci_dev->intr_handle,
 				   ice_dcf_dev_interrupt_handler, hw);
@@ -628,6 +675,9 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 
 	return 0;
 
+err_rss:
+	rte_free(hw->rss_key);
+	rte_free(hw->rss_lut);
 err_alloc:
 	rte_free(hw->vf_res);
 err_api:
@@ -655,4 +705,6 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	rte_free(hw->arq_buf);
 	rte_free(hw->vf_vsi_map);
 	rte_free(hw->vf_res);
+	rte_free(hw->rss_lut);
+	rte_free(hw->rss_key);
 }
drivers/net/ice/ice_dcf.h +3 -0
index d2e447b48..152266e3c 100644
@@ -50,6 +50,9 @@ struct ice_dcf_hw {
 	uint16_t vsi_id;
 
 	struct rte_eth_dev *eth_dev;
+	uint8_t *rss_lut;
+	uint8_t *rss_key;
+	uint64_t supported_rxdid;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
Signature · 1 line
2.17.1
author
#38 lore raw

PATCH v4 2/12 net/ice: complete device info get in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to get complete device information for DCF, including Rx/Tx offload capabilities and default configuration.

---
 drivers/net/ice/ice_dcf_ethdev.c | 70 ++++++++++++++++++++++++++++++--
 1 file changed, 67 insertions(+), 3 deletions(-)
drivers/net/ice/ice_dcf_ethdev.c +67 -3
index e5ba1a61f..eb3708191 100644
@@ -24,6 +24,7 @@
 
 #include "ice_generic_flow.h"
 #include "ice_dcf_ethdev.h"
+#include "ice_rxtx.h"
 
 static uint16_t
 ice_dcf_recv_pkts(__rte_unused void *rx_queue,
@@ -66,11 +67,74 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev,
 		     struct rte_eth_dev_info *dev_info)
 {
 	struct ice_dcf_adapter *adapter = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &adapter->real_hw;
 
 	dev_info->max_mac_addrs = 1;
-	dev_info->max_rx_pktlen = (uint32_t)-1;
-	dev_info->max_rx_queues = RTE_DIM(adapter->rxqs);
-	dev_info->max_tx_queues = RTE_DIM(adapter->txqs);
+	dev_info->max_rx_queues = hw->vsi_res->num_queue_pairs;
+	dev_info->max_tx_queues = hw->vsi_res->num_queue_pairs;
+	dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN;
+	dev_info->max_rx_pktlen = ICE_FRAME_SIZE_MAX;
+	dev_info->hash_key_size = hw->vf_res->rss_key_size;
+	dev_info->reta_size = hw->vf_res->rss_lut_size;
+	dev_info->flow_type_rss_offloads = ICE_RSS_OFFLOAD_ALL;
+
+	dev_info->rx_offload_capa =
+		DEV_RX_OFFLOAD_VLAN_STRIP |
+		DEV_RX_OFFLOAD_IPV4_CKSUM |
+		DEV_RX_OFFLOAD_UDP_CKSUM |
+		DEV_RX_OFFLOAD_TCP_CKSUM |
+		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
+		DEV_RX_OFFLOAD_SCATTER |
+		DEV_RX_OFFLOAD_JUMBO_FRAME |
+		DEV_RX_OFFLOAD_VLAN_FILTER |
+		DEV_RX_OFFLOAD_RSS_HASH;
+	dev_info->tx_offload_capa =
+		DEV_TX_OFFLOAD_VLAN_INSERT |
+		DEV_TX_OFFLOAD_IPV4_CKSUM |
+		DEV_TX_OFFLOAD_UDP_CKSUM |
+		DEV_TX_OFFLOAD_TCP_CKSUM |
+		DEV_TX_OFFLOAD_SCTP_CKSUM |
+		DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+		DEV_TX_OFFLOAD_TCP_TSO |
+		DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+		DEV_TX_OFFLOAD_GRE_TNL_TSO |
+		DEV_TX_OFFLOAD_IPIP_TNL_TSO |
+		DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
+		DEV_TX_OFFLOAD_MULTI_SEGS;
+
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_thresh = {
+			.pthresh = ICE_DEFAULT_RX_PTHRESH,
+			.hthresh = ICE_DEFAULT_RX_HTHRESH,
+			.wthresh = ICE_DEFAULT_RX_WTHRESH,
+		},
+		.rx_free_thresh = ICE_DEFAULT_RX_FREE_THRESH,
+		.rx_drop_en = 0,
+		.offloads = 0,
+	};
+
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_thresh = {
+			.pthresh = ICE_DEFAULT_TX_PTHRESH,
+			.hthresh = ICE_DEFAULT_TX_HTHRESH,
+			.wthresh = ICE_DEFAULT_TX_WTHRESH,
+		},
+		.tx_free_thresh = ICE_DEFAULT_TX_FREE_THRESH,
+		.tx_rs_thresh = ICE_DEFAULT_TX_RSBIT_THRESH,
+		.offloads = 0,
+	};
+
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = ICE_MAX_RING_DESC,
+		.nb_min = ICE_MIN_RING_DESC,
+		.nb_align = ICE_ALIGN_RING_DESC,
+	};
+
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = ICE_MAX_RING_DESC,
+		.nb_min = ICE_MIN_RING_DESC,
+		.nb_align = ICE_ALIGN_RING_DESC,
+	};
 
 	return 0;
 }
Signature · 1 line
2.17.1
author
#39 lore raw

PATCH v4 3/12 net/ice: complete dev configure in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable device configuration function in DCF.

---
 drivers/net/ice/ice_dcf_ethdev.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf_ethdev.c +10 -1
index eb3708191..01412ced0 100644
@@ -57,8 +57,17 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 }
 
 static int
-ice_dcf_dev_configure(__rte_unused struct rte_eth_dev *dev)
+ice_dcf_dev_configure(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
author
#40 lore raw

PATCH v4 4/12 net/ice: complete queue setup in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Delete original DCF queue setup functions and use ice queue setup and release functions instead.

---
 drivers/net/ice/ice_dcf_ethdev.c | 42 +++-----------------------------
 drivers/net/ice/ice_dcf_ethdev.h |  3 ---
 drivers/net/ice/ice_dcf_parent.c |  7 ++++++
 3 files changed, 11 insertions(+), 41 deletions(-)
drivers/net/ice/ice_dcf_ethdev.c +4 -38
index 01412ced0..b07850ece 100644
@@ -229,11 +229,6 @@ ice_dcf_dev_close(struct rte_eth_dev *dev)
 	ice_dcf_uninit_hw(dev, &adapter->real_hw);
 }
 
-static void
-ice_dcf_queue_release(__rte_unused void *q)
-{
-}
-
 static int
 ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev,
 		    __rte_unused int wait_to_complete)
@@ -241,45 +236,16 @@ ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev,
 	return 0;
 }
 
-static int
-ice_dcf_rx_queue_setup(struct rte_eth_dev *dev,
-		       uint16_t rx_queue_id,
-		       __rte_unused uint16_t nb_rx_desc,
-		       __rte_unused unsigned int socket_id,
-		       __rte_unused const struct rte_eth_rxconf *rx_conf,
-		       __rte_unused struct rte_mempool *mb_pool)
-{
-	struct ice_dcf_adapter *adapter = dev->data->dev_private;
-
-	dev->data->rx_queues[rx_queue_id] = &adapter->rxqs[rx_queue_id];
-
-	return 0;
-}
-
-static int
-ice_dcf_tx_queue_setup(struct rte_eth_dev *dev,
-		       uint16_t tx_queue_id,
-		       __rte_unused uint16_t nb_tx_desc,
-		       __rte_unused unsigned int socket_id,
-		       __rte_unused const struct rte_eth_txconf *tx_conf)
-{
-	struct ice_dcf_adapter *adapter = dev->data->dev_private;
-
-	dev->data->tx_queues[tx_queue_id] = &adapter->txqs[tx_queue_id];
-
-	return 0;
-}
-
 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_configure           = ice_dcf_dev_configure,
 	.dev_infos_get           = ice_dcf_dev_info_get,
-	.rx_queue_setup          = ice_dcf_rx_queue_setup,
-	.tx_queue_setup          = ice_dcf_tx_queue_setup,
-	.rx_queue_release        = ice_dcf_queue_release,
-	.tx_queue_release        = ice_dcf_queue_release,
+	.rx_queue_setup          = ice_rx_queue_setup,
+	.tx_queue_setup          = ice_tx_queue_setup,
+	.rx_queue_release        = ice_rx_queue_release,
+	.tx_queue_release        = ice_tx_queue_release,
 	.link_update             = ice_dcf_link_update,
 	.stats_get               = ice_dcf_stats_get,
 	.stats_reset             = ice_dcf_stats_reset,
drivers/net/ice/ice_dcf_ethdev.h +0 -3
index e60e808d8..b54528bea 100644
@@ -19,10 +19,7 @@ struct ice_dcf_queue {
 
 struct ice_dcf_adapter {
 	struct ice_adapter parent; /* Must be first */
-
 	struct ice_dcf_hw real_hw;
-	struct ice_dcf_queue rxqs[ICE_DCF_MAX_RINGS];
-	struct ice_dcf_queue txqs[ICE_DCF_MAX_RINGS];
 };
 
 void ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw,
drivers/net/ice/ice_dcf_parent.c +7 -0
index d13e19d78..322a5273f 100644
@@ -335,6 +335,13 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)
 	parent_adapter->eth_dev = eth_dev;
 	parent_adapter->pf.adapter = parent_adapter;
 	parent_adapter->pf.dev_data = eth_dev->data;
+	/* create a dummy main_vsi */
+	parent_adapter->pf.main_vsi =
+		rte_zmalloc(NULL, sizeof(struct ice_vsi), 0);
+	if (!parent_adapter->pf.main_vsi)
+		return -ENOMEM;
+	parent_adapter->pf.main_vsi->adapter = parent_adapter;
+
 	parent_hw->back = parent_adapter;
 	parent_hw->mac_type = ICE_MAC_GENERIC;
 	parent_hw->vendor_id = ICE_INTEL_VENDOR_ID;
Signature · 1 line
2.17.1
author
#41 lore raw

PATCH v4 5/12 net/ice: add stop flag for device start / stop

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add stop flag for DCF device start and stop.

---
 drivers/net/ice/ice_dcf_ethdev.c | 14 ++++++++++++++
 drivers/net/ice/ice_dcf_parent.c |  1 +
 2 files changed, 15 insertions(+)
drivers/net/ice/ice_dcf_ethdev.c +14 -0
index b07850ece..676a504fd 100644
@@ -45,6 +45,11 @@ ice_dcf_xmit_pkts(__rte_unused void *tx_queue,
 static int
 ice_dcf_dev_start(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	ad->pf.adapter_stopped = 0;
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
@@ -53,7 +58,16 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 static void
 ice_dcf_dev_stop(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	if (ad->pf.adapter_stopped == 1) {
+		PMD_DRV_LOG(DEBUG, "Port is already stopped");
+		return;
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
+	ad->pf.adapter_stopped = 1;
 }
 
 static int
drivers/net/ice/ice_dcf_parent.c +1 -0
index 322a5273f..c5dfdd36e 100644
@@ -341,6 +341,7 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)
 	if (!parent_adapter->pf.main_vsi)
 		return -ENOMEM;
 	parent_adapter->pf.main_vsi->adapter = parent_adapter;
+	parent_adapter->pf.adapter_stopped = 1;
 
 	parent_hw->back = parent_adapter;
 	parent_hw->mac_type = ICE_MAC_GENERIC;
Signature · 1 line
2.17.1
author
#42 lore raw

PATCH v4 6/12 net/ice: add Rx queue init in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable Rx queues initialization during device start in DCF.

---
 drivers/net/ice/ice_dcf.h        |  1 +
 drivers/net/ice/ice_dcf_ethdev.c | 83 ++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)
drivers/net/ice/ice_dcf.h +1 -0
index 152266e3c..dcb2a0283 100644
@@ -53,6 +53,7 @@ struct ice_dcf_hw {
 	uint8_t *rss_lut;
 	uint8_t *rss_key;
 	uint64_t supported_rxdid;
+	uint16_t num_queue_pairs;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
drivers/net/ice/ice_dcf_ethdev.c +83 -0

97 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#43 lore raw

PATCH v4 7/12 net/ice: init RSS during DCF start

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable RSS initialization during DCF start. Add RSS LUT and RSS key configuration functions.

---
 drivers/net/ice/ice_dcf.c        | 117 +++++++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |   1 +
 drivers/net/ice/ice_dcf_ethdev.c |   8 +++
 3 files changed, 126 insertions(+)
drivers/net/ice/ice_dcf.c +117 -0
index 93fabd5f7..f285323dd 100644
@@ -708,3 +708,120 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	rte_free(hw->rss_lut);
 	rte_free(hw->rss_key);
 }
+
+static int
+ice_dcf_configure_rss_key(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_rss_key *rss_key;
+	struct dcf_virtchnl_cmd args;
+	int len, err;
+
+	len = sizeof(*rss_key) + hw->vf_res->rss_key_size - 1;
+	rss_key = rte_zmalloc("rss_key", len, 0);
+	if (!rss_key)
+		return -ENOMEM;
+
+	rss_key->vsi_id = hw->vsi_res->vsi_id;
+	rss_key->key_len = hw->vf_res->rss_key_size;
+	rte_memcpy(rss_key->key, hw->rss_key, hw->vf_res->rss_key_size);
+
+	args.v_op = VIRTCHNL_OP_CONFIG_RSS_KEY;
+	args.req_msglen = len;
+	args.req_msg = (uint8_t *)rss_key;
+	args.rsp_msglen = 0;
+	args.rsp_buflen = 0;
+	args.rsp_msgbuf = NULL;
+	args.pending = 0;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_KEY");
+
+	rte_free(rss_key);
+	return err;
+}
+
+static int
+ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_rss_lut *rss_lut;
+	struct dcf_virtchnl_cmd args;
+	int len, err;
+
+	len = sizeof(*rss_lut) + hw->vf_res->rss_lut_size - 1;
+	rss_lut = rte_zmalloc("rss_lut", len, 0);
+	if (!rss_lut)
+		return -ENOMEM;
+
+	rss_lut->vsi_id = hw->vsi_res->vsi_id;
+	rss_lut->lut_entries = hw->vf_res->rss_lut_size;
+	rte_memcpy(rss_lut->lut, hw->rss_lut, hw->vf_res->rss_lut_size);
+
+	args.v_op = VIRTCHNL_OP_CONFIG_RSS_LUT;
+	args.req_msglen = len;
+	args.req_msg = (uint8_t *)rss_lut;
+	args.rsp_msglen = 0;
+	args.rsp_buflen = 0;
+	args.rsp_msgbuf = NULL;
+	args.pending = 0;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_LUT");
+
+	rte_free(rss_lut);
+	return err;
+}
+
+int
+ice_dcf_init_rss(struct ice_dcf_hw *hw)
+{
+	struct rte_eth_dev *dev = hw->eth_dev;
+	struct rte_eth_rss_conf *rss_conf;
+	uint8_t i, j, nb_q;
+	int ret;
+
+	rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = dev->data->nb_rx_queues;
+
+	if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF)) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+	if (dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
+		PMD_DRV_LOG(WARNING, "RSS is enabled by PF by default");
+		/* set all lut items to default queue */
+		memset(hw->rss_lut, 0, hw->vf_res->rss_lut_size);
+		return ice_dcf_configure_rss_lut(hw);
+	}
+
+	/* In IAVF, RSS enablement is set by PF driver. It is not supported
+	 * to set based on rss_conf->rss_hf.
+	 */
+
+	/* configure RSS key */
+	if (!rss_conf->rss_key)
+		/* Calculate the default hash key */
+		for (i = 0; i < hw->vf_res->rss_key_size; i++)
+			hw->rss_key[i] = (uint8_t)rte_rand();
+	else
+		rte_memcpy(hw->rss_key, rss_conf->rss_key,
+			   RTE_MIN(rss_conf->rss_key_len,
+				   hw->vf_res->rss_key_size));
+
+	/* init RSS LUT table */
+	for (i = 0, j = 0; i < hw->vf_res->rss_lut_size; i++, j++) {
+		if (j >= nb_q)
+			j = 0;
+		hw->rss_lut[i] = j;
+	}
+	/* send virtchnnl ops to configure rss*/
+	ret = ice_dcf_configure_rss_lut(hw);
+	if (ret)
+		return ret;
+	ret = ice_dcf_configure_rss_key(hw);
+	if (ret)
+		return ret;
+
+	return 0;
+}
drivers/net/ice/ice_dcf.h +1 -0
index dcb2a0283..eea4b286b 100644
@@ -63,5 +63,6 @@ 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_init_rss(struct ice_dcf_hw *hw);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +8 -0
index 5afd07f96..e2ab7e637 100644
@@ -133,6 +133,14 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
+		ret = ice_dcf_init_rss(hw);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "Failed to configure RSS");
+			return ret;
+		}
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
Signature · 1 line
2.17.1
author
#44 lore raw

PATCH v4 8/12 net/ice: add queue config in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add queues and Rx queue irqs configuration during device start in DCF. The setup is sent to PF via virtchnl.

---
 drivers/net/ice/ice_dcf.c        | 111 +++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |   6 ++
 drivers/net/ice/ice_dcf_ethdev.c | 126 +++++++++++++++++++++++++++++++
 3 files changed, 243 insertions(+)
drivers/net/ice/ice_dcf.c +111 -0
index f285323dd..8869e0d1c 100644
@@ -24,6 +24,7 @@
 #include <rte_dev.h>
 
 #include "ice_dcf.h"
+#include "ice_rxtx.h"
 
 #define ICE_DCF_AQ_LEN     32
 #define ICE_DCF_AQ_BUF_SZ  4096
@@ -825,3 +826,113 @@ ice_dcf_init_rss(struct ice_dcf_hw *hw)
 
 	return 0;
 }
+
+#define IAVF_RXDID_LEGACY_1 1
+#define IAVF_RXDID_COMMS_GENERIC 16
+
+int
+ice_dcf_configure_queues(struct ice_dcf_hw *hw)
+{
+	struct ice_rx_queue **rxq =
+		(struct ice_rx_queue **)hw->eth_dev->data->rx_queues;
+	struct ice_tx_queue **txq =
+		(struct ice_tx_queue **)hw->eth_dev->data->tx_queues;
+	struct virtchnl_vsi_queue_config_info *vc_config;
+	struct virtchnl_queue_pair_info *vc_qp;
+	struct dcf_virtchnl_cmd args;
+	uint16_t i, size;
+	int err;
+
+	size = sizeof(*vc_config) +
+	       sizeof(vc_config->qpair[0]) * hw->num_queue_pairs;
+	vc_config = rte_zmalloc("cfg_queue", size, 0);
+	if (!vc_config)
+		return -ENOMEM;
+
+	vc_config->vsi_id = hw->vsi_res->vsi_id;
+	vc_config->num_queue_pairs = hw->num_queue_pairs;
+
+	for (i = 0, vc_qp = vc_config->qpair;
+	     i < hw->num_queue_pairs;
+	     i++, vc_qp++) {
+		vc_qp->txq.vsi_id = hw->vsi_res->vsi_id;
+		vc_qp->txq.queue_id = i;
+		if (i < hw->eth_dev->data->nb_tx_queues) {
+			vc_qp->txq.ring_len = txq[i]->nb_tx_desc;
+			vc_qp->txq.dma_ring_addr = txq[i]->tx_ring_dma;
+		}
+		vc_qp->rxq.vsi_id = hw->vsi_res->vsi_id;
+		vc_qp->rxq.queue_id = i;
+		vc_qp->rxq.max_pkt_size = rxq[i]->max_pkt_len;
+
+		if (i >= hw->eth_dev->data->nb_rx_queues)
+			continue;
+
+		vc_qp->rxq.ring_len = rxq[i]->nb_rx_desc;
+		vc_qp->rxq.dma_ring_addr = rxq[i]->rx_ring_dma;
+		vc_qp->rxq.databuffer_size = rxq[i]->rx_buf_len;
+
+		if (hw->vf_res->vf_cap_flags &
+		    VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC &&
+		    hw->supported_rxdid &
+		    BIT(IAVF_RXDID_COMMS_GENERIC)) {
+			vc_qp->rxq.rxdid = IAVF_RXDID_COMMS_GENERIC;
+			PMD_DRV_LOG(NOTICE, "request RXDID == %d in "
+				    "Queue[%d]", vc_qp->rxq.rxdid, i);
+		} else {
+			PMD_DRV_LOG(ERR, "RXDID 16 is not supported");
+			return -EINVAL;
+		}
+	}
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_CONFIG_VSI_QUEUES;
+	args.req_msg = (uint8_t *)vc_config;
+	args.req_msglen = size;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "Failed to execute command of"
+			    " VIRTCHNL_OP_CONFIG_VSI_QUEUES");
+
+	rte_free(vc_config);
+	return err;
+}
+
+int
+ice_dcf_config_irq_map(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_irq_map_info *map_info;
+	struct virtchnl_vector_map *vecmap;
+	struct dcf_virtchnl_cmd args;
+	int len, i, err;
+
+	len = sizeof(struct virtchnl_irq_map_info) +
+	      sizeof(struct virtchnl_vector_map) * hw->nb_msix;
+
+	map_info = rte_zmalloc("map_info", len, 0);
+	if (!map_info)
+		return -ENOMEM;
+
+	map_info->num_vectors = hw->nb_msix;
+	for (i = 0; i < hw->nb_msix; i++) {
+		vecmap = &map_info->vecmap[i];
+		vecmap->vsi_id = hw->vsi_res->vsi_id;
+		vecmap->rxitr_idx = 0;
+		vecmap->vector_id = hw->msix_base + i;
+		vecmap->txq_map = 0;
+		vecmap->rxq_map = hw->rxq_map[hw->msix_base + i];
+	}
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_CONFIG_IRQ_MAP;
+	args.req_msg = (u8 *)map_info;
+	args.req_msglen = len;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command OP_CONFIG_IRQ_MAP");
+
+	rte_free(map_info);
+	return err;
+}
drivers/net/ice/ice_dcf.h +6 -0
index eea4b286b..9470d1df7 100644
@@ -54,6 +54,10 @@ struct ice_dcf_hw {
 	uint8_t *rss_key;
 	uint64_t supported_rxdid;
 	uint16_t num_queue_pairs;
+
+	uint16_t msix_base;
+	uint16_t nb_msix;
+	uint16_t rxq_map[16];
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
@@ -64,5 +68,7 @@ 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_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);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +126 -0

142 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#45 lore raw

PATCH v4 9/12 net/ice: add queue start and stop for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add queue start and stop in DCF. Support queue enable and disable through virtual channel. Add support for Rx queue mbufs allocation and queue reset.

---
 drivers/net/ice/ice_dcf.c        |  57 ++++++
 drivers/net/ice/ice_dcf.h        |   3 +-
 drivers/net/ice/ice_dcf_ethdev.c | 322 +++++++++++++++++++++++++++++++
 3 files changed, 381 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +57 -0
index 8869e0d1c..f18c0f16a 100644
@@ -936,3 +936,60 @@ ice_dcf_config_irq_map(struct ice_dcf_hw *hw)
 	rte_free(map_info);
 	return err;
 }
+
+int
+ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on)
+{
+	struct virtchnl_queue_select queue_select;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&queue_select, 0, sizeof(queue_select));
+	queue_select.vsi_id = hw->vsi_res->vsi_id;
+	if (rx)
+		queue_select.rx_queues |= 1 << qid;
+	else
+		queue_select.tx_queues |= 1 << qid;
+
+	memset(&args, 0, sizeof(args));
+	if (on)
+		args.v_op = VIRTCHNL_OP_ENABLE_QUEUES;
+	else
+		args.v_op = VIRTCHNL_OP_DISABLE_QUEUES;
+
+	args.req_msg = (u8 *)&queue_select;
+	args.req_msglen = sizeof(queue_select);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "Failed to execute command of %s",
+			    on ? "OP_ENABLE_QUEUES" : "OP_DISABLE_QUEUES");
+
+	return err;
+}
+
+int
+ice_dcf_disable_queues(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_queue_select queue_select;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&queue_select, 0, sizeof(queue_select));
+	queue_select.vsi_id = hw->vsi_res->vsi_id;
+
+	queue_select.rx_queues = BIT(hw->eth_dev->data->nb_rx_queues) - 1;
+	queue_select.tx_queues = BIT(hw->eth_dev->data->nb_tx_queues) - 1;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_DISABLE_QUEUES;
+	args.req_msg = (u8 *)&queue_select;
+	args.req_msglen = sizeof(queue_select);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR,
+			    "Failed to execute command of OP_DISABLE_QUEUES");
+
+	return err;
+}
drivers/net/ice/ice_dcf.h +2 -1
index 9470d1df7..68e1661c0 100644
@@ -70,5 +70,6 @@ void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, 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);
-
+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);
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +322 -0

355 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#46 lore raw

PATCH v4 10/12 net/ice: enable stats for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to get and reset Rx/Tx stats in DCF. Query stats from PF.

---
 drivers/net/ice/ice_dcf.c        |  27 ++++++++
 drivers/net/ice/ice_dcf.h        |   4 ++
 drivers/net/ice/ice_dcf_ethdev.c | 102 +++++++++++++++++++++++++++----
 3 files changed, 120 insertions(+), 13 deletions(-)
drivers/net/ice/ice_dcf.c +27 -0
index f18c0f16a..fbeb58ee1 100644
@@ -993,3 +993,30 @@ ice_dcf_disable_queues(struct ice_dcf_hw *hw)
 
 	return err;
 }
+
+int
+ice_dcf_query_stats(struct ice_dcf_hw *hw,
+				   struct virtchnl_eth_stats *pstats)
+{
+	struct virtchnl_queue_select q_stats;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&q_stats, 0, sizeof(q_stats));
+	q_stats.vsi_id = hw->vsi_res->vsi_id;
+
+	args.v_op = VIRTCHNL_OP_GET_STATS;
+	args.req_msg = (uint8_t *)&q_stats;
+	args.req_msglen = sizeof(q_stats);
+	args.rsp_msglen = sizeof(*pstats);
+	args.rsp_msgbuf = (uint8_t *)pstats;
+	args.rsp_buflen = sizeof(*pstats);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err) {
+		PMD_DRV_LOG(ERR, "fail to execute command OP_GET_STATS");
+		return err;
+	}
+
+	return 0;
+}
drivers/net/ice/ice_dcf.h +4 -0
index 68e1661c0..e82bc7748 100644
@@ -58,6 +58,7 @@ struct ice_dcf_hw {
 	uint16_t msix_base;
 	uint16_t nb_msix;
 	uint16_t rxq_map[16];
+	struct virtchnl_eth_stats eth_stats_offset;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
@@ -72,4 +73,7 @@ int ice_dcf_configure_queues(struct ice_dcf_hw *hw);
 int ice_dcf_config_irq_map(struct ice_dcf_hw *hw);
 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);
+
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +89 -13

114 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#47 lore raw

PATCH v4 11/12 net/ice: set MAC filter during dev start for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to add and delete MAC address filter in DCF.

---
 drivers/net/ice/ice_dcf.c        | 42 ++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |  1 +
 drivers/net/ice/ice_dcf_ethdev.c |  7 ++++++
 3 files changed, 50 insertions(+)
drivers/net/ice/ice_dcf.c +42 -0
index fbeb58ee1..712f43825 100644
@@ -1020,3 +1020,45 @@ ice_dcf_query_stats(struct ice_dcf_hw *hw,
 
 	return 0;
 }
+
+int
+ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
+{
+	struct virtchnl_ether_addr_list *list;
+	struct rte_ether_addr *addr;
+	struct dcf_virtchnl_cmd args;
+	int len, err = 0;
+
+	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);
+	if (!list) {
+		PMD_DRV_LOG(ERR, "fail to allocate memory");
+		return -ENOMEM;
+	}
+
+	rte_memcpy(list->list[0].addr, addr->addr_bytes,
+			sizeof(addr->addr_bytes));
+	PMD_DRV_LOG(DEBUG, "add/rm mac:%x:%x:%x:%x:%x:%x",
+			    addr->addr_bytes[0], addr->addr_bytes[1],
+			    addr->addr_bytes[2], addr->addr_bytes[3],
+			    addr->addr_bytes[4], addr->addr_bytes[5]);
+
+	list->vsi_id = hw->vsi_res->vsi_id;
+	list->num_elements = 1;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = add ? VIRTCHNL_OP_ADD_ETH_ADDR :
+			VIRTCHNL_OP_DEL_ETH_ADDR;
+	args.req_msg = (uint8_t *)list;
+	args.req_msglen  = len;
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command %s",
+			    add ? "OP_ADD_ETHER_ADDRESS" :
+			    "OP_DEL_ETHER_ADDRESS");
+	rte_free(list);
+	return err;
+}
drivers/net/ice/ice_dcf.h +1 -0
index e82bc7748..a44a01e90 100644
@@ -75,5 +75,6 @@ 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);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +7 -0
index 38e321f4b..c39dfc1cc 100644
@@ -544,6 +544,12 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	ret = ice_dcf_add_del_all_mac_addr(hw, true);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to add mac addr");
+		return ret;
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
@@ -601,6 +607,7 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 		intr_handle->intr_vec = NULL;
 	}
 
+	ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false);
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	ad->pf.adapter_stopped = 1;
 }
Signature · 1 line
2.17.1
author
#48 lore raw

PATCH v4 12/12 doc: enable DCF datapath configuration

In reply to Ting Xu

Add doc for DCF datapath configuration in DPDK 20.08 release note.

---
 doc/guides/rel_notes/release_20_08.rst | 6 ++++++
 1 file changed, 6 insertions(+)
doc/guides/rel_notes/release_20_08.rst +6 -0
index dee4ccbb5..1a3a4cdb2 100644
@@ -56,6 +56,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated the Intel ice driver.**
+
+  Updated the Intel ice driver with new features and improvements, including:
+
+  * Added support for DCF datapath configuration.
+
 * **Updated Mellanox mlx5 driver.**
 
   Updated Mellanox mlx5 driver with new features and improvements, including:
Signature · 1 line
2.17.1
#49 lore raw

Re: [dpdk-dev] [PATCH v4 12/12] doc: enable DCF datapath configuration

Quoted 38 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Friday, June 19, 2020 4:51 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Kovacevic, Marko <[email protected]>; Mcnamara, John <[email protected]>; Xu, Ting <[email protected]>
Subject: [PATCH v4 12/12] doc: enable DCF datapath configuration

Add doc for DCF datapath configuration in DPDK 20.08 release note.

---
 doc/guides/rel_notes/release_20_08.rst | 6 ++++++
 1 file changed, 6 insertions(+)
doc/guides/rel_notes/release_20_08.rst +3 -0
index dee4ccbb5..1a3a4cdb2 100644
@@ -56,6 +56,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated the Intel ice driver.**
+
+  Updated the Intel ice driver with new features and improvements,

including:

doc/guides/rel_notes/release_20_08.rst +3 -0
+
+  * Added support for DCF datapath configuration.
+
 * **Updated Mellanox mlx5 driver.**
 
   Updated Mellanox mlx5 driver with new features and improvements,
Quoted 3 lines

including:
--
2.17.1

We might also need to add doc/nic/features/ice_dcf.ini as a new type of ethdev has been added.

author
#50 lore raw

v5 cover enable DCF datapath configuration

In reply to Ting Xu

This patchset adds support to configure DCF datapath, including Rx/Tx queues setup, start and stop, device configuration, RSS and flexible descriptor RXDID initialization and MAC filter setup.

Qi Zhang (11):
net/ice: init RSS and supported RXDID in DCF net/ice: complete device info get in DCF net/ice: complete dev configure in DCF net/ice: complete queue setup in DCF net/ice: add stop flag for device start / stop net/ice: add Rx queue init in DCF net/ice: init RSS during DCF start net/ice: add queue config in DCF net/ice: add queue start and stop for DCF net/ice: enable stats for DCF
net/ice: set MAC filter during dev start for DCF

Ting Xu (1):
doc: enable DCF datapath configuration

---
v4->v5:
Add driver's feature doc

v3->v4:
Clean codes based on comments

v2->v3:
Correct coding style issue

v1->v2:
Optimize coding style
Correct some return values
Add support to stop started queues when queue start failed

 doc/guides/nics/features/ice_dcf.ini   |  19 +
 doc/guides/rel_notes/release_20_08.rst |   6 +
 drivers/net/ice/ice_dcf.c              | 408 ++++++++++++-
 drivers/net/ice/ice_dcf.h              |  17 +
 drivers/net/ice/ice_dcf_ethdev.c       | 773 +++++++++++++++++++++++--
 drivers/net/ice/ice_dcf_ethdev.h       |   3 -
 drivers/net/ice/ice_dcf_parent.c       |   8 +
 7 files changed, 1181 insertions(+), 53 deletions(-)
 create mode 100644 doc/guides/nics/features/ice_dcf.ini
Signature · 1 line
2.17.1
author
#51 lore raw

PATCH v5 1/12 net/ice: init RSS and supported RXDID in DCF

From: Qi Zhang <[email protected]>

Enable RSS parameters initialization and get the supported flexible descriptor RXDIDs bitmap from PF during DCF init.

---
 drivers/net/ice/ice_dcf.c | 54 ++++++++++++++++++++++++++++++++++++++-
 drivers/net/ice/ice_dcf.h |  3 +++
 2 files changed, 56 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +53 -1
index 0cd5d1bf6..93fabd5f7 100644
@@ -233,7 +233,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)
 
 	caps = VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | VIRTCHNL_VF_OFFLOAD_RX_POLLING |
 	       VIRTCHNL_VF_CAP_ADV_LINK_SPEED | VIRTCHNL_VF_CAP_DCF |
-	       VF_BASE_MODE_OFFLOADS;
+	       VF_BASE_MODE_OFFLOADS | VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC;
 
 	err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES,
 					  (uint8_t *)&caps, sizeof(caps));
@@ -547,6 +547,30 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw)
 	return err;
 }
 
+static int
+ice_dcf_get_supported_rxdid(struct ice_dcf_hw *hw)
+{
+	int err;
+
+	err = ice_dcf_send_cmd_req_no_irq(hw,
+					  VIRTCHNL_OP_GET_SUPPORTED_RXDIDS,
+					  NULL, 0);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to send OP_GET_SUPPORTED_RXDIDS");
+		return -1;
+	}
+
+	err = ice_dcf_recv_cmd_rsp_no_irq(hw, VIRTCHNL_OP_GET_SUPPORTED_RXDIDS,
+					  (uint8_t *)&hw->supported_rxdid,
+					  sizeof(uint64_t), NULL);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Failed to get response of OP_GET_SUPPORTED_RXDIDS");
+		return -1;
+	}
+
+	return 0;
+}
+
 int
 ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 {
@@ -620,6 +644,29 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 		goto err_alloc;
 	}
 
+	/* Allocate memory for RSS info */
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
+		hw->rss_key = rte_zmalloc(NULL,
+					  hw->vf_res->rss_key_size, 0);
+		if (!hw->rss_key) {
+			PMD_INIT_LOG(ERR, "unable to allocate rss_key memory");
+			goto err_alloc;
+		}
+		hw->rss_lut = rte_zmalloc("rss_lut",
+					  hw->vf_res->rss_lut_size, 0);
+		if (!hw->rss_lut) {
+			PMD_INIT_LOG(ERR, "unable to allocate rss_lut memory");
+			goto err_rss;
+		}
+	}
+
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) {
+		if (ice_dcf_get_supported_rxdid(hw) != 0) {
+			PMD_INIT_LOG(ERR, "failed to do get supported rxdid");
+			goto err_rss;
+		}
+	}
+
 	hw->eth_dev = eth_dev;
 	rte_intr_callback_register(&pci_dev->intr_handle,
 				   ice_dcf_dev_interrupt_handler, hw);
@@ -628,6 +675,9 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 
 	return 0;
 
+err_rss:
+	rte_free(hw->rss_key);
+	rte_free(hw->rss_lut);
 err_alloc:
 	rte_free(hw->vf_res);
 err_api:
@@ -655,4 +705,6 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	rte_free(hw->arq_buf);
 	rte_free(hw->vf_vsi_map);
 	rte_free(hw->vf_res);
+	rte_free(hw->rss_lut);
+	rte_free(hw->rss_key);
 }
drivers/net/ice/ice_dcf.h +3 -0
index d2e447b48..152266e3c 100644
@@ -50,6 +50,9 @@ struct ice_dcf_hw {
 	uint16_t vsi_id;
 
 	struct rte_eth_dev *eth_dev;
+	uint8_t *rss_lut;
+	uint8_t *rss_key;
+	uint64_t supported_rxdid;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
Signature · 1 line
2.17.1
author
#52 lore raw

PATCH v5 2/12 net/ice: complete device info get in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to get complete device information for DCF, including Rx/Tx offload capabilities and default configuration.

---
 drivers/net/ice/ice_dcf_ethdev.c | 70 ++++++++++++++++++++++++++++++--
 1 file changed, 67 insertions(+), 3 deletions(-)
drivers/net/ice/ice_dcf_ethdev.c +67 -3
index e5ba1a61f..eb3708191 100644
@@ -24,6 +24,7 @@
 
 #include "ice_generic_flow.h"
 #include "ice_dcf_ethdev.h"
+#include "ice_rxtx.h"
 
 static uint16_t
 ice_dcf_recv_pkts(__rte_unused void *rx_queue,
@@ -66,11 +67,74 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev,
 		     struct rte_eth_dev_info *dev_info)
 {
 	struct ice_dcf_adapter *adapter = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &adapter->real_hw;
 
 	dev_info->max_mac_addrs = 1;
-	dev_info->max_rx_pktlen = (uint32_t)-1;
-	dev_info->max_rx_queues = RTE_DIM(adapter->rxqs);
-	dev_info->max_tx_queues = RTE_DIM(adapter->txqs);
+	dev_info->max_rx_queues = hw->vsi_res->num_queue_pairs;
+	dev_info->max_tx_queues = hw->vsi_res->num_queue_pairs;
+	dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN;
+	dev_info->max_rx_pktlen = ICE_FRAME_SIZE_MAX;
+	dev_info->hash_key_size = hw->vf_res->rss_key_size;
+	dev_info->reta_size = hw->vf_res->rss_lut_size;
+	dev_info->flow_type_rss_offloads = ICE_RSS_OFFLOAD_ALL;
+
+	dev_info->rx_offload_capa =
+		DEV_RX_OFFLOAD_VLAN_STRIP |
+		DEV_RX_OFFLOAD_IPV4_CKSUM |
+		DEV_RX_OFFLOAD_UDP_CKSUM |
+		DEV_RX_OFFLOAD_TCP_CKSUM |
+		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
+		DEV_RX_OFFLOAD_SCATTER |
+		DEV_RX_OFFLOAD_JUMBO_FRAME |
+		DEV_RX_OFFLOAD_VLAN_FILTER |
+		DEV_RX_OFFLOAD_RSS_HASH;
+	dev_info->tx_offload_capa =
+		DEV_TX_OFFLOAD_VLAN_INSERT |
+		DEV_TX_OFFLOAD_IPV4_CKSUM |
+		DEV_TX_OFFLOAD_UDP_CKSUM |
+		DEV_TX_OFFLOAD_TCP_CKSUM |
+		DEV_TX_OFFLOAD_SCTP_CKSUM |
+		DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+		DEV_TX_OFFLOAD_TCP_TSO |
+		DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+		DEV_TX_OFFLOAD_GRE_TNL_TSO |
+		DEV_TX_OFFLOAD_IPIP_TNL_TSO |
+		DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
+		DEV_TX_OFFLOAD_MULTI_SEGS;
+
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_thresh = {
+			.pthresh = ICE_DEFAULT_RX_PTHRESH,
+			.hthresh = ICE_DEFAULT_RX_HTHRESH,
+			.wthresh = ICE_DEFAULT_RX_WTHRESH,
+		},
+		.rx_free_thresh = ICE_DEFAULT_RX_FREE_THRESH,
+		.rx_drop_en = 0,
+		.offloads = 0,
+	};
+
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_thresh = {
+			.pthresh = ICE_DEFAULT_TX_PTHRESH,
+			.hthresh = ICE_DEFAULT_TX_HTHRESH,
+			.wthresh = ICE_DEFAULT_TX_WTHRESH,
+		},
+		.tx_free_thresh = ICE_DEFAULT_TX_FREE_THRESH,
+		.tx_rs_thresh = ICE_DEFAULT_TX_RSBIT_THRESH,
+		.offloads = 0,
+	};
+
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = ICE_MAX_RING_DESC,
+		.nb_min = ICE_MIN_RING_DESC,
+		.nb_align = ICE_ALIGN_RING_DESC,
+	};
+
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = ICE_MAX_RING_DESC,
+		.nb_min = ICE_MIN_RING_DESC,
+		.nb_align = ICE_ALIGN_RING_DESC,
+	};
 
 	return 0;
 }
Signature · 1 line
2.17.1
author
#53 lore raw

PATCH v5 3/12 net/ice: complete dev configure in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable device configuration function in DCF.

---
 drivers/net/ice/ice_dcf_ethdev.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf_ethdev.c +10 -1
index eb3708191..01412ced0 100644
@@ -57,8 +57,17 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 }
 
 static int
-ice_dcf_dev_configure(__rte_unused struct rte_eth_dev *dev)
+ice_dcf_dev_configure(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	ad->rx_bulk_alloc_allowed = true;
+	ad->tx_simple_allowed = true;
+
+	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
author
#54 lore raw

PATCH v5 4/12 net/ice: complete queue setup in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Delete original DCF queue setup functions and use ice queue setup and release functions instead.

---
 drivers/net/ice/ice_dcf_ethdev.c | 42 +++-----------------------------
 drivers/net/ice/ice_dcf_ethdev.h |  3 ---
 drivers/net/ice/ice_dcf_parent.c |  7 ++++++
 3 files changed, 11 insertions(+), 41 deletions(-)
drivers/net/ice/ice_dcf_ethdev.c +4 -38
index 01412ced0..b07850ece 100644
@@ -229,11 +229,6 @@ ice_dcf_dev_close(struct rte_eth_dev *dev)
 	ice_dcf_uninit_hw(dev, &adapter->real_hw);
 }
 
-static void
-ice_dcf_queue_release(__rte_unused void *q)
-{
-}
-
 static int
 ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev,
 		    __rte_unused int wait_to_complete)
@@ -241,45 +236,16 @@ ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev,
 	return 0;
 }
 
-static int
-ice_dcf_rx_queue_setup(struct rte_eth_dev *dev,
-		       uint16_t rx_queue_id,
-		       __rte_unused uint16_t nb_rx_desc,
-		       __rte_unused unsigned int socket_id,
-		       __rte_unused const struct rte_eth_rxconf *rx_conf,
-		       __rte_unused struct rte_mempool *mb_pool)
-{
-	struct ice_dcf_adapter *adapter = dev->data->dev_private;
-
-	dev->data->rx_queues[rx_queue_id] = &adapter->rxqs[rx_queue_id];
-
-	return 0;
-}
-
-static int
-ice_dcf_tx_queue_setup(struct rte_eth_dev *dev,
-		       uint16_t tx_queue_id,
-		       __rte_unused uint16_t nb_tx_desc,
-		       __rte_unused unsigned int socket_id,
-		       __rte_unused const struct rte_eth_txconf *tx_conf)
-{
-	struct ice_dcf_adapter *adapter = dev->data->dev_private;
-
-	dev->data->tx_queues[tx_queue_id] = &adapter->txqs[tx_queue_id];
-
-	return 0;
-}
-
 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_configure           = ice_dcf_dev_configure,
 	.dev_infos_get           = ice_dcf_dev_info_get,
-	.rx_queue_setup          = ice_dcf_rx_queue_setup,
-	.tx_queue_setup          = ice_dcf_tx_queue_setup,
-	.rx_queue_release        = ice_dcf_queue_release,
-	.tx_queue_release        = ice_dcf_queue_release,
+	.rx_queue_setup          = ice_rx_queue_setup,
+	.tx_queue_setup          = ice_tx_queue_setup,
+	.rx_queue_release        = ice_rx_queue_release,
+	.tx_queue_release        = ice_tx_queue_release,
 	.link_update             = ice_dcf_link_update,
 	.stats_get               = ice_dcf_stats_get,
 	.stats_reset             = ice_dcf_stats_reset,
drivers/net/ice/ice_dcf_ethdev.h +0 -3
index e60e808d8..b54528bea 100644
@@ -19,10 +19,7 @@ struct ice_dcf_queue {
 
 struct ice_dcf_adapter {
 	struct ice_adapter parent; /* Must be first */
-
 	struct ice_dcf_hw real_hw;
-	struct ice_dcf_queue rxqs[ICE_DCF_MAX_RINGS];
-	struct ice_dcf_queue txqs[ICE_DCF_MAX_RINGS];
 };
 
 void ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw,
drivers/net/ice/ice_dcf_parent.c +7 -0
index d13e19d78..322a5273f 100644
@@ -335,6 +335,13 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)
 	parent_adapter->eth_dev = eth_dev;
 	parent_adapter->pf.adapter = parent_adapter;
 	parent_adapter->pf.dev_data = eth_dev->data;
+	/* create a dummy main_vsi */
+	parent_adapter->pf.main_vsi =
+		rte_zmalloc(NULL, sizeof(struct ice_vsi), 0);
+	if (!parent_adapter->pf.main_vsi)
+		return -ENOMEM;
+	parent_adapter->pf.main_vsi->adapter = parent_adapter;
+
 	parent_hw->back = parent_adapter;
 	parent_hw->mac_type = ICE_MAC_GENERIC;
 	parent_hw->vendor_id = ICE_INTEL_VENDOR_ID;
Signature · 1 line
2.17.1
author
#55 lore raw

PATCH v5 5/12 net/ice: add stop flag for device start / stop

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add stop flag for DCF device start and stop.

---
 drivers/net/ice/ice_dcf_ethdev.c | 14 ++++++++++++++
 drivers/net/ice/ice_dcf_parent.c |  1 +
 2 files changed, 15 insertions(+)
drivers/net/ice/ice_dcf_ethdev.c +14 -0
index b07850ece..676a504fd 100644
@@ -45,6 +45,11 @@ ice_dcf_xmit_pkts(__rte_unused void *tx_queue,
 static int
 ice_dcf_dev_start(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	ad->pf.adapter_stopped = 0;
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
@@ -53,7 +58,16 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 static void
 ice_dcf_dev_stop(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
+	struct ice_adapter *ad = &dcf_ad->parent;
+
+	if (ad->pf.adapter_stopped == 1) {
+		PMD_DRV_LOG(DEBUG, "Port is already stopped");
+		return;
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
+	ad->pf.adapter_stopped = 1;
 }
 
 static int
drivers/net/ice/ice_dcf_parent.c +1 -0
index 322a5273f..c5dfdd36e 100644
@@ -341,6 +341,7 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)
 	if (!parent_adapter->pf.main_vsi)
 		return -ENOMEM;
 	parent_adapter->pf.main_vsi->adapter = parent_adapter;
+	parent_adapter->pf.adapter_stopped = 1;
 
 	parent_hw->back = parent_adapter;
 	parent_hw->mac_type = ICE_MAC_GENERIC;
Signature · 1 line
2.17.1
author
#56 lore raw

PATCH v5 6/12 net/ice: add Rx queue init in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable Rx queues initialization during device start in DCF.

---
 drivers/net/ice/ice_dcf.h        |  1 +
 drivers/net/ice/ice_dcf_ethdev.c | 83 ++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)
drivers/net/ice/ice_dcf.h +1 -0
index 152266e3c..dcb2a0283 100644
@@ -53,6 +53,7 @@ struct ice_dcf_hw {
 	uint8_t *rss_lut;
 	uint8_t *rss_key;
 	uint64_t supported_rxdid;
+	uint16_t num_queue_pairs;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
drivers/net/ice/ice_dcf_ethdev.c +83 -0

97 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#57 lore raw

PATCH v5 7/12 net/ice: init RSS during DCF start

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Enable RSS initialization during DCF start. Add RSS LUT and RSS key configuration functions.

---
 drivers/net/ice/ice_dcf.c        | 117 +++++++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |   1 +
 drivers/net/ice/ice_dcf_ethdev.c |   8 +++
 3 files changed, 126 insertions(+)
drivers/net/ice/ice_dcf.c +117 -0
index 93fabd5f7..f285323dd 100644
@@ -708,3 +708,120 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	rte_free(hw->rss_lut);
 	rte_free(hw->rss_key);
 }
+
+static int
+ice_dcf_configure_rss_key(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_rss_key *rss_key;
+	struct dcf_virtchnl_cmd args;
+	int len, err;
+
+	len = sizeof(*rss_key) + hw->vf_res->rss_key_size - 1;
+	rss_key = rte_zmalloc("rss_key", len, 0);
+	if (!rss_key)
+		return -ENOMEM;
+
+	rss_key->vsi_id = hw->vsi_res->vsi_id;
+	rss_key->key_len = hw->vf_res->rss_key_size;
+	rte_memcpy(rss_key->key, hw->rss_key, hw->vf_res->rss_key_size);
+
+	args.v_op = VIRTCHNL_OP_CONFIG_RSS_KEY;
+	args.req_msglen = len;
+	args.req_msg = (uint8_t *)rss_key;
+	args.rsp_msglen = 0;
+	args.rsp_buflen = 0;
+	args.rsp_msgbuf = NULL;
+	args.pending = 0;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_KEY");
+
+	rte_free(rss_key);
+	return err;
+}
+
+static int
+ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_rss_lut *rss_lut;
+	struct dcf_virtchnl_cmd args;
+	int len, err;
+
+	len = sizeof(*rss_lut) + hw->vf_res->rss_lut_size - 1;
+	rss_lut = rte_zmalloc("rss_lut", len, 0);
+	if (!rss_lut)
+		return -ENOMEM;
+
+	rss_lut->vsi_id = hw->vsi_res->vsi_id;
+	rss_lut->lut_entries = hw->vf_res->rss_lut_size;
+	rte_memcpy(rss_lut->lut, hw->rss_lut, hw->vf_res->rss_lut_size);
+
+	args.v_op = VIRTCHNL_OP_CONFIG_RSS_LUT;
+	args.req_msglen = len;
+	args.req_msg = (uint8_t *)rss_lut;
+	args.rsp_msglen = 0;
+	args.rsp_buflen = 0;
+	args.rsp_msgbuf = NULL;
+	args.pending = 0;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_LUT");
+
+	rte_free(rss_lut);
+	return err;
+}
+
+int
+ice_dcf_init_rss(struct ice_dcf_hw *hw)
+{
+	struct rte_eth_dev *dev = hw->eth_dev;
+	struct rte_eth_rss_conf *rss_conf;
+	uint8_t i, j, nb_q;
+	int ret;
+
+	rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = dev->data->nb_rx_queues;
+
+	if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF)) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+	if (dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
+		PMD_DRV_LOG(WARNING, "RSS is enabled by PF by default");
+		/* set all lut items to default queue */
+		memset(hw->rss_lut, 0, hw->vf_res->rss_lut_size);
+		return ice_dcf_configure_rss_lut(hw);
+	}
+
+	/* In IAVF, RSS enablement is set by PF driver. It is not supported
+	 * to set based on rss_conf->rss_hf.
+	 */
+
+	/* configure RSS key */
+	if (!rss_conf->rss_key)
+		/* Calculate the default hash key */
+		for (i = 0; i < hw->vf_res->rss_key_size; i++)
+			hw->rss_key[i] = (uint8_t)rte_rand();
+	else
+		rte_memcpy(hw->rss_key, rss_conf->rss_key,
+			   RTE_MIN(rss_conf->rss_key_len,
+				   hw->vf_res->rss_key_size));
+
+	/* init RSS LUT table */
+	for (i = 0, j = 0; i < hw->vf_res->rss_lut_size; i++, j++) {
+		if (j >= nb_q)
+			j = 0;
+		hw->rss_lut[i] = j;
+	}
+	/* send virtchnnl ops to configure rss*/
+	ret = ice_dcf_configure_rss_lut(hw);
+	if (ret)
+		return ret;
+	ret = ice_dcf_configure_rss_key(hw);
+	if (ret)
+		return ret;
+
+	return 0;
+}
drivers/net/ice/ice_dcf.h +1 -0
index dcb2a0283..eea4b286b 100644
@@ -63,5 +63,6 @@ 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_init_rss(struct ice_dcf_hw *hw);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +8 -0
index 5afd07f96..e2ab7e637 100644
@@ -133,6 +133,14 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
+		ret = ice_dcf_init_rss(hw);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "Failed to configure RSS");
+			return ret;
+		}
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
Signature · 1 line
2.17.1
author
#58 lore raw

PATCH v5 8/12 net/ice: add queue config in DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add queues and Rx queue irqs configuration during device start in DCF. The setup is sent to PF via virtchnl.

---
 drivers/net/ice/ice_dcf.c        | 111 +++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |   6 ++
 drivers/net/ice/ice_dcf_ethdev.c | 126 +++++++++++++++++++++++++++++++
 3 files changed, 243 insertions(+)
drivers/net/ice/ice_dcf.c +111 -0
index f285323dd..8869e0d1c 100644
@@ -24,6 +24,7 @@
 #include <rte_dev.h>
 
 #include "ice_dcf.h"
+#include "ice_rxtx.h"
 
 #define ICE_DCF_AQ_LEN     32
 #define ICE_DCF_AQ_BUF_SZ  4096
@@ -825,3 +826,113 @@ ice_dcf_init_rss(struct ice_dcf_hw *hw)
 
 	return 0;
 }
+
+#define IAVF_RXDID_LEGACY_1 1
+#define IAVF_RXDID_COMMS_GENERIC 16
+
+int
+ice_dcf_configure_queues(struct ice_dcf_hw *hw)
+{
+	struct ice_rx_queue **rxq =
+		(struct ice_rx_queue **)hw->eth_dev->data->rx_queues;
+	struct ice_tx_queue **txq =
+		(struct ice_tx_queue **)hw->eth_dev->data->tx_queues;
+	struct virtchnl_vsi_queue_config_info *vc_config;
+	struct virtchnl_queue_pair_info *vc_qp;
+	struct dcf_virtchnl_cmd args;
+	uint16_t i, size;
+	int err;
+
+	size = sizeof(*vc_config) +
+	       sizeof(vc_config->qpair[0]) * hw->num_queue_pairs;
+	vc_config = rte_zmalloc("cfg_queue", size, 0);
+	if (!vc_config)
+		return -ENOMEM;
+
+	vc_config->vsi_id = hw->vsi_res->vsi_id;
+	vc_config->num_queue_pairs = hw->num_queue_pairs;
+
+	for (i = 0, vc_qp = vc_config->qpair;
+	     i < hw->num_queue_pairs;
+	     i++, vc_qp++) {
+		vc_qp->txq.vsi_id = hw->vsi_res->vsi_id;
+		vc_qp->txq.queue_id = i;
+		if (i < hw->eth_dev->data->nb_tx_queues) {
+			vc_qp->txq.ring_len = txq[i]->nb_tx_desc;
+			vc_qp->txq.dma_ring_addr = txq[i]->tx_ring_dma;
+		}
+		vc_qp->rxq.vsi_id = hw->vsi_res->vsi_id;
+		vc_qp->rxq.queue_id = i;
+		vc_qp->rxq.max_pkt_size = rxq[i]->max_pkt_len;
+
+		if (i >= hw->eth_dev->data->nb_rx_queues)
+			continue;
+
+		vc_qp->rxq.ring_len = rxq[i]->nb_rx_desc;
+		vc_qp->rxq.dma_ring_addr = rxq[i]->rx_ring_dma;
+		vc_qp->rxq.databuffer_size = rxq[i]->rx_buf_len;
+
+		if (hw->vf_res->vf_cap_flags &
+		    VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC &&
+		    hw->supported_rxdid &
+		    BIT(IAVF_RXDID_COMMS_GENERIC)) {
+			vc_qp->rxq.rxdid = IAVF_RXDID_COMMS_GENERIC;
+			PMD_DRV_LOG(NOTICE, "request RXDID == %d in "
+				    "Queue[%d]", vc_qp->rxq.rxdid, i);
+		} else {
+			PMD_DRV_LOG(ERR, "RXDID 16 is not supported");
+			return -EINVAL;
+		}
+	}
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_CONFIG_VSI_QUEUES;
+	args.req_msg = (uint8_t *)vc_config;
+	args.req_msglen = size;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "Failed to execute command of"
+			    " VIRTCHNL_OP_CONFIG_VSI_QUEUES");
+
+	rte_free(vc_config);
+	return err;
+}
+
+int
+ice_dcf_config_irq_map(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_irq_map_info *map_info;
+	struct virtchnl_vector_map *vecmap;
+	struct dcf_virtchnl_cmd args;
+	int len, i, err;
+
+	len = sizeof(struct virtchnl_irq_map_info) +
+	      sizeof(struct virtchnl_vector_map) * hw->nb_msix;
+
+	map_info = rte_zmalloc("map_info", len, 0);
+	if (!map_info)
+		return -ENOMEM;
+
+	map_info->num_vectors = hw->nb_msix;
+	for (i = 0; i < hw->nb_msix; i++) {
+		vecmap = &map_info->vecmap[i];
+		vecmap->vsi_id = hw->vsi_res->vsi_id;
+		vecmap->rxitr_idx = 0;
+		vecmap->vector_id = hw->msix_base + i;
+		vecmap->txq_map = 0;
+		vecmap->rxq_map = hw->rxq_map[hw->msix_base + i];
+	}
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_CONFIG_IRQ_MAP;
+	args.req_msg = (u8 *)map_info;
+	args.req_msglen = len;
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command OP_CONFIG_IRQ_MAP");
+
+	rte_free(map_info);
+	return err;
+}
drivers/net/ice/ice_dcf.h +6 -0
index eea4b286b..9470d1df7 100644
@@ -54,6 +54,10 @@ struct ice_dcf_hw {
 	uint8_t *rss_key;
 	uint64_t supported_rxdid;
 	uint16_t num_queue_pairs;
+
+	uint16_t msix_base;
+	uint16_t nb_msix;
+	uint16_t rxq_map[16];
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
@@ -64,5 +68,7 @@ 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_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);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +126 -0

142 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#59 lore raw

PATCH v5 9/12 net/ice: add queue start and stop for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add queue start and stop in DCF. Support queue enable and disable through virtual channel. Add support for Rx queue mbufs allocation and queue reset.

---
 drivers/net/ice/ice_dcf.c        |  57 ++++++
 drivers/net/ice/ice_dcf.h        |   3 +-
 drivers/net/ice/ice_dcf_ethdev.c | 322 +++++++++++++++++++++++++++++++
 3 files changed, 381 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +57 -0
index 8869e0d1c..f18c0f16a 100644
@@ -936,3 +936,60 @@ ice_dcf_config_irq_map(struct ice_dcf_hw *hw)
 	rte_free(map_info);
 	return err;
 }
+
+int
+ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on)
+{
+	struct virtchnl_queue_select queue_select;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&queue_select, 0, sizeof(queue_select));
+	queue_select.vsi_id = hw->vsi_res->vsi_id;
+	if (rx)
+		queue_select.rx_queues |= 1 << qid;
+	else
+		queue_select.tx_queues |= 1 << qid;
+
+	memset(&args, 0, sizeof(args));
+	if (on)
+		args.v_op = VIRTCHNL_OP_ENABLE_QUEUES;
+	else
+		args.v_op = VIRTCHNL_OP_DISABLE_QUEUES;
+
+	args.req_msg = (u8 *)&queue_select;
+	args.req_msglen = sizeof(queue_select);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "Failed to execute command of %s",
+			    on ? "OP_ENABLE_QUEUES" : "OP_DISABLE_QUEUES");
+
+	return err;
+}
+
+int
+ice_dcf_disable_queues(struct ice_dcf_hw *hw)
+{
+	struct virtchnl_queue_select queue_select;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&queue_select, 0, sizeof(queue_select));
+	queue_select.vsi_id = hw->vsi_res->vsi_id;
+
+	queue_select.rx_queues = BIT(hw->eth_dev->data->nb_rx_queues) - 1;
+	queue_select.tx_queues = BIT(hw->eth_dev->data->nb_tx_queues) - 1;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_DISABLE_QUEUES;
+	args.req_msg = (u8 *)&queue_select;
+	args.req_msglen = sizeof(queue_select);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR,
+			    "Failed to execute command of OP_DISABLE_QUEUES");
+
+	return err;
+}
drivers/net/ice/ice_dcf.h +2 -1
index 9470d1df7..68e1661c0 100644
@@ -70,5 +70,6 @@ void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, 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);
-
+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);
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +322 -0

355 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#60 lore raw

PATCH v5 10/12 net/ice: enable stats for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to get and reset Rx/Tx stats in DCF. Query stats from PF.

---
 drivers/net/ice/ice_dcf.c        |  27 ++++++++
 drivers/net/ice/ice_dcf.h        |   4 ++
 drivers/net/ice/ice_dcf_ethdev.c | 102 +++++++++++++++++++++++++++----
 3 files changed, 120 insertions(+), 13 deletions(-)
drivers/net/ice/ice_dcf.c +27 -0
index f18c0f16a..fbeb58ee1 100644
@@ -993,3 +993,30 @@ ice_dcf_disable_queues(struct ice_dcf_hw *hw)
 
 	return err;
 }
+
+int
+ice_dcf_query_stats(struct ice_dcf_hw *hw,
+				   struct virtchnl_eth_stats *pstats)
+{
+	struct virtchnl_queue_select q_stats;
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&q_stats, 0, sizeof(q_stats));
+	q_stats.vsi_id = hw->vsi_res->vsi_id;
+
+	args.v_op = VIRTCHNL_OP_GET_STATS;
+	args.req_msg = (uint8_t *)&q_stats;
+	args.req_msglen = sizeof(q_stats);
+	args.rsp_msglen = sizeof(*pstats);
+	args.rsp_msgbuf = (uint8_t *)pstats;
+	args.rsp_buflen = sizeof(*pstats);
+
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err) {
+		PMD_DRV_LOG(ERR, "fail to execute command OP_GET_STATS");
+		return err;
+	}
+
+	return 0;
+}
drivers/net/ice/ice_dcf.h +4 -0
index 68e1661c0..e82bc7748 100644
@@ -58,6 +58,7 @@ struct ice_dcf_hw {
 	uint16_t msix_base;
 	uint16_t nb_msix;
 	uint16_t rxq_map[16];
+	struct virtchnl_eth_stats eth_stats_offset;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
@@ -72,4 +73,7 @@ int ice_dcf_configure_queues(struct ice_dcf_hw *hw);
 int ice_dcf_config_irq_map(struct ice_dcf_hw *hw);
 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);
+
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +89 -13

114 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#61 lore raw

PATCH v5 11/12 net/ice: set MAC filter during dev start for DCF

In reply to Ting Xu

From: Qi Zhang <[email protected]>

Add support to add and delete MAC address filter in DCF.

---
 drivers/net/ice/ice_dcf.c        | 42 ++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h        |  1 +
 drivers/net/ice/ice_dcf_ethdev.c |  7 ++++++
 3 files changed, 50 insertions(+)
drivers/net/ice/ice_dcf.c +42 -0
index fbeb58ee1..712f43825 100644
@@ -1020,3 +1020,45 @@ ice_dcf_query_stats(struct ice_dcf_hw *hw,
 
 	return 0;
 }
+
+int
+ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)
+{
+	struct virtchnl_ether_addr_list *list;
+	struct rte_ether_addr *addr;
+	struct dcf_virtchnl_cmd args;
+	int len, err = 0;
+
+	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);
+	if (!list) {
+		PMD_DRV_LOG(ERR, "fail to allocate memory");
+		return -ENOMEM;
+	}
+
+	rte_memcpy(list->list[0].addr, addr->addr_bytes,
+			sizeof(addr->addr_bytes));
+	PMD_DRV_LOG(DEBUG, "add/rm mac:%x:%x:%x:%x:%x:%x",
+			    addr->addr_bytes[0], addr->addr_bytes[1],
+			    addr->addr_bytes[2], addr->addr_bytes[3],
+			    addr->addr_bytes[4], addr->addr_bytes[5]);
+
+	list->vsi_id = hw->vsi_res->vsi_id;
+	list->num_elements = 1;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = add ? VIRTCHNL_OP_ADD_ETH_ADDR :
+			VIRTCHNL_OP_DEL_ETH_ADDR;
+	args.req_msg = (uint8_t *)list;
+	args.req_msglen  = len;
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command %s",
+			    add ? "OP_ADD_ETHER_ADDRESS" :
+			    "OP_DEL_ETHER_ADDRESS");
+	rte_free(list);
+	return err;
+}
drivers/net/ice/ice_dcf.h +1 -0
index e82bc7748..a44a01e90 100644
@@ -75,5 +75,6 @@ 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);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +7 -0
index 38e321f4b..c39dfc1cc 100644
@@ -544,6 +544,12 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	ret = ice_dcf_add_del_all_mac_addr(hw, true);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to add mac addr");
+		return ret;
+	}
+
 	dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	return 0;
@@ -601,6 +607,7 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 		intr_handle->intr_vec = NULL;
 	}
 
+	ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false);
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	ad->pf.adapter_stopped = 1;
 }
Signature · 1 line
2.17.1
author
#62 lore raw

PATCH v5 12/12 doc: enable DCF datapath configuration

In reply to Ting Xu

Add doc for DCF datapath configuration in DPDK 20.08 release note. Add "ice_dcf" driver features.

---
 doc/guides/nics/features/ice_dcf.ini   | 19 +++++++++++++++++++
 doc/guides/rel_notes/release_20_08.rst |  6 ++++++
 2 files changed, 25 insertions(+)
 create mode 100644 doc/guides/nics/features/ice_dcf.ini
doc/guides/nics/features/ice_dcf.ini new file +19 -0
new file mode 100644
index 000000000..e2b565909
@@ -0,0 +1,19 @@
+;
+; Supported features of the 'ice_dcf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Queue start/stop     = Y
+Jumbo frame          = Y
+Scattered Rx         = Y
+RSS hash             = P
+Flow API             = Y
+CRC offload          = Y
+L3 checksum offload  = P
+L4 checksum offload  = P
+Basic stats          = Y
+Linux UIO            = Y
+Linux VFIO           = Y
+x86-32               = Y
+x86-64               = Y
doc/guides/rel_notes/release_20_08.rst +6 -0
index dee4ccbb5..1a3a4cdb2 100644
@@ -56,6 +56,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated the Intel ice driver.**
+
+  Updated the Intel ice driver with new features and improvements, including:
+
+  * Added support for DCF datapath configuration.
+
 * **Updated Mellanox mlx5 driver.**
 
   Updated Mellanox mlx5 driver with new features and improvements, including:
Signature · 1 line
2.17.1
Reviewed-by on the v5 series
#63 lore raw
In reply to Ting Xu
Quoted 57 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Tuesday, June 23, 2020 10:38
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Kovacevic, Marko <[email protected]>; Mcnamara, John <[email protected]>; Xu, Ting <[email protected]>
Subject: [PATCH v5 00/12] enable DCF datapath configuration

This patchset adds support to configure DCF datapath, including Rx/Tx queues setup, start and stop, device configuration, RSS and flexible descriptor RXDID initialization and MAC filter setup.

Qi Zhang (11):
net/ice: init RSS and supported RXDID in DCF net/ice: complete device info get in DCF net/ice: complete dev configure in DCF net/ice: complete queue setup in DCF net/ice: add stop flag for device start / stop net/ice: add Rx queue init in DCF net/ice: init RSS during DCF start net/ice: add queue config in DCF net/ice: add queue start and stop for DCF net/ice: enable stats for DCF
net/ice: set MAC filter during dev start for DCF

Ting Xu (1):
doc: enable DCF datapath configuration

---
v4->v5:
Add driver's feature doc

v3->v4:
Clean codes based on comments

v2->v3:
Correct coding style issue

v1->v2:
Optimize coding style
Correct some return values
Add support to stop started queues when queue start failed

 doc/guides/nics/features/ice_dcf.ini   |  19 +
 doc/guides/rel_notes/release_20_08.rst |   6 +
 drivers/net/ice/ice_dcf.c              | 408 ++++++++++++-
 drivers/net/ice/ice_dcf.h              |  17 +
 drivers/net/ice/ice_dcf_ethdev.c       | 773 +++++++++++++++++++++++--
 drivers/net/ice/ice_dcf_ethdev.h       |   3 -
 drivers/net/ice/ice_dcf_parent.c       |   8 +
 7 files changed, 1181 insertions(+), 53 deletions(-)  create mode 100644

doc/guides/nics/features/ice_dcf.ini

--
2.17.1

Applied
#64 lore raw
Quoted 11 lines

-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Monday, June 29, 2020 10:44 AM
To: Xu, Ting <[email protected]>; [email protected]
Cc: Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Kovacevic, Marko <[email protected]>; Mcnamara, John <[email protected]>
Subject: RE: [PATCH v5 00/12] enable DCF datapath configuration

Quoted 1 line

Applied to dpdk-next-net-intel.

Thanks
Qi

Quoted 61 lines
Quoted 9 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Tuesday, June 23, 2020 10:38
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Kovacevic, Marko <[email protected]>; Mcnamara, John

<[email protected]>;

Quoted 50 lines

Xu, Ting <[email protected]>
Subject: [PATCH v5 00/12] enable DCF datapath configuration

This patchset adds support to configure DCF datapath, including Rx/Tx queues setup, start and stop, device configuration, RSS and flexible descriptor RXDID initialization and MAC filter setup.

Qi Zhang (11):
net/ice: init RSS and supported RXDID in DCF net/ice: complete device info get in DCF net/ice: complete dev configure in DCF net/ice: complete queue setup in DCF net/ice: add stop flag for device start / stop net/ice: add Rx queue init in DCF net/ice: init RSS during DCF start net/ice: add queue config in DCF net/ice: add queue start and stop for DCF net/ice: enable stats for DCF
net/ice: set MAC filter during dev start for DCF

Ting Xu (1):
doc: enable DCF datapath configuration

---
v4->v5:
Add driver's feature doc

v3->v4:
Clean codes based on comments

v2->v3:
Correct coding style issue

v1->v2:
Optimize coding style
Correct some return values
Add support to stop started queues when queue start failed

 doc/guides/nics/features/ice_dcf.ini   |  19 +
 doc/guides/rel_notes/release_20_08.rst |   6 +
 drivers/net/ice/ice_dcf.c              | 408 ++++++++++++-
 drivers/net/ice/ice_dcf.h              |  17 +
 drivers/net/ice/ice_dcf_ethdev.c       | 773 +++++++++++++++++++++++--
 drivers/net/ice/ice_dcf_ethdev.h       |   3 -
 drivers/net/ice/ice_dcf_parent.c       |   8 +
 7 files changed, 1181 insertions(+), 53 deletions(-)  create mode

100644 doc/guides/nics/features/ice_dcf.ini

--
2.17.1