History

ethtool: helper functions for netlink interface

Add common request/reply header definition and helpers to parse request header and fill reply header. Provide ethnl_update_* helpers to update structure members from request attributes (to be used for *_SET requests).

Michal Kubecek committed 6 years ago

Commit 041b1c51 parent 2b4a8993 files · +392 −0Browse files

Showing the changes to include/uapi/linux (1 of 3 files). Show all

Unified · Split

include/uapi/linux/ethtool_netlink.h+21−0
@@ -29,6 +29,27 @@ enum { · 28 unmodified lines
29 ETHTOOL_MSG_KERNEL_MAX = __ETHTOOL_MSG_KERNEL_CNT - 129 ETHTOOL_MSG_KERNEL_MAX = __ETHTOOL_MSG_KERNEL_CNT - 1
30};30};
31 31
32/* request header */
33
34/* use compact bitsets in reply */
35#define ETHTOOL_FLAG_COMPACT_BITSETS (1 << 0)
36/* provide optional reply for SET or ACT requests */
37#define ETHTOOL_FLAG_OMIT_REPLY (1 << 1)
38
39#define ETHTOOL_FLAG_ALL (ETHTOOL_FLAG_COMPACT_BITSETS | \
40 ETHTOOL_FLAG_OMIT_REPLY)
41
42enum {
43 ETHTOOL_A_HEADER_UNSPEC,
44 ETHTOOL_A_HEADER_DEV_INDEX, /* u32 */
45 ETHTOOL_A_HEADER_DEV_NAME, /* string */
46 ETHTOOL_A_HEADER_FLAGS, /* u32 - ETHTOOL_FLAG_* */
47
48 /* add new constants above here */
49 __ETHTOOL_A_HEADER_CNT,
50 ETHTOOL_A_HEADER_MAX = __ETHTOOL_A_HEADER_CNT - 1
51};
52
32/* generic netlink info */53/* generic netlink info */
33#define ETHTOOL_GENL_NAME "ethtool"54#define ETHTOOL_GENL_NAME "ethtool"
34#define ETHTOOL_GENL_VERSION 155#define ETHTOOL_GENL_VERSION 1