diff options
| author | Yan Burman <yanb@mellanox.com> | 2012-12-11 21:13:19 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2012-12-12 13:02:30 -0500 |
| commit | 520dfe3a3645257bf83660f672c47f8558f3d4c4 (patch) | |
| tree | 9d8634ad557daaa72561d6b912fcf99e7877f2ff | |
| parent | c402b9477b44f768c232726d10bd103ec6e46b07 (diff) | |
net/mlx4_en: Add support for destination MAC in steering rules
Implement destination MAC rule extension for L3/L4 rules in
flow steering. Usefull for vSwitch/macvlan configurations.
Signed-off-by: Yan Burman <yanb@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index cc7bb25c7e40..03447dad07e9 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
| @@ -617,7 +617,13 @@ static int mlx4_en_validate_flow(struct net_device *dev, | |||
| 617 | if (cmd->fs.location >= MAX_NUM_OF_FS_RULES) | 617 | if (cmd->fs.location >= MAX_NUM_OF_FS_RULES) |
| 618 | return -EINVAL; | 618 | return -EINVAL; |
| 619 | 619 | ||
| 620 | switch (cmd->fs.flow_type & ~FLOW_EXT) { | 620 | if (cmd->fs.flow_type & FLOW_MAC_EXT) { |
| 621 | /* dest mac mask must be ff:ff:ff:ff:ff:ff */ | ||
| 622 | if (!is_broadcast_ether_addr(cmd->fs.m_ext.h_dest)) | ||
| 623 | return -EINVAL; | ||
| 624 | } | ||
| 625 | |||
| 626 | switch (cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { | ||
| 621 | case TCP_V4_FLOW: | 627 | case TCP_V4_FLOW: |
| 622 | case UDP_V4_FLOW: | 628 | case UDP_V4_FLOW: |
| 623 | if (cmd->fs.m_u.tcp_ip4_spec.tos) | 629 | if (cmd->fs.m_u.tcp_ip4_spec.tos) |
| @@ -745,7 +751,6 @@ static int mlx4_en_ethtool_to_net_trans_rule(struct net_device *dev, | |||
| 745 | struct list_head *rule_list_h) | 751 | struct list_head *rule_list_h) |
| 746 | { | 752 | { |
| 747 | int err; | 753 | int err; |
| 748 | u64 mac; | ||
| 749 | __be64 be_mac; | 754 | __be64 be_mac; |
| 750 | struct ethhdr *eth_spec; | 755 | struct ethhdr *eth_spec; |
| 751 | struct mlx4_en_priv *priv = netdev_priv(dev); | 756 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| @@ -760,12 +765,16 @@ static int mlx4_en_ethtool_to_net_trans_rule(struct net_device *dev, | |||
| 760 | if (!spec_l2) | 765 | if (!spec_l2) |
| 761 | return -ENOMEM; | 766 | return -ENOMEM; |
| 762 | 767 | ||
| 763 | mac = priv->mac & MLX4_MAC_MASK; | 768 | if (cmd->fs.flow_type & FLOW_MAC_EXT) { |
| 764 | be_mac = cpu_to_be64(mac << 16); | 769 | memcpy(&be_mac, cmd->fs.h_ext.h_dest, ETH_ALEN); |
| 770 | } else { | ||
| 771 | u64 mac = priv->mac & MLX4_MAC_MASK; | ||
| 772 | be_mac = cpu_to_be64(mac << 16); | ||
| 773 | } | ||
| 765 | 774 | ||
| 766 | spec_l2->id = MLX4_NET_TRANS_RULE_ID_ETH; | 775 | spec_l2->id = MLX4_NET_TRANS_RULE_ID_ETH; |
| 767 | memcpy(spec_l2->eth.dst_mac_msk, &mac_msk, ETH_ALEN); | 776 | memcpy(spec_l2->eth.dst_mac_msk, &mac_msk, ETH_ALEN); |
| 768 | if ((cmd->fs.flow_type & ~FLOW_EXT) != ETHER_FLOW) | 777 | if ((cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) != ETHER_FLOW) |
| 769 | memcpy(spec_l2->eth.dst_mac, &be_mac, ETH_ALEN); | 778 | memcpy(spec_l2->eth.dst_mac, &be_mac, ETH_ALEN); |
| 770 | 779 | ||
| 771 | if ((cmd->fs.flow_type & FLOW_EXT) && cmd->fs.m_ext.vlan_tci) { | 780 | if ((cmd->fs.flow_type & FLOW_EXT) && cmd->fs.m_ext.vlan_tci) { |
| @@ -775,7 +784,7 @@ static int mlx4_en_ethtool_to_net_trans_rule(struct net_device *dev, | |||
| 775 | 784 | ||
| 776 | list_add_tail(&spec_l2->list, rule_list_h); | 785 | list_add_tail(&spec_l2->list, rule_list_h); |
| 777 | 786 | ||
| 778 | switch (cmd->fs.flow_type & ~FLOW_EXT) { | 787 | switch (cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { |
| 779 | case ETHER_FLOW: | 788 | case ETHER_FLOW: |
| 780 | eth_spec = &cmd->fs.h_u.ether_spec; | 789 | eth_spec = &cmd->fs.h_u.ether_spec; |
| 781 | memcpy(&spec_l2->eth.dst_mac, eth_spec->h_dest, ETH_ALEN); | 790 | memcpy(&spec_l2->eth.dst_mac, eth_spec->h_dest, ETH_ALEN); |
