From patchwork Wed Aug 1 13:36:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Morey-Chaisemartin X-Patchwork-Id: 10552309 X-Patchwork-Delegate: leon@leon.nu 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 4C62113BF for ; Wed, 1 Aug 2018 13:36:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CDA32B4BF for ; Wed, 1 Aug 2018 13:36:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30BB32B513; Wed, 1 Aug 2018 13:36:57 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,T_TVD_MIME_EPI 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 05FE62B528 for ; Wed, 1 Aug 2018 13:36:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389278AbeHAPWo (ORCPT ); Wed, 1 Aug 2018 11:22:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:46146 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389108AbeHAPWo (ORCPT ); Wed, 1 Aug 2018 11:22:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 71618ACB0 for ; Wed, 1 Aug 2018 13:36:53 +0000 (UTC) From: Nicolas Morey-Chaisemartin Subject: [PATCH rdma-core 1/3] rxe: support iproute2 in rxe_cfg To: linux-rdma@vger.kernel.org References: <2fb5bb71-8b9c-3164-a89d-526c73a06fbb@suse.de> Openpgp: preference=signencrypt Message-ID: Date: Wed, 1 Aug 2018 15:36:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <2fb5bb71-8b9c-3164-a89d-526c73a06fbb@suse.de> 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 ifconfig is now deprecated in most distro in favour on iproute2. Use the ip command when ifconfig is missing. Signed-off-by: Nicolas Morey-Chaisemartin --- providers/rxe/rxe_cfg.in | 64 +++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/providers/rxe/rxe_cfg.in b/providers/rxe/rxe_cfg.in index 555a5cde983a..cf9e04ca6818 100755 --- a/providers/rxe/rxe_cfg.in +++ b/providers/rxe/rxe_cfg.in @@ -130,6 +130,7 @@ sub get_dev_info { my $np; my $i = 0; my $j = 0; + my $ifconfig; get_mlx4_list(); @@ -191,22 +192,43 @@ sub get_dev_info { $ipv4_addr{$eth} = " "; $eth_mtu{$eth} = ""; - @lines = `ifconfig $eth`; - foreach $line (@lines) { - # get IP address - if ($line =~ /inet addr/) { - $line =~ s/^\s+inet addr://g; - @fields = split(/\s+/, $line); - $ipv4_addr{$eth} = $fields[0]; - } - - # get ethernet mtu - if ($line =~ /MTU:/) { - $line =~ s/^.*MTU://g; - @fields = split(/\s+/, $line); - $eth_mtu{$eth} = $fields[0]; - } - } + $ifconfig=`which ifconfig 2> /dev/null`; + if ($ifconfig =~ /ifconfig/) { + @lines = `ifconfig $eth`; + foreach $line (@lines) { + # get IP address + if ($line =~ /inet addr/) { + $line =~ s/^\s+inet addr://g; + @fields = split(/\s+/, $line); + $ipv4_addr{$eth} = $fields[0]; + } + + # get ethernet mtu + if ($line =~ /MTU:/) { + $line =~ s/^.*MTU://g; + @fields = split(/\s+/, $line); + $eth_mtu{$eth} = $fields[0]; + } + } + } else { + @lines = `ip addr show $eth`; + foreach $line (@lines) { + # get IP address + if ($line =~ /inet /) { + $line =~ s/^\s+inet ([0-9.]+)\//$1 /g; + print($line); + @fields = split(/\s+/, $line); + $ipv4_addr{$eth} = $fields[0]; + } + + # get ethernet mtu + if ($line =~ /mtu /) { + $line =~ s/^.*mtu //g; + @fields = split(/\s+/, $line); + $eth_mtu{$eth} = $fields[0]; + } + } + } } # get rxe mtu @@ -527,8 +549,14 @@ sub do_start { foreach my $rxe (@rxe_array) { my $stat = get_devinfo($rxe); if ($stat =~ "PORT_DOWN") { - my $cmd = "ifconfig $eth_names{$rxe} up"; - system($cmd); + my $ifconfig=`which ifconfig 2> /dev/null`; + my $cmd; + if ($ifconfig =~ /ifconfig/) { + $cmd = "ifconfig $eth_names{$rxe} up"; + } else { + $cmd = "ip link set $eth_names{$rxe} up"; + } + system($cmd); } } From patchwork Wed Aug 1 13:36:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Morey-Chaisemartin X-Patchwork-Id: 10552311 X-Patchwork-Delegate: leon@leon.nu 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 0965E13BF for ; Wed, 1 Aug 2018 13:36:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE0CB2B4EA for ; Wed, 1 Aug 2018 13:36:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E22602B51E; Wed, 1 Aug 2018 13:36: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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,T_TVD_MIME_EPI 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 986742B512 for ; Wed, 1 Aug 2018 13:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389280AbeHAPWr (ORCPT ); Wed, 1 Aug 2018 11:22:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:46176 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389108AbeHAPWq (ORCPT ); Wed, 1 Aug 2018 11:22:46 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2CA10ACB0 for ; Wed, 1 Aug 2018 13:36:56 +0000 (UTC) From: Nicolas Morey-Chaisemartin Subject: [PATCH rdma-core 2/3] rxe: support newer ifconfig To: linux-rdma@vger.kernel.org References: <2fb5bb71-8b9c-3164-a89d-526c73a06fbb@suse.de> Openpgp: preference=signencrypt Message-ID: <17479029-7d54-accb-ee5b-a7baa07beeb3@suse.de> Date: Wed, 1 Aug 2018 15:36:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <2fb5bb71-8b9c-3164-a89d-526c73a06fbb@suse.de> 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 net-tools 2.0 has changed the ifconfig format: eth0: flags=4163 mtu 1500 inet 10.0.2.127 netmask 255.255.255.0 broadcast 10.0.2.255 Fix the regexp to support both older and newer versions of net-tools Signed-off-by: Nicolas Morey-Chaisemartin --- providers/rxe/rxe_cfg.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/providers/rxe/rxe_cfg.in b/providers/rxe/rxe_cfg.in index cf9e04ca6818..5d01f3a613c9 100755 --- a/providers/rxe/rxe_cfg.in +++ b/providers/rxe/rxe_cfg.in @@ -197,15 +197,15 @@ sub get_dev_info { @lines = `ifconfig $eth`; foreach $line (@lines) { # get IP address - if ($line =~ /inet addr/) { - $line =~ s/^\s+inet addr://g; + if ($line =~ /inet (addr)?/) { + $line =~ s/^\s+inet (addr)?:?//g; @fields = split(/\s+/, $line); $ipv4_addr{$eth} = $fields[0]; } # get ethernet mtu - if ($line =~ /MTU:/) { - $line =~ s/^.*MTU://g; + if ($line =~ /(MTU|mtu)[: ]/) { + $line =~ s/^.*(MTU|mtu)[: ]//g; @fields = split(/\s+/, $line); $eth_mtu{$eth} = $fields[0]; } From patchwork Wed Aug 1 13:36:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Morey-Chaisemartin X-Patchwork-Id: 10552313 X-Patchwork-Delegate: leon@leon.nu 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 6CD0813B8 for ; Wed, 1 Aug 2018 13:37:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C6C62B501 for ; Wed, 1 Aug 2018 13:37:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AF1C2B512; Wed, 1 Aug 2018 13:37:01 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,T_TVD_MIME_EPI 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 10D542B496 for ; Wed, 1 Aug 2018 13:37:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389286AbeHAPWt (ORCPT ); Wed, 1 Aug 2018 11:22:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:46196 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389108AbeHAPWt (ORCPT ); Wed, 1 Aug 2018 11:22:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B2238ACB0 for ; Wed, 1 Aug 2018 13:36:58 +0000 (UTC) From: Nicolas Morey-Chaisemartin Subject: [PATCH rdma-core 3/3] suse: Add recommends for rxe_cfg requirements To: linux-rdma@vger.kernel.org References: <2fb5bb71-8b9c-3164-a89d-526c73a06fbb@suse.de> Openpgp: preference=signencrypt Message-ID: Date: Wed, 1 Aug 2018 15:36:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <2fb5bb71-8b9c-3164-a89d-526c73a06fbb@suse.de> 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 rxe_cfg requires ethtool and iproute2 or net-tools. net-tools (more precisely ifconfig) being deprecated on all recent SUSE version, recommends iproute2 Signed-off-by: Nicolas Morey-Chaisemartin --- suse/rdma-core.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/suse/rdma-core.spec b/suse/rdma-core.spec index ea1608eeb39f..faf1c63ba4f7 100644 --- a/suse/rdma-core.spec +++ b/suse/rdma-core.spec @@ -166,6 +166,9 @@ Obsoletes: librxe-rdmav2 < %{version}-%{release} Requires: %{mlx4_lname} = %{version}-%{release} Requires: %{mlx5_lname} = %{version}-%{release} %endif +# Recommended packages for rxe_cfg +Recommends: ethtool +Recommends: iproute2 %description -n libibverbs libibverbs is a library that allows userspace processes to use RDMA