From patchwork Tue Jun 2 11:31:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danielle Ratson X-Patchwork-Id: 218053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0F9DC433E0 for ; Tue, 2 Jun 2020 11:31:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4D9E20772 for ; Tue, 2 Jun 2020 11:31:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="p+hVDIqv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726802AbgFBLbu (ORCPT ); Tue, 2 Jun 2020 07:31:50 -0400 Received: from mail-eopbgr20080.outbound.protection.outlook.com ([40.107.2.80]:10724 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726728AbgFBLbs (ORCPT ); Tue, 2 Jun 2020 07:31:48 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M1RVr48Xd0D619GgB1t+WxcOHiiF0pdXu1ejT1Xha3HZVT+dGRdvQMTFdIKZidhWzil6blkIjRj2/xxxPLf+xF6ZkK5IIBauOWHiEqutIHTRQvBRODR+4M2TSTKkpzK6aVGhBTu2ht5opaEuM8UmCHhiaRuE2nq8AeOehlbBeSli2LN9Zcyf3orErWeRur2oldcg9e3OatyrLWx/6176T8YnRy/YKEgIsMnnakmlHZD61jlgOHInCPvqvdDaI7lX9Z7j+tIZCKhgVFDYMqBi5nJcZ5cnz4yELs3Gu64JSksvQFqqMY9IMUb3cxpWuwaI+TVT3EAo6QWJS4qDW5mG2Q== 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=90kUULobvupA+b00To4xjFWqhQhveWUxiNAMFFWpGNk=; b=OXhiXY1pehpsxWwVUafGXx2AFv+cSMYGPRRCN7Seczd09Fcikb+Tmbw4U1OVA1nxrU/pRiSz79H4oS7tCdXK4oq27w+kSChaaqPjxLdHouPkkZMTkbWpQzDCz6st4SxxpLetSCLSPeu0o/npC4RxKFBdjWybrFhl552tUsPmBJ3Gnz1USRZeZ1zVFqbsmlSLsvnl6iLU1ZPuqWC1x8FaHWolMkMgQCHmH0niEcMpKUxrLfgj2gNS9llg/YR99sbfHQaXW54SBVBkoWwvPjtxFVm+iG9QD+l1llVppgt1gWJH0PTvsWq5fT9b3QMBMSeAlZD/dZ43CgQqJiSQ/RKkpQ== 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=90kUULobvupA+b00To4xjFWqhQhveWUxiNAMFFWpGNk=; b=p+hVDIqvosV68ZML0bQP9yYNfPFdznnpMdCMmEPOt3M5Jma/JVCXfYljLo0rGziLCvPeka5HmV5LVYEjxZqlKU/WsJZjIsyAOVFlZwckJyf7YDQlPUpK2PbzCAnU+mTjW35mwhRknRN9CDYRWpd6fuK5g6+hZcbORmJ3Kbjewe0= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB5010.eurprd05.prod.outlook.com (2603:10a6:208:cd::23) by AM0PR05MB4129.eurprd05.prod.outlook.com (2603:10a6:208:64::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Tue, 2 Jun 2020 11:31:45 +0000 Received: from AM0PR05MB5010.eurprd05.prod.outlook.com ([fe80::ccb:c612:f276:a182]) by AM0PR05MB5010.eurprd05.prod.outlook.com ([fe80::ccb:c612:f276:a182%6]) with mapi id 15.20.3045.024; Tue, 2 Jun 2020 11:31:45 +0000 From: Danielle Ratson To: netdev@vger.kernel.org Cc: davem@davemloft.net, michael.chan@broadcom.com, kuba@kernel.org, jeffrey.t.kirsher@intel.com, saeedm@mellanox.com, leon@kernel.org, jiri@mellanox.com, idosch@mellanox.com, snelson@pensando.io, drivers@pensando.io, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, mlxsw@mellanox.com, Danielle Ratson Subject: [RFC PATCH net-next 1/8] devlink: Move set attribute of devlink_port_attrs to devlink_port Date: Tue, 2 Jun 2020 14:31:12 +0300 Message-Id: <20200602113119.36665-2-danieller@mellanox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200602113119.36665-1-danieller@mellanox.com> References: <20200602113119.36665-1-danieller@mellanox.com> X-ClientProxiedBy: AM4P190CA0014.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::24) To AM0PR05MB5010.eurprd05.prod.outlook.com (2603:10a6:208:cd::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dev-r-vrt-156.mtr.labs.mlnx (37.142.13.130) by AM4P190CA0014.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.21 via Frontend Transport; Tue, 2 Jun 2020 11:31:42 +0000 X-Mailer: git-send-email 2.20.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 46bb1cba-ccf7-4b66-4f63-08d806e88785 X-MS-TrafficTypeDiagnostic: AM0PR05MB4129: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-Forefront-PRVS: 0422860ED4 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v+yNT/ILBQB9HNNG65o6NgwcNDWGnSmBfky9uMbBimtRvnfidyZDbP8bUo5mdj32rYX02uZsaVqw0mDG7R5UdBYtiNXSjikxCjk2npELvpmUqfXOMqVox40/hEQcd7k8j+MmhRQg382+KJBffGf4WLqW7yuoVW7/5wpHuNmA0qiogMyii6wEvlP/cYQvonYmIDw0Dq1qBs1a8xYxl2WIiiv6o9jucHvYtTsRzLpjK0q6D6Xvy1h7FbYo8EFkshXz1bXrDWpcfIXAMEOOFbIP66kU4W4M6a62KNJDlvm+/XSqcqa7iDk6uz5R67ElDV3tkE5fK4Bg+wbU3rS7E14Kfg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB5010.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(346002)(376002)(39860400002)(366004)(396003)(4326008)(7416002)(6506007)(478600001)(6916009)(52116002)(6486002)(2906002)(36756003)(5660300002)(316002)(6666004)(1076003)(26005)(86362001)(83380400001)(66946007)(66556008)(66476007)(16526019)(186003)(107886003)(8936002)(6512007)(2616005)(956004)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: GOMqXTooT/XHaEWl5baGER7DJJKjPMKllPDrXF3vOVnwaZ5qY7kp4cy7/dF0faUNOdcVjBbhYgPA6YhMhTjuc/BHsAKtRRRpzfZeL+Br56PMOxmYeIAv3TivEK7sy05zgK/D9aPyyjXaFY4BPci9mS657B8wSnP4FUJUMuxmcuvMWrDrwkdRqOeM5v5BWElZxJ+2R4afayPdgbfAemKRXL5xSCQPZ8sWr62X9Z2I7L2KUXeeczzqb3UXcYYQgPiZ8zW6ZCk/MOJ/NeVnyqjlfearJEzc35zHqfwTDMRWlpkrXrqZ+dpxju8hHPSAMbyxiGSvlQTqj8EdGz/TPD5B3GynNsF0+OVE36qHscZpSZs9WysvgjUA27dd2V8bhiKVCpRqC/DTBraY3MUna9ZmoTGv31bHMLkp/7RPgpP7p+lkh/CkgH/ki0JMMbjlRnjlbHr+gA2kR2q4ZwOquME2NrDPKWxZgLsBg+URLEj6JXL9Ne0ApUvL+C23j6UZN0d2 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46bb1cba-ccf7-4b66-4f63-08d806e88785 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2020 11:31:45.0484 (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: O6vxxkha4TICyfyN/aHps3sLdJlBQ+cLoDdQfReNIc8ScVP6STq/vzPocCvlA5u8HmrVN9nrVdb/p2wvjrlZkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4129 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The struct devlink_port_attrs holds the attributes of devlink_port. The 'set' field is not devlink_port's attribute as opposed to most of the others. Move 'set' to be devlink_port's field called 'attrs_set'. Signed-off-by: Danielle Ratson Reviewed-by: Jiri Pirko --- include/net/devlink.h | 4 ++-- net/core/devlink.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/net/devlink.h b/include/net/devlink.h index 1df6dfec26c2..3e4efd51d5c5 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -65,8 +65,7 @@ struct devlink_port_pci_vf_attrs { }; struct devlink_port_attrs { - u8 set:1, - split:1, + u8 split:1, switch_port:1; enum devlink_port_flavour flavour; struct netdev_phys_item_id switch_id; @@ -90,6 +89,7 @@ struct devlink_port { enum devlink_port_type desired_type; void *type_dev; struct devlink_port_attrs attrs; + u8 attrs_set:1; struct delayed_work type_warn_dw; }; diff --git a/net/core/devlink.c b/net/core/devlink.c index 2cafbc808b09..e5e594d15d3e 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -524,7 +524,7 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg, { struct devlink_port_attrs *attrs = &devlink_port->attrs; - if (!attrs->set) + if (!devlink_port->attrs_set) return 0; if (nla_put_u16(msg, DEVLINK_ATTR_PORT_FLAVOUR, attrs->flavour)) return -EMSGSIZE; @@ -7385,7 +7385,7 @@ static int __devlink_port_attrs_set(struct devlink_port *devlink_port, if (WARN_ON(devlink_port->registered)) return -EEXIST; - attrs->set = true; + devlink_port->attrs_set = true; attrs->flavour = flavour; if (switch_id) { attrs->switch_port = true; @@ -7493,7 +7493,7 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port, struct devlink_port_attrs *attrs = &devlink_port->attrs; int n = 0; - if (!attrs->set) + if (!devlink_port->attrs_set) return -EOPNOTSUPP; switch (attrs->flavour) { From patchwork Tue Jun 2 11:31:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danielle Ratson X-Patchwork-Id: 218052 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC42DC433DF for ; Tue, 2 Jun 2020 11:32:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 82D4A2068D for ; Tue, 2 Jun 2020 11:32:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="mzuOGE6/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726856AbgFBLb7 (ORCPT ); Tue, 2 Jun 2020 07:31:59 -0400 Received: from mail-vi1eur05on2054.outbound.protection.outlook.com ([40.107.21.54]:9760 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726728AbgFBLb6 (ORCPT ); Tue, 2 Jun 2020 07:31:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KZAnDMtufYeHKIHq1GZfTQilahQwVFqbig3HXLiaVe3JnkjxIoHztlU0LmpS4nSDG+XKziEVYSwnm53tjBdVBQca7VCfFip8xcFKhe7f+Var1rfVZs2xDIJSUyULRbWyjSm9u2gS32V4aoGKuwoAIJewcVd+2KFhWQhAKHSU/7O8nnCVUYQboY7gO9+pRvQhqHUQAda7DKZGdY2l+2ey2kB/DIYGEavtH47GdiV94wEnsV4BNV8DdChvcj+6wVeHf9GTLKvRgqRwy/ZnJQxXdFD+nvCGbIJ9MNiVgZYCtY5qYLAe1LPs9zkWdA3EkvgrEDLfp6qD18nAoFQY2/X5fw== 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=nq9+a40fxDPkT+/FqEzguZD7eMDwa/IJ9vHOnwKUUCE=; b=WymgDaOVA267LyEY3T/zVeG+bwmz50Qzxm5thvFyqLkUt73XmWVVxmFKnv1lWErId42pDbCZjZCQB9YfboijK1YKhFzqEdmpjwO0kOU53flkWH6/D3o1uO/G8Aif44bF8aAxq2XHvIqLKv+iyOu2PKoa3aAcvfkJbIIv2wxj1BIJSitVPjHi0KOfrg2GdlEZ2UBk/4/gr2lE5XLQ02fCbiep0JjpPHGaZ7UFtoqstSdZN1xdt/vGe2Ud32+buqIDHt95jfbLNXSgnRpIUCJazbd+JojUqTo5cUZOU1d2SrHaMEIN0LtkgQd6teRXztRFkqlY85Alpr0XUPtfoRprIQ== 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=nq9+a40fxDPkT+/FqEzguZD7eMDwa/IJ9vHOnwKUUCE=; b=mzuOGE6/KMsAjyZ+BRWoFo+LVq4WE5Ic+s9uBgcQIQbN0am/bItFKbL1O3v+teZPutshhsB0KEFkRze2aLqJrNUaHKMM9nUed2OXRx7j5SeBNpv3DspobWBHaOpi6hKyx/bQsEc5LmUIvY/SSsGYy6mLy7dWbTWG4+Nh/juxjxw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB5010.eurprd05.prod.outlook.com (2603:10a6:208:cd::23) by AM0PR05MB6628.eurprd05.prod.outlook.com (2603:10a6:20b:15b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.17; Tue, 2 Jun 2020 11:31:52 +0000 Received: from AM0PR05MB5010.eurprd05.prod.outlook.com ([fe80::ccb:c612:f276:a182]) by AM0PR05MB5010.eurprd05.prod.outlook.com ([fe80::ccb:c612:f276:a182%6]) with mapi id 15.20.3045.024; Tue, 2 Jun 2020 11:31:52 +0000 From: Danielle Ratson To: netdev@vger.kernel.org Cc: davem@davemloft.net, michael.chan@broadcom.com, kuba@kernel.org, jeffrey.t.kirsher@intel.com, saeedm@mellanox.com, leon@kernel.org, jiri@mellanox.com, idosch@mellanox.com, snelson@pensando.io, drivers@pensando.io, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, mlxsw@mellanox.com, Danielle Ratson Subject: [RFC PATCH net-next 3/8] devlink: Replace devlink_port_attrs_set parameters with a struct Date: Tue, 2 Jun 2020 14:31:14 +0300 Message-Id: <20200602113119.36665-4-danieller@mellanox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200602113119.36665-1-danieller@mellanox.com> References: <20200602113119.36665-1-danieller@mellanox.com> X-ClientProxiedBy: AM4P190CA0014.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::24) To AM0PR05MB5010.eurprd05.prod.outlook.com (2603:10a6:208:cd::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dev-r-vrt-156.mtr.labs.mlnx (37.142.13.130) by AM4P190CA0014.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.21 via Frontend Transport; Tue, 2 Jun 2020 11:31:49 +0000 X-Mailer: git-send-email 2.20.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e80595ba-aacb-4c4d-647c-08d806e88b88 X-MS-TrafficTypeDiagnostic: AM0PR05MB6628: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 0422860ED4 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M+HGnvMcyb/eNadY9Vz5fmZ1ip9scOOOQ2JSI3OEXKgO7alWYD1cX8G2ZUncr3iaPJvjarHTRjWc/Uw92++7iryhhr4TFBA7txXdSdQ7gR2Y9MXopmjlYuUrXVNr6W6fJP9pizlFaGwshKfoViClHQACXkjlRIvW3FrQXamgAY5XcOJKOv+wjlZtgwJK8eiVXBBfzrBywE7luJ3ni1Gx6IUdhsGv+jrSZ/aAhUchc4fM/7x353hg6Wvnr8I7D3YBTGxaeb2x8iO+2GcllIA9euhAo19Vmj0wZJYz4yLjbx11+ZQR2Lwms3EBRScLEBpZxxSPGL+oqJ8rqEO10Q1rSg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB5010.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(396003)(136003)(376002)(346002)(186003)(16526019)(26005)(83380400001)(6506007)(86362001)(36756003)(2616005)(2906002)(52116002)(107886003)(6916009)(956004)(6486002)(8676002)(7416002)(30864003)(66556008)(478600001)(6666004)(6512007)(66476007)(66946007)(5660300002)(316002)(4326008)(8936002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: LqE+YTWo19B+36CwSfBFdD+e1KWwG02/3sE7svFFRmjto2pFjofaXFjZl0EUC9DGdw1eSXa8wxqvSfPm0RT8l0YGtMVbDXm/JY54Py0t41KZ9sTwt3EKNNQIa/cZUoS+dSy36tcN1eC/gHDWw9qFs98lTT623765h5GWMtBrQtXQTmUsFLpcED1pj7uUhaRrIlHGGkHB8f/+Ovyd4JCnZbPz19F+lGKspJ20Xfd0OIGCRPCr0cCrl4V16grRwOOplgp/nKVk3YyO8VAe2fT7iCvDfb6T2nP6N20nPNEEJHoA81DtUbMm26ZPoegQ6YuagBSpeMZJmzofi4YxbdjcbFZBV7D4NoFxzg0z1oSQyv484l2O+02x+Gqvd+OT7FcAopOczWVysdxc0yKB6cSx8XpYgsSQQQRDaYr+qM5uDt0EQYQfUZekKtdXmTFov4ktyhFIPAz7w5v8LfeiuQYMPZ1TsfevmRxyGLkaHJQjiAoZR+aK90DnKGETf6QWwErr X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e80595ba-aacb-4c4d-647c-08d806e88b88 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2020 11:31:52.6050 (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: EhevTF86teifoudky55XpkADK1Pj4mWMxof/uzZJ8Q0+ddz/66+Op9v7G2Q7mAUvIPKx2gQv1+aKalf/BalOQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6628 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently, devlink_port_attrs_set accepts a long list of parameters, that most of them are devlink port's attributes. Use the devlink_port_attrs struct to replace the relevant parameters. Signed-off-by: Danielle Ratson Reviewed-by: Jiri Pirko --- .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 13 +++- drivers/net/ethernet/intel/ice/ice_devlink.c | 6 +- .../ethernet/mellanox/mlx5/core/en/devlink.c | 19 +++--- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 20 +++--- drivers/net/ethernet/mellanox/mlxsw/core.c | 11 +++- .../net/ethernet/netronome/nfp/nfp_devlink.c | 11 +++- .../ethernet/pensando/ionic/ionic_devlink.c | 5 +- drivers/net/netdevsim/dev.c | 14 ++-- include/net/devlink.h | 12 +--- net/core/devlink.c | 64 ++++++------------- net/dsa/dsa2.c | 17 +++-- 11 files changed, 97 insertions(+), 95 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c index a812beb46325..babaccf92b23 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -685,6 +685,9 @@ static void bnxt_dl_params_unregister(struct bnxt *bp) int bnxt_dl_register(struct bnxt *bp) { + struct devlink_port_attrs attrs = {}; + const unsigned char *switch_id; + unsigned char switch_id_len; struct devlink *dl; int rc; @@ -713,9 +716,13 @@ int bnxt_dl_register(struct bnxt *bp) if (!BNXT_PF(bp)) return 0; - devlink_port_attrs_set(&bp->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL, - bp->pf.port_id, false, 0, bp->dsn, - sizeof(bp->dsn)); + attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; + attrs.phys.port_number = bp->pf.port_id; + switch_id = bp->dsn; + switch_id_len = sizeof(bp->dsn); + memcpy(attrs.switch_id.id, switch_id, switch_id_len); + attrs.switch_id.id_len = switch_id_len; + devlink_port_attrs_set(&bp->dl_port, &attrs); rc = devlink_port_register(dl, &bp->dl_port, bp->pf.port_id); if (rc) { netdev_err(bp->dev, "devlink_port_register failed\n"); diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c index a73d06e06b5d..69715a0cbfe8 100644 --- a/drivers/net/ethernet/intel/ice/ice_devlink.c +++ b/drivers/net/ethernet/intel/ice/ice_devlink.c @@ -312,6 +312,7 @@ int ice_devlink_create_port(struct ice_pf *pf) struct devlink *devlink = priv_to_devlink(pf); struct ice_vsi *vsi = ice_get_main_vsi(pf); struct device *dev = ice_pf_to_dev(pf); + struct devlink_port_attrs attrs = {}; int err; if (!vsi) { @@ -319,8 +320,9 @@ int ice_devlink_create_port(struct ice_pf *pf) return -EIO; } - devlink_port_attrs_set(&pf->devlink_port, DEVLINK_PORT_FLAVOUR_PHYSICAL, - pf->hw.pf_id, false, 0, NULL, 0); + attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; + attrs.phys.port_number = pf->hw.pf_id; + devlink_port_attrs_set(&pf->devlink_port, &attrs); err = devlink_port_register(devlink, &pf->devlink_port, pf->hw.pf_id); if (err) { dev_err(dev, "devlink_port_register failed: %d\n", err); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c index f8b2de4b04be..a69c62d72d16 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c @@ -6,17 +6,16 @@ int mlx5e_devlink_port_register(struct mlx5e_priv *priv) { struct devlink *devlink = priv_to_devlink(priv->mdev); + struct devlink_port_attrs attrs = {}; - if (mlx5_core_is_pf(priv->mdev)) - devlink_port_attrs_set(&priv->dl_port, - DEVLINK_PORT_FLAVOUR_PHYSICAL, - PCI_FUNC(priv->mdev->pdev->devfn), - false, 0, - NULL, 0); - else - devlink_port_attrs_set(&priv->dl_port, - DEVLINK_PORT_FLAVOUR_VIRTUAL, - 0, false, 0, NULL, 0); + if (mlx5_core_is_pf(priv->mdev)) { + attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; + attrs.phys.port_number = PCI_FUNC(priv->mdev->pdev->devfn); + } else { + attrs.flavour = DEVLINK_PORT_FLAVOUR_VIRTUAL; + } + + devlink_port_attrs_set(&priv->dl_port, &attrs); return devlink_port_register(devlink, &priv->dl_port, 1); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index af89a4803c7d..e6f467037c5c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -1193,8 +1193,11 @@ static int register_devlink_port(struct mlx5_core_dev *dev, { struct devlink *devlink = priv_to_devlink(dev); struct mlx5_eswitch_rep *rep = rpriv->rep; + struct devlink_port_attrs attrs = {}; struct netdev_phys_item_id ppid = {}; unsigned int dl_port_index = 0; + const unsigned char *switch_id; + unsigned char switch_id_len; u16 pfnum; if (!is_devlink_port_supported(dev, rpriv)) @@ -1203,19 +1206,18 @@ static int register_devlink_port(struct mlx5_core_dev *dev, mlx5e_rep_get_port_parent_id(rpriv->netdev, &ppid); dl_port_index = vport_to_devlink_port_index(dev, rep->vport); pfnum = PCI_FUNC(dev->pdev->devfn); - + attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; + attrs.phys.port_number = pfnum; + switch_id = &ppid.id[0]; + switch_id_len = ppid.id_len; + memcpy(attrs.switch_id.id, switch_id, switch_id_len); + attrs.switch_id.id_len = switch_id_len; if (rep->vport == MLX5_VPORT_UPLINK) - devlink_port_attrs_set(&rpriv->dl_port, - DEVLINK_PORT_FLAVOUR_PHYSICAL, - pfnum, false, 0, - &ppid.id[0], ppid.id_len); + devlink_port_attrs_set(&rpriv->dl_port, &attrs); else if (rep->vport == MLX5_VPORT_PF) - devlink_port_attrs_pci_pf_set(&rpriv->dl_port, - &ppid.id[0], ppid.id_len, - pfnum); + devlink_port_attrs_pci_pf_set(&rpriv->dl_port, pfnum); else if (mlx5_eswitch_is_vf_vport(dev->priv.eswitch, rpriv->rep->vport)) devlink_port_attrs_pci_vf_set(&rpriv->dl_port, - &ppid.id[0], ppid.id_len, pfnum, rep->vport - 1); return devlink_port_register(devlink, &rpriv->dl_port, dl_port_index); diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index e9ccd333f61d..bbe7358d4ea5 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c @@ -2129,12 +2129,17 @@ static int __mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port, struct mlxsw_core_port *mlxsw_core_port = &mlxsw_core->ports[local_port]; struct devlink_port *devlink_port = &mlxsw_core_port->devlink_port; + struct devlink_port_attrs attrs = {}; int err; + attrs.split = split; + attrs.flavour = flavour; + attrs.phys.port_number = port_number; + attrs.phys.split_subport_number = split_port_subnumber; + memcpy(attrs.switch_id.id, switch_id, switch_id_len); + attrs.switch_id.id_len = switch_id_len; mlxsw_core_port->local_port = local_port; - devlink_port_attrs_set(devlink_port, flavour, port_number, - split, split_port_subnumber, - switch_id, switch_id_len); + devlink_port_attrs_set(devlink_port, &attrs); err = devlink_port_register(devlink, devlink_port, local_port); if (err) memset(mlxsw_core_port, 0, sizeof(*mlxsw_core_port)); diff --git a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c index 07dbf4d72227..71f4e624b3db 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c @@ -353,6 +353,7 @@ const struct devlink_ops nfp_devlink_ops = { int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port) { + struct devlink_port_attrs attrs = {}; struct nfp_eth_table_port eth_port; struct devlink *devlink; const u8 *serial; @@ -365,10 +366,14 @@ int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port) if (ret) return ret; + attrs.split = eth_port.is_split; + attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; + attrs.phys.port_number = eth_port.label_port; + attrs.phys.split_subport_number = eth_port.label_subport; serial_len = nfp_cpp_serial(port->app->cpp, &serial); - devlink_port_attrs_set(&port->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL, - eth_port.label_port, eth_port.is_split, - eth_port.label_subport, serial, serial_len); + memcpy(attrs.switch_id.id, serial, serial_len); + attrs.switch_id.id_len = serial_len; + devlink_port_attrs_set(&port->dl_port, &attrs); devlink = priv_to_devlink(app->pf); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c index 273c889faaad..aa224d0cfa54 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c @@ -69,6 +69,7 @@ void ionic_devlink_free(struct ionic *ionic) int ionic_devlink_register(struct ionic *ionic) { struct devlink *dl = priv_to_devlink(ionic); + struct devlink_port_attrs attrs = {}; int err; err = devlink_register(dl, ionic->dev); @@ -81,8 +82,8 @@ int ionic_devlink_register(struct ionic *ionic) if (ionic->is_mgmt_nic) return 0; - devlink_port_attrs_set(&ionic->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL, - 0, false, 0, NULL, 0); + attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; + devlink_port_attrs_set(&ionic->dl_port, &attrs); err = devlink_port_register(dl, &ionic->dl_port, 0); if (err) dev_err(ionic->dev, "devlink_port_register failed: %d\n", err); diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index ec6b6f7818ac..d88316ea8684 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -889,8 +889,11 @@ static const struct devlink_ops nsim_dev_devlink_ops = { static int __nsim_dev_port_add(struct nsim_dev *nsim_dev, unsigned int port_index) { + struct devlink_port_attrs attrs = {}; struct nsim_dev_port *nsim_dev_port; struct devlink_port *devlink_port; + const unsigned char *switch_id; + unsigned char switch_id_len; int err; nsim_dev_port = kzalloc(sizeof(*nsim_dev_port), GFP_KERNEL); @@ -899,10 +902,13 @@ static int __nsim_dev_port_add(struct nsim_dev *nsim_dev, nsim_dev_port->port_index = port_index; devlink_port = &nsim_dev_port->devlink_port; - devlink_port_attrs_set(devlink_port, DEVLINK_PORT_FLAVOUR_PHYSICAL, - port_index + 1, 0, 0, - nsim_dev->switch_id.id, - nsim_dev->switch_id.id_len); + attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; + attrs.phys.port_number = port_index + 1; + switch_id = nsim_dev->switch_id.id; + switch_id_len = nsim_dev->switch_id.id_len; + memcpy(attrs.switch_id.id, switch_id, switch_id_len); + attrs.switch_id.id_len = switch_id_len; + devlink_port_attrs_set(devlink_port, &attrs); err = devlink_port_register(priv_to_devlink(nsim_dev), devlink_port, port_index); if (err) diff --git a/include/net/devlink.h b/include/net/devlink.h index 4d840997690a..96fe5c05f62f 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -1158,17 +1158,9 @@ void devlink_port_type_ib_set(struct devlink_port *devlink_port, struct ib_device *ibdev); void devlink_port_type_clear(struct devlink_port *devlink_port); void devlink_port_attrs_set(struct devlink_port *devlink_port, - enum devlink_port_flavour flavour, - u32 port_number, bool split, - u32 split_subport_number, - const unsigned char *switch_id, - unsigned char switch_id_len); -void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port, - const unsigned char *switch_id, - unsigned char switch_id_len, u16 pf); + struct devlink_port_attrs *devlink_port_attrs); +void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port, u16 pf); void devlink_port_attrs_pci_vf_set(struct devlink_port *devlink_port, - const unsigned char *switch_id, - unsigned char switch_id_len, u16 pf, u16 vf); int devlink_sb_register(struct devlink *devlink, unsigned int sb_index, u32 size, u16 ingress_pools_count, diff --git a/net/core/devlink.c b/net/core/devlink.c index c4507fd9fc11..6a783e712794 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -7377,9 +7377,7 @@ void devlink_port_type_clear(struct devlink_port *devlink_port) EXPORT_SYMBOL_GPL(devlink_port_type_clear); static int __devlink_port_attrs_set(struct devlink_port *devlink_port, - enum devlink_port_flavour flavour, - const unsigned char *switch_id, - unsigned char switch_id_len) + enum devlink_port_flavour flavour) { struct devlink_port_attrs *attrs = &devlink_port->attrs; @@ -7387,12 +7385,10 @@ static int __devlink_port_attrs_set(struct devlink_port *devlink_port, return -EEXIST; devlink_port->attrs_set = true; attrs->flavour = flavour; - if (switch_id) { + if (attrs->switch_id.id) { devlink_port->switch_port = true; - if (WARN_ON(switch_id_len > MAX_PHYS_ITEM_ID_LEN)) - switch_id_len = MAX_PHYS_ITEM_ID_LEN; - memcpy(attrs->switch_id.id, switch_id, switch_id_len); - attrs->switch_id.id_len = switch_id_len; + if (WARN_ON(attrs->switch_id.id_len > MAX_PHYS_ITEM_ID_LEN)) + attrs->switch_id.id_len = MAX_PHYS_ITEM_ID_LEN; } else { devlink_port->switch_port = false; } @@ -7403,33 +7399,27 @@ static int __devlink_port_attrs_set(struct devlink_port *devlink_port, * devlink_port_attrs_set - Set port attributes * * @devlink_port: devlink port - * @flavour: flavour of the port - * @port_number: number of the port that is facing user, for example - * the front panel port number - * @split: indicates if this is split port - * @split_subport_number: if the port is split, this is the number - * of subport. - * @switch_id: if the port is part of switch, this is buffer with ID, - * otwerwise this is NULL - * @switch_id_len: length of the switch_id buffer + * @devlink_port_attrs: devlink port attributes, holds: + * @flavour: flavour of the port + * @port_number: number of the port that is facing + * user, for example the front panel + * port number + * @split: indicates if this is split port + * @split_subport_number: if the port is split, this + * is the number of subport. + * @switch_id: if the port is part of switch, this is + * buffer with ID, otherwise this is NULL + * @switch_id_len: length of the switch_id buffer */ void devlink_port_attrs_set(struct devlink_port *devlink_port, - enum devlink_port_flavour flavour, - u32 port_number, bool split, - u32 split_subport_number, - const unsigned char *switch_id, - unsigned char switch_id_len) + struct devlink_port_attrs *attrs) { - struct devlink_port_attrs *attrs = &devlink_port->attrs; int ret; - ret = __devlink_port_attrs_set(devlink_port, flavour, - switch_id, switch_id_len); + ret = __devlink_port_attrs_set(devlink_port, attrs->flavour); if (ret) return; - attrs->split = split; - attrs->phys.port_number = port_number; - attrs->phys.split_subport_number = split_subport_number; + devlink_port->attrs = *attrs; } EXPORT_SYMBOL_GPL(devlink_port_attrs_set); @@ -7438,20 +7428,14 @@ EXPORT_SYMBOL_GPL(devlink_port_attrs_set); * * @devlink_port: devlink port * @pf: associated PF for the devlink port instance - * @switch_id: if the port is part of switch, this is buffer with ID, - * otherwise this is NULL - * @switch_id_len: length of the switch_id buffer */ -void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port, - const unsigned char *switch_id, - unsigned char switch_id_len, u16 pf) +void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port, u16 pf) { struct devlink_port_attrs *attrs = &devlink_port->attrs; int ret; ret = __devlink_port_attrs_set(devlink_port, - DEVLINK_PORT_FLAVOUR_PCI_PF, - switch_id, switch_id_len); + DEVLINK_PORT_FLAVOUR_PCI_PF); if (ret) return; @@ -7465,21 +7449,15 @@ EXPORT_SYMBOL_GPL(devlink_port_attrs_pci_pf_set); * @devlink_port: devlink port * @pf: associated PF for the devlink port instance * @vf: associated VF of a PF for the devlink port instance - * @switch_id: if the port is part of switch, this is buffer with ID, - * otherwise this is NULL - * @switch_id_len: length of the switch_id buffer */ void devlink_port_attrs_pci_vf_set(struct devlink_port *devlink_port, - const unsigned char *switch_id, - unsigned char switch_id_len, u16 pf, u16 vf) { struct devlink_port_attrs *attrs = &devlink_port->attrs; int ret; ret = __devlink_port_attrs_set(devlink_port, - DEVLINK_PORT_FLAVOUR_PCI_VF, - switch_id, switch_id_len); + DEVLINK_PORT_FLAVOUR_PCI_VF); if (ret) return; attrs->pci_vf.pf = pf; diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 076908fdd29b..e055efff390b 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -261,10 +261,15 @@ static int dsa_port_setup(struct dsa_port *dp) struct devlink_port *dlp = &dp->devlink_port; bool dsa_port_link_registered = false; bool devlink_port_registered = false; + struct devlink_port_attrs attrs = {}; struct devlink *dl = ds->devlink; bool dsa_port_enabled = false; int err = 0; + attrs.phys.port_number = dp->index; + memcpy(attrs.switch_id.id, id, len); + attrs.switch_id.id_len = len; + if (dp->setup) return 0; @@ -274,8 +279,8 @@ static int dsa_port_setup(struct dsa_port *dp) break; case DSA_PORT_TYPE_CPU: memset(dlp, 0, sizeof(*dlp)); - devlink_port_attrs_set(dlp, DEVLINK_PORT_FLAVOUR_CPU, - dp->index, false, 0, id, len); + attrs.flavour = DEVLINK_PORT_FLAVOUR_CPU; + devlink_port_attrs_set(dlp, &attrs); err = devlink_port_register(dl, dlp, dp->index); if (err) break; @@ -294,8 +299,8 @@ static int dsa_port_setup(struct dsa_port *dp) break; case DSA_PORT_TYPE_DSA: memset(dlp, 0, sizeof(*dlp)); - devlink_port_attrs_set(dlp, DEVLINK_PORT_FLAVOUR_DSA, - dp->index, false, 0, id, len); + attrs.flavour = DEVLINK_PORT_FLAVOUR_DSA; + devlink_port_attrs_set(dlp, &attrs); err = devlink_port_register(dl, dlp, dp->index); if (err) break; @@ -314,8 +319,8 @@ static int dsa_port_setup(struct dsa_port *dp) break; case DSA_PORT_TYPE_USER: memset(dlp, 0, sizeof(*dlp)); - devlink_port_attrs_set(dlp, DEVLINK_PORT_FLAVOUR_PHYSICAL, - dp->index, false, 0, id, len); + attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; + devlink_port_attrs_set(dlp, &attrs); err = devlink_port_register(dl, dlp, dp->index); if (err) break; From patchwork Tue Jun 2 11:31:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danielle Ratson X-Patchwork-Id: 218051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3104C433E0 for ; Tue, 2 Jun 2020 11:32:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 911152068D for ; Tue, 2 Jun 2020 11:32:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="i91/bKsW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726963AbgFBLcK (ORCPT ); Tue, 2 Jun 2020 07:32:10 -0400 Received: from mail-vi1eur05on2085.outbound.protection.outlook.com ([40.107.21.85]:6161 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725900AbgFBLcJ (ORCPT ); Tue, 2 Jun 2020 07:32:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SechwI9iDIKmUXMdlAwGZ0Rh9xZqhw4MDeYAQYgSKkZsE+yrfQDKGMnMXEmTZEdwuxSs+Cd4nx9rCPhjZBrNqeCO6lPN6FzLHQYB0bjvX+wobN0aRB4LXzvs+KNSQISZd6ogpkOxroRmeH4nTA6YWbagEN8feokoHor7OOmfs0zlI1W2jBu8PD8MG5PHCsl6KmPSH44Eau7Yj+e+Kp6orQPCyxwywux97/R0u9mujGsPQzlkx5+UM5rq9J/PZ/sToCSWQOSNsUh1cFJorL2RKwxdaLYfDZh97SJisGoJdpreqY7DR6r5XBrXLGJOZnzdpssofQLK/dKjxji88v7Lkw== 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=fSsjUEMecom8Fv0/H07+XLJG/S3QU3de7Iqvu+1xYDQ=; b=Kczytv7nHu1vFpRuMfQidWTEVOeleZ82tivusrrV/oD0AjpeztH35Hc2t1PY0rtGjAjddJFBtZiLQ8KzR1ZbznDRGJfF16yT5jYPAvcoyRgGwXRKsFeMSLZ85or80Bhbpeo89+zSH1FYnCbunTwe/5IOshXj7xEqM/cK3pgpQm11U5eUw7xVtWaVAu8JsSZvmUv1zLV+C2vlNiGrxtJY+pNNyrgd0y7ucaDv6AO2gMwomwfhoV2hqYye66rha7OcQ7InuADXgE3oZj7uUUBG1uLovORftyjN7GjTwGQo8eVid8yR1daAKoVxtwIfTzq+pXVsjleDfnqmjmGxr98p9g== 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=fSsjUEMecom8Fv0/H07+XLJG/S3QU3de7Iqvu+1xYDQ=; b=i91/bKsWwl6bTQtYAUkKgRTvGuuLiVytebj0KlWiS3i6IFnkTaHOAHe5WCNmkaVKisWAH+a4WZqIR9PUha+TyfuHhffwSQZ+vpGZqWCq/4JJsUxfmFOuYYf53EzvGvNt6rNi/Q6ub/k12ZOGwQTTM7WuE+rDQPdRHXRNAuUy5mw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB5010.eurprd05.prod.outlook.com (2603:10a6:208:cd::23) by AM0PR05MB6628.eurprd05.prod.outlook.com (2603:10a6:20b:15b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.17; Tue, 2 Jun 2020 11:31:58 +0000 Received: from AM0PR05MB5010.eurprd05.prod.outlook.com ([fe80::ccb:c612:f276:a182]) by AM0PR05MB5010.eurprd05.prod.outlook.com ([fe80::ccb:c612:f276:a182%6]) with mapi id 15.20.3045.024; Tue, 2 Jun 2020 11:31:58 +0000 From: Danielle Ratson To: netdev@vger.kernel.org Cc: davem@davemloft.net, michael.chan@broadcom.com, kuba@kernel.org, jeffrey.t.kirsher@intel.com, saeedm@mellanox.com, leon@kernel.org, jiri@mellanox.com, idosch@mellanox.com, snelson@pensando.io, drivers@pensando.io, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, mlxsw@mellanox.com, Danielle Ratson Subject: [RFC PATCH net-next 5/8] devlink: Add a new devlink port lanes attribute and pass to netlink Date: Tue, 2 Jun 2020 14:31:16 +0300 Message-Id: <20200602113119.36665-6-danieller@mellanox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200602113119.36665-1-danieller@mellanox.com> References: <20200602113119.36665-1-danieller@mellanox.com> X-ClientProxiedBy: AM4P190CA0014.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::24) To AM0PR05MB5010.eurprd05.prod.outlook.com (2603:10a6:208:cd::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dev-r-vrt-156.mtr.labs.mlnx (37.142.13.130) by AM4P190CA0014.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.21 via Frontend Transport; Tue, 2 Jun 2020 11:31:56 +0000 X-Mailer: git-send-email 2.20.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8610a9a2-7d83-4e12-40c7-08d806e88f56 X-MS-TrafficTypeDiagnostic: AM0PR05MB6628: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0422860ED4 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Pj73bncKUM53NSVkuFTx5y5S+I72FB6clXMvS1Knb0tkeqOubJw+lMSvVgKeeBPGkzJDf5WR0A9t6GMkx/v5+Iig5xCqhnu+KqAb8Kto5EabUKRrW14mCe7XU4j5tIWJf6TVQN7ctbaNgghnFHpm22Xlhi+Nd0oNa3oKr6pA4N9Zc/qS8XC8NTg78nzfdSCFZZtnGVOdQBDN1K72OX+lOoml227QA1YTRT4MQ8UzL9POuDHsh/ScTMRISxB8c7RLJPhZM9lUF1VPdjSmDe9dhQLR7UgmXyS44ot/yRUzSSZDl2TC92MdBcM0JkZndzxW2t5uBoqvbGqM8pL4+U9KEw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB5010.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(396003)(136003)(376002)(346002)(186003)(16526019)(26005)(83380400001)(6506007)(86362001)(36756003)(2616005)(2906002)(52116002)(107886003)(6916009)(956004)(6486002)(8676002)(7416002)(66556008)(478600001)(6666004)(6512007)(66476007)(66946007)(5660300002)(316002)(4326008)(8936002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 79+eATXKMwaWLPsSIcOjcmtpescSj3W9ykFjDq8LnLIBHUZwaaHBIbz55MKsbDLOcDNtjFkW4GLUpmH5YvYOkuJK5nwyLUduiIlA5qbFgDCwcaDYVpxdSRqCWD+yM32s3FRSyFJPEzGfKA4+xk+ZeTCZbO33xnHGNuR+9MvUZH47tnTqTAxJKwwcaw/xWYDJbOuMIr5D0Yer1rwrTj1X+yY361VRDKRNy6mPPAzQMCuUuFY49448ySsKeAE4GwAyAZxrLo5CfQV5th/OT0q2a/P0/Mjj/708bvy1j72RDJxvNz0hdxkpQCLhX6Ok6tfQsRpyN4qEqd21Twz33VPbx660lEjAskiHvxTHSpSO/4hlzj4Qh6LoEFY/sZoBfV4abjvFmucW2a8LKFux9d5OyCppt45Kn9AtdxbtFLqFfqa36T4Ju+VlQ0zGtFoVzTCReaKowXQ8sexcN1y+ZQw6ZBJyaQ0vGtJrsof1QF3TfoI= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8610a9a2-7d83-4e12-40c7-08d806e88f56 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2020 11:31:58.1538 (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: Gnsarl70KYJGMJTq65adRYQyfIiJiAst/aEfkXsGgST14oyfRFToxJ5+pjP2BEP2nF47C4W9dUyHfpz8+uTbRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6628 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add a new devlink port attribute that indicates the port's number of lanes. Drivers are expected to set it via devlink_port_attrs_set(), before registering the port. The attribute is not passed to user space in case the number of lanes is invalid (0). Signed-off-by: Danielle Ratson Reviewed-by: Jiri Pirko --- drivers/net/ethernet/mellanox/mlxsw/core.c | 1 + include/net/devlink.h | 1 + include/uapi/linux/devlink.h | 2 ++ net/core/devlink.c | 7 +++++++ 4 files changed, 11 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index f44cb1a537f3..6cde196f6b70 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c @@ -2134,6 +2134,7 @@ static int __mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port, int err; attrs.split = split; + attrs.lanes = lanes; attrs.flavour = flavour; attrs.phys.port_number = port_number; attrs.phys.split_subport_number = split_port_subnumber; diff --git a/include/net/devlink.h b/include/net/devlink.h index 96fe5c05f62f..ee088cead80a 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -66,6 +66,7 @@ struct devlink_port_pci_vf_attrs { struct devlink_port_attrs { u8 split:1; + u32 lanes; enum devlink_port_flavour flavour; struct netdev_phys_item_id switch_id; union { diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h index 08563e6a424d..806c6a437fa2 100644 --- a/include/uapi/linux/devlink.h +++ b/include/uapi/linux/devlink.h @@ -451,6 +451,8 @@ enum devlink_attr { DEVLINK_ATTR_TRAP_POLICER_RATE, /* u64 */ DEVLINK_ATTR_TRAP_POLICER_BURST, /* u64 */ + DEVLINK_ATTR_PORT_LANES, /* u32 */ + /* add new attributes above here, update the policy in devlink.c */ __DEVLINK_ATTR_MAX, diff --git a/net/core/devlink.c b/net/core/devlink.c index 6a783e712794..ce82629b7386 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -526,6 +526,10 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg, if (!devlink_port->attrs_set) return 0; + if (attrs->lanes) { + if (nla_put_u32(msg, DEVLINK_ATTR_PORT_LANES, attrs->lanes)) + return -EMSGSIZE; + } if (nla_put_u16(msg, DEVLINK_ATTR_PORT_FLAVOUR, attrs->flavour)) return -EMSGSIZE; switch (devlink_port->attrs.flavour) { @@ -7405,6 +7409,9 @@ static int __devlink_port_attrs_set(struct devlink_port *devlink_port, * user, for example the front panel * port number * @split: indicates if this is split port + * @lanes: maximum number of lanes the port supports. + * 0 value is not passed to netlink and valid + * number is a power of 2. * @split_subport_number: if the port is split, this * is the number of subport. * @switch_id: if the port is part of switch, this is From patchwork Tue Jun 2 11:31:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danielle Ratson X-Patchwork-Id: 218050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3E16C433DF for ; Tue, 2 Jun 2020 11:32:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE3AB2068D for ; Tue, 2 Jun 2020 11:32:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="l/t6w3CM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727064AbgFBLcT (ORCPT ); Tue, 2 Jun 2020 07:32:19 -0400 Received: from mail-vi1eur05on2085.outbound.protection.outlook.com ([40.107.21.85]:6161 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725900AbgFBLcP (ORCPT ); Tue, 2 Jun 2020 07:32:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mTHwUwO5pJdom4iUMtblH/oHOYYPb/vcX6WKrXn7J0TEFGulEivjgqOPmD4KAk8jmTyICZrLUmYUrSbsTO+vIPUNU20Ai+6QcCslS02JH3FJg4u8Lrv+e7hYGbU5R0GkUVA/2OZuI7n5lUYLjsIHsCABqrNJDFzlpLmn2PK4Bm1By0ycE3KdZCvZc/tN9KIhpwB8WBAmrTrPhm+dIqrWgd+mflN31jFsHMmNSI/2FS0nKgHiI0yNQhRZm9cWWjFV6UFUhfIfGzLC9O4rJbPE85/lCFT1vsoOllHy70bVBvJeHkswYnxbtODHFkxeWFVF2s7VT6NRq1xxwhu7+sdYzA== 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=Gq5wth5oUugThJEeHkqYsiQPCoAg7LbBLQ4oyJNNruo=; b=UgwK/Pp1ha7GEDEcvEghacicBT2Vr+sw4R7rphRp0tmcJnoS+m1W3/e2sTnKJb6tUcaLpb2pNBnTnMzvHKaMVIscQl31Wwddic1Js3cf7JCmBhMCMx04f701WEbnXAvp9wrTAZXRTAOsbMJiupvFx8/iNNqMCJx1gsygt3laMU/FbT/M2xrMkXP6nmcGXKgS5GuD2fos4h7B58RnljHbAlCnNfz5pVP0d9Sb9rS4QBHA1p14PGmslV/XAMFlBRTnt5X/r1e+V8ssqs9qz/pfFIcBjfFVwwUmNfNHWKd/gLvK8lPRGbhonYV03xlXZ3DObrghvkbYlDKGxdPlEw5Cag== 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=Gq5wth5oUugThJEeHkqYsiQPCoAg7LbBLQ4oyJNNruo=; b=l/t6w3CMzf2dCCX5s1q4uDxMpXL9duSuoUJHVUF+c/bwkfePvukpq+/B/1XruS4EEM6QYLYlQzSQfFe594mU5xZh/4Dn0Xpr8ajfdDyQplLeSz9cqEJ0KXHblB2kOgnTRkc2ALLAPSHdN+FbuGoAltc6mMLAWnPBGKUk2JJZzDs= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB5010.eurprd05.prod.outlook.com (2603:10a6:208:cd::23) by AM0PR05MB6628.eurprd05.prod.outlook.com (2603:10a6:20b:15b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.17; Tue, 2 Jun 2020 11:32:04 +0000 Received: from AM0PR05MB5010.eurprd05.prod.outlook.com ([fe80::ccb:c612:f276:a182]) by AM0PR05MB5010.eurprd05.prod.outlook.com ([fe80::ccb:c612:f276:a182%6]) with mapi id 15.20.3045.024; Tue, 2 Jun 2020 11:32:04 +0000 From: Danielle Ratson To: netdev@vger.kernel.org Cc: davem@davemloft.net, michael.chan@broadcom.com, kuba@kernel.org, jeffrey.t.kirsher@intel.com, saeedm@mellanox.com, leon@kernel.org, jiri@mellanox.com, idosch@mellanox.com, snelson@pensando.io, drivers@pensando.io, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, mlxsw@mellanox.com, Danielle Ratson Subject: [RFC PATCH net-next 7/8] devlink: Add a new devlink port split ability attribute and pass to netlink Date: Tue, 2 Jun 2020 14:31:18 +0300 Message-Id: <20200602113119.36665-8-danieller@mellanox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200602113119.36665-1-danieller@mellanox.com> References: <20200602113119.36665-1-danieller@mellanox.com> X-ClientProxiedBy: AM4P190CA0014.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::24) To AM0PR05MB5010.eurprd05.prod.outlook.com (2603:10a6:208:cd::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dev-r-vrt-156.mtr.labs.mlnx (37.142.13.130) by AM4P190CA0014.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.21 via Frontend Transport; Tue, 2 Jun 2020 11:32:03 +0000 X-Mailer: git-send-email 2.20.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a1586650-8d97-4d06-89e6-08d806e8931f X-MS-TrafficTypeDiagnostic: AM0PR05MB6628: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0422860ED4 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KyxOvnc+fQh76cCgj4j2PxkJ+0RtMIw3zX4xG7zCB/s7m9pyluwnTw9dLBYhUBM/7SAIB5G/ObegoIuxrBruwA2T1wnbGi0cpxjiaY8KJVuV5mr3I4civ9YgGUH481XiRiEPbQzEdMAZvaSLbohuRAppNOFdSKAHPfD73VeLHKAcBTAo326k2tMv06otJ3enjjX6wcQUN9VBC3O+jQFPWxAhI0ZRkb0fFTkN8Sa3Tzg/W3uTxLUxR61ZLxuvnt5vNVXFjROyyyzAhkZ/VmONn/5pg8fpuPISiNDzY3blL/4HdtnCib+horsS9scvAaKq X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB5010.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(396003)(136003)(376002)(346002)(186003)(16526019)(26005)(83380400001)(6506007)(86362001)(36756003)(2616005)(2906002)(52116002)(107886003)(6916009)(956004)(6486002)(8676002)(7416002)(66556008)(478600001)(6666004)(6512007)(66476007)(66946007)(5660300002)(316002)(4326008)(8936002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eiwHYR7uJAy8EMBkOXHxMOby8rDHEAmX3kkJLK0tjWZ83Zscy64hxv0mfYLWqT4sU+yvFzwgJFEk/wOOq4iXqo1I8hM3HpLeiBcO8CWDPctCMU68j1l7CbMG7YbAC/+RiHqaIrWlI1Ljdv/FZCh9V16dQtobbXnZF6a8k516DTVQyDzmcFghKAvnOFEzfz9ij/sTAI5loKbKrya3BdC8MzKTv6fB2M0NcM390Vpbs3vGh9Z5ekof6j0OwAnWdLI6qVbDiQkLo6nST9dklFmUUGhs6TWTEdPkgQiH2JumwRf3wAe/6cvgvPoAWqCAdMXtav++oe0R9pk3qqhTJviQXLOTk/Drv80jtw5bFGYve99aonxNxYvBouSDvEC5MY6vGOiSPT+xvmvGYaPPA15kk4WAiQJh2i9mW3oZPx+r59lVrj5WI0yD2WgrxP1azKtC/MsJiA4vzQf5tzPPCOgAmmfBFJeEtDrMv99oAMHu0d0= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1586650-8d97-4d06-89e6-08d806e8931f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2020 11:32:04.5211 (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: 5VdTIL5No20yg96ssiEJ26p3q/x6ng518g16/qE0ROQgx0XWP9drSro2FznnBR6qGVy1JrVmgsnB+OECZ0buvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6628 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add a new attribute that indicates the split ability to devlink port. Drivers are expected to set it via devlink_port_attrs_set(), before registering the port. Signed-off-by: Danielle Ratson Reviewed-by: Jiri Pirko --- drivers/net/ethernet/mellanox/mlxsw/core.c | 1 + drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 1 + include/net/devlink.h | 3 ++- include/uapi/linux/devlink.h | 1 + net/core/devlink.c | 3 +++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index f85f5d88d331..8b3791d73c99 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c @@ -2135,6 +2135,7 @@ static int __mlxsw_core_port_init(struct mlxsw_core *mlxsw_core, u8 local_port, attrs.split = split; attrs.lanes = lanes; + attrs.splittable = splittable; attrs.flavour = flavour; attrs.phys.port_number = port_number; attrs.phys.split_subport_number = split_port_subnumber; diff --git a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c index 71f4e624b3db..b6a10565309a 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c @@ -367,6 +367,7 @@ int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port) return ret; attrs.split = eth_port.is_split; + attrs.splittable = !attrs.split; attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; attrs.phys.port_number = eth_port.label_port; attrs.phys.split_subport_number = eth_port.label_subport; diff --git a/include/net/devlink.h b/include/net/devlink.h index ee088cead80a..3eb5fd41731f 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -65,7 +65,8 @@ struct devlink_port_pci_vf_attrs { }; struct devlink_port_attrs { - u8 split:1; + u8 split:1, + splittable:1; u32 lanes; enum devlink_port_flavour flavour; struct netdev_phys_item_id switch_id; diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h index 806c6a437fa2..22bd17ba8adb 100644 --- a/include/uapi/linux/devlink.h +++ b/include/uapi/linux/devlink.h @@ -452,6 +452,7 @@ enum devlink_attr { DEVLINK_ATTR_TRAP_POLICER_BURST, /* u64 */ DEVLINK_ATTR_PORT_LANES, /* u32 */ + DEVLINK_ATTR_PORT_SPLITTABLE, /* u8 */ /* add new attributes above here, update the policy in devlink.c */ diff --git a/net/core/devlink.c b/net/core/devlink.c index ce82629b7386..a47426941e21 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -530,6 +530,8 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg, if (nla_put_u32(msg, DEVLINK_ATTR_PORT_LANES, attrs->lanes)) return -EMSGSIZE; } + if (nla_put_u8(msg, DEVLINK_ATTR_PORT_SPLITTABLE, attrs->splittable)) + return -EMSGSIZE; if (nla_put_u16(msg, DEVLINK_ATTR_PORT_FLAVOUR, attrs->flavour)) return -EMSGSIZE; switch (devlink_port->attrs.flavour) { @@ -7409,6 +7411,7 @@ static int __devlink_port_attrs_set(struct devlink_port *devlink_port, * user, for example the front panel * port number * @split: indicates if this is split port + * @splittable: indicates if the port can be split. * @lanes: maximum number of lanes the port supports. * 0 value is not passed to netlink and valid * number is a power of 2.