DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v3 1/2] net/ice: remove unused devargs
@ 2019-07-10  4:16 Qi Zhang
  2019-07-10  4:16 ` [dpdk-dev] [PATCH v3 2/2] net/ice: add safe mode support devarg Qi Zhang
  2019-07-10  7:27 ` [dpdk-dev] [PATCH v3 1/2] net/ice: remove unused devargs Yang, Qiming
  0 siblings, 2 replies; 7+ messages in thread
From: Qi Zhang @ 2019-07-10  4:16 UTC (permalink / raw)
  To: qiming.yang, wenzhuo.lu; +Cc: dev, Qi Zhang, stable

Remove devarg "max_queue_pair_num" related code since
it is not complete implemented.

Fixes: f9cf4f864150 ("net/ice: support device initialization")
Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 doc/guides/nics/ice.rst      |  8 ------
 drivers/net/ice/ice_ethdev.c | 66 ++------------------------------------------
 2 files changed, 3 insertions(+), 71 deletions(-)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 666b1b272..e9b3a48bc 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -49,14 +49,6 @@ Please note that enabling debugging options may affect system performance.
 Runtime Config Options
 ~~~~~~~~~~~~~~~~~~~~~~
 
-- ``Maximum Number of Queue Pairs``
-
-  The maximum number of queue pairs is decided by HW. If not configured, APP
-  uses the number from HW. Users can check the number by calling the API
-  ``rte_eth_dev_info_get``.
-  If users want to limit the number of queues, they can set a smaller number
-  using EAL parameter like ``max_queue_pair_num=n``.
-
 
 Driver compilation and testing
 ------------------------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 9ce730cd4..4b5cd8269 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -17,7 +17,6 @@
 #include "ice_rxtx.h"
 #include "ice_switch_filter.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"
 
@@ -251,59 +250,6 @@ ice_init_controlq_parameter(struct ice_hw *hw)
 }
 
 static int
-ice_check_qp_num(const char *key, const char *qp_value,
-		 __rte_unused void *opaque)
-{
-	char *end = NULL;
-	int num = 0;
-
-	while (isblank(*qp_value))
-		qp_value++;
-
-	num = strtoul(qp_value, &end, 10);
-
-	if (!num || (*end == '-') || errno) {
-		PMD_DRV_LOG(WARNING, "invalid value:\"%s\" for key:\"%s\", "
-			    "value must be > 0",
-			    qp_value, key);
-		return -1;
-	}
-
-	return num;
-}
-
-static int
-ice_config_max_queue_pair_num(struct rte_devargs *devargs)
-{
-	struct rte_kvargs *kvlist;
-	const char *queue_num_key = ICE_MAX_QP_NUM;
-	int ret;
-
-	if (!devargs)
-		return 0;
-
-	kvlist = rte_kvargs_parse(devargs->args, NULL);
-	if (!kvlist)
-		return 0;
-
-	if (!rte_kvargs_count(kvlist, queue_num_key)) {
-		rte_kvargs_free(kvlist);
-		return 0;
-	}
-
-	if (rte_kvargs_process(kvlist, queue_num_key,
-			       ice_check_qp_num, NULL) < 0) {
-		rte_kvargs_free(kvlist);
-		return 0;
-	}
-	ret = rte_kvargs_process(kvlist, queue_num_key,
-				 ice_check_qp_num, NULL);
-	rte_kvargs_free(kvlist);
-
-	return ret;
-}
-
-static int
 ice_res_pool_init(struct ice_res_pool_info *pool, uint32_t base,
 		  uint32_t num)
 {
@@ -1128,13 +1074,9 @@ ice_pf_sw_init(struct rte_eth_dev *dev)
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
 
-	if (ice_config_max_queue_pair_num(dev->device->devargs) > 0)
-		pf->lan_nb_qp_max =
-			ice_config_max_queue_pair_num(dev->device->devargs);
-	else
-		pf->lan_nb_qp_max =
-			(uint16_t)RTE_MIN(hw->func_caps.common_cap.num_txq,
-					  hw->func_caps.common_cap.num_rxq);
+	pf->lan_nb_qp_max =
+		(uint16_t)RTE_MIN(hw->func_caps.common_cap.num_txq,
+				  hw->func_caps.common_cap.num_rxq);
 
 	pf->lan_nb_qps = pf->lan_nb_qp_max;
 
@@ -3751,8 +3693,6 @@ static struct rte_pci_driver rte_ice_pmd = {
 RTE_PMD_REGISTER_PCI(net_ice, rte_ice_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_ice, pci_id_ice_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_ice, "* igb_uio | uio_pci_generic | vfio-pci");
-RTE_PMD_REGISTER_PARAM_STRING(net_ice,
-			      ICE_MAX_QP_NUM "=<int>");
 
 RTE_INIT(ice_init_log)
 {
-- 
2.13.6


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

* [dpdk-dev] [PATCH v3 2/2] net/ice: add safe mode support devarg
  2019-07-10  4:16 [dpdk-dev] [PATCH v3 1/2] net/ice: remove unused devargs Qi Zhang
@ 2019-07-10  4:16 ` Qi Zhang
  2019-07-10  7:29   ` Yang, Qiming
  2019-07-10  9:46   ` Ray Kinsella
  2019-07-10  7:27 ` [dpdk-dev] [PATCH v3 1/2] net/ice: remove unused devargs Yang, Qiming
  1 sibling, 2 replies; 7+ messages in thread
From: Qi Zhang @ 2019-07-10  4:16 UTC (permalink / raw)
  To: qiming.yang, wenzhuo.lu; +Cc: dev, Qi Zhang

Safe mode support is not necessary by default.
Driver be initialized without OS package silently may confuse users
since most advanced feature are disabled.
Add devarg for safe mode enabling only for when user intend to do this.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
-v3:
  fix wrong logic in parse_bool.

-v2:
  fix missing return value check from ice_parse_devargs.
  minor document update.

 doc/guides/nics/ice.rst      | 11 +++++++
 drivers/net/ice/ice_ethdev.c | 68 +++++++++++++++++++++++++++++++++++++++++++-
 drivers/net/ice/ice_ethdev.h |  8 ++++++
 3 files changed, 86 insertions(+), 1 deletion(-)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index e9b3a48bc..03819d29f 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -49,6 +49,17 @@ Please note that enabling debugging options may affect system performance.
 Runtime Config Options
 ~~~~~~~~~~~~~~~~~~~~~~
 
+- ``Safe Mode Support`` (default ``0``)
+
+  If driver failed to load OS package, by default driver's initialization failed.
+  But if user intend to use the device without OS package, user can take ``devargs``
+  parameter ``safe-mode-support``, for example::
+
+    -w 80:00.0,safe-mode-support=1
+
+  Then the driver will be initialized successfully and the device will enter Safe Mode.
+  NOTE: In Safe mode, only very limited features are available, features like RSS,
+  checksum, fdir, tunneling ... are all disabled.
 
 Driver compilation and testing
 ------------------------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 4b5cd8269..a7cbe0848 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -17,6 +17,14 @@
 #include "ice_rxtx.h"
 #include "ice_switch_filter.h"
 
+/* devargs */
+#define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support"
+
+static const char * const ice_valid_args[] = {
+	ICE_SAFE_MODE_SUPPORT_ARG,
+	NULL
+};
+
 #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"
 
@@ -1334,6 +1342,50 @@ ice_base_queue_get(struct ice_pf *pf)
 }
 
 static int
+parse_bool(const char *key, const char *value, void *args)
+{
+	int *i = (int *)args;
+	char *end;
+	int num;
+
+	num = strtoul(value, &end, 10);
+
+	if (num != 0 && num != 1) {
+		PMD_DRV_LOG(WARNING, "invalid value:\"%s\" for key:\"%s\", "
+			"value must be 0 or 1",
+			value, key);
+		return -1;
+	}
+
+	*i = num;
+	return 0;
+}
+
+static int ice_parse_devargs(struct rte_eth_dev *dev)
+{
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	struct rte_devargs *devargs = dev->device->devargs;
+	struct rte_kvargs *kvlist;
+	int ret;
+
+	if (devargs == NULL)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, ice_valid_args);
+	if (kvlist == NULL) {
+		PMD_INIT_LOG(ERR, "Invalid kvargs key\n");
+		return -EINVAL;
+	}
+
+	ret = rte_kvargs_process(kvlist, ICE_SAFE_MODE_SUPPORT_ARG,
+				 &parse_bool, &ad->devargs.safe_mode_support);
+
+	rte_kvargs_free(kvlist);
+	return ret;
+}
+
+static int
 ice_dev_init(struct rte_eth_dev *dev)
 {
 	struct rte_pci_device *pci_dev;
@@ -1366,6 +1418,12 @@ ice_dev_init(struct rte_eth_dev *dev)
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 
+	ret = ice_parse_devargs(dev);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to parse devargs");
+		return -EINVAL;
+	}
+
 	ice_init_controlq_parameter(hw);
 
 	ret = ice_init_hw(hw);
@@ -1376,8 +1434,14 @@ ice_dev_init(struct rte_eth_dev *dev)
 
 	ret = ice_load_pkg(dev);
 	if (ret) {
+		if (ad->devargs.safe_mode_support == 0) {
+			PMD_INIT_LOG(ERR, "Failed to load the DDP package,"
+					"Use safe-mode-support=1 to enter Safe Mode");
+			return ret;
+		}
+
 		PMD_INIT_LOG(WARNING, "Failed to load the DDP package,"
-				"Entering Safe Mode");
+					"Entering Safe Mode");
 		ad->is_safe_mode = 1;
 	}
 
