APPLIED: [PATCH][SRU Bionic] net: hns: fix skb->truesize underestimation

Khaled Elmously khalid.elmously at canonical.com
Tue May 7 02:43:15 UTC 2019


On 2019-04-29 13:00:34 , dann frazier wrote:
> From: Huazhong Tan <tanhuazhong at huawei.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1826911
> 
> 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 at huawei.com>
> Signed-off-by: Salil Mehta <salil.mehta at huawei.com>
> Signed-off-by: David S. Miller <davem at davemloft.net>
> (cherry picked from commit b1ccd4c0ab6ef499f47dd84ed4920502a7147bba)
> Signed-off-by: dann frazier <dann.frazier at canonical.com>
> ---
>  drivers/net/ethernet/hisilicon/hns/hns_enet.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
> index ae860fe49d77e..e8511ef794b90 100644
> --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
> +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
> @@ -430,7 +430,7 @@ static void hns_nic_reuse_page(struct sk_buff *skb, int i,
>  	}
>  
>  	skb_add_rx_frag(skb, i, desc_cb->priv, desc_cb->page_offset + pull_len,
> -			size - pull_len, truesize - pull_len);
> +			size - pull_len, truesize);
>  
>  	 /* avoid re-using remote pages,flag default unreuse */
>  	if (unlikely(page_to_nid(desc_cb->priv) != numa_node_id()))
> -- 
> 2.20.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team



More information about the kernel-team mailing list