提交 9a570cc0 编写于 作者: Y Yunsheng Lin 提交者: Xie XiuQi

net: hns3: optimize the barrier using when cleaning tx BD

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

Currently, a barrier is used when cleaning each tx BD, which may
cause performance degradation.

This patch optimize it to use one barrier when cleaning tx BD
each round.

Feature or Bugfix:Bugfix
Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
Reviewed-by: Nlipeng <lipeng321@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 87bb0f3c
...@@ -2287,12 +2287,13 @@ static void hns3_reuse_buffer(struct hns3_enet_ring *ring, int i) ...@@ -2287,12 +2287,13 @@ static void hns3_reuse_buffer(struct hns3_enet_ring *ring, int i)
ring->desc[i].rx.bd_base_info = 0; ring->desc[i].rx.bd_base_info = 0;
} }
static void hns3_nic_reclaim_one_desc(struct hns3_enet_ring *ring, int *bytes, static void hns3_nic_reclaim_desc(struct hns3_enet_ring *ring, int head,
int *pkts) int *bytes, int *pkts)
{ {
int ntc = ring->next_to_clean; int ntc = ring->next_to_clean;
struct hns3_desc_cb *desc_cb; struct hns3_desc_cb *desc_cb;
while (head != ntc) {
desc_cb = &ring->desc_cb[ntc]; desc_cb = &ring->desc_cb[ntc];
(*pkts) += (desc_cb->type == DESC_TYPE_SKB); (*pkts) += (desc_cb->type == DESC_TYPE_SKB);
(*bytes) += desc_cb->length; (*bytes) += desc_cb->length;
...@@ -2302,6 +2303,10 @@ static void hns3_nic_reclaim_one_desc(struct hns3_enet_ring *ring, int *bytes, ...@@ -2302,6 +2303,10 @@ static void hns3_nic_reclaim_one_desc(struct hns3_enet_ring *ring, int *bytes,
if (++ntc == ring->desc_num) if (++ntc == ring->desc_num)
ntc = 0; ntc = 0;
/* Issue prefetch for next Tx descriptor */
prefetch(&ring->desc_cb[ntc]);
}
/* This smp_store_release() pairs with smp_load_acquire() in /* This smp_store_release() pairs with smp_load_acquire() in
* ring_space called by hns3_nic_net_xmit. * ring_space called by hns3_nic_net_xmit.
*/ */
...@@ -2345,11 +2350,7 @@ void hns3_clean_tx_ring(struct hns3_enet_ring *ring) ...@@ -2345,11 +2350,7 @@ void hns3_clean_tx_ring(struct hns3_enet_ring *ring)
bytes = 0; bytes = 0;
pkts = 0; pkts = 0;
while (head != ring->next_to_clean) { hns3_nic_reclaim_desc(ring, head, &bytes, &pkts);
hns3_nic_reclaim_one_desc(ring, &bytes, &pkts);
/* Issue prefetch for next Tx descriptor */
prefetch(&ring->desc_cb[ring->next_to_clean]);
}
ring->tqp_vector->tx_group.total_bytes += bytes; ring->tqp_vector->tx_group.total_bytes += bytes;
ring->tqp_vector->tx_group.total_packets += pkts; ring->tqp_vector->tx_group.total_packets += pkts;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册