From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.0 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 B6AAEC43381 for ; Fri, 1 Mar 2019 18:05:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7892620842 for ; Fri, 1 Mar 2019 18:05:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="PxkS8VtJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728347AbfCASFI (ORCPT ); Fri, 1 Mar 2019 13:05:08 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:39735 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727492AbfCASFI (ORCPT ); Fri, 1 Mar 2019 13:05:08 -0500 Received: by mail-qt1-f193.google.com with SMTP id o6so28780406qtk.6 for ; Fri, 01 Mar 2019 10:05:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VbICCqOrMsN2q9BagjJwAc7+cD/wA1wos1TUyZz86y4=; b=PxkS8VtJooo4yKLBxGzLZNvuixanzrzuRX+eFnVNgjwP1gpWPyzNDUt281tUO1Mggw AwidN3SNq87lIRDBl0MMTxjmy0FOH3Ol51nUpWWFUoD1FQcOzoeA586lJD07MMSt7V3D 0DuQnNNd4TCYzvr/MbfLSz/oiHFeeGsG1GWJsgCoNvAGXyjpblwT8++hENTxGkXqqcwk tQq+bS8RSptqpluNmxKBYbr6QFWWX2y6mp1HqDphqptd5bJG3D84WU9OZMSc43ScZRZL MlsTV5EZsdmXRzPzoRaIxBuhvJzVjDTdHjvi3FFad1r2vXT9uiL3+Xp9JnvCgh/8y/qY mwdg== 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:mime-version :content-transfer-encoding; bh=VbICCqOrMsN2q9BagjJwAc7+cD/wA1wos1TUyZz86y4=; b=T5YrIO78LTURlQsn0gb76WEaCtB/H14IghJX1s5qzmQ4wZj6GZEfatjJlVVr3mHOPm CGr0RsYExHVr6PSLk452ufR/qpndgo30ukhHEM2kQiWVod2jQrS//SsqIVMiSagJmEoK 09bMMYTdQinrd8yCcBsRpkps8SxCJS4YFDbUK0IeAVwFvUnQaHZpAmOBcFmvzKDwKtmP M7PHqwNlWUXxnaORoxKfAfh7dnkQX6eMv2oKuAhAkqWsExckxDrwfq3UyfBAWjfKkyXp SunfUe8bAKLuRIg5bVe/8lcXbLfcBi4Nzzp+3EXTxLMjiBM/SjiqTk8uQFBzpmzZBwoE 3X1A== X-Gm-Message-State: APjAAAVFlQfGiFIidxdw4NIyrgqBqmryJBlHcNanruEhLQEflcf/kfcc TKeist/u+mCTaSUpgXlUeL+FFx/+XWc= X-Google-Smtp-Source: APXvYqzcMuBWxKcipZUQYzk4kikntCFRJnoPcrmU7e1ZSLqqZvkKUmyjZOOndF5s6uwCHjX/JxVFlg== X-Received: by 2002:a0c:ae1a:: with SMTP id y26mr4876542qvc.234.1551463506572; Fri, 01 Mar 2019 10:05:06 -0800 (PST) Received: from jkicinski-Precision-T1700.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id a13sm16785792qtb.6.2019.03.01.10.05.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Mar 2019 10:05:05 -0800 (PST) From: Jakub Kicinski To: jiri@resnulli.us, davem@davemloft.net Cc: netdev@vger.kernel.org, oss-drivers@netronome.com, Jakub Kicinski Subject: [PATCH net-next v2 0/7] devlink: expose PF and VF representors as ports Date: Fri, 1 Mar 2019 10:04:46 -0800 Message-Id: <20190301180453.17778-1-jakub.kicinski@netronome.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi! This series is a long overdue follow up to Jiri's work on providing a common .ndo_phys_port_name implementation based on devlink ports. First devlink port flavours for PF and VF ports are added, and registered by the NFP. Port numbers and split info are reserved for physical and DSA ports. For PCIe ports we add pf/vf identifiers. Note that devices may have more than one PF, including multi host scenarios where not all pfs are connected to the same host. The port_index is slightly tricky to figure out, we use a bit of math to create unique IDs for ports. Next subports for PCIe ports are introduced. This is in case device has more than one netdev on a physical function (e.g. multi port SmartNIC). With the above features in place we can remove the ndo_phys_port_name implementation from the NFP and use the standard devlink one for port netdevs. Last but not least a concept of peer netdevs is added. In multi-host scenarios its currently not possible to figure out which PF is associated with the local host. Peer device is "the other side of the wire" for PCIe ports. In case of NFP we only link the PF netdevs, but it should be possible to also link VF peers after VF driver probes, if users request it. This is the conceptual image of devlink instances: HOST A || HOST B || PF A | V | V | V | V || PF B | V | V | V |*F |*F |*F |*F ... || |*F |*F |*F *port A0 |*port A1 | 0 | 1 | 2 | 3 ||*port B0 |*port B1 | 0 | 1 | 2 || PCI Express link || PCI Express link \ \ \ | | | | | / / / \ \ \ | | | | | / / / /\ \______\______\'___|___|__________|_______'____/___/___/__ /\ || |+PF0s0|+PF0s1 |+VF0|+VF1| ...| |+PF1s0|+PF1s1|+VF0|+VF1| || i || |------ ------ ----- ---- ----|--- ------ ------ ---- ----| || i d n H || | <<========== | || d n H e s O || | ==========>> | || e s O v t S || | SR-IOV e-switch | || v t S l a T || | <<========== | || l a T i n || | ==========>> | || i n n c A || | ________ _________ ________ | || n c B k e || | |+Phys 0 |+Phys 1 |+Phys 2 | | || k e || \---------------------------------------------------------/ || \/ | | | \/ | | | || || MAC 0 || MAC 1 || MAC 2 || || '+' marks the devlink ports and port (-representor-) netdevs '*' marks host netdevs (actual VF/PF netdev) v2 (Jiri): - update devlink user space output in a commit message; - split the pci attribute setting helper into pf and vf versions; - add peer IBDEV_NAME; - add nest for peer attributes. Jakub Kicinski (7): nfp: split devlink port init from registration devlink: add PF and VF port flavours nfp: register devlink ports of all reprs devlink: allow subports on devlink PCI ports nfp: switch to devlink_port_get_phys_port_name() devlink: introduce port's peer netdevs nfp: expose PF peer netdevs drivers/net/ethernet/netronome/nfp/abm/main.c | 1 + .../net/ethernet/netronome/nfp/flower/main.c | 1 + .../net/ethernet/netronome/nfp/nfp_devlink.c | 54 +++++- .../net/ethernet/netronome/nfp/nfp_net_main.c | 17 +- .../net/ethernet/netronome/nfp/nfp_net_repr.c | 16 +- drivers/net/ethernet/netronome/nfp/nfp_port.c | 33 +--- drivers/net/ethernet/netronome/nfp/nfp_port.h | 4 + include/net/devlink.h | 48 ++++- include/uapi/linux/devlink.h | 12 ++ net/core/devlink.c | 178 ++++++++++++++++-- 10 files changed, 310 insertions(+), 54 deletions(-) -- 2.19.2