From patchwork Fri Jun 28 09:54:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 11021879 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 4FAB6112C for ; Fri, 28 Jun 2019 09:54:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E0E028782 for ; Fri, 28 Jun 2019 09:54:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3124A28806; Fri, 28 Jun 2019 09:54:38 +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 B448928782 for ; Fri, 28 Jun 2019 09:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726508AbfF1Jyf (ORCPT ); Fri, 28 Jun 2019 05:54:35 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:33999 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726524AbfF1Jyf (ORCPT ); Fri, 28 Jun 2019 05:54:35 -0400 Received: by mail-ed1-f65.google.com with SMTP id s49so10211680edb.1 for ; Fri, 28 Jun 2019 02:54:34 -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=zijQ0vKQpmmSMmIBGOngMYzVjH1lavH3ZmuxMYJW1/c=; b=mQPTFiYjDFtKzEr5716YLZ0/EE6nic8xb5a/zvCQ12XlOYE5pGGTQ7nvQO1sh1WOHY /CCGFuwcusRiflLm2he0DAN+/2mPZJJR09RF8TtORWtnTlVPPwnsfP68d8945FQqIaDA vqOju+uG/LVCzTOXQFFtoJJmJ3wZ+Yau0YX+EZWJ/kQhoBrYx04WZVmMEl4o4aCMEEnt 5x1rupEj4050iSx6DOLunrpf77iTcXZ5RF5HFqP2DeW3auj4kJnprX0TMNZYFRd8sW4d ayAVJqr02GORZJSu6bIsQxOYTSr+W0qGcF8gx1yUjvugh1NAGjRnpC1tF6c2iaa4MRrC 0aGg== 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=zijQ0vKQpmmSMmIBGOngMYzVjH1lavH3ZmuxMYJW1/c=; b=mmSdYx+AV0vOuOPUCEZG1ad70w+vtnI4yiTE9fmZ8QMMKZz0H9wVuo0sajgywVOeF9 +niApMyk+y3lV6nKvuy3uH6WNVsIQhy5cZzphd+TXtDgxjRgEaRidbn0AHb9q29F5KT9 BIU/+BCOdz6eMyOLo9UkMFvGq9rnfv4dVBTOZE1KWADFWoOI8pSaIBeR21GAKOnR4EsG qyW93EKpZnfmP7lNy0XfwjvnCeyDIwE+SP9xitwDEaMUZCbytIbqHGY+Zw8GPnYHW7lY sVXcf6w7xrxrx6Nko6N6YsfPRDEt3tWZ8ZkVAif14/QtjOJU2dNM5ZPgf6DRwAhMF0PF k8HQ== X-Gm-Message-State: APjAAAV5+gdfsypmq40YG3gEt2YJH2Ew8lJYZgwO8cLz04plPsa0NrCA 8iXgxjFUiissLaVynkmbcG01jg== X-Google-Smtp-Source: APXvYqz+g13oSCgKrIbcw3oziJsTT303AgVBuLRsORpmG//aPzwD5Vl3CfnKYjr6OL6Fx5UQGU10jA== X-Received: by 2002:a17:906:9410:: with SMTP id q16mr7758263ejx.90.1561715673351; Fri, 28 Jun 2019 02:54:33 -0700 (PDT) Received: from tegmen.arch.suse.de (nat.nue.novell.com. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id e12sm536721edb.72.2019.06.28.02.54.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2019 02:54:32 -0700 (PDT) From: Denis Kirjanov X-Google-Original-From: Denis Kirjanov To: stephen@networkplumber.org, dsahern@gmail.com Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, dledford@redhat.com, mkubecek@suse.cz, Denis Kirjanov Subject: [PATCH iproute2-next v4 1/2] ipaddress: correctly print a VF hw address in the IPoIB case Date: Fri, 28 Jun 2019 11:54:25 +0200 Message-Id: <20190628095426.2819-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 ethernet mac and that doesn't work in the 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 v2->v3: fixed alignment v3->v4: aligned print statements as used through the source Signed-off-by: Denis Kirjanov --- ip/ipaddress.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index b504200b..741b8667 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,41 @@ 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 +1132,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 Fri Jun 28 09:54:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 11021881 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 6CA1C13B4 for ; Fri, 28 Jun 2019 09:54:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BF5F28763 for ; Fri, 28 Jun 2019 09:54:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 506A228803; Fri, 28 Jun 2019 09:54:39 +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 F04F328800 for ; Fri, 28 Jun 2019 09:54:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726484AbfF1Jyh (ORCPT ); Fri, 28 Jun 2019 05:54:37 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:45270 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726561AbfF1Jyf (ORCPT ); Fri, 28 Jun 2019 05:54:35 -0400 Received: by mail-ed1-f65.google.com with SMTP id a14so10129868edv.12 for ; Fri, 28 Jun 2019 02:54:34 -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=pcJbfKjM2ad/y+5/UddgYg5Cz58j5AZ0qF4vYduQT5G6UbZUJQpTEoZGGg1usZKLP9 KYS+X07KCpm94g3IW66CGdJociXACubVTm7SNwzltVsVoOB8DfXrZtFc1yjjXL/Zjzll L7Z90vOpaCfSK7UggqwkBnKcfHQvnt9Ow9kmpwXhb8c/HnAgmC4IUNJdrDy6b91k8vh1 f+v7UaDLu9ZNVl2MabYbx27TiH18GvTG9PjGQyRZRjotblzuWlLmbokwCqb4pmIseqPu qqtFkxSoNdrQhgmF+3s/HIFzPqCcmktNIqWoNQXpWN59juFzfGXnZjDT3l6pC7ekVMYy ITZA== 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=KUOTVqaAV8YLRjJ8OdXcWKO3JrmggKkeXl9h4VFpP6UbGpiqpnBPxJ2CtlCI3NljJJ FPrXMeZp0Ow6MCtH3R93CaazHn1elTYRP8JAzjgbrp2VHHUNjpyjoD/eQGJoM3+K1pXw kxliapoVdohH0vPU8JjbPw8xTI8BOKQEMyL5anyv9lSoobDBh4pKeQikSnTWXiPwaXN/ KoytBTYr+mnViUJoZyyVSHE9gxY+VWk1TiVtAUjUKXOeWykT3BwH6mIlCdm9MFfYr99q Ca/E6zwylCDj5y9HUZWatFBl22GYEIp/9SCWZD3vQi9Lwdd2s2/4ne7H/DJrHYVsUGDh SQVA== X-Gm-Message-State: APjAAAUmI9QExgxwrJbrFVPI5iIJp55wBVyXZNRLIOfG9NBoChHRpoMM TY+5QMGFukfLpmisZdCF57cPkw== X-Google-Smtp-Source: APXvYqz0piUDWyHsW3RnYXb/wRndogljwovgfmSHoyN0JEmE5i8Kz+TBlL9R3yKWDt/16Qv/u9SAGQ== X-Received: by 2002:a50:f98a:: with SMTP id q10mr10106210edn.267.1561715674240; Fri, 28 Jun 2019 02:54:34 -0700 (PDT) Received: from tegmen.arch.suse.de (nat.nue.novell.com. [195.135.221.2]) by smtp.gmail.com with ESMTPSA id e12sm536721edb.72.2019.06.28.02.54.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2019 02:54:33 -0700 (PDT) From: Denis Kirjanov X-Google-Original-From: Denis Kirjanov To: stephen@networkplumber.org, dsahern@gmail.com Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, dledford@redhat.com, mkubecek@suse.cz, Denis Kirjanov Subject: [PATCH iproute2-next v4 2/2] uapi: update if_link.h Date: Fri, 28 Jun 2019 11:54:26 +0200 Message-Id: <20190628095426.2819-2-dkirjanov@suse.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190628095426.2819-1-dkirjanov@suse.com> References: <20190628095426.2819-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 */