svn commit: r310806 - head/sys/dev/pci

2016-12-30 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Dec 30 08:37:30 2016
New Revision: 310806
URL: https://svnweb.freebsd.org/changeset/base/310806

Log:
  Add MSIX rewrite table quirk for use with VMs.
  
  This patch solves IRQ generation problems using the mlx5en(4) driver
  with xenserver v6.5.0 in SRIOV and PCI-passthrough modes.
  
  Until further the hw.pci.msix_rewrite_table quirk must be set manually
  in /boot/loader.conf .
  
  Reviewed by:  jhb @
  Sponsored by:   Mellanox Technologies
  MFC after:2 weeks

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

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Fri Dec 30 06:26:17 2016(r310805)
+++ head/sys/dev/pci/pci.c  Fri Dec 30 08:37:30 2016(r310806)
@@ -356,6 +356,11 @@ static int pci_do_msix = 1;
 SYSCTL_INT(_hw_pci, OID_AUTO, enable_msix, CTLFLAG_RWTUN, &pci_do_msix, 1,
 "Enable support for MSI-X interrupts");
 
+static int pci_msix_rewrite_table = 0;
+SYSCTL_INT(_hw_pci, OID_AUTO, msix_rewrite_table, CTLFLAG_RWTUN,
+&pci_msix_rewrite_table, 0,
+"Rewrite entire MSI-X table when updating MSI-X entries");
+
 static int pci_honor_msi_blacklist = 1;
 SYSCTL_INT(_hw_pci, OID_AUTO, honor_msi_blacklist, CTLFLAG_RDTUN,
 &pci_honor_msi_blacklist, 1, "Honor chipset blacklist for MSI/MSI-X");
