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 8A9AAA034F; Sat, 16 Oct 2021 10:08:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C46C141142; Sat, 16 Oct 2021 10:08:11 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2061.outbound.protection.outlook.com [40.107.243.61]) by mails.dpdk.org (Postfix) with ESMTP id E679740041 for ; Sat, 16 Oct 2021 10:08:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cqVUqsW8bo4uhXq74LBs0PMmsAQeIPSVdwMzOloGINKNbhKgDrj8Qt8p4okWYJ7aWLTmqUBa0+klIcIac9BjUthGcDL/H6/lUcKZuq3wzqoeyNU6mXv/zkzqXR/voA1qsHYLueiisGUCg6qVcBxbWhktvdDwx4n8YPtEoLqMXGNgeShZ+RULQipicCl6ksh2RZB6HkkLPt2pkFGvfAoDlijeEv4xY1VTbf/6GsI/vTl2Df915piD/5nYwDCHqECLrkT9K/6QA+rcC/Um5KdFEtPUknjz9E+eGZuXHOPxbOUxIYA//YmuVJej2+cf+lHFduqLK0kif8W9Mvk0UTJBLw== 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=MrelYTIW+uJq2U4ystdkSicm2v0Mbwp2NpPlCOdeAI4=; b=H9f0LrquYB9V98pi4A0gf09hBZg3ZCU5osZnQg3TEuFwcmKd6uGwdB4Aevc4O6Kj1uVv+EULNv5JiTXny0KOrD3PmFsvHWDIbr2zLuwA+W04Yo2/NcX+lWDoVujJpBosKNCqfHUYIGQuY5ESXuCfEWec/5ohG7YNA2G/cx6Zm7m20fBmv75LQIQ6J5EoRn5ryZfSwnA9McOUjC+PUB7EC4PBuhOTxqgGcxRTe18FjO5dGNLbY1maa2qnlLKS6G7SeUO7NeycGwT/gMBclQNYXeuhD9N6DgpASy6Clpm+DqaBlnesCypRwhNmvbtGrYZ4fagE9Tf09kA5Y/Qk2io2Ug== 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=MrelYTIW+uJq2U4ystdkSicm2v0Mbwp2NpPlCOdeAI4=; b=QM8XzQ+fqVs21oFXscR5lkGwfj5X8dKkBj6IwcpBBIe92/H/megF2cIkK43KtYBVXXVqdQNCLPe1C1vRnpt11D1QwyOuUqh66Lactz98OIPm6omrT1jJBcaOQBu0IDnDkNVKr+BDJydVNYIj8YtzGJ/hMoWX7amuU8995qNrJKLjszcqCuynOjVwZe7O3FIg4JGxMw8VUmF6vsptv26WdRi2cdvc8bA47iG29XoXBRPvA6TubafnyH0bB217s7mLI02weMSmOH3RrDQIL2qc6YPdpNIa1fkyN97IyBL3ETqHitq0U84XoQ6l7fx6RBsopaKTrNrm4zosPQ4kP2PgnA== Received: from MWHPR19CA0093.namprd19.prod.outlook.com (2603:10b6:320:1f::31) by BY5PR12MB3987.namprd12.prod.outlook.com (2603:10b6:a03:1a8::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.25; Sat, 16 Oct 2021 08:08:08 +0000 Received: from CO1NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:320:1f:cafe::3e) by MWHPR19CA0093.outlook.office365.com (2603:10b6:320:1f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Sat, 16 Oct 2021 08:08:08 +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 CO1NAM11FT029.mail.protection.outlook.com (10.13.174.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Sat, 16 Oct 2021 08:08:07 +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; Sat, 16 Oct 2021 08:08:05 +0000 From: Xueming Li To: CC: , Viacheslav Ovsiienko , "Lior Margalit" , Matan Azrad Date: Sat, 16 Oct 2021 16:07:28 +0800 Message-ID: <20211016080732.1781622-5-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211016080732.1781622-1-xuemingl@nvidia.com> References: <20210927083256.337450-1-xuemingl@nvidia.com> <20211016080732.1781622-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: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 50101929-c4a3-4f0e-e9e8-08d9907c169a X-MS-TrafficTypeDiagnostic: BY5PR12MB3987: 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: qfsfnYKzsOm1jMgbuePcfmgB6pYx4gM5uu3AK2ZLsAzcRvl64artdEas/g1wJskMuJjlKAG6wB/feANlnjwf2tI9HsHc9ejZiAyEj6fApNAh/FsaGtitB6m+iAtXZTu4nXHsKq18z2/ExWqELd6NqHvs68YZ+Ez+C+s4164/3w7SHAKoJl4cfoYHTDvxQZHpm+QnWz0xcRuseViVbAAy1vD6HWWVn1cm0dDXtvt0QJSUNd37woOlMqbB49O+8oG+Fe3V9BlY8zS/Gc3T9pOOlvTp0nQYl2DX8y0VADFxnPsvG9j9vpMD1HsFZQIFOac4fxhsPjU/0L5vhLjlv4MPhoKk4Nl1Nm+n2APc9JhENFDBRoIzsaxWwoUNKcvz0Zmb0/lJaYMX01BEsj+hqS3Bc/ncI25M6l0yRUkzVRy4EzThoDY/EJwfLnde52+HWGknnH0zvkvr1H7vAMyR19ys1ODm68XhDyEUBzxq/esSdqKEATloyahrcvFQaa+Ou38+6lwDCp6DA87WMIz8OaC5BAQIlnDXTcZnRmisGF3y8AzV030DwUQ5jA+Ghznsg4r3F0AG8TGacziEo5oWtJQua87iOUjd0eKVFdQegHR2YVpNK18cBW9uNx2Lwi22FcRRLNMXLs95oR/zPGTE6uqZgsvG7h9b6PjklA3nIOGo3Isg+E5UsuIjWN1kuRBe7t4gQ8pdzdl03T/V2oaprRlqeQ== 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)(46966006)(36840700001)(16526019)(107886003)(7696005)(8936002)(70586007)(70206006)(55016002)(186003)(26005)(8676002)(6286002)(508600001)(1076003)(6666004)(5660300002)(54906003)(86362001)(4326008)(36756003)(2906002)(82310400003)(47076005)(316002)(36860700001)(83380400001)(336012)(7636003)(2616005)(356005)(6916009)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2021 08:08:07.7472 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 50101929-c4a3-4f0e-e9e8-08d9907c169a 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: CO1NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3987 Subject: [dpdk-dev] [PATCH v2 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 --- 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 c6370cd1d68..f06ce54f7e7 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. * @@ -2224,6 +2242,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, @@ -9685,6 +9705,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