@@ -772,29 +772,25 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)
772
772
struct ravb_rx_desc * desc ;
773
773
struct sk_buff * skb ;
774
774
dma_addr_t dma_addr ;
775
+ int rx_packets = 0 ;
775
776
u8 desc_status ;
776
- int boguscnt ;
777
777
u16 pkt_len ;
778
778
u8 die_dt ;
779
779
int entry ;
780
780
int limit ;
781
+ int i ;
781
782
782
783
entry = priv -> cur_rx [q ] % priv -> num_rx_ring [q ];
783
- boguscnt = priv -> dirty_rx [q ] + priv -> num_rx_ring [q ] - priv -> cur_rx [q ];
784
+ limit = priv -> dirty_rx [q ] + priv -> num_rx_ring [q ] - priv -> cur_rx [q ];
784
785
stats = & priv -> stats [q ];
785
786
786
- boguscnt = min (boguscnt , * quota );
787
- limit = boguscnt ;
788
787
desc = & priv -> gbeth_rx_ring [entry ];
789
- while ( desc -> die_dt != DT_FEMPTY ) {
788
+ for ( i = 0 ; i < limit && rx_packets < * quota && desc -> die_dt != DT_FEMPTY ; i ++ ) {
790
789
/* Descriptor type must be checked before all other reads */
791
790
dma_rmb ();
792
791
desc_status = desc -> msc ;
793
792
pkt_len = le16_to_cpu (desc -> ds_cc ) & RX_DS ;
794
793
795
- if (-- boguscnt < 0 )
796
- break ;
797
-
798
794
/* We use 0-byte descriptors to mark the DMA mapping errors */
799
795
if (!pkt_len )
800
796
continue ;
@@ -820,7 +816,7 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)
820
816
skb_put (skb , pkt_len );
821
817
skb -> protocol = eth_type_trans (skb , ndev );
822
818
napi_gro_receive (& priv -> napi [q ], skb );
823
- stats -> rx_packets ++ ;
819
+ rx_packets ++ ;
824
820
stats -> rx_bytes += pkt_len ;
825
821
break ;
826
822
case DT_FSTART :
@@ -848,7 +844,7 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)
848
844
eth_type_trans (priv -> rx_1st_skb , ndev );
849
845
napi_gro_receive (& priv -> napi [q ],
850
846
priv -> rx_1st_skb );
851
- stats -> rx_packets ++ ;
847
+ rx_packets ++ ;
852
848
stats -> rx_bytes += pkt_len ;
853
849
break ;
854
850
}
@@ -887,9 +883,9 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)
887
883
desc -> die_dt = DT_FEMPTY ;
888
884
}
889
885
890
- * quota -= limit - ( ++ boguscnt ) ;
891
-
892
- return boguscnt < = 0 ;
886
+ stats -> rx_packets += rx_packets ;
887
+ * quota -= rx_packets ;
888
+ return * quota = = 0 ;
893
889
}
894
890
895
891
/* Packet receive function for Ethernet AVB */
0 commit comments