From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C15DBA0032 for ; Sat, 17 Sep 2022 08:02:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 05E8E42847; Sat, 17 Sep 2022 08:02:48 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2060.outbound.protection.outlook.com [40.107.244.60]) by mails.dpdk.org (Postfix) with ESMTP id 72FD8427F9; Sat, 17 Sep 2022 08:02:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MoBq7Z8Dd9cNREcRhZxeKdIUwhg3Wwb/q9fQ7ZfBZcebUvZwo2JFykzOzcqTgPdn7LJQwQdRTVIM7jmsK/tPdsVJOjkAqG1JqYZUa2RfaTkm9IYbOyIh4JThworJyvi6bVjcP0H7RuuWABdBGZFYUaVcQmDv4JV7pdMnIqRKi/YtbW6/poU3K9hof2jkA4HTQyXZFqABvXGb8lc+qXChYaLUSyrNlrZ2wowOobhE085ml6hZgSMN9BVplhs7vl/6LIYupDFmm5TbVqCca4hEArtag3McH2OOQSua+nKXNpdL+fJ1SzvG5N9DD21WHtVOuJ+Q2k3xPd80N6386n+ThQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EY0KTQvRjgy4gPJdFv4B1E4GKThi8NtL5JIv8eGiwcc=; b=AbYmA5O57vyc5zmDxwBwDlSHvNkH9Zyq8zNdiMEnEnOVx3+iPMoF1jlMHqeUcXXXUUl6WJnfxfQKJqpb3btiSFQl8vtbwxNNoKdcYGmfOOcEUkahkALM/JzZNPktQ1IcVFCVXzEYTcObhJ4YT5dJ2mRg/IA/wdsGuUV7BGPwF6Fz3kYYPzFFYCka7H+raYjkACHCyVYpVePgQqLV5CqxyXSaqBw7JirYTHMbpF60gAqUO7bz5zH8Nl7J7fYORW5GuQCZXEcWfiUKd3iOWicmdxdbxQbGQhfH+yfxsT83rQEIBOLLKAc+eB+tX+G28hklzGUMoQ/G7xiy82XhKnsZLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EY0KTQvRjgy4gPJdFv4B1E4GKThi8NtL5JIv8eGiwcc=; b=C7mWFRJ3MOgQdRR8McsbwlcR4lwHlVPcnXqikEgXBCKO3mek3tC9xDOQBKaJEhmaZn39iQV/qjm7+0/RBChSj27kTEsCmNiYg+epVPrG9FYL0ujgzzLkBSfoi3ayBT/Uti/biheeJA7ChhjXOfqhvRDEjh9EseX+wAHfd36h1FA+hxAhuYQwCYl3clWh5KtISJvfg7VBgiVMi5t9dBi5g5Nxl/O7SY4EE+aPYYXf5bRSg39PJqVvNxriNNOszsUgbKvUxcfAd06VhAOE4rfs9Kc9YWfudRbZfJ2DBufkNRr1yPjHjxu8GoXAoN+ts5pDSdWdKhu6GQ1uwhaYWWTGgg== Received: from DS7PR03CA0066.namprd03.prod.outlook.com (2603:10b6:5:3bb::11) by SN7PR12MB6911.namprd12.prod.outlook.com (2603:10b6:806:261::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Sat, 17 Sep 2022 06:02:43 +0000 Received: from DM6NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3bb:cafe::23) by DS7PR03CA0066.outlook.office365.com (2603:10b6:5:3bb::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.17 via Frontend Transport; Sat, 17 Sep 2022 06:02:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT016.mail.protection.outlook.com (10.13.173.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.12 via Frontend Transport; Sat, 17 Sep 2022 06:02:43 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Fri, 16 Sep 2022 23:02:29 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Fri, 16 Sep 2022 23:02:27 -0700 From: Shun Hao To: , , , "Sean Zhang" CC: , , Subject: [PATCH v1 1/3] net/mlx5: fix meter hierarchy with represented port item Date: Sat, 17 Sep 2022 09:02:08 +0300 Message-ID: <20220917060210.3332529-2-shunh@nvidia.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20220917060210.3332529-1-shunh@nvidia.com> References: <20220917060210.3332529-1-shunh@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT016:EE_|SN7PR12MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fc643f7-eb8f-4e8b-2e72-08da98723c51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m3cyXepnAECMWE8kRo76R5nmFihKHmg1i3Xzp2nJd62fBZ82wOfk5IULi8h5L1YH77xL4m/8sgr+mkF8b3HJubIsEi26px9h0mnytKRSgrW6FQzbig7LcnMKVKZrnCncN4AEeQ4lP8JP0mthJNTK9HxnbOwKqO2vWFT7y9pwAGxx8Sj1thBoolFyTeoF/7Tt5GXC25p6KWL732SxTKSE9S5Hb0DEBB9ByhpDM7w+VTCKSihcmL5GP2aYiokeDHtkG2xBlIp4Rj6VoFYezyRWVt0NRBiKe/j9W4nb6GVm+GlgwDTuUkUFqgteLEFKKCmGSa9e5PKClj0VTzv+AhL9tbTtbMG1/avqQlgiyqeTZjLqfYhIeaJXlVSwT/q1LdOsVCRHuVFE3YY3qcK1lVv6UdBbDbmL2S25ysFrXyfzsAHCZH7wnz9ydD/pPHUSFPdZeturr47ZqtzKiBHtiZI/NtLYwDypUiYoXabr94DzaukSzJXjLTLC+7AeHFPaFGZcxiMisfmeh96Wqy39zC0Fi3f9X1v6wzb8+ZkNP1A/dgvr5whLaoCFkVIBBotO2VsXb1hZvPr3GqHJQoCNSiDuzbrJLz6hkJ7fKpSAoEVm9LwS/0AJIU6ixnKLW5+9bsajupf/AUDIPgzDnq3f6J6cwL8R1dpnrwP3fXx2DUjgC4hHO95w5xYRqMyDFfoDyFrRMYX/xbipGcqTTjbK0k1Lxj2WRYnYD76B9rCusNe9cG/kKdnk7w90czKZOzgsbg0AHa/NuV+5LWIcXFkWBHEWQg== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(396003)(136003)(346002)(451199015)(36840700001)(40470700004)(46966006)(7696005)(7636003)(40480700001)(186003)(55016003)(110136005)(4326008)(26005)(8676002)(86362001)(82740400003)(5660300002)(2616005)(8936002)(336012)(40460700003)(70206006)(47076005)(356005)(82310400005)(478600001)(16526019)(426003)(54906003)(316002)(70586007)(6666004)(36860700001)(2906002)(6636002)(450100002)(41300700001)(83380400001)(1076003)(6286002)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2022 06:02:43.0274 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fc643f7-eb8f-4e8b-2e72-08da98723c51 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6911 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org There is a new item type represented_port, and currently it will fail when using meter hierarchy in flow using represented_port match. This patch fixes this fail by adding support for represented_port item in meter hierarchy flow split. Fixes: e8146c63 ("net/mlx5: support represented port item in flow rules") Cc: stable@dpdk.org Signed-off-by: Shun Hao Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 10 +++++++--- drivers/net/mlx5/mlx5_flow.h | 3 +++ drivers/net/mlx5/mlx5_flow_dv.c | 20 ++++++++++++++++---- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 8c93a3f2e5..e93b6e144c 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -5337,7 +5337,7 @@ flow_meter_split_prep(struct rte_eth_dev *dev, switch (item_type) { case RTE_FLOW_ITEM_TYPE_PORT_ID: - if (mlx5_flow_get_item_vport_id(dev, items, &flow_src_port, error)) + case RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT: return -rte_errno; if (!fm->def_policy && wks->policy->is_hierarchy && flow_src_port != priv->representor_id) { @@ -11025,14 +11025,18 @@ int mlx5_flow_get_item_vport_id(struct rte_eth_dev *dev, { struct mlx5_priv *port_priv; const struct rte_flow_item_port_id *pid_v; + uint32_t esw_mgr_port; - if (item->type != RTE_FLOW_ITEM_TYPE_PORT_ID) + if (item->type != RTE_FLOW_ITEM_TYPE_PORT_ID && + item->type != RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL, "Incorrect item type."); pid_v = item->spec; if (!pid_v) return 0; - if (pid_v->id == MLX5_PORT_ESW_MGR) { + esw_mgr_port = (item->type == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT) ? + MLX5_REPRESENTED_PORT_ESW_MGR : MLX5_PORT_ESW_MGR; + if (pid_v->id == esw_mgr_port) { *vport_id = mlx5_flow_get_esw_manager_vport_id(dev); } else { port_priv = mlx5_port_to_eswitch_info(pid_v->id, false); diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 4c233cd94a..2f265763a9 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -21,6 +21,9 @@ /* E-Switch Manager port, used for rte_flow_item_port_id. */ #define MLX5_PORT_ESW_MGR UINT32_MAX +/* E-Switch Manager port, used for rte_flow_item_ethdev. */ +#define MLX5_REPRESENTED_PORT_ESW_MGR UINT16_MAX + /* Private rte flow items. */ enum mlx5_rte_flow_item_type { MLX5_RTE_FLOW_ITEM_TYPE_END = INT_MIN, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 4c811fe00a..f7a5e479b6 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -7055,6 +7055,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, if (ret < 0) return ret; last_item = MLX5_FLOW_ITEM_REPRESENTED_PORT; + port_id_item = items; break; case RTE_FLOW_ITEM_TYPE_ETH: ret = mlx5_flow_validate_item_eth(items, item_flags, @@ -16642,8 +16643,13 @@ __flow_dv_create_policy_flow(struct rte_eth_dev *dev, uint8_t misc_mask; if (match_src_port && priv->sh->esw_mode) { - if (flow_dv_translate_item_port_id(dev, matcher.buf, - value.buf, item, attr)) { + if (item && item->type == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT) + ret = flow_dv_translate_item_represented_port(dev, matcher.buf, value.buf, + item, attr); + else + ret = flow_dv_translate_item_port_id(dev, matcher.buf, value.buf, + item, attr); + if (ret) { DRV_LOG(ERR, "Failed to create meter policy%d flow's" " value with port.", color); return -1; @@ -16692,10 +16698,16 @@ __flow_dv_create_policy_matcher(struct rte_eth_dev *dev, struct mlx5_flow_tbl_data_entry *tbl_data; struct mlx5_priv *priv = dev->data->dev_private; const uint32_t color_mask = (UINT32_C(1) << MLX5_MTR_COLOR_BITS) - 1; + int ret; if (match_src_port && priv->sh->esw_mode) { - if (flow_dv_translate_item_port_id(dev, matcher.mask.buf, - value.buf, item, attr)) { + if (item && item->type == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT) + ret = flow_dv_translate_item_represented_port(dev, matcher.mask.buf, + value.buf, item, attr); + else + ret = flow_dv_translate_item_port_id(dev, matcher.mask.buf, value.buf, + item, attr); + if (ret) { DRV_LOG(ERR, "Failed to register meter policy%d matcher" " with port.", priority); return -1; -- 2.20.0