netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next 0/2] display permanent hardware address
@ 2019-12-15 20:50 Michal Kubecek
  2019-12-15 21:06 ` [PATCH iproute2-next 1/2] Update kernel headers Michal Kubecek
  2019-12-15 21:06 ` [PATCH iproute2-next 2/2] ip link: show permanent hardware address Michal Kubecek
  0 siblings, 2 replies; 4+ messages in thread
From: Michal Kubecek @ 2019-12-15 20:50 UTC (permalink / raw)
  To: David Ahern; +Cc: Stephen Hemminger, netdev

Since kernel commit f74877a5457d ("rtnetlink: provide permanent hardware
address in RTM_NEWLINK"), in net-next tree at the moment, kernel provides
the permanent hardware address of a network device (if set). Patch 2 adds
this information to the output of "ip link show" and "ip address show",
patch 1 updates UAPI header copies to get IFLA_PERM_ADDRESS constant.

Michal Kubecek (2):
  Update kernel headers
  ip link: show permanent hardware address

 include/uapi/linux/if_bonding.h | 10 ++++++++++
 include/uapi/linux/if_bridge.h  | 10 ++++++++++
 include/uapi/linux/if_link.h    |  1 +
 ip/ipaddress.c                  | 18 ++++++++++++++++++
 4 files changed, 39 insertions(+)

-- 
2.24.1


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

* [PATCH iproute2-next 1/2] Update kernel headers
  2019-12-15 20:50 [PATCH iproute2-next 0/2] display permanent hardware address Michal Kubecek
@ 2019-12-15 21:06 ` Michal Kubecek
  2019-12-15 21:06 ` [PATCH iproute2-next 2/2] ip link: show permanent hardware address Michal Kubecek
  1 sibling, 0 replies; 4+ messages in thread
From: Michal Kubecek @ 2019-12-15 21:06 UTC (permalink / raw)
  To: David Ahern; +Cc: Stephen Hemminger, netdev

Update kernel headers to commit:
    f5058a27dac7 ("net: phylink: propagate phy_attach_direct() return code")

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
 include/uapi/linux/if_bonding.h | 10 ++++++++++
 include/uapi/linux/if_bridge.h  | 10 ++++++++++
 include/uapi/linux/if_link.h    |  1 +
 3 files changed, 21 insertions(+)

diff --git a/include/uapi/linux/if_bonding.h b/include/uapi/linux/if_bonding.h
index 790585f0e61b..6829213a54c5 100644
--- a/include/uapi/linux/if_bonding.h
+++ b/include/uapi/linux/if_bonding.h
@@ -95,6 +95,16 @@
 #define BOND_XMIT_POLICY_ENCAP23	3 /* encapsulated layer 2+3 */
 #define BOND_XMIT_POLICY_ENCAP34	4 /* encapsulated layer 3+4 */
 
+/* 802.3ad port state definitions (43.4.2.2 in the 802.3ad standard) */
+#define AD_STATE_LACP_ACTIVITY   0x1
+#define AD_STATE_LACP_TIMEOUT    0x2
+#define AD_STATE_AGGREGATION     0x4
+#define AD_STATE_SYNCHRONIZATION 0x8
+#define AD_STATE_COLLECTING      0x10
+#define AD_STATE_DISTRIBUTING    0x20
+#define AD_STATE_DEFAULTED       0x40
+#define AD_STATE_EXPIRED         0x80
+
 typedef struct ifbond {
 	__s32 bond_mode;
 	__s32 num_slaves;
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index 31fc51bdedb3..9fefc7f30d7b 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -156,6 +156,15 @@ struct bridge_vlan_xstats {
 	__u32 pad2;
 };
 
+struct bridge_stp_xstats {
+	__u64 transition_blk;
+	__u64 transition_fwd;
+	__u64 rx_bpdu;
+	__u64 tx_bpdu;
+	__u64 rx_tcn;
+	__u64 tx_tcn;
+};
+
 /* Bridge multicast database attributes
  * [MDBA_MDB] = {
  *     [MDBA_MDB_ENTRY] = {
@@ -262,6 +271,7 @@ enum {
 	BRIDGE_XSTATS_VLAN,
 	BRIDGE_XSTATS_MCAST,
 	BRIDGE_XSTATS_PAD,
+	BRIDGE_XSTATS_STP,
 	__BRIDGE_XSTATS_MAX
 };
 #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 1c49f436424d..29eac87e0e0f 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -169,6 +169,7 @@ enum {
 	IFLA_MAX_MTU,
 	IFLA_PROP_LIST,
 	IFLA_ALT_IFNAME, /* Alternative ifname */
+	IFLA_PERM_ADDRESS,
 	__IFLA_MAX
 };
 
-- 
2.24.1


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

* [PATCH iproute2-next 2/2] ip link: show permanent hardware address
  2019-12-15 20:50 [PATCH iproute2-next 0/2] display permanent hardware address Michal Kubecek
  2019-12-15 21:06 ` [PATCH iproute2-next 1/2] Update kernel headers Michal Kubecek
@ 2019-12-15 21:06 ` Michal Kubecek
  2019-12-17 16:35   ` David Ahern
  1 sibling, 1 reply; 4+ messages in thread
From: Michal Kubecek @ 2019-12-15 21:06 UTC (permalink / raw)
  To: David Ahern; +Cc: Stephen Hemminger, netdev

Display permanent hardware address of an interface in output of
"ip link show" and "ip addr show". To reduce noise, permanent address is
only shown if it is different from current one.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
 ip/ipaddress.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 964f14df93f0..9415d7682c12 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1011,6 +1011,24 @@ int print_linkinfo(struct nlmsghdr *n, void *arg)
 						       ifi->ifi_type,
 						       b1, sizeof(b1)));
 		}
+		if (tb[IFLA_PERM_ADDRESS]) {
+			unsigned int len = RTA_PAYLOAD(tb[IFLA_PERM_ADDRESS]);
+
+			if (!tb[IFLA_ADDRESS] ||
+			    RTA_PAYLOAD(tb[IFLA_ADDRESS]) != len ||
+			    memcmp(RTA_DATA(tb[IFLA_PERM_ADDRESS]),
+				   RTA_DATA(tb[IFLA_ADDRESS]), len)) {
+				print_string(PRINT_FP, NULL, " permaddr ", NULL);
+				print_color_string(PRINT_ANY,
+						   COLOR_MAC,
+						   "permaddr",
+						   "%s",
+						   ll_addr_n2a(RTA_DATA(tb[IFLA_PERM_ADDRESS]),
+							       RTA_PAYLOAD(tb[IFLA_PERM_ADDRESS]),
+							       ifi->ifi_type,
+							       b1, sizeof(b1)));
+			}
+		}
 	}
 
 	if (tb[IFLA_LINK_NETNSID]) {
-- 
2.24.1


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

* Re: [PATCH iproute2-next 2/2] ip link: show permanent hardware address
  2019-12-15 21:06 ` [PATCH iproute2-next 2/2] ip link: show permanent hardware address Michal Kubecek
@ 2019-12-17 16:35   ` David Ahern
  0 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2019-12-17 16:35 UTC (permalink / raw)
  To: Michal Kubecek, David Ahern; +Cc: Stephen Hemminger, netdev

On 12/15/19 2:06 PM, Michal Kubecek wrote:
> Display permanent hardware address of an interface in output of
> "ip link show" and "ip addr show". To reduce noise, permanent address is
> only shown if it is different from current one.
> 
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> ---
>  ip/ipaddress.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 

applied to iproute2-next. Thanks



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

end of thread, other threads:[~2019-12-17 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15 20:50 [PATCH iproute2-next 0/2] display permanent hardware address Michal Kubecek
2019-12-15 21:06 ` [PATCH iproute2-next 1/2] Update kernel headers Michal Kubecek
2019-12-15 21:06 ` [PATCH iproute2-next 2/2] ip link: show permanent hardware address Michal Kubecek
2019-12-17 16:35   ` David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).