Commit ab95465c authored by Maor Dickman's avatar Maor Dickman Committed by Jakub Kicinski

net/sched: add vlan push_eth and pop_eth action to the hardware IR

Add vlan push_eth and pop_eth action to the hardware intermediate
representation model which would subsequently allow it to be used
by drivers for offload.
Signed-off-by: default avatarMaor Dickman <maord@nvidia.com>
Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent a860352e
...@@ -150,6 +150,8 @@ enum flow_action_id { ...@@ -150,6 +150,8 @@ enum flow_action_id {
FLOW_ACTION_PPPOE_PUSH, FLOW_ACTION_PPPOE_PUSH,
FLOW_ACTION_JUMP, FLOW_ACTION_JUMP,
FLOW_ACTION_PIPE, FLOW_ACTION_PIPE,
FLOW_ACTION_VLAN_PUSH_ETH,
FLOW_ACTION_VLAN_POP_ETH,
NUM_FLOW_ACTIONS, NUM_FLOW_ACTIONS,
}; };
...@@ -211,6 +213,10 @@ struct flow_action_entry { ...@@ -211,6 +213,10 @@ struct flow_action_entry {
__be16 proto; __be16 proto;
u8 prio; u8 prio;
} vlan; } vlan;
struct { /* FLOW_ACTION_VLAN_PUSH_ETH */
unsigned char dst[ETH_ALEN];
unsigned char src[ETH_ALEN];
} vlan_push_eth;
struct { /* FLOW_ACTION_MANGLE */ struct { /* FLOW_ACTION_MANGLE */
/* FLOW_ACTION_ADD */ /* FLOW_ACTION_ADD */
enum flow_action_mangle_base htype; enum flow_action_mangle_base htype;
......
...@@ -78,4 +78,14 @@ static inline u8 tcf_vlan_push_prio(const struct tc_action *a) ...@@ -78,4 +78,14 @@ static inline u8 tcf_vlan_push_prio(const struct tc_action *a)
return tcfv_push_prio; return tcfv_push_prio;
} }
static inline void tcf_vlan_push_eth(unsigned char *src, unsigned char *dest,
const struct tc_action *a)
{
rcu_read_lock();
memcpy(dest, rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_dst, ETH_ALEN);
memcpy(dest, rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_src, ETH_ALEN);
rcu_read_unlock();
}
#endif /* __NET_TC_VLAN_H */ #endif /* __NET_TC_VLAN_H */
...@@ -390,6 +390,13 @@ static int tcf_vlan_offload_act_setup(struct tc_action *act, void *entry_data, ...@@ -390,6 +390,13 @@ static int tcf_vlan_offload_act_setup(struct tc_action *act, void *entry_data,
entry->vlan.proto = tcf_vlan_push_proto(act); entry->vlan.proto = tcf_vlan_push_proto(act);
entry->vlan.prio = tcf_vlan_push_prio(act); entry->vlan.prio = tcf_vlan_push_prio(act);
break; break;
case TCA_VLAN_ACT_POP_ETH:
entry->id = FLOW_ACTION_VLAN_POP_ETH;
break;
case TCA_VLAN_ACT_PUSH_ETH:
entry->id = FLOW_ACTION_VLAN_PUSH_ETH;
tcf_vlan_push_eth(entry->vlan_push_eth.src, entry->vlan_push_eth.dst, act);
break;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -407,6 +414,12 @@ static int tcf_vlan_offload_act_setup(struct tc_action *act, void *entry_data, ...@@ -407,6 +414,12 @@ static int tcf_vlan_offload_act_setup(struct tc_action *act, void *entry_data,
case TCA_VLAN_ACT_MODIFY: case TCA_VLAN_ACT_MODIFY:
fl_action->id = FLOW_ACTION_VLAN_MANGLE; fl_action->id = FLOW_ACTION_VLAN_MANGLE;
break; break;
case TCA_VLAN_ACT_POP_ETH:
fl_action->id = FLOW_ACTION_VLAN_POP_ETH;
break;
case TCA_VLAN_ACT_PUSH_ETH:
fl_action->id = FLOW_ACTION_VLAN_PUSH_ETH;
break;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment