2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

datapath: VLAN actions should use push/pop semantics

Currently the kernel vlan actions mirror those used by OpenFlow 1.0.
i.e. MODIFY and STRIP. More flexible approach is to have an action to
push a tag and pop a tag off, so that it can handle multiple levels of vlan
tags. Plus it aligns with newer version of OpenFlow.
        As this patch replaces MODIFY with PUSH semantic, action
mapping done in userpace is fixed accordingly.
        GSO handling for multiple levels of vlan tags is also added as
Jesse suggested before.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
Pravin Shelar
2011-09-09 18:13:26 -07:00
parent f37c91c767
commit d9065a90b6
14 changed files with 232 additions and 75 deletions

View File

@@ -718,7 +718,7 @@ dpif_netdev_validate_actions(const struct nlattr *actions,
case OVS_ACTION_ATTR_USERSPACE:
break;
case OVS_ACTION_ATTR_SET_DL_TCI:
case OVS_ACTION_ATTR_PUSH_VLAN:
*mutates = true;
if (nl_attr_get_be16(a) & htons(VLAN_CFI)) {
return EINVAL;
@@ -732,7 +732,7 @@ dpif_netdev_validate_actions(const struct nlattr *actions,
}
break;
case OVS_ACTION_ATTR_STRIP_VLAN:
case OVS_ACTION_ATTR_POP_VLAN:
case OVS_ACTION_ATTR_SET_DL_SRC:
case OVS_ACTION_ATTR_SET_DL_DST:
case OVS_ACTION_ATTR_SET_NW_SRC:
@@ -1142,7 +1142,7 @@ dpif_netdev_wait(struct dpif *dpif)
}
static void
dp_netdev_strip_vlan(struct ofpbuf *packet)
dp_netdev_pop_vlan(struct ofpbuf *packet)
{
struct vlan_eth_header *veh = packet->l2;
if (packet->size >= sizeof *veh
@@ -1314,12 +1314,12 @@ dp_netdev_execute_actions(struct dp_netdev *dp,
key, nl_attr_get_u64(a));
break;
case OVS_ACTION_ATTR_SET_DL_TCI:
eth_set_vlan_tci(packet, nl_attr_get_be16(a));
case OVS_ACTION_ATTR_PUSH_VLAN:
eth_push_vlan(packet, nl_attr_get_be16(a));
break;
case OVS_ACTION_ATTR_STRIP_VLAN:
dp_netdev_strip_vlan(packet);
case OVS_ACTION_ATTR_POP_VLAN:
dp_netdev_pop_vlan(packet);
break;
case OVS_ACTION_ATTR_SET_DL_SRC: