svn commit: r305763 - head/sys/dev/hyperv/netvsc

2016-09-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Sep 13 05:54:31 2016
New Revision: 305763
URL: https://svnweb.freebsd.org/changeset/base/305763

Log:
  hyperv/hn: Reorganize synthetic parts attach code.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7860

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
  head/sys/dev/hyperv/netvsc/if_hnvar.h

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Sep 13 05:47:59 
2016(r305762)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Sep 13 05:54:31 
2016(r305763)
@@ -350,6 +350,7 @@ static int hn_attach_subchans(struct hn_
 static void hn_detach_allchans(struct hn_softc *);
 static void hn_chan_callback(struct vmbus_channel *chan, void *xrxr);
 static void hn_set_ring_inuse(struct hn_softc *, int);
+static int hn_synth_attach(struct hn_softc *, int);
 
 static void hn_nvs_handle_notify(struct hn_softc *sc,
const struct vmbus_chanpkt_hdr *pkt);
@@ -531,29 +532,9 @@ netvsc_attach(device_t dev)
goto failed;
 
/*
-* Attach the primary channel before attaching NVS and RNDIS.
+* Attach the synthetic parts, i.e. NVS and RNDIS.
 */
-   error = hn_chan_attach(sc, sc->hn_prichan);
-   if (error)
-   goto failed;
-
-   /*
-* Attach NVS and RNDIS (synthetic parts).
-*/
-   error = hv_rf_on_device_add(sc, _cnt, ETHERMTU);
-   if (error)
-   goto failed;
-
-   /*
-* Set the # of TX/RX rings that could be used according to
-* the # of channels that host offered.
-*/
-   hn_set_ring_inuse(sc, ring_cnt);
-
-   /*
-* Attach the sub-channels, if any.
-*/
-   error = hn_attach_subchans(sc);
+   error = hn_synth_attach(sc, ETHERMTU);
if (error)
goto failed;
 
@@ -1513,7 +1494,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
 #ifdef INET
struct ifaddr *ifa = (struct ifaddr *)data;
 #endif
-   int mask, error = 0, ring_cnt;
+   int mask, error = 0;
int retry_cnt = 500;

switch(cmd) {
@@ -1590,29 +1571,10 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
hn_detach_allchans(sc);
 
/*
-* Attach the primary channel before attaching NVS and RNDIS.
-*/
-   hn_chan_attach(sc, sc->hn_prichan);
-
-   ring_cnt = sc->hn_rx_ring_cnt;
-   error = hv_rf_on_device_add(sc, _cnt, ifr->ifr_mtu);
-   if (error) {
-   NV_LOCK(sc);
-   sc->temp_unusable = FALSE;
-   NV_UNLOCK(sc);
-   break;
-   }
-
-   /*
-* Set the # of TX/RX rings that could be used according to
-* the # of channels that host offered.
+* Attach the synthetic parts, i.e. NVS and RNDIS.
+* XXX check error.
 */
-   hn_set_ring_inuse(sc, ring_cnt);
-
-   /*
-* Attach the sub-channels, if any.
-*/
-   hn_attach_subchans(sc); /* XXX check error */
+   hn_synth_attach(sc, ifr->ifr_mtu);
 
if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax)
hn_set_chim_size(sc, sc->hn_chim_szmax);
@@ -3065,17 +3027,13 @@ hn_attach_subchans(struct hn_softc *sc)
if (subchan_cnt == 0)
return (0);
 
-   /* Wait for sub-channels setup to complete. */
-   subchans = vmbus_subchan_get(sc->hn_prichan, subchan_cnt);
-
/* Attach the sub-channels. */
+   subchans = vmbus_subchan_get(sc->hn_prichan, subchan_cnt);
for (i = 0; i < subchan_cnt; ++i) {
error = hn_chan_attach(sc, subchans[i]);
if (error)
break;
}
-
-   /* Release the sub-channels */
vmbus_subchan_rel(subchans, subchan_cnt);
 
if (error) {
@@ -3129,6 +3087,132 @@ back:
 #endif
 }
 
+static int
+hn_synth_alloc_subchans(struct hn_softc *sc, int *nsubch)
+{
+   struct vmbus_channel **subchans;
+   int nchan, rxr_cnt, error;
+
+   nchan = *nsubch + 1;
+   if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30 || nchan == 1) {
+   /*
+* Either RSS is not supported, or multiple RX/TX rings
+* are not requested.
+*/
+   *nsubch = 0;
+   return (0);
+   }
+
+   /*
+* Get RSS capabilities, e.g. # of RX rings, and # of indirect
+* table entries.
+*/
+   error = hn_rndis_get_rsscaps(sc, _cnt);
+   if 

svn commit: r305762 - stable/11/sys/dev/iwm

2016-09-12 Thread Andriy Voskoboinyk
Author: avos
Date: Tue Sep 13 05:47:59 2016
New Revision: 305762
URL: https://svnweb.freebsd.org/changeset/base/305762

Log:
  MFC r305470:
  
  iwm: fix scanning for hidden SSIDs.
  
  Setup SSIDs in scan command so firmware will send direct probe request(s)
  while scanning.
  
  Tested by:dbk...@gmail.com
  
  PR:   211519

Modified:
  stable/11/sys/dev/iwm/if_iwm_scan.c
  stable/11/sys/dev/iwm/if_iwmreg.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/iwm/if_iwm_scan.c
==
--- stable/11/sys/dev/iwm/if_iwm_scan.c Tue Sep 13 05:41:13 2016
(r305761)
+++ stable/11/sys/dev/iwm/if_iwm_scan.c Tue Sep 13 05:47:59 2016
(r305762)
@@ -265,6 +265,7 @@ iwm_mvm_lmac_scan_fill_channels(struct i
 struct iwm_scan_channel_cfg_lmac *chan, int n_ssids)
 {
struct ieee80211com *ic = >sc_ic;
+   struct ieee80211_scan_state *ss = ic->ic_scan;
struct ieee80211_channel *c;
uint8_t nchan;
int j;
@@ -292,10 +293,11 @@ iwm_mvm_lmac_scan_fill_channels(struct i
chan->iter_count = htole16(1);
chan->iter_interval = htole32(0);
chan->flags = htole32(IWM_UNIFIED_SCAN_CHANNEL_PARTIAL);
-#if 0 /* makes scanning while associated less useful */
-   if (n_ssids != 0)
-   chan->flags |= htole32(1 << 1); /* select SSID 0 */
-#endif
+   chan->flags |= htole32(IWM_SCAN_CHANNEL_NSSIDS(n_ssids));
+   /* XXX IEEE80211_SCAN_NOBCAST flag is never set. */
+   if (!IEEE80211_IS_CHAN_PASSIVE(c) &&
+   (!(ss->ss_flags & IEEE80211_SCAN_NOBCAST) || n_ssids != 0))
+   chan->flags |= htole32(IWM_SCAN_CHANNEL_TYPE_ACTIVE);
chan++;
nchan++;
}
@@ -334,11 +336,7 @@ iwm_mvm_umac_scan_fill_channels(struct i
chan->channel_num = ieee80211_mhz2ieee(c->ic_freq, 0);
chan->iter_count = 1;
chan->iter_interval = htole16(0);
-   chan->flags = htole32(0);
-#if 0 /* makes scanning while associated less useful */
-   if (n_ssids != 0)
-   chan->flags = htole32(1 << 0); /* select SSID 0 */
-#endif
+   chan->flags = htole32(IWM_SCAN_CHANNEL_UMAC_NSSIDS(n_ssids));
chan++;
nchan++;
}
@@ -355,13 +353,11 @@ iwm_mvm_fill_probe_req(struct iwm_softc 
struct ieee80211_rateset *rs;
size_t remain = sizeof(preq->buf);
uint8_t *frm, *pos;
-   int ssid_len = 0;
-   const uint8_t *ssid = NULL;
 
memset(preq, 0, sizeof(*preq));
 
/* Ensure enough space for header and SSID IE. */
-   if (remain < sizeof(*wh) + 2 + ssid_len)
+   if (remain < sizeof(*wh) + 2)
return ENOBUFS;
 
/*
@@ -378,7 +374,7 @@ iwm_mvm_fill_probe_req(struct iwm_softc 
*(uint16_t *)>i_seq[0] = 0; /* filled by HW */
 
frm = (uint8_t *)(wh + 1);
-   frm = ieee80211_add_ssid(frm, ssid, ssid_len);
+   frm = ieee80211_add_ssid(frm, NULL, 0);
 
/* Tell the firmware where the MAC header is. */
preq->mac_header.offset = 0;
@@ -544,11 +540,11 @@ iwm_mvm_umac_scan(struct iwm_softc *sc)
.data = { NULL, },
.flags = IWM_CMD_SYNC,
};
+   struct ieee80211_scan_state *ss = sc->sc_ic.ic_scan;
struct iwm_scan_req_umac *req;
struct iwm_scan_req_umac_tail *tail;
size_t req_len;
-   int ssid_len = 0;
-   const uint8_t *ssid = NULL;
+   uint8_t i, nssid;
int ret;
 
req_len = sizeof(struct iwm_scan_req_umac) +
@@ -577,8 +573,9 @@ iwm_mvm_umac_scan(struct iwm_softc *sc)
req->scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH);
req->ooc_priority = htole32(IWM_SCAN_PRIORITY_HIGH);
 
+   nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX);
req->n_channels = iwm_mvm_umac_scan_fill_channels(sc,
-   (struct iwm_scan_channel_cfg_umac *)req->data, ssid_len != 0);
+   (struct iwm_scan_channel_cfg_umac *)req->data, nssid);
 
req->general_flags = htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL |
IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE |
@@ -589,15 +586,19 @@ iwm_mvm_umac_scan(struct iwm_softc *sc)
sc->sc_capa_n_scan_channels);
 
/* Check if we're doing an active directed scan. */
-   if (ssid_len != 0) {
-   tail->direct_scan[0].id = IEEE80211_ELEMID_SSID;
-   tail->direct_scan[0].len = ssid_len;
-   memcpy(tail->direct_scan[0].ssid, ssid, ssid_len);
+   for (i = 0; i < nssid; i++) {
+   tail->direct_scan[i].id = IEEE80211_ELEMID_SSID;
+   tail->direct_scan[i].len = MIN(ss->ss_ssid[i].len,
+   IEEE80211_NWID_LEN);
+   memcpy(tail->direct_scan[i].ssid, 

svn commit: r305761 - head/sys/dev/hyperv/netvsc

2016-09-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Sep 13 05:41:13 2016
New Revision: 305761
URL: https://svnweb.freebsd.org/changeset/base/305761

Log:
  hyperv/hn: Regroup synthetic parts attach code.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7859

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

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Sep 13 05:27:36 
2016(r305760)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Sep 13 05:41:13 
2016(r305761)
@@ -523,12 +523,40 @@ netvsc_attach(device_t dev)
goto failed;
 
/*
+* Create transaction context for NVS and RNDIS transactions.
+*/
+   sc->hn_xact = vmbus_xact_ctx_create(bus_get_dma_tag(dev),
+   HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE, 0);
+   if (sc->hn_xact == NULL)
+   goto failed;
+
+   /*
 * Attach the primary channel before attaching NVS and RNDIS.
 */
error = hn_chan_attach(sc, sc->hn_prichan);
if (error)
goto failed;
 
+   /*
+* Attach NVS and RNDIS (synthetic parts).
+*/
+   error = hv_rf_on_device_add(sc, _cnt, ETHERMTU);
+   if (error)
+   goto failed;
+
+   /*
+* Set the # of TX/RX rings that could be used according to
+* the # of channels that host offered.
+*/
+   hn_set_ring_inuse(sc, ring_cnt);
+
+   /*
+* Attach the sub-channels, if any.
+*/
+   error = hn_attach_subchans(sc);
+   if (error)
+   goto failed;
+
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = hn_ioctl;
ifp->if_init = hn_ifinit;
@@ -563,31 +591,6 @@ netvsc_attach(device_t dev)
IFCAP_LRO;
ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO;
 
-   sc->hn_xact = vmbus_xact_ctx_create(bus_get_dma_tag(dev),
-   HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE, 0);
-   if (sc->hn_xact == NULL)
-   goto failed;
-
-   error = hv_rf_on_device_add(sc, _cnt, ETHERMTU);
-   if (error)
-   goto failed;
-   KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_inuse,
-   ("invalid channel count %d, should be less than %d",
-ring_cnt, sc->hn_rx_ring_inuse));
-
-   /*
-* Set the # of TX/RX rings that could be used according to
-* the # of channels that host offered.
-*/
-   hn_set_ring_inuse(sc, ring_cnt);
-
-   /*
-* Attach the sub-channels, if any.
-*/
-   error = hn_attach_subchans(sc);
-   if (error)
-   goto failed;
-
 #if __FreeBSD_version >= 1100099
if (sc->hn_rx_ring_inuse > 1) {
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305760 - head/sys/dev/hyperv/netvsc

2016-09-12 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Sep 13 05:27:36 2016
New Revision: 305760
URL: https://svnweb.freebsd.org/changeset/base/305760

Log:
  hyperv/hn: Reorganize channel attach/detach code.
  
  This paves the way for further attach/detach code reorganization.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7858

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Sep 13 05:22:08 2016
(r305759)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Sep 13 05:27:36 2016
(r305760)
@@ -582,11 +582,6 @@ hv_nv_on_device_remove(struct hn_softc *
 {

hv_nv_disconnect_from_vsp(sc);
-
-   /* Now, we can close the channel safely */
-
-   vmbus_chan_close(sc->hn_prichan);
-
return (0);
 }
 

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Sep 13 05:22:08 
2016(r305759)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Sep 13 05:27:36 
2016(r305760)
@@ -345,8 +345,11 @@ static int hn_create_rx_data(struct hn_s
 static void hn_destroy_rx_data(struct hn_softc *sc);
 static void hn_set_chim_size(struct hn_softc *, int);
 static int hn_chan_attach(struct hn_softc *, struct vmbus_channel *);
+static void hn_chan_detach(struct hn_softc *, struct vmbus_channel *);
 static int hn_attach_subchans(struct hn_softc *);
+static void hn_detach_allchans(struct hn_softc *);
 static void hn_chan_callback(struct vmbus_channel *chan, void *xrxr);
+static void hn_set_ring_inuse(struct hn_softc *, int);
 
 static void hn_nvs_handle_notify(struct hn_softc *sc,
const struct vmbus_chanpkt_hdr *pkt);
@@ -520,7 +523,7 @@ netvsc_attach(device_t dev)
goto failed;
 
/*
-* Associate the first TX/RX ring w/ the primary channel.
+* Attach the primary channel before attaching NVS and RNDIS.
 */
error = hn_chan_attach(sc, sc->hn_prichan);
if (error)
@@ -576,17 +579,14 @@ netvsc_attach(device_t dev)
 * Set the # of TX/RX rings that could be used according to
 * the # of channels that host offered.
 */
-   if (sc->hn_tx_ring_inuse > ring_cnt)
-   sc->hn_tx_ring_inuse = ring_cnt;
-   sc->hn_rx_ring_inuse = ring_cnt;
-   device_printf(dev, "%d TX ring, %d RX ring\n",
-   sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse);
+   hn_set_ring_inuse(sc, ring_cnt);
 
-   if (sc->hn_rx_ring_inuse > 1) {
-   error = hn_attach_subchans(sc);
-   if (error)
-   goto failed;
-   }
+   /*
+* Attach the sub-channels, if any.
+*/
+   error = hn_attach_subchans(sc);
+   if (error)
+   goto failed;
 
 #if __FreeBSD_version >= 1100099
if (sc->hn_rx_ring_inuse > 1) {
@@ -669,6 +669,7 @@ netvsc_detach(device_t dev)
 */
 
hv_rf_on_device_remove(sc);
+   hn_detach_allchans(sc);
 
hn_stop_tx_tasks(sc);
 
@@ -1580,14 +1581,17 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
break;
}
 
-   /* Wait for subchannels to be destroyed */
-   vmbus_subchan_drain(sc->hn_prichan);
+   /*
+* Detach all of the channels.
+*/
+   hn_detach_allchans(sc);
 
-   sc->hn_rx_ring[0].hn_rx_flags &= ~HN_RX_FLAG_ATTACHED;
-   sc->hn_tx_ring[0].hn_tx_flags &= ~HN_TX_FLAG_ATTACHED;
-   hn_chan_attach(sc, sc->hn_prichan); /* XXX check error */
+   /*
+* Attach the primary channel before attaching NVS and RNDIS.
+*/
+   hn_chan_attach(sc, sc->hn_prichan);
 
-   ring_cnt = sc->hn_rx_ring_inuse;
+   ring_cnt = sc->hn_rx_ring_cnt;
error = hv_rf_on_device_add(sc, _cnt, ifr->ifr_mtu);
if (error) {
NV_LOCK(sc);
@@ -1595,27 +1599,17 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
NV_UNLOCK(sc);
break;
}
-   /* # of channels can _not_ be changed */
-   KASSERT(sc->hn_rx_ring_inuse == ring_cnt,
-   ("RX ring count %d and channel count %u mismatch",
-sc->hn_rx_ring_cnt, ring_cnt));
-   if (sc->hn_rx_ring_inuse > 1) {
-   int r;
 
-   /*
-* Skip the rings on primary channel; they are
-* handled by the hv_rf_on_device_add() above.
-*/
-

svn commit: r305759 - stable/10

2016-09-12 Thread Li-Wen Hsu
Author: lwhsu (ports committer)
Date: Tue Sep 13 05:22:08 2016
New Revision: 305759
URL: https://svnweb.freebsd.org/changeset/base/305759

Log:
  MFC r303935
  
  Only remove empty directories before packaging.
  
  This preserves files are intentionally empty, most of them are in tests.txz
  
  Reviewed by:  bdrewery

Modified:
  stable/10/Makefile.inc1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/Makefile.inc1
==
--- stable/10/Makefile.inc1 Tue Sep 13 02:18:29 2016(r305758)
+++ stable/10/Makefile.inc1 Tue Sep 13 05:22:08 2016(r305759)
@@ -882,7 +882,7 @@ distributeworld installworld: _installch
${IMAKEENV} rm -rf ${INSTALLTMP}
 .if make(distributeworld)
 .for dist in ${EXTRA_DISTRIBUTIONS}
-   find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
+   find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -type d -empty -delete
 .endfor
 .if defined(NO_ROOT)
 .for dist in base ${EXTRA_DISTRIBUTIONS}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305758 - head/usr.sbin/pw

2016-09-12 Thread Warren Block
Author: wblock (doc committer)
Date: Tue Sep 13 02:18:29 2016
New Revision: 305758
URL: https://svnweb.freebsd.org/changeset/base/305758

Log:
  Add another badly-needed simple example to the pw(8) man page.

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

Modified: head/usr.sbin/pw/pw.8
==
--- head/usr.sbin/pw/pw.8   Mon Sep 12 23:00:31 2016(r305757)
+++ head/usr.sbin/pw/pw.8   Tue Sep 13 02:18:29 2016(r305758)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 23, 2016
+.Dd September 12, 2016
 .Dt PW 8
 .Os
 .Sh NAME
@@ -966,6 +966,11 @@ Finally, a random password is generated 
 .Bd -literal -offset indent
 pw useradd -n gsmith -c "Glurmo Smith" -s /bin/csh -m -w random
 .Ed
+.Pp
+Delete the gsmith user and their home directory, including contents.
+.Bd -literal -offset indent
+pw userdel -n gsmith -r
+.Ed
 .Sh EXIT STATUS
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305722 - head/sys/x86/x86

2016-09-12 Thread Sepherosa Ziehau
On Mon, Sep 12, 2016 at 6:00 PM, Konstantin Belousov
 wrote:
> On Mon, Sep 12, 2016 at 04:47:35PM +0800, Sepherosa Ziehau wrote:
>> On Mon, Sep 12, 2016 at 4:39 PM, Sepherosa Ziehau  wrote:
>> > On Mon, Sep 12, 2016 at 4:32 PM, Konstantin Belousov
>> >  wrote:
>> >> On Mon, Sep 12, 2016 at 04:57:58AM +, Sepherosa Ziehau wrote:
>> >>> Author: sephe
>> >>> Date: Mon Sep 12 04:57:58 2016
>> >>> New Revision: 305722
>> >>> URL: https://svnweb.freebsd.org/changeset/base/305722
>> >>>
>> >>> Log:
>> >>>   x86: Use sx lock for interrupt sources.
>> >>>
>> >>>   - Certain pic_assign_cpu, e.g. msi_assign_cpu can have quite a long
>> >>> call chain.  For msi_assign_cpu, mutex makes complex PCI bridge
>> >>> drivers more tricky, e.g. sleep can note be called, etc, it will
>> >>> be pretty tricky for upcoming Hyper-V PCI bridge driver for PCI
>> >>> pass-through.
>> >>
>> >>>   - It is not used on any hot code path nor non-sleepable context, so
>> >>> sx should have the same effect as mutex.
>> >> Did you tested ACPI_DMAR interrupt remapping mode with your patch and
>> >> witness enabled ?
>> >
>> > Nope, I am about to try it now.  BTW, I just checked the code for
>> > ACPI_DMAR, I didn't see anything obviously w/ the lock type change
>> > though.
>>
>> I didn't notice anything wrong w/ options
>> ACPI_DMAR+WITNESS+INVARIANTS.  If you saw anything wrong, please let
>> me know.
>
> Options are not enough, you should explicitely enable interrupt remapping
> with loader tunable hw.dmar.ir=1.

Still didn't find anything wrong with this tunable set.

Thanks,
sephe

-- 
Tomorrow Will Never Die
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305757 - head/sys/net80211

2016-09-12 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Sep 12 23:00:31 2016
New Revision: 305757
URL: https://svnweb.freebsd.org/changeset/base/305757

Log:
  net80211: fix possible panic in adhoc mode (INIT -> RUN state transition).
  
  In case if there is already running interface, a second non-sta
  interface will omit scanning, going directly to RUN state. Handle
  this case for adhoc mode appropriately.
  
  Tested with RTL8821AU, 2 vaps in IBSS mode.

Modified:
  head/sys/net80211/ieee80211_adhoc.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Mon Sep 12 22:46:19 2016
(r305756)
+++ head/sys/net80211/ieee80211_adhoc.c Mon Sep 12 23:00:31 2016
(r305757)
@@ -215,6 +215,19 @@ adhoc_newstate(struct ieee80211vap *vap,
/* XXX validate prerequisites */
}
switch (ostate) {
+   case IEEE80211_S_INIT:
+   /*
+* Already have a channel; bypass the
+* scan and startup immediately.
+* Note that ieee80211_create_ibss will call
+* back to do a RUN->RUN state change.
+*/
+   ieee80211_create_ibss(vap,
+   ieee80211_ht_adjust_channel(ic,
+   ic->ic_curchan, vap->iv_flags_ht));
+   /* NB: iv_bss is changed on return */
+   ni = vap->iv_bss;
+   break;
case IEEE80211_S_SCAN:
 #ifdef IEEE80211_DEBUG
if (ieee80211_msg_debug(vap)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305756 - in head/sys: kern sys

2016-09-12 Thread Mariusz Zaborski
Author: oshogbo
Date: Mon Sep 12 22:46:19 2016
New Revision: 305756
URL: https://svnweb.freebsd.org/changeset/base/305756

Log:
  fd: add fget_cap and fget_cap_locked primitives
  
  They can be used to obtain capabilities along with a referenced fp.
  
  Reviewed by:  mjg@

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/sys/filedesc.h

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cMon Sep 12 22:07:35 2016
(r305755)
+++ head/sys/kern/kern_descrip.cMon Sep 12 22:46:19 2016
(r305756)
@@ -2446,6 +2446,77 @@ finit(struct file *fp, u_int flag, short
 }
 
 int
+fget_cap_locked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
+struct file **fpp, struct filecaps *havecapsp)
+{
+   struct filedescent *fde;
+   int error;
+
+   FILEDESC_LOCK_ASSERT(fdp);
+
+   fde = fdeget_locked(fdp, fd);
+   if (fde == NULL) {
+   error = EBADF;
+   goto out;
+   }
+
+#ifdef CAPABILITIES
+   error = cap_check(cap_rights_fde(fde), needrightsp);
+   if (error != 0)
+   goto out;
+#endif
+
+   if (havecapsp != NULL)
+   filecaps_copy(>fde_caps, havecapsp, true);
+
+   fhold(fde->fde_file);
+   *fpp = fde->fde_file;
+
+   error = 0;
+out:
+   return (error);
+}
+
+int
+fget_cap(struct thread *td, int fd, cap_rights_t *needrightsp,
+struct file **fpp, struct filecaps *havecapsp)
+{
+   struct filedesc *fdp;
+   struct file *fp;
+   int error;
+   seq_t seq;
+
+   fdp = td->td_proc->p_fd;
+   for (;;) {
+   error = fget_unlocked(fdp, fd, needrightsp, , );
+   if (error != 0)
+   return (error);
+
+   if (havecapsp != NULL) {
+   if (!filecaps_copy(>fd_ofiles[fd].fde_caps,
+   havecapsp, false)) {
+   fdrop(fp, td);
+   goto get_locked;
+   }
+   }
+
+   if (!fd_modified(fdp, fd, seq))
+   break;
+   fdrop(fp, td);
+   }
+
+   *fpp = fp;
+   return (0);
+
+get_locked:
+   FILEDESC_SLOCK(fdp);
+   error = fget_cap_locked(fdp, fd, needrightsp, fpp, havecapsp);
+   FILEDESC_SUNLOCK(fdp);
+
+   return (error);
+}
+
+int
 fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
 struct file **fpp, seq_t *seqp)
 {

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Mon Sep 12 22:07:35 2016(r305755)
+++ head/sys/sys/filedesc.h Mon Sep 12 22:46:19 2016(r305756)
@@ -190,6 +190,11 @@ intgetvnode(struct thread *td, int fd, 
struct file **fpp);
 void   mountcheckdirs(struct vnode *olddp, struct vnode *newdp);
 
+intfget_cap_locked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
+   struct file **fpp, struct filecaps *havecapsp);
+intfget_cap(struct thread *td, int fd, cap_rights_t *needrightsp,
+   struct file **fpp, struct filecaps *havecapsp);
+
 /* Return a referenced file from an unlocked descriptor. */
 intfget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
struct file **fpp, seq_t *seqp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305755 - in stable/10: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive

2016-09-12 Thread Martin Matuska
Author: mm
Date: Mon Sep 12 22:07:35 2016
New Revision: 305755
URL: https://svnweb.freebsd.org/changeset/base/305755

Log:
  MFC r305422:
  Sync libarchive with vendor
  
  Vendor issues fixed:
  PR #777: Multiple bugfixes for setup_acls()
  
  This includes a bugfix for a bug that caused ACLs not to be read properly
  for files and directories inside subdirectories and as a result not being
  stored or being incorrectly stored in tar archives.

Added:
  stable/10/contrib/libarchive/README.md
 - copied unchanged from r305422, head/contrib/libarchive/README.md
Deleted:
  stable/10/contrib/libarchive/README
Modified:
  stable/10/contrib/libarchive/libarchive/archive_acl.c
  stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
  stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c
  stable/10/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c
  stable/10/lib/libarchive/config_freebsd.h
Directory Properties:
  stable/10/   (props changed)

Copied: stable/10/contrib/libarchive/README.md (from r305422, 
head/contrib/libarchive/README.md)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/contrib/libarchive/README.md  Mon Sep 12 22:07:35 2016
(r305755, copy of r305422, head/contrib/libarchive/README.md)
@@ -0,0 +1,222 @@
+# Welcome to libarchive!
+
+The libarchive project develops a portable, efficient C library that
+can read and write streaming archives in a variety of formats.  It
+also includes implementations of the common `tar`, `cpio`, and `zcat`
+command-line tools that use the libarchive library.
+
+## Questions?  Issues?
+
+* http://www.libarchive.org is the home for ongoing
+  libarchive development, including documentation,
+  and links to the libarchive mailing lists.
+* To report an issue, use the issue tracker at
+  https://github.com/libarchive/libarchive/issues
+* To submit an enhancement to libarchive, please
+  submit a pull request via GitHub: 
https://github.com/libarchive/libarchive/pulls
+
+## Contents of the Distribution
+
+This distribution bundle includes the following major components:
+
+* **libarchive**: a library for reading and writing streaming archives
+* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built 
on libarchive
+* **cpio**: the 'bsdcpio' program is a different interface to essentially the 
same functionality
+* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, 
xzcat, and such
+* **examples**: Some small example programs that you may find useful.
+* **examples/minitar**: a compact sample demonstrating use of libarchive.
+* **contrib**:  Various items sent to me by third parties; please contact the 
authors with any questions.
+
+The top-level directory contains the following information files:
+
+* **NEWS** - highlights of recent changes
+* **COPYING** - what you can do with this
+* **INSTALL** - installation instructions
+* **README** - this file
+* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL
+* **configure** - configuration script, see INSTALL for details.  If your copy 
of the source lacks a `configure` script, you can try to construct it by 
running the script in `build/autogen.sh` (or use `cmake`).
+
+The following files in the top-level directory are used by the 'configure' 
script:
+* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this 
distribution, only needed by maintainers
+* `Makefile.in`, `config.h.in` - templates used by configure script
+
+## Documentation
+
+In addition to the informational articles and documentation
+in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki),
+the distribution also includes a number of manual pages:
+
+ * bsdtar.1 explains the use of the bsdtar program
+ * bsdcpio.1 explains the use of the bsdcpio program
+ * bsdcat.1 explains the use of the bsdcat program
+ * libarchive.3 gives an overview of the library as a whole
+ * archive_read.3, archive_write.3, archive_write_disk.3, and
+   archive_read_disk.3 provide detailed calling sequences for the read
+   and write APIs
+ * archive_entry.3 details the "struct archive_entry" utility class
+ * archive_internals.3 provides some insight into libarchive's
+   internal structure and operation.
+ * libarchive-formats.5 documents the file formats supported by the library
+ * cpio.5, mtree.5, and tar.5 provide detailed information about these
+   popular archive formats, including hard-to-find details about
+   modern cpio and tar variants.
+
+The manual pages above are provided in the 'doc' directory in
+a number of different formats.
+
+You should also read the copious comments in `archive.h` and the
+source code for the sample programs for more details.  Please let us
+know about any errors or omissions you find.
+
+## Supported Formats
+
+Currently, the library automatically detects and reads the following 

svn commit: r305754 - in stable/11: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive

2016-09-12 Thread Martin Matuska
Author: mm
Date: Mon Sep 12 22:07:00 2016
New Revision: 305754
URL: https://svnweb.freebsd.org/changeset/base/305754

Log:
  MFC r305422:
  Sync libarchive with vendor
  
  Vendor issues fixed:
  PR #777: Multiple bugfixes for setup_acls()
  
  This includes a bugfix for a bug that caused ACLs not to be read properly
  for files and directories inside subdirectories and as a result not being
  stored or being incorrectly stored in tar archives.

Added:
  stable/11/contrib/libarchive/README.md
 - copied unchanged from r305422, head/contrib/libarchive/README.md
Deleted:
  stable/11/contrib/libarchive/README
Modified:
  stable/11/contrib/libarchive/libarchive/archive_acl.c
  stable/11/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
  stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c
  stable/11/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c
  stable/11/lib/libarchive/config_freebsd.h
Directory Properties:
  stable/11/   (props changed)

Copied: stable/11/contrib/libarchive/README.md (from r305422, 
head/contrib/libarchive/README.md)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/contrib/libarchive/README.md  Mon Sep 12 22:07:00 2016
(r305754, copy of r305422, head/contrib/libarchive/README.md)
@@ -0,0 +1,222 @@
+# Welcome to libarchive!
+
+The libarchive project develops a portable, efficient C library that
+can read and write streaming archives in a variety of formats.  It
+also includes implementations of the common `tar`, `cpio`, and `zcat`
+command-line tools that use the libarchive library.
+
+## Questions?  Issues?
+
+* http://www.libarchive.org is the home for ongoing
+  libarchive development, including documentation,
+  and links to the libarchive mailing lists.
+* To report an issue, use the issue tracker at
+  https://github.com/libarchive/libarchive/issues
+* To submit an enhancement to libarchive, please
+  submit a pull request via GitHub: 
https://github.com/libarchive/libarchive/pulls
+
+## Contents of the Distribution
+
+This distribution bundle includes the following major components:
+
+* **libarchive**: a library for reading and writing streaming archives
+* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built 
on libarchive
+* **cpio**: the 'bsdcpio' program is a different interface to essentially the 
same functionality
+* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, 
xzcat, and such
+* **examples**: Some small example programs that you may find useful.
+* **examples/minitar**: a compact sample demonstrating use of libarchive.
+* **contrib**:  Various items sent to me by third parties; please contact the 
authors with any questions.
+
+The top-level directory contains the following information files:
+
+* **NEWS** - highlights of recent changes
+* **COPYING** - what you can do with this
+* **INSTALL** - installation instructions
+* **README** - this file
+* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL
+* **configure** - configuration script, see INSTALL for details.  If your copy 
of the source lacks a `configure` script, you can try to construct it by 
running the script in `build/autogen.sh` (or use `cmake`).
+
+The following files in the top-level directory are used by the 'configure' 
script:
+* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this 
distribution, only needed by maintainers
+* `Makefile.in`, `config.h.in` - templates used by configure script
+
+## Documentation
+
+In addition to the informational articles and documentation
+in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki),
+the distribution also includes a number of manual pages:
+
+ * bsdtar.1 explains the use of the bsdtar program
+ * bsdcpio.1 explains the use of the bsdcpio program
+ * bsdcat.1 explains the use of the bsdcat program
+ * libarchive.3 gives an overview of the library as a whole
+ * archive_read.3, archive_write.3, archive_write_disk.3, and
+   archive_read_disk.3 provide detailed calling sequences for the read
+   and write APIs
+ * archive_entry.3 details the "struct archive_entry" utility class
+ * archive_internals.3 provides some insight into libarchive's
+   internal structure and operation.
+ * libarchive-formats.5 documents the file formats supported by the library
+ * cpio.5, mtree.5, and tar.5 provide detailed information about these
+   popular archive formats, including hard-to-find details about
+   modern cpio and tar variants.
+
+The manual pages above are provided in the 'doc' directory in
+a number of different formats.
+
+You should also read the copious comments in `archive.h` and the
+source code for the sample programs for more details.  Please let us
+know about any errors or omissions you find.
+
+## Supported Formats
+
+Currently, the library automatically detects and reads the following 

Re: svn commit: r305745 - head/sys/dev/urtwn

2016-09-12 Thread Adrian Chadd
Ah, ugh, that thing.. :(


-adrian

On 12 September 2016 at 11:40, Andriy Voskoboinyk  wrote:
> Mon, 12 Sep 2016 21:10:54 +0300 було написано Adrian Chadd
> :
>
> Hi,
>
> The error handling is splitted between ieee80211_raw_output() and
> ic_raw_xmit();
> it cannot be moved completely to net80211 because of
> https://lists.freebsd.org/pipermail/freebsd-wireless/2015-November/006272.html
>
>
>> Hi,
>>
>> That's why I created ieee80211_tx_complete(). Is that not "right" here?
>>
>>
>>
>> -a
>>
>>
>> On 12 September 2016 at 09:46, Andriy Voskoboinyk 
>> wrote:
>>>
>>> Author: avos
>>> Date: Mon Sep 12 16:46:14 2016
>>> New Revision: 305745
>>> URL: https://svnweb.freebsd.org/changeset/base/305745
>>>
>>> Log:
>>>   urtwn: fix possible driver hang when beacon miss is detected.
>>>
>>> Modified:
>>>   head/sys/dev/urtwn/if_urtwn.c
>>>
>>> Modified: head/sys/dev/urtwn/if_urtwn.c
>>>
>>> ==
>>> --- head/sys/dev/urtwn/if_urtwn.c   Mon Sep 12 16:44:21 2016
>>> (r305744)
>>> +++ head/sys/dev/urtwn/if_urtwn.c   Mon Sep 12 16:46:14 2016
>>> (r305745)
>>> @@ -5628,8 +5628,11 @@ urtwn_raw_xmit(struct ieee80211_node *ni
>>> callout_reset(>sc_watchdog_ch, hz, urtwn_watchdog, sc);
>>>
>>>  end:
>>> -   if (error != 0)
>>> +   if (error != 0) {
>>> +   if (m->m_flags & M_TXCB)
>>> +   ieee80211_process_callback(ni, m, 1);
>>> m_freem(m);
>>> +   }
>>>
>>> URTWN_UNLOCK(sc);
>>>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r305753 - head/usr.sbin/amd/amd

2016-09-12 Thread Cy Schubert
Author: cy
Date: Mon Sep 12 19:31:14 2016
New Revision: 305753
URL: https://svnweb.freebsd.org/changeset/base/305753

Log:
  Fixup whitespace, repace space with a tab.
  
  X-MFC-with:   Upcoming amd update.

Modified:
  head/usr.sbin/amd/amd/Makefile

Modified: head/usr.sbin/amd/amd/Makefile
==
--- head/usr.sbin/amd/amd/Makefile  Mon Sep 12 18:07:06 2016
(r305752)
+++ head/usr.sbin/amd/amd/Makefile  Mon Sep 12 19:31:14 2016
(r305753)
@@ -8,7 +8,7 @@
 
 .include 
 
-.PATH: ${.CURDIR}/../../../contrib/amd/amd
+.PATH: ${.CURDIR}/../../../contrib/amd/amd
 
 PROG=  amd
 MAN=   amd.8
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305745 - head/sys/dev/urtwn

2016-09-12 Thread Andriy Voskoboinyk
Mon, 12 Sep 2016 21:10:54 +0300 було написано Adrian Chadd  
:


Hi,

The error handling is splitted between ieee80211_raw_output() and  
ic_raw_xmit();

it cannot be moved completely to net80211 because of
https://lists.freebsd.org/pipermail/freebsd-wireless/2015-November/006272.html


Hi,

That's why I created ieee80211_tx_complete(). Is that not "right" here?



-a


On 12 September 2016 at 09:46, Andriy Voskoboinyk   
wrote:

Author: avos
Date: Mon Sep 12 16:46:14 2016
New Revision: 305745
URL: https://svnweb.freebsd.org/changeset/base/305745

Log:
  urtwn: fix possible driver hang when beacon miss is detected.

Modified:
  head/sys/dev/urtwn/if_urtwn.c

Modified: head/sys/dev/urtwn/if_urtwn.c
==
--- head/sys/dev/urtwn/if_urtwn.c   Mon Sep 12 16:44:21 2016 
(r305744)
+++ head/sys/dev/urtwn/if_urtwn.c   Mon Sep 12 16:46:14 2016 
(r305745)

@@ -5628,8 +5628,11 @@ urtwn_raw_xmit(struct ieee80211_node *ni
callout_reset(>sc_watchdog_ch, hz, urtwn_watchdog, sc);

 end:
-   if (error != 0)
+   if (error != 0) {
+   if (m->m_flags & M_TXCB)
+   ieee80211_process_callback(ni, m, 1);
m_freem(m);
+   }

URTWN_UNLOCK(sc);


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r305745 - head/sys/dev/urtwn

2016-09-12 Thread Adrian Chadd
Hi,

That's why I created ieee80211_tx_complete(). Is that not "right" here?



-a


On 12 September 2016 at 09:46, Andriy Voskoboinyk  wrote:
> Author: avos
> Date: Mon Sep 12 16:46:14 2016
> New Revision: 305745
> URL: https://svnweb.freebsd.org/changeset/base/305745
>
> Log:
>   urtwn: fix possible driver hang when beacon miss is detected.
>
> Modified:
>   head/sys/dev/urtwn/if_urtwn.c
>
> Modified: head/sys/dev/urtwn/if_urtwn.c
> ==
> --- head/sys/dev/urtwn/if_urtwn.c   Mon Sep 12 16:44:21 2016
> (r305744)
> +++ head/sys/dev/urtwn/if_urtwn.c   Mon Sep 12 16:46:14 2016
> (r305745)
> @@ -5628,8 +5628,11 @@ urtwn_raw_xmit(struct ieee80211_node *ni
> callout_reset(>sc_watchdog_ch, hz, urtwn_watchdog, sc);
>
>  end:
> -   if (error != 0)
> +   if (error != 0) {
> +   if (m->m_flags & M_TXCB)
> +   ieee80211_process_callback(ni, m, 1);
> m_freem(m);
> +   }
>
> URTWN_UNLOCK(sc);
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-09-12 Thread John Baldwin
Author: jhb
Date: Mon Sep 12 18:07:06 2016
New Revision: 305752
URL: https://svnweb.freebsd.org/changeset/base/305752

Log:
  Remove explicit device_verbose() from the t4iov driver detach routine
  now that this case is handled generically.

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

Modified: head/sys/dev/cxgbe/t4_iov.c
==
--- head/sys/dev/cxgbe/t4_iov.c Mon Sep 12 18:06:42 2016(r305751)
+++ head/sys/dev/cxgbe/t4_iov.c Mon Sep 12 18:07:06 2016(r305752)
@@ -217,7 +217,6 @@ t4iov_detach(device_t dev)
if (error)
return (error);
}
-   device_verbose(dev);
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305751 - in head: share/man/man9 sys/kern

2016-09-12 Thread John Baldwin
Author: jhb
Date: Mon Sep 12 18:06:42 2016
New Revision: 305751
URL: https://svnweb.freebsd.org/changeset/base/305751

Log:
  Make device_quiet() an attachment property.
  
  In particular, reset the DF_QUIET flag when detaching from a device so
  that a driver that marks a device quiet doesn't dictate policy for a
  different driver that may claim the device in the future.
  
  Reviewed by:  rpokala, wblock
  MFC after:2 weeks
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D7803

Modified:
  head/share/man/man9/device_quiet.9
  head/sys/kern/subr_bus.c

Modified: head/share/man/man9/device_quiet.9
==
--- head/share/man/man9/device_quiet.9  Mon Sep 12 17:35:45 2016
(r305750)
+++ head/share/man/man9/device_quiet.9  Mon Sep 12 18:06:42 2016
(r305751)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 21, 1999
+.Dd September 12, 2016
 .Dt DEVICE_QUIET 9
 .Os
 .Sh NAME
@@ -49,16 +49,18 @@
 Each device has a quiet flag associated with it.
 A device is
 verbose by default when it is created but may be quieted to prevent
-the device identification string to be printed during probe.
+printing of the device identification string during attach
+and printing of a message during detach.
 To quiet a device, call
-.Fn device_quiet ,
-to re-enable to probe message (to make the message appear again, for
-example after a
-.Xr device_detach 9 )
+.Fn device_quiet
+during a device driver probe routine.
+To re-enable probe messages,
 call
 .Fn device_verbose .
 To test to see if a device is quieted, call
 .Fn device_is_quiet .
+.Pp
+Devices are implicitly marked verbose after a driver detaches.
 .Sh SEE ALSO
 .Xr device 9
 .Sh AUTHORS

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cMon Sep 12 17:35:45 2016(r305750)
+++ head/sys/kern/subr_bus.cMon Sep 12 18:06:42 2016(r305751)
@@ -2146,6 +2146,12 @@ device_probe_child(device_t dev, device_
}
 
/*
+* Reset DF_QUIET in case this driver doesn't
+* end up as the best driver.
+*/
+   device_verbose(child);
+
+   /*
 * Probes that return BUS_PROBE_NOWILDCARD or lower
 * only match on devices whose driver was explicitly
 * specified.
@@ -2970,6 +2976,7 @@ device_detach(device_t dev)
if (!(dev->flags & DF_FIXEDCLASS))
devclass_delete_device(dev->devclass, dev);
 
+   device_verbose(dev);
dev->state = DS_NOTPRESENT;
(void)device_set_driver(dev, NULL);
device_sysctl_fini(dev);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305750 - in stable/10/usr.sbin/pw: . tests

2016-09-12 Thread Alan Somers
Author: asomers
Date: Mon Sep 12 17:35:45 2016
New Revision: 305750
URL: https://svnweb.freebsd.org/changeset/base/305750

Log:
  MFC r302778
  
  pw should sanitize the argument of -w.
  
  Otherwise, it will silently disable the login for the selected account if
  the argument is unrecognizable.
  
  usr.sbin/pw/pw.h
  usr.sbin/pw/pw_conf.c
  usr.sbin/pw/pw_user.c
  Use separate rules to validate boolean parameters and passwd
  parameters.  Error out if a password parameter cannot be parsed.
  
  usr.sbin/pw/tests/Makefile
  usr.sbin/pw/tests/crypt.c
  usr.sbin/pw/tests/pw_useradd.sh
  usr.sbin/pw/tests/pw_usermod.sh
  Add tests for the validation.  Also, enhance existing
  password-related tests to actually validate that the correct hash is
  written to master.passwd.

Added:
  stable/10/usr.sbin/pw/tests/crypt.c
 - copied unchanged from r302778, head/usr.sbin/pw/tests/crypt.c
Modified:
  stable/10/usr.sbin/pw/pw.h
  stable/10/usr.sbin/pw/pw_conf.c
  stable/10/usr.sbin/pw/pw_user.c
  stable/10/usr.sbin/pw/tests/Makefile
  stable/10/usr.sbin/pw/tests/pw_useradd.sh
  stable/10/usr.sbin/pw/tests/pw_usermod.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/pw/pw.h
==
--- stable/10/usr.sbin/pw/pw.h  Mon Sep 12 17:29:20 2016(r305749)
+++ stable/10/usr.sbin/pw/pw.h  Mon Sep 12 17:35:45 2016(r305750)
@@ -93,6 +93,7 @@ int groupadd(struct userconf *, char *na
 int nis_update(void);
 
 int boolean_val(char const * str, int dflt);
+int passwd_val(char const * str, int dflt);
 char const *boolean_str(int val);
 char *newstr(char const * p);
 

Modified: stable/10/usr.sbin/pw/pw_conf.c
==
--- stable/10/usr.sbin/pw/pw_conf.c Mon Sep 12 17:29:20 2016
(r305749)
+++ stable/10/usr.sbin/pw/pw_conf.c Mon Sep 12 17:35:45 2016
(r305750)
@@ -186,6 +186,22 @@ boolean_val(char const * str, int dflt)
for (i = 0; boolfalse[i]; i++)
if (strcmp(str, boolfalse[i]) == 0)
return 0;
+   }
+   return dflt;
+}
+
+int
+passwd_val(char const * str, int dflt)
+{
+   if ((str = unquote(str)) != NULL) {
+   int i;
+
+   for (i = 0; booltrue[i]; i++)
+   if (strcmp(str, booltrue[i]) == 0)
+   return 1;
+   for (i = 0; boolfalse[i]; i++)
+   if (strcmp(str, boolfalse[i]) == 0)
+   return 0;
 
/*
 * Special cases for defaultpassword
@@ -194,6 +210,8 @@ boolean_val(char const * str, int dflt)
return -1;
if (strcmp(str, "none") == 0)
return -2;
+
+   errx(1, "Invalid value for default password");
}
return dflt;
 }
@@ -258,7 +276,7 @@ read_userconfig(char const * file)
 #endif
switch (i) {
case _UC_DEFAULTPWD:
-   config.default_password = boolean_val(q, 1);
+   config.default_password = passwd_val(q, 1);
break;
case _UC_REUSEUID:
config.reuse_uids = boolean_val(q, 0);

Modified: stable/10/usr.sbin/pw/pw_user.c
==
--- stable/10/usr.sbin/pw/pw_user.c Mon Sep 12 17:29:20 2016
(r305749)
+++ stable/10/usr.sbin/pw/pw_user.c Mon Sep 12 17:35:45 2016
(r305750)
@@ -1317,7 +1317,7 @@ pw_user_add(int argc, char **argv, char 
 
mix_config(cmdcnf, cnf);
if (default_passwd)
-   cmdcnf->default_password = boolean_val(default_passwd,
+   cmdcnf->default_password = passwd_val(default_passwd,
cnf->default_password);
if (genconf) {
if (name != NULL)
@@ -1719,7 +1719,7 @@ pw_user_mod(int argc, char **argv, char 
if (lc == NULL || login_setcryptfmt(lc, "sha512", NULL) == NULL)
warn("setting crypt(3) format");
login_close(lc);
-   cnf->default_password = boolean_val(passwd,
+   cnf->default_password = passwd_val(passwd,
cnf->default_password);
pwd->pw_passwd = pw_password(cnf, pwd->pw_name, dryrun);
edited = true;

Modified: stable/10/usr.sbin/pw/tests/Makefile
==
--- stable/10/usr.sbin/pw/tests/MakefileMon Sep 12 17:29:20 2016
(r305749)
+++ stable/10/usr.sbin/pw/tests/MakefileMon Sep 12 17:35:45 2016
(r305750)
@@ -2,6 +2,11 @@
 
 TESTSDIR=  

svn commit: r305749 - head/sys/dev/evdev

2016-09-12 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Sep 12 17:29:20 2016
New Revision: 305749
URL: https://svnweb.freebsd.org/changeset/base/305749

Log:
  Remove semicolon from the end of the macro definition
  
  Reported by: hans

Modified:
  head/sys/dev/evdev/cdev.c
  head/sys/dev/evdev/uinput.c

Modified: head/sys/dev/evdev/cdev.c
==
--- head/sys/dev/evdev/cdev.c   Mon Sep 12 17:05:42 2016(r305748)
+++ head/sys/dev/evdev/cdev.c   Mon Sep 12 17:29:20 2016(r305749)
@@ -49,7 +49,7 @@
 #include 
 
 #ifdef EVDEV_DEBUG
-#definedebugf(client, fmt, args...)printf("evdev cdev: "fmt"\n", 
##args);
+#definedebugf(client, fmt, args...)printf("evdev cdev: "fmt"\n", 
##args)
 #else
 #definedebugf(client, fmt, args...)
 #endif

Modified: head/sys/dev/evdev/uinput.c
==
--- head/sys/dev/evdev/uinput.c Mon Sep 12 17:05:42 2016(r305748)
+++ head/sys/dev/evdev/uinput.c Mon Sep 12 17:29:20 2016(r305749)
@@ -50,7 +50,7 @@
 #include 
 
 #ifdef UINPUT_DEBUG
-#definedebugf(state, fmt, args...) printf("uinput: " fmt "\n", 
##args);
+#definedebugf(state, fmt, args...) printf("uinput: " fmt "\n", 
##args)
 #else
 #definedebugf(state, fmt, args...)
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305748 - stable/10/cddl/lib/libdtrace

2016-09-12 Thread George V. Neville-Neil
Author: gnn
Date: Mon Sep 12 17:05:42 2016
New Revision: 305748
URL: https://svnweb.freebsd.org/changeset/base/305748

Log:
  MFC: 304825
  Unlike Solaris, in FreeBSD p_args can be 0 so check for that
  instead of walking down to ar_args blindly.
  
  Reported by:  Amanda Strnad
  Reviewed by:  markj, jhb
  Sponsored by: DARPA, AFRL

Modified:
  stable/10/cddl/lib/libdtrace/psinfo.d
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/lib/libdtrace/psinfo.d
==
--- stable/10/cddl/lib/libdtrace/psinfo.d   Mon Sep 12 17:02:22 2016
(r305747)
+++ stable/10/cddl/lib/libdtrace/psinfo.d   Mon Sep 12 17:05:42 2016
(r305748)
@@ -57,7 +57,7 @@ translator psinfo_t < struct proc *T > {
pr_gid = T->p_ucred->cr_rgid;
pr_egid = T->p_ucred->cr_groups[0];
pr_addr = 0;
-   pr_psargs = (T->p_args->ar_args == 0) ? "" :
+   pr_psargs = (T->p_args == 0) ? "" :
memstr(T->p_args->ar_args, ' ', T->p_args->ar_length);
pr_arglen = T->p_args->ar_length;
pr_jailid = T->p_ucred->cr_prison->pr_id;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305747 - stable/11/cddl/lib/libdtrace

2016-09-12 Thread George V. Neville-Neil
Author: gnn
Date: Mon Sep 12 17:02:22 2016
New Revision: 305747
URL: https://svnweb.freebsd.org/changeset/base/305747

Log:
  MFC: 304825
  Unlike Solaris, in FreeBSD p_args can be 0 so check for that
  instead of walking down to ar_args blindly.
  
  Reported by:  Amanda Strnad
  Reviewed by:  markj, jhb
  Sponsored by: DARPA, AFRL

Modified:
  stable/11/cddl/lib/libdtrace/psinfo.d
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/lib/libdtrace/psinfo.d
==
--- stable/11/cddl/lib/libdtrace/psinfo.d   Mon Sep 12 16:55:16 2016
(r305746)
+++ stable/11/cddl/lib/libdtrace/psinfo.d   Mon Sep 12 17:02:22 2016
(r305747)
@@ -59,7 +59,7 @@ translator psinfo_t < struct proc *T > {
pr_gid = T->p_ucred->cr_rgid;
pr_egid = T->p_ucred->cr_groups[0];
pr_addr = 0;
-   pr_psargs = (T->p_args->ar_args == 0) ? "" :
+   pr_psargs = (T->p_args == 0) ? "" :
memstr(T->p_args->ar_args, ' ', T->p_args->ar_length);
pr_arglen = T->p_args->ar_length;
pr_jailid = T->p_ucred->cr_prison->pr_id;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305746 - stable/10/etc/periodic/daily

2016-09-12 Thread Alan Somers
Author: asomers
Date: Mon Sep 12 16:55:16 2016
New Revision: 305746
URL: https://svnweb.freebsd.org/changeset/base/305746

Log:
  MFC r304162
  
  Decrease the anti-congestion sleep in 480.leapfile-ntpd to 1 hour
  
  24 hours is too long. Periodic scripts are executed serially, so when
  combined with the sleep in 410.pkg-audit periodic could actually take more
  than 24 hours and block the next invocation.

Modified:
  stable/10/etc/periodic/daily/480.leapfile-ntpd
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/periodic/daily/480.leapfile-ntpd
==
--- stable/10/etc/periodic/daily/480.leapfile-ntpd  Mon Sep 12 16:46:14 
2016(r305745)
+++ stable/10/etc/periodic/daily/480.leapfile-ntpd  Mon Sep 12 16:55:16 
2016(r305746)
@@ -16,7 +16,7 @@ case "$daily_ntpd_leapfile_enable" in
case "$daily_ntpd_avoid_congestion" in
[Yy][Ee][Ss])
# Avoid dogpiling
-   (sleep $(jot -r 1 0 86400); service ntpd onefetch) &
+   (sleep $(jot -r 1 0 3600); service ntpd onefetch) &
;;
*)
service ntpd onefetch
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305745 - head/sys/dev/urtwn

2016-09-12 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Sep 12 16:46:14 2016
New Revision: 305745
URL: https://svnweb.freebsd.org/changeset/base/305745

Log:
  urtwn: fix possible driver hang when beacon miss is detected.

Modified:
  head/sys/dev/urtwn/if_urtwn.c

Modified: head/sys/dev/urtwn/if_urtwn.c
==
--- head/sys/dev/urtwn/if_urtwn.c   Mon Sep 12 16:44:21 2016
(r305744)
+++ head/sys/dev/urtwn/if_urtwn.c   Mon Sep 12 16:46:14 2016
(r305745)
@@ -5628,8 +5628,11 @@ urtwn_raw_xmit(struct ieee80211_node *ni
callout_reset(>sc_watchdog_ch, hz, urtwn_watchdog, sc);
 
 end:
-   if (error != 0)
+   if (error != 0) {
+   if (m->m_flags & M_TXCB)
+   ieee80211_process_callback(ni, m, 1);
m_freem(m);
+   }
 
URTWN_UNLOCK(sc);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305744 - head/sys/x86/x86

2016-09-12 Thread Konstantin Belousov
Author: kib
Date: Mon Sep 12 16:44:21 2016
New Revision: 305744
URL: https://svnweb.freebsd.org/changeset/base/305744

Log:
  Fix typo in comment.
  
  MFC after:3 days

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

Modified: head/sys/x86/x86/identcpu.c
==
--- head/sys/x86/x86/identcpu.c Mon Sep 12 16:38:51 2016(r305743)
+++ head/sys/x86/x86/identcpu.c Mon Sep 12 16:44:21 2016(r305744)
@@ -1725,7 +1725,7 @@ print_AMD_info(void)
 * As long as that bug pops up very rarely (intensive machine usage
 * on other operating systems generally generates one unexplainable
 * crash any 2 months) and as long as a model specific fix would be
-* impratical at this stage, print out a warning string if the broken
+* impractical at this stage, print out a warning string if the broken
 * model and family are identified.
 */
if (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x20 &&
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305743 - in head/sys/mips: malta mips

2016-09-12 Thread Ruslan Bukin
Author: br
Date: Mon Sep 12 16:38:51 2016
New Revision: 305743
URL: https://svnweb.freebsd.org/changeset/base/305743

Log:
  Add SMP support for MTI Malta 34kf CPU.
  
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5

Modified:
  head/sys/mips/malta/asm_malta.S
  head/sys/mips/malta/malta_mp.c
  head/sys/mips/mips/locore.S

Modified: head/sys/mips/malta/asm_malta.S
==
--- head/sys/mips/malta/asm_malta.S Mon Sep 12 16:36:44 2016
(r305742)
+++ head/sys/mips/malta/asm_malta.S Mon Sep 12 16:38:51 2016
(r305743)
@@ -37,6 +37,7 @@
 #include 
 
 #defineVPECONF0_MVP(1 << 1)
+#defineVPECONF0_VPA(1 << 0)
 
.set noreorder
 
@@ -54,16 +55,16 @@ LEAF(platform_processor_id)
.set pop
 END(platform_processor_id)
 
-LEAF(enable_mvp)
+LEAF(malta_cpu_configure)
.set push
.set mips32r2
.set noat
-   li  t2, (VPECONF0_MVP)
+   li  t2, (VPECONF0_MVP | VPECONF0_VPA)
move$1, t2
jr  ra
.word   0x4181 | (1 << 11) | 2  # mttc0 t2, $1, 2
.set pop
-END(enable_mvp)
+END(malta_cpu_configure)
 
 /*
  * Called on APs to wait until they are told to launch.

Modified: head/sys/mips/malta/malta_mp.c
==
--- head/sys/mips/malta/malta_mp.c  Mon Sep 12 16:36:44 2016
(r305742)
+++ head/sys/mips/malta/malta_mp.c  Mon Sep 12 16:38:51 2016
(r305743)
@@ -49,6 +49,9 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #defineMALTA_MAXCPU2
+#defineVPECONF0_VPA(1 << 0)
+#defineMVPCONTROL_VPC  (1 << 1)
+#defineTCSTATUS_A  (1 << 13)
 
 unsigned malta_ap_boot = ~0;
 
@@ -62,6 +65,19 @@ unsigned malta_ap_boot = ~0;
 #defineC_IRQ5  (1 << 15)
 
 static inline void
+evpe(void)
+{
+   __asm __volatile(
+   "   .set push   \n"
+   "   .set noreorder  \n"
+   "   .set noat   \n"
+   "   .set mips32r2   \n"
+   "   .word   0x41600021  # evpe  \n"
+   "   ehb \n"
+   "   .set pop\n");
+}
+
+static inline void
 ehb(void)
 {
__asm __volatile(
@@ -118,25 +134,30 @@ ehb(void)
__retval;   \
 })
 
-void
-platform_ipi_send(int cpuid)
+static void
+set_thread_context(int cpuid)
 {
uint32_t reg;
 
-   /*
-* Set thread context.
-* Note this is not global, so we don't need lock.
-*/
reg = read_c0_register32(1, 1);
reg &= ~(0xff);
reg |= cpuid;
write_c0_register32(1, 1, reg);
 
ehb();
+}
+
+void
+platform_ipi_send(int cpuid)
+{
+   uint32_t reg;
+
+   set_thread_context(cpuid);
 
/* Set cause */
reg = mftc0(13, 0);
-   mttc0(13, 0, (reg | C_SW1));
+   reg |= (C_SW1);
+   mttc0(13, 0, reg);
 }
 
 void
@@ -204,8 +225,42 @@ platform_smp_topo(void)
 int
 platform_start_ap(int cpuid)
 {
+   uint32_t reg;
int timeout;
 
+   /* Enter into configuration */
+   reg = read_c0_register32(0, 1);
+   reg |= (MVPCONTROL_VPC);
+   write_c0_register32(0, 1, reg);
+
+   set_thread_context(cpuid);
+
+   /*
+* Hint: how to set entry point.
+* reg = 0x8000;
+* mttc0(2, 3, reg);
+*/
+
+   /* Enable thread */
+   reg = mftc0(2, 1);
+   reg |= (TCSTATUS_A);
+   mttc0(2, 1, reg);
+
+   /* Unhalt CPU core */
+   mttc0(2, 4, 0);
+
+   /* Activate VPE */
+   reg = mftc0(1, 2);
+   reg |= (VPECONF0_VPA);
+   mttc0(1, 2, reg);
+
+   /* Out of configuration */
+   reg = read_c0_register32(0, 1);
+   reg &= ~(MVPCONTROL_VPC);
+   write_c0_register32(0, 1, reg);
+
+   evpe();
+
if (atomic_cmpset_32(_ap_boot, ~0, cpuid) == 0)
return (-1);
 

Modified: head/sys/mips/mips/locore.S
==
--- head/sys/mips/mips/locore.S Mon Sep 12 16:36:44 2016(r305742)
+++ head/sys/mips/mips/locore.S Mon Sep 12 16:38:51 2016(r305743)
@@ -161,7 +161,7 @@ VECTOR(_locore, unknown)
 #if defined(CPU_MALTA) && defined(SMP)
.set push
.set mips32r2
-   jal enable_mvp
+   jal malta_cpu_configure
nop
jal platform_processor_id
nop
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305742 - stable/11/etc/periodic/daily

2016-09-12 Thread Alan Somers
Author: asomers
Date: Mon Sep 12 16:36:44 2016
New Revision: 305742
URL: https://svnweb.freebsd.org/changeset/base/305742

Log:
  MFC r304162
  
  Decrease the anti-congestion sleep in 480.leapfile-ntpd to 1 hour
  
  24 hours is too long. Periodic scripts are executed serially, so when
  combined with the sleep in 410.pkg-audit periodic could actually take more
  than 24 hours and block the next invocation.

Modified:
  stable/11/etc/periodic/daily/480.leapfile-ntpd
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/etc/periodic/daily/480.leapfile-ntpd
==
--- stable/11/etc/periodic/daily/480.leapfile-ntpd  Mon Sep 12 16:28:32 
2016(r305741)
+++ stable/11/etc/periodic/daily/480.leapfile-ntpd  Mon Sep 12 16:36:44 
2016(r305742)
@@ -16,7 +16,7 @@ case "$daily_ntpd_leapfile_enable" in
case "$daily_ntpd_avoid_congestion" in
[Yy][Ee][Ss])
# Avoid dogpiling
-   (sleep $(jot -r 1 0 86400); service ntpd onefetch) &
+   (sleep $(jot -r 1 0 3600); service ntpd onefetch) &
;;
*)
service ntpd onefetch
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305741 - in stable/11/usr.sbin/pw: . tests

2016-09-12 Thread Alan Somers
Author: asomers
Date: Mon Sep 12 16:28:32 2016
New Revision: 305741
URL: https://svnweb.freebsd.org/changeset/base/305741

Log:
  MFC r302778
  
  pw should sanitize the argument of -w.
  
  Otherwise, it will silently disable the login for the selected account if
  the argument is unrecognizable.
  
  usr.sbin/pw/pw.h
  usr.sbin/pw/pw_conf.c
  usr.sbin/pw/pw_user.c
  Use separate rules to validate boolean parameters and passwd
  parameters.  Error out if a password parameter cannot be parsed.
  
  usr.sbin/pw/tests/Makefile
  usr.sbin/pw/tests/crypt.c
  usr.sbin/pw/tests/pw_useradd.sh
  usr.sbin/pw/tests/pw_usermod.sh
  Add tests for the validation.  Also, enhance existing
  password-related tests to actually validate that the correct hash is
  written to master.passwd.

Added:
  stable/11/usr.sbin/pw/tests/crypt.c
 - copied unchanged from r302778, head/usr.sbin/pw/tests/crypt.c
Modified:
  stable/11/usr.sbin/pw/pw.h
  stable/11/usr.sbin/pw/pw_conf.c
  stable/11/usr.sbin/pw/pw_user.c
  stable/11/usr.sbin/pw/tests/Makefile
  stable/11/usr.sbin/pw/tests/pw_useradd.sh
  stable/11/usr.sbin/pw/tests/pw_usermod.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/pw/pw.h
==
--- stable/11/usr.sbin/pw/pw.h  Mon Sep 12 16:13:27 2016(r305740)
+++ stable/11/usr.sbin/pw/pw.h  Mon Sep 12 16:28:32 2016(r305741)
@@ -93,6 +93,7 @@ int groupadd(struct userconf *, char *na
 int nis_update(void);
 
 int boolean_val(char const * str, int dflt);
+int passwd_val(char const * str, int dflt);
 char const *boolean_str(int val);
 char *newstr(char const * p);
 

Modified: stable/11/usr.sbin/pw/pw_conf.c
==
--- stable/11/usr.sbin/pw/pw_conf.c Mon Sep 12 16:13:27 2016
(r305740)
+++ stable/11/usr.sbin/pw/pw_conf.c Mon Sep 12 16:28:32 2016
(r305741)
@@ -186,6 +186,22 @@ boolean_val(char const * str, int dflt)
for (i = 0; boolfalse[i]; i++)
if (strcmp(str, boolfalse[i]) == 0)
return 0;
+   }
+   return dflt;
+}
+
+int
+passwd_val(char const * str, int dflt)
+{
+   if ((str = unquote(str)) != NULL) {
+   int i;
+
+   for (i = 0; booltrue[i]; i++)
+   if (strcmp(str, booltrue[i]) == 0)
+   return 1;
+   for (i = 0; boolfalse[i]; i++)
+   if (strcmp(str, boolfalse[i]) == 0)
+   return 0;
 
/*
 * Special cases for defaultpassword
@@ -194,6 +210,8 @@ boolean_val(char const * str, int dflt)
return -1;
if (strcmp(str, "none") == 0)
return -2;
+
+   errx(1, "Invalid value for default password");
}
return dflt;
 }
@@ -258,7 +276,7 @@ read_userconfig(char const * file)
 #endif
switch (i) {
case _UC_DEFAULTPWD:
-   config.default_password = boolean_val(q, 1);
+   config.default_password = passwd_val(q, 1);
break;
case _UC_REUSEUID:
config.reuse_uids = boolean_val(q, 0);

Modified: stable/11/usr.sbin/pw/pw_user.c
==
--- stable/11/usr.sbin/pw/pw_user.c Mon Sep 12 16:13:27 2016
(r305740)
+++ stable/11/usr.sbin/pw/pw_user.c Mon Sep 12 16:28:32 2016
(r305741)
@@ -1315,7 +1315,7 @@ pw_user_add(int argc, char **argv, char 
 
mix_config(cmdcnf, cnf);
if (default_passwd)
-   cmdcnf->default_password = boolean_val(default_passwd,
+   cmdcnf->default_password = passwd_val(default_passwd,
cnf->default_password);
if (genconf) {
if (name != NULL)
@@ -1717,7 +1717,7 @@ pw_user_mod(int argc, char **argv, char 
if (lc == NULL || login_setcryptfmt(lc, "sha512", NULL) == NULL)
warn("setting crypt(3) format");
login_close(lc);
-   cnf->default_password = boolean_val(passwd,
+   cnf->default_password = passwd_val(passwd,
cnf->default_password);
pwd->pw_passwd = pw_password(cnf, pwd->pw_name, dryrun);
edited = true;

Modified: stable/11/usr.sbin/pw/tests/Makefile
==
--- stable/11/usr.sbin/pw/tests/MakefileMon Sep 12 16:13:27 2016
(r305740)
+++ stable/11/usr.sbin/pw/tests/MakefileMon Sep 12 16:28:32 2016
(r305741)
@@ -2,6 +2,11 @@
 
 PACKAGE=   tests
 

svn commit: r305740 - head/sys/arm/conf

2016-09-12 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep 12 16:13:27 2016
New Revision: 305740
URL: https://svnweb.freebsd.org/changeset/base/305740

Log:
  Remove CUBIEBOARD kernel config file.
  Every Allwinner board should either use ALLWINNER (SMP) or ALLWINER_UP kernel
  config files.
  
  MFC after:2 week

Deleted:
  head/sys/arm/conf/CUBIEBOARD
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305739 - head/release/arm

2016-09-12 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep 12 16:10:47 2016
New Revision: 305739
URL: https://svnweb.freebsd.org/changeset/base/305739

Log:
  Use "generic" ALLWINNER_UP kernel config for Cubieboard release.
  
  Reviewed by:  gjb
  MFC after:2 week

Modified:
  head/release/arm/CUBIEBOARD.conf

Modified: head/release/arm/CUBIEBOARD.conf
==
--- head/release/arm/CUBIEBOARD.confMon Sep 12 15:57:35 2016
(r305738)
+++ head/release/arm/CUBIEBOARD.confMon Sep 12 16:10:47 2016
(r305739)
@@ -7,7 +7,7 @@ EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
 EMBEDDED_TARGET_ARCH="armv6"
 EMBEDDEDPORTS="sysutils/u-boot-cubieboard"
-KERNEL="CUBIEBOARD"
+KERNEL="ALLWINNER_UP"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x4200"
 IMAGE_SIZE="1G"
 PART_SCHEME="MBR"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305738 - releng/11.0/sys/netpfil/ipfw

2016-09-12 Thread Andrey V. Elsukov
Author: ae
Date: Mon Sep 12 15:57:35 2016
New Revision: 305738
URL: https://svnweb.freebsd.org/changeset/base/305738

Log:
  Merge from stable/11 r304415,304419 (by oleg):
Fix command: ipfw set (enable|disable) N (where N > 4).
  
  PR:   212595
  Approved by:  re (kib)

Modified:
  releng/11.0/sys/netpfil/ipfw/ip_fw_sockopt.c
Directory Properties:
  releng/11.0/   (props changed)

Modified: releng/11.0/sys/netpfil/ipfw/ip_fw_sockopt.c
==
--- releng/11.0/sys/netpfil/ipfw/ip_fw_sockopt.cMon Sep 12 14:28:38 
2016(r305737)
+++ releng/11.0/sys/netpfil/ipfw/ip_fw_sockopt.cMon Sep 12 15:57:35 
2016(r305738)
@@ -1414,8 +1414,10 @@ manage_sets(struct ip_fw_chain *chain, i
 
if (rh->range.head.length != sizeof(ipfw_range_tlv))
return (1);
-   if (rh->range.set >= IPFW_MAX_SETS ||
-   rh->range.new_set >= IPFW_MAX_SETS)
+   /* enable_sets() expects bitmasks. */
+   if (op3->opcode != IP_FW_SET_ENABLE &&
+   (rh->range.set >= IPFW_MAX_SETS ||
+   rh->range.new_set >= IPFW_MAX_SETS))
return (EINVAL);
 
ret = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305737 - head/usr.bin/bsdiff/bspatch

2016-09-12 Thread Ed Maste
Author: emaste
Date: Mon Sep 12 14:28:38 2016
New Revision: 305737
URL: https://svnweb.freebsd.org/changeset/base/305737

Log:
  bspatch: remove superfluous newlines from errx strings

Modified:
  head/usr.bin/bsdiff/bspatch/bspatch.c

Modified: head/usr.bin/bsdiff/bspatch/bspatch.c
==
--- head/usr.bin/bsdiff/bspatch/bspatch.c   Mon Sep 12 10:23:24 2016
(r305736)
+++ head/usr.bin/bsdiff/bspatch/bspatch.c   Mon Sep 12 14:28:38 2016
(r305737)
@@ -183,13 +183,13 @@ int main(int argc, char *argv[])
/* Read header */
if (fread(header, 1, 32, f) < 32) {
if (feof(f))
-   errx(1, "Corrupt patch\n");
+   errx(1, "Corrupt patch");
err(1, "fread(%s)", argv[3]);
}
 
/* Check for appropriate magic */
if (memcmp(header, "BSDIFF40", 8) != 0)
-   errx(1, "Corrupt patch\n");
+   errx(1, "Corrupt patch");
 
/* Read lengths from header */
bzctrllen = offtin(header + 8);
@@ -198,7 +198,7 @@ int main(int argc, char *argv[])
if (bzctrllen < 0 || bzctrllen > OFF_MAX - 32 ||
bzdatalen < 0 || bzctrllen + 32 > OFF_MAX - bzdatalen ||
newsize < 0 || newsize > SSIZE_MAX)
-   errx(1, "Corrupt patch\n");
+   errx(1, "Corrupt patch");
 
/* Close patch file and re-open it via libbzip2 at the right places */
if (fclose(f))
@@ -237,24 +237,24 @@ int main(int argc, char *argv[])
lenread = BZ2_bzRead(, cpfbz2, buf, 8);
if ((lenread < 8) || ((cbz2err != BZ_OK) &&
(cbz2err != BZ_STREAM_END)))
-   errx(1, "Corrupt patch\n");
+   errx(1, "Corrupt patch");
ctrl[i] = offtin(buf);
}
 
/* Sanity-check */
if (ctrl[0] < 0 || ctrl[0] > INT_MAX ||
ctrl[1] < 0 || ctrl[1] > INT_MAX)
-   errx(1, "Corrupt patch\n");
+   errx(1, "Corrupt patch");
 
/* Sanity-check */
if (newpos + ctrl[0] > newsize)
-   errx(1, "Corrupt patch\n");
+   errx(1, "Corrupt patch");
 
/* Read diff string */
lenread = BZ2_bzRead(, dpfbz2, new + newpos, ctrl[0]);
if ((lenread < ctrl[0]) ||
((dbz2err != BZ_OK) && (dbz2err != BZ_STREAM_END)))
-   errx(1, "Corrupt patch\n");
+   errx(1, "Corrupt patch");
 
/* Add old data to diff string */
for (i = 0; i < ctrl[0]; i++)
@@ -267,13 +267,13 @@ int main(int argc, char *argv[])
 
/* Sanity-check */
if (newpos + ctrl[1] > newsize)
-   errx(1, "Corrupt patch\n");
+   errx(1, "Corrupt patch");
 
/* Read extra string */
lenread = BZ2_bzRead(, epfbz2, new + newpos, ctrl[1]);
if ((lenread < ctrl[1]) ||
((ebz2err != BZ_OK) && (ebz2err != BZ_STREAM_END)))
-   errx(1, "Corrupt patch\n");
+   errx(1, "Corrupt patch");
 
/* Adjust pointers */
newpos+=ctrl[1];
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305736 - in stable/8/sys: dev/usb dev/usb/template sys

2016-09-12 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Sep 12 10:23:24 2016
New Revision: 305736
URL: https://svnweb.freebsd.org/changeset/base/305736

Log:
  MFC r305421:
  Resolve deadlock between device_detach() and usbd_do_request_flags()
  by reviving the SX control request lock and refining which lock
  protects the common scratch area in "struct usb_device".
  
  The SX control request lock was removed by r246759 because it caused a
  lock order reversal with the USB enumeration lock inside
  usbd_transfer_setup() as a function of r246616. It was thought that
  reducing the number of locks would resolve the LOR, but because some
  USB device drivers use usbd_do_request_flags() inside callback
  functions, like in taskqueues, a deadlock may occur when these are
  drained from device_detach(). By restoring the SX control request
  lock usbd_do_request_flags() is allowed to complete its execution
  when a USB device driver is detaching. By using the SX control request
  lock to protect the scratch area, the LOR introduced by r246616 is
  also resolved.
  
  Bump the FreeBSD version while at it to force recompilation of all USB
  kernel modules.
  
  Found by: avos@

Modified:
  stable/8/sys/dev/usb/template/usb_template.c
  stable/8/sys/dev/usb/usb_device.c
  stable/8/sys/dev/usb/usb_device.h
  stable/8/sys/dev/usb/usb_generic.c
  stable/8/sys/dev/usb/usb_request.c
  stable/8/sys/dev/usb/usb_transfer.c
  stable/8/sys/dev/usb/usb_util.c
  stable/8/sys/sys/param.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/usb/   (props changed)
  stable/8/sys/sys/   (props changed)

Modified: stable/8/sys/dev/usb/template/usb_template.c
==
--- stable/8/sys/dev/usb/template/usb_template.cMon Sep 12 10:20:44 
2016(r305735)
+++ stable/8/sys/dev/usb/template/usb_template.cMon Sep 12 10:23:24 
2016(r305736)
@@ -1240,7 +1240,7 @@ usb_temp_setup(struct usb_device *udev,
return (0);
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
uts = udev->scratch.temp_setup;
 
@@ -1319,7 +1319,7 @@ done:
if (error)
usb_temp_unsetup(udev);
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
return (error);
 }
 

Modified: stable/8/sys/dev/usb/usb_device.c
==
--- stable/8/sys/dev/usb/usb_device.c   Mon Sep 12 10:20:44 2016
(r305735)
+++ stable/8/sys/dev/usb/usb_device.c   Mon Sep 12 10:23:24 2016
(r305736)
@@ -1550,6 +1550,7 @@ usb_alloc_device(device_t parent_dev, st
/* initialise our SX-lock */
sx_init_flags(>enum_sx, "USB config SX lock", SX_DUPOK);
sx_init_flags(>sr_sx, "USB suspend and resume SX lock", 
SX_NOWITNESS);
+   sx_init_flags(>ctrl_sx, "USB control transfer SX lock", SX_DUPOK);
 
cv_init(>ctrlreq_cv, "WCTRL");
cv_init(>ref_cv, "UGONE");
@@ -1735,7 +1736,7 @@ usb_alloc_device(device_t parent_dev, st
 */
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
scratch_ptr = udev->scratch.data;
 
@@ -1786,7 +1787,7 @@ usb_alloc_device(device_t parent_dev, st
}
 
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
 
/* assume 100mA bus powered for now. Changed when configured. */
udev->power = USB_MIN_POWER;
@@ -2148,6 +2149,7 @@ usb_free_device(struct usb_device *udev,

sx_destroy(>enum_sx);
sx_destroy(>sr_sx);
+   sx_destroy(>ctrl_sx);
 
cv_destroy(>ctrlreq_cv);
cv_destroy(>ref_cv);
@@ -2311,7 +2313,7 @@ usbd_set_device_strings(struct usb_devic
uint8_t do_unlock;
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
temp_ptr = (char *)udev->scratch.data;
temp_size = sizeof(udev->scratch.data);
@@ -2371,7 +2373,7 @@ usbd_set_device_strings(struct usb_devic
}
 
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
 }
 
 /*
@@ -2853,6 +2855,40 @@ usbd_enum_is_locked(struct usb_device *u
 }
 
 /*
+ * The following function is used to serialize access to USB control
+ * transfers and the USB scratch area. If the lock is already grabbed
+ * this function returns zero. Else a value of one is returned.
+ */
+uint8_t
+usbd_ctrl_lock(struct usb_device *udev)
+{
+   if (sx_xlocked(>ctrl_sx))
+   return (0);
+   sx_xlock(>ctrl_sx);
+
+   /*
+* We need to allow suspend and resume at this point, else the
+* control transfer will timeout if the device is suspended!
+*/
+   if 

svn commit: r305735 - in stable/9/sys: dev/usb dev/usb/template sys

2016-09-12 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Sep 12 10:20:44 2016
New Revision: 305735
URL: https://svnweb.freebsd.org/changeset/base/305735

Log:
  MFC r305421:
  Resolve deadlock between device_detach() and usbd_do_request_flags()
  by reviving the SX control request lock and refining which lock
  protects the common scratch area in "struct usb_device".
  
  The SX control request lock was removed by r246759 because it caused a
  lock order reversal with the USB enumeration lock inside
  usbd_transfer_setup() as a function of r246616. It was thought that
  reducing the number of locks would resolve the LOR, but because some
  USB device drivers use usbd_do_request_flags() inside callback
  functions, like in taskqueues, a deadlock may occur when these are
  drained from device_detach(). By restoring the SX control request
  lock usbd_do_request_flags() is allowed to complete its execution
  when a USB device driver is detaching. By using the SX control request
  lock to protect the scratch area, the LOR introduced by r246616 is
  also resolved.
  
  Bump the FreeBSD version while at it to force recompilation of all USB
  kernel modules.
  
  Found by: avos@

Modified:
  stable/9/sys/dev/usb/template/usb_template.c
  stable/9/sys/dev/usb/usb_device.c
  stable/9/sys/dev/usb/usb_device.h
  stable/9/sys/dev/usb/usb_generic.c
  stable/9/sys/dev/usb/usb_request.c
  stable/9/sys/dev/usb/usb_transfer.c
  stable/9/sys/dev/usb/usb_util.c
  stable/9/sys/sys/param.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/sys/dev/usb/template/usb_template.c
==
--- stable/9/sys/dev/usb/template/usb_template.cMon Sep 12 10:17:25 
2016(r305734)
+++ stable/9/sys/dev/usb/template/usb_template.cMon Sep 12 10:20:44 
2016(r305735)
@@ -1240,7 +1240,7 @@ usb_temp_setup(struct usb_device *udev,
return (0);
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
uts = udev->scratch.temp_setup;
 
@@ -1319,7 +1319,7 @@ done:
if (error)
usb_temp_unsetup(udev);
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
return (error);
 }
 

Modified: stable/9/sys/dev/usb/usb_device.c
==
--- stable/9/sys/dev/usb/usb_device.c   Mon Sep 12 10:17:25 2016
(r305734)
+++ stable/9/sys/dev/usb/usb_device.c   Mon Sep 12 10:20:44 2016
(r305735)
@@ -1555,6 +1555,7 @@ usb_alloc_device(device_t parent_dev, st
/* initialise our SX-lock */
sx_init_flags(>enum_sx, "USB config SX lock", SX_DUPOK);
sx_init_flags(>sr_sx, "USB suspend and resume SX lock", 
SX_NOWITNESS);
+   sx_init_flags(>ctrl_sx, "USB control transfer SX lock", SX_DUPOK);
 
cv_init(>ctrlreq_cv, "WCTRL");
cv_init(>ref_cv, "UGONE");
@@ -1740,7 +1741,7 @@ usb_alloc_device(device_t parent_dev, st
 */
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
scratch_ptr = udev->scratch.data;
 
@@ -1791,7 +1792,7 @@ usb_alloc_device(device_t parent_dev, st
}
 
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
 
/* assume 100mA bus powered for now. Changed when configured. */
udev->power = USB_MIN_POWER;
@@ -2158,6 +2159,7 @@ usb_free_device(struct usb_device *udev,

sx_destroy(>enum_sx);
sx_destroy(>sr_sx);
+   sx_destroy(>ctrl_sx);
 
cv_destroy(>ctrlreq_cv);
cv_destroy(>ref_cv);
@@ -2321,7 +2323,7 @@ usbd_set_device_strings(struct usb_devic
uint8_t do_unlock;
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
temp_ptr = (char *)udev->scratch.data;
temp_size = sizeof(udev->scratch.data);
@@ -2381,7 +2383,7 @@ usbd_set_device_strings(struct usb_devic
}
 
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
 }
 
 /*
@@ -2788,6 +2790,40 @@ usbd_enum_is_locked(struct usb_device *u
 }
 
 /*
+ * The following function is used to serialize access to USB control
+ * transfers and the USB scratch area. If the lock is already grabbed
+ * this function returns zero. Else a value of one is returned.
+ */
+uint8_t
+usbd_ctrl_lock(struct usb_device *udev)
+{
+   if (sx_xlocked(>ctrl_sx))
+   return (0);
+   sx_xlock(>ctrl_sx);
+
+   /*
+* We need to allow suspend and resume at this point, else the
+* control transfer will timeout if the device is suspended!
+*/
+   if (usbd_enum_is_locked(udev))
+   usbd_sr_unlock(udev);
+   return (1);
+}
+

svn commit: r305734 - in stable/10/sys: dev/usb dev/usb/template sys

2016-09-12 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Sep 12 10:17:25 2016
New Revision: 305734
URL: https://svnweb.freebsd.org/changeset/base/305734

Log:
  MFC r305421:
  Resolve deadlock between device_detach() and usbd_do_request_flags()
  by reviving the SX control request lock and refining which lock
  protects the common scratch area in "struct usb_device".
  
  The SX control request lock was removed by r246759 because it caused a
  lock order reversal with the USB enumeration lock inside
  usbd_transfer_setup() as a function of r246616. It was thought that
  reducing the number of locks would resolve the LOR, but because some
  USB device drivers use usbd_do_request_flags() inside callback
  functions, like in taskqueues, a deadlock may occur when these are
  drained from device_detach(). By restoring the SX control request
  lock usbd_do_request_flags() is allowed to complete its execution
  when a USB device driver is detaching. By using the SX control request
  lock to protect the scratch area, the LOR introduced by r246616 is
  also resolved.
  
  Bump the FreeBSD version while at it to force recompilation of all USB
  kernel modules.
  
  Found by: avos@

Modified:
  stable/10/sys/dev/usb/template/usb_template.c
  stable/10/sys/dev/usb/usb_device.c
  stable/10/sys/dev/usb/usb_device.h
  stable/10/sys/dev/usb/usb_generic.c
  stable/10/sys/dev/usb/usb_request.c
  stable/10/sys/dev/usb/usb_transfer.c
  stable/10/sys/dev/usb/usb_util.c
  stable/10/sys/sys/param.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/template/usb_template.c
==
--- stable/10/sys/dev/usb/template/usb_template.c   Mon Sep 12 10:14:30 
2016(r305733)
+++ stable/10/sys/dev/usb/template/usb_template.c   Mon Sep 12 10:17:25 
2016(r305734)
@@ -1245,7 +1245,7 @@ usb_temp_setup(struct usb_device *udev,
return (0);
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
uts = udev->scratch.temp_setup;
 
@@ -1324,7 +1324,7 @@ done:
if (error)
usb_temp_unsetup(udev);
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
return (error);
 }
 

Modified: stable/10/sys/dev/usb/usb_device.c
==
--- stable/10/sys/dev/usb/usb_device.c  Mon Sep 12 10:14:30 2016
(r305733)
+++ stable/10/sys/dev/usb/usb_device.c  Mon Sep 12 10:17:25 2016
(r305734)
@@ -1588,6 +1588,7 @@ usb_alloc_device(device_t parent_dev, st
/* initialise our SX-lock */
sx_init_flags(>enum_sx, "USB config SX lock", SX_DUPOK);
sx_init_flags(>sr_sx, "USB suspend and resume SX lock", 
SX_NOWITNESS);
+   sx_init_flags(>ctrl_sx, "USB control transfer SX lock", SX_DUPOK);
 
cv_init(>ctrlreq_cv, "WCTRL");
cv_init(>ref_cv, "UGONE");
@@ -1773,7 +1774,7 @@ usb_alloc_device(device_t parent_dev, st
 */
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
scratch_ptr = udev->scratch.data;
 
@@ -1824,7 +1825,7 @@ usb_alloc_device(device_t parent_dev, st
}
 
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
 
/* assume 100mA bus powered for now. Changed when configured. */
udev->power = USB_MIN_POWER;
@@ -2195,6 +2196,7 @@ usb_free_device(struct usb_device *udev,

sx_destroy(>enum_sx);
sx_destroy(>sr_sx);
+   sx_destroy(>ctrl_sx);
 
cv_destroy(>ctrlreq_cv);
cv_destroy(>ref_cv);
@@ -2358,7 +2360,7 @@ usbd_set_device_strings(struct usb_devic
uint8_t do_unlock;
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
temp_ptr = (char *)udev->scratch.data;
temp_size = sizeof(udev->scratch.data);
@@ -2418,7 +2420,7 @@ usbd_set_device_strings(struct usb_devic
}
 
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
 }
 
 /*
@@ -2825,6 +2827,40 @@ usbd_enum_is_locked(struct usb_device *u
 }
 
 /*
+ * The following function is used to serialize access to USB control
+ * transfers and the USB scratch area. If the lock is already grabbed
+ * this function returns zero. Else a value of one is returned.
+ */
+uint8_t
+usbd_ctrl_lock(struct usb_device *udev)
+{
+   if (sx_xlocked(>ctrl_sx))
+   return (0);
+   sx_xlock(>ctrl_sx);
+
+   /*
+* We need to allow suspend and resume at this point, else the
+* control transfer will timeout if the device is suspended!
+*/
+   if (usbd_enum_is_locked(udev))
+   usbd_sr_unlock(udev);
+   return (1);
+}
+
+void
+usbd_ctrl_unlock(struct 

svn commit: r305733 - in stable/11/sys: dev/usb dev/usb/template sys

2016-09-12 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Sep 12 10:14:30 2016
New Revision: 305733
URL: https://svnweb.freebsd.org/changeset/base/305733

Log:
  MFC r305421:
  Resolve deadlock between device_detach() and usbd_do_request_flags()
  by reviving the SX control request lock and refining which lock
  protects the common scratch area in "struct usb_device".
  
  The SX control request lock was removed by r246759 because it caused a
  lock order reversal with the USB enumeration lock inside
  usbd_transfer_setup() as a function of r246616. It was thought that
  reducing the number of locks would resolve the LOR, but because some
  USB device drivers use usbd_do_request_flags() inside callback
  functions, like in taskqueues, a deadlock may occur when these are
  drained from device_detach(). By restoring the SX control request
  lock usbd_do_request_flags() is allowed to complete its execution
  when a USB device driver is detaching. By using the SX control request
  lock to protect the scratch area, the LOR introduced by r246616 is
  also resolved.
  
  Bump the FreeBSD version while at it to force recompilation of all USB
  kernel modules.
  
  Found by: avos@

Modified:
  stable/11/sys/dev/usb/template/usb_template.c
  stable/11/sys/dev/usb/usb_device.c
  stable/11/sys/dev/usb/usb_device.h
  stable/11/sys/dev/usb/usb_generic.c
  stable/11/sys/dev/usb/usb_request.c
  stable/11/sys/dev/usb/usb_transfer.c
  stable/11/sys/dev/usb/usb_util.c
  stable/11/sys/sys/param.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/template/usb_template.c
==
--- stable/11/sys/dev/usb/template/usb_template.c   Mon Sep 12 08:32:06 
2016(r305732)
+++ stable/11/sys/dev/usb/template/usb_template.c   Mon Sep 12 10:14:30 
2016(r305733)
@@ -1245,7 +1245,7 @@ usb_temp_setup(struct usb_device *udev,
return (0);
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
uts = udev->scratch.temp_setup;
 
@@ -1324,7 +1324,7 @@ done:
if (error)
usb_temp_unsetup(udev);
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
return (error);
 }
 

Modified: stable/11/sys/dev/usb/usb_device.c
==
--- stable/11/sys/dev/usb/usb_device.c  Mon Sep 12 08:32:06 2016
(r305732)
+++ stable/11/sys/dev/usb/usb_device.c  Mon Sep 12 10:14:30 2016
(r305733)
@@ -1585,6 +1585,7 @@ usb_alloc_device(device_t parent_dev, st
/* initialise our SX-lock */
sx_init_flags(>enum_sx, "USB config SX lock", SX_DUPOK);
sx_init_flags(>sr_sx, "USB suspend and resume SX lock", 
SX_NOWITNESS);
+   sx_init_flags(>ctrl_sx, "USB control transfer SX lock", SX_DUPOK);
 
cv_init(>ctrlreq_cv, "WCTRL");
cv_init(>ref_cv, "UGONE");
@@ -1770,7 +1771,7 @@ usb_alloc_device(device_t parent_dev, st
 */
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
scratch_ptr = udev->scratch.data;
 
@@ -1821,7 +1822,7 @@ usb_alloc_device(device_t parent_dev, st
}
 
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
 
/* assume 100mA bus powered for now. Changed when configured. */
udev->power = USB_MIN_POWER;
@@ -2195,6 +2196,7 @@ usb_free_device(struct usb_device *udev,

sx_destroy(>enum_sx);
sx_destroy(>sr_sx);
+   sx_destroy(>ctrl_sx);
 
cv_destroy(>ctrlreq_cv);
cv_destroy(>ref_cv);
@@ -2358,7 +2360,7 @@ usbd_set_device_strings(struct usb_devic
uint8_t do_unlock;
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
temp_ptr = (char *)udev->scratch.data;
temp_size = sizeof(udev->scratch.data);
@@ -2418,7 +2420,7 @@ usbd_set_device_strings(struct usb_devic
}
 
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
 }
 
 /*
@@ -2825,6 +2827,40 @@ usbd_enum_is_locked(struct usb_device *u
 }
 
 /*
+ * The following function is used to serialize access to USB control
+ * transfers and the USB scratch area. If the lock is already grabbed
+ * this function returns zero. Else a value of one is returned.
+ */
+uint8_t
+usbd_ctrl_lock(struct usb_device *udev)
+{
+   if (sx_xlocked(>ctrl_sx))
+   return (0);
+   sx_xlock(>ctrl_sx);
+
+   /*
+* We need to allow suspend and resume at this point, else the
+* control transfer will timeout if the device is suspended!
+*/
+   if (usbd_enum_is_locked(udev))
+   usbd_sr_unlock(udev);
+   return (1);
+}
+
+void
+usbd_ctrl_unlock(struct 

Re: svn commit: r305722 - head/sys/x86/x86

2016-09-12 Thread Konstantin Belousov
On Mon, Sep 12, 2016 at 04:47:35PM +0800, Sepherosa Ziehau wrote:
> On Mon, Sep 12, 2016 at 4:39 PM, Sepherosa Ziehau  wrote:
> > On Mon, Sep 12, 2016 at 4:32 PM, Konstantin Belousov
> >  wrote:
> >> On Mon, Sep 12, 2016 at 04:57:58AM +, Sepherosa Ziehau wrote:
> >>> Author: sephe
> >>> Date: Mon Sep 12 04:57:58 2016
> >>> New Revision: 305722
> >>> URL: https://svnweb.freebsd.org/changeset/base/305722
> >>>
> >>> Log:
> >>>   x86: Use sx lock for interrupt sources.
> >>>
> >>>   - Certain pic_assign_cpu, e.g. msi_assign_cpu can have quite a long
> >>> call chain.  For msi_assign_cpu, mutex makes complex PCI bridge
> >>> drivers more tricky, e.g. sleep can note be called, etc, it will
> >>> be pretty tricky for upcoming Hyper-V PCI bridge driver for PCI
> >>> pass-through.
> >>
> >>>   - It is not used on any hot code path nor non-sleepable context, so
> >>> sx should have the same effect as mutex.
> >> Did you tested ACPI_DMAR interrupt remapping mode with your patch and
> >> witness enabled ?
> >
> > Nope, I am about to try it now.  BTW, I just checked the code for
> > ACPI_DMAR, I didn't see anything obviously w/ the lock type change
> > though.
> 
> I didn't notice anything wrong w/ options
> ACPI_DMAR+WITNESS+INVARIANTS.  If you saw anything wrong, please let
> me know.

Options are not enough, you should explicitely enable interrupt remapping
with loader tunable hw.dmar.ir=1.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305722 - head/sys/x86/x86

2016-09-12 Thread Sepherosa Ziehau
On Mon, Sep 12, 2016 at 4:39 PM, Sepherosa Ziehau  wrote:
> On Mon, Sep 12, 2016 at 4:32 PM, Konstantin Belousov
>  wrote:
>> On Mon, Sep 12, 2016 at 04:57:58AM +, Sepherosa Ziehau wrote:
>>> Author: sephe
>>> Date: Mon Sep 12 04:57:58 2016
>>> New Revision: 305722
>>> URL: https://svnweb.freebsd.org/changeset/base/305722
>>>
>>> Log:
>>>   x86: Use sx lock for interrupt sources.
>>>
>>>   - Certain pic_assign_cpu, e.g. msi_assign_cpu can have quite a long
>>> call chain.  For msi_assign_cpu, mutex makes complex PCI bridge
>>> drivers more tricky, e.g. sleep can note be called, etc, it will
>>> be pretty tricky for upcoming Hyper-V PCI bridge driver for PCI
>>> pass-through.
>>
>>>   - It is not used on any hot code path nor non-sleepable context, so
>>> sx should have the same effect as mutex.
>> Did you tested ACPI_DMAR interrupt remapping mode with your patch and
>> witness enabled ?
>
> Nope, I am about to try it now.  BTW, I just checked the code for
> ACPI_DMAR, I didn't see anything obviously w/ the lock type change
> though.

I didn't notice anything wrong w/ options
ACPI_DMAR+WITNESS+INVARIANTS.  If you saw anything wrong, please let
me know.

Thanks,
sephe

-- 
Tomorrow Will Never Die
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305722 - head/sys/x86/x86

2016-09-12 Thread Sepherosa Ziehau
On Mon, Sep 12, 2016 at 4:32 PM, Konstantin Belousov
 wrote:
> On Mon, Sep 12, 2016 at 04:57:58AM +, Sepherosa Ziehau wrote:
>> Author: sephe
>> Date: Mon Sep 12 04:57:58 2016
>> New Revision: 305722
>> URL: https://svnweb.freebsd.org/changeset/base/305722
>>
>> Log:
>>   x86: Use sx lock for interrupt sources.
>>
>>   - Certain pic_assign_cpu, e.g. msi_assign_cpu can have quite a long
>> call chain.  For msi_assign_cpu, mutex makes complex PCI bridge
>> drivers more tricky, e.g. sleep can note be called, etc, it will
>> be pretty tricky for upcoming Hyper-V PCI bridge driver for PCI
>> pass-through.
>
>>   - It is not used on any hot code path nor non-sleepable context, so
>> sx should have the same effect as mutex.
> Did you tested ACPI_DMAR interrupt remapping mode with your patch and
> witness enabled ?

Nope, I am about to try it now.  BTW, I just checked the code for
ACPI_DMAR, I didn't see anything obviously w/ the lock type change
though.

Thanks,
sephe

-- 
Tomorrow Will Never Die
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305722 - head/sys/x86/x86

2016-09-12 Thread Konstantin Belousov
On Mon, Sep 12, 2016 at 04:57:58AM +, Sepherosa Ziehau wrote:
> Author: sephe
> Date: Mon Sep 12 04:57:58 2016
> New Revision: 305722
> URL: https://svnweb.freebsd.org/changeset/base/305722
> 
> Log:
>   x86: Use sx lock for interrupt sources.
>   
>   - Certain pic_assign_cpu, e.g. msi_assign_cpu can have quite a long
> call chain.  For msi_assign_cpu, mutex makes complex PCI bridge
> drivers more tricky, e.g. sleep can note be called, etc, it will
> be pretty tricky for upcoming Hyper-V PCI bridge driver for PCI
> pass-through.

>   - It is not used on any hot code path nor non-sleepable context, so
> sx should have the same effect as mutex.
Did you tested ACPI_DMAR interrupt remapping mode with your patch and
witness enabled ?

>   
>   PIC list is still protected by mutex to keep suspend/resume work.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305732 - stable/10/sys/net

2016-09-12 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Sep 12 08:32:06 2016
New Revision: 305732
URL: https://svnweb.freebsd.org/changeset/base/305732

Log:
  MFC 305177
  net/vlan: Shift for pri is 13 (pri mask 0xe000) not 1.
  
  Reviewed by:araujo, hps
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D7710

Modified:
  stable/10/sys/net/if_vlan_var.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/if_vlan_var.h
==
--- stable/10/sys/net/if_vlan_var.h Mon Sep 12 08:14:11 2016
(r305731)
+++ stable/10/sys/net/if_vlan_var.h Mon Sep 12 08:32:06 2016
(r305732)
@@ -46,7 +46,7 @@ structether_vlan_header {
 #defineEVL_PRIOFTAG(tag)   (((tag) >> 13) & 7)
 #defineEVL_CFIOFTAG(tag)   (((tag) >> 12) & 1)
 #defineEVL_MAKETAG(vlid, pri, cfi) 
\
-   ((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
+   ((pri) & 7) << 13) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
 
 /* Set the VLAN ID in an mbuf packet header non-destructively. */
 #define EVL_APPLY_VLID(m, vlid)
\
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305731 - stable/11/sys/net

2016-09-12 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Sep 12 08:14:11 2016
New Revision: 305731
URL: https://svnweb.freebsd.org/changeset/base/305731

Log:
  MFC 305177
  net/vlan: Shift for pri is 13 (pri mask 0xe000) not 1.
  
  Reviewed by:araujo, hps
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D7710

Modified:
  stable/11/sys/net/ethernet.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/ethernet.h
==
--- stable/11/sys/net/ethernet.hMon Sep 12 06:12:28 2016
(r305730)
+++ stable/11/sys/net/ethernet.hMon Sep 12 08:14:11 2016
(r305731)
@@ -89,7 +89,7 @@ struct ether_vlan_header {
 #defineEVL_PRIOFTAG(tag)   (((tag) >> 13) & 7)
 #defineEVL_CFIOFTAG(tag)   (((tag) >> 12) & 1)
 #defineEVL_MAKETAG(vlid, pri, cfi) 
\
-   ((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
+   ((pri) & 7) << 13) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
 
 /*
  *  NOTE: 0x-0x05DC (0..1500) are generally IEEE 802.3 length fields.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305730 - head/sys/dev/hyperv/netvsc

2016-09-12 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Sep 12 06:12:28 2016
New Revision: 305730
URL: https://svnweb.freebsd.org/changeset/base/305730

Log:
  hyperv/hn: Pull ether address and link status extraction up.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7831

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
  head/sys/dev/hyperv/netvsc/if_hnvar.h

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Sep 12 05:59:39 2016
(r305729)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Sep 12 06:12:28 2016
(r305730)
@@ -99,11 +99,6 @@ struct vmbus_channel;
 #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE)
 #define NETVSC_PACKET_MAXPAGE  32
 
-typedef struct {
-   uint8_t mac_addr[ETHER_ADDR_LEN];
-   uint32_tlink_state;
-} netvsc_device_info;
-
 #define HN_XACT_REQ_PGCNT  2
 #define HN_XACT_RESP_PGCNT 2
 #define HN_XACT_REQ_SIZE   (HN_XACT_REQ_PGCNT * PAGE_SIZE)

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Sep 12 05:59:39 
2016(r305729)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Sep 12 06:12:28 
2016(r305730)
@@ -440,7 +440,8 @@ netvsc_attach(device_t dev)
 {
struct sysctl_oid_list *child;
struct sysctl_ctx_list *ctx;
-   netvsc_device_info device_info;
+   uint8_t eaddr[ETHER_ADDR_LEN];
+   uint32_t link_status;
hn_softc_t *sc;
int unit = device_get_unit(dev);
struct ifnet *ifp = NULL;
@@ -564,7 +565,7 @@ netvsc_attach(device_t dev)
if (sc->hn_xact == NULL)
goto failed;
 
-   error = hv_rf_on_device_add(sc, _info, _cnt, ETHERMTU);
+   error = hv_rf_on_device_add(sc, _cnt, ETHERMTU);
if (error)
goto failed;
KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_inuse,
@@ -597,9 +598,11 @@ netvsc_attach(device_t dev)
}
 #endif
 
-   if (device_info.link_state == NDIS_MEDIA_STATE_CONNECTED) {
+   error = hn_rndis_get_linkstatus(sc, _status);
+   if (error)
+   goto failed;
+   if (link_status == NDIS_MEDIA_STATE_CONNECTED)
sc->hn_carrier = 1;
-   }
 
 #if __FreeBSD_version >= 1100045
tso_maxlen = hn_tso_maxlen;
@@ -612,7 +615,10 @@ netvsc_attach(device_t dev)
(ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN);
 #endif
 
-   ether_ifattach(ifp, device_info.mac_addr);
+   error = hn_rndis_get_eaddr(sc, eaddr);
+   if (error)
+   goto failed;
+   ether_ifattach(ifp, eaddr);
 
 #if __FreeBSD_version >= 1100045
if_printf(ifp, "TSO: %u/%u/%u\n", ifp->if_hw_tsomax,
@@ -1503,7 +1509,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
 #ifdef INET
struct ifaddr *ifa = (struct ifaddr *)data;
 #endif
-   netvsc_device_info device_info;
int mask, error = 0, ring_cnt;
int retry_cnt = 500;

@@ -1583,8 +1588,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
hn_chan_attach(sc, sc->hn_prichan); /* XXX check error */
 
ring_cnt = sc->hn_rx_ring_inuse;
-   error = hv_rf_on_device_add(sc, _info, _cnt,
-   ifr->ifr_mtu);
+   error = hv_rf_on_device_add(sc, _cnt, ifr->ifr_mtu);
if (error) {
NV_LOCK(sc);
sc->temp_unusable = FALSE;

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cMon Sep 12 05:59:39 
2016(r305729)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cMon Sep 12 06:12:28 
2016(r305730)
@@ -75,9 +75,6 @@ static void hv_rf_receive_indicate_statu
 const void *data, int dlen);
 static void hv_rf_receive_data(struct hn_rx_ring *rxr,
 const void *data, int dlen);
-static int hv_rf_query_device_mac(struct hn_softc *sc, uint8_t *eaddr);
-static int hv_rf_query_device_link_status(struct hn_softc *sc,
-uint32_t *link_status);
 
 static int hn_rndis_query(struct hn_softc *sc, uint32_t oid,
 const void *idata, size_t idlen, void *odata, size_t *odlen0);
@@ -479,11 +476,8 @@ hv_rf_on_receive(struct hn_softc *sc, st
}
 }
 
-/*
- * RNDIS filter query device MAC address
- */
-static int
-hv_rf_query_device_mac(struct hn_softc *sc, uint8_t *eaddr)
+int
+hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr)
 {
size_t eaddr_len;
int error;
@@ -500,11 +494,8 @@ 

svn commit: r305729 - head/sys/dev/hyperv/netvsc

2016-09-12 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Sep 12 05:59:39 2016
New Revision: 305729
URL: https://svnweb.freebsd.org/changeset/base/305729

Log:
  hyperv/hn: Reorganize RNDIS attach
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7830

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

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cMon Sep 12 05:37:44 
2016(r305728)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cMon Sep 12 05:59:39 
2016(r305729)
@@ -78,7 +78,6 @@ static void hv_rf_receive_data(struct hn
 static int hv_rf_query_device_mac(struct hn_softc *sc, uint8_t *eaddr);
 static int hv_rf_query_device_link_status(struct hn_softc *sc,
 uint32_t *link_status);
-static int  hv_rf_init_device(struct hn_softc *sc);
 
 static int hn_rndis_query(struct hn_softc *sc, uint32_t oid,
 const void *idata, size_t idlen, void *odata, size_t *odlen0);
@@ -922,11 +921,8 @@ hn_rndis_set_rxfilter(struct hn_softc *s
return (error);
 }
 
-/*
- * RNDIS filter init device
- */
 static int
-hv_rf_init_device(struct hn_softc *sc)
+hn_rndis_init(struct hn_softc *sc)
 {
struct rndis_init_req *req;
const struct rndis_init_comp *comp;
@@ -1007,9 +1003,26 @@ hv_rf_halt_device(struct hn_softc *sc)
return (0);
 }
 
-/*
- * RNDIS filter on device add
- */
+static int
+hn_rndis_attach(struct hn_softc *sc)
+{
+   int error;
+
+   /*
+* Initialize RNDIS.
+*/
+   error = hn_rndis_init(sc);
+   if (error)
+   return (error);
+
+   /*
+* Configure NDIS offload settings.
+* XXX no offloading, if error happened?
+*/
+   hn_rndis_conf_offload(sc);
+   return (0);
+}
+
 int
 hv_rf_on_device_add(struct hn_softc *sc, void *additl_info,
 int *nchan0, int mtu)
@@ -1023,28 +1036,15 @@ hv_rf_on_device_add(struct hn_softc *sc,
if (ret != 0)
return (ret);
 
-   /*
-* Initialize the rndis device
-*/
-
-   /* Send the rndis initialization message */
-   ret = hv_rf_init_device(sc);
-   if (ret != 0) {
-   /*
-* TODO: If rndis init failed, we will need to shut down
-* the channel
-*/
-   }
+   ret = hn_rndis_attach(sc);
+   if (ret != 0)
+   return (ret);
 
/* Get the mac address */
ret = hv_rf_query_device_mac(sc, dev_info->mac_addr);
if (ret != 0) {
/* TODO: shut down rndis device and the channel */
}
-
-   /* Configure NDIS offload settings */
-   hn_rndis_conf_offload(sc);
-
hv_rf_query_device_link_status(sc, _info->link_state);
 
if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30 || nchan == 1) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"