diff mbox series

[net-next,2/2] net: netsec: remove loops in napi Rx process

Message ID 1560931034-6810-2-git-send-email-ilias.apalodimas@linaro.org
State Superseded
Headers show
Series [net-next,1/2] net: netsec: initialize tx ring on ndo_open | expand

Commit Message

Ilias Apalodimas June 19, 2019, 7:57 a.m. UTC
netsec_process_rx was running in a loop trying to process as many packets
as possible before re-enabling interrupts. With the recent DMA changes
this is not needed anymore as we manage to consume all the budget without
looping over the function.
Since it has no performance penalty let's remove that and simplify the Rx
path a bit

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

---
 drivers/net/ethernet/socionext/netsec.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

-- 
2.20.1

Comments

Ard Biesheuvel June 19, 2019, 9:41 a.m. UTC | #1
On Wed, 19 Jun 2019 at 09:57, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>

> netsec_process_rx was running in a loop trying to process as many packets

> as possible before re-enabling interrupts. With the recent DMA changes

> this is not needed anymore as we manage to consume all the budget without

> looping over the function.

> Since it has no performance penalty let's remove that and simplify the Rx

> path a bit

>

> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>


Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


> ---

>  drivers/net/ethernet/socionext/netsec.c | 11 ++---------

>  1 file changed, 2 insertions(+), 9 deletions(-)

>

> diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c

> index a10ef700f16d..48fd7448b513 100644

> --- a/drivers/net/ethernet/socionext/netsec.c

> +++ b/drivers/net/ethernet/socionext/netsec.c

> @@ -820,19 +820,12 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget)

>  static int netsec_napi_poll(struct napi_struct *napi, int budget)

>  {

>         struct netsec_priv *priv;

> -       int rx, done, todo;

> +       int done;

>

>         priv = container_of(napi, struct netsec_priv, napi);

>

>         netsec_process_tx(priv);

> -

> -       todo = budget;

> -       do {

> -               rx = netsec_process_rx(priv, todo);

> -               todo -= rx;

> -       } while (rx);

> -

> -       done = budget - todo;

> +       done = netsec_process_rx(priv, budget);

>

>         if (done < budget && napi_complete_done(napi, done)) {

>                 unsigned long flags;

> --

> 2.20.1

>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index a10ef700f16d..48fd7448b513 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -820,19 +820,12 @@  static int netsec_process_rx(struct netsec_priv *priv, int budget)
 static int netsec_napi_poll(struct napi_struct *napi, int budget)
 {
 	struct netsec_priv *priv;
-	int rx, done, todo;
+	int done;
 
 	priv = container_of(napi, struct netsec_priv, napi);
 
 	netsec_process_tx(priv);
-
-	todo = budget;
-	do {
-		rx = netsec_process_rx(priv, todo);
-		todo -= rx;
-	} while (rx);
-
-	done = budget - todo;
+	done = netsec_process_rx(priv, budget);
 
 	if (done < budget && napi_complete_done(napi, done)) {
 		unsigned long flags;