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 8534CA0C43; Fri, 22 Oct 2021 11:12:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C26341190; Fri, 22 Oct 2021 11:12:22 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2088.outbound.protection.outlook.com [40.107.93.88]) by mails.dpdk.org (Postfix) with ESMTP id 4BDA5411A2 for ; Fri, 22 Oct 2021 11:12:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g0gg4Eh8YBcKx0KJ2VZ89I6OEMUeyNExUXQJNTFh8S5Upg5oug0R8f/RltqmiyPWDOsoRtweawi0fnb4MkjVw3J7c/cO2rCPFu2KPxR3G2GgdqYTSXVOsgogw3IKRpakNy6wBBm9aFcJL9CscPfSI81OvOGifQRm+JAUpOHVXkCRkidhi6dV7QqWXraIg4BCQSFbfRIDP7yML4pMb2t3Q3m2H9s7O7cZg+D5vaScnJoHHIsW8y4QkACDPqwcuUmSiAT7+p4EBbyDm2ZcYQ+ixJUxsGgFh7xht8NPc/qmyqpPiSWU8ansYjnUZSCJm6/Y/CJpVOdnxqcn3nD+djlC1Q== 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=5dsI6Woh3W1f447as+iTKtK9hHs4TC7SH+o6CyK6r/M=; b=FNTfm6enFzJ2bQvOtZQH99U26ap1uJaImYOurEHOR6eSwwPGbJ6OGLYvERoCmqZmxahFvf0Ta3quLmLXIQNGvTEOhB2ExydAfXhpsnRmXQbUwWJ8mh6MGlkXeOZyaFgaz+ozdtKDuWcbxiT7UZopRP1Nv+dL/a7Dsmv7VNZ8WyQR0zSi4LKENZITFzIwak8K1f1wGdmqrO3hFm55R67IdZoKWI0R0tijJRppHYxtG/W9Yj5n9k3uBtAsE67sYl4rutTZA/WdISLIWgNpd4wbMUQHJLtHAL0f4pGpNCljDJZ4/XNd/4c98VyCAqK/zQRw0dvHN5SZ8TywbtDURz6RbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=5dsI6Woh3W1f447as+iTKtK9hHs4TC7SH+o6CyK6r/M=; b=TZoFG0sQtjAcrax7AnJZeFB0BQo3qoy9BkdPaodgtUvQxdCKW36XiLMkHr/xeU6OQ/a1XYPr6kKfQ7yfgthbGSN67hTGflFkXC9ZbF5rgQiMbxmnX295yE4GYU24Se6cGzFzUcojoVt6+YMMvhk3btoV/nn31uC2U6yr1CUwqd5T5knApCTpdeML4K9iqT7KG23cYAqnZOcd2rHIO91kGII6ch6Z3msSPqGY0WCbmIEou7ggvNK5KNZOMc53HppzU7MiKxPOm59hBvQg44Lg0kz2FTrePRkCZ6dJkI3BL408vwSqAOYZDXwreC/umuIXIw+bJRVOJ8OcP91rvJGwaw== Received: from MW4PR03CA0273.namprd03.prod.outlook.com (2603:10b6:303:b5::8) by BL0PR12MB4724.namprd12.prod.outlook.com (2603:10b6:208:87::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Fri, 22 Oct 2021 09:12:17 +0000 Received: from CO1NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b5:cafe::29) by MW4PR03CA0273.outlook.office365.com (2603:10b6:303:b5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Fri, 22 Oct 2021 09:12:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT038.mail.protection.outlook.com (10.13.174.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Fri, 22 Oct 2021 09:12:16 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 22 Oct 2021 09:12:11 +0000 From: Xueming Li To: CC: , Viacheslav Ovsiienko , Lior Margalit , Matan Azrad Date: Fri, 22 Oct 2021 17:11:38 +0800 Message-ID: <20211022091142.51397-5-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211022091142.51397-1-xuemingl@nvidia.com> References: <20210927083256.337450-1-xuemingl@nvidia.com> <20211022091142.51397-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b06a7cc0-2761-4966-8f4f-08d9953c0b53 X-MS-TrafficTypeDiagnostic: BL0PR12MB4724: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BgGYFCshGtZ5y9xSncr7xDMfDfLcYltwfigwOwwYBOCMSb/f2Ko4/KEqsdHnt7tk5XBf1PBXs1IWEJpUndYAJc7wQr/jnd6hr+xhXDzP6yns0A8b3W2WNOA12W1NWXvyB2D5/8jg0a4tKxxjUu58uwVI7qGk3OAOiNEE0iprS5baIii5Imwf26S7DTgJNROaTmXoDXCJ6sijQANpdcoRYHBuoEYkS8ssTVl5IT6jsfB8I5c/drvVpExlvCnUZFFrFFGoK0rUzdkPthNgbKy4GhWHdEJTWvSqcwwQS4FjyCwzis1mUVwV27Mvaa3QB63byMfA4Uv0KT1P/IH6LS0RwiZVbQLnqhwtWaL1LbWcbOMnFOXQ6G2NgPTVFX7Ybc2bUCX0sqjizVb7yLOLy7q3zQdHLjj4lks8orpetzjG6hAxp5lIEVqp0kj2Y94nH1imiB1MItl0a1OSZlMYR2CgB7z4QRZXZB+i2yi9cR3uwhPLWcX93NAah0Ibrl+kREAeQPorEr0sWHAhuKN7PiWTrjchsCxjq+ooJd0n47xKl17C28LzlJO9b7A4l4tcFFmuxSDnIH5YkfpUeNPbu4Ajm6pMT13r3075ZH2Qsw9DgduOArLaJsv5Ajbl3rIJ+VziZCebTx57JnSv5XkKv5b6YOYsacperqcLDHTz7BjzVkWJZjT8E0673RKiEQhRfFvFRN9rmXH2ZM817VixGKxKAw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(70586007)(8936002)(4326008)(1076003)(6916009)(356005)(2906002)(316002)(8676002)(5660300002)(70206006)(16526019)(55016002)(6286002)(36756003)(82310400003)(36860700001)(7696005)(6666004)(54906003)(508600001)(86362001)(83380400001)(2616005)(26005)(7636003)(47076005)(107886003)(336012)(426003)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2021 09:12:16.8148 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b06a7cc0-2761-4966-8f4f-08d9953c0b53 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4724 Subject: [dpdk-dev] [PATCH v4 4/8] net/mlx5: support E-Switch manager egress traffic match 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 Sender: "dev" For egress packet on representor, the vport ID in transport domain is E-Switch manager vport ID since representor shares resources of E-Switch manager. E-Switch manager vport ID and Tx queue internal device index are used to match representor egress packet. This patch adds flow item port ID match on E-Switch manager. E-Switch manager vport ID is 0xfffe on BlueField, 0 otherwise. Signed-off-by: Xueming Li Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.h | 3 +++ drivers/net/mlx5/mlx5_flow_dv.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 5c68d4f7d74..c25af8d9864 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -18,6 +18,9 @@ #include "mlx5.h" +/* E-Switch Manager port, used for rte_flow_item_port_id. */ +#define MLX5_PORT_ESW_MGR UINT32_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 f2fde912947..5b964153860 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -92,6 +93,23 @@ static int flow_dv_jump_tbl_resource_release(struct rte_eth_dev *dev, uint32_t rix_jump); +static int16_t +flow_dv_get_esw_manager_vport_id(struct rte_eth_dev *dev) +{ + struct mlx5_priv *priv = dev->data->dev_private; + + if (priv->pci_dev == NULL) + return 0; + switch (priv->pci_dev->id.device_id) { + case PCI_DEVICE_ID_MELLANOX_CONNECTX5BF: + case PCI_DEVICE_ID_MELLANOX_CONNECTX6DXBF: + case PCI_DEVICE_ID_MELLANOX_CONNECTX7BF: + return (int16_t)0xfffe; + default: + return 0; + } +} + /** * Initialize flow attributes structure according to flow items' types. * @@ -2184,6 +2202,8 @@ flow_dv_validate_item_port_id(struct rte_eth_dev *dev, return ret; if (!spec) return 0; + if (spec->id == MLX5_PORT_ESW_MGR) + return 0; esw_priv = mlx5_port_to_eswitch_info(spec->id, false); if (!esw_priv) return rte_flow_error_set(error, rte_errno, @@ -9575,6 +9595,11 @@ flow_dv_translate_item_port_id(struct rte_eth_dev *dev, void *matcher, struct mlx5_priv *priv; uint16_t mask, id; + if (pid_v && pid_v->id == MLX5_PORT_ESW_MGR) { + flow_dv_translate_item_source_vport(matcher, key, + flow_dv_get_esw_manager_vport_id(dev), 0xffff); + return 0; + } mask = pid_m ? pid_m->id : 0xffff; id = pid_v ? pid_v->id : dev->data->port_id; priv = mlx5_port_to_eswitch_info(id, item == NULL); -- 2.33.0