aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cmd.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c20
4 files changed, 26 insertions, 23 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 1df56cc50ee9..0e572a527154 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -222,8 +222,6 @@ static int mlx4_comm_cmd_poll(struct mlx4_dev *dev, u8 cmd, u16 param,
222 * FLR process. The only non-zero result in the RESET command 222 * FLR process. The only non-zero result in the RESET command
223 * is MLX4_DELAY_RESET_SLAVE*/ 223 * is MLX4_DELAY_RESET_SLAVE*/
224 if ((MLX4_COMM_CMD_RESET == cmd)) { 224 if ((MLX4_COMM_CMD_RESET == cmd)) {
225 mlx4_warn(dev, "Got slave FLRed from Communication"
226 " channel (ret:0x%x)\n", ret_from_pending);
227 err = MLX4_DELAY_RESET_SLAVE; 225 err = MLX4_DELAY_RESET_SLAVE;
228 } else { 226 } else {
229 mlx4_warn(dev, "Communication channel timed out\n"); 227 mlx4_warn(dev, "Communication channel timed out\n");
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index b35f94700093..89c47ea84b50 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1323,6 +1323,7 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv)
1323 priv->last_moder_time[ring] = moder_time; 1323 priv->last_moder_time[ring] = moder_time;
1324 cq = &priv->rx_cq[ring]; 1324 cq = &priv->rx_cq[ring];
1325 cq->moder_time = moder_time; 1325 cq->moder_time = moder_time;
1326 cq->moder_cnt = priv->rx_frames;
1326 err = mlx4_en_set_cq_moder(priv, cq); 1327 err = mlx4_en_set_cq_moder(priv, cq);
1327 if (err) 1328 if (err)
1328 en_err(priv, "Failed modifying moderation for cq:%d\n", 1329 en_err(priv, "Failed modifying moderation for cq:%d\n",
@@ -2118,6 +2119,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
2118 struct mlx4_en_priv *priv; 2119 struct mlx4_en_priv *priv;
2119 int i; 2120 int i;
2120 int err; 2121 int err;
2122 u64 mac_u64;
2121 2123
2122 dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), 2124 dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv),
2123 MAX_TX_RINGS, MAX_RX_RINGS); 2125 MAX_TX_RINGS, MAX_RX_RINGS);
@@ -2191,10 +2193,17 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
2191 dev->addr_len = ETH_ALEN; 2193 dev->addr_len = ETH_ALEN;
2192 mlx4_en_u64_to_mac(dev->dev_addr, mdev->dev->caps.def_mac[priv->port]); 2194 mlx4_en_u64_to_mac(dev->dev_addr, mdev->dev->caps.def_mac[priv->port]);
2193 if (!is_valid_ether_addr(dev->dev_addr)) { 2195 if (!is_valid_ether_addr(dev->dev_addr)) {
2194 en_err(priv, "Port: %d, invalid mac burned: %pM, quiting\n", 2196 if (mlx4_is_slave(priv->mdev->dev)) {
2195 priv->port, dev->dev_addr); 2197 eth_hw_addr_random(dev);
2196 err = -EINVAL; 2198 en_warn(priv, "Assigned random MAC address %pM\n", dev->dev_addr);
2197 goto out; 2199 mac_u64 = mlx4_en_mac_to_u64(dev->dev_addr);
2200 mdev->dev->caps.def_mac[priv->port] = mac_u64;
2201 } else {
2202 en_err(priv, "Port: %d, invalid mac burned: %pM, quiting\n",
2203 priv->port, dev->dev_addr);
2204 err = -EINVAL;
2205 goto out;
2206 }
2198 } 2207 }
2199 2208
2200 memcpy(priv->prev_mac, dev->dev_addr, sizeof(priv->prev_mac)); 2209 memcpy(priv->prev_mac, dev->dev_addr, sizeof(priv->prev_mac));
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index 58a8e535d698..2c97901c6a6d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -840,12 +840,16 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave,
840 MLX4_CMD_NATIVE); 840 MLX4_CMD_NATIVE);
841 841
842 if (!err && dev->caps.function != slave) { 842 if (!err && dev->caps.function != slave) {
843 /* set slave default_mac address */
844 MLX4_GET(def_mac, outbox->buf, QUERY_PORT_MAC_OFFSET);
845 def_mac += slave << 8;
846 /* if config MAC in DB use it */ 843 /* if config MAC in DB use it */
847 if (priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac) 844 if (priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac)
848 def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac; 845 def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac;
846 else {
847 /* set slave default_mac address */
848 MLX4_GET(def_mac, outbox->buf, QUERY_PORT_MAC_OFFSET);
849 def_mac += slave << 8;
850 priv->mfunc.master.vf_admin[slave].vport[vhcr->in_modifier].mac = def_mac;
851 }
852
849 MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET); 853 MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET);
850 854
851 /* get port type - currently only eth is enabled */ 855 /* get port type - currently only eth is enabled */
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 0d32a82458bf..2f4a26039e80 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -1290,7 +1290,6 @@ static int mlx4_init_slave(struct mlx4_dev *dev)
1290{ 1290{
1291 struct mlx4_priv *priv = mlx4_priv(dev); 1291 struct mlx4_priv *priv = mlx4_priv(dev);
1292 u64 dma = (u64) priv->mfunc.vhcr_dma; 1292 u64 dma = (u64) priv->mfunc.vhcr_dma;
1293 int num_of_reset_retries = NUM_OF_RESET_RETRIES;
1294 int ret_from_reset = 0; 1293 int ret_from_reset = 0;
1295 u32 slave_read; 1294 u32 slave_read;
1296 u32 cmd_channel_ver; 1295 u32 cmd_channel_ver;
@@ -1304,18 +1303,10 @@ static int mlx4_init_slave(struct mlx4_dev *dev)
1304 * NUM_OF_RESET_RETRIES times before leaving.*/ 1303 * NUM_OF_RESET_RETRIES times before leaving.*/
1305 if (ret_from_reset) { 1304 if (ret_from_reset) {
1306 if (MLX4_DELAY_RESET_SLAVE == ret_from_reset) { 1305 if (MLX4_DELAY_RESET_SLAVE == ret_from_reset) {
1307 msleep(SLEEP_TIME_IN_RESET); 1306 mlx4_warn(dev, "slave is currently in the "
1308 while (ret_from_reset && num_of_reset_retries) { 1307 "middle of FLR. Deferring probe.\n");
1309 mlx4_warn(dev, "slave is currently in the" 1308 mutex_unlock(&priv->cmd.slave_cmd_mutex);
1310 "middle of FLR. retrying..." 1309 return -EPROBE_DEFER;
1311 "(try num:%d)\n",
1312 (NUM_OF_RESET_RETRIES -
1313 num_of_reset_retries + 1));
1314 ret_from_reset =
1315 mlx4_comm_cmd(dev, MLX4_COMM_CMD_RESET,
1316 0, MLX4_COMM_TIME);
1317 num_of_reset_retries = num_of_reset_retries - 1;
1318 }
1319 } else 1310 } else
1320 goto err; 1311 goto err;
1321 } 1312 }
@@ -1526,7 +1517,8 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
1526 } else { 1517 } else {
1527 err = mlx4_init_slave(dev); 1518 err = mlx4_init_slave(dev);
1528 if (err) { 1519 if (err) {
1529 mlx4_err(dev, "Failed to initialize slave\n"); 1520 if (err != -EPROBE_DEFER)
1521 mlx4_err(dev, "Failed to initialize slave\n");
1530 return err; 1522 return err;
1531 } 1523 }
1532 1524