svn commit: r367917 - head/sys/dev/cxgbe

2020-11-20 Thread Navdeep Parhar
Author: np
Date: Sat Nov 21 03:27:32 2020
New Revision: 367917
URL: https://svnweb.freebsd.org/changeset/base/367917

Log:
  cxgbe(4): Catch up with in-flight netmap rx before destroying queues.
  
  The netmap application using the driver is responsible for replenishing
  the receive freelists and they may be totally depleted when the
  application exits.  Packets in flight, if any, might block the pipeline
  in case there aren't enough buffers left in the freelist.  Avoid this by
  filling up the freelists with a driver allocated buffer.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/t4_netmap.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hSat Nov 21 00:53:31 2020
(r367916)
+++ head/sys/dev/cxgbe/adapter.hSat Nov 21 03:27:32 2020
(r367917)
@@ -749,6 +749,9 @@ struct sge_nm_rxq {
bus_dma_tag_t fl_desc_tag;
bus_dmamap_t fl_desc_map;
bus_addr_t fl_ba;
+
+   void *bb;   /* bit bucket for packets with nowhere to go. */
+   uma_zone_t bb_zone;
 };
 
 #define INVALID_NM_TXQ_CNTXT_ID ((u_int)(-1))

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Sat Nov 21 00:53:31 2020
(r367916)
+++ head/sys/dev/cxgbe/t4_netmap.c  Sat Nov 21 03:27:32 2020
(r367917)
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -586,6 +588,8 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi
 
alloc_nm_rxq_hwq(vi, nm_rxq, tnl_cong(vi->pi, nm_cong_drop));
nm_rxq->fl_hwidx = hwidx;
+   nm_rxq->bb_zone = rxb->zone;
+   nm_rxq->bb = uma_zalloc(nm_rxq->bb_zone, M_WAITOK);
slot = netmap_reset(na, NR_RX, i, 0);
MPASS(slot != NULL);/* XXXNM: error check, not assert */
 
@@ -628,6 +632,31 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi
return (cxgbe_netmap_rss(sc, vi, ifp, na));
 }
 
+static void
+flush_nm_rxq(struct adapter *sc, struct vi_info *vi, struct sge_nm_rxq *nm_rxq)
+{
+   int i, n;
+   u_int fl_pidx, fl_pidx_target, hw_cidx_desc;
+   const uint64_t ba = pmap_kextract((vm_offset_t)nm_rxq->bb);
+
+   hw_cidx_desc = nm_rxq->fl_cidx / 8;
+   if (hw_cidx_desc == 0)
+   fl_pidx_target = nm_rxq->fl_sidx2 - 8;
+   else
+   fl_pidx_target = (hw_cidx_desc - 1) * 8;
+   MPASS((fl_pidx_target & 7) == 0);
+
+   fl_pidx = nm_rxq->fl_pidx;
+   MPASS((fl_pidx & 7) == 0);
+   for (n = 0; fl_pidx != fl_pidx_target; n++) {
+   for (i = 0; i < 8; i++, fl_pidx++)
+   nm_rxq->fl_desc[fl_pidx] = htobe64(ba | 
nm_rxq->fl_hwidx);
+   if (__predict_false(fl_pidx == nm_rxq->fl_sidx2))
+   fl_pidx = 0;
+   }
+   t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(n));
+}
+
 static int
 cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp,
 struct netmap_adapter *na)
@@ -652,6 +681,23 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v
if (rc != 0)
return (rc);/* error message logged already. */
 
+   /*
+* First pass over the rx queues to make sure they're all caught up.
+*
+* The freelists could be out of buffers and we may need to arrange
+* things so that any packets still in flight (after TP's cong_drop
+* logic but not yet DMA'd) have somewhere to go and do not block the
+* pipeline.  Do this before trying to free any queue.
+*/
+   for_each_nm_rxq(vi, i, nm_rxq) {
+   nm_state = atomic_load_int(_rxq->nm_state);
+   kring = na->rx_rings[nm_rxq->nid];
+   if (nm_state == NM_OFF || !nm_kring_pending_off(kring))
+   continue;
+   MPASS(nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID);
+   flush_nm_rxq(sc, vi, nm_rxq);
+   }
+
for_each_nm_txq(vi, i, nm_txq) {
struct sge_qstat *spg = (void *)_txq->desc[nm_txq->sidx];
 
@@ -688,6 +734,8 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v
pause("nmst", 1);
 
free_nm_rxq_hwq(vi, nm_rxq);
+   uma_zfree(nm_rxq->bb_zone, nm_rxq->bb);
+   nm_rxq->bb = NULL;
 
/* XXX: netmap, not the driver, should do this. */
kring->rhead = kring->rcur = kring->nr_hwcur = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to 

svn commit: r367916 - head/sys/dev/siis

2020-11-20 Thread Alexander Motin
Author: mav
Date: Sat Nov 21 00:53:31 2020
New Revision: 367916
URL: https://svnweb.freebsd.org/changeset/base/367916

Log:
  Unlucky change...
  
  MFC after:3 days

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

Modified: head/sys/dev/siis/siis.c
==
--- head/sys/dev/siis/siis.cSat Nov 21 00:51:39 2020(r367915)
+++ head/sys/dev/siis/siis.cSat Nov 21 00:53:31 2020(r367916)
@@ -1725,7 +1725,7 @@ siis_setup_fis(device_t dev, struct siis_cmd *ctp, uni
fis[11] = ccb->ataio.cmd.features_exp;
fis[12] = ccb->ataio.cmd.sector_count;
if (ccb->ataio.cmd.flags & CAM_ATAIO_FPDMA) {
-   fis[12] &= 0x03;
+   fis[12] &= 0x07;
fis[12] |= tag << 3;
}
fis[13] = ccb->ataio.cmd.sector_count_exp;
___
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: r367915 - in head/sys/dev: ahci siis

2020-11-20 Thread Alexander Motin
Author: mav
Date: Sat Nov 21 00:51:39 2020
New Revision: 367915
URL: https://svnweb.freebsd.org/changeset/base/367915

Log:
  Fix stupid math mistake in r366922.
  
  MFC after:3 days

Modified:
  head/sys/dev/ahci/ahci.c
  head/sys/dev/siis/siis.c

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cSat Nov 21 00:40:59 2020(r367914)
+++ head/sys/dev/ahci/ahci.cSat Nov 21 00:51:39 2020(r367915)
@@ -2580,7 +2580,7 @@ ahci_setup_fis(struct ahci_channel *ch, struct ahci_cm
fis[11] = ccb->ataio.cmd.features_exp;
fis[12] = ccb->ataio.cmd.sector_count;
if (ccb->ataio.cmd.flags & CAM_ATAIO_FPDMA) {
-   fis[12] &= 0xf8;
+   fis[12] &= 0x07;
fis[12] |= tag << 3;
}
fis[13] = ccb->ataio.cmd.sector_count_exp;

Modified: head/sys/dev/siis/siis.c
==
--- head/sys/dev/siis/siis.cSat Nov 21 00:40:59 2020(r367914)
+++ head/sys/dev/siis/siis.cSat Nov 21 00:51:39 2020(r367915)
@@ -1725,7 +1725,7 @@ siis_setup_fis(device_t dev, struct siis_cmd *ctp, uni
fis[11] = ccb->ataio.cmd.features_exp;
fis[12] = ccb->ataio.cmd.sector_count;
if (ccb->ataio.cmd.flags & CAM_ATAIO_FPDMA) {
-   fis[12] &= 0xf8;
+   fis[12] &= 0x03;
fis[12] |= tag << 3;
}
fis[13] = ccb->ataio.cmd.sector_count_exp;
___
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: r367913 - head/sbin/mount_nfs

2020-11-20 Thread Rick Macklem
Author: rmacklem
Date: Fri Nov 20 22:29:38 2020
New Revision: 367913
URL: https://svnweb.freebsd.org/changeset/base/367913

Log:
  Document the new "tls" NFS mount option.
  
  Recent commits to head have added support for NFS over TLS
  to the FreeBSD kernel.
  To enable use of this for an NFS mount, the "tls" mount_nfs
  option has been added.
  
  Once the IETF has assigned an RFC number, I will replace ""
  with the number.
  
  This is a content change.
  
  Reviewed by:  gbe
  Differential Revision:https://reviews.freebsd.org/D26262

Modified:
  head/sbin/mount_nfs/mount_nfs.8

Modified: head/sbin/mount_nfs/mount_nfs.8
==
--- head/sbin/mount_nfs/mount_nfs.8 Fri Nov 20 22:14:51 2020
(r367912)
+++ head/sbin/mount_nfs/mount_nfs.8 Fri Nov 20 22:29:38 2020
(r367913)
@@ -28,7 +28,7 @@
 .\"@(#)mount_nfs.8 8.3 (Berkeley) 3/29/95
 .\" $FreeBSD$
 .\"
-.Dd December 14, 2019
+.Dd November 20, 2020
 .Dt MOUNT_NFS 8
 .Os
 .Sh NAME
@@ -403,6 +403,12 @@ interval.)
 .It Cm timeo Ns = Ns Aq Ar value
 Alias for
 .Cm timeout .
+.It Cm tls
+This option specifies that the connection to the server must use TLS
+per RFC .
+TLS is only supported for TCP connections and the
+.Xr rpc.tlsclntd 8
+daemon must be running for an NFS over TCP connection to use TLS.
 .It Cm udp
 Use UDP transport.
 .It Cm vers Ns = Ns Aq Ar vers_number
@@ -537,6 +543,7 @@ Same as
 .Xr mount 8 ,
 .Xr nfsd 8 ,
 .Xr nfsiod 8 ,
+.Xr rpc.tlsclntd 8 ,
 .Xr showmount 8
 .Sh HISTORY
 A version of the
___
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: r367912 - head/usr.sbin/mountd

2020-11-20 Thread Rick Macklem
Author: rmacklem
Date: Fri Nov 20 22:14:51 2020
New Revision: 367912
URL: https://svnweb.freebsd.org/changeset/base/367912

Log:
  Update man page for new TLS export options.
  
  NFS over TLS uses three new export options, added by r364979.
  This patch updates the exports.5 man page for these new options.
  Once assigned by IETF, "" will be replaced with the RFC number.
  
  This is a content change.
  
  Reviewed by:  gbe
  Differential Revision:https://review.freebsd.org/D26241

Modified:
  head/usr.sbin/mountd/exports.5

Modified: head/usr.sbin/mountd/exports.5
==
--- head/usr.sbin/mountd/exports.5  Fri Nov 20 20:22:01 2020
(r367911)
+++ head/usr.sbin/mountd/exports.5  Fri Nov 20 22:14:51 2020
(r367912)
@@ -28,7 +28,7 @@
 .\" @(#)exports.5  8.3 (Berkeley) 3/29/95
 .\" $FreeBSD$
 .\"
-.Dd February 11, 2019
+.Dd November 20, 2020
 .Dt EXPORTS 5
 .Os
 .Sh NAME
@@ -117,9 +117,13 @@ exported to the host set.
 The option flags specify whether the file system
 is exported read-only or read-write and how the client UID is mapped to
 user credentials on the server.
-For the NFSv4 tree root, the only option that can be specified in this
-section is
-.Fl sec .
+For the NFSv4 tree root, the only options that can be specified in this
+section are ones related to security:
+.Fl sec ,
+.Fl tls ,
+.Fl tlscert
+and
+.Fl tlscertuser .
 .Pp
 Export options are specified as follows:
 .Pp
@@ -241,6 +245,48 @@ or
 .Fl webnfs
 flags.
 .Pp
+The
+.Fl tls ,
+.Fl tlscert
+and
+.Fl tlscertuser
+export options are used to require the client to use TLS for the mount(s)
+per RFC .
+For NFS mounts using TLS to work,
+.Xr rpc.tlsservd 8
+must be running on the server.
+.Bd -filled -offset indent
+.Fl tls
+requires that the client use TLS.
+.br
+.Fl tlscert
+requires that the client use TLS and provide a verifiable X.509 certificate
+during TLS handshake.
+.br
+.Fl tlscertuser
+requires that the client use TLS and provide a verifiable X.509 certificate.
+The otherName component of the certificate's subjAltName must have a
+an OID of 1.3.6.1.4.1.2238.1.1.1 and a UTF8 string of the form
+.Dq user@domain .
+.Dq user@domain
+will be translated to the credentials of the specified user in the same
+manner as
+.Xr nfsuserd 8 ,
+where
+.Dq user
+is normally a username is the server's password database and
+.Dq domain
+is the DNS domain name for the server.
+All RPCs will be performed using these credentials instead of the
+ones in the RPC header in a manner similar to
+.Sm off
+.Fl mapall Li = Sy user .
+.Sm on
+.Ed
+.Pp
+If none of these three flags are specified, TLS mounts are permitted but
+not required.
+.Pp
 Specifying the
 .Fl quiet
 option will inhibit some of the syslog diagnostics for bad lines in
@@ -541,7 +587,15 @@ afterwards, whereas NFSv3 rejects the mount request.
 .Xr netgroup 5 ,
 .Xr mountd 8 ,
 .Xr nfsd 8 ,
+.Xr rpc.tlsservd 8 ,
 .Xr showmount 8
+.Sh STANDARDS
+The implementation is based on the specification in
+.Rs
+.%T "Network File System Protocol Specification, Appendix A, RFC 1094"
+.%T "NFS: Network File System Version 3, Appendix I, RFC 1813"
+.%T "Towards Remote Procedure Call Encryption By Default, RFC "
+.Re
 .Sh BUGS
 The export options are tied to the local mount points in the kernel and
 must be non-contradictory for any exported subdirectory of the local
___
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: r367911 - head/sys/kern

2020-11-20 Thread Kirk McKusick
Author: mckusick
Date: Fri Nov 20 20:22:01 2020
New Revision: 367911
URL: https://svnweb.freebsd.org/changeset/base/367911

Log:
  Only attempt a VOP_UNLOCK() when the vn_lock() has been successful.
  
  No MFC as this code is not present in 12-stable.
  
  Reported by:  Peter Holm
  Reviewed by:  Mateusz Guzik
  Tested by:Peter Holm
  Sponsored by: Netflix

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Fri Nov 20 20:11:59 2020(r367910)
+++ head/sys/kern/vfs_vnops.c   Fri Nov 20 20:22:01 2020(r367911)
@@ -3007,8 +3007,8 @@ vn_write_outvp(struct vnode *outvp, char *dat, off_t o
curthread->td_ucred, cred, NULL, curthread);
outoff += xfer2;
xfer -= xfer2;
+   VOP_UNLOCK(outvp);
}
-   VOP_UNLOCK(outvp);
}
if (mp != NULL)
vn_finished_write(mp);
___
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: r367910 - in head: . share/man/man7

2020-11-20 Thread Bryan Drewery
Author: bdrewery
Date: Fri Nov 20 20:11:59 2020
New Revision: 367910
URL: https://svnweb.freebsd.org/changeset/base/367910

Log:
  Add lists for customizing legacy and bootstrap-tools.
  
  Reviewed by:  arichardson
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D27200

Modified:
  head/Makefile.inc1
  head/share/man/man7/build.7

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri Nov 20 19:36:34 2020(r367909)
+++ head/Makefile.inc1  Fri Nov 20 20:11:59 2020(r367910)
@@ -20,8 +20,12 @@
 #  LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
 #  LOCAL_MTREE="list of mtree files" to process to allow local directories
 #  to be created before files are installed
+#  LOCAL_LEGACY_DIRS="list of dirs" to add additional dirs to the legacy
+#  target
+#  LOCAL_BSTOOL_DIRS="list of dirs" to add additional dirs to the
+#  bootstrap-tools target
 #  LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
-#  list
+#  target
 #  LOCAL_XTOOL_DIRS="list of dirs" to add additional dirs to the
 #  cross-tools target
 #  METALOG="path to metadata log" to write permission and ownership
@@ -2127,7 +2131,9 @@ legacy: .PHONY
false
 .endif
 
-.for _tool in tools/build
+.for _tool in \
+  tools/build \
+  ${LOCAL_LEGACY_DIRS}
${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \
cd ${.CURDIR}/${_tool}; \
if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \
@@ -2458,7 +2464,8 @@ bootstrap-tools: ${_bt}-links .PHONY
 ${_crunchgen} \
 ${_nmtree} \
 ${_vtfontcvt} \
-${_localedef}
+${_localedef} \
+${LOCAL_BSTOOL_DIRS}
 ${_bt}-${_tool}: ${_bt}-links .PHONY .MAKE
${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \
cd ${.CURDIR}/${_tool}; \

Modified: head/share/man/man7/build.7
==
--- head/share/man/man7/build.7 Fri Nov 20 19:36:34 2020(r367909)
+++ head/share/man/man7/build.7 Fri Nov 20 20:11:59 2020(r367910)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 3, 2020
+.Dd November 12, 2020
 .Dt BUILD 7
 .Os
 .Sh NAME
@@ -571,6 +571,16 @@ may also be used as needed elsewhere within the list.
 If set, this variable supplies a list of additional mtrees relative to the
 root of the source tree to use as part of the
 .Cm hierarchy
+target.
+.It Va LOCAL_LEGACY_DIRS
+If set, this variable supplies a list of additional directories relative to
+the root of the source tree to build as part of the
+.Cm legacy
+target.
+.It Va LOCAL_BSTOOL_DIRS
+If set, this variable supplies a list of additional directories relative to
+the root of the source tree to build as part of the
+.Cm bootstrap-tools
 target.
 .It Va LOCAL_TOOL_DIRS
 If set, this variable supplies a list of additional directories relative to
___
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: r367909 - head/sys/dev/isp

2020-11-20 Thread Alexander Motin
Author: mav
Date: Fri Nov 20 19:36:34 2020
New Revision: 367909
URL: https://svnweb.freebsd.org/changeset/base/367909

Log:
  Increase queue depths from 1024/256 to 8192/1024 IOCBs.
  
  Qlogic chips store S/G lists in the same queue as requests themselves.  In
  the worst case 1MB I/O may require up to 52 IOCBs, that means queue of 1024
  IOCBs can store only 19 of such requests.  The increase reduces chances of
  overflow, while we should be able to afford additional 512KB of RAM per HBA.
  The Linux driver uses comparable numbers.
  
  While there, decouple ATIO queue size from response queue size.  There is
  no reason for them to be equal.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.h
  head/sys/dev/isp/isp_pci.c
  head/sys/dev/isp/isp_target.c
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Fri Nov 20 18:52:37 2020(r367908)
+++ head/sys/dev/isp/isp.c  Fri Nov 20 19:36:34 2020(r367909)
@@ -98,7 +98,7 @@ static const uint8_t alpa_map[] = {
 /*
  * Local function prototypes.
  */
-static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t 
*);
+static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t 
*, uint16_t);
 static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, 
uint32_t *);
 static void isp_clear_portdb(ispsoftc_t *, int);
 static void isp_mark_portdb(ispsoftc_t *, int);
@@ -912,7 +912,7 @@ isp_init(ispsoftc_t *isp)
 
 #ifdef ISP_TARGET_MODE
/* unconditionally set up the ATIO queue if we support target mode */
-   icbp->icb_atioqlen = RESULT_QUEUE_LEN(isp);
+   icbp->icb_atioqlen = ATIO_QUEUE_LEN(isp);
if (icbp->icb_atioqlen < 8) {
isp_prt(isp, ISP_LOGERR, "bad ATIO queue length %d", 
icbp->icb_atioqlen);
return;
@@ -3179,14 +3179,15 @@ isp_intr_atioq(ispsoftc_t *isp)
case RQSTYPE_ATIO:
case RQSTYPE_NOTIFY_ACK:/* Can be set to ATIO queue.*/
case RQSTYPE_ABTS_RCVD: /* Can be set to ATIO queue.*/
-   (void) isp_target_notify(isp, addr, );
+   (void) isp_target_notify(isp, addr, ,
+   ATIO_QUEUE_LEN(isp));
break;
case RQSTYPE_RPT_ID_ACQ:/* Can be set to ATIO queue.*/
default:
isp_print_qentry(isp, "?ATIOQ entry?", oop, addr);
break;
}
-   optr = ISP_NXT_QENTRY(oop, RESULT_QUEUE_LEN(isp));
+   optr = ISP_NXT_QENTRY(oop, ATIO_QUEUE_LEN(isp));
}
if (isp->isp_atioodx != optr) {
ISP_WRITE(isp, BIU2400_ATIO_RSPOUTP, optr);
@@ -3287,7 +3288,8 @@ isp_intr_respq(ispsoftc_t *isp)
}
ISP_MEMZERO(hp, QENTRY_LEN);/* PERF */
continue;
-   } else if (isp_handle_other_response(isp, etype, hp, )) {
+   } else if (isp_handle_other_response(isp, etype, hp,
+   , RESULT_QUEUE_LEN(isp))) {
/* More then one IOCB could be consumed. */
while (sptr != cptr) {
ISP_MEMZERO(hp, QENTRY_LEN);/* PERF */
@@ -3729,7 +3731,7 @@ isp_intr_async(ispsoftc_t *isp, uint16_t mbox)
  */
 
 static int
-isp_handle_other_response(ispsoftc_t *isp, int type, isphdr_t *hp, uint32_t 
*optrp)
+isp_handle_other_response(ispsoftc_t *isp, int type, isphdr_t *hp, uint32_t 
*optrp, uint16_t ql)
 {
isp_ridacq_t rid;
int chan, c;
@@ -3794,7 +3796,7 @@ isp_handle_other_response(ispsoftc_t *isp, int type, i
case RQSTYPE_ABTS_RCVD: /* Can be set to ATIO queue. */
case RQSTYPE_ABTS_RSP:
 #ifdef ISP_TARGET_MODE
-   return (isp_target_notify(isp, hp, optrp));
+   return (isp_target_notify(isp, hp, optrp, ql));
 #endif
/* FALLTHROUGH */
default:

Modified: head/sys/dev/isp/isp_freebsd.h
==
--- head/sys/dev/isp/isp_freebsd.h  Fri Nov 20 18:52:37 2020
(r367908)
+++ head/sys/dev/isp/isp_freebsd.h  Fri Nov 20 19:36:34 2020
(r367909)
@@ -349,8 +349,6 @@ struct isposinfo {
 #defineGET_NANOSEC(x)  ((x)->tv_sec * 10 + 
(x)->tv_nsec)
 #defineNANOTIME_SUBisp_nanotime_sub
 
-#defineMAXISPREQUEST(isp)  1024
-
 #defineMEMORYBARRIER(isp, type, offset, size, chan)\
 switch (type) {\
 case SYNC_REQUEST: \

Modified: head/sys/dev/isp/isp_pci.c
==
--- 

svn commit: r367908 - head/sys/powerpc/powerpc

2020-11-20 Thread Alfredo Dal'Ava Junior
Author: alfredo
Date: Fri Nov 20 18:52:37 2020
New Revision: 367908
URL: https://svnweb.freebsd.org/changeset/base/367908

Log:
  [POWERPC] print uprintf_signal 'type' field in hex
  
  Print 'type' field in hex to improve readability
  
  Reviewed by:  jhibbits
  Differential Revision:https://reviews.freebsd.org/D27294

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

Modified: head/sys/powerpc/powerpc/trap.c
==
--- head/sys/powerpc/powerpc/trap.c Fri Nov 20 18:42:01 2020
(r367907)
+++ head/sys/powerpc/powerpc/trap.c Fri Nov 20 18:52:37 2020
(r367908)
@@ -503,7 +503,7 @@ trap(struct trapframe *frame)
ksi.ksi_addr = (void *)addr;
ksi.ksi_trapno = type;
if (uprintf_signal) {
-   uprintf("pid %d comm %s: signal %d code %d type %d "
+   uprintf("pid %d comm %s: signal %d code %d type 0x%x "
"addr 0x%lx r1 0x%lx srr0 0x%lx srr1 0x%lx\n",
p->p_pid, p->p_comm, sig, ucode, type,
(u_long)addr, (u_long)frame->fixreg[1],
___
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: r367907 - head

2020-11-20 Thread Alfredo Dal'Ava Junior
Author: alfredo
Date: Fri Nov 20 18:42:01 2020
New Revision: 367907
URL: https://svnweb.freebsd.org/changeset/base/367907

Log:
  [POWERPC64LE,POWEPCSPE] set default kernel config for powerpc64le and 
powerpcspe variants
  
  Default KERNCONF for powerpc64le should be GENERIC64, and powerpcspe should
  select MPC85XXSPE
  
  Reviewed by:  bdragon,emaste
  Sponsored by: Eldorado Research Institute (eldorado.org.br)
  Differential Revision:https://reviews.freebsd.org/D27257

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri Nov 20 18:02:04 2020(r367906)
+++ head/Makefile.inc1  Fri Nov 20 18:42:01 2020(r367907)
@@ -1591,6 +1591,10 @@ KERNCONF=${KERNFAST}
 .endif
 .if ${TARGET_ARCH} == "powerpc64"
 KERNCONF?= GENERIC64
+.elif ${TARGET_ARCH} == "powerpc64le"
+KERNCONF?= GENERIC64LE
+.elif ${TARGET_ARCH} == "powerpcspe"
+KERNCONF?= MPC85XXSPE
 .else
 KERNCONF?= GENERIC
 .endif
___
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: r367906 - head/sys/dev/isp

2020-11-20 Thread Alexander Motin
Author: mav
Date: Fri Nov 20 18:02:04 2020
New Revision: 367906
URL: https://svnweb.freebsd.org/changeset/base/367906

Log:
  Cleanup DMA handling.
  
   - Make isp_start() to set all the IOCB fields aside of S/G list, removing
  extra information from isp_send_cmd(), now only doing S/G lists and sending.
   - Turn DMA setup/free from being card and PCI-specific into OS-specific,
  instead add new card-specific method for isp_send_cmd().  Previously this
  function was a monster handling all the cards.
   - Remove double error code translation.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_freebsd.h
  head/sys/dev/isp/isp_library.c
  head/sys/dev/isp/isp_library.h
  head/sys/dev/isp/isp_pci.c
  head/sys/dev/isp/isp_target.c
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Fri Nov 20 17:26:02 2020(r367905)
+++ head/sys/dev/isp/isp.c  Fri Nov 20 18:02:04 2020(r367906)
@@ -2822,35 +2822,31 @@ isp_start(XS_T *xs)
goto start_again;
}
 
-   reqp->req_header.rqs_entry_count = 1;
-   reqp->req_header.rqs_entry_type = RQSTYPE_T7RQS;
-
/*
-* Set task attributes
-*/
-   if (XS_TAG_P(xs))
-   reqp->req_task_attribute = XS_TAG_TYPE(xs);
-   else
-   reqp->req_task_attribute = FCP_CMND_TASK_ATTR_SIMPLE;
-   reqp->req_task_attribute |= (XS_PRIORITY(xs) << FCP_CMND_PRIO_SHIFT) &
-FCP_CMND_PRIO_MASK;
-
-   /*
 * NB: we do not support long CDBs (yet)
 */
cdblen = XS_CDBLEN(xs);
-
if (cdblen > sizeof (reqp->req_cdb)) {
isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this 
chip", cdblen);
XS_SETERR(xs, HBA_REQINVAL);
return (CMD_COMPLETE);
}
 
+   reqp->req_header.rqs_entry_type = RQSTYPE_T7RQS;
+   reqp->req_header.rqs_entry_count = 1;
reqp->req_nphdl = lp->handle;
-   reqp->req_tidlo = lp->portid;
-   reqp->req_tidhi = lp->portid >> 16;
-   reqp->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs));
+   reqp->req_time = XS_TIME(xs);
be64enc(reqp->req_lun, CAM_EXTLUN_BYTE_SWIZZLE(XS_LUN(xs)));
+   if (XS_XFRIN(xs))
+   reqp->req_alen_datadir = FCP_CMND_DATA_READ;
+   else if (XS_XFROUT(xs))
+   reqp->req_alen_datadir = FCP_CMND_DATA_WRITE;
+   if (XS_TAG_P(xs))
+   reqp->req_task_attribute = XS_TAG_TYPE(xs);
+   else
+   reqp->req_task_attribute = FCP_CMND_TASK_ATTR_SIMPLE;
+   reqp->req_task_attribute |= (XS_PRIORITY(xs) << FCP_CMND_PRIO_SHIFT) &
+FCP_CMND_PRIO_MASK;
if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & 
PRLI_WD3_RETRY)) {
if (FCP_NEXT_CRN(isp, >req_crn, xs)) {
isp_prt(isp, ISP_LOG_WARN1,
@@ -2860,8 +2856,11 @@ isp_start(XS_T *xs)
return (CMD_EAGAIN);
}
}
-   reqp->req_time = XS_TIME(xs);
ISP_MEMCPY(reqp->req_cdb, XS_CDBP(xs), cdblen);
+   reqp->req_dl = XS_XFRLEN(xs);
+   reqp->req_tidlo = lp->portid;
+   reqp->req_tidhi = lp->portid >> 16;
+   reqp->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs));
 
/* Whew. Thankfully the same for type 7 requests */
reqp->req_handle = isp_allocate_handle(isp, xs, ISP_HANDLE_INITIATOR);
@@ -2878,7 +2877,7 @@ isp_start(XS_T *xs)
 * The callee is responsible for adding all requests at this point.
 */
dmaresult = ISP_DMASETUP(isp, xs, reqp);
-   if (dmaresult != CMD_QUEUED) {
+   if (dmaresult != 0) {
isp_destroy_handle(isp, reqp->req_handle);
/*
 * dmasetup sets actual error in packet, and
@@ -2887,7 +2886,7 @@ isp_start(XS_T *xs)
return (dmaresult);
}
isp_xs_prt(isp, xs, ISP_LOGDEBUG0, "START cmd cdb[0]=0x%x datalen %ld", 
XS_CDBP(xs)[0], (long) XS_XFRLEN(xs));
-   return (CMD_QUEUED);
+   return (0);
 }
 
 /*
@@ -3442,8 +3441,7 @@ isp_intr_respq(ispsoftc_t *isp)
isp_prt(isp, ISP_LOGDEBUG2, "asked for %lu got raw resid %lu 
settled for %lu",
(u_long)XS_XFRLEN(xs), (u_long)resid, 
(u_long)XS_GET_RESID(xs));
 
-   if (XS_XFRLEN(xs))
-   ISP_DMAFREE(isp, xs, sp->req_handle);
+   ISP_DMAFREE(isp, xs);
isp_destroy_handle(isp, sp->req_handle);
 
ISP_MEMZERO(hp, QENTRY_LEN);/* PERF */

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Fri Nov 20 17:26:02 2020
(r367905)
+++ head/sys/dev/isp/isp_freebsd.c  Fri Nov 20 18:02:04 2020
(r367906)
@@ -1270,7 +1270,7 @@ 

svn commit: r367905 - head/cddl/contrib/opensolaris/common/ctf

2020-11-20 Thread Jonathan T. Looney
Author: jtl
Date: Fri Nov 20 17:26:02 2020
New Revision: 367905
URL: https://svnweb.freebsd.org/changeset/base/367905

Log:
  When copying types from one CTF container to another, ensure that we
  encode 0-length (i.e. "") structure and union member names as offset 0.
  This ensures that we don't confuse other parts of the CTF code which
  expect this encoding.
  
  This resolves a Dtrace error resolving members of anonymous structs/unions
  within the (struct mbuf) type which some users were seeing after r366908.
  
  While here, update the code in ctf_add_generic() to encode 0-length type
  names as offset 0.
  
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D27246

Modified:
  head/cddl/contrib/opensolaris/common/ctf/ctf_create.c

Modified: head/cddl/contrib/opensolaris/common/ctf/ctf_create.c
==
--- head/cddl/contrib/opensolaris/common/ctf/ctf_create.c   Fri Nov 20 
17:13:13 2020(r367904)
+++ head/cddl/contrib/opensolaris/common/ctf/ctf_create.c   Fri Nov 20 
17:26:02 2020(r367905)
@@ -615,7 +615,7 @@ ctf_add_generic(ctf_file_t *fp, uint_t flag, const cha
if ((dtd = ctf_alloc(sizeof (ctf_dtdef_t))) == NULL)
return (ctf_set_errno(fp, EAGAIN));
 
-   if (name != NULL && (s = ctf_strdup(name)) == NULL) {
+   if (name != NULL && *name != '\0' && (s = ctf_strdup(name)) == NULL) {
ctf_free(dtd, sizeof (ctf_dtdef_t));
return (ctf_set_errno(fp, EAGAIN));
}
@@ -1217,7 +1217,7 @@ membadd(const char *name, ctf_id_t type, ulong_t offse
if ((dmd = ctf_alloc(sizeof (ctf_dmdef_t))) == NULL)
return (ctf_set_errno(ctb->ctb_file, EAGAIN));
 
-   if (name != NULL && (s = ctf_strdup(name)) == NULL) {
+   if (name != NULL && *name != '\0' && (s = ctf_strdup(name)) == NULL) {
ctf_free(dmd, sizeof (ctf_dmdef_t));
return (ctf_set_errno(ctb->ctb_file, EAGAIN));
}
___
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: r367904 - head/usr.sbin/wpa/hostapd

2020-11-20 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Fri Nov 20 17:13:13 2020
New Revision: 367904
URL: https://svnweb.freebsd.org/changeset/base/367904

Log:
  hostapd.conf(5): Add missing 'l'
  
  In r367901 I accidentally deleted the 'l' while fixing a few
  mandoc erros.
  
  Spotted by: Yuri Pankov

Modified:
  head/usr.sbin/wpa/hostapd/hostapd.conf.5

Modified: head/usr.sbin/wpa/hostapd/hostapd.conf.5
==
--- head/usr.sbin/wpa/hostapd/hostapd.conf.5Fri Nov 20 17:04:49 2020
(r367903)
+++ head/usr.sbin/wpa/hostapd/hostapd.conf.5Fri Nov 20 17:13:13 2020
(r367904)
@@ -68,7 +68,7 @@ Interface name.
 Should be set in
 .Dq hostap
 mode.
-Make certain that there are no spaces after the interface name, or hostapd wil
+Make certain that there are no spaces after the interface name, or hostapd will
 complain that the interface does not exist.
 .It Va debug
 Debugging mode: 0 = no, 1 = minimal, 2 = verbose, 3 = msg dumps, 4 =
___
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: r367903 - head/usr.sbin/moused

2020-11-20 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Fri Nov 20 17:04:49 2020
New Revision: 367903
URL: https://svnweb.freebsd.org/changeset/base/367903

Log:
  moused(8): Fix a few mandoc warnings
  
  - new sentence, new line

Modified:
  head/usr.sbin/moused/moused.8

Modified: head/usr.sbin/moused/moused.8
==
--- head/usr.sbin/moused/moused.8   Fri Nov 20 16:59:51 2020
(r367902)
+++ head/usr.sbin/moused/moused.8   Fri Nov 20 17:04:49 2020
(r367903)
@@ -147,7 +147,8 @@ is enabled, the
 option can be used to set the
 .Ar distance
 (in pixels) that the mouse must move before a scroll event
-is generated.  This effectively controls the scrolling speed.
+is generated.
+This effectively controls the scrolling speed.
 The default
 .Ar distance
 is 2 pixels.
@@ -240,20 +241,21 @@ drive the pointer quickly across the screen.
 The
 .Ar exp
 value specifies the exponent, which is basically
-the amount of acceleration.  Useful values are in the
-range 1.1 to 2.0, but it depends on your mouse hardware
-and your personal preference.  A value of 1.0 means no
-exponential acceleration.  A value of 2.0 means squared
-acceleration (i.e. if you move the mouse twice as fast,
-the pointer will move four times as fast on the screen).
+the amount of acceleration.
+Useful values are in the range 1.1 to 2.0, but it depends on
+your mouse hardware and your personal preference.
+A value of 1.0 means no exponential acceleration.
+A value of 2.0 means squared acceleration (i.e. if
+you move the mouse twice as fast, the pointer will move
+four times as fast on the screen).
 Values beyond 2.0 are possible but not recommended.
 A good value to start is probably 1.5.
 .Pp
 The optional
 .Ar offset
-value specifies the distance at which the acceleration
-begins.  The default is 1.0, which means that the
-acceleration is applied to movements larger than one unit.
+value specifies the distance at which the acceleration begins.
+The default is 1.0, which means that the acceleration is applied
+to movements larger than one unit.
 If you specify a larger value, it takes more speed for
 the acceleration to kick in, i.e. the speed range for
 small and accurate movements is wider.
@@ -263,8 +265,8 @@ not satisfied with the behaviour, try a value of 2.0.
 Note that the
 .Fl A
 option interacts badly with the X server's own acceleration,
-which doesn't work very well anyway.  Therefore it is
-recommended to switch it off if necessary:
+which doesn't work very well anyway.
+Therefore it is recommended to switch it off if necessary:
 .Dq xset m 1 .
 .It Fl a Ar X Ns Op , Ns Ar Y
 Accelerate or decelerate the mouse input.
___
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: r367902 - head/usr.sbin/crashinfo

2020-11-20 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Fri Nov 20 16:59:51 2020
New Revision: 367902
URL: https://svnweb.freebsd.org/changeset/base/367902

Log:
  crashinfo(8): Fix a few mandoc warnings
  
  - new sentence, new line

Modified:
  head/usr.sbin/crashinfo/crashinfo.8

Modified: head/usr.sbin/crashinfo/crashinfo.8
==
--- head/usr.sbin/crashinfo/crashinfo.8 Fri Nov 20 16:57:06 2020
(r367901)
+++ head/usr.sbin/crashinfo/crashinfo.8 Fri Nov 20 16:59:51 2020
(r367902)
@@ -89,9 +89,11 @@ and
 The options are as follows:
 .Bl -tag -width indent
 .It Fl b
-Run in batch mode.  Write most messages to the
+Run in batch mode.
+Write most messages to the
 .Pa core.txt.XX
-file instead of the terminal.  This flag is used when
+file instead of the terminal.
+This flag is used when
 .Nm
 is run during boot.
 .It Fl d Ar crashdir
___
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: r367901 - head/usr.sbin/wpa/hostapd

2020-11-20 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Fri Nov 20 16:57:06 2020
New Revision: 367901
URL: https://svnweb.freebsd.org/changeset/base/367901

Log:
  hostapd.conf(5): Fix a mandoc warning
  
  - new sentence, new line

Modified:
  head/usr.sbin/wpa/hostapd/hostapd.conf.5

Modified: head/usr.sbin/wpa/hostapd/hostapd.conf.5
==
--- head/usr.sbin/wpa/hostapd/hostapd.conf.5Fri Nov 20 16:50:52 2020
(r367900)
+++ head/usr.sbin/wpa/hostapd/hostapd.conf.5Fri Nov 20 16:57:06 2020
(r367901)
@@ -67,8 +67,9 @@ The following parameters are recognized:
 Interface name.
 Should be set in
 .Dq hostap
-mode.  Make certain that there are no spaces after the interface name,
-or hostapd will complain that the interface does not exist.
+mode.
+Make certain that there are no spaces after the interface name, or hostapd wil
+complain that the interface does not exist.
 .It Va debug
 Debugging mode: 0 = no, 1 = minimal, 2 = verbose, 3 = msg dumps, 4 =
 excessive.
___
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: r367900 - head/usr.sbin/syslogd

2020-11-20 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Fri Nov 20 16:50:52 2020
New Revision: 367900
URL: https://svnweb.freebsd.org/changeset/base/367900

Log:
  syslog.conf(5): Fix a few mandoc warnings
  
  - new sentence, new line
  - skipping paragraph macro: Pp at the end of Sh

Modified:
  head/usr.sbin/syslogd/syslog.conf.5

Modified: head/usr.sbin/syslogd/syslog.conf.5
==
--- head/usr.sbin/syslogd/syslog.conf.5 Fri Nov 20 16:46:51 2020
(r367899)
+++ head/usr.sbin/syslogd/syslog.conf.5 Fri Nov 20 16:50:52 2020
(r367900)
@@ -245,7 +245,8 @@ specification is a line beginning with
 or
 .Ql \&:
 and the following blocks will be applied only when filter value
-matches given filter propertie's value. See
+matches given filter propertie's value.
+See
 .Sx PROPERTY-BASED FILTERS
 section for more details.
 .Pp
@@ -464,8 +465,8 @@ or
 .Ql \&:
 followed by three comma-separated fields
 .Em property , operator , \&"value\&" .
-Value must be double-quoted. A double quote and backslash must be escaped by
-a backslash.
+Value must be double-quoted.
+A double quote and backslash must be escaped by a backslash.
 .Pp
 Following
 .Em properties
@@ -521,7 +522,6 @@ Operator may be prefixed by
 .Ql icase_
 - to make comparison function case insensitive
 .El
-.Pp
 .Sh IMPLEMENTATION NOTES
 The
 .Dq kern
___
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: r367899 - head/usr.sbin/bsnmpd/modules/snmp_wlan

2020-11-20 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Fri Nov 20 16:46:51 2020
New Revision: 367899
URL: https://svnweb.freebsd.org/changeset/base/367899

Log:
  snmp_wlan(3): Fix mandoc warnings
  
  - new sentence, new line

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3

Modified: head/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3
==
--- head/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3  Fri Nov 20 16:41:32 
2020(r367898)
+++ head/usr.sbin/bsnmpd/modules/snmp_wlan/snmp_wlan.3  Fri Nov 20 16:46:51 
2020(r367899)
@@ -41,8 +41,8 @@
 The
 .Nm snmp_wlan
 module implements a private BEGEMOT-WIRELESS-MIB, which allows
-management of virtual wireless interfaces. The MIB defines objects similar to 
the
-state data and configuration capabilities of
+management of virtual wireless interfaces.
+The MIB defines objects similar to the state data and configuration 
capabilities of
 .Xr ifconfig 8
 for configuring virtual wireless interfaces.
 Therefore one should consider adding write communities or loading the
@@ -52,15 +52,15 @@ module on systems where security is crucial.
 A short description of the Tables and interesting objects in the MIB follows.
 .Bl -tag -width "X"
 .It Va wlanInterfaceTable
-The table is used for creation and deletion of virtual wireless interfaces. To
-add a new interface, a SET should be executed on the
+The table is used for creation and deletion of virtual wireless interfaces.
+To add a new interface, a SET should be executed on the
 .Va wlanIfaceName
 column with
-value the desired name of the interface. Next the parent interface must be set
-via
+value the desired name of the interface.
+Next the parent interface must be set via
 .Va wlanParentIfName
-column. Any optional parameters may be set
-via the
+column.
+Any optional parameters may be set via the
 .Va wlanIfaceOperatingMode ,
 .Va wlanIfaceFlags ,
 .Va wlanIfaceBssid
@@ -78,9 +78,9 @@ The table contains information about the hardware capa
 a wireless interface.
 .It Va wlanIfaceConfigTable
 The table is used to get or set various configuration parameters for a virtual
-wireless interface. Depending on the operating mode of the interface and the
-hardware capabilities of the underlying hardware interface, not all parameters
-and values may be supported.
+wireless interface.
+Depending on the operating mode of the interface and the hardware capabilities
+of the underlying hardware interface, not all parameters and values may be 
supported.
 .It Va wlanIfacePeerTable
 The table contains information about the associated stations for interfaces
 operating as access points, or the stations identified as neighbors in the IBSS
@@ -106,8 +106,9 @@ Access Control configuration for wireless interfaces o
 The table with Access Control MAC entries for which the configured Access
 Control Policy on wireless interfaces operating in Host AP mode is applied.
 .Va wlanMACAccessControlMACStatus
-column is used to add or delete MAC ACL entries. A set with value 
createAndGo(4)
-will add new entry, while with value destroy(6) will delete an existing one.
+column is used to add or delete MAC ACL entries.
+A set with value createAndGo(4) will add new entry, while with value destroy(6)
+will delete an existing one.
 .It Va wlanMeshRoutingConfig
 The subtree contains system configuration related to Wireless Mesh Routing.
 .It Va wlanMeshInterfaceTable
@@ -121,8 +122,9 @@ The mesh routing table for interfaces operating as mes
 forwarding packets on a mesh network.
 .Va wlanMeshRouteStatus
 column is used to add or delete entries in the mesh routing table for an
-interface. A set with value createAndGo(4) will add new entry, while with value
-destroy(6) will delete an existing one.
+interface.
+A set with value createAndGo(4) will add new entry, while with value destroy(6)
+will delete an existing one.
 .It Va wlanMeshStatsTable
 Summary statistics for each virtual wireless interface operating as mesh point.
 .It Va wlanMeshHWMPConfig
___
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: r367898 - head/usr.bin/iscsictl

2020-11-20 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Fri Nov 20 16:41:32 2020
New Revision: 367898
URL: https://svnweb.freebsd.org/changeset/base/367898

Log:
  iscsi.conf(5): Fix a mandoc warning
  
  - new sentence, new line

Modified:
  head/usr.bin/iscsictl/iscsi.conf.5

Modified: head/usr.bin/iscsictl/iscsi.conf.5
==
--- head/usr.bin/iscsictl/iscsi.conf.5  Fri Nov 20 16:34:01 2020
(r367897)
+++ head/usr.bin/iscsictl/iscsi.conf.5  Fri Nov 20 16:41:32 2020
(r367898)
@@ -146,9 +146,9 @@ for iSCSI over RDMA, or
 Default is
 .Qq Ar iSCSI .
 .It Cm dscp
-The DiffServ Codepoint used for sending data. The DSCP can be
-set to numeric, or hexadecimal values directly, as well as the
-well-defined
+The DiffServ Codepoint used for sending data.
+The DSCP can be set to numeric, or hexadecimal values directly,
+as well as the well-defined
 .Qq Ar cs
 and
 .Qq Ar af
___
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: r367897 - head/sbin/devmatch

2020-11-20 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Fri Nov 20 16:34:01 2020
New Revision: 367897
URL: https://svnweb.freebsd.org/changeset/base/367897

Log:
  devmatch(8): Fix section ordering
  
  - sections out of conventional order: Sh HISTORY

Modified:
  head/sbin/devmatch/devmatch.8

Modified: head/sbin/devmatch/devmatch.8
==
--- head/sbin/devmatch/devmatch.8   Fri Nov 20 15:21:10 2020
(r367896)
+++ head/sbin/devmatch/devmatch.8   Fri Nov 20 16:34:01 2020
(r367897)
@@ -69,6 +69,10 @@ Produce more verbose output.
 .Sh SEE ALSO
 .Xr devinfo 8 ,
 .Xr MODULE_PNP_INFO 9
+.Sh HISTORY
+.Nm
+first appeared in
+.Fx 12.0 .
 .Sh AUTHORS
 .An Warner Losh Aq Mt i...@freebsd.org
 .Sh BUGS
@@ -94,7 +98,3 @@ logical equivalent in USB, PCI, and others.
 .Pp
 Many drivers currently lack proper PNP table decorations and need to
 be updated.
-.Sh HISTORY
-.Nm
-first appeared in
-.Fx 12.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: r367896 - head/sys/riscv/riscv

2020-11-20 Thread Mitchell Horne
Author: mhorne
Date: Fri Nov 20 15:21:10 2020
New Revision: 367896
URL: https://svnweb.freebsd.org/changeset/base/367896

Log:
  riscv: always initialize the static kernel environment
  
  Ensure we initialize the static environment when not booting via
  loader(8), and provide a static buffer if this is the case. This fixes
  two issues.
  
  First, performing the initialization ensures that kenv variables set in
  the kernel's config file are honored. Previously, any new or overridden
  values were ignored.
  
  Second, providing the static buffer allows variables to be set in the
  device tree's bootargs property of the chosen node. This can be set by
  u-boot or by QEMU's '-append' flag. Attempting to this prior to this
  change resulted in an early panic, since the static environment had no
  buffer backing it.
  
  Submitted by: syrinx (earlier version)
  Reviewed by:  kp
  Differential Revision:https://reviews.freebsd.org/D25034

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

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Fri Nov 20 15:19:30 2020
(r367895)
+++ head/sys/riscv/riscv/machdep.c  Fri Nov 20 15:21:10 2020
(r367896)
@@ -130,6 +130,8 @@ cpuset_t all_harts;
 
 extern int *end;
 
+static char static_kenv[PAGE_SIZE];
+
 static void
 cpu_startup(void *dummy)
 {
@@ -836,6 +838,8 @@ parse_metadata(void)
kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
if (kern_envp != NULL)
init_static_kenv(kern_envp, 0);
+   else
+   init_static_kenv(static_kenv, sizeof(static_kenv));
 #ifdef DDB
ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t);
ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t);
___
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: r367895 - head/sys/fs/msdosfs

2020-11-20 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 20 15:19:30 2020
New Revision: 367895
URL: https://svnweb.freebsd.org/changeset/base/367895

Log:
  msdosfs: suspend around unmount or remount rw->ro.
  
  This also eliminates unsafe use of VFS_SYNC(MNT_WAIT).
  
  Requested by: mckusick
  Discussed with:   imp
  Tested by:pho (previous version)
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D27269

Modified:
  head/sys/fs/msdosfs/msdosfs_vfsops.c

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- head/sys/fs/msdosfs/msdosfs_vfsops.cFri Nov 20 14:45:45 2020
(r367894)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.cFri Nov 20 15:19:30 2020
(r367895)
@@ -248,22 +248,28 @@ msdosfs_mount(struct mount *mp)
pmp = VFSTOMSDOSFS(mp);
if (!(pmp->pm_flags & MSDOSFSMNT_RONLY) &&
vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) {
-   error = VFS_SYNC(mp, MNT_WAIT);
-   if (error)
+   if ((error = vn_start_write(NULL, , V_WAIT)) != 0)
return (error);
+   error = vfs_write_suspend_umnt(mp);
+   if (error != 0)
+   return (error);
+
flags = WRITECLOSE;
if (mp->mnt_flag & MNT_FORCE)
flags |= FORCECLOSE;
error = vflush(mp, 0, flags, td);
-   if (error)
+   if (error != 0) {
+   vfs_write_resume(mp, 0);
return (error);
+   }
 
/*
 * Now the volume is clean.  Mark it so while the
 * device is still rw.
 */
error = markvoldirty(pmp, 0);
-   if (error) {
+   if (error != 0) {
+   vfs_write_resume(mp, 0);
(void)markvoldirty(pmp, 1);
return (error);
}
@@ -273,6 +279,7 @@ msdosfs_mount(struct mount *mp)
error = g_access(pmp->pm_cp, 0, -1, 0);
g_topology_unlock();
if (error) {
+   vfs_write_resume(mp, 0);
(void)markvoldirty(pmp, 1);
return (error);
}
@@ -286,6 +293,7 @@ msdosfs_mount(struct mount *mp)
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_RDONLY;
MNT_IUNLOCK(mp);
+   vfs_write_resume(mp, 0);
} else if ((pmp->pm_flags & MSDOSFSMNT_RONLY) &&
!vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) {
/*
@@ -749,21 +757,31 @@ msdosfs_unmount(struct mount *mp, int mntflags)
 {
struct msdosfsmount *pmp;
int error, flags;
+   bool susp;
 
error = flags = 0;
pmp = VFSTOMSDOSFS(mp);
-   if ((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0)
-   error = msdosfs_sync(mp, MNT_WAIT);
+   susp = (pmp->pm_flags & MSDOSFSMNT_RONLY) == 0;
+
+   if (susp) {
+   error = vfs_write_suspend_umnt(mp);
+   if (error != 0)
+   return (error);
+   }
+
if ((mntflags & MNT_FORCE) != 0)
flags |= FORCECLOSE;
-   else if (error != 0)
-   return (error);
error = vflush(mp, 0, flags, curthread);
-   if (error != 0 && error != ENXIO)
+   if (error != 0 && error != ENXIO) {
+   if (susp)
+   vfs_write_resume(mp, VR_START_WRITE);
return (error);
-   if ((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0) {
+   }
+   if (susp) {
error = markvoldirty(pmp, 0);
-   if (error && error != ENXIO) {
+   if (error != 0 && error != ENXIO) {
+   if (susp)
+   vfs_write_resume(mp, VR_START_WRITE);
(void)markvoldirty(pmp, 1);
return (error);
}
@@ -800,6 +818,9 @@ msdosfs_unmount(struct mount *mp, int mntflags)
BO_UNLOCK(bo);
}
 #endif
+   if (susp)
+   vfs_write_resume(mp, VR_START_WRITE);
+
g_topology_lock();
g_vfs_close(pmp->pm_cp);
g_topology_unlock();
___
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: r367894 - head/sys/net

2020-11-20 Thread Mitchell Horne
Author: mhorne
Date: Fri Nov 20 14:45:45 2020
New Revision: 367894
URL: https://svnweb.freebsd.org/changeset/base/367894

Log:
  Make net/ifq.h C++ friendly
  
  Don't use "new" as an identifier, and add explicit casts from void *.
  
  As a general policy, FreeBSD doesn't make any C++ compatibility
  guarantees for kernel headers like it does for userland, but it is a
  small effort to do so in this case, to the benefit of a downstream
  consumer (NetApp).
  
  Reviewed by:  rscheff
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:https://reviews.freebsd.org/D27286

Modified:
  head/sys/net/ifq.h

Modified: head/sys/net/ifq.h
==
--- head/sys/net/ifq.h  Fri Nov 20 14:37:07 2020(r367893)
+++ head/sys/net/ifq.h  Fri Nov 20 14:45:45 2020(r367894)
@@ -336,7 +336,7 @@ drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, s
 }
 
 static __inline void
-drbr_putback(struct ifnet *ifp, struct buf_ring *br, struct mbuf *new)
+drbr_putback(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m_new)
 {
/*
 * The top of the list needs to be swapped 
@@ -348,11 +348,11 @@ drbr_putback(struct ifnet *ifp, struct buf_ring *br, s
 * Peek in altq case dequeued it
 * so put it back.
 */
-   IFQ_DRV_PREPEND(>if_snd, new);
+   IFQ_DRV_PREPEND(>if_snd, m_new);
return;
}
 #endif
-   buf_ring_putback_sc(br, new);
+   buf_ring_putback_sc(br, m_new);
 }
 
 static __inline struct mbuf *
@@ -371,7 +371,7 @@ drbr_peek(struct ifnet *ifp, struct buf_ring *br)
return (m);
}
 #endif
-   return(buf_ring_peek_clear_sc(br));
+   return ((struct mbuf *)buf_ring_peek_clear_sc(br));
 }
 
 static __inline void
@@ -383,7 +383,7 @@ drbr_flush(struct ifnet *ifp, struct buf_ring *br)
if (ifp != NULL && ALTQ_IS_ENABLED(>if_snd))
IFQ_PURGE(>if_snd);
 #endif 
-   while ((m = buf_ring_dequeue_sc(br)) != NULL)
+   while ((m = (struct mbuf *)buf_ring_dequeue_sc(br)) != NULL)
m_freem(m);
 }
 
@@ -406,7 +406,7 @@ drbr_dequeue(struct ifnet *ifp, struct buf_ring *br)
return (m);
}
 #endif
-   return (buf_ring_dequeue_sc(br));
+   return ((struct mbuf *)buf_ring_dequeue_sc(br));
 }
 
 static __inline void
@@ -438,11 +438,11 @@ drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *
return (m);
}
 #endif
-   m = buf_ring_peek(br);
+   m = (struct mbuf *)buf_ring_peek(br);
if (m == NULL || func(m, arg) == 0)
return (NULL);
 
-   return (buf_ring_dequeue_sc(br));
+   return ((struct mbuf *)buf_ring_dequeue_sc(br));
 }
 
 static __inline int
___
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: r367893 - head/libexec/rc/rc.d

2020-11-20 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Fri Nov 20 14:37:07 2020
New Revision: 367893
URL: https://svnweb.freebsd.org/changeset/base/367893

Log:
  Revert r367291 (KEYWORD: shutdown for rc.d/zfs)
  
  The problem is that zfs is asked to stop too early in the shutdown
  sequence. Other services, such as syslog may still be running and have some
  files open (e.g., under /var/log). This of course causes the messages like:
  
cannot unmount '/var/run': umount failed
cannot unmount '/var/log': umount failed
cannot unmount '/var': umount failed
cannot unmount '/usr/home': umount failed
cannot unmount '/usr': umount failed
cannot unmount '/': umount failed
  
  For now, let's remove the shutdown KEYWORD from the zfs service, as people are
  reporting problems in their setups:
  https://lists.freebsd.org/pipermail/freebsd-current/2020-November/077559.html
  
  In the future, we may think of stopping zfs on shutdown after all the other
  services and just before init(8) exits. Another interesting option might be to
  a new rcorder(8) KEYWORD like "shutdownjail", but this idea would need to be
  discussed a bit.
  
  Reported by:  Johan Hendriks 
  Reported by:  Yasuhiro KIMURA 
  Reported by:  Tomoaki AOKI 
  Approved by:  kevans (src)
  MFC:  3 days
  Differential Revision:https://reviews.freebsd.org/D27263

