svn commit: r343678 - head/sys/netpfil/pf

2019-02-01 Thread Gleb Smirnoff
Author: glebius
Date: Sat Feb  2 05:49:05 2019
New Revision: 343678
URL: https://svnweb.freebsd.org/changeset/base/343678

Log:
  Return PFIL_CONSUMED if packet was consumed.  While here gather all
  the identical endings of pf_check_*() into single function.
  
  PR:   235411

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

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Sat Feb  2 04:27:47 2019
(r343677)
+++ head/sys/netpfil/pf/pf_ioctl.c  Sat Feb  2 05:49:05 2019
(r343678)
@@ -4002,6 +4002,26 @@ shutdown_pf(void)
return (error);
 }
 
+static pfil_return_t
+pf_check_return(int chk, struct mbuf **m)
+{
+
+   switch (chk) {
+   case PF_PASS:
+   if (*m == NULL)
+   return (PFIL_CONSUMED);
+   else
+   return (PFIL_PASS);
+   break;
+   default:
+   if (*m != NULL) {
+   m_freem(*m);
+   *m = NULL;
+   }
+   return (PFIL_DROPPED);
+   }
+}
+
 #ifdef INET
 static pfil_return_t
 pf_check_in(struct mbuf **m, struct ifnet *ifp, int flags,
@@ -4010,12 +4030,8 @@ pf_check_in(struct mbuf **m, struct ifnet *ifp, int fl
int chk;
 
chk = pf_test(PF_IN, flags, ifp, m, inp);
-   if (chk && *m) {
-   m_freem(*m);
-   *m = NULL;
-   }
 
-   return (chk == PF_PASS ? PFIL_PASS : PFIL_DROPPED);
+   return (pf_check_return(chk, m));
 }
 
 static pfil_return_t
@@ -4025,12 +4041,8 @@ pf_check_out(struct mbuf **m, struct ifnet *ifp, int f
int chk;
 
chk = pf_test(PF_OUT, flags, ifp, m, inp);
-   if (chk && *m) {
-   m_freem(*m);
-   *m = NULL;
-   }
 
-   return (chk == PF_PASS ? PFIL_PASS : PFIL_DROPPED);
+   return (pf_check_return(chk, m));
 }
 #endif
 
@@ -4049,12 +4061,8 @@ pf_check6_in(struct mbuf **m, struct ifnet *ifp, int f
CURVNET_SET(ifp->if_vnet);
chk = pf_test6(PF_IN, flags, (*m)->m_flags & M_LOOP ? V_loif : ifp, m, 
inp);
CURVNET_RESTORE();
-   if (chk && *m) {
-   m_freem(*m);
-   *m = NULL;
-   }
 
-   return (chk == PF_PASS ? PFIL_PASS : PFIL_DROPPED);
+   return (pf_check_return(chk, m));
 }
 
 static pfil_return_t
@@ -4066,12 +4074,8 @@ pf_check6_out(struct mbuf **m, struct ifnet *ifp, int 
CURVNET_SET(ifp->if_vnet);
chk = pf_test6(PF_OUT, flags, ifp, m, inp);
CURVNET_RESTORE();
-   if (chk && *m) {
-   m_freem(*m);
-   *m = NULL;
-   }
 
-   return (chk == PF_PASS ? PFIL_PASS : PFIL_DROPPED);
+   return (pf_check_return(chk, m));
 }
 #endif /* INET6 */
 
___
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: r343672 - head/libexec/rtld-elf/i386

2019-02-01 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Feb  1 23:16:59 2019
New Revision: 343672
URL: https://svnweb.freebsd.org/changeset/base/343672

Log:
  rtld: pacify -Wmaybe-uninitialized from gcc6
  
  Sponsored by: Dell EMC Isilon

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

Modified: head/libexec/rtld-elf/i386/reloc.c
==
--- head/libexec/rtld-elf/i386/reloc.c  Fri Feb  1 23:15:54 2019
(r343671)
+++ head/libexec/rtld-elf/i386/reloc.c  Fri Feb  1 23:16:59 2019
(r343672)
@@ -146,6 +146,10 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int
} else
cache = NULL;
 
+   /* Appease some compilers. */
+   symval = 0;
+   def = NULL;
+
rellim = (const Elf_Rel *)((const char *)obj->rel + obj->relsize);
for (rel = obj->rel;  rel < rellim;  rel++) {
switch (ELF_R_TYPE(rel->r_info)) {
___
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: r343671 - head/lib/msun

2019-02-01 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Feb  1 23:15:54 2019
New Revision: 343671
URL: https://svnweb.freebsd.org/changeset/base/343671

Log:
  libm: squelch -Woverflow from gcc6
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/msun/Makefile

Modified: head/lib/msun/Makefile
==
--- head/lib/msun/Makefile  Fri Feb  1 23:04:45 2019(r343670)
+++ head/lib/msun/Makefile  Fri Feb  1 23:15:54 2019(r343671)
@@ -108,6 +108,15 @@ COMMON_SRCS+=  catrigl.c \
s_nextafterl.c s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c \
s_scalbnl.c s_sinl.c s_sincosl.c \
s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c
+# Work around this warning from gcc 6:
+# lib/msun/ld80/e_powl.c:275:1: error: floating constant exceeds range of
+# 'long double' [-Werror=overflow]
+# if( y >= LDBL_MAX )
+# See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=130067
+.include 
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 6
+CFLAGS.e_powl.c+= -Wno-error=overflow
+.endif
 .endif
 
 # C99 complex functions
___
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: r343670 - in head/sys: dev/qlnx/qlnxe dev/qlnx/qlnxr modules/qlnx/qlnxr

2019-02-01 Thread Conrad Meyer
Author: cem
Date: Fri Feb  1 23:04:45 2019
New Revision: 343670
URL: https://svnweb.freebsd.org/changeset/base/343670

Log:
  qlnxr(4), qlnxe(4): Unbreak gcc build
  
  Remove redundant definitions and conditionalize Clang-specific CFLAGS.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/qlnx/qlnxe/qlnx_rdma.h
  head/sys/dev/qlnx/qlnxr/qlnxr_verbs.c
  head/sys/modules/qlnx/qlnxr/Makefile

Modified: head/sys/dev/qlnx/qlnxe/qlnx_rdma.h
==
--- head/sys/dev/qlnx/qlnxe/qlnx_rdma.h Fri Feb  1 22:24:14 2019
(r343669)
+++ head/sys/dev/qlnx/qlnxe/qlnx_rdma.h Fri Feb  1 23:04:45 2019
(r343670)
@@ -51,8 +51,6 @@ typedef struct qlnx_rdma_if qlnx_rdma_if_t;
 
 extern int qlnx_rdma_register_if(qlnx_rdma_if_t *rdma_if);
 extern int qlnx_rdma_deregister_if(qlnx_rdma_if_t *rdma_if);
-extern int qlnx_rdma_ll2_set_mac_filter(void *rdma_ctx, uint8_t 
*old_mac_address,
-uint8_t *new_mac_address);
 
 #define QLNX_NUM_CNQ   1
 

Modified: head/sys/dev/qlnx/qlnxr/qlnxr_verbs.c
==
--- head/sys/dev/qlnx/qlnxr/qlnxr_verbs.c   Fri Feb  1 22:24:14 2019
(r343669)
+++ head/sys/dev/qlnx/qlnxr/qlnxr_verbs.c   Fri Feb  1 23:04:45 2019
(r343670)
@@ -74,16 +74,6 @@ __FBSDID("$FreeBSD$");
((unsigned char *))[2], \
((unsigned char *))[3]
 
-struct ib_srq *qlnxr_create_srq(struct ib_pd *,
-   struct ib_srq_init_attr *,
-   struct ib_udata *);
-
-int qlnxr_destroy_srq(struct ib_srq *);
-
-int qlnxr_modify_srq(struct ib_srq *,
-   struct ib_srq_attr *,
-   enum ib_srq_attr_mask,
-   struct ib_udata *);
 static int
 qlnxr_check_srq_params(struct ib_pd *ibpd,
struct qlnxr_dev *dev,
@@ -99,19 +89,6 @@ static int
 qlnxr_alloc_srq_kernel_params(struct qlnxr_srq *srq,
struct qlnxr_dev *dev,
struct ib_srq_init_attr *init_attr);
-
-extern enum _ecore_status_t
-ecore_rdma_modify_srq(void *rdma_cxt,
-   struct ecore_rdma_modify_srq_in_params *in_params);
-
-extern enum _ecore_status_t
-ecore_rdma_destroy_srq(void *rdma_cxt,
-   struct ecore_rdma_destroy_srq_in_params *in_params);
-
-extern enum _ecore_status_t
-ecore_rdma_create_srq(void *rdma_cxt,
-   struct ecore_rdma_create_srq_in_params *in_params,
-   struct ecore_rdma_create_srq_out_params *out_params);
 
 
 static int

Modified: head/sys/modules/qlnx/qlnxr/Makefile
==
--- head/sys/modules/qlnx/qlnxr/MakefileFri Feb  1 22:24:14 2019
(r343669)
+++ head/sys/modules/qlnx/qlnxr/MakefileFri Feb  1 23:04:45 2019
(r343670)
@@ -62,12 +62,14 @@ CFLAGS+= -DINET6 -DINET
 
 CWARNEXTRA += -Wno-cast-qual
 CWARNEXTRA += -Wno-unused-function
+.if ${COMPILER_TYPE} == "clang"
 CWARNEXTRA += -Wno-gnu-variable-sized-type-not-at-end
+.endif
 CWARNEXTRA += -Wno-missing-prototypes
-CWARNEXTRA += -Wno-constant-conversion
+CWARNEXTRA += ${NO_WCONSTANT_CONVERSION}
 CWARNEXTRA += -Wno-format
 
-CWARNEXTRA += -Wno-shift-sign-overflow
+CWARNEXTRA += ${NO_WSHIFT_COUNT_OVERFLOW}
 CWARNEXTRA += -Wno-empty-body
 
 CFLAGS += -DQLNX_DEBUG
___
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: r343669 - head/contrib/elftoolchain/readelf

2019-02-01 Thread Ed Maste
Author: emaste
Date: Fri Feb  1 22:24:14 2019
New Revision: 343669
URL: https://svnweb.freebsd.org/changeset/base/343669

Log:
  readelf: decode FreeBSD note types
  
  Decode NT_FREEBSD_ABI_TAG, NT_FREEBSD_ARCH_TAG, and NT_FREEBSD_FEATURE_CTL.
  
  Reviewed by:  brooks, kib (earlier)
  MFC after:2 weeks
  Relnotes: Yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19054

Modified:
  head/contrib/elftoolchain/readelf/readelf.c

Modified: head/contrib/elftoolchain/readelf/readelf.c
==
--- head/contrib/elftoolchain/readelf/readelf.c Fri Feb  1 21:09:36 2019
(r343668)
+++ head/contrib/elftoolchain/readelf/readelf.c Fri Feb  1 22:24:14 2019
(r343669)
@@ -313,6 +313,8 @@ static void dump_mips_specific_info(struct readelf *re
 static void dump_notes(struct readelf *re);
 static void dump_notes_content(struct readelf *re, const char *buf, size_t sz,
 off_t off);
+static void dump_notes_data(const char *name, uint32_t type, const char *buf,
+size_t sz);
 static void dump_svr4_hash(struct section *s);
 static void dump_svr4_hash64(struct readelf *re, struct section *s);
 static void dump_gnu_hash(struct readelf *re, struct section *s);
@@ -3486,12 +3488,58 @@ dump_notes(struct readelf *re)
}
 }
 
+static struct flag_desc note_feature_ctl_flags[] = {
+   { NT_FREEBSD_FCTL_ASLR_DISABLE, "ASLR_DISABLE" },
+   { 0, NULL }
+};
+
 static void
+dump_notes_data(const char *name, uint32_t type, const char *buf, size_t sz)
+{
+   size_t i;
+   const uint32_t *ubuf;
+
+   /* Note data is at least 4-byte aligned. */
+   if (((uintptr_t)buf & 3) != 0) {
+   warnx("bad note data alignment");
+   goto unknown;
+   }
+   ubuf = (const uint32_t *)(const void *)buf;
+
+   if (strcmp(name, "FreeBSD") == 0) {
+   switch (type) {
+   case NT_FREEBSD_ABI_TAG:
+   if (sz != 4)
+   goto unknown;
+   printf("   ABI tag: %u\n", ubuf[0]);
+   return;
+   /* NT_FREEBSD_NOINIT_TAG carries no data, treat as unknown. */
+   case NT_FREEBSD_ARCH_TAG:
+   if (sz != 4)
+   goto unknown;
+   printf("   Arch tag: %x\n", ubuf[0]);
+   return;
+   case NT_FREEBSD_FEATURE_CTL:
+   if (sz != 4)
+   goto unknown;
+   printf("   Features:");
+   dump_flags(note_feature_ctl_flags, ubuf[0]);
+   printf("\n");
+   return;
+   }
+   }
+unknown:
+   printf("   description data:");
+   for (i = 0; i < sz; i++)
+   printf(" %02x", (unsigned char)buf[i]);
+   printf("\n");
+}
+
+static void
 dump_notes_content(struct readelf *re, const char *buf, size_t sz, off_t off)
 {
Elf_Note *note;
const char *end, *name;
-   uint32_t i;
 
printf("\nNotes at offset %#010jx with length %#010jx:\n",
(uintmax_t) off, (uintmax_t) sz);
@@ -3523,10 +3571,7 @@ dump_notes_content(struct readelf *re, const char *buf
printf("  %-13s %#010jx", name, (uintmax_t) note->n_descsz);
printf("  %s\n", note_type(name, re->ehdr.e_type,
note->n_type));
-   printf("   description data:");
-   for (i = 0; i < note->n_descsz; i++)
-   printf(" %02x", (unsigned char)buf[i]);
-   printf("\n");
+   dump_notes_data(name, note->n_type, buf, note->n_descsz);
buf += roundup2(note->n_descsz, 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: r343668 - head/sys/i386/i386

2019-02-01 Thread Konstantin Belousov
Author: kib
Date: Fri Feb  1 21:09:36 2019
New Revision: 343668
URL: https://svnweb.freebsd.org/changeset/base/343668

Log:
  Disable boot-time memory test on i386 be default.
  
  With the current 24G memory limit for GENERIC, the boot time test
  causes quite visible delay, amplified by the default
  debug.late_console = 0.
  
  The comment text is copied from the same setting explanation for
  amd64.
  
  Suggested by: bde
  Discussed with:   emaste
  Sponsored by: The FreeBSD Foundation
  MFC after:2 months

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

Modified: head/sys/i386/i386/machdep.c
==
--- head/sys/i386/i386/machdep.cFri Feb  1 20:46:47 2019
(r343667)
+++ head/sys/i386/i386/machdep.cFri Feb  1 21:09:36 2019
(r343668)
@@ -2005,13 +2005,15 @@ physmap_done:
Maxmem = atop(physmap[physmap_idx + 1]);
 
/*
-* By default enable the memory test on real hardware, and disable
-* it if we appear to be running in a VM.  This avoids touching all
-* pages unnecessarily, which doesn't matter on real hardware but is
-* bad for shared VM hosts.  Use a general name so that
-* one could eventually do more with the code than just disable it.
+* The boot memory test is disabled by default, as it takes a
+* significant amount of time on large-memory systems, and is
+* unfriendly to virtual machines as it unnecessarily touches all
+* pages.
+*
+* A general name is used as the code may be extended to support
+* additional tests beyond the current "page present" test.
 */
-   memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1;
+   memtest = 0;
TUNABLE_ULONG_FETCH("hw.memtest.tests", );
 
if (atop(physmap[physmap_idx + 1]) != Maxmem &&
___
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: r343667 - head/sys/x86/x86

2019-02-01 Thread Konstantin Belousov
Author: kib
Date: Fri Feb  1 20:46:47 2019
New Revision: 343667
URL: https://svnweb.freebsd.org/changeset/base/343667

Log:
  x86: correctly limit max memory resource address..
  
  CPU and buses can manage up to the limit reported by cpu_maxphyaddr,
  so set mem_rman to the value returned by cpu_getmaxphyaddr().  For the
  PAE mode, it was missed both when rman_res_t was increased to
  uintmax_t, and from the PAE merge commit.
  
  When importing smaps or dump_avail chunks into memory rman, do not
  blindly ignore resources which ends above the limit, chomp them
  instead if start is below the limit.  The same change was already done
  to i386 add_physmap_entry().
  
  Based on the submission by:   bde
  MFC after:2 months

Modified:
  head/sys/x86/x86/nexus.c

Modified: head/sys/x86/x86/nexus.c
==
--- head/sys/x86/x86/nexus.cFri Feb  1 20:42:49 2019(r343666)
+++ head/sys/x86/x86/nexus.cFri Feb  1 20:46:47 2019(r343667)
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -269,11 +270,7 @@ nexus_init_resources(void)
panic("nexus_init_resources port_rman");
 
mem_rman.rm_start = 0;
-#ifndef PAE
-   mem_rman.rm_end = BUS_SPACE_MAXADDR;
-#else
-   mem_rman.rm_end = ((1ULL << cpu_maxphyaddr) - 1);
-#endif
+   mem_rman.rm_end = cpu_getmaxphyaddr();
mem_rman.rm_type = RMAN_ARRAY;
mem_rman.rm_descr = "I/O memory addresses";
if (rman_init(_rman)
@@ -787,6 +784,7 @@ ram_attach(device_t dev)
 {
struct bios_smap *smapbase, *smap, *smapend;
struct resource *res;
+   rman_res_t length;
vm_paddr_t *p;
caddr_t kmdp;
uint32_t smapsize;
@@ -807,16 +805,12 @@ ram_attach(device_t dev)
if (smap->type != SMAP_TYPE_MEMORY ||
smap->length == 0)
continue;
-#ifdef __i386__
-   /*
-* Resources use long's to track resources, so
-* we can't include memory regions above 4GB.
-*/
-   if (smap->base > ~0ul)
+   if (smap->base > mem_rman.rm_end)
continue;
-#endif
+   length = smap->base + smap->length > mem_rman.rm_end ?
+   mem_rman.rm_end - smap->base : smap->length;
error = bus_set_resource(dev, SYS_RES_MEMORY, rid,
-   smap->base, smap->length);
+   smap->base, length);
if (error)
panic(
"ram_attach: resource %d failed set with 
%d",
@@ -841,16 +835,12 @@ ram_attach(device_t dev)
 * segment is 0.
 */
for (rid = 0, p = dump_avail; p[1] != 0; rid++, p += 2) {
-#ifdef PAE
-   /*
-* Resources use long's to track resources, so we can't
-* include memory regions above 4GB.
-*/
-   if (p[0] > ~0ul)
+   if (p[0] > mem_rman.rm_end)
break;
-#endif
+   length = (p[1] > mem_rman.rm_end ? mem_rman.rm_end : p[1]) -
+   p[0];
error = bus_set_resource(dev, SYS_RES_MEMORY, rid, p[0],
-   p[1] - p[0]);
+   length);
if (error)
panic("ram_attach: resource %d failed set with %d", rid,
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: r343666 - in head/sys/dev/cxgbe: . common

2019-02-01 Thread Navdeep Parhar
Author: np
Date: Fri Feb  1 20:42:49 2019
New Revision: 343666
URL: https://svnweb.freebsd.org/changeset/base/343666

Log:
  cxgbe(4): Improved error reporting and diagnostics.
  
  "slow" interrupt handler:
  - Expand the list of INT_CAUSE registers known to the driver.
  - Add decode information for many more bits but decouple it from the
rest of intr_info so that it is entirely optional.
  - Call t4_fatal_err exactly once, and from the top level PL intr handler.
  
  t4_fatal_err:
  - Use t4_shutdown_adapter from the common code to stop the adapter.
  - Stop servicing slow interrupts after the first fatal one.
  
  Driver/firmware interaction:
  - CH_DUMP_MBOX: note whether the mailbox being dumped is a command or a
reply or something else.
  - Log the raw value of pcie_fw for some errors.
  - Use correct log levels (debug vs. error).
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hFri Feb  1 20:28:15 2019
(r343665)
+++ head/sys/dev/cxgbe/adapter.hFri Feb  1 20:42:49 2019
(r343666)
@@ -155,7 +155,7 @@ enum {
CHK_MBOX_ACCESS = (1 << 2),
MASTER_PF   = (1 << 3),
ADAP_SYSCTL_CTX = (1 << 4),
-   /* TOM_INIT_DONE= (1 << 5), No longer used */
+   ADAP_ERR= (1 << 5),
BUF_PACKING_OK  = (1 << 6),
IS_VF   = (1 << 7),
 
@@ -175,6 +175,7 @@ enum {
DF_LOAD_FW_ANYTIME  = (1 << 1), /* Allow LOAD_FW after init */
DF_DISABLE_TCB_CACHE= (1 << 2), /* Disable TCB cache (T6+) */
DF_DISABLE_CFG_RETRY= (1 << 3), /* Disable fallback config */
+   DF_VERBOSE_SLOWINTR = (1 << 4), /* Chatty slow intr handler */
 };
 
 #define IS_DOOMED(vi)  ((vi)->flags & DOOMED)
@@ -932,24 +933,6 @@ struct adapter {
 #define TXQ_LOCK_ASSERT_OWNED(txq) EQ_LOCK_ASSERT_OWNED(&(txq)->eq)
 #define TXQ_LOCK_ASSERT_NOTOWNED(txq)  EQ_LOCK_ASSERT_NOTOWNED(&(txq)->eq)
 
-#define CH_DUMP_MBOX(sc, mbox, data_reg) \
-   do { \
-   if (sc->debug_flags & DF_DUMP_MBOX) { \
-   log(LOG_NOTICE, \
-   "%s mbox %u: %016llx %016llx %016llx %016llx " \
-   "%016llx %016llx %016llx %016llx\n", \
-   device_get_nameunit(sc->dev), mbox, \
-   (unsigned long long)t4_read_reg64(sc, data_reg), \
-   (unsigned long long)t4_read_reg64(sc, data_reg + 
8), \
-   (unsigned long long)t4_read_reg64(sc, data_reg + 
16), \
-   (unsigned long long)t4_read_reg64(sc, data_reg + 
24), \
-   (unsigned long long)t4_read_reg64(sc, data_reg + 
32), \
-   (unsigned long long)t4_read_reg64(sc, data_reg + 
40), \
-   (unsigned long long)t4_read_reg64(sc, data_reg + 
48), \
-   (unsigned long long)t4_read_reg64(sc, data_reg + 
56)); \
-   } \
-   } while (0)
-
 #define for_each_txq(vi, iter, q) \
for (q = >pi->adapter->sge.txq[vi->first_txq], iter = 0; \
iter < vi->ntxq; ++iter, ++q)
@@ -1103,6 +1086,38 @@ t4_use_ldst(struct adapter *sc)
 #else
return (0);
 #endif
+}
+
+static inline void
+CH_DUMP_MBOX(struct adapter *sc, int mbox, const int reg,
+const char *msg, const __be64 *const p, const bool err)
+{
+
+   if (!(sc->debug_flags & DF_DUMP_MBOX) && !err)
+   return;
+   if (p != NULL) {
+   log(err ? LOG_ERR : LOG_DEBUG,
+   "%s: mbox %u %s %016llx %016llx %016llx %016llx "
+   "%016llx %016llx %016llx %016llx\n",
+   device_get_nameunit(sc->dev), mbox, msg,
+   (long long)be64_to_cpu(p[0]), (long long)be64_to_cpu(p[1]),
+   (long long)be64_to_cpu(p[2]), (long long)be64_to_cpu(p[3]),
+   (long long)be64_to_cpu(p[4]), (long long)be64_to_cpu(p[5]),
+   (long long)be64_to_cpu(p[6]), (long long)be64_to_cpu(p[7]));
+   } else {
+   log(err ? LOG_ERR : LOG_DEBUG,
+   "%s: mbox %u %s %016llx %016llx %016llx %016llx "
+   "%016llx %016llx %016llx %016llx\n",
+   device_get_nameunit(sc->dev), mbox, msg,
+   (long long)t4_read_reg64(sc, reg),
+   (long long)t4_read_reg64(sc, reg + 8),
+   (long long)t4_read_reg64(sc, reg + 16),
+   (long long)t4_read_reg64(sc, reg + 24),
+   (long long)t4_read_reg64(sc, reg + 32),
+   (long long)t4_read_reg64(sc, reg + 40),
+

svn commit: r343665 - head/contrib/elftoolchain/readelf

2019-02-01 Thread Ed Maste
Author: emaste
Date: Fri Feb  1 20:28:15 2019
New Revision: 343665
URL: https://svnweb.freebsd.org/changeset/base/343665

Log:
  readelf: use table-based DT_FLAGS and DT_FLAGS_1 decoding
  
  Fewer lines of code and more maintainable.
  
  Reviewed by:  brooks, kib
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19053

Modified:
  head/contrib/elftoolchain/readelf/readelf.c

Modified: head/contrib/elftoolchain/readelf/readelf.c
==
--- head/contrib/elftoolchain/readelf/readelf.c Fri Feb  1 18:19:33 2019
(r343664)
+++ head/contrib/elftoolchain/readelf/readelf.c Fri Feb  1 20:28:15 2019
(r343665)
@@ -220,6 +220,11 @@ struct mips_option {
const char *desc;
 };
 
+struct flag_desc {
+   uint64_t flag;
+   const char *desc;
+};
+
 static void add_dumpop(struct readelf *re, size_t si, const char *sn, int op,
 int t);
 static const char *aeabi_adv_simd_arch(uint64_t simd);
@@ -293,8 +298,7 @@ static void dump_dwarf_ranges_foreach(struct readelf *
 static void dump_dwarf_str(struct readelf *re);
 static void dump_eflags(struct readelf *re, uint64_t e_flags);
 static void dump_elf(struct readelf *re);
-static void dump_dt_flags_val(uint64_t d_val);
-static void dump_dt_flags_1_val(uint64_t d_val);
+static void dump_flags(struct flag_desc *fd, uint64_t flags);
 static void dump_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32_t stab);
 static void dump_dynamic(struct readelf *re);
 static void dump_liblist(struct readelf *re);
@@ -2723,6 +2727,58 @@ dump_arch_dyn_val(struct readelf *re, GElf_Dyn *dyn)
 }
 
 static void
+dump_flags(struct flag_desc *desc, uint64_t val)
+{
+   struct flag_desc *fd;
+
+   for (fd = desc; fd->flag != 0; fd++) {
+   if (val & fd->flag) {
+   val &= ~fd->flag;
+   printf(" %s", fd->desc);
+   }
+   }
+   if (val != 0)
+   printf(" unknown (0x%jx)", (uintmax_t)val);
+}
+
+static struct flag_desc dt_flags[] = {
+   { DF_ORIGIN,"ORIGIN" },
+   { DF_SYMBOLIC,  "SYMBOLIC" },
+   { DF_TEXTREL,   "TEXTREL" },
+   { DF_BIND_NOW,  "BIND_NOW" },
+   { DF_STATIC_TLS,"STATIC_TLS" },
+   { 0, NULL }
+};
+
+static struct flag_desc dt_flags_1[] = {
+   { DF_1_BIND_NOW,"NOW" },
+   { DF_1_GLOBAL,  "GLOBAL" },
+   { 0x4,  "GROUP" },
+   { DF_1_NODELETE,"NODELETE" },
+   { DF_1_LOADFLTR,"LOADFLTR" },
+   { 0x20, "INITFIRST" },
+   { DF_1_NOOPEN,  "NOOPEN" },
+   { DF_1_ORIGIN,  "ORIGIN" },
+   { 0x100,"DIRECT" },
+   { DF_1_INTERPOSE,   "INTERPOSE" },
+   { DF_1_NODEFLIB,"NODEFLIB" },
+   { 0x1000,   "NODUMP" },
+   { 0x2000,   "CONFALT" },
+   { 0x4000,   "ENDFILTEE" },
+   { 0x8000,   "DISPRELDNE" },
+   { 0x1,  "DISPRELPND" },
+   { 0x2,  "NODIRECT" },
+   { 0x4,  "IGNMULDEF" },
+   { 0x8,  "NOKSYMS" },
+   { 0x10, "NOHDR" },
+   { 0x20, "EDITED" },
+   { 0x40, "NORELOC" },
+   { 0x80, "SYMINTPOSE" },
+   { 0x100,"GLOBAUDIT" },
+   { 0, NULL }
+};
+
+static void
 dump_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32_t stab)
 {
const char *name;
@@ -2807,146 +2863,14 @@ dump_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32
printf(" %s\n", timestamp(dyn->d_un.d_val));
break;
case DT_FLAGS:
-   dump_dt_flags_val(dyn->d_un.d_val);
+   dump_flags(dt_flags, dyn->d_un.d_val);
break;
case DT_FLAGS_1:
-   dump_dt_flags_1_val(dyn->d_un.d_val);
+   dump_flags(dt_flags_1, dyn->d_un.d_val);
break;
default:
printf("\n");
}
-}
-
-static void
-dump_dt_flags_val(uint64_t d_val)
-{
-   if (d_val & 0x1) {
-   d_val ^= 0x1;
-   printf(" ORIGIN");
-   }
-   if (d_val & 0x2) {
-   d_val ^= 0x2;
-   printf(" SYMBOLIC");
-   }
-   if (d_val & 0x4) {
-   d_val ^= 0x4;
-   printf(" TEXTREL");
-   }
-   if (d_val & 0x8) {
-   d_val ^= 0x8;
-   printf(" BIND_NOW");
-   }
-   if (d_val & 0x10) {
-   d_val ^= 0x10;
-   printf(" STATIC_TLS");
-   }
-   if (d_val)
-   printf(" %jx", (uintmax_t)d_val);
-   printf("\n");
-}
-
-static void
-dump_dt_flags_1_val(uint64_t d_val)
-{
-   if (d_val & 0x1) {
-   d_val ^= 0x1;
-   printf(" 

svn commit: r343663 - head/sys/teken

2019-02-01 Thread Bruce Evans
Author: bde
Date: Fri Feb  1 16:07:49 2019
New Revision: 343663
URL: https://svnweb.freebsd.org/changeset/base/343663

Log:
  Fix function keys for syscons in cons25 mode (vidcontrol -T cons25).
  
  kbd(4) (but only documented in atkbd(4)) maintains a table of strings
  for 96 function keys.  Using teken broke this 9+ years ago for the
  most usable first 12 function keys and for 10 cursor keys, by supplying
  its own non-programmable strings so that the keyboard driver's strings
  are not used.
  
  Fix this by supplying NULL in the teken layer for syscons in cons25 mode
  so that the the strings are found in the kbd(4) layer.
  
  vt needs more changes to use kbd(4)'s tables.  Teken's cons25 table is
  still needed to supply nonempty strings for vt in cons25 mode.
  
  Keep using teken's xterm tables for both syscons and vt in xterm mode.
  Function keys should at least default to xterm values in xterm mode,
  and kbd(4) doesn't support this.
  
  teken_set_cons25() sets a sticky flag to ask for the fix, and space is
  reserved for another new flag.  vt should set this flag when it uses
  kbd(4)'s tables.
  
  PR:   226553 (for vt)

Modified:
  head/sys/teken/teken.c

Modified: head/sys/teken/teken.c
==
--- head/sys/teken/teken.c  Fri Feb  1 15:38:20 2019(r343662)
+++ head/sys/teken/teken.c  Fri Feb  1 16:07:49 2019(r343663)
@@ -58,6 +58,7 @@
 #defineTS_CONS25   0x0040  /* cons25 emulation. */
 #defineTS_INSTRING 0x0080  /* Inside string. */
 #defineTS_CURSORKEYS   0x0100  /* Cursor keys mode. */
+#defineTS_CONS25KEYS   0x0400  /* Fuller cons25 emul (fix function 
keys). */
 
 /* Character that blanks a cell. */
 #defineBLANK   ' '
@@ -411,7 +412,7 @@ void
 teken_set_cons25(teken_t *t)
 {
 
-   t->t_stateflags |= TS_CONS25;
+   t->t_stateflags |= TS_CONS25 | TS_CONS25KEYS;
 }
 
 /*
@@ -722,6 +723,9 @@ teken_get_sequence(const teken_t *t, unsigned int k)
 {
 
/* Cons25 mode. */
+   if ((t->t_stateflags & (TS_CONS25 | TS_CONS25KEYS)) ==
+   (TS_CONS25 | TS_CONS25KEYS))
+   return (NULL);  /* Don't override good kbd(4) strings. */
if (t->t_stateflags & TS_CONS25 &&
k < sizeof special_strings_cons25 / sizeof(char *))
return (special_strings_cons25[k]);
___
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: r343661 - in head/sys/netinet: . tcp_stacks

2019-02-01 Thread Michael Tuexen
Author: tuexen
Date: Fri Feb  1 12:33:00 2019
New Revision: 343661
URL: https://svnweb.freebsd.org/changeset/base/343661

Log:
  When handling SYN-ACK segments in the SYN-RCVD state, set tp->snd_wnd
  consistently.
  
  This inconsistency was observed when working on the bug reported in
  PR 235256, although it does not fix the reported issue. The fix for
  the PR will be a separate commit.
  
  PR:   235256
  Reviewed by:  rrs@, Richard Scheffenegger
  MFC after:3 days
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D19033

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_stacks/rack.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cFri Feb  1 12:24:56 2019
(r343660)
+++ head/sys/netinet/tcp_input.cFri Feb  1 12:33:00 2019
(r343661)
@@ -2385,8 +2385,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru
if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
(TF_RCVD_SCALE|TF_REQ_SCALE)) {
tp->rcv_scale = tp->request_r_scale;
-   tp->snd_wnd = tiwin;
}
+   tp->snd_wnd = tiwin;
/*
 * Make transitions:
 *  SYN-RECEIVED  -> ESTABLISHED

Modified: head/sys/netinet/tcp_stacks/rack.c
==
--- head/sys/netinet/tcp_stacks/rack.c  Fri Feb  1 12:24:56 2019
(r343660)
+++ head/sys/netinet/tcp_stacks/rack.c  Fri Feb  1 12:33:00 2019
(r343661)
@@ -5433,6 +5433,7 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, st
tp->ts_recent_age = tcp_ts_getticks();
tp->ts_recent = to->to_tsval;
}
+   tp->snd_wnd = tiwin;
/*
 * If the ACK bit is off:  if in SYN-RECEIVED state or SENDSYN flag
 * is on (half-synchronized state), then queue data for later
@@ -5440,7 +5441,6 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, st
 */
if ((thflags & TH_ACK) == 0) {
if (IS_FASTOPEN(tp->t_flags)) {
-   tp->snd_wnd = tiwin;
cc_conn_init(tp);
}
return (rack_process_data(m, th, so, tp, drop_hdrlen, tlen,
@@ -5452,7 +5452,6 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, st
if ((tp->t_flags & (TF_RCVD_SCALE | TF_REQ_SCALE)) ==
(TF_RCVD_SCALE | TF_REQ_SCALE)) {
tp->rcv_scale = tp->request_r_scale;
-   tp->snd_wnd = tiwin;
}
/*
 * Make transitions: SYN-RECEIVED  -> ESTABLISHED SYN-RECEIVED* ->
___
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: r343646 - head/sys/netinet

2019-02-01 Thread Gleb Smirnoff
Author: glebius
Date: Fri Feb  1 08:10:26 2019
New Revision: 343646
URL: https://svnweb.freebsd.org/changeset/base/343646

Log:
  Repair siftr(4): PFIL_IN and PFIL_OUT are defines of some value, relying
  on them having particular values can break things.

Modified:
  head/sys/netinet/siftr.c

Modified: head/sys/netinet/siftr.c
==
--- head/sys/netinet/siftr.cFri Feb  1 07:48:37 2019(r343645)
+++ head/sys/netinet/siftr.cFri Feb  1 08:10:26 2019(r343646)
@@ -172,8 +172,11 @@ static MALLOC_DEFINE(M_SIFTR_HASHNODE, "siftr_hashnode
 struct pkt_node {
/* Timestamp of pkt as noted in the pfil hook. */
struct timeval  tval;
-   /* Direction pkt is travelling; either PFIL_IN or PFIL_OUT. */
-   uint8_t direction;
+   /* Direction pkt is travelling. */
+   enum {
+   DIR_IN = 0,
+   DIR_OUT = 1,
+   }   direction;
/* IP version pkt_node relates to; either INP_IPV4 or INP_IPV6. */
uint8_t ipver;
/* Hash of the pkt which triggered the log message. */
@@ -286,11 +289,7 @@ static struct alq *siftr_alq = NULL;
 static struct mtx siftr_pkt_queue_mtx;
 static struct mtx siftr_pkt_mgr_mtx;
 static struct thread *siftr_pkt_manager_thr = NULL;
-/*
- * pfil.h defines PFIL_IN as 1 and PFIL_OUT as 2,
- * which we use as an index into this array.
- */
-static char direction[3] = {'\0', 'i','o'};
+static char direction[2] = {'i','o'};
 
 /* Required function prototypes. */
 static int siftr_sysctl_enabled_handler(SYSCTL_HANDLER_ARGS);
@@ -409,7 +408,7 @@ siftr_process_pkt(struct pkt_node * pkt_node)
LIST_INSERT_HEAD(counter_list, hash_node, nodes);
} else {
/* Malloc failed. */
-   if (pkt_node->direction == PFIL_IN)
+   if (pkt_node->direction == DIR_IN)
ss->nskip_in_malloc++;
else
ss->nskip_out_malloc++;
@@ -812,7 +811,7 @@ siftr_siftdata(struct pkt_node *pn, struct inpcb *inp,
INP_RUNLOCK(inp);
 
pn->ipver = ipver;
-   pn->direction = dir;
+   pn->direction = (dir == PFIL_IN ? DIR_IN : DIR_OUT);
 
/*
 * Significantly more accurate than using getmicrotime(), but slower!
___
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: r343645 - head/sys/contrib/ipfilter/netinet

2019-02-01 Thread Gleb Smirnoff
Author: glebius
Date: Fri Feb  1 07:48:37 2019
New Revision: 343645
URL: https://svnweb.freebsd.org/changeset/base/343645

Log:
  Unbreak call to ipf_check(): it expects the out parameter to be 0 or 1.
  
  Pointy hat to:glebius
  Reported by:  cy

Modified:
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Fri Feb  1 06:19:12 
2019(r343644)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Fri Feb  1 07:48:37 
2019(r343645)
@@ -135,8 +135,8 @@ ipf_check_wrapper(struct mbuf **mp, struct ifnet *ifp,
pfil_return_t rv;
 
CURVNET_SET(ifp->if_vnet);
-   rv = ipf_check(_ipfmain, ip, ip->ip_hl << 2, ifp, (flags & PFIL_OUT),
-   mp);
+   rv = ipf_check(_ipfmain, ip, ip->ip_hl << 2, ifp,
+   !!(flags & PFIL_OUT), mp);
CURVNET_RESTORE();
return (rv == 0 ? PFIL_PASS : PFIL_DROPPED);
 }
@@ -150,7 +150,7 @@ ipf_check_wrapper6(struct mbuf **mp, struct ifnet *ifp
 
CURVNET_SET(ifp->if_vnet);
rv = ipf_check(_ipfmain, mtod(*mp, struct ip *),
-   sizeof(struct ip6_hdr), ifp, (flags & PFIL_OUT), mp);
+   sizeof(struct ip6_hdr), ifp, !!(flags & PFIL_OUT), mp);
CURVNET_RESTORE();
 
return (rv == 0 ? PFIL_PASS : PFIL_DROPPED);
___
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"