~ubuntu-branches/ubuntu/wily/openvswitch/wily

« back to all changes in this revision

Viewing changes to lib/nx-match.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-08-10 11:35:15 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20150810113515-575vj06oq29emxsn
Tags: 2.4.0~git20150810.97bab95-0ubuntu1
* New upstream snapshot from 2.4 branch:
  - d/*: Align any relevant packaging changes with upstream.
* d/*: wrap-and-sort.
* d/openvswitch-{common,vswitch}.install: Correct install location for
  bash completion files.
* d/tests/openflow.py: Explicitly use ovs-testcontroller as provided
  by 2.4.0 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <netinet/in.h>
23
23
#include "compiler.h"
24
24
#include "flow.h"
 
25
#include "meta-flow.h"
25
26
#include "ofp-errors.h"
26
27
#include "openvswitch/types.h"
27
28
 
28
29
struct ds;
29
30
struct match;
30
 
struct mf_field;
31
 
struct mf_subfield;
32
31
struct ofpact_reg_move;
33
32
struct ofpact_reg_load;
34
33
struct ofpact_stack;
42
41
 * See include/openflow/nicira-ext.h for NXM specification.
43
42
 */
44
43
 
 
44
void mf_format_subfield(const struct mf_subfield *, struct ds *);
 
45
char *mf_parse_subfield__(struct mf_subfield *sf, const char **s)
 
46
    OVS_WARN_UNUSED_RESULT;
 
47
char *mf_parse_subfield(struct mf_subfield *, const char *s)
 
48
    OVS_WARN_UNUSED_RESULT;
 
49
 
45
50
enum ofperr nx_pull_match(struct ofpbuf *, unsigned int match_len,
46
51
                          struct match *,
47
52
                          ovs_be64 *cookie, ovs_be64 *cookie_mask);
50
55
                                ovs_be64 *cookie_mask);
51
56
enum ofperr oxm_pull_match(struct ofpbuf *, struct match *);
52
57
enum ofperr oxm_pull_match_loose(struct ofpbuf *, struct match *);
 
58
enum ofperr oxm_pull_field_array(const void *, size_t fields_len,
 
59
                                 struct field_array *);
53
60
int nx_put_match(struct ofpbuf *, const struct match *,
54
61
                 ovs_be64 cookie, ovs_be64 cookie_mask);
55
62
int oxm_put_match(struct ofpbuf *, const struct match *, enum ofp_version);
 
63
void oxm_format_field_array(struct ds *, const struct field_array *);
 
64
int oxm_put_field_array(struct ofpbuf *, const struct field_array *,
 
65
                        enum ofp_version version);
 
66
 
 
67
/* Decoding and encoding OXM/NXM headers (just a field ID) or entries (a field
 
68
 * ID followed by a value and possibly a mask). */
 
69
enum ofperr nx_pull_entry(struct ofpbuf *, const struct mf_field **,
 
70
                          union mf_value *value, union mf_value *mask);
 
71
enum ofperr nx_pull_header(struct ofpbuf *, const struct mf_field **,
 
72
                           bool *masked);
 
73
void nx_put_entry(struct ofpbuf *, enum mf_field_id, enum ofp_version,
 
74
                  const union mf_value *value, const union mf_value *mask);
 
75
void nx_put_header(struct ofpbuf *, enum mf_field_id, enum ofp_version,
 
76
                   bool masked);
 
77
 
 
78
/* NXM and OXM protocol headers values.
 
79
 *
 
80
 * These are often alternatives to nx_pull_entry/header() and
 
81
 * nx_put_entry/header() for decoding and encoding OXM/NXM.  In those cases,
 
82
 * the nx_*() functions should be preferred because they can support the 64-bit
 
83
 * "experimenter" OXM format (even though it is not yet implemented). */
 
84
uint32_t mf_nxm_header(enum mf_field_id);
 
85
const struct mf_field *mf_from_nxm_header(uint32_t nxm_header);
56
86
 
57
87
char *nx_match_to_string(const uint8_t *, unsigned int match_len);
58
88
char *oxm_match_to_string(const struct ofpbuf *, unsigned int match_len);
59
89
int nx_match_from_string(const char *, struct ofpbuf *);
60
90
int oxm_match_from_string(const char *, struct ofpbuf *);
61
91
 
 
92
void nx_format_field_name(enum mf_field_id, enum ofp_version, struct ds *);
 
93
 
62
94
char *nxm_parse_reg_move(struct ofpact_reg_move *, const char *)
63
 
    WARN_UNUSED_RESULT;
64
 
char *nxm_parse_reg_load(struct ofpact_reg_load *, const char *)
65
 
    WARN_UNUSED_RESULT;
 
95
    OVS_WARN_UNUSED_RESULT;
66
96
 
67
97
void nxm_format_reg_move(const struct ofpact_reg_move *, struct ds *);
68
 
void nxm_format_reg_load(const struct ofpact_reg_load *, struct ds *);
69
 
 
70
 
enum ofperr nxm_reg_move_from_openflow(const struct nx_action_reg_move *,
71
 
                                       struct ofpbuf *ofpacts);
72
 
enum ofperr nxm_reg_load_from_openflow(const struct nx_action_reg_load *,
73
 
                                       struct ofpbuf *ofpacts);
74
98
 
75
99
enum ofperr nxm_reg_move_check(const struct ofpact_reg_move *,
76
100
                               const struct flow *);
77
 
enum ofperr nxm_reg_load_check(const struct ofpact_reg_load *,
78
 
                               const struct flow *);
79
 
 
80
 
void nxm_reg_move_to_nxast(const struct ofpact_reg_move *,
81
 
                           struct ofpbuf *openflow);
82
 
void nxm_reg_load_to_nxast(const struct ofpact_reg_load *,
83
 
                           struct ofpbuf *openflow);
84
101
 
85
102
void nxm_execute_reg_move(const struct ofpact_reg_move *, struct flow *,
86
103
                          struct flow_wildcards *);
87
 
void nxm_execute_reg_load(const struct ofpact_reg_load *, struct flow *,
88
 
                          struct flow_wildcards *);
89
104
void nxm_reg_load(const struct mf_subfield *, uint64_t src_data,
90
105
                  struct flow *, struct flow_wildcards *);
91
106
 
92
107
char *nxm_parse_stack_action(struct ofpact_stack *, const char *)
93
 
    WARN_UNUSED_RESULT;
 
108
    OVS_WARN_UNUSED_RESULT;
94
109
 
95
110
void nxm_format_stack_push(const struct ofpact_stack *, struct ds *);
96
111
void nxm_format_stack_pop(const struct ofpact_stack *, struct ds *);
97
112
 
98
 
enum ofperr nxm_stack_push_from_openflow(const struct nx_action_stack *,
99
 
                                       struct ofpbuf *ofpacts);
100
 
enum ofperr nxm_stack_pop_from_openflow(const struct nx_action_stack *,
101
 
                                       struct ofpbuf *ofpacts);
102
113
enum ofperr nxm_stack_push_check(const struct ofpact_stack *,
103
114
                                 const  struct flow *);
104
115
enum ofperr nxm_stack_pop_check(const struct ofpact_stack *,
105
116
                               const struct flow *);
106
117
 
107
 
void nxm_stack_push_to_nxast(const struct ofpact_stack *,
108
 
                           struct ofpbuf *openflow);
109
 
void nxm_stack_pop_to_nxast(const struct ofpact_stack *,
110
 
                           struct ofpbuf *openflow);
111
 
 
112
118
void nxm_execute_stack_push(const struct ofpact_stack *,
113
119
                            const struct flow *, struct flow_wildcards *,
114
120
                            struct ofpbuf *);
116
122
                            struct flow *, struct flow_wildcards *,
117
123
                            struct ofpbuf *);
118
124
 
119
 
int nxm_field_bytes(uint32_t header);
120
 
int nxm_field_bits(uint32_t header);
 
125
ovs_be64 oxm_bitmap_from_mf_bitmap(const struct mf_bitmap *, enum ofp_version);
 
126
struct mf_bitmap oxm_bitmap_to_mf_bitmap(ovs_be64 oxm_bitmap,
 
127
                                         enum ofp_version);
 
128
struct mf_bitmap oxm_writable_fields(void);
 
129
struct mf_bitmap oxm_matchable_fields(void);
 
130
struct mf_bitmap oxm_maskable_fields(void);
121
131
 
122
132
/* Dealing with the 'ofs_nbits' members in several Nicira extensions. */
123
133