All the mail mirrored from lore.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

* Re: [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig
       [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-18 14:24   ` Leon Romanovsky
  1 sibling, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2017-10-16  4:50 UTC (permalink / raw
  To: Nathan Hartwell; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 450 bytes --]

On Wed, Oct 11, 2017 at 01:00:24PM -0600, Nathan Hartwell wrote:
> 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.

Can you please specify the version of ifconfig and OS?

Thanks

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig
       [not found]     ` <20171016045054.GZ2106-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-10-16 15:31       ` Nathan Hartwell
  0 siblings, 0 replies; 11+ messages in thread
From: Nathan Hartwell @ 2017-10-16 15:31 UTC (permalink / raw
  To: Leon Romanovsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Sun, Oct 15, 2017 at 10:50 PM, Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Wed, Oct 11, 2017 at 01:00:24PM -0600, Nathan Hartwell wrote:
>> 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.
>
> Can you please specify the version of ifconfig and OS?
>
> Thanks


OS: CentOS 7 / 4.14.0-rc3 kernel
ifconfig: net-tools 2.10-alpha
--
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	[flat|nested] 11+ messages in thread

* Re: [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig
       [not found] ` <CALvXFTdij1WaFL2A05MJBcngn5eJ=ahxwRU64bS_VsCjvnE1XQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2017-10-16  4:50   ` Leon Romanovsky
@ 2017-10-18 14:24   ` Leon Romanovsky
       [not found]     ` <20171018142454.GR2106-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  1 sibling, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2017-10-18 14:24 UTC (permalink / raw
  To: Moni Shoua; +Cc: Nathan Hartwell, linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 2235 bytes --]

Moni ?????

Thanks

On Wed, Oct 11, 2017 at 01:00:24PM -0600, Nathan Hartwell wrote:
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: Moni Shoua @ 2017-10-18 14:45 UTC (permalink / raw
  To: Leon Romanovsky; +Cc: Nathan Hartwell, linux-rdma

On Wed, Oct 18, 2017 at 5:24 PM, Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> Moni ?????
>
> Thanks
>
> On Wed, Oct 11, 2017 at 01:00:24PM -0600, Nathan Hartwell wrote:
>> 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.
did you consider replacing ifconfig with ip? I can't say for sure but
the recommendation AFAIK is to replace is to replace ifconfig with ip
in scripts that parse the output
Another alternative is to use /sys file system (e.g. /sys/class/net/p2p1/speed)
--
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	[flat|nested] 11+ messages in thread

* Re: [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: Bart Van Assche @ 2017-10-18 15:03 UTC (permalink / raw
  To: Moni Shoua, Leon Romanovsky; +Cc: Nathan Hartwell, linux-rdma

On 10/18/17 07:45, Moni Shoua wrote:
> On Wed, Oct 18, 2017 at 5:24 PM, Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>> Moni ?????
>>
>> Thanks
>>
>> On Wed, Oct 11, 2017 at 01:00:24PM -0600, Nathan Hartwell wrote:
>>> 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.
> did you consider replacing ifconfig with ip? I can't say for sure but
> the recommendation AFAIK is to replace is to replace ifconfig with ip
> in scripts that parse the output
> Another alternative is to use /sys file system (e.g. /sys/class/net/p2p1/speed)

Personally I'm in favor of the latter solution (sysfs). For sysfs 
attributes backwards compatibility is guaranteed but not for the output 
of the ifconfig or ip tools.

Bart.
--
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	[flat|nested] 11+ messages in thread

* Re: [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: Moni Shoua @ 2017-10-18 15:15 UTC (permalink / raw
  To: Bart Van Assche; +Cc: Leon Romanovsky, Nathan Hartwell, linux-rdma

> Personally I'm in favor of the latter solution (sysfs). For sysfs attributes
> backwards compatibility is guaranteed but not for the output of the ifconfig
> or ip tools.
>
> Bart.

I agree
--
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	[flat|nested] 11+ messages in thread

* Re: [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: Nathan Hartwell @ 2017-10-18 16:12 UTC (permalink / raw
  To: Moni Shoua; +Cc: Bart Van Assche, Leon Romanovsky, linux-rdma

On Wed, Oct 18, 2017 at 9:15 AM, Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
>> Personally I'm in favor of the latter solution (sysfs). For sysfs attributes
>> backwards compatibility is guaranteed but not for the output of the ifconfig
>> or ip tools.
>>
>> Bart.
>
> I agree

While I agree in principle with the idea to move to sysfs, if that
work would be applied then I would go so far as to say that a complete
rewrite of the scrip should be looked into. For example, there are a
number of other areas (e.g. the calls to modprobe) that can produce
unhelpful (but harmless) warnings to the console. We are focusing on
other fixes that have been found and need to be applied to rxe at the
moment so I am not sure when / if we will cycle around to revisit
updates to the script.
--
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	[flat|nested] 11+ messages in thread

* Re: [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig
       [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
  1 sibling, 0 replies; 11+ messages in thread
From: Moni Shoua @ 2017-10-19  7:37 UTC (permalink / raw
  To: Nathan Hartwell; +Cc: Bart Van Assche, Leon Romanovsky, linux-rdma

>
> While I agree in principle with the idea to move to sysfs, if that
> work would be applied then I would go so far as to say that a complete
> rewrite of the scrip should be looked into. For example, there are a
> number of other areas (e.g. the calls to modprobe) that can produce
> unhelpful (but harmless) warnings to the console. We are focusing on
> other fixes that have been found and need to be applied to rxe at the
> moment so I am not sure when / if we will cycle around to revisit
> updates to the script.

You don't have to rewrite the whole script now but only the sections
that you intend to fix anyway.
It shouldn't take long to replace the use of ifconfig/ethtool with
/sysfs for getting MTU and SPEDD
--
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	[flat|nested] 11+ messages in thread

* Re: [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig
       [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>
  1 sibling, 1 reply; 11+ messages in thread
From: Jason Gunthorpe @ 2017-10-23 15:40 UTC (permalink / raw
  To: Nathan Hartwell; +Cc: Moni Shoua, Bart Van Assche, Leon Romanovsky, linux-rdma

On Wed, Oct 18, 2017 at 10:12:02AM -0600, Nathan Hartwell wrote:

> work would be applied then I would go so far as to say that a complete
> rewrite of the scrip should be looked into.

Yes. This script is horrid and needs to go away.

rxe links (and soft iwarp!) should be created via netlink using Leon's
new rdma tool. We need a bunch of steps to get there, but that needs
to be the end goal.

Jason
--
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	[flat|nested] 11+ messages in thread

* Re: [PATCH] rxe_cfg: Fix parsing of ethtool / ifconfig
       [not found]                         ` <20171023154043.GD11952-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-10-24 15:26                           ` Moni Shoua
  0 siblings, 0 replies; 11+ messages in thread
From: Moni Shoua @ 2017-10-24 15:26 UTC (permalink / raw
  To: Jason Gunthorpe
  Cc: Nathan Hartwell, Bart Van Assche, Leon Romanovsky, linux-rdma

> rxe links (and soft iwarp!) should be created via netlink using Leon's
> new rdma tool. We need a bunch of steps to get there, but that needs
> to be the end goal.
>
Agreed. I'll take it with Leon.
--
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	[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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.