This is in preparation for pushing vlan tags
using the TPID provided by the kernel via auxdata.

Signed-off-by: Simon Horman <ho...@verge.net.au>

---
v5
* No change

v4
* First post
---
 lib/cfm.c                    | 2 +-
 lib/flow.c                   | 2 +-
 lib/odp-execute.c            | 2 +-
 lib/packets.c                | 4 ++--
 lib/packets.h                | 2 +-
 ofproto/bond.c               | 2 +-
 ofproto/ofproto-dpif-xlate.c | 2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/cfm.c b/lib/cfm.c
index bd2f6ea..583df1d 100644
--- 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;
diff --git a/lib/flow.c b/lib/flow.c
index f1d2cad..b1b9f98 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -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)) {
diff --git a/lib/odp-execute.c b/lib/odp-execute.c
index 5b77fa9..096c113 100644
--- a/lib/odp-execute.c
+++ b/lib/odp-execute.c
@@ -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;
         }
 
diff --git a/lib/packets.c b/lib/packets.c
index d87aa8e..0d63841 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -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;
 
diff --git a/lib/packets.h b/lib/packets.h
index 63873b0..8e21fa8 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -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);
diff --git a/ofproto/bond.c b/ofproto/bond.c
index a651d8d..b4d9487 100644
--- a/ofproto/bond.c
+++ b/ofproto/bond.c
@@ -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;
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index e73b7eb..4020f78 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -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;
-- 
1.8.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to