diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2016-08-31 23:57:39 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-02 14:46:53 +0200 |
commit | b7d7dee5bf136010fae44209daf6675dc4c5c4c6 (patch) | |
tree | 50326426a083d4a9245413ead08a974ce90249b5 /drivers/staging/octeon | |
parent | 08712f9de1013ed360d489fc185d962dfd6be7cf (diff) |
staging: octeon: move common poll code into a separate function
Move common poll code into a separate function.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/octeon')
-rw-r--r-- | drivers/staging/octeon/ethernet-rx.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c index 27e3459a626e..140e8afb3dd3 100644 --- a/drivers/staging/octeon/ethernet-rx.c +++ b/drivers/staging/octeon/ethernet-rx.c @@ -143,14 +143,7 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work) return 0; } -/** - * cvm_oct_napi_poll - the NAPI poll function. - * @napi: The NAPI instance, or null if called from cvm_oct_poll_controller - * @budget: Maximum number of packets to receive. - * - * Returns the number of packets processed. - */ -static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) +static int cvm_oct_poll(int budget) { const int coreid = cvmx_get_core_num(); u64 old_group_mask; @@ -410,7 +403,23 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) } cvm_oct_rx_refill_pool(0); - if (rx_count < budget && napi) { + return rx_count; +} + +/** + * cvm_oct_napi_poll - the NAPI poll function. + * @napi: The NAPI instance. + * @budget: Maximum number of packets to receive. + * + * Returns the number of packets processed. + */ +static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) +{ + int rx_count; + + rx_count = cvm_oct_poll(budget); + + if (rx_count < budget) { /* No more work */ napi_complete(napi); enable_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group); @@ -427,7 +436,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) */ void cvm_oct_poll_controller(struct net_device *dev) { - cvm_oct_napi_poll(NULL, 16); + cvm_oct_poll(16); } #endif |