Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dfb6cbf6 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'sctp-delayed-wakeups'



Marcelo Ricardo Leitner says:

====================
sctp: delay calls to sk_data_ready() as much as possible

1st patch is a preparation for the 2nd. The idea is to not call
->sk_data_ready() for every data chunk processed while processing
packets but only once before releasing the socket.

v2: patchset re-checked, small changelog fixes
v3: on patch 2, make use of local vars to make it more readable
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ea019649 fb586f25
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -210,14 +210,15 @@ struct sctp_sock {
	int user_frag;

	__u32 autoclose;
	__u8 nodelay;
	__u8 disable_fragments;
	__u8 v4mapped;
	__u8 frag_interleave;
	__u32 adaptation_ind;
	__u32 pd_point;
	__u8 recvrcvinfo;
	__u8 recvnxtinfo;
	__u16	nodelay:1,
		disable_fragments:1,
		v4mapped:1,
		frag_interleave:1,
		recvrcvinfo:1,
		recvnxtinfo:1,
		pending_data_ready:1;

	atomic_t pd_mode;
	/* Receive to here while partial delivery is in effect. */
+7 −0
Original line number Diff line number Diff line
@@ -1222,6 +1222,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
				sctp_cmd_seq_t *commands,
				gfp_t gfp)
{
	struct sock *sk = ep->base.sk;
	struct sctp_sock *sp = sctp_sk(sk);
	int error = 0;
	int force;
	sctp_cmd_t *cmd;
@@ -1742,6 +1744,11 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
			error = sctp_outq_uncork(&asoc->outqueue, gfp);
	} else if (local_cork)
		error = sctp_outq_uncork(&asoc->outqueue, gfp);

	if (sp->pending_data_ready) {
		sk->sk_data_ready(sk);
		sp->pending_data_ready = 0;
	}
	return error;
nomem:
	error = -ENOMEM;
+2 −2
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event)
		sctp_ulpq_clear_pd(ulpq);

	if (queue == &sk->sk_receive_queue)
		sk->sk_data_ready(sk);
		sctp_sk(sk)->pending_data_ready = 1;
	return 1;

out_free:
@@ -1140,5 +1140,5 @@ void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, gfp_t gfp)

	/* If there is data waiting, send it up the socket now. */
	if (sctp_ulpq_clear_pd(ulpq) || ev)
		sk->sk_data_ready(sk);
		sctp_sk(sk)->pending_data_ready = 1;
}