On Sat, Oct 26, 2013 at 06:12:27PM +0800, Alexander Wu wrote: > Add headers and function prototype for table features. > And modify the limits of mp-table-features msg > > Signed-off-by: Alexander Wu <alexander...@huawei.com> > --- > lib/ofp-msgs.h | 4 +- > lib/ofp-util.h | 159 > ++++++++++++++++++++++++++++++++++++++++++++ > ofproto/ofproto-provider.h | 3 + > 3 files changed, 164 insertions(+), 2 deletions(-) > > diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h > index aa19fe3..9a679f4 100644 > --- a/lib/ofp-msgs.h > +++ b/lib/ofp-msgs.h > @@ -336,10 +336,10 @@ enum ofpraw { > /* OFPST 1.3+ (11): struct ofp13_meter_features. */ > OFPRAW_OFPST13_METER_FEATURES_REPLY, > > - /* OFPST 1.3+ (12): struct ofp13_table_features[]. */ > + /* OFPST 1.3+ (12): void. */ > OFPRAW_OFPST13_TABLE_FEATURES_REQUEST, > > - /* OFPST 1.3+ (12): struct ofp13_table_features[]. */ > + /* OFPST 1.3+ (12): struct ofp13_table_features, uint8_t[8][]. */ > OFPRAW_OFPST13_TABLE_FEATURES_REPLY, > > /* OFPST 1.0+ (13): void. */ > diff --git a/lib/ofp-util.h b/lib/ofp-util.h > index 1f77808..a33ddec 100644 > --- a/lib/ofp-util.h > +++ b/lib/ofp-util.h > @@ -598,6 +598,165 @@ enum ofperr ofputil_decode_table_mod(const struct > ofp_header *, > struct ofpbuf *ofputil_encode_table_mod(const struct ofputil_table_mod *, > enum ofputil_protocol); > > +struct ofputil_table_feature_prop_header { > + uint16_t type; /* One of OFPTFPT_*. */ > + uint16_t length; /* Length in bytes of this property. */ > + uint8_t *data; > +}; > + > +#define OTF_GET (1 << 0) > +#define OTF_SET (1 << 1)
Perhaps an enum is appropriate for these values. > +#define OFTABLE_NUM 0xff > + > +/* Abstract ofp13_table_features */ > +struct ofputil_table_features { > + uint16_t length; /* Length is padded to 64 bits. */ > + uint8_t table_id; /* Identifier of table. Lower numbered tables > + are consulted first. */ > + char name[OFP_MAX_TABLE_NAME_LEN]; > + uint64_t metadata_match; /* Bits of metadata table can match. */ > + uint64_t metadata_write; /* Bits of metadata table can write. */ > + uint32_t config; /* Bitmap of OFPTC_* values */ > + uint32_t max_entries; /* Max number of entries supported. */ > + > + struct ofputil_table_feature_prop_header props[0xff]; > + uint16_t n_property; > +}; > + > + I think that one blank line is sufficient here. > +struct oxm_variable { > + uint32_t data; > + char *name; > +}; > + > +extern struct oxm_variable oxm_variables[]; > +int get_oxm_num(void); > +char *get_oxm_name(uint32_t type); oxm_variables, get_oxm_num and get_oxm_name are added in the next patch not this one. So its declaration should go there too. > + > +/* Table Feature property types. > + * Low order bit cleared indicates a property for a regular Flow Entry. > + * Low order bit set indicates a property for the Table-Miss Flow Entry. */ > +enum ofputil_table_feature_prop_type { > + OFPUTIL_INSTRUCTIONS = 0, /* Instructions property. */ > + OFPUTIL_INSTRUCTIONS_MISS = 1, /* Instructions for table-miss. */ > + OFPUTIL_NEXT_TABLES = 2, /* Next Table property. */ > + OFPUTIL_NEXT_TABLES_MISS = 3, /* Next Table for table-miss. */ > + OFPUTIL_WRITE_ACTIONS = 4, /* Write Actions property. */ > + OFPUTIL_WRITE_ACTIONS_MISS = 5, /* Write Actions for table-miss. */ > + OFPUTIL_APPLY_ACTIONS = 6, /* Apply Actions property. */ > + OFPUTIL_APPLY_ACTIONS_MISS = 7, /* Apply Actions for table-miss. */ > + OFPUTIL_MATCH = 8, /* Match property. */ > + OFPUTIL_WILDCARDS = 10, /* Wildcards property. */ > + OFPUTIL_WRITE_SETFIELD = 12, /* Write Set-Field property. */ > + OFPUTIL_WRITE_SETFIELD_MISS = 13, /* Write Set-Field for table-miss. */ > + OFPUTIL_APPLY_SETFIELD = 14, /* Apply Set-Field property. */ > + OFPUTIL_APPLY_SETFIELD_MISS = 15, /* Apply Set-Field for table-miss. */ > + OFPUTIL_EXPERIMENTER = 0xFFFE, /* Experimenter property. */ > + OFPUTIL_EXPERIMENTER_MISS = 0xFFFF, /* Experimenter for table-miss. */ > +}; This seems to duplicate ofp13_table_feature_prop_type. I wonder if it is necessary. > + > +struct ofputil_instruction { > + uint16_t type; /* Instruction type */ > + uint16_t len; /* Length of this struct in bytes. */ > + uint8_t pad[4]; > +}; > + > +/* Instructions property */ > +struct ofputil_table_feature_prop_instructions { > + uint16_t type; /* One of OFPUTIL_INSTRUCTIONS, > + OFPUTIL_INSTRUCTIONS_MISS. */ > + uint16_t length; /* Length in bytes of this property. */ > + uint8_t table_id; > + uint8_t n_instructions; > + /* Followed by: > + * - Exactly (length - 4) bytes containing the instruction ids, then > + * - Exactly (length + 7)/8*8 - (length) (between 0 and 7) > + * bytes of all-zero bytes */ > + struct ofputil_instruction *instruction_ids; > +}; > + > +#define NEXT_TABLE_NUM 0xff > + > +struct ofputil_table_feature_prop_next_tables { > + uint16_t type; /* One of OFPUTIL_NEXT_TABLES, > + OFPUTIL_NEXT_TABLES_MISS. */ > + uint16_t length; /* Length in bytes of this property. */ > + uint8_t n_next_table; > + /* Followed by: > + * - Exactly (length - 4) bytes containing the table_ids, then > + * - Exactly (length + 7)/8*8 - (length) (between 0 and 7) > + * bytes of all-zero bytes */ > + uint8_t next_table_ids[NEXT_TABLE_NUM]; /* List of table ids. */ > +}; > + > +struct ofputil_table_feature_prop_actions { > + uint16_t type; /* One of OFPUTIL_WRITE_ACTIONS, > + OFPUTIL_WRITE_ACTIONS_MISS, > + OFPUTIL_APPLY_ACTIONS, > + OFPUTIL_APPLY_ACTIONS_MISS. */ > + uint16_t length; /* Length in bytes of this property. */ > + uint8_t n_actions; > + /* Followed by: > + * - Exactly (length - 4) bytes containing the action_ids, then > + * - Exactly (length + 7)/8*8 - (length) (between 0 and 7) > + * bytes of all-zero bytes */ > + struct ofp_action_header *action_ids; /* List of actions > + without any data */ > +}; > + > +/* Match, Wildcard or Set-Field property */ > +struct ofputil_table_feature_prop_oxm { > + uint16_t type; /* One of OFPTFPT13_MATCH, OFPTFPT13_WILDCARDS, > + OFPTFPT13_WRITE_SETFIELD, > + OFPTFPT13_WRITE_SETFIELD_MISS, > + OFPTFPT13_APPLY_SETFIELD, > + OFPTFPT13_APPLY_SETFIELD_MISS. */ > + uint16_t length; /* Length in bytes of this property. */ > + uint8_t n_oxm; > + /* Followed by: > + * - Exactly (length - 4) bytes containing the oxm_ids, then > + * - Exactly (length + 7)/8*8 - (length) (between 0 and 7) > + * bytes of all-zero bytes */ > + /* enum ofputil_match_bitmap oxm_bits; */ /* Array of OXM headers */ > +}; > + > +/* Experimenter table feature property */ > +struct ofputil_table_feature_prop_experimenter { > + uint16_t type; /* One of OFPTFPT13_EXPERIMENTER, > + OFPTFPT13_EXPERIMENTER_MISS. */ > + uint16_t length; /* Length in bytes of this property. */ > + uint32_t experimenter; /* Experimenter ID which takes the same form > + as in struct ofp_experimenter_header. */ > + uint32_t exp_type; /* Experimenter defined. */ > + /* Followed by: > + * - Exactly (length - 12) bytes containing the experimenter data, then > + * - Exactly (length + 7)/8*8 - (length) (between 0 and 7) > + * bytes of all-zero bytes */ > + /*uint32_t experimenter_data[10]; */ > +}; > + > +enum ofperr > +ofputil_decode_table_features_request(const struct ofp_header *oh, int *n, > + struct ofputil_table_features tfs[], uint32_t > *flag); > + > +enum ofperr > +ofputil_decode_table_features_reply(const struct ofp_header *oh, int > *tfs_num, > + struct ofputil_table_features tfs[]); > + > +struct ofpbuf * > +ofputil_encode_table_features_request(enum ofp_version ofp_version); > + > +void > +ofputil_append_table_features_reply(const struct ofputil_table_features *tf, > + struct list *replies); > +uint16_t get_prop_length(uint16_t type); > + > +char *get_prop_name(uint16_t type); > + > +struct ofpbuf * > +ofputil_encode_table_features(const struct ofputil_table_features tfs[], int > n, > + const struct ofp_header *oh); > + The functions above are defined in the following patch. Their declarations should go there too. > /* Meter band configuration for all supported band types. */ > struct ofputil_meter_band { > uint16_t type; > diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h > index 07bb266..5886dec 100644 > --- a/ofproto/ofproto-provider.h > +++ b/ofproto/ofproto-provider.h > @@ -152,6 +152,8 @@ struct ofproto { > struct hmap groups OVS_GUARDED; /* Contains "struct ofgroup"s. */ > uint32_t n_groups[4] OVS_GUARDED; /* # of existing groups of each type. > */ > struct ofputil_group_features ogf; > + /* ANOTHER solution. it doesn't need to copy */ > + struct ofputil_table_features otf[OFTABLE_NUM]; /* seems like to be > "tf", not "otf" */ > }; > > void ofproto_init_tables(struct ofproto *, int n_tables); > @@ -258,6 +260,7 @@ struct oftable { > uint32_t eviction_group_id_basis; > struct hmap eviction_groups_by_id; > struct heap eviction_groups_by_size; > + struct ofputil_table_features tf; > }; > > /* Assigns TABLE to each oftable, in turn, in OFPROTO. > -- > 1.7.3.1.msysgit.0 > > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev