svn commit: r366507 - head/sys/cam/scsi

2020-10-06 Thread Warner Losh
Author: imp
Date: Wed Oct  7 05:44:35 2020
New Revision: 366507
URL: https://svnweb.freebsd.org/changeset/base/366507

Log:
  cam: Add quirk for Samsung MZ7* behind a SATA-to-SAS interposer
  
  Sometimes, this drive will be present in the system such that the the
  firmware identification string doesn't start with ATA, such as when
  it's behind a SATA-to-SAS interposer. Add another quirk for that.
  
  Submitted by: github user mr44er
  Github PR: 423

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Wed Oct  7 05:36:05 2020(r366506)
+++ head/sys/cam/scsi/scsi_da.c Wed Oct  7 05:44:35 2020(r366507)
@@ -1417,6 +1417,15 @@ static struct da_quirk_entry da_quirk_table[] =
},
{
/*
+ * Same as above but enable the quirks for SSD SAMSUNG MZ7*
+ * connected via SATA-to-SAS interposer and because of this
+ * starting without "ATA"
+*/
+   { T_DIRECT, SIP_MEDIA_FIXED, "SAMSUNG", "MZ7*", "*" },
+   /*quirks*/DA_Q_4K
+   },
+   {
+   /*
 * SuperTalent TeraDrive CT SSDs
 * 4k optimised & trim only works in 4k requests + 4k aligned
 */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366506 - head/sbin/nvmecontrol/modules/wdc

2020-10-06 Thread Warner Losh
Author: imp
Date: Wed Oct  7 05:36:05 2020
New Revision: 366506
URL: https://svnweb.freebsd.org/changeset/base/366506

Log:
  nvmecontrol: Update wdc module for newer WDC NVMe products
  
  Update the to log fetch operation for latest WDC NVMe products.
  
  Tested on HGST SN100 (a few years old) and WDC SN720 (more recent).
  
  Submitted by: Akhilesh Rn  (minor style tweak by me)
  Github PR: 435

Modified:
  head/sbin/nvmecontrol/modules/wdc/wdc.c

Modified: head/sbin/nvmecontrol/modules/wdc/wdc.c
==
--- head/sbin/nvmecontrol/modules/wdc/wdc.c Tue Oct  6 23:35:26 2020
(r366505)
+++ head/sbin/nvmecontrol/modules/wdc/wdc.c Wed Oct  7 05:36:05 2020
(r366506)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include "nvmecontrol.h"
 
@@ -61,14 +62,18 @@ static struct options 
 {
const char *template;
const char *dev;
+   uint8_t data_area;
 } opt = {
.template = NULL,
.dev = NULL,
+   .data_area = 0,
 };
 
 static const struct opts opts[] = {
OPT("template", 'o', arg_string, opt, template,
"Template for paths to use for different logs"),
+   OPT("data-area", 'd', arg_uint8, opt, data_area,
+   "Data-area to retrieve up to"),
OPT_END
 };
 
@@ -88,11 +93,27 @@ static struct cmd cap_diag_cmd = {
 
 CMD_SUBCOMMAND(wdc_cmd, cap_diag_cmd);
 
-#define WDC_NVME_TOC_SIZE  8
+#define WDC_NVME_VID   0x1c58
+#define WDC_NVME_VID_2 0x1b96
+#define WDC_NVME_VID_3 0x15b7
 
-#define WDC_NVME_CAP_DIAG_OPCODE   0xe6
-#define WDC_NVME_CAP_DIAG_CMD  0x
+#define WDC_NVME_TOC_SIZE  0x8
+#define WDC_NVME_LOG_SIZE_HDR_LEN  0x8
+#define WDC_NVME_CAP_DIAG_OPCODE_E60xe6
+#define WDC_NVME_CAP_DIAG_CMD  0x
+#define WDC_NVME_CAP_DIAG_OPCODE_FA0xfa
+#define WDC_NVME_DUI_MAX_SECTIONS_V0   0x3c
+#define WDC_NVME_DUI_MAX_SECTIONS_V1   0x3a
+#define WDC_NVME_DUI_MAX_SECTIONS_V2   0x26
+#define WDC_NVME_DUI_MAX_SECTIONS_V3   0x23
 
+typedef enum wdc_dui_header {
+   WDC_DUI_HEADER_VER_0 = 0,
+   WDC_DUI_HEADER_VER_1,
+   WDC_DUI_HEADER_VER_2,
+   WDC_DUI_HEADER_VER_3,
+} wdc_dui_header;
+
 static void
 wdc_append_serial_name(int fd, char *buf, size_t len, const char *suffix)
 {
@@ -108,25 +129,26 @@ wdc_append_serial_name(int fd, char *buf, size_t len, 
while (walker > sn && *walker == ' ')
walker--;
*++walker = '\0';
-   snprintf(buf, len, "%s%s.bin", sn, suffix);
+   snprintf(buf, len, "_%s_%s.bin", sn, suffix);
 }
 
 static void
 wdc_get_data(int fd, uint32_t opcode, uint32_t len, uint32_t off, uint32_t cmd,
-uint8_t *buffer, size_t buflen)
+uint8_t *buffer, size_t buflen, bool e6lg_flag)
 {
struct nvme_pt_command  pt;
 
memset(, 0, sizeof(pt));
pt.cmd.opc = opcode;
-   pt.cmd.cdw10 = htole32(len / sizeof(uint32_t)); /* - 1 like all the 
others ??? */
-   pt.cmd.cdw11 = htole32(off / sizeof(uint32_t));
+   pt.cmd.cdw10 = htole32(len / sizeof(uint32_t));
pt.cmd.cdw12 = htole32(cmd);
+   if (e6lg_flag)
+   pt.cmd.cdw11 = htole32(off / sizeof(uint32_t));
+   else
+   pt.cmd.cdw13 = htole32(off / sizeof(uint32_t));
pt.buf = buffer;
pt.len = buflen;
pt.is_read = 1;
-// printf("opcode %#x cdw10(len) %#x cdw11(offset?) %#x cdw12(cmd/sub) %#x 
buflen %zd\n",
-// (int)opcode, (int)cdw10, (int)cdw11, (int)cdw12, buflen);
 
if (ioctl(fd, NVME_PASSTHROUGH_CMD, ) < 0)
err(1, "wdc_get_data request failed");
@@ -135,17 +157,29 @@ wdc_get_data(int fd, uint32_t opcode, uint32_t len, ui
 }
 
 static void
-wdc_do_dump(int fd, char *tmpl, const char *suffix, uint32_t opcode,
+wdc_do_dump_e6(int fd, char *tmpl, const char *suffix, uint32_t opcode,
 uint32_t cmd, int len_off)
 {
int first;
int fd2;
-   uint8_t *buf;
+   uint8_t *buf, *hdr;
uint32_t len, offset;
size_t resid;
+   bool e6lg_flag = false;
 
wdc_append_serial_name(fd, tmpl, MAXPATHLEN, suffix);
 
+   /* Read Log Dump header */
+   len = WDC_NVME_LOG_SIZE_HDR_LEN;
+   offset = 0;
+   hdr = malloc(len);
+   if (hdr == NULL)
+   errx(1, "Can't get buffer to read dump");
+   wdc_get_data(fd, opcode, len, offset, cmd, hdr, len, false);
+   if (memcmp("E6LG", hdr, 4) == 0) {
+   e6lg_flag = true;
+   }
+
/* XXX overwrite protection? */
fd2 = open(tmpl, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd2 < 0)
@@ -159,15 +193,13 @@ wdc_do_dump(int fd, char *tmpl, const char *suffix, ui
 
do {
resid = len > NVME_MAX_XFER_SIZE ? NVME_MAX_XFER_SIZE : 

svn commit: r366505 - head/sys/cam/nvme

2020-10-06 Thread Warner Losh
Author: imp
Date: Tue Oct  6 23:35:26 2020
New Revision: 366505
URL: https://svnweb.freebsd.org/changeset/base/366505

Log:
  nvme: Note where the CCB was released for passthrough command

Modified:
  head/sys/cam/nvme/nvme_da.c

Modified: head/sys/cam/nvme/nvme_da.c
==
--- head/sys/cam/nvme/nvme_da.c Tue Oct  6 23:33:56 2020(r366504)
+++ head/sys/cam/nvme/nvme_da.c Tue Oct  6 23:35:26 2020(r366505)
@@ -1257,6 +1257,7 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb
/* No-op.  We're polling */
return;
case NDA_CCB_PASS:
+   /* NVME_PASSTHROUGH_CMD runs this CCB and releases it */
return;
default:
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366504 - head/sys/cam

2020-10-06 Thread Warner Losh
Author: imp
Date: Tue Oct  6 23:33:56 2020
New Revision: 366504
URL: https://svnweb.freebsd.org/changeset/base/366504

Log:
  cam: Assert we have a reference when freeing sim
  
  Before we decrement refcount to sleep on the sim, assert that the
  refcount >= 1. If it were 0 here, we'd never wake up.

Modified:
  head/sys/cam/cam_sim.c

Modified: head/sys/cam/cam_sim.c
==
--- head/sys/cam/cam_sim.c  Tue Oct  6 23:16:56 2020(r366503)
+++ head/sys/cam/cam_sim.c  Tue Oct  6 23:33:56 2020(r366504)
@@ -134,6 +134,7 @@ cam_sim_free(struct cam_sim *sim, int free_devq)
mtx = sim->mtx;
mtx_assert(mtx, MA_OWNED);
}
+   KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
sim->refcount--;
if (sim->refcount > 0) {
error = msleep(sim, mtx, PRIBIO, "simfree", 0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366503 - in head/sys: kern sys x86/x86

2020-10-06 Thread Mitchell Horne
Author: mhorne
Date: Tue Oct  6 23:16:56 2020
New Revision: 366503
URL: https://svnweb.freebsd.org/changeset/base/366503

Log:
  Remove unused function cpu_boot()
  
  The prototype was added with the creation of kern_shutdown.c in r17658,
  but it appears to have never been implemented. Remove it now.
  
  Reviewed by:  cem, kib
  Differential Revision:https://reviews.freebsd.org/D26702

Modified:
  head/sys/kern/kern_shutdown.c
  head/sys/sys/systm.h
  head/sys/x86/x86/cpu_machdep.c

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Tue Oct  6 22:53:11 2020
(r366502)
+++ head/sys/kern/kern_shutdown.c   Tue Oct  6 23:16:56 2020
(r366503)
@@ -668,7 +668,6 @@ shutdown_reset(void *junk, int howto)
spinlock_enter();
 #endif
 
-   /* cpu_boot(howto); */ /* doesn't do anything at the moment */
cpu_reset();
/* NOTREACHED */ /* assuming reset worked */
 }

Modified: head/sys/sys/systm.h
==
--- head/sys/sys/systm.hTue Oct  6 22:53:11 2020(r366502)
+++ head/sys/sys/systm.hTue Oct  6 23:16:56 2020(r366503)
@@ -268,7 +268,6 @@ void*phashinit_flags(int count, struct malloc_type 
*t
 int flags);
 void   g_waitidle(void);
 
-void   cpu_boot(int);
 void   cpu_flush_dcache(void *, size_t);
 void   cpu_rootconf(void);
 void   critical_enter_KBI(void);

Modified: head/sys/x86/x86/cpu_machdep.c
==
--- head/sys/x86/x86/cpu_machdep.c  Tue Oct  6 22:53:11 2020
(r366502)
+++ head/sys/x86/x86/cpu_machdep.c  Tue Oct  6 23:16:56 2020
(r366503)
@@ -194,17 +194,6 @@ SYSCTL_BOOL(_machdep, OID_AUTO, mwait_cpustop_broken, 
 "Can not reliably wake MONITOR/MWAIT cpus without interrupts");
 
 /*
- * Machine dependent boot() routine
- *
- * I haven't seen anything to put here yet
- * Possibly some stuff might be grafted back here from boot()
- */
-void
-cpu_boot(int howto)
-{
-}
-
-/*
  * Flush the D-cache for non-DMA I/O so that the I-cache can
  * be made coherent later.
  */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366502 - head/share/man/man8

2020-10-06 Thread John-Mark Gurney
Author: jmg
Date: Tue Oct  6 22:53:11 2020
New Revision: 366502
URL: https://svnweb.freebsd.org/changeset/base/366502

Log:
  add the FILESYSTEMS placeholder and note that it's the default 
early_late_divider

Modified:
  head/share/man/man8/rc.8

Modified: head/share/man/man8/rc.8
==
--- head/share/man/man8/rc.8Tue Oct  6 21:31:04 2020(r366501)
+++ head/share/man/man8/rc.8Tue Oct  6 22:53:11 2020(r366502)
@@ -31,7 +31,7 @@
 .\" @(#)rc.8   8.2 (Berkeley) 12/11/93
 .\" $FreeBSD$
 .\"
-.Dd September 6, 2019
+.Dd October 6, 2020
 .Dt RC 8
 .Os
 .Sh NAME
@@ -242,7 +242,11 @@ Scripts that are
 .Dq placeholders
 to ensure that certain operations are performed before others.
 In order of startup, these are:
-.Bl -tag -width ".Pa NETWORKING"
+.Bl -tag -width ".Pa FILESYSTEMS"
+.It Pa FILESYSTEMS
+Ensure that root and other critical file systems are mounted.
+This is the default
+.Va $early_late_divider .
 .It Pa NETWORKING
 Ensure basic network services are running, including general
 network configuration.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366501 - head/sys/fs/ext2fs

2020-10-06 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Oct  6 21:31:04 2020
New Revision: 366501
URL: https://svnweb.freebsd.org/changeset/base/366501

Log:
  ext2fs: minor typo.
  
  Obtained from:Dragonfly
  MFC after:3 days

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==
--- head/sys/fs/ext2fs/ext2_alloc.c Tue Oct  6 19:19:56 2020
(r366500)
+++ head/sys/fs/ext2fs/ext2_alloc.c Tue Oct  6 21:31:04 2020
(r366501)
@@ -193,7 +193,7 @@ static SYSCTL_NODE(_vfs, OID_AUTO, ext2fs, CTLFLAG_RW 
 static int doasyncfree = 1;
 
 SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doasyncfree, CTLFLAG_RW, , 0,
-"Use asychronous writes to update block pointers when freeing blocks");
+"Use asynchronous writes to update block pointers when freeing blocks");
 
 static int doreallocblks = 0;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366500 - head/sys/net

2020-10-06 Thread Kristof Provost
Author: kp
Date: Tue Oct  6 19:19:56 2020
New Revision: 366500
URL: https://svnweb.freebsd.org/changeset/base/366500

Log:
  bridge: call member interface ioctl() without NET_EPOCH
  
  We're not allowed to hold NET_EPOCH while sleeping, so when we call ioctl()
  handlers for member interfaces we cannot be in NET_EPOCH.  We still need some
  protection of our CK_LISTs, so hold BRIDGE_LOCK instead.
  
  That requires changing BRIDGE_LOCK into a sleepable lock, and separating the
  BRIDGE_RT_LOCK, to protect bridge_rtnode lists. That lock is taken in the data
  path (while in NET_EPOCH), so it cannot be a sleepable lock.
  
  While here document the locking strategy.
  
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D26418

Modified:
  head/sys/net/if_bridge.c

Modified: head/sys/net/if_bridge.c
==
--- head/sys/net/if_bridge.cTue Oct  6 19:15:11 2020(r366499)
+++ head/sys/net/if_bridge.cTue Oct  6 19:19:56 2020(r366500)
@@ -186,17 +186,41 @@ extern void   nd6_setmtu(struct ifnet *);
 
 /*
  * Bridge locking
+ *
+ * The bridge relies heavily on the epoch(9) system to protect its data
+ * structures. This means we can safely use CK_LISTs while in NET_EPOCH, but we
+ * must ensure there is only one writer at a time.
+ *
+ * That is: for read accesses we only need to be in NET_EPOCH, but for write
+ * accesses we must hold:
+ *
+ *  - BRIDGE_RT_LOCK, for any change to bridge_rtnodes
+ *  - BRIDGE_LOCK, for any other change
+ *
+ * The BRIDGE_LOCK is a sleepable lock, because it is held accross ioctl()
+ * calls to bridge member interfaces and these ioctl()s can sleep.
+ * The BRIDGE_RT_LOCK is a non-sleepable mutex, because it is sometimes
+ * required while we're in NET_EPOCH and then we're not allowed to sleep.
  */
 #define BRIDGE_LOCK_INIT(_sc)  do {\
-   mtx_init(&(_sc)->sc_mtx, "if_bridge", NULL, MTX_DEF);   \
+   sx_init(&(_sc)->sc_sx, "if_bridge");\
+   mtx_init(&(_sc)->sc_rt_mtx, "if_bridge rt", NULL, MTX_DEF); \
 } while (0)
 #define BRIDGE_LOCK_DESTROY(_sc)   do {\
-   mtx_destroy(&(_sc)->sc_mtx);\
+   sx_destroy(&(_sc)->sc_sx);  \
+   mtx_destroy(&(_sc)->sc_rt_mtx); \
 } while (0)
-#define BRIDGE_LOCK(_sc)   mtx_lock(&(_sc)->sc_mtx)
-#define BRIDGE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
-#define BRIDGE_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->sc_mtx, 
MA_OWNED)
-#define BRIDGE_UNLOCK_ASSERT(_sc)  mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED)
+#define BRIDGE_LOCK(_sc)   sx_xlock(&(_sc)->sc_sx)
+#define BRIDGE_UNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx)
+#define BRIDGE_LOCK_ASSERT(_sc)sx_assert(&(_sc)->sc_sx, 
SX_XLOCKED)
+#define BRIDGE_LOCK_OR_NET_EPOCH_ASSERT(_sc)   \
+   MPASS(in_epoch(net_epoch_preempt) || sx_xlocked(&(_sc)->sc_sx))
+#define BRIDGE_UNLOCK_ASSERT(_sc)  sx_assert(&(_sc)->sc_sx, SX_UNLOCKED)
+#define BRIDGE_RT_LOCK(_sc)mtx_lock(&(_sc)->sc_rt_mtx)
+#define BRIDGE_RT_UNLOCK(_sc)  mtx_unlock(&(_sc)->sc_rt_mtx)
+#define BRIDGE_RT_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_rt_mtx, MA_OWNED)
+#define BRIDGE_RT_LOCK_OR_NET_EPOCH_ASSERT(_sc)\
+   MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(_sc)->sc_rt_mtx))
 
 /*
  * Bridge interface list entry.
@@ -235,7 +259,8 @@ struct bridge_rtnode {
 struct bridge_softc {
struct ifnet*sc_ifp;/* make this an interface */
LIST_ENTRY(bridge_softc) sc_list;
-   struct mtx  sc_mtx;
+   struct sx   sc_sx;
+   struct mtx  sc_rt_mtx;
uint32_tsc_brtmax;  /* max # of addresses */
uint32_tsc_brtcnt;  /* cur. # of addresses */
uint32_tsc_brttimeout;  /* rt timeout in seconds */
@@ -252,8 +277,8 @@ struct bridge_softc {
struct epoch_contextsc_epoch_ctx;
 };
 
-VNET_DEFINE_STATIC(struct mtx, bridge_list_mtx);
-#defineV_bridge_list_mtx   VNET(bridge_list_mtx)
+VNET_DEFINE_STATIC(struct sx, bridge_list_sx);
+#defineV_bridge_list_sxVNET(bridge_list_sx)
 static eventhandler_tag bridge_detach_cookie;
 
 intbridge_rtable_prune_period = BRIDGE_RTABLE_PRUNE_PERIOD;
@@ -536,11 +561,11 @@ const int bridge_control_table_size = nitems(bridge_co
 
 VNET_DEFINE_STATIC(LIST_HEAD(, bridge_softc), bridge_list);
 #defineV_bridge_list   VNET(bridge_list)
-#defineBRIDGE_LIST_LOCK_INIT(x)mtx_init(_bridge_list_mtx,
\
-   "if_bridge list", NULL, MTX_DEF)
-#defineBRIDGE_LIST_LOCK_DESTROY(x) mtx_destroy(_bridge_list_mtx)
-#defineBRIDGE_LIST_LOCK(x) mtx_lock(_bridge_list_mtx)
-#defineBRIDGE_LIST_UNLOCK(x) 

svn commit: r366499 - stable/12/tools/tools/netmap

2020-10-06 Thread Vincenzo Maffione
Author: vmaffione
Date: Tue Oct  6 19:15:11 2020
New Revision: 366499
URL: https://svnweb.freebsd.org/changeset/base/366499

Log:
  MFC r366394
  
  netmap: tools: extend CFLAGS after including bsd.prog.mk
  
  MFC after:  1 week

Modified:
  stable/12/tools/tools/netmap/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tools/tools/netmap/Makefile
==
--- stable/12/tools/tools/netmap/Makefile   Tue Oct  6 19:14:03 2020
(r366498)
+++ stable/12/tools/tools/netmap/Makefile   Tue Oct  6 19:15:11 2020
(r366499)
@@ -7,9 +7,10 @@ PROGS  =   pkt-gen nmreplay bridge lb
 
 CLEANFILES = $(PROGS) *.o
 MAN=
-CFLAGS += -Werror -Wall
-CFLAGS += -Wextra
 
+.include 
+.include 
+
 LDFLAGS += -lpthread
 .ifdef WITHOUT_PCAP
 CFLAGS += -DNO_PCAP
@@ -17,9 +18,6 @@ CFLAGS += -DNO_PCAP
 LDFLAGS += -lpcap
 .endif
 LDFLAGS += -lm # used by nmreplay
-
-.include 
-.include 
 
 CFLAGS += -Wno-cast-align
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366498 - stable/12/tools/tools/netmap

2020-10-06 Thread Vincenzo Maffione
Author: vmaffione
Date: Tue Oct  6 19:14:03 2020
New Revision: 366498
URL: https://svnweb.freebsd.org/changeset/base/366498

Log:
  MFC r366393
  
  netmap: tools: fix several compiler warnings
  
  MFC after:  1 week

Modified:
  stable/12/tools/tools/netmap/Makefile
  stable/12/tools/tools/netmap/bridge.c
  stable/12/tools/tools/netmap/ctrs.h
  stable/12/tools/tools/netmap/lb.c
  stable/12/tools/tools/netmap/nmreplay.c
  stable/12/tools/tools/netmap/pkt-gen.c
  stable/12/tools/tools/netmap/pkt_hash.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tools/tools/netmap/Makefile
==
--- stable/12/tools/tools/netmap/Makefile   Tue Oct  6 19:12:43 2020
(r366497)
+++ stable/12/tools/tools/netmap/Makefile   Tue Oct  6 19:14:03 2020
(r366498)
@@ -21,6 +21,8 @@ LDFLAGS += -lm # used by nmreplay
 .include 
 .include 
 
+CFLAGS += -Wno-cast-align
+
 all: $(PROGS)
 
 pkt-gen: pkt-gen.o

Modified: stable/12/tools/tools/netmap/bridge.c
==
--- stable/12/tools/tools/netmap/bridge.c   Tue Oct  6 19:12:43 2020
(r366497)
+++ stable/12/tools/tools/netmap/bridge.c   Tue Oct  6 19:14:03 2020
(r366498)
@@ -14,7 +14,7 @@
 #include 
 #include 
 
-int verbose = 0;
+static int verbose = 0;
 
 static int do_abort = 0;
 static int zerocopy = 1; /* enable zerocopy if possible */
@@ -31,7 +31,7 @@ sigint_h(int sig)
 /*
  * how many packets on this set of queues ?
  */
-int
+static int
 pkt_queued(struct nm_desc *d, int tx)
 {
u_int i, tot = 0;

Modified: stable/12/tools/tools/netmap/ctrs.h
==
--- stable/12/tools/tools/netmap/ctrs.h Tue Oct  6 19:12:43 2020
(r366497)
+++ stable/12/tools/tools/netmap/ctrs.h Tue Oct  6 19:14:03 2020
(r366498)
@@ -18,12 +18,12 @@ struct my_ctrs {
  * Caller has to make sure that the buffer is large enough.
  */
 static const char *
-norm2(char *buf, double val, char *fmt, int normalize)
+norm2(char *buf, double val, const char *fmt, int normalize)
 {
-   char *units[] = { "", "K", "M", "G", "T" };
+   const char *units[] = { "", "K", "M", "G", "T" };
u_int i;
if (normalize)
-   for (i = 0; val >=1000 && i < sizeof(units)/sizeof(char *) - 1; 
i++)
+   for (i = 0; val >=1000 && i < sizeof(units)/sizeof(const char 
*) - 1; i++)
val /= 1000;
else
i=0;

Modified: stable/12/tools/tools/netmap/lb.c
==
--- stable/12/tools/tools/netmap/lb.c   Tue Oct  6 19:12:43 2020
(r366497)
+++ stable/12/tools/tools/netmap/lb.c   Tue Oct  6 19:14:03 2020
(r366498)
@@ -89,7 +89,7 @@ struct compact_ipv6_hdr {
 #define BUF_REVOKE 100
 #define STAT_MSG_MAXSIZE 1024
 
-struct {
+static struct {
char ifname[MAX_IFNAMELEN];
char base_name[MAX_IFNAMELEN];
int netmap_fd;
@@ -115,7 +115,7 @@ struct overflow_queue {
uint32_t size;
 };
 
-struct overflow_queue *freeq;
+static struct overflow_queue *freeq;
 
 static inline int
 oq_full(struct overflow_queue *q)
@@ -160,12 +160,12 @@ oq_deq(struct overflow_queue *q)
 
 static volatile int do_abort = 0;
 
-uint64_t dropped = 0;
-uint64_t forwarded = 0;
-uint64_t received_bytes = 0;
-uint64_t received_pkts = 0;
-uint64_t non_ip = 0;
-uint32_t freeq_n = 0;
+static uint64_t dropped = 0;
+static uint64_t forwarded = 0;
+static uint64_t received_bytes = 0;
+static uint64_t received_pkts = 0;
+static uint64_t non_ip = 0;
+static uint32_t freeq_n = 0;
 
 struct port_des {
char interface[MAX_PORTNAMELEN];
@@ -178,7 +178,7 @@ struct port_des {
struct group_des *group;
 };
 
-struct port_des *ports;
+static struct port_des *ports;
 
 /* each group of pipes receives all the packets */
 struct group_des {
@@ -190,7 +190,7 @@ struct group_des {
int custom_port;
 };
 
-struct group_des *groups;
+static struct group_des *groups;
 
 /* statistcs */
 struct counters {
@@ -205,7 +205,7 @@ struct counters {
 #define COUNTERS_FULL  1
 };
 
-struct counters counters_buf;
+static struct counters counters_buf;
 
 static void *
 print_stats(void *arg)
@@ -387,7 +387,7 @@ static void sigint_h(int sig)
signal(SIGINT, SIG_DFL);
 }
 
-void usage()
+static void usage()
 {
printf("usage: lb [options]\n");
printf("where options are:\n");
@@ -404,9 +404,9 @@ void usage()
 }
 
 static int
-parse_pipes(char *spec)
+parse_pipes(const char *spec)
 {
-   char *end = index(spec, ':');
+   const char *end = index(spec, ':');
static int max_groups = 0;
struct group_des *g;
 
@@ -458,7 +458,8 @@ parse_pipes(char *spec)
 }
 
 /* complete the initialization of the groups data structure */
-void init_groups(void)
+static 

svn commit: r366497 - in stable/12: share/man/man4 tools/tools/netmap

2020-10-06 Thread Vincenzo Maffione
Author: vmaffione
Date: Tue Oct  6 19:12:43 2020
New Revision: 366497
URL: https://svnweb.freebsd.org/changeset/base/366497

Log:
  MFC r366389
  
  netmap: minor documentation fix
  
  Also update date of pkt-gen.8 (not done in r366387).
  
  Submitted by:   milosz.kaniew...@gmail.com

Modified:
  stable/12/share/man/man4/netmap.4
  stable/12/tools/tools/netmap/pkt-gen.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/netmap.4
==
--- stable/12/share/man/man4/netmap.4   Tue Oct  6 19:11:55 2020
(r366496)
+++ stable/12/share/man/man4/netmap.4   Tue Oct  6 19:12:43 2020
(r366497)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 6, 2020
+.Dd October 3, 2020
 .Dt NETMAP 4
 .Os
 .Sh NAME
@@ -1051,7 +1051,7 @@ void receiver(void)
 for (;;) {
poll(, 1, -1);
 while ( (buf = nm_nextpkt(d, )) )
-   consume_pkt(buf, h->len);
+   consume_pkt(buf, h.len);
 }
 nm_close(d);
 }

Modified: stable/12/tools/tools/netmap/pkt-gen.8
==
--- stable/12/tools/tools/netmap/pkt-gen.8  Tue Oct  6 19:11:55 2020
(r366496)
+++ stable/12/tools/tools/netmap/pkt-gen.8  Tue Oct  6 19:12:43 2020
(r366497)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 31, 2018
+.Dd October 3, 2020
 .Dt PKT-GEN 8
 .Os
 .Sh NAME
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366496 - stable/12/sys/net

2020-10-06 Thread Vincenzo Maffione
Author: vmaffione
Date: Tue Oct  6 19:11:55 2020
New Revision: 366496
URL: https://svnweb.freebsd.org/changeset/base/366496

Log:
  MFC r366388
  
  netmap: fix constness warnings generated by "-Wcast-qual"
  
  Submitted by:   milosz.kaniew...@gmail.com

Modified:
  stable/12/sys/net/netmap_user.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/netmap_user.h
==
--- stable/12/sys/net/netmap_user.h Tue Oct  6 19:10:32 2020
(r366495)
+++ stable/12/sys/net/netmap_user.h Tue Oct  6 19:11:55 2020
(r366496)
@@ -292,7 +292,7 @@ struct nm_desc {
  * when the descriptor is open correctly, d->self == d
  * Eventually we should also use some magic number.
  */
-#define P2NMD(p)   ((struct nm_desc *)(p))
+#define P2NMD(p)   ((const struct nm_desc *)(p))
 #define IS_NETMAP_DESC(d)  ((d) && P2NMD(d)->self == P2NMD(d))
 #define NETMAP_FD(d)   (P2NMD(d)->fd)
 
@@ -623,7 +623,7 @@ nm_parse(const char *ifname, struct nm_desc *d, char *
const char *vpname = NULL;
u_int namelen;
uint32_t nr_ringid = 0, nr_flags;
-   char errmsg[MAXERRMSG] = "";
+   char errmsg[MAXERRMSG] = "", *tmp;
long num;
uint16_t nr_arg2 = 0;
enum { P_START, P_RNGSFXOK, P_GETNUM, P_FLAGS, P_FLAGSOK, P_MEMID } 
p_state;
@@ -720,12 +720,13 @@ nm_parse(const char *ifname, struct nm_desc *d, char *
port++;
break;
case P_GETNUM:
-   num = strtol(port, (char **), 10);
+   num = strtol(port, , 10);
if (num < 0 || num >= NETMAP_RING_MASK) {
snprintf(errmsg, MAXERRMSG, "'%ld' out of range 
[0, %d)",
num, NETMAP_RING_MASK);
goto fail;
}
+   port = tmp;
nr_ringid = num & NETMAP_RING_MASK;
p_state = P_RNGSFXOK;
break;
@@ -767,11 +768,12 @@ nm_parse(const char *ifname, struct nm_desc *d, char *
snprintf(errmsg, MAXERRMSG, "double setting of 
memid");
goto fail;
}
-   num = strtol(port, (char **), 10);
+   num = strtol(port, , 10);
if (num <= 0) {
snprintf(errmsg, MAXERRMSG, "invalid memid %ld, 
must be >0", num);
goto fail;
}
+   port = tmp;
nr_arg2 = num;
p_state = P_RNGSFXOK;
break;
@@ -1054,7 +1056,7 @@ nm_inject(struct nm_desc *d, const void *buf, size_t s
ring->slot[i].flags = NS_MOREFRAG;
nm_pkt_copy(buf, NETMAP_BUF(ring, idx), 
ring->nr_buf_size);
i = nm_ring_next(ring, i);
-   buf = (char *)buf + ring->nr_buf_size;
+   buf = (const char *)buf + ring->nr_buf_size;
}
idx = ring->slot[i].buf_idx;
ring->slot[i].len = rem;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366495 - stable/12/tools/tools/netmap

2020-10-06 Thread Vincenzo Maffione
Author: vmaffione
Date: Tue Oct  6 19:10:32 2020
New Revision: 366495
URL: https://svnweb.freebsd.org/changeset/base/366495

Log:
  MFC r366387
  
  netmap: pkt-gen: minor corrections to documentation
  
  Submitted by:   Brian Poole 

Modified:
  stable/12/tools/tools/netmap/pkt-gen.8
  stable/12/tools/tools/netmap/pkt-gen.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tools/tools/netmap/pkt-gen.8
==
--- stable/12/tools/tools/netmap/pkt-gen.8  Tue Oct  6 18:13:15 2020
(r366494)
+++ stable/12/tools/tools/netmap/pkt-gen.8  Tue Oct  6 19:10:32 2020
(r366495)
@@ -95,7 +95,7 @@ for server-side ping-pong operation.
 .It Fl n Ar count
 Number of iterations of the
 .Nm
-function, with 0 meaning infinite).
+function (with 0 meaning infinite).
 In case of
 .Cm tx
 or
@@ -147,10 +147,10 @@ is larger than one, each thread handles a single TX ri
 .Cm tx
 mode), a single RX ring (in
 .Cm rx
-mode), or a TX/RX ring couple.
+mode), or a TX/RX ring pair.
 The number of
 .Ar threads
-must be less or equal than the number of TX (or RX) ring available
+must be less than or equal to the number of TX (or RX) ring available
 in the device specified by
 .Ar interface .
 .It Fl T Ar report_ms
@@ -158,7 +158,7 @@ Number of milliseconds between reports.
 .It Fl w Ar wait_for_link_time
 Number of seconds to wait before starting the
 .Nm
-function, useuful to make sure that the network link is up.
+function, useful to make sure that the network link is up.
 A network device driver may take some time to enter netmap mode, or
 to create a new transmit/receive ring pair when
 .Xr netmap 4
@@ -168,7 +168,7 @@ Packet transmission rate.
 Not setting the packet transmission rate tells
 .Nm
 to transmit packets as quickly as possible.
-On servers from 2010 on-wards
+On servers from 2010 onward
 .Xr netmap 4
 is able to completely use all of the bandwidth of a 10 or 40Gbps link,
 so this option should be used unless your intention is to saturate the link.
@@ -231,7 +231,7 @@ This adds 4 bytes of CRC and 20 bytes of framing to ea
 .It Fl C Ar tx_slots Ns Oo Cm \&, Ns Ar rx_slots Ns Oo Cm \&, Ns Ar tx_rings 
Ns Oo Cm \&, Ns Ar rx_rings Oc Oc Oc
 Configuration in terms of number of rings and slots to be used when
 opening the netmap port.
-Such configuration has effect on software ports
+Such configuration has an effect on software ports
 created on the fly, such as VALE ports and netmap pipes.
 The configuration may consist of 1 to 4 numbers separated by commas:
 .Dq tx_slots,rx_slots,tx_rings,rx_rings .

Modified: stable/12/tools/tools/netmap/pkt-gen.c
==
--- stable/12/tools/tools/netmap/pkt-gen.c  Tue Oct  6 18:13:15 2020
(r366494)
+++ stable/12/tools/tools/netmap/pkt-gen.c  Tue Oct  6 19:10:32 2020
(r366495)
@@ -275,7 +275,7 @@ struct glob_arg {
 #define OPT_TS 16  /* add a timestamp */
 #define OPT_INDIRECT   32  /* use indirect buffers, tx only */
 #define OPT_DUMP   64  /* dump rx/tx traffic */
-#define OPT_RUBBISH256 /* send wathever the buffers contain */
+#define OPT_RUBBISH256 /* send whatever the buffers contain */
 #define OPT_RANDOM_SRC  512
 #define OPT_RANDOM_DST  1024
 #define OPT_PPS_STATS   2048
@@ -2360,7 +2360,7 @@ usage(int errcode)
 " for client-side ping-pong operation, and pong for server-side 
ping-pong operation.\n"
 "\n"
 " -n count\n"
-" Number of iterations of the pkt-gen function, with 0 meaning 
infinite).  In case of tx or rx,\n"
+" Number of iterations of the pkt-gen function (with 0 meaning 
infinite).  In case of tx or rx,\n"
 " count is the number of packets to receive or transmit.  In case 
of ping or pong, count is the\n"
 " number of ping-pong transactions.\n"
 "\n"
@@ -2397,20 +2397,20 @@ usage(int errcode)
 " -p threads\n"
 " Number of threads to use.  By default, only a single thread is 
used to handle all the netmap\n"
 " rings.  If threads is larger than one, each thread handles a 
single TX ring (in tx mode), a\n"
-" single RX ring (in rx mode), or a TX/RX ring couple.  The number 
of threads must be less or\n"
-" equal than the number of TX (or RX) ring available in the device 
specified by interface.\n"
+" single RX ring (in rx mode), or a TX/RX ring pair.  The number 
of threads must be less than or\n"
+" equal to the number of TX (or RX) rings available in the device 
specified by interface.\n"
 "\n"
 " -T report_ms\n"
 " Number of milliseconds between reports.\n"
 "\n"
 " -w wait_for_link_time\n"
-" Number of seconds to wait before starting the pkt-gen function, 
useuful to make sure that the\n"
+" Number of seconds to wait before starting the 

svn commit: r366494 - head/sys/dev/drm2

2020-10-06 Thread John Baldwin
Author: jhb
Date: Tue Oct  6 18:13:15 2020
New Revision: 366494
URL: https://svnweb.freebsd.org/changeset/base/366494

Log:
  Don't permit DRM buffer mappings to be upgraded to executable.
  
  Reviewed by:  kib
  MFC after:1 month
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26697

Modified:
  head/sys/dev/drm2/drm_bufs.c

Modified: head/sys/dev/drm2/drm_bufs.c
==
--- head/sys/dev/drm2/drm_bufs.cTue Oct  6 18:07:52 2020
(r366493)
+++ head/sys/dev/drm2/drm_bufs.cTue Oct  6 18:13:15 2020
(r366494)
@@ -1635,14 +1635,12 @@ int drm_mapbufs(struct drm_device *dev, void *data,
goto done;
}
retcode = vm_mmap(>vm_map, , map->size,
-   VM_PROT_READ | VM_PROT_WRITE, VM_PROT_ALL,
-   MAP_SHARED | MAP_NOSYNC, OBJT_DEVICE,
-   file_priv->minor->device, token);
+   VM_PROT_RW, VM_PROT_RW, MAP_SHARED | MAP_NOSYNC,
+   OBJT_DEVICE, file_priv->minor->device, token);
} else {
retcode = vm_mmap(>vm_map, , 
dma->byte_count,
-   VM_PROT_READ | VM_PROT_WRITE, VM_PROT_ALL,
-   MAP_SHARED | MAP_NOSYNC, OBJT_DEVICE,
-   file_priv->minor->device, 0);
+   VM_PROT_RW, VM_PROT_RW, MAP_SHARED | MAP_NOSYNC,
+   OBJT_DEVICE, file_priv->minor->device, 0);
}
if (retcode) {
/* Real error */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366493 - head/sys/opencrypto

2020-10-06 Thread John Baldwin
Author: jhb
Date: Tue Oct  6 18:07:52 2020
New Revision: 366493
URL: https://svnweb.freebsd.org/changeset/base/366493

Log:
  Simplify swcr_authcompute() after removal of deprecated algorithms.
  
  - Just use sw->octx != NULL to handle the HMAC case when finalizing
the MAC.
  
  - Explicitly zero the on-stack auth context.
  
  Reviewed by:  markj
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D26688

Modified:
  head/sys/opencrypto/cryptosoft.c

Modified: head/sys/opencrypto/cryptosoft.c
==
--- head/sys/opencrypto/cryptosoft.cTue Oct  6 18:02:33 2020
(r366492)
+++ head/sys/opencrypto/cryptosoft.cTue Oct  6 18:07:52 2020
(r366493)
@@ -341,7 +341,7 @@ swcr_authcompute(struct swcr_session *ses, struct cryp
err = crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length,
axf->Update, );
if (err)
-   return err;
+   goto out;
 
if (CRYPTO_HAS_OUTPUT_BUFFER(crp) &&
CRYPTO_OP_IS_ENCRYPT(crp->crp_op))
@@ -352,38 +352,13 @@ swcr_authcompute(struct swcr_session *ses, struct cryp
err = crypto_apply(crp, crp->crp_payload_start,
crp->crp_payload_length, axf->Update, );
if (err)
-   return err;
+   goto out;
 
-   switch (axf->type) {
-   case CRYPTO_SHA1:
-   case CRYPTO_SHA2_224:
-   case CRYPTO_SHA2_256:
-   case CRYPTO_SHA2_384:
-   case CRYPTO_SHA2_512:
-   axf->Final(aalg, );
-   break;
-
-   case CRYPTO_SHA1_HMAC:
-   case CRYPTO_SHA2_224_HMAC:
-   case CRYPTO_SHA2_256_HMAC:
-   case CRYPTO_SHA2_384_HMAC:
-   case CRYPTO_SHA2_512_HMAC:
-   case CRYPTO_RIPEMD160_HMAC:
-   if (sw->sw_octx == NULL)
-   return EINVAL;
-
-   axf->Final(aalg, );
+   axf->Final(aalg, );
+   if (sw->sw_octx != NULL) {
bcopy(sw->sw_octx, , axf->ctxsize);
axf->Update(, aalg, axf->hashsize);
axf->Final(aalg, );
-   break;
-
-   case CRYPTO_BLAKE2B:
-   case CRYPTO_BLAKE2S:
-   case CRYPTO_NULL_HMAC:
-   case CRYPTO_POLY1305:
-   axf->Final(aalg, );
-   break;
}
 
if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) {
@@ -398,6 +373,8 @@ swcr_authcompute(struct swcr_session *ses, struct cryp
crypto_copyback(crp, crp->crp_digest_start, sw->sw_mlen, aalg);
}
explicit_bzero(aalg, sizeof(aalg));
+out:
+   explicit_bzero(, sizeof(ctx));
return (err);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366492 - head/sys/netinet

2020-10-06 Thread John Baldwin
Author: jhb
Date: Tue Oct  6 18:02:33 2020
New Revision: 366492
URL: https://svnweb.freebsd.org/changeset/base/366492

Log:
  Check if_capenable, not if_capabilities when enabling rate limiting.
  
  if_capabilities is a read-only mask of supported capabilities.
  if_capenable is a mask under administrative control via ifconfig(8).
  
  Reviewed by:  gallatin
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D26690

Modified:
  head/sys/netinet/tcp_ratelimit.c

Modified: head/sys/netinet/tcp_ratelimit.c
==
--- head/sys/netinet/tcp_ratelimit.cTue Oct  6 17:58:56 2020
(r366491)
+++ head/sys/netinet/tcp_ratelimit.cTue Oct  6 18:02:33 2020
(r366492)
@@ -1137,7 +1137,7 @@ tcp_rl_ifnet_link(void *arg __unused, struct ifnet *if
int error;
struct tcp_rate_set *rs;
 
-   if (((ifp->if_capabilities & IFCAP_TXRTLMT) == 0) ||
+   if (((ifp->if_capenable & IFCAP_TXRTLMT) == 0) ||
(link_state != LINK_STATE_UP)) {
/*
 * We only care on an interface going up that is rate-limit
@@ -1224,7 +1224,7 @@ tcp_set_pacing_rate(struct tcpcb *tp, struct ifnet *if
/*
 * We are setting up a rate for the first time.
 */
-   if ((ifp->if_capabilities & IFCAP_TXRTLMT) == 0) {
+   if ((ifp->if_capenable & IFCAP_TXRTLMT) == 0) {
/* Not supported by the egress */
if (error)
*error = ENODEV;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366491 - in head/sys: dev/cxgbe dev/cxgbe/crypto dev/mlx5/mlx5_en kern net sys

2020-10-06 Thread John Baldwin
Author: jhb
Date: Tue Oct  6 17:58:56 2020
New Revision: 366491
URL: https://svnweb.freebsd.org/changeset/base/366491

Log:
  Store the send tag type in the common send tag header.
  
  Both cxgbe(4) and mlx5(4) wrapped the existing send tag header with
  their own identical headers that stored the type that the
  type-specific tag structures inherited from, so in practice it seems
  drivers need this in the tag anyway.  This permits removing these
  extra header indirections (struct cxgbe_snd_tag and struct
  mlx5e_snd_tag).
  
  In addition, this permits driver-independent code to query the type of
  a tag, e.g. to know what type of tag is being queried via
  if_snd_query.
  
  Reviewed by:  gallatin, hselasky, np, kib
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D26689

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/crypto/t4_kern_tls.c
  head/sys/dev/cxgbe/offload.h
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sched.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/en_hw_tls.h
  head/sys/dev/mlx5/mlx5_en/en_rl.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
  head/sys/kern/kern_mbuf.c
  head/sys/net/if_lagg.c
  head/sys/net/if_vlan.c
  head/sys/sys/mbuf.h

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hTue Oct  6 15:17:41 2020
(r366490)
+++ head/sys/dev/cxgbe/adapter.hTue Oct  6 17:58:56 2020
(r366491)
@@ -1202,7 +1202,6 @@ int update_mac_settings(struct ifnet *, int);
 int adapter_full_init(struct adapter *);
 int adapter_full_uninit(struct adapter *);
 uint64_t cxgbe_get_counter(struct ifnet *, ift_counter);
-void cxgbe_snd_tag_init(struct cxgbe_snd_tag *, struct ifnet *, int);
 int vi_full_init(struct vi_info *);
 int vi_full_uninit(struct vi_info *);
 void vi_sysctls(struct vi_info *);

Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c
==
--- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Tue Oct  6 15:17:41 2020
(r366490)
+++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Tue Oct  6 17:58:56 2020
(r366491)
@@ -156,7 +156,7 @@ struct tls_keyctx {
 #define KEY_DELETE_TX  0x8
 
 struct tlspcb {
-   struct cxgbe_snd_tag com;
+   struct m_snd_tag com;
struct vi_info *vi; /* virtual interface */
struct adapter *sc;
struct l2t_entry *l2te; /* L2 table entry used by this connection */
@@ -205,7 +205,7 @@ static int ktls_setup_keys(struct tlspcb *tlsp,
 static inline struct tlspcb *
 mst_to_tls(struct m_snd_tag *t)
 {
-   return ((struct tlspcb *)mst_to_cst(t));
+   return (__containerof(t, struct tlspcb, com));
 }
 
 /* XXX: There are similar versions of these two in tom/t4_tls.c. */
@@ -240,7 +240,7 @@ alloc_tlspcb(struct ifnet *ifp, struct vi_info *vi, in
if (tlsp == NULL)
return (NULL);
 
-   cxgbe_snd_tag_init(>com, ifp, IF_SND_TAG_TYPE_TLS);
+   m_snd_tag_init(>com, ifp, IF_SND_TAG_TYPE_TLS);
tlsp->vi = vi;
tlsp->sc = sc;
tlsp->ctrlq = >sge.ctrlq[pi->port_id];
@@ -484,7 +484,7 @@ ktls_set_tcb_fields(struct tlspcb *tlsp, struct tcpcb 
tlsp->tid);
return (ENOMEM);
}
-   m->m_pkthdr.snd_tag = m_snd_tag_ref(>com.com);
+   m->m_pkthdr.snd_tag = m_snd_tag_ref(>com);
m->m_pkthdr.csum_flags |= CSUM_SND_TAG;
 
/* FW_ULPTX_WR */
@@ -727,13 +727,13 @@ cxgbe_tls_tag_alloc(struct ifnet *ifp, union if_snd_ta
else
txq->kern_tls_cbc++;
TXQ_UNLOCK(txq);
-   *pt = >com.com;
+   *pt = >com;
return (0);
 
 failed:
if (atid >= 0)
free_atid(sc, atid);
-   m_snd_tag_rele(>com.com);
+   m_snd_tag_rele(>com);
return (error);
 }
 
@@ -836,7 +836,7 @@ ktls_setup_keys(struct tlspcb *tlsp, const struct ktls
tlsp->tid);
return (ENOMEM);
}
-   m->m_pkthdr.snd_tag = m_snd_tag_ref(>com.com);
+   m->m_pkthdr.snd_tag = m_snd_tag_ref(>com);
m->m_pkthdr.csum_flags |= CSUM_SND_TAG;
kwr = mtod(m, void *);
memset(kwr, 0, len);

Modified: head/sys/dev/cxgbe/offload.h
==
--- head/sys/dev/cxgbe/offload.hTue Oct  6 15:17:41 2020
(r366490)
+++ head/sys/dev/cxgbe/offload.hTue Oct  6 17:58:56 2020
(r366491)
@@ -87,13 +87,8 @@ enum {
EO_FLUSH_RPL_PENDING= (1 << 3), /* credit flush rpl due back */
 };
 
-struct cxgbe_snd_tag {
-   struct m_snd_tag com;
-   int type;
-};
-
 struct cxgbe_rate_tag {
-   struct cxgbe_snd_tag com;
+   

svn commit: r366490 - releng/12.2/cddl/contrib/opensolaris/lib/libzfs/common

2020-10-06 Thread Glen Barber
Author: gjb
Date: Tue Oct  6 15:17:41 2020
New Revision: 366490
URL: https://svnweb.freebsd.org/changeset/base/366490

Log:
  MFS12 r366180, r366341:
   r366180 (asomers):
Fix resuming receive stream to dataset with mounted clone
  
   r366341 (asomers):
Fix "zfs receive" of interrupted stream without "-F"
  
  Approved by:  re (kib)
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  releng/12.2/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
Directory Properties:
  releng/12.2/   (props changed)

Modified: 
releng/12.2/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- releng/12.2/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
Tue Oct  6 14:26:05 2020(r366489)
+++ releng/12.2/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
Tue Oct  6 15:17:41 2020(r366490)
@@ -3138,7 +3138,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
char prop_errbuf[1024];
const char *chopprefix;
boolean_t newfs = B_FALSE;
-   boolean_t stream_wantsnewfs;
+   boolean_t stream_wantsnewfs, stream_resumingnewfs;
uint64_t parent_snapguid = 0;
prop_changelist_t *clp = NULL;
nvlist_t *snapprops_nvlist = NULL;
@@ -3302,6 +3302,8 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
DMU_BACKUP_FEATURE_RESUMING;
stream_wantsnewfs = (drrb->drr_fromguid == 0 ||
(drrb->drr_flags & DRR_FLAG_CLONE) || originsnap) && !resuming;
+   stream_resumingnewfs = (drrb->drr_fromguid == 0 ||
+   (drrb->drr_flags & DRR_FLAG_CLONE) || originsnap) && resuming;
 
if (stream_wantsnewfs) {
/*
@@ -3433,7 +3435,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
}
 
if (!flags->dryrun && zhp->zfs_type == ZFS_TYPE_FILESYSTEM &&
-   (stream_wantsnewfs || resuming)) {
+   (stream_wantsnewfs || stream_resumingnewfs)) {
/* We can't do online recv in this case */
clp = changelist_gather(zhp, ZFS_PROP_NAME, 0, 0);
if (clp == NULL) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366489 - head/sys/netinet

2020-10-06 Thread Michael Tuexen
Author: tuexen
Date: Tue Oct  6 14:26:05 2020
New Revision: 366489
URL: https://svnweb.freebsd.org/changeset/base/366489

Log:
  Reset delayed SACK state when restarting an SCTP association.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Tue Oct  6 14:03:59 2020
(r366488)
+++ head/sys/netinet/sctp_input.c   Tue Oct  6 14:26:05 2020
(r366489)
@@ -1830,17 +1830,14 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle
/* move to OPEN state, if not in SHUTDOWN_SENT */
SCTP_SET_STATE(stcb, SCTP_STATE_OPEN);
}
-   asoc->pre_open_streams =
-   ntohs(initack_cp->init.num_outbound_streams);
+   asoc->pre_open_streams = 
ntohs(initack_cp->init.num_outbound_streams);
asoc->init_seq_number = ntohl(initack_cp->init.initial_tsn);
asoc->sending_seq = asoc->asconf_seq_out = 
asoc->str_reset_seq_out = asoc->init_seq_number;
asoc->asconf_seq_out_acked = asoc->asconf_seq_out - 1;
-
asoc->asconf_seq_in = asoc->last_acked_seq = 
asoc->init_seq_number - 1;
-
asoc->str_reset_seq_in = asoc->init_seq_number;
-
asoc->advanced_peer_ack_point = asoc->last_acked_seq;
+   asoc->send_sack = 1;
if (asoc->mapping_array) {
memset(asoc->mapping_array, 0,
asoc->mapping_array_size);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366488 - in stable/12/sys: kern sys

2020-10-06 Thread Mark Johnston
Author: markj
Date: Tue Oct  6 14:03:59 2020
New Revision: 366488
URL: https://svnweb.freebsd.org/changeset/base/366488

Log:
  MFC r365759-r365765, r365788:
  Simplify unix domain socket locking.

Modified:
  stable/12/sys/kern/uipc_usrreq.c
  stable/12/sys/sys/unpcb.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/uipc_usrreq.c
==
--- stable/12/sys/kern/uipc_usrreq.cTue Oct  6 13:03:31 2020
(r366487)
+++ stable/12/sys/kern/uipc_usrreq.cTue Oct  6 14:03:59 2020
(r366488)
@@ -65,13 +65,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
-#include /* XXX must be before  */
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -106,9 +106,7 @@ __FBSDID("$FreeBSD$");
 MALLOC_DECLARE(M_FILECAPS);
 
 /*
- * Locking key:
- * (l) Locked using list lock
- * (g) Locked using linkage lock
+ * See unpcb.h for the locking key.
  */
 
 static uma_zone_t  unp_zone;
@@ -191,41 +189,32 @@ SYSCTL_INT(_net_local, OID_AUTO, deferred, CTLFLAG_RD,
 /*
  * Locking and synchronization:
  *
- * Three types of locks exist in the local domain socket implementation: a
- * a global linkage rwlock, the mtxpool lock, and per-unpcb mutexes.
- * The linkage lock protects the socket count, global generation number,
- * and stream/datagram global lists.
+ * Several types of locks exist in the local domain socket implementation:
+ * - a global linkage lock
+ * - a global connection list lock
+ * - the mtxpool lock
+ * - per-unpcb mutexes
  *
- * The mtxpool lock protects the vnode from being modified while referenced.
- * Lock ordering requires that it be acquired before any unpcb locks.
+ * The linkage lock protects the global socket lists, the generation number
+ * counter and garbage collector state.
  *
- * The unpcb lock (unp_mtx) protects all fields in the unpcb. Of particular
- * note is that this includes the unp_conn field. So long as the unpcb lock
- * is held the reference to the unpcb pointed to by unp_conn is valid. If we
- * require that the unpcb pointed to by unp_conn remain live in cases where
- * we need to drop the unp_mtx as when we need to acquire the lock for a
- * second unpcb the caller must first acquire an additional reference on the
- * second unpcb and then revalidate any state (typically check that unp_conn
- * is non-NULL) upon requiring the initial unpcb lock. The lock ordering
- * between unpcbs is the conventional ascending address order. Two helper
- * routines exist for this:
+ * The connection list lock protects the list of referring sockets in a 
datagram
+ * socket PCB.  This lock is also overloaded to protect a global list of
+ * sockets whose buffers contain socket references in the form of SCM_RIGHTS
+ * messages.  To avoid recursion, such references are released by a dedicated
+ * thread.
  *
- *   - unp_pcb_lock2(unp, unp2) - which just acquires the two locks in the
- * safe ordering.
+ * The mtxpool lock protects the vnode from being modified while referenced.
+ * Lock ordering rules require that it be acquired before any PCB locks.
  *
- *   - unp_pcb_owned_lock2(unp, unp2, freed) - the lock for unp is held
- * when called. If unp is unlocked and unp2 is subsequently freed
- * freed will be set to 1.
+ * The unpcb lock (unp_mtx) protects the most commonly referenced fields in the
+ * unpcb.  This includes the unp_conn field, which either links two connected
+ * PCBs together (for connected socket types) or points at the destination
+ * socket (for connectionless socket types).  The operations of creating or
+ * destroying a connection therefore involve locking multiple PCBs.  To avoid
+ * lock order reversals, in some cases this involves dropping a PCB lock and
+ * using a reference counter to maintain liveness.
  *
- * The helper routines for references are:
- *
- *   - unp_pcb_hold(unp): Can be called any time we currently hold a valid
- * reference to unp.
- *
- *- unp_pcb_rele(unp): The caller must hold the unp lock. If we are
- *  releasing the last reference, detach must have been called thus
- *  unp->unp_socket be NULL.
- *
  * UNIX domain sockets each have an unpcb hung off of their so_pcb pointer,
  * allocated in pru_attach() and freed in pru_detach().  The validity of that
  * pointer is an invariant, so no lock is required to dereference the so_pcb
@@ -285,6 +274,7 @@ static struct mtx   unp_defers_lock;
"unp", "unp",   \
MTX_DUPOK|MTX_DEF)
 #defineUNP_PCB_LOCK_DESTROY(unp)   mtx_destroy(&(unp)->unp_mtx)
+#defineUNP_PCB_LOCKPTR(unp)(&(unp)->unp_mtx)
 #defineUNP_PCB_LOCK(unp)   mtx_lock(&(unp)->unp_mtx)
 #defineUNP_PCB_TRYLOCK(unp)mtx_trylock(&(unp)->unp_mtx)
 

svn commit: r366487 - head/sys/riscv/riscv

2020-10-06 Thread Jessica Clarke
Author: jrtc27
Date: Tue Oct  6 13:03:31 2020
New Revision: 366487
URL: https://svnweb.freebsd.org/changeset/base/366487

Log:
  riscv: Remove outdated condition in page_fault_handler
  
  Since r366355 and r366284 we panic on access faults rather than treating
  them like page faults so this condition is never true.
  
  Reviewed by:  jhb (mentor), markj, mhorne
  Approved by:  jhb (mentor), markj, mhorne
  Differential Revision:https://reviews.freebsd.org/D26686

Modified:
  head/sys/riscv/riscv/trap.c

Modified: head/sys/riscv/riscv/trap.c
==
--- head/sys/riscv/riscv/trap.c Tue Oct  6 13:02:20 2020(r366486)
+++ head/sys/riscv/riscv/trap.c Tue Oct  6 13:03:31 2020(r366487)
@@ -220,8 +220,7 @@ page_fault_handler(struct trapframe *frame, int usermo
 
va = trunc_page(stval);
 
-   if ((frame->tf_scause == EXCP_FAULT_STORE) ||
-   (frame->tf_scause == EXCP_STORE_PAGE_FAULT)) {
+   if (frame->tf_scause == EXCP_STORE_PAGE_FAULT) {
ftype = VM_PROT_WRITE;
} else if (frame->tf_scause == EXCP_INST_PAGE_FAULT) {
ftype = VM_PROT_EXECUTE;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366486 - head/sys/riscv/riscv

2020-10-06 Thread Jessica Clarke
Author: jrtc27
Date: Tue Oct  6 13:02:20 2020
New Revision: 366486
URL: https://svnweb.freebsd.org/changeset/base/366486

Log:
  riscv: Handle supervisor instruction page faults
  
  We should never take instruction page faults when in the kernel, but by
  using the standard page fault code we should get a more-informative
  message about faulting on a NOFAULT page rather than branching to the
  default case here and printing an "Unknown kernel exception ..."
  message.
  
  Reviewed by:  jhb (mentor), markj
  Approved by:  jhb (mentor), markj
  Differential Revision:https://reviews.freebsd.org/D26685

Modified:
  head/sys/riscv/riscv/trap.c

Modified: head/sys/riscv/riscv/trap.c
==
--- head/sys/riscv/riscv/trap.c Tue Oct  6 12:57:54 2020(r366485)
+++ head/sys/riscv/riscv/trap.c Tue Oct  6 13:02:20 2020(r366486)
@@ -290,6 +290,7 @@ do_trap_supervisor(struct trapframe *frame)
break;
case EXCP_STORE_PAGE_FAULT:
case EXCP_LOAD_PAGE_FAULT:
+   case EXCP_INST_PAGE_FAULT:
page_fault_handler(frame, 0);
break;
case EXCP_BREAKPOINT:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366485 - head/tests/sys/capsicum

2020-10-06 Thread Li-Wen Hsu
Author: lwhsu
Date: Tue Oct  6 12:57:54 2020
New Revision: 366485
URL: https://svnweb.freebsd.org/changeset/base/366485

Log:
  Temporarily skip failing test cases in CI:
  
  sys.capsicum.functional.ForkedOpenatTest_WithFlagInCapabilityMode___
  sys.capsicum.functional.OpenatTest__WithFlag
  
  PR:   249960
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tests/sys/capsicum/functional.sh

Modified: head/tests/sys/capsicum/functional.sh
==
--- head/tests/sys/capsicum/functional.sh   Tue Oct  6 12:56:29 2020
(r366484)
+++ head/tests/sys/capsicum/functional.sh   Tue Oct  6 12:57:54 2020
(r366485)
@@ -40,6 +40,13 @@ check()
${SRCDIR}/${CAPSICUM_TEST_BIN} --gtest_filter=${tc}
 }
 
+skip()
+{
+   local reason=${1}
+
+   atf_skip "${reason}"
+}
+
 add_testcase()
 {
local tc=${1}
@@ -48,7 +55,20 @@ add_testcase()
tc_escaped=$(echo ${tc} | sed -e 's/\./__/')
 
atf_test_case ${tc_escaped}
-   eval "${tc_escaped}_body() { check ${tc}; }"
+
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   case "${tc_escaped}" in
+   
ForkedOpenatTest_WithFlagInCapabilityMode___|OpenatTest__WithFlag)
+   eval "${tc_escaped}_body() { skip 
\"http://bugs.freebsd.org/249960\;; }"
+   ;;
+   *)
+   eval "${tc_escaped}_body() { check ${tc}; }"
+   ;;
+   esac
+   else
+   eval "${tc_escaped}_body() { check ${tc}; }"
+   fi
+
atf_add_test_case ${tc_escaped}
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366484 - head/sys/riscv/riscv

2020-10-06 Thread Jessica Clarke
Author: jrtc27
Date: Tue Oct  6 12:56:29 2020
New Revision: 366484
URL: https://svnweb.freebsd.org/changeset/base/366484

Log:
  riscv: De-Arm a few names
  
  These names were inherited from the arm64 port and should be changed to
  the RISC-V terminology.
  
  Reviewed by:  jhb (mentor), kp, markj
  Approved by:  jhb (mentor), kp, markj
  Differential Revision:https://reviews.freebsd.org/D26671

Modified:
  head/sys/riscv/riscv/exception.S
  head/sys/riscv/riscv/trap.c

Modified: head/sys/riscv/riscv/exception.S
==
--- head/sys/riscv/riscv/exception.STue Oct  6 11:29:08 2020
(r366483)
+++ head/sys/riscv/riscv/exception.STue Oct  6 12:56:29 2020
(r366484)
@@ -40,12 +40,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-.macro save_registers el
+.macro save_registers mode
addisp, sp, -(TF_SIZE)
 
sd  ra, (TF_RA)(sp)
 
-.if \el == 0   /* We came from userspace. */
+.if \mode == 0 /* We came from userspace. */
sd  gp, (TF_GP)(sp)
 .option push
 .option norelax
@@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$");
sd  a6, (TF_A + 6 * 8)(sp)
sd  a7, (TF_A + 7 * 8)(sp)
 
-.if \el == 1
+.if \mode == 1
/* Store kernel sp */
li  t1, TF_SIZE
add t0, sp, t1
@@ -110,9 +110,9 @@ __FBSDID("$FreeBSD$");
sd  t0, (TF_SCAUSE)(sp)
 .endm
 
-.macro load_registers el
+.macro load_registers mode
ld  t0, (TF_SSTATUS)(sp)
-.if \el == 0
+.if \mode == 0
/* Ensure user interrupts will be enabled on eret */
li  t1, SSTATUS_SPIE
or  t0, t0, t1
@@ -130,7 +130,7 @@ __FBSDID("$FreeBSD$");
ld  t0, (TF_SEPC)(sp)
csrwsepc, t0
 
-.if \el == 0
+.if \mode == 0
/* We go to userspace. Load user sp */
ld  t0, (TF_SP)(sp)
csrwsscratch, t0

Modified: head/sys/riscv/riscv/trap.c
==
--- head/sys/riscv/riscv/trap.c Tue Oct  6 11:29:08 2020(r366483)
+++ head/sys/riscv/riscv/trap.c Tue Oct  6 12:56:29 2020(r366484)
@@ -158,7 +158,7 @@ dump_regs(struct trapframe *frame)
 }
 
 static void
-svc_handler(struct trapframe *frame)
+ecall_handler(struct trapframe *frame)
 {
struct thread *td;
 
@@ -172,7 +172,7 @@ svc_handler(struct trapframe *frame)
 }
 
 static void
-data_abort(struct trapframe *frame, int usermode)
+page_fault_handler(struct trapframe *frame, int usermode)
 {
struct vm_map *map;
uint64_t stval;
@@ -290,7 +290,7 @@ do_trap_supervisor(struct trapframe *frame)
break;
case EXCP_STORE_PAGE_FAULT:
case EXCP_LOAD_PAGE_FAULT:
-   data_abort(frame, 0);
+   page_fault_handler(frame, 0);
break;
case EXCP_BREAKPOINT:
 #ifdef KDTRACE_HOOKS
@@ -353,11 +353,11 @@ do_trap_user(struct trapframe *frame)
case EXCP_STORE_PAGE_FAULT:
case EXCP_LOAD_PAGE_FAULT:
case EXCP_INST_PAGE_FAULT:
-   data_abort(frame, 1);
+   page_fault_handler(frame, 1);
break;
case EXCP_USER_ECALL:
frame->tf_sepc += 4;/* Next instruction */
-   svc_handler(frame);
+   ecall_handler(frame);
break;
case EXCP_ILLEGAL_INSTRUCTION:
 #ifdef FPE
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366483 - head/sys/netinet

2020-10-06 Thread Michael Tuexen
Author: tuexen
Date: Tue Oct  6 11:29:08 2020
New Revision: 366483
URL: https://svnweb.freebsd.org/changeset/base/366483

Log:
  Ensure variables are initialized before used.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_pcb.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Tue Oct  6 11:08:52 2020
(r366482)
+++ head/sys/netinet/sctp_input.c   Tue Oct  6 11:29:08 2020
(r366483)
@@ -5553,7 +5553,9 @@ sctp_common_input_processing(struct mbuf **mm, int iph
stcb = NULL;
goto out;
}
-   data_processed = 1;
+   if (retval == 0) {
+   data_processed = 1;
+   }
/*
 * Anything important needs to have been m_copy'ed in
 * process_data

Modified: head/sys/netinet/sctp_pcb.c
==
--- head/sys/netinet/sctp_pcb.c Tue Oct  6 11:08:52 2020(r366482)
+++ head/sys/netinet/sctp_pcb.c Tue Oct  6 11:29:08 2020(r366483)
@@ -6047,6 +6047,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, s
peer_supports_prsctp = 0;
peer_supports_auth = 0;
peer_supports_asconf = 0;
+   peer_supports_asconf_ack = 0;
peer_supports_reconfig = 0;
peer_supports_nrsack = 0;
peer_supports_pktdrop = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366482 - head/sys/netinet

2020-10-06 Thread Michael Tuexen
Author: tuexen
Date: Tue Oct  6 11:08:52 2020
New Revision: 366482
URL: https://svnweb.freebsd.org/changeset/base/366482

Log:
  Remove dead stores reported by clang static code analysis
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Tue Oct  6 10:51:47 2020
(r366481)
+++ head/sys/netinet/sctp_input.c   Tue Oct  6 11:08:52 2020
(r366482)
@@ -4116,7 +4116,6 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *
struct sctp_idata_chunk *idata_chunk;
uint32_t bottle_bw, on_queue;
uint32_t offset, chk_len;
-   uint16_t trunc_len;
uint16_t pktdrp_len;
uint8_t pktdrp_flags;
 
@@ -4126,13 +4125,10 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *
pktdrp_len = ntohs(cp->ch.chunk_length);
KASSERT(limit <= pktdrp_len, ("Inconsistent limit"));
if (pktdrp_flags & SCTP_PACKET_TRUNCATED) {
-   trunc_len = ntohs(cp->trunc_len);
-   if (trunc_len <= pktdrp_len - sizeof(struct 
sctp_pktdrop_chunk)) {
+   if (ntohs(cp->trunc_len) <= pktdrp_len - sizeof(struct 
sctp_pktdrop_chunk)) {
/* The peer plays games with us. */
return;
}
-   } else {
-   trunc_len = 0;
}
limit -= sizeof(struct sctp_pktdrop_chunk);
offset = 0;

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Tue Oct  6 10:51:47 2020
(r366481)
+++ head/sys/netinet/sctp_output.c  Tue Oct  6 11:08:52 2020
(r366482)
@@ -8793,7 +8793,7 @@ no_data_fill:
 * the top of the for, but just to make sure
 * I will reset these again here.
 */
-   ctl_cnt = bundle_at = 0;
+   ctl_cnt = 0;
continue;   /* This takes us back to the
 * for() for the nets. */
} else {
@@ -9392,7 +9392,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
uint32_t dmtu = 0;
 
SCTP_TCB_LOCK_ASSERT(stcb);
-   tmr_started = ctl_cnt = bundle_at = error = 0;
+   tmr_started = ctl_cnt = 0;
no_fragmentflg = 1;
fwd_tsn = 0;
*cnt_out = 0;

Modified: head/sys/netinet/sctp_pcb.c
==
--- head/sys/netinet/sctp_pcb.c Tue Oct  6 10:51:47 2020(r366481)
+++ head/sys/netinet/sctp_pcb.c Tue Oct  6 11:08:52 2020(r366482)
@@ -4345,7 +4345,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd
LIST_INSERT_HEAD(head, stcb, sctp_asocs);
SCTP_INP_INFO_WUNLOCK();
 
-   if ((err = sctp_add_remote_addr(stcb, firstaddr, NULL, port, 
SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC))) {
+   if (sctp_add_remote_addr(stcb, firstaddr, NULL, port, SCTP_DO_SETSCOPE, 
SCTP_ALLOC_ASOC)) {
/* failure.. memory error? */
if (asoc->strmout) {
SCTP_FREE(asoc->strmout, SCTP_M_STRMO);

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Tue Oct  6 10:51:47 2020(r366481)
+++ head/sys/netinet/sctputil.c Tue Oct  6 11:08:52 2020(r366482)
@@ -1725,7 +1725,6 @@ sctp_timeout_handler(void *t)
net = (struct sctp_nets *)tmr->net;
CURVNET_SET((struct vnet *)tmr->vnet);
NET_EPOCH_ENTER(et);
-   did_output = 1;
released_asoc_reference = false;
 
 #ifdef SCTP_AUDITING_ENABLED
@@ -1994,7 +1993,6 @@ sctp_timeout_handler(void *t)
op_err = 
sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
"Shutdown guard timer expired");
sctp_abort_an_association(inp, stcb, op_err, 
SCTP_SO_NOT_LOCKED);
-   did_output = true;
/* no need to unlock on tcb its gone */
goto out_decr;
case SCTP_TIMER_TYPE_AUTOCLOSE:
@@ -2071,7 +2069,6 @@ sctp_timeout_handler(void *t)
 #ifdef INVARIANTS
panic("Unknown timer type %d", type);
 #else
-   did_output = false;
goto out;
 #endif
}
@@ -2155,7 +2152,6 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s
("sctp_timer_start of type %d: inp = %p, stcb->sctp_ep %p",
t_type, stcb, stcb->sctp_ep));
tmr = NULL;
-   to_ticks = 0;
if (stcb != NULL) {
SCTP_TCB_LOCK_ASSERT(stcb);
  

svn commit: r366481 - head/share/man/man3

2020-10-06 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Tue Oct  6 10:51:47 2020
New Revision: 366481
URL: https://svnweb.freebsd.org/changeset/base/366481

Log:
  intro(3): Update the list of included libraries
  
  - Extend the list of main libraries of section 3
  - Extend the library functions that are included in the libc
  
  MFC after:2 weeks
  Submitted by: Naga Chaitanya Vellanki 
  Approved by:  gbe
  Differential Revision:https://reviews.freebsd.org/D26476

Modified:
  head/share/man/man3/intro.3

Modified: head/share/man/man3/intro.3
==
--- head/share/man/man3/intro.3 Tue Oct  6 10:41:04 2020(r366480)
+++ head/share/man/man3/intro.3 Tue Oct  6 10:51:47 2020(r366481)
@@ -28,12 +28,17 @@
 .\" @(#)intro.38.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd March 22, 2017
+.Dd October 6, 2020
 .Dt INTRO 3
 .Os
 .Sh NAME
 .Nm intro
 .Nd introduction to the C libraries
+.Sh SYNOPSIS
+.Nm cc
+.Op Ar flags
+.Ar
+.Op Fl llibrary
 .Sh DESCRIPTION
 This section provides an overview of the C
 library functions, their error returns and other
@@ -47,7 +52,11 @@ must be indicated at compile time with the
 option of the compiler.
 .Pp
 The various libraries (followed by the loader flag):
-.Bl -tag -width "libc (-lc)"
+.Bl -tag -width "libbluetooth (-lbluetooth)"
+.It Em libbluetooth Pq Fl l Ns Ar bluetooth
+The bluetooth library.
+See
+.Xr bluetooth 3 .
 .It Em libc Pq Fl l Ns Ar c
 Standard C library functions.
 When using the C compiler
@@ -57,21 +66,58 @@ to supply the loader flag
 .Fl l Ns Ar c
 for these functions.
 There are several `libraries' or groups of functions included inside of
-.Em libc
-: the standard
-.Tn I/O
-routines,
-database routines,
-bit operators,
-string operators,
-character tests and character operators,
-des encryption routines,
-storage allocation, time functions, signal handling and more.
+.Em libc :
+.Bl -tag -width "XX"
+.It standard I/O routines
+see
+.Xr stdio 3
+.It database routines
+see
+.Xr db 3
+.It bit operators
+see
+.Xr bitstring 3
+.It string operators
+see
+.Xr string 3
+.It character tests and character operators
+.It storage allocation
+see
+.Xr mpool 3
+.It regular-expressions
+see
+.Xr regex 3
+.It remote procedure calls (RPC)
+see
+.Xr rpc 3
+.It time functions
+see
+.Xr time 3
+.It signal handling
+see
+.Xr signal 3
+.El
+.It Em libcalendar Pq Fl l Ns Ar calendar
+The calendar arithmetic library.
+See
+.Xr calendar 3 .
+.It Em libcam Pq Fl l Ns Ar cam
+The common access method user library.
+See
+.Xr cam 3 .
+.It Em libcrypt Pq Fl l Ns Ar crypt
+The crypt library.
+See
+.Xr crypt 3 .
 .It Em libcurses Pq Fl l Ns Ar curses Fl l Ns Ar termcap
 Terminal independent screen management routines
 for two dimensional non-bitmap display terminals.
-(See
-.Xr ncurses 3 . )
+See
+.Xr ncurses 3 .
+.It Em libcuse Pq Fl l Ns Ar cuse
+The userland character device library.
+See
+.Xr cuse 3 .
 .It Em libcompat Pq Fl l Ns Ar compat
 Functions which are obsolete but are available for compatibility with
 .Bx 4.3 .
@@ -82,32 +128,106 @@ have been included for source code compatibility.
 Use of these routines should, for the most part, be avoided.
 The manual page entry for each compatibility routine
 indicates the proper interface to use.
+.It Em libdevinfo Pq Fl l Ns Ar devinfo
+The Device and Resource Information Utility library.
+See
+.Xr devinfo 3 .
+.It Em libdevstat Pq Fl l Ns Ar devstat
+The Device Statistics library.
+See
+.Xr devstat 3 .
+.It Em libdwarf Pq Fl l Ns Ar dwarf
+The DWARF access library.
+See
+.Xr dwarf 3 .
+.It Em libelf Pq Fl l Ns Ar elf
+The ELF access library.
+See
+.Xr elf 3 .
+.It Em libfetch Pq Fl l Ns Ar fetch
+The file transfer library.
+See
+.Xr fetch 3 .
+.It Em libfigpar Pq Fl l Ns Ar figpar
+The configuration file parsing library.
+See
+.Xr figpar 3 .
+.It Em libgpio Pq Fl l Ns Ar gpio
+The general-purpose input output library (GPIO).
+See
+.Xr gpio 3 .
+.It Em libgssapi Pq Fl l Ns Ar gssapi
+The generic security service application programming
+interface.
+See
+.Xr gssapi 3 .
+.It Em libjail Pq Fl l Ns Ar jail
+The jail library.
+See
+.Xr jail 3 .
 .It Em libkvm Pq Fl l Ns Ar kvm
 Functions used to access kernel memory are in this library.
 They can be used
 against both a running system and a crash dump.
-(See
-.Xr kvm 3 . )
+See
+.Xr kvm 3 .
 .It Em libl Pq Fl l Ns Ar l
 The library for
 .Xr lex 1 .
 .It Em libm Pq Fl l Ns Ar m
-The math library,
-.Em libm .
-The math library is loaded as needed by the Pascal compiler,
-but not by the C compiler which requires the
-.Fl l Ns Ar m
-flag.
-(See
-.Xr math 3 . )
+The math library.
+See
+.Xr math 3 .
+.It Em libmd Pq Fl l Ns Ar md
+The message digest library.
+See
+.Xr md4 3 ,
+.Xr md5 3 ,
+.Xr sha 3 ,
+.Xr sha256 3 ,
+.Xr sha512 3 ,
+.Xr ripemd 3 ,
+.Xr skein 3 .
 .It Em libmp Pq Fl l Ns Ar mp
+.It Em libpam Pq Fl l Ns Ar pam
+The pluggable authentication module library.
+See
+.Xr pam 3 .
+.It Em libpcap Pq Fl 

svn commit: r366480 - head/sys/netinet

2020-10-06 Thread Michael Tuexen
Author: tuexen
Date: Tue Oct  6 10:41:04 2020
New Revision: 366480
URL: https://svnweb.freebsd.org/changeset/base/366480

Log:
  Cleanup, no functional change intended.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Tue Oct  6 10:41:00 2020
(r366479)
+++ head/sys/netinet/sctp_usrreq.c  Tue Oct  6 10:41:04 2020
(r366480)
@@ -3077,43 +3077,27 @@ flags_out:
break;
}
case SCTP_RECVRCVINFO:
-   {
-   int onoff;
-
-   if (*optsize < sizeof(int)) {
-   SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);
-   error = EINVAL;
-   } else {
-   SCTP_INP_RLOCK(inp);
-   onoff = sctp_is_feature_on(inp, 
SCTP_PCB_FLAGS_RECVRCVINFO);
-   SCTP_INP_RUNLOCK(inp);
-   }
-   if (error == 0) {
-   /* return the option value */
-   *(int *)optval = onoff;
-   *optsize = sizeof(int);
-   }
-   break;
+   if (*optsize < sizeof(int)) {
+   SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);
+   error = EINVAL;
+   } else {
+   SCTP_INP_RLOCK(inp);
+   *(int *)optval = sctp_is_feature_on(inp, 
SCTP_PCB_FLAGS_RECVRCVINFO);
+   SCTP_INP_RUNLOCK(inp);
+   *optsize = sizeof(int);
}
+   break;
case SCTP_RECVNXTINFO:
-   {
-   int onoff;
-
-   if (*optsize < sizeof(int)) {
-   SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);
-   error = EINVAL;
-   } else {
-   SCTP_INP_RLOCK(inp);
-   onoff = sctp_is_feature_on(inp, 
SCTP_PCB_FLAGS_RECVNXTINFO);
-   SCTP_INP_RUNLOCK(inp);
-   }
-   if (error == 0) {
-   /* return the option value */
-   *(int *)optval = onoff;
-   *optsize = sizeof(int);
-   }
-   break;
+   if (*optsize < sizeof(int)) {
+   SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);
+   error = EINVAL;
+   } else {
+   SCTP_INP_RLOCK(inp);
+   *(int *)optval = sctp_is_feature_on(inp, 
SCTP_PCB_FLAGS_RECVNXTINFO);
+   SCTP_INP_RUNLOCK(inp);
+   *optsize = sizeof(int);
}
+   break;
case SCTP_DEFAULT_SNDINFO:
{
struct sctp_sndinfo *info;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366479 - head/sys/compat/linuxkpi/common/include/linux

2020-10-06 Thread Emmanuel Vadot
Author: manu
Date: Tue Oct  6 10:41:00 2020
New Revision: 366479
URL: https://svnweb.freebsd.org/changeset/base/366479

Log:
  linuxkpi: Add pagemap.h
  
  Add release_pages needed by drm which simply calls put_page for
  all the pages provided
  
  Reviewed by:  bz
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26680

Added:
  head/sys/compat/linuxkpi/common/include/linux/pagemap.h   (contents, props 
changed)

Added: head/sys/compat/linuxkpi/common/include/linux/pagemap.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/linuxkpi/common/include/linux/pagemap.h Tue Oct  6 
10:41:00 2020(r366479)
@@ -0,0 +1,45 @@
+/*-
+ * Copyright (c) 2020 The FreeBSD Foundation
+ *
+ * This software was developed by Emmanuel Vadot under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _LINUX_PAGEMAP_H_
+#define _LINUX_PAGEMAP_H_
+
+#include 
+
+static inline void
+release_pages(struct page **pages, int nr)
+{
+   int i;
+
+   for (i = 0; i < nr; i++)
+   put_page(pages[i]);
+}
+
+#endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366478 - head/sys/compat/linuxkpi/common/include/linux

2020-10-06 Thread Emmanuel Vadot
Author: manu
Date: Tue Oct  6 10:39:40 2020
New Revision: 366478
URL: https://svnweb.freebsd.org/changeset/base/366478

Log:
  linuxkpi: Add power_supply.h
  
  Add power_supply_is_system_supplied which is needed by drm.
  
  Reviewed by:  bz
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26679

Added:
  head/sys/compat/linuxkpi/common/include/linux/power_supply.h   (contents, 
props changed)

Added: head/sys/compat/linuxkpi/common/include/linux/power_supply.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/linuxkpi/common/include/linux/power_supply.hTue Oct 
 6 10:39:40 2020(r366478)
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 2020 The FreeBSD Foundation
+ *
+ * This software was developed by Emmanuel Vadot under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _LINUX_POWER_SUPPLY_H_
+#define _LINUX_POWER_SUPPLY_H_
+
+#include 
+#include 
+
+static inline int
+power_supply_is_system_supplied(void)
+{
+
+   return (power_profile_get_state() == POWER_PROFILE_PERFORMANCE);
+}
+
+#endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366477 - head/sys/compat/linuxkpi/common/include/linux

2020-10-06 Thread Emmanuel Vadot
Author: manu
Date: Tue Oct  6 10:37:21 2020
New Revision: 366477
URL: https://svnweb.freebsd.org/changeset/base/366477

Log:
  linuxkpi: Add prefetch.h
  
  Only add prefetchw as it is the only function used by drm.
  Simply use the __builtin_prefetch which is available in all
  compiler for a long time.
  
  Reviewed by:  bz
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26677

Added:
  head/sys/compat/linuxkpi/common/include/linux/prefetch.h   (contents, props 
changed)

Added: head/sys/compat/linuxkpi/common/include/linux/prefetch.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/linuxkpi/common/include/linux/prefetch.hTue Oct  6 
10:37:21 2020(r366477)
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2020 The FreeBSD Foundation
+ *
+ * This software was developed by Emmanuel Vadot under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _LINUX_PREFETCH_H_
+#define_LINUX_PREFETCH_H_
+
+#define prefetchw(x) __builtin_prefetch(x,1)
+
+#endif /* _LINUX_PREFETCH_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366476 - head/sys/compat/linuxkpi/common/include/linux

2020-10-06 Thread Emmanuel Vadot
Author: manu
Date: Tue Oct  6 10:36:16 2020
New Revision: 366476
URL: https://svnweb.freebsd.org/changeset/base/366476

Log:
  linuxkpi: Add numa.h
  
  Only contain NUMA_NO_NODE needed by drm
  
  Reviewed by:  bz
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26676

Added:
  head/sys/compat/linuxkpi/common/include/linux/numa.h   (contents, props 
changed)

Added: head/sys/compat/linuxkpi/common/include/linux/numa.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/linuxkpi/common/include/linux/numa.hTue Oct  6 
10:36:16 2020(r366476)
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2020 The FreeBSD Foundation
+ *
+ * This software was developed by Emmanuel Vadot under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _LINUX_NUMA_H_
+#define_LINUX_NUMA_H_
+
+#defineNUMA_NO_NODE-1
+
+#endif /* _LINUX_NUMA_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366475 - head/sys/compat/linuxkpi/common/include/linux

2020-10-06 Thread Emmanuel Vadot
Author: manu
Date: Tue Oct  6 10:35:03 2020
New Revision: 366475
URL: https://svnweb.freebsd.org/changeset/base/366475

Log:
  linuxkpi: Add gcd function
  
  This compute the common greater divider
  Taken from OpenBSD
  
  Reviewed by:  bz, imp
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26674

Added:
  head/sys/compat/linuxkpi/common/include/linux/gcd.h   (contents, props 
changed)

Added: head/sys/compat/linuxkpi/common/include/linux/gcd.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/linuxkpi/common/include/linux/gcd.h Tue Oct  6 10:35:03 
2020(r366475)
@@ -0,0 +1,50 @@
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dieter Baron and Thomas Klausner.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _LINUX_GCD_H_
+#define _LINUX_GCD_H_
+
+static inline unsigned long
+gcd(unsigned long a, unsigned long b)
+{
+   unsigned long c;
+
+   c = a % b;
+   while (c != 0) {
+   a = b;
+   b = c;
+   c = a % b;
+   }
+
+   return (b);
+}
+
+#endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366474 - head/sys/netinet

2020-10-06 Thread Michael Tuexen
Author: tuexen
Date: Tue Oct  6 09:51:40 2020
New Revision: 366474
URL: https://svnweb.freebsd.org/changeset/base/366474

Log:
  Whitespace changes.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Tue Oct  6 09:28:24 2020
(r366473)
+++ head/sys/netinet/sctp_input.c   Tue Oct  6 09:51:40 2020
(r366474)
@@ -1510,7 +1510,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle
 *   INIT-ACK(tag=t)-->
 *   INIT(tag=t)--> *1
 *   <---INIT-ACK(tag=a)---
- *   sctp_ep->sctp_flags & 
SCTP_PCB_FLAGS_TCPTYPE) ||
(stcb->sctp_ep->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL)) &&
(!SCTP_IS_LISTENING(inp))) {
-   stcb->sctp_ep->sctp_flags |=
-   SCTP_PCB_FLAGS_CONNECTED;
+   stcb->sctp_ep->sctp_flags |= 
SCTP_PCB_FLAGS_CONNECTED;
soisconnected(stcb->sctp_socket);
}
if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366473 - in stable/12/sys: amd64/include x86/include

2020-10-06 Thread Konstantin Belousov
Author: kib
Date: Tue Oct  6 09:28:24 2020
New Revision: 366473
URL: https://svnweb.freebsd.org/changeset/base/366473

Log:
  MFC r366415:
  Move ctx_switch_xsave declaration to amd64 md_var.h.

Modified:
  stable/12/sys/amd64/include/md_var.h
  stable/12/sys/x86/include/x86_var.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/include/md_var.h
==
--- stable/12/sys/amd64/include/md_var.hTue Oct  6 08:18:09 2020
(r366472)
+++ stable/12/sys/amd64/include/md_var.hTue Oct  6 09:28:24 2020
(r366473)
@@ -37,6 +37,7 @@
 #include 
 
 extern uint64_t*vm_page_dump;
+extern charctx_switch_xsave[];
 extern int hw_lower_amd64_sharedpage;
 extern int hw_ibrs_disable;
 extern int hw_ssb_disable;

Modified: stable/12/sys/x86/include/x86_var.h
==
--- stable/12/sys/x86/include/x86_var.h Tue Oct  6 08:18:09 2020
(r366472)
+++ stable/12/sys/x86/include/x86_var.h Tue Oct  6 09:28:24 2020
(r366473)
@@ -67,7 +67,6 @@ externu_int   cpu_mon_mwait_flags;
 extern u_int   cpu_mon_min_size;
 extern u_int   cpu_mon_max_size;
 extern u_int   cpu_maxphyaddr;
-extern charctx_switch_xsave[];
 extern u_int   hv_high;
 extern charhv_vendor[];
 extern charkstack[];
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366472 - head/usr.bin/backlight

2020-10-06 Thread Baptiste Daroussin
Author: bapt
Date: Tue Oct  6 08:18:09 2020
New Revision: 366472
URL: https://svnweb.freebsd.org/changeset/base/366472

Log:
  backlight: check the lenght if the input before trimming '%'
  
  Reported by:  hps
  Reviewed by:  manu
  Differential Revision:https://reviews.freebsd.org/D26693

Modified:
  head/usr.bin/backlight/backlight.c

Modified: head/usr.bin/backlight/backlight.c
==
--- head/usr.bin/backlight/backlight.c  Tue Oct  6 08:05:19 2020
(r366471)
+++ head/usr.bin/backlight/backlight.c  Tue Oct  6 08:18:09 2020
(r366472)
@@ -145,7 +145,8 @@ main(int argc, char *argv[])
 
if (argc == 1) {
/* ignore a trailing % for user friendlyness */
-   if (argv[0][strlen(argv[0]) - 1] == '%')
+   if (strlen(argv[0]) > 0 &&
+   argv[0][strlen(argv[0]) - 1] == '%')
argv[0][strlen(argv[0]) - 1] = '\0';
percent = strtonum(argv[0], 0, 100, _error);
if (percent_error)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r366471 - head/usr.bin/backlight

2020-10-06 Thread Hans Petter Selasky

On 2020-10-06 10:05, Baptiste Daroussin wrote:

Author: bapt
Date: Tue Oct  6 08:05:19 2020
New Revision: 366471
URL: https://svnweb.freebsd.org/changeset/base/366471

Log:
   backlight: accept '%' in the brightness input value
   
   Improve friendlyness of the command line by accepting the percent brightness

   in both format: with or without a trailing '%'
   
   Reviewed by:	manu

   Differential Revision:   https://reviews.freebsd.org/D26692

Modified:
   head/usr.bin/backlight/backlight.8
   head/usr.bin/backlight/backlight.c

Modified: head/usr.bin/backlight/backlight.8
==
--- head/usr.bin/backlight/backlight.8  Tue Oct  6 06:45:52 2020
(r366470)
+++ head/usr.bin/backlight/backlight.8  Tue Oct  6 08:05:19 2020
(r366471)
@@ -22,7 +22,7 @@
  .\"
  .\" $FreeBSD$
  .\"
-.Dd October 02, 2020
+.Dd October 06, 2020
  .Dt BACKLIGHT 8
  .Os
  .Sh NAME
@@ -63,6 +63,7 @@ When querying the brightness level only print the valu
  Query information about the backlight (name, type).
  .It Ar value
  Set the brightness level to this value, must be between 0 and 100.
+A trailing '%' is valid.
  .It Ar incr | +
  .Op Ar value
  Decrement the backlight level.

Modified: head/usr.bin/backlight/backlight.c
==
--- head/usr.bin/backlight/backlight.c  Tue Oct  6 06:45:52 2020
(r366470)
+++ head/usr.bin/backlight/backlight.c  Tue Oct  6 08:05:19 2020
(r366471)
@@ -144,6 +144,9 @@ main(int argc, char *argv[])
action = BACKLIGHT_SET_BRIGHTNESS;
  
  		if (argc == 1) {

+   /* ignore a trailing % for user friendlyness */
+   if (argv[0][strlen(argv[0]) - 1] == '%')
+   argv[0][strlen(argv[0]) - 1] = '\0';
percent = strtonum(argv[0], 0, 100, _error);
if (percent_error)
errx(1, "Cannot parse brightness level %s: %s",



Should there be a check here that strlen(xxx) > 0 ?

--HPS
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366471 - head/usr.bin/backlight

2020-10-06 Thread Baptiste Daroussin
Author: bapt
Date: Tue Oct  6 08:05:19 2020
New Revision: 366471
URL: https://svnweb.freebsd.org/changeset/base/366471

Log:
  backlight: accept '%' in the brightness input value
  
  Improve friendlyness of the command line by accepting the percent brightness
  in both format: with or without a trailing '%'
  
  Reviewed by:  manu
  Differential Revision:https://reviews.freebsd.org/D26692

Modified:
  head/usr.bin/backlight/backlight.8
  head/usr.bin/backlight/backlight.c

Modified: head/usr.bin/backlight/backlight.8
==
--- head/usr.bin/backlight/backlight.8  Tue Oct  6 06:45:52 2020
(r366470)
+++ head/usr.bin/backlight/backlight.8  Tue Oct  6 08:05:19 2020
(r366471)
@@ -22,7 +22,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 02, 2020
+.Dd October 06, 2020
 .Dt BACKLIGHT 8
 .Os
 .Sh NAME
@@ -63,6 +63,7 @@ When querying the brightness level only print the valu
 Query information about the backlight (name, type).
 .It Ar value
 Set the brightness level to this value, must be between 0 and 100.
+A trailing '%' is valid.
 .It Ar incr | +
 .Op Ar value
 Decrement the backlight level.

Modified: head/usr.bin/backlight/backlight.c
==
--- head/usr.bin/backlight/backlight.c  Tue Oct  6 06:45:52 2020
(r366470)
+++ head/usr.bin/backlight/backlight.c  Tue Oct  6 08:05:19 2020
(r366471)
@@ -144,6 +144,9 @@ main(int argc, char *argv[])
action = BACKLIGHT_SET_BRIGHTNESS;
 
if (argc == 1) {
+   /* ignore a trailing % for user friendlyness */
+   if (argv[0][strlen(argv[0]) - 1] == '%')
+   argv[0][strlen(argv[0]) - 1] = '\0';
percent = strtonum(argv[0], 0, 100, _error);
if (percent_error)
errx(1, "Cannot parse brightness level %s: %s",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366470 - in head: share/mk tests/sys/capsicum

2020-10-06 Thread Li-Wen Hsu
Author: lwhsu
Date: Tue Oct  6 06:45:52 2020
New Revision: 366470
URL: https://svnweb.freebsd.org/changeset/base/366470

Log:
  Make capsicum test cases fine-grained
  
  Add a wrapping script to use ATF to run tests written with Googletest
  one by one. This helps locating and tracking the failing case in CI easier.
  
  This is a temporarily solution while Googletest support in Kyua is developing.
  We will revert this once Kyua+Googletest integration is ready.
  
  Reviewed by:  emaste
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25896

Added:
  head/tests/sys/capsicum/functional.sh   (contents, props changed)
Modified:
  head/share/mk/bsd.test.mk
  head/share/mk/googletest.test.mk
  head/tests/sys/capsicum/Makefile

Modified: head/share/mk/bsd.test.mk
==
--- head/share/mk/bsd.test.mk   Tue Oct  6 04:18:42 2020(r366469)
+++ head/share/mk/bsd.test.mk   Tue Oct  6 06:45:52 2020(r366470)
@@ -62,10 +62,11 @@ TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW
 _TESTS=
 
 # Pull in the definitions of all supported test interfaces.
-.include 
 .include 
 .include 
 .include 
+# Include atf last to let other test framework use it
+.include 
 
 # Sort the tests alphabetically, so the results are deterministically formed
 # across runs.

Modified: head/share/mk/googletest.test.mk
==
--- head/share/mk/googletest.test.mkTue Oct  6 04:18:42 2020
(r366469)
+++ head/share/mk/googletest.test.mkTue Oct  6 06:45:52 2020
(r366470)
@@ -30,12 +30,18 @@ GTESTS?=
 .include 
 
 PROGS_CXX+= ${GTESTS}
-_TESTS+= ${GTESTS}
 .for _T in ${GTESTS}
 BINDIR.${_T}= ${TESTSDIR}
 CXXFLAGS.${_T}+= ${GTESTS_CXXFLAGS}
 MAN.${_T}?= # empty
 SRCS.${_T}?= ${_T}.cc
+.if !empty(GTESTS_WRAPPER_SH.${_T})
+# A stopgap/workaround to let kyua execute test case one by one
+ATF_TESTS_SH+= ${GTESTS_WRAPPER_SH.${_T}}
+.else
+_TESTS+= ${_T}
 TEST_INTERFACE.${_T}= plain
+.endif
+
 .endfor
 .endif

Modified: head/tests/sys/capsicum/Makefile
==
--- head/tests/sys/capsicum/MakefileTue Oct  6 04:18:42 2020
(r366469)
+++ head/tests/sys/capsicum/MakefileTue Oct  6 06:45:52 2020
(r366470)
@@ -14,6 +14,7 @@ CFLAGS+=  -I${SRCTOP}/tests
 .PATH: ${SRCTOP}/contrib/capsicum-test
 
 GTESTS+=   capsicum-test
+GTESTS_WRAPPER_SH.capsicum-test=   functional
 
 SRCS.capsicum-test+=   \
capsicum-test-main.cc \
@@ -50,6 +51,6 @@ BINMODE.mini-me.setuid=   4555
 
 WARNS.capsicum-test=   3
 
-.endif
+.endif # MK_GOOGLETEST
 
 .include 

Added: head/tests/sys/capsicum/functional.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/capsicum/functional.sh   Tue Oct  6 06:45:52 2020
(r366470)
@@ -0,0 +1,68 @@
+#-
+# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+#
+# Copyright (c) 2020 The FreeBSD Foundation
+#
+# This software was developed by Li-Wen Hsu 
+# under sponsorship from the FreeBSD Foundation.
+#
+# 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$
+
+SRCDIR=$(atf_get_srcdir)
+CAPSICUM_TEST_BIN=capsicum-test
+
+check()
+{
+   local tc=${1}
+
+   atf_check -s exit:0 -o match:PASSED  -e ignore \
+   ${SRCDIR}/${CAPSICUM_TEST_BIN} --gtest_filter=${tc}
+}
+
+add_testcase()
+{
+   local tc=${1}
+   local tc_escaped word
+
+   tc_escaped=$(echo ${tc} | sed -e 's/\./__/')
+
+   atf_test_case ${tc_escaped}
+   eval