diff mbox series

[OpenWrt-Devel,v2,2/2,netifd] system-linux: add autoneg and link-partner output

Message ID 20180627211433.26619-2-jwh@corp.connectbit.io
State Accepted
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel,v2,1/2,netifd] system-linux: add 2.5 and 10G interface speed definitions | expand

Commit Message

Joe Holden June 27, 2018, 9:14 p.m. UTC
From: Joe Holden <jwh@zorins.co.uk>

This adds an array that contains the link modes advertised by the other device and also
indicates whether auto negotiation is true or false.

link-partner may or may not be populated depending on hardware, driver and/or settings.

Signed-off-by: Joe Holden <jwh@zorins.co.uk>
---
 system-linux.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Hans Dedecker June 28, 2018, 11:45 a.m. UTC | #1
On Wed, Jun 27, 2018 at 11:15 PM <jwh@corp.connectbit.io> wrote:
>
> From: Joe Holden <jwh@zorins.co.uk>
>
> This adds an array that contains the link modes advertised by the other device and also
> indicates whether auto negotiation is true or false.
>
> link-partner may or may not be populated depending on hardware, driver and/or settings.
>
> Signed-off-by: Joe Holden <jwh@zorins.co.uk>
Patch applied with a minor tweak

Thx
Hans
> ---
>  system-linux.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/system-linux.c b/system-linux.c
> index 1330ea1..362e06d 100644
> --- a/system-linux.c
> +++ b/system-linux.c
> @@ -1730,6 +1730,10 @@ system_if_dump_info(struct device *dev, struct blob_buf *b)
>                 system_add_link_modes(b, ecmd.advertising);
>                 blobmsg_close_array(b, c);
>
> +               c = blobmsg_open_array(b, "link-partner");
> +               system_add_link_modes(b, ecmd.lp_advertising);
> +               blobmsg_close_array(b, c);
> +
>                 c = blobmsg_open_array(b, "link-supported");
>                 system_add_link_modes(b, ecmd.supported);
>                 blobmsg_close_array(b, c);
> @@ -1738,6 +1742,8 @@ system_if_dump_info(struct device *dev, struct blob_buf *b)
>                 snprintf(s, 8, "%d%c", ethtool_cmd_speed(&ecmd),
>                         ecmd.duplex == DUPLEX_HALF ? 'H' : 'F');
>                 blobmsg_add_string_buffer(b);
> +
> +               blobmsg_add_u8(b, "autoneg", !!ecmd.autoneg);
>         }
>
>         return 0;
> --
> 2.18.0
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/system-linux.c b/system-linux.c
index 1330ea1..362e06d 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -1730,6 +1730,10 @@  system_if_dump_info(struct device *dev, struct blob_buf *b)
 		system_add_link_modes(b, ecmd.advertising);
 		blobmsg_close_array(b, c);
 
+		c = blobmsg_open_array(b, "link-partner");
+		system_add_link_modes(b, ecmd.lp_advertising);
+		blobmsg_close_array(b, c);
+
 		c = blobmsg_open_array(b, "link-supported");
 		system_add_link_modes(b, ecmd.supported);
 		blobmsg_close_array(b, c);
@@ -1738,6 +1742,8 @@  system_if_dump_info(struct device *dev, struct blob_buf *b)
 		snprintf(s, 8, "%d%c", ethtool_cmd_speed(&ecmd),
 			ecmd.duplex == DUPLEX_HALF ? 'H' : 'F');
 		blobmsg_add_string_buffer(b);
+
+		blobmsg_add_u8(b, "autoneg", !!ecmd.autoneg);
 	}
 
 	return 0;