[ovs-dev] [bondlib 04/19] packets: Reserve headroom for VLAN header in eth_compose(), snap_compose().

Ben Pfaff blp at nicira.com
Tue Mar 29 09:29:09 PDT 2011


On Mon, Mar 28, 2011 at 01:43:41PM -0700, Ethan Jackson wrote:
> Looks Good to me.
> 
> It might be worth commenting why we are allocating and reserving
> VLAN_HEADER_LEN extra bytes.  That may confuse a future reader.

That's reasonable.  I folded this in:

diff --git a/lib/packets.c b/lib/packets.c
index e82eec4..d2229cd 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -221,7 +221,10 @@ ipv6_is_cidr(const struct in6_addr *netmask)
 /* Populates 'b' with an Ethernet II packet headed with the given 'eth_dst',
  * 'eth_src' and 'eth_type' parameters.  A payload of 'size' bytes is allocated
  * in 'b' and returned.  This payload may be populated with appropriate
- * information by the caller. */
+ * information by the caller.
+ *
+ * The returned packet has enough headroom to insert an 802.1Q VLAN header if
+ * desired. */
 void *
 eth_compose(struct ofpbuf *b, const uint8_t eth_dst[ETH_ADDR_LEN],
             const uint8_t eth_src[ETH_ADDR_LEN], uint16_t eth_type,
@@ -247,7 +250,10 @@ eth_compose(struct ofpbuf *b, const uint8_t eth_dst[ETH_ADDR_LEN],
 /* Populates 'b' with an Ethernet LLC+SNAP packet headed with the given
  * 'eth_dst', 'eth_src', 'snap_org', and 'snap_type'.  A payload of 'size'
  * bytes is allocated in 'b' and returned.  This payload may be populated with
- * appropriate information by the caller. */
+ * appropriate information by the caller.
+ *
+ * The returned packet has enough headroom to insert an 802.1Q VLAN header if
+ * desired. */
 void *
 snap_compose(struct ofpbuf *b, const uint8_t eth_dst[ETH_ADDR_LEN],
              const uint8_t eth_src[ETH_ADDR_LEN],



More information about the dev mailing list