From patchwork Fri Jun 14 13:32:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 10995345 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 BC5F4924 for ; Fri, 14 Jun 2019 13:33:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC79A27CF9 for ; Fri, 14 Jun 2019 13:33:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0F93286CC; Fri, 14 Jun 2019 13:33:01 +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 388D727CF9 for ; Fri, 14 Jun 2019 13:33:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728231AbfFNNc7 (ORCPT ); Fri, 14 Jun 2019 09:32:59 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:33156 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727729AbfFNNc7 (ORCPT ); Fri, 14 Jun 2019 09:32:59 -0400 Received: by mail-ed1-f65.google.com with SMTP id i11so3576813edq.0 for ; Fri, 14 Jun 2019 06:32:58 -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; bh=Xbwbd2FuvWF2sMTKfN6EsRdJUe6Rnva9AqWY64EVH9E=; b=P4l/749/6w7w0u+I8a0x9Mq6xwN8uEi6lcuObPfC2jGJOxxj977gYw0P9DNxMVRYuR IeDNWHg9wrpACLRYw2HrSHnu5PeggUS4RlzDPThp4ri1ot4kcF+b42joYzOZNZalZy4A eZNnJyrm64lHAOL1KEd4B6Jz2nPGXg4hB0NTUqO5CBVT8Vfo5nUHVRHn1O9pg4viLYGl IYCa294nYs0O79355NxX0sF2M0h0ryvvhCTu5mEd+dPjZKMqjaQo+jnbk+GclvkQYhyQ lpNf7dDaUrPQnd0MP3kywWXN0IofSPdUjvwh3+E6F8qBTX31VHFr8U8ikkbJpulVQwim e4mg== 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=Xbwbd2FuvWF2sMTKfN6EsRdJUe6Rnva9AqWY64EVH9E=; b=qEYqVgQwfQFN2px7UZrxKVh3hstGQr9vWSLJvdq02mROGVeQbYE8XQaVaCfPsbYpRV becwhYx3EPBlsUOns6NmWx4EJZALVyrjWYyDTXV+A1Gy4Omcg5CDINp1W98WLSdDJagf pK0LZeJNkZcn0dFZLjALZmqGd/D961+vJfVkuv0HGeRhoS+T9D9Em95CBrqCJMYTiiVo +XvWBcjc4RRhxyQbukXubWpvtEhuc4UkXUOxHbFIqs9CLgXu/gJAhR7EOPAf0ZXIIVkC 2N9hKmvR/Wgs9Fq+1/MOlOn2VtPraTO7ikzsE/UgXLiFRrNrjtLUMqRsp3HAQJIQjmWb M/ZA== X-Gm-Message-State: APjAAAXGPft8izSvVq//OgAp7yktHQF+D4upFv+us7uELm8Noc/uPUkz bWSV9J8uyNdg6/j3epwz2DygPw== X-Google-Smtp-Source: APXvYqy/MDwtm+0C6d59yT9OcEDGG8IZkCrMOAK6009SIIyKNiw673+xIZDafT6Y4ZxuqudSwaeuaQ== X-Received: by 2002:a17:906:1858:: with SMTP id w24mr73721955eje.212.1560519177434; Fri, 14 Jun 2019 06:32:57 -0700 (PDT) Received: from tegmen.arch.suse.de (nat.nue.novell.com. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id r11sm320509ejr.57.2019.06.14.06.32.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Jun 2019 06:32:56 -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 1/2] ipoib: correcly show a VF hardware address Date: Fri, 14 Jun 2019 15:32:46 +0200 Message-Id: <20190614133249.18308-1-dkirjanov@suse.com> X-Mailer: git-send-email 2.12.3 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. 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 v1->v2: just copy an address without modifing ifla_vf_mac v2->v3: update the changelog 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 Fri Jun 14 13:32:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 10995347 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 17287924 for ; Fri, 14 Jun 2019 13:33:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07794286AD for ; Fri, 14 Jun 2019 13:33:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFADC286B5; Fri, 14 Jun 2019 13:33:02 +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 DCD4C286CC for ; Fri, 14 Jun 2019 13:33:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728247AbfFNNdB (ORCPT ); Fri, 14 Jun 2019 09:33:01 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:40334 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728219AbfFNNdA (ORCPT ); Fri, 14 Jun 2019 09:33:00 -0400 Received: by mail-ed1-f66.google.com with SMTP id k8so3523101eds.7 for ; Fri, 14 Jun 2019 06:32:59 -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=aYhhfc+KUZ4F503Uo2wk/Th2y6eTdDCgMSMGmuYftiU=; b=R+a94iRvCzzHakqjzlegtGxkHPmBkVtTbfYe3sxtvYLif+h26b3yWKCGgPTZIINmaq ildR+IQk9A9iZnRIeuMQ6Usy3UiZHfmyFq9iL6EweVkan3qo7XHF3wOf7fdmICfR6kV9 HL3ATpJt5/PLpyxlvprRUuEXC/hPeTPu1bVOoiCEPubsF8JXHF+dHDc2SiToKFKUmiYO q/30ZBPFpU8Ob7Dbg3L1tvjWX3hXKwm/N/XGk9vPnPBOsW6DHBj/5Tt8L0dxBGB1VnRO 8DjyAnXdM6phGlb+w83W4UYPaWYlaLlJUqssPU3biz+eIw+dl6wdu3yRyjK67QbvSrFx 6gNA== 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=aYhhfc+KUZ4F503Uo2wk/Th2y6eTdDCgMSMGmuYftiU=; b=PVCiMITHvbrKbzfvcityi3d80eI1Bu2MCSsJ5A4G3bNS5s5CLRp3KkYqxwzg2ImW5S +ERQfVnKF8Z/FUJjQtwQTgbmEvM4QOrXRegpU9nMl5gAk8ZpDuftHq5oCKM0GoEEqt2g q+n6azk4nCK+ysBUmayyaR6lrPXiBQ6BYzM//z+lu5lwUCfl6b2j4raBBjUuxpx0bFXT 9HNCyoUtJ1vDTEDSn4qva2oq2ggSNGlGBd7OtNTnd9tXyA+hj0JCH1yY7jNWjf7TSTMG JoxUq0fDL83//J5ciDTwCDv7Va9xr6uPQuDbvMdk0BmcojI7MwDMOvFRDqqja8Le9tV4 eEEw== X-Gm-Message-State: APjAAAUmWqFFjH1Pnj3HYXrQbsDkTW/Fft4AdPq7bEDjzDT4U6WwiJRt 3AN2N/DOgo67nBkf48Hs7dzQyg== X-Google-Smtp-Source: APXvYqwYHwuLHle/xINkaVMv0O+A7bZdRxn7btjuJaD5nPFS9u+7dhR4aKbBJDypQDLS9qZ3bJlH5g== X-Received: by 2002:a17:906:2641:: with SMTP id i1mr4340794ejc.9.1560519178381; Fri, 14 Jun 2019 06:32:58 -0700 (PDT) Received: from tegmen.arch.suse.de (nat.nue.novell.com. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id r11sm320509ejr.57.2019.06.14.06.32.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Jun 2019 06:32:57 -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 2/2] ipoib: show VF broadcast address Date: Fri, 14 Jun 2019 15:32:47 +0200 Message-Id: <20190614133249.18308-2-dkirjanov@suse.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190614133249.18308-1-dkirjanov@suse.com> References: <20190614133249.18308-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 v1->v2: add the IFLA_VF_BROADCAST constant v2->v3: put IFLA_VF_BROADCAST at the end to avoid KABI breakage and set NLA_REJECT dev_setlink Signed-off-by: Denis Kirjanov --- include/uapi/linux/if_link.h | 5 +++++ net/core/rtnetlink.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 5b225ff63b48..6f75bda2c2d7 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -694,6 +694,7 @@ enum { IFLA_VF_IB_NODE_GUID, /* VF Infiniband node GUID */ IFLA_VF_IB_PORT_GUID, /* VF Infiniband port GUID */ IFLA_VF_VLAN_LIST, /* nested list of vlans, option for QinQ */ + IFLA_VF_BROADCAST, /* VF broadcast */ __IFLA_VF_MAX, }; @@ -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..8ac81630ab5c 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,6 +1250,7 @@ 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) || @@ -1753,6 +1757,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] = { .type = NLA_REJECT }, [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) },