Merge ^/head r318560 through r318657.

This commit is contained in:
Dimitry Andric 2017-05-22 19:28:24 +00:00
commit 27c240688c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang500-import/; revision=318658
78 changed files with 5513 additions and 285 deletions

View file

@ -57,8 +57,8 @@ si_int __popcountsi2(si_int a); // bit population
si_int __popcountdi2(di_int a); // bit population
si_int __popcountti2(ti_int a); // bit population
uint32_t __bswapsi2(uint32_t a); // a byteswapped, arm only
uint64_t __bswapdi2(uint64_t a); // a byteswapped, arm only
uint32_t __bswapsi2(uint32_t a); // a byteswapped, arm/mips only
uint64_t __bswapdi2(uint64_t a); // a byteswapped, arm/mips only
// Integral arithmetic

View file

@ -0,0 +1,28 @@
/* ===-- bswapdi2.c - Implement __bswapdi2 ---------------------------------===
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
* This file implements __bswapdi2 for the compiler_rt library.
*
* ===----------------------------------------------------------------------===
*/
#include "int_lib.h"
COMPILER_RT_ABI uint64_t
__bswapdi2 (uint64_t u)
{
return ((((u) & 0xff00000000000000ULL) >> 56)
| (((u) & 0x00ff000000000000ULL) >> 40)
| (((u) & 0x0000ff0000000000ULL) >> 24)
| (((u) & 0x000000ff00000000ULL) >> 8)
| (((u) & 0x00000000ff000000ULL) << 8)
| (((u) & 0x0000000000ff0000ULL) << 24)
| (((u) & 0x000000000000ff00ULL) << 40)
| (((u) & 0x00000000000000ffULL) << 56));
}

View file

@ -0,0 +1,25 @@
/* ===-- bswapsi2.c - Implement __bswapsi2 ---------------------------------===
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
* This file implements __bswapsi2 for the compiler_rt library.
*
* ===----------------------------------------------------------------------===
*/
#include "int_lib.h"
COMPILER_RT_ABI uint32_t
__bswapsi2 (uint32_t u)
{
return ((((u) & 0xff000000) >> 24)
| (((u) & 0x00ff0000) >> 8)
| (((u) & 0x0000ff00) << 8)
| (((u) & 0x000000ff) << 24));
}

View file

@ -30,7 +30,7 @@
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd February 13, 2014
.Dd May 20, 2017
.Dt DMA 8
.Os
.Sh NAME
@ -74,7 +74,7 @@ acts as a compatibility option for sendmail.
.It Fl bp
List all mails currently stored in the mail queue.
.It Fl bq
Queue the mail, but don't attempt to deliver it.
Queue the mail, but do not attempt to deliver it.
See also the
.Sq DEFER
config file setting below.
@ -82,9 +82,9 @@ config file setting below.
.Pp
All other
.Ar mode Ns
s are are ignored.
s are ignored.
.It Fl D
Don't run in the background.
Do not run in the background.
Useful for debugging.
.It Fl f Ar sender
Set sender address (envelope-from) to
@ -198,7 +198,7 @@ The special name
.Ql *
can be used to create a catch-all alias, which gets used if no other
matching alias is found.
Use the catch-all alias only if you don't want any local mail to be
Use the catch-all alias only if you do not want any local mail to be
delivered.
.It Ic SPOOLDIR Xo
(string, default=/var/spool/dma)
@ -213,7 +213,7 @@ Just stick with the default.
Path to the
.Sq auth.conf
file.
.It Ic SECURETRANS Xo
.It Ic SECURETRANSFER Xo
(boolean, default=commented)
.Xc
Uncomment if you want TLS/SSL secured transfer.
@ -222,7 +222,7 @@ Uncomment if you want TLS/SSL secured transfer.
.Xc
Uncomment if you want to use STARTTLS.
Only useful together with
.Sq SECURETRANS .
.Sq SECURETRANSFER .
.It Ic OPPORTUNISTIC_TLS Xo
(boolean, default=commented)
.Xc
@ -234,7 +234,7 @@ the outside mail exchangers; in opportunistic TLS mode, the connection will
be encrypted if the remote server supports STARTTLS, but an unencrypted
delivery will still be made if the negotiation fails.
Only useful together with
.Sq SECURETRANS
.Sq SECURETRANSFER
and
.Sq STARTTLS .
.It Ic CERTFILE Xo
@ -305,7 +305,8 @@ will send all mails as
setting it to
.Ql percolator
will send all mails as
.Ql Sm off Va username @percolator .
.Sm off
.Ql Va username @percolator .
.Sm on
.It Ic NULLCLIENT Xo
.Xc

View file

@ -24,7 +24,7 @@
.\"
.\" $Id: nm.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd February 15, 2015
.Dd May 21, 2017
.Os
.Dt NM 1
.Sh NAME
@ -304,6 +304,8 @@ A local
(uninitialized data) symbol.
.It d
A local data symbol.
.It r
A local read-only data symbol.
.It t
A local text symbol.
.It v

View file

@ -413,6 +413,26 @@ wflag_emptypat_body()
atf_check -o file:test4 grep -w -e "" test4
}
atf_test_case excessive_matches
excessive_matches_head()
{
atf_set "descr" "Check for proper handling of lines with excessive matches (PR 218811)"
}
excessive_matches_body()
{
grep_type
if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then
atf_expect_fail "this test does not pass with GNU grep in base"
fi
for i in $(jot 4096); do
printf "x" >> test.in
done
atf_check -s exit:0 -x '[ $(grep -o x test.in | wc -l) -eq 4096 ]'
atf_check -s exit:1 -x 'grep -on x test.in | grep -v "1:x"'
}
atf_test_case fgrep_sanity
fgrep_sanity_head()
{
@ -490,6 +510,39 @@ wv_combo_break_body()
atf_check -s exit:1 grep -v -w "x" test2
}
atf_test_case ocolor_metadata
ocolor_metadata_head()
{
atf_set "descr" "Check for -n/-b producing per-line metadata output"
}
ocolor_metadata_body()
{
grep_type
if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then
atf_expect_fail "this test does not pass with GNU grep in base"
fi
printf "xxx\nyyyy\nzzz\nfoobarbaz\n" > test1
check_expr="^[^:]*[0-9][^:]*:[^:]+$"
atf_check -o inline:"1:1:xx\n" grep -bon "xx$" test1
atf_check -o inline:"2:4:yyyy\n" grep -bn "yy" test1
atf_check -o inline:"2:6:yy\n" grep -bon "yy$" test1
# These checks ensure that grep isn't producing bogus line numbering
# in the middle of a line.
atf_check -s exit:1 -x \
"grep -Eon 'x|y|z|f' test1 | grep -Ev '${check_expr}'"
atf_check -s exit:1 -x \
"grep -En 'x|y|z|f' --color=always test1 | grep -Ev '${check_expr}'"
atf_check -s exit:1 -x \
"grep -Eon 'x|y|z|f' --color=always test1 | grep -Ev '${check_expr}'"
}
atf_test_case grep_nomatch_flags
grep_nomatch_flags_head()
{
@ -603,10 +656,12 @@ atf_init_test_cases()
atf_add_test_case egrep_empty_invalid
atf_add_test_case zerolen
atf_add_test_case wflag_emptypat
atf_add_test_case excessive_matches
atf_add_test_case wv_combo_break
atf_add_test_case fgrep_sanity
atf_add_test_case egrep_sanity
atf_add_test_case grep_sanity
atf_add_test_case ocolor_metadata
atf_add_test_case grep_nomatch_flags
atf_add_test_case binary_flags
atf_add_test_case badcontext

View file

@ -433,7 +433,7 @@ char *argv[];
default:
fprintf(stderr,
"Top version %s\n"
"Usage: %s [-abCHIijnPqStuvz] [-d count] [-m io | cpu] [-o field] [-s time]\n"
"Usage: %s [-abCHIijnPqStuvwz] [-d count] [-m io | cpu] [-o field] [-s time]\n"
" [-J jail] [-U username] [number]\n",
version_string(), myname);
exit(1);

View file

@ -156,8 +156,6 @@
..
usb
..
utopia
..
vkbd
..
wi

View file

@ -606,6 +606,8 @@
..
cmp
..
compress
..
cpio
..
col

View file

@ -71,7 +71,7 @@ case "$daily_scrub_zfs_enable" in
# Now minus last scrub (both in seconds) converted to days.
_scrub_diff=$(expr -e \( $(date +%s) - \
$(date -j -f %F.%T ${_last_scrub} +%s) \) / 60 / 60 / 24)
$(date -j -v -70M -f %F.%T ${_last_scrub} +%s) \) / 60 / 60 / 24)
if [ ${_scrub_diff} -lt ${_pool_threshold} ]; then
echo " skipping scrubbing of pool '${pool}':"
echo " last scrubbing is ${_scrub_diff} days ago, threshold is set to ${_pool_threshold} days"

View file

@ -65,6 +65,7 @@
.ds doc-operating-system-FreeBSD-10.2 10.2
.ds doc-operating-system-FreeBSD-10.3 10.3
.ds doc-operating-system-FreeBSD-11.0 11.0
.ds doc-operating-system-FreeBSD-11.1 11.1
.ds doc-operating-system-FreeBSD-12.0 12.0
.
.\" Definitions for other *BSDs not (yet) in doc-common

View file

@ -157,6 +157,9 @@ _libclang_rt= libclang_rt
.if ${MK_LIBCPLUSPLUS} != "no"
_libcxxrt= libcxxrt
_libcplusplus= libc++
.if ${MACHINE_CPUARCH} != "arm"
_libcplusplus+= libc++experimental
.endif
.endif
SUBDIR.${MK_EFI}+= libefivar

View file

@ -0,0 +1,30 @@
# $FreeBSD$
.include <src.opts.mk>
PACKAGE= clibs
SRCDIR= ${SRCTOP}/contrib/libc++
LIB= c++experimental
NO_PIC=
MK_PROFILE= no
.PATH: ${SRCDIR}/src/experimental
SRCS+= filesystem/directory_iterator.cpp
SRCS+= filesystem/operations.cpp
SRCS+= filesystem/path.cpp
SRCS+= memory_resource.cpp
WARNS?= 0
CXXFLAGS+= ${PICFLAG}
CXXFLAGS+= -isystem ${SRCDIR}/include
CXXFLAGS+= -nostdinc++
CXXFLAGS+= -nostdlib
CXXFLAGS+= -D_LIBCPP_BUILDING_LIBRARY
CXXFLAGS+= -DLIBCXXRT
.if empty(CXXFLAGS:M-std=*)
CXXFLAGS+= -std=c++14
.endif
.include <bsd.lib.mk>

View file

@ -485,7 +485,6 @@ FBSDprivate_1.0 {
_pthread_sigmask;
_pthread_testcancel;
_spinlock;
_spinlock_debug;
_spinunlock;
_rtld_addr_phdr;
_rtld_atfork_pre;

View file

@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
long _atomic_lock_stub(volatile long *);
void _spinlock_stub(spinlock_t *);
void _spinunlock_stub(spinlock_t *);
void _spinlock_debug_stub(spinlock_t *, char *, int);
__weak_reference(_atomic_lock_stub, _atomic_lock);
@ -48,7 +47,6 @@ _atomic_lock_stub(volatile long *lck __unused)
return (0L);
}
__weak_reference(_spinlock, _spinlock_debug);
#pragma weak _spinlock
void
_spinlock(spinlock_t *lck)

View file

@ -41,21 +41,17 @@
* Lock structure with room for debugging information.
*/
struct _spinlock {
volatile long access_lock;
volatile long lock_owner;
volatile char *fname;
volatile int lineno;
long spare1;
long spare2;
void *thr_extra;
int spare3;
};
typedef struct _spinlock spinlock_t;
#define _SPINLOCK_INITIALIZER { 0, 0, 0, 0 }
#define _SPINUNLOCK(_lck) _spinunlock(_lck);
#ifdef _LOCK_DEBUG
#define _SPINLOCK(_lck) _spinlock_debug(_lck, __FILE__, __LINE__)
#else
#define _SPINLOCK(_lck) _spinlock(_lck)
#endif
/*
* Thread function prototype definitions:
@ -64,7 +60,6 @@ __BEGIN_DECLS
long _atomic_lock(volatile long *);
void _spinlock(spinlock_t *);
void _spinunlock(spinlock_t *);
void _spinlock_debug(spinlock_t *, char *, int);
__END_DECLS
#endif /* _SPINLOCK_H_ */

View file

@ -224,3 +224,10 @@ SRCS+= switch8.S
SRCS+= switchu8.S
SRCS+= sync_synchronize.S
.endif
# GCC-6.3 on mips32 requires bswap32 built-in.
.if ${MACHINE_CPUARCH} == "mips"
SRCS+= bswapdi2.c
SRCS+= bswapsi2.c
.endif

View file

@ -17,6 +17,7 @@ MK_SSP= no
LIB=thr
SHLIB_MAJOR= 3
WARNS?= 3
NO_WTHREAD_SAFETY=1
CFLAGS+=-DPTHREAD_KERNEL
CFLAGS+=-I${SRCTOP}/lib/libc/include -I${.CURDIR}/thread \
-I${SRCTOP}/include
@ -27,6 +28,12 @@ CFLAGS+=-I${SRCTOP}/libexec/rtld-elf/${MACHINE_CPUARCH}
CFLAGS+=-I${SRCTOP}/lib/libthread_db
CFLAGS+=-Winline
CFLAGS.thr_stack.c+= -Wno-cast-align
.include <bsd.compiler.mk>
.if !(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 40300)
CFLAGS.thr_symbols.c+= -Wno-missing-variable-declarations
.endif
.ifndef NO_THREAD_UNWIND_STACK
CFLAGS+=-fexceptions
CFLAGS+=-D_PTHREAD_FORCED_UNWIND

View file

@ -173,7 +173,6 @@ STATIC_LIB_REQUIRE(_sigtimedwait);
STATIC_LIB_REQUIRE(_sigwait);
STATIC_LIB_REQUIRE(_sigwaitinfo);
STATIC_LIB_REQUIRE(_spinlock);
STATIC_LIB_REQUIRE(_spinlock_debug);
STATIC_LIB_REQUIRE(_spinunlock);
STATIC_LIB_REQUIRE(_thread_init_hack);

View file

@ -49,27 +49,42 @@ __weak_reference(_pthread_rwlock_unlock, pthread_rwlock_unlock);
__weak_reference(_pthread_rwlock_wrlock, pthread_rwlock_wrlock);
__weak_reference(_pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock);
#define CHECK_AND_INIT_RWLOCK \
if (*rwlock == THR_PSHARED_PTR) { \
prwlock = __thr_pshared_offpage(rwlock, 0); \
if (prwlock == NULL) \
return (EINVAL); \
} else if (__predict_false((prwlock = (*rwlock)) <= \
THR_RWLOCK_DESTROYED)) { \
if (prwlock == THR_RWLOCK_INITIALIZER) { \
int ret; \
ret = init_static(_get_curthread(), rwlock); \
if (ret) \
return (ret); \
} else if (prwlock == THR_RWLOCK_DESTROYED) { \
return (EINVAL); \
} \
prwlock = *rwlock; \
}
static int init_static(struct pthread *thread, pthread_rwlock_t *rwlock);
static int init_rwlock(pthread_rwlock_t *rwlock, pthread_rwlock_t *rwlock_out);
/*
* Prototypes
*/
static int __always_inline
check_and_init_rwlock(pthread_rwlock_t *rwlock, pthread_rwlock_t *rwlock_out)
{
if (__predict_false(*rwlock == THR_PSHARED_PTR ||
*rwlock <= THR_RWLOCK_DESTROYED))
return (init_rwlock(rwlock, rwlock_out));
*rwlock_out = *rwlock;
return (0);
}
static int __noinline
init_rwlock(pthread_rwlock_t *rwlock, pthread_rwlock_t *rwlock_out)
{
pthread_rwlock_t prwlock;
int ret;
if (*rwlock == THR_PSHARED_PTR) {
prwlock = __thr_pshared_offpage(rwlock, 0);
if (prwlock == NULL)
return (EINVAL);
} else if ((prwlock = *rwlock) <= THR_RWLOCK_DESTROYED) {
if (prwlock == THR_RWLOCK_INITIALIZER) {
ret = init_static(_get_curthread(), rwlock);
if (ret != 0)
return (ret);
} else if (prwlock == THR_RWLOCK_DESTROYED) {
return (EINVAL);
}
prwlock = *rwlock;
}
*rwlock_out = prwlock;
return (0);
}
static int
rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr)
@ -148,7 +163,9 @@ rwlock_rdlock_common(pthread_rwlock_t *rwlock, const struct timespec *abstime)
int flags;
int ret;
CHECK_AND_INIT_RWLOCK
ret = check_and_init_rwlock(rwlock, &prwlock);
if (ret != 0)
return (ret);
if (curthread->rdlock_count) {
/*
@ -220,7 +237,9 @@ _pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
int flags;
int ret;
CHECK_AND_INIT_RWLOCK
ret = check_and_init_rwlock(rwlock, &prwlock);
if (ret != 0)
return (ret);
if (curthread->rdlock_count) {
/*
@ -253,7 +272,9 @@ _pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock)
pthread_rwlock_t prwlock;
int ret;
CHECK_AND_INIT_RWLOCK
ret = check_and_init_rwlock(rwlock, &prwlock);
if (ret != 0)
return (ret);
ret = _thr_rwlock_trywrlock(&prwlock->lock);
if (ret == 0)
@ -268,7 +289,9 @@ rwlock_wrlock_common (pthread_rwlock_t *rwlock, const struct timespec *abstime)
pthread_rwlock_t prwlock;
int ret;
CHECK_AND_INIT_RWLOCK
ret = check_and_init_rwlock(rwlock, &prwlock);
if (ret != 0)
return (ret);
/*
* POSIX said the validity of the abstimeout parameter need

View file

@ -65,7 +65,7 @@ __thr_spinunlock(spinlock_t *lck)
{
struct spinlock_extra *_extra;
_extra = (struct spinlock_extra *)lck->fname;
_extra = lck->thr_extra;
THR_UMUTEX_UNLOCK(_get_curthread(), &_extra->lock);
}
@ -78,9 +78,9 @@ __thr_spinlock(spinlock_t *lck)
PANIC("Spinlock called when not threaded.");
if (!initialized)
PANIC("Spinlocks not initialized.");
if (lck->fname == NULL)
if (lck->thr_extra == NULL)
init_spinlock(lck);
_extra = (struct spinlock_extra *)lck->fname;
_extra = lck->thr_extra;
THR_UMUTEX_LOCK(_get_curthread(), &_extra->lock);
}
@ -90,14 +90,14 @@ init_spinlock(spinlock_t *lck)
struct pthread *curthread = _get_curthread();
THR_UMUTEX_LOCK(curthread, &spinlock_static_lock);
if ((lck->fname == NULL) && (spinlock_count < MAX_SPINLOCKS)) {
lck->fname = (char *)&extra[spinlock_count];
if ((lck->thr_extra == NULL) && (spinlock_count < MAX_SPINLOCKS)) {
lck->thr_extra = &extra[spinlock_count];
_thr_umutex_init(&extra[spinlock_count].lock);
extra[spinlock_count].owner = lck;
spinlock_count++;
}
THR_UMUTEX_UNLOCK(curthread, &spinlock_static_lock);
if (lck->fname == NULL)
if (lck->thr_extra == NULL)
PANIC("Warning: exceeded max spinlocks");
}

View file

@ -290,19 +290,6 @@ _thr_stack_alloc(struct pthread_attr *attr)
return (-1);
}
/*
* Disable this warning from clang:
*
* cast from 'char *' to
* 'struct stack *' increases required alignment from 1 to 8
* [-Werror,-Wcast-align]
* spare_stack = (struct stack *)
*/
#ifdef __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
#endif
/* This function must be called with _thread_list_lock held. */
void
_thr_stack_free(struct pthread_attr *attr)
@ -329,7 +316,3 @@ _thr_stack_free(struct pthread_attr *attr)
attr->stackaddr_attr = NULL;
}
}
#ifdef __clang__
#pragma GCC diagnostic pop
#endif

View file

@ -37,10 +37,6 @@ __FBSDID("$FreeBSD$");
#include "thr_private.h"
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wmissing-variable-declarations"
#endif
/* A collection of symbols needed by debugger */
/* int _libthr_debug */

View file

@ -270,7 +270,7 @@ packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES}
pkg-stage:
.if !defined(NOPKG)
env REPOS_DIR=${.CURDIR}/pkg_repos/ \
env PORTSDIR=${PORTSDIR} REPOS_DIR=${.CURDIR}/pkg_repos/ \
sh ${.CURDIR}/scripts/pkg-stage.sh
mkdir -p ${.OBJDIR}/dvd/packages/repos/
cp ${.CURDIR}/scripts/FreeBSD_install_cdrom.conf \

View file

@ -10,6 +10,7 @@ export PKG_DBDIR="/tmp/pkg"
export PERMISSIVE="YES"
export REPO_AUTOUPDATE="NO"
export PKGCMD="/usr/sbin/pkg -d"
export PORTSDIR="${PORTSDIR:-/usr/ports}"
_DVD_PACKAGES="archivers/unzip
devel/subversion
@ -33,8 +34,8 @@ x11/kde4
x11/xorg"
# If NOPORTS is set for the release, do not attempt to build pkg(8).
if [ ! -f /usr/ports/Makefile ]; then
echo "*** /usr/ports is missing! ***"
if [ ! -f ${PORTSDIR}/Makefile ]; then
echo "*** ${PORTSDIR} is missing! ***"
echo "*** Skipping pkg-stage.sh ***"
echo "*** Unset NOPORTS to fix this ***"
exit 0
@ -42,7 +43,7 @@ fi
if [ ! -x /usr/local/sbin/pkg ]; then
/etc/rc.d/ldconfig restart
/usr/bin/make -C /usr/ports/ports-mgmt/pkg install clean
/usr/bin/make -C ${PORTSDIR}/ports-mgmt/pkg install clean
fi
export DVD_DIR="dvd/packages"
@ -58,7 +59,7 @@ fi
# Ensure the ports listed in _DVD_PACKAGES exist to sanitize the
# final list.
for _P in ${_DVD_PACKAGES}; do
if [ -d "/usr/ports/${_P}" ]; then
if [ -d "${PORTSDIR}/${_P}" ]; then
DVD_PACKAGES="${DVD_PACKAGES} ${_P}"
else
echo "*** Skipping nonexistent port: ${_P}"

255
share/man/man4/ena.4 Normal file
View file

@ -0,0 +1,255 @@
.\" Copyright (c) 2015-2017 Amazon.com, Inc. or its affiliates.
.\" 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
.\" OWNER 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$
.\"
.Dd May 04, 2017
.Dt ENA 4
.Os
.Sh NAME
.Nm ena
.Nd "FreeBSD kernel driver for Elastic Network Adapter (ENA) family"
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following line in your
kernel configuration file:
.Bd -ragged -offset indent
.Cd "device ena"
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
if_ena_load="YES"
.Ed
.Sh DESCRIPTION
The ENA is a networking interface designed to make good use of modern CPU
features and system architectures.
.Pp
The ENA device exposes a lightweight management interface with a
minimal set of memory mapped registers and extendable command set
through an Admin Queue.
.Pp
The driver supports a range of ENA devices, is link-speed independent
(i.e., the same driver is used for 10GbE, 25GbE, 40GbE, etc.), and has
a negotiated and extendable feature set.
.Pp
Some ENA devices support SR-IOV. This driver is used for both the
SR-IOV Physical Function (PF) and Virtual Function (VF) devices.
.Pp
The ENA devices enable high speed and low overhead network traffic
processing by providing multiple Tx/Rx queue pairs (the maximum number
is advertised by the device via the Admin Queue), a dedicated MSI-X
interrupt vector per Tx/Rx queue pair, and CPU cacheline optimized
data placement.
.Pp
The
.Nm
driver supports industry standard TCP/IP offload features such
as checksum offload and TCP transmit segmentation offload (TSO).
Receive-side scaling (RSS) is supported for multi-core scaling.
.Pp
The
.Nm
driver and its corresponding devices implement health
monitoring mechanisms such as watchdog, enabling the device and driver
to recover in a manner transparent to the application, as well as
debug logs.
.Pp
Some of the ENA devices support a working mode called Low-latency
Queue (LLQ), which saves several more microseconds. This feature will
be implemented for driver in future releases.
.Sh HARDWARE
Supported PCI vendor ID/device IDs:
.Pp
.Bl -bullet -compact
.It
1d0f:0ec2 - ENA PF
.It
1d0f:1ec2 - ENA PF with LLQ support
.It
1d0f:ec20 - ENA VF
.It
1d0f:ec21 - ENA VF with LLQ support
.El
.Sh DIAGNOSTICS
.Ss Device initialization phase:
.Bl -diag
.It ena%d: failed to init mmio read less
.Pp
Error occured during initialization of the mmio register read request.
.It ena%d: Can not reset device
.Pp
Device could not be reset; device may not be responding or is already
during reset.
.It ena%d: device version is too low
.Pp
Version of the controller is too low and it is not supported by the driver.
.It ena%d: Invalid dma width value %d
.Pp
The controller is able to request dma transcation width. Device stopped
responding or it demanded invalid value.
.It ena%d: Can not initialize ena admin queue with device
.Pp
Initialization of the Admin Queue failed; device may not be responding or there
was a problem with initialization of the resources.
.It ena%d: Cannot get attribute for ena device rc: %d
.Pp
Failed to get attributes of the device from the controller.
.It ena%d: Cannot configure aenq groups rc: %d
.Pp
Errors occured when trying to configure AENQ groups.
.El
.Ss Driver initialisation/shutdown phase:
.Bl -diag
.It ena%d: PCI resource allocation failed!
.It ena%d: allocating ena_dev failed
.It ena%d: failed to pmap registers bar
.It ena%d: Error while setting up bufring
.It ena%d: Error with initialization of IO rings
.It ena%d: can not allocate ifnet structure
.It ena%d: Error with network interface setup
.It ena%d: Failed to enable and set the admin interrupts
.It ena%d: Failed to allocate %d, vectors %d
.It ena%d: Failed to enable MSIX, vectors %d rc %d
.It ena%d: Error with MSI-X enablement
.It ena%d: could not allocate irq vector: %d
.It ena%d: Unable to allocate bus resource: registers
.Pp
Resource allocation failed when initializing the device; driver will not
be attached.
.It ena%d: ENA device init failed (err: %d)
.Pp
Device initialization failed; driver will not be attached.
.It ena%d: could not activate irq vector: %d
.Pp
Error occured when trying to activate interrupt vectors for Admin Queue.
.It ena%d: failed to register interrupt handler for irq %ju: %d
.Pp
Error occured when trying to register Admin Queue interrupt handler.
.It ena%d: Cannot setup mgmnt queue intr
.Pp
Error occured during configuration of the Admin Queue interrupts.
.It ena%d: Enable MSI-X failed
.Pp
Configuration of the MSI-X for Admin Queue failed; there could be lack
of resources or interrupts could not have been configured; driver will
not be attached.
.It ena%d: VLAN is in use, detach first
.Pp
VLANs are being used when trying to detach the driver; VLANs should be detached
first and then detach routine should be called again.
.It ena%d: Unmapped RX DMA tag associations
.It ena%d: Unmapped TX DMA tag associations
.Pp
Error occured when trying to destroy RX/TX DMA tag.
.It ena%d: Cannot init RSS
.It ena%d: Cannot fill indirect table
.It ena%d: Cannot fill indirect table
.It ena%d: Cannot fill hash function
.It ena%d: Cannot fill hash control
.It ena%d: WARNING: RSS was not properly initialized, it will affect bandwidth
.Pp
Error occured during initialization of one of RSS resources; device is still
going to work but it will affect performance because all RX packets will be
passed to queue 0 and there will be no hash information.
.It ena%d: failed to tear down irq: %d
.It ena%d: dev has no parent while releasing res for irq: %d
Release of the interrupts failed.
.El
.Ss Additional diagnostic:
.Bl -diag
.It ena%d: Cannot get attribute for ena device
.Pp
This message appears when trying to change MTU and driver is unable to get
attributes from the device.
.It ena%d: Invalid MTU setting. new_mtu: %d
.Pp
Requested MTU value is not supported and will not be set.
.It ena%d: keep alive watchdog timeout
.Pp
Device stopped responding and will be reset.
.It ena%d: Found a Tx that wasn't completed on time, qid %d, index %d.
.Pp
Packet was pushed to the NIC but not sent within given time limit; it may
be caused by hang of the IO queue.
.It ena%d: The number of lost tx completion is aboce the threshold (%d > %d). Reset the device
.Pp
If too many Tx wasn't completed on time the device is going to be reset; it may
be caused by hanged queue or device.
.It ena%d: trigger reset is on
.Pp
Device will be reset; reset is triggered either by watchdog or if too many TX
packets were not completed on time.
.It ena%d: invalid value recvd
.Pp
Link status received from the device in the AENQ handler is invalid.
.It ena%d: Allocation for Tx Queue %u failed
.It ena%d: Allocation for Rx Queue %u failed
.It ena%d: Unable to create Rx DMA map for buffer %d
.It ena%d: Failed to create io TX queue #%d rc: %d
.It ena%d: Failed to get TX queue handlers. TX queue num %d rc: %d
.It ena%d: Failed to create io RX queue[%d] rc: %d
.It ena%d: Failed to get RX queue handlers. RX queue num %d rc: %d
.It ena%d: failed to request irq
.It ena%d: could not allocate irq vector: %d
.It ena%d: failed to register interrupt handler for irq %ju: %d
.Pp
IO resources initialization failed. Interface will not be brought up.
.It ena%d: LRO[%d] Initialization failed!
.Pp
Initialization of the LRO for the RX ring failed.
.It ena%d: failed to alloc buffer for rx queue
.It ena%d: failed to add buffer for rx queue %d
.It ena%d: refilled rx queue %d with %d pages only
.Pp
Allocation of resources used on RX path failed; if happened during
initialization of the IO queue, the interface will not be brought up.
.It ena%d: ioctl promisc/allmulti
.Pp
IOCTL request for the device to work in promiscuous/allmulti mode; see
.Xr ifconfig 8
for more details.
.It ena%d: too many fragments. Last fragment: %d!
.Pp
Packet with unsupported number of segments was queued for sending to the
device; packet will be dropped.
.Sh SUPPORT
If an issue is identified with the released source code with a supported adapter
email the specific information related to the issue to
.Aq Mt mk@semihalf.com
and
.Aq Mt mw@semihalf.com .
.Sh SEE ALSO
.Xr vlan 4 ,
.Xr ifconfig 8
.Sh AUTHORS
The
.Nm
driver was written by
.An Semihalf.

View file

@ -59,19 +59,7 @@ TAGS ${.CURDIR}/TAGS: ${.CURDIR}/cscope.files
rm -f ${.CURDIR}/TAGS
cd ${.CURDIR}; xargs etags -a < ${.CURDIR}/cscope.files
# You need the textproc/glimpse ports for this.
glimpse:
.if !exists(${.CURDIR}/.glimpse_exclude)
echo .svn > ${.CURDIR}/.glimpse_exclude
echo /compile/ >> ${.CURDIR}/.glimpse_exclude
.endif
cd ${.CURDIR}; glimpseindex -H . -B -f -o .
glimpse-clean:
cd ${.CURDIR}; rm -f .glimpse_*
.if !(make(cscope) || make(cscope-clean) || make(cscope-hook) || make(TAGS) || \
make(glimpse) || make(glimpse-clean))
.if !(make(cscope) || make(cscope-clean) || make(cscope-hook) || make(TAGS))
.include <src.opts.mk>
# The boot loader

View file

@ -79,6 +79,7 @@ nodevice snake_saver
nodevice star_saver
nodevice warp_saver
nodevice ccr
nodevice cxgbe
nodevice cxgbev
nodevice snd_cmi

View file

@ -188,7 +188,6 @@ renameat
symlinkat
unlinkat
freebsd32_utimensat
open
pdfork
pdgetpid
pdkill

View file

