Skip to content

Commit 1177009

Browse files
Arkadi Sharshevskydavem330
authored andcommitted
devlink: Add Ethernet header for dpipe
This will be used by the IPv4 host table which will be introduced in the following patches. This header is global and can be reused by many drivers. Signed-off-by: Arkadi Sharshevsky <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a5e2da6 commit 1177009

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

include/net/devlink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ int devlink_dpipe_action_put(struct sk_buff *skb,
328328
struct devlink_dpipe_action *action);
329329
int devlink_dpipe_match_put(struct sk_buff *skb,
330330
struct devlink_dpipe_match *match);
331+
extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;
331332

332333
#else
333334

include/uapi/linux/devlink.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,12 @@ enum devlink_dpipe_action_type {
226226
DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY,
227227
};
228228

229+
enum devlink_dpipe_field_ethernet_id {
230+
DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC,
231+
};
232+
233+
enum devlink_dpipe_header_id {
234+
DEVLINK_DPIPE_HEADER_ETHERNET,
235+
};
236+
229237
#endif /* _UAPI_LINUX_DEVLINK_H_ */

net/core/devlink.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@
2929
#define CREATE_TRACE_POINTS
3030
#include <trace/events/devlink.h>
3131

32+
static struct devlink_dpipe_field devlink_dpipe_fields_ethernet[] = {
33+
{
34+
.name = "destination_mac",
35+
.id = DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC,
36+
.bitwidth = 48,
37+
},
38+
};
39+
40+
struct devlink_dpipe_header devlink_dpipe_header_ethernet = {
41+
.name = "ethernet",
42+
.id = DEVLINK_DPIPE_HEADER_ETHERNET,
43+
.fields = devlink_dpipe_fields_ethernet,
44+
.fields_count = ARRAY_SIZE(devlink_dpipe_fields_ethernet),
45+
.global = true,
46+
};
47+
EXPORT_SYMBOL(devlink_dpipe_header_ethernet);
48+
3249
EXPORT_TRACEPOINT_SYMBOL_GPL(devlink_hwmsg);
3350

3451
static LIST_HEAD(devlink_list);

0 commit comments

Comments
 (0)