Modified:
  head/libexec/rc/rc.d/zfs

Modified: head/libexec/rc/rc.d/zfs
==
--- head/libexec/rc/rc.d/zfsFri Nov 20 14:02:43 2020(r367892)
+++ head/libexec/rc/rc.d/zfsFri Nov 20 14:37:07 2020(r367893)
@@ -6,7 +6,6 @@
 # PROVIDE: zfs
 # REQUIRE: zfsbe
 # BEFORE: FILESYSTEMS var
-# KEYWORD: shutdown
 
 . /etc/rc.subr
 
___
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: r367892 - head/sys/dev/sound/pcm

2020-11-20 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 20 14:02:43 2020
New Revision: 367892
URL: https://svnweb.freebsd.org/changeset/base/367892

Log:
  Unlock channels when any of them are locked, when returning for non-busy 
state.
  
  Reported and tested by:   "Wall, Stephen" 
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/dev/sound/pcm/dsp.c

Modified: head/sys/dev/sound/pcm/dsp.c
==
--- head/sys/dev/sound/pcm/dsp.cFri Nov 20 13:00:28 2020
(r367891)
+++ head/sys/dev/sound/pcm/dsp.cFri Nov 20 14:02:43 2020
(r367892)
@@ -857,6 +857,8 @@ dsp_io_ops(struct cdev *i_dev, struct uio *buf)
getchns(i_dev, , , prio);
 
if (*ch == NULL || !((*ch)->flags & CHN_F_BUSY)) {
+   if (rdch != NULL || wrch != NULL)
+   relchns(i_dev, rdch, wrch, prio);
PCM_GIANT_EXIT(d);
return (EBADF);
}
___
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"


Re: svn commit: r367530 - in head/sys/netinet: . tcp_stacks

2020-11-20 Thread Michael Tuexen
On 20. Nov 2020, at 00:13, John Baldwin  wrote:
> 
> On 11/19/20 2:55 PM, John Baldwin wrote:
>> On 11/9/20 1:49 PM, Michael Tuexen wrote:
>>> Author: tuexen
>>> Date: Mon Nov  9 21:49:40 2020
>>> New Revision: 367530
>>> URL: https://svnweb.freebsd.org/changeset/base/367530
>>> 
>>> Log:
>>>  RFC 7323 specifies that:
>>>  * TCP segments without timestamps should be dropped when support for
>>>the timestamp option has been negotiated.
>>>  * TCP segments with timestamps should be processed normally if support
>>>for the timestamp option has not been negotiated.
>>>  This patch enforces the above.
>>> 
>>>  PR:250499
>>>  Reviewed by:   gnn, rrs
>>>  MFC after: 1 week
>>>  Sponsored by:  Netflix, Inc
>>>  Differential Revision: https://reviews.freebsd.org/D27148
>>> 
>>> Modified:
>>>  head/sys/netinet/tcp_input.c
>>>  head/sys/netinet/tcp_stacks/bbr.c
>>>  head/sys/netinet/tcp_stacks/rack.c
>>>  head/sys/netinet/tcp_syncache.c
>>>  head/sys/netinet/tcp_timewait.c
>>> 
>>> Modified: head/sys/netinet/tcp_timewait.c
>>> ==
>>> --- head/sys/netinet/tcp_timewait.c Mon Nov  9 21:19:17 2020
>>> (r367529)
>>> +++ head/sys/netinet/tcp_timewait.c Mon Nov  9 21:49:40 2020
>>> (r367530)
>>> @@ -376,7 +376,7 @@ tcp_twstart(struct tcpcb *tp)
>>>  * looking for a pcb in the listen state.  Returns 0 otherwise.
>>>  */
>>> int
>>> -tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unused, struct tcphdr 
>>> *th,
>>> +tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th,
>>> struct mbuf *m, int tlen)
>>> {
>>> struct tcptw *tw;
>>> @@ -410,6 +410,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unu
>>>  */
>>> if (thflags & TH_RST)
>>> goto drop;
>>> +
>>> +   /*
>>> +* If timestamps were negotiated during SYN/ACK and a
>>> +* segment without a timestamp is received, silently drop
>>> +* the segment.
>>> +* See section 3.2 of RFC 7323.
>>> +*/
>>> +   if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
>>> +   goto drop;
>>> +   }
>> 
>> This causes an insta-panic with TOE because toe_4tuple_check() passes in a 
>> NULL
>> pointer for 'to'.  I'm working on a fix for that, but perhaps wait to MFC 
>> until
>> the fix is ready so they can be merged together?
>> 
>> That said, TOE only calls this in the case that it has gotten a new SYN, so I
>> wonder if it makes sense to apply this check on a new SYN.  For a new SYN,
>> shouldn't we not care if the new connection is using a different timestamp
>> option from the old connection?  The language in RFC 7323 3.2 is all about
>> segments on an existing connection, not segments from a new connection I 
>> think?
>> 
>> That is, I think we should perhaps move this check after the TH_SYN check so
>> that a mismatch doesn't prevent recycling?
> 
> Actually, we move the check below requiring TH_ACK, I think this would fix 
> the TOE
> case and also DTRT for plain SYNs for non-TOE:
Yes, I committed this in https://svnweb.freebsd.org/changeset/base/367891
and also added a comment and a KASSERT.
> 
> diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
> index c52eab956303..85f1ccbe40f9 100644
> --- a/sys/netinet/tcp_timewait.c
> +++ b/sys/netinet/tcp_timewait.c
> @@ -411,16 +411,6 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct 
> tcphdr *th,
>   if (thflags & TH_RST)
>   goto drop;
> 
> - /*
> -  * If timestamps were negotiated during SYN/ACK and a
> -  * segment without a timestamp is received, silently drop
> -  * the segment.
> -  * See section 3.2 of RFC 7323.
> -  */
> - if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
> - goto drop;
> - }
> -
> #if 0
> /* PAWS not needed at the moment */
>   /*
> @@ -455,6 +445,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct 
> tcphdr *th,
>   if ((thflags & TH_ACK) == 0)
>   goto drop;
> 
> + /*
> +  * If timestamps were negotiated during SYN/ACK and a
> +  * segment without a timestamp is received, silently drop
> +  * the segment.
> +  * See section 3.2 of RFC 7323.
> +  */
> + if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
> + goto drop;
> + }
> +
>   /*
>* Reset the 2MSL timer if this is a duplicate FIN.
>*/
> 
> The commented out PAWS bits would also seem to not be relevant for SYN-only
> packets?  However, I'm less sure of if that bit should be moved later as
> well. (Or perhaps it should just be removed.  It has been #if 0'd since the
> timewait structure was first added back in 2003 by jlemon@)
Yes, I saw that also. Will deal with it in a separate issue...

