2525
2626const struct cls_field cls_fields [CLS_N_FIELDS + 1 ] = {
2727#define CLS_FIELD (WILDCARDS , MEMBER , NAME ) \
28- { offsetof(flow_t , MEMBER ), \
29- sizeof ((flow_t * )0 )-> MEMBER , \
28+ { offsetof(struct flow , MEMBER ), \
29+ sizeof ((struct flow * )0 )-> MEMBER , \
3030 WILDCARDS , \
3131 #NAME },
3232 CLS_FIELDS
3333#undef CLS_FIELD
34- { sizeof (flow_t ), 0 , 0 , "exact" },
34+ { sizeof (struct flow ), 0 , 0 , "exact" },
3535};
3636
37- static uint32_t hash_fields (const flow_t * , int table_idx );
38- static bool equal_fields (const flow_t * , const flow_t * , int table_idx );
37+ static uint32_t hash_fields (const struct flow * , int table_idx );
38+ static bool equal_fields (const struct flow * , const struct flow * ,
39+ int table_idx );
3940
4041static int table_idx_from_wildcards (uint32_t wildcards );
4142static 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,
4647static struct cls_rule * search_table (const struct hmap * table , int field_idx ,
4748 const struct cls_rule * );
4849static struct cls_rule * search_exact_table (const struct classifier * ,
49- size_t hash , const flow_t * );
50+ size_t hash , const struct flow * );
5051static bool rules_match_1wild (const struct cls_rule * fixed ,
5152 const struct cls_rule * wild , int field_idx );
5253static bool rules_match_2wild (const struct cls_rule * wild1 ,
@@ -55,7 +56,7 @@ static bool rules_match_2wild(const struct cls_rule *wild1,
5556/* Converts the flow in 'flow' into a cls_rule in 'rule', with the given
5657 * 'wildcards' and 'priority'.*/
5758void
58- cls_rule_from_flow (const flow_t * flow , uint32_t wildcards ,
59+ cls_rule_from_flow (const struct flow * flow , uint32_t wildcards ,
5960 unsigned int priority , struct cls_rule * rule )
6061{
6162 rule -> flow = * flow ;
@@ -280,7 +281,7 @@ classifier_remove(struct classifier *cls, struct cls_rule *rule)
280281 * rules added more recently take priority over rules added less recently, but
281282 * this is subject to change and should not be depended upon.) */
282283struct cls_rule *
283- classifier_lookup (const struct classifier * cls , const flow_t * flow )
284+ classifier_lookup (const struct classifier * cls , const struct flow * flow )
284285{
285286 struct cls_rule * rule = classifier_lookup_exact (cls , flow );
286287 if (!rule ) {
@@ -290,15 +291,15 @@ classifier_lookup(const struct classifier *cls, const flow_t *flow)
290291}
291292
292293struct cls_rule *
293- classifier_lookup_exact (const struct classifier * cls , const flow_t * flow )
294+ classifier_lookup_exact (const struct classifier * cls , const struct flow * flow )
294295{
295296 return (!hmap_is_empty (& cls -> exact_table )
296297 ? search_exact_table (cls , flow_hash (flow , 0 ), flow )
297298 : NULL );
298299}
299300
300301struct cls_rule *
301- classifier_lookup_wild (const struct classifier * cls , const flow_t * flow )
302+ classifier_lookup_wild (const struct classifier * cls , const struct flow * flow )
302303{
303304 struct cls_rule * best = NULL ;
304305 if (cls -> n_rules > hmap_count (& cls -> exact_table )) {
@@ -318,7 +319,7 @@ classifier_lookup_wild(const struct classifier *cls, const flow_t *flow)
318319
319320struct cls_rule *
320321classifier_find_rule_exactly (const struct classifier * cls ,
321- const flow_t * target , uint32_t wildcards ,
322+ const struct flow * target , uint32_t wildcards ,
322323 unsigned int priority )
323324{
324325 struct cls_bucket * bucket ;
@@ -356,7 +357,7 @@ classifier_find_rule_exactly(const struct classifier *cls,
356357 * Two rules are considered overlapping if a packet could match both. */
357358bool
358359classifier_rule_overlaps (const struct classifier * cls ,
359- const flow_t * target , uint32_t wildcards ,
360+ const struct flow * target , uint32_t wildcards ,
360361 unsigned int priority )
361362{
362363 struct cls_rule target_rule ;
@@ -506,7 +507,7 @@ classifier_for_each(const struct classifier *cls, int include,
506507}
507508
508509static struct cls_bucket * create_bucket (struct hmap * , size_t hash ,
509- const flow_t * fixed );
510+ const struct flow * fixed );
510511static struct cls_rule * bucket_insert (struct cls_bucket * , struct cls_rule * );
511512
512513static 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);
515516 * (CLS_F_IDX_*) are less than 'table_idx'. (If 'table_idx' is
516517 * CLS_F_IDX_EXACT, hashes all the fields in 'flow'). */
517518static uint32_t
518- hash_fields (const flow_t * flow , int table_idx )
519+ hash_fields (const struct flow * flow , int table_idx )
519520{
520521 /* I just know I'm going to hell for writing code this way.
521522 *
@@ -581,7 +582,7 @@ hash_fields(const flow_t *flow, int table_idx)
581582 *
582583 * Returns true if all the compared fields are equal, false otherwise. */
583584static bool
584- equal_fields (const flow_t * a , const flow_t * b , int table_idx )
585+ equal_fields (const struct flow * a , const struct flow * b , int table_idx )
585586{
586587 /* XXX The generated code could be better here. */
587588#define CLS_FIELD (WILDCARDS , MEMBER , NAME ) \
@@ -685,7 +686,7 @@ find_bucket(struct hmap *table, size_t hash, const struct cls_rule *rule)
685686/* Creates a bucket and inserts it in 'table' with the given 'hash' and 'fixed'
686687 * values. Returns the new bucket. */
687688static struct cls_bucket *
688- create_bucket (struct hmap * table , size_t hash , const flow_t * fixed )
689+ create_bucket (struct hmap * table , size_t hash , const struct flow * fixed )
689690{
690691 struct cls_bucket * bucket = xmalloc (sizeof * bucket );
691692 list_init (& bucket -> rules );
@@ -746,7 +747,7 @@ read_uint32(const void *p)
746747 * The compared field is the one with wildcard bit or bits 'field_wc', offset
747748 * 'rule_ofs' within cls_rule's "fields" member, and length 'len', in bytes. */
748749static inline bool ALWAYS_INLINE
749- field_matches (const flow_t * a_ , const flow_t * b_ ,
750+ field_matches (const struct flow * a_ , const struct flow * b_ ,
750751 uint32_t wildcards , uint32_t nw_src_mask , uint32_t nw_dst_mask ,
751752 uint32_t field_wc , int ofs , int len )
752753{
@@ -787,7 +788,7 @@ rules_match(const struct cls_rule *a, const struct cls_rule *b,
787788 case CLS_F_IDX_##NAME: \
788789 if (!field_matches(&a->flow, &b->flow, \
789790 wildcards, nw_src_mask, nw_dst_mask, \
790- WILDCARDS, offsetof(flow_t , MEMBER), \
791+ WILDCARDS, offsetof(struct flow , MEMBER), \
791792 sizeof a->flow.MEMBER)) { \
792793 return false; \
793794 } \
@@ -884,7 +885,7 @@ search_table(const struct hmap *table, int field_idx,
884885
885886static struct cls_rule *
886887search_exact_table (const struct classifier * cls , size_t hash ,
887- const flow_t * target )
888+ const struct flow * target )
888889{
889890 struct cls_rule * rule ;
890891
0 commit comments