svn commit: r367514 - head/sys/dev/bxe

2020-11-08 Thread Warner Losh
Author: imp
Date: Mon Nov  9 03:02:34 2020
New Revision: 367514
URL: https://svnweb.freebsd.org/changeset/base/367514

Log:
  Remove newline from bxe description, it's not done elsewhere.

Modified:
  head/sys/dev/bxe/bxe.c

Modified: head/sys/dev/bxe/bxe.c
==
--- head/sys/dev/bxe/bxe.c  Mon Nov  9 01:57:07 2020(r367513)
+++ head/sys/dev/bxe/bxe.c  Mon Nov  9 03:02:34 2020(r367514)
@@ -2520,7 +2520,7 @@ bxe_probe(device_t dev)
 
 /* Print out the device identity. */
 snprintf(descbuf, BXE_DEVDESC_MAX,
- "%s (%c%d) BXE v:%s\n", t->bxe_name,
+ "%s (%c%d) BXE v:%s", t->bxe_name,
  (((pci_read_config(dev, PCIR_REVID, 4) &
 0xf0) >> 4) + 'A'),
  (pci_read_config(dev, PCIR_REVID, 4) & 0xf),
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367503 - in head/sys: kern vm

2020-11-08 Thread Mateusz Guzik
Author: mjg
Date: Mon Nov  9 00:34:23 2020
New Revision: 367503
URL: https://svnweb.freebsd.org/changeset/base/367503

Log:
  Add more per-cpu zones.
  
  This covers powers of 2 up to 64.
  
  Example pending user is ZFS.

Modified:
  head/sys/kern/subr_pcpu.c
  head/sys/vm/uma.h

Modified: head/sys/kern/subr_pcpu.c
==
--- head/sys/kern/subr_pcpu.c   Mon Nov  9 00:08:35 2020(r367502)
+++ head/sys/kern/subr_pcpu.c   Mon Nov  9 00:34:23 2020(r367503)
@@ -133,17 +133,25 @@ SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_start
 /*
  * UMA_ZONE_PCPU zones for general kernel use.
  */
-
 uma_zone_t pcpu_zone_4;
 uma_zone_t pcpu_zone_8;
+uma_zone_t pcpu_zone_16;
+uma_zone_t pcpu_zone_32;
+uma_zone_t pcpu_zone_64;
 
 static void
 pcpu_zones_startup(void)
 {
 
-   pcpu_zone_4 = uma_zcreate("pcpu-4", sizeof(uint32_t),
+   pcpu_zone_4 = uma_zcreate("pcpu-4", 4,
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
-   pcpu_zone_8 = uma_zcreate("pcpu-8", sizeof(uint64_t),
+   pcpu_zone_8 = uma_zcreate("pcpu-8", 8,
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
+   pcpu_zone_16 = uma_zcreate("pcpu-16", 16,
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
+   pcpu_zone_32 = uma_zcreate("pcpu-32", 32,
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
+   pcpu_zone_64 = uma_zcreate("pcpu-64", 64,
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
 }
 SYSINIT(pcpu_zones, SI_SUB_COUNTER, SI_ORDER_FIRST, pcpu_zones_startup, NULL);

Modified: head/sys/vm/uma.h
==
--- head/sys/vm/uma.h   Mon Nov  9 00:08:35 2020(r367502)
+++ head/sys/vm/uma.h   Mon Nov  9 00:34:23 2020(r367503)
@@ -668,6 +668,9 @@ size_t uma_zone_memory(uma_zone_t zone);
  */
 extern uma_zone_t pcpu_zone_4;
 extern uma_zone_t pcpu_zone_8;
+extern uma_zone_t pcpu_zone_16;
+extern uma_zone_t pcpu_zone_32;
+extern uma_zone_t pcpu_zone_64;
 
 /*
  * Exported statistics structures to be used by user space monitoring tools.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367502 - in head/sys/dev/cxgbe: . common

2020-11-08 Thread Navdeep Parhar
Author: np
Date: Mon Nov  9 00:08:35 2020
New Revision: 367502
URL: https://svnweb.freebsd.org/changeset/base/367502

Log:
  cxgbe(4): Allow the PF driver to set a VF's MAC address.
  
  The MAC address can be set with the optional mac-addr property in the VF
  section of the iovctl.conf(5) used to instantiate the VFs.
  
  MFC after:2 weeks
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/t4_iov.c

Modified: head/sys/dev/cxgbe/common/common.h
==
--- head/sys/dev/cxgbe/common/common.h  Mon Nov  9 00:05:45 2020
(r367501)
+++ head/sys/dev/cxgbe/common/common.h  Mon Nov  9 00:08:35 2020
(r367502)
@@ -691,6 +691,8 @@ void t4_idma_monitor_init(struct adapter *adapter,
 void t4_idma_monitor(struct adapter *adapter,
 struct sge_idma_monitor_state *idma,
 int hz, int ticks);
+int t4_set_vf_mac(struct adapter *adapter, unsigned int pf, unsigned int vf,
+ unsigned int naddr, u8 *addr);
 
 unsigned int t4_get_regs_len(struct adapter *adapter);
 void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size);

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==
--- head/sys/dev/cxgbe/common/t4_hw.c   Mon Nov  9 00:05:45 2020
(r367501)
+++ head/sys/dev/cxgbe/common/t4_hw.c   Mon Nov  9 00:08:35 2020
(r367502)
@@ -10202,6 +10202,48 @@ void t4_idma_monitor(struct adapter *adapter,
 }
 
 /**
+ * t4_set_vf_mac - Set MAC address for the specified VF
+ * @adapter: The adapter
+ * @pf: the PF used to instantiate the VFs
+ * @vf: one of the VFs instantiated by the specified PF
+ * @naddr: the number of MAC addresses
+ * @addr: the MAC address(es) to be set to the specified VF
+ */
+int t4_set_vf_mac(struct adapter *adapter, unsigned int pf, unsigned int vf,
+ unsigned int naddr, u8 *addr)
+{
+   struct fw_acl_mac_cmd cmd;
+
+   memset(, 0, sizeof(cmd));
+   cmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_ACL_MAC_CMD) |
+   F_FW_CMD_REQUEST |
+   F_FW_CMD_WRITE |
+   V_FW_ACL_MAC_CMD_PFN(pf) |
+   V_FW_ACL_MAC_CMD_VFN(vf));
+
+   /* Note: Do not enable the ACL */
+   cmd.en_to_len16 = cpu_to_be32((unsigned int)FW_LEN16(cmd));
+   cmd.nmac = naddr;
+
+   switch (pf) {
+   case 3:
+   memcpy(cmd.macaddr3, addr, sizeof(cmd.macaddr3));
+   break;
+   case 2:
+   memcpy(cmd.macaddr2, addr, sizeof(cmd.macaddr2));
+   break;
+   case 1:
+   memcpy(cmd.macaddr1, addr, sizeof(cmd.macaddr1));
+   break;
+   case 0:
+   memcpy(cmd.macaddr0, addr, sizeof(cmd.macaddr0));
+   break;
+   }
+
+   return t4_wr_mbox(adapter, adapter->mbox, , sizeof(cmd), );
+}
+
+/**
  * t4_read_pace_tbl - read the pace table
  * @adap: the adapter
  * @pace_vals: holds the returned values

Modified: head/sys/dev/cxgbe/t4_iov.c
==
--- head/sys/dev/cxgbe/t4_iov.c Mon Nov  9 00:05:45 2020(r367501)
+++ head/sys/dev/cxgbe/t4_iov.c Mon Nov  9 00:08:35 2020(r367502)
@@ -42,12 +42,19 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #include "common/common.h"
+#include "common/t4_regs.h"
 #include "t4_if.h"
 
 struct t4iov_softc {
device_t sc_dev;
device_t sc_main;
bool sc_attached;
+
+   int pf;
+   int regs_rid;
+   struct resource *regs_res;
+   bus_space_handle_t bh;
+   bus_space_tag_t bt;
 };
 
 struct {
@@ -113,6 +120,13 @@ struct {
{0x6087, "Chelsio T6225-CR 87"},
 };
 
+static inline uint32_t
+t4iov_read_reg(struct t4iov_softc *sc, uint32_t reg)
+{
+
+   return bus_space_read_4(sc->bt, sc->bh, reg);
+}
+
 static int t4iov_attach_child(device_t dev);
 
 static int
@@ -179,10 +193,28 @@ static int
 t4iov_attach(device_t dev)
 {
struct t4iov_softc *sc;
+   uint32_t pl_rev, whoami;
 
sc = device_get_softc(dev);
sc->sc_dev = dev;
 
+   sc->regs_rid = PCIR_BAR(0);
+   sc->regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
+   >regs_rid, RF_ACTIVE);
+   if (sc->regs_res == NULL) {
+   device_printf(dev, "cannot map registers.\n");
+   return (ENXIO);
+   }
+   sc->bt = rman_get_bustag(sc->regs_res);
+   sc->bh = rman_get_bushandle(sc->regs_res);
+
+   pl_rev = t4iov_read_reg(sc, A_PL_REV);
+   whoami = t4iov_read_reg(sc, A_PL_WHOAMI);
+   if (G_CHIPID(pl_rev) <= CHELSIO_T5)
+   sc->pf = G_SOURCEPF(whoami);
+   else
+   sc->pf = G_T6_SOURCEPF(whoami);
+
   

svn commit: r367501 - head/usr.bin/vmstat

2020-11-08 Thread Mateusz Guzik
Author: mjg
Date: Mon Nov  9 00:05:45 2020
New Revision: 367501
URL: https://svnweb.freebsd.org/changeset/base/367501

Log:
  vmstat: remove spurious newlines when reporting zones

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

Modified: head/usr.bin/vmstat/vmstat.c
==
--- head/usr.bin/vmstat/vmstat.cMon Nov  9 00:05:21 2020
(r367500)
+++ head/usr.bin/vmstat/vmstat.cMon Nov  9 00:05:45 2020
(r367501)
@@ -1500,7 +1500,7 @@ domemstat_zone(void)
}
xo_open_container("memory-zone-statistics");
xo_emit("{T:/%-20s} {T:/%6s} {T:/%6s} {T:/%8s} {T:/%8s} {T:/%8s} 
{T:/%8s}"
-   "{T:/%4s} {T:/%4s}\n\n", "ITEM", "SIZE",
+   "{T:/%4s} {T:/%4s}\n", "ITEM", "SIZE",
"LIMIT", "USED", "FREE", "REQ", "FAIL", "SLEEP", "XDOMAIN");
xo_open_list("zone");
for (mtp = memstat_mtl_first(mtlp); mtp != NULL;
@@ -1526,7 +1526,6 @@ domemstat_zone(void)
memstat_mtl_free(mtlp);
xo_close_list("zone");
xo_close_container("memory-zone-statistics");
-   xo_emit("\n");
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367500 - head/sys/kern

2020-11-08 Thread Mateusz Guzik
Author: mjg
Date: Mon Nov  9 00:05:21 2020
New Revision: 367500
URL: https://svnweb.freebsd.org/changeset/base/367500

Log:
  procdesc: convert the zone to a malloc type
  
  The object is 128 bytes in size.

Modified:
  head/sys/kern/sys_procdesc.c

Modified: head/sys/kern/sys_procdesc.c
==
--- head/sys/kern/sys_procdesc.cMon Nov  9 00:04:58 2020
(r367499)
+++ head/sys/kern/sys_procdesc.cMon Nov  9 00:05:21 2020
(r367500)
@@ -92,7 +92,7 @@ __FBSDID("$FreeBSD$");
 
 FEATURE(process_descriptors, "Process Descriptors");
 
-static uma_zone_t procdesc_zone;
+MALLOC_DEFINE(M_PROCDESC, "procdesc", "process descriptors");
 
 static fo_poll_t   procdesc_poll;
 static fo_kqfilter_t   procdesc_kqfilter;
@@ -117,22 +117,6 @@ static struct fileops procdesc_ops = {
 };
 
 /*
- * Initialize with VFS so that process descriptors are available along with
- * other file descriptor types.  As long as it runs before init(8) starts,
- * there shouldn't be a problem.
- */
-static void
-procdesc_init(void *dummy __unused)
-{
-
-   procdesc_zone = uma_zcreate("procdesc", sizeof(struct procdesc),
-   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
-   if (procdesc_zone == NULL)
-   panic("procdesc_init: procdesc_zone not initialized");
-}
-SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_ANY, procdesc_init, NULL);
-
-/*
  * Return a locked process given a process descriptor, or ESRCH if it has
  * died.
  */
@@ -229,7 +213,7 @@ procdesc_new(struct proc *p, int flags)
 {
struct procdesc *pd;
 
-   pd = uma_zalloc(procdesc_zone, M_WAITOK | M_ZERO);
+   pd = malloc(sizeof(*pd), M_PROCDESC, M_WAITOK | M_ZERO);
pd->pd_proc = p;
pd->pd_pid = p->p_pid;
p->p_procdesc = pd;
@@ -290,7 +274,7 @@ procdesc_free(struct procdesc *pd)
 
knlist_destroy(>pd_selinfo.si_note);
PROCDESC_LOCK_DESTROY(pd);
-   uma_zfree(procdesc_zone, pd);
+   free(pd, M_PROCDESC);
}
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367499 - head/sys/sys

2020-11-08 Thread Mateusz Guzik
Author: mjg
Date: Mon Nov  9 00:04:58 2020
New Revision: 367499
URL: https://svnweb.freebsd.org/changeset/base/367499

Log:
  bufcache: convert bo_numoutput from long to int
  
  int is wide enough and it plugs a hole in struct vnode, taking it down
  from 496 to 488 bytes.

Modified:
  head/sys/sys/bufobj.h

Modified: head/sys/sys/bufobj.h
==
--- head/sys/sys/bufobj.h   Mon Nov  9 00:04:35 2020(r367498)
+++ head/sys/sys/bufobj.h   Mon Nov  9 00:04:58 2020(r367499)
@@ -104,7 +104,7 @@ struct bufobj {
void*bo_private;/* private pointer */
struct bufv bo_clean;   /* i Clean buffers */
struct bufv bo_dirty;   /* i Dirty buffers */
-   longbo_numoutput;   /* i Writes in progress */
+   int bo_numoutput;   /* i Writes in progress */
u_int   bo_flag;/* i Flags */
int bo_domain;  /* - Clean queue affinity */
int bo_bsize;   /* - Block size for i/o */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367498 - in head/sys: compat/linuxkpi/common/src dev/evdev kern sys

2020-11-08 Thread Mateusz Guzik
Author: mjg
Date: Mon Nov  9 00:04:35 2020
New Revision: 367498
URL: https://svnweb.freebsd.org/changeset/base/367498

Log:
  kqueue: save space by using only one func pointer for assertions

Modified:
  head/sys/compat/linuxkpi/common/src/linux_compat.c
  head/sys/dev/evdev/uinput.c
  head/sys/kern/kern_event.c
  head/sys/kern/uipc_socket.c
  head/sys/kern/vfs_subr.c
  head/sys/sys/event.h

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Mon Nov  9 00:01:13 
2020(r367497)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Mon Nov  9 00:04:35 
2020(r367498)
@@ -422,26 +422,19 @@ linux_kq_unlock(void *arg)
 }
 
 static void
-linux_kq_lock_owned(void *arg)
+linux_kq_assert_lock(void *arg, int what)
 {
 #ifdef INVARIANTS
spinlock_t *s = arg;
 
-   mtx_assert(>m, MA_OWNED);
+   if (what == LA_LOCKED)
+   mtx_assert(>m, MA_OWNED);
+   else
+   mtx_assert(>m, MA_NOTOWNED);
 #endif
 }
 
 static void
-linux_kq_lock_unowned(void *arg)
-{
-#ifdef INVARIANTS
-   spinlock_t *s = arg;
-
-   mtx_assert(>m, MA_NOTOWNED);
-#endif
-}
-
-static void
 linux_file_kqfilter_poll(struct linux_file *, int);
 
 struct linux_file *
@@ -457,8 +450,7 @@ linux_file_alloc(void)
/* setup fields needed by kqueue support */
spin_lock_init(>f_kqlock);
knlist_init(>f_selinfo.si_note, >f_kqlock,
-   linux_kq_lock, linux_kq_unlock,
-   linux_kq_lock_owned, linux_kq_lock_unowned);
+   linux_kq_lock, linux_kq_unlock, linux_kq_assert_lock);
 
return (filp);
 }

Modified: head/sys/dev/evdev/uinput.c
==
--- head/sys/dev/evdev/uinput.c Mon Nov  9 00:01:13 2020(r367497)
+++ head/sys/dev/evdev/uinput.c Mon Nov  9 00:04:35 2020(r367498)
@@ -145,20 +145,16 @@ uinput_knlunlock(void *arg)
 }
 
 static void
-uinput_knl_assert_locked(void *arg)
+uinput_knl_assert_lock(void *arg, int what)
 {
 
-   sx_assert((struct sx*)arg, SA_XLOCKED);
+   if (what == LA_LOCKED)
+   sx_assert((struct sx*)arg, SA_XLOCKED);
+   else
+   sx_assert((struct sx*)arg, SA_UNLOCKED);
 }
 
 static void
-uinput_knl_assert_unlocked(void *arg)
-{
-
-   sx_assert((struct sx*)arg, SA_UNLOCKED);
-}
-
-static void
 uinput_ev_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
 int32_t value)
 {
@@ -212,8 +208,7 @@ uinput_open(struct cdev *dev, int oflags, int devtype,
 
sx_init(>ucs_lock, "uinput");
knlist_init(>ucs_selp.si_note, >ucs_lock, uinput_knllock,
-   uinput_knlunlock, uinput_knl_assert_locked,
-   uinput_knl_assert_unlocked);
+   uinput_knlunlock, uinput_knl_assert_lock);
 
devfs_set_cdevpriv(state, uinput_dtor);
return (0);

Modified: head/sys/kern/kern_event.c
==
--- head/sys/kern/kern_event.c  Mon Nov  9 00:01:13 2020(r367497)
+++ head/sys/kern/kern_event.c  Mon Nov  9 00:04:35 2020(r367498)
@@ -305,10 +305,10 @@ kn_leave_flux(struct knote *kn)
 } while (0)
 #ifdef INVARIANTS
 #defineKNL_ASSERT_LOCKED(knl) do { 
\
-   knl->kl_assert_locked((knl)->kl_lockarg);   \
+   knl->kl_assert_lock((knl)->kl_lockarg, LA_LOCKED);  \
 } while (0)
 #defineKNL_ASSERT_UNLOCKED(knl) do {   
\
-   knl->kl_assert_unlocked((knl)->kl_lockarg); \
+   knl->kl_assert_lock((knl)->kl_lockarg, LA_UNLOCKED);\
 } while (0)
 #else /* !INVARIANTS */
 #defineKNL_ASSERT_LOCKED(knl) do {} while(0)
@@ -2375,20 +2375,16 @@ knlist_mtx_unlock(void *arg)
 }
 
 static void
-knlist_mtx_assert_locked(void *arg)
+knlist_mtx_assert_lock(void *arg, int what)
 {
 
-   mtx_assert((struct mtx *)arg, MA_OWNED);
+   if (what == LA_LOCKED)
+   mtx_assert((struct mtx *)arg, MA_OWNED);
+   else
+   mtx_assert((struct mtx *)arg, MA_NOTOWNED);
 }
 
 static void
-knlist_mtx_assert_unlocked(void *arg)
-{
-
-   mtx_assert((struct mtx *)arg, MA_NOTOWNED);
-}
-
-static void
 knlist_rw_rlock(void *arg)
 {
 
@@ -2403,23 +2399,19 @@ knlist_rw_runlock(void *arg)
 }
 
 static void
-knlist_rw_assert_locked(void *arg)
+knlist_rw_assert_lock(void *arg, int what)
 {
 
-   rw_assert((struct rwlock *)arg, RA_LOCKED);
+   if (what == LA_LOCKED)
+   rw_assert((struct rwlock *)arg, RA_LOCKED);
+   else
+   rw_assert((struct rwlock *)arg, RA_UNLOCKED);
 }
 
-static void
-knlist_rw_assert_unlocked(void *arg)
-{
-
-   rw_assert((struct rwlock *)arg, RA_UNLOCKED);
-}
-
 void
 knlist_init(struct knlist *knl, void *lock, void (*kl_lock)(void *),
   

svn commit: r367497 - in head/sys/dev/cxgbe: . common

2020-11-08 Thread Navdeep Parhar
Author: np
Date: Mon Nov  9 00:01:13 2020
New Revision: 367497
URL: https://svnweb.freebsd.org/changeset/base/367497

Log:
  cxgbev(4): Use the MAC address set by the the PF if there is one.
  
  Query the firmware for the MAC address set by the PF for the VF and use
  it instead of the firmware generated MAC if it's available.
  
  MFC after:2 weeks
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/common/t4vf_hw.c
  head/sys/dev/cxgbe/t4_vf.c

Modified: head/sys/dev/cxgbe/common/common.h
==
--- head/sys/dev/cxgbe/common/common.h  Sun Nov  8 23:34:06 2020
(r367496)
+++ head/sys/dev/cxgbe/common/common.h  Mon Nov  9 00:01:13 2020
(r367497)
@@ -912,6 +912,8 @@ int t4vf_get_sge_params(struct adapter *adapter);
 int t4vf_get_rss_glb_config(struct adapter *adapter);
 int t4vf_get_vfres(struct adapter *adapter);
 int t4vf_prep_adapter(struct adapter *adapter);
+int t4vf_get_vf_mac(struct adapter *adapter, unsigned int port,
+   unsigned int *naddr, u8 *addr);
 int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid,
enum t4_bar2_qtype qtype, int user, u64 *pbar2_qoffset,
unsigned int *pbar2_qid);

