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 |
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;
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 --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;
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(-)