From patchwork Thu May 16 04:28:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ergin, Mesut A" X-Patchwork-Id: 53459 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6517A5920; Thu, 16 May 2019 06:28:29 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 657912F7D for ; Thu, 16 May 2019 06:28:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 May 2019 21:28:23 -0700 X-ExtLoop1: 1 Received: from skx-pink.jf.intel.com ([10.54.80.236]) by orsmga001.jf.intel.com with ESMTP; 15 May 2019 21:28:23 -0700 From: Mesut Ali Ergin To: beilei.xing@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org, Mesut Ali Ergin Date: Wed, 15 May 2019 21:28:03 -0700 Message-Id: <1557980885-183777-2-git-send-email-mesut.a.ergin@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557980885-183777-1-git-send-email-mesut.a.ergin@intel.com> References: <1557980885-183777-1-git-send-email-mesut.a.ergin@intel.com> Subject: [dpdk-dev] [PATCH 1/3] net/i40e: add support for MARK + RSS action in rte_flow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Currently, i40e Flow Director action parser only allows following nine action combinations: (QUEUE, PASSTHRU, DROP, QUEUE + MARK, PASSTHRU + MARK, DROP + MARK, QUEUE + FLAG, PASSTHRU + FLAG, DROP + FLAG) Using the existing Cloud Filter profile on the NIC, it is possible to add support for two more combinations as: (MARK + RSS, MARK + FLAG + RSS) Addition of these new combinations would allow more applications to utilize DPDK rte_flow to implement hardware flow offloads with Intel Ethernet 700 series network adapters, including but not limited to the existing OVS DPDK partial hardware flow offload feature. Signed-off-by: Mesut Ali Ergin Acked-by: Qi Zhang --- drivers/net/i40e/i40e_flow.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 5447e4e..d4d564f 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -3078,6 +3078,12 @@ i40e_flow_parse_fdir_action(struct rte_eth_dev *dev, case RTE_FLOW_ACTION_TYPE_PASSTHRU: filter->action.behavior = I40E_FDIR_PASSTHRU; break; + case RTE_FLOW_ACTION_TYPE_MARK: + filter->action.behavior = I40E_FDIR_PASSTHRU; + mark_spec = act->conf; + filter->action.report_status = I40E_FDIR_REPORT_ID; + filter->soft_id = mark_spec->id; + break; default: rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, act, @@ -3090,13 +3096,36 @@ i40e_flow_parse_fdir_action(struct rte_eth_dev *dev, NEXT_ITEM_OF_ACTION(act, actions, index); switch (act->type) { case RTE_FLOW_ACTION_TYPE_MARK: + if (!mark_spec) { + /* Double MARK actions requested */ + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, act, + "Invalid action."); + return -rte_errno; + } mark_spec = act->conf; filter->action.report_status = I40E_FDIR_REPORT_ID; filter->soft_id = mark_spec->id; break; case RTE_FLOW_ACTION_TYPE_FLAG: + if (!mark_spec) { + /* MARK + FLAG not supported */ + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, act, + "Invalid action."); + return -rte_errno; + } filter->action.report_status = I40E_FDIR_NO_REPORT_STATUS; break; + case RTE_FLOW_ACTION_TYPE_RSS: + if (filter->action.behavior != I40E_FDIR_PASSTHRU) { + /* RSS filter won't be next if FDIR did not pass thru */ + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, act, + "Invalid action."); + return -rte_errno; + } + break; case RTE_FLOW_ACTION_TYPE_END: return 0; default: From patchwork Thu May 16 04:28:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ergin, Mesut A" X-Patchwork-Id: 53460 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 732CA5B2A; Thu, 16 May 2019 06:28:31 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 087B62F7D for ; Thu, 16 May 2019 06:28:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 May 2019 21:28:23 -0700 X-ExtLoop1: 1 Received: from skx-pink.jf.intel.com ([10.54.80.236]) by orsmga001.jf.intel.com with ESMTP; 15 May 2019 21:28:23 -0700 From: Mesut Ali Ergin To: beilei.xing@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org, Mesut Ali Ergin Date: Wed, 15 May 2019 21:28:04 -0700 Message-Id: <1557980885-183777-3-git-send-email-mesut.a.ergin@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557980885-183777-1-git-send-email-mesut.a.ergin@intel.com> References: <1557980885-183777-1-git-send-email-mesut.a.ergin@intel.com> Subject: [dpdk-dev] [PATCH 2/3] net/i40e: add runtime option to disable vector rx X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Vector RX functions are not at feature parity with non-vector ones and currently the vector RX path is enabled by default. Hence, the only option to force selection of non-vector variants and be able to retain functionality is to disable vector PMD globally at compile time via the config file option. This patch introduces a new runtime device config option named disable-vec-rx to allow users to limit the driver to make a choice among non-vector RX functions, on a per device basis. This runtime option defaults to a value of zero, allowing vector RX functions to be selected (current behavior). When disable-vec-rx=1 is specified for a device, even if all the other requirements to select a vector RX function are satisfied, the driver will still pick one out of the appropriate non-vector RX functions. Signed-off-by: Mesut Ali Ergin --- doc/guides/nics/i40e.rst | 14 +++++++++ drivers/net/i40e/i40e_ethdev.c | 70 +++++++++++++++++++++++++++++++++++++++++- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/i40e_rxtx.c | 4 +++ 4 files changed, 88 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst index a97484c..532cc64 100644 --- a/doc/guides/nics/i40e.rst +++ b/doc/guides/nics/i40e.rst @@ -183,6 +183,20 @@ Runtime Config Options -w 84:00.0,use-latest-supported-vec=1 +- ``Disable RX Vector Functions `` (default ``vector RX enabled``) + + When config file option for the vector PMD is enabled, vector RX functions may + be the default choice of the driver at device initialization time, if certain + conditions apply. However, vector RX functions may not always be at feature + parity with non-vector ones. In order to allow users to override vector RX + function selection behavior at runtime, the ``devargs`` parameter + ``disable-vec-rx`` is introduced, such that + + -w DBDF,disable-vec-rx=1 + + would force driver to limit its choices to non-vector RX function variants for + the device specified by the DBDF. + Vector RX Pre-conditions ~~~~~~~~~~~~~~~~~~~~~~~~ For Vector RX it is assumed that the number of descriptor rings will be a power diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index cab440f..19fbd23 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -44,6 +44,7 @@ #define ETH_I40E_SUPPORT_MULTI_DRIVER "support-multi-driver" #define ETH_I40E_QUEUE_NUM_PER_VF_ARG "queue-num-per-vf" #define ETH_I40E_USE_LATEST_VEC "use-latest-supported-vec" +#define ETH_I40E_DISABLE_VEC_RX "disable-vec-rx" #define I40E_CLEAR_PXE_WAIT_MS 200 @@ -410,6 +411,7 @@ static const char *const valid_keys[] = { ETH_I40E_SUPPORT_MULTI_DRIVER, ETH_I40E_QUEUE_NUM_PER_VF_ARG, ETH_I40E_USE_LATEST_VEC, + ETH_I40E_DISABLE_VEC_RX, NULL}; static const struct rte_pci_id pci_id_i40e_map[] = { @@ -1263,6 +1265,68 @@ i40e_use_latest_vec(struct rte_eth_dev *dev) return 0; } +static int +i40e_parse_disable_vec_rx_handler(__rte_unused const char *key, + const char *value, + void *opaque) +{ + struct i40e_adapter *ad; + + ad = (struct i40e_adapter *)opaque; + + switch (atoi(value)) { + case 0: + /* Selection of RX vector functions left untouched*/ + break; + case 1: + /* Disable RX vector functions as requested*/ + ad->rx_vec_allowed = false; + break; + default: + PMD_DRV_LOG(WARNING, "Value should be 0 or 1, set it as 1!"); + break; + } + + return 0; +} + +int +i40e_disable_vec_rx(struct rte_eth_dev *dev) +{ + struct i40e_adapter *ad = + I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); + struct rte_kvargs *kvlist; + int kvargs_count; + + + if (!dev->device->devargs) + return 0; + + kvlist = rte_kvargs_parse(dev->device->devargs->args, valid_keys); + if (!kvlist) + return -EINVAL; + + kvargs_count = rte_kvargs_count(kvlist, ETH_I40E_DISABLE_VEC_RX); + if (!kvargs_count) { + rte_kvargs_free(kvlist); + return 0; + } + + if (kvargs_count > 1) + PMD_DRV_LOG(WARNING, "More than one argument \"%s\" and only " + "the first invalid or last valid one is used !", + ETH_I40E_DISABLE_VEC_RX); + + if (rte_kvargs_process(kvlist, ETH_I40E_DISABLE_VEC_RX, + i40e_parse_disable_vec_rx_handler, ad) < 0) { + rte_kvargs_free(kvlist); + return -EINVAL; + } + + rte_kvargs_free(kvlist); + return 0; +} + #define I40E_ALARM_INTERVAL 50000 /* us */ static int @@ -1795,6 +1859,9 @@ i40e_dev_configure(struct rte_eth_dev *dev) ad->tx_simple_allowed = true; ad->tx_vec_allowed = true; + /* Check if users wanted to disable vector RX functions */ + i40e_disable_vec_rx(dev); + /* Only legacy filter API needs the following fdir config. So when the * legacy filter API is deprecated, the following codes should also be * removed. @@ -12790,4 +12857,5 @@ RTE_PMD_REGISTER_PARAM_STRING(net_i40e, ETH_I40E_FLOATING_VEB_LIST_ARG "=" ETH_I40E_QUEUE_NUM_PER_VF_ARG "=1|2|4|8|16" ETH_I40E_SUPPORT_MULTI_DRIVER "=1" - ETH_I40E_USE_LATEST_VEC "=0|1"); + ETH_I40E_USE_LATEST_VEC "=0|1" + ETH_I40E_DISABLE_VEC_RX "=0|1"); diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 9855038..906bfe9 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -1248,6 +1248,7 @@ int i40e_config_rss_filter(struct i40e_pf *pf, struct i40e_rte_flow_rss_conf *conf, bool add); int i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params); int i40e_vf_representor_uninit(struct rte_eth_dev *ethdev); +int i40e_disable_vec_rx(struct rte_eth_dev *dev); #define I40E_DEV_TO_PCI(eth_dev) \ RTE_DEV_TO_PCI((eth_dev)->device) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 1489552..7e66f59 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -1736,6 +1736,10 @@ i40e_dev_rx_queue_setup_runtime(struct rte_eth_dev *dev, */ ad->rx_bulk_alloc_allowed = true; ad->rx_vec_allowed = true; + + /* Check if users wanted to disable vector RX functions */ + i40e_disable_vec_rx(dev); + dev->data->scattered_rx = use_scattered_rx; if (use_def_burst_func) ad->rx_bulk_alloc_allowed = false; From patchwork Thu May 16 04:28:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ergin, Mesut A" X-Patchwork-Id: 53461 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 136915F1A; Thu, 16 May 2019 06:28:33 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 33495326C for ; Thu, 16 May 2019 06:28:26 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 May 2019 21:28:23 -0700 X-ExtLoop1: 1 Received: from skx-pink.jf.intel.com ([10.54.80.236]) by orsmga001.jf.intel.com with ESMTP; 15 May 2019 21:28:23 -0700 From: Mesut Ali Ergin To: beilei.xing@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org, Mesut Ali Ergin Date: Wed, 15 May 2019 21:28:05 -0700 Message-Id: <1557980885-183777-4-git-send-email-mesut.a.ergin@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557980885-183777-1-git-send-email-mesut.a.ergin@intel.com> References: <1557980885-183777-1-git-send-email-mesut.a.ergin@intel.com> Subject: [dpdk-dev] [PATCH 3/3] net/i40e: fix inadvertent override of vector RX allowance X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When i40e_rx_vec_dev_conf_condition_check_default() determines whether vector receive functions would be allowed during initialization phase, it should honor previously recorded disallowance during configuration phase, and not override simply because it is for the first queue. Signed-off-by: Mesut Ali Ergin --- drivers/net/i40e/i40e_rxtx_vec_common.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/i40e/i40e_rxtx_vec_common.h b/drivers/net/i40e/i40e_rxtx_vec_common.h index 0e6ffa0..f30cab4 100644 --- a/drivers/net/i40e/i40e_rxtx_vec_common.h +++ b/drivers/net/i40e/i40e_rxtx_vec_common.h @@ -212,6 +212,10 @@ i40e_rx_vec_dev_conf_condition_check_default(struct rte_eth_dev *dev) if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND) return -1; + /* Should not override if vector was already disallowed */ + if (!ad->rx_vec_allowed) + return -1; + /** * Vector mode is allowed only when number of Rx queue * descriptor is power of 2.