blob: 1fc6880a920d6a3a3e4c8d3a44408600b30096a9 [file] [log] [blame]
developer20d67712022-03-02 14:09:32 +08001diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
2--- a/include/linux/netdevice.h
3+++ b/include/linux/netdevice.h
4@@ -829,6 +829,59 @@ typedef u16 (*select_queue_fallback_t)(s
5 struct sk_buff *skb,
6 struct net_device *sb_dev);
7
8+enum net_device_path_type {
9+ DEV_PATH_ETHERNET = 0,
10+ DEV_PATH_VLAN,
11+ DEV_PATH_BRIDGE,
12+ DEV_PATH_PPPOE,
13+ DEV_PATH_DSA,
14+};
15+
16+struct net_device_path {
17+ enum net_device_path_type type;
18+ const struct net_device *dev;
19+ union {
20+ struct {
21+ u16 id;
22+ __be16 proto;
23+ u8 h_dest[ETH_ALEN];
24+ } encap;
25+ struct {
26+ enum {
27+ DEV_PATH_BR_VLAN_KEEP,
28+ DEV_PATH_BR_VLAN_TAG,
29+ DEV_PATH_BR_VLAN_UNTAG,
30+ DEV_PATH_BR_VLAN_UNTAG_HW,
31+ } vlan_mode;
32+ u16 vlan_id;
33+ __be16 vlan_proto;
34+ } bridge;
35+ struct {
36+ int port;
37+ u16 proto;
38+ } dsa;
39+ };
40+};
41+
42+#define NET_DEVICE_PATH_STACK_MAX 5
43+#define NET_DEVICE_PATH_VLAN_MAX 2
44+
45+struct net_device_path_stack {
46+ int num_paths;
47+ struct net_device_path path[NET_DEVICE_PATH_STACK_MAX];
48+};
49+
50+struct net_device_path_ctx {
51+ const struct net_device *dev;
52+ const u8 *daddr;
53+
54+ int num_vlans;
55+ struct {
56+ u16 id;
57+ __be16 proto;
58+ } vlan[NET_DEVICE_PATH_VLAN_MAX];
59+};
60+
61 enum tc_setup_type {
62 TC_SETUP_QDISC_MQPRIO,
63 TC_SETUP_CLSU32,
64@@ -844,6 +897,7 @@ enum tc_setup_type {
65 TC_SETUP_ROOT_QDISC,
66 TC_SETUP_QDISC_GRED,
67 TC_SETUP_QDISC_TAPRIO,
68+ TC_SETUP_FT,
69 };
70
71 /* These structures hold the attributes of bpf state that are being passed
72@@ -1258,6 +1312,8 @@ enum flow_offload_type {
73 * Get devlink port instance associated with a given netdev.
74 * Called with a reference on the netdevice and devlink locks only,
75 * rtnl_lock is not held.
76+ * int (*ndo_fill_forward_path)(struct net_device_path_ctx *ctx, struct net_device_path *path);
77+ * Get the forwarding path to reach the real device from the HW destination address
78 */
79 struct net_device_ops {
80 int (*ndo_init)(struct net_device *dev);
81@@ -1460,6 +1516,8 @@ struct net_device_ops {
82 int (*ndo_xsk_wakeup)(struct net_device *dev,
83 u32 queue_id, u32 flags);
84 struct devlink_port * (*ndo_get_devlink_port)(struct net_device *dev);
85+ int (*ndo_fill_forward_path)(struct net_device_path_ctx *ctx,
86+ struct net_device_path *path);
87 };
88
89 /**
90@@ -2684,6 +2742,8 @@ void dev_remove_offload(struct packet_of
91
92 int dev_get_iflink(const struct net_device *dev);
93 int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
94+int dev_fill_forward_path(const struct net_device *dev, const u8 *daddr,
95+ struct net_device_path_stack *stack);
96 struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
97 unsigned short mask);
98 struct net_device *dev_get_by_name(struct net *net, const char *name);