Skip to contentSkip to conversation

net/ice: suppport package download

PATCH NAK Qiming Yang 5 participants 37 messages Mar 1, 2019 – Mar 25, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net/ice: suppport package download

Columbiaville requires a package to be downloaded if need advanced features. This patch add package download support in two ways. If it configured package path in devargs, will use this path, if not, will load the package at /lib/firmware/intel/ice/ddp/ice.pkg.

When package download failed, will initialize in safe mode, some advanced features will not be supported.

---
 drivers/net/ice/ice_ethdev.c | 134 +++++++++++++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_ethdev.h |   2 +
 2 files changed, 136 insertions(+)
drivers/net/ice/ice_ethdev.c +134 -0
index a23c63a..c097259 100644
@@ -2,12 +2,19 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 #include <rte_ethdev_pci.h>
 
 #include "base/ice_sched.h"
 #include "ice_ethdev.h"
 #include "ice_rxtx.h"
 
+#define ETH_ICE_PKG_PATH_ARG	"package_path"
+
 #define ICE_MAX_QP_NUM "max_queue_pair_num"
 #define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100
 
@@ -72,6 +79,10 @@ static int ice_xstats_get_names(struct rte_eth_dev *dev,
 				struct rte_eth_xstat_name *xstats_names,
 				unsigned int limit);
 
+static const char *const valid_keys[] = {
+	ETH_ICE_PKG_PATH_ARG,
+	NULL};
+
 static const struct rte_pci_id pci_id_ice_map[] = {
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_BACKPLANE) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP) },
@@ -1260,6 +1271,119 @@ ice_pf_setup(struct ice_pf *pf)
 }
 
 static int
+ice_parse_pkg_path_handler(__rte_unused const char *key,
+			  const char *value,
+			  void *opaque)
+{
+	struct ice_adapter *ad;
+
+	ad = (struct ice_adapter *)opaque;
+	ad->pkg_path = value;
+
+	return 0;
+}
+
+static void
+ice_find_pkg_path(struct rte_eth_dev *dev)
+{
+	struct rte_kvargs *kvlist;
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	int kvargs_count;
+
+	if (!(dev->device->devargs))
+		return;
+
+	kvlist = rte_kvargs_parse(dev->device->devargs->args, valid_keys);
+	if (kvlist == NULL)
+		return;
+
+	kvargs_count = rte_kvargs_count(kvlist, ETH_ICE_PKG_PATH_ARG);
+
+	if (!kvargs_count) {
+		rte_kvargs_free(kvlist);
+		return;
+	}
+
+	if (kvargs_count > 1)
+		PMD_DRV_LOG(WARNING, "More than one argument \"%s\" and only "
+		"the first invalid or last valid one is used !",
+		ETH_ICE_PKG_PATH_ARG);
+
+	if (rte_kvargs_process(kvlist, ETH_ICE_PKG_PATH_ARG,
+			       ice_parse_pkg_path_handler, ad) < 0) {
+		rte_kvargs_free(kvlist);
+		return;
+	}
+	rte_kvargs_free(kvlist);
+}
+
+static int ice_load_pkg(struct rte_eth_dev *dev, const char *pkg_path)
+{
+	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct ice_adapter *ad =
+			ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	int err;
+	uint8_t *buf;
+	int buf_len;
+	FILE *file;
+	struct stat fstat;
+
+	file = fopen(pkg_path, "rb");
+	if (file == NULL)  {
+		PMD_INIT_LOG(ERR, "failed to open file");
+		return 0;
+	}
+
+	err = stat(pkg_path, &fstat);
+	if (err) {
+		PMD_INIT_LOG(ERR, "failed to get file stats");
+		fclose(file);
+		return 0;
+	}
+
+	buf_len = fstat.st_size;
+	printf("buf_len = %d\n", buf_len);
+	buf = rte_malloc(NULL, buf_len, 0);
+
+	if (buf == NULL) {
+		PMD_INIT_LOG(ERR, "failed to allocate buf for package");
+		fclose(file);
+		return 0;
+	}
+
+	err = fread(buf, buf_len, 1, file);
+	if (err != 1) {
+		PMD_INIT_LOG(ERR, "failed to read package data");
+		fclose(file);
+		return 0;
+	}
+
+	fclose(file);
+
+	err = ice_copy_and_init_pkg(hw, buf, buf_len);
+	if (err) {
+		PMD_INIT_LOG(ERR, "ice_copy_and_init_hw failed: %d\n",
+			err);
+		goto err_go_to_safe_mode;
+	}
+
+	err = ice_init_hw_tbls(hw);
+	if (err) {
+		PMD_INIT_LOG(ERR, "ice_init_hw_tbls failed: %d\n", err);
+		goto err_go_to_safe_mode;
+	}
+
+	ad->is_safe_mode = 0;
+	return 0;
+
+err_go_to_safe_mode:
+	ad->is_safe_mode = 1;
+
+	return err;
+}
+
+static int
 ice_dev_init(struct rte_eth_dev *dev)
 {
 	struct rte_pci_device *pci_dev;
@@ -1267,6 +1391,7 @@ ice_dev_init(struct rte_eth_dev *dev)
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct ice_vsi *vsi;
+	const char *pkg_path;
 	int ret;
 
 	dev->dev_ops = &ice_eth_dev_ops;
@@ -1322,6 +1447,15 @@ ice_dev_init(struct rte_eth_dev *dev)
 		goto err_pf_setup;
 	}
 
+	ice_find_pkg_path(dev);
+	if (!(pf->adapter->pkg_path))
+		pkg_path = "/lib/firmware/intel/ice/ddp/ice.pkg";
+	else
+		pkg_path = pf->adapter->pkg_path;
+	ret = ice_load_pkg(dev, pkg_path);
+	if (ret)
+		PMD_INIT_LOG(ERR, "Failed to load default OS package");
+
 	vsi = pf->main_vsi;
 
 	/* Disable double vlan by default */
drivers/net/ice/ice_ethdev.h +2 -0
index 3cefa5b..796459a 100644
@@ -264,6 +264,8 @@ struct ice_adapter {
 	bool tx_simple_allowed;
 	/* ptype mapping table */
 	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
+	const char *pkg_path;
+	bool is_safe_mode;
 };
 
 struct ice_vsi_vlan_pvid_info {
Signature · 1 line
2.9.5
#1 lore raw

PATCH 2/2 net/ice: disable advanced features in safe mode

As some advanced features are not supported in safe mode, this patch disabled them when safe mode flags is set.

---
 drivers/net/ice/ice_ethdev.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
drivers/net/ice/ice_ethdev.c +30 -0
index c097259..4e2b65e 100644
@@ -1379,6 +1379,8 @@ static int ice_load_pkg(struct rte_eth_dev *dev, const char *pkg_path)
 
 err_go_to_safe_mode:
 	ad->is_safe_mode = 1;
+	PMD_INIT_LOG(WARNING, "Initialize in safe mode,"
+		"some features are disabled.\n");
 
 	return err;
 }
@@ -1646,12 +1648,18 @@ static int ice_init_rss(struct ice_pf *pf)
 	struct ice_aqc_get_set_rss_keys key;
 	uint16_t i, nb_q;
 	int ret = 0;
+	bool is_safe_mode = pf->adapter->is_safe_mode;
 
 	rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
 	nb_q = dev->data->nb_rx_queues;
 	vsi->rss_key_size = ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE;
 	vsi->rss_lut_size = hw->func_caps.common_cap.rss_table_size;
 
+	if (is_safe_mode) {
+		PMD_DRV_LOG(WARNING, "RSS is not supported in safe mode\n");
+		return 0;
+	}
+
 	if (!vsi->rss_key)
 		vsi->rss_key = rte_zmalloc(NULL,
 					   vsi->rss_key_size, 0);
@@ -1955,6 +1963,7 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ice_vsi *vsi = pf->main_vsi;
 	struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev->device);
+	bool is_safe_mode = pf->adapter->is_safe_mode;
 
 	dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN;
 	dev_info->max_rx_pktlen = ICE_FRAME_SIZE_MAX;
@@ -2048,6 +2057,21 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->default_txportconf.nb_queues = 1;
 	dev_info->default_rxportconf.ring_size = ICE_BUF_SIZE_MIN;
 	dev_info->default_txportconf.ring_size = ICE_BUF_SIZE_MIN;
+
+	if (is_safe_mode) {
+		dev_info->rx_offload_capa =
+			DEV_RX_OFFLOAD_VLAN_STRIP |
+			DEV_RX_OFFLOAD_JUMBO_FRAME |
+			DEV_RX_OFFLOAD_KEEP_CRC |
+			DEV_RX_OFFLOAD_SCATTER |
+			DEV_RX_OFFLOAD_VLAN_FILTER;
+		dev_info->tx_offload_capa =
+			DEV_TX_OFFLOAD_VLAN_INSERT |
+			DEV_TX_OFFLOAD_TCP_TSO |
+			DEV_TX_OFFLOAD_MULTI_SEGS |
+			DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+		dev_info->flow_type_rss_offloads = 0;
+	}
 }
 
 static inline int
@@ -2413,6 +2437,7 @@ ice_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct ice_vsi *vsi = pf->main_vsi;
 	struct rte_eth_rxmode *rxmode;
+	bool is_safe_mode = pf->adapter->is_safe_mode;
 
 	rxmode = &dev->data->dev_conf.rxmode;
 	if (mask & ETH_VLAN_FILTER_MASK) {
@@ -2429,6 +2454,11 @@ ice_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 			ice_vsi_config_vlan_stripping(vsi, FALSE);
 	}
 
+	if (is_safe_mode) {
+		PMD_DRV_LOG(WARNING, "QinQ is not supported in safe mode\n");
+		return 0;
+	}
+
 	if (mask & ETH_VLAN_EXTEND_MASK) {
 		if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)
 			ice_vsi_config_double_vlan(vsi, TRUE);
Signature · 1 line
2.9.5
#2 lore raw

Re: [PATCH 2/2] net/ice: disable advanced features in safe mode

drivers/net/ice/ice_ethdev.c static int ice_load_pkg(struct rte_eth_dev *dev, const char *pkg_path) · line 1383

Quoted 2 lines · On Fri, 1 Mar 2019 20:46:13 +0800 Qiming Yang <[email protected]> wrote:
drivers/net/ice/ice_ethdev.c +2 -0
+	PMD_INIT_LOG(WARNING, "Initialize in safe mode,"
+		"some features are disabled.\n");

Don't split a message string, it makes it harder to search.

Also, most drivers define PMD_INIT_LOG to always add a newline and do not add the newline in the macro call.

#3 lore raw

Re: [PATCH 2/2] net/ice: disable advanced features in safe mode

In reply to Qiming Yang

Hi Qiming,

For some reason I am not seeing patch 1/2 in this series. Can you make sure you sent it or re-send it?

Paul

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiming Yang
Sent: Friday, March 1, 2019 4:46 AM
To: [email protected]
Cc: Yang, Qiming <[email protected]>
Subject: [dpdk-dev] [PATCH 2/2] net/ice: disable advanced features in safe mode

As some advanced features are not supported in safe mode, this patch disabled them when safe mode flags is set.

---
 drivers/net/ice/ice_ethdev.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
drivers/net/ice/ice_ethdev.c +9 -0
@@ -1379,6 +1379,8 @@ static int ice_load_pkg(struct rte_eth_dev *dev, const char *pkg_path)
 
 err_go_to_safe_mode:
 	ad->is_safe_mode = 1;
+	PMD_INIT_LOG(WARNING, "Initialize in safe mode,"
+		"some features are disabled.\n");
 
 	return err;
 }
@@ -1646,12 +1648,18 @@ static int ice_init_rss(struct ice_pf *pf)
 	struct ice_aqc_get_set_rss_keys key;
 	uint16_t i, nb_q;
 	int ret = 0;
+	bool is_safe_mode = pf->adapter->is_safe_mode;
 
 	rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
 	nb_q = dev->data->nb_rx_queues;
 	vsi->rss_key_size = ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE;
 	vsi->rss_lut_size = hw->func_caps.common_cap.rss_table_size;
 
+	if (is_safe_mode) {
+		PMD_DRV_LOG(WARNING, "RSS is not supported in safe mode\n");
+		return 0;
+	}
+
 	if (!vsi->rss_key)
 		vsi->rss_key = rte_zmalloc(NULL,
 					   vsi->rss_key_size, 0);
@@ -1955,6 +1963,7 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ice_vsi *vsi = pf->main_vsi;
 	struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev->device);
+	bool is_safe_mode = pf->adapter->is_safe_mode;
 
 	dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN;
 	dev_info->max_rx_pktlen = ICE_FRAME_SIZE_MAX; @@ -2048,6 +2057,21 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)

dev_info->default_txportconf.nb_queues = 1; dev_info->default_rxportconf.ring_size = ICE_BUF_SIZE_MIN; dev_info->default_txportconf.ring_size = ICE_BUF_SIZE_MIN;
+
+ if (is_safe_mode) {
+ dev_info->rx_offload_capa =
+ DEV_RX_OFFLOAD_VLAN_STRIP |
+ DEV_RX_OFFLOAD_JUMBO_FRAME |
+ DEV_RX_OFFLOAD_KEEP_CRC |
+ DEV_RX_OFFLOAD_SCATTER |
+ DEV_RX_OFFLOAD_VLAN_FILTER;
+ dev_info->tx_offload_capa =
+ DEV_TX_OFFLOAD_VLAN_INSERT |
+ DEV_TX_OFFLOAD_TCP_TSO |
+ DEV_TX_OFFLOAD_MULTI_SEGS |
+ DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+ dev_info->flow_type_rss_offloads = 0;
+ }
}

static inline int
@@ -2413,6 +2437,7 @@ ice_vlan_offload_set(struct rte_eth_dev *dev, int mask)
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct ice_vsi *vsi = pf->main_vsi;
struct rte_eth_rxmode *rxmode;
+ bool is_safe_mode = pf->adapter->is_safe_mode;

rxmode = &dev->data->dev_conf.rxmode;
if (mask & ETH_VLAN_FILTER_MASK) {
@@ -2429,6 +2454,11 @@ ice_vlan_offload_set(struct rte_eth_dev *dev, int mask)
ice_vsi_config_vlan_stripping(vsi, FALSE);
}

+ if (is_safe_mode) {
+ PMD_DRV_LOG(WARNING, "QinQ is not supported in safe mode\n");
+ return 0;
+ }
+
if (mask & ETH_VLAN_EXTEND_MASK) {
if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)
ice_vsi_config_double_vlan(vsi, TRUE);
--
2.9.5

#4 lore raw
In reply to Qiming Yang

01/03/2019 13:46, Qiming Yang:

Quoted 5 lines

Columbiaville requires a package to be downloaded if need advanced features. This patch add package download support in two ways. If it configured package path in devargs, will use this path, if not, will load the package at /lib/firmware/intel/ice/ddp/ice.pkg.

Quoted 8 lines

When package download failed, will initialize in safe mode, some advanced features will not be supported.

---
 drivers/net/ice/ice_ethdev.c | 134 +++++++++++++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_ethdev.h |   2 +
 2 files changed, 136 insertions(+)

I think you should update the doc in this patch.
Users may want to know about this new option,
and where to download the packages.

#5 lore raw

Yes, I will add the document update when I send v2 out. Thanks

Quoted 28 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Friday, March 1, 2019 9:40 PM
To: Yang, Qiming <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/2] net/ice: suppport package download

01/03/2019 13:46, Qiming Yang:

Quoted 11 lines

Columbiaville requires a package to be downloaded if need advanced features. This patch add package download support in two ways. If it configured package path in devargs, will use this path, if not, will load the package at /lib/firmware/intel/ice/ddp/ice.pkg.

When package download failed, will initialize in safe mode, some advanced features will not be supported.

---
 drivers/net/ice/ice_ethdev.c | 134

+++++++++++++++++++++++++++++++++++++++++++

Quoted 2 lines
 drivers/net/ice/ice_ethdev.h |   2 +
 2 files changed, 136 insertions(+)

I think you should update the doc in this patch.
Users may want to know about this new option, and where to download the packages.

#6 lore raw
In reply to Qiming Yang

drivers/net/ice/ice_ethdev.c ice_pf_setup(struct ice_pf *pf) · line 1280

Quoted 8 lines · On Fri, 1 Mar 2019 20:46:12 +0800 Qiming Yang <[email protected]> wrote:

static int

