From patchwork Thu Mar 22 10:55:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 889302 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="J7ftBWmJ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 406Nql2lwlz9s1c for ; Thu, 22 Mar 2018 21:55:31 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754538AbeCVKza (ORCPT ); Thu, 22 Mar 2018 06:55:30 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:40927 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753653AbeCVKzZ (ORCPT ); Thu, 22 Mar 2018 06:55:25 -0400 Received: by mail-wm0-f41.google.com with SMTP id t6so15262589wmt.5 for ; Thu, 22 Mar 2018 03:55:24 -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=pdIfZM3Brwb7McVK+WdzhZkQXxAUihQwYwtSTjVJLVs=; b=J7ftBWmJ8+PCe5VaK9r4jQc/x1H2ioHwvz3kuSLxOazlMI2MQdID/T32eS8LPFs+Ej QFp7uXOX7dw+/oKaYtKnodzCJvSTtJBx9Tr1sQGEhTO8MIYKl4FKSxUGe9/Q8HhXEHmf 6ml0EzMAZX1Z6tl5xzQqYg9XuboGEF2JKqv5BTtG025DO9nX+aPATapMRrmfghw10KgI yZoLdlSIjMi+xBJ6/xAsavh2ewy4IRCxMMS/P5MMlYyxDxwa1ouHlR3/cN00NfojTEvG 43yy462QGwhC5qBybIGidNmull3YjFPR0IdswwG8qDAsADpSW+C1YugnedJMHnthOLqz SwJA== 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=pdIfZM3Brwb7McVK+WdzhZkQXxAUihQwYwtSTjVJLVs=; b=GRLlYLRpOpGikq9d7ELHOKJbpIsI4fTpwy57D7OSOKXOKI6NW30OlC8JBlU/4ES4Ne UZ8/bhzGN3mJHlwKrl8c7VtjgytTSrlU/GR2cvr+u4VKQ5e1isokxIRWyRJ26xsMnJUo hqW1eV72o6x+tGtUEGyh6vo88FrIY6imv7/ZEmKhj7wTg6znIR+gNc2Sc6W86hCJLBci l8HpRvSjCQy+PthNu2/NsCz8544SeIA4PAH4bCUtb4pf76yIa3UL7Ildj+a21v5YHsLG GVn5FpSyPfRCMLDOyOAUhlxHp/LC6gw6SboSPG274WHZfBJryGG4eAYhxxxBNnuRpQji 11Vw== X-Gm-Message-State: AElRT7EtYpgdS2Ea0g1eSG/Jqe4UyumBX4Q7UxFJkfJTqc3FZUVvSdE1 qwBEsS1XjpbnuwTAwB9grj54JJ0U X-Google-Smtp-Source: AG47ELsjX8nuvRxKNAJmf60237P8yeiX4crmv7UZRp1xN8nXAFwGmX7ZnugFv3D8hPQw0UDXlHzFOQ== X-Received: by 10.28.158.205 with SMTP id h196mr4808035wme.25.1521716123571; Thu, 22 Mar 2018 03:55:23 -0700 (PDT) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id 93sm5379810wrh.46.2018.03.22.03.55.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Mar 2018 03:55:23 -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 Subject: [patch net-next RFC 00/12] devlink: introduce port flavours and common phys_port_name generation Date: Thu, 22 Mar 2018 11:55:10 +0100 Message-Id: <20180322105522.8186-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. I'm testing this with Netronome nfp hardware. When the user has 2 physical ports, 1 pf, and 4 vfs, he should see something like this: # devlink port pci/0000:05:00.0/0: type eth netdev enp5s0np0 flavour physical number 0 pci/0000:05:00.0/268435456: type eth netdev eth0 flavour physical number 0 pci/0000:05:00.0/268435460: type eth netdev enp5s0np1 flavour physical number 1 pci/0000:05:00.0/536875008: type eth netdev eth2 flavour pf_rep number 536875008 pci/0000:05:00.0/536870912: type eth netdev eth1 flavour vf_rep number 0 pci/0000:05:00.0/536870976: type eth netdev eth3 flavour vf_rep number 1 pci/0000:05:00.0/536871040: type eth netdev eth4 flavour vf_rep number 2 pci/0000:05:00.0/536871104: type eth netdev eth5 flavour vf_rep number 3 The indexes are weird numbers now. That needs to be fixed. Also, netdev renaming does not work correctly for me now for some reason. Also, there is one extra port that I don't understand what is the purpose for it - something nfp specific perhaps. The desired output should look like this: # devlink port pci/0000:05:00.0/0: type eth netdev enp5s0np0 flavour physical number 0 pci/0000:05:00.0/1: type eth netdev enp5s0np1 flavour physical number 1 pci/0000:05:00.0/2: type eth netdev enp5s0npf0 flavour pf_rep number 0 pci/0000:05:00.0/3: type eth netdev enp5s0nvf0 flavour vf_rep number 0 pci/0000:05:00.0/4: type eth netdev enp5s0nvf1 flavour vf_rep number 1 pci/0000:05:00.0/5: type eth netdev enp5s0nvf2 flavour vf_rep number 2 pci/0000:05:00.0/6: type eth netdev enp5s0nvf3 flavour vf_rep number 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. I tested this for mlxsw and nfp. I have no way to test this on DSA hw, I would really appretiate DSA guys to test this. Thanks! Jiri Pirko (12): 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 dsa: use devlink helper to generate physical port name mlxsw: use devlink helper to generate physical port name nfp: flower: fix error path during representor creation nfp: set eth_id for representors to avoid port index conflict nfp: register devlink port for VF/PF representors nfp: flower: create port for flower vnic nfp: use devlink helper to generate physical port name nfp: flower: set sysfs link to device for representors 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/flower/main.c | 17 ++++- drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 45 +++++++++-- drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 19 ++++- drivers/net/ethernet/netronome/nfp/nfp_net_repr.h | 1 + drivers/net/ethernet/netronome/nfp/nfp_port.c | 30 +------- include/net/devlink.h | 32 ++++++-- include/uapi/linux/devlink.h | 22 ++++++ net/core/devlink.c | 92 ++++++++++++++++++++--- net/dsa/dsa2.c | 23 ++++++ net/dsa/slave.c | 6 +- 14 files changed, 252 insertions(+), 90 deletions(-)