From patchwork Fri Jun 28 22:35:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 11023531 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 1B89E13B1 for ; Fri, 28 Jun 2019 22:36:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FDFD28876 for ; Fri, 28 Jun 2019 22:36:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2175E2887B; Fri, 28 Jun 2019 22:36:55 +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 A9FC628876 for ; Fri, 28 Jun 2019 22:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727074AbfF1Wgx (ORCPT ); Fri, 28 Jun 2019 18:36:53 -0400 Received: from mail-eopbgr70043.outbound.protection.outlook.com ([40.107.7.43]:2242 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726892AbfF1Wgw (ORCPT ); Fri, 28 Jun 2019 18:36:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=testarcselector01; d=microsoft.com; cv=none; b=olveLdaYHnF7gm+fAT+EuBZRgv70zl0G8SG98357yFsdkSyiouqq58iA7PsBoHDFYYYtxYzc21WoxtG+0weV4XdsJra40wv6WX6zDL53+oPaiSDLrcZeFUNO+GwNFnR2KnmBYGJkD4wfayW/Sp5jvPnWNW9zUPEgfpp+B3Zex9E= 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=4seYw6lJWiZfn6j7X5+BnFJvitpC4uDOTg8X4SzNwC8=; b=EGTSP210KuF3B3wcolVndWYCBDu9Tyt+m+KWuDHvT3bPSe8x8DktXD5LMbY8w/KU9Eub9VULvPrilYf9yM6nl3/D2ljM0OXRklTmpq25azBtyB7ltBVSeSJXQxk3XKKKaxlt6wZ1FimWLTTN1BZ7oNQPELKPu5B/bnniBDuJYWc= 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=4seYw6lJWiZfn6j7X5+BnFJvitpC4uDOTg8X4SzNwC8=; b=EBU8F2oe80G4K7Rj8arm7+ACu09xRiZewcghD2Vt5tDoXe3pEQtaIhRzyHPtwzbRpfFb9WnyWvkeCzFvbhKT3qLXrYPAfwxDm4nOJOE+NPaySaB/l2a9fPCICakBrwLJGvkoKbe3Y4xdaaxiQuqdEatttgNQdcb93cGE9TZuEzE= 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:35:58 +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:35:58 +0000 From: Saeed Mahameed To: Saeed Mahameed , Leon Romanovsky CC: "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" , Huy Nguyen , Vu Pham , Parav Pandit Subject: [PATCH mlx5-next 06/18] net/mlx5: Rename mlx5_pci_dev_type to mlx5_coredev_type Thread-Topic: [PATCH mlx5-next 06/18] net/mlx5: Rename mlx5_pci_dev_type to mlx5_coredev_type Thread-Index: AQHVLgHayF8jsOI7wkWu7jL1AsBI7A== Date: Fri, 28 Jun 2019 22:35:58 +0000 Message-ID: <20190628223516.9368-7-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: 659b5d2a-fbca-4770-dc90-08d6fc18fd36 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:935; 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)(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);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: m8JUQ7K/l5V2FwZ2afkfgkD7qJige/DWkfcI/YeGJzc7b3zW59G6b693yCuzwcIKgSw2++w0SKsShmKK/9r2S49mZQRgnfT96moSOtqBVodTBf13uHKS4NBG37Lq4O4p0eSNxQd3Y4bTUqZnARKiMo8uED3s5tJcCGX+nz6DCSRiGOY8IC59rC5PB3XBcduaPPkNz2/p9nxjansfGE1inniUOrtm7UXvMKzt+tAaTP8It8n01agjfxWJVaCVVaw68n9FvJwAIqe4x25v+kyFqskWsnNrG9I6ujCTqaNKA2z1E86ISsHYGttxGHEov66Et6aoA4jsNr4CP2GqfF55d2FBia1wqh5conZq8wlZAweF6geOxnaZKOUYXlxugi9enH3Y/aNgQ+UZPLjBhioAfwkA0lGp95Jq9h+j3ISdtbo= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 659b5d2a-fbca-4770-dc90-08d6fc18fd36 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jun 2019 22:35:58.1363 (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: Huy Nguyen Rename mlx5_pci_dev_type to mlx5_coredev_type to distinguish different mlx5 device types. mlx5_coredev_type represents mlx5_core_dev instance type. Hence keep mlx5_coredev_type in mlx5_core_dev structure. Signed-off-by: Huy Nguyen Signed-off-by: Vu Pham Signed-off-by: Parav Pandit Reviewed-by: Parav Pandit Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 5 +++-- include/linux/mlx5/driver.h | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index bfc8c6faedc2..e5f9df7f7e34 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -731,8 +731,6 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct pci_dev *pdev, struct mlx5_priv *priv = &dev->priv; int err = 0; - priv->pci_dev_data = id->driver_data; - pci_set_drvdata(dev->pdev, dev); dev->bar_addr = pci_resource_start(pdev, 0); @@ -1320,6 +1318,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *id) dev->device = &pdev->dev; dev->pdev = pdev; + dev->coredev_type = id->driver_data & MLX5_PCI_DEV_IS_VF ? + MLX5_COREDEV_VF : MLX5_COREDEV_PF; + err = mlx5_mdev_init(dev, prof_sel); if (err) goto mdev_init_err; diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 2ff624a91e3d..155b8cbe1cc9 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -182,6 +182,11 @@ enum port_state_policy { MLX5_POLICY_INVALID = 0xffffffff }; +enum mlx5_coredev_type { + MLX5_COREDEV_PF, + MLX5_COREDEV_VF +}; + struct mlx5_field_desc { struct dentry *dent; int i; @@ -567,7 +572,6 @@ struct mlx5_priv { struct mlx5_core_sriov sriov; struct mlx5_lag *lag; struct mlx5_devcom *devcom; - unsigned long pci_dev_data; struct mlx5_core_roce roce; struct mlx5_fc_stats fc_stats; struct mlx5_rl_table rl_table; @@ -646,6 +650,7 @@ struct mlx5_vxlan; struct mlx5_core_dev { struct device *device; + enum mlx5_coredev_type coredev_type; struct pci_dev *pdev; /* sync pci state */ struct mutex pci_status_mutex; @@ -1079,9 +1084,9 @@ enum { MLX5_PCI_DEV_IS_VF = 1 << 0, }; -static inline int mlx5_core_is_pf(struct mlx5_core_dev *dev) +static inline bool mlx5_core_is_pf(struct mlx5_core_dev *dev) { - return !(dev->priv.pci_dev_data & MLX5_PCI_DEV_IS_VF); + return dev->coredev_type == MLX5_COREDEV_PF; } static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev)