diff options
author | Rony Efraim <ronye@mellanox.com> | 2013-05-08 18:22:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-11 19:12:44 -0400 |
commit | 7677fc965fba41d1386fa3b76a1f00303f02bb2d (patch) | |
tree | 1324b8af989563dea62f9bc7f952c411f8d8a2dd /drivers/net/ethernet/mellanox | |
parent | 4e8cf5b8a1da8dbe1ece5f084b99f5c902ea709b (diff) |
net/mlx4: Strengthen VLAN tags/priorities enforcement in VST mode
Make sure that the following steps are taken:
- drop packets sent by the VF with vlan tag
- block packets with vlan tag which are steered to the VF
- drop/block tagged packets when the policy is priority-tagged
- make sure VLAN stripping for received packets is set
- make sure force UP bit for the VF QP is set
Use enum values for all the above instead of numerical bit offsets.
Signed-off-by: Rony Efraim <ronye@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_resources.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 20 |
2 files changed, 18 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_resources.c b/drivers/net/ethernet/mellanox/mlx4/en_resources.c index 91f2b2c43c12..d3f508697a3d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_resources.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_resources.c | |||
@@ -60,7 +60,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, | |||
60 | context->pri_path.sched_queue = 0x83 | (priv->port - 1) << 6; | 60 | context->pri_path.sched_queue = 0x83 | (priv->port - 1) << 6; |
61 | if (user_prio >= 0) { | 61 | if (user_prio >= 0) { |
62 | context->pri_path.sched_queue |= user_prio << 3; | 62 | context->pri_path.sched_queue |= user_prio << 3; |
63 | context->pri_path.feup = 1 << 6; | 63 | context->pri_path.feup = MLX4_FEUP_FORCE_ETH_UP; |
64 | } | 64 | } |
65 | context->pri_path.counter_index = 0xff; | 65 | context->pri_path.counter_index = 0xff; |
66 | context->cqn_send = cpu_to_be32(cqn); | 66 | context->cqn_send = cpu_to_be32(cqn); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index d4a9de666fbd..1157f028a90f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -372,14 +372,28 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
372 | if (MLX4_QP_ST_RC == qp_type) | 372 | if (MLX4_QP_ST_RC == qp_type) |
373 | return -EINVAL; | 373 | return -EINVAL; |
374 | 374 | ||
375 | /* force strip vlan by clear vsd */ | ||
376 | qpc->param3 &= ~cpu_to_be32(MLX4_STRIP_VLAN); | ||
377 | if (0 != vp_oper->state.default_vlan) { | ||
378 | qpc->pri_path.vlan_control = | ||
379 | MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED | | ||
380 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED | | ||
381 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED; | ||
382 | } else { /* priority tagged */ | ||
383 | qpc->pri_path.vlan_control = | ||
384 | MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED | | ||
385 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED; | ||
386 | } | ||
387 | |||
388 | qpc->pri_path.fvl_rx |= MLX4_FVL_RX_FORCE_ETH_VLAN; | ||
375 | qpc->pri_path.vlan_index = vp_oper->vlan_idx; | 389 | qpc->pri_path.vlan_index = vp_oper->vlan_idx; |
376 | qpc->pri_path.fl = (1 << 6) | (1 << 2); /* set cv bit and hide_cqe_vlan bit*/ | 390 | qpc->pri_path.fl |= MLX4_FL_CV | MLX4_FL_ETH_HIDE_CQE_VLAN; |
377 | qpc->pri_path.feup |= 1 << 3; /* set fvl bit */ | 391 | qpc->pri_path.feup |= MLX4_FEUP_FORCE_ETH_UP | MLX4_FVL_FORCE_ETH_VLAN; |
378 | qpc->pri_path.sched_queue &= 0xC7; | 392 | qpc->pri_path.sched_queue &= 0xC7; |
379 | qpc->pri_path.sched_queue |= (vp_oper->state.default_qos) << 3; | 393 | qpc->pri_path.sched_queue |= (vp_oper->state.default_qos) << 3; |
380 | } | 394 | } |
381 | if (vp_oper->state.spoofchk) { | 395 | if (vp_oper->state.spoofchk) { |
382 | qpc->pri_path.feup |= 1 << 5; /* set fsm bit */; | 396 | qpc->pri_path.feup |= MLX4_FSM_FORCE_ETH_SRC_MAC; |
383 | qpc->pri_path.grh_mylmc = (0x80 & qpc->pri_path.grh_mylmc) + vp_oper->mac_idx; | 397 | qpc->pri_path.grh_mylmc = (0x80 & qpc->pri_path.grh_mylmc) + vp_oper->mac_idx; |
384 | } | 398 | } |
385 | return 0; | 399 | return 0; |