diff mbox series

[6/8] net: sfc: use skb_list_walk_safe helper for gso segments

Message ID 20200108215909.421487-7-Jason@zx2c4.com
State Accepted
Delegated to: David Miller
Headers show
Series reduce open coded skb->next access for gso segment walking | expand

Commit Message

Jason A. Donenfeld Jan. 8, 2020, 9:59 p.m. UTC
This is a straight-forward conversion case for the new function, and
while we're at it, we can remove a null write to skb->next by replacing
it with skb_mark_not_on_list.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/net/ethernet/sfc/tx.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Edward Cree Feb. 18, 2020, 3:34 p.m. UTC | #1
On 08/01/2020 21:59, Jason A. Donenfeld wrote:
> This is a straight-forward conversion case for the new function, and
> while we're at it, we can remove a null write to skb->next by replacing
> it with skb_mark_not_on_list.
>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  drivers/net/ethernet/sfc/tx.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
> index 00c1c4402451..547692b33b4d 100644
> --- a/drivers/net/ethernet/sfc/tx.c
> +++ b/drivers/net/ethernet/sfc/tx.c
> @@ -473,12 +473,9 @@ static int efx_tx_tso_fallback(struct efx_tx_queue *tx_queue,
>  	dev_consume_skb_any(skb);
>  	skb = segments;
>  
> -	while (skb) {
> -		next = skb->next;
> -		skb->next = NULL;
> -
> +	skb_list_walk_safe(skb, skb, next) {
Could this be replaced with
    skb_list_walk_safe(segments, skb, next) {
and elide the assignment just above?
Or is there some reason I'm missing not to do that?
-ed
> +		skb_mark_not_on_list(skb);
>  		efx_enqueue_skb(tx_queue, skb);
> -		skb = next;
>  	}
>  
>  	return 0;
Jason A. Donenfeld Feb. 18, 2020, 3:54 p.m. UTC | #2
On Tue, Feb 18, 2020 at 4:35 PM Edward Cree <ecree@solarflare.com> wrote:
>
> On 08/01/2020 21:59, Jason A. Donenfeld wrote:
> > This is a straight-forward conversion case for the new function, and
> > while we're at it, we can remove a null write to skb->next by replacing
> > it with skb_mark_not_on_list.
> >
> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> > ---
> >  drivers/net/ethernet/sfc/tx.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
> > index 00c1c4402451..547692b33b4d 100644
> > --- a/drivers/net/ethernet/sfc/tx.c
> > +++ b/drivers/net/ethernet/sfc/tx.c
> > @@ -473,12 +473,9 @@ static int efx_tx_tso_fallback(struct efx_tx_queue *tx_queue,
> >       dev_consume_skb_any(skb);
> >       skb = segments;
> >
> > -     while (skb) {
> > -             next = skb->next;
> > -             skb->next = NULL;
> > -
> > +     skb_list_walk_safe(skb, skb, next) {
> Could this be replaced with
>     skb_list_walk_safe(segments, skb, next) {
> and elide the assignment just above?
> Or is there some reason I'm missing not to do that?

Yes that's probably correct.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 00c1c4402451..547692b33b4d 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -473,12 +473,9 @@  static int efx_tx_tso_fallback(struct efx_tx_queue *tx_queue,
 	dev_consume_skb_any(skb);
 	skb = segments;
 
-	while (skb) {
-		next = skb->next;
-		skb->next = NULL;
-
+	skb_list_walk_safe(skb, skb, next) {
+		skb_mark_not_on_list(skb);
 		efx_enqueue_skb(tx_queue, skb);
-		skb = next;
 	}
 
 	return 0;