MFHead @350426

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
asomers 2019-07-30 04:17:36 +00:00
commit 51c309ec92
48 changed files with 657 additions and 290 deletions

View File

@ -297,6 +297,7 @@ int mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *));
#endif
int mkostemp(char *, int);
int mkostemps(char *, int, int);
int mkostempsat(int, char *, int, int);
void qsort_r(void *, size_t, size_t, void *,
int (*)(void *, const void *, const void *));
int radixsort(const unsigned char **, int, const unsigned char *,

View File

@ -581,7 +581,6 @@ ${PACKAGE}FILES+= test_read_format_zip_jar.jar.uu
${PACKAGE}FILES+= test_read_format_zip_length_at_end.zip.uu
${PACKAGE}FILES+= test_read_format_zip_lzma_alone_leak.zipx.uu
${PACKAGE}FILES+= test_read_format_zip_lzma.zipx.uu
${PACKAGE}FILES+= test_read_format_zip_lzma.zipx.uu
${PACKAGE}FILES+= test_read_format_zip_lzma_multi.zipx.uu
${PACKAGE}FILES+= test_read_format_zip_mac_metadata.zip.uu
${PACKAGE}FILES+= test_read_format_zip_malformed1.zip.uu

View File

@ -63,7 +63,7 @@ MLINKS+=getc.3 fgetc.3 getc.3 getc_unlocked.3 getc.3 getchar.3 \
MLINKS+=getline.3 getdelim.3
MLINKS+=getwc.3 fgetwc.3 getwc.3 getwchar.3
MLINKS+=mktemp.3 mkdtemp.3 mktemp.3 mkstemp.3 mktemp.3 mkstemps.3 \
mktemp.3 mkostemp.3 mktemp.3 mkostemps.3
mktemp.3 mkostemp.3 mktemp.3 mkostemps.3 mktemp.3 mkostempsat.3
MLINKS+=open_memstream.3 open_wmemstream.3
MLINKS+=printf.3 asprintf.3 printf.3 dprintf.3 printf.3 fprintf.3 \
printf.3 snprintf.3 printf.3 sprintf.3 \

View File

@ -171,6 +171,10 @@ FBSD_1.5 {
gets_s;
};
FBSD_1.6 {
mkostempsat;
};
FBSDprivate_1.0 {
_flockfile;
_flockfile_debug_stub;

View File

@ -28,7 +28,7 @@
.\" @(#)mktemp.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd August 8, 2013
.Dd July 29, 2019
.Dt MKTEMP 3
.Os
.Sh NAME
@ -46,6 +46,8 @@
.Fn mkostemp "char *template" "int oflags"
.Ft int
.Fn mkostemps "char *template" "int suffixlen" "int oflags"
.Ft int
.Fn mkostempsat "int dfd" "char *template" "int suffixlen" "int oflags"
.Ft char *
.Fn mkdtemp "char *template"
.In unistd.h
@ -126,6 +128,21 @@ function
are told the length of the suffix string.
.Pp
The
.Fn mkostempsat
function acts the same as
.Fn mkostemps
but takes an additional directory descriptor as a parameter.
The temporary file is created relative to the corresponding
directory, or to the current working directory if the special
value
.Dv AT_FDCWD
is specified.
If the template path is an absolute path, the
.Fa dfd
parameter is ignored and the behavior is identical to
.Fn mkostemps .
.Pp
The
.Fn mkdtemp
function makes the same replacement to the template as in
.Fn mktemp
@ -262,9 +279,10 @@ and is not specified by
.St -p1003.1-2008 .
The
.Fn mkostemp ,
.Fn mkstemps
and
.Fn mkstemps ,
.Fn mkostemps
and
.Fn mkostempsat
functions do not conform to any standard.
.Sh HISTORY
A
@ -293,6 +311,10 @@ and
.Fn mkostemps
functions appeared in
.Fx 10.0 .
The
.Fn mkostempsat
function appeared in
.Fx 13.0 .
.Sh BUGS
This family of functions produces filenames which can be guessed,
though the risk is minimized when large numbers of
@ -308,10 +330,11 @@ and opening it for use
(later in the user application)
particularly dangerous from a security perspective.
Whenever it is possible,
.Fn mkstemp
or
.Fn mkstemp ,
.Fn mkostemp
should be used instead, since it does not have the race condition.
or
.Fn mkostempsat
should be used instead, since they do not have the race condition.
If
.Fn mkstemp
cannot be used, the filename created by

View File

@ -49,17 +49,25 @@ __FBSDID("$FreeBSD$");
char *_mktemp(char *);
static int _gettemp(char *, int *, int, int, int);
static int _gettemp(int, char *, int *, int, int, int);
static const unsigned char padchar[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int
mkostempsat(int dfd, char *path, int slen, int oflags)
{
int fd;
return (_gettemp(dfd, path, &fd, 0, slen, oflags) ? fd : -1);
}
int
mkostemps(char *path, int slen, int oflags)
{
int fd;
return (_gettemp(path, &fd, 0, slen, oflags) ? fd : -1);
return (_gettemp(AT_FDCWD, path, &fd, 0, slen, oflags) ? fd : -1);
}
int
@ -67,7 +75,7 @@ mkstemps(char *path, int slen)
{
int fd;
return (_gettemp(path, &fd, 0, slen, 0) ? fd : -1);
return (_gettemp(AT_FDCWD, path, &fd, 0, slen, 0) ? fd : -1);
}
int
@ -75,7 +83,7 @@ mkostemp(char *path, int oflags)
{
int fd;
return (_gettemp(path, &fd, 0, 0, oflags) ? fd : -1);
return (_gettemp(AT_FDCWD, path, &fd, 0, 0, oflags) ? fd : -1);
}
int
@ -83,19 +91,19 @@ mkstemp(char *path)
{
int fd;
return (_gettemp(path, &fd, 0, 0, 0) ? fd : -1);
return (_gettemp(AT_FDCWD, path, &fd, 0, 0, 0) ? fd : -1);
}
char *
mkdtemp(char *path)
{
return (_gettemp(path, (int *)NULL, 1, 0, 0) ? path : (char *)NULL);
return (_gettemp(AT_FDCWD, path, (int *)NULL, 1, 0, 0) ? path : (char *)NULL);
}
char *
_mktemp(char *path)
{
return (_gettemp(path, (int *)NULL, 0, 0, 0) ? path : (char *)NULL);
return (_gettemp(AT_FDCWD, path, (int *)NULL, 0, 0, 0) ? path : (char *)NULL);
}
__warn_references(mktemp,
@ -108,7 +116,7 @@ mktemp(char *path)
}
static int
_gettemp(char *path, int *doopen, int domkdir, int slen, int oflags)
_gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags)
{
char *start, *trv, *suffp, *carryp;
char *pad;
@ -155,7 +163,7 @@ _gettemp(char *path, int *doopen, int domkdir, int slen, int oflags)
for (; trv > path; --trv) {
if (*trv == '/') {
*trv = '\0';
rval = stat(path, &sbuf);
rval = fstatat(dfd, path, &sbuf, 0);
*trv = '/';
if (rval != 0)
return (0);
@ -168,11 +176,11 @@ _gettemp(char *path, int *doopen, int domkdir, int slen, int oflags)
}
}
oflags |= O_CREAT | O_EXCL | O_RDWR;
for (;;) {
if (doopen) {
if ((*doopen =
_open(path, O_CREAT|O_EXCL|O_RDWR|oflags, 0600)) >=
0)
*doopen = _openat(dfd, path, oflags, 0600);
if (*doopen >= 0)
return (1);
if (errno != EEXIST)
return (0);

View File

@ -1521,6 +1521,7 @@ atacapprint(struct ata_params *parm)
printf("WWN %04x%04x%04x%04x\n",
parm->wwn[0], parm->wwn[1], parm->wwn[2], parm->wwn[3]);
}
printf("additional product id %.8s\n", parm->product_id);
if (parm->enabled.extension & ATA_SUPPORT_MEDIASN) {
printf("media serial number %.30s\n",
parm->media_serial);
@ -1650,35 +1651,39 @@ atacapprint(struct ata_params *parm)
} else
printf("\n");
printf("Native Command Queuing (NCQ) ");
if (parm->satacapabilities != 0xffff &&
(parm->satacapabilities & ATA_SUPPORT_NCQ)) {
if (atasata(parm) && (parm->satacapabilities & ATA_SUPPORT_NCQ)) {
printf("yes %d tags\n",
ATA_QUEUE_LEN(parm->queue) + 1);
printf("NCQ Priority Information %s\n",
parm->satacapabilities & ATA_SUPPORT_NCQ_PRIO ?
"yes" : "no");
printf("NCQ Non-Data Command %s\n",
parm->satacapabilities2 & ATA_SUPPORT_NCQ_NON_DATA ?
"yes" : "no");
printf("NCQ Streaming %s\n",
parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ?
"yes" : "no");
printf("Receive & Send FPDMA Queued %s\n",
parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ?
"yes" : "no");
printf("NCQ Autosense %s\n",
parm->satasupport & ATA_SUPPORT_NCQ_AUTOSENSE ?
"yes" : "no");
} else
printf("no\n");
printf("NCQ Queue Management %s\n", atasata(parm) &&
parm->satacapabilities2 & ATA_SUPPORT_NCQ_QMANAGEMENT ?
"yes" : "no");
printf("NCQ Streaming %s\n", atasata(parm) &&
parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ?
"yes" : "no");
printf("Receive & Send FPDMA Queued %s\n", atasata(parm) &&
parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ?
"yes" : "no");
printf("SMART %s %s\n",
parm->support.command1 & ATA_SUPPORT_SMART ? "yes" : "no",
parm->enabled.command1 & ATA_SUPPORT_SMART ? "yes" : "no");
printf("microcode download %s %s\n",
parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no",
parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no");
printf("security %s %s\n",
parm->support.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no",
parm->enabled.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no");
printf("power management %s %s\n",
parm->support.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no",
parm->enabled.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no");
printf("microcode download %s %s\n",
parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no",
parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no");
printf("advanced power management %s %s",
parm->support.command2 & ATA_SUPPORT_APM ? "yes" : "no",
parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no");
@ -1721,6 +1726,15 @@ atacapprint(struct ata_params *parm)
printf("free-fall %s %s\n",
parm->support2 & ATA_SUPPORT_FREEFALL ? "yes" : "no",
parm->enabled2 & ATA_SUPPORT_FREEFALL ? "yes" : "no");
printf("sense data reporting %s %s\n",
parm->support2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no",
parm->enabled2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no");
printf("extended power conditions %s %s\n",
parm->support2 & ATA_SUPPORT_EPC ? "yes" : "no",
parm->enabled2 & ATA_SUPPORT_EPC ? "yes" : "no");
printf("device statistics notification %s %s\n",
parm->support2 & ATA_SUPPORT_DSN ? "yes" : "no",
parm->enabled2 & ATA_SUPPORT_DSN ? "yes" : "no");
printf("Data Set Management (DSM/TRIM) ");
if (parm->support_dsm & ATA_SUPPORT_DSM_TRIM) {
printf("yes\n");
@ -1743,6 +1757,8 @@ atacapprint(struct ata_params *parm)
} else {
printf("no\n");
}
printf("encrypts all user data %s\n",
parm->support3 & ATA_ENCRYPTS_ALL_USER_DATA ? "yes" : "no");
printf("Sanitize ");
if (parm->multi & ATA_SUPPORT_SANITIZE) {
printf("yes\t\t%s%s%s\n",

View File

@ -79,7 +79,6 @@ set_restore_flags(struct cam_device *device, uint8_t *flags, int set_flag,
int error = 0;
struct scsi_control_ext_page *control_page = NULL;
struct scsi_mode_header_10 *mode_hdr = NULL;
struct scsi_mode_sense_10 *cdb = NULL;
union ccb *ccb = NULL;
unsigned long mode_buf_size = sizeof(struct scsi_mode_header_10) +
sizeof(struct scsi_mode_blk_desc) +
@ -96,25 +95,19 @@ set_restore_flags(struct cam_device *device, uint8_t *flags, int set_flag,
* Get the control extension subpage, we'll send it back modified to
* enable SCSI control over the tape drive's timestamp
*/
scsi_mode_sense_len(&ccb->csio,
scsi_mode_sense_subpage(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
/*tag_action*/ task_attr,
/*dbd*/ 0,
/*page_control*/ SMS_PAGE_CTRL_CURRENT,
/*page*/ SCEP_PAGE_CODE,
/*subpage*/ SCEP_SUBPAGE_CODE,
/*param_buf*/ &mode_buf[0],
/*param_len*/ mode_buf_size,
/*minimum_cmd_size*/ 10,
/*sense_len*/ SSD_FULL_SIZE,
/*timeout*/ timeout ? timeout : 5000);
/*
* scsi_mode_sense_len does not have a subpage argument at the moment,
* so we have to manually set the subpage code before calling
* cam_send_ccb().
*/
cdb = (struct scsi_mode_sense_10 *)ccb->csio.cdb_io.cdb_bytes;
cdb->subpage = SCEP_SUBPAGE_CODE;
ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
if (retry_count > 0)

View File

@ -49,7 +49,7 @@ nvme_print_controller(struct nvme_controller_data *cdata)
uint8_t str[128];
char cbuf[UINT128_DIG + 1];
uint16_t oncs, oacs;
uint8_t compare, write_unc, dsm, vwc_present;
uint8_t compare, write_unc, dsm, t;
uint8_t security, fmt, fw, nsmgmt;
uint8_t fw_slot1_ro, fw_num_slots;
uint8_t ns_smart;
@ -63,8 +63,6 @@ nvme_print_controller(struct nvme_controller_data *cdata)
NVME_CTRLR_DATA_ONCS_WRITE_UNC_MASK;
dsm = (oncs >> NVME_CTRLR_DATA_ONCS_DSM_SHIFT) &
NVME_CTRLR_DATA_ONCS_DSM_MASK;
vwc_present = (cdata->vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) &
NVME_CTRLR_DATA_VWC_PRESENT_MASK;
oacs = cdata->oacs;
security = (oacs >> NVME_CTRLR_DATA_OACS_SECURITY_SHIFT) &
@ -107,8 +105,10 @@ nvme_print_controller(struct nvme_controller_data *cdata)
printf("Recommended Arb Burst: %d\n", cdata->rab);
printf("IEEE OUI Identifier: %02x %02x %02x\n",
cdata->ieee[0], cdata->ieee[1], cdata->ieee[2]);
printf("Multi-Path I/O Capabilities: %s%s%s%s\n",
printf("Multi-Path I/O Capabilities: %s%s%s%s%s\n",
(cdata->mic == 0) ? "Not Supported" : "",
((cdata->mic >> NVME_CTRLR_DATA_MIC_ANAR_SHIFT) &
NVME_CTRLR_DATA_MIC_SRIOVVF_MASK) ? "Asymmetric, " : "",
((cdata->mic >> NVME_CTRLR_DATA_MIC_SRIOVVF_SHIFT) &
NVME_CTRLR_DATA_MIC_SRIOVVF_MASK) ? "SR-IOV VF, " : "",
((cdata->mic >> NVME_CTRLR_DATA_MIC_MCTRLRS_SHIFT) &
@ -149,9 +149,24 @@ nvme_print_controller(struct nvme_controller_data *cdata)
printf("Virtualization Management: %sSupported\n",
((oacs >> NVME_CTRLR_DATA_OACS_VM_SHIFT) &
NVME_CTRLR_DATA_OACS_VM_MASK) ? "" : "Not ");
printf("Doorbell Buffer Config %sSupported\n",
printf("Doorbell Buffer Config: %sSupported\n",
((oacs >> NVME_CTRLR_DATA_OACS_DBBUFFER_SHIFT) &
NVME_CTRLR_DATA_OACS_DBBUFFER_MASK) ? "" : "Not ");
printf("Get LBA Status: %sSupported\n",
((oacs >> NVME_CTRLR_DATA_OACS_GETLBA_SHIFT) &
NVME_CTRLR_DATA_OACS_GETLBA_MASK) ? "" : "Not ");
printf("Sanitize: ");
if (cdata->sanicap != 0) {
printf("%s%s%s\n",
((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_CES_SHIFT) &
NVME_CTRLR_DATA_SANICAP_CES_SHIFT) ? "crypto, " : "",
((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_BES_SHIFT) &
NVME_CTRLR_DATA_SANICAP_BES_SHIFT) ? "block, " : "",
((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_OWS_SHIFT) &
NVME_CTRLR_DATA_SANICAP_OWS_SHIFT) ? "overwrite" : "");
} else {
printf("Not Supported\n");
}
printf("Abort Command Limit: %d\n", cdata->acl+1);
printf("Async Event Request Limit: %d\n", cdata->aerl+1);
printf("Number of Firmware Slots: ");
@ -197,6 +212,9 @@ nvme_print_controller(struct nvme_controller_data *cdata)
printf("Timestamp feature: %sSupported\n",
((oncs >> NVME_CTRLR_DATA_ONCS_TIMESTAMP_SHIFT) &
NVME_CTRLR_DATA_ONCS_TIMESTAMP_MASK) ? "" : "Not ");
printf("Verify feature: %sSupported\n",
((oncs >> NVME_CTRLR_DATA_ONCS_VERIFY_SHIFT) &
NVME_CTRLR_DATA_ONCS_VERIFY_MASK) ? "" : "Not ");
printf("Fused Operation Support: %s%s\n",
(cdata->fuses == 0) ? "Not Supported" : "",
((cdata->fuses >> NVME_CTRLR_DATA_FUSES_CNW_SHIFT) &
@ -208,8 +226,13 @@ nvme_print_controller(struct nvme_controller_data *cdata)
NVME_CTRLR_DATA_FNA_ERASE_ALL_MASK) ? "All-NVM" : "Per-NS",
((cdata->fna >> NVME_CTRLR_DATA_FNA_FORMAT_ALL_SHIFT) &
NVME_CTRLR_DATA_FNA_FORMAT_ALL_MASK) ? "All-NVM" : "Per-NS");
printf("Volatile Write Cache: %s\n",
vwc_present ? "Present" : "Not Present");
t = (cdata->vwc >> NVME_CTRLR_DATA_VWC_ALL_SHIFT) &
NVME_CTRLR_DATA_VWC_ALL_MASK;
printf("Volatile Write Cache: %s%s\n",
((cdata->vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) &
NVME_CTRLR_DATA_VWC_PRESENT_MASK) ? "Present" : "Not Present",
(t == NVME_CTRLR_DATA_VWC_ALL_NO) ? ", no flush all" :
(t == NVME_CTRLR_DATA_VWC_ALL_YES) ? ", flush all" : "");
if (nsmgmt) {
printf("\n");

View File

@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd January 12, 2015
.Dd July 29, 2019
.Dt CC_DCTCP 4
.Os
.Sh NAME
@ -60,7 +60,7 @@ In addition, when classic ECN is used as sender and DCTCP is used as
receiver, DCTCP avoids to mirror back ACKs only when the CWR flag is
set in the incoming packet.
.Pp
The other specifications are based on the paper and Internet Draft referenced
The other specifications are based on the paper and the RFC referenced
in the
.Sx SEE ALSO
section below.
@ -70,16 +70,27 @@ The algorithm exposes the following tunable variables in the
branch of the
.Xr sysctl 3
MIB:
.Bl -tag -width ".Va alpha"
.Bl -tag -width ".Va slowstart"
.It Va alpha
An initial estimator of the congestion on the link.
Default is 0.
.It Va dctcp_shift_g
An estimation gain in the alpha calculation.
Default is 16.
The initial value to estimate the congestion on the link.
The valid range is from 0 to 1024, where 1024 reduces the congestion
window to half, if a CE is observed in the first window and
.Va alpha
could not yet adjust to the congestion level on that path.
Default is 1024.
.It Va shift_g
An estimation gain in the
.Va alpha
calculation.
This influences the responsiveness when adjusting alpha
to the most recent observed window.
Valid range from 0 to 10, the default is 4, resulting in an effective
gain of 1 / ( 2 ^
.Va shift_g
), or 1/16th.
.It Va slowstart
A trigger to halve congestion window after slow start.
Default does nothing to halve window.
A flag if the congestion window should be reduced by one half after slow start.
Valid settings 0 and 1, default 0.
.El
.Sh SEE ALSO
.Xr cc_chd 4 ,
@ -108,10 +119,12 @@ Default does nothing to halve window.
.Re
.Rs
.%A "Stephen Bensley"
.%A "Lars Eggert"
.%A "Dave Thaler"
.%T "Microsoft's Datacenter TCP (DCTCP): TCP Congestion Control for Datacenters"
.%U "http://tools.ietf.org/html/draft-bensley-tcpm-dctcp-01"
.%A "Praveen Balasubramanian"
.%A "Lars Eggert"
.%A "Glenn Judd"
.%T "Data Center TCP (DCTCP): TCP Congestion Control for Data Centers"
.%U "https://tools.ietf.org/html/rfc8257"
.Re
.Sh HISTORY
The

View File

@ -755,7 +755,9 @@ cpsw_get_fdt_data(struct cpsw_softc *sc, int port)
continue;
}
OF_prop_free(name);
if (mdio_child_addr != slave_mdio_addr[port])
if (mdio_child_addr != slave_mdio_addr[port] &&
mdio_child_addr != (slave_mdio_addr[port] & 0xFFF))
continue;
if (fdt_get_phyaddr(child, NULL, &phy, NULL) != 0){

View File

@ -97,6 +97,16 @@ struct hwmod ti_hwmods[] = {
{NULL, 0}
};
static inline int
ti_get_hwmods_prop(phandle_t node, void **name)
{
int len;
if ((len = OF_getprop_alloc(node, "ti,hwmods", name)) > 0)
return (len);
return (OF_getprop_alloc(OF_parent(node), "ti,hwmods", name));
}
clk_ident_t
ti_hwmods_get_clock(device_t dev)
{
@ -110,7 +120,7 @@ ti_hwmods_get_clock(device_t dev)
if ((node = ofw_bus_get_node(dev)) == 0)
return (INVALID_CLK_IDENT);
if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
if ((len = ti_get_hwmods_prop(node, (void **)&name)) <= 0)
return (INVALID_CLK_IDENT);
buf = name;
@ -148,7 +158,7 @@ int ti_hwmods_contains(device_t dev, const char *hwmod)
if ((node = ofw_bus_get_node(dev)) == 0)
return (0);
if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
if ((len = ti_get_hwmods_prop(node, (void **)&name)) <= 0)
return (0);
buf = name;
@ -182,7 +192,7 @@ ti_hwmods_get_unit(device_t dev, const char *hwmod)
if ((node = ofw_bus_get_node(dev)) == 0)
return (0);
if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
if ((len = ti_get_hwmods_prop(node, (void **)&name)) <= 0)
return (0);
buf = name;

View File

@ -5790,7 +5790,7 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
(pmap_load(pte) & (ATTR_AP_RW_BIT | ATTR_SW_DBM)) ==
(ATTR_AP(ATTR_AP_RO) | ATTR_SW_DBM)) {
pmap_clear_bits(pte, ATTR_AP_RW_BIT);
pmap_invalidate_page(pmap, trunc_page(far));
pmap_invalidate_page(pmap, far);
rv = KERN_SUCCESS;
}
PMAP_UNLOCK(pmap);

View File

@ -162,6 +162,7 @@ device smc # SMSC LAN91C111
device vnic # Cavium ThunderX NIC
device al_eth # Annapurna Alpine Ethernet NIC
device dwc_rk # Rockchip Designware
device dwc_socfpga # Altera SOCFPGA Ethernet MAC
# Etherswitch devices
device etherswitch # Enable etherswitch support

View File

@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/capsicum.h>
#include <sys/filedesc.h>
#include <sys/limits.h>
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/syscallsubr.h>

View File

@ -206,6 +206,7 @@ dev/acpica/acpi_pci_link.c optional acpi pci
dev/acpica/acpi_pcib.c optional acpi pci
dev/acpica/acpi_pxm.c optional acpi
dev/ahci/ahci_generic.c optional ahci
dev/altera/dwc/if_dwc_socfpga.c optional fdt dwc_socfpga
dev/axgbe/if_axgbe.c optional axgbe
dev/axgbe/xgbe-desc.c optional axgbe
dev/axgbe/xgbe-dev.c optional axgbe

View File

@ -0,0 +1,113 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2019 Ruslan Bukin <br@bsdpad.com>
*
* This software was developed by SRI International and the University of
* Cambridge Computer Laboratory (Department of Computer Science and
* Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
* DARPA SSITH research programme.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <machine/bus.h>
#include <dev/dwc/if_dwc.h>
#include <dev/dwc/if_dwcvar.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include "if_dwc_if.h"
static int
if_dwc_socfpga_probe(device_t dev)
{
if (!ofw_bus_status_okay(dev))
return (ENXIO);
if (!ofw_bus_is_compatible(dev, "altr,socfpga-stmmac"))
return (ENXIO);
device_set_desc(dev, "Altera SOCFPGA Ethernet MAC");
return (BUS_PROBE_DEFAULT);
}
static int
if_dwc_socfpga_init(device_t dev)
{
return (0);
}
static int
if_dwc_socfpga_mac_type(device_t dev)
{
return (DWC_GMAC);
}
static int
if_dwc_socfpga_mii_clk(device_t dev)
{
phandle_t root;
root = OF_finddevice("/");
if (ofw_bus_node_is_compatible(root, "altr,socfpga-stratix10"))
return (GMAC_MII_CLK_35_60M_DIV26);
/* Default value. */
return (GMAC_MII_CLK_25_35M_DIV16);
}
static device_method_t dwc_socfpga_methods[] = {
DEVMETHOD(device_probe, if_dwc_socfpga_probe),
DEVMETHOD(if_dwc_init, if_dwc_socfpga_init),
DEVMETHOD(if_dwc_mac_type, if_dwc_socfpga_mac_type),
DEVMETHOD(if_dwc_mii_clk, if_dwc_socfpga_mii_clk),
DEVMETHOD_END
};
static devclass_t dwc_socfpga_devclass;
extern driver_t dwc_driver;
DEFINE_CLASS_1(dwc, dwc_socfpga_driver, dwc_socfpga_methods,
sizeof(struct dwc_softc), dwc_driver);
EARLY_DRIVER_MODULE(dwc_socfpga, simplebus, dwc_socfpga_driver,
dwc_socfpga_devclass, 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE);
MODULE_DEPEND(dwc_socfpga, dwc, 1, 1, 1);

View File

@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
#ifdef _KERNEL
#include <sys/param.h>
#include <sys/ctype.h>
#include <sys/limits.h>
#include <sys/malloc.h>
#include <sys/systm.h>
#else /* !_KERNEL */

View File

@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/hash.h>
#include <sys/limits.h>
#include <sys/queue.h>
#ifdef _KERNEL

View File

@ -31,6 +31,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/limits.h>
#include <sys/sbuf.h>
#ifdef _KERNEL

View File

@ -31,6 +31,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/limits.h>
#include <sys/sbuf.h>
#ifdef _KERNEL

View File

@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include <sys/stat.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/fcntl.h>
#include <sys/uio.h>

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com>
* Copyright (c) 2014,2019 Ruslan Bukin <br@bsdpad.com>
* All rights reserved.
*
* This software was developed by SRI International and the University of
@ -32,7 +32,7 @@
__FBSDID("$FreeBSD$");
/*
* Micrel KSZ9021 Gigabit Ethernet Transceiver
* Micrel KSZ8081/KSZ9021/KSZ9031 Gigabit Ethernet Transceiver
*/
#include <sys/param.h>
@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <dev/mii/mii_fdt.h>
#define MII_KSZPHY_EXTREG 0x0b
#define KSZPHY_EXTREG_WRITE (1 << 15)
@ -251,6 +252,7 @@ micphy_probe(device_t dev)
static int
micphy_attach(device_t dev)
{
mii_fdt_phy_config_t *cfg;
struct mii_softc *sc;
phandle_t node;
device_t miibus;
@ -271,10 +273,12 @@ micphy_attach(device_t dev)
if ((node = ofw_bus_get_node(parent)) == -1)
return (ENXIO);
cfg = mii_fdt_get_config(dev);
if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ9031)
ksz9031_load_values(sc, node);
ksz9031_load_values(sc, cfg->phynode);
else
ksz9021_load_values(sc, node);
ksz9021_load_values(sc, cfg->phynode);
return (0);
}

View File

@ -175,6 +175,9 @@
/* SR-IOV Virtual Function */
#define NVME_CTRLR_DATA_MIC_SRIOVVF_SHIFT (2)
#define NVME_CTRLR_DATA_MIC_SRIOVVF_MASK (0x1)
/* Asymmetric Namespace Access Reporting */
#define NVME_CTRLR_DATA_MIC_ANAR_SHIFT (3)
#define NVME_CTRLR_DATA_MIC_ANAR_MASK (0x1)
/** OACS - optional admin command support */
/* supports security send/receive commands */
@ -204,6 +207,9 @@
/* supports Doorbell Buffer Config */
#define NVME_CTRLR_DATA_OACS_DBBUFFER_SHIFT (8)
#define NVME_CTRLR_DATA_OACS_DBBUFFER_MASK (0x1)
/* supports Get LBA Status */
#define NVME_CTRLR_DATA_OACS_GETLBA_SHIFT (9)
#define NVME_CTRLR_DATA_OACS_GETLBA_MASK (0x1)
/** firmware updates */
/* first slot is read-only */
@ -212,6 +218,9 @@
/* number of firmware slots */
#define NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT (1)
#define NVME_CTRLR_DATA_FRMW_NUM_SLOTS_MASK (0x7)
/* firmware activation without reset */
#define NVME_CTRLR_DATA_FRMW_ACT_WO_RESET_SHIFT (4)
#define NVME_CTRLR_DATA_FRMW_ACT_WO_RESET_MASK (0x1)
/** log page attributes */
/* per namespace smart/health log page */
@ -228,6 +237,26 @@
#define NVME_CTRLR_DATA_APSTA_APST_SUPP_SHIFT (0)
#define NVME_CTRLR_DATA_APSTA_APST_SUPP_MASK (0x1)
/** Sanitize Capabilities */
/* Crypto Erase Support */
#define NVME_CTRLR_DATA_SANICAP_CES_SHIFT (0)
#define NVME_CTRLR_DATA_SANICAP_CES_MASK (0x1)
/* Block Erase Support */
#define NVME_CTRLR_DATA_SANICAP_BES_SHIFT (1)
#define NVME_CTRLR_DATA_SANICAP_BES_MASK (0x1)
/* Overwrite Support */
#define NVME_CTRLR_DATA_SANICAP_OWS_SHIFT (2)
#define NVME_CTRLR_DATA_SANICAP_OWS_MASK (0x1)
/* No-Deallocate Inhibited */
#define NVME_CTRLR_DATA_SANICAP_NDI_SHIFT (29)
#define NVME_CTRLR_DATA_SANICAP_NDI_MASK (0x1)
/* No-Deallocate Modifies Media After Sanitize */
#define NVME_CTRLR_DATA_SANICAP_NODMMAS_SHIFT (30)
#define NVME_CTRLR_DATA_SANICAP_NODMMAS_MASK (0x3)
#define NVME_CTRLR_DATA_SANICAP_NODMMAS_UNDEF (0)
#define NVME_CTRLR_DATA_SANICAP_NODMMAS_NO (1)
#define NVME_CTRLR_DATA_SANICAP_NODMMAS_YES (2)
/** submission queue entry size */
#define NVME_CTRLR_DATA_SQES_MIN_SHIFT (0)
#define NVME_CTRLR_DATA_SQES_MIN_MASK (0xF)
@ -255,6 +284,8 @@
#define NVME_CTRLR_DATA_ONCS_RESERV_MASK (0x1)
#define NVME_CTRLR_DATA_ONCS_TIMESTAMP_SHIFT (6)
#define NVME_CTRLR_DATA_ONCS_TIMESTAMP_MASK (0x1)
#define NVME_CTRLR_DATA_ONCS_VERIFY_SHIFT (7)
#define NVME_CTRLR_DATA_ONCS_VERIFY_MASK (0x1)
/** Fused Operation Support */
#define NVME_CTRLR_DATA_FUSES_CNW_SHIFT (0)
@ -269,8 +300,15 @@
#define NVME_CTRLR_DATA_FNA_CRYPTO_ERASE_MASK (0x1)
/** volatile write cache */
/* volatile write cache present */
#define NVME_CTRLR_DATA_VWC_PRESENT_SHIFT (0)
#define NVME_CTRLR_DATA_VWC_PRESENT_MASK (0x1)
/* flush all namespaces supported */
#define NVME_CTRLR_DATA_VWC_ALL_SHIFT (1)
#define NVME_CTRLR_DATA_VWC_ALL_MASK (0x3)
#define NVME_CTRLR_DATA_VWC_ALL_UNKNOWN (0)
#define NVME_CTRLR_DATA_VWC_ALL_NO (2)
#define NVME_CTRLR_DATA_VWC_ALL_YES (3)
/** namespace features */
/* thin provisioning */
@ -285,6 +323,9 @@
/* NGUID and EUI64 fields are not reusable */
#define NVME_NS_DATA_NSFEAT_NO_ID_REUSE_SHIFT (3)
#define NVME_NS_DATA_NSFEAT_NO_ID_REUSE_MASK (0x1)
/* NPWG, NPWA, NPDG, NPDA, and NOWS are valid */
#define NVME_NS_DATA_NSFEAT_NPVALID_SHIFT (4)
#define NVME_NS_DATA_NSFEAT_NPVALID_MASK (0x1)
/** formatted lba size */
#define NVME_NS_DATA_FLBAS_FORMAT_SHIFT (0)
@ -793,12 +834,27 @@ struct nvme_controller_data {
/** Controller Attributes */
uint32_t ctratt; /* bitfield really */
uint8_t reserved1[12];
/** Read Recovery Levels Supported */
uint16_t rrls;
uint8_t reserved1[9];
/** Controller Type */
uint8_t cntrltype;
/** FRU Globally Unique Identifier */
uint8_t fguid[16];
uint8_t reserved2[128];
/** Command Retry Delay Time 1 */
uint16_t crdt1;
/** Command Retry Delay Time 2 */
uint16_t crdt2;
/** Command Retry Delay Time 3 */
uint16_t crdt3;
uint8_t reserved2[122];
/* bytes 256-511: admin command set attributes */
@ -878,7 +934,34 @@ struct nvme_controller_data {
/** Sanitize Capabilities */
uint32_t sanicap; /* Really a bitfield */
uint8_t reserved3[180];
/** Host Memory Buffer Minimum Descriptor Entry Size */
uint32_t hmminds;
/** Host Memory Maximum Descriptors Entries */
uint16_t hmmaxd;
/** NVM Set Identifier Maximum */
uint16_t nsetidmax;
/** Endurance Group Identifier Maximum */
uint16_t endgidmax;
/** ANA Transition Time */
uint8_t anatt;
/** Asymmetric Namespace Access Capabilities */
uint8_t anacap;
/** ANA Group Identifier Maximum */
uint32_t anagrpmax;
/** Number of ANA Group Identifiers */
uint32_t nanagrpid;
/** Persistent Event Log Size */
uint32_t pels;
uint8_t reserved3[156];
/* bytes 512-703: nvm command set attributes */
/** submission queue entry size */
@ -913,7 +996,9 @@ struct nvme_controller_data {
/** NVM Vendor Specific Command Configuration */
uint8_t nvscc;
uint8_t reserved5;
/** Namespace Write Protection Capabilities */
uint8_t nwpc;
/** Atomic Compare & Write Unit */
uint16_t acwu;
@ -922,8 +1007,11 @@ struct nvme_controller_data {
/** SGL Support */
uint32_t sgls;
/** Maximum Number of Allowed Namespaces */
uint32_t mnan;
/* bytes 540-767: Reserved */
uint8_t reserved7[228];
uint8_t reserved7[224];
/** NVM Subsystem NVMe Qualified Name */
uint8_t subnqn[256];
@ -1008,8 +1096,38 @@ struct nvme_namespace_data {
/** NVM Capacity */
uint8_t nvmcap[16];
/* bytes 64-103: Reserved */
uint8_t reserved5[40];
/** Namespace Preferred Write Granularity */
uint16_t npwg;
/** Namespace Preferred Write Alignment */
uint16_t npwa;
/** Namespace Preferred Deallocate Granularity */
uint16_t npdg;
/** Namespace Preferred Deallocate Alignment */
uint16_t npda;
/** Namespace Optimal Write Size */
uint16_t nows;
/* bytes 74-91: Reserved */
uint8_t reserved5[18];
/** ANA Group Identifier */
uint32_t anagrpid;
/* bytes 96-98: Reserved */
uint8_t reserved6[3];
/** Namespace Attributes */
uint8_t nsattr;
/** NVM Set Identifier */
uint16_t nvmsetid;
/** Endurance Group Identifier */
uint16_t endgid;
/** Namespace Globally Unique Identifier */
uint8_t nguid[16];
@ -1020,7 +1138,7 @@ struct nvme_namespace_data {
/** lba format support */
uint32_t lbaf[16];
uint8_t reserved6[192];
uint8_t reserved7[192];
uint8_t vendor_specific[3712];
} __packed __aligned(4);
@ -1402,6 +1520,10 @@ void nvme_controller_data_swapbytes(struct nvme_controller_data *s)
s->rtd3e = le32toh(s->rtd3e);
s->oaes = le32toh(s->oaes);
s->ctratt = le32toh(s->ctratt);
s->rrls = le16toh(s->rrls);
s->crdt1 = le16toh(s->crdt1);
s->crdt2 = le16toh(s->crdt2);
s->crdt3 = le16toh(s->crdt3);
s->oacs = le16toh(s->oacs);
s->wctemp = le16toh(s->wctemp);
s->cctemp = le16toh(s->cctemp);
@ -1415,6 +1537,13 @@ void nvme_controller_data_swapbytes(struct nvme_controller_data *s)
s->mntmt = le16toh(s->mntmt);
s->mxtmt = le16toh(s->mxtmt);
s->sanicap = le32toh(s->sanicap);
s->hmminds = le32toh(s->hmminds);
s->hmmaxd = le16toh(s->hmmaxd);
s->nsetidmax = le16toh(s->nsetidmax);
s->endgidmax = le16toh(s->endgidmax);
s->anagrpmax = le32toh(s->anagrpmax);
s->nanagrpid = le32toh(s->nanagrpid);
s->pels = le32toh(s->pels);
s->maxcmd = le16toh(s->maxcmd);
s->nn = le32toh(s->nn);
s->oncs = le16toh(s->oncs);
@ -1423,6 +1552,7 @@ void nvme_controller_data_swapbytes(struct nvme_controller_data *s)
s->awupf = le16toh(s->awupf);
s->acwu = le16toh(s->acwu);
s->sgls = le32toh(s->sgls);
s->mnan = le32toh(s->mnan);
for (i = 0; i < 32; i++)
nvme_power_state_swapbytes(&s->power_state[i]);
}
@ -1442,6 +1572,14 @@ void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s)
s->nabo = le16toh(s->nabo);
s->nabspf = le16toh(s->nabspf);
s->noiob = le16toh(s->noiob);
s->npwg = le16toh(s->npwg);
s->npwa = le16toh(s->npwa);
s->npdg = le16toh(s->npdg);
s->npda = le16toh(s->npda);
s->nows = le16toh(s->nows);
s->anagrpid = le32toh(s->anagrpid);
s->nvmsetid = le16toh(s->nvmsetid);
s->endgid = le16toh(s->endgid);
for (i = 0; i < 16; i++)
s->lbaf[i] = le32toh(s->lbaf[i]);
}

View File

@ -175,6 +175,9 @@ static const STRUCT_USB_HOST_ID urndis_host_devs[] = {
{USB_VENDOR(USB_VENDOR_PALM), USB_IFACE_CLASS(UICLASS_CDC),
USB_IFACE_SUBCLASS(UISUBCLASS_ABSTRACT_CONTROL_MODEL),
USB_IFACE_PROTOCOL(0xff)},
/* Nokia 7 plus */
{USB_IFACE_CLASS(UICLASS_IAD), USB_IFACE_SUBCLASS(0x4),
USB_IFACE_PROTOCOL(UIPROTO_ACTIVESYNC)},
};
DRIVER_MODULE(urndis, uhub, urndis_driver, urndis_devclass, NULL, NULL);

View File

@ -52,6 +52,7 @@
#include <sys/filio.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mman.h>

View File

@ -51,6 +51,7 @@
#include <sys/kernel.h>
#include <sys/fcntl.h>
#include <sys/filio.h>
#include <sys/limits.h>
#include <sys/sdt.h>
#include <sys/stat.h>
#include <sys/bio.h>

View File

@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
#include <sys/uio.h>
#include <sys/malloc.h>
#include <sys/queue.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/rwlock.h>
#include <sys/sx.h>

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/capsicum.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/rwlock.h>

View File

@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$");
#include <sys/mbuf.h>
#include <sys/protosw.h>
#include <sys/rwlock.h>
#include <sys/sdt.h>
#include <sys/sf_buf.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
@ -66,8 +65,6 @@ __FBSDID("$FreeBSD$");
#define EXT_FLAG_NOCACHE EXT_FLAG_VENDOR2
#define EXT_FLAG_CACHE_LAST EXT_FLAG_VENDOR3
SDT_PROVIDER_DECLARE(vfs);
/*
* Structure describing a single sendfile(2) I/O, which may consist of
* several underlying pager I/Os.
@ -346,7 +343,6 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, int error)
free(sfio, M_TEMP);
}
SDT_PROBE_DEFINE1(vfs, sendfile, swapin, pager_error, "int");
/*
* Iterate through pages vector and request paging for non-valid pages.
*/
@ -440,14 +436,15 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, int *nios, off_t off,
i + count == npages ? &rhpages : NULL,
&sendfile_iodone, sfio);
if (rv != VM_PAGER_OK) {
SDT_PROBE1(vfs, sendfile, swapin, pager_error, rv);
for (j = 0; j < count; j++) {
vm_page_lock(*(pa + i + j));
vm_page_unwire(*(pa + i + j), PQ_INACTIVE);
vm_page_unlock(*(pa + i + j));
for (j = i; j < i + count; j++) {
if (pa[j] != bogus_page) {
vm_page_lock(pa[j]);
vm_page_unwire(pa[j], PQ_INACTIVE);
vm_page_unlock(pa[j]);
}
}
VM_OBJECT_WUNLOCK(obj);
return EIO;
return (EIO);
}
KASSERT(rv == VM_PAGER_OK, ("%s: pager fail obj %p page %p",
__func__, obj, pa[i]));
@ -804,10 +801,10 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
error = sendfile_swapin(obj, sfio, &nios, off, space, npages,
rhpages, flags);
if (error) {
free(sfio, M_TEMP);
if (error != 0) {
if (vp != NULL)
VOP_UNLOCK(vp, 0);
free(sfio, M_TEMP);
goto done;
}

View File

@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/ktrace.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>

View File

@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ktr.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/syscallsubr.h>

View File

@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
#include <sys/filio.h>
#include <sys/fnv_hash.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/uio.h>
#include <sys/signal.h>
#include <sys/jail.h>

View File

@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/intr.h>
#include <sys/limits.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/rman.h>

View File

@ -56,8 +56,9 @@ __FBSDID("$FreeBSD$");
#include <netinet/cc/cc.h>
#include <netinet/cc/cc_module.h>
#define MAX_ALPHA_VALUE 1024
VNET_DEFINE_STATIC(uint32_t, dctcp_alpha) = 0;
#define DCTCP_SHIFT 10
#define MAX_ALPHA_VALUE (1<<DCTCP_SHIFT)
VNET_DEFINE_STATIC(uint32_t, dctcp_alpha) = MAX_ALPHA_VALUE;
#define V_dctcp_alpha VNET(dctcp_alpha)
VNET_DEFINE_STATIC(uint32_t, dctcp_shift_g) = 4;
#define V_dctcp_shift_g VNET(dctcp_shift_g)
@ -65,14 +66,14 @@ VNET_DEFINE_STATIC(uint32_t, dctcp_slowstart) = 0;
#define V_dctcp_slowstart VNET(dctcp_slowstart)
struct dctcp {
int bytes_ecn; /* # of marked bytes during a RTT */
int bytes_total; /* # of acked bytes during a RTT */
int alpha; /* the fraction of marked bytes */
int ce_prev; /* CE state of the last segment */
int save_sndnxt; /* end sequence number of the current window */
int ece_curr; /* ECE flag in this segment */
int ece_prev; /* ECE flag in the last segment */
uint32_t num_cong_events; /* # of congestion events */
uint32_t bytes_ecn; /* # of marked bytes during a RTT */
uint32_t bytes_total; /* # of acked bytes during a RTT */
int alpha; /* the fraction of marked bytes */
int ce_prev; /* CE state of the last segment */
tcp_seq save_sndnxt; /* end sequence number of the current window */
int ece_curr; /* ECE flag in this segment */
int ece_prev; /* ECE flag in the last segment */
uint32_t num_cong_events; /* # of congestion events */
};
static MALLOC_DEFINE(M_dctcp, "dctcp data",
@ -122,7 +123,7 @@ dctcp_ack_received(struct cc_var *ccv, uint16_t type)
newreno_cc_algo.ack_received(ccv, type);
if (type == CC_DUPACK)
bytes_acked = CCV(ccv, t_maxseg);
bytes_acked = min(ccv->bytes_this_ack, CCV(ccv, t_maxseg));
if (type == CC_ACK)
bytes_acked = ccv->bytes_this_ack;
@ -132,6 +133,8 @@ dctcp_ack_received(struct cc_var *ccv, uint16_t type)
/* Update total marked bytes. */
if (dctcp_data->ece_curr) {
//XXRMS: For fluid-model DCTCP, update
//cwnd here during for RTT fairness
if (!dctcp_data->ece_prev
&& bytes_acked > CCV(ccv, t_maxseg)) {
dctcp_data->bytes_ecn +=
@ -165,18 +168,20 @@ dctcp_after_idle(struct cc_var *ccv)
{
struct dctcp *dctcp_data;
dctcp_data = ccv->cc_data;
if (CCV(ccv, t_flags) & TF_ECN_PERMIT) {
dctcp_data = ccv->cc_data;
/* Initialize internal parameters after idle time */
dctcp_data->bytes_ecn = 0;
dctcp_data->bytes_total = 0;
dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
dctcp_data->alpha = V_dctcp_alpha;
dctcp_data->ece_curr = 0;
dctcp_data->ece_prev = 0;
dctcp_data->num_cong_events = 0;
/* Initialize internal parameters after idle time */
dctcp_data->bytes_ecn = 0;
dctcp_data->bytes_total = 0;
dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
dctcp_data->alpha = V_dctcp_alpha;
dctcp_data->ece_curr = 0;
dctcp_data->ece_prev = 0;
dctcp_data->num_cong_events = 0;
}
dctcp_cc_algo.after_idle = newreno_cc_algo.after_idle;
newreno_cc_algo.after_idle(ccv);
}
static void
@ -227,63 +232,66 @@ static void
dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
{
struct dctcp *dctcp_data;
u_int win, mss;
u_int cwin, mss;
dctcp_data = ccv->cc_data;
win = CCV(ccv, snd_cwnd);
mss = CCV(ccv, t_maxseg);
if (CCV(ccv, t_flags) & TF_ECN_PERMIT) {
dctcp_data = ccv->cc_data;
cwin = CCV(ccv, snd_cwnd);
mss = CCV(ccv, t_maxseg);
switch (type) {
case CC_NDUPACK:
if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) {
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
CCV(ccv, snd_ssthresh) = mss *
max(win / 2 / mss, 2);
dctcp_data->num_cong_events++;
} else {
/* cwnd has already updated as congestion
* recovery. Reverse cwnd value using
* snd_cwnd_prev and recalculate snd_ssthresh
*/
win = CCV(ccv, snd_cwnd_prev);
CCV(ccv, snd_ssthresh) =
max(win / 2 / mss, 2) * mss;
switch (type) {
case CC_NDUPACK:
if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) {
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
CCV(ccv, snd_ssthresh) =
max(cwin / 2, 2 * mss);
dctcp_data->num_cong_events++;
} else {
/* cwnd has already updated as congestion
* recovery. Reverse cwnd value using
* snd_cwnd_prev and recalculate snd_ssthresh
*/
cwin = CCV(ccv, snd_cwnd_prev);
CCV(ccv, snd_ssthresh) =
max(cwin / 2, 2 * mss);
}
ENTER_RECOVERY(CCV(ccv, t_flags));
}
ENTER_RECOVERY(CCV(ccv, t_flags));
}
break;
case CC_ECN:
/*
* Save current snd_cwnd when the host encounters both
* congestion recovery and fast recovery.
*/
CCV(ccv, snd_cwnd_prev) = win;
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
if (V_dctcp_slowstart &&
dctcp_data->num_cong_events++ == 0) {
CCV(ccv, snd_ssthresh) =
mss * max(win / 2 / mss, 2);
dctcp_data->alpha = MAX_ALPHA_VALUE;
dctcp_data->bytes_ecn = 0;
dctcp_data->bytes_total = 0;
dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
} else
CCV(ccv, snd_ssthresh) = max((win - ((win *
dctcp_data->alpha) >> 11)) / mss, 2) * mss;
CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
ENTER_CONGRECOVERY(CCV(ccv, t_flags));
}
dctcp_data->ece_curr = 1;
break;
case CC_RTO:
if (CCV(ccv, t_flags) & TF_ECN_PERMIT) {
break;
case CC_ECN:
/*
* Save current snd_cwnd when the host encounters both
* congestion recovery and fast recovery.
*/
CCV(ccv, snd_cwnd_prev) = cwin;
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
if (V_dctcp_slowstart &&
dctcp_data->num_cong_events++ == 0) {
CCV(ccv, snd_ssthresh) =
max(cwin / 2, 2 * mss);
dctcp_data->alpha = MAX_ALPHA_VALUE;
dctcp_data->bytes_ecn = 0;
dctcp_data->bytes_total = 0;
dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
} else
CCV(ccv, snd_ssthresh) =
max((cwin - (((uint64_t)cwin *
dctcp_data->alpha) >> (DCTCP_SHIFT+1))),
2 * mss);
CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
ENTER_CONGRECOVERY(CCV(ccv, t_flags));
}
dctcp_data->ece_curr = 1;
break;
case CC_RTO:
CCV(ccv, t_flags) |= TF_ECN_SND_CWR;
dctcp_update_alpha(ccv);
dctcp_data->save_sndnxt += CCV(ccv, t_maxseg);
dctcp_data->num_cong_events++;
break;
}
break;
}
} else
newreno_cc_algo.cong_signal(ccv, type);
}
static void
@ -303,7 +311,7 @@ dctcp_conn_init(struct cc_var *ccv)
static void
dctcp_post_recovery(struct cc_var *ccv)
{
dctcp_cc_algo.post_recovery = newreno_cc_algo.post_recovery;
newreno_cc_algo.post_recovery(ccv);
if (CCV(ccv, t_flags) & TF_ECN_PERMIT)
dctcp_update_alpha(ccv);
@ -329,8 +337,8 @@ dctcp_ecnpkt_handler(struct cc_var *ccv)
delay_ack = 1;
/*
* DCTCP responses an ACK immediately when the CE state
* in between this segment and the last segment is not same.
* DCTCP responds with an ACK immediately when the CE state
* in between this segment and the last segment has changed.
*/
if (ccflag & CCF_IPHDR_CE) {
if (!dctcp_data->ce_prev && (ccflag & CCF_DELACK))
@ -350,8 +358,6 @@ dctcp_ecnpkt_handler(struct cc_var *ccv)
if (delay_ack == 0)
ccv->flags |= CCF_ACKNOW;
else
ccv->flags &= ~CCF_ACKNOW;
}
/*
@ -369,18 +375,18 @@ dctcp_update_alpha(struct cc_var *ccv)
dctcp_data->bytes_total = max(dctcp_data->bytes_total, 1);
/*
* Update alpha: alpha = (1 - g) * alpha + g * F.
* Update alpha: alpha = (1 - g) * alpha + g * M.
* Here:
* g is weight factor
* recommaded to be set to 1/16
* small g = slow convergence between competitive DCTCP flows
* large g = impacts low utilization of bandwidth at switches
* F is fraction of marked segments in last RTT
* M is fraction of marked segments in last RTT
* updated every RTT
* Alpha must be round to 0 - MAX_ALPHA_VALUE.
*/
dctcp_data->alpha = min(alpha_prev - (alpha_prev >> V_dctcp_shift_g) +
(dctcp_data->bytes_ecn << (10 - V_dctcp_shift_g)) /
dctcp_data->alpha = ulmin(alpha_prev - (alpha_prev >> V_dctcp_shift_g) +
((uint64_t)dctcp_data->bytes_ecn << (DCTCP_SHIFT - V_dctcp_shift_g)) /
dctcp_data->bytes_total, MAX_ALPHA_VALUE);
/* Initialize internal parameters for next alpha calculation */
@ -398,14 +404,10 @@ dctcp_alpha_handler(SYSCTL_HANDLER_ARGS)
new = V_dctcp_alpha;
error = sysctl_handle_int(oidp, &new, 0, req);
if (error == 0 && req->newptr != NULL) {
if (new > 1)
if (new > MAX_ALPHA_VALUE)
error = EINVAL;
else {
if (new > MAX_ALPHA_VALUE)
V_dctcp_alpha = MAX_ALPHA_VALUE;
else
V_dctcp_alpha = new;
}
else
V_dctcp_alpha = new;
}
return (error);
@ -420,7 +422,7 @@ dctcp_shift_g_handler(SYSCTL_HANDLER_ARGS)
new = V_dctcp_shift_g;
error = sysctl_handle_int(oidp, &new, 0, req);
if (error == 0 && req->newptr != NULL) {
if (new > 1)
if (new > DCTCP_SHIFT)
error = EINVAL;
else
V_dctcp_shift_g = new;
@ -454,7 +456,7 @@ SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, dctcp, CTLFLAG_RW, NULL,
SYSCTL_PROC(_net_inet_tcp_cc_dctcp, OID_AUTO, alpha,
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(dctcp_alpha), 0,
&dctcp_alpha_handler,
"IU", "dctcp alpha parameter");
"IU", "dctcp alpha parameter at start of session");
SYSCTL_PROC(_net_inet_tcp_cc_dctcp, OID_AUTO, shift_g,
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(dctcp_shift_g), 4,

View File

@ -1442,9 +1442,9 @@ ipfw_chk(struct ip_fw_args *args)
* pointer might become stale after other pullups (but we never use it
* this way).
*/
#define PULLUP_TO(_len, p, T) PULLUP_LEN(_len, p, sizeof(T))
#define PULLUP_TO(_len, p, T) PULLUP_LEN(_len, p, sizeof(T))
#define EHLEN (eh != NULL ? ((char *)ip - (char *)eh) : 0)
#define PULLUP_LEN(_len, p, T) \
#define _PULLUP_LOCKED(_len, p, T, unlock) \
do { \
int x = (_len) + T + EHLEN; \
if (mem) { \
@ -1453,12 +1453,18 @@ do { \
} else { \
if (__predict_false((m)->m_len < x)) { \
args->m = m = m_pullup(m, x); \
if (m == NULL) \
if (m == NULL) { \
unlock; \
goto pullup_failed; \
} \
} \
p = mtod(m, char *) + (_len) + EHLEN; \
} \
} while (0)
#define PULLUP_LEN(_len, p, T) _PULLUP_LOCKED(_len, p, T, )
#define PULLUP_LEN_LOCKED(_len, p, T) \
_PULLUP_LOCKED(_len, p, T, IPFW_PF_RUNLOCK(chain))
/*
* In case pointers got stale after pullups, update them.
*/
@ -2310,7 +2316,7 @@ do { \
case O_TCPOPTS:
if (proto == IPPROTO_TCP && offset == 0 && ulp){
PULLUP_LEN(hlen, ulp,
PULLUP_LEN_LOCKED(hlen, ulp,
(TCP(ulp)->th_off << 2));
match = tcpopts_match(TCP(ulp), cmd);
}
@ -2335,7 +2341,7 @@ do { \
uint16_t mss, *p;
int i;
PULLUP_LEN(hlen, ulp,
PULLUP_LEN_LOCKED(hlen, ulp,
(TCP(ulp)->th_off << 2));
if ((tcpopts_parse(TCP(ulp), &mss) &
IP_FW_TCPOPT_MSS) == 0)
@ -3182,6 +3188,7 @@ do { \
} /* end of inner loop, scan opcodes */
#undef PULLUP_LEN
#undef PULLUP_LEN_LOCKED
if (done)
break;

View File

@ -377,33 +377,30 @@ ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_fw *rule,
uint16_t eaction_id, uint16_t default_id, uint16_t instance_id)
{
ipfw_insn *cmd, *icmd;
int l, cmdlen;
int l;
IPFW_UH_WLOCK_ASSERT(ch);
IPFW_WLOCK_ASSERT(ch);
cmd = ACTION_PTR(rule);
l = rule->cmd_len - rule->act_ofs;
while (l > 0) {
cmdlen = F_LEN(cmd);
l -= cmdlen;
if (cmd->opcode == O_EXTERNAL_ACTION || l <= 0)
break;
cmd += cmdlen;
}
/*
* Return if there is not O_EXTERNAL_ACTION or its id is
* different.
*/
cmd = ipfw_get_action(rule);
if (cmd->opcode != O_EXTERNAL_ACTION ||
cmd->arg1 != eaction_id)
return (0);
/*
* If instance_id is specified, we need to truncate the
* rule length. Check if there is O_EXTERNAL_INSTANCE opcode.
*
* NOTE: F_LEN(cmd) must be 1 for O_EXTERNAL_ACTION opcode,
* and rule length should be enough to keep O_EXTERNAL_INSTANCE
* opcode, thus we do check for l > 1.
*/
if (instance_id != 0 && l > 0) {
MPASS(cmdlen == 1);
l = rule->cmd + rule->cmd_len - cmd;
if (instance_id != 0 && l > 1) {
MPASS(F_LEN(cmd) == 1);
icmd = cmd + 1;
if (icmd->opcode != O_EXTERNAL_INSTANCE ||
icmd->arg1 != instance_id)
@ -415,8 +412,9 @@ ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_fw *rule,
* opcode.
*/
EACTION_DEBUG("truncate rule %d: len %u -> %u",
rule->rulenum, rule->cmd_len, rule->cmd_len - l);
rule->cmd_len -= l;
rule->rulenum, rule->cmd_len,
rule->cmd_len - F_LEN(icmd));
rule->cmd_len -= F_LEN(icmd);
MPASS(((uint32_t *)icmd -
(uint32_t *)rule->cmd) == rule->cmd_len);
}

View File

@ -140,13 +140,12 @@ ifaddr_change(void *arg __unused, struct ifnet *ifp)
static void
flush_nat_ptrs(struct ip_fw_chain *chain, const int ix)
{
int i;
ipfw_insn_nat *cmd;
int i;
IPFW_WLOCK_ASSERT(chain);
for (i = 0; i < chain->n_rules; i++) {
cmd = (ipfw_insn_nat *)ACTION_PTR(chain->map[i]);
/* XXX skip log and the like ? */
cmd = (ipfw_insn_nat *)ipfw_get_action(chain->map[i]);
if (cmd->o.opcode == O_NAT && cmd->nat != NULL &&
(ix < 0 || cmd->nat->id == ix))
cmd->nat = NULL;

View File

@ -665,6 +665,7 @@ struct ip_fw *ipfw_alloc_rule(struct ip_fw_chain *chain, size_t rulesize);
void ipfw_free_rule(struct ip_fw *rule);
int ipfw_match_range(struct ip_fw *rule, ipfw_range_tlv *rt);
int ipfw_mark_object_kidx(uint32_t *bmask, uint16_t etlv, uint16_t kidx);
ipfw_insn *ipfw_get_action(struct ip_fw *);
typedef int (sopt_handler_f)(struct ip_fw_chain *ch,
ip_fw3_opheader *op3, struct sockopt_data *sd);

View File

@ -1217,6 +1217,35 @@ move_range(struct ip_fw_chain *chain, ipfw_range_tlv *rt)
return (0);
}
/*
* Returns pointer to action instruction, skips all possible rule
* modifiers like O_LOG, O_TAG, O_ALTQ.
*/
ipfw_insn *
ipfw_get_action(struct ip_fw *rule)
{
ipfw_insn *cmd;
int l, cmdlen;
cmd = ACTION_PTR(rule);
l = rule->cmd_len - rule->act_ofs;
while (l > 0) {
switch (cmd->opcode) {
case O_ALTQ:
case O_LOG:
case O_TAG:
break;
default:
return (cmd);
}
cmdlen = F_LEN(cmd);
l -= cmdlen;
cmd += cmdlen;
}
panic("%s: rule (%p) has not action opcode", __func__, rule);
return (NULL);
}
/*
* Clear counters for a specific rule.
* Normally run under IPFW_UH_RLOCK, but these are idempotent ops

View File

@ -6351,9 +6351,8 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb
m = *m0; /* pf_normalize messes with m0 */
h = mtod(m, struct ip6_hdr *);
#if 1
/*
* we do not support jumbogram yet. if we keep going, zero ip6_plen
* we do not support jumbogram. if we keep going, zero ip6_plen
* will do something bad, so drop the packet for now.
*/
if (htons(h->ip6_plen) == 0) {
@ -6361,7 +6360,6 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb
REASON_SET(&reason, PFRES_NORM); /*XXX*/
goto done;
}
#endif
pd.src = (struct pf_addr *)&h->ip6_src;
pd.dst = (struct pf_addr *)&h->ip6_dst;

View File

@ -1139,9 +1139,8 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif,
int off;
struct ip6_ext ext;
struct ip6_opt opt;
struct ip6_opt_jumbo jumbo;
struct ip6_frag frag;
u_int32_t jumbolen = 0, plen;
u_int32_t plen;
int optend;
int ooff;
u_int8_t proto;
@ -1185,6 +1184,11 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif,
if (sizeof(struct ip6_hdr) + IPV6_MAXPACKET < m->m_pkthdr.len)
goto drop;
plen = ntohs(h->ip6_plen);
/* jumbo payload option not supported */
if (plen == 0)
goto drop;
extoff = 0;
off = sizeof(struct ip6_hdr);
proto = h->ip6_nxt;
@ -1228,26 +1232,8 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif,
goto shortpkt;
if (ooff + sizeof(opt) + opt.ip6o_len > optend)
goto drop;
switch (opt.ip6o_type) {
case IP6OPT_JUMBO:
if (h->ip6_plen != 0)
goto drop;
if (!pf_pull_hdr(m, ooff, &jumbo,
sizeof(jumbo), NULL, NULL,
AF_INET6))
goto shortpkt;
memcpy(&jumbolen, jumbo.ip6oj_jumbo_len,
sizeof(jumbolen));
jumbolen = ntohl(jumbolen);
if (jumbolen <= IPV6_MAXPACKET)
goto drop;
if (sizeof(struct ip6_hdr) + jumbolen !=
m->m_pkthdr.len)
goto drop;
break;
default:
break;
}
if (opt.ip6o_type == IP6OPT_JUMBO)
goto drop;
ooff += sizeof(opt) + opt.ip6o_len;
} while (ooff < optend);
@ -1260,13 +1246,6 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif,
}
} while (!terminal);
/* jumbo payload option must be present, or plen > 0 */
if (ntohs(h->ip6_plen) == 0)
plen = jumbolen;
else
plen = ntohs(h->ip6_plen);
if (plen == 0)
goto drop;
if (sizeof(struct ip6_hdr) + plen > m->m_pkthdr.len)
goto shortpkt;
@ -1275,10 +1254,6 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif,
return (PF_PASS);
fragment:
/* Jumbo payload packets cannot be fragmented. */
plen = ntohs(h->ip6_plen);
if (plen == 0 || jumbolen)
goto drop;
if (sizeof(struct ip6_hdr) + plen > m->m_pkthdr.len)
goto shortpkt;

View File

@ -65,7 +65,7 @@ END(copyio_fault)
ENTER_USER_ACCESS(a7)
li t2, XLEN_BYTES
blt a2, t2, 3f /* Byte-copy if len < XLEN_BYTES */
blt a2, t2, 4f /* Byte-copy if len < XLEN_BYTES */
/*
* Compare lower bits of src and dest.
@ -73,7 +73,7 @@ END(copyio_fault)
*/
andi t0, a0, (XLEN_BYTES-1) /* Low bits of src */
andi t1, a1, (XLEN_BYTES-1) /* Low bits of dest */
bne t0, t1, 3f /* Misaligned. Go to byte copy */
bne t0, t1, 4f /* Misaligned. Go to byte copy */
beqz t0, 2f /* Already word-aligned, skip ahead */
/* Byte copy until the first word-aligned address */
@ -84,6 +84,7 @@ END(copyio_fault)
addi a2, a2, -1 /* len-- */
andi t0, a0, (XLEN_BYTES-1)
bnez t0, 1b
j 3f
/* Copy words */
2: ld a4, 0(a0) /* Load word from src */
@ -91,20 +92,20 @@ END(copyio_fault)
sd a4, 0(a1) /* Store word in dest */
addi a1, a1, XLEN_BYTES
addi a2, a2, -XLEN_BYTES /* len -= XLEN_BYTES */
bgeu a2, t2, 2b /* Again if len >= XLEN_BYTES */
3: bgeu a2, t2, 2b /* Again if len >= XLEN_BYTES */
/* Check if we're finished */
beqz a2, 4f
beqz a2, 5f
/* Copy any remaining bytes */
3: lb a4, 0(a0) /* Load byte from src */
4: lb a4, 0(a0) /* Load byte from src */
addi a0, a0, 1
sb a4, 0(a1) /* Store byte in dest */
addi a1, a1, 1
addi a2, a2, -1 /* len-- */
bnez a2, 3b
bnez a2, 4b
4: EXIT_USER_ACCESS(a7)
5: EXIT_USER_ACCESS(a7)
SET_FAULT_HANDLER(x0, a7) /* Clear the handler */
.endm

View File

@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
*/
#include <sys/param.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/malloc.h>

View File

@ -143,7 +143,8 @@ struct ata_params {
/*77*/ u_int16_t satacapabilities2;
#define ATA_SATA_CURR_GEN_MASK 0x0006
#define ATA_SUPPORT_NCQ_STREAM 0x0010
#define ATA_SUPPORT_NCQ_QMANAGEMENT 0x0020
#define ATA_SUPPORT_NCQ_NON_DATA 0x0020
#define ATA_SUPPORT_NCQ_QMANAGEMENT ATA_SUPPORT_NCQ_NON_DATA
#define ATA_SUPPORT_RCVSND_FPDMA_QUEUED 0x0040
/*78*/ u_int16_t satasupport;
#define ATA_SUPPORT_NONZERO 0x0002
@ -152,6 +153,7 @@ struct ata_params {
#define ATA_SUPPORT_INORDERDATA 0x0010
#define ATA_SUPPORT_ASYNCNOTIF 0x0020
#define ATA_SUPPORT_SOFTSETPRESERVE 0x0040
#define ATA_SUPPORT_NCQ_AUTOSENSE 0x0080
/*79*/ u_int16_t sataenabled;
#define ATA_ENABLED_DAPST 0x0080
@ -285,7 +287,8 @@ struct ata_params {
#define ATA_FORM_FACTOR_C_FAST 0x0009
/*169*/ u_int16_t support_dsm;
#define ATA_SUPPORT_DSM_TRIM 0x0001
u_int16_t reserved170[6];
/*170*/ u_int8_t product_id[8]; /* Additional Product Identifier */
u_int16_t reserved174[2];
/*176*/ u_int8_t media_serial[60];
/*206*/ u_int16_t sct;
u_int16_t reserved207[2];

View File

@ -1332,31 +1332,27 @@ swap_pager_getpages_async(vm_object_t object, vm_page_t *ma, int count,
* completion.
*
* The parent has soft-busy'd the pages it passes us and will unbusy
* those whos rtvals[] entry is not set to VM_PAGER_PEND on return.
* those whose rtvals[] entry is not set to VM_PAGER_PEND on return.
* We need to unbusy the rest on I/O completion.
*/
static void
swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count,
int flags, int *rtvals)
{
int i, n;
boolean_t sync;
daddr_t addr, n_free, s_free;
struct buf *bp;
daddr_t addr, blk, n_free, s_free;
vm_page_t mreq;
int i, j, n;
bool async;
swp_pager_init_freerange(&s_free, &n_free);
if (count && ma[0]->object != object) {
panic("swap_pager_putpages: object mismatch %p/%p",
object,
ma[0]->object
);
}
KASSERT(count == 0 || ma[0]->object == object,
("%s: object mismatch %p/%p",
__func__, object, ma[0]->object));
/*
* Step 1
*
* Turn object into OBJT_SWAP
* check for bogus sysops
* force sync if not pageout process
* Turn object into OBJT_SWAP. Force sync if not a pageout process.
*/
if (object->type != OBJT_SWAP) {
addr = swp_pager_meta_build(object, 0, SWAPBLK_NONE);
@ -1364,12 +1360,8 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count,
("unexpected object swap block"));
}
VM_OBJECT_WUNLOCK(object);
n = 0;
if (curproc != pageproc)
sync = TRUE;
else
sync = (flags & VM_PAGER_PUT_SYNC) != 0;
async = curproc == pageproc && (flags & VM_PAGER_PUT_SYNC) == 0;
swp_pager_init_freerange(&s_free, &n_free);
/*
* Step 2
@ -1379,10 +1371,6 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count,
* successfully.
*/
for (i = 0; i < count; i += n) {
int j;
struct buf *bp;
daddr_t blk;
/* Maximum I/O size is limited by maximum swap block size. */
n = min(count - i, nsw_cluster_max);
@ -1390,15 +1378,15 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count,
blk = swp_pager_getswapspace(&n, 4);
if (blk == SWAPBLK_NONE) {
for (j = 0; j < n; ++j)
rtvals[i+j] = VM_PAGER_FAIL;
rtvals[i + j] = VM_PAGER_FAIL;
continue;
}
/*
* All I/O parameters have been satisfied, build the I/O
* All I/O parameters have been satisfied. Build the I/O
* request and assign the swap space.
*/
if (sync != TRUE) {
if (async) {
mtx_lock(&swbuf_mtx);
while (nsw_wcount_async == 0)
msleep(&nsw_wcount_async, &swbuf_mtx, PVM,
@ -1407,7 +1395,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count,
mtx_unlock(&swbuf_mtx);
}
bp = uma_zalloc(swwbuf_zone, M_WAITOK);
if (sync != TRUE)
if (async)
bp->b_flags = B_ASYNC;
bp->b_flags |= B_PAGING;
bp->b_iocmd = BIO_WRITE;
@ -1420,8 +1408,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count,
VM_OBJECT_WLOCK(object);
for (j = 0; j < n; ++j) {
vm_page_t mreq = ma[i+j];
mreq = ma[i + j];
addr = swp_pager_meta_build(mreq->object, mreq->pindex,
blk + j);
if (addr != SWAPBLK_NONE)
@ -1455,9 +1442,9 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count,
/*
* asynchronous
*
* NOTE: b_blkno is destroyed by the call to swapdev_strategy
* NOTE: b_blkno is destroyed by the call to swapdev_strategy.
*/
if (sync == FALSE) {
if (async) {
bp->b_iodone = swp_pager_async_iodone;
BUF_KERNPROC(bp);
swp_pager_strategy(bp);
@ -1467,7 +1454,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count,
/*
* synchronous
*
* NOTE: b_blkno is destroyed by the call to swapdev_strategy
* NOTE: b_blkno is destroyed by the call to swapdev_strategy.
*/
bp->b_iodone = bdone;
swp_pager_strategy(bp);
@ -1483,8 +1470,8 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count,
*/
swp_pager_async_iodone(bp);
}
VM_OBJECT_WLOCK(object);
swp_pager_freeswapspace(s_free, n_free);
VM_OBJECT_WLOCK(object);
}
/*

View File

@ -460,11 +460,11 @@ intpr(int clientOnly, int serverOnly)
xo_close_container("operations");
xo_open_container("server");
xo_emit("{T:Server Re-Failed:}\n");
xo_emit("{T:retfailed/%17ju}\n", (uintmax_t)ext_nfsstats.srvrpc_errs);
xo_emit("{T:Server Re-Failed}\n");
xo_emit("{:retfailed/%16ju}\n", (uintmax_t)ext_nfsstats.srvrpc_errs);
xo_emit("{T:Server Faults:}\n");
xo_emit("{T:faults/%13ju}\n", (uintmax_t)ext_nfsstats.srv_errs);
xo_emit("{T:Server Faults}\n");
xo_emit("{:faults/%13ju}\n", (uintmax_t)ext_nfsstats.srv_errs);
xo_emit("{T:Server Write Gathering:/%13.13s}\n");

View File

@ -31,7 +31,7 @@
.\" @(#)printf.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
.Dd April 21, 2014
.Dd July 29, 2019
.Dt PRINTF 1
.Os
.Sh NAME
@ -87,8 +87,6 @@ are as follows:
Write a <bell> character.
.It Cm \eb
Write a <backspace> character.
.It Cm \ec
Ignore remaining characters in this string.
.It Cm \ef
Write a <form-feed> character.
.It Cm \en
@ -289,7 +287,12 @@ The permitted escape sequences are slightly different in that
octal escapes are
.Cm \e0 Ns Ar num
instead of
.Cm \e Ns Ar num .
.Cm \e Ns Ar num
and that an additional escape sequence
.Cm \ec
stops further output from this
.Nm
invocation.
.It Cm n$
Allows reordering of the output according to
.Ar argument .