@@ -1482,11 +1487,10 @@ pci_find_extcap_method(device_t dev, dev
 /*
  * Support for MSI-X message interrupts.
  */
-void
-pci_enable_msix_method(device_t dev, device_t child, u_int index,
-uint64_t address, uint32_t data)
+static void
+pci_write_msix_entry(device_t dev, u_int index, uint64_t address, uint32_t 
data)
 {
-   struct pci_devinfo *dinfo = device_get_ivars(child);
+   struct pci_devinfo *dinfo = device_get_ivars(dev);
struct pcicfg_msix *msix = &dinfo->cfg.msix;
uint32_t offset;
 
@@ -1495,6 +1499,31 @@ pci_enable_msix_method(device_t dev, dev
bus_write_4(msix->msix_table_res, offset, address & 0x);
bus_write_4(msix->msix_table_res, offset + 4, address >> 32);
bus_write_4(msix->msix_table_res, offset + 8, data);
+}
+
+void
+pci_enable_msix_method(device_t dev, device_t child, u_int index,
+uint64_t address, uint32_t data)
+{
+
+   if (pci_msix_rewrite_table) {
+   struct pci_devinfo *dinfo = device_get_ivars(child);
+   struct pcicfg_msix *msix = &dinfo->cfg.msix;
+
+   /*
+* Some VM hosts require MSIX to be disabled in the
+* control register before updating the MSIX table
+* entries are allowed. It is not enough to only
+* disable MSIX while updating a single entry. MSIX
+* must be disabled while updating all entries in the
+* table.
+*/
+   pci_write_config(child,
+   msix->msix_location + PCIR_MSIX_CTRL,
+   msix->msix_ctrl & ~PCIM_MSIXCTRL_MSIX_ENABLE, 2);
+   pci_resume_msix(child);
+   } else
+   pci_write_msix_entry(child, index, address, data);
 
/* Enable MSI -> HT mapping. */
pci_ht_map_msi(child, address);
@@ -1570,7 +1599,8 @@ pci_resume_msix(device_t dev)
if (mte->mte_vector == 0 || mte->mte_handlers == 0)
continue;
mv = &msix->msix_vectors[mte->mte_vector - 1];
-   pci_enable_msix(dev, i, mv->mv_address, mv->mv_data);
+   pci_write_msix_entry(dev, i, mv->mv_address,
+   mv->mv_data);
pci_unmask_msix(dev, i);
}
}
@@ -4401,12 +4431,20 @@ pci_setup_intr(device_t dev, device_t ch
mv->mv_address = addr;
mv->mv_data = data;
}
-   if (mte->mte_handlers == 0) {
+
+   /*
+* The MSIX table entry must be made valid by
+* incrementing the mte_handlers before
+* calling pci_enable_msix() and
+* pci_resume_msix(). Else the MSIX rewrite
+* table quirk will not work as expected.
+*/
+   mte->mte_handlers++;
+   if (mte->mte_handlers == 1) {
pci_enable_msix(child, rid - 1, mv->mv_address,
mv->mv_data);
pci_unmask_msix(child, rid - 1);
}
-   mte->mte_handlers++;
}
 
/*
___
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.o

svn commit: r310807 - in head: share/man/man4 sys/dev/cxgbe sys/dev/cxgbe/common

2016-12-30 Thread Navdeep Parhar
Author: np
Date: Fri Dec 30 08:59:49 2016
New Revision: 310807
URL: https://svnweb.freebsd.org/changeset/base/310807

Log:
  cxgbe(4): Updates to link configuration.
  
  - Update struct link_settings and associated shared code.
  
  - Add tunables to control FEC and autonegotiation.  All ports inherit
these values as their initial settings.
hw.cxgbe.fec
hw.cxgbe.autoneg
  
  - Add per-port sysctls to control FEC and autonegotiation.  These can be
modified at any time.
dev...fec
dev...autoneg
  
  MFC after:3 days
  Sponsored by: Chelsio Communications

Modified:
  head/share/man/man4/cxgbe.4
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_vf.c

Modified: head/share/man/man4/cxgbe.4
==
--- head/share/man/man4/cxgbe.4 Fri Dec 30 08:37:30 2016(r310806)
+++ head/share/man/man4/cxgbe.4 Fri Dec 30 08:59:49 2016(r310807)
@@ -289,6 +289,24 @@ The default is 3 (both rx_pause and tx_p
 This tunable establishes the default PAUSE settings for all ports.
 Settings can be displayed and controlled on a per-port basis via the
 dev..X.pause_settings sysctl.
+.It Va hw.cxgbe.fec
+FEC (Forward Error Correction) settings.
+0 diables FEC.
+Bit 0 enables RS FEC, bit 1 enables BASE-R RS, bit 3 is reserved.
+The default is -1 which lets the driver pick a value.
+This tunable establishes the default FEC settings for all ports.
+Settings can be displayed and controlled on a per-port basis via the
+dev..X.fec sysctl.
+.It Va hw.cxgbe.autoneg
+Link autonegotiation settings.
+This tunable establishes the default autonegotiation settings for all ports.
+Settings can be displayed and controlled on a per-port basis via the
+dev..X.autoneg sysctl.
+0 disables autonegotiation.
+1 enables autonegotiation.
+The default is -1 which lets the driver pick a value.
+dev..X.autoneg is -1 for port and module combinations that do not support
+autonegotiation.
 .It Va hw.cxgbe.buffer_packing
 Allow the hardware to deliver multiple frames in the same receive buffer
 opportunistically.

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hFri Dec 30 08:37:30 2016
(r310806)
+++ head/sys/dev/cxgbe/adapter.hFri Dec 30 08:59:49 2016
(r310807)
@@ -265,7 +265,6 @@ struct port_info {
uint8_t  tx_chan;
uint8_t  rx_chan_map;   /* rx MPS channel bitmap */
 
-   int linkdnrc;
struct link_config link_cfg;
 
struct timeval last_refreshed;
@@ -1098,7 +1097,7 @@ int t4_os_find_pci_capability(struct ada
 int t4_os_pci_save_state(struct adapter *);
 int t4_os_pci_restore_state(struct adapter *);
 void t4_os_portmod_changed(const struct adapter *, int);
-void t4_os_link_changed(struct adapter *, int, int, int);
+void t4_os_link_changed(struct adapter *, int, int);
 void t4_iterate(void (*)(struct adapter *, void *), void *);
 void t4_init_devnames(struct adapter *);
 void t4_add_adapter(struct adapter *);

Modified: head/sys/dev/cxgbe/common/common.h
==
--- head/sys/dev/cxgbe/common/common.h  Fri Dec 30 08:37:30 2016
(r310806)
+++ head/sys/dev/cxgbe/common/common.h  Fri Dec 30 08:59:49 2016
(r310807)
@@ -62,6 +62,12 @@ enum {
PAUSE_AUTONEG = 1 << 2
 };
 
+enum {
+   FEC_RS= 1 << 0,
+   FEC_BASER_RS  = 1 << 1,
+   FEC_RESERVED  = 1 << 2,
+};
+
 struct port_stats {
u64 tx_octets;/* total # of octets in good frames */
u64 tx_frames;/* all good frames */
@@ -392,12 +398,16 @@ struct trace_params {
 struct link_config {
unsigned short supported;/* link capabilities */
unsigned short advertising;  /* advertised capabilities */
-   unsigned int requested_speed;/* speed user has requested */
-   unsigned int speed;  /* actual link speed */
+   unsigned short lp_advertising;   /* peer advertised capabilities */
+   unsigned int   requested_speed;  /* speed user has requested */
+   unsigned int   speed;/* actual link speed */
unsigned char  requested_fc; /* flow control user has requested */
unsigned char  fc;   /* actual link flow control */
+   unsigned char  requested_fec;/* FEC user has requested */
+   unsigned char  fec;  /* actual FEC */
unsigned char  autoneg;  /* autonegotiating? */
unsigned char  link_ok;  /* link up? */
+   unsigned char  link_down_rc; /* link down reason */
 };
 
 #include "adapter.h"

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==
--- head/sys/dev/cxgbe/common

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

2016-12-30 Thread Gavin Atkinson
Author: gavin
Date: Fri Dec 30 11:02:16 2016
New Revision: 310809
URL: https://svnweb.freebsd.org/changeset/base/310809

Log:
  Fix bit value for a debug flag definition.
  
  Pointy hat to:gavin

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

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Fri Dec 30 09:38:45 2016
(r310808)
+++ head/sys/dev/usb/wlan/if_run.c  Fri Dec 30 11:02:16 2016
(r310809)
@@ -105,7 +105,7 @@ enum {
RUN_DEBUG_RSSI  = 0x4000,   /* dump RSSI lookups */
RUN_DEBUG_RESET = 0x8000,   /* initialization progress */
RUN_DEBUG_CALIB = 0x0001,   /* calibration progress */
-   RUN_DEBUG_CMD   = 0x0001,   /* command queue */
+   RUN_DEBUG_CMD   = 0x0002,   /* command queue */
RUN_DEBUG_ANY   = 0x
 };
 
___
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: r310810 - head/sys/dev/sfxge

2016-12-30 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Dec 30 11:49:37 2016
New Revision: 310810
URL: https://svnweb.freebsd.org/changeset/base/310810

Log:
  sfxge(4): cleanup: check deferred packet list tunables once
  
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision:  https://reviews.freebsd.org/D8973

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

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Fri Dec 30 11:02:16 2016
(r310809)
+++ head/sys/dev/sfxge/sfxge_tx.c   Fri Dec 30 11:49:37 2016
(r310810)
@@ -1785,26 +1785,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
(rc = tso_init(txq)) != 0)
goto fail3;
 
-   if (sfxge_tx_dpl_get_max <= 0) {
-   log(LOG_ERR, "%s=%d must be greater than 0",
-   SFXGE_PARAM_TX_DPL_GET_MAX, sfxge_tx_dpl_get_max);
-   rc = EINVAL;
-   goto fail_tx_dpl_get_max;
-   }
-   if (sfxge_tx_dpl_get_non_tcp_max <= 0) {
-   log(LOG_ERR, "%s=%d must be greater than 0",
-   SFXGE_PARAM_TX_DPL_GET_NON_TCP_MAX,
-   sfxge_tx_dpl_get_non_tcp_max);
-   rc = EINVAL;
-   goto fail_tx_dpl_get_max;
-   }
-   if (sfxge_tx_dpl_put_max < 0) {
-   log(LOG_ERR, "%s=%d must be greater or equal to 0",
-   SFXGE_PARAM_TX_DPL_PUT_MAX, sfxge_tx_dpl_put_max);
-   rc = EINVAL;
-   goto fail_tx_dpl_put_max;
-   }
-
/* Initialize the deferred packet list. */
stdp = &txq->dpl;
stdp->std_put_max = sfxge_tx_dpl_put_max;
@@ -1849,8 +1829,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
 
 fail_txq_stat_init:
 fail_dpl_node:
-fail_tx_dpl_put_max:
-fail_tx_dpl_get_max:
 fail3:
 fail_txq_node:
free(txq->pend_desc, M_SFXGE);
@@ -1951,6 +1929,26 @@ sfxge_tx_init(struct sfxge_softc *sc)
KASSERT(intr->state == SFXGE_INTR_INITIALIZED,
("intr->state != SFXGE_INTR_INITIALIZED"));
 
+   if (sfxge_tx_dpl_get_max <= 0) {
+   log(LOG_ERR, "%s=%d must be greater than 0",
+   SFXGE_PARAM_TX_DPL_GET_MAX, sfxge_tx_dpl_get_max);
+   rc = EINVAL;
+   goto fail_tx_dpl_get_max;
+   }
+   if (sfxge_tx_dpl_get_non_tcp_max <= 0) {
+   log(LOG_ERR, "%s=%d must be greater than 0",
+   SFXGE_PARAM_TX_DPL_GET_NON_TCP_MAX,
+   sfxge_tx_dpl_get_non_tcp_max);
+   rc = EINVAL;
+   goto fail_tx_dpl_get_non_tcp_max;
+   }
+   if (sfxge_tx_dpl_put_max < 0) {
+   log(LOG_ERR, "%s=%d must be greater or equal to 0",
+   SFXGE_PARAM_TX_DPL_PUT_MAX, sfxge_tx_dpl_put_max);
+   rc = EINVAL;
+   goto fail_tx_dpl_put_max;
+   }
+
sc->txq_count = SFXGE_TXQ_NTYPES - 1 + sc->intr.n_alloc;
 
sc->tso_fw_assisted = sfxge_tso_fw_assisted;
@@ -2003,5 +2001,8 @@ fail2:
 fail:
 fail_txq_node:
sc->txq_count = 0;
+fail_tx_dpl_put_max:
+fail_tx_dpl_get_non_tcp_max:
+fail_tx_dpl_get_max:
return (rc);
 }
___
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: r310811 - head/sys/dev/sfxge/common

2016-12-30 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Dec 30 11:52:55 2016
New Revision: 310811
URL: https://svnweb.freebsd.org/changeset/base/310811

Log:
  sfxge(4): cleanup: remove now-unused function flags
  
  Submitted by:   Mark Spender 
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision:  https://reviews.freebsd.org/D8966

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_mcdi.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:49:37 2016
(r310810)
+++ head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:52:55 2016
(r310811)
@@ -128,11 +128,6 @@ typedef struct efx_rxq_s   efx_rxq_t;
 
 typedef struct efx_nic_s   efx_nic_t;
 
-#defineEFX_NIC_FUNC_PRIMARY0x0001
-#defineEFX_NIC_FUNC_LINKCTRL   0x0002
-#defineEFX_NIC_FUNC_TRUSTED0x0004
-
-
 extern __checkReturn   efx_rc_t
 efx_nic_create(
__inefx_family_t family,
@@ -1100,7 +1095,6 @@ typedef struct efx_nic_cfg_s {
unsigned intenc_features;
uint8_t enc_mac_addr[6];
uint8_t enc_port;   /* PHY port number */
-   uint32_tenc_func_flags;
uint32_tenc_intr_vec_base;
uint32_tenc_intr_limit;
uint32_tenc_evq_limit;

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cFri Dec 30 11:49:37 2016
(r310810)
+++ head/sys/dev/sfxge/common/efx_mcdi.cFri Dec 30 11:52:55 2016
(r310811)
@@ -1184,11 +1184,9 @@ efx_mcdi_drv_attach(
__inefx_nic_t *enp,
__inboolean_t attach)
 {
-   efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_DRV_ATTACH_IN_LEN,
MC_CMD_DRV_ATTACH_EXT_OUT_LEN)];
-   uint32_t flags;
efx_rc_t rc;
 
(void) memset(payload, 0, sizeof (payload));
@@ -1219,36 +1217,8 @@ efx_mcdi_drv_attach(
goto fail2;
}
 
-   if (attach == B_FALSE) {
-   flags = 0;
-   } else if (enp->en_family == EFX_FAMILY_SIENA) {
-   efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
-
-   /* Create synthetic privileges for Siena functions */
-   flags = EFX_NIC_FUNC_LINKCTRL | EFX_NIC_FUNC_TRUSTED;
-   if (emip->emi_port == 1)
-   flags |= EFX_NIC_FUNC_PRIMARY;
-   } else {
-   EFX_STATIC_ASSERT(EFX_NIC_FUNC_PRIMARY ==
-   (1u << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_PRIMARY));
-   EFX_STATIC_ASSERT(EFX_NIC_FUNC_LINKCTRL ==
-   (1u << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL));
-   EFX_STATIC_ASSERT(EFX_NIC_FUNC_TRUSTED ==
-   (1u << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_TRUSTED));
-
-   /* Save function privilege flags (EF10 and later) */
-   if (req.emr_out_length_used < MC_CMD_DRV_ATTACH_EXT_OUT_LEN) {
-   rc = EMSGSIZE;
-   goto fail3;
-   }
-   flags = MCDI_OUT_DWORD(req, DRV_ATTACH_EXT_OUT_FUNC_FLAGS);
-   }
-   encp->enc_func_flags = flags;
-
return (0);
 
-fail3:
-   EFSYS_PROBE(fail3);
 fail2:
EFSYS_PROBE(fail2);
 fail1:
___
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: r310812 - head/sys/dev/sfxge/common

2016-12-30 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Dec 30 11:54:27 2016
New Revision: 310812
URL: https://svnweb.freebsd.org/changeset/base/310812

Log:
  sfxge(4): support non-interrupting event queues creation
  
  Poll-mode driver does not use interrupts and number of used event queues
  should not be limitted by the number of interrupts allocated for the
  NIC.
  
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision:  https://reviews.freebsd.org/D8967

Modified:
  head/sys/dev/sfxge/common/ef10_ev.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_impl.h

Modified: head/sys/dev/sfxge/common/ef10_ev.c
==
--- head/sys/dev/sfxge/common/ef10_ev.c Fri Dec 30 11:52:55 2016
(r310811)
+++ head/sys/dev/sfxge/common/ef10_ev.c Fri Dec 30 11:54:27 2016
(r310812)
@@ -49,6 +49,12 @@ __FBSDID("$FreeBSD$");
 #defineEFX_EV_QSTAT_INCR(_eep, _stat)
 #endif
 
+/*
+ * Non-interrupting event queue requires interrrupting event queue to
+ * refer to for wake-up events even if wake ups are never used.
+ * It could be even non-allocated event queue.
+ */
+#defineEFX_EF10_ALWAYS_INTERRUPTING_EVQ_INDEX  (0)
 
 static __checkReturn   boolean_t
 ef10_ev_rx(
@@ -151,6 +157,7 @@ efx_mcdi_init_evq(
uint64_t addr;
int npages;
int i;
+   boolean_t interrupting;
int ev_cut_through;
efx_rc_t rc;
 
@@ -171,6 +178,9 @@ efx_mcdi_init_evq(
MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_INSTANCE, instance);
MCDI_IN_SET_DWORD(req, INIT_EVQ_IN_IRQ_NUM, irq);
 
+   interrupting = ((flags & EFX_EVQ_FLAGS_NOTIFY_MASK) ==
+   EFX_EVQ_FLAGS_NOTIFY_INTERRUPT);
+
/*
 * On Huntington RX and TX event batching can only be requested together
 * (even if the datapath firmware doesn't actually support RX
@@ -194,7 +204,7 @@ efx_mcdi_init_evq(
goto fail2;
}
MCDI_IN_POPULATE_DWORD_6(req, INIT_EVQ_IN_FLAGS,
-   INIT_EVQ_IN_FLAG_INTERRUPTING, 1,
+   INIT_EVQ_IN_FLAG_INTERRUPTING, interrupting,
INIT_EVQ_IN_FLAG_RPTR_DOS, 0,
INIT_EVQ_IN_FLAG_INT_ARMD, 0,
INIT_EVQ_IN_FLAG_CUT_THRU, ev_cut_through,
@@ -280,6 +290,7 @@ efx_mcdi_init_evq_v2(
uint8_t payload[
MAX(MC_CMD_INIT_EVQ_V2_IN_LEN(EFX_EVQ_NBUFS(EFX_EVQ_MAXNEVS)),
MC_CMD_INIT_EVQ_V2_OUT_LEN)];
+   boolean_t interrupting;
unsigned int evq_type;
efx_qword_t *dma_addr;
uint64_t addr;
@@ -304,6 +315,9 @@ efx_mcdi_init_evq_v2(
MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_INSTANCE, instance);
MCDI_IN_SET_DWORD(req, INIT_EVQ_V2_IN_IRQ_NUM, irq);
 
+   interrupting = ((flags & EFX_EVQ_FLAGS_NOTIFY_MASK) ==
+   EFX_EVQ_FLAGS_NOTIFY_INTERRUPT);
+
switch (flags & EFX_EVQ_FLAGS_TYPE_MASK) {
case EFX_EVQ_FLAGS_TYPE_AUTO:
evq_type = MC_CMD_INIT_EVQ_V2_IN_FLAG_TYPE_AUTO;
@@ -319,7 +333,7 @@ efx_mcdi_init_evq_v2(
goto fail2;
}
MCDI_IN_POPULATE_DWORD_4(req, INIT_EVQ_V2_IN_FLAGS,
-   INIT_EVQ_V2_IN_FLAG_INTERRUPTING, 1,
+   INIT_EVQ_V2_IN_FLAG_INTERRUPTING, interrupting,
INIT_EVQ_V2_IN_FLAG_RPTR_DOS, 0,
INIT_EVQ_V2_IN_FLAG_INT_ARMD, 0,
INIT_EVQ_V2_IN_FLAG_TYPE, evq_type);
@@ -484,7 +498,17 @@ ef10_ev_qcreate(
eep->ee_mcdi= ef10_ev_mcdi;
 
/* Set up the event queue */
-   irq = index;/* INIT_EVQ expects function-relative vector number */
+   /* INIT_EVQ expects function-relative vector number */
+   if ((flags & EFX_EVQ_FLAGS_NOTIFY_MASK) ==
+   EFX_EVQ_FLAGS_NOTIFY_INTERRUPT) {
+   irq = index;
+   } else if (index == EFX_EF10_ALWAYS_INTERRUPTING_EVQ_INDEX) {
+   irq = index;
+   flags = (flags & ~EFX_EVQ_FLAGS_NOTIFY_MASK) |
+   EFX_EVQ_FLAGS_NOTIFY_INTERRUPT;
+   } else {
+   irq = EFX_EF10_ALWAYS_INTERRUPTING_EVQ_INDEX;
+   }
 
/*
 * Interrupts may be raised for events immediately after the queue is

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:52:55 2016
(r310811)
+++ head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:54:27 2016
(r310812)
@@ -1624,6 +1624,10 @@ efx_ev_fini(
 #defineEFX_EVQ_FLAGS_TYPE_THROUGHPUT   (0x1)
 #defineEFX_EVQ_FLAGS_TYPE_LOW_LATENCY  (0x2)
 
+#defineEFX_EVQ_FLAGS_NOTIFY_MASK   (0xC)
+#defineEFX_EVQ_FLAGS_NOTIFY_INTERRUPT  (0x0)   /* Interrupting 
(default) */
+#defineEFX_EVQ_FLAGS_NOTIFY_DISABLED   (0x4)   /* Non-interrupting */
+
 extern __checkReturn   efx_rc_t
 efx_ev_qcreate(
__inefx_nic

svn commit: r310813 - head/sys/dev/sfxge/common

2016-12-30 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Dec 30 11:56:12 2016
New Revision: 310813
URL: https://svnweb.freebsd.org/changeset/base/310813

Log:
  sfxge(4): add per-command timeout reporting to the common code
  
  In newer firmware that supports multithreaded MCDI processing,
  longer running commands may be run ina background thread. Add
  support for drivers to query the appropriate timeout for each
  MCDI request.
  
  Submitted by:   Andy Moreton 
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D8968

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_mcdi.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_mcdi.c
  head/sys/dev/sfxge/common/siena_impl.h
  head/sys/dev/sfxge/common/siena_mcdi.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Fri Dec 30 11:54:27 2016
(r310812)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Fri Dec 30 11:56:12 2016
(r310813)
@@ -330,6 +330,12 @@ ef10_mcdi_feature_supported(
__inefx_mcdi_feature_id_t id,
__out   boolean_t *supportedp);
 
+extern void
+ef10_mcdi_get_timeout(
+   __inefx_nic_t *enp,
+   __inefx_mcdi_req_t *emrp,
+   __out   uint32_t *timeoutp);
+
 #endif /* EFSYS_OPT_MCDI */
 
 /* NVRAM */

Modified: head/sys/dev/sfxge/common/ef10_mcdi.c
==
--- head/sys/dev/sfxge/common/ef10_mcdi.c   Fri Dec 30 11:54:27 2016
(r310812)
+++ head/sys/dev/sfxge/common/ef10_mcdi.c   Fri Dec 30 11:56:12 2016
(r310813)
@@ -108,6 +108,46 @@ ef10_mcdi_fini(
emip->emi_new_epoch = B_FALSE;
 }
 
+/*
+ * In older firmware all commands are processed in a single thread, so a long
+ * running command for one PCIe function can block processing for another
+ * function (see bug 61269).
+ *
+ * In newer firmware that supports multithreaded MCDI processing, we can extend
+ * the timeout for long-running requests which we know firmware may choose to
+ * process in a background thread.
+ */
+#defineEF10_MCDI_CMD_TIMEOUT_US(10 * 1000 * 1000)
+#defineEF10_MCDI_CMD_LONG_TIMEOUT_US   (60 * 1000 * 1000)
+
+   void
+ef10_mcdi_get_timeout(
+   __inefx_nic_t *enp,
+   __inefx_mcdi_req_t *emrp,
+   __out   uint32_t *timeoutp)
+{
+   efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+
+   switch (emrp->emr_cmd) {
+   case MC_CMD_POLL_BIST:
+   case MC_CMD_NVRAM_ERASE:
+   case MC_CMD_LICENSING_V3:
+   case MC_CMD_NVRAM_UPDATE_FINISH:
+   if (encp->enc_fw_verified_nvram_update_required != B_FALSE) {
+   /*
+* Potentially longer running commands, which firmware
+* may choose to process in a background thread.
+*/
+   *timeoutp = EF10_MCDI_CMD_LONG_TIMEOUT_US;
+   break;
+   }
+   /* FALLTHRU */
+   default:
+   *timeoutp = EF10_MCDI_CMD_TIMEOUT_US;
+   break;
+   }
+}
+
void
 ef10_mcdi_send_request(
__inefx_nic_t *enp,

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:54:27 2016
(r310812)
+++ head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:56:12 2016
(r310813)
@@ -243,6 +243,12 @@ efx_mcdi_new_epoch(
__inefx_nic_t *enp);
 
 extern void
+efx_mcdi_get_timeout(
+   __inefx_nic_t *enp,
+   __inefx_mcdi_req_t *emrp,
+   __out   uint32_t *usec_timeoutp);
+
+extern void
 efx_mcdi_request_start(
__inefx_nic_t *enp,
__inefx_mcdi_req_t *emrp,

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hFri Dec 30 11:54:27 2016
(r310812)
+++ head/sys/dev/sfxge/common/efx_impl.hFri Dec 30 11:56:12 2016
(r310813)
@@ -427,7 +427,10 @@ typedef struct efx_mcdi_ops_s {
boolean_t   (*emco_poll_response)(efx_nic_t *);
void(*emco_read_response)(efx_nic_t *, void *, size_t, 
size_t);
void(*emco_fini)(efx_nic_t *);
-   efx_rc_t(*emco_feature_supported)(efx_nic_t *, 
efx_mcdi_feature_id_t, boolean_t *);
+   efx_rc_t(*emco_feature_supported)(efx_nic_t *,
+

svn commit: r310814 - head/sys/dev/sfxge/common

2016-12-30 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Dec 30 11:58:23 2016
New Revision: 310814
URL: https://svnweb.freebsd.org/changeset/base/310814

Log:
  sfxge(4): make verified update result available from ef10_nvram_partn_unlock()
  
  Manftest needs to know exactly what went wrong with the verified update
  so that failing boards can be correctly diagnosed.
  
  Submitted by:   Tom Millington 
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D8969

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_nvram.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Fri Dec 30 11:56:12 2016
(r310813)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Fri Dec 30 11:58:23 2016
(r310814)
@@ -393,7 +393,8 @@ ef10_nvram_partn_lock(
 extern __checkReturn   efx_rc_t
 ef10_nvram_partn_unlock(
__inefx_nic_t *enp,
-   __inuint32_t partn);
+   __inuint32_t partn,
+   __out_opt   uint32_t *resultp);
 
 #endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */
 

Modified: head/sys/dev/sfxge/common/ef10_nvram.c
==
--- head/sys/dev/sfxge/common/ef10_nvram.c  Fri Dec 30 11:56:12 2016
(r310813)
+++ head/sys/dev/sfxge/common/ef10_nvram.c  Fri Dec 30 11:58:23 2016
(r310814)
@@ -1828,7 +1828,7 @@ ef10_nvram_partn_write_segment_tlv(
goto fail7;
 
/* Unlock the partition */
-   ef10_nvram_partn_unlock(enp, partn);
+   ef10_nvram_partn_unlock(enp, partn, NULL);
 
EFSYS_KMEM_FREE(enp->en_esip, partn_size, partn_data);
 
@@ -1843,7 +1843,7 @@ fail5:
 fail4:
EFSYS_PROBE(fail4);
 
-   ef10_nvram_partn_unlock(enp, partn);
+   ef10_nvram_partn_unlock(enp, partn, NULL);
 fail3:
EFSYS_PROBE(fail3);
 
@@ -2049,13 +2049,16 @@ fail1:
__checkReturn   efx_rc_t
 ef10_nvram_partn_unlock(
__inefx_nic_t *enp,
-   __inuint32_t partn)
+   __inuint32_t partn,
+   __out_opt   uint32_t *resultp)
 {
boolean_t reboot = B_FALSE;
-   uint32_t result = 0; /* FIXME: MC_CMD_NVRAM_VERIFY_RC_UNKNOWN */
efx_rc_t rc;
 
-   rc = efx_mcdi_nvram_update_finish(enp, partn, reboot, &result);
+   if (resultp != NULL)
+   *resultp = MC_CMD_NVRAM_VERIFY_RC_UNKNOWN;
+
+   rc = efx_mcdi_nvram_update_finish(enp, partn, reboot, resultp);
if (rc != 0)
goto fail1;
 
@@ -2064,7 +2067,6 @@ ef10_nvram_partn_unlock(
 fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
-   /* FIXME: log result if verified firmware update fails */
return (rc);
 }
 
@@ -2370,7 +2372,7 @@ ef10_nvram_partn_rw_finish(
 {
efx_rc_t rc;
 
-   if ((rc = ef10_nvram_partn_unlock(enp, partn)) != 0)
+   if ((rc = ef10_nvram_partn_unlock(enp, partn, NULL)) != 0)
goto fail1;
 
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r310815 - head/sys/dev/sfxge/common

2016-12-30 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Dec 30 12:00:17 2016
New Revision: 310815
URL: https://svnweb.freebsd.org/changeset/base/310815

Log:
  sfxge(4): add functions to efx_bootcfg supporting whole partition access
  
  Expose expcfg partition layout discovery and validating buffer copy
  routines.  Needed for whole-partition expcfg operations.
  
  Submitted by:   Richard Houldsworth 
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D8970

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_bootcfg.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Dec 30 11:58:23 2016
(r310814)
+++ head/sys/dev/sfxge/common/efx.h Fri Dec 30 12:00:17 2016
(r310815)
@@ -1422,6 +1422,29 @@ efx_nvram_fini(
 
 #if EFSYS_OPT_BOOTCFG
 
+/* Report size and offset of bootcfg sector in NVRAM partition. */
+extern __checkReturn   efx_rc_t
+efx_bootcfg_sector_info(
+   __inefx_nic_t *enp,
+   __inuint32_t pf,
+   __out_opt   uint32_t *sector_countp,
+   __out   size_t *offsetp,
+   __out   size_t *max_sizep);
+
+/*
+ * Copy bootcfg sector data to a target buffer which may differ in size.
+ * Optionally corrects format errors in source buffer.
+ */
+extern efx_rc_t
+efx_bootcfg_copy_sector(
+   __inefx_nic_t *enp,
+   __inout_bcount(sector_length)
+   uint8_t *sector,
+   __insize_t sector_length,
+   __out_bcount(data_size) uint8_t *data,
+   __insize_t data_size,
+   __inboolean_t handle_format_errors);
+
 extern efx_rc_t
 efx_bootcfg_read(
__inefx_nic_t *enp,

Modified: head/sys/dev/sfxge/common/efx_bootcfg.c
==
--- head/sys/dev/sfxge/common/efx_bootcfg.c Fri Dec 30 11:58:23 2016
(r310814)
+++ head/sys/dev/sfxge/common/efx_bootcfg.c Fri Dec 30 12:00:17 2016
(r310815)
@@ -42,17 +42,24 @@ __FBSDID("$FreeBSD$");
  */
 #defineBOOTCFG_MAX_SIZE 0x1000
 
+/* Medford per-PF bootcfg sector */
+#defineBOOTCFG_PER_PF   0x800
+#defineBOOTCFG_PF_COUNT 16
+
 #defineDHCP_END ((uint8_t)0xff)
 #defineDHCP_PAD ((uint8_t)0)
 
 
-/* Report size and offset of bootcfg sector in NVRAM partition. */
-static __checkReturn   efx_rc_t
-efx_bootcfg_sector(
+/* Report the layout of bootcfg sectors in NVRAM partition. */
+   __checkReturn   efx_rc_t
+efx_bootcfg_sector_info(
__inefx_nic_t *enp,
+   __inuint32_t pf,
+   __out_opt   uint32_t *sector_countp,
__out   size_t *offsetp,
__out   size_t *max_sizep)
 {
+   uint32_t count;
size_t max_size;
size_t offset;
int rc;
@@ -62,6 +69,7 @@ efx_bootcfg_sector(
case EFX_FAMILY_SIENA:
max_size = BOOTCFG_MAX_SIZE;
offset = 0;
+   count = 1;
break;
 #endif /* EFSYS_OPT_SIENA */
 
@@ -69,16 +77,20 @@ efx_bootcfg_sector(
case EFX_FAMILY_HUNTINGTON:
max_size = BOOTCFG_MAX_SIZE;
offset = 0;
+   count = 1;
break;
 #endif /* EFSYS_OPT_HUNTINGTON */
 
 #if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD: {
-   efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
-
/* Shared partition (array indexed by PF) */
-   max_size = 0x0800;
-   offset = max_size * encp->enc_pf;
+   max_size = BOOTCFG_PER_PF;
+   count = BOOTCFG_PF_COUNT;
+   if (pf >= count) {
+   rc = EINVAL;
+   goto fail2;
+   }
+   offset = max_size * pf;
break;
}
 #endif /* EFSYS_OPT_MEDFORD */
@@ -90,11 +102,17 @@ efx_bootcfg_sector(
}
EFSYS_ASSERT3U(max_size, <=, BOOTCFG_MAX_SIZE);
 
+   if (sector_countp != NULL)
+   *sector_countp = count;
*offsetp = offset;
*max_sizep = max_size;
 
return (0);
 
+#if EFSYS_OPT_MEDFORD
+fail2:
+   EFSYS_PROBE(fail2);
+#endif
 fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
@@ -104,7 +122,7 @@ fail1:
 static __checkReturn   uint8_t
 efx_bootcfg_csum(
__inefx_nic_t *enp,
-   __in_bcount(size)   caddr_t data,
+   __in_bcount(size)   uint8_t const *data,
__insize_t size)
 {
_NOTE(ARGUNUSED(enp))
@@ -120,7 +

svn commit: r310816 - head/sys/dev/sfxge/common

2016-12-30 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Dec 30 12:02:16 2016
New Revision: 310816
URL: https://svnweb.freebsd.org/changeset/base/310816

Log:
  sfxge(4): fix efx_filter_supported_filters API
  
  The previous API had various problems, including the length of the
  caller provided buffer not being specified, no means being available
  to discover how big the buffer needs to be, and a lack of clarity of
  what the resulting list contains.
  
  To fix it:
  - add the buffer length as a parameter
  - if the provided buffer is too short, fail with ENOSPC and return the
required length
  - ensure that the list contents are valid and add comments
describing it
  
  It is safe to change this API as, unsuprisingly, it has no users.
  
  Submitted by:   Mark Spender 
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision:  https://reviews.freebsd.org/D8971

Modified:
  head/sys/dev/sfxge/common/ef10_filter.c
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_filter.c
  head/sys/dev/sfxge/common/efx_impl.h

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Fri Dec 30 12:00:17 2016
(r310815)
+++ head/sys/dev/sfxge/common/ef10_filter.c Fri Dec 30 12:02:16 2016
(r310816)
@@ -871,13 +871,16 @@ fail1:
 
 static __checkReturn   efx_rc_t
 efx_mcdi_get_parser_disp_info(
-   __inefx_nic_t *enp,
-   __out   uint32_t *list,
-   __out   size_t *length)
+   __inefx_nic_t *enp,
+   __out_ecount(buffer_length) uint32_t *buffer,
+   __insize_t buffer_length,
+   __out   size_t *list_lengthp)
 {
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_GET_PARSER_DISP_INFO_IN_LEN,
MC_CMD_GET_PARSER_DISP_INFO_OUT_LENMAX)];
+   size_t matches_count;
+   size_t list_size;
efx_rc_t rc;
 
(void) memset(payload, 0, sizeof (payload));
@@ -897,25 +900,41 @@ efx_mcdi_get_parser_disp_info(
goto fail1;
}
 
-   *length = MCDI_OUT_DWORD(req,
+   matches_count = MCDI_OUT_DWORD(req,
GET_PARSER_DISP_INFO_OUT_NUM_SUPPORTED_MATCHES);
 
if (req.emr_out_length_used <
-   MC_CMD_GET_PARSER_DISP_INFO_OUT_LEN(*length)) {
+   MC_CMD_GET_PARSER_DISP_INFO_OUT_LEN(matches_count)) {
rc = EMSGSIZE;
goto fail2;
}
 
-   memcpy(list,
-   MCDI_OUT2(req,
-   uint32_t,
-   GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES),
-   (*length) * sizeof (uint32_t));
+   *list_lengthp = matches_count;
+
+   if (buffer_length < matches_count) {
+   rc = ENOSPC;
+   goto fail3;
+   }
+
+   /*
+* Check that the elements in the list in the MCDI response are the size
+* we expect, so we can just copy them directly. Any conversion of the
+* flags is handled by the caller.
+*/
EFX_STATIC_ASSERT(sizeof (uint32_t) ==
MC_CMD_GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES_LEN);
 
+   list_size = matches_count *
+   MC_CMD_GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES_LEN;
+   memcpy(buffer,
+   MCDI_OUT2(req, uint32_t,
+   GET_PARSER_DISP_INFO_OUT_SUPPORTED_MATCHES),
+   list_size);
+
return (0);
 
+fail3:
+   EFSYS_PROBE(fail3);
 fail2:
EFSYS_PROBE(fail2);
 fail1:
@@ -926,14 +945,55 @@ fail1:
 
__checkReturn   efx_rc_t
 ef10_filter_supported_filters(
-   __inefx_nic_t *enp,
-   __out   uint32_t *list,
-   __out   size_t *length)
+   __inefx_nic_t *enp,
+   __out_ecount(buffer_length) uint32_t *buffer,
+   __insize_t buffer_length,
+   __out   size_t *list_lengthp)
 {
-   efx_rc_t rc;
 
-   if ((rc = efx_mcdi_get_parser_disp_info(enp, list, length)) != 0)
+   size_t mcdi_list_length;
+   size_t list_length;
+   uint32_t i;
+   efx_rc_t rc;
+   uint32_t all_filter_flags =
+   (EFX_FILTER_MATCH_REM_HOST | EFX_FILTER_MATCH_LOC_HOST |
+   EFX_FILTER_MATCH_REM_MAC | EFX_FILTER_MATCH_REM_PORT |
+   EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_PORT |
+   EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_INNER_VID |
+   EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_IP_PROTO |
+   EFX_FILTER_MATCH_UNKNOWN_MCAST_DST |
+   EFX_FILTER_MATCH_UNKNOWN_UCAST_DST);
+
+   rc = efx_mcdi_get_parser_disp_info(enp, buffer, buffer_length,
+   &mcdi_list_length);
+   if (rc != 0) {
+ 

svn commit: r310817 - in head/sys: conf dev/sfxge/common modules/sfxge

2016-12-30 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Dec 30 12:06:55 2016
New Revision: 310817
URL: https://svnweb.freebsd.org/changeset/base/310817

Log:
  sfxge(4): remove obsolete Wake-On-LAN support
  
  Wake-on-lan is not supported in production on any of our adapters, as
  they don't have the required AUX power connector. (It's possible that
  AUX power is supplied to some of our ALOM or mezz adapters, but if so
  then we've never implemented or tested WoL support.)
  
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D8972

Deleted:
  head/sys/dev/sfxge/common/efx_wol.c
Modified:
  head/sys/conf/files.amd64
  head/sys/dev/sfxge/common/efsys.h
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_check.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_nic.c
  head/sys/modules/sfxge/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Fri Dec 30 12:02:16 2016(r310816)
+++ head/sys/conf/files.amd64   Fri Dec 30 12:06:55 2016(r310817)
@@ -383,7 +383,6 @@ dev/sfxge/common/efx_rx.c   optionalsfxge
 dev/sfxge/common/efx_sram.coptionalsfxge pci
 dev/sfxge/common/efx_tx.c  optionalsfxge pci
 dev/sfxge/common/efx_vpd.c optionalsfxge pci
-dev/sfxge/common/efx_wol.c optionalsfxge pci
 dev/sfxge/common/hunt_nic.coptionalsfxge pci
 dev/sfxge/common/mcdi_mon.coptionalsfxge pci
 dev/sfxge/common/medford_nic.c optionalsfxge pci

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Fri Dec 30 12:02:16 2016
(r310816)
+++ head/sys/dev/sfxge/common/efsys.h   Fri Dec 30 12:06:55 2016
(r310817)
@@ -266,7 +266,6 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, b
 #defineEFSYS_OPT_BOOTCFG 0
 
 #defineEFSYS_OPT_DIAG 0
-#defineEFSYS_OPT_WOL 1
 #defineEFSYS_OPT_RX_SCALE 1
 #defineEFSYS_OPT_QSTATS 1
 #defineEFSYS_OPT_FILTER 1

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Dec 30 12:02:16 2016
(r310816)
+++ head/sys/dev/sfxge/common/efx.h Fri Dec 30 12:06:55 2016
(r310817)
@@ -1075,7 +1075,6 @@ efx_bist_stop(
 #defineEFX_FEATURE_LFSR_HASH_INSERT0x0002
 #defineEFX_FEATURE_LINK_EVENTS 0x0004
 #defineEFX_FEATURE_PERIODIC_MAC_STATS  0x0008
-#defineEFX_FEATURE_WOL 0x0010
 #defineEFX_FEATURE_MCDI0x0020
 #defineEFX_FEATURE_LOOKAHEAD_SPLIT 0x0040
 #defineEFX_FEATURE_MAC_HEADER_FILTERS  0x0080
@@ -1459,87 +1458,6 @@ efx_bootcfg_write(
 
 #endif /* EFSYS_OPT_BOOTCFG */
 
-#if EFSYS_OPT_WOL
-
-typedef enum efx_wol_type_e {
-   EFX_WOL_TYPE_INVALID,
-   EFX_WOL_TYPE_MAGIC,
-   EFX_WOL_TYPE_BITMAP,
-   EFX_WOL_TYPE_LINK,
-   EFX_WOL_NTYPES,
-} efx_wol_type_t;
-
-typedef enum efx_lightsout_offload_type_e {
-   EFX_LIGHTSOUT_OFFLOAD_TYPE_INVALID,
-   EFX_LIGHTSOUT_OFFLOAD_TYPE_ARP,
-   EFX_LIGHTSOUT_OFFLOAD_TYPE_NS,
-} efx_lightsout_offload_type_t;
-
-#defineEFX_WOL_BITMAP_MASK_SIZE(48)
-#defineEFX_WOL_BITMAP_VALUE_SIZE   (128)
-
-typedef union efx_wol_param_u {
-   struct {
-   uint8_t mac_addr[6];
-   } ewp_magic;
-   struct {
-   uint8_t mask[EFX_WOL_BITMAP_MASK_SIZE];   /* 1 bit per byte */
-   uint8_t value[EFX_WOL_BITMAP_VALUE_SIZE]; /* value to match */
-   uint8_t value_len;
-   } ewp_bitmap;
-} efx_wol_param_t;
-
-typedef union efx_lightsout_offload_param_u {
-   struct {
-   uint8_t mac_addr[6];
-   uint32_t ip;
-   } elop_arp;
-   struct {
-   uint8_t mac_addr[6];
-   uint32_t solicited_node[4];
-   uint32_t ip[4];
-   } elop_ns;
-} efx_lightsout_offload_param_t;
-
-extern __checkReturn   efx_rc_t
-efx_wol_init(
-   __inefx_nic_t *enp);
-
-extern __checkReturn   efx_rc_t
-efx_wol_filter_clear(
-   __inefx_nic_t *enp);
-
-extern __checkReturn   efx_rc_t
-efx_wol_filter_add(
-   __inefx_nic_t *enp,
-   __inefx_wol_type_t type,
-   __inefx_wol_param_t *paramp,
-   __out   uint32_t *filter_idp);
-
-extern __checkReturn   efx_rc_t
-efx_wol_filter_remove(
-   __inefx_nic_t *enp,
-   __inuint32_t filter_id);
-
-extern __checkReturn   efx_rc_t
-efx_lightsout_offload_add(
-   __inefx_nic_t *enp,
-   __inefx_lightsout_offload_type_t type,
-   __in 

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

2016-12-30 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Dec 30 12:10:15 2016
New Revision: 310818
URL: https://svnweb.freebsd.org/changeset/base/310818

Log:
  sfxge(4): support per-command MCDI timeout
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/sfxge_mcdi.c

Modified: head/sys/dev/sfxge/sfxge_mcdi.c
==
--- head/sys/dev/sfxge/sfxge_mcdi.c Fri Dec 30 12:06:55 2016
(r310817)
+++ head/sys/dev/sfxge/sfxge_mcdi.c Fri Dec 30 12:10:15 2016
(r310818)
@@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
 
 #defineSFXGE_MCDI_POLL_INTERVAL_MIN 10 /* 10us in 1us units */
 #defineSFXGE_MCDI_POLL_INTERVAL_MAX 10 /* 100ms in 1us units */
-#defineSFXGE_MCDI_WATCHDOG_INTERVAL 1000   /* 10s in 1us units */
 
 static void
 sfxge_mcdi_timeout(struct sfxge_softc *sc)
@@ -70,7 +69,7 @@ sfxge_mcdi_timeout(struct sfxge_softc *s
 }
 
 static void
-sfxge_mcdi_poll(struct sfxge_softc *sc)
+sfxge_mcdi_poll(struct sfxge_softc *sc, uint32_t timeout_us)
 {
efx_nic_t *enp;
clock_t delay_total;
@@ -87,7 +86,7 @@ sfxge_mcdi_poll(struct sfxge_softc *sc)
return;
}
 
-   if (delay_total > SFXGE_MCDI_WATCHDOG_INTERVAL) {
+   if (delay_total > timeout_us) {
aborted = efx_mcdi_request_abort(enp);
KASSERT(aborted, ("abort failed"));
sfxge_mcdi_timeout(sc);
@@ -115,6 +114,7 @@ sfxge_mcdi_execute(void *arg, efx_mcdi_r
 {
struct sfxge_softc *sc;
struct sfxge_mcdi *mcdi;
+   uint32_t timeout_us = 0;
 
sc = (struct sfxge_softc *)arg;
mcdi = &sc->mcdi;
@@ -125,8 +125,11 @@ sfxge_mcdi_execute(void *arg, efx_mcdi_r
("MCDI not initialized"));
 
/* Issue request and poll for completion. */
+   efx_mcdi_get_timeout(sc->enp, emrp, &timeout_us);
+   KASSERT(timeout_us > 0, ("MCDI timeout not initialized"));
+
efx_mcdi_request_start(sc->enp, emrp, B_FALSE);
-   sfxge_mcdi_poll(sc);
+   sfxge_mcdi_poll(sc, timeout_us);
 
SFXGE_MCDI_UNLOCK(mcdi);
 }
___
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: r310819 - head/sys/dev/sfxge/common

2016-12-30 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Dec 30 12:19:40 2016
New Revision: 310819
URL: https://svnweb.freebsd.org/changeset/base/310819

Log:
  sfxge(4): cleanup: add efsys_lock_state_t for type of state param in 
EFSYS_LOCK()
  
  This allows the common code to use the correct type for the lock state
  local variable passed to EFSYS_LOCK() and EFSYS_UNLOCK().
  
  On Windows, this allows warning supression pragmas to be removed.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days

Modified:
  head/sys/dev/sfxge/common/ef10_filter.c
  head/sys/dev/sfxge/common/efsys.h
  head/sys/dev/sfxge/common/efx_filter.c
  head/sys/dev/sfxge/common/efx_mcdi.c

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Fri Dec 30 12:10:15 2016
(r310818)
+++ head/sys/dev/sfxge/common/ef10_filter.c Fri Dec 30 12:19:40 2016
(r310819)
@@ -471,7 +471,7 @@ ef10_filter_restore(
efx_filter_spec_t *spec;
ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table;
boolean_t restoring;
-   int state;
+   efsys_lock_state_t state;
efx_rc_t rc;
 
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
@@ -546,7 +546,7 @@ ef10_filter_add_internal(
int ins_index;
boolean_t replacing = B_FALSE;
unsigned int i;
-   int state;
+   efsys_lock_state_t state;
boolean_t locked = B_FALSE;
 
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
@@ -748,7 +748,7 @@ ef10_filter_delete_internal(
efx_rc_t rc;
ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
efx_filter_spec_t *spec;
-   int state;
+   efsys_lock_state_t state;
uint32_t filter_idx = filter_id % EFX_EF10_FILTER_TBL_ROWS;
 
/*
@@ -822,7 +822,7 @@ ef10_filter_delete(
unsigned int hash;
unsigned int depth;
unsigned int i;
-   int state;
+   efsys_lock_state_t state;
boolean_t locked = B_FALSE;
 
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Fri Dec 30 12:10:15 2016
(r310818)
+++ head/sys/dev/sfxge/common/efsys.h   Fri Dec 30 12:19:40 2016
(r310819)
@@ -1094,6 +1094,8 @@ typedef struct efsys_lock_s {
 #defineSFXGE_EFSYS_LOCK_ASSERT_OWNED(_eslp)
\
mtx_assert(&(_eslp)->lock, MA_OWNED)
 
+typedef int efsys_lock_state_t;
+
 #defineEFSYS_LOCK_MAGIC0x10c4
 
 #defineEFSYS_LOCK(_lockp, _state)  
\

Modified: head/sys/dev/sfxge/common/efx_filter.c
==
--- head/sys/dev/sfxge/common/efx_filter.c  Fri Dec 30 12:10:15 2016
(r310818)
+++ head/sys/dev/sfxge/common/efx_filter.c  Fri Dec 30 12:19:40 2016
(r310819)
@@ -1047,7 +1047,7 @@ siena_filter_tbl_clear(
siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
siena_filter_tbl_t *sftp = &sfp->sf_tbl[tbl_id];
int index;
-   int state;
+   efsys_lock_state_t state;
 
EFSYS_LOCK(enp->en_eslp, state);
 
@@ -1195,7 +1195,7 @@ siena_filter_restore(
siena_filter_spec_t *spec;
efx_oword_t filter;
int filter_idx;
-   int state;
+   efsys_lock_state_t state;
uint32_t key;
efx_rc_t rc;
 
@@ -1253,7 +1253,7 @@ siena_filter_add(
efx_oword_t filter;
int filter_idx;
unsigned int depth;
-   int state;
+   efsys_lock_state_t state;
uint32_t key;
 
 
@@ -1334,7 +1334,7 @@ siena_filter_delete(
efx_oword_t filter;
int filter_idx;
unsigned int depth;
-   int state;
+   efsys_lock_state_t state;
uint32_t key;
 
EFSYS_ASSERT3P(spec, !=, NULL);

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cFri Dec 30 12:10:15 2016
(r310818)
+++ head/sys/dev/sfxge/common/efx_mcdi.cFri Dec 30 12:19:40 2016
(r310819)
@@ -183,7 +183,7 @@ efx_mcdi_new_epoch(
__inefx_nic_t *enp)
 {
efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
-   int state;
+   efsys_lock_state_t state;
 
/* Start a new epoch (allow fresh MCDI requests to succeed) */
EFSYS_LOCK(enp->en_eslp, state);
@@ -254,7 +254,7 @@ efx_mcdi_request_start(
unsigned int seq;
unsigned int xflags;
boolean_t new_epoch;
-   int state;
+   efsys_lock_state_t state;
 
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_fl

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

2016-12-30 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Dec 30 12:23:02 2016
New Revision: 310820
URL: https://svnweb.freebsd.org/changeset/base/310820

Log:
  sfxge(4): move queue size checks to after the NIC config has been populated
  
  Submitted by:   Mark Spender 
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision:  https://reviews.freebsd.org/D8974

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

Modified: head/sys/dev/sfxge/sfxge.c
==
--- head/sys/dev/sfxge/sfxge.c  Fri Dec 30 12:19:40 2016(r310819)
+++ head/sys/dev/sfxge/sfxge.c  Fri Dec 30 12:23:02 2016(r310820)
@@ -737,6 +737,16 @@ sfxge_create(struct sfxge_softc *sc)
goto fail3;
sc->enp = enp;
 
+   /* Initialize MCDI to talk to the microcontroller. */
+   DBGPRINT(sc->dev, "mcdi_init...");
+   if ((error = sfxge_mcdi_init(sc)) != 0)
+   goto fail4;
+
+   /* Probe the NIC and build the configuration data area. */
+   DBGPRINT(sc->dev, "nic_probe...");
+   if ((error = efx_nic_probe(enp)) != 0)
+   goto fail5;
+
if (!ISP2(sfxge_rx_ring_entries) ||
(sfxge_rx_ring_entries < EFX_RXQ_MINNDESCS) ||
(sfxge_rx_ring_entries > EFX_RXQ_MAXNDESCS)) {
@@ -759,16 +769,6 @@ sfxge_create(struct sfxge_softc *sc)
}
sc->txq_entries = sfxge_tx_ring_entries;
 
-   /* Initialize MCDI to talk to the microcontroller. */
-   DBGPRINT(sc->dev, "mcdi_init...");
-   if ((error = sfxge_mcdi_init(sc)) != 0)
-   goto fail4;
-
-   /* Probe the NIC and build the configuration data area. */
-   DBGPRINT(sc->dev, "nic_probe...");
-   if ((error = efx_nic_probe(enp)) != 0)
-   goto fail5;
-
SYSCTL_ADD_STRING(device_get_sysctl_ctx(dev),
  SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
  OID_AUTO, "version", CTLFLAG_RD,
@@ -861,14 +861,14 @@ fail7:
efx_nvram_fini(enp);
 
 fail6:
+fail_tx_ring_entries:
+fail_rx_ring_entries:
efx_nic_unprobe(enp);
 
 fail5:
sfxge_mcdi_fini(sc);
 
 fail4:
-fail_tx_ring_entries:
-fail_rx_ring_entries:
sc->enp = NULL;
efx_nic_destroy(enp);
SFXGE_EFSYS_LOCK_DESTROY(&sc->enp_lock);
___
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: r310821 - head/sys/vm

2016-12-30 Thread Konstantin Belousov
Author: kib
Date: Fri Dec 30 13:04:43 2016
New Revision: 310821
URL: https://svnweb.freebsd.org/changeset/base/310821

Log:
  Style.
  
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cFri Dec 30 12:23:02 2016(r310820)
+++ head/sys/vm/vm_map.cFri Dec 30 13:04:43 2016(r310821)
@@ -2927,8 +2927,8 @@ vm_map_entry_delete(vm_map_t map, vm_map
offidxstart = OFF_TO_IDX(entry->offset);
offidxend = offidxstart + count;
VM_OBJECT_WLOCK(object);
-   if (object->ref_count != 1 &&
-   ((object->flags & (OBJ_NOSPLIT|OBJ_ONEMAPPING)) == 
OBJ_ONEMAPPING ||
+   if (object->ref_count != 1 && ((object->flags & (OBJ_NOSPLIT |
+   OBJ_ONEMAPPING)) == OBJ_ONEMAPPING ||
object == kernel_object || object == kmem_object)) {
vm_object_collapse(object);
 
@@ -2941,7 +2941,8 @@ vm_map_entry_delete(vm_map_t map, vm_map
vm_object_page_remove(object, offidxstart, offidxend,
OBJPR_NOTMAPPED);
if (object->type == OBJT_SWAP)
-   swap_pager_freespace(object, offidxstart, 
count);
+   swap_pager_freespace(object, offidxstart,
+   count);
if (offidxend >= object->size &&
offidxstart < object->size) {
size1 = object->size;
@@ -2949,8 +2950,9 @@ vm_map_entry_delete(vm_map_t map, vm_map
if (object->cred != NULL) {
size1 -= object->size;
KASSERT(object->charge >= ptoa(size1),
-   ("vm_map_entry_delete: 
object->charge < 0"));
-   swap_release_by_cred(ptoa(size1), 
object->cred);
+   ("object %p charge < 0", object));
+   swap_release_by_cred(ptoa(size1),
+   object->cred);
object->charge -= ptoa(size1);
}
}
@@ -3168,13 +3170,15 @@ vm_map_copy_entry(
if ((src_object = src_entry->object.vm_object) != NULL) {
VM_OBJECT_WLOCK(src_object);
charged = ENTRY_CHARGED(src_entry);
-   if ((src_object->handle == NULL) &&
-   (src_object->type == OBJT_DEFAULT ||
-src_object->type == OBJT_SWAP)) {
+   if (src_object->handle == NULL &&
+   (src_object->type == OBJT_DEFAULT ||
+   src_object->type == OBJT_SWAP)) {
vm_object_collapse(src_object);
-   if ((src_object->flags & 
(OBJ_NOSPLIT|OBJ_ONEMAPPING)) == OBJ_ONEMAPPING) {
+   if ((src_object->flags & (OBJ_NOSPLIT |
+   OBJ_ONEMAPPING)) == OBJ_ONEMAPPING) {
vm_object_split(src_entry);
-   src_object = 
src_entry->object.vm_object;
+   src_object =
+   src_entry->object.vm_object;
}
}
vm_object_reference_locked(src_object);
@@ -3201,8 +3205,10 @@ vm_map_copy_entry(
*fork_charge += size;
}
}
-   src_entry->eflags |= 
(MAP_ENTRY_COW|MAP_ENTRY_NEEDS_COPY);
-   dst_entry->eflags |= 
(MAP_ENTRY_COW|MAP_ENTRY_NEEDS_COPY);
+   src_entry->eflags |= MAP_ENTRY_COW |
+   MAP_ENTRY_NEEDS_COPY;
+   dst_entry->eflags |= MAP_ENTRY_COW |
+   MAP_ENTRY_NEEDS_COPY;
dst_entry->offset = src_entry->offset;
if (src_entry->eflags & MAP_ENTRY_VN_WRITECNT) {
/*
@@ -3825,10 +3831,10 @@ Retry:
rv = KERN_NO_SPACE;
/* Grow the underlying object if applicable. */
else if (stack_entry->object.vm_object == NULL ||
-vm_object_coalesce(stack_entry->object.vm_object,
-stack_entry->offset,
-(vm_size_t)(stack_entry->end - stack_entry->start),
- 

Re: svn commit: r310789 - head/lib/libpam/static_libpam

2016-12-30 Thread Ed Maste
On 29 December 2016 at 19:59, Ravi Pokala  wrote:
>
> I'm a little confused - the original version had to have had a compile-only 
> step to generate the object first, before running the link-only operation 
> against the object. The new code replaces the link-only operation with a 
> compile+link operation. Shouldn't the pre-existing compile-only operation be 
> removed, since the new compile+link operation supersedes it?

Hi Ravi,

This change:

>> - ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC}
>> + ${CC} -nostdlib ${CFLAGS} -o ${.TARGET} -r -Wl,--whole-archive 
>> ${.ALLSRC}

is not actually compiling, it's just invoking the compiler driver to
in turn invoke the linker. The input in ${.ALLSRC} is still a
collection of object files.
___
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: r310822 - head/sys/dev/netmap

2016-12-30 Thread Adrian Chadd
Author: adrian
Date: Fri Dec 30 14:47:46 2016
New Revision: 310822
URL: https://svnweb.freebsd.org/changeset/base/310822

Log:
  [netmap] fix locking regressions
  
  * Firmware oriented NICs may need to sleep in their configuration paths.
Use RLOCK instead of WLOCK to allow this to again occur.
  
This fixes netmap on cxgbe.
  
  * Change the worker lock to a normal mutex rather than a spin lock.
Drivers shouldn't be doing netmap work from the fast interrupt
handlers, so it's not required to be a spinlock.
  
  Submitted by: luigi, Vincenzo Maffione 
  Reviewed by:  jhb

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

Modified: head/sys/dev/netmap/netmap_freebsd.c
==
--- head/sys/dev/netmap/netmap_freebsd.cFri Dec 30 13:04:43 2016
(r310821)
+++ head/sys/dev/netmap/netmap_freebsd.cFri Dec 30 14:47:46 2016
(r310822)
@@ -92,7 +92,7 @@ nm_os_selinfo_uninit(NM_SELINFO_T *si)
 void
 nm_os_ifnet_lock(void)
 {
-   IFNET_WLOCK();
+   IFNET_RLOCK();
 }
 
 void
@@ -1090,8 +1090,8 @@ nm_kthread_worker(void *data)
continue;
} else if (nmk->run) {
/* wait on event with one second timeout */
-   msleep_spin((void *)(uintptr_t)ctx->cfg.wchan,
-   &nmk->worker_lock, "nmk_ev", hz);
+   msleep((void *)(uintptr_t)ctx->cfg.wchan,
+   &nmk->worker_lock, 0, "nmk_ev", hz);
nmk->scheduled++;
}
mtx_unlock(&nmk->worker_lock);
@@ -1122,7 +1122,7 @@ nm_os_kthread_create(struct nm_kthread_c
if (!nmk)
return NULL;
 
-   mtx_init(&nmk->worker_lock, "nm_kthread lock", NULL, MTX_SPIN);
+   mtx_init(&nmk->worker_lock, "nm_kthread lock", NULL, MTX_DEF);
nmk->worker_ctx.worker_fn = cfg->worker_fn;
nmk->worker_ctx.worker_private = cfg->worker_private;
nmk->worker_ctx.type = cfg->type;
___
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: r310823 - head/lib/libfetch

2016-12-30 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Dec 30 14:54:54 2016
New Revision: 310823
URL: https://svnweb.freebsd.org/changeset/base/310823

Log:
  Fix inverted loop condition which broke multi-line responses to CONNECT.
  
  PR:   194483
  Submitted by: Miłosz Kaniewski 
  MFC after:1 week

Modified:
  head/lib/libfetch/http.c

Modified: head/lib/libfetch/http.c
==
--- head/lib/libfetch/http.cFri Dec 30 14:47:46 2016(r310822)
+++ head/lib/libfetch/http.cFri Dec 30 14:54:54 2016(r310823)
@@ -1432,7 +1432,7 @@ http_connect(struct url *URL, struct url
default:
/* ignore */ ;
}
-   } while (h < hdr_end);
+   } while (h > hdr_end);
}
if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 &&
fetch_ssl(conn, URL, verbose) == -1) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r310824 - head/sys/dev/xdma

2016-12-30 Thread Ruslan Bukin
Author: br
Date: Fri Dec 30 16:06:05 2016
New Revision: 310824
URL: https://svnweb.freebsd.org/changeset/base/310824

Log:
  o Fix unlocking.
  o Fix types for ds_addr/ds_len.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/xdma/xdma.c
  head/sys/dev/xdma/xdma.h

Modified: head/sys/dev/xdma/xdma.c
==
--- head/sys/dev/xdma/xdma.cFri Dec 30 14:54:54 2016(r310823)
+++ head/sys/dev/xdma/xdma.cFri Dec 30 16:06:05 2016(r310824)
@@ -412,7 +412,7 @@ xdma_prep_memcpy(xdma_channel_t *xchan, 
if (ret != 0) {
device_printf(xdma->dev,
"%s: Can't prepare memcpy transfer.\n", __func__);
-   XDMA_UNLOCK();
+   XCHAN_UNLOCK(xchan);
 
return (-1);
}
@@ -460,7 +460,8 @@ xdma_prep_cyclic(xdma_channel_t *xchan, 
if (ret != 0) {
device_printf(xdma->dev,
"%s: Can't prepare cyclic transfer.\n", __func__);
-   XDMA_UNLOCK();
+   XCHAN_UNLOCK(xchan);
+
return (-1);
}
 

Modified: head/sys/dev/xdma/xdma.h
==
--- head/sys/dev/xdma/xdma.hFri Dec 30 14:54:54 2016(r310823)
+++ head/sys/dev/xdma/xdma.hFri Dec 30 16:06:05 2016(r310824)
@@ -77,8 +77,8 @@ struct xdma_channel_config {
 typedef struct xdma_channel_config xdma_config_t;
 
 struct xdma_descriptor {
-   uintptr_t   ds_addr;
-   uint32_tds_len;
+   bus_addr_t  ds_addr;
+   bus_size_t  ds_len;
 };
 
 typedef struct xdma_descriptor xdma_descriptor_t;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r310828 - head/sys/dev/xdma

2016-12-30 Thread Ruslan Bukin
Author: br
Date: Fri Dec 30 16:26:54 2016
New Revision: 310828
URL: https://svnweb.freebsd.org/changeset/base/310828

Log:
  Add parenthesis.
  
  Noticed by:   hps
  Sponsored by: DARPA, AFRL

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

Modified: head/sys/dev/xdma/xdma.c
==
--- head/sys/dev/xdma/xdma.cFri Dec 30 16:23:13 2016(r310827)
+++ head/sys/dev/xdma/xdma.cFri Dec 30 16:26:54 2016(r310828)
@@ -73,9 +73,9 @@ static struct mtx xdma_mtx;
 /*
  * Per channel locks.
  */
-#defineXCHAN_LOCK(xchan)   mtx_lock(&xchan->mtx_lock)
-#defineXCHAN_UNLOCK(xchan) mtx_unlock(&xchan->mtx_lock)
-#defineXCHAN_ASSERT_LOCKED(xchan)  mtx_assert(&xchan->mtx_lock, 
MA_OWNED)
+#defineXCHAN_LOCK(xchan)   mtx_lock(&(xchan)->mtx_lock)
+#defineXCHAN_UNLOCK(xchan) mtx_unlock(&(xchan)->mtx_lock)
+#defineXCHAN_ASSERT_LOCKED(xchan)  mtx_assert(&(xchan)->mtx_lock, 
MA_OWNED)
 
 /*
  * Allocate virtual xDMA channel.
___
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: r310829 - head/sys/conf

2016-12-30 Thread Alexander Kabaev
Author: kan
Date: Fri Dec 30 17:12:41 2016
New Revision: 310829
URL: https://svnweb.freebsd.org/changeset/base/310829

Log:
  Restore status quo: mips64 does not need subr_sfbuf.c
  
  Reported by: br

Modified:
  head/sys/conf/files.mips

Modified: head/sys/conf/files.mips
==
--- head/sys/conf/files.mipsFri Dec 30 16:26:54 2016(r310828)
+++ head/sys/conf/files.mipsFri Dec 30 17:12:41 2016(r310829)
@@ -52,7 +52,8 @@ kern/kern_clocksource.c   standard
 kern/link_elf_obj.cstandard
 kern/subr_busdma_bufalloc.cstandard
 kern/subr_dummy_vdso_tc.c  standard
-kern/subr_sfbuf.c  standard
+kern/subr_sfbuf.c  optionalmips | mipsel | mipsn32
+kern/subr_sfbuf.c  optionalmipshf | mipselhf
 
 # gcc/clang runtime
 libkern/ffsl.c standard
___
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: r310834 - head/sys/vm

2016-12-30 Thread Konstantin Belousov
Author: kib
Date: Fri Dec 30 17:37:06 2016
New Revision: 310834
URL: https://svnweb.freebsd.org/changeset/base/310834

Log:
  Assert that the pages found on the object queue by vm_page_next() and
  vm_page_prev() have correct ownership.
  
  In collaboration with:alc
  Sponsored by: The FreeBSD Foundation (kib)
  MFC after:1 week

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Fri Dec 30 17:36:08 2016(r310833)
+++ head/sys/vm/vm_page.c   Fri Dec 30 17:37:06 2016(r310834)
@@ -1328,9 +1328,11 @@ vm_page_next(vm_page_t m)
vm_page_t next;
 
VM_OBJECT_ASSERT_LOCKED(m->object);
-   if ((next = TAILQ_NEXT(m, listq)) != NULL &&
-   next->pindex != m->pindex + 1)
-   next = NULL;
+   if ((next = TAILQ_NEXT(m, listq)) != NULL) {
+   MPASS(next->object == m->object);
+   if (next->pindex != m->pindex + 1)
+   next = NULL;
+   }
return (next);
 }
 
@@ -1346,9 +1348,11 @@ vm_page_prev(vm_page_t m)
vm_page_t prev;
 
VM_OBJECT_ASSERT_LOCKED(m->object);
-   if ((prev = TAILQ_PREV(m, pglist, listq)) != NULL &&
-   prev->pindex != m->pindex - 1)
-   prev = NULL;
+   if ((prev = TAILQ_PREV(m, pglist, listq)) != NULL) {
+   MPASS(prev->object == m->object);
+   if (prev->pindex != m->pindex - 1)
+   prev = NULL;
+   }
return (prev);
 }
 
___
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: r310840 - in head: lib/clang/libllvm usr.bin/clang

2016-12-30 Thread Dimitry Andric
Author: dim
Date: Fri Dec 30 18:00:31 2016
New Revision: 310840
URL: https://svnweb.freebsd.org/changeset/base/310840

Log:
  Reapply 310775, now it also builds correctly if lldb is disabled:
  
  Move llvm-objdump from CLANG_EXTRAS to installed by default
  
  We currently install three tools from binutils 2.17.50: as, ld, and
  objdump. Work is underway to migrate to a permissively-licensed
  tool-chain, with one goal being the retirement of binutils 2.17.50.
  
  LLVM's llvm-objdump is intended to be compatible with GNU objdump
  although it is currently missing some options and may have formatting
  differences. Enable it by default for testing and further investigation.
  It may later be changed to install as /usr/bin/objdump, it becomes a
  fully viable replacement.
  
  Reviewed by:  emaste
  Differential Revision:https://reviews.freebsd.org/D8879

Modified:
  head/lib/clang/libllvm/Makefile
  head/usr.bin/clang/Makefile

Modified: head/lib/clang/libllvm/Makefile
==
--- head/lib/clang/libllvm/Makefile Fri Dec 30 17:57:14 2016
(r310839)
+++ head/lib/clang/libllvm/Makefile Fri Dec 30 18:00:31 2016
(r310840)
@@ -308,24 +308,24 @@ SRCS_MIN+=DebugInfo/CodeView/TypeRecord
 SRCS_MIN+= DebugInfo/CodeView/TypeRecordBuilder.cpp
 SRCS_MIN+= DebugInfo/CodeView/TypeStreamMerger.cpp
 SRCS_MIN+= DebugInfo/CodeView/TypeTableBuilder.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFAcceleratorTable.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFCompileUnit.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFContext.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFDebugAbbrev.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFDebugArangeSet.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFDebugAranges.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFDebugFrame.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFDebugLine.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFDebugLoc.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFDebugMacro.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFDebugRangeList.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFFormValue.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFTypeUnit.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFUnit.cpp
-SRCS_EXT+= DebugInfo/DWARF/DWARFUnitIndex.cpp
-SRCS_EXT+= DebugInfo/DWARF/SyntaxHighlighting.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFAcceleratorTable.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFCompileUnit.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFContext.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFDebugAbbrev.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFDebugArangeSet.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFDebugAranges.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFDebugFrame.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFDebugLine.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFDebugLoc.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFDebugMacro.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFDebugRangeList.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFFormValue.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFTypeUnit.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFUnit.cpp
+SRCS_MIW+= DebugInfo/DWARF/DWARFUnitIndex.cpp
+SRCS_MIW+= DebugInfo/DWARF/SyntaxHighlighting.cpp
 SRCS_EXT+= DebugInfo/PDB/GenericError.cpp
 SRCS_EXT+= DebugInfo/PDB/PDB.cpp
 SRCS_EXT+= DebugInfo/PDB/PDBContext.cpp
@@ -484,10 +484,10 @@ SRCS_MIN+=MC/MCCodeEmitter.cpp
 SRCS_MIN+= MC/MCCodeView.cpp
 SRCS_MIN+= MC/MCContext.cpp
 SRCS_XDL+= MC/MCDisassembler/Disassembler.cpp
-SRCS_XDB+= MC/MCDisassembler/MCDisassembler.cpp
-SRCS_XDB+= MC/MCDisassembler/MCExternalSymbolizer.cpp
+SRCS_XDW+= MC/MCDisassembler/MCDisassembler.cpp
+SRCS_XDW+= MC/MCDisassembler/MCExternalSymbolizer.cpp
 SRCS_MIN+= MC/MCDisassembler/MCRelocationInfo.cpp
-SRCS_XDB+= MC/MCDisassembler/MCSymbolizer.cpp
+SRCS_XDW+= MC/MCDisassembler/MCSymbolizer.cpp
 SRCS_MIN+= MC/MCDwarf.cpp
 SRCS_MIN+= MC/MCELFObjectTargetWriter.cpp
 SRCS_MIN+= MC/MCELFStreamer.cpp
@@ -698,8 +698,8 @@ SRCS_MIN+=  Target/AArch64/AArch64TargetM
 SRCS_MIN+= Target/AArch64/AArch64TargetObjectFile.cpp
 SRCS_MIN+= Target/AArch64/AArch64TargetTransformInfo.cpp
 SRCS_MIN+= Target/AArch64/AsmParser/AArch64AsmParser.cpp
-SRCS_XDB+= Target/AArch64/Disassembler/AArch64Disassembler.cpp
-SRCS_XDB+= Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp
+SRCS_XDW+= Target/AArch64/Disassembler/AArch64Disassembler.cpp
+SRCS_XDW+= Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp
 SRCS_MIN+= Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
 SRCS_MIN+= Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
 SRCS_MIN+= Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
@@ -760,7 +760,7 @@ SRCS_MIN+=  Target/ARM/Thumb2InstrInfo.cp
 SRCS_M

svn commit: r310845 - head/sys/boot/i386/common

2016-12-30 Thread Toomas Soome
Author: tsoome
Date: Fri Dec 30 18:21:52 2016
New Revision: 310845
URL: https://svnweb.freebsd.org/changeset/base/310845

Log:
  boot2 will deadlock if extended keys are used on text input
  
  The boot2 family of bootblocks (zfsboot/gptzfsboot) are using separate
  implementation if keyboard reading code, which has deadlock case when
  extended key (arrows etc) are pressed.
  
  The problem is about avoiding the noise from some systems, generating
  false key events with scan code 1 and ascii code 00, so the code
  does attempt to filter such cases out. Unfortunately the extended keys
  also set ascii 0, and therefore the pressed key event is ignored and
  the keypress is never read, resulting in infinite loop.
  
  This update is moving the check to keyhit() function and is allowing
  the rest of the code to process the extended keys.
  
  Reviewed by:  bapt, allanjude
  Approved by:  allanjude (mentor)
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D8608

Modified:
  head/sys/boot/i386/common/cons.c

Modified: head/sys/boot/i386/common/cons.c
==
--- head/sys/boot/i386/common/cons.cFri Dec 30 18:17:44 2016
(r310844)
+++ head/sys/boot/i386/common/cons.cFri Dec 30 18:21:52 2016
(r310845)
@@ -65,18 +65,17 @@ int
 getc(int fn)
 {
 
-   /*
-* The extra comparison against zero is an attempt to work around
-* what appears to be a bug in QEMU and Bochs. Both emulators
-* sometimes report a key-press with scancode one and ascii zero
-* when no such key is pressed in reality. As far as I can tell,
-* this only happens shortly after a reboot.
-*/
v86.ctl = V86_FLAGS;
v86.addr = 0x16;
v86.eax = fn << 8;
v86int();
-   return fn == 0 ? v86.eax & 0xff : (!V86_ZR(v86.efl) && (v86.eax & 
0xff));
+
+   if (fn == 0)
+   return (v86.eax);
+
+   if (V86_ZR(v86.efl))
+   return (0);
+   return (v86.eax);
 }
 
 int
@@ -106,14 +105,22 @@ getchar(void)
 int
 keyhit(unsigned int secs)
 {
-   uint32_t t0, t1;
+   uint32_t t0, t1, c;
 
if (OPT_CHECK(RBX_NOINTR))
return (0);
secs *= SECOND;
t0 = 0;
for (;;) {
-   if (xgetc(1))
+   /*
+* The extra comparison is an attempt to work around
+* what appears to be a bug in QEMU and Bochs. Both emulators
+* sometimes report a key-press with scancode one and ascii zero
+* when no such key is pressed in reality. As far as I can tell,
+* this only happens shortly after a reboot.
+*/
+   c = xgetc(1);
+   if (c != 0 && c != 0x0100)
return (1);
if (secs > 0) {
t1 = *(uint32_t *)PTOV(0x46c);
@@ -134,9 +141,19 @@ getstr(char *cmdstr, size_t cmdstrsize)
 
s = cmdstr;
for (;;) {
-   switch (c = xgetc(0)) {
-   case 0:
+   c = xgetc(0);
+
+   /* Translate some extended codes. */
+   switch (c) {
+   case 0x5300:/* delete */
+   c = '\177';
break;
+   default:
+   c &= 0xff;
+   break;
+   }
+
+   switch (c) {
case '\177':
case '\b':
if (s > cmdstr) {
@@ -149,9 +166,11 @@ getstr(char *cmdstr, size_t cmdstrsize)
*s = 0;
return;
default:
-   if (s - cmdstr < cmdstrsize - 1)
-   *s++ = c;
-   putchar(c);
+   if (c >= 0x20 && c <= 0x7e) {
+   if (s - cmdstr < cmdstrsize - 1)
+   *s++ = c;
+   putchar(c);
+   }
break;
}
}
___
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: r310846 - in head/sys/contrib/ck: . include include/gcc include/gcc/aarch64 include/gcc/arm include/gcc/ppc64 include/gcc/x86_64 src

2016-12-30 Thread Olivier Houchard
Author: cognet
Date: Fri Dec 30 18:23:58 2016
New Revision: 310846
URL: https://svnweb.freebsd.org/changeset/base/310846

Log:
  Merge CK as of commit 255a47553aa5e8d0bb5f8eec63acac7f4c25a6d8, mostly
  to make sure we don't use any FP instruction.

Added:
  head/sys/contrib/ck/include/gcc/aarch64/ck_pr_llsc.h
 - copied unchanged from r310844, 
vendor-sys/ck/dist/include/gcc/aarch64/ck_pr_llsc.h
  head/sys/contrib/ck/include/gcc/aarch64/ck_pr_lse.h
 - copied unchanged from r310844, 
vendor-sys/ck/dist/include/gcc/aarch64/ck_pr_lse.h
Deleted:
  head/sys/contrib/ck/src/Makefile.in
Modified:
  head/sys/contrib/ck/FREEBSD-Xlist
  head/sys/contrib/ck/include/ck_md.h
  head/sys/contrib/ck/include/ck_pr.h
  head/sys/contrib/ck/include/gcc/aarch64/ck_pr.h
  head/sys/contrib/ck/include/gcc/arm/ck_pr.h
  head/sys/contrib/ck/include/gcc/ck_pr.h
  head/sys/contrib/ck/include/gcc/ppc64/ck_pr.h
  head/sys/contrib/ck/include/gcc/x86_64/ck_pr.h
Directory Properties:
  head/sys/contrib/ck/   (props changed)

Modified: head/sys/contrib/ck/FREEBSD-Xlist
==
--- head/sys/contrib/ck/FREEBSD-Xlist   Fri Dec 30 18:21:52 2016
(r310845)
+++ head/sys/contrib/ck/FREEBSD-Xlist   Fri Dec 30 18:23:58 2016
(r310846)
@@ -8,3 +8,4 @@
 */regressions
 */tools
 */include/ck_md.h.in
+*/src/Makefile.in

Modified: head/sys/contrib/ck/include/ck_md.h
==
--- head/sys/contrib/ck/include/ck_md.h Fri Dec 30 18:21:52 2016
(r310845)
+++ head/sys/contrib/ck/include/ck_md.h Fri Dec 30 18:23:58 2016
(r310846)
@@ -49,6 +49,10 @@
 #define CK_MD_VMA_BITS_UNKNOWN 
 #endif /* CK_MD_VMA_BITS_UNKNOWN */
 
+#ifndef CK_PR_DISABLE_DOUBLE
+#define CK_PR_DISABLE_DOUBLE
+#endif /* CK_PR_DISABLE_DOUBLE */
+
 #ifndef CK_MD_RMO
 #define CK_MD_RMO
 #endif /* CK_MD_RMO */

Modified: head/sys/contrib/ck/include/ck_pr.h
==
--- head/sys/contrib/ck/include/ck_pr.h Fri Dec 30 18:21:52 2016
(r310845)
+++ head/sys/contrib/ck/include/ck_pr.h Fri Dec 30 18:23:58 2016
(r310846)
@@ -173,7 +173,9 @@ ck_pr_rfo(const void *m)
 
 #define ck_pr_store_ptr(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), ptr)
 #define ck_pr_store_char(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), char)
+#ifndef CK_PR_DISABLE_DOUBLE
 #define ck_pr_store_double(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), double)
+#endif
 #define ck_pr_store_uint(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), uint)
 #define ck_pr_store_int(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), int)
 #define ck_pr_store_32(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), 32)
@@ -191,7 +193,9 @@ ck_pr_rfo(const void *m)
 
 #define CK_PR_LOAD_SAFE(SRC, TYPE) ck_pr_md_load_##TYPE((SRC))
 #define ck_pr_load_char(SRC) CK_PR_LOAD_SAFE((SRC), char)
+#ifndef CK_PR_DISABLE_DOUBLE
 #define ck_pr_load_double(SRC) CK_PR_LOAD_SAFE((SRC), double)
+#endif
 #define ck_pr_load_uint(SRC) CK_PR_LOAD_SAFE((SRC), uint)
 #define ck_pr_load_int(SRC) CK_PR_LOAD_SAFE((SRC), int)
 #define ck_pr_load_32(SRC) CK_PR_LOAD_SAFE((SRC), 32)
@@ -279,7 +283,8 @@ CK_PR_BIN_S(or, int, int, |)
 
 #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */
 
-#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE)
+#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \
+   !defined(CK_PR_DISABLE_DOUBLE)
 
 #ifndef CK_F_PR_ADD_DOUBLE
 #define CK_F_PR_ADD_DOUBLE
@@ -291,7 +296,7 @@ CK_PR_BIN_S(add, double, double, +)
 CK_PR_BIN_S(sub, double, double, -)
 #endif /* CK_F_PR_SUB_DOUBLE */
 
-#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */
+#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && 
!CK_PR_DISABLE_DOUBLE */
 
 #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE)
 
@@ -679,7 +684,8 @@ CK_PR_UNARY_Z_S(dec, int, int, -, 1)
 
 #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */
 
-#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE)
+#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \
+   !defined(CK_PR_DISABLE_DOUBLE)
 
 #ifndef CK_F_PR_INC_DOUBLE
 #define CK_F_PR_INC_DOUBLE
@@ -691,7 +697,7 @@ CK_PR_UNARY_S(inc, add, double, double)
 CK_PR_UNARY_S(dec, sub, double, double)
 #endif /* CK_F_PR_DEC_DOUBLE */
 
-#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */
+#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && 
!CK_PR_DISABLE_DOUBLE */
 
 #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE)
 
@@ -918,14 +924,15 @@ CK_PR_N_Z_S(int, int)
 
 #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */
 
-#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE)
+#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \
+   !defined(CK_PR_DISABLE_DOUBLE)
 
 #ifndef CK_F_PR_NEG_DOUBLE
 #define CK_F_PR_NEG_DOUBLE
 CK_PR_N_S(neg, double, double, -)
 #end

Re: svn commit: r310789 - head/lib/libpam/static_libpam

2016-12-30 Thread John Baldwin
On Thursday, December 29, 2016 09:30:52 PM Alexander Kabaev wrote:
> Author: kan
> Date: Thu Dec 29 21:30:52 2016
> New Revision: 310789
> URL: https://svnweb.freebsd.org/changeset/base/310789
> 
> Log:
>   Use compiler driver to build relocatable object
>   
>   This works better with external toolchains where LD
>   will not necessarily defailt to emulation we want.
>   Compiler driver knows better.

I think this was the case I had added the XLDFLAGS in my mips cross-building
patches for.  I'm fine with dropping the XLDFLAGS bits and depending on the
compiler driver if we think that is the better solution.

> Modified:
>   head/lib/libpam/static_libpam/Makefile
> 
> Modified: head/lib/libpam/static_libpam/Makefile
> ==
> --- head/lib/libpam/static_libpam/MakefileThu Dec 29 21:06:31 2016
> (r310788)
> +++ head/lib/libpam/static_libpam/MakefileThu Dec 29 21:30:52 2016
> (r310789)
> @@ -64,6 +64,6 @@ CLEANFILES+=openpam_static.o \
>   openpam_static_modules.o
>  
>  openpam_static_modules.o: openpam_static.o ${STATIC_MODULES}
> - ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC}
> + ${CC} -nostdlib ${CFLAGS} -o ${.TARGET} -r -Wl,--whole-archive 
> ${.ALLSRC}
>  
>  .include "${.CURDIR}/../libpam/Makefile"
> 


-- 
John Baldwin
___
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: r310847 - head/sys/netinet

2016-12-30 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Dec 30 18:46:21 2016
New Revision: 310847
URL: https://svnweb.freebsd.org/changeset/base/310847

Log:
  Harden CARP against network loops.
  
  If there is a loop in the network a CARP that is in MASTER state will see it's
  own broadcasts, which will then cause it to assume BACKUP state.  When it
  assumes BACKUP it will stop sending advertisements.  In that state it will no
  longer see advertisements and will assume MASTER...
  
  We can't catch all the cases where we are seeing our own CARP broadcast, but
  we can catch the obvious case.
  
  Submitted by: torek
  Obtained from:FreeNAS
  MFC after:2 weeks
  Sponsored by: iXsystems

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Fri Dec 30 18:23:58 2016(r310846)
+++ head/sys/netinet/ip_carp.c  Fri Dec 30 18:46:21 2016(r310847)
@@ -581,27 +581,90 @@ carp6_input(struct mbuf **mp, int *offp,
 }
 #endif /* INET6 */
 
+/*
+ * This routine should not be necessary at all, but some switches
+ * (VMWare ESX vswitches) can echo our own packets back at us,
+ * and we must ignore them or they will cause us to drop out of
+ * MASTER mode.
+ *
+ * We cannot catch all cases of network loops.  Instead, what we
+ * do here is catch any packet that arrives with a carp header
+ * with a VHID of 0, that comes from an address that is our own.
+ * These packets are by definition "from us" (even if they are from
+ * a misconfigured host that is pretending to be us).
+ *
+ * The VHID test is outside this mini-function.
+ */
+static int
+carp_source_is_self(struct mbuf *m, struct ifaddr *ifa, sa_family_t af)
+{
+   struct ip *ip4;
+   struct in_addr in4;
+   struct ip6_hdr *ip6;
+   struct in6_addr in6;
+
+   switch (af) {
+   case AF_INET:
+   ip4 = mtod(m, struct ip *);
+   in4 = ifatoia(ifa)->ia_addr.sin_addr;
+   return (in4.s_addr == ip4->ip_src.s_addr);
+
+   case AF_INET6:
+   ip6 = mtod(m, struct ip6_hdr *);
+   in6 = ifatoia6(ifa)->ia_addr.sin6_addr;
+   return (memcmp(&in6, &ip6->ip6_src, sizeof(in6)) == 0);
+
+   default:/* how did this happen? */
+   break;
+   }
+   return (0);
+}
+
 static void
 carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af)
 {
struct ifnet *ifp = m->m_pkthdr.rcvif;
-   struct ifaddr *ifa;
+   struct ifaddr *ifa, *match;
struct carp_softc *sc;
uint64_t tmp_counter;
struct timeval sc_tv, ch_tv;
+   int error;
 
-   /* verify that the VHID is valid on the receiving interface */
+   /*
+* Verify that the VHID is valid on the receiving interface.
+*
+* There should be just one match.  If there are none
+* the VHID is not valid and we drop the packet.  If
+* there are multiple VHID matches, take just the first
+* one, for compatibility with previous code.  While we're
+* scanning, check for obvious loops in the network topology
+* (these should never happen, and as noted above, we may
+* miss real loops; this is just a double-check).
+*/
IF_ADDR_RLOCK(ifp);
-   IFNET_FOREACH_IFA(ifp, ifa)
-   if (ifa->ifa_addr->sa_family == af &&
-   ifa->ifa_carp->sc_vhid == ch->carp_vhid) {
-   ifa_ref(ifa);
-   break;
-   }
+   error = 0;
+   match = NULL;
+   IFNET_FOREACH_IFA(ifp, ifa) {
+   if (match == NULL && ifa->ifa_carp != NULL &&
+   ifa->ifa_addr->sa_family == af &&
+   ifa->ifa_carp->sc_vhid == ch->carp_vhid)
+   match = ifa;
+   if (ch->carp_vhid == 0 && carp_source_is_self(m, ifa, af))
+   error = ELOOP;
+   }
+   ifa = error ? NULL : match;
+   if (ifa != NULL)
+   ifa_ref(ifa);
IF_ADDR_RUNLOCK(ifp);
 
if (ifa == NULL) {
-   CARPSTATS_INC(carps_badvhid);
+   if (error == ELOOP) {
+   CARP_DEBUG("dropping looped packet on interface %s\n",
+   ifp->if_xname);
+   CARPSTATS_INC(carps_badif); /* ??? */
+   } else {
+   CARPSTATS_INC(carps_badvhid);
+   }
m_freem(m);
return;
}
@@ -787,12 +850,41 @@ carp_send_ad_error(struct carp_softc *sc
}
 }
 
+/*
+ * Pick the best ifaddr on the given ifp for sending CARP
+ * advertisements.
+ *
+ * "Best" here is defined by ifa_preferred().  This function is much
+ * much like ifaof_ifpforaddr() except that we just use ifa_preferred().
+ *
+ * (This could be simplified to return the actual address, except that
+ * it has a d

svn commit: r310849 - head/sys/vm

2016-12-30 Thread Konstantin Belousov
Author: kib
Date: Fri Dec 30 18:55:33 2016
New Revision: 310849
URL: https://svnweb.freebsd.org/changeset/base/310849

Log:
  Fix two similar bugs in the populate vm_fault() code.
  
  If pager' populate method succeeded, but other thread raced with us
  and modified vm_map, we must unbusy all pages busied by the pager,
  before we retry the whole fault handling.  If pager instantiated more
  pages than fit into the current map entry, we must unbusy the pages
  which are clipped.
  
  Also do some refactoring, clarify comments and use more clear local
  variable names.
  
  Reported and tested by:   kargl, sub...@gmail.com (previous version)
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Fri Dec 30 18:51:56 2016(r310848)
+++ head/sys/vm/vm_fault.c  Fri Dec 30 18:55:33 2016(r310849)
@@ -304,13 +304,45 @@ vm_fault_restore_map_lock(struct faultst
fs->lookup_still_valid = true;
 }
 
+static void
+vm_fault_populate_check_page(vm_page_t m)
+{
+
+   /*
+* Check each page to ensure that the pager is obeying the
+* interface: the page must be installed in the object, fully
+* valid, and exclusively busied.
+*/
+   MPASS(m != NULL);
+   MPASS(m->valid == VM_PAGE_BITS_ALL);
+   MPASS(vm_page_xbusied(m));
+}
+
+static void
+vm_fault_populate_cleanup(vm_object_t object, vm_pindex_t first,
+vm_pindex_t last)
+{
+   vm_page_t m;
+   vm_pindex_t pidx;
+
+   VM_OBJECT_ASSERT_WLOCKED(object);
+   MPASS(first <= last);
+   for (pidx = first, m = vm_page_lookup(object, pidx);
+   pidx <= last; pidx++, m = vm_page_next(m)) {
+   vm_fault_populate_check_page(m);
+   vm_page_lock(m);
+   vm_page_deactivate(m);
+   vm_page_unlock(m);
+   vm_page_xunbusy(m);
+   }
+}
 
 static int
 vm_fault_populate(struct faultstate *fs, vm_offset_t vaddr, vm_prot_t prot,
 int fault_type, int fault_flags, boolean_t wired, vm_page_t *m_hold)
 {
vm_page_t m;
-   vm_pindex_t f_first, f_last, pidx;
+   vm_pindex_t map_first, map_last, pager_first, pager_last, pidx;
int rv;
 
MPASS(fs->object == fs->first_object);
@@ -319,8 +351,8 @@ vm_fault_populate(struct faultstate *fs,
MPASS(fs->first_object->backing_object == NULL);
MPASS(fs->lookup_still_valid);
 
-   f_first = OFF_TO_IDX(fs->entry->offset);
-   f_last = OFF_TO_IDX(fs->entry->offset + fs->entry->end -
+   pager_first = OFF_TO_IDX(fs->entry->offset);
+   pager_last = OFF_TO_IDX(fs->entry->offset + fs->entry->end -
fs->entry->start) - 1;
unlock_map(fs);
unlock_vp(fs);
@@ -334,7 +366,7 @@ vm_fault_populate(struct faultstate *fs,
 * to the driver.
 */
rv = vm_pager_populate(fs->first_object, fs->first_pindex,
-   fault_type, fs->entry->max_protection, &f_first, &f_last);
+   fault_type, fs->entry->max_protection, &pager_first, &pager_last);
 
VM_OBJECT_ASSERT_WLOCKED(fs->first_object);
if (rv == VM_PAGER_BAD) {
@@ -351,34 +383,40 @@ vm_fault_populate(struct faultstate *fs,
return (KERN_FAILURE); /* AKA SIGSEGV */
 
/* Ensure that the driver is obeying the interface. */
-   MPASS(f_first <= f_last);
-   MPASS(fs->first_pindex <= f_last);
-   MPASS(fs->first_pindex >= f_first);
-   MPASS(f_last < fs->first_object->size);
+   MPASS(pager_first <= pager_last);
+   MPASS(fs->first_pindex <= pager_last);
+   MPASS(fs->first_pindex >= pager_first);
+   MPASS(pager_last < fs->first_object->size);
 
vm_fault_restore_map_lock(fs);
-   if (fs->map->timestamp != fs->map_generation)
+   if (fs->map->timestamp != fs->map_generation) {
+   vm_fault_populate_cleanup(fs->first_object, pager_first,
+   pager_last);
return (KERN_RESOURCE_SHORTAGE); /* RetryFault */
+   }
 
-   /* Clip pager response to fit into the vm_map_entry. */
-   f_first = MAX(OFF_TO_IDX(fs->entry->offset), f_first);
-   f_last = MIN(OFF_TO_IDX(fs->entry->end - fs->entry->start +
-   fs->entry->offset), f_last);
-
-   pidx = f_first;
-   for (m = vm_page_lookup(fs->first_object, pidx); pidx <= f_last;
-   pidx++, m = vm_page_next(m)) {
-   /*
-* Check each page to ensure that the driver is
-* obeying the interface: the page must be installed
-* in the object, fully valid, and exclusively busied.
-*/
-   MPASS(m != NULL);
-   MPASS(vm_page_xbusied(m));
-   MPASS(m->valid == VM_PAGE_BITS_ALL);
-   MPASS(m->object == fs->first_object);
- 

svn commit: r310850 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys/boot/pc98/libpc98 s...

2016-12-30 Thread Toomas Soome
Author: tsoome
Date: Fri Dec 30 19:06:29 2016
New Revision: 310850
URL: https://svnweb.freebsd.org/changeset/base/310850

Log:
  dosfs support in libstand is broken since r298230
  
  Apparently the libstand dosfs optimization is a bit too optimistic
  and did introduce possible memory corruption.
  
  This patch is backing out the bad part and since this results in
  dosfs reading full blocks now, we can also remove extra offset argument
  from dv_strategy callback.
  
  The analysis of the issue and the backout patch is provided by Mikhail 
Kupchik.
  
  PR:   214423
  Submitted by: Mikhail Kupchik
  Reported by:  Mikhail Kupchik
  Reviewed by:  bapt, allanjude
  Approved by:  allanjude (mentor)
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D8644

Modified:
  head/lib/libstand/cd9660.c
  head/lib/libstand/dosfs.c
  head/lib/libstand/ext2fs.c
  head/lib/libstand/nandfs.c
  head/lib/libstand/read.c
  head/lib/libstand/stand.h
  head/lib/libstand/ufs.c
  head/lib/libstand/write.c
  head/sys/boot/common/bcache.c
  head/sys/boot/common/bootstrap.h
  head/sys/boot/common/disk.c
  head/sys/boot/common/md.c
  head/sys/boot/efi/libefi/efipart.c
  head/sys/boot/i386/libfirewire/firewire.c
  head/sys/boot/i386/libi386/bioscd.c
  head/sys/boot/i386/libi386/biosdisk.c
  head/sys/boot/i386/libi386/pxe.c
  head/sys/boot/mips/beri/loader/beri_disk_cfi.c
  head/sys/boot/mips/beri/loader/beri_disk_sdcard.c
  head/sys/boot/ofw/libofw/ofw_disk.c
  head/sys/boot/pc98/libpc98/bioscd.c
  head/sys/boot/pc98/libpc98/biosdisk.c
  head/sys/boot/powerpc/kboot/hostdisk.c
  head/sys/boot/powerpc/ps3/ps3cdrom.c
  head/sys/boot/powerpc/ps3/ps3disk.c
  head/sys/boot/uboot/lib/disk.c
  head/sys/boot/usb/storage/umass_loader.c
  head/sys/boot/userboot/userboot/host.c
  head/sys/boot/userboot/userboot/userboot_disk.c
  head/sys/boot/zfs/zfs.c

Modified: head/lib/libstand/cd9660.c
==
--- head/lib/libstand/cd9660.c  Fri Dec 30 18:55:33 2016(r310849)
+++ head/lib/libstand/cd9660.c  Fri Dec 30 19:06:29 2016(r310850)
@@ -143,7 +143,7 @@ susp_lookup_record(struct open_file *f, 
if (bcmp(sh->type, SUSP_CONTINUATION, 2) == 0) {
shc = (ISO_RRIP_CONT *)sh;
error = f->f_dev->dv_strategy(f->f_devdata, F_READ,
-   cdb2devb(isonum_733(shc->location)), 0,
+   cdb2devb(isonum_733(shc->location)),
ISO_DEFAULT_BLOCK_SIZE, susp_buffer, &read);
 
/* Bail if it fails. */
@@ -288,7 +288,7 @@ cd9660_open(const char *path, struct ope
for (bno = 16;; bno++) {
twiddle(1);
rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno),
-   0, ISO_DEFAULT_BLOCK_SIZE, buf, &read);
+   ISO_DEFAULT_BLOCK_SIZE, buf, &read);
if (rc)
goto out;
if (read != ISO_DEFAULT_BLOCK_SIZE) {
@@ -322,7 +322,7 @@ cd9660_open(const char *path, struct ope
twiddle(1);
rc = f->f_dev->dv_strategy
(f->f_devdata, F_READ,
-cdb2devb(bno + boff), 0,
+cdb2devb(bno + boff),
 ISO_DEFAULT_BLOCK_SIZE,
 buf, &read);
if (rc)
@@ -387,7 +387,7 @@ cd9660_open(const char *path, struct ope
bno = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length);
twiddle(1);
rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno),
-   0, ISO_DEFAULT_BLOCK_SIZE, buf, &read);
+   ISO_DEFAULT_BLOCK_SIZE, buf, &read);
if (rc)
goto out;
if (read != ISO_DEFAULT_BLOCK_SIZE) {
@@ -444,7 +444,7 @@ buf_read_file(struct open_file *f, char 
 
twiddle(16);
rc = f->f_dev->dv_strategy(f->f_devdata, F_READ,
-   cdb2devb(blkno), 0, ISO_DEFAULT_BLOCK_SIZE,
+   cdb2devb(blkno), ISO_DEFAULT_BLOCK_SIZE,
fp->f_buf, &read);
if (rc)
return (rc);

Modified: head/lib/libstand/dosfs.c
==
--- head/lib/libstand/dosfs.c   Fri Dec 30 18:55:33 2016(r310849)
+++ head/lib/libstand/dosfs.c   Fri Dec 30 19:06:29 2016(r310850)
@@ -154,7 +154,7 @@ static int fatcnt(DOS_FS *, u_int);
 static int fatget(DOS_FS *, u_int *);
 static int fatend(u_int, u_int);
 static int ioread(DOS_FS *, u_int, void *, u_int);
-static int ioget(struct open_file *, daddr_t, 

svn commit: r310853 - head/lib/libstand

2016-12-30 Thread Toomas Soome
Author: tsoome
Date: Fri Dec 30 20:00:41 2016
New Revision: 310853
URL: https://svnweb.freebsd.org/changeset/base/310853

Log:
  loader: nandfs calls strategy with one extra argument.
  
  The strategy argument cleanup in r310850 did miss another call to strategy(),
  and left it with extra argument.
  
  Reviewed by:  allanjude
  Approved by:  allanjude (mentor)
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D9003

Modified:
  head/lib/libstand/nandfs.c

Modified: head/lib/libstand/nandfs.c
==
--- head/lib/libstand/nandfs.c  Fri Dec 30 19:55:04 2016(r310852)
+++ head/lib/libstand/nandfs.c  Fri Dec 30 20:00:41 2016(r310853)
@@ -1045,7 +1045,7 @@ nandfs_probe_sectorsize(struct open_file
 
for (i = 512; i < (16 * 1024); i <<= 1) {
NANDFS_DEBUG("%d ", i);
-   err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 0, 0, i,
+   err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 0, i,
buffer, NULL);
 
if (err == 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: r310854 - head/sys/boot/fdt/dts/arm

2016-12-30 Thread Jared McNeill
Author: jmcneill
Date: Fri Dec 30 20:16:09 2016
New Revision: 310854
URL: https://svnweb.freebsd.org/changeset/base/310854

Log:
  Add missing reg property to usbphy node.
  
  MFC after:1 week

Modified:
  head/sys/boot/fdt/dts/arm/a83t.dtsi

Modified: head/sys/boot/fdt/dts/arm/a83t.dtsi
==
--- head/sys/boot/fdt/dts/arm/a83t.dtsi Fri Dec 30 20:00:41 2016
(r310853)
+++ head/sys/boot/fdt/dts/arm/a83t.dtsi Fri Dec 30 20:16:09 2016
(r310854)
@@ -176,6 +176,9 @@
 
usbphy: phy@01c19400 {
compatible = "allwinner,sun8i-a83t-usb-phy";
+   reg = <0x01c19400 0x2c>,
+ <0x01c1a800 0x4>,
+ <0x01c1a800 0x4>;
clocks = <&usb_clk 8>,
 <&usb_clk 9>,
 <&usb_clk 10>,
___
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: r310789 - head/lib/libpam/static_libpam

2016-12-30 Thread Ravi Pokala
-Original Message-
> From:  on behalf of Ed Maste 
> 
> Date: 2016-12-30, Friday at 07:39
> To: Ravi Pokala 
> Cc: Alexander Kabaev , "src-committ...@freebsd.org" 
> , "svn-src-...@freebsd.org" 
> , "svn-src-head@freebsd.org" 
> 
> Subject: Re: svn commit: r310789 - head/lib/libpam/static_libpam
> 
> On 29 December 2016 at 19:59, Ravi Pokala  wrote:
>>
>> I'm a little confused - the original version had to have had a compile-only 
>> step to generate the object first, before running the link-only operation 
>> against the object. The new code replaces the link-only operation with a 
>> compile+link operation. Shouldn't the pre-existing compile-only operation be 
>> removed, since the new compile+link operation supersedes it?
> 
> Hi Ravi,
> 
> This change:
> 
>>> - ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC}
>>> + ${CC} -nostdlib ${CFLAGS} -o ${.TARGET} -r -Wl,--whole-archive 
>>> ${.ALLSRC}
> 
> is not actually compiling, it's just invoking the compiler driver to
> in turn invoke the linker. The input in ${.ALLSRC} is still a
> collection of object files.

Ahhh! My knowledge of `make' is terrible, so I thought ${.ALLSRC} must have 
been referring to actual source files in some non-obvious way. I also thought 
some special flag would be needed when passing an object file to the compiler, 
rather than a source file. Combine those two, and there was my problem.

Thanks for clarifying!

-Ravi (rpokala@)


___
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: r310863 - head/usr.bin/indent

2016-12-30 Thread Piotr Pawel Stefaniak
Author: pstef
Date: Fri Dec 30 21:00:45 2016
New Revision: 310863
URL: https://svnweb.freebsd.org/changeset/base/310863

Log:
  indent(1): Avoid out of bounds access of array ps.paren_indents
  
  ps.p_l_follow can't be allowed to grow beyond maximum index of paren_indents.
  
  Approved by:  pfg (mentor)

Modified:
  head/usr.bin/indent/indent.c

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cFri Dec 30 20:48:22 2016
(r310862)
+++ head/usr.bin/indent/indent.cFri Dec 30 21:00:45 2016
(r310863)
@@ -525,7 +525,12 @@ check_type:
break;
 
case lparen:/* got a '(' or '[' */
-   ++ps.p_l_follow;/* count parens to make Healy happy */
+   /* count parens to make Healy happy */
+   if (++ps.p_l_follow == nitems(ps.paren_indents)) {
+   diag3(0, "Reached internal limit of %d unclosed parens",
+   nitems(ps.paren_indents));
+   ps.p_l_follow--;
+   }
if (ps.want_blank && *token != '[' &&
(ps.last_token != ident || proc_calls_space ||
/* offsetof (1) is never allowed a space; sizeof (2) gets
___
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: r310864 - head/sys/netinet

2016-12-30 Thread Ngie Cooper
Author: ngie
Date: Fri Dec 30 21:33:01 2016
New Revision: 310864
URL: https://svnweb.freebsd.org/changeset/base/310864

Log:
  Unbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all IPv6
  structs under the INET6 #ifdef. Similarly (even though it doesn't seem
  to affect the build), conditionalize all IPv4 structs under the INET
  #ifdef
  
  This also unbreaks the LINT-NOINET6 tinderbox target on amd64; I have not
  verified other MACHINE/TARGET pairs (e.g. armv6/arm).
  
  MFC after:2 weeks
  X-MFC with:   r310847
  Pointyhat to: jpaetzel
  Reported by:  O. Hartmann 

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Fri Dec 30 21:00:45 2016(r310863)
+++ head/sys/netinet/ip_carp.c  Fri Dec 30 21:33:01 2016(r310864)
@@ -598,23 +598,29 @@ carp6_input(struct mbuf **mp, int *offp,
 static int
 carp_source_is_self(struct mbuf *m, struct ifaddr *ifa, sa_family_t af)
 {
+#ifdef INET
struct ip *ip4;
struct in_addr in4;
+#endif
+#ifdef INET6
struct ip6_hdr *ip6;
struct in6_addr in6;
+#endif
 
switch (af) {
+#ifdef INET
case AF_INET:
ip4 = mtod(m, struct ip *);
in4 = ifatoia(ifa)->ia_addr.sin_addr;
return (in4.s_addr == ip4->ip_src.s_addr);
-
+#endif
+#ifdef INET6
case AF_INET6:
ip6 = mtod(m, struct ip6_hdr *);
in6 = ifatoia6(ifa)->ia_addr.sin6_addr;
return (memcmp(&in6, &ip6->ip6_src, sizeof(in6)) == 0);
-
-   default:/* how did this happen? */
+#endif
+   default:
break;
}
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r310865 - head/contrib/bsnmp/snmp_mibII

2016-12-30 Thread Ngie Cooper
Author: ngie
Date: Fri Dec 30 21:41:01 2016
New Revision: 310865
URL: https://svnweb.freebsd.org/changeset/base/310865

Log:
  Fix whitespace in a comment and fixing a spelling error in a comment
  
  MFC after:3 days

Modified:
  head/contrib/bsnmp/snmp_mibII/mibII.c

Modified: head/contrib/bsnmp/snmp_mibII/mibII.c
==
--- head/contrib/bsnmp/snmp_mibII/mibII.c   Fri Dec 30 21:33:01 2016
(r310864)
+++ head/contrib/bsnmp/snmp_mibII/mibII.c   Fri Dec 30 21:41:01 2016
(r310865)
@@ -1308,8 +1308,7 @@ update_ifa_info(void)
 
 /*
  * Update arp table
- *
-*/
+ */
 void
 mib_arp_update(void)
 {
@@ -1351,7 +1350,7 @@ mib_arp_update(void)
 
 
 /*
- * Intput on the routing socket.
+ * Input on the routing socket.
  */
 static void
 route_input(int fd, void *udata __unused)
___
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: r310864 - head/sys/netinet

2016-12-30 Thread Ngie Cooper (yaneurabeya)

> On Dec 30, 2016, at 13:33, Ngie Cooper  wrote:
> 
> Author: ngie
> Date: Fri Dec 30 21:33:01 2016
> New Revision: 310864
> URL: https://svnweb.freebsd.org/changeset/base/310864
> 
> Log:
>  Unbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all IPv6
>  structs under the INET6 #ifdef. Similarly (even though it doesn't seem
>  to affect the build), conditionalize all IPv4 structs under the INET
>  #ifdef
> 
>  This also unbreaks the LINT-NOINET6 tinderbox target on amd64; I have not
>  verified other MACHINE/TARGET pairs (e.g. armv6/arm).

Quick note (mostly for myself): I’m running "make tinderbox” to address 
this concern and see if I can spot other issues.
Cheers,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


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

2016-12-30 Thread Ngie Cooper (yaneurabeya)

> On Dec 30, 2016, at 13:53, Ngie Cooper (yaneurabeya)  
> wrote:
> 
>> 
>> On Dec 30, 2016, at 13:33, Ngie Cooper  wrote:
>> 
>> Author: ngie
>> Date: Fri Dec 30 21:33:01 2016
>> New Revision: 310864
>> URL: https://svnweb.freebsd.org/changeset/base/310864
>> 
>> Log:
>> Unbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all IPv6
>> structs under the INET6 #ifdef. Similarly (even though it doesn't seem
>> to affect the build), conditionalize all IPv4 structs under the INET
>> #ifdef
>> 
>> This also unbreaks the LINT-NOINET6 tinderbox target on amd64; I have not
>> verified other MACHINE/TARGET pairs (e.g. armv6/arm).
> 
>   Quick note (mostly for myself): I’m running "make tinderbox” to address 
> this concern and see if I can spot other issues.
> Cheers,

I realized looking at the code that unfortunately it’s still broken when both 
IPv4/IPv6 are disabled :/.
-Ngie



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r310866 - in head: . contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/tests

2016-12-30 Thread Martin Matuska
Author: mm
Date: Fri Dec 30 22:18:22 2016
New Revision: 310866
URL: https://svnweb.freebsd.org/changeset/base/310866

Log:
  MFV r310796, r310797:
  
  Sync libarchive with vendor.
  
  Vendor changes (relevant to FreeBSD):
  PR #771: Add NFSv4 ACL support to pax and restricted pax
  
  NFSv4 ACL information may now be stored to and restored from tar archives.
  ACL must be non-trivial and supported by the underlying filesystem, e.g.
  natively by ZFS or by UFS with the NFSv4 ACL enable flag set.
  
  MFC after:2 weeks
  Relnotes: yes

Added:
  head/contrib/libarchive/libarchive/test/test_acl_pax_nfs4.tar.uu
 - copied unchanged from r310796, 
vendor/libarchive/dist/libarchive/test/test_acl_pax_nfs4.tar.uu
  head/contrib/libarchive/libarchive/test/test_acl_pax_posix1e.tar.uu
 - copied unchanged from r310796, 
vendor/libarchive/dist/libarchive/test/test_acl_pax_posix1e.tar.uu
  head/contrib/libarchive/libarchive/test/test_acl_text.c
 - copied unchanged from r310796, 
vendor/libarchive/dist/libarchive/test/test_acl_text.c
  head/contrib/libarchive/libarchive/test/test_compat_star_acl.c
 - copied unchanged from r310796, 
vendor/libarchive/dist/libarchive/test/test_compat_star_acl.c
  head/contrib/libarchive/libarchive/test/test_compat_star_acl_nfs4.tar.uu
 - copied unchanged from r310796, 
vendor/libarchive/dist/libarchive/test/test_compat_star_acl_nfs4.tar.uu
Deleted:
  head/contrib/libarchive/libarchive/test/test_acl_pax.tar.uu
  head/contrib/libarchive/libarchive/test/test_compat_star_acl_posix1e.c
Modified:
  head/ObsoleteFiles.inc
  head/contrib/libarchive/NEWS
  head/contrib/libarchive/libarchive/archive_acl.c
  head/contrib/libarchive/libarchive/archive_acl_private.h
  head/contrib/libarchive/libarchive/archive_entry.c
  head/contrib/libarchive/libarchive/archive_entry.h
  head/contrib/libarchive/libarchive/archive_entry_acl.3
  head/contrib/libarchive/libarchive/archive_entry_locale.h
  head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
  head/contrib/libarchive/libarchive/archive_read_support_format_tar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_pax.c
  head/contrib/libarchive/libarchive/libarchive-formats.5
  head/contrib/libarchive/libarchive/tar.5
  head/contrib/libarchive/libarchive/test/main.c
  head/contrib/libarchive/libarchive/test/test.h
  head/contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c
  head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c
  head/contrib/libarchive/libarchive/test/test_acl_nfs4.c
  head/contrib/libarchive/libarchive/test/test_acl_pax.c
  head/contrib/libarchive/libarchive/test/test_acl_posix1e.c
  head/lib/libarchive/tests/Makefile
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Fri Dec 30 21:41:01 2016(r310865)
+++ head/ObsoleteFiles.inc  Fri Dec 30 22:18:22 2016(r310866)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20161230: libarchive ACL pax test renamed to test_acl_pax_posix1e.tar.uu
+OLD_FILES+=usr/tests/lib/libarchive/test_acl_pax.tar.uu
 # 20161217: new clang import which bumps version from 3.9.0 to 3.9.1.
 OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/allocator_interface.h
 OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/asan_interface.h

Modified: head/contrib/libarchive/NEWS
==
--- head/contrib/libarchive/NEWSFri Dec 30 21:41:01 2016
(r310865)
+++ head/contrib/libarchive/NEWSFri Dec 30 22:18:22 2016
(r310866)
@@ -1,3 +1,6 @@
+Dec 27, 2016: NFSv4 ACL read and write support for pax
+Deprecated functions: archive_entry_acl_text(), archive_entry_acl_text_w()
+
 Oct 26, 2016: Remove liblzmadec support
 
 Oct 23, 2016: libarchive 3.2.2 released

Modified: head/contrib/libarchive/libarchive/archive_acl.c
==
--- head/contrib/libarchive/libarchive/archive_acl.cFri Dec 30 21:41:01 
2016(r310865)
+++ head/contrib/libarchive/libarchive/archive_acl.cFri Dec 30 22:18:22 
2016(r310866)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2003-2010 Tim Kientzle
+ * Copyright (c) 2016 Martin Matuska
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -55,23 +56,31 @@ static struct archive_acl_entry *acl_new
 static int archive_acl_add_entry_len_l(struct archive_acl *acl,
int type, int permset, int tag, int id, const char *name,
size_t len, struct archive_string_conv *sc);
+static int archive_acl_text_want_type(struct archive_acl *acl, int flags);
+static ssize_t archive_acl_text_len(struct archive_acl *acl, int want_type,
+   int flags, int wide, struct archive *a

svn commit: r310867 - in head/sys: dev/rtwn dev/rtwn/rtl8812a dev/rtwn/rtl8821a dev/rtwn/rtl8821a/usb modules/rtwn_usb

2016-12-30 Thread Andriy Voskoboinyk
Author: avos
Date: Fri Dec 30 22:24:01 2016
New Revision: 310867
URL: https://svnweb.freebsd.org/changeset/base/310867

Log:
  rtwn: add (untested) radar detection support for RTL8821AU
  (disabled by default).
  
  To enable it, dev.rtwn.%d.radar_detection tunable need to be set
  to a nonzero value.
  
  Tested with RTL8821AU, AP mode (no radar events were seen - so,
  I have no idea if it is really correct / working)
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D8903

Added:
  head/sys/dev/rtwn/rtl8821a/usb/r21au_dfs.c   (contents, props changed)
Modified:
  head/sys/dev/rtwn/if_rtwn.c
  head/sys/dev/rtwn/if_rtwn_beacon.c
  head/sys/dev/rtwn/if_rtwn_beacon.h
  head/sys/dev/rtwn/if_rtwn_debug.h
  head/sys/dev/rtwn/if_rtwnvar.h
  head/sys/dev/rtwn/rtl8812a/r12a_var.h
  head/sys/dev/rtwn/rtl8821a/r21a_init.c
  head/sys/dev/rtwn/rtl8821a/usb/r21au.h
  head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c
  head/sys/modules/rtwn_usb/Makefile

Modified: head/sys/dev/rtwn/if_rtwn.c
==
--- head/sys/dev/rtwn/if_rtwn.c Fri Dec 30 22:18:22 2016(r310866)
+++ head/sys/dev/rtwn/if_rtwn.c Fri Dec 30 22:24:01 2016(r310867)
@@ -580,6 +580,8 @@ rtwn_vap_create(struct ieee80211com *ic,
vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_16;
vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K;
 
+   TIMEOUT_TASK_INIT(taskqueue_thread, &uvp->tx_beacon_csa, 0,
+   rtwn_tx_beacon_csa, vap);
if (opmode == IEEE80211_M_IBSS) {
uvp->recv_mgmt = vap->iv_recv_mgmt;
vap->iv_recv_mgmt = rtwn_adhoc_recv_mgmt;
@@ -1067,9 +1069,26 @@ rtwn_newstate(struct ieee80211vap *vap, 
} else
early_newstate = 0;
 
+   if (ostate == IEEE80211_S_CSA) {
+   taskqueue_cancel_timeout(taskqueue_thread,
+   &uvp->tx_beacon_csa, NULL);
+
+   /*
+* In multi-vap case second counter may not be cleared
+* properly.
+*/
+   vap->iv_csa_count = 0;
+   }
IEEE80211_UNLOCK(ic);
RTWN_LOCK(sc);
-   if (ostate == IEEE80211_S_RUN) {
+
+   if (ostate == IEEE80211_S_CSA) {
+   /* Unblock all queues (multi-vap case). */
+   rtwn_write_1(sc, R92C_TXPAUSE, 0);
+   }
+
+   if ((ostate == IEEE80211_S_RUN && nstate != IEEE80211_S_CSA) ||
+   ostate == IEEE80211_S_CSA) {
sc->vaps_running--;
 
/* Set media status to 'No Link'. */
@@ -1141,6 +1160,11 @@ rtwn_newstate(struct ieee80211vap *vap, 
 
sc->vaps_running++;
break;
+   case IEEE80211_S_CSA:
+   /* Block all Tx queues (except beacon queue). */
+   rtwn_setbits_1(sc, R92C_TXPAUSE, 0,
+   R92C_TX_QUEUE_AC | R92C_TX_QUEUE_MGT | R92C_TX_QUEUE_HIGH);
+   break;
default:
break;
}

Modified: head/sys/dev/rtwn/if_rtwn_beacon.c
==
--- head/sys/dev/rtwn/if_rtwn_beacon.c  Fri Dec 30 22:18:22 2016
(r310866)
+++ head/sys/dev/rtwn/if_rtwn_beacon.c  Fri Dec 30 22:24:01 2016
(r310867)
@@ -160,7 +160,8 @@ rtwn_tx_beacon(struct rtwn_softc *sc, st
 void
 rtwn_update_beacon(struct ieee80211vap *vap, int item)
 {
-   struct rtwn_softc *sc = vap->iv_ic->ic_softc;
+   struct ieee80211com *ic = vap->iv_ic;
+   struct rtwn_softc *sc = ic->ic_softc;
struct rtwn_vap *uvp = RTWN_VAP(vap);
struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off;
struct ieee80211_node *ni = vap->iv_bss;
@@ -176,21 +177,71 @@ rtwn_update_beacon(struct ieee80211vap *
return;
}
}
-   rtwn_beacon_update_begin(sc, vap);
-   RTWN_UNLOCK(sc);
 
-   if (item == IEEE80211_BEACON_TIM)
+   RTWN_DPRINTF(sc, RTWN_DEBUG_BEACON,
+   "%s: vap id %d, iv_csa_count %d, ic_csa_count %d, item %d\n",
+   __func__, uvp->id, vap->iv_csa_count, ic->ic_csa_count, item);
+
+   switch (item) {
+   case IEEE80211_BEACON_CSA:
+   if (vap->iv_csa_count != ic->ic_csa_count) {
+   /*
+* XXX two APs with different beacon intervals
+* are not handled properly.
+*/
+   /* XXX check TBTT? */
+   taskqueue_enqueue_timeout(taskqueue_thread,
+   &uvp->tx_beacon_csa,
+   msecs_to_ticks(ni->ni_intval));
+   }
+   break;
+   case IEEE80211_BEACON_TIM:
mcast = 1;  /* XXX */
+   break;
+   default:
+   break;
+   }
 
setbit(bo->bo_flags, item);
+
+   rtwn_beacon_update_begin(sc, vap);
+   

svn commit: r310868 - in head/contrib/libarchive: cpio libarchive libarchive/test

2016-12-30 Thread Martin Matuska
Author: mm
Date: Fri Dec 30 22:54:08 2016
New Revision: 310868
URL: https://svnweb.freebsd.org/changeset/base/310868

Log:
  MFV r310798:
  
  Sync libarchive with vendor.
  
  Vendor bugfixes (relevant to FreeBSD):
  PR #843: Fix memory leak of struct archive_entry in cpio/cpio.c
  PR #851: Spelling fixes
  Fix two protoypes in manual page archive_read_disk.3
  
  MFC after:2 weeks

Modified:
  head/contrib/libarchive/cpio/cpio.c
  head/contrib/libarchive/libarchive/archive_match.c
  head/contrib/libarchive/libarchive/archive_rb.c
  head/contrib/libarchive/libarchive/archive_read_disk.3
  head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c
  head/contrib/libarchive/libarchive/archive_write_disk_posix.c
  head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c
  head/contrib/libarchive/libarchive/archive_write_set_format_warc.c
  head/contrib/libarchive/libarchive/archive_write_set_format_xar.c
  head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c
  head/contrib/libarchive/libarchive/test/test_read_format_7zip.c
  head/contrib/libarchive/libarchive/test/test_read_format_isorr_bz2.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_filename.c
  head/contrib/libarchive/libarchive/test/test_write_format_iso9660.c
  head/contrib/libarchive/libarchive/test/test_write_format_iso9660_zisofs.c
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/cpio/cpio.c
==
--- head/contrib/libarchive/cpio/cpio.c Fri Dec 30 22:24:01 2016
(r310867)
+++ head/contrib/libarchive/cpio/cpio.c Fri Dec 30 22:54:08 2016
(r310868)
@@ -703,6 +703,7 @@ file_to_archive(struct cpio *cpio, const
lafe_warnc(0, "%s",
archive_error_string(cpio->archive_read_disk));
if (r <= ARCHIVE_FAILED) {
+   archive_entry_free(entry);
cpio->return_value = 1;
return (r);
}

Modified: head/contrib/libarchive/libarchive/archive_match.c
==
--- head/contrib/libarchive/libarchive/archive_match.c  Fri Dec 30 22:24:01 
2016(r310867)
+++ head/contrib/libarchive/libarchive/archive_match.c  Fri Dec 30 22:54:08 
2016(r310868)
@@ -471,7 +471,7 @@ archive_match_path_excluded(struct archi
 }
 
 /*
- * Utilty functions to get statistic information for inclusion patterns.
+ * Utility functions to get statistic information for inclusion patterns.
  */
 int
 archive_match_path_unmatched_inclusions(struct archive *_a)
@@ -1270,7 +1270,7 @@ set_timefilter_pathname_wcs(struct archi
 #endif /* _WIN32 && !__CYGWIN__ */
 
 /*
- * Call back funtions for archive_rb.
+ * Call back functions for archive_rb.
  */
 static int
 cmp_node_mbs(const struct archive_rb_node *n1,
@@ -1405,7 +1405,7 @@ add_entry(struct archive_match *a, int f
&(a->exclusion_tree), pathname);
 
/*
-* We always overwrite comparison condision.
+* We always overwrite comparison condition.
 * If you do not want to overwrite it, you should not
 * call archive_match_exclude_entry(). We cannot know
 * what behavior you really expect since overwriting
@@ -1481,7 +1481,7 @@ time_excluded(struct archive_match *a, s
if (nsec == a->older_ctime_nsec &&
(a->older_ctime_filter & ARCHIVE_MATCH_EQUAL)
  == 0)
-   return (1); /* Eeual, skip it. */
+   return (1); /* Equal, skip it. */
}
}
if (a->newer_mtime_filter) {
@@ -1513,7 +1513,7 @@ time_excluded(struct archive_match *a, s
}
}
 
-   /* If there is no excluson list, include the file. */
+   /* If there is no exclusion list, include the file. */
if (a->exclusion_entry_list.count == 0)
return (0);
 
@@ -1700,7 +1700,7 @@ add_owner_id(struct archive_match *a, st
break;
}
 
-   /* Add oowner id. */
+   /* Add owner id. */
if (i == ids->count)
ids->ids[ids->count++] = id;
else if (ids->ids[i] != id) {

Modified: head/contrib/libarchive/libarchive/archive_rb.c
==
--- head/contrib/libarchive/libarchive/archive_rb.c Fri Dec 30 22:24:01 
2016(r310867)
+++ head/contrib/libarchive/libarchive/archive_rb.c Fri Dec 30 22:54:08 
2016(r310868)
@@ -312,7 +312,7 @@ __archive_rb_tree_insert_rebalance(struc
father = RB_FATHER(self);
if (RB_BLACK_P(father)) {
/*
-* If our greatgrandpa is black, we're done.
+ 

svn commit: r310870 - head/contrib/libarchive/libarchive

2016-12-30 Thread Martin Matuska
Author: mm
Date: Fri Dec 30 23:05:06 2016
New Revision: 310870
URL: https://svnweb.freebsd.org/changeset/base/310870

Log:
  MFV r310869:
  
  Sync libarchive with vendor.
  
  Vendor bugfixes:
  Use __LA_DEPRECATED macro with functions deprecated in 379867e (r310796)
  
  MFC after:2 weeks
  X-MFC with:   r310866

Modified:
  head/contrib/libarchive/libarchive/archive_entry.h
  head/contrib/libarchive/libarchive/archive_entry_locale.h
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/libarchive/archive_entry.h
==
--- head/contrib/libarchive/libarchive/archive_entry.h  Fri Dec 30 23:00:00 
2016(r310869)
+++ head/contrib/libarchive/libarchive/archive_entry.h  Fri Dec 30 23:05:06 
2016(r310870)
@@ -105,6 +105,12 @@ typedef int64_t la_int64_t;
 # define __LA_DECL
 #endif
 
+#if defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 1
+# define __LA_DEPRECATED __attribute__((deprecated))
+#else
+# define __LA_DEPRECATED
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -529,9 +535,9 @@ __LA_DECL int archive_entry_acl_from_tex
 
 /* Deprecated functions */
 __LA_DECL const wchar_t*archive_entry_acl_text_w(struct archive_entry 
*,
-   int /* flags */) __attribute__ ((deprecated));
+   int /* flags */) __LA_DEPRECATED;
 __LA_DECL const char *archive_entry_acl_text(struct archive_entry *,
-   int /* flags */) __attribute__ ((deprecated));
+   int /* flags */) __LA_DEPRECATED;
 
 /* Return bitmask of ACL types in an archive entry */
 __LA_DECL int   archive_entry_acl_types(struct archive_entry *);

Modified: head/contrib/libarchive/libarchive/archive_entry_locale.h
==
--- head/contrib/libarchive/libarchive/archive_entry_locale.h   Fri Dec 30 
23:00:00 2016(r310869)
+++ head/contrib/libarchive/libarchive/archive_entry_locale.h   Fri Dec 30 
23:05:06 2016(r310870)
@@ -63,8 +63,7 @@ int _archive_entry_uname_l(struct archiv
 const char **, size_t *, struct archive_string_conv *);
 #define archive_entry_acl_text_l _archive_entry_acl_text_l
 int _archive_entry_acl_text_l(struct archive_entry *, int,
-const char **, size_t *, struct archive_string_conv *)
-__attribute__ ((deprecated));
+const char **, size_t *, struct archive_string_conv *) __LA_DEPRECATED;
 #define archive_entry_acl_to_text_l _archive_entry_acl_to_text_l
 char *_archive_entry_acl_to_text_l(struct archive_entry *, ssize_t *, int,
 struct archive_string_conv *);
___
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: r310872 - head/usr.bin/sdiff

2016-12-30 Thread Baptiste Daroussin
Author: bapt
Date: Fri Dec 30 23:41:33 2016
New Revision: 310872
URL: https://svnweb.freebsd.org/changeset/base/310872

Log:
  Make sdiff --left-column work as expected
  
  MFC after:3 days

Modified:
  head/usr.bin/sdiff/sdiff.c

Modified: head/usr.bin/sdiff/sdiff.c
==
--- head/usr.bin/sdiff/sdiff.c  Fri Dec 30 23:14:18 2016(r310871)
+++ head/usr.bin/sdiff/sdiff.c  Fri Dec 30 23:41:33 2016(r310872)
@@ -87,7 +87,6 @@ enum {
UNIDIR_OPT,
STRIPCR_OPT,
HORIZ_OPT,
-   LEFTC_OPT,
SUPCL_OPT,
LF_OPT,
/* the following groupings must be in sequence */
@@ -109,7 +108,6 @@ enum {
 
 static struct option longopts[] = {
/* options only processed in sdiff */
-   { "left-column",no_argument,NULL,   
LEFTC_OPT },
{ "suppress-common-lines",  no_argument,NULL,   's' },
{ "width",  required_argument,  NULL,   'w' },
 
@@ -129,6 +127,7 @@ static struct option longopts[] = {
{ "ignore-tab-expansion",   no_argument,NULL,   'E' },
{ "ignore-matching-lines",  required_argument,  NULL,   'I' },
{ "ignore-case",no_argument,NULL,   'i' },
+   { "left-column",no_argument,NULL,   'l' },
{ "expand-tabs",no_argument,NULL,   't' },
{ "speed-large-files",  no_argument,NULL,   'H' },
{ "ignore-all-space",   no_argument,NULL,   'W' },
___
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: r310873 - head/contrib/bsnmp/snmp_mibII

2016-12-30 Thread Ngie Cooper
Author: ngie
Date: Fri Dec 30 23:44:39 2016
New Revision: 310873
URL: https://svnweb.freebsd.org/changeset/base/310873

Log:
  Guard against use-after-free after calling mibif_free(..)
  
  Set variables to NULL after calling free.
  
  Also, remove unnecessary if (x != NULL) checks before calling free(x)
  
  MFC after:1 week

Modified:
  head/contrib/bsnmp/snmp_mibII/mibII.c

Modified: head/contrib/bsnmp/snmp_mibII/mibII.c
==
--- head/contrib/bsnmp/snmp_mibII/mibII.c   Fri Dec 30 23:41:33 2016
(r310872)
+++ head/contrib/bsnmp/snmp_mibII/mibII.c   Fri Dec 30 23:44:39 2016
(r310873)
@@ -707,10 +707,11 @@ mibif_free(struct mibif *ifp)
}
 
free(ifp->private);
-   if (ifp->physaddr != NULL)
-   free(ifp->physaddr);
-   if (ifp->specmib != NULL)
-   free(ifp->specmib);
+   ifp->private = NULL;
+   free(ifp->physaddr);
+   ifp->physaddr = NULL;
+   free(ifp->specmib);
+   ifp->specmib = NULL;
 
STAILQ_FOREACH(map, &mibindexmap_list, link)
if (map->mibif == ifp) {
@@ -745,8 +746,8 @@ mibif_free(struct mibif *ifp)
at = at1;
}
 
-
free(ifp);
+   ifp = NULL;
mib_if_number--;
mib_iftable_last_change = this_tick;
 }
___
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: r310874 - head/usr.bin/sdiff

2016-12-30 Thread Baptiste Daroussin
Author: bapt
Date: Fri Dec 30 23:46:11 2016
New Revision: 310874
URL: https://svnweb.freebsd.org/changeset/base/310874

Log:
  Remove extra entries from the option enum
  
  MFC after:3 days

Modified:
  head/usr.bin/sdiff/sdiff.c

Modified: head/usr.bin/sdiff/sdiff.c
==
--- head/usr.bin/sdiff/sdiff.c  Fri Dec 30 23:44:39 2016(r310873)
+++ head/usr.bin/sdiff/sdiff.c  Fri Dec 30 23:46:11 2016(r310874)
@@ -82,28 +82,9 @@ enum {
NORMAL_OPT,
FCASE_SENSITIVE_OPT,
FCASE_IGNORE_OPT,
-   FROMFILE_OPT,
-   TOFILE_OPT,
-   UNIDIR_OPT,
STRIPCR_OPT,
-   HORIZ_OPT,
-   SUPCL_OPT,
-   LF_OPT,
-   /* the following groupings must be in sequence */
-   OLDGF_OPT,
-   NEWGF_OPT,
-   UNCGF_OPT,
-   CHGF_OPT,
-   OLDLF_OPT,
-   NEWLF_OPT,
-   UNCLF_OPT,
-   /* end order-sensitive enums */
TSIZE_OPT,
-   HLINES_OPT,
-   LFILES_OPT,
DIFFPROG_OPT,
-
-   NOOP_OPT,
 };
 
 static struct option longopts[] = {
___
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: r310729 - head/contrib/bsnmp/lib

2016-12-30 Thread Ngie Cooper (yaneurabeya)

> On Dec 28, 2016, at 16:20, Ngie Cooper  wrote:
> 
> Author: ngie
> Date: Thu Dec 29 00:20:03 2016
> New Revision: 310729
> URL: https://svnweb.freebsd.org/changeset/base/310729
> 
> Log:
>  Prevent improper memory accesses after calling snmp_pdu_free and 
> snmp_value_free
> 
>  snmp_pdu_free: set pdu->nbindings to 0 to limit the damage that
>  could happen if a pdu was reused after calling the function, and
>  as both stack and heap allocation types are used in contrib/bsnmp
>  and usr.sbin/bsnmpd.
> 
>  snmp_value_free: NULL out value->v.octetstring.octets after calling
>  free on it to prevent a double-free from occurring.

This commit identified a bug in the bsnmptools implementation:

% bsnmpwalk -s 172.16.45.130:161
sysDescr.0 = fbsd12 3045910434 FreeBSD 12.0-CURRENT
Bus error (core dumped)


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r310886 - head/sys/arm/ti/am335x

2016-12-30 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Dec 31 02:18:08 2016
New Revision: 310886
URL: https://svnweb.freebsd.org/changeset/base/310886

Log:
  Fixes the sensor initialization, always reset the digital outputs to start.
  
  Obtained from:pfSense
  MFC after:3 days
  Sponsored by: Rubicon Communications, LLC (Netgate)

Modified:
  head/sys/arm/ti/am335x/am335x_scm.c

Modified: head/sys/arm/ti/am335x/am335x_scm.c
==
--- head/sys/arm/ti/am335x/am335x_scm.c Sat Dec 31 02:02:42 2016
(r310885)
+++ head/sys/arm/ti/am335x/am335x_scm.c Sat Dec 31 02:18:08 2016
(r310886)
@@ -110,11 +110,14 @@ am335x_scm_attach(device_t dev)
struct sysctl_oid_list *tree;
uint32_t reg;
 
-   /* Set ADC to continous mode, clear output reset. */
-   reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV;
-   ti_scm_reg_write_4(SCM_BGAP_CTRL, reg);
-   /* Flush write. */
+   /* Reset the digital outputs. */
+   ti_scm_reg_write_4(SCM_BGAP_CTRL, 0);
+   ti_scm_reg_read_4(SCM_BGAP_CTRL, ®);
+   DELAY(500);
+   /* Set continous mode. */
+   ti_scm_reg_write_4(SCM_BGAP_CTRL, SCM_BGAP_CONTCONV);
ti_scm_reg_read_4(SCM_BGAP_CTRL, ®);
+   DELAY(500);
/* Start the ADC conversion. */
reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV | SCM_BGAP_SOC;
ti_scm_reg_write_4(SCM_BGAP_CTRL, reg);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r310887 - head/sys/dev/rccgpio

2016-12-30 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Dec 31 02:23:15 2016
New Revision: 310887
URL: https://svnweb.freebsd.org/changeset/base/310887

Log:
  Fix rcc_gpio_modify_bits().  Obviously (1 << 0) is not the same as 0.
  
  Pointy hat to:loos
  MFC after:3 days

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

Modified: head/sys/dev/rccgpio/rccgpio.c
==
--- head/sys/dev/rccgpio/rccgpio.c  Sat Dec 31 02:18:08 2016
(r310886)
+++ head/sys/dev/rccgpio/rccgpio.c  Sat Dec 31 02:23:15 2016
(r310887)
@@ -57,12 +57,12 @@ struct rcc_gpio_pin {
 };
 
 static struct rcc_gpio_pin rcc_pins[] = {
-   { .pin = 11, .name = "reset switch", .caps = GPIO_PIN_INPUT },
-   { .pin = 15, .name = "red LED", .caps = GPIO_PIN_OUTPUT },
-   { .pin = 17, .name = "green LED", .caps = GPIO_PIN_OUTPUT },
+   { .pin = (1 << 11), .name = "reset switch", .caps = GPIO_PIN_INPUT },
+   { .pin = (1 << 15), .name = "red LED", .caps = GPIO_PIN_OUTPUT },
+   { .pin = (1 << 17), .name = "green LED", .caps = GPIO_PIN_OUTPUT },
 #if 0
-   { .pin = 16, .name = "HD1 LED", .caps = GPIO_PIN_OUTPUT },
-   { .pin = 18, .name = "HD2 LED", .caps = GPIO_PIN_OUTPUT },
+   { .pin = (1 << 16), .name = "HD1 LED", .caps = GPIO_PIN_OUTPUT },
+   { .pin = (1 << 18), .name = "HD2 LED", .caps = GPIO_PIN_OUTPUT },
 #endif
 };
 
@@ -87,14 +87,14 @@ struct rcc_gpio_softc {
 
 static void
 rcc_gpio_modify_bits(struct rcc_gpio_softc *sc, uint32_t reg, uint32_t mask,
-   uint32_t bit)
+   uint32_t writebits)
 {
uint32_t value;
 
RCC_GPIO_LOCK(sc);
value = RCC_READ(sc, reg);
-   value &= ~(1 << mask);
-   value |= (1 << bit);
+   value &= ~mask;
+   value |= writebits;
RCC_WRITE(sc, reg, value);
RCC_GPIO_UNLOCK(sc);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r310888 - head/usr.sbin/syslogd

2016-12-30 Thread Hiroki Sato
Author: hrs
Date: Sat Dec 31 03:07:48 2016
New Revision: 310888
URL: https://svnweb.freebsd.org/changeset/base/310888

Log:
  Retry to open an F_PIPE process when it dies unexpectedly.
  
  Reported by:  Eugene Grosbein
  PR:   215335

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Sat Dec 31 02:23:15 2016
(r310887)
+++ head/usr.sbin/syslogd/syslogd.c Sat Dec 31 03:07:48 2016
(r310888)
@@ -368,9 +368,19 @@ close_filed(struct filed *f)
if (f == NULL || f->f_file == -1)
return;
 
+   switch (f->f_type) {
+   case F_FILE:
+   case F_TTY:
+   case F_CONSOLE:
+   case F_FORW:
+   f->f_type = F_UNUSED;
+   break;
+   case F_PIPE:
+   f->fu_pipe_pid = 0;
+   break;
+   }
(void)close(f->f_file);
f->f_file = -1;
-   f->f_type = F_UNUSED;
 }
 
 static int
@@ -1378,18 +1388,15 @@ fprintlog(struct filed *f, int flags, co
if (f->fu_pipe_pid == 0) {
if ((f->f_file = p_open(f->fu_pipe_pname,
&f->fu_pipe_pid)) < 0) {
-   f->f_type = F_UNUSED;
logerror(f->fu_pipe_pname);
break;
}
}
if (writev(f->f_file, iov, nitems(iov)) < 0) {
int e = errno;
+
+   deadq_enter(f->fu_pipe_pid, f->fu_pipe_pname);
close_filed(f);
-   if (f->fu_pipe_pid > 0)
-   deadq_enter(f->fu_pipe_pid,
-   f->fu_pipe_pname);
-   f->fu_pipe_pid = 0;
errno = e;
logerror(f->fu_pipe_pname);
}
@@ -1520,7 +1527,6 @@ reapchild(int signo __unused)
if (f->f_type == F_PIPE &&
f->fu_pipe_pid == pid) {
close_filed(f);
-   f->fu_pipe_pid = 0;
log_deadchild(pid, status, f->fu_pipe_pname);
break;
}
@@ -1619,10 +1625,8 @@ die(int signo)
/* flush any pending output */
if (f->f_prevcount)
fprintlog(f, 0, (char *)NULL);
-   if (f->f_type == F_PIPE && f->fu_pipe_pid > 0) {
+   if (f->f_type == F_PIPE && f->fu_pipe_pid > 0)
close_filed(f);
-   f->fu_pipe_pid = 0;
-   }
}
Initialized = was_initialized;
if (signo) {
@@ -1851,12 +1855,8 @@ init(int signo)
close_filed(f);
break;
case F_PIPE:
-   if (f->fu_pipe_pid > 0) {
-   close_filed(f);
-   deadq_enter(f->fu_pipe_pid,
-   f->fu_pipe_pname);
-   }
-   f->fu_pipe_pid = 0;
+   deadq_enter(f->fu_pipe_pid, f->fu_pipe_pname);
+   close_filed(f);
break;
}
}
@@ -2753,6 +2753,8 @@ deadq_enter(pid_t pid, const char *name)
struct deadq_entry *dq;
int status;
 
+   if (pid == 0)
+   return;
/*
 * Be paranoid, if we can't signal the process, don't enter it
 * into the dead queue (perhaps it's already dead).  If possible,
___
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: r310889 - head/tools/build/mk

2016-12-30 Thread Jung-uk Kim
Author: jkim
Date: Sat Dec 31 06:07:48 2016
New Revision: 310889
URL: https://svnweb.freebsd.org/changeset/base/310889

Log:
  Do not remove llvm-objdump.  It is installed by default since r310840.

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Sat Dec 31 03:07:48 
2016(r310888)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Sat Dec 31 06:07:48 
2016(r310889)
@@ -1484,7 +1484,6 @@ OLD_FILES+=usr/bin/llvm-link
 OLD_FILES+=usr/bin/llvm-lto
 OLD_FILES+=usr/bin/llvm-mc
 OLD_FILES+=usr/bin/llvm-nm
-OLD_FILES+=usr/bin/llvm-objdump
 OLD_FILES+=usr/bin/llvm-pdbdump
 OLD_FILES+=usr/bin/llvm-rtdyld
 OLD_FILES+=usr/bin/llvm-symbolizer
___
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: r310890 - head/usr.sbin/syslogd

2016-12-30 Thread Hiroki Sato
Author: hrs
Date: Sat Dec 31 06:23:05 2016
New Revision: 310890
URL: https://svnweb.freebsd.org/changeset/base/310890

Log:
  Replace two fat signal handlers with function calls in
  the main I/O multiplex loop.  select() now watches
  a pipe which is written by the new skinny signal
  handlers and the received signals are handled inside
  the loop sequencially.
  
  This eliminates a complex signal mask to guarantee
  async-signal safety.

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Sat Dec 31 06:07:48 2016
(r310889)
+++ head/usr.sbin/syslogd/syslogd.c Sat Dec 31 06:23:05 2016
(r310890)
@@ -321,8 +321,9 @@ static int  LogFacPri;  /* Put facility an
 static int KeepKernFac;/* Keep remotely logged kernel facility */
 static int needdofsync = 0; /* Are any file(s) waiting to be fsynced? */
 static struct pidfh *pfh;
+static int sigp[2];/* Pipe to catch a signal during select(). */
 
-static volatile sig_atomic_t MarkSet, WantDie;
+static volatile sig_atomic_t MarkSet, WantDie, WantInitialize, WantReapchild;
 
 static int allowaddr(char *);
 static int addfile(struct filed *);
@@ -340,6 +341,7 @@ static void dofsync(void);
 static voiddomark(int);
 static voidfprintlog(struct filed *, int, const char *);
 static voidinit(int);
+static voidinit_sh(int);
 static voidlogerror(const char *);
 static voidlogmsg(int, const char *, const char *, int);
 static voidlog_deadchild(pid_t, int, const char *);
@@ -347,11 +349,13 @@ static void   markit(void);
 static int socksetup(struct peer *);
 static int socklist_recv_file(struct socklist *);
 static int socklist_recv_sock(struct socklist *);
+static int socklist_recv_signal(struct socklist *);
 static int skip_message(const char *, const char *, int);
 static voidprintline(const char *, char *, int);
 static voidprintsys(char *);
 static int p_open(const char *, pid_t *);
 static voidreapchild(int);
+static voidreapchild_sh(int);
 static const char *ttymsg_check(struct iovec *, int, char *, int);
 static voidusage(void);
 static int validate(struct sockaddr *, const char *);
@@ -435,7 +439,6 @@ main(int argc, char *argv[])
struct timeval tv, *tvp;
struct peer *pe;
struct socklist *sl;
-   sigset_t mask;
pid_t ppid = 1, spid;
char *p;
 
@@ -578,6 +581,17 @@ main(int argc, char *argv[])
if ((argc -= optind) != 0)
usage();
 
+   /* Pipe to catch a signal during select(). */
+   s = pipe2(sigp, O_NONBLOCK);
+   if (s < 0) {
+   err(1, "cannot open a pipe for signals");
+   } else {
+   addsock(NULL, 0, &(struct socklist){
+   .sl_socket = sigp[1],
+   .sl_recv = socklist_recv_signal
+   });
+   }
+
/* Listen by default: /dev/klog. */
s = open(_PATH_KLOG, O_RDONLY|O_NONBLOCK, 0);
if (s < 0) {
@@ -632,19 +646,8 @@ main(int argc, char *argv[])
(void)signal(SIGTERM, dodie);
(void)signal(SIGINT, Debug ? dodie : SIG_IGN);
(void)signal(SIGQUIT, Debug ? dodie : SIG_IGN);
-   /*
-* We don't want the SIGCHLD and SIGHUP handlers to interfere
-* with each other; they are likely candidates for being called
-* simultaneously (SIGHUP closes pipe descriptor, process dies,
-* SIGCHLD happens).
-*/
-   sigemptyset(&mask);
-   sigaddset(&mask, SIGHUP);
-   (void)sigaction(SIGCHLD, &(struct sigaction){
-   .sa_handler = reapchild,
-   .sa_mask = mask,
-   .sa_flags = SA_RESTART
-   }, NULL);
+   (void)signal(SIGHUP, init_sh);
+   (void)signal(SIGCHLD, reapchild_sh);
(void)signal(SIGALRM, domark);
(void)signal(SIGPIPE, SIG_IGN); /* We'll catch EPIPE instead. */
(void)alarm(TIMERINTVL);
@@ -654,16 +657,6 @@ main(int argc, char *argv[])
 
dprintf("off & running\n");
 
-   init(0);
-   /* prevent SIGHUP and SIGCHLD handlers from running in parallel */
-   sigemptyset(&mask);
-   sigaddset(&mask, SIGCHLD);
-   (void)sigaction(SIGHUP, &(struct sigaction){
-   .sa_handler = init,
-   .sa_mask = mask,
-   .sa_flags = SA_RESTART
-   }, NULL);
-
tvp = &tv;
tv.tv_sec = tv.tv_usec = 0;
 
@@ -677,6 +670,12 @@ main(int argc, char *argv[])
errx(1, "calloc fd_set");
 
for (;;) {
+   if (Initialized == 0)
+   init(0);
+   else if (WantInitialize)
+   init(WantInitialize);
+   if (WantReapchild)
+   reapchild(WantReapchild);
if (MarkSet)
markit();
if (Want

svn commit: r310891 - head/sys/net80211

2016-12-30 Thread Adrian Chadd
Author: adrian
Date: Sat Dec 31 07:50:14 2016
New Revision: 310891
URL: https://svnweb.freebsd.org/changeset/base/310891

Log:
  [net80211] add placeholders for the VHT action frame handling.
  
  Upcoming vht support will register send/receive action handlers.

Modified:
  head/sys/net80211/ieee80211.h
  head/sys/net80211/ieee80211_action.c

Modified: head/sys/net80211/ieee80211.h
==
--- head/sys/net80211/ieee80211.h   Sat Dec 31 06:23:05 2016
(r310890)
+++ head/sys/net80211/ieee80211.h   Sat Dec 31 07:50:14 2016
(r310891)
@@ -382,7 +382,7 @@ struct ieee80211_action {
 #defineIEEE80211_ACTION_CAT_MESH   13  /* Mesh */
 #defineIEEE80211_ACTION_CAT_SELF_PROT  15  /* Self-protected */
 /* 16 - 125 reserved */
-#defineIEEE80211_ACTION_VHT21
+#defineIEEE80211_ACTION_CAT_VHT21
 #defineIEEE80211_ACTION_CAT_VENDOR 127 /* Vendor Specific */
 
 #defineIEEE80211_ACTION_HT_TXCHWIDTH   0   /* recommended xmit 
chan width*/

Modified: head/sys/net80211/ieee80211_action.c
==
--- head/sys/net80211/ieee80211_action.cSat Dec 31 06:23:05 2016
(r310890)
+++ head/sys/net80211/ieee80211_action.cSat Dec 31 07:50:14 2016
(r310891)
@@ -79,6 +79,10 @@ static ieee80211_send_action_func *vendo
send_inval, send_inval, send_inval, send_inval,
 };
 
+static ieee80211_send_action_func *vht_send_action[3] = {
+   send_inval, send_inval, send_inval,
+};
+
 int
 ieee80211_send_action_register(int cat, int act, ieee80211_send_action_func *f)
 {
@@ -108,6 +112,11 @@ ieee80211_send_action_register(int cat, 
break;
vendor_send_action[act] = f;
return 0;
+   case IEEE80211_ACTION_CAT_VHT:
+   if (act >= nitems(vht_send_action))
+   break;
+   vht_send_action[act] = f;
+   return 0;
}
return EINVAL;
 }
@@ -144,6 +153,10 @@ ieee80211_send_action(struct ieee80211_n
if (act < nitems(vendor_send_action))
f = vendor_send_action[act];
break;
+   case IEEE80211_ACTION_CAT_VHT:
+   if (act < nitems(vht_send_action))
+   f = vht_send_action[act];
+   break;
}
return f(ni, cat, act, sa);
 }
@@ -177,6 +190,10 @@ static ieee80211_recv_action_func *vendo
recv_inval, recv_inval, recv_inval, recv_inval,
 };
 
+static ieee80211_recv_action_func *vht_recv_action[3] = {
+   recv_inval, recv_inval, recv_inval
+};
+
 int
 ieee80211_recv_action_register(int cat, int act, ieee80211_recv_action_func *f)
 {
@@ -206,6 +223,11 @@ ieee80211_recv_action_register(int cat, 
break;
vendor_recv_action[act] = f;
return 0;
+   case IEEE80211_ACTION_CAT_VHT:
+   if (act >= nitems(vht_recv_action))
+   break;
+   vht_recv_action[act] = f;
+   return 0;
}
return EINVAL;
 }
@@ -256,6 +278,10 @@ ieee80211_recv_action(struct ieee80211_n
if (ia->ia_action < nitems(vendor_recv_action))
f = vendor_recv_action[ia->ia_action];
break;
+   case IEEE80211_ACTION_CAT_VHT:
+   if (ia->ia_action < nitems(vht_recv_action))
+   f = vht_recv_action[ia->ia_action];
+   break;
}
return f(ni, wh, frm, efrm);
 }
___
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"