Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Apr 2008 04:42:56 GMT
From:      Julian Elischer <julian@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 140062 for review
Message-ID:  <200804150442.m3F4gubo007548@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=140062

Change 140062 by julian@julian_trafmon1 on 2008/04/15 04:42:50

	IFC to 140061

Affected files ...

.. //depot/projects/arp-v2/src/sys/amd64/include/pcb_ext.h#2 delete
.. //depot/projects/arp-v2/src/sys/dev/re/if_re.c#4 integrate
.. //depot/projects/arp-v2/src/sys/mips/include/ns16550.h#2 delete
.. //depot/projects/arp-v2/src/sys/mips/include/pcb_ext.h#2 delete
.. //depot/projects/arp-v2/src/sys/mips/mips/machdep.c#2 integrate
.. //depot/projects/arp-v2/src/sys/mips/mips/mainbus.c#2 integrate
.. //depot/projects/arp-v2/src/sys/net/bpf.c#4 integrate
.. //depot/projects/arp-v2/src/sys/netinet/sctp_constants.h#2 integrate
.. //depot/projects/arp-v2/src/sys/netinet/sctp_indata.c#3 integrate
.. //depot/projects/arp-v2/src/sys/netinet/sctp_input.c#3 integrate
.. //depot/projects/arp-v2/src/sys/netinet/sctp_output.c#3 integrate
.. //depot/projects/arp-v2/src/sys/netinet/sctp_usrreq.c#2 integrate
.. //depot/projects/arp-v2/src/sys/netinet/sctp_var.h#2 integrate
.. //depot/projects/arp-v2/src/sys/netinet6/sctp6_usrreq.c#2 integrate
.. //depot/projects/arp-v2/src/sys/sys/protosw.h#2 integrate
.. //depot/projects/arp-v2/src/sys/sys/socket.h#4 integrate

Differences ...

==== //depot/projects/arp-v2/src/sys/dev/re/if_re.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.113 2008/03/31 04:03:14 yongari Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.114 2008/04/15 00:46:15 yongari Exp $");
 
 /*
  * RealTek 8139C+/8169/8169S/8110S/8168/8111/8101E PCI NIC driver
@@ -1185,23 +1185,17 @@
 				device_printf(dev, "Using %d MSI messages\n",
 				    msic);
 				sc->rl_msi = 1;
+				/* Explicitly set MSI enable bit. */
+				CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE);
+				cfg = CSR_READ_1(sc, RL_CFG2);
+				cfg |= RL_CFG2_MSI;
+				CSR_WRITE_1(sc, RL_CFG2, cfg);
+				CSR_WRITE_1(sc, RL_EECMD, 0);
 			} else
 				pci_release_msi(dev);
 		}
 	}
 
-	/* For MSI capable hardwares, explicitily set/clear MSI enable bit. */
-	if (msic != 0) {
-		CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE);
-		cfg = CSR_READ_1(sc, RL_CFG2);
-		if (sc->rl_msi != 0)
-			cfg |= RL_CFG2_MSI;
-		else
-			cfg &= ~RL_CFG2_MSI;
-		CSR_WRITE_1(sc, RL_CFG2, cfg);
-		CSR_WRITE_1(sc, RL_EECMD, 0);
-	}
-
 	/* Allocate interrupt */
 	if (sc->rl_msi == 0) {
 		rid = 0;

==== //depot/projects/arp-v2/src/sys/mips/mips/machdep.c#2 (text+ko) ====

@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/mips/mips/machdep.c,v 1.1 2008/04/13 07:27:37 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/mips/mips/machdep.c,v 1.2 2008/04/15 02:50:07 imp Exp $");
 
 #include "opt_md.h"
 #include "opt_ddb.h"
@@ -93,7 +93,6 @@
 #endif
 
 #include <sys/random.h>
-#include <machine/ns16550.h>
 #include <net/if.h>
 
 #define	BOOTINFO_DEBUG	0
@@ -293,19 +292,6 @@
 	PCPU_SET(curpcb, thread0.td_pcb);
 }
 
-#ifdef	DEBUG_UART_POLLED
-void
-init_bootstrap_console()
-{
-	/*
-	 * Initalize the (temporary) bootstrap console interface, so
-	 * we can use printf until the VM system starts being setup.
-	 * The real console is initialized before then.
-	 */
-	uart_post_init(PA_2_K1VA(ADDR_NS16550_UART1));
-}
-#endif
-
 struct msgbuf *msgbufp=0;
 
 #if 0

==== //depot/projects/arp-v2/src/sys/mips/mips/mainbus.c#2 (text+ko) ====

@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/mips/mips/mainbus.c,v 1.1 2008/04/13 07:27:37 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/mips/mips/mainbus.c,v 1.2 2008/04/15 02:50:07 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -60,11 +60,6 @@
 #include <machine/pmap.h>
 #include <machine/resource.h>
 
-#ifdef	DCHU_DEBUG_UART
-#include <machine/pltfm.h>
-#include <machine/ns16550.h>
-#endif
-
 static struct rman irq_rman, port_rman, mem_rman;
 
 static	int mainbus_probe(device_t);
@@ -116,10 +111,6 @@
 };
 static devclass_t mainbus_devclass;
 
-#ifdef	DEBUG_UART
-#define	printf(s)	puts_post(PA_2_K1VA(ADDR_NS16550_UART1), s)
-#endif
-
 DRIVER_MODULE(mainbus, root, mainbus_driver, mainbus_devclass, 0, 0);
 
 static int
@@ -179,9 +170,7 @@
 	int retval = 0;
 
 	retval += bus_print_child_header(bus, child);
-#ifndef DEBUG_UART
 	retval += printf(" on motherboard\n");
-#endif
 
 	return (retval);
 }

==== //depot/projects/arp-v2/src/sys/net/bpf.c#4 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net/bpf.c,v 1.191 2008/04/07 02:51:00 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/net/bpf.c,v 1.192 2008/04/15 00:50:01 jkim Exp $");
 
 #include "opt_bpf.h"
 #include "opt_mac.h"
@@ -88,8 +88,6 @@
 
 #define PRINET  26			/* interruptible */
 
-#define	M_SKIP_BPF	M_SKIP_FIREWALL
-
 /*
  * bpf_iflist is a list of BPF interface structures, each corresponding to a
  * specific DLT.  The same network interface might have several BPF interface
@@ -843,9 +841,6 @@
 		mc = m_dup(m, M_DONTWAIT);
 		if (mc != NULL)
 			mc->m_pkthdr.rcvif = ifp;
-		/* XXX Do not return the same packet twice. */
-		if (d->bd_direction == BPF_D_INOUT)
-			m->m_flags |= M_SKIP_BPF;
 	} else
 		mc = NULL;
 
@@ -1573,9 +1568,12 @@
 	BPFIF_UNLOCK(bp);
 }
 
-#define	BPF_CHECK_DIRECTION(d, m) \
-	if (((d)->bd_direction == BPF_D_IN && (m)->m_pkthdr.rcvif == NULL) || \
-	    ((d)->bd_direction == BPF_D_OUT && (m)->m_pkthdr.rcvif != NULL))
+#define	BPF_CHECK_DIRECTION(d, i)				\
+	    (((d)->bd_direction == BPF_D_IN && (i) == NULL) ||	\
+	    ((d)->bd_direction == BPF_D_OUT && (i) != NULL))
+#define	BPF_CHECK_DUPLICATE(d, i)				\
+	    ((d)->bd_feedback &&				\
+	    (d)->bd_direction == BPF_D_INOUT &&	(i) == NULL)
 
 /*
  * Incoming linkage from device drivers, when packet is in an mbuf chain.
@@ -1588,18 +1586,14 @@
 	int gottime;
 	struct timeval tv;
 
-	if (m->m_flags & M_SKIP_BPF) {
-		m->m_flags &= ~M_SKIP_BPF;
-		return;
-	}
-
 	gottime = 0;
 
 	pktlen = m_length(m, NULL);
 
 	BPFIF_LOCK(bp);
 	LIST_FOREACH(d, &bp->bif_dlist, bd_next) {
-		BPF_CHECK_DIRECTION(d, m)
+		if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif) ||
+		    BPF_CHECK_DUPLICATE(d, m->m_pkthdr.rcvif))
 			continue;
 		BPFD_LOCK(d);
 		++d->bd_rcount;
@@ -1642,11 +1636,6 @@
 	int gottime;
 	struct timeval tv;
 
-	if (m->m_flags & M_SKIP_BPF) {
-		m->m_flags &= ~M_SKIP_BPF;
-		return;
-	}
-
 	gottime = 0;
 
 	pktlen = m_length(m, NULL);
@@ -1662,7 +1651,8 @@
 
 	BPFIF_LOCK(bp);
 	LIST_FOREACH(d, &bp->bif_dlist, bd_next) {
-		BPF_CHECK_DIRECTION(d, m)
+		if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif) ||
+		    BPF_CHECK_DUPLICATE(d, m->m_pkthdr.rcvif))
 			continue;
 		BPFD_LOCK(d);
 		++d->bd_rcount;
@@ -1685,6 +1675,7 @@
 }
 
 #undef	BPF_CHECK_DIRECTION
+#undef	BPF_CHECK_DUPLICATE
 
 /*
  * Move the packet data from interface memory (pkt) into the

==== //depot/projects/arp-v2/src/sys/netinet/sctp_constants.h#2 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_constants.h,v 1.17 2005/03/06 16:04:17 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_constants.h,v 1.34 2007/10/30 14:09:23 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_constants.h,v 1.35 2008/04/14 14:33:07 rrs Exp $");
 
 #ifndef __sctp_constants_h__
 #define __sctp_constants_h__
@@ -190,35 +190,36 @@
 #define SCTP_MBUF_IALLOC            91
 #define SCTP_MBUF_IFREE             92
 #define SCTP_MBUF_ICOPY             93
-#define SCTP_SORCV_FREECTL          94
-#define SCTP_SORCV_DOESCPY          95
-#define SCTP_SORCV_DOESLCK          96
-#define SCTP_SORCV_DOESADJ          97
-#define SCTP_SORCV_BOTWHILE         98
-#define SCTP_SORCV_PASSBF           99
-#define SCTP_SORCV_ADJD            100
-#define SCTP_UNKNOWN_MAX           101
-#define SCTP_RANDY_STUFF           102
-#define SCTP_RANDY_STUFF1          103
-#define SCTP_STRMOUT_LOG_ASSIGN	   104
-#define SCTP_STRMOUT_LOG_SEND	   105
-#define SCTP_FLIGHT_LOG_DOWN_CA    106
-#define SCTP_FLIGHT_LOG_UP         107
-#define SCTP_FLIGHT_LOG_DOWN_GAP   108
-#define SCTP_FLIGHT_LOG_DOWN_RSND  109
-#define SCTP_FLIGHT_LOG_UP_RSND    110
-#define SCTP_FLIGHT_LOG_DOWN_RSND_TO    111
-#define SCTP_FLIGHT_LOG_DOWN_WP    112
-#define SCTP_FLIGHT_LOG_UP_REVOKE  113
-#define SCTP_FLIGHT_LOG_DOWN_PDRP  114
-#define SCTP_FLIGHT_LOG_DOWN_PMTU  115
-#define SCTP_SACK_LOG_NORMAL	   116
-#define SCTP_SACK_LOG_EXPRESS	   117
-#define SCTP_MAP_TSN_ENTERS        118
-#define SCTP_THRESHOLD_CLEAR       119
-#define SCTP_THRESHOLD_INCR        120
+#define SCTP_MBUF_SPLIT             94
+#define SCTP_SORCV_FREECTL          95
+#define SCTP_SORCV_DOESCPY          96
+#define SCTP_SORCV_DOESLCK          97
+#define SCTP_SORCV_DOESADJ          98
+#define SCTP_SORCV_BOTWHILE         99
+#define SCTP_SORCV_PASSBF          100
+#define SCTP_SORCV_ADJD            101
+#define SCTP_UNKNOWN_MAX           102
+#define SCTP_RANDY_STUFF           103
+#define SCTP_RANDY_STUFF1          104
+#define SCTP_STRMOUT_LOG_ASSIGN	   105
+#define SCTP_STRMOUT_LOG_SEND	   106
+#define SCTP_FLIGHT_LOG_DOWN_CA    107
+#define SCTP_FLIGHT_LOG_UP         108
+#define SCTP_FLIGHT_LOG_DOWN_GAP   109
+#define SCTP_FLIGHT_LOG_DOWN_RSND  110
+#define SCTP_FLIGHT_LOG_UP_RSND    111
+#define SCTP_FLIGHT_LOG_DOWN_RSND_TO    112
+#define SCTP_FLIGHT_LOG_DOWN_WP    113
+#define SCTP_FLIGHT_LOG_UP_REVOKE  114
+#define SCTP_FLIGHT_LOG_DOWN_PDRP  115
+#define SCTP_FLIGHT_LOG_DOWN_PMTU  116
+#define SCTP_SACK_LOG_NORMAL	   117
+#define SCTP_SACK_LOG_EXPRESS	   118
+#define SCTP_MAP_TSN_ENTERS        119
+#define SCTP_THRESHOLD_CLEAR       120
+#define SCTP_THRESHOLD_INCR        121
 
-#define SCTP_LOG_MAX_TYPES 121
+#define SCTP_LOG_MAX_TYPES 122
 /*
  * To turn on various logging, you must first enable 'options KTR' and
  * you might want to bump the entires 'options KTR_ENTRIES=80000'.

==== //depot/projects/arp-v2/src/sys/netinet/sctp_indata.c#3 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_indata.c,v 1.48 2008/01/28 10:25:43 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_indata.c,v 1.49 2008/04/14 14:34:29 rrs Exp $");
 
 #include <netinet/sctp_os.h>
 #include <netinet/sctp_var.h>
@@ -582,6 +582,7 @@
 		/* The incoming sseq is behind where we last delivered? */
 		SCTPDBG(SCTP_DEBUG_INDATA1, "Duplicate S-SEQ:%d delivered:%d from peer, Abort  association\n",
 		    control->sinfo_ssn, strm->last_sequence_delivered);
+protocol_error:
 		/*
 		 * throw it in the stream so it gets cleaned up in
 		 * association destruction
@@ -659,6 +660,11 @@
 		 * Ok, we did not deliver this guy, find the correct place
 		 * to put it on the queue.
 		 */
+		if ((compare_with_wrap(asoc->cumulative_tsn,
+		    control->sinfo_tsn, MAX_TSN)) ||
+		    (control->sinfo_tsn == asoc->cumulative_tsn)) {
+			goto protocol_error;
+		}
 		if (TAILQ_EMPTY(&strm->inqueue)) {
 			/* Empty queue */
 			if (sctp_logging_level & SCTP_STR_LOGGING_ENABLE) {
@@ -3343,7 +3349,7 @@
 					tp1->sent++;
 				}
 			}
-		} else if (tp1->rec.data.doing_fast_retransmit) {
+		} else if ((tp1->rec.data.doing_fast_retransmit) && (sctp_cmt_on_off == 0)) {
 			/*
 			 * For those that have done a FR we must take
 			 * special consideration if we strike. I.e the

==== //depot/projects/arp-v2/src/sys/netinet/sctp_input.c#3 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_input.c,v 1.27 2005/03/06 16:04:17 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_input.c,v 1.67 2008/01/31 08:22:24 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_input.c,v 1.68 2008/04/14 18:13:33 rrs Exp $");
 
 #include <netinet/sctp_os.h>
 #include <netinet/sctp_var.h>
@@ -2182,6 +2182,20 @@
 		/* out of memory or ?? */
 		return (NULL);
 	}
+#ifdef SCTP_MBUF_LOGGING
+	if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+		struct mbuf *mat;
+
+		mat = m_sig;
+		while (mat) {
+			if (SCTP_BUF_IS_EXTENDED(mat)) {
+				sctp_log_mb(mat, SCTP_MBUF_SPLIT);
+			}
+			mat = SCTP_BUF_NEXT(mat);
+		}
+	}
+#endif
+
 	/*
 	 * compute the signature/digest for the cookie
 	 */
@@ -2795,7 +2809,7 @@
 		}
 	}
 	/* stop the timer */
-	sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_22);
+	sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_22);
 	SCTP_STAT_INCR_COUNTER32(sctps_shutdown);
 	/* free the TCB */
 	SCTPDBG(SCTP_DEBUG_INPUT2,
@@ -4807,6 +4821,19 @@
 					SCTP_BUF_NEXT(mm) = SCTP_M_COPYM(m, *offset, SCTP_SIZE32(chk_length),
 					    M_DONTWAIT);
 					if (SCTP_BUF_NEXT(mm)) {
+#ifdef SCTP_MBUF_LOGGING
+						if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+							struct mbuf *mat;
+
+							mat = SCTP_BUF_NEXT(mm);
+							while (mat) {
+								if (SCTP_BUF_IS_EXTENDED(mat)) {
+									sctp_log_mb(mat, SCTP_MBUF_ICOPY);
+								}
+								mat = SCTP_BUF_NEXT(mat);
+							}
+						}
+#endif
 						sctp_queue_op_err(stcb, mm);
 					} else {
 						sctp_m_freem(mm);

==== //depot/projects/arp-v2/src/sys/netinet/sctp_output.c#3 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_output.c,v 1.46 2005/03/06 16:04:17 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_output.c,v 1.67 2008/02/22 15:06:25 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_output.c,v 1.68 2008/04/14 14:32:32 rrs Exp $");
 
 #include <netinet/sctp_os.h>
 #include <sys/proc.h>
@@ -3157,6 +3157,19 @@
 		sctp_m_freem(mret);
 		return (NULL);
 	}
+#ifdef SCTP_MBUF_LOGGING
+	if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+		struct mbuf *mat;
+
+		mat = copy_init;
+		while (mat) {
+			if (SCTP_BUF_IS_EXTENDED(mat)) {
+				sctp_log_mb(mat, SCTP_MBUF_ICOPY);
+			}
+			mat = SCTP_BUF_NEXT(mat);
+		}
+	}
+#endif
 	copy_initack = SCTP_M_COPYM(initack, initack_offset, M_COPYALL,
 	    M_DONTWAIT);
 	if (copy_initack == NULL) {
@@ -3164,6 +3177,19 @@
 		sctp_m_freem(copy_init);
 		return (NULL);
 	}
+#ifdef SCTP_MBUF_LOGGING
+	if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+		struct mbuf *mat;
+
+		mat = copy_initack;
+		while (mat) {
+			if (SCTP_BUF_IS_EXTENDED(mat)) {
+				sctp_log_mb(mat, SCTP_MBUF_ICOPY);
+			}
+			mat = SCTP_BUF_NEXT(mat);
+		}
+	}
+#endif
 	/* easy side we just drop it on the end */
 	ph = mtod(mret, struct sctp_paramhdr *);
 	SCTP_BUF_LEN(mret) = sizeof(struct sctp_state_cookie) +
@@ -5665,6 +5691,19 @@
 		} else {
 			/* copy the old fashion way */
 			appendchain = SCTP_M_COPYM(clonechain, 0, M_COPYALL, M_DONTWAIT);
+#ifdef SCTP_MBUF_LOGGING
+			if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+				struct mbuf *mat;
+
+				mat = appendchain;
+				while (mat) {
+					if (SCTP_BUF_IS_EXTENDED(mat)) {
+						sctp_log_mb(mat, SCTP_MBUF_ICOPY);
+					}
+					mat = SCTP_BUF_NEXT(mat);
+				}
+			}
+#endif
 		}
 	}
 	if (appendchain == NULL) {
@@ -5752,6 +5791,19 @@
 			ca->cnt_failed++;
 			return;
 		}
+#ifdef SCTP_MBUF_LOGGING
+		if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+			struct mbuf *mat;
+
+			mat = m;
+			while (mat) {
+				if (SCTP_BUF_IS_EXTENDED(mat)) {
+					sctp_log_mb(mat, SCTP_MBUF_ICOPY);
+				}
+				mat = SCTP_BUF_NEXT(mat);
+			}
+		}
+#endif
 	} else {
 		m = NULL;
 	}
@@ -6490,6 +6542,19 @@
 			to_move = 0;
 			goto out_of;
 		}
+#ifdef SCTP_MBUF_LOGGING
+		if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+			struct mbuf *mat;
+
+			mat = chk->data;
+			while (mat) {
+				if (SCTP_BUF_IS_EXTENDED(mat)) {
+					sctp_log_mb(mat, SCTP_MBUF_ICOPY);
+				}
+				mat = SCTP_BUF_NEXT(mat);
+			}
+		}
+#endif
 		/* Pull off the data */
 		m_adj(sp->data, to_move);
 		/* Now lets work our way down and compact it */
@@ -7859,6 +7924,19 @@
 				/* No memory */
 				return (-2);
 			}
