From: Ivan Malov <ivan.malov@oktetlabs.ru>
To: dev@dpdk.org
Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 6/7] net/sfc: support port representor related flow actions
Date: Mon, 25 Oct 2021 14:04:14 +0300 [thread overview]
Message-ID: <20211025110415.20683-6-ivan.malov@oktetlabs.ru> (raw)
In-Reply-To: <20211025110415.20683-1-ivan.malov@oktetlabs.ru>
Add support for actions PORT_REPRESENTOR and REPRESENTED_PORT.
The former should be used instead of ambiguous PORT_ID.
The latter sends traffic to the entity represented by
the given ethdev (network port or VF).
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
doc/guides/nics/features/sfc.ini | 2 +
doc/guides/nics/sfc_efx.rst | 4 ++
drivers/net/sfc/sfc_mae.c | 66 ++++++++++++++++++++++++++++++++
3 files changed, 72 insertions(+)
diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini
index c830426eb2..0d785f4765 100644
--- a/doc/guides/nics/features/sfc.ini
+++ b/doc/guides/nics/features/sfc.ini
@@ -73,6 +73,8 @@ of_set_vlan_vid = Y
pf = Y
phy_port = Y
port_id = Y
+port_representor = Y
+represented_port = Y
queue = Y
rss = Y
vf = Y
diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
index 8dbd250b3c..960e25bf98 100644
--- a/doc/guides/nics/sfc_efx.rst
+++ b/doc/guides/nics/sfc_efx.rst
@@ -248,6 +248,10 @@ Supported actions (***transfer*** rules):
- VF
+- PORT_REPRESENTOR
+
+- REPRESENTED_PORT
+
- PORT_ID
- COUNT
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index 8ec4036275..411f2ac27e 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -3488,6 +3488,58 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,
return rc;
}
+static int
+sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa,
+ const struct rte_flow_action_ethdev *conf,
+ efx_mae_actions_t *spec)
+{
+ struct sfc_mae *mae = &sa->mae;
+ efx_mport_sel_t mport;
+ int rc;
+
+ rc = sfc_mae_switch_get_ethdev_mport(mae->switch_domain_id,
+ conf->port_id, &mport);
+ if (rc != 0) {
+ sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
+ conf->port_id, strerror(rc));
+ return rc;
+ }
+
+ rc = efx_mae_action_set_populate_deliver(spec, &mport);
+ if (rc != 0) {
+ sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
+ mport.sel, strerror(rc));
+ }
+
+ return rc;
+}
+
+static int
+sfc_mae_rule_parse_action_represented_port(struct sfc_adapter *sa,
+ const struct rte_flow_action_ethdev *conf,
+ efx_mae_actions_t *spec)
+{
+ struct sfc_mae *mae = &sa->mae;
+ efx_mport_sel_t mport;
+ int rc;
+
+ rc = sfc_mae_switch_get_entity_mport(mae->switch_domain_id,
+ conf->port_id, &mport);
+ if (rc != 0) {
+ sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
+ conf->port_id, strerror(rc));
+ return rc;
+ }
+
+ rc = efx_mae_action_set_populate_deliver(spec, &mport);
+ if (rc != 0) {
+ sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
+ mport.sel, strerror(rc));
+ }
+
+ return rc;
+}
+
static const char * const action_names[] = {
[RTE_FLOW_ACTION_TYPE_VXLAN_DECAP] = "VXLAN_DECAP",
[RTE_FLOW_ACTION_TYPE_OF_POP_VLAN] = "OF_POP_VLAN",
@@ -3501,6 +3553,8 @@ static const char * const action_names[] = {
[RTE_FLOW_ACTION_TYPE_PF] = "PF",
[RTE_FLOW_ACTION_TYPE_VF] = "VF",
[RTE_FLOW_ACTION_TYPE_PORT_ID] = "PORT_ID",
+ [RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR] = "PORT_REPRESENTOR",
+ [RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT] = "REPRESENTED_PORT",
[RTE_FLOW_ACTION_TYPE_DROP] = "DROP",
[RTE_FLOW_ACTION_TYPE_JUMP] = "JUMP",
};
@@ -3609,6 +3663,18 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa,
bundle->actions_mask);
rc = sfc_mae_rule_parse_action_port_id(sa, action->conf, spec);
break;
+ case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR:
+ SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
+ bundle->actions_mask);
+ rc = sfc_mae_rule_parse_action_port_representor(sa,
+ action->conf, spec);
+ break;
+ case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
+ SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
+ bundle->actions_mask);
+ rc = sfc_mae_rule_parse_action_represented_port(sa,
+ action->conf, spec);
+ break;
case RTE_FLOW_ACTION_TYPE_DROP:
SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_DROP,
bundle->actions_mask);
--
2.20.1
next prev parent reply other threads:[~2021-10-25 11:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-25 11:04 [dpdk-dev] [PATCH 1/7] net/sfc: do not allow flow rules to refer to VF representors Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 2/7] net/sfc: rename ethdev m-port retrieval helper Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 3/7] net/sfc: improve m-port related log messages Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 4/7] net/sfc: assign correct m-ports to independent switch ports Ivan Malov
2021-10-25 11:04 ` [dpdk-dev] [PATCH 5/7] net/sfc: support represented port flow item Ivan Malov
2021-10-25 11:04 ` Ivan Malov [this message]
2021-10-25 11:04 ` [dpdk-dev] [PATCH 7/7] net/sfc: ignore direction attributes in transfer flows Ivan Malov
2021-11-02 18:27 ` [dpdk-dev] [PATCH 1/7] net/sfc: do not allow flow rules to refer to VF representors Ferruh Yigit
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=20211025110415.20683-6-ivan.malov@oktetlabs.ru \
--to=ivan.malov@oktetlabs.ru \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
/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).