@@ -755,13 +755,27 @@ static inline void efx_ptp_process_rx(struct efx_nic *efx, struct sk_buff *skb)
755755 local_bh_enable ();
756756}
757757
758- static int efx_ptp_start (struct efx_nic * efx )
758+ static void efx_ptp_remove_multicast_filters (struct efx_nic * efx )
759+ {
760+ struct efx_ptp_data * ptp = efx -> ptp_data ;
761+
762+ if (ptp -> rxfilter_installed ) {
763+ efx_filter_remove_id_safe (efx , EFX_FILTER_PRI_REQUIRED ,
764+ ptp -> rxfilter_general );
765+ efx_filter_remove_id_safe (efx , EFX_FILTER_PRI_REQUIRED ,
766+ ptp -> rxfilter_event );
767+ ptp -> rxfilter_installed = false;
768+ }
769+ }
770+
771+ static int efx_ptp_insert_multicast_filters (struct efx_nic * efx )
759772{
760773 struct efx_ptp_data * ptp = efx -> ptp_data ;
761774 struct efx_filter_spec rxfilter ;
762775 int rc ;
763776
764- ptp -> reset_required = false;
777+ if (ptp -> rxfilter_installed )
778+ return 0 ;
765779
766780 /* Must filter on both event and general ports to ensure
767781 * that there is no packet re-ordering.
@@ -794,23 +808,37 @@ static int efx_ptp_start(struct efx_nic *efx)
794808 goto fail ;
795809 ptp -> rxfilter_general = rc ;
796810
811+ ptp -> rxfilter_installed = true;
812+ return 0 ;
813+
814+ fail :
815+ efx_filter_remove_id_safe (efx , EFX_FILTER_PRI_REQUIRED ,
816+ ptp -> rxfilter_event );
817+ return rc ;
818+ }
819+
820+ static int efx_ptp_start (struct efx_nic * efx )
821+ {
822+ struct efx_ptp_data * ptp = efx -> ptp_data ;
823+ int rc ;
824+
825+ ptp -> reset_required = false;
826+
827+ rc = efx_ptp_insert_multicast_filters (efx );
828+ if (rc )
829+ return rc ;
830+
797831 rc = efx_ptp_enable (efx );
798832 if (rc != 0 )
799- goto fail2 ;
833+ goto fail ;
800834
801835 ptp -> evt_frag_idx = 0 ;
802836 ptp -> current_adjfreq = 0 ;
803- ptp -> rxfilter_installed = true;
804837
805838 return 0 ;
806839
807- fail2 :
808- efx_filter_remove_id_safe (efx , EFX_FILTER_PRI_REQUIRED ,
809- ptp -> rxfilter_general );
810840fail :
811- efx_filter_remove_id_safe (efx , EFX_FILTER_PRI_REQUIRED ,
812- ptp -> rxfilter_event );
813-
841+ efx_ptp_remove_multicast_filters (efx );
814842 return rc ;
815843}
816844
@@ -826,13 +854,7 @@ static int efx_ptp_stop(struct efx_nic *efx)
826854
827855 rc = efx_ptp_disable (efx );
828856
829- if (ptp -> rxfilter_installed ) {
830- efx_filter_remove_id_safe (efx , EFX_FILTER_PRI_REQUIRED ,
831- ptp -> rxfilter_general );
832- efx_filter_remove_id_safe (efx , EFX_FILTER_PRI_REQUIRED ,
833- ptp -> rxfilter_event );
834- ptp -> rxfilter_installed = false;
835- }
857+ efx_ptp_remove_multicast_filters (efx );
836858
837859 /* Make sure RX packets are really delivered */
838860 efx_ptp_deliver_rx_queue (& efx -> ptp_data -> rxq );
0 commit comments