Re: svn commit: r364989 - head/sys/dev/jedec_dimm

2020-08-31 Thread Andriy Gapon
On 31/08/2020 18:03, Eric van Gyzen wrote:
> Author: vangyzen
> Date: Mon Aug 31 15:03:23 2020
> New Revision: 364989
> URL: https://svnweb.freebsd.org/changeset/base/364989
> 
> Log:
>   jedec_dimm: fix array overrun
>   
>   Coverity detected the overrunning of sc->part_str.
>   
>   Submitted by:   bret_ketc...@dell.com
>   Reported by:Coverity
>   MFC after:  2 weeks
>   Sponsored by:   Dell EMC Isilon
>   Differential Revision:  https://reviews.freebsd.org/D26145
> 
> Modified:
>   head/sys/dev/jedec_dimm/jedec_dimm.c
> 
> Modified: head/sys/dev/jedec_dimm/jedec_dimm.c
> ==
> --- head/sys/dev/jedec_dimm/jedec_dimm.c  Mon Aug 31 14:47:23 2020
> (r364988)
> +++ head/sys/dev/jedec_dimm/jedec_dimm.c  Mon Aug 31 15:03:23 2020
> (r364989)
> @@ -795,7 +795,7 @@ jedec_dimm_field_to_str(struct jedec_dimm_softc *sc, c
>  
>   /* If we're dealing with ASCII, convert trailing spaces to NULs. */
>   if (ascii) {
> - for (i = dstsz; i > 0; i--) {
> + for (i = dstsz - 1; i > 0; i--) {

If 'i' is an index into the array, then shouldn't the condition be 
greater-equal?


>   if (dst[i] == ' ') {
>   dst[i] = 0;
>   } else if (dst[i] == 0) {
> 


-- 
Andriy Gapon
___
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: r364989 - head/sys/dev/jedec_dimm

2020-08-31 Thread Ravi Pokala
-Original Message-
From:  on behalf of Eric van Gyzen 

Date: 2020-08-31, Monday at 08:03
To: , , 

Subject: svn commit: r364989 - head/sys/dev/jedec_dimm

Author: vangyzen
Date: Mon Aug 31 15:03:23 2020
New Revision: 364989
URL: https://svnweb.freebsd.org/changeset/base/364989

Log:
  jedec_dimm: fix array overrun

  Coverity detected the overrunning of sc->part_str.

  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26145

Pointy-hat to: rpokala@

Bah, sorry, I completely missed this review. 

Thanks for the fix, Bret. Thanks for reviewing and committing it, Eric.

-Ravi (rpokala@)

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

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

==
--- head/sys/dev/jedec_dimm/jedec_dimm.cMon Aug 31 14:47:23 2020
(r364988)
+++ head/sys/dev/jedec_dimm/jedec_dimm.cMon Aug 31 15:03:23 2020
(r364989)
@@ -795,7 +795,7 @@ jedec_dimm_field_to_str(struct jedec_dimm_softc *sc, c

/* If we're dealing with ASCII, convert trailing spaces to NULs. */
if (ascii) {
-   for (i = dstsz; i > 0; i--) {
+   for (i = dstsz - 1; i > 0; i--) {
if (dst[i] == ' ') {
dst[i] = 0;
} else if (dst[i] == 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: r365022 - head/sys/libkern

2020-08-31 Thread Warner Losh
Author: imp
Date: Tue Sep  1 04:37:55 2020
New Revision: 365022
URL: https://svnweb.freebsd.org/changeset/base/365022

Log:
  Smaller crc for the boot loader.
  
  Save 7k of text space by using simpler crc32 for standalone case. we
  don't need all that fancy optimization in the boot loader, so use a
  simplified version of the CRC function. We could save more by doing it
  one bit at a time rather than 32, but this is the biggest savings at
  the smallest performance hit.
  
  With LUA and verfied exec, gptboot, gptzfsboot and friends are pushing
  the ~530k limit and every little bit helps.
  
  Reviewed By: allanjude
  Differential Revision: https://reviews.freebsd.org/D24225

Modified:
  head/sys/libkern/gsb_crc32.c

Modified: head/sys/libkern/gsb_crc32.c
==
--- head/sys/libkern/gsb_crc32.cTue Sep  1 01:57:56 2020
(r365021)
+++ head/sys/libkern/gsb_crc32.cTue Sep  1 04:37:55 2020
(r365022)
@@ -227,6 +227,7 @@ singletable_crc32c(uint32_t crc, const void *buf, size
return crc;
 }
 
+#ifndef _STANDALONE
 
 /*
  * Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved
@@ -788,3 +789,10 @@ calculate_crc32c(uint32_t crc32c,
return (multitable_crc32c(crc32c, buffer, length));
}
 }
+#else
+uint32_t
+calculate_crc32c(uint32_t crc32c, const unsigned char *buffer, unsigned int 
length)
+{
+   return (singletable_crc32c(crc32c, buffer, length));
+}
+#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: r365021 - head/sys/powerpc/powerpc

2020-08-31 Thread Brandon Bergren
Author: bdragon
Date: Tue Sep  1 01:57:56 2020
New Revision: 365021
URL: https://svnweb.freebsd.org/changeset/base/365021

Log:
  [PowerPC] Remove unused openpic_set_priority().
  
  When SMP support for powerpc was added in r178628, the last callers of this
  function were removed. All code that needs to manipulate the task priority
  just does it directly instead.
  
  Noticed while reading through the lint logs.
  
  Sponsored by: Tag1 Consulting, Inc.

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

Modified: head/sys/powerpc/powerpc/openpic.c
==
--- head/sys/powerpc/powerpc/openpic.c  Tue Sep  1 01:12:55 2020
(r365020)
+++ head/sys/powerpc/powerpc/openpic.c  Tue Sep  1 01:57:56 2020
(r365021)
@@ -73,21 +73,6 @@ openpic_write(struct openpic_softc *sc, u_int reg, uin
bus_space_write_4(sc->sc_bt, sc->sc_bh, reg, val);
 }
 
-static __inline void
-openpic_set_priority(struct openpic_softc *sc, int pri)
-{
-   u_int tpr;
-   uint32_t x;
-
-   sched_pin();
-   tpr = OPENPIC_PCPU_TPR((sc->sc_dev == root_pic) ? PCPU_GET(cpuid) : 0);
-   x = openpic_read(sc, tpr);
-   x &= ~OPENPIC_TPR_MASK;
-   x |= pri;
-   openpic_write(sc, tpr, x);
-   sched_unpin();
-}
-
 int
 openpic_common_attach(device_t dev, uint32_t node)
 {
___
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: r365019 - head/sys/fs/nfsclient

2020-08-31 Thread Rick Macklem
Author: rmacklem
Date: Tue Sep  1 01:10:16 2020
New Revision: 365019
URL: https://svnweb.freebsd.org/changeset/base/365019

Log:
  Add a check to test for the case of the "tls" option being used with "udp".
  
  The KERN_TLS only supports TCP, so use of the "tls" option with "udp" will
  not work.  This patch adds a test for this case, so that the mount is not
  attempted when both "tls" and "udp" are specified.

Modified:
  head/sys/fs/nfsclient/nfs_clvfsops.c

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==
--- head/sys/fs/nfsclient/nfs_clvfsops.cTue Sep  1 00:14:40 2020
(r365018)
+++ head/sys/fs/nfsclient/nfs_clvfsops.cTue Sep  1 01:10:16 2020
(r365019)
@@ -1419,7 +1419,9 @@ mountnfs(struct nfs_args *argp, struct mount *mp, stru
if ((newflag & NFSMNT_TLS) != 0) {
error = EINVAL;
 #ifdef KERN_TLS
-   if (rpctls_getinfo(, true, false))
+   /* KERN_TLS is only supported for TCP. */
+   if (argp->sotype == SOCK_STREAM &&
+   rpctls_getinfo(, true, false))
error = 0;
 #endif
if (error != 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: r365018 - head

2020-08-31 Thread Ed Maste
Author: emaste
Date: Tue Sep  1 00:14:40 2020
New Revision: 365018
URL: https://svnweb.freebsd.org/changeset/base/365018

Log:
  Makefile.inc1: comment .endif to ease finding matching .if

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Aug 31 23:48:27 2020(r365017)
+++ head/Makefile.inc1  Tue Sep  1 00:14:40 2020(r365018)
@@ -1436,7 +1436,7 @@ distributeworld installworld stageworld: _installcheck
DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
${INSTALL_SYMLINK} ${INSTALLFLAGS} usr/src/sys ${INSTALL_DDIR}/base/sys
-.endif
+.endif # make(distributeworld)
${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
${IMAKEENV} rm -rf ${INSTALLTMP}
 .if make(distributeworld)
@@ -1465,7 +1465,7 @@ distributeworld installworld stageworld: _installcheck
${DESTDIR}/${DISTDIR}/${dist}.debug.meta
 .endfor
 .endif
-.endif
+.endif # make(distributeworld)
 
 packageworld: .PHONY
 .for dist in base ${EXTRA_DISTRIBUTIONS}
___
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: r365016 - head/sbin/devd

2020-08-31 Thread Warner Losh
Author: imp
Date: Mon Aug 31 23:48:23 2020
New Revision: 365016
URL: https://svnweb.freebsd.org/changeset/base/365016

Log:
  Add documentation for ETHERNET events.

Modified:
  head/sbin/devd/devd.conf.5

Modified: head/sbin/devd/devd.conf.5
==
--- head/sbin/devd/devd.conf.5  Mon Aug 31 23:31:16 2020(r365015)
+++ head/sbin/devd/devd.conf.5  Mon Aug 31 23:48:23 2020(r365016)
@@ -432,6 +432,14 @@ node is destroyed.
 .Pp
 .Bl -column "System" "Subsystem" "1234567" -compact
 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
+.It Li ETHERNET Ta Ar inet Ta IFATTACH Ta
+Notification when the default VNET instance of the
+.Ar inet
+interface is attached.
+.El
+.Pp
+.Bl -column "System" "Subsystem" "1234567" -compact
+.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
 .It Li GEOM Ta Ta Ta
 Events related to the
 .Xr geom 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: r365017 - head/sbin/devd

2020-08-31 Thread Warner Losh
Author: imp
Date: Mon Aug 31 23:48:27 2020
New Revision: 365017
URL: https://svnweb.freebsd.org/changeset/base/365017

Log:
  Sort IFNET alphabetically

Modified:
  head/sbin/devd/devd.conf.5

Modified: head/sbin/devd/devd.conf.5
==
--- head/sbin/devd/devd.conf.5  Mon Aug 31 23:48:23 2020(r365016)
+++ head/sbin/devd/devd.conf.5  Mon Aug 31 23:48:27 2020(r365017)
@@ -401,24 +401,6 @@ String containing the temperature of the core that has
 .Pp
 .Bl -column "System" "Subsystem" "1234567" -compact
 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
-.It Li IFNET
-.It Li IFNET Ta Ar inet Ta Ta
-The
-.Dq subsystem
-is the actual name of the network interface on which the event
-took place.
-.It Li IFNET Ta Ar inet Ta Li LINK_UP Ta
-Carrier status changed to UP.
-.It Li IFNET Ta Ar inet Ta Li LINK_DOWN Ta
-Carrier status changed to DOWN.
-.It Li IFNET Ta Ar inet Ta Li ATTACH Ta
-The network interface is attached to the system.
-.It Li IFNET Ta Ar inet Ta Li DETACH Ta
-The network interface is detached from the system.
-.El
-.Pp
-.Bl -column "System" "Subsystem" "1234567" -compact
-.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
 .It Li DEVFS
 .It Li DEVFS Ta Li CDEV Ta Li CREATE Ta
 The
@@ -471,12 +453,29 @@ provider size has changed.
 .Pp
 .Bl -column "System" "Subsystem" "1234567" -compact
 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
+.It Li IFNET
+.It Li IFNET Ta Ar inet Ta Ta
+The
+.Dq subsystem
+is the actual name of the network interface on which the event
+took place.
+.It Li IFNET Ta Ar inet Ta Li LINK_UP Ta
+Carrier status changed to UP.
+.It Li IFNET Ta Ar inet Ta Li LINK_DOWN Ta
+Carrier status changed to DOWN.
+.It Li IFNET Ta Ar inet Ta Li ATTACH Ta
+The network interface is attached to the system.
+.It Li IFNET Ta Ar inet Ta Li DETACH Ta
+The network interface is detached from the system.
+.El
+.Pp
+.Bl -column "System" "Subsystem" "1234567" -compact
+.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
 .It Li kern Ta Li power Ta Li resume Ta
 Notification that the system has woken from the suspended state.
 Note: this notification is deprecated and will be removed in
 .Fx 14.0 .
 .El
-.Pp
 .Pp
 .Bl -column "System" "Subsystem" "1234567" -compact
 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
___
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: r365015 - in head/sys/dev: an wi

2020-08-31 Thread Warner Losh
Author: imp
Date: Mon Aug 31 23:31:16 2020
New Revision: 365015
URL: https://svnweb.freebsd.org/changeset/base/365015

Log:
  Warn for the non pccard attachments
  
  These devices have non-pccard attachments. Warn for those as well. Both an and
  wi don't do the modern cyrpto needed to use these cards on secure wifi 
networks.
  an needs firmware from Cisco, which I don't think was ever produced. wi could
  in theory do it with raw frames and on-host encryption, but nobody has written
  that in the 15 years since WEP was cracked.
  
  MFC After: 3 days
  Noticed by: rgrimes
  Differential Revision: https://reviews.freebsd.org/D26138

Modified:
  head/sys/dev/an/if_an_isa.c
  head/sys/dev/an/if_an_pccard.c
  head/sys/dev/an/if_an_pci.c
  head/sys/dev/wi/if_wi_macio.c
  head/sys/dev/wi/if_wi_pccard.c
  head/sys/dev/wi/if_wi_pci.c

Modified: head/sys/dev/an/if_an_isa.c
==
--- head/sys/dev/an/if_an_isa.c Mon Aug 31 22:44:59 2020(r365014)
+++ head/sys/dev/an/if_an_isa.c Mon Aug 31 23:31:16 2020(r365015)
@@ -127,6 +127,7 @@ an_attach_isa(device_t dev)
an_release_resources(dev);
return (error);
}
+   gone_in_dev(dev, 13, "pccard removed, an doesn't support modern 
crypto");
return (0);
 }
 

Modified: head/sys/dev/an/if_an_pccard.c
==
--- head/sys/dev/an/if_an_pccard.c  Mon Aug 31 22:44:59 2020
(r365014)
+++ head/sys/dev/an/if_an_pccard.c  Mon Aug 31 23:31:16 2020
(r365015)
@@ -157,6 +157,6 @@ fail:
if (error)
an_release_resources(dev);
else
-   gone_in_dev(dev, 13, "pccard removed");
+   gone_in_dev(dev, 13, "pccard removed, an doesn't support modern 
crypto");
return (error);
 }

Modified: head/sys/dev/an/if_an_pci.c
==
--- head/sys/dev/an/if_an_pci.c Mon Aug 31 22:44:59 2020(r365014)
+++ head/sys/dev/an/if_an_pci.c Mon Aug 31 23:31:16 2020(r365015)
@@ -230,7 +230,8 @@ an_attach_pci(dev)
NULL, an_intr, sc, >irq_handle);
if (error)
device_printf(dev, "couldn't setup interrupt\n");
-
+   else
+   gone_in_dev(dev, 13, "pccard removed, an doesn't support modern 
crypto");
 fail:
if (error)
an_release_resources(dev);

Modified: head/sys/dev/wi/if_wi_macio.c
==
--- head/sys/dev/wi/if_wi_macio.c   Mon Aug 31 22:44:59 2020
(r365014)
+++ head/sys/dev/wi/if_wi_macio.c   Mon Aug 31 23:31:16 2020
(r365015)
@@ -142,6 +142,8 @@ wi_macio_attach(device_t dev)
error = wi_attach(dev);
if (error != 0)
wi_free(dev);
+   else
+   gone_in_dev(dev, 13, "pccard removed, wi doesn't 
support modern crypto");
}
return error;
 }

Modified: head/sys/dev/wi/if_wi_pccard.c
==
--- head/sys/dev/wi/if_wi_pccard.c  Mon Aug 31 22:44:59 2020
(r365014)
+++ head/sys/dev/wi/if_wi_pccard.c  Mon Aug 31 23:31:16 2020
(r365015)
@@ -200,7 +200,7 @@ wi_pccard_attach(device_t dev)
error = wi_attach(dev);
if (error != 0)
wi_free(dev);
-   gone_in_dev(dev, 13, "pccard removed");
+   gone_in_dev(dev, 13, "pccard removed, wi doesn't support modern 
crypto");
}
return error;
 }

Modified: head/sys/dev/wi/if_wi_pci.c
==
--- head/sys/dev/wi/if_wi_pci.c Mon Aug 31 22:44:59 2020(r365014)
+++ head/sys/dev/wi/if_wi_pci.c Mon Aug 31 23:31:16 2020(r365015)
@@ -233,6 +233,8 @@ wi_pci_attach(device_t dev)
error = wi_attach(dev);
if (error != 0)
wi_free(dev);
+   else
+   gone_in_dev(dev, 13, "pccard removed, wi doesn't support modern 
crypto");
return (error);
 }
 
___
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: r365014 - head/sys/dev/cxgbe

2020-08-31 Thread Navdeep Parhar
Author: np
Date: Mon Aug 31 22:44:59 2020
New Revision: 365014
URL: https://svnweb.freebsd.org/changeset/base/365014

Log:
  cxgbe(4): Check for descriptors before writing a TLS or raw work request.
  
  This fixes a regression in r362905.
  
  Submitted by: jhb@
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Mon Aug 31 21:57:01 2020(r365013)
+++ head/sys/dev/cxgbe/t4_sge.c Mon Aug 31 22:44:59 2020(r365014)
@@ -3004,6 +3004,14 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool
 
MPASS(rc != 0 && rc != EAGAIN);
MPASS(txp->npkt == 0);
+
+   n = tx_len16_to_desc(mbuf_len16(m0));
+   if (__predict_false(avail < n)) {
+   avail += reclaim_tx_descs(txq, min(n, 32));
+   if (avail < n)
+   break;  /* out of descriptors */
+   }
+
wr = >desc[eq->pidx];
if (mbuf_cflags(m0) & MC_RAW_WR) {
n = write_raw_wr(txq, wr, m0, avail);
@@ -3014,12 +3022,6 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool
avail);
 #endif
} else {
-   n = tx_len16_to_desc(mbuf_len16(m0));
-   if (__predict_false(avail < n)) {
-   avail += reclaim_tx_descs(txq, 32);
-   if (avail < n)
-   break;  /* out of descriptors */
-   }
ETHER_BPF_MTAP(ifp, m0);
if (sc->flags & IS_VF)
n = write_txpkt_vm_wr(sc, txq, m0);
___
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: r365013 - head/share/mk

2020-08-31 Thread John Baldwin
Author: jhb
Date: Mon Aug 31 21:57:01 2020
New Revision: 365013
URL: https://svnweb.freebsd.org/changeset/base/365013

Log:
  Suppress -Wempty-body warnings in GCC 6.x and later.
  
  libc++ in LLVM 11 uses an empty else clause in
  include/c++/v1/__thread_support which triggers this warning.
  
  Reviewed by:  dim, emaste
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D26257

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkMon Aug 31 21:55:25 2020(r365012)
+++ head/share/mk/bsd.sys.mkMon Aug 31 21:57:01 2020(r365013)
@@ -150,7 +150,8 @@ CWARNFLAGS+=-Wno-error=address  
\
 
 # GCC 6.1.0
 .if ${COMPILER_VERSION} >= 60100
-CWARNFLAGS+=   -Wno-error=maybe-uninitialized  \
+CWARNFLAGS+=   -Wno-error=empty-body   \
+   -Wno-error=maybe-uninitialized  \
-Wno-error=nonnull-compare  \
-Wno-error=redundant-decls  \
-Wno-error=shift-negative-value \
___
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: r365012 - head/lib/libc/gen

2020-08-31 Thread John Baldwin
Author: jhb
Date: Mon Aug 31 21:55:25 2020
New Revision: 365012
URL: https://svnweb.freebsd.org/changeset/base/365012

Log:
  Fix the build of scandir_b with GCC.
  
  Use explicit typedefs for block thunk structures as in r264143.
  
  Reviewed by:  kib, adrian
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D26256

Modified:
  head/lib/libc/gen/scandir.c

Modified: head/lib/libc/gen/scandir.c
==
--- head/lib/libc/gen/scandir.c Mon Aug 31 21:28:57 2020(r365011)
+++ head/lib/libc/gen/scandir.c Mon Aug 31 21:55:25 2020(r365012)
@@ -56,15 +56,18 @@ void qsort_b(void *, size_t, size_t, void *);
 #defineSELECT(x)   select(x)
 #endif
 
-#ifndef I_AM_SCANDIR_B
+#ifdef I_AM_SCANDIR_B
+typedef DECLARE_BLOCK(int, select_block, const struct dirent *);
+typedef DECLARE_BLOCK(int, dcomp_block, const struct dirent **,
+const struct dirent **);
+#else
 static int alphasort_thunk(void *thunk, const void *p1, const void *p2);
 #endif
 
 int
 #ifdef I_AM_SCANDIR_B
-scandir_b(const char *dirname, struct dirent ***namelist,
-DECLARE_BLOCK(int, select, const struct dirent *),
-DECLARE_BLOCK(int, dcomp, const struct dirent **, const struct dirent **))
+scandir_b(const char *dirname, struct dirent ***namelist, select_block select,
+dcomp_block dcomp)
 #else
 scandir(const char *dirname, struct dirent ***namelist,
 int (*select)(const struct dirent *), int (*dcomp)(const struct dirent **,
___
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: r365009 - in head: share/man/man4/man4.i386 sys/i386/bios

2020-08-31 Thread Warner Losh
Author: imp
Date: Mon Aug 31 21:04:00 2020
New Revision: 365009
URL: https://svnweb.freebsd.org/changeset/base/365009

Log:
  Add deprecation notice for apm BIOS
  
  Add deprecation notice for apm bios, aka the apm(4) device. The apm(8)
  command will remain, at least for a while, since ACPI emulates the apm
  ioctl interface.
  
  Discussed on: arch@
  Relnotes: yes
  MFC After: 3 days

Modified:
  head/share/man/man4/man4.i386/apm.4
  head/sys/i386/bios/apm.c

Modified: head/share/man/man4/man4.i386/apm.4
==
--- head/share/man/man4/man4.i386/apm.4 Mon Aug 31 20:02:32 2020
(r365008)
+++ head/share/man/man4/man4.i386/apm.4 Mon Aug 31 21:04:00 2020
(r365009)
@@ -19,6 +19,9 @@
 .Nd APM BIOS interface
 .Sh SYNOPSIS
 .Cd device apm
+.Sh DEPRECATION NOTICE
+This driver is scheduled for removal prior to the release of
+.Fx 13.0 .
 .Sh DESCRIPTION
 .Nm
 is an interface to the Intel / Microsoft APM (Advanced Power Management) BIOS

Modified: head/sys/i386/bios/apm.c
==
--- head/sys/i386/bios/apm.cMon Aug 31 20:02:32 2020(r365008)
+++ head/sys/i386/bios/apm.cMon Aug 31 21:04:00 2020(r365009)
@@ -1214,6 +1214,8 @@ apm_attach(device_t dev)
sc->sc_resume.ah_arg = sc;
apm_hook_establish(APM_HOOK_RESUME, >sc_resume);
 
+   gone_in_dev(dev, 13, "APM support has been removed.");
+
return 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: r365008 - head/share/man/man4

2020-08-31 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Mon Aug 31 20:02:32 2020
New Revision: 365008
URL: https://svnweb.freebsd.org/changeset/base/365008

Log:
  vtnet(4): improve the wording
  
  PR:   247936
  Submitted by: PauAmma 
  Reported by:  PauAmma 
  MFC after:7 days
  Differential Revision:https://reviews.freebsd.org/D26244

Modified:
  head/share/man/man4/vtnet.4

Modified: head/share/man/man4/vtnet.4
==
--- head/share/man/man4/vtnet.4 Mon Aug 31 19:59:05 2020(r365007)
+++ head/share/man/man4/vtnet.4 Mon Aug 31 20:02:32 2020(r365008)
@@ -49,7 +49,7 @@ The
 .Nm
 device driver provides support for VirtIO Ethernet devices.
 .Pp
-If the hypervisor advertises the appreciate features, the
+If the hypervisor advertises the appropriate features, the
 .Nm
 driver supports TCP/UDP checksum offload for both transmit and receive,
 TCP segmentation offload (TSO), TCP large receive offload (LRO),
___
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: r365006 - in head/tools/tools/tinybsd/conf: bridge default firewall minimal vpn wireless

2020-08-31 Thread Warner Losh
Author: imp
Date: Mon Aug 31 19:47:30 2020
New Revision: 365006
URL: https://svnweb.freebsd.org/changeset/base/365006

Log:
  gc pmtimer and apm
  
  pmtimer was removed from base some time ago. apm hasn't been relevant
  for these devices in a long time (and was commented out). Remove them
  both from these config files.

Modified:
  head/tools/tools/tinybsd/conf/bridge/TINYBSD
  head/tools/tools/tinybsd/conf/default/TINYBSD
  head/tools/tools/tinybsd/conf/firewall/TINYBSD
  head/tools/tools/tinybsd/conf/minimal/TINYBSD
  head/tools/tools/tinybsd/conf/vpn/TINYBSD
  head/tools/tools/tinybsd/conf/wireless/TINYBSD

Modified: head/tools/tools/tinybsd/conf/bridge/TINYBSD
==
--- head/tools/tools/tinybsd/conf/bridge/TINYBSDMon Aug 31 19:38:03 
2020(r365005)
+++ head/tools/tools/tinybsd/conf/bridge/TINYBSDMon Aug 31 19:47:30 
2020(r365006)
@@ -63,11 +63,6 @@ device   sc
 
 device agp # support several AGP chipsets
 
-# Power management support (see NOTES for more options)
-#deviceapm
-# Add suspend/resume support for the i8254.
-device pmtimer
-
 # PCCARD (PCMCIA) support
 # PCMCIA and cardbus bridge support
 device cbb # cardbus (yenta) bridge

Modified: head/tools/tools/tinybsd/conf/default/TINYBSD
==
--- head/tools/tools/tinybsd/conf/default/TINYBSD   Mon Aug 31 19:38:03 
2020(r365005)
+++ head/tools/tools/tinybsd/conf/default/TINYBSD   Mon Aug 31 19:47:30 
2020(r365006)
@@ -73,11 +73,6 @@ device   sc
 
 device agp # support several AGP chipsets
 
-# Power management support (see NOTES for more options)
-#deviceapm
-# Add suspend/resume support for the i8254.
-device pmtimer
-
 # PCCARD (PCMCIA) support
 # PCMCIA and cardbus bridge support
 device cbb # cardbus (yenta) bridge

Modified: head/tools/tools/tinybsd/conf/firewall/TINYBSD
==
--- head/tools/tools/tinybsd/conf/firewall/TINYBSD  Mon Aug 31 19:38:03 
2020(r365005)
+++ head/tools/tools/tinybsd/conf/firewall/TINYBSD  Mon Aug 31 19:47:30 
2020(r365006)
@@ -62,11 +62,6 @@ device   sc
 
 device agp # support several AGP chipsets
 
-# Power management support (see NOTES for more options)
-#deviceapm
-# Add suspend/resume support for the i8254.
-device pmtimer
-
 # PCCARD (PCMCIA) support
 # PCMCIA and cardbus bridge support
 #devicecbb # cardbus (yenta) bridge

Modified: head/tools/tools/tinybsd/conf/minimal/TINYBSD
==
--- head/tools/tools/tinybsd/conf/minimal/TINYBSD   Mon Aug 31 19:38:03 
2020(r365005)
+++ head/tools/tools/tinybsd/conf/minimal/TINYBSD   Mon Aug 31 19:47:30 
2020(r365006)
@@ -58,11 +58,6 @@ device   sc
 
 device agp # support several AGP chipsets
 
-# Power management support (see NOTES for more options)
-#deviceapm
-# Add suspend/resume support for the i8254.
-device pmtimer
-
 # Pseudo devices.
 device loop# Network loopback
 device ether   # Ethernet support

Modified: head/tools/tools/tinybsd/conf/vpn/TINYBSD
==
--- head/tools/tools/tinybsd/conf/vpn/TINYBSD   Mon Aug 31 19:38:03 2020
(r365005)
+++ head/tools/tools/tinybsd/conf/vpn/TINYBSD   Mon Aug 31 19:47:30 2020
(r365006)
@@ -63,11 +63,6 @@ device   sc
 
 device agp # support several AGP chipsets
 
-# Power management support (see NOTES for more options)
-#deviceapm
-# Add suspend/resume support for the i8254.
-device pmtimer
-
 # PCCARD (PCMCIA) support
 # PCMCIA and cardbus bridge support
 #devicecbb # cardbus (yenta) bridge

Modified: head/tools/tools/tinybsd/conf/wireless/TINYBSD
==
--- head/tools/tools/tinybsd/conf/wireless/TINYBSD  Mon Aug 31 19:38:03 
2020(r365005)
+++ head/tools/tools/tinybsd/conf/wireless/TINYBSD  Mon Aug 31 19:47:30 
2020(r365006)
@@ -63,11 +63,6 @@ device   sc
 
 device agp # support several AGP chipsets
 
-# Power management support (see NOTES for more options)
-#deviceapm
-# Add suspend/resume support for the i8254.
-device pmtimer
-
 # PCCARD (PCMCIA) support
 # PCMCIA and cardbus bridge support
 device cbb # cardbus (yenta) bridge
___

svn commit: r365005 - head/sys/dev/nvme

2020-08-31 Thread Warner Losh
Author: imp
Date: Mon Aug 31 19:38:03 2020
New Revision: 365005
URL: https://svnweb.freebsd.org/changeset/base/365005

Log:
  Use symbolic names for asych events
  
  Rather than |= 0x300, define and use asyn event names for the name
  space changes and the firmware activations that we're asking for.

Modified:
  head/sys/dev/nvme/nvme.h
  head/sys/dev/nvme/nvme_ctrlr.c

Modified: head/sys/dev/nvme/nvme.h
==
--- head/sys/dev/nvme/nvme.hMon Aug 31 18:47:56 2020(r365004)
+++ head/sys/dev/nvme/nvme.hMon Aug 31 19:38:03 2020(r365005)
@@ -454,6 +454,8 @@ enum nvme_critical_warning_state {
NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP= 0x10,
 };
 #define NVME_CRIT_WARN_ST_RESERVED_MASK(0xE0)
+#defineNVME_ASYNC_EVENT_NS_ATTRIBUTE   (0x100)
+#defineNVME_ASYNC_EVENT_FW_ACTIVATE(0x200)
 
 /* slot for current FW */
 #define NVME_FIRMWARE_PAGE_AFI_SLOT_SHIFT  (0)

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Mon Aug 31 18:47:56 2020
(r365004)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Mon Aug 31 19:38:03 2020
(r365005)
@@ -835,7 +835,8 @@ nvme_ctrlr_configure_aer(struct nvme_controller *ctrlr
NVME_CRIT_WARN_ST_READ_ONLY |
NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP;
if (ctrlr->cdata.ver >= NVME_REV(1, 2))
-   ctrlr->async_event_config |= 0x300;
+   ctrlr->async_event_config |= NVME_ASYNC_EVENT_NS_ATTRIBUTE |
+   NVME_ASYNC_EVENT_FW_ACTIVATE;
 
status.done = 0;
nvme_ctrlr_cmd_get_feature(ctrlr, NVME_FEAT_TEMPERATURE_THRESHOLD,
___
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: r364321 - head/sbin/ipfw

2020-08-31 Thread Ed Maste
On Mon, 31 Aug 2020 at 10:09, Rodney W. Grimes
 wrote:
>
> > Hrm, it seems this reply ended up in my spam folder; sorry for not
> > replying until now.
>
> lol Oh, bad filter :-)
>
> > > >   *strchr(timestr, '\n') = '\0';
> > > >   bprintf(bp, "%s ", timestr);
> > >^ Isnt this the +1 space?
> > >
> > > >   } else {
> > > > - bprintf(bp, "%*s", twidth, " ");
> > > > + bprintf(bp, "%*s", twidth + 1, " ");
> > > ^missing from this string?
> >
> > Inserting an extra space in the format string would also work, sure. I
> > considered doing it that way but in the end decided it's not
> > materially more clear one way or another, so used the patch as
> > submitted.
>
> For me the + 1 leads to a "why is this here", where as the space
> in the format string clearly matches the other condition of the else.
> Also + 1 causes a run time computation, the extra space does not.

No, but the extra space adds a format string character which will be
more costly than the +1. I would have used "%*s " if twidth was
already used in the other case, to keep them consistent.

Anyhow, I think this isn't worth bikeshedding; I have no objection if
anyone feels "%*s " is more clear and wants to commit that change.
___
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: r365004 - head/bin/ls

2020-08-31 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Mon Aug 31 18:47:56 2020
New Revision: 365004
URL: https://svnweb.freebsd.org/changeset/base/365004

Log:
  ls(1): Update all POSIX references and correct the STANDARDS section
  
  - Update the POSIX references for non-standard ls(1) options
  - Simplify the STANDARDS section by mention both supported POSIX versions
  
  Reported by:  hrs
  Reviewed by:  hrs, bcr
  Approved by:  hrs, bcr
  MFC after:3 days
  X-MFC-With:   r364449
  Differential Revision:https://reviews.freebsd.org/D26210

Modified:
  head/bin/ls/ls.1

Modified: head/bin/ls/ls.1
==
--- head/bin/ls/ls.1Mon Aug 31 16:32:17 2020(r365003)
+++ head/bin/ls/ls.1Mon Aug 31 18:47:56 2020(r365004)
@@ -32,7 +32,7 @@
 .\" @(#)ls.1   8.7 (Berkeley) 7/29/94
 .\" $FreeBSD$
 .\"
-.Dd August 21, 2020
+.Dd August 31, 2020
 .Dt LS 1
 .Os
 .Sh NAME
@@ -197,7 +197,7 @@ This option is not defined in
 Display each file's MAC label; see
 .Xr maclabel 7 .
 This option is not defined in
-.St -p1003.1-2001 .
+.St -p1003.1-2008 .
 .It Fl a
 Include directory entries whose names begin with a
 dot
@@ -209,7 +209,7 @@ but use
 .Tn C
 escape codes whenever possible.
 This option is not defined in
-.St -p1003.1-2001 .
+.St -p1003.1-2008 .
 .It Fl c
 Use time when file status was last changed for sorting or printing.
 .It Fl -color Ns = Ns Ar when
@@ -292,7 +292,7 @@ and
 .Fl t
 options.
 As allowed by
-.St -p1003.1-2001 ,
+.St -p1003.1-2008 ,
 this option has no effect on the
 .Fl d ,
 .Fl l ,
@@ -308,7 +308,7 @@ where it was used to display the group name in the lon
 .Pq Fl l
 format output.
 This option is incompatible with
-.St -p1003.1-2001 .
+.St -p1003.1-2008 .
 .It Fl h
 When used with the
 .Fl l
@@ -316,7 +316,7 @@ option, use unit suffixes: Byte, Kilobyte, Megabyte, G
 and Petabyte in order to reduce the number of digits to four or fewer
 using base 2 for sizes.
 This option is not defined in
-.St -p1003.1-2001 .
+.St -p1003.1-2008 .
 .It Fl i
 For each file, print the file's file serial number (inode number).
 .It Fl k
@@ -343,7 +343,7 @@ Include the file flags in a long
 .Pq Fl l
 output.
 This option is incompatible with
-.St -p1003.1-2001 .
+.St -p1003.1-2008 .
 See
 .Xr chflags 1
 for a list of file flags and their meanings.
@@ -895,13 +895,14 @@ and
 the
 .Nm
 utility conforms to
+.St -p1003.1-2001
+and
 .St -p1003.1-2008 .
 The options
 .Fl B , D , G , I , T , U , W , Z , b , h , w , y
 and
 .Fl ,
-are compatible extensions not defined in
-.St -p1003.1-2008 .
+are non-standard extensions.
 .Pp
 The ACL support is compatible with
 .Tn IEEE
___
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: r365003 - head/sys/dev/mlx5/mlx5_core

2020-08-31 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 31 16:32:17 2020
New Revision: 365003
URL: https://svnweb.freebsd.org/changeset/base/365003

Log:
  mlx5 sriov: Add controls for VFs to set port/node GUIDs.
  
  Setting GUIDs make RoCE offloads functional on VFs.
  
  Reported and tested by:   chuck
  Sponsored by: Mellanox Technologies - Nvidia
  MFC after:1 week

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 31 16:30:52 2020
(r365002)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 31 16:32:17 2020
(r365003)
@@ -180,6 +180,8 @@ static struct mlx5_profile profiles[] = {
 
 #ifdef PCI_IOV
 static const char iov_mac_addr_name[] = "mac-addr";
+static const char iov_node_guid_name[] = "node-guid";
+static const char iov_port_guid_name[] = "port-guid";
 #endif
 
 static int set_dma_caps(struct pci_dev *pdev)
@@ -1624,6 +1626,10 @@ static int init_one(struct pci_dev *pdev,
vf_schema = pci_iov_schema_alloc_node();
pci_iov_schema_add_unicast_mac(vf_schema,
iov_mac_addr_name, 0, NULL);
+   pci_iov_schema_add_uint64(vf_schema, iov_node_guid_name,
+   0, 0);
+   pci_iov_schema_add_uint64(vf_schema, iov_port_guid_name,
+   0, 0);
err = pci_iov_attach(bsddev, pf_schema, vf_schema);
if (err != 0) {
device_printf(bsddev,
@@ -1825,6 +1831,7 @@ mlx5_iov_add_vf(device_t dev, uint16_t vfnum, const nv
struct mlx5_priv *priv;
const void *mac;
size_t mac_size;
+   uint64_t node_guid, port_guid;
int error;
 
pdev = device_get_softc(dev);
@@ -1842,6 +1849,28 @@ mlx5_iov_add_vf(device_t dev, uint16_t vfnum, const nv
if (error != 0) {
mlx5_core_err(core_dev,
"setting MAC for VF %d failed, error %d\n",
+   vfnum + 1, error);
+   }
+   }
+
+   if (nvlist_exists_number(vf_config, iov_node_guid_name)) {
+   node_guid = nvlist_get_number(vf_config, iov_node_guid_name);
+   error = -mlx5_modify_nic_vport_node_guid(core_dev, vfnum + 1,
+   node_guid);
+   if (error != 0) {
+   mlx5_core_err(core_dev,
+   "modifying node GUID for VF %d failed, error %d\n",
+   vfnum + 1, error);
+   }
+   }
+
+   if (nvlist_exists_number(vf_config, iov_port_guid_name)) {
+   port_guid = nvlist_get_number(vf_config, iov_port_guid_name);
+   error = -mlx5_modify_nic_vport_port_guid(core_dev, vfnum + 1,
+   port_guid);
+   if (error != 0) {
+   mlx5_core_err(core_dev,
+   "modifying port GUID for VF %d failed, error %d\n",
vfnum + 1, error);
}
}
___
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: r365002 - head/sys/dev/mlx5/mlx5_core

2020-08-31 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 31 16:30:52 2020
New Revision: 365002
URL: https://svnweb.freebsd.org/changeset/base/365002

Log:
  mlx5 sriov: add error message for failed MAC programming on VF.
  
  Sponsored by: Mellanox Technologies - Nvidia
  MFC after:1 week

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 31 16:27:03 2020
(r365001)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 31 16:30:52 2020
(r365002)
@@ -1839,6 +1839,11 @@ mlx5_iov_add_vf(device_t dev, uint16_t vfnum, const nv
_size);
error = -mlx5_eswitch_set_vport_mac(priv->eswitch,
vfnum + 1, __DECONST(u8 *, mac));
+   if (error != 0) {
+   mlx5_core_err(core_dev,
+   "setting MAC for VF %d failed, error %d\n",
+   vfnum + 1, error);
+   }
}
 
error = -mlx5_eswitch_set_vport_state(priv->eswitch, vfnum + 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: r365001 - in head/sys/dev/mlx5: mlx5_core mlx5_en

2020-08-31 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 31 16:27:03 2020
New Revision: 365001
URL: https://svnweb.freebsd.org/changeset/base/365001

Log:
  mlx5en: Implement SIOCGIFDOWNREASON.
  
  Sponsored by: Mellanox Technologies - Nvidia
  MFC after:1 week

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_core.h
  head/sys/dev/mlx5/mlx5_core/mlx5_port.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Aug 31 16:25:55 2020
(r365000)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Aug 31 16:27:03 2020
(r365001)
@@ -127,6 +127,9 @@ void mlx5_core_event(struct mlx5_core_dev *dev, enum m
 void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force);
 void mlx5_disable_device(struct mlx5_core_dev *dev);
 void mlx5_recover_device(struct mlx5_core_dev *dev);
+int mlx5_query_pddr_troubleshooting_info(struct mlx5_core_dev *mdev,
+u16 *monitor_opcode,
+u8 *status_message, size_t sm_len);
 
 int mlx5_register_device(struct mlx5_core_dev *dev);
 void mlx5_unregister_device(struct mlx5_core_dev *dev);

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Aug 31 16:25:55 2020
(r365000)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Aug 31 16:27:03 2020
(r365001)
@@ -1221,6 +1221,31 @@ int mlx5_query_pddr_range_info(struct mlx5_core_dev *m
 }
 EXPORT_SYMBOL_GPL(mlx5_query_pddr_range_info);
 
+int mlx5_query_pddr_troubleshooting_info(struct mlx5_core_dev *mdev,
+u16 *monitor_opcode, u8 *status_message, size_t sm_len)
+{
+   int outlen = MLX5_ST_SZ_BYTES(pddr_reg);
+   u32 out[MLX5_ST_SZ_DW(pddr_reg)] = {0};
+   int err;
+
+   err = mlx5_query_pddr(mdev, MLX5_PDDR_TROUBLESHOOTING_INFO_PAGE, 1,
+   out, outlen);
+   if (err != 0)
+   return err;
+   if (monitor_opcode != NULL) {
+   *monitor_opcode = MLX5_GET(pddr_reg, out,
+   page_data.troubleshooting_info_page.status_opcode.
+   monitor_opcodes);
+   }
+   if (status_message != NULL) {
+   strlcpy(status_message,
+   MLX5_ADDR_OF(pddr_reg, out,
+   page_data.troubleshooting_info_page.status_message),
+   sm_len);
+   }
+   return (0);
+}
+
 int
 mlx5_query_mfrl_reg(struct mlx5_core_dev *mdev, u8 *reset_level)
 {

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Aug 31 16:25:55 2020
(r365000)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Aug 31 16:27:03 2020
(r365001)
@@ -3233,6 +3233,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 {
struct mlx5e_priv *priv;
struct ifreq *ifr;
+   struct ifdownreason *ifdr;
struct ifi2creq i2c;
int error = 0;
int mask = 0;
@@ -3500,6 +3501,16 @@ out:
error = copyout(, ifr_data_get_ptr(ifr), sizeof(i2c));
 err_i2c:
PRIV_UNLOCK(priv);
+   break;
+   case SIOCGIFDOWNREASON:
+   ifdr = (struct ifdownreason *)data;
+   bzero(ifdr->ifdr_msg, sizeof(ifdr->ifdr_msg));
+   PRIV_LOCK(priv);
+   error = -mlx5_query_pddr_troubleshooting_info(priv->mdev, NULL,
+   ifdr->ifdr_msg, sizeof(ifdr->ifdr_msg));
+   PRIV_UNLOCK(priv);
+   if (error == 0)
+   ifdr->ifdr_reason = IFDR_REASON_MSG;
break;
 
default:
___
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: r365000 - in head/sys/dev/mlx5: . mlx5_core

2020-08-31 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 31 16:25:55 2020
New Revision: 365000
URL: https://svnweb.freebsd.org/changeset/base/365000

Log:
  mlx5_core: add mlx5_query_pddr().
  
  And use it in mlx5_query_pddr_range_info() instead of direct register
  access.
  
  Sponsored by: Mellanox Technologies - Nvidia
  MFC after:1 week

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_port.c
  head/sys/dev/mlx5/mlx5_ifc.h

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Aug 31 16:23:51 2020
(r364999)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Aug 31 16:25:55 2020
(r365000)
@@ -1175,19 +1175,29 @@ out:
return err;
 }
 
+static int mlx5_query_pddr(struct mlx5_core_dev *mdev,
+u8 local_port, int page_select, u32 *out, int outlen)
+{
+   u32 in[MLX5_ST_SZ_DW(pddr_reg)] = {0};
+
+   if (!MLX5_CAP_PCAM_REG(mdev, pddr))
+   return -EOPNOTSUPP;
+
+   MLX5_SET(pddr_reg, in, local_port, local_port);
+   MLX5_SET(pddr_reg, in, page_select, page_select);
+
+   return mlx5_core_access_reg(mdev, in, sizeof(in), out, outlen, 
MLX5_REG_PDDR, 0, 0);
+}
+
 int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 
*is_er_type)
 {
u32 pddr_reg[MLX5_ST_SZ_DW(pddr_reg)] = {};
-   int sz = MLX5_ST_SZ_BYTES(pddr_reg);
int error;
u8 ecc;
u8 ci;
 
-   MLX5_SET(pddr_reg, pddr_reg, local_port, local_port);
-   MLX5_SET(pddr_reg, pddr_reg, page_select, 3 /* module info page */);
-
-   error = mlx5_core_access_reg(mdev, pddr_reg, sz, pddr_reg, sz,
-   MLX5_ACCESS_REG_SUMMARY_CTRL_ID_PDDR, 0, 0);
+   error = mlx5_query_pddr(mdev, local_port, MLX5_PDDR_MODULE_INFO_PAGE,
+   pddr_reg, sizeof(pddr_reg));
if (error != 0)
return (error);
 

Modified: head/sys/dev/mlx5/mlx5_ifc.h
==
--- head/sys/dev/mlx5/mlx5_ifc.hMon Aug 31 16:23:51 2020
(r364999)
+++ head/sys/dev/mlx5/mlx5_ifc.hMon Aug 31 16:25:55 2020
(r365000)
@@ -780,10 +780,6 @@ struct mlx5_ifc_flow_table_nic_cap_bits {
u8 reserved_1[0x7200];
 };
 
-enum {
-   MLX5_ACCESS_REG_SUMMARY_CTRL_ID_PDDR   = 0x5031,
-};
-
 struct mlx5_ifc_pddr_module_info_bits {
u8 cable_technology[0x8];
u8 cable_breakout[0x8];
___
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: r364999 - in head/sys/dev/mlx5: . mlx5_core

2020-08-31 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 31 16:23:51 2020
New Revision: 364999
URL: https://svnweb.freebsd.org/changeset/base/364999

Log:
  mlx5_core: Import PDDR register definitions
  
  PDDR (Port Diagnostics Database Register) is used to read the physical
  layer debug database, which contains helpful troubleshooting information
  regarding the state of the link.
  
  PDDR register can only be queried when PCAM register reports it as
  supported in its register mask. A new helper macro was added to
  the MLX5_CAP_* infrastructure in order to access this mask.
  
  Sponsored by: Mellanox Technologies - Nvidia
  MFC after:1 week

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_core.h
  head/sys/dev/mlx5/mlx5_ifc.h

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Mon Aug 31 16:18:48 2020(r364998)
+++ head/sys/dev/mlx5/driver.h  Mon Aug 31 16:23:51 2020(r364999)
@@ -145,6 +145,7 @@ enum {
MLX5_REG_PMPE= 0x5010,
MLX5_REG_PMAOS   = 0x5012,
MLX5_REG_PPLM= 0x5023,
+   MLX5_REG_PDDR= 0x5031,
MLX5_REG_PBSR= 0x5038,
MLX5_REG_PCAM= 0x507f,
MLX5_REG_NODE_DESC   = 0x6001,

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Aug 31 16:18:48 2020
(r364998)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Aug 31 16:23:51 2020
(r364999)
@@ -79,6 +79,35 @@ enum mlx5_semaphore_space_address {
 
 struct mlx5_core_dev;
 
+enum mlx5_pddr_page_select {
+   MLX5_PDDR_OPERATIONAL_INFO_PAGE= 0x0,
+   MLX5_PDDR_TROUBLESHOOTING_INFO_PAGE= 0x1,
+   MLX5_PDDR_MODULE_INFO_PAGE = 0x3,
+};
+
+enum mlx5_pddr_monitor_opcodes {
+   MLX5_LINK_NO_ISSUE_OBSERVED= 0x0,
+   MLX5_LINK_PORT_CLOSED  = 0x1,
+   MLX5_LINK_AN_FAILURE   = 0x2,
+   MLX5_LINK_TRAINING_FAILURE = 0x5,
+   MLX5_LINK_LOGICAL_MISMATCH = 0x9,
+   MLX5_LINK_REMOTE_FAULT_INDICATION  = 0xe,
+   MLX5_LINK_BAD_SIGNAL_INTEGRITY = 0xf,
+   MLX5_LINK_CABLE_COMPLIANCE_CODE_MISMATCH   = 0x10,
+   MLX5_LINK_INTERNAL_ERR = 0x17,
+   MLX5_LINK_INFO_NOT_AVAIL   = 0x3ff,
+   MLX5_LINK_CABLE_UNPLUGGED  = 0x400,
+   MLX5_LINK_LONG_RANGE_FOR_NON_MLX_CABLE = 0x401,
+   MLX5_LINK_BUS_STUCK= 0x402,
+   MLX5_LINK_UNSUPP_EEPROM= 0x403,
+   MLX5_LINK_PART_NUM_LIST= 0x404,
+   MLX5_LINK_UNSUPP_CABLE = 0x405,
+   MLX5_LINK_MODULE_TEMP_SHUTDOWN = 0x406,
+   MLX5_LINK_SHORTED_CABLE= 0x407,
+   MLX5_LINK_POWER_BUDGET_EXCEEDED= 0x408,
+   MLX5_LINK_MNG_FORCED_DOWN  = 0x409,
+};
+
 int mlx5_query_hca_caps(struct mlx5_core_dev *dev);
 int mlx5_query_board_id(struct mlx5_core_dev *dev);
 int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u32 *qcam,

Modified: head/sys/dev/mlx5/mlx5_ifc.h
==
--- head/sys/dev/mlx5/mlx5_ifc.hMon Aug 31 16:18:48 2020
(r364998)
+++ head/sys/dev/mlx5/mlx5_ifc.hMon Aug 31 16:23:51 2020
(r364999)
@@ -872,23 +872,6 @@ struct mlx5_ifc_pddr_module_info_bits {
u8 reserved_at_4c0[0x300];
 };
 
-union 
mlx5_ifc_pddr_operation_info_page_pddr_phy_info_page_pddr_troubleshooting_page_pddr_module_info_auto_bits
 {
-   struct mlx5_ifc_pddr_module_info_bits pddr_module_info;
-   u8 reserved_at_0[0x7c0];
-};
-
-struct mlx5_ifc_pddr_reg_bits {
-   u8 reserved_at_0[0x8];
-   u8 local_port[0x8];
-   u8 pnat[0x2];
-   u8 reserved_at_12[0xe];
-
-   u8 reserved_at_20[0x18];
-   u8 page_select[0x8];
-
-   union 
mlx5_ifc_pddr_operation_info_page_pddr_phy_info_page_pddr_troubleshooting_page_pddr_module_info_auto_bits
 page_data;
-};
-
 struct mlx5_ifc_per_protocol_networking_offload_caps_bits {
u8 csum_cap[0x1];
u8 vlan_cap[0x1];
@@ -8755,7 +8738,10 @@ struct mlx5_ifc_pcam_regs_5000_to_507f_bits {
u8 port_access_reg_cap_mask_127_to_96[0x20];
u8 port_access_reg_cap_mask_95_to_64[0x20];
 
-   u8 port_access_reg_cap_mask_63_to_36[0x1c];
+   u8 reserved_at_40[0xe];
+   u8 pddr[0x1];
+   u8 reserved_at_4f[0xd];
+
u8 pplm[0x1];
u8 port_access_reg_cap_mask_34_to_32[0x3];
 
@@ -10345,6 +10331,46 @@ struct mlx5_ifc_mpcnt_reg_ext_bits 

svn commit: r364998 - head/contrib/ofed/infiniband-diags/src

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 16:18:48 2020
New Revision: 364998
URL: https://svnweb.freebsd.org/changeset/base/364998

Log:
  infiniband-diags: Fix memory leak in dump_multicast_tables
  
  Coverity detected leak.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  Reviewed by:  hselasky, kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26228

Modified:
  head/contrib/ofed/infiniband-diags/src/ibroute.c

Modified: head/contrib/ofed/infiniband-diags/src/ibroute.c
==
--- head/contrib/ofed/infiniband-diags/src/ibroute.cMon Aug 31 16:17:28 
2020(r364997)
+++ head/contrib/ofed/infiniband-diags/src/ibroute.cMon Aug 31 16:18:48 
2020(r364998)
@@ -222,6 +222,7 @@ char *dump_multicast_tables(ib_portid_t * portid, unsi
fprintf(stderr, "SubnGet() failed"
"; MAD status 0x%x AM 0x%x\n",
status, mod);
+   free(mapnd);
return NULL;
}
}
___
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: r364997 - in head/sys/ofed: drivers/infiniband/core include/rdma

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 16:17:28 2020
New Revision: 364997
URL: https://svnweb.freebsd.org/changeset/base/364997

Log:
  infiniband: Appease Coverty
  
  Coverity claims the call to rdma_gid2ip in cma_igmp_send overwrites addr.
  Use a consistent definition of sockaddr to prevent detections and code
  changes in the future.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  Reviewed by:  hselasky, kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26229

Modified:
  head/sys/ofed/drivers/infiniband/core/ib_addr.c
  head/sys/ofed/drivers/infiniband/core/ib_cma.c
  head/sys/ofed/drivers/infiniband/core/ib_sa_query.c
  head/sys/ofed/include/rdma/ib_addr.h

Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_addr.c Mon Aug 31 16:07:40 
2020(r364996)
+++ head/sys/ofed/drivers/infiniband/core/ib_addr.c Mon Aug 31 16:17:28 
2020(r364997)
@@ -860,11 +860,7 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *s
struct rdma_dev_addr dev_addr;
struct resolve_cb_context ctx;
 
-   union {
-   struct sockaddr _sockaddr;
-   struct sockaddr_in  _sockaddr_in;
-   struct sockaddr_in6 _sockaddr_in6;
-   } sgid_addr, dgid_addr;
+   union rdma_sockaddr sgid_addr, dgid_addr;
 
rdma_gid2ip(_addr._sockaddr, sgid);
rdma_gid2ip(_addr._sockaddr, dgid);

Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_cma.c  Mon Aug 31 16:07:40 
2020(r364996)
+++ head/sys/ofed/drivers/infiniband/core/ib_cma.c  Mon Aug 31 16:17:28 
2020(r364997)
@@ -450,18 +450,15 @@ static int cma_igmp_send(struct net_device *ndev, cons
int retval;
 
if (ndev) {
-   union {
-   struct sockaddr sock;
-   struct sockaddr_storage storage;
-   } addr;
+   union rdma_sockaddr addr;
 
-   rdma_gid2ip(, mgid);
+   rdma_gid2ip(_sockaddr, mgid);
 
CURVNET_SET_QUIET(ndev->if_vnet);
if (join)
-   retval = -if_addmulti(ndev, , NULL);
+   retval = -if_addmulti(ndev, _sockaddr, NULL);
else
-   retval = -if_delmulti(ndev, );
+   retval = -if_delmulti(ndev, _sockaddr);
CURVNET_RESTORE();
} else {
retval = -ENODEV;

Modified: head/sys/ofed/drivers/infiniband/core/ib_sa_query.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_sa_query.c Mon Aug 31 16:07:40 
2020(r364996)
+++ head/sys/ofed/drivers/infiniband/core/ib_sa_query.c Mon Aug 31 16:17:28 
2020(r364997)
@@ -668,11 +668,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 
struct rdma_dev_addr dev_addr = {.bound_dev_if = rec->ifindex,
 .net = rec->net ? rec->net :
 _net};
-   union {
-   struct sockaddr _sockaddr;
-   struct sockaddr_in  _sockaddr_in;
-   struct sockaddr_in6 _sockaddr_in6;
-   } sgid_addr, dgid_addr;
+   union rdma_sockaddr sgid_addr, dgid_addr;
 
if (!device->get_netdev)
return -EOPNOTSUPP;

Modified: head/sys/ofed/include/rdma/ib_addr.h
==
--- head/sys/ofed/include/rdma/ib_addr.hMon Aug 31 16:07:40 2020
(r364996)
+++ head/sys/ofed/include/rdma/ib_addr.hMon Aug 31 16:17:28 2020
(r364997)
@@ -57,6 +57,13 @@ struct rdma_addr_client {
struct completion comp;
 };
 
+union rdma_sockaddr {
+   struct sockaddr _sockaddr;
+   struct sockaddr_in  _sockaddr_in;
+   struct sockaddr_in6 _sockaddr_in6;
+   struct sockaddr_storage _sockaddr_ss;
+};
+
 /**
  * rdma_addr_register_client - Register an address client.
  */
___
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: r364996 - head/lib/libpmc/pmu-events

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 16:07:40 2020
New Revision: 364996
URL: https://svnweb.freebsd.org/changeset/base/364996

Log:
  libpmc: Fix memory leak in process_mapfile
  
  Coverity detected memory leak fix.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  Reviewed by:  cem
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26230

Modified:
  head/lib/libpmc/pmu-events/jevents.c

Modified: head/lib/libpmc/pmu-events/jevents.c
==
--- head/lib/libpmc/pmu-events/jevents.cMon Aug 31 15:59:17 2020
(r364995)
+++ head/lib/libpmc/pmu-events/jevents.cMon Aug 31 16:07:40 2020
(r364996)
@@ -794,6 +794,7 @@ process_mapfile(FILE *outfp, char *fpath)
if (!mapfp) {
pr_info("%s: Error %s opening %s\n", prog, strerror(errno),
fpath);
+   free(line);
return -1;
}
 
@@ -850,6 +851,8 @@ process_mapfile(FILE *outfp, char *fpath)
 
 out:
print_mapping_table_suffix(outfp);
+   free(line);
+   fclose(mapfp);
return 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"


Re: svn commit: r364982 - head/sys/netinet6

2020-08-31 Thread Kyle Evans
On Sun, Aug 30, 2020 at 8:45 PM Kyle Evans  wrote:
>
> Author: kevans
> Date: Mon Aug 31 01:45:48 2020
> New Revision: 364982
> URL: https://svnweb.freebsd.org/changeset/base/364982
>
> Log:
>   ipv6: quit dropping packets looping back on p2p interfaces
>
>   To paraphrase the below-referenced PR:
>
>   This logic originated in the KAME project, and was even controversial when
>   it was enabled there by default in 2001. No such equivalent logic exists in
>   the IPv4 stack, and it turns out that this leads to us dropping valid
>   traffic when the "point to point" interface is actually a 1:many tun
>   interface, e.g. with the wireguard userland stack.
>
>   Even in the case of true point-to-point links, this logic only avoids
>   transient looping of packets sent by misconfigured applications or
>   attackers, which can be subverted by proper route configuration rather than
>   hardcoded logic in the kernel to drop packets.
>
>   In the review, melifaro goes on to note that the kernel can't fix it, so it
>   perhaps shouldn't try to be 'smart' about it. Additionally, that TTL will
>   still kick in even with incorrect route configuration.
>
>   PR:   247718
>   Reviewed by:  melifaro, rgrimes
>   MFC after:1 week
>   Differential Revision:https://reviews.freebsd.org/D25567
>

I should note that this was:

Submitted by: Mira Ressel 

It was then put into review form by Lutz Donnerhacke to help guide the
patch into the correct hands.

Apologies for the omission-

Kyle Evans
___
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: r364995 - head/sbin/ggate/ggated

2020-08-31 Thread Mark Johnston
Author: markj
Date: Mon Aug 31 15:59:17 2020
New Revision: 364995
URL: https://svnweb.freebsd.org/changeset/base/364995

Log:
  ggated(8): Avoid doubly opening the requested disk device.
  
  - Initialize the disk device fd field in connection_new().
  - Close the disk device after handing the connection over
to a child worker.
  - Avoid re-opening a disk device for each connection from
the same client, avoiding an fd leak.
  
  PR:   132845
  Submitted by: Yoshihiro Ota 
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D26168

Modified:
  head/sbin/ggate/ggated/ggated.c

Modified: head/sbin/ggate/ggated/ggated.c
==
--- head/sbin/ggate/ggated/ggated.c Mon Aug 31 15:55:29 2020
(r364994)
+++ head/sbin/ggate/ggated/ggated.c Mon Aug 31 15:59:17 2020
(r364995)
@@ -349,6 +349,16 @@ exports_check(struct ggd_export *ex, struct g_gate_cin
flags = O_WRONLY;
else
flags = O_RDWR;
+   if (conn->c_diskfd != -1) {
+   if (strcmp(conn->c_path, ex->e_path) != 0) {
+   g_gate_log(LOG_ERR, "old %s and new %s: "
+   "Path mismatch during handshakes.",
+   conn->c_path, ex->e_path);
+   return (EPERM);
+   }
+   return (0);
+   }
+
conn->c_diskfd = open(ex->e_path, flags);
if (conn->c_diskfd == -1) {
error = errno;
@@ -455,7 +465,7 @@ connection_new(struct g_gate_cinit *cinit, struct sock
conn->c_token = cinit->gc_token;
ip = htonl(((struct sockaddr_in *)(void *)s)->sin_addr.s_addr);
conn->c_srcip = ip;
-   conn->c_sendfd = conn->c_recvfd = -1;
+   conn->c_diskfd = conn->c_sendfd = conn->c_recvfd = -1;
if ((cinit->gc_flags & GGATE_FLAG_SEND) != 0)
conn->c_sendfd = sfd;
else
@@ -510,6 +520,8 @@ connection_remove(struct ggd_connection *conn)
LIST_REMOVE(conn, c_next);
g_gate_log(LOG_DEBUG, "Connection removed [%s %s].",
ip2str(conn->c_srcip), conn->c_path);
+   if (conn->c_diskfd != -1)
+   close(conn->c_diskfd);
if (conn->c_sendfd != -1)
close(conn->c_sendfd);
if (conn->c_recvfd != -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: r364994 - head/sbin/dhclient

2020-08-31 Thread Ed Maste
Author: emaste
Date: Mon Aug 31 15:55:29 2020
New Revision: 364994
URL: https://svnweb.freebsd.org/changeset/base/364994

Log:
  dhclient: improve error handling parsing option 119
  
  Reported by:  Shlomi Oberman, JSOF
  Submitted by: delphij
  Reviewed by:  markj
  Tested by:markj

Modified:
  head/sbin/dhclient/options.c

Modified: head/sbin/dhclient/options.c
==
--- head/sbin/dhclient/options.cMon Aug 31 15:32:45 2020
(r364993)
+++ head/sbin/dhclient/options.cMon Aug 31 15:55:29 2020
(r364994)
@@ -298,6 +298,8 @@ find_search_domain_name_len(struct option_data *option
 
pointed_len = find_search_domain_name_len(option,
);
+   if (pointed_len < 0)
+   return (-1);
domain_name_len += pointed_len;
 
*offset = i + 2;
___
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: r364993 - in head/sys/dev: rtwn/usb usb

2020-08-31 Thread Mark Johnston
Author: markj
Date: Mon Aug 31 15:32:45 2020
New Revision: 364993
URL: https://svnweb.freebsd.org/changeset/base/364993

Log:
  rtwn(4): Add support for the Belkin N300.
  
  PR:   249034
  Submitted by: Salvador Martínez Mármol 
  MFC after:1 week

Modified:
  head/sys/dev/rtwn/usb/rtwn_usb_attach.h
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.h
==
--- head/sys/dev/rtwn/usb/rtwn_usb_attach.h Mon Aug 31 15:31:17 2020
(r364992)
+++ head/sys/dev/rtwn/usb/rtwn_usb_attach.h Mon Aug 31 15:32:45 2020
(r364993)
@@ -49,6 +49,7 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = {
RTWN_RTL8192CU_DEV(AZUREWAVE,   RTL8188CE_2),
RTWN_RTL8192CU_DEV(AZUREWAVE,   RTL8188CU),
RTWN_RTL8192CU_DEV(BELKIN,  F7D2102),
+   RTWN_RTL8192CU_DEV(BELKIN,  F9L1004V1),
RTWN_RTL8192CU_DEV(BELKIN,  RTL8188CU),
RTWN_RTL8192CU_DEV(BELKIN,  RTL8192CU),
RTWN_RTL8192CU_DEV(CHICONY, RTL8188CUS_1),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsMon Aug 31 15:31:17 2020(r364992)
+++ head/sys/dev/usb/usbdevsMon Aug 31 15:32:45 2020(r364993)
@@ -1378,6 +1378,7 @@ product BELKIN F6C900UNV  0x0900  F6C900-UNV
 product BELKIN F6C100UNV   0x0910  F6C100-UNV
 product BELKIN F6C120UNV   0x0912  F6C120-UNV UPS
 product BELKIN F6C800UNV   0x0980  F6C800-UNV
+product BELKIN F9L1004V1   0x1004  N300 Wireless Adapter
 product BELKIN F6C1100UNV  0x1100  F6C1100-UNV, F6C1200-UNV
 product BELKIN F5U120  0x1203  F5U120-PC Hub
 product BELKIN RTL8188CU   0x1102  RTL8188CU Wireless Adapter
___
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: r364992 - head/sys/fs/nfsserver

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 15:31:17 2020
New Revision: 364992
URL: https://svnweb.freebsd.org/changeset/base/364992

Log:
  Fix nfsrvd_locku memory leak
  
  Coverity detected memory leak fix.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  Reviewed by:  rmacklem
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26231

Modified:
  head/sys/fs/nfsserver/nfs_nfsdserv.c

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- head/sys/fs/nfsserver/nfs_nfsdserv.cMon Aug 31 15:26:01 2020
(r364991)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.cMon Aug 31 15:31:17 2020
(r364992)
@@ -2720,6 +2720,8 @@ nfsrvd_locku(struct nfsrv_descript *nd, __unused int i
stp->ls_stateid.seqid = 0;
} else {
nd->nd_repstat = NFSERR_BADSTATEID;
+   free(stp, M_NFSDSTATE);
+   free(lop, M_NFSDLOCK);
goto nfsmout;
}
}
___
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: r364991 - head/contrib/ofed/opensm/opensm

2020-08-31 Thread Eric van Gyzen

On 8/31/20 10:26 AM, Eric van Gyzen wrote:

Author: vangyzen
Date: Mon Aug 31 15:26:01 2020
New Revision: 364991
URL: https://svnweb.freebsd.org/changeset/base/364991

Log:
   opensm: Fix a possible dereference of a NULL pointer
   


Submitted by:   bret_ketc...@dell.com


   Reported by: Coverity
   Reviewed by: hselasky, kib
   MFC after:   2 weeks
   Sponsored by:Dell EMC Isilon
   Differential Revision:   https://reviews.freebsd.org/D26233

Modified:
   head/contrib/ofed/opensm/opensm/osm_perfmgr.c

Modified: head/contrib/ofed/opensm/opensm/osm_perfmgr.c
==
--- head/contrib/ofed/opensm/opensm/osm_perfmgr.c   Mon Aug 31 15:07:15 
2020(r364990)
+++ head/contrib/ofed/opensm/opensm/osm_perfmgr.c   Mon Aug 31 15:26:01 
2020(r364991)
@@ -1311,6 +1311,14 @@ static void perfmgr_check_overflow(osm_perfmgr_t * pm,
cl_plock_acquire(>osm->lock);
p_node =
osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+   if (!p_node) {
+   OSM_LOG(pm->log, OSM_LOG_ERROR,
+   "ERR 5407: Node \"%s\" (guid 0x%" PRIx64
+   ") no longer exists so removing from PerfMgr"
+" monitoring\n",
+   mon_node->name, mon_node->guid);
+   goto Exit;
+   }
lid = get_lid(p_node, port, mon_node);
cl_plock_release(>osm->lock);
if (lid == 0) {
@@ -1402,6 +1410,14 @@ static void perfmgr_check_pce_overflow(osm_perfmgr_t *
cl_plock_acquire(>osm->lock);
p_node =
osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+   if (!p_node) {
+   OSM_LOG(pm->log, OSM_LOG_ERROR,
+   "ERR 5407: Node \"%s\" (guid 0x%" PRIx64
+   ") no longer exists so removing from PerfMgr"
+" monitoring\n",
+   mon_node->name, mon_node->guid);
+   goto Exit;
+   }
lid = get_lid(p_node, port, mon_node);
cl_plock_release(>osm->lock);
if (lid == 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: r364991 - head/contrib/ofed/opensm/opensm

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 15:26:01 2020
New Revision: 364991
URL: https://svnweb.freebsd.org/changeset/base/364991

Log:
  opensm: Fix a possible dereference of a NULL pointer
  
  Reported by:  Coverity
  Reviewed by:  hselasky, kib
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26233

Modified:
  head/contrib/ofed/opensm/opensm/osm_perfmgr.c

Modified: head/contrib/ofed/opensm/opensm/osm_perfmgr.c
==
--- head/contrib/ofed/opensm/opensm/osm_perfmgr.c   Mon Aug 31 15:07:15 
2020(r364990)
+++ head/contrib/ofed/opensm/opensm/osm_perfmgr.c   Mon Aug 31 15:26:01 
2020(r364991)
@@ -1311,6 +1311,14 @@ static void perfmgr_check_overflow(osm_perfmgr_t * pm,
cl_plock_acquire(>osm->lock);
p_node =
osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+   if (!p_node) {
+   OSM_LOG(pm->log, OSM_LOG_ERROR,
+   "ERR 5407: Node \"%s\" (guid 0x%" PRIx64
+   ") no longer exists so removing from PerfMgr"
+" monitoring\n",
+   mon_node->name, mon_node->guid);
+   goto Exit;
+   }
lid = get_lid(p_node, port, mon_node);
cl_plock_release(>osm->lock);
if (lid == 0) {
@@ -1402,6 +1410,14 @@ static void perfmgr_check_pce_overflow(osm_perfmgr_t *
cl_plock_acquire(>osm->lock);
p_node =
osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+   if (!p_node) {
+   OSM_LOG(pm->log, OSM_LOG_ERROR,
+   "ERR 5407: Node \"%s\" (guid 0x%" PRIx64
+   ") no longer exists so removing from PerfMgr"
+" monitoring\n",
+   mon_node->name, mon_node->guid);
+   goto Exit;
+   }
lid = get_lid(p_node, port, mon_node);
cl_plock_release(>osm->lock);
if (lid == 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: r364990 - head/sys/kern

2020-08-31 Thread Kyle Evans
Author: kevans
Date: Mon Aug 31 15:07:15 2020
New Revision: 364990
URL: https://svnweb.freebsd.org/changeset/base/364990

Log:
  posixshm: fix setting of shm_flags
  
  Noted in D24652, we currently set shmfd->shm_flags on every
  shm_open()/shm_open2(). This wasn't properly thought out; one shouldn't be
  able to specify incompatible flags on subsequent opens of non-anon shm.
  
  Move setting of shm_flags explicitly to the two places shmfd are created, as
  we do with seals, and validate when we're opening a pre-existing mapping
  that we've either passed no flags or we've passed the exact same flags as
  the first time.
  
  Reviewed by:  kib, markj
  Differential Revision:https://reviews.freebsd.org/D26242

Modified:
  head/sys/kern/uipc_shm.c

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cMon Aug 31 15:03:23 2020(r364989)
+++ head/sys/kern/uipc_shm.cMon Aug 31 15:07:15 2020(r364990)
@@ -833,6 +833,7 @@ kern_shm_open2(struct thread *td, const char *userpath
}
shmfd = shm_alloc(td->td_ucred, cmode);
shmfd->shm_seals = initial_seals;
+   shmfd->shm_flags = shmflags;
} else {
error = shm_copyin_path(td, userpath, );
if (error != 0) {
@@ -855,6 +856,7 @@ kern_shm_open2(struct thread *td, const char *userpath
 #endif
shmfd = shm_alloc(td->td_ucred, cmode);
shmfd->shm_seals = initial_seals;
+   shmfd->shm_flags = shmflags;
shm_insert(path, fnv, shmfd);
 #ifdef MAC
}
@@ -898,6 +900,8 @@ kern_shm_open2(struct thread *td, const char *userpath
else if ((flags & (O_CREAT | O_EXCL)) ==
(O_CREAT | O_EXCL))
error = EEXIST;
+   else if (shmflags != 0 && shmflags != shmfd->shm_flags)
+   error = EINVAL;
else {
 #ifdef MAC
error = mac_posixshm_check_open(td->td_ucred,
@@ -947,7 +951,6 @@ kern_shm_open2(struct thread *td, const char *userpath
}
}
 
-   shmfd->shm_flags = shmflags;
finit(fp, FFLAGS(flags & O_ACCMODE), DTYPE_SHM, shmfd, _ops);
 
td->td_retval[0] = fd;
___
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: r364989 - head/sys/dev/jedec_dimm

2020-08-31 Thread Eric van Gyzen
Author: vangyzen
Date: Mon Aug 31 15:03:23 2020
New Revision: 364989
URL: https://svnweb.freebsd.org/changeset/base/364989

Log:
  jedec_dimm: fix array overrun
  
  Coverity detected the overrunning of sc->part_str.
  
  Submitted by: bret_ketc...@dell.com
  Reported by:  Coverity
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26145

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

Modified: head/sys/dev/jedec_dimm/jedec_dimm.c
==
--- head/sys/dev/jedec_dimm/jedec_dimm.cMon Aug 31 14:47:23 2020
(r364988)
+++ head/sys/dev/jedec_dimm/jedec_dimm.cMon Aug 31 15:03:23 2020
(r364989)
@@ -795,7 +795,7 @@ jedec_dimm_field_to_str(struct jedec_dimm_softc *sc, c
 
/* If we're dealing with ASCII, convert trailing spaces to NULs. */
if (ascii) {
-   for (i = dstsz; i > 0; i--) {
+   for (i = dstsz - 1; i > 0; i--) {
if (dst[i] == ' ') {
dst[i] = 0;
} else if (dst[i] == 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"


Re: svn commit: r364321 - head/sbin/ipfw

2020-08-31 Thread Stefan Esser

Am 31.08.20 um 16:09 schrieb Rodney W. Grimes:

Hrm, it seems this reply ended up in my spam folder; sorry for not
replying until now.


lol Oh, bad filter :-)


   *strchr(timestr, '\n') = '\0';
   bprintf(bp, "%s ", timestr);

^ Isnt this the +1 space?


   } else {
- bprintf(bp, "%*s", twidth, " ");
+ bprintf(bp, "%*s", twidth + 1, " ");

 ^missing from this string?


Inserting an extra space in the format string would also work, sure. I
considered doing it that way but in the end decided it's not
materially more clear one way or another, so used the patch as
submitted.


For me the + 1 leads to a "why is this here", where as the space
in the format string clearly matches the other condition of the else.


In this case it doesn't seem to make much of a difference, since
the string passed is just a blank character (and it does not make
any difference whether a blank is inserted before or behind it).

But in general, I'd rather see "%*s " as the format (which makes
it clear, that the blank is inserted behind the string argument
referenced by %s, not to the left of it - or " %*s" for the other
placement of the extra blank).

But in this particular case I'd use

printf(bp, "%*s ", twidth, "");

since there is no need to pass a non-zero length argument for %s and
I'd think that the purpose of the format string is to make the columns
line up and then to provide one additional blank as a separator for
maximum length values.

Adding 1 to the width argument of "%*s" adds blanks to the left of
the string, which is obvious given the semantics of the format string,
but still takes some thinking compared to trivially seeing the place
where the extra blank is put in a format string ...


Also + 1 causes a run time computation, the extra space does not.


Well, the parsing of the extra blank in the format string can be
assumed to cost more cycles than the increment of a variable plus
the extra loop iteration it causes for the alignment blanks that are
written. But the code length will be shorter with the blank in the
format string and the extra cycles will be irrelevant ...

Regards, STefan


OpenPGP_signature
Description: OpenPGP digital signature


Re: svn commit: r364321 - head/sbin/ipfw

2020-08-31 Thread Rodney W. Grimes
> Hrm, it seems this reply ended up in my spam folder; sorry for not
> replying until now.

lol Oh, bad filter :-)

> > >   *strchr(timestr, '\n') = '\0';
> > >   bprintf(bp, "%s ", timestr);
> >^ Isnt this the +1 space?
> >
> > >   } else {
> > > - bprintf(bp, "%*s", twidth, " ");
> > > + bprintf(bp, "%*s", twidth + 1, " ");
> > ^missing from this string?
> 
> Inserting an extra space in the format string would also work, sure. I
> considered doing it that way but in the end decided it's not
> materially more clear one way or another, so used the patch as
> submitted.

For me the + 1 leads to a "why is this here", where as the space
in the format string clearly matches the other condition of the else.
Also + 1 causes a run time computation, the extra space does not.


-- 
Rod Grimes rgri...@freebsd.org
___
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: r364986 - head/sys/kern

2020-08-31 Thread Andrew Gallatin
Author: gallatin
Date: Mon Aug 31 13:53:14 2020
New Revision: 364986
URL: https://svnweb.freebsd.org/changeset/base/364986

Log:
  make m_getm2() resilient to zone_jumbop exhaustion
  
  When the zone_jumbop is exhausted, most things using
  using sosend* (like sshd)  will eventually
  fail or hang if allocations are limited to the
  depleted jumbop zone.  This makes it imossible to
  communicate with a box which is under an attach which
  exhausts the jumbop zone.
  
  Rather than depending on the page size zone, also try cluster
  allocations to satisfy larger requests.  This allows me
  to ssh to, and serve 100Gb/s of traffic from a server which
  under attack and has had its page-sized zone exhausted.
  
  Reviewed by:  glebius, markj, rmacklem
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D26150

Modified:
  head/sys/kern/kern_mbuf.c

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Mon Aug 31 12:14:20 2020(r364985)
+++ head/sys/kern/kern_mbuf.c   Mon Aug 31 13:53:14 2020(r364986)
@@ -1423,21 +1423,28 @@ m_getm2(struct mbuf *m, int len, int how, short type, 
 
/* Loop and append maximum sized mbufs to the chain tail. */
while (len > 0) {
-   if (len > MCLBYTES)
-   mb = m_getjcl(how, type, (flags & M_PKTHDR),
+   mb = NULL;
+   if (len > MCLBYTES) {
+   mb = m_getjcl(M_NOWAIT, type, (flags & M_PKTHDR),
MJUMPAGESIZE);
-   else if (len >= MINCLSIZE)
-   mb = m_getcl(how, type, (flags & M_PKTHDR));
-   else if (flags & M_PKTHDR)
-   mb = m_gethdr(how, type);
-   else
-   mb = m_get(how, type);
 
-   /* Fail the whole operation if one mbuf can't be allocated. */
+   }
if (mb == NULL) {
-   if (nm != NULL)
+   if (len >= MINCLSIZE)
+   mb = m_getcl(how, type, (flags & M_PKTHDR));
+   else if (flags & M_PKTHDR)
+   mb = m_gethdr(how, type);
+   else
+   mb = m_get(how, type);
+
+   /*
+* Fail the whole operation if one mbuf can't be
+* allocated.
+*/
+   if (mb == NULL) {
m_freem(nm);
-   return (NULL);
+   return (NULL);
+   }
}
 
/* Book keeping. */
___
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: r364984 - head/sys/dev/hyperv/storvsc

2020-08-31 Thread Wei Hu
Author: whu
Date: Mon Aug 31 09:05:45 2020
New Revision: 364984
URL: https://svnweb.freebsd.org/changeset/base/364984

Log:
  Hyper-V: storvsc: Enhance srb_status code handling.
  
  In hv_storvsc_io_request() when coring, prevent changing of the send channel
  from the base channel to another one. storvsc_poll always probes on the base
  channel.
  
  Based upon conversations with Microsoft, changed the handling of srb_status
  codes. Most we should never get, others yes. All are treated as retry-able
  except for two. We should not get these statuses, but if we ever do, the I/O
  state is not known.
  
  Submitted by: Alexander Sideropoulos 
  Reviewed by:  trasz, allanjude, whu
  MFC after:1 week
  Sponsored by: Netapp Inc
  Differential Revision:https://reviews.freebsd.org/D25756

Modified:
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  head/sys/dev/hyperv/storvsc/hv_vstorage.h

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cMon Aug 31 
05:25:13 2020(r364983)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cMon Aug 31 
09:05:45 2020(r364984)
@@ -151,6 +151,12 @@ SYSCTL_UINT(_hw_storvsc, OID_AUTO, max_io, CTLFLAG_RDT
 static int hv_storvsc_chan_cnt = 0;
 SYSCTL_INT(_hw_storvsc, OID_AUTO, chan_cnt, CTLFLAG_RDTUN,
_storvsc_chan_cnt, 0, "# of channels to use");
+#ifdef DIAGNOSTIC
+static int hv_storvsc_srb_status = -1;
+SYSCTL_INT(_hw_storvsc, OID_AUTO, srb_status,  CTLFLAG_RW,
+   _storvsc_srb_status, 0, "srb_status to inject");
+TUNABLE_INT("hw_storvsc.srb_status", _storvsc_srb_status);
+#endif /* DIAGNOSTIC */
 
 #define STORVSC_MAX_IO \
vmbus_chan_prplist_nelem(hv_storvsc_ringbuffer_size,\
@@ -704,7 +710,16 @@ hv_storvsc_io_request(struct storvsc_softc *sc,
vstor_packet->operation = VSTOR_OPERATION_EXECUTESRB;
 
ch_sel = (vstor_packet->u.vm_srb.lun + curcpu) % sc->hs_nchan;
-   outgoing_channel = sc->hs_sel_chan[ch_sel];
+   /*
+* If we are panic'ing, then we are dumping core. Since storvsc_polls
+* always uses sc->hs_chan, then we must send to that channel or a poll
+* timeout will occur.
+*/
+   if (panicstr) {
+   outgoing_channel = sc->hs_chan;
+   } else {
+   outgoing_channel = sc->hs_sel_chan[ch_sel];
+   }
 
mtx_unlock(>softc->hs_lock);
if (request->prp_list.gpa_range.gpa_len) {
@@ -2155,26 +2170,133 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
int srb_status = SRB_STATUS(vm_srb->srb_status);
+#ifdef DIAGNOSTIC
+   if (hv_storvsc_srb_status != -1) {
+   srb_status = SRB_STATUS(hv_storvsc_srb_status & 0x3f);
+   hv_storvsc_srb_status = -1;
+   }
+#endif /* DIAGNOSTIC */
if (vm_srb->scsi_status == SCSI_STATUS_OK) {
if (srb_status != SRB_STATUS_SUCCESS) {
-   /*
-* If there are errors, for example, invalid LUN,
-* host will inform VM through SRB status.
-*/
-   if (bootverbose) {
-   if (srb_status == SRB_STATUS_INVALID_LUN) {
-   xpt_print(ccb->ccb_h.path,
-   "invalid LUN %d for op: %s\n",
-   vm_srb->lun,
-   scsi_op_desc(cmd->opcode, NULL));
-   } else {
-   xpt_print(ccb->ccb_h.path,
-   "Unknown SRB flag: %d for op: %s\n",
-   srb_status,
-   scsi_op_desc(cmd->opcode, NULL));
-   }
+   bool log_error = true;
+   switch (srb_status) {
+   case SRB_STATUS_PENDING:
+   /* We should never get this */
+   panic("storvsc_io_done: 
SRB_STATUS_PENDING");
+   break;
+   case SRB_STATUS_ABORTED:
+   /*
+* storvsc doesn't support aborts yet
+* but if we ever get this status
+* the I/O is complete - treat it as a
+* timeout
+*/
+   ccb->ccb_h.status |= CAM_CMD_TIMEOUT;
+