Skip to content

Commit 013b96e

Browse files
committed
sctp: Pass sk_buff_head explicitly to sctp_ulpq_tail_event().
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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 178ca04 commit 013b96e

3 files changed

Lines changed: 13 additions & 20 deletions

File tree

‎include/net/sctp/ulpqueue.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void sctp_ulpq_free(struct sctp_ulpq *);
5959
int sctp_ulpq_tail_data(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
6060

6161
/* Add a new event for propagation to the ULP. */
62-
int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev);
62+
int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sk_buff_head *skb_list);
6363

6464
/* Renege previously received chunks. */
6565
void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);

‎net/sctp/stream_interleave.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ static int do_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *even
13171317

13181318
skb_queue_head_init(&temp);
13191319
__skb_queue_tail(&temp, sctp_event2skb(event));
1320-
return sctp_ulpq_tail_event(ulpq, event);
1320+
return sctp_ulpq_tail_event(ulpq, &temp);
13211321
}
13221322

13231323
static struct sctp_stream_interleave sctp_stream_interleave_0 = {

‎net/sctp/ulpqueue.c‎

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
130130
*/
131131
if (event) {
132132
event_eor = (event->msg_flags & MSG_EOR) ? 1 : 0;
133-
sctp_ulpq_tail_event(ulpq, event);
133+
sctp_ulpq_tail_event(ulpq, &temp);
134134
}
135135

136136
return event_eor;
@@ -194,18 +194,17 @@ static int sctp_ulpq_clear_pd(struct sctp_ulpq *ulpq)
194194
return sctp_clear_pd(ulpq->asoc->base.sk, ulpq->asoc);
195195
}
196196

197-
/* If the SKB of 'event' is on a list, it is the first such member
198-
* of that list.
199-
*/
200-
int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event)
197+
int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sk_buff_head *skb_list)
201198
{
202199
struct sock *sk = ulpq->asoc->base.sk;
203200
struct sctp_sock *sp = sctp_sk(sk);
204-
struct sk_buff_head *queue, *skb_list;
205-
struct sk_buff *skb = sctp_event2skb(event);
201+
struct sctp_ulpevent *event;
202+
struct sk_buff_head *queue;
203+
struct sk_buff *skb;
206204
int clear_pd = 0;
207205

208-
skb_list = (struct sk_buff_head *) skb->prev;
206+
skb = __skb_peek(skb_list);
207+
event = sctp_skb2event(skb);
209208

210209
/* If the socket is just going to throw this away, do not
211210
* even try to deliver it.
@@ -258,13 +257,7 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event)
258257
}
259258
}
260259

261-
/* If we are harvesting multiple skbs they will be
262-
* collected on a list.
263-
*/
264-
if (skb_list)
265-
skb_queue_splice_tail_init(skb_list, queue);
266-
else
267-
__skb_queue_tail(queue, skb);
260+
skb_queue_splice_tail_init(skb_list, queue);
268261

269262
/* Did we just complete partial delivery and need to get
270263
* rolling again? Move pending data to the receive
@@ -757,7 +750,7 @@ static void sctp_ulpq_reasm_drain(struct sctp_ulpq *ulpq)
757750
* sctp_ulpevent for very first SKB on the temp' list.
758751
*/
759752
if (event)
760-
sctp_ulpq_tail_event(ulpq, event);
753+
sctp_ulpq_tail_event(ulpq, &temp);
761754
}
762755
}
763756

@@ -957,7 +950,7 @@ static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
957950
if (event) {
958951
/* see if we have more ordered that we can deliver */
959952
sctp_ulpq_retrieve_ordered(ulpq, event);
960-
sctp_ulpq_tail_event(ulpq, event);
953+
sctp_ulpq_tail_event(ulpq, &temp);
961954
}
962955
}
963956

@@ -1087,7 +1080,7 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq,
10871080

10881081
skb_queue_head_init(&temp);
10891082
__skb_queue_tail(&temp, sctp_event2skb(event));
1090-
sctp_ulpq_tail_event(ulpq, event);
1083+
sctp_ulpq_tail_event(ulpq, &temp);
10911084
sctp_ulpq_set_pd(ulpq);
10921085
return;
10931086
}

0 commit comments

Comments
 (0)