DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] net/ice: suppport package download
@ 2019-03-01 12:46 Qiming Yang
  2019-03-01 12:46 ` [dpdk-dev] [PATCH 2/2] net/ice: disable advanced features in safe mode Qiming Yang
                   ` (5 more replies)
  0 siblings, 6 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-01 12:46 UTC (permalink / raw)
  To: dev; +Cc: Qiming Yang

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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 134 +++++++++++++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_ethdev.h |   2 +
 2 files changed, 136 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index a23c63a..c097259 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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 */
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 3cefa5b..796459a 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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

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

* [dpdk-dev] [PATCH 2/2] net/ice: disable advanced features in safe mode
  2019-03-01 12:46 [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Qiming Yang
@ 2019-03-01 12:46 ` Qiming Yang
  2019-03-01 18:38   ` Stephen Hemminger
  2019-03-01 20:41   ` Stillwell Jr, Paul M
  2019-03-01 13:40 ` [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Thomas Monjalon
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-01 12:46 UTC (permalink / raw)
  To: dev; +Cc: Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c097259..4e2b65e 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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

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

* Re: [dpdk-dev] [PATCH 1/2] net/ice: suppport package download
  2019-03-01 12:46 [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Qiming Yang
  2019-03-01 12:46 ` [dpdk-dev] [PATCH 2/2] net/ice: disable advanced features in safe mode Qiming Yang
@ 2019-03-01 13:40 ` Thomas Monjalon
  2019-03-06  2:36   ` Yang, Qiming
  2019-03-01 18:39 ` Stephen Hemminger
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 65+ messages in thread
From: Thomas Monjalon @ 2019-03-01 13:40 UTC (permalink / raw)
  To: Qiming Yang; +Cc: dev

01/03/2019 13:46, Qiming Yang:
> 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.
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
>  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.

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

* Re: [dpdk-dev] [PATCH 2/2] net/ice: disable advanced features in safe mode
  2019-03-01 12:46 ` [dpdk-dev] [PATCH 2/2] net/ice: disable advanced features in safe mode Qiming Yang
@ 2019-03-01 18:38   ` Stephen Hemminger
  2019-03-01 20:41   ` Stillwell Jr, Paul M
  1 sibling, 0 replies; 65+ messages in thread
From: Stephen Hemminger @ 2019-03-01 18:38 UTC (permalink / raw)
  To: Qiming Yang; +Cc: dev

On Fri,  1 Mar 2019 20:46:13 +0800
Qiming Yang <qiming.yang@intel.com> wrote:

> +	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.

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

* Re: [dpdk-dev] [PATCH 1/2] net/ice: suppport package download
  2019-03-01 12:46 [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Qiming Yang
  2019-03-01 12:46 ` [dpdk-dev] [PATCH 2/2] net/ice: disable advanced features in safe mode Qiming Yang
  2019-03-01 13:40 ` [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Thomas Monjalon
@ 2019-03-01 18:39 ` Stephen Hemminger
  2019-03-01 18:40 ` Stephen Hemminger
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 65+ messages in thread
From: Stephen Hemminger @ 2019-03-01 18:39 UTC (permalink / raw)
  To: Qiming Yang; +Cc: dev

On Fri,  1 Mar 2019 20:46:12 +0800
Qiming Yang <qiming.yang@intel.com> wrote:

>  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;

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

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

* Re: [dpdk-dev] [PATCH 1/2] net/ice: suppport package download
  2019-03-01 12:46 [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Qiming Yang
                   ` (2 preceding siblings ...)
  2019-03-01 18:39 ` Stephen Hemminger
@ 2019-03-01 18:40 ` Stephen Hemminger
  2019-03-04 17:54 ` Stillwell Jr, Paul M
  2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver Qiming Yang
  5 siblings, 0 replies; 65+ messages in thread
From: Stephen Hemminger @ 2019-03-01 18:40 UTC (permalink / raw)
  To: Qiming Yang; +Cc: dev

On Fri,  1 Mar 2019 20:46:12 +0800
Qiming Yang <qiming.yang@intel.com> wrote:

> +
> +	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

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

* Re: [dpdk-dev] [PATCH 2/2] net/ice: disable advanced features in safe mode
  2019-03-01 12:46 ` [dpdk-dev] [PATCH 2/2] net/ice: disable advanced features in safe mode Qiming Yang
  2019-03-01 18:38   ` Stephen Hemminger
@ 2019-03-01 20:41   ` Stillwell Jr, Paul M
  1 sibling, 0 replies; 65+ messages in thread
From: Stillwell Jr, Paul M @ 2019-03-01 20:41 UTC (permalink / raw)
  To: Yang, Qiming, dev; +Cc: Yang, Qiming

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:dev-bounces@dpdk.org] On Behalf Of Qiming Yang
Sent: Friday, March 1, 2019 4:46 AM
To: dev@dpdk.org
Cc: Yang, Qiming <qiming.yang@intel.com>
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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index c097259..4e2b65e 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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

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

* Re: [dpdk-dev] [PATCH 1/2] net/ice: suppport package download
  2019-03-01 12:46 [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Qiming Yang
                   ` (3 preceding siblings ...)
  2019-03-01 18:40 ` Stephen Hemminger
@ 2019-03-04 17:54 ` Stillwell Jr, Paul M
  2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver Qiming Yang
  5 siblings, 0 replies; 65+ messages in thread
From: Stillwell Jr, Paul M @ 2019-03-04 17:54 UTC (permalink / raw)
  To: Yang, Qiming, dev; +Cc: Yang, Qiming

NACK, see comments below

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiming Yang
> Sent: Friday, March 1, 2019 4:46 AM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>
> 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.

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

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

> When package download failed, will initialize in safe mode, some advanced
> features will not be supported.
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
>  drivers/net/ice/ice_ethdev.c | 134
> +++++++++++++++++++++++++++++++++++++++++++
>  drivers/net/ice/ice_ethdev.h |   2 +
>  2 files changed, 136 insertions(+)
> 
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
> index a23c63a..c097259 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -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 */
> diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
> index 3cefa5b..796459a 100644
> --- a/drivers/net/ice/ice_ethdev.h
> +++ b/drivers/net/ice/ice_ethdev.h
> @@ -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

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

* Re: [dpdk-dev] [PATCH 1/2] net/ice: suppport package download
  2019-03-01 13:40 ` [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Thomas Monjalon
@ 2019-03-06  2:36   ` Yang, Qiming
  0 siblings, 0 replies; 65+ messages in thread
From: Yang, Qiming @ 2019-03-06  2:36 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

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

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Friday, March 1, 2019 9:40 PM
> To: Yang, Qiming <qiming.yang@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 1/2] net/ice: suppport package download
> 
> 01/03/2019 13:46, Qiming Yang:
> > 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.
> >
> > Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> > ---
> >  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.
> 
> 

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

* [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver
  2019-03-01 12:46 [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Qiming Yang
                   ` (4 preceding siblings ...)
  2019-03-04 17:54 ` Stillwell Jr, Paul M
@ 2019-03-20 15:50 ` Qiming Yang
  2019-03-20 15:50   ` Qiming Yang
                     ` (5 more replies)
  5 siblings, 6 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 15:50 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, paul.m.stillwell.jr, 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(-)

-- 
2.9.5

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

* [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver
  2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver Qiming Yang
@ 2019-03-20 15:50   ` Qiming Yang
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 1/4] net/ice: load OS default package Qiming Yang
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 15:50 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, paul.m.stillwell.jr, 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(-)

-- 
2.9.5


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

* [dpdk-dev] [PATCH v2 1/4] net/ice: load OS default package
  2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver Qiming Yang
  2019-03-20 15:50   ` Qiming Yang
@ 2019-03-20 15:50   ` Qiming Yang
  2019-03-20 15:50     ` Qiming Yang
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 2/4] net/ice: add safe mode Qiming Yang
                     ` (3 subsequent siblings)
  5 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 15:50 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, paul.m.stillwell.jr, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 69 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index a23c63a..13f2748 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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);
-- 
2.9.5

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

* [dpdk-dev] [PATCH v2 1/4] net/ice: load OS default package
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 1/4] net/ice: load OS default package Qiming Yang
@ 2019-03-20 15:50     ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 15:50 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, paul.m.stillwell.jr, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 69 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index a23c63a..13f2748 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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);
-- 
2.9.5


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

* [dpdk-dev] [PATCH v2 2/4] net/ice: add safe mode
  2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver Qiming Yang
  2019-03-20 15:50   ` Qiming Yang
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 1/4] net/ice: load OS default package Qiming Yang
@ 2019-03-20 15:50   ` Qiming Yang
  2019-03-20 15:50     ` Qiming Yang
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 3/4] net/ice: enable RSS when device init Qiming Yang
                     ` (2 subsequent siblings)
  5 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 15:50 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, paul.m.stillwell.jr, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 48 +++++++++++++++++++++++++++++---------------
 drivers/net/ice/ice_ethdev.h |  1 +
 2 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 13f2748..a217da8 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 3cefa5b..b1f1f79 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5

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

* [dpdk-dev] [PATCH v2 2/4] net/ice: add safe mode
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 2/4] net/ice: add safe mode Qiming Yang
@ 2019-03-20 15:50     ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 15:50 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, paul.m.stillwell.jr, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 48 +++++++++++++++++++++++++++++---------------
 drivers/net/ice/ice_ethdev.h |  1 +
 2 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 13f2748..a217da8 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 3cefa5b..b1f1f79 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5


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

* [dpdk-dev] [PATCH v2 3/4] net/ice: enable RSS when device init
  2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver Qiming Yang
                     ` (2 preceding siblings ...)
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 2/4] net/ice: add safe mode Qiming Yang
@ 2019-03-20 15:50   ` Qiming Yang
  2019-03-20 15:50     ` Qiming Yang
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 4/4] doc: add document update for package download Qiming Yang
  2019-03-20 17:59   ` [dpdk-dev] [PATCH v3 0/3] enable package download in ice driver Qiming Yang
  5 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 15:50 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, paul.m.stillwell.jr, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index a217da8..60aaedc 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5

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

* [dpdk-dev] [PATCH v2 3/4] net/ice: enable RSS when device init
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 3/4] net/ice: enable RSS when device init Qiming Yang
@ 2019-03-20 15:50     ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 15:50 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, paul.m.stillwell.jr, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index a217da8..60aaedc 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5


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

* [dpdk-dev] [PATCH v2 4/4] doc: add document update for package download
  2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver Qiming Yang
                     ` (3 preceding siblings ...)
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 3/4] net/ice: enable RSS when device init Qiming Yang
@ 2019-03-20 15:50   ` Qiming Yang
  2019-03-20 15:50     ` Qiming Yang
  2019-03-20 17:59   ` [dpdk-dev] [PATCH v3 0/3] enable package download in ice driver Qiming Yang
  5 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 15:50 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, paul.m.stillwell.jr, Qiming Yang

Updated ice.rst and release_19_05.rst.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/nics/ice.rst                | 9 +++++++++
 doc/guides/rel_notes/release_19_05.rst | 5 +++++
 2 files changed, 14 insertions(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 3998d5e..6410ec5 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 61a2c73..7248ea1 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
-- 
2.9.5

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

* [dpdk-dev] [PATCH v2 4/4] doc: add document update for package download
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 4/4] doc: add document update for package download Qiming Yang
@ 2019-03-20 15:50     ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 15:50 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, paul.m.stillwell.jr, Qiming Yang

Updated ice.rst and release_19_05.rst.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/nics/ice.rst                | 9 +++++++++
 doc/guides/rel_notes/release_19_05.rst | 5 +++++
 2 files changed, 14 insertions(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 3998d5e..6410ec5 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 61a2c73..7248ea1 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
-- 
2.9.5


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

* [dpdk-dev] [PATCH v3 0/3] enable package download in ice driver
  2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver Qiming Yang
                     ` (4 preceding siblings ...)
  2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 4/4] doc: add document update for package download Qiming Yang
@ 2019-03-20 17:59   ` Qiming Yang
  2019-03-20 17:59     ` Qiming Yang
                       ` (4 more replies)
  5 siblings, 5 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 17:59 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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(-)

-- 
2.9.5

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

* [dpdk-dev] [PATCH v3 0/3] enable package download in ice driver
  2019-03-20 17:59   ` [dpdk-dev] [PATCH v3 0/3] enable package download in ice driver Qiming Yang
@ 2019-03-20 17:59     ` Qiming Yang
  2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 1/3] net/ice: load OS default package Qiming Yang
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 17:59 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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(-)

-- 
2.9.5


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

* [dpdk-dev] [PATCH v3 1/3] net/ice: load OS default package
  2019-03-20 17:59   ` [dpdk-dev] [PATCH v3 0/3] enable package download in ice driver Qiming Yang
  2019-03-20 17:59     ` Qiming Yang
@ 2019-03-20 17:59     ` Qiming Yang
  2019-03-20 17:59       ` Qiming Yang
  2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 2/3] net/ice: add safe mode Qiming Yang
                       ` (2 subsequent siblings)
  4 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 17:59 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 3998d5e..6410ec5 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index b1a7d75..af4300b 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
 
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c468962..2ff6fdd 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2,12 +2,18 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#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;
@@ -1257,6 +1263,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_file, "rb");
+	if (!file)  {
+		PMD_INIT_LOG(ERR, "failed to open file: %s", pkg_file);
+		return -1;
+	}
+
+	err = stat(pkg_file, &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)
 {
@@ -1296,6 +1358,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);
@@ -1341,6 +1409,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);
-- 
2.9.5

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

