History

netdev-genl: create a simple family for netdev stuff

Add a Netlink spec-compatible family for netdevs. This is a very simple implementation without much thought going into it. It allows us to reap all the benefits of Netlink specs, one can use the generic client to issue the commands: $ ./cli.py --spec netdev.yaml --dump dev_get [{'ifindex': 1, 'xdp-features': set()}, {'ifindex': 2, 'xdp-features': {'basic', 'ndo-xmit', 'redirect'}}, {'ifindex': 3, 'xdp-features': {'rx-sg'}}] the generic python library does not have flags-by-name support, yet, but we also don't have to carry strings in the messages, as user space can get the names from the spec.

Jakub Kicinski committed 3 years ago

Commit d3d854f1 parent 150809010 files · +477 −1Browse files

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

Unified · Split

include/uapi/linux/netdev.h+59−0
@@ -0,0 +1,59 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/* Do not edit directly, auto-generated from: */
3/* Documentation/netlink/specs/netdev.yaml */
4/* YNL-GEN uapi header */
5
6#ifndef _UAPI_LINUX_NETDEV_H
7#define _UAPI_LINUX_NETDEV_H
8
9#define NETDEV_FAMILY_NAME "netdev"
10#define NETDEV_FAMILY_VERSION 1
11
12/**
13 * enum netdev_xdp_act
14 * @NETDEV_XDP_ACT_BASIC: XDP feautues set supported by all drivers
15 * (XDP_ABORTED, XDP_DROP, XDP_PASS, XDP_TX)
16 * @NETDEV_XDP_ACT_REDIRECT: The netdev supports XDP_REDIRECT
17 * @NETDEV_XDP_ACT_NDO_XMIT: This feature informs if netdev implements
18 * ndo_xdp_xmit callback.
19 * @NETDEV_XDP_ACT_XSK_ZEROCOPY: This feature informs if netdev supports AF_XDP
20 * in zero copy mode.
21 * @NETDEV_XDP_ACT_HW_OFFLOAD: This feature informs if netdev supports XDP hw
22 * oflloading.
23 * @NETDEV_XDP_ACT_RX_SG: This feature informs if netdev implements non-linear
24 * XDP buffer support in the driver napi callback.
25 * @NETDEV_XDP_ACT_NDO_XMIT_SG: This feature informs if netdev implements
26 * non-linear XDP buffer support in ndo_xdp_xmit callback.
27 */
28enum netdev_xdp_act {
29 NETDEV_XDP_ACT_BASIC = 1,
30 NETDEV_XDP_ACT_REDIRECT = 2,
31 NETDEV_XDP_ACT_NDO_XMIT = 4,
32 NETDEV_XDP_ACT_XSK_ZEROCOPY = 8,
33 NETDEV_XDP_ACT_HW_OFFLOAD = 16,
34 NETDEV_XDP_ACT_RX_SG = 32,
35 NETDEV_XDP_ACT_NDO_XMIT_SG = 64,
36};
37
38enum {
39 NETDEV_A_DEV_IFINDEX = 1,
40 NETDEV_A_DEV_PAD,
41 NETDEV_A_DEV_XDP_FEATURES,
42
43 __NETDEV_A_DEV_MAX,
44 NETDEV_A_DEV_MAX = (__NETDEV_A_DEV_MAX - 1)
45};
46
47enum {
48 NETDEV_CMD_DEV_GET = 1,
49 NETDEV_CMD_DEV_ADD_NTF,
50 NETDEV_CMD_DEV_DEL_NTF,
51 NETDEV_CMD_DEV_CHANGE_NTF,
52
53 __NETDEV_CMD_MAX,
54 NETDEV_CMD_MAX = (__NETDEV_CMD_MAX - 1)
55};
56
57#define NETDEV_MCGRP_MGMT "mgmt"
58
59#endif /* _UAPI_LINUX_NETDEV_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t