@@ -845,6 +845,9 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
845845 struct flow_keys fk ;
846846 int rc ;
847847
848+ if (flow_id == RPS_FLOW_ID_INVALID )
849+ return - EINVAL ;
850+
848851 if (!skb_flow_dissect_flow_keys (skb , & fk , 0 ))
849852 return - EPROTONOSUPPORT ;
850853
@@ -879,8 +882,8 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
879882 return rc ;
880883
881884 /* Remember this so we can check whether to expire the filter later */
882- efx -> rps_flow_id [ rc ] = flow_id ;
883- channel = efx_get_channel ( efx , skb_get_rx_queue ( skb )) ;
885+ channel = efx_get_channel ( efx , rxq_index ) ;
886+ channel -> rps_flow_id [ rc ] = flow_id ;
884887 ++ channel -> rfs_filters_added ;
885888
886889 if (spec .ether_type == htons (ETH_P_IP ))
@@ -902,24 +905,34 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
902905bool __efx_filter_rfs_expire (struct efx_nic * efx , unsigned int quota )
903906{
904907 bool (* expire_one )(struct efx_nic * efx , u32 flow_id , unsigned int index );
905- unsigned int index , size ;
908+ unsigned int channel_idx , index , size ;
906909 u32 flow_id ;
907910
908911 if (!spin_trylock_bh (& efx -> filter_lock ))
909912 return false;
910913
911914 expire_one = efx -> type -> filter_rfs_expire_one ;
915+ channel_idx = efx -> rps_expire_channel ;
912916 index = efx -> rps_expire_index ;
913917 size = efx -> type -> max_rx_ip_filters ;
914918 while (quota -- ) {
915- flow_id = efx -> rps_flow_id [index ];
916- if (expire_one (efx , flow_id , index ))
919+ struct efx_channel * channel = efx_get_channel (efx , channel_idx );
920+ flow_id = channel -> rps_flow_id [index ];
921+
922+ if (flow_id != RPS_FLOW_ID_INVALID &&
923+ expire_one (efx , flow_id , index )) {
917924 netif_info (efx , rx_status , efx -> net_dev ,
918- "expired filter %d [flow %u]\n" ,
919- index , flow_id );
920- if (++ index == size )
925+ "expired filter %d [queue %u flow %u]\n" ,
926+ index , channel_idx , flow_id );
927+ channel -> rps_flow_id [index ] = RPS_FLOW_ID_INVALID ;
928+ }
929+ if (++ index == size ) {
930+ if (++ channel_idx == efx -> n_channels )
931+ channel_idx = 0 ;
921932 index = 0 ;
933+ }
922934 }
935+ efx -> rps_expire_channel = channel_idx ;
923936 efx -> rps_expire_index = index ;
924937
925938 spin_unlock_bh (& efx -> filter_lock );
0 commit comments