mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
datapath: Describe policy for extending flow key, implement needed changes.
When the datapath was converted to use Netlink attributes for describing flow keys, I had a vague idea of how it could be smoothly extensible, but I didn't actually implement extensibility or carefully think it through. This commit adds a document that describes how flow keys can be extended in a compatible fashion and adapts the existing interface to match what it says. This commit doesn't actually implement extensibility. I already have a separate patch series out for that. This patch series borrows from that one heavily, but the extensibility series will need to be reworked somewhat once this one is in. This commit is only lightly tested because I don't have a good test setup for VLANs. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
@@ -1274,10 +1274,11 @@ execute_set_action(struct ofpbuf *packet, const struct nlattr *a)
|
||||
break;
|
||||
|
||||
case OVS_KEY_ATTR_UNSPEC:
|
||||
case OVS_KEY_ATTR_ENCAP:
|
||||
case OVS_KEY_ATTR_ETHERTYPE:
|
||||
case OVS_KEY_ATTR_IPV6:
|
||||
case OVS_KEY_ATTR_IN_PORT:
|
||||
case OVS_KEY_ATTR_8021Q:
|
||||
case OVS_KEY_ATTR_VLAN:
|
||||
case OVS_KEY_ATTR_ICMP:
|
||||
case OVS_KEY_ATTR_ICMPV6:
|
||||
case OVS_KEY_ATTR_ARP:
|
||||
@@ -1298,8 +1299,7 @@ dp_netdev_execute_actions(struct dp_netdev *dp,
|
||||
unsigned int left;
|
||||
|
||||
NL_ATTR_FOR_EACH_UNSAFE (a, left, actions, actions_len) {
|
||||
const struct nlattr *nested;
|
||||
const struct ovs_key_8021q *q_key;
|
||||
const struct ovs_action_push_vlan *vlan;
|
||||
int type = nl_attr_type(a);
|
||||
|
||||
switch ((enum ovs_action_attr) type) {
|
||||
@@ -1311,15 +1311,12 @@ dp_netdev_execute_actions(struct dp_netdev *dp,
|
||||
dp_netdev_action_userspace(dp, packet, key, a);
|
||||
break;
|
||||
|
||||
case OVS_ACTION_ATTR_PUSH:
|
||||
nested = nl_attr_get(a);
|
||||
assert(nl_attr_type(nested) == OVS_KEY_ATTR_8021Q);
|
||||
q_key = nl_attr_get_unspec(nested, sizeof(*q_key));
|
||||
eth_push_vlan(packet, q_key->q_tci);
|
||||
case OVS_ACTION_ATTR_PUSH_VLAN:
|
||||
vlan = nl_attr_get(a);
|
||||
eth_push_vlan(packet, vlan->vlan_tci);
|
||||
break;
|
||||
|
||||
case OVS_ACTION_ATTR_POP:
|
||||
assert(nl_attr_get_u16(a) == OVS_KEY_ATTR_8021Q);
|
||||
case OVS_ACTION_ATTR_POP_VLAN:
|
||||
dp_netdev_pop_vlan(packet);
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user