2 // Copyright (c) 2010-2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #ifndef _ACL_FIELD_DEF_H_
18 #define _ACL_FIELD_DEF_H_
20 #include <rte_ether.h>
26 struct pkt_eth_ipv4_udp {
27 struct ether_hdr ether_hdr;
28 struct ipv4_hdr ipv4_hdr;
29 struct udp_hdr udp_hdr;
30 } __attribute__((packed));
32 static struct rte_acl_field_def pkt_eth_ipv4_udp_defs[] = {
33 /* first input field - always one byte long. */
35 .type = RTE_ACL_FIELD_TYPE_BITMASK,
36 .size = sizeof (uint8_t),
39 .offset = offsetof (struct pkt_eth_ipv4_udp, ipv4_hdr.next_proto_id),
41 /* IPv4 source address. */
43 .type = RTE_ACL_FIELD_TYPE_MASK,
44 .size = sizeof (uint32_t),
47 .offset = offsetof (struct pkt_eth_ipv4_udp, ipv4_hdr.src_addr),
49 /* IPv4 destination address */
51 .type = RTE_ACL_FIELD_TYPE_MASK,
52 .size = sizeof (uint32_t),
55 .offset = offsetof (struct pkt_eth_ipv4_udp, ipv4_hdr.dst_addr),
57 /* (L4 src/dst port) - 4 consecutive bytes. */
59 .type = RTE_ACL_FIELD_TYPE_RANGE,
60 .size = sizeof (uint16_t),
63 .offset = offsetof (struct pkt_eth_ipv4_udp, udp_hdr.src_port),
66 .type = RTE_ACL_FIELD_TYPE_RANGE,
67 .size = sizeof (uint16_t),
70 .offset = offsetof (struct pkt_eth_ipv4_udp, udp_hdr.dst_port),
74 struct pkt_qinq_ipv4_udp {
75 struct qinq_hdr qinq_hdr;
76 struct ipv4_hdr ipv4_hdr;
77 struct udp_hdr udp_hdr;
80 static struct rte_acl_field_def pkt_qinq_ipv4_udp_defs[] = {
81 /* first input field - always one byte long. */
83 .type = RTE_ACL_FIELD_TYPE_BITMASK,
84 .size = sizeof (uint8_t),
87 .offset = offsetof (struct pkt_qinq_ipv4_udp, ipv4_hdr.next_proto_id),
89 /* IPv4 source address. */
91 .type = RTE_ACL_FIELD_TYPE_MASK,
92 .size = sizeof (uint32_t),
95 .offset = offsetof (struct pkt_qinq_ipv4_udp, ipv4_hdr.src_addr),
97 /* IPv4 destination address */
99 .type = RTE_ACL_FIELD_TYPE_MASK,
100 .size = sizeof (uint32_t),
103 .offset = offsetof (struct pkt_qinq_ipv4_udp, ipv4_hdr.dst_addr),
105 /* (L4 src/dst port) - 4 consecutive bytes. */
107 .type = RTE_ACL_FIELD_TYPE_RANGE,
108 .size = sizeof (uint16_t),
111 .offset = offsetof (struct pkt_qinq_ipv4_udp, udp_hdr.src_port),
114 .type = RTE_ACL_FIELD_TYPE_RANGE,
115 .size = sizeof (uint16_t),
118 .offset = offsetof (struct pkt_qinq_ipv4_udp, udp_hdr.dst_port),
120 /* (SVLAN id + eth type) - 4 consecutive bytes. */
122 .type = RTE_ACL_FIELD_TYPE_BITMASK,
123 .size = sizeof(uint16_t),
126 .offset = offsetof (struct pkt_qinq_ipv4_udp, qinq_hdr.svlan.eth_proto),
129 .type = RTE_ACL_FIELD_TYPE_BITMASK,
130 .size = sizeof(uint16_t),
133 .offset = offsetof (struct pkt_qinq_ipv4_udp, qinq_hdr.svlan.vlan_tci),
135 /* (CVLAN id + eth type) - 4 consecutive byates. */
137 .type = RTE_ACL_FIELD_TYPE_BITMASK,
138 .size = sizeof(uint16_t),
141 .offset = offsetof (struct pkt_qinq_ipv4_udp, qinq_hdr.cvlan.eth_proto),
144 .type = RTE_ACL_FIELD_TYPE_BITMASK,
145 .size = sizeof(uint16_t),
148 .offset = offsetof (struct pkt_qinq_ipv4_udp, qinq_hdr.cvlan.vlan_tci),
152 #endif /* _ACL_FIELD_DEF_H_ */