Thanks for reporting the issue and sorry for breaking the code. I didn't know 
about
this use of tcp_twcheck() and have no 

svn commit: r367891 - head/sys/netinet

2020-11-20 Thread Michael Tuexen
Author: tuexen
Date: Fri Nov 20 13:00:28 2020
New Revision: 367891
URL: https://svnweb.freebsd.org/changeset/base/367891

Log:
  Fix an issue I introuced in r367530: tcp_twcheck() can be called
  with to == NULL for SYN segments. So don't assume tp != NULL.
  Thanks to jhb@ for reporting and suggesting a fix.
  
  PR:   250499
  MFC after:1 week
  XMFC-with:r367530
  Sponsored by: Netflix, Inc.

Modified:
  head/sys/netinet/tcp_timewait.c

Modified: head/sys/netinet/tcp_timewait.c
==
--- head/sys/netinet/tcp_timewait.c Fri Nov 20 12:31:02 2020
(r367890)
+++ head/sys/netinet/tcp_timewait.c Fri Nov 20 13:00:28 2020
(r367891)
@@ -374,6 +374,7 @@ tcp_twstart(struct tcpcb *tp)
 /*
  * Returns 1 if the TIME_WAIT state was killed and we should start over,
  * looking for a pcb in the listen state.  Returns 0 otherwise.
+ * It be called with to == NULL only for pure SYN-segments.
  */
 int
 tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th,
@@ -397,6 +398,8 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, stru
goto drop;
 
thflags = th->th_flags;
+   KASSERT(to != NULL || (thflags & (TH_SYN | TH_ACK)) == TH_SYN,
+   ("tcp_twcheck: called without options on a non-SYN segment"));
 
/*
 * NOTE: for FIN_WAIT_2 (to be added later),
@@ -411,16 +414,6 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, stru
if (thflags & TH_RST)
goto drop;
 
-   /*
-* If timestamps were negotiated during SYN/ACK and a
-* segment without a timestamp is received, silently drop
-* the segment.
-* See section 3.2 of RFC 7323.
-*/
-   if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
-   goto drop;
-   }
-
 #if 0
 /* PAWS not needed at the moment */
/*
@@ -454,6 +447,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, stru
 */
if ((thflags & TH_ACK) == 0)
goto drop;
+
+   /*
+* If timestamps were negotiated during SYN/ACK and a
+* segment without a timestamp is received, silently drop
+* the segment.
+* See section 3.2 of RFC 7323.
+*/
+   if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
+   goto drop;
+   }
 
/*
 * Reset the 2MSL timer if this is a duplicate FIN.
___
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: r367890 - head/sys/fs/msdosfs

2020-11-20 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 20 12:31:02 2020
New Revision: 367890
URL: https://svnweb.freebsd.org/changeset/base/367890

Log:
  msdosfs: Add trivial support for suspension.
  
  Tested by:pho (previous version)
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D27269

Modified:
  head/sys/fs/msdosfs/msdosfs_vfsops.c
  head/sys/fs/msdosfs/msdosfs_vnops.c

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- head/sys/fs/msdosfs/msdosfs_vfsops.cFri Nov 20 11:45:08 2020
(r367889)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.cFri Nov 20 12:31:02 2020
(r367890)
@@ -950,6 +950,12 @@ loop:
error = msdosfs_fsiflush(pmp, waitfor);
if (error != 0)
allerror = error;
+
+   if (allerror == 0 && waitfor == MNT_SUSPEND) {
+   MNT_ILOCK(mp);
+   mp->mnt_kern_flag |= MNTK_SUSPEND2 | MNTK_SUSPENDED;
+   MNT_IUNLOCK(mp);
+   }
return (allerror);
 }
 

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==
--- head/sys/fs/msdosfs/msdosfs_vnops.c Fri Nov 20 11:45:08 2020
(r367889)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c Fri Nov 20 12:31:02 2020
(r367890)
@@ -848,7 +848,7 @@ msdosfs_fsync(struct vop_fsync_args *ap)
* Non-critical metadata for associated directory entries only
* gets synced accidentally, as in most file systems.
*/
-   if (ap->a_waitfor == MNT_WAIT) {
+   if (ap->a_waitfor != MNT_NOWAIT) {
devvp = VTODE(ap->a_vp)->de_pmp->pm_devvp;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
allerror = VOP_FSYNC(devvp, MNT_WAIT, ap->a_td);
@@ -856,7 +856,7 @@ msdosfs_fsync(struct vop_fsync_args *ap)
} else
allerror = 0;
 
-   error = deupdat(VTODE(ap->a_vp), ap->a_waitfor == MNT_WAIT);
+   error = deupdat(VTODE(ap->a_vp), ap->a_waitfor != MNT_NOWAIT);
if (allerror == 0)
allerror = error;
return (allerror);
___
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: r367889 - head/sbin/camcontrol

2020-11-20 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Fri Nov 20 11:45:08 2020
New Revision: 367889
URL: https://svnweb.freebsd.org/changeset/base/367889

Log:
  camcontrol(8): Fix some warnings spotted by mandoc
  
  - skipping paragraph macro: Pp before Bl

Modified:
  head/sbin/camcontrol/camcontrol.8

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Fri Nov 20 11:31:25 2020
(r367888)
+++ head/sbin/camcontrol/camcontrol.8   Fri Nov 20 11:45:08 2020
(r367889)
@@ -2276,7 +2276,6 @@ These zones must be written sequentially.
 If they are not written sequentially, starting at the write pointer, the
 command will fail.
 .El
-.Pp
 .Bl -tag -width 12n
 .It Fl c Ar cmd
 Specify the zone subcommand:
@@ -2831,7 +2830,6 @@ This will read and decode the attribute values from pa
 in tape drive sa0, and will display any
 .Tn SCSI
 errors that result.
-.Pp
 .Bd -literal -offset indent
 camcontrol zone da0 -v -c rz -P summary
 .Ed
@@ -2842,7 +2840,6 @@ summary of the zone parameters, and display any
 or
 .Tn ATA
 errors that result.
-.Pp
 .Bd -literal -offset indent
 camcontrol zone da0 -v -c rz -o reset
 .Ed
@@ -2853,7 +2850,6 @@ pointer reset from the disk da0, and display any
 or
 .Tn ATA
 errors that result.
-.Pp
 .Bd -literal -offset indent
 camcontrol zone da0 -v -c rwp -l 0x2c8
 .Ed
@@ -2864,7 +2860,6 @@ that starts at LBA 0x2c8 and display any
 or
 .Tn ATA
 errors that result.
-.Pp
 .Bd -literal -offset indent
 camcontrol epc ada0 -c timer -T 60.1 -p Idle_a -e -s
 .Ed
@@ -2873,7 +2868,6 @@ Set the timer for the Idle_a power condition on drive
 .Pa ada0
 to 60.1 seconds, enable that particular power condition, and save the timer
 value and the enabled state of the power condition.
-.Pp
 .Bd -literal -offset indent
 camcontrol epc da4 -c goto -p Standby_z -H
 .Ed
@@ -2885,7 +2879,6 @@ the drive's lowest power state) and hold in that state
 explicitly released by another
 .Cm goto
 command.
-.Pp
 .Bd -literal -offset indent
 camcontrol epc da2 -c status -P
 .Ed
@@ -2903,7 +2896,6 @@ to only send the
 .Tn ATA
 CHECK POWER MODE command, which should not trigger a change in the drive's
 power state.
-.Pp
 .Bd -literal -offset indent
 camcontrol epc ada0 -c list
 .Ed
@@ -2911,7 +2903,6 @@ camcontrol epc ada0 -c list
 Display the ATA Power Conditions log (Log Address 0x08) for
 drive
 .Pa ada0 .
-.Pp
 .Bd -literal -offset indent
 camcontrol timestamp sa0 -s -f "%a, %d %b %Y %T %z" \e
-T "Wed, 26 Oct 2016 21:43:57 -0600"
___
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: r367888 - head/sys/dev/dwc

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:31:25 2020
New Revision: 367888
URL: https://svnweb.freebsd.org/changeset/base/367888

Log:
  if_dwc: Add checksum offloading support

Modified:
  head/sys/dev/dwc/if_dwc.c

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:31:04 2020(r367887)
+++ head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:31:25 2020(r367888)
@@ -155,7 +155,6 @@ __FBSDID("$FreeBSD$");
 #defineRDESC0_FS   (1U <<  9)  /* First Descriptor */
 #defineRDESC0_LS   (1U <<  8)  /* Last Descriptor */
 #defineRDESC0_ICE  (1U <<  7)  /* IPC Checksum Error */
-#defineRDESC0_GF   (1U <<  7)  /* Giant Frame */
 #defineRDESC0_LC   (1U <<  6)  /* Late Collision */
 #defineRDESC0_FT   (1U <<  5)  /* Frame Type */
 #defineRDESC0_RWT  (1U <<  4)  /* Receive Watchdog 
Timeout */
@@ -628,7 +627,7 @@ dwc_get1paddr(void *arg, bus_dma_segment_t *segs, int 
 
 inline static void
 dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr,
-uint32_t len)
+  uint32_t len, uint32_t flags)
 {
uint32_t desc0, desc1;
 
@@ -641,10 +640,10 @@ dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_ad
if (sc->mactype != DWC_GMAC_EXT_DESC) {
desc0 = 0;
desc1 = NTDESC1_TCH | NTDESC1_FS | NTDESC1_LS |
-   NTDESC1_IC | len;
+   NTDESC1_IC | len | flags;
} else {
desc0 = ETDESC0_TCH | ETDESC0_FS | ETDESC0_LS |
-   ETDESC0_IC;
+   ETDESC0_IC | flags;
desc1 = len;
}
++sc->txcount;
@@ -667,6 +666,7 @@ dwc_setup_txbuf(struct dwc_softc *sc, int idx, struct 
struct bus_dma_segment seg;
int error, nsegs;
struct mbuf * m;
+   uint32_t flags = 0;
 
if ((m = m_defrag(*mp, M_NOWAIT)) == NULL)
return (ENOMEM);
@@ -685,8 +685,22 @@ dwc_setup_txbuf(struct dwc_softc *sc, int idx, struct 
 
sc->txbuf_map[idx].mbuf = m;
 
-   dwc_setup_txdesc(sc, idx, seg.ds_addr, seg.ds_len);
+   if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0) {
+   if ((m->m_pkthdr.csum_flags & (CSUM_TCP|CSUM_UDP)) != 0) {
+   if (sc->mactype != DWC_GMAC_EXT_DESC)
+   flags = NTDESC1_CIC_FULL;
+   else
+   flags = ETDESC0_CIC_FULL;
+   } else {
+   if (sc->mactype != DWC_GMAC_EXT_DESC)
+   flags = NTDESC1_CIC_HDR;
+   else
+   flags = ETDESC0_CIC_HDR;
+   }
+   }
 
+   dwc_setup_txdesc(sc, idx, seg.ds_addr, seg.ds_len, flags);
+
return (0);
 }
 
@@ -807,6 +821,18 @@ dwc_rxfinish_one(struct dwc_softc *sc, struct dwc_hwde
m->m_len = len;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 
+   if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0 &&
+ (rdesc0 & RDESC0_FT) != 0) {
+   m->m_pkthdr.csum_flags = CSUM_IP_CHECKED;
+   if ((rdesc0 & RDESC0_ICE) == 0)
+   m->m_pkthdr.csum_flags |= CSUM_IP_VALID;
+   if ((rdesc0 & RDESC0_PCE) == 0) {
+   m->m_pkthdr.csum_flags |=
+   CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
+   m->m_pkthdr.csum_data = 0x;
+   }
+   }
+
/* Remove trailing FCS */
m_adj(m, -ETHER_CRC_LEN);
 
@@ -893,7 +919,7 @@ setup_dma(struct dwc_softc *sc)
"could not create TX buffer DMA map.\n");
goto out;
}
-   dwc_setup_txdesc(sc, idx, 0, 0);
+   dwc_setup_txdesc(sc, idx, 0, 0, 0);
}
 
/*
@@ -1139,6 +1165,14 @@ dwc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/* No work to do except acknowledge the change took */
if_togglecapenable(ifp, IFCAP_VLAN_MTU);
}
+   if (mask & IFCAP_RXCSUM)
+   if_togglecapenable(ifp, IFCAP_RXCSUM);
+   if (mask & IFCAP_TXCSUM)
+   if_togglecapenable(ifp, IFCAP_TXCSUM);
+   if ((if_getcapenable(ifp) & IFCAP_TXCSUM) != 0)
+   if_sethwassistbits(ifp, CSUM_IP | CSUM_UDP | CSUM_TCP, 
0);
+   else
+   if_sethwassistbits(ifp, 0, CSUM_IP | CSUM_UDP | 
CSUM_TCP);
break;
 
default:
@@ -1173,7 +1207,7 @@ dwc_txfinish_locked(struct dwc_softc *sc)
bus_dmamap_unload(sc->txbuf_tag, bmap->map);

svn commit: r367887 - head/sys/dev/dwc

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:31:04 2020
New Revision: 367887
URL: https://svnweb.freebsd.org/changeset/base/367887

Log:
  if_dwc: Add flow control support

Modified:
  head/sys/dev/dwc/if_dwc.c
  head/sys/dev/dwc/if_dwc.h

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:30:44 2020(r367886)
+++ head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:31:04 2020(r367887)
@@ -224,6 +224,10 @@ static void dwc_stop_dma(struct dwc_softc *sc);
 
 static void dwc_tick(void *arg);
 
+/* Pause time field in the transmitted control frame */
+static int dwc_pause_time = 0x;
+TUNABLE_INT("hw.dwc.pause_time", _pause_time);
+
 /*
  * MIIBUS functions
  */
@@ -333,6 +337,15 @@ dwc_miibus_statchg(device_t dev)
else
reg &= ~(CONF_DM);
WRITE4(sc, MAC_CONFIGURATION, reg);
+
+   reg = FLOW_CONTROL_UP;
+   if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0)
+   reg |= FLOW_CONTROL_TX;
+   if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0)
+   reg |= FLOW_CONTROL_RX;
+   if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0)
+   reg |= dwc_pause_time << FLOW_CONTROL_PT_SHIFT;
+   WRITE4(sc, FLOW_CONTROL, reg);
 
IF_DWC_SET_SPEED(dev, IFM_SUBTYPE(mii->mii_media_active));
 

Modified: head/sys/dev/dwc/if_dwc.h
==
--- head/sys/dev/dwc/if_dwc.h   Fri Nov 20 11:30:44 2020(r367886)
+++ head/sys/dev/dwc/if_dwc.h   Fri Nov 20 11:31:04 2020(r367887)
@@ -70,6 +70,10 @@
 #define GMII_ADDRESS_GB(1 << 0)/* Busy */
 #defineGMII_DATA   0x14
 #defineFLOW_CONTROL0x18
+#define FLOW_CONTROL_PT_SHIFT  16
+#define FLOW_CONTROL_UP(1 << 3)/* Unicast pause enable 
*/
+#define FLOW_CONTROL_RX(1 << 2)/* RX Flow control 
enable */
+#define FLOW_CONTROL_TX(1 << 1)/* TX Flow control 
enable */
 #defineGMAC_VLAN_TAG   0x1C
 #defineVERSION 0x20
 #defineDEBUG   0x24
___
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: r367886 - head/sys/arm/allwinner

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:30:44 2020
New Revision: 367886
URL: https://svnweb.freebsd.org/changeset/base/367886

Log:
  if_awg: Add a awg_dma_start_tx function that trigger dma engine
  
  No functional changes intended

Modified:
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Fri Nov 20 11:30:23 2020
(r367885)
+++ head/sys/arm/allwinner/if_awg.c Fri Nov 20 11:30:44 2020
(r367886)
@@ -941,6 +941,18 @@ awg_setup_dma(device_t dev)
return (0);
 }
 
+static void
+awg_dma_start_tx(struct awg_softc *sc)
+{
+   uint32_t val;
+
+   AWG_ASSERT_LOCKED(sc);
+
+   /* Start and run TX DMA */
+   val = RD4(sc, EMAC_TX_CTL_1);
+   WR4(sc, EMAC_TX_CTL_1, val | TX_DMA_START);
+}
+
 /*
  * if_ functions
  */
@@ -949,7 +961,6 @@ static void
 awg_start_locked(struct awg_softc *sc)
 {
struct mbuf *m;
-   uint32_t val;
if_t ifp;
int cnt, err;
 
@@ -984,9 +995,7 @@ awg_start_locked(struct awg_softc *sc)
bus_dmamap_sync(sc->tx.desc_tag, sc->tx.desc_map,
BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
 
-   /* Start and run TX DMA */
-   val = RD4(sc, EMAC_TX_CTL_1);
-   WR4(sc, EMAC_TX_CTL_1, val | TX_DMA_START);
+   awg_dma_start_tx(sc);
}
 }
 
___
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: r367885 - head/sys/dev/dwc

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:30:23 2020
New Revision: 367885
URL: https://svnweb.freebsd.org/changeset/base/367885

Log:
  if_dwc: Use if_ function where appropriate
  
  No functional changes intended

Modified:
  head/sys/dev/dwc/if_dwc.c

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:30:01 2020(r367884)
+++ head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:30:23 2020(r367885)
@@ -983,25 +983,26 @@ dwc_txstart_locked(struct dwc_softc *sc)
 
ifp = sc->ifp;
 
-   if (ifp->if_drv_flags & IFF_DRV_OACTIVE)
+   if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) !=
+   IFF_DRV_RUNNING)
return;
 
enqueued = 0;
 
for (;;) {
if (sc->txcount == (TX_DESC_COUNT - 1)) {
-   ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+   if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
break;
}
 
-   IFQ_DRV_DEQUEUE(>if_snd, m);
+   m = if_dequeue(ifp);
if (m == NULL)
break;
if (dwc_setup_txbuf(sc, sc->tx_idx_head, ) != 0) {
-IFQ_DRV_PREPEND(>if_snd, m);
+   if_sendq_prepend(ifp, m);
break;
}
-   BPF_MTAP(ifp, m);
+   if_bpfmtap(ifp, m);
sc->tx_idx_head = next_txidx(sc, sc->tx_idx_head);
++enqueued;
}
@@ -1029,7 +1030,7 @@ dwc_init_locked(struct dwc_softc *sc)
 
DWC_ASSERT_LOCKED(sc);
 
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+   if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
return;
 
dwc_setup_rxfilter(sc);
@@ -1065,7 +1066,7 @@ dwc_stop_locked(struct dwc_softc *sc)
DWC_ASSERT_LOCKED(sc);
 
ifp = sc->ifp;
-   ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+   if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
sc->tx_watchdog_count = 0;
sc->stats_harvest_count = 0;
 
@@ -1081,7 +1082,7 @@ dwc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct dwc_softc *sc;
struct mii_data *mii;
struct ifreq *ifr;
-   int mask, error;
+   int flags, mask, error;
 
sc = ifp->if_softc;
ifr = (struct ifreq *)data;
@@ -1090,25 +1091,25 @@ dwc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
switch (cmd) {
case SIOCSIFFLAGS:
DWC_LOCK(sc);
-   if (ifp->if_flags & IFF_UP) {
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-   if ((ifp->if_flags ^ sc->if_flags) &
-   (IFF_PROMISC | IFF_ALLMULTI))
+   if (if_getflags(ifp) & IFF_UP) {
+   if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
+   flags = if_getflags(ifp) ^ sc->if_flags;
+   if ((flags & (IFF_PROMISC|IFF_ALLMULTI)) != 0)
dwc_setup_rxfilter(sc);
} else {
if (!sc->is_detaching)
dwc_init_locked(sc);
}
} else {
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+   if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
dwc_stop_locked(sc);
}
-   sc->if_flags = ifp->if_flags;
+   sc->if_flags = if_getflags(ifp);
DWC_UNLOCK(sc);
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+   if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
DWC_LOCK(sc);
dwc_setup_rxfilter(sc);
DWC_UNLOCK(sc);
@@ -1120,10 +1121,10 @@ dwc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = ifmedia_ioctl(ifp, ifr, >mii_media, cmd);
break;
case SIOCSIFCAP:
-   mask = ifp->if_capenable ^ ifr->ifr_reqcap;
+   mask = ifr->ifr_reqcap ^ if_getcapenable(ifp);
if (mask & IFCAP_VLAN_MTU) {
/* No work to do except acknowledge the change took */
-   ifp->if_capenable ^= IFCAP_VLAN_MTU;
+   if_togglecapenable(ifp, IFCAP_VLAN_MTU);
}
break;
 
@@ -1161,7 +1162,7 @@ dwc_txfinish_locked(struct dwc_softc *sc)
bmap->mbuf = NULL;
dwc_setup_txdesc(sc, sc->tx_idx_tail, 0, 0);
sc->tx_idx_tail = next_txidx(sc, sc->tx_idx_tail);
-   ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+   if_setdrvflagbits(ifp, 0, 

svn commit: r367884 - head/sys/dev/dwc

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:30:01 2020
New Revision: 367884
URL: https://svnweb.freebsd.org/changeset/base/367884

Log:
  if_dwc: Reorder functions and sort them by usage
  
  No functional changes intended

Modified:
  head/sys/dev/dwc/if_dwc.c

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:29:37 2020(r367883)
+++ head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:30:01 2020(r367884)
@@ -195,6 +195,12 @@ struct dwc_hwdesc
uint32_t addr2; /* ptr to next descriptor / second buffer data*/
 };
 
+
+struct dwc_hash_maddr_ctx {
+   struct dwc_softc *sc;
+   uint32_t hash[8];
+};
+
 /*
  * The hardware imposes alignment restrictions on various objects involved in
  * DMA transfers.  These values are expressed in bytes (not bits).
@@ -216,281 +222,461 @@ static void dwc_enable_mac(struct dwc_softc *sc, bool 
 static void dwc_init_dma(struct dwc_softc *sc);
 static void dwc_stop_dma(struct dwc_softc *sc);
 
-static inline uint32_t
-next_rxidx(struct dwc_softc *sc, uint32_t curidx)
-{
+static void dwc_tick(void *arg);
 
-   return ((curidx + 1) % RX_DESC_COUNT);
-}
+/*
+ * MIIBUS functions
+ */
 
-static inline uint32_t
-next_txidx(struct dwc_softc *sc, uint32_t curidx)
+static int
+dwc_miibus_read_reg(device_t dev, int phy, int reg)
 {
+   struct dwc_softc *sc;
+   uint16_t mii;
+   size_t cnt;
+   int rv = 0;
 
-   return ((curidx + 1) % TX_DESC_COUNT);
-}
+   sc = device_get_softc(dev);
 
-static void
-dwc_get1paddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
-{
+   mii = ((phy & GMII_ADDRESS_PA_MASK) << GMII_ADDRESS_PA_SHIFT)
+   | ((reg & GMII_ADDRESS_GR_MASK) << GMII_ADDRESS_GR_SHIFT)
+   | (sc->mii_clk << GMII_ADDRESS_CR_SHIFT)
+   | GMII_ADDRESS_GB; /* Busy flag */
 
-   if (error != 0)
-   return;
-   *(bus_addr_t *)arg = segs[0].ds_addr;
-}
+   WRITE4(sc, GMII_ADDRESS, mii);
 
-inline static void
-dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr,
-uint32_t len)
-{
-   uint32_t desc0, desc1;
-
-   /* Addr/len 0 means we're clearing the descriptor after xmit done. */
-   if (paddr == 0 || len == 0) {
-   desc0 = 0;
-   desc1 = 0;
-   --sc->txcount;
-   } else {
-   if (sc->mactype != DWC_GMAC_EXT_DESC) {
-   desc0 = 0;
-   desc1 = NTDESC1_TCH | NTDESC1_FS | NTDESC1_LS |
-   NTDESC1_IC | len;
-   } else {
-   desc0 = ETDESC0_TCH | ETDESC0_FS | ETDESC0_LS |
-   ETDESC0_IC;
-   desc1 = len;
+   for (cnt = 0; cnt < 1000; cnt++) {
+   if (!(READ4(sc, GMII_ADDRESS) & GMII_ADDRESS_GB)) {
+   rv = READ4(sc, GMII_DATA);
+   break;
}
-   ++sc->txcount;
+   DELAY(10);
}
 
-   sc->txdesc_ring[idx].addr1 = (uint32_t)(paddr);
-   sc->txdesc_ring[idx].desc0 = desc0;
-   sc->txdesc_ring[idx].desc1 = desc1;
-
-   if (paddr && len) {
-   wmb();
-   sc->txdesc_ring[idx].desc0 |= TDESC0_OWN;
-   wmb();
-   }
+   return rv;
 }
 
 static int
-dwc_setup_txbuf(struct dwc_softc *sc, int idx, struct mbuf **mp)
+dwc_miibus_write_reg(device_t dev, int phy, int reg, int val)
 {
-   struct bus_dma_segment seg;
-   int error, nsegs;
-   struct mbuf * m;
+   struct dwc_softc *sc;
+   uint16_t mii;
+   size_t cnt;
 
-   if ((m = m_defrag(*mp, M_NOWAIT)) == NULL)
-   return (ENOMEM);
-   *mp = m;
+   sc = device_get_softc(dev);
 
-   error = bus_dmamap_load_mbuf_sg(sc->txbuf_tag, sc->txbuf_map[idx].map,
-   m, , , 0);
-   if (error != 0) {
-   return (ENOMEM);
-   }
+   mii = ((phy & GMII_ADDRESS_PA_MASK) << GMII_ADDRESS_PA_SHIFT)
+   | ((reg & GMII_ADDRESS_GR_MASK) << GMII_ADDRESS_GR_SHIFT)
+   | (sc->mii_clk << GMII_ADDRESS_CR_SHIFT)
+   | GMII_ADDRESS_GB | GMII_ADDRESS_GW;
 
-   KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs));
+   WRITE4(sc, GMII_DATA, val);
+   WRITE4(sc, GMII_ADDRESS, mii);
 
-   bus_dmamap_sync(sc->txbuf_tag, sc->txbuf_map[idx].map,
-   BUS_DMASYNC_PREWRITE);
+   for (cnt = 0; cnt < 1000; cnt++) {
+   if (!(READ4(sc, GMII_ADDRESS) & GMII_ADDRESS_GB)) {
+   break;
+}
+   DELAY(10);
+   }
 
-   sc->txbuf_map[idx].mbuf = m;
-
-   dwc_setup_txdesc(sc, idx, seg.ds_addr, seg.ds_len);
-
return (0);
 }
 
 static void
-dwc_txstart_locked(struct dwc_softc *sc)
+dwc_miibus_statchg(device_t dev)
 {
-   struct ifnet *ifp;
-   struct mbuf *m;
-   int enqueued;
+  

svn commit: r367883 - head/sys/arm/allwinner

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:29:37 2020
New Revision: 367883
URL: https://svnweb.freebsd.org/changeset/base/367883

Log:
  if_awg: Reorder functions and sort them by usage
  
  No functional changes intended

Modified:
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Fri Nov 20 11:29:20 2020
(r367882)
+++ head/sys/arm/allwinner/if_awg.c Fri Nov 20 11:29:37 2020
(r367883)
@@ -217,7 +217,10 @@ static struct resource_spec awg_spec[] = {
 };
 
 static void awg_txeof(struct awg_softc *sc);
+static void awg_start_locked(struct awg_softc *sc);
 
+static void awg_tick(void *softc);
+
 static int awg_parse_delay(device_t dev, uint32_t *tx_delay,
 uint32_t *rx_delay);
 static uint32_t syscon_read_emac_clk_reg(device_t dev);
@@ -225,6 +228,10 @@ static void syscon_write_emac_clk_reg(device_t dev, ui
 static phandle_t awg_get_phy_node(device_t dev);
 static bool awg_has_internal_phy(device_t dev);
 
+/*
+ * MII functions
+ */
+
 static int
 awg_miibus_readreg(device_t dev, int phy, int reg)
 {
@@ -346,6 +353,10 @@ awg_miibus_statchg(device_t dev)
WR4(sc, EMAC_TX_FLOW_CTL, val);
 }
 
+/*
+ * Media functions
+ */
+
 static void
 awg_media_status(if_t ifp, struct ifmediareq *ifmr)
 {
@@ -379,6 +390,217 @@ awg_media_change(if_t ifp)
return (error);
 }
 
+/*
+ * Core functions
+ */
+
+/* Bit Reversal - http://aggregate.org/MAGIC/#Bit%20Reversal */
+static uint32_t
+bitrev32(uint32_t x)
+{
+   x = (((x & 0x) >> 1) | ((x & 0x) << 1));
+   x = (((x & 0x) >> 2) | ((x & 0x) << 2));
+   x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));
+   x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));
+
+   return (x >> 16) | (x << 16);
+}
+
+static u_int
+awg_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+   uint32_t crc, hashreg, hashbit, *hash = arg;
+
+   crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN) & 0x7f;
+   crc = bitrev32(~crc) >> 26;
+   hashreg = (crc >> 5);
+   hashbit = (crc & 0x1f);
+   hash[hashreg] |= (1 << hashbit);
+
+   return (1);
+}
+
+static void
+awg_setup_rxfilter(struct awg_softc *sc)
+{
+   uint32_t val, hash[2], machi, maclo;
+   uint8_t *eaddr;
+   if_t ifp;
+
+   AWG_ASSERT_LOCKED(sc);
+
+   ifp = sc->ifp;
+   val = 0;
+   hash[0] = hash[1] = 0;
+
+   if (if_getflags(ifp) & IFF_PROMISC)
+   val |= DIS_ADDR_FILTER;
+   else if (if_getflags(ifp) & IFF_ALLMULTI) {
+   val |= RX_ALL_MULTICAST;
+   hash[0] = hash[1] = ~0;
+   } else if (if_foreach_llmaddr(ifp, awg_hash_maddr, hash) > 0)
+   val |= HASH_MULTICAST;
+
+   /* Write our unicast address */
+   eaddr = IF_LLADDR(ifp);
+   machi = (eaddr[5] << 8) | eaddr[4];
+   maclo = (eaddr[3] << 24) | (eaddr[2] << 16) | (eaddr[1] << 8) |
+  (eaddr[0] << 0);
+   WR4(sc, EMAC_ADDR_HIGH(0), machi);
+   WR4(sc, EMAC_ADDR_LOW(0), maclo);
+
+   /* Multicast hash filters */
+   WR4(sc, EMAC_RX_HASH_0, hash[1]);
+   WR4(sc, EMAC_RX_HASH_1, hash[0]);
+
+   /* RX frame filter config */
+   WR4(sc, EMAC_RX_FRM_FLT, val);
+}
+
+static void
+awg_setup_core(struct awg_softc *sc)
+{
+   uint32_t val;
+
+   AWG_ASSERT_LOCKED(sc);
+   /* Configure DMA burst length and priorities */
+   val = awg_burst_len << BASIC_CTL_BURST_LEN_SHIFT;
+   if (awg_rx_tx_pri)
+   val |= BASIC_CTL_RX_TX_PRI;
+   WR4(sc, EMAC_BASIC_CTL_1, val);
+
+}
+
+static void
+awg_enable_mac(struct awg_softc *sc, bool enable)
+{
+   uint32_t tx, rx;
+
+   AWG_ASSERT_LOCKED(sc);
+
+   tx = RD4(sc, EMAC_TX_CTL_0);
+   rx = RD4(sc, EMAC_RX_CTL_0);
+   if (enable) {
+   tx |= TX_EN;
+   rx |= RX_EN | CHECK_CRC;
+   } else {
+   tx &= ~TX_EN;
+   rx &= ~(RX_EN | CHECK_CRC);
+   }
+
+   WR4(sc, EMAC_TX_CTL_0, tx);
+   WR4(sc, EMAC_RX_CTL_0, rx);
+}
+
+static void 
+awg_get_eaddr(device_t dev, uint8_t *eaddr)
+{
+   struct awg_softc *sc;
+   uint32_t maclo, machi, rnd;
+   u_char rootkey[16];
+   uint32_t rootkey_size;
+
+   sc = device_get_softc(dev);
+
+   machi = RD4(sc, EMAC_ADDR_HIGH(0)) & 0x;
+   maclo = RD4(sc, EMAC_ADDR_LOW(0));
+
+   rootkey_size = sizeof(rootkey);
+   if (maclo == 0x && machi == 0x) {
+   /* MAC address in hardware is invalid, create one */
+   if (aw_sid_get_fuse(AW_SID_FUSE_ROOTKEY, rootkey,
+   _size) == 0 &&
+   (rootkey[3] | rootkey[12] | rootkey[13] | rootkey[14] |
+rootkey[15]) != 0) {
+   /* MAC address is derived from the root key in SID */
+   maclo = (rootkey[13] << 24) | 

svn commit: r367882 - head/sys/dev/dwc

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:29:20 2020
New Revision: 367882
URL: https://svnweb.freebsd.org/changeset/base/367882

Log:
  if_dwc: dwc_get_hwaddr cannot fail, change return to void
  
  No functional changes intended

Modified:
  head/sys/dev/dwc/if_dwc.c

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:29:00 2020(r367881)
+++ head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:29:20 2020(r367882)
@@ -1153,7 +1153,7 @@ out:
return (0);
 }
 
-static int
+static void
 dwc_get_hwaddr(struct dwc_softc *sc, uint8_t *hwaddr)
 {
uint32_t hi, lo, rnd;
@@ -1185,8 +1185,6 @@ dwc_get_hwaddr(struct dwc_softc *sc, uint8_t *hwaddr)
hwaddr[4] = rnd >>  8;
hwaddr[5] = rnd >>  0;
}
-
-   return (0);
 }
 
 #defineGPIO_ACTIVE_LOW 1
@@ -1336,10 +1334,7 @@ dwc_attach(device_t dev)
}
 
