IFC @r271887

This commit is contained in:
Neel Natu 2014-09-20 06:27:37 +00:00
commit b6cf6c8ca6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/bhyve_svm/; revision=271894
381 changed files with 4488 additions and 3239 deletions

View File

@ -352,6 +352,7 @@ WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
# 32 bit world
LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
.if ${TARGET_ARCH} == "amd64"
@ -387,7 +388,7 @@ LIB32FLAGS+= --sysroot=${WORLDTMP}
.endif
# Yes, the flags are redundant.
LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
_SHLIBDIRPREFIX=${LIB32TMP} \
_LDSCRIPTROOT=${LIB32TMP} \
VERSION="${VERSION}" \
@ -611,7 +612,7 @@ build32:
cd ${.CURDIR}/${_dir}; \
WORLDTMP=${WORLDTMP} \
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
MAKEOBJDIRPREFIX=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
build-tools
.endfor

View File

@ -38,6 +38,8 @@
# xargs -n1 | sort | uniq -d;
# done
# 20140917: hv_kvpd rc.d script removed in favor of devd configuration
OLD_FILES+=etc/rc.d/hv_kvpd
# 20140814: libopie version bump
OLD_LIBS+=usr/lib/libopie.so.7
OLD_LIBS+=usr/lib32/libopie.so.7

View File

@ -94,7 +94,7 @@ GENHDRS+= iconv.h
SRCS+= iconv_stub.c
iconv.h: ${.CURDIR}/iconv_stub.h
cp ${.CURDIR}/iconv_stub.h ${.TARGET}
cp -f ${.CURDIR}/iconv_stub.h ${.TARGET}
.endif
.endif

View File

@ -34,14 +34,14 @@
* leading underscores.
*/
#pragma weak _go = go
static int
go(int a)
{
return (a + 1);
}
#pragma weak _go = go
static void
handle(int sig)
{

View File

@ -29,6 +29,7 @@ dtrace=$1
t="season_8_mountain_of_madness_t"
pid=$$
rc=`$dtrace -n "BEGIN{ trace(pid$pid`$t)0); }"`
$dtrace -n "BEGIN{ trace(pid$pid\`$t)0); }"
rc=$?
exit $rc

View File

@ -30,6 +30,7 @@ dtrace=$1
t="season_8_mountain_of_madness_t"
pid=$$
rc=`$dtrace -n "BEGIN{ trace(pid`$t)0); }"` -p $pid
$dtrace -n "BEGIN{ trace(pid$pid\`$t)0); }" -p $pid
rc=$?
exit $rc

View File

@ -25,7 +25,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
t="season_7_lisa_the_vegetrian_t *"
t="season_7_lisa_the_vegetarian_t *"
exe="tst.aouttype.exe"
elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf'
@ -37,7 +37,8 @@ fi
./$exe &
pid=$!
rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"`
$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"
rc=$?
kill -9 $pid

View File

@ -38,7 +38,8 @@ fi
./$exe &
pid=$!
rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"`
$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"
rc=$?
kill -9 $pid

View File

