From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 6318E42338;
	Mon,  9 Oct 2023 10:03:41 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 1CE3A40A84;
	Mon,  9 Oct 2023 10:02:39 +0200 (CEST)
Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126])
 by mails.dpdk.org (Postfix) with ESMTP id 91BC640A75
 for <dev@dpdk.org>; Mon,  9 Oct 2023 10:02:37 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1696838557; x=1728374557;
 h=from:to:subject:date:message-id:in-reply-to:references:
 mime-version:content-transfer-encoding;
 bh=kOTpgao6KPJd3SoSyyNEi8XWy4dPxfrvQjdc1KbJGiY=;
 b=VHpHznwCSJ21lvx/zvEE8Hz//uS0/m9S8G4chpsH/0ft2oatiBVimfQO
 jNZ2CrCsWBbOG/A4vDUHMTOC4O+BnIQa7M0zD1vFF3gVYZpm2/SwASHOE
 j6Ho4/iSEHnA7m0U0sk8Wa2J0xzduy1Yn5Ckhqi6pdni4aVD5Cst1FHek
 SpC3EWLkb5I26CLW4ZLiagwc5IN+Pa1MR4c3sBv+Vl4JQ6RGzDpqgcPBX
 igPeXVTeeixT5rueEQMqJlk43VVr7ZunvEWC/7/n5JitUyGKM09IUCfMO
 wQNPjXrmoENy9k7/SmiIVDjPaciNJj8qxvhiczds+CmtihpKOVxpu7qAq g==;
X-IronPort-AV: E=McAfee;i="6600,9927,10857"; a="369155102"
X-IronPort-AV: E=Sophos;i="6.03,209,1694761200"; d="scan'208";a="369155102"
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 09 Oct 2023 01:02:36 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=McAfee;i="6600,9927,10857"; a="926675933"
X-IronPort-AV: E=Sophos;i="6.03,209,1694761200"; d="scan'208";a="926675933"
Received: from dpdk-pengyuan-mev.sh.intel.com ([10.67.119.132])
 by orsmga005.jf.intel.com with ESMTP; 09 Oct 2023 01:02:34 -0700
From: "Zhang, Yuying" <yuying.zhang@intel.com>
To: yuying.zhang@intel.com, dev@dpdk.org, qi.z.zhang@intel.com,
 jingjing.wu@intel.com, beilei.xing@intel.com
Subject: [PATCH v10 9/9] net/cpfl: support represented port action
Date: Fri,  8 Sep 2023 16:05:52 +0000
Message-Id: <20230908160552.148060-10-yuying.zhang@intel.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20230908160552.148060-1-yuying.zhang@intel.com>
References: <20230928084458.2333663-1-yuying.zhang@intel.com>
 <20230908160552.148060-1-yuying.zhang@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Yuying Zhang <yuying.zhang@intel.com>

Support RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT action for forwarding
packet to APF/CPF/VF representors.

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/cpfl/cpfl_flow_engine_fxp.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cpfl/cpfl_flow_engine_fxp.c b/drivers/net/cpfl/cpfl_flow_engine_fxp.c
index 7a3376f9f6..ddede2f553 100644
--- a/drivers/net/cpfl/cpfl_flow_engine_fxp.c
+++ b/drivers/net/cpfl/cpfl_flow_engine_fxp.c
@@ -266,6 +266,7 @@ cpfl_fxp_parse_action(struct cpfl_itf *itf,
 	int queue_id = -1;
 	bool fwd_vsi = false;
 	bool fwd_q = false;
+	bool is_vsi;
 	uint32_t i;
 	struct cpfl_rule_info *rinfo = &rim->rules[index];
 	union cpfl_action_set *act_set = (void *)rinfo->act_bytes;
@@ -276,6 +277,7 @@ cpfl_fxp_parse_action(struct cpfl_itf *itf,
 		action_type = action->type;
 		switch (action_type) {
 		case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR:
+		case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:
 			if (!fwd_vsi)
 				fwd_vsi = true;
 			else
@@ -294,12 +296,20 @@ cpfl_fxp_parse_action(struct cpfl_itf *itf,
 				queue_id = CPFL_INVALID_QUEUE_ID;
 			}
 
-			dev_id = cpfl_get_vsi_id(dst_itf);
+			is_vsi = (action_type == RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR ||
+				  dst_itf->type == CPFL_ITF_TYPE_REPRESENTOR);
+			if (is_vsi)
+				dev_id = cpfl_get_vsi_id(dst_itf);
+			else
+				dev_id = cpfl_get_port_id(dst_itf);
 
 			if (dev_id == CPFL_INVALID_HW_ID)
 				goto err;
 
-			*act_set = cpfl_act_fwd_vsi(0, priority, 0, dev_id);
+			if (is_vsi)
+				*act_set = cpfl_act_fwd_vsi(0, priority, 0, dev_id);
+			else
+				*act_set = cpfl_act_fwd_port(0, priority, 0, dev_id);
 			act_set++;
 			rinfo->act_byte_len += sizeof(union cpfl_action_set);
 			break;
-- 
2.34.1