/* Read MAC before reset */
-   if (dwc_get_hwaddr(sc, macaddr)) {
-   device_printf(sc->dev, "can't get mac\n");
-   return (ENXIO);
-   }
+   dwc_get_hwaddr(sc, macaddr);
 
/* Reset the PHY if needed */
if (dwc_reset(dev) != 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: r367881 - head/sys/dev/dwc

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:29:00 2020
New Revision: 367881
URL: https://svnweb.freebsd.org/changeset/base/367881

Log:
  if_dwc: Add dwc_stop_dma and use it in dwc_stop_locked
  
  No functional changes intended

Modified:
  head/sys/dev/dwc/if_dwc.c

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:28:23 2020(r367880)
+++ head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:29:00 2020(r367881)
@@ -214,6 +214,7 @@ static void dwc_setup_rxfilter(struct dwc_softc *sc);
 static void dwc_setup_core(struct dwc_softc *sc);
 static void dwc_enable_mac(struct dwc_softc *sc, bool enable);
 static void dwc_init_dma(struct dwc_softc *sc);
+static void dwc_stop_dma(struct dwc_softc *sc);
 
 static inline uint32_t
 next_rxidx(struct dwc_softc *sc, uint32_t curidx)
@@ -359,7 +360,6 @@ static void
 dwc_stop_locked(struct dwc_softc *sc)
 {
struct ifnet *ifp;
-   uint32_t reg;
 
DWC_ASSERT_LOCKED(sc);
 
@@ -370,22 +370,8 @@ dwc_stop_locked(struct dwc_softc *sc)
 
callout_stop(>dwc_callout);
 
-   /* Stop DMA TX */
-   reg = READ4(sc, OPERATION_MODE);
-   reg &= ~(MODE_ST);
-   WRITE4(sc, OPERATION_MODE, reg);
-
-   /* Flush TX */
-   reg = READ4(sc, OPERATION_MODE);
-   reg |= (MODE_FTF);
-   WRITE4(sc, OPERATION_MODE, reg);
-
+   dwc_stop_dma(sc);
dwc_enable_mac(sc, false);
-
-   /* Stop DMA RX */
-   reg = READ4(sc, OPERATION_MODE);
-   reg &= ~(MODE_SR);
-   WRITE4(sc, OPERATION_MODE, reg);
 }
 
 static void dwc_clear_stats(struct dwc_softc *sc)
@@ -816,6 +802,29 @@ dwc_init_dma(struct dwc_softc *sc)
/* Start DMA */
reg = READ4(sc, OPERATION_MODE);
reg |= (MODE_ST | MODE_SR);
+   WRITE4(sc, OPERATION_MODE, reg);
+}
+
+static void
+dwc_stop_dma(struct dwc_softc *sc)
+{
+   uint32_t reg;
+
+   DWC_ASSERT_LOCKED(sc);
+
+   /* Stop DMA TX */
+   reg = READ4(sc, OPERATION_MODE);
+   reg &= ~(MODE_ST);
+   WRITE4(sc, OPERATION_MODE, reg);
+
+   /* Flush TX */
+   reg = READ4(sc, OPERATION_MODE);
+   reg |= (MODE_FTF);
+   WRITE4(sc, OPERATION_MODE, reg);
+
+   /* Stop DMA RX */
+   reg = READ4(sc, OPERATION_MODE);
+   reg &= ~(MODE_SR);
WRITE4(sc, OPERATION_MODE, reg);
 }
 
___
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: r367880 - head/sys/arm/allwinner

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:28:23 2020
New Revision: 367880
URL: https://svnweb.freebsd.org/changeset/base/367880

Log:
  if_awg: Add awg_stop_dma and use it in awg_stop
  
  No functional changes intended

Modified:
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Fri Nov 20 11:28:06 2020
(r367879)
+++ head/sys/arm/allwinner/if_awg.c Fri Nov 20 11:28:23 2020
(r367880)
@@ -781,6 +781,31 @@ awg_init_dma(struct awg_softc *sc)
 }
 
 static void
+awg_stop_dma(struct awg_softc *sc)
+{
+   uint32_t val;
+
+   AWG_ASSERT_LOCKED(sc);
+
+   /* Stop transmit DMA and flush data in the TX FIFO */
+   val = RD4(sc, EMAC_TX_CTL_1);
+   val &= ~TX_DMA_EN;
+   val |= FLUSH_TX_FIFO;
+   WR4(sc, EMAC_TX_CTL_1, val);
+
+   /* Disable interrupts */
+   awg_disable_dma_intr(sc);
+
+   /* Disable transmit DMA */
+   val = RD4(sc, EMAC_TX_CTL_1);
+   WR4(sc, EMAC_TX_CTL_1, val & ~TX_DMA_EN);
+
+   /* Disable receive DMA */
+   val = RD4(sc, EMAC_RX_CTL_1);
+   WR4(sc, EMAC_RX_CTL_1, val & ~RX_DMA_EN);
+}
+
+static void
 awg_init_locked(struct awg_softc *sc)
 {
struct mii_data *mii;
@@ -830,24 +855,8 @@ awg_stop(struct awg_softc *sc)
 
callout_stop(>stat_ch);
 
-   /* Stop transmit DMA and flush data in the TX FIFO */
-   val = RD4(sc, EMAC_TX_CTL_1);
-   val &= ~TX_DMA_EN;
-   val |= FLUSH_TX_FIFO;
-   WR4(sc, EMAC_TX_CTL_1, val);
-
+   awg_stop_dma(sc);
awg_enable_mac(sc, false);
-
-   /* Disable interrupts */
-   awg_disable_dma_intr(sc);
-
-   /* Disable transmit DMA */
-   val = RD4(sc, EMAC_TX_CTL_1);
-   WR4(sc, EMAC_TX_CTL_1, val & ~TX_DMA_EN);
-
-   /* Disable receive DMA */
-   val = RD4(sc, EMAC_RX_CTL_1);
-   WR4(sc, EMAC_RX_CTL_1, val & ~RX_DMA_EN);
 
sc->link = 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: r367879 - head/sys/dev/dwc

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:28:06 2020
New Revision: 367879
URL: https://svnweb.freebsd.org/changeset/base/367879

Log:
  if_dwc: Use dwc_enable_mac in dwc_stop_locked
  
  No functional changes intended

Modified:
  head/sys/dev/dwc/if_dwc.c

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:27:43 2020(r367878)
+++ head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:28:06 2020(r367879)
@@ -380,10 +380,7 @@ dwc_stop_locked(struct dwc_softc *sc)
reg |= (MODE_FTF);
WRITE4(sc, OPERATION_MODE, reg);
 
-   /* Stop transmitters */
-   reg = READ4(sc, MAC_CONFIGURATION);
-   reg &= ~(CONF_TE | CONF_RE);
-   WRITE4(sc, MAC_CONFIGURATION, reg);
+   dwc_enable_mac(sc, false);
 
/* Stop DMA RX */
reg = READ4(sc, OPERATION_MODE);
___
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: r367878 - head/sys/dev/dwc

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:27:43 2020
New Revision: 367878
URL: https://svnweb.freebsd.org/changeset/base/367878

Log:
  if_dwc: Add a function to enable/disable the mac tx/rx
  
  No functional changes intended

Modified:
  head/sys/dev/dwc/if_dwc.c

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:27:26 2020(r367877)
+++ head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:27:43 2020(r367878)
@@ -212,6 +212,7 @@ static void dwc_rxfinish_locked(struct dwc_softc *sc);
 static void dwc_stop_locked(struct dwc_softc *sc);
 static void dwc_setup_rxfilter(struct dwc_softc *sc);
 static void dwc_setup_core(struct dwc_softc *sc);
+static void dwc_enable_mac(struct dwc_softc *sc, bool enable);
 static void dwc_init_dma(struct dwc_softc *sc);
 
 static inline uint32_t
@@ -483,6 +484,7 @@ dwc_init_locked(struct dwc_softc *sc)
 
dwc_setup_rxfilter(sc);
dwc_setup_core(sc);
+   dwc_enable_mac(sc, true);
dwc_init_dma(sc);
 
if_setdrvflagbits(ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE);
@@ -778,10 +780,23 @@ dwc_setup_core(struct dwc_softc *sc)
 
DWC_ASSERT_LOCKED(sc);
 
-   /* Enable transmitters */
+   /* Enable core */
reg = READ4(sc, MAC_CONFIGURATION);
reg |= (CONF_JD | CONF_ACS | CONF_BE);
-   reg |= (CONF_TE | CONF_RE);
+   WRITE4(sc, MAC_CONFIGURATION, reg);
+}
+
+static void
+dwc_enable_mac(struct dwc_softc *sc, bool enable)
+{
+   uint32_t reg;
+
+   DWC_ASSERT_LOCKED(sc);
+   reg = READ4(sc, MAC_CONFIGURATION);
+   if (enable)
+   reg |= CONF_TE | CONF_RE;
+   else
+   reg &= ~(CONF_TE | CONF_RE);
WRITE4(sc, MAC_CONFIGURATION, reg);
 }
 
___
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: r367877 - head/sys/arm/allwinner

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:27:26 2020
New Revision: 367877
URL: https://svnweb.freebsd.org/changeset/base/367877

Log:
  if_awg: Add a function to enable/disable the mac tx/rx
  
  No functional changes intended

Modified:
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Fri Nov 20 11:27:08 2020
(r367876)
+++ head/sys/arm/allwinner/if_awg.c Fri Nov 20 11:27:26 2020
(r367877)
@@ -716,15 +716,30 @@ awg_setup_core(struct awg_softc *sc)
val |= BASIC_CTL_RX_TX_PRI;
WR4(sc, EMAC_BASIC_CTL_1, val);
 
-   /* Enable transmitter */
-   val = RD4(sc, EMAC_TX_CTL_0);
-   WR4(sc, EMAC_TX_CTL_0, val | TX_EN);
+}
 
-   /* Enable receiver */
-   val = RD4(sc, EMAC_RX_CTL_0);
-   WR4(sc, EMAC_RX_CTL_0, val | RX_EN | CHECK_CRC);
+static void
+awg_enable_mac(struct awg_softc *sc, bool enable)
+{
+   uint32_t tx, rx;
+
+   AWG_ASSERT_LOCKED(sc);
+
+   tx = RD4(sc, EMAC_TX_CTL_0);
+   rx = RD4(sc, EMAC_RX_CTL_0);
+   if (enable) {
+   tx |= TX_EN;
+   rx |= RX_EN | CHECK_CRC;
+   } else {
+   tx &= ~TX_EN;
+   rx &= ~(RX_EN | CHECK_CRC);
+   }
+
+   WR4(sc, EMAC_TX_CTL_0, tx);
+   WR4(sc, EMAC_RX_CTL_0, rx);
 }
 
+
 static void
 awg_enable_dma_intr(struct awg_softc *sc)
 {
@@ -781,6 +796,7 @@ awg_init_locked(struct awg_softc *sc)
 
awg_setup_rxfilter(sc);
awg_setup_core(sc);
+   awg_enable_mac(sc, true);
awg_init_dma(sc);
 
if_setdrvflagbits(ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE);
@@ -820,13 +836,7 @@ awg_stop(struct awg_softc *sc)
val |= FLUSH_TX_FIFO;
WR4(sc, EMAC_TX_CTL_1, val);
 
-   /* Disable transmitter */
-   val = RD4(sc, EMAC_TX_CTL_0);
-   WR4(sc, EMAC_TX_CTL_0, val & ~TX_EN);
-
-   /* Disable receiver */
-   val = RD4(sc, EMAC_RX_CTL_0);
-   WR4(sc, EMAC_RX_CTL_0, val & ~RX_EN);
+   awg_enable_mac(sc, false);
 
/* Disable interrupts */
awg_disable_dma_intr(sc);
___
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: r367876 - head/sys/dev/dwc

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:27:08 2020
New Revision: 367876
URL: https://svnweb.freebsd.org/changeset/base/367876

Log:
  if_dwc: Use if_setdrvflagbits to notify that we are running
  
  No functional changes intended

Modified:
  head/sys/dev/dwc/if_dwc.c

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:26:46 2020(r367875)
+++ head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:27:08 2020(r367876)
@@ -481,11 +481,11 @@ dwc_init_locked(struct dwc_softc *sc)
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
return;
 
-   ifp->if_drv_flags |= IFF_DRV_RUNNING;
-
dwc_setup_rxfilter(sc);
dwc_setup_core(sc);
dwc_init_dma(sc);
+
+   if_setdrvflagbits(ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE);
 
/*
 * Call mii_mediachg() which will call back into dwc_miibus_statchg()
___
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: r367875 - head/sys/dev/dwc

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:26:46 2020
New Revision: 367875
URL: https://svnweb.freebsd.org/changeset/base/367875

Log:
  if_dwc: Split init code into sub function
  
  Be clear of what we enable or init.
  
  No functional changes intended

Modified:
  head/sys/dev/dwc/if_dwc.c

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:26:20 2020(r367874)
+++ head/sys/dev/dwc/if_dwc.c   Fri Nov 20 11:26:46 2020(r367875)
@@ -211,6 +211,8 @@ static void dwc_txfinish_locked(struct dwc_softc *sc);
 static void dwc_rxfinish_locked(struct dwc_softc *sc);
 static void dwc_stop_locked(struct dwc_softc *sc);
 static void dwc_setup_rxfilter(struct dwc_softc *sc);
+static void dwc_setup_core(struct dwc_softc *sc);
+static void dwc_init_dma(struct dwc_softc *sc);
 
 static inline uint32_t
 next_rxidx(struct dwc_softc *sc, uint32_t curidx)
@@ -473,7 +475,6 @@ static void
 dwc_init_locked(struct dwc_softc *sc)
 {
struct ifnet *ifp = sc->ifp;
-   uint32_t reg;
 
DWC_ASSERT_LOCKED(sc);
 
@@ -483,27 +484,9 @@ dwc_init_locked(struct dwc_softc *sc)
ifp->if_drv_flags |= IFF_DRV_RUNNING;
 
dwc_setup_rxfilter(sc);
+   dwc_setup_core(sc);
+   dwc_init_dma(sc);
 
-   /* Initializa DMA and enable transmitters */
-   reg = READ4(sc, OPERATION_MODE);
-   reg |= (MODE_TSF | MODE_OSF | MODE_FUF);
-   reg &= ~(MODE_RSF);
-   reg |= (MODE_RTC_LEV32 << MODE_RTC_SHIFT);
-   WRITE4(sc, OPERATION_MODE, reg);
-
-   WRITE4(sc, INTERRUPT_ENABLE, INT_EN_DEFAULT);
-
-   /* Start DMA */
-   reg = READ4(sc, OPERATION_MODE);
-   reg |= (MODE_ST | MODE_SR);
-   WRITE4(sc, OPERATION_MODE, reg);
-
-   /* Enable transmitters */
-   reg = READ4(sc, MAC_CONFIGURATION);
-   reg |= (CONF_JD | CONF_ACS | CONF_BE);
-   reg |= (CONF_TE | CONF_RE);
-   WRITE4(sc, MAC_CONFIGURATION, reg);
-
/*
 * Call mii_mediachg() which will call back into dwc_miibus_statchg()
 * to set up the remaining config registers based on current media.
@@ -786,6 +769,42 @@ dwc_setup_rxfilter(struct dwc_softc *sc)
for (i = 0; i < nhash; i++)
WRITE4(sc, HASH_TABLE_REG(i), ctx.hash[i]);
}
+}
+
+static void
+dwc_setup_core(struct dwc_softc *sc)
+{
+   uint32_t reg;
+
+   DWC_ASSERT_LOCKED(sc);
+
+   /* Enable transmitters */
+   reg = READ4(sc, MAC_CONFIGURATION);
+   reg |= (CONF_JD | CONF_ACS | CONF_BE);
+   reg |= (CONF_TE | CONF_RE);
+   WRITE4(sc, MAC_CONFIGURATION, reg);
+}
+
+static void
+dwc_init_dma(struct dwc_softc *sc)
+{
+   uint32_t reg;
+
+   DWC_ASSERT_LOCKED(sc);
+
+   /* Initializa DMA and enable transmitters */
+   reg = READ4(sc, OPERATION_MODE);
+   reg |= (MODE_TSF | MODE_OSF | MODE_FUF);
+   reg &= ~(MODE_RSF);
+   reg |= (MODE_RTC_LEV32 << MODE_RTC_SHIFT);
+   WRITE4(sc, OPERATION_MODE, reg);
+
+   WRITE4(sc, INTERRUPT_ENABLE, INT_EN_DEFAULT);
+
+   /* Start DMA */
+   reg = READ4(sc, OPERATION_MODE);
+   reg |= (MODE_ST | MODE_SR);
+   WRITE4(sc, OPERATION_MODE, reg);
 }
 
 static int
