netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, lucien.xin@gmail.com, nhorman@tuxdriver.com
Subject: Re: [PATCH v5 5/5] sctp: Pass sk_buff_head explicitly to sctp_ulpq_tail_event().
Date: Thu, 11 Apr 2019 19:19:46 -0300	[thread overview]
Message-ID: <20190411221946.GQ10452@localhost.localdomain> (raw)
In-Reply-To: <20190411.150207.1202792333614364121.davem@davemloft.net>

On Thu, Apr 11, 2019 at 03:02:07PM -0700, David Miller wrote:
> 
> Now the SKB list implementation assumption can be removed.
> 
> And now that we know that the list head is always non-NULL
> we can remove the code blocks dealing with that as well.
> 
> Signed-off-by: David S. Miller <davem@davemloft.net>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

Thanks!

> ---
>  include/net/sctp/ulpqueue.h  |  2 +-
>  net/sctp/stream_interleave.c |  2 +-
>  net/sctp/ulpqueue.c          | 29 +++++++++++------------------
>  3 files changed, 13 insertions(+), 20 deletions(-)
> 
> diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
> index bb0ecba3db2b..f4ac7117ff29 100644
> --- a/include/net/sctp/ulpqueue.h
> +++ b/include/net/sctp/ulpqueue.h
> @@ -59,7 +59,7 @@ void sctp_ulpq_free(struct sctp_ulpq *);
>  int sctp_ulpq_tail_data(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
>  
>  /* Add a new event for propagation to the ULP. */
> -int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev);
> +int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sk_buff_head *skb_list);
>  
>  /* Renege previously received chunks.  */
>  void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
> diff --git a/net/sctp/stream_interleave.c b/net/sctp/stream_interleave.c
> index 2c50627bdfdb..25e0b7e5189c 100644
> --- a/net/sctp/stream_interleave.c
> +++ b/net/sctp/stream_interleave.c
> @@ -1317,7 +1317,7 @@ static int do_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *even
>  
>  	skb_queue_head_init(&temp);
>  	__skb_queue_tail(&temp, sctp_event2skb(event));
> -	return sctp_ulpq_tail_event(ulpq, event);
> +	return sctp_ulpq_tail_event(ulpq, &temp);
>  }
>  
>  static struct sctp_stream_interleave sctp_stream_interleave_0 = {
> diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
> index a698f1a509bf..7cdc3623fa35 100644
> --- a/net/sctp/ulpqueue.c
> +++ b/net/sctp/ulpqueue.c
> @@ -130,7 +130,7 @@ int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
>  	 */
>  	if (event) {
>  		event_eor = (event->msg_flags & MSG_EOR) ? 1 : 0;
> -		sctp_ulpq_tail_event(ulpq, event);
> +		sctp_ulpq_tail_event(ulpq, &temp);
>  	}
>  
>  	return event_eor;
> @@ -194,18 +194,17 @@ static int sctp_ulpq_clear_pd(struct sctp_ulpq *ulpq)
>  	return sctp_clear_pd(ulpq->asoc->base.sk, ulpq->asoc);
>  }
>  
> -/* If the SKB of 'event' is on a list, it is the first such member
> - * of that list.
> - */
> -int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event)
> +int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sk_buff_head *skb_list)
>  {
>  	struct sock *sk = ulpq->asoc->base.sk;
>  	struct sctp_sock *sp = sctp_sk(sk);
> -	struct sk_buff_head *queue, *skb_list;
> -	struct sk_buff *skb = sctp_event2skb(event);
> +	struct sctp_ulpevent *event;
> +	struct sk_buff_head *queue;
> +	struct sk_buff *skb;
>  	int clear_pd = 0;
>  
> -	skb_list = (struct sk_buff_head *) skb->prev;
> +	skb = __skb_peek(skb_list);
> +	event = sctp_skb2event(skb);
>  
>  	/* If the socket is just going to throw this away, do not
>  	 * even try to deliver it.
> @@ -258,13 +257,7 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event)
>  		}
>  	}
>  
> -	/* If we are harvesting multiple skbs they will be
> -	 * collected on a list.
> -	 */
> -	if (skb_list)
> -		skb_queue_splice_tail_init(skb_list, queue);
> -	else
> -		__skb_queue_tail(queue, skb);
> +	skb_queue_splice_tail_init(skb_list, queue);
>  
>  	/* Did we just complete partial delivery and need to get
>  	 * rolling again?  Move pending data to the receive
> @@ -757,7 +750,7 @@ static void sctp_ulpq_reasm_drain(struct sctp_ulpq *ulpq)
>  		 * sctp_ulpevent for  very first SKB on the  temp' list.
>  		 */
>  		if (event)
> -			sctp_ulpq_tail_event(ulpq, event);
> +			sctp_ulpq_tail_event(ulpq, &temp);
>  	}
>  }
>  
> @@ -957,7 +950,7 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
>  	if (event) {
>  		/* see if we have more ordered that we can deliver */
>  		sctp_ulpq_retrieve_ordered(ulpq, event);
> -		sctp_ulpq_tail_event(ulpq, event);
> +		sctp_ulpq_tail_event(ulpq, &temp);
>  	}
>  }
>  
> @@ -1087,7 +1080,7 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq,
>  
>  			skb_queue_head_init(&temp);
>  			__skb_queue_tail(&temp, sctp_event2skb(event));
> -			sctp_ulpq_tail_event(ulpq, event);
> +			sctp_ulpq_tail_event(ulpq, &temp);
>  			sctp_ulpq_set_pd(ulpq);
>  			return;
>  		}
> -- 
> 2.20.1
> 

      reply	other threads:[~2019-04-11 22:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 22:02 [PATCH v5 5/5] sctp: Pass sk_buff_head explicitly to sctp_ulpq_tail_event() David Miller
2019-04-11 22:19 ` Marcelo Ricardo Leitner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190411221946.GQ10452@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).