svn commit: r310674 - head/sys/dev/sound/pci/hda

2016-12-27 Thread Michal Meloun
Author: mmel
Date: Wed Dec 28 07:37:26 2016
New Revision: 310674
URL: https://svnweb.freebsd.org/changeset/base/310674

Log:
  Limit number of stripes supported by HDA codec to maximum number
  announced by HDA controller.
  Incorrectly implermented HDA codec may report support for more stripes
  that HDA controller already have. Due to this, always limit number of
  enabled stripes by global controller maximum.
  
  Reviewed by:  mav
  MFC after:1 month
  Differential Revision: https://reviews.freebsd.org/D8922

Modified:
  head/sys/dev/sound/pci/hda/hdaa.c
  head/sys/dev/sound/pci/hda/hdac.c
  head/sys/dev/sound/pci/hda/hdac.h

Modified: head/sys/dev/sound/pci/hda/hdaa.c
==
--- head/sys/dev/sound/pci/hda/hdaa.c   Wed Dec 28 06:16:55 2016
(r310673)
+++ head/sys/dev/sound/pci/hda/hdaa.c   Wed Dec 28 07:37:26 2016
(r310674)
@@ -2130,7 +2130,8 @@ hdaa_channel_start(struct hdaa_chan *ch)
uint32_t fmt;
 
fmt = hdaa_stream_format(ch);
-   ch->stripectl = fls(ch->stripecap & hdaa_allowed_stripes(fmt)) - 1;
+   ch->stripectl = fls(ch->stripecap & hdaa_allowed_stripes(fmt) &
+   hda_get_stripes_mask(devinfo->dev)) - 1;
ch->sid = HDAC_STREAM_ALLOC(device_get_parent(devinfo->dev), 
devinfo->dev,
ch->dir == PCMDIR_PLAY ? 1 : 0, fmt, ch->stripectl, >dmapos);
if (ch->sid <= 0)

Modified: head/sys/dev/sound/pci/hda/hdac.c
==
--- head/sys/dev/sound/pci/hda/hdac.c   Wed Dec 28 06:16:55 2016
(r310673)
+++ head/sys/dev/sound/pci/hda/hdac.c   Wed Dec 28 07:37:26 2016
(r310674)
@@ -1767,6 +1767,9 @@ hdac_read_ivar(device_t dev, device_t ch
case HDA_IVAR_DMA_NOCACHE:
*result = (sc->flags & HDAC_F_DMA_NOCACHE) != 0;
break;
+   case HDA_IVAR_STRIPES_MASK:
+   *result = (1 << (1 << sc->num_sdo)) - 1;
+   break;
default:
return (ENOENT);
}

Modified: head/sys/dev/sound/pci/hda/hdac.h
==
--- head/sys/dev/sound/pci/hda/hdac.h   Wed Dec 28 06:16:55 2016
(r310673)
+++ head/sys/dev/sound/pci/hda/hdac.h   Wed Dec 28 07:37:26 2016
(r310674)
@@ -707,6 +707,7 @@ enum hdac_device_ivars {
 HDA_IVAR_SUBSYSTEM_ID,
 HDA_IVAR_NODE_TYPE,
 HDA_IVAR_DMA_NOCACHE,
+HDA_IVAR_STRIPES_MASK,
 };
 
 #define HDA_ACCESSOR(var, ivar, type)  \
@@ -723,6 +724,7 @@ HDA_ACCESSOR(subdevice_id,  SUBDEVICE_ID,
 HDA_ACCESSOR(subsystem_id, SUBSYSTEM_ID,   uint32_t);
 HDA_ACCESSOR(node_type,NODE_TYPE,  uint8_t);
 HDA_ACCESSOR(dma_nocache,  DMA_NOCACHE,uint8_t);
+HDA_ACCESSOR(stripes_mask, STRIPES_MASK,   uint8_t);
 
 #define PCIS_MULTIMEDIA_HDA0x03
 
___
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: r310669 - head/usr.sbin/bsnmpd/modules/snmp_pf

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Wed Dec 28 06:10:58 2016
New Revision: 310669
URL: https://svnweb.freebsd.org/changeset/base/310669

Log:
  style(9): clean up whitespace
  
  MFC after:3 days

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c

Modified: head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c  Wed Dec 28 05:43:14 
2016(r310668)
+++ head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c  Wed Dec 28 06:10:58 
2016(r310669)
@@ -1640,20 +1640,20 @@ err:
 static int
 altq_is_enabled(int pfdev)
 {
-struct pfioc_altq pa;
+   struct pfioc_altq pa;
 
errno = 0;
-if (ioctl(pfdev, DIOCGETALTQS, )) {
-if (errno == ENODEV) {
+   if (ioctl(pfdev, DIOCGETALTQS, )) {
+   if (errno == ENODEV) {
syslog(LOG_INFO, "No ALTQ support in kernel\n"
"ALTQ related functions disabled\n");
-return (0);
-} else
-syslog(LOG_ERR, "DIOCGETALTQS returned an error: %s",
+   return (0);
+   } else
+   syslog(LOG_ERR, "DIOCGETALTQS returned an error: %s",
strerror(errno));
return (-1);
-}
-return (1);
+   }
+   return (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"


Re: svn commit: r310650 - in head/sys/mips: include mips

2016-12-27 Thread Adrian Chadd
hiya,

so I dug into the mips24k definition of this. It says this:

"
3.4.3 Uncached accelerated writes
The 24K core permits memory regions to be marked as “uncached
accelerated”. This type of region is useful to hard-
ware which is “write only” - perhaps video frame buffers, or some
other hardware stream. Sequential word stores in
such regions are gathered into cache-line-sized chunks, before being
written with a single burst cycle on the CPU
interface.
Such regions are uncached for read, and partial-word or
out-of-sequence writes have “unpredictable” effects - don’t
do them. The burst write is normally performed when software writes to
the last location in the memory block or does
an uncached-accelerated write to some other block; but it can also be
triggered by a
sync instruction, a pref nudge, a matching load or any exception. If
the block is not completely written by the time it’s pushed out, it
will be written using a series of doubleword or smaller write cycles
over the 24K core’s 64-bit memory interface.
"

So, question is - is our write combining page attribute in the VM
suitable for this? Is it defined as "only do full sequential word
writes"? Or do we risk having some other platform use it in a less
"don't do this" way and then MIPS is the one at fault again? :)


-adrian



On 27 December 2016 at 18:55, Alexander Kabaev  wrote:
> Author: kan
> Date: Wed Dec 28 02:55:26 2016
> New Revision: 310650
> URL: https://svnweb.freebsd.org/changeset/base/310650
>
> Log:
>   Implement pmap_change_attr and related APIs on MIPS
>
>   On platforms that have uncached-accelerate cache attribute, map it
>   to VM_MEMATTR_WRITE_COMBINING. Otherwise, leave write comining
>   undefined.
>
>   Reviewed by:  adrian, jhb (glance)
>   Differential Revision:https://reviews.freebsd.org/D8894
>
> Modified:
>   head/sys/mips/include/cpuregs.h
>   head/sys/mips/include/pmap.h
>   head/sys/mips/include/pte.h
>   head/sys/mips/include/vm.h
>   head/sys/mips/mips/pmap.c
>
> Modified: head/sys/mips/include/cpuregs.h
> ==
> --- head/sys/mips/include/cpuregs.h Tue Dec 27 23:56:46 2016
> (r310649)
> +++ head/sys/mips/include/cpuregs.h Wed Dec 28 02:55:26 2016
> (r310650)
> @@ -171,6 +171,10 @@
>  #defineMIPS_CCA_CACHED MIPS_CCA_CCS
>  #endif
>
> +#if defined(CPU_XBURST)
> +#defineMIPS_CCA_UA 0x01
> +#endif
> +
>  #ifndefMIPS_CCA_UNCACHED
>  #defineMIPS_CCA_UNCACHED   MIPS_CCA_UC
>  #endif
> @@ -188,6 +192,16 @@
>  #endif
>  #endif
>
> +/*
> + * Use uncached-accelerated mode for write-combining maps, if one is defined,
> + * otherwise fall back to uncached
> + */
> +#ifndef MIPS_CCA_WC
> +#ifdef MIPS_CCA_UA
> +#defineMIPS_CCA_WC MIPS_CCA_UA
> +#endif
> +#endif
> +
>  #defineMIPS_PHYS_TO_XKPHYS(cca,x) \
> ((0x2ULL << 62) | ((unsigned long long)(cca) << 59) | (x))
>  #defineMIPS_PHYS_TO_XKPHYS_CACHED(x) \
>
> Modified: head/sys/mips/include/pmap.h
> ==
> --- head/sys/mips/include/pmap.hTue Dec 27 23:56:46 2016
> (r310649)
> +++ head/sys/mips/include/pmap.hWed Dec 28 02:55:26 2016
> (r310650)
> @@ -74,7 +74,8 @@ struct md_page {
>  };
>
>  #definePV_TABLE_REF0x02/* referenced */
> -#definePV_MEMATTR_UNCACHEABLE  0x04
> +#definePV_MEMATTR_MASK 0xf0/* store vm_memattr_t here */
> +#definePV_MEMATTR_SHIFT0x04
>
>  #defineASID_BITS   8
>  #defineASIDGEN_BITS(32 - ASID_BITS)
> @@ -163,22 +164,24 @@ extern vm_offset_t virtual_end;
>
>  extern vm_paddr_t dump_avail[PHYS_AVAIL_ENTRIES + 2];
>
> -#definepmap_page_get_memattr(m)VM_MEMATTR_DEFAULT
> +#definepmap_page_get_memattr(m) (((m)->md.pv_flags & 
> PV_MEMATTR_MASK) >> PV_MEMATTR_SHIFT)
>  #definepmap_page_is_mapped(m)  (!TAILQ_EMPTY(&(m)->md.pv_list))
>  #definepmap_page_is_write_mapped(m)(((m)->aflags & 
> PGA_WRITEABLE) != 0)
>
>  void pmap_bootstrap(void);
>  void *pmap_mapdev(vm_paddr_t, vm_size_t);
> +void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t);
>  void pmap_unmapdev(vm_offset_t, vm_size_t);
>  vm_offset_t pmap_steal_memory(vm_size_t size);
>  void pmap_kenter(vm_offset_t va, vm_paddr_t pa);
> -void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr);
> +void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t attr);
>  void pmap_kremove(vm_offset_t va);
>  void *pmap_kenter_temporary(vm_paddr_t pa, int i);
>  void pmap_kenter_temporary_free(vm_paddr_t pa);
>  void pmap_flush_pvcache(vm_page_t m);
>  int pmap_emulate_modified(pmap_t pmap, vm_offset_t va);
>  void pmap_page_set_memattr(vm_page_t, vm_memattr_t);
> +int pmap_change_attr(vm_offset_t, vm_size_t, vm_memattr_t);
>
>  #endif

svn commit: r310668 - head/usr.sbin/bsnmpd/tools/libbsnmptools

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Wed Dec 28 05:43:14 2016
New Revision: 310668
URL: https://svnweb.freebsd.org/changeset/base/310668

Log:
  style(9) fixes: clean up leading whitespace
  
  MFC after:3 days

Modified:
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
==
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c   Wed Dec 28 
05:42:41 2016(r310667)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c   Wed Dec 28 
05:43:14 2016(r310668)
@@ -1090,6 +1090,7 @@ snmp_ip2asn_oid(char *str, struct asn_oi
char *endptr, *ptr;
 
ptr = str;
+
for (i = 0; i < 4; i++) {
v = strtoul(ptr, , 10);
if (v > 0xff)
___
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: r310667 - head/usr.sbin/bsnmpd/modules/snmp_bridge

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Wed Dec 28 05:42:41 2016
New Revision: 310667
URL: https://svnweb.freebsd.org/changeset/base/310667

Log:
  style(9) fixes: clean up leading whitespace
  
  MFC after:3 days

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c

Modified: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c   Wed Dec 28 
05:41:53 2016(r310666)
+++ head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c   Wed Dec 28 
05:42:41 2016(r310667)
@@ -1472,7 +1472,7 @@ bridge_do_pfctl(int32_t bridge_ctl, enum
} else
s_len = 0;
 
-len = sizeof(i);
+   len = sizeof(i);
 
strcpy(mib_name, bridge_sysctl);
 
___
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: r310666 - head/usr.sbin/bsnmpd/modules/snmp_hostres

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Wed Dec 28 05:41:53 2016
New Revision: 310666
URL: https://svnweb.freebsd.org/changeset/base/310666

Log:
  style(9) fixes
  
  - Clean up trailing whitespace
  - Fix variable type alignment in storage_OS_get_swap(..)
  
  MFC after:3 days

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c

Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c  Wed Dec 
28 05:21:22 2016(r310665)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c  Wed Dec 
28 05:41:53 2016(r310666)
@@ -123,7 +123,7 @@ device_entry_create(const char *name, co
if (map == NULL) {
/* new object - get a new index */
if (next_device_index > INT_MAX) {
-   syslog(LOG_ERR,
+   syslog(LOG_ERR,
"%s: hrDeviceTable index wrap", __func__);
/* There isn't much we can do here.
 * If the next_swins_index is consumed

Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c  Wed Dec 28 
05:21:22 2016(r310665)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c  Wed Dec 28 
05:41:53 2016(r310666)
@@ -131,7 +131,7 @@ static const struct {
const struct asn_oid*oid;   /* the OID to return */
 } fs_type_map[] = {
{ "ufs",_hrFSBerkeleyFFS_c },
-   { "zfs",_hrFSOther_c },
+   { "zfs",_hrFSOther_c },
{ "cd9660", _hrFSiso9660_c },
{ "nfs",_hrFSNFS_c },
{ "ext2fs", _hrFSLinuxExt2_c },
@@ -167,7 +167,7 @@ fs_entry_create(const char *name)
/* new object - get a new index */
if (next_fs_index > INT_MAX) {
/* Unrecoverable error - die clean and quicly*/
-   syslog(LOG_ERR, "%s: hrFSTable index wrap", __func__);
+   syslog(LOG_ERR, "%s: hrFSTable index wrap", __func__);
errx(EX_SOFTWARE, "hrFSTable index wrap");
}
 

Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c   Wed Dec 
28 05:21:22 2016(r310665)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c   Wed Dec 
28 05:41:53 2016(r310666)
@@ -177,7 +177,7 @@ partition_entry_create(int32_t ds_index,
 
if (next_partition_index > INT_MAX) {
/* Unrecoverable error - die clean and quicly*/
-   syslog(LOG_ERR, "%s: hrPartitionTable index wrap",
+   syslog(LOG_ERR, "%s: hrPartitionTable index wrap",
__func__);
errx(EX_SOFTWARE, "hrPartitionTable index wrap");
}

Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c Wed Dec 28 
05:21:22 2016(r310665)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c Wed Dec 28 
05:41:53 2016(r310666)
@@ -193,7 +193,7 @@ OS_getSystemInitialLoadParameters(u_char
syslog(LOG_ERR, "malloc failed");
return (SNMP_ERR_GENERR);
}
-if (sysctl(mib, 2, buf, _len, NULL, 0)) {
+   if (sysctl(mib, 2, buf, _len, NULL, 0)) {
syslog(LOG_ERR,
"sysctl({CTL_KERN,KERN_BOOTFILE}) failed: %m");
free(buf);
@@ -296,7 +296,7 @@ OS_getMemorySize(uint32_t *ms)
*ms = UINT32_MAX;
else
*ms = phys_mem_size;
-return (SNMP_ERR_NOERROR);
+   return (SNMP_ERR_NOERROR);
 }
 
 /*
@@ -360,7 +360,7 @@ OS_setSystemDate(const struct timeval *t
if (settimeofday(timeval_to_set, NULL) == -1) {
syslog(LOG_ERR, "settimeofday failed: %m");
return (SNMP_ERR_GENERR);
-}
+   }
return (SNMP_ERR_NOERROR);
 }
 
@@ -378,7 +378,7 @@ op_hrSystem(struct 

svn commit: r310664 - in head: tools/build/mk usr.sbin/bsnmpd/modules

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Wed Dec 28 05:16:41 2016
New Revision: 310664
URL: https://svnweb.freebsd.org/changeset/base/310664

Log:
  Only build/install usr.sbin/bsnmpd/modules/snmp_wlan if MK_WIRELESS != no
  
  MFC after:1 week

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.sbin/bsnmpd/modules/Makefile

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Dec 28 05:05:08 
2016(r310663)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Dec 28 05:16:41 
2016(r310664)
@@ -9021,6 +9021,12 @@ OLD_FILES+=usr/share/man/man8/wlandebug.
 OLD_FILES+=usr/share/man/man8/wpa_cli.8.gz
 OLD_FILES+=usr/share/man/man8/wpa_passphrase.8.gz
 OLD_FILES+=usr/share/man/man8/wpa_supplicant.8.gz
+OLD_FILES+=usr/lib/snmp_wlan.so
+OLD_LIBS+=usr/lib/snmp_wlan.so.6
+# bsnmp module
+OLD_FILES+=usr/share/man/man3/snmp_wlan.3.gz
+OLD_FILES+=usr/share/snmp/defs/wlan_tree.def
+OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-WIRELESS-MIB.txt
 .endif
 
 .if ${MK_SVNLITE} == no || ${MK_SVN} == yes

Modified: head/usr.sbin/bsnmpd/modules/Makefile
==
--- head/usr.sbin/bsnmpd/modules/Makefile   Wed Dec 28 05:05:08 2016
(r310663)
+++ head/usr.sbin/bsnmpd/modules/Makefile   Wed Dec 28 05:16:41 2016
(r310664)
@@ -17,7 +17,6 @@ SUBDIR=   ${_snmp_atm} \
snmp_target \
snmp_usm \
snmp_vacm \
-   snmp_wlan
 
 .if ${MK_PF} != "no"
 SUBDIR+=snmp_pf
@@ -27,6 +26,10 @@ SUBDIR+=snmp_pf
 SUBDIR+=snmp_netgraph
 .endif
 
+.if ${MK_WIRELESS} != "no"
+SUBDIR+=snmp_wlan
+.endif
+
 INCS=  snmpmod.h
 INCSDIR= ${INCLUDEDIR}/bsnmp
 
___
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: r310663 - head/contrib/bsnmp/snmpd

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Wed Dec 28 05:05:08 2016
New Revision: 310663
URL: https://svnweb.freebsd.org/changeset/base/310663

Log:
  style(9): ip_get(..): clean up whitespace
  
  MFC after:3 days

Modified:
  head/contrib/bsnmp/snmpd/export.c

Modified: head/contrib/bsnmp/snmpd/export.c
==
--- head/contrib/bsnmp/snmpd/export.c   Wed Dec 28 04:56:15 2016
(r310662)
+++ head/contrib/bsnmp/snmpd/export.c   Wed Dec 28 05:05:08 2016
(r310663)
@@ -194,6 +194,7 @@ ip_get(struct snmp_value *value, u_char 
value->v.ipaddress[1] = valp[1];
value->v.ipaddress[2] = valp[2];
value->v.ipaddress[3] = valp[3];
+
return (SNMP_ERR_NOERROR);
 }
 
___
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: r310662 - head/contrib/bsnmp/lib

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Wed Dec 28 04:56:15 2016
New Revision: 310662
URL: https://svnweb.freebsd.org/changeset/base/310662

Log:
  style(9): snmp_send_packet(..): fix whitespace
  
  MFC after:3 days

Modified:
  head/contrib/bsnmp/lib/snmpclient.c

Modified: head/contrib/bsnmp/lib/snmpclient.c
==
--- head/contrib/bsnmp/lib/snmpclient.c Wed Dec 28 04:55:43 2016
(r310661)
+++ head/contrib/bsnmp/lib/snmpclient.c Wed Dec 28 04:56:15 2016
(r310662)
@@ -1227,9 +1227,9 @@ snmp_next_reqid(struct snmp_client * c)
 static int32_t
 snmp_send_packet(struct snmp_pdu * pdu)
 {
-u_char *buf;
-struct asn_buf b;
-ssize_t ret;
+   u_char *buf;
+   struct asn_buf b;
+   ssize_t ret;
 
if ((buf = malloc(snmp_client.txbuflen)) == NULL) {
seterr(_client, "%s", strerror(errno));
___
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: r310661 - head/sys/boot/i386/loader

2016-12-27 Thread Ed Maste
Author: emaste
Date: Wed Dec 28 04:55:43 2016
New Revision: 310661
URL: https://svnweb.freebsd.org/changeset/base/310661

Log:
  loader: use strip -o instead of cp and strip in place
  
  It is simpler and cleaner to have strip produce the stripped output
  directly than copying the input to the output first.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/boot/i386/loader/Makefile

Modified: head/sys/boot/i386/loader/Makefile
==
--- head/sys/boot/i386/loader/Makefile  Wed Dec 28 04:53:52 2016
(r310660)
+++ head/sys/boot/i386/loader/Makefile  Wed Dec 28 04:55:43 2016
(r310661)
@@ -99,8 +99,7 @@ ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTX
-b ${BTXKERN} ${LOADER}.bin
 
 ${LOADER}.bin: ${LOADER}.sym
-   cp ${.ALLSRC} ${.TARGET}
-   strip -R .comment -R .note ${.TARGET}
+   strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC}
 
 loader.help: help.common help.i386
cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > 
${.TARGET}
___
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: r310660 - head/contrib/bsnmp/lib

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Wed Dec 28 04:53:52 2016
New Revision: 310660
URL: https://svnweb.freebsd.org/changeset/base/310660

Log:
  style(9): fix whitespace in pdu_encode_secparams(..)
  
  MFC after:3 days

Modified:
  head/contrib/bsnmp/lib/snmp.c

Modified: head/contrib/bsnmp/lib/snmp.c
==
--- head/contrib/bsnmp/lib/snmp.c   Wed Dec 28 04:48:30 2016
(r310659)
+++ head/contrib/bsnmp/lib/snmp.c   Wed Dec 28 04:53:52 2016
(r310660)
@@ -357,8 +357,8 @@ static enum snmp_code
 pdu_encode_secparams(struct asn_buf *b, struct snmp_pdu *pdu)
 {
u_char buf[256], *sptr;
-struct asn_buf tb;
-size_t auth_off, moved = 0;
+   struct asn_buf tb;
+   size_t auth_off, moved = 0;
 
auth_off = 0;
memset(buf, 0, 256);
___
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: r310658 - head/sys/dev/hyperv/netvsc

2016-12-27 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Dec 28 04:47:17 2016
New Revision: 310658
URL: https://svnweb.freebsd.org/changeset/base/310658

Log:
  hyperv/hn: Factor out function to set rxfilter.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8928

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Wed Dec 28 04:35:52 2016
(r310657)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Wed Dec 28 04:47:17 2016
(r310658)
@@ -333,6 +333,7 @@ static void hn_link_status(struct hn_s
 static int hn_create_rx_data(struct hn_softc *, int);
 static voidhn_destroy_rx_data(struct hn_softc *);
 static int hn_check_iplen(const struct mbuf *, int);
+static int hn_set_rxfilter(struct hn_softc *, uint32_t);
 static int hn_rxfilter_config(struct hn_softc *);
 #ifndef RSS
 static int hn_rss_reconfig(struct hn_softc *);
@@ -684,11 +685,25 @@ do {  
\
 #endif /* INET6 || INET */
 
 static int
+hn_set_rxfilter(struct hn_softc *sc, uint32_t filter)
+{
+   int error = 0;
+
+   HN_LOCK_ASSERT(sc);
+
+   if (sc->hn_rx_filter != filter) {
+   error = hn_rndis_set_rxfilter(sc, filter);
+   if (!error)
+   sc->hn_rx_filter = filter;
+   }
+   return (error);
+}
+
+static int
 hn_rxfilter_config(struct hn_softc *sc)
 {
struct ifnet *ifp = sc->hn_ifp;
uint32_t filter;
-   int error = 0;
 
HN_LOCK_ASSERT(sc);
 
@@ -703,13 +718,7 @@ hn_rxfilter_config(struct hn_softc *sc)
!TAILQ_EMPTY(>if_multiaddrs))
filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
}
-
-   if (sc->hn_rx_filter != filter) {
-   error = hn_rndis_set_rxfilter(sc, filter);
-   if (!error)
-   sc->hn_rx_filter = filter;
-   }
-   return (error);
+   return (hn_set_rxfilter(sc, filter));
 }
 
 static void
@@ -4817,8 +4826,7 @@ hn_suspend_data(struct hn_softc *sc)
/*
 * Disable RX by clearing RX filter.
 */
-   sc->hn_rx_filter = NDIS_PACKET_TYPE_NONE;
-   hn_rndis_set_rxfilter(sc, sc->hn_rx_filter);
+   hn_set_rxfilter(sc, NDIS_PACKET_TYPE_NONE);
 
/*
 * Give RNDIS enough time to flush all pending data packets.
___
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: r310657 - head/sys/dev/hyperv/netvsc

2016-12-27 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Dec 28 04:35:52 2016
New Revision: 310657
URL: https://svnweb.freebsd.org/changeset/base/310657

Log:
  hyperv/hn: Function renaming; no functional changes.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8908

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Wed Dec 28 04:31:07 2016
(r310656)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Wed Dec 28 04:35:52 2016
(r310657)
@@ -333,7 +333,7 @@ static void hn_link_status(struct hn_s
 static int hn_create_rx_data(struct hn_softc *, int);
 static voidhn_destroy_rx_data(struct hn_softc *);
 static int hn_check_iplen(const struct mbuf *, int);
-static int hn_set_rxfilter(struct hn_softc *);
+static int hn_rxfilter_config(struct hn_softc *);
 #ifndef RSS
 static int hn_rss_reconfig(struct hn_softc *);
 #endif
@@ -684,7 +684,7 @@ do {
\
 #endif /* INET6 || INET */
 
 static int
-hn_set_rxfilter(struct hn_softc *sc)
+hn_rxfilter_config(struct hn_softc *sc)
 {
struct ifnet *ifp = sc->hn_ifp;
uint32_t filter;
@@ -2431,7 +2431,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
 * reply.
 */
HN_NO_SLEEPING(sc);
-   hn_set_rxfilter(sc);
+   hn_rxfilter_config(sc);
HN_SLEEPING_OK(sc);
} else {
hn_init_locked(sc);
@@ -2508,7 +2508,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
 * the RNDIS reply.
 */
HN_NO_SLEEPING(sc);
-   hn_set_rxfilter(sc);
+   hn_rxfilter_config(sc);
HN_SLEEPING_OK(sc);
}
 
@@ -2566,7 +2566,7 @@ hn_init_locked(struct hn_softc *sc)
return;
 
/* Configure RX filter */
-   hn_set_rxfilter(sc);
+   hn_rxfilter_config(sc);
 
/* Clear OACTIVE bit. */
atomic_clear_int(>if_drv_flags, IFF_DRV_OACTIVE);
@@ -4925,7 +4925,7 @@ hn_resume_data(struct hn_softc *sc)
/*
 * Re-enable RX.
 */
-   hn_set_rxfilter(sc);
+   hn_rxfilter_config(sc);
 
/*
 * Make sure to clear suspend status on "all" TX rings,
___
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: r310656 - head/contrib/bsnmp/snmpd

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Wed Dec 28 04:31:07 2016
New Revision: 310656
URL: https://svnweb.freebsd.org/changeset/base/310656

Log:
  style(9): sort alignment in udp_recv(..)
  
  MFC after:3 weeks

Modified:
  head/contrib/bsnmp/snmpd/trans_udp.c

Modified: head/contrib/bsnmp/snmpd/trans_udp.c
==
--- head/contrib/bsnmp/snmpd/trans_udp.cWed Dec 28 04:29:09 2016
(r310655)
+++ head/contrib/bsnmp/snmpd/trans_udp.cWed Dec 28 04:31:07 2016
(r310656)
@@ -334,10 +334,10 @@ static ssize_t
 udp_recv(struct tport *tp, struct port_input *pi)
 {
struct udp_port *p = (struct udp_port *)tp;
+   struct cmsghdr *cmsgp;
struct in_addr *laddr;
struct msghdr msg;
char cbuf[CMSG_SPACE(sizeof(struct in_addr))];
-   struct cmsghdr *cmsgp;
ssize_t ret;
 
memset(cbuf, 0, sizeof(cbuf));
___
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: r310655 - head/contrib/bsnmp/snmpd

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Wed Dec 28 04:29:09 2016
New Revision: 310655
URL: https://svnweb.freebsd.org/changeset/base/310655

Log:
  Fix bsnmpd sending/receiving with multi-homed configurations or INADDR_ANY 
used
  as the listening address in snmpd_input(..)
  
  Stash the IPv4 address of the receiver via the recv(..) callback and use it in
  the send(..) callback for the transport by specifying IP_SENDSRCADDR for the
  control message type.
  
  Add sendmsg logic to the UDP transport's send(..) callback and use the
  respective send(..) callback for the transport instead of calling sendto in
  snmpd_input(..).
  
  MFC after:  3 weeks
  Obtained from:  Isilon OneFS (^/onefs/branches/BR_8_0_0_DEV@r507595)
  Submitted by:   Thor Steingrimsson 
  Sponsored by:   Dell EMC Isilon

Modified:
  head/contrib/bsnmp/snmpd/main.c
  head/contrib/bsnmp/snmpd/snmpd.h
  head/contrib/bsnmp/snmpd/trans_lsock.c
  head/contrib/bsnmp/snmpd/trans_udp.c
  head/contrib/bsnmp/snmpd/trans_udp.h

Modified: head/contrib/bsnmp/snmpd/main.c
==
--- head/contrib/bsnmp/snmpd/main.c Wed Dec 28 03:56:25 2016
(r310654)
+++ head/contrib/bsnmp/snmpd/main.c Wed Dec 28 04:29:09 2016
(r310655)
@@ -1040,10 +1040,8 @@ snmpd_input(struct port_input *pi, struc
 #ifdef USE_TCPWRAPPERS
char client[16];
 #endif
-   struct msghdr msg;
-   struct iovec iov[1];
 
-   ret = tport->transport->vtab->recv(pi);
+   ret = tport->transport->vtab->recv(tport, pi);
if (ret == -1)
return (-1);
 
@@ -1186,21 +1184,15 @@ snmpd_input(struct port_input *pi, struc
sndbuf, , "SNMP", ierr, vi, NULL);
 
if (ferr == SNMPD_INPUT_OK) {
-   msg.msg_name = pi->peer;
-   msg.msg_namelen = pi->peerlen;
-   msg.msg_iov = iov;
-   msg.msg_iovlen = 1;
-   msg.msg_flags = 0;
-   iov[0].iov_base = sndbuf;
-   iov[0].iov_len = sndlen;
-
-   slen = sendmsg(pi->fd, , 0);
+   slen = tport->transport->vtab->send(tport, sndbuf, sndlen,
+   pi->peer, pi->peerlen);
if (slen == -1)
-   syslog(LOG_ERR, "sendmsg: %m");
+   syslog(LOG_ERR, "send*: %m");
else if ((size_t)slen != sndlen)
-   syslog(LOG_ERR, "sendmsg: short write %zu/%zu",
-   sndlen, (size_t)slen);
+   syslog(LOG_ERR, "send*: short write %zu/%zu", sndlen,
+   (size_t)slen);
}
+
snmp_pdu_free();
free(sndbuf);
snmp_input_consume(pi);

Modified: head/contrib/bsnmp/snmpd/snmpd.h
==
--- head/contrib/bsnmp/snmpd/snmpd.hWed Dec 28 03:56:25 2016
(r310654)
+++ head/contrib/bsnmp/snmpd/snmpd.hWed Dec 28 04:29:09 2016
(r310655)
@@ -193,7 +193,7 @@ struct transport_def {
 
ssize_t (*send)(struct tport *, const u_char *, size_t,
const struct sockaddr *, size_t);
-   ssize_t (*recv)(struct port_input *);
+   ssize_t (*recv)(struct tport *, struct port_input *);
 };
 struct transport {
struct asn_oid  index;  /* transport table index */

Modified: head/contrib/bsnmp/snmpd/trans_lsock.c
==
--- head/contrib/bsnmp/snmpd/trans_lsock.c  Wed Dec 28 03:56:25 2016
(r310654)
+++ head/contrib/bsnmp/snmpd/trans_lsock.c  Wed Dec 28 04:29:09 2016
(r310655)
@@ -59,7 +59,7 @@ static void lsock_close_port(struct tpor
 static int lsock_init_port(struct tport *);
 static ssize_t lsock_send(struct tport *, const u_char *, size_t,
 const struct sockaddr *, size_t);
-static ssize_t lsock_recv(struct port_input *);
+static ssize_t lsock_recv(struct tport *, struct port_input *);
 
 /* exported */
 const struct transport_def lsock_trans = {
@@ -444,7 +444,7 @@ check_priv_stream(struct port_input *pi)
  * Receive something
  */
 static ssize_t
-lsock_recv(struct port_input *pi)
+lsock_recv(struct tport *tp __unused, struct port_input *pi)
 {
struct msghdr msg;
struct iovec iov[1];

Modified: head/contrib/bsnmp/snmpd/trans_udp.c
==
--- head/contrib/bsnmp/snmpd/trans_udp.cWed Dec 28 03:56:25 2016
(r310654)
+++ head/contrib/bsnmp/snmpd/trans_udp.cWed Dec 28 04:29:09 2016
(r310655)
@@ -55,7 +55,7 @@ static void udp_close_port(struct tport 
 static int udp_init_port(struct tport *);
 static ssize_t udp_send(struct tport *, const u_char *, size_t,
 const struct sockaddr *, size_t);
-static ssize_t udp_recv(struct port_input *);
+static ssize_t udp_recv(struct 

svn commit: r310654 - in head: tools/build/mk usr.sbin/bsnmpd/bsnmpd

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Wed Dec 28 03:56:25 2016
New Revision: 310654
URL: https://svnweb.freebsd.org/changeset/base/310654

Log:
  Install snmpmod.3 as all of the bsnmpd APIs it documents
  
  MFC after:3 days

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.sbin/bsnmpd/bsnmpd/Makefile

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Dec 28 03:40:54 
2016(r310653)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Dec 28 03:56:25 
2016(r310654)
@@ -782,22 +782,119 @@ OLD_FILES+=usr/share/man/man1/bsnmpget.1
 OLD_FILES+=usr/share/man/man1/bsnmpset.1.gz
 OLD_FILES+=usr/share/man/man1/bsnmpwalk.1.gz
 OLD_FILES+=usr/share/man/man1/gensnmptree.1.gz
+OLD_FILES+=usr/share/man/man3/FIND_OBJECT_INT.3.gz
+OLD_FILES+=usr/share/man/man3/FIND_OBJECT_INT_LINK.3.gz
+OLD_FILES+=usr/share/man/man3/FIND_OBJECT_INT_LINK_INDEX.3.gz
+OLD_FILES+=usr/share/man/man3/FIND_OBJECT_OID.3.gz
+OLD_FILES+=usr/share/man/man3/FIND_OBJECT_OID_LINK.3.gz
+OLD_FILES+=usr/share/man/man3/FIND_OBJECT_OID_LINK_INDEX.3.gz
+OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_INT.3.gz
+OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_INT_LINK.3.gz
+OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_INT_LINK_INDEX.3.gz
+OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_OID.3.gz
+OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_OID_LINK.3.gz
+OLD_FILES+=usr/share/man/man3/INSERT_OBJECT_OID_LINK_INDEX.3.gz
+OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_INT.3.gz
+OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_INT_LINK.3.gz
+OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_INT_LINK_INDEX.3.gz
+OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_OID.3.gz
+OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_OID_LINK.3.gz
+OLD_FILES+=usr/share/man/man3/NEXT_OBJECT_OID_LINK_INDEX.3.gz
 OLD_FILES+=usr/share/man/man3/asn1.3.gz
 OLD_FILES+=usr/share/man/man3/bsnmpagent.3.gz
 OLD_FILES+=usr/share/man/man3/bsnmpclient.3.gz
+OLD_FILES+=usr/share/man/man3/bsnmpd_get_target_stats.3.gz
+OLD_FILES+=usr/share/man/man3/bsnmpd_get_usm_stats.3.gz
+OLD_FILES+=usr/share/man/man3/bsnmpd_reset_usm_stats.3.gz
 OLD_FILES+=usr/share/man/man3/bsnmplib.3.gz
+OLD_FILES+=usr/share/man/man3/buf_alloc.3.gz
+OLD_FILES+=usr/share/man/man3/buf_size.3.gz
+OLD_FILES+=usr/share/man/man3/comm_define.3.gz
+OLD_FILES+=usr/share/man/man3/community.3.gz
+OLD_FILES+=usr/share/man/man3/fd_deselect.3.gz
+OLD_FILES+=usr/share/man/man3/fd_resume.3.gz
+OLD_FILES+=usr/share/man/man3/fd_select.3.gz
+OLD_FILES+=usr/share/man/man3/fd_suspend.3.gz
+OLD_FILES+=usr/share/man/man3/get_ticks.3.gz
+OLD_FILES+=usr/share/man/man3/index_append.3.gz
+OLD_FILES+=usr/share/man/man3/index_append_off.3.gz
+OLD_FILES+=usr/share/man/man3/index_compare.3.gz
+OLD_FILES+=usr/share/man/man3/index_compare_off.3.gz
+OLD_FILES+=usr/share/man/man3/index_decode.3.gz
+OLD_FILES+=usr/share/man/man3/ip_commit.3.gz
+OLD_FILES+=usr/share/man/man3/ip_get.3.gz
+OLD_FILES+=usr/share/man/man3/ip_rollback.3.gz
+OLD_FILES+=usr/share/man/man3/ip_save.3.gz
+OLD_FILES+=usr/share/man/man3/or_register.3.gz
+OLD_FILES+=usr/share/man/man3/or_unregister.3.gz
+OLD_FILES+=usr/share/man/man3/oid_commit.3.gz
+OLD_FILES+=usr/share/man/man3/oid_get.3.gz
+OLD_FILES+=usr/share/man/man3/oid_rollback.3.gz
+OLD_FILES+=usr/share/man/man3/oid_save.3.gz
+OLD_FILES+=usr/share/man/man3/oid_usmNotInTimeWindows.3.gz
+OLD_FILES+=usr/share/man/man3/oid_usmUnknownEngineIDs.3.gz
+OLD_FILES+=usr/share/man/man3/oid_zeroDotZero.3.gz
+OLD_FILES+=usr/share/man/man3/reqid_allocate.3.gz
+OLD_FILES+=usr/share/man/man3/reqid_base.3.gz
+OLD_FILES+=usr/share/man/man3/reqid_istype.3.gz
+OLD_FILES+=usr/share/man/man3/reqid_next.3.gz
+OLD_FILES+=usr/share/man/man3/reqid_type.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_atm.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_bridge.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_hast.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_hostres.3.gz
+OLD_FILES+=usr/share/man/man3/snmp_input_finish.3.gz
+OLD_FILES+=usr/share/man/man3/snmp_input_start.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_lm75.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_mibII.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_netgraph.3.gz
+OLD_FILES+=usr/share/man/man3/snmp_output.3.gz
+OLD_FILES+=usr/share/man/man3/snmp_pdu_auth_access.3.gz
+OLD_FILES+=usr/share/man/man3/snmp_send_port.3.gz
+OLD_FILES+=usr/share/man/man3/snmp_send_trap.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_target.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_usm.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_vacm.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_wlan.3.gz
+OLD_FILES+=usr/share/man/man3/snmpd_target_stat.3.gz
+OLD_FILES+=usr/share/man/man3/snmpd_usmstats.3.gz
 OLD_FILES+=usr/share/man/man3/snmpmod.3.gz
+OLD_FILES+=usr/share/man/man3/start_tick.3.gz
+OLD_FILES+=usr/share/man/man3/string_commit.3.gz
+OLD_FILES+=usr/share/man/man3/string_free.3.gz
+OLD_FILES+=usr/share/man/man3/string_get.3.gz

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

2016-12-27 Thread Justin Hibbits
Author: jhibbits
Date: Wed Dec 28 03:40:54 2016
New Revision: 310653
URL: https://svnweb.freebsd.org/changeset/base/310653

Log:
  Restrict SLB handler to powerpc64 and AIM
  
  Only Book-S has SLBs.  Book-E does not, so restrict it to only Book-S (which 
we
  call AIM).

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

Modified: head/sys/powerpc/powerpc/trap.c
==
--- head/sys/powerpc/powerpc/trap.c Wed Dec 28 03:19:59 2016
(r310652)
+++ head/sys/powerpc/powerpc/trap.c Wed Dec 28 03:40:54 2016
(r310653)
@@ -88,7 +88,7 @@ static intfix_unaligned(struct thread *
 static int handle_onfault(struct trapframe *frame);
 static voidsyscall(struct trapframe *frame);
 
-#ifdef __powerpc64__
+#if defined(__powerpc64__) && defined(AIM)
voidhandle_kernel_slb_spill(int, register_t, register_t);
 static int handle_user_slb_spill(pmap_t pm, vm_offset_t addr);
 extern int n_slbs;
@@ -208,7 +208,7 @@ trap(struct trapframe *frame)
ucode = TRAP_TRACE;
break;
 
-#ifdef __powerpc64__
+#if defined(__powerpc64__) && defined(AIM)
case EXC_ISE:
case EXC_DSE:
if (handle_user_slb_spill(>p_vmspace->vm_pmap,
@@ -347,7 +347,7 @@ trap(struct trapframe *frame)
}
break;
 #endif
-#ifdef __powerpc64__
+#if defined(__powerpc64__) && defined(AIM)
case EXC_DSE:
if ((frame->dar & SEGMENT_MASK) == USER_ADDR) {
__asm __volatile ("slbmte %0, %1" ::
@@ -578,7 +578,7 @@ syscall(struct trapframe *frame)
td = curthread;
td->td_frame = frame;
 
-#ifdef __powerpc64__
+#if defined(__powerpc64__) && defined(AIM)
/*
 * Speculatively restore last user SLB segment, which we know is
 * invalid already, since we are likely to do copyin()/copyout().
@@ -591,7 +591,7 @@ syscall(struct trapframe *frame)
syscallret(td, error, );
 }
 
-#ifdef __powerpc64__
+#if defined(__powerpc64__) && defined(AIM)
 /* Handle kernel SLB faults -- runs in real mode, all seat belts off */
 void
 handle_kernel_slb_spill(int type, register_t dar, register_t srr0)
___
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: r310652 - head/sys/dev/hyperv/netvsc

2016-12-27 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Dec 28 03:19:59 2016
New Revision: 310652
URL: https://svnweb.freebsd.org/changeset/base/310652

Log:
  hyperv/hn: Consolidate hn_{suspend,resume}
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8907

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Wed Dec 28 03:07:58 2016
(r310651)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Wed Dec 28 03:19:59 2016
(r310652)
@@ -2367,9 +2367,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
break;
}
 
-   /* Disable polling. */
-   hn_polling(sc, 0);
-
/*
 * Suspend this interface before the synthetic parts
 * are ripped.
@@ -2415,13 +2412,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
 */
hn_resume(sc);
 
-   /*
-* Re-enable polling if this interface is running and
-* the polling is requested.
-*/
-   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && sc->hn_pollhz > 0)
-   hn_polling(sc, sc->hn_pollhz);
-
HN_UNLOCK(sc);
break;
 
@@ -4900,6 +4890,9 @@ static void
 hn_suspend(struct hn_softc *sc)
 {
 
+   /* Disable polling. */
+   hn_polling(sc, 0);
+
if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING)
hn_suspend_data(sc);
hn_suspend_mgmt(sc);
@@ -4992,6 +4985,13 @@ hn_resume(struct hn_softc *sc)
if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING)
hn_resume_data(sc);
hn_resume_mgmt(sc);
+
+   /*
+* Re-enable polling if this interface is running and
+* the polling is requested.
+*/
+   if ((sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) && sc->hn_pollhz > 0)
+   hn_polling(sc, sc->hn_pollhz);
 }
 
 static void 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r310651 - head/sys/dev/hyperv/vmbus

2016-12-27 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Dec 28 03:07:58 2016
New Revision: 310651
URL: https://svnweb.freebsd.org/changeset/base/310651

Log:
  hyperv/vmbus: Nuke unnecessary critical sections.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8906

Modified:
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_chan.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Wed Dec 28 02:55:26 2016
(r310650)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Wed Dec 28 03:07:58 2016
(r310651)
@@ -1393,7 +1393,7 @@ cleanup:
vmbus_xact_ctx_destroy(sc->vmbus_xc);
sc->vmbus_xc = NULL;
}
-   free(sc->vmbus_chmap, M_DEVBUF);
+   free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF);
mtx_destroy(>vmbus_prichan_lock);
mtx_destroy(>vmbus_chan_lock);
 
@@ -1480,7 +1480,7 @@ vmbus_detach(device_t dev)
sc->vmbus_xc = NULL;
}
 
-   free(sc->vmbus_chmap, M_DEVBUF);
+   free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF);
mtx_destroy(>vmbus_prichan_lock);
mtx_destroy(>vmbus_chan_lock);
 

Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c
==
--- head/sys/dev/hyperv/vmbus/vmbus_chan.c  Wed Dec 28 02:55:26 2016
(r310650)
+++ head/sys/dev/hyperv/vmbus/vmbus_chan.c  Wed Dec 28 03:07:58 2016
(r310651)
@@ -775,9 +775,7 @@ vmbus_chan_clrchmap_task(void *xchan, in
 {
struct vmbus_channel *chan = xchan;
 
-   critical_enter();
chan->ch_vmbus->vmbus_chmap[chan->ch_id] = NULL;
-   critical_exit();
 }
 
 static void
@@ -1308,15 +1306,17 @@ vmbus_chan_pollcfg_task(void *xarg, int 
chan->ch_poll_flags = poll_flags;
 
/*
-* Disable interrupt from the RX bufring (TX bufring does not
-* generate interrupt to VM), and disconnect this channel from
-* the channel map to make sure that ISR can not enqueue this
-* channel task anymore.
+* Disconnect this channel from the channel map to make sure that
+* the RX bufring interrupt enabling bit can not be touched, and
+* ISR can not enqueue this channel task anymore.  THEN, disable
+* interrupt from the RX bufring (TX bufring does not generate
+* interrupt to VM).
+*
+* NOTE: order is critical.
 */
-   critical_enter();
-   vmbus_rxbr_intr_mask(>ch_rxbr);
chan->ch_vmbus->vmbus_chmap[chan->ch_id] = NULL;
-   critical_exit();
+   __compiler_membar();
+   vmbus_rxbr_intr_mask(>ch_rxbr);
 
/*
 * NOTE:
@@ -1380,11 +1380,9 @@ vmbus_chan_polldis_task(void *xchan, int
 * Plug this channel back to the channel map and unmask
 * the RX bufring interrupt.
 */
-   critical_enter();
chan->ch_vmbus->vmbus_chmap[chan->ch_id] = chan;
__compiler_membar();
vmbus_rxbr_intr_unmask(>ch_rxbr);
-   critical_exit();
 
/*
 * Kick start the interrupt task, just in case unmasking

Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h
==
--- head/sys/dev/hyperv/vmbus/vmbus_var.h   Wed Dec 28 02:55:26 2016
(r310650)
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h   Wed Dec 28 03:07:58 2016
(r310651)
@@ -93,7 +93,7 @@ struct vmbus_softc {
 
u_long  *vmbus_rx_evtflags;
/* compat evtflgs from host */
-   struct vmbus_channel**vmbus_chmap;
+   struct vmbus_channel *volatile *vmbus_chmap;
struct vmbus_xact_ctx   *vmbus_xc;
struct vmbus_pcpu_data  vmbus_pcpu[MAXCPU];
 
___
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: r310650 - in head/sys/mips: include mips

2016-12-27 Thread Alexander Kabaev
Author: kan
Date: Wed Dec 28 02:55:26 2016
New Revision: 310650
URL: https://svnweb.freebsd.org/changeset/base/310650

Log:
  Implement pmap_change_attr and related APIs on MIPS
  
  On platforms that have uncached-accelerate cache attribute, map it
  to VM_MEMATTR_WRITE_COMBINING. Otherwise, leave write comining
  undefined.
  
  Reviewed by:  adrian, jhb (glance)
  Differential Revision:https://reviews.freebsd.org/D8894

Modified:
  head/sys/mips/include/cpuregs.h
  head/sys/mips/include/pmap.h
  head/sys/mips/include/pte.h
  head/sys/mips/include/vm.h
  head/sys/mips/mips/pmap.c

Modified: head/sys/mips/include/cpuregs.h
==
--- head/sys/mips/include/cpuregs.h Tue Dec 27 23:56:46 2016
(r310649)
+++ head/sys/mips/include/cpuregs.h Wed Dec 28 02:55:26 2016
(r310650)
@@ -171,6 +171,10 @@
 #defineMIPS_CCA_CACHED MIPS_CCA_CCS
 #endif
 
+#if defined(CPU_XBURST)
+#defineMIPS_CCA_UA 0x01
+#endif
+
 #ifndefMIPS_CCA_UNCACHED
 #defineMIPS_CCA_UNCACHED   MIPS_CCA_UC
 #endif
@@ -188,6 +192,16 @@
 #endif
 #endif
 
+/*
+ * Use uncached-accelerated mode for write-combining maps, if one is defined,
+ * otherwise fall back to uncached
+ */
+#ifndef MIPS_CCA_WC
+#ifdef MIPS_CCA_UA
+#defineMIPS_CCA_WC MIPS_CCA_UA
+#endif
+#endif
+
 #defineMIPS_PHYS_TO_XKPHYS(cca,x) \
((0x2ULL << 62) | ((unsigned long long)(cca) << 59) | (x))
 #defineMIPS_PHYS_TO_XKPHYS_CACHED(x) \

Modified: head/sys/mips/include/pmap.h
==
--- head/sys/mips/include/pmap.hTue Dec 27 23:56:46 2016
(r310649)
+++ head/sys/mips/include/pmap.hWed Dec 28 02:55:26 2016
(r310650)
@@ -74,7 +74,8 @@ struct md_page {
 };
 
 #definePV_TABLE_REF0x02/* referenced */
-#definePV_MEMATTR_UNCACHEABLE  0x04
+#definePV_MEMATTR_MASK 0xf0/* store vm_memattr_t here */
+#definePV_MEMATTR_SHIFT0x04
 
 #defineASID_BITS   8
 #defineASIDGEN_BITS(32 - ASID_BITS)
@@ -163,22 +164,24 @@ extern vm_offset_t virtual_end;
 
 extern vm_paddr_t dump_avail[PHYS_AVAIL_ENTRIES + 2];
 
-#definepmap_page_get_memattr(m)VM_MEMATTR_DEFAULT
+#definepmap_page_get_memattr(m) (((m)->md.pv_flags & PV_MEMATTR_MASK) 
>> PV_MEMATTR_SHIFT)
 #definepmap_page_is_mapped(m)  (!TAILQ_EMPTY(&(m)->md.pv_list))
 #definepmap_page_is_write_mapped(m)(((m)->aflags & PGA_WRITEABLE) 
!= 0)
 
 void pmap_bootstrap(void);
 void *pmap_mapdev(vm_paddr_t, vm_size_t);
+void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t);
 void pmap_unmapdev(vm_offset_t, vm_size_t);
 vm_offset_t pmap_steal_memory(vm_size_t size);
 void pmap_kenter(vm_offset_t va, vm_paddr_t pa);
-void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr);
+void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t attr);
 void pmap_kremove(vm_offset_t va);
 void *pmap_kenter_temporary(vm_paddr_t pa, int i);
 void pmap_kenter_temporary_free(vm_paddr_t pa);
 void pmap_flush_pvcache(vm_page_t m);
 int pmap_emulate_modified(pmap_t pmap, vm_offset_t va);
 void pmap_page_set_memattr(vm_page_t, vm_memattr_t);
+int pmap_change_attr(vm_offset_t, vm_size_t, vm_memattr_t);
 
 #endif /* _KERNEL */
 

Modified: head/sys/mips/include/pte.h
==
--- head/sys/mips/include/pte.h Tue Dec 27 23:56:46 2016(r310649)
+++ head/sys/mips/include/pte.h Wed Dec 28 02:55:26 2016(r310650)
@@ -132,8 +132,10 @@ typedefpt_entry_t *pd_entry_t;
  * it is matched.
  */
 #definePTE_C(attr) ((attr & 0x07) << 3)
+#definePTE_C_MASK  (PTE_C(0x07))
 #definePTE_C_UNCACHED  (PTE_C(MIPS_CCA_UNCACHED))
 #definePTE_C_CACHE (PTE_C(MIPS_CCA_CACHED))
+#definePTE_C_WC(PTE_C(MIPS_CCA_WC))
 #definePTE_D   0x04
 #definePTE_V   0x02
 #definePTE_G   0x01
@@ -158,6 +160,7 @@ typedef pt_entry_t *pd_entry_t;
 #definepte_clear(pte, bit) (*(pte) &= ~(bit))
 #definepte_set(pte, bit)   (*(pte) |= (bit))
 #definepte_test(pte, bit)  ((*(pte) & (bit)) == (bit))
+#definepte_cache_bits(pte) ((*(pte) >> 3) & 0x07)
 
 /* Assembly support for PTE access*/
 #ifdef LOCORE

Modified: head/sys/mips/include/vm.h
==
--- head/sys/mips/include/vm.h  Tue Dec 27 23:56:46 2016(r310649)
+++ head/sys/mips/include/vm.h  Wed Dec 28 02:55:26 2016(r310650)
@@ -32,7 +32,11 @@
 #include 
 
 /* Memory attributes. */
-#define

svn commit: r310649 - head/sys/cam/ctl

2016-12-27 Thread Alexander Motin
Author: mav
Date: Tue Dec 27 23:56:46 2016
New Revision: 310649
URL: https://svnweb.freebsd.org/changeset/base/310649

Log:
  Allow more efficient use of private area.
  
  There are 16 bytes of space, so we may store two pointers in one.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl_io.h
  head/sys/cam/ctl/scsi_ctl.c

Modified: head/sys/cam/ctl/ctl_io.h
==
--- head/sys/cam/ctl/ctl_io.h   Tue Dec 27 23:32:54 2016(r310648)
+++ head/sys/cam/ctl/ctl_io.h   Tue Dec 27 23:56:46 2016(r310649)
@@ -145,7 +145,9 @@ struct ctl_ptr_len_flags {
 union ctl_priv {
uint8_t bytes[sizeof(uint64_t) * 2];
uint64_tinteger;
+   uint64_tintegers[2];
void*ptr;
+   void*ptrs[2];
 };
 
 /*

Modified: head/sys/cam/ctl/scsi_ctl.c
==
--- head/sys/cam/ctl/scsi_ctl.c Tue Dec 27 23:32:54 2016(r310648)
+++ head/sys/cam/ctl/scsi_ctl.c Tue Dec 27 23:56:46 2016(r310649)
@@ -185,6 +185,9 @@ MALLOC_DEFINE(M_CTLFE, "CAM CTL FE", "CA
 /* This is only used in the CTIO */
 #defineccb_atioppriv_ptr1
 
+#define PRIV_CCB(io)   ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[0])
+#define PRIV_INFO(io)  ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[1])
+
 intctlfeinitialize(void);
 void   ctlfeshutdown(void);
 static periph_init_t   ctlfeperiphinit;
@@ -554,7 +557,7 @@ ctlferegister(struct cam_periph *periph,
status = CAM_RESRC_UNAVAIL;
break;
}
-   new_io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr = cmd_info;
+   PRIV_INFO(new_io) = cmd_info;
softc->atios_alloced++;
new_ccb->ccb_h.io_ptr = new_io;
 
@@ -702,7 +705,7 @@ ctlfedata(struct ctlfe_lun_softc *softc,
size_t off;
int i, idx;
 
-   cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr;
+   cmd_info = PRIV_INFO(io);
bus_softc = softc->parent_softc;
 
/*
@@ -806,7 +809,7 @@ ctlfestart(struct cam_periph *periph, un
 
flags = atio->ccb_h.flags &
(CAM_DIS_DISCONNECT|CAM_TAG_ACTION_VALID|CAM_DIR_MASK);
-   cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr;
+   cmd_info = PRIV_INFO(io);
cmd_info->cur_transfer_index = 0;
cmd_info->cur_transfer_off = 0;
cmd_info->flags = 0;
@@ -987,7 +990,7 @@ ctlfe_free_ccb(struct cam_periph *periph
switch (ccb->ccb_h.func_code) {
case XPT_ACCEPT_TARGET_IO:
softc->atios_freed++;
-   cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr;
+   cmd_info = PRIV_INFO(io);
free(cmd_info, M_CTLFE);
break;
case XPT_IMMEDIATE_NOTIFY:
@@ -1154,12 +1157,12 @@ ctlfedone(struct cam_periph *periph, uni
 */
mtx_unlock(mtx);
io = done_ccb->ccb_h.io_ptr;
-   cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr;
+   cmd_info = PRIV_INFO(io);
ctl_zero_io(io);
 
/* Save pointers on both sides */
-   io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = done_ccb;
-   io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr = cmd_info;
+   PRIV_CCB(io) = done_ccb;
+   PRIV_INFO(io) = cmd_info;
done_ccb->ccb_h.io_ptr = io;
 
/*
@@ -1315,7 +1318,7 @@ ctlfedone(struct cam_periph *periph, uni
struct ccb_scsiio *csio;
 
csio = _ccb->csio;
-   cmd_info = 
io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr;
+   cmd_info = PRIV_INFO(io);
 
io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG;
 
@@ -1444,7 +1447,7 @@ ctlfedone(struct cam_periph *periph, uni
send_ctl_io = 1;
 
io->io_hdr.io_type = CTL_IO_TASK;
-   io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr =done_ccb;
+   PRIV_CCB(io) = done_ccb;
inot->ccb_h.io_ptr = io;
io->io_hdr.nexus.initid = inot->initiator_id;
io->io_hdr.nexus.targ_port = bus_softc->port.targ_port;
@@ -2002,7 +2005,7 @@ ctlfe_datamove(union ctl_io *io)
KASSERT(io->io_hdr.io_type == CTL_IO_SCSI,
("Unexpected io_type (%d) in ctlfe_datamove", io->io_hdr.io_type));
 
-   ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr;
+   ccb = PRIV_CCB(io);
periph = xpt_path_periph(ccb->ccb_h.path);
cam_periph_lock(periph);
softc = (struct ctlfe_lun_softc *)periph->softc;
@@ -2022,7 +2025,7 @@ ctlfe_done(union ctl_io *io)
struct cam_periph *periph;
struct ctlfe_lun_softc *softc;
 
-   ccb = 

svn commit: r310648 - in head: contrib/bsnmp/gensnmpdef contrib/bsnmp/gensnmptree contrib/bsnmp/lib contrib/bsnmp/snmp_mibII contrib/bsnmp/snmp_ntp contrib/bsnmp/snmp_target contrib/bsnmp/snmp_usm ...

2016-12-27 Thread Ngie Cooper
Author: ngie
Date: Tue Dec 27 23:32:54 2016
New Revision: 310648
URL: https://svnweb.freebsd.org/changeset/base/310648

Log:
  style(9): clean up trailing whitespace
  
  MFC after:3 weeks

Modified:
  head/contrib/bsnmp/gensnmpdef/gensnmpdef.1
  head/contrib/bsnmp/gensnmpdef/gensnmpdef.c
  head/contrib/bsnmp/gensnmptree/gensnmptree.1
  head/contrib/bsnmp/gensnmptree/gensnmptree.c
  head/contrib/bsnmp/lib/asn1.3
  head/contrib/bsnmp/lib/asn1.c
  head/contrib/bsnmp/lib/asn1.h
  head/contrib/bsnmp/lib/bsnmpagent.3
  head/contrib/bsnmp/lib/bsnmpclient.3
  head/contrib/bsnmp/lib/bsnmplib.3
  head/contrib/bsnmp/lib/snmp.c
  head/contrib/bsnmp/lib/snmp.h
  head/contrib/bsnmp/lib/snmpagent.c
  head/contrib/bsnmp/lib/snmpagent.h
  head/contrib/bsnmp/lib/snmpclient.c
  head/contrib/bsnmp/lib/snmpclient.h
  head/contrib/bsnmp/lib/snmpcrypto.c
  head/contrib/bsnmp/lib/snmppriv.h
  head/contrib/bsnmp/lib/support.c
  head/contrib/bsnmp/lib/support.h
  head/contrib/bsnmp/snmp_mibII/mibII.c
  head/contrib/bsnmp/snmp_mibII/mibII.h
  head/contrib/bsnmp/snmp_mibII/mibII_begemot.c
  head/contrib/bsnmp/snmp_mibII/mibII_ifmib.c
  head/contrib/bsnmp/snmp_mibII/mibII_ifstack.c
  head/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
  head/contrib/bsnmp/snmp_mibII/mibII_ip.c
  head/contrib/bsnmp/snmp_mibII/mibII_ipaddr.c
  head/contrib/bsnmp/snmp_mibII/mibII_nettomedia.c
  head/contrib/bsnmp/snmp_mibII/mibII_rcvaddr.c
  head/contrib/bsnmp/snmp_mibII/mibII_route.c
  head/contrib/bsnmp/snmp_mibII/mibII_tcp.c
  head/contrib/bsnmp/snmp_mibII/mibII_tree.def
  head/contrib/bsnmp/snmp_mibII/mibII_udp.c
  head/contrib/bsnmp/snmp_mibII/snmp_mibII.3
  head/contrib/bsnmp/snmp_mibII/snmp_mibII.h
  head/contrib/bsnmp/snmp_ntp/NTP-MIB.txt
  head/contrib/bsnmp/snmp_ntp/NTP-PROXY-MIB.txt
  head/contrib/bsnmp/snmp_target/snmp_target.3
  head/contrib/bsnmp/snmp_usm/snmp_usm.3
  head/contrib/bsnmp/snmp_usm/usm_snmp.c
  head/contrib/bsnmp/snmp_vacm/snmp_vacm.3
  head/contrib/bsnmp/snmp_vacm/vacm_snmp.c
  head/contrib/bsnmp/snmpd/BEGEMOT-MIB.txt
  head/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt
  head/contrib/bsnmp/snmpd/FOKUS-MIB.txt
  head/contrib/bsnmp/snmpd/action.c
  head/contrib/bsnmp/snmpd/config.c
  head/contrib/bsnmp/snmpd/export.c
  head/contrib/bsnmp/snmpd/main.c
  head/contrib/bsnmp/snmpd/snmpd.config
  head/contrib/bsnmp/snmpd/snmpd.h
  head/contrib/bsnmp/snmpd/snmpd.sh
  head/contrib/bsnmp/snmpd/snmpmod.3
  head/contrib/bsnmp/snmpd/snmpmod.h
  head/contrib/bsnmp/snmpd/trans_lsock.c
  head/contrib/bsnmp/snmpd/trans_lsock.h
  head/contrib/bsnmp/snmpd/trans_udp.c
  head/contrib/bsnmp/snmpd/trans_udp.h
  head/contrib/bsnmp/snmpd/trap.c
  head/contrib/bsnmp/snmpd/tree.def
  head/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt
  head/usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c
  head/usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt
  head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_addrs.c
  head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c
  head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c
  head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
  head/usr.sbin/bsnmpd/modules/snmp_bridge/snmp_bridge.3
  head/usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.3
  head/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.c
  head/usr.sbin/bsnmpd/modules/snmp_pf/BEGEMOT-PF-MIB.txt
  head/usr.sbin/bsnmpd/modules/snmp_pf/Makefile
  head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
  head/usr.sbin/bsnmpd/modules/snmp_target/Makefile
  head/usr.sbin/bsnmpd/modules/snmp_usm/Makefile
  head/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile
  head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c
  head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h
  head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c
  head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c

Modified: head/contrib/bsnmp/gensnmpdef/gensnmpdef.1
==
--- head/contrib/bsnmp/gensnmpdef/gensnmpdef.1  Tue Dec 27 23:31:32 2016
(r310647)
+++ head/contrib/bsnmp/gensnmpdef/gensnmpdef.1  Tue Dec 27 23:32:54 2016
(r310648)
@@ -4,7 +4,7 @@
 .\"All rights reserved.
 .\"
 .\" Author: Harti Brandt 
-.\" 
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
@@ -13,7 +13,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"notice, this list of conditions and the following disclaimer in the
 .\"documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED 

svn commit: r310647 - head/sys/cddl/contrib/opensolaris/uts/common/sys

2016-12-27 Thread Mark Johnston
Author: markj
Date: Tue Dec 27 23:31:32 2016
New Revision: 310647
URL: https://svnweb.freebsd.org/changeset/base/310647

Log:
  Remove an obsolete pragma from dtrace.h.
  
  It triggers a compiler warning and has been removed upstream.
  
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h   Tue Dec 27 
22:38:44 2016(r310646)
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h   Tue Dec 27 
23:31:32 2016(r310647)
@@ -32,8 +32,6 @@
 #ifndef _SYS_DTRACE_H
 #define_SYS_DTRACE_H
 
-#pragma ident  "%Z%%M% %I% %E% SMI"
-
 #ifdef __cplusplus
 extern "C" {
 #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: r310646 - head/sys/cam/ctl

2016-12-27 Thread Alexander Motin
Author: mav
Date: Tue Dec 27 22:38:44 2016
New Revision: 310646
URL: https://svnweb.freebsd.org/changeset/base/310646

Log:
  Do not update "saved" mode page on every MODE SELECT.
  
  We do not have non-volatile memory to really save those values, so we
  neither report nor support this capability.  Also saved mode pages are
  not replicated between HA peers now.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Tue Dec 27 22:37:24 2016(r310645)
+++ head/sys/cam/ctl/ctl.c  Tue Dec 27 22:38:44 2016(r310646)
@@ -5833,7 +5833,7 @@ ctl_default_page_handler(struct ctl_scsi
 struct ctl_page_index *page_index, uint8_t *page_ptr)
 {
struct ctl_lun *lun;
-   uint8_t *current_cp, *saved_cp;
+   uint8_t *current_cp;
int set_ua;
uint32_t initidx;
 
@@ -5843,13 +5843,10 @@ ctl_default_page_handler(struct ctl_scsi
 
current_cp = (page_index->page_data + (page_index->page_len *
CTL_PAGE_CURRENT));
-   saved_cp = (page_index->page_data + (page_index->page_len *
-   CTL_PAGE_SAVED));
 
mtx_lock(>lun_lock);
if (memcmp(current_cp, page_ptr, page_index->page_len)) {
memcpy(current_cp, page_ptr, page_index->page_len);
-   memcpy(saved_cp, page_ptr, page_index->page_len);
set_ua = 1;
}
if (set_ua != 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: r310645 - in head/sys: conf dev/intel modules modules/intelspi

2016-12-27 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Dec 27 22:37:24 2016
New Revision: 310645
URL: https://svnweb.freebsd.org/changeset/base/310645

Log:
  [intelspi] Add SPI driver for Intel BayTrail SoC
  
  Add SPI mode (PIO-only) support for Intel Synchronous Serial Port that
  can be found in several Intel's products starting from PXA family.
  Most of implementations have slight differences in behavior and in
  addresses for registers subset. This driver covers only BayTrail SoC
  implementation for it's the only hardware I have to test it on.
  
  Driver attaches to ACPI bus only and does not have PCI or FDT support
  for now due to lack of hardware to test it on.
  
  "intelspi" is the best name I've managed to come up with. Linux driver
  name (spi-pxa2xx) does not make sense because current implementation
  does not support actual PXA2xx SoCs. And as far as I know there is no
  codename assigned to Intel SSP chip.
  
  Reviewed by:  br, manu
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D8896

Added:
  head/sys/dev/intel/
  head/sys/dev/intel/spi.c   (contents, props changed)
  head/sys/modules/intelspi/
  head/sys/modules/intelspi/Makefile   (contents, props changed)
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Dec 27 22:31:06 2016(r310644)
+++ head/sys/conf/files.amd64   Tue Dec 27 22:37:24 2016(r310645)
@@ -228,6 +228,7 @@ dev/if_ndis/if_ndis.c   optionalndis
 dev/if_ndis/if_ndis_pccard.c   optionalndis pccard
 dev/if_ndis/if_ndis_pci.c  optionalndis cardbus | ndis pci
 dev/if_ndis/if_ndis_usb.c  optionalndis usb
+dev/intel/spi.coptionalintelspi
 dev/io/iodev.c optionalio
 dev/ioat/ioat.coptionalioat pci
 dev/ioat/ioat_test.c   optionalioat pci

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Tue Dec 27 22:31:06 2016(r310644)
+++ head/sys/conf/files.i386Tue Dec 27 22:37:24 2016(r310645)
@@ -275,6 +275,7 @@ dev/if_ndis/if_ndis.c   optional ndis
 dev/if_ndis/if_ndis_pccard.c   optional ndis pccard
 dev/if_ndis/if_ndis_pci.c  optional ndis cardbus | ndis pci
 dev/if_ndis/if_ndis_usb.c  optional ndis usb
+dev/intel/spi.coptional intelspi
 dev/io/iodev.c optional io
 dev/ipmi/ipmi.coptional ipmi
 dev/ipmi/ipmi_acpi.c   optional ipmi acpi

Added: head/sys/dev/intel/spi.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/intel/spi.cTue Dec 27 22:37:24 2016(r310645)
@@ -0,0 +1,533 @@
+/*-
+ * Copyright (c) 2016 Oleksandr Tymoshenko 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_acpi.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "spibus_if.h"
+
+/**
+ * Macros for driver mutex locking
+ */
+#defineINTELSPI_LOCK(_sc)  mtx_lock(&(_sc)->sc_mtx)
+#defineINTELSPI_UNLOCK(_sc)mtx_unlock(&(_sc)->sc_mtx)
+#defineINTELSPI_LOCK_INIT(_sc) \
+   mtx_init(&_sc->sc_mtx, 

svn commit: r310644 - head/sys/cam/ctl

2016-12-27 Thread Alexander Motin
Author: mav
Date: Tue Dec 27 22:31:06 2016
New Revision: 310644
URL: https://svnweb.freebsd.org/changeset/base/310644

Log:
  Fix/synchronize field types in struct ctl_modepage_header.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Tue Dec 27 22:28:14 2016(r310643)
+++ head/sys/cam/ctl/ctl.c  Tue Dec 27 22:31:06 2016(r310644)
@@ -5939,7 +5939,7 @@ ctl_do_mode_select(union ctl_io *io)
int page_len, page_len_offset, page_len_size;
union ctl_modepage_info *modepage_info;
struct ctl_lun *lun;
-   int *len_left, *len_used;
+   uint16_t *len_left, *len_used;
int retval, i;
 
ctsio = >scsiio;

Modified: head/sys/cam/ctl/ctl.h
==
--- head/sys/cam/ctl/ctl.h  Tue Dec 27 22:28:14 2016(r310643)
+++ head/sys/cam/ctl/ctl.h  Tue Dec 27 22:31:06 2016(r310644)
@@ -74,8 +74,8 @@ struct ctl_port_entry {
 struct ctl_modepage_header {
uint8_t page_code;
uint8_t subpage;
-   int32_t len_used;
-   int32_t len_left;
+   uint16_t len_used;
+   uint16_t len_left;
 };
 
 union ctl_modepage_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: r310643 - head/sys/cam/scsi

2016-12-27 Thread Alexander Motin
Author: mav
Date: Tue Dec 27 22:28:14 2016
New Revision: 310643
URL: https://svnweb.freebsd.org/changeset/base/310643

Log:
  Missed piece of r310640.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/scsi/scsi_all.h
==
--- head/sys/cam/scsi/scsi_all.hTue Dec 27 22:14:41 2016
(r310642)
+++ head/sys/cam/scsi/scsi_all.hTue Dec 27 22:28:14 2016
(r310643)
@@ -228,6 +228,7 @@ struct scsi_mode_select_6
u_int8_t opcode;
u_int8_t byte2;
 #defineSMS_SP  0x01
+#defineSMS_RTD 0x02
 #defineSMS_PF  0x10
u_int8_t unused[2];
u_int8_t length;
___
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: r310642 - head/sys/netinet

2016-12-27 Thread Michael Tuexen
Author: tuexen
Date: Tue Dec 27 22:14:41 2016
New Revision: 310642
URL: https://svnweb.freebsd.org/changeset/base/310642

Log:
  Consistent handling of errors reported from the lower layer.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Tue Dec 27 21:16:08 2016
(r310641)
+++ head/sys/netinet/sctp_output.c  Tue Dec 27 22:14:41 2016
(r310642)
@@ -4678,7 +4678,7 @@ sctp_send_initiate(struct sctp_inpcb *in
struct sctp_supported_chunk_types_param *pr_supported;
struct sctp_paramhdr *ph;
int cnt_inits_to = 0;
-   int ret;
+   int error;
uint16_t num_ext, chunk_len, padding_len, parameter_len;
 
/* INIT's always go to the primary (and usually ONLY address) */
@@ -4927,14 +4927,21 @@ sctp_send_initiate(struct sctp_inpcb *in
}
}
SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - calls lowlevel_output\n");
-   ret = sctp_lowlevel_chunk_output(inp, stcb, net,
+   if ((error = sctp_lowlevel_chunk_output(inp, stcb, net,
(struct sockaddr *)>ro._l_addr,
m, 0, NULL, 0, 0, 0, 0,
inp->sctp_lport, stcb->rport, htonl(0),
net->port, NULL,
0, 0,
-   so_locked);
-   SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret);
+   so_locked))) {
+   SCTPDBG(SCTP_DEBUG_OUTPUT4, "Gak send error %d\n", error);
+   if (error == ENOBUFS) {
+   stcb->asoc.ifp_had_enobuf = 1;
+   SCTP_STAT_INCR(sctps_lowlevelerr);
+   }
+   } else {
+   stcb->asoc.ifp_had_enobuf = 0;
+   }
SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
(void)SCTP_GETTIME_TIMEVAL(>last_sent_time);
 }
@@ -5502,6 +5509,7 @@ sctp_send_initiate_ack(struct sctp_inpcb
uint16_t his_limit, i_want;
int abort_flag;
int nat_friendly = 0;
+   int error;
struct socket *so;
uint16_t num_ext, chunk_len, padding_len, parameter_len;
 
@@ -6116,12 +6124,24 @@ do_a_abort:
over_addr = NULL;
}
 
-   (void)sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0,
+   if ((error = sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, 
NULL, 0, 0,
0, 0,
inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag,
port, over_addr,
mflowtype, mflowid,
-   SCTP_SO_NOT_LOCKED);
+   SCTP_SO_NOT_LOCKED))) {
+   SCTPDBG(SCTP_DEBUG_OUTPUT4, "Gak send error %d\n", error);
+   if (error == ENOBUFS) {
+   if (asoc != NULL) {
+   asoc->ifp_had_enobuf = 1;
+   }
+   SCTP_STAT_INCR(sctps_lowlevelerr);
+   }
+   } else {
+   if (asoc != NULL) {
+   asoc->ifp_had_enobuf = 0;
+   }
+   }
SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
 }
 
@@ -8821,8 +8841,8 @@ no_data_fill:
SCTP_STAT_INCR(sctps_lowlevelerrusr);
}
if (error == ENOBUFS) {
-   SCTP_STAT_INCR(sctps_lowlevelerr);
asoc->ifp_had_enobuf = 1;
+   SCTP_STAT_INCR(sctps_lowlevelerr);
}
if (error == EHOSTUNREACH) {
/*
@@ -9509,8 +9529,14 @@ sctp_chunk_retransmission(struct sctp_in
chk->whoTo->port, NULL,
0, 0,
so_locked))) {
-   SCTP_STAT_INCR(sctps_lowlevelerr);
+   SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", 
error);
+   if (error == ENOBUFS) {
+   asoc->ifp_had_enobuf = 1;
+   SCTP_STAT_INCR(sctps_lowlevelerr);
+   }
return (error);
+   } else {
+   asoc->ifp_had_enobuf = 0;
}
endofchain = NULL;
auth = NULL;
@@ -9781,8 +9807,14 @@ one_chunk_around:
0, 0,
so_locked))) {
/* error, we could not output */
-   SCTP_STAT_INCR(sctps_lowlevelerr);
+   SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error 
%d\n", error);
+   if (error == ENOBUFS) {
+   asoc->ifp_had_enobuf = 1;
+   SCTP_STAT_INCR(sctps_lowlevelerr);
+

svn commit: r310640 - head/sys/cam/ctl

2016-12-27 Thread Alexander Motin
Author: mav
Date: Tue Dec 27 21:11:54 2016
New Revision: 310640
URL: https://svnweb.freebsd.org/changeset/base/310640

Log:
  Add support for revert to defaults (RTD) bit in MODE SELECT.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl.h
  head/sys/cam/ctl/ctl_cmd_table.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Tue Dec 27 20:22:17 2016(r310639)
+++ head/sys/cam/ctl/ctl.c  Tue Dec 27 21:11:54 2016(r310640)
@@ -6158,10 +6158,13 @@ bailout_no_done:
 int
 ctl_mode_select(struct ctl_scsiio *ctsio)
 {
-   int param_len, pf, sp;
-   int header_size, bd_len;
+   struct ctl_lun *lun;
union ctl_modepage_info *modepage_info;
+   int bd_len, i, header_size, param_len, pf, rtd, sp;
+   uint32_t initidx;
 
+   lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
+   initidx = ctl_get_initindex(>io_hdr.nexus);
switch (ctsio->cdb[0]) {
case MODE_SELECT_6: {
struct scsi_mode_select_6 *cdb;
@@ -6169,6 +6172,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio
cdb = (struct scsi_mode_select_6 *)ctsio->cdb;
 
pf = (cdb->byte2 & SMS_PF) ? 1 : 0;
+   rtd = (cdb->byte2 & SMS_RTD) ? 1 : 0;
sp = (cdb->byte2 & SMS_SP) ? 1 : 0;
param_len = cdb->length;
header_size = sizeof(struct scsi_mode_header_6);
@@ -6180,6 +6184,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio
cdb = (struct scsi_mode_select_10 *)ctsio->cdb;
 
pf = (cdb->byte2 & SMS_PF) ? 1 : 0;
+   rtd = (cdb->byte2 & SMS_RTD) ? 1 : 0;
sp = (cdb->byte2 & SMS_SP) ? 1 : 0;
param_len = scsi_2btoul(cdb->length);
header_size = sizeof(struct scsi_mode_header_10);
@@ -6191,6 +6196,30 @@ ctl_mode_select(struct ctl_scsiio *ctsio
return (CTL_RETVAL_COMPLETE);
}
 
+   if (rtd) {
+   if (param_len != 0) {
+   ctl_set_invalid_field(ctsio, /*sks_valid*/ 0,
+   /*command*/ 1, /*field*/ 0,
+   /*bit_valid*/ 0, /*bit*/ 0);
+   ctl_done((union ctl_io *)ctsio);
+   return (CTL_RETVAL_COMPLETE);
+   }
+
+   /* Revert to defaults. */
+   ctl_init_page_index(lun);
+   mtx_lock(>lun_lock);
+   ctl_est_ua_all(lun, initidx, CTL_UA_MODE_CHANGE);
+   mtx_unlock(>lun_lock);
+   for (i = 0; i < CTL_NUM_MODE_PAGES; i++) {
+   ctl_isc_announce_mode(lun, -1,
+   lun->mode_pages.index[i].page_code & SMPH_PC_MASK,
+   lun->mode_pages.index[i].subpage);
+   }
+   ctl_set_success(ctsio);
+   ctl_done((union ctl_io *)ctsio);
+   return (CTL_RETVAL_COMPLETE);
+   }
+
/*
 * From SPC-3:
 * "A parameter list length of zero indicates that the Data-Out Buffer
@@ -9563,6 +9592,11 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio *
eid_ptr->flags4 = SVPD_EID_LUICLR;
 
/*
+* We support revert to defaults (RTD) bit in MODE SELECT.
+*/
+   eid_ptr->flags5 = SVPD_EID_RTD_SUP;
+
+   /*
 * XXX KDM in order to correctly answer this, we would need
 * information from the SIM to determine how much sense data it
 * can send.  So this would really be a path inquiry field, most

Modified: head/sys/cam/ctl/ctl.h
==
--- head/sys/cam/ctl/ctl.h  Tue Dec 27 20:22:17 2016(r310639)
+++ head/sys/cam/ctl/ctl.h  Tue Dec 27 21:11:54 2016(r310640)
@@ -78,14 +78,8 @@ struct ctl_modepage_header {
int32_t len_left;
 };
 
-struct ctl_modepage_aps {
-   struct ctl_modepage_header header;
-   uint8_t lock_active;
-};
-
 union ctl_modepage_info {
struct ctl_modepage_header header;
-   struct ctl_modepage_aps aps;
 };
 
 /*

Modified: head/sys/cam/ctl/ctl_cmd_table.c
==
--- head/sys/cam/ctl/ctl_cmd_table.cTue Dec 27 20:22:17 2016
(r310639)
+++ head/sys/cam/ctl/ctl_cmd_table.cTue Dec 27 21:11:54 2016
(r310640)
@@ -990,7 +990,7 @@ const struct ctl_cmd_entry ctl_cmd_table
 CTL_CMD_FLAG_OK_ON_NO_MEDIA |
 CTL_CMD_FLAG_OK_ON_STANDBY |
 CTL_FLAG_DATA_OUT,
- CTL_LUN_PAT_NONE, 6, {0x11, 0, 0, 0xff, 0x07}},
+ CTL_LUN_PAT_NONE, 6, {0x13, 0, 0, 0xff, 0x07}},
 
 /* 16 RESERVE(6) */
 {ctl_scsi_reserve, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV |
@@ -1260,7 +1260,7 @@ const struct ctl_cmd_entry ctl_cmd_table
   

svn commit: r310639 - in head/sys: compat/freebsd32 kern sys

2016-12-27 Thread John Baldwin
Author: jhb
Date: Tue Dec 27 20:22:17 2016
New Revision: 310639
URL: https://svnweb.freebsd.org/changeset/base/310639

Log:
  Regen after r310638.
  
  Differential Revision:https://reviews.freebsd.org/D8854

Modified:
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/compat/freebsd32/freebsd32_syscall.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c
  head/sys/kern/init_sysent.c
  head/sys/kern/syscalls.c
  head/sys/kern/systrace_args.c
  head/sys/sys/syscall.h
  head/sys/sys/syscall.mk
  head/sys/sys/sysproto.h

Modified: head/sys/compat/freebsd32/freebsd32_proto.h
==
--- head/sys/compat/freebsd32/freebsd32_proto.h Tue Dec 27 20:21:11 2016
(r310638)
+++ head/sys/compat/freebsd32/freebsd32_proto.h Tue Dec 27 20:22:17 2016
(r310639)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 305954 
2016-09-18 22:03:07Z kib 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 310638 
2016-12-27 20:21:11Z jhb
  */
 
 #ifndef _FREEBSD32_SYSPROTO_H_
@@ -917,7 +917,7 @@ int ofreebsd32_getdirentries(struct thre
 struct freebsd4_freebsd32_getfsstat_args {
char buf_l_[PADL_(struct statfs32 *)]; struct statfs32 * buf; char 
buf_r_[PADR_(struct statfs32 *)];
char bufsize_l_[PADL_(long)]; long bufsize; char 
bufsize_r_[PADR_(long)];
-   char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+   char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];
 };
 struct freebsd4_freebsd32_statfs_args {
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];

Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
==
--- head/sys/compat/freebsd32/freebsd32_syscall.h   Tue Dec 27 20:21:11 
2016(r310638)
+++ head/sys/compat/freebsd32/freebsd32_syscall.h   Tue Dec 27 20:22:17 
2016(r310639)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 305954 
2016-09-18 22:03:07Z kib 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 310638 
2016-12-27 20:21:11Z jhb
  */
 
 #defineFREEBSD32_SYS_syscall   0

Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
==
--- head/sys/compat/freebsd32/freebsd32_syscalls.c  Tue Dec 27 20:21:11 
2016(r310638)
+++ head/sys/compat/freebsd32/freebsd32_syscalls.c  Tue Dec 27 20:22:17 
2016(r310639)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 305954 
2016-09-18 22:03:07Z kib 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 310638 
2016-12-27 20:21:11Z jhb
  */
 
 const char *freebsd32_syscallnames[] = {

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==
--- head/sys/compat/freebsd32/freebsd32_sysent.cTue Dec 27 20:21:11 
2016(r310638)
+++ head/sys/compat/freebsd32/freebsd32_sysent.cTue Dec 27 20:22:17 
2016(r310639)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 305954 
2016-09-18 22:03:07Z kib 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 310638 
2016-12-27 20:21:11Z jhb
  */
 
 #include "opt_compat.h"

Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c
==
--- head/sys/compat/freebsd32/freebsd32_systrace_args.c Tue Dec 27 20:21:11 
2016(r310638)
+++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Tue Dec 27 20:22:17 
2016(r310639)
@@ -1960,7 +1960,7 @@ systrace_args(int sysnum, void *params, 
struct getfsstat_args *p = params;
uarg[0] = (intptr_t) p->buf; /* struct statfs * */
iarg[1] = p->bufsize; /* long */
-   iarg[2] = p->flags; /* int */
+   iarg[2] = p->mode; /* int */
*n_args = 3;
break;
}

Modified: head/sys/kern/init_sysent.c
==
--- head/sys/kern/init_sysent.c Tue Dec 27 20:21:11 2016(r310638)
+++ head/sys/kern/init_sysent.c Tue Dec 27 20:22:17 2016(r310639)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 

svn commit: r310638 - in head: lib/libc/gen lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys

2016-12-27 Thread John Baldwin
Author: jhb
Date: Tue Dec 27 20:21:11 2016
New Revision: 310638
URL: https://svnweb.freebsd.org/changeset/base/310638

Log:
  Rename the 'flags' argument to getfsstat() to 'mode' and validate it.
  
  This argument is not a bitmask of flags, but only accepts a single value.
  Fail with EINVAL if an invalid value is passed to 'flag'.  Rename the
  'flags' argument to getmntinfo(3) to 'mode' as well to match.
  
  This is a followup to r308088.
  
  Reviewed by:  kib
  MFC after:1 month

Modified:
  head/lib/libc/gen/getmntinfo.3
  head/lib/libc/gen/getmntinfo.c
  head/lib/libc/sys/getfsstat.2
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/syscalls.master
  head/sys/kern/vfs_syscalls.c
  head/sys/sys/syscallsubr.h

Modified: head/lib/libc/gen/getmntinfo.3
==
--- head/lib/libc/gen/getmntinfo.3  Tue Dec 27 20:06:26 2016
(r310637)
+++ head/lib/libc/gen/getmntinfo.3  Tue Dec 27 20:21:11 2016
(r310638)
@@ -28,7 +28,7 @@
 .\" @(#)getmntinfo.3   8.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd June 9, 1993
+.Dd December 27, 2016
 .Dt GETMNTINFO 3
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@
 .In sys/ucred.h
 .In sys/mount.h
 .Ft int
-.Fn getmntinfo "struct statfs **mntbufp" "int flags"
+.Fn getmntinfo "struct statfs **mntbufp" "int mode"
 .Sh DESCRIPTION
 The
 .Fn getmntinfo
@@ -55,7 +55,7 @@ The
 .Fn getmntinfo
 function
 passes its
-.Fa flags
+.Fa mode
 argument transparently to
 .Xr getfsstat 2 .
 .Sh RETURN VALUES

Modified: head/lib/libc/gen/getmntinfo.c
==
--- head/lib/libc/gen/getmntinfo.c  Tue Dec 27 20:06:26 2016
(r310637)
+++ head/lib/libc/gen/getmntinfo.c  Tue Dec 27 20:21:11 2016
(r310638)
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
  * Return information about mounted filesystems.
  */
 int
-getmntinfo(struct statfs **mntbufp, int flags)
+getmntinfo(struct statfs **mntbufp, int mode)
 {
static struct statfs *mntbuf;
static int mntsize;
@@ -50,7 +50,7 @@ getmntinfo(struct statfs **mntbufp, int 
 
if (mntsize <= 0 && (mntsize = getfsstat(0, 0, MNT_NOWAIT)) < 0)
return (0);
-   if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, flags)) < 0)
+   if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, mode)) < 0)
return (0);
while (bufsize <= mntsize * sizeof(struct statfs)) {
if (mntbuf)
@@ -58,7 +58,7 @@ getmntinfo(struct statfs **mntbufp, int 
bufsize = (mntsize + 1) * sizeof(struct statfs);
if ((mntbuf = malloc(bufsize)) == NULL)
return (0);
-   if ((mntsize = getfsstat(mntbuf, bufsize, flags)) < 0)
+   if ((mntsize = getfsstat(mntbuf, bufsize, mode)) < 0)
return (0);
}
*mntbufp = mntbuf;

Modified: head/lib/libc/sys/getfsstat.2
==
--- head/lib/libc/sys/getfsstat.2   Tue Dec 27 20:06:26 2016
(r310637)
+++ head/lib/libc/sys/getfsstat.2   Tue Dec 27 20:21:11 2016
(r310638)
@@ -28,7 +28,7 @@
 .\"@(#)getfsstat.2 8.3 (Berkeley) 5/25/95
 .\" $FreeBSD$
 .\"
-.Dd November 6, 2016
+.Dd December 27, 2016
 .Dt GETFSSTAT 2
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@
 .In sys/ucred.h
 .In sys/mount.h
 .Ft int
-.Fn getfsstat "struct statfs *buf" "long bufsize" "int flags"
+.Fn getfsstat "struct statfs *buf" "long bufsize" "int mode"
 .Sh DESCRIPTION
 The
 .Fn getfsstat
@@ -74,11 +74,11 @@ is given as NULL,
 returns just the number of mounted file systems.
 .Pp
 Normally
-.Fa flags
+.Fa mode
 should be specified as
 .Dv MNT_WAIT .
 If
-.Fa flags
+.Fa mode
 is set to
 .Dv MNT_NOWAIT ,
 .Fn getfsstat
@@ -108,6 +108,12 @@ The
 .Fa buf
 argument
 points to an invalid address.
+.It Bq Er EINVAL
+.Fa mode
+is set to a value other than
+.Dv MNT_WAIT
+or
+.Dv MNT_NOWAIT .
 .It Bq Er EIO
 An
 .Tn I/O

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Tue Dec 27 20:06:26 2016
(r310637)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Tue Dec 27 20:21:11 2016
(r310638)
@@ -253,7 +253,7 @@ freebsd4_freebsd32_getfsstat(struct thre
 
count = uap->bufsize / sizeof(struct statfs32);
size = count * sizeof(struct statfs);
-   error = kern_getfsstat(td, , size, , UIO_SYSSPACE, 
uap->flags);
+   error = kern_getfsstat(td, , size, , UIO_SYSSPACE, uap->mode);
if (size > 0) {
sp = buf;
copycount = count;

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Tue 

svn commit: r310636 - head/sys/arm/broadcom/bcm2835

2016-12-27 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Dec 27 19:08:08 2016
New Revision: 310636
URL: https://svnweb.freebsd.org/changeset/base/310636

Log:
  [rpi] Fix bcm2835_audio locking and samples starvation
  
  Rework general approach to locking and working with audio worker thread:
  
  - Use flags to signal requested worker action
  - Fix submitted buffer calculations to avoid samples starvation
  - Protect buffer pointers with locks to fix race condition between callback
and audio worker thread
  - Remove unnecessary vchi_service_use
  - Do not use lock to serialize VCHI requests since only one thread issues 
them now
  - Fix unloading signaling per hselasky@ suggestion
  - Add output to detect inconsistent callback data caused by possible firmware 
bug
https://github.com/raspberrypi/firmware/issues/696
  - Add stats/debug sysctls to troubleshoot possible bugs
  
  PR:   213687, 205979, 215194
  MFC after:1 week

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_audio.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_audio.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_audio.c   Tue Dec 27 18:23:16 
2016(r310635)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_audio.c   Tue Dec 27 19:08:08 
2016(r310636)
@@ -40,13 +40,33 @@
 
 SND_DECLARE_FILE("$FreeBSD$");
 
+/* Audio destination */
 #defineDEST_AUTO   0
 #defineDEST_HEADPHONES 1
 #defineDEST_HDMI   2
 
+/* Playback state */
+#definePLAYBACK_IDLE   0
+#definePLAYBACK_PLAYING1
+#definePLAYBACK_STOPPING   2
+
+/* Worker thread state */
+#defineWORKER_RUNNING  0
+#defineWORKER_STOPPING 1
+#defineWORKER_STOPPED  2
+
+/*
+ * Worker thread flags, set to 1 in flags_pending
+ * when driver requests one or another operation
+ * from worker. Cleared to 0 once worker performs
+ * the operations.
+ */
+#defineAUDIO_PARAMS(1 << 0)
+#defineAUDIO_PLAY  (1 << 1)
+#defineAUDIO_STOP  (1 << 2)
+
 #defineVCHIQ_AUDIO_PACKET_SIZE 4000
-#defineVCHIQ_AUDIO_BUFFER_SIZE 128000
-#defineVCHIQ_AUDIO_PREBUFFER   10 /* Number of pre-buffered audio 
messages */
+#defineVCHIQ_AUDIO_BUFFER_SIZE 10*VCHIQ_AUDIO_PACKET_SIZE
 
 #defineVCHIQ_AUDIO_MAX_VOLUME  
 /* volume in terms of 0.01dB */
@@ -77,22 +97,25 @@ static struct pcmchan_caps bcm2835_audio
 
 struct bcm2835_audio_info;
 
-#definePLAYBACK_IDLE   0
-#definePLAYBACK_STARTING   1
-#definePLAYBACK_PLAYING2
-#definePLAYBACK_STOPPING   3
-
 struct bcm2835_audio_chinfo {
struct bcm2835_audio_info *parent;
struct pcm_channel *channel;
struct snd_dbuf *buffer;
uint32_t fmt, spd, blksz;
 
-   uint32_t complete_pos;
-   uint32_t free_buffer;
-   uint32_t buffered_ptr;
+   /* Pointer to first unsubmitted sample */
+   uint32_t unsubmittedptr;
+   /*
+* Number of bytes in "submitted but not played"
+* pseudo-buffer
+*/
+   int available_space;
int playback_state;
-   int prebuffered;
+   uint64_t callbacks;
+   uint64_t submitted_samples;
+   uint64_t retrieved_samples;
+   uint64_t underruns;
+   int starved;
 };
 
 struct bcm2835_audio_info {
@@ -100,32 +123,25 @@ struct bcm2835_audio_info {
unsigned int bufsz;
struct bcm2835_audio_chinfo pch;
uint32_t dest, volume;
-   struct mtx *lock;
struct intr_config_hook intr_hook;
 
/* VCHI data */
-   struct sx vchi_lock;
-
VCHI_INSTANCE_T vchi_instance;
VCHI_CONNECTION_T *vchi_connection;
VCHI_SERVICE_HANDLE_T vchi_handle;
 
-   struct sx worker_lock;
+   struct mtx lock;
struct cv worker_cv;
 
-   bool parameters_update_pending;
-   bool controls_update_pending;
+   uint32_t flags_pending;
 
-   /* Unloadign module */
-   int unloading;
+   /* Worker thread state */
+   int worker_state;
 };
 
-#define bcm2835_audio_lock(_ess) snd_mtxlock((_ess)->lock)
-#define bcm2835_audio_unlock(_ess) snd_mtxunlock((_ess)->lock)
-#define bcm2835_audio_lock_assert(_ess) snd_mtxassert((_ess)->lock)
-
-#define VCHIQ_VCHI_LOCK(sc)sx_xlock(&(sc)->vchi_lock)
-#define VCHIQ_VCHI_UNLOCK(sc)  sx_xunlock(&(sc)->vchi_lock)
+#define BCM2835_AUDIO_LOCK(sc) mtx_lock(&(sc)->lock)
+#define BCM2835_AUDIO_LOCKED(sc)   mtx_assert(&(sc)->lock, MA_OWNED)
+#define BCM2835_AUDIO_UNLOCK(sc)   mtx_unlock(&(sc)->lock)
 
 static const char *
 dest_description(uint32_t dest)
@@ -149,6 +165,36 @@ dest_description(uint32_t dest)
 }
 
 static void
+bcm2835_worker_update_params(struct bcm2835_audio_info *sc)
+{
+
+   BCM2835_AUDIO_LOCKED(sc);
+
+   sc->flags_pending |= 

Re: svn commit: r310624 - head/sys/net80211

2016-12-27 Thread Shawn Webb
Sounds good. Thanks for the explanation!

On Tue, Dec 27, 2016 at 10:48:17AM -0800, Adrian Chadd wrote:
> Hi,
> 
> As it's a kernel change in a frequently changing subsystem in -HEAD,
> I'm opting not to bump it until I get the 11ac bits "done" enough.
> Otherwise there'd be a lot of churn. I did bump it for the userland
> facing ABI though as that did have a pretty big impact.
> 
> Anyone using binary-only wifi kernel modules on FreeBSD should know better. :)
> 
> I promise to bump it once 11ac is "done" enough to use, so there is a
> good reference point.
> 
> Thanks,
> 
> 
> -adrian
> 
> 
> On 27 December 2016 at 06:08, Shawn Webb  wrote:
> > On Tue, Dec 27, 2016 at 06:10:28AM +, Adrian Chadd wrote:
> >> Author: adrian
> >> Date: Tue Dec 27 06:10:28 2016
> >> New Revision: 310624
> >> URL: https://svnweb.freebsd.org/changeset/base/310624
> >>
> >> Log:
> >>   [net80211] turn the default TX key configuration (for WEP) into a vap 
> >> callback.
> >>
> >>   The ath10k firmware supports hardware WEP offload, and in native wifi 
> >> mode
> >>   (or 802.3 ethernet mode, for that matter) the WEP key isn't actually 
> >> included
> >>   in the TX payload from net80211.  Instead, a separate firmware command 
> >> is issued
> >>   that sets the default TX key to be the specified key.
> >>
> >>   However, net80211 doesn't at all inform the driver layer that this is
> >>   occuring - it just "expects" to be inserting WEP header information
> >>   when doing WEP TX, even with hardware encryption.
> >>
> >>   So, to better support the newer world order, turn the default TX key 
> >> assignment
> >>   into a VAP method that can be overridden by the driver and ensure its 
> >> wrapped
> >>   in a crypto begin/end set.  That way it should be correctly atomic from 
> >> the
> >>   point of view of keychanges (as long as the driver does the right thing.)
> >>
> >>   It'd be nice if we passed through to the key_set call a flag that says
> >>   "also make this the default key" - that's captured here by calling the
> >>   deftxkey method after the key_set method.  Maybe I can do that later.
> >>
> >>   Note: this is a net80211 ABI change, and will require a kernel+modules
> >>   recompile.  Happy Holidays, etc.
> >
> > Hey Adrian,
> >
> > Thank you very much for your hard work on the wireless stack. Since this
> > introduces an ABI change, should __FreeBSD_version be bumped?
> >
> > Thanks,
> >
> > --
> > Shawn Webb
> > Cofounder and Security Engineer
> > HardenedBSD
> >
> > GPG Key ID:  0x6A84658F52456EEE
> > GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r310624 - head/sys/net80211

2016-12-27 Thread Adrian Chadd
Hi,

As it's a kernel change in a frequently changing subsystem in -HEAD,
I'm opting not to bump it until I get the 11ac bits "done" enough.
Otherwise there'd be a lot of churn. I did bump it for the userland
facing ABI though as that did have a pretty big impact.

Anyone using binary-only wifi kernel modules on FreeBSD should know better. :)

I promise to bump it once 11ac is "done" enough to use, so there is a
good reference point.

Thanks,


-adrian


On 27 December 2016 at 06:08, Shawn Webb  wrote:
> On Tue, Dec 27, 2016 at 06:10:28AM +, Adrian Chadd wrote:
>> Author: adrian
>> Date: Tue Dec 27 06:10:28 2016
>> New Revision: 310624
>> URL: https://svnweb.freebsd.org/changeset/base/310624
>>
>> Log:
>>   [net80211] turn the default TX key configuration (for WEP) into a vap 
>> callback.
>>
>>   The ath10k firmware supports hardware WEP offload, and in native wifi mode
>>   (or 802.3 ethernet mode, for that matter) the WEP key isn't actually 
>> included
>>   in the TX payload from net80211.  Instead, a separate firmware command is 
>> issued
>>   that sets the default TX key to be the specified key.
>>
>>   However, net80211 doesn't at all inform the driver layer that this is
>>   occuring - it just "expects" to be inserting WEP header information
>>   when doing WEP TX, even with hardware encryption.
>>
>>   So, to better support the newer world order, turn the default TX key 
>> assignment
>>   into a VAP method that can be overridden by the driver and ensure its 
>> wrapped
>>   in a crypto begin/end set.  That way it should be correctly atomic from the
>>   point of view of keychanges (as long as the driver does the right thing.)
>>
>>   It'd be nice if we passed through to the key_set call a flag that says
>>   "also make this the default key" - that's captured here by calling the
>>   deftxkey method after the key_set method.  Maybe I can do that later.
>>
>>   Note: this is a net80211 ABI change, and will require a kernel+modules
>>   recompile.  Happy Holidays, etc.
>
> Hey Adrian,
>
> Thank you very much for your hard work on the wireless stack. Since this
> introduces an ABI change, should __FreeBSD_version be bumped?
>
> Thanks,
>
> --
> Shawn Webb
> Cofounder and Security Engineer
> HardenedBSD
>
> GPG Key ID:  0x6A84658F52456EEE
> GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
___
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: r310635 - head/sys/cam/ctl

2016-12-27 Thread Alexander Motin
Author: mav
Date: Tue Dec 27 18:23:16 2016
New Revision: 310635
URL: https://svnweb.freebsd.org/changeset/base/310635

Log:
  Decouple limits on number of LUNs per port and LUs per CTL.
  
  Those two values are not directly related, so make them independent.
  This does not change any limits immediately, but makes number of LUNs
  per port controllable via tunable/sysctl kern.cam.ctl.lun_map_size.
  After this change increasing CTL_MAX_LUNS should be pretty cheap,
  and even making it tunable should be easy.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_frontend.c
  head/sys/cam/ctl/ctl_frontend.h
  head/sys/cam/ctl/ctl_io.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Tue Dec 27 17:31:07 2016(r310634)
+++ head/sys/cam/ctl/ctl.c  Tue Dec 27 18:23:16 2016(r310635)
@@ -407,6 +407,9 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, work
 static int ctl_debug = CTL_DEBUG_NONE;
 SYSCTL_INT(_kern_cam_ctl, OID_AUTO, debug, CTLFLAG_RWTUN,
 _debug, 0, "Enabled debug flags");
+static int ctl_lun_map_size = 1024;
+SYSCTL_INT(_kern_cam_ctl, OID_AUTO, lun_map_size, CTLFLAG_RWTUN,
+_lun_map_size, 0, "Size of per-port LUN map (max LUN + 1)");
 
 /*
  * Supported pages (0x00), Serial number (0x80), Device ID (0x83),
@@ -826,7 +829,7 @@ ctl_isc_announce_port(struct ctl_port *p
return;
i = sizeof(msg->port) + strlen(port->port_name) + 1;
if (port->lun_map)
-   i += sizeof(uint32_t) * CTL_MAX_LUNS;
+   i += port->lun_map_size * sizeof(uint32_t);
if (port->port_devid)
i += port->port_devid->len;
if (port->target_devid)
@@ -846,7 +849,7 @@ ctl_isc_announce_port(struct ctl_port *p
"%d:%s", softc->ha_id, port->port_name) + 1;
i += msg->port.name_len;
if (port->lun_map) {
-   msg->port.lun_map_len = sizeof(uint32_t) * CTL_MAX_LUNS;
+   msg->port.lun_map_len = port->lun_map_size * sizeof(uint32_t);
memcpy(>port.data[i], port->lun_map,
msg->port.lun_map_len);
i += msg->port.lun_map_len;
@@ -1155,19 +1158,25 @@ ctl_isc_port_sync(struct ctl_softc *soft
M_CTL);
i += msg->port.name_len;
if (msg->port.lun_map_len != 0) {
-   if (port->lun_map == NULL)
-   port->lun_map = malloc(sizeof(uint32_t) * CTL_MAX_LUNS,
+   if (port->lun_map == NULL ||
+   port->lun_map_size * sizeof(uint32_t) <
+   msg->port.lun_map_len) {
+   port->lun_map_size = 0;
+   free(port->lun_map, M_CTL);
+   port->lun_map = malloc(msg->port.lun_map_len,
M_CTL, M_WAITOK);
-   memcpy(port->lun_map, >port.data[i],
-   sizeof(uint32_t) * CTL_MAX_LUNS);
+   }
+   memcpy(port->lun_map, >port.data[i], 
msg->port.lun_map_len);
+   port->lun_map_size = msg->port.lun_map_len / sizeof(uint32_t);
i += msg->port.lun_map_len;
} else {
+   port->lun_map_size = 0;
free(port->lun_map, M_CTL);
port->lun_map = NULL;
}
if (msg->port.port_devid_len != 0) {
if (port->port_devid == NULL ||
-   port->port_devid->len != msg->port.port_devid_len) {
+   port->port_devid->len < msg->port.port_devid_len) {
free(port->port_devid, M_CTL);
port->port_devid = malloc(sizeof(struct ctl_devid) +
msg->port.port_devid_len, M_CTL, M_WAITOK);
@@ -1182,7 +1191,7 @@ ctl_isc_port_sync(struct ctl_softc *soft
}
if (msg->port.target_devid_len != 0) {
if (port->target_devid == NULL ||
-   port->target_devid->len != msg->port.target_devid_len) {
+   port->target_devid->len < msg->port.target_devid_len) {
free(port->target_devid, M_CTL);
port->target_devid = malloc(sizeof(struct ctl_devid) +
msg->port.target_devid_len, M_CTL, M_WAITOK);
@@ -1197,7 +1206,7 @@ ctl_isc_port_sync(struct ctl_softc *soft
}
if (msg->port.init_devid_len != 0) {
if (port->init_devid == NULL ||
-   port->init_devid->len != msg->port.init_devid_len) {
+   port->init_devid->len < msg->port.init_devid_len) {
free(port->init_devid, M_CTL);
port->init_devid = malloc(sizeof(struct ctl_devid) +
msg->port.init_devid_len, M_CTL, M_WAITOK);
@@ -3295,7 +3304,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
 
if (port->lun_map != NULL) {
   

svn commit: r310634 - head/contrib/elftoolchain/elfcopy

2016-12-27 Thread Ed Maste
Author: emaste
Date: Tue Dec 27 17:31:07 2016
New Revision: 310634
URL: https://svnweb.freebsd.org/changeset/base/310634

Log:
  elfcopy: fix PE object section name corruption and crash
  
  Fixed a bug that the PE object section names are generated incorrectly
  using the section name table found in the original input ELF object
  instead of the intermediate ELF object.
  
  Ticket:   #541
  
  Do not try to copy section content from a NULL d_buf when creating
  uninitialized data COFF section for PE object.
  
  Ticket:   #540
  
  Obtained from:ELF Tool Chain r3507, r3508
  MFC after:1 week

Modified:
  head/contrib/elftoolchain/elfcopy/pe.c

Modified: head/contrib/elftoolchain/elfcopy/pe.c
==
--- head/contrib/elftoolchain/elfcopy/pe.c  Tue Dec 27 17:13:31 2016
(r310633)
+++ head/contrib/elftoolchain/elfcopy/pe.c  Tue Dec 27 17:31:07 2016
(r310634)
@@ -70,7 +70,7 @@ create_pe(struct elfcopy *ecp, int ifd, 
errx(EXIT_FAILURE, "gelf_getehdr() failed: %s",
elf_errmsg(-1));
 
-   if (elf_getshstrndx(ecp->ein, ) == 0)
+   if (elf_getshstrndx(e, ) == 0)
errx(EXIT_FAILURE, "elf_getshstrndx() failed: %s",
elf_errmsg(-1));
 
@@ -124,7 +124,7 @@ create_pe(struct elfcopy *ecp, int ifd, 
(void) elf_errno();
continue;
}
-   if ((name = elf_strptr(ecp->ein, indx, sh.sh_name)) ==
+   if ((name = elf_strptr(e, indx, sh.sh_name)) ==
NULL) {
warnx("elf_strptr() failed: %s", elf_errmsg(-1));
(void) elf_errno();
@@ -210,12 +210,14 @@ create_pe(struct elfcopy *ecp, int ifd, 
}
pb->pb_align = 1;
pb->pb_off = 0;
-   pb->pb_size = roundup(sh.sh_size, poh.oh_filealign);
-   if ((pb->pb_buf = calloc(1, pb->pb_size)) == NULL) {
-   warn("calloc failed");
-   continue;
+   if (sh.sh_type != SHT_NOBITS) {
+   pb->pb_size = roundup(sh.sh_size, poh.oh_filealign);
+   if ((pb->pb_buf = calloc(1, pb->pb_size)) == NULL) {
+   warn("calloc failed");
+   continue;
+   }
+   memcpy(pb->pb_buf, d->d_buf, sh.sh_size);
}
-   memcpy(pb->pb_buf, d->d_buf, sh.sh_size);
}
elferr = elf_errno();
if (elferr != 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: r310633 - head/usr.sbin/ctld

2016-12-27 Thread Alexander Motin
Author: mav
Date: Tue Dec 27 17:13:31 2016
New Revision: 310633
URL: https://svnweb.freebsd.org/changeset/base/310633

Log:
  Add MAX_LUNS overflow safety checks.
  
  While this MAX_LUNS limitation is too synthetic and should be removed,
  it is better to enforce it while it is here.
  
  MFC after:2 weeks

Modified:
  head/usr.sbin/ctld/parse.y
  head/usr.sbin/ctld/uclparse.c

Modified: head/usr.sbin/ctld/parse.y
==
--- head/usr.sbin/ctld/parse.y  Tue Dec 27 11:31:17 2016(r310632)
+++ head/usr.sbin/ctld/parse.y  Tue Dec 27 17:13:31 2016(r310633)
@@ -821,6 +821,11 @@ lun_number:STR
free($1);
return (1);
}
+   if (tmp >= MAX_LUNS) {
+   yyerror("LU number is too big");
+   free($1);
+   return (1);
+   }
 
ret = asprintf(, "%s,lun,%ju", target->t_name, tmp);
if (ret <= 0)
@@ -845,6 +850,11 @@ target_lun_ref:LUN STR STR
return (1);
}
free($2);
+   if (tmp >= MAX_LUNS) {
+   yyerror("LU number is too big");
+   free($3);
+   return (1);
+   }
 
lun = lun_find(conf, $3);
free($3);

Modified: head/usr.sbin/ctld/uclparse.c
==
--- head/usr.sbin/ctld/uclparse.c   Tue Dec 27 11:31:17 2016
(r310632)
+++ head/usr.sbin/ctld/uclparse.c   Tue Dec 27 17:13:31 2016
(r310633)
@@ -183,18 +183,25 @@ static int
 uclparse_target_lun(struct target *target, const ucl_object_t *obj)
 {
struct lun *lun;
+   uint64_t tmp;
 
if (obj->type == UCL_INT) {
char *name;
 
-   asprintf(, "%s,lun,%ju", target->t_name,
-   ucl_object_toint(obj));
+   tmp = ucl_object_toint(obj);
+   if (tmp >= MAX_LUNS) {
+   log_warnx("LU number %ju in target \"%s\" is too big",
+   tmp, target->t_name);
+   return (1);
+   }
+
+   asprintf(, "%s,lun,%ju", target->t_name, tmp);
lun = lun_new(conf, name);
if (lun == NULL)
return (1);
 
lun_set_scsiname(lun, name);
-   target->t_luns[ucl_object_toint(obj)] = lun;
+   target->t_luns[tmp] = lun;
return (0);
}
 
@@ -207,6 +214,12 @@ uclparse_target_lun(struct target *targe
"\"number\" integer property", target->t_name);
return (1);
}
+   tmp = ucl_object_toint(num);
+   if (tmp >= MAX_LUNS) {
+   log_warnx("LU number %ju in target \"%s\" is too big",
+   tmp, target->t_name);
+   return (1);
+   }
 
if (name == NULL || name->type != UCL_STRING) {
log_warnx("lun section in target \"%s\" is missing "
@@ -218,7 +231,7 @@ uclparse_target_lun(struct target *targe
if (lun == NULL)
return (1);
 
-   target->t_luns[ucl_object_toint(num)] = lun;
+   target->t_luns[tmp] = lun;
}
 
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: r310624 - head/sys/net80211

2016-12-27 Thread Shawn Webb
On Tue, Dec 27, 2016 at 06:10:28AM +, Adrian Chadd wrote:
> Author: adrian
> Date: Tue Dec 27 06:10:28 2016
> New Revision: 310624
> URL: https://svnweb.freebsd.org/changeset/base/310624
> 
> Log:
>   [net80211] turn the default TX key configuration (for WEP) into a vap 
> callback.
>   
>   The ath10k firmware supports hardware WEP offload, and in native wifi mode
>   (or 802.3 ethernet mode, for that matter) the WEP key isn't actually 
> included
>   in the TX payload from net80211.  Instead, a separate firmware command is 
> issued
>   that sets the default TX key to be the specified key.
>   
>   However, net80211 doesn't at all inform the driver layer that this is
>   occuring - it just "expects" to be inserting WEP header information
>   when doing WEP TX, even with hardware encryption.
>   
>   So, to better support the newer world order, turn the default TX key 
> assignment
>   into a VAP method that can be overridden by the driver and ensure its 
> wrapped
>   in a crypto begin/end set.  That way it should be correctly atomic from the
>   point of view of keychanges (as long as the driver does the right thing.)
>   
>   It'd be nice if we passed through to the key_set call a flag that says
>   "also make this the default key" - that's captured here by calling the
>   deftxkey method after the key_set method.  Maybe I can do that later.
>   
>   Note: this is a net80211 ABI change, and will require a kernel+modules
>   recompile.  Happy Holidays, etc.

Hey Adrian,

Thank you very much for your hard work on the wireless stack. Since this
introduces an ABI change, should __FreeBSD_version be bumped?

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r310547 - head/sys/netinet

2016-12-27 Thread Michael Tuexen
> On 27 Dec 2016, at 09:19, hiren panchasara  wrote:
> 
> On 12/25/16 at 05:37P, Michael Tuexen wrote:
>> Author: tuexen
>> Date: Sun Dec 25 17:37:18 2016
>> New Revision: 310547
>> URL: https://svnweb.freebsd.org/changeset/base/310547
>> 
>> Log:
>>  Remove a KASSERT which is not always true.
>> 
>>  In case of the empty queue tp->snd_holes and tcp_sackhole_insert()
>>  failing due to memory shortage, tp->snd_holes will be empty.
>>  This problem was hit when stress tests where performed by pho.
>> 
>>  PR: 215513
>>  Reported by:pho
>>  Tested by:  pho
>>  Sponsored by:   Netflix, Inc.
>> 
>> Modified:
>>  head/sys/netinet/tcp_sack.c
> 
> Thanks for the fix, Michael. Can you please MFC this?
Sure. Will do it after 3 days or so. Missed that.

Best regards
Michael
> 
> Cheers,
> Hiren

___
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: r310630 - in head: include lib/libkvm

2016-12-27 Thread Andriy Gapon
Author: avg
Date: Tue Dec 27 10:17:56 2016
New Revision: 310630
URL: https://svnweb.freebsd.org/changeset/base/310630

Log:
  libkvm: support access to vmm guest memory, allow writes to fwmem and vmm
  
  This change consists of two parts:
  - allow libkvm to recognize /dev/vmm/* character devices as devices that
provide access to the physical memory of a system (similarly to /dev/fwmem*)
  - allow libkvm to recognize that /dev/vmm/* and /dev/fwmem* devices provide
access to the physical memory of live remote systems and, thus, the memory
is writable
  
  As a result, it should be possible to run commands like
  $ kgdb -w /path/to/kernel /dev/fwmem0.0
  $ kgdb /path/to/kernel /dev/vmm/guest
  
  Reviewed by:  kib, jhb
  MFC after:2 weeks
  Relnotes: yes
  Sponsored by: Panzura
  Differential Revision: https://reviews.freebsd.org/D8679

Modified:
  head/include/paths.h
  head/lib/libkvm/kvm.c
  head/lib/libkvm/kvm_private.h

Modified: head/include/paths.h
==
--- head/include/paths.hTue Dec 27 09:40:07 2016(r310629)
+++ head/include/paths.hTue Dec 27 10:17:56 2016(r310630)
@@ -99,6 +99,7 @@
 #define_PATH_VARDB "/var/db/"
 #define_PATH_VARRUN"/var/run/"
 #define_PATH_VARTMP"/var/tmp/"
+#define_PATH_DEVVMM"/dev/vmm/"
 #define_PATH_YP"/var/yp/"
 #define_PATH_UUCPLOCK  "/var/spool/lock/"
 

Modified: head/lib/libkvm/kvm.c
==
--- head/lib/libkvm/kvm.c   Tue Dec 27 09:40:07 2016(r310629)
+++ head/lib/libkvm/kvm.c   Tue Dec 27 10:17:56 2016(r310630)
@@ -167,8 +167,10 @@ _kvm_open(kvm_t *kd, const char *uf, con
return (kd);
}
}
+
/*
-* This is a crash dump.
+* This is either a crash dump or a remote live system with its physical
+* memory fully accessible via a special device.
 * Open the namelist fd and determine the architecture.
 */
if ((kd->nlfd = open(uf, O_RDONLY | O_CLOEXEC, 0)) < 0) {
@@ -177,8 +179,11 @@ _kvm_open(kvm_t *kd, const char *uf, con
}
if (_kvm_read_kernel_ehdr(kd) < 0)
goto failed;
-   if (strncmp(mf, _PATH_FWMEM, strlen(_PATH_FWMEM)) == 0)
+   if (strncmp(mf, _PATH_FWMEM, strlen(_PATH_FWMEM)) == 0 ||
+   strncmp(mf, _PATH_DEVVMM, strlen(_PATH_DEVVMM)) == 0) {
kd->rawdump = 1;
+   kd->writable = 1;
+   }
SET_FOREACH(parch, kvm_arch) {
if ((*parch)->ka_probe(kd)) {
kd->arch = *parch;
@@ -405,6 +410,15 @@ ssize_t
 kvm_write(kvm_t *kd, u_long kva, const void *buf, size_t len)
 {
int cc;
+   ssize_t cw;
+   off_t pa;
+   const char *cp;
+
+   if (!ISALIVE(kd) && !kd->writable) {
+   _kvm_err(kd, kd->program,
+   "kvm_write not implemented for dead kernels");
+   return (-1);
+   }
 
if (ISALIVE(kd)) {
/*
@@ -422,12 +436,38 @@ kvm_write(kvm_t *kd, u_long kva, const v
} else if ((size_t)cc < len)
_kvm_err(kd, kd->program, "short write");
return (cc);
-   } else {
-   _kvm_err(kd, kd->program,
-   "kvm_write not implemented for dead kernels");
-   return (-1);
}
-   /* NOTREACHED */
+
+   cp = buf;
+   while (len > 0) {
+   cc = kd->arch->ka_kvatop(kd, kva, );
+   if (cc == 0)
+   return (-1);
+   if (cc > (ssize_t)len)
+   cc = len;
+   errno = 0;
+   if (lseek(kd->pmfd, pa, 0) == -1 && errno != 0) {
+   _kvm_syserr(kd, 0, _PATH_MEM);
+   break;
+   }
+   cw = write(kd->pmfd, cp, cc);
+   if (cw < 0) {
+   _kvm_syserr(kd, kd->program, "kvm_write");
+   break;
+   }
+   /*
+* If ka_kvatop returns a bogus value or our core file is
+* truncated, we might wind up seeking beyond the end of the
+* core file in which case the read will return 0 (EOF).
+*/
+   if (cw == 0)
+   break;
+   cp += cw;
+   kva += cw;
+   len -= cw;
+   }
+
+   return (cp - (char *)buf);
 }
 
 int

Modified: head/lib/libkvm/kvm_private.h
==
--- head/lib/libkvm/kvm_private.h   Tue Dec 27 09:40:07 2016
(r310629)
+++ head/lib/libkvm/kvm_private.h   Tue Dec 27 10:17:56 2016
(r310630)
@@ -78,6 +78,7 @@ struct __kvm {
 */
   

svn commit: r310627 - head/sys/dev/sfxge

2016-12-27 Thread Andrew Rybchenko
Author: arybchik
Date: Tue Dec 27 08:51:26 2016
New Revision: 310627
URL: https://svnweb.freebsd.org/changeset/base/310627

Log:
  sfxge(4): do not limit driver RSS table to RSS channels max
  
  Specification of entire RSS table in the driver allows to spread traffic
  more equally across CPUs/RSS channels if number of RSS channels is not
  power of 2.
  
  Reviewed by:philip
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision: https://reviews.freebsd.org/D8910

Modified:
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_rx.c
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Tue Dec 27 08:32:54 2016(r310626)
+++ head/sys/dev/sfxge/sfxge.h  Tue Dec 27 08:51:26 2016(r310627)
@@ -301,7 +301,7 @@ struct sfxge_softc {
unsigned intmax_rss_channels;
uma_zone_t  rxq_cache;
struct sfxge_rxq*rxq[SFXGE_RX_SCALE_MAX];
-   unsigned intrx_indir_table[SFXGE_RX_SCALE_MAX];
+   unsigned intrx_indir_table[EFX_RSS_TBL_SIZE];
 
struct sfxge_txq*txq[SFXGE_TXQ_NTYPES + 
SFXGE_RX_SCALE_MAX];
 

Modified: head/sys/dev/sfxge/sfxge_rx.c
==
--- head/sys/dev/sfxge/sfxge_rx.c   Tue Dec 27 08:32:54 2016
(r310626)
+++ head/sys/dev/sfxge/sfxge_rx.c   Tue Dec 27 08:51:26 2016
(r310627)
@@ -1128,7 +1128,7 @@ sfxge_rx_start(struct sfxge_softc *sc)
/*
 * Set up the scale table.  Enable all hash types and hash insertion.
 */
-   for (index = 0; index < SFXGE_RX_SCALE_MAX; index++)
+   for (index = 0; index < nitems(sc->rx_indir_table); index++)
 #ifdef RSS
sc->rx_indir_table[index] =
rss_get_indirection_to_bucket(index) % sc->rxq_count;
@@ -1136,7 +1136,7 @@ sfxge_rx_start(struct sfxge_softc *sc)
sc->rx_indir_table[index] = index % sc->rxq_count;
 #endif
if ((rc = efx_rx_scale_tbl_set(sc->enp, sc->rx_indir_table,
-  SFXGE_RX_SCALE_MAX)) != 0)
+  nitems(sc->rx_indir_table))) != 0)
goto fail;
(void)efx_rx_scale_mode_set(sc->enp, EFX_RX_HASHALG_TOEPLITZ,
(1 << EFX_RX_HASH_IPV4) | (1 << EFX_RX_HASH_TCPIPV4) |

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Tue Dec 27 08:32:54 2016
(r310626)
+++ head/sys/dev/sfxge/sfxge_tx.c   Tue Dec 27 08:51:26 2016
(r310627)
@@ -838,8 +838,9 @@ sfxge_if_transmit(struct ifnet *ifp, str
/* check if flowid is set */
if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
uint32_t hash = m->m_pkthdr.flowid;
+   uint32_t idx = hash % nitems(sc->rx_indir_table);
 
-   index = sc->rx_indir_table[hash % SFXGE_RX_SCALE_MAX];
+   index = sc->rx_indir_table[idx];
}
 #endif
 #if SFXGE_TX_PARSE_EARLY
___
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: r310547 - head/sys/netinet

2016-12-27 Thread hiren panchasara
On 12/25/16 at 05:37P, Michael Tuexen wrote:
> Author: tuexen
> Date: Sun Dec 25 17:37:18 2016
> New Revision: 310547
> URL: https://svnweb.freebsd.org/changeset/base/310547
> 
> Log:
>   Remove a KASSERT which is not always true.
>   
>   In case of the empty queue tp->snd_holes and tcp_sackhole_insert()
>   failing due to memory shortage, tp->snd_holes will be empty.
>   This problem was hit when stress tests where performed by pho.
>   
>   PR: 215513
>   Reported by:pho
>   Tested by:  pho
>   Sponsored by:   Netflix, Inc.
> 
> Modified:
>   head/sys/netinet/tcp_sack.c

Thanks for the fix, Michael. Can you please MFC this?

Cheers,
Hiren


pgp6UGh01qwPo.pgp
Description: PGP signature