Modified: head/sys/dev/cxgbe/common/t4vf_hw.c
==
--- head/sys/dev/cxgbe/common/t4vf_hw.c Sun Nov  8 23:34:06 2020
(r367496)
+++ head/sys/dev/cxgbe/common/t4vf_hw.c Mon Nov  9 00:01:13 2020
(r367497)
@@ -382,3 +382,49 @@ int t4vf_prep_adapter(struct adapter *adapter)
 
return 0;
 }
+
+/*
+ * t4vf_get_vf_mac - Get the MAC address to be set to the VI of this VF.
+ * @adapter: The adapter
+ * @port: The port associated with vf
+ * @naddr: the number of ACL MAC addresses returned in addr
+ * @addr: Placeholder for MAC addresses
+ *
+ * Find the MAC address to be set to the VF's VI. The requested MAC address
+ * is from the host OS via callback in the PF driver.
+ */
+int t4vf_get_vf_mac(struct adapter *adapter, unsigned int port,
+   unsigned int *naddr, u8 *addr)
+{
+   struct fw_acl_mac_cmd cmd;
+   int ret;
+
+   memset(, 0, sizeof(cmd));
+   cmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_ACL_MAC_CMD) |
+ F_FW_CMD_REQUEST |
+ F_FW_CMD_READ);
+   cmd.en_to_len16 = cpu_to_be32((unsigned int)FW_LEN16(cmd));
+   ret = t4vf_wr_mbox(adapter, , sizeof(cmd), );
+   if (ret)
+   return ret;
+
+   if (cmd.nmac < *naddr)
+   *naddr = cmd.nmac;
+
+   switch (port) {
+   case 3:
+   memcpy(addr, cmd.macaddr3, sizeof(cmd.macaddr3));
+   break;
+   case 2:
+   memcpy(addr, cmd.macaddr2, sizeof(cmd.macaddr2));
+   break;
+   case 1:
+   memcpy(addr, cmd.macaddr1, sizeof(cmd.macaddr1));
+   break;
+   case 0:
+   memcpy(addr, cmd.macaddr0, sizeof(cmd.macaddr0));
+   break;
+   }
+
+   return ret;
+}

Modified: head/sys/dev/cxgbe/t4_vf.c
==
--- head/sys/dev/cxgbe/t4_vf.c  Sun Nov  8 23:34:06 2020(r367496)
+++ head/sys/dev/cxgbe/t4_vf.c  Mon Nov  9 00:01:13 2020(r367497)
@@ -481,7 +481,7 @@ static int
 t4vf_attach(device_t dev)
 {
struct adapter *sc;
-   int rc = 0, i, j, rqidx, tqidx;
+   int rc = 0, i, j, rqidx, tqidx, n, p, pmask;
struct make_dev_args mda;
struct intrs_and_queues iaq;
struct sge *s;
@@ -618,8 +618,10 @@ t4vf_attach(device_t dev)
 * First pass over all the ports - allocate VIs and initialize some
 * basic parameters like mac address, port type, etc.
 */
+   pmask = sc->params.vfres.pmask;
for_each_port(sc, i) {
struct port_info *pi;
+   uint8_t mac[ETHER_ADDR_LEN];
 
pi = malloc(sizeof(*pi), M_CXGBE, M_ZERO | M_WAITOK);
sc->port[i] = pi;
@@ -644,6 +646,15 @@ t4vf_attach(device_t dev)
sc->port[i] = NULL;
goto done;
}
+
+   /* Prefer the MAC address set by the PF, if there is one. */
+   n = 1;
+   p = ffs(pmask) - 1;
+   MPASS(p >= 0);
+   rc = t4vf_get_vf_mac(sc, p, , mac);
+   if (rc == 0 && n == 1)
+   t4_os_set_hw_addr(pi, mac);
+   pmask &= ~(1 << p);
 
/* No t4_link_start. */
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367496 - head/sys/powerpc/aim

2020-11-08 Thread Brandon Bergren
Author: bdragon
Date: Sun Nov  8 23:34:06 2020
New Revision: 367496
URL: https://svnweb.freebsd.org/changeset/base/367496

Log:
  [PowerPC] Fix powerpc64le boot after HPT superpages addition
  
  The HPT is always stored in big-endian, as it is accessed directly by the
  hardware as well as the kernel. As such, it is necessary to convert values
  to and from native endian when running on LE.
  
  Some unconverted accesses snuck in accidentally with r367417.
  
  Apply the appropriate conversions to fix boot hanging on powerpc64le.
  
  Sponsored by: Tag1 Consulting, Inc.

Modified:
  head/sys/powerpc/aim/moea64_native.c

Modified: head/sys/powerpc/aim/moea64_native.c
==
--- head/sys/powerpc/aim/moea64_native.cSun Nov  8 22:30:13 2020
(r367495)
+++ head/sys/powerpc/aim/moea64_native.cSun Nov  8 23:34:06 2020
(r367496)
@@ -384,7 +384,7 @@ moea64_pte_clear_native(struct pvo_entry *pvo, uint64_
 static __always_inline int64_t
 moea64_pte_unset_locked(volatile struct lpte *pt, uint64_t vpn)
 {
-   uint64_t ptelo;
+   uint64_t ptelo, ptehi;
 
/*
 * Invalidate the pte, briefly locking it to collect RC bits. No
@@ -392,9 +392,10 @@ moea64_pte_unset_locked(volatile struct lpte *pt, uint
 */
isync();
critical_enter();
-   pt->pte_hi = htobe64((be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED);
+   ptehi = (be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED;
+   pt->pte_hi = htobe64(ptehi);
PTESYNC();
-   TLBIE(vpn, pt->pte_hi);
+   TLBIE(vpn, ptehi);
ptelo = be64toh(pt->pte_lo);
*((volatile int32_t *)(>pte_hi) + 1) = 0; /* Release lock */
critical_exit();
@@ -416,7 +417,7 @@ moea64_pte_unset_native(struct pvo_entry *pvo)
 
rw_rlock(_eviction_lock);
 
-   if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) != pvo_ptevpn) {
+   if ((be64toh(pt->pte_hi) & LPTE_AVPN_MASK) != pvo_ptevpn) {
/* Evicted */
STAT_MOEA64(moea64_pte_overflow--);
ret = -1;
@@ -433,7 +434,7 @@ moea64_pte_replace_inval_native(struct pvo_entry *pvo,
 volatile struct lpte *pt)
 {
struct lpte properpt;
-   uint64_t ptelo;
+   uint64_t ptelo, ptehi;
 
moea64_pte_from_pvo(pvo, );
 
@@ -452,9 +453,10 @@ moea64_pte_replace_inval_native(struct pvo_entry *pvo,
 */
isync();
critical_enter();
-   pt->pte_hi = htobe64((be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED);
+   ptehi = (be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED;
+   pt->pte_hi = htobe64(ptehi);
PTESYNC();
-   TLBIE(pvo->pvo_vpn, pt->pte_hi);
+   TLBIE(pvo->pvo_vpn, ptehi);
ptelo = be64toh(pt->pte_lo);
EIEIO();
pt->pte_lo = htobe64(properpt.pte_lo);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367495 - head/sys/dev/cxgbe/firmware

2020-11-08 Thread Navdeep Parhar
Author: np
Date: Sun Nov  8 22:30:13 2020
New Revision: 367495
URL: https://svnweb.freebsd.org/changeset/base/367495

Log:
  cxgbe(4): Add the firmware binaries missing in r367428.
  
  Obtained from:Chelsio Communications
  MFC after:5 days
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin   (contents, props changed)
  head/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin   (contents, props changed)
  head/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin   (contents, props changed)

Modified: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin
==
Binary file (source and/or target). No diff available.

Modified: head/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin
==
Binary file (source and/or target). No diff available.

Modified: head/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin
==
Binary file (source and/or target). No diff available.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367494 - head/sys/net

2020-11-08 Thread Mitchell Horne
Author: mhorne
Date: Sun Nov  8 19:02:22 2020
New Revision: 367494
URL: https://svnweb.freebsd.org/changeset/base/367494

Log:
  Fix definition of rn_addmask()
  
  Add the missing static keyword present in the declaration.
  
  Reviewed by:  melifaro
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:https://reviews.freebsd.org/D27024

Modified:
  head/sys/net/radix.c

Modified: head/sys/net/radix.c
==
--- head/sys/net/radix.cSun Nov  8 18:49:23 2020(r367493)
+++ head/sys/net/radix.cSun Nov  8 19:02:22 2020(r367494)
@@ -483,7 +483,7 @@ on1:
return (tt);
 }
 
-struct radix_node *
+static struct radix_node *
 rn_addmask(void *n_arg, struct radix_mask_head *maskhead, int search, int skip)
 {
unsigned char *netmask = n_arg;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367493 - head/sys/netinet

2020-11-08 Thread Mitchell Horne
Author: mhorne
Date: Sun Nov  8 18:49:23 2020
New Revision: 367493
URL: https://svnweb.freebsd.org/changeset/base/367493

Log:
  igmp: convert igmpstat to use PCPU counters
  
  Currently there is no locking done to protect this structure. It is
  likely okay due to the low-volume nature of IGMP, but allows for
  the possibility of underflow. This appears to be one of the only
  holdouts of the conversion to counter(9) which was done for most
  protocol stat structures around 2013.
  
  This also updates the visibility of this stats structure so that it can
  be consumed from elsewhere in the kernel, consistent with the vast
  majority of VNET_PCPUSTAT structures.
  
  Reviewed by:  kp
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:https://reviews.freebsd.org/D27023

Modified:
  head/sys/netinet/igmp.c
  head/sys/netinet/igmp_var.h

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Sun Nov  8 18:47:05 2020(r367492)
+++ head/sys/netinet/igmp.c Sun Nov  8 18:49:23 2020(r367493)
@@ -230,16 +230,15 @@ VNET_DEFINE_STATIC(int, current_state_timers_running);
 #defineV_state_change_timers_running   
VNET(state_change_timers_running)
 #defineV_current_state_timers_running  
VNET(current_state_timers_running)
 
+VNET_PCPUSTAT_DEFINE(struct igmpstat, igmpstat);
+VNET_PCPUSTAT_SYSINIT(igmpstat);
+VNET_PCPUSTAT_SYSUNINIT(igmpstat);
+
 VNET_DEFINE_STATIC(LIST_HEAD(, igmp_ifsoftc), igi_head) =
 LIST_HEAD_INITIALIZER(igi_head);
-VNET_DEFINE_STATIC(struct igmpstat, igmpstat) = {
-   .igps_version = IGPS_VERSION_3,
-   .igps_len = sizeof(struct igmpstat),
-};
 VNET_DEFINE_STATIC(struct timeval, igmp_gsrdelay) = {10, 0};
 
 #defineV_igi_head  VNET(igi_head)
-#defineV_igmpstat  VNET(igmpstat)
 #defineV_igmp_gsrdelay VNET(igmp_gsrdelay)
 
 VNET_DEFINE_STATIC(int, igmp_recvifkludge) = 1;
@@ -263,7 +262,8 @@ VNET_DEFINE_STATIC(int, igmp_default_version) = IGMP_V
  */
 SYSCTL_PROC(_net_inet_igmp, IGMPCTL_STATS, stats,
 CTLFLAG_VNET | CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_MPSAFE,
-_NAME(igmpstat), 0, sysctl_igmp_stat, "S,igmpstat", "");
+_NAME(igmpstat), 0, sysctl_igmp_stat, "S,igmpstat",
+"IGMP statistics (struct igmpstat, netinet/igmp_var.h)");
 SYSCTL_INT(_net_inet_igmp, OID_AUTO, recvifkludge, CTLFLAG_VNET | CTLFLAG_RW,
 _NAME(igmp_recvifkludge), 0,
 "Rewrite IGMPv1/v2 reports from 0.0.0.0 to contain subnet address");
@@ -347,22 +347,31 @@ sysctl_igmp_stat(SYSCTL_HANDLER_ARGS)
int error;
char *p;
 
-   error = sysctl_wire_old_buffer(req, sizeof(V_igmpstat));
+   error = sysctl_wire_old_buffer(req, sizeof(struct igmpstat));
if (error)
return (error);
 
if (req->oldptr != NULL) {
-   if (req->oldlen < sizeof(V_igmpstat))
+   if (req->oldlen < sizeof(struct igmpstat))
error = ENOMEM;
-   else 
-   error = SYSCTL_OUT(req, _igmpstat,
-   sizeof(V_igmpstat));
+   else {
+   /*
+* Copy the counters, and explicitly set the struct's
+* version and length fields.
+*/
+   COUNTER_ARRAY_COPY(VNET(igmpstat), ,
+   sizeof(struct igmpstat) / sizeof(uint64_t));
+   igps0.igps_version = IGPS_VERSION_3;
+   igps0.igps_len = IGPS_VERSION3_LEN;
+   error = SYSCTL_OUT(req, ,
+   sizeof(struct igmpstat));
+   }
} else
-   req->validlen = sizeof(V_igmpstat);
+   req->validlen = sizeof(struct igmpstat);
if (error)
goto out;
if (req->newptr != NULL) {
-   if (req->newlen < sizeof(V_igmpstat))
+   if (req->newlen < sizeof(struct igmpstat))
error = ENOMEM;
else
error = SYSCTL_IN(req, ,
@@ -379,12 +388,8 @@ sysctl_igmp_stat(SYSCTL_HANDLER_ARGS)
error = EINVAL;
goto out;
}
-   /*
-* Avoid overwrite of the version and length field.
-*/
-   igps0.igps_version = V_igmpstat.igps_version;
-   igps0.igps_len = V_igmpstat.igps_len;
-   bcopy(, _igmpstat, sizeof(V_igmpstat));
+   COUNTER_ARRAY_ZERO(VNET(igmpstat),
+   sizeof(struct igmpstat) / sizeof(uint64_t));
}
 out:
return (error);

Modified: head/sys/netinet/igmp_var.h
==
--- head/sys/netinet/igmp_var.h Sun Nov  8 

svn commit: r367492 - in head/sys/netinet: . tcp_stacks

2020-11-08 Thread Richard Scheffenegger
Author: rscheff
Date: Sun Nov  8 18:47:05 2020
New Revision: 367492
URL: https://svnweb.freebsd.org/changeset/base/367492

Log:
  Prevent premature SACK block transmission during loss recovery
  
  Under specific conditions, a window update can be sent with
  outdated SACK information. Some clients react to this by
  subsequently delaying loss recovery, making TCP perform very
  poorly.
  
  Reported by:  chengc_netapp.com
  Reviewed by:  rrs, jtl
  MFC after:2 weeks
  Sponsored by: NetApp, Inc.
  Differential Revision:https://reviews.freebsd.org/D24237

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_reass.c
  head/sys/netinet/tcp_stacks/bbr.c
  head/sys/netinet/tcp_stacks/rack.c
  head/sys/netinet/tcp_stacks/rack_bbr_common.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cSun Nov  8 18:27:49 2020
(r367491)
+++ head/sys/netinet/tcp_input.cSun Nov  8 18:47:05 2020
(r367492)
@@ -1462,6 +1462,29 @@ tcp_autorcvbuf(struct mbuf *m, struct tcphdr *th, stru
 }
 
 void
+tcp_handle_wakeup(struct tcpcb *tp, struct socket *so)
+{
+   /*
+* Since tp might be gone if the session entered
+* the TIME_WAIT state before coming here, we need
+* to check if the socket is still connected.
+*/
+   if ((so->so_state & SS_ISCONNECTED) == 0)
+   return;
+   INP_LOCK_ASSERT(tp->t_inpcb);
+   if (tp->t_flags & TF_WAKESOR) {
+   tp->t_flags &= ~TF_WAKESOR;
+   SOCKBUF_UNLOCK_ASSERT(>so_rcv);
+   sorwakeup(so);
+   }
+   if (tp->t_flags & TF_WAKESOW) {
+   tp->t_flags &= ~TF_WAKESOW;
+   SOCKBUF_UNLOCK_ASSERT(>so_snd);
+   sowwakeup(so);
+   }
+}
+
+void
 tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
 struct tcpcb *tp, int drop_hdrlen, int tlen, uint8_t iptos)
 {
@@ -1811,7 +1834,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru
else if (!tcp_timer_active(tp, TT_PERSIST))
tcp_timer_activate(tp, TT_REXMT,
  tp->t_rxtcur);
-   sowwakeup(so);
+   tp->t_flags |= TF_WAKESOW;
if (sbavail(>so_snd))
(void) tp->t_fb->tfb_tcp_output(tp);
goto check_delack;
@@ -1876,8 +1899,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru
m_adj(m, drop_hdrlen);  /* delayed header drop 
*/
sbappendstream_locked(>so_rcv, m, 0);
}
-   /* NB: sorwakeup_locked() does an implicit unlock. */
-   sorwakeup_locked(so);
+   SOCKBUF_UNLOCK(>so_rcv);
+   tp->t_flags |= TF_WAKESOR;
if (DELAY_ACK(tp, tlen)) {
tp->t_flags |= TF_DELACK;
} else {
@@ -2811,8 +2834,8 @@ process_ACK:
tp->snd_wnd = 0;
ourfinisacked = 0;
}
-   /* NB: sowwakeup_locked() does an implicit unlock. */
-   sowwakeup_locked(so);
+   SOCKBUF_UNLOCK(>so_snd);
+   tp->t_flags |= TF_WAKESOW;
m_freem(mfree);
/* Detect una wraparound. */
if (!IN_RECOVERY(tp->t_flags) &&
@@ -3033,8 +3056,8 @@ dodata:   
/* XXX */
m_freem(m);
else
sbappendstream_locked(>so_rcv, m, 0);
-   /* NB: sorwakeup_locked() does an implicit unlock. */
-   sorwakeup_locked(so);
+   SOCKBUF_UNLOCK(>so_rcv);
+   tp->t_flags |= TF_WAKESOR;
} else {
/*
 * XXX: Due to the header drop above "th" is
@@ -3101,6 +3124,8 @@ dodata:   
/* XXX */
if (thflags & TH_FIN) {
if (TCPS_HAVERCVDFIN(tp->t_state) == 0) {
socantrcvmore(so);
+   /* The socket upcall is handled by socantrcvmore. */
+   tp->t_flags &= ~TF_WAKESOR;
/*
 * If connection is half-synchronized
 * (ie NEEDSYN flag on) then delay ACK,
@@ -3164,6 +3189,7 @@ check_delack:
tp->t_flags &= ~TF_DELACK;
tcp_timer_activate(tp, TT_DELACK, tcp_delacktime);
}
+   tcp_handle_wakeup(tp, so);

svn commit: r367491 - in head: . sys/net/route

2020-11-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Sun Nov  8 18:27:49 2020
New Revision: 367491
URL: https://svnweb.freebsd.org/changeset/base/367491

Log:
  Switch net.add_addr_allfibs default to 0.
  
  The goal of the fib support is to provide multiple independent
   routing tables, isolated from each other.
  net.add_addr_allfibs default tries to shift gears in the opposite
   direction, unconditionally inserting all addresses to all of the fibs.
  
  There are use cases when this is necessary, however this is not a
   default expected behaviour, especially compared to other implementations.
  
  Provide WARNING message for the setups with multiple fibs to notify
   potential users of the feature.
  
  Differential Revision:https://reviews.freebsd.org/D26076

Modified:
  head/UPDATING
  head/sys/net/route/route_ifaddrs.c
  head/sys/net/route/route_tables.c

Modified: head/UPDATING
==
--- head/UPDATING   Sun Nov  8 18:11:12 2020(r367490)
+++ head/UPDATING   Sun Nov  8 18:27:49 2020(r367491)
@@ -26,6 +26,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
world, or to merely disable the most expensive debugging functionality
at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20201108:
+   Default value of net.add_addr_allfibs has been changed to 0.
+   If you have multi-fib configuration and rely on existence of all
+   interface routes in every fib, you need to set the above sysctl to 1.
 20201030:
The internal pre-processor in the calendar(1) program has been
extended to support more C pre-processor commands (e.g. #ifdef, #else,

Modified: head/sys/net/route/route_ifaddrs.c
==
--- head/sys/net/route/route_ifaddrs.c  Sun Nov  8 18:11:12 2020
(r367490)
+++ head/sys/net/route/route_ifaddrs.c  Sun Nov  8 18:27:49 2020
(r367491)
@@ -61,7 +61,7 @@
  * By default, interface address routes are added to the fib of the interface.
  * Once set to non-zero, adds interface address route to all fibs.
  */
-VNET_DEFINE(u_int, rt_add_addr_allfibs) = 1;
+VNET_DEFINE(u_int, rt_add_addr_allfibs) = 0;
 SYSCTL_UINT(_net, OID_AUTO, add_addr_allfibs, CTLFLAG_RWTUN | CTLFLAG_VNET,
 _NAME(rt_add_addr_allfibs), 0, "");
 

Modified: head/sys/net/route/route_tables.c
==
--- head/sys/net/route/route_tables.c   Sun Nov  8 18:11:12 2020
(r367490)
+++ head/sys/net/route/route_tables.c   Sun Nov  8 18:27:49 2020
(r367491)
@@ -183,6 +183,11 @@ grow_rtables(uint32_t num_tables)
new_rt_tables = mallocarray(num_tables * (AF_MAX + 1), sizeof(void *),
M_RTABLE, M_WAITOK | M_ZERO);
 
+   if ((num_tables > 1) && (V_rt_add_addr_allfibs == 0))
+   printf("WARNING: Adding ifaddrs to all fibs has been turned off 
"
+   "by default. Consider tuning %s if needed\n",
+   "net.add_addr_allfibs");
+
/*
 * Current rt_tables layout:
 * fib0[af0, af1, af2, .., AF_MAX]fib1[af0, af1, af2, .., Af_MAX]..
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367490 - head/sys/net/route

2020-11-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Sun Nov  8 18:11:12 2020
New Revision: 367490
URL: https://svnweb.freebsd.org/changeset/base/367490

Log:
  Temporarily revert setting net.add_addr_allfibs to 0.
  It accidentally sweeped in r367486.
  Revert to allow for proper commit message & warning.

Modified:
  head/sys/net/route/route_ifaddrs.c

Modified: head/sys/net/route/route_ifaddrs.c
==
--- head/sys/net/route/route_ifaddrs.c  Sun Nov  8 17:10:12 2020
(r367489)
+++ head/sys/net/route/route_ifaddrs.c  Sun Nov  8 18:11:12 2020
(r367490)
@@ -61,7 +61,7 @@
  * By default, interface address routes are added to the fib of the interface.
  * Once set to non-zero, adds interface address route to all fibs.
  */
-VNET_DEFINE(u_int, rt_add_addr_allfibs) = 0;
+VNET_DEFINE(u_int, rt_add_addr_allfibs) = 1;
 SYSCTL_UINT(_net, OID_AUTO, add_addr_allfibs, CTLFLAG_RWTUN | CTLFLAG_VNET,
 _NAME(rt_add_addr_allfibs), 0, "");
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367488 - in head/sys: kern sys

2020-11-08 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Nov  8 15:54:59 2020
New Revision: 367488
URL: https://svnweb.freebsd.org/changeset/base/367488

Log:
  Move syscall_thread_{enter,exit}() into the slow path.  This is only
  needed for syscalls from unloadable modules.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: EPSRC
  Differential Revision:https://reviews.freebsd.org/D26988

Modified:
  head/sys/kern/kern_syscalls.c
  head/sys/kern/subr_syscall.c
  head/sys/sys/sysent.h

Modified: head/sys/kern/kern_syscalls.c
==
--- head/sys/kern/kern_syscalls.c   Sun Nov  8 14:08:00 2020
(r367487)
+++ head/sys/kern/kern_syscalls.c   Sun Nov  8 15:54:59 2020
(r367488)
@@ -80,10 +80,13 @@ syscall_thread_drain(struct sysent *se)
 }
 
 int
-_syscall_thread_enter(struct thread *td, struct sysent *se)
+syscall_thread_enter(struct thread *td, struct sysent *se)
 {
u_int32_t cnt, oldcnt;
 
+   KASSERT((se->sy_thrcnt & SY_THR_STATIC) == 0,
+   ("%s: not a static syscall", __func__));
+
do {
oldcnt = se->sy_thrcnt;
if ((oldcnt & (SY_THR_DRAINING | SY_THR_ABSENT)) != 0)
@@ -94,9 +97,12 @@ _syscall_thread_enter(struct thread *td, struct sysent
 }
 
 void
-_syscall_thread_exit(struct thread *td, struct sysent *se)
+syscall_thread_exit(struct thread *td, struct sysent *se)
 {
u_int32_t cnt, oldcnt;
+
+   KASSERT((se->sy_thrcnt & SY_THR_STATIC) == 0,
+   ("%s: not a static syscall", __func__));
 
do {
oldcnt = se->sy_thrcnt;

Modified: head/sys/kern/subr_syscall.c
==
--- head/sys/kern/subr_syscall.cSun Nov  8 14:08:00 2020
(r367487)
+++ head/sys/kern/subr_syscall.cSun Nov  8 15:54:59 2020
(r367488)
@@ -61,6 +61,7 @@ syscallenter(struct thread *td)
struct syscall_args *sa;
struct sysent *se;
int error, traced;
+   bool sy_thr_static;
 
VM_CNT_INC(v_syscall);
p = td->td_proc;
@@ -128,12 +129,6 @@ syscallenter(struct thread *td)
}
 #endif
 
-   error = syscall_thread_enter(td, se);
-   if (error != 0) {
-   td->td_errno = error;
-   goto retval;
-   }
-
/*
 * Fetch fast sigblock value at the time of syscall entry to
 * handle sleepqueue primitives which might call cursig().
@@ -145,8 +140,19 @@ syscallenter(struct thread *td)
KASSERT((td->td_pflags & TDP_NERRNO) == 0,
("%s: TDP_NERRNO set", __func__));
 
+   sy_thr_static = (se->sy_thrcnt & SY_THR_STATIC) != 0;
+
if (__predict_false(SYSTRACE_ENABLED() ||
-   AUDIT_SYSCALL_ENTER(sa->code, td))) {
+   AUDIT_SYSCALL_ENTER(sa->code, td) ||
+   !sy_thr_static)) {
+   if (!sy_thr_static) {
+   error = syscall_thread_enter(td, se);
+   if (error != 0) {
+   td->td_errno = error;
+   goto retval;
+   }
+   }
+
 #ifdef KDTRACE_HOOKS
/* Give the syscall:::entry DTrace probe a chance to fire. */
if (__predict_false(se->sy_entry != 0))
@@ -176,6 +182,9 @@ syscallenter(struct thread *td)
(*systrace_probe_func)(sa, SYSTRACE_RETURN,
error ? -1 : td->td_retval[0]);
 #endif
+
+   if (!sy_thr_static)
+   syscall_thread_exit(td, se);
} else {
error = (se->sy_call)(td, sa->args);
/* Save the latest error return value. */
@@ -184,7 +193,6 @@ syscallenter(struct thread *td)
else
td->td_errno = error;
}
-   syscall_thread_exit(td, se);
 
  retval:
KTR_STOP4(KTR_SYSC, "syscall", syscallname(p, sa->code),

Modified: head/sys/sys/sysent.h
==
--- head/sys/sys/sysent.h   Sun Nov  8 14:08:00 2020(r367487)
+++ head/sys/sys/sysent.h   Sun Nov  8 15:54:59 2020(r367488)
@@ -294,26 +294,8 @@ struct nosys_args;
 intlkmnosys(struct thread *, struct nosys_args *);
 intlkmressys(struct thread *, struct nosys_args *);
 
-int_syscall_thread_enter(struct thread *td, struct sysent *se);
-void   _syscall_thread_exit(struct thread *td, struct sysent *se);
-
-static inline int
-syscall_thread_enter(struct thread *td, struct sysent *se)
-{
-
-   if (__predict_true((se->sy_thrcnt & SY_THR_STATIC) != 0))
-   return (0);
-   return (_syscall_thread_enter(td, se));
-}
-
-static inline void
-syscall_thread_exit(struct thread *td, struct sysent *se)
-{
-
-   if (__predict_true((se->sy_thrcnt & SY_THR_STATIC) != 0))
-   return;
-   _syscall_thread_exit(td, se);
-}

svn commit: r367487 - head/sys/contrib/openzfs/module/os/freebsd/zfs

2020-11-08 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Nov  8 14:08:00 2020
New Revision: 367487
URL: https://svnweb.freebsd.org/changeset/base/367487

Log:
  Check if the ZVOL has been written before calling zil_async_to_sync.
  The ZIL will be opened on the first write, not earlier.
  
  Reviewed-by: Ryan Moeller 
  Reviewed-by: Brian Behlendorf 
  Signed-off-by: Mariusz Zaborski 
  OpenZFS Pull Request: https://github.com/openzfs/zfs/pull/11152
  PR:   250934

Modified:
  head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c

Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c
==
--- head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.cSun Nov  8 
13:30:44 2020(r367486)
+++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.cSun Nov  8 
14:08:00 2020(r367487)
@@ -890,7 +890,8 @@ zvol_cdev_open(struct cdev *dev, int flags, int fmt, s
if (flags & (FSYNC | FDSYNC)) {
zsd = >zv_zso->zso_dev;
zsd->zsd_sync_cnt++;
-   if (zsd->zsd_sync_cnt == 1)
+   if (zsd->zsd_sync_cnt == 1 &&
+   (zv->zv_flags & ZVOL_WRITTEN_TO) != 0)
zil_async_to_sync(zv->zv_zilog, ZVOL_OBJ);
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367486 - head/sys/net/route

2020-11-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Sun Nov  8 13:30:44 2020
New Revision: 367486
URL: https://svnweb.freebsd.org/changeset/base/367486

Log:
  Fix build broken by r367484: add route_ifaddrs.c.
  
  Pointy hat to: melifaro
  Reported by:  jenkins

Added:
  head/sys/net/route/route_ifaddrs.c   (contents, props changed)

Added: head/sys/net/route/route_ifaddrs.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/net/route/route_ifaddrs.c  Sun Nov  8 13:30:44 2020
(r367486)
@@ -0,0 +1,309 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1980, 1986, 1991, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * @(#)route.c 8.3.1.1 (Berkeley) 2/23/95
+ * $FreeBSD$
+ */
+
+#include "opt_mpath.h"
+#include "opt_route.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/*
+ * Control interface address fib propagation.
+ * By default, interface address routes are added to the fib of the interface.
+ * Once set to non-zero, adds interface address route to all fibs.
+ */
+VNET_DEFINE(u_int, rt_add_addr_allfibs) = 0;
+SYSCTL_UINT(_net, OID_AUTO, add_addr_allfibs, CTLFLAG_RWTUN | CTLFLAG_VNET,
+_NAME(rt_add_addr_allfibs), 0, "");
+
+/*
+ * Set up a routing table entry, normally
+ * for an interface.
+ */
+static inline  int
+rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
+{
+   RIB_RLOCK_TRACKER;
+   struct epoch_tracker et;
+   struct sockaddr *dst;
+   struct sockaddr *netmask;
+   struct rib_cmd_info rc;
+   struct rt_addrinfo info;
+   int error = 0;
+   int startfib, endfib;
+   struct sockaddr_storage ss;
+   int didwork = 0;
+   int a_failure = 0;
+   struct sockaddr_dl_short sdl;
+   struct rib_head *rnh;
+
+   if (flags & RTF_HOST) {
+   dst = ifa->ifa_dstaddr;
+   netmask = NULL;
+   } else {
+   dst = ifa->ifa_addr;
+   netmask = ifa->ifa_netmask;
+   }
+   if (dst->sa_len == 0)
+   return(EINVAL);
+   switch (dst->sa_family) {
+   case AF_INET6:
+   case AF_INET:
+   /* We support multiple FIBs. */
+   break;
+   default:
+   fibnum = RT_DEFAULT_FIB;
+   break;
+   }
+   if (fibnum == RT_ALL_FIBS) {
+   if (V_rt_add_addr_allfibs == 0 && cmd == (int)RTM_ADD)
+   startfib = endfib = ifa->ifa_ifp->if_fib;
+   else {
+   startfib = 0;
+   endfib = rt_numfibs - 1;
+   }
+   } else {
+   KASSERT((fibnum < rt_numfibs), ("rtinit1: bad fibnum"));
+   startfib = fibnum;
+   endfib = fibnum;
+   }
+
+   /*
+* If it's a delete, check that if it exists,
+* it's on the correct interface or we might scrub
+* a route to another ifa which would
+* be confusing at best and possibly worse.
+*/
+   if (cmd == RTM_DELETE) {
+   /*
+* It's a delete, so it should already exist..
+* If it's a net, mask off the host bits
+* (Assuming we have a mask)
+* XXX 

svn commit: r367485 - head/contrib/llvm-project/llvm/lib/Target/PowerPC

2020-11-08 Thread Dimitry Andric
Author: dim
Date: Sun Nov  8 12:47:35 2020
New Revision: 367485
URL: https://svnweb.freebsd.org/changeset/base/367485

Log:
  Merge commit 354d3106c from llvm git (by Kai Luo):
  
[PowerPC] Skip combining (uint_to_fp x) if x is not simple type
  
Current powerpc64le backend hits
```
Combining: t7: f64 = uint_to_fp t6
llc: llvm-project/llvm/include/llvm/CodeGen/ValueTypes.h:291:
llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() &&
"Expected a SimpleValueType!"' failed.
```
This patch fixes it by skipping combination if `t6` is not simple
type.
Fixed https://bugs.llvm.org/show_bug.cgi?id=47660.
  
Reviewed By: #powerpc, steven.zhang
  
Differential Revision: https://reviews.llvm.org/D88388
  
  This should fix the llvm assertion mentioned above when building the
  following ports for powerpc64le:
  
  * audio/traverso
  * databases/percona57-pam-for-mysql
  * databases/percona57-server
  * emulators/citra
  * emulators/citra-qt5
  * games/7kaa
  * graphics/dia
  * graphics/mandelbulber
  * graphics/pcl-pointclouds
  * net-p2p/libtorrent-rasterbar
  * textproc/htmldoc
  
  Requested by: pkubaj
  MFC after:3 days

Modified:
  head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
==
--- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp   
Sun Nov  8 11:12:00 2020(r367484)
+++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp   
Sun Nov  8 12:47:35 2020(r367485)
@@ -14257,6 +14257,8 @@ SDValue PPCTargetLowering::combineFPToIntToFP(SDNode *
   // from the hardware.
   if (Op.getValueType() != MVT::f32 && Op.getValueType() != MVT::f64)
 return SDValue();
+  if (!Op.getOperand(0).getValueType().isSimple())
+return SDValue();
   if (Op.getOperand(0).getValueType().getSimpleVT() <= MVT(MVT::i1) ||
   Op.getOperand(0).getValueType().getSimpleVT() > MVT(MVT::i64))
 return SDValue();
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367484 - in head/sys: conf net

2020-11-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Sun Nov  8 11:12:00 2020
New Revision: 367484
URL: https://svnweb.freebsd.org/changeset/base/367484

Log:
  Move all ifaddr route creation business logic to net/route/route_ifaddr.c
  
  Differential Revision:https://reviews.freebsd.org/D26318

Modified:
  head/sys/conf/files
  head/sys/net/if.c
  head/sys/net/route.c

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sun Nov  8 10:13:06 2020(r367483)
+++ head/sys/conf/files Sun Nov  8 11:12:00 2020(r367484)
@@ -4174,6 +4174,7 @@ net/route/nhop_utils.cstandard
 net/route/route_ctl.c  standard
 net/route/route_ddb.c  optional ddb
 net/route/route_helpers.c  standard
+net/route/route_ifaddrs.c  standard
 net/route/route_tables.c   standard
 net/route/route_temporal.c standard
 net/rss_config.c   optional inet rss | inet6 rss

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Sun Nov  8 10:13:06 2020(r367483)
+++ head/sys/net/if.c   Sun Nov  8 11:12:00 2020(r367484)
@@ -1842,76 +1842,6 @@ ifa_free(struct ifaddr *ifa)
NET_EPOCH_CALL(ifa_destroy, >ifa_epoch_ctx);
 }
 
-static int
-ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa,
-struct sockaddr *ia)
-{
-   struct rib_cmd_info rc;
-   struct epoch_tracker et;
-   int error;
-   struct rt_addrinfo info;
-   struct sockaddr_dl null_sdl;
-   struct ifnet *ifp;
-   struct ifaddr *rti_ifa = NULL;
-
-   ifp = ifa->ifa_ifp;
-
-   NET_EPOCH_ENTER(et);
-   bzero(, sizeof(info));
-   if (cmd != RTM_DELETE)
-   info.rti_ifp = V_loif;
-   if (cmd == RTM_ADD) {
-   /* explicitly specify (loopback) ifa */
-   if (info.rti_ifp != NULL) {
-   rti_ifa = ifaof_ifpforaddr(ifa->ifa_addr, info.rti_ifp);
-   if (rti_ifa != NULL)
-   ifa_ref(rti_ifa);
-   info.rti_ifa = rti_ifa;
-   }
-   }
-   info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC | RTF_PINNED;
-   info.rti_info[RTAX_DST] = ia;
-   info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)_sdl;
-   link_init_sdl(ifp, (struct sockaddr *)_sdl, ifp->if_type);
-
-   error = rib_action(ifp->if_fib, cmd, , );
-   NET_EPOCH_EXIT(et);
-
-   if (rti_ifa != NULL)
-   ifa_free(rti_ifa);
-
-   if (error == 0 ||
-   (cmd == RTM_ADD && error == EEXIST) ||
-   (cmd == RTM_DELETE && (error == ENOENT || error == ESRCH)))
-   return (error);
-
-   log(LOG_DEBUG, "%s: %s failed for interface %s: %u\n",
-   __func__, otype, if_name(ifp), error);
-
-   return (error);
-}
-
-int
-ifa_add_loopback_route(struct ifaddr *ifa, struct sockaddr *ia)
-{
-
-   return (ifa_maintain_loopback_route(RTM_ADD, "insertion", ifa, ia));
-}
-
-int
-ifa_del_loopback_route(struct ifaddr *ifa, struct sockaddr *ia)
-{
-
-   return (ifa_maintain_loopback_route(RTM_DELETE, "deletion", ifa, ia));
-}
-
-int
-ifa_switch_loopback_route(struct ifaddr *ifa, struct sockaddr *ia)
-{
-
-   return (ifa_maintain_loopback_route(RTM_CHANGE, "switch", ifa, ia));
-}
-
 /*
  * XXX: Because sockaddr_dl has deeper structure than the sockaddr
  * structs used to represent other address families, it is necessary

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cSun Nov  8 10:13:06 2020(r367483)
+++ head/sys/net/route.cSun Nov  8 11:12:00 2020(r367484)
@@ -72,20 +72,6 @@
 #include 
 #include 
 
-/*
- * By default add routes to all fibs for new interfaces.
- * Once this is set to 0 then only allocate routes on interface
- * changes for the FIB of the caller when adding a new set of addresses
- * to an interface.  XXX this is a shotgun aproach to a problem that needs
- * a more fine grained solution.. that will come.
- * XXX also has the problems getting the FIB from curthread which will not
- * always work given the fib can be overridden and prefixes can be added
- * from the network stack context.
- */
-VNET_DEFINE(u_int, rt_add_addr_allfibs) = 1;
-SYSCTL_UINT(_net, OID_AUTO, add_addr_allfibs, CTLFLAG_RWTUN | CTLFLAG_VNET,
-_NAME(rt_add_addr_allfibs), 0, "");
-
 VNET_PCPUSTAT_DEFINE(struct rtstat, rtstat);
 
 VNET_PCPUSTAT_SYSINIT(rtstat);
@@ -864,196 +850,6 @@ rt_maskedcopy(struct sockaddr *src, struct sockaddr *d
*cp2++ = *cp1++ & *cp3++;
if (cp2 < cplim2)
bzero((caddr_t)cp2, (unsigned)(cplim2 - cp2));
-}
-
-/*
- * Set up a routing table entry, normally
- * for an interface.
- */
-static inline  int
-rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
-{
-   

svn commit: r367481 - in head: share/man/man4 sys/compat/linux

2020-11-08 Thread Alexander Leidinger
Author: netchild
Date: Sun Nov  8 09:50:58 2020
New Revision: 367481
URL: https://svnweb.freebsd.org/changeset/base/367481

Log:
   - add more linux socket options (sorted by value)
   - map those IPv4 / IPv6 socket options which exist in FreeBSD
 + most of them visually verified to have the same type/layout of arguments
 + not tested with linux programs to behave as intended
   - be more human readable for known options which are not handled
   - be more verbose for unhandled socket message flags we know about
   - print the jail ID in linux_msg if run in a jail
   - add possibility to print debug message about known missing parts only once
   - add multiple levels of sysctl linux.debug:
 1: print debug messages, tell about unimplemented stuff (only once)
 2: like 1, but also print messages about implemented but not tested
stuff (only once)
 3+: like 2, but no rate limiting of messages
   - increase default linux debug level from 1 to 3
  
  We are a lot more verbose in as we need to be (e.g. some of the IP socket
  options which are the same, and share the same memory layout, and are
  believed to work). The reason is that we have no good testsuite to test those
  linux-bits. The LTP or other test suites like the python one, are not fully
  up to the task we need. As such the excessive messages about emulated but not
  tested socket options.
  
  IMO any MFC (possible, but most probably not by me) should set the default
  debug level to 1.
  
  Discussed with:   trasz

Modified:
  head/share/man/man4/linux.4
  head/sys/compat/linux/linux_mib.c
  head/sys/compat/linux/linux_socket.c
  head/sys/compat/linux/linux_socket.h
  head/sys/compat/linux/linux_util.c
  head/sys/compat/linux/linux_util.h

Modified: head/share/man/man4/linux.4
==
--- head/share/man/man4/linux.4 Sun Nov  8 09:49:51 2020(r367480)
+++ head/share/man/man4/linux.4 Sun Nov  8 09:50:58 2020(r367481)
@@ -98,7 +98,12 @@ tunables:
 .It Va compat.linux.debug
 Enable debugging messages.
 Set to 0 to silence them.
-Defaults to 1.
+Defaults to 3.
+A setting of 1 prints debug messages, tells about unimplemented stuff (only
+once).
+Set to 2 is like 1, but also prints messages about implemented but not tested
+stuff (only once).
+Setting it to 3 or higher is like 2, but no rate limiting of messages.
 .It Va compat.linux.default_openfiles
 Default soft openfiles resource limit for Linux applications.
 Set to -1 to disable the limit.

Modified: head/sys/compat/linux/linux_mib.c
==
--- head/sys/compat/linux/linux_mib.c   Sun Nov  8 09:49:51 2020
(r367480)
+++ head/sys/compat/linux/linux_mib.c   Sun Nov  8 09:50:58 2020
(r367481)
@@ -63,7 +63,7 @@ static unsigned linux_osd_jail_slot;
 SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
 "Linux mode");
 
-int linux_debug = 1;
+int linux_debug = 3;
 SYSCTL_INT(_compat_linux, OID_AUTO, debug, CTLFLAG_RWTUN,
 _debug, 0, "Log warnings from linux(4); or 0 to disable");
 

Modified: head/sys/compat/linux/linux_socket.c
==
--- head/sys/compat/linux/linux_socket.cSun Nov  8 09:49:51 2020
(r367480)
+++ head/sys/compat/linux/linux_socket.cSun Nov  8 09:50:58 2020
(r367481)
@@ -112,12 +112,37 @@ linux_to_bsd_ip_sockopt(int opt)
 {
 
switch (opt) {
+   /* known and translated sockopts */
case LINUX_IP_TOS:
return (IP_TOS);
case LINUX_IP_TTL:
return (IP_TTL);
+   case LINUX_IP_HDRINCL:
+   return (IP_HDRINCL);
case LINUX_IP_OPTIONS:
return (IP_OPTIONS);
+   case LINUX_IP_RECVOPTS:
+   LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_RECVOPTS");
+   return (IP_RECVOPTS);
+   case LINUX_IP_RETOPTS:
+   LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_REETOPTS");
+   return (IP_RETOPTS);
+   case LINUX_IP_RECVTTL:
+   LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_RECVTTL");
+   return (IP_RECVTTL);
+   case LINUX_IP_RECVTOS:
+   LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_RECVTOS");
+   return (IP_RECVTOS);
+   case LINUX_IP_FREEBIND:
+   LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_FREEBIND");
+   return (IP_BINDANY);
+   case LINUX_IP_IPSEC_POLICY:
+   /* we have this option, but not documented in ip(4) manpage */
+   LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option 
IP_IPSEC_POLICY");
+   return (IP_IPSEC_POLICY);
+   case LINUX_IP_MINTTL:
+   LINUX_RATELIMIT_MSG_NOTTESTED("IPv4 socket option IP_MINTTL");
+   return (IP_MINTTL);

svn commit: r367480 - head/stand/common

2020-11-08 Thread Toomas Soome
Author: tsoome
Date: Sun Nov  8 09:49:51 2020
New Revision: 367480
URL: https://svnweb.freebsd.org/changeset/base/367480

Log:
  loader: cstyle cleanup of bootstrap.h did miss a bit
  
  correct small issues - misplaced comment and typos.

Modified:
  head/stand/common/bootstrap.h

Modified: head/stand/common/bootstrap.h
==
--- head/stand/common/bootstrap.h   Sun Nov  8 09:35:41 2020
(r367479)
+++ head/stand/common/bootstrap.h   Sun Nov  8 09:49:51 2020
(r367480)
@@ -111,10 +111,10 @@ struct console
/* reinit XXX may need more args */
int (* c_init)(int arg);
/* emit c */
-   void(* c_out)(int c);
-   int (* c_in)(void);
+   void(* c_out)(int c);
/* wait for and return input */
-   /* return nonzer if input waiting */
+   int (* c_in)(void);
+   /* return nonzero if input waiting */
int (* c_ready)(void);
 };
 extern struct console *consoles[];
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367479 - head/stand/common

2020-11-08 Thread Toomas Soome
Author: tsoome
Date: Sun Nov  8 09:35:41 2020
New Revision: 367479
URL: https://svnweb.freebsd.org/changeset/base/367479

Log:
  loader: cstyle cleanup of bootstrap.h
  
  No functional changes intended.

Modified:
  head/stand/common/bootstrap.h

Modified: head/stand/common/bootstrap.h
==
--- head/stand/common/bootstrap.h   Sun Nov  8 07:49:39 2020
(r367478)
+++ head/stand/common/bootstrap.h   Sun Nov  8 09:35:41 2020
(r367479)
@@ -40,11 +40,11 @@ typedef int (bootblk_cmd_t)(int argc, char *argv[]);
 #defineCOMMAND_ERRBUFSZ(256)
 extern const char *command_errmsg;
 extern charcommand_errbuf[COMMAND_ERRBUFSZ];
-#define CMD_OK 0
-#define CMD_WARN   1
-#define CMD_ERROR  2
-#define CMD_CRIT   3
-#define CMD_FATAL  4
+#defineCMD_OK  0
+#defineCMD_WARN1
+#defineCMD_ERROR   2
+#defineCMD_CRIT3
+#defineCMD_FATAL   4
 
 /* interp.c */
 void   interact(void);
@@ -52,9 +52,9 @@ void  interp_emit_prompt(void);
 intinterp_builtin_cmd(int argc, char *argv[]);
 
 /* Called by interp.c for interp_*.c embedded interpreters */
-intinterp_include(const char *filename);   /* Execute commands from 
filename */
-void   interp_init(void);  /* Initialize interpreater */
-intinterp_run(const char *line);   /* Run a single command */
+intinterp_include(const char *);   /* Execute commands from filename */
+void   interp_init(void);  /* Initialize interpreater */
+intinterp_run(const char *);   /* Run a single command */
 
 /* interp_backslash.c */
 char   *backslash(const char *str);
@@ -87,64 +87,70 @@ int bcache_strategy(void *devdata, int rw, daddr_t blk
  */
 struct bcache_devdata
 {
-int (*dv_strategy)(void *devdata, int rw, daddr_t blk,
-   size_t size, char *buf, size_t *rsize);
-void   *dv_devdata;
-void   *dv_cache;
+   int (*dv_strategy)(void *, int, daddr_t, size_t, char *, size_t *);
+   void*dv_devdata;
+   void*dv_cache;
 };
 
 /*
  * Modular console support.
  */
-struct console 
+struct console
 {
-const char *c_name;
-const char *c_desc;
-intc_flags;
-#define C_PRESENTIN(1<<0)  /* console can provide input */
-#define C_PRESENTOUT   (1<<1)  /* console can provide output */
-#define C_ACTIVEIN (1<<2)  /* user wants input from console */
-#define C_ACTIVEOUT(1<<3)  /* user wants output to console */
+   const char  *c_name;
+   const char  *c_desc;
+   int c_flags;
+#defineC_PRESENTIN (1<<0)  /* console can provide input */
+#defineC_PRESENTOUT(1<<1)  /* console can provide output */
+#defineC_ACTIVEIN  (1<<2)  /* user wants input from console */
+#defineC_ACTIVEOUT (1<<3)  /* user wants output to console */
 #defineC_WIDEOUT   (1<<4)  /* c_out routine groks wide chars */
-void   (* c_probe)(struct console *cp);/* set c_flags to match 
hardware */
-int(* c_init)(int arg);/* reinit XXX 
may need more args */
-void   (* c_out)(int c);   /* emit c */
-int(* c_in)(void); /* wait for and 
return input */
-int(* c_ready)(void);  /* return 
nonzer if input waiting */
+
+   /* set c_flags to match hardware */
+   void(* c_probe)(struct console *cp);
+   /* reinit XXX may need more args */
+   int (* c_init)(int arg);
+   /* emit c */
+   void(* c_out)(int c);
+   int (* c_in)(void);
+   /* wait for and return input */
+   /* return nonzer if input waiting */
+   int (* c_ready)(void);
 };
-extern struct console  *consoles[];
-void   cons_probe(void);
+extern struct console *consoles[];
+void cons_probe(void);
 
 /*
  * Plug-and-play enumerator/configurator interface.
  */
-struct pnphandler 
+struct pnphandler
 {
-const char *pp_name;   /* handler/bus name */
-void   (* pp_enumerate)(void); /* enumerate PnP devices, add to chain 
*/
+   const char *pp_name;/* handler/bus name */
+   void (*pp_enumerate)(void); /* enumerate PnP devices, add to chain */
 };
 
 struct pnpident
 {
-char   *id_ident;  /* ASCII identifier, actual 
format varies with bus/handler */
-STAILQ_ENTRY(pnpident) id_link;
+   /* ASCII identifier, actual format varies with bus/handler */
+   char*id_ident;
+   STAILQ_ENTRY(pnpident)  id_link;
 };
 
 struct pnpinfo
 {
-char   *pi_desc;   /* ASCII description, optional 
*/
-int