From patchwork Mon Jul 25 05:35:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Zeng X-Patchwork-Id: 114146 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 CD959A00C4; Mon, 25 Jul 2022 07:35:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D2C54067C; Mon, 25 Jul 2022 07:35:33 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id AA2A44021E for ; Mon, 25 Jul 2022 07:35:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658727331; x=1690263331; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=PJj7SaUNOnew8BJ6jovCSLVom2GiK0bbDPVxs0U4fCw=; b=msB8C9+SO+I0Km/9upPZPq12jQB2JGOc05CHze4yU8C1KMbdzi85ZXFQ qKxbkQ54KN937VvvYWhZnhowVYdS+dhIjzuU2wBgPE3eheLrOa5HHozIf yjhdJSe5OkCIbZzwCrxfJtF/LSigsaVu/DtgkiHNb35sdzjpKgB56gVR9 ELe8jErBSEU0tn/e8rsZ8c5hGFOjdE5DWQMRdw9qYCeJDUQn7ZUxA2had EPODl+fp60y1ZCnWdc7sZQfDuDEH9FvzvE8AWBJQrfuGdRGJG/bbvwzsM qBZKRqXBc6J6gcMEC8HNUmI5WBjT7toDlixEDvfuSbQZbIWCGe0usDfxT w==; X-IronPort-AV: E=McAfee;i="6400,9594,10418"; a="313361871" X-IronPort-AV: E=Sophos;i="5.93,191,1654585200"; d="scan'208";a="313361871" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2022 22:35:30 -0700 X-IronPort-AV: E=Sophos;i="5.93,191,1654585200"; d="scan'208";a="658023644" Received: from unknown (HELO localhost.localdomain) ([10.239.252.103]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2022 22:35:29 -0700 From: zhichaox.zeng@intel.com To: dev@dpdk.org Cc: qiming.yang@intel.com, Zhichao Zeng , Qi Zhang Subject: [PATCH] net/ice: support represented port flow action Date: Mon, 25 Jul 2022 13:35:49 +0800 Message-Id: <20220725053549.4130777-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 From: Zhichao Zeng 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 --- 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: