PERFORCE change 115202 for review
John Baldwin
jhb at FreeBSD.org
Thu Mar 1 13:54:59 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=115202
Change 115202 by jhb at jhb_zion on 2007/03/01 13:54:06
IFC @115200.
Affected files ...
.. //depot/projects/smpng/sys/arm/at91/ohci_atmelarm.c#2 integrate
.. //depot/projects/smpng/sys/dev/em/if_em.c#80 integrate
.. //depot/projects/smpng/sys/dev/usb/umass.c#61 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdevs#101 integrate
.. //depot/projects/smpng/sys/kern/kern_mutex.c#141 integrate
.. //depot/projects/smpng/sys/kern/kern_sx.c#41 integrate
.. //depot/projects/smpng/sys/kern/uipc_usrreq.c#74 integrate
.. //depot/projects/smpng/sys/net/if_vlan_var.h#18 integrate
.. //depot/projects/smpng/sys/netinet/ip_mroute.c#54 integrate
.. //depot/projects/smpng/sys/netinet/ip_output.c#90 integrate
.. //depot/projects/smpng/sys/netinet/tcp_input.c#96 integrate
.. //depot/projects/smpng/sys/netinet/tcp_output.c#43 integrate
.. //depot/projects/smpng/sys/netinet6/ip6_mroute.c#30 integrate
.. //depot/projects/smpng/sys/netinet6/ip6_mroute.h#7 integrate
.. //depot/projects/smpng/sys/sys/priv.h#3 integrate
.. //depot/projects/smpng/sys/sys/systm.h#80 integrate
Differences ...
==== //depot/projects/smpng/sys/arm/at91/ohci_atmelarm.c#2 (text) ====
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/at91/ohci_atmelarm.c,v 1.1 2006/03/18 01:45:29 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/at91/ohci_atmelarm.c,v 1.2 2007/03/01 09:10:55 piso Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -99,8 +99,8 @@
}
device_set_ivars(sc->sc_ohci.sc_bus.bdev, &sc->sc_ohci.sc_bus);
- err = bus_setup_intr(dev, sc->sc_ohci.irq_res, INTR_TYPE_BIO, ohci_intr, sc,
- &sc->sc_ohci.ih);
+ err = bus_setup_intr(dev, sc->sc_ohci.irq_res, INTR_TYPE_BIO, NULL,
+ ohci_intr, sc, &sc->sc_ohci.ih);
if (err) {
err = ENXIO;
goto error;
==== //depot/projects/smpng/sys/dev/em/if_em.c#80 (text+ko) ====
@@ -31,7 +31,7 @@
***************************************************************************/
-/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.169 2007/02/23 12:18:38 piso Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.171 2007/02/28 09:04:46 ru Exp $*/
#ifdef HAVE_KERNEL_OPTION_HEADERS
#include "opt_device_polling.h"
==== //depot/projects/smpng/sys/dev/usb/umass.c#61 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/usb/umass.c,v 1.141 2007/02/21 07:46:40 n_hibma Exp $
+ * $FreeBSD: src/sys/dev/usb/umass.c,v 1.142 2007/02/27 22:33:50 imp Exp $
* $NetBSD: umass.c,v 1.28 2000/04/02 23:46:53 augustss Exp $
*/
@@ -317,6 +317,10 @@
# define NO_INQUIRY_EVPD 0x0800
/* Pad all RBC requests to 12 bytes. */
# define RBC_PAD_TO_12 0x1000
+ /* Device reports number of sectors from READ_CAPACITY, not max
+ * sector number.
+ */
+# define READ_CAPACITY_OFFBY1 0x2000
};
static struct umass_devdescr_t umass_devdescrs[] = {
@@ -446,6 +450,10 @@
UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
IGNORE_RESIDUE | NO_START_STOP
},
+ { USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR31, RID_WILDCARD,
+ UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
+ READ_CAPACITY_OFFBY1
+ },
{ USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ2_256, RID_WILDCARD,
UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
IGNORE_RESIDUE
@@ -2698,6 +2706,16 @@
switch (status) {
case STATUS_CMD_OK:
ccb->ccb_h.status = CAM_REQ_CMP;
+ if ((sc->quirks & READ_CAPACITY_OFFBY1) &&
+ (ccb->ccb_h.func_code == XPT_SCSI_IO) &&
+ (csio->cdb_io.cdb_bytes[0] == READ_CAPACITY)) {
+ struct scsi_read_capacity_data *rcap;
+ uint32_t maxsector;
+
+ rcap = (struct scsi_read_capacity_data *)csio->data_ptr;
+ maxsector = scsi_4btoul(rcap->addr) - 1;
+ scsi_ulto4b(maxsector, rcap->addr);
+ }
xpt_done(ccb);
break;
==== //depot/projects/smpng/sys/dev/usb/usbdevs#101 (text+ko) ====
@@ -1,4 +1,4 @@
-$FreeBSD: src/sys/dev/usb/usbdevs,v 1.287 2007/02/09 15:59:28 le Exp $
+$FreeBSD: src/sys/dev/usb/usbdevs,v 1.288 2007/02/27 22:27:53 imp Exp $
/* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */
/*-
@@ -1545,8 +1545,8 @@
/* SanDisk products */
product SANDISK SDDR05A 0x0001 ImageMate SDDR-05a
+product SANDISK SDDR31 0x0002 ImageMate SDDR-31
product SANDISK SDDR05 0x0005 ImageMate SDDR-05
-product SANDISK SDDR31 0x0002 ImageMate SDDR-31
product SANDISK SDDR12 0x0100 ImageMate SDDR-12
product SANDISK SDDR09 0x0200 ImageMate SDDR-09
product SANDISK SDDR75 0x0810 ImageMate SDDR-75
==== //depot/projects/smpng/sys/kern/kern_mutex.c#141 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.181 2007/02/27 06:42:04 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.182 2007/03/01 09:35:48 kmacy Exp $");
#include "opt_adaptive_mutexes.h"
#include "opt_ddb.h"
@@ -157,9 +157,9 @@
void
_mtx_unlock_flags(struct mtx *m, int opts, const char *file, int line)
{
-
+#ifdef LOCK_PROFILING
struct lock_object lo;
-
+#endif
MPASS(curthread != NULL);
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_unlock() of destroyed mutex @ %s:%d", file, line));
@@ -176,7 +176,9 @@
m->mtx_object.lo_flags &= ~LO_CONTESTED;
#endif
_rel_sleep_lock(m, curthread, opts, file, line);
+#ifdef LOCK_PROFILING
lock_profile_release_lock(&lo);
+#endif
}
void
@@ -200,9 +202,9 @@
void
_mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file, int line)
{
-
+#ifdef LOCK_PROFILING
struct lock_object lo;
-
+#endif
MPASS(curthread != NULL);
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_unlock_spin() of destroyed mutex @ %s:%d", file, line));
@@ -218,7 +220,9 @@
m->mtx_object.lo_flags &= ~LO_CONTESTED;
#endif
_rel_spin_lock(m);
+#ifdef LOCK_PROFILING
lock_profile_release_lock(&lo);
+#endif
}
/*
==== //depot/projects/smpng/sys/kern/kern_sx.c#41 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_sx.c,v 1.34 2007/02/27 06:42:04 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_sx.c,v 1.35 2007/03/01 09:35:48 kmacy Exp $");
#include "opt_ddb.h"
@@ -228,9 +228,10 @@
void
_sx_sunlock(struct sx *sx, const char *file, int line)
{
+#ifdef LOCK_PROFILING
struct lock_object lo;
int count = -1;
-
+#endif
_sx_assert(sx, SX_SLOCKED, file, line);
mtx_lock(sx->sx_lock);
@@ -262,15 +263,18 @@
LOCK_LOG_LOCK("SUNLOCK", &sx->sx_object, 0, 0, file, line);
mtx_unlock(sx->sx_lock);
+#ifdef LOCK_PROFILING
if (count == 0)
lock_profile_release_lock(&lo);
-
+#endif
}
void
_sx_xunlock(struct sx *sx, const char *file, int line)
{
+#ifdef LOCK_PROFILING
struct lock_object lo;
+#endif
_sx_assert(sx, SX_XLOCKED, file, line);
mtx_lock(sx->sx_lock);
@@ -298,7 +302,9 @@
LOCK_LOG_LOCK("XUNLOCK", &sx->sx_object, 0, 0, file, line);
mtx_unlock(sx->sx_lock);
+#ifdef LOCK_PROFILING
lock_profile_release_lock(&lo);
+#endif
}
int
==== //depot/projects/smpng/sys/kern/uipc_usrreq.c#74 (text+ko) ====
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.197 2007/02/26 20:47:52 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.199 2007/03/01 09:00:42 rwatson Exp $");
#include "opt_mac.h"
@@ -774,21 +774,18 @@
unp2 = unp->unp_conn;
if (nam != NULL) {
+ UNP_GLOBAL_WLOCK_ASSERT();
if (unp2 != NULL) {
error = EISCONN;
- UNP_PCB_LOCK(unp);
break;
}
error = unp_connect(so, nam, td);
- UNP_PCB_LOCK(unp);
if (error)
break;
unp2 = unp->unp_conn;
} else {
- UNP_PCB_LOCK(unp);
if (unp2 == NULL) {
error = ENOTCONN;
- UNP_PCB_LOCK(unp);
break;
}
}
@@ -799,19 +796,19 @@
* return the slightly counter-intuitive but otherwise
* correct error that the socket is not connected.
*/
- UNP_PCB_LOCK_ASSERT(unp);
- UNP_PCB_LOCK(unp2);
if (unp2 == NULL) {
error = ENOTCONN;
break;
}
- so2 = unp2->unp_socket;
+ /* Lockless read. */
+ if (unp2->unp_flags & UNP_WANTCRED)
+ control = unp_addsockcred(td, control);
+ UNP_PCB_LOCK(unp);
if (unp->unp_addr != NULL)
from = (struct sockaddr *)unp->unp_addr;
else
from = &sun_noname;
- if (unp2->unp_flags & UNP_WANTCRED)
- control = unp_addsockcred(td, control);
+ so2 = unp2->unp_socket;
SOCKBUF_LOCK(&so2->so_rcv);
if (sbappendaddr_locked(&so2->so_rcv, from, m, control)) {
sorwakeup_locked(so2);
@@ -821,9 +818,13 @@
SOCKBUF_UNLOCK(&so2->so_rcv);
error = ENOBUFS;
}
- if (nam != NULL)
+ if (nam != NULL) {
+ UNP_GLOBAL_WLOCK_ASSERT();
+ UNP_PCB_LOCK(unp2);
unp_disconnect(unp, unp2);
- UNP_PCB_UNLOCK(unp2);
+ UNP_PCB_UNLOCK(unp2);
+ }
+ UNP_PCB_UNLOCK(unp);
break;
}
@@ -836,18 +837,15 @@
*/
if ((so->so_state & SS_ISCONNECTED) == 0) {
if (nam != NULL) {
+ UNP_GLOBAL_WLOCK_ASSERT();
error = unp_connect(so, nam, td);
- UNP_PCB_LOCK(unp);
if (error)
break; /* XXX */
} else {
error = ENOTCONN;
- UNP_PCB_LOCK(unp);
break;
}
- } else
- UNP_PCB_LOCK(unp);
- UNP_PCB_LOCK_ASSERT(unp);
+ }
/* Lockless read. */
if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
@@ -874,13 +872,12 @@
error = ENOTCONN;
break;
}
+ so2 = unp2->unp_socket;
UNP_PCB_LOCK(unp2);
- so2 = unp2->unp_socket;
SOCKBUF_LOCK(&so2->so_rcv);
if (unp2->unp_flags & UNP_WANTCRED) {
/*
- * Credentials are passed only once on
- * SOCK_STREAM.
+ * Credentials are passed only once on SOCK_STREAM.
*/
unp2->unp_flags &= ~UNP_WANTCRED;
control = unp_addsockcred(td, control);
@@ -915,14 +912,14 @@
}
/*
- * SEND_EOF is equivalent to a SEND followed by
- * a SHUTDOWN.
+ * SEND_EOF is equivalent to a SEND followed by a SHUTDOWN.
*/
if (flags & PRUS_EOF) {
+ UNP_PCB_LOCK(unp);
socantsendmore(so);
unp_shutdown(unp);
+ UNP_PCB_UNLOCK(unp);
}
- UNP_PCB_UNLOCK(unp);
if ((nam != NULL) || (flags & PRUS_EOF))
UNP_GLOBAL_WUNLOCK();
==== //depot/projects/smpng/sys/net/if_vlan_var.h#18 (text+ko) ====
@@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/net/if_vlan_var.h,v 1.25 2006/09/17 13:33:29 andre Exp $
+ * $FreeBSD: src/sys/net/if_vlan_var.h,v 1.26 2007/02/28 22:05:30 bms Exp $
*/
#ifndef _NET_IF_VLAN_VAR_H_
@@ -40,9 +40,40 @@
u_int16_t evl_proto;
};
-#define EVL_VLID_MASK 0x0FFF
-#define EVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK)
-#define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7)
+#define EVL_VLID_MASK 0x0FFF
+#define EVL_PRI_MASK 0xE000
+#define EVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK)
+#define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7)
+#define EVL_CFIOFTAG(tag) (((tag) >> 12) & 1)
+#define EVL_MAKETAG(vlid, pri, cfi) \
+ ((((((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
+
+/* Set the VLAN ID in an mbuf packet header non-destructively. */
+#define EVL_APPLY_VLID(m, vlid) \
+ do { \
+ if ((m)->m_flags & M_VLANTAG) { \
+ (m)->m_pkthdr.ether_vtag &= EVL_VLID_MASK; \
+ (m)->m_pkthdr.ether_vtag |= (vlid); \
+ } else { \
+ (m)->m_pkthdr.ether_vtag = (vlid); \
+ (m)->m_flags |= M_VLANTAG; \
+ } \
+ } while (0)
+
+/* Set the priority ID in an mbuf packet header non-destructively. */
+#define EVL_APPLY_PRI(m, pri) \
+ do { \
+ if ((m)->m_flags & M_VLANTAG) { \
+ uint16_t __vlantag = (m)->m_pkthdr.ether_vtag; \
+ (m)->m_pkthdr.ether_vtag |= EVL_MAKETAG( \
+ EVL_VLANOFTAG(__vlantag), (pri), \
+ EVL_CFIOFTAG(__vlantag)); \
+ } else { \
+ (m)->m_pkthdr.ether_vtag = \
+ EVL_MAKETAG(0, (pri), 0); \
+ (m)->m_flags |= M_VLANTAG; \
+ } \
+ } while (0)
/* sysctl(3) tags, for compatibility purposes */
#define VLANCTL_PROTO 1
==== //depot/projects/smpng/sys/netinet/ip_mroute.c#54 (text+ko) ====
@@ -52,7 +52,7 @@
* and PIM-SMv2 and PIM-DM support, advanced API support,
* bandwidth metering and signaling
*
- * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.131 2007/02/25 14:22:03 bms Exp $
+ * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.132 2007/02/28 20:02:24 bms Exp $
*/
#include "opt_inet.h"
@@ -146,6 +146,17 @@
&mfctable, sizeof(mfctable), "S,*mfc[MFCTBLSIZ]",
"Multicast Forwarding Table (struct *mfc[MFCTBLSIZ], netinet/ip_mroute.h)");
+static struct mtx mrouter_mtx;
+#define MROUTER_LOCK() mtx_lock(&mrouter_mtx)
+#define MROUTER_UNLOCK() mtx_unlock(&mrouter_mtx)
+#define MROUTER_LOCK_ASSERT() do { \
+ mtx_assert(&mrouter_mtx, MA_OWNED); \
+ NET_ASSERT_GIANT(); \
+} while (0)
+#define MROUTER_LOCK_INIT() \
+ mtx_init(&mrouter_mtx, "IPv4 multicast forwarding", NULL, MTX_DEF)
+#define MROUTER_LOCK_DESTROY() mtx_destroy(&mrouter_mtx)
+
static struct mtx mfc_mtx;
#define MFC_LOCK() mtx_lock(&mfc_mtx)
#define MFC_UNLOCK() mtx_unlock(&mfc_mtx)
@@ -637,8 +648,6 @@
callout_init(&bw_meter_ch, NET_CALLOUT_MPSAFE);
}
-static struct mtx mrouter_mtx;
-
static void
if_detached_event(void *arg __unused, struct ifnet *ifp)
{
@@ -650,9 +659,9 @@
struct rtdetq *pq;
struct rtdetq *npq;
- mtx_lock(&mrouter_mtx);
+ MROUTER_LOCK();
if (ip_mrouter == NULL) {
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
}
/*
@@ -696,7 +705,7 @@
MFC_UNLOCK();
VIF_UNLOCK();
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
}
/*
@@ -715,17 +724,17 @@
if (version != 1)
return ENOPROTOOPT;
- mtx_lock(&mrouter_mtx);
+ MROUTER_LOCK();
if (ip_mrouter != NULL) {
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
return EADDRINUSE;
}
if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event,
if_detached_event, NULL, EVENTHANDLER_PRI_ANY);
if (if_detach_event_tag == NULL) {
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
return (ENOMEM);
}
@@ -737,7 +746,7 @@
ip_mrouter = so;
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
if (mrtdebug)
log(LOG_DEBUG, "ip_mrouter_init\n");
@@ -758,10 +767,10 @@
struct mfc *rt;
struct rtdetq *rte;
- mtx_lock(&mrouter_mtx);
+ MROUTER_LOCK();
if (ip_mrouter == NULL) {
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
return EINVAL;
}
@@ -826,7 +835,7 @@
reg_vif_num = VIFI_INVALID;
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
if (mrtdebug)
log(LOG_DEBUG, "ip_mrouter_done\n");
@@ -3027,7 +3036,7 @@
{
switch (type) {
case MOD_LOAD:
- mtx_init(&mrouter_mtx, "mrouter initialization", NULL, MTX_DEF);
+ MROUTER_LOCK_INIT();
MFC_LOCK_INIT();
VIF_LOCK_INIT();
ip_mrouter_reset();
@@ -3040,7 +3049,7 @@
printf("ip_mroute: unable to attach pim encap\n");
VIF_LOCK_DESTROY();
MFC_LOCK_DESTROY();
- mtx_destroy(&mrouter_mtx);
+ MROUTER_LOCK_DESTROY();
return (EINVAL);
}
@@ -3055,7 +3064,7 @@
}
VIF_LOCK_DESTROY();
MFC_LOCK_DESTROY();
- mtx_destroy(&mrouter_mtx);
+ MROUTER_LOCK_DESTROY();
return (EINVAL);
}
#endif
@@ -3131,7 +3140,7 @@
VIF_LOCK_DESTROY();
MFC_LOCK_DESTROY();
- mtx_destroy(&mrouter_mtx);
+ MROUTER_LOCK_DESTROY();
break;
default:
==== //depot/projects/smpng/sys/netinet/ip_output.c#90 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)ip_output.c 8.3 (Berkeley) 1/21/94
- * $FreeBSD: src/sys/netinet/ip_output.c,v 1.269 2006/12/10 13:44:00 bms Exp $
+ * $FreeBSD: src/sys/netinet/ip_output.c,v 1.270 2007/03/01 13:29:30 bms Exp $
*/
#include "opt_ipfw.h"
@@ -188,30 +188,33 @@
dst->sin_addr = ip->ip_dst;
}
/*
- * If routing to interface only,
- * short circuit routing lookup.
+ * If routing to interface only, short circuit routing lookup.
+ * The use of an all-ones broadcast address implies this; an
+ * interface is specified by the broadcast address of an interface,
+ * or the destination address of a ptp interface.
*/
- if (flags & IP_ROUTETOIF) {
- if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL &&
- (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == NULL) {
+ if (flags & IP_SENDONES) {
+ if ((ia = ifatoia(ifa_ifwithbroadaddr(sintosa(dst)))) == NULL &&
+ (ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL) {
ipstat.ips_noroute++;
error = ENETUNREACH;
goto bad;
}
+ ip->ip_dst.s_addr = INADDR_BROADCAST;
+ dst->sin_addr = ip->ip_dst;
ifp = ia->ia_ifp;
ip->ip_ttl = 1;
- isbroadcast = in_broadcast(dst->sin_addr, ifp);
- } else if (flags & IP_SENDONES) {
- if ((ia = ifatoia(ifa_ifwithbroadaddr(sintosa(dst)))) == NULL) {
+ isbroadcast = 1;
+ } else if (flags & IP_ROUTETOIF) {
+ if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL &&
+ (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == NULL) {
ipstat.ips_noroute++;
error = ENETUNREACH;
goto bad;
}
ifp = ia->ia_ifp;
- ip->ip_dst.s_addr = INADDR_BROADCAST;
- dst->sin_addr = ip->ip_dst;
ip->ip_ttl = 1;
- isbroadcast = 1;
+ isbroadcast = in_broadcast(dst->sin_addr, ifp);
} else if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) &&
imo != NULL && imo->imo_multicast_ifp != NULL) {
/*
==== //depot/projects/smpng/sys/netinet/tcp_input.c#96 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.314 2007/02/26 22:25:20 mohans Exp $
+ * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.315 2007/02/28 20:48:00 mohans Exp $
*/
#include "opt_ipfw.h" /* for ipfw_fwd */
@@ -1155,6 +1155,8 @@
tp->ts_recent = to.to_tsval;
tp->ts_recent_age = ticks;
}
+ /* Initial send window, already scaled. */
+ tp->snd_wnd = th->th_win;
if (to.to_flags & TOF_MSS)
tcp_mss(tp, to.to_mss);
if (tp->sack_enable) {
@@ -1484,9 +1486,6 @@
if ((thflags & TH_SYN) == 0)
goto drop;
- /* Initial send window, already scaled. */
- tp->snd_wnd = th->th_win;
-
tp->irs = th->th_seq;
tcp_rcvseqinit(tp);
if (thflags & TH_ACK) {
==== //depot/projects/smpng/sys/netinet/tcp_output.c#43 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_output.c 8.4 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_output.c,v 1.122 2007/02/01 18:32:13 andre Exp $
+ * $FreeBSD: src/sys/netinet/tcp_output.c,v 1.125 2007/03/01 13:12:09 andre Exp $
*/
#include "opt_inet.h"
@@ -801,13 +801,14 @@
* IP, TCP and Options length to keep ip->ip_len from
* overflowing. Prevent the last segment from being
* fractional thus making them all equal sized and set
- * the flag to continue sending.
+ * the flag to continue sending. TSO is disabled when
+ * IP options or IPSEC are present.
*/
if (len + optlen + ipoptlen > tp->t_maxopd) {
flags &= ~TH_FIN;
if (tso) {
if (len > TCP_MAXWIN - hdrlen) {
- len = TCP_MAXWIN - hdrlen;
+ len = TCP_MAXWIN - hdrlen - optlen;
len = len - (len % (tp->t_maxopd - optlen));
sendalot = 1;
} else if (tp->t_flags & TF_NEEDFIN)
@@ -1214,39 +1215,32 @@
* XXX: It is a POLA question whether calling tcp_drop right
* away would be the really correct behavior instead.
*/
- if (error != EPERM && ((tp->t_flags & TF_FORCEDATA) == 0 ||
- !callout_active(tp->tt_persist))) {
- /*
- * No need to check for TH_FIN here because
- * the TF_SENTFIN flag handles that case.
- */
- if ((flags & TH_SYN) == 0) {
- if (sack_rxmit) {
- p->rxmit -= len;
- tp->sackhint.sack_bytes_rexmit -= len;
- KASSERT(tp->sackhint.sack_bytes_rexmit
- >= 0,
- ("sackhint bytes rtx >= 0"));
- } else
- tp->snd_nxt -= len;
- }
+ if (((tp->t_flags & TF_FORCEDATA) == 0 ||
+ !callout_active(tp->tt_persist)) &&
+ ((flags & TH_SYN) == 0) &&
+ (error != EPERM)) {
+ if (sack_rxmit) {
+ p->rxmit -= len;
+ tp->sackhint.sack_bytes_rexmit -= len;
+ KASSERT(tp->sackhint.sack_bytes_rexmit >= 0,
+ ("sackhint bytes rtx >= 0"));
+ } else
+ tp->snd_nxt -= len;
}
- if (error == EPERM) {
+out:
+ SOCKBUF_UNLOCK_ASSERT(&so->so_snd); /* Check gotos. */
+ switch (error) {
+ case EPERM:
tp->t_softerror = error;
return (error);
- }
-
-out:
- SOCKBUF_UNLOCK_ASSERT(&so->so_snd); /* Check gotos. */
- if (error == ENOBUFS) {
+ case ENOBUFS:
if (!callout_active(tp->tt_rexmt) &&
!callout_active(tp->tt_persist))
callout_reset(tp->tt_rexmt, tp->t_rxtcur,
tcp_timer_rexmt, tp);
tp->snd_cwnd = tp->t_maxseg;
return (0);
- }
- if (error == EMSGSIZE) {
+ case EMSGSIZE:
/*
* For some reason the interface we used initially
* to send segments changed to another or lowered
@@ -1265,14 +1259,19 @@
if (tso)
tp->t_flags &= ~TF_TSO;
tcp_mtudisc(tp->t_inpcb, 0);
- return 0;
- }
- if ((error == EHOSTUNREACH || error == ENETDOWN)
- && TCPS_HAVERCVDSYN(tp->t_state)) {
- tp->t_softerror = error;
return (0);
+ case EHOSTDOWN:
+ case EHOSTUNREACH:
+ case ENETDOWN:
+ case ENETUNREACH:
+ if (TCPS_HAVERCVDSYN(tp->t_state)) {
+ tp->t_softerror = error;
+ return (0);
+ }
+ /* FALLTHROUGH */
+ default:
+ return (error);
}
- return (error);
}
tcpstat.tcps_sndtotal++;
==== //depot/projects/smpng/sys/netinet6/ip6_mroute.c#30 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/ip6_mroute.c,v 1.41 2007/02/24 21:09:35 bms Exp $ */
+/* $FreeBSD: src/sys/netinet6/ip6_mroute.c,v 1.44 2007/02/28 21:58:37 bms Exp $ */
/* $KAME: ip6_mroute.c,v 1.58 2001/12/18 02:36:31 itojun Exp $ */
/*-
@@ -121,6 +121,7 @@
static MALLOC_DEFINE(M_MRTABLE6, "mf6c", "multicast forwarding cache entry");
+/* XXX: this is a very common idiom; move to <sys/mbuf.h> ? */
#define M_HASCL(m) ((m)->m_flags & M_EXT)
static int ip6_mdq __P((struct mbuf *, struct ifnet *, struct mf6c *));
@@ -133,6 +134,8 @@
struct mbuf *));
extern struct domain inet6domain;
+
+/* XXX: referenced from ip_mroute.c for dynamically loading this code. */
struct ip6protosw in6_pim_protosw = {
.pr_type = SOCK_RAW,
.pr_domain = &inet6domain,
@@ -144,18 +147,13 @@
.pr_usrreqs = &rip6_usrreqs
};
-/*
- * Globals. All but ip6_mrtproto and mrt6stat could be static,
- * except for netstat or debugging purposes.
- */
-int ip6_mrouter_ver = 0;
-int ip6_mrtproto = IPPROTO_PIM; /* for netstat only */
+static int ip6_mrouter_ver = 0;
SYSCTL_DECL(_net_inet6);
SYSCTL_DECL(_net_inet6_ip6);
SYSCTL_NODE(_net_inet6, IPPROTO_PIM, pim, CTLFLAG_RW, 0, "PIM");
-struct mrt6stat mrt6stat;
+static struct mrt6stat mrt6stat;
SYSCTL_STRUCT(_net_inet6_ip6, OID_AUTO, mrt6stat, CTLFLAG_RW,
&mrt6stat, mrt6stat,
"Multicast Routing Statistics (struct mrt6stat, netinet6/ip6_mroute.h)");
@@ -163,13 +161,13 @@
#define NO_RTE_FOUND 0x1
#define RTE_FOUND 0x2
-struct mf6c *mf6ctable[MF6CTBLSIZ];
+static struct mf6c *mf6ctable[MF6CTBLSIZ];
SYSCTL_OPAQUE(_net_inet6_ip6, OID_AUTO, mf6ctable, CTLFLAG_RD,
&mf6ctable, sizeof(mf6ctable), "S,*mf6ctable[MF6CTBLSIZ]",
"Multicast Forwarding Table (struct *mf6ctable[MF6CTBLSIZ], "
"netinet6/ip6_mroute.h)");
-u_char n6expire[MF6CTBLSIZ];
+static u_char n6expire[MF6CTBLSIZ];
static struct mif6 mif6table[MAXMIFS];
SYSCTL_OPAQUE(_net_inet6_ip6, OID_AUTO, mif6table, CTLFLAG_RD,
@@ -177,7 +175,7 @@
"Multicast Interfaces (struct mif[MAXMIFS], netinet6/ip6_mroute.h)");
#ifdef MRT6DEBUG
-u_int mrt6debug = 0; /* debug level */
+static u_int mrt6debug = 0; /* debug level */
#define DEBUG_MFC 0x02
#define DEBUG_FORWARD 0x04
#define DEBUG_EXPIRE 0x08
@@ -234,9 +232,7 @@
/*
* Find a route for a given origin IPv6 address and Multicast group address.
- * Quality of service parameter to be added in the future!!!
*/
-
#define MF6CFIND(o, g, rt) do { \
struct mf6c *_rt = mf6ctable[MF6CHASH(o,g)]; \
rt = NULL; \
@@ -258,6 +254,7 @@
/*
* Macros to compute elapsed time efficiently
* Borrowed from Van Jacobson's scheduling code
+ * XXX: replace with timersub() ?
*/
#define TV_DELTA(a, b, delta) do { \
int xxs; \
@@ -277,12 +274,13 @@
} \
} while (/*CONSTCOND*/ 0)
+/* XXX: replace with timercmp(a, b, <) ? */
#define TV_LT(a, b) (((a).tv_usec < (b).tv_usec && \
(a).tv_sec <= (b).tv_sec) || (a).tv_sec < (b).tv_sec)
#ifdef UPCALL_TIMING
#define UPCALL_MAX 50
-u_long upcall_data[UPCALL_MAX + 1];
+static u_long upcall_data[UPCALL_MAX + 1];
static void collate();
#endif /* UPCALL_TIMING */
@@ -546,10 +544,6 @@
}
}
}
-#ifdef notyet
- bzero((caddr_t)qtable, sizeof(qtable));
- bzero((caddr_t)tbftable, sizeof(tbftable));
-#endif
bzero((caddr_t)mif6table, sizeof(mif6table));
nummifs = 0;
@@ -615,9 +609,6 @@
struct mif6 *mifp;
struct ifnet *ifp;
int error, s;
-#ifdef notyet
- struct tbf *m_tbf = tbftable + mifcp->mif6c_mifi;
-#endif
if (mifcp->mif6c_mifi >= MAXMIFS)
return (EINVAL);
@@ -663,10 +654,7 @@
s = splnet();
mifp->m6_flags = mifcp->mif6c_flags;
mifp->m6_ifp = ifp;
-#ifdef notyet
- /* scaling up here allows division by 1024 in critical code */
- mifp->m6_rate_limit = mifcp->mif6c_rate_limit * 1024 / 1000;
-#endif
+
/* initialize per mif pkt counters */
mifp->m6_pkt_in = 0;
mifp->m6_pkt_out = 0;
@@ -726,10 +714,6 @@
}
}
-#ifdef notyet
- bzero((caddr_t)qtable[*mifip], sizeof(qtable[*mifip]));
- bzero((caddr_t)mifp->m6_tbf, sizeof(*(mifp->m6_tbf)));
-#endif
bzero((caddr_t)mifp, sizeof(*mifp));
/* Adjust nummifs down */
==== //depot/projects/smpng/sys/netinet6/ip6_mroute.h#7 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/ip6_mroute.h,v 1.10 2007/02/24 11:38:47 bms Exp $ */
+/* $FreeBSD: src/sys/netinet6/ip6_mroute.h,v 1.11 2007/02/28 20:32:25 bms Exp $ */
/* $KAME: ip6_mroute.h,v 1.19 2001/06/14 06:12:55 suz Exp $ */
/*-
@@ -103,9 +103,6 @@
mifi_t mif6c_mifi; /* the index of the mif to be added */
u_char mif6c_flags; /* MIFF_ flags defined below */
u_short mif6c_pifi; /* the index of the physical IF */
-#ifdef notyet
- u_int mif6c_rate_limit; /* max rate */
-#endif
};
#define MIFF_REGISTER 0x1 /* mif represents a register end-point */
@@ -209,9 +206,6 @@
struct mif6 {
u_char m6_flags; /* MIFF_ flags defined above */
u_int m6_rate_limit; /* max rate */
-#ifdef notyet
- struct tbf *m6_tbf; /* token bucket structure at intf. */
-#endif
struct in6_addr m6_lcl_addr; /* local interface address */
struct ifnet *m6_ifp; /* pointer to interface */
u_quad_t m6_pkt_in; /* # pkts in on interface */
==== //depot/projects/smpng/sys/sys/priv.h#3 (text+ko) ====
@@ -26,7 +26,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/sys/priv.h,v 1.5 2007/02/20 23:49:31 rwatson Exp $
+ * $FreeBSD: src/sys/sys/priv.h,v 1.6 2007/02/27 23:38:58 pjd Exp $
*/
/*
@@ -303,7 +303,7 @@
#define PRIV_NET_ADDMULTI 405 /* Add multicast addr. to ifnet. */
#define PRIV_NET_DELMULTI 406 /* Delete multicast addr. from ifnet. */
#define PRIV_NET_HWIOCTL 407 /* Issue hardware ioctl on ifnet. */
-#define PRIV_NET_SETLLADDR 408
+#define PRIV_NET_SETLLADDR 408 /* Set interface link-level address. */
#define PRIV_NET_ADDIFGROUP 409 /* Add new interface group. */
#define PRIV_NET_DELIFGROUP 410 /* Delete interface group. */
#define PRIV_NET_IFCREATE 411 /* Create cloned interface. */
==== //depot/projects/smpng/sys/sys/systm.h#80 (text+ko) ====
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* @(#)systm.h 8.7 (Berkeley) 3/29/95
- * $FreeBSD: src/sys/sys/systm.h,v 1.250 2007/02/23 16:22:09 jhb Exp $
+ * $FreeBSD: src/sys/sys/systm.h,v 1.251 2007/02/28 16:51:52 thomas Exp $
*/
#ifndef _SYS_SYSTM_H_
@@ -271,7 +271,7 @@
void cpu_initclocks(void);
void usrinfoinit(void);
-/* Finalize the world. */
+/* Finalize the world */
void shutdown_nice(int);
/* Timeouts */
@@ -285,7 +285,7 @@
caddr_t kern_timeout_callwheel_alloc(caddr_t v);
void kern_timeout_callwheel_init(void);
-/* Stubs for obsolete functions that used to be for interrupt management */
+/* Stubs for obsolete functions that used to be for interrupt management */
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list