From patchwork Wed Jun 12 11:33: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: 10989501 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 466E11398 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 3308928A30 for ; Wed, 12 Jun 2019 11:34:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23BD328A2A; 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 BAE7428A2A for ; Wed, 12 Jun 2019 11:34:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406951AbfFLLd6 (ORCPT ); Wed, 12 Jun 2019 07:33:58 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:45315 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407591AbfFLLd5 (ORCPT ); Wed, 12 Jun 2019 07:33:57 -0400 Received: by mail-ed1-f66.google.com with SMTP id a14so23332441edv.12 for ; Wed, 12 Jun 2019 04:33:56 -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=TsABUyr6czjxkgVPVlQz/+LV8vXRq4YLo2VkQCGdbrI=; b=aRcMzt/DiOaPSx7zsRGguao3JcN6luewaLiYoXTY/Tid7U/gioJSfzG7aqvCIglu+S MhSm1avGDRO0qVyfwdNXAzxJFbJuN44Ha/NDEnxe6Uqy/469wHTViOcMPGzSkwWDCZVH M4gVn+PdROOGHU6/WhhN2UketiJkSwvApE2jAU8xvr0xtzr5Oa7KRmOACHyJVIHsvONA FETc6mrPGQNW8bxaeGVU8WQdGX7ZSnZjhmGkKQSVK97FZDZxPrNu/mHh1yR4sDo6k7Zc mW1R+ictO0vWOl5vyT9rTsG7g9ShYy8sBz9CoI7+vwCg3kc+CxsPq/jgdp/WjMResQee omAQ== 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=TsABUyr6czjxkgVPVlQz/+LV8vXRq4YLo2VkQCGdbrI=; b=pZgwrA4l55GGSfGInlJryiTVcYLpMzTKLrKbIsOT+Vgrp0ltwpjNjgd2TCdPDc5ro3 6XEkqKmdpmEjG0VLCF7FTl9KYCI6NXHB6CeJHDxGNWyWkMymxX36R6LCPa1x+2tm26AP aJXZhEJCofcRHeKAIgOX5d5e/lbQQlWKGxak98h0zVufaYV7KXWWRsSxnMEqWmZDJ2zK IZW62awdgAzxQn6fyz5YsOpLnd0SoLO51oKOmPyigYuri9saYaCqMZE/6ewpiiYWnoI8 qWtbqIXNfK8JSpULbuhrp/ZtmHaVg/NZ0DweH6aria4utZ4trZ0Go/SoaZZCcLT+9EGi 9+Hg== X-Gm-Message-State: APjAAAVeeQvhWP+JJ3uaXmScYm2A33eZIaZZrfbDsGGrHlbxUfFmXnt5 llcnJ8FBRw2E0h9C4MDGJ4qoxQ== X-Google-Smtp-Source: APXvYqyUXzAFkZpGpzj35SrPGn+8SbHQ03MMgRfmsKa25zTAeRMgrlFeacBw13d3yMBeAAVpr26CRQ== X-Received: by 2002:a17:906:4948:: with SMTP id f8mr22533651ejt.79.1560339235927; Wed, 12 Jun 2019 04:33:55 -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:55 -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 net-next 1/2] ipoib: correcly show a VF hardware address Date: Wed, 12 Jun 2019 13:33:47 +0200 Message-Id: <20190612113348.59858-3-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 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;