From patchwork Thu Jun 13 14:20:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 10992063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A0A9914C0 for ; Thu, 13 Jun 2019 15:03:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F59421327 for ; Thu, 13 Jun 2019 15:03:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83C06205FD; Thu, 13 Jun 2019 15:03:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DD0621327 for ; Thu, 13 Jun 2019 15:03:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732487AbfFMPDu (ORCPT ); Thu, 13 Jun 2019 11:03:50 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:37346 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732485AbfFMOUN (ORCPT ); Thu, 13 Jun 2019 10:20:13 -0400 Received: by mail-ed1-f68.google.com with SMTP id w13so31507163eds.4 for ; Thu, 13 Jun 2019 07:20:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-powerpc-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=l2XZf3MqSLL1068ArIZ1fX7e7BFKW+hoxEr0Z73hDYU=; b=wlnKxYFzVZAhVfDEKfEq/S9BWL/d8LsN46UzobezevW7QcLbccNwTYXGDAD5aPLH46 MOzFT1yqUoHiXGSohup1c0AbXgEcyX363SAQMQuX9xbgiTRnIbSIITWv/T72CqBqOptA X3gCSTeS4CKUVQWiZT5ZHWXi07yFkzWl5pXXnP3O+5m20qXpBjYhfgisYlN9k5rXKEsu mTaGhYWGmUeHQvDb1A4kuaC779hwD1jwJmG76fEBNnn6pWraiQ7V37kAhYgFzuccNqPz oO/dyVZhUR3cGjr4+6x963S0e1+pA1djGSr2XVkuOid4FU9tB3w/2h/V/2S4yLKG8P+S GhNw== 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:in-reply-to :references; bh=l2XZf3MqSLL1068ArIZ1fX7e7BFKW+hoxEr0Z73hDYU=; b=mCiAQ5TwBbCcOC2fK9pnVbEm4qba3aftclEW9nHRZq1Tp7dhnIBBdnUkE9DeMfyYEE Ozf9ELHXS17zQpHzHlz4un/xtB8jTBKAfK3MiPvlwFvcWBXO+GOF/JHUg/UbDbZOWd4k jkTmx94EgqnbQ5Ie+z2lxM3x6mQwXGGEmcb+m78Cy4iwFqOhtUFaJ2vS+yDCq1N24jY2 vTDvocSfYakiUXdj4hoYP/AyCcOlGl2b34mRNcshU32CjGHF79uLFbvhIzFjguk9idBI PCwtlYoMw/RCCR99x9pl5mQqvhxXI2okct3PMZ4drX7HU9sMJ+zwI0FoYgqiwkNpKw+j Zjdw== X-Gm-Message-State: APjAAAXLU3/A2kHlWj0vOKUj/6B09FzIAP5++omNvZSd9x0JuGARMpWT F4naN+hK1tz2otm9ZgIeEcMmEQ== X-Google-Smtp-Source: APXvYqxKWMiRpgcDCIIh/0S+T8OwFs1xE2aRwYnGai6MS2b984ArIgDAmqmX+DtQrGNYbvWsxUp+PA== X-Received: by 2002:a50:b66f:: with SMTP id c44mr28242447ede.171.1560435611510; Thu, 13 Jun 2019 07:20:11 -0700 (PDT) Received: from tegmen.arch.suse.de (charybdis-ext.suse.de. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id s57sm931939edd.54.2019.06.13.07.20.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Jun 2019 07:20:10 -0700 (PDT) From: Denis Kirjanov X-Google-Original-From: Denis Kirjanov To: davem@davemloft.net, dledford@redhat.com Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, mkubecek@suse.cz, Denis Kirjanov Subject: [PATCH net-next v2 1/2] ipoib: correcly show a VF hardware address Date: Thu, 13 Jun 2019 16:20:02 +0200 Message-Id: <20190613142003.129391-3-dkirjanov@suse.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190613142003.129391-1-dkirjanov@suse.com> References: <20190613142003.129391-1-dkirjanov@suse.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP in the case of IPoIB with SRIOV enabled hardware ip link show command incorrecly prints 0 instead of a VF hardware address. To correcly print the address add a new field to specify an address length. Before: 11: ib1: mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256 link/infiniband 80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff vf 0 MAC 00:00:00:00:00:00, spoof checking off, link-state disable, trust off, query_rss off ... After: 11: ib1: mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256 link/infiniband 80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff vf 0 link/infiniband 80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof checking off, link-state disable, trust off, query_rss off Signed-off-by: Denis Kirjanov --- drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 9b5e11d3fb85..04ea7db08e87 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1998,6 +1998,7 @@ static int ipoib_get_vf_config(struct net_device *dev, int vf, return err; ivf->vf = vf; + memcpy(ivf->mac, dev->dev_addr, dev->addr_len); return 0; } From patchwork Thu Jun 13 14:20:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 10992061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E1F114C0 for ; Thu, 13 Jun 2019 15:03:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C5C6212BE for ; Thu, 13 Jun 2019 15:03:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30CC2223B3; Thu, 13 Jun 2019 15:03:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1E3A212BE for ; Thu, 13 Jun 2019 15:03:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732668AbfFMPDt (ORCPT ); Thu, 13 Jun 2019 11:03:49 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:37348 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732487AbfFMOUO (ORCPT ); Thu, 13 Jun 2019 10:20:14 -0400 Received: by mail-ed1-f67.google.com with SMTP id w13so31507236eds.4 for ; Thu, 13 Jun 2019 07:20:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-powerpc-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CLJfufUC+jaDfyJ4se5WFGEmTMmNZoYdXCDhnYh3Yt8=; b=S8KeHYRWXb9Xg1KEMUNAVxKpWQ4XZJcB0tVZBOWVUkiqsaULcx3n6PfY81iFhqFQon XN6bGFXimmMXoHxiSSxq9B4KBqn2ukMHdbHlg5Ng+QeAj2ZYop+mjtXzyRFiid1H3TEz wRQjHel3LjXZTBQWYOXaSRSQJyjB4EbFau89qDwQGdERqYtOUgq2BCTdWCupu5O/wdRp XfhaI/1HXgQG12rAPV72npwqz4dX2YAUfYVNeWMhJdfKrk2v09msdFIsqvwCYQkGw4Eh IukyDkoMxD3AYdlfsTFW81E4l+I51/UhYDSo+fu14tWwT4QqggQEV6XR9d/nv26gvtL2 h8fg== 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:in-reply-to :references; bh=CLJfufUC+jaDfyJ4se5WFGEmTMmNZoYdXCDhnYh3Yt8=; b=d7ccmkeQz35/H6+HA3oBpKs+LotOyLcr5sclevno7NNgUFFs6o0F8OYekX+WcyQ1G2 p7wR39tdXGzV6HGn+c3K9pxLhKwkTmv8jNPBKnk3Sq356muDZq0gtn0C06eW0bkHDLdn iRSdOQrM+VIGIBdDdOz2CTEitnDu1K6L2F1d/JjaEEj/offn0CG3x2UHIgDmMalU8Vmh 1Z334akA6YamjnRURmCwDgNWN5TGlVDmDPp1u9eWwSHm98XegdlBappqNkq6wvRJJFAe Fdl0vCEQCR5KhJ0oUS3sSqIWFUIcxYLXZLRzhqC6qI/wZ2KAhUPNV0GY826tnXGk7nDu G12A== X-Gm-Message-State: APjAAAU59fpdqPE59O08BXHiCJ9rEhM95iNi0S6t4pD8OVTHADQOV5Oy qKiWJl5BZlJmoFsLiZtecD/OoA== X-Google-Smtp-Source: APXvYqzPeTdIki/JD/hpH3sIthvsp8TBy4DrrOof79LmIZ7Oz1g2qq5WzKhgV/0H0o05e+O5VQu45Q== X-Received: by 2002:a50:ca46:: with SMTP id e6mr61551411edi.275.1560435612366; Thu, 13 Jun 2019 07:20:12 -0700 (PDT) Received: from tegmen.arch.suse.de (charybdis-ext.suse.de. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id s57sm931939edd.54.2019.06.13.07.20.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Jun 2019 07:20:11 -0700 (PDT) From: Denis Kirjanov X-Google-Original-From: Denis Kirjanov To: davem@davemloft.net, dledford@redhat.com Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, mkubecek@suse.cz, Denis Kirjanov Subject: [PATCH net-next v2 2/2] ipoib: show VF broadcast address Date: Thu, 13 Jun 2019 16:20:03 +0200 Message-Id: <20190613142003.129391-4-dkirjanov@suse.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190613142003.129391-1-dkirjanov@suse.com> References: <20190613142003.129391-1-dkirjanov@suse.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP in IPoIB case we can't see a VF broadcast address for but can see for PF Before: 11: ib1: mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256 link/infiniband 80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff vf 0 MAC 14:80:00:00:66:fe, spoof checking off, link-state disable, trust off, query_rss off ... After: 11: ib1: mtu 2044 qdisc pfifo_fast state UP mode DEFAULT group default qlen 256 link/infiniband 80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff vf 0 link/infiniband 80:00:00:66:fe:80:00:00:00:00:00:00:24:8a:07:03:00:a4:3e:7c brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff, spoof checking off, link-state disable, trust off, query_rss off Signed-off-by: Denis Kirjanov --- include/uapi/linux/if_link.h | 5 +++++ net/core/rtnetlink.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 5b225ff63b48..1f36dd3a45d6 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -681,6 +681,7 @@ enum { enum { IFLA_VF_UNSPEC, IFLA_VF_MAC, /* Hardware queue specific attributes */ + IFLA_VF_BROADCAST, IFLA_VF_VLAN, /* VLAN ID and QoS */ IFLA_VF_TX_RATE, /* Max TX Bandwidth Allocation */ IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ @@ -704,6 +705,10 @@ struct ifla_vf_mac { __u8 mac[32]; /* MAX_ADDR_LEN */ }; +struct ifla_vf_broadcast { + __u8 broadcast[32]; +}; + struct ifla_vf_vlan { __u32 vf; __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index cec60583931f..88304212f127 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -908,6 +908,7 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev, size += num_vfs * (nla_total_size(0) + nla_total_size(sizeof(struct ifla_vf_mac)) + + nla_total_size(sizeof(struct ifla_vf_broadcast)) + nla_total_size(sizeof(struct ifla_vf_vlan)) + nla_total_size(0) + /* nest IFLA_VF_VLAN_LIST */ nla_total_size(MAX_VLAN_LIST_LEN * @@ -1197,6 +1198,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, struct ifla_vf_vlan vf_vlan; struct ifla_vf_rate vf_rate; struct ifla_vf_mac vf_mac; + struct ifla_vf_broadcast vf_broadcast; struct ifla_vf_info ivi; memset(&ivi, 0, sizeof(ivi)); @@ -1231,6 +1233,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, vf_trust.vf = ivi.vf; memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac)); + memcpy(vf_broadcast.broadcast, dev->broadcast, dev->addr_len); vf_vlan.vlan = ivi.vlan; vf_vlan.qos = ivi.qos; vf_vlan_info.vlan = ivi.vlan; @@ -1247,8 +1250,10 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, if (!vf) goto nla_put_vfinfo_failure; if (nla_put(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac) || + nla_put(skb, IFLA_VF_BROADCAST, sizeof(vf_broadcast), &vf_broadcast) || nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) || nla_put(skb, IFLA_VF_RATE, sizeof(vf_rate), + &vf_rate) || nla_put(skb, IFLA_VF_TX_RATE, sizeof(vf_tx_rate), &vf_tx_rate) || @@ -1753,6 +1758,7 @@ static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, + [IFLA_VF_BROADCAST] = {. len = sizeof(struct ifla_vf_broadcast) }, [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) }, [IFLA_VF_VLAN_LIST] = { .type = NLA_NESTED }, [IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) },