PERFORCE change 50027 for review
Robert Watson
rwatson at FreeBSD.org
Tue Mar 30 18:32:57 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=50027
Change 50027 by rwatson at rwatson_tislabs on 2004/03/30 18:31:52
- optimized MD pagecopy() function to copy uncached pages.
- uipc_connect2() used outside uipc_usrreq.c rather than
unp_connect2().
- 802.11 code allows control of protections and power on
transmission.
Affected files ...
.. //depot/projects/netperf_socket/sys/amd64/amd64/pmap.c#4 integrate
.. //depot/projects/netperf_socket/sys/amd64/amd64/support.S#2 integrate
.. //depot/projects/netperf_socket/sys/amd64/include/md_var.h#3 integrate
.. //depot/projects/netperf_socket/sys/dev/sound/pci/ich.c#4 integrate
.. //depot/projects/netperf_socket/sys/fs/fifofs/fifo_vnops.c#2 integrate
.. //depot/projects/netperf_socket/sys/fs/portalfs/portal_vnops.c#3 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_usrreq.c#6 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_ioctl.c#3 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_ioctl.h#2 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_node.c#2 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_proto.c#2 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_var.h#2 integrate
.. //depot/projects/netperf_socket/sys/sys/un.h#2 integrate
Differences ...
==== //depot/projects/netperf_socket/sys/amd64/amd64/pmap.c#4 (text+ko) ====
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.453 2004/03/07 21:06:47 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.454 2004/03/31 02:03:48 alc Exp $");
/*
* Manages physical address maps.
@@ -2463,7 +2463,7 @@
vm_offset_t src = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(msrc));
vm_offset_t dst = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mdst));
- bcopy((void *)src, (void *)dst, PAGE_SIZE);
+ pagecopy((void *)src, (void *)dst);
}
/*
==== //depot/projects/netperf_socket/sys/amd64/amd64/support.S#2 (text+ko) ====
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/amd64/support.S,v 1.105 2003/11/27 17:20:44 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/support.S,v 1.106 2004/03/31 02:03:49 alc Exp $
*/
#include "opt_ddb.h"
@@ -167,6 +167,32 @@
movsb
ret
+/*
+ * pagecopy(%rdi=from, %rsi=to)
+ */
+ENTRY(pagecopy)
+ movq $-PAGE_SIZE,%rax
+ movq %rax,%rdx
+ subq %rax,%rdi
+ subq %rax,%rsi
+1:
+ prefetchnta (%rdi,%rax)
+ addq $64,%rax
+ jne 1b
+2:
+ movq (%rdi,%rdx),%rax
+ movnti %rax,(%rsi,%rdx)
+ movq 8(%rdi,%rdx),%rax
+ movnti %rax,8(%rsi,%rdx)
+ movq 16(%rdi,%rdx),%rax
+ movnti %rax,16(%rsi,%rdx)
+ movq 24(%rdi,%rdx),%rax
+ movnti %rax,24(%rsi,%rdx)
+ addq $32,%rdx
+ jne 2b
+ sfence
+ ret
+
/* fillw(pat, base, cnt) */
/* %rdi,%rsi, %rdx */
ENTRY(fillw)
==== //depot/projects/netperf_socket/sys/amd64/include/md_var.h#3 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/include/md_var.h,v 1.71 2004/01/29 00:05:03 peter Exp $
+ * $FreeBSD: src/sys/amd64/include/md_var.h,v 1.72 2004/03/31 02:03:49 alc Exp $
*/
#ifndef _MACHINE_MD_VAR_H_
@@ -65,11 +65,12 @@
void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault));
void enable_sse(void);
void fillw(int /*u_short*/ pat, void *base, size_t cnt);
-void pagezero(void *addr);
+void fpstate_drop(struct thread *td);
int is_physical_memory(vm_offset_t addr);
int isa_nmi(int cd);
+void pagecopy(void *from, void *to);
+void pagezero(void *addr);
void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist);
int user_dbreg_trap(void);
-void fpstate_drop(struct thread *td);
#endif /* !_MACHINE_MD_VAR_H_ */
==== //depot/projects/netperf_socket/sys/dev/sound/pci/ich.c#4 (text+ko) ====
@@ -32,7 +32,7 @@
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/ich.c,v 1.39 2004/03/17 17:50:44 njl Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/ich.c,v 1.40 2004/03/31 00:11:24 matk Exp $");
/* -------------------------------------------------------------------- */
@@ -693,12 +693,23 @@
}
/*
+ * By default, ich4 has NAMBAR and NABMBAR i/o spaces as
+ * read-only. Need to enable "legacy support", by poking into
+ * pci config space. The driver should use MMBAR and MBBAR,
+ * but doing so will mess things up here. ich4 has enough new
+ * features it warrants it's own driver.
+ */
+ if (pci_get_devid(dev) == ICH4ID) {
+ pci_write_config(dev, PCIR_ICH_LEGACY, ICH_LEGACY_ENABLE, 1);
+ }
+
+ /*
* Enable bus master. On ich4/5 this may prevent the detection of
* the primary codec becoming ready in ich_init().
*/
pci_enable_busmaster(dev);
- if ((pci_get_devid(dev) == ICH4ID) || (pci_get_devid(dev) == ICH5ID)) {
+ if (pci_get_devid(dev) == ICH5ID) {
sc->nambarid = PCIR_MMBAR;
sc->nabmbarid = PCIR_MBBAR;
sc->regtype = SYS_RES_MEMORY;
==== //depot/projects/netperf_socket/sys/fs/fifofs/fifo_vnops.c#2 (text+ko) ====
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)fifo_vnops.c 8.10 (Berkeley) 5/27/95
- * $FreeBSD: src/sys/fs/fifofs/fifo_vnops.c,v 1.91 2003/11/16 01:11:11 truckman Exp $
+ * $FreeBSD: src/sys/fs/fifofs/fifo_vnops.c,v 1.92 2004/03/31 01:41:29 rwatson Exp $
*/
#include <sys/param.h>
@@ -201,7 +201,7 @@
if (error)
goto fail2;
fip->fi_writesock = wso;
- error = unp_connect2(wso, rso);
+ error = uipc_connect2(wso, rso);
if (error) {
(void)soclose(wso);
fail2:
==== //depot/projects/netperf_socket/sys/fs/portalfs/portal_vnops.c#3 (text+ko) ====
@@ -35,7 +35,7 @@
*
* @(#)portal_vnops.c 8.14 (Berkeley) 5/21/95
*
- * $FreeBSD: src/sys/fs/portalfs/portal_vnops.c,v 1.60 2004/03/01 03:14:21 rwatson Exp $
+ * $FreeBSD: src/sys/fs/portalfs/portal_vnops.c,v 1.61 2004/03/31 01:41:29 rwatson Exp $
*/
/*
@@ -203,7 +203,7 @@
M_NOWAIT);
so2 = so3;
- return (unp_connect2(so, so2));
+ return (uipc_connect2(so, so2));
}
static int
==== //depot/projects/netperf_socket/sys/kern/uipc_usrreq.c#6 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.118 2004/03/30 02:16:25 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.119 2004/03/31 01:41:29 rwatson Exp $");
#include "opt_mac.h"
@@ -122,6 +122,7 @@
static void unp_detach(struct unpcb *);
static int unp_bind(struct unpcb *,struct sockaddr *, struct thread *);
static int unp_connect(struct socket *,struct sockaddr *, struct thread *);
+static int unp_connect2(struct socket *so, struct socket *so2);
static void unp_disconnect(struct unpcb *);
static void unp_shutdown(struct unpcb *);
static void unp_drop(struct unpcb *, int);
@@ -208,7 +209,7 @@
return (retval);
}
-static int
+int
uipc_connect2(struct socket *so1, struct socket *so2)
{
struct unpcb *unp = sotounpcb(so1);
@@ -901,7 +902,7 @@
return (error);
}
-int
+static int
unp_connect2(so, so2)
register struct socket *so;
register struct socket *so2;
==== //depot/projects/netperf_socket/sys/net80211/ieee80211_ioctl.c#3 (text+ko) ====
@@ -31,12 +31,15 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.11 2004/01/19 05:25:43 onoe Exp $");
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.13 2004/03/30 22:57:57 sam Exp $");
/*
* IEEE 802.11 ioctl support (FreeBSD-specific)
*/
+#include "opt_inet.h"
+#include "opt_ipx.h"
+
#include <sys/endian.h>
#include <sys/param.h>
#include <sys/kernel.h>
@@ -49,6 +52,16 @@
#include <net/if_media.h>
#include <net/ethernet.h>
+#ifdef INET
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#endif
+
+#ifdef IPX
+#include <netipx/ipx.h>
+#include <netipx/ipx_if.h>
+#endif
+
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_ioctl.h>
@@ -756,6 +769,7 @@
u_int8_t tmpkey[IEEE80211_KEYBUF_SIZE];
char tmpssid[IEEE80211_NWID_LEN];
struct ieee80211_channel *chan;
+ struct ifaddr *ifa; /* XXX */
switch (cmd) {
case SIOCSIFMEDIA:
@@ -859,8 +873,18 @@
case IEEE80211_IOC_RTSTHRESHOLD:
ireq->i_val = ic->ic_rtsthreshold;
break;
+ case IEEE80211_IOC_PROTMODE:
+ ireq->i_val = ic->ic_protmode;
+ break;
+ case IEEE80211_IOC_TXPOWER:
+ if ((ic->ic_caps & IEEE80211_C_TXPMGT) == 0)
+ error = EINVAL;
+ else
+ ireq->i_val = ic->ic_txpower;
+ break;
default:
error = EINVAL;
+ break;
}
break;
case SIOCS80211:
@@ -1000,6 +1024,29 @@
ic->ic_rtsthreshold = ireq->i_val;
error = ENETRESET;
break;
+ case IEEE80211_IOC_PROTMODE:
+ if (ireq->i_val > IEEE80211_PROT_RTSCTS) {
+ error = EINVAL;
+ break;
+ }
+ ic->ic_protmode = ireq->i_val;
+ /* NB: if not operating in 11g this can wait */
+ if (ic->ic_curmode == IEEE80211_MODE_11G)
+ error = ENETRESET;
+ break;
+ case IEEE80211_IOC_TXPOWER:
+ if ((ic->ic_caps & IEEE80211_C_TXPMGT) == 0) {
+ error = EINVAL;
+ break;
+ }
+ if (!(IEEE80211_TXPOWER_MIN < ireq->i_val &&
+ ireq->i_val < IEEE80211_TXPOWER_MAX)) {
+ error = EINVAL;
+ break;
+ }
+ ic->ic_txpower = ireq->i_val;
+ error = ENETRESET;
+ break;
default:
error = EINVAL;
break;
@@ -1026,6 +1073,51 @@
else
ifp->if_mtu = ifr->ifr_mtu;
break;
+ case SIOCSIFADDR:
+ /*
+ * XXX Handle this directly so we can supress if_init calls.
+ * XXX This should be done in ether_ioctl but for the moment
+ * XXX there are too many other parts of the system that
+ * XXX set IFF_UP and so supress if_init being called when
+ * XXX it should be.
+ */
+ ifa = (struct ifaddr *) data;
+ switch (ifa->ifa_addr->sa_family) {
+#ifdef INET
+ case AF_INET:
+ if ((ifp->if_flags & IFF_UP) == 0) {
+ ifp->if_flags |= IFF_UP;
+ ifp->if_init(ifp->if_softc);
+ }
+ arp_ifinit(ifp, ifa);
+ break;
+#endif
+#ifdef IPX
+ /*
+ * XXX - This code is probably wrong,
+ * but has been copied many times.
+ */
+ case AF_IPX: {
+ struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
+ struct arpcom *ac = (struct arpcom *)ifp;
+
+ if (ipx_nullhost(*ina))
+ ina->x_host = *(union ipx_host *) ac->ac_enaddr;
+ else
+ bcopy((caddr_t) ina->x_host.c_host,
+ (caddr_t) ac->ac_enaddr,
+ sizeof(ac->ac_enaddr));
+ /* fall thru... */
+ }
+#endif
+ default:
+ if ((ifp->if_flags & IFF_UP) == 0) {
+ ifp->if_flags |= IFF_UP;
+ ifp->if_init(ifp->if_softc);
+ }
+ break;
+ }
+ break;
default:
error = ether_ioctl(ifp, cmd, data);
break;
==== //depot/projects/netperf_socket/sys/net80211/ieee80211_ioctl.h#2 (text+ko) ====
@@ -29,7 +29,7 @@
* (INCLUDING 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/net80211/ieee80211_ioctl.h,v 1.4 2003/10/17 23:15:30 sam Exp $
+ * $FreeBSD: src/sys/net80211/ieee80211_ioctl.h,v 1.5 2004/03/30 22:57:57 sam Exp $
*/
#ifndef _NET80211_IEEE80211_IOCTL_H_
#define _NET80211_IEEE80211_IOCTL_H_
@@ -119,6 +119,11 @@
#define IEEE80211_POWERSAVE_ON IEEE80211_POWERSAVE_CAM
#define IEEE80211_IOC_POWERSAVESLEEP 11
#define IEEE80211_IOC_RTSTHRESHOLD 12
+#define IEEE80211_IOC_PROTMODE 13
+#define IEEE80211_PROTMODE_OFF 0
+#define IEEE80211_PROTMODE_CTS 1
+#define IEEE80211_PROTMODE_RTSCTS 2
+#define IEEE80211_IOC_TXPOWER 14
#ifndef IEEE80211_CHAN_ANY
#define IEEE80211_CHAN_ANY 0xffff /* token for ``any channel'' */
==== //depot/projects/netperf_socket/sys/net80211/ieee80211_node.c#2 (text+ko) ====
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.13 2003/11/09 23:36:46 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.14 2004/03/30 22:57:57 sam Exp $");
#include "opt_inet.h"
@@ -102,6 +102,7 @@
ic->ic_bss = (*ic->ic_node_alloc)(ic);
KASSERT(ic->ic_bss != NULL, ("unable to setup inital BSS node"));
+ ic->ic_txpower = IEEE80211_TXPOWER_MAX;
ic->ic_bss->ni_chan = IEEE80211_CHAN_ANYC;
}
==== //depot/projects/netperf_socket/sys/net80211/ieee80211_proto.c#2 (text+ko) ====
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_proto.c,v 1.6 2003/10/31 18:32:09 brooks Exp $");
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_proto.c,v 1.7 2004/03/30 22:57:57 sam Exp $");
/*
* IEEE 802.11 protocol support.
@@ -102,6 +102,7 @@
#endif
ic->ic_fragthreshold = 2346; /* XXX not used yet */
ic->ic_fixed_rate = -1; /* no fixed rate */
+ ic->ic_protmode = IEEE80211_PROT_CTSONLY;
mtx_init(&ic->ic_mgtq.ifq_mtx, ifp->if_xname, "mgmt send q", MTX_DEF);
==== //depot/projects/netperf_socket/sys/net80211/ieee80211_var.h#2 (text+ko) ====
@@ -29,7 +29,7 @@
* (INCLUDING 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/net80211/ieee80211_var.h,v 1.11 2004/01/15 08:44:27 onoe Exp $
+ * $FreeBSD: src/sys/net80211/ieee80211_var.h,v 1.12 2004/03/30 22:57:57 sam Exp $
*/
#ifndef _NET80211_IEEE80211_VAR_H_
#define _NET80211_IEEE80211_VAR_H_
@@ -49,6 +49,9 @@
#define IEEE80211_CHAN_ANYC \
((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
+#define IEEE80211_TXPOWER_MAX 100 /* max power */
+#define IEEE80211_TXPOWER_MIN 0 /* kill radio (if possible) */
+
enum ieee80211_phytype {
IEEE80211_T_DS, /* direct sequence spread spectrum */
IEEE80211_T_FH, /* frequency hopping */
@@ -77,6 +80,15 @@
};
/*
+ * 802.11g protection mode.
+ */
+enum ieee80211_protmode {
+ IEEE80211_PROT_NONE = 0, /* no protection */
+ IEEE80211_PROT_CTSONLY = 1, /* CTS to self */
+ IEEE80211_PROT_RTSCTS = 2, /* RTS-CTS */
+};
+
+/*
* Channels are specified by frequency and attributes.
*/
struct ieee80211_channel {
@@ -166,6 +178,7 @@
enum ieee80211_phytype ic_phytype; /* XXX wrong for multi-mode */
enum ieee80211_opmode ic_opmode; /* operation mode */
enum ieee80211_state ic_state; /* 802.11 state */
+ enum ieee80211_protmode ic_protmode; /* 802.11g protection mode */
struct ifmedia ic_media; /* interface media config */
struct bpf_if *ic_rawbpf; /* packet filter structure */
struct ieee80211_node *ic_bss; /* information for this node */
@@ -226,6 +239,8 @@
#define IEEE80211_F_TXPOW_AUTO 0x00010000 /* TX Power: undefined */
#define IEEE80211_F_SHSLOT 0x00020000 /* CONF: short slot time */
#define IEEE80211_F_SHPREAMBLE 0x00040000 /* CONF: short preamble */
+#define IEEE80211_F_USEPROT 0x00100000 /* STATUS: protection enabled */
+#define IEEE80211_F_USEBARKER 0x00200000 /* STATUS: use barker preamble*/
/* ic_caps */
#define IEEE80211_C_WEP 0x00000001 /* CAPABILITY: WEP available */
==== //depot/projects/netperf_socket/sys/sys/un.h#2 (text+ko) ====
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)un.h 8.3 (Berkeley) 2/19/95
- * $FreeBSD: src/sys/sys/un.h,v 1.25 2002/08/21 16:20:01 mike Exp $
+ * $FreeBSD: src/sys/sys/un.h,v 1.26 2004/03/31 01:41:30 rwatson Exp $
*/
#ifndef _SYS_UN_H_
@@ -64,10 +64,10 @@
struct socket;
struct sockopt;
+int uipc_connect2(struct socket *so1, struct socket *so2);
int uipc_ctloutput(struct socket *so, struct sockopt *sopt);
int uipc_usrreq(struct socket *so, int req, struct mbuf *m,
struct mbuf *nam, struct mbuf *control);
-int unp_connect2(struct socket *so, struct socket *so2);
void unp_dispose(struct mbuf *m);
int unp_externalize(struct mbuf *mbuf, struct mbuf **controlp);
void unp_init(void);
More information about the p4-projects
mailing list