2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-02 07:15:17 +00:00

tc: Add VLAN tpid for push action

Currently we only support 802.1q, so we can offload push action without
specifying any vlan type. Kernel will push 802.1q ethertype by default.

But to support QinQ, we need to tell what ethertype is in push action as
it could be 802.1ad.

Signed-off-by: Jianbo Liu <jianbol@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
This commit is contained in:
Jianbo Liu
2018-07-17 02:01:54 +00:00
committed by Simon Horman
parent 024810cf4b
commit 61e8655cfc
3 changed files with 8 additions and 1 deletions

View File

@@ -1077,6 +1077,7 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match,
} else if (nl_attr_type(nla) == OVS_ACTION_ATTR_PUSH_VLAN) {
const struct ovs_action_push_vlan *vlan_push = nl_attr_get(nla);
action->vlan.vlan_push_tpid = vlan_push->vlan_tpid;
action->vlan.vlan_push_id = vlan_tci_to_vid(vlan_push->vlan_tci);
action->vlan.vlan_push_prio = vlan_tci_to_pcp(vlan_push->vlan_tci);
action->type = TC_ACT_VLAN_PUSH;

View File

@@ -784,9 +784,11 @@ nl_parse_act_vlan(struct nlattr *options, struct tc_flower *flower)
vlan_parms = vlan_attrs[TCA_VLAN_PARMS];
v = nl_attr_get_unspec(vlan_parms, sizeof *v);
if (v->v_action == TCA_VLAN_ACT_PUSH) {
struct nlattr *vlan_tpid = vlan_attrs[TCA_VLAN_PUSH_VLAN_PROTOCOL];
struct nlattr *vlan_id = vlan_attrs[TCA_VLAN_PUSH_VLAN_ID];
struct nlattr *vlan_prio = vlan_attrs[TCA_VLAN_PUSH_VLAN_PRIORITY];
action->vlan.vlan_push_tpid = nl_attr_get_u16(vlan_tpid);
action->vlan.vlan_push_id = nl_attr_get_u16(vlan_id);
action->vlan.vlan_push_prio = vlan_prio ? nl_attr_get_u8(vlan_prio) : 0;
action->type = TC_ACT_VLAN_PUSH;
@@ -1158,7 +1160,8 @@ nl_msg_put_act_pedit(struct ofpbuf *request, struct tc_pedit *parm,
}
static void
nl_msg_put_act_push_vlan(struct ofpbuf *request, uint16_t vid, uint8_t prio)
nl_msg_put_act_push_vlan(struct ofpbuf *request, uint16_t tpid,
uint16_t vid, uint8_t prio)
{
size_t offset;
@@ -1169,6 +1172,7 @@ nl_msg_put_act_push_vlan(struct ofpbuf *request, uint16_t vid, uint8_t prio)
.v_action = TCA_VLAN_ACT_PUSH };
nl_msg_put_unspec(request, TCA_VLAN_PARMS, &parm, sizeof parm);
nl_msg_put_u16(request, TCA_VLAN_PUSH_VLAN_PROTOCOL, tpid);
nl_msg_put_u16(request, TCA_VLAN_PUSH_VLAN_ID, vid);
nl_msg_put_u8(request, TCA_VLAN_PUSH_VLAN_PRIORITY, prio);
}
@@ -1489,6 +1493,7 @@ nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower)
case TC_ACT_VLAN_PUSH: {
act_offset = nl_msg_start_nested(request, act_index++);
nl_msg_put_act_push_vlan(request,
action->vlan.vlan_push_tpid,
action->vlan.vlan_push_id,
action->vlan.vlan_push_prio);
nl_msg_end_nested(request, act_offset);

View File

@@ -119,6 +119,7 @@ struct tc_action {
int ifindex_out;
struct {
ovs_be16 vlan_push_tpid;
uint16_t vlan_push_id;
uint8_t vlan_push_prio;
} vlan;