aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx4/en_rx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_rx.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index e8d6ad2dce0a..d4ad8c226b51 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -168,8 +168,12 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv,
168 return 0; 168 return 0;
169 169
170err: 170err:
171 while (i--) 171 while (i--) {
172 dma_addr_t dma = be64_to_cpu(rx_desc->data[i].addr);
173 pci_unmap_single(priv->mdev->pdev, dma, skb_frags[i].size,
174 PCI_DMA_FROMDEVICE);
172 put_page(skb_frags[i].page); 175 put_page(skb_frags[i].page);
176 }
173 return -ENOMEM; 177 return -ENOMEM;
174} 178}
175 179
@@ -380,12 +384,12 @@ err_allocator:
380} 384}
381 385
382void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, 386void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv,
383 struct mlx4_en_rx_ring *ring) 387 struct mlx4_en_rx_ring *ring, u32 size, u16 stride)
384{ 388{
385 struct mlx4_en_dev *mdev = priv->mdev; 389 struct mlx4_en_dev *mdev = priv->mdev;
386 390
387 mlx4_en_unmap_buffer(&ring->wqres.buf); 391 mlx4_en_unmap_buffer(&ring->wqres.buf);
388 mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size + TXBB_SIZE); 392 mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE);
389 vfree(ring->rx_info); 393 vfree(ring->rx_info);
390 ring->rx_info = NULL; 394 ring->rx_info = NULL;
391} 395}
@@ -853,6 +857,7 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv)
853 struct mlx4_en_rss_map *rss_map = &priv->rss_map; 857 struct mlx4_en_rss_map *rss_map = &priv->rss_map;
854 struct mlx4_qp_context context; 858 struct mlx4_qp_context context;
855 struct mlx4_rss_context *rss_context; 859 struct mlx4_rss_context *rss_context;
860 int rss_rings;
856 void *ptr; 861 void *ptr;
857 u8 rss_mask = (MLX4_RSS_IPV4 | MLX4_RSS_TCP_IPV4 | MLX4_RSS_IPV6 | 862 u8 rss_mask = (MLX4_RSS_IPV4 | MLX4_RSS_TCP_IPV4 | MLX4_RSS_IPV6 |
858 MLX4_RSS_TCP_IPV6); 863 MLX4_RSS_TCP_IPV6);
@@ -893,10 +898,15 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv)
893 mlx4_en_fill_qp_context(priv, 0, 0, 0, 1, priv->base_qpn, 898 mlx4_en_fill_qp_context(priv, 0, 0, 0, 1, priv->base_qpn,
894 priv->rx_ring[0].cqn, &context); 899 priv->rx_ring[0].cqn, &context);
895 900
901 if (!priv->prof->rss_rings || priv->prof->rss_rings > priv->rx_ring_num)
902 rss_rings = priv->rx_ring_num;
903 else
904 rss_rings = priv->prof->rss_rings;
905
896 ptr = ((void *) &context) + offsetof(struct mlx4_qp_context, pri_path) 906 ptr = ((void *) &context) + offsetof(struct mlx4_qp_context, pri_path)
897 + MLX4_RSS_OFFSET_IN_QPC_PRI_PATH; 907 + MLX4_RSS_OFFSET_IN_QPC_PRI_PATH;
898 rss_context = ptr; 908 rss_context = ptr;
899 rss_context->base_qpn = cpu_to_be32(ilog2(priv->rx_ring_num) << 24 | 909 rss_context->base_qpn = cpu_to_be32(ilog2(rss_rings) << 24 |
900 (rss_map->base_qpn)); 910 (rss_map->base_qpn));
901 rss_context->default_qpn = cpu_to_be32(rss_map->base_qpn); 911 rss_context->default_qpn = cpu_to_be32(rss_map->base_qpn);
902 if (priv->mdev->profile.udp_rss) { 912 if (priv->mdev->profile.udp_rss) {