lib: Add tpid parameter to eth_push_vlan()
authorSimon Horman <horms@verge.net.au>
Wed, 15 Jan 2014 08:17:01 +0000 (17:17 +0900)
committerBen Pfaff <blp@nicira.com>
Thu, 16 Jan 2014 22:38:21 +0000 (14:38 -0800)
This is in preparation for pushing vlan tags
using the TPID provided by the kernel via auxdata.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/cfm.c
lib/flow.c
lib/odp-execute.c
lib/packets.c
lib/packets.h
ofproto/bond.c
ofproto/ofproto-dpif-xlate.c

index bd2f6ea..583df1d 100644 (file)
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -554,7 +554,7 @@ cfm_compose_ccm(struct cfm *cfm, struct ofpbuf *packet,
 
     if (ccm_vlan || cfm->ccm_pcp) {
         uint16_t tci = ccm_vlan | (cfm->ccm_pcp << VLAN_PCP_SHIFT);
-        eth_push_vlan(packet, htons(tci));
+        eth_push_vlan(packet, htons(ETH_TYPE_VLAN), htons(tci));
     }
 
     ccm = packet->l3;
index f1d2cad..b1b9f98 100644 (file)
@@ -1168,7 +1168,7 @@ flow_compose(struct ofpbuf *b, const struct flow *flow)
     }
 
     if (flow->vlan_tci & htons(VLAN_CFI)) {
-        eth_push_vlan(b, flow->vlan_tci);
+        eth_push_vlan(b, htons(ETH_TYPE_VLAN), flow->vlan_tci);
     }
 
     if (flow->dl_type == htons(ETH_TYPE_IP)) {
index 5b77fa9..096c113 100644 (file)
@@ -205,7 +205,7 @@ odp_execute_actions__(void *dp, struct ofpbuf *packet, struct pkt_metadata *md,
 
         case OVS_ACTION_ATTR_PUSH_VLAN: {
             const struct ovs_action_push_vlan *vlan = nl_attr_get(a);
-            eth_push_vlan(packet, vlan->vlan_tci);
+            eth_push_vlan(packet, htons(ETH_TYPE_VLAN), vlan->vlan_tci);
             break;
         }
 
index d87aa8e..0d63841 100644 (file)
@@ -176,7 +176,7 @@ compose_rarp(struct ofpbuf *b, const uint8_t eth_src[ETH_ADDR_LEN])
  *
  * Also sets 'packet->l2' to point to the new Ethernet header. */
 void
-eth_push_vlan(struct ofpbuf *packet, ovs_be16 tci)
+eth_push_vlan(struct ofpbuf *packet, ovs_be16 tpid, ovs_be16 tci)
 {
     struct eth_header *eh = packet->data;
     struct vlan_eth_header *veh;
@@ -185,7 +185,7 @@ eth_push_vlan(struct ofpbuf *packet, ovs_be16 tci)
     struct vlan_eth_header tmp;
     memcpy(tmp.veth_dst, eh->eth_dst, ETH_ADDR_LEN);
     memcpy(tmp.veth_src, eh->eth_src, ETH_ADDR_LEN);
-    tmp.veth_type = htons(ETH_TYPE_VLAN);
+    tmp.veth_type = tpid;
     tmp.veth_tci = tci & htons(~VLAN_CFI);
     tmp.veth_next_type = eh->eth_type;
 
index 63873b0..8e21fa8 100644 (file)
@@ -151,7 +151,7 @@ bool eth_addr_from_string(const char *, uint8_t ea[ETH_ADDR_LEN]);
 
 void compose_rarp(struct ofpbuf *, const uint8_t eth_src[ETH_ADDR_LEN]);
 
-void eth_push_vlan(struct ofpbuf *, ovs_be16 tci);
+void eth_push_vlan(struct ofpbuf *, ovs_be16 tpid, ovs_be16 tci);
 void eth_pop_vlan(struct ofpbuf *);
 
 void set_ethertype(struct ofpbuf *packet, ovs_be16 eth_type);
index a651d8d..b4d9487 100644 (file)
@@ -541,7 +541,7 @@ bond_compose_learning_packet(struct bond *bond,
     packet = ofpbuf_new(0);
     compose_rarp(packet, eth_src);
     if (vlan) {
-        eth_push_vlan(packet, htons(vlan));
+        eth_push_vlan(packet, htons(ETH_TYPE_VLAN), htons(vlan));
     }
 
     *port_aux = slave->aux;
index b5b6171..c5e6600 100644 (file)
@@ -581,7 +581,7 @@ xlate_receive(const struct dpif_backer *backer, struct ofpbuf *packet,
              * an OpenFlow controller properly, so that it looks correct
              * for sFlow, and so that flow_extract() will get the correct
              * vlan_tci if it is called on 'packet'. */
-            eth_push_vlan(packet, flow->vlan_tci);
+            eth_push_vlan(packet, htons(ETH_TYPE_VLAN), flow->vlan_tci);
         }
         /* We can't reproduce 'key' from 'flow'. */
         fitness = fitness == ODP_FIT_PERFECT ? ODP_FIT_TOO_MUCH : fitness;