From: Simei Su <simei.su@intel.com>
To: qi.z.zhang@intel.com, qiming.yang@intel.com
Cc: dev@dpdk.org, haiyue.wang@intel.com, beilei.xing@intel.com,
Simei Su <simei.su@intel.com>
Subject: [dpdk-dev] [PATCH v2 4/4] net/ice: add devarg for ACL ipv4 rule number
Date: Tue, 29 Sep 2020 09:56:32 +0800 [thread overview]
Message-ID: <20200929015632.109364-5-simei.su@intel.com> (raw)
In-Reply-To: <20200929015632.109364-1-simei.su@intel.com>
This patch enables devargs for ACL ipv4 rule number and refactor
DCF capability selection API to support not just DCF capability.
Signed-off-by: Simei Su <simei.su@intel.com>
---
drivers/net/ice/ice_acl_filter.c | 42 +++++++++-------
drivers/net/ice/ice_dcf_ethdev.c | 100 ++++++++++++++++++++++++++++++---------
drivers/net/ice/ice_ethdev.h | 1 +
3 files changed, 103 insertions(+), 40 deletions(-)
diff --git a/drivers/net/ice/ice_acl_filter.c b/drivers/net/ice/ice_acl_filter.c
index 758362a..6e12774 100644
--- a/drivers/net/ice/ice_acl_filter.c
+++ b/drivers/net/ice/ice_acl_filter.c
@@ -102,29 +102,37 @@ ice_acl_setup(struct ice_pf *pf)
struct ice_hw *hw = ICE_PF_TO_HW(pf);
u32 pf_num = hw->dev_caps.num_funcs;
struct ice_acl_tbl_params params;
+ int acl_ipv4_rules = 0;
u16 scen_id;
int err = 0;
- memset(¶ms, 0, sizeof(params));
-
- /* create for IPV4 table */
- if (pf_num < 4)
- params.width = ICE_AQC_ACL_KEY_WIDTH_BYTES * 6;
+ if (pf->adapter->devargs.acl_ipv4_rules_num)
+ acl_ipv4_rules = pf->adapter->devargs.acl_ipv4_rules_num;
else
- params.width = ICE_AQC_ACL_KEY_WIDTH_BYTES * 3;
-
- params.depth = ICE_AQC_ACL_TCAM_DEPTH;
- params.entry_act_pairs = 1;
- params.concurr = false;
+ acl_ipv4_rules = ICE_AQC_ACL_TCAM_DEPTH;
- err = ice_acl_create_tbl(hw, ¶ms);
- if (err)
- return err;
+ memset(¶ms, 0, sizeof(params));
- err = ice_acl_create_scen(hw, params.width, params.depth,
- &scen_id);
- if (err)
- return err;
+ /* create for IPV4 table */
+ if (acl_ipv4_rules) {
+ if (pf_num < 4)
+ params.width = ICE_AQC_ACL_KEY_WIDTH_BYTES * 6;
+ else
+ params.width = ICE_AQC_ACL_KEY_WIDTH_BYTES * 3;
+
+ params.depth = acl_ipv4_rules;
+ params.entry_act_pairs = 1;
+ params.concurr = false;
+
+ err = ice_acl_create_tbl(hw, ¶ms);
+ if (err)
+ return err;
+
+ err = ice_acl_create_scen(hw, params.width, params.depth,
+ &scen_id);
+ if (err)
+ return err;
+ }
return 0;
}
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 2faed3c..98f9766 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -26,6 +26,16 @@
#include "ice_dcf_ethdev.h"
#include "ice_rxtx.h"
+/* devargs */
+#define ICE_DCF_CAP "cap"
+#define ICE_DCF_ACL_IPV4_RULES_NUM "acl_ipv4_nums"
+
+static const char * const ice_dcf_valid_args[] = {
+ ICE_DCF_CAP,
+ ICE_DCF_ACL_IPV4_RULES_NUM,
+ NULL,
+};
+
static uint16_t
ice_dcf_recv_pkts(__rte_unused void *rx_queue,
__rte_unused struct rte_mbuf **bufs,
@@ -895,9 +905,51 @@ static const struct eth_dev_ops ice_dcf_eth_dev_ops = {
};
static int
+parse_int(__rte_unused const char *key, const char *value, void *args)
+{
+ int *i = (int *)args;
+ char *end;
+ int num;
+
+ num = strtoul(value, &end, 10);
+ *i = num;
+
+ return 0;
+}
+
+static int ice_dcf_parse_devargs(struct rte_eth_dev *dev)
+{
+ struct ice_dcf_adapter *adapter = dev->data->dev_private;
+ struct ice_adapter *parent_adapter = &adapter->parent;
+
+ 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_dcf_valid_args);
+ if (kvlist == NULL) {
+ PMD_INIT_LOG(ERR, "Invalid kvargs key\n");
+ return -EINVAL;
+ }
+
+ ret = rte_kvargs_process(kvlist, ICE_DCF_ACL_IPV4_RULES_NUM,
+ &parse_int, &parent_adapter->devargs.acl_ipv4_rules_num);
+ if (ret)
+ goto bail;
+
+bail:
+ rte_kvargs_free(kvlist);
+ return ret;
+}
+
+static int
ice_dcf_dev_init(struct rte_eth_dev *eth_dev)
{
struct ice_dcf_adapter *adapter = eth_dev->data->dev_private;
+ int ret;
eth_dev->dev_ops = &ice_dcf_eth_dev_ops;
eth_dev->rx_pkt_burst = ice_dcf_recv_pkts;
@@ -908,6 +960,12 @@ ice_dcf_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+ ret = ice_dcf_parse_devargs(eth_dev);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to parse devargs");
+ return -EINVAL;
+ }
+
adapter->real_hw.vc_event_msg_cb = ice_dcf_handle_pf_event_msg;
if (ice_dcf_init_hw(eth_dev, &adapter->real_hw) != 0) {
PMD_INIT_LOG(ERR, "Failed to init DCF hardware");
@@ -932,48 +990,44 @@ ice_dcf_dev_uninit(struct rte_eth_dev *eth_dev)
}
static int
-ice_dcf_cap_check_handler(__rte_unused const char *key,
- const char *value, __rte_unused void *opaque)
+handle_dcf_arg(__rte_unused const char *key, const char *value,
+ __rte_unused void *arg)
{
- if (strcmp(value, "dcf"))
- return -1;
+ bool *dcf = arg;
+
+ if (arg == NULL || value == NULL)
+ return -EINVAL;
+
+ if (strcmp(value, "dcf") == 0)
+ *dcf = true;
+ else
+ *dcf = false;
return 0;
}
-static int
-ice_dcf_cap_selected(struct rte_devargs *devargs)
+static bool
+check_cap_dcf_enable(struct rte_devargs *devargs)
{
struct rte_kvargs *kvlist;
- const char *key = "cap";
- int ret = 0;
+ bool enable = false;
if (devargs == NULL)
- return 0;
+ return false;
kvlist = rte_kvargs_parse(devargs->args, NULL);
if (kvlist == NULL)
- return 0;
-
- if (!rte_kvargs_count(kvlist, key))
- goto exit;
-
- /* dcf capability selected when there's a key-value pair: cap=dcf */
- if (rte_kvargs_process(kvlist, key,
- ice_dcf_cap_check_handler, NULL) < 0)
- goto exit;
+ return false;
- ret = 1;
+ rte_kvargs_process(kvlist, ICE_DCF_CAP, handle_dcf_arg, &enable);
-exit:
- rte_kvargs_free(kvlist);
- return ret;
+ return enable;
}
static int eth_ice_dcf_pci_probe(__rte_unused struct rte_pci_driver *pci_drv,
struct rte_pci_device *pci_dev)
{
- if (!ice_dcf_cap_selected(pci_dev->device.devargs))
+ if (!check_cap_dcf_enable(pci_dev->device.devargs))
return 1;
return rte_eth_dev_pci_generic_probe(pci_dev,
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 38de4c6..a804182 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -469,6 +469,7 @@ struct ice_devargs {
uint8_t proto_xtr_dflt;
int pipe_mode_support;
uint8_t proto_xtr[ICE_MAX_QUEUE_NUM];
+ int acl_ipv4_rules_num;
};
/**
--
2.9.5
next prev parent reply other threads:[~2020-09-29 2:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-10 7:37 [dpdk-dev] [PATCH v1 0/3] net/ice: support DCF ACL capabiltiy Simei Su
2020-09-10 7:37 ` [dpdk-dev] [PATCH v1 1/3] net/ice: get PF VSI map Simei Su
2020-09-10 7:37 ` [dpdk-dev] [PATCH v1 2/3] net/ice: add devarg for ACL ipv4 rule number Simei Su
2020-09-10 7:53 ` Wang, Haiyue
2020-09-10 7:37 ` [dpdk-dev] [PATCH v1 3/3] net/ice: support ACL filter in DCF Simei Su
2020-09-29 1:56 ` [dpdk-dev] [PATCH v2 0/4] net/ice: support DCF ACL capabiltiy Simei Su
2020-09-29 1:56 ` [dpdk-dev] [PATCH v2 1/4] net/ice/base: change API from static to non-static Simei Su
2020-09-29 1:56 ` [dpdk-dev] [PATCH v2 2/4] net/ice: get PF VSI map Simei Su
2020-09-29 1:56 ` [dpdk-dev] [PATCH v2 3/4] net/ice: support ACL filter in DCF Simei Su
2020-09-29 1:56 ` Simei Su [this message]
2020-10-14 8:54 ` [dpdk-dev] [PATCH v3 0/3] net/ice: support DCF ACL capabiltiy Simei Su
2020-10-14 8:54 ` [dpdk-dev] [PATCH v3 1/3] net/ice/base: change API from static to non-static Simei Su
2020-10-14 8:54 ` [dpdk-dev] [PATCH v3 2/3] net/ice: get PF VSI map Simei Su
2020-10-14 8:54 ` [dpdk-dev] [PATCH v3 3/3] net/ice: support ACL filter in DCF Simei Su
2020-10-15 5:10 ` Zhang, Qi Z
2020-10-15 7:08 ` Su, Simei
2020-10-16 8:44 ` [dpdk-dev] [PATCH v4 0/3] net/ice: support DCF ACL capabiltiy Simei Su
2020-10-16 8:44 ` [dpdk-dev] [PATCH v4 1/3] net/ice/base: change API from static to non-static Simei Su
2020-10-16 8:44 ` [dpdk-dev] [PATCH v4 2/3] net/ice: get PF VSI map Simei Su
2020-10-16 8:44 ` [dpdk-dev] [PATCH v4 3/3] net/ice: support ACL filter in DCF Simei Su
2020-10-20 11:32 ` [dpdk-dev] [PATCH v5 0/3] net/ice: support DCF ACL capabiltiy Simei Su
2020-10-20 11:32 ` [dpdk-dev] [PATCH v5 1/3] net/ice/base: change API from static to non-static Simei Su
2020-10-20 11:32 ` [dpdk-dev] [PATCH v5 2/3] net/ice: get PF VSI map Simei Su
2020-10-20 11:32 ` [dpdk-dev] [PATCH v5 3/3] net/ice: support ACL filter in DCF Simei Su
2020-10-20 12:37 ` [dpdk-dev] [PATCH v5 0/3] net/ice: support DCF ACL capabiltiy Zhang, Qi Z
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200929015632.109364-5-simei.su@intel.com \
--to=simei.su@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=haiyue.wang@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).