From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40072.outbound.protection.outlook.com [40.107.4.72]) by dpdk.org (Postfix) with ESMTP id 8668D1B3A2; Thu, 2 Aug 2018 03:06:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K/4lpzGFthpE7UaANveO5GxDbeOPBeKx92RtTyeynqk=; b=HWyaqhpKra7GfB+YlaQZhAWe83k/qVpAOnfuZ3OxDF5uKWx9IiQL2oi03cLd3YbZGqwV+O2GFu6hcV3IEndppa0/N+WDA8cB6lZEPkGXzYmFraiNzN7xndw65YTfJNibw9gtHD56FXfcRL6A4XXPc5YCglML37DDdjellP1aUuM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from mellanox.com (209.116.155.178) by AM5PR0501MB2034.eurprd05.prod.outlook.com (2603:10a6:203:1a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.19; Thu, 2 Aug 2018 01:06:12 +0000 From: Yongseok Koh To: shahafs@mellanox.com Cc: dev@dpdk.org, Yongseok Koh , stable@dpdk.org Date: Wed, 1 Aug 2018 18:05:56 -0700 Message-Id: <20180802010557.16648-1-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: MWHPR15CA0054.namprd15.prod.outlook.com (2603:10b6:301:4c::16) To AM5PR0501MB2034.eurprd05.prod.outlook.com (2603:10a6:203:1a::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 37d9f61f-1cb2-43bc-b664-08d5f8142466 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0501MB2034; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2034; 3:sia+6n+PQiWOI88sze8p6gc76BEnhwsfeUGwW6ji06CjZWh+CmuQINgAi9i/uWuLTRGOqB857RZzdim8bB5rADIu8pK6ThwLWwIc5b6gYbGePHNo6AxwQzB2POVVWmGr9zK+q2Liu1w9e4hwAzaviewQedsyYXhybA5b9iU28zG2po2Z5+vMeAWuA/u1gECcp/ki13vJNGLizWIDySz4pMv86iSeFxHXSOWuB7qCuH4hTXsndGB/mhM5qLsH8+dC; 25:i7qiOx7k+FOp0IpXHBhnO8V3ETQpmkRy1rVPXKRBXvI9lRfWP+VrI5Gq8hhb/ftQcceWNGvMtIGFHvzfQylT0eykd07wkKWp6FI1nLgfpm3AKoQ+zPUEe+/6DevMj9kSM1mOnxVgzdXgRgmaKJerCitf7pSOuawHT7rYdGdDzDD44KzWzzCNhkCy7lfnHIUIoDPc04e3duwgSInviL/9BVluUaGPUaEWNBf0s0xB2x5j+tSI/DbkRiuck93lHWJeMsoILV2Dx0k7asyEvdsF61kPYejEuhif0jp2Jr6U9+rZQGTRz9nPBAKHnjn9eiRa77sE6q4NKiY91DkeXvdwvg==; 31:gab4JG/j8EApknQt8RjG5xi37czyrDmtlrwD4v4z9FKUYLSA31bW6bquNpV9Dr72wrHbYWSVksjYNIsUelYWRBIonIqVP1ebUHu+TJcdGXIHP6FqlnKE56j8gomIMY+aDUtN870AuHAxHzOG0yYzAZ3GcySWOUi+dLZfj9bXmNNvkF0vozF7wp5p7luG2xFZYP6CanSQdMM1eGp+bl2Hg+jrSS39X3NXV2uvZAZCNjo= X-MS-TrafficTypeDiagnostic: AM5PR0501MB2034: X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2034; 20:+AyjATjT/4db2Xoc8XpjLl36KdgmDQ5oE/GxK3YiSTdA8yAFlmSUpo0GHXIXX10w+efGz5TazknFQaqetCGt7DhjhdKvwAuXO8Q5XpFI5o7yaNCSc4vF8cVp+9QqsRZFY8s7y0XqHSdDzGAC9zAO67FAU0g7Y3KdQD2oE0aB/DFQh15ypa9AwiAy8/VJLzV5G05heKAI+CBiFZQ0WPhoP37vQubbHP03gR/5raogo/dckZP33CfL5fpbzIXhCc7uACb2E9VSTA64cwp6SUfw9m2acKmGkHqGeI8yoSVyUwSwqN9VkxYyxJ+d5lQ4JGhS1YApSlHPCRRD0EBcNCTFvflx8fUsC2oQJl7w0L5IdsW+OyawmYay/XCEuwtcAMAqtSGerUJzC+UMeaScc7Z3bFOZYn9UdAi7ZBqDG8ikibkp4X+kqpYxuqvHPZL//DjSk1+mjNTRT8O0b4X+sF1ngh2HUMcsF5o6x0+1SP8eo89OxWnlQDFn+1RrZ9d7YuVM; 4:UKEpOyPVZ4GPfm+wLw/EOEUnv+xw/W27FZ1/CRKURIgkrwt34JsOh8vSTcc7GX97ioFT4u28jHTN2i1+r8Y8TnpliXGM+FXsScKkbd12V6DATTXgAdIo4cQnNrq/dwsI8UCkuKxGCf2Q8TJl/E3qw11JueBif37As3cPAz+rpKdJNHEcoP8LK+oyjcx+fzN8pi6R/nR5HI4JcG4pPVvd51+3SKGBw+5bZ0VKG55XPQVEVwdhnIsTlSrfox8gGVnNYfxK/exU7EZrzCVjO0kISw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:AM5PR0501MB2034; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0501MB2034; X-Forefront-PRVS: 07521929C1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(136003)(376002)(346002)(39860400002)(366004)(189003)(199004)(26005)(2616005)(6116002)(105586002)(25786009)(2351001)(486006)(956004)(8676002)(34206002)(4326008)(3846002)(386003)(86362001)(476003)(1076002)(55016002)(36756003)(106356001)(81156014)(50226002)(21086003)(81166006)(53936002)(47776003)(69596002)(97736004)(5660300001)(316002)(52116002)(37006003)(6666003)(48376002)(2361001)(6636002)(7736002)(66066001)(16526019)(50466002)(68736007)(450100002)(2906002)(14444005)(8936002)(305945005)(7696005)(51416003)(16586007)(478600001)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0501MB2034; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0501MB2034; 23:b5IXNmMPLUepmTIkrdUvhNMwWgWTKzgtnldG+sK?= =?us-ascii?Q?XkfRP39t6MpcaUK6X9TxIamh2r1eGiKpf7I6Rmpf3OhwCUbih8wzx0xncA7D?= =?us-ascii?Q?w2HBlOp5ozbjNBeYvQhDURPSETYrarsiq5uNeFm/2pBsYRia9YWJQ2uMjM58?= =?us-ascii?Q?wVv6Cz1rIPJyMMbcBKQB5EcjK8+/8bng6ndN+5krxvH6rC34lm7zF8N8EjPU?= =?us-ascii?Q?bc9EGi5ULeNFtKTEx7gRkqwke1Rh/U5hnv6PtHTqVmroTzsP62HtlW9JcoKj?= =?us-ascii?Q?FsG0lOczk1I2nmOvOg9EfG5DZjd08+5nlUnW0h+A0HCucWB2qKTC/YLmlJsy?= =?us-ascii?Q?uoHC+/vyIAd7OA7W3kwVQZy4nkQ1KXioHUej6yMi5bZPPTZMY84Nl1PaT/Cm?= =?us-ascii?Q?wr/aOC/csLYpD8hwqUInRNDoyTmjEnkQqgOT/ycG76i2S/w/9RqME1iOaV5A?= =?us-ascii?Q?1Ny4c4Kc/PS3bzPabJ+prkYGyGKjZMDAA4JxTve4Es0jFbQR0aejPNHB0Ma0?= =?us-ascii?Q?JaDGed3o8cqjEXdRriEZwfZk9zv0kLxnzzU/BO40LejKSj5JwU17shbQecqz?= =?us-ascii?Q?md3kg8XDtB4WPlmOb9vid95pCX7O2N5CGICTYCVtXLboVsL2YkeO35CWbA/7?= =?us-ascii?Q?jkx0rzFUDaCPo0J+PcLP9gZQcYS+ktlEcss7/r2cvlxKVoe1x+A4KkHU8J+W?= =?us-ascii?Q?o6mgfMMduURyefrhG+yuj0vUKa8LIjdaTHO17tei91LZbzMG5lCO4jv4dsHa?= =?us-ascii?Q?q0GiGlown7xh3uh/A9XDuLX2GCprSFaLROjRXKQcRbO600KJGOvtp1Spj9rx?= =?us-ascii?Q?OG1OyI3aAWGIetYRoT/w1StCSAhIKAfE31xUxO1hR7M/+pRrjLM3zvVO+2Ez?= =?us-ascii?Q?ilR73qam3Sydxgd9LdjDsz+Zj4lwTff0RySlEE8YiSmodd5rO4uq274zP4qK?= =?us-ascii?Q?iSKxXl1hY9QpVoHCpnlO8I7YbQm1Nza5ycYVC1/jIFoDeDzzcWXuwiD92+Q9?= =?us-ascii?Q?YEhJUQ2b8faBaIfvnRXtCMK8jttIYqx8fo7/TRK4RAdw8pAVOH6s5JuyF77I?= =?us-ascii?Q?ldJ+bOhnUb2tAX/glT46GVs8l74LFgGkeQ8+icztXSf+LgWHzlZ1/xBEn494?= =?us-ascii?Q?9wbxLg3cexBhJb6FLYoTyqdESuF9gUDAdYL0vgwtsUbleDGuE8p/aQmbbCFE?= =?us-ascii?Q?i1Dqc2MreI9mmoTAnemO6GdrPGF+IAcvcWExnAPMSSSFmUQo4MEnoDTj7j7A?= =?us-ascii?Q?/OIZ0YNHQUMDHKHPSHyVAAWiO8Aj0/MNLNU/CC1LT9TFp/IeCfsriPMa5cqm?= =?us-ascii?Q?xEw=3D=3D?= X-Microsoft-Antispam-Message-Info: vHNgNyJ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/8vs0/2dcsTQ7X1Ij087aHg9NlrMA2n82/B9EkyfKBwK0dPhIue7d5Lr5zPuPlBa/wtnmWbHWXsRRPuaEgPBsWTyl7sx1k2JwxDzuaAxemr9TfMKUtT/AvMaEhn0XhSRLxoAnZATpYHqEH6mdAuIvnS0/nqnMEhx/e+wVcyAzx5yhmKldAW2lXrMGr2qd5xpBCiT/GIuaiUom2GEv+WYFlWdyAWPcFzz SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2018 01:06:12.5912 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37d9f61f-1cb2-43bc-b664-08d5f8142466 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0501MB2034 Subject: [dpdk-dev] [PATCH 1/2] net/mlx5: preserve promisc flag for flow isolation mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Aug 2018 01:06:15 -0000 mlx5_dev_ops_isolate doesn't have APIs for enabling/disabling promiscuous mode as it can't be enabled in flow isolation mode. If the function pointers are null, librte APIs such as rte_eth_promiscuous_enable/disable() fail to set the flag (dev->data->promiscuous). Also, there's need to preserve promiscuous mode setting when toggling flow isolation mode. Promiscuous mode, if enabled, should be disabled when switching to flow isolation mode and vice versa. Fixes: 0887aa7f27f3 ("net/mlx5: add new operations for isolated mode") Cc: stable@dpdk.org Signed-off-by: Yongseok Koh --- drivers/net/mlx5/mlx5.c | 2 ++ drivers/net/mlx5/mlx5_flow.c | 16 ++++++++++++++-- drivers/net/mlx5/mlx5_rxmode.c | 8 ++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index e3e2a181ac..83b82f11ab 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -399,6 +399,8 @@ const struct eth_dev_ops mlx5_dev_ops_isolate = { .dev_set_link_down = mlx5_set_link_down, .dev_set_link_up = mlx5_set_link_up, .dev_close = mlx5_dev_close, + .promiscuous_enable = mlx5_promiscuous_enable, + .promiscuous_disable = mlx5_promiscuous_disable, .link_update = mlx5_link_update, .stats_get = mlx5_stats_get, .stats_reset = mlx5_stats_reset, diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 6c3021abac..268d1f056c 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -3335,10 +3335,22 @@ mlx5_flow_isolate(struct rte_eth_dev *dev, return -rte_errno; } priv->isolated = !!enable; - if (enable) + if (enable) { dev->dev_ops = &mlx5_dev_ops_isolate; - else + /* + * Disable unsupported features. Need to restore flag so that it + * can be re-enabled when switching out of isolated mode. + */ + if (dev->data->promiscuous) { + mlx5_promiscuous_disable(dev); + dev->data->promiscuous = 1; + } + } else { dev->dev_ops = &mlx5_dev_ops; + /* Take back disabled features if needed. */ + if (dev->data->promiscuous) + mlx5_promiscuous_enable(dev); + } return 0; } diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c index 80824bc43b..0ed4c1a174 100644 --- a/drivers/net/mlx5/mlx5_rxmode.c +++ b/drivers/net/mlx5/mlx5_rxmode.c @@ -32,10 +32,13 @@ void mlx5_promiscuous_enable(struct rte_eth_dev *dev) { + struct priv *priv = dev->data->dev_private; int ret; dev->data->promiscuous = 1; - if (((struct priv *)dev->data->dev_private)->config.vf) + if (priv->isolated) + return; + if (priv->config.vf) mlx5_nl_promisc(dev, 1); ret = mlx5_traffic_restart(dev); if (ret) @@ -52,10 +55,11 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev) void mlx5_promiscuous_disable(struct rte_eth_dev *dev) { + struct priv *priv = dev->data->dev_private; int ret; dev->data->promiscuous = 0; - if (((struct priv *)dev->data->dev_private)->config.vf) + if (priv->config.vf) mlx5_nl_promisc(dev, 0); ret = mlx5_traffic_restart(dev); if (ret) -- 2.11.0