2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-25 15:07:05 +00:00

lib: Add tpid parameter to eth_push_vlan()

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>
This commit is contained in:
Simon Horman
2014-01-15 17:17:01 +09:00
committed by Ben Pfaff
parent bfd3367b9e
commit 1bf02876a4
7 changed files with 8 additions and 8 deletions

View File

@@ -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;

View 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)) {

View 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;
}

View 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;

View 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);

View 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;

View 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;