aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2012-02-08 02:51:27 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-03-19 04:58:58 -0400
commiteb01b9759e733c0ede11d35e3cde5b3c24ab32c9 (patch)
tree11211eb5b108b24fd4ae47caa8175c64ae500430
parent6bb78cfb50bfbaf90646a80448ee8de2372e292a (diff)
ixgbe: Move poll routine in order to improve readability
This change relocates the ixgbe_poll routine so it is right next to the interrupt routine that schedules and calls it. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Stephen Ko <stephen.s.ko@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 6453e3a589ec..73bba8b41831 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2308,6 +2308,55 @@ static irqreturn_t ixgbe_msix_clean_rings(int irq, void *data)
2308} 2308}
2309 2309
2310/** 2310/**
2311 * ixgbe_poll - NAPI Rx polling callback
2312 * @napi: structure for representing this polling device
2313 * @budget: how many packets driver is allowed to clean
2314 *
2315 * This function is used for legacy and MSI, NAPI mode
2316 **/
2317static int ixgbe_poll(struct napi_struct *napi, int budget)
2318{
2319 struct ixgbe_q_vector *q_vector =
2320 container_of(napi, struct ixgbe_q_vector, napi);
2321 struct ixgbe_adapter *adapter = q_vector->adapter;
2322 struct ixgbe_ring *ring;
2323 int per_ring_budget;
2324 bool clean_complete = true;
2325
2326#ifdef CONFIG_IXGBE_DCA
2327 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED)
2328 ixgbe_update_dca(q_vector);
2329#endif
2330
2331 ixgbe_for_each_ring(ring, q_vector->tx)
2332 clean_complete &= !!ixgbe_clean_tx_irq(q_vector, ring);
2333
2334 /* attempt to distribute budget to each queue fairly, but don't allow
2335 * the budget to go below 1 because we'll exit polling */
2336 if (q_vector->rx.count > 1)
2337 per_ring_budget = max(budget/q_vector->rx.count, 1);
2338 else
2339 per_ring_budget = budget;
2340
2341 ixgbe_for_each_ring(ring, q_vector->rx)
2342 clean_complete &= ixgbe_clean_rx_irq(q_vector, ring,
2343 per_ring_budget);
2344
2345 /* If all work not completed, return budget and keep polling */
2346 if (!clean_complete)
2347 return budget;
2348
2349 /* all work done, exit the polling mode */
2350 napi_complete(napi);
2351 if (adapter->rx_itr_setting & 1)
2352 ixgbe_set_itr(q_vector);
2353 if (!test_bit(__IXGBE_DOWN, &adapter->state))
2354 ixgbe_irq_enable_queues(adapter, ((u64)1 << q_vector->v_idx));
2355
2356 return 0;
2357}
2358
2359/**
2311 * ixgbe_request_msix_irqs - Initialize MSI-X interrupts 2360 * ixgbe_request_msix_irqs - Initialize MSI-X interrupts
2312 * @adapter: board private structure 2361 * @adapter: board private structure
2313 * 2362 *
@@ -4254,55 +4303,6 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
4254} 4303}
4255 4304
4256/** 4305/**
4257 * ixgbe_poll - NAPI Rx polling callback
4258 * @napi: structure for representing this polling device
4259 * @budget: how many packets driver is allowed to clean
4260 *
4261 * This function is used for legacy and MSI, NAPI mode
4262 **/
4263static int ixgbe_poll(struct napi_struct *napi, int budget)
4264{
4265 struct ixgbe_q_vector *q_vector =
4266 container_of(napi, struct ixgbe_q_vector, napi);
4267 struct ixgbe_adapter *adapter = q_vector->adapter;
4268 struct ixgbe_ring *ring;
4269 int per_ring_budget;
4270 bool clean_complete = true;
4271
4272#ifdef CONFIG_IXGBE_DCA
4273 if (adapter->flags & IXGBE_FLAG_DCA_ENABLED)
4274 ixgbe_update_dca(q_vector);
4275#endif
4276
4277 ixgbe_for_each_ring(ring, q_vector->tx)
4278 clean_complete &= !!ixgbe_clean_tx_irq(q_vector, ring);
4279
4280 /* attempt to distribute budget to each queue fairly, but don't allow
4281 * the budget to go below 1 because we'll exit polling */
4282 if (q_vector->rx.count > 1)
4283 per_ring_budget = max(budget/q_vector->rx.count, 1);
4284 else
4285 per_ring_budget = budget;
4286
4287 ixgbe_for_each_ring(ring, q_vector->rx)
4288 clean_complete &= ixgbe_clean_rx_irq(q_vector, ring,
4289 per_ring_budget);
4290
4291 /* If all work not completed, return budget and keep polling */
4292 if (!clean_complete)
4293 return budget;
4294
4295 /* all work done, exit the polling mode */
4296 napi_complete(napi);
4297 if (adapter->rx_itr_setting & 1)
4298 ixgbe_set_itr(q_vector);
4299 if (!test_bit(__IXGBE_DOWN, &adapter->state))
4300 ixgbe_irq_enable_queues(adapter, ((u64)1 << q_vector->v_idx));
4301
4302 return 0;
4303}
4304
4305/**
4306 * ixgbe_tx_timeout - Respond to a Tx Hang 4306 * ixgbe_tx_timeout - Respond to a Tx Hang
4307 * @netdev: network interface device structure 4307 * @netdev: network interface device structure
4308 **/ 4308 **/