提交 f05975d9 编写于 作者: J Jiangfeng Xiao 提交者: Greg Kroah-Hartman

net: hisilicon: Fix ping latency when deal with high throughput

[ Upstream commit e56bd641ca61beb92b135298d5046905f920b734 ]

This is due to error in over budget processing.
When dealing with high throughput, the used buffers
that exceeds the budget is not cleaned up. In addition,
it takes a lot of cycles to clean up the used buffer,
and then the buffer where the valid data is located can take effect.
Signed-off-by: NJiangfeng Xiao <xiaojiangfeng@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 1d5cb12a
...@@ -174,6 +174,7 @@ struct hip04_priv { ...@@ -174,6 +174,7 @@ struct hip04_priv {
dma_addr_t rx_phys[RX_DESC_NUM]; dma_addr_t rx_phys[RX_DESC_NUM];
unsigned int rx_head; unsigned int rx_head;
unsigned int rx_buf_size; unsigned int rx_buf_size;
unsigned int rx_cnt_remaining;
struct device_node *phy_node; struct device_node *phy_node;
struct phy_device *phy; struct phy_device *phy;
...@@ -487,7 +488,6 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) ...@@ -487,7 +488,6 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
struct hip04_priv *priv = container_of(napi, struct hip04_priv, napi); struct hip04_priv *priv = container_of(napi, struct hip04_priv, napi);
struct net_device *ndev = priv->ndev; struct net_device *ndev = priv->ndev;
struct net_device_stats *stats = &ndev->stats; struct net_device_stats *stats = &ndev->stats;
unsigned int cnt = hip04_recv_cnt(priv);
struct rx_desc *desc; struct rx_desc *desc;
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *buf; unsigned char *buf;
...@@ -500,8 +500,8 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) ...@@ -500,8 +500,8 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
/* clean up tx descriptors */ /* clean up tx descriptors */
tx_remaining = hip04_tx_reclaim(ndev, false); tx_remaining = hip04_tx_reclaim(ndev, false);
priv->rx_cnt_remaining += hip04_recv_cnt(priv);
while (cnt && !last) { while (priv->rx_cnt_remaining && !last) {
buf = priv->rx_buf[priv->rx_head]; buf = priv->rx_buf[priv->rx_head];
skb = build_skb(buf, priv->rx_buf_size); skb = build_skb(buf, priv->rx_buf_size);
if (unlikely(!skb)) { if (unlikely(!skb)) {
...@@ -547,11 +547,13 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) ...@@ -547,11 +547,13 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget)
hip04_set_recv_desc(priv, phys); hip04_set_recv_desc(priv, phys);
priv->rx_head = RX_NEXT(priv->rx_head); priv->rx_head = RX_NEXT(priv->rx_head);
if (rx >= budget) if (rx >= budget) {
--priv->rx_cnt_remaining;
goto done; goto done;
}
if (--cnt == 0) if (--priv->rx_cnt_remaining == 0)
cnt = hip04_recv_cnt(priv); priv->rx_cnt_remaining += hip04_recv_cnt(priv);
} }
if (!(priv->reg_inten & RCV_INT)) { if (!(priv->reg_inten & RCV_INT)) {
...@@ -636,6 +638,7 @@ static int hip04_mac_open(struct net_device *ndev) ...@@ -636,6 +638,7 @@ static int hip04_mac_open(struct net_device *ndev)
int i; int i;
priv->rx_head = 0; priv->rx_head = 0;
priv->rx_cnt_remaining = 0;
priv->tx_head = 0; priv->tx_head = 0;
priv->tx_tail = 0; priv->tx_tail = 0;
hip04_reset_ppe(priv); hip04_reset_ppe(priv);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册