summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQi Zhang <qi.z.zhang@intel.com>2019-07-10 12:16:30 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2019-07-23 14:31:34 +0200
commit603beeb970b5d87fa740fb66c25de6e5dbd0aaf1 (patch)
tree7ab4b30703f48bd7688891c42193023e5a54868b
parente732b7f5393f4b8225ab460c58dafb858a38a52c (diff)
downloaddpdk-603beeb970b5d87fa740fb66c25de6e5dbd0aaf1.zip
dpdk-603beeb970b5d87fa740fb66c25de6e5dbd0aaf1.tar.gz
dpdk-603beeb970b5d87fa740fb66c25de6e5dbd0aaf1.tar.xz
net/ice: add safe mode devarg
When OS package is not provided driver silently goes into safe mode, since safe mode is missing most of advanced features, this may confuse the users. Instead of going into safe mode silently, add devarg for safe mode enabling only for users that are asking for it. Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> Acked-by: Qiming Yang <qiming.yang@intel.com> Acked-by: Ray Kinsella <ray.kinsella@intel.com>
-rw-r--r--doc/guides/nics/ice.rst11
-rw-r--r--drivers/net/ice/ice_ethdev.c68
-rw-r--r--drivers/net/ice/ice_ethdev.h8
3 files changed, 86 insertions, 1 deletions
diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index e9b3a48..03819d2 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 4190824..573a19d 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;
}
@@ -3692,6 +3756,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 8a52239..f569da8 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 {