[ovs-dev] [PATCH 1/2] datapath: Set the correct bits for OFPAT_SET_NW_TOS action.

Justin Pettit jpettit at nicira.com
Fri Feb 12 14:37:42 PST 2010


On Feb 11, 2010, at 3:22 PM, Ben Pfaff wrote:

> @@ -265,10 +266,10 @@ static struct sk_buff *set_nw_tos(struct sk_buff *skb,
> 		struct iphdr *nh = ip_hdr(skb);
> 		u8 *f = &nh->tos;
> 		u8 old = *f;
> +		u8 new;
> 
> -		/* We only set the lower 6 bits. */
> -		u8 new = (a->nw_tos & 0x3f) | (nh->tos & 0xc0);
> -
> +		/* Set the DSCP bits and preserve the ECN bits. */
> +		new = (a->nw_tos & ~INET_ECN_MASK) | (nh->tos & INET_ECN_MASK);

Is there a reason to not use (a->nw_tos & IP_DSCP_MASK) instead of negating INET_ECN_MASK? It seems a bit clearer to me and more consistent with code dpif-netdev.c.

Otherwise looks good.

--Justin






More information about the dev mailing list