提交 b1ccd4c0 编写于 作者: H Huazhong Tan 提交者: David S. Miller

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: 9cbe9fd5 ("net: hns: optimize XGE capability by reducing cpu usage")
Signed-off-by: NHuazhong tan <tanhuazhong@huawei.com>
Signed-off-by: NSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ac4a5b52
...@@ -531,7 +531,7 @@ static void hns_nic_reuse_page(struct sk_buff *skb, int i, ...@@ -531,7 +531,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, 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 */ /* avoid re-using remote pages,flag default unreuse */
if (unlikely(page_to_nid(desc_cb->priv) != numa_node_id())) if (unlikely(page_to_nid(desc_cb->priv) != numa_node_id()))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册