aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_netdev.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 7345c43b019e..bb536aa613f4 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -644,6 +644,7 @@ static int mlx4_en_get_qp(struct mlx4_en_priv *priv)
644 goto alloc_err; 644 goto alloc_err;
645 } 645 }
646 memcpy(entry->mac, priv->dev->dev_addr, sizeof(entry->mac)); 646 memcpy(entry->mac, priv->dev->dev_addr, sizeof(entry->mac));
647 memcpy(priv->current_mac, entry->mac, sizeof(priv->current_mac));
647 entry->reg_id = reg_id; 648 entry->reg_id = reg_id;
648 649
649 hlist_add_head_rcu(&entry->hlist, 650 hlist_add_head_rcu(&entry->hlist,
@@ -760,21 +761,22 @@ static int mlx4_en_replace_mac(struct mlx4_en_priv *priv, int qpn,
760 return __mlx4_replace_mac(dev, priv->port, qpn, new_mac_u64); 761 return __mlx4_replace_mac(dev, priv->port, qpn, new_mac_u64);
761} 762}
762 763
763static int mlx4_en_do_set_mac(struct mlx4_en_priv *priv) 764static int mlx4_en_do_set_mac(struct mlx4_en_priv *priv,
765 unsigned char new_mac[ETH_ALEN + 2])
764{ 766{
765 int err = 0; 767 int err = 0;
766 768
767 if (priv->port_up) { 769 if (priv->port_up) {
768 /* Remove old MAC and insert the new one */ 770 /* Remove old MAC and insert the new one */
769 err = mlx4_en_replace_mac(priv, priv->base_qpn, 771 err = mlx4_en_replace_mac(priv, priv->base_qpn,
770 priv->dev->dev_addr, priv->prev_mac); 772 new_mac, priv->current_mac);
771 if (err) 773 if (err)
772 en_err(priv, "Failed changing HW MAC address\n"); 774 en_err(priv, "Failed changing HW MAC address\n");
773 } else 775 } else
774 en_dbg(HW, priv, "Port is down while registering mac, exiting...\n"); 776 en_dbg(HW, priv, "Port is down while registering mac, exiting...\n");
775 777
776 memcpy(priv->prev_mac, priv->dev->dev_addr, 778 if (!err)
777 sizeof(priv->prev_mac)); 779 memcpy(priv->current_mac, new_mac, sizeof(priv->current_mac));
778 780
779 return err; 781 return err;
780} 782}
@@ -784,14 +786,17 @@ static int mlx4_en_set_mac(struct net_device *dev, void *addr)
784 struct mlx4_en_priv *priv = netdev_priv(dev); 786 struct mlx4_en_priv *priv = netdev_priv(dev);
785 struct mlx4_en_dev *mdev = priv->mdev; 787 struct mlx4_en_dev *mdev = priv->mdev;
786 struct sockaddr *saddr = addr; 788 struct sockaddr *saddr = addr;
789 unsigned char new_mac[ETH_ALEN + 2];
787 int err; 790 int err;
788 791
789 if (!is_valid_ether_addr(saddr->sa_data)) 792 if (!is_valid_ether_addr(saddr->sa_data))
790 return -EADDRNOTAVAIL; 793 return -EADDRNOTAVAIL;
791 794
792 mutex_lock(&mdev->state_lock); 795 mutex_lock(&mdev->state_lock);
793 memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN); 796 memcpy(new_mac, saddr->sa_data, ETH_ALEN);
794 err = mlx4_en_do_set_mac(priv); 797 err = mlx4_en_do_set_mac(priv, new_mac);
798 if (!err)
799 memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN);
795 mutex_unlock(&mdev->state_lock); 800 mutex_unlock(&mdev->state_lock);
796 801
797 return err; 802 return err;
@@ -940,11 +945,6 @@ static void mlx4_en_set_promisc_mode(struct mlx4_en_priv *priv,
940 0, MLX4_MCAST_DISABLE); 945 0, MLX4_MCAST_DISABLE);
941 if (err) 946 if (err)
942 en_err(priv, "Failed disabling multicast filter\n"); 947 en_err(priv, "Failed disabling multicast filter\n");
943
944 /* Disable port VLAN filter */
945 err = mlx4_SET_VLAN_FLTR(mdev->dev, priv);
946 if (err)
947 en_err(priv, "Failed disabling VLAN filter\n");
948 } 948 }
949} 949}
950 950
@@ -993,11 +993,6 @@ static void mlx4_en_clear_promisc_mode(struct mlx4_en_priv *priv,
993 en_err(priv, "Failed disabling promiscuous mode\n"); 993 en_err(priv, "Failed disabling promiscuous mode\n");
994 break; 994 break;
995 } 995 }
996
997 /* Enable port VLAN filter */
998 err = mlx4_SET_VLAN_FLTR(mdev->dev, priv);
999 if (err)
1000 en_err(priv, "Failed enabling VLAN filter\n");
1001} 996}
1002 997
1003static void mlx4_en_do_multicast(struct mlx4_en_priv *priv, 998static void mlx4_en_do_multicast(struct mlx4_en_priv *priv,
@@ -1166,7 +1161,8 @@ static void mlx4_en_do_uc_filter(struct mlx4_en_priv *priv,
1166 } 1161 }
1167 1162
1168 /* MAC address of the port is not in uc list */ 1163 /* MAC address of the port is not in uc list */
1169 if (ether_addr_equal_64bits(entry->mac, dev->dev_addr)) 1164 if (ether_addr_equal_64bits(entry->mac,
1165 priv->current_mac))
1170 found = true; 1166 found = true;
1171 1167
1172 if (!found) { 1168 if (!found) {
@@ -1476,7 +1472,7 @@ static void mlx4_en_do_get_stats(struct work_struct *work)
1476 queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY); 1472 queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY);
1477 } 1473 }
1478 if (mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port]) { 1474 if (mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port]) {
1479 mlx4_en_do_set_mac(priv); 1475 mlx4_en_do_set_mac(priv, priv->current_mac);
1480 mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port] = 0; 1476 mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port] = 0;
1481 } 1477 }
1482 mutex_unlock(&mdev->state_lock); 1478 mutex_unlock(&mdev->state_lock);
@@ -2469,6 +2465,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
2469 priv->port = port; 2465 priv->port = port;
2470 priv->port_up = false; 2466 priv->port_up = false;
2471 priv->flags = prof->flags; 2467 priv->flags = prof->flags;
2468 priv->pflags = MLX4_EN_PRIV_FLAGS_BLUEFLAME;
2472 priv->ctrl_flags = cpu_to_be32(MLX4_WQE_CTRL_CQ_UPDATE | 2469 priv->ctrl_flags = cpu_to_be32(MLX4_WQE_CTRL_CQ_UPDATE |
2473 MLX4_WQE_CTRL_SOLICITED); 2470 MLX4_WQE_CTRL_SOLICITED);
2474 priv->num_tx_rings_p_up = mdev->profile.num_tx_rings_p_up; 2471 priv->num_tx_rings_p_up = mdev->profile.num_tx_rings_p_up;
@@ -2535,7 +2532,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
2535 } 2532 }
2536 } 2533 }
2537 2534
2538 memcpy(priv->prev_mac, dev->dev_addr, sizeof(priv->prev_mac)); 2535 memcpy(priv->current_mac, dev->dev_addr, sizeof(priv->current_mac));
2539 2536
2540 priv->stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) + 2537 priv->stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) +
2541 DS_SIZE * MLX4_EN_MAX_RX_FRAGS); 2538 DS_SIZE * MLX4_EN_MAX_RX_FRAGS);