From patchwork Mon Jun 17 08:53:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 10998579 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 22A75112C for ; Mon, 17 Jun 2019 08:53:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12FE428874 for ; Mon, 17 Jun 2019 08:53:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0708528877; Mon, 17 Jun 2019 08:53: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 6C08528874 for ; Mon, 17 Jun 2019 08:53:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726731AbfFQIxt (ORCPT ); Mon, 17 Jun 2019 04:53:49 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:38929 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725826AbfFQIxt (ORCPT ); Mon, 17 Jun 2019 04:53:49 -0400 Received: by mail-ed1-f68.google.com with SMTP id m10so15035063edv.6 for ; Mon, 17 Jun 2019 01:53:48 -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=tVdybmwcrudt9c/Fjr6ik4Y4QWR2zx2XxazxsJ9Os08=; b=FgMRwUPbuEvJzbL8PBS5vNGvEhcMXLT3jMfxRuwMUz069Fb+j7se/WTJ3z9LVnjbG6 98Y7N7aHskNgVPoVoIgwWL9SEEIgySDn0Y3Ur9PkQkJeqMHNRSMUn/kf5aXqKBUd58Cu hOtpiKGPLWCoS5YD3dk4HsTl1lW+dgDdlc49AX/mf5jUnvXV+FaL3Gu3qurNd428A3NV Vi3JfbZA4mopUsqmyJGa4Wgefr2/Y8tmGWn0qKXmQYswCfspBS2TWuTOOIdbHwrG0kP0 IQ1zA2o6YKURf7muC7i9llEAKZ9ZFY5fJt8C0+lIwQFsk+a091YUQ9503gVgDtxV3EcN 4uUw== 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=tVdybmwcrudt9c/Fjr6ik4Y4QWR2zx2XxazxsJ9Os08=; b=iFWAjvG5ZBcfFpjMkByZmleV5aPTUOknTC1ynNJGvrWJUisUKv5XLSbE4+sYVOgT85 M4ELOuWxtEqgRJkPfG0oAaxla0XzSyHWjfmQ/bXsVbLgR9SsR9guYRzIxoPf3NAw7suh frQ1gq1oPQDAME9kKm+Lm+ux+2SAiSwy6dmlUyFHso2wbYkoUqHMbZG+RnKKCw/e9GHR Q+eJjQcidWnslrxbaT0ptLFEN9aV31cpCNVc9ve5ff1Byi5Q/HwNskhFE5buohXis485 E0hmFp9o/PUjztFGNaVBCvaEnIxGCkA2dB+z3Cfm0JIqMwugYWYlrHeuAC/LPYvUw/7/ /4TQ== X-Gm-Message-State: APjAAAUPqFruvZ4VTDm5SAKGUteeKLKxVYBzaxe5ZnR8qT71ZQPB4jxj wIWz6RquKl+cuA9JdsuD5PKYM9nDeRU= X-Google-Smtp-Source: APXvYqx/ZK+CJMvgB9VVxuWljmLEpBD7Y1zlCGUtpeu2PX2nLWMIOqMtyw4ZmxucdIEf+1EtiIeF/A== X-Received: by 2002:a17:906:3452:: with SMTP id d18mr74122016ejb.24.1560761627751; Mon, 17 Jun 2019 01:53:47 -0700 (PDT) Received: from tegmen.arch.suse.de (nat.nue.novell.com. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id y11sm2075735ejb.54.2019.06.17.01.53.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jun 2019 01:53:47 -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: Mon, 17 Jun 2019 10:53:38 +0200 Message-Id: <20190617085341.51592-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 with iproute2 patch[0] 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 [0]: https://patchwork.kernel.org/patch/10997111/ v1->v2: just copy an address without modifing ifla_vf_mac v2->v3: update the changelog v3->v4: update the changelog: add a link to the patch for iproute2 Signed-off-by: Denis Kirjanov Acked-by: Doug Ledford --- 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 Mon Jun 17 08:53:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 10998581 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 B9F3614B6 for ; Mon, 17 Jun 2019 08:53:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB1DB28872 for ; Mon, 17 Jun 2019 08:53:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E77F28877; Mon, 17 Jun 2019 08:53:58 +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 2742F28872 for ; Mon, 17 Jun 2019 08:53:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727342AbfFQIxw (ORCPT ); Mon, 17 Jun 2019 04:53:52 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36048 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbfFQIxv (ORCPT ); Mon, 17 Jun 2019 04:53:51 -0400 Received: by mail-ed1-f68.google.com with SMTP id k21so15045817edq.3 for ; Mon, 17 Jun 2019 01:53:50 -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=DTdlSRI5toTIXOI9GdbnOjjqVUi+gPD2G3Jt4p3hHow=; b=QFtPAWiyBosToAPGs0O6nwrHBfHu1PCESD+JsskSK/eKnHBZYEZ9wT3nrRA4idqqZN m4hnSvLBi8igx9+/4HZHaRrlg+vi2E5AvCrUMW/3f+CNPxcv1FlF0HnzJZIdVhDlQcE0 4fJ9b81hDYV/kHMEQS1IPi2UTefR3hYxpQgS9ELr9hVTtK8otkQl1vDp38RMR6wSUnQM LOw8DuFp6U0qXLOaAu0xQmiR5AAjch4fIycwZ0Uck0LXuKw9Nv4Tza/c3fX4vdKpD42J 174qlRjNffoxKtPMK5k9ssMEOvk9UsVnQxrCiozXGEcN7K7K7qkYkiiO404Rbxdgb2mv +uug== 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=DTdlSRI5toTIXOI9GdbnOjjqVUi+gPD2G3Jt4p3hHow=; b=Pv6scJEhjQQQkDudVMfrApiQqvbj+shD1ElEqpAmnaEeYa9PsOQAdrF3lgz4QR04lK txrnhJEAC476WzPJcrNKAU3Gq7i71yydg3O+bshq69eo36r8g4TcysTa0youLuc065Ne aqvHvvtNdnvU1lDw/05DzOp9u4dPGM3i8EkJoumEI/Pvij9pGmF6TgG+iuRP/7XPm1vO 6KG1SnuHn7JqavMxVHVWV9kPjRyaAh6uZieimTWfMiCNBPW2F3uKPOkIHdg816RgzGYr K3hyLnPy9gtptDa62cwJ8OhgyZWJMAYJMeMvx3CkSIKsDW4U/OT466J6piN/v9P5HTt2 Ooaw== X-Gm-Message-State: APjAAAVs3lyGh34tbnKZgduRei03a5CDbgV1L4m1WzKDZrKSBmpPZhle OPdlWuiWcaxTMrv9O//V+lYdqQ== X-Google-Smtp-Source: APXvYqxoMlM/rJp3A933zVaQKrNk7W0KzCCSgP+wr+yYtoTX07t4tKNdjRNlGEEbkmp41wqCb9gMzw== X-Received: by 2002:a17:906:610:: with SMTP id s16mr93601890ejb.108.1560761628569; Mon, 17 Jun 2019 01:53:48 -0700 (PDT) Received: from tegmen.arch.suse.de (nat.nue.novell.com. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id y11sm2075735ejb.54.2019.06.17.01.53.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jun 2019 01:53:48 -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: Mon, 17 Jun 2019 10:53:39 +0200 Message-Id: <20190617085341.51592-2-dkirjanov@suse.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190617085341.51592-1-dkirjanov@suse.com> References: <20190617085341.51592-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 with iproute2 patch[0]: 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 [0]: https://patchwork.kernel.org/patch/10997111 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 v3->v4: update the changelog: add a link to the patch for iproute2 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) },