DPDK patches and discussions
 help / color / mirror / Atom feed
* [RFC] net/ice: support represented port flow action
@ 2022-06-14 13:20 zhichaox.zeng
  2022-07-20  2:02 ` Zeng, ZhichaoX
  2022-08-08  1:28 ` Zhang, Qi Z
  0 siblings, 2 replies; 3+ messages in thread
From: zhichaox.zeng @ 2022-06-14 13:20 UTC (permalink / raw)
  To: dev; +Cc: qiming.yang, Zhichao Zeng, Qi Zhang

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

Add support for action REPRESENTED_PORT, which send traffic
to the VF represented by the given ethdev.

Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
 doc/guides/nics/features/ice.ini    |  1 +
 drivers/net/ice/ice_switch_filter.c | 43 +++++++++++++++++++++++++++++
 2 files changed, 44 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 36c9bffb73..56bc392ac7 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1618,9 +1618,14 @@ 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_represented_port;
+	const struct rte_eth_dev *representor_dev;
 	const struct rte_flow_action_vf *act_vf;
 	const struct rte_flow_action *action;
+	const struct ice_pf *pf;
 	enum rte_flow_action_type action_type;
+	uint16_t representor_port_id, representor_id;
+	uint16_t backer_port_id, pf_port_id;
 
 	for (action = actions; action->type !=
 				RTE_FLOW_ACTION_TYPE_END; action++) {
@@ -1646,6 +1651,43 @@ 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:
+			/**
+			 * The following two cases will return an invalid parameter error code:
+			 * 1.The given port_id is not in the valid range
+			 * 2.The VF represented by the representor and the current adapter do
+			 *   not belong to the same PF
+			 */
+			rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI;
+			act_represented_port = action->conf;
+			representor_dev = &rte_eth_devices[act_represented_port->port_id];
+			pf = &ad->parent.pf;
+			pf_port_id = pf->dev_data->port_id;
+
+			if (!representor_dev->data) {
+				rte_flow_error_set(error,
+					EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+					actions,
+					"Invalid ethdev_port_id");
+				return -rte_errno;
+			}
+
+			backer_port_id = representor_dev->data->backer_port_id;
+			representor_id = representor_dev->data->representor_id;
+			representor_port_id = representor_dev->data->port_id;
+
+			if (backer_port_id != pf_port_id &&
+				(representor_id || pf_port_id != representor_port_id)) {
+				rte_flow_error_set(error,
+					EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+					actions,
+					"Invalid ethdev_port_id");
+				return -rte_errno;
+			}
+
+			rule_info->sw_act.vsi_handle = representor_id;
+			break;
+
 		case RTE_FLOW_ACTION_TYPE_DROP:
 			rule_info->sw_act.fltr_act = ICE_DROP_PACKET;
 			break;
@@ -1789,6 +1831,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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [RFC] net/ice: support represented port flow action
  2022-06-14 13:20 [RFC] net/ice: support represented port flow action zhichaox.zeng
@ 2022-07-20  2:02 ` Zeng, ZhichaoX
  2022-08-08  1:28 ` Zhang, Qi Z
  1 sibling, 0 replies; 3+ messages in thread
From: Zeng, ZhichaoX @ 2022-07-20  2:02 UTC (permalink / raw)
  To: dev; +Cc: Yang, Qiming, Zhang, Qi Z

Hi ZhangQi
    Could you please help to review this patch at your convenience, thank you so much!

Best regards
Zhichao

> -----Original Message-----
> From: Zeng, ZhichaoX <zhichaox.zeng@intel.com> 
> Sent: Tuesday, June 14, 2022 9:21 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zeng, ZhichaoX <zhichaox.zeng@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [RFC] net/ice: support represented port flow action
>
> From: Zhichao Zeng <zhichaox.zeng@intel.com>
>
> Add support for action REPRESENTED_PORT, which send traffic to the VF represented by the given ethdev.
>
> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [RFC] net/ice: support represented port flow action
  2022-06-14 13:20 [RFC] net/ice: support represented port flow action zhichaox.zeng
  2022-07-20  2:02 ` Zeng, ZhichaoX
@ 2022-08-08  1:28 ` Zhang, Qi Z
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2022-08-08  1:28 UTC (permalink / raw)
  To: Zeng, ZhichaoX, dev; +Cc: Yang, Qiming



> -----Original Message-----
> From: Zeng, ZhichaoX <zhichaox.zeng@intel.com>
> Sent: Tuesday, June 14, 2022 9:21 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zeng, ZhichaoX
> <zhichaox.zeng@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [RFC] net/ice: support represented port flow action
> 
> From: Zhichao Zeng <zhichaox.zeng@intel.com>
> 
> Add support for action REPRESENTED_PORT, which send traffic to the VF
> represented by the given ethdev.
> 
> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-08  1:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 13:20 [RFC] net/ice: support represented port flow action zhichaox.zeng
2022-07-20  2:02 ` Zeng, ZhichaoX
2022-08-08  1:28 ` Zhang, Qi Z

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).