drivers/net/ice/ice_ethdev.c +7 -0
+ice_parse_pkg_path_handler(__rte_unused const char *key,
+			  const char *value,
+			  void *opaque)
+{
+	struct ice_adapter *ad;
+
+	ad = (struct ice_adapter *)opaque;

Minor language nitpick:
Explicit cast of void * pointer is not necessary in C.

#7 lore raw
In reply to Qiming Yang

drivers/net/ice/ice_ethdev.c ice_pf_setup(struct ice_pf *pf) · line 1310

Quoted 4 lines · On Fri, 1 Mar 2019 20:46:12 +0800 Qiming Yang <[email protected]> wrote:
drivers/net/ice/ice_ethdev.c +4 -0
+
+	if (kvargs_count > 1)
+		PMD_DRV_LOG(WARNING, "More than one argument \"%s\" and only "
+		"the first invalid or last valid one is used !",

Do not add line breaks to error message strings, it makes it harder to find them in the source with tools like grep

#8 lore raw
In reply to Qiming Yang

NACK, see comments below

Quoted 10 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiming Yang
Sent: Friday, March 1, 2019 4:46 AM
To: [email protected]
Cc: Yang, Qiming <[email protected]>
Subject: [dpdk-dev] [PATCH 1/2] net/ice: suppport package download

Columbiaville requires a package to be downloaded if need advanced features. This patch add package download support in two ways.
If it configured package path in devargs, will use this path, if not, will load the

We can't support downloading the package through devargs. Please remove this.

Quoted 2 lines

package at /lib/firmware/intel/ice/ddp/ice.pkg.

The location is /lib/firmware. No need for extra indirection

Quoted 210 lines

When package download failed, will initialize in safe mode, some advanced features will not be supported.

---
 drivers/net/ice/ice_ethdev.c | 134
+++++++++++++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_ethdev.h |   2 +
 2 files changed, 136 insertions(+)
drivers/net/ice/ice_ethdev.c +11 -0
index a23c63a..c097259 100644
@@ -2,12 +2,19 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 #include <rte_ethdev_pci.h>
 
 #include "base/ice_sched.h"
 #include "ice_ethdev.h"
 #include "ice_rxtx.h"
 
+#define ETH_ICE_PKG_PATH_ARG	"package_path"
+
 #define ICE_MAX_QP_NUM "max_queue_pair_num"
 #define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100
 
@@ -72,6 +79,10 @@ static int ice_xstats_get_names(struct rte_eth_dev
 *dev,
 				struct rte_eth_xstat_name *xstats_names,
 				unsigned int limit);
 
+static const char *const valid_keys[] = {
+	ETH_ICE_PKG_PATH_ARG,
+	NULL};
+
 static const struct rte_pci_id pci_id_ice_map[] = {
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID,

ICE_DEV_ID_E810C_BACKPLANE) },
{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID,
ICE_DEV_ID_E810C_QSFP) }, @@ -1260,6 +1271,119 @@ ice_pf_setup(struct ice_pf *pf) }

static int

drivers/net/ice/ice_ethdev.c +35 -0
+ice_parse_pkg_path_handler(__rte_unused const char *key,
+			  const char *value,
+			  void *opaque)
+{
+	struct ice_adapter *ad;
+
+	ad = (struct ice_adapter *)opaque;
+	ad->pkg_path = value;
+
+	return 0;
+}
+
+static void
+ice_find_pkg_path(struct rte_eth_dev *dev) {
+	struct rte_kvargs *kvlist;
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	int kvargs_count;
+
+	if (!(dev->device->devargs))
+		return;
+
+	kvlist = rte_kvargs_parse(dev->device->devargs->args, valid_keys);
+	if (kvlist == NULL)
+		return;
+
+	kvargs_count = rte_kvargs_count(kvlist, ETH_ICE_PKG_PATH_ARG);
+
+	if (!kvargs_count) {
+		rte_kvargs_free(kvlist);
+		return;
+	}
+
+	if (kvargs_count > 1)
+		PMD_DRV_LOG(WARNING, "More than one argument

\"%s\" and only "

drivers/net/ice/ice_ethdev.c +14 -0
+		"the first invalid or last valid one is used !",
+		ETH_ICE_PKG_PATH_ARG);
+
+	if (rte_kvargs_process(kvlist, ETH_ICE_PKG_PATH_ARG,
+			       ice_parse_pkg_path_handler, ad) < 0) {
+		rte_kvargs_free(kvlist);
+		return;
+	}
+	rte_kvargs_free(kvlist);
+}
+
+static int ice_load_pkg(struct rte_eth_dev *dev, const char *pkg_path)
+{
+	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data-
Quoted 1 line

dev_private);

drivers/net/ice/ice_ethdev.c +2 -0
+	struct ice_adapter *ad =
+			ICE_DEV_PRIVATE_TO_ADAPTER(dev->data-
Quoted 1 line

dev_private);

drivers/net/ice/ice_ethdev.c +62 -0
+	int err;
+	uint8_t *buf;
+	int buf_len;
+	FILE *file;
+	struct stat fstat;
+
+	file = fopen(pkg_path, "rb");
+	if (file == NULL)  {
+		PMD_INIT_LOG(ERR, "failed to open file");
+		return 0;
+	}
+
+	err = stat(pkg_path, &fstat);
+	if (err) {
+		PMD_INIT_LOG(ERR, "failed to get file stats");
+		fclose(file);
+		return 0;
+	}
+
+	buf_len = fstat.st_size;
+	printf("buf_len = %d\n", buf_len);
+	buf = rte_malloc(NULL, buf_len, 0);
+
+	if (buf == NULL) {
+		PMD_INIT_LOG(ERR, "failed to allocate buf for package");
+		fclose(file);
+		return 0;
+	}
+
+	err = fread(buf, buf_len, 1, file);
+	if (err != 1) {
+		PMD_INIT_LOG(ERR, "failed to read package data");
+		fclose(file);
+		return 0;
+	}
+
+	fclose(file);
+
+	err = ice_copy_and_init_pkg(hw, buf, buf_len);
+	if (err) {
+		PMD_INIT_LOG(ERR, "ice_copy_and_init_hw failed: %d\n",
+			err);
+		goto err_go_to_safe_mode;
+	}
+
+	err = ice_init_hw_tbls(hw);
+	if (err) {
+		PMD_INIT_LOG(ERR, "ice_init_hw_tbls failed: %d\n", err);
+		goto err_go_to_safe_mode;
+	}
+
+	ad->is_safe_mode = 0;
+	return 0;
+
+err_go_to_safe_mode:
+	ad->is_safe_mode = 1;
+
+	return err;
+}
+
+static int
 ice_dev_init(struct rte_eth_dev *dev)
 {
 	struct rte_pci_device *pci_dev;
@@ -1267,6 +1391,7 @@ ice_dev_init(struct rte_eth_dev *dev)
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data-
 >dev_private);
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data-
 >dev_private);
 	struct ice_vsi *vsi;
+	const char *pkg_path;
 	int ret;
drivers/net/ice/ice_ethdev.c +9 -0
 	dev->dev_ops = &ice_eth_dev_ops;
@@ -1322,6 +1447,15 @@ ice_dev_init(struct rte_eth_dev *dev)
 		goto err_pf_setup;
 	}
 
+	ice_find_pkg_path(dev);
+	if (!(pf->adapter->pkg_path))
+		pkg_path = "/lib/firmware/intel/ice/ddp/ice.pkg";
+	else
+		pkg_path = pf->adapter->pkg_path;
+	ret = ice_load_pkg(dev, pkg_path);
+	if (ret)
+		PMD_INIT_LOG(ERR, "Failed to load default OS package");
+
 	vsi = pf->main_vsi;
 
 	/* Disable double vlan by default */
drivers/net/ice/ice_ethdev.h +2 -1
index 3cefa5b..796459a 100644
@@ -264,6 +264,8 @@ struct ice_adapter {
 	bool tx_simple_allowed;
 	/* ptype mapping table */
 	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
+	const char *pkg_path;
+	bool is_safe_mode;
 };
 
 struct ice_vsi_vlan_pvid_info {
--

2.9.5

#9 lore raw

v2 cover enable package download in ice driver

In reply to Qiming Yang

This patch set enabled package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

If package download failed, driver need to go to safe mode. This patch set disabled RSS, QINQ, checksum offload in safe mode.

The patch set also enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
V2:
1. fixed errors in commit log.
2. removed unnecessary code.
3. improved as Qi's comments.
4. removed devargs.
5. added document update.

Qiming Yang (4):
net/ice: load OS default package
net/ice: add safe mode
net/ice: enable RSS when device init
doc: add document update for package download

 doc/guides/nics/ice.rst                |   9 ++
 doc/guides/rel_notes/release_19_05.rst |   5 ++
 drivers/net/ice/ice_ethdev.c           | 150 ++++++++++++++++++++++++++++++---
 drivers/net/ice/ice_ethdev.h           |   1 +
 4 files changed, 152 insertions(+), 13 deletions(-)
Signature · 1 line
2.9.5
#10 lore raw

PATCH v2 1/4 net/ice: load OS default package

This patch enables package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

There is no per device package be supported so far, all the devices can only download the same package. This limitation will be removed in the future.

---
 drivers/net/ice/ice_ethdev.c | 69 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)
drivers/net/ice/ice_ethdev.c +69 -0
index a23c63a..13f2748 100644
@@ -2,6 +2,11 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 #include <rte_ethdev_pci.h>
 
 #include "base/ice_sched.h"
