net/mlx5e: Offload tc vlan push/pop using HW action
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / en_tc.c
index 7c33df2034f07d69a04b6a1d6365500d1dd70261..3e4a7e81b67f0c94069324e95a2fcb701cf20c43 100644 (file)
@@ -2530,12 +2530,17 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
                        if (tcf_vlan_action(a) == TCA_VLAN_ACT_POP) {
                                attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_POP;
                        } else if (tcf_vlan_action(a) == TCA_VLAN_ACT_PUSH) {
-                               if (tcf_vlan_push_proto(a) != htons(ETH_P_8021Q) ||
-                                   tcf_vlan_push_prio(a))
-                                       return -EOPNOTSUPP;
-
                                attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH;
-                               attr->vlan = tcf_vlan_push_vid(a);
+                               attr->vlan_vid = tcf_vlan_push_vid(a);
+                               if (mlx5_eswitch_vlan_actions_supported(priv->mdev)) {
+                                       attr->vlan_prio = tcf_vlan_push_prio(a);
+                                       attr->vlan_proto = tcf_vlan_push_proto(a);
+                                       if (!attr->vlan_proto)
+                                               attr->vlan_proto = htons(ETH_P_8021Q);
+                               } else if (tcf_vlan_push_proto(a) != htons(ETH_P_8021Q) ||
+                                          tcf_vlan_push_prio(a)) {
+                                       return -EOPNOTSUPP;
+                               }
                        } else { /* action is TCA_VLAN_ACT_MODIFY */
                                return -EOPNOTSUPP;
                        }