Author: tuexen
Date: Fri Jul  5 10:08:49 2013
New Revision: 252779
URL: http://svnweb.freebsd.org/changeset/base/252779

Log:
  Fix a bug were only 2048 streams where usable even though more than
  2048 streams were negotiated on the wire. While there, remove the
  hard coded limit of 2048 streams.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_sysctl.h

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h   Fri Jul  5 09:36:09 2013        
(r252778)
+++ head/sys/netinet/sctp_constants.h   Fri Jul  5 10:08:49 2013        
(r252779)
@@ -521,9 +521,6 @@ __FBSDID("$FreeBSD$");
 /* How long a cookie lives in milli-seconds */
 #define SCTP_DEFAULT_COOKIE_LIFE       60000
 
-/* resource limit of streams */
-#define MAX_SCTP_STREAMS       2048
-
 /* Maximum the mapping array will  grow to (TSN mapping array) */
 #define SCTP_MAPPING_ARRAY     512
 
@@ -658,6 +655,7 @@ __FBSDID("$FreeBSD$");
 
 /* How many streams I request initally by default */
 #define SCTP_OSTREAM_INITIAL 10
+#define SCTP_ISTREAM_INITIAL 2048
 
 /*
  * How many smallest_mtu's need to increase before a window update sack is

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c       Fri Jul  5 09:36:09 2013        
(r252778)
+++ head/sys/netinet/sctp_input.c       Fri Jul  5 10:08:49 2013        
(r252779)
@@ -389,9 +389,10 @@ sctp_process_init(struct sctp_init_chunk
                }
                SCTP_FREE(asoc->strmin, SCTP_M_STRMI);
        }
-       asoc->streamincnt = ntohs(init->num_outbound_streams);
-       if (asoc->streamincnt > MAX_SCTP_STREAMS) {
-               asoc->streamincnt = MAX_SCTP_STREAMS;
+       if (asoc->max_inbound_streams > ntohs(init->num_outbound_streams)) {
+               asoc->streamincnt = ntohs(init->num_outbound_streams);
+       } else {
+               asoc->streamincnt = asoc->max_inbound_streams;
        }
        SCTP_MALLOC(asoc->strmin, struct sctp_stream_in *, asoc->streamincnt *
            sizeof(struct sctp_stream_in), SCTP_M_STRMI);
@@ -403,11 +404,6 @@ sctp_process_init(struct sctp_init_chunk
        for (i = 0; i < asoc->streamincnt; i++) {
                asoc->strmin[i].stream_no = i;
                asoc->strmin[i].last_sequence_delivered = 0xffff;
-               /*
-                * U-stream ranges will be set when the cookie is unpacked.
-                * Or for the INIT sender they are un set (if pr-sctp not
-                * supported) when the INIT-ACK arrives.
-                */
                TAILQ_INIT(&asoc->strmin[i].inqueue);
                asoc->strmin[i].delivery_started = 0;
        }

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c Fri Jul  5 09:36:09 2013        (r252778)
+++ head/sys/netinet/sctp_pcb.c Fri Jul  5 10:08:49 2013        (r252779)
@@ -2503,9 +2503,6 @@ sctp_inpcb_alloc(struct socket *so, uint
        m->initial_rto = SCTP_BASE_SYSCTL(sctp_rto_initial_default);
        m->initial_init_rto_max = SCTP_BASE_SYSCTL(sctp_init_rto_max_default);
        m->sctp_sack_freq = SCTP_BASE_SYSCTL(sctp_sack_freq_default);
-
-       m->max_open_streams_intome = MAX_SCTP_STREAMS;
-
        m->max_init_times = SCTP_BASE_SYSCTL(sctp_init_rtx_max_default);
        m->max_send_times = SCTP_BASE_SYSCTL(sctp_assoc_rtx_max_default);
        m->def_net_failure = SCTP_BASE_SYSCTL(sctp_path_rtx_max_default);
@@ -2517,6 +2514,7 @@ sctp_inpcb_alloc(struct socket *so, uint
 
        m->sctp_default_cc_module = SCTP_BASE_SYSCTL(sctp_default_cc_module);
        m->sctp_default_ss_module = SCTP_BASE_SYSCTL(sctp_default_ss_module);
+       m->max_open_streams_intome = 
SCTP_BASE_SYSCTL(sctp_nr_incoming_streams_default);
        /* number of streams to pre-open on a association */
        m->pre_open_stream_count = 
SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default);
 

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c      Fri Jul  5 09:36:09 2013        
(r252778)
+++ head/sys/netinet/sctp_sysctl.c      Fri Jul  5 10:08:49 2013        
(r252779)
@@ -81,6 +81,7 @@ sctp_init_sysctls()
        SCTP_BASE_SYSCTL(sctp_path_rtx_max_default) = 
SCTPCTL_PATH_RTX_MAX_DEFAULT;
        SCTP_BASE_SYSCTL(sctp_path_pf_threshold) = 
SCTPCTL_PATH_PF_THRESHOLD_DEFAULT;
        SCTP_BASE_SYSCTL(sctp_add_more_threshold) = 
SCTPCTL_ADD_MORE_ON_OUTPUT_DEFAULT;
+       SCTP_BASE_SYSCTL(sctp_nr_incoming_streams_default) = 
SCTPCTL_INCOMING_STREAMS_DEFAULT;
        SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default) = 
