Skip to content

Commit b1ccd4c

Browse files
Huazhong Tandavem330
authored andcommitted
net: hns: fix skb->truesize underestimation
skb->truesize is not meant to be tracking amount of used bytes in a skb, but amount of reserved/consumed bytes in memory. For instance, if we use a single byte in last page fragment, we have to account the full size of the fragment. So skb_add_rx_frag needs to calculate the length of the entire buffer into turesize. Fixes: 9cbe9fd ("net: hns: optimize XGE capability by reducing cpu usage") Signed-off-by: Huazhong tan <tanhuazhong@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ac4a5b5 commit b1ccd4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/hisilicon/hns/hns_enet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ static void hns_nic_reuse_page(struct sk_buff *skb, int i,
531531
}
532532

533533
skb_add_rx_frag(skb, i, desc_cb->priv, desc_cb->page_offset + pull_len,
534-
size - pull_len, truesize - pull_len);
534+
size - pull_len, truesize);
535535

536536
/* avoid re-using remote pages,flag default unreuse */
537537
if (unlikely(page_to_nid(desc_cb->priv) != numa_node_id()))

0 commit comments

Comments
 (0)