diff options
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_netdev.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 926d8aac941c..073b85b45fc5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -929,15 +929,20 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv) | |||
929 | if (priv->rx_cq[i].buf) | 929 | if (priv->rx_cq[i].buf) |
930 | mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); | 930 | mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); |
931 | } | 931 | } |
932 | |||
933 | if (priv->base_tx_qpn) { | ||
934 | mlx4_qp_release_range(priv->mdev->dev, priv->base_tx_qpn, priv->tx_ring_num); | ||
935 | priv->base_tx_qpn = 0; | ||
936 | } | ||
932 | } | 937 | } |
933 | 938 | ||
934 | int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | 939 | int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) |
935 | { | 940 | { |
936 | struct mlx4_en_port_profile *prof = priv->prof; | 941 | struct mlx4_en_port_profile *prof = priv->prof; |
937 | int i; | 942 | int i; |
938 | int base_tx_qpn, err; | 943 | int err; |
939 | 944 | ||
940 | err = mlx4_qp_reserve_range(priv->mdev->dev, priv->tx_ring_num, 256, &base_tx_qpn); | 945 | err = mlx4_qp_reserve_range(priv->mdev->dev, priv->tx_ring_num, 256, &priv->base_tx_qpn); |
941 | if (err) { | 946 | if (err) { |
942 | en_err(priv, "failed reserving range for TX rings\n"); | 947 | en_err(priv, "failed reserving range for TX rings\n"); |
943 | return err; | 948 | return err; |
@@ -949,7 +954,7 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | |||
949 | prof->tx_ring_size, i, TX)) | 954 | prof->tx_ring_size, i, TX)) |
950 | goto err; | 955 | goto err; |
951 | 956 | ||
952 | if (mlx4_en_create_tx_ring(priv, &priv->tx_ring[i], base_tx_qpn + i, | 957 | if (mlx4_en_create_tx_ring(priv, &priv->tx_ring[i], priv->base_tx_qpn + i, |
953 | prof->tx_ring_size, TXBB_SIZE)) | 958 | prof->tx_ring_size, TXBB_SIZE)) |
954 | goto err; | 959 | goto err; |
955 | } | 960 | } |
@@ -969,7 +974,6 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | |||
969 | 974 | ||
970 | err: | 975 | err: |
971 | en_err(priv, "Failed to allocate NIC resources\n"); | 976 | en_err(priv, "Failed to allocate NIC resources\n"); |
972 | mlx4_qp_release_range(priv->mdev->dev, base_tx_qpn, priv->tx_ring_num); | ||
973 | return -ENOMEM; | 977 | return -ENOMEM; |
974 | } | 978 | } |
975 | 979 | ||
@@ -1204,9 +1208,11 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
1204 | en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); | 1208 | en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); |
1205 | 1209 | ||
1206 | /* Configure port */ | 1210 | /* Configure port */ |
1211 | mlx4_en_calc_rx_buf(dev); | ||
1207 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, | 1212 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, |
1208 | MLX4_EN_MIN_MTU, | 1213 | priv->rx_skb_size + ETH_FCS_LEN, |
1209 | 0, 0, 0, 0); | 1214 | prof->tx_pause, prof->tx_ppp, |
1215 | prof->rx_pause, prof->rx_ppp); | ||
1210 | if (err) { | 1216 | if (err) { |
1211 | en_err(priv, "Failed setting port general configurations " | 1217 | en_err(priv, "Failed setting port general configurations " |
1212 | "for port %d, with error %d\n", priv->port, err); | 1218 | "for port %d, with error %d\n", priv->port, err); |