svn commit: r361746 - head/sys/dev/netmap

2020-06-02 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jun  3 05:48:42 2020
New Revision: 361746
URL: https://svnweb.freebsd.org/changeset/base/361746

Log:
  netmap: vtnet: remove leftover memory barriers
  
  MFC after:1 week

Modified:
  head/sys/dev/netmap/if_vtnet_netmap.h

Modified: head/sys/dev/netmap/if_vtnet_netmap.h
==
--- head/sys/dev/netmap/if_vtnet_netmap.h   Wed Jun  3 05:27:29 2020
(r361745)
+++ head/sys/dev/netmap/if_vtnet_netmap.h   Wed Jun  3 05:48:42 2020
(r361746)
@@ -129,7 +129,6 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl
/*
 * First part: process new packets to send.
 */
-   rmb();
 
nm_i = kring->nr_hwcur;
if (nm_i != head) { /* we have new packets to send */
@@ -302,7 +301,6 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl
struct vtnet_rxq *rxq = >vtnet_rxqs[ring_nr];
struct virtqueue *vq = rxq->vtnrx_vq;
 
-   rmb();
/*
 * First part: import newly received packets.
 * Only accept our own buffers (matching the token). We should only get
___
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: r361747 - head/sys/dev/netmap

2020-06-02 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jun  3 05:49:19 2020
New Revision: 361747
URL: https://svnweb.freebsd.org/changeset/base/361747

Log:
  netmap: vale: fix disabled logs
  
  MFC after:1 week

Modified:
  head/sys/dev/netmap/netmap_vale.c

Modified: head/sys/dev/netmap/netmap_vale.c
==
--- head/sys/dev/netmap/netmap_vale.c   Wed Jun  3 05:48:42 2020
(r361746)
+++ head/sys/dev/netmap/netmap_vale.c   Wed Jun  3 05:49:19 2020
(r361747)
@@ -1034,7 +1034,7 @@ nm_vale_flush(struct nm_bdg_fwd *ft, u_int n, struct n
}
 
nm_prdis(5, "pass 2 dst %d is %x %s",
-   i, d_i, is_vp ? "virtual" : "nic/host");
+   i, d_i, nm_is_bwrap(_na->up) ? "nic/host" : 
"virtual");
dst_nr = d_i & (NM_BDG_MAXRINGS-1);
nrings = dst_na->up.num_rx_rings;
if (dst_nr >= nrings)
@@ -1114,7 +1114,7 @@ retry:
 
nm_prdis("send [%d] %d(%d) bytes at 
%s:%d",
i, (int)copy_len, 
(int)dst_len,
-   NM_IFPNAME(dst_ifp), j);
+   dst_na->up.name, j);
/* round to a multiple of 64 */
copy_len = (copy_len + 63) & ~63;
 
___
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: r361745 - head/sys/dev/virtio/network

2020-06-02 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jun  3 05:27:29 2020
New Revision: 361745
URL: https://svnweb.freebsd.org/changeset/base/361745

Log:
  netmap: vtnet: call netmap_rx_irq() under VQ lock
  
  The netmap_rx_irq() function normally wakes up user-space threads
  waiting for more packets. In this case, it is not necessary to
  call it under the driver queue lock. However, if the interface is
  attached to a VALE switch, netmap_rx_irq() ends up calling rxsync
  on the interface (see netmap_bwrap_intr_notify()). Although
  concurrent rxsyncs are serialized through the kring lock
  (see nm_kr_tryget()), the lock acquire operation is not blocking.
  As a result, it may happen that netmap_rx_irq() is called on
  an RX ring while another instance is running, causing the
  second call to fail, and received packets stall in the receive VQ.
  We fix this issue by calling netmap_irx_irq() under the VQ lock.
  
  MFC after:1 week

Modified:
  head/sys/dev/virtio/network/if_vtnet.c

Modified: head/sys/dev/virtio/network/if_vtnet.c
==
--- head/sys/dev/virtio/network/if_vtnet.c  Wed Jun  3 05:09:33 2020
(r361744)
+++ head/sys/dev/virtio/network/if_vtnet.c  Wed Jun  3 05:27:29 2020
(r361745)
@@ -1936,9 +1936,20 @@ vtnet_rx_vq_intr(void *xrxq)
return;
}
 
+   VTNET_RXQ_LOCK(rxq);
+
 #ifdef DEV_NETMAP
+   /*
+* We call netmap_rx_irq() under lock to prevent concurrent calls.
+* This is not necessary to serialize the access to the RX vq, but
+* rather to avoid races that may happen if this interface is
+* attached to a VALE switch, which would cause received packets
+* to stall in the RX queue (nm_kr_tryget() could find the kring
+* busy when called from netmap_bwrap_intr_notify()).
+*/
nmirq = netmap_rx_irq(ifp, rxq->vtnrx_id, );
if (nmirq != NM_IRQ_PASS) {
+   VTNET_RXQ_UNLOCK(rxq);
if (nmirq == NM_IRQ_RESCHED) {
taskqueue_enqueue(rxq->vtnrx_tq, >vtnrx_intrtask);
}
@@ -1946,8 +1957,6 @@ vtnet_rx_vq_intr(void *xrxq)
}
 #endif /* DEV_NETMAP */
 
-   VTNET_RXQ_LOCK(rxq);
-
 again:
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
VTNET_RXQ_UNLOCK(rxq);
@@ -1987,17 +1996,18 @@ vtnet_rxq_tq_intr(void *xrxq, int pending)
sc = rxq->vtnrx_sc;
ifp = sc->vtnet_ifp;
 
+   VTNET_RXQ_LOCK(rxq);
+
 #ifdef DEV_NETMAP
nmirq = netmap_rx_irq(ifp, rxq->vtnrx_id, );
if (nmirq != NM_IRQ_PASS) {
+   VTNET_RXQ_UNLOCK(rxq);
if (nmirq == NM_IRQ_RESCHED) {
taskqueue_enqueue(rxq->vtnrx_tq, >vtnrx_intrtask);
}
return;
}
 #endif /* DEV_NETMAP */
-
-   VTNET_RXQ_LOCK(rxq);
 
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
VTNET_RXQ_UNLOCK(rxq);
___
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: r361744 - head/sys/dev/virtio/network

2020-06-02 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jun  3 05:09:33 2020
New Revision: 361744
URL: https://svnweb.freebsd.org/changeset/base/361744

Log:
  netmap: vtnet: honor NM_IRQ_RESCHED
  
  The netmap_rx_irq() function may return NM_IRQ_RESCHED to inform the
  driver that more work is pending, and that netmap expects netmap_rx_irq()
  to be called again as soon as possible.
  This change implements this behaviour in the vtnet driver.
  
  MFC after:1 week

Modified:
  head/sys/dev/virtio/network/if_vtnet.c

Modified: head/sys/dev/virtio/network/if_vtnet.c
==
--- head/sys/dev/virtio/network/if_vtnet.c  Wed Jun  3 05:00:40 2020
(r361743)
+++ head/sys/dev/virtio/network/if_vtnet.c  Wed Jun  3 05:09:33 2020
(r361744)
@@ -1916,6 +1916,9 @@ vtnet_rx_vq_intr(void *xrxq)
struct vtnet_rxq *rxq;
struct ifnet *ifp;
int tries, more;
+#ifdef DEV_NETMAP
+   int nmirq;
+#endif /* DEV_NETMAP */
 
rxq = xrxq;
sc = rxq->vtnrx_sc;
@@ -1934,8 +1937,13 @@ vtnet_rx_vq_intr(void *xrxq)
}
 
 #ifdef DEV_NETMAP
-   if (netmap_rx_irq(ifp, rxq->vtnrx_id, ) != NM_IRQ_PASS)
+   nmirq = netmap_rx_irq(ifp, rxq->vtnrx_id, );
+   if (nmirq != NM_IRQ_PASS) {
+   if (nmirq == NM_IRQ_RESCHED) {
+   taskqueue_enqueue(rxq->vtnrx_tq, >vtnrx_intrtask);
+   }
return;
+   }
 #endif /* DEV_NETMAP */
 
VTNET_RXQ_LOCK(rxq);
@@ -1971,10 +1979,23 @@ vtnet_rxq_tq_intr(void *xrxq, int pending)
struct vtnet_rxq *rxq;
struct ifnet *ifp;
int more;
+#ifdef DEV_NETMAP
+   int nmirq;
+#endif /* DEV_NETMAP */
 
rxq = xrxq;
sc = rxq->vtnrx_sc;
ifp = sc->vtnet_ifp;
+
+#ifdef DEV_NETMAP
+   nmirq = netmap_rx_irq(ifp, rxq->vtnrx_id, );
+   if (nmirq != NM_IRQ_PASS) {
+   if (nmirq == NM_IRQ_RESCHED) {
+   taskqueue_enqueue(rxq->vtnrx_tq, >vtnrx_intrtask);
+   }
+   return;
+   }
+#endif /* DEV_NETMAP */
 
VTNET_RXQ_LOCK(rxq);
 
___
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: r361743 - stable/11/sbin/ifconfig

2020-06-02 Thread Eugene Grosbein
Author: eugen
Date: Wed Jun  3 05:00:40 2020
New Revision: 361743
URL: https://svnweb.freebsd.org/changeset/base/361743

Log:
  MFC r361548: ifconfig(8): spell "groupname" consistently with SYNOPSYS.

Modified:
  stable/11/sbin/ifconfig/ifconfig.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ifconfig/ifconfig.8
==
--- stable/11/sbin/ifconfig/ifconfig.8  Wed Jun  3 04:48:00 2020
(r361742)
+++ stable/11/sbin/ifconfig/ifconfig.8  Wed Jun  3 05:00:40 2020
(r361743)
@@ -369,7 +369,7 @@ the system will not attempt to
 transmit messages through that interface.
 If possible, the interface will be reset to disable reception as well.
 This action does not automatically disable routes using the interface.
-.It Cm group Ar group-name
+.It Cm group Ar groupname
 Assign the interface to a
 .Dq group .
 Any interface can be in multiple groups.
@@ -382,7 +382,7 @@ is a member of the PPP interface family group,
 .\" The interface(s) the default route(s) point to are members of the
 .\" .Em egress
 .\" interface group.
-.It Cm -group Ar group-name
+.It Cm -group Ar groupname
 Remove the interface from the given
 .Dq group .
 .It Cm eui64
___
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: r361742 - stable/12/sbin/ifconfig

2020-06-02 Thread Eugene Grosbein
Author: eugen
Date: Wed Jun  3 04:48:00 2020
New Revision: 361742
URL: https://svnweb.freebsd.org/changeset/base/361742

Log:
  MFC r361548: ifconfig(8): spell "groupname" consistently with SYNOPSYS.

Modified:
  stable/12/sbin/ifconfig/ifconfig.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ifconfig/ifconfig.8
==
--- stable/12/sbin/ifconfig/ifconfig.8  Wed Jun  3 00:16:36 2020
(r361741)
+++ stable/12/sbin/ifconfig/ifconfig.8  Wed Jun  3 04:48:00 2020
(r361742)
@@ -369,7 +369,7 @@ the system will not attempt to
 transmit messages through that interface.
 If possible, the interface will be reset to disable reception as well.
 This action does not automatically disable routes using the interface.
-.It Cm group Ar group-name
+.It Cm group Ar groupname
 Assign the interface to a
 .Dq group .
 Any interface can be in multiple groups.
@@ -382,7 +382,7 @@ is a member of the PPP interface family group,
 .\" The interface(s) the default route(s) point to are members of the
 .\" .Em egress
 .\" interface group.
-.It Cm -group Ar group-name
+.It Cm -group Ar groupname
 Remove the interface from the given
 .Dq group .
 .It Cm eui64
___
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: r361741 - head/sys/x86/x86

2020-06-02 Thread Jason A. Harmening
Author: jah
Date: Wed Jun  3 00:16:36 2020
New Revision: 361741
URL: https://svnweb.freebsd.org/changeset/base/361741

Log:
  Remove unnecessary WITNESS check in x86 bus_dma
  
  When I did some bus_dma cleanup in r320528, I brought forward some sketchy
  WITNESS checks from the prior x86 busdma wrappers, instead of recognizing
  them as technical debt and just dropping them.  Two of these were removed in
  r346351 and r346851, but one remains in bounce_bus_dmamem_alloc(). This check
  could be constrained to only apply in the BUS_DMA_NOWAIT case, but it's 
cleaner
  to simply remove it and rely on the checks already present in the sleepable
  allocation paths used by this function.
  
  While here, remove another unnecessary witness check in bus_dma_tag_create
  (the tag is always allocated with M_NOWAIT), and fix a couple of typos.
  
  Reported by:  cem
  Reviewed by:  kib, cem
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25107

Modified:
  head/sys/x86/x86/busdma_bounce.c
  head/sys/x86/x86/busdma_machdep.c

Modified: head/sys/x86/x86/busdma_bounce.c
==
--- head/sys/x86/x86/busdma_bounce.cTue Jun  2 22:57:13 2020
(r361740)
+++ head/sys/x86/x86/busdma_bounce.cWed Jun  3 00:16:36 2020
(r361741)
@@ -407,8 +407,6 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vad
vm_memattr_t attr;
int mflags;
 
-   WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__);
-
if (flags & BUS_DMA_NOWAIT)
mflags = M_NOWAIT;
else
@@ -492,7 +490,7 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vad
 }
 
 /*
- * Free a piece of memory and it's allociated dmamap, that was allocated
+ * Free a piece of memory and its associated dmamap, that was allocated
  * via bus_dmamem_alloc.  Make the same choice for free/contigfree.
  */
 static void

Modified: head/sys/x86/x86/busdma_machdep.c
==
--- head/sys/x86/x86/busdma_machdep.c   Tue Jun  2 22:57:13 2020
(r361740)
+++ head/sys/x86/x86/busdma_machdep.c   Wed Jun  3 00:16:36 2020
(r361741)
@@ -223,8 +223,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al
struct bus_dma_tag_common *tc;
int error;
 
-   WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__);
-
if (parent == NULL) {
error = bus_dma_bounce_impl.tag_create(parent, alignment,
boundary, lowaddr, highaddr, filter, filterarg, maxsize,
___
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: r361740 - head/contrib/llvm-project/lld/ELF

2020-06-02 Thread Ed Maste
Author: emaste
Date: Tue Jun  2 22:57:13 2020
New Revision: 361740
URL: https://svnweb.freebsd.org/changeset/base/361740

Log:
  lld: Set DF_1_PIE for -pie
  
  DF_1_PIE originated from Solaris[1].
  
  GNU ld[2] sets the flag on non-Solaris platforms.
  
  It can help distinguish PIE from ET_DYN.
  eu-classify from elfutils uses this to recognize PIE[3].
  
  glibc uses this flag to reject dlopen'ing a PIE[4]
  
  [1] https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html
  [2] 
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5fe2850dd96483f176858fd75c098313d5b20bc2
  [3] 
https://sourceware.org/git/?p=elfutils.git;a=commit;h=3f489b5c7c78df6d52f8982f79c36e9a220e8951
  [4] https://sourceware.org/bugzilla/show_bug.cgi?id=24323
  
  Discussed with:   dim
  Obtained from:LLVM ee9a251caf1d
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/llvm-project/lld/ELF/SyntheticSections.cpp

Modified: head/contrib/llvm-project/lld/ELF/SyntheticSections.cpp
==
--- head/contrib/llvm-project/lld/ELF/SyntheticSections.cpp Tue Jun  2 
22:55:51 2020(r361739)
+++ head/contrib/llvm-project/lld/ELF/SyntheticSections.cpp Tue Jun  2 
22:57:13 2020(r361740)
@@ -1315,6 +1315,8 @@ template  void DynamicSection::final
 dtFlags1 |= DF_1_NODELETE;
   if (config->zNodlopen)
 dtFlags1 |= DF_1_NOOPEN;
+  if (config->pie)
+dtFlags1 |= DF_1_PIE;
   if (config->zNow) {
 dtFlags |= DF_BIND_NOW;
 dtFlags1 |= DF_1_NOW;
___
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: r361739 - in head/contrib/llvm-project/llvm: include/llvm/BinaryFormat tools/llvm-readobj

2020-06-02 Thread Ed Maste
Author: emaste
Date: Tue Jun  2 22:55:51 2020
New Revision: 361739
URL: https://svnweb.freebsd.org/changeset/base/361739

Log:
  llvm: Add DF_1_PIE
  
  Discussed with:   dim
  Obtained from:LLVM d9943e7f0ce8
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/llvm-project/llvm/include/llvm/BinaryFormat/ELF.h
  head/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp

Modified: head/contrib/llvm-project/llvm/include/llvm/BinaryFormat/ELF.h
==
--- head/contrib/llvm-project/llvm/include/llvm/BinaryFormat/ELF.h  Tue Jun 
 2 22:37:53 2020(r361738)
+++ head/contrib/llvm-project/llvm/include/llvm/BinaryFormat/ELF.h  Tue Jun 
 2 22:55:51 2020(r361739)
@@ -1290,7 +1290,8 @@ enum {
   DF_1_NORELOC = 0x0040,
   DF_1_SYMINTPOSE = 0x0080, // Object has individual interposers.
   DF_1_GLOBAUDIT = 0x0100,  // Global auditing required.
-  DF_1_SINGLETON = 0x0200   // Singleton symbols are used.
+  DF_1_SINGLETON = 0x0200,  // Singleton symbols are used.
+  DF_1_PIE = 0x0800,// Object is a position-independent executable.
 };
 
 // DT_MIPS_FLAGS values.

Modified: head/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp
==
--- head/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp Tue Jun 
 2 22:37:53 2020(r361738)
+++ head/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp Tue Jun 
 2 22:55:51 2020(r361739)
@@ -2213,7 +2213,8 @@ static const EnumEntry ElfDynamicDTFlags1[] 
   LLVM_READOBJ_DT_FLAG_ENT(DF_1, NORELOC),
   LLVM_READOBJ_DT_FLAG_ENT(DF_1, SYMINTPOSE),
   LLVM_READOBJ_DT_FLAG_ENT(DF_1, GLOBAUDIT),
-  LLVM_READOBJ_DT_FLAG_ENT(DF_1, SINGLETON)
+  LLVM_READOBJ_DT_FLAG_ENT(DF_1, SINGLETON),
+  LLVM_READOBJ_DT_FLAG_ENT(DF_1, PIE),
 };
 
 static const EnumEntry ElfDynamicDTMipsFlags[] = {
___
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: r361738 - head/sys/dev/usb/wlan

2020-06-02 Thread Adrian Chadd
Author: adrian
Date: Tue Jun  2 22:37:53 2020
New Revision: 361738
URL: https://svnweb.freebsd.org/changeset/base/361738

Log:
  [run] note that PHY_HT is for mixed mode.
  
  Submitted by: Ashish Gupta 
  Differential Revision:https://reviews.freebsd.org/D25108

Modified:
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_runreg.h

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 22:36:17 2020
(r361737)
+++ head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 22:37:53 2020
(r361738)
@@ -3397,7 +3397,7 @@ run_set_tx_desc(struct run_softc *sc, struct run_tx_da
mcs |= RT2860_PHY_OFDM;
} else if (rt2860_rates[ridx].phy == IEEE80211_T_HT) {
/* XXX TODO: [adrian] set short preamble for MCS? */
-   mcs |= RT2860_PHY_HT; /* Mixed, not greenfield */
+   mcs |= RT2860_PHY_HT_MIX; /* Mixed, not greenfield */
}
txwi->phy = htole16(mcs);
 

Modified: head/sys/dev/usb/wlan/if_runreg.h
==
--- head/sys/dev/usb/wlan/if_runreg.h   Tue Jun  2 22:36:17 2020
(r361737)
+++ head/sys/dev/usb/wlan/if_runreg.h   Tue Jun  2 22:37:53 2020
(r361738)
@@ -781,7 +781,7 @@ struct rt2860_txwi {
 #defineRT2860_PHY_MODE 0xc000
 #defineRT2860_PHY_CCK  (0 << 14)
 #defineRT2860_PHY_OFDM (1 << 14)
-#defineRT2860_PHY_HT   (2 << 14)
+#defineRT2860_PHY_HT_MIX   (2 << 14)
 #defineRT2860_PHY_HT_GF(3 << 14)
 #defineRT2860_PHY_SGI  (1 << 8)
 #defineRT2860_PHY_BW40 (1 << 7)
___
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: r361737 - head/sys/dev/usb/wlan

2020-06-02 Thread Adrian Chadd
Author: adrian
Date: Tue Jun  2 22:36:17 2020
New Revision: 361737
URL: https://svnweb.freebsd.org/changeset/base/361737

Log:
  [run] Set the number of HT chains.
  
  * Set the tx/rx chains based on the existing MIMO eeprom reads
  * Add 3-chain rates
  
  Tested:
  
  * MAC/BBP RT5390 (rev 0x0502), RF RT5370 (MIMO 1T1R), 2g/5g STA
  * MAC/BBP RT3593 (rev 0x0402), RF RT3053 (MIMO 3T3R), 2g/5g STA

Modified:
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 20:42:45 2020
(r361736)
+++ head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 22:36:17 2020
(r361737)
@@ -537,6 +537,7 @@ static const struct rt2860_rate {
{  0x85, 5, IEEE80211_T_HT, 4, 60, 60 },
{  0x86, 6, IEEE80211_T_HT, 4, 60, 60 },
{  0x87, 7, IEEE80211_T_HT, 4, 60, 60 },
+
/* MCS - 2 streams */
{  0x88, 8, IEEE80211_T_HT, 4, 60, 60 },
{  0x89, 9, IEEE80211_T_HT, 4, 60, 60 },
@@ -546,6 +547,16 @@ static const struct rt2860_rate {
{  0x8d, 13, IEEE80211_T_HT, 4, 60, 60 },
{  0x8e, 14, IEEE80211_T_HT, 4, 60, 60 },
{  0x8f, 15, IEEE80211_T_HT, 4, 60, 60 },
+
+   /* MCS - 3 streams */
+   {  0x90, 16, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x91, 17, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x92, 18, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x93, 19, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x94, 20, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x95, 21, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x96, 22, IEEE80211_T_HT, 4, 60, 60 },
+   {  0x97, 23, IEEE80211_T_HT, 4, 60, 60 },
 };
 
 /* These are indexes into the above rt2860_rates[] array */
@@ -553,7 +564,7 @@ static const struct rt2860_rate {
 #defineRT2860_RIDX_CCK11   3
 #defineRT2860_RIDX_OFDM6   4
 #defineRT2860_RIDX_MCS012
-#defineRT2860_RIDX_MAX 28
+#defineRT2860_RIDX_MAX 36
 
 static const struct {
uint16_treg;
@@ -859,12 +870,8 @@ run_attach(device_t self)
IEEE80211_HTCAP_MAXAMSDU_3839 |
IEEE80211_HTCAP_SMPS_OFF;
 
-   /*
-* For now, just do 1 stream.  Later on we'll figure out
-* how many tx/rx streams a particular NIC supports.
-*/
-   ic->ic_rxstream = 1;
-   ic->ic_txstream = 1;
+   ic->ic_rxstream = sc->nrxchains;
+   ic->ic_txstream = sc->ntxchains;
}
 
ic->ic_cryptocaps =
___
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: r361736 - stable/11/sys/dev/iscsi

2020-06-02 Thread Alexander Motin
Author: mav
Date: Tue Jun  2 20:42:45 2020
New Revision: 361736
URL: https://svnweb.freebsd.org/changeset/base/361736

Log:
  MFC 361400: Do not try to fill socket send buffer to the last byte.
  
  Setting so_snd.sb_lowat to at least 1/8 of the socket buffer size allows
  send thread more actively use PDUs coalescing, that dramatically reduces
  TCP lock congestion and number of context switches, when the socket is
  full and PDUs are small.

Modified:
  stable/11/sys/dev/iscsi/icl_soft.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/iscsi/icl_soft.c
==
--- stable/11/sys/dev/iscsi/icl_soft.c  Tue Jun  2 20:42:25 2020
(r361735)
+++ stable/11/sys/dev/iscsi/icl_soft.c  Tue Jun  2 20:42:45 2020
(r361736)
@@ -913,7 +913,8 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu
"have %ld, need %ld",
available, size);
 #endif
-   so->so_snd.sb_lowat = size;
+   so->so_snd.sb_lowat = max(size,
+   so->so_snd.sb_hiwat / 8);
SOCKBUF_UNLOCK(>so_snd);
return;
}
___
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: r361735 - stable/12/sys/dev/iscsi

2020-06-02 Thread Alexander Motin
Author: mav
Date: Tue Jun  2 20:42:25 2020
New Revision: 361735
URL: https://svnweb.freebsd.org/changeset/base/361735

Log:
  MFC 361400: Do not try to fill socket send buffer to the last byte.
  
  Setting so_snd.sb_lowat to at least 1/8 of the socket buffer size allows
  send thread more actively use PDUs coalescing, that dramatically reduces
  TCP lock congestion and number of context switches, when the socket is
  full and PDUs are small.

Modified:
  stable/12/sys/dev/iscsi/icl_soft.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/iscsi/icl_soft.c
==
--- stable/12/sys/dev/iscsi/icl_soft.c  Tue Jun  2 20:40:10 2020
(r361734)
+++ stable/12/sys/dev/iscsi/icl_soft.c  Tue Jun  2 20:42:25 2020
(r361735)
@@ -913,7 +913,8 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu
"have %ld, need %ld",
available, size);
 #endif
-   so->so_snd.sb_lowat = size;
+   so->so_snd.sb_lowat = max(size,
+   so->so_snd.sb_hiwat / 8);
SOCKBUF_UNLOCK(>so_snd);
return;
}
___
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: r361734 - stable/12/sys/cam/ctl

2020-06-02 Thread Alexander Motin
Author: mav
Date: Tue Jun  2 20:40:10 2020
New Revision: 361734
URL: https://svnweb.freebsd.org/changeset/base/361734

Log:
  MFC r361604: Make struct ctl_be_lun first element of struct ctl_be_*_lun.
  
  It allows to remove some extra pointer dereferences and slightly tightens
  up the code by unification.

Modified:
  stable/12/sys/cam/ctl/ctl.c
  stable/12/sys/cam/ctl/ctl_backend.h
  stable/12/sys/cam/ctl/ctl_backend_block.c
  stable/12/sys/cam/ctl/ctl_backend_ramdisk.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/ctl/ctl.c
==
--- stable/12/sys/cam/ctl/ctl.c Tue Jun  2 20:39:34 2020(r361733)
+++ stable/12/sys/cam/ctl/ctl.c Tue Jun  2 20:40:10 2020(r361734)
@@ -3081,7 +3081,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, 
break;
 
if (lun->backend->lun_info != NULL) {
-   retval = 
lun->backend->lun_info(lun->be_lun->be_lun, sb);
+   retval = lun->backend->lun_info(lun->be_lun, 
sb);
if (retval != 0)
break;
}
@@ -4749,7 +4749,7 @@ ctl_free_lun(struct ctl_lun *lun)
/*
 * Tell the backend to free resources, if this LUN has a backend.
 */
-   lun->be_lun->lun_shutdown(lun->be_lun->be_lun);
+   lun->be_lun->lun_shutdown(lun->be_lun);
 
lun->ie_reportcnt = UINT32_MAX;
callout_drain(>ie_callout);
@@ -6706,7 +6706,7 @@ ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
data = page_index->page_data;
 
if (lun->backend->lun_attr != NULL &&
-   (val = lun->backend->lun_attr(lun->be_lun->be_lun, "blocksavail"))
+   (val = lun->backend->lun_attr(lun->be_lun, "blocksavail"))
 != UINT64_MAX) {
phdr = (struct scsi_log_param_header *)data;
scsi_ulto2b(0x0001, phdr->param_code);
@@ -6719,7 +6719,7 @@ ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
}
 
if (lun->backend->lun_attr != NULL &&
-   (val = lun->backend->lun_attr(lun->be_lun->be_lun, "blocksused"))
+   (val = lun->backend->lun_attr(lun->be_lun, "blocksused"))
 != UINT64_MAX) {
phdr = (struct scsi_log_param_header *)data;
scsi_ulto2b(0x0002, phdr->param_code);
@@ -6732,7 +6732,7 @@ ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
}
 
if (lun->backend->lun_attr != NULL &&
-   (val = lun->backend->lun_attr(lun->be_lun->be_lun, 
"poolblocksavail"))
+   (val = lun->backend->lun_attr(lun->be_lun, "poolblocksavail"))
 != UINT64_MAX) {
phdr = (struct scsi_log_param_header *)data;
scsi_ulto2b(0x00f1, phdr->param_code);
@@ -6745,7 +6745,7 @@ ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
}
 
if (lun->backend->lun_attr != NULL &&
-   (val = lun->backend->lun_attr(lun->be_lun->be_lun, 
"poolblocksused"))
+   (val = lun->backend->lun_attr(lun->be_lun, "poolblocksused"))
 != UINT64_MAX) {
phdr = (struct scsi_log_param_header *)data;
scsi_ulto2b(0x00f2, phdr->param_code);
@@ -13384,8 +13384,7 @@ ctl_thresh_thread(void *arg)
continue;
}
mtx_unlock(>ctl_lock); // XXX
-   val = lun->backend->lun_attr(
-   lun->be_lun->be_lun, attr);
+   val = lun->backend->lun_attr(lun->be_lun, attr);
mtx_lock(>ctl_lock);
if (val == UINT64_MAX)
continue;

Modified: stable/12/sys/cam/ctl/ctl_backend.h
==
--- stable/12/sys/cam/ctl/ctl_backend.h Tue Jun  2 20:39:34 2020
(r361733)
+++ stable/12/sys/cam/ctl/ctl_backend.h Tue Jun  2 20:40:10 2020
(r361734)
@@ -80,7 +80,8 @@ typedef enum {
MODULE_DEPEND(name, cam, 1, 1, 1)
 
 
-typedef void (*be_callback_t)(void *be_lun);
+struct ctl_be_lun;
+typedef void (*be_callback_t)(struct ctl_be_lun *be_lun);
 
 /*
  * The lun_type field is the SCSI device type of this particular LUN.  In
@@ -147,7 +148,6 @@ struct ctl_be_lun {
uint8_t lun_type;   /* passed to CTL */
ctl_backend_lun_flags   flags;  /* passed to CTL */
ctl_lun_serseq  serseq; /* passed to CTL */
-   void*be_lun;/* passed to CTL */
uint64_tmaxlba; /* passed to CTL */
uint32_tblocksize;  /* passed to CTL */
uint16_tpblockexp;  

svn commit: r361733 - stable/12/sys/cam/ctl

2020-06-02 Thread Alexander Motin
Author: mav
Date: Tue Jun  2 20:39:34 2020
New Revision: 361733
URL: https://svnweb.freebsd.org/changeset/base/361733

Log:
  MFC r361590: Remove ctl_free_beio() LUN and ctl_io dependencies.
  
  This slightly simplifies the code, plus may be a ground for asynchronous
  buffer free.

Modified:
  stable/12/sys/cam/ctl/ctl_backend_block.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/ctl/ctl_backend_block.c
==
--- stable/12/sys/cam/ctl/ctl_backend_block.c   Tue Jun  2 20:38:53 2020
(r361732)
+++ stable/12/sys/cam/ctl/ctl_backend_block.c   Tue Jun  2 20:39:34 2020
(r361733)
@@ -162,7 +162,6 @@ struct ctl_be_block_lun {
cbb_dispatch_t unmap;
cbb_dispatch_t get_lba_status;
cbb_getattr_t getattr;
-   uma_zone_t lun_zone;
uint64_t size_blocks;
uint64_t size_bytes;
struct ctl_be_block_softc *softc;
@@ -187,9 +186,10 @@ struct ctl_be_block_lun {
 struct ctl_be_block_softc {
struct sxmodify_lock;
struct mtx   lock;
-   uma_zone_t   beio_zone;
int  num_luns;
SLIST_HEAD(, ctl_be_block_lun)   lun_list;
+   uma_zone_t   beio_zone;
+   uma_zone_t   buf_zone;
 };
 
 static struct ctl_be_block_softc backend_block_softc;
@@ -202,6 +202,7 @@ struct ctl_be_block_io {
struct ctl_sg_entry sg_segs[CTLBLK_MAX_SEGS];
struct iovecxiovecs[CTLBLK_MAX_SEGS];
int bio_cmd;
+   int two_sglists;
int num_segs;
int num_bios_sent;
int num_bios_done;
@@ -310,32 +311,20 @@ ctl_alloc_beio(struct ctl_be_block_softc *softc)
 static void
 ctl_free_beio(struct ctl_be_block_io *beio)
 {
-   int duplicate_free;
+   struct ctl_be_block_softc *softc = beio->softc;
int i;
 
-   duplicate_free = 0;
-
for (i = 0; i < beio->num_segs; i++) {
-   if (beio->sg_segs[i].addr == NULL)
-   duplicate_free++;
+   uma_zfree(softc->buf_zone, beio->sg_segs[i].addr);
 
-   uma_zfree(beio->lun->lun_zone, beio->sg_segs[i].addr);
-   beio->sg_segs[i].addr = NULL;
-
/* For compare we had two equal S/G lists. */
-   if (ARGS(beio->io)->flags & CTL_LLF_COMPARE) {
-   uma_zfree(beio->lun->lun_zone,
+   if (beio->two_sglists) {
+   uma_zfree(softc->buf_zone,
beio->sg_segs[i + CTLBLK_HALF_SEGS].addr);
-   beio->sg_segs[i + CTLBLK_HALF_SEGS].addr = NULL;
}
}
 
-   if (duplicate_free > 0) {
-   printf("%s: %d duplicate frees out of %d segments\n", __func__,
-  duplicate_free, beio->num_segs);
-   }
-
-   uma_zfree(beio->softc->beio_zone, beio);
+   uma_zfree(softc->beio_zone, beio);
 }
 
 static void
@@ -1272,6 +1261,7 @@ static void
 ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun,
union ctl_io *io)
 {
+   struct ctl_be_block_softc *softc = be_lun->softc;
struct ctl_be_lun *cbe_lun = _lun->cbe_lun;
struct ctl_be_block_io *beio;
struct ctl_lba_len_flags *lbalen;
@@ -1336,7 +1326,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *b
} else
seglen -= seglen % cbe_lun->blocksize;
beio->sg_segs[i].len = seglen;
-   beio->sg_segs[i].addr = uma_zalloc(be_lun->lun_zone, M_WAITOK);
+   beio->sg_segs[i].addr = uma_zalloc(softc->buf_zone, M_WAITOK);
 
DPRINTF("segment %d addr %p len %zd\n", i,
beio->sg_segs[i].addr, beio->sg_segs[i].len);
@@ -1590,10 +1580,12 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun,
DPRINTF("%s at LBA %jx len %u @%ju\n",
   (beio->bio_cmd == BIO_READ) ? "READ" : "WRITE",
   (uintmax_t)lbalen->lba, lbalen->len, bptrlen->len);
-   if (lbalen->flags & CTL_LLF_COMPARE)
+   if (lbalen->flags & CTL_LLF_COMPARE) {
+   beio->two_sglists = 1;
lbas = CTLBLK_HALF_IO_SIZE;
-   else
+   } else {
lbas = CTLBLK_MAX_IO_SIZE;
+   }
lbas = MIN(lbalen->len - bptrlen->len, lbas / cbe_lun->blocksize);
beio->io_offset = (lbalen->lba + bptrlen->len) * cbe_lun->blocksize;
beio->io_len = lbas * cbe_lun->blocksize;
@@ -1607,17 +1599,17 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun,
 * Setup the S/G entry for this chunk.
 */
beio->sg_segs[i].len = 

svn commit: r361732 - stable/11/sys/cam/ctl

2020-06-02 Thread Alexander Motin
Author: mav
Date: Tue Jun  2 20:38:53 2020
New Revision: 361732
URL: https://svnweb.freebsd.org/changeset/base/361732

Log:
  MFC r361536: Properly check kern_sg_entries for S/G list.
  
  ctl_data_print() is called in core context, so does not even know meaning
  of ext_sg_entries.

Modified:
  stable/11/sys/cam/ctl/ctl_util.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl_util.c
==
--- stable/11/sys/cam/ctl/ctl_util.cTue Jun  2 20:38:18 2020
(r361731)
+++ stable/11/sys/cam/ctl/ctl_util.cTue Jun  2 20:38:53 2020
(r361732)
@@ -859,7 +859,7 @@ ctl_data_print(union ctl_io *io)
return;
if (io->io_hdr.flags & CTL_FLAG_BUS_ADDR)
return;
-   if (io->scsiio.ext_sg_entries > 0)  /* XXX: Implement */
+   if (io->scsiio.kern_sg_entries > 0) /* XXX: Implement */
return;
ctl_scsi_path_string(io, path_str, sizeof(path_str));
len = min(io->scsiio.kern_data_len, 4096);
___
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: r361731 - stable/12/sys/cam/ctl

2020-06-02 Thread Alexander Motin
Author: mav
Date: Tue Jun  2 20:38:18 2020
New Revision: 361731
URL: https://svnweb.freebsd.org/changeset/base/361731

Log:
  MFC r361536: Properly check kern_sg_entries for S/G list.
  
  ctl_data_print() is called in core context, so does not even know meaning
  of ext_sg_entries.

Modified:
  stable/12/sys/cam/ctl/ctl_util.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/ctl/ctl_util.c
==
--- stable/12/sys/cam/ctl/ctl_util.cTue Jun  2 20:37:31 2020
(r361730)
+++ stable/12/sys/cam/ctl/ctl_util.cTue Jun  2 20:38:18 2020
(r361731)
@@ -861,7 +861,7 @@ ctl_data_print(union ctl_io *io)
return;
if (io->io_hdr.flags & CTL_FLAG_BUS_ADDR)
return;
-   if (io->scsiio.ext_sg_entries > 0)  /* XXX: Implement */
+   if (io->scsiio.kern_sg_entries > 0) /* XXX: Implement */
return;
ctl_scsi_path_string(io, path_str, sizeof(path_str));
len = min(io->scsiio.kern_data_len, 4096);
___
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: r361730 - stable/11/sys/cam/ctl

2020-06-02 Thread Alexander Motin
Author: mav
Date: Tue Jun  2 20:37:31 2020
New Revision: 361730
URL: https://svnweb.freebsd.org/changeset/base/361730

Log:
  MFC r361502: Do not remove upcall if we haven't yet.
  
  This fixes assertion if we failed to bind listening HA socket.

Modified:
  stable/11/sys/cam/ctl/ctl_ha.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl_ha.c
==
--- stable/11/sys/cam/ctl/ctl_ha.c  Tue Jun  2 20:37:04 2020
(r361729)
+++ stable/11/sys/cam/ctl/ctl_ha.c  Tue Jun  2 20:37:31 2020
(r361730)
@@ -257,7 +257,8 @@ ctl_ha_lclose(struct ha_softc *softc)
 
if (softc->ha_lso) {
SOCKBUF_LOCK(>ha_lso->so_rcv);
-   soupcall_clear(softc->ha_lso, SO_RCV);
+   if (softc->ha_lso->so_rcv.sb_upcall != NULL)
+   soupcall_clear(softc->ha_lso, SO_RCV);
SOCKBUF_UNLOCK(>ha_lso->so_rcv);
soclose(softc->ha_lso);
softc->ha_lso = 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: r361729 - stable/12/sys/cam/ctl

2020-06-02 Thread Alexander Motin
Author: mav
Date: Tue Jun  2 20:37:04 2020
New Revision: 361729
URL: https://svnweb.freebsd.org/changeset/base/361729

Log:
  MFC r361502, r361509: Fix fallout of r319722 in CTL HA.
  
  ha_lso is a listening socket (unless bind() has failed), so should use
  solisten_upcall_set(NULL, NULL), not soupcall_clear().

Modified:
  stable/12/sys/cam/ctl/ctl_ha.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/ctl/ctl_ha.c
==
--- stable/12/sys/cam/ctl/ctl_ha.c  Tue Jun  2 17:33:10 2020
(r361728)
+++ stable/12/sys/cam/ctl/ctl_ha.c  Tue Jun  2 20:37:04 2020
(r361729)
@@ -258,9 +258,11 @@ ctl_ha_lclose(struct ha_softc *softc)
 {
 
if (softc->ha_lso) {
-   SOCKBUF_LOCK(>ha_lso->so_rcv);
-   soupcall_clear(softc->ha_lso, SO_RCV);
-   SOCKBUF_UNLOCK(>ha_lso->so_rcv);
+   if (SOLISTENING(softc->ha_lso)) {
+   SOLISTEN_LOCK(softc->ha_lso);
+   solisten_upcall_set(softc->ha_lso, NULL, NULL);
+   SOLISTEN_UNLOCK(softc->ha_lso);
+   }
soclose(softc->ha_lso);
softc->ha_lso = 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: r361728 - head/libexec/rtld-elf

2020-06-02 Thread Konstantin Belousov
Author: kib
Date: Tue Jun  2 17:33:10 2020
New Revision: 361728
URL: https://svnweb.freebsd.org/changeset/base/361728

Log:
  Uppercase 'dso' to indicate that it is abbreviation.
  
  Suggested by: arichardson
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cTue Jun  2 17:18:16 2020
(r361727)
+++ head/libexec/rtld-elf/rtld.cTue Jun  2 17:33:10 2020
(r361728)
@@ -2583,7 +2583,7 @@ do_load_object(int fd, const char *name, char *path, s
 if (!digest_dynamic(obj, 0))
goto errp;
 if (obj->z_pie) {
-   _rtld_error("Cannot load PIE binary %s as dso", obj->path);
+   _rtld_error("Cannot load PIE binary %s as DSO", obj->path);
goto errp;
 }
 dbg("%s valid_hash_sysv %d valid_hash_gnu %d dynsymcount %d", obj->path,
___
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: r361727 - head/sys/sys

2020-06-02 Thread Doug Moore
Author: dougm
Date: Tue Jun  2 17:18:16 2020
New Revision: 361727
URL: https://svnweb.freebsd.org/changeset/base/361727

Log:
  Remove from RB_REMOVE_COLOR some null checks where the pointer checked
  is provably never null.  Restructure the surrounding code just enough
  to make the non-nullness obvious.
  
  Reviewed by:  markj
  Tested by:pho
  Differential Revision:https://reviews.freebsd.org/D25089

Modified:
  head/sys/sys/tree.h

Modified: head/sys/sys/tree.h
==
--- head/sys/sys/tree.h Tue Jun  2 16:40:58 2020(r361726)
+++ head/sys/sys/tree.h Tue Jun  2 17:18:16 2020(r361727)
@@ -493,26 +493,23 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
RB_ROTATE_LEFT(head, parent, tmp, field);\
tmp = RB_RIGHT(parent, field);  \
}   \
-   if (!RB_ISRED(RB_LEFT(tmp, field), field) &&\
-   !RB_ISRED(RB_RIGHT(tmp, field), field)) {   \
+   if (RB_ISRED(RB_LEFT(tmp, field), field)) { \
+   struct type *oleft; \
+   oleft = RB_LEFT(tmp, field);\
+   RB_COLOR(oleft, field) = RB_BLACK;  \
RB_COLOR(tmp, field) = RB_RED;  \
+   RB_ROTATE_RIGHT(head, tmp, oleft, field); \
+   tmp = RB_RIGHT(parent, field);  \
+   } else if (!RB_ISRED(RB_RIGHT(tmp, field), field)) { \
+   RB_COLOR(tmp, field) = RB_RED;  \
elm = parent;   \
parent = RB_PARENT(elm, field); \
continue;   \
}   \
-   if (!RB_ISRED(RB_RIGHT(tmp, field), field)) {   \
-   struct type *oleft; \
-   if ((oleft = RB_LEFT(tmp, field))   \
-   != NULL)\
-   RB_COLOR(oleft, field) = RB_BLACK; \
-   RB_COLOR(tmp, field) = RB_RED;  \
-   RB_ROTATE_RIGHT(head, tmp, oleft, field); \
-   tmp = RB_RIGHT(parent, field);  \
-   }   \
+   if (RB_ISRED(RB_RIGHT(tmp, field), field))  \
+   RB_COLOR(RB_RIGHT(tmp, field), field) = 
RB_BLACK; \
RB_COLOR(tmp, field) = RB_COLOR(parent, field); \
RB_COLOR(parent, field) = RB_BLACK; \
-   if (RB_RIGHT(tmp, field))   \
-   RB_COLOR(RB_RIGHT(tmp, field), field) = 
RB_BLACK; \
RB_ROTATE_LEFT(head, parent, tmp, field);   \
elm = RB_ROOT(head);\
break;  \
@@ -523,26 +520,23 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
RB_ROTATE_RIGHT(head, parent, tmp, field);\
tmp = RB_LEFT(parent, field);   \
}   \
-   if (!RB_ISRED(RB_LEFT(tmp, field), field) &&\
-   !RB_ISRED(RB_RIGHT(tmp, field), field)) {   \
+   if (RB_ISRED(RB_RIGHT(tmp, field), field)) {\
+   struct type *oright;\
+   oright = RB_RIGHT(tmp, field);  \
+   RB_COLOR(oright, field) = RB_BLACK; \
RB_COLOR(tmp, field) = RB_RED;  \
+   RB_ROTATE_LEFT(head, tmp, oright, field); \
+   tmp = RB_LEFT(parent, field);   \
+   } else if (!RB_ISRED(RB_LEFT(tmp, field), field)) { \
+   RB_COLOR(tmp, field) = RB_RED;  \
elm = parent;   \
parent = RB_PARENT(elm, field); \
continue;   \
}   \
-   if (!RB_ISRED(RB_LEFT(tmp, field), field)) {\
-   

svn commit: r361726 - head/sys/dev/usb/wlan

2020-06-02 Thread Adrian Chadd
Author: adrian
Date: Tue Jun  2 16:40:58 2020
New Revision: 361726
URL: https://svnweb.freebsd.org/changeset/base/361726

Log:
  [run] Add 11NA flags for 5G NICs that support HT.
  
  Now that I'm a proud owner of an ASUS USB-N66, I can test 2G/5G and
  3-stream configurations.
  
  For now, just flip on 5G HT rates.  I've tested this in both
  5G HT20 and 5G 11a modes.  It's still one stream for now until
  we verify that the number of streams reported (ie the MIMO below)
  is actually the number of 11n streams, NOT the number of antennas.
  (They don't have to match! You can have more antennas than MIMO
  streams!)
  
  Tested:
  
  * run0: MAC/BBP RT3593 (rev 0x0402), RF RT3053 (MIMO 3T3R)

Modified:
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 16:20:58 2020
(r361725)
+++ head/sys/dev/usb/wlan/if_run.c  Tue Jun  2 16:40:58 2020
(r361726)
@@ -4943,6 +4943,8 @@ run_getradiocaps(struct ieee80211com *ic,
sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 ||
sc->rf_rev == RT5592_RF_5592) {
setbit(bands, IEEE80211_MODE_11A);
+   if (sc->rf_rev != RT3070_RF_2020)
+   setbit(bands, IEEE80211_MODE_11NA);
/* Note: for now, only support HT20 channels */
ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
run_chan_5ghz, nitems(run_chan_5ghz), bands, 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: r361725 - head/libexec/rtld-elf

2020-06-02 Thread Konstantin Belousov
Author: kib
Date: Tue Jun  2 16:20:58 2020
New Revision: 361725
URL: https://svnweb.freebsd.org/changeset/base/361725

Log:
  Do not allow to load ET_DYN object with DF_1_PIE flag set.
  
  Linkers are supposed to mark PIE binaries with DF_1_PIE, such binary
  cannot be correctly and usefully loaded neither by dlopen(3) nor as a
  dependency of other object.  For instance, we cannot do anything
  useful with COPY relocations, among other things.
  
  Glibc already added similar restriction.
  
  Requested and reviewed by:emaste
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D25086

Modified:
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld.h

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cTue Jun  2 12:23:04 2020
(r361724)
+++ head/libexec/rtld-elf/rtld.cTue Jun  2 16:20:58 2020
(r361725)
@@ -1370,6 +1370,8 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_D
obj->z_interpose = true;
if (dynp->d_un.d_val & DF_1_NODEFLIB)
obj->z_nodeflib = true;
+   if (dynp->d_un.d_val & DF_1_PIE)
+   obj->z_pie = true;
break;
 
default:
@@ -2580,6 +2582,10 @@ do_load_object(int fd, const char *name, char *path, s
 obj->path = path;
 if (!digest_dynamic(obj, 0))
goto errp;
+if (obj->z_pie) {
+   _rtld_error("Cannot load PIE binary %s as dso", obj->path);
+   goto errp;
+}
 dbg("%s valid_hash_sysv %d valid_hash_gnu %d dynsymcount %d", obj->path,
obj->valid_hash_sysv, obj->valid_hash_gnu, obj->dynsymcount);
 if (obj->z_noopen && (flags & (RTLD_LO_DLOPEN | RTLD_LO_TRACE)) ==

Modified: head/libexec/rtld-elf/rtld.h
==
--- head/libexec/rtld-elf/rtld.hTue Jun  2 12:23:04 2020
(r361724)
+++ head/libexec/rtld-elf/rtld.hTue Jun  2 16:20:58 2020
(r361725)
@@ -257,6 +257,7 @@ typedef struct Struct_Obj_Entry {
 bool z_interpose : 1;  /* Interpose all objects but main */
 bool z_nodeflib : 1;   /* Don't search default library path */
 bool z_global : 1; /* Make the object global */
+bool z_pie : 1;/* Object proclaimed itself PIE executable */
 bool static_tls : 1;   /* Needs static TLS allocation */
 bool static_tls_copied : 1;/* Needs static TLS copying */
 bool ref_nodel : 1;/* Refcount increased to prevent 
dlclose */
___
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: r361712 - in head/sys/modules: . tcp

2020-06-02 Thread John Baldwin
On 6/2/20 8:08 AM, Kyle Evans wrote:
> On Tue, Jun 2, 2020 at 10:07 AM John Baldwin  wrote:
>>
>> On 6/1/20 5:32 PM, Kyle Evans wrote:> > Author: kevans
>>> Date: Tue Jun  2 00:32:36 2020
>>> New Revision: 361712
>>> URL: https://svnweb.freebsd.org/changeset/base/361712
>>>
>>> Log:
>>>   modules: don't build ipsec/tcpmd5 if the kernel is configured for IPSEC
>>>
>>>   IPSEC_SUPPORT can currently only cope with either IPSEC || IPSEC_SUPPORT,
>>>   not both. Refrain from building if IPSEC is set, as the resulting module
>>>   won't be able to load anyways if it's built into the kernel.
>>>
>>>   KERN_OPTS is safe here; for tied modules, it will reflect the kernel
>>>   configuration. For untied modules, it will defer to whatever is set in
>>>   ^/sys/conf/config.mk, which doesn't set IPSEC for modules. The latter
>>>   situation has some risk to it for uncommon scenarios, but such is the life
>>>   of untied kernel modules.
>>>
>>>   Reported by:jenkins (a lot), O. Hartmann (once)
>>>   Generally discussed with:   imp, jhb
>>>
>>> Modified:
>>>   head/sys/modules/Makefile
>>>   head/sys/modules/tcp/Makefile
>>>
>>> Modified: head/sys/modules/Makefile
>>> ==
>>> --- head/sys/modules/Makefile Tue Jun  2 00:03:26 2020(r361711)
>>> +++ head/sys/modules/Makefile Tue Jun  2 00:32:36 2020(r361712)
>>> @@ -427,7 +427,7 @@ _if_enc=  if_enc
>>>  _if_gif= if_gif
>>>  _if_gre= if_gre
>>>  _ipfw_pmod=  ipfw_pmod
>>> -.if ${KERN_OPTS:MIPSEC_SUPPORT}
>>> +.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MIPSEC}
>>>  _ipsec=  ipsec
>>>  .endif
>>>  .endif
>>>
>>> Modified: head/sys/modules/tcp/Makefile
>>> ==
>>> --- head/sys/modules/tcp/Makefile Tue Jun  2 00:03:26 2020
>>> (r361711)
>>> +++ head/sys/modules/tcp/Makefile Tue Jun  2 00:32:36 2020
>>> (r361712)
>>> @@ -16,7 +16,7 @@ _tcp_rack=  rack
>>>
>>>  .if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \
>>>   defined(ALL_MODULES)
>>> -.if ${KERN_OPTS:MIPSEC_SUPPORT}
>>> +.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MIPSEC}
>>
>> Thanks.
>>
>> Was finally getting back to this this morning.  This one should be 
>> TCP_SIGNATURE,
>> not IPSEC.  (This would break for a kernel which doesn't have IPSEC but does
>> have TCP_SIGNATURE.)
>>
> 
> Whoops. =-(

No worries.  I just finished a LINT build with that change.  I'll make sure a
full tinderbox passes ok though.

-- 
John Baldwin
___
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: r361712 - in head/sys/modules: . tcp

2020-06-02 Thread Kyle Evans
On Tue, Jun 2, 2020 at 10:07 AM John Baldwin  wrote:
>
> On 6/1/20 5:32 PM, Kyle Evans wrote:> > Author: kevans
> > Date: Tue Jun  2 00:32:36 2020
> > New Revision: 361712
> > URL: https://svnweb.freebsd.org/changeset/base/361712
> >
> > Log:
> >   modules: don't build ipsec/tcpmd5 if the kernel is configured for IPSEC
> >
> >   IPSEC_SUPPORT can currently only cope with either IPSEC || IPSEC_SUPPORT,
> >   not both. Refrain from building if IPSEC is set, as the resulting module
> >   won't be able to load anyways if it's built into the kernel.
> >
> >   KERN_OPTS is safe here; for tied modules, it will reflect the kernel
> >   configuration. For untied modules, it will defer to whatever is set in
> >   ^/sys/conf/config.mk, which doesn't set IPSEC for modules. The latter
> >   situation has some risk to it for uncommon scenarios, but such is the life
> >   of untied kernel modules.
> >
> >   Reported by:jenkins (a lot), O. Hartmann (once)
> >   Generally discussed with:   imp, jhb
> >
> > Modified:
> >   head/sys/modules/Makefile
> >   head/sys/modules/tcp/Makefile
> >
> > Modified: head/sys/modules/Makefile
> > ==
> > --- head/sys/modules/Makefile Tue Jun  2 00:03:26 2020(r361711)
> > +++ head/sys/modules/Makefile Tue Jun  2 00:32:36 2020(r361712)
> > @@ -427,7 +427,7 @@ _if_enc=  if_enc
> >  _if_gif= if_gif
> >  _if_gre= if_gre
> >  _ipfw_pmod=  ipfw_pmod
> > -.if ${KERN_OPTS:MIPSEC_SUPPORT}
> > +.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MIPSEC}
> >  _ipsec=  ipsec
> >  .endif
> >  .endif
> >
> > Modified: head/sys/modules/tcp/Makefile
> > ==
> > --- head/sys/modules/tcp/Makefile Tue Jun  2 00:03:26 2020
> > (r361711)
> > +++ head/sys/modules/tcp/Makefile Tue Jun  2 00:32:36 2020
> > (r361712)
> > @@ -16,7 +16,7 @@ _tcp_rack=  rack
> >
> >  .if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \
> >   defined(ALL_MODULES)
> > -.if ${KERN_OPTS:MIPSEC_SUPPORT}
> > +.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MIPSEC}
>
> Thanks.
>
> Was finally getting back to this this morning.  This one should be 
> TCP_SIGNATURE,
> not IPSEC.  (This would break for a kernel which doesn't have IPSEC but does
> have TCP_SIGNATURE.)
>

Whoops. =-(
___
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: r361633 - in head/sys: net netipsec

2020-06-02 Thread Kyle Evans
On Tue, Jun 2, 2020 at 10:05 AM John Baldwin  wrote:
>
> On 6/1/20 8:02 AM, Kyle Evans wrote:
> > On Mon, Jun 1, 2020 at 1:18 AM Hartmann, O.  wrote:
> >>
> >> On Sun, 31 May 2020 11:43:18 +0200
> >> "Hartmann, O."  wrote:
> >>
> >>> On Fri, 29 May 2020 19:22:40 + (UTC)
> >>> John Baldwin  wrote:
> >>>
>  Author: jhb
>  Date: Fri May 29 19:22:40 2020
>  New Revision: 361633
>  URL: https://svnweb.freebsd.org/changeset/base/361633
> 
>  Log:
>    Consistently include opt_ipsec.h for consumers of
>  .
>    This fixes ipsec.ko to include all of IPSEC_DEBUG.
> 
> >>> [... snip ...]
> >>>
> >>> [...]
> >>> --- all_subdir_ipsec ---
> >>> --- ipsec_mod.o ---
> >>> /usr/src/sys/netipsec/ipsec_mod.c:114:3: error: implicit declaration
> >>> of function 'ipsec_support_enable' is invalid in C99
> >>> [-Werror,-Wimplicit-function-declaration]
> >>> ipsec_support_enable(ipv4_ipsec_support, _methods); ^
> >>> /usr/src/sys/netipsec/ipsec_mod.c:125:3: error: implicit declaration
> >>> of function 'ipsec_support_disable' is invalid in C99
> >>> [-Werror,-Wimplicit-function-declaration]
> >>> ipsec_support_disable(ipv4_ipsec_support); ^ --- all_subdir_ipwfw ---
> >>> Building
> >>> /usr/obj/usr/src/amd64.amd64/sys/WALHALL/modules/usr/src/sys/modules/ipwfw/ipw_bss/ipw_bss.ko
> >>> --- all_subdir_ipsec --- /usr/src/sys/netipsec/ipsec_mod.c:125:3:
> >>> note: did you mean 'ipsec_support_enable'?
> >>> /usr/src/sys/netipsec/ipsec_mod.c:114:3: note: 'ipsec_support_enable'
> >>> declared here ipsec_support_enable(ipv4_ipsec_support, _methods);
> >>> ^ 2 errors generated. *** [ipsec_mod.o] Error code 1
> >>>
> >>> make[4]: stopped in /usr/src/sys/modules/ipsec
> >>
> >> FYI: IPSEC is statically built into the kernel via "options IPSEC"
> >
> > This is the same failure as we're seeing on LINT kernels, which also
> > have both. I've got a tentative diff at [0] that teaches the modules
> > to cope with the possibility, but I haven't thought too much on how
> > useful the result is. IIRC we're building the modules into the kernel
> > anyways in this scenario, so the result probably just won't load
> > because it's already loaded.
> >
> > [0] https://people.freebsd.org/~kevans.ipsec.diff
>
> I think we should just not build ipsec.ko and tcp_md5.ko if the kernel already
> includes the support instead.  I started testing this yesterday but got side
> tracked.  I will try to get this fixed today.
>

Hi,

Sorry, I forgot to follow up- I went ahead and tested+committed that
as r361712 to end the Jenkins spam.

Thanks,

Kyle Evans
___
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: r361712 - in head/sys/modules: . tcp

2020-06-02 Thread John Baldwin
On 6/1/20 5:32 PM, Kyle Evans wrote:
> Author: kevans
> Date: Tue Jun  2 00:32:36 2020
> New Revision: 361712
> URL: https://svnweb.freebsd.org/changeset/base/361712
> 
> Log:
>   modules: don't build ipsec/tcpmd5 if the kernel is configured for IPSEC
>   
>   IPSEC_SUPPORT can currently only cope with either IPSEC || IPSEC_SUPPORT,
>   not both. Refrain from building if IPSEC is set, as the resulting module
>   won't be able to load anyways if it's built into the kernel.
>   
>   KERN_OPTS is safe here; for tied modules, it will reflect the kernel
>   configuration. For untied modules, it will defer to whatever is set in
>   ^/sys/conf/config.mk, which doesn't set IPSEC for modules. The latter
>   situation has some risk to it for uncommon scenarios, but such is the life
>   of untied kernel modules.
>   
>   Reported by:jenkins (a lot), O. Hartmann (once)
>   Generally discussed with:   imp, jhb
> 
> Modified:
>   head/sys/modules/Makefile
>   head/sys/modules/tcp/Makefile
> 
> Modified: head/sys/modules/Makefile
> ==
> --- head/sys/modules/Makefile Tue Jun  2 00:03:26 2020(r361711)
> +++ head/sys/modules/Makefile Tue Jun  2 00:32:36 2020(r361712)
> @@ -427,7 +427,7 @@ _if_enc=  if_enc
>  _if_gif= if_gif
>  _if_gre= if_gre
>  _ipfw_pmod=  ipfw_pmod
> -.if ${KERN_OPTS:MIPSEC_SUPPORT}
> +.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MIPSEC}
>  _ipsec=  ipsec
>  .endif
>  .endif
> 
> Modified: head/sys/modules/tcp/Makefile
> ==
> --- head/sys/modules/tcp/Makefile Tue Jun  2 00:03:26 2020
> (r361711)
> +++ head/sys/modules/tcp/Makefile Tue Jun  2 00:32:36 2020
> (r361712)
> @@ -16,7 +16,7 @@ _tcp_rack=  rack
>  
>  .if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \
>   defined(ALL_MODULES)
> -.if ${KERN_OPTS:MIPSEC_SUPPORT}
> +.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MIPSEC}

Thanks.

Was finally getting back to this this morning.  This one should be 
TCP_SIGNATURE,
not IPSEC.  (This would break for a kernel which doesn't have IPSEC but does
have TCP_SIGNATURE.)

-- 
John Baldwin
___
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: r361633 - in head/sys: net netipsec

2020-06-02 Thread John Baldwin
On 6/1/20 8:02 AM, Kyle Evans wrote:
> On Mon, Jun 1, 2020 at 1:18 AM Hartmann, O.  wrote:
>>
>> On Sun, 31 May 2020 11:43:18 +0200
>> "Hartmann, O."  wrote:
>>
>>> On Fri, 29 May 2020 19:22:40 + (UTC)
>>> John Baldwin  wrote:
>>>
 Author: jhb
 Date: Fri May 29 19:22:40 2020
 New Revision: 361633
 URL: https://svnweb.freebsd.org/changeset/base/361633

 Log:
   Consistently include opt_ipsec.h for consumers of
 .
   This fixes ipsec.ko to include all of IPSEC_DEBUG.

>>> [... snip ...]
>>>
>>> [...]
>>> --- all_subdir_ipsec ---
>>> --- ipsec_mod.o ---
>>> /usr/src/sys/netipsec/ipsec_mod.c:114:3: error: implicit declaration
>>> of function 'ipsec_support_enable' is invalid in C99
>>> [-Werror,-Wimplicit-function-declaration]
>>> ipsec_support_enable(ipv4_ipsec_support, _methods); ^
>>> /usr/src/sys/netipsec/ipsec_mod.c:125:3: error: implicit declaration
>>> of function 'ipsec_support_disable' is invalid in C99
>>> [-Werror,-Wimplicit-function-declaration]
>>> ipsec_support_disable(ipv4_ipsec_support); ^ --- all_subdir_ipwfw ---
>>> Building
>>> /usr/obj/usr/src/amd64.amd64/sys/WALHALL/modules/usr/src/sys/modules/ipwfw/ipw_bss/ipw_bss.ko
>>> --- all_subdir_ipsec --- /usr/src/sys/netipsec/ipsec_mod.c:125:3:
>>> note: did you mean 'ipsec_support_enable'?
>>> /usr/src/sys/netipsec/ipsec_mod.c:114:3: note: 'ipsec_support_enable'
>>> declared here ipsec_support_enable(ipv4_ipsec_support, _methods);
>>> ^ 2 errors generated. *** [ipsec_mod.o] Error code 1
>>>
>>> make[4]: stopped in /usr/src/sys/modules/ipsec
>>
>> FYI: IPSEC is statically built into the kernel via "options IPSEC"
> 
> This is the same failure as we're seeing on LINT kernels, which also
> have both. I've got a tentative diff at [0] that teaches the modules
> to cope with the possibility, but I haven't thought too much on how
> useful the result is. IIRC we're building the modules into the kernel
> anyways in this scenario, so the result probably just won't load
> because it's already loaded.
> 
> [0] https://people.freebsd.org/~kevans.ipsec.diff

I think we should just not build ipsec.ko and tcp_md5.ko if the kernel already
includes the support instead.  I started testing this yesterday but got side
tracked.  I will try to get this fixed today.

-- 
John Baldwin
___
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: r361721 - head/contrib/ipfilter/man

2020-06-02 Thread Rodney W. Grimes
> In message <202006021419.052ejopl017...@gndrsh.dnsmgr.net>, "Rodney W. 
> Grimes"
> writes:
> > > Author: cy
> > > Date: Tue Jun  2 03:44:22 2020
> > > New Revision: 361721
> > > URL: https://svnweb.freebsd.org/changeset/base/361721
> > > 
> > > Log:
> > >   Per-rule hit counts (-h) can be used with either -i (input) or -o 
> > > (output
> > )
> > >   filter rule lists.
> >
> > This change does not make that explicitly apparent, as it simply
> > removes that -h -i is valid, but that means -h [-i|-o] is implicit.
> 
> The man page and corresponding verification options needs some work. For 
> instance -n also doesn't mean anything without either -i and/or -o. ipfstat 
> needs the same love that's been shown to ippool. Noted and on my todo list.
> 

Thank you.  

-- 
Rod Grimes rgri...@freebsd.org
___
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: r361360 - head/sys/dev/hyperv/hvsock

2020-06-02 Thread Wei Hu via svn-src-all
> -Original Message-
> From: Kyle Evans 
> Sent: Saturday, May 30, 2020 4:34 AM
> To: Wei Hu 
> Cc: src-committers ; svn-src-all  a...@freebsd.org>; svn-src-head 
> Subject: Re: svn commit: r361360 - head/sys/dev/hyperv/hvsock
> 
> On Fri, May 22, 2020 at 10:51 AM Kyle Evans  wrote:
> >
> > On Fri, May 22, 2020 at 4:17 AM Wei Hu  wrote:
> > >
> > > Author: whu
> > > Date: Fri May 22 09:17:07 2020
> > > New Revision: 361360
> > > URL:
> > > https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsv
> > >
> nweb.freebsd.org%2Fchangeset%2Fbase%2F361360data=02%7C01%7C
> weh%
> > >
> 40microsoft.com%7Cc97d223b440a8f1708d8040f9563%7C72f988bf86f1
> 41a
> > >
> f91ab2d7cd011db47%7C1%7C0%7C637263812262686264sdata=xPJ95
> nVsWPV
> > > f8qxlxSyMplJXuaFcbp5bd9FiGgvHhao%3Dreserved=0
> > >
> > > Log:
> > >   Socket AF_HYPERV should return failure when it is not running on
> > > HyperV
> > >
> > > [... snip ...]
> > > @@ -354,6 +354,9 @@ hvs_trans_attach(struct socket *so, int proto,
> > > struct  {
> > > struct hvs_pcb *pcb = so2hvspcb(so);
> > >
> > > +   if (vm_guest != VM_GUEST_HV)
> > > +   return (ESOCKTNOSUPPORT);
> > > +
> > > HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
> > > "%s: HyperV Socket hvs_trans_attach called\n",
> > > __func__);
> > >
> >
> > This one may be OK, but none of these other methods should be able to
> > be invoked if the attach failed. See this comment at around
> > ^/sys/kern/uipc_socket.c#50:
> >
> > 50 * pru_detach() disassociates protocol layer state from an attached
> > socket,
> > 51 * and will be called exactly once for sockets in which pru_attach()
> > has
> > 52 * been successfully called.  If pru_attach() returned an error,
> > 53 * pru_detach() will not be called.  Socket layer private.
> >
> > That said, I wonder if VNET_DOMAIN_SET provides the correct semantics
> > here at all. You can't fail domain_init, but I don't think there's any
> > value in this domain actually getting registered on non-HyperV guests,
> > a fact which presumably won't change at runtime.
> >
> 
> I'm considering the patch below, which is almost certainly going to be mangled
> by my mail client, for solving this style of problem. It gives the domain a 
> chance
> to probe the system and opt out, for cases like hvsock where leaving the
> domain around and fully-initialized when there's no way it can work is both
> wasteful and a bit of an accident waiting to happen -- IMO it's much less 
> error
> prone and more comforting if we just reject it early on, since we can. The
> vm_guest detection and hyperv's false-positive aversion stuff in hyperv_init
> should run much earlier than this.
> 
> diff --git a/sys/dev/hyperv/hvsock/hv_sock.c
> b/sys/dev/hyperv/hvsock/hv_sock.c index d212c2d8c2d..d3bc1ab0f2c 100644
> --- a/sys/dev/hyperv/hvsock/hv_sock.c
> +++ b/sys/dev/hyperv/hvsock/hv_sock.c
> @@ -74,6 +74,8 @@ SYSCTL_INT(_net_hvsock, OID_AUTO, hvs_dbg_level,
> CTLFLAG_RWTUN, _dbg_level,
> 
>  MALLOC_DEFINE(M_HVSOCK, "hyperv_socket", "hyperv socket control
> structures");
> 
> +static int hvs_dom_probe(void);
> +
>  /* The MTU is 16KB per host side's design */
>  #define HVSOCK_MTU_SIZE(1024 * 16)
>  #define HVSOCK_SEND_BUF_SZ (PAGE_SIZE - sizeof(struct
> vmpipe_proto_header))
> @@ -124,6 +126,7 @@ static struct protosw   hv_socket_protosw[] = 
> {
>  static struct domain   hv_socket_domain = {
> .dom_family =   AF_HYPERV,
> .dom_name = "hyperv",
> +   .dom_probe =hvs_dom_probe,
> .dom_protosw =  hv_socket_protosw,
> .dom_protoswNPROTOSW =
> _socket_protosw[nitems(hv_socket_protosw)]
>  };
> @@ -322,6 +325,16 @@ hvs_trans_unlock(void)
> sx_xunlock(_trans_socks_sx);  }
> 
> +static int
> +hvs_dom_probe(void)
> +{
> +
> +   /* Don't even give us a chance to attach on non-HyperV. */
> +   if (vm_guest != VM_GUEST_HV)
> +   return (ENXIO);
> +   return (0);
> +}
> +
>  void
>  hvs_trans_init(void)
>  {
> @@ -329,9 +342,6 @@ hvs_trans_init(void)
> if (!IS_DEFAULT_VNET(curvnet))
> return;
> 
> -   if (vm_guest != VM_GUEST_HV)
> -   return;
> -
> HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
> "%s: HyperV Socket hvs_trans_init called\n", __func__);
> 
> @@ -354,9 +364,6 @@ hvs_trans_attach(struct socket *so, int proto, struct
> thread *td)  {
> struct hvs_pcb *pcb = so2hvspcb(so);
> 
> -   if (vm_guest != VM_GUEST_HV)
> -   return (ESOCKTNOSUPPORT);
> -
> HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
> "%s: HyperV Socket hvs_trans_attach called\n", __func__);
> 
> @@ -383,9 +390,6 @@ hvs_trans_detach(struct socket *so)  {
> struct hvs_pcb *pcb;
> 
> -   if (vm_guest != VM_GUEST_HV)
> -   return;
> -
> HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
> "%s: HyperV Socket hvs_trans_detach called\n", __func__);
> 
> @@ -595,9 

Re: svn commit: r361721 - head/contrib/ipfilter/man

2020-06-02 Thread Cy Schubert
In message <202006021419.052ejopl017...@gndrsh.dnsmgr.net>, "Rodney W. 
Grimes"
writes:
> > Author: cy
> > Date: Tue Jun  2 03:44:22 2020
> > New Revision: 361721
> > URL: https://svnweb.freebsd.org/changeset/base/361721
> > 
> > Log:
> >   Per-rule hit counts (-h) can be used with either -i (input) or -o (output
> )
> >   filter rule lists.
>
> This change does not make that explicitly apparent, as it simply
> removes that -h -i is valid, but that means -h [-i|-o] is implicit.

The man page and corresponding verification options needs some work. For 
instance -n also doesn't mean anything without either -i and/or -o. ipfstat 
needs the same love that's been shown to ippool. Noted and on my todo list.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  https://FreeBSD.org
NTP:   Web:  https://nwtime.org

The need of the many outweighs the greed of the few.


___
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: r361721 - head/contrib/ipfilter/man

2020-06-02 Thread Rodney W. Grimes
> Author: cy
> Date: Tue Jun  2 03:44:22 2020
> New Revision: 361721
> URL: https://svnweb.freebsd.org/changeset/base/361721
> 
> Log:
>   Per-rule hit counts (-h) can be used with either -i (input) or -o (output)
>   filter rule lists.

This change does not make that explicitly apparent, as it simply
removes that -h -i is valid, but that means -h [-i|-o] is implicit.

>   
>   MFC after:  3 days
> 
> Modified:
>   head/contrib/ipfilter/man/ipfstat.8
> 
> Modified: head/contrib/ipfilter/man/ipfstat.8
> ==
> --- head/contrib/ipfilter/man/ipfstat.8   Tue Jun  2 02:38:54 2020
> (r361720)
> +++ head/contrib/ipfilter/man/ipfstat.8   Tue Jun  2 03:44:22 2020
> (r361721)
> @@ -69,8 +69,7 @@ the kernel) if any is present.
>  Show groups currently configured (both active and inactive).
>  .TP
>  .B \-h
> -Show per-rule the number of times each one scores a "hit".  For use in
> -combination with \fB\-i\fP.
> +Show per-rule the number of times each one scores a "hit".

+ For use in combination with \fB-i\fP or \fB-o\P.

Also which does -h list by default if neither -i or -o is given?
Is that even valid?

>  .TP
>  .B \-i
>  Display the filter list used for the input side of the kernel IP processing.
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r361723 - head/sys/compat/linuxkpi/common/include/linux

2020-06-02 Thread Emmanuel Vadot
On Tue, 2 Jun 2020 14:48:26 +0200
Hans Petter Selasky  wrote:

> On 2020-06-02 14:33, Emmanuel Vadot wrote:
> > On Tue, 2 Jun 2020 14:23:27 +0200
> > Hans Petter Selasky  wrote:
> > 
> >> On 2020-06-02 14:01, Hans Petter Selasky wrote:
> >>> Hi,
> >>>
> >>> I'll compile test DRM and add the missing is const expression macro and
> >>> bump the FreeBSD version.
> >>>
> >>> Sorry for the breakage.
> >>>
> >>> --HPS
> >>
> >> Bjoern,
> >>
> >> Small things like this are usually fine.
> >>
> >> It is important to not have too many local patches, as in this case with
> >> drm-devel-kmod ...
> >>
> >> Heads up Manu: extensible array support xarray.h will soon be ready for
> >> upstreaming!
> > 
> >   Oh ! Good, that's something that I wanted to do at one point.
> >   Could you opened a review so I can prepare patches for drm-kmod before
> > it lands ?
> > 
> >> Here you go:
> >> https://svnweb.freebsd.org/changeset/base/361724
> > 
> 
> Hi,
> 
> If you can test/review this before Friday, would be great:
> 
> https://reviews.freebsd.org/D25101
> --HPS

 Will do, thanks.

-- 
Emmanuel Vadot  
___
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: r361723 - head/sys/compat/linuxkpi/common/include/linux

2020-06-02 Thread Hans Petter Selasky

On 2020-06-02 14:33, Emmanuel Vadot wrote:

On Tue, 2 Jun 2020 14:23:27 +0200
Hans Petter Selasky  wrote:


On 2020-06-02 14:01, Hans Petter Selasky wrote:

Hi,

I'll compile test DRM and add the missing is const expression macro and
bump the FreeBSD version.

Sorry for the breakage.

--HPS


Bjoern,

Small things like this are usually fine.

It is important to not have too many local patches, as in this case with
drm-devel-kmod ...

Heads up Manu: extensible array support xarray.h will soon be ready for
upstreaming!


  Oh ! Good, that's something that I wanted to do at one point.
  Could you opened a review so I can prepare patches for drm-kmod before
it lands ?


Here you go:
https://svnweb.freebsd.org/changeset/base/361724




Hi,

If you can test/review this before Friday, would be great:

https://reviews.freebsd.org/D25101
--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"


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

2020-06-02 Thread Emmanuel Vadot
On Tue, 2 Jun 2020 14:23:27 +0200
Hans Petter Selasky  wrote:

> On 2020-06-02 14:01, Hans Petter Selasky wrote:
> > Hi,
> > 
> > I'll compile test DRM and add the missing is const expression macro and 
> > bump the FreeBSD version.
> > 
> > Sorry for the breakage.
> > 
> > --HPS
> 
> Bjoern,
> 
> Small things like this are usually fine.
> 
> It is important to not have too many local patches, as in this case with 
> drm-devel-kmod ...
> 
> Heads up Manu: extensible array support xarray.h will soon be ready for 
> upstreaming!

 Oh ! Good, that's something that I wanted to do at one point.
 Could you opened a review so I can prepare patches for drm-kmod before
it lands ?

> Here you go:
> https://svnweb.freebsd.org/changeset/base/361724

 Thanks !

> --HPS


-- 
Emmanuel Vadot  
___
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: r361723 - head/sys/compat/linuxkpi/common/include/linux

2020-06-02 Thread Hans Petter Selasky

On 2020-06-02 14:01, Hans Petter Selasky wrote:

Hi,

I'll compile test DRM and add the missing is const expression macro and 
bump the FreeBSD version.


Sorry for the breakage.

--HPS


Bjoern,

Small things like this are usually fine.

It is important to not have too many local patches, as in this case with 
drm-devel-kmod ...


Heads up Manu: extensible array support xarray.h will soon be ready for 
upstreaming!


Here you go:
https://svnweb.freebsd.org/changeset/base/361724

--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: r361724 - in head/sys: compat/linuxkpi/common/include/linux sys

2020-06-02 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Jun  2 12:23:04 2020
New Revision: 361724
URL: https://svnweb.freebsd.org/changeset/base/361724

Log:
  Implement __is_constexpr() function macro in the LinuxKPI.
  Bump the FreeBSD version.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h
  head/sys/sys/param.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Tue Jun  2 
10:19:45 2020(r361723)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Tue Jun  2 
12:23:04 2020(r361724)
@@ -561,4 +561,7 @@ linux_ratelimited(linux_ratelimit_t *rl)
((num) > __max) ? SIZE_MAX : (__size + sizeof((ptr)->field[0]) * 
(num)); \
 })
 
+#define__is_constexpr(x) \
+   __builtin_constant_p(x)
+
 #endif /* _LINUX_KERNEL_H_ */

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hTue Jun  2 10:19:45 2020(r361723)
+++ head/sys/sys/param.hTue Jun  2 12:23:04 2020(r361724)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300096  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300097  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r361723 - head/sys/compat/linuxkpi/common/include/linux

2020-06-02 Thread Hans Petter Selasky

Hi,

I'll compile test DRM and add the missing is const expression macro and 
bump the FreeBSD version.


Sorry for the breakage.

--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"


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

2020-06-02 Thread Emmanuel Vadot
On Tue, 02 Jun 2020 11:31:58 +
"Bjoern A. Zeeb"  wrote:

> On 2 Jun 2020, at 10:36, Emmanuel Vadot wrote:
> 
> >  Hello Hans,
> >
> > On Tue, 2 Jun 2020 10:19:45 + (UTC)
> > Hans Petter Selasky  wrote:
> >
> >> Author: hselasky
> >> Date: Tue Jun  2 10:19:45 2020
> >> New Revision: 361723
> >> URL: https://svnweb.freebsd.org/changeset/base/361723
> >>
> >> Log:
> >>   Implement struct_size() function macro in the LinuxKPI.
> >>
> >>   MFC after:   1 week
> >>   Sponsored by:Mellanox Technologies
> >>
> >> Modified:
> >>   head/sys/compat/linuxkpi/common/include/linux/kernel.h
> >>
> >> Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
> >> ==
> >> --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Jun  2 
> >> 09:45:43 2020  (r361722)
> >> +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Jun  2 
> >> 10:19:45 2020  (r361723)
> >> @@ -555,4 +555,10 @@ linux_ratelimited(linux_ratelimit_t *rl)
> >>return (ppsratecheck(>lasttime, >counter, 1));
> >>  }
> >>
> >> +#define   struct_size(ptr, field, num) ({ \
> >> +  const size_t __size = offsetof(__typeof(*(ptr)), field); \
> >> +  const size_t __max = (SIZE_MAX - __size) / sizeof((ptr)->field[0]); 
> >> \
> >> +  ((num) > __max) ? SIZE_MAX : (__size + sizeof((ptr)->field[0]) * 
> >> (num)); \
> >> +})
> >> +
> >>  #endif/* _LINUX_KERNEL_H_ */
> >
> >  Can you bump FreeBSD_version so I can fix
> > https://github.com/freebsd/drm-kmod/ and update the
> > graphics/drm-devel-kmod port please ?
> 
> I almost wonder if we want a ?linuxkkpi version? to check instead.
> If there?s a lot more ?work? on the linuxkpi we might not want to 
> bump __FreeBSD_version for every change which can conflict/affect 
> external code?
> 
> /bz
> 

 There is a LINUXKPI_VERSION but that's for Linux version compliance.
It's not easy to add a linuxkpi_version like freebsd_version because
you cannot check it in the port makefile. But that might help when
mfc'ing linuxkpi stuff.
 FreeBSD_version is cheap enough to bump.

-- 
Emmanuel Vadot  
___
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: r361723 - head/sys/compat/linuxkpi/common/include/linux

2020-06-02 Thread Bjoern A. Zeeb

On 2 Jun 2020, at 10:36, Emmanuel Vadot wrote:


 Hello Hans,

On Tue, 2 Jun 2020 10:19:45 + (UTC)
Hans Petter Selasky  wrote:


Author: hselasky
Date: Tue Jun  2 10:19:45 2020
New Revision: 361723
URL: https://svnweb.freebsd.org/changeset/base/361723

Log:
  Implement struct_size() function macro in the LinuxKPI.

  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h	Tue Jun  2 
09:45:43 2020	(r361722)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h	Tue Jun  2 
10:19:45 2020	(r361723)

@@ -555,4 +555,10 @@ linux_ratelimited(linux_ratelimit_t *rl)
return (ppsratecheck(>lasttime, >counter, 1));
 }

+#definestruct_size(ptr, field, num) ({ \
+   const size_t __size = offsetof(__typeof(*(ptr)), field); \
+	const size_t __max = (SIZE_MAX - __size) / sizeof((ptr)->field[0]); 
\
+	((num) > __max) ? SIZE_MAX : (__size + sizeof((ptr)->field[0]) * 
(num)); \

+})
+
 #endif /* _LINUX_KERNEL_H_ */


 Can you bump FreeBSD_version so I can fix
https://github.com/freebsd/drm-kmod/ and update the
graphics/drm-devel-kmod port please ?


I almost wonder if we want a “linuxkkpi version” to check instead.
If there’s a lot more “work” on the linuxkpi we might not want to 
bump __FreeBSD_version for every change which can conflict/affect 
external code?


/bz

___
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: r361723 - head/sys/compat/linuxkpi/common/include/linux

2020-06-02 Thread Emmanuel Vadot


 Hello Hans,

On Tue, 2 Jun 2020 10:19:45 + (UTC)
Hans Petter Selasky  wrote:

> Author: hselasky
> Date: Tue Jun  2 10:19:45 2020
> New Revision: 361723
> URL: https://svnweb.freebsd.org/changeset/base/361723
> 
> Log:
>   Implement struct_size() function macro in the LinuxKPI.
>   
>   MFC after:  1 week
>   Sponsored by:   Mellanox Technologies
> 
> Modified:
>   head/sys/compat/linuxkpi/common/include/linux/kernel.h
> 
> Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
> ==
> --- head/sys/compat/linuxkpi/common/include/linux/kernel.hTue Jun  2 
> 09:45:43 2020(r361722)
> +++ head/sys/compat/linuxkpi/common/include/linux/kernel.hTue Jun  2 
> 10:19:45 2020(r361723)
> @@ -555,4 +555,10 @@ linux_ratelimited(linux_ratelimit_t *rl)
>   return (ppsratecheck(>lasttime, >counter, 1));
>  }
>  
> +#define  struct_size(ptr, field, num) ({ \
> + const size_t __size = offsetof(__typeof(*(ptr)), field); \
> + const size_t __max = (SIZE_MAX - __size) / sizeof((ptr)->field[0]); \
> + ((num) > __max) ? SIZE_MAX : (__size + sizeof((ptr)->field[0]) * 
> (num)); \
> +})
> +
>  #endif   /* _LINUX_KERNEL_H_ */

 Can you bump FreeBSD_version so I can fix
https://github.com/freebsd/drm-kmod/ and update the
graphics/drm-devel-kmod port please ?

-- 
Emmanuel Vadot  
___
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: r361722 - head/sys/compat/linuxkpi/common/include/linux

2020-06-02 Thread Emmanuel Vadot


 Hello Hans,

On Tue, 2 Jun 2020 09:45:44 + (UTC)
Hans Petter Selasky  wrote:

> Author: hselasky
> Date: Tue Jun  2 09:45:43 2020
> New Revision: 361722
> URL: https://svnweb.freebsd.org/changeset/base/361722
> 
> Log:
>   Implement BUILD_BUG_ON_ZERO() in the LinuxKPI.
>   Tested using gcc and clang.
>   
>   MFC after:  1 week
>   Sponsored by:   Mellanox Technologies
> 
> Modified:
>   head/sys/compat/linuxkpi/common/include/linux/kernel.h
> 
> Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
> ==
> --- head/sys/compat/linuxkpi/common/include/linux/kernel.hTue Jun  2 
> 03:44:22 2020(r361721)
> +++ head/sys/compat/linuxkpi/common/include/linux/kernel.hTue Jun  2 
> 09:45:43 2020(r361722)
> @@ -94,6 +94,9 @@
>  #define  BUILD_BUG_ON_NOT_POWER_OF_2(x)  BUILD_BUG_ON(!powerof2(x))
>  #define  BUILD_BUG_ON_INVALID(expr)  while (0) { (void)(expr); }
>  
> +extern const volatile int lkpi_build_bug_on_zero;
> +#define  BUILD_BUG_ON_ZERO(x)((x) ? lkpi_build_bug_on_zero : 0)
> +
>  #define  BUG()   panic("BUG at %s:%d", __FILE__, 
> __LINE__)
>  #define  BUG_ON(cond)do {\
>   if (cond) { \

 That doesn't work for drm-kmod.
 One example of error :
--- intel_display.o ---
/usr/home/manu/Work/freebsd/drm-kmod/drivers/gpu/drm/i915/intel_display.c:14804:38:
 error: implicit declaration of function '__is_constexpr' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
val = (val & ~PANEL_UNLOCK_MASK) | PANEL_UNLOCK_REGS;
   ^
/usr/home/manu/Work/freebsd/drm-kmod/drivers/gpu/drm/i915/i915_reg.h:4770:29: 
note: expanded from macro 'PANEL_UNLOCK_REGS'
#define  PANEL_UNLOCK_REGS  REG_FIELD_PREP(PANEL_UNLOCK_MASK, 
0xabcd)
^
/usr/home/manu/Work/freebsd/drm-kmod/drivers/gpu/drm/i915/i915_reg.h:164:28: 
note: expanded from macro 'REG_FIELD_PREP'
   BUILD_BUG_ON_ZERO(!__is_constexpr(__mask)) + \
  ^
/usr/home/manu/Work/freebsd/drm-kmod/drivers/gpu/drm/i915/intel_display.c:14804:38:
 error: '__builtin_choose_expr' requires a constant expression
val = (val & ~PANEL_UNLOCK_MASK) | PANEL_UNLOCK_REGS;
   ^
/usr/home/manu/Work/freebsd/drm-kmod/drivers/gpu/drm/i915/i915_reg.h:4770:29: 
note: expanded from macro 'PANEL_UNLOCK_REGS'
#define  PANEL_UNLOCK_REGS  REG_FIELD_PREP(PANEL_UNLOCK_MASK, 
0xabcd)

^
/usr/home/manu/Work/freebsd/drm-kmod/drivers/gpu/drm/i915/i915_reg.h:167:49: 
note: expanded from macro 'REG_FIELD_PREP'
   BUILD_BUG_ON_ZERO(__builtin_choose_expr(__is_constexpr(__val), 
(~((__mask) >> __bf_shf(__mask)) & (__val)), 0
   
^~~
/home/manu/Work/freebsd/freebsd-svn/base/head/sys//compat/linuxkpi/common/include/linux/kernel.h:98:32:
 note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(x)((x) ? lkpi_build_bug_on_zero : 0)
  ^
11 errors generated.
*** [intel_display.o] Error code 1


 Step to reproduce: 

 git clone https://github.com/freebsd/drm-kmod.git
 edit drivers/gpu/drm/i915/i915_drv.h to remove the dummy 
BUILD_BUG_ON_ZERO macro.
 make -C i915

-- 
Emmanuel Vadot  
___
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: r361723 - head/sys/compat/linuxkpi/common/include/linux

2020-06-02 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Jun  2 10:19:45 2020
New Revision: 361723
URL: https://svnweb.freebsd.org/changeset/base/361723

Log:
  Implement struct_size() function macro in the LinuxKPI.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Tue Jun  2 
09:45:43 2020(r361722)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Tue Jun  2 
10:19:45 2020(r361723)
@@ -555,4 +555,10 @@ linux_ratelimited(linux_ratelimit_t *rl)
return (ppsratecheck(>lasttime, >counter, 1));
 }
 
+#definestruct_size(ptr, field, num) ({ \
+   const size_t __size = offsetof(__typeof(*(ptr)), field); \
+   const size_t __max = (SIZE_MAX - __size) / sizeof((ptr)->field[0]); \
+   ((num) > __max) ? SIZE_MAX : (__size + sizeof((ptr)->field[0]) * 
(num)); \
+})
+
 #endif /* _LINUX_KERNEL_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: r361722 - head/sys/compat/linuxkpi/common/include/linux

2020-06-02 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Jun  2 09:45:43 2020
New Revision: 361722
URL: https://svnweb.freebsd.org/changeset/base/361722

Log:
  Implement BUILD_BUG_ON_ZERO() in the LinuxKPI.
  Tested using gcc and clang.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Tue Jun  2 
03:44:22 2020(r361721)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Tue Jun  2 
09:45:43 2020(r361722)
@@ -94,6 +94,9 @@
 #defineBUILD_BUG_ON_NOT_POWER_OF_2(x)  BUILD_BUG_ON(!powerof2(x))
 #defineBUILD_BUG_ON_INVALID(expr)  while (0) { (void)(expr); }
 
+extern const volatile int lkpi_build_bug_on_zero;
+#defineBUILD_BUG_ON_ZERO(x)((x) ? lkpi_build_bug_on_zero : 0)
+
 #defineBUG()   panic("BUG at %s:%d", __FILE__, 
__LINE__)
 #defineBUG_ON(cond)do {\
if (cond) { \
___
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"