2 * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
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 #define N_NXM_DL_TYPES 2
19 #define NXM_DL_NONE (0, 0)
20 #define NXM_DL_ARP (ETH_TYPE_ARP, 0)
21 #define NXM_DL_IP (ETH_TYPE_IP, 0)
22 #define NXM_DL_IPV6 (ETH_TYPE_IPV6, 0)
23 #define NXM_DL_IP_ANY (ETH_TYPE_IP, ETH_TYPE_IPV6)
25 #define DEFINE_FIELD_M(HEADER, WILDCARD, DL_TYPES, NW_PROTO, WRITABLE) \
26 DEFINE_FIELD(HEADER, WILDCARD, DL_TYPES, NW_PROTO, WRITABLE) \
27 DEFINE_FIELD(HEADER##_W, WILDCARD, DL_TYPES, NW_PROTO, false)
29 /* NXM_ suffix FWW_* bit dl_types nw_proto rw? */
30 /* ------------ ------------ ----------- ------------- --- */
31 DEFINE_FIELD_M(NX_TUN_ID, 0, NXM_DL_NONE, 0, true)
32 DEFINE_FIELD (OF_IN_PORT, FWW_IN_PORT, NXM_DL_NONE, 0, false)
33 DEFINE_FIELD_M(OF_ETH_DST, 0, NXM_DL_NONE, 0, false)
34 DEFINE_FIELD (OF_ETH_SRC, FWW_DL_SRC, NXM_DL_NONE, 0, false)
35 DEFINE_FIELD (OF_ETH_TYPE, FWW_DL_TYPE, NXM_DL_NONE, 0, false)
36 DEFINE_FIELD_M(OF_VLAN_TCI, 0, NXM_DL_NONE, 0, true)
37 DEFINE_FIELD (OF_IP_TOS, FWW_NW_TOS, NXM_DL_IP_ANY, 0, false)
38 DEFINE_FIELD (OF_IP_PROTO, FWW_NW_PROTO, NXM_DL_IP_ANY, 0, false)
39 DEFINE_FIELD_M(OF_IP_SRC, 0, NXM_DL_IP, 0, false)
40 DEFINE_FIELD_M(OF_IP_DST, 0, NXM_DL_IP, 0, false)
41 DEFINE_FIELD (OF_TCP_SRC, FWW_TP_SRC, NXM_DL_IP_ANY, IPPROTO_TCP, false)
42 DEFINE_FIELD (OF_TCP_DST, FWW_TP_DST, NXM_DL_IP_ANY, IPPROTO_TCP, false)
43 DEFINE_FIELD (OF_UDP_SRC, FWW_TP_SRC, NXM_DL_IP_ANY, IPPROTO_UDP, false)
44 DEFINE_FIELD (OF_UDP_DST, FWW_TP_DST, NXM_DL_IP_ANY, IPPROTO_UDP, false)
45 DEFINE_FIELD (OF_ICMP_TYPE, FWW_TP_SRC, NXM_DL_IP, IPPROTO_ICMP, false)
46 DEFINE_FIELD (OF_ICMP_CODE, FWW_TP_DST, NXM_DL_IP, IPPROTO_ICMP, false)
47 DEFINE_FIELD (OF_ARP_OP, FWW_NW_PROTO, NXM_DL_ARP, 0, false)
48 DEFINE_FIELD_M(OF_ARP_SPA, 0, NXM_DL_ARP, 0, false)
49 DEFINE_FIELD_M(OF_ARP_TPA, 0, NXM_DL_ARP, 0, false)
50 DEFINE_FIELD (NX_ARP_SHA, FWW_ARP_SHA, NXM_DL_ARP, 0, false)
51 DEFINE_FIELD (NX_ARP_THA, FWW_ARP_THA, NXM_DL_ARP, 0, false)
52 DEFINE_FIELD_M(NX_IPV6_SRC, 0, NXM_DL_IPV6, 0, false)
53 DEFINE_FIELD_M(NX_IPV6_DST, 0, NXM_DL_IPV6, 0, false)
54 DEFINE_FIELD (NX_ICMPV6_TYPE, FWW_TP_SRC, NXM_DL_IPV6, IPPROTO_ICMPV6, false)
55 DEFINE_FIELD (NX_ICMPV6_CODE, FWW_TP_DST, NXM_DL_IPV6, IPPROTO_ICMPV6, false)
56 DEFINE_FIELD (NX_ND_TARGET, FWW_ND_TARGET,NXM_DL_IPV6, IPPROTO_ICMPV6, false)
57 DEFINE_FIELD (NX_ND_SLL, FWW_ARP_SHA, NXM_DL_IPV6, IPPROTO_ICMPV6, false)
58 DEFINE_FIELD (NX_ND_TLL, FWW_ARP_THA, NXM_DL_IPV6, IPPROTO_ICMPV6, false)
60 DEFINE_FIELD_M(NX_REG0, 0, NXM_DL_NONE, 0, true)
62 DEFINE_FIELD_M(NX_REG1, 0, NXM_DL_NONE, 0, true)
65 DEFINE_FIELD_M(NX_REG2, 0, NXM_DL_NONE, 0, true)
68 DEFINE_FIELD_M(NX_REG3, 0, NXM_DL_NONE, 0, true)