|
34 | 34 |
|
35 | 35 | #include <net/tc_act/tc_gact.h>
|
36 | 36 | #include <net/tc_act/tc_mirred.h>
|
| 37 | +#include <net/tc_act/tc_vlan.h> |
37 | 38 |
|
38 | 39 | #include "cxgb4.h"
|
39 | 40 | #include "cxgb4_tc_flower.h"
|
@@ -185,6 +186,27 @@ static void cxgb4_process_flow_actions(struct net_device *in,
|
185 | 186 |
|
186 | 187 | fs->action = FILTER_SWITCH;
|
187 | 188 | fs->eport = pi->port_id;
|
| 189 | + } else if (is_tcf_vlan(a)) { |
| 190 | + u32 vlan_action = tcf_vlan_action(a); |
| 191 | + u8 prio = tcf_vlan_push_prio(a); |
| 192 | + u16 vid = tcf_vlan_push_vid(a); |
| 193 | + u16 vlan_tci = (prio << VLAN_PRIO_SHIFT) | vid; |
| 194 | + |
| 195 | + switch (vlan_action) { |
| 196 | + case TCA_VLAN_ACT_POP: |
| 197 | + fs->newvlan |= VLAN_REMOVE; |
| 198 | + break; |
| 199 | + case TCA_VLAN_ACT_PUSH: |
| 200 | + fs->newvlan |= VLAN_INSERT; |
| 201 | + fs->vlan = vlan_tci; |
| 202 | + break; |
| 203 | + case TCA_VLAN_ACT_MODIFY: |
| 204 | + fs->newvlan |= VLAN_REWRITE; |
| 205 | + fs->vlan = vlan_tci; |
| 206 | + break; |
| 207 | + default: |
| 208 | + break; |
| 209 | + } |
188 | 210 | }
|
189 | 211 | }
|
190 | 212 | }
|
@@ -222,6 +244,26 @@ static int cxgb4_validate_flow_actions(struct net_device *dev,
|
222 | 244 | __func__);
|
223 | 245 | return -EINVAL;
|
224 | 246 | }
|
| 247 | + } else if (is_tcf_vlan(a)) { |
| 248 | + u16 proto = be16_to_cpu(tcf_vlan_push_proto(a)); |
| 249 | + u32 vlan_action = tcf_vlan_action(a); |
| 250 | + |
| 251 | + switch (vlan_action) { |
| 252 | + case TCA_VLAN_ACT_POP: |
| 253 | + break; |
| 254 | + case TCA_VLAN_ACT_PUSH: |
| 255 | + case TCA_VLAN_ACT_MODIFY: |
| 256 | + if (proto != ETH_P_8021Q) { |
| 257 | + netdev_err(dev, "%s: Unsupported vlan proto\n", |
| 258 | + __func__); |
| 259 | + return -EOPNOTSUPP; |
| 260 | + } |
| 261 | + break; |
| 262 | + default: |
| 263 | + netdev_err(dev, "%s: Unsupported vlan action\n", |
| 264 | + __func__); |
| 265 | + return -EOPNOTSUPP; |
| 266 | + } |
225 | 267 | } else {
|
226 | 268 | netdev_err(dev, "%s: Unsupported action\n", __func__);
|
227 | 269 | return -EOPNOTSUPP;
|
|
0 commit comments