diff options
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_netdev.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 7e4b1720c3d1..7d4fb7bf2593 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -130,7 +130,7 @@ static enum mlx4_net_trans_rule_id mlx4_ip_proto_to_trans_rule_id(u8 ip_proto) | |||
130 | case IPPROTO_TCP: | 130 | case IPPROTO_TCP: |
131 | return MLX4_NET_TRANS_RULE_ID_TCP; | 131 | return MLX4_NET_TRANS_RULE_ID_TCP; |
132 | default: | 132 | default: |
133 | return -EPROTONOSUPPORT; | 133 | return MLX4_NET_TRANS_RULE_NUM; |
134 | } | 134 | } |
135 | }; | 135 | }; |
136 | 136 | ||
@@ -177,7 +177,7 @@ static void mlx4_en_filter_work(struct work_struct *work) | |||
177 | int rc; | 177 | int rc; |
178 | __be64 mac_mask = cpu_to_be64(MLX4_MAC_MASK << 16); | 178 | __be64 mac_mask = cpu_to_be64(MLX4_MAC_MASK << 16); |
179 | 179 | ||
180 | if (spec_tcp_udp.id < 0) { | 180 | if (spec_tcp_udp.id >= MLX4_NET_TRANS_RULE_NUM) { |
181 | en_warn(priv, "RFS: ignoring unsupported ip protocol (%d)\n", | 181 | en_warn(priv, "RFS: ignoring unsupported ip protocol (%d)\n", |
182 | filter->ip_proto); | 182 | filter->ip_proto); |
183 | goto ignore; | 183 | goto ignore; |
@@ -770,11 +770,12 @@ static int mlx4_en_do_set_mac(struct mlx4_en_priv *priv) | |||
770 | priv->dev->dev_addr, priv->prev_mac); | 770 | priv->dev->dev_addr, priv->prev_mac); |
771 | if (err) | 771 | if (err) |
772 | en_err(priv, "Failed changing HW MAC address\n"); | 772 | en_err(priv, "Failed changing HW MAC address\n"); |
773 | memcpy(priv->prev_mac, priv->dev->dev_addr, | ||
774 | sizeof(priv->prev_mac)); | ||
775 | } else | 773 | } else |
776 | en_dbg(HW, priv, "Port is down while registering mac, exiting...\n"); | 774 | en_dbg(HW, priv, "Port is down while registering mac, exiting...\n"); |
777 | 775 | ||
776 | memcpy(priv->prev_mac, priv->dev->dev_addr, | ||
777 | sizeof(priv->prev_mac)); | ||
778 | |||
778 | return err; | 779 | return err; |
779 | } | 780 | } |
780 | 781 | ||
@@ -788,9 +789,8 @@ static int mlx4_en_set_mac(struct net_device *dev, void *addr) | |||
788 | if (!is_valid_ether_addr(saddr->sa_data)) | 789 | if (!is_valid_ether_addr(saddr->sa_data)) |
789 | return -EADDRNOTAVAIL; | 790 | return -EADDRNOTAVAIL; |
790 | 791 | ||
791 | memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN); | ||
792 | |||
793 | mutex_lock(&mdev->state_lock); | 792 | mutex_lock(&mdev->state_lock); |
793 | memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN); | ||
794 | err = mlx4_en_do_set_mac(priv); | 794 | err = mlx4_en_do_set_mac(priv); |
795 | mutex_unlock(&mdev->state_lock); | 795 | mutex_unlock(&mdev->state_lock); |
796 | 796 | ||
@@ -1526,6 +1526,27 @@ static void mlx4_en_linkstate(struct work_struct *work) | |||
1526 | mutex_unlock(&mdev->state_lock); | 1526 | mutex_unlock(&mdev->state_lock); |
1527 | } | 1527 | } |
1528 | 1528 | ||
1529 | static int mlx4_en_init_affinity_hint(struct mlx4_en_priv *priv, int ring_idx) | ||
1530 | { | ||
1531 | struct mlx4_en_rx_ring *ring = priv->rx_ring[ring_idx]; | ||
1532 | int numa_node = priv->mdev->dev->numa_node; | ||
1533 | int ret = 0; | ||
1534 | |||
1535 | if (!zalloc_cpumask_var(&ring->affinity_mask, GFP_KERNEL)) | ||
1536 | return -ENOMEM; | ||
1537 | |||
1538 | ret = cpumask_set_cpu_local_first(ring_idx, numa_node, | ||
1539 | ring->affinity_mask); | ||
1540 | if (ret) | ||
1541 | free_cpumask_var(ring->affinity_mask); | ||
1542 | |||
1543 | return ret; | ||
1544 | } | ||
1545 | |||
1546 | static void mlx4_en_free_affinity_hint(struct mlx4_en_priv *priv, int ring_idx) | ||
1547 | { | ||
1548 | free_cpumask_var(priv->rx_ring[ring_idx]->affinity_mask); | ||
1549 | } | ||
1529 | 1550 | ||
1530 | int mlx4_en_start_port(struct net_device *dev) | 1551 | int mlx4_en_start_port(struct net_device *dev) |
1531 | { | 1552 | { |
@@ -1567,17 +1588,25 @@ int mlx4_en_start_port(struct net_device *dev) | |||
1567 | 1588 | ||
1568 | mlx4_en_cq_init_lock(cq); | 1589 | mlx4_en_cq_init_lock(cq); |
1569 | 1590 | ||
1591 | err = mlx4_en_init_affinity_hint(priv, i); | ||
1592 | if (err) { | ||
1593 | en_err(priv, "Failed preparing IRQ affinity hint\n"); | ||
1594 | goto cq_err; | ||
1595 | } | ||
1596 | |||
1570 | err = mlx4_en_activate_cq(priv, cq, i); | 1597 | err = mlx4_en_activate_cq(priv, cq, i); |
1571 | if (err) { | 1598 | if (err) { |
1572 | en_err(priv, "Failed activating Rx CQ\n"); | 1599 | en_err(priv, "Failed activating Rx CQ\n"); |
1600 | mlx4_en_free_affinity_hint(priv, i); | ||
1573 | goto cq_err; | 1601 | goto cq_err; |
1574 | } | 1602 | } |
1575 | for (j = 0; j < cq->size; j++) | 1603 | for (j = 0; j < cq->size; j++) |
1576 | cq->buf[j].owner_sr_opcode = MLX4_CQE_OWNER_MASK; | 1604 | cq->buf[j].owner_sr_opcode = MLX4_CQE_OWNER_MASK; |
1577 | err = mlx4_en_set_cq_moder(priv, cq); | 1605 | err = mlx4_en_set_cq_moder(priv, cq); |
1578 | if (err) { | 1606 | if (err) { |
1579 | en_err(priv, "Failed setting cq moderation parameters"); | 1607 | en_err(priv, "Failed setting cq moderation parameters\n"); |
1580 | mlx4_en_deactivate_cq(priv, cq); | 1608 | mlx4_en_deactivate_cq(priv, cq); |
1609 | mlx4_en_free_affinity_hint(priv, i); | ||
1581 | goto cq_err; | 1610 | goto cq_err; |
1582 | } | 1611 | } |
1583 | mlx4_en_arm_cq(priv, cq); | 1612 | mlx4_en_arm_cq(priv, cq); |
@@ -1615,7 +1644,7 @@ int mlx4_en_start_port(struct net_device *dev) | |||
1615 | } | 1644 | } |
1616 | err = mlx4_en_set_cq_moder(priv, cq); | 1645 | err = mlx4_en_set_cq_moder(priv, cq); |
1617 | if (err) { | 1646 | if (err) { |
1618 | en_err(priv, "Failed setting cq moderation parameters"); | 1647 | en_err(priv, "Failed setting cq moderation parameters\n"); |
1619 | mlx4_en_deactivate_cq(priv, cq); | 1648 | mlx4_en_deactivate_cq(priv, cq); |
1620 | goto tx_err; | 1649 | goto tx_err; |
1621 | } | 1650 | } |
@@ -1715,8 +1744,10 @@ rss_err: | |||
1715 | mac_err: | 1744 | mac_err: |
1716 | mlx4_en_put_qp(priv); | 1745 | mlx4_en_put_qp(priv); |
1717 | cq_err: | 1746 | cq_err: |
1718 | while (rx_index--) | 1747 | while (rx_index--) { |
1719 | mlx4_en_deactivate_cq(priv, priv->rx_cq[rx_index]); | 1748 | mlx4_en_deactivate_cq(priv, priv->rx_cq[rx_index]); |
1749 | mlx4_en_free_affinity_hint(priv, i); | ||
1750 | } | ||
1720 | for (i = 0; i < priv->rx_ring_num; i++) | 1751 | for (i = 0; i < priv->rx_ring_num; i++) |
1721 | mlx4_en_deactivate_rx_ring(priv, priv->rx_ring[i]); | 1752 | mlx4_en_deactivate_rx_ring(priv, priv->rx_ring[i]); |
1722 | 1753 | ||
@@ -1847,6 +1878,8 @@ void mlx4_en_stop_port(struct net_device *dev, int detach) | |||
1847 | msleep(1); | 1878 | msleep(1); |
1848 | mlx4_en_deactivate_rx_ring(priv, priv->rx_ring[i]); | 1879 | mlx4_en_deactivate_rx_ring(priv, priv->rx_ring[i]); |
1849 | mlx4_en_deactivate_cq(priv, cq); | 1880 | mlx4_en_deactivate_cq(priv, cq); |
1881 | |||
1882 | mlx4_en_free_affinity_hint(priv, i); | ||
1850 | } | 1883 | } |
1851 | } | 1884 | } |
1852 | 1885 | ||
@@ -2539,7 +2572,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2539 | netif_set_real_num_tx_queues(dev, priv->tx_ring_num); | 2572 | netif_set_real_num_tx_queues(dev, priv->tx_ring_num); |
2540 | netif_set_real_num_rx_queues(dev, priv->rx_ring_num); | 2573 | netif_set_real_num_rx_queues(dev, priv->rx_ring_num); |
2541 | 2574 | ||
2542 | SET_ETHTOOL_OPS(dev, &mlx4_en_ethtool_ops); | 2575 | dev->ethtool_ops = &mlx4_en_ethtool_ops; |
2543 | 2576 | ||
2544 | /* | 2577 | /* |
2545 | * Set driver features | 2578 | * Set driver features |
@@ -2594,8 +2627,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2594 | prof->tx_pause, prof->tx_ppp, | 2627 | prof->tx_pause, prof->tx_ppp, |
2595 | prof->rx_pause, prof->rx_ppp); | 2628 | prof->rx_pause, prof->rx_ppp); |
2596 | if (err) { | 2629 | if (err) { |
2597 | en_err(priv, "Failed setting port general configurations " | 2630 | en_err(priv, "Failed setting port general configurations for port %d, with error %d\n", |
2598 | "for port %d, with error %d\n", priv->port, err); | 2631 | priv->port, err); |
2599 | goto out; | 2632 | goto out; |
2600 | } | 2633 | } |
2601 | 2634 | ||