[ovs-dev] [runt-flows 7/8] datapath: Fix default value of skb transport_header.

Ben Pfaff blp at nicira.com
Fri Aug 13 17:55:46 UTC 2010


This commit started out as simply better documenting what flow_extract(),
but then I realized that skb_reset_transport_header() didn't do what I
thought it did, so this changes the code to do what I thought it did.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 datapath/flow.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/datapath/flow.c b/datapath/flow.c
index a68165e..bfef8b9 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -239,6 +239,17 @@ static __be16 parse_ethertype(struct sk_buff *skb)
  *
  * Returns 0 if successful, otherwise a negative errno value.
  *
+ * Initializes @skb header pointers as follows:
+ *
+ *    - skb->mac_header points to the Ethernet header.
+ *
+ *    - skb->network_header points just past the Ethernet header, or just past
+ *      the VLAN header, to the first byte of the Ethernet payload.
+ *
+ *    - skb->transport_header points just past the IPv4 header, if one is
+ *      present and of a correct length, to the first byte of e.g. the TCP,
+ *      UDP, or ICMP header.  Otherwise it equals skb->network_header.
+ *
  * Sets OVS_CB(skb)->is_frag to %true if @skb is an IPv4 fragment, otherwise to
  * %false.
  */
@@ -353,7 +364,7 @@ int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key)
 			}
 		}
 	} else {
-		skb_reset_transport_header(skb);
+		skb->transport_header = skb->network_header;
 	}
 	return 0;
 }
-- 
1.7.1





More information about the dev mailing list