aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox
diff options
context:
space:
mode:
authorHadar Hen Zion <hadarh@mellanox.com>2013-01-30 18:07:06 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-31 12:48:47 -0500
commit8258bd2713c3e42bc0e5664cbede0e07587c125f (patch)
treede8f4d4f4a18003df648592283194ceb264bc145 /drivers/net/ethernet/mellanox
parent69d7126b7fef09beaa4b7c103ec2a5bd8c8b2666 (diff)
net/mlx4_en: Fix vlan mask for ethtool steering rules
The vlan mask field should be validated and assigned according to the field size which is 12 bits. Also replace the numeric 0xfff mask with existing kernel macro. Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com> Signed-off-by: Amir Vadai <amirv@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_ethtool.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index f33049f9bfe7..f36c219dffcf 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -666,12 +666,16 @@ static int mlx4_en_validate_flow(struct net_device *dev,
666 666
667 if ((cmd->fs.flow_type & FLOW_EXT)) { 667 if ((cmd->fs.flow_type & FLOW_EXT)) {
668 if (cmd->fs.m_ext.vlan_etype || 668 if (cmd->fs.m_ext.vlan_etype ||
669 !(cmd->fs.m_ext.vlan_tci == 0 || 669 !((cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK)) ==
670 cmd->fs.m_ext.vlan_tci == cpu_to_be16(0xfff))) 670 0 ||
671 (cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK)) ==
672 cpu_to_be16(VLAN_VID_MASK)))
671 return -EINVAL; 673 return -EINVAL;
674
672 if (cmd->fs.m_ext.vlan_tci) { 675 if (cmd->fs.m_ext.vlan_tci) {
673 if (be16_to_cpu(cmd->fs.h_ext.vlan_tci) >= VLAN_N_VID) 676 if (be16_to_cpu(cmd->fs.h_ext.vlan_tci) >= VLAN_N_VID)
674 return -EINVAL; 677 return -EINVAL;
678
675 } 679 }
676 } 680 }
677 681
@@ -690,9 +694,10 @@ static int mlx4_en_ethtool_add_mac_rule(struct ethtool_rxnfc *cmd,
690 memcpy(spec_l2->eth.dst_mac_msk, &mac_msk, ETH_ALEN); 694 memcpy(spec_l2->eth.dst_mac_msk, &mac_msk, ETH_ALEN);
691 memcpy(spec_l2->eth.dst_mac, mac, ETH_ALEN); 695 memcpy(spec_l2->eth.dst_mac, mac, ETH_ALEN);
692 696
693 if ((cmd->fs.flow_type & FLOW_EXT) && cmd->fs.m_ext.vlan_tci) { 697 if ((cmd->fs.flow_type & FLOW_EXT) &&
698 (cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK))) {
694 spec_l2->eth.vlan_id = cmd->fs.h_ext.vlan_tci; 699 spec_l2->eth.vlan_id = cmd->fs.h_ext.vlan_tci;
695 spec_l2->eth.vlan_id_msk = cpu_to_be16(0xfff); 700 spec_l2->eth.vlan_id_msk = cpu_to_be16(VLAN_VID_MASK);
696 } 701 }
697 702
698 list_add_tail(&spec_l2->list, rule_list_h); 703 list_add_tail(&spec_l2->list, rule_list_h);