diff options
Diffstat (limited to 'drivers/net/ethernet/atheros/alx/main.c')
-rw-r--r-- | drivers/net/ethernet/atheros/alx/main.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index e398eda07298..c8af3ce3ea38 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c | |||
@@ -184,15 +184,16 @@ static void alx_schedule_reset(struct alx_priv *alx) | |||
184 | schedule_work(&alx->reset_wk); | 184 | schedule_work(&alx->reset_wk); |
185 | } | 185 | } |
186 | 186 | ||
187 | static bool alx_clean_rx_irq(struct alx_priv *alx, int budget) | 187 | static int alx_clean_rx_irq(struct alx_priv *alx, int budget) |
188 | { | 188 | { |
189 | struct alx_rx_queue *rxq = &alx->rxq; | 189 | struct alx_rx_queue *rxq = &alx->rxq; |
190 | struct alx_rrd *rrd; | 190 | struct alx_rrd *rrd; |
191 | struct alx_buffer *rxb; | 191 | struct alx_buffer *rxb; |
192 | struct sk_buff *skb; | 192 | struct sk_buff *skb; |
193 | u16 length, rfd_cleaned = 0; | 193 | u16 length, rfd_cleaned = 0; |
194 | int work = 0; | ||
194 | 195 | ||
195 | while (budget > 0) { | 196 | while (work < budget) { |
196 | rrd = &rxq->rrd[rxq->rrd_read_idx]; | 197 | rrd = &rxq->rrd[rxq->rrd_read_idx]; |
197 | if (!(rrd->word3 & cpu_to_le32(1 << RRD_UPDATED_SHIFT))) | 198 | if (!(rrd->word3 & cpu_to_le32(1 << RRD_UPDATED_SHIFT))) |
198 | break; | 199 | break; |
@@ -203,7 +204,7 @@ static bool alx_clean_rx_irq(struct alx_priv *alx, int budget) | |||
203 | ALX_GET_FIELD(le32_to_cpu(rrd->word0), | 204 | ALX_GET_FIELD(le32_to_cpu(rrd->word0), |
204 | RRD_NOR) != 1) { | 205 | RRD_NOR) != 1) { |
205 | alx_schedule_reset(alx); | 206 | alx_schedule_reset(alx); |
206 | return 0; | 207 | return work; |
207 | } | 208 | } |
208 | 209 | ||
209 | rxb = &rxq->bufs[rxq->read_idx]; | 210 | rxb = &rxq->bufs[rxq->read_idx]; |
@@ -243,7 +244,7 @@ static bool alx_clean_rx_irq(struct alx_priv *alx, int budget) | |||
243 | } | 244 | } |
244 | 245 | ||
245 | napi_gro_receive(&alx->napi, skb); | 246 | napi_gro_receive(&alx->napi, skb); |
246 | budget--; | 247 | work++; |
247 | 248 | ||
248 | next_pkt: | 249 | next_pkt: |
249 | if (++rxq->read_idx == alx->rx_ringsz) | 250 | if (++rxq->read_idx == alx->rx_ringsz) |
@@ -258,21 +259,22 @@ next_pkt: | |||
258 | if (rfd_cleaned) | 259 | if (rfd_cleaned) |
259 | alx_refill_rx_ring(alx, GFP_ATOMIC); | 260 | alx_refill_rx_ring(alx, GFP_ATOMIC); |
260 | 261 | ||
261 | return budget > 0; | 262 | return work; |
262 | } | 263 | } |
263 | 264 | ||
264 | static int alx_poll(struct napi_struct *napi, int budget) | 265 | static int alx_poll(struct napi_struct *napi, int budget) |
265 | { | 266 | { |
266 | struct alx_priv *alx = container_of(napi, struct alx_priv, napi); | 267 | struct alx_priv *alx = container_of(napi, struct alx_priv, napi); |
267 | struct alx_hw *hw = &alx->hw; | 268 | struct alx_hw *hw = &alx->hw; |
268 | bool complete = true; | ||
269 | unsigned long flags; | 269 | unsigned long flags; |
270 | bool tx_complete; | ||
271 | int work; | ||
270 | 272 | ||
271 | complete = alx_clean_tx_irq(alx) && | 273 | tx_complete = alx_clean_tx_irq(alx); |
272 | alx_clean_rx_irq(alx, budget); | 274 | work = alx_clean_rx_irq(alx, budget); |
273 | 275 | ||
274 | if (!complete) | 276 | if (!tx_complete || work == budget) |
275 | return 1; | 277 | return budget; |
276 | 278 | ||
277 | napi_complete(&alx->napi); | 279 | napi_complete(&alx->napi); |
278 | 280 | ||
@@ -284,7 +286,7 @@ static int alx_poll(struct napi_struct *napi, int budget) | |||
284 | 286 | ||
285 | alx_post_write(hw); | 287 | alx_post_write(hw); |
286 | 288 | ||
287 | return 0; | 289 | return work; |
288 | } | 290 | } |
289 | 291 | ||
290 | static irqreturn_t alx_intr_handle(struct alx_priv *alx, u32 intr) | 292 | static irqreturn_t alx_intr_handle(struct alx_priv *alx, u32 intr) |