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

2016-10-26 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Oct 27 05:33:48 2016
New Revision: 307991
URL: https://svnweb.freebsd.org/changeset/base/307991

Log:
  hyperv/hn: NVS inclusion cleanup and forward declare functions.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8347

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:26:04 2016
(r307990)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:33:48 2016
(r307991)
@@ -24,21 +24,23 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
  */
 
-/**
- * HyperV vmbus network VSC (virtual services client) module
- *
+/*
+ * Network Virtualization Service.
  */
 
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_inet6.h"
+#include "opt_inet.h"
 
 #include 
 #include 
-#include 
 #include 
-#include 
+#include 
+#include 
 #include 
 
 #include 
@@ -58,18 +60,22 @@
 #include 
 #include 
 
-/*
- * Forward declarations
- */
-static int  hn_nvs_conn_chim(struct hn_softc *sc);
-static int  hn_nvs_conn_rxbuf(struct hn_softc *);
-static int  hn_nvs_disconn_chim(struct hn_softc *sc);
-static int  hn_nvs_disconn_rxbuf(struct hn_softc *sc);
-static void hn_nvs_sent_none(struct hn_nvs_sendctx *sndc,
-struct hn_softc *, struct vmbus_channel *chan,
-const void *, int);
+static int hn_nvs_conn_chim(struct hn_softc *);
+static int hn_nvs_conn_rxbuf(struct hn_softc *);
+static int hn_nvs_disconn_chim(struct hn_softc *);
+static int hn_nvs_disconn_rxbuf(struct hn_softc *);
+static int hn_nvs_conf_ndis(struct hn_softc *, int);
+static int hn_nvs_init_ndis(struct hn_softc *);
+static int hn_nvs_doinit(struct hn_softc *, uint32_t);
+static int hn_nvs_init(struct hn_softc *);
+static const void  *hn_nvs_xact_execute(struct hn_softc *,
+   struct vmbus_xact *, void *, int,
+   size_t *, uint32_t);
+static voidhn_nvs_sent_none(struct hn_nvs_sendctx *,
+   struct hn_softc *, struct vmbus_channel *,
+   const void *, int);
 
-struct hn_nvs_sendctx  hn_nvs_sendctx_none =
+struct hn_nvs_sendctx  hn_nvs_sendctx_none =
 HN_NVS_SENDCTX_INITIALIZER(hn_nvs_sent_none, NULL);
 
 static const uint32_t  hn_nvs_version[] = {
___
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: r307990 - head/sys/dev/hyperv/netvsc

2016-10-26 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Oct 27 05:26:04 2016
New Revision: 307990
URL: https://svnweb.freebsd.org/changeset/base/307990

Log:
  hyperv/hn: Move send context to NVS domain.
  
  Since all sends are encapsulated in NVS messages.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8346

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  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/if_hnvar.h

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:13:00 2016
(r307989)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:26:04 2016
(r307990)
@@ -39,18 +39,24 @@
 #include 
 #include 
 #include 
+#include 
+
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
+
+#include 
+#include 
 
 #include 
+#include 
+#include 
 #include 
-#include 
-#include 
+
+#include 
 #include 
 #include 
+#include 
 
 /*
  * Forward declarations
@@ -59,12 +65,12 @@ static int  hn_nvs_conn_chim(struct hn_s
 static int  hn_nvs_conn_rxbuf(struct hn_softc *);
 static int  hn_nvs_disconn_chim(struct hn_softc *sc);
 static int  hn_nvs_disconn_rxbuf(struct hn_softc *sc);
-static void hn_nvs_sent_none(struct hn_send_ctx *sndc,
+static void hn_nvs_sent_none(struct hn_nvs_sendctx *sndc,
 struct hn_softc *, struct vmbus_channel *chan,
 const void *, int);
 
-struct hn_send_ctx hn_send_ctx_none =
-HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL);
+struct hn_nvs_sendctx  hn_nvs_sendctx_none =
+HN_NVS_SENDCTX_INITIALIZER(hn_nvs_sent_none, NULL);
 
 static const uint32_t  hn_nvs_version[] = {
HN_NVS_VERSION_5,
@@ -77,7 +83,7 @@ static const void *
 hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact,
 void *req, int reqlen, size_t *resplen0, uint32_t type)
 {
-   struct hn_send_ctx sndc;
+   struct hn_nvs_sendctx sndc;
size_t resplen, min_resplen = *resplen0;
const struct hn_nvs_hdr *hdr;
int error;
@@ -88,7 +94,7 @@ hn_nvs_xact_execute(struct hn_softc *sc,
/*
 * Execute the xact setup by the caller.
 */
-   hn_send_ctx_init(&sndc, hn_nvs_sent_xact, xact);
+   hn_nvs_sendctx_init(&sndc, hn_nvs_sent_xact, xact);
 
vmbus_xact_activate(xact);
error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC,
@@ -121,7 +127,7 @@ hn_nvs_req_send(struct hn_softc *sc, voi
 {
 
return (hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE,
-   req, reqlen, &hn_send_ctx_none));
+   req, reqlen, &hn_nvs_sendctx_none));
 }
 
 static int 
@@ -604,7 +610,7 @@ hn_nvs_detach(struct hn_softc *sc)
 }
 
 void
-hn_nvs_sent_xact(struct hn_send_ctx *sndc,
+hn_nvs_sent_xact(struct hn_nvs_sendctx *sndc,
 struct hn_softc *sc __unused, struct vmbus_channel *chan __unused,
 const void *data, int dlen)
 {
@@ -613,7 +619,7 @@ hn_nvs_sent_xact(struct hn_send_ctx *snd
 }
 
 static void
-hn_nvs_sent_none(struct hn_send_ctx *sndc __unused,
+hn_nvs_sent_none(struct hn_nvs_sendctx *sndc __unused,
 struct hn_softc *sc __unused, struct vmbus_channel *chan __unused,
 const void *data __unused, int dlen __unused)
 {
@@ -670,3 +676,12 @@ done:
vmbus_xact_put(xact);
return (error);
 }
+
+int
+hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan,
+struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt)
+{
+
+   return hn_nvs_send_rndis_sglist(chan, HN_NVS_RNDIS_MTYPE_CTRL,
+   sndc, gpa, gpa_cnt);
+}

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 05:13:00 2016
(r307989)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 05:26:04 2016
(r307990)
@@ -31,31 +31,76 @@
 #ifndef __HV_NET_VSC_H__
 #define __HV_NET_VSC_H__
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
+struct hn_nvs_sendctx;
+struct vmbus_channel;
+struct hn_softc;
+
+typedef void   (*hn_nvs_sent_t)
+   (struct hn_nvs_sendctx *, struct hn_softc *,
+struct vmbus_channel *, const void *, int);
+
+struct hn_nvs_sendctx {
+   hn_nvs_sent_t   hn_cb;
+   void*hn_cbarg;
+};
+
+#define HN_NVS_SENDCTX_INITIALIZER(cb, cbarg)  \
+{  \
+   .hn_cb  = cb,   \
+   .hn_cbarg   = cbarg \
+}
+
+static __inline void
+hn_nvs_sendctx_init(struct hn_nvs_sendctx *sndc, hn_nvs_sent_t cb, void *cbarg)
+{
+

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

2016-10-26 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Oct 27 05:13:00 2016
New Revision: 307989
URL: https://svnweb.freebsd.org/changeset/base/307989

Log:
  hyperv/hn: Move hn_softc to if_hnvar.h
  
  While I'm here, use consistent macro names.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8345

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:04:54 2016
(r307988)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:13:00 2016
(r307989)
@@ -138,9 +138,9 @@ hn_nvs_conn_rxbuf(struct hn_softc *sc)
 * Limit RXBUF size for old NVS.
 */
if (sc->hn_nvs_ver <= HN_NVS_VERSION_2)
-   rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY;
+   rxbuf_size = HN_RXBUF_SIZE_COMPAT;
else
-   rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE;
+   rxbuf_size = HN_RXBUF_SIZE;
 
/*
 * Connect the RXBUF GPADL to the primary channel.
@@ -219,8 +219,7 @@ hn_nvs_conn_chim(struct hn_softc *sc)
 * Sub-channels just share this chimney sending buffer.
 */
error = vmbus_chan_gpadl_connect(sc->hn_prichan,
-   sc->hn_chim_dma.hv_paddr, NETVSC_SEND_BUFFER_SIZE,
-   &sc->hn_chim_gpadl);
+   sc->hn_chim_dma.hv_paddr, HN_CHIM_SIZE, &sc->hn_chim_gpadl);
if (error) {
if_printf(sc->hn_ifp, "chim gpadl conn failed: %d\n", error);
goto cleanup;
@@ -267,8 +266,8 @@ hn_nvs_conn_chim(struct hn_softc *sc)
}
 
sc->hn_chim_szmax = sectsz;
-   sc->hn_chim_cnt = NETVSC_SEND_BUFFER_SIZE / sc->hn_chim_szmax;
-   if (NETVSC_SEND_BUFFER_SIZE % sc->hn_chim_szmax != 0) {
+   sc->hn_chim_cnt = HN_CHIM_SIZE / sc->hn_chim_szmax;
+   if (HN_CHIM_SIZE % sc->hn_chim_szmax != 0) {
if_printf(sc->hn_ifp, "chimney sending sections are "
"not properly aligned\n");
}

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 05:04:54 2016
(r307988)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 05:13:00 2016
(r307989)
@@ -28,13 +28,6 @@
  * $FreeBSD$
  */
 
-/*
- * HyperV vmbus (virtual machine bus) network VSC (virtual services client)
- * header file
- *
- * (Updated from unencumbered NvspProtocol.h)
- */
-
 #ifndef __HV_NET_VSC_H__
 #define __HV_NET_VSC_H__
 
@@ -64,224 +57,5 @@
 
 #include 
 
-#define HN_USE_TXDESC_BUFRING
-
-/*
- * The following arguably belongs in a separate header file
- */
-
-/*
- * Defines
- */
-
-#define NETVSC_SEND_BUFFER_SIZE(1024*1024*15)   /* 15M 
*/
-
-#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY  (1024*1024*15) /* 15MB */
-#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */
-
-/*
- * Maximum MTU we permit to be configured for a netvsc interface.
- * When the code was developed, a max MTU of 12232 was tested and
- * proven to work.  9K is a reasonable maximum for an Ethernet.
- */
-#define NETVSC_MAX_CONFIGURABLE_MTU(9 * 1024)
-
-#define NETVSC_PACKET_SIZE PAGE_SIZE
-
-/*
- * Data types
- */
-
-struct vmbus_channel;
-
-#define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE)
-#define NETVSC_PACKET_MAXPAGE  32
-
-#define HN_XACT_REQ_PGCNT  2
-#define HN_XACT_RESP_PGCNT 2
-#define HN_XACT_REQ_SIZE   (HN_XACT_REQ_PGCNT * PAGE_SIZE)
-#define HN_XACT_RESP_SIZE  (HN_XACT_RESP_PGCNT * PAGE_SIZE)
-
-struct hn_txdesc;
-#ifndef HN_USE_TXDESC_BUFRING
-SLIST_HEAD(hn_txdesc_list, hn_txdesc);
-#else
-struct buf_ring;
-#endif
-
-struct hn_tx_ring;
-
-struct hn_rx_ring {
-   struct ifnet*hn_ifp;
-   struct hn_tx_ring *hn_txr;
-   void*hn_rdbuf;
-   uint8_t *hn_rxbuf;  /* shadow sc->hn_rxbuf */
-   int hn_rx_idx;
-
-   /* Trust csum verification on host side */
-   int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */
-   struct lro_ctrl hn_lro;
-
-   u_long  hn_csum_ip;
-   u_long  hn_csum_tcp;
-   u_long  hn_csum_udp;
-   u_long  hn_csum_trusted;
-   u_long  hn_lro_tried;
-   u_long  hn_small_pkts;
-   u_long  hn_pkts;
-   u_long  hn_rss_pkts;
-
-   /* Rarely used stuffs */
-   struct sysctl_oid *hn_rx_sysctl_tree;
-   int hn_rx_flags;
-
-   void*hn_br; /* TX/RX bufring */
-   struct hyperv_dma hn_br_dma;
-} __aligned(CACHE_LINE_

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

2016-10-26 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Oct 27 05:04:54 2016
New Revision: 307988
URL: https://svnweb.freebsd.org/changeset/base/307988

Log:
  hyperv/hn: Shuffle chimney sending buffer alloc/free around.
  
  This paves way for more chimney sending buffer reorganization.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8343

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 04:55:19 2016
(r307987)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:04:54 2016
(r307988)
@@ -73,33 +73,6 @@ static const uint32_thn_nvs_version[] 
HN_NVS_VERSION_1
 };
 
-uint32_t
-hn_chim_alloc(struct hn_softc *sc)
-{
-   int i, bmap_cnt = sc->hn_chim_bmap_cnt;
-   u_long *bmap = sc->hn_chim_bmap;
-   uint32_t ret = HN_NVS_CHIM_IDX_INVALID;
-
-   for (i = 0; i < bmap_cnt; ++i) {
-   int idx;
-
-   idx = ffsl(~bmap[i]);
-   if (idx == 0)
-   continue;
-
-   --idx; /* ffsl is 1-based */
-   KASSERT(i * LONG_BIT + idx < sc->hn_chim_cnt,
-   ("invalid i %d and idx %d", i, idx));
-
-   if (atomic_testandset_long(&bmap[i], idx))
-   continue;
-
-   ret = i * LONG_BIT + idx;
-   break;
-   }
-   return (ret);
-}
-
 static const void *
 hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact,
 void *req, int reqlen, size_t *resplen0, uint32_t type)
@@ -648,25 +621,6 @@ hn_nvs_sent_none(struct hn_send_ctx *snd
/* EMPTY */
 }
 
-void
-hn_chim_free(struct hn_softc *sc, uint32_t chim_idx)
-{
-   u_long mask;
-   uint32_t idx;
-
-   idx = chim_idx / LONG_BIT;
-   KASSERT(idx < sc->hn_chim_bmap_cnt,
-   ("invalid chimney index 0x%x", chim_idx));
-
-   mask = 1UL << (chim_idx % LONG_BIT);
-   KASSERT(sc->hn_chim_bmap[idx] & mask,
-   ("index bitmap 0x%lx, chimney index %u, "
-"bitmap idx %d, bitmask 0x%lx",
-sc->hn_chim_bmap[idx], chim_idx, idx, mask));
-
-   atomic_clear_long(&sc->hn_chim_bmap[idx], mask);
-}
-
 int
 hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch0)
 {

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Oct 27 04:55:19 
2016(r307987)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Oct 27 05:04:54 
2016(r307988)
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -457,6 +458,52 @@ hn_sendpkt_rndis_chim(struct hn_tx_ring 
&rndis, sizeof(rndis), &txd->send_ctx));
 }
 
+static __inline uint32_t
+hn_chim_alloc(struct hn_softc *sc)
+{
+   int i, bmap_cnt = sc->hn_chim_bmap_cnt;
+   u_long *bmap = sc->hn_chim_bmap;
+   uint32_t ret = HN_NVS_CHIM_IDX_INVALID;
+
+   for (i = 0; i < bmap_cnt; ++i) {
+   int idx;
+
+   idx = ffsl(~bmap[i]);
+   if (idx == 0)
+   continue;
+
+   --idx; /* ffsl is 1-based */
+   KASSERT(i * LONG_BIT + idx < sc->hn_chim_cnt,
+   ("invalid i %d and idx %d", i, idx));
+
+   if (atomic_testandset_long(&bmap[i], idx))
+   continue;
+
+   ret = i * LONG_BIT + idx;
+   break;
+   }
+   return (ret);
+}
+
+static __inline void
+hn_chim_free(struct hn_softc *sc, uint32_t chim_idx)
+{
+   u_long mask;
+   uint32_t idx;
+
+   idx = chim_idx / LONG_BIT;
+   KASSERT(idx < sc->hn_chim_bmap_cnt,
+   ("invalid chimney index 0x%x", chim_idx));
+
+   mask = 1UL << (chim_idx % LONG_BIT);
+   KASSERT(sc->hn_chim_bmap[idx] & mask,
+   ("index bitmap 0x%lx, chimney index %u, "
+"bitmap idx %d, bitmask 0x%lx",
+sc->hn_chim_bmap[idx], chim_idx, idx, mask));
+
+   atomic_clear_long(&sc->hn_chim_bmap[idx], mask);
+}
+
 static int
 hn_set_rxfilter(struct hn_softc *sc)
 {

Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h
==
--- head/sys/dev/hyperv/netvsc/if_hnvar.h   Thu Oct 27 04:55:19 2016
(r307987)
+++ head/sys/dev/hyperv/netvsc/if_hnvar.h   Thu Oct 27 05:04:54 2016
(r307988)
@@ -94,9 +94,6 @@ hn_nvs_send_sglist(struct vmbus_channel 
 struct vmbus_xact;
 struct rndis_packet_msg;
 
-uint32_t   hn_chim_alloc(struct hn_softc *sc);
-void   hn_chim_free(struct hn_softc *sc, uint32_t chim_id

svn commit: r307987 - in head/sys: dev/hyperv/netvsc net

2016-10-26 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Oct 27 04:55:19 2016
New Revision: 307987
URL: https://svnweb.freebsd.org/changeset/base/307987

Log:
  hyperv/hn: Define empty packet filter.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8342

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

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Oct 27 04:42:39 
2016(r307986)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Oct 27 04:55:19 
2016(r307987)
@@ -3849,8 +3849,8 @@ hn_suspend_data(struct hn_softc *sc)
/*
 * Disable RX by clearing RX filter.
 */
-   hn_rndis_set_rxfilter(sc, 0);
-   sc->hn_rx_filter = 0;
+   sc->hn_rx_filter = NDIS_PACKET_TYPE_NONE;
+   hn_rndis_set_rxfilter(sc, sc->hn_rx_filter);
 
/*
 * Give RNDIS enough time to flush all pending data packets.

Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h
==
--- head/sys/dev/hyperv/netvsc/if_hnvar.h   Thu Oct 27 04:42:39 2016
(r307986)
+++ head/sys/dev/hyperv/netvsc/if_hnvar.h   Thu Oct 27 04:55:19 2016
(r307987)
@@ -106,7 +106,7 @@ int hn_rndis_query_rsscaps(struct hn_so
 inthn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr);
 inthn_rndis_get_linkstatus(struct hn_softc *sc,
uint32_t *link_status);
-/* filter: NDIS_PACKET_TYPE_ or 0. */
+/* filter: NDIS_PACKET_TYPE_. */
 inthn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter);
 
 inthn_nvs_attach(struct hn_softc *sc, int mtu);

Modified: head/sys/net/rndis.h
==
--- head/sys/net/rndis.hThu Oct 27 04:42:39 2016(r307986)
+++ head/sys/net/rndis.hThu Oct 27 04:55:19 2016(r307987)
@@ -352,6 +352,7 @@ struct rndis_keepalive_comp {
 };
 
 /* Packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
+#defineNDIS_PACKET_TYPE_NONE   0x
 #defineNDIS_PACKET_TYPE_DIRECTED   0x0001
 #defineNDIS_PACKET_TYPE_MULTICAST  0x0002
 #defineNDIS_PACKET_TYPE_ALL_MULTICAST  0x0004
___
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: r307986 - head/sys/dev/hyperv/netvsc

2016-10-26 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Oct 27 04:42:39 2016
New Revision: 307986
URL: https://svnweb.freebsd.org/changeset/base/307986

Log:
  hyperv/hn: Move %b format string for capabilities near their definition.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8341

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 04:28:01 2016
(r307985)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 04:42:39 2016
(r307986)
@@ -275,6 +275,11 @@ struct hn_softc {
 #define HN_CAP_TSO60x0100
 #define HN_CAP_HASHVAL 0x0200
 
+/* Capability description for use with printf(9) %b identifier. */
+#define HN_CAP_BITS\
+   "\020\1VLAN\2MTU\3IPCS\4TCP4CS\5TCP6CS" \
+   "\6UDP4CS\7UDP6CS\10TSO4\11TSO6\12HASHVAL"
+
 #define HN_LINK_FLAG_LINKUP0x0001
 #define HN_LINK_FLAG_NETCHG0x0002
 

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Oct 27 04:28:01 
2016(r307985)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Oct 27 04:42:39 
2016(r307986)
@@ -2379,18 +2379,7 @@ hn_caps_sysctl(SYSCTL_HANDLER_ARGS)
HN_LOCK(sc);
caps = sc->hn_caps;
HN_UNLOCK(sc);
-   snprintf(caps_str, sizeof(caps_str), "%b", caps,
-   "\020"
-   "\001VLAN"
-   "\002MTU"
-   "\003IPCS"
-   "\004TCP4CS"
-   "\005TCP6CS"
-   "\006UDP4CS"
-   "\007UDP6CS"
-   "\010TSO4"
-   "\011TSO6"
-   "\012HASHVAL");
+   snprintf(caps_str, sizeof(caps_str), "%b", caps, HN_CAP_BITS);
return sysctl_handle_string(oidp, caps_str, sizeof(caps_str), req);
 }
 
___
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: r307985 - head/sys/dev/hyperv/netvsc

2016-10-26 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Oct 27 04:28:01 2016
New Revision: 307985
URL: https://svnweb.freebsd.org/changeset/base/307985

Log:
  hyperv/hn: Nuke unnecessary M_NETVSC
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8340

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  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 Thu Oct 27 04:26:33 2016
(r307984)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 04:28:01 2016
(r307985)
@@ -52,8 +52,6 @@
 #include 
 #include 
 
-MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver");
-
 /*
  * Forward declarations
  */
@@ -308,7 +306,7 @@ hn_nvs_conn_chim(struct hn_softc *sc)
 
sc->hn_chim_bmap_cnt = sc->hn_chim_cnt / LONG_BIT;
sc->hn_chim_bmap = malloc(sc->hn_chim_bmap_cnt * sizeof(u_long),
-   M_NETVSC, M_WAITOK | M_ZERO);
+   M_DEVBUF, M_WAITOK | M_ZERO);
 
/* Done! */
sc->hn_flags |= HN_FLAG_CHIM_CONNECTED;
@@ -427,7 +425,7 @@ hn_nvs_disconn_chim(struct hn_softc *sc)
}
 
if (sc->hn_chim_bmap != NULL) {
-   free(sc->hn_chim_bmap, M_NETVSC);
+   free(sc->hn_chim_bmap, M_DEVBUF);
sc->hn_chim_bmap = NULL;
}
return (0);

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 04:26:33 2016
(r307984)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 04:28:01 2016
(r307985)
@@ -66,8 +66,6 @@
 
 #define HN_USE_TXDESC_BUFRING
 
-MALLOC_DECLARE(M_NETVSC);
-
 /*
  * The following arguably belongs in a separate header file
  */

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Oct 27 04:26:33 
2016(r307984)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Oct 27 04:28:01 
2016(r307985)
@@ -2606,7 +2606,7 @@ hn_create_rx_data(struct hn_softc *sc, i
sc->hn_rx_ring_inuse = sc->hn_rx_ring_cnt;
 
sc->hn_rx_ring = malloc(sizeof(struct hn_rx_ring) * sc->hn_rx_ring_cnt,
-   M_NETVSC, M_WAITOK | M_ZERO);
+   M_DEVBUF, M_WAITOK | M_ZERO);
 
 #if defined(INET) || defined(INET6)
 #if __FreeBSD_version >= 1100095
@@ -2647,7 +2647,7 @@ hn_create_rx_data(struct hn_softc *sc, i
rxr->hn_ifp = sc->hn_ifp;
if (i < sc->hn_tx_ring_cnt)
rxr->hn_txr = &sc->hn_tx_ring[i];
-   rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK);
+   rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_DEVBUF, M_WAITOK);
rxr->hn_rx_idx = i;
rxr->hn_rxbuf = sc->hn_rxbuf;
 
@@ -2794,9 +2794,9 @@ hn_destroy_rx_data(struct hn_softc *sc)
 #if defined(INET) || defined(INET6)
tcp_lro_free(&rxr->hn_lro);
 #endif
-   free(rxr->hn_rdbuf, M_NETVSC);
+   free(rxr->hn_rdbuf, M_DEVBUF);
}
-   free(sc->hn_rx_ring, M_NETVSC);
+   free(sc->hn_rx_ring, M_DEVBUF);
sc->hn_rx_ring = NULL;
 
sc->hn_rx_ring_cnt = 0;
@@ -2821,11 +2821,11 @@ hn_create_tx_ring(struct hn_softc *sc, i
 
txr->hn_txdesc_cnt = HN_TX_DESC_CNT;
txr->hn_txdesc = malloc(sizeof(struct hn_txdesc) * txr->hn_txdesc_cnt,
-   M_NETVSC, M_WAITOK | M_ZERO);
+   M_DEVBUF, M_WAITOK | M_ZERO);
 #ifndef HN_USE_TXDESC_BUFRING
SLIST_INIT(&txr->hn_txlist);
 #else
-   txr->hn_txdesc_br = buf_ring_alloc(txr->hn_txdesc_cnt, M_NETVSC,
+   txr->hn_txdesc_br = buf_ring_alloc(txr->hn_txdesc_cnt, M_DEVBUF,
M_WAITOK, &txr->hn_tx_lock);
 #endif
 
@@ -2843,7 +2843,7 @@ hn_create_tx_ring(struct hn_softc *sc, i
TASK_INIT(&txr->hn_txeof_task, 0, hn_xmit_txeof_taskfunc, txr);
 
br_depth = hn_get_txswq_depth(txr);
-   txr->hn_mbuf_br = buf_ring_alloc(br_depth, M_NETVSC,
+   txr->hn_mbuf_br = buf_ring_alloc(br_depth, M_DEVBUF,
M_WAITOK, &txr->hn_tx_lock);
}
 
@@ -3026,14 +3026,14 @@ hn_destroy_tx_ring(struct hn_tx_ring *tx
bus_dma_tag_destroy(txr->hn_tx_rndis_dtag);
 
 #ifdef HN_USE_TXDESC_BUFRING
-   buf_ring_free(txr->hn_txdesc_br, M_NETVSC);
+   buf_ring_free(txr->hn_txdesc_br, M_DEVBUF);
 #endif
 
-   free(txr->hn_txdesc, M_NETVSC);
+   free(txr->hn_txdesc, M_DEVBUF);
txr->hn_txdesc = NULL;
 
if (txr->hn_mbuf_br != NULL)
-   buf_ring_free(txr->hn_mbuf_br, M_NETVSC);
+   buf_ring_free(txr->hn_mbuf_br, M_DEVBUF);

svn commit: r307984 - in head/sys/arm: allwinner conf

2016-10-26 Thread Ganbold Tsagaankhuu
Author: ganbold
Date: Thu Oct 27 04:26:33 2016
New Revision: 307984
URL: https://svnweb.freebsd.org/changeset/base/307984

Log:
  Add support for Allwinner Consumer IR interface.
  RX is supported now and the driver is using evdev framework.
  It was tested on Cubieboard2 (A20 SoC) using lirc
  with dfrobot's IR remote controller.

Added:
  head/sys/arm/allwinner/aw_cir.c   (contents, props changed)
Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/conf/GENERIC

Added: head/sys/arm/allwinner/aw_cir.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/allwinner/aw_cir.c Thu Oct 27 04:26:33 2016
(r307984)
@@ -0,0 +1,535 @@
+/*-
+ * Copyright (c) 2016 Ganbold Tsagaankhuu 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Allwinner Consumer IR controller
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#defineREAD(_sc, _r)   bus_read_4((_sc)->res[0], (_r))
+#defineWRITE(_sc, _r, _v)  bus_write_4((_sc)->res[0], (_r), (_v))
+
+/* IR Control */
+#defineAW_IR_CTL   0x00
+/* Global Enable */
+#define AW_IR_CTL_GEN  (1 << 0)
+/* RX enable */
+#define AW_IR_CTL_RXEN (1 << 1)
+/* CIR mode enable */
+#define AW_IR_CTL_MD   (1 << 4) | (1 << 5)
+
+/* RX Config Reg */
+#defineAW_IR_RXCTL 0x10
+/* Pulse Polarity Invert flag */
+#define AW_IR_RXCTL_RPPI   (1 << 2)
+
+/* RX Data */
+#defineAW_IR_RXFIFO0x20
+
+/* RX Interrupt Control */
+#defineAW_IR_RXINT 0x2C
+/* RX FIFO Overflow */
+#define AW_IR_RXINT_ROI_EN (1 << 0)
+/* RX Packet End */
+#define AW_IR_RXINT_RPEI_EN(1 << 1)
+/* RX FIFO Data Available */
+#define AW_IR_RXINT_RAI_EN (1 << 4)
+/* RX FIFO available byte level */
+#define AW_IR_RXINT_RAL(val)   ((val) << 8)
+
+/* RX Interrupt Status Reg */
+#defineAW_IR_RXSTA 0x30
+/* RX FIFO Get Available Counter */
+#define AW_IR_RXSTA_COUNTER(val)   (((val) >> 8) & (sc->fifo_size 
* 2 - 1))
+/* Clear all interrupt status */
+#define AW_IR_RXSTA_CLEARALL   0xff
+
+/* IR Sample Configure Reg */
+#defineAW_IR_CIR   0x34
+/* Filter Threshold = 8 * 21.3 = ~128us < 200us */
+#define AW_IR_RXFILT_VAL   (((8) & 0x3f) << 2)
+/* Idle Threshold = (2 + 1) * 128 * 42.7 = ~16.4ms > 9ms */
+#define AW_IR_RXIDLE_VAL   (((2) & 0xff) << 8)
+
+/* Bit 15 - value (pulse/space) */
+#defineVAL_MASK0x80
+/* Bits 0:14 - sample duration  */
+#definePERIOD_MASK 0x7f
+
+/* Clock rate for IR0 or IR1 clock in CIR mode */
+#defineAW_IR_BASE_CLK  300
+/* Frequency sample 3MHz/64 = 46875Hz (21.3us) */
+#defineAW_IR_SAMPLE_64 (0 << 0)
+/* Frequency sample 3MHz/128 = 23437.5Hz (42.7us) */
+#defineAW_IR_SAMPLE_128(1 << 0)
+
+#defineAW_IR_ERROR_CODE0x
+#defineAW_IR_REPEAT_CODE   0x0
+
+/* 80 * 42.7 = ~3.4ms, Lead1(4.5ms) > AW_IR_L1_MIN */
+#defineAW_IR_L1_MIN80
+/* 40 * 42.7 = ~1.7ms, Lead0(4.5ms) Lead0R(2.25ms) > AW_IR_L0_MIN */
+#define

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

2016-10-26 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Oct 27 03:43:27 2016
New Revision: 307983
URL: https://svnweb.freebsd.org/changeset/base/307983

Log:
  hyperv/hn: Properly configure RSS according to RSS capabilities
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8338

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/ndis.h

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 02:20:13 2016
(r307982)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 03:43:27 2016
(r307983)
@@ -255,6 +255,8 @@ struct hn_softc {
int hn_ndis_tso_szmax;
int hn_ndis_tso_sgmin;
 
+   int hn_rss_ind_size;
+   uint32_thn_rss_hash;/* NDIS_HASH_ */
struct ndis_rssprm_toeplitz hn_rss;
 };
 

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Oct 27 02:20:13 
2016(r307982)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Oct 27 03:43:27 
2016(r307983)
@@ -329,6 +329,7 @@ static int hn_hwassist_sysctl(SYSCTL_HAN
 static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS);
+static int hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_check_iplen(const struct mbuf *, int);
 static int hn_create_tx_ring(struct hn_softc *, int);
 static void hn_destroy_tx_ring(struct hn_tx_ring *);
@@ -770,6 +771,11 @@ netvsc_attach(device_t dev)
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter",
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0,
hn_rxfilter_sysctl, "A", "rxfilter");
+   SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_hash",
+   CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0,
+   hn_rss_hash_sysctl, "A", "RSS hash");
+   SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rss_ind_size",
+   CTLFLAG_RD, &sc->hn_rss_ind_size, 0, "RSS indirect entry count");
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key",
CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0,
hn_rss_key_sysctl, "IU", "RSS key");
@@ -2479,6 +2485,20 @@ back:
 }
 
 static int
+hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS)
+{
+   struct hn_softc *sc = arg1;
+   char hash_str[128];
+   uint32_t hash;
+
+   HN_LOCK(sc);
+   hash = sc->hn_rss_hash;
+   HN_UNLOCK(sc);
+   snprintf(hash_str, sizeof(hash_str), "%b", hash, NDIS_HASH_BITS);
+   return sysctl_handle_string(oidp, hash_str, sizeof(hash_str), req);
+}
+
+static int
 hn_check_iplen(const struct mbuf *m, int hoff)
 {
const struct ip *ip;
@@ -3642,6 +3662,10 @@ hn_synth_attach(struct hn_softc *sc, int
old_caps = sc->hn_caps;
sc->hn_caps = 0;
 
+   /* Clear RSS stuffs. */
+   sc->hn_rss_ind_size = 0;
+   sc->hn_rss_hash = 0;
+
/*
 * Attach the primary channel _before_ attaching NVS and RNDIS.
 */
@@ -3716,7 +3740,6 @@ hn_synth_attach(struct hn_softc *sc, int
if_printf(sc->hn_ifp, "setup default RSS indirect "
"table\n");
}
-   /* TODO: Take ndis_rss_caps.ndis_nind into account. */
for (i = 0; i < NDIS_HASH_INDCNT; ++i)
rss->rss_ind[i] = i % nchan;
sc->hn_flags |= HN_FLAG_HAS_RSSIND;

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cThu Oct 27 02:20:13 
2016(r307982)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cThu Oct 27 03:43:27 
2016(r307983)
@@ -747,13 +747,14 @@ done:
 }
 
 int
-hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt)
+hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt0)
 {
struct ndis_rss_caps in, caps;
size_t caps_len;
-   int error;
+   int error, indsz, rxr_cnt, hash_fnidx;
+   uint32_t hash_func = 0, hash_types = 0;
 
-   *rxr_cnt = 0;
+   *rxr_cnt0 = 0;
 
if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_20)
return (EOPNOTSUPP);
@@ -792,18 +793,73 @@ hn_rndis_query_rsscaps(struct hn_softc *
return (EINVAL);
}
 
+   /*
+* Save information for later RSS configuration.
+*/
if (caps.ndis_nrxr == 0) {
if_printf(sc->hn_ifp, "0 RX rings!?\n");
return (EINVAL);
}
-   *rxr_cnt = caps.ndis

svn commit: r307982 - head/sys/dev/re

2016-10-26 Thread Kevin Lo
Author: kevlo
Date: Thu Oct 27 02:20:13 2016
New Revision: 307982
URL: https://svnweb.freebsd.org/changeset/base/307982

Log:
  Disable CLKREQ for ASPM since re(4) doesn't implement link level power saving.
  
  Reviewed by:  yongari

Modified:
  head/sys/dev/re/if_re.c

Modified: head/sys/dev/re/if_re.c
==
--- head/sys/dev/re/if_re.c Thu Oct 27 00:33:14 2016(r307981)
+++ head/sys/dev/re/if_re.c Thu Oct 27 02:20:13 2016(r307982)
@@ -1358,15 +1358,17 @@ re_attach(device_t dev)
CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
}
 
-   /* Disable ASPM L0S/L1. */
+   /* Disable ASPM L0S/L1 and CLKREQ. */
if (sc->rl_expcap != 0) {
cap = pci_read_config(dev, sc->rl_expcap +
PCIER_LINK_CAP, 2);
if ((cap & PCIEM_LINK_CAP_ASPM) != 0) {
ctl = pci_read_config(dev, sc->rl_expcap +
PCIER_LINK_CTL, 2);
-   if ((ctl & PCIEM_LINK_CTL_ASPMC) != 0) {
-   ctl &= ~PCIEM_LINK_CTL_ASPMC;
+   if ((ctl & (PCIEM_LINK_CTL_ECPM |
+   PCIEM_LINK_CTL_ASPMC))!= 0) {
+   ctl &= ~(PCIEM_LINK_CTL_ECPM |
+   PCIEM_LINK_CTL_ASPMC);
pci_write_config(dev, sc->rl_expcap +
PCIER_LINK_CTL, ctl, 2);
device_printf(dev, "ASPM disabled\n");
___
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: r307578 - head/sys/dev/bxe

2016-10-26 Thread Mark Johnston
On Tue, Oct 18, 2016 at 09:33:57PM +, David C Somayajulu wrote:
> Author: davidcs
> Date: Tue Oct 18 21:33:57 2016
> New Revision: 307578
> URL: https://svnweb.freebsd.org/changeset/base/307578
> 
> Log:
>   1.  Use taskqueue_create() instead of taskqueue_create_fast() for both
>   fastpath and slowpath taskqueues.
>   2. Service all transmits in taskqueue threads.
>   3. additional stats counters for  keeping track of
>   - bd availability
>   - tx buf ring not emptied in the fp task queue.
> These are drained via timeout taskqueue.
>   - tx attempts during link down.
>   
>   MFC after: 5 days
Submitted by:   Matt Joras
___
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: r307979 - head/sys/net

2016-10-26 Thread Bryan Drewery
Author: bdrewery
Date: Wed Oct 26 23:40:07 2016
New Revision: 307979
URL: https://svnweb.freebsd.org/changeset/base/307979

Log:
  Remove excess CTLFLAG_VNET
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/net/if_bridge.c

Modified: head/sys/net/if_bridge.c
==
--- head/sys/net/if_bridge.cWed Oct 26 20:28:23 2016(r307978)
+++ head/sys/net/if_bridge.cWed Oct 26 23:40:07 2016(r307979)
@@ -408,7 +408,7 @@ SYSCTL_INT(_net_link_bridge, OID_AUTO, i
 static VNET_DEFINE(int, allow_llz_overlap) = 0;
 #defineV_allow_llz_overlap VNET(allow_llz_overlap)
 SYSCTL_INT(_net_link_bridge, OID_AUTO, allow_llz_overlap,
-CTLFLAG_VNET | CTLFLAG_RW | CTLFLAG_VNET, &VNET_NAME(allow_llz_overlap), 0,
+CTLFLAG_RW | CTLFLAG_VNET, &VNET_NAME(allow_llz_overlap), 0,
 "Allow overlap of link-local scope "
 "zones of a bridge interface and the member interfaces");
 
___
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: r307978 - head/sys/ufs/ufs

2016-10-26 Thread Kirk McKusick
Author: mckusick
Date: Wed Oct 26 20:28:23 2016
New Revision: 307978
URL: https://svnweb.freebsd.org/changeset/base/307978

Log:
  The UFS/FFS filesystem checks directory link counts when doing
  directory create and delete operations. If it ever finds a directory
  with a link count less than 2, it panics. Thus, an rm -rf that
  encounters a directory with a link count below 2 causes a kernel
  panic. The proposed fix is to return the error EINVAL rather than
  panicing. The effect is that the requested operation is not done,
  but the system continues to run. At a more convenient later time,
  the filesystem can be unmounted and cleaned (with fsck or journal
  run). Once cleaned, the operation can be rerun to successful
  completion.
  
  This fix takes that approach. The panic message has been converted
  into a uprintf(9) to provide the user with the inode number and
  filesystem mount point of the offending directory and EINVAL is
  returned for the operation.
  
  The long (three year) delay in fixing this problem occurred because
  the bug was misclassified when originally assigned and only this week
  was found during a sweep of old unresolved bug reports.
  
  PR:  180894
  Reviewed by: kib
  MFC after:   2 weeks

Modified:
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ufs/ufs_vnops.c
==
--- head/sys/ufs/ufs/ufs_vnops.cWed Oct 26 20:12:30 2016
(r307977)
+++ head/sys/ufs/ufs/ufs_vnops.cWed Oct 26 20:28:23 2016
(r307978)
@@ -105,7 +105,7 @@ static vop_create_t ufs_create;
 static vop_getattr_t   ufs_getattr;
 static vop_ioctl_t ufs_ioctl;
 static vop_link_t  ufs_link;
-static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct 
componentname *);
+static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct 
componentname *, const char *);
 static vop_markatime_t ufs_markatime;
 static vop_mkdir_t ufs_mkdir;
 static vop_mknod_t ufs_mknod;
@@ -204,7 +204,7 @@ ufs_create(ap)
 
error =
ufs_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode),
-   ap->a_dvp, ap->a_vpp, ap->a_cnp);
+   ap->a_dvp, ap->a_vpp, ap->a_cnp, "ufs_create");
if (error != 0)
return (error);
if ((ap->a_cnp->cn_flags & MAKEENTRY) != 0)
@@ -232,7 +232,7 @@ ufs_mknod(ap)
int error;
 
error = ufs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode),
-   ap->a_dvp, vpp, ap->a_cnp);
+   ap->a_dvp, vpp, ap->a_cnp, "ufs_mknod");
if (error)
return (error);
ip = VTOI(*vpp);
@@ -942,6 +942,17 @@ out:
return (error);
 }
 
+static void
+print_bad_link_count(const char *funcname, struct vnode *dvp)
+{
+   struct inode *dip;
+
+   dip = VTOI(dvp);
+   uprintf("%s: Bad link count %d on parent inode %d in file system %s\n",
+   funcname, dip->i_effnlink, dip->i_number,
+   dvp->v_mount->mnt_stat.f_mntonname);
+}
+
 /*
  * link vnode call
  */
@@ -964,9 +975,11 @@ ufs_link(ap)
if ((cnp->cn_flags & HASBUF) == 0)
panic("ufs_link: no name");
 #endif
-   if (VTOI(tdvp)->i_effnlink < 2)
-   panic("ufs_link: Bad link count %d on parent",
-   VTOI(tdvp)->i_effnlink);
+   if (VTOI(tdvp)->i_effnlink < 2) {
+   print_bad_link_count("ufs_link", tdvp);
+   error = EINVAL;
+   goto out;
+   }
ip = VTOI(vp);
if ((nlink_t)ip->i_nlink >= LINK_MAX) {
error = EMLINK;
@@ -1710,10 +1723,10 @@ ufs_do_posix1e_acl_inheritance_file(stru
 * XXX: This should not happen, as EOPNOTSUPP above was
 * supposed to free acl.
 */
-   printf("ufs_makeinode: VOP_GETACL() but no "
-   "VOP_SETACL()\n");
-   /* panic("ufs_makeinode: VOP_GETACL() but no "
-   "VOP_SETACL()"); */
+   printf("ufs_do_posix1e_acl_inheritance_file: VOP_GETACL() "
+   "but no VOP_SETACL()\n");
+   /* panic("ufs_do_posix1e_acl_inheritance_file: VOP_GETACL() "
+   "but no VOP_SETACL()"); */
break;
 
default:
@@ -1791,6 +1804,11 @@ ufs_mkdir(ap)
 * but not have it entered in the parent directory. The entry is
 * made later after writing "." and ".." entries.
 */
+   if (dp->i_effnlink < 2) {
+   print_bad_link_count("ufs_mkdir", dvp);
+   error = EINVAL;
+   goto out;
+   }
error = UFS_VALLOC(dvp, dmode, cnp->cn_cred, &tvp);
if (error)
goto out;
@@ -2021,13 +2039,12 @@ ufs_rmdir(ap)
 * tries to remove a locally mounted on directory).
 */
error = 0;
-   if (ip->i_effnlink < 2) {
+   if (dp->i_effnlink <= 2) {
+   if (dp->i_effnli

svn commit: r307977 - head/secure/lib/libcrypto

2016-10-26 Thread Jung-uk Kim
Author: jkim
Date: Wed Oct 26 20:12:30 2016
New Revision: 307977
URL: https://svnweb.freebsd.org/changeset/base/307977

Log:
  Prefer ACFLAGS over CFLAGS for compiling aarch64 assembly files.

Modified:
  head/secure/lib/libcrypto/Makefile

Modified: head/secure/lib/libcrypto/Makefile
==
--- head/secure/lib/libcrypto/Makefile  Wed Oct 26 20:02:22 2016
(r307976)
+++ head/secure/lib/libcrypto/Makefile  Wed Oct 26 20:12:30 2016
(r307977)
@@ -24,7 +24,7 @@ SRCS= cpt_err.c cryptlib.c cversion.c ex
o_fips.c o_init.c o_str.c o_time.c uid.c
 .if defined(ASM_aarch64)
 SRCS+= arm64cpuid.S armcap.c mem_clr.c
-CFLAGS.arm64cpuid.S=   -march=armv8-a+crypto
+ACFLAGS.arm64cpuid.S=  -march=armv8-a+crypto
 .elif defined(ASM_amd64)
 SRCS+= x86_64cpuid.S
 .elif defined(ASM_arm)
@@ -40,7 +40,7 @@ INCS+=crypto.h ebcdic.h opensslv.h ossl
 SRCS+= aes_cfb.c aes_ctr.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c aes_wrap.c
 .if defined(ASM_aarch64)
 SRCS+= aes_cbc.c aes_core.c aesv8-armx.S
-CFLAGS.aesv8-armx.S=   -march=armv8-a+crypto
+ACFLAGS.aesv8-armx.S=  -march=armv8-a+crypto
 .elif defined(ASM_amd64)
 SRCS+= aes-x86_64.S aesni-mb-x86_64.S aesni-sha1-x86_64.S \
aesni-sha256-x86_64.S aesni-x86_64.S bsaes-x86_64.S vpaes-x86_64.S
@@ -246,7 +246,7 @@ SRCS+=  cbc128.c ccm128.c cfb128.c ctr128
wrap128.c xts128.c
 .if defined(ASM_aarch64)
 SRCS+= ghashv8-armx.S
-CFLAGS.ghashv8-armx.S= -march=armv8-a+crypto
+ACFLAGS.ghashv8-armx.S=-march=armv8-a+crypto
 .elif defined(ASM_amd64)
 SRCS+= aesni-gcm-x86_64.S ghash-x86_64.S
 .elif defined(ASM_arm)
___
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: r307976 - in head: crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/modes/asm secure/lib/libcrypto secure/lib/libcrypto/aarch64

2016-10-26 Thread Jung-uk Kim
Author: jkim
Date: Wed Oct 26 20:02:22 2016
New Revision: 307976
URL: https://svnweb.freebsd.org/changeset/base/307976

Log:
  Build OpenSSL assembly sources for aarch64.  Tested with ThunderX by andrew.

Added:
  head/secure/lib/libcrypto/aarch64/
  head/secure/lib/libcrypto/aarch64/aesv8-armx.S   (contents, props changed)
  head/secure/lib/libcrypto/aarch64/ghashv8-armx.S   (contents, props changed)
  head/secure/lib/libcrypto/aarch64/sha1-armv8.S   (contents, props changed)
  head/secure/lib/libcrypto/aarch64/sha256-armv8.S   (contents, props changed)
  head/secure/lib/libcrypto/aarch64/sha512-armv8.S   (contents, props changed)
Modified:
  head/crypto/openssl/crypto/aes/asm/aesv8-armx.pl
  head/crypto/openssl/crypto/arm64cpuid.S
  head/crypto/openssl/crypto/modes/asm/ghashv8-armx.pl
  head/secure/lib/libcrypto/Makefile
  head/secure/lib/libcrypto/Makefile.asm
  head/secure/lib/libcrypto/Makefile.inc

Modified: head/crypto/openssl/crypto/aes/asm/aesv8-armx.pl
==
--- head/crypto/openssl/crypto/aes/asm/aesv8-armx.plWed Oct 26 18:47:47 
2016(r307975)
+++ head/crypto/openssl/crypto/aes/asm/aesv8-armx.plWed Oct 26 20:02:22 
2016(r307976)
@@ -42,7 +42,7 @@ $code=<<___;
 #if __ARM_MAX_ARCH__>=7
 .text
 ___
-$code.=".arch  armv8-a+crypto\n"   if ($flavour =~ /64/);
+# $code.=".archarmv8-a+crypto\n"   if ($flavour =~ 
/64/);
 $code.=".arch  armv7-a\n.fpu   neon\n.code 32\n"   if ($flavour !~ /64/);
#^^ this is done to simplify adoption by not depending
#   on latest binutils.

Modified: head/crypto/openssl/crypto/arm64cpuid.S
==
--- head/crypto/openssl/crypto/arm64cpuid.S Wed Oct 26 18:47:47 2016
(r307975)
+++ head/crypto/openssl/crypto/arm64cpuid.S Wed Oct 26 20:02:22 2016
(r307976)
@@ -1,7 +1,6 @@
 #include "arm_arch.h"
 
 .text
-.arch  armv8-a+crypto
 
 .align 5
 .global_armv7_neon_probe

Modified: head/crypto/openssl/crypto/modes/asm/ghashv8-armx.pl
==
--- head/crypto/openssl/crypto/modes/asm/ghashv8-armx.plWed Oct 26 
18:47:47 2016(r307975)
+++ head/crypto/openssl/crypto/modes/asm/ghashv8-armx.plWed Oct 26 
20:02:22 2016(r307976)
@@ -49,7 +49,7 @@ $code=<<___;
 
 .text
 ___
-$code.=".arch  armv8-a+crypto\n"   if ($flavour =~ /64/);
+# $code.=".archarmv8-a+crypto\n"   if ($flavour =~ /64/);
 $code.=".fpu   neon\n.code 32\n"   if ($flavour !~ /64/);
 
 


Modified: head/secure/lib/libcrypto/Makefile
==
--- head/secure/lib/libcrypto/Makefile  Wed Oct 26 18:47:47 2016
(r307975)
+++ head/secure/lib/libcrypto/Makefile  Wed Oct 26 20:02:22 2016
(r307976)
@@ -22,7 +22,10 @@ MAN+=config.5 des_modes.7
 # base sources
 SRCS=  cpt_err.c cryptlib.c cversion.c ex_data.c mem.c mem_dbg.c o_dir.c \
o_fips.c o_init.c o_str.c o_time.c uid.c
-.if defined(ASM_amd64)
+.if defined(ASM_aarch64)
+SRCS+= arm64cpuid.S armcap.c mem_clr.c
+CFLAGS.arm64cpuid.S=   -march=armv8-a+crypto
+.elif defined(ASM_amd64)
 SRCS+= x86_64cpuid.S
 .elif defined(ASM_arm)
 SRCS+= armcap.c armv4cpuid.S
@@ -35,7 +38,10 @@ INCS+=   crypto.h ebcdic.h opensslv.h ossl
 
 # aes
 SRCS+= aes_cfb.c aes_ctr.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c aes_wrap.c
-.if defined(ASM_amd64)
+.if defined(ASM_aarch64)
+SRCS+= aes_cbc.c aes_core.c aesv8-armx.S
+CFLAGS.aesv8-armx.S=   -march=armv8-a+crypto
+.elif defined(ASM_amd64)
 SRCS+= aes-x86_64.S aesni-mb-x86_64.S aesni-sha1-x86_64.S \
aesni-sha256-x86_64.S aesni-x86_64.S bsaes-x86_64.S vpaes-x86_64.S
 .elif defined(ASM_arm)
@@ -238,7 +244,10 @@ INCS+= mdc2.h
 # modes
 SRCS+= cbc128.c ccm128.c cfb128.c ctr128.c cts128.c gcm128.c ofb128.c \
wrap128.c xts128.c
-.if defined(ASM_amd64)
+.if defined(ASM_aarch64)
+SRCS+= ghashv8-armx.S
+CFLAGS.ghashv8-armx.S= -march=armv8-a+crypto
+.elif defined(ASM_amd64)
 SRCS+= aesni-gcm-x86_64.S ghash-x86_64.S
 .elif defined(ASM_arm)
 SRCS+= ghash-armv4.S ghashv8-armx.S
@@ -324,7 +333,9 @@ INCS+=  seed.h
 
 # sha
 SRCS+= sha1_one.c sha1dgst.c sha256.c sha512.c sha_dgst.c sha_one.c
-.if defined(ASM_amd64)
+.if defined(ASM_aarch64)
+SRCS+= sha1-armv8.S sha256-armv8.S sha512-armv8.S
+.elif defined(ASM_amd64)
 SRCS+= sha1-mb-x86_64.S sha1-x86_64.S sha256-mb-x86_64.S sha256-x86_64.S \
sha512-x86_64.S
 .elif defined(ASM_arm)

Modified: head/secure/lib/libcrypto/Makefile.asm
==
--- head/secure/lib/libcrypto/Makefile.asm  Wed Oct 26 18:47:47 2016
(r307975)
+++ head/secu

svn commit: r307975 - head/sys/i386/i386

2016-10-26 Thread John Baldwin
Author: jhb
Date: Wed Oct 26 18:47:47 2016
New Revision: 307975
URL: https://svnweb.freebsd.org/changeset/base/307975

Log:
  Enable EFER_NXE properly on APs.
  
  EFER_NXE is set in the EFER MSR by initializecpu() and must be set on all
  CPUs in the system.  When PG_NX support was added to PAE on i386, the
  block to enable EFER_NXE was placed in a section of initializecpu() that
  only runs if 'cpu == CPU_686'.  During early boot, locore does an
  initial pass to set cpu that sets it to CPU_686 on all CPUs later than
  a Pentium.  Later, printcpuinfo() adjusts the 'cpu' variable on
  PII and later CPUs to one of CPU_PII, CPU_PIII, or CPU_P4.  However,
  printcpuinfo() is called after initializecpu() on the BSP, so the BSP
  would enable EFER_NXE and pg_nx.  The APs execute initializecpu() much
  later after printcpuinfo() has run.  The end result on a modern CPU was
  that cpu was set to CPU_PIII when the APs invoked initializecpu(), so
  they did not enable EFER_NXE.  As a result, the APs would fault when
  trying to access any pages marked with PG_NX set.
  
  When booting a 2 CPU PAE kernel in bhyve this manifested as a hang before
  single user mode.  The attempt to execute /bin/init tried to copy out
  the exec strings (argv, etc.) to a non-executable mapping while running
  on the AP.  The instruction kept faulting due to invalid bits in the PTE
  in an infinite loop.
  
  Fix this by moving the code to enable EFER_NXE out of the switch statement
  on 'cpu' and always doing it if 'amd_feature' supports AMDID_NX.
  
  MFC after:2 weeks

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

Modified: head/sys/i386/i386/initcpu.c
==
--- head/sys/i386/i386/initcpu.cWed Oct 26 18:20:06 2016
(r307974)
+++ head/sys/i386/i386/initcpu.cWed Oct 26 18:47:47 2016
(r307975)
@@ -753,16 +753,6 @@ initializecpu(void)
init_transmeta();
break;
}
-#if defined(PAE) || defined(PAE_TABLES)
-   if ((amd_feature & AMDID_NX) != 0) {
-   uint64_t msr;
-
-   msr = rdmsr(MSR_EFER) | EFER_NXE;
-   wrmsr(MSR_EFER, msr);
-   pg_nx = PG_NX;
-   elf32_nxstack = 1;
-   }
-#endif
break;
 #endif
default:
@@ -774,6 +764,16 @@ initializecpu(void)
cpu_fxsr = hw_instruction_sse = 1;
}
 #endif
+#if defined(PAE) || defined(PAE_TABLES)
+   if ((amd_feature & AMDID_NX) != 0) {
+   uint64_t msr;
+
+   msr = rdmsr(MSR_EFER) | EFER_NXE;
+   wrmsr(MSR_EFER, msr);
+   pg_nx = PG_NX;
+   elf32_nxstack = 1;
+   }
+#endif
 }
 
 void
___
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: r307974 - stable/9/sys/dev/bxe

2016-10-26 Thread David C Somayajulu
Author: davidcs
Date: Wed Oct 26 18:20:06 2016
New Revision: 307974
URL: https://svnweb.freebsd.org/changeset/base/307974

Log:
  MFC r307578
  1. Use taskqueue_create() instead of taskqueue_create_fast() for both
 fastpath and slowpath taskqueues.
  2. Service all transmits in taskqueue threads.
  3. additional stats counters for  keeping track of
- bd availability
- tx buf ring not emptied in the fp task queue.
  These are drained via timeout taskqueue.
- tx attempts during link down.

Modified:
  stable/9/sys/dev/bxe/bxe.c
  stable/9/sys/dev/bxe/bxe.h
  stable/9/sys/dev/bxe/bxe_stats.h
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/bxe/bxe.c
==
--- stable/9/sys/dev/bxe/bxe.c  Wed Oct 26 18:13:30 2016(r307973)
+++ stable/9/sys/dev/bxe/bxe.c  Wed Oct 26 18:20:06 2016(r307974)
@@ -27,7 +27,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define BXE_DRIVER_VERSION "1.78.81"
+#define BXE_DRIVER_VERSION "1.78.89"
 
 #include "bxe.h"
 #include "ecore_sp.h"
@@ -500,7 +500,14 @@ static const struct {
 { STATS_OFFSET32(mbuf_alloc_tpa),
 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"},
 { STATS_OFFSET32(tx_queue_full_return),
-4, STATS_FLAGS_FUNC, "tx_queue_full_return"}
+4, STATS_FLAGS_FUNC, "tx_queue_full_return"},
+{ STATS_OFFSET32(tx_request_link_down_failures),
+4, STATS_FLAGS_FUNC, "tx_request_link_down_failures"},
+{ STATS_OFFSET32(bd_avail_too_less_failures),
+4, STATS_FLAGS_FUNC, "bd_avail_too_less_failures"},
+{ STATS_OFFSET32(tx_mq_not_empty),
+4, STATS_FLAGS_FUNC, "tx_mq_not_empty"}
+
 };
 
 static const struct {
@@ -613,7 +620,14 @@ static const struct {
 { Q_STATS_OFFSET32(mbuf_alloc_tpa),
 4, "mbuf_alloc_tpa"},
 { Q_STATS_OFFSET32(tx_queue_full_return),
-4, "tx_queue_full_return"}
+4, "tx_queue_full_return"},
+{ Q_STATS_OFFSET32(tx_request_link_down_failures),
+4, "tx_request_link_down_failures"},
+{ Q_STATS_OFFSET32(bd_avail_too_less_failures),
+4, "bd_avail_too_less_failures"},
+{ Q_STATS_OFFSET32(tx_mq_not_empty),
+4, "tx_mq_not_empty"}
+
 };
 
 #define BXE_NUM_ETH_STATS   ARRAY_SIZE(bxe_eth_stats_arr)
@@ -5620,7 +5634,7 @@ bxe_tx_start(struct ifnet *ifp)
 BXE_FP_TX_UNLOCK(fp);
 }
 
-#if __FreeBSD_version >= 80
+#if __FreeBSD_version >= 901504
 
 static int
 bxe_tx_mq_start_locked(struct bxe_softc*sc,
@@ -5642,10 +5656,16 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 return (EINVAL);
 }
 