SCTPCTL_OUTGOING_STREAMS_DEFAULT;
        SCTP_BASE_SYSCTL(sctp_cmt_on_off) = SCTPCTL_CMT_ON_OFF_DEFAULT;
        /* EY */
@@ -623,6 +624,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
                RANGECHK(SCTP_BASE_SYSCTL(sctp_path_rtx_max_default), 
SCTPCTL_PATH_RTX_MAX_MIN, SCTPCTL_PATH_RTX_MAX_MAX);
                RANGECHK(SCTP_BASE_SYSCTL(sctp_path_pf_threshold), 
SCTPCTL_PATH_PF_THRESHOLD_MIN, SCTPCTL_PATH_PF_THRESHOLD_MAX);
                RANGECHK(SCTP_BASE_SYSCTL(sctp_add_more_threshold), 
SCTPCTL_ADD_MORE_ON_OUTPUT_MIN, SCTPCTL_ADD_MORE_ON_OUTPUT_MAX);
+               RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_incoming_streams_default), 
SCTPCTL_INCOMING_STREAMS_MIN, SCTPCTL_INCOMING_STREAMS_MAX);
                RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), 
SCTPCTL_OUTGOING_STREAMS_MIN, SCTPCTL_OUTGOING_STREAMS_MAX);
                RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_on_off), 
SCTPCTL_CMT_ON_OFF_MIN, SCTPCTL_CMT_ON_OFF_MAX);
                /* EY */
@@ -965,6 +967,10 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUT
     &SCTP_BASE_SYSCTL(sctp_add_more_threshold), 0, sysctl_sctp_check, "IU",
     SCTPCTL_ADD_MORE_ON_OUTPUT_DESC);
 
+SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, incoming_streams, CTLTYPE_UINT | 
CTLFLAG_RW,
+    &SCTP_BASE_SYSCTL(sctp_nr_incoming_streams_default), 0, sysctl_sctp_check, 
"IU",
+    SCTPCTL_INCOMING_STREAMS_DESC);
+
 SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, outgoing_streams, CTLTYPE_UINT | 
CTLFLAG_RW,
     &SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default), 0, sysctl_sctp_check, 
"IU",
     SCTPCTL_OUTGOING_STREAMS_DESC);

Modified: head/sys/netinet/sctp_sysctl.h
==============================================================================
--- head/sys/netinet/sctp_sysctl.h      Fri Jul  5 09:36:09 2013        
(r252778)
+++ head/sys/netinet/sctp_sysctl.h      Fri Jul  5 10:08:49 2013        
(r252779)
@@ -72,6 +72,7 @@ struct sctp_sysctl {
        uint32_t sctp_path_rtx_max_default;
        uint32_t sctp_path_pf_threshold;
        uint32_t sctp_add_more_threshold;
+       uint32_t sctp_nr_incoming_streams_default;
        uint32_t sctp_nr_outgoing_streams_default;
        uint32_t sctp_cmt_on_off;
        uint32_t sctp_cmt_use_dac;
@@ -322,6 +323,12 @@ struct sctp_sysctl {
 #define SCTPCTL_ADD_MORE_ON_OUTPUT_MAX 0xFFFFFFFF
 #define SCTPCTL_ADD_MORE_ON_OUTPUT_DEFAULT SCTP_DEFAULT_ADD_MORE
 
+/* incoming_streams: Default number of incoming streams */
+#define SCTPCTL_INCOMING_STREAMS_DESC  "Default number of incoming streams"
+#define SCTPCTL_INCOMING_STREAMS_MIN   1
+#define SCTPCTL_INCOMING_STREAMS_MAX   65535
+#define SCTPCTL_INCOMING_STREAMS_DEFAULT SCTP_ISTREAM_INITIAL
+
 /* outgoing_streams: Default number of outgoing streams */
 #define SCTPCTL_OUTGOING_STREAMS_DESC  "Default number of outgoing streams"
 #define SCTPCTL_OUTGOING_STREAMS_MIN   1
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to