Add IPv6 flow specification support.
Unified · Split
| @@ -226,6 +226,7 @@ struct ib_uverbs_flow_spec { · 225 unmodified lines | ||
| 226 | 226 | struct ib_uverbs_flow_spec_eth eth; |
| 227 | 227 | struct ib_uverbs_flow_spec_ipv4 ipv4; |
| 228 | 228 | struct ib_uverbs_flow_spec_tcp_udp tcp_udp; |
| 229 | + struct ib_uverbs_flow_spec_ipv6 ipv6; | |
| 229 | 230 | }; |
| 230 | 231 | }; |
| 231 | 232 | |
| @@ -3105,6 +3105,15 @@ static int kern_spec_to_ib_spec(struct ib_uverbs_flow_spec *kern_spec, · 3104 unmodified lines | ||
| 3105 | 3105 | memcpy(&ib_spec->ipv4.mask, &kern_spec->ipv4.mask, |
| 3106 | 3106 | sizeof(struct ib_flow_ipv4_filter)); |
| 3107 | 3107 | break; |
| 3108 | + case IB_FLOW_SPEC_IPV6: | |
| 3109 | + ib_spec->ipv6.size = sizeof(struct ib_flow_spec_ipv6); | |
| 3110 | + if (ib_spec->ipv6.size != kern_spec->ipv6.size) | |
| 3111 | + return -EINVAL; | |
| 3112 | + memcpy(&ib_spec->ipv6.val, &kern_spec->ipv6.val, | |
| 3113 | + sizeof(struct ib_flow_ipv6_filter)); | |
| 3114 | + memcpy(&ib_spec->ipv6.mask, &kern_spec->ipv6.mask, | |
| 3115 | + sizeof(struct ib_flow_ipv6_filter)); | |
| 3116 | + break; | |
| 3108 | 3117 | case IB_FLOW_SPEC_TCP: |
| 3109 | 3118 | case IB_FLOW_SPEC_UDP: |
| 3110 | 3119 | ib_spec->tcp_udp.size = sizeof(struct ib_flow_spec_tcp_udp); |
| @@ -1569,6 +1569,7 @@ enum ib_flow_spec_type { · 1568 unmodified lines | ||
| 1569 | 1569 | IB_FLOW_SPEC_IB = 0x22, |
| 1570 | 1570 | /* L3 header*/ |
| 1571 | 1571 | IB_FLOW_SPEC_IPV4 = 0x30, |
| 1572 | + IB_FLOW_SPEC_IPV6 = 0x31, | |
| 1572 | 1573 | /* L4 headers*/ |
| 1573 | 1574 | IB_FLOW_SPEC_TCP = 0x40, |
| 1574 | 1575 | IB_FLOW_SPEC_UDP = 0x41 |
| @@ -1630,6 +1631,18 @@ struct ib_flow_spec_ipv4 { · 55 unmodified lines | ||
| 1630 | 1631 | struct ib_flow_ipv4_filter mask; |
| 1631 | 1632 | }; |
| 1632 | 1633 | |
| 1634 | +struct ib_flow_ipv6_filter { | |
| 1635 | + u8 src_ip[16]; | |
| 1636 | + u8 dst_ip[16]; | |
| 1637 | +}; | |
| 1638 | + | |
| 1639 | +struct ib_flow_spec_ipv6 { | |
| 1640 | + enum ib_flow_spec_type type; | |
| 1641 | + u16 size; | |
| 1642 | + struct ib_flow_ipv6_filter val; | |
| 1643 | + struct ib_flow_ipv6_filter mask; | |
| 1644 | +}; | |
| 1645 | + | |
| 1633 | 1646 | struct ib_flow_tcp_udp_filter { |
| 1634 | 1647 | __be16 dst_port; |
| 1635 | 1648 | __be16 src_port; |
| @@ -1651,6 +1664,7 @@ union ib_flow_spec { · 15 unmodified lines | ||
| 1651 | 1664 | struct ib_flow_spec_ib ib; |
| 1652 | 1665 | struct ib_flow_spec_ipv4 ipv4; |
| 1653 | 1666 | struct ib_flow_spec_tcp_udp tcp_udp; |
| 1667 | + struct ib_flow_spec_ipv6 ipv6; | |
| 1654 | 1668 | }; |
| 1655 | 1669 | |
| 1656 | 1670 | struct ib_flow_attr { |
| @@ -867,6 +867,24 @@ struct ib_uverbs_flow_spec_tcp_udp { · 866 unmodified lines | ||
| 867 | 867 | struct ib_uverbs_flow_tcp_udp_filter mask; |
| 868 | 868 | }; |
| 869 | 869 | |
| 870 | +struct ib_uverbs_flow_ipv6_filter { | |
| 871 | + __u8 src_ip[16]; | |
| 872 | + __u8 dst_ip[16]; | |
| 873 | +}; | |
| 874 | + | |
| 875 | +struct ib_uverbs_flow_spec_ipv6 { | |
| 876 | + union { | |
| 877 | + struct ib_uverbs_flow_spec_hdr hdr; | |
| 878 | + struct { | |
| 879 | + __u32 type; | |
| 880 | + __u16 size; | |
| 881 | + __u16 reserved; | |
| 882 | + }; | |
| 883 | + }; | |
| 884 | + struct ib_uverbs_flow_ipv6_filter val; | |
| 885 | + struct ib_uverbs_flow_ipv6_filter mask; | |
| 886 | +}; | |
| 887 | + | |
| 870 | 888 | struct ib_uverbs_flow_attr { |
| 871 | 889 | __u32 type; |
| 872 | 890 | __u16 size; |