diff options
| -rw-r--r-- | drivers/net/ethernet/sfc/ptp.c | 56 | 
1 files changed, 39 insertions, 17 deletions
| diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index 24bd2e3040f8..7ae66d900256 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c | |||
| @@ -755,13 +755,27 @@ static inline void efx_ptp_process_rx(struct efx_nic *efx, struct sk_buff *skb) | |||
| 755 | local_bh_enable(); | 755 | local_bh_enable(); | 
| 756 | } | 756 | } | 
| 757 | 757 | ||
| 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) | ||
| 759 | { | 772 | { | 
| 760 | struct efx_ptp_data *ptp = efx->ptp_data; | 773 | struct efx_ptp_data *ptp = efx->ptp_data; | 
| 761 | struct efx_filter_spec rxfilter; | 774 | struct efx_filter_spec rxfilter; | 
| 762 | int rc; | 775 | int rc; | 
| 763 | 776 | ||
| 764 | ptp->reset_required = false; | 777 | if (ptp->rxfilter_installed) | 
| 778 | return 0; | ||
| 765 | 779 | ||
| 766 | /* Must filter on both event and general ports to ensure | 780 | /* Must filter on both event and general ports to ensure | 
| 767 | * that there is no packet re-ordering. | 781 | * that there is no packet re-ordering. | 
| @@ -794,23 +808,37 @@ static int efx_ptp_start(struct efx_nic *efx) | |||
| 794 | goto fail; | 808 | goto fail; | 
| 795 | ptp->rxfilter_general = rc; | 809 | ptp->rxfilter_general = rc; | 
| 796 | 810 | ||
| 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 | |||
| 797 | rc = efx_ptp_enable(efx); | 831 | rc = efx_ptp_enable(efx); | 
| 798 | if (rc != 0) | 832 | if (rc != 0) | 
| 799 | goto fail2; | 833 | goto fail; | 
| 800 | 834 | ||
| 801 | ptp->evt_frag_idx = 0; | 835 | ptp->evt_frag_idx = 0; | 
| 802 | ptp->current_adjfreq = 0; | 836 | ptp->current_adjfreq = 0; | 
| 803 | ptp->rxfilter_installed = true; | ||
| 804 | 837 | ||
| 805 | return 0; | 838 | return 0; | 
| 806 | 839 | ||
| 807 | fail2: | ||
| 808 | efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, | ||
| 809 | ptp->rxfilter_general); | ||
| 810 | fail: | 840 | fail: | 
| 811 | efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, | 841 | efx_ptp_remove_multicast_filters(efx); | 
| 812 | ptp->rxfilter_event); | ||
| 813 | |||
| 814 | return rc; | 842 | return rc; | 
| 815 | } | 843 | } | 
| 816 | 844 | ||
| @@ -826,13 +854,7 @@ static int efx_ptp_stop(struct efx_nic *efx) | |||
| 826 | 854 | ||
| 827 | rc = efx_ptp_disable(efx); | 855 | rc = efx_ptp_disable(efx); | 
| 828 | 856 | ||
| 829 | if (ptp->rxfilter_installed) { | 857 | efx_ptp_remove_multicast_filters(efx); | 
| 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 | } | ||
| 836 | 858 | ||
| 837 | /* Make sure RX packets are really delivered */ | 859 | /* Make sure RX packets are really delivered */ | 
| 838 | efx_ptp_deliver_rx_queue(&efx->ptp_data->rxq); | 860 | efx_ptp_deliver_rx_queue(&efx->ptp_data->rxq); | 
