2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

meta-flow: Inline mf_from_id().

mf_from_id accesses a static table, so the compiler should be able to
completely optimize it away.

Also use OVS_PACKED_ENUM to waste less space.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Jarno Rajahalme
2013-10-24 13:19:27 -07:00
committed by Ben Pfaff
parent 64fcc07313
commit 7f98c44d8a
2 changed files with 16 additions and 14 deletions

View File

@@ -41,7 +41,9 @@ VLOG_DEFINE_THIS_MODULE(meta_flow);
sizeof ((union mf_value *)0)->MEMBER, \
8 * sizeof ((union mf_value *)0)->MEMBER
static const struct mf_field mf_fields[MFF_N_IDS] = {
extern const struct mf_field mf_fields[MFF_N_IDS]; /* Silence a warning. */
const struct mf_field mf_fields[MFF_N_IDS] = {
/* ## -------- ## */
/* ## metadata ## */
/* ## -------- ## */
@@ -728,14 +730,6 @@ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
const struct mf_field *mf_from_nxm_header__(uint32_t header);
static void nxm_init(void);
/* Returns the field with the given 'id'. */
const struct mf_field *
mf_from_id(enum mf_field_id id)
{
ovs_assert((unsigned int) id < MFF_N_IDS);
return &mf_fields[id];
}
/* Returns the field with the given 'name', or a null pointer if no field has
* that name. */
const struct mf_field *