@@ -784,6 +784,13 @@ static inline int octep_iq_full_check(struct octep_iq *iq)
784
784
/* Stop the queue if unable to send */
785
785
netif_stop_subqueue (iq -> netdev , iq -> q_no );
786
786
787
+ /* Allow for pending updates in write index
788
+ * from iq_process_completion in other cpus
789
+ * to reflect, in case queue gets free
790
+ * entries.
791
+ */
792
+ smp_mb ();
793
+
787
794
/* check again and restart the queue, in case NAPI has just freed
788
795
* enough Tx ring entries.
789
796
*/
@@ -818,6 +825,7 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
818
825
struct octep_iq * iq ;
819
826
skb_frag_t * frag ;
820
827
u16 nr_frags , si ;
828
+ int xmit_more ;
821
829
u16 q_no , wi ;
822
830
823
831
if (skb_put_padto (skb , ETH_ZLEN ))
@@ -830,10 +838,6 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
830
838
}
831
839
832
840
iq = oct -> iq [q_no ];
833
- if (octep_iq_full_check (iq )) {
834
- iq -> stats .tx_busy ++ ;
835
- return NETDEV_TX_BUSY ;
836
- }
837
841
838
842
shinfo = skb_shinfo (skb );
839
843
nr_frags = shinfo -> nr_frags ;
@@ -894,19 +898,33 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
894
898
hw_desc -> dptr = tx_buffer -> sglist_dma ;
895
899
}
896
900
897
- netdev_tx_sent_queue (iq -> netdev_q , skb -> len );
901
+ xmit_more = netdev_xmit_more ();
902
+
903
+ __netdev_tx_sent_queue (iq -> netdev_q , skb -> len , xmit_more );
904
+
898
905
skb_tx_timestamp (skb );
899
906
atomic_inc (& iq -> instr_pending );
907
+ iq -> fill_cnt ++ ;
900
908
wi ++ ;
901
909
if (wi == iq -> max_count )
902
910
wi = 0 ;
903
911
iq -> host_write_index = wi ;
912
+
913
+ /* octep_iq_full_check stops the queue and returns
914
+ * true if so, in case the queue has become full
915
+ * by inserting current packet. If so, we can
916
+ * go ahead and ring doorbell.
917
+ */
918
+ if (!octep_iq_full_check (iq ) && xmit_more &&
919
+ iq -> fill_cnt < iq -> fill_threshold )
920
+ return NETDEV_TX_OK ;
921
+
904
922
/* Flush the hw descriptor before writing to doorbell */
905
923
wmb ();
906
-
907
- /* Ring Doorbell to notify the NIC there is a new packet */
908
- writel ( 1 , iq -> doorbell_reg ) ;
909
- iq -> stats . instr_posted ++ ;
924
+ /* Ring Doorbell to notify the NIC of new packets */
925
+ writel ( iq -> fill_cnt , iq -> doorbell_reg );
926
+ iq -> stats . instr_posted += iq -> fill_cnt ;
927
+ iq -> fill_cnt = 0 ;
910
928
return NETDEV_TX_OK ;
911
929
912
930
dma_map_sg_err :
0 commit comments