From patchwork Fri May 18 07:28:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 916049 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="GZRWaeZx"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40nKYR3v1hz9s0q for ; Fri, 18 May 2018 17:29:15 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752237AbeERH3N (ORCPT ); Fri, 18 May 2018 03:29:13 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:32840 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751909AbeERH3L (ORCPT ); Fri, 18 May 2018 03:29:11 -0400 Received: by mail-wm0-f66.google.com with SMTP id x12-v6so2354338wmc.0 for ; Fri, 18 May 2018 00:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=wkR37k9z9RFX3TV9GneYLeRH6kh38/ZK7aKNHUrZkzg=; b=GZRWaeZxr4g5mfC9tatq2rt/o9ykTbH/sYkdMymBlF+bEQHcRVBxPMhVeE4TAL+lci uYJTJlu/9X/WQcq8MRhu16dQVaEoLXjlBKKna/9ubS6gSUTYTJy2+xppDftHQ5QZYBTI g6aViNrZZh978aU52wHMwn1gFPivpwWgVzJRFQkk/0Ry8VO22IjI6SdMGe0PsF7ZXiNa BiVyPGgcynXTsuSmCoXPCCj2gnZXSDO8p87acb2QiDfRrXL3wO81Hz1JJwZ6VCGcz7D7 krAFdBVgYdSPsVj+qnSvWfgsQEc0KwVe+3K/wp38UsBp2z7gv8fXREpxGcGL8DJR0mf/ S+Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wkR37k9z9RFX3TV9GneYLeRH6kh38/ZK7aKNHUrZkzg=; b=mJPWJoPC+LRoSZFuOK5ETIckFPdVTZ2JBQ4wW5uJyzh28mkRGSYOUy0uJOctgoS3Vv 5/IN+/51T7TMMBqRYV67lb67Q8DgRe3AgmGPaxxIBKD447DxPWwZb8PP2kCTHelDhMNR /utPiTXGAtRaE8I3HlQ6oYhJpeLgEqNuIhNix1j0LS2jslj7P9aWe1fFycWvAqWbfRrx AW2nsvAHl+Cgugg5gWXjaxiC1UXYD0sNqqaXUnQacFbBhCANRrmIpUO0wyBlPH+kRPFC GVIveQ/X06lBJw4caUgXR6rRIF4nBLWjmgnvMxcU/oa+M3htsYVzOWKNZzhLFtcdfQ9U QOSw== X-Gm-Message-State: ALKqPwdtVSbnq+UEUc0+TGeFFhyJ6T94vfNFDnx02+jXy5668sOyMWPJ jezoBac/Ym6kysbQAwYfpODTRyza X-Google-Smtp-Source: AB8JxZqvDNqdsSh1CqeDg2U2o4+27BzqcvOT9XPm9JpTRcrq5kkknZJ/K16YRRDj/95ScdWEE1zF7g== X-Received: by 2002:a1c:ee0d:: with SMTP id m13-v6mr3762774wmh.136.1526628550231; Fri, 18 May 2018 00:29:10 -0700 (PDT) Received: from localhost (ip-94-113-127-8.net.upcbroadband.cz. [94.113.127.8]) by smtp.gmail.com with ESMTPSA id r6-v6sm7103274wrg.73.2018.05.18.00.29.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 00:29:09 -0700 (PDT) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, idosch@mellanox.com, jakub.kicinski@netronome.com, mlxsw@mellanox.com, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com, michael.chan@broadcom.com, ganeshgr@chelsio.com, saeedm@mellanox.com, simon.horman@netronome.com, pieter.jansenvanvuuren@netronome.com, john.hurley@netronome.com, dirk.vandermerwe@netronome.com, alexander.h.duyck@intel.com, ogerlitz@mellanox.com, dsahern@gmail.com, vijaya.guvva@cavium.com, satananda.burla@cavium.com, raghu.vatsavayi@cavium.com, felix.manlunas@cavium.com, gospo@broadcom.com, sathya.perla@broadcom.com, vasundhara-v.volam@broadcom.com, tariqt@mellanox.com, eranbe@mellanox.com, jeffrey.t.kirsher@intel.com, roopa@cumulusnetworks.com Subject: [patch net-next 0/5] devlink: introduce port flavours and common phys_port_name generation Date: Fri, 18 May 2018 09:28:59 +0200 Message-Id: <20180518072904.29523-1-jiri@resnulli.us> X-Mailer: git-send-email 2.14.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jiri Pirko This patchset resolves 2 issues we have right now: 1) There are many netdevices / ports in the system, for port, pf, vf represenatation but the user has no way to see which is which 2) The ndo_get_phys_port_name is implemented in each driver separatelly, which may lead to inconsistent names between drivers. This patchset introduces port flavours which should address the first problem. In this initial patchset, I focus on DSA and their port flavours. As a follow-up, I plan to add PF and VF representor flavours. However, that needs additional dependencies in drivers (nfp, mlx5). The common phys_port_name generation is used by mlxsw. An example output for mlxsw looks like this: # devlink port ... pci/0000:03:00.0/59: type eth netdev enp3s0np4 flavour physical number 4 pci/0000:03:00.0/61: type eth netdev enp3s0np1 flavour physical number 1 pci/0000:03:00.0/63: type eth netdev enp3s0np2 flavour physical number 2 pci/0000:03:00.0/49: type eth netdev enp3s0np8s0 flavour physical number 8 split_group 8 subport 0 pci/0000:03:00.0/50: type eth netdev enp3s0np8s1 flavour physical number 8 split_group 8 subport 1 pci/0000:03:00.0/51: type eth netdev enp3s0np8s2 flavour physical number 8 split_group 8 subport 2 pci/0000:03:00.0/52: type eth netdev enp3s0np8s3 flavour physical number 8 split_group 8 subport 3 As you can see, the netdev names are generated according to the flavour and port number. In case the port is split, the split subnumber is also included. An example output for dsa_loop testing module looks like this: # devlink port mdio_bus/fixed-0:1f/0: type eth netdev lan1 flavour physical number 0 mdio_bus/fixed-0:1f/1: type eth netdev lan2 flavour physical number 1 mdio_bus/fixed-0:1f/2: type eth netdev lan3 flavour physical number 2 mdio_bus/fixed-0:1f/3: type eth netdev lan4 flavour physical number 3 mdio_bus/fixed-0:1f/4: type notset mdio_bus/fixed-0:1f/5: type notset flavour cpu number 5 mdio_bus/fixed-0:1f/6: type notset mdio_bus/fixed-0:1f/7: type notset mdio_bus/fixed-0:1f/8: type notset mdio_bus/fixed-0:1f/9: type notset mdio_bus/fixed-0:1f/10: type notset mdio_bus/fixed-0:1f/11: type notset Reviewed-by: Florian Fainelli Tested-by: Florian Fainelli --- RFC->v1: -removed nfp patches, removed DSA patch that used name generation helper -patch 1: - Reduced the nfp change just to simply use newly created attr_set func -patch 2: - rebased - removed pf/vf reps flavours -patch 3: - rebased -patch 4: - added missing break pointed out by Andrew Jiri Pirko (5): devlink: introduce devlink_port_attrs_set devlink: extend attrs_set for setting port flavours devlink: introduce a helper to generate physical port names dsa: set devlink port attrs for dsa ports mlxsw: use devlink helper to generate physical port name drivers/net/ethernet/mellanox/mlxsw/core.c | 18 ++++- drivers/net/ethernet/mellanox/mlxsw/core.h | 5 +- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 21 ++---- drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 11 ++- drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 5 +- include/net/devlink.h | 32 +++++++-- include/uapi/linux/devlink.h | 14 ++++ net/core/devlink.c | 86 +++++++++++++++++++++--- net/dsa/dsa2.c | 24 +++++++ 9 files changed, 170 insertions(+), 46 deletions(-)