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 22061A00BE; Sun, 10 Apr 2022 12:31:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E3FF40698; Sun, 10 Apr 2022 12:31:37 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2062.outbound.protection.outlook.com [40.107.236.62]) by mails.dpdk.org (Postfix) with ESMTP id 5655F4068C for ; Sun, 10 Apr 2022 12:31:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bx4MRJAH43EweZoKV9sQsLHb+iLaefYz3XB0TKaqYktHxOoLbsOut0XC3m1caV6b6v8KAXBVdkPufpzBzrtaE6ExyR9huehO0fGmBolcyzo3M5u5TBZwiqPkqJ8MftcInOcwYi87LoFRF69DmtLiCgI/oh1jk3Zv9TsYQL5FqngRehnwY9b+iQ4ZBWYWy4+HAXIiHsaNn+1FiMec8MpO3vmy6Xibtf4mEPS/E1dJ0aoRQIRfTWS4XQi5qclvPDhhFHUPfTgPmqA95ZxV7VifLIMEeDtW553RdW2/B1KLnUoePpLtjk58FrDzbRM73GVCVLMYLJrKZVDCWqmFK/QGrw== 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=uUYOwICzhQrfBTHae6n8BTEUNdRPPh5+W7fajAxl03c=; b=dtXs34RXe2qn3XZmg+gX1JdPcaKJisl+deaMrYJgZXmliHSXLDyyPdkkCmJiJo6BX3m1O/uOn7saYNC1+6uzpCESQidA5+w24viiW8phNIe5I4plh57O6BFwjBy+84LJ/9LeX3nIZsVDoXVvnqOCKj/PZFdiQG1632gPVC+VnsBRDBB7+4Bt7AJUZvhim+AOK9qGWImpe9C5WvZokkcL/H5FOw30rpAW5v/6f4tyq2y2zrAalQ/LlPxJmgbQsLSRKuBSVT8i/U9Isqp9ygCo1WWdxL/x9CL0F+B30OfTsimqE0lHEFXION0txOsXtQ5nTMFfX8RpGpTQFWiIuHjvPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=monjalon.net 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=uUYOwICzhQrfBTHae6n8BTEUNdRPPh5+W7fajAxl03c=; b=ECzSsyBfwpPWK0VyiGaoZqoU6bt2+otLveNV+BSkgpnTMLb7RdKbpVU5V2usTLD6GeQRpddMUk88ZEA0b3N1EveH8CLkv5AvtWFhoAb5i+Xy3SdTgyBlROaKTGn5+5PPdXGoXoA/YxdqW30DvGa+Q8UtbWV2Ps5VOET74x6Fwafv0lMP1c/CXEUxpFFNp7nhM3eUzAEvv9o6L3to4ZslYxrAkQT3IdtIf1uvIQJ16weK2t7nvIPZdAYpwe6v8UNxbKu0tWeOb+ocZUUvsF9SlC6VvumR0bSSgrB7YxYASaW0U4Tn8Gc9cpJFK2c3Qwj7OwekAhgEzEQK0rO3hqhBnA== Received: from DM6PR12CA0008.namprd12.prod.outlook.com (2603:10b6:5:1c0::21) by DM6PR12MB3609.namprd12.prod.outlook.com (2603:10b6:5:118::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.28; Sun, 10 Apr 2022 10:31:33 +0000 Received: from DM6NAM11FT042.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1c0:cafe::29) by DM6PR12CA0008.outlook.office365.com (2603:10b6:5:1c0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29 via Frontend Transport; Sun, 10 Apr 2022 10:31:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) 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.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by DM6NAM11FT042.mail.protection.outlook.com (10.13.173.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5144.20 via Frontend Transport; Sun, 10 Apr 2022 10:31:32 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Sun, 10 Apr 2022 10:31:27 +0000 Received: from nvidia.com (10.126.230.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.22; Sun, 10 Apr 2022 03:31:24 -0700 From: Adham Masarwah To: CC: , , , , , Subject: [PATCH 1/2] net/mlx5: add support for set promiscuous modes in Windows Date: Sun, 10 Apr 2022 13:31:06 +0300 Message-ID: <20220410103107.66964-2-adham@nvidia.com> X-Mailer: git-send-email 2.16.1.windows.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3c946858-4bd1-41cb-9d52-08da1add483a X-MS-TrafficTypeDiagnostic: DM6PR12MB3609:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr 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: sjF1dcIFce0GaMvgCio3fUGX9zK0byI5+a9IXEuC6xemILtV4mK7LEjTgvTqVvK6W3i//TrjbIvoUN09v+IKJXIlEx1uddmeiQdKDcvx69frShgdBfrBLZdHOvSvpzkjAah+319ERqcWpKByXcF4P9DG0+fxC9gScRkEO4dJdeM8g1JA7dWcUoKu2NeA/7NLgtkLEgO0mt8ofIt7k4DBtiSzWTb3gNa3wHymEq3c9CyEE9ZCh9m0XnCcYdR+COyX3mE7H6xMcsH05HZFeMrsEswfXtKRRynSkffF5GqHDliSLkybFndTfI2CFsrvNPq6U2q6XCPaAmhUnUDq9zmJfi7W5blDIgdkNsOJWvX6VftAdC/Wq5FGuN/Wf6BXzOmIXWfuyZ+fG9ev+7Ux1NtnQvIu70+kWh0+021WuSxrg7eDqydX2BFcmzP0eu/qbe+SXktEVowjIg6pJhhRaK2QJaYXob+7LUKvDqLU41187yiP+upYVKjAz4Dzy9ofqJ49vKCDjXqOK64YEiPt3Jow+PkNXTWd6A3XuHAH54NPITYFaq2jlsbXm7pXcrfk16a4zlDr0Frey6zCBDCughM6LsELgyjQatIKQqbr5H4kkMTU7LhAIzKzBd3iwxSr3cwuWK218jJoc4bvkJxso0PJFFOGLDjCjMIAR6OHe9DTmViZroZ4+3muIg3GrTH+MVEaao4fSWprRlF0ZwL9B7V5Nw== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(83380400001)(47076005)(336012)(426003)(508600001)(4326008)(70586007)(70206006)(316002)(54906003)(8676002)(186003)(16526019)(2906002)(7696005)(6916009)(36860700001)(107886003)(6286002)(26005)(2616005)(1076003)(6666004)(55016003)(86362001)(8936002)(82310400005)(36756003)(40460700003)(81166007)(5660300002)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2022 10:31:32.6992 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3c946858-4bd1-41cb-9d52-08da1add483a 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.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT042.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3609 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 Support of the set promiscuous modes by calling the new API In Mlx5DevX Lib. Added new glue API for Windows which will be used to communicate with Windows driver to enable/disable PROMISC or ALLMC. Signed-off-by: Adham Masarwah Tested-by: Idan Hackmon Acked-by: Matan Azard --- drivers/common/mlx5/windows/mlx5_glue.c | 31 +++++++++++++++++++++++++++++++ drivers/common/mlx5/windows/mlx5_glue.h | 6 ++++++ drivers/net/mlx5/windows/mlx5_os.c | 15 ++++++--------- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/drivers/common/mlx5/windows/mlx5_glue.c b/drivers/common/mlx5/windows/mlx5_glue.c index 535487a8d4..73d63ffd98 100644 --- a/drivers/common/mlx5/windows/mlx5_glue.c +++ b/drivers/common/mlx5/windows/mlx5_glue.c @@ -328,6 +328,36 @@ mlx5_glue_devx_init_showdown_event(void *ctx) return 0; } +static int +mlx5_glue_devx_set_promisc_vport(void *ctx, uint32_t promisc_type, uint8_t f_enable) +{ +#ifdef HAVE_DEVX_SET_PROMISC_SUPPORT + int devx_promisc_type = MLX5_DEVX_SET_PROMISC_VPORT_PROMISC_MODE; + struct mlx5_context *mlx5_ctx; + int err; + + if (!ctx) { + errno = EINVAL; + return errno; + } + mlx5_ctx = (struct mlx5_context *)ctx; + if (promisc_type == MC_PROMISC) + devx_promisc_type = MLX5_DEVX_SET_PROMISC_VPORT_ALL_MULTICAST; + err = devx_set_promisc_vport(mlx5_ctx->devx_ctx, devx_promisc_type, f_enable); + if (err) { + errno = err; + return errno; + } + return 0; +#else + (void)promisc_type; + (void)f_enable; + (void)ctx; + DRV_LOG(WARNING, "%s: is not supported", __func__); + return -ENOTSUP; +#endif +} + alignas(RTE_CACHE_LINE_SIZE) const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){ .version = MLX5_GLUE_VERSION, @@ -351,4 +381,5 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){ .devx_query_eqn = mlx5_glue_devx_query_eqn, .query_rt_values = mlx5_glue_query_rt_values, .devx_init_showdown_event = mlx5_glue_devx_init_showdown_event, + .devx_set_promisc_vport = mlx5_glue_devx_set_promisc_vport, }; diff --git a/drivers/common/mlx5/windows/mlx5_glue.h b/drivers/common/mlx5/windows/mlx5_glue.h index db8f2e8319..eae8070b3f 100644 --- a/drivers/common/mlx5/windows/mlx5_glue.h +++ b/drivers/common/mlx5/windows/mlx5_glue.h @@ -49,6 +49,11 @@ struct mlx5dv_dr_action_dest_attr { }; #endif +enum { + ALL_PROMISC, + MC_PROMISC, +}; + /* LIB_GLUE_VERSION must be updated every time this structure is modified. */ struct mlx5_glue { const char *version; @@ -87,6 +92,7 @@ struct mlx5_glue { int (*devx_query_eqn)(void *context, uint32_t cpus, uint32_t *eqn); int (*query_rt_values)(void *ctx, void *devx_clock); int (*devx_init_showdown_event)(void *ctx); + int (*devx_set_promisc_vport)(void *ctx, uint32_t promisc_type, uint8_t f_enable); }; extern const struct mlx5_glue *mlx5_glue; diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index c7bb81549e..77f04cc931 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -729,7 +729,6 @@ mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv, /** * Set device promiscuous mode - * Currently it has no support under Windows. * * @param dev * Pointer to Ethernet device structure. @@ -742,10 +741,9 @@ mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv, int mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable) { - (void)dev; - (void)enable; - DRV_LOG(WARNING, "%s: is not supported", __func__); - return -ENOTSUP; + struct mlx5_priv *priv = dev->data->dev_private; + + return mlx5_glue->devx_set_promisc_vport(priv->sh->cdev->ctx, ALL_PROMISC, enable); } /** @@ -762,10 +760,9 @@ mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable) int mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable) { - (void)dev; - (void)enable; - DRV_LOG(WARNING, "%s: is not supported", __func__); - return -ENOTSUP; + struct mlx5_priv *priv = dev->data->dev_private; + + return mlx5_glue->devx_set_promisc_vport(priv->sh->cdev->ctx, MC_PROMISC, enable); } /** -- 2.16.1.windows.4