svn commit: r218232 - head/sys/netinet

Randall Stewart rrs at FreeBSD.org
Thu Feb 3 19:22:21 UTC 2011


Author: rrs
Date: Thu Feb  3 19:22:21 2011
New Revision: 218232
URL: http://svn.freebsd.org/changeset/base/218232

Log:
  1) Move per John Baldwin to mp_maxid
  2) Some signed/unsigned errors found by Mac OS compiler (from Michael)
  3) a couple of copyright updates on the effected files.
  
  MFC after:	3 months

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

Modified: head/sys/netinet/sctp_asconf.c
==============================================================================
--- head/sys/netinet/sctp_asconf.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_asconf.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs at lakerest.net and
+ *                          Michael Tuexen, tuexen at fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -1348,7 +1351,7 @@ sctp_asconf_queue_mgmt(struct sctp_tcb *
 
 	TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next);
 #ifdef SCTP_DEBUG
-	if (SCTP_BASE_SYSCTL(sctp_debug_on) && SCTP_DEBUG_ASCONF2) {
+	if (SCTP_BASE_SYSCTL(sctp_debug_on) & SCTP_DEBUG_ASCONF2) {
 		if (type == SCTP_ADD_IP_ADDRESS) {
 			SCTP_PRINTF("asconf_queue_mgmt: inserted asconf ADD_IP_ADDRESS: ");
 			SCTPDBG_ADDR(SCTP_DEBUG_ASCONF2, sa);

Modified: head/sys/netinet/sctp_cc_functions.c
==============================================================================
--- head/sys/netinet/sctp_cc_functions.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_cc_functions.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs at lakerest.net and
+ *                          Michael Tuexen, tuexen at fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -375,8 +378,6 @@ sctp_cwnd_update_after_sack(struct sctp_
 				}
 			} else {
 				/* We are in congestion avoidance */
-				uint32_t incr;
-
 				/*
 				 * Add to pba
 				 */
@@ -514,7 +515,8 @@ sctp_cwnd_update_after_packet_dropped(st
     uint32_t * bottle_bw, uint32_t * on_queue)
 {
 	uint32_t bw_avail;
-	int rtt, incr;
+	int rtt;
+	unsigned int incr;
 	int old_cwnd = net->cwnd;
 
 	/* need real RTT for this calc */

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_constants.h	Thu Feb  3 19:22:21 2011	(r218232)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs at lakerest.net and
+ *                          Michael Tuexen, tuexen at fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -915,11 +918,11 @@ __FBSDID("$FreeBSD$");
 
 /* modular comparison */
 /* See RFC 1982 for details. */
-#define SCTP_SSN_GT(a, b) (((a < b) && ((b - a) > (1<<15))) || \
-                           ((a > b) && ((a - b) < (1<<15))))
+#define SCTP_SSN_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \
+                           ((a > b) && ((uint16_t)(a - b) < (1U<<15))))
 #define SCTP_SSN_GE(a, b) (SCTP_SSN_GT(a, b) || (a == b))
-#define SCTP_TSN_GT(a, b) (((a < b) && ((b - a) > (1<<31))) || \
-                           ((a > b) && ((a - b) < (1<<31))))
+#define SCTP_TSN_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \
+                           ((a > b) && ((uint32_t)(a - b) < (1U<<31))))
 #define SCTP_TSN_GE(a, b) (SCTP_TSN_GT(a, b) || (a == b))
 
 /* Mapping array manipulation routines */

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_input.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs at lakerest.net and
+ *                          Michael Tuexen, tuexen at fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -2918,7 +2921,7 @@ sctp_handle_ecn_echo(struct sctp_ecne_ch
 	uint8_t override_bit = 0;
 	uint32_t tsn, window_data_tsn;
 	int len;
-	int pkt_cnt;
+	unsigned int pkt_cnt;
 
 	len = ntohs(cp->ch.chunk_length);
 	if ((len != sizeof(struct sctp_ecne_chunk)) &&
@@ -5933,7 +5936,7 @@ sctp_input(struct mbuf *m, int off)
 	int offset;
 	int cpu_to_use;
 
-	if (mp_ncpus > 1) {
+	if (mp_maxid > 1) {
 		ip = mtod(m, struct ip *);
 		offset = off + sizeof(*sh);
 		if (SCTP_BUF_LEN(m) < offset) {
@@ -5944,7 +5947,7 @@ sctp_input(struct mbuf *m, int off)
 			ip = mtod(m, struct ip *);
 		}
 		sh = (struct sctphdr *)((caddr_t)ip + off);
-		cpu_to_use = ntohl(sh->v_tag) % mp_ncpus;
+		cpu_to_use = ntohl(sh->v_tag) % mp_maxid;
 		sctp_queue_to_mcore(m, off, cpu_to_use);
 		return;
 	}

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_output.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -1,5 +1,8 @@
 /*-
  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2011, by Randall Stewart, rrs at lakerest.net and
+ *                          Michael Tuexen, tuexen at fh-muenster.de
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -9311,14 +9314,15 @@ sctp_chunk_output(struct sctp_inpcb *inp
 	 */
 	struct sctp_association *asoc;
 	struct sctp_nets *net;
-	int error = 0, num_out = 0, tot_out = 0, ret = 0, reason_code = 0,
-	    burst_cnt = 0;
+	int error = 0, num_out = 0, tot_out = 0, ret = 0, reason_code = 0;
+	unsigned int burst_cnt = 0;
 	struct timeval now;
 	int now_filled = 0;
 	int nagle_on = 0;
 	int frag_point = sctp_get_frag_point(stcb, &stcb->asoc);
 	int un_sent = 0;
-	int fr_done, tot_frs = 0;
+	int fr_done;
+	unsigned int tot_frs = 0;
 
 	asoc = &stcb->asoc;
 	if (from_where == SCTP_OUTPUT_FROM_USR_SEND) {

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_pcb.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -5549,27 +5549,27 @@ sctp_startup_mcore_threads(void)
 {
 	int i;
 
-	if (mp_ncpus == 1)
+	if (mp_maxid == 1)
 		return;
 
 	SCTP_MALLOC(sctp_mcore_workers, struct sctp_mcore_ctrl *,
-	    (mp_ncpus * sizeof(struct sctp_mcore_ctrl)),
+	    (mp_maxid * sizeof(struct sctp_mcore_ctrl)),
 	    SCTP_M_MCORE);
 	if (sctp_mcore_workers == NULL) {
 		/* TSNH I hope */
 		return;
 	}
-	memset(sctp_mcore_workers, 0, (mp_ncpus *
+	memset(sctp_mcore_workers, 0, (mp_maxid *
 	    sizeof(struct sctp_mcore_ctrl)));
 	/* Init the structures */
-	for (i = 0; i < mp_ncpus; i++) {
+	for (i = 0; i < mp_maxid; i++) {
 		TAILQ_INIT(&sctp_mcore_workers[i].que);
 		SCTP_MCORE_LOCK_INIT(&sctp_mcore_workers[i]);
 		SCTP_MCORE_QLOCK_INIT(&sctp_mcore_workers[i]);
 		sctp_mcore_workers[i].cpuid = i;
 	}
 	/* Now start them all */
-	for (i = 0; i < mp_ncpus; i++) {
+	for (i = 0; i < mp_maxid; i++) {
 		(void)kproc_create(sctp_mcore_thread,
 		    (void *)&sctp_mcore_workers[i],
 		    &sctp_mcore_workers[i].thread_proc,
@@ -5604,12 +5604,12 @@ sctp_pcb_init()
 #endif
 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
 	SCTP_MALLOC(SCTP_BASE_STATS, struct sctpstat *,
-	    (mp_ncpus * sizeof(struct sctpstat)),
+	    (mp_maxid * sizeof(struct sctpstat)),
 	    SCTP_M_MCORE);
 #endif
 	(void)SCTP_GETTIME_TIMEVAL(&tv);
 #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
-	bzero(SCTP_BASE_STATS, (sizeof(struct sctpstat) * mp_ncpus));
+	bzero(SCTP_BASE_STATS, (sizeof(struct sctpstat) * mp_maxid));
 	SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_sec = (uint32_t) tv.tv_sec;
 	SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_usec = (uint32_t) tv.tv_usec;
 #else

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c	Thu Feb  3 18:50:10 2011	(r218231)
+++ head/sys/netinet/sctp_sysctl.c	Thu Feb  3 19:22:21 2011	(r218232)
@@ -664,7 +664,7 @@ sysctl_stat_get(SYSCTL_HANDLER_ARGS)
 		return (EINVAL);
 	}
 	memset(&sb, 0, sizeof(sb));
-	for (cpu = 0; cpu < mp_ncpus; cpu++) {
+	for (cpu = 0; cpu < mp_maxid; cpu++) {
 		sarry = &SCTP_BASE_STATS[cpu];
 		if (sarry->sctps_discontinuitytime.tv_sec > sb.sctps_discontinuitytime.tv_sec) {
 			sb.sctps_discontinuitytime.tv_sec = sarry->sctps_discontinuitytime.tv_sec;


More information about the svn-src-head mailing list