From patchwork Fri Jun 28 22:36:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11023511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8AA413B1 for ; Fri, 28 Jun 2019 22:36:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EECD828812 for ; Fri, 28 Jun 2019 22:36:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E34AD28875; Fri, 28 Jun 2019 22:36:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75B4928812 for ; Fri, 28 Jun 2019 22:36:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726695AbfF1WgS (ORCPT ); Fri, 28 Jun 2019 18:36:18 -0400 Received: from mail-eopbgr70049.outbound.protection.outlook.com ([40.107.7.49]:23750 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726936AbfF1WgS (ORCPT ); Fri, 28 Jun 2019 18:36:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=testarcselector01; d=microsoft.com; cv=none; b=X6Loj3N0zUqJMLpWw1qGpmkYoqV2xkvxIiNLuCCWqpB53cjQF1fmskrKe54M/pc3zDedPbJUNIj4Yo0LwmdEDio0b8XAOX5sAYgmL8Ms+mcqXX8mzPAsOBKxCilrl6WCCq60+EHnl2wGwRRAxPkdss5dwPlFRoMB5I6Qo8gp/Hc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=testarcselector01; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wuLegtSJ0oJBwmDsRFHg0bs64i1MIsCM+RSybepaoEo=; b=Yvjkvlj300hSHA7534J+kLh3hplFbvEboL3C53KaJb5mR/MZ3eL7OPBdgrGhahLtaF5IcBKOhB1rz8Ho65Jt49P4lK22onufmsix3lxmRkov1WTyCB3wLEsjHQAzHgz2CDOaP0uaAii/N63D3MUPVnhKSRESNBKH3yO59/4ctwA= ARC-Authentication-Results: i=1; test.office365.com 1;spf=none;dmarc=none;dkim=none;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wuLegtSJ0oJBwmDsRFHg0bs64i1MIsCM+RSybepaoEo=; b=dQj6axoBMbKUEjo/AQ0tOvL0k7aamkcEBV4toh1TU/zjwxU82MrRIkwP35RO2LPOzwts++mJn81UPTm66GoYz8vuJFVCU8m8hSUZ7QWVt12lDhYLmxaty4dbW/iSaRXSWYp9TU66Ba6Z2xnNcKNiAE3DDEDFSBqBS4fme5Ztbsc= Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.227.7) by DB6PR0501MB2357.eurprd05.prod.outlook.com (10.168.56.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.17; Fri, 28 Jun 2019 22:36:04 +0000 Received: from DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::a901:6951:59de:3278]) by DB6PR0501MB2759.eurprd05.prod.outlook.com ([fe80::a901:6951:59de:3278%2]) with mapi id 15.20.2008.014; Fri, 28 Jun 2019 22:36:04 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky CC: "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" , Bodong Wang , Daniel Jurgens Subject: [PATCH mlx5-next 09/18] net/mlx5: Don't handle VF func change if host PF is disabled Thread-Topic: [PATCH mlx5-next 09/18] net/mlx5: Don't handle VF func change if host PF is disabled Thread-Index: AQHVLgHemS55hqdZJE+JQICHcsVV5A== Date: Fri, 28 Jun 2019 22:36:04 +0000 Message-ID: <20190628223516.9368-10-saeedm@mellanox.com> References: <20190628223516.9368-1-saeedm@mellanox.com> In-Reply-To: <20190628223516.9368-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.21.0 x-originating-ip: [209.116.155.178] x-clientproxiedby: BY5PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:180::48) To DB6PR0501MB2759.eurprd05.prod.outlook.com (2603:10a6:4:84::7) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e024b62c-df92-4a11-5c1a-08d6fc1900ff x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0501MB2357; x-ms-traffictypediagnostic: DB6PR0501MB2357: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 00826B6158 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(396003)(346002)(366004)(136003)(376002)(189003)(199004)(107886003)(6436002)(1076003)(3846002)(6116002)(256004)(66446008)(50226002)(6636002)(66066001)(53936002)(36756003)(71200400001)(71190400001)(186003)(8676002)(52116002)(4326008)(5660300002)(14444005)(26005)(6506007)(305945005)(450100002)(11346002)(446003)(478600001)(76176011)(64756008)(99286004)(386003)(102836004)(6512007)(110136005)(2906002)(316002)(66476007)(68736007)(14454004)(81166006)(486006)(86362001)(81156014)(73956011)(66946007)(2616005)(6486002)(476003)(66556008)(8936002)(25786009)(54906003)(7736002)(461764006);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2357;H:DB6PR0501MB2759.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 37pIGe4MeVDfHaDkV5uYBDAOhfwqMgMH7/0ZoOm7wvnzTvU2EjSbKfiWbHWn/hlrOH23VqyPi+N/U0ef6yuFYDeKZ+Z/vPfvZjj7kFKEshyL4+hcQfXSzsdpoccFpwR0a3I40059WaYHW9NprEaTcwqhtMw+wGhFs7M9KpX4KIqIcZCMgkYnCKZKKBUirDzOjc2F6w41VGMoAl/LM5x2CLYsUi8pK+a/9Mcbgr2SAT5cTIEe1q+ZFlQUwflg6Qkqt4ZuQ6uz9Be5s91nfLEU9XwhUTjh8Mfmw5m5jOAji+qNI7PqPxUz0Ve0l1jjOROAziN64FCHV6wvJ+/XXVaNxi//jTJtnKcprqlqRF8RKC574Nl4FLbYSl1Xe9OiUkoZCLzgPzyfqgkLbJA60i23iPUlybYSlWbaQ3E8OB0FbAg= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e024b62c-df92-4a11-5c1a-08d6fc1900ff X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jun 2019 22:36:04.4984 (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: saeedm@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2357 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bodong Wang When ECPF eswitch manager is at offloads mode, it monitors functions changed event from host PF side and acts according to the number of VFs enabled/disabled. As ECPF and host PF work in two independent hosts, it's possible that host PF OS reboots but ECPF system is still kept on and continues monitoring events from host PF. When kernel from host PF side is booting, PCI iov driver does sriov_init and compute_max_vf_buses by iterating over all valid num of VFs. This triggers FLR and generates functions changed events, even though host PF HCA is not enabled at this time. However, ECPF is not aware of this information, and still handles these events as usual. ECPF system will see massive number of reps are created, but destroyed immediately once creation finished. To eliminate this noise, a bit is added to host parameter context to indicate host PF is disabled. ECPF will not handle the VF changed event if this bit is set. Signed-off-by: Bodong Wang Reviewed-by: Daniel Jurgens Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 5 ++++- include/linux/mlx5/mlx5_ifc.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 24af2744453b..105c21069c0c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -2026,6 +2026,7 @@ static void esw_functions_changed_event_handler(struct work_struct *work) u32 out[MLX5_ST_SZ_DW(query_esw_functions_out)] = {}; struct mlx5_host_work *host_work; struct mlx5_eswitch *esw; + bool host_pf_disabled; u16 num_vfs = 0; int err; @@ -2035,7 +2036,9 @@ static void esw_functions_changed_event_handler(struct work_struct *work) err = mlx5_esw_query_functions(esw->dev, out, sizeof(out)); num_vfs = MLX5_GET(query_esw_functions_out, out, host_params_context.host_num_of_vfs); - if (err || num_vfs == esw->esw_funcs.num_vfs) + host_pf_disabled = MLX5_GET(query_esw_functions_out, out, + host_params_context.host_pf_disabled); + if (err || host_pf_disabled || num_vfs == esw->esw_funcs.num_vfs) goto out; /* Number of VFs can only change from "0 to x" or "x to 0". */ diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index e2a77b5152a8..031db53e94ce 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -9823,7 +9823,8 @@ struct mlx5_ifc_mtrc_ctrl_bits { struct mlx5_ifc_host_params_context_bits { u8 host_number[0x8]; - u8 reserved_at_8[0x8]; + u8 reserved_at_8[0x7]; + u8 host_pf_disabled[0x1]; u8 host_num_of_vfs[0x10]; u8 host_total_vfs[0x10];