diff options
author | Xue Chaojing <xuechaojing@huawei.com> | 2018-12-09 14:14:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-12 01:52:56 -0500 |
commit | e1a76515b0c20c3477200c1345c477cc0e68c4ad (patch) | |
tree | 7f98b3f839ac0b5a163ed25433ee1b426e99de4e | |
parent | 0bd72117fba2dd51a65eaa7b480adc0eea9a4409 (diff) |
hinic: optmize rx refill buffer mechanism
There is no need to schedule a different tasklet for refill,
This patch remove it.
Suggested-by: Neil Horman <nhorman@redhat.com>
Signed-off-by: Xue Chaojing <xuechaojing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/huawei/hinic/hinic_rx.c | 23 | ||||
-rw-r--r-- | drivers/net/ethernet/huawei/hinic/hinic_rx.h | 2 |
2 files changed, 5 insertions, 20 deletions
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.c b/drivers/net/ethernet/huawei/hinic/hinic_rx.c index f86f2e693224..0098b206e7e9 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #define RX_IRQ_NO_LLI_TIMER 0 | 43 | #define RX_IRQ_NO_LLI_TIMER 0 |
44 | #define RX_IRQ_NO_CREDIT 0 | 44 | #define RX_IRQ_NO_CREDIT 0 |
45 | #define RX_IRQ_NO_RESEND_TIMER 0 | 45 | #define RX_IRQ_NO_RESEND_TIMER 0 |
46 | #define HINIC_RX_BUFFER_WRITE 16 | ||
46 | 47 | ||
47 | /** | 48 | /** |
48 | * hinic_rxq_clean_stats - Clean the statistics of specific queue | 49 | * hinic_rxq_clean_stats - Clean the statistics of specific queue |
@@ -229,7 +230,6 @@ skb_out: | |||
229 | wmb(); /* write all the wqes before update PI */ | 230 | wmb(); /* write all the wqes before update PI */ |
230 | 231 | ||
231 | hinic_rq_update(rxq->rq, prod_idx); | 232 | hinic_rq_update(rxq->rq, prod_idx); |
232 | tasklet_schedule(&rxq->rx_task); | ||
233 | } | 233 | } |
234 | 234 | ||
235 | return i; | 235 | return i; |
@@ -259,17 +259,6 @@ static void free_all_rx_skbs(struct hinic_rxq *rxq) | |||
259 | } | 259 | } |
260 | 260 | ||
261 | /** | 261 | /** |
262 | * rx_alloc_task - tasklet for queue allocation | ||
263 | * @data: rx queue | ||
264 | **/ | ||
265 | static void rx_alloc_task(unsigned long data) | ||
266 | { | ||
267 | struct hinic_rxq *rxq = (struct hinic_rxq *)data; | ||
268 | |||
269 | (void)rx_alloc_pkts(rxq); | ||
270 | } | ||
271 | |||
272 | /** | ||
273 | * rx_recv_jumbo_pkt - Rx handler for jumbo pkt | 262 | * rx_recv_jumbo_pkt - Rx handler for jumbo pkt |
274 | * @rxq: rx queue | 263 | * @rxq: rx queue |
275 | * @head_skb: the first skb in the list | 264 | * @head_skb: the first skb in the list |
@@ -333,6 +322,7 @@ static int rxq_recv(struct hinic_rxq *rxq, int budget) | |||
333 | struct hinic_qp *qp = container_of(rxq->rq, struct hinic_qp, rq); | 322 | struct hinic_qp *qp = container_of(rxq->rq, struct hinic_qp, rq); |
334 | u64 pkt_len = 0, rx_bytes = 0; | 323 | u64 pkt_len = 0, rx_bytes = 0; |
335 | struct hinic_rq_wqe *rq_wqe; | 324 | struct hinic_rq_wqe *rq_wqe; |
325 | unsigned int free_wqebbs; | ||
336 | int num_wqes, pkts = 0; | 326 | int num_wqes, pkts = 0; |
337 | struct hinic_sge sge; | 327 | struct hinic_sge sge; |
338 | struct sk_buff *skb; | 328 | struct sk_buff *skb; |
@@ -376,8 +366,9 @@ static int rxq_recv(struct hinic_rxq *rxq, int budget) | |||
376 | rx_bytes += pkt_len; | 366 | rx_bytes += pkt_len; |
377 | } | 367 | } |
378 | 368 | ||
379 | if (pkts) | 369 | free_wqebbs = hinic_get_rq_free_wqebbs(rxq->rq); |
380 | tasklet_schedule(&rxq->rx_task); /* rx_alloc_pkts */ | 370 | if (free_wqebbs > HINIC_RX_BUFFER_WRITE) |
371 | rx_alloc_pkts(rxq); | ||
381 | 372 | ||
382 | u64_stats_update_begin(&rxq->rxq_stats.syncp); | 373 | u64_stats_update_begin(&rxq->rxq_stats.syncp); |
383 | rxq->rxq_stats.pkts += pkts; | 374 | rxq->rxq_stats.pkts += pkts; |
@@ -494,8 +485,6 @@ int hinic_init_rxq(struct hinic_rxq *rxq, struct hinic_rq *rq, | |||
494 | 485 | ||
495 | sprintf(rxq->irq_name, "hinic_rxq%d", qp->q_id); | 486 | sprintf(rxq->irq_name, "hinic_rxq%d", qp->q_id); |
496 | 487 | ||
497 | tasklet_init(&rxq->rx_task, rx_alloc_task, (unsigned long)rxq); | ||
498 | |||
499 | pkts = rx_alloc_pkts(rxq); | 488 | pkts = rx_alloc_pkts(rxq); |
500 | if (!pkts) { | 489 | if (!pkts) { |
501 | err = -ENOMEM; | 490 | err = -ENOMEM; |
@@ -512,7 +501,6 @@ int hinic_init_rxq(struct hinic_rxq *rxq, struct hinic_rq *rq, | |||
512 | 501 | ||
513 | err_req_rx_irq: | 502 | err_req_rx_irq: |
514 | err_rx_pkts: | 503 | err_rx_pkts: |
515 | tasklet_kill(&rxq->rx_task); | ||
516 | free_all_rx_skbs(rxq); | 504 | free_all_rx_skbs(rxq); |
517 | devm_kfree(&netdev->dev, rxq->irq_name); | 505 | devm_kfree(&netdev->dev, rxq->irq_name); |
518 | return err; | 506 | return err; |
@@ -528,7 +516,6 @@ void hinic_clean_rxq(struct hinic_rxq *rxq) | |||
528 | 516 | ||
529 | rx_free_irq(rxq); | 517 | rx_free_irq(rxq); |
530 | 518 | ||
531 | tasklet_kill(&rxq->rx_task); | ||
532 | free_all_rx_skbs(rxq); | 519 | free_all_rx_skbs(rxq); |
533 | devm_kfree(&netdev->dev, rxq->irq_name); | 520 | devm_kfree(&netdev->dev, rxq->irq_name); |
534 | } | 521 | } |
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.h b/drivers/net/ethernet/huawei/hinic/hinic_rx.h index ab3fabab91b2..f8ed3fa6c8ee 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.h | |||
@@ -42,8 +42,6 @@ struct hinic_rxq { | |||
42 | 42 | ||
43 | char *irq_name; | 43 | char *irq_name; |
44 | 44 | ||
45 | struct tasklet_struct rx_task; | ||
46 | |||
47 | struct napi_struct napi; | 45 | struct napi_struct napi; |
48 | }; | 46 | }; |
49 | 47 | ||