@@ -10,6 +15,7 @@
 
 #define ICE_MAX_QP_NUM "max_queue_pair_num"
 #define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100
+#define ICE_DFLT_PKG_FILE "/lib/firmware/intel/ice/ddp/ice.pkg"
 
 int ice_logtype_init;
 int ice_logtype_driver;
@@ -1259,6 +1265,62 @@ ice_pf_setup(struct ice_pf *pf)
 	return 0;
 }
 
+static int ice_load_pkg(struct rte_eth_dev *dev)
+{
+	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	const char *pkg_file = ICE_DFLT_PKG_FILE;
+	int err;
+	uint8_t *buf;
+	int buf_len;
+	FILE *file;
+	struct stat fstat;
+
+	file = fopen(pkg_path, "rb");
+	if (!file)  {
+		PMD_INIT_LOG(ERR, "failed to open file: %s", pkg_file);
+		return -1;
+	}
+
+	err = stat(pkg_path, &fstat);
+	if (err) {
+		PMD_INIT_LOG(ERR, "failed to get file stats");
+		fclose(file);
+		return err;
+	}
+
+	buf_len = fstat.st_size;
+	buf = rte_malloc(NULL, buf_len, 0);
+
+	if (!buf) {
+		PMD_INIT_LOG(ERR, "failed to allocate buf of size %d"
+				  "for package", buf_len);
+		fclose(file);
+		return -1;
+	}
+
+	err = fread(buf, buf_len, 1, file);
+	if (err != 1) {
+		PMD_INIT_LOG(ERR, "failed to read package data");
+		fclose(file);
+		return -1;
+	}
+
+	fclose(file);
+
+	err = ice_copy_and_init_pkg(hw, buf, buf_len);
+	if (err) {
+		PMD_INIT_LOG(ERR, "ice_copy_and_init_hw failed: %d\n", err);
+		return err;
+	}
+	err = ice_init_hw_tbls(hw);
+	if (err) {
+		PMD_INIT_LOG(ERR, "ice_init_hw_tbls failed: %d\n", err);
+		return err;
+	}
+
+	return 0;
+}
+
 static int
 ice_dev_init(struct rte_eth_dev *dev)
 {
@@ -1298,6 +1360,12 @@ ice_dev_init(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
+	ret = ice_load_pkg(dev);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to load the DDP package");
+		goto err_load_pkg;
+	}
+
 	PMD_INIT_LOG(INFO, "FW %d.%d.%05d API %d.%d",
 		     hw->fw_maj_ver, hw->fw_min_ver, hw->fw_build,
 		     hw->api_maj_ver, hw->api_min_ver);
@@ -1343,6 +1411,7 @@ ice_dev_init(struct rte_eth_dev *dev)
 err_msix_pool_init:
 	rte_free(dev->data->mac_addrs);
 err_init_mac:
+err_load_pkg:
 	ice_sched_cleanup_all(hw);
 	rte_free(hw->port_info);
 	ice_shutdown_all_ctrlq(hw);
Signature · 1 line
2.9.5
#11 lore raw

PATCH v2 2/4 net/ice: add safe mode

In reply to Qiming Yang

If E810 download package failed, driver need to go to safe mode. In the safe mode, some advanced features will not be supported.

---
 drivers/net/ice/ice_ethdev.c | 48 +++++++++++++++++++++++++++++---------------
 drivers/net/ice/ice_ethdev.h |  1 +
 2 files changed, 33 insertions(+), 16 deletions(-)
drivers/net/ice/ice_ethdev.c +32 -16
index 13f2748..a217da8 100644
@@ -1328,6 +1328,8 @@ ice_dev_init(struct rte_eth_dev *dev)
 	struct rte_intr_handle *intr_handle;
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct ice_vsi *vsi;
 	int ret;
 
@@ -1362,8 +1364,9 @@ ice_dev_init(struct rte_eth_dev *dev)
 
 	ret = ice_load_pkg(dev);
 	if (ret) {
-		PMD_INIT_LOG(ERR, "Failed to load the DDP package");
-		goto err_load_pkg;
+		PMD_INIT_LOG(WARNING, "Failed to load the DDP package,"
+				"Entering Safe Mode");
+		ad->is_safe_mode = 1;
 	}
 
 	PMD_INIT_LOG(INFO, "FW %d.%d.%05d API %d.%d",
@@ -1411,7 +1414,6 @@ ice_dev_init(struct rte_eth_dev *dev)
 err_msix_pool_init:
 	rte_free(dev->data->mac_addrs);
 err_init_mac:
-err_load_pkg:
 	ice_sched_cleanup_all(hw);
 	rte_free(hw->port_info);
 	ice_shutdown_all_ctrlq(hw);
@@ -1581,12 +1583,18 @@ static int ice_init_rss(struct ice_pf *pf)
 	struct ice_aqc_get_set_rss_keys key;
 	uint16_t i, nb_q;
 	int ret = 0;
+	bool is_safe_mode = pf->adapter->is_safe_mode;
 
 	rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
 	nb_q = dev->data->nb_rx_queues;
 	vsi->rss_key_size = ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE;
 	vsi->rss_lut_size = hw->func_caps.common_cap.rss_table_size;
 
+	if (is_safe_mode) {
+		PMD_DRV_LOG(WARNING, "RSS is not supported in safe mode\n");
+		return 0;
+	}
+
 	if (!vsi->rss_key)
 		vsi->rss_key = rte_zmalloc(NULL,
 					   vsi->rss_key_size, 0);
@@ -1890,6 +1898,7 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ice_vsi *vsi = pf->main_vsi;
 	struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev->device);
+	bool is_safe_mode = pf->adapter->is_safe_mode;
 
 	dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN;
 	dev_info->max_rx_pktlen = ICE_FRAME_SIZE_MAX;
@@ -1900,33 +1909,40 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	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_QINQ_STRIP |
-		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
-		DEV_RX_OFFLOAD_VLAN_EXTEND |
 		DEV_RX_OFFLOAD_JUMBO_FRAME |
 		DEV_RX_OFFLOAD_KEEP_CRC |
 		DEV_RX_OFFLOAD_SCATTER |
 		DEV_RX_OFFLOAD_VLAN_FILTER;
 	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_MULTI_SEGS |
 		DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+	dev_info->flow_type_rss_offloads = 0;
+
+	if (!is_safe_mode) {
+		dev_info->rx_offload_capa |=
+			DEV_RX_OFFLOAD_IPV4_CKSUM |
+			DEV_RX_OFFLOAD_UDP_CKSUM |
+			DEV_RX_OFFLOAD_TCP_CKSUM |
+			DEV_RX_OFFLOAD_QINQ_STRIP |
+			DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
+			DEV_RX_OFFLOAD_VLAN_EXTEND;
+		dev_info->tx_offload_capa |=
+			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_info->flow_type_rss_offloads |= ICE_RSS_OFFLOAD_ALL;
+	}
+
 	dev_info->rx_queue_offload_capa = 0;
 	dev_info->tx_queue_offload_capa = 0;
 
 	dev_info->reta_size = hw->func_caps.common_cap.rss_table_size;
 	dev_info->hash_key_size = (VSIQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t);
-	dev_info->flow_type_rss_offloads = ICE_RSS_OFFLOAD_ALL;
 
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
 		.rx_thresh = {
drivers/net/ice/ice_ethdev.h +1 -0
index 3cefa5b..b1f1f79 100644
@@ -264,6 +264,7 @@ struct ice_adapter {
 	bool tx_simple_allowed;
 	/* ptype mapping table */
 	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
+	bool is_safe_mode;
 };
 
 struct ice_vsi_vlan_pvid_info {
Signature · 1 line
2.9.5
#12 lore raw

PATCH v2 3/4 net/ice: enable RSS when device init

In reply to Qiming Yang

This patch enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
 drivers/net/ice/ice_ethdev.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/net/ice/ice_ethdev.c +39 -0
index a217da8..60aaedc 100644
@@ -10,6 +10,7 @@
 #include <rte_ethdev_pci.h>
 
 #include "base/ice_sched.h"
+#include "base/ice_flow.h"
 #include "ice_ethdev.h"
 #include "ice_rxtx.h"
 
@@ -1627,6 +1628,44 @@ static int ice_init_rss(struct ice_pf *pf)
 	if (ret)
 		return -EINVAL;
 
+	/* configure RSS for tcp4 with input set IP src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV4,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s TCP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp4 with input set IP src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV4,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp4 with input set IP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV4 rss flow fail %d",
+				__func__, ret);
+
+	/* configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV6,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+	PMD_DRV_LOG(ERR, "%s TCP_IPV6 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp6 with input set IPv6 src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV6,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV6 flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp6 with input set IPv6 src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV6 rss flow fail %d",
+				__func__, ret);
+
 	return 0;
 }
 
Signature · 1 line
2.9.5
#13 lore raw

PATCH v2 4/4 doc: add document update for package download

In reply to Qiming Yang

Updated ice.rst and release_19_05.rst.

---
 doc/guides/nics/ice.rst                | 9 +++++++++
 doc/guides/rel_notes/release_19_05.rst | 5 +++++
 2 files changed, 14 insertions(+)
doc/guides/nics/ice.rst +9 -0
index 3998d5e..6410ec5 100644
@@ -84,6 +84,15 @@ To start ``testpmd``, and add vlan 10 to port 0:
 Limitations or Known issues
 ---------------------------
 
+The Intel E810 requires a programmable pipeline package be downloaded
+by the driver to support normal operations. The E810 has a limited
+functionality built in to allow PXE boot and other use cases, but the
+driver must download a package file during the driver initialization
+stage. The file must be in the /lib/firmware/intel/ice/ddp directory
+and it must be named ice.pkg. A symbolic link to this file is also ok.
+The same package file is used by both the kernel driver and the DPDK PMD.
+
+
 19.02 limitation
 ~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_19_05.rst +5 -0
index 61a2c73..7248ea1 100644
@@ -91,6 +91,11 @@ New Features
 
   * Added promiscuous mode support.
 
+* **Updated the ice driver.**
+
+  * Added package download support.
+  * Added Safe Mode support.
+  * Supported RSS for UPD/TCP/SCTP+IPV4/IPV6 packets
 
 Removed Items
 -------------
Signature · 1 line
2.9.5
#14 lore raw

v3 cover enable package download in ice driver

In reply to Qiming Yang

This patch set enabled package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

If package download failed, driver need to go to safe mode. This patch set disabled RSS, QINQ, checksum offload in safe mode.

The patch set also enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
V3:
1. fixed compile issue.
2. split document update to each patch.

V2:
1. fixed errors in commit log.
2. removed unnecessary code.
3. improved as Qi's comments.
4. removed devargs.
5. added document update.

Qiming Yang (3):
net/ice: load OS default package
net/ice: add safe mode
net/ice: enable RSS when device init

 doc/guides/nics/ice.rst                |   9 ++
 doc/guides/rel_notes/release_19_05.rst |   6 ++
 drivers/net/ice/ice_ethdev.c           | 150 ++++++++++++++++++++++++++++++---
 drivers/net/ice/ice_ethdev.h           |   1 +
 4 files changed, 153 insertions(+), 13 deletions(-)
Signature · 1 line
2.9.5
#15 lore raw

PATCH v3 1/3 net/ice: load OS default package

This patch enables package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

There is no per device package be supported so far, all the devices can only download the same package. This limitation will be removed in the future.

---
 doc/guides/nics/ice.rst                |  9 +++++
 doc/guides/rel_notes/release_19_05.rst |  4 ++
 drivers/net/ice/ice_ethdev.c           | 69 ++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+)
doc/guides/nics/ice.rst +9 -0
index 3998d5e..6410ec5 100644
@@ -84,6 +84,15 @@ To start ``testpmd``, and add vlan 10 to port 0:
 Limitations or Known issues
 ---------------------------
 
+The Intel E810 requires a programmable pipeline package be downloaded
+by the driver to support normal operations. The E810 has a limited
+functionality built in to allow PXE boot and other use cases, but the
+driver must download a package file during the driver initialization
+stage. The file must be in the /lib/firmware/intel/ice/ddp directory
+and it must be named ice.pkg. A symbolic link to this file is also ok.
+The same package file is used by both the kernel driver and the DPDK PMD.
+
+
 19.02 limitation
 ~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_19_05.rst +4 -0
index b1a7d75..af4300b 100644
@@ -102,6 +102,10 @@ New Features
   * Added support for VXLAN-GPE packet.
   * Added support for VXLAN-GPE classification.
 
+* **Updated the ice driver.**
+
+  * Added package download support.
+
 Removed Items
 -------------
 
drivers/net/ice/ice_ethdev.c +69 -0

99 lines not on this page · raw message

Signature · 1 line
2.9.5
#16 lore raw

PATCH v3 2/3 net/ice: add safe mode

In reply to Qiming Yang

If E810 download package failed, driver need to go to safe mode. In the safe mode, some advanced features will not be supported.

---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 48 ++++++++++++++++++++++------------
 drivers/net/ice/ice_ethdev.h           |  1 +
 3 files changed, 34 insertions(+), 16 deletions(-)
doc/guides/rel_notes/release_19_05.rst +1 -0
index af4300b..9ca147f 100644
@@ -105,6 +105,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c +32 -16

104 lines not on this page · raw message

drivers/net/ice/ice_ethdev.h +1 -0
index 151a09e..9a8fbfa 100644
@@ -266,6 +266,7 @@ struct ice_adapter {
 	bool tx_simple_allowed;
 	/* ptype mapping table */
 	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
+	bool is_safe_mode;
 };
 
 struct ice_vsi_vlan_pvid_info {
Signature · 1 line
2.9.5
#17 lore raw

PATCH v3 3/3 net/ice: enable RSS when device init

In reply to Qiming Yang

This patch enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
doc/guides/rel_notes/release_19_05.rst +1 -0
index 9ca147f..7d34d63 100644
@@ -106,6 +106,7 @@ New Features
 
   * Added package download support.
   * Added Safe Mode support.
+  * Supported RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c +39 -0
index b5b52ff..dffaf4f 100644
@@ -8,6 +8,7 @@
 #include <unistd.h>
 
 #include "base/ice_sched.h"
+#include "base/ice_flow.h"
 #include "ice_ethdev.h"
 #include "ice_rxtx.h"
 
@@ -1625,6 +1626,44 @@ static int ice_init_rss(struct ice_pf *pf)
 	if (ret)
 		return -EINVAL;
 
+	/* configure RSS for tcp4 with input set IP src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV4,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s TCP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp4 with input set IP src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV4,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp4 with input set IP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV4 rss flow fail %d",
+				__func__, ret);
+
+	/* configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV6,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+	PMD_DRV_LOG(ERR, "%s TCP_IPV6 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp6 with input set IPv6 src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV6,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV6 flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp6 with input set IPv6 src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV6 rss flow fail %d",
+				__func__, ret);
+
 	return 0;
 }
 
Signature · 1 line
2.9.5
#18 lore raw

v4 cover enable package download in ice driver

In reply to Qiming Yang

This patch set enabled package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

If package download failed, driver need to go to safe mode. This patch set disabled RSS, QINQ, checksum offload in safe mode.

The patch set also enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
V4:
1. free memory when package download fail.

V3:
1. fixed compile issue.
2. split document update to each patch.

V2:
1. fixed errors in commit log.
2. removed unnecessary code.
3. improved as Qi's comments.
4. removed devargs.
5. added document update.

Qiming Yang (3):
net/ice: load OS default package
net/ice: add safe mode
net/ice: enable RSS when device init

 doc/guides/nics/ice.rst                |   9 ++
 doc/guides/rel_notes/release_19_05.rst |   6 ++
 drivers/net/ice/ice_ethdev.c           | 158 ++++++++++++++++++++++++++++++---
 drivers/net/ice/ice_ethdev.h           |   1 +
 4 files changed, 161 insertions(+), 13 deletions(-)
Signature · 1 line
2.9.5
#19 lore raw

PATCH v4 1/3 net/ice: load OS default package

This patch enables package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

There is no per device package be supported so far, all the devices can only download the same package. This limitation will be removed in the future.

---
 doc/guides/nics/ice.rst                |  9 ++++
 doc/guides/rel_notes/release_19_05.rst |  4 ++
 drivers/net/ice/ice_ethdev.c           | 77 ++++++++++++++++++++++++++++++++++
 3 files changed, 90 insertions(+)
doc/guides/nics/ice.rst +9 -0
index 3998d5e..6410ec5 100644
@@ -84,6 +84,15 @@ To start ``testpmd``, and add vlan 10 to port 0:
 Limitations or Known issues
 ---------------------------
 
+The Intel E810 requires a programmable pipeline package be downloaded
+by the driver to support normal operations. The E810 has a limited
+functionality built in to allow PXE boot and other use cases, but the
+driver must download a package file during the driver initialization
+stage. The file must be in the /lib/firmware/intel/ice/ddp directory
+and it must be named ice.pkg. A symbolic link to this file is also ok.
+The same package file is used by both the kernel driver and the DPDK PMD.
+
+
 19.02 limitation
 ~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_19_05.rst +4 -0
index b1a7d75..af4300b 100644
@@ -102,6 +102,10 @@ New Features
   * Added support for VXLAN-GPE packet.
   * Added support for VXLAN-GPE classification.
 
+* **Updated the ice driver.**
+
+  * Added package download support.
+
 Removed Items
 -------------
 
drivers/net/ice/ice_ethdev.c +77 -0

107 lines not on this page · raw message

Signature · 1 line
2.9.5
#20 lore raw

v5 cover enable package download in ice driver

This patch set enabled package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

If package download failed, driver need to go to safe mode. This patch set disabled RSS, QINQ, checksum offload in safe mode.

The patch set also enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
V5:
1. improve as community's comment.
2. fixed time line error.

V4:
1. free memory when package download fail.

V3:
1. fixed compile issue.
2. split document update to each patch.

V2:
1. fixed errors in commit log.
2. removed unnecessary code.
3. improved as Qi's comments.
4. removed devargs.
5. added document update.

Qiming Yang (3):
net/ice: load OS default package
net/ice: add safe mode
net/ice: enable RSS when device init

 doc/guides/nics/ice.rst                |   9 ++
 doc/guides/rel_notes/release_19_05.rst |   6 ++
 drivers/net/ice/ice_ethdev.c           | 157 ++++++++++++++++++++++++++++++---
 drivers/net/ice/ice_ethdev.h           |   1 +
 4 files changed, 160 insertions(+), 13 deletions(-)
Signature · 1 line
2.9.5
#21 lore raw

PATCH v5 1/3 net/ice: load OS default package

This patch enables package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

There is no per device package be supported so far, all the devices can only download the same package. This limitation will be removed in the future.

---
 doc/guides/nics/ice.rst                |  9 ++++
 doc/guides/rel_notes/release_19_05.rst |  4 ++
 drivers/net/ice/ice_ethdev.c           | 76 ++++++++++++++++++++++++++++++++++
 3 files changed, 89 insertions(+)
doc/guides/nics/ice.rst +9 -0
index 0725669..77b9522 100644
@@ -101,6 +101,15 @@ To start ``testpmd``, and add vlan 10 to port 0:
 Limitations or Known issues
 ---------------------------
 
+The Intel E810 requires a programmable pipeline package be downloaded
+by the driver to support normal operations. The E810 has a limited
+functionality built in to allow PXE boot and other use cases, but the
+driver must download a package file during the driver initialization
+stage. The file must be in the /lib/firmware/intel/ice/ddp directory
+and it must be named ice.pkg. A symbolic link to this file is also ok.
+The same package file is used by both the kernel driver and the DPDK PMD.
+
+
 19.02 limitation
 ~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_19_05.rst +4 -0
index d2ec947..5f44fef 100644
@@ -107,6 +107,10 @@ New Features
   * Added support for VXLAN-GPE packet.
   * Added support for VXLAN-GPE classification.
 
+* **Updated the ice driver.**
+
+  * Added package download support.
+
 Removed Items
 -------------
 
drivers/net/ice/ice_ethdev.c +76 -0

106 lines not on this page · raw message

Signature · 1 line
2.9.5
#22 lore raw

PATCH v5 2/3 net/ice: add safe mode

In reply to Qiming Yang

If E810 download package failed, driver need to go to safe mode. In the safe mode, some advanced features will not be supported.

---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 48 ++++++++++++++++++++++------------
 drivers/net/ice/ice_ethdev.h           |  1 +
 3 files changed, 34 insertions(+), 16 deletions(-)
doc/guides/rel_notes/release_19_05.rst +1 -0
index 5f44fef..a5a22c9 100644
@@ -110,6 +110,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c +32 -16

104 lines not on this page · raw message

drivers/net/ice/ice_ethdev.h +1 -0
index 151a09e..9a8fbfa 100644
@@ -266,6 +266,7 @@ struct ice_adapter {
 	bool tx_simple_allowed;
 	/* ptype mapping table */
 	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
+	bool is_safe_mode;
 };
 
 struct ice_vsi_vlan_pvid_info {
Signature · 1 line
2.9.5
#23 lore raw

PATCH v5 3/3 net/ice: enable RSS when device init

In reply to Qiming Yang

This patch enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
doc/guides/rel_notes/release_19_05.rst +1 -0
index a5a22c9..1b2ce57 100644
@@ -111,6 +111,7 @@ New Features
 
   * Added package download support.
   * Added Safe Mode support.
+  * Supported RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c +39 -0
index 11720de..10a2bcf 100644
@@ -8,6 +8,7 @@
 #include <unistd.h>
 
 #include "base/ice_sched.h"
+#include "base/ice_flow.h"
 #include "ice_ethdev.h"
 #include "ice_rxtx.h"
 
@@ -1632,6 +1633,44 @@ static int ice_init_rss(struct ice_pf *pf)
 	if (ret)
 		return -EINVAL;
 
+	/* configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV6,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s TCP_IPV6 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp6 with input set IPv6 src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV6,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV6 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp6 with input set IPv6 src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV6 rss flow fail %d",
+				__func__, ret);
+
+	/* configure RSS for tcp4 with input set IP src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV4,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s TCP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp4 with input set IP src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV4,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp4 with input set IP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV4 rss flow fail %d",
+				__func__, ret);
+
 	return 0;
 }
 
Signature · 1 line
2.9.5
Acked-by on the v5 series
#24 lore raw

Re: [PATCH v5 0/3] enable package download in ice driver

In reply to Qiming Yang
Quoted 49 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Qiming Yang
Sent: Sunday, March 24, 2019 7:30 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Subject: [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver

This patch set enabled package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

If package download failed, driver need to go to safe mode. This patch set disabled RSS, QINQ, checksum offload in safe mode.

The patch set also enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
V5:
1. improve as community's comment.
2. fixed time line error.

V4:
1. free memory when package download fail.

V3:
1. fixed compile issue.
2. split document update to each patch.

V2:
1. fixed errors in commit log.
2. removed unnecessary code.
3. improved as Qi's comments.
4. removed devargs.
5. added document update.

Qiming Yang (3):
net/ice: load OS default package
net/ice: add safe mode
net/ice: enable RSS when device init

 doc/guides/nics/ice.rst                |   9 ++
 doc/guides/rel_notes/release_19_05.rst |   6 ++
 drivers/net/ice/ice_ethdev.c           | 157
++++++++++++++++++++++++++++++---
 drivers/net/ice/ice_ethdev.h           |   1 +
 4 files changed, 160 insertions(+), 13 deletions(-)
Quoted 2 lines

--
2.9.5

#25 lore raw

v6 cover enable package download in ice driver

In reply to Qiming Yang

This patch set enabled package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

If package download failed, driver need to go to safe mode. This patch set disabled RSS, QINQ, checksum offload in safe mode.

The patch set also enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
v6:
1. rebased to master branch.

V5:
1. improve as community's comment.
2. fixed time line error.

V4:
1. free memory when package download fail.

V3:
1. fixed compile issue.
2. split document update to each patch.

V2:
1. fixed errors in commit log.
2. removed unnecessary code.
3. improved as Qi's comments.
4. removed devargs.
5. added document update.

Qiming Yang (3):
net/ice: load OS default package
net/ice: add safe mode
net/ice: enable RSS when device init

 doc/guides/nics/ice.rst                |   9 ++
 doc/guides/rel_notes/release_19_05.rst |   5 ++
 drivers/net/ice/ice_ethdev.c           | 158 ++++++++++++++++++++++++++++++---
 drivers/net/ice/ice_ethdev.h           |   1 +
 4 files changed, 160 insertions(+), 13 deletions(-)
Signature · 1 line
2.9.5
#26 lore raw

PATCH v6 1/3 net/ice: load OS default package

This patch enables package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

There is no per device package be supported so far, all the devices can only download the same package. This limitation will be removed in the future.

---
 doc/guides/nics/ice.rst                |  9 ++++
 doc/guides/rel_notes/release_19_05.rst |  4 ++
 drivers/net/ice/ice_ethdev.c           | 77 ++++++++++++++++++++++++++++++++++
 3 files changed, 90 insertions(+)
doc/guides/nics/ice.rst +9 -0
index 3998d5e..6410ec5 100644
@@ -84,6 +84,15 @@ To start ``testpmd``, and add vlan 10 to port 0:
 Limitations or Known issues
 ---------------------------
 
+The Intel E810 requires a programmable pipeline package be downloaded
+by the driver to support normal operations. The E810 has a limited
+functionality built in to allow PXE boot and other use cases, but the
+driver must download a package file during the driver initialization
+stage. The file must be in the /lib/firmware/intel/ice/ddp directory
+and it must be named ice.pkg. A symbolic link to this file is also ok.
+The same package file is used by both the kernel driver and the DPDK PMD.
+
+
 19.02 limitation
 ~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_19_05.rst +4 -0
index 61a2c73..b73938a 100644
@@ -91,6 +91,10 @@ New Features
 
   * Added promiscuous mode support.
 
+* **Updated the ice driver.**
+
+  * Added package download support.
+
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c +77 -0

107 lines not on this page · raw message

Signature · 1 line
2.9.5
#27 lore raw

Re: [PATCH v6 1/3] net/ice: load OS default package

Quoted 65 lines

-----Original Message-----
From: Yang, Qiming
Sent: Monday, March 25, 2019 5:01 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Subject: [PATCH v6 1/3] net/ice: load OS default package

This patch enables package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg.
The package is shared by the kernel driver and the DPDK PMD.

There is no per device package be supported so far, all the devices can only download the same package. This limitation will be removed in the future.

---
 doc/guides/nics/ice.rst                |  9 ++++
 doc/guides/rel_notes/release_19_05.rst |  4 ++
 drivers/net/ice/ice_ethdev.c           | 77
++++++++++++++++++++++++++++++++++
 3 files changed, 90 insertions(+)
doc/guides/nics/ice.rst index renamed from doc/guides/nics/ice.rst +0 -0

3998d5e..6410ec5 100644

doc/guides/nics/ice.rst +9 -0
@@ -84,6 +84,15 @@ To start ``testpmd``, and add vlan 10 to port 0:
 Limitations or Known issues
 ---------------------------
 
+The Intel E810 requires a programmable pipeline package be downloaded
+by the driver to support normal operations. The E810 has a limited
+functionality built in to allow PXE boot and other use cases, but the
+driver must download a package file during the driver initialization
+stage. The file must be in the /lib/firmware/intel/ice/ddp directory
+and it must be named ice.pkg. A symbolic link to this file is also ok.
+The same package file is used by both the kernel driver and the DPDK PMD.
+
+
 19.02 limitation
 ~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_19_05.rst +4 -0
index 61a2c73..b73938a 100644
@@ -91,6 +91,10 @@ New Features
 
   * Added promiscuous mode support.
 
+* **Updated the ice driver.**
+
+  * Added package download support.
+
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c index renamed from drivers/net/ice/ice_ethdev.c +0 -0

a23c63a..c2a03c3 100644

drivers/net/ice/ice_ethdev.c line 7

Quoted 4 lines
drivers/net/ice/ice_ethdev.c +1 -0
@@ -4,12 +4,19 @@
 
 #include <rte_ethdev_pci.h>
 
+	

Unnecessary empty line.

Quoted 37 lines
drivers/net/ice/ice_ethdev.c +24 -0
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 #include "base/ice_sched.h"
 #include "ice_ethdev.h"
 #include "ice_rxtx.h"
 
 #define ICE_MAX_QP_NUM "max_queue_pair_num"
 #define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100
+#define ICE_DFLT_PKG_FILE "/lib/firmware/intel/ice/ddp/ice.pkg"
 
 int ice_logtype_init;
 int ice_logtype_driver;
@@ -1259,6 +1266,69 @@ ice_pf_setup(struct ice_pf *pf)
 	return 0;
 }
 
+static int ice_load_pkg(struct rte_eth_dev *dev) {
+	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	const char *pkg_file = ICE_DFLT_PKG_FILE;
+	int err;
+	uint8_t *buf;
+	int buf_len;
+	FILE *file;
+	struct stat fstat;
+
+	file = fopen(pkg_file, "rb");
+	if (!file)  {
+		PMD_INIT_LOG(ERR, "failed to open file: %s\n", pkg_file);
+		return -1;
+	}
+
+	err = stat(pkg_file, &fstat);
+	if (err) {
+		PMD_INIT_LOG(ERR, "failed to get file stats\n");

drivers/net/ice/ice_ethdev.c ice_pf_setup(struct ice_pf *pf) · line 1296

Quoted 10 lines
drivers/net/ice/ice_ethdev.c +10 -0
+		fclose(file);
+		return err;
+	}
+
+	buf_len = fstat.st_size;
+	buf = rte_malloc(NULL, buf_len, 0);
+
+	if (!buf) {
+		PMD_INIT_LOG(ERR, "failed to allocate buf of size %d"
+				  "for package\n", buf_len);

No need to split a string.

Quoted 60 lines
drivers/net/ice/ice_ethdev.c +40 -0
+		fclose(file);
+		return -1;
+	}
+
+	err = fread(buf, buf_len, 1, file);
+	if (err != 1) {
+		PMD_INIT_LOG(ERR, "failed to read package data\n");
+		fclose(file);
+		err = -1;
+		goto fail_exit;
+	}
+
+	fclose(file);
+
+	err = ice_copy_and_init_pkg(hw, buf, buf_len);
+	if (err) {
+		PMD_INIT_LOG(ERR, "ice_copy_and_init_hw failed: %d\n", err);
+		goto fail_exit;
+	}
+	err = ice_init_hw_tbls(hw);
+	if (err) {
+		PMD_INIT_LOG(ERR, "ice_init_hw_tbls failed: %d\n", err);
+		goto fail_init_tbls;
+	}
+
+	return 0;
+
+fail_init_tbls:
+	rte_free(hw->pkg_copy);
+fail_exit:
+	rte_free(buf);
+	return err;
+}
+
 static int
 ice_dev_init(struct rte_eth_dev *dev)
 {
@@ -1298,6 +1368,12 @@ ice_dev_init(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
+	ret = ice_load_pkg(dev);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to load the DDP package");
+		goto err_load_pkg;
+	}
+
 	PMD_INIT_LOG(INFO, "FW %d.%d.%05d API %d.%d",
 		     hw->fw_maj_ver, hw->fw_min_ver, hw->fw_build,
 		     hw->api_maj_ver, hw->api_min_ver); @@ -1343,6 +1419,7 @@

ice_dev_init(struct rte_eth_dev *dev)
err_msix_pool_init:

drivers/net/ice/ice_ethdev.c +1 -1
 	rte_free(dev->data->mac_addrs);
 err_init_mac:
+err_load_pkg:
 	ice_sched_cleanup_all(hw);
 	rte_free(hw->port_info);
 	ice_shutdown_all_ctrlq(hw);
--

2.9.5

#28 lore raw

PATCH v6 2/3 net/ice: add safe mode

In reply to Qiming Yang

If E810 download package failed, driver need to go to safe mode. In the safe mode, some advanced features will not be supported.

---
 doc/guides/rel_notes/release_19_05.rst |  2 +-
 drivers/net/ice/ice_ethdev.c           | 48 ++++++++++++++++++++++------------
 drivers/net/ice/ice_ethdev.h           |  1 +
 3 files changed, 34 insertions(+), 17 deletions(-)
doc/guides/rel_notes/release_19_05.rst +1 -1
index b73938a..c9267a2 100644
@@ -94,7 +94,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
-
+  * Added Safe Mode support.
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c +32 -16

104 lines not on this page · raw message

drivers/net/ice/ice_ethdev.h +1 -0
index 3cefa5b..b1f1f79 100644
@@ -264,6 +264,7 @@ struct ice_adapter {
 	bool tx_simple_allowed;
 	/* ptype mapping table */
 	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
+	bool is_safe_mode;
 };
 
 struct ice_vsi_vlan_pvid_info {
Signature · 1 line
2.9.5
#29 lore raw

PATCH v6 3/3 net/ice: enable RSS when device init

In reply to Qiming Yang

This patch enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
doc/guides/rel_notes/release_19_05.rst +1 -0
index c9267a2..60bc52d 100644
@@ -95,6 +95,7 @@ New Features
 
   * Added package download support.
   * Added Safe Mode support.
+  * Supported RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c +39 -0
index db4c115..282e983 100644
@@ -11,6 +11,7 @@
 #include <unistd.h>
 
 #include "base/ice_sched.h"
+#include "base/ice_flow.h"
 #include "ice_ethdev.h"
 #include "ice_rxtx.h"
 
@@ -1635,6 +1636,44 @@ static int ice_init_rss(struct ice_pf *pf)
 	if (ret)
 		return -EINVAL;
 
+	/* configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV6,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s TCP_IPV6 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp6 with input set IPv6 src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV6,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV6 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp6 with input set IPv6 src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV6 rss flow fail %d",
+				__func__, ret);
+
+	/* configure RSS for tcp4 with input set IP src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV4,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s TCP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp4 with input set IP src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV4,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp4 with input set IP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV4 rss flow fail %d",
+				__func__, ret);
+
 	return 0;
 }
 
Signature · 1 line
2.9.5
Acked-by on the v6 series Applied
#30 lore raw

Re: [PATCH v6 0/3] enable package download in ice driver

In reply to Qiming Yang
Quoted 54 lines

-----Original Message-----
From: Yang, Qiming
Sent: Monday, March 25, 2019 5:01 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Subject: [PATCH v6 0/3] enable package download in ice driver

This patch set enabled package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

If package download failed, driver need to go to safe mode. This patch set disabled RSS, QINQ, checksum offload in safe mode.

The patch set also enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
v6:
1. rebased to master branch.

V5:
1. improve as community's comment.
2. fixed time line error.

V4:
1. free memory when package download fail.

V3:
1. fixed compile issue.
2. split document update to each patch.

V2:
1. fixed errors in commit log.
2. removed unnecessary code.
3. improved as Qi's comments.
4. removed devargs.
5. added document update.

Qiming Yang (3):
net/ice: load OS default package
net/ice: add safe mode
net/ice: enable RSS when device init

 doc/guides/nics/ice.rst                |   9 ++
 doc/guides/rel_notes/release_19_05.rst |   5 ++
 drivers/net/ice/ice_ethdev.c           | 158
++++++++++++++++++++++++++++++---
 drivers/net/ice/ice_ethdev.h           |   1 +
 4 files changed, 160 insertions(+), 13 deletions(-)
Quoted 2 lines

--
2.9.5

Applied to dpdk-next-net-intel with minor fix on PATCH 1/3

Thanks
Qi

#31 lore raw

PATCH v4 1/3 net/ice: load OS default package

In reply to Qiming Yang

This patch enables package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

There is no per device package be supported so far, all the devices can only download the same package. This limitation will be removed in the future.

---
 doc/guides/nics/ice.rst                |  9 ++++
 doc/guides/rel_notes/release_19_05.rst |  4 ++
 drivers/net/ice/ice_ethdev.c           | 77 ++++++++++++++++++++++++++++++++++
 3 files changed, 90 insertions(+)
doc/guides/nics/ice.rst +9 -0
index 3998d5e..6410ec5 100644
@@ -84,6 +84,15 @@ To start ``testpmd``, and add vlan 10 to port 0:
 Limitations or Known issues
 ---------------------------
 
+The Intel E810 requires a programmable pipeline package be downloaded
+by the driver to support normal operations. The E810 has a limited
+functionality built in to allow PXE boot and other use cases, but the
+driver must download a package file during the driver initialization
+stage. The file must be in the /lib/firmware/intel/ice/ddp directory
+and it must be named ice.pkg. A symbolic link to this file is also ok.
+The same package file is used by both the kernel driver and the DPDK PMD.
+
+
 19.02 limitation
 ~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_19_05.rst +4 -0
index b1a7d75..af4300b 100644
@@ -102,6 +102,10 @@ New Features
   * Added support for VXLAN-GPE packet.
   * Added support for VXLAN-GPE classification.
 
+* **Updated the ice driver.**
+
+  * Added package download support.
+
 Removed Items
 -------------
 
drivers/net/ice/ice_ethdev.c +77 -0

107 lines not on this page · raw message

Signature · 1 line
2.9.5
#32 lore raw

PATCH v4 2/3 net/ice: add safe mode

In reply to Qiming Yang

If E810 download package failed, driver need to go to safe mode. In the safe mode, some advanced features will not be supported.

---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 48 ++++++++++++++++++++++------------
 drivers/net/ice/ice_ethdev.h           |  1 +
 3 files changed, 34 insertions(+), 16 deletions(-)
doc/guides/rel_notes/release_19_05.rst +1 -0
index af4300b..9ca147f 100644
@@ -105,6 +105,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c +32 -16

104 lines not on this page · raw message

drivers/net/ice/ice_ethdev.h +1 -0
index 151a09e..9a8fbfa 100644
@@ -266,6 +266,7 @@ struct ice_adapter {
 	bool tx_simple_allowed;
 	/* ptype mapping table */
 	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
+	bool is_safe_mode;
 };
 
 struct ice_vsi_vlan_pvid_info {
Signature · 1 line
2.9.5
#33 lore raw

v4 cover enable package download in ice driver

In reply to Qiming Yang

This patch set enabled package downloading to the device. The package is to be in the /lib/firmware/intel/ice/ddp directory and named ice.pkg. The package is shared by the kernel driver and the DPDK PMD.

If package download failed, driver need to go to safe mode. This patch set disabled RSS, QINQ, checksum offload in safe mode.

The patch set also enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
V4:
1. free memory when package download fail.

V3:
1. fixed compile issue.
2. split document update to each patch.

V2:
1. fixed errors in commit log.
2. removed unnecessary code.
3. improved as Qi's comments.
4. removed devargs.
5. added document update.

Qiming Yang (3):
net/ice: load OS default package
net/ice: add safe mode
net/ice: enable RSS when device init

 doc/guides/nics/ice.rst                |   9 ++
 doc/guides/rel_notes/release_19_05.rst |   6 ++
 drivers/net/ice/ice_ethdev.c           | 158 ++++++++++++++++++++++++++++++---
 drivers/net/ice/ice_ethdev.h           |   1 +
 4 files changed, 161 insertions(+), 13 deletions(-)
Signature · 1 line
2.9.5
#34 lore raw

PATCH v4 2/3 net/ice: add safe mode

In reply to Qiming Yang

If E810 download package failed, driver need to go to safe mode. In the safe mode, some advanced features will not be supported.

---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 48 ++++++++++++++++++++++------------
 drivers/net/ice/ice_ethdev.h           |  1 +
 3 files changed, 34 insertions(+), 16 deletions(-)
doc/guides/rel_notes/release_19_05.rst +1 -0
index af4300b..9ca147f 100644
@@ -105,6 +105,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c +32 -16

104 lines not on this page · raw message

drivers/net/ice/ice_ethdev.h +1 -0
index 151a09e..9a8fbfa 100644
@@ -266,6 +266,7 @@ struct ice_adapter {
 	bool tx_simple_allowed;
 	/* ptype mapping table */
 	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
+	bool is_safe_mode;
 };
 
 struct ice_vsi_vlan_pvid_info {
Signature · 1 line
2.9.5
#35 lore raw

PATCH v4 3/3 net/ice: enable RSS when device init

In reply to Qiming Yang

This patch enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
doc/guides/rel_notes/release_19_05.rst +1 -0
index 9ca147f..7d34d63 100644
@@ -106,6 +106,7 @@ New Features
 
   * Added package download support.
   * Added Safe Mode support.
+  * Supported RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c +39 -0
index 99039d6..1c922b4 100644
@@ -8,6 +8,7 @@
 #include <unistd.h>
 
 #include "base/ice_sched.h"
+#include "base/ice_flow.h"
 #include "ice_ethdev.h"
 #include "ice_rxtx.h"
 
@@ -1633,6 +1634,44 @@ static int ice_init_rss(struct ice_pf *pf)
 	if (ret)
 		return -EINVAL;
 
+	/* configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV6,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s TCP_IPV6 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp6 with input set IPv6 src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV6,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV6 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp6 with input set IPv6 src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV6 rss flow fail %d",
+				__func__, ret);
+
+	/* configure RSS for tcp4 with input set IP src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV4,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s TCP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp4 with input set IP src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV4,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp4 with input set IP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV4 rss flow fail %d",
+				__func__, ret);
+
 	return 0;
 }
 
Signature · 1 line
2.9.5
#36 lore raw

PATCH v4 3/3 net/ice: enable RSS when device init

In reply to Qiming Yang

This patch enabled RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.

---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
doc/guides/rel_notes/release_19_05.rst +1 -0
index 9ca147f..7d34d63 100644
@@ -106,6 +106,7 @@ New Features
 
   * Added package download support.
   * Added Safe Mode support.
+  * Supported RSS for UPD/TCP/SCTP+IPV4/IPV6 packets.
 
 Removed Items
 -------------
drivers/net/ice/ice_ethdev.c +39 -0
index 99039d6..1c922b4 100644
@@ -8,6 +8,7 @@
 #include <unistd.h>
 
 #include "base/ice_sched.h"
+#include "base/ice_flow.h"
 #include "ice_ethdev.h"
 #include "ice_rxtx.h"
 
@@ -1633,6 +1634,44 @@ static int ice_init_rss(struct ice_pf *pf)
 	if (ret)
 		return -EINVAL;
 
+	/* configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV6,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s TCP_IPV6 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp6 with input set IPv6 src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV6,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV6 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp6 with input set IPv6 src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV6);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV6 rss flow fail %d",
+				__func__, ret);
+
+	/* configure RSS for tcp4 with input set IP src/dst, TCP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV4,
+			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s TCP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for udp4 with input set IP src/dst, UDP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV4,
+			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s UDP_IPV4 rss flow fail %d", __func__, ret);
+
+	/* configure RSS for sctp4 with input set IP src/dst */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4,
+			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s SCTP_IPV4 rss flow fail %d",
+				__func__, ret);
+
 	return 0;
 }
 
Signature · 1 line
2.9.5