IB/core: Add more fields to IPv6 flow specification
authorMaor Gottlieb <maorg@mellanox.com>
Tue, 30 Aug 2016 13:58:34 +0000 (16:58 +0300)
committerDoug Ledford <dledford@redhat.com>
Fri, 7 Oct 2016 20:54:18 +0000 (16:54 -0400)
Add the following fields to IPv6 flow filter specification:
1. Traffic Class
2. Flow Label
3. Next Header
4. Hop Limit

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/uverbs_cmd.c
include/rdma/ib_verbs.h
include/uapi/rdma/ib_user_verbs.h

index b9fb256..cb3f515 100644 (file)
@@ -3158,6 +3158,10 @@ static int kern_spec_to_ib_spec(struct ib_uverbs_flow_spec *kern_spec,
                ib_spec->size = sizeof(struct ib_flow_spec_ipv6);
                memcpy(&ib_spec->ipv6.val, kern_spec_val, actual_filter_sz);
                memcpy(&ib_spec->ipv6.mask, kern_spec_mask, actual_filter_sz);
+
+               if ((ntohl(ib_spec->ipv6.mask.flow_label)) >= BIT(20) ||
+                   (ntohl(ib_spec->ipv6.val.flow_label)) >= BIT(20))
+                       return -EINVAL;
                break;
        case IB_FLOW_SPEC_TCP:
        case IB_FLOW_SPEC_UDP:
index 990220b..0cec4da 100644 (file)
@@ -1676,6 +1676,10 @@ struct ib_flow_spec_ipv4 {
 struct ib_flow_ipv6_filter {
        u8      src_ip[16];
        u8      dst_ip[16];
+       __be32  flow_label;
+       u8      next_hdr;
+       u8      traffic_class;
+       u8      hop_limit;
        /* Must be last */
        u8      real_sz[0];
 };
index 804f086..25225eb 100644 (file)
@@ -886,8 +886,13 @@ struct ib_uverbs_flow_spec_tcp_udp {
 };
 
 struct ib_uverbs_flow_ipv6_filter {
-       __u8 src_ip[16];
-       __u8 dst_ip[16];
+       __u8    src_ip[16];
+       __u8    dst_ip[16];
+       __be32  flow_label;
+       __u8    next_hdr;
+       __u8    traffic_class;
+       __u8    hop_limit;
+       __u8    reserved;
 };
 
 struct ib_uverbs_flow_spec_ipv6 {