@ -653,6 +653,7 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
dontreport = 0;
vdev_size = -1ULL;
for (c = 0; c < children; c++) {
boolean_t is_replacing, is_spare;
nvlist_t *cnv = child[c];
char *path;
struct stat64 statbuf;
@ -669,16 +670,19 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
* If this is a replacing or spare vdev, then
* get the real first child of the vdev.
*/
if (strcmp(childtype,
VDEV_TYPE_REPLACING) == 0 ||
strcmp(childtype, VDEV_TYPE_SPARE) == 0) {
is_replacing = strcmp(childtype,
VDEV_TYPE_REPLACING) == 0;
is_spare = strcmp(childtype,
VDEV_TYPE_SPARE) == 0;
if (is_replacing || is_spare) {
nvlist_t **rchild;
uint_t rchildren;
verify(nvlist_lookup_nvlist_array(cnv,
ZPOOL_CONFIG_CHILDREN, &rchild,
&rchildren) == 0);
assert(rchildren == 2);
assert((is_replacing && rchildren == 2)
|| (is_spare && rchildren >= 2));
cnv = rchild[0];
verify(nvlist_lookup_string(cnv,

View File

@ -274,7 +274,7 @@ ctf_fdopen(int fd, int *errp)
*/
if (nbytes >= (ssize_t) sizeof (Elf32_Ehdr) &&
bcmp(&hdr.e32.e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0) {
#ifdef _BIG_ENDIAN
#if BYTE_ORDER == _BIG_ENDIAN
uchar_t order = ELFDATA2MSB;
#else
uchar_t order = ELFDATA2LSB;

View File

@ -167,7 +167,7 @@ print_bitfield(dt_printarg_t *pap, ulong_t off, ctf_encoding_t *ep)
* to the lowest 'size' bytes in 'value', and we need to shift based on
* the offset from the end of the data, not the offset of the start.
*/
#ifdef _BIG_ENDIAN
#if BYTE_ORDER == _BIG_ENDIAN
buf += sizeof (value) - size;
off += ep->cte_bits;
#endif
@ -178,7 +178,7 @@ print_bitfield(dt_printarg_t *pap, ulong_t off, ctf_encoding_t *ep)
* Offsets are counted from opposite ends on little- and
* big-endian machines.
*/
#ifdef _BIG_ENDIAN
#if BYTE_ORDER == _BIG_ENDIAN
shift = NBBY - shift;
#endif

View File

@ -1457,6 +1457,12 @@ zfs_setprop_error(libzfs_handle_t *hdl, zfs_prop_t prop, int err,
(void) zfs_error(hdl, EZFS_DSREADONLY, errbuf);
break;
case E2BIG:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"property value too long"));
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
break;
case ENOTSUP:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"pool and or dataset must be upgraded to set this "

View File

@ -14,6 +14,9 @@ the 'tools' directory for your own consumption.
* Removed the deprecated tools. This includes atf-config, atf-report,
atf-run and atf-version.
* Issue #8: Fixed atf-c/macros_test:use test failures spotted by the clang
that ships with FreeBSD 11.0-CURRENT.
Changes in version 0.19
***********************

View File

@ -87,6 +87,7 @@ ATF_TC(TEST_MACRO_1);
ATF_TC_HEAD(TEST_MACRO_1, tc) { if (tc != NULL) {} }
ATF_TC_BODY(TEST_MACRO_1, tc) { if (tc != NULL) {} }
atf_tc_t *test_name_1 = &ATF_TC_NAME(TEST_MACRO_1);
atf_tc_pack_t *test_pack_1 = &ATF_TC_PACK_NAME(TEST_MACRO_1);
void (*head_1)(atf_tc_t *) = ATF_TC_HEAD_NAME(TEST_MACRO_1);
void (*body_1)(const atf_tc_t *) = ATF_TC_BODY_NAME(TEST_MACRO_1);
ATF_TC_WITH_CLEANUP(TEST_MACRO_2);
@ -94,10 +95,12 @@ ATF_TC_HEAD(TEST_MACRO_2, tc) { if (tc != NULL) {} }
ATF_TC_BODY(TEST_MACRO_2, tc) { if (tc != NULL) {} }
ATF_TC_CLEANUP(TEST_MACRO_2, tc) { if (tc != NULL) {} }
atf_tc_t *test_name_2 = &ATF_TC_NAME(TEST_MACRO_2);
atf_tc_pack_t *test_pack_2 = &ATF_TC_PACK_NAME(TEST_MACRO_2);
void (*head_2)(atf_tc_t *) = ATF_TC_HEAD_NAME(TEST_MACRO_2);
void (*body_2)(const atf_tc_t *) = ATF_TC_BODY_NAME(TEST_MACRO_2);
void (*cleanup_2)(const atf_tc_t *) = ATF_TC_CLEANUP_NAME(TEST_MACRO_2);
ATF_TC_WITHOUT_HEAD(TEST_MACRO_3);
ATF_TC_BODY(TEST_MACRO_3, tc) { if (tc != NULL) {} }
atf_tc_t *test_name_3 = &ATF_TC_NAME(TEST_MACRO_3);
atf_tc_pack_t *test_pack_3 = &ATF_TC_PACK_NAME(TEST_MACRO_3);
void (*body_3)(const atf_tc_t *) = ATF_TC_BODY_NAME(TEST_MACRO_3);

View File

@ -208,7 +208,7 @@ or of
if no argument.
.TP
.B rand
random number on (0,1)
random number on [0,1)
.TP
.B srand
sets seed for

View File

@ -74,7 +74,7 @@ int main(int argc, char *argv[])
signal(SIGFPE, fpecatch);
srand_seed = 1;
srand(srand_seed);
srandom((unsigned long) srand_seed);
yyin = NULL;
symtab = makesymtab(NSYMTAB/NSYMTAB);

View File

@ -1521,8 +1521,10 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg lis
u = (Awkfloat) system(getsval(x)) / 256; /* 256 is unix-dep */
break;
case FRAND:
/* in principle, rand() returns something in 0..RAND_MAX */
u = (Awkfloat) (rand() % RAND_MAX) / RAND_MAX;
/* random() returns numbers in [0..2^31-1]
* in order to get a number in [0, 1), divide it by 2^31
*/
u = (Awkfloat) random() / (0x7fffffffL + 0x1UL);
break;
case FSRAND:
if (isrec(x)) /* no argument provided */
@ -1530,7 +1532,7 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg lis
else
u = getfval(x);
tmp = u;
srand((unsigned int) u);
srandom((unsigned long) u);
u = srand_seed;
srand_seed = tmp;
break;

View File

@ -684,8 +684,6 @@ jail_enable="NO" # Set to NO to disable starting of any jails
jail_parallel_start="NO" # Start jails in the background
jail_list="" # Space separated list of names of jails
hv_kvpd_enable="NO" # Start the Hyper-V key-value Pair Driver hv_kvp(4)
##############################################################
### Define source_rc_confs, the mechanism used by /etc/rc.* ##
### scripts to source rc_conf_files overrides safely. ##

View File

@ -18,6 +18,10 @@ FILES+= uath.conf usb.conf
FILES+= zfs.conf
.endif
.if ${MK_HYPERV} != "no"
FILES+= hyperv.conf
.endif
NO_OBJ=
FILESDIR= /etc/devd
FILESMODE= 644

19
etc/devd/hyperv.conf Normal file
View File

@ -0,0 +1,19 @@
# $FreeBSD$
#
# Hyper-V specific events
notify 10 {
match "system" "DEVFS";
match "subsystem" "CDEV";
match "type" "CREATE";
match "cdev" "hv_kvp_dev";
action "/usr/sbin/hv_kvp_daemon";
};
notify 10 {
match "system" "DEVFS";
match "subsystem" "CDEV";
match "type" "DESTROY";
match "cdev" "hv_kvp_dev";
action "pkill -x hv_kvp_daemon";
};

View File

@ -69,7 +69,7 @@ SENDMAIL_MC!= hostname
SENDMAIL_MC:= ${SENDMAIL_MC}.mc
${SENDMAIL_MC}:
cp freebsd.mc ${SENDMAIL_MC}
cp -f freebsd.mc ${SENDMAIL_MC}
.endif
.ifndef SENDMAIL_SUBMIT_MC
@ -77,7 +77,7 @@ SENDMAIL_SUBMIT_MC!= hostname
SENDMAIL_SUBMIT_MC:= ${SENDMAIL_SUBMIT_MC}.submit.mc
${SENDMAIL_SUBMIT_MC}:
cp freebsd.submit.mc ${SENDMAIL_SUBMIT_MC}
cp -f freebsd.submit.mc ${SENDMAIL_SUBMIT_MC}
.endif
INSTALL_CF= ${SENDMAIL_MC:R}.cf

View File

@ -57,7 +57,6 @@ FILES= DAEMON \
hostid \
hostid_save \
hostname \
${_hv_kvpd} \
inetd \
initrandom \
ip6addrctl \
@ -193,10 +192,6 @@ _ubthidhci= ubthidhci
_casperd= casperd
.endif
.if ${MK_HYPERV} != "no"
_hv_kvpd= hv_kvpd
.endif
.if ${MK_UNBOUND} != "no"
_unbound= local_unbound
.endif

View File

@ -1,16 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: hv_kvpd
. /etc/rc.subr
name="hv_kvp_daemon"
rcvar="hv_kvpd_enable"
command="/usr/sbin/${name}"
required_dirs="/var/db/hyperv"
load_rc_config $name
run_rc_command "$1"

View File

@ -453,7 +453,6 @@ int encrypt(char *, int);
long gethostid(void);
int lockf(int, int, off_t);
int nice(int);
int setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */
int setregid(gid_t, gid_t);
int setreuid(uid_t, uid_t);
@ -567,6 +566,7 @@ int setkey(const char *);
int setlogin(const char *);
int setloginclass(const char *);
void *setmode(const char *);
int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */
void setproctitle(const char *_fmt, ...) __printf0like(1, 2);
int setresgid(gid_t, gid_t, gid_t);
int setresuid(uid_t, uid_t, uid_t);

View File

@ -112,10 +112,10 @@ ${GEN_KX509}: kx509.asn1
.SUFFIXES: .h .c .x .hx
.x.c:
cp ${.IMPSRC} ${.TARGET}
cp -f ${.IMPSRC} ${.TARGET}
.hx.h:
cp ${.IMPSRC} ${.TARGET}
cp -f ${.IMPSRC} ${.TARGET}
.include <bsd.lib.mk>

View File

@ -151,11 +151,11 @@ KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \
libkern: libkern.gen libkern.${LIBC_ARCH}
libkern.gen: ${KQSRCS} ${KSRCS}
cp -p ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
cp -fp ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
libkern.${LIBC_ARCH}:: ${KMSRCS}
.if defined(KMSRCS) && !empty(KMSRCS)
cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
cp -fp ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
.endif
.include <bsd.lib.mk>

View File

@ -268,7 +268,7 @@ __elf_fdnlist(fd, list)
}
/* mmap section header table */
base = mmap(NULL, (size_t)shdr_size, PROT_READ, 0, fd,
base = mmap(NULL, (size_t)shdr_size, PROT_READ, MAP_PRIVATE, fd,
(off_t)ehdr.e_shoff);
if (base == MAP_FAILED)
return (-1);
@ -301,7 +301,7 @@ __elf_fdnlist(fd, list)
* making the memory allocation permanent as with malloc/free
* (i.e., munmap will return it to the system).
*/
base = mmap(NULL, (size_t)symstrsize, PROT_READ, 0, fd,
base = mmap(NULL, (size_t)symstrsize, PROT_READ, MAP_PRIVATE, fd,
(off_t)symstroff);
if (base == MAP_FAILED)
goto done;

View File

@ -28,7 +28,7 @@
.\" @(#)mmap.2 8.4 (Berkeley) 5/11/95
.\" $FreeBSD$
.\"
.Dd September 15, 2014
.Dd September 17, 2014
.Dt MMAP 2
.Os
.Sh NAME
@ -176,11 +176,6 @@ already exists within the range.
.It Dv MAP_HASSEMAPHORE
Notify the kernel that the region may contain semaphores and that special
handling may be necessary.
.It Dv MAP_INHERIT
This flag never operated as advertised and is no longer supported.
Please refer to
.Xr minherit 2
for further information.
.It Dv MAP_NOCORE
Region is not included in a core file.
.It Dv MAP_NOSYNC
@ -300,14 +295,6 @@ The
system call does not unmap pages, see
.Xr munmap 2
for further information.
.Pp
The current design does not allow a process to specify the location of
swap space.
In the future we may define an additional mapping type,
.Dv MAP_SWAP ,
in which
the file descriptor argument specifies a file or device to which swapping
should be done.
.Sh NOTES
Although this implementation does not impose any alignment restrictions on
the

View File

@ -68,7 +68,7 @@ geom_stats_resync(void)
return;
for (;;) {
p = mmap(statp, (npages + 1) * pagesize,
PROT_READ, 0, statsfd, 0);
PROT_READ, MAP_SHARED, statsfd, 0);
if (p == MAP_FAILED)
break;
else
@ -90,7 +90,7 @@ geom_stats_open(void)
return (errno);
pagesize = getpagesize();
spp = pagesize / sizeof(struct devstat);
p = mmap(NULL, pagesize, PROT_READ, 0, statsfd, 0);
p = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, statsfd, 0);
if (p == MAP_FAILED) {
error = errno;
close(statsfd);

View File

@ -963,7 +963,8 @@ nvpair_createv_nvlist(const nvlist_t *value, const char *namefmt,
namefmt, nameap);
if (nvp == NULL)
nvlist_destroy(nvl);
nvlist_set_parent(nvl, nvp);
else
nvlist_set_parent(nvl, nvp);
return (nvp);
}

View File

@ -33,7 +33,7 @@ LDADD+= -lssl -lcrypto -lpthread
# Misnamed file in upstream source
configlexer.l: configlexer.lex
cp -p ${.ALLSRC} ${.TARGET}
cp -fp ${.ALLSRC} ${.TARGET}
CLEANFILES+= configlexer.l
# Symbol prefix for lex and yacc

View File

@ -241,7 +241,11 @@ lgammal_r(long double x, int *signgamp)
*signgamp = 1;
if((hx & 0x7fff) == 0x7fff) /* x is +-Inf or NaN */
return x*x;
if((hx==0||hx==0x8000)&&lx==0) return one/vzero;
if((hx==0||hx==0x8000)&&lx==0) {
if (hx&0x8000)
*signgamp = -1;
return one/vzero;
}
/* purge off tiny and negative arguments */
if(fabsl(x)<0x1p-119L) {

View File

@ -261,7 +261,11 @@ lgammal_r(long double x, int *signgamp)
*signgamp = 1;
if((hx & 0x7fff) == 0x7fff) /* x is +-Inf or NaN */
return x*x;
if((hx==0||hx==0x8000)&&lx==0) return one/vzero;
if((hx==0||hx==0x8000)&&lx==0) {
if (hx&0x8000)
*signgamp = -1;
return one/vzero;
}
ENTERI();

View File

@ -214,7 +214,11 @@ __ieee754_lgamma_r(double x, int *signgamp)
*signgamp = 1;
ix = hx&0x7fffffff;
if(ix>=0x7ff00000) return x*x;
if((ix|lx)==0) return one/vzero;
if((ix|lx)==0) {
if(hx<0)
*signgamp = -1;
return one/vzero;
}
if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */
if(hx<0) {
*signgamp = -1;

View File

@ -132,7 +132,11 @@ __ieee754_lgammaf_r(float x, int *signgamp)
*signgamp = 1;
ix = hx&0x7fffffff;
if(ix>=0x7f800000) return x*x;
if(ix==0) return one/vzero;
if(ix==0) {
if(hx<0)
*signgamp = -1;
return one/vzero;
}
if(ix<0x35000000) { /* |x|<2**-21, return -log(|x|) */
if(hx<0) {
*signgamp = -1;

View File

@ -160,8 +160,8 @@ http_date(void)
void
http_output(const char *html)
{
write(con_sock, html, strlen(html));
write(con_sock, "\r\n", 2);
write(con_sock, html, strlen(html));
write(con_sock, "\r\n", 2);
}
@ -172,30 +172,30 @@ http_output(const char *html)
void
log_line(char *req)
{
char log_buff[256];
char msg[1024];
char env_host[80], env_addr[80];
long addr;
FILE *log;
char log_buff[256];
char msg[1024];
char env_host[80], env_addr[80];
long addr;
FILE *log;
strcpy(log_buff,inet_ntoa(source.sin_addr));
sprintf(env_addr, "REMOTE_ADDR=%s",log_buff);
addr=inet_addr(log_buff);
strcpy(msg,adate());
strcat(msg," ");
hst=gethostbyaddr((char*) &addr, 4, AF_INET);
addr=inet_addr(log_buff);
strcpy(msg,adate());
strcat(msg," ");
hst=gethostbyaddr((char*) &addr, 4, AF_INET);
/* If DNS hostname exists */
if (hst) {
if (hst) {
strcat(msg,hst->h_name);
sprintf(env_host, "REMOTE_HOST=%s",hst->h_name);
}
strcat(msg," (");
strcat(msg,log_buff);
strcat(msg,") ");
strcat(msg,req);
strcat(msg," (");
strcat(msg,log_buff);
strcat(msg,") ");
strcat(msg,req);
if (daemonize) {
log=fopen(logfile,"a");
@ -226,8 +226,8 @@ http_request(void)
lg = read(con_sock, req, 1024);
if ((p=strstr(req,"\n"))) *p=0;
if ((p=strstr(req,"\r"))) *p=0;
if ((p=strstr(req,"\n"))) *p=0;
if ((p=strstr(req,"\r"))) *p=0;
log_line(req);
@ -253,40 +253,40 @@ http_request(void)
filename = strtok(NULL, " ");
c = strtok(NULL, " ");
if (fetch_mode != NULL) filename=fetch_mode;
if (filename == NULL ||
strlen(filename)==1) filename="/index.html";
if (fetch_mode != NULL) filename=fetch_mode;
if (filename == NULL ||
strlen(filename)==1) filename="/index.html";
while (filename[0]== '/') filename++;
while (filename[0]== '/') filename++;
/* CGI handling. Untested */
if (!strncmp(filename,"cgi-bin/",8))
{
par=0;
if ((par=strstr(filename,"?")))
{
*par=0;
par++;
}
if (access(filename,X_OK)) goto conti;
stat (filename,&file_status);
if (setuid(file_status.st_uid)) return;
if (seteuid(file_status.st_uid)) return;
if (!fork())
{
close(1);
dup(con_sock);
/*printf("HTTP/1.0 200 OK\nContent-type: text/html\n\n\n");*/
/* CGI handling. Untested */
if (!strncmp(filename,"cgi-bin/",8))
{
par=0;
if ((par=strstr(filename,"?")))
{
*par=0;
par++;
}
if (access(filename,X_OK)) goto conti;
stat (filename,&file_status);
if (setuid(file_status.st_uid)) return;
if (seteuid(file_status.st_uid)) return;
if (!fork())
{
close(1);
dup(con_sock);
/*printf("HTTP/1.0 200 OK\nContent-type: text/html\n\n\n");*/
printf("HTTP/1.0 200 OK\r\n");
/* Plug in environment variable, others in log_line */
/* Plug in environment variable, others in log_line */
setenv("SERVER_SOFTWARE", "FreeBSD/PicoBSD", 1);
execlp (filename,filename,par,(char *)0);
}
wait(&i);
return;
}
conti:
}
wait(&i);
return;
}
conti:
if (filename == NULL) {
http_output(http_405[0]);
http_output(http_405[1]);
@ -307,8 +307,8 @@ http_request(void)
/* Open filename */
fd = open(filename, O_RDONLY);
if (fd < 0) {
http_output(http_404[0]);
http_output(http_404[1]);
http_output(http_404[0]);
http_output(http_404[1]);
goto end_request;
}
@ -325,7 +325,7 @@ http_request(void)
http_output(http_404[1]);
goto end_request2;
}
/* Past this point we are serving either a GET or HEAD */
/* Print all the header info */
http_output(http_200);
@ -371,14 +371,14 @@ http_request(void)
int
main(int argc, char *argv[])
{
int ch, ld;
int httpd_group = 65534;
pid_t server_pid;
int ch, ld;
pid_t httpd_group = 65534;
pid_t server_pid;
/* Default for html directory */
strcpy (homedir,getenv("HOME"));
if (!geteuid()) strcpy (homedir,"/httphome");
else strcat (homedir,"/httphome");
if (!geteuid()) strcpy (homedir,"/httphome");
else strcat (homedir,"/httphome");
/* Defaults for log file */
if (geteuid()) {
@ -420,10 +420,10 @@ main(int argc, char *argv[])
printf("usage: simple_httpd [[-d directory][-g grpid][-l logfile][-p port][-vD]]\n");
exit(1);
/* NOTREACHED */
}
}
/* Not running as root and no port supplied, assume 1080 */
if ((http_port == 80) && geteuid()) {
if ((http_port == 80) && geteuid()) {
http_port = 1080;
}
@ -437,15 +437,15 @@ main(int argc, char *argv[])
}
/* Create log file if it doesn't exit */
if ((access(logfile,W_OK)) && daemonize) {
ld = open (logfile,O_WRONLY);
if ((access(logfile,W_OK)) && daemonize) {
ld = open (logfile,O_WRONLY);
chmod (logfile,00600);
close(ld);
}
init_servconnection();
init_servconnection();
if (verbose) {
if (verbose) {
printf("Server started with options \n");
printf("port: %d\n",http_port);
if (fetch_mode == NULL) printf("html home: %s\n",homedir);
@ -453,7 +453,7 @@ main(int argc, char *argv[])
}
/* httpd is spawned */
if (daemonize) {
if (daemonize) {
if ((server_pid = fork()) != 0) {
wait3(0,WNOHANG,0);
if (verbose) printf("pid: %d\n",server_pid);
@ -462,16 +462,17 @@ main(int argc, char *argv[])
wait3(0,WNOHANG,0);
}
if (fetch_mode == NULL) setpgrp(0,httpd_group);
if (fetch_mode == NULL)
setpgrp((pid_t)0, httpd_group);
/* How many connections do you want?
* Keep this lower than the available number of processes
*/
if (listen(http_sock,15) < 0) exit(1);
if (listen(http_sock,15) < 0) exit(1);
label:
label:
wait_connection();
if (fork()) {
wait3(0,WNOHANG,0);
close(con_sock);
@ -488,13 +489,13 @@ main(int argc, char *argv[])
char *
adate(void)
{
static char out[50];
time_t now;
struct tm *t;
time(&now);
t = localtime(&now);
sprintf(out, "%02d:%02d:%02d %02d/%02d/%02d",
t->tm_hour, t->tm_min, t->tm_sec,
t->tm_mday, t->tm_mon+1, t->tm_year );
return out;
static char out[50];
time_t now;
struct tm *t;
time(&now);
t = localtime(&now);
sprintf(out, "%02d:%02d:%02d %02d/%02d/%02d",
t->tm_hour, t->tm_min, t->tm_sec,
t->tm_mday, t->tm_mon+1, t->tm_year );
return out;
}

View File

@ -50,6 +50,12 @@ ${PKGCMD} -vv
${PKGCMD} update -f
${PKGCMD} fetch -o ${PKG_REPODIR} -d ${DVD_PACKAGES}
# Create the 'Latest/pkg.txz' symlink so 'pkg bootstrap' works
# using the on-disc packages.
mkdir -p ${PKG_REPODIR}/Latest
(cd ${PKG_REPODIR}/Latest && \
ln -s ../All/$(${PKGCMD} rquery %n-%v pkg).txz pkg.txz)
${PKGCMD} repo ${PKG_REPODIR}
# Always exit '0', even if pkg(8) complains about conflicts.

View File

@ -2332,8 +2332,8 @@ from the aggregation interface.
.It Cm laggproto Ar proto
Set the aggregation protocol.
The default is failover.
The available options are failover, fec, lacp, loadbalance, roundrobin and
none.
The available options are failover, lacp, loadbalance, roundrobin, broadcast
and none.
.It Cm lagghash Ar option Ns Oo , Ns Ar option Oc
Set the packet layers to hash for aggregation protocols which load balance.
The default is

View File

@ -151,7 +151,10 @@ getbounds(void) {
}
if (fgets(buf, sizeof buf, fp) == NULL) {
syslog(LOG_WARNING, "unable to read from bounds, using 0");
if (feof(fp))
syslog(LOG_WARNING, "bounds file is empty, using 0");
else
syslog(LOG_WARNING, "bounds file: %s", strerror(errno));
fclose(fp);
return (ret);
}
@ -160,6 +163,7 @@ getbounds(void) {
ret = (int)strtol(buf, NULL, 10);
if (ret == 0 && (errno == EINVAL || errno == ERANGE))
syslog(LOG_WARNING, "invalid value found in bounds, using 0");
fclose(fp);
return (ret);
}

View File

@ -61,10 +61,10 @@ option.
The driver currently supports the aggregation protocols
.Ic failover
(the default),
.Ic fec ,
.Ic lacp ,
.Ic loadbalance ,
.Ic roundrobin ,
.Ic broadcast ,
and
.Ic none .
The protocols determine which ports are used for outgoing traffic
@ -86,9 +86,6 @@ This constraint can be relaxed by setting the
.Xr sysctl 8
variable to a nonzero value,
which is useful for certain bridged network setups.
.It Ic fec
Supports Cisco EtherChannel.
This is an alias for
.Ic loadbalance
mode.
.It Ic lacp
@ -113,6 +110,9 @@ available, the VLAN tag, and the IP source and destination address.
Distributes outgoing traffic using a round-robin scheduler
through all active ports and accepts incoming traffic from
any active port.
.It Ic broadcast
Sends frames to all ports of the LAG and receives frames on
any port of the LAG.
.It Ic none
This protocol is intended to do nothing: it disables any traffic without
disabling the

View File

@ -31,7 +31,7 @@
.\"
.\" $FreeBSD$
.\"/
.Dd October 21, 2009
.Dd September 20, 2014
.Dt MALO 4
.Os
.Sh NAME
@ -49,7 +49,7 @@ kernel configuration file:
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following lines in
module at boot time, place the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
if_malo_load="YES"
@ -84,6 +84,15 @@ the archive and running
in the
.Pa malo-firmware-1.4
directory.
.Pp
To load the
.Nm malofw
firmware kernel module at boot time, place the following
line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
malofw_load="YES"
.Ed
.Sh HARDWARE
The following cards are among those supported by the
.Nm

View File

@ -1390,6 +1390,7 @@ MLINKS+=taskqueue.9 TASK_INIT.9 \
taskqueue.9 TASK_INITIALIZER.9 \
taskqueue.9 taskqueue_block.9 \
taskqueue.9 taskqueue_cancel.9 \
taskqueue.9 taskqueue_cancel_timeout.9 \
taskqueue.9 taskqueue_create.9 \
taskqueue.9 taskqueue_create_fast.9 \
taskqueue.9 TASKQUEUE_DECLARE.9 \
@ -1397,14 +1398,20 @@ MLINKS+=taskqueue.9 TASK_INIT.9 \
taskqueue.9 TASKQUEUE_DEFINE_THREAD.9 \
taskqueue.9 taskqueue_drain.9 \
taskqueue.9 taskqueue_drain_all.9 \
taskqueue.9 taskqueue_drain_timeout.9 \
taskqueue.9 taskqueue_enqueue.9 \
taskqueue.9 taskqueue_enqueue_fast.9 \
taskqueue.9 taskqueue_enqueue_timeout.9 \
taskqueue.9 TASKQUEUE_FAST_DEFINE.9 \
taskqueue.9 TASKQUEUE_FAST_DEFINE_THREAD.9 \
taskqueue.9 taskqueue_free.9 \
taskqueue.9 taskqueue_member.9 \
taskqueue.9 taskqueue_run.9 \
taskqueue.9 taskqueue_unblock.9
taskqueue.9 taskqueue_set_callback.9 \
taskqueue.9 taskqueue_start_threads.9 \
taskqueue.9 taskqueue_start_threads_pinned.9 \
taskqueue.9 taskqueue_unblock.9 \
taskqueue.9 TIMEOUT_TASK_INIT.9
MLINKS+=time.9 boottime.9 \
time.9 time_second.9 \
time.9 time_uptime.9

View File

@ -24,13 +24,15 @@
.\"
.\" $FreeBSD$
.\"
.Dd August 17, 2013
.Dd September 18, 2014
.Dt SDT 9
.Os
.Sh NAME
.Nm SDT
.Nd a DTrace framework for adding statically-defined tracing probes
.Sh SYNOPSIS
.In sys/param.h
.In sys/queue.h
.In sys/sdt.h
.Fn SDT_PROVIDER_DECLARE prov
.Fn SDT_PROVIDER_DEFINE prov

View File

@ -256,7 +256,6 @@ still work with
struct mbuf *ifq_tail; | struct mbuf *ifq_tail;
int ifq_len; | int ifq_len;
int ifq_maxlen; | int ifq_maxlen;
int ifq_drops; | int ifq_drops;
}; | /* driver queue fields */
| ......
| /* altq related fields */

View File

@ -362,7 +362,7 @@ fpuexit(struct thread *td)
stop_emulating();
fpusave(curpcb->pcb_save);
start_emulating();
PCPU_SET(fpcurthread, 0);
PCPU_SET(fpcurthread, NULL);
}
critical_exit();
}
@ -602,16 +602,21 @@ fputrap_sse(void)
return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]);
}
/*
* Implement device not available (DNA) exception
*
* It would be better to switch FP context here (if curthread != fpcurthread)
* and not necessarily for every context switch, but it is too hard to
* access foreign pcb's.
*/
static int err_count = 0;
/*
* Device Not Available (DNA, #NM) exception handler.
*
* It would be better to switch FP context here (if curthread !=
* fpcurthread) and not necessarily for every context switch, but it
* is too hard to access foreign pcb's.
*
* The handler is entered with interrupts enabled, which allows the
* context switch to happen before critical enter() is executed, and
* causes restoration of FPU context on CPU other than that caused
* DNA. It is fine, since context switch started emulation on the
* current CPU as well.
*/
void
fpudna(void)
{
@ -625,11 +630,9 @@ fpudna(void)
return;
}
if (PCPU_GET(fpcurthread) != NULL) {
printf("fpudna: fpcurthread = %p (%d), curthread = %p (%d)\n",
PCPU_GET(fpcurthread),
PCPU_GET(fpcurthread)->td_proc->p_pid,
curthread, curthread->td_proc->p_pid);
panic("fpudna");
panic("fpudna: fpcurthread = %p (%d), curthread = %p (%d)\n",
PCPU_GET(fpcurthread), PCPU_GET(fpcurthread)->td_tid,
curthread, curthread->td_tid);
}
stop_emulating();
/*

View File

@ -3873,7 +3873,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot)
pt_entry_t *pte, PG_G, PG_M, PG_RW, PG_V;
boolean_t anychanged, pv_lists_locked;
if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
KASSERT((prot & ~VM_PROT_ALL) == 0, ("invalid prot %x", prot));
if (prot == VM_PROT_NONE) {
pmap_remove(pmap, sva, eva);
return;
}

View File

@ -61,6 +61,11 @@ MALLOC_DECLARE(M_LINUX);
#define PTRIN(v) (void *)(uintptr_t)(v)
#define PTROUT(v) (l_uintptr_t)(uintptr_t)(v)
#define CP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
#define CP2(src,dst,sfld,dfld) do { (dst).dfld = (src).sfld; } while (0)
#define PTRIN_CP(src,dst,fld) \
do { (dst).fld = PTRIN((src).fld); } while (0)
/*
* Provide a separate set of types for the Linux types.
*/

View File

@ -73,11 +73,6 @@ DUMMY(epoll_create);
DUMMY(epoll_ctl);
DUMMY(epoll_wait);
DUMMY(remap_file_pages);
DUMMY(timer_create);
DUMMY(timer_settime);
DUMMY(timer_gettime);
DUMMY(timer_getoverrun);
DUMMY(timer_delete);
DUMMY(fstatfs64);
DUMMY(mbind);
DUMMY(get_mempolicy);

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255675 2013-09-18 18:48:33Z rdivacky
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 271743 2014-09-18 08:36:45Z bz
*/
#ifndef _LINUX_SYSPROTO_H_
@ -781,19 +781,25 @@ struct linux_set_tid_address_args {
char tidptr_l_[PADL_(int *)]; int * tidptr; char tidptr_r_[PADR_(int *)];
};
struct linux_timer_create_args {
register_t dummy;
char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];
char evp_l_[PADL_(struct sigevent *)]; struct sigevent * evp; char evp_r_[PADR_(struct sigevent *)];
char timerid_l_[PADL_(l_timer_t *)]; l_timer_t * timerid; char timerid_r_[PADR_(l_timer_t *)];
};
struct linux_timer_settime_args {
register_t dummy;
char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
char new_l_[PADL_(const struct itimerspec *)]; const struct itimerspec * new; char new_r_[PADR_(const struct itimerspec *)];
char old_l_[PADL_(struct itimerspec *)]; struct itimerspec * old; char old_r_[PADR_(struct itimerspec *)];
};
struct linux_timer_gettime_args {
register_t dummy;
char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
char setting_l_[PADL_(struct itimerspec *)]; struct itimerspec * setting; char setting_r_[PADR_(struct itimerspec *)];
};
struct linux_timer_getoverrun_args {
register_t dummy;
char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
};
struct linux_timer_delete_args {
register_t dummy;
char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
};
struct linux_clock_settime_args {
char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255675 2013-09-18 18:48:33Z rdivacky
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 271743 2014-09-18 08:36:45Z bz
*/
#define LINUX_SYS_exit 1

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255675 2013-09-18 18:48:33Z rdivacky
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 271743 2014-09-18 08:36:45Z bz
*/
const char *linux_syscallnames[] = {

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255675 2013-09-18 18:48:33Z rdivacky
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 271743 2014-09-18 08:36:45Z bz
*/
#include "opt_compat.h"
@ -278,11 +278,11 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)linux_epoll_wait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 256 = linux_epoll_wait */
{ 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 257 = linux_remap_file_pages */
{ AS(linux_set_tid_address_args), (sy_call_t *)linux_set_tid_address, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 258 = linux_set_tid_address */
{ 0, (sy_call_t *)linux_timer_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 259 = linux_timer_create */
{ 0, (sy_call_t *)linux_timer_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 260 = linux_timer_settime */
{ 0, (sy_call_t *)linux_timer_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 261 = linux_timer_gettime */
{ 0, (sy_call_t *)linux_timer_getoverrun, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 262 = linux_timer_getoverrun */
{ 0, (sy_call_t *)linux_timer_delete, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 263 = linux_timer_delete */
{ AS(linux_timer_create_args), (sy_call_t *)linux_timer_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 259 = linux_timer_create */
{ AS(linux_timer_settime_args), (sy_call_t *)linux_timer_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 260 = linux_timer_settime */
{ AS(linux_timer_gettime_args), (sy_call_t *)linux_timer_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 261 = linux_timer_gettime */
{ AS(linux_timer_getoverrun_args), (sy_call_t *)linux_timer_getoverrun, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 262 = linux_timer_getoverrun */
{ AS(linux_timer_delete_args), (sy_call_t *)linux_timer_delete, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 263 = linux_timer_delete */
{ AS(linux_clock_settime_args), (sy_call_t *)linux_clock_settime, AUE_CLOCK_SETTIME, NULL, 0, 0, 0, SY_THR_STATIC }, /* 264 = linux_clock_settime */
{ AS(linux_clock_gettime_args), (sy_call_t *)linux_clock_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 265 = linux_clock_gettime */
{ AS(linux_clock_getres_args), (sy_call_t *)linux_clock_getres, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 266 = linux_clock_getres */

View File

@ -1720,27 +1720,43 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
}
/* linux_timer_create */
case 259: {
*n_args = 0;
struct linux_timer_create_args *p = params;
iarg[0] = p->clock_id; /* clockid_t */
uarg[1] = (intptr_t) p->evp; /* struct sigevent * */
uarg[2] = (intptr_t) p->timerid; /* l_timer_t * */
*n_args = 3;
break;
}
/* linux_timer_settime */
case 260: {
*n_args = 0;
struct linux_timer_settime_args *p = params;
iarg[0] = p->timerid; /* l_timer_t */
iarg[1] = p->flags; /* l_int */
uarg[2] = (intptr_t) p->new; /* const struct itimerspec * */
uarg[3] = (intptr_t) p->old; /* struct itimerspec * */
*n_args = 4;
break;
}
/* linux_timer_gettime */
case 261: {
*n_args = 0;
struct linux_timer_gettime_args *p = params;
iarg[0] = p->timerid; /* l_timer_t */
uarg[1] = (intptr_t) p->setting; /* struct itimerspec * */
*n_args = 2;
break;
}
/* linux_timer_getoverrun */
case 262: {
*n_args = 0;
struct linux_timer_getoverrun_args *p = params;
iarg[0] = p->timerid; /* l_timer_t */
*n_args = 1;
break;
}
/* linux_timer_delete */
case 263: {
*n_args = 0;
struct linux_timer_delete_args *p = params;
iarg[0] = p->timerid; /* l_timer_t */
*n_args = 1;
break;
}
/* linux_clock_settime */
@ -4829,18 +4845,71 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
/* linux_timer_create */
case 259:
switch(ndx) {
case 0:
p = "clockid_t";
break;
case 1:
p = "struct sigevent *";
break;
case 2:
p = "l_timer_t *";
break;
default:
break;
};
break;
/* linux_timer_settime */
case 260:
switch(ndx) {
case 0:
p = "l_timer_t";
break;
case 1:
p = "l_int";
break;
case 2:
p = "const struct itimerspec *";
break;
case 3:
p = "struct itimerspec *";
break;
default:
break;
};
break;
/* linux_timer_gettime */
case 261:
switch(ndx) {
case 0:
p = "l_timer_t";
break;
case 1:
p = "struct itimerspec *";
break;
default:
break;
};
break;
/* linux_timer_getoverrun */
case 262:
switch(ndx) {
case 0:
p = "l_timer_t";
break;
default:
break;
};
break;
/* linux_timer_delete */
case 263:
switch(ndx) {
case 0:
p = "l_timer_t";
break;
default:
break;
};
break;
/* linux_clock_settime */
case 264:
@ -6413,14 +6482,29 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
/* linux_timer_create */
case 259:
if (ndx == 0 || ndx == 1)
p = "int";
break;
/* linux_timer_settime */
case 260:
if (ndx == 0 || ndx == 1)
p = "int";
break;
/* linux_timer_gettime */
case 261:
if (ndx == 0 || ndx == 1)
p = "int";
break;
/* linux_timer_getoverrun */
case 262:
if (ndx == 0 || ndx == 1)
p = "int";
break;
/* linux_timer_delete */
case 263:
if (ndx == 0 || ndx == 1)
p = "int";
break;
/* linux_clock_settime */
case 264:
if (ndx == 0 || ndx == 1)

View File

@ -435,11 +435,13 @@
256 AUE_NULL STD { int linux_epoll_wait(void); }
257 AUE_NULL STD { int linux_remap_file_pages(void); }
258 AUE_NULL STD { int linux_set_tid_address(int *tidptr); }
259 AUE_NULL STD { int linux_timer_create(void); }
260 AUE_NULL STD { int linux_timer_settime(void); }
261 AUE_NULL STD { int linux_timer_gettime(void); }
262 AUE_NULL STD { int linux_timer_getoverrun(void); }
263 AUE_NULL STD { int linux_timer_delete(void); }
259 AUE_NULL STD { int linux_timer_create(clockid_t clock_id, \
struct sigevent *evp, l_timer_t *timerid); }
260 AUE_NULL STD { int linux_timer_settime(l_timer_t timerid, l_int flags, \
const struct itimerspec *new, struct itimerspec *old); }
261 AUE_NULL STD { int linux_timer_gettime(l_timer_t timerid, struct itimerspec *setting); }
262 AUE_NULL STD { int linux_timer_getoverrun(l_timer_t timerid); }
263 AUE_NULL STD { int linux_timer_delete(l_timer_t timerid); }
264 AUE_CLOCK_SETTIME STD { int linux_clock_settime(clockid_t which, struct l_timespec *tp); }
265 AUE_NULL STD { int linux_clock_gettime(clockid_t which, struct l_timespec *tp); }
266 AUE_NULL STD { int linux_clock_getres(clockid_t which, struct l_timespec *tp); }

View File

@ -260,7 +260,7 @@ emac_txeof(struct emac_softc *sc)
EMAC_ASSERT_LOCKED(sc);
ifp = sc->emac_ifp;
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
/* Unarm watchdog timer if no TX */
@ -340,12 +340,12 @@ emac_rxeof(struct emac_softc *sc, int count)
if_printf(ifp,
"bad packet: len = %i status = %i\n",
len, status);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
#if 0
if (status & (EMAC_CRCERR | EMAC_LENERR)) {
good_packet = 0;
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
if (status & EMAC_CRCERR)
if_printf(ifp, "crc error\n");
if (status & EMAC_LENERR)
@ -393,18 +393,18 @@ emac_rxeof(struct emac_softc *sc, int count)
m0->m_next = m;
m = m0;
} else {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
m = NULL;
continue;
}
} else if (m->m_len > EMAC_MAC_MAXF) {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
m = NULL;
continue;
}
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
EMAC_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
EMAC_LOCK(sc);
@ -431,7 +431,7 @@ emac_watchdog(struct emac_softc *sc)
} else
if_printf(sc->emac_ifp, "watchdog timeout -- resetting\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
emac_init_locked(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))

View File

@ -776,19 +776,19 @@ ate_tick(void *xsc)
sc->mibdata.dot3StatsAlignmentErrors += RD4(sc, ETH_ALE);
sc->mibdata.dot3StatsFCSErrors += RD4(sc, ETH_SEQE);
c = RD4(sc, ETH_SCOL);
ifp->if_collisions += c;
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, c);
sc->mibdata.dot3StatsSingleCollisionFrames += c;
c = RD4(sc, ETH_MCOL);
sc->mibdata.dot3StatsMultipleCollisionFrames += c;
ifp->if_collisions += c;
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, c);
sc->mibdata.dot3StatsSQETestErrors += RD4(sc, ETH_SQEE);
sc->mibdata.dot3StatsDeferredTransmissions += RD4(sc, ETH_DTE);
c = RD4(sc, ETH_LCOL);
sc->mibdata.dot3StatsLateCollisions += c;
ifp->if_collisions += c;
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, c);
c = RD4(sc, ETH_ECOL);
sc->mibdata.dot3StatsExcessiveCollisions += c;
ifp->if_collisions += c;
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, c);
sc->mibdata.dot3StatsCarrierSenseErrors += RD4(sc, ETH_CSE);
sc->mibdata.dot3StatsFrameTooLongs += RD4(sc, ETH_ELR);
sc->mibdata.dot3StatsInternalMacReceiveErrors += RD4(sc, ETH_DRFC);
@ -797,9 +797,9 @@ ate_tick(void *xsc)
* Not sure where to lump these, so count them against the errors
* for the interface.
*/
sc->ifp->if_oerrors += RD4(sc, ETH_TUE);
sc->ifp->if_ierrors += RD4(sc, ETH_CDE) + RD4(sc, ETH_RJB) +
RD4(sc, ETH_USF);
if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, RD4(sc, ETH_TUE));
if_inc_counter(sc->ifp, IFCOUNTER_IERRORS,
RD4(sc, ETH_CDE) + RD4(sc, ETH_RJB) + RD4(sc, ETH_USF));
/* Schedule another timeout one second from now. */
callout_reset(&sc->tick_ch, hz, ate_tick, sc);
@ -914,7 +914,7 @@ ate_intr(void *xsc)
mb = m_get2(remain + ETHER_ALIGN, M_NOWAIT, MT_DATA,
M_PKTHDR);
if (mb == NULL) {
sc->ifp->if_iqdrops++;
if_inc_counter(sc->ifp, IFCOUNTER_IQDROPS, 1);
rxdhead->status = 0;
continue;
}
@ -957,7 +957,7 @@ ate_intr(void *xsc)
} while (!done);
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
(*ifp->if_input)(ifp, mb);
}
}
@ -990,7 +990,7 @@ ate_intr(void *xsc)
m_freem(sc->sent_mbuf[sc->txtail]);
sc->tx_descs[sc->txtail].addr = 0;
sc->sent_mbuf[sc->txtail] = NULL;
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
sc->txtail = NEXT_TX_IDX(sc, sc->txtail);
}
@ -1162,7 +1162,7 @@ atestart_locked(struct ifnet *ifp)
BUS_DMASYNC_POSTWRITE);
bus_dmamap_unload(sc->mtag, sc->tx_map[sc->txtail]);
m_free(sc->sent_mbuf[sc->txhead]);
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
}
sc->sent_mbuf[sc->txhead] = m;

View File

@ -522,12 +522,12 @@ macb_watchdog(struct macb_softc *sc)
ifp = sc->ifp;
if ((sc->flags & MACB_FLAG_LINK) == 0) {
if_printf(ifp, "watchdog timeout (missed link)\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return;
}
if_printf(ifp, "watchdog timeout\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
macbinit_locked(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
@ -677,7 +677,7 @@ macb_tx_cleanup(struct macb_softc *sc)
td->dmamap);
m_freem(td->buff);
td->buff = NULL;
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
}
do {
@ -732,7 +732,7 @@ macb_rx(struct macb_softc *sc)
bus_dmamap_sync(sc->dmatag_ring_rx,
sc->rx_desc[sc->rx_cons].dmamap, BUS_DMASYNC_POSTREAD);
if (macb_new_rxbuf(sc, sc->rx_cons) != 0) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
first = sc->rx_cons;
do {
@ -781,7 +781,7 @@ macb_rx(struct macb_softc *sc)
m->m_flags |= M_PKTHDR;
m->m_pkthdr.len = rxbytes;
m->m_pkthdr.rcvif = ifp;
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
nsegs = 0;
MACB_UNLOCK(sc);

View File

@ -1379,7 +1379,7 @@ ece_intr_rx_locked(struct ece_softc *sc, int count)
if (desc->length < ETHER_MIN_LEN - ETHER_CRC_LEN ||
desc->length > ETHER_MAX_LEN - ETHER_CRC_LEN +
ETHER_VLAN_ENCAP_LEN) {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
desc->cown = 0;
desc->length = MCLBYTES - 2;
/* Invalid packet, skip and process next
@ -1389,7 +1389,7 @@ ece_intr_rx_locked(struct ece_softc *sc, int count)
}
if (ece_new_rxbuf(sc, rxdesc) != 0) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
desc->cown = 0;
desc->length = MCLBYTES - 2;
break;
@ -1478,7 +1478,7 @@ ece_intr_status(void *xsc)
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
if ((stat & ERROR_MASK) != 0)
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
}
}

View File

@ -754,7 +754,7 @@ lpe_rxintr(struct lpe_softc *sc)
/* Check received frame for errors */
if (hws->lhs_info & LPE_HWDESC_RXERRS) {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
lpe_discard_rxbuf(sc, cons);
lpe_init_rxbuf(sc, cons);
goto skip;
@ -764,7 +764,7 @@ lpe_rxintr(struct lpe_softc *sc)
m->m_pkthdr.rcvif = ifp;
m->m_data += 2;
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
lpe_unlock(sc);
(*ifp->if_input)(ifp, m);
@ -800,12 +800,12 @@ lpe_txintr(struct lpe_softc *sc)
bus_dmamap_sync(sc->lpe_cdata.lpe_tx_buf_tag,
txd->lpe_txdesc_dmamap, BUS_DMASYNC_POSTWRITE);
ifp->if_collisions += LPE_HWDESC_COLLISIONS(hws->lhs_info);
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, LPE_HWDESC_COLLISIONS(hws->lhs_info));
if (hws->lhs_info & LPE_HWDESC_TXERRS)
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
else
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
if (txd->lpe_txdesc_first) {
bus_dmamap_unload(sc->lpe_cdata.lpe_tx_buf_tag,

View File

@ -1837,7 +1837,7 @@ cpsw_tx_watchdog(struct cpsw_softc *sc)
++sc->watchdog.timer;
if (sc->watchdog.timer > 2) {
sc->watchdog.timer = 0;
++ifp->if_oerrors;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
++sc->watchdog.resets;
cpsw_tx_watchdog_full_reset(sc);
}

View File

@ -906,20 +906,18 @@ npe_addstats(struct npe_softc *sc)
be32toh(ns->RxOverrunDiscards)
+ be32toh(ns->RxUnderflowEntryDiscards);
ifp->if_oerrors +=
be32toh(ns->dot3StatsInternalMacTransmitErrors)
+ be32toh(ns->dot3StatsCarrierSenseErrors)
+ be32toh(ns->TxVLANIdFilterDiscards)
;
ifp->if_ierrors += be32toh(ns->dot3StatsFCSErrors)
+ be32toh(ns->dot3StatsInternalMacReceiveErrors)
+ be32toh(ns->RxOverrunDiscards)
+ be32toh(ns->RxUnderflowEntryDiscards)
;
ifp->if_collisions +=
be32toh(ns->dot3StatsSingleCollisionFrames)
+ be32toh(ns->dot3StatsMultipleCollisionFrames)
;
if_inc_counter(ifp, IFCOUNTER_OERRORS,
be32toh(ns->dot3StatsInternalMacTransmitErrors) +
be32toh(ns->dot3StatsCarrierSenseErrors) +
be32toh(ns->TxVLANIdFilterDiscards));
if_inc_counter(ifp, IFCOUNTER_IERRORS,
be32toh(ns->dot3StatsFCSErrors) +
be32toh(ns->dot3StatsInternalMacReceiveErrors) +
be32toh(ns->RxOverrunDiscards) +
be32toh(ns->RxUnderflowEntryDiscards));
if_inc_counter(ifp, IFCOUNTER_COLLISIONS,
be32toh(ns->dot3StatsSingleCollisionFrames) +
be32toh(ns->dot3StatsMultipleCollisionFrames));
#undef NPEADD
#undef MIBADD
}
@ -999,7 +997,7 @@ npe_txdone_finish(struct npe_softc *sc, const struct txdone *td)
* We're no longer busy, so clear the busy flag and call the
* start routine to xmit more packets.
*/
ifp->if_opackets += td->count;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, td->count);
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
sc->npe_watchdog_timer = 0;
npestart_locked(ifp);
@ -1138,7 +1136,7 @@ npe_rxdone(int qid, void *arg)
mrx->m_pkthdr.len = mrx->m_len;
mrx->m_pkthdr.rcvif = ifp;
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
ifp->if_input(ifp, mrx);
rx_npkts++;
} else {
@ -1467,7 +1465,7 @@ npewatchdog(struct npe_softc *sc)
return;
device_printf(sc->sc_dev, "watchdog timeout\n");
sc->sc_ifp->if_oerrors++;
if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
npeinit_locked(sc);
}

View File

@ -26,6 +26,7 @@ __FBSDID("$FreeBSD$");
#include <machine/stdarg.h>
#include <efi.h>
#include <eficonsctl.h>
#define _PATH_LOADER "/boot/loader.efi"
#define _PATH_KERNEL "/boot/kernel/kernel"
@ -97,6 +98,7 @@ strcmp(const char *s1, const char *s2)
static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL;
static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL;
static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL;
static EFI_GUID ConsoleControlGUID = EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
static EFI_BLOCK_IO *bootdev;
static EFI_DEVICE_PATH *bootdevpath;
@ -109,11 +111,20 @@ EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab)
UINTN i, nparts = sizeof(handles);
EFI_STATUS status;
EFI_DEVICE_PATH *devpath;
EFI_BOOT_SERVICES *BS;
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl = NULL;
char *path = _PATH_LOADER;
systab = Xsystab;
image = Ximage;
BS = systab->BootServices;
status = BS->LocateProtocol(&ConsoleControlGUID, NULL,
(VOID **)&ConsoleControl);
if (status == EFI_SUCCESS)
(void)ConsoleControl->SetMode(ConsoleControl,
EfiConsoleControlScreenText);
printf(" \n>> FreeBSD EFI boot block\n");
printf(" Loader path: %s\n", path);

View File

@ -236,10 +236,14 @@ bi_load_efi_data(struct preloaded_file *kfp)
if (efi_find_framebuffer(&efifb) == 0) {
printf("EFI framebuffer information:\n");
printf("addr, size 0x%lx, 0x%lx\n", efifb.fb_addr, efifb.fb_size);
printf("dimensions %d x %d\n", efifb.fb_width, efifb.fb_height);
printf("addr, size 0x%lx, 0x%lx\n", efifb.fb_addr,
efifb.fb_size);
printf("dimensions %d x %d\n", efifb.fb_width,
efifb.fb_height);
printf("stride %d\n", efifb.fb_stride);
printf("masks 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", efifb.fb_mask_red, efifb.fb_mask_green, efifb.fb_mask_blue, efifb.fb_mask_reserved);
printf("masks 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
efifb.fb_mask_red, efifb.fb_mask_green, efifb.fb_mask_blue,
efifb.fb_mask_reserved);
file_addmetadata(kfp, MODINFOMD_EFI_FB, sizeof(efifb), &efifb);
}

View File

@ -0,0 +1,253 @@
/*-
* Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Original Module Name: ConsoleControl.h
* Abstract: Abstraction of a Text mode or GOP/UGA screen
*/
/* $FreeBSD$ */
#ifndef _EFI_CONS_CTL_H
#define _EFI_CONS_CTL_H
#define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \
{ 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} }
typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL EFI_CONSOLE_CONTROL_PROTOCOL;
typedef enum {
EfiConsoleControlScreenText,
EfiConsoleControlScreenGraphics,
EfiConsoleControlScreenMaxValue
} EFI_CONSOLE_CONTROL_SCREEN_MODE;
typedef
EFI_STATUS
(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE) (
IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode,
OUT BOOLEAN *GopUgaExists, OPTIONAL
OUT BOOLEAN *StdInLocked OPTIONAL
)
/*++
Routine Description:
Return the current video mode information. Also returns info about existence
of Graphics Output devices or UGA Draw devices in system, and if the Std In
device is locked. All the arguments are optional and only returned if a non
NULL pointer is passed in.
Arguments:
This - Protocol instance pointer.
Mode - Are we in text of grahics mode.
GopUgaExists - TRUE if Console Spliter has found a GOP or UGA device
StdInLocked - TRUE if StdIn device is keyboard locked
Returns:
EFI_SUCCESS - Mode information returned.
--*/
;
typedef
EFI_STATUS
(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE) (
IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode
)
/*++
Routine Description:
Set the current mode to either text or graphics. Graphics is
for Quiet Boot.
Arguments:
This - Protocol instance pointer.
Mode - Mode to set the
Returns:
EFI_SUCCESS - Mode information returned.
--*/
;
typedef
EFI_STATUS
(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN) (
IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
IN CHAR16 *Password
)
/*++
Routine Description:
Lock Std In devices until Password is typed.
Arguments:
This - Protocol instance pointer.
Password - Password needed to unlock screen. NULL means unlock keyboard
Returns:
EFI_SUCCESS - Mode information returned.
EFI_DEVICE_ERROR - Std In not locked
--*/
;
struct _EFI_CONSOLE_CONTROL_PROTOCOL {
EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE GetMode;
EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE SetMode;
EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN LockStdIn;
};
extern EFI_GUID gEfiConsoleControlProtocolGuid;
#endif
/*-
* Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
*
* This program and the accompanying materials are licensed and made available
* under the terms and conditions of the BSD License which accompanies this
* distribution. The full text of the license may be found at
* http://opensource.org/licenses/bsd-license.php
*
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
* IMPLIED.
*
* Original Module Name: ConsoleControl.h
* Abstract: Abstraction of a Text mode or GOP/UGA screen
*/
/* $FreeBSD */
#ifndef _EFI_CONS_CTL_H
#define _EFI_CONS_CTL_H
#define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \
{ 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} }
typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL EFI_CONSOLE_CONTROL_PROTOCOL;
typedef enum {
EfiConsoleControlScreenText,
EfiConsoleControlScreenGraphics,
EfiConsoleControlScreenMaxValue
} EFI_CONSOLE_CONTROL_SCREEN_MODE;
typedef
EFI_STATUS
(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE) (
IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode,
OUT BOOLEAN *GopUgaExists, OPTIONAL
OUT BOOLEAN *StdInLocked OPTIONAL
)
/*++
Routine Description:
Return the current video mode information. Also returns info about existence
of Graphics Output devices or UGA Draw devices in system, and if the Std In
device is locked. All the arguments are optional and only returned if a non
NULL pointer is passed in.
Arguments:
This - Protocol instance pointer.
Mode - Are we in text of grahics mode.
GopUgaExists - TRUE if Console Spliter has found a GOP or UGA device
StdInLocked - TRUE if StdIn device is keyboard locked
Returns:
EFI_SUCCESS - Mode information returned.
--*/
;
typedef
EFI_STATUS
(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE) (
IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode
)
/*++
Routine Description:
Set the current mode to either text or graphics. Graphics is
for Quiet Boot.
Arguments:
This - Protocol instance pointer.
Mode - Mode to set the
Returns:
EFI_SUCCESS - Mode information returned.
--*/
;
typedef
EFI_STATUS
(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN) (
IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
IN CHAR16 *Password
)
/*++
Routine Description:
Lock Std In devices until Password is typed.
Arguments:
This - Protocol instance pointer.
Password - Password needed to unlock screen. NULL means unlock keyboard
Returns:
EFI_SUCCESS - Mode information returned.
EFI_DEVICE_ERROR - Std In not locked
--*/
;
struct _EFI_CONSOLE_CONTROL_PROTOCOL {
EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE GetMode;
EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE SetMode;
EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN LockStdIn;
};
extern EFI_GUID gEfiConsoleControlProtocolGuid;
#endif

View File

@ -28,6 +28,7 @@
__FBSDID("$FreeBSD$");
#include <efi.h>
#include <eficonsctl.h>
#include <efilib.h>
#include <stand.h>
@ -82,6 +83,9 @@ void
efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table)
{
static EFI_GUID image_protocol = LOADED_IMAGE_PROTOCOL;
static EFI_GUID console_control_protocol =
EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
EFI_CONSOLE_CONTROL_PROTOCOL *console_control = NULL;
EFI_LOADED_IMAGE *img;
CHAR16 *argp, *args, **argv;
EFI_STATUS status;
@ -92,6 +96,12 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table)
BS = ST->BootServices;
RS = ST->RuntimeServices;
status = BS->LocateProtocol(&console_control_protocol, NULL,
(VOID **)&console_control);
if (status == EFI_SUCCESS)
(void)console_control->SetMode(console_control,
EfiConsoleControlScreenText);
heapsize = 2 * 1024 * 1024;
status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData,
EFI_SIZE_TO_PAGES(heapsize), &heap);

View File

@ -3052,7 +3052,7 @@ xpt_polled_action(union ccb *start_ccb)
}
/*
* Schedule a peripheral driver to receive a ccb when it's
* Schedule a peripheral driver to receive a ccb when its
* target device has space for more transactions.
*/
void

View File

@ -5993,6 +5993,14 @@ ctl_write_same(struct ctl_scsiio *ctsio)
break; /* NOTREACHED */
}
/* NDOB flag can be used only together with UNMAP */
if ((byte2 & (SWS_NDOB | SWS_UNMAP)) == SWS_NDOB) {
ctl_set_invalid_field(ctsio, /*sks_valid*/ 1,
/*command*/ 1, /*field*/ 1, /*bit_valid*/ 1, /*bit*/ 0);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
/*
* The first check is to make sure we're in bounds, the second
* check is to catch wrap-around problems. If the lba + num blocks
@ -6027,7 +6035,8 @@ ctl_write_same(struct ctl_scsiio *ctsio)
* If we've got a kernel request that hasn't been malloced yet,
* malloc it and tell the caller the data buffer is here.
*/
if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) {
if ((byte2 & SWS_NDOB) == 0 &&
(ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) {
ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK);;
ctsio->kern_data_len = len;
ctsio->kern_total_len = len;
@ -7065,7 +7074,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
* descriptor. Otherwise, just set it to 0.
*/
if (dbd == 0) {
if (control_dev != 0)
if (control_dev == 0)
scsi_ulto3b(lun->be_lun->blocksize,
block_desc->block_len);
else
@ -7879,7 +7888,7 @@ ctl_persistent_reserve_in(struct ctl_scsiio *ctsio)
res_cap = (struct scsi_per_res_cap *)ctsio->kern_data_ptr;
scsi_ulto2b(sizeof(*res_cap), res_cap->length);
res_cap->flags2 |= SPRI_TMV | SPRI_ALLOW_3;
res_cap->flags2 |= SPRI_TMV | SPRI_ALLOW_5;
type_mask = SPRI_TM_WR_EX_AR |
SPRI_TM_EX_AC_RO |
SPRI_TM_WR_EX_RO |

View File

@ -1042,7 +1042,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun,
softc = be_lun->softc;
lbalen = ARGS(beio->io);
if (lbalen->flags & ~(SWS_LBDATA | SWS_UNMAP | SWS_ANCHOR) ||
if (lbalen->flags & ~(SWS_LBDATA | SWS_UNMAP | SWS_ANCHOR | SWS_NDOB) ||
(lbalen->flags & (SWS_UNMAP | SWS_ANCHOR) && be_lun->unmap == NULL)) {
ctl_free_beio(beio);
ctl_set_invalid_field(&io->scsiio,
@ -2278,7 +2278,9 @@ ctl_be_block_modify_file(struct ctl_be_block_lun *be_lun,
if (params->lun_size_bytes != 0) {
be_lun->size_bytes = params->lun_size_bytes;
} else {
vn_lock(be_lun->vn, LK_SHARED | LK_RETRY);
error = VOP_GETATTR(be_lun->vn, &vattr, curthread->td_ucred);
VOP_UNLOCK(be_lun->vn, 0);
if (error != 0) {
snprintf(req->error_str, sizeof(req->error_str),
"error calling VOP_GETATTR() for file %s",
@ -2296,24 +2298,22 @@ static int
ctl_be_block_modify_dev(struct ctl_be_block_lun *be_lun,
struct ctl_lun_req *req)
{
struct cdev *dev;
struct cdevsw *devsw;
struct ctl_be_block_devdata *dev_data;
int error;
struct ctl_lun_modify_params *params;
uint64_t size_bytes;
params = &req->reqdata.modify;
dev = be_lun->vn->v_rdev;
devsw = dev->si_devsw;
if (!devsw->d_ioctl) {
dev_data = &be_lun->backend.dev;
if (!dev_data->csw->d_ioctl) {
snprintf(req->error_str, sizeof(req->error_str),
"%s: no d_ioctl for device %s!", __func__,
be_lun->dev_path);
return (ENODEV);
}
error = devsw->d_ioctl(dev, DIOCGMEDIASIZE,
error = dev_data->csw->d_ioctl(dev_data->cdev, DIOCGMEDIASIZE,
(caddr_t)&size_bytes, FREAD,
curthread);
if (error) {
@ -2346,6 +2346,7 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
{
struct ctl_lun_modify_params *params;
struct ctl_be_block_lun *be_lun;
uint64_t oldsize;
int error;
params = &req->reqdata.modify;
@ -2376,28 +2377,27 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
}
}
vn_lock(be_lun->vn, LK_SHARED | LK_RETRY);
oldsize = be_lun->size_bytes;
if (be_lun->vn->v_type == VREG)
error = ctl_be_block_modify_file(be_lun, req);
else
error = ctl_be_block_modify_dev(be_lun, req);
VOP_UNLOCK(be_lun->vn, 0);
if (error != 0)
goto bailout_error;
be_lun->size_blocks = be_lun->size_bytes >> be_lun->blocksize_shift;
if (be_lun->size_bytes != oldsize) {
be_lun->size_blocks = be_lun->size_bytes >>
be_lun->blocksize_shift;
/*
* The maximum LBA is the size - 1.
*
* XXX: Note that this field is being updated without locking,
* which might cause problems on 32-bit architectures.
*/
be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1;
ctl_lun_capacity_changed(&be_lun->ctl_be_lun);
/*
* The maximum LBA is the size - 1.
*
* XXX: Note that this field is being updated without locking,
* which might cause problems on 32-bit architectures.
*/
be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1;
ctl_lun_capacity_changed(&be_lun->ctl_be_lun);
}
/* Tell the user the exact size we ended up using */
params->lun_size_bytes = be_lun->size_bytes;

View File

@ -304,7 +304,8 @@ const struct ctl_cmd_entry ctl_cmd_table_84[32] =
/* 00 RECEIVE COPY STATUS (LID1) */
{ctl_receive_copy_status_lid1, CTL_SERIDX_RD_CAP,
CTL_CMD_FLAG_OK_ON_BOTH |
CTL_FLAG_DATA_IN,
CTL_FLAG_DATA_IN |
CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
CTL_LUN_PAT_NONE,
16, {0x00, 0xff, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}},
@ -320,14 +321,16 @@ const struct ctl_cmd_entry ctl_cmd_table_84[32] =
CTL_CMD_FLAG_OK_ON_STOPPED |
CTL_CMD_FLAG_OK_ON_INOPERABLE |
CTL_CMD_FLAG_OK_ON_SECONDARY |
CTL_FLAG_DATA_IN,
CTL_FLAG_DATA_IN |
CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
CTL_LUN_PAT_NONE,
16, {0x03, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}},
/* 04 RECEIVE COPY FAILURE DETAILS (LID1) */
{ctl_receive_copy_failure_details, CTL_SERIDX_RD_CAP,
CTL_CMD_FLAG_OK_ON_BOTH |
CTL_FLAG_DATA_IN,
CTL_FLAG_DATA_IN |
CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
CTL_LUN_PAT_NONE,
16, {0x04, 0xff, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}},
@ -470,7 +473,8 @@ const struct ctl_cmd_entry ctl_cmd_table_a3[32] =
CTL_CMD_FLAG_OK_ON_STOPPED |
CTL_CMD_FLAG_OK_ON_INOPERABLE |
CTL_CMD_FLAG_OK_ON_SECONDARY |
CTL_FLAG_DATA_IN,
CTL_FLAG_DATA_IN |
CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
CTL_LUN_PAT_NONE,
12, {0x0c, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}},
@ -479,7 +483,8 @@ const struct ctl_cmd_entry ctl_cmd_table_a3[32] =
CTL_CMD_FLAG_OK_ON_STOPPED |
CTL_CMD_FLAG_OK_ON_INOPERABLE |
CTL_CMD_FLAG_OK_ON_SECONDARY |
CTL_FLAG_DATA_IN,
CTL_FLAG_DATA_IN |
CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
CTL_LUN_PAT_NONE,
12, {0x0d, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}},
@ -1085,7 +1090,7 @@ const struct ctl_cmd_entry ctl_cmd_table[256] =
{ctl_write_same, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN |
CTL_FLAG_DATA_OUT,
CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE,
16, {0x1a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
16, {0x1b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}},
/* 94 */

View File

@ -1811,6 +1811,7 @@ tpc_create_token(struct ctl_lun *lun, struct ctl_port *port, off_t len,
{
static int id = 0;
struct scsi_vpd_id_descriptor *idd = NULL;
struct scsi_ec_cscd_id *cscd;
int targid_len;
scsi_ulto4b(ROD_TYPE_AUR, token->type);
@ -1824,8 +1825,12 @@ tpc_create_token(struct ctl_lun *lun, struct ctl_port *port, off_t len,
idd = scsi_get_devid_desc((struct scsi_vpd_id_descriptor *)
lun->lun_devid->data, lun->lun_devid->len,
scsi_devid_is_lun_eui64);
if (idd != NULL)
memcpy(&token->body[8], idd, 4 + idd->length);
if (idd != NULL) {
cscd = (struct scsi_ec_cscd_id *)&token->body[8];
cscd->type_code = EC_CSCD_ID;
cscd->luidt_pdt = T_DIRECT;
memcpy(&cscd->codeset, idd, 4 + idd->length);
}
scsi_u64to8b(0, &token->body[40]);
scsi_u64to8b(len, &token->body[48]);
if (port->target_devid) {

View File

@ -317,6 +317,7 @@ struct scsi_per_res_cap
#define SPRI_ALLOW_2 0x20
#define SPRI_ALLOW_3 0x30
#define SPRI_ALLOW_4 0x40
#define SPRI_ALLOW_5 0x50
#define SPRI_PTPL_A 0x01
uint8_t type_mask[2];
#define SPRI_TM_WR_EX_AR 0x8000
@ -1030,6 +1031,7 @@ struct scsi_write_same_16
{
uint8_t opcode;
uint8_t byte2;
#define SWS_NDOB 0x01
uint8_t addr[8];
uint8_t length[4];
uint8_t group;
@ -1608,11 +1610,11 @@ struct scsi_token
{
uint8_t type[4];
#define ROD_TYPE_INTERNAL 0x00000000
#define ROD_TYPE_AUR 0x00001000
#define ROD_TYPE_PIT_DEF 0x00080000
#define ROD_TYPE_PIT_VULN 0x00080001
#define ROD_TYPE_PIT_PERS 0x00080002
#define ROD_TYPE_PIT_ANY 0x0008FFFF
#define ROD_TYPE_AUR 0x00010000
#define ROD_TYPE_PIT_DEF 0x00800000
#define ROD_TYPE_PIT_VULN 0x00800001
#define ROD_TYPE_PIT_PERS 0x00800002
#define ROD_TYPE_PIT_ANY 0x0080FFFF
#define ROD_TYPE_BLOCK_ZERO 0xFFFF0001
uint8_t reserved[2];
uint8_t length[2];

View File

@ -0,0 +1,36 @@
/*-
* Copyright 2014 The FreeBSD Project.
* All rights reserved.
*
* This software was developed by Steven Hartland.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/sdt.h>
SDT_PROBE_DEFINE1(sdt, , , set__error, "int");

View File

@ -31,6 +31,15 @@
#include_next <sys/sdt.h>
#define SET_ERROR(err) (err)
#ifdef KDTRACE_HOOKS
SDT_PROBE_DECLARE(sdt, , , set__error);
#define SET_ERROR(err) \
((sdt_sdt___set__error->id ? \
(*sdt_probe_func)(sdt_sdt___set__error->id, \
(uintptr_t)err, 0, 0, 0, 0) : 0), err)
#else
#define SET_ERROR(err) (err)
#endif
#endif /* _OPENSOLARIS_SYS_SDT_H_ */

View File

@ -1503,23 +1503,6 @@ arc_space_return(uint64_t space, arc_space_type_t type)
atomic_add_64(&arc_size, -space);
}
void *
arc_data_buf_alloc(uint64_t size)
{
if (arc_evict_needed(ARC_BUFC_DATA))
cv_signal(&arc_reclaim_thr_cv);
atomic_add_64(&arc_size, size);
return (zio_data_buf_alloc(size));
}
void
arc_data_buf_free(void *buf, uint64_t size)
{
zio_data_buf_free(buf, size);
ASSERT(arc_size >= size);
atomic_add_64(&arc_size, -size);
}
arc_buf_t *
arc_buf_alloc(spa_t *spa, int size, void *tag, arc_buf_contents_t type)
{

View File

@ -301,8 +301,10 @@ bpobj_iterate_impl(bpobj_t *bpo, bpobj_itor_t func, void *arg, dmu_tx_t *tx,
if (free) {
err = bpobj_space(&sublist,
&used_before, &comp_before, &uncomp_before);
if (err)
if (err != 0) {
bpobj_close(&sublist);
break;
}
}
err = bpobj_iterate_impl(&sublist, func, arg, tx, free);
if (free) {

View File

@ -83,16 +83,20 @@
/* Check hostid on import? */
static int check_hostid = 1;
SYSCTL_DECL(_vfs_zfs);
SYSCTL_INT(_vfs_zfs, OID_AUTO, check_hostid, CTLFLAG_RWTUN, &check_hostid, 0,
"Check hostid on import?");
/*
* The interval, in seconds, at which failed configuration cache file writes
* should be retried.
*/
static int zfs_ccw_retry_interval = 300;
SYSCTL_DECL(_vfs_zfs);
SYSCTL_INT(_vfs_zfs, OID_AUTO, check_hostid, CTLFLAG_RWTUN, &check_hostid, 0,
"Check hostid on import?");
TUNABLE_INT("vfs.zfs.ccw_retry_interval", &zfs_ccw_retry_interval);
SYSCTL_INT(_vfs_zfs, OID_AUTO, ccw_retry_interval, CTLFLAG_RW,
&zfs_ccw_retry_interval, 0,
"Configuration cache file write, retry after failure, interval (seconds)");
typedef enum zti_modes {
ZTI_MODE_FIXED, /* value is # of threads (min 1) */
ZTI_MODE_BATCH, /* cpu-intensive; value is ignored */

View File

@ -243,9 +243,6 @@ int zfs_flags = ~(ZFS_DEBUG_DPRINTF | ZFS_DEBUG_SPA);
#else
int zfs_flags = 0;
#endif
SYSCTL_DECL(_debug);
SYSCTL_INT(_debug, OID_AUTO, zfs_flags, CTLFLAG_RWTUN, &zfs_flags, 0,
"ZFS debug flags.");
/*
* zfs_recover can be set to nonzero to attempt to recover from
@ -259,6 +256,32 @@ SYSCTL_DECL(_vfs_zfs);
SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RDTUN, &zfs_recover, 0,
"Try to recover from otherwise-fatal errors.");
static int
sysctl_vfs_zfs_debug_flags(SYSCTL_HANDLER_ARGS)
{
int err, val;
val = zfs_flags;
err = sysctl_handle_int(oidp, &val, 0, req);
if (err != 0 || req->newptr == NULL)
return (err);
/*
* ZFS_DEBUG_MODIFY must be enabled prior to boot so all
* arc buffers in the system have the necessary additional
* checksum data. However, it is safe to disable at any
* time.
*/
if (!(zfs_flags & ZFS_DEBUG_MODIFY))
val &= ~ZFS_DEBUG_MODIFY;
zfs_flags = val;
return (0);
}
SYSCTL_PROC(_vfs_zfs, OID_AUTO, debug_flags,
CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RWTUN, 0, sizeof(int),
sysctl_vfs_zfs_debug_flags, "IU", "Debug flags for ZFS testing.");
/*
* If destroy encounters an EIO while reading metadata (e.g. indirect
* blocks), space referenced by the missing metadata can not be freed.

View File

@ -83,8 +83,6 @@ typedef enum arc_space_type {
void arc_space_consume(uint64_t space, arc_space_type_t type);
void arc_space_return(uint64_t space, arc_space_type_t type);
void *arc_data_buf_alloc(uint64_t space);
void arc_data_buf_free(void *buf, uint64_t space);
arc_buf_t *arc_buf_alloc(spa_t *spa, int size, void *tag,
arc_buf_contents_t type);
arc_buf_t *arc_loan_buf(spa_t *spa, int size);

View File

@ -52,9 +52,103 @@
/* Offset to LR Save word (ppc64). CR Save area sits between back chain and LR */
#define RETURN_OFFSET64 16
#ifdef __powerpc64__
#define OFFSET 4 /* Account for the TOC reload slot */
#else
#define OFFSET 0
#endif
#define INKERNEL(x) ((x) <= VM_MAX_KERNEL_ADDRESS && \
(x) >= VM_MIN_KERNEL_ADDRESS)
static __inline int
dtrace_sp_inkernel(uintptr_t sp, int aframes)
{
vm_offset_t callpc;
#ifdef __powerpc64__
callpc = *(vm_offset_t *)(sp + RETURN_OFFSET64);
#else
callpc = *(vm_offset_t *)(sp + RETURN_OFFSET);
#endif
if ((callpc & 3) || (callpc < 0x100))
return (0);
/*
* trapexit() and asttrapexit() are sentinels
* for kernel stack tracing.
*
* Special-case this for 'aframes == 0', because fbt sets aframes to the
* trap callchain depth, so we want to break out of it.
*/
if ((callpc + OFFSET == (vm_offset_t) &trapexit ||
callpc + OFFSET == (vm_offset_t) &asttrapexit) &&
aframes != 0)
return (0);
return (1);
}
static __inline uintptr_t
dtrace_next_sp(uintptr_t sp)
{
vm_offset_t callpc;
#ifdef __powerpc64__
callpc = *(vm_offset_t *)(sp + RETURN_OFFSET64);
#else
callpc = *(vm_offset_t *)(sp + RETURN_OFFSET);
#endif
/*
* trapexit() and asttrapexit() are sentinels
* for kernel stack tracing.
*
* Special-case this for 'aframes == 0', because fbt sets aframes to the
* trap callchain depth, so we want to break out of it.
*/
if ((callpc + OFFSET == (vm_offset_t) &trapexit ||
callpc + OFFSET == (vm_offset_t) &asttrapexit))
/* Access the trap frame */
#ifdef __powerpc64__
return (*(uintptr_t *)sp + 48 + sizeof(register_t));
#else
return (*(uintptr_t *)sp + 8 + sizeof(register_t));
#endif
return (*(uintptr_t*)sp);
}
static __inline uintptr_t
dtrace_get_pc(uintptr_t sp)
{
vm_offset_t callpc;
#ifdef __powerpc64__
callpc = *(vm_offset_t *)(sp + RETURN_OFFSET64);
#else
callpc = *(vm_offset_t *)(sp + RETURN_OFFSET);
#endif
/*
* trapexit() and asttrapexit() are sentinels
* for kernel stack tracing.
*
* Special-case this for 'aframes == 0', because fbt sets aframes to the
* trap callchain depth, so we want to break out of it.
*/
if ((callpc + OFFSET == (vm_offset_t) &trapexit ||
callpc + OFFSET == (vm_offset_t) &asttrapexit))
/* Access the trap frame */
#ifdef __powerpc64__
return (*(uintptr_t *)sp + 48 + offsetof(struct trapframe, lr));
#else
return (*(uintptr_t *)sp + 8 + offsetof(struct trapframe, lr));
#endif
return (callpc);
}
greg_t
dtrace_getfp(void)
{
@ -66,10 +160,11 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
uint32_t *intrpc)
{
int depth = 0;
register_t sp;
uintptr_t osp, sp;
vm_offset_t callpc;
pc_t caller = (pc_t) solaris_cpu[curcpu].cpu_dtrace_caller;
osp = PAGE_SIZE;
if (intrpc != 0)
pcstack[depth++] = (pc_t) intrpc;
@ -78,17 +173,12 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
sp = dtrace_getfp();
while (depth < pcstack_limit) {
if (!INKERNEL((long) sp))
if (sp <= osp)
break;
#ifdef __powerpc64__
callpc = *(uintptr_t *)(sp + RETURN_OFFSET64);
#else
callpc = *(uintptr_t *)(sp + RETURN_OFFSET);
#endif
if (!INKERNEL(callpc))
if (!dtrace_sp_inkernel(sp, aframes))
break;
callpc = dtrace_get_pc(sp);
if (aframes > 0) {
aframes--;
@ -100,7 +190,8 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
pcstack[depth++] = callpc;
}
sp = *(uintptr_t*)sp;
osp = sp;
sp = dtrace_next_sp(sp);
}
for (; depth < pcstack_limit; depth++) {
@ -368,8 +459,11 @@ dtrace_getarg(int arg, int aframes)
* On ppc32 AIM, and booke, trapexit() is the immediately following
* label. On ppc64 AIM trapexit() follows a nop.
*/
if (((long)(fp[1]) == (long)trapexit) ||
(((long)(fp[1]) + 4 == (long)trapexit))) {
#ifdef __powerpc64__
if ((long)(fp[2]) + 4 == (long)trapexit) {
#else
if ((long)(fp[1]) == (long)trapexit) {
#endif
/*
* In the case of powerpc, we will use the pointer to the regs
* structure that was pushed when we took the trap. To get this
@ -433,23 +527,31 @@ int
dtrace_getstackdepth(int aframes)
{
int depth = 0;
register_t sp;
uintptr_t osp, sp;
vm_offset_t callpc;
osp = PAGE_SIZE;
aframes++;
sp = dtrace_getfp();
depth++;
for(;;) {
if (!INKERNEL((long) sp))
if (sp <= osp)
break;
if (!INKERNEL((long) *(void **)sp))
if (!dtrace_sp_inkernel(sp, aframes))
break;
depth++;
if (aframes == 0)
depth++;
else
aframes--;
osp = sp;
sp = *(uintptr_t *)sp;
}
if (depth < aframes)
return 0;
else
return depth - aframes;
return (0);
return (depth);
}
ulong_t

View File

@ -147,7 +147,7 @@ fbt_provide_module_function(linker_file_t lf, int symindx,
fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO);
fbt->fbtp_name = name;
fbt->fbtp_id = dtrace_probe_create(fbt_id, modname,
name, FBT_ENTRY, 3, fbt);
name, FBT_ENTRY, 7, fbt);
fbt->fbtp_patchpoint = instr;
fbt->fbtp_ctl = lf;
fbt->fbtp_loadcnt = lf->loadcnt;
@ -210,7 +210,7 @@ fbt_provide_module_function(linker_file_t lf, int symindx,
if (retfbt == NULL) {
fbt->fbtp_id = dtrace_probe_create(fbt_id, modname,
name, FBT_RETURN, 5, fbt);
name, FBT_RETURN, 7, fbt);
} else {
retfbt->fbtp_next = fbt;
fbt->fbtp_id = retfbt->fbtp_id;

View File

@ -1139,26 +1139,26 @@ linprocfs_donetdev(PFS_FILL_ARGS)
linux_ifname(ifp, ifname, sizeof ifname);
sbuf_printf(sb, "%6.6s: ", ifname);
sbuf_printf(sb, "%7ju %7ju %4ju %4ju %4lu %5lu %10lu %9ju ",
(uintmax_t )ifp->if_ibytes, /* rx_bytes */
(uintmax_t )ifp->if_ipackets, /* rx_packets */
(uintmax_t )ifp->if_ierrors, /* rx_errors */
(uintmax_t )ifp->if_iqdrops, /* rx_dropped +
* rx_missed_errors */
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_IBYTES),
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_IPACKETS),
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_IERRORS),
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_IQDROPS),
/* rx_missed_errors */
0UL, /* rx_fifo_errors */
0UL, /* rx_length_errors +
* rx_over_errors +
* rx_crc_errors +
* rx_frame_errors */
0UL, /* rx_compressed */
(uintmax_t )ifp->if_imcasts); /* multicast,
* XXX-BZ rx only? */
sbuf_printf(sb, "%8ju %7ju %4ju %4lu %4lu %5ju %7lu %10lu\n",
(uintmax_t )ifp->if_obytes, /* tx_bytes */
(uintmax_t )ifp->if_opackets, /* tx_packets */
(uintmax_t )ifp->if_oerrors, /* tx_errors */
0UL, /* tx_dropped */
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_IMCASTS));
/* XXX-BZ rx only? */
sbuf_printf(sb, "%8ju %7ju %4ju %4ju %4lu %5ju %7lu %10lu\n",
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_OBYTES),
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_OPACKETS),
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_OERRORS),
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_OQDROPS),
0UL, /* tx_fifo_errors */
(uintmax_t )ifp->if_collisions, /* collisions */
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_COLLISIONS),
0UL, /* tx_carrier_errors +
* tx_aborted_errors +
* tx_window_errors +

View File

@ -0,0 +1,182 @@
/*-
* Copyright (c) 2014 Bjoern A. Zeeb
* All rights reserved.
*
* This software was developed by SRI International and the University of
* Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-11-C-0249
* ("MRC2"), as part of the DARPA MRC research programme.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "opt_compat.h"
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/signal.h>
#include <sys/syscallsubr.h>
#include <sys/systm.h>
#include <sys/time.h>
#include <sys/types.h>
#ifdef COMPAT_LINUX32
#include <machine/../linux32/linux.h>
#include <machine/../linux32/linux32_proto.h>
#else
#include <machine/../linux/linux.h>
#include <machine/../linux/linux_proto.h>
#endif
#include <compat/linux/linux_timer.h>
static int
linux_convert_l_clockid(clockid_t *clock_id)
{
switch (*clock_id) {
case LINUX_CLOCK_REALTIME:
*clock_id = CLOCK_REALTIME;
break;
case LINUX_CLOCK_MONOTONIC:
*clock_id = CLOCK_MONOTONIC;
break;
default:
return (EINVAL);
}
return (0);
}
static int
linux_convert_l_sigevent(struct l_sigevent *l_sig, struct sigevent *sig)
{
CP(*l_sig, *sig, sigev_notify);
switch (l_sig->sigev_notify) {
case L_SIGEV_SIGNAL:
sig->sigev_notify = SIGEV_SIGNAL;
CP(*l_sig, *sig, sigev_signo);
PTRIN_CP(*l_sig, *sig, sigev_value.sival_ptr);
break;
case L_SIGEV_NONE:
sig->sigev_notify = SIGEV_NONE;
break;
case L_SIGEV_THREAD:
#if 0
/* Seems to not be used anywhere (anymore)? */
sig->sigev_notify = SIGEV_THREAD;
return (ENOSYS);
#else
return (EINVAL);
#endif
case L_SIGEV_THREAD_ID:
sig->sigev_notify = SIGEV_THREAD_ID;
CP2(*l_sig, *sig, _l_sigev_un._tid, sigev_notify_thread_id);
CP(*l_sig, *sig, sigev_signo);
PTRIN_CP(*l_sig, *sig, sigev_value.sival_ptr);
break;
default:
return (EINVAL);
}
return (0);
}
int
linux_timer_create(struct thread *td, struct linux_timer_create_args *uap)
{
struct l_sigevent l_ev;
struct sigevent ev, *evp;
int error, id;
if (uap->evp == NULL) {
evp = NULL;
} else {
error = copyin(uap->evp, &l_ev, sizeof(l_ev));
if (error != 0)
return (error);
error = linux_convert_l_sigevent(&l_ev, &ev);
if (error != 0)
return (error);
evp = &ev;
}
error = linux_convert_l_clockid(&uap->clock_id);
if (error != 0)
return (error);
error = kern_ktimer_create(td, uap->clock_id, evp, &id, -1);
if (error == 0) {
error = copyout(&id, uap->timerid, sizeof(int));
if (error != 0)
kern_ktimer_delete(td, id);
}
return (error);
}
int
linux_timer_settime(struct thread *td, struct linux_timer_settime_args *uap)
{
struct l_itimerspec l_val, l_oval;
struct itimerspec val, oval, *ovalp;
int error;
error = copyin(uap->new, &l_val, sizeof(l_val));
if (error != 0)
return (error);
ITS_CP(l_val, val);
ovalp = uap->old != NULL ? &oval : NULL;
error = kern_ktimer_settime(td, uap->timerid, uap->flags, &val, ovalp);
if (error == 0 && uap->old != NULL) {
ITS_CP(oval, l_oval);
error = copyout(&l_oval, uap->old, sizeof(l_oval));
}
return (error);
}
int
linux_timer_gettime(struct thread *td, struct linux_timer_gettime_args *uap)
{
struct l_itimerspec l_val;
struct itimerspec val;
int error;
error = kern_ktimer_gettime(td, uap->timerid, &val);
if (error == 0) {
ITS_CP(val, l_val);
error = copyout(&l_val, uap->setting, sizeof(l_val));
}
return (error);
}
int
linux_timer_getoverrun(struct thread *td, struct linux_timer_getoverrun_args *uap)
{
return (kern_ktimer_getoverrun(td, uap->timerid));
}
int
linux_timer_delete(struct thread *td, struct linux_timer_delete_args *uap)
{
return (kern_ktimer_delete(td, uap->timerid));
}

View File

@ -0,0 +1,97 @@
/*-
* Copyright (c) 2014 Bjoern A. Zeeb
* All rights reserved.
*
* This software was developed by SRI International and the University of
* Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-11-C-0249
* ("MRC2"), as part of the DARPA MRC research programme.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (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$
*/
#ifndef _LINUX_TIMER_H
#define _LINUX_TIMER_H
#ifndef __LINUX_ARCH_SIGEV_PREAMBLE_SIZE
#define __LINUX_ARCH_SIGEV_PREAMBLE_SIZE \
(sizeof(l_int) * 2 + sizeof(l_sigval_t))
#endif
#define LINUX_SIGEV_MAX_SIZE 64
#define LINUX_SIGEV_PAD_SIZE \
((LINUX_SIGEV_MAX_SIZE - __LINUX_ARCH_SIGEV_PREAMBLE_SIZE) / \
sizeof(l_int))
#define LINUX_CLOCK_REALTIME 0
#define LINUX_CLOCK_MONOTONIC 1
#define LINUX_CLOCK_PROCESS_CPUTIME_ID 2
#define LINUX_CLOCK_THREAD_CPUTIME_ID 3
#define LINUX_CLOCK_MONOTONIC_RAW 4
#define LINUX_CLOCK_REALTIME_COARSE 5
#define LINUX_CLOCK_MONOTONIC_COARSE 6
#define LINUX_CLOCK_BOOTTIME 7
#define LINUX_CLOCK_REALTIME_ALARM 8
#define LINUX_CLOCK_BOOTTIME_ALARM 9
#define LINUX_CLOCK_SGI_CYCLE 10
#define LINUX_CLOCK_TAI 11
#define L_SIGEV_SIGNAL 0
#define L_SIGEV_NONE 1
#define L_SIGEV_THREAD 2
#define L_SIGEV_THREAD_ID 4
#define TS_CP(src,dst,fld) do { \
CP((src).fld,(dst).fld,tv_sec); \
CP((src).fld,(dst).fld,tv_nsec); \
} while (0)
#define ITS_CP(src, dst) do { \
TS_CP((src), (dst), it_interval); \
TS_CP((src), (dst), it_value); \
} while (0)
struct l_sigevent {
l_sigval_t sigev_value;
l_int sigev_signo;
l_int sigev_notify;
union {
l_int _pad[LINUX_SIGEV_PAD_SIZE];
l_int _tid;
struct {
l_uintptr_t _function;
l_uintptr_t _attribute;
} _l_sigev_thread;
} _l_sigev_un;
}
#if defined(__amd64__) && defined(COMPAT_LINUX32)
__packed
#endif
;
struct l_itimerspec {
struct l_timespec it_interval;
struct l_timespec it_value;
};
#endif /* _LINUX_TIMER_H */

View File

@ -111,6 +111,7 @@ cddl/compat/opensolaris/kern/opensolaris_misc.c optional zfs compile-with "${
cddl/compat/opensolaris/kern/opensolaris_sunddi.c optional zfs compile-with "${ZFS_C}"
# zfs specific
cddl/compat/opensolaris/kern/opensolaris_acl.c optional zfs compile-with "${ZFS_C}"
cddl/compat/opensolaris/kern/opensolaris_dtrace.c optional zfs compile-with "${ZFS_C}"
cddl/compat/opensolaris/kern/opensolaris_kobj.c optional zfs compile-with "${ZFS_C}"
cddl/compat/opensolaris/kern/opensolaris_kstat.c optional zfs compile-with "${ZFS_C}"
cddl/compat/opensolaris/kern/opensolaris_lookup.c optional zfs compile-with "${ZFS_C}"
@ -2151,6 +2152,7 @@ dev/random/hash.c optional random
dev/random/rwfile.c optional random
dev/rc/rc.c optional rc
dev/re/if_re.c optional re
dev/rl/if_rl.c optional rl pci
dev/rndtest/rndtest.c optional rndtest
dev/rp/rp.c optional rp
dev/rp/rp_isa.c optional rp isa
@ -3865,7 +3867,6 @@ opencrypto/xform.c optional crypto
pci/alpm.c optional alpm pci
pci/amdpm.c optional amdpm pci | nfpm pci
pci/amdsmb.c optional amdsmb pci
pci/if_rl.c optional rl pci
pci/intpm.c optional intpm pci
pci/ncr.c optional ncr pci \
compile-with "${NORMAL_C} -Wno-unused"

View File

@ -477,6 +477,7 @@ compat/linux/linux_socket.c optional compat_linux32
compat/linux/linux_stats.c optional compat_linux32
compat/linux/linux_sysctl.c optional compat_linux32
compat/linux/linux_time.c optional compat_linux32
compat/linux/linux_timer.c optional compat_linux32
compat/linux/linux_uid16.c optional compat_linux32
compat/linux/linux_util.c optional compat_linux32
dev/amr/amr_linux.c optional compat_linux32 amr

View File

@ -83,6 +83,7 @@ compat/linux/linux_socket.c optional compat_linux
compat/linux/linux_stats.c optional compat_linux
compat/linux/linux_sysctl.c optional compat_linux
compat/linux/linux_time.c optional compat_linux
compat/linux/linux_timer.c optional compat_linux
compat/linux/linux_uid16.c optional compat_linux
compat/linux/linux_util.c optional compat_linux
compat/ndis/kern_ndis.c optional ndisapi pci

View File

@ -55,6 +55,7 @@ compat/linux/linux_socket.c optional compat_linux
compat/linux/linux_stats.c optional compat_linux
compat/linux/linux_sysctl.c optional compat_linux
compat/linux/linux_time.c optional compat_linux
compat/linux/linux_timer.c optional compat_linux
compat/linux/linux_uid16.c optional compat_linux
compat/linux/linux_util.c optional compat_linux
compat/svr4/imgact_svr4.c optional compat_svr4

View File

@ -50,7 +50,6 @@ struct ifaltq {
struct mbuf *ifq_tail;
int ifq_len;
int ifq_maxlen;
int ifq_drops;
#ifdef __FreeBSD__
struct mtx ifq_mtx;
#endif

View File

@ -70,9 +70,6 @@ void
ar9300_attach_freebsd_ops(struct ath_hal *ah)
{
/* stub everything first */
ar9300_set_stub_functions(ah);
/* Global functions */
ah->ah_detach = ar9300_detach;
ah->ah_getRateTable = ar9300_get_rate_table;
@ -471,11 +468,13 @@ ar9300_freebsd_setup_x_tx_desc(struct ath_hal *ah, struct ath_desc *ds,
u_int txRate3, u_int txTries3)
{
#if 0
ath_hal_printf(ah, "%s: called, 0x%x/%d, 0x%x/%d, 0x%x/%d\n",
__func__,
txRate1, txTries1,
txRate2, txTries2,
txRate3, txTries3);
#endif
/* XXX should only be called during probe */
return (AH_TRUE);

View File

@ -33,7 +33,7 @@ void
ar9300_set_stub_functions(struct ath_hal *ah)
{
ath_hal_printf(ah, "%s: setting stub functions\n", __func__);
// ath_hal_printf(ah, "%s: setting stub functions\n", __func__);
ah->ah_getRateTable = ar9300_Stub_GetRateTable;
// ah->ah_detach = ar9300_Stub_detach;

View File

@ -1211,11 +1211,6 @@ acpi_set_resource(device_t dev, device_t child, int type, int rid,
if (!(type == SYS_RES_IOPORT && start == CONF1_ADDR_PORT))
#endif
{
if (bootverbose)
device_printf(dev,
"Ignoring %s range %#lx-%#lx for %s\n",
type == SYS_RES_MEMORY ? "memory" : "I/O",
start, start + count - 1, acpi_name(ad->ad_handle));
AcpiOsFree(devinfo);
return (0);
}

View File

@ -1852,9 +1852,9 @@ ae_tx_intr(ae_softc_t *sc)
sizeof(ae_txs_t) + 3) & ~3) % AE_TXD_BUFSIZE_DEFAULT;
if ((flags & AE_TXS_SUCCESS) != 0)
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
else
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
sc->tx_inproc--;
}
@ -1897,13 +1897,13 @@ ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd)
size = le16toh(rxd->len) - ETHER_CRC_LEN;
if (size < (ETHER_MIN_LEN - ETHER_CRC_LEN - ETHER_VLAN_ENCAP_LEN)) {
if_printf(ifp, "Runt frame received.");
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
m = m_devget(&rxd->data[0], size, ETHER_ALIGN, ifp, NULL);
if (m == NULL) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
return;
}
@ -1913,7 +1913,7 @@ ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd)
m->m_flags |= M_VLANTAG;
}
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
/*
* Pass it through.
*/
@ -1959,7 +1959,7 @@ ae_rx_intr(ae_softc_t *sc)
if ((flags & AE_RXD_SUCCESS) != 0)
ae_rxeof(sc, rxd);
else
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
if (count > 0) {
@ -1989,7 +1989,7 @@ ae_watchdog(ae_softc_t *sc)
else
if_printf(ifp, "watchdog timeout - resetting.\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
ae_init_locked(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))

View File

@ -1792,7 +1792,7 @@ age_watchdog(struct age_softc *sc)
ifp = sc->age_ifp;
if ((sc->age_flags & AGE_FLAG_LINK) == 0) {
if_printf(sc->age_ifp, "watchdog timeout (missed link)\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
age_init_locked(sc);
return;
@ -1805,7 +1805,7 @@ age_watchdog(struct age_softc *sc)
return;
}
if_printf(sc->age_ifp, "watchdog timeout\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
age_init_locked(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
@ -2087,22 +2087,22 @@ age_stats_update(struct age_softc *sc)
stat->tx_mcast_bytes += smb->tx_mcast_bytes;
/* Update counters in ifnet. */
ifp->if_opackets += smb->tx_frames;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, smb->tx_frames);
ifp->if_collisions += smb->tx_single_colls +
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, smb->tx_single_colls +
smb->tx_multi_colls + smb->tx_late_colls +
smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT;
smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT);
ifp->if_oerrors += smb->tx_excess_colls +
if_inc_counter(ifp, IFCOUNTER_OERRORS, smb->tx_excess_colls +
smb->tx_late_colls + smb->tx_underrun +
smb->tx_pkts_truncated;
smb->tx_pkts_truncated);
ifp->if_ipackets += smb->rx_frames;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, smb->rx_frames);
ifp->if_ierrors += smb->rx_crcerrs + smb->rx_lenerrs +
smb->rx_runts + smb->rx_pkts_truncated +
if_inc_counter(ifp, IFCOUNTER_IERRORS, smb->rx_crcerrs +
smb->rx_lenerrs + smb->rx_runts + smb->rx_pkts_truncated +
smb->rx_fifo_oflows + smb->rx_desc_oflows +
smb->rx_alignerrs;
smb->rx_alignerrs);
/* Update done, clear. */
smb->updated = 0;
@ -2291,7 +2291,7 @@ age_fixup_rx(struct ifnet *ifp, struct mbuf *m)
*/
MGETHDR(n, M_NOWAIT, MT_DATA);
if (n == NULL) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
m_freem(m);
return (NULL);
}
@ -2347,7 +2347,7 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
mp = rxd->rx_m;
/* Add a new receive buffer to the ring. */
if (age_newbuf(sc, rxd) != 0) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
/* Reuse Rx buffers. */
if (sc->age_cdata.age_rxhead != NULL)
m_freem(sc->age_cdata.age_rxhead);

View File

@ -2323,13 +2323,13 @@ alc_watchdog(struct alc_softc *sc)
ifp = sc->alc_ifp;
if ((sc->alc_flags & ALC_FLAG_LINK) == 0) {
if_printf(sc->alc_ifp, "watchdog timeout (lost link)\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
alc_init_locked(sc);
return;
}
if_printf(sc->alc_ifp, "watchdog timeout -- resetting\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
alc_init_locked(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
@ -2608,11 +2608,11 @@ alc_stats_update(struct alc_softc *sc)
stat->tx_mcast_bytes += smb->tx_mcast_bytes;
/* Update counters in ifnet. */
ifp->if_opackets += smb->tx_frames;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, smb->tx_frames);
ifp->if_collisions += smb->tx_single_colls +
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, smb->tx_single_colls +
smb->tx_multi_colls * 2 + smb->tx_late_colls +
smb->tx_abort * HDPX_CFG_RETRY_DEFAULT;
smb->tx_abort * HDPX_CFG_RETRY_DEFAULT);
/*
* XXX
@ -2621,15 +2621,16 @@ alc_stats_update(struct alc_softc *sc)
* the counter name is not correct one so I've removed the
* counter in output errors.
*/
ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls +
smb->tx_underrun;
if_inc_counter(ifp, IFCOUNTER_OERRORS,
smb->tx_abort + smb->tx_late_colls + smb->tx_underrun);
ifp->if_ipackets += smb->rx_frames;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, smb->rx_frames);
ifp->if_ierrors += smb->rx_crcerrs + smb->rx_lenerrs +
if_inc_counter(ifp, IFCOUNTER_IERRORS,
smb->rx_crcerrs + smb->rx_lenerrs +
smb->rx_runts + smb->rx_pkts_truncated +
smb->rx_fifo_oflows + smb->rx_rrs_errs +
smb->rx_alignerrs;
smb->rx_alignerrs);
if ((sc->alc_flags & ALC_FLAG_SMB_BUG) == 0) {
/* Update done, clear. */
@ -2921,7 +2922,7 @@ alc_fixup_rx(struct ifnet *ifp, struct mbuf *m)
*/
MGETHDR(n, M_NOWAIT, MT_DATA);
if (n == NULL) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
m_freem(m);
return (NULL);
}
@ -2977,7 +2978,7 @@ alc_rxeof(struct alc_softc *sc, struct rx_rdesc *rrd)
mp = rxd->rx_m;
/* Add a new receive buffer to the ring. */
if (alc_newbuf(sc, rxd) != 0) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
/* Reuse Rx buffers. */
if (sc->alc_cdata.alc_rxhead != NULL)
m_freem(sc->alc_cdata.alc_rxhead);

View File

@ -1953,13 +1953,13 @@ ale_watchdog(struct ale_softc *sc)
ifp = sc->ale_ifp;
if ((sc->ale_flags & ALE_FLAG_LINK) == 0) {
if_printf(sc->ale_ifp, "watchdog timeout (lost link)\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
ale_init_locked(sc);
return;
}
if_printf(sc->ale_ifp, "watchdog timeout -- resetting\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
ale_init_locked(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
@ -2206,11 +2206,11 @@ ale_stats_update(struct ale_softc *sc)
stat->tx_mcast_bytes += smb->tx_mcast_bytes;
/* Update counters in ifnet. */
ifp->if_opackets += smb->tx_frames;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, smb->tx_frames);
ifp->if_collisions += smb->tx_single_colls +
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, smb->tx_single_colls +
smb->tx_multi_colls * 2 + smb->tx_late_colls +
smb->tx_abort * HDPX_CFG_RETRY_DEFAULT;
smb->tx_abort * HDPX_CFG_RETRY_DEFAULT);
/*
* XXX
@ -2219,15 +2219,16 @@ ale_stats_update(struct ale_softc *sc)
* the counter name is not correct one so I've removed the
* counter in output errors.
*/
ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls +
smb->tx_underrun;
if_inc_counter(ifp, IFCOUNTER_OERRORS,
smb->tx_abort + smb->tx_late_colls + smb->tx_underrun);
ifp->if_ipackets += smb->rx_frames;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, smb->rx_frames);
ifp->if_ierrors += smb->rx_crcerrs + smb->rx_lenerrs +
if_inc_counter(ifp, IFCOUNTER_IERRORS,
smb->rx_crcerrs + smb->rx_lenerrs +
smb->rx_runts + smb->rx_pkts_truncated +
smb->rx_fifo_oflows + smb->rx_rrs_errs +
smb->rx_alignerrs;
smb->rx_alignerrs);
}
static int
@ -2549,7 +2550,7 @@ ale_rxeof(struct ale_softc *sc, int count)
m = m_devget((char *)(rs + 1), length - ETHER_CRC_LEN,
ETHER_ALIGN, ifp, NULL);
if (m == NULL) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
ale_rx_update_page(sc, &rx_page, length, &prod);
continue;
}

View File

@ -1159,7 +1159,7 @@ atse_watchdog(struct atse_softc *sc)
return;
device_printf(sc->atse_dev, "watchdog timeout\n");
sc->atse_ifp->if_oerrors++;
if_inc_counter(sc->atse_ifp, IFCOUNTER_OERRORS, 1);
atse_intr_debug(sc, "poll");
@ -1263,7 +1263,7 @@ atse_rx_locked(struct atse_softc *sc)
atse_update_rx_err(sc, ((meta &
A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK) >>
A_ONCHIP_FIFO_MEM_CORE_ERROR_SHIFT) & 0xff);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
sc->atse_rx_buf_len = 0;
/*
* Should still read till EOP or next SOP.
@ -1292,7 +1292,7 @@ atse_rx_locked(struct atse_softc *sc)
"without empty buffer: %u\n",
__func__, sc->atse_rx_buf_len);
/* XXX-BZ any better counter? */
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
if ((sc->atse_flags & ATSE_FLAGS_SOP_SEEN) == 0)
@ -1311,7 +1311,7 @@ atse_rx_locked(struct atse_softc *sc)
* XXX-BZ Error. We need more mbufs and are
* not setup for this yet.
*/
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
sc->atse_flags |= ATSE_FLAGS_ERROR;
}
if ((sc->atse_flags & ATSE_FLAGS_ERROR) == 0)
@ -1330,7 +1330,7 @@ atse_rx_locked(struct atse_softc *sc)
A_ONCHIP_FIFO_MEM_CORE_EMPTY_SHIFT;
sc->atse_rx_buf_len += (4 - empty);
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
rx_npkts++;
m = sc->atse_rx_m;
@ -1414,7 +1414,7 @@ atse_rx_intr(void *arg)
atse_update_rx_err(sc, ((rxe &
A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK) >>
A_ONCHIP_FIFO_MEM_CORE_ERROR_SHIFT) & 0xff);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
/*
@ -1469,7 +1469,7 @@ atse_tx_intr(void *arg)
if (txe & (A_ONCHIP_FIFO_MEM_CORE_EVENT_OVERFLOW|
A_ONCHIP_FIFO_MEM_CORE_EVENT_UNDERFLOW)) {
/* XXX-BZ ERROR HANDLING. */
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
}
/*
@ -1527,12 +1527,12 @@ atse_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
atse_update_rx_err(sc, ((rx &
A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK) >>
A_ONCHIP_FIFO_MEM_CORE_ERROR_SHIFT) & 0xff);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
if (tx & (A_ONCHIP_FIFO_MEM_CORE_EVENT_OVERFLOW|
A_ONCHIP_FIFO_MEM_CORE_EVENT_UNDERFLOW)) {
/* XXX-BZ ERROR HANDLING. */
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
}
if (ATSE_TX_READ_FILL_LEVEL(sc) == 0)
sc->atse_watchdog_timer = 0;

View File

@ -872,7 +872,7 @@ an_rxeof(struct an_softc *sc)
/* read header */
if (an_read_data(sc, id, 0x0, (caddr_t)&rx_frame,
sizeof(rx_frame))) {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
@ -895,7 +895,7 @@ an_rxeof(struct an_softc *sc)
if_printf(ifp, "oversized packet "
"received (%d, %d)\n",
len, MCLBYTES);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
@ -921,7 +921,7 @@ an_rxeof(struct an_softc *sc)
if_printf(ifp, "oversized packet "
"received (%d, %d)\n",
len, MCLBYTES);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
@ -940,13 +940,13 @@ an_rxeof(struct an_softc *sc)
} else {
MGETHDR(m, M_NOWAIT, MT_DATA);
if (m == NULL) {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
MCLGET(m, M_NOWAIT);
if (!(m->m_flags & M_EXT)) {
m_freem(m);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
m->m_pkthdr.rcvif = ifp;
@ -957,7 +957,7 @@ an_rxeof(struct an_softc *sc)
if (an_read_data(sc, id, 0, (caddr_t)&rx_frame,
sizeof(rx_frame))) {
m_freem(m);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
#endif
@ -966,12 +966,12 @@ an_rxeof(struct an_softc *sc)
(caddr_t)&rx_frame_802_3,
sizeof(rx_frame_802_3))) {
m_freem(m);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
if (rx_frame_802_3.an_rx_802_3_status != 0) {
m_freem(m);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
/* Check for insane frame length */
@ -981,7 +981,7 @@ an_rxeof(struct an_softc *sc)
if_printf(ifp, "oversized packet "
"received (%d, %d)\n",
len, MCLBYTES);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
m->m_pkthdr.len = m->m_len =
@ -1001,10 +1001,10 @@ an_rxeof(struct an_softc *sc)
if (error) {
m_freem(m);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
/* Receive packet. */
#ifdef ANCACHE
@ -1031,13 +1031,13 @@ an_rxeof(struct an_softc *sc)
MGETHDR(m, M_NOWAIT, MT_DATA);
if (m == NULL) {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
MCLGET(m, M_NOWAIT);
if (!(m->m_flags & M_EXT)) {
m_freem(m);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
m->m_pkthdr.rcvif = ifp;
@ -1061,7 +1061,7 @@ an_rxeof(struct an_softc *sc)
if_printf(ifp, "oversized packet "
"received (%d, %d)\n",
len, MCLBYTES);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
@ -1073,7 +1073,7 @@ an_rxeof(struct an_softc *sc)
bcopy(buf, (char *)eh,
m->m_pkthdr.len);
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
/* Receive packet. */
#if 0
@ -1126,9 +1126,9 @@ an_txeof(struct an_softc *sc, int status)
id = CSR_READ_2(sc, AN_TX_CMP_FID(sc->mpi350));
if (status & AN_EV_TX_EXC) {
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
} else
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
for (i = 0; i < AN_TX_RING_CNT; i++) {
if (id == sc->an_rdata.an_tx_ring[i]) {
@ -1142,9 +1142,9 @@ an_txeof(struct an_softc *sc, int status)
id = CSR_READ_2(sc, AN_TX_CMP_FID(sc->mpi350));
if (!sc->an_rdata.an_tx_empty){
if (status & AN_EV_TX_EXC) {
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
} else
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
AN_INC(sc->an_rdata.an_tx_cons, AN_MAX_TX_DESC);
if (sc->an_rdata.an_tx_prod ==
sc->an_rdata.an_tx_cons)
@ -2962,7 +2962,7 @@ an_watchdog(struct an_softc *sc)
an_init_mpi350_desc(sc);
an_init_locked(sc);
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
}
int

View File

@ -1715,12 +1715,22 @@ ath_suspend(struct ath_softc *sc)
* NB: don't worry about putting the chip in low power
* mode; pci will power off our socket on suspend and
* CardBus detaches the device.
*
* XXX TODO: well, that's great, except for non-cardbus
* devices!
*/
/*
* XXX ensure none of the taskqueues are running
* XXX This doesn't wait until all pending taskqueue
* items and parallel transmit/receive/other threads
* are running!
*/
ath_hal_intrset(sc->sc_ah, 0);
taskqueue_block(sc->sc_tq);
callout_drain(&sc->sc_cal_ch);
/*
* XXX ensure sc_invalid is 1
* XXX ensure the calibration callout is disabled
*/
/* Disable the PCIe PHY, complete with workarounds */
@ -1811,6 +1821,11 @@ ath_resume(struct ath_softc *sc)
AH_FALSE, &status);
ath_reset_keycache(sc);
ATH_RX_LOCK(sc);
sc->sc_rx_stopped = 1;
sc->sc_rx_resetted = 1;
ATH_RX_UNLOCK(sc);
/* Let DFS at it in case it's a DFS channel */
ath_dfs_radar_enable(sc, ic->ic_curchan);
@ -2015,44 +2030,46 @@ ath_intr(void *arg)
if (status & HAL_INT_RXEOL) {
int imask;
ATH_KTR(sc, ATH_KTR_ERROR, 0, "ath_intr: RXEOL");
ATH_PCU_LOCK(sc);
if (! sc->sc_isedma) {
ATH_PCU_LOCK(sc);
/*
* NB: the hardware should re-read the link when
* RXE bit is written, but it doesn't work at
* least on older hardware revs.
*/
sc->sc_stats.ast_rxeol++;
/*
* Disable RXEOL/RXORN - prevent an interrupt
* storm until the PCU logic can be reset.
* In case the interface is reset some other
* way before "sc_kickpcu" is called, don't
* modify sc_imask - that way if it is reset
* by a call to ath_reset() somehow, the
* interrupt mask will be correctly reprogrammed.
*/
imask = sc->sc_imask;
imask &= ~(HAL_INT_RXEOL | HAL_INT_RXORN);
ath_hal_intrset(ah, imask);
/*
* Only blank sc_rxlink if we've not yet kicked
* the PCU.
*
* This isn't entirely correct - the correct solution
* would be to have a PCU lock and engage that for
* the duration of the PCU fiddling; which would include
* running the RX process. Otherwise we could end up
* messing up the RX descriptor chain and making the
* RX desc list much shorter.
*/
if (! sc->sc_kickpcu)
sc->sc_rxlink = NULL;
sc->sc_kickpcu = 1;
ATH_PCU_UNLOCK(sc);
}
/*
* NB: the hardware should re-read the link when
* RXE bit is written, but it doesn't work at
* least on older hardware revs.
*/
sc->sc_stats.ast_rxeol++;
/*
* Disable RXEOL/RXORN - prevent an interrupt
* storm until the PCU logic can be reset.
* In case the interface is reset some other
* way before "sc_kickpcu" is called, don't
* modify sc_imask - that way if it is reset
* by a call to ath_reset() somehow, the
* interrupt mask will be correctly reprogrammed.
*/
imask = sc->sc_imask;
imask &= ~(HAL_INT_RXEOL | HAL_INT_RXORN);
ath_hal_intrset(ah, imask);
/*
* Only blank sc_rxlink if we've not yet kicked
* the PCU.
*
* This isn't entirely correct - the correct solution
* would be to have a PCU lock and engage that for
* the duration of the PCU fiddling; which would include
* running the RX process. Otherwise we could end up
* messing up the RX descriptor chain and making the
* RX desc list much shorter.
*/
if (! sc->sc_kickpcu)
sc->sc_rxlink = NULL;
sc->sc_kickpcu = 1;
ATH_PCU_UNLOCK(sc);
/*
* Enqueue an RX proc, to handled whatever
* Enqueue an RX proc to handle whatever
* is in the RX queue.
* This will then kick the PCU.
* This will then kick the PCU if required.
*/
sc->sc_rx.recv_sched(sc, 1);
}
@ -2348,6 +2365,12 @@ ath_init(void *arg)
ATH_UNLOCK(sc);
return;
}
ATH_RX_LOCK(sc);
sc->sc_rx_stopped = 1;
sc->sc_rx_resetted = 1;
ATH_RX_UNLOCK(sc);
ath_chan_change(sc, ic->ic_curchan);
/* Let DFS at it in case it's a DFS channel */
@ -2406,8 +2429,7 @@ ath_init(void *arg)
* Enable interrupts.
*/
sc->sc_imask = HAL_INT_RX | HAL_INT_TX
| HAL_INT_RXEOL | HAL_INT_RXORN
| HAL_INT_TXURN
| HAL_INT_RXORN | HAL_INT_TXURN
| HAL_INT_FATAL | HAL_INT_GLOBAL;
/*
@ -2417,6 +2439,14 @@ ath_init(void *arg)
if (sc->sc_isedma)
sc->sc_imask |= (HAL_INT_RXHP | HAL_INT_RXLP);
/*
* If we're an EDMA NIC, we don't care about RXEOL.
* Writing a new descriptor in will simply restart
* RX DMA.
*/
if (! sc->sc_isedma)
sc->sc_imask |= HAL_INT_RXEOL;
/*
* Enable MIB interrupts when there are hardware phy counters.
* Note we only do this (at the moment) for station mode.
@ -2735,6 +2765,11 @@ ath_reset(struct ifnet *ifp, ATH_RESET_TYPE reset_type)
__func__, status);
sc->sc_diversity = ath_hal_getdiversity(ah);
ATH_RX_LOCK(sc);
sc->sc_rx_stopped = 1;
sc->sc_rx_resetted = 1;
ATH_RX_UNLOCK(sc);
/* Let DFS at it in case it's a DFS channel */
ath_dfs_radar_enable(sc, ic->ic_curchan);
@ -3192,7 +3227,7 @@ ath_transmit(struct ifnet *ifp, struct mbuf *m)
DPRINTF(sc, ATH_DEBUG_XMIT,
"%s: out of txfrag buffers\n", __func__);
sc->sc_stats.ast_tx_nofrag++;
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ath_freetx(m);
goto bad;
}
@ -3240,7 +3275,7 @@ ath_transmit(struct ifnet *ifp, struct mbuf *m)
*
* XXX should use atomics?
*/
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
nextfrag:
/*
* Pass the frame to the h/w for transmission.
@ -3260,7 +3295,7 @@ ath_transmit(struct ifnet *ifp, struct mbuf *m)
next = m->m_nextpkt;
if (ath_tx_start(sc, ni, bf, m)) {
bad:
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
reclaim:
bf->bf_m = NULL;
bf->bf_node = NULL;
@ -5333,14 +5368,15 @@ ath_chan_set(struct ath_softc *sc, struct ieee80211_channel *chan)
ATH_PCU_LOCK(sc);
/* Disable interrupts */
ath_hal_intrset(ah, 0);
/* Stop new RX/TX/interrupt completion */
if (ath_reset_grablock(sc, 1) == 0) {
device_printf(sc->sc_dev, "%s: concurrent reset! Danger!\n",
__func__);
}
ath_hal_intrset(ah, 0);
/* Stop pending RX/TX completion */
ath_txrx_stop_locked(sc);
@ -5384,6 +5420,11 @@ ath_chan_set(struct ath_softc *sc, struct ieee80211_channel *chan)
}
sc->sc_diversity = ath_hal_getdiversity(ah);
ATH_RX_LOCK(sc);
sc->sc_rx_stopped = 1;
sc->sc_rx_resetted = 1;
ATH_RX_UNLOCK(sc);
/* Let DFS at it in case it's a DFS channel */
ath_dfs_radar_enable(sc, chan);
@ -6346,7 +6387,7 @@ ath_watchdog(void *arg)
} else
if_printf(ifp, "device timeout\n");
do_reset = 1;
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
sc->sc_stats.ast_watchdog++;
ATH_LOCK(sc);
@ -6530,8 +6571,10 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case SIOCGATHSTATS:
/* NB: embed these numbers to get a consistent view */
sc->sc_stats.ast_tx_packets = ifp->if_opackets;
sc->sc_stats.ast_rx_packets = ifp->if_ipackets;
sc->sc_stats.ast_tx_packets = ifp->if_get_counter(ifp,
IFCOUNTER_OPACKETS);
sc->sc_stats.ast_rx_packets = ifp->if_get_counter(ifp,
IFCOUNTER_IPACKETS);
sc->sc_stats.ast_tx_rssi = ATH_RSSI(sc->sc_halstats.ns_avgtxrssi);
sc->sc_stats.ast_rx_rssi = ATH_RSSI(sc->sc_halstats.ns_avgrssi);
#ifdef IEEE80211_SUPPORT_TDMA

View File

@ -704,7 +704,7 @@ ath_rx_pkt(struct ath_softc *sc, struct ath_rx_status *rs, HAL_STATUS status,
rs->rs_keyix-32 : rs->rs_keyix);
}
}
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
rx_error:
/*
* Cleanup any pending partial frame.
@ -830,7 +830,7 @@ ath_rx_pkt(struct ath_softc *sc, struct ath_rx_status *rs, HAL_STATUS status,
rs->rs_antenna |= 0x4;
}
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
sc->sc_stats.ast_ant_rx[rs->rs_antenna]++;
/*

View File

@ -160,10 +160,20 @@ ath_edma_stoprecv(struct ath_softc *sc, int dodelay)
struct ath_hal *ah = sc->sc_ah;
ATH_RX_LOCK(sc);
ath_hal_stoppcurecv(ah);
ath_hal_setrxfilter(ah, 0);
ath_hal_stopdmarecv(ah);
/*
*
*/
if (ath_hal_stopdmarecv(ah) == AH_TRUE)
sc->sc_rx_stopped = 1;
/*
* Give the various bus FIFOs (not EDMA descriptor FIFO)
* time to finish flushing out data.
*/
DELAY(3000);
/* Flush RX pending for each queue */
@ -218,10 +228,6 @@ ath_edma_reinit_fifo(struct ath_softc *sc, HAL_RX_QUEUE qtype)
/*
* Start receive.
*
* XXX TODO: this needs to reallocate the FIFO entries when a reset
* occurs, in case the FIFO is filled up and no new descriptors get
* thrown into the FIFO.
*/
static int
ath_edma_startrecv(struct ath_softc *sc)
@ -230,35 +236,31 @@ ath_edma_startrecv(struct ath_softc *sc)
ATH_RX_LOCK(sc);
/*
* Sanity check - are we being called whilst RX
* isn't stopped? If so, we may end up pushing
* too many entries into the RX FIFO and
* badness occurs.
*/
/* Enable RX FIFO */
ath_hal_rxena(ah);
/*
* Entries should only be written out if the
* FIFO is empty.
*
* XXX This isn't correct. I should be looking
* at the value of AR_RXDP_SIZE (0x0070) to determine
* how many entries are in here.
*
* A warm reset will clear the registers but not the FIFO.
*
* And I believe this is actually the address of the last
* handled buffer rather than the current FIFO pointer.
* So if no frames have been (yet) seen, we'll reinit the
* FIFO.
*
* I'll chase that up at some point.
* In theory the hardware has been initialised, right?
*/
if (ath_hal_getrxbuf(sc->sc_ah, HAL_RX_QUEUE_HP) == 0) {
if (sc->sc_rx_resetted == 1) {
DPRINTF(sc, ATH_DEBUG_EDMA_RX,
"%s: Re-initing HP FIFO\n", __func__);
ath_edma_reinit_fifo(sc, HAL_RX_QUEUE_HP);
}
if (ath_hal_getrxbuf(sc->sc_ah, HAL_RX_QUEUE_LP) == 0) {
DPRINTF(sc, ATH_DEBUG_EDMA_RX,
"%s: Re-initing LP FIFO\n", __func__);
ath_edma_reinit_fifo(sc, HAL_RX_QUEUE_LP);
sc->sc_rx_resetted = 0;
} else {
device_printf(sc->sc_dev,
"%s: called without resetting chip?\n",
__func__);
}
/* Add up to m_fifolen entries in each queue */
@ -266,6 +268,9 @@ ath_edma_startrecv(struct ath_softc *sc)
* These must occur after the above write so the FIFO buffers
* are pushed/tracked in the same order as the hardware will
* process them.
*
* XXX TODO: is this really necessary? We should've stopped
* the hardware already and reinitialised it, so it's a no-op.
*/
ath_edma_rxfifo_alloc(sc, HAL_RX_QUEUE_HP,
sc->sc_rxedma[HAL_RX_QUEUE_HP].m_fifolen);
@ -276,6 +281,11 @@ ath_edma_startrecv(struct ath_softc *sc)
ath_mode_init(sc);
ath_hal_startpcurecv(ah);
/*
* We're now doing RX DMA!
*/
sc->sc_rx_stopped = 0;
ATH_RX_UNLOCK(sc);
return (0);
@ -380,6 +390,21 @@ ath_edma_recv_proc_queue(struct ath_softc *sc, HAL_RX_QUEUE qtype,
ATH_RX_LOCK(sc);
#if 1
if (sc->sc_rx_resetted == 1) {
/*
* XXX We shouldn't ever be scheduled if
* receive has been stopped - so complain
* loudly!
*/
device_printf(sc->sc_dev,
"%s: sc_rx_resetted=1! Bad!\n",
__func__);
ATH_RX_UNLOCK(sc);
return;
}
#endif
do {
bf = re->m_fifo[re->m_fifo_head];
/* This shouldn't occur! */
@ -451,24 +476,6 @@ ath_edma_recv_proc_queue(struct ath_softc *sc, HAL_RX_QUEUE qtype,
"ath edma rx proc: npkts=%d\n",
npkts);
/* Handle resched and kickpcu appropriately */
ATH_PCU_LOCK(sc);
if (dosched && sc->sc_kickpcu) {
ATH_KTR(sc, ATH_KTR_ERROR, 0,
"ath_edma_recv_proc_queue(): kickpcu");
if (npkts > 0)
device_printf(sc->sc_dev,
"%s: handled npkts %d\n",
__func__, npkts);
/*
* XXX TODO: what should occur here? Just re-poke and
* re-enable the RX FIFO?
*/
sc->sc_kickpcu = 0;
}
ATH_PCU_UNLOCK(sc);
return;
}

Some files were not shown because too many files have changed in this diff Show More