@ -57,7 +57,7 @@ struct sysent freebsd32_sysent[] = {
{ 0, (sy_call_t *)sys_fork, AUE_FORK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 2 = fork */
{ AS(read_args), (sy_call_t *)sys_read, AUE_READ, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 3 = read */
{ AS(write_args), (sy_call_t *)sys_write, AUE_WRITE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 4 = write */
{ AS(open_args), (sy_call_t *)sys_open, AUE_OPEN_RWTC, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 5 = open */
{ AS(open_args), (sy_call_t *)sys_open, AUE_OPEN_RWTC, NULL, 0, 0, 0, SY_THR_STATIC }, /* 5 = open */
{ AS(close_args), (sy_call_t *)sys_close, AUE_CLOSE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 6 = close */
{ AS(freebsd32_wait4_args), (sy_call_t *)freebsd32_wait4, AUE_WAIT4, NULL, 0, 0, 0, SY_THR_STATIC }, /* 7 = freebsd32_wait4 */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 8 = obsolete old creat */

View file

@ -37,4 +37,12 @@ int linux_wbinvd_on_all_cpus(void);
#endif
#define get_cpu() ({ \
sched_pin(); \
PCPU_GET(cpuid); \
})
#define put_cpu() \
sched_unpin()
#endif /* _ASM_SMP_H_ */

View file

@ -1584,6 +1584,12 @@ dev/e1000/e1000_mbx.c optional em \
dev/e1000/e1000_osdep.c optional em \
compile-with "${NORMAL_C} -I$S/dev/e1000"
dev/et/if_et.c optional et
dev/ena/ena.c optional ena \
compile-with "${NORMAL_C} -I$S/contrib"
dev/ena/ena_sysctl.c optional ena \
compile-with "${NORMAL_C} -I$S/contrib"
contrib/ena-com/ena_com.c optional ena
contrib/ena-com/ena_eth_com.c optional ena
dev/ep/if_ep.c optional ep
dev/ep/if_ep_isa.c optional ep isa
dev/ep/if_ep_pccard.c optional ep pccard

View file

@ -143,32 +143,20 @@ typedef int (* lookupfunc_t) __P((struct ipf_main_softc_s *, void *,
* i6addr is used as a container for both IPv4 and IPv6 addresses, as well
* as other types of objects, depending on its qualifier.
*/
typedef union i6addr {
u_32_t i6[4];
struct in_addr in4;
#ifdef USE_INET6
typedef union i6addr {
u_32_t i6[4];
struct in_addr in4;
struct in6_addr in6;
void *vptr[2];
lookupfunc_t lptr[2];
struct {
u_short type;
u_short subtype;
int name;
} i6un;
} i6addr_t;
#else
typedef union i6addr {
u_32_t i6[4];
struct in_addr in4;
void *vptr[2];
lookupfunc_t lptr[2];
struct {
u_short type;
u_short subtype;
int name;
} i6un;
} i6addr_t;
#endif
void *vptr[2];
lookupfunc_t lptr[2];
struct {
u_short type;
u_short subtype;
int name;
} i6un;
} i6addr_t;
#define in4_addr in4.s_addr
#define iplookupnum i6[1]

3769
sys/dev/ena/ena.c Normal file

File diff suppressed because it is too large Load diff

434
sys/dev/ena/ena.h Normal file
View file

@ -0,0 +1,434 @@
/*-
* BSD LICENSE
*
* Copyright (c) 2015-2017 Amazon.com, Inc. or its affiliates.
* 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
* OWNER 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 ENA_H
#define ENA_H
#include <sys/types.h>
#include "ena-com/ena_com.h"
#include "ena-com/ena_eth_com.h"
#define DRV_MODULE_VER_MAJOR 0
#define DRV_MODULE_VER_MINOR 7
#define DRV_MODULE_VER_SUBMINOR 0
#define DRV_MODULE_NAME "ena"
#ifndef DRV_MODULE_VERSION
#define DRV_MODULE_VERSION \
__XSTRING(DRV_MODULE_VER_MAJOR) "." \
__XSTRING(DRV_MODULE_VER_MINOR) "." \
__XSTRING(DRV_MODULE_VER_SUBMINOR)
#endif
#define DEVICE_NAME "Elastic Network Adapter (ENA)"
#define DEVICE_DESC "ENA adapter"
/* Calculate DMA mask - width for ena cannot exceed 48, so it is safe */
#define ENA_DMA_BIT_MASK(x) ((1ULL << (x)) - 1ULL)
/* 1 for AENQ + ADMIN */
#define ENA_MAX_MSIX_VEC(io_queues) (1 + (io_queues))
#define ENA_REG_BAR 0
#define ENA_MEM_BAR 2
#define ENA_BUS_DMA_SEGS 32
#define ENA_DEFAULT_RING_SIZE 1024
#define ENA_DEFAULT_SMALL_PACKET_LEN 128
#define ENA_DEFAULT_MAX_RX_BUFF_ALLOC_SIZE 1536
#define ENA_RX_REFILL_THRESH_DEVIDER 8
#define ENA_MAX_PUSH_PKT_SIZE 128
#define ENA_NAME_MAX_LEN 20
#define ENA_IRQNAME_SIZE 40
#define ENA_PKT_MAX_BUFS 19
#define ENA_STALL_TIMEOUT 100
#define ENA_RX_RSS_TABLE_LOG_SIZE 7
#define ENA_RX_RSS_TABLE_SIZE (1 << ENA_RX_RSS_TABLE_LOG_SIZE)
#define ENA_HASH_KEY_SIZE 40
#define ENA_DMA_BITS_MASK 40
#define ENA_MAX_FRAME_LEN 10000
#define ENA_MIN_FRAME_LEN 60
#define ENA_RX_HASH_KEY_NUM 10
#define ENA_RX_THASH_TABLE_SIZE (1 << 8)
#define ENA_TX_CLEANUP_TRESHOLD 128
#define DB_THRESHOLD 64
#define TX_COMMIT 32
/*
* TX budget for cleaning. It should be half of the RX budget to reduce amount
* of TCP retransmissions.
*/
#define TX_BUDGET 128
/* RX cleanup budget. -1 stands for infinity. */
#define RX_BUDGET 256
/*
* How many times we can repeat cleanup in the io irq handling routine if the
* RX or TX budget was depleted.
*/
#define CLEAN_BUDGET 8
#define RX_IRQ_INTERVAL 20
#define TX_IRQ_INTERVAL 50
#define ENA_MAX_MTU 9216
#define ENA_TSO_MAXSIZE PAGE_SIZE
#define ENA_TSO_NSEGS ENA_PKT_MAX_BUFS
#define ENA_RX_OFFSET NET_SKB_PAD + NET_IP_ALIGN
#define ENA_MMIO_DISABLE_REG_READ BIT(0)
#define ENA_TX_RING_IDX_NEXT(idx, ring_size) (((idx) + 1) & ((ring_size) - 1))
#define ENA_RX_RING_IDX_NEXT(idx, ring_size) (((idx) + 1) & ((ring_size) - 1))
#define ENA_RX_RING_IDX_ADD(idx, n, ring_size) \
(((idx) + (n)) & ((ring_size) - 1))
#define ENA_IO_TXQ_IDX(q) (2 * (q))
#define ENA_IO_RXQ_IDX(q) (2 * (q) + 1)
#define ENA_MGMNT_IRQ_IDX 0
#define ENA_IO_IRQ_FIRST_IDX 1
#define ENA_IO_IRQ_IDX(q) (ENA_IO_IRQ_FIRST_IDX + (q))
/*
* ENA device should send keep alive msg every 1 sec.
* We wait for 6 sec just to be on the safe side.
*/
#define DEFAULT_KEEP_ALIVE_TO (SBT_1S * 6)
/* Time in jiffies before concluding the transmitter is hung. */
#define DEFAULT_TX_CMP_TO (SBT_1S * 5)
/* Number of queues to check for missing queues per timer tick */
#define DEFAULT_TX_MONITORED_QUEUES (4)
/* Max number of timeouted packets before device reset */
#define DEFAULT_TX_CMP_THRESHOLD (128)
/*
* Supported PCI vendor and devices IDs
*/
#define PCI_VENDOR_ID_AMAZON 0x1d0f
#define PCI_DEV_ID_ENA_PF 0x0ec2
#define PCI_DEV_ID_ENA_LLQ_PF 0x1ec2
#define PCI_DEV_ID_ENA_VF 0xec20
#define PCI_DEV_ID_ENA_LLQ_VF 0xec21
struct msix_entry {
int entry;
int vector;
};
typedef struct _ena_vendor_info_t {
unsigned int vendor_id;
unsigned int device_id;
unsigned int index;
} ena_vendor_info_t;
struct ena_irq {
/* Interrupt resources */
struct resource *res;
driver_intr_t *handler;
void *data;
void *cookie;
unsigned int vector;
bool requested;
int cpu;
char name[ENA_IRQNAME_SIZE];
};
struct ena_que {
struct ena_adapter *adapter;
struct ena_ring *tx_ring;
struct ena_ring *rx_ring;
uint32_t id;
int cpu;
};
struct ena_tx_buffer {
struct mbuf *mbuf;
/* # of ena desc for this specific mbuf
* (includes data desc and metadata desc) */
unsigned int tx_descs;
/* # of buffers used by this mbuf */
unsigned int num_of_bufs;
bus_dmamap_t map;
/* Used to detect missing tx packets */
struct bintime timestamp;
bool print_once;
struct ena_com_buf bufs[ENA_PKT_MAX_BUFS];
} __aligned(CACHE_LINE_SIZE);
struct ena_rx_buffer {
struct mbuf *mbuf;
bus_dmamap_t map;
struct ena_com_buf ena_buf;
} __aligned(CACHE_LINE_SIZE);
struct ena_stats_tx {
counter_u64_t cnt;
counter_u64_t bytes;
counter_u64_t queue_stop;
counter_u64_t prepare_ctx_err;
counter_u64_t queue_wakeup;
counter_u64_t dma_mapping_err;
/* Not counted */
counter_u64_t unsupported_desc_num;
/* Not counted */
counter_u64_t napi_comp;
/* Not counted */
counter_u64_t tx_poll;
counter_u64_t doorbells;
counter_u64_t missing_tx_comp;
counter_u64_t bad_req_id;
};
struct ena_stats_rx {
counter_u64_t cnt;
counter_u64_t bytes;
counter_u64_t refil_partial;
counter_u64_t bad_csum;
/* Not counted */
counter_u64_t page_alloc_fail;
counter_u64_t mbuf_alloc_fail;
counter_u64_t dma_mapping_err;
counter_u64_t bad_desc_num;
/* Not counted */
counter_u64_t small_copy_len_pkt;
};
struct ena_ring {
/* Holds the empty requests for TX out of order completions */
uint16_t *free_tx_ids;
struct ena_com_dev *ena_dev;
struct ena_adapter *adapter;
struct ena_com_io_cq *ena_com_io_cq;
struct ena_com_io_sq *ena_com_io_sq;
/* The maximum length the driver can push to the device (For LLQ) */
enum ena_admin_placement_policy_type tx_mem_queue_type;
uint16_t rx_small_copy_len;
uint16_t qid;
uint16_t mtu;
uint8_t tx_max_header_size;
struct ena_com_rx_buf_info ena_bufs[ENA_PKT_MAX_BUFS];
uint32_t smoothed_interval;
enum ena_intr_moder_level moder_tbl_idx;
struct ena_que *que;
struct lro_ctrl lro;
uint16_t next_to_use;
uint16_t next_to_clean;
union {
struct ena_tx_buffer *tx_buffer_info; /* contex of tx packet */
struct ena_rx_buffer *rx_buffer_info; /* contex of rx packet */
};
int ring_size; /* number of tx/rx_buffer_info's entries */
struct buf_ring *br; /* only for TX */
struct mtx ring_mtx;
char mtx_name[16];
struct task enqueue_task;
struct taskqueue *enqueue_tq;
struct task cmpl_task;
struct taskqueue *cmpl_tq;
union {
struct ena_stats_tx tx_stats;
struct ena_stats_rx rx_stats;
};
} __aligned(CACHE_LINE_SIZE);
struct ena_stats_dev {
/* Not counted */
counter_u64_t tx_timeout;
/* Not counted */
counter_u64_t io_suspend;
/* Not counted */
counter_u64_t io_resume;
/* Not counted */
counter_u64_t wd_expired;
counter_u64_t interface_up;
counter_u64_t interface_down;
/* Not counted */
counter_u64_t admin_q_pause;
};
struct ena_hw_stats {
uint64_t rx_packets;
uint64_t tx_packets;
uint64_t rx_bytes;
uint64_t tx_bytes;
uint64_t rx_drops;
};
/* Board specific private data structure */
struct ena_adapter {
struct ena_com_dev *ena_dev;
/* OS defined structs */
if_t ifp;
device_t pdev;
struct ifmedia media;
/* OS resources */
struct resource * memory;
struct resource * registers;
struct mtx global_mtx;
struct sx ioctl_sx;
/* MSI-X */
uint32_t msix_enabled;
struct msix_entry *msix_entries;
int msix_vecs;
/* DMA tags used throughout the driver adapter for Tx and Rx */
bus_dma_tag_t tx_buf_tag;
bus_dma_tag_t rx_buf_tag;
int dma_width;
/*
* RX packets that shorter that this len will be copied to the skb
* header
*/
unsigned int small_copy_len;
uint16_t max_tx_sgl_size;
uint16_t max_rx_sgl_size;
uint32_t tx_offload_cap;
/* Tx fast path data */
int num_queues;
unsigned int tx_usecs, rx_usecs; /* Interrupt coalescing */
unsigned int tx_ring_size;
unsigned int rx_ring_size;
/* RSS*/
uint8_t rss_ind_tbl[ENA_RX_RSS_TABLE_SIZE];
bool rss_support;
uint32_t msg_enable;
uint8_t mac_addr[ETHER_ADDR_LEN];
/* mdio and phy*/
char name[ENA_NAME_MAX_LEN];
bool link_status;
bool trigger_reset;
bool up;
bool running;
uint32_t wol;
/* Queue will represent one TX and one RX ring */
struct ena_que que[ENA_MAX_NUM_IO_QUEUES]
__aligned(CACHE_LINE_SIZE);
/* TX */
struct ena_ring tx_ring[ENA_MAX_NUM_IO_QUEUES]
__aligned(CACHE_LINE_SIZE);
/* RX */
struct ena_ring rx_ring[ENA_MAX_NUM_IO_QUEUES]
__aligned(CACHE_LINE_SIZE);
struct ena_irq irq_tbl[ENA_MAX_MSIX_VEC(ENA_MAX_NUM_IO_QUEUES)];
/* Timer service */
struct callout timer_service;
sbintime_t keep_alive_timestamp;
uint32_t next_monitored_tx_qid;
struct task reset_task;
struct taskqueue *reset_tq;
int wd_active;
sbintime_t keep_alive_timeout;
sbintime_t missing_tx_timeout;
uint32_t missing_tx_max_queues;
uint32_t missing_tx_threshold;
/* Statistics */
struct ena_stats_dev dev_stats;
struct ena_hw_stats hw_stats;
};
#define ENA_DEV_LOCK mtx_lock(&adapter->global_mtx)
#define ENA_DEV_UNLOCK mtx_unlock(&adapter->global_mtx)
#define ENA_RING_MTX_LOCK(_ring) mtx_lock(&(_ring)->ring_mtx)
#define ENA_RING_MTX_TRYLOCK(_ring) mtx_trylock(&(_ring)->ring_mtx)
#define ENA_RING_MTX_UNLOCK(_ring) mtx_unlock(&(_ring)->ring_mtx)
struct ena_dev *ena_efa_enadev_get(device_t pdev);
int ena_register_adapter(struct ena_adapter *adapter);
void ena_unregister_adapter(struct ena_adapter *adapter);
int ena_update_stats_counters(struct ena_adapter *adapter);
static inline int ena_mbuf_count(struct mbuf *mbuf)
{
int count = 1;
while ((mbuf = mbuf->m_next) != NULL)
++count;
return count;
}
#endif /* !(ENA_H) */

243
sys/dev/ena/ena_sysctl.c Normal file
View file

@ -0,0 +1,243 @@
/*-
* BSD LICENSE
*
* Copyright (c) 2015-2017 Amazon.com, Inc. or its affiliates.
* 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
* OWNER 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 "ena_sysctl.h"
static int ena_sysctl_update_stats(SYSCTL_HANDLER_ARGS);
static void ena_sysctl_add_stats(struct ena_adapter *);
void
ena_sysctl_add_nodes(struct ena_adapter *adapter)
{
ena_sysctl_add_stats(adapter);
}
static void
ena_sysctl_add_stats(struct ena_adapter *adapter)
{
device_t dev;
struct ena_ring *tx_ring;
struct ena_ring *rx_ring;
struct ena_hw_stats *hw_stats;
struct ena_stats_dev *dev_stats;
struct ena_stats_tx *tx_stats;
struct ena_stats_rx *rx_stats;
struct ena_com_stats_admin *admin_stats;
struct sysctl_ctx_list *ctx;
struct sysctl_oid *tree;
struct sysctl_oid_list *child;
struct sysctl_oid *queue_node, *tx_node, *rx_node, *hw_node;
struct sysctl_oid *admin_node;
struct sysctl_oid_list *queue_list, *tx_list, *rx_list, *hw_list;
struct sysctl_oid_list *admin_list;
#define QUEUE_NAME_LEN 32
char namebuf[QUEUE_NAME_LEN];
int i;
dev = adapter->pdev;
ctx = device_get_sysctl_ctx(dev);
tree = device_get_sysctl_tree(dev);
child = SYSCTL_CHILDREN(tree);
tx_ring = adapter->tx_ring;
rx_ring = adapter->rx_ring;
hw_stats = &adapter->hw_stats;
dev_stats = &adapter->dev_stats;
admin_stats = &adapter->ena_dev->admin_queue.stats;
SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "tx_timeout",
CTLFLAG_RD, &dev_stats->tx_timeout,
"Driver TX timeouts");
SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "io_suspend",
CTLFLAG_RD, &dev_stats->io_suspend,
"IO queue suspends");
SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "io_resume",
CTLFLAG_RD, &dev_stats->io_resume,
"IO queue resumes");
SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "wd_expired",
CTLFLAG_RD, &dev_stats->wd_expired,
"Watchdog expiry count");
SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "interface_up",
CTLFLAG_RD, &dev_stats->interface_up,
"Network interface up count");
SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "interface_down",
CTLFLAG_RD, &dev_stats->interface_down,
"Network interface down count");
SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "admin_q_pause",
CTLFLAG_RD, &dev_stats->admin_q_pause,
"Admin queue pauses");
for (i = 0; i < adapter->num_queues; ++i, ++tx_ring, ++rx_ring) {
snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i);
queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO,
namebuf, CTLFLAG_RD, NULL, "Queue Name");
queue_list = SYSCTL_CHILDREN(queue_node);
/* TX specific stats */
tx_node = SYSCTL_ADD_NODE(ctx, queue_list, OID_AUTO,
"tx_ring", CTLFLAG_RD, NULL, "TX ring");
tx_list = SYSCTL_CHILDREN(tx_node);
tx_stats = &tx_ring->tx_stats;
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"count", CTLFLAG_RD,
&tx_stats->cnt, "Packets sent");
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"bytes", CTLFLAG_RD,
&tx_stats->bytes, "Bytes sent");
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"prepare_ctx_err", CTLFLAG_RD,
&tx_stats->prepare_ctx_err,
"TX buffer preparation failures");
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"queue_wakeup", CTLFLAG_RD,
&tx_stats->queue_wakeup, "Queue wakeups");
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"dma_mapping_err", CTLFLAG_RD,
&tx_stats->dma_mapping_err, "DMA mapping failures");
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"unsupported_desc_num", CTLFLAG_RD,
&tx_stats->unsupported_desc_num,
"Excessive descriptor packet discards");
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"napi_comp", CTLFLAG_RD,
&tx_stats->napi_comp, "Napi completions");
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"tx_poll", CTLFLAG_RD,
&tx_stats->tx_poll, "TX poll count");
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"doorbells", CTLFLAG_RD,
&tx_stats->doorbells, "Queue doorbells");
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"missing_tx_comp", CTLFLAG_RD,
&tx_stats->missing_tx_comp, "TX completions missed");
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"bad_req_id", CTLFLAG_RD,
&tx_stats->bad_req_id, "Bad request id count");
SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
"stops", CTLFLAG_RD,
&tx_stats->queue_stop, "Queue stops");
/* RX specific stats */
rx_node = SYSCTL_ADD_NODE(ctx, queue_list, OID_AUTO,
"rx_ring", CTLFLAG_RD, NULL, "RX ring");
rx_list = SYSCTL_CHILDREN(rx_node);
rx_stats = &rx_ring->rx_stats;
SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
"count", CTLFLAG_RD,
&rx_stats->cnt, "Packets received");
SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
"bytes", CTLFLAG_RD,
&rx_stats->bytes, "Bytes received");
SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
"refil_partial", CTLFLAG_RD,
&rx_stats->refil_partial, "Partial refilled mbufs");
SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
"bad_csum", CTLFLAG_RD,
&rx_stats->bad_csum, "Bad RX checksum");
SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
"page_alloc_fail", CTLFLAG_RD,
&rx_stats->page_alloc_fail, "Failed page allocs");
SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
"mbuf_alloc_fail", CTLFLAG_RD,
&rx_stats->mbuf_alloc_fail, "Failed mbuf allocs");
SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
"dma_mapping_err", CTLFLAG_RD,
&rx_stats->dma_mapping_err, "DMA mapping errors");
SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
"bad_desc_num", CTLFLAG_RD,
&rx_stats->bad_desc_num, "Bad descriptor count");
SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
"small_copy_len_pkt", CTLFLAG_RD,
&rx_stats->small_copy_len_pkt, "Small copy packet count");
}
/* Stats read from device */
hw_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "hw_stats",
CTLFLAG_RD, NULL, "Statistics from hardware");
hw_list = SYSCTL_CHILDREN(hw_node);
SYSCTL_ADD_U64(ctx, hw_list, OID_AUTO, "rx_packets", CTLFLAG_RD,
&hw_stats->rx_packets, 0, "Packets received");
SYSCTL_ADD_U64(ctx, hw_list, OID_AUTO, "tx_packets", CTLFLAG_RD,
&hw_stats->tx_packets, 0, "Packets transmitted");
SYSCTL_ADD_U64(ctx, hw_list, OID_AUTO, "rx_bytes", CTLFLAG_RD,
&hw_stats->rx_bytes, 0, "Bytes received");
SYSCTL_ADD_U64(ctx, hw_list, OID_AUTO, "tx_bytes", CTLFLAG_RD,
&hw_stats->tx_bytes, 0, "Bytes transmitted");
SYSCTL_ADD_U64(ctx, hw_list, OID_AUTO, "rx_drops", CTLFLAG_RD,
&hw_stats->rx_drops, 0, "Receive packet drops");
SYSCTL_ADD_PROC(ctx, hw_list, OID_AUTO, "update_stats",
CTLTYPE_INT|CTLFLAG_RD, adapter, 0, ena_sysctl_update_stats,
"A", "Update stats from hardware");
/* ENA Admin queue stats */
admin_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "admin_stats",
CTLFLAG_RD, NULL, "ENA Admin Queue statistics");
admin_list = SYSCTL_CHILDREN(admin_node);
SYSCTL_ADD_U32(ctx, admin_list, OID_AUTO, "aborted_cmd", CTLFLAG_RD,
&admin_stats->aborted_cmd, 0, "Aborted commands");
SYSCTL_ADD_U32(ctx, admin_list, OID_AUTO, "sumbitted_cmd", CTLFLAG_RD,
&admin_stats->submitted_cmd, 0, "Submitted commands");
SYSCTL_ADD_U32(ctx, admin_list, OID_AUTO, "completed_cmd", CTLFLAG_RD,
&admin_stats->completed_cmd, 0, "Completed commands");
SYSCTL_ADD_U32(ctx, admin_list, OID_AUTO, "out_of_space", CTLFLAG_RD,
&admin_stats->out_of_space, 0, "Queue out of space");
SYSCTL_ADD_U32(ctx, admin_list, OID_AUTO, "no_completion", CTLFLAG_RD,
&admin_stats->no_completion, 0, "Commands not completed");
}
static int
ena_sysctl_update_stats(SYSCTL_HANDLER_ARGS)
{
struct ena_adapter *adapter = (struct ena_adapter *)arg1;
int rc;
if (adapter->up)
ena_update_stats_counters(adapter);
rc = sysctl_handle_string(oidp, "", 1, req);
return (rc);
}

44
sys/dev/ena/ena_sysctl.h Normal file
View file

@ -0,0 +1,44 @@
/*-
* BSD LICENSE
*
* Copyright (c) 2015-2017 Amazon.com, Inc. or its affiliates.
* 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
* OWNER 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 ENA_SYSCTL_H
#define ENA_SYSCTL_H
#include <sys/types.h>
#include <sys/sysctl.h>
#include "ena.h"
void ena_sysctl_add_nodes(struct ena_adapter *);
#endif /* !(ENA_SYSCTL_H) */

View file

@ -1224,7 +1224,6 @@ xn_rxeof(struct netfront_rxq *rxq)
RING_FINAL_CHECK_FOR_RESPONSES(&rxq->ring, work_to_do);
} while (work_to_do);
XN_RX_UNLOCK(rxq);
mbufq_drain(&mbufq_errq);
/*
* Process all the mbufs after the remapping is complete.
@ -1253,7 +1252,6 @@ xn_rxeof(struct netfront_rxq *rxq)
*/
tcp_lro_flush_all(lro);
#endif
XN_RX_LOCK(rxq);
}
static void

View file

@ -98,7 +98,7 @@
#define MSDOSFSROOT_OFS 0x1fffffff
/*
* The fat cache structure. fc_fsrcn is the filesystem relative cluster
* The FAT cache structure. fc_fsrcn is the filesystem relative cluster
* number that corresponds to the file relative cluster number in this
* structure (fc_frcn).
*/
@ -108,11 +108,11 @@ struct fatcache {
};
/*
* The fat entry cache as it stands helps make extending files a "quick"
* operation by avoiding having to scan the fat to discover the last
* The FAT entry cache as it stands helps make extending files a "quick"
* operation by avoiding having to scan the FAT to discover the last
* cluster of the file. The cache also helps sequential reads by
* remembering the last cluster read from the file. This also prevents us
* from having to rescan the fat to find the next cluster to read. This
* from having to rescan the FAT to find the next cluster to read. This
* cache is probably pretty worthless if a file is opened by multiple
* processes.
*/
@ -126,7 +126,7 @@ struct fatcache {
#define FCE_EMPTY 0xffffffff /* doesn't represent an actual cluster # */
/*
* Set a slot in the fat cache.
* Set a slot in the FAT cache.
*/
#define fc_setcache(dep, slot, frcn, fsrcn) \
(dep)->de_fc[(slot)].fc_frcn = (frcn); \
@ -156,7 +156,7 @@ struct denode {
u_short de_MDate; /* modification date */
u_long de_StartCluster; /* starting cluster of file */
u_long de_FileSize; /* size of file in bytes */
struct fatcache de_fc[FC_SIZE]; /* fat cache */
struct fatcache de_fc[FC_SIZE]; /* FAT cache */
u_quad_t de_modrev; /* Revision level for lease. */
uint64_t de_inode; /* Inode number (really byte offset of direntry) */
};

View file

@ -66,10 +66,10 @@
/*
* MSDOSFS:
* Return true if filesystem uses 12 bit fats. Microsoft Programmer's
* Return true if filesystem uses 12 bit FATs. Microsoft Programmer's
* Reference says if the maximum cluster number in a filesystem is greater
* than 4078 ((CLUST_RSRVS - CLUST_FIRST) & FAT12_MASK) then we've got a
* 16 bit fat filesystem. While mounting, the result of this test is stored
* than 4084 ((CLUST_RSRVD - CLUST_FIRST) & FAT12_MASK) then we've got a
* 16 bit FAT filesystem. While mounting, the result of this test is stored
* in pm_fatentrysize.
*/
#define FAT12(pmp) (pmp->pm_fatmask == FAT12_MASK)
@ -83,8 +83,8 @@
* These are the values for the function argument to the function
* fatentry().
*/
#define FAT_GET 0x0001 /* get a fat entry */
#define FAT_SET 0x0002 /* set a fat entry */
#define FAT_GET 0x0001 /* get a FAT entry */
#define FAT_SET 0x0002 /* set a FAT entry */
#define FAT_GET_AND_SET (FAT_GET | FAT_SET)
/*

View file

@ -73,7 +73,7 @@ static uint16_t unix2winchr(const u_char **, size_t *, int, struct msdosfsmount
* 2 - character ('.' and ' ') should be skipped in DOS file name,
* and generation number inserted.
*/
static u_char
static const u_char
unix2dos[256] = {
/* iso8859-1 -> cp850 */
0, 0, 0, 0, 0, 0, 0, 0, /* 00-07 */
@ -110,7 +110,7 @@ unix2dos[256] = {
0x9d, 0xeb, 0xe9, 0xea, 0x9a, 0xed, 0xe8, 0x98, /* f8-ff */
};
static u_char
static const u_char
dos2unix[256] = {
/* cp850 -> iso8859-1 */
0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, /* 00-07 */
@ -147,7 +147,7 @@ dos2unix[256] = {
0xb0, 0xa8, 0xb7, 0xb9, 0xb3, 0xb2, 0x3f, 0x3f, /* f8-ff */
};
static u_char
static const u_char
u2l[256] = {
/* tolower */
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 00-07 */
@ -184,7 +184,7 @@ u2l[256] = {
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* f8-ff */
};
static u_char
static const u_char
l2u[256] = {
/* toupper */
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 00-07 */

View file

@ -160,7 +160,7 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset,
ldep->de_diroffset = diroffset;
ldep->de_inode = inode;
lockmgr(nvp->v_vnlock, LK_EXCLUSIVE, NULL);
fc_purge(ldep, 0); /* init the fat cache for this denode */
fc_purge(ldep, 0); /* init the FAT cache for this denode */
error = insmntque(nvp, mntp);
if (error != 0) {
free(ldep, M_MSDOSFSNODE);

View file

@ -176,8 +176,8 @@ pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int *sp)
*sp = pmp->pm_bpcluster;
/*
* Rummage around in the fat cache, maybe we can avoid tromping
* through every fat entry for the file. And, keep track of how far
* Rummage around in the FAT cache, maybe we can avoid tromping
* through every FAT entry for the file. And, keep track of how far
* off the cache was from where we wanted to be.
*/
i = 0;
@ -244,13 +244,13 @@ hiteof:;
*cnp = i;
if (bp)
brelse(bp);
/* update last file cluster entry in the fat cache */
/* update last file cluster entry in the FAT cache */
fc_setcache(dep, FC_LASTFC, i - 1, prevcn);
return (E2BIG);
}
/*
* Find the closest entry in the fat cache to the cluster we are looking
* Find the closest entry in the FAT cache to the cluster we are looking
* for.
*/
static void
@ -276,7 +276,7 @@ fc_lookup(struct denode *dep, u_long findcn, u_long *frcnp, u_long *fsrcnp)
}
/*
* Purge the fat cache in denode dep of all entries relating to file
* Purge the FAT cache in denode dep of all entries relating to file
* relative cluster frcn and beyond.
*/
void
@ -295,13 +295,13 @@ fc_purge(struct denode *dep, u_int frcn)
}
/*
* Update the fat.
* If mirroring the fat, update all copies, with the first copy as last.
* Else update only the current fat (ignoring the others).
* Update the FAT.
* If mirroring the FAT, update all copies, with the first copy as last.
* Else update only the current FAT (ignoring the others).
*
* pmp - msdosfsmount structure for filesystem to update
* bp - addr of modified fat block
* fatbn - block number relative to begin of filesystem of the modified fat block.
* bp - addr of modified FAT block
* fatbn - block number relative to begin of filesystem of the modified FAT block.
*/
static void
updatefats(struct msdosfsmount *pmp, struct buf *bp, u_long fatbn)
@ -315,12 +315,12 @@ updatefats(struct msdosfsmount *pmp, struct buf *bp, u_long fatbn)
if (pmp->pm_flags & MSDOSFS_FATMIRROR) {
/*
* Now copy the block(s) of the modified fat to the other copies of
* the fat and write them out. This is faster than reading in the
* other fats and then writing them back out. This could tie up
* the fat for quite a while. Preventing others from accessing it.
* To prevent us from going after the fat quite so much we use
* delayed writes, unless they specfied "synchronous" when the
* Now copy the block(s) of the modified FAT to the other copies of
* the FAT and write them out. This is faster than reading in the
* other FATs and then writing them back out. This could tie up
* the FAT for quite a while. Preventing others from accessing it.
* To prevent us from going after the FAT quite so much we use
* delayed writes, unless they specified "synchronous" when the
* filesystem was mounted. If synch is asked for then use
* bwrite()'s and really slow things down.
*/
@ -349,7 +349,7 @@ updatefats(struct msdosfsmount *pmp, struct buf *bp, u_long fatbn)
}
/*
* Write out the first (or current) fat last.
* Write out the first (or current) FAT last.
*/
if (pmp->pm_mountp->mnt_flag & MNT_SYNCHRONOUS)
bwrite(bp);
@ -358,7 +358,7 @@ updatefats(struct msdosfsmount *pmp, struct buf *bp, u_long fatbn)
}
/*
* Updating entries in 12 bit fats is a pain in the butt.
* Updating entries in 12 bit FATs is a pain in the butt.
*
* The following picture shows where nibbles go when moving from a 12 bit
* cluster number into the appropriate bytes in the FAT.
@ -436,21 +436,21 @@ clusterfree(struct msdosfsmount *pmp, u_long cluster, u_long *oldcnp)
}
/*
* Get or Set or 'Get and Set' the cluster'th entry in the fat.
* Get or Set or 'Get and Set' the cluster'th entry in the FAT.
*
* function - whether to get or set a fat entry
* function - whether to get or set a FAT entry
* pmp - address of the msdosfsmount structure for the filesystem
* whose fat is to be manipulated.
* whose FAT is to be manipulated.
* cn - which cluster is of interest
* oldcontents - address of a word that is to receive the contents of the
* cluster'th entry if this is a get function
* newcontents - the new value to be written into the cluster'th element of
* the fat if this is a set function.
* the FAT if this is a set function.
*
* This function can also be used to free a cluster by setting the fat entry
* This function can also be used to free a cluster by setting the FAT entry
* for a cluster to 0.
*
* All copies of the fat are updated if this is a set function. NOTE: If
* All copies of the FAT are updated if this is a set function. NOTE: If
* fatentry() marks a cluster as free it does not update the inusemap in
* the msdosfsmount structure. This is left to the caller.
*/
@ -513,7 +513,7 @@ fatentry(int function, struct msdosfsmount *pmp, u_long cn, u_long *oldcontents,
if (FAT12(pmp) & (cn & 1))
readcn >>= 4;
readcn &= pmp->pm_fatmask;
/* map reserved fat entries to same values for all fats */
/* map reserved FAT entries to same values for all FATs */
if ((readcn | ~pmp->pm_fatmask) >= CLUST_RSRVD)
readcn |= ~pmp->pm_fatmask;
*oldcontents = readcn;
@ -537,7 +537,7 @@ fatentry(int function, struct msdosfsmount *pmp, u_long cn, u_long *oldcontents,
case FAT32_MASK:
/*
* According to spec we have to retain the
* high order bits of the fat entry.
* high order bits of the FAT entry.
*/
readcn = getulong(&bp->b_data[bo]);
readcn &= ~FAT32_MASK;
@ -560,7 +560,7 @@ fatentry(int function, struct msdosfsmount *pmp, u_long cn, u_long *oldcontents,
* pmp - mount point
* start - first cluster of chain
* count - number of clusters in chain
* fillwith - what to write into fat entry of last cluster
* fillwith - what to write into FAT entry of last cluster
*/
static int
fatchain(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith)
@ -685,7 +685,7 @@ chainlength(struct msdosfsmount *pmp, u_long start, u_long count)
* pmp - mount point.
* start - start of cluster chain.
* count - number of clusters to allocate.
* fillwith - put this value into the fat entry for the
* fillwith - put this value into the FAT entry for the
* last allocated cluster.
* retcluster - put the first allocated cluster's number here.
* got - how many clusters were actually allocated.
@ -730,7 +730,7 @@ chainalloc(struct msdosfsmount *pmp, u_long start, u_long count,
* pmp - mount point.
* start - preferred start of cluster chain.
* count - number of clusters requested.
* fillwith - put this value into the fat entry for the
* fillwith - put this value into the FAT entry for the
* last allocated cluster.
* retcluster - put the first allocated cluster's number here.
* got - how many clusters were actually allocated.
@ -882,7 +882,7 @@ freeclusterchain(struct msdosfsmount *pmp, u_long cluster)
}
/*
* Read in fat blocks looking for free clusters. For every free cluster
* Read in FAT blocks looking for free clusters. For every free cluster
* found turn off its corresponding bit in the pm_inusemap.
*/
int
@ -896,7 +896,7 @@ fillinusemap(struct msdosfsmount *pmp)
MSDOSFS_ASSERT_MP_LOCKED(pmp);
/*
* Mark all clusters in use, we mark the free ones in the fat scan
* Mark all clusters in use, we mark the free ones in the FAT scan
* loop further down.
*/
for (cn = 0; cn < (pmp->pm_maxcluster + N_INUSEBITS) / N_INUSEBITS; cn++)
@ -904,7 +904,7 @@ fillinusemap(struct msdosfsmount *pmp)
/*
* Figure how many free clusters are in the filesystem by ripping
* through the fat counting the number of entries whose content is
* through the FAT counting the number of entries whose content is
* zero. These represent free clusters.
*/
pmp->pm_freeclustercount = 0;
@ -1042,8 +1042,8 @@ extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp,
}
/*
* Update the "last cluster of the file" entry in the denode's fat
* cache.
* Update the "last cluster of the file" entry in the
* denode's FAT cache.
*/
fc_setcache(dep, FC_LASTFC, frcn + got - 1, cn + got - 1);

View file

@ -604,7 +604,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp)
<= ((CLUST_RSRVD - CLUST_FIRST) & FAT12_MASK)) {
/*
* This will usually be a floppy disk. This size makes
* sure that one fat entry will not be split across
* sure that one FAT entry will not be split across
* multiple blocks.
*/
pmp->pm_fatmask = FAT12_MASK;
@ -717,9 +717,9 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp)
goto error_exit;
/*
* If they want fat updates to be synchronous then let them suffer
* If they want FAT updates to be synchronous then let them suffer
* the performance degradation in exchange for the on disk copy of
* the fat being correct just about all the time. I suppose this
* the FAT being correct just about all the time. I suppose this
* would be a good thing to turn on if the kernel is still flakey.
*/
if (mp->mnt_flag & MNT_SYNCHRONOUS)
@ -925,14 +925,14 @@ msdosfs_sync(struct mount *mp, int waitfor)
td = curthread;
/*
* If we ever switch to not updating all of the fats all the time,
* If we ever switch to not updating all of the FATs all the time,
* this would be the place to update them from the first one.
*/
if (pmp->pm_fmod != 0) {
if (pmp->pm_flags & MSDOSFSMNT_RONLY)
panic("msdosfs_sync: rofs mod");
else {
/* update fats here */
/* update FATs here */
}
}
/*

View file

@ -736,7 +736,7 @@ msdosfs_write(struct vop_write_args *ap)
vfs_bio_clrbuf(bp);
/*
* Do the bmap now, since pcbmap needs buffers
* for the fat table. (see msdosfs_strategy)
* for the FAT table. (see msdosfs_strategy)
*/
if (bp->b_blkno == bp->b_lblkno) {
error = pcbmap(dep, bp->b_lblkno, &bn, 0, 0);

View file

@ -65,7 +65,7 @@ MALLOC_DECLARE(M_MSDOSFSMNT);
struct msdosfs_fileno;
/*
* Layout of the mount control block for a msdos filesystem.
* Layout of the mount control block for a MSDOSFS filesystem.
*/
struct msdosfsmount {
struct mount *pm_mountp;/* vfs mount struct for this fs */
@ -73,7 +73,7 @@ struct msdosfsmount {
struct bufobj *pm_bo;
uid_t pm_uid; /* uid to set as owner of the files */
gid_t pm_gid; /* gid to set as owner of the files */
mode_t pm_mask; /* mask to and with file protection bits
mode_t pm_mask; /* mask to and with file protection bits
for files */
mode_t pm_dirmask; /* mask to and with file protection bits
for directories */
@ -81,7 +81,7 @@ struct msdosfsmount {
struct cdev *pm_dev; /* character device mounted */
struct bpb50 pm_bpb; /* BIOS parameter blk for this fs */
u_long pm_BlkPerSec; /* How many DEV_BSIZE blocks fit inside a physical sector */
u_long pm_FATsecs; /* actual number of fat sectors */
u_long pm_FATsecs; /* actual number of FAT sectors */
u_long pm_fatblk; /* block # of first FAT */
u_long pm_rootdirblk; /* block # (cluster # for FAT32) of root directory number */
u_long pm_rootdirsize; /* size in blocks (not clusters) */
@ -93,15 +93,15 @@ struct msdosfsmount {
u_long pm_bnshift; /* shift file offset right this amount to get a block number */
u_long pm_bpcluster; /* bytes per cluster */
u_long pm_fmod; /* ~0 if fs is modified, this can rollover to 0 */
u_long pm_fatblocksize; /* size of fat blocks in bytes */
u_long pm_fatblocksec; /* size of fat blocks in sectors */
u_long pm_fatsize; /* size of fat in bytes */
uint32_t pm_fatmask; /* mask to use for fat numbers */
u_long pm_fatblocksize; /* size of FAT blocks in bytes */
u_long pm_fatblocksec; /* size of FAT blocks in sectors */
u_long pm_fatsize; /* size of FAT in bytes */
uint32_t pm_fatmask; /* mask to use for FAT numbers */
u_long pm_fsinfo; /* fsinfo block number */
u_long pm_nxtfree; /* next place to search for a free cluster */
u_int pm_fatmult; /* these 2 values are used in fat */
u_int pm_fatmult; /* these 2 values are used in FAT */
u_int pm_fatdiv; /* offset computation */
u_int pm_curfat; /* current fat for FAT32 (0 otherwise) */
u_int pm_curfat; /* current FAT for FAT32 (0 otherwise) */
u_int *pm_inusemap; /* ptr to bitmap of in-use clusters */
uint64_t pm_flags; /* see below */
void *pm_u2w; /* Local->Unicode iconv handle */

View file

@ -459,14 +459,6 @@ symlinkat
unlinkat
utimensat
##
## Allow entry into open(2). This system call will fail, since access to the
## global file namespace has been disallowed, but allowing entry into the
## syscall means that an audit trail will be generated (which is also very
## useful for debugging).
##
open
##
## Process descriptor-related system calls are allowed.
##

View file

@ -50,7 +50,7 @@ struct sysent sysent[] = {
{ 0, (sy_call_t *)sys_fork, AUE_FORK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 2 = fork */
{ AS(read_args), (sy_call_t *)sys_read, AUE_READ, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 3 = read */
{ AS(write_args), (sy_call_t *)sys_write, AUE_WRITE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 4 = write */
{ AS(open_args), (sy_call_t *)sys_open, AUE_OPEN_RWTC, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 5 = open */
{ AS(open_args), (sy_call_t *)sys_open, AUE_OPEN_RWTC, NULL, 0, 0, 0, SY_THR_STATIC }, /* 5 = open */
{ AS(close_args), (sy_call_t *)sys_close, AUE_CLOSE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 6 = close */
{ AS(wait4_args), (sy_call_t *)sys_wait4, AUE_WAIT4, NULL, 0, 0, 0, SY_THR_STATIC }, /* 7 = wait4 */
{ compat(AS(ocreat_args),creat), AUE_CREAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 8 = old creat */

View file

@ -383,8 +383,8 @@ platform_start(__register_t a0 __unused, __register_t a1 __unused,
phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
phys_avail[1] = ctob(realmem);
dump_avail[0] = phys_avail[0];
dump_avail[1] = phys_avail[1] - phys_avail[0];
dump_avail[0] = 0;
dump_avail[1] = phys_avail[1];
physmem = realmem;

View file

@ -107,6 +107,7 @@ SUBDIR= \
${_efirt} \
${_elink} \
${_em} \
${_ena} \
${_ep} \
${_epic} \
esp \
@ -566,6 +567,7 @@ _drm= drm
_drm2= drm2
_ed= ed
_em= em
_ena= ena
_ep= ep
_et= et
_exca= exca

41
sys/modules/ena/Makefile Normal file
View file

@ -0,0 +1,41 @@
#
# BSD LICENSE
#
# Copyright (c) 2015-2017 Amazon.com, Inc. or its affiliates.
# 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
# OWNER 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$
#
.PATH: ${SRCTOP}/sys/dev/ena \
${SRCTOP}/sys/contrib/ena-com
KMOD = if_ena
SRCS = ena.c ena_com.c ena_eth_com.c ena_sysctl.c
SRCS += device_if.h bus_if.h pci_if.h
CFLAGS += -I${SRCTOP}/sys/contrib
.include <bsd.kmod.mk>

View file

@ -448,7 +448,7 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m,
if (IEEE80211_QOS_HAS_SEQ(wh) &&
TID_TO_WME_AC(tid) >= WME_AC_VI)
ic->ic_wme.wme_hipri_traffic++;
if (! ieee80211_check_rxseq(ni, wh, bssid))
if (! ieee80211_check_rxseq(ni, wh, bssid, rxs))
goto out;
}
}
@ -479,7 +479,7 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m,
* and we should do nothing more with it.
*/
if ((m->m_flags & M_AMPDU) &&
ieee80211_ampdu_reorder(ni, m) != 0) {
ieee80211_ampdu_reorder(ni, m, rxs) != 0) {
m = NULL;
goto out;
}

View file

@ -577,7 +577,7 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m,
if (IEEE80211_QOS_HAS_SEQ(wh) &&
TID_TO_WME_AC(tid) >= WME_AC_VI)
ic->ic_wme.wme_hipri_traffic++;
if (! ieee80211_check_rxseq(ni, wh, bssid))
if (! ieee80211_check_rxseq(ni, wh, bssid, rxs))
goto out;
}
}
@ -665,7 +665,7 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m,
* and we should do nothing more with it.
*/
if ((m->m_flags & M_AMPDU) &&
ieee80211_ampdu_reorder(ni, m) != 0) {
ieee80211_ampdu_reorder(ni, m, rxs) != 0) {
m = NULL;
goto out;
}

View file

@ -849,7 +849,8 @@ ampdu_rx_flush_upto(struct ieee80211_node *ni,
* the frame should be processed normally by the caller.
*/
int
ieee80211_ampdu_reorder(struct ieee80211_node *ni, struct mbuf *m)
ieee80211_ampdu_reorder(struct ieee80211_node *ni, struct mbuf *m,
const struct ieee80211_rx_stats *rxs)
{
#define PROCESS 0 /* caller should process frame */
#define CONSUMED 1 /* frame consumed, caller does nothing */

View file

@ -185,7 +185,8 @@ int ieee80211_setup_htrates(struct ieee80211_node *,
void ieee80211_setup_basic_htrates(struct ieee80211_node *,
const uint8_t *htinfo);
struct mbuf *ieee80211_decap_amsdu(struct ieee80211_node *, struct mbuf *);
int ieee80211_ampdu_reorder(struct ieee80211_node *, struct mbuf *);
int ieee80211_ampdu_reorder(struct ieee80211_node *, struct mbuf *,
const struct ieee80211_rx_stats *);
void ieee80211_recv_bar(struct ieee80211_node *, struct mbuf *);
void ieee80211_ht_node_init(struct ieee80211_node *);
void ieee80211_ht_node_cleanup(struct ieee80211_node *);

View file

@ -158,7 +158,7 @@ ishtinfooui(const uint8_t *frm)
*/
static __inline int
ieee80211_check_rxseq(struct ieee80211_node *ni, struct ieee80211_frame *wh,
uint8_t *bssid)
uint8_t *bssid, const struct ieee80211_rx_stats *rxs)
{
#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0)
#define SEQ_EQ(a,b) ((int)((a)-(b)) == 0)

View file

@ -1580,7 +1580,7 @@ mesh_input(struct ieee80211_node *ni, struct mbuf *m,
if (IEEE80211_QOS_HAS_SEQ(wh) &&
TID_TO_WME_AC(tid) >= WME_AC_VI)
ic->ic_wme.wme_hipri_traffic++;
if (! ieee80211_check_rxseq(ni, wh, wh->i_addr1))
if (! ieee80211_check_rxseq(ni, wh, wh->i_addr1, rxs))
goto out;
}
}

View file

@ -648,7 +648,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m,
if (IEEE80211_QOS_HAS_SEQ(wh) &&
TID_TO_WME_AC(tid) >= WME_AC_VI)
ic->ic_wme.wme_hipri_traffic++;
if (! ieee80211_check_rxseq(ni, wh, bssid))
if (! ieee80211_check_rxseq(ni, wh, bssid, rxs))
goto out;
}
}
@ -673,7 +673,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m,
if ((m->m_flags & M_AMPDU) &&
(dir == IEEE80211_FC1_DIR_FROMDS ||
dir == IEEE80211_FC1_DIR_DSTODS) &&
ieee80211_ampdu_reorder(ni, m) != 0) {
ieee80211_ampdu_reorder(ni, m, rxs) != 0) {
m = NULL;
goto out;
}

View file

@ -504,7 +504,7 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m,
if (IEEE80211_QOS_HAS_SEQ(wh) &&
TID_TO_WME_AC(tid) >= WME_AC_VI)
ic->ic_wme.wme_hipri_traffic++;
if (! ieee80211_check_rxseq(ni, wh, wh->i_addr1))
if (! ieee80211_check_rxseq(ni, wh, wh->i_addr1, rxs))
goto out;
}
switch (type) {
@ -540,7 +540,7 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m,
* and we should do nothing more with it.
*/
if ((m->m_flags & M_AMPDU) &&
ieee80211_ampdu_reorder(ni, m) != 0) {
ieee80211_ampdu_reorder(ni, m, rxs) != 0) {
m = NULL;
goto out;
}

View file

@ -597,6 +597,10 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
error = EINVAL;
goto out;
}
if ((inp->inp_vflag & INP_IPV4) == 0) {
error = EAFNOSUPPORT;
goto out;
}
in6_sin6_2_sin(&sin, sin6p);
inp->inp_vflag |= INP_IPV4;
@ -614,6 +618,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
#endif
error = tp->t_fb->tfb_tcp_output(tp);
goto out;
} else {
if ((inp->inp_vflag & INP_IPV6) == 0) {
error = EAFNOSUPPORT;
goto out;
}
}
#endif
inp->inp_vflag &= ~INP_IPV4;

View file

@ -1119,6 +1119,10 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
error = EINVAL;
goto out;
}
if ((inp->inp_vflag & INP_IPV4) == 0) {
error = EAFNOSUPPORT;
goto out;
}
if (inp->inp_faddr.s_addr != INADDR_ANY) {
error = EISCONN;
goto out;
@ -1136,6 +1140,11 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
if (error == 0)
soisconnected(so);
goto out;
} else {
if ((inp->inp_vflag & INP_IPV6) == 0) {
error = EAFNOSUPPORT;
goto out;
}
}
#endif
if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {

View file

@ -163,7 +163,8 @@ main (int argc, char *argv[])
printf("kevent %d %d errno %d return.ident %p "
"return.data %p return.udata %p %p\n",
i, result, error,
kq_returned.ident, kq_returned.data,
(void*)kq_returned.ident,
(void*)kq_returned.data,
kq_returned.udata,
kq_iocb);
#endif
@ -171,7 +172,7 @@ main (int argc, char *argv[])
if (kq_iocb)
break;
#ifdef DEBUG
printf("Try again left %d out of %d %d\n",
printf("Try again left %d out of %lu %d\n",
pending, nitems(iocb), cancel);
#endif
}

View file

@ -55,7 +55,8 @@
#define PATH_TEMPLATE "aio.XXXXXXXXXX"
#define LIO_MAX 5
#define MAX_IOCBS LIO_MAX * 16
#define IOCBS_PER_LIO 16
#define MAX_IOCBS (LIO_MAX * IOCBS_PER_LIO)
#define MAX_RUNS 300
int
@ -103,9 +104,9 @@ main(int argc, char *argv[])
#endif
for (j = 0; j < LIO_MAX; j++) {
lio[j] =
malloc(sizeof(struct aiocb *) * MAX_IOCBS/LIO_MAX);
for (i = 0; i < MAX_IOCBS / LIO_MAX; i++) {
k = (MAX_IOCBS / LIO_MAX * j) + i;
malloc(sizeof(struct aiocb *) * IOCBS_PER_LIO);
for (i = 0; i < IOCBS_PER_LIO; i++) {
k = (IOCBS_PER_LIO * j) + i;
lio[j][i] = iocb[k] =
calloc(1, sizeof(struct aiocb));
iocb[k]->aio_nbytes = sizeof(buffer);
@ -115,7 +116,7 @@ main(int argc, char *argv[])
= iocb[k]->aio_nbytes * k * (run + 1);
#ifdef DEBUG
printf("hello iocb[k] %d\n",
printf("hello iocb[k] %ld\n",
iocb[k]->aio_offset);
#endif
iocb[k]->aio_lio_opcode = LIO_WRITE;
@ -125,11 +126,11 @@ main(int argc, char *argv[])
sig.sigev_notify = SIGEV_KEVENT;
time(&time1);
result = lio_listio(LIO_NOWAIT, lio[j],
MAX_IOCBS / LIO_MAX, &sig);
IOCBS_PER_LIO, &sig);
error = errno;
time(&time2);
#ifdef DEBUG
printf("Time %d %d %d result -> %d\n",
printf("Time %ld %ld %ld result -> %d\n",
time1, time2, time2-time1, result);
#endif
if (result != 0) {
@ -169,7 +170,8 @@ main(int argc, char *argv[])
printf("kevent %d %d errno %d return.ident %p "
"return.data %p return.udata %p %p\n",
i, result, error,
kq_returned.ident, kq_returned.data,
(void*)kq_returned.ident,
(void*)kq_returned.data,
kq_returned.udata,
lio[j]);
#endif

View file

@ -4514,6 +4514,7 @@ OLD_LIBS+=${DEBUG_LIB32_LIBS}
OLD_LIBS+=lib/libcxxrt.so.1
OLD_FILES+=usr/lib/libc++.a
OLD_FILES+=usr/lib/libc++_p.a
OLD_FILES+=usr/lib/libc++experimental.a
OLD_FILES+=usr/lib/libc++.so
OLD_LIBS+=usr/lib/libc++.so.1
OLD_FILES+=usr/lib/libcxxrt.a

View file

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd December 3, 2005
.Dd May 22, 2017
.Dt CATMAN 1
.Os
.Sh NAME
@ -40,6 +40,8 @@ The
utility preformats all the man pages in
.Ar directories
using the
.Nm mandoc
command when supported, falling back on the
.Nm nroff Fl man
command.
Directories may be separated by colons instead of spaces.
@ -99,6 +101,7 @@ environment variable is not set.
.Sh SEE ALSO
.Xr makewhatis 1 ,
.Xr man 1 ,
.Xr mandoc 1 ,
.Xr nroff 1
.Sh HISTORY
A previous version of the

View file

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <locale.h>
#include <langinfo.h>
#include <libgen.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -70,6 +71,8 @@ static char *lang_locale; /* short form of locale */
static const char *machine, *machine_arch;
static int exit_code; /* exit code to use when finished */
extern char **environ;
/*
* -T argument for nroff
*/
@ -93,6 +96,7 @@ static const char *locale_device[] = {
#define GZCAT_CMD "z"
enum Ziptype {NONE, BZIP, GZIP};
static bool mandoc_locales = false;
static uid_t uid;
static int starting_dir;
static char tmp_file[MAXPATHLEN];
@ -438,11 +442,24 @@ process_page(char *mandir, char *src, char *cat, enum Ziptype zipped)
}
snprintf(tmp_file, sizeof tmp_file, "%s.tmp", cat);
snprintf(cmd, sizeof cmd,
"%scat %s | tbl | nroff -c -T%s -man | %s > %s.tmp",
"%scat %s | mandoc -Tlint -Wunsupp 2>/dev/null",
zipped == BZIP ? BZ2CAT_CMD : zipped == GZIP ? GZCAT_CMD : "",
src, nroff_device,
zipped == BZIP ? BZ2_CMD : zipped == GZIP ? GZ_CMD : "cat",
cat);
src);
if (system(cmd) == 0) {
snprintf(cmd, sizeof cmd,
"%scat %s | mandoc -T%s | %s > %s.tmp",
zipped == BZIP ? BZ2CAT_CMD : zipped == GZIP ? GZCAT_CMD : "",
src, mandoc_locales ? "locale" : "ascii",
zipped == BZIP ? BZ2_CMD : zipped == GZIP ? GZ_CMD : "cat",
cat);
} else {
snprintf(cmd, sizeof cmd,
"%scat %s | tbl | nroff -c -T%s -man | %s > %s.tmp",
zipped == BZIP ? BZ2CAT_CMD : zipped == GZIP ? GZCAT_CMD : "",
src, nroff_device,
zipped == BZIP ? BZ2_CMD : zipped == GZIP ? GZ_CMD : "cat",
cat);
}
if (system(cmd) != 0)
err(1, "formatting pipeline");
if (rename(tmp_file, cat) < 0)
@ -771,6 +788,7 @@ main(int argc, char **argv)
break;
case 'L':
determine_locale();
mandoc_locales = true;
break;
case 'n':
pretend++;

View file

@ -1,6 +1,8 @@
# @(#)Makefile 8.2 (Berkeley) 4/17/94
# $FreeBSD$
.include <src.opts.mk>
PROG= compress
SRCS= compress.c zopen.c
LINKS= ${BINDIR}/compress ${BINDIR}/uncompress
@ -9,4 +11,8 @@ MLINKS= compress.1 uncompress.1
# XXX zopen is not part of libc
# MAN=zopen.3
.if ${MK_TESTS} != "no"
SUBDIR+= tests
.endif
.include <bsd.prog.mk>

View file

@ -129,7 +129,7 @@ main(int argc, char *argv[])
exit (eval);
}
if (cat == 1 && argc > 1)
if (cat == 1 && style == COMPRESS && argc > 1)
errx(1, "the -c option permits only a single file argument");
for (; *argv; ++argv)

View file

@ -0,0 +1,7 @@
# $FreeBSD$
PACKAGE= tests
ATF_TESTS_SH= compress_test
.include <bsd.test.mk>

View file

@ -0,0 +1,196 @@
# Copyright (c) 2017 Jilles Tjoelker <jilles@FreeBSD.org>
# 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 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$
atf_test_case uncompress_file_1
uncompress_file_1_head()
{
atf_set "descr" \
"Test uncompress without options, filename with .Z"
}
uncompress_file_1_body()
{
printf '%01000d\n' 7 >expectfile1
printf "\
\037\235\220\060\002\012\034\110\260\240\301\203\010\023\052\134\
\310\260\241\303\207\020\043\112\234\110\261\242\305\213\030\063\
\152\334\310\261\243\307\217\040\103\212\034\111\262\244\311\223\
\050\123\252\134\211\360\206\002" >file1.Z
atf_check uncompress file1.Z
atf_check cmp file1 expectfile1
atf_check test ! -e file1.Z
}
atf_test_case uncompress_file_2
uncompress_file_2_head()
{
atf_set "descr" \
"Test uncompress without options, filename without .Z"
}
uncompress_file_2_body()
{
printf '%01000d\n' 7 >expectfile1
printf "\
\037\235\220\060\002\012\034\110\260\240\301\203\010\023\052\134\
\310\260\241\303\207\020\043\112\234\110\261\242\305\213\030\063\
\152\334\310\261\243\307\217\040\103\212\034\111\262\244\311\223\
\050\123\252\134\211\360\206\002" >file1.Z
atf_check uncompress file1
atf_check cmp file1 expectfile1
atf_check test ! -e file1.Z
}
atf_test_case uncompress_stdio_1
uncompress_stdio_1_head()
{
atf_set "descr" \
"Test uncompress without parameters"
}
uncompress_stdio_1_body()
{
printf '%01000d\n' 7 >expectfile1
printf "\
\037\235\220\060\002\012\034\110\260\240\301\203\010\023\052\134\
\310\260\241\303\207\020\043\112\234\110\261\242\305\213\030\063\
\152\334\310\261\243\307\217\040\103\212\034\111\262\244\311\223\
\050\123\252\134\211\360\206\002" >file1.Z
atf_check -o file:expectfile1 -x 'uncompress <file1.Z'
}
atf_test_case uncompress_minusc_1
uncompress_minusc_1_head()
{
atf_set "descr" \
"Test uncompress with -c"
}
uncompress_minusc_1_body()
{
printf '%01000d\n' 7 >expectfile1
printf "\
\037\235\220\060\002\012\034\110\260\240\301\203\010\023\052\134\
\310\260\241\303\207\020\043\112\234\110\261\242\305\213\030\063\
\152\334\310\261\243\307\217\040\103\212\034\111\262\244\311\223\
\050\123\252\134\211\360\206\002" >file1.Z
atf_check -o file:expectfile1 uncompress -c file1.Z
atf_check test -e file1.Z
atf_check test ! -e file1
}
atf_test_case compress_uncompress_stdio_1
compress_uncompress_stdio_1_head()
{
atf_set "descr" \
"Test compressing and uncompressing some data, using stdio"
}
compress_uncompress_stdio_1_body()
{
printf '%01000d\n' 7 8 >expectfile1
atf_check -x 'compress <expectfile1 >file1.Z'
atf_check -o file:expectfile1 uncompress -c file1.Z
}
atf_test_case compress_uncompress_minusc_1
compress_uncompress_minusc_1_head()
{
atf_set "descr" \
"Test compressing and uncompressing some data, using -c"
}
compress_uncompress_minusc_1_body()
{
printf '%01000d\n' 7 8 >expectfile1
atf_check -x 'compress -c expectfile1 >file1.Z'
atf_check -o file:expectfile1 uncompress -c file1.Z
}
atf_test_case compress_uncompress_file_1
compress_uncompress_file_1_head()
{
atf_set "descr" \
"Test compressing and uncompressing some data, passing one filename"
}
compress_uncompress_file_1_body()
{
printf '%01000d\n' 7 8 >expectfile1
cp expectfile1 file1
atf_check compress file1
atf_check -s exit:1 cmp -s file1.Z expectfile1
atf_check uncompress file1.Z
atf_check cmp file1 expectfile1
}
atf_test_case compress_uncompress_file_2
compress_uncompress_file_2_head()
{
atf_set "descr" \
"Test compressing and uncompressing some data, passing two filenames"
}
compress_uncompress_file_2_body()
{
printf '%01000d\n' 7 8 >expectfile1
printf '%01000d\n' 8 7 >expectfile2
cp expectfile1 file1
cp expectfile2 file2
atf_check compress file1 file2
atf_check -s exit:1 cmp -s file1.Z expectfile1
atf_check -s exit:1 cmp -s file2.Z expectfile2
atf_check -s exit:1 cmp -s file1.Z file2.Z
atf_check uncompress file1.Z file2.Z
atf_check cmp file1 expectfile1
atf_check cmp file2 expectfile2
}
atf_test_case compress_uncompress_file_minusc_1
compress_uncompress_file_minusc_1_head()
{
atf_set "descr" \
"Test compressing and uncompressing some data, passing two filenames to uncompress -c"
}
compress_uncompress_file_minusc_1_body()
{
printf '%01000d\n' 7 8 >expectfile1
printf '%01000d\n' 8 7 >expectfile2
cp expectfile1 file1
cp expectfile2 file2
atf_check compress file1 file2
atf_check -s exit:1 cmp -s file1.Z expectfile1
atf_check -s exit:1 cmp -s file2.Z expectfile2
atf_check -s exit:1 cmp -s file1.Z file2.Z
atf_check -x 'uncompress -c file1.Z file2.Z >all'
atf_check -x 'cat expectfile1 expectfile2 >expectall'
atf_check cmp all expectall
}
atf_init_test_cases()
{
atf_add_test_case uncompress_file_1
atf_add_test_case uncompress_file_2
atf_add_test_case uncompress_stdio_1
atf_add_test_case uncompress_minusc_1
atf_add_test_case compress_uncompress_stdio_1
atf_add_test_case compress_uncompress_minusc_1
atf_add_test_case compress_uncompress_file_1
atf_add_test_case compress_uncompress_file_2
atf_add_test_case compress_uncompress_file_minusc_1
}

View file

@ -213,24 +213,24 @@ grep_fgetln(struct file *f, size_t *lenp)
if (grep_lnbufgrow(len + LNBUFBUMP))
goto error;
memcpy(lnbuf + off, bufpos, len - off);
/* With FILE_MMAP, this is EOF; there's no more to refill */
if (filebehave == FILE_MMAP) {
bufrem -= len;
break;
}
off = len;
/* Fetch more to try and find EOL/EOF */
if (grep_refill(f) != 0)
goto error;
if (bufrem == 0)
/* EOF: return partial line */
break;
if ((p = memchr(bufpos, fileeol, bufrem)) == NULL &&
filebehave != FILE_MMAP)
if ((p = memchr(bufpos, fileeol, bufrem)) == NULL)
continue;
if (p == NULL) {
/* mmap EOF: return partial line, consume buffer */
diff = len;
} else {
/* got it: finish up the line (like code above) */
++p;
diff = p - bufpos;
len += diff;
}
/* got it: finish up the line (like code above) */
++p;
diff = p - bufpos;
len += diff;
if (grep_lnbufgrow(len))
goto error;
memcpy(lnbuf + off, bufpos, diff);

View file

@ -90,6 +90,7 @@ struct file {
};
struct str {
off_t boff;
off_t off;
size_t len;
char *dat;

View file

@ -65,6 +65,7 @@ enqueue(struct str *x)
item->data.dat = grep_malloc(sizeof(char) * x->len);
item->data.len = x->len;
item->data.line_no = x->line_no;
item->data.boff = x->boff;
item->data.off = x->off;
memcpy(item->data.dat, x->dat, x->len);
item->data.file = x->file;

View file

@ -61,10 +61,12 @@ static bool first_match = true;
* other useful bits
*/
struct parsec {
regmatch_t matches[MAX_LINE_MATCHES]; /* Matches made */
struct str ln; /* Current line */
size_t matchidx; /* Latest used match index */
bool binary; /* Binary file? */
regmatch_t matches[MAX_LINE_MATCHES]; /* Matches made */
struct str ln; /* Current line */
size_t lnstart; /* Position in line */
size_t matchidx; /* Latest match index */
int printed; /* Metadata printed? */
bool binary; /* Binary file? */
};
@ -232,8 +234,10 @@ procfile(const char *fn)
strcpy(pc.ln.file, fn);
pc.ln.line_no = 0;
pc.ln.len = 0;
pc.ln.boff = 0;
pc.ln.off = -1;
pc.binary = f->binary;
pc.printed = 0;
tail = 0;
last_outed = 0;
same_file = false;
@ -247,8 +251,11 @@ procfile(const char *fn)
mcount = mlimit;
for (c = 0; c == 0 || !(lflag || qflag); ) {
/* Reset match count for every line processed */
/* Reset per-line statistics */
pc.printed = 0;
pc.matchidx = 0;
pc.lnstart = 0;
pc.ln.boff = 0;
pc.ln.off += pc.ln.len + 1;
if ((pc.ln.dat = grep_fgetln(f, &pc.ln.len)) == NULL ||
pc.ln.len == 0) {
@ -288,6 +295,14 @@ procfile(const char *fn)
/* Print the matching line, but only if not quiet/binary */
if (t == 0 && printmatch) {
printline(&pc, ':');
while (pc.matchidx >= MAX_LINE_MATCHES) {
/* Reset matchidx and try again */
pc.matchidx = 0;
if (procline(&pc) == 0)
printline(&pc, ':');
else
break;
}
first_match = false;
same_file = true;
last_outed = 0;
@ -295,7 +310,7 @@ procfile(const char *fn)
if (t != 0 && doctx) {
/* Deal with any -A context */
if (tail > 0) {
printline(&pc, '-');
grep_printline(&pc.ln, '-');
tail--;
if (Bflag > 0)
clearqueue();
@ -356,11 +371,11 @@ procline(struct parsec *pc)
{
regmatch_t pmatch, lastmatch, chkmatch;
wchar_t wbegin, wend;
size_t st = 0, nst = 0;
size_t st, nst;
unsigned int i;
int c = 0, r = 0, lastmatches = 0, leflags = eflags;
size_t startm = 0, matchidx;
int retry;
unsigned int retry;
matchidx = pc->matchidx;
@ -376,6 +391,8 @@ procline(struct parsec *pc)
} else if (matchall)
return (0);
st = pc->lnstart;
nst = 0;
/* Initialize to avoid a false positive warning from GCC. */
lastmatch.rm_so = lastmatch.rm_eo = 0;
@ -432,12 +449,12 @@ procline(struct parsec *pc)
* still match a whole word.
*/
if (r == REG_NOMATCH &&
(retry == 0 || pmatch.rm_so + 1 < retry))
(retry == pc->lnstart ||
pmatch.rm_so + 1 < retry))
retry = pmatch.rm_so + 1;
if (r == REG_NOMATCH)
continue;
}
lastmatches++;
lastmatch = pmatch;
@ -466,8 +483,11 @@ procline(struct parsec *pc)
}
/* avoid excessive matching - skip further patterns */
if ((color == NULL && !oflag) || qflag || lflag ||
matchidx >= MAX_LINE_MATCHES)
matchidx >= MAX_LINE_MATCHES) {
pc->lnstart = nst;
lastmatches = 0;
break;
}
}
/*
@ -475,7 +495,7 @@ procline(struct parsec *pc)
* again just in case we still have a chance to match later in
* the string.
*/
if (lastmatches == 0 && retry > 0) {
if (lastmatches == 0 && retry > pc->lnstart) {
st = retry;
continue;
}
@ -497,6 +517,7 @@ procline(struct parsec *pc)
/* Advance st based on previous matches */
st = nst;
pc->lnstart = st;
}
/* Reflect the new matchidx in the context */
@ -591,7 +612,7 @@ printline_metadata(struct str *line, int sep)
if (bflag) {
if (printsep)
putchar(sep);
printf("%lld", (long long)line->off);
printf("%lld", (long long)(line->off + line->boff));
printsep = true;
}
if (printsep)
@ -616,13 +637,22 @@ printline(struct parsec *pc, int sep)
/* --color and -o */
if ((oflag || color) && matchidx > 0) {
printline_metadata(&pc->ln, sep);
/* Only print metadata once per line if --color */
if (!oflag && pc->printed == 0)
printline_metadata(&pc->ln, sep);
for (i = 0; i < matchidx; i++) {
match = pc->matches[i];
/* Don't output zero length matches */
if (match.rm_so == match.rm_eo)
continue;
if (!oflag)
/*
* Metadata is printed on a per-line basis, so every
* match gets file metadata with the -o flag.
*/
if (oflag) {
pc->ln.boff = match.rm_so;
printline_metadata(&pc->ln, sep);
} else
fwrite(pc->ln.dat + a, match.rm_so - a, 1,
stdout);
if (color)
@ -643,4 +673,5 @@ printline(struct parsec *pc, int sep)
}
} else
grep_printline(&pc->ln, sep);
pc->printed++;
}

View file

@ -42,6 +42,11 @@ f_include $BSDCFG_SHARE/variable.subr
# DISTRIBUTIONS
# BSDINSTALL_DISTDIR
#
# Default name of the ZFS boot-pool
#
: ${ZFSBOOT_POOL_NAME:=zroot}
############################################################ GLOBALS
#
@ -53,8 +58,6 @@ msg_installation_error="Installation Error!"
error()
{
[ -f "$PATH_FSTAB" ] && bsdinstall umount
local file
f_getvar "$VAR_DEBUG_FILE#+" file
if [ "$file" ]; then
@ -63,6 +66,13 @@ error()
# No need to restore title, pining for the fjords
fi
[ -f "$PATH_FSTAB" ] || exit
if [ "$ZFSBOOT_DISKS" ]; then
zpool export $ZFSBOOT_POOL_NAME
else
bsdinstall umount
fi
exit 1
}
@ -99,12 +109,15 @@ if [ "$ZFSBOOT_DISKS" ]; then
bsdinstall zfsboot
else
bsdinstall scriptedpart "$PARTITIONS"
bsdinstall mount
fi
bsdinstall mount
# Unpack distributions
bsdinstall checksum
bsdinstall distextract
for set in $DISTRIBUTIONS; do
f_dprintf "Extracting $BSDINSTALL_DISTDIR/$set"
tar -xf "$BSDINSTALL_DISTDIR/$set" -C $BSDINSTALL_CHROOT
done
# Finalize install
bsdinstall config
@ -125,7 +138,11 @@ if [ -f /tmp/bsdinstall-installscript-ab ]; then
fi
bsdinstall entropy
bsdinstall umount
if [ "$ZFSBOOT_DISKS" ]; then
zpool export $ZFSBOOT_POOL_NAME
else
bsdinstall umount
fi
f_dprintf "Installation Completed at %s" "$( date )"

View file

@ -24,12 +24,12 @@
.\"
.\" $FreeBSD$
.\"
.Dd March 4, 2017
.Dd May 22, 2017
.Dt EFIVAR 8
.Os
.Sh NAME
.Nm efivar
.Nd UEFI environemnt variable interaction
.Nd UEFI environment variable interaction
.Sh SYNOPSIS
.Nm
.Op Fl abdDHlLNpRtw
@ -58,7 +58,7 @@ This program manages
.Pq UEFI
environment variables.
UEFI variables have three part: A namespace, a name and a value.
The namespace is a GUID that's self assigned by the group defining the
The namespace is a GUID that is self assigned by the group defining the
variables.
The name is a Unicode name for the variable.
The value is binary data.
@ -70,7 +70,7 @@ The following options are available:
Specify the name of the variable to operate on.
The
.Ar name
argument is the GUID of variable, followed by a dash, followed by the
argument is the GUID of the variable, followed by a dash, followed by the
UEFI variable name.
The GUID may be in numeric format, or may be one of the well known
symbolic name (see
@ -86,19 +86,19 @@ This flag implies
unless the
.Fl -append
flag is given.
This is not well understood and currently unimplemented.
This behavior is not well understood and is currently unimplemented.
.It Fl a Fl -append
Append the specified value to the UEFI variable rather than replacing
it.p
it.
.It Fl t Ar attr Fl -attributes Ar attr
Specify, in user hostile hexidecimal, the attributes for this
Specify, in hexadecimal, the attributes for this
variable.
See section 7.2 (GetVariable subsection, Related Definitions) of the
UEFI Specification for hex values to use.
.It Fl A Fl -ascii
Display the variable data as modified ascii: All printable characters
are printed, while unprintable characters are rendered as a two-digit
hexadecimal number preceeded by a % character.
hexadecimal number preceded by a % character.
.It Fl b Fl -binary
Display the variable data as binary data.
Usually will be used with the
@ -155,31 +155,29 @@ can be used to specify simple strings.
Display the
.Ar name
environment variable.
.El
.Sh COMPATIBILITY
The
.Nm
program is intended to be compatible (strict superset) with a progam
of the same name included in the Red Hat libefivar package.
.Pp
Except the
program is intended to be compatible (strict superset) with a program
of the same name included in the Red Hat libefivar package,
but the
.Fl d
and
.Fl -print-decimal
flags are not implmenented and never will be.
flags are not implemented and never will be.
.Pp
The
.Fl d
flag is a short-hand for
flag is short for
.Fl -device-path .
.Sh SEE ALSO
Appendix A of the UEFI specification has the format for GUIDs.
All GUIDs
.Dq Globally Unique Identifiers
have the format described in RFC 4122.
.El
.Pp
.Xr efivar 8
.Sh HISTORY
The
.Nm
utility first appeared in
.Fx 12.0 .
.Fx 11.1 .

View file

@ -28,7 +28,7 @@
.\" @(#)exports.5 8.3 (Berkeley) 3/29/95
.\" $FreeBSD$
.\"
.Dd August 14, 2014
.Dd May 20, 2017
.Dt EXPORTS 5
.Os
.Sh NAME
@ -164,12 +164,12 @@ In the absence of
.Fl maproot
and
.Fl mapall
options, remote accesses by root will result in using a credential of -2:-2.
options, remote accesses by root will result in using a credential of 65534:65533.
All other users will be mapped to their remote credential.
If a
.Fl maproot
option is given,
remote access by root will be mapped to that credential instead of -2:-2.
remote access by root will be mapped to that credential instead of 65534:65533.
If a
.Fl mapall
option is given,

View file

@ -725,7 +725,7 @@ on_read_request_process(struct query_state *qstate)
if (read_response->error_code == -2) {
read_response->data = malloc(
read_response->data_size);
assert(read_response != NULL);
assert(read_response->data != NULL);
read_response->error_code = cache_read(c_entry,
read_request->cache_key,
read_request->cache_key_size,
@ -743,9 +743,14 @@ on_read_request_process(struct query_state *qstate)
&read_response->data_size);
if (read_response->error_code == -2) {
read_response->error_code = 0;
read_response->data = NULL;
read_response->data_size = 0;
read_response->data = malloc(
read_response->data_size);
assert(read_response->data != NULL);
read_response->error_code = cache_read(neg_c_entry,
read_request->cache_key,
read_request->cache_key_size,
read_response->data,
&read_response->data_size);
}
}
configuration_unlock_entry(qstate->config_entry, CELT_NEGATIVE);