On Mon, Jun 06, 2011 at 07:13:15PM -0700, Ethan Jackson wrote:
> flow_wildcard_to_dl_dst_mask() is a tad on the fancy side, but I think
> it's fine.
Do you like this version better?
/* Returns the wildcard bitmask for the Ethernet destination address
* that 'wc' specifies. The bitmask has a 0 in each bit that is wildcarded
* and a 1 in each bit that must match. */
const uint8_t *
flow_wildcards_to_dl_dst_mask(flow_wildcards_t wc)
{
static const uint8_t no_wild[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
static const uint8_t addr_wild[] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t mcast_wild[] = {0xfe, 0xff, 0xff, 0xff, 0xff, 0xff};
static const uint8_t all_wild[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
switch (wc & (FWW_DL_DST | FWW_ETH_MCAST)) {
case 0: return no_wild;
case FWW_DL_DST: return addr_wild;
case FWW_ETH_MCAST: return mcast_wild;
case FWW_DL_DST | FWW_ETH_MCAST: return all_wild;
}
NOT_REACHED();
}
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev