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 C5E89A0C43; Tue, 19 Oct 2021 12:36:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 50F1F41151; Tue, 19 Oct 2021 12:35:54 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id 3BA074113F for ; Tue, 19 Oct 2021 12:35:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jN+g4mpRthCWjQI8oPL+T12axIV990AWTYLjS+PTuUpyQhUx9gNYJAFOG5zuW12IKqfHVSZSmntlINvCTKuJCdWkgetYspW/n2tBE8vO4f10Df2iTfvfPUSy8cOGiiOPEbXLzO2NOvhd38j73Cca93n+boe22DR7XsKW77RXGdEuQgUF/RtPImLwWA4dVzOvtDw84N8F7o9Dj8dwO+598vzf+2rOedS2/yVQ7c5Jz3/TuRT/SjhvN0WUhQ35d4N/bZlQVyAYKqCEgbgg8QK6NMSmTqDrcp8mP0D6wprS4GzFmbXEcHGkvoSj5eKfVetqJWxZMTeKMxVr3yM3Psc37g== 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=fl7g0E/Q2kj9bO094Z2B+ZROFPYBfoLFIyYIbOLogQQ=; b=VDHDx6RETEefUOBBCGRtR9CNzDiGMdu1vcM8e5vyVIrdWeog/gXveM4pHOXuNEZA85UsPgEiT1pDT4SxN2YFNg1KwL3eFa/qFnacPqXrEbPSoEL4Pc0SE/DxaIHqRNBJc9VMX9Agpon2ckh/F7ovE7O0ID3gLCJdHLXHuk4fG6psDhi+VASjSrDlTjBo/xHdJGp85EYanctWA4z7T3276czITDQJ1Y29kZiabpPrgLABMMVbNORVeK/S7g/T8+Ur5EW37zO+ri7fBn0n/ZVmJDGJhQAc964n/69QfAxKtTS6n10yAQek8PRojmecWwVcbb5X7610rz2ZWYFdbMMJDA== 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=fl7g0E/Q2kj9bO094Z2B+ZROFPYBfoLFIyYIbOLogQQ=; b=FdFyiKNrJ3kjI0l4kvKEPLz+71NPfdcvaBaLcDMr6iPVEJwI60W+9L43uVi9Nip8eQCrvM+v/Fo7F0PG+VBd/NMb8SRZlCZaDRFFNXzSp5aBlwEpJXMcrB3zpE3I6xgg/Fzp78bGHwlCHapHToK4gc0+BiFRdkGjcJaAFtEbAb/TiQ4271RQ90SvDpNCHfIlPzgS0bpsf88XAT7RSqkh4LkiCpxKfTY9Dzozjv3QpCoP4GdMRKcn3fm6JEztXY2pnOe5OFAa4kGnIrxNtIcw46VeYiVqt/ju2woqyJsB9hqQWtx0+Bnpea/xiNn1PNMZTkRrxaTlEiUhQCthBfkzlg== Received: from DM5PR2201CA0002.namprd22.prod.outlook.com (2603:10b6:4:14::12) by MWHPR12MB1293.namprd12.prod.outlook.com (2603:10b6:300:9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 10:35:49 +0000 Received: from DM6NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:4:14:cafe::2e) by DM5PR2201CA0002.outlook.office365.com (2603:10b6:4:14::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 10:35:49 +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 DM6NAM11FT017.mail.protection.outlook.com (10.13.172.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 10:35:49 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 19 Oct 2021 10:35:40 +0000 From: Xueming Li To: CC: , Viacheslav Ovsiienko , Lior Margalit , Matan Azrad Date: Tue, 19 Oct 2021 18:34:57 +0800 Message-ID: <20211019103501.2216840-5-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211019103501.2216840-1-xuemingl@nvidia.com> References: <20210927083256.337450-1-xuemingl@nvidia.com> <20211019103501.2216840-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] 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: d01e16a4-3f2a-4baf-c68f-08d992ec37ca X-MS-TrafficTypeDiagnostic: MWHPR12MB1293: 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: S8xgO4eekRlkWVKzri2OSefCAFCWD9UpGsdX1B5mfSPHol6FeL48zz3w/QI8cUEy4krzV7zRrdyIbCAtXkRDe6fMo8/UDxAefZ5pRvcEkeJjKyzREMZF0Nkk+DH5Q1jM/ZywSbAwQ5a2ucIrMpuRt+LIYUT1HyFDGyxOr8/t0LYdzeRZWBQovFPApqdCR/++BU5lyqGOKkCR8hiXDqvZzCtmlBtNNXFmFLY7G2Uw7uTfYc5oIyQVyVGyuRYnLp6dyjSZNDYLooigJ2jVChW/QgC7a88f388bNG9IVC8nUE45jwEIVNJUXqnoIZJ9WknEVIDzGJ20w/nIDihgFrLGCOyTRYZ5rI8j5sBwsHlwGZeFjo3Ku3dxBzLaXhnO4G68JuGM7YIPctUOKlgk5tNn9OCZoAchYqBEq5bTivFmdFV8LKeHv5Z2sJTu6KY9R07TEHgrzaw0iQV/JA7JlJZOSDtuHL8aPPKkvy1QlbahAVkCgcA3GD8iaBbouKY7xEcSNEnDqjnN6HSZTLj9WnmnUQVmxCTmJ0l8Rwrq/+a3lx8tBBleuxaKePYse8oL7bcV21Rwx/N8XdjGreM0tn3mr59CYJrRUtc7OIY7dc3+hCKPrE8ZJEJ26Q1M5u0WO7RpdVfyV25HzIp+092ApMzH+Hc9KBiQCzPvKWZlhyTxEA3Szkowvbw+DkS/BHQn26eLuzxp3Y359nZt6ETmNfoDvg== 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)(26005)(356005)(8936002)(70206006)(2616005)(426003)(86362001)(8676002)(1076003)(36756003)(7696005)(336012)(70586007)(47076005)(55016002)(6286002)(82310400003)(6666004)(2906002)(6916009)(5660300002)(36906005)(316002)(7636003)(107886003)(508600001)(54906003)(4326008)(36860700001)(186003)(16526019)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 10:35:49.4489 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d01e16a4-3f2a-4baf-c68f-08d992ec37ca 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: DM6NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1293 Subject: [dpdk-dev] [PATCH v3 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 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