DPDK patches and discussions
 help / color / mirror / Atom feed
From: zhichaox.zeng@intel.com
To: dev@dpdk.org
Cc: qiming.yang@intel.com, Zhichao Zeng <zhichaox.zeng@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>
Subject: [PATCH] net/ice: support represented port flow action
Date: Mon, 25 Jul 2022 13:35:49 +0800	[thread overview]
Message-ID: <20220725053549.4130777-1-zhichaox.zeng@intel.com> (raw)

From: Zhichao Zeng <zhichaox.zeng@intel.com>

Add support for action REPRESENTED_PORT in DCF. Supposed to send matching
traffic to the entity (VF) represented by the given ethdev, at embedded
switch level.

Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
 doc/guides/nics/features/ice.ini    |  1 +
 drivers/net/ice/ice_switch_filter.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/doc/guides/nics/features/ice.ini b/doc/guides/nics/features/ice.ini
index 7861790a51..12fd802885 100644
--- a/doc/guides/nics/features/ice.ini
+++ b/doc/guides/nics/features/ice.ini
@@ -82,3 +82,4 @@ passthru             = Y
 queue                = Y
 rss                  = Y
 vf                   = Y
+represented_port     = Y
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index e84283fec1..5d65988474 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1618,9 +1618,12 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 			    struct rte_flow_error *error,
 			    struct ice_adv_rule_info *rule_info)
 {
+	const struct rte_flow_action_ethdev *act_ethdev;
 	const struct rte_flow_action_vf *act_vf;
 	const struct rte_flow_action *action;
+	const struct rte_eth_dev *repr_dev;
 	enum rte_flow_action_type action_type;
+	uint16_t rule_port_id, backer_port_id;
 
 	for (action = actions; action->type !=
 				RTE_FLOW_ACTION_TYPE_END; action++) {
@@ -1646,6 +1649,30 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 				rule_info->sw_act.vsi_handle = act_vf->id;
 			break;
 
+		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
+			rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI;
+			act_ethdev = action->conf;
+			repr_dev = &rte_eth_devices[act_ethdev->port_id];
+
+			if (!repr_dev->data)
+				goto invalid;
+
+			rule_port_id = ad->parent.pf.dev_data->port_id;
+			backer_port_id = repr_dev->data->backer_port_id;
+
+			if (backer_port_id != rule_port_id)
+				goto invalid;
+
+			rule_info->sw_act.vsi_handle = repr_dev->data->representor_id;
+			break;
+
+invalid:
+			rte_flow_error_set(error,
+						EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+						actions,
+						"Invalid ethdev_port_id");
+			return -rte_errno;
+
 		case RTE_FLOW_ACTION_TYPE_DROP:
 			rule_info->sw_act.fltr_act = ICE_DROP_PACKET;
 			break;
@@ -1789,6 +1816,7 @@ ice_switch_check_action(const struct rte_flow_action *actions,
 		case RTE_FLOW_ACTION_TYPE_RSS:
 		case RTE_FLOW_ACTION_TYPE_QUEUE:
 		case RTE_FLOW_ACTION_TYPE_DROP:
+		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
 			actions_num++;
 			break;
 		case RTE_FLOW_ACTION_TYPE_VOID:
-- 
2.25.1


             reply	other threads:[~2022-07-25  5:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25  5:35 zhichaox.zeng [this message]
2022-08-30  1:22 Xu, Ke1

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=20220725053549.4130777-1-zhichaox.zeng@intel.com \
    --to=zhichaox.zeng@intel.com \
    --cc=dev@dpdk.org \
    --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).