Commit aaca121d authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

mlx4: get rid of frag_prefix_size

Using per frag storage for frag_prefix_size is really silly.

mlx4_en_complete_rx_desc() has all needed info already.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 159ddfd2
...@@ -588,15 +588,14 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv, ...@@ -588,15 +588,14 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
int length) int length)
{ {
struct skb_frag_struct *skb_frags_rx = skb_shinfo(skb)->frags; struct skb_frag_struct *skb_frags_rx = skb_shinfo(skb)->frags;
struct mlx4_en_frag_info *frag_info; struct mlx4_en_frag_info *frag_info = priv->frag_info;
int nr; int nr, frag_size;
dma_addr_t dma; dma_addr_t dma;
/* Collect used fragments while replacing them in the HW descriptors */ /* Collect used fragments while replacing them in the HW descriptors */
for (nr = 0; nr < priv->num_frags; nr++) { for (nr = 0;;) {
frag_info = &priv->frag_info[nr]; frag_size = min_t(int, length, frag_info->frag_size);
if (length <= frag_info->frag_prefix_size)
break;
if (unlikely(!frags[nr].page)) if (unlikely(!frags[nr].page))
goto fail; goto fail;
...@@ -606,15 +605,16 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv, ...@@ -606,15 +605,16 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
__skb_fill_page_desc(skb, nr, frags[nr].page, __skb_fill_page_desc(skb, nr, frags[nr].page,
frags[nr].page_offset, frags[nr].page_offset,
frag_info->frag_size); frag_size);
skb->truesize += frag_info->frag_stride; skb->truesize += frag_info->frag_stride;
frags[nr].page = NULL; frags[nr].page = NULL;
nr++;
length -= frag_size;
if (!length)
break;
frag_info++;
} }
/* Adjust size of last fragment to match actual length */
if (nr > 0)
skb_frag_size_set(&skb_frags_rx[nr - 1],
length - priv->frag_info[nr - 1].frag_prefix_size);
return nr; return nr;
fail: fail:
...@@ -1197,7 +1197,6 @@ void mlx4_en_calc_rx_buf(struct net_device *dev) ...@@ -1197,7 +1197,6 @@ void mlx4_en_calc_rx_buf(struct net_device *dev)
if (priv->tx_ring_num[TX_XDP]) { if (priv->tx_ring_num[TX_XDP]) {
priv->rx_page_order = 0; priv->rx_page_order = 0;
priv->frag_info[0].frag_size = eff_mtu; priv->frag_info[0].frag_size = eff_mtu;
priv->frag_info[0].frag_prefix_size = 0;
/* This will gain efficient xdp frame recycling at the /* This will gain efficient xdp frame recycling at the
* expense of more costly truesize accounting * expense of more costly truesize accounting
*/ */
...@@ -1212,7 +1211,6 @@ void mlx4_en_calc_rx_buf(struct net_device *dev) ...@@ -1212,7 +1211,6 @@ void mlx4_en_calc_rx_buf(struct net_device *dev)
priv->frag_info[i].frag_size = priv->frag_info[i].frag_size =
(eff_mtu > buf_size + frag_sizes[i]) ? (eff_mtu > buf_size + frag_sizes[i]) ?
frag_sizes[i] : eff_mtu - buf_size; frag_sizes[i] : eff_mtu - buf_size;
priv->frag_info[i].frag_prefix_size = buf_size;
priv->frag_info[i].frag_stride = priv->frag_info[i].frag_stride =
ALIGN(priv->frag_info[i].frag_size, ALIGN(priv->frag_info[i].frag_size,
SMP_CACHE_BYTES); SMP_CACHE_BYTES);
...@@ -1232,10 +1230,9 @@ void mlx4_en_calc_rx_buf(struct net_device *dev) ...@@ -1232,10 +1230,9 @@ void mlx4_en_calc_rx_buf(struct net_device *dev)
eff_mtu, priv->num_frags); eff_mtu, priv->num_frags);
for (i = 0; i < priv->num_frags; i++) { for (i = 0; i < priv->num_frags; i++) {
en_err(priv, en_err(priv,
" frag:%d - size:%d prefix:%d stride:%d\n", " frag:%d - size:%d stride:%d\n",
i, i,
priv->frag_info[i].frag_size, priv->frag_info[i].frag_size,
priv->frag_info[i].frag_prefix_size,
priv->frag_info[i].frag_stride); priv->frag_info[i].frag_stride);
} }
} }
......
...@@ -472,9 +472,8 @@ struct mlx4_en_mc_list { ...@@ -472,9 +472,8 @@ struct mlx4_en_mc_list {
struct mlx4_en_frag_info { struct mlx4_en_frag_info {
u16 frag_size; u16 frag_size;
u16 frag_prefix_size;
u32 frag_stride;
u16 rx_headroom; u16 rx_headroom;
u32 frag_stride;
}; };
#ifdef CONFIG_MLX4_EN_DCB #ifdef CONFIG_MLX4_EN_DCB
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment