[ovs-dev] [netlink 06/16] flow: Get rid of flow_t typedef.
Ben Pfaff
blp at nicira.com
Fri Sep 10 22:55:06 UTC 2010
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.
---
lib/classifier.c | 39 ++++++++++++++++++++-------------------
lib/classifier.h | 21 +++++++++++----------
lib/dhcp-client.c | 2 +-
lib/dpif-netdev.c | 4 ++--
lib/flow.c | 18 +++++++++---------
lib/flow.h | 30 +++++++++++++++---------------
lib/learning-switch.c | 4 ++--
lib/ofp-print.c | 2 +-
lib/ofp-util.c | 8 ++++----
lib/ofp-util.h | 8 ++++----
ofproto/fail-open.c | 4 ++--
ofproto/in-band.c | 6 +++---
ofproto/in-band.h | 4 ++--
ofproto/ofproto-sflow.c | 2 +-
ofproto/ofproto.c | 38 +++++++++++++++++++-------------------
ofproto/ofproto.h | 16 ++++++++--------
tests/test-classifier.c | 10 +++++-----
tests/test-flows.c | 2 +-
vswitchd/bridge.c | 24 ++++++++++++------------
19 files changed, 122 insertions(+), 120 deletions(-)
diff --git a/lib/classifier.c b/lib/classifier.c
index 6bca2cc..46ffdde 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -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;
@@ -281,7 +282,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) {
@@ -291,7 +292,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)
@@ -299,7 +300,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)) {
@@ -319,7 +320,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;
@@ -357,7 +358,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;
@@ -510,7 +511,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);
@@ -519,7 +520,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.
*
@@ -585,7 +586,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) \
@@ -690,7 +691,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);
@@ -751,7 +752,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)
{
@@ -792,7 +793,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; \
} \
@@ -889,7 +890,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;
diff --git a/lib/classifier.h b/lib/classifier.h
index f522f0e..bed6a65 100644
--- a/lib/classifier.h
+++ b/lib/classifier.h
@@ -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);
diff --git a/lib/dhcp-client.c b/lib/dhcp-client.c
index 1cdd858..3cd326a 100644
--- a/lib/dhcp-client.c
+++ b/lib/dhcp-client.c
@@ -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);
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 3ca7dee..bbc590f 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -845,7 +845,7 @@ dpif_netdev_execute(struct dpif *dpif,
struct ofpbuf copy;
bool mutates;
struct odp_flow_key key;
- flow_t flow;
+ struct flow flow;
int error;
if (packet->size < ETH_HEADER_LEN || packet->size > UINT16_MAX) {
@@ -960,7 +960,7 @@ dp_netdev_port_input(struct dp_netdev *dp, struct dp_netdev_port *port,
{
struct dp_netdev_flow *flow;
struct odp_flow_key key;
- flow_t f;
+ struct flow f;
if (packet->size < ETH_HEADER_LEN) {
return;
diff --git a/lib/flow.c b/lib/flow.c
index f2f7727..78c45ad 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -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);
diff --git a/lib/flow.h b/lib/flow.h
index 7b5f144..8999410 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -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. */
diff --git a/lib/learning-switch.c b/lib/learning-switch.c
index e189f1e..2e9e40d 100644
--- a/lib/learning-switch.c
+++ b/lib/learning-switch.c
@@ -321,7 +321,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,
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 8704878..868cef4 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -129,7 +129,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;
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 89f3689..a1c6fbb 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -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)
{
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index b4af179..dc431d0 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -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,
diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c
index 04be5ce..2a8fb95 100644
--- a/ofproto/fail-open.c
+++ b/ofproto/fail-open.c
@@ -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. */
diff --git a/ofproto/in-band.c b/ofproto/in-band.c
index 01ec132..c86e7e7 100644
--- a/ofproto/in-band.c
+++ b/ofproto/in-band.c
@@ -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) {
diff --git a/ofproto/in-band.h b/ofproto/in-band.h
index 12f5714..27a5fe5 100644
--- a/ofproto/in-band.h
+++ b/ofproto/in-band.h
@@ -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 *);
diff --git a/ofproto/ofproto-sflow.c b/ofproto/ofproto-sflow.c
index 3128d0a..f8ff496 100644
--- a/ofproto/ofproto-sflow.c
+++ b/ofproto/ofproto-sflow.c
@@ -462,8 +462,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. */
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 36fbb23..4e209f0 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -77,7 +77,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);
@@ -1260,7 +1260,7 @@ ofproto_is_alive(const struct ofproto *p)
}
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)
{
@@ -1280,8 +1280,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)
{
@@ -1294,7 +1294,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;
@@ -1939,7 +1939,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;
@@ -1998,7 +1998,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);
}
@@ -2020,7 +2020,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,
@@ -2393,7 +2393,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
@@ -2438,7 +2438,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));
@@ -2754,7 +2754,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)
@@ -2824,9 +2824,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);
@@ -3529,7 +3529,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,
@@ -3564,7 +3564,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);
@@ -3579,7 +3579,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)) {
@@ -4050,7 +4050,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;
@@ -4166,7 +4166,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) {
@@ -4361,7 +4361,7 @@ 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);
@@ -4554,7 +4554,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_)
{
diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index 4ef4a4c..b663366 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -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). */
@@ -120,25 +120,25 @@ 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 {
void (*port_changed_cb)(enum ofp_port_reason, const struct ofp_phy_port *,
void *aux);
- 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);
diff --git a/tests/test-classifier.c b/tests/test-classifier.c
index f1b902d..e960d1c 100644
--- a/tests/test-classifier.c
+++ b/tests/test-classifier.c
@@ -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);
diff --git a/tests/test-flows.c b/tests/test-flows.c
index 3d31aae..a4649b3 100644
--- a/tests/test-flows.c
+++ b/tests/test-flows.c
@@ -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++;
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 4ab66ef..9a3be00 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1682,7 +1682,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);
@@ -2029,7 +2029,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)
{
@@ -2118,7 +2118,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)
{
@@ -2206,7 +2206,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)
@@ -2240,7 +2240,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
@@ -2286,7 +2286,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)
@@ -2296,7 +2296,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;
@@ -2344,7 +2344,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;
@@ -2433,7 +2433,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)
{
@@ -2521,7 +2521,7 @@ bridge_port_changed_ofhook_cb(enum ofp_port_reason reason,
}
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_)
{
@@ -2533,7 +2533,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_)
@@ -2916,7 +2916,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
--
1.7.1
More information about the dev
mailing list