Skip to content

Commit e1a7651

Browse files
Xue Chaojingdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: Xue Chaojing <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0bd7211 commit e1a7651

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

drivers/net/ethernet/huawei/hinic/hinic_rx.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#define RX_IRQ_NO_LLI_TIMER 0
4444
#define RX_IRQ_NO_CREDIT 0
4545
#define RX_IRQ_NO_RESEND_TIMER 0
46+
#define HINIC_RX_BUFFER_WRITE 16
4647

4748
/**
4849
* hinic_rxq_clean_stats - Clean the statistics of specific queue
@@ -229,7 +230,6 @@ static int rx_alloc_pkts(struct hinic_rxq *rxq)
229230
wmb(); /* write all the wqes before update PI */
230231

231232
hinic_rq_update(rxq->rq, prod_idx);
232-
tasklet_schedule(&rxq->rx_task);
233233
}
234234

235235
return i;
@@ -258,17 +258,6 @@ static void free_all_rx_skbs(struct hinic_rxq *rxq)
258258
}
259259
}
260260

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-
272261
/**
273262
* rx_recv_jumbo_pkt - Rx handler for jumbo pkt
274263
* @rxq: rx queue
@@ -333,6 +322,7 @@ static int rxq_recv(struct hinic_rxq *rxq, int budget)
333322
struct hinic_qp *qp = container_of(rxq->rq, struct hinic_qp, rq);
334323
u64 pkt_len = 0, rx_bytes = 0;
335324
struct hinic_rq_wqe *rq_wqe;
325+
unsigned int free_wqebbs;
336326
int num_wqes, pkts = 0;
337327
struct hinic_sge sge;
338328
struct sk_buff *skb;
@@ -376,8 +366,9 @@ static int rxq_recv(struct hinic_rxq *rxq, int budget)
376366
rx_bytes += pkt_len;
377367
}
378368

379-
if (pkts)
380-
tasklet_schedule(&rxq->rx_task); /* rx_alloc_pkts */
369+
free_wqebbs = hinic_get_rq_free_wqebbs(rxq->rq);
370+
if (free_wqebbs > HINIC_RX_BUFFER_WRITE)
371+
rx_alloc_pkts(rxq);
381372

382373
u64_stats_update_begin(&rxq->rxq_stats.syncp);
383374
rxq->rxq_stats.pkts += pkts;
@@ -494,8 +485,6 @@ int hinic_init_rxq(struct hinic_rxq *rxq, struct hinic_rq *rq,
494485

495486
sprintf(rxq->irq_name, "hinic_rxq%d", qp->q_id);
496487

497-
tasklet_init(&rxq->rx_task, rx_alloc_task, (unsigned long)rxq);
498-
499488
pkts = rx_alloc_pkts(rxq);
500489
if (!pkts) {
501490
err = -ENOMEM;
@@ -512,7 +501,6 @@ int hinic_init_rxq(struct hinic_rxq *rxq, struct hinic_rq *rq,
512501

513502
err_req_rx_irq:
514503
err_rx_pkts:
515-
tasklet_kill(&rxq->rx_task);
516504
free_all_rx_skbs(rxq);
517505
devm_kfree(&netdev->dev, rxq->irq_name);
518506
return err;
@@ -528,7 +516,6 @@ void hinic_clean_rxq(struct hinic_rxq *rxq)
528516

529517
rx_free_irq(rxq);
530518

531-
tasklet_kill(&rxq->rx_task);
532519
free_all_rx_skbs(rxq);
533520
devm_kfree(&netdev->dev, rxq->irq_name);
534521
}

drivers/net/ethernet/huawei/hinic/hinic_rx.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ struct hinic_rxq {
4242

4343
char *irq_name;
4444

45-
struct tasklet_struct rx_task;
46-
4745
struct napi_struct napi;
4846
};
4947

0 commit comments

Comments
 (0)