f6167af43cd9f643d3d2002e60280fe354b28bdf
[sliver-openvswitch.git] / lib / nx-match.def
1 /*                                                                -*- c -*-
2  * Copyright (c) 2008, 2009, 2010 Nicira Networks.
3  *
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:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #define DEFINE_FIELD_M(HEADER, WILDCARD, DL_TYPE, NW_PROTO)             \
18         DEFINE_FIELD(HEADER, WILDCARD, DL_TYPE, NW_PROTO)               \
19         DEFINE_FIELD(HEADER##_W, WILDCARD, DL_TYPE, NW_PROTO)
20
21 /*             NXM_ bit      OFPFW_* bit     dl_type       nw_proto      */
22 /*             ------------  --------------  -----------   ------------- */
23 DEFINE_FIELD  (OF_IN_PORT,   OFPFW_IN_PORT,  0,            0)
24 DEFINE_FIELD_M(OF_ETH_DST,   0,              0,            0)
25 DEFINE_FIELD  (OF_ETH_SRC,   OFPFW_DL_SRC,   0,            0)
26 DEFINE_FIELD  (OF_ETH_TYPE,  OFPFW_DL_TYPE,  0,            0)
27 DEFINE_FIELD_M(OF_VLAN_TCI,  0,              0,            0)
28 DEFINE_FIELD  (OF_IP_TOS,    OFPFW_NW_TOS,   ETH_TYPE_IP,  0)
29 DEFINE_FIELD  (OF_IP_PROTO,  OFPFW_NW_PROTO, ETH_TYPE_IP,  0)
30 DEFINE_FIELD_M(OF_IP_SRC,    0,              ETH_TYPE_IP,  0)
31 DEFINE_FIELD_M(OF_IP_DST,    0,              ETH_TYPE_IP,  0)
32 DEFINE_FIELD  (OF_TCP_SRC,   OFPFW_TP_SRC,   ETH_TYPE_IP,  IP_TYPE_TCP)
33 DEFINE_FIELD  (OF_TCP_DST,   OFPFW_TP_DST,   ETH_TYPE_IP,  IP_TYPE_TCP)
34 DEFINE_FIELD  (OF_UDP_SRC,   OFPFW_TP_SRC,   ETH_TYPE_IP,  IP_TYPE_UDP)
35 DEFINE_FIELD  (OF_UDP_DST,   OFPFW_TP_DST,   ETH_TYPE_IP,  IP_TYPE_UDP)
36 DEFINE_FIELD  (OF_ICMP_TYPE, OFPFW_TP_SRC,   ETH_TYPE_IP,  IP_TYPE_ICMP)
37 DEFINE_FIELD  (OF_ICMP_CODE, OFPFW_TP_DST,   ETH_TYPE_IP,  IP_TYPE_ICMP)
38 DEFINE_FIELD  (OF_ARP_OP,    OFPFW_NW_PROTO, ETH_TYPE_ARP, 0)
39 DEFINE_FIELD_M(OF_ARP_SPA,   0,              ETH_TYPE_ARP, 0)
40 DEFINE_FIELD_M(OF_ARP_TPA,   0,              ETH_TYPE_ARP, 0)
41 DEFINE_FIELD  (NX_TUN_ID,    NXFW_TUN_ID,    0,            0)
42
43 DEFINE_FIELD_M(NX_REG0,      0,              0,            0)
44 #if FLOW_N_REGS >= 2
45 DEFINE_FIELD_M(NX_REG1,      0,              0,            0)
46 #endif
47 #if FLOW_N_REGS >= 3
48 DEFINE_FIELD_M(NX_REG2,      0,              0,            0)
49 #endif
50 #if FLOW_N_REGS >= 4
51 DEFINE_FIELD_M(NX_REG3,      0,              0,            0)
52 #endif
53 #if FLOW_N_REGS > 4
54 #error
55 #endif
56
57 #undef DEFINE_FIELD