X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fpackets.h;h=cc9ab3df6c1b139e192c9aa50788fc2d6b39126f;hb=25a27ba07c1acbda03c3ff08bf78e2921b48c90b;hp=0f97fe626cf6ca01ff2467bd5e654703467cb3fa;hpb=e8c16d83665f4a4e74e3cc7f736b3802b46f660c;p=sliver-openvswitch.git diff --git a/lib/packets.h b/lib/packets.h index 0f97fe626..cc9ab3df6 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -155,6 +155,7 @@ void set_mpls_lse(struct ofpbuf *, ovs_be32 label); void push_mpls(struct ofpbuf *packet, ovs_be16 ethtype, ovs_be32 lse); void pop_mpls(struct ofpbuf *, ovs_be16 ethtype); +void set_mpls_lse_ttl(ovs_be32 *lse, uint8_t ttl); void set_mpls_lse_tc(ovs_be32 *lse, uint8_t tc); void set_mpls_lse_label(ovs_be32 *lse, ovs_be32 label); void set_mpls_lse_bos(ovs_be32 *lse, uint8_t bos); @@ -258,6 +259,7 @@ BUILD_ASSERT_DECL(LLC_SNAP_HEADER_LEN == sizeof(struct llc_snap_header)); #define VLAN_PCP_SHIFT 13 #define VLAN_CFI 0x1000 +#define VLAN_CFI_SHIFT 12 /* Given the vlan_tci field from an 802.1Q header, in network byte order, * returns the VLAN ID in host byte order. */ @@ -275,6 +277,14 @@ vlan_tci_to_pcp(ovs_be16 vlan_tci) return (ntohs(vlan_tci) & VLAN_PCP_MASK) >> VLAN_PCP_SHIFT; } +/* Given the vlan_tci field from an 802.1Q header, in network byte order, + * returns the Canonical Format Indicator (CFI). */ +static inline int +vlan_tci_to_cfi(ovs_be16 vlan_tci) +{ + return (vlan_tci & htons(VLAN_CFI)) != 0; +} + #define VLAN_HEADER_LEN 4 struct vlan_header { ovs_be16 vlan_tci; /* Lowest 12 bits are VLAN ID. */