mirror of
https://github.com/openvswitch/ovs
synced 2025-09-03 15:55:19 +00:00
Fix up usage of flow_wildcards_t.
The flow_wildcards_t type is defined as a distinct type from sparse's perspective (with __attribute__((bitwise))) so that we don't accidentally mix it with only-partially-compatible OFPFW_* flags. But we were weren't using it quite right in a few plces. This fixes it up.
This commit is contained in:
@@ -680,7 +680,7 @@ nxm_put_eth(struct ofpbuf *b, uint32_t header,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
nxm_put_eth_dst(struct ofpbuf *b,
|
nxm_put_eth_dst(struct ofpbuf *b,
|
||||||
uint32_t wc, const uint8_t value[ETH_ADDR_LEN])
|
flow_wildcards_t wc, const uint8_t value[ETH_ADDR_LEN])
|
||||||
{
|
{
|
||||||
switch (wc & (FWW_DL_DST | FWW_ETH_MCAST)) {
|
switch (wc & (FWW_DL_DST | FWW_ETH_MCAST)) {
|
||||||
case FWW_DL_DST | FWW_ETH_MCAST:
|
case FWW_DL_DST | FWW_ETH_MCAST:
|
||||||
|
@@ -96,12 +96,11 @@ ofputil_netmask_to_wcbits(ovs_be32 netmask)
|
|||||||
|
|
||||||
/* WC_INVARIANTS is the invariant bits (as defined on WC_INVARIANT_LIST) all
|
/* WC_INVARIANTS is the invariant bits (as defined on WC_INVARIANT_LIST) all
|
||||||
* OR'd together. */
|
* OR'd together. */
|
||||||
enum {
|
static const flow_wildcards_t WC_INVARIANTS = 0
|
||||||
WC_INVARIANTS = 0
|
|
||||||
#define WC_INVARIANT_BIT(NAME) | FWW_##NAME
|
#define WC_INVARIANT_BIT(NAME) | FWW_##NAME
|
||||||
WC_INVARIANT_LIST
|
WC_INVARIANT_LIST
|
||||||
#undef WC_INVARIANT_BIT
|
#undef WC_INVARIANT_BIT
|
||||||
};
|
;
|
||||||
|
|
||||||
/* Converts the ofp_match in 'match' into a cls_rule in 'rule', with the given
|
/* Converts the ofp_match in 'match' into a cls_rule in 'rule', with the given
|
||||||
* 'priority'. */
|
* 'priority'. */
|
||||||
@@ -110,7 +109,7 @@ ofputil_cls_rule_from_match(const struct ofp_match *match,
|
|||||||
unsigned int priority, struct cls_rule *rule)
|
unsigned int priority, struct cls_rule *rule)
|
||||||
{
|
{
|
||||||
struct flow_wildcards *wc = &rule->wc;
|
struct flow_wildcards *wc = &rule->wc;
|
||||||
unsigned int ofpfw;
|
uint32_t ofpfw;
|
||||||
ovs_be16 vid, pcp;
|
ovs_be16 vid, pcp;
|
||||||
|
|
||||||
/* Initialize rule->priority. */
|
/* Initialize rule->priority. */
|
||||||
@@ -119,7 +118,7 @@ ofputil_cls_rule_from_match(const struct ofp_match *match,
|
|||||||
|
|
||||||
/* Initialize most of rule->wc. */
|
/* Initialize most of rule->wc. */
|
||||||
flow_wildcards_init_catchall(wc);
|
flow_wildcards_init_catchall(wc);
|
||||||
wc->wildcards = ofpfw & WC_INVARIANTS;
|
wc->wildcards = (OVS_FORCE flow_wildcards_t) ofpfw & WC_INVARIANTS;
|
||||||
|
|
||||||
/* Wildcard fields that aren't defined by ofp_match or tun_id. */
|
/* Wildcard fields that aren't defined by ofp_match or tun_id. */
|
||||||
wc->wildcards |= (FWW_ARP_SHA | FWW_ARP_THA | FWW_ND_TARGET);
|
wc->wildcards |= (FWW_ARP_SHA | FWW_ARP_THA | FWW_ND_TARGET);
|
||||||
@@ -202,10 +201,10 @@ void
|
|||||||
ofputil_cls_rule_to_match(const struct cls_rule *rule, struct ofp_match *match)
|
ofputil_cls_rule_to_match(const struct cls_rule *rule, struct ofp_match *match)
|
||||||
{
|
{
|
||||||
const struct flow_wildcards *wc = &rule->wc;
|
const struct flow_wildcards *wc = &rule->wc;
|
||||||
unsigned int ofpfw;
|
uint32_t ofpfw;
|
||||||
|
|
||||||
/* Figure out most OpenFlow wildcards. */
|
/* Figure out most OpenFlow wildcards. */
|
||||||
ofpfw = wc->wildcards & WC_INVARIANTS;
|
ofpfw = (OVS_FORCE uint32_t) (wc->wildcards & WC_INVARIANTS);
|
||||||
ofpfw |= ofputil_netmask_to_wcbits(wc->nw_src_mask) << OFPFW_NW_SRC_SHIFT;
|
ofpfw |= ofputil_netmask_to_wcbits(wc->nw_src_mask) << OFPFW_NW_SRC_SHIFT;
|
||||||
ofpfw |= ofputil_netmask_to_wcbits(wc->nw_dst_mask) << OFPFW_NW_DST_SHIFT;
|
ofpfw |= ofputil_netmask_to_wcbits(wc->nw_dst_mask) << OFPFW_NW_DST_SHIFT;
|
||||||
if (wc->wildcards & FWW_NW_TOS) {
|
if (wc->wildcards & FWW_NW_TOS) {
|
||||||
|
Reference in New Issue
Block a user