+#ifdef SCTP_MBUF_LOGGING
+			if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+				struct mbuf *mat;
+
+				mat = cookie;
+				while (mat) {
+					if (SCTP_BUF_IS_EXTENDED(mat)) {
+						sctp_log_mb(mat, SCTP_MBUF_ICOPY);
+					}
+					mat = SCTP_BUF_NEXT(mat);
+				}
+			}
+#endif
 			break;
 		}
 		at += SCTP_SIZE32(plen);
@@ -7920,6 +7998,19 @@
 		/* gak out of memory */
 		return;
 	}
+#ifdef SCTP_MBUF_LOGGING
+	if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+		struct mbuf *mat;
+
+		mat = outchain;
+		while (mat) {
+			if (SCTP_BUF_IS_EXTENDED(mat)) {
+				sctp_log_mb(mat, SCTP_MBUF_ICOPY);
+			}
+			mat = SCTP_BUF_NEXT(mat);
+		}
+	}
+#endif
 	chdr = mtod(outchain, struct sctp_chunkhdr *);
 	chdr->chunk_type = SCTP_HEARTBEAT_ACK;
 	chdr->chunk_flags = 0;
@@ -8175,6 +8266,20 @@
 			/* couldn't copy it */
 			return;
 		}
+#ifdef SCTP_MBUF_LOGGING
+		if (sctp_logging_level & SCTP_MBUF_LOGGING_ENABLE) {
+			struct mbuf *mat;
+
+			mat = m_ack;
+			while (mat) {
+				if (SCTP_BUF_IS_EXTENDED(mat)) {
+					sctp_log_mb(mat, SCTP_MBUF_ICOPY);
+				}
+				mat = SCTP_BUF_NEXT(mat);
+			}
+		}
+#endif
+
 		sctp_alloc_a_chunk(stcb, chk);
 		if (chk == NULL) {
 			/* no memory */
@@ -11591,7 +11696,7 @@
 			/* we already checked for non-blocking above. */
 			max_len = sndlen;
 		} else {
-			max_len = SCTP_SB_LIMIT_SND(so) - stcb->asoc.total_output_queue_size;
+			max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes;
 		}
 	} else {
 		max_len = 0;

==== //depot/projects/arp-v2/src/sys/netinet/sctp_usrreq.c#2 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_usrreq.c,v 1.48 2005/03/07 23:26:08 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_usrreq.c,v 1.52 2007/12/07 01:32:13 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_usrreq.c,v 1.53 2008/04/14 18:13:33 rrs Exp $");
 #include <netinet/sctp_os.h>
 #include <sys/proc.h>
 #include <netinet/sctp_pcb.h>
@@ -919,6 +919,37 @@
 }
 
 int
+sctp_flush(struct socket *so, int how)
+{
+	/*
+	 * We will just clear out the values and let subsequent close clear
+	 * out the data, if any. Note if the user did a shutdown(SHUT_RD)
+	 * they will not be able to read the data, the socket will block
+	 * that from happening.
+	 */
+	if ((how == PRU_FLUSH_RD) || (how == PRU_FLUSH_RDWR)) {
+		/*
+		 * First make sure the sb will be happy, we don't use these
+		 * except maybe the count
+		 */
+		so->so_rcv.sb_cc = 0;
+		so->so_rcv.sb_mbcnt = 0;
+		so->so_rcv.sb_mb = NULL;
+	}
+	if ((how == PRU_FLUSH_WR) || (how == PRU_FLUSH_RDWR)) {
+		/*
+		 * First make sure the sb will be happy, we don't use these
+		 * except maybe the count
+		 */
+		so->so_snd.sb_cc = 0;
+		so->so_snd.sb_mbcnt = 0;
+		so->so_snd.sb_mb = NULL;
+
+	}
+	return (0);
+}
+
+int
 sctp_shutdown(struct socket *so)
 {
 	struct sctp_inpcb *inp;
@@ -4008,10 +4039,11 @@
 		SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
 		return (EINVAL);
 	}
+	SCTP_INP_INCR_REF(inp);
 	SCTP_ASOC_CREATE_LOCK(inp);
 	create_lock_on = 1;
 
-	SCTP_INP_INCR_REF(inp);
+
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
 	    (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
 		/* Should I really unlock ? */
@@ -4063,7 +4095,7 @@
 		if (stcb == NULL) {
 			SCTP_INP_DECR_REF(inp);
 		} else {
-			SCTP_TCB_LOCK(stcb);
+			SCTP_TCB_UNLOCK(stcb);
 		}
 	}
 	if (stcb != NULL) {
@@ -4433,6 +4465,7 @@
 	.pru_close = sctp_close,
 	.pru_detach = sctp_close,
 	.pru_sopoll = sopoll_generic,
+	.pru_flush = sctp_flush,
 	.pru_disconnect = sctp_disconnect,
 	.pru_listen = sctp_listen,
 	.pru_peeraddr = sctp_peeraddr,

==== //depot/projects/arp-v2/src/sys/netinet/sctp_var.h#2 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_var.h,v 1.24 2005/03/06 16:04:19 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_var.h,v 1.21 2007/10/16 14:05:51 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_var.h,v 1.22 2008/04/14 18:13:33 rrs Exp $");
 
 #ifndef _NETINET_SCTP_VAR_H_
 #define _NETINET_SCTP_VAR_H_
@@ -307,6 +307,8 @@
 
 void sctp_pcbinfo_cleanup(void);
 
+int sctp_flush(struct socket *, int);
+
 int sctp_shutdown __P((struct socket *));
 void sctp_notify 
 __P((struct sctp_inpcb *, struct ip *ip, struct sctphdr *,

==== //depot/projects/arp-v2/src/sys/netinet6/sctp6_usrreq.c#2 (text+ko) ====

@@ -30,7 +30,7 @@
 /*	$KAME: sctp6_usrreq.c,v 1.38 2005/08/24 08:08:56 suz Exp $	*/
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet6/sctp6_usrreq.c,v 1.42 2007/12/10 16:03:39 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet6/sctp6_usrreq.c,v 1.43 2008/04/14 18:12:37 rrs Exp $");
 
 #include <netinet/sctp_os.h>
 #include <sys/proc.h>
@@ -1260,6 +1260,7 @@
 	.pru_close = sctp6_close,
 	.pru_detach = sctp6_close,
 	.pru_sopoll = sopoll_generic,
+	.pru_flush = sctp_flush,
 	.pru_disconnect = sctp6_disconnect,
 	.pru_listen = sctp_listen,
 	.pru_peeraddr = sctp6_getpeeraddr,

==== //depot/projects/arp-v2/src/sys/sys/protosw.h#2 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)protosw.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/sys/sys/protosw.h,v 1.57 2006/07/24 15:20:08 rwatson Exp $
+ * $FreeBSD: src/sys/sys/protosw.h,v 1.58 2008/04/14 18:06:04 rrs Exp $
  */
 
 #ifndef _SYS_PROTOSW_H_
@@ -226,7 +226,8 @@
 #define	PRUS_EOF	0x2
 #define	PRUS_MORETOCOME	0x4
 	int	(*pru_sense)(struct socket *so, struct stat *sb);
-	int	(*pru_shutdown)(struct socket *so);
+        int	(*pru_shutdown)(struct socket *so);
+	int	(*pru_flush)(struct socket *so, int direction);  
 	int	(*pru_sockaddr)(struct socket *so, struct sockaddr **nam);
 	int	(*pru_sosend)(struct socket *so, struct sockaddr *addr,
 		    struct uio *uio, struct mbuf *top, struct mbuf *control,

==== //depot/projects/arp-v2/src/sys/sys/socket.h#4 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)socket.h	8.4 (Berkeley) 2/21/94
- * $FreeBSD: src/sys/sys/socket.h,v 1.98 2008/02/03 15:54:41 phk Exp $
+ * $FreeBSD: src/sys/sys/socket.h,v 1.99 2008/04/14 18:06:04 rrs Exp $
  */
 
 #ifndef _SYS_SOCKET_H_
@@ -593,6 +593,12 @@
 #define	SHUT_WR		1		/* shut down the writing side */
 #define	SHUT_RDWR	2		/* shut down both sides */
 
+/* we cheat and use the SHUT_XX defines for these */
+#define PRU_FLUSH_RD     SHUT_RD
+#define PRU_FLUSH_WR     SHUT_WR
+#define PRU_FLUSH_RDWR   SHUT_RDWR
+
+
 #if __BSD_VISIBLE
 /*
  * sendfile(2) header/trailer struct



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804150442.m3F4gubo007548>