public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig
@ 2017-10-11 19:00 Nathan Hartwell
       [not found] ` <CALvXFTdij1WaFL2A05MJBcngn5eJ=ahxwRU64bS_VsCjvnE1XQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Nathan Hartwell @ 2017-10-11 19:00 UTC (permalink / raw)
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

rxe_cfg does not always parse the output of ethtool and ifconfig correctly.

Fix two items:
1)  Parsing of ethtool's link speed field to always output a link speed.
2)  Parsing of ifconfig's IP address / MTU fields with newer builds of
ifconfig that have a slightly different output format than in the
past.

Signed-off-by: Nathan Hartwell <nathan.hartwell-YP+SxaqqoVo2oU8LL9ROB9BPR1lH4CV8@public.gmane.org>

--------------------------------------------------------------------------------

diff --git a/providers/rxe/rxe_cfg.in b/providers/rxe/rxe_cfg.in
index 0a8583d..8429b28 100755
--- a/providers/rxe/rxe_cfg.in
+++ b/providers/rxe/rxe_cfg.in
@@ -180,9 +180,9 @@ sub get_dev_info {
                    if ($fields[0] =~ "Link detected") {
                        $link_state{$eth} = $fields[1];
                    }
-           }
-           elsif ($line =~ "10000baseT") {
-               $link_speed{$eth} = "10GigE";
+                   elsif ($fields[0] =~ "Speed") {
+                       $link_speed{$eth} = $fields[1];
+                   }
            }
        }

@@ -197,6 +197,11 @@ sub get_dev_info {
                @fields = split(/\s+/, $line);
                $ipv4_addr{$eth} = $fields[0];
            }
+           elsif ($line =~ /inet /) {
+           $line =~ s/^\s+inet //g;
+               @fields = split(/\s+/, $line);
+               $ipv4_addr{$eth} = $fields[0];
+           }

            # get ethernet mtu
            if ($line =~ /MTU:/) {
@@ -204,6 +209,11 @@ sub get_dev_info {
                @fields = split(/\s+/, $line);
                $eth_mtu{$eth} = $fields[0];
            }
+           elsif ($line =~ /mtu /) {
+               $line =~ s/^.*mtu //g;
+               @fields = split(/\s+/, $line);
+               $eth_mtu{$eth} = $fields[0];
+           }
        }
     }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-10-24 15:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-11 19:00 [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig Nathan Hartwell
     [not found] ` <CALvXFTdij1WaFL2A05MJBcngn5eJ=ahxwRU64bS_VsCjvnE1XQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-16  4:50   ` Leon Romanovsky
     [not found]     ` <20171016045054.GZ2106-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-16 15:31       ` Nathan Hartwell
2017-10-18 14:24   ` Leon Romanovsky
     [not found]     ` <20171018142454.GR2106-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-18 14:45       ` Moni Shoua
     [not found]         ` <CAG9sBKMa2nYkjWy37DxbcmMriPtwKFHb2gxn6MYT=YJwa=3E2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-18 15:03           ` Bart Van Assche
     [not found]             ` <96dc09fb-14a8-a9ea-58ba-fedba2dc5194-Sjgp3cTcYWE@public.gmane.org>
2017-10-18 15:15               ` Moni Shoua
     [not found]                 ` <CAG9sBKNhKNBDhZ=ywQ8xSTDHpmCzeshkRHEiEeQhkpdE_1CuNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-18 16:12                   ` Nathan Hartwell
     [not found]                     ` <CALvXFTfBZYTMzJnbrG2feHkZa6m3OZcZEDqQVN_hSTx+1f_i5A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-19  7:37                       ` Moni Shoua
2017-10-23 15:40                       ` Jason Gunthorpe
     [not found]                         ` <20171023154043.GD11952-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-10-24 15:26                           ` Moni Shoua

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox