@@ -2138,17 +2138,14 @@ static void airoha_hw_cleanup(struct airoha_qdma *qdma)
2138
2138
if (!qdma -> q_rx [i ].ndesc )
2139
2139
continue ;
2140
2140
2141
- napi_disable (& qdma -> q_rx [i ].napi );
2142
2141
netif_napi_del (& qdma -> q_rx [i ].napi );
2143
2142
airoha_qdma_cleanup_rx_queue (& qdma -> q_rx [i ]);
2144
2143
if (qdma -> q_rx [i ].page_pool )
2145
2144
page_pool_destroy (qdma -> q_rx [i ].page_pool );
2146
2145
}
2147
2146
2148
- for (i = 0 ; i < ARRAY_SIZE (qdma -> q_tx_irq ); i ++ ) {
2149
- napi_disable (& qdma -> q_tx_irq [i ].napi );
2147
+ for (i = 0 ; i < ARRAY_SIZE (qdma -> q_tx_irq ); i ++ )
2150
2148
netif_napi_del (& qdma -> q_tx_irq [i ].napi );
2151
- }
2152
2149
2153
2150
for (i = 0 ; i < ARRAY_SIZE (qdma -> q_tx ); i ++ ) {
2154
2151
if (!qdma -> q_tx [i ].ndesc )
@@ -2173,6 +2170,21 @@ static void airoha_qdma_start_napi(struct airoha_qdma *qdma)
2173
2170
}
2174
2171
}
2175
2172
2173
+ static void airoha_qdma_stop_napi (struct airoha_qdma * qdma )
2174
+ {
2175
+ int i ;
2176
+
2177
+ for (i = 0 ; i < ARRAY_SIZE (qdma -> q_tx_irq ); i ++ )
2178
+ napi_disable (& qdma -> q_tx_irq [i ].napi );
2179
+
2180
+ for (i = 0 ; i < ARRAY_SIZE (qdma -> q_rx ); i ++ ) {
2181
+ if (!qdma -> q_rx [i ].ndesc )
2182
+ continue ;
2183
+
2184
+ napi_disable (& qdma -> q_rx [i ].napi );
2185
+ }
2186
+ }
2187
+
2176
2188
static void airoha_update_hw_stats (struct airoha_gdm_port * port )
2177
2189
{
2178
2190
struct airoha_eth * eth = port -> qdma -> eth ;
@@ -2738,7 +2750,7 @@ static int airoha_probe(struct platform_device *pdev)
2738
2750
2739
2751
err = airoha_hw_init (pdev , eth );
2740
2752
if (err )
2741
- goto error ;
2753
+ goto error_hw_cleanup ;
2742
2754
2743
2755
for (i = 0 ; i < ARRAY_SIZE (eth -> qdma ); i ++ )
2744
2756
airoha_qdma_start_napi (& eth -> qdma [i ]);
@@ -2753,13 +2765,16 @@ static int airoha_probe(struct platform_device *pdev)
2753
2765
err = airoha_alloc_gdm_port (eth , np );
2754
2766
if (err ) {
2755
2767
of_node_put (np );
2756
- goto error ;
2768
+ goto error_napi_stop ;
2757
2769
}
2758
2770
}
2759
2771
2760
2772
return 0 ;
2761
2773
2762
- error :
2774
+ error_napi_stop :
2775
+ for (i = 0 ; i < ARRAY_SIZE (eth -> qdma ); i ++ )
2776
+ airoha_qdma_stop_napi (& eth -> qdma [i ]);
2777
+ error_hw_cleanup :
2763
2778
for (i = 0 ; i < ARRAY_SIZE (eth -> qdma ); i ++ )
2764
2779
airoha_hw_cleanup (& eth -> qdma [i ]);
2765
2780
@@ -2780,8 +2795,10 @@ static void airoha_remove(struct platform_device *pdev)
2780
2795
struct airoha_eth * eth = platform_get_drvdata (pdev );
2781
2796
int i ;
2782
2797
2783
- for (i = 0 ; i < ARRAY_SIZE (eth -> qdma ); i ++ )
2798
+ for (i = 0 ; i < ARRAY_SIZE (eth -> qdma ); i ++ ) {
2799
+ airoha_qdma_stop_napi (& eth -> qdma [i ]);
2784
2800
airoha_hw_cleanup (& eth -> qdma [i ]);
2801
+ }
2785
2802
2786
2803
for (i = 0 ; i < ARRAY_SIZE (eth -> ports ); i ++ ) {
2787
2804
struct airoha_gdm_port * port = eth -> ports [i ];
0 commit comments