~james-page/ubuntu/saucy/openvswitch/1.12-snapshot

« back to all changes in this revision

Viewing changes to lib/odp-util.h

  • Committer: James Page
  • Date: 2013-08-21 10:16:57 UTC
  • mfrom: (1.1.20)
  • Revision ID: james.page@canonical.com-20130821101657-3o0z0qeiv5zkwlzi
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
struct ds;
30
30
struct flow;
31
31
struct flow_tnl;
 
32
struct flow_wildcards;
32
33
struct nlattr;
33
34
struct ofpbuf;
34
35
struct simap;
35
36
 
36
 
#define OVSP_NONE UINT32_MAX
 
37
#define ODPP_LOCAL ODP_PORT_C(OVSP_LOCAL)
 
38
#define ODPP_NONE  ODP_PORT_C(UINT32_MAX)
37
39
 
38
40
void format_odp_actions(struct ds *, const struct nlattr *odp_actions,
39
41
                        size_t actions_len);
87
89
    uint32_t keybuf[DIV_ROUND_UP(ODPUTIL_FLOW_KEY_BYTES, 4)];
88
90
};
89
91
 
 
92
enum odp_key_fitness odp_tun_key_from_attr(const struct nlattr *,
 
93
                                           struct flow_tnl *);
 
94
 
 
95
void odp_flow_format(const struct nlattr *key, size_t key_len,
 
96
                     const struct nlattr *mask, size_t mask_len,
 
97
                     struct ds *);
90
98
void odp_flow_key_format(const struct nlattr *, size_t, struct ds *);
91
 
int odp_flow_key_from_string(const char *s, const struct simap *port_names,
92
 
                             struct ofpbuf *);
 
99
int odp_flow_from_string(const char *s,
 
100
                         const struct simap *port_names,
 
101
                         struct ofpbuf *, struct ofpbuf *);
93
102
 
94
103
void odp_flow_key_from_flow(struct ofpbuf *, const struct flow *,
95
 
                            uint32_t odp_in_port);
 
104
                            odp_port_t odp_in_port);
 
105
void odp_flow_key_from_mask(struct ofpbuf *, const struct flow *mask,
 
106
                            const struct flow *flow, uint32_t odp_in_port);
96
107
 
97
108
uint32_t odp_flow_key_hash(const struct nlattr *, size_t);
98
109
 
116
127
void commit_odp_tunnel_action(const struct flow *, struct flow *base,
117
128
                              struct ofpbuf *odp_actions);
118
129
void commit_odp_actions(const struct flow *, struct flow *base,
119
 
                        struct ofpbuf *odp_actions);
 
130
                        struct ofpbuf *odp_actions,
 
131
                        struct flow_wildcards *wc);
120
132
 
121
133
/* ofproto-dpif interface.
122
134
 *
127
139
 
128
140
enum user_action_cookie_type {
129
141
    USER_ACTION_COOKIE_UNSPEC,
130
 
    USER_ACTION_COOKIE_SFLOW,        /* Packet for sFlow sampling. */
131
 
    USER_ACTION_COOKIE_SLOW_PATH     /* Userspace must process this flow. */
 
142
    USER_ACTION_COOKIE_SFLOW,        /* Packet for per-bridge sFlow sampling. */
 
143
    USER_ACTION_COOKIE_SLOW_PATH,    /* Userspace must process this flow. */
 
144
    USER_ACTION_COOKIE_FLOW_SAMPLE,  /* Packet for per-flow sampling. */
 
145
    USER_ACTION_COOKIE_IPFIX,        /* Packet for per-bridge IPFIX sampling. */
132
146
};
133
147
 
134
148
/* user_action_cookie is passed as argument to OVS_ACTION_ATTR_USERSPACE.
147
161
        uint16_t unused;
148
162
        uint32_t reason;        /* enum slow_path_reason. */
149
163
    } slow_path;
 
164
 
 
165
    struct {
 
166
        uint16_t type;          /* USER_ACTION_COOKIE_FLOW_SAMPLE. */
 
167
        uint16_t probability;   /* Sampling probability. */
 
168
        uint32_t collector_set_id; /* ID of IPFIX collector set. */
 
169
        uint32_t obs_domain_id; /* Observation Domain ID. */
 
170
        uint32_t obs_point_id;  /* Observation Point ID. */
 
171
    } flow_sample;
 
172
 
 
173
    struct {
 
174
        uint16_t type;          /* USER_ACTION_COOKIE_IPFIX. */
 
175
    } ipfix;
150
176
};
151
 
BUILD_ASSERT_DECL(sizeof(union user_action_cookie) == 8);
 
177
BUILD_ASSERT_DECL(sizeof(union user_action_cookie) == 16);
152
178
 
153
179
size_t odp_put_userspace_action(uint32_t pid,
154
 
                                const union user_action_cookie *,
 
180
                                const void *userdata, size_t userdata_size,
155
181
                                struct ofpbuf *odp_actions);
156
182
void odp_put_tunnel_action(const struct flow_tnl *tunnel,
157
183
                           struct ofpbuf *odp_actions);
160
186
 
161
187
/* Reasons why a subfacet might not be fast-pathable. */
162
188
enum slow_path_reason {
163
 
    /* These reasons are mutually exclusive. */
164
 
    SLOW_CFM = 1 << 0,          /* CFM packets need per-packet processing. */
165
 
    SLOW_LACP = 1 << 1,         /* LACP packets need per-packet processing. */
166
 
    SLOW_STP = 1 << 2,          /* STP packets need per-packet processing. */
167
 
    SLOW_IN_BAND = 1 << 3,      /* In-band control needs every packet. */
168
 
 
169
 
    /* Mutually exclusive with SLOW_CFM, SLOW_LACP, SLOW_STP.
170
 
     * Could possibly appear with SLOW_IN_BAND. */
171
 
    SLOW_CONTROLLER = 1 << 4,   /* Packets must go to OpenFlow controller. */
172
 
 
173
 
    /* This can appear on its own, or, theoretically at least, along with any
174
 
     * other combination of reasons. */
175
 
    SLOW_MATCH = 1 << 5,        /* Datapath can't match specifically enough. */
 
189
    SLOW_CFM = 1,               /* CFM packets need per-packet processing. */
 
190
    SLOW_LACP,                  /* LACP packets need per-packet processing. */
 
191
    SLOW_STP,                   /* STP packets need per-packet processing. */
 
192
    SLOW_BFD,                   /* BFD packets need per-packet processing. */
 
193
    SLOW_CONTROLLER,            /* Packets must go to OpenFlow controller. */
 
194
    __SLOW_MAX
176
195
};
177
196
 
178
197
#endif /* odp-util.h */