From patchwork Wed Jun 12 11:33:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 10989497 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 8532A1398 for ; Wed, 12 Jun 2019 11:33:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 645E228716 for ; Wed, 12 Jun 2019 11:33:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5352C28A33; Wed, 12 Jun 2019 11:33: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 D300E28716 for ; Wed, 12 Jun 2019 11:33:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406413AbfFLLd4 (ORCPT ); Wed, 12 Jun 2019 07:33:56 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:39193 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406355AbfFLLd4 (ORCPT ); Wed, 12 Jun 2019 07:33:56 -0400 Received: by mail-ed1-f65.google.com with SMTP id m10so25224481edv.6 for ; Wed, 12 Jun 2019 04:33:54 -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=TsABUyr6czjxkgVPVlQz/+LV8vXRq4YLo2VkQCGdbrI=; b=lqhSGRt2GPnBMZl9OHjZPdTnaGC8MuuF5RKiYHKLj+kJd0vO34ykhAMVvi3/ztrcb/ m7s93ddk84XOaxuiJ3CZjQ+k3I/kXSCssrBrE3CD/s8IWGBLTJYHMk5AM5sJsin63LZF 6z9sw8VObdVnzvdQ0cZT1IGNk/BA/RGUMHq0ivf9v+R37MnG0Byv+z69qfoLzB/+U0Dw Ofy5fV6mXIvP9G65alKRuPWQC6I82zmYPjBAsjXij0cUcTiYY7imMMkS/AuPxsEpdiD/ I+ACUA99Jttddfz7yZBX3n7XJxHEaOPMdNqAdHrbzJ2GqITmRGg46um1E9qrfd+mdo03 WBsg== 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=TsABUyr6czjxkgVPVlQz/+LV8vXRq4YLo2VkQCGdbrI=; b=FL/mE7uIf38WDTqe3JiAUu7L57iMaRt+MudYBVvE4QPx+tLKjGxsiwMuU8Wm35weFq zcg0xvtbEGQxUvh4DAaKqRI0M5cseL4G1MvaCe4qZGVkU9nFlUOKuAERLoan+OKY9zzH MrACn2TTYYRpJQT5rGIHsdQVJo+VpDG+4qwErza0hQpJHSUL5GwJSZzEEkubAuSpIEJN fvUmSDf5TO85bvSuQ5K9Q+FIiUTNVPaTNdtE6exDDr/YOAgSo9H+4mLbagICGvD+H7Rw CyZV+hYeLQ+xyZ6A/ow+l/0maCvE4gmQMUSISf0u/8URm85MIFmREi2HYe7hHnke/Xzf hYAA== X-Gm-Message-State: APjAAAUjZ0cMnLTzqm31YbJyVMuqKjPGNBTIe4TnnZoTrAVcgR6cJpaH EDX8O7uWZEG2TPPjutp8ORfcjQ== X-Google-Smtp-Source: APXvYqwh3pugoDidWfjeiGQrMilab3hYM3dq0SIHQS9CnMI7n+pYFtoAg6OXHlsd8OjzJTtrkLadtg== X-Received: by 2002:a50:8dc7:: with SMTP id s7mr34856137edh.268.1560339233963; Wed, 12 Jun 2019 04:33:53 -0700 (PDT) Received: from tegmen.arch.suse.de (charybdis-ext.suse.de. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id i21sm2752934ejd.76.2019.06.12.04.33.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Jun 2019 04:33:53 -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, Denis Kirjanov Subject: [PATCH 1/2] ipoib: correcly show a VF hardware address Date: Wed, 12 Jun 2019 13:33:45 +0200 Message-Id: <20190612113348.59858-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. 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 + include/uapi/linux/if_link.h | 1 + net/core/rtnetlink.c | 1 + 3 files changed, 3 insertions(+) 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; } diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 5b225ff63b48..904ee1a7330b 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -702,6 +702,7 @@ enum { struct ifla_vf_mac { __u32 vf; __u8 mac[32]; /* MAX_ADDR_LEN */ + __u8 addr_len; }; struct ifla_vf_vlan { diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index cec60583931f..2e1b9ffbe602 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1230,6 +1230,7 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, vf_rss_query_en.vf = vf_trust.vf = ivi.vf; + vf_mac.addr_len = dev->addr_len; memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac)); vf_vlan.vlan = ivi.vlan; vf_vlan.qos = ivi.qos; From patchwork Wed Jun 12 11:33:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 10989503 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 D055B14E5 for ; Wed, 12 Jun 2019 11:34:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF2CC28A2A for ; Wed, 12 Jun 2019 11:34:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3C2D28A33; Wed, 12 Jun 2019 11:34:03 +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 5D1E228A2A for ; Wed, 12 Jun 2019 11:34:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408240AbfFLLeC (ORCPT ); Wed, 12 Jun 2019 07:34:02 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:45045 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408287AbfFLLd6 (ORCPT ); Wed, 12 Jun 2019 07:33:58 -0400 Received: by mail-ed1-f66.google.com with SMTP id k8so25183458edr.11 for ; Wed, 12 Jun 2019 04:33:57 -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=ZK1rfebeAZy2VZhbXgK9JVhhf/g7goNVoEB7hDLP6Mg=; b=gjqGr1oUqHSoVIfYm5ktzYwqWbRdlBa4lSY87EGwZIf4P9E52Qss5XP8L3X8gTbnaJ 4YQa3APlW+YAtEmQHG566Oz4O2ZhnbKsMhVZc1EcV+es38lU70zgbFCNPfm4sBfpDAoQ yFhtWkB3gtGkhk0S9+JHs9sHcA2Wwh0z90If1biT/tEltS4peaZY3fXtITnd8Y7/o8hN 6VcIE6enxNcteq6+ER+z5pqHqnil9uWCfqCD4RQhwWWoFSdPHEk3dGoYXwkJ7laSjGlN tXSZhH42m+NqYRXmB+wTWPNE2o/4zgvJj10dNN7wvM2Oo5JKJO1f8xgVVqo6NmuzZ4q7 FSCw== 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=ZK1rfebeAZy2VZhbXgK9JVhhf/g7goNVoEB7hDLP6Mg=; b=rD8GISv0t7BGCTa2/vvgllcQ9XgRUKKGMrG5hXDuGrSS9uy3stxj95fJ/aU3Dd+K/j ZjTuvqLUtShmu2obI8GR/Uq2GEIK/EZDvP6MfbCAfBaNBIKk8wHPyrec0CXebJ4i1Zos pyk3+MI+NxG99yqGsoydSjgiz6I7RhU+ObyfO5CWmfV1LeLbLyVYZ7lC+TwYiTrdg1Yz mWX+wak7Z4rdB7+mt3lAF1sB/ebFbiac0Vf/gswYsrmsjnVgc+Ha4HRQcm0p1rd0KtSy GJO5MxORC8RRnje8JHbqOwsQFlrsQ4KHrCiO0IJxfx/1PXKouBDddN0advyyweH+Bnvr it8g== X-Gm-Message-State: APjAAAU5A0W3MG6SyJBZG83CWnDegv4O+HqQWXDntTl4hY8+7fNMfT9F bfN/bgGKswGrU8VAxvbADzaEpg== X-Google-Smtp-Source: APXvYqxxAXM2MiwL49vBBLeDWD8POyGb924iwQ9IdmSEKUkNva+/5X+GZyGqZY6BbiUzBYrgWvjA+A== X-Received: by 2002:a50:9282:: with SMTP id k2mr39869843eda.269.1560339236705; Wed, 12 Jun 2019 04:33:56 -0700 (PDT) Received: from tegmen.arch.suse.de (charybdis-ext.suse.de. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id i21sm2752934ejd.76.2019.06.12.04.33.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Jun 2019 04:33: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 Subject: [PATCH net-next 2/2] ipoib: show VF broadcast address Date: Wed, 12 Jun 2019 13:33:48 +0200 Message-Id: <20190612113348.59858-4-dkirjanov@suse.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190612113348.59858-1-dkirjanov@suse.com> References: <20190612113348.59858-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 --- net/core/rtnetlink.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 2e1b9ffbe602..f70902b57a40 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1248,6 +1248,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_BROADCAST, dev->addr_len, dev->broadcast) || nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) || nla_put(skb, IFLA_VF_RATE, sizeof(vf_rate), &vf_rate) ||