]>
Commit | Line | Data |
---|---|---|
09246b99 BP |
1 | /* |
2 | * Copyright (c) 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 | #ifndef NX_MATCH_H | |
18 | #define NX_MATCH_H 1 | |
19 | ||
20 | #include <stdint.h> | |
21 | ||
22 | struct cls_rule; | |
b6c9e612 | 23 | struct flow; |
09246b99 | 24 | struct ofpbuf; |
b6c9e612 BP |
25 | struct nx_action_reg_load; |
26 | struct nx_action_reg_move; | |
09246b99 BP |
27 | |
28 | /* Nicira Extended Match (NXM) flexible flow match helper functions. | |
29 | * | |
30 | * See include/openflow/nicira-ext.h for NXM specification. | |
31 | */ | |
32 | ||
33 | int nx_pull_match(struct ofpbuf *, unsigned int match_len, uint16_t priority, | |
34 | struct cls_rule *); | |
35 | int nx_put_match(struct ofpbuf *, const struct cls_rule *); | |
36 | ||
37 | char *nx_match_to_string(const uint8_t *, unsigned int match_len); | |
38 | int nx_match_from_string(const char *, struct ofpbuf *); | |
39 | ||
b6c9e612 BP |
40 | int nxm_check_reg_move(const struct nx_action_reg_move *, const struct flow *); |
41 | int nxm_check_reg_load(const struct nx_action_reg_load *, const struct flow *); | |
42 | ||
43 | void nxm_execute_reg_move(const struct nx_action_reg_move *, struct flow *); | |
44 | void nxm_execute_reg_load(const struct nx_action_reg_load *, struct flow *); | |
45 | ||
09246b99 BP |
46 | /* Upper bound on the length of an nx_match. The longest nx_match (assuming |
47 | * we implement 4 registers) would be: | |
48 | * | |
49 | * header value mask total | |
50 | * ------ ----- ---- ----- | |
51 | * NXM_OF_IN_PORT 4 2 -- 6 | |
52 | * NXM_OF_ETH_DST_W 4 6 6 16 | |
53 | * NXM_OF_ETH_SRC 4 6 -- 10 | |
54 | * NXM_OF_ETH_TYPE 4 2 -- 6 | |
55 | * NXM_OF_VLAN_TCI 4 2 2 8 | |
56 | * NXM_OF_IP_TOS 4 1 -- 5 | |
57 | * NXM_OF_IP_PROTO 4 2 -- 6 | |
58 | * NXM_OF_IP_SRC_W 4 4 4 12 | |
59 | * NXM_OF_IP_DST_W 4 4 4 12 | |
60 | * NXM_OF_TCP_SRC 4 2 -- 6 | |
61 | * NXM_OF_TCP_DST 4 2 -- 6 | |
62 | * NXM_NX_REG_W(0) 4 4 4 12 | |
63 | * NXM_NX_REG_W(1) 4 4 4 12 | |
64 | * NXM_NX_REG_W(2) 4 4 4 12 | |
65 | * NXM_NX_REG_W(3) 4 4 4 12 | |
66 | * NXM_NX_TUN_ID_W 4 8 8 20 | |
67 | * ------------------------------------------- | |
68 | * total 161 | |
69 | * | |
70 | * So this value is conservative. | |
71 | */ | |
72 | #define NXM_MAX_LEN 192 | |
73 | ||
2e4f5fcf BP |
74 | /* This is my guess at the length of a "typical" nx_match, for use in |
75 | * predicting space requirements. */ | |
76 | #define NXM_TYPICAL_LEN 64 | |
77 | ||
09246b99 | 78 | #endif /* nx-match.h */ |