mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
meta-flow: Add 64-bit registers.
These 64-bit registers are intended to conform with the OpenFlow 1.5 draft specification. EXT-244. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This commit is contained in:
@@ -234,6 +234,29 @@ const struct mf_field mf_fields[MFF_N_IDS] = {
|
||||
REGISTER(7),
|
||||
#else
|
||||
#error "Need to update mf_fields[] to match FLOW_N_REGS"
|
||||
#endif
|
||||
|
||||
#define XREGISTER(IDX) \
|
||||
{ \
|
||||
MFF_XREG##IDX, "xreg" #IDX, NULL, \
|
||||
MF_FIELD_SIZES(be64), \
|
||||
MFM_FULLY, \
|
||||
MFS_HEXADECIMAL, \
|
||||
MFP_NONE, \
|
||||
true, \
|
||||
OXM_OF_PKT_REG(IDX), "OXM_OF_PKT_REG" #IDX, \
|
||||
OXM_OF_PKT_REG(IDX), "OXM_OF_PKT_REG" #IDX, OFP15_VERSION, \
|
||||
OFPUTIL_P_NXM_OXM_ANY, \
|
||||
OFPUTIL_P_NXM_OXM_ANY, \
|
||||
-1, \
|
||||
}
|
||||
#if FLOW_N_XREGS == 4
|
||||
XREGISTER(0),
|
||||
XREGISTER(1),
|
||||
XREGISTER(2),
|
||||
XREGISTER(3),
|
||||
#else
|
||||
#error "Need to update mf_fields[] to match FLOW_N_XREGS"
|
||||
#endif
|
||||
|
||||
/* ## -- ## */
|
||||
@@ -922,6 +945,8 @@ mf_is_all_wild(const struct mf_field *mf, const struct flow_wildcards *wc)
|
||||
return !wc->masks.pkt_mark;
|
||||
CASE_MFF_REGS:
|
||||
return !wc->masks.regs[mf->id - MFF_REG0];
|
||||
CASE_MFF_XREGS:
|
||||
return !flow_get_xreg(&wc->masks, mf->id - MFF_XREG0);
|
||||
|
||||
case MFF_ETH_SRC:
|
||||
return eth_addr_is_zero(wc->masks.dl_src);
|
||||
@@ -1160,6 +1185,7 @@ mf_is_value_valid(const struct mf_field *mf, const union mf_value *value)
|
||||
case MFF_SKB_PRIORITY:
|
||||
case MFF_PKT_MARK:
|
||||
CASE_MFF_REGS:
|
||||
CASE_MFF_XREGS:
|
||||
case MFF_ETH_SRC:
|
||||
case MFF_ETH_DST:
|
||||
case MFF_ETH_TYPE:
|
||||
@@ -1290,6 +1316,10 @@ mf_get_value(const struct mf_field *mf, const struct flow *flow,
|
||||
value->be32 = htonl(flow->regs[mf->id - MFF_REG0]);
|
||||
break;
|
||||
|
||||
CASE_MFF_XREGS:
|
||||
value->be64 = htonll(flow_get_xreg(flow, mf->id - MFF_XREG0));
|
||||
break;
|
||||
|
||||
case MFF_ETH_SRC:
|
||||
memcpy(value->mac, flow->dl_src, ETH_ADDR_LEN);
|
||||
break;
|
||||
@@ -1492,6 +1522,10 @@ mf_set_value(const struct mf_field *mf,
|
||||
match_set_reg(match, mf->id - MFF_REG0, ntohl(value->be32));
|
||||
break;
|
||||
|
||||
CASE_MFF_XREGS:
|
||||
match_set_xreg(match, mf->id - MFF_XREG0, ntohll(value->be64));
|
||||
break;
|
||||
|
||||
case MFF_ETH_SRC:
|
||||
match_set_dl_src(match, value->mac);
|
||||
break;
|
||||
@@ -1711,6 +1745,10 @@ mf_set_flow_value(const struct mf_field *mf,
|
||||
flow->regs[mf->id - MFF_REG0] = ntohl(value->be32);
|
||||
break;
|
||||
|
||||
CASE_MFF_XREGS:
|
||||
flow_set_xreg(flow, mf->id - MFF_XREG0, ntohll(value->be64));
|
||||
break;
|
||||
|
||||
case MFF_ETH_SRC:
|
||||
memcpy(flow->dl_src, value->mac, ETH_ADDR_LEN);
|
||||
break;
|
||||
@@ -1928,6 +1966,10 @@ mf_set_wild(const struct mf_field *mf, struct match *match)
|
||||
match_set_reg_masked(match, mf->id - MFF_REG0, 0, 0);
|
||||
break;
|
||||
|
||||
CASE_MFF_XREGS:
|
||||
match_set_xreg_masked(match, mf->id - MFF_XREG0, 0, 0);
|
||||
break;
|
||||
|
||||
case MFF_ETH_SRC:
|
||||
memset(match->flow.dl_src, 0, ETH_ADDR_LEN);
|
||||
memset(match->wc.masks.dl_src, 0, ETH_ADDR_LEN);
|
||||
@@ -2151,6 +2193,11 @@ mf_set(const struct mf_field *mf,
|
||||
ntohl(value->be32), ntohl(mask->be32));
|
||||
break;
|
||||
|
||||
CASE_MFF_XREGS:
|
||||
match_set_xreg_masked(match, mf->id - MFF_XREG0,
|
||||
ntohll(value->be64), ntohll(mask->be64));
|
||||
break;
|
||||
|
||||
case MFF_PKT_MARK:
|
||||
match_set_pkt_mark_masked(match, ntohl(value->be32),
|
||||
ntohl(mask->be32));
|
||||
|
Reference in New Issue
Block a user