Re: [RFC PATCH net-next 1/3] net: rtnetlink: Add link-down reason to RTNL messages
From: Jakub Kicinski <hidden>
Date: 2019-03-16 02:26:19
On Fri, 15 Mar 2019 17:56:07 +0000, Petr Machata wrote:
quoted hunk ↗ jump to hunk
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index e2091bb2b3a8..cfd9e86ff0ca 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h@@ -110,6 +110,9 @@ struct rtnl_link_ops { int (*fill_linkxstats)(struct sk_buff *skb, const struct net_device *dev, int *prividx, int attr); + size_t (*link_down_reason_get_size)(const struct net_device *dev); + int (*fill_link_down_reason)(struct sk_buff *skb, + const struct net_device *dev);
IMHO the API is a little heavy for returning, what is effectively a u64 value sliced in two.. Perhaps the core can just assume the reason will be provided if the NDO is present? And the "fill" NDO should probably fill in the reason structure, rather than getting the skb passed and dealing with netlink directly. Also perhaps this would be a ethtool-nl candidate (which would hopefully land soon after the merge window)?
quoted hunk ↗ jump to hunk
}; int __rtnl_link_register(struct rtnl_link_ops *ops);diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 5b225ff63b48..a47f42e79741 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h@@ -167,6 +167,8 @@ enum { IFLA_NEW_IFINDEX, IFLA_MIN_MTU, IFLA_MAX_MTU, + IFLA_LINK_DOWN_REASON_MAJOR, /* enum rtnl_link_down_reason_major */ + IFLA_LINK_DOWN_REASON_MINOR, __IFLA_MAX };