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

Merge branch 'sctp'



Daniel Borkmann says:

====================
Misc SCTP updates

Daniel Borkmann (2):
  net: sctp: improve timer slack calculation for transport HBs
  net: sctp: only warn in proc_sctp_do_alpha_beta if write
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
parents eb1ac820 eaea2da7
Loading
Loading
Loading
Loading
+0 −21
Original line number Original line Diff line number Diff line
@@ -388,27 +388,6 @@ static inline int sctp_list_single_entry(struct list_head *head)
	return (head->next != head) && (head->next == head->prev);
	return (head->next != head) && (head->next == head->prev);
}
}


/* Generate a random jitter in the range of -50% ~ +50% of input RTO. */
static inline __s32 sctp_jitter(__u32 rto)
{
	static __u32 sctp_rand;
	__s32 ret;

	/* Avoid divide by zero. */
	if (!rto)
		rto = 1;

	sctp_rand += jiffies;
	sctp_rand ^= (sctp_rand << 12);
	sctp_rand ^= (sctp_rand >> 20);

	/* Choose random number from 0 to rto, then move to -50% ~ +50%
	 * of rto.
	 */
	ret = sctp_rand % rto - (rto >> 1);
	return ret;
}

/* Break down data chunks at this point.  */
/* Break down data chunks at this point.  */
static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
{
{
+3 −2
Original line number Original line Diff line number Diff line
@@ -424,6 +424,7 @@ static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write,
				   void __user *buffer, size_t *lenp,
				   void __user *buffer, size_t *lenp,
				   loff_t *ppos)
				   loff_t *ppos)
{
{
	if (write)
		pr_warn_once("Changing rto_alpha or rto_beta may lead to "
		pr_warn_once("Changing rto_alpha or rto_beta may lead to "
			     "suboptimal rtt/srtt estimations!\n");
			     "suboptimal rtt/srtt estimations!\n");


+9 −8
Original line number Original line Diff line number Diff line
@@ -594,15 +594,16 @@ void sctp_transport_burst_reset(struct sctp_transport *t)
}
}


/* What is the next timeout value for this transport? */
/* What is the next timeout value for this transport? */
unsigned long sctp_transport_timeout(struct sctp_transport *t)
unsigned long sctp_transport_timeout(struct sctp_transport *trans)
{
{
	unsigned long timeout;
	/* RTO + timer slack +/- 50% of RTO */
	timeout = t->rto + sctp_jitter(t->rto);
	unsigned long timeout = (trans->rto >> 1) + prandom_u32_max(trans->rto);
	if ((t->state != SCTP_UNCONFIRMED) &&

	    (t->state != SCTP_PF))
	if (trans->state != SCTP_UNCONFIRMED &&
		timeout += t->hbinterval;
	    trans->state != SCTP_PF)
	timeout += jiffies;
		timeout += trans->hbinterval;
	return timeout;

	return timeout + jiffies;
}
}


/* Reset transport variables to their initial values */
/* Reset transport variables to their initial values */