@@ -477,12 +477,13 @@ static void nicvf_rcv_pkt_handler(struct net_device *netdev,
477
477
static int nicvf_cq_intr_handler (struct net_device * netdev , u8 cq_idx ,
478
478
struct napi_struct * napi , int budget )
479
479
{
480
- int processed_cqe , work_done = 0 ;
480
+ int processed_cqe , work_done = 0 , tx_done = 0 ;
481
481
int cqe_count , cqe_head ;
482
482
struct nicvf * nic = netdev_priv (netdev );
483
483
struct queue_set * qs = nic -> qs ;
484
484
struct cmp_queue * cq = & qs -> cq [cq_idx ];
485
485
struct cqe_rx_t * cq_desc ;
486
+ struct netdev_queue * txq ;
486
487
487
488
spin_lock_bh (& cq -> lock );
488
489
loop :
@@ -497,8 +498,8 @@ static int nicvf_cq_intr_handler(struct net_device *netdev, u8 cq_idx,
497
498
cqe_head = nicvf_queue_reg_read (nic , NIC_QSET_CQ_0_7_HEAD , cq_idx ) >> 9 ;
498
499
cqe_head &= 0xFFFF ;
499
500
500
- netdev_dbg (nic -> netdev , "%s cqe_count %d cqe_head %d\n" ,
501
- __func__ , cqe_count , cqe_head );
501
+ netdev_dbg (nic -> netdev , "%s CQ%d cqe_count %d cqe_head %d\n" ,
502
+ __func__ , cq_idx , cqe_count , cqe_head );
502
503
while (processed_cqe < cqe_count ) {
503
504
/* Get the CQ descriptor */
504
505
cq_desc = (struct cqe_rx_t * )GET_CQ_DESC (cq , cqe_head );
@@ -512,8 +513,8 @@ static int nicvf_cq_intr_handler(struct net_device *netdev, u8 cq_idx,
512
513
break ;
513
514
}
514
515
515
- netdev_dbg (nic -> netdev , "cq_desc->cqe_type %d\n" ,
516
- cq_desc -> cqe_type );
516
+ netdev_dbg (nic -> netdev , "CQ%d cq_desc->cqe_type %d\n" ,
517
+ cq_idx , cq_desc -> cqe_type );
517
518
switch (cq_desc -> cqe_type ) {
518
519
case CQE_TYPE_RX :
519
520
nicvf_rcv_pkt_handler (netdev , napi , cq ,
@@ -523,6 +524,7 @@ static int nicvf_cq_intr_handler(struct net_device *netdev, u8 cq_idx,
523
524
case CQE_TYPE_SEND :
524
525
nicvf_snd_pkt_handler (netdev , cq ,
525
526
(void * )cq_desc , CQE_TYPE_SEND );
527
+ tx_done ++ ;
526
528
break ;
527
529
case CQE_TYPE_INVALID :
528
530
case CQE_TYPE_RX_SPLIT :
@@ -533,8 +535,9 @@ static int nicvf_cq_intr_handler(struct net_device *netdev, u8 cq_idx,
533
535
}
534
536
processed_cqe ++ ;
535
537
}
536
- netdev_dbg (nic -> netdev , "%s processed_cqe %d work_done %d budget %d\n" ,
537
- __func__ , processed_cqe , work_done , budget );
538
+ netdev_dbg (nic -> netdev ,
539
+ "%s CQ%d processed_cqe %d work_done %d budget %d\n" ,
540
+ __func__ , cq_idx , processed_cqe , work_done , budget );
538
541
539
542
/* Ring doorbell to inform H/W to reuse processed CQEs */
540
543
nicvf_queue_reg_write (nic , NIC_QSET_CQ_0_7_DOOR ,
@@ -544,6 +547,19 @@ static int nicvf_cq_intr_handler(struct net_device *netdev, u8 cq_idx,
544
547
goto loop ;
545
548
546
549
done :
550
+ /* Wakeup TXQ if its stopped earlier due to SQ full */
551
+ if (tx_done ) {
552
+ txq = netdev_get_tx_queue (netdev , cq_idx );
553
+ if (netif_tx_queue_stopped (txq )) {
554
+ netif_tx_wake_queue (txq );
555
+ nic -> drv_stats .txq_wake ++ ;
556
+ if (netif_msg_tx_err (nic ))
557
+ netdev_warn (netdev ,
558
+ "%s: Transmit queue wakeup SQ%d\n" ,
559
+ netdev -> name , cq_idx );
560
+ }
561
+ }
562
+
547
563
spin_unlock_bh (& cq -> lock );
548
564
return work_done ;
549
565
}
@@ -555,15 +571,10 @@ static int nicvf_poll(struct napi_struct *napi, int budget)
555
571
struct net_device * netdev = napi -> dev ;
556
572
struct nicvf * nic = netdev_priv (netdev );
557
573
struct nicvf_cq_poll * cq ;
558
- struct netdev_queue * txq ;
559
574
560
575
cq = container_of (napi , struct nicvf_cq_poll , napi );
561
576
work_done = nicvf_cq_intr_handler (netdev , cq -> cq_idx , napi , budget );
562
577
563
- txq = netdev_get_tx_queue (netdev , cq -> cq_idx );
564
- if (netif_tx_queue_stopped (txq ))
565
- netif_tx_wake_queue (txq );
566
-
567
578
if (work_done < budget ) {
568
579
/* Slow packet rate, exit polling */
569
580
napi_complete (napi );
@@ -836,7 +847,7 @@ static netdev_tx_t nicvf_xmit(struct sk_buff *skb, struct net_device *netdev)
836
847
837
848
if (!nicvf_sq_append_skb (nic , skb ) && !netif_tx_queue_stopped (txq )) {
838
849
netif_tx_stop_queue (txq );
839
- nic -> drv_stats .tx_busy ++ ;
850
+ nic -> drv_stats .txq_stop ++ ;
840
851
if (netif_msg_tx_err (nic ))
841
852
netdev_warn (netdev ,
842
853
"%s: Transmit ring full, stopping SQ%d\n" ,
@@ -989,6 +1000,9 @@ int nicvf_open(struct net_device *netdev)
989
1000
for (qidx = 0 ; qidx < qs -> rbdr_cnt ; qidx ++ )
990
1001
nicvf_enable_intr (nic , NICVF_INTR_RBDR , qidx );
991
1002
1003
+ nic -> drv_stats .txq_stop = 0 ;
1004
+ nic -> drv_stats .txq_wake = 0 ;
1005
+
992
1006
netif_carrier_on (netdev );
993
1007
netif_tx_start_all_queues (netdev );
994
1008
0 commit comments