@@ -2578,6 +2578,32 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
2578
2578
return err ;
2579
2579
}
2580
2580
2581
+ static int parse_tc_vlan_action (struct mlx5e_priv * priv ,
2582
+ const struct tc_action * a ,
2583
+ struct mlx5_esw_flow_attr * attr ,
2584
+ u32 * action )
2585
+ {
2586
+ if (tcf_vlan_action (a ) == TCA_VLAN_ACT_POP ) {
2587
+ * action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_POP ;
2588
+ } else if (tcf_vlan_action (a ) == TCA_VLAN_ACT_PUSH ) {
2589
+ * action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH ;
2590
+ attr -> vlan_vid [0 ] = tcf_vlan_push_vid (a );
2591
+ if (mlx5_eswitch_vlan_actions_supported (priv -> mdev )) {
2592
+ attr -> vlan_prio [0 ] = tcf_vlan_push_prio (a );
2593
+ attr -> vlan_proto [0 ] = tcf_vlan_push_proto (a );
2594
+ if (!attr -> vlan_proto [0 ])
2595
+ attr -> vlan_proto [0 ] = htons (ETH_P_8021Q );
2596
+ } else if (tcf_vlan_push_proto (a ) != htons (ETH_P_8021Q ) ||
2597
+ tcf_vlan_push_prio (a )) {
2598
+ return - EOPNOTSUPP ;
2599
+ }
2600
+ } else { /* action is TCA_VLAN_ACT_MODIFY */
2601
+ return - EOPNOTSUPP ;
2602
+ }
2603
+
2604
+ return 0 ;
2605
+ }
2606
+
2581
2607
static int parse_tc_fdb_actions (struct mlx5e_priv * priv , struct tcf_exts * exts ,
2582
2608
struct mlx5e_tc_flow_parse_attr * parse_attr ,
2583
2609
struct mlx5e_tc_flow * flow )
@@ -2589,6 +2615,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
2589
2615
LIST_HEAD (actions );
2590
2616
bool encap = false;
2591
2617
u32 action = 0 ;
2618
+ int err ;
2592
2619
2593
2620
if (!tcf_exts_has_actions (exts ))
2594
2621
return - EINVAL ;
@@ -2605,8 +2632,6 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
2605
2632
}
2606
2633
2607
2634
if (is_tcf_pedit (a )) {
2608
- int err ;
2609
-
2610
2635
err = parse_tc_pedit_action (priv , a , MLX5_FLOW_NAMESPACE_FDB ,
2611
2636
parse_attr );
2612
2637
if (err )
@@ -2673,23 +2698,11 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
2673
2698
}
2674
2699
2675
2700
if (is_tcf_vlan (a )) {
2676
- if (tcf_vlan_action (a ) == TCA_VLAN_ACT_POP ) {
2677
- action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_POP ;
2678
- } else if (tcf_vlan_action (a ) == TCA_VLAN_ACT_PUSH ) {
2679
- action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH ;
2680
- attr -> vlan_vid = tcf_vlan_push_vid (a );
2681
- if (mlx5_eswitch_vlan_actions_supported (priv -> mdev )) {
2682
- attr -> vlan_prio = tcf_vlan_push_prio (a );
2683
- attr -> vlan_proto = tcf_vlan_push_proto (a );
2684
- if (!attr -> vlan_proto )
2685
- attr -> vlan_proto = htons (ETH_P_8021Q );
2686
- } else if (tcf_vlan_push_proto (a ) != htons (ETH_P_8021Q ) ||
2687
- tcf_vlan_push_prio (a )) {
2688
- return - EOPNOTSUPP ;
2689
- }
2690
- } else { /* action is TCA_VLAN_ACT_MODIFY */
2691
- return - EOPNOTSUPP ;
2692
- }
2701
+ err = parse_tc_vlan_action (priv , a , attr , & action );
2702
+
2703
+ if (err )
2704
+ return err ;
2705
+
2693
2706
attr -> mirror_count = attr -> out_count ;
2694
2707
continue ;
2695
2708
}
0 commit comments