* [dpdk-dev] [PATCH v3 1/3] net/ice: load OS default package
  2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 1/3] net/ice: load OS default package Qiming Yang
@ 2019-03-20 17:59       ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 17:59 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 3998d5e..6410ec5 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index b1a7d75..af4300b 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
 
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c468962..2ff6fdd 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2,12 +2,18 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#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;
@@ -1257,6 +1263,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_file, "rb");
+	if (!file)  {
+		PMD_INIT_LOG(ERR, "failed to open file: %s", pkg_file);
+		return -1;
+	}
+
+	err = stat(pkg_file, &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)
 {
@@ -1296,6 +1358,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);
@@ -1341,6 +1409,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);
-- 
2.9.5


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

* [dpdk-dev] [PATCH v3 2/3] net/ice: add safe mode
  2019-03-20 17:59   ` [dpdk-dev] [PATCH v3 0/3] enable package download in ice driver Qiming Yang
  2019-03-20 17:59     ` Qiming Yang
  2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 1/3] net/ice: load OS default package Qiming Yang
@ 2019-03-20 17:59     ` Qiming Yang
  2019-03-20 17:59       ` Qiming Yang
  2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 3/3] net/ice: enable RSS when device init Qiming Yang
  2019-03-21 15:02     ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
  4 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 17:59 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(-)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index af4300b..9ca147f 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -105,6 +105,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 2ff6fdd..b5b52ff 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1326,6 +1326,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;
 
@@ -1360,8 +1362,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",
@@ -1409,7 +1412,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);
@@ -1579,12 +1581,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);
@@ -1889,6 +1897,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;
@@ -1899,33 +1908,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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 151a09e..9a8fbfa 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5

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

* [dpdk-dev] [PATCH v3 2/3] net/ice: add safe mode
  2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 2/3] net/ice: add safe mode Qiming Yang
@ 2019-03-20 17:59       ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 17:59 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(-)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index af4300b..9ca147f 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -105,6 +105,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 2ff6fdd..b5b52ff 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1326,6 +1326,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;
 
@@ -1360,8 +1362,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",
@@ -1409,7 +1412,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);
@@ -1579,12 +1581,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);
@@ -1889,6 +1897,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;
@@ -1899,33 +1908,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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 151a09e..9a8fbfa 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5


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

* [dpdk-dev] [PATCH v3 3/3] net/ice: enable RSS when device init
  2019-03-20 17:59   ` [dpdk-dev] [PATCH v3 0/3] enable package download in ice driver Qiming Yang
                       ` (2 preceding siblings ...)
  2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 2/3] net/ice: add safe mode Qiming Yang
@ 2019-03-20 17:59     ` Qiming Yang
  2019-03-20 17:59       ` Qiming Yang
  2019-03-21 15:02     ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
  4 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 17:59 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 9ca147f..7d34d63 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index b5b52ff..dffaf4f 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5

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

* [dpdk-dev] [PATCH v3 3/3] net/ice: enable RSS when device init
  2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 3/3] net/ice: enable RSS when device init Qiming Yang
@ 2019-03-20 17:59       ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-20 17:59 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 9ca147f..7d34d63 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index b5b52ff..dffaf4f 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5


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

* [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver
  2019-03-20 17:59   ` [dpdk-dev] [PATCH v3 0/3] enable package download in ice driver Qiming Yang
                       ` (3 preceding siblings ...)
  2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 3/3] net/ice: enable RSS when device init Qiming Yang
@ 2019-03-21 15:02     ` Qiming Yang
  2019-03-21 15:02       ` Qiming Yang
                         ` (7 more replies)
  4 siblings, 8 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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(-)

-- 
2.9.5

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

* [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver
  2019-03-21 15:02     ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
@ 2019-03-21 15:02       ` Qiming Yang
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
                         ` (6 subsequent siblings)
  7 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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(-)

-- 
2.9.5


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

* [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package
  2019-03-21 15:02     ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
  2019-03-21 15:02       ` Qiming Yang
@ 2019-03-21 15:02       ` Qiming Yang
  2019-03-21 15:02         ` Qiming Yang
                           ` (2 more replies)
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode Qiming Yang
                         ` (5 subsequent siblings)
  7 siblings, 3 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 3998d5e..6410ec5 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index b1a7d75..af4300b 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
 
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c468962..bf527ef 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2,12 +2,18 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#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;
@@ -1257,6 +1263,70 @@ 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", pkg_file);
+		return -1;
+	}
+
+	err = stat(pkg_file, &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);
+		err = -1;
+		goto fail_read;
+	}
+
+	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_init_pkg;
+	}
+	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_init_pkg:
+fail_read:
+	rte_free(buf);
+	return err;
+}
+
 static int
 ice_dev_init(struct rte_eth_dev *dev)
 {
@@ -1296,6 +1366,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);
@@ -1341,6 +1417,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);
-- 
2.9.5

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

* [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
@ 2019-03-21 15:02         ` Qiming Yang
  2019-03-25  2:29         ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Qiming Yang
  2019-03-25  9:00         ` [dpdk-dev] [PATCH v6 " Qiming Yang
  2 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 3998d5e..6410ec5 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index b1a7d75..af4300b 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
 
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c468962..bf527ef 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2,12 +2,18 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#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;
@@ -1257,6 +1263,70 @@ 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", pkg_file);
+		return -1;
+	}
+
+	err = stat(pkg_file, &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);
+		err = -1;
+		goto fail_read;
+	}
+
+	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_init_pkg;
+	}
+	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_init_pkg:
+fail_read:
+	rte_free(buf);
+	return err;
+}
+
 static int
 ice_dev_init(struct rte_eth_dev *dev)
 {
@@ -1296,6 +1366,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);
@@ -1341,6 +1417,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);
-- 
2.9.5


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

* [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode
  2019-03-21 15:02     ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
  2019-03-21 15:02       ` Qiming Yang
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
@ 2019-03-21 15:02       ` Qiming Yang
  2019-03-21 15:02         ` Qiming Yang
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init Qiming Yang
                         ` (4 subsequent siblings)
  7 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(-)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index af4300b..9ca147f 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -105,6 +105,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index bf527ef..99039d6 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1334,6 +1334,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;
 
@@ -1368,8 +1370,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",
@@ -1417,7 +1420,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);
@@ -1587,12 +1589,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);
@@ -1897,6 +1905,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;
@@ -1907,33 +1916,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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 151a09e..9a8fbfa 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5

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

* [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode Qiming Yang
@ 2019-03-21 15:02         ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(-)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index af4300b..9ca147f 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -105,6 +105,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index bf527ef..99039d6 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1334,6 +1334,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;
 
@@ -1368,8 +1370,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",
@@ -1417,7 +1420,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);
@@ -1587,12 +1589,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);
@@ -1897,6 +1905,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;
@@ -1907,33 +1916,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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 151a09e..9a8fbfa 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5


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

* [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init
  2019-03-21 15:02     ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
                         ` (2 preceding siblings ...)
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode Qiming Yang
@ 2019-03-21 15:02       ` Qiming Yang
  2019-03-21 15:02         ` Qiming Yang
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
                         ` (3 subsequent siblings)
  7 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 9ca147f..7d34d63 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 99039d6..1c922b4 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5

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

* [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init Qiming Yang
@ 2019-03-21 15:02         ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 9ca147f..7d34d63 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 99039d6..1c922b4 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5


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

* [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver
  2019-03-21 15:02     ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
                         ` (3 preceding siblings ...)
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init Qiming Yang
@ 2019-03-21 15:02       ` Qiming Yang
  2019-03-21 15:02         ` Qiming Yang
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
                         ` (2 subsequent siblings)
  7 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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(-)

-- 
2.9.5

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

* [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
@ 2019-03-21 15:02         ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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(-)

-- 
2.9.5


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

* [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package
  2019-03-21 15:02     ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
                         ` (4 preceding siblings ...)
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
@ 2019-03-21 15:02       ` Qiming Yang
  2019-03-21 15:02         ` Qiming Yang
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode Qiming Yang
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init Qiming Yang
  7 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 3998d5e..6410ec5 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index b1a7d75..af4300b 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
 
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c468962..bf527ef 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2,12 +2,18 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#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;
@@ -1257,6 +1263,70 @@ 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", pkg_file);
+		return -1;
+	}
+
+	err = stat(pkg_file, &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);
+		err = -1;
+		goto fail_read;
+	}
+
+	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_init_pkg;
+	}
+	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_init_pkg:
+fail_read:
+	rte_free(buf);
+	return err;
+}
+
 static int
 ice_dev_init(struct rte_eth_dev *dev)
 {
@@ -1296,6 +1366,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);
@@ -1341,6 +1417,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);
-- 
2.9.5

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

* [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
@ 2019-03-21 15:02         ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 3998d5e..6410ec5 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index b1a7d75..af4300b 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
 
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c468962..bf527ef 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2,12 +2,18 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#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;
@@ -1257,6 +1263,70 @@ 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", pkg_file);
+		return -1;
+	}
+
+	err = stat(pkg_file, &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);
+		err = -1;
+		goto fail_read;
+	}
+
+	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_init_pkg;
+	}
+	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_init_pkg:
+fail_read:
+	rte_free(buf);
+	return err;
+}
+
 static int
 ice_dev_init(struct rte_eth_dev *dev)
 {
@@ -1296,6 +1366,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);
@@ -1341,6 +1417,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);
-- 
2.9.5


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

* [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode
  2019-03-21 15:02     ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
                         ` (5 preceding siblings ...)
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
@ 2019-03-21 15:02       ` Qiming Yang
  2019-03-21 15:02         ` Qiming Yang
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init Qiming Yang
  7 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(-)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index af4300b..9ca147f 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -105,6 +105,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index bf527ef..99039d6 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1334,6 +1334,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;
 
@@ -1368,8 +1370,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",
@@ -1417,7 +1420,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);
@@ -1587,12 +1589,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);
@@ -1897,6 +1905,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;
@@ -1907,33 +1916,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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 151a09e..9a8fbfa 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5

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

* [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode Qiming Yang
@ 2019-03-21 15:02         ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(-)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index af4300b..9ca147f 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -105,6 +105,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index bf527ef..99039d6 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1334,6 +1334,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;
 
@@ -1368,8 +1370,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",
@@ -1417,7 +1420,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);
@@ -1587,12 +1589,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);
@@ -1897,6 +1905,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;
@@ -1907,33 +1916,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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 151a09e..9a8fbfa 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5


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

* [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init
  2019-03-21 15:02     ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
                         ` (6 preceding siblings ...)
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode Qiming Yang
@ 2019-03-21 15:02       ` Qiming Yang
  2019-03-21 15:02         ` Qiming Yang
  7 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 9ca147f..7d34d63 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 99039d6..1c922b4 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5

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

* [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init Qiming Yang
@ 2019-03-21 15:02         ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-21 15:02 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 9ca147f..7d34d63 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 99039d6..1c922b4 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5


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

* [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
  2019-03-21 15:02         ` Qiming Yang
@ 2019-03-25  2:29         ` Qiming Yang
  2019-03-25  2:29           ` Qiming Yang
                             ` (4 more replies)
  2019-03-25  9:00         ` [dpdk-dev] [PATCH v6 " Qiming Yang
  2 siblings, 5 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  2:29 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

---
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(-)

-- 
2.9.5

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

* [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver
  2019-03-25  2:29         ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Qiming Yang
@ 2019-03-25  2:29           ` Qiming Yang
  2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 1/3] net/ice: load OS default package Qiming Yang
                             ` (3 subsequent siblings)
  4 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  2:29 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

---
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(-)

-- 
2.9.5


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

* [dpdk-dev] [PATCH v5 1/3] net/ice: load OS default package
  2019-03-25  2:29         ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Qiming Yang
  2019-03-25  2:29           ` Qiming Yang
@ 2019-03-25  2:29           ` Qiming Yang
  2019-03-25  2:29             ` Qiming Yang
  2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 2/3] net/ice: add safe mode Qiming Yang
                             ` (2 subsequent siblings)
  4 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  2:29 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 0725669..77b9522 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index d2ec947..5f44fef 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
 
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c468962..bf240c9 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2,12 +2,18 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#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;
@@ -1257,6 +1263,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");
+		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);
+		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)
 {
@@ -1296,6 +1365,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);
@@ -1341,6 +1416,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);
-- 
2.9.5

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

* [dpdk-dev] [PATCH v5 1/3] net/ice: load OS default package
  2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 1/3] net/ice: load OS default package Qiming Yang
@ 2019-03-25  2:29             ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  2:29 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 0725669..77b9522 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index d2ec947..5f44fef 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
 
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c468962..bf240c9 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2,12 +2,18 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#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;
@@ -1257,6 +1263,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");
+		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);
+		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)
 {
@@ -1296,6 +1365,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);
@@ -1341,6 +1416,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);
-- 
2.9.5


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

* [dpdk-dev] [PATCH v5 2/3] net/ice: add safe mode
  2019-03-25  2:29         ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Qiming Yang
  2019-03-25  2:29           ` Qiming Yang
  2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 1/3] net/ice: load OS default package Qiming Yang
@ 2019-03-25  2:29           ` Qiming Yang
  2019-03-25  2:29             ` Qiming Yang
  2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 3/3] net/ice: enable RSS when device init Qiming Yang
  2019-03-25  4:25           ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Stillwell Jr, Paul M
  4 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  2:29 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(-)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 5f44fef..a5a22c9 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -110,6 +110,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index bf240c9..11720de 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1333,6 +1333,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;
 
@@ -1367,8 +1369,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",
@@ -1416,7 +1419,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);
@@ -1586,12 +1588,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);
@@ -1896,6 +1904,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;
@@ -1906,33 +1915,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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 151a09e..9a8fbfa 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5

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

* [dpdk-dev] [PATCH v5 2/3] net/ice: add safe mode
  2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 2/3] net/ice: add safe mode Qiming Yang
@ 2019-03-25  2:29             ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  2:29 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(-)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 5f44fef..a5a22c9 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -110,6 +110,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
+  * Added Safe Mode support.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index bf240c9..11720de 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1333,6 +1333,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;
 
@@ -1367,8 +1369,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",
@@ -1416,7 +1419,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);
@@ -1586,12 +1588,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);
@@ -1896,6 +1904,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;
@@ -1906,33 +1915,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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 151a09e..9a8fbfa 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5


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

* [dpdk-dev] [PATCH v5 3/3] net/ice: enable RSS when device init
  2019-03-25  2:29         ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Qiming Yang
                             ` (2 preceding siblings ...)
  2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 2/3] net/ice: add safe mode Qiming Yang
@ 2019-03-25  2:29           ` Qiming Yang
  2019-03-25  2:29             ` Qiming Yang
  2019-03-25  4:25           ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Stillwell Jr, Paul M
  4 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  2:29 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index a5a22c9..1b2ce57 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 11720de..10a2bcf 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5

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

* [dpdk-dev] [PATCH v5 3/3] net/ice: enable RSS when device init
  2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 3/3] net/ice: enable RSS when device init Qiming Yang
@ 2019-03-25  2:29             ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  2:29 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index a5a22c9..1b2ce57 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 11720de..10a2bcf 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5


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

* Re: [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver
  2019-03-25  2:29         ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Qiming Yang
                             ` (3 preceding siblings ...)
  2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 3/3] net/ice: enable RSS when device init Qiming Yang
@ 2019-03-25  4:25           ` Stillwell Jr, Paul M
  2019-03-25  4:25             ` Stillwell Jr, Paul M
  4 siblings, 1 reply; 65+ messages in thread
From: Stillwell Jr, Paul M @ 2019-03-25  4:25 UTC (permalink / raw)
  To: Yang, Qiming, dev; +Cc: Zhang, Qi Z, Yang, Qiming


> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Qiming Yang
> Sent: Sunday, March 24, 2019 7:30 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> 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(-)
> 
> --
> 2.9.5

Acked-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>

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

* Re: [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver
  2019-03-25  4:25           ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Stillwell Jr, Paul M
@ 2019-03-25  4:25             ` Stillwell Jr, Paul M
  0 siblings, 0 replies; 65+ messages in thread
From: Stillwell Jr, Paul M @ 2019-03-25  4:25 UTC (permalink / raw)
  To: Yang, Qiming, dev; +Cc: Zhang, Qi Z, Yang, Qiming


> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Qiming Yang
> Sent: Sunday, March 24, 2019 7:30 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> 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(-)
> 
> --
> 2.9.5

Acked-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>


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

* [dpdk-dev] [PATCH v6 0/3] enable package download in ice driver
  2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
  2019-03-21 15:02         ` Qiming Yang
  2019-03-25  2:29         ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Qiming Yang
@ 2019-03-25  9:00         ` Qiming Yang
  2019-03-25  9:00           ` Qiming Yang
                             ` (4 more replies)
  2 siblings, 5 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  9:00 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Acked-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>

---
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(-)

-- 
2.9.5

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

* [dpdk-dev] [PATCH v6 0/3] enable package download in ice driver
  2019-03-25  9:00         ` [dpdk-dev] [PATCH v6 " Qiming Yang
@ 2019-03-25  9:00           ` Qiming Yang
  2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 1/3] net/ice: load OS default package Qiming Yang
                             ` (3 subsequent siblings)
  4 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  9:00 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Acked-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>

---
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(-)

-- 
2.9.5


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

* [dpdk-dev] [PATCH v6 1/3] net/ice: load OS default package
  2019-03-25  9:00         ` [dpdk-dev] [PATCH v6 " Qiming Yang
  2019-03-25  9:00           ` Qiming Yang
@ 2019-03-25  9:01           ` Qiming Yang
  2019-03-25  9:01             ` Qiming Yang
  2019-03-25 13:56             ` Zhang, Qi Z
  2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 2/3] net/ice: add safe mode Qiming Yang
                             ` (2 subsequent siblings)
  4 siblings, 2 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  9:01 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 3998d5e..6410ec5 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 61a2c73..b73938a 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -91,6 +91,10 @@ New Features
 
   * Added promiscuous mode support.
 
+* **Updated the ice driver.**
+
+  * Added package download support.
+
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index a23c63a..c2a03c3 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -4,12 +4,19 @@
 
 #include <rte_ethdev_pci.h>
 
+
+#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");
+		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);
+		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:
 	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

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

* [dpdk-dev] [PATCH v6 1/3] net/ice: load OS default package
  2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 1/3] net/ice: load OS default package Qiming Yang
@ 2019-03-25  9:01             ` Qiming Yang
  2019-03-25 13:56             ` Zhang, Qi Z
  1 sibling, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  9:01 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(+)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 3998d5e..6410ec5 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -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
 ~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index 61a2c73..b73938a 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -91,6 +91,10 @@ New Features
 
   * Added promiscuous mode support.
 
+* **Updated the ice driver.**
+
+  * Added package download support.
+
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index a23c63a..c2a03c3 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -4,12 +4,19 @@
 
 #include <rte_ethdev_pci.h>
 
+
+#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");
+		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);
+		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:
 	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


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

* [dpdk-dev] [PATCH v6 2/3] net/ice: add safe mode
  2019-03-25  9:00         ` [dpdk-dev] [PATCH v6 " Qiming Yang
  2019-03-25  9:00           ` Qiming Yang
  2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 1/3] net/ice: load OS default package Qiming Yang
@ 2019-03-25  9:01           ` Qiming Yang
  2019-03-25  9:01             ` Qiming Yang
  2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 3/3] net/ice: enable RSS when device init Qiming Yang
  2019-03-25 14:00           ` [dpdk-dev] [PATCH v6 0/3] enable package download in ice driver Zhang, Qi Z
  4 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  9:01 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(-)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index b73938a..c9267a2 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -94,7 +94,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
-
+  * Added Safe Mode support.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c2a03c3..db4c115 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1336,6 +1336,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;
 
@@ -1370,8 +1372,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",
@@ -1419,7 +1422,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);
@@ -1589,12 +1591,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);
@@ -1898,6 +1906,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;
@@ -1908,33 +1917,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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 3cefa5b..b1f1f79 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5

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

* [dpdk-dev] [PATCH v6 2/3] net/ice: add safe mode
  2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 2/3] net/ice: add safe mode Qiming Yang
