Commit 34515e94 authored by Xin Long's avatar Xin Long Committed by David S. Miller
Browse files

sctp: add support for Primary Path Switchover



This is a new feature defined in section 5 of rfc7829: "Primary Path
Switchover". By introducing a new tunable parameter:

  Primary.Switchover.Max.Retrans (PSMR)

The primary path will be changed to another active path when the path
error counter on the old primary path exceeds PSMR, so that "the SCTP
sender is allowed to continue data transmission on a new working path
even when the old primary destination address becomes active again".

This patch is to add this tunable parameter, 'ps_retrans' per netns,
sock, asoc and transport. It also allows a user to change ps_retrans
per netns by sysctl, and ps_retrans per sock/asoc/transport will be
initialized with it.

The check will be done in sctp_do_8_2_transport_strike() when this
feature is enabled.

Note this feature is disabled by initializing 'ps_retrans' per netns
as 0xffff by default, and its value can't be less than 'pf_retrans'
when changing by sysctl.

v3->v4:
  - add define SCTP_PS_RETRANS_MAX 0xffff, and use it on extra2 of
    sysctl 'ps_retrans'.
  - add a new entry for ps_retrans on ip-sysctl.txt.

Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8d2a6935
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -2195,6 +2195,18 @@ pf_retrans - INTEGER

	Default: 0

ps_retrans - INTEGER
	Primary.Switchover.Max.Retrans (PSMR), it's a tunable parameter coming
	from section-5 "Primary Path Switchover" in rfc7829.  The primary path
	will be changed to another active path when the path error counter on
	the old primary path exceeds PSMR, so that "the SCTP sender is allowed
	to continue data transmission on a new working path even when the old
	primary destination address becomes active again".   Note this feature
	is disabled by initializing 'ps_retrans' per netns as 0xffff by default,
	and its value can't be less than 'pf_retrans' when changing by sysctl.

	Default: 0xffff

rto_initial - INTEGER
	The initial round trip timeout value in milliseconds that will be used
	in calculating round trip times.  This is the initial time interval
+6 −0
Original line number Diff line number Diff line
@@ -89,6 +89,12 @@ struct netns_sctp {
	 */
	int pf_retrans;

	/* Primary.Switchover.Max.Retrans sysctl value
	 * taken from:
	 * https://tools.ietf.org/html/rfc7829
	 */
	int ps_retrans;

	/*
	 * Disable Potentially-Failed feature, the feature is enabled by default
	 * pf_enable	-  0  : disable pf
+2 −0
Original line number Diff line number Diff line
@@ -296,6 +296,8 @@ enum {
};
#define SCTP_PF_EXPOSE_MAX	SCTP_PF_EXPOSE_ENABLE

#define SCTP_PS_RETRANS_MAX	0xffff

/* These return values describe the success or failure of a number of
 * routines which form the lower interface to SCTP_outqueue.
 */
+8 −3
Original line number Diff line number Diff line
@@ -184,7 +184,8 @@ struct sctp_sock {
	__u32 flowlabel;
	__u8  dscp;

	int pf_retrans;
	__u16 pf_retrans;
	__u16 ps_retrans;

	/* The initial Path MTU to use for new associations. */
	__u32 pathmtu;
@@ -897,7 +898,9 @@ struct sctp_transport {
	 * and will be initialized from the assocs value.  This can be changed
	 * using the SCTP_PEER_ADDR_THLDS socket option
	 */
	int pf_retrans;
	__u16 pf_retrans;
	/* Used for primary path switchover. */
	__u16 ps_retrans;
	/* PMTU	      : The current known path MTU.  */
	__u32 pathmtu;

@@ -1773,7 +1776,9 @@ struct sctp_association {
	 * and will be initialized from the assocs value.  This can be
	 * changed using the SCTP_PEER_ADDR_THLDS socket option
	 */
	int pf_retrans;
	__u16 pf_retrans;
	/* Used for primary path switchover. */
	__u16 ps_retrans;

	/* Maximum number of times the endpoint will retransmit INIT  */
	__u16 max_init_attempts;
+3 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ static struct sctp_association *sctp_association_init(
	 */
	asoc->max_retrans = sp->assocparams.sasoc_asocmaxrxt;
	asoc->pf_retrans  = sp->pf_retrans;
	asoc->ps_retrans  = sp->ps_retrans;
	asoc->pf_expose   = sp->pf_expose;

	asoc->rto_initial = msecs_to_jiffies(sp->rtoinfo.srto_initial);
@@ -628,6 +629,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,

	/* And the partial failure retrans threshold */
	peer->pf_retrans = asoc->pf_retrans;
	/* And the primary path switchover retrans threshold */
	peer->ps_retrans = asoc->ps_retrans;

	/* Initialize the peer's SACK delay timeout based on the
	 * association configured value.
Loading