2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-01 23:05:29 +00:00

flow: Get rid of flow_t typedef.

When userspace and the kernel were using the same structure for flows,
flow_t was a useful way to indicate that a structure was really a userspace
flow instead of a kernel one, but now it's better to just write "struct
flow" for consistency, since OVS doesn't use typedefs for structs
elsewhere.

Acked-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
Ben Pfaff
2010-09-03 11:30:02 -07:00
parent 14608a1539
commit ae412e7dd8
19 changed files with 121 additions and 119 deletions

View File

@@ -25,17 +25,18 @@
const struct cls_field cls_fields[CLS_N_FIELDS + 1] = {
#define CLS_FIELD(WILDCARDS, MEMBER, NAME) \
{ offsetof(flow_t, MEMBER), \
sizeof ((flow_t *)0)->MEMBER, \
{ offsetof(struct flow, MEMBER), \
sizeof ((struct flow *)0)->MEMBER, \
WILDCARDS, \
#NAME },
CLS_FIELDS
#undef CLS_FIELD
{ sizeof(flow_t), 0, 0, "exact" },
{ sizeof(struct flow), 0, 0, "exact" },
};
static uint32_t hash_fields(const flow_t *, int table_idx);
static bool equal_fields(const flow_t *, const flow_t *, int table_idx);
static uint32_t hash_fields(const struct flow *, int table_idx);
static bool equal_fields(const struct flow *, const struct flow *,
int table_idx);
static int table_idx_from_wildcards(uint32_t wildcards);
static struct cls_rule *table_insert(struct hmap *, struct cls_rule *);
@@ -46,7 +47,7 @@ static struct cls_bucket *find_bucket(struct hmap *, size_t hash,
static struct cls_rule *search_table(const struct hmap *table, int field_idx,
const struct cls_rule *);
static struct cls_rule *search_exact_table(const struct classifier *,
size_t hash, const flow_t *);
size_t hash, const struct flow *);
static bool rules_match_1wild(const struct cls_rule *fixed,
const struct cls_rule *wild, int field_idx);
static bool rules_match_2wild(const struct cls_rule *wild1,
@@ -55,7 +56,7 @@ static bool rules_match_2wild(const struct cls_rule *wild1,
/* Converts the flow in 'flow' into a cls_rule in 'rule', with the given
* 'wildcards' and 'priority'.*/
void
cls_rule_from_flow(const flow_t *flow, uint32_t wildcards,
cls_rule_from_flow(const struct flow *flow, uint32_t wildcards,
unsigned int priority, struct cls_rule *rule)
{
rule->flow = *flow;
@@ -280,7 +281,7 @@ classifier_remove(struct classifier *cls, struct cls_rule *rule)
* rules added more recently take priority over rules added less recently, but
* this is subject to change and should not be depended upon.) */
struct cls_rule *
classifier_lookup(const struct classifier *cls, const flow_t *flow)
classifier_lookup(const struct classifier *cls, const struct flow *flow)
{
struct cls_rule *rule = classifier_lookup_exact(cls, flow);
if (!rule) {
@@ -290,7 +291,7 @@ classifier_lookup(const struct classifier *cls, const flow_t *flow)
}
struct cls_rule *
classifier_lookup_exact(const struct classifier *cls, const flow_t *flow)
classifier_lookup_exact(const struct classifier *cls, const struct flow *flow)
{
return (!hmap_is_empty(&cls->exact_table)
? search_exact_table(cls, flow_hash(flow, 0), flow)
@@ -298,7 +299,7 @@ classifier_lookup_exact(const struct classifier *cls, const flow_t *flow)
}
struct cls_rule *
classifier_lookup_wild(const struct classifier *cls, const flow_t *flow)
classifier_lookup_wild(const struct classifier *cls, const struct flow *flow)
{
struct cls_rule *best = NULL;
if (cls->n_rules > hmap_count(&cls->exact_table)) {
@@ -318,7 +319,7 @@ classifier_lookup_wild(const struct classifier *cls, const flow_t *flow)
struct cls_rule *
classifier_find_rule_exactly(const struct classifier *cls,
const flow_t *target, uint32_t wildcards,
const struct flow *target, uint32_t wildcards,
unsigned int priority)
{
struct cls_bucket *bucket;
@@ -356,7 +357,7 @@ classifier_find_rule_exactly(const struct classifier *cls,
* Two rules are considered overlapping if a packet could match both. */
bool
classifier_rule_overlaps(const struct classifier *cls,
const flow_t *target, uint32_t wildcards,
const struct flow *target, uint32_t wildcards,
unsigned int priority)
{
struct cls_rule target_rule;
@@ -506,7 +507,7 @@ classifier_for_each(const struct classifier *cls, int include,
}
static struct cls_bucket *create_bucket(struct hmap *, size_t hash,
const flow_t *fixed);
const struct flow *fixed);
static struct cls_rule *bucket_insert(struct cls_bucket *, struct cls_rule *);
static inline bool equal_bytes(const void *, const void *, size_t n);
@@ -515,7 +516,7 @@ static inline bool equal_bytes(const void *, const void *, size_t n);
* (CLS_F_IDX_*) are less than 'table_idx'. (If 'table_idx' is
* CLS_F_IDX_EXACT, hashes all the fields in 'flow'). */
static uint32_t
hash_fields(const flow_t *flow, int table_idx)
hash_fields(const struct flow *flow, int table_idx)
{
/* I just know I'm going to hell for writing code this way.
*
@@ -581,7 +582,7 @@ finish:
*
* Returns true if all the compared fields are equal, false otherwise. */
static bool
equal_fields(const flow_t *a, const flow_t *b, int table_idx)
equal_fields(const struct flow *a, const struct flow *b, int table_idx)
{
/* XXX The generated code could be better here. */
#define CLS_FIELD(WILDCARDS, MEMBER, NAME) \
@@ -685,7 +686,7 @@ find_bucket(struct hmap *table, size_t hash, const struct cls_rule *rule)
/* Creates a bucket and inserts it in 'table' with the given 'hash' and 'fixed'
* values. Returns the new bucket. */
static struct cls_bucket *
create_bucket(struct hmap *table, size_t hash, const flow_t *fixed)
create_bucket(struct hmap *table, size_t hash, const struct flow *fixed)
{
struct cls_bucket *bucket = xmalloc(sizeof *bucket);
list_init(&bucket->rules);
@@ -746,7 +747,7 @@ read_uint32(const void *p)
* The compared field is the one with wildcard bit or bits 'field_wc', offset
* 'rule_ofs' within cls_rule's "fields" member, and length 'len', in bytes. */
static inline bool ALWAYS_INLINE
field_matches(const flow_t *a_, const flow_t *b_,
field_matches(const struct flow *a_, const struct flow *b_,
uint32_t wildcards, uint32_t nw_src_mask, uint32_t nw_dst_mask,
uint32_t field_wc, int ofs, int len)
{
@@ -787,7 +788,7 @@ rules_match(const struct cls_rule *a, const struct cls_rule *b,
case CLS_F_IDX_##NAME: \
if (!field_matches(&a->flow, &b->flow, \
wildcards, nw_src_mask, nw_dst_mask, \
WILDCARDS, offsetof(flow_t, MEMBER), \
WILDCARDS, offsetof(struct flow, MEMBER), \
sizeof a->flow.MEMBER)) { \
return false; \
} \
@@ -884,7 +885,7 @@ search_table(const struct hmap *table, int field_idx,
static struct cls_rule *
search_exact_table(const struct classifier *cls, size_t hash,
const flow_t *target)
const struct flow *target)
{
struct cls_rule *rule;

View File

@@ -56,7 +56,7 @@
* performance (see above). To adjust the ordering, change the order of the
* lines. */
#define CLS_FIELDS \
/* flow_t all-caps */ \
/* struct flow all-caps */ \
/* wildcard bit(s) member name name */ \
/* ----------------- ----------- -------- */ \
CLS_FIELD(OFPFW_IN_PORT, in_port, IN_PORT) \
@@ -86,7 +86,7 @@ enum {
/* Field information. */
struct cls_field {
int ofs; /* Offset in flow_t. */
int ofs; /* Offset in struct flow. */
int len; /* Length in bytes. */
uint32_t wildcards; /* OFPFW_* bit or bits for this field. */
const char *name; /* Name (for debugging). */
@@ -104,7 +104,7 @@ struct classifier {
struct cls_bucket {
struct hmap_node hmap_node; /* Within struct classifier 'tables'. */
struct list rules; /* In order from highest to lowest priority. */
flow_t fixed; /* Values for fixed fields. */
struct flow fixed; /* Values for fixed fields. */
};
/* A flow classification rule.
@@ -117,13 +117,13 @@ struct cls_rule {
struct list list; /* Within struct cls_bucket 'rules'. */
struct hmap_node hmap; /* Within struct classifier 'exact_table'. */
} node;
flow_t flow; /* All field values. */
struct flow flow; /* All field values. */
struct flow_wildcards wc; /* Wildcards for fields. */
unsigned int priority; /* Larger numbers are higher priorities. */
unsigned int table_idx; /* Index into struct classifier 'tables'. */
};
void cls_rule_from_flow(const flow_t *, uint32_t wildcards,
void cls_rule_from_flow(const struct flow *, uint32_t wildcards,
unsigned int priority, struct cls_rule *);
void cls_rule_from_match(const struct ofp_match *, unsigned int priority,
bool tun_id_from_cookie, uint64_t cookie,
@@ -143,12 +143,13 @@ int classifier_count_exact(const struct classifier *);
struct cls_rule *classifier_insert(struct classifier *, struct cls_rule *);
void classifier_insert_exact(struct classifier *, struct cls_rule *);
void classifier_remove(struct classifier *, struct cls_rule *);
struct cls_rule *classifier_lookup(const struct classifier *, const flow_t *);
struct cls_rule *classifier_lookup(const struct classifier *,
const struct flow *);
struct cls_rule *classifier_lookup_wild(const struct classifier *,
const flow_t *);
const struct flow *);
struct cls_rule *classifier_lookup_exact(const struct classifier *,
const flow_t *);
bool classifier_rule_overlaps(const struct classifier *, const flow_t *,
const struct flow *);
bool classifier_rule_overlaps(const struct classifier *, const struct flow *,
uint32_t wildcards, unsigned int priority);
typedef void cls_cb_func(struct cls_rule *, void *aux);
@@ -164,7 +165,7 @@ void classifier_for_each_match(const struct classifier *,
const struct cls_rule *,
int include, cls_cb_func *, void *aux);
struct cls_rule *classifier_find_rule_exactly(const struct classifier *,
const flow_t *target,
const struct flow *target,
uint32_t wildcards,
unsigned int priority);

View File

@@ -942,7 +942,7 @@ do_receive_msg(struct dhclient *cli, struct dhcp_msg *msg)
for (; cli->received < 50; cli->received++) {
const struct ip_header *ip;
const struct dhcp_header *dhcp;
flow_t flow;
struct flow flow;
int error;
ofpbuf_clear(&b);

View File

@@ -835,7 +835,7 @@ dpif_netdev_execute(struct dpif *dpif,
struct dp_netdev *dp = get_dp_netdev(dpif);
struct ofpbuf copy;
bool mutates;
flow_t key;
struct flow key;
int error;
if (packet->size < ETH_HEADER_LEN || packet->size > UINT16_MAX) {

View File

@@ -78,7 +78,7 @@ pull_icmp(struct ofpbuf *packet)
}
static void
parse_vlan(struct ofpbuf *b, flow_t *flow)
parse_vlan(struct ofpbuf *b, struct flow *flow)
{
struct qtag_prefix {
uint16_t eth_type; /* ETH_TYPE_VLAN */
@@ -139,7 +139,7 @@ parse_ethertype(struct ofpbuf *b)
*/
int
flow_extract(struct ofpbuf *packet, uint32_t tun_id, uint16_t in_port,
flow_t *flow)
struct flow *flow)
{
struct ofpbuf b = *packet;
struct eth_header *eth;
@@ -235,7 +235,7 @@ flow_extract(struct ofpbuf *packet, uint32_t tun_id, uint16_t in_port,
* arguments must have been initialized through a call to flow_extract().
*/
void
flow_extract_stats(const flow_t *flow, struct ofpbuf *packet,
flow_extract_stats(const struct flow *flow, struct ofpbuf *packet,
struct odp_flow_stats *stats)
{
memset(stats, '\0', sizeof(*stats));
@@ -254,8 +254,8 @@ flow_extract_stats(const flow_t *flow, struct ofpbuf *packet,
/* Extract 'flow' with 'wildcards' into the OpenFlow match structure
* 'match'. */
void
flow_to_match(const flow_t *flow, uint32_t wildcards, bool tun_id_from_cookie,
struct ofp_match *match)
flow_to_match(const struct flow *flow, uint32_t wildcards,
bool tun_id_from_cookie, struct ofp_match *match)
{
if (!tun_id_from_cookie) {
wildcards &= OFPFW_ALL;
@@ -281,7 +281,7 @@ flow_to_match(const flow_t *flow, uint32_t wildcards, bool tun_id_from_cookie,
void
flow_from_match(const struct ofp_match *match, bool tun_id_from_cookie,
uint64_t cookie, flow_t *flow, uint32_t *flow_wildcards)
uint64_t cookie, struct flow *flow, uint32_t *flow_wildcards)
{
uint32_t wildcards = ntohl(match->wildcards);
@@ -310,7 +310,7 @@ flow_from_match(const struct ofp_match *match, bool tun_id_from_cookie,
}
char *
flow_to_string(const flow_t *flow)
flow_to_string(const struct flow *flow)
{
struct ds ds = DS_EMPTY_INITIALIZER;
flow_format(&ds, flow);
@@ -318,7 +318,7 @@ flow_to_string(const flow_t *flow)
}
void
flow_format(struct ds *ds, const flow_t *flow)
flow_format(struct ds *ds, const struct flow *flow)
{
ds_put_format(ds, "tunnel%08"PRIx32":in_port%04"PRIx16
":vlan%"PRIu16":pcp%"PRIu8
@@ -344,7 +344,7 @@ flow_format(struct ds *ds, const flow_t *flow)
}
void
flow_print(FILE *stream, const flow_t *flow)
flow_print(FILE *stream, const struct flow *flow)
{
char *s = flow_to_string(flow);
fputs(s, stream);

View File

@@ -31,7 +31,6 @@ struct ds;
struct ofp_match;
struct ofpbuf;
typedef struct flow flow_t;
struct flow {
uint32_t tun_id; /* Encapsulating tunnel ID. */
uint32_t nw_src; /* IP source address. */
@@ -56,39 +55,40 @@ BUILD_ASSERT_DECL(offsetof(struct flow, nw_tos) == FLOW_SIG_SIZE - 1);
BUILD_ASSERT_DECL(sizeof(((struct flow *)0)->nw_tos) == 1);
BUILD_ASSERT_DECL(sizeof(struct flow) == FLOW_SIG_SIZE + FLOW_PAD_SIZE);
int flow_extract(struct ofpbuf *, uint32_t tun_id, uint16_t in_port, flow_t *);
void flow_extract_stats(const flow_t *flow, struct ofpbuf *packet,
int flow_extract(struct ofpbuf *, uint32_t tun_id, uint16_t in_port,
struct flow *);
void flow_extract_stats(const struct flow *flow, struct ofpbuf *packet,
struct odp_flow_stats *stats);
void flow_to_match(const flow_t *, uint32_t wildcards, bool tun_id_cookie,
void flow_to_match(const struct flow *, uint32_t wildcards, bool tun_id_cookie,
struct ofp_match *);
void flow_from_match(const struct ofp_match *, bool tun_id_from_cookie,
uint64_t cookie, flow_t *, uint32_t *wildcards);
char *flow_to_string(const flow_t *);
void flow_format(struct ds *, const flow_t *);
void flow_print(FILE *, const flow_t *);
static inline int flow_compare(const flow_t *, const flow_t *);
static inline bool flow_equal(const flow_t *, const flow_t *);
static inline size_t flow_hash(const flow_t *, uint32_t basis);
uint64_t cookie, struct flow *, uint32_t *wildcards);
char *flow_to_string(const struct flow *);
void flow_format(struct ds *, const struct flow *);
void flow_print(FILE *, const struct flow *);
static inline int flow_compare(const struct flow *, const struct flow *);
static inline bool flow_equal(const struct flow *, const struct flow *);
static inline size_t flow_hash(const struct flow *, uint32_t basis);
static inline int
flow_compare(const flow_t *a, const flow_t *b)
flow_compare(const struct flow *a, const struct flow *b)
{
return memcmp(a, b, FLOW_SIG_SIZE);
}
static inline bool
flow_equal(const flow_t *a, const flow_t *b)
flow_equal(const struct flow *a, const struct flow *b)
{
return !flow_compare(a, b);
}
static inline size_t
flow_hash(const flow_t *flow, uint32_t basis)
flow_hash(const struct flow *flow, uint32_t basis)
{
return hash_bytes(flow, FLOW_SIG_SIZE, basis);
}
/* Information on wildcards for a flow, as a supplement to flow_t. */
/* Information on wildcards for a flow, as a supplement to struct flow. */
struct flow_wildcards {
uint32_t wildcards; /* enum ofp_flow_wildcards (in host order). */
uint32_t nw_src_mask; /* 1-bit in each significant nw_src bit. */

View File

@@ -305,7 +305,7 @@ process_switch_features(struct lswitch *sw, struct rconn *rconn OVS_UNUSED,
}
static uint16_t
lswitch_choose_destination(struct lswitch *sw, const flow_t *flow)
lswitch_choose_destination(struct lswitch *sw, const struct flow *flow)
{
uint16_t out_port;
@@ -372,7 +372,7 @@ process_packet_in(struct lswitch *sw, struct rconn *rconn, void *opi_)
size_t pkt_ofs, pkt_len;
struct ofpbuf pkt;
flow_t flow;
struct flow flow;
/* Ignore packets sent via output to OFPP_CONTROLLER. This library never
* uses such an action. You never know what experiments might be going on,

View File

@@ -130,7 +130,7 @@ ofp_packet_in(struct ds *string, const void *oh, size_t len, int verbosity)
ds_put_char(string, '\n');
if (verbosity > 0) {
flow_t flow;
struct flow flow;
struct ofpbuf packet;
struct ofp_match match;
packet.data = (void *) op->data;

View File

@@ -132,7 +132,7 @@ update_openflow_length(struct ofpbuf *buffer)
}
struct ofpbuf *
make_flow_mod(uint16_t command, const flow_t *flow, size_t actions_len)
make_flow_mod(uint16_t command, const struct flow *flow, size_t actions_len)
{
struct ofp_flow_mod *ofm;
size_t size = sizeof *ofm + actions_len;
@@ -161,7 +161,7 @@ make_flow_mod(uint16_t command, const flow_t *flow, size_t actions_len)
}
struct ofpbuf *
make_add_flow(const flow_t *flow, uint32_t buffer_id,
make_add_flow(const struct flow *flow, uint32_t buffer_id,
uint16_t idle_timeout, size_t actions_len)
{
struct ofpbuf *out = make_flow_mod(OFPFC_ADD, flow, actions_len);
@@ -173,7 +173,7 @@ make_add_flow(const flow_t *flow, uint32_t buffer_id,
}
struct ofpbuf *
make_del_flow(const flow_t *flow)
make_del_flow(const struct flow *flow)
{
struct ofpbuf *out = make_flow_mod(OFPFC_DELETE_STRICT, flow, 0);
struct ofp_flow_mod *ofm = out->data;
@@ -182,7 +182,7 @@ make_del_flow(const flow_t *flow)
}
struct ofpbuf *
make_add_simple_flow(const flow_t *flow,
make_add_simple_flow(const struct flow *flow,
uint32_t buffer_id, uint16_t out_port,
uint16_t idle_timeout)
{

View File

@@ -34,12 +34,12 @@ void *put_openflow(size_t openflow_len, uint8_t type, struct ofpbuf *);
void *put_openflow_xid(size_t openflow_len, uint8_t type, uint32_t xid,
struct ofpbuf *);
void update_openflow_length(struct ofpbuf *);
struct ofpbuf *make_flow_mod(uint16_t command, const flow_t *,
struct ofpbuf *make_flow_mod(uint16_t command, const struct flow *,
size_t actions_len);
struct ofpbuf *make_add_flow(const flow_t *, uint32_t buffer_id,
struct ofpbuf *make_add_flow(const struct flow *, uint32_t buffer_id,
uint16_t max_idle, size_t actions_len);
struct ofpbuf *make_del_flow(const flow_t *);
struct ofpbuf *make_add_simple_flow(const flow_t *,
struct ofpbuf *make_del_flow(const struct flow *);
struct ofpbuf *make_add_simple_flow(const struct flow *,
uint32_t buffer_id, uint16_t out_port,
uint16_t max_idle);
struct ofpbuf *make_packet_in(uint32_t buffer_id, uint16_t in_port,

View File

@@ -257,7 +257,7 @@ static void
fail_open_recover(struct fail_open *fo)
{
if (fail_open_is_active(fo)) {
flow_t flow;
struct flow flow;
VLOG_WARN("No longer in fail-open mode");
fo->last_disconn_secs = 0;
@@ -283,7 +283,7 @@ fail_open_flushed(struct fail_open *fo)
bool open = disconn_secs >= trigger_duration(fo);
if (open) {
union ofp_action action;
flow_t flow;
struct flow flow;
/* Set up a flow that matches every packet and directs them to
* OFPP_NORMAL. */

View File

@@ -224,7 +224,7 @@ enum {
};
struct in_band_rule {
flow_t flow;
struct flow flow;
uint32_t wildcards;
unsigned int priority;
};
@@ -396,7 +396,7 @@ in_band_status_cb(struct status_reply *sr, void *in_band_)
/* Returns true if 'packet' should be sent to the local port regardless
* of the flow table. */
bool
in_band_msg_in_hook(struct in_band *in_band, const flow_t *flow,
in_band_msg_in_hook(struct in_band *in_band, const struct flow *flow,
const struct ofpbuf *packet)
{
if (!in_band) {
@@ -431,7 +431,7 @@ in_band_msg_in_hook(struct in_band *in_band, const flow_t *flow,
/* Returns true if the rule that would match 'flow' with 'actions' is
* allowed to be set up in the datapath. */
bool
in_band_rule_check(struct in_band *in_band, const flow_t *flow,
in_band_rule_check(struct in_band *in_band, const struct flow *flow,
const struct odp_actions *actions)
{
if (!in_band) {

View File

@@ -37,9 +37,9 @@ void in_band_set_remotes(struct in_band *,
void in_band_run(struct in_band *);
void in_band_wait(struct in_band *);
bool in_band_msg_in_hook(struct in_band *, const flow_t *,
bool in_band_msg_in_hook(struct in_band *, const struct flow *,
const struct ofpbuf *packet);
bool in_band_rule_check(struct in_band *, const flow_t *,
bool in_band_rule_check(struct in_band *, const struct flow *,
const struct odp_actions *);
void in_band_flushed(struct in_band *);

View File

@@ -488,8 +488,8 @@ ofproto_sflow_received(struct ofproto_sflow *os, struct odp_msg *msg)
const union odp_action *actions;
struct ofpbuf payload;
size_t n_actions, n_outputs;
struct flow flow;
size_t min_size;
flow_t flow;
size_t i;
/* Get odp_sflow_sample_header. */

View File

@@ -81,7 +81,7 @@ static void ofport_free(struct ofport *);
static void hton_ofp_phy_port(struct ofp_phy_port *);
static int xlate_actions(const union ofp_action *in, size_t n_in,
const flow_t *flow, struct ofproto *ofproto,
const struct flow *, struct ofproto *,
const struct ofpbuf *packet,
struct odp_actions *out, tag_type *tags,
bool *may_set_up_flow, uint16_t *nf_output_iface);
@@ -1278,7 +1278,7 @@ ofproto_port_del(struct ofproto *ofproto, uint16_t odp_port)
}
int
ofproto_send_packet(struct ofproto *p, const flow_t *flow,
ofproto_send_packet(struct ofproto *p, const struct flow *flow,
const union ofp_action *actions, size_t n_actions,
const struct ofpbuf *packet)
{
@@ -1298,8 +1298,8 @@ ofproto_send_packet(struct ofproto *p, const flow_t *flow,
}
void
ofproto_add_flow(struct ofproto *p,
const flow_t *flow, uint32_t wildcards, unsigned int priority,
ofproto_add_flow(struct ofproto *p, const struct flow *flow,
uint32_t wildcards, unsigned int priority,
const union ofp_action *actions, size_t n_actions,
int idle_timeout)
{
@@ -1312,7 +1312,7 @@ ofproto_add_flow(struct ofproto *p,
}
void
ofproto_delete_flow(struct ofproto *ofproto, const flow_t *flow,
ofproto_delete_flow(struct ofproto *ofproto, const struct flow *flow,
uint32_t wildcards, unsigned int priority)
{
struct rule *rule;
@@ -1967,7 +1967,7 @@ execute_odp_actions(struct ofproto *ofproto, uint16_t in_port,
* Takes ownership of 'packet'. */
static void
rule_execute(struct ofproto *ofproto, struct rule *rule,
struct ofpbuf *packet, const flow_t *flow)
struct ofpbuf *packet, const struct flow *flow)
{
const union odp_action *actions;
struct odp_flow_stats stats;
@@ -2026,7 +2026,7 @@ rule_insert(struct ofproto *p, struct rule *rule, struct ofpbuf *packet,
/* Send the packet and credit it to the rule. */
if (packet) {
flow_t flow;
struct flow flow;
flow_extract(packet, 0, in_port, &flow);
rule_execute(p, rule, packet, &flow);
}
@@ -2048,7 +2048,7 @@ rule_insert(struct ofproto *p, struct rule *rule, struct ofpbuf *packet,
static struct rule *
rule_create_subrule(struct ofproto *ofproto, struct rule *rule,
const flow_t *flow)
const struct flow *flow)
{
struct rule *subrule = rule_create(ofproto, rule, NULL, 0,
rule->idle_timeout, rule->hard_timeout,
@@ -2439,7 +2439,7 @@ add_controller_action(struct odp_actions *actions, uint16_t max_len)
struct action_xlate_ctx {
/* Input. */
flow_t flow; /* Flow to which these actions correspond. */
struct flow flow; /* Flow to which these actions correspond. */
int recurse; /* Recursion level, via xlate_table_action. */
struct ofproto *ofproto;
const struct ofpbuf *packet; /* The packet corresponding to 'flow', or a
@@ -2484,7 +2484,7 @@ add_output_action(struct action_xlate_ctx *ctx, uint16_t port)
}
static struct rule *
lookup_valid_rule(struct ofproto *ofproto, const flow_t *flow)
lookup_valid_rule(struct ofproto *ofproto, const struct flow *flow)
{
struct rule *rule;
rule = rule_from_cls_rule(classifier_lookup(&ofproto->cls, flow));
@@ -2830,7 +2830,7 @@ do_xlate_actions(const union ofp_action *in, size_t n_in,
static int
xlate_actions(const union ofp_action *in, size_t n_in,
const flow_t *flow, struct ofproto *ofproto,
const struct flow *flow, struct ofproto *ofproto,
const struct ofpbuf *packet,
struct odp_actions *out, tag_type *tags, bool *may_set_up_flow,
uint16_t *nf_output_iface)
@@ -2900,9 +2900,9 @@ handle_packet_out(struct ofproto *p, struct ofconn *ofconn,
struct ofp_packet_out *opo;
struct ofpbuf payload, *buffer;
struct odp_actions actions;
struct flow flow;
int n_actions;
uint16_t in_port;
flow_t flow;
int error;
error = reject_slave_controller(ofconn, oh);
@@ -3600,7 +3600,7 @@ add_flow(struct ofproto *p, struct ofconn *ofconn,
int error;
if (ofm->flags & htons(OFPFF_CHECK_OVERLAP)) {
flow_t flow;
struct flow flow;
uint32_t wildcards;
flow_from_match(&ofm->match, p->tun_id_from_cookie, ofm->cookie,
@@ -3635,7 +3635,7 @@ static struct rule *
find_flow_strict(struct ofproto *p, const struct ofp_flow_mod *ofm)
{
uint32_t wildcards;
flow_t flow;
struct flow flow;
flow_from_match(&ofm->match, p->tun_id_from_cookie, ofm->cookie,
&flow, &wildcards);
@@ -3650,7 +3650,7 @@ send_buffered_packet(struct ofproto *ofproto, struct ofconn *ofconn,
{
struct ofpbuf *packet;
uint16_t in_port;
flow_t flow;
struct flow flow;
int error;
if (ofm->buffer_id == htonl(UINT32_MAX)) {
@@ -4120,7 +4120,7 @@ handle_odp_miss_msg(struct ofproto *p, struct ofpbuf *packet)
struct odp_msg *msg = packet->data;
struct rule *rule;
struct ofpbuf payload;
flow_t flow;
struct flow flow;
payload.data = msg + 1;
payload.size = msg->length - sizeof *msg;
@@ -4282,7 +4282,7 @@ ofproto_update_used(struct ofproto *p)
for (i = 0; i < n_flows; i++) {
struct odp_flow *f = &flows[i];
struct rule *rule;
flow_t flow;
struct flow flow;
odp_flow_key_to_flow(&f->key, &flow);
@@ -4518,7 +4518,7 @@ revalidate_cb(struct cls_rule *sub_, void *cbdata_)
static bool
revalidate_rule(struct ofproto *p, struct rule *rule)
{
const flow_t *flow = &rule->cr.flow;
const struct flow *flow = &rule->cr.flow;
COVERAGE_INC(ofproto_revalidate_rule);
if (rule->super) {
@@ -4778,7 +4778,7 @@ pick_fallback_dpid(void)
}
static bool
default_normal_ofhook_cb(const flow_t *flow, const struct ofpbuf *packet,
default_normal_ofhook_cb(const struct flow *flow, const struct ofpbuf *packet,
struct odp_actions *actions, tag_type *tags,
uint16_t *nf_output_iface, void *ofproto_)
{

View File

@@ -36,7 +36,7 @@ struct ofproto;
struct svec;
struct ofexpired {
flow_t flow;
struct flow flow;
uint64_t packet_count; /* Packets from subrules. */
uint64_t byte_count; /* Bytes from subrules. */
long long int used; /* Last-used time (0 if never used). */
@@ -122,23 +122,23 @@ void ofproto_get_snoops(const struct ofproto *, struct svec *);
void ofproto_get_all_flows(struct ofproto *p, struct ds *);
/* Functions for use by ofproto implementation modules, not by clients. */
int ofproto_send_packet(struct ofproto *, const flow_t *,
int ofproto_send_packet(struct ofproto *, const struct flow *,
const union ofp_action *, size_t n_actions,
const struct ofpbuf *);
void ofproto_add_flow(struct ofproto *, const flow_t *, uint32_t wildcards,
unsigned int priority,
void ofproto_add_flow(struct ofproto *, const struct flow *,
uint32_t wildcards, unsigned int priority,
const union ofp_action *, size_t n_actions,
int idle_timeout);
void ofproto_delete_flow(struct ofproto *, const flow_t *, uint32_t wildcards,
unsigned int priority);
void ofproto_delete_flow(struct ofproto *, const struct flow *,
uint32_t wildcards, unsigned int priority);
void ofproto_flush_flows(struct ofproto *);
/* Hooks for ovs-vswitchd. */
struct ofhooks {
bool (*normal_cb)(const flow_t *, const struct ofpbuf *packet,
bool (*normal_cb)(const struct flow *, const struct ofpbuf *packet,
struct odp_actions *, tag_type *,
uint16_t *nf_output_iface, void *aux);
void (*account_flow_cb)(const flow_t *, tag_type tags,
void (*account_flow_cb)(const struct flow *, tag_type tags,
const union odp_action *, size_t n_actions,
unsigned long long int n_bytes, void *aux);
void (*account_checkpoint_cb)(void *aux);

View File

@@ -155,7 +155,7 @@ read_uint32(const void *p)
}
static bool
match(const struct cls_rule *wild, const flow_t *fixed)
match(const struct cls_rule *wild, const struct flow *fixed)
{
int f_idx;
@@ -187,7 +187,7 @@ match(const struct cls_rule *wild, const flow_t *fixed)
}
static struct cls_rule *
tcls_lookup(const struct tcls *cls, const flow_t *flow, int include)
tcls_lookup(const struct tcls *cls, const struct flow *flow, int include)
{
size_t i;
@@ -335,7 +335,7 @@ get_value(unsigned int *x, unsigned n_values)
static struct cls_rule *
lookup_with_include_bits(const struct classifier *cls,
const flow_t *flow, int include)
const struct flow *flow, int include)
{
switch (include) {
case CLS_INC_WILD:
@@ -359,7 +359,7 @@ compare_classifiers(struct classifier *cls, struct tcls *tcls)
assert(classifier_count_exact(cls) == tcls_count_exact(tcls));
for (i = 0; i < confidence; i++) {
struct cls_rule *cr0, *cr1;
flow_t flow;
struct flow flow;
unsigned int x;
int include;
@@ -453,7 +453,7 @@ make_rule(int wc_fields, unsigned int priority, int value_pat)
const struct cls_field *f;
struct test_rule *rule;
uint32_t wildcards;
flow_t flow;
struct flow flow;
wildcards = 0;
memset(&flow, 0, sizeof flow);

View File

@@ -54,7 +54,7 @@ main(int argc OVS_UNUSED, char *argv[])
while (fread(&expected_match, sizeof expected_match, 1, flows)) {
struct ofpbuf *packet;
struct ofp_match extracted_match;
flow_t flow;
struct flow flow;
n++;

View File

@@ -1751,7 +1751,7 @@ bridge_reconfigure_remotes(struct bridge *br,
if (!n_controllers
&& ofproto_get_fail_mode(br->ofproto) == OFPROTO_FAIL_STANDALONE) {
union ofp_action action;
flow_t flow;
struct flow flow;
memset(&action, 0, sizeof action);
action.type = htons(OFPAT_OUTPUT);
@@ -2115,7 +2115,7 @@ bond_wait(struct bridge *br)
}
static bool
set_dst(struct dst *p, const flow_t *flow,
set_dst(struct dst *p, const struct flow *flow,
const struct port *in_port, const struct port *out_port,
tag_type *tags)
{
@@ -2204,7 +2204,7 @@ port_includes_vlan(const struct port *port, uint16_t vlan)
}
static size_t
compose_dsts(const struct bridge *br, const flow_t *flow, uint16_t vlan,
compose_dsts(const struct bridge *br, const struct flow *flow, uint16_t vlan,
const struct port *in_port, const struct port *out_port,
struct dst dsts[], tag_type *tags, uint16_t *nf_output_iface)
{
@@ -2292,7 +2292,7 @@ print_dsts(const struct dst *dsts, size_t n)
}
static void
compose_actions(struct bridge *br, const flow_t *flow, uint16_t vlan,
compose_actions(struct bridge *br, const struct flow *flow, uint16_t vlan,
const struct port *in_port, const struct port *out_port,
tag_type *tags, struct odp_actions *actions,
uint16_t *nf_output_iface)
@@ -2326,7 +2326,7 @@ compose_actions(struct bridge *br, const flow_t *flow, uint16_t vlan,
* 802.1Q header and implicitly tagged ports. A value of 0 indicates that
* the packet is untagged and -1 indicates it has an invalid header and
* should be dropped. */
static int flow_get_vlan(struct bridge *br, const flow_t *flow,
static int flow_get_vlan(struct bridge *br, const struct flow *flow,
struct port *in_port, bool have_packet)
{
/* Note that dl_vlan of 0 and of OFP_VLAN_NONE both mean that the packet
@@ -2372,7 +2372,7 @@ static int flow_get_vlan(struct bridge *br, const flow_t *flow,
* migration. Older Citrix-patched Linux DomU used gratuitous ARP replies to
* indicate this; newer upstream kernels use gratuitous ARP requests. */
static bool
is_gratuitous_arp(const flow_t *flow)
is_gratuitous_arp(const struct flow *flow)
{
return (flow->dl_type == htons(ETH_TYPE_ARP)
&& eth_addr_is_broadcast(flow->dl_dst)
@@ -2382,7 +2382,7 @@ is_gratuitous_arp(const flow_t *flow)
}
static void
update_learning_table(struct bridge *br, const flow_t *flow, int vlan,
update_learning_table(struct bridge *br, const struct flow *flow, int vlan,
struct port *in_port)
{
enum grat_arp_lock_type lock_type;
@@ -2430,7 +2430,7 @@ update_learning_table(struct bridge *br, const flow_t *flow, int vlan,
* so in one special case.
*/
static bool
is_admissible(struct bridge *br, const flow_t *flow, bool have_packet,
is_admissible(struct bridge *br, const struct flow *flow, bool have_packet,
tag_type *tags, int *vlanp, struct port **in_portp)
{
struct iface *in_iface;
@@ -2519,7 +2519,7 @@ is_admissible(struct bridge *br, const flow_t *flow, bool have_packet,
* returns true. Otherwise, the actions should only be applied to 'packet', or
* not at all, if 'packet' was NULL. */
static bool
process_flow(struct bridge *br, const flow_t *flow,
process_flow(struct bridge *br, const struct flow *flow,
const struct ofpbuf *packet, struct odp_actions *actions,
tag_type *tags, uint16_t *nf_output_iface)
{
@@ -2570,7 +2570,7 @@ done:
}
static bool
bridge_normal_ofhook_cb(const flow_t *flow, const struct ofpbuf *packet,
bridge_normal_ofhook_cb(const struct flow *flow, const struct ofpbuf *packet,
struct odp_actions *actions, tag_type *tags,
uint16_t *nf_output_iface, void *br_)
{
@@ -2582,7 +2582,7 @@ bridge_normal_ofhook_cb(const flow_t *flow, const struct ofpbuf *packet,
}
static void
bridge_account_flow_ofhook_cb(const flow_t *flow, tag_type tags,
bridge_account_flow_ofhook_cb(const struct flow *flow, tag_type tags,
const union odp_action *actions,
size_t n_actions, unsigned long long int n_bytes,
void *br_)
@@ -2963,7 +2963,7 @@ bond_send_learning_packets(struct port *port)
union ofp_action actions[2], *a;
uint16_t dp_ifidx;
tag_type tags = 0;
flow_t flow;
struct flow flow;
int retval;
if (e->port == port->port_idx