devlink: Add IPv6 header for dpipe
authorArkadi Sharshevsky <arkadis@mellanox.com>
Thu, 31 Aug 2017 15:59:12 +0000 (17:59 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 31 Aug 2017 21:42:19 +0000 (14:42 -0700)
This will be used by the IPv6 host table which will be introduced in the
following patches. The fields in the header are added per-use. This header
is global and can be reused by many drivers.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/devlink.h
include/uapi/linux/devlink.h
net/core/devlink.c

index aaf7178127a2f793943ac912c819caf6fea64593..b9654e133599383fad6ada59a19378e4515be90c 100644 (file)
@@ -330,6 +330,7 @@ int devlink_dpipe_match_put(struct sk_buff *skb,
                            struct devlink_dpipe_match *match);
 extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;
 extern struct devlink_dpipe_header devlink_dpipe_header_ipv4;
+extern struct devlink_dpipe_header devlink_dpipe_header_ipv6;
 
 #else
 
index 6c172548589dedd184824a9ce1c15d89d7479458..0cbca96c66b9447cac9c69d6f5b72d4c27d739dd 100644 (file)
@@ -234,9 +234,14 @@ enum devlink_dpipe_field_ipv4_id {
        DEVLINK_DPIPE_FIELD_IPV4_DST_IP,
 };
 
+enum devlink_dpipe_field_ipv6_id {
+       DEVLINK_DPIPE_FIELD_IPV6_DST_IP,
+};
+
 enum devlink_dpipe_header_id {
        DEVLINK_DPIPE_HEADER_ETHERNET,
        DEVLINK_DPIPE_HEADER_IPV4,
+       DEVLINK_DPIPE_HEADER_IPV6,
 };
 
 #endif /* _UAPI_LINUX_DEVLINK_H_ */
index cbc4b0461b0f3ab84053ac1bbe84e2107258d945..7d430c1d9c3ed9be22f558d9297ac65e5d64ec7d 100644 (file)
@@ -63,6 +63,23 @@ struct devlink_dpipe_header devlink_dpipe_header_ipv4 = {
 };
 EXPORT_SYMBOL(devlink_dpipe_header_ipv4);
 
+static struct devlink_dpipe_field devlink_dpipe_fields_ipv6[] = {
+       {
+               .name = "destination ip",
+               .id = DEVLINK_DPIPE_FIELD_IPV6_DST_IP,
+               .bitwidth = 128,
+       },
+};
+
+struct devlink_dpipe_header devlink_dpipe_header_ipv6 = {
+       .name = "ipv6",
+       .id = DEVLINK_DPIPE_HEADER_IPV6,
+       .fields = devlink_dpipe_fields_ipv6,
+       .fields_count = ARRAY_SIZE(devlink_dpipe_fields_ipv6),
+       .global = true,
+};
+EXPORT_SYMBOL(devlink_dpipe_header_ipv6);
+
 EXPORT_TRACEPOINT_SYMBOL_GPL(devlink_hwmsg);
 
 static LIST_HEAD(devlink_list);