Skip to content

Commit 3fb886e

Browse files
Arkadi Sharshevskydavem330
authored andcommitted
devlink: Add IPv4 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 1177009 commit 3fb886e

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

include/net/devlink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ int devlink_dpipe_action_put(struct sk_buff *skb,
329329
int devlink_dpipe_match_put(struct sk_buff *skb,
330330
struct devlink_dpipe_match *match);
331331
extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;
332+
extern struct devlink_dpipe_header devlink_dpipe_header_ipv4;
332333

333334
#else
334335

include/uapi/linux/devlink.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,13 @@ enum devlink_dpipe_field_ethernet_id {
230230
DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC,
231231
};
232232

233+
enum devlink_dpipe_field_ipv4_id {
234+
DEVLINK_DPIPE_FIELD_IPV4_DST_IP,
235+
};
236+
233237
enum devlink_dpipe_header_id {
234238
DEVLINK_DPIPE_HEADER_ETHERNET,
239+
DEVLINK_DPIPE_HEADER_IPV4,
235240
};
236241

237242
#endif /* _UAPI_LINUX_DEVLINK_H_ */

net/core/devlink.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,23 @@ struct devlink_dpipe_header devlink_dpipe_header_ethernet = {
4646
};
4747
EXPORT_SYMBOL(devlink_dpipe_header_ethernet);
4848

49+
static struct devlink_dpipe_field devlink_dpipe_fields_ipv4[] = {
50+
{
51+
.name = "destination ip",
52+
.id = DEVLINK_DPIPE_FIELD_IPV4_DST_IP,
53+
.bitwidth = 32,
54+
},
55+
};
56+
57+
struct devlink_dpipe_header devlink_dpipe_header_ipv4 = {
58+
.name = "ipv4",
59+
.id = DEVLINK_DPIPE_HEADER_IPV4,
60+
.fields = devlink_dpipe_fields_ipv4,
61+
.fields_count = ARRAY_SIZE(devlink_dpipe_fields_ipv4),
62+
.global = true,
63+
};
64+
EXPORT_SYMBOL(devlink_dpipe_header_ipv4);
65+
4966
EXPORT_TRACEPOINT_SYMBOL_GPL(devlink_hwmsg);
5067

5168
static LIST_HEAD(devlink_list);

0 commit comments

Comments
 (0)