___
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: r367874 - head/sys/arm/allwinner

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:26:20 2020
New Revision: 367874
URL: https://svnweb.freebsd.org/changeset/base/367874

Log:
  if_awg: Split init code into sub function
  
  Be clear of what we enable or init.
  
  No functional changes intended

Modified:
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Fri Nov 20 11:25:54 2020
(r367873)
+++ head/sys/arm/allwinner/if_awg.c Fri Nov 20 11:26:20 2020
(r367874)
@@ -705,50 +705,55 @@ awg_setup_rxfilter(struct awg_softc *sc)
 }
 
 static void
-awg_enable_intr(struct awg_softc *sc)
+awg_setup_core(struct awg_softc *sc)
 {
+   uint32_t val;
+
+   AWG_ASSERT_LOCKED(sc);
+   /* Configure DMA burst length and priorities */
+   val = awg_burst_len << BASIC_CTL_BURST_LEN_SHIFT;
+   if (awg_rx_tx_pri)
+   val |= BASIC_CTL_RX_TX_PRI;
+   WR4(sc, EMAC_BASIC_CTL_1, val);
+
+   /* Enable transmitter */
+   val = RD4(sc, EMAC_TX_CTL_0);
+   WR4(sc, EMAC_TX_CTL_0, val | TX_EN);
+
+   /* Enable receiver */
+   val = RD4(sc, EMAC_RX_CTL_0);
+   WR4(sc, EMAC_RX_CTL_0, val | RX_EN | CHECK_CRC);
+}
+
+static void
+awg_enable_dma_intr(struct awg_softc *sc)
+{
/* Enable interrupts */
WR4(sc, EMAC_INT_EN, RX_INT_EN | TX_INT_EN | TX_BUF_UA_INT_EN);
 }
 
 static void
-awg_disable_intr(struct awg_softc *sc)
+awg_disable_dma_intr(struct awg_softc *sc)
 {
/* Disable interrupts */
WR4(sc, EMAC_INT_EN, 0);
 }
 
 static void
-awg_init_locked(struct awg_softc *sc)
+awg_init_dma(struct awg_softc *sc)
 {
-   struct mii_data *mii;
uint32_t val;
-   if_t ifp;
 
-   mii = device_get_softc(sc->miibus);
-   ifp = sc->ifp;
-
AWG_ASSERT_LOCKED(sc);
 
-   if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
-   return;
-
-   awg_setup_rxfilter(sc);
-
-   /* Configure DMA burst length and priorities */
-   val = awg_burst_len << BASIC_CTL_BURST_LEN_SHIFT;
-   if (awg_rx_tx_pri)
-   val |= BASIC_CTL_RX_TX_PRI;
-   WR4(sc, EMAC_BASIC_CTL_1, val);
-
/* Enable interrupts */
 #ifdef DEVICE_POLLING
-   if ((if_getcapenable(ifp) & IFCAP_POLLING) == 0)
-   awg_enable_intr(sc);
+   if ((if_getcapenable(sc->ifp) & IFCAP_POLLING) == 0)
+   awg_enable_dma_intr(sc);
else
-   awg_disable_intr(sc);
+   awg_disable_dma_intr(sc);
 #else
-   awg_enable_intr(sc);
+   awg_enable_dma_intr(sc);
 #endif
 
/* Enable transmit DMA */
@@ -758,15 +763,26 @@ awg_init_locked(struct awg_softc *sc)
/* Enable receive DMA */
val = RD4(sc, EMAC_RX_CTL_1);
WR4(sc, EMAC_RX_CTL_1, val | RX_DMA_EN | RX_MD);
+}
 
-   /* Enable transmitter */
-   val = RD4(sc, EMAC_TX_CTL_0);
-   WR4(sc, EMAC_TX_CTL_0, val | TX_EN);
+static void
+awg_init_locked(struct awg_softc *sc)
+{
+   struct mii_data *mii;
+   if_t ifp;
 
-   /* Enable receiver */
-   val = RD4(sc, EMAC_RX_CTL_0);
-   WR4(sc, EMAC_RX_CTL_0, val | RX_EN | CHECK_CRC);
+   mii = device_get_softc(sc->miibus);
+   ifp = sc->ifp;
 
+   AWG_ASSERT_LOCKED(sc);
+
+   if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
+   return;
+
+   awg_setup_rxfilter(sc);
+   awg_setup_core(sc);
+   awg_init_dma(sc);
+
if_setdrvflagbits(ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE);
 
mii_mediachg(mii);
@@ -813,7 +829,7 @@ awg_stop(struct awg_softc *sc)
WR4(sc, EMAC_RX_CTL_0, val & ~RX_EN);
 
/* Disable interrupts */
-   awg_disable_intr(sc);
+   awg_disable_dma_intr(sc);
 
/* Disable transmit DMA */
val = RD4(sc, EMAC_TX_CTL_1);
@@ -1101,13 +1117,13 @@ awg_ioctl(if_t ifp, u_long cmd, caddr_t data)
if (error != 0)
break;
AWG_LOCK(sc);
-   awg_disable_intr(sc);
+   awg_disable_dma_intr(sc);
if_setcapenablebit(ifp, IFCAP_POLLING, 0);
AWG_UNLOCK(sc);
} else {
error = ether_poll_deregister(ifp);
AWG_LOCK(sc);
-   awg_enable_intr(sc);
+   awg_enable_dma_intr(sc);
if_setcapenablebit(ifp, 0, IFCAP_POLLING);
AWG_UNLOCK(sc);
}
___
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: r367873 - head/sys/arm/allwinner

2020-11-20 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 20 11:25:54 2020
New Revision: 367873
URL: https://svnweb.freebsd.org/changeset/base/367873

Log:
  if_awg: Remove the taskqueue for miibus_statchg
  
  I guess it was added so we can obtain the device lock but we already
  have it when the function is called.
  
  No functional changes intended

Modified:
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Fri Nov 20 10:48:19 2020
(r367872)
+++ head/sys/arm/allwinner/if_awg.c Fri Nov 20 11:25:54 2020
(r367873)
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -199,7 +198,6 @@ struct awg_softc {
device_tdev;
device_tmiibus;
struct callout  stat_ch;
-   struct task link_task;
void*ih;
u_int   mdc_div_ratio_m;
int link;
@@ -284,11 +282,14 @@ awg_miibus_writereg(device_t dev, int phy, int reg, in
 }
 
 static void
-awg_update_link_locked(struct awg_softc *sc)
+awg_miibus_statchg(device_t dev)
 {
+   struct awg_softc *sc;
struct mii_data *mii;
uint32_t val;
 
+   sc = device_get_softc(dev);
+
AWG_ASSERT_LOCKED(sc);
 
if ((if_getdrvflags(sc->ifp) & IFF_DRV_RUNNING) == 0)
@@ -346,28 +347,6 @@ awg_update_link_locked(struct awg_softc *sc)
 }
 
 static void
-awg_link_task(void *arg, int pending)
-{
-   struct awg_softc *sc;
-
-   sc = arg;
-
-   AWG_LOCK(sc);
-   awg_update_link_locked(sc);
-   AWG_UNLOCK(sc);
-}
-
-static void
-awg_miibus_statchg(device_t dev)
-{
-   struct awg_softc *sc;
-
-   sc = device_get_softc(dev);
-
-   taskqueue_enqueue(taskqueue_swi, >link_task);
-}
-
-static void
 awg_media_status(if_t ifp, struct ifmediareq *ifmr)
 {
struct awg_softc *sc;
@@ -1873,7 +1852,6 @@ awg_attach(device_t dev)
 
mtx_init(>mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF);
callout_init_mtx(>stat_ch, >mtx, 0);
-   TASK_INIT(>link_task, 0, awg_link_task, sc);
 
/* Setup clocks and regulators */
error = awg_setup_extres(dev);
___
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: r367869 - head/tests/sys/netpfil/pf

2020-11-20 Thread Kristof Provost
Author: kp
Date: Fri Nov 20 10:11:03 2020
New Revision: 367869
URL: https://svnweb.freebsd.org/changeset/base/367869

Log:
  pf tests: Basic source tracking test
  
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D27255

Added:
  head/tests/sys/netpfil/pf/src_track.sh   (contents, props changed)
Modified:
  head/tests/sys/netpfil/pf/Makefile

Modified: head/tests/sys/netpfil/pf/Makefile
==
--- head/tests/sys/netpfil/pf/Makefile  Fri Nov 20 10:09:48 2020
(r367868)
+++ head/tests/sys/netpfil/pf/Makefile  Fri Nov 20 10:11:03 2020
(r367869)
@@ -12,6 +12,7 @@ ATF_TESTS_SH+=anchor \
names \
nat \
set_tos \
+   src_track \
rdr \
route_to \
synproxy \

Added: head/tests/sys/netpfil/pf/src_track.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/pf/src_track.sh  Fri Nov 20 10:11:03 2020
(r367869)
@@ -0,0 +1,66 @@
+# $FreeBSD$
+#
+# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+#
+# Copyright (c) 2020 Kristof Provost 
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+. $(atf_get_srcdir)/utils.subr
+
+atf_test_case "source_track" "cleanup"
+source_track_head()
+{
+   atf_set descr 'Basic source tracking test'
+   atf_set require.user root
+}
+
+source_track_body()
+{
+   pft_init
+
+   epair=$(vnet_mkepair)
+
+   vnet_mkjail alcatraz ${epair}b
+
+   ifconfig ${epair}a 192.0.2.2/24 up
+   jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up
+
+   # Enable pf!
+   jexec alcatraz pfctl -e
+   pft_set_rules alcatraz \
+   "pass in keep state (source-track)" \
+   "pass out keep state (source-track)"
+
+   ping -c 3 192.0.2.1
+   jexec alcatraz pfctl -s all -v
+}
+
+source_track_cleanup()
+{
+   pft_cleanup
+}
+
+atf_init_test_cases()
+{
+   atf_add_test_case "source_track"
+}
___
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: r367867 - head/sys/netpfil/pf

2020-11-20 Thread Kristof Provost
Author: kp
Date: Fri Nov 20 10:08:33 2020
New Revision: 367867
URL: https://svnweb.freebsd.org/changeset/base/367867

Log:
  pf: Fix incorrect assertion
  
  We never set PFRULE_RULESRCTRACK when calling pf_insert_src_node(). We do set
  PFRULE_SRCTRACK, so update the assertion to match.
  
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D27254

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cFri Nov 20 09:56:46 2020(r367866)
+++ head/sys/netpfil/pf/pf.cFri Nov 20 10:08:33 2020(r367867)
@@ -705,7 +705,7 @@ pf_insert_src_node(struct pf_src_node **sn, struct pf_
 struct pf_addr *src, sa_family_t af)
 {
 
-   KASSERT((rule->rule_flag & PFRULE_RULESRCTRACK ||
+   KASSERT((rule->rule_flag & PFRULE_SRCTRACK ||
rule->rpool.opts & PF_POOL_STICKYADDR),
("%s for non-tracking rule %p", __func__, rule));
 
___
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: r367866 - head/usr.bin/grep

2020-11-20 Thread Eugene Grosbein
Author: eugen
Date: Fri Nov 20 09:56:46 2020
New Revision: 367866
URL: https://svnweb.freebsd.org/changeset/base/367866

Log:
  bzgrep: make flag --no-filename work
  
  PR:   248813
  MFC after:1 week

Modified:
  head/usr.bin/grep/zgrep.sh

Modified: head/usr.bin/grep/zgrep.sh
==
--- head/usr.bin/grep/zgrep.sh  Fri Nov 20 09:05:36 2020(r367865)
+++ head/usr.bin/grep/zgrep.sh  Fri Nov 20 09:56:46 2020(r367866)
@@ -90,6 +90,10 @@ do
pattern_found=1
shift
;;
+   -h|--no-filename)
+   silent=1
+   shift
+   ;;
--*)
grep_args="${grep_args} $1"
shift
@@ -118,10 +122,6 @@ do
;;
-)
hyphen=1
-   shift
-   ;;
-   -h)
-   silent=1
shift
;;
-r|-R)
___
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: r367865 - head/sys/kern

2020-11-20 Thread Michal Meloun
Author: mmel
Date: Fri Nov 20 09:05:36 2020
New Revision: 367865
URL: https://svnweb.freebsd.org/changeset/base/367865

Log:
  Also pass interrupt binding request to non-root interrupt controllers.
  There are message based controllers that can bind interrupts even if they are
  not implemented as root controllers (such as the ITS subblock of GIC).
  
  MFC after:3 weeks

Modified:
  head/sys/kern/subr_intr.c

Modified: head/sys/kern/subr_intr.c
==
--- head/sys/kern/subr_intr.c   Fri Nov 20 08:07:29 2020(r367864)
+++ head/sys/kern/subr_intr.c   Fri Nov 20 09:05:36 2020(r367865)
@@ -588,9 +588,6 @@ intr_isrc_assign_cpu(void *arg, int cpu)
struct intr_irqsrc *isrc = arg;
int error;
 
-   if (isrc->isrc_dev != intr_irq_root_dev)
-   return (EINVAL);
-
mtx_lock(_table_lock);
if (cpu == NOCPU) {
CPU_ZERO(>isrc_cpu);
___
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"