@@ -3693,6 +3757,8 @@ static struct rte_pci_driver rte_ice_pmd = {
 RTE_PMD_REGISTER_PCI(net_ice, rte_ice_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_ice, pci_id_ice_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_ice, "* igb_uio | uio_pci_generic | vfio-pci");
+RTE_PMD_REGISTER_PARAM_STRING(net_ice,
+			      ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>");
 
 RTE_INIT(ice_init_log)
 {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 8a52239f5..f569da833 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -274,6 +274,13 @@ struct ice_pf {
 };
 
 /**
+ * Cache devargs parse result.
+ */
+struct ice_devargs {
+	int safe_mode_support;
+};
+
+/**
  * Structure to store private data for each PF/VF instance.
  */
 struct ice_adapter {
@@ -286,6 +293,7 @@ struct ice_adapter {
 	/* ptype mapping table */
 	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
 	bool is_safe_mode;
+	struct ice_devargs devargs;
 };
 
 struct ice_vsi_vlan_pvid_info {
-- 
2.13.6


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

* Re: [dpdk-dev] [PATCH v3 1/2] net/ice: remove unused devargs
  2019-07-10  4:16 [dpdk-dev] [PATCH v3 1/2] net/ice: remove unused devargs Qi Zhang
  2019-07-10  4:16 ` [dpdk-dev] [PATCH v3 2/2] net/ice: add safe mode support devarg Qi Zhang
@ 2019-07-10  7:27 ` Yang, Qiming
  2019-07-11  4:43   ` Zhang, Qi Z
  1 sibling, 1 reply; 7+ messages in thread
From: Yang, Qiming @ 2019-07-10  7:27 UTC (permalink / raw)
  To: Zhang, Qi Z, Lu, Wenzhuo; +Cc: dev, stable


-----Original Message-----
From: Zhang, Qi Z 
Sent: Wednesday, July 10, 2019 12:16 PM
To: Yang, Qiming <qiming.yang@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>
Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; stable@dpdk.org
Subject: [PATCH v3 1/2] net/ice: remove unused devargs

Remove devarg "max_queue_pair_num" related code since it is not complete implemented.

Fixes: f9cf4f864150 ("net/ice: support device initialization")
Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 doc/guides/nics/ice.rst      |  8 ------
 drivers/net/ice/ice_ethdev.c | 66 ++------------------------------------------
 2 files changed, 3 insertions(+), 71 deletions(-)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index 666b1b272..e9b3a48bc 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -49,14 +49,6 @@ Please note that enabling debugging options may affect system performance.
 Runtime Config Options
 ~~~~~~~~~~~~~~~~~~~~~~
 
-- ``Maximum Number of Queue Pairs``
-
-  The maximum number of queue pairs is decided by HW. If not configured, APP
-  uses the number from HW. Users can check the number by calling the API
-  ``rte_eth_dev_info_get``.
-  If users want to limit the number of queues, they can set a smaller number
-  using EAL parameter like ``max_queue_pair_num=n``.
-
 
 Driver compilation and testing
 ------------------------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 9ce730cd4..4b5cd8269 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -17,7 +17,6 @@
 #include "ice_rxtx.h"
 #include "ice_switch_filter.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"
 
@@ -251,59 +250,6 @@ ice_init_controlq_parameter(struct ice_hw *hw)  }
 
 static int
-ice_check_qp_num(const char *key, const char *qp_value,
-		 __rte_unused void *opaque)
-{
-	char *end = NULL;
-	int num = 0;
-
-	while (isblank(*qp_value))
-		qp_value++;
-
-	num = strtoul(qp_value, &end, 10);
-
-	if (!num || (*end == '-') || errno) {
-		PMD_DRV_LOG(WARNING, "invalid value:\"%s\" for key:\"%s\", "
-			    "value must be > 0",
-			    qp_value, key);
-		return -1;
-	}
-
-	return num;
-}
-
-static int
-ice_config_max_queue_pair_num(struct rte_devargs *devargs) -{
-	struct rte_kvargs *kvlist;
-	const char *queue_num_key = ICE_MAX_QP_NUM;
-	int ret;
-
-	if (!devargs)
-		return 0;
-
-	kvlist = rte_kvargs_parse(devargs->args, NULL);
-	if (!kvlist)
-		return 0;
-
-	if (!rte_kvargs_count(kvlist, queue_num_key)) {
-		rte_kvargs_free(kvlist);
-		return 0;
-	}
-
-	if (rte_kvargs_process(kvlist, queue_num_key,
-			       ice_check_qp_num, NULL) < 0) {
-		rte_kvargs_free(kvlist);
-		return 0;
-	}
-	ret = rte_kvargs_process(kvlist, queue_num_key,
-				 ice_check_qp_num, NULL);
-	rte_kvargs_free(kvlist);
-
-	return ret;
-}
-
-static int
 ice_res_pool_init(struct ice_res_pool_info *pool, uint32_t base,
 		  uint32_t num)
 {
@@ -1128,13 +1074,9 @@ ice_pf_sw_init(struct rte_eth_dev *dev)
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
 
-	if (ice_config_max_queue_pair_num(dev->device->devargs) > 0)
-		pf->lan_nb_qp_max =
-			ice_config_max_queue_pair_num(dev->device->devargs);
-	else
-		pf->lan_nb_qp_max =
-			(uint16_t)RTE_MIN(hw->func_caps.common_cap.num_txq,
-					  hw->func_caps.common_cap.num_rxq);
+	pf->lan_nb_qp_max =
+		(uint16_t)RTE_MIN(hw->func_caps.common_cap.num_txq,
+				  hw->func_caps.common_cap.num_rxq);
 
 	pf->lan_nb_qps = pf->lan_nb_qp_max;
 
@@ -3751,8 +3693,6 @@ static struct rte_pci_driver rte_ice_pmd = {  RTE_PMD_REGISTER_PCI(net_ice, rte_ice_pmd);  RTE_PMD_REGISTER_PCI_TABLE(net_ice, pci_id_ice_map);  RTE_PMD_REGISTER_KMOD_DEP(net_ice, "* igb_uio | uio_pci_generic | vfio-pci"); -RTE_PMD_REGISTER_PARAM_STRING(net_ice,
-			      ICE_MAX_QP_NUM "=<int>");
 
 RTE_INIT(ice_init_log)
 {
--
2.13.6

Acked-by: Qiming Yang <qiming.yang@intel.com>

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

* Re: [dpdk-dev] [PATCH v3 2/2] net/ice: add safe mode support devarg
  2019-07-10  4:16 ` [dpdk-dev] [PATCH v3 2/2] net/ice: add safe mode support devarg Qi Zhang
@ 2019-07-10  7:29   ` Yang, Qiming
  2019-07-11  4:45     ` Zhang, Qi Z
  2019-07-10  9:46   ` Ray Kinsella
  1 sibling, 1 reply; 7+ messages in thread
From: Yang, Qiming @ 2019-07-10  7:29 UTC (permalink / raw)
  To: Zhang, Qi Z, Lu, Wenzhuo; +Cc: dev



-----Original Message-----
From: Zhang, Qi Z 
Sent: Wednesday, July 10, 2019 12:17 PM
To: Yang, Qiming <qiming.yang@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>
Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
Subject: [PATCH v3 2/2] net/ice: add safe mode support devarg

Safe mode support is not necessary by default.
Driver be initialized without OS package silently may confuse users since most advanced feature are disabled.
Add devarg for safe mode enabling only for when user intend to do this.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
-v3:
  fix wrong logic in parse_bool.

-v2:
  fix missing return value check from ice_parse_devargs.
  minor document update.

 doc/guides/nics/ice.rst      | 11 +++++++
 drivers/net/ice/ice_ethdev.c | 68 +++++++++++++++++++++++++++++++++++++++++++-
 drivers/net/ice/ice_ethdev.h |  8 ++++++
 3 files changed, 86 insertions(+), 1 deletion(-)

diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index e9b3a48bc..03819d29f 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -49,6 +49,17 @@ Please note that enabling debugging options may affect system performance.
 Runtime Config Options
 ~~~~~~~~~~~~~~~~~~~~~~
 
+- ``Safe Mode Support`` (default ``0``)
+
+  If driver failed to load OS package, by default driver's initialization failed.
+  But if user intend to use the device without OS package, user can 
+ take ``devargs``  parameter ``safe-mode-support``, for example::
+
+    -w 80:00.0,safe-mode-support=1
+
+  Then the driver will be initialized successfully and the device will enter Safe Mode.
+  NOTE: In Safe mode, only very limited features are available, 
+ features like RSS,  checksum, fdir, tunneling ... are all disabled.
 
 Driver compilation and testing
 ------------------------------
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 4b5cd8269..a7cbe0848 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -17,6 +17,14 @@
 #include "ice_rxtx.h"
 #include "ice_switch_filter.h"
 
+/* devargs */
+#define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support"
+
+static const char * const ice_valid_args[] = {
+	ICE_SAFE_MODE_SUPPORT_ARG,
+	NULL
+};
+
 #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"
 
@@ -1334,6 +1342,50 @@ ice_base_queue_get(struct ice_pf *pf)  }
 
 static int
+parse_bool(const char *key, const char *value, void *args) {
+	int *i = (int *)args;
+	char *end;
+	int num;
+
+	num = strtoul(value, &end, 10);
+
+	if (num != 0 && num != 1) {
+		PMD_DRV_LOG(WARNING, "invalid value:\"%s\" for key:\"%s\", "
+			"value must be 0 or 1",
+			value, key);
+		return -1;
+	}
+
+	*i = num;
+	return 0;
+}
+
+static int ice_parse_devargs(struct rte_eth_dev *dev) {
+	struct ice_adapter *ad =
+		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	struct rte_devargs *devargs = dev->device->devargs;
+	struct rte_kvargs *kvlist;
+	int ret;
+
+	if (devargs == NULL)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, ice_valid_args);
+	if (kvlist == NULL) {
+		PMD_INIT_LOG(ERR, "Invalid kvargs key\n");
+		return -EINVAL;
+	}
+
+	ret = rte_kvargs_process(kvlist, ICE_SAFE_MODE_SUPPORT_ARG,
+				 &parse_bool, &ad->devargs.safe_mode_support);
+
+	rte_kvargs_free(kvlist);
+	return ret;
+}
+
+static int
 ice_dev_init(struct rte_eth_dev *dev)
 {
 	struct rte_pci_device *pci_dev;
@@ -1366,6 +1418,12 @@ ice_dev_init(struct rte_eth_dev *dev)
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 
+	ret = ice_parse_devargs(dev);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to parse devargs");
+		return -EINVAL;
+	}
+
 	ice_init_controlq_parameter(hw);
 
 	ret = ice_init_hw(hw);
@@ -1376,8 +1434,14 @@ ice_dev_init(struct rte_eth_dev *dev)
 
 	ret = ice_load_pkg(dev);
 	if (ret) {
+		if (ad->devargs.safe_mode_support == 0) {
+			PMD_INIT_LOG(ERR, "Failed to load the DDP package,"
+					"Use safe-mode-support=1 to enter Safe Mode");
+			return ret;
+		}
+
 		PMD_INIT_LOG(WARNING, "Failed to load the DDP package,"
-				"Entering Safe Mode");
+					"Entering Safe Mode");
 		ad->is_safe_mode = 1;
 	}
 
@@ -3693,6 +3757,8 @@ static struct rte_pci_driver rte_ice_pmd = {  RTE_PMD_REGISTER_PCI(net_ice, rte_ice_pmd);  RTE_PMD_REGISTER_PCI_TABLE(net_ice, pci_id_ice_map);  RTE_PMD_REGISTER_KMOD_DEP(net_ice, "* igb_uio | uio_pci_generic | vfio-pci");
+RTE_PMD_REGISTER_PARAM_STRING(net_ice,
+			      ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>");
 
 RTE_INIT(ice_init_log)
 {
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 8a52239f5..f569da833 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -274,6 +274,13 @@ struct ice_pf {
 };
 
 /**
+ * Cache devargs parse result.
+ */
+struct ice_devargs {
+	int safe_mode_support;
+};
+
+/**
  * Structure to store private data for each PF/VF instance.
  */
 struct ice_adapter {
@@ -286,6 +293,7 @@ struct ice_adapter {
 	/* ptype mapping table */
 	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
 	bool is_safe_mode;
+	struct ice_devargs devargs;
 };
 
 struct ice_vsi_vlan_pvid_info {
--
2.13.6

Acked-by: Qiming Yang <qiming.yang@intel.com>

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

* Re: [dpdk-dev] [PATCH v3 2/2] net/ice: add safe mode support devarg
  2019-07-10  4:16 ` [dpdk-dev] [PATCH v3 2/2] net/ice: add safe mode support devarg Qi Zhang
  2019-07-10  7:29   ` Yang, Qiming
@ 2019-07-10  9:46   ` Ray Kinsella
  1 sibling, 0 replies; 7+ messages in thread
From: Ray Kinsella @ 2019-07-10  9:46 UTC (permalink / raw)
  To: Qi Zhang, qiming.yang, wenzhuo.lu; +Cc: dev

Acked-by: Ray Kinsella <mdr@ashroe.eu>

On 10/07/2019 05:16, Qi Zhang wrote:
> Safe mode support is not necessary by default.
> Driver be initialized without OS package silently may confuse users
> since most advanced feature are disabled.
> Add devarg for safe mode enabling only for when user intend to do this.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
> -v3:
>   fix wrong logic in parse_bool.
> 
> -v2:
>   fix missing return value check from ice_parse_devargs.
>   minor document update.
> 
>  doc/guides/nics/ice.rst      | 11 +++++++
>  drivers/net/ice/ice_ethdev.c | 68 +++++++++++++++++++++++++++++++++++++++++++-
>  drivers/net/ice/ice_ethdev.h |  8 ++++++
>  3 files changed, 86 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
> index e9b3a48bc..03819d29f 100644
> --- a/doc/guides/nics/ice.rst
> +++ b/doc/guides/nics/ice.rst
> @@ -49,6 +49,17 @@ Please note that enabling debugging options may affect system performance.
>  Runtime Config Options
>  ~~~~~~~~~~~~~~~~~~~~~~
>  
> +- ``Safe Mode Support`` (default ``0``)
> +
> +  If driver failed to load OS package, by default driver's initialization failed.
> +  But if user intend to use the device without OS package, user can take ``devargs``
> +  parameter ``safe-mode-support``, for example::
> +
> +    -w 80:00.0,safe-mode-support=1
> +
> +  Then the driver will be initialized successfully and the device will enter Safe Mode.
> +  NOTE: In Safe mode, only very limited features are available, features like RSS,
> +  checksum, fdir, tunneling ... are all disabled.
>  
>  Driver compilation and testing
>  ------------------------------
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
> index 4b5cd8269..a7cbe0848 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -17,6 +17,14 @@
>  #include "ice_rxtx.h"
>  #include "ice_switch_filter.h"
>  
> +/* devargs */
> +#define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support"
> +
> +static const char * const ice_valid_args[] = {
> +	ICE_SAFE_MODE_SUPPORT_ARG,
> +	NULL
> +};
> +
>  #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"
>  
> @@ -1334,6 +1342,50 @@ ice_base_queue_get(struct ice_pf *pf)
>  }
>  
>  static int
> +parse_bool(const char *key, const char *value, void *args)
> +{
> +	int *i = (int *)args;
> +	char *end;
> +	int num;
> +
> +	num = strtoul(value, &end, 10);
> +
> +	if (num != 0 && num != 1) {
> +		PMD_DRV_LOG(WARNING, "invalid value:\"%s\" for key:\"%s\", "
> +			"value must be 0 or 1",
> +			value, key);
> +		return -1;
> +	}
> +
> +	*i = num;
> +	return 0;
> +}
> +
> +static int ice_parse_devargs(struct rte_eth_dev *dev)
> +{
> +	struct ice_adapter *ad =
> +		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> +	struct rte_devargs *devargs = dev->device->devargs;
> +	struct rte_kvargs *kvlist;
> +	int ret;
> +
> +	if (devargs == NULL)
> +		return 0;
> +
> +	kvlist = rte_kvargs_parse(devargs->args, ice_valid_args);
> +	if (kvlist == NULL) {
> +		PMD_INIT_LOG(ERR, "Invalid kvargs key\n");
> +		return -EINVAL;
> +	}
> +
> +	ret = rte_kvargs_process(kvlist, ICE_SAFE_MODE_SUPPORT_ARG,
> +				 &parse_bool, &ad->devargs.safe_mode_support);
> +
> +	rte_kvargs_free(kvlist);
> +	return ret;
> +}
> +
> +static int
>  ice_dev_init(struct rte_eth_dev *dev)
>  {
>  	struct rte_pci_device *pci_dev;
> @@ -1366,6 +1418,12 @@ ice_dev_init(struct rte_eth_dev *dev)
>  	hw->bus.device = pci_dev->addr.devid;
>  	hw->bus.func = pci_dev->addr.function;
>  
> +	ret = ice_parse_devargs(dev);
> +	if (ret) {
> +		PMD_INIT_LOG(ERR, "Failed to parse devargs");
> +		return -EINVAL;
> +	}
> +
>  	ice_init_controlq_parameter(hw);
>  
>  	ret = ice_init_hw(hw);
> @@ -1376,8 +1434,14 @@ ice_dev_init(struct rte_eth_dev *dev)
>  
>  	ret = ice_load_pkg(dev);
>  	if (ret) {
> +		if (ad->devargs.safe_mode_support == 0) {
> +			PMD_INIT_LOG(ERR, "Failed to load the DDP package,"
> +					"Use safe-mode-support=1 to enter Safe Mode");
> +			return ret;
> +		}
> +
>  		PMD_INIT_LOG(WARNING, "Failed to load the DDP package,"
> -				"Entering Safe Mode");
> +					"Entering Safe Mode");
>  		ad->is_safe_mode = 1;
>  	}
>  
> @@ -3693,6 +3757,8 @@ static struct rte_pci_driver rte_ice_pmd = {
>  RTE_PMD_REGISTER_PCI(net_ice, rte_ice_pmd);
>  RTE_PMD_REGISTER_PCI_TABLE(net_ice, pci_id_ice_map);
>  RTE_PMD_REGISTER_KMOD_DEP(net_ice, "* igb_uio | uio_pci_generic | vfio-pci");
> +RTE_PMD_REGISTER_PARAM_STRING(net_ice,
> +			      ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>");
>  
>  RTE_INIT(ice_init_log)
>  {
> diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
> index 8a52239f5..f569da833 100644
> --- a/drivers/net/ice/ice_ethdev.h
> +++ b/drivers/net/ice/ice_ethdev.h
> @@ -274,6 +274,13 @@ struct ice_pf {
>  };
>  
>  /**
> + * Cache devargs parse result.
> + */
> +struct ice_devargs {
> +	int safe_mode_support;
> +};
> +
> +/**
>   * Structure to store private data for each PF/VF instance.
>   */
>  struct ice_adapter {
> @@ -286,6 +293,7 @@ struct ice_adapter {
>  	/* ptype mapping table */
>  	uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;
>  	bool is_safe_mode;
> +	struct ice_devargs devargs;
>  };
>  
>  struct ice_vsi_vlan_pvid_info {
> 

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

* Re: [dpdk-dev] [PATCH v3 1/2] net/ice: remove unused devargs
  2019-07-10  7:27 ` [dpdk-dev] [PATCH v3 1/2] net/ice: remove unused devargs Yang, Qiming
@ 2019-07-11  4:43   ` Zhang, Qi Z
  0 siblings, 0 replies; 7+ messages in thread
From: Zhang, Qi Z @ 2019-07-11  4:43 UTC (permalink / raw)
  To: Yang, Qiming, Lu, Wenzhuo; +Cc: dev



> -----Original Message-----
> From: Yang, Qiming
> Sent: Wednesday, July 10, 2019 3:28 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH v3 1/2] net/ice: remove unused devargs
> 
> 
> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, July 10, 2019 12:16 PM
> To: Yang, Qiming <qiming.yang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; stable@dpdk.org
> Subject: [PATCH v3 1/2] net/ice: remove unused devargs
> 
> Remove devarg "max_queue_pair_num" related code since it is not complete
> implemented.
> 
> Fixes: f9cf4f864150 ("net/ice: support device initialization")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
> 
> Acked-by: Qiming Yang <qiming.yang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

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

* Re: [dpdk-dev] [PATCH v3 2/2] net/ice: add safe mode support devarg
  2019-07-10  7:29   ` Yang, Qiming
@ 2019-07-11  4:45     ` Zhang, Qi Z
  0 siblings, 0 replies; 7+ messages in thread
From: Zhang, Qi Z @ 2019-07-11  4:45 UTC (permalink / raw)
  To: Yang, Qiming, Lu, Wenzhuo; +Cc: dev, Kinsella, Ray



> -----Original Message-----
> From: Yang, Qiming
> Sent: Wednesday, July 10, 2019 3:29 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH v3 2/2] net/ice: add safe mode support devarg
> 
> 
> 
> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, July 10, 2019 12:17 PM
> To: Yang, Qiming <qiming.yang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH v3 2/2] net/ice: add safe mode support devarg
> 
> Safe mode support is not necessary by default.
> Driver be initialized without OS package silently may confuse users since most
> advanced feature are disabled.
> Add devarg for safe mode enabling only for when user intend to do this.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
....

> Acked-by: Qiming Yang <qiming.yang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

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

end of thread, other threads:[~2019-07-11  4:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10  4:16 [dpdk-dev] [PATCH v3 1/2] net/ice: remove unused devargs Qi Zhang
2019-07-10  4:16 ` [dpdk-dev] [PATCH v3 2/2] net/ice: add safe mode support devarg Qi Zhang
2019-07-10  7:29   ` Yang, Qiming
2019-07-11  4:45     ` Zhang, Qi Z
2019-07-10  9:46   ` Ray Kinsella
2019-07-10  7:27 ` [dpdk-dev] [PATCH v3 1/2] net/ice: remove unused devargs Yang, Qiming
2019-07-11  4:43   ` Zhang, Qi Z

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