-if (!sc->link_vars.link_up ||
-(ifp->if_drv_flags &
-(IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) {
+if (m != NULL) {
 rc = drbr_enqueue(ifp, tx_br, m);
+if (rc != 0) {
+fp->eth_q_stats.tx_soft_errors++;
+goto bxe_tx_mq_start_locked_exit;
+}
+}
+
+if (!sc->link_vars.link_up || !(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+fp->eth_q_stats.tx_request_link_down_failures++;
 goto bxe_tx_mq_start_locked_exit;
 }
 
@@ -5655,24 +5675,22 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 fp->eth_q_stats.tx_max_drbr_queue_depth = depth;
 }
 
-if (m == NULL) {
-/* no new work, check for pending frames */
-next = drbr_dequeue(ifp, tx_br);
-} else if (drbr_needs_enqueue(ifp, tx_br)) {
-/* have both new and pending work, maintain packet order */
-rc = drbr_enqueue(ifp, tx_br, m);
-if (rc != 0) {
-fp->eth_q_stats.tx_soft_errors++;
-goto bxe_tx_mq_start_locked_exit;
-}
-next = drbr_dequeue(ifp, tx_br);
-} else {
-/* new work only and nothing pending */
-next = m;
-}
-
 /* keep adding entries while there are frames to send */
-while (next != NULL) {
+while ((next = drbr_peek(ifp, tx_br)) != NULL) {
+/* handle any completions if we're running low */
+tx_bd_avail = bxe_tx_avail(sc, fp);
+if (tx_bd_avail < BXE_TX_CLEANUP_THRESHOLD) {
+/* bxe_txeof will set IFF_DRV_OACTIVE appropriately */
+bxe_txeof(sc, fp);
+tx_bd_avail = bxe_tx_avail(sc, fp);
+if (tx_bd_avail < (BXE_TSO_MAX_SEGMENTS + 1)) {
+fp->eth_q_stats.bd_avail_too_less_failures++;
+m_freem(next);
+drbr_advance(ifp, tx_br);
+rc = ENOBUFS;
+break;
+}
+}
 
 /* the mbuf now belongs to us */
 fp->eth_q_stats.mbuf_alloc_tx++;
@@ -5688,11 +5706,11 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 if (next != NULL) {
 /* mark the TX queue as full and save the frame */
 ifp->if_dr

svn commit: r307973 - stable/10/sys/dev/bxe

2016-10-26 Thread David C Somayajulu
Author: davidcs
Date: Wed Oct 26 18:13:30 2016
New Revision: 307973
URL: https://svnweb.freebsd.org/changeset/base/307973

Log:
  MFC r307578
  1. Use taskqueue_create() instead of taskqueue_create_fast() for both
 fastpath and slowpath taskqueues.
  2. Service all transmits in taskqueue threads.
  3. additional stats counters for  keeping track of
- bd availability
- tx buf ring not emptied in the fp task queue.
  These are drained via timeout taskqueue.
- tx attempts during link down.

Modified:
  stable/10/sys/dev/bxe/bxe.c
  stable/10/sys/dev/bxe/bxe.h
  stable/10/sys/dev/bxe/bxe_stats.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/bxe/bxe.c
==
--- stable/10/sys/dev/bxe/bxe.c Wed Oct 26 17:53:12 2016(r307972)
+++ stable/10/sys/dev/bxe/bxe.c Wed Oct 26 18:13:30 2016(r307973)
@@ -27,7 +27,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define BXE_DRIVER_VERSION "1.78.81"
+#define BXE_DRIVER_VERSION "1.78.89"
 
 #include "bxe.h"
 #include "ecore_sp.h"
@@ -500,7 +500,14 @@ static const struct {
 { STATS_OFFSET32(mbuf_alloc_tpa),
 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"},
 { STATS_OFFSET32(tx_queue_full_return),
-4, STATS_FLAGS_FUNC, "tx_queue_full_return"}
+4, STATS_FLAGS_FUNC, "tx_queue_full_return"},
+{ STATS_OFFSET32(tx_request_link_down_failures),
+4, STATS_FLAGS_FUNC, "tx_request_link_down_failures"},
+{ STATS_OFFSET32(bd_avail_too_less_failures),
+4, STATS_FLAGS_FUNC, "bd_avail_too_less_failures"},
+{ STATS_OFFSET32(tx_mq_not_empty),
+4, STATS_FLAGS_FUNC, "tx_mq_not_empty"}
+
 };
 
 static const struct {
@@ -613,7 +620,14 @@ static const struct {
 { Q_STATS_OFFSET32(mbuf_alloc_tpa),
 4, "mbuf_alloc_tpa"},
 { Q_STATS_OFFSET32(tx_queue_full_return),
-4, "tx_queue_full_return"}
+4, "tx_queue_full_return"},
+{ Q_STATS_OFFSET32(tx_request_link_down_failures),
+4, "tx_request_link_down_failures"},
+{ Q_STATS_OFFSET32(bd_avail_too_less_failures),
+4, "bd_avail_too_less_failures"},
+{ Q_STATS_OFFSET32(tx_mq_not_empty),
+4, "tx_mq_not_empty"}
+
 };
 
 #define BXE_NUM_ETH_STATS   ARRAY_SIZE(bxe_eth_stats_arr)
@@ -5612,7 +5626,7 @@ bxe_tx_start(struct ifnet *ifp)
 BXE_FP_TX_UNLOCK(fp);
 }
 
-#if __FreeBSD_version >= 80
+#if __FreeBSD_version >= 901504
 
 static int
 bxe_tx_mq_start_locked(struct bxe_softc*sc,
@@ -5634,10 +5648,16 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 return (EINVAL);
 }
 
-if (!sc->link_vars.link_up ||
-(ifp->if_drv_flags &
-(IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) {
+if (m != NULL) {
 rc = drbr_enqueue(ifp, tx_br, m);
+if (rc != 0) {
+fp->eth_q_stats.tx_soft_errors++;
+goto bxe_tx_mq_start_locked_exit;
+}
+}
+
+if (!sc->link_vars.link_up || !(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+fp->eth_q_stats.tx_request_link_down_failures++;
 goto bxe_tx_mq_start_locked_exit;
 }
 
@@ -5647,24 +5667,22 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 fp->eth_q_stats.tx_max_drbr_queue_depth = depth;
 }
 
-if (m == NULL) {
-/* no new work, check for pending frames */
-next = drbr_dequeue(ifp, tx_br);
-} else if (drbr_needs_enqueue(ifp, tx_br)) {
-/* have both new and pending work, maintain packet order */
-rc = drbr_enqueue(ifp, tx_br, m);
-if (rc != 0) {
-fp->eth_q_stats.tx_soft_errors++;
-goto bxe_tx_mq_start_locked_exit;
-}
-next = drbr_dequeue(ifp, tx_br);
-} else {
-/* new work only and nothing pending */
-next = m;
-}
-
 /* keep adding entries while there are frames to send */
-while (next != NULL) {
+while ((next = drbr_peek(ifp, tx_br)) != NULL) {
+/* handle any completions if we're running low */
+tx_bd_avail = bxe_tx_avail(sc, fp);
+if (tx_bd_avail < BXE_TX_CLEANUP_THRESHOLD) {
+/* bxe_txeof will set IFF_DRV_OACTIVE appropriately */
+bxe_txeof(sc, fp);
+tx_bd_avail = bxe_tx_avail(sc, fp);
+if (tx_bd_avail < (BXE_TSO_MAX_SEGMENTS + 1)) {
+fp->eth_q_stats.bd_avail_too_less_failures++;
+m_freem(next);
+drbr_advance(ifp, tx_br);
+rc = ENOBUFS;
+break;
+}
+}
 
 /* the mbuf now belongs to us */
 fp->eth_q_stats.mbuf_alloc_tx++;
@@ -5680,11 +5698,11 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 if (next != NULL) {
 /* mark the TX queue as full and save the frame */
 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
-

svn commit: r307972 - stable/11/sys/dev/bxe

2016-10-26 Thread David C Somayajulu
Author: davidcs
Date: Wed Oct 26 17:53:12 2016
New Revision: 307972
URL: https://svnweb.freebsd.org/changeset/base/307972

Log:
  MFC r307578
1. Use taskqueue_create() instead of taskqueue_create_fast() for both
   fastpath and slowpath taskqueues.
2. Service all transmits in taskqueue threads.
3. additional stats counters for  keeping track of
- bd availability
- tx buf ring not emptied in the fp task queue.
  These are drained via timeout taskqueue.
- tx attempts during link down.

Modified:
  stable/11/sys/dev/bxe/bxe.c
  stable/11/sys/dev/bxe/bxe.h
  stable/11/sys/dev/bxe/bxe_stats.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/bxe/bxe.c
==
--- stable/11/sys/dev/bxe/bxe.c Wed Oct 26 17:37:08 2016(r307971)
+++ stable/11/sys/dev/bxe/bxe.c Wed Oct 26 17:53:12 2016(r307972)
@@ -27,7 +27,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define BXE_DRIVER_VERSION "1.78.81"
+#define BXE_DRIVER_VERSION "1.78.89"
 
 #include "bxe.h"
 #include "ecore_sp.h"
@@ -489,7 +489,14 @@ static const struct {
 { STATS_OFFSET32(mbuf_alloc_tpa),
 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"},
 { STATS_OFFSET32(tx_queue_full_return),
-4, STATS_FLAGS_FUNC, "tx_queue_full_return"}
+4, STATS_FLAGS_FUNC, "tx_queue_full_return"},
+{ STATS_OFFSET32(tx_request_link_down_failures),
+4, STATS_FLAGS_FUNC, "tx_request_link_down_failures"},
+{ STATS_OFFSET32(bd_avail_too_less_failures),
+4, STATS_FLAGS_FUNC, "bd_avail_too_less_failures"},
+{ STATS_OFFSET32(tx_mq_not_empty),
+4, STATS_FLAGS_FUNC, "tx_mq_not_empty"}
+
 };
 
 static const struct {
@@ -602,7 +609,14 @@ static const struct {
 { Q_STATS_OFFSET32(mbuf_alloc_tpa),
 4, "mbuf_alloc_tpa"},
 { Q_STATS_OFFSET32(tx_queue_full_return),
-4, "tx_queue_full_return"}
+4, "tx_queue_full_return"},
+{ Q_STATS_OFFSET32(tx_request_link_down_failures),
+4, "tx_request_link_down_failures"},
+{ Q_STATS_OFFSET32(bd_avail_too_less_failures),
+4, "bd_avail_too_less_failures"},
+{ Q_STATS_OFFSET32(tx_mq_not_empty),
+4, "tx_mq_not_empty"}
+
 };
 
 #define BXE_NUM_ETH_STATS   ARRAY_SIZE(bxe_eth_stats_arr)
@@ -5599,7 +5613,7 @@ bxe_tx_start(if_t ifp)
 BXE_FP_TX_UNLOCK(fp);
 }
 
-#if __FreeBSD_version >= 80
+#if __FreeBSD_version >= 901504
 
 static int
 bxe_tx_mq_start_locked(struct bxe_softc*sc,
@@ -5621,11 +5635,16 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 return (EINVAL);
 }
 
-if (!sc->link_vars.link_up ||
-(if_getdrvflags(ifp) &
-(IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) {
-if (m != NULL)
-rc = drbr_enqueue(ifp, tx_br, m);
+if (m != NULL) {
+rc = drbr_enqueue(ifp, tx_br, m);
+if (rc != 0) {
+fp->eth_q_stats.tx_soft_errors++;
+goto bxe_tx_mq_start_locked_exit;
+}
+}
+
+if (!sc->link_vars.link_up || !(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+fp->eth_q_stats.tx_request_link_down_failures++;
 goto bxe_tx_mq_start_locked_exit;
 }
 
@@ -5635,24 +5654,22 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 fp->eth_q_stats.tx_max_drbr_queue_depth = depth;
 }
 
-if (m == NULL) {
-/* no new work, check for pending frames */
-next = drbr_dequeue_drv(ifp, tx_br);
-} else if (drbr_needs_enqueue_drv(ifp, tx_br)) {
-/* have both new and pending work, maintain packet order */
-rc = drbr_enqueue(ifp, tx_br, m);
-if (rc != 0) {
-fp->eth_q_stats.tx_soft_errors++;
-goto bxe_tx_mq_start_locked_exit;
-}
-next = drbr_dequeue_drv(ifp, tx_br);
-} else {
-/* new work only and nothing pending */
-next = m;
-}
-
 /* keep adding entries while there are frames to send */
-while (next != NULL) {
+while ((next = drbr_peek(ifp, tx_br)) != NULL) {
+/* handle any completions if we're running low */
+tx_bd_avail = bxe_tx_avail(sc, fp);
+if (tx_bd_avail < BXE_TX_CLEANUP_THRESHOLD) {
+/* bxe_txeof will set IFF_DRV_OACTIVE appropriately */
+bxe_txeof(sc, fp);
+tx_bd_avail = bxe_tx_avail(sc, fp);
+if (tx_bd_avail < (BXE_TSO_MAX_SEGMENTS + 1)) {
+fp->eth_q_stats.bd_avail_too_less_failures++;
+m_freem(next);
+drbr_advance(ifp, tx_br);
+rc = ENOBUFS;
+break;
+}
+}
 
 /* the mbuf now belongs to us */
 fp->eth_q_stats.mbuf_alloc_tx++;
@@ -5668,11 +5685,11 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 if (next != NULL) {
 /* mark the TX queue as full and save t

svn commit: r307971 - head/sys/mips/include

2016-10-26 Thread John Baldwin
Author: jhb
Date: Wed Oct 26 17:37:08 2016
New Revision: 307971
URL: https://svnweb.freebsd.org/changeset/base/307971

Log:
  Correct definition of 'struct sigcontext' on MIPS.
  
  Add missing fields ('sr' and 'mc_tls') to 'struct sigcontext'.
  
  The kernel doesn't use 'struct sigcontext' but instead uses 'ucontext_t'
  which includes 'mcontext_t' in 'struct sigframe' to build the signal frame.
  As a result, this change is not an ABI change but simply making
  'struct sigcontext' correct.  Note that 'struct sigcontext' is only used
  for "Traditional BSD style" signal handlers.
  
  While here, rename the 'xxx' field to '__spare__' to match 'mcontext_t'.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/mips/include/signal.h

Modified: head/sys/mips/include/signal.h
==
--- head/sys/mips/include/signal.h  Wed Oct 26 17:34:33 2016
(r307970)
+++ head/sys/mips/include/signal.h  Wed Oct 26 17:37:08 2016
(r307971)
@@ -68,11 +68,13 @@ struct  sigcontext {
int sc_onstack; /* sigstack state to restore */
__register_tsc_pc;  /* pc at time of signal */
__register_tsc_regs[32];/* processor regs 0 to 31 */
+   __register_tsr; /* status register */
__register_tmullo, mulhi;   /* mullo and mulhi registers... */
int sc_fpused;  /* fp has been used */
f_register_tsc_fpregs[33];  /* fp regs 0 to 31 and csr */
__register_tsc_fpc_eir; /* fp exception instruction reg */
-   int xxx[8]; /* XXX reserved */ 
+   void*sc_tls;/* pointer to TLS area */
+   int __spare__[8];   /* XXX reserved */ 
 };
 
 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
___
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: r307970 - stable/11/sys/netpfil/ipfw

2016-10-26 Thread Andrey V. Elsukov
Author: ae
Date: Wed Oct 26 17:34:33 2016
New Revision: 307970
URL: https://svnweb.freebsd.org/changeset/base/307970

Log:
  MFC r307628:
Fix `ipfw table lookup` handler to return entry value, but not its index.

Modified:
  stable/11/sys/netpfil/ipfw/ip_fw_table.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/ipfw/ip_fw_table.c
==
--- stable/11/sys/netpfil/ipfw/ip_fw_table.cWed Oct 26 17:07:53 2016
(r307969)
+++ stable/11/sys/netpfil/ipfw/ip_fw_table.cWed Oct 26 17:34:33 2016
(r307970)
@@ -1087,6 +1087,7 @@ find_table_entry(struct ip_fw_chain *ch,
struct table_config *tc;
struct table_algo *ta;
struct table_info *kti;
+   struct table_value *pval;
struct namedobj_instance *ni;
int error;
size_t sz;
@@ -1132,7 +1133,10 @@ find_table_entry(struct ip_fw_chain *ch,
return (ENOTSUP);
 
error = ta->find_tentry(tc->astate, kti, tent);
-
+   if (error == 0) {
+   pval = get_table_value(ch, tc, tent->v.kidx);
+   ipfw_export_table_value_v1(pval, &tent->v.value);
+   }
IPFW_UH_RUNLOCK(ch);
 
return (error);
___
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: r307969 - head/contrib/elftoolchain/strings

2016-10-26 Thread Ed Maste
Author: emaste
Date: Wed Oct 26 17:07:53 2016
New Revision: 307969
URL: https://svnweb.freebsd.org/changeset/base/307969

Log:
  strings: fix exit status if a file before the last one fails
  
  Previously a command like "strings f1 f2 f3" reported the exit status
  based only on processing the last file.
  
  As with GNU strings, report an error exit status if an error was
  encountered processing any of the files. While here simplify the
  exit status handling to just success (0) / failure (1).
  
  Reviewed by:  brooks
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D8334

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

Modified: head/contrib/elftoolchain/strings/strings.c
==
--- head/contrib/elftoolchain/strings/strings.c Wed Oct 26 16:03:26 2016
(r307968)
+++ head/contrib/elftoolchain/strings/strings.c Wed Oct 26 17:07:53 2016
(r307969)
@@ -48,12 +48,6 @@
 
 ELFTC_VCSID("$Id: strings.c 3446 2016-05-03 01:31:17Z emaste $");
 
-enum return_code {
-   RETURN_OK,
-   RETURN_NOINPUT,
-   RETURN_SOFTWARE
-};
-
 enum radix_style {
RADIX_DECIMAL,
RADIX_HEX,
@@ -107,7 +101,7 @@ main(int argc, char **argv)
 {
int ch, rc;
 
-   rc = RETURN_OK;
+   rc = 0;
min_len = 0;
encoding_size = 1;
if (elf_version(EV_CURRENT) == EV_NONE)
@@ -197,7 +191,8 @@ main(int argc, char **argv)
if (!*argv)
rc = handle_file("{standard input}");
else while (*argv) {
-   rc = handle_file(*argv);
+   if (handle_file(*argv) != 0)
+   rc = 1;
argv++;
}
return (rc);
@@ -209,11 +204,11 @@ handle_file(const char *name)
int fd, rt;
 
if (name == NULL)
-   return (RETURN_NOINPUT);
+   return (1);
if (strcmp("{standard input}", name) != 0) {
if (freopen(name, "rb", stdin) == NULL) {
warnx("'%s': %s", name, strerror(errno));
-   return (RETURN_NOINPUT);
+   return (1);
}
} else {
return (find_strings(name, (off_t)0, (off_t)0));
@@ -221,7 +216,7 @@ handle_file(const char *name)
 
fd = fileno(stdin);
if (fd < 0)
-   return (RETURN_NOINPUT);
+   return (1);
rt = handle_elf(name, fd);
return (rt);
 }
@@ -239,7 +234,7 @@ handle_binary(const char *name, int fd)
(void) lseek(fd, (off_t)0, SEEK_SET);
if (!fstat(fd, &buf))
return (find_strings(name, (off_t)0, buf.st_size));
-   return (RETURN_SOFTWARE);
+   return (1);
 }
 
 /*
@@ -257,7 +252,7 @@ handle_elf(const char *name, int fd)
Elf_Scn *scn;
int rc;
 
-   rc = RETURN_OK;
+   rc = 0;
/* If entire file is chosen, treat it as a binary file */
if (entire_file)
return (handle_binary(name, fd));
@@ -272,7 +267,7 @@ handle_elf(const char *name, int fd)
if (gelf_getehdr(elf, &elfhdr) == NULL) {
(void) elf_end(elf);
warnx("%s: ELF file could not be processed", name);
-   return (RETURN_SOFTWARE);
+   return (1);
}
 
if (elfhdr.e_shnum == 0 && elfhdr.e_type == ET_CORE) {
@@ -352,7 +347,7 @@ find_strings(const char *name, off_t off
if ((obuf = (char*)calloc(1, min_len + 1)) == NULL) {
(void) fprintf(stderr, "Unable to allocate memory: %s\n",
 strerror(errno));
-   return (RETURN_SOFTWARE);
+   return (1);
}
 
(void) fseeko(stdin, offset, SEEK_SET);
@@ -426,7 +421,7 @@ find_strings(const char *name, off_t off
}
 _exit1:
free(obuf);
-   return (RETURN_OK);
+   return (0);
 }
 
 #defineUSAGE_MESSAGE   "\
___
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: r307968 - head/sys/arm/allwinner

2016-10-26 Thread Andrew Turner
Author: andrew
Date: Wed Oct 26 16:03:26 2016
New Revision: 307968
URL: https://svnweb.freebsd.org/changeset/base/307968

Log:
  Use the new fdt_intr.h constants in the Allwinner NMI driver.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm/allwinner/aw_nmi.c

Modified: head/sys/arm/allwinner/aw_nmi.c
==
--- head/sys/arm/allwinner/aw_nmi.c Wed Oct 26 15:58:41 2016
(r307967)
+++ head/sys/arm/allwinner/aw_nmi.c Wed Oct 26 16:03:26 2016
(r307968)
@@ -40,12 +40,11 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
 
-#include 
-
 #include "pic_if.h"
 
 #defineNMI_IRQ_CTRL_REG0x0
@@ -155,19 +154,19 @@ aw_nmi_map_fdt(device_t dev, u_int ncell
tripol = cells[1];
 
switch (tripol) {
-   case IRQ_TYPE_EDGE_RISING:
+   case FDT_INTR_EDGE_RISING:
trig = INTR_TRIGGER_EDGE;
pol  = INTR_POLARITY_HIGH;
break;
-   case IRQ_TYPE_EDGE_FALLING:
+   case FDT_INTR_EDGE_FALLING:
trig = INTR_TRIGGER_EDGE;
pol  = INTR_POLARITY_LOW;
break;
-   case IRQ_TYPE_LEVEL_HIGH:
+   case FDT_INTR_LEVEL_HIGH:
trig = INTR_TRIGGER_LEVEL;
pol  = INTR_POLARITY_HIGH;
break;
-   case IRQ_TYPE_LEVEL_LOW:
+   case FDT_INTR_LEVEL_LOW:
trig = INTR_TRIGGER_LEVEL;
pol  = INTR_POLARITY_LOW;
break;
___
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: r307967 - head/usr.sbin/config

2016-10-26 Thread Marcel Moolenaar
Author: marcel
Date: Wed Oct 26 15:58:41 2016
New Revision: 307967
URL: https://svnweb.freebsd.org/changeset/base/307967

Log:
  Allow config to be compiled from another source directory, such as one
  for building tools. This boils down to replacing ${.CURDIR} with
  ${SRCDIR}, where the latter is the directory in which this makefile
  lives.
  
  Also allow overriding where file2c comes from using ${FILE2C}.

Modified:
  head/usr.sbin/config/Makefile

Modified: head/usr.sbin/config/Makefile
==
--- head/usr.sbin/config/Makefile   Wed Oct 26 15:19:18 2016
(r307966)
+++ head/usr.sbin/config/Makefile   Wed Oct 26 15:58:41 2016
(r307967)
@@ -1,15 +1,20 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
+SRCDIR:=${.PARSEDIR:tA}
+
 PROG=  config
 MAN=   config.5 config.8
 SRCS=  config.y main.c lang.l mkmakefile.c mkheaders.c \
mkoptions.c y.tab.h kernconf.c
 
+FILE2C?=file2c
+
 kernconf.c: kernconf.tmpl
-   file2c 'char kernconfstr[] = {' ',0};' < ${.CURDIR}/kernconf.tmpl > 
kernconf.c
+   ${FILE2C} 'char kernconfstr[] = {' ',0};' < \
+   ${SRCDIR}/kernconf.tmpl > kernconf.c
 
-CFLAGS+= -I. -I${.CURDIR}
+CFLAGS+= -I. -I${SRCDIR}
 
 NO_WMISSING_VARIABLE_DECLARATIONS=
 
___
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: r307966 - head/sys/netinet

2016-10-26 Thread Julien Charbon
Author: jch
Date: Wed Oct 26 15:19:18 2016
New Revision: 307966
URL: https://svnweb.freebsd.org/changeset/base/307966

Log:
  Remove an extraneous call to soisconnected() in syncache_socket(),
  introduced with r261242.  The useful and expected soisconnected()
  call is done in tcp_do_segment().
  
  Has been found as part of unrelated PR:212920 investigation.
  
  Improve slightly (~2%) the maximum number of TCP accept per second.
  
  Tested by:kevin.bowling_kev009.com, jch
  Approved by:  gnn, hiren
  MFC after:1 week
  Sponsored by: Verisign, Inc
  Differential Revision:https://reviews.freebsd.org/D8072

Modified:
  head/sys/netinet/tcp_syncache.c

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Wed Oct 26 15:18:08 2016
(r307965)
+++ head/sys/netinet/tcp_syncache.c Wed Oct 26 15:19:18 2016
(r307966)
@@ -918,10 +918,6 @@ syncache_socket(struct syncache *sc, str
tp->t_keepcnt = sototcpcb(lso)->t_keepcnt;
tcp_timer_activate(tp, TT_KEEP, TP_KEEPINIT(tp));
 
-   if ((so->so_options & SO_ACCEPTFILTER) == 0) {
-   soisconnected(so);
-   }
-
TCPSTAT_INC(tcps_accepts);
return (so);
 
___
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: r307965 - in head/sys: arm/arm arm64/arm64 dev/fdt

2016-10-26 Thread Andrew Turner
Author: andrew
Date: Wed Oct 26 15:18:08 2016
New Revision: 307965
URL: https://svnweb.freebsd.org/changeset/base/307965

Log:
  Pull the common FDT interrupt values into a new header rather than be magic
  numbers.
  
  Sponsored by: DARPA, AFRL

Added:
  head/sys/dev/fdt/fdt_intr.h   (contents, props changed)
Modified:
  head/sys/arm/arm/gic.c
  head/sys/arm64/arm64/gic_v3.c

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Wed Oct 26 14:26:45 2016(r307964)
+++ head/sys/arm/arm/gic.c  Wed Oct 26 15:18:08 2016(r307965)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -821,13 +822,15 @@ gic_map_fdt(device_t dev, u_int ncells, 
}
 
tripol = cells[2] & 0xff;
-   if (tripol & 0xf0 || (tripol & 0x0a && cells[0] == 0))
+   if (tripol & 0xf0 || (tripol & FDT_INTR_LOW_MASK &&
+   cells[0] == 0))
device_printf(dev, "unsupported trigger/polarity "
"configuration 0x%02x\n", tripol);
 
*irqp = irq;
*polp = INTR_POLARITY_CONFORM;
-   *trigp = tripol & 0x03 ? INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL;
+   *trigp = tripol & FDT_INTR_EDGE_MASK ?
+   INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL;
return (0);
}
return (EINVAL);

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Wed Oct 26 14:26:45 2016
(r307964)
+++ head/sys/arm64/arm64/gic_v3.c   Wed Oct 26 15:18:08 2016
(r307965)
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #ifdef FDT
+#include 
 #include 
 #endif
 
@@ -470,20 +471,20 @@ gic_map_fdt(device_t dev, u_int ncells, 
return (EINVAL);
}
 
-   switch (cells[2] & 0xf) {
-   case 1:
+   switch (cells[2] & FDT_INTR_MASK) {
+   case FDT_INTR_EDGE_RISING:
*trigp = INTR_TRIGGER_EDGE;
*polp = INTR_POLARITY_HIGH;
break;
-   case 2:
+   case FDT_INTR_EDGE_FALLING:
*trigp = INTR_TRIGGER_EDGE;
*polp = INTR_POLARITY_LOW;
break;
-   case 4:
+   case FDT_INTR_LEVEL_HIGH:
*trigp = INTR_TRIGGER_LEVEL;
*polp = INTR_POLARITY_HIGH;
break;
-   case 8:
+   case FDT_INTR_LEVEL_LOW:
*trigp = INTR_TRIGGER_LEVEL;
*polp = INTR_POLARITY_LOW;
break;

Added: head/sys/dev/fdt/fdt_intr.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/fdt/fdt_intr.h Wed Oct 26 15:18:08 2016(r307965)
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 2016 Andrew Turner 
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _FDT_INTR_H_
+#define_FDT_INTR_H_
+
+#defineFDT_INTR_EDGE_RISING1
+#defineFDT_INTR_EDGE_FALLING   2
+#defineFDT_INTR_LEVEL_HIGH 4
+#defineFDT_INTR_LEVEL_LOW  8
+#defineFDT_INTR_LOW_MASK   (FDT_INTR_EDGE_FALLING | 
FDT_INTR_LEVEL_LOW)
+#defineFDT_INTR_EDGE_MASK  (FDT_INTR_EDGE_RISING | 
F

svn commit: r307964 - head/lib/libproc

2016-10-26 Thread Ruslan Bukin
Author: br
Date: Wed Oct 26 14:26:45 2016
New Revision: 307964
URL: https://svnweb.freebsd.org/changeset/base/307964

Log:
  Use uint32_t instead of u_long as a storage for breakpoint instruction
  to copy. All the platforms breakpoints fits this fine.
  
  This fixes operation on big-endian MIPS64 where we were coping
  zeroes instead of real instruction.
  
  Reviewed by:  rpaulo
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D8250

Modified:
  head/lib/libproc/proc_bkpt.c

Modified: head/lib/libproc/proc_bkpt.c
==
--- head/lib/libproc/proc_bkpt.cWed Oct 26 14:09:30 2016
(r307963)
+++ head/lib/libproc/proc_bkpt.cWed Oct 26 14:26:45 2016
(r307964)
@@ -68,6 +68,14 @@ __FBSDID("$FreeBSD$");
 #error "Add support for your architecture"
 #endif
 
+/*
+ * Use 4-bytes holder for breakpoint instruction on all the platforms.
+ * Works for x86 as well until it is endian-little platform.
+ * (We are coping one byte only on x86 from this 4-bytes piece of
+ * memory).
+ */
+typedef uint32_t instr_t;
+
 static int
 proc_stop(struct proc_handle *phdl)
 {
@@ -92,8 +100,9 @@ proc_bkptset(struct proc_handle *phdl, u
 unsigned long *saved)
 {
struct ptrace_io_desc piod;
-   unsigned long paddr, caddr;
+   unsigned long caddr;
int ret = 0, stopped;
+   instr_t instr;
 
*saved = 0;
if (phdl->status == PS_DEAD || phdl->status == PS_UNDEAD ||
@@ -115,10 +124,10 @@ proc_bkptset(struct proc_handle *phdl, u
 * Read the original instruction.
 */
caddr = address;
-   paddr = 0;
+   instr = 0;
piod.piod_op = PIOD_READ_I;
piod.piod_offs = (void *)caddr;
-   piod.piod_addr = &paddr;
+   piod.piod_addr = &instr;
piod.piod_len  = BREAKPOINT_INSTR_SZ;
if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) {
DPRINTF("ERROR: couldn't read instruction at address 0x%"
@@ -126,15 +135,15 @@ proc_bkptset(struct proc_handle *phdl, u
ret = -1;
goto done;
}
-   *saved = paddr;
+   *saved = instr;
/*
 * Write a breakpoint instruction to that address.
 */
caddr = address;
-   paddr = BREAKPOINT_INSTR;
+   instr = BREAKPOINT_INSTR;
piod.piod_op = PIOD_WRITE_I;
piod.piod_offs = (void *)caddr;
-   piod.piod_addr = &paddr;
+   piod.piod_addr = &instr;
piod.piod_len  = BREAKPOINT_INSTR_SZ;
if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) {
DPRINTF("ERROR: couldn't write instruction at address 0x%"
@@ -156,8 +165,9 @@ proc_bkptdel(struct proc_handle *phdl, u
 unsigned long saved)
 {
struct ptrace_io_desc piod;
-   unsigned long paddr, caddr;
+   unsigned long caddr;
int ret = 0, stopped;
+   instr_t instr;
 
if (phdl->status == PS_DEAD || phdl->status == PS_UNDEAD ||
phdl->status == PS_IDLE) {
@@ -178,10 +188,10 @@ proc_bkptdel(struct proc_handle *phdl, u
 * Overwrite the breakpoint instruction that we setup previously.
 */
caddr = address;
-   paddr = saved;
+   instr = saved;
piod.piod_op = PIOD_WRITE_I;
piod.piod_offs = (void *)caddr;
-   piod.piod_addr = &paddr;
+   piod.piod_addr = &instr;
piod.piod_len  = BREAKPOINT_INSTR_SZ;
if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) {
DPRINTF("ERROR: couldn't write instruction at address 0x%"
___
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: r307963 - head/sys/arm/allwinner/clk

2016-10-26 Thread Andrew Turner
Author: andrew
Date: Wed Oct 26 14:09:30 2016
New Revision: 307963
URL: https://svnweb.freebsd.org/changeset/base/307963

Log:
  Define the Allwinner PLL FDT constants in the file that uses them rather
  than including a file from under sys/gnu.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm/allwinner/clk/aw_pll.c

Modified: head/sys/arm/allwinner/clk/aw_pll.c
==
--- head/sys/arm/allwinner/clk/aw_pll.c Wed Oct 26 12:41:44 2016
(r307962)
+++ head/sys/arm/allwinner/clk/aw_pll.c Wed Oct 26 14:09:30 2016
(r307963)
@@ -47,12 +47,15 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
-
 #include 
 
 #include "clkdev_if.h"
 
+#defineSUN4I_A10_PLL2_1X   0
+#defineSUN4I_A10_PLL2_2X   1
+#defineSUN4I_A10_PLL2_4X   2
+#defineSUN4I_A10_PLL2_8X   3
+
 #defineAW_PLL_ENABLE   (1 << 31)
 
 #defineA10_PLL1_OUT_EXT_DIVP   (0x3 << 16)
___
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: r307936 - head/sys/amd64/amd64

2016-10-26 Thread Konstantin Belousov
On Tue, Oct 25, 2016 at 09:26:00PM +0200, Tijl Coosemans wrote:
> On Tue, 25 Oct 2016 17:13:46 + (UTC) Gleb Smirnoff  
> wrote:
> > Author: glebius
> > Date: Tue Oct 25 17:13:46 2016
> > New Revision: 307936
> > URL: https://svnweb.freebsd.org/changeset/base/307936
> > 
> > Log:
> >   The argument validation in r296956 was not enough to close all possible
> >   overflows in sysarch(2).
> >   
> >   Submitted by: Kun Yang 
> >   Patch by: kib
> >   Security: SA-16:15
> > 
> > Modified:
> >   head/sys/amd64/amd64/sys_machdep.c
> 
> This patch and r296956 need to be applied to i386 too, don't they?
I do not think so.  The amd64 bug is that I thought that the overflow
checks were not needed, which appeared to be not true.

i386_set_ldt(), which is the i386 version of amd64_set_ldt(), already
contained the comparisions of largest_ld with pldt->ldt_len etc.

Still, independend look at the i386 (and amd64 version as well) is more
than welcomed, so please read the code yourself.
___
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: r307962 - head/sys/dev/gpio

2016-10-26 Thread Andrew Turner
Author: andrew
Date: Wed Oct 26 12:41:44 2016
New Revision: 307962
URL: https://svnweb.freebsd.org/changeset/base/307962

Log:
  Stop including a possibly GPLd header from the GPIO code. Add the only
  needed macro to ofw_gpiobus.c.
  
  Reported by:  emaste
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/gpio/gpiobusvar.h
  head/sys/dev/gpio/ofw_gpiobus.c

Modified: head/sys/dev/gpio/gpiobusvar.h
==
--- head/sys/dev/gpio/gpiobusvar.h  Wed Oct 26 12:30:53 2016
(r307961)
+++ head/sys/dev/gpio/gpiobusvar.h  Wed Oct 26 12:41:44 2016
(r307962)
@@ -38,7 +38,6 @@
 
 #ifdef FDT
 #include 
-#include 
 #endif
 
 #ifdef INTRNG

Modified: head/sys/dev/gpio/ofw_gpiobus.c
==
--- head/sys/dev/gpio/ofw_gpiobus.c Wed Oct 26 12:30:53 2016
(r307961)
+++ head/sys/dev/gpio/ofw_gpiobus.c Wed Oct 26 12:41:44 2016
(r307962)
@@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$");
 
 #include "gpiobus_if.h"
 
+#defineGPIO_ACTIVE_LOW 1
+
 static struct ofw_gpiobus_devinfo *ofw_gpiobus_setup_devinfo(device_t,
device_t, phandle_t);
 static void ofw_gpiobus_destroy_devinfo(device_t, struct ofw_gpiobus_devinfo 
*);
___
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: r307961 - head/sys/arm64/arm64

2016-10-26 Thread Andrew Turner
Author: andrew
Date: Wed Oct 26 12:30:53 2016
New Revision: 307961
URL: https://svnweb.freebsd.org/changeset/base/307961

Log:
  Only release CPUs when they exist.
  
  MFC after:1 week
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/mp_machdep.c

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Wed Oct 26 12:29:56 2016
(r307960)
+++ head/sys/arm64/arm64/mp_machdep.c   Wed Oct 26 12:30:53 2016
(r307961)
@@ -203,6 +203,10 @@ release_aps(void *dummy __unused)
 {
int i;
 
+   /* Only release CPUs if they exist */
+   if (mp_ncpus == 1)
+   return;
+
intr_pic_ipi_setup(IPI_AST, "ast", ipi_ast, NULL);
intr_pic_ipi_setup(IPI_PREEMPT, "preempt", ipi_preempt, NULL);
intr_pic_ipi_setup(IPI_RENDEZVOUS, "rendezvous", ipi_rendezvous, NULL);
___
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: r307960 - head/sys/arm64/arm64

2016-10-26 Thread Andrew Turner
Author: andrew
Date: Wed Oct 26 12:29:56 2016
New Revision: 307960
URL: https://svnweb.freebsd.org/changeset/base/307960

Log:
  Use nitems to get the correct number of registers to read when dumping
  them. Previously this would walk past the end of the array and print
  whatever happened to be after the trapframe struct.
  
  MFC after:1 week
  Sponsored by: DARPA, AFRL

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

Modified: head/sys/arm64/arm64/trap.c
==
--- head/sys/arm64/arm64/trap.c Wed Oct 26 08:47:35 2016(r307959)
+++ head/sys/arm64/arm64/trap.c Wed Oct 26 12:29:56 2016(r307960)
@@ -250,7 +250,7 @@ print_registers(struct trapframe *frame)
 {
u_int reg;
 
-   for (reg = 0; reg < 31; reg++) {
+   for (reg = 0; reg < nitems(frame->tf_x); reg++) {
printf(" %sx%d: %16lx\n", (reg < 10) ? " " : "", reg,
frame->tf_x[reg]);
}
___
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: r307959 - head/sys/arm/allwinner/clk

2016-10-26 Thread Emmanuel Vadot
Author: manu
Date: Wed Oct 26 08:47:35 2016
New Revision: 307959
URL: https://svnweb.freebsd.org/changeset/base/307959

Log:
  The only consumer of pll1 is the CPU clock, we don't need to set it glitch 
free.
  
  Reported by:  jmcneill
  MFC after:1 week

Modified:
  head/sys/arm/allwinner/clk/aw_pll.c

Modified: head/sys/arm/allwinner/clk/aw_pll.c
==
--- head/sys/arm/allwinner/clk/aw_pll.c Wed Oct 26 08:39:33 2016
(r307958)
+++ head/sys/arm/allwinner/clk/aw_pll.c Wed Oct 26 08:47:35 2016
(r307959)
@@ -310,15 +310,6 @@ struct aw_pll_funcs {
 #defineDEVICE_UNLOCK(sc)   CLKDEV_DEVICE_UNLOCK((sc)->clkdev)
 
 static int
-a10_pll1_init(device_t dev, bus_addr_t reg, struct clknode_init_def *def)
-{
-   /* Allow changing PLL frequency while enabled */
-   def->flags = CLK_NODE_GLITCH_FREE;
-
-   return (0);
-}
-
-static int
 a10_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
 int flags)
 {
@@ -999,7 +990,7 @@ a83t_pllcpux_set_freq(struct aw_pll_sc *
}
 
 static struct aw_pll_funcs aw_pll_func[] = {
-   PLL(AWPLL_A10_PLL1, a10_pll1_recalc, a10_pll1_set_freq, a10_pll1_init),
+   PLL(AWPLL_A10_PLL1, a10_pll1_recalc, a10_pll1_set_freq, NULL),
PLL(AWPLL_A10_PLL2, a10_pll2_recalc, a10_pll2_set_freq, NULL),
PLL(AWPLL_A10_PLL3, a10_pll3_recalc, a10_pll3_set_freq, a10_pll3_init),
PLL(AWPLL_A10_PLL5, a10_pll5_recalc, NULL, NULL),
___
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: r307958 - stable/11/usr.bin/printenv

2016-10-26 Thread Pietro Cerutti
Author: gahr (ports committer)
Date: Wed Oct 26 08:39:33 2016
New Revision: 307958
URL: https://svnweb.freebsd.org/changeset/base/307958

Log:
  MFC r307638:
  
  Chase a cornercase in printenv and sync its behaviour with builtin's
  
  The cornercase is when printenv is passed a parameter in the form
  VAR=val, where VAR=val exists in the environment. In this case, printenv would
  print a spurious newline and returns 0.
  
  Approved by:  cognet
  MFC after:1 week

Modified:
  stable/11/usr.bin/printenv/printenv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/printenv/printenv.c
==
--- stable/11/usr.bin/printenv/printenv.c   Wed Oct 26 07:45:48 2016
(r307957)
+++ stable/11/usr.bin/printenv/printenv.c   Wed Oct 26 08:39:33 2016
(r307958)
@@ -83,8 +83,8 @@ main(int argc, char *argv[])
for (ep = environ; *ep; ep++)
if (!memcmp(*ep, *argv, len)) {
cp = *ep + len;
-   if (!*cp || *cp == '=') {
-   (void)printf("%s\n", *cp ? cp + 1 : cp);
+   if (*cp == '=') {
+   (void)printf("%s\n", cp + 1);
exit(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: r307957 - stable/10/sys/cam/scsi

2016-10-26 Thread Alexander Motin
Author: mav
Date: Wed Oct 26 07:45:48 2016
New Revision: 307957
URL: https://svnweb.freebsd.org/changeset/base/307957

Log:
  MFC r307132: Use copyout() instead of pointing sbuf to user-space buffer.

Modified:
  stable/10/sys/cam/scsi/scsi_enc_ses.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_enc_ses.c
==
--- stable/10/sys/cam/scsi/scsi_enc_ses.c   Wed Oct 26 07:45:15 2016
(r307956)
+++ stable/10/sys/cam/scsi/scsi_enc_ses.c   Wed Oct 26 07:45:48 2016
(r307957)
@@ -2675,13 +2675,13 @@ ses_get_elm_devnames(enc_softc_t *enc, e
if (len < 0)
return (EINVAL);
 
-   sbuf_new(&sb, elmdn->elm_devnames, len, 0);
-
cam_periph_unlock(enc->periph);
+   sbuf_new(&sb, NULL, len, SBUF_FIXEDLEN);
ses_paths_iter(enc, &enc->enc_cache.elm_map[elmdn->elm_idx],
   ses_elmdevname_callback, &sb);
sbuf_finish(&sb);
elmdn->elm_names_len = sbuf_len(&sb);
+   copyout(sbuf_data(&sb), elmdn->elm_devnames, elmdn->elm_names_len + 1);
cam_periph_lock(enc->periph);
return (elmdn->elm_names_len > 0 ? 0 : ENODEV);
 }
___
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: r307956 - stable/11/sys/cam/scsi

2016-10-26 Thread Alexander Motin
Author: mav
Date: Wed Oct 26 07:45:15 2016
New Revision: 307956
URL: https://svnweb.freebsd.org/changeset/base/307956

Log:
  MFC r307132: Use copyout() instead of pointing sbuf to user-space buffer.

Modified:
  stable/11/sys/cam/scsi/scsi_enc_ses.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_enc_ses.c
==
--- stable/11/sys/cam/scsi/scsi_enc_ses.c   Wed Oct 26 05:26:59 2016
(r307955)
+++ stable/11/sys/cam/scsi/scsi_enc_ses.c   Wed Oct 26 07:45:15 2016
(r307956)
@@ -2672,13 +2672,13 @@ ses_get_elm_devnames(enc_softc_t *enc, e
if (len < 0)
return (EINVAL);
 
-   sbuf_new(&sb, elmdn->elm_devnames, len, 0);
-
cam_periph_unlock(enc->periph);
+   sbuf_new(&sb, NULL, len, SBUF_FIXEDLEN);
ses_paths_iter(enc, &enc->enc_cache.elm_map[elmdn->elm_idx],
   ses_elmdevname_callback, &sb);
sbuf_finish(&sb);
elmdn->elm_names_len = sbuf_len(&sb);
+   copyout(sbuf_data(&sb), elmdn->elm_devnames, elmdn->elm_names_len + 1);
cam_periph_lock(enc->periph);
return (elmdn->elm_names_len > 0 ? 0 : ENODEV);
 }
___
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"