net: hns: fix skb->truesize underestimation
authorHuazhong Tan <tanhuazhong@huawei.com>
Thu, 23 Aug 2018 03:10:12 +0000 (11:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Oct 2018 00:01:51 +0000 (17:01 -0700)
commit58c29919644d5d64d66e185677423f447035f080
tree7e562387ebcdd9eef1535b5fff2c9c5f0fcc256c
parent44b4ae8248453bd6216776edb177edf6d994f791
net: hns: fix skb->truesize underestimation

[ Upstream commit b1ccd4c0ab6ef499f47dd84ed4920502a7147bba ]

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: 9cbe9fd5214e ("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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/hisilicon/hns/hns_enet.c