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 1CDF5A04A4; Wed, 2 Mar 2022 12:07:06 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA75042715; Wed, 2 Mar 2022 12:07:05 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2041.outbound.protection.outlook.com [40.107.220.41]) by mails.dpdk.org (Postfix) with ESMTP id D780040141; Wed, 2 Mar 2022 12:07:04 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iGiccU0bO8phBfcvwsgWC+dn/y/JWuHI7+Ni0iUMPjVdKK8HosSXeyNunBgbprwDkjchJP/yq/Gtdd6YkrIOH7GJsHgJSbBDcLVRRiI2K/X9hQUkud6DPxqUS5nuZmBtXqLDNAfRPvEs+054BA3kqSmHOOtsAx4FuEThQIYjj36FEW7GhGdxRAWOtAz2y1m+dBxyjSaffYMmNaONgKPQXnKovOpwbxstQZSJIBjdT56ExqZhCHFvkeV/e6RgQmpismEyx52ryfnqy8jwcadJ0bg+YBzDrPXCCS8eB5LF81j6W6zXgdXrhifgEXU3XlkjKzVcFgVn0qH2lTL47iNeAw== 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=eAvTt9Swm+pbKLMKT4mIW/PzHPESKxeNVzC8Esp27s0=; b=ZoUt7TdS4XHMk25ldD0YBFTpYky+FoizO/jzgFQ/6AR7Pw3F07VLWVojsRpuBLp8VflYEr2Zk2sMQnzVYE+Un9QuNHKvytMl87AxL9QZc7qlxUI7rg6/9fvpv4v5BCNINbAatLkpSQA71vHG8CFtuLebA/7LmM2wcigvAjUaSqsrh1IMO/Z83twRJtMDurKMxCW5p5HaYw+FysouClIeWHc9OdEadRu20/baaXhZVRYDuUEEattVupGyktFGPps2jYRo4OpbwJtiy1r56BYQCXeWjYbgj6QqgTKvq2VwqgpeDOPsMmYr35jMM/e2Hvw82Mjo0zhx4Queh629crPzfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) 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=eAvTt9Swm+pbKLMKT4mIW/PzHPESKxeNVzC8Esp27s0=; b=S882CISnzXO4j1rEDUNFTR/ChQ4LUTAaHn4GzDwVvi/A9CLFQfy7+RJ89KVq9JAHhqdH60Jzo79zRaehsJh0qTnV0Eu63xfbjjjk2G1RRMFvO+p7apFXHXzbUJXLcWNNxd+nQWkR8FP9wcxh4/4O67uPgeRZZvcBNqp8cUP9k8X+NppxwaX8GgOkK2/kvI4ausgbbUZqrssb/G/sAC3iR+EfRS0cQsnjearrkG+Gox69RyknwwkLY6VKRXY4SoITDrywqvQRBDkSBdN70CWDUsX62TAw0oVmc4eTewBArRg0WIy2thsEfkmzjqtDN98grJtp2kDsaShiYx7sQ+EEkw== Received: from DM5PR19CA0050.namprd19.prod.outlook.com (2603:10b6:3:116::12) by MN2PR12MB4991.namprd12.prod.outlook.com (2603:10b6:208:a4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.25; Wed, 2 Mar 2022 11:07:02 +0000 Received: from DM6NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:3:116:cafe::62) by DM5PR19CA0050.outlook.office365.com (2603:10b6:3:116::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14 via Frontend Transport; Wed, 2 Mar 2022 11:07:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT056.mail.protection.outlook.com (10.13.173.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5038.14 via Frontend Transport; Wed, 2 Mar 2022 11:07:02 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 2 Mar 2022 11:07:01 +0000 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.9; Wed, 2 Mar 2022 03:06:58 -0800 From: Gregory Etelson To: CC: , , , , Viacheslav Ovsiienko Subject: [PATCH] net/mlx5: fix flex item availability Date: Wed, 2 Mar 2022 13:06:42 +0200 Message-ID: <20220302110642.28496-1-getelson@nvidia.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5ada2f4-787a-460d-c168-08d9fc3cc74d X-MS-TrafficTypeDiagnostic: MN2PR12MB4991:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: se9/a/hNo9fUX/Se9zP5qpQIwMdk+HHwFinF09FX5CrPtuuwheHuEjMoH7zG5BNbu351MKlid3B2KFIjcXALK5yiwnkyBtzOxQLqQio5oWZsQHjuTwzaHMS0aY6AnlFCeWOxiClMNDIdUCQJhUhrsXzzsOIOLdmxUBZT438l97zEh6+5UfsuNeivhh4e5UprEEIYV4tiFPVqQL19tzBZ0/N5K8keblpdLGFxUeeX+iD8iN4YUndYtISjGy7kbIrBKYTIafX8GH+pVOirkQLvNTDdGYox1hMy//f9MZSL3tlkJm4f+DhwZ+vdRtpJe9cgjbco1G+1EcAYk3XeViQbbdfLBFH6QZGvo/ikhenZT4S6NUANBbPi6npOvuMhWtt5HMZbYzu4zvH+k+qf2V7hVbH3T6MZK1a5ADREFXk6wpYRIM3aGtAMXZxDHMgct6jVhOGURiqDJesvgcER5j8T5vxM/YQA72Sj2/zHs6RgpFB6N5OFDaXFe/Y9EYCmZY+IY2/2kH4VWIjwVY3NBkL4F4LFenQJrwZ4eDqXn+fC6aJJGTuOQPtrGu10HfhXwZvj9hmjTtqZOLM6AdHx//bh7ErfCzd2uKKD9mqjF9AaWUEaUAQAsP5SP6x1mVIxYt1jm0IJ6AjsxPMqt9TasUDjwp492WlMPr90CoxYFPI0Quv81hFGTzssWb97e2mJb+cqN1uEjVZ34Ks6nY2kpfr2+Q== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(47076005)(16526019)(336012)(186003)(36860700001)(83380400001)(426003)(6286002)(81166007)(86362001)(356005)(40460700003)(82310400004)(26005)(508600001)(2906002)(450100002)(70206006)(4326008)(70586007)(8676002)(54906003)(316002)(6916009)(7696005)(55016003)(8936002)(107886003)(5660300002)(6666004)(2616005)(1076003)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2022 11:07:02.0385 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5ada2f4-787a-460d-c168-08d9fc3cc74d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4991 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 Flex item availability is restricted to Blue Field 2 and Blue Field 3 PF ports. The patch validates port type compliance before proceeding to flex item creation. Cc: stable@dpdk.org Fixes: db25cadc0887 ("net/mlx5: add flex item operations") Signed-off-by: Gregory Etelson Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/linux/mlx5_common_os.h | 1 + drivers/net/mlx5/mlx5_flow.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/common/mlx5/linux/mlx5_common_os.h b/drivers/common/mlx5/linux/mlx5_common_os.h index a85f3b5f3c..27f1192205 100644 --- a/drivers/common/mlx5/linux/mlx5_common_os.h +++ b/drivers/common/mlx5/linux/mlx5_common_os.h @@ -9,6 +9,7 @@ #include #include +#include #include #include #include diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a690e2d337..ebff2c6409 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -10619,10 +10619,27 @@ mlx5_flow_flex_item_create(struct rte_eth_dev *dev, struct rte_flow_error *error) { static const char err_msg[] = "flex item creation unsupported"; + struct mlx5_priv *priv = dev->data->dev_private; struct rte_flow_attr attr = { .transfer = 0 }; const struct mlx5_flow_driver_ops *fops = flow_get_drv_ops(flow_get_drv_type(dev, &attr)); + if (!priv->pci_dev) { + rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, + "create flex item on PF only"); + return NULL; + } + switch (priv->pci_dev->id.device_id) { + case PCI_DEVICE_ID_MELLANOX_CONNECTX6DXBF: + case PCI_DEVICE_ID_MELLANOX_CONNECTX7BF: + break; + default: + rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, + "flex item available on Blue Field ports only"); + return NULL; + } if (!fops->item_create) { DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg); rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, -- 2.34.1