2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-25 15:07:05 +00:00

Add OXM_OF_METADATA field as a step toward OpenFlow 1.1 support.

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Joe Stringer
2012-06-27 01:09:44 +12:00
committed by Ben Pfaff
parent b5e5143b6a
commit 969fc56c2a
16 changed files with 249 additions and 90 deletions

View File

@@ -55,6 +55,15 @@ static const struct mf_field mf_fields[MFF_N_IDS] = {
true,
NXM_NX_TUN_ID, "NXM_NX_TUN_ID",
NXM_NX_TUN_ID, "NXM_NX_TUN_ID",
}, {
MFF_METADATA, "metadata", NULL,
MF_FIELD_SIZES(be64),
MFM_FULLY, 0,
MFS_HEXADECIMAL,
MFP_NONE,
true,
OXM_OF_METADATA, "OXM_OF_METADATA",
OXM_OF_METADATA, "OXM_OF_METADATA",
}, {
MFF_IN_PORT, "in_port", NULL,
MF_FIELD_SIZES(be16),
@@ -563,6 +572,8 @@ mf_is_all_wild(const struct mf_field *mf, const struct flow_wildcards *wc)
case MFF_TUN_ID:
return !wc->tun_id_mask;
case MFF_METADATA:
return !wc->metadata_mask;
#if FLOW_N_REGS > 0
case MFF_REG0:
@@ -673,6 +684,9 @@ mf_get_mask(const struct mf_field *mf, const struct flow_wildcards *wc,
case MFF_TUN_ID:
mask->be64 = wc->tun_id_mask;
break;
case MFF_METADATA:
mask->be64 = wc->metadata_mask;
break;
#if FLOW_N_REGS > 0
case MFF_REG0:
@@ -872,6 +886,7 @@ mf_is_value_valid(const struct mf_field *mf, const union mf_value *value)
{
switch (mf->id) {
case MFF_TUN_ID:
case MFF_METADATA:
case MFF_IN_PORT:
#if FLOW_N_REGS > 0
case MFF_REG0:
@@ -962,6 +977,9 @@ mf_get_value(const struct mf_field *mf, const struct flow *flow,
case MFF_TUN_ID:
value->be64 = flow->tun_id;
break;
case MFF_METADATA:
value->be64 = flow->metadata;
break;
case MFF_IN_PORT:
value->be16 = htons(flow->in_port);
@@ -1130,6 +1148,9 @@ mf_set_value(const struct mf_field *mf,
case MFF_TUN_ID:
cls_rule_set_tun_id(rule, value->be64);
break;
case MFF_METADATA:
cls_rule_set_metadata(rule, value->be64);
break;
case MFF_IN_PORT:
cls_rule_set_in_port(rule, ntohs(value->be16));
@@ -1300,6 +1321,9 @@ mf_set_flow_value(const struct mf_field *mf,
case MFF_TUN_ID:
flow->tun_id = value->be64;
break;
case MFF_METADATA:
flow->metadata = value->be64;
break;
case MFF_IN_PORT:
flow->in_port = ntohs(value->be16);
@@ -1479,6 +1503,8 @@ mf_set_wild(const struct mf_field *mf, struct cls_rule *rule)
case MFF_TUN_ID:
cls_rule_set_tun_id_masked(rule, htonll(0), htonll(0));
break;
case MFF_METADATA:
cls_rule_set_metadata_masked(rule, htonll(0), htonll(0));
case MFF_IN_PORT:
rule->wc.wildcards |= FWW_IN_PORT;
@@ -1698,6 +1724,9 @@ mf_set(const struct mf_field *mf,
case MFF_TUN_ID:
cls_rule_set_tun_id_masked(rule, value->be64, mask->be64);
break;
case MFF_METADATA:
cls_rule_set_metadata_masked(rule, value->be64, mask->be64);
break;
#if FLOW_N_REGS > 0
case MFF_REG0:
@@ -1857,6 +1886,7 @@ mf_random_value(const struct mf_field *mf, union mf_value *value)
switch (mf->id) {
case MFF_TUN_ID:
case MFF_METADATA:
case MFF_IN_PORT:
#if FLOW_N_REGS > 0
case MFF_REG0: