Date: Sun, 15 May 2005 23:29:02 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 77026 for review Message-ID: <200505152329.j4FNT2iD035097@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=77026 Change 77026 by marcel@marcel_nfs on 2005/05/15 23:28:21 IFC @77022 Affected files ... .. //depot/projects/tty/include/netdb.h#7 integrate .. //depot/projects/tty/lib/libc/net/getaddrinfo.c#13 integrate .. //depot/projects/tty/lib/libc/net/getnetbydns.c#4 integrate .. //depot/projects/tty/lib/libc/net/getnetbyht.c#5 integrate .. //depot/projects/tty/lib/libc/net/getnetbynis.c#3 integrate .. //depot/projects/tty/lib/libc/net/getnetnamadr.c#5 integrate .. //depot/projects/tty/lib/libc/net/netdb_private.h#4 integrate .. //depot/projects/tty/share/man/man4/carp.4#2 integrate .. //depot/projects/tty/share/man/man4/iwi.4#2 integrate .. //depot/projects/tty/sys/compat/ndis/kern_ndis.c#7 integrate .. //depot/projects/tty/sys/compat/ndis/ndis_var.h#6 integrate .. //depot/projects/tty/sys/contrib/ipfilter/netinet/ip_compat.h#8 integrate .. //depot/projects/tty/sys/dev/if_ndis/if_ndis.c#7 integrate .. //depot/projects/tty/sys/dev/if_ndis/if_ndisvar.h#7 integrate .. //depot/projects/tty/sys/dev/iwi/if_iwi.c#2 integrate .. //depot/projects/tty/sys/dev/iwi/if_iwivar.h#2 integrate .. //depot/projects/tty/sys/dev/syscons/daemon/daemon_saver.c#3 integrate .. //depot/projects/tty/sys/dev/syscons/snake/snake_saver.c#3 integrate .. //depot/projects/tty/sys/dev/syscons/star/star_saver.c#2 integrate .. //depot/projects/tty/sys/dev/syscons/syscons.c#13 integrate .. //depot/projects/tty/sys/netinet/ip_carp.c#2 integrate .. //depot/projects/tty/sys/netinet6/icmp6.c#10 integrate .. //depot/projects/tty/sys/netinet6/in6_src.c#7 integrate .. //depot/projects/tty/sys/netinet6/ip6_fw.c#10 integrate .. //depot/projects/tty/sys/netinet6/ip6_output.c#10 integrate .. //depot/projects/tty/sys/sys/consio.h#3 integrate .. //depot/projects/tty/tools/regression/usr.bin/file2c/regress.1.out#1 branch .. //depot/projects/tty/tools/regression/usr.bin/file2c/regress.2.out#1 branch .. //depot/projects/tty/tools/regression/usr.bin/file2c/regress.3.out#1 branch .. //depot/projects/tty/tools/regression/usr.bin/file2c/regress.4.out#1 branch .. //depot/projects/tty/tools/regression/usr.bin/file2c/regress.5.out#1 branch .. //depot/projects/tty/tools/regression/usr.bin/file2c/regress.6.out#1 branch .. //depot/projects/tty/tools/regression/usr.bin/file2c/regress.7.out#1 branch .. //depot/projects/tty/tools/regression/usr.bin/file2c/regress.8.out#1 branch .. //depot/projects/tty/tools/regression/usr.bin/file2c/regress.9.out#1 branch .. //depot/projects/tty/tools/regression/usr.bin/file2c/regress.out#2 delete .. //depot/projects/tty/tools/regression/usr.bin/file2c/regress.sh#3 integrate .. //depot/projects/tty/usr.bin/file2c/Makefile#2 integrate .. //depot/projects/tty/usr.bin/file2c/file2c.1#2 integrate .. //depot/projects/tty/usr.bin/file2c/file2c.c#2 integrate .. //depot/projects/tty/usr.sbin/ndiscvt/inf.c#3 integrate .. //depot/projects/tty/usr.sbin/vidcontrol/vidcontrol.c#4 integrate Differences ... ==== //depot/projects/tty/include/netdb.h#7 (text+ko) ==== @@ -55,7 +55,7 @@ /* * @(#)netdb.h 8.1 (Berkeley) 6/2/93 * From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $ - * $FreeBSD: src/include/netdb.h,v 1.35 2005/04/27 19:12:56 ume Exp $ + * $FreeBSD: src/include/netdb.h,v 1.36 2005/05/15 20:15:15 ume Exp $ */ #ifndef _NETDB_H_ @@ -63,6 +63,8 @@ #include <sys/cdefs.h> #include <sys/_types.h> +#include <machine/_limits.h> +#include <machine/endian.h> #ifndef _SIZE_T_DECLARED typedef __size_t size_t; @@ -74,6 +76,11 @@ #define _SOCKLEN_T_DECLARED #endif +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + #ifndef _PATH_HEQUIV # define _PATH_HEQUIV "/etc/hosts.equiv" #endif @@ -99,14 +106,27 @@ }; /* - * Assumption here is that a network number - * fits in an unsigned long -- probably a poor one. + * Note: n_net used to be an unsigned long integer. + * In XNS5, and subsequently in POSIX-2001 it was changed to an + * uint32_t. + * To accomodate for this while preserving binary compatibility with + * the old interface, we prepend or append 32 bits of padding, + * depending on the (LP64) architecture's endianness. + * + * This should be deleted the next time the libc major number is + * incremented. */ struct netent { char *n_name; /* official name of net */ char **n_aliases; /* alias list */ int n_addrtype; /* net address type */ - unsigned long n_net; /* network # */ +#if __LONG_BIT == 64 && _BYTE_ORDER == _BIG_ENDIAN + uint32_t __n_pad0; /* ABI compatibility */ +#endif + uint32_t n_net; /* network # */ +#if __LONG_BIT == 64 && _BYTE_ORDER == _LITTLE_ENDIAN + uint32_t __n_pad0; /* ABI compatibility */ +#endif }; struct servent { @@ -122,12 +142,29 @@ int p_proto; /* protocol # */ }; +/* + * Note: ai_addrlen used to be a size_t, per RFC 2553. + * In XNS5.2, and subsequently in POSIX-2001 and RFC 3493 it was + * changed to a socklen_t. + * To accomodate for this while preserving binary compatibility with the + * old interface, we prepend or append 32 bits of padding, depending on + * the (LP64) architecture's endianness. + * + * This should be deleted the next time the libc major number is + * incremented. + */ struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ int ai_family; /* PF_xxx */ int ai_socktype; /* SOCK_xxx */ int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ +#if __LONG_BIT == 64 && _BYTE_ORDER == _BIG_ENDIAN + uint32_t __ai_pad0; /* ABI compatibility */ +#endif + socklen_t ai_addrlen; /* length of ai_addr */ +#if __LONG_BIT == 64 && _BYTE_ORDER == _LITTLE_ENDIAN + uint32_t __ai_pad0; /* ABI compatibility */ +#endif char *ai_canonname; /* canonical name for hostname */ struct sockaddr *ai_addr; /* binary address */ struct addrinfo *ai_next; /* next structure in linked list */ @@ -225,7 +262,11 @@ struct hostent *gethostent(void); struct hostent *getipnodebyaddr(const void *, size_t, int, int *); struct hostent *getipnodebyname(const char *, int, int, int *); -struct netent *getnetbyaddr(unsigned long, int); +#if __LONG_BIT == 64 +struct netent *getnetbyaddr(unsigned long, int); /* ABI compatibility */ +#else +struct netent *getnetbyaddr(uint32_t, int); +#endif struct netent *getnetbyname(const char *); struct netent *getnetent(void); int getnetgrent(char **, char **, char **); ==== //depot/projects/tty/lib/libc/net/getaddrinfo.c#13 (text+ko) ==== @@ -63,7 +63,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/net/getaddrinfo.c,v 1.68 2005/05/14 19:43:10 gnn Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/net/getaddrinfo.c,v 1.69 2005/05/15 20:15:15 ume Exp $"); #include "namespace.h" #include <sys/types.h> @@ -135,7 +135,7 @@ static const struct afd { int a_af; int a_addrlen; - int a_socklen; + socklen_t a_socklen; int a_off; const char *a_addrany; const char *a_loopback; @@ -1352,6 +1352,9 @@ memset(ai->ai_addr, 0, (size_t)afd->a_socklen); ai->ai_addr->sa_len = afd->a_socklen; ai->ai_addrlen = afd->a_socklen; +#if __LONG_BIT == 64 + ai->__ai_pad0 = 0; /* ABI compatibility */ +#endif ai->ai_addr->sa_family = ai->ai_family = afd->a_af; p = (char *)(void *)(ai->ai_addr); #ifdef FAITH ==== //depot/projects/tty/lib/libc/net/getnetbydns.c#4 (text+ko) ==== @@ -62,7 +62,7 @@ static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/net/getnetbydns.c,v 1.29 2005/04/28 15:32:55 ume Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/net/getnetbydns.c,v 1.30 2005/05/15 20:15:15 ume Exp $"); #include <sys/param.h> #include <sys/socket.h> @@ -259,6 +259,9 @@ break; } ne->n_aliases++; +#if __LONG_BIT == 64 + ne->__n_pad0 = 0; /* ABI compatibility */ +#endif return 0; } h_errno = TRY_AGAIN; @@ -268,7 +271,7 @@ int _dns_getnetbyaddr(void *rval, void *cb_data, va_list ap) { - unsigned long net; + uint32_t net; int net_type; struct netent *ne; struct netent_data *ned; @@ -276,9 +279,9 @@ int nn, anslen, error; querybuf *buf; char qbuf[MAXDNAME]; - unsigned long net2; + uint32_t net2; - net = va_arg(ap, unsigned long); + net = va_arg(ap, uint32_t); net_type = va_arg(ap, int); ne = va_arg(ap, struct netent *); ned = va_arg(ap, struct netent_data *); @@ -327,12 +330,13 @@ error = getnetanswer(buf, anslen, BYADDR, ne, ned); free(buf); if (error == 0) { - unsigned u_net = net; /* maybe net should be unsigned ? */ - /* Strip trailing zeros */ - while ((u_net & 0xff) == 0 && u_net != 0) - u_net >>= 8; - ne->n_net = u_net; + while ((net & 0xff) == 0 && net != 0) + net >>= 8; + ne->n_net = net; +#if __LONG_BIT == 64 + ne->__n_pad0 = 0; /* ABI compatibility */ +#endif return NS_SUCCESS; } return NS_NOTFOUND; ==== //depot/projects/tty/lib/libc/net/getnetbyht.c#5 (text+ko) ==== @@ -46,7 +46,7 @@ static char orig_rcsid[] = "From: Id: getnetent.c,v 8.4 1997/06/01 20:34:37 vixie Exp"; #endif /* LIBC_SCCS and not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/net/getnetbyht.c,v 1.14 2005/04/29 17:36:54 ume Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/net/getnetbyht.c,v 1.15 2005/05/15 20:15:15 ume Exp $"); #include <sys/types.h> #include <sys/socket.h> @@ -122,6 +122,9 @@ if (p != NULL) *p++ = '\0'; ne->n_net = inet_network(cp); +#if __LONG_BIT == 64 + ne->__n_pad0 = 0; /* ABI compatibility */ +#endif ne->n_addrtype = AF_INET; q = ne->n_aliases = ned->net_aliases; if (p != NULL) { @@ -191,13 +194,13 @@ int _ht_getnetbyaddr(void *rval, void *cb_data, va_list ap) { - unsigned long net; + uint32_t net; int type; struct netent *ne; struct netent_data *ned; int error; - net = va_arg(ap, unsigned long); + net = va_arg(ap, uint32_t); type = va_arg(ap, int); ne = va_arg(ap, struct netent *); ned = va_arg(ap, struct netent_data *); ==== //depot/projects/tty/lib/libc/net/getnetbynis.c#3 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/net/getnetbynis.c,v 1.17 2005/04/29 17:36:54 ume Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/net/getnetbynis.c,v 1.18 2005/05/15 20:15:15 ume Exp $"); #include <sys/param.h> #include <sys/socket.h> @@ -99,6 +99,9 @@ cp++; ne->n_net = inet_network(cp); +#if __LONG_BIT == 64 + ne->__n_pad0 = 0; /* ABI compatibility */ +#endif ne->n_addrtype = AF_INET; q = ne->n_aliases = ned->net_aliases; @@ -149,22 +152,22 @@ } -int +int _nis_getnetbyaddr(void *rval, void *cb_data, va_list ap) { #ifdef YP - unsigned long addr; + uint32_t addr; int af; struct netent *ne; struct netent_data *ned; char *str, *cp; - unsigned long net2; + uint32_t net2; int nn; unsigned int netbr[4]; char buf[MAXDNAME]; int error; - addr = va_arg(ap, unsigned long); + addr = va_arg(ap, uint32_t); af = va_arg(ap, int); ne = va_arg(ap, struct netent *); ned = va_arg(ap, struct netent_data *); ==== //depot/projects/tty/lib/libc/net/getnetnamadr.c#5 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/net/getnetnamadr.c,v 1.19 2005/04/28 15:32:55 ume Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/net/getnetnamadr.c,v 1.20 2005/05/15 20:15:15 ume Exp $"); #include "namespace.h" #include "reentrant.h" @@ -120,7 +120,8 @@ } int -getnetbyaddr_r(u_long addr, int af, struct netent *ne, struct netent_data *ned) +getnetbyaddr_r(uint32_t addr, int af, struct netent *ne, + struct netent_data *ned) { int rval; @@ -164,13 +165,17 @@ } struct netent * -getnetbyaddr(u_long addr, int af) +#if __LONG_BIT == 64 +getnetbyaddr(u_long addr, int af) /* ABI compatibility */ +#else +getnetbyaddr(uint32_t addr, int af) +#endif { struct netdata *nd; if ((nd = __netdata_init()) == NULL) return NULL; - if (getnetbyaddr_r(addr, af, &nd->net, &nd->data) != 0) + if (getnetbyaddr_r((uint32_t)addr, af, &nd->net, &nd->data) != 0) return NULL; return &nd->net; } ==== //depot/projects/tty/lib/libc/net/netdb_private.h#4 (text+ko) ==== @@ -22,20 +22,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libc/net/netdb_private.h,v 1.8 2005/04/28 18:52:40 ume Exp $ + * $FreeBSD: src/lib/libc/net/netdb_private.h,v 1.9 2005/05/15 20:15:15 ume Exp $ */ #ifndef _NETDB_PRIVATE_H_ #define _NETDB_PRIVATE_H_ -#include <sys/_types.h> #include <stdio.h> /* XXX: for FILE */ -#ifndef _UINT32_T_DECLARED -typedef __uint32_t uint32_t; -#define _UINT32_T_DECLARED -#endif - #define _MAXALIASES 35 #define _MAXLINELEN 1024 #define _MAXADDRS 35 @@ -155,7 +149,7 @@ int gethostbyname2_r(const char *, int, struct hostent *, struct hostent_data *); int gethostent_r(struct hostent *, struct hostent_data *); -int getnetbyaddr_r(unsigned long addr, int af, struct netent *, +int getnetbyaddr_r(uint32_t addr, int af, struct netent *, struct netent_data *); int getnetbyname_r(const char *, struct netent *, struct netent_data *); int getnetent_r(struct netent *, struct netent_data *); ==== //depot/projects/tty/share/man/man4/carp.4#2 (text+ko) ==== @@ -23,9 +23,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/carp.4,v 1.6 2005/04/07 15:28:14 glebius Exp $ +.\" $FreeBSD: src/share/man/man4/carp.4,v 1.7 2005/05/15 01:58:32 glebius Exp $ .\" -.Dd April 7, 2005 +.Dd May 15, 2005 .Dt CARP 4 .Os .Sh NAME @@ -128,6 +128,15 @@ .It Va net.inet.carp.arpbalance Balance local traffic using ARP. Disabled by default. +.It Va net.inet.carp.suppress_preempt +A read only value showing the status of preemption suppression. +Preemption can be suppressed if link on an interface is down +or when +.Xr pfsync 4 +interface is not synchronized. +Value of 0 means that preemption is not suppressed, since no +problems are detected. +Every problem increments suppression counter. .El .Sh EXAMPLES For firewalls and routers with multiple interfaces, it is desirable to @@ -216,8 +225,9 @@ itself will always be balanced to the same virtual host. .Sh SEE ALSO .Xr inet 4 , +.Xr ifconfig 8 , +.Xr pfsync 4 , .Xr rc.conf 5 , -.Xr ifconfig 8 , .Xr sysctl 8 .Sh HISTORY The ==== //depot/projects/tty/share/man/man4/iwi.4#2 (text+ko) ==== @@ -1,4 +1,4 @@ -.\" $FreeBSD: src/share/man/man4/iwi.4,v 1.1 2005/04/18 18:47:35 damien Exp $ +.\" $FreeBSD: src/share/man/man4/iwi.4,v 1.2 2005/05/15 21:08:51 imp Exp $ .\" .\" Copyright (c) 2004, 2005 .\" Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. @@ -49,6 +49,14 @@ .Pp For more information on configuring this device, see .Xr ifconfig 8 . +.Pp +This driver requires firmware to be loaded before it will work. +You need to obtain +.Xr iwicontrol 8 +from the IWI web page listed below to accomplish loading the firmware +before +.Xr ifconfig 8 +will work. .Sh EXAMPLES Join an existing BSS network (ie: connect to an access point): .Pp @@ -74,6 +82,11 @@ .Bl -diag .It "iwi%d: device timeout" The driver will reset the hardware. This should not happen. +.It "iwi%d: Please load firmware" +The required firmeware has not been loaded into the card, and threfore +the card cannot operate. Load the firmware with +.Xr iwicontrol 8 +before proceeding. .El .Sh SEE ALSO .Xr an 4 , @@ -83,7 +96,7 @@ .Xr wi 4 , .Xr wlan 4 , .Xr ifconfig 8 , -.Xr iwicontrol 8, +.Xr iwicontrol 8 , .Xr wicontrol 8 .Rs .%T The IWI Web Page ==== //depot/projects/tty/sys/compat/ndis/kern_ndis.c#7 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.80 2005/05/05 06:14:59 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.81 2005/05/15 04:27:58 wpaul Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1095,15 +1095,6 @@ sc = arg; - NDIS_LOCK(sc); - adapter = sc->ndis_block->nmb_miniportadapterctx; - if (adapter == NULL) { - NDIS_UNLOCK(sc); - return(EIO); - } - - sc->ndis_block->nmb_devicectx = NULL; - #ifdef NDIS_REAP_TIMERS /* * Drivers are sometimes very lax about cancelling all @@ -1124,6 +1115,15 @@ KeFlushQueuedDpcs(); #endif + NDIS_LOCK(sc); + adapter = sc->ndis_block->nmb_miniportadapterctx; + if (adapter == NULL) { + NDIS_UNLOCK(sc); + return(EIO); + } + + sc->ndis_block->nmb_devicectx = NULL; + /* * The adapter context is only valid after the init * handler has been called, and is invalid once the @@ -1420,6 +1420,8 @@ return(status); block = fdo->do_devext; + + block->nmb_filterdbs.nf_ethdb = block; block->nmb_deviceobj = fdo; block->nmb_physdeviceobj = pdo; block->nmb_nextdeviceobj = IoAttachDeviceToDeviceStack(fdo, pdo); @@ -1434,6 +1436,22 @@ sc->ndis_block = block; sc->ndis_chars = IoGetDriverObjectExtension(drv, (void *)1); + /* + * If the driver has a MiniportTransferData() function, + * we should allocate a private RX packet pool. + */ + + if (sc->ndis_chars->nmc_transferdata_func != NULL) { + NdisAllocatePacketPool(&status, &block->nmb_rxpool, + 32, PROTOCOL_RESERVED_SIZE_IN_PACKET); + if (status != NDIS_STATUS_SUCCESS) { + IoDetachDevice(block->nmb_nextdeviceobj); + IoDeleteDevice(fdo); + return(status); + } + INIT_LIST_HEAD((&block->nmb_packetlist)); + } + /* Give interrupt handling priority over timers. */ IoInitializeDpcRequest(fdo, kernndis_functbl[6].ipt_wrap); KeSetImportanceDpc(&fdo->do_dpc, KDPC_IMPORTANCE_HIGH); @@ -1470,6 +1488,8 @@ TAILQ_REMOVE(&ndis_devhead, sc->ndis_block, link); + if (sc->ndis_chars->nmc_transferdata_func != NULL) + NdisFreePacketPool(sc->ndis_block->nmb_rxpool); fdo = sc->ndis_block->nmb_deviceobj; IoDetachDevice(sc->ndis_block->nmb_nextdeviceobj); IoDeleteDevice(fdo); ==== //depot/projects/tty/sys/compat/ndis/ndis_var.h#6 (text+ko) ==== @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.39 2005/05/05 06:14:59 wpaul Exp $ + * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.40 2005/05/15 04:27:58 wpaul Exp $ */ #ifndef _NDIS_VAR_H_ @@ -1144,6 +1144,20 @@ typedef struct ndis_packet_oob ndis_packet_oob; +/* + * Our protocol private region for handling ethernet. + * We need this to stash some of the things returned + * by NdisMEthIndicateReceive(). + */ + +struct ndis_ethpriv { + void *nep_ctx; /* packet context */ + long nep_offset; /* residual data to transfer */ + void *nep_pad[2]; +}; + +typedef struct ndis_ethpriv ndis_ethpriv; + #define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(void *)) struct ndis_packet { @@ -1164,7 +1178,7 @@ } np_macrsvd; } u; uint32_t *np_rsvd[2]; - uint8_t nm_protocolreserved[PROTOCOL_RESERVED_SIZE_IN_PACKET]; + uint8_t np_protocolreserved[PROTOCOL_RESERVED_SIZE_IN_PACKET]; /* * This next part is probably wrong, but we need some place @@ -1204,6 +1218,8 @@ typedef struct ndis_filterdbs ndis_filterdbs; +#define nf_ethdb u.nf_ethdb + enum ndis_medium { NdisMedium802_3, NdisMedium802_5, @@ -1482,6 +1498,7 @@ ndis_status nmb_getstat; ndis_status nmb_setstat; ndis_miniport_timer *nmb_timerlist; + ndis_handle nmb_rxpool; TAILQ_ENTRY(ndis_miniport_block) link; }; ==== //depot/projects/tty/sys/contrib/ipfilter/netinet/ip_compat.h#8 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_compat.h,v 1.26 2005/04/28 21:36:30 darrenr Exp $ */ +/* $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_compat.h,v 1.27 2005/05/15 03:34:17 darrenr Exp $ */ /* * Copyright (C) 1993-2001, 2003 by Darren Reed. @@ -6,7 +6,7 @@ * See the IPFILTER.LICENCE file for details on licencing. * * @(#)ip_compat.h 1.8 1/14/96 - * $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_compat.h,v 1.26 2005/04/28 21:36:30 darrenr Exp $ + * $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_compat.h,v 1.27 2005/05/15 03:34:17 darrenr Exp $ * Id: ip_compat.h,v 2.142.2.25 2005/03/28 09:33:36 darrenr Exp */ @@ -769,7 +769,7 @@ /* F R E E B S D */ /* ----------------------------------------------------------------------- */ #ifdef __FreeBSD__ -# if defined(_KERNEL) && !defined(IPFILTER_LKM) && !defined(KLD_MODULE) +# if defined(_KERNEL) # if (__FreeBSD_version >= 500000) # include "opt_bpf.h" # else @@ -1222,7 +1222,7 @@ * For BSD kernels, if bpf is in the kernel, enable ipfilter to use bpf in * filter rules. */ -#if !defined(IPFILTER_BPF) && ((NBPF > 0) || (NBPFILTER > 0)) +#if !defined(IPFILTER_BPF) && ((NBPF > 0) || (NBPFILTER > 0) || (DEV_BPF >0)) # define IPFILTER_BPF #endif ==== //depot/projects/tty/sys/dev/if_ndis/if_ndis.c#7 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.92 2005/05/08 09:36:16 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.93 2005/05/15 04:27:59 wpaul Exp $"); #include "opt_bdg.h" @@ -99,6 +99,12 @@ static void ndis_txeof (ndis_handle, ndis_packet *, ndis_status); static void ndis_rxeof (ndis_handle, ndis_packet **, uint32_t); +static void ndis_rxeof_eth (ndis_handle, ndis_handle, char *, void *, + uint32_t, void *, uint32_t, uint32_t); +static void ndis_rxeof_done (ndis_handle); +static void ndis_rxeof_xfr (kdpc *, ndis_handle, void *, void *); +static void ndis_rxeof_xfr_done (ndis_handle, ndis_packet *, + uint32_t, uint32_t); static void ndis_linksts (ndis_handle, ndis_status, void *, uint32_t); static void ndis_linksts_done (ndis_handle); @@ -106,6 +112,10 @@ static funcptr ndis_txeof_wrap; static funcptr ndis_rxeof_wrap; +static funcptr ndis_rxeof_eth_wrap; +static funcptr ndis_rxeof_done_wrap; +static funcptr ndis_rxeof_xfr_wrap; +static funcptr ndis_rxeof_xfr_done_wrap; static funcptr ndis_linksts_wrap; static funcptr ndis_linksts_done_wrap; static funcptr ndis_ticktask_wrap; @@ -165,6 +175,14 @@ break; windrv_wrap((funcptr)ndis_rxeof, &ndis_rxeof_wrap, 3, WINDRV_WRAP_STDCALL); + windrv_wrap((funcptr)ndis_rxeof_eth, &ndis_rxeof_eth_wrap, + 8, WINDRV_WRAP_STDCALL); + windrv_wrap((funcptr)ndis_rxeof_done, &ndis_rxeof_done_wrap, + 1, WINDRV_WRAP_STDCALL); + windrv_wrap((funcptr)ndis_rxeof_xfr, &ndis_rxeof_xfr_wrap, + 4, WINDRV_WRAP_STDCALL); + windrv_wrap((funcptr)ndis_rxeof_xfr_done, + &ndis_rxeof_xfr_done_wrap, 4, WINDRV_WRAP_STDCALL); windrv_wrap((funcptr)ndis_txeof, &ndis_txeof_wrap, 3, WINDRV_WRAP_STDCALL); windrv_wrap((funcptr)ndis_linksts, &ndis_linksts_wrap, @@ -185,6 +203,10 @@ /* fallthrough */ case MOD_SHUTDOWN: windrv_unwrap(ndis_rxeof_wrap); + windrv_unwrap(ndis_rxeof_eth_wrap); + windrv_unwrap(ndis_rxeof_done_wrap); + windrv_unwrap(ndis_rxeof_xfr_wrap); + windrv_unwrap(ndis_rxeof_xfr_done_wrap); windrv_unwrap(ndis_txeof_wrap); windrv_unwrap(ndis_linksts_wrap); windrv_unwrap(ndis_linksts_done_wrap); @@ -520,6 +542,9 @@ /* Install our RX and TX interrupt handlers. */ sc->ndis_block->nmb_senddone_func = ndis_txeof_wrap; sc->ndis_block->nmb_pktind_func = ndis_rxeof_wrap; + sc->ndis_block->nmb_ethrxindicate_func = ndis_rxeof_eth_wrap; + sc->ndis_block->nmb_ethrxdone_func = ndis_rxeof_done_wrap; + sc->ndis_block->nmb_tdcond_func = ndis_rxeof_xfr_done_wrap; /* Call driver's init routine. */ if (ndis_init_nic(sc)) { @@ -812,6 +837,8 @@ (work_item_func)ndis_starttask_wrap, ifp); NdisInitializeWorkItem(&sc->ndis_resetitem, (work_item_func)ndis_resettask_wrap, sc); + KeInitializeDpc(&sc->ndis_rxdpc, ndis_rxeof_xfr_wrap, sc->ndis_block); + fail: if (error) @@ -947,6 +974,204 @@ } /* + * The following bunch of routines are here to support drivers that + * use the NdisMEthIndicateReceive()/MiniportTransferData() mechanism. + */ + +static void +ndis_rxeof_eth(adapter, ctx, addr, hdr, hdrlen, lookahead, lookaheadlen, pktlen) + ndis_handle adapter; + ndis_handle ctx; + char *addr; + void *hdr; + uint32_t hdrlen; + void *lookahead; + uint32_t lookaheadlen; + uint32_t pktlen; +{ + ndis_miniport_block *block; + uint8_t irql; + uint32_t status; + ndis_buffer *b; + ndis_packet *p; + struct mbuf *m; + ndis_ethpriv *priv; + + block = adapter; + + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + + if (m == NULL) { + NdisFreePacket(p); + return; + } + + /* Save the data provided to us so far. */ + + m->m_len = lookaheadlen + hdrlen; + m->m_pkthdr.len = pktlen + hdrlen; + m->m_next = NULL; + m_copyback(m, 0, hdrlen, hdr); + m_copyback(m, hdrlen, lookaheadlen, lookahead); + + /* Now create a fake NDIS_PACKET to hold the data */ + + NdisAllocatePacket(&status, &p, block->nmb_rxpool); + + if (status != NDIS_STATUS_SUCCESS) { + m_freem(m); + return; + } + + p->np_m0 = m; + + b = IoAllocateMdl(m->m_data, m->m_pkthdr.len, FALSE, FALSE, NULL); + + if (b == NULL) { + NdisFreePacket(p); + m_freem(m); + return; + } + + p->np_private.npp_head = p->np_private.npp_tail = b; + p->np_private.npp_totlen = m->m_pkthdr.len; + + /* Save the packet RX context somewhere. */ + priv = (ndis_ethpriv *)&p->np_protocolreserved; + priv->nep_ctx = ctx; + + KeAcquireSpinLock(&block->nmb_lock, &irql); + + INSERT_LIST_TAIL((&block->nmb_packetlist), + ((list_entry *)&p->u.np_clrsvd.np_miniport_rsvd)); + + KeReleaseSpinLock(&block->nmb_lock, irql); + + return; +} + +static void +ndis_rxeof_done(adapter) + ndis_handle adapter; +{ + struct ndis_softc *sc; + ndis_miniport_block *block; + + block = adapter; + + /* Schedule transfer/RX of queued packets. */ + + sc = device_get_softc(block->nmb_physdeviceobj->do_devext); + + KeInsertQueueDpc(&sc->ndis_rxdpc, NULL, NULL); + + return; +} + +/* + * Runs at DISPATCH_LEVEL. + */ +static void +ndis_rxeof_xfr(dpc, adapter, sysarg1, sysarg2) + kdpc *dpc; + ndis_handle adapter; + void *sysarg1; + void *sysarg2; +{ + ndis_miniport_block *block; + struct ndis_softc *sc; + ndis_packet *p; + list_entry *l; + uint32_t status; + ndis_ethpriv *priv; + struct ifnet *ifp; + struct mbuf *m; + + block = adapter; + sc = device_get_softc(block->nmb_physdeviceobj->do_devext); + ifp = &sc->arpcom.ac_if; + + KeAcquireSpinLockAtDpcLevel(&block->nmb_lock); + + l = block->nmb_packetlist.nle_flink; + while(l != &block->nmb_packetlist) { + REMOVE_LIST_HEAD((&block->nmb_packetlist)); + p = CONTAINING_RECORD(l, ndis_packet, + u.np_clrsvd.np_miniport_rsvd); + + priv = (ndis_ethpriv *)&p->np_protocolreserved; + m = p->np_m0; + p->np_softc = sc; + p->np_m0 = NULL; + + KeReleaseSpinLockFromDpcLevel(&block->nmb_lock); + + status = MSCALL6(sc->ndis_chars->nmc_transferdata_func, + p, &p->np_private.npp_totlen, block, priv->nep_ctx, + m->m_len, m->m_pkthdr.len - m->m_len); + + KeAcquireSpinLockAtDpcLevel(&block->nmb_lock); + + /* + * If status is NDIS_STATUS_PENDING, do nothing and + * wait for a callback to the ndis_rxeof_xfr_done() + * handler. + */ + + m->m_len = m->m_pkthdr.len; + m->m_pkthdr.rcvif = ifp; + + if (status == NDIS_STATUS_SUCCESS) { + IoFreeMdl(p->np_private.npp_head); + NdisFreePacket(p); + ifp->if_ipackets++; + (*ifp->if_input)(ifp, m); + } + + if (status == NDIS_STATUS_FAILURE) + m_freem(m); + + /* Advance to next packet */ + l = block->nmb_packetlist.nle_flink; + } + + KeReleaseSpinLockFromDpcLevel(&block->nmb_lock); + + return; +} + +static void +ndis_rxeof_xfr_done(adapter, packet, status, len) + ndis_handle adapter; + ndis_packet *packet; + uint32_t status; + uint32_t len; +{ + ndis_miniport_block *block; + struct ndis_softc *sc; + struct ifnet *ifp; + struct mbuf *m; + + block = adapter; + sc = device_get_softc(block->nmb_physdeviceobj->do_devext); + ifp = &sc->arpcom.ac_if; + + m = packet->np_m0; + IoFreeMdl(packet->np_private.npp_head); + NdisFreePacket(packet); + + if (status != NDIS_STATUS_SUCCESS) { + m_freem(m); + return; + } + + m->m_len = m->m_pkthdr.len; + m->m_pkthdr.rcvif = ifp; + ifp->if_ipackets++; + (*ifp->if_input)(ifp, m); + return; +} +/* * A frame has been uploaded: pass the resulting mbuf chain up to * the higher level protocols. * ==== //depot/projects/tty/sys/dev/if_ndis/if_ndisvar.h#7 (text+ko) ==== @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/if_ndis/if_ndisvar.h,v 1.21 2005/05/05 03:56:09 wpaul Exp $ + * $FreeBSD: src/sys/dev/if_ndis/if_ndisvar.h,v 1.22 2005/05/15 04:27:59 wpaul Exp $ */ #define NDIS_DEFAULT_NODENAME "FreeBSD NDIS node" @@ -127,6 +127,7 @@ ndis_work_item ndis_tickitem; ndis_work_item ndis_startitem; ndis_work_item ndis_resetitem; + kdpc ndis_rxdpc; bus_dma_tag_t ndis_parent_tag; struct ndis_shmem *ndis_shlist; bus_dma_tag_t ndis_mtag; ==== //depot/projects/tty/sys/dev/iwi/if_iwi.c#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/iwi/if_iwi.c,v 1.1 2005/04/18 18:47:36 damien Exp $ */ +/* $FreeBSD: src/sys/dev/iwi/if_iwi.c,v 1.2 2005/05/15 21:02:51 imp Exp $ */ /*- * Copyright (c) 2004, 2005 @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200505152329.j4FNT2iD035097>