From patchwork Sat Sep 17 01:49:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Zeng X-Patchwork-Id: 116403 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F2B8AA0032; Sat, 17 Sep 2022 03:47:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8D8A74021D; Sat, 17 Sep 2022 03:47:45 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 8AE9040156 for ; Sat, 17 Sep 2022 03:47:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663379263; x=1694915263; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=x1uObP/UbHgoYGb+4rYgJvz6BCv+SKPUL4dnARYgmEA=; b=QVhEIlSrrNcZk6Idq0wDL0OKpaUtUBjUUHUXlow9xA2lpSYqJEZTj7BM gSYVI7iSo+bd+g3+xRkiPKqv/dbt2bRCqJnc73foDCIRi2V5phStwB+gY 9bbl8i2BTWsFAdaDkSpNlIJmWu1RPUV8m2ETeBV2tSGwDmU3tDkmrWYlo B954J1Kh7dxIxn+0NX2diquXXSgNMW1sjMfmzn9R/6i0j4vEyteON7BH/ ZpjmFZlO3JWFW9eNsEuxlRaJpWykVUCNXopR787lQW9fwbI71fD6rm/G9 YnAsozxsIh5EhDaq9tNPUD601nZnKWRCJfQ1tf1N/FRXRaiGUw54UPg30 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10472"; a="300482268" X-IronPort-AV: E=Sophos;i="5.93,321,1654585200"; d="scan'208";a="300482268" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2022 18:47:42 -0700 X-IronPort-AV: E=Sophos;i="5.93,321,1654585200"; d="scan'208";a="760248803" Received: from unknown (HELO localhost.localdomain) ([10.239.252.103]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2022 18:47:40 -0700 From: Zhichao Zeng To: dev@dpdk.org Cc: yidingx.zhou@intel.com, Zhichao Zeng , Qiming Yang , Qi Zhang Subject: [PATCH] net/ice: support traffic to original DCF port Date: Sat, 17 Sep 2022 09:49:10 +0800 Message-Id: <20220917014910.39751-1-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add support for sending traffic to the original DCF port with 'port_representor' action by using DCF port id as 'port_id'. For example: testpmd> flow create 0 ingress pattern any / end actions port_representor port_id 0 / end Signed-off-by: Zhichao Zeng Acked-by: Qi Zhang Tested-by: Ke Xu --- doc/guides/nics/features/ice.ini | 1 + drivers/net/ice/ice_switch_filter.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/doc/guides/nics/features/ice.ini b/doc/guides/nics/features/ice.ini index fe1e81302c..221e8e90f5 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 represented_port = Y +port_representor = Y diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index ef20b9ad95..60f7934a16 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -1628,6 +1628,30 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad, RTE_FLOW_ACTION_TYPE_END; action++) { action_type = action->type; switch (action_type) { + case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR: + rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI; + act_ethdev = action->conf; + + if (!rte_eth_dev_is_valid_port(act_ethdev->port_id)) + goto invalid_port_id; + + /* For traffic to original DCF port */ + rule_port_id = ad->parent.pf.dev_data->port_id; + + if (rule_port_id != act_ethdev->port_id) + goto invalid_port_id; + + rule_info->sw_act.vsi_handle = 0; + + break; + +invalid_port_id: + rte_flow_error_set(error, + EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, + actions, + "Invalid port_id"); + return -rte_errno; + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI; act_ethdev = action->conf; @@ -1799,6 +1823,7 @@ ice_switch_check_action(const struct rte_flow_action *actions, case RTE_FLOW_ACTION_TYPE_QUEUE: case RTE_FLOW_ACTION_TYPE_DROP: case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: + case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR: actions_num++; break; case RTE_FLOW_ACTION_TYPE_VOID: