net/mlx5e: Use napi_alloc_skb for RX SKB allocations
authorTariq Toukan <tariqt@mellanox.com>
Wed, 20 Apr 2016 19:02:16 +0000 (22:02 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Apr 2016 19:09:05 +0000 (15:09 -0400)
Instead of netdev_alloc_skb, we use the napi_alloc_skb function
which is designated to allocate skbuff's for RX in a
channel-specific NAPI instance, and implies the IP packet alignment.

Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

index c99fdff74c97ee76a15af4b72eca21c06bd655c6..303e6cdf9fcd853fb5d761465b2796f27c446e3f 100644 (file)
@@ -93,7 +93,6 @@
 #define MLX5E_SQ_BF_BUDGET             16
 
 #define MLX5E_NUM_MAIN_GROUPS 9
-#define MLX5E_NET_IP_ALIGN 2
 
 static inline u16 mlx5_min_rx_wqes(int wq_type, u32 wq_size)
 {
index 942829e6d8ba101742828dd399826b3ca2afa376..9b17bc064cc899d57a1f38fa076e19098b0282d4 100644 (file)
@@ -373,8 +373,8 @@ static int mlx5e_create_rq(struct mlx5e_channel *c,
                rq->wqe_sz = (priv->params.lro_en) ?
                                priv->params.lro_wqe_sz :
                                MLX5E_SW2HW_MTU(priv->netdev->mtu);
-               rq->wqe_sz = SKB_DATA_ALIGN(rq->wqe_sz + MLX5E_NET_IP_ALIGN);
-               byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN;
+               rq->wqe_sz = SKB_DATA_ALIGN(rq->wqe_sz);
+               byte_count = rq->wqe_sz;
                byte_count |= MLX5_HW_START_PADDING;
        }
 
index d71919ccf912a3bad201f3285b3d765ca545a4b1..5bdcc0b69f76e1f610446e6c86191b199772288e 100644 (file)
@@ -47,7 +47,7 @@ int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix)
        struct sk_buff *skb;
        dma_addr_t dma_addr;
 
-       skb = netdev_alloc_skb(rq->netdev, rq->wqe_sz);
+       skb = napi_alloc_skb(rq->cq.napi, rq->wqe_sz);
        if (unlikely(!skb))
                return -ENOMEM;
 
@@ -61,10 +61,8 @@ int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix)
        if (unlikely(dma_mapping_error(rq->pdev, dma_addr)))
                goto err_free_skb;
 
-       skb_reserve(skb, MLX5E_NET_IP_ALIGN);
-
        *((dma_addr_t *)skb->cb) = dma_addr;
-       wqe->data.addr = cpu_to_be64(dma_addr + MLX5E_NET_IP_ALIGN);
+       wqe->data.addr = cpu_to_be64(dma_addr);
        wqe->data.lkey = rq->mkey_be;
 
        rq->skb[ix] = skb;
@@ -701,9 +699,9 @@ void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
                goto mpwrq_cqe_out;
        }
 
-       skb = netdev_alloc_skb(rq->netdev,
-                              ALIGN(MLX5_MPWRQ_SMALL_PACKET_THRESHOLD,
-                                    sizeof(long)));
+       skb = napi_alloc_skb(rq->cq.napi,
+                            ALIGN(MLX5_MPWRQ_SMALL_PACKET_THRESHOLD,
+                                  sizeof(long)));
        if (unlikely(!skb))
                goto mpwrq_cqe_out;