From patchwork Thu Sep 17 17:20:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 260709 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=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, 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 C6533C433E2 for ; Thu, 17 Sep 2020 17:20:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CF39206B6 for ; Thu, 17 Sep 2020 17:20:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="WawXX1GC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726405AbgIQRUw (ORCPT ); Thu, 17 Sep 2020 13:20:52 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:11028 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726411AbgIQRUf (ORCPT ); Thu, 17 Sep 2020 13:20:35 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 17 Sep 2020 10:19:04 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 17 Sep 2020 10:20:33 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 17 Sep 2020 10:20:33 -0700 Received: from sw-mtx-036.mtx.labs.mlnx (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 17 Sep 2020 17:20:32 +0000 From: Parav Pandit To: , , CC: Parav Pandit Subject: [PATCH net-next v2 0/8] devlink: Add SF add/delete devlink ops Date: Thu, 17 Sep 2020 20:20:12 +0300 Message-ID: <20200917172020.26484-1-parav@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200917081731.8363-8-parav@nvidia.com> References: <20200917081731.8363-8-parav@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1600363144; bh=zvuS8s0qxZ5cKsy1wxygzQ59kQ4ObXSo+U0oboEg5kE=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding: Content-Type:X-Originating-IP:X-ClientProxiedBy; b=WawXX1GCVfRz7G9O/r0J8MOumiiiAAWLcTal6/mNoCIwD71TGJLxAEMhAjdpKZACR SSzg6bFMt5AU6gncNX7U6jR/tzgukeOJB4RmFH1PPdqR9ddpjQhgjQBH5fn3xp7q57 pIMAi5hdk1SdFgCsHuJFWqhOBO7BE4xqsOV54j4pup5ej6aENMb8vRSyABtx8HB3v4 QU2NeNGDiMzhfuHG092G7kmjWKaaKOLm+sUGQl2ohhX1C4WxDelINxNd/OztgAP9MJ DLIzaZDZU0chiAYznK0WWVrOcSGaucECcpfHhLyhzFF1zqtWyqa7ZLmAGzUre4+zSf 9eiImRc2ziQNg== Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Dave, Jakub, Similar to PCI VF, PCI SF represents portion of the device. PCI SF is represented using a new devlink port flavour. This short series implements small part of the RFC described in detail at [1] and [2]. It extends (a) devlink core to expose new devlink port flavour 'pcisf'. (b) Expose new user interface to add/delete devlink port. (c) Extends netdevsim driver to simulate PCI PF and SF ports (d) Add port function state attribute Patch summary: Patch-1 Extends devlink to expose new PCI SF port flavour Patch-2 Extends devlink to let user add, delete devlink Port Patch-3 Prepare code to handle multiple port attributes Patch-4 Extends devlink to let user get, set function state Patch-5 Extends netdevsim driver to simulate PCI PF ports Patch-6 Extends netdevsim driver to simulate hw_addr get/set Patch-7 Extends netdevsim driver to simulate function state get/set Patch-8 Extends netdevsim driver to simulate PCI SF ports [1] https://lore.kernel.org/netdev/20200519092258.GF4655@nanopsycho/ [2] https://marc.info/?l=linux-netdev&m=158555928517777&w=2 --- Changelog: v1->v2: - Fixed extra semicolon at end of switch case reportec by coccinelle Parav Pandit (8): devlink: Introduce PCI SF port flavour and port attribute devlink: Support add and delete devlink port devlink: Prepare code to fill multiple port function attributes devlink: Support get and set state of port function netdevsim: Add support for add and delete of a PCI PF port netdevsim: Simulate get/set hardware address of a PCI port netdevsim: Simulate port function state for a PCI port netdevsim: Add support for add and delete PCI SF port drivers/net/netdevsim/Makefile | 3 +- drivers/net/netdevsim/dev.c | 14 + drivers/net/netdevsim/netdevsim.h | 32 ++ drivers/net/netdevsim/port_function.c | 498 ++++++++++++++++++++++++++ include/net/devlink.h | 75 ++++ include/uapi/linux/devlink.h | 13 + net/core/devlink.c | 230 ++++++++++-- 7 files changed, 840 insertions(+), 25 deletions(-) create mode 100644 drivers/net/netdevsim/port_function.c