@ 2019-03-25  9:01             ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  9:01 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, 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.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 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(-)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index b73938a..c9267a2 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -94,7 +94,7 @@ New Features
 * **Updated the ice driver.**
 
   * Added package download support.
-
+  * Added Safe Mode support.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c2a03c3..db4c115 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1336,6 +1336,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;
 
@@ -1370,8 +1372,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",
@@ -1419,7 +1422,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);
@@ -1589,12 +1591,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);
@@ -1898,6 +1906,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;
@@ -1908,33 +1917,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 = {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 3cefa5b..b1f1f79 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -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 {
-- 
2.9.5


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

* [dpdk-dev] [PATCH v6 3/3] net/ice: enable RSS when device init
  2019-03-25  9:00         ` [dpdk-dev] [PATCH v6 " Qiming Yang
                             ` (2 preceding siblings ...)
  2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 2/3] net/ice: add safe mode Qiming Yang
@ 2019-03-25  9:01           ` Qiming Yang
  2019-03-25  9:01             ` Qiming Yang
  2019-03-25 14:00           ` [dpdk-dev] [PATCH v6 0/3] enable package download in ice driver Zhang, Qi Z
  4 siblings, 1 reply; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  9:01 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index c9267a2..60bc52d 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index db4c115..282e983 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5

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

* [dpdk-dev] [PATCH v6 3/3] net/ice: enable RSS when device init
  2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 3/3] net/ice: enable RSS when device init Qiming Yang
@ 2019-03-25  9:01             ` Qiming Yang
  0 siblings, 0 replies; 65+ messages in thread
From: Qiming Yang @ 2019-03-25  9:01 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

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

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 doc/guides/rel_notes/release_19_05.rst |  1 +
 drivers/net/ice/ice_ethdev.c           | 39 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index c9267a2..60bc52d 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -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
 -------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index db4c115..282e983 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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;
 }
 
-- 
2.9.5


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

* Re: [dpdk-dev] [PATCH v6 1/3] net/ice: load OS default package
  2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 1/3] net/ice: load OS default package Qiming Yang
  2019-03-25  9:01             ` Qiming Yang
@ 2019-03-25 13:56             ` Zhang, Qi Z
  2019-03-25 13:56               ` Zhang, Qi Z
  1 sibling, 1 reply; 65+ messages in thread
From: Zhang, Qi Z @ 2019-03-25 13:56 UTC (permalink / raw)
  To: Yang, Qiming, dev



> -----Original Message-----
> From: Yang, Qiming
> Sent: Monday, March 25, 2019 5:01 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming <qiming.yang@intel.com>
> 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.
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
>  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(+)
> 
> diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index
> 3998d5e..6410ec5 100644
> --- a/doc/guides/nics/ice.rst
> +++ b/doc/guides/nics/ice.rst
> @@ -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
>  ~~~~~~~~~~~~~~~~
> 
> diff --git a/doc/guides/rel_notes/release_19_05.rst
> b/doc/guides/rel_notes/release_19_05.rst
> index 61a2c73..b73938a 100644
> --- a/doc/guides/rel_notes/release_19_05.rst
> +++ b/doc/guides/rel_notes/release_19_05.rst
> @@ -91,6 +91,10 @@ New Features
> 
>    * Added promiscuous mode support.
> 
> +* **Updated the ice driver.**
> +
> +  * Added package download support.
> +
> 
>  Removed Items
>  -------------
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index
> a23c63a..c2a03c3 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -4,12 +4,19 @@
> 
>  #include <rte_ethdev_pci.h>
> 
> +	
Unnecessary empty line.

> +#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");
> +		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.

> +		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:
>  	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

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

* Re: [dpdk-dev] [PATCH v6 1/3] net/ice: load OS default package
  2019-03-25 13:56             ` Zhang, Qi Z
@ 2019-03-25 13:56               ` Zhang, Qi Z
  0 siblings, 0 replies; 65+ messages in thread
From: Zhang, Qi Z @ 2019-03-25 13:56 UTC (permalink / raw)
  To: Yang, Qiming, dev



> -----Original Message-----
> From: Yang, Qiming
> Sent: Monday, March 25, 2019 5:01 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming <qiming.yang@intel.com>
> 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.
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
>  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(+)
> 
> diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index
> 3998d5e..6410ec5 100644
> --- a/doc/guides/nics/ice.rst
> +++ b/doc/guides/nics/ice.rst
> @@ -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
>  ~~~~~~~~~~~~~~~~
> 
> diff --git a/doc/guides/rel_notes/release_19_05.rst
> b/doc/guides/rel_notes/release_19_05.rst
> index 61a2c73..b73938a 100644
> --- a/doc/guides/rel_notes/release_19_05.rst
> +++ b/doc/guides/rel_notes/release_19_05.rst
> @@ -91,6 +91,10 @@ New Features
> 
>    * Added promiscuous mode support.
> 
> +* **Updated the ice driver.**
> +
> +  * Added package download support.
> +
> 
>  Removed Items
>  -------------
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index
> a23c63a..c2a03c3 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -4,12 +4,19 @@
> 
>  #include <rte_ethdev_pci.h>
> 
> +	
Unnecessary empty line.

> +#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");
> +		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.

> +		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:
>  	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


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

* Re: [dpdk-dev] [PATCH v6 0/3] enable package download in ice driver
  2019-03-25  9:00         ` [dpdk-dev] [PATCH v6 " Qiming Yang
                             ` (3 preceding siblings ...)
  2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 3/3] net/ice: enable RSS when device init Qiming Yang
@ 2019-03-25 14:00           ` Zhang, Qi Z
  2019-03-25 14:00             ` Zhang, Qi Z
  4 siblings, 1 reply; 65+ messages in thread
From: Zhang, Qi Z @ 2019-03-25 14:00 UTC (permalink / raw)
  To: Yang, Qiming, dev



> -----Original Message-----
> From: Yang, Qiming
> Sent: Monday, March 25, 2019 5:01 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming <qiming.yang@intel.com>
> 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.
> 
> Acked-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
> 
> ---
> 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(-)
> 
> --
> 2.9.5

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

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

Thanks
Qi

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

* Re: [dpdk-dev] [PATCH v6 0/3] enable package download in ice driver
  2019-03-25 14:00           ` [dpdk-dev] [PATCH v6 0/3] enable package download in ice driver Zhang, Qi Z
@ 2019-03-25 14:00             ` Zhang, Qi Z
  0 siblings, 0 replies; 65+ messages in thread
From: Zhang, Qi Z @ 2019-03-25 14:00 UTC (permalink / raw)
  To: Yang, Qiming, dev



> -----Original Message-----
> From: Yang, Qiming
> Sent: Monday, March 25, 2019 5:01 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming <qiming.yang@intel.com>
> 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.
> 
> Acked-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
> 
> ---
> 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(-)
> 
> --
> 2.9.5

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

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

Thanks
Qi

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

end of thread, other threads:[~2019-03-25 14:00 UTC | newest]

Thread overview: 65+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-01 12:46 [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Qiming Yang
2019-03-01 12:46 ` [dpdk-dev] [PATCH 2/2] net/ice: disable advanced features in safe mode Qiming Yang
2019-03-01 18:38   ` Stephen Hemminger
2019-03-01 20:41   ` Stillwell Jr, Paul M
2019-03-01 13:40 ` [dpdk-dev] [PATCH 1/2] net/ice: suppport package download Thomas Monjalon
2019-03-06  2:36   ` Yang, Qiming
2019-03-01 18:39 ` Stephen Hemminger
2019-03-01 18:40 ` Stephen Hemminger
2019-03-04 17:54 ` Stillwell Jr, Paul M
2019-03-20 15:50 ` [dpdk-dev] [PATCH v2 0/4] enable package download in ice driver Qiming Yang
2019-03-20 15:50   ` Qiming Yang
2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 1/4] net/ice: load OS default package Qiming Yang
2019-03-20 15:50     ` Qiming Yang
2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 2/4] net/ice: add safe mode Qiming Yang
2019-03-20 15:50     ` Qiming Yang
2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 3/4] net/ice: enable RSS when device init Qiming Yang
2019-03-20 15:50     ` Qiming Yang
2019-03-20 15:50   ` [dpdk-dev] [PATCH v2 4/4] doc: add document update for package download Qiming Yang
2019-03-20 15:50     ` Qiming Yang
2019-03-20 17:59   ` [dpdk-dev] [PATCH v3 0/3] enable package download in ice driver Qiming Yang
2019-03-20 17:59     ` Qiming Yang
2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 1/3] net/ice: load OS default package Qiming Yang
2019-03-20 17:59       ` Qiming Yang
2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 2/3] net/ice: add safe mode Qiming Yang
2019-03-20 17:59       ` Qiming Yang
2019-03-20 17:59     ` [dpdk-dev] [PATCH v3 3/3] net/ice: enable RSS when device init Qiming Yang
2019-03-20 17:59       ` Qiming Yang
2019-03-21 15:02     ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
2019-03-21 15:02       ` Qiming Yang
2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
2019-03-21 15:02         ` Qiming Yang
2019-03-25  2:29         ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Qiming Yang
2019-03-25  2:29           ` Qiming Yang
2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 1/3] net/ice: load OS default package Qiming Yang
2019-03-25  2:29             ` Qiming Yang
2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 2/3] net/ice: add safe mode Qiming Yang
2019-03-25  2:29             ` Qiming Yang
2019-03-25  2:29           ` [dpdk-dev] [PATCH v5 3/3] net/ice: enable RSS when device init Qiming Yang
2019-03-25  2:29             ` Qiming Yang
2019-03-25  4:25           ` [dpdk-dev] [PATCH v5 0/3] enable package download in ice driver Stillwell Jr, Paul M
2019-03-25  4:25             ` Stillwell Jr, Paul M
2019-03-25  9:00         ` [dpdk-dev] [PATCH v6 " Qiming Yang
2019-03-25  9:00           ` Qiming Yang
2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 1/3] net/ice: load OS default package Qiming Yang
2019-03-25  9:01             ` Qiming Yang
2019-03-25 13:56             ` Zhang, Qi Z
2019-03-25 13:56               ` Zhang, Qi Z
2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 2/3] net/ice: add safe mode Qiming Yang
2019-03-25  9:01             ` Qiming Yang
2019-03-25  9:01           ` [dpdk-dev] [PATCH v6 3/3] net/ice: enable RSS when device init Qiming Yang
2019-03-25  9:01             ` Qiming Yang
2019-03-25 14:00           ` [dpdk-dev] [PATCH v6 0/3] enable package download in ice driver Zhang, Qi Z
2019-03-25 14:00             ` Zhang, Qi Z
2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode Qiming Yang
2019-03-21 15:02         ` Qiming Yang
2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init Qiming Yang
2019-03-21 15:02         ` Qiming Yang
2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 0/3] enable package download in ice driver Qiming Yang
2019-03-21 15:02         ` Qiming Yang
2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 1/3] net/ice: load OS default package Qiming Yang
2019-03-21 15:02         ` Qiming Yang
2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 2/3] net/ice: add safe mode Qiming Yang
2019-03-21 15:02         ` Qiming Yang
2019-03-21 15:02       ` [dpdk-dev] [PATCH v4 3/3] net/ice: enable RSS when device init Qiming Yang
2019-03-21 15:02         ` Qiming Yang

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