aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdo Shamay <idos@mellanox.com>2014-11-02 09:26:15 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-03 12:28:13 -0500
commit5f6e9800804758de367132a0fe9b85865d24f89b (patch)
tree217874cd459ec8c75be4b3507c9fb31fed281d60
parent0a98455666ec87378148a1dde97f1ce5baf75a64 (diff)
net/mlx4_en: Remove RX buffers alignment to IP_ALIGN
When IP_ALIGN has a non zero value, hardware will write to a non aligned address. The only reader from this address is when copying the header from the first frag into the linear buffer (further access to the IP address will be from the linear buffer, in which the headers are aligned). Since the penalty of non align access by the hardware is greater than the software memcpy, changing the frag_align to always be 0. Signed-off-by: Ido Shamay <idos@mellanox.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c16
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h1
2 files changed, 4 insertions, 13 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index c562c1468944..2ce3f00fbf38 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -74,7 +74,7 @@ static int mlx4_alloc_pages(struct mlx4_en_priv *priv,
74 page_alloc->page_size = PAGE_SIZE << order; 74 page_alloc->page_size = PAGE_SIZE << order;
75 page_alloc->page = page; 75 page_alloc->page = page;
76 page_alloc->dma = dma; 76 page_alloc->dma = dma;
77 page_alloc->page_offset = frag_info->frag_align; 77 page_alloc->page_offset = 0;
78 /* Not doing get_page() for each frag is a big win 78 /* Not doing get_page() for each frag is a big win
79 * on asymetric workloads. Note we can not use atomic_set(). 79 * on asymetric workloads. Note we can not use atomic_set().
80 */ 80 */
@@ -945,15 +945,8 @@ void mlx4_en_calc_rx_buf(struct net_device *dev)
945 (eff_mtu > buf_size + frag_sizes[i]) ? 945 (eff_mtu > buf_size + frag_sizes[i]) ?
946 frag_sizes[i] : eff_mtu - buf_size; 946 frag_sizes[i] : eff_mtu - buf_size;
947 priv->frag_info[i].frag_prefix_size = buf_size; 947 priv->frag_info[i].frag_prefix_size = buf_size;
948 if (!i) { 948 priv->frag_info[i].frag_stride = ALIGN(frag_sizes[i],
949 priv->frag_info[i].frag_align = NET_IP_ALIGN; 949 SMP_CACHE_BYTES);
950 priv->frag_info[i].frag_stride =
951 ALIGN(frag_sizes[i] + NET_IP_ALIGN, SMP_CACHE_BYTES);
952 } else {
953 priv->frag_info[i].frag_align = 0;
954 priv->frag_info[i].frag_stride =
955 ALIGN(frag_sizes[i], SMP_CACHE_BYTES);
956 }
957 buf_size += priv->frag_info[i].frag_size; 950 buf_size += priv->frag_info[i].frag_size;
958 i++; 951 i++;
959 } 952 }
@@ -966,11 +959,10 @@ void mlx4_en_calc_rx_buf(struct net_device *dev)
966 eff_mtu, priv->num_frags); 959 eff_mtu, priv->num_frags);
967 for (i = 0; i < priv->num_frags; i++) { 960 for (i = 0; i < priv->num_frags; i++) {
968 en_err(priv, 961 en_err(priv,
969 " frag:%d - size:%d prefix:%d align:%d stride:%d\n", 962 " frag:%d - size:%d prefix:%d stride:%d\n",
970 i, 963 i,
971 priv->frag_info[i].frag_size, 964 priv->frag_info[i].frag_size,
972 priv->frag_info[i].frag_prefix_size, 965 priv->frag_info[i].frag_prefix_size,
973 priv->frag_info[i].frag_align,
974 priv->frag_info[i].frag_stride); 966 priv->frag_info[i].frag_stride);
975 } 967 }
976} 968}
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 6beb4d34dce0..ef83d127f406 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -481,7 +481,6 @@ struct mlx4_en_frag_info {
481 u16 frag_size; 481 u16 frag_size;
482 u16 frag_prefix_size; 482 u16 frag_prefix_size;
483 u16 frag_stride; 483 u16 frag_stride;
484 u16 frag_align;
485}; 484};
486 485
487#ifdef CONFIG_MLX4_EN_DCB 486#ifdef CONFIG_MLX4_EN_DCB