From patchwork Wed Jun 19 14:14:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 11004273 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 8D82876 for ; Wed, 19 Jun 2019 14:14:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B99C28ACF for ; Wed, 19 Jun 2019 14:14:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DBDC28ACD; Wed, 19 Jun 2019 14:14:32 +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 DC85928AEC for ; Wed, 19 Jun 2019 14:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727552AbfFSOOb (ORCPT ); Wed, 19 Jun 2019 10:14:31 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:36745 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725893AbfFSOOb (ORCPT ); Wed, 19 Jun 2019 10:14:31 -0400 Received: by mail-ed1-f65.google.com with SMTP id k21so27466877edq.3 for ; Wed, 19 Jun 2019 07:14:29 -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=/HYBIY590cdJS2RAEvrEQw5uxHga9dzdyPJdjb+NVxA=; b=uLNntrvtIfGirEO8AEO56wnzF/PzZl3RwGkdiKRQ4CxeRIqzICSRYtlcRe3fThx1oh 2s6Xs7lYlU8sUXHgf31IhPkL0TLN7uCIXOw1FrNhBQsThyYCf8nMJOOrT79jw+/S+ohA SaeYMgr6I2jn0rzK1uv2vqWHFwd8VJX0YpLkQ908yoLfeJwEiLSqC2CMqjrJaRKYr7lq 04Tf7On3pNILGlQdazLocV3ZYR6EDGtz+YDoa1Uq5yxQiyWr0+RRbnmnRtMFL4Ug6sjy s1M4/Q2us7xv/hZ9g+iav6SyYZsIj6g5a5t1BQSXEDdxmgeJUoBp3d0pvQ63Mxg9T3Vh UNCA== 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=/HYBIY590cdJS2RAEvrEQw5uxHga9dzdyPJdjb+NVxA=; b=eSu/1ZeahlQSOx6Mk0U3iXVhQ/NUlqemkuySQKuwBKRNWleGtJdcpK9jdaaNcG0eqF z71PhE1X/XODm/tdFmYFnmEP5kpV5F/N/fzkJPcVjvvozxf+oT3z20wey4OCElcNjRJi /RTMBhawxyG57FoexsRxEkVtjW6kiYLA6CjJEgbBZBVrMqr3yIbVZi/OYzY5vx3PlbT8 h2646dH5eYm/+qN1MkBSqAxzTsatDX+tDWQcJSeJxATtL4M+R0zhPo7iarhXuVnefP4b 5QHyfTQlX69zZbImUD7QWS8GB3Vx2O+Q5ACpvC3amdEA9xvtCsTLXxgctaCLUlYDvM7n 1KAQ== X-Gm-Message-State: APjAAAXQ3H7yCmh+zU/Pq9Ouj6PnrMJeJ89hOsUViny4sQlW0dYiBhDL kpKSc+1NoVK4Xy2vfnIwo9gvwQ== X-Google-Smtp-Source: APXvYqwY3G1QoJMH8Xvq5yGwhbIHOhEE0hqZprEzI2ce1zei9N5VFz3/eOz7/8RokfCjbt7qVsQoYQ== X-Received: by 2002:a17:906:4950:: with SMTP id f16mr22289578ejt.259.1560953668393; Wed, 19 Jun 2019 07:14:28 -0700 (PDT) Received: from tegmen.arch.suse.de (nat.nue.novell.com. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id y20sm49633ejj.75.2019.06.19.07.14.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 07:14:27 -0700 (PDT) From: Denis Kirjanov X-Google-Original-From: Denis Kirjanov To: stephen@networkplumber.org Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, dledford@redhat.com, mkubecek@suse.cz, Denis Kirjanov Subject: [PATCH iproute2 v2 1/2] ipaddress: correctly print a VF hw address in the IPoIB case Date: Wed, 19 Jun 2019 16:14:13 +0200 Message-Id: <20190619141414.4242-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 Current code assumes that we print Etheret mac and that doesn't work in IPoIB case with SRIOV-enabled hardware 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: updated kernel headers to uapi commit Signed-off-by: Denis Kirjanov --- ip/ipaddress.c | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index b504200b..13ad76dd 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -349,9 +350,10 @@ static void print_af_spec(FILE *fp, struct rtattr *af_spec_attr) static void print_vf_stats64(FILE *fp, struct rtattr *vfstats); -static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) +static void print_vfinfo(struct ifinfomsg *ifi, FILE *fp, struct rtattr *vfinfo) { struct ifla_vf_mac *vf_mac; + struct ifla_vf_broadcast *vf_broadcast; struct ifla_vf_tx_rate *vf_tx_rate; struct rtattr *vf[IFLA_VF_MAX + 1] = {}; @@ -365,13 +367,43 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) parse_rtattr_nested(vf, IFLA_VF_MAX, vfinfo); vf_mac = RTA_DATA(vf[IFLA_VF_MAC]); + vf_broadcast = RTA_DATA(vf[IFLA_VF_BROADCAST]); vf_tx_rate = RTA_DATA(vf[IFLA_VF_TX_RATE]); print_string(PRINT_FP, NULL, "%s ", _SL_); print_int(PRINT_ANY, "vf", "vf %d ", vf_mac->vf); - print_string(PRINT_ANY, "mac", "MAC %s", - ll_addr_n2a((unsigned char *) &vf_mac->mac, - ETH_ALEN, 0, b1, sizeof(b1))); + + print_string(PRINT_ANY, + "link_type", + " link/%s ", + ll_type_n2a(ifi->ifi_type, b1, sizeof(b1))); + + print_color_string(PRINT_ANY, + COLOR_MAC, + "address", + "%s", + ll_addr_n2a((unsigned char *) &vf_mac->mac, + ifi->ifi_type == ARPHRD_ETHER ? ETH_ALEN : INFINIBAND_ALEN, + ifi->ifi_type, + b1, sizeof(b1))); + + if (vf[IFLA_VF_BROADCAST]) { + if (ifi->ifi_flags&IFF_POINTOPOINT) { + print_string(PRINT_FP, NULL, " peer ", NULL); + print_bool(PRINT_JSON, + "link_pointtopoint", NULL, true); + } else { + print_string(PRINT_FP, NULL, " brd ", NULL); + } + print_color_string(PRINT_ANY, + COLOR_MAC, + "broadcast", + "%s", + ll_addr_n2a((unsigned char *) &vf_broadcast->broadcast, + ifi->ifi_type == ARPHRD_ETHER ? ETH_ALEN : INFINIBAND_ALEN, + ifi->ifi_type, + b1, sizeof(b1))); + } if (vf[IFLA_VF_VLAN_LIST]) { struct rtattr *i, *vfvlanlist = vf[IFLA_VF_VLAN_LIST]; @@ -1102,7 +1134,7 @@ int print_linkinfo(struct nlmsghdr *n, void *arg) open_json_array(PRINT_JSON, "vfinfo_list"); for (i = RTA_DATA(vflist); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) { open_json_object(NULL); - print_vfinfo(fp, i); + print_vfinfo(ifi, fp, i); close_json_object(); } close_json_array(PRINT_JSON, NULL); From patchwork Wed Jun 19 14:14:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 11004275 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 5C2A576 for ; Wed, 19 Jun 2019 14:14:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BD1B28AC8 for ; Wed, 19 Jun 2019 14:14:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34C6D28ABB; Wed, 19 Jun 2019 14:14:37 +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 D47C828755 for ; Wed, 19 Jun 2019 14:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727315AbfFSOOf (ORCPT ); Wed, 19 Jun 2019 10:14:35 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:41529 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbfFSOOb (ORCPT ); Wed, 19 Jun 2019 10:14:31 -0400 Received: by mail-ed1-f65.google.com with SMTP id p15so27428054eds.8 for ; Wed, 19 Jun 2019 07:14:30 -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=HNmoLH7L65zh+oviWZRmLVKzaZLwx+ZIkWckjpUyKBQ=; b=JkqwUOJ2KhL6ElU8NiXPocHkkrgkpMm0P3iOITbTr9OPqePsNMvTdfzNMVyt4dKgHm /MozwMQvURD6aIie2Ra2jbp/tLM/IWS0bHrca/ryCSusAy76VML3qCeZ3B70GBk9ZW01 mguWiA7tX8NY9sxjSDj6BhyfXb5CtGTOXD2yZ9ALW/5ETHT1bXGBZEwa/6+c5HNnG8ca W32Hzyk+lAFUUwr0vNSMehti348ZU5m7qprnPv6i5x7QO91f+U2Fh7Q9sOZDlMlFrM9U ON+EAdMBl3tLZrIIKlaSAPae6DeBBiAeGCfpgr+uULPRTaoZufoKMOkN3AURnBBixyzi yKhg== 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=HNmoLH7L65zh+oviWZRmLVKzaZLwx+ZIkWckjpUyKBQ=; b=X1XKCcXp9Qby+/llXcGMlEWf/YEDg99UMRNBIS6PVWhRae/hmz98jKSEjMwXF1meX5 fkc7owLtJJVR3c+YJDP1aWWlWabIrQrEEZ0XgDO3GBtab218rpXmPPMJemBvno2VI9Un 3MeyeAV3EcdlEVYueQfd2nwvq2GuoBVaMngdSdMIn2eqCow7U2qZzXsAeDht1Wv8sIER NiWLL+MUXP1bPaTzIsnqrmlClMsvhN4aTHqrink2cOx7KMJE6B+FZ3FIg7L287bpNq0k 6a6JUzE5krWZVWbLh76GbJVI4YdUUmc8gudh+SuAoJvwc2OWOHhv/vrimCfS1sBvkOQ3 JXcg== X-Gm-Message-State: APjAAAVgQHwEcDYiE8nFaN+4aOhIA2/S5AIiWXExWKb9v885oWEXXx+v DRRDBVYGi/AUgmM9NIBmjJS+PA== X-Google-Smtp-Source: APXvYqylvVlKjCkXf9SKQvYzpD2/hOMsXkUHInSzmwPZYXNUiBHg28qFA/d0E21MKPC9Y77fRLoHuA== X-Received: by 2002:a17:906:5007:: with SMTP id s7mr65779550ejj.81.1560953669421; Wed, 19 Jun 2019 07:14:29 -0700 (PDT) Received: from tegmen.arch.suse.de (nat.nue.novell.com. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id y20sm49633ejj.75.2019.06.19.07.14.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 07:14:28 -0700 (PDT) From: Denis Kirjanov X-Google-Original-From: Denis Kirjanov To: stephen@networkplumber.org Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, dledford@redhat.com, mkubecek@suse.cz, Denis Kirjanov Subject: [PATCH iproute2 v2 2/2] uapi: update if_link.h Date: Wed, 19 Jun 2019 16:14:14 +0200 Message-Id: <20190619141414.4242-2-dkirjanov@suse.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190619141414.4242-1-dkirjanov@suse.com> References: <20190619141414.4242-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 update if_link.h to commit 75345f888f700c4ab2448287e35d48c760b202e6 ("ipoib: show VF broadcast address") Signed-off-by: Denis Kirjanov --- include/uapi/linux/if_link.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index bfe7f9e6..5f271d84 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -692,6 +692,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, }; @@ -702,6 +703,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 */