From patchwork Tue Jul 28 09:10:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337667 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=IltUdIiO; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9rr2Mb3z9sR4 for ; Tue, 28 Jul 2020 19:11:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728441AbgG1JLH (ORCPT ); Tue, 28 Jul 2020 05:11:07 -0400 Received: from mail-eopbgr10065.outbound.protection.outlook.com ([40.107.1.65]:60054 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728338AbgG1JLG (ORCPT ); Tue, 28 Jul 2020 05:11:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kad26ETQu5jmzvowCBOkg6DeXQ6GvURPA2zzCweV287RlzxfgLAnLQwcYHjfy6zUTAVQ4ezWFPkLTLgo9qEbYvuG3EOBOLrU+ZoVFLDjYuWAJnnPTYtX9adSEo6y1yuFZVMEOTNymJoFjxsK7etCFpFtGcdDTP5sk7GAIxC/E5fNjmEaJN4bbfARlswiQ3hw/17jVb+dRtE93Hdxyhji0atfcf1d/wW/9endSPalb8aGWayo0k1Gyszsg7vfffOwx9HiEOfuDzd5ZzhqFJ2Ycdv/6efQ4PJ9LnByt0bZW4mVS2jVfbEULCUOOuj5NMd+BBc0LTKzpaq5OC1B4kMWnA== 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-SenderADCheck; bh=kZuiqMnHww19AJqPSPMRbEjF3BYq5StuylbJqNPBZd4=; b=Ev13FrefKviC7U7egrJn0uuWlKaUM6yzIj5AgsL64wdz1lXJp/rBEjVGj5JuJnEttcqfAP/OOaOp9bGLmfpTKRzGqtIiL/+eG4kVLxMM5T2IVekn9A+XTuOtsArMmBH1TzA66AAls/lBYjbILFs2d87yVY2s/HhGjFWxk5qSiNZR3udB6Vp9aDCA/FXZKeX1wsE/Sp/lzX+MpuddYCBe3UMdh645dvZELsvnxo3JF3Z7pRLQ3E4tBQvGM7Chu3IqJH8R3Je46q8gyLjZYFGsflHPSUou5nDiV0/fLteefFbUpf8+br6eApbQ1sKMfZtwaKEsc/yeR9/TCajQRRFNxQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=kZuiqMnHww19AJqPSPMRbEjF3BYq5StuylbJqNPBZd4=; b=IltUdIiO5whFNNdkSSPRhHIgPe7YoNCMLaX1rRkROiEZTlvf5xg5MbUz97/LgtLt1E8kzS3hNE6J6iUAZJW3A8QWtaO7m7hFzf+x2i/OKoY9ujCmkqLiu2PZxOWJT3BRThVaMvWsSru/syU6eKD6WaHgo7U+Cnt9rtuC3QkVj3U= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4879.eurprd05.prod.outlook.com (2603:10a6:803:5c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23; Tue, 28 Jul 2020 09:11:00 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:00 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Eli Cohen , Vlad Buslov , Saeed Mahameed Subject: [net 01/12] net/mlx5e: Hold reference on mirred devices while accessing them Date: Tue, 28 Jul 2020 02:10:24 -0700 Message-Id: <20200728091035.112067-2-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:10:58 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b1064b7d-c43f-4c25-f815-08d832d6255e X-MS-TrafficTypeDiagnostic: VI1PR05MB4879: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F8wdV45H7M4UqKQWJKv8EazfM317mBTlxXZv9eOq1AfHeRri4HAGJ7sOBFhZFBRKPJSCyMKglpAjugJ6jNEU6ZdSumR6ztbfQVmDocoJ63xkrCEarfJOKK70lv/ot6bYe7/l/tlIxxaoRa+3W4Y7lmLJ+N7D5LFwjqhvJgev5M/Y4SqwjW06RSorO6qayuOXGgLLARykC88xcSnWJnzEww4hcfmPcQpYpaWITq8JuW+mKxq+vni6Ul3BBQNtupoij3sIQEXVDjkXZ6mk95yST5my2ZBFn/ILwGx7ul7RmZXaCKPGBMpe9exXZCp6qpEOyAcGM09jBMdZ9xDHJJWTN8iBaR5lR92Wtj4xuVDFpukiizI3eMS+PC3OVmbMFAch X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(39860400002)(366004)(346002)(376002)(136003)(6512007)(1076003)(8676002)(86362001)(8936002)(2906002)(66946007)(66556008)(66476007)(107886003)(16526019)(2616005)(26005)(83380400001)(186003)(36756003)(6666004)(478600001)(956004)(52116002)(6506007)(54906003)(316002)(5660300002)(4326008)(110136005)(6486002)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ccyppewK2ngXXZhijb1piEuQLpBH7+col3TasUB/84UdRZ3hjNDVudAVK6y9M3HS6r7t13dl1fxSEQXsZb/xGrjAKCacbauFpfuZCJw9Cne5tMJVqM1ILkiqBo376BVCvRNk1n/Mq/t2odHKOmVyiDmgXU4vyHK/1PkY0g7oOgmjYzkP3PRxhikmxFwHA6e2CDniKcH5fr6wO1yPcGtQita4miaIYpl+d7qtUUyPSCgIoljlBls6gTYSnj2BPcidU9GIHCIHFqu+gwySzWvfrtkM2HuM3LJX5p6W+VgCZiMb08nKARdcWk1W9OV5a26M8/XHwLv4zpTGYElfus3faqsUjORVZ2QupSnVY/ElnsDMisnR24fkz50vfBUMrNhJbZo6g+ixaeny7phjsOLIbFxAbtyFtcBTDDBImTBJGtKI1HmkfybN14nMZdL5LEWeIJG0I5mcyzc4PJN3KequmZCtNO4UFMV3gdTh+UI7ZmY= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1064b7d-c43f-4c25-f815-08d832d6255e X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:00.6202 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LWW/gDejOQu2z5vFCP6kThsSNifNShsB+D40rU+gZNWR0DNYLWqx2iRKNuv0kB/YvBamAmjLilZZk+gipEUaVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4879 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eli Cohen Net devices might be removed. For example, a vxlan device could be deleted and its ifnidex would become invalid. Use dev_get_by_index() instead of __dev_get_by_index() to hold reference on the device while accessing it and release after done. Fixes: 3c37745ec614 ("net/mlx5e: Properly deal with encap flows add/del under neigh update") Signed-off-by: Eli Cohen Reviewed-by: Vlad Buslov Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index cc8412151ca09..518957d82b1ca 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -1327,10 +1327,14 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, continue; mirred_ifindex = parse_attr->mirred_ifindex[out_index]; - out_dev = __dev_get_by_index(dev_net(priv->netdev), - mirred_ifindex); + out_dev = dev_get_by_index(dev_net(priv->netdev), + mirred_ifindex); + if (!out_dev) + return -ENODEV; + err = mlx5e_attach_encap(priv, flow, out_dev, out_index, extack, &encap_dev, &encap_valid); + dev_put(out_dev); if (err) return err; From patchwork Tue Jul 28 09:10:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337670 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=MvKjP6XL; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9rw6rDmz9sTC for ; Tue, 28 Jul 2020 19:11:11 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728448AbgG1JLK (ORCPT ); Tue, 28 Jul 2020 05:11:10 -0400 Received: from mail-eopbgr10065.outbound.protection.outlook.com ([40.107.1.65]:60054 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727970AbgG1JLJ (ORCPT ); Tue, 28 Jul 2020 05:11:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nX0n6nMVfC1rpBciB/8DQgxbFXHM+WOngcrs7ySfXgM74b69m7D0Mb+5TFoqeRc8zPKjxq7EKcjypy31u52q1OeK9HEM1L6q0rmTee+JLfKGrymV01FVjLiN9QpRGpPuTPgi/eC7/YMUniPCMr3ipdjnriPbuiT+Z6jSVDBTbljJ2vN64at8UbKrvL+MYQj8qMSGAfk/Wx4btav/LMr6aUxOI5xr8tVB8YhC9YK1tb6B8zQ558ilmi+wz1Fd2EZlYBksJEApfTYy24+eSkgPxKqX7iHVMIwi4BkrRdYNJghI12zyn86MxyrhFHZo/YqllklnTGtpVjVjbDVil57z8Q== 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-SenderADCheck; bh=J7/1yDK+ivw9ePtT0Eql+6kkxMnJzsGiQRVpRr7tOCM=; b=lH9GA/UJO0k1P+v7PXP7nG3yKKwVgGjcczaHoCP/zH2/dBKh1KVw0I/MnnvhAvdblGdOce6xZeWTuWgpOrSfHyytM+oAIVon9hd8hNRKSnux/Lyvad26YMA5OeaPYGba/sAAcsc2gteyCYQGcV4BI0IEMb2qMRr/m4yNG6/memMaBNmr9xLLuqPgdKBLX8nLnYY5frjkMqt84RdEyPTHID22kGJLRLx7mmIsLbU+Po9XwMZux1idneGsDhw/QHIOHXH12JdsvQnSZK4RiTaHFpGmNJoxJPmGrmJB4WinXpiyscnoE0eqi6+5COhufIyzgvOtXJBAAeClEQ9xvO/oRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=J7/1yDK+ivw9ePtT0Eql+6kkxMnJzsGiQRVpRr7tOCM=; b=MvKjP6XLFOGrTkiqUKXnuJ/KXHeh5RApygatAV2CaM/z31AEqsKFJBnmiIlBgwyRxW1JJeRX6qk+GDdgoVl4Uo7zKQmsg4Df9rHwkg6gazY7Kiogdy5dEoRHD6awAWGjEYNunyMtWBMejHpGUfAk3fyJcd4h1Bpn4IiLD7keyc4= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4879.eurprd05.prod.outlook.com (2603:10a6:803:5c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23; Tue, 28 Jul 2020 09:11:03 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:03 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Parav Pandit , Roi Dayan , Saeed Mahameed Subject: [net 02/12] net/mlx5: E-switch, Destroy TSAR when fail to enable the mode Date: Tue, 28 Jul 2020 02:10:25 -0700 Message-Id: <20200728091035.112067-3-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:11:00 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9b78e00f-3a3f-4041-f2d3-08d832d626b6 X-MS-TrafficTypeDiagnostic: VI1PR05MB4879: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:576; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8nS+jhAcLLHe2Zd8urOa5xVfL9ULIOjyCw32tKH+EO54cyYt312B6koK0tEzBsPNiEDIw6bwN2YgG7gWPeRgGCrsULfx3XPzP5HfsTzKZ/2vsr0sSLliB6FbpVMurRGc3lK+wpTtivVZqWBpBbSMNOo4+tr/QIcH+9kO5M55g98lmNV5J3lJdFM1D2WECJu5cxlaQYLkT/4pUphfK0BAZQ/urgjhbweo8gyW3RJzs3wws39yXCYBJQDjOfvk3wG/UR1kPbUY+DBK78/Lkwic94T3m65YnatEi4VbtxqRen0GEH2+Ta8/Kv5ydKN9LPb5J+fa+0IxGVtTCCNwN7j9oMt0y3BIri5zK0QhinIYedXb6eM5bBGtDNt9x/t4mcH0 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(39860400002)(366004)(346002)(376002)(136003)(6512007)(1076003)(8676002)(86362001)(8936002)(2906002)(66946007)(66556008)(66476007)(107886003)(16526019)(2616005)(26005)(83380400001)(186003)(36756003)(6666004)(478600001)(956004)(52116002)(6506007)(54906003)(316002)(5660300002)(4326008)(110136005)(6486002)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 2fPJocj2idmpdSE6a6edZQqy1bVxIAkB6bgI8V4z7f/Eu9H7HspWqqn57+vvaKS2DbHIQklmoPX+JU0FYs23eVcUpR/6nK9MLboOu7EbZFgeW8eRRELBaCWQiZgRKHSYn/cgUu5TeqxBUpHDl7PSeEAtIcA0arZgQkGgTCdlH2lzO/GSk1vATZHpyAqSUD0rG+fgmx9F5aPjUJdPMcZe+Wnx9QKYhhPWtkaUF9VZd7crJNIFvHHM9Hnfs0PzXzsPDNV91oxKhc2pykJdN8ptIC5kB+bO3a1fqCpZl/0xhRFOZfXxd7F1/vmBySZNZwqOJJNZr+vGQjvsW1+mOSfSTuZ33YIeG2bu11GsRrqE3eEPai8KoXoCwzDYup1YXBHqUpxm2ZCraBECNwghtGXaWLkZu/U6M0rTprMWWayG6ly/TaQzNeQT0yJUNNd036OplcmXsKL/q6jG59Lv+luJO1mQWwVPVK9zCDJVvD823mw= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b78e00f-3a3f-4041-f2d3-08d832d626b6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:03.3921 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: e+4MVYy28p6eTJF5OPibT8noN9jAIMSsZxolUVY6DqAXBpITJUlnWjWZbb1MmU7jQt8Kq4GOPtshyy6h8o33bQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4879 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Parav Pandit When either esw_legacy_enable() or esw_offloads_enable() fails, code missed to destroy the created TSAR. Hence, add the missing call to destroy the TSAR. Fixes: 610090ebce92 ("net/mlx5: E-switch, Initialize TSAR Qos hardware block before its user vports") Signed-off-by: Parav Pandit Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 1116ab9bea6c5..9701f0f8be50b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1608,7 +1608,7 @@ int mlx5_eswitch_enable_locked(struct mlx5_eswitch *esw, int mode, int num_vfs) mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_ETH); } - + esw_destroy_tsar(esw); return err; } From patchwork Tue Jul 28 09:10:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337671 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=iXEvps/W; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9ry281Cz9sTK for ; Tue, 28 Jul 2020 19:11:14 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728454AbgG1JLN (ORCPT ); Tue, 28 Jul 2020 05:11:13 -0400 Received: from mail-eopbgr10068.outbound.protection.outlook.com ([40.107.1.68]:63277 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728338AbgG1JLL (ORCPT ); Tue, 28 Jul 2020 05:11:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eKj+EHXry4BwQgvFAmVirFw6CKSMqeLD+CT3VJOp/YvWiAHbyg7Q+CSP8yTFc9mhWdJqtYOWYmkIblkeaK9ZQr5F3shHHljhdwPTPQbFlDMhxK4QGbS7dvEZMBXdn33fK+aplPy+HXTMPeyFDrO5z9sqi6H9Pl/zfL+vXyDrey3lE1wSgCe6TemJgMMF9mbvyvpaxNwkQLzBOLWCl/4e2d4VTdIeyCtuW+gYtgnNno8x+R7L9vpAI95fG4qeSZOABWe/YuQVrPI1TmjdmzuhiwTn3Zkm36LG8Zl01SaG5SCK3E2sgGulESo+JM8923J/ViWC9p8cBujkJbHTDZWVCQ== 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-SenderADCheck; bh=gXrl47i8PA3EGMT5i4vfMZ74q6UW+TArcbHtIexVBKE=; b=jm0300+rF5a5PLi1+NgMS9tIv74NUYD54SWdbLAsdzK2spg/YSQ95rCzHpu7JznP15GhSHjMA85qwhTopDboioDKMwdUYxdXWf9IFQNxt4oD6+HtWNRzgg+ZfW2u4TdZiEQ6Zw9z2XLUiEjwhim3z03X0xD4GgbjhnS6TA3Z11n+0zla7JLy/6nnYalxsAYW9GQE36XD5LBGjvRyR6wge6u8YFIKRXnNDqCgmtgcf19E1GjfHkKZhFK5SYyOLsoASmfeQYGRZA7JIkFzCr5Jt8Vsg0wZORtUba7OW+FkZugYCnfSHBIKqMwrgaAUpRemuK0wWmzX47go02GAycX4eQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=gXrl47i8PA3EGMT5i4vfMZ74q6UW+TArcbHtIexVBKE=; b=iXEvps/W4+Nw6cUtrSDcOWtq2/LykG5M5sAqRGHdftpzO0Qea7ZU7QqtG3ZZ5fNkFhDeie0nRrgx9DryOpmWtKNZtBPL+WiFm+5Dsj6y2vBNiW5EPliuTDWs9uNGqeM7RGi2DgcsIazBR+4ywJ9Qi5sfyusIcUtEPgBBdhqL3Tg= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4638.eurprd05.prod.outlook.com (2603:10a6:802:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 09:11:06 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:06 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Parav Pandit , Roi Dayan , Saeed Mahameed Subject: [net 03/12] net/mlx5: E-switch, Destroy TSAR after reload interface Date: Tue, 28 Jul 2020 02:10:26 -0700 Message-Id: <20200728091035.112067-4-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:11:04 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cf8af54d-f32d-4156-eafc-08d832d628a7 X-MS-TrafficTypeDiagnostic: VI1PR05MB4638: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:79; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: URmUnt31lGrP8cUabnnDnkddFinS9z4zP2MCUJh8f02Ca2n1y1VYRZ6uJr9K4+pFue48koog9ZtTxesOBywB0AjqzLwGukVdpILdP1N5y9bbRWXJXuHrN4yQ8MNqXXmVJ3HTafSrCcZ/1a/ilTviRGF/Xoj7Fefph93uw02eTHPhi44CJxtDc5QRcG43z5yWTcrlrWLNZpcCRgL9nSNCg2jb/IU3cdNVs1Hfy41X8piVZPY/915pO/fVp7jpi3ATfIfRj82OAXwb9IICMxnlXQnak2vPwh1JQUFCFI2X70KJeoPHw768iFJEQ3lrztYNP6KKdg1DI8qq5nsUdpgPasoSryylIwmJLy2aK+BO9IdXEQwcHm8bLD9m6GfQB3IP X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(136003)(366004)(346002)(396003)(376002)(110136005)(52116002)(478600001)(956004)(54906003)(4326008)(8936002)(16526019)(107886003)(2616005)(186003)(6486002)(316002)(8676002)(83380400001)(6506007)(6512007)(86362001)(1076003)(5660300002)(26005)(66946007)(66476007)(66556008)(2906002)(36756003)(6666004)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: rBaXyqA2mGkURaPudPeHHObQVRpCnTyOK7acatcYe9Qfjx/mu1yHRFtqXzRcG2f7K0+zZ7BF0R9/kYQDwqlh/EyvMb88k0cSuVT1GMkpl7KHgKeCdPFanYs+ZkvCYHXdGPs6636tpONkTJVm9FMa3D2lxaAwqiy/1Nga6i0gRYI4N0W0ZPA8KQKgDWJrsgejRaVTv30l4F0tICMxjhcabX49d8FjdHxjaZAuHtJtLKypzl/wY0B27miU3njYGB3s4/jZvYD9Akr4M+o6jeeREosfNQ6v7htbFxK3xw04gzh6CTDDDmqY0vAXUcf+Omc6CS5d4WKY/OYoNTxj4d7lusOtrcc0+xpusplXWgdj1djYzxRWCYaGO+BPZNA7mEBTFLl98Ajtxai9jn1Itu/SVDjihmH6DOROUgI3ru8Scj12dpKwc5UTzTYQJwGC1A+AF2dsFHWe3pf6uEKb9ouSFS3nOOPs2CvOsyDSebUPQMg= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf8af54d-f32d-4156-eafc-08d832d628a7 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:06.3560 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: d4Kttu8B/nFBkicJzKNVGrwDhpQdQrKK2ns98qUoOJBYTg5pfY36n7O5byO8tZw8XZcMsx0ZiOBTyVuoBcAp8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4638 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Parav Pandit When eswitch offloads is enabled, TSAR is created before reloading the interfaces. However when eswitch offloads mode is disabled, TSAR is disabled before reloading the interfaces. To keep the eswitch enable/disable sequence as mirror, destroy TSAR after reloading the interfaces. Fixes: 1bd27b11c1df ("net/mlx5: Introduce E-switch QoS management") Signed-off-by: Parav Pandit Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 9701f0f8be50b..d9376627584e9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1653,8 +1653,6 @@ void mlx5_eswitch_disable_locked(struct mlx5_eswitch *esw, bool clear_vf) else if (esw->mode == MLX5_ESWITCH_OFFLOADS) esw_offloads_disable(esw); - esw_destroy_tsar(esw); - old_mode = esw->mode; esw->mode = MLX5_ESWITCH_NONE; @@ -1664,6 +1662,8 @@ void mlx5_eswitch_disable_locked(struct mlx5_eswitch *esw, bool clear_vf) mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_ETH); } + esw_destroy_tsar(esw); + if (clear_vf) mlx5_eswitch_clear_vf_vports_info(esw); } From patchwork Tue Jul 28 09:10:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337672 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=moXLk0ZR; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9s15DBlz9sR4 for ; Tue, 28 Jul 2020 19:11:17 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728413AbgG1JLR (ORCPT ); Tue, 28 Jul 2020 05:11:17 -0400 Received: from mail-eopbgr10068.outbound.protection.outlook.com ([40.107.1.68]:63277 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728451AbgG1JLP (ORCPT ); Tue, 28 Jul 2020 05:11:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K7supIg8fIGTf66C9vnsaw5C2/pUuD2eyST5K9SqdnegmpLa8Q39ZbTJ/r4QvYhdDtlwrvFgv+GEuwTPEOpn/3JO8mTAbZmr2Kja/1s8bj0Xoa9eCJfDVcFwtEPavsaVEW0RpefAmG+MIdHDDCeTWqsVuJj1utWaxo3RTTkV3aPXLfeeB2bjjtlJ9wvqhkqYyje1t5IgqRs5P2ODA2h7A7Fn3V3HAqBYa9Mso/6yPzstatRrEED5auuN7c5rfX8mwZQDtHpBpxUibgRI/tAlF2TF2hRsD0hPJg934/XaDuysP2SqjqfexG8FDcONlAO9ei7rCkzwijXtGW1r+wV28g== 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-SenderADCheck; bh=W8EwSVx2YsOzHa0mWr3FT/EvFj9ZeD3uENoUnVK0Log=; b=GcL4/zLR57gbRtfv95x/ZdZoyZlaYsCX7T5/7y/fs0iw5jhn/hLbR5bgKZxE48eyy3uNvqMw3aghGq0WkQzpSRYjzUy7/YDTZn/O91KLCblh7Y7rPqAcpvNcJgVbYYgdyc3yV1fh8emh4GI2zbTTNU2LwFu7YkMnS5utXI04FSFzbvbluPJC0zdk6P8chAQD0v9e8xcuNaLa/wGlKri7PlS4QnZA4Q+XtjyZem3QWFTaKmx/EIanzkR+gCcYw/HkqjhguddcSwKZ3xEyMyz0WbpEI/li3ixKwcFOATaIeBvDY0wooQzMXv7vShSFLH6BtTyzVF321kGO5nfEl7yEWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=W8EwSVx2YsOzHa0mWr3FT/EvFj9ZeD3uENoUnVK0Log=; b=moXLk0ZRub0VrBUCuI1/TBpU8BDZTo9/zdAxbxNydh2rFnGxOROBLRFBOC6vviH9Olp/6xo7EDe3E8awaHzc7cJIkPn7c6fLXY5ECnO+TrlER6NnQ0xvJgHtIttcloHvKuAyN1UmAmuK5cr3YFrQEzaIibejW6tN8q4d8QCx/+E= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4638.eurprd05.prod.outlook.com (2603:10a6:802:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 09:11:09 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:09 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Maor Gottlieb , Mark Bloch , Saeed Mahameed Subject: [net 04/12] net/mlx5: Fix forward to next namespace Date: Tue, 28 Jul 2020 02:10:27 -0700 Message-Id: <20200728091035.112067-5-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:11:06 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2cf70638-19aa-4586-72cb-08d832d62a61 X-MS-TrafficTypeDiagnostic: VI1PR05MB4638: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KA5yKFE4RyOqCpNikzCPdh5ZJXuh5jnnS4xE0nRL5hILg4CReRwpzoryEPtUFj07eFaRp6y+shrFA7vu5x+wg2JQglxYve/mhukNRN3HgSpbSPmHO5LfO2QbHUU5xDp4MVKdsq2v2wqXXKWBwIcdPaziLfxHzrJpo7oHRl3LTJ5R/BoGImt24eP6irA+7YN45zF64DXs5r/RVTcKBgDTEzccT4sHwO5D0Z6o59KcWBL8fJD+/MNClfTbuQY+4DQd1gCNiO8AFwYFJfOy4MJT1zT3G5qvQkDhvTQBuLMqlMbvgYoXbxp541yg11rUI07oHRcjPB/krc07xR/Wrucj9zTIYRGJyxBb7aqBE3DIWF4TRrSu3phPyPRsdOcZbx/Q X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(136003)(366004)(346002)(396003)(376002)(110136005)(52116002)(478600001)(956004)(54906003)(4326008)(8936002)(16526019)(107886003)(2616005)(186003)(6486002)(316002)(8676002)(83380400001)(6506007)(6512007)(86362001)(1076003)(5660300002)(26005)(66946007)(66476007)(66556008)(2906002)(36756003)(6666004)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: UGE1UHOdTEmhkoSh8JpdAppsRqsdo8OuhTK/RAqbk8i90S6RmJstaGuPhKMaYvE0Ea5tU3XMlg2R0S04kou5SlQMzl+NA+iXiBz0tDCNB/pEK7tYgk8QIBR/eAMUExKNSX7y6DGXFvsezHYoAAwxUewYLJ9CVIYjXFGsbtLrDez3sLKDsc+Y5bf2dFcxPjGbsUTmBo+W/IvhpgbBAeNRLxPV8jIEiJsfXQq2Say5nR5e4w2dL6Em3/EWyk39O7tHax/q5b6cryobcwtyKbUmolO2WY5pV5cbfKPLtGhhAeMEADIYmyCugtLId160mOXytr0QuBAPx7pKQQIasKUG9qW7d4zwOg3ZOKNMpX158/j8bPA2bjpglr8SopnbJIrL4f1xueKrUa87I6YR+YX3zGxJQ84crjhEL7oL/uaGZogqYX9JzHNab2paS+wmIAbsY8bW5lA9iwjn6K9wd41dsVcuHPbJXaPrlj8WJXZzYGI= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cf70638-19aa-4586-72cb-08d832d62a61 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:09.4094 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SOK9mNqaaFLw1JVmq6PpZ4ONt5P7MOfCDS0MiSl8ARU77EuOAXvc1o8QEPBv2wQSzIZX+2gmd/SETu0L19LtHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4638 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Maor Gottlieb The steering tree is as follow (nic RX as example): --------- |root_ns| --------- | -------------------------------- | | | ---------- ---------- --------- |p(prio)0| | p1 | | pn | ---------- ---------- --------- | | ---------------- --------------- |ns(e.g bypass)| |ns(e.g. lag) | ---------------- --------------- | | | ---- ---- ---- |p0| |p1| |pn| ---- ---- ---- | ---- |FT| ---- find_next_chained_ft(prio) returns the first flow table in the next priority. If prio is a parent of a flow table then it returns the first flow table in the next priority in the same namespace, else if prio is parent of namespace, then it should return the first flow table in the next namespace. Currently if the user requests to forward to next namespace, the code calls to find_next_chained_ft with the prio of the next namespace and not the prio of the namesapce itself. Fixes: 9254f8ed15b6 ("net/mlx5: Add support in forward to namespace") Signed-off-by: Maor Gottlieb Reviewed-by: Mark Bloch Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/fs_core.c | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 13e2fb79c21ae..2569bb6228b65 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -797,7 +797,7 @@ static struct mlx5_flow_table *find_closest_ft_recursive(struct fs_node *root, return ft; } -/* If reverse if false then return the first flow table in next priority of +/* If reverse is false then return the first flow table in next priority of * prio in the tree, else return the last flow table in the previous priority * of prio in the tree. */ @@ -829,34 +829,16 @@ static struct mlx5_flow_table *find_prev_chained_ft(struct fs_prio *prio) return find_closest_ft(prio, true); } -static struct fs_prio *find_fwd_ns_prio(struct mlx5_flow_root_namespace *root, - struct mlx5_flow_namespace *ns) -{ - struct mlx5_flow_namespace *root_ns = &root->ns; - struct fs_prio *iter_prio; - struct fs_prio *prio; - - fs_get_obj(prio, ns->node.parent); - list_for_each_entry(iter_prio, &root_ns->node.children, node.list) { - if (iter_prio == prio && - !list_is_last(&prio->node.children, &iter_prio->node.list)) - return list_next_entry(iter_prio, node.list); - } - return NULL; -} - static struct mlx5_flow_table *find_next_fwd_ft(struct mlx5_flow_table *ft, struct mlx5_flow_act *flow_act) { - struct mlx5_flow_root_namespace *root = find_root(&ft->node); struct fs_prio *prio; + bool next_ns; - if (flow_act->action & MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS) - prio = find_fwd_ns_prio(root, ft->ns); - else - fs_get_obj(prio, ft->node.parent); + next_ns = flow_act->action & MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS; + fs_get_obj(prio, next_ns ? ft->ns->node.parent : ft->node.parent); - return (prio) ? find_next_chained_ft(prio) : NULL; + return find_next_chained_ft(prio); } static int connect_fts_in_prio(struct mlx5_core_dev *dev, From patchwork Tue Jul 28 09:10:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337673 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=uCLv3lxN; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9s42TSHz9sR4 for ; Tue, 28 Jul 2020 19:11:20 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728466AbgG1JLT (ORCPT ); Tue, 28 Jul 2020 05:11:19 -0400 Received: from mail-eopbgr10068.outbound.protection.outlook.com ([40.107.1.68]:63277 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728338AbgG1JLS (ORCPT ); Tue, 28 Jul 2020 05:11:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K6J8rMFpIf9pPwKPszBRjrnkv2u0VetifptUhUvZTpFm8gT55Uq3HW9cfyUv3ati+Phn0OVyk2yG0OmHMnvqaJ9mP8VuNsAEJsWvDtMwDzJAQ6fDk6zMin4Y79nIPXzGvZIVk64J23iViTMEfnvp69XZ3z7YguWCj0DzByqhE1hKR+Upa1w95EOGzVrIwV9TRIHUXEu3/tXSisDVA/7H3L/4q3VFL3TE4vRJrhxWDKzZCqNxJuOP8woqOUe+DtYGrsWBvPYKG1QzhCKfQ6Luwlm3gwIeKYaQa+ousP2AAMmG+h8LGUo4FN6aOKmYVKskziztAJ5DCuVsP/TrsrazPg== 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-SenderADCheck; bh=VbS4hf242e7gV3+n9hr3DrvbJkJ5Xo4xW1uimBlEXUQ=; b=mOhzK++B2TZNvcJOBnNhFjJYDjvmB5+pKncopB+ElEgBzChj3m+xYGhu9lOCOccMvtG9jDSwoSSKlJ/OU4FewLdBxrP1VJACWzoDgBi/0x67qS3xLg1x8qiom0+2CwLTENW6krSJETGaRMhGxcOcJ0rq6yctLSjMS1ZOMrVKLzcffR3j8SYKkv2M9OTuJcOwweh0P5fvZFNrMTnTjFopaDU1rRh0aLGhy2At9yHSKKAHkMBGLvySR0E1HAit8PagnyoQXGar7xBQmA1sEeQ413J+m+J/YiokNMu6Jin+pv3s/yH5Bl15OeT17YyBlBDRtho+ZrVAr0zZSB9aJfiG8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=VbS4hf242e7gV3+n9hr3DrvbJkJ5Xo4xW1uimBlEXUQ=; b=uCLv3lxNastRRx/yeFHsPeaKChoKn5JpDMI/bydwi1RbucFGwuyCdEN+aOysOQVdHMIJke4RVWUhLA8m86MWLNpIhhRiZv9Q82XdaOHLtGbnHLBm3Z1863MN64kw1uQ/x37y/UNw5eWAFimrwkAUFTRV0KPGZrYhGZYYHdQ574Q= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4638.eurprd05.prod.outlook.com (2603:10a6:802:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 09:11:12 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:12 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Aya Levin , Tariq Toukan , Saeed Mahameed Subject: [net 05/12] net/mlx5e: Fix error path of device attach Date: Tue, 28 Jul 2020 02:10:28 -0700 Message-Id: <20200728091035.112067-6-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:11:09 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f34f4fd9-d2d1-4148-c856-08d832d62c00 X-MS-TrafficTypeDiagnostic: VI1PR05MB4638: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tUjmXN9bxFaHG/tYjvP8GlRgC1WxULnm8jyfmtJ/AgH1A2zRXX05WzL6Wgmf2aVNx8GMwNjRcK6pWsCnZfXAh4ewWR481aQC5cBFFOyreZ1T/+XQLg3a6S6wq45zen+9wXTofLUU9PRqkN70KtsVd7ZoNDl2VU/aZzL8ug9KeG2DObaSjUd0YPICD7ZRxWXytKhGnmqK7KHmD83JNSSLZIKjTTbj6dLvi8N/z6JpzpJa0sTgaDR/tVPDLPfY1cvEqOuJDQ1UZPlN8z0k3G4qToW3MB8nP5nNC9Uny5XcHzqlPgb2/LCsoU4gildac5TkONIKiF0ga8Ru1Q3MM5LSVZ1Ui0c0HCQcbHPBXycch9TGFYketcpAcVmVSbp2CWLd X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(136003)(366004)(346002)(396003)(376002)(110136005)(52116002)(478600001)(956004)(54906003)(4326008)(8936002)(16526019)(107886003)(2616005)(186003)(6486002)(316002)(8676002)(83380400001)(6506007)(6512007)(86362001)(1076003)(5660300002)(26005)(66946007)(66476007)(66556008)(2906002)(36756003)(6666004)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: D6CrSvFSuXql3c8wlXqccw3rYYTbU50WZEdsm/VrOV69bgvVL8vzkiuGW+4wZMFD99J8WC/WIaUF2s+Xn1jFZTHRFfyxh4EnteYwoYsS646J8J5NHpMJjzj9uBde2N3vo92z4GPTud+Xi0m0Zld+zE5ZP5l5j3mGYnj/hKUoljEJwLsCDrpDMquGpV/PdvbvQCVjNQ8iMQqm+NIz18+PTQ21rrBnHMkfCU5v///h46IDRjJKrXBRMWJUWapGS9qliHml8U3bln9gNMgoQSbcaK8h+3oIxaTKnviKJwe8OV4bQW2BWIVYN4KoedR9jYuu3OWUKjxhmp2eIwxr8R9UPStvCBmJciENCIbZpeXJbCmsbCivQlOX0eDPxoVcozjfXSa1bGPW1JH40RKp5F7n5+wlVOFvwetQI/9JqzrOU/VDXJTZbDbac8/vzSBkIOq0lSEoBLU0vDgmwT/Jm86rNJ1Rxx7pv+wn7i4f/fMAdDk= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f34f4fd9-d2d1-4148-c856-08d832d62c00 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:12.0360 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wRnxG/yjgf/4sToITLr0I/2VqBuiGczojfILp/bsXQNoZpCKtLHop5uZiyslk0/i8DOaSkx59oMCOvxsjlnL6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4638 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Aya Levin On failure to attach the netdev, fix the rollback by re-setting the device's state back to MLX5E_STATE_DESTROYING. Failing to attach doesn't stop statistics polling via .ndo_get_stats64. In this case, although the device is not attached, it falsely continues to query the firmware for counters. Setting the device's state back to MLX5E_STATE_DESTROYING prevents the firmware counters query. Fixes: 26e59d8077a3 ("net/mlx5e: Implement mlx5e interface attach/detach callbacks") Signed-off-by: Aya Levin Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 081f15074cac4..31f9ecae98df9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -5390,6 +5390,8 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv) profile->cleanup_tx(priv); out: + set_bit(MLX5E_STATE_DESTROYING, &priv->state); + cancel_work_sync(&priv->update_stats_work); return err; } From patchwork Tue Jul 28 09:10:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337674 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=Vb6iBFC8; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9s72pNnz9sR4 for ; Tue, 28 Jul 2020 19:11:23 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728472AbgG1JLW (ORCPT ); Tue, 28 Jul 2020 05:11:22 -0400 Received: from mail-eopbgr10068.outbound.protection.outlook.com ([40.107.1.68]:63277 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728451AbgG1JLV (ORCPT ); Tue, 28 Jul 2020 05:11:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dnTvAWYdlONkWO714hjhxH+DljlxsIXL/A1lMw6JRsrswIkkrJyYs1LFxCDSwGSA9BN0q7AZ+En0zfqKMhyB/Yq+q0zZGma1NQs/OJ6kl5BpEjJA5wYScR3ikpW2iJX2uJ5khSo0P9mmlYVEdXiggq1LKYW+Vt293q9s1+Xk8opd1KFcaCGGsTgIkwK3epDWVKMimp8L6qIlyWw4nt6UriY0V87/qnEBC144viCRUGi0lueIHKCqC2PIx1XdLd1iElbZ9jX74a++O54jF6L0LMAfLHIYJGbqYVJiniMb0sDsKnFJc2YgSnQGAkvnyMOzjuNmIVoJRcO4NkpzeEV1Dw== 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-SenderADCheck; bh=ACZeNjH8ov6MHwGPLpRS4RHYgUTvmLXBdaweiNEDfX4=; b=IeYuNKwwCyfwyzNqAMVtDSegDGoF9T0TKDZpNCGHn/jNgaE0relXoieknW4YPitVHXqmsmEUAYB2PyZq3SuLxdGwCChAd7wxyYSXQgR1giyE+9tIkIlQCnErXMni8vTtahb5zyBesSk8QmWN6WR89UCd4TaBHG3tu30kYMP7yBkyJEEZnvO8MSIdzfe5tmbBmOnQLrS/j5ArSFy7+uuZNvoO/Nde0sXUi3Ly6t+y7a4TmA3QsLFyRcBByto+D4yos0nTwtFtMlpwrN9MjQ7KYGvHx4ToRHXsuVdkQ5vWp/LlQrgM0foJrvp5w/opBGTHTHMODxeu//FARZwr5eK+/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=ACZeNjH8ov6MHwGPLpRS4RHYgUTvmLXBdaweiNEDfX4=; b=Vb6iBFC8lu9KFDtJWfXOXIoqy9hMPLjcFmybD6h8HeZR62sISULa8nlu4R23Ez3oAQnW4mTO4h4cGFO7umb/Y6A7L/Je8KBgLwhvYlMy8kpnAIpMXLvsT+WKU4cbY3nBQewvFvQsnLihYfrrNAfZfRBiRoFAcWx4xidI2tl0Uso= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4638.eurprd05.prod.outlook.com (2603:10a6:802:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 09:11:16 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:16 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Maor Dickman , Roi Dayan , Vlad Buslov , Saeed Mahameed Subject: [net 06/12] net/mlx5e: Fix missing cleanup of ethtool steering during rep rx cleanup Date: Tue, 28 Jul 2020 02:10:29 -0700 Message-Id: <20200728091035.112067-7-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:11:12 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d1708ec0-9131-42d1-d609-08d832d62dbb X-MS-TrafficTypeDiagnostic: VI1PR05MB4638: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:196; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kCO0S8fmlTbJ5RPFkl3a0vKUK7PBBtZab1PSL1Sg8oXWybhF/UcvA8YQixAeDxu/22ByoiT387e5/7zjjZCj2Io4kA1T9nT+7ySgFCbWg+rjFEKoX1VDnOdj/gF2inTpnBjmNoaOjJcL6rwQpLWjqDZgTLcgqct8U+M6L+hYxwb7n/0wlZTyRu5B78TFgcKfZQtlq3pI+Az8ekLMWJVAroEr4dxVInIoWHrqa8foSutybco9CP6Ua70Vrx2MTN6wijdlKd901b6XT7tKFqn/HbGtszpfVsdzZjEHN951A+mGdvVU/VWoshNbgFsdFcfqkR7KUcqEHF9SM/caqdR2/7AaYky/sgz4UaDBBMXq9CV4EoYEePfbApgZzcpOrsQB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(136003)(366004)(346002)(396003)(376002)(110136005)(52116002)(478600001)(956004)(54906003)(4326008)(8936002)(16526019)(107886003)(2616005)(186003)(6486002)(316002)(8676002)(6506007)(6512007)(86362001)(1076003)(5660300002)(26005)(66946007)(66476007)(66556008)(2906002)(36756003)(6666004)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: iGSU7uCxyV7fs9bq9eIh5UjLrx80wtNYoDtULkCZ71iTkLkEDSXNcEYrtbx5M5YSm99GEFpo2jXuksOS5slvXeSVO4VnkMKu8rX7eGqKwWCKhRotiw6eQ9sqeIl1L12BF2sC+sYISPHrjGYLsQNwMgQTn4V8uLnwgkv+9qoIqtq+uzenA5AmqW0p3fhJU+WaJC/NqGnKrVvEk8InQZ9kxHo7w7/0Whm+/t+gPdpBUhN5FTdu7E037KsRQ0/UjrXIRtxmcUaKwDxo3bt9Ug+/wJA/NM6kC8Ey5Gz1KdV9NKFhvMN/QkkssdXq4SJWUgVYPHGsbP50f2WUghfhy9qf7LUtEAYn1ss3iSE6eOQS8xYAOnNa8umYt2Kzg9SUwKbRwQ0061CDLaiuTdqVaCft8CM8TaCSjbXm9mh1BVGVC1MgZ8T3NDQu4dpBtXNQHDq9jA3gzRL4K1baEApDzyuq2onsHxDU7JOgTZZIeTHDgHQ= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1708ec0-9131-42d1-d609-08d832d62dbb X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:14.7978 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /F9rhVHBeewYaKzSXpPv6yxo6gYDoeO9Ebt7HVnlOcbuJKAl4xJtaen517YFUvaZe1+0sknrAHGBDb0wN+KUuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4638 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Maor Dickman The cited commit add initialization of ethtool steering during representor rx initializations without cleaning it up in representor rx cleanup, this may cause for stale ethtool flows to remain after moving back from switchdev mode to legacy mode. Fixed by calling ethtool steering cleanup during rep rx cleanup. Fixes: 6783e8b29f63 ("net/mlx5e: Init ethtool steering for representors") Signed-off-by: Maor Dickman Reviewed-by: Roi Dayan Reviewed-by: Vlad Buslov Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 006807e04eda3..8c294ab43f908 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -936,6 +936,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv) { + mlx5e_ethtool_cleanup_steering(priv); rep_vport_rx_rule_destroy(priv); mlx5e_destroy_rep_root_ft(priv); mlx5e_destroy_ttc_table(priv, &priv->fs.ttc); From patchwork Tue Jul 28 09:10:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337675 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=KEuWr47M; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9sD4MmZz9sR4 for ; Tue, 28 Jul 2020 19:11:28 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728475AbgG1JL0 (ORCPT ); Tue, 28 Jul 2020 05:11:26 -0400 Received: from mail-eopbgr10068.outbound.protection.outlook.com ([40.107.1.68]:63277 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728467AbgG1JLZ (ORCPT ); Tue, 28 Jul 2020 05:11:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ireb0wGn6+Ub0gMuNHVf6Lfb5XMzcEPa8uN1E2AxVaSVJAw1QOz3ugQD77hFtnWZGag7CHQiVuF3ws3OegZokZc18DxGKcStAl5Rwwt7GQFNqa/49fsHPmdYVVWUPc/eUTgVYBCUWm6Qi5RSuNf4JFmGumPvLq0Zkum4DOmJKOHauGPqXvmH3GR8uzoQuuBUtmyHlcr404KQLwjatNXfoHEu2RrvamtSBOqqU11ML3UDuK2Vji8bq6YnPRdpORU6lrh35atibPW7iGyaQmmUsYFFm42fWSbhIRjR0YonCyK7J2xeZuB2PagP6xPbLHESTe6sRBosGVrOksgo5lpyMA== 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-SenderADCheck; bh=VV289PZZjkgGraaKduzqeziAVHzELgEurwDPXhDJgC0=; b=SeCkysU7LYfg10GvpfLb7/WGEFIl7YyizFmxwmZxNM2X/hz8zXf3a19f6g0uH7okzY5LcCXIqmcp3HBNrteOed6D+IYKYAU1zSTl2diXFreDW1TOcS8XdwlAvMeevmcXqPHXLTqjH69Mpbv7/WjR5BPHAHLjnEUtSK+8A7gMGXrWwqxbeC9RkqMUNLiQtB2NHbBPEMqUhMM7YL6mtD6sufiQYN5fdSzJNS+WApyTQUzSoy+OoxN4EG+HgZ9BoPbf2B2lbZzMiZMhgVevGJaqISEllP2iCK+LpHBdrHfnb/zY1l6rTCp/Kv4NvzWoFLovSBmW1ijtUhdjLNKIi2b4+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=VV289PZZjkgGraaKduzqeziAVHzELgEurwDPXhDJgC0=; b=KEuWr47MOrbKWO+N9GVudQgexoNrhIWq5lE1y3xTJYLe2r5itblx7oFFfqDDFmjh/YZF0o8JwS1Y9iep0Y150lwVGTpXsWuDyRnamYZxlIJ0az7shNXP5jm7+KXPYaZSJxhB7cXatipVLk56BcegIZw1Ah0HfMeMahixp7ekiqM= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4638.eurprd05.prod.outlook.com (2603:10a6:802:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 09:11:20 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:20 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Eran Ben Elisha , Ariel Levkovich , Saeed Mahameed Subject: [net 07/12] net/mlx5: Fix a bug of using ptp channel index as pin index Date: Tue, 28 Jul 2020 02:10:30 -0700 Message-Id: <20200728091035.112067-8-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:11:17 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d16971aa-ddce-48d5-787d-08d832d63021 X-MS-TrafficTypeDiagnostic: VI1PR05MB4638: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f0fjFhWmTBHG3quYhCO5FbO0ZRQxDjx69F9fFgM5xWU3YUMld0oy56k78VZTZ87QM61WwFn8Ngvb0N1SzHsGYeGSaAclaIGCXjL+ltSVr3R9ctkERkGvKh45RFO5N+8HM0HnmlzQi0/fcyaFt9YpR08YvZiDfl+qy1Q6hAq6rXoTpE2kR8YcmJ1qjQMlWYPl83Hv04zBQpQ/Af/CgVq854dk+o3HEQ5/xFUrukxD30YNeOMKZnHzm0VthX1ZK7Xt1bewWUBN942CVGHl5TH1DbgpadXx6DEqgjvQXpuaqBTbHrnuUf20JD99LnySgOXkz0vEwHESrbMQvSgdxhov201WJR6PwMdAy0BA1ZE3RLTybfE4aGLH4XlS6My9YW37 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(136003)(366004)(346002)(396003)(376002)(110136005)(52116002)(478600001)(956004)(54906003)(4326008)(8936002)(16526019)(107886003)(2616005)(186003)(6486002)(316002)(8676002)(83380400001)(6506007)(6512007)(86362001)(1076003)(5660300002)(26005)(66946007)(66476007)(66556008)(2906002)(36756003)(6666004)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: WrqSvQ+pYF6fDeEvyBuj0RwQCq9GTvEbnwWqL+Ir/eHO/pZJffQWHf1y3LyTxCQOVeu1IaFiSwsbRSQvD1dHQAHe4GIQ5A7/vl7bG7Wp5JhqDY3wzcT4aqNEp3KrAwx+lBnFcoaArXG7WU3PXTnWJvcYdl7kySNV1OU3AvKLM/lkaha7Qn3BUi+SVhuaQUqosu90F/yr+zt0EkzJ5XJ9aS6g8bdykiiytnmFhaznBXl/i+E6JW4gQSRRJ8O7YRguUId77Jppn2QVzoukQKag3i0YaAOfbDjtArewQC37l6z8nyCAaOE27eLFd6eRExS0sebO13B8ClEbj8Oqk3dE857Ed6dQ1nHPX94YRWw16UfZTRAAnEC5r1LPR0PdLyGKSRQcymOj5AFPTU9yBOONbgRqaHx8syrAO1m+WaiVwyVsZn8IOsQ0CLuTstnrEjf2pVRa7l9cmoJaF7BUwMtno5uA/x/PKvCCFy5N9iEJO9E= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d16971aa-ddce-48d5-787d-08d832d63021 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:20.5202 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fki0IYjKc7IqCczWuUerughrAmum0Jjau5ehn56bWBO1euRamPAGcQ7+XxCHv8PxGz4SZPrKetIJ/31rOxcVoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4638 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eran Ben Elisha On PTP mlx5_ptp_enable(on=0) flow, driver mistakenly used channel index as pin index. After ptp patch marked in fixes tag was introduced, driver can freely call ptp_find_pin() as part of the .enable() callback. Fix driver mlx5_ptp_enable(on=0) flow to always use ptp_find_pin(). With that, Driver will use the correct pin index in mlx5_ptp_enable(on=0) flow. In addition, when initializing the pins, always set channel to zero. As all pins can be attached to all channels, let ptp_set_pinfunc() to move them between the channels. For stable branches, this fix to be applied only on kernels that includes both patches in fixes tag. Otherwise, mlx5_ptp_enable(on=0) will be stuck on pincfg_mux. Fixes: 62582a7ee783 ("ptp: Avoid deadlocks in the programmable pin code.") Fixes: ee7f12205abc ("net/mlx5e: Implement 1PPS support") Signed-off-by: Eran Ben Elisha Reviewed-by: Ariel Levkovich Signed-off-by: Saeed Mahameed --- .../ethernet/mellanox/mlx5/core/lib/clock.c | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index ef0706d15a5b7..c6967e1a560b7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c @@ -273,17 +273,17 @@ static int mlx5_extts_configure(struct ptp_clock_info *ptp, if (rq->extts.index >= clock->ptp_info.n_pins) return -EINVAL; + pin = ptp_find_pin(clock->ptp, PTP_PF_EXTTS, rq->extts.index); + if (pin < 0) + return -EBUSY; + if (on) { - pin = ptp_find_pin(clock->ptp, PTP_PF_EXTTS, rq->extts.index); - if (pin < 0) - return -EBUSY; pin_mode = MLX5_PIN_MODE_IN; pattern = !!(rq->extts.flags & PTP_FALLING_EDGE); field_select = MLX5_MTPPS_FS_PIN_MODE | MLX5_MTPPS_FS_PATTERN | MLX5_MTPPS_FS_ENABLE; } else { - pin = rq->extts.index; field_select = MLX5_MTPPS_FS_ENABLE; } @@ -331,12 +331,12 @@ static int mlx5_perout_configure(struct ptp_clock_info *ptp, if (rq->perout.index >= clock->ptp_info.n_pins) return -EINVAL; - if (on) { - pin = ptp_find_pin(clock->ptp, PTP_PF_PEROUT, - rq->perout.index); - if (pin < 0) - return -EBUSY; + pin = ptp_find_pin(clock->ptp, PTP_PF_PEROUT, + rq->perout.index); + if (pin < 0) + return -EBUSY; + if (on) { pin_mode = MLX5_PIN_MODE_OUT; pattern = MLX5_OUT_PATTERN_PERIODIC; ts.tv_sec = rq->perout.period.sec; @@ -362,7 +362,6 @@ static int mlx5_perout_configure(struct ptp_clock_info *ptp, MLX5_MTPPS_FS_ENABLE | MLX5_MTPPS_FS_TIME_STAMP; } else { - pin = rq->perout.index; field_select = MLX5_MTPPS_FS_ENABLE; } @@ -452,7 +451,7 @@ static int mlx5_init_pin_config(struct mlx5_clock *clock) "mlx5_pps%d", i); clock->ptp_info.pin_config[i].index = i; clock->ptp_info.pin_config[i].func = PTP_PF_NONE; - clock->ptp_info.pin_config[i].chan = i; + clock->ptp_info.pin_config[i].chan = 0; } return 0; From patchwork Tue Jul 28 09:10:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337678 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=pCVEgkZA; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9sQ6DqYz9sTK for ; Tue, 28 Jul 2020 19:11:38 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728482AbgG1JLa (ORCPT ); Tue, 28 Jul 2020 05:11:30 -0400 Received: from mail-eopbgr10068.outbound.protection.outlook.com ([40.107.1.68]:63277 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727957AbgG1JL3 (ORCPT ); Tue, 28 Jul 2020 05:11:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=biUPfKjcpC2moNBLumB2CZpBb5ZsIYvv0J0DjFLM8M67jyU+bWDyjJcw/WRkOY4Ol4d9OoFAh5jnI9dXr7km+uNqKTpoGDR3LaFrfSljixRW/5QH0/K7G7AzclLRDvg9XvjozhnftAj9b2gnmwym7S2IQKzhaQcB7VN4caMgY/cYaPFtC6bIyg9TLTy5y29atbsA1ERASEmMAF+eLh3CNTSX683cKyPAwpNDZyJsm/zazLpxJlmAfIpoN/de7UfcFb6BxCc2aXttDOJ7u8GT4o/o2rpT74H2Fg/QCDa3U5HKq8RdQqPoK+CApVKgRT1Cl6PnDiIR6IAEEFf665zbzQ== 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-SenderADCheck; bh=yh/WC1RGHuRNGr4ByxZYexAoCoMyD3n91nbAh5l8XQA=; b=T68kbznRfILYN2TILp1DsZIbrXsCc+zxpsAea7vlMCzn5+kNddbNcxn+l9yQbLnPyAYq+GC5uKiPot30AIVq98lp2U+bvK/2XJKla+YUMDLYy3biBksb9m6SWvuu1+U+LkZAYZgnL2PVUXnQZmzA9k9xMLObtstRrAGKIas6OlT/p1kyPxmNcLZRe7b3LVj2BO+uT2YcBUFFO+K/mwqRajvM37Vntveo2H//zmgrOrtYBYsMiTVSq/HGmmuzvRWoJjDWZGSpGl57cAUrBrIw9lg8MMkVbky/tMlHObl6lcaVuqVwH4fKNEs1QZWNQv9dIZunG590B9TnYn+/sSS7Vg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=yh/WC1RGHuRNGr4ByxZYexAoCoMyD3n91nbAh5l8XQA=; b=pCVEgkZAn8j9FNKiiXRVN5HA0Q39Fj1Dh+qzFpCiHw1J5m6rEhwufw97NBZH7JpZ96Snayl/Dicm/jTGGb17r/Oi9Tyzq82Qr9dQtA1567IO1RMpqd47yLxuZkfDX4KcmfmMFkfHUtYqPLxIcBth0tXF8RJ3l7i5C+cgpMm0VAo= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4638.eurprd05.prod.outlook.com (2603:10a6:802:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 09:11:24 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:24 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Eran Ben Elisha , Ariel Levkovich , Saeed Mahameed Subject: [net 08/12] net/mlx5: Verify Hardware supports requested ptp function on a given pin Date: Tue, 28 Jul 2020 02:10:31 -0700 Message-Id: <20200728091035.112067-9-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:11:22 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 789e4c8f-23da-423f-f905-08d832d63368 X-MS-TrafficTypeDiagnostic: VI1PR05MB4638: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2733; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lTnsr5fZtLWG+7ZrAIo5K0lYF+X63wJUjPWkdqfIZYc7ujP/ZU1KC12kU+ZXbu5mWUwhXBKj0QTJP4xrMYwxrSQ3pE9HlNwB9RNhaWVebatriFnlYFM4Kbm2vdq0NXxy/Ca3aqeyB2uXQFKoD+XKNduq8BQ9pQGWN0CIJcZEySTxDa8PogxHuE2VYmdBxu6+XlE63NHUrlW2OPKMu5KUlgakX57eqpgHxveBSiy8R/VeVkhSN3Rw8HokbZozFZOQSsFlDv5ZbTOGZ140tADJqAk+V37YXvOfSBCG/0DIH9RdJq4k6MLTPl8Z5yE+3DETVued4g8ljDJbk/Y9/2yWzGjKVMaEiB4sgvP9Tk+P0xSvAmJ5v9ZaLKGmiYXnGkmo X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(136003)(366004)(346002)(396003)(376002)(110136005)(52116002)(478600001)(956004)(54906003)(4326008)(8936002)(16526019)(107886003)(2616005)(186003)(6486002)(316002)(8676002)(15650500001)(83380400001)(6506007)(6512007)(86362001)(1076003)(5660300002)(26005)(66946007)(66476007)(66556008)(2906002)(36756003)(6666004)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: WXNHoUe2hHLls027BO09STNQyIQNTJBiRdQmjgtAkUfL+p9kEhu/pKGmI1HMLVa1csprvA0iUxyPvt4/P+OqImwosWxcMNiYB2BZD5PbBn6cgJVPi4bAzhtjjRy7T0qCAesFs7y4c5NQYQPx/b0vMI813CKn7lx+PsHIMHAYR1ZfsDpMZ6BmdMmM9MKXpxKVOVFPOhPP+YqU1Nu66cH298kckPglPo52Kc5kx/GuaMqQnmnuaCjCBvPH1sUt1a9OQo5kxhTDtsnVDmD/S17yF157GDseUHZQtqx8iU6VaDVCVVWdeA4LBQT/IMiAUmgulw5ellg6GkU6mC4Sar6Gdq5swn7OB4lBoU4DkL94hshSme6+j/GeX6NW96XP1SFZFl+R/7XUrVUf1+yztUfB097lOoeCbTwLdqJ3E4faCoZ2KByJy42eCIE+RPtp6N/VhXcF/gXcpfHRV4qpcGK6nP1wOZVOdSwzY4i1ZbqkAmQ= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 789e4c8f-23da-423f-f905-08d832d63368 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:24.2827 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yNbajUm/k19dIcbRjN6VxxHLHh6TRimTV709sM4MyGAVeUO2O1DbWvyz+yu8Ca4QLz59kVsJyrCD2VJ+14VtVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4638 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eran Ben Elisha Fix a bug where driver did not verify Hardware pin capabilities for PTP functions. Fixes: ee7f12205abc ("net/mlx5e: Implement 1PPS support") Signed-off-by: Eran Ben Elisha Reviewed-by: Ariel Levkovich Signed-off-by: Saeed Mahameed --- .../ethernet/mellanox/mlx5/core/lib/clock.c | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index c6967e1a560b7..284806e331bd8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c @@ -408,10 +408,31 @@ static int mlx5_ptp_enable(struct ptp_clock_info *ptp, return 0; } +enum { + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_IN = BIT(0), + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_OUT = BIT(1), +}; + static int mlx5_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin, enum ptp_pin_function func, unsigned int chan) { - return (func == PTP_PF_PHYSYNC) ? -EOPNOTSUPP : 0; + struct mlx5_clock *clock = container_of(ptp, struct mlx5_clock, + ptp_info); + + switch (func) { + case PTP_PF_NONE: + return 0; + case PTP_PF_EXTTS: + return !(clock->pps_info.pin_caps[pin] & + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_IN); + case PTP_PF_PEROUT: + return !(clock->pps_info.pin_caps[pin] & + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_OUT); + default: + return -EOPNOTSUPP; + } + + return -EOPNOTSUPP; } static const struct ptp_clock_info mlx5_ptp_clock_info = { From patchwork Tue Jul 28 09:10:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337676 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=NjZJaPeN; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9sM4xpDz9sSd for ; Tue, 28 Jul 2020 19:11:35 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728512AbgG1JLe (ORCPT ); Tue, 28 Jul 2020 05:11:34 -0400 Received: from mail-eopbgr10068.outbound.protection.outlook.com ([40.107.1.68]:63277 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728476AbgG1JLd (ORCPT ); Tue, 28 Jul 2020 05:11:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ERJFOsegWVVCB7rD1L8gUXGlwqDT2+PCYT7Q2oV/ytFzT2IE6lipsGTaVUsSVCEHCgfOqoKyYAQyQDLtvucZKCtaPOTOw0/4XFh4GyECpC/54YAft2Csg4E9r+skJowBN3auCNIJ6UMsfu0RBj4rAYSHTtCiEDOdqb1BZ60Ic78PQDtWuGvnGNnwWUenNV8+auS27e6KuQb6fEc4VKXwYHFj4c739Zb+7vnLv5+c6DLc4+29jUjW2N18chb7wJ3OLhCwKk18jp38nFLakRy45aRnttsjBcNd8WUkKYcHnvK5L4GHNp62JnyfJpnnBwvqV4sRE8YCu+le1qqgvtbE8g== 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-SenderADCheck; bh=DjhaxaNKOx/o/FA4SHNwtMrUSfbIn3A/PpFldpdRVbg=; b=jV1haHaBVKIISrlOrstOzLOMWHjgvdEOKs3f26eVmOSEwtusZkMEy55ggdsBcnnyTsAyiOG4i3ea0rn04uD5M3eoBO8ntUB1cv/bttZjy4ZUspMaUP3y1biqM3ClPIE4MTjYCy3+CCFi5lbcF32Fi33qULfW0eCZVN/hiNMlp2WIl6dquOWYThlYhceHqUFt1b7G6l53URb2xoaBWRdw0GnI2LGUpvNFbIEZksEKR616J+PrAZkoa5kN5D80I5xW9CT8uvrYR46Ig+D7DsW3edeck4mpoXVxNlh4LYIJdzlCqhCWCFOllSME3j5BbKUSjLepUnNswBWVu6AnM6ZP2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=DjhaxaNKOx/o/FA4SHNwtMrUSfbIn3A/PpFldpdRVbg=; b=NjZJaPeNcwXzWQOfgPD6rSS284BIsXYs+TvOidMkoUHJNVbB5XMH2KxO8mquse69Z7QJ5s4QyEX0zfHxn/QhJOZzLVv4FvMPGzImZhshJ3ib3OWMFfs+9F74R+7EeE9OhX9KJ6AxfXRJnHUtLZejJtNhiBpr/r2pAsZ6DEK5wq0= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4638.eurprd05.prod.outlook.com (2603:10a6:802:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 09:11:27 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:27 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Raed Salem , Roi Dayan , Vu Pham , Saeed Mahameed Subject: [net 09/12] net/mlx5e: Fix slab-out-of-bounds in mlx5e_rep_is_lag_netdev Date: Tue, 28 Jul 2020 02:10:32 -0700 Message-Id: <20200728091035.112067-10-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:11:24 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 087b0957-2f2d-4589-ceca-08d832d63548 X-MS-TrafficTypeDiagnostic: VI1PR05MB4638: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SofpeivuI92BJTD8HgnUSlJ0WZQvdBZVi4IsGaE8rEsKtSTNFYwqOG1Z6YKkvJZS4RNWQqj2D9ZtfU0YAqkE4xa9e/X4hTG2LGMPc4PEtRyOIvt0PcBvav+uTBk1IJmQWFrvHcgw2wxMVhu1whwURYln35u2gq9UlQ6DF3Xq2O24Gg0aUvjQ0v15PvDoOt3pO+AAXQ1BPMPgjcnMEvsk3gqr1DOyEMc2vQ5t+JdjnLZbcfi2lLjP7isizb5zxRFydu6RiovkKnq+bLfc0GQBMAk2jjivnkcyXf/lS64VnxSYhzVoyk/2an0jQdyMkwlGAEq+3nTWUDn3xKVvzzsKWl7s33JhNTD5fLPgH+cIOnGidzUvMdmKzfZAT1eJ2aNB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(136003)(366004)(346002)(396003)(376002)(110136005)(52116002)(478600001)(956004)(54906003)(4326008)(8936002)(16526019)(107886003)(2616005)(186003)(6486002)(316002)(8676002)(83380400001)(6506007)(6512007)(86362001)(1076003)(5660300002)(26005)(66946007)(66476007)(66556008)(2906002)(36756003)(6666004)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: qy+U2TMF8noUgC84PQfdKGunRThcUho28F+fl8qR746X22+V4WlqymcJbk+qtgM2FSf+j981PacfPp6lXIojbBZWPGPmnsbaVmnX2TKEEnIKCZTYHPRxQydU79GnVzEYD+U2PcmqwfzR6SHy52y4SFyTepCOCtm4/ilxVhmGEQLZnCBlbRxHb8Qrr0IL71TS1E2zQtUgEa199aUie8t5FqGT7K5IVsP7bXWh2jYPUmI0B0LQ6AS/zImnqfOZrspSv0L/akp7SDDfvASNjnvmTX3c+7dtrlJ4mBlsh5wK2/yiS/emt9TB0RKmH3/23LGQq2ZQHiR6/hNe6J2yKhEKzXa6jdW0Xb1PJUwKVCEZ4wl1TvpsOjlWFvUtzKIm115lP+mT8gk1H/YlKVroVhuJ+Tp7eNcCHHyjQ9myOoDyp50IJ+br6Cz21kH8lzltzxmpC5MDqpwExbiwjJixHNVQbmkrjHc7g7k5KTu0toj3uQ4= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 087b0957-2f2d-4589-ceca-08d832d63548 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:27.8421 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mLO5jKU/KK18M+tvdhjcOeYxMA0LV1Gqwz1LVXEEvO4e6+RSxehBgAN12gntDwkjbj6TW2UDm3L5fr0NBhK8Pg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4638 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Raed Salem mlx5e_rep_is_lag_netdev is used as first check as part of netdev events handler for bond device of non-uplink representors, this handler can get any netdevice under the same network namespace of mlx5e netdevice. Current code treats the netdev as mlx5e netdev and only later on verifies this, hence causes the following Kasan trace: [15402.744990] ================================================================== [15402.746942] BUG: KASAN: slab-out-of-bounds in mlx5e_rep_is_lag_netdev+0xcb/0xf0 [mlx5_core] [15402.749009] Read of size 8 at addr ffff880391f3f6b0 by task ovs-vswitchd/5347 [15402.752065] CPU: 7 PID: 5347 Comm: ovs-vswitchd Kdump: loaded Tainted: G B O --------- -t - 4.18.0-g3dcc204d291d-dirty #1 [15402.755349] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 [15402.757600] Call Trace: [15402.758968] dump_stack+0x71/0xab [15402.760427] print_address_description+0x6a/0x270 [15402.761969] kasan_report+0x179/0x2d0 [15402.763445] ? mlx5e_rep_is_lag_netdev+0xcb/0xf0 [mlx5_core] [15402.765121] mlx5e_rep_is_lag_netdev+0xcb/0xf0 [mlx5_core] [15402.766782] mlx5e_rep_esw_bond_netevent+0x129/0x620 [mlx5_core] Fix by deferring the violating access to be post the netdev verify check. Fixes: 7e51891a237f ("net/mlx5e: Use netdev events to set/del egress acl forward-to-vport rule") Signed-off-by: Raed Salem Reviewed-by: Roi Dayan Reviewed-by: Vu Pham Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c index bdb71332cbf2d..3e44e4d820c51 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c @@ -183,13 +183,16 @@ void mlx5e_rep_bond_unslave(struct mlx5_eswitch *esw, static bool mlx5e_rep_is_lag_netdev(struct net_device *netdev) { - struct mlx5e_priv *priv = netdev_priv(netdev); - struct mlx5e_rep_priv *rpriv = priv->ppriv; + struct mlx5e_rep_priv *rpriv; + struct mlx5e_priv *priv; /* A given netdev is not a representor or not a slave of LAG configuration */ if (!mlx5e_eswitch_rep(netdev) || !bond_slave_get_rtnl(netdev)) return false; + priv = netdev_priv(netdev); + rpriv = priv->ppriv; + /* Egress acl forward to vport is supported only non-uplink representor */ return rpriv->rep->vport != MLX5_VPORT_UPLINK; } From patchwork Tue Jul 28 09:10:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337677 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=VEnWw/6n; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9sQ1ffjz9sSd for ; Tue, 28 Jul 2020 19:11:38 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728516AbgG1JLh (ORCPT ); Tue, 28 Jul 2020 05:11:37 -0400 Received: from mail-eopbgr10068.outbound.protection.outlook.com ([40.107.1.68]:63277 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728403AbgG1JLf (ORCPT ); Tue, 28 Jul 2020 05:11:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S0/n82hQwUWyjQGgsbGbX8p3TktH0B6vOb3Lb5Y8GKh9frw8104IucJegoPiq3rsW/JBZpC5fLYpzvpKHOioDXBAJxYCx5rXio1K3hFM8ZU0D4Sk2R2YgMVGXeqGyyWLcmAVBCuRhGq93IYx/XNpkVJdDgli5F+k4KIxIbsvLzpcdy6yL5HXTbrwnsR0rJlKkM1grxdeixxmGRtAEkwPFTTZBpKQCSCANl5FZEeAw7XAYQaqtdNUocyfWw1OALOE3LORjH4pmAR19FLbufM2WmU6+82N6FbS5CxmYeAjFixeqfLemAm9CzmUXNh+kn3JVqDg/aw4WvdnB90lS2b4Tw== 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-SenderADCheck; bh=3eh8jFVtjX8y2ZaPHudui6VQ5uy62eUgokPfk15A2a0=; b=Xbpj5rLuYkZujAGNHFqaUsXMpdG1+E8Si7E6yXVV+O3mMzz785gkrPvP2XVOmnD16qxW6iX4U1pIQP3XolyYJjP4d8887EocWoEwB9CKlvtp23WAkXMVRYKOjJJNyEq+pFl01TPMnVsAnc+hGrgVNp+sKQ/M7MbJSiL+HzteTbwFbUPNNW/ww9dHifq/oW8lXuBkEnAh7DXagrC1RTtb2nTDWqEzG8RKvaUc2uH+6iKRrhPVUwZ+jxzxw89FHRujsFmwMDQECzerjQVb82AuBD9qsOy2532DVjH2bkQF7r6C4Z37AW8fyVh5lT1ku/uutZigftDAEL107v8LtuBa7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=3eh8jFVtjX8y2ZaPHudui6VQ5uy62eUgokPfk15A2a0=; b=VEnWw/6nQxnXdplwgQr94sjByuZimA0npc7D5D6fGMDTSdZjvIGMwVFHrCwS9tGI0gwmz/FlWqkCCbjLXgST7u4ljFbbf4wHnSrI8fJ3/YRMuQpxbNwpk7QzWRM4p3U9GP0F+iAK1qXk3rajlGFC3SzmmzRXB2y6dxvjzv/4sPA= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4638.eurprd05.prod.outlook.com (2603:10a6:802:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 09:11:32 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:31 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Eran Ben Elisha , Saeed Mahameed Subject: [net 10/12] net/mlx5: Query PPS pin operational status before registering it Date: Tue, 28 Jul 2020 02:10:33 -0700 Message-Id: <20200728091035.112067-11-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:11:29 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 33205a18-358a-4372-1254-08d832d637ad X-MS-TrafficTypeDiagnostic: VI1PR05MB4638: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eJtCEuYaNET/UHSLqoE1mEZLK8JpYrmgRVvxaSsWA86E9iZTXleZq889Z3aMfvaOQFmkm6OqBjdYstVdq7j5Ic7sWjiY1WyQ3dlQ6vduXqOSLKvtcVeo2heBopQih3/BrzVqnACZZwUhnaqysHqsvc7E+HS20mZ4Z+58Zpf+bTc3SOp/WSVRUeynnJA7cqIFm6FhUjRQo0K40Qb5d8R74Ww84F37nOZElKVdmeEdLFLQJ9q/GQegjLZLy5LQ9Mvv0yrc+aftCUB/3hvUxNu70EAzvOEfsB33njIqr+/tVIy2st7nJCFLxENpN8dvV3BnMNMxDuALZ7lW3jvtJ4AYHpt9oDJJFB3k/sC15ci6odfbIiGTpH3OHkufxip0MalE X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(136003)(366004)(346002)(396003)(376002)(110136005)(52116002)(478600001)(956004)(54906003)(4326008)(8936002)(16526019)(107886003)(2616005)(186003)(6486002)(316002)(8676002)(83380400001)(6506007)(6512007)(86362001)(1076003)(5660300002)(26005)(66946007)(66476007)(66556008)(2906002)(36756003)(6666004)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: kRrOBHC2DApmbtrrq2BfrV9PJ3qQ7hg9uwF8ceUvMqZqinI4SC/QZC8nMm+7d6YIXWl5/FDt41ZW0MFKdnFcJgtD6vEKiA3Bggm16aVzDV6AsMIUQhfxwNyCmgpImvPG4InMx7zPRmnoVOu/LVUAOGa301flr7JUbpnNbb5l2h5GmTUPgxiQOA3PPyZt3gfSksMO1JJLgcdVOciiY5yYHojxSoacvGdwjIbQB6RpNFQMRACifLFvY7iL+I2GhLXvunSFaPfConMLyoSmEXi/FefCOyBnJQlTKr8kWgMB/pvODz2kC8SVZZjZs2HYGxZWKwxwDFzvzsngxrzkQfZN+BOTJ2FjUmqpOL0GgaWxuvssr5teu31IgvC5sUI+oLkBuRmUjsjfuPDoKWkTqHoJArYcIcyFFBmV+5PSub2J8GHau3ffcg2SSDju2Y5MjrPT6kark3aoBU78HiO9xe+nuba+/O/WUZi5UQ7ovAcYgEc= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33205a18-358a-4372-1254-08d832d637ad X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:31.7972 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Nql3bLwQX7xbp9YLFBHVVxh9HN2IQvqk782ru+FwD+1NeIniacdkf5EUHFc+CDsIA11BrcNdXLFeqHPRbZfBMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4638 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eran Ben Elisha In a special configuration, a ConnectX6-Dx pin pps-out might be activated when driver is loaded. Fix the driver to always read the operational pin mode when registering it, and advertise it accordingly. Fixes: ee7f12205abc ("net/mlx5e: Implement 1PPS support") Signed-off-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed --- .../ethernet/mellanox/mlx5/core/lib/clock.c | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index 284806e331bd8..2d55b7c22c034 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c @@ -452,6 +452,38 @@ static const struct ptp_clock_info mlx5_ptp_clock_info = { .verify = NULL, }; +static int mlx5_query_mtpps_pin_mode(struct mlx5_core_dev *mdev, u8 pin, + u32 *mtpps, u32 mtpps_size) +{ + u32 in[MLX5_ST_SZ_DW(mtpps_reg)] = {}; + + MLX5_SET(mtpps_reg, in, pin, pin); + + return mlx5_core_access_reg(mdev, in, sizeof(in), mtpps, + mtpps_size, MLX5_REG_MTPPS, 0, 0); +} + +static int mlx5_get_pps_pin_mode(struct mlx5_clock *clock, u8 pin) +{ + struct mlx5_core_dev *mdev = clock->mdev; + u32 out[MLX5_ST_SZ_DW(mtpps_reg)] = {}; + u8 mode; + int err; + + err = mlx5_query_mtpps_pin_mode(mdev, pin, out, sizeof(out)); + if (err || !MLX5_GET(mtpps_reg, out, enable)) + return PTP_PF_NONE; + + mode = MLX5_GET(mtpps_reg, out, pin_mode); + + if (mode == MLX5_PIN_MODE_IN) + return PTP_PF_EXTTS; + else if (mode == MLX5_PIN_MODE_OUT) + return PTP_PF_PEROUT; + + return PTP_PF_NONE; +} + static int mlx5_init_pin_config(struct mlx5_clock *clock) { int i; @@ -471,7 +503,7 @@ static int mlx5_init_pin_config(struct mlx5_clock *clock) sizeof(clock->ptp_info.pin_config[i].name), "mlx5_pps%d", i); clock->ptp_info.pin_config[i].index = i; - clock->ptp_info.pin_config[i].func = PTP_PF_NONE; + clock->ptp_info.pin_config[i].func = mlx5_get_pps_pin_mode(clock, i); clock->ptp_info.pin_config[i].chan = 0; } From patchwork Tue Jul 28 09:10:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337679 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=kZnucxT7; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9sX4xfrz9sTC for ; Tue, 28 Jul 2020 19:11:44 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728524AbgG1JLn (ORCPT ); Tue, 28 Jul 2020 05:11:43 -0400 Received: from mail-eopbgr10059.outbound.protection.outlook.com ([40.107.1.59]:13383 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728403AbgG1JLn (ORCPT ); Tue, 28 Jul 2020 05:11:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HWhiRDLOwHjHX7+byzL5vId6oqwyJGlp9R5ETKtINIRRWRPn/s/pdWD2yRADrCUK2ukHE2LO03hZ0MWCpnLDwTM7aUtQ+VmBT2lodCmcbbSEYUjI8T59qsxRoROIjVAOAJznqMOKUu6PIEPSSZ3tNs7h7ktVatTmf6Cfcg9D/z4ozo8vvGC70I9NdcgZgjIfkU0DvhLFGJMLafyxTxL46LVV1rGfkp4/C1XoFVy+Dm7KsO7K9PhvPvFLi00azHIaGmBUjzr05LUIz01YeZ+xRTE1p5eh1uQqB3Ncigt0/WYHO9ODKy8vJmook/uJcaEz39VItIyC1XSlCcYKAlNy1g== 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-SenderADCheck; bh=gzGnnzeqa3Mt+G/zKrcVBdS+UfSwx8lwFyW3z0pA4GE=; b=HXRK0ZBUGIyOOR4S2T7Uy8Iyreq4gGhg+BYSHeWt78CkfKLDjAFPQVh3SPlkxGszfcQe0BaHyajQkLXKwDJM75hTdltR7DRhr6DJDKuI3COet/uXKaWynImYF86mOUgr+lXGwME+qv/pyf6tL6q/dmx5nXmWJKZK8xk9t299DhNn1MPp0HtO2R61ChMO3yk+XqKet0eOjhoKaQqTzYjrXInj2rhQq5gASEX2OOemIiJ0cD/Qwn9Gq7ZRi6qswg/+th/UE6SjpsSZR8nInBGxg5bx9p14Ynb2osoeKO1lHRaF/s8LxeaW/3CHWbGVNaS0aHmtYjNzPpvOLF4eqUcz4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=gzGnnzeqa3Mt+G/zKrcVBdS+UfSwx8lwFyW3z0pA4GE=; b=kZnucxT71xlRRuo0MK88joHm/gdHbl91ZhTmfiRAzTQ9WMqfX7AYUwLG4/iyqCBdCu+ZuwolYpqFuLml/fDEk8f15fwxDNJtdqiZ4EcgewJRbN7BHow2joZ2L14u8fiZIy9vCoK46vX5q/ZE9r5vM16mt/+cN6btNYC+v82m8QM= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4638.eurprd05.prod.outlook.com (2603:10a6:802:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 09:11:37 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:37 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Ron Diskin , Roi Dayan , Moshe Shemesh , Saeed Mahameed Subject: [net 11/12] net/mlx5e: Modify uplink state on interface up/down Date: Tue, 28 Jul 2020 02:10:34 -0700 Message-Id: <20200728091035.112067-12-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:11:33 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d575400e-d4aa-4cb8-15c5-08d832d63a2a X-MS-TrafficTypeDiagnostic: VI1PR05MB4638: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1775; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jRTSnpHwBPI6LkZ90s+lq0gUymna8NsdDsNr2tS1ZLekNNTCrJDHR+CPTUl0ma1o14U84R/9DPopfnYuGPR8G/6EH+FFRUbw//ZT2Muv8px8Q5R3wdq5dqjEJnAaoY1PsOPBbD8AbDCROfpbbSIIVXtA8VHxCdCJZk592ZG192Lu2APnRVqAyeLcEnZvzWQviZYZeVQSC7VGYF3LQ2YhavPS1XROcaRbrpOmjOel6Bo/nqvSowQ47rz44RSOiQsGy2QYLJW4+pLIpBjaUoH+r8bJ7V1hztlq3cEm8V/PYtGFmax4+rISenjQSvqFqil3PqzAbIv1xQjtQyAXpmxp5SZDq9bA8boXSi1G1SEAO+fOXqTw2PFEiTHwFZaWiWeK X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(136003)(366004)(346002)(396003)(376002)(110136005)(52116002)(478600001)(956004)(54906003)(4326008)(8936002)(16526019)(107886003)(2616005)(186003)(6486002)(316002)(8676002)(83380400001)(6506007)(6512007)(86362001)(1076003)(5660300002)(26005)(66946007)(66476007)(66556008)(2906002)(36756003)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OF2OeGLG8YKd34fbU4CBzxGZ4RdaX+SJa/qyfQh6J4kKsUKLOqyN3ONpvJsoG/qa/E/4VDuZc3+2K6ONpIDa78cHNN6LwaVkdLBqgBLVWXEsybkIogSrzTZ5P3m9cj7BFir15rVqq4cwbr7RVxh9E6Y0HpM5bKns/Q9B5Z9Uhl386EfljWShTvRbSw3ebkIkARXeh9rVacYwgoVfJEgFIoJA4KHazcaZZRlwps3mkqBe39Jl61foEJS4b+/uym1AGQPlY+dTW/oKcOUZi6RxJa7WJBHhFzrH6jYarW0SXnT55nwj/QfNCqHoAzL0LZNPCJR/zzD7DPn6uS2xfdcnYbj7N094zc8643Xt9BKSsEasr60PuyfLQIKF9rx8tK+rs++foS+LEGZaACtuZMNdChiIduxMDa23iqEvaq+4L99o1lVdJmkE7PFjxsYvuqcR/UL8a2gS5TZVLKp+oHyi8ZG1bRArajQu4GzYB3hVyZo= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d575400e-d4aa-4cb8-15c5-08d832d63a2a X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:37.2326 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FfDgRBefB0Kq3+KQ1Y5sEMZv1Ik3a7FWrmj91JkJsaSdgOpT5scy5z2a824RYpzNygPuXVJ+mtDWS8uJsq/QuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4638 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ron Diskin When setting the PF interface up/down, notify the firmware to update uplink state via MODIFY_VPORT_STATE. This behavior will prevent sending traffic out on uplink port when PF is down, such as sending traffic from a VF interface which is still up. Currently when calling mlx5e_open/close(), the driver only sends PAOS command to notify the firmware to set the physical port state to up/down, however, it is not sufficient. When VF is in "auto" state, it follows the uplink state, which was not updated on mlx5e_open/close() before this patch. Fixes: 63bfd399de55 ("net/mlx5e: Send PAOS command on interface up/down") Signed-off-by: Ron Diskin Reviewed-by: Roi Dayan Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/en_main.c | 25 ++++++++++++++++--- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 2 ++ .../net/ethernet/mellanox/mlx5/core/eswitch.c | 16 +++++++----- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 2 ++ include/linux/mlx5/mlx5_ifc.h | 1 + 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 31f9ecae98df9..07fdbea7ea13b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3069,6 +3069,25 @@ void mlx5e_timestamp_init(struct mlx5e_priv *priv) priv->tstamp.rx_filter = HWTSTAMP_FILTER_NONE; } +static void mlx5e_modify_admin_state(struct mlx5_core_dev *mdev, + enum mlx5_port_status state) +{ + struct mlx5_eswitch *esw = mdev->priv.eswitch; + int vport_admin_state; + + mlx5_set_port_admin_status(mdev, state); + + if (!MLX5_ESWITCH_MANAGER(mdev) || mlx5_eswitch_mode(esw) == MLX5_ESWITCH_OFFLOADS) + return; + + if (state == MLX5_PORT_UP) + vport_admin_state = MLX5_VPORT_ADMIN_STATE_AUTO; + else + vport_admin_state = MLX5_VPORT_ADMIN_STATE_DOWN; + + mlx5_eswitch_set_vport_state(esw, MLX5_VPORT_UPLINK, vport_admin_state); +} + int mlx5e_open_locked(struct net_device *netdev) { struct mlx5e_priv *priv = netdev_priv(netdev); @@ -3101,7 +3120,7 @@ int mlx5e_open(struct net_device *netdev) mutex_lock(&priv->state_lock); err = mlx5e_open_locked(netdev); if (!err) - mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP); + mlx5e_modify_admin_state(priv->mdev, MLX5_PORT_UP); mutex_unlock(&priv->state_lock); return err; @@ -3135,7 +3154,7 @@ int mlx5e_close(struct net_device *netdev) return -ENODEV; mutex_lock(&priv->state_lock); - mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_DOWN); + mlx5e_modify_admin_state(priv->mdev, MLX5_PORT_DOWN); err = mlx5e_close_locked(netdev); mutex_unlock(&priv->state_lock); @@ -5182,7 +5201,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv) /* Marking the link as currently not needed by the Driver */ if (!netif_running(netdev)) - mlx5_set_port_admin_status(mdev, MLX5_PORT_DOWN); + mlx5e_modify_admin_state(mdev, MLX5_PORT_DOWN); mlx5e_set_netdev_mtu_boundaries(priv); mlx5e_set_dev_port_mtu(priv); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 8c294ab43f908..9519a61bd8ec5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -1081,6 +1081,8 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv) mlx5e_rep_tc_enable(priv); + mlx5_modify_vport_admin_state(mdev, MLX5_VPORT_STATE_OP_MOD_UPLINK, + 0, 0, MLX5_VPORT_ADMIN_STATE_AUTO); mlx5_lag_add(mdev, netdev); priv->events_nb.notifier_call = uplink_rep_async_event; mlx5_notifier_register(mdev, &priv->events_nb); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index d9376627584e9..71d01143c4556 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1826,6 +1826,8 @@ int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw, u16 vport, int link_state) { struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); + int opmod = MLX5_VPORT_STATE_OP_MOD_ESW_VPORT; + int other_vport = 1; int err = 0; if (!ESW_ALLOWED(esw)) @@ -1833,15 +1835,17 @@ int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw, if (IS_ERR(evport)) return PTR_ERR(evport); + if (vport == MLX5_VPORT_UPLINK) { + opmod = MLX5_VPORT_STATE_OP_MOD_UPLINK; + other_vport = 0; + vport = 0; + } mutex_lock(&esw->state_lock); - err = mlx5_modify_vport_admin_state(esw->dev, - MLX5_VPORT_STATE_OP_MOD_ESW_VPORT, - vport, 1, link_state); + err = mlx5_modify_vport_admin_state(esw->dev, opmod, vport, other_vport, link_state); if (err) { - mlx5_core_warn(esw->dev, - "Failed to set vport %d link state, err = %d", - vport, err); + mlx5_core_warn(esw->dev, "Failed to set vport %d link state, opmod = %d, err = %d", + vport, opmod, err); goto unlock; } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index a5175e98c0b34..5785596f13f5b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h @@ -680,6 +680,8 @@ static inline int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int num_vfs) { r static inline void mlx5_eswitch_disable(struct mlx5_eswitch *esw, bool clear_vf) {} static inline bool mlx5_esw_lag_prereq(struct mlx5_core_dev *dev0, struct mlx5_core_dev *dev1) { return true; } static inline bool mlx5_eswitch_is_funcs_handler(struct mlx5_core_dev *dev) { return false; } +static inline +int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw, u16 vport, int link_state) { return 0; } static inline const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev) { return ERR_PTR(-EOPNOTSUPP); diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 073b79eacc991..1340e02b14ef2 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -4381,6 +4381,7 @@ struct mlx5_ifc_query_vport_state_out_bits { enum { MLX5_VPORT_STATE_OP_MOD_VNIC_VPORT = 0x0, MLX5_VPORT_STATE_OP_MOD_ESW_VPORT = 0x1, + MLX5_VPORT_STATE_OP_MOD_UPLINK = 0x2, }; struct mlx5_ifc_arm_monitor_counter_in_bits { From patchwork Tue Jul 28 09:10:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337680 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=mm9uU1Sf; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BG9sc3DZ6z9sT6 for ; Tue, 28 Jul 2020 19:11:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728525AbgG1JLr (ORCPT ); Tue, 28 Jul 2020 05:11:47 -0400 Received: from mail-eopbgr10059.outbound.protection.outlook.com ([40.107.1.59]:13383 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728346AbgG1JLq (ORCPT ); Tue, 28 Jul 2020 05:11:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZkLMbnR4Knke4fL7Xy3GUJ+sj6CX1x6hUWffTb85iJDH5enN0Zxj6KwEVe/xS3CKLeAUoD3KJ55+2Ox8r8MWm4Fm52V1kY3+X1y82ZEQNyrA3UjXfTy4HT5yVdd8ZoOASeikqdeNWoUtFl4eOWA2OoBI/hKasK3WgESS3ptYwpSPRIqmySVVJQJl0nrdacIux1GeTSOgSgsN46KEnHKAmP/1e4TSFy+YgC7iIUsTIte4phh89oDFiGf4WThzlwyUJq3YSifFnk8uLglDM47VrBZVzs5pKRvxuPiHnTJ7ZPP2mOhgrq24KbL+qRO7e/U0DPExPgKUNwwR/S2/P6X81g== 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-SenderADCheck; bh=PB6A7BOwlbghfua3HcZpWWj9Vo6t8AgAXCfLrMfdU6M=; b=kuvWQV4l4dWZrK6vvo7K4WZqfHFXSEVMMWG1JfMPR55N0duUR+zEYBgSv5a/uFNXzcLQiN9toXlFFVGY+8/IVMTCGDzGU30KXssOqjvov9L4ntGTexw/JNTaqA3CcWPN04uZEMXI524BvX+ILr+EFZfpuzyPpYRjYmsdcx6wssCJOz0CCMAswFCGDbT+WsB5FfS34R6WZJTJvydDiD8E0PJXmH4brM+KHwDJxRc1oe8tyMqPillDosW874D0brO+edW6orHNh1we3gy2zb9eO0qwL9dyqTu/8jNU6qzl5Y9stHzRhqAAYqK6AW0tlBoxMoS6v79TZ0yfTvV7GEk6Zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=PB6A7BOwlbghfua3HcZpWWj9Vo6t8AgAXCfLrMfdU6M=; b=mm9uU1SfiS40dJPEmxBEc/IzXyfyWctFiaXPgaxD/BAuEKlhx8UPMBhLqWWpmUFa1L3CiJwo02IENWaX24E1iliKXyXvnaQH6DT0bNvJafwUXZzQZU9fUwx5mCUFQGzPElgr+b50BR1RxA+W18ySxngOQg562oVpNG+yuAhJmyM= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB4638.eurprd05.prod.outlook.com (2603:10a6:802:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 09:11:40 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:11:40 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Alaa Hleihel , Roi Dayan , Vlad Buslov , Saeed Mahameed Subject: [net 12/12] net/mlx5e: Fix kernel crash when setting vf VLANID on a VF dev Date: Tue, 28 Jul 2020 02:10:35 -0700 Message-Id: <20200728091035.112067-13-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728091035.112067-1-saeedm@mellanox.com> References: <20200728091035.112067-1-saeedm@mellanox.com> X-ClientProxiedBy: BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY3PR05CA0022.namprd05.prod.outlook.com (2603:10b6:a03:254::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.9 via Frontend Transport; Tue, 28 Jul 2020 09:11:38 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 56c6d048-5ffc-4e07-c926-08d832d63d02 X-MS-TrafficTypeDiagnostic: VI1PR05MB4638: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:475; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VoE4HfVD/UU8PhlUXSRN+/gPOQwdVxFTNJ+wXSo3Nh9cDP6Nx+nKXwIJOZftHImNumndRCMEFWm3enzOnFxucMkYXCm+8DEQi953APRP5Hp62zIdXBSA8+nu38G0Y4C/2hK/e1EwxxWgyp2S93oGBGPSRx+KYzMtfPZ4XADl35xxbbtchN9UitO6TIMLBFRxNxnz+2OEUAjMT3ekJLFbO0/OJH1jNZw8S0bJlsn2Ychr5EyAUZZjvZ+DHfcZVCg+fgj7/n2dsQiowSbeX7iYh9K81JYNta1uLG22bBe3dOKST+893XsioPuq3ZG+DjRemjngoBs8menhQoqq9BzEW2mjYeG+ycAguZpt2SJ8dZcageL0FIAAHRhzbekn7z37 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB5102.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(136003)(366004)(346002)(396003)(376002)(110136005)(52116002)(478600001)(956004)(54906003)(4326008)(8936002)(16526019)(107886003)(2616005)(186003)(6486002)(316002)(8676002)(83380400001)(6506007)(6512007)(86362001)(1076003)(5660300002)(26005)(66946007)(66476007)(66556008)(2906002)(36756003)(6666004)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 4yeNpNbp9HoURg0t1VfhQ5UH2T0jO8QCJtrpQbmfFlgY9qspeyiZX4Akwr8wpF2HgghQz4GwL+sPwYDRIUn7fUw1yQK9MYdlknx7bFkfMW6EqYgHqP2ZHDquJYwPrOxA7BfAL3FxHGGF+TkUwouY74CSB8FehM1SQqyyLdJ5h/UiDl8A991KfLJ9Bal8ONQjCw+0HqtMVHPbjKrlBM7bLNof0F2tLq3Eg/+w+f1niEVgnj9nMaUoZMdN5cq1gjkh09MEmDwiJllSxOluJnWuQYAgmiEe7TphHmfoDVRi6KMb54U92ertJ/W0qwDLrhIIfhpKwKGAT/yBQlImLsy5U9AeRSwDN5ZotdLcrQbBPoC/FeUi3oXUEFjbUvTC1jrieven0Yx9SLse76bVjzUf5goKNngUTLK3NLRfAH3YrwuFERJf3thEttP2U6xPoGmnAK11H7pKXUF1O/7eZBf798iKDhWZWKbOpqrkg8G8hWc= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56c6d048-5ffc-4e07-c926-08d832d63d02 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 09:11:40.8189 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bBKXYnfvLPpSuQ6Xtl7KtIeRA34oa2IGstKhCGMtSw1SDYnZJkUfcVIo5pZagdidrd8SVja+dAh1tM8ASKb1mg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4638 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Alaa Hleihel After the cited commit, function 'mlx5_eswitch_set_vport_vlan' started to acquire esw->state_lock. However, esw is not defined for VF devices, hence attempting to set vf VLANID on a VF dev will cause a kernel panic. Fix it by moving up the (redundant) esw validation from function '__mlx5_eswitch_set_vport_vlan' since the rest of the callers now have and use a valid esw. For example with vf device eth4: # ip link set dev eth4 vf 0 vlan 0 Trace of the panic: [ 411.409842] BUG: unable to handle page fault for address: 00000000000011b8 [ 411.449745] #PF: supervisor read access in kernel mode [ 411.452348] #PF: error_code(0x0000) - not-present page [ 411.454938] PGD 80000004189c9067 P4D 80000004189c9067 PUD 41899a067 PMD 0 [ 411.458382] Oops: 0000 [#1] SMP PTI [ 411.460268] CPU: 4 PID: 5711 Comm: ip Not tainted 5.8.0-rc4_for_upstream_min_debug_2020_07_08_22_04 #1 [ 411.462447] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 [ 411.464158] RIP: 0010:__mutex_lock+0x4e/0x940 [ 411.464928] Code: fd 41 54 49 89 f4 41 52 53 89 d3 48 83 ec 70 44 8b 1d ee 03 b0 01 65 48 8b 04 25 28 00 00 00 48 89 45 c8 31 c0 45 85 db 75 0a <48> 3b 7f 60 0f 85 7e 05 00 00 49 8d 45 68 41 56 41 b8 01 00 00 00 [ 411.467678] RSP: 0018:ffff88841fcd74b0 EFLAGS: 00010246 [ 411.468562] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 [ 411.469715] RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000001158 [ 411.470812] RBP: ffff88841fcd7550 R08: ffffffffa00fa1ce R09: 0000000000000000 [ 411.471835] R10: ffff88841fcd7570 R11: 0000000000000000 R12: 0000000000000002 [ 411.472862] R13: 0000000000001158 R14: ffffffffa00fa1ce R15: 0000000000000000 [ 411.474004] FS: 00007faee7ca6b80(0000) GS:ffff88846fc00000(0000) knlGS:0000000000000000 [ 411.475237] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 411.476129] CR2: 00000000000011b8 CR3: 000000041909c006 CR4: 0000000000360ea0 [ 411.477260] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 411.478340] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 411.479332] Call Trace: [ 411.479760] ? __nla_validate_parse.part.6+0x57/0x8f0 [ 411.482825] ? mlx5_eswitch_set_vport_vlan+0x3e/0xa0 [mlx5_core] [ 411.483804] mlx5_eswitch_set_vport_vlan+0x3e/0xa0 [mlx5_core] [ 411.484733] mlx5e_set_vf_vlan+0x41/0x50 [mlx5_core] [ 411.485545] do_setlink+0x613/0x1000 [ 411.486165] __rtnl_newlink+0x53d/0x8c0 [ 411.486791] ? mark_held_locks+0x49/0x70 [ 411.487429] ? __lock_acquire+0x8fe/0x1eb0 [ 411.488085] ? rcu_read_lock_sched_held+0x52/0x60 [ 411.488998] ? kmem_cache_alloc_trace+0x16d/0x2d0 [ 411.489759] rtnl_newlink+0x47/0x70 [ 411.490357] rtnetlink_rcv_msg+0x24e/0x450 [ 411.490978] ? netlink_deliver_tap+0x92/0x3d0 [ 411.491631] ? validate_linkmsg+0x330/0x330 [ 411.492262] netlink_rcv_skb+0x47/0x110 [ 411.492852] netlink_unicast+0x1ac/0x270 [ 411.493551] netlink_sendmsg+0x336/0x450 [ 411.494209] sock_sendmsg+0x30/0x40 [ 411.494779] ____sys_sendmsg+0x1dd/0x1f0 [ 411.495378] ? copy_msghdr_from_user+0x5c/0x90 [ 411.496082] ___sys_sendmsg+0x87/0xd0 [ 411.496683] ? lock_acquire+0xb9/0x3a0 [ 411.497322] ? lru_cache_add+0x5/0x170 [ 411.497944] ? find_held_lock+0x2d/0x90 [ 411.498568] ? handle_mm_fault+0xe46/0x18c0 [ 411.499205] ? __sys_sendmsg+0x51/0x90 [ 411.499784] __sys_sendmsg+0x51/0x90 [ 411.500341] do_syscall_64+0x59/0x2e0 [ 411.500938] ? asm_exc_page_fault+0x8/0x30 [ 411.501609] ? rcu_read_lock_sched_held+0x52/0x60 [ 411.502350] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 411.503093] RIP: 0033:0x7faee73b85a7 [ 411.503654] Code: Bad RIP value. Fixes: 0e18134f4f9f ("net/mlx5e: Eswitch, use state_lock to synchronize vlan change") Signed-off-by: Alaa Hleihel Reviewed-by: Roi Dayan Reviewed-by: Vlad Buslov Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 71d01143c4556..43005caff09e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1887,8 +1887,6 @@ int __mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw, struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); int err = 0; - if (!ESW_ALLOWED(esw)) - return -EPERM; if (IS_ERR(evport)) return PTR_ERR(evport); if (vlan > 4095 || qos > 7) @@ -1916,6 +1914,9 @@ int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw, u8 set_flags = 0; int err; + if (!ESW_ALLOWED(esw)) + return -EPERM; + if (vlan || qos) set_flags = SET_VLAN_STRIP | SET_VLAN_INSERT;