svn commit: r304835 - stable/11/sys/netinet

2016-08-25 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Aug 26 05:37:44 2016
New Revision: 304835
URL: https://svnweb.freebsd.org/changeset/base/304835

Log:
  MFC 303766
  tcp/lro: If timestamps mismatch or it's a FIN, force flush.
  
  This keeps the segments/ACK/FIN delivery order.
  
  Before this patch, it was observed: if A sent FIN immediately after
  an ACK, B would deliver FIN first to the TCP stack, then the ACK.
  This out-of-order delivery causes one unnecessary ACK sent from B.
  
  Reviewed by:gallatin, hps
  Obtained from:  rrs, gallatin
  Sponsored by:   Netflix (rrs, gallatin), Microsoft (sephe)
  Differential Revision:  https://reviews.freebsd.org/D7415

Modified:
  stable/11/sys/netinet/tcp_lro.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_lro.c
==
--- stable/11/sys/netinet/tcp_lro.c Fri Aug 26 05:18:27 2016
(r304834)
+++ stable/11/sys/netinet/tcp_lro.c Fri Aug 26 05:37:44 2016
(r304835)
@@ -578,6 +578,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
tcp_seq seq;
int error, ip_len, l;
uint16_t eh_type, tcp_data_len;
+   int force_flush = 0;
 
/* We expect a contiguous header [eh, ip, tcp]. */
 
@@ -644,8 +645,15 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
 * Check TCP header constraints.
 */
/* Ensure no bits set besides ACK or PSH. */
-   if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0)
-   return (TCP_LRO_CANNOT);
+   if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) {
+   if (th->th_flags & TH_SYN)
+   return (TCP_LRO_CANNOT);
+   /*
+* Make sure that previously seen segements/ACKs are delivered
+* before this segement, e.g. FIN.
+*/
+   force_flush = 1;
+   }
 
/* XXX-BZ We lose a ACK|PUSH flag concatenating multiple segments. */
/* XXX-BZ Ideally we'd flush on PUSH? */
@@ -661,8 +669,13 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
ts_ptr = (uint32_t *)(th + 1);
if (l != 0 && (__predict_false(l != TCPOLEN_TSTAMP_APPA) ||
(*ts_ptr != ntohl(TCPOPT_NOP<<24|TCPOPT_NOP<<16|
-   TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP
-   return (TCP_LRO_CANNOT);
+   TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP {
+   /*
+* Make sure that previously seen segements/ACKs are delivered
+* before this segement.
+*/
+   force_flush = 1;
+   }
 
/* If the driver did not pass in the checksum, set it now. */
if (csum == 0x)
@@ -696,6 +709,13 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
 #endif
}
 
+   if (force_flush) {
+   /* Timestamps mismatch; this is a FIN, etc */
+   tcp_lro_active_remove(le);
+   tcp_lro_flush(lc, le);
+   return (TCP_LRO_CANNOT);
+   }
+
/* Flush now if appending will result in overflow. */
if (le->p_len > (lc->lro_length_lim - tcp_data_len)) {
tcp_lro_active_remove(le);
@@ -772,6 +792,14 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
return (0);
}
 
+   if (force_flush) {
+   /*
+* Nothing to flush, but this segment can not be further
+* aggregated/delayed.
+*/
+   return (TCP_LRO_CANNOT);
+   }
+
/* Try to find an empty slot. */
if (LIST_EMPTY(>lro_free))
return (TCP_LRO_NO_ENTRIES);
___
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: r304834 - in head/sys: dev/hyperv/netvsc net

2016-08-25 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Aug 26 05:18:27 2016
New Revision: 304834
URL: https://svnweb.freebsd.org/changeset/base/304834

Log:
  hyperv/hn: Use vmbus xact for RNDIS set.
  
  And use new RNDIS set to configure NDIS offloading parameters.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7641

Added:
  head/sys/dev/hyperv/netvsc/ndis.h   (contents, props changed)
Modified:
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/net/rndis.h

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Aug 26 05:15:08 
2016(r304833)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Aug 26 05:18:27 
2016(r304834)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #define HV_RF_RECVINFO_VLAN0x1
 #define HV_RF_RECVINFO_CSUM0x2
@@ -98,6 +99,9 @@ static void hn_rndis_sent_cb(struct hn_s
 const void *data, int dlen);
 static int hn_rndis_query(struct hn_softc *sc, uint32_t oid,
 const void *idata, size_t idlen, void *odata, size_t *odlen0);
+static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data,
+size_t dlen);
+static int hn_rndis_conf_offload(struct hn_softc *sc);
 
 static __inline uint32_t
 hn_rndis_rid(struct hn_softc *sc)
@@ -1002,7 +1006,7 @@ hn_rndis_query(struct hn_softc *sc, uint
reqlen = sizeof(*req) + idlen;
xact = vmbus_xact_get(sc->hn_xact, reqlen);
if (xact == NULL) {
-   if_printf(sc->hn_ifp, "no xact for RNDIS query\n");
+   if_printf(sc->hn_ifp, "no xact for RNDIS query 0x%08x\n", oid);
return (ENXIO);
}
rid = hn_rndis_rid(sc);
@@ -1078,6 +1082,96 @@ done:
return (error);
 }
 
+static int
+hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, size_t dlen)
+{
+   struct rndis_set_req *req;
+   const struct rndis_set_comp *comp;
+   struct vmbus_xact *xact;
+   size_t reqlen, comp_len;
+   uint32_t rid;
+   int error;
+
+   KASSERT(dlen > 0, ("invalid dlen %zu", dlen));
+
+   reqlen = sizeof(*req) + dlen;
+   xact = vmbus_xact_get(sc->hn_xact, reqlen);
+   if (xact == NULL) {
+   if_printf(sc->hn_ifp, "no xact for RNDIS set 0x%08x\n", oid);
+   return (ENXIO);
+   }
+   rid = hn_rndis_rid(sc);
+   req = vmbus_xact_req_data(xact);
+   req->rm_type = REMOTE_NDIS_SET_MSG;
+   req->rm_len = reqlen;
+   req->rm_rid = rid;
+   req->rm_oid = oid;
+   req->rm_infobuflen = dlen;
+   req->rm_infobufoffset = RNDIS_SET_REQ_INFOBUFOFFSET;
+   /* Data immediately follows RNDIS set. */
+   memcpy(req + 1, data, dlen);
+
+   comp_len = sizeof(*comp);
+   comp = hn_rndis_xact_execute(sc, xact, rid, reqlen, _len,
+   REMOTE_NDIS_SET_CMPLT);
+   if (comp == NULL) {
+   if_printf(sc->hn_ifp, "exec RNDIS set 0x%08x failed\n", oid);
+   error = EIO;
+   goto done;
+   }
+
+   if (comp->rm_status != RNDIS_STATUS_SUCCESS) {
+   if_printf(sc->hn_ifp, "RNDIS set 0x%08x failed: "
+   "status 0x%08x\n", oid, comp->rm_status);
+   error = EIO;
+   goto done;
+   }
+   error = 0;
+done:
+   vmbus_xact_put(xact);
+   return (error);
+}
+
+static int
+hn_rndis_conf_offload(struct hn_softc *sc)
+{
+   struct ndis_offload_params params;
+   size_t paramsz;
+   int error;
+
+   /* NOTE: 0 means "no change" */
+   memset(, 0, sizeof(params));
+
+   params.ndis_hdr.ndis_type = NDIS_OBJTYPE_DEFAULT;
+   if (sc->hn_ndis_ver < NDIS_VERSION_6_30) {
+   params.ndis_hdr.ndis_rev = NDIS_OFFLOAD_PARAMS_REV_2;
+   paramsz = NDIS_OFFLOAD_PARAMS_SIZE_6_1;
+   } else {
+   params.ndis_hdr.ndis_rev = NDIS_OFFLOAD_PARAMS_REV_3;
+   paramsz = NDIS_OFFLOAD_PARAMS_SIZE;
+   }
+   params.ndis_hdr.ndis_size = paramsz;
+
+   params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_TXRX;
+   params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_TXRX;
+   params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_TXRX;
+   if (sc->hn_ndis_ver >= NDIS_VERSION_6_30) {
+   params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_TXRX;
+   params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_TXRX;
+   }
+   params.ndis_lsov2_ip4 = NDIS_OFFLOAD_LSOV2_ON;
+   /* XXX ndis_lsov2_ip6 = NDIS_OFFLOAD_LSOV2_ON */
+
+   error = hn_rndis_set(sc, OID_TCP_OFFLOAD_PARAMETERS, , paramsz);
+   if (error) {
+   if_printf(sc->hn_ifp, "offload config failed: %d\n", error);
+   } else {
+   if (bootverbose)
+   if_printf(sc->hn_ifp, "offload config done\n");
+   }
+   return (error);
+}
+
 /*
  * RNDIS filter init 

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

2016-08-25 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Aug 26 05:15:08 2016
New Revision: 304833
URL: https://svnweb.freebsd.org/changeset/base/304833

Log:
  hyperv/hn: Save the adopted NDIS version for RNDIS to use later.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7640

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Aug 26 05:12:09 2016
(r304832)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Aug 26 05:15:08 2016
(r304833)
@@ -521,9 +521,15 @@ hv_nv_connect_to_vsp(struct hn_softc *sc
for (i = protocol_number - 1; i >= 0; i--) {
if (hv_nv_negotiate_nvsp_protocol(sc, protocol_list[i]) == 0) {
sc->hn_nvs_ver = protocol_list[i];
+   sc->hn_ndis_ver = NDIS_VERSION_6_30;
+   if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4)
+   sc->hn_ndis_ver = NDIS_VERSION_6_1;
if (bootverbose) {
-   device_printf(dev, "NVS version 0x%x\n",
-   sc->hn_nvs_ver);
+   if_printf(sc->hn_ifp, "NVS version 0x%x, "
+   "NDIS version %u.%u\n",
+   sc->hn_nvs_ver,
+   NDIS_VERSION_MAJOR(sc->hn_ndis_ver),
+   NDIS_VERSION_MINOR(sc->hn_ndis_ver));
}
break;
}
@@ -549,11 +555,8 @@ hv_nv_connect_to_vsp(struct hn_softc *sc
 
memset(, 0, sizeof(ndis));
ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT;
-   ndis.nvs_ndis_major = NDIS_VERSION_MAJOR_6;
-   if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4)
-   ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_1;
-   else
-   ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_30;
+   ndis.nvs_ndis_major = NDIS_VERSION_MAJOR(sc->hn_ndis_ver);
+   ndis.nvs_ndis_minor = NDIS_VERSION_MINOR(sc->hn_ndis_ver);
 
/* NOTE: No response. */
ret = hn_nvs_req_send(sc, , sizeof(ndis));

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Aug 26 05:12:09 2016
(r304832)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Aug 26 05:15:08 2016
(r304833)
@@ -382,6 +382,7 @@ typedef struct hn_softc {
struct hyperv_dma   hn_chim_dma;
 
uint32_thn_rndis_rid;
+   uint32_thn_ndis_ver;
 } hn_softc_t;
 
 #define HN_FLAG_RXBUF_CONNECTED0x0001

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Aug 26 05:12:09 
2016(r304832)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Aug 26 05:15:08 
2016(r304833)
@@ -330,6 +330,7 @@ static int hn_rx_stat_ulong_sysctl(SYSCT
 static int hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS);
+static int hn_ndis_version_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 *);
@@ -427,6 +428,8 @@ netvsc_probe(device_t dev)
 static int
 netvsc_attach(device_t dev)
 {
+   struct sysctl_oid_list *child;
+   struct sysctl_ctx_list *ctx;
netvsc_device_info device_info;
hn_softc_t *sc;
int unit = device_get_unit(dev);
@@ -608,9 +611,13 @@ netvsc_attach(device_t dev)
hn_tx_chimney_size < sc->hn_chim_szmax)
hn_set_chim_size(sc, hn_tx_chimney_size);
 
-   SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
-   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
-   "nvs_version", CTLFLAG_RD, >hn_nvs_ver, 0, "NVS version");
+   ctx = device_get_sysctl_ctx(dev);
+   child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
+   SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "nvs_version", CTLFLAG_RD,
+   >hn_nvs_ver, 0, "NVS version");
+   SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "ndis_version",
+   CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0,
+   hn_ndis_version_sysctl, "A", "NDIS version");
 
return (0);
 failed:
@@ -2094,6 +2101,18 @@ hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARG
 }
 
 static int
+hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS)
+{

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

2016-08-25 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Aug 26 05:12:09 2016
New Revision: 304832
URL: https://svnweb.freebsd.org/changeset/base/304832

Log:
  hyperv/hn: Use vmbus xact for RNDIS query.
  
  And switch MAC address query to use new RNDIS query function.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7639

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

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Aug 26 04:31:19 
2016(r304831)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Aug 26 05:12:09 
2016(r304832)
@@ -96,6 +96,8 @@ static void hn_rndis_sent_halt(struct hn
 static void hn_rndis_sent_cb(struct hn_send_ctx *sndc,
 struct hn_softc *sc, struct vmbus_channel *chan,
 const void *data, int dlen);
+static int hn_rndis_query(struct hn_softc *sc, uint32_t oid,
+const void *idata, size_t idlen, void *odata, size_t *odlen0);
 
 static __inline uint32_t
 hn_rndis_rid(struct hn_softc *sc)
@@ -695,13 +697,23 @@ cleanup:
 /*
  * RNDIS filter query device MAC address
  */
-static inline int
+static int
 hv_rf_query_device_mac(rndis_device *device)
 {
-   uint32_t size = ETHER_ADDR_LEN;
+   struct hn_softc *sc = device->sc;
+   size_t hwaddr_len;
+   int error;
 
-   return (hv_rf_query_device(device,
-   RNDIS_OID_802_3_PERMANENT_ADDRESS, device->hw_mac_addr, ));
+   hwaddr_len = ETHER_ADDR_LEN;
+   error = hn_rndis_query(sc, OID_802_3_PERMANENT_ADDRESS, NULL, 0,
+   device->hw_mac_addr, _len);
+   if (error)
+   return error;
+   if (hwaddr_len != ETHER_ADDR_LEN) {
+   if_printf(sc->hn_ifp, "invalid hwaddr len %zu\n", hwaddr_len);
+   return EINVAL;
+   }
+   return 0;
 }
 
 /*
@@ -892,12 +904,12 @@ exit:
 
 static const void *
 hn_rndis_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, uint32_t 
rid,
-size_t reqlen, size_t min_complen, uint32_t comp_type)
+size_t reqlen, size_t *comp_len0, uint32_t comp_type)
 {
struct vmbus_gpa gpa[HN_XACT_REQ_PGCNT];
const struct rndis_comp_hdr *comp;
bus_addr_t paddr;
-   size_t comp_len;
+   size_t comp_len, min_complen = *comp_len0;
int gpa_cnt, error;
 
KASSERT(rid > HN_RNDIS_RID_COMPAT_MAX, ("invalid rid %u\n", rid));
@@ -946,7 +958,14 @@ hn_rndis_xact_execute(struct hn_softc *s
 * Check this RNDIS complete message.
 */
if (comp_len < min_complen) {
-   if_printf(sc->hn_ifp, "invalid RNDIS comp len %zu\n", comp_len);
+   if (comp_len >= sizeof(*comp)) {
+   /* rm_status field is valid */
+   if_printf(sc->hn_ifp, "invalid RNDIS comp len %zu, "
+   "status 0x%08x\n", comp_len, comp->rm_status);
+   } else {
+   if_printf(sc->hn_ifp, "invalid RNDIS comp len %zu\n",
+   comp_len);
+   }
return (NULL);
}
if (comp->rm_len < min_complen) {
@@ -965,9 +984,100 @@ hn_rndis_xact_execute(struct hn_softc *s
return (NULL);
}
/* All pass! */
+   *comp_len0 = comp_len;
return (comp);
 }
 
+static int
+hn_rndis_query(struct hn_softc *sc, uint32_t oid,
+const void *idata, size_t idlen, void *odata, size_t *odlen0)
+{
+   struct rndis_query_req *req;
+   const struct rndis_query_comp *comp;
+   struct vmbus_xact *xact;
+   size_t reqlen, odlen = *odlen0, comp_len;
+   int error, ofs;
+   uint32_t rid;
+
+   reqlen = sizeof(*req) + idlen;
+   xact = vmbus_xact_get(sc->hn_xact, reqlen);
+   if (xact == NULL) {
+   if_printf(sc->hn_ifp, "no xact for RNDIS query\n");
+   return (ENXIO);
+   }
+   rid = hn_rndis_rid(sc);
+   req = vmbus_xact_req_data(xact);
+   req->rm_type = REMOTE_NDIS_QUERY_MSG;
+   req->rm_len = reqlen;
+   req->rm_rid = rid;
+   req->rm_oid = oid;
+   /*
+* XXX
+* This is _not_ RNDIS Spec conforming:
+* "This MUST be set to 0 when there is no input data
+*  associated with the OID."
+*
+* If this field was set to 0 according to the RNDIS Spec,
+* Hyper-V would set non-SUCCESS status in the query
+* completion.
+*/
+   req->rm_infobufoffset = RNDIS_QUERY_REQ_INFOBUFOFFSET;
+
+   if (idlen > 0) {
+   req->rm_infobuflen = idlen;
+   /* Input data immediately follows RNDIS query. */
+   memcpy(req + 1, idata, idlen);
+   }
+
+   comp_len = sizeof(*comp) + odlen;
+   comp = hn_rndis_xact_execute(sc, xact, rid, reqlen, _len,
+   REMOTE_NDIS_QUERY_CMPLT);
+   if (comp == 

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

2016-08-25 Thread Justin Hibbits
Author: jhibbits
Date: Fri Aug 26 03:36:37 2016
New Revision: 304829
URL: https://svnweb.freebsd.org/changeset/base/304829

Log:
  Prevent BSS from being cleared twice on BookE
  
  Summary:
  First time BSS is cleared in booke_init(), Second time it's cleared in
  powerpc_init().  Any variable initialized between two those guys gets wiped 
out
  what is wrong. In particular it wipes tlb1_entries initialized by tlb1_init(),
  which was fine when tlb1_init() was called a second time, but this was removed
  in r304656.
  
  Submitted by: Ivan Krivonos 
  Differential Revision: https://reviews.freebsd.org/D7638

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

Modified: head/sys/powerpc/powerpc/machdep.c
==
--- head/sys/powerpc/powerpc/machdep.c  Fri Aug 26 02:46:47 2016
(r304828)
+++ head/sys/powerpc/powerpc/machdep.c  Fri Aug 26 03:36:37 2016
(r304829)
@@ -284,8 +284,14 @@ powerpc_init(vm_offset_t fdt, vm_offset_
 #endif
}
} else {
+#if !defined(BOOKE)
+   /*
+* On BOOKE the BSS is already cleared and some variables
+* initialized.  Do not wipe them out.
+*/
bzero(__sbss_start, __sbss_end - __sbss_start);
bzero(__bss_start, _end - __bss_start);
+#endif
init_static_kenv(NULL, 0);
}
/* Store boot environment state */
___
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: r304828 - head/sys/ddb

2016-08-25 Thread Conrad E. Meyer
Author: cem
Date: Fri Aug 26 02:46:47 2016
New Revision: 304828
URL: https://svnweb.freebsd.org/changeset/base/304828

Log:
  ddb: Add 'show active trace' command
  
  'show active trace', or 'acttrace' for short, prints backtraces from running
  threads only.
  
  Reviewed by:  mjg
  Differential Revision:https://reviews.freebsd.org/D7646

Modified:
  head/sys/ddb/db_command.c

Modified: head/sys/ddb/db_command.c
==
--- head/sys/ddb/db_command.c   Fri Aug 26 01:28:31 2016(r304827)
+++ head/sys/ddb/db_command.c   Fri Aug 26 02:46:47 2016(r304828)
@@ -72,6 +72,7 @@ static db_cmdfcn_tdb_halt;
 static db_cmdfcn_t db_kill;
 static db_cmdfcn_t db_reset;
 static db_cmdfcn_t db_stack_trace;
+static db_cmdfcn_t db_stack_trace_active;
 static db_cmdfcn_t db_stack_trace_all;
 static db_cmdfcn_t db_watchdog;
 
@@ -79,6 +80,12 @@ static db_cmdfcn_t   db_watchdog;
  * 'show' commands
  */
 
+static struct command db_show_active_cmds[] = {
+   { "trace",  db_stack_trace_active,  0,  NULL },
+};
+struct command_table db_show_active_table =
+LIST_HEAD_INITIALIZER(db_show_active_table);
+
 static struct command db_show_all_cmds[] = {
{ "trace",  db_stack_trace_all, 0,  NULL },
 };
@@ -86,6 +93,7 @@ struct command_table db_show_all_table =
 LIST_HEAD_INITIALIZER(db_show_all_table);
 
 static struct command db_show_cmds[] = {
+   { "active", 0,  0,  _show_active_table },
{ "all",0,  0,  _show_all_table },
{ "registers",  db_show_regs,   0,  NULL },
{ "breaks", db_listbreak_cmd,   0,  NULL },
@@ -120,6 +128,8 @@ static struct command db_cmds[] = {
{ "match",  db_trace_until_matching_cmd,0,  NULL },
{ "trace",  db_stack_trace, CS_OWN, NULL },
{ "t",  db_stack_trace, CS_OWN, NULL },
+   /* XXX alias for active trace */
+   { "acttrace",   db_stack_trace_active,  0,  NULL },
/* XXX alias for all trace */
{ "alltrace",   db_stack_trace_all, 0,  NULL },
{ "where",  db_stack_trace, CS_OWN, NULL },
@@ -195,6 +205,9 @@ db_command_init(void)
db_command_register(_cmd_table, _cmds[i]);
for (i = 0; i < N(db_show_cmds); i++)
db_command_register(_show_table, _show_cmds[i]);
+   for (i = 0; i < N(db_show_active_cmds); i++)
+   db_command_register(_show_active_table,
+   _show_active_cmds[i]);
for (i = 0; i < N(db_show_all_cmds); i++)
db_command_register(_show_all_table, _show_all_cmds[i]);
 #undef N
@@ -799,8 +812,7 @@ db_stack_trace(db_expr_t tid, bool hasti
 }
 
 static void
-db_stack_trace_all(db_expr_t dummy, bool dummy2, db_expr_t dummy3,
-char *dummy4)
+_db_stack_trace_all(bool active_only)
 {
struct proc *p;
struct thread *td;
@@ -811,8 +823,18 @@ db_stack_trace_all(db_expr_t dummy, bool
prev_jb = kdb_jmpbuf(jb);
if (setjmp(jb) == 0) {
FOREACH_THREAD_IN_PROC(p, td) {
-   db_printf("\nTracing command %s pid %d tid %ld 
td %p\n",
- p->p_comm, p->p_pid, 
(long)td->td_tid, td);
+   if (td->td_state == TDS_RUNNING)
+   db_printf("\nTracing command %s pid %d"
+   " tid %ld td %p (CPU %d)\n",
+   p->p_comm, p->p_pid,
+   (long)td->td_tid, td,
+   td->td_oncpu);
+   else if (active_only)
+   continue;
+   else
+   db_printf("\nTracing command %s pid %d"
+   " tid %ld td %p\n", p->p_comm,
+   p->p_pid, (long)td->td_tid, td);
db_trace_thread(td, -1);
if (db_pager_quit) {
kdb_jmpbuf(prev_jb);
@@ -824,6 +846,22 @@ db_stack_trace_all(db_expr_t dummy, bool
}
 }
 
+static void
+db_stack_trace_active(db_expr_t dummy, bool dummy2, db_expr_t dummy3,
+char *dummy4)
+{
+
+   _db_stack_trace_all(true);
+}
+
+static void
+db_stack_trace_all(db_expr_t dummy, bool dummy2, db_expr_t dummy3,
+char *dummy4)
+{
+
+   _db_stack_trace_all(false);
+}
+
 /*
  * Take the parsed expression value from the command line that was parsed
  * as a hexadecimal value and convert it as if the expression was parsed
___
svn-src-all@freebsd.org mailing list

svn commit: r304827 - head/sys/dev/cxgbe/cxgbei

2016-08-25 Thread Navdeep Parhar
Author: np
Date: Fri Aug 26 01:28:31 2016
New Revision: 304827
URL: https://svnweb.freebsd.org/changeset/base/304827

Log:
  cxgbe/cxgbei: There is no need for multiple modules in the KLD.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/cxgbei/cxgbei.c
  head/sys/dev/cxgbe/cxgbei/cxgbei.h
  head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c

Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.c
==
--- head/sys/dev/cxgbe/cxgbei/cxgbei.c  Thu Aug 25 23:55:56 2016
(r304826)
+++ head/sys/dev/cxgbe/cxgbei/cxgbei.c  Fri Aug 26 01:28:31 2016
(r304827)
@@ -1117,10 +1117,14 @@ cxgbei_modevent(module_t mod, int cmd, v
switch (cmd) {
case MOD_LOAD:
rc = cxgbei_mod_load();
+   if (rc == 0)
+   rc = icl_cxgbei_mod_load();
break;
 
case MOD_UNLOAD:
-   rc = cxgbei_mod_unload();
+   rc = icl_cxgbei_mod_unload();
+   if (rc == 0)
+   rc = cxgbei_mod_unload();
break;
 
default:

Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.h
==
--- head/sys/dev/cxgbe/cxgbei/cxgbei.h  Thu Aug 25 23:55:56 2016
(r304826)
+++ head/sys/dev/cxgbe/cxgbei/cxgbei.h  Fri Aug 26 01:28:31 2016
(r304827)
@@ -167,4 +167,8 @@ int t4_ddp_set_map(struct cxgbei_data *,
 struct cxgbei_ulp2_gather_list *, int);
 void t4_ddp_clear_map(struct cxgbei_data *, struct cxgbei_ulp2_gather_list *,
 u_int, u_int, u_int, struct icl_cxgbei_conn *);
+
+/* icl_cxgbei.c */
+int icl_cxgbei_mod_load(void);
+int icl_cxgbei_mod_unload(void);
 #endif

Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
==
--- head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c  Thu Aug 25 23:55:56 2016
(r304826)
+++ head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c  Fri Aug 26 01:28:31 2016
(r304827)
@@ -877,10 +877,10 @@ icl_cxgbei_limits(struct icl_drv_limits 
return (0);
 }
 
-static int
-icl_cxgbei_load(void)
+int
+icl_cxgbei_mod_load(void)
 {
-   int error;
+   int rc;
 
icl_transfer_zone = uma_zcreate("icl_transfer",
16 * 1024, NULL, NULL, NULL, NULL,
@@ -888,15 +888,14 @@ icl_cxgbei_load(void)
 
refcount_init(_cxgbei_ncons, 0);
 
-   error = icl_register("cxgbei", false, -100, icl_cxgbei_limits,
+   rc = icl_register("cxgbei", false, -100, icl_cxgbei_limits,
icl_cxgbei_new_conn);
-   KASSERT(error == 0, ("failed to register"));
 
-   return (error);
+   return (rc);
 }
 
-static int
-icl_cxgbei_unload(void)
+int
+icl_cxgbei_mod_unload(void)
 {
 
if (icl_cxgbei_ncons != 0)
@@ -908,28 +907,4 @@ icl_cxgbei_unload(void)
 
return (0);
 }
-
-static int
-icl_cxgbei_modevent(module_t mod, int what, void *arg)
-{
-
-   switch (what) {
-   case MOD_LOAD:
-   return (icl_cxgbei_load());
-   case MOD_UNLOAD:
-   return (icl_cxgbei_unload());
-   default:
-   return (EINVAL);
-   }
-}
-
-moduledata_t icl_cxgbei_data = {
-   "icl_cxgbei",
-   icl_cxgbei_modevent,
-   0
-};
-
-DECLARE_MODULE(icl_cxgbei, icl_cxgbei_data, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
-MODULE_DEPEND(icl_cxgbei, icl, 1, 1, 1);
-MODULE_VERSION(icl_cxgbei, 1);
 #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"


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

2016-08-25 Thread Sepherosa Ziehau
On Fri, Aug 26, 2016 at 1:54 AM, hiren panchasara
 wrote:
> On 08/02/16 at 06:36P, Sepherosa Ziehau wrote:
>> Author: sephe
>> Date: Tue Aug  2 06:36:47 2016
>> New Revision: 303656
>> URL: https://svnweb.freebsd.org/changeset/base/303656
>>
>> Log:
>>   tcp/lro: Implement hash table for LRO entries.
>>
>>   This significantly improves HTTP workload performance and reduces
>>   HTTP workload latency.
>>
>>   Reviewed by:rrs, gallatin, hps
>>   Obtained from:  rrs, gallatin
>>   Sponsored by:   Netflix (rrs, gallatin) , Microsoft (sephe)
>>   Differential Revision:  https://reviews.freebsd.org/D6689
>
> Hi Sephe,
>
> Can you please MFC this to stable/11?

I don't think this one can be MFC'ed, since it changes the size of LRO
control struct, which is usually embedded in the driver's softc/RX
ring struct.

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: r303766 - head/sys/netinet

2016-08-25 Thread Sepherosa Ziehau
On Fri, Aug 26, 2016 at 1:52 AM, hiren panchasara
 wrote:
> On 08/05/16 at 09:08P, Sepherosa Ziehau wrote:
>> Author: sephe
>> Date: Fri Aug  5 09:08:00 2016
>> New Revision: 303766
>> URL: https://svnweb.freebsd.org/changeset/base/303766
>>
>> Log:
>>   tcp/lro: If timestamps mismatch or it's a FIN, force flush.
>>
>>   This keeps the segments/ACK/FIN delivery order.
>>
>>   Before this patch, it was observed: if A sent FIN immediately after
>>   an ACK, B would deliver FIN first to the TCP stack, then the ACK.
>>   This out-of-order delivery causes one unnecessary ACK sent from B.
>>
>>   Reviewed by:gallatin, hps
>>   Obtained from:  rrs, gallatin
>>   Sponsored by:   Netflix (rrs, gallatin), Microsoft (sephe)
>>   Differential Revision:  https://reviews.freebsd.org/D7415
>
> Hi Sephe,
>
> This looks like a good fix for stable/11. Can you please MFC it?

Yeah, sure.

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: r304826 - head/share/mk

2016-08-25 Thread Bryan Drewery
Author: bdrewery
Date: Thu Aug 25 23:55:56 2016
New Revision: 304826
URL: https://svnweb.freebsd.org/changeset/base/304826

Log:
  WITH_META_MODE: Don't let subdir traversals for 'make install' re-enable meta 
mode.
  
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/mk/src.sys.env.mk

Modified: head/share/mk/src.sys.env.mk
==
--- head/share/mk/src.sys.env.mkThu Aug 25 23:24:57 2016
(r304825)
+++ head/share/mk/src.sys.env.mkThu Aug 25 23:55:56 2016
(r304826)
@@ -23,6 +23,7 @@ _src_env_conf_included_:  .NOTMAIN
 .if make(*install*) && ${.MAKE.LEVEL} == 0
 META_MODE= normal
 MK_META_MODE=  no
+.export MK_META_MODE
 .endif
 
 # If we were found via .../share/mk we need to replace that
___
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: r303988 - head/lib/libc/gen

2016-08-25 Thread Bryan Drewery
On 8/25/2016 1:55 PM, Ed Schouten wrote:
> Hi Bryan,
> 
> 2016-08-25 19:43 GMT+02:00 Bryan Drewery :
 readelf -a /lib/libc.so.7|grep basename
>>>   2149: 00076200   231 FUNCGLOBAL DEFAULT   11
>>> basename@@FBSD_1.0 (2)
>>>   2514: 00076140   184 FUNCGLOBAL DEFAULT   11
>>> basename_r@@FBSD_1.2 (4)
> 
> I think the reason for this is that I haven't made any changes to the
> underlying basename() function (yet); only to dirname(). So there is
> no basename@FBSD_1.0. Only basename@@FBSD_1.0 (to indicate it's the
> latest version against we should link).
> 

It only happens with static builds which lack the 1.0 symbol:

> # readelf -a /usr/lib/libc.a|grep basename
> File: /usr/lib/libc.a(basename.o)
>  1:  0 FILELOCAL  DEFAULT  ABS 
> /root/git/freebsd/lib/libc/gen/basename.c
>  2:  8 OBJECT  LOCAL  DEFAULT5 basename.bname
>  6: 00c0   231 FUNCGLOBAL DEFAULT2 basename
>  7:    184 FUNCGLOBAL DEFAULT2 basename_r

With dynamic it is fine:

> # readelf -a /lib/libc.so.7|grep basename
>   2149: 00078280   231 FUNCGLOBAL DEFAULT   11 basename@@FBSD_1.0 
> (2)
>   2514: 000781c0   184 FUNCGLOBAL DEFAULT   11 
> basename_r@@FBSD_1.2 (4)


> What happens if you s/__sym_compat/__sym_default the basename() line?
> 
> 

Libc wouldn't build, it complained quite loudly with a lot of these:

> fatal error: error in backend: A @@ version cannot be undefined



With this it built:

> diff --git lib/libc/gen/basename.c lib/libc/gen/basename.c
> index 7e21ca4..5f35613 100644
> --- lib/libc/gen/basename.c
> +++ lib/libc/gen/basename.c
> @@ -66,7 +66,7 @@ basename_r(const char *path, char *bname)
>  }
> 
>  char *
> -basename(char *path)
> +(basename_impl)(char *path)
>  {
> static char *bname = NULL;
> 
> @@ -77,3 +77,4 @@ basename(char *path)
> }
> return (basename_r(path, bname));
>  }
> +__sym_default(basename, basename_impl, FBSD_1.0);

Perhaps there is a better way, but it worked...

Then I get:

> # readelf -a /lib/libc.so.7|grep basename
>   2145: 00078280   231 FUNCGLOBAL DEFAULT   11 basename@@FBSD_1.0 
> (2)
>   2514: 000781c0   184 FUNCGLOBAL DEFAULT   11 
> basename_r@@FBSD_1.2 (4)
> # readelf -a /usr/lib/libc.a|grep basename
> File: /usr/lib/libc.a(basename.o)
>  1:  0 FILELOCAL  DEFAULT  ABS 
> /root/git/freebsd/lib/libc/gen/basename.c
>  2:  8 OBJECT  LOCAL  DEFAULT5 basename_impl.bname
>  6: 00c0   231 FUNCGLOBAL DEFAULT2 basename@@FBSD_1.0
>  7: 00c0   231 FUNCGLOBAL DEFAULT2 basename_impl
>  8:    184 FUNCGLOBAL DEFAULT2 basename_r

And xinstall builds with dynamic and static and runs fine.


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r304825 - head/cddl/lib/libdtrace

2016-08-25 Thread George V. Neville-Neil
Author: gnn
Date: Thu Aug 25 23:24:57 2016
New Revision: 304825
URL: https://svnweb.freebsd.org/changeset/base/304825

Log:
  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
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/cddl/lib/libdtrace/psinfo.d

Modified: head/cddl/lib/libdtrace/psinfo.d
==
--- head/cddl/lib/libdtrace/psinfo.dThu Aug 25 23:06:12 2016
(r304824)
+++ head/cddl/lib/libdtrace/psinfo.dThu Aug 25 23:24:57 2016
(r304825)
@@ -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: r304824 - head/sys/dev/cxgbe/cxgbei

2016-08-25 Thread Navdeep Parhar
Author: np
Date: Thu Aug 25 23:06:12 2016
New Revision: 304824
URL: https://svnweb.freebsd.org/changeset/base/304824

Log:
  cxgbe/cxgbei: Convert the driver-private PDU flags to enums and replace
  pdu_ prefix with icp_ in struct icl_cxgbei_pdu.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/cxgbei/cxgbei.c
  head/sys/dev/cxgbe/cxgbei/cxgbei.h
  head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c

Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.c
==
--- head/sys/dev/cxgbe/cxgbei/cxgbei.c  Thu Aug 25 22:32:10 2016
(r304823)
+++ head/sys/dev/cxgbe/cxgbei/cxgbei.c  Thu Aug 25 23:06:12 2016
(r304824)
@@ -577,8 +577,8 @@ do_rx_iscsi_hdr(struct sge_iq *iq, const
icp = ip_to_icp(ip);
bcopy(mtod(m, caddr_t) + sizeof(*cpl), icp->ip.ip_bhs, sizeof(struct
iscsi_bhs));
-   icp->pdu_seq = ntohl(cpl->seq);
-   icp->pdu_flags = SBUF_ULP_FLAG_HDR_RCVD;
+   icp->icp_seq = ntohl(cpl->seq);
+   icp->icp_flags = ICPF_RX_HDR;
 
/* This is the start of a new PDU.  There should be no old state. */
MPASS(toep->ulpcb2 == NULL);
@@ -606,13 +606,13 @@ do_rx_iscsi_data(struct sge_iq *iq, cons
 
/* Must already have received the header (but not the data). */
MPASS(icp != NULL);
-   MPASS(icp->pdu_flags == SBUF_ULP_FLAG_HDR_RCVD);
+   MPASS(icp->icp_flags == ICPF_RX_HDR);
MPASS(icp->ip.ip_data_mbuf == NULL);
MPASS(icp->ip.ip_data_len == 0);
 
m_adj(m, sizeof(*cpl));
 
-   icp->pdu_flags |= SBUF_ULP_FLAG_DATA_RCVD;
+   icp->icp_flags |= ICPF_RX_FLBUF;
icp->ip.ip_data_mbuf = m;
icp->ip.ip_data_len = m->m_pkthdr.len;
 
@@ -645,19 +645,19 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const
 
/* Must already be assembling a PDU. */
MPASS(icp != NULL);
-   MPASS(icp->pdu_flags & SBUF_ULP_FLAG_HDR_RCVD); /* Data is optional. */
+   MPASS(icp->icp_flags & ICPF_RX_HDR);/* Data is optional. */
ip = >ip;
-   icp->pdu_flags |= SBUF_ULP_FLAG_STATUS_RCVD;
+   icp->icp_flags |= ICPF_RX_STATUS;
val = ntohl(cpl->ddpvld);
if (val & F_DDP_PADDING_ERR)
-   icp->pdu_flags |= SBUF_ULP_FLAG_PAD_ERROR;
+   icp->icp_flags |= ICPF_PAD_ERR;
if (val & F_DDP_HDRCRC_ERR)
-   icp->pdu_flags |= SBUF_ULP_FLAG_HCRC_ERROR;
+   icp->icp_flags |= ICPF_HCRC_ERR;
if (val & F_DDP_DATACRC_ERR)
-   icp->pdu_flags |= SBUF_ULP_FLAG_DCRC_ERROR;
+   icp->icp_flags |= ICPF_DCRC_ERR;
if (ip->ip_data_mbuf == NULL) {
/* XXXNP: what should ip->ip_data_len be, and why? */
-   icp->pdu_flags |= SBUF_ULP_FLAG_DATA_DDPED;
+   icp->icp_flags |= ICPF_RX_DDP;
}
pdu_len = ntohs(cpl->len);  /* includes everything. */
 
@@ -674,7 +674,7 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const
}
 
tp = intotcpcb(inp);
-   MPASS(icp->pdu_seq == tp->rcv_nxt);
+   MPASS(icp->icp_seq == tp->rcv_nxt);
MPASS(tp->rcv_wnd >= pdu_len);
tp->rcv_nxt += pdu_len;
tp->rcv_wnd -= pdu_len;
@@ -737,9 +737,8 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const
if (ip0 == NULL)
CXGBE_UNIMPLEMENTED("PDU allocation failure");
icp0 = ip_to_icp(ip0);
-   icp0->pdu_seq = 0; /* XXX */
-   icp0->pdu_flags = SBUF_ULP_FLAG_HDR_RCVD |
-   SBUF_ULP_FLAG_STATUS_RCVD;
+   icp0->icp_seq = 0; /* XXX */
+   icp0->icp_flags = ICPF_RX_HDR | ICPF_RX_STATUS;
m_copydata(m, 0, sizeof(struct iscsi_bhs), (void 
*)ip0->ip_bhs);
STAILQ_INSERT_TAIL(>rcvd_pdus, ip0, ip_next);
}
@@ -748,7 +747,7 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const
 
 #if 0
CTR4(KTR_CXGBE, "%s: tid %u, pdu_len %u, pdu_flags 0x%x",
-   __func__, tid, pdu_len, icp->pdu_flags);
+   __func__, tid, pdu_len, icp->icp_flags);
 #endif
 
STAILQ_INSERT_TAIL(>rcvd_pdus, ip, ip_next);

Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.h
==
--- head/sys/dev/cxgbe/cxgbei/cxgbei.h  Thu Aug 25 22:32:10 2016
(r304823)
+++ head/sys/dev/cxgbe/cxgbei/cxgbei.h  Thu Aug 25 23:06:12 2016
(r304824)
@@ -76,15 +76,26 @@ ic_to_icc(struct icl_conn *ic)
return (__containerof(ic, struct icl_cxgbei_conn, ic));
 }
 
-#define CXGBEI_PDU_SIGNATURE 0x12344321
+/* PDU flags and signature. */
+enum {
+   ICPF_RX_HDR = 1 << 0, /* PDU header received. */
+   ICPF_RX_FLBUF   = 1 << 1, /* PDU payload received in a freelist. */
+   ICPF_RX_DDP = 1 << 2, /* PDU payload DDP'd. */
+   ICPF_RX_STATUS  = 1 << 3, /* Rx status received. */
+   ICPF_HCRC_ERR   = 1 

svn commit: r304823 - head/libexec/rtld-elf/mips

2016-08-25 Thread Adrian Chadd
Author: adrian
Date: Thu Aug 25 22:32:10 2016
New Revision: 304823
URL: https://svnweb.freebsd.org/changeset/base/304823

Log:
  [mips] flip from =v to =r - let the compiler choose a temp register.
  
  =v is some ye olde gcc "use this specific register as the temp register"
  thing that they've deprecated and clang/llvm doesn't implement.
  
  Poked again and again by: sbruno

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

Modified: head/libexec/rtld-elf/mips/reloc.c
==
--- head/libexec/rtld-elf/mips/reloc.c  Thu Aug 25 21:55:17 2016
(r304822)
+++ head/libexec/rtld-elf/mips/reloc.c  Thu Aug 25 22:32:10 2016
(r304823)
@@ -645,7 +645,7 @@ _mips_get_tls(void)
".set\tmips64r2\n\t"
"rdhwr\t%0, $29\n\t"
".set\tpop"
-   : "=v" (_rv));
+   : "=r" (_rv));
/*
 * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317'
 *
@@ -670,7 +670,7 @@ _mips_get_tls(void)
".set\tmips32r2\n\t"
"rdhwr\t%0, $29\n\t"
".set\tpop"
-   : "=v" (_rv));
+   : "=r" (_rv));
/*
 * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317'
 *
___
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: r304822 - head/sys/dev/cxgbe/cxgbei

2016-08-25 Thread Navdeep Parhar
Author: np
Date: Thu Aug 25 21:55:17 2016
New Revision: 304822
URL: https://svnweb.freebsd.org/changeset/base/304822

Log:
  cxgbe/cxgbei: Read the chip's configuration to determine the actual
  hardware send and receive PDU limits.  Report these limits to ICL and
  take them into account when setting the socket's send and receive buffer
  sizes.  The driver used a single hardcoded limit everywhere prior to
  this change.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/cxgbei/cxgbei.c
  head/sys/dev/cxgbe/cxgbei/cxgbei.h
  head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c

Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.c
==
--- head/sys/dev/cxgbe/cxgbei/cxgbei.c  Thu Aug 25 21:33:39 2016
(r304821)
+++ head/sys/dev/cxgbe/cxgbei/cxgbei.c  Thu Aug 25 21:55:17 2016
(r304822)
@@ -472,17 +472,47 @@ t4_sk_ddp_tag_release(struct icl_cxgbei_
return (0);
 }
 
+static void
+read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len,
+uint32_t *max_rx_pdu_len)
+{
+   uint32_t tx_len, rx_len, r, v;
+
+   rx_len = t4_read_reg(sc, A_TP_PMM_RX_PAGE_SIZE);
+   tx_len = t4_read_reg(sc, A_TP_PMM_TX_PAGE_SIZE);
+
+   r = t4_read_reg(sc, A_TP_PARA_REG2);
+   rx_len = min(rx_len, G_MAXRXDATA(r));
+   tx_len = min(tx_len, G_MAXRXDATA(r));
+
+   r = t4_read_reg(sc, A_TP_PARA_REG7);
+   v = min(G_PMMAXXFERLEN0(r), G_PMMAXXFERLEN1(r));
+   rx_len = min(rx_len, v);
+   tx_len = min(tx_len, v);
+
+   /* Remove after FW_FLOWC_MNEM_TXDATAPLEN_MAX fix in firmware. */
+   tx_len = min(tx_len, 3 * 4096);
+
+   *max_tx_pdu_len = rounddown2(tx_len, 512);
+   *max_rx_pdu_len = rounddown2(rx_len, 512);
+}
+
+/*
+ * Initialize the software state of the iSCSI ULP driver.
+ *
+ * ENXIO means firmware didn't set up something that it was supposed to.
+ */
 static int
-cxgbei_ddp_init(struct adapter *sc, struct cxgbei_data *ci)
+cxgbei_init(struct adapter *sc, struct cxgbei_data *ci)
 {
-   int nppods, bits, max_sz, rc;
+   int nppods, bits, rc;
static const u_int pgsz_order[] = {0, 1, 2, 3};
 
MPASS(sc->vres.iscsi.size > 0);
 
ci->llimit = sc->vres.iscsi.start;
ci->ulimit = sc->vres.iscsi.start + sc->vres.iscsi.size - 1;
-   max_sz = G_MAXRXDATA(t4_read_reg(sc, A_TP_PARA_REG2));
+   read_pdu_limits(sc, >max_tx_pdu_len, >max_rx_pdu_len);
 
nppods = sc->vres.iscsi.size >> IPPOD_SIZE_SHIFT;
if (nppods <= 1024)
@@ -513,7 +543,6 @@ cxgbei_ddp_init(struct adapter *sc, stru
}
 
mtx_init(>map_lock, "ddp lock", NULL, MTX_DEF | MTX_DUPOK);
-   ci->max_txsz = ci->max_rxsz = min(max_sz, ULP2_MAX_PKT_SIZE);
ci->nppods = nppods;
ci->idx_last = nppods;
ci->idx_bits = bits;
@@ -811,7 +840,7 @@ cxgbei_activate(struct adapter *sc)
if (ci == NULL)
return (ENOMEM);
 
-   rc = cxgbei_ddp_init(sc, ci);
+   rc = cxgbei_init(sc, ci);
if (rc != 0) {
free(ci, M_CXGBE);
return (rc);

Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.h
==
--- head/sys/dev/cxgbe/cxgbei/cxgbei.h  Thu Aug 25 21:33:39 2016
(r304821)
+++ head/sys/dev/cxgbe/cxgbei/cxgbei.h  Thu Aug 25 21:55:17 2016
(r304822)
@@ -135,8 +135,6 @@ struct cxgbei_ulp2_tag_format {
 };
 
 struct cxgbei_data {
-   u_int max_txsz;
-   u_int max_rxsz;
u_int llimit;
u_int ulimit;
u_int nppods;
@@ -144,6 +142,8 @@ struct cxgbei_data {
u_char idx_bits;
uint32_t idx_mask;
uint32_t rsvd_tag_mask;
+   u_int max_tx_pdu_len;
+   u_int max_rx_pdu_len;
 
struct mtx map_lock;
bus_dma_tag_t ulp_ddp_tag;

Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
==
--- head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c  Thu Aug 25 21:33:39 2016
(r304821)
+++ head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c  Thu Aug 25 21:55:17 2016
(r304822)
@@ -137,16 +137,6 @@ static kobj_method_t icl_cxgbei_methods[
 
 DEFINE_CLASS(icl_cxgbei, icl_cxgbei_methods, sizeof(struct icl_cxgbei_conn));
 
-#if 0
-/*
- * Subtract another 256 for AHS from MAX_DSL if AHS could be used.
- */
-#define CXGBEI_MAX_PDU 16224
-#define CXGBEI_MAX_DSL (CXGBEI_MAX_PDU - sizeof(struct iscsi_bhs) - 8)
-#endif
-#define CXGBEI_MAX_DSL 8192
-#define CXGBEI_MAX_PDU (CXGBEI_MAX_DSL + sizeof(struct iscsi_bhs) + 8)
-
 void
 icl_cxgbei_conn_pdu_free(struct icl_conn *ic, struct icl_pdu *ip)
 {
@@ -339,7 +329,7 @@ icl_cxgbei_conn_pdu_append_data(struct i
 
if (__predict_true(m_append(m, len, addr) != 0)) {
ip->ip_data_len += len;
-   MPASS(ip->ip_data_len <= CXGBEI_MAX_DSL);
+   MPASS(ip->ip_data_len <= ic->ic_max_data_segment_length);

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

2016-08-25 Thread Ed Maste
Author: emaste
Date: Thu Aug 25 21:33:39 2016
New Revision: 304821
URL: https://svnweb.freebsd.org/changeset/base/304821

Log:
  bspatch: remove output file in the case of error
  
  Reviewed by:  oshogbo
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D7644

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

Modified: head/usr.bin/bsdiff/bspatch/bspatch.c
==
--- head/usr.bin/bsdiff/bspatch/bspatch.c   Thu Aug 25 21:29:16 2016
(r304820)
+++ head/usr.bin/bsdiff/bspatch/bspatch.c   Thu Aug 25 21:33:39 2016
(r304821)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -51,6 +52,18 @@ __FBSDID("$FreeBSD$");
 #define O_BINARY 0
 #endif
 
+static char *newfile;
+static int dirfd = -1;
+
+static void
+exit_cleanup(void)
+{
+
+   if (dirfd != -1 && newfile != NULL)
+   if (unlinkat(dirfd, newfile, 0))
+   warn("unlinkat");
+}
+
 static off_t offtin(u_char *buf)
 {
off_t y;
@@ -82,6 +95,7 @@ int main(int argc, char *argv[])
 {
FILE *f, *cpf, *dpf, *epf;
BZFILE *cpfbz2, *dpfbz2, *epfbz2;
+   char *directory, *namebuf;
int cbz2err, dbz2err, ebz2err;
int newfd, oldfd;
ssize_t oldsize, newsize;
@@ -93,7 +107,7 @@ int main(int argc, char *argv[])
off_t lenread;
off_t i;
 #ifdef HAVE_CAPSICUM
-   cap_rights_t rights_ro, rights_wr;
+   cap_rights_t rights_dir, rights_ro, rights_wr;
 #endif
 
if (argc != 4)
@@ -114,10 +128,19 @@ int main(int argc, char *argv[])
/* open oldfile */
if ((oldfd = open(argv[1], O_RDONLY | O_BINARY, 0)) < 0)
err(1, "open(%s)", argv[1]);
+   /* open directory where we'll write newfile */
+   if ((namebuf = strdup(argv[2])) == NULL ||
+   (directory = dirname(namebuf)) == NULL ||
+   (dirfd = open(directory, O_DIRECTORY)) < 0)
+   err(1, "open %s", argv[2]);
+   free(namebuf);
+   if ((newfile = basename(argv[2])) == NULL)
+   err(1, "basename");
/* open newfile */
-   if ((newfd = open(argv[2], O_CREAT | O_TRUNC | O_WRONLY | O_BINARY,
-   0666)) < 0)
+   if ((newfd = openat(dirfd, newfile,
+   O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0666)) < 0)
err(1, "open(%s)", argv[2]);
+   atexit(exit_cleanup);
 
 #ifdef HAVE_CAPSICUM
if (cap_enter() < 0) {
@@ -128,13 +151,15 @@ int main(int argc, char *argv[])
/* Capsicum Available */
cap_rights_init(_ro, CAP_READ, CAP_FSTAT, CAP_SEEK);
cap_rights_init(_wr, CAP_WRITE);
-   
+   cap_rights_init(_dir, CAP_UNLINKAT);
+
if (cap_rights_limit(fileno(f), _ro) < 0 ||
cap_rights_limit(fileno(cpf), _ro) < 0 ||
cap_rights_limit(fileno(dpf), _ro) < 0 ||
cap_rights_limit(fileno(epf), _ro) < 0 ||
cap_rights_limit(oldfd, _ro) < 0 ||
-   cap_rights_limit(newfd, _wr) < 0)
+   cap_rights_limit(newfd, _wr) < 0 ||
+   cap_rights_limit(dirfd, _dir) < 0)
err(1, "cap_rights_limit() failed, could not restrict"
" capabilities");
}
@@ -260,6 +285,8 @@ int main(int argc, char *argv[])
/* Write the new file */
if (write(newfd, new, newsize) != newsize || close(newfd) == -1)
err(1, "%s", argv[2]);
+   /* Disable atexit cleanup */
+   newfile = NULL;
 
free(new);
free(old);
___
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: r304819 - head/lib/libc/stdio

2016-08-25 Thread Andrey A. Chernov
Author: ache
Date: Thu Aug 25 21:14:26 2016
New Revision: 304819
URL: https://svnweb.freebsd.org/changeset/base/304819

Log:
  Original fgetln() from 44lite return sucess for line tail errors,
  i.e. partial line, but set __SERR and errno in the same time, which
  is inconsistent.
  Now both OpenBSD and NetBSD return failure, i.e. no line and set error
  indicators for such case, so make our fgetln() and fgetwln()
  (as its wide version) compatible with the rest of *BSD.
  
  PR: 212033
  MFC after:  7 days

Modified:
  head/lib/libc/stdio/fgetln.c
  head/lib/libc/stdio/fgetwln.c

Modified: head/lib/libc/stdio/fgetln.c
==
--- head/lib/libc/stdio/fgetln.cThu Aug 25 21:13:16 2016
(r304818)
+++ head/lib/libc/stdio/fgetln.cThu Aug 25 21:14:26 2016
(r304819)
@@ -139,8 +139,11 @@ fgetln(FILE *fp, size_t *lenp)
(void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
len - off);
off = len;
-   if (__srefill(fp))
-   break;  /* EOF or error: return partial line */
+   if (__srefill(fp)) {
+   if (__sfeof(fp))
+   break;
+   goto error;
+   }
if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL)
continue;
 

Modified: head/lib/libc/stdio/fgetwln.c
==
--- head/lib/libc/stdio/fgetwln.c   Thu Aug 25 21:13:16 2016
(r304818)
+++ head/lib/libc/stdio/fgetwln.c   Thu Aug 25 21:14:26 2016
(r304819)
@@ -53,7 +53,6 @@ fgetwln_l(FILE * __restrict fp, size_t *
ORIENT(fp, 1);
 
len = 0;
-   /* WEOF or error: return partial line, see fgetln(3). */
while ((wc = __fgetwc(fp, locale)) != WEOF) {
 #defineGROW512
if (len * sizeof(wchar_t) >= fp->_lb._size &&
@@ -65,7 +64,7 @@ fgetwln_l(FILE * __restrict fp, size_t *
if (wc == L'\n')
break;
}
-   if (len == 0)
+   if (len == 0 || (wc == WEOF && !__sfeof(fp)))
goto error;
 
FUNLOCKFILE(fp);
___
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: r303988 - head/lib/libc/gen

2016-08-25 Thread Ed Schouten
Hi Bryan,

2016-08-25 19:43 GMT+02:00 Bryan Drewery :
>>> readelf -a /lib/libc.so.7|grep basename
>>   2149: 00076200   231 FUNCGLOBAL DEFAULT   11
>> basename@@FBSD_1.0 (2)
>>   2514: 00076140   184 FUNCGLOBAL DEFAULT   11
>> basename_r@@FBSD_1.2 (4)

I think the reason for this is that I haven't made any changes to the
underlying basename() function (yet); only to dirname(). So there is
no basename@FBSD_1.0. Only basename@@FBSD_1.0 (to indicate it's the
latest version against we should link).

What happens if you s/__sym_compat/__sym_default the basename() line?


-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
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: r304815 - in head: lib lib/libifc share/examples/libifc share/mk

2016-08-25 Thread Conrad Meyer
On Thu, Aug 25, 2016 at 1:20 PM, Kristof Provost  wrote:
> On 25 Aug 2016, at 22:14, John Baldwin wrote:
>> I hate even writing this mail, and it looks like the topic wasn't really
>> discussed in the review, but I think libifconfig is probably the "better"
>> name if the goal is to move most of ifconfig into it.  Certainly if a
>> developer is looking for a library that provides a programmatic interface
>> to the same operations a user does via ifconfig, libifconfig is the name
>> they will look for first.
>
> This is the right time to bring this sort of thing up. One of the reasons
> I pushed to get this in the tree in this very early state was to provoke
> exactly this sort of response. Right now the work is still in an early state
> and changing this sort of thing is still possible.
>
> The name was in fact discussed privately, and we figured libifconfig was a
> bit
> on the long side.
>
> I certainly take your point about libifc_. Does anyone else have any views
> regarding
> the naming (or other subjects)?

Hi,

I don't have anything to add, other than a "me too."

I'd second John's suggestions.  'libifconfig' for the library name is
more reasonable than libifc.  And just 'ifc_' (or even 'ifconfig_')
prefixes for public library routines is sufficient.

Thanks,
Conrad
___
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: r304815 - in head: lib lib/libifc share/examples/libifc share/mk

2016-08-25 Thread Alexey Dokuchaev
On Thu, Aug 25, 2016 at 10:20:29PM +0200, Kristof Provost wrote:
> On 25 Aug 2016, at 22:14, John Baldwin wrote:
> > I hate even writing this mail, and it looks like the topic wasn't
> > really discussed in the review, but I think libifconfig is probably
> > the "better" name if the goal is to move most of ifconfig into it.
> > ...
> > Hmm, it seems you are 'libifc_*'.  Most of our libraries do not
> > include 'lib' in the namespace prefix (see above examples that all
> > use the name of the library without 'lib' as the prefix).  If nothing
> > else I'd suggest dropping 'lib' to be consistent with most other
> > libraries in the tree.

+1.

> The name was in fact discussed privately, and we figured libifconfig
> was a bit on the long side.

Oh come one, we already have `libblocksruntime' and `libbluetooth' (and
some others I probably don't remember now).  `libifconfig' is just fine.
Potential namespace clashes are a lot nastier than a longer name.

> I certainly take your point about libifc_. Does anyone else have any
> views regarding the naming (or other subjects)?

I second John, dropping the `lib' prefix and going with `ifconfig_' looks
like a good idea.

./danfe
___
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: r304815 - in head: lib lib/libifc share/examples/libifc share/mk

2016-08-25 Thread Eric van Gyzen
On 08/25/2016 15:20, Kristof Provost wrote:
> On 25 Aug 2016, at 22:14, John Baldwin wrote:
>> On Thursday, August 25, 2016 07:40:25 PM Kristof Provost wrote:
>>> Author: kp
>>> Date: Thu Aug 25 19:40:25 2016
>>> New Revision: 304815
>>> URL: https://svnweb.freebsd.org/changeset/base/304815
>>>
>>> Log:
>>>   Add libifc, a library implementing core functionality that exists
>>> in ifconfig(8) today.
>>>
>>>   libifc (pronounced lib-ifconfig) aims to be a light abstraction
>>> layer between
>>>   programs and the kernel APIs for managing the network configuration.
>>>   This should hopefully make programs easier to maintain, and reduce
>>> code
>>>   duplication.
>>>
>>>   Work will begin on making ifconfig(8) use this library in the near
>>> future.
>>>
>>>   This code is still evolving. The interface should not be considered
>>> stable until
>>>   it is announced as such.
>>
>> I hate even writing this mail, and it looks like the topic wasn't really
>> discussed in the review, but I think libifconfig is probably the "better"
>> name if the goal is to move most of ifconfig into it.  Certainly if a
>> developer is looking for a library that provides a programmatic interface
>> to the same operations a user does via ifconfig, libifconfig is the name
>> they will look for first.
>>
>> One thing I did see in the review is that the APIs use 'ifc_*' and
>> that was
>> the reason given for renaming the library.  If you really want those
>> to be
>> in sync, I actually think the longer 'ifconfig_*' prefix isn't that
>> terrible.
>> We have other libraries that use similar length names and namespace
>> prefixes
>> already (libarchive, libdevctl, libdevinfo, libpthread).
>>
>> Hmm, it seems you are 'libifc_*'.  Most of our libraries do not include
>> 'lib' in the namespace prefix (see above examples that all use the
>> name of
>> the library without 'lib' as the prefix).  If nothing else I'd suggest
>> dropping 'lib' to be consistent with most other libraries in the tree.
> 
> This is the right time to bring this sort of thing up. One of the reasons
> I pushed to get this in the tree in this very early state was to provoke
> exactly this sort of response. Right now the work is still in an early
> state
> and changing this sort of thing is still possible.
> 
> The name was in fact discussed privately, and we figured libifconfig was
> a bit
> on the long side.
> 
> I certainly take your point about libifc_. Does anyone else have any
> views regarding
> the naming (or other subjects)?

I'm on the same page as John about the naming:  The library should be
libifconfig, and the functions should begin with "ifconfig_".

Thanks for this contribution, Marie.  I've wanted it many times in the past.

Eric
___
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: r304815 - in head: lib lib/libifc share/examples/libifc share/mk

2016-08-25 Thread Mariusz Zaborski
Some inline comments :)

Cheers,
Mariusz

[...]
> +libifc_handle_t *
> +libifc_open(void)
> +{
> +   struct libifc_handle *h;
> +
> +   h = calloc(1, sizeof(struct libifc_handle));
This can fail, and we are using NULL references.

> +
> +   for (int i = 0; i <= AF_MAX; i++) {
> +   h->sockets[i] = -1;
> +   }
> +
> +   return (h);
> +}
> +
> +
> +void
> +libifc_close(libifc_handle_t *h)
> +{
Missing blank line.
> +   for (int i = 0; i <= AF_MAX; i++) {
> +   if (h->sockets[i] != -1) {
> +   (void)close(h->sockets[i]);
> +   }
> +   }
> +   free(h);
> +}
[...]
> +int
> +libifc_get_description(libifc_handle_t *h, const char *name, char 
> **description)
> +{
> +   struct ifreq ifr;
> +   char *descr = NULL;
> +   size_t descrlen = 64;
> +
> +   memset(, 0, sizeof(struct ifreq));
> +   (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
> +   for (;;) {
> +   if ((descr = reallocf(descr, descrlen)) == NULL) {
> +   h->error.errtype = OTHER;
> +   h->error.errcode = ENOMEM;
> +   return (-1);
> +   }
> +
> +   ifr.ifr_buffer.buffer = descr;
> +   ifr.ifr_buffer.length = descrlen;
> +   if (libifc_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR,
> +   ) != 0) {
> +   return (-1);
> +   }
> +
> +   if (ifr.ifr_buffer.buffer == descr) {
> +   if (strlen(descr) > 0) {
> +   *description = strdup(descr);
This can fail.
> +   free(descr);
> +   return (0);
> +   }
> +   } else if (ifr.ifr_buffer.length > descrlen) {
> +   descrlen = ifr.ifr_buffer.length;
> +   continue;
> +   }
> +   break;
> +   }
> +   free(descr);
> +   h->error.errtype = OTHER;
> +   h->error.errcode = 0;
> +   return (-1);
> +}
> +
> +
[..]

All function bellow has wrong prototypes.

> +int libifc_unset_description(libifc_handle_t *h, const char *name)
> +{
> +   struct ifreq ifr;
> +
> +   memset(, 0, sizeof(struct ifreq));
> +   (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
> +   ifr.ifr_buffer.length = 0;
> +   ifr.ifr_buffer.buffer = NULL;
> +
> +   if (libifc_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, ) < 0) {
> +   return (-1);
> +   }
> +   return (0);
> +}
> +
> +
> +int libifc_set_name(libifc_handle_t *h, const char *name, const char 
> *newname)
> +{
> +   struct ifreq ifr;
> +   char *tmpname;
> +
> +   memset(, 0, sizeof(struct ifreq));
> +   tmpname = strdup(newname);
> +   if (tmpname == NULL) {
> +   h->error.errtype = OTHER;
> +   h->error.errcode = ENOMEM;
> +   return (-1);
> +   }
> +
> +   (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
> +   ifr.ifr_data = tmpname;
> +
> +   if (libifc_ioctlwrap(h, AF_LOCAL, SIOCSIFNAME, ) != 0) {
> +   free(tmpname);
> +   return (-1);
> +   }
> +   free(tmpname);
> +   return (0);
> +}
> +
> +
> +int libifc_set_mtu(libifc_handle_t *h, const char *name, const int mtu)
> +{
> +   struct ifreq ifr;
> +
> +   memset(, 0, sizeof(struct ifreq));
> +   (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
> +   ifr.ifr_mtu = mtu;
> +   if (libifc_ioctlwrap(h, AF_LOCAL, SIOCSIFMTU, ) < 0) {
> +   return (-1);
> +   }
> +   return (0);
> +}
> +
> +
> +int libifc_get_mtu(libifc_handle_t *h, const char *name, int *mtu)
> +{
> +   struct ifreq ifr;
> +
> +   memset(, 0, sizeof(struct ifreq));
> +   (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
> +   if (libifc_ioctlwrap(h, AF_LOCAL, SIOCGIFMTU, ) == -1) {
> +   return (-1);
> +   }
> +   *mtu = ifr.ifr_mtu;
> +   return (0);
> +}
> +
> +
> +int libifc_set_metric(libifc_handle_t *h, const char *name, const int mtu)
> +{
> +   struct ifreq ifr;
> +
> +   memset(, 0, sizeof(struct ifreq));
> +   (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
> +   ifr.ifr_mtu = mtu;
> +   if (libifc_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, ) < 0) {
> +   return (-1);
> +   }
> +   return (0);
> +}
> +
> +
> +int libifc_get_metric(libifc_handle_t *h, const char *name, int *metric)
> +{
> +   struct ifreq ifr;
> +
> +   memset(, 0, sizeof(struct ifreq));
> +   (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
> +   if (libifc_ioctlwrap(h, AF_LOCAL, SIOCGIFMETRIC, ) == -1) {
> +   return (-1);
> +   }
> +   *metric = ifr.ifr_metric;
> +   return (0);
> +}
> +
> +
> +int libifc_set_capability(libifc_handle_t *h, const char *name,

Re: svn commit: r304815 - in head: lib lib/libifc share/examples/libifc share/mk

2016-08-25 Thread Kristof Provost

On 25 Aug 2016, at 22:14, John Baldwin wrote:

On Thursday, August 25, 2016 07:40:25 PM Kristof Provost wrote:

Author: kp
Date: Thu Aug 25 19:40:25 2016
New Revision: 304815
URL: https://svnweb.freebsd.org/changeset/base/304815

Log:
  Add libifc, a library implementing core functionality that exists 
in ifconfig(8) today.


  libifc (pronounced lib-ifconfig) aims to be a light abstraction 
layer between
  programs and the kernel APIs for managing the network 
configuration.
  This should hopefully make programs easier to maintain, and reduce 
code

  duplication.

  Work will begin on making ifconfig(8) use this library in the near 
future.


  This code is still evolving. The interface should not be considered 
stable until

  it is announced as such.


I hate even writing this mail, and it looks like the topic wasn't 
really
discussed in the review, but I think libifconfig is probably the 
"better"

name if the goal is to move most of ifconfig into it.  Certainly if a
developer is looking for a library that provides a programmatic 
interface
to the same operations a user does via ifconfig, libifconfig is the 
name

they will look for first.

One thing I did see in the review is that the APIs use 'ifc_*' and 
that was
the reason given for renaming the library.  If you really want those 
to be
in sync, I actually think the longer 'ifconfig_*' prefix isn't that 
terrible.
We have other libraries that use similar length names and namespace 
prefixes

already (libarchive, libdevctl, libdevinfo, libpthread).

Hmm, it seems you are 'libifc_*'.  Most of our libraries do not 
include
'lib' in the namespace prefix (see above examples that all use the 
name of

the library without 'lib' as the prefix).  If nothing else I'd suggest
dropping 'lib' to be consistent with most other libraries in the tree.


This is the right time to bring this sort of thing up. One of the 
reasons

I pushed to get this in the tree in this very early state was to provoke
exactly this sort of response. Right now the work is still in an early 
state

and changing this sort of thing is still possible.

The name was in fact discussed privately, and we figured libifconfig was 
a bit

on the long side.

I certainly take your point about libifc_. Does anyone else have any 
views regarding

the naming (or other subjects)?

Regards,
Kristof
___
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: r304815 - in head: lib lib/libifc share/examples/libifc share/mk

2016-08-25 Thread John Baldwin
On Thursday, August 25, 2016 07:40:25 PM Kristof Provost wrote:
> Author: kp
> Date: Thu Aug 25 19:40:25 2016
> New Revision: 304815
> URL: https://svnweb.freebsd.org/changeset/base/304815
> 
> Log:
>   Add libifc, a library implementing core functionality that exists in 
> ifconfig(8) today.
>   
>   libifc (pronounced lib-ifconfig) aims to be a light abstraction layer 
> between
>   programs and the kernel APIs for managing the network configuration.
>   This should hopefully make programs easier to maintain, and reduce code
>   duplication.
>   
>   Work will begin on making ifconfig(8) use this library in the near future.
>   
>   This code is still evolving. The interface should not be considered stable 
> until
>   it is announced as such.

I hate even writing this mail, and it looks like the topic wasn't really
discussed in the review, but I think libifconfig is probably the "better"
name if the goal is to move most of ifconfig into it.  Certainly if a
developer is looking for a library that provides a programmatic interface
to the same operations a user does via ifconfig, libifconfig is the name
they will look for first.

One thing I did see in the review is that the APIs use 'ifc_*' and that was
the reason given for renaming the library.  If you really want those to be
in sync, I actually think the longer 'ifconfig_*' prefix isn't that terrible.
We have other libraries that use similar length names and namespace prefixes
already (libarchive, libdevctl, libdevinfo, libpthread).

Hmm, it seems you are 'libifc_*'.  Most of our libraries do not include
'lib' in the namespace prefix (see above examples that all use the name of
the library without 'lib' as the prefix).  If nothing else I'd suggest
dropping 'lib' to be consistent with most other libraries in the tree.

-- 
John Baldwin
___
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: r304816 - stable/10/lib/libc/stdio

2016-08-25 Thread Andrey A. Chernov
Author: ache
Date: Thu Aug 25 19:55:31 2016
New Revision: 304816
URL: https://svnweb.freebsd.org/changeset/base/304816

Log:
  MFC r295632
  
  getln: We cannot expand the buffer beyond INT_MAX (_size overflows).
  
  In such cases return ENOMEM. This is a limitation of our
  implementation, alternatively you may consider getline(3).
  
  Differential Revision:  https://reviews.freebsd.org/D442 (Partial)
  Obtained from:  Apple Inc. (Libc 997.90.3)

Modified:
  stable/10/lib/libc/stdio/fgetln.3
  stable/10/lib/libc/stdio/fgetln.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/stdio/fgetln.3
==
--- stable/10/lib/libc/stdio/fgetln.3   Thu Aug 25 19:40:25 2016
(r304815)
+++ stable/10/lib/libc/stdio/fgetln.3   Thu Aug 25 19:55:31 2016
(r304816)
@@ -28,7 +28,7 @@
 .\" @(#)fgetln.3   8.3 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\"
-.Dd April 19, 1994
+.Dd February 15, 2016
 .Dt FGETLN 3
 .Os
 .Sh NAME
@@ -97,6 +97,9 @@ These changes are lost as soon as the po
 The argument
 .Fa stream
 is not a stream open for reading.
+.It Bq Er ENOMEM
+The internal line buffer could not be expanded due to lack of available memory,
+or because it would need to expand beyond INT_MAX in size.
 .El
 .Pp
 The

Modified: stable/10/lib/libc/stdio/fgetln.c
==
--- stable/10/lib/libc/stdio/fgetln.c   Thu Aug 25 19:40:25 2016
(r304815)
+++ stable/10/lib/libc/stdio/fgetln.c   Thu Aug 25 19:55:31 2016
(r304816)
@@ -37,6 +37,8 @@ static char sccsid[] = "@(#)fgetln.c  8.2
 __FBSDID("$FreeBSD$");
 
 #include "namespace.h"
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -61,6 +63,10 @@ __slbexpand(FILE *fp, size_t newsize)
 #endif
if (fp->_lb._size >= newsize)
return (0);
+   if (newsize > INT_MAX) {
+   errno = ENOMEM;
+   return (-1);
+   }
if ((p = realloc(fp->_lb._base, newsize)) == NULL)
return (-1);
fp->_lb._base = p;
@@ -152,7 +158,7 @@ fgetln(FILE *fp, size_t *lenp)
}
*lenp = len;
 #ifdef notdef
-   fp->_lb._base[len] = 0;
+   fp->_lb._base[len] = '\0';
 #endif
FUNLOCKFILE(fp);
return ((char *)fp->_lb._base);
___
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: r304815 - in head: lib lib/libifc share/examples/libifc share/mk

2016-08-25 Thread Kristof Provost
Author: kp
Date: Thu Aug 25 19:40:25 2016
New Revision: 304815
URL: https://svnweb.freebsd.org/changeset/base/304815

Log:
  Add libifc, a library implementing core functionality that exists in 
ifconfig(8) today.
  
  libifc (pronounced lib-ifconfig) aims to be a light abstraction layer between
  programs and the kernel APIs for managing the network configuration.
  This should hopefully make programs easier to maintain, and reduce code
  duplication.
  
  Work will begin on making ifconfig(8) use this library in the near future.
  
  This code is still evolving. The interface should not be considered stable 
until
  it is announced as such.
  
  Submitted By: Marie Helene Kvello-Aune 
  Reviewed By: kp
  Differential Revision: https://reviews.freebsd.org/D7529

Added:
  head/lib/libifc/
  head/lib/libifc/Makefile   (contents, props changed)
  head/lib/libifc/libifc.c   (contents, props changed)
  head/lib/libifc/libifc.h   (contents, props changed)
  head/lib/libifc/libifc_internal.c   (contents, props changed)
  head/lib/libifc/libifc_internal.h   (contents, props changed)
  head/share/examples/libifc/
  head/share/examples/libifc/Makefile   (contents, props changed)
  head/share/examples/libifc/ifcreate.c   (contents, props changed)
  head/share/examples/libifc/ifdestroy.c   (contents, props changed)
  head/share/examples/libifc/setdescription.c   (contents, props changed)
  head/share/examples/libifc/setmtu.c   (contents, props changed)
Modified:
  head/lib/Makefile
  head/share/mk/bsd.libnames.mk
  head/share/mk/src.libnames.mk

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Thu Aug 25 19:36:58 2016(r304814)
+++ head/lib/Makefile   Thu Aug 25 19:40:25 2016(r304815)
@@ -60,6 +60,7 @@ SUBDIR=   ${SUBDIR_BOOTSTRAP} \
${_libgssapi} \
${_librpcsec_gss} \
${_libiconv_modules} \
+   libifc \
libipsec \
libjail \
libkiconv \

Added: head/lib/libifc/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libifc/MakefileThu Aug 25 19:40:25 2016(r304815)
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+PACKAGE=   lib${LIB}
+LIB=   ifc
+# Don't build shared library, for now.
+NO_PIC= 
+
+SHLIBDIR?= /lib
+SHLIB_MAJOR=   1
+SRCS=  libifc.c libifc_internal.c
+
+INCSDIR=   ${INCLUDEDIR}
+INCS=  libifc.h
+
+#MAN=  libifco.3
+
+CFLAGS+= -I${.CURDIR}
+WARNS?=6
+
+.include 

Added: head/lib/libifc/libifc.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libifc/libifc.cThu Aug 25 19:40:25 2016(r304815)
@@ -0,0 +1,397 @@
+/*
+ * Copyright (c) 2016, Marie Helene Kvello-Aune
+ * 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,
+ * thislist 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.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its 
contributors
+ * may be used to endorse or promote products derived from this software 
without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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$
+ */
+
+/*
+ * Copyright (c) 1983, 1993
+ *  The Regents of the University of California.  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 

svn commit: r304814 - in head: bin/dd sbin/ggate/ggatec sbin/ggate/ggated usr.sbin/cdcontrol usr.sbin/pc-sysinstall/backend

2016-08-25 Thread Alex Kozlov
Author: ak (ports committer)
Date: Thu Aug 25 19:36:58 2016
New Revision: 304814
URL: https://svnweb.freebsd.org/changeset/base/304814

Log:
  Remove last remnants of acd(4), mcd(4), and scd(4) drivers.
  
  Approved by:  jhb

Modified:
  head/bin/dd/dd.1
  head/sbin/ggate/ggatec/ggatec.8
  head/sbin/ggate/ggated/ggated.8
  head/usr.sbin/cdcontrol/cdcontrol.1
  head/usr.sbin/cdcontrol/cdcontrol.c
  head/usr.sbin/pc-sysinstall/backend/functions-mountoptical.sh

Modified: head/bin/dd/dd.1
==
--- head/bin/dd/dd.1Thu Aug 25 19:17:16 2016(r304813)
+++ head/bin/dd/dd.1Thu Aug 25 19:36:58 2016(r304814)
@@ -32,7 +32,7 @@
 .\" @(#)dd.1   8.2 (Berkeley) 1/13/94
 .\" $FreeBSD$
 .\"
-.Dd February 28, 2016
+.Dd August 25, 2016
 .Dt DD 1
 .Os
 .Sh NAME
@@ -414,7 +414,7 @@ Check for (even) parity errors on a file
 To create an image of a Mode-1 CD-ROM, which is a commonly used format
 for data CD-ROM disks, use a block size of 2048 bytes:
 .Pp
-.Dl "dd if=/dev/acd0 of=filename.iso bs=2048"
+.Dl "dd if=/dev/cd0 of=filename.iso bs=2048"
 .Pp
 Write a filesystem image to a memory stick, padding the end with zeros,
 if necessary, to a 1MiB boundary:

Modified: head/sbin/ggate/ggatec/ggatec.8
==
--- head/sbin/ggate/ggatec/ggatec.8 Thu Aug 25 19:17:16 2016
(r304813)
+++ head/sbin/ggate/ggatec/ggatec.8 Thu Aug 25 19:36:58 2016
(r304814)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 14, 2015
+.Dd August 25, 2016
 .Dt GGATEC 8
 .Os
 .Sh NAME
@@ -161,10 +161,10 @@ option.
 Use a CD-ROM device on a remote host.
 .Bd -literal -offset indent
 server# cat /etc/gg.exports
-client RO /dev/acd0
+client RO /dev/cd0
 server# ggated
 
-client# ggatec create -o ro server /dev/acd0
+client# ggatec create -o ro server /dev/cd0
 ggate0
 client# mount_cd9660 /dev/ggate0 /cdrom
 .Ed

Modified: head/sbin/ggate/ggated/ggated.8
==
--- head/sbin/ggate/ggated/ggated.8 Thu Aug 25 19:17:16 2016
(r304813)
+++ head/sbin/ggate/ggated/ggated.8 Thu Aug 25 19:36:58 2016
(r304814)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 27, 2016
+.Dd August 25, 2016
 .Dt GGATED 8
 .Os
 .Sh NAME
@@ -87,7 +87,7 @@ An alternate location for the exports fi
 .Pp
 The format of an exports file is as follows:
 .Bd -literal -offset indent
-1.2.3.4RO  /dev/acd0
+1.2.3.4RO  /dev/cd0
 1.2.3.0/24 RW  /tmp/test.img
 hostname   WO  /tmp/image
 .Ed
@@ -108,7 +108,7 @@ option.
 .Sh EXAMPLES
 Export CD-ROM device and a file:
 .Bd -literal -offset indent
-# echo "1.2.3.0/24 RO /dev/acd0" > /etc/gg.exports
+# echo "1.2.3.0/24 RO /dev/cd0" > /etc/gg.exports
 # echo "client RW /image" >> /etc/gg.exports
 # ggated
 .Ed

Modified: head/usr.sbin/cdcontrol/cdcontrol.1
==
--- head/usr.sbin/cdcontrol/cdcontrol.1 Thu Aug 25 19:17:16 2016
(r304813)
+++ head/usr.sbin/cdcontrol/cdcontrol.1 Thu Aug 25 19:36:58 2016
(r304814)
@@ -1,6 +1,6 @@
 .\" $FreeBSD$
 .\"
-.Dd June 27, 2008
+.Dd August 25, 2016
 .Dt CDCONTROL 1
 .Os
 .Sh NAME
@@ -17,9 +17,7 @@ The
 utility is a program to control audio features of a CD drive.
 The device is a name such
 as
-.Pa cd0
-or
-.Pa acd0 .
+.Pa cd0 .
 .Pp
 If no
 .Ar command
@@ -37,9 +35,7 @@ Verbose mode.
 Print as much information as possible.
 .It Fl f Ar device
 Specify a device, such as
-.Pa /dev/cd0
-or
-.Pa acd0 .
+.Pa /dev/cd0 .
 Both absolute path and relative to
 .Pa /dev
 filename are possible.
@@ -56,9 +52,7 @@ option is specified,
 tries opening first
 .Pa /dev/cdrom ,
 then
-.Pa /dev/cd0 ,
-and finally
-.Pa /dev/acd0 .
+.Pa /dev/cd0 .
 .El
 .Pp
 The available commands are listed below.
@@ -206,10 +200,8 @@ These variables have been deprecated in 
 .Ev CDROM .
 .El
 .Sh FILES
-.Bl -tag -width ".Pa /dev/mcd0" -compact
+.Bl -tag -width ".Pa /dev/cd0" -compact
 .It Pa /dev/cd0
-.It Pa /dev/mcd0
-.It Pa /dev/acd0
 .El
 .Sh HISTORY
 The

Modified: head/usr.sbin/cdcontrol/cdcontrol.c
==
--- head/usr.sbin/cdcontrol/cdcontrol.c Thu Aug 25 19:17:16 2016
(r304813)
+++ head/usr.sbin/cdcontrol/cdcontrol.c Thu Aug 25 19:36:58 2016
(r304814)
@@ -1292,8 +1292,6 @@ open_cd(void)
fd = open(dev = "/dev/cdrom", O_RDONLY);
if (fd < 0 && errno == ENOENT)
fd = open(dev = "/dev/cd0", O_RDONLY);
-   if (fd < 0 && errno == ENOENT)
-   fd = open(dev = "/dev/acd0", O_RDONLY);
}
 
if (fd < 0) {

Modified: head/usr.sbin/pc-sysinstall/backend/functions-mountoptical.sh
==
--- 

svn commit: r304812 - head/sys/kern

2016-08-25 Thread Konstantin Belousov
Author: kib
Date: Thu Aug 25 19:15:02 2016
New Revision: 304812
URL: https://svnweb.freebsd.org/changeset/base/304812

Log:
  In both do_rw_wrlock() and do_rw_rdlock() after r304808, do not
  obliterate possible error from sleep with errors from
  umtxq_check_susp(), when looping to clear URWLOCK_{READ,WRITE}_WAITERS.
  
  Noted and reviewed by:vangyzen
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==
--- head/sys/kern/kern_umtx.c   Thu Aug 25 17:30:00 2016(r304811)
+++ head/sys/kern/kern_umtx.c   Thu Aug 25 19:15:02 2016(r304812)
@@ -2609,7 +2609,7 @@ do_rw_rdlock(struct thread *td, struct u
uint32_t flags, wrflags;
int32_t state, oldstate;
int32_t blocked_readers;
-   int error, rv;
+   int error, error1, rv;
 
uq = td->td_umtxq;
error = fueword32(>rw_flags, );
@@ -2758,9 +2758,12 @@ sleep:
if (oldstate == state)
break;
state = oldstate;
-   error = umtxq_check_susp(td);
-   if (error != 0)
+   error1 = umtxq_check_susp(td);
+   if (error1 != 0) {
+   if (error == 0)
+   error = error1;
break;
+   }
}
}
 
@@ -2783,7 +2786,7 @@ do_rw_wrlock(struct thread *td, struct u
int32_t state, oldstate;
int32_t blocked_writers;
int32_t blocked_readers;
-   int error, rv;
+   int error, error1, rv;
 
uq = td->td_umtxq;
error = fueword32(>rw_flags, );
@@ -2929,14 +2932,17 @@ sleep:
if (oldstate == state)
break;
state = oldstate;
-   error = umtxq_check_susp(td);
+   error1 = umtxq_check_susp(td);
/*
 * We are leaving the URWLOCK_WRITE_WAITERS
 * behind, but this should not harm the
 * correctness.
 */
-   if (error != 0)
+   if (error1 != 0) {
+   if (error == 0)
+   error = error1;
break;
+   }
}
rv = fueword32(>rw_blocked_readers,
_readers);
___
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: r304803 - in head/sys: netinet netinet/cc sys

2016-08-25 Thread hiren panchasara
On 08/25/16 at 01:33P, Lawrence Stewart wrote:
> Author: lstewart
> Date: Thu Aug 25 13:33:32 2016
> New Revision: 304803
> URL: https://svnweb.freebsd.org/changeset/base/304803
> 
> Log:
>   Pass the number of segments coalesced by LRO up the stack by repurposing the
>   tso_segsz pkthdr field during RX processing, and use the information in TCP 
> for
>   more correct accounting and as a congestion control input. This is only a 
> start,
>   and an audit of other uses for the data is left as future work.
>   
>   Reviewed by:gallatin, rrs
>   Sponsored by:   Netflix, Inc.
>   Differential Revision:  https://reviews.freebsd.org/D7564
> 
> Modified:
>   head/sys/netinet/cc/cc.h
>   head/sys/netinet/cc/cc_newreno.c
>   head/sys/netinet/tcp_input.c
>   head/sys/netinet/tcp_lro.c
>   head/sys/netinet/tcp_var.h
>   head/sys/sys/mbuf.h

fastpath module is broken now. You may want to update that.

Also, can this be brought back to stable/11?

Cheers,
Hiren


pgprOHJTO4yN1.pgp
Description: PGP signature


Re: svn commit: r304223 - in head: share/man/man4 share/man/man9 sys/netinet

2016-08-25 Thread hiren panchasara
On 08/16/16 at 03:11P, Randall Stewart wrote:
> Author: rrs
> Date: Tue Aug 16 15:11:46 2016
> New Revision: 304223
> URL: https://svnweb.freebsd.org/changeset/base/304223
> 
> Log:
>   Here we update the  modular tcp to be able to switch to an
>   alternate TCP stack in other then the closed state (pre-listen/connect).
>   The idea is that *if* that is supported by the alternate stack, it
>   is asked if its ok to switch. If it approves the "handoff" then we
>   allow the switch to happen. Also the fini() function now gets a flag
>   to tell if you are switching away *or* the tcb is destroyed. The
>   init() call into the alternate stack is moved to the end so the
>   tcb is more fully formed before the init transpires.
>   
>   Sponsored by:   Netflix Inc.
>   Differential Revision:  D6790
> 
> Modified:
>   head/share/man/man4/tcp.4
>   head/share/man/man9/tcp_functions.9
>   head/sys/netinet/tcp_subr.c
>   head/sys/netinet/tcp_syncache.c
>   head/sys/netinet/tcp_usrreq.c
>   head/sys/netinet/tcp_var.h

Randall,

Is this something we can bring back to stable/11?

Cheers,
Hiren


pgpfIZo4w60De.pgp
Description: PGP signature


Re: svn commit: r303626 - in head/sys: netinet netinet6

2016-08-25 Thread hiren panchasara
On 08/01/16 at 05:02P, Andrew Gallatin wrote:
> Author: gallatin
> Date: Mon Aug  1 17:02:21 2016
> New Revision: 303626
> URL: https://svnweb.freebsd.org/changeset/base/303626
> 
> Log:
>   Rework IPV6 TCP path MTU discovery to match IPv4
>   
>   - Re-write tcp_ctlinput6() to closely mimic the IPv4 tcp_ctlinput()
>   
>   - Now that tcp_ctlinput6() updates t_maxseg, we can allow ip6_output()
> to send TCP packets without looking at the tcp host cache for every
> single transmit.
>   
>   - Make the icmp6 code mimic the IPv4 code & avoid returning
> PRC_HOSTDEAD because it is so expensive.
>   
>   Without these changes in place, every TCP6 pmtu discovery or host
>   unreachable ICMP resulted in a call to in6_pcbnotify() which walks the
>   tcbinfo table with the write lock held.  Because the tcbinfo table is
>   shared between IPv4 and IPv6, this causes huge scalabilty issues on
>   servers with lots of (~100K) TCP connections, to the point where even
>   a small percent of IPv6 traffic had a disproportionate impact on
>   overall throughput.
>   
>   Reviewed by:bz, rrs, ae (all earlier versions), lstewart (in 
> Netflix's tree)
>   Sponsored by:   Netflix
>   Differential Revision:  https://reviews.freebsd.org/D7272

Drew,

What do you think about getting this into stable/11?

Cheers,
Hiren


pgp5U4Pr0CdeU.pgp
Description: PGP signature


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

2016-08-25 Thread hiren panchasara
On 08/02/16 at 06:36P, Sepherosa Ziehau wrote:
> Author: sephe
> Date: Tue Aug  2 06:36:47 2016
> New Revision: 303656
> URL: https://svnweb.freebsd.org/changeset/base/303656
> 
> Log:
>   tcp/lro: Implement hash table for LRO entries.
>   
>   This significantly improves HTTP workload performance and reduces
>   HTTP workload latency.
>   
>   Reviewed by:rrs, gallatin, hps
>   Obtained from:  rrs, gallatin
>   Sponsored by:   Netflix (rrs, gallatin) , Microsoft (sephe)
>   Differential Revision:  https://reviews.freebsd.org/D6689

Hi Sephe,

Can you please MFC this to stable/11?

Cheers,
Hiren


pgpmD7NFOUL82.pgp
Description: PGP signature


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

2016-08-25 Thread hiren panchasara
On 08/05/16 at 09:08P, Sepherosa Ziehau wrote:
> Author: sephe
> Date: Fri Aug  5 09:08:00 2016
> New Revision: 303766
> URL: https://svnweb.freebsd.org/changeset/base/303766
> 
> Log:
>   tcp/lro: If timestamps mismatch or it's a FIN, force flush.
>   
>   This keeps the segments/ACK/FIN delivery order.
>   
>   Before this patch, it was observed: if A sent FIN immediately after
>   an ACK, B would deliver FIN first to the TCP stack, then the ACK.
>   This out-of-order delivery causes one unnecessary ACK sent from B.
>   
>   Reviewed by:gallatin, hps
>   Obtained from:  rrs, gallatin
>   Sponsored by:   Netflix (rrs, gallatin), Microsoft (sephe)
>   Differential Revision:  https://reviews.freebsd.org/D7415

Hi Sephe,

This looks like a good fix for stable/11. Can you please MFC it?

Cheers,
Hiren


pgpYx9gP5N06h.pgp
Description: PGP signature


Re: svn commit: r303988 - head/lib/libc/gen

2016-08-25 Thread Bryan Drewery
On 8/25/16 9:29 AM, Guido Falsi wrote:
> On 08/25/16 18:24, Bryan Drewery wrote:
> --- _bootstrap-tools-usr.bin/xinstall ---
> xinstall.o: In function `install':
> /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall/xinstall.c:(.text+0xf55):
> undefined reference to `basename@FBSD_1.0'
>>
>> readelf -a /lib/libc.so.7|grep basename ?
> 
>> readelf -a /lib/libc.so.7|grep basename
>   2149: 00076200   231 FUNCGLOBAL DEFAULT   11
> basename@@FBSD_1.0 (2)
>   2514: 00076140   184 FUNCGLOBAL DEFAULT   11
> basename_r@@FBSD_1.2 (4)
> 
> 

Hmm, I do run into the same issue with 'buildworld'.  It builds fine
directly though.

Debugging it more here.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r304811 - head/lib/libc/stdio

2016-08-25 Thread Andrey A. Chernov
Author: ache
Date: Thu Aug 25 17:30:00 2016
New Revision: 304811
URL: https://svnweb.freebsd.org/changeset/base/304811

Log:
  Remove "Fast path", it bypass __wcrtomb() and all its error checking.
  One of affected encoding example: US-ASCII
  
  MFC after:  7 days

Modified:
  head/lib/libc/stdio/fputwc.c

Modified: head/lib/libc/stdio/fputwc.c
==
--- head/lib/libc/stdio/fputwc.cThu Aug 25 17:13:04 2016
(r304810)
+++ head/lib/libc/stdio/fputwc.cThu Aug 25 17:30:00 2016
(r304811)
@@ -53,19 +53,9 @@ __fputwc(wchar_t wc, FILE *fp, locale_t 
size_t i, len;
struct xlocale_ctype *l = XLOCALE_CTYPE(locale);
 
-   if (MB_CUR_MAX == 1 && wc > 0 && wc <= UCHAR_MAX) {
-   /*
-* Assume single-byte locale with no special encoding.
-* A more careful test would be to check
-* _CurrentRuneLocale->encoding.
-*/
-   *buf = (unsigned char)wc;
-   len = 1;
-   } else {
-   if ((len = l->__wcrtomb(buf, wc, >_mbstate)) == (size_t)-1) 
{
-   fp->_flags |= __SERR;
-   return (WEOF);
-   }
+   if ((len = l->__wcrtomb(buf, wc, >_mbstate)) == (size_t)-1) {
+   fp->_flags |= __SERR;
+   return (WEOF);
}
 
for (i = 0; i < len; i++)
___
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: r304810 - head/lib/libc/stdio

2016-08-25 Thread Andrey A. Chernov
Author: ache
Date: Thu Aug 25 17:13:04 2016
New Revision: 304810
URL: https://svnweb.freebsd.org/changeset/base/304810

Log:
  Don't check for __SERR which may stick from one of any previous stdio
  functions.
  __SERR is for user and the rest of stdio code do not check it
  for error sensing internally, only set it.
  In vf(w)printf.c here it is more easy to save __SERR, clear and restore it.

Modified:
  head/lib/libc/stdio/getdelim.c
  head/lib/libc/stdio/vfprintf.c
  head/lib/libc/stdio/vfwprintf.c

Modified: head/lib/libc/stdio/getdelim.c
==
--- head/lib/libc/stdio/getdelim.c  Thu Aug 25 17:07:43 2016
(r304809)
+++ head/lib/libc/stdio/getdelim.c  Thu Aug 25 17:13:04 2016
(r304810)
@@ -125,7 +125,7 @@ getdelim(char ** __restrict linep, size_
 
if (fp->_r <= 0 && __srefill(fp)) {
/* If fp is at EOF already, we just need space for the NUL. */
-   if (__sferror(fp) || expandtofit(linep, 1, linecapp))
+   if (!__sfeof(fp) || expandtofit(linep, 1, linecapp))
goto error;
FUNLOCKFILE(fp);
(*linep)[0] = '\0';
@@ -137,7 +137,7 @@ getdelim(char ** __restrict linep, size_
if (sappend(linep, , linecapp, fp->_p, fp->_r))
goto error;
if (__srefill(fp)) {
-   if (__sferror(fp))
+   if (!__sfeof(fp))
goto error;
goto done;  /* hit EOF */
}

Modified: head/lib/libc/stdio/vfprintf.c
==
--- head/lib/libc/stdio/vfprintf.c  Thu Aug 25 17:07:43 2016
(r304809)
+++ head/lib/libc/stdio/vfprintf.c  Thu Aug 25 17:13:04 2016
(r304810)
@@ -364,6 +364,7 @@ __vfprintf(FILE *fp, locale_t locale, co
int nextarg;/* 1-based argument index */
va_list orgap;  /* original argument pointer */
char *convbuf;  /* wide to multibyte conversion result */
+   int savserr;
 
static const char xdigs_lower[16] = "0123456789abcdef";
static const char xdigs_upper[16] = "0123456789ABCDEF";
@@ -460,6 +461,9 @@ __vfprintf(FILE *fp, locale_t locale, co
return (EOF);
}
 
+   savserr = fp->_flags & __SERR;
+   fp->_flags &= ~__SERR;
+
convbuf = NULL;
fmt = (char *)fmt0;
argtable = NULL;
@@ -1031,6 +1035,8 @@ error:
free(convbuf);
if (__sferror(fp))
ret = EOF;
+   else
+   fp->_flags |= savserr;
if ((argtable != NULL) && (argtable != statargtable))
free (argtable);
return (ret);

Modified: head/lib/libc/stdio/vfwprintf.c
==
--- head/lib/libc/stdio/vfwprintf.c Thu Aug 25 17:07:43 2016
(r304809)
+++ head/lib/libc/stdio/vfwprintf.c Thu Aug 25 17:13:04 2016
(r304810)
@@ -444,6 +444,7 @@ __vfwprintf(FILE *fp, locale_t locale, c
int nextarg;/* 1-based argument index */
va_list orgap;  /* original argument pointer */
wchar_t *convbuf;   /* multibyte to wide conversion result */
+   int savserr;
 
static const char xdigs_lower[16] = "0123456789abcdef";
static const char xdigs_upper[16] = "0123456789ABCDEF";
@@ -536,6 +537,9 @@ __vfwprintf(FILE *fp, locale_t locale, c
return (EOF);
}
 
+   savserr = fp->_flags & __SERR;
+   fp->_flags &= ~__SERR;
+
convbuf = NULL;
fmt = (wchar_t *)fmt0;
argtable = NULL;
@@ -1096,6 +1100,8 @@ error:
free(convbuf);
if (__sferror(fp))
ret = EOF;
+   else
+   fp->_flags |= savserr;
if ((argtable != NULL) && (argtable != statargtable))
free (argtable);
return (ret);
___
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: r304809 - head/usr.bin/getconf

2016-08-25 Thread Garrett Cooper
Author: ngie
Date: Thu Aug 25 17:07:43 2016
New Revision: 304809
URL: https://svnweb.freebsd.org/changeset/base/304809

Log:
  Add non-TRUSTEDBSD prefixed knobs for the _PC_ACL* and {CAP,INF,MAC}_PRESENT 
knobs
  
  It's not necessarily intuitive that the variables to query contain TRUSTEDBSD
  in the prefix. Add non-TRUSTEDBSD prefixed knobs for querying things like
  "_PC_ACL_NFS4".
  
  MFC after:1 week
  Relnotes: yes
  Reviewed by:  wollman
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D7618

Modified:
  head/usr.bin/getconf/pathconf.gperf

Modified: head/usr.bin/getconf/pathconf.gperf
==
--- head/usr.bin/getconf/pathconf.gperf Thu Aug 25 16:35:42 2016
(r304808)
+++ head/usr.bin/getconf/pathconf.gperf Thu Aug 25 17:07:43 2016
(r304809)
@@ -20,8 +20,14 @@ static const struct map *in_word_set(con
 %}
 struct map { const char *name; int key; int valid; };
 %%
+ACL_EXTENDED, _PC_ACL_EXTENDED
+ACL_NFS4, _PC_ACL_NFS4
+ACL_PATH_MAX, _PC_ACL_PATH_MAX
+CAP_PRESENT, _PC_CAP_PRESENT
 FILESIZEBITS, _PC_FILESIZEBITS
+INF_PRESENT, _PC_INF_PRESENT
 LINK_MAX, _PC_LINK_MAX
+MAC_PRESENT, _PC_MAC_PRESENT
 MAX_CANON, _PC_MAX_CANON
 MAX_INPUT, _PC_MAX_INPUT
 MIN_HOLE_SIZE, _PC_MIN_HOLE_SIZE
___
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: r304808 - head/sys/kern

2016-08-25 Thread Konstantin Belousov
Author: kib
Date: Thu Aug 25 16:35:42 2016
New Revision: 304808
URL: https://svnweb.freebsd.org/changeset/base/304808

Log:
  Prevent leak of URWLOCK_READ_WAITERS flag for urwlocks.
  
  If there was some error, e.g. the sleep was interrupted, as in the
  referenced PR, do_rw_rdlock() did not cleared URWLOCK_READ_WAITERS.
  Since unlock only wakes up write waiters when there is no read
  waiters, for URWLOCK_PREFER_READER kind of locks, the result was
  missed wakeups for writers.
  
  In particular, the most visible victims are ld-elf.so locks in
  processes which loaded libthr, because rtld locks are urwlocks in
  prefer-reader mode.  Normal rwlocks fall into prefer-reader mode only
  if thread already owns rw lock in read mode, which is not typical and
  correspondingly less visible.  In the PR, unowned rtld bind lock was
  waited for in the process where only one thread was left alive.
  
  Note that do_rw_wrlock() correctly clears URWLOCK_WRITE_WAITERS in
  case of errors.
  
  Reported and tested by:   longw...@incore.de
  PR:   211947
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==
--- head/sys/kern/kern_umtx.c   Thu Aug 25 15:08:33 2016(r304807)
+++ head/sys/kern/kern_umtx.c   Thu Aug 25 16:35:42 2016(r304808)
@@ -2743,9 +2743,12 @@ sleep:
suword32(>rw_blocked_readers, blocked_readers-1);
if (blocked_readers == 1) {
rv = fueword32(>rw_state, );
-   if (rv == -1)
+   if (rv == -1) {
+   umtxq_unbusy_unlocked(>uq_key);
error = EFAULT;
-   while (error == 0) {
+   break;
+   }
+   for (;;) {
rv = casueword32(>rw_state, state,
, state & ~URWLOCK_READ_WAITERS);
if (rv == -1) {
@@ -2756,6 +2759,8 @@ sleep:
break;
state = oldstate;
error = umtxq_check_susp(td);
+   if (error != 0)
+   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"


Re: svn commit: r303988 - head/lib/libc/gen

2016-08-25 Thread Guido Falsi
On 08/25/16 18:24, Bryan Drewery wrote:
 --- _bootstrap-tools-usr.bin/xinstall ---
 xinstall.o: In function `install':
 /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall/xinstall.c:(.text+0xf55):
 undefined reference to `basename@FBSD_1.0'
> 
> readelf -a /lib/libc.so.7|grep basename ?

> readelf -a /lib/libc.so.7|grep basename
  2149: 00076200   231 FUNCGLOBAL DEFAULT   11
basename@@FBSD_1.0 (2)
  2514: 00076140   184 FUNCGLOBAL DEFAULT   11
basename_r@@FBSD_1.2 (4)


-- 
Guido Falsi 
___
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: r303988 - head/lib/libc/gen

2016-08-25 Thread Bryan Drewery
On 8/25/16 9:17 AM, Guido Falsi wrote:
> On 08/25/16 18:05, Bryan Drewery wrote:
>> On 8/25/16 1:27 AM, Guido Falsi wrote:
>>> On 08/24/16 21:49, Ed Schouten wrote:
 2016-08-24 20:30 GMT+02:00 Bryan Drewery :
> That would only fix stable/11, stable/10, stable/9, releng/11.0.
>
> It won't fix releng/10.3, releng/10.2, releng/10.1, releng/9.3, etc...
> without an EN.
>
> It won't fix stable/11 - 1, stable/10 - 1, etc.
>
> It will never fix releng/8.4 (unsupported releases) since so@ won't EN
> to those.  People do sometimes need to build these older releases still.
>
> It creates a line in the sand where we can never build checkouts older
> than where the fix was at.  So I don't think it is the appropriate fix.

 Good point!

 Just for the record: Bryan and I just discussed this matter in more
 detail on IRC. We came up with a workaround that should be pretty
 good.

 Attached is a patch for  that adds some extra logic, so that
 any calls to basename() and dirname() will expand to calls to
 __old_basename() and __old_dirname(). Using __sym_compat(), these will
 cause the compiler to generate calls to basename@FBSD_1.0 and
 dirname@FBSD_1.0.

 According to Bryan, this fixes the problems he was experiencing.

>>>
>>> I just tried using the attached patch to build a nanobsd image, host is
>>> amd64 head at r304773 with this patch applied, target is i386
>>> releng/11.0 at r304729.
>>>
>>
>> What did you apply the patch to?
>>
>> You need to apply to the source tree, then do a buildworld/installworld
>> for the host, then try nanobsd.
> 
> I did apply it to the source tree of the host machine, and did not apply
> it to the nanobsd sources.
> 
> The error message is very different from the previous one and involves
> symbol versioning.
> 
>>
>>> I've got it failing early during build:
>>>
>>> --- _bootstrap-tools-usr.bin/xinstall ---
>>> xinstall.o: In function `install':
>>> /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall/xinstall.c:(.text+0xf55):
>>> undefined reference to `basename@FBSD_1.0'

readelf -a /lib/libc.so.7|grep basename ?

>>> cc: error: linker command failed with exit code 1 (use -v to see invocation)
>>> *** [xinstall] Error code 1
>>>
>>> make[3]: stopped in /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall
>>> 1 error
>>>
>>> make[3]: stopped in /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall
>>> *** [_bootstrap-tools-usr.bin/xinstall] Error code 2
>>>
>>> Did I miss some needed procedure?
>>>
>>> Thanks!
>>>
>>
>>
> 
> 


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r303988 - head/lib/libc/gen

2016-08-25 Thread Guido Falsi
On 08/25/16 18:05, Bryan Drewery wrote:
> On 8/25/16 1:27 AM, Guido Falsi wrote:
>> On 08/24/16 21:49, Ed Schouten wrote:
>>> 2016-08-24 20:30 GMT+02:00 Bryan Drewery :
 That would only fix stable/11, stable/10, stable/9, releng/11.0.

 It won't fix releng/10.3, releng/10.2, releng/10.1, releng/9.3, etc...
 without an EN.

 It won't fix stable/11 - 1, stable/10 - 1, etc.

 It will never fix releng/8.4 (unsupported releases) since so@ won't EN
 to those.  People do sometimes need to build these older releases still.

 It creates a line in the sand where we can never build checkouts older
 than where the fix was at.  So I don't think it is the appropriate fix.
>>>
>>> Good point!
>>>
>>> Just for the record: Bryan and I just discussed this matter in more
>>> detail on IRC. We came up with a workaround that should be pretty
>>> good.
>>>
>>> Attached is a patch for  that adds some extra logic, so that
>>> any calls to basename() and dirname() will expand to calls to
>>> __old_basename() and __old_dirname(). Using __sym_compat(), these will
>>> cause the compiler to generate calls to basename@FBSD_1.0 and
>>> dirname@FBSD_1.0.
>>>
>>> According to Bryan, this fixes the problems he was experiencing.
>>>
>>
>> I just tried using the attached patch to build a nanobsd image, host is
>> amd64 head at r304773 with this patch applied, target is i386
>> releng/11.0 at r304729.
>>
> 
> What did you apply the patch to?
> 
> You need to apply to the source tree, then do a buildworld/installworld
> for the host, then try nanobsd.

I did apply it to the source tree of the host machine, and did not apply
it to the nanobsd sources.

The error message is very different from the previous one and involves
symbol versioning.

> 
>> I've got it failing early during build:
>>
>> --- _bootstrap-tools-usr.bin/xinstall ---
>> xinstall.o: In function `install':
>> /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall/xinstall.c:(.text+0xf55):
>> undefined reference to `basename@FBSD_1.0'
>> cc: error: linker command failed with exit code 1 (use -v to see invocation)
>> *** [xinstall] Error code 1
>>
>> make[3]: stopped in /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall
>> 1 error
>>
>> make[3]: stopped in /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall
>> *** [_bootstrap-tools-usr.bin/xinstall] Error code 2
>>
>> Did I miss some needed procedure?
>>
>> Thanks!
>>
> 
> 


-- 
Guido Falsi 



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r303988 - head/lib/libc/gen

2016-08-25 Thread Bryan Drewery
On 8/25/16 1:27 AM, Guido Falsi wrote:
> On 08/24/16 21:49, Ed Schouten wrote:
>> 2016-08-24 20:30 GMT+02:00 Bryan Drewery :
>>> That would only fix stable/11, stable/10, stable/9, releng/11.0.
>>>
>>> It won't fix releng/10.3, releng/10.2, releng/10.1, releng/9.3, etc...
>>> without an EN.
>>>
>>> It won't fix stable/11 - 1, stable/10 - 1, etc.
>>>
>>> It will never fix releng/8.4 (unsupported releases) since so@ won't EN
>>> to those.  People do sometimes need to build these older releases still.
>>>
>>> It creates a line in the sand where we can never build checkouts older
>>> than where the fix was at.  So I don't think it is the appropriate fix.
>>
>> Good point!
>>
>> Just for the record: Bryan and I just discussed this matter in more
>> detail on IRC. We came up with a workaround that should be pretty
>> good.
>>
>> Attached is a patch for  that adds some extra logic, so that
>> any calls to basename() and dirname() will expand to calls to
>> __old_basename() and __old_dirname(). Using __sym_compat(), these will
>> cause the compiler to generate calls to basename@FBSD_1.0 and
>> dirname@FBSD_1.0.
>>
>> According to Bryan, this fixes the problems he was experiencing.
>>
> 
> I just tried using the attached patch to build a nanobsd image, host is
> amd64 head at r304773 with this patch applied, target is i386
> releng/11.0 at r304729.
> 

What did you apply the patch to?

You need to apply to the source tree, then do a buildworld/installworld
for the host, then try nanobsd.

> I've got it failing early during build:
> 
> --- _bootstrap-tools-usr.bin/xinstall ---
> xinstall.o: In function `install':
> /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall/xinstall.c:(.text+0xf55):
> undefined reference to `basename@FBSD_1.0'
> cc: error: linker command failed with exit code 1 (use -v to see invocation)
> *** [xinstall] Error code 1
> 
> make[3]: stopped in /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall
> 1 error
> 
> make[3]: stopped in /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall
> *** [_bootstrap-tools-usr.bin/xinstall] Error code 2
> 
> Did I miss some needed procedure?
> 
> Thanks!
> 


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


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

2016-08-25 Thread Allan Jude
Author: allanjude
Date: Thu Aug 25 15:08:33 2016
New Revision: 304807
URL: https://svnweb.freebsd.org/changeset/base/304807

Log:
  Capsicumize bspatch
  
  Move all of the fopen() and open() calls to the top of main()
  
  Restrict each FD to least privilege (read/seek only, write only, etc)
  
  cap_enter(), and make all except the output FD read/seek only.
  
  Reviewed by:  emaste, ed, oshogbo, delphij
  Approved by:  so
  MFC after:3 days
  Relnotes: yes
  Sponsored by: ScaleEngine Inc.
  Differential Revision:https://reviews.freebsd.org/D7358

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

Modified: head/usr.bin/bsdiff/bspatch/bspatch.c
==
--- head/usr.bin/bsdiff/bspatch/bspatch.c   Thu Aug 25 14:42:29 2016
(r304806)
+++ head/usr.bin/bsdiff/bspatch/bspatch.c   Thu Aug 25 15:08:33 2016
(r304807)
@@ -27,8 +27,20 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#if defined(__FreeBSD__)
+#include 
+#if __FreeBSD_version >= 1100014
+#include 
+#define HAVE_CAPSICUM
+#elif __FreeBSD_version >= 100
+#include 
+#define HAVE_CAPSICUM
+#endif
+#endif
+
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -80,6 +92,9 @@ int main(int argc, char *argv[])
off_t ctrl[3];
off_t lenread;
off_t i;
+#ifdef HAVE_CAPSICUM
+   cap_rights_t rights_ro, rights_wr;
+#endif
 
if (argc != 4)
usage();
@@ -87,6 +102,43 @@ int main(int argc, char *argv[])
/* Open patch file */
if ((f = fopen(argv[3], "rb")) == NULL)
err(1, "fopen(%s)", argv[3]);
+   /* Open patch file for control block */
+   if ((cpf = fopen(argv[3], "rb")) == NULL)
+   err(1, "fopen(%s)", argv[3]);
+   /* open patch file for diff block */
+   if ((dpf = fopen(argv[3], "rb")) == NULL)
+   err(1, "fopen(%s)", argv[3]);
+   /* open patch file for extra block */
+   if ((epf = fopen(argv[3], "rb")) == NULL)
+   err(1, "fopen(%s)", argv[3]);
+   /* open oldfile */
+   if ((oldfd = open(argv[1], O_RDONLY | O_BINARY, 0)) < 0)
+   err(1, "open(%s)", argv[1]);
+   /* open newfile */
+   if ((newfd = open(argv[2], O_CREAT | O_TRUNC | O_WRONLY | O_BINARY,
+   0666)) < 0)
+   err(1, "open(%s)", argv[2]);
+
+#ifdef HAVE_CAPSICUM
+   if (cap_enter() < 0) {
+   /* Failed to sandbox, fatal if CAPABILITY_MODE enabled */
+   if (errno != ENOSYS)
+   err(1, "failed to enter security sandbox");
+   } else {
+   /* Capsicum Available */
+   cap_rights_init(_ro, CAP_READ, CAP_FSTAT, CAP_SEEK);
+   cap_rights_init(_wr, CAP_WRITE);
+   
+   if (cap_rights_limit(fileno(f), _ro) < 0 ||
+   cap_rights_limit(fileno(cpf), _ro) < 0 ||
+   cap_rights_limit(fileno(dpf), _ro) < 0 ||
+   cap_rights_limit(fileno(epf), _ro) < 0 ||
+   cap_rights_limit(oldfd, _ro) < 0 ||
+   cap_rights_limit(newfd, _wr) < 0)
+   err(1, "cap_rights_limit() failed, could not restrict"
+   " capabilities");
+   }
+#endif
 
/*
File format:
@@ -123,31 +175,22 @@ int main(int argc, char *argv[])
/* Close patch file and re-open it via libbzip2 at the right places */
if (fclose(f))
err(1, "fclose(%s)", argv[3]);
-   if ((cpf = fopen(argv[3], "rb")) == NULL)
-   err(1, "fopen(%s)", argv[3]);
if (fseeko(cpf, 32, SEEK_SET))
err(1, "fseeko(%s, %lld)", argv[3],
(long long)32);
if ((cpfbz2 = BZ2_bzReadOpen(, cpf, 0, 0, NULL, 0)) == NULL)
errx(1, "BZ2_bzReadOpen, bz2err = %d", cbz2err);
-   if ((dpf = fopen(argv[3], "rb")) == NULL)
-   err(1, "fopen(%s)", argv[3]);
if (fseeko(dpf, 32 + bzctrllen, SEEK_SET))
err(1, "fseeko(%s, %lld)", argv[3],
(long long)(32 + bzctrllen));
if ((dpfbz2 = BZ2_bzReadOpen(, dpf, 0, 0, NULL, 0)) == NULL)
errx(1, "BZ2_bzReadOpen, bz2err = %d", dbz2err);
-   if ((epf = fopen(argv[3], "rb")) == NULL)
-   err(1, "fopen(%s)", argv[3]);
if (fseeko(epf, 32 + bzctrllen + bzdatalen, SEEK_SET))
err(1, "fseeko(%s, %lld)", argv[3],
(long long)(32 + bzctrllen + bzdatalen));
if ((epfbz2 = BZ2_bzReadOpen(, epf, 0, 0, NULL, 0)) == NULL)
errx(1, "BZ2_bzReadOpen, bz2err = %d", ebz2err);
 
-   oldfd = open(argv[1], O_RDONLY | O_BINARY, 0);
-   if (oldfd < 0)
-   err(1, "%s", argv[1]);
if ((oldsize = lseek(oldfd, 0, SEEK_END)) == -1 ||
(old = malloc(oldsize+1)) == NULL ||
lseek(oldfd, 0, SEEK_SET) != 0 ||
@@ -215,9 +258,6 

svn commit: r304806 - head/sys/arm64/arm64

2016-08-25 Thread Andrew Turner
Author: andrew
Date: Thu Aug 25 14:42:29 2016
New Revision: 304806
URL: https://svnweb.freebsd.org/changeset/base/304806

Log:
  Fix an assert, it should check if, when moving from 1 l1 to 512 l2 blocks,
  the l2 entry is a block type and not an l3 page.
  
  While here fix the string to correct the level name and add a missing ')'.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Thu Aug 25 13:59:19 2016(r304805)
+++ head/sys/arm64/arm64/pmap.c Thu Aug 25 14:42:29 2016(r304806)
@@ -4323,9 +4323,9 @@ pmap_demote_l1(pmap_t pmap, pt_entry_t *
phys += L2_SIZE;
}
cpu_dcache_wb_range((vm_offset_t)l2, PAGE_SIZE);
-   KASSERT(l2[0] == ((oldl1 & ~ATTR_DESCR_MASK) | L3_PAGE),
-   ("Invalid l3 page (%lx != %lx", l2[0],
-   (oldl1 & ~ATTR_DESCR_MASK) | L3_PAGE));
+   KASSERT(l2[0] == ((oldl1 & ~ATTR_DESCR_MASK) | L2_BLOCK),
+   ("Invalid l2 page (%lx != %lx)", l2[0],
+   (oldl1 & ~ATTR_DESCR_MASK) | L2_BLOCK));
 
if (tmpl1 != 0) {
pmap_kenter(tmpl1, PAGE_SIZE,
@@ -4405,7 +4405,7 @@ pmap_demote_l2_locked(pmap_t pmap, pt_en
cpu_dcache_wb_range((vm_offset_t)l3, PAGE_SIZE);
}
KASSERT(l3[0] == ((oldl2 & ~ATTR_DESCR_MASK) | L3_PAGE),
-   ("Invalid l3 page (%lx != %lx", l3[0],
+   ("Invalid l3 page (%lx != %lx)", l3[0],
(oldl2 & ~ATTR_DESCR_MASK) | L3_PAGE));
 
/*
___
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: r304805 - in head/sys: arm64/conf conf

2016-08-25 Thread Jared McNeill
Author: jmcneill
Date: Thu Aug 25 13:59:19 2016
New Revision: 304805
URL: https://svnweb.freebsd.org/changeset/base/304805

Log:
  Add support for Allwinner A64.
  
  Reviewed by:  andrew, manu
  Relnotes: yes

Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Thu Aug 25 13:46:52 2016(r304804)
+++ head/sys/arm64/conf/GENERIC Thu Aug 25 13:59:19 2016(r304805)
@@ -86,6 +86,7 @@ options   WITNESS_SKIPSPIN# Don't run wi
 optionsMALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
 
 # SoC support
+optionsSOC_ALLWINNER_A64
 optionsSOC_CAVM_THUNDERX
 optionsSOC_HISI_HI6220
 
@@ -103,6 +104,7 @@ options PCI_IOV # PCI SR-IOV support
 # Ethernet NICs
 device mii
 device miibus  # MII bus support
+device awg # Allwinner EMAC Gigabit Ethernet
 device em  # Intel PRO/1000 Gigabit Ethernet Family
 device igb # Intel PRO/1000 PCIE Server Gigabit Family
 device ix  # Intel 10Gb Ethernet Family
@@ -118,6 +120,7 @@ device  da
 device pass# Passthrough device (direct ATA/SCSI access)
 
 # MMC/SD/SDIO Card slot support
+device aw_mmc  # Allwinner SD/MMC controller
 device mmc # mmc/sd bus
 device mmcsd   # mmc/sd flash cards
 device dwmmc
@@ -125,18 +128,45 @@ devicedwmmc
 # Serial (COM) ports
 device uart# Generic UART driver
 device uart_ns8250 # ns8250-type UART driver
+device uart_snps
 device pl011
 
 # USB support
 optionsUSB_DEBUG   # enable debug msgs
+device aw_ehci # Allwinner EHCI USB interface (USB 2.0)
+device aw_usbphy   # Allwinner USB PHY
 device dwcotg  # DWC OTG controller
-device ohci# OHCI PCI->USB interface
-device ehci# EHCI PCI->USB interface (USB 2.0)
+device ohci# OHCI USB interface
+device ehci# EHCI USB interface (USB 2.0)
 device xhci# XHCI PCI->USB interface (USB 3.0)
 device usb # USB Bus (required)
 device ukbd# Keyboard
 device umass   # Disks/Mass storage - Requires scbus 
and da
 
+# GPIO
+device aw_gpio # Allwinner GPIO controller
+device gpio
+device fdt_pinctrl
+
+# I2C
+device aw_rsb  # Allwinner Reduced Serial Bus
+device iicbus
+
+# Clock and reset controllers
+device aw_ccu  # Allwinner clock controller
+
+# Interrupt controllers
+device aw_nmi  # Allwinner NMI support
+
+# Real-time clock support
+device aw_rtc  # Allwinner Real-time Clock
+
+# Watchdog controllers
+device aw_wdog # Allwinner Watchdog
+
+# Power management controllers
+device axp81x  # X-Powers AXP81x PMIC
+
 # Pseudo devices.
 device loop# Network loopback
 device random  # Entropy device
@@ -148,6 +178,13 @@ device gif # IPv6 and IPv4 
tunneling
 device firmware# firmware assist module
 device psci# Support for ARM PSCI
 
+# EXT_RESOURCES pseudo devices
+optionsEXT_RESOURCES
+device clk
+device phy
+device hwreset
+device regulator
+
 # The `bpf' device enables the Berkeley Packet Filter.
 # Be aware of the administrative consequences of enabling this!
 # Note that 'bpf' is required for DHCP.

Modified: head/sys/conf/files.arm64
==
--- head/sys/conf/files.arm64   Thu Aug 25 13:46:52 2016(r304804)
+++ head/sys/conf/files.arm64   Thu Aug 25 13:59:19 2016(r304805)
@@ -11,6 +11,30 @@ cloudabi64_vdso_blob.o   optionalcompat_
no-implicit-rule\
clean   "cloudabi64_vdso_blob.o"
 #
+arm/allwinner/a10_ehci.c   optionalehci aw_ehci
+arm/allwinner/a10_gpio.c   optionalgpio aw_gpio
+arm/allwinner/a10_mmc.coptionalmmc aw_mmc
+arm/allwinner/a64/a64_padconf.coptionalsoc_allwinner_a64
+arm/allwinner/a64/a64_r_padconf.c optional soc_allwinner_a64
+arm/allwinner/aw_ccu.c optionalaw_ccu
+arm/allwinner/aw_nmi.c optionalaw_nmi \
+   compile-with "${NORMAL_C} -I$S/gnu/dts/include"
+arm/allwinner/aw_reset.c   optionalaw_ccu
+arm/allwinner/aw_rsb.c 

svn commit: r304804 - in head/sys: dev/syscons kern

2016-08-25 Thread Bruce Evans
Author: bde
Date: Thu Aug 25 13:46:52 2016
New Revision: 304804
URL: https://svnweb.freebsd.org/changeset/base/304804

Log:
  Less-quick fix for locking fixes in r172250.  r172250 added a second
  syscons spinlock for the output routine alone.  It is better to extend
  the coverage of the first syscons spinlock added in r162285.  2 locks
  might work with complicated juggling, but no juggling was done.  What
  the 2 locks actually did was to cover some of the missing locking in
  each other and deadlock less often against each other than a single
  lock with larger coverage would against itself.  Races are preferable
  to deadlocks here, but 2 locks are still worse since they are harder
  to understand and fix.
  
  Prefer deadlocks to races and merge the second lock into the first one.
  
  Extend the scope of the spinlocking to all of sc_cnputc() instead of
  just the sc_puts() part.  This further prefers deadlocks to races.
  
  Extend the kdb_active hack from sc_puts() internals for the second lock
  to all spinlocking.  This reduces deadlocks much more than the other
  changes increases them.  The s/p,10* test in ddb gets much further now.
  Hide this detail in the SC_VIDEO_LOCK() macro.  Add namespace pollution
  in 1 nested #include and reduce namespace pollution in other nested
  #includes to pay for this.
  
  Move the first lock higher in the witness order.  The second lock was
  unnaturally low and the first lock was unnaturally high.  The second
  lock had to be above "sleepq chain" and/or "callout" to avoid spurious
  LORs for visual bells in sc_puts().  Other console driver locks are
  already even higher (but not adjacent like they should be) except when
  they are missing from the table.  Audio bells also benefit from the
  syscons lock being high so that audio mutexes have chance of being
  lower.  Otherwise, console drviver locks should be as low as possible.
  Non-spurious LORs now occur if the bell code calls printf() or is
  interrupted (perhaps by an NMI) and the interrupt handler calls
  printf().  Previous commits turned off many bells in console i/o but
  missed ones done by the teken layer.

Modified:
  head/sys/dev/syscons/syscons.c
  head/sys/dev/syscons/syscons.h
  head/sys/kern/subr_witness.c

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Thu Aug 25 13:33:32 2016
(r304803)
+++ head/sys/dev/syscons/syscons.c  Thu Aug 25 13:46:52 2016
(r304804)
@@ -343,7 +343,9 @@ sctty_outwakeup(struct tty *tp)
len = ttydisc_getc(tp, buf, sizeof buf);
if (len == 0)
break;
+   SC_VIDEO_LOCK(scp->sc);
sc_puts(scp, buf, len, 0);
+   SC_VIDEO_UNLOCK(scp->sc);
 }
 }
 
@@ -1760,6 +1762,8 @@ sc_cnputc(struct consdev *cd, int c)
 
 /* assert(sc_console != NULL) */
 
+SC_VIDEO_LOCK(scp->sc);
+
 #ifndef SC_NO_HISTORY
 if (scp == scp->sc->cur_scp && scp->status & SLKED) {
scp->status &= ~SLKED;
@@ -1793,6 +1797,7 @@ sc_cnputc(struct consdev *cd, int c)
 s = spltty();  /* block sckbdevent and scrn_timer */
 sccnupdate(scp);
 splx(s);
+SC_VIDEO_UNLOCK(scp->sc);
 }
 
 static int
@@ -2726,24 +2731,14 @@ exchange_scr(sc_softc_t *sc)
 static void
 sc_puts(scr_stat *scp, u_char *buf, int len, int kernel)
 {
-int need_unlock = 0;
-
 #ifdef DEV_SPLASH
 /* make screensaver happy */
 if (!sticky_splash && scp == scp->sc->cur_scp && !sc_saver_keyb_only)
run_scrn_saver = FALSE;
 #endif
 
-if (scp->tsw) {
-   if (!kdb_active && !mtx_owned(>sc->scr_lock)) {
-   need_unlock = 1;
-   mtx_lock_spin(>sc->scr_lock);
-   }
+if (scp->tsw)
(*scp->tsw->te_puts)(scp, buf, len, kernel);
-   if (need_unlock)
-   mtx_unlock_spin(>sc->scr_lock);
-}
-
 if (scp->sc->delayed_next_scr)
sc_switch_scr(scp->sc, scp->sc->delayed_next_scr - 1);
 }
@@ -2906,10 +2901,8 @@ scinit(int unit, int flags)
  * disappeared...
  */
 sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE);
-if ((sc->flags & SC_INIT_DONE) == 0) {
-   mtx_init(>scr_lock, "scrlock", NULL, MTX_SPIN);
+if ((sc->flags & SC_INIT_DONE) == 0)
SC_VIDEO_LOCKINIT(sc);
-}
 
 adp = NULL;
 if (sc->adapter >= 0) {
@@ -3126,7 +3119,6 @@ scterm(int unit, int flags)
(*scp->tsw->te_term)(scp, >ts);
 if (scp->ts != NULL)
free(scp->ts, M_DEVBUF);
-mtx_destroy(>scr_lock);
 mtx_destroy(>video_mtx);
 
 /* clear the structure */

Modified: head/sys/dev/syscons/syscons.h
==
--- head/sys/dev/syscons/syscons.h  Thu Aug 25 13:33:32 2016
(r304803)
+++ head/sys/dev/syscons/syscons.h  Thu Aug 25 13:46:52 2016
(r304804)
@@ -34,8 +34,9 @@
 #ifndef _DEV_SYSCONS_SYSCONS_H_
 #define_DEV_SYSCONS_SYSCONS_H_
 

svn commit: r304803 - in head/sys: netinet netinet/cc sys

2016-08-25 Thread Lawrence Stewart
Author: lstewart
Date: Thu Aug 25 13:33:32 2016
New Revision: 304803
URL: https://svnweb.freebsd.org/changeset/base/304803

Log:
  Pass the number of segments coalesced by LRO up the stack by repurposing the
  tso_segsz pkthdr field during RX processing, and use the information in TCP 
for
  more correct accounting and as a congestion control input. This is only a 
start,
  and an audit of other uses for the data is left as future work.
  
  Reviewed by:  gallatin, rrs
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D7564

Modified:
  head/sys/netinet/cc/cc.h
  head/sys/netinet/cc/cc_newreno.c
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_lro.c
  head/sys/netinet/tcp_var.h
  head/sys/sys/mbuf.h

Modified: head/sys/netinet/cc/cc.h
==
--- head/sys/netinet/cc/cc.hThu Aug 25 13:24:11 2016(r304802)
+++ head/sys/netinet/cc/cc.hThu Aug 25 13:33:32 2016(r304803)
@@ -86,6 +86,7 @@ struct cc_var {
struct tcpcb*tcp;
struct sctp_nets*sctp;
} ccvc;
+   uint16_tnsegs; /* # segments coalesced into current chain. */
 };
 
 /* cc_var flags. */

Modified: head/sys/netinet/cc/cc_newreno.c
==
--- head/sys/netinet/cc/cc_newreno.cThu Aug 25 13:24:11 2016
(r304802)
+++ head/sys/netinet/cc/cc_newreno.cThu Aug 25 13:33:32 2016
(r304803)
@@ -137,7 +137,8 @@ newreno_ack_received(struct cc_var *ccv,
 */
if (CCV(ccv, snd_nxt) == CCV(ccv, snd_max))
incr = min(ccv->bytes_this_ack,
-   V_tcp_abc_l_var * CCV(ccv, t_maxseg));
+   ccv->nsegs * V_tcp_abc_l_var *
+   CCV(ccv, t_maxseg));
else
incr = min(ccv->bytes_this_ack, CCV(ccv, 
t_maxseg));
}

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cThu Aug 25 13:24:11 2016
(r304802)
+++ head/sys/netinet/tcp_input.cThu Aug 25 13:33:32 2016
(r304803)
@@ -300,10 +300,12 @@ hhook_run_tcp_est_in(struct tcpcb *tp, s
  * CC wrapper hook functions
  */
 void
-cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t type)
+cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs,
+uint16_t type)
 {
INP_WLOCK_ASSERT(tp->t_inpcb);
 
+   tp->ccv->nsegs = nsegs;
tp->ccv->bytes_this_ack = BYTES_THIS_ACK(tp, th);
if (tp->snd_cwnd <= tp->snd_wnd)
tp->ccv->flags |= CCF_CWND_LIMITED;
@@ -313,7 +315,7 @@ cc_ack_received(struct tcpcb *tp, struct
if (type == CC_ACK) {
if (tp->snd_cwnd > tp->snd_ssthresh) {
tp->t_bytes_acked += min(tp->ccv->bytes_this_ack,
-V_tcp_abc_l_var * tcp_maxseg(tp));
+nsegs * V_tcp_abc_l_var * tcp_maxseg(tp));
if (tp->t_bytes_acked >= tp->snd_cwnd) {
tp->t_bytes_acked -= tp->snd_cwnd;
tp->ccv->flags |= CCF_ABC_SENTAWND;
@@ -1502,6 +1504,7 @@ tcp_do_segment(struct mbuf *m, struct tc
int thflags, acked, ourfinisacked, needoutput = 0, sack_changed;
int rstreason, todrop, win;
u_long tiwin;
+   uint16_t nsegs;
char *s;
struct in_conninfo *inc;
struct mbuf *mfree;
@@ -1521,6 +1524,7 @@ tcp_do_segment(struct mbuf *m, struct tc
inc = >t_inpcb->inp_inc;
tp->sackhint.last_sack_ack = 0;
sack_changed = 0;
+   nsegs = max(1, m->m_pkthdr.lro_nsegs);
 
/*
 * If this is either a state-changing packet or current state isn't
@@ -1759,7 +1763,7 @@ tcp_do_segment(struct mbuf *m, struct tc
/* Run HHOOK_TCP_ESTABLISHED_IN helper hooks. */
hhook_run_tcp_est_in(tp, th, );
 
-   TCPSTAT_INC(tcps_rcvackpack);
+   TCPSTAT_ADD(tcps_rcvackpack, nsegs);
TCPSTAT_ADD(tcps_rcvackbyte, acked);
sbdrop(>so_snd, acked);
if (SEQ_GT(tp->snd_una, tp->snd_recover) &&
@@ -1772,7 +1776,7 @@ tcp_do_segment(struct mbuf *m, struct tc
 * typically means increasing the congestion
 * window.
 */
-   cc_ack_received(tp, th, CC_ACK);
+   cc_ack_received(tp, th, nsegs, CC_ACK);
 
tp->snd_una = th->th_ack;
 

Re: svn commit: r304781 - head/etc/rc.d

2016-08-25 Thread Cy Schubert
In message <3deee68f-3b30-8305-6985-422797f66...@freebsd.org>, Andrey 
Chernov w
rites:
> On 25.08.2016 5:58, Cy Schubert wrote:
> > Author: cy
> > Date: Thu Aug 25 02:58:41 2016
> > New Revision: 304781
> > URL: https://svnweb.freebsd.org/changeset/base/304781
> > 
> > Log:
> >   Add logic to replace the working ntp leap-seconds file in /var/db
> >   if it contains a $FreeBSD$ header. The header will cause the file
> >   to fail checksum of the hash causing ntpd to ignore the file.
> 
> You don't need any logic, just remove $FreeBSD$ keyword from it. ntpd
> can be called manually with this file too.

Yes, it can be called manually too. The script copies /etc/ntp/leap-seconds 
to /var/db/ntpd.leap-seconds.list (if /etc/ntp/leap-seconds has a newer #$ 
[version number] or #@ [expiry] timestamps in it), before any other 
comparisons. There is potential. Having said that, it is a gratuitous step 
and could probably be removed.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
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: r304802 - head/etc/rc.d

2016-08-25 Thread Cy Schubert
Author: cy
Date: Thu Aug 25 13:24:11 2016
New Revision: 304802
URL: https://svnweb.freebsd.org/changeset/base/304802

Log:
  Remove the gratuitous check for $FreeBSD$ and rename the function
  to ntpd_init_leapfile, to ensure a copy exists in /var/db if a copy
  isn't already there.
  
  Reported by:  ache@
  MFC after:1 day

Modified:
  head/etc/rc.d/ntpd

Modified: head/etc/rc.d/ntpd
==
--- head/etc/rc.d/ntpd  Thu Aug 25 12:42:41 2016(r304801)
+++ head/etc/rc.d/ntpd  Thu Aug 25 13:24:11 2016(r304802)
@@ -29,7 +29,7 @@ ntpd_precmd()
rc_flags="-g $rc_flags"
fi
 
-   ntpd_valid_leapfile
+   ntpd_init_leapfile
 
if [ ! -f $ntp_db_leapfile ]; then
ntpd_fetch_leapfile
@@ -80,15 +80,12 @@ get_ntp_leapfile_expiry() {
'^\([1-9][0-9]*\)$' \| 0
 }
 
-ntpd_valid_leapfile() {
+ntpd_init_leapfile() {
# Refresh working leapfile with an invalid hash due to
# FreeBSD id header. Ntpd will ignore leapfiles with a
# mismatch hash. The file must be the virgin file from
# the source.
-   if [ -f $ntp_db_leapfile ]; then
-   grep -q '\$FreeBSD.*\$' $ntp_db_leapfile &&
-   cp -p $ntp_src_leapfile $ntp_db_leapfile
-   else
+   if [ ! -f $ntp_db_leapfile ]; then
cp -p $ntp_src_leapfile $ntp_db_leapfile
fi
 }
___
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: r304781 - head/etc/rc.d

2016-08-25 Thread Andrey Chernov
On 25.08.2016 5:58, Cy Schubert wrote:
> Author: cy
> Date: Thu Aug 25 02:58:41 2016
> New Revision: 304781
> URL: https://svnweb.freebsd.org/changeset/base/304781
> 
> Log:
>   Add logic to replace the working ntp leap-seconds file in /var/db
>   if it contains a $FreeBSD$ header. The header will cause the file
>   to fail checksum of the hash causing ntpd to ignore the file.

You don't need any logic, just remove $FreeBSD$ keyword from it. ntpd
can be called manually with this file too.


___
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: r304801 - head/sys/boot/efi/loader

2016-08-25 Thread Andrew Turner
Author: andrew
Date: Thu Aug 25 12:42:41 2016
New Revision: 304801
URL: https://svnweb.freebsd.org/changeset/base/304801

Log:
  Don't set *dev in the zfs root case, it may be NULL and will correctly be
  set later in the function. This fixes a potential NULL pointer dereference
  found on arm64.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/boot/efi/loader/devicename.c

Modified: head/sys/boot/efi/loader/devicename.c
==
--- head/sys/boot/efi/loader/devicename.c   Thu Aug 25 12:04:57 2016
(r304800)
+++ head/sys/boot/efi/loader/devicename.c   Thu Aug 25 12:42:41 2016
(r304801)
@@ -120,7 +120,6 @@ efi_parsedev(struct devdesc **dev, const
free(idev);
return (err);
}
-   *dev = idev;
cp = strchr(np + 1, ':');
} else
 #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: r304800 - head/sys/dev/syscons

2016-08-25 Thread Bruce Evans
Author: bde
Date: Thu Aug 25 12:04:57 2016
New Revision: 304800
URL: https://svnweb.freebsd.org/changeset/base/304800

Log:
  Fix logic errors in bounds checks in previous commit.  The 2-entry stack
  was overrun for grab levels larger than 2.
  
  Reported by:  pluknet

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

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Thu Aug 25 10:53:03 2016
(r304799)
+++ head/sys/dev/syscons/syscons.c  Thu Aug 25 12:04:57 2016
(r304800)
@@ -1729,7 +1729,7 @@ sc_cngrab(struct consdev *cp)
 
 sc = sc_console->sc;
 lev = atomic_fetchadd_int(>grab_level, 1);
-if (lev >= 0 || lev < 2)
+if (lev >= 0 && lev < 2)
sccnopen(sc, >grab_state[lev], 1 | 2);
 }
 
@@ -1741,7 +1741,7 @@ sc_cnungrab(struct consdev *cp)
 
 sc = sc_console->sc;
 lev = atomic_load_acq_int(>grab_level) - 1;
-if (lev >= 0 || lev < 2)
+if (lev >= 0 && lev < 2)
sccnclose(sc, >grab_state[lev]);
 atomic_add_int(>grab_level, -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: r304799 - head/sys/arm64/arm64

2016-08-25 Thread Andrew Turner
Author: andrew
Date: Thu Aug 25 10:53:03 2016
New Revision: 304799
URL: https://svnweb.freebsd.org/changeset/base/304799

Log:
  Map coherent memory in a non-coherent dma tag as uncached. This is similar
  to what the 32-bit arm code does, with the exception that it always assumes
  the tag is non-coherent.
  
  Tested by:jmcneill
  Obtained from:ABT Systems Ltd
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cThu Aug 25 10:29:41 2016
(r304798)
+++ head/sys/arm64/arm64/busdma_bounce.cThu Aug 25 10:53:03 2016
(r304799)
@@ -438,6 +438,13 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dm
mflags |= M_ZERO;
if (flags & BUS_DMA_NOCACHE)
attr = VM_MEMATTR_UNCACHEABLE;
+   else if ((flags & BUS_DMA_COHERENT) != 0 &&
+   (dmat->bounce_flags & BF_COHERENT) == 0)
+   /*
+* If we have a non-coherent tag, and are trying to allocate
+* a coherent block of memory it needs to be uncached.
+*/
+   attr = VM_MEMATTR_UNCACHEABLE;
else
attr = VM_MEMATTR_DEFAULT;
 
___
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: r304798 - head/sys/arm/allwinner/clk

2016-08-25 Thread Jared McNeill
Author: jmcneill
Date: Thu Aug 25 10:29:41 2016
New Revision: 304798
URL: https://svnweb.freebsd.org/changeset/base/304798

Log:
  Add support for Allwinner A64 PLL_PERIPH0/PLL_PERIPH1 and PLL_HSIC clocks.
  
  Reviewed by:  andrew, manu

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 Thu Aug 25 10:28:47 2016
(r304797)
+++ head/sys/arm/allwinner/clk/aw_pll.c Thu Aug 25 10:29:41 2016
(r304798)
@@ -142,6 +142,15 @@ __FBSDID("$FreeBSD$");
 #defineA31_PLL6_DEFAULT_K  0x1
 #defineA31_PLL6_TIMEOUT10
 
+#defineA64_PLLHSIC_LOCK(1 << 28)
+#defineA64_PLLHSIC_FRAC_CLK_OUT(1 << 25)
+#defineA64_PLLHSIC_PLL_MODE_SEL(1 << 24)
+#defineA64_PLLHSIC_PLL_SDM_EN  (1 << 20)
+#defineA64_PLLHSIC_FACTOR_N(0x7f << 8)
+#defineA64_PLLHSIC_FACTOR_N_SHIFT  8
+#defineA64_PLLHSIC_PRE_DIV_M   (0xf << 0)
+#defineA64_PLLHSIC_PRE_DIV_M_SHIFT 0
+
 #defineA80_PLL4_CLK_OUT_EN (1 << 20)
 #defineA80_PLL4_PLL_DIV2   (1 << 18)
 #defineA80_PLL4_PLL_DIV1   (1 << 16)
@@ -172,6 +181,7 @@ enum aw_pll_type {
AWPLL_A23_PLL1,
AWPLL_A31_PLL1,
AWPLL_A31_PLL6,
+   AWPLL_A64_PLLHSIC,
AWPLL_A80_PLL4,
 };
 
@@ -601,6 +611,7 @@ a31_pll6_init(device_t dev, bus_addr_t r
val &= ~(A31_PLL6_FACTOR_N | A31_PLL6_FACTOR_K | A31_PLL6_BYPASS_EN);
val |= (A31_PLL6_DEFAULT_N << A31_PLL6_FACTOR_N_SHIFT);
val |= (A31_PLL6_DEFAULT_K << A31_PLL6_FACTOR_K_SHIFT);
+   val |= AW_PLL_ENABLE;
CLKDEV_WRITE_4(dev, reg, val);
 
/* Wait for PLL to become stable */
@@ -613,9 +624,6 @@ a31_pll6_init(device_t dev, bus_addr_t r
 
CLKDEV_DEVICE_UNLOCK(dev);
 
-   if (retry == 0)
-   return (ETIMEDOUT);
-
return (0);
 }
 
@@ -663,6 +671,40 @@ a80_pll4_recalc(struct aw_pll_sc *sc, ui
return (0);
 }
 
+static int
+a64_pllhsic_recalc(struct aw_pll_sc *sc, uint64_t *freq)
+{
+   uint32_t val, n, m;
+
+   DEVICE_LOCK(sc);
+   PLL_READ(sc, );
+   DEVICE_UNLOCK(sc);
+
+   n = ((val & A64_PLLHSIC_FACTOR_N) >> A64_PLLHSIC_FACTOR_N_SHIFT) + 1;
+   m = ((val & A64_PLLHSIC_PRE_DIV_M) >> A64_PLLHSIC_PRE_DIV_M_SHIFT) + 1;
+
+   *freq = (*freq * n) / m;
+
+   return (0);
+}
+
+static int
+a64_pllhsic_init(device_t dev, bus_addr_t reg, struct clknode_init_def *def)
+{
+   uint32_t val;
+
+   /*
+* PLL_HSIC default is 480MHz, just enable it.
+*/
+   CLKDEV_DEVICE_LOCK(dev);
+   CLKDEV_READ_4(dev, reg, );
+   val |= AW_PLL_ENABLE;
+   CLKDEV_WRITE_4(dev, reg, val);
+   CLKDEV_DEVICE_UNLOCK(dev);
+
+   return (0);
+}
+
 #definePLL(_type, _recalc, _set_freq, _init)   \
[(_type)] = {   \
.recalc = (_recalc),\
@@ -681,6 +723,7 @@ static struct aw_pll_funcs aw_pll_func[]
PLL(AWPLL_A31_PLL1, a31_pll1_recalc, NULL, NULL),
PLL(AWPLL_A31_PLL6, a31_pll6_recalc, NULL, a31_pll6_init),
PLL(AWPLL_A80_PLL4, a80_pll4_recalc, NULL, NULL),
+   PLL(AWPLL_A64_PLLHSIC, a64_pllhsic_recalc, NULL, a64_pllhsic_init),
 };
 
 static struct ofw_compat_data compat_data[] = {
@@ -694,6 +737,7 @@ static struct ofw_compat_data compat_dat
{ "allwinner,sun6i-a31-pll6-clk",   AWPLL_A31_PLL6 },
{ "allwinner,sun8i-a23-pll1-clk",   AWPLL_A23_PLL1 },
{ "allwinner,sun9i-a80-pll4-clk",   AWPLL_A80_PLL4 },
+   { "allwinner,sun50i-a64-pllhsic-clk",   AWPLL_A64_PLLHSIC },
{ NULL, 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: r304797 - head/tests/sys/kqueue

2016-08-25 Thread Julio Merino
Author: jmmv
Date: Thu Aug 25 10:28:47 2016
New Revision: 304797
URL: https://svnweb.freebsd.org/changeset/base/304797

Log:
  Make use of Kyua's work directories.
  
  Change the vnode tests to use the current directory when creating temporary
  files, which we can assume is a volatile work directory, and then make the
  kqueue_test.sh driver _not_ abandon the directory created by Kyua.
  
  This makes the various kqueue tests independent of each other, and ensures
  the temporary file is cleaned up on failure.
  
  Problem spotted by asomers@ when reviewing D4254.

Modified:
  head/tests/sys/kqueue/kqueue_test.sh
  head/tests/sys/kqueue/vnode.c

Modified: head/tests/sys/kqueue/kqueue_test.sh
==
--- head/tests/sys/kqueue/kqueue_test.shThu Aug 25 10:27:22 2016
(r304796)
+++ head/tests/sys/kqueue/kqueue_test.shThu Aug 25 10:28:47 2016
(r304797)
@@ -1,8 +1,8 @@
 #!/bin/sh
+# $FreeBSD$
 
-cd $(dirname $0)
 i=1
-./kqtest | while read line; do
+"$(dirname $0)/kqtest" | while read line; do
echo $line | grep -q passed
if [ $? -eq 0 ]; then
echo "ok - $i $line"

Modified: head/tests/sys/kqueue/vnode.c
==
--- head/tests/sys/kqueue/vnode.c   Thu Aug 25 10:27:22 2016
(r304796)
+++ head/tests/sys/kqueue/vnode.c   Thu Aug 25 10:28:47 2016
(r304797)
@@ -25,12 +25,12 @@ void
 test_kevent_vnode_add(void)
 {
 const char *test_id = "kevent(EVFILT_VNODE, EV_ADD)";
-const char *testfile = "/tmp/kqueue-test.tmp";
+const char *testfile = "./kqueue-test.tmp";
 struct kevent kev;
 
 test_begin(test_id);
 
-system("touch /tmp/kqueue-test.tmp");
+system("touch ./kqueue-test.tmp");
 vnode_fd = open(testfile, O_RDONLY);
 if (vnode_fd < 0)
 err(1, "open of %s", testfile);
@@ -57,7 +57,7 @@ test_kevent_vnode_note_delete(void)
 if (kevent(kqfd, , 1, NULL, 0, NULL) < 0)
 err(1, "%s", test_id);
 
-if (unlink("/tmp/kqueue-test.tmp") < 0)
+if (unlink("./kqueue-test.tmp") < 0)
 err(1, "unlink");
 
 kevent_cmp(, kevent_get(kqfd));
@@ -77,7 +77,7 @@ test_kevent_vnode_note_write(void)
 if (kevent(kqfd, , 1, NULL, 0, NULL) < 0)
 err(1, "%s", test_id);
 
-if (system("echo hello >> /tmp/kqueue-test.tmp") < 0)
+if (system("echo hello >> ./kqueue-test.tmp") < 0)
 err(1, "system");
 
 /* BSD kqueue adds NOTE_EXTEND even though it was not requested */
@@ -102,7 +102,7 @@ test_kevent_vnode_note_attrib(void)
 if (kevent(kqfd, , 1, NULL, 0, NULL) < 0)
 err(1, "%s", test_id);
 
-if (system("touch /tmp/kqueue-test.tmp") < 0)
+if (system("touch ./kqueue-test.tmp") < 0)
 err(1, "system");
 
 nfds = kevent(kqfd, NULL, 0, , 1, NULL);
@@ -130,7 +130,7 @@ test_kevent_vnode_note_rename(void)
 if (kevent(kqfd, , 1, NULL, 0, NULL) < 0)
 err(1, "%s", test_id);
 
-if (system("mv /tmp/kqueue-test.tmp /tmp/kqueue-test2.tmp") < 0)
+if (system("mv ./kqueue-test.tmp ./kqueue-test2.tmp") < 0)
 err(1, "system");
 
 nfds = kevent(kqfd, NULL, 0, , 1, NULL);
@@ -142,7 +142,7 @@ test_kevent_vnode_note_rename(void)
 err(1, "%s - incorrect event (sig=%u; filt=%d; flags=%d)", 
 test_id, (unsigned int)kev.ident, kev.filter, kev.flags);
 
-if (system("mv /tmp/kqueue-test2.tmp /tmp/kqueue-test.tmp") < 0)
+if (system("mv ./kqueue-test2.tmp ./kqueue-test.tmp") < 0)
 err(1, "system");
 
 success();
@@ -183,7 +183,7 @@ test_kevent_vnode_disable_and_enable(voi
 err(1, "%s", test_id);
 
 /* Confirm that the watch is disabled */
-if (system("touch /tmp/kqueue-test.tmp") < 0)
+if (system("touch ./kqueue-test.tmp") < 0)
 err(1, "system");
 test_no_kevents();
 
@@ -191,7 +191,7 @@ test_kevent_vnode_disable_and_enable(voi
 kev.flags = EV_ENABLE;
 if (kevent(kqfd, , 1, NULL, 0, NULL) < 0)
 err(1, "%s", test_id);
-if (system("touch /tmp/kqueue-test.tmp") < 0)
+if (system("touch ./kqueue-test.tmp") < 0)
 err(1, "system");
 nfds = kevent(kqfd, NULL, 0, , 1, NULL);
 if (nfds < 1)
@@ -221,7 +221,7 @@ test_kevent_vnode_dispatch(void)
 if (kevent(kqfd, , 1, NULL, 0, NULL) < 0)
 err(1, "%s", test_id);
 
-if (system("touch /tmp/kqueue-test.tmp") < 0)
+if (system("touch ./kqueue-test.tmp") < 0)
 err(1, "system");
 
 nfds = kevent(kqfd, NULL, 0, , 1, NULL);
@@ -235,7 +235,7 @@ test_kevent_vnode_dispatch(void)
 
 /* Confirm that the watch is disabled automatically */
 puts("-- checking that watch is disabled");
-if (system("touch /tmp/kqueue-test.tmp") < 0)
+if (system("touch ./kqueue-test.tmp") < 0)
 err(1, "system");
 test_no_kevents();
 
___
svn-src-all@freebsd.org mailing list

svn commit: r304796 - head/sys/arm/allwinner/clk

2016-08-25 Thread Jared McNeill
Author: jmcneill
Date: Thu Aug 25 10:27:22 2016
New Revision: 304796
URL: https://svnweb.freebsd.org/changeset/base/304796

Log:
  Switch parent clock when setting frequency if a new parent is a better
  candidate for the target rate.
  
  Reviewed by:  andrew, manu

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

Modified: head/sys/arm/allwinner/clk/aw_modclk.c
==
--- head/sys/arm/allwinner/clk/aw_modclk.c  Thu Aug 25 10:24:14 2016
(r304795)
+++ head/sys/arm/allwinner/clk/aw_modclk.c  Thu Aug 25 10:27:22 2016
(r304796)
@@ -160,28 +160,47 @@ aw_modclk_set_freq(struct clknode *clk, 
 int flags, int *stop)
 {
struct aw_modclk_sc *sc;
-   uint32_t val, m, n, best_m, best_n;
+   uint32_t val, m, n, src, best_m, best_n, best_src;
uint64_t cur_freq;
int64_t best_diff, cur_diff;
+   int error;
 
sc = clknode_get_softc(clk);
best_n = best_m = 0;
best_diff = (int64_t)*fout; 
+   best_src = 0;
 
-   for (n = 0; n <= CLK_RATIO_N_MAX; n++)
-   for (m = 0; m <= CLK_RATIO_M_MAX; m++) {
-   cur_freq = fin / (1 << n) / (m + 1);
-   cur_diff = (int64_t)*fout - cur_freq;
-   if (cur_diff >= 0 && cur_diff < best_diff) {
-   best_diff = cur_diff;
-   best_m = m;
-   best_n = n;
+   for (src = 0; src < CLK_SRC_SEL_MAX; src++) {
+   error = clknode_set_parent_by_idx(clk, src);
+   if (error != 0)
+   continue;
+   error = clknode_get_freq(clknode_get_parent(clk), );
+   if (error != 0)
+   continue;
+
+   for (n = 0; n <= CLK_RATIO_N_MAX; n++)
+   for (m = 0; m <= CLK_RATIO_M_MAX; m++) {
+   cur_freq = fin / (1 << n) / (m + 1);
+   cur_diff = (int64_t)*fout - cur_freq;
+   if (cur_diff >= 0 && cur_diff < best_diff) {
+   best_src = src;
+   best_diff = cur_diff;
+   best_m = m;
+   best_n = n;
+   }
}
-   }
+   }
 
if (best_diff == (int64_t)*fout)
return (ERANGE);
 
+   error = clknode_set_parent_by_idx(clk, best_src);
+   if (error != 0)
+   return (error);
+   error = clknode_get_freq(clknode_get_parent(clk), );
+   if (error != 0)
+   return (error);
+
DEVICE_LOCK(sc);
MODCLK_READ(sc, );
val &= ~(CLK_RATIO_N | CLK_RATIO_M);
___
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: r304795 - head/sys/arm/allwinner/clk

2016-08-25 Thread Jared McNeill
Author: jmcneill
Date: Thu Aug 25 10:24:14 2016
New Revision: 304795
URL: https://svnweb.freebsd.org/changeset/base/304795

Log:
  Add support for Allwinner multi-parent bus gates.
  
  Reviewed by:  andrew, manu

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

Modified: head/sys/arm/allwinner/clk/aw_gate.c
==
--- head/sys/arm/allwinner/clk/aw_gate.cThu Aug 25 10:20:27 2016
(r304794)
+++ head/sys/arm/allwinner/clk/aw_gate.cThu Aug 25 10:24:14 2016
(r304795)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -89,11 +90,14 @@ static struct ofw_compat_data compat_dat
  (uintptr_t)"Allwinner APB0 Clock Gates" },
 
{ "allwinner,sun8i-h3-bus-gates-clk",
- (uintptr_t)"Allwinner Bus Clock Gates"},
+ (uintptr_t)"Allwinner Bus Clock Gates" },
 
{ "allwinner,sun9i-a80-apbs-gates-clk",
  (uintptr_t)"Allwinner APBS Clock Gates" },
 
+   { "allwinner,sunxi-multi-bus-gates-clk",
+ (uintptr_t)"Allwinner Multi Bus Clock Gates" },
+
{ NULL, 0 }
 };
 
@@ -119,6 +123,43 @@ aw_gate_create(device_t dev, bus_addr_t 
 }
 
 static int
+aw_gate_add(device_t dev, struct clkdom *clkdom, phandle_t node,
+bus_addr_t paddr)
+{
+   const char **names;
+   uint32_t *indices;
+   clk_t clk_parent;
+   int index, nout, error;
+
+   indices = NULL;
+
+   nout = clk_parse_ofw_out_names(dev, node, , );
+   if (nout == 0) {
+   device_printf(dev, "no clock outputs found\n");
+   return (ENOENT);
+   }
+   if (indices == NULL) {
+   device_printf(dev, "no clock-indices property\n");
+   return (ENXIO);
+   }
+
+   error = clk_get_by_ofw_index(dev, node, 0, _parent);
+   if (error != 0) {
+   device_printf(dev, "cannot parse clock parent\n");
+   return (ENXIO);
+   }
+
+   for (index = 0; index < nout; index++) {
+   error = aw_gate_create(dev, paddr, clkdom,
+   clk_get_name(clk_parent), names[index], indices[index]);
+   if (error)
+   return (error);
+   }
+
+   return (0);
+}
+
+static int
 aw_gate_probe(device_t dev)
 {
const char *d;
@@ -138,16 +179,11 @@ static int
 aw_gate_attach(device_t dev)
 {
struct clkdom *clkdom;
-   const char **names;
-   int index, nout, error;
-   uint32_t *indices;
-   clk_t clk_parent;
bus_addr_t paddr;
bus_size_t psize;
-   phandle_t node;
+   phandle_t node, child;
 
node = ofw_bus_get_node(dev);
-   indices = NULL;
 
if (ofw_reg_to_paddr(node, 0, , , NULL) != 0) {
device_printf(dev, "cannot parse 'reg' property\n");
@@ -156,44 +192,21 @@ aw_gate_attach(device_t dev)
 
clkdom = clkdom_create(dev);
 
-   nout = clk_parse_ofw_out_names(dev, node, , );
-   if (nout == 0) {
-   device_printf(dev, "no clock outputs found\n");
-   error = ENOENT;
-   goto fail;
-   }
-   if (indices == NULL) {
-   device_printf(dev, "no clock-indices property\n");
-   error = ENXIO;
-   goto fail;
-   }
-
-   error = clk_get_by_ofw_index(dev, 0, 0, _parent);
-   if (error != 0) {
-   device_printf(dev, "cannot parse clock parent\n");
-   return (ENXIO);
-   }
-
-   for (index = 0; index < nout; index++) {
-   error = aw_gate_create(dev, paddr, clkdom,
-   clk_get_name(clk_parent), names[index], indices[index]);
-   if (error)
-   goto fail;
-   }
+   if (ofw_bus_is_compatible(dev, "allwinner,sunxi-multi-bus-gates-clk")) {
+   for (child = OF_child(node); child > 0; child = OF_peer(child))
+   aw_gate_add(dev, clkdom, child, paddr);
+   } else
+   aw_gate_add(dev, clkdom, node, paddr);
 
if (clkdom_finit(clkdom) != 0) {
device_printf(dev, "cannot finalize clkdom initialization\n");
-   error = ENXIO;
-   goto fail;
+   return (ENXIO);
}
 
if (bootverbose)
clkdom_dump(clkdom);
 
return (0);
-
-fail:
-   return (error);
 }
 
 static device_method_t aw_gate_methods[] = {
___
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: r304794 - head/sys/arm/allwinner

2016-08-25 Thread Jared McNeill
Author: jmcneill
Date: Thu Aug 25 10:20:27 2016
New Revision: 304794
URL: https://svnweb.freebsd.org/changeset/base/304794

Log:
  Expose DC1SW as a regulator switch. On Pine64 this is used to control EMAC
  PHY power.
  
  Reviewed by:  andrew, manu

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

Modified: head/sys/arm/allwinner/axp81x.c
==
--- head/sys/arm/allwinner/axp81x.c Thu Aug 25 10:14:56 2016
(r304793)
+++ head/sys/arm/allwinner/axp81x.c Thu Aug 25 10:20:27 2016
(r304794)
@@ -52,10 +52,17 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "iicbus_if.h"
+#include 
+
 #include "gpio_if.h"
+#include "iicbus_if.h"
+#include "regdev_if.h"
+
+MALLOC_DEFINE(M_AXP81X_REG, "AXP81x regulator", "AXP81x power regulator");
 
 #defineAXP_ICTYPE  0x03
+#defineAXP_POWERCTL2   0x12
+#define AXP_POWERCTL2_DC1SW(1 << 7)
 #defineAXP_POWERBAT0x32
 #define AXP_POWERBAT_SHUTDOWN  (1 << 7)
 #defineAXP_IRQEN1  0x40
@@ -96,6 +103,37 @@ static struct resource_spec axp81x_spec[
{ -1, 0 }
 };
 
+struct axp81x_regdef {
+   intptr_tid;
+   char*name;
+   char*supply_name;
+   uint8_t enable_reg;
+   uint8_t enable_mask;
+};
+
+enum axp81x_reg_id {
+   AXP81X_REG_ID_DC1SW
+};
+
+static struct axp81x_regdef axp81x_regdefs[] = {
+   {
+   .id = AXP81X_REG_ID_DC1SW,
+   .name = "dc1sw",
+   .enable_reg = AXP_POWERCTL2,
+   .enable_mask = AXP_POWERCTL2_DC1SW,
+   },
+};
+
+struct axp81x_softc;
+
+struct axp81x_reg_sc {
+   struct regnode  *regnode;
+   device_tbase_dev;
+   struct axp81x_regdef*def;
+   phandle_t   xref;
+   struct regnode_std_param *param;
+};
+
 struct axp81x_softc {
struct resource *res;
uint16_taddr;
@@ -103,6 +141,10 @@ struct axp81x_softc {
device_tgpiodev;
struct mtx  mtx;
int busy;
+
+   /* Regulators */
+   struct axp81x_reg_sc**regs;
+   int nregs;
 };
 
 #defineAXP_LOCK(sc)mtx_lock(&(sc)->mtx)
@@ -150,6 +192,56 @@ axp81x_write(device_t dev, uint8_t reg, 
return (iicbus_transfer(dev, msg, 2));
 }
 
+static int
+axp81x_regnode_init(struct regnode *regnode)
+{
+   return (0);
+}
+
+static int
+axp81x_regnode_enable(struct regnode *regnode, bool enable, int *udelay)
+{
+   struct axp81x_reg_sc *sc;
+   uint8_t val;
+
+   sc = regnode_get_softc(regnode);
+
+   axp81x_read(sc->base_dev, sc->def->enable_reg, , 1);
+   if (enable)
+   val |= sc->def->enable_mask;
+   else
+   val &= ~sc->def->enable_mask;
+   axp81x_write(sc->base_dev, sc->def->enable_reg, val);
+
+   *udelay = 0;
+
+   return (0);
+}
+
+static int
+axp81x_regnode_set_voltage(struct regnode *regnode, int min_uvolt,
+int max_uvolt, int *udelay)
+{
+   return (ENXIO);
+}
+
+static int
+axp81x_regnode_get_voltage(struct regnode *regnode, int *uvolt)
+{
+   return (ENXIO);
+}
+
+static regnode_method_t axp81x_regnode_methods[] = {
+   /* Regulator interface */
+   REGNODEMETHOD(regnode_init, axp81x_regnode_init),
+   REGNODEMETHOD(regnode_enable,   axp81x_regnode_enable),
+   REGNODEMETHOD(regnode_set_voltage,  axp81x_regnode_set_voltage),
+   REGNODEMETHOD(regnode_get_voltage,  axp81x_regnode_get_voltage),
+   REGNODEMETHOD_END
+};
+DEFINE_CLASS_1(axp81x_regnode, axp81x_regnode_class, axp81x_regnode_methods,
+sizeof(struct axp81x_reg_sc), regnode_class);
+
 static void
 axp81x_shutdown(void *devp, int howto)
 {
@@ -417,6 +509,56 @@ axp81x_get_node(device_t dev, device_t b
return (ofw_bus_get_node(dev));
 }
 
+static struct axp81x_reg_sc *
+axp81x_reg_attach(device_t dev, phandle_t node,
+struct axp81x_regdef *def)
+{
+   struct axp81x_reg_sc *reg_sc;
+   struct regnode_init_def initdef;
+   struct regnode *regnode;
+
+   memset(, 0, sizeof(initdef));
+   regulator_parse_ofw_stdparam(dev, node, );
+   initdef.id = def->id;
+   initdef.ofw_node = node;
+   regnode = regnode_create(dev, _regnode_class, );
+   if (regnode == NULL) {
+   device_printf(dev, "cannot create regulator\n");
+   return (NULL);
+   }
+
+   reg_sc = regnode_get_softc(regnode);
+   reg_sc->regnode = regnode;
+   reg_sc->base_dev = dev;
+   reg_sc->def = def;
+   reg_sc->xref = OF_xref_from_node(node);
+   reg_sc->param = regnode_get_stdparam(regnode);
+
+   regnode_register(regnode);
+
+   return (reg_sc);
+}
+
+static int

svn commit: r304793 - head/sys/arm/allwinner

2016-08-25 Thread Jared McNeill
Author: jmcneill
Date: Thu Aug 25 10:14:56 2016
New Revision: 304793
URL: https://svnweb.freebsd.org/changeset/base/304793

Log:
  Remove dependency on allwinner_soc_family() as it is not available on arm64.
  
  Reviewed by:  andrew, manu

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

Modified: head/sys/arm/allwinner/aw_rtc.c
==
--- head/sys/arm/allwinner/aw_rtc.c Thu Aug 25 09:16:25 2016
(r304792)
+++ head/sys/arm/allwinner/aw_rtc.c Thu Aug 25 10:14:56 2016
(r304793)
@@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$");
 #defineLOSC_MAGIC  0x16aa
 #defineLOSC_BUSY_MASK  0x0380
 
-#defineIS_SUN7I(allwinner_soc_family() == 
ALLWINNERSOC_SUN7I)
+#defineIS_SUN7I(sc->type == A20_RTC)
 
 #defineYEAR_MIN(IS_SUN7I ? 1970 : 2010)
 #defineYEAR_MAX(IS_SUN7I ? 2100 : 2073)
@@ -108,6 +108,7 @@ static struct ofw_compat_data compat_dat
 
 struct aw_rtc_softc {
struct resource *res;
+   int type;
bus_size_t  rtc_date;
bus_size_t  rtc_time;
 };
@@ -169,8 +170,9 @@ aw_rtc_attach(device_t dev)
device_printf(dev, "could not allocate resources\n");
return (ENXIO);
}
-   
-   switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) {
+
+   sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
+   switch (sc->type) {
case A10_RTC:
case A20_RTC:
sc->rtc_date = A10_RTC_DATE_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: r304792 - stable/11/sys/netinet

2016-08-25 Thread Michael Tuexen
Author: tuexen
Date: Thu Aug 25 09:16:25 2016
New Revision: 304792
URL: https://svnweb.freebsd.org/changeset/base/304792

Log:
  MFC r304543:
  Unbreak sctp_connectx().
  
  MFC r304573:
  Remove duplicate code, which is not protected by the appropriate locks.
  
  MFC r304579:
  Improve the locking when sending user messages.
  
  First, keep a ref count on the stcb after looking it up, as
  done in the other lookup cases.
  Second, before looking again at sp, ensure that it is not
  freed, because the assoc is about to be freed.

Modified:
  stable/11/sys/netinet/sctp_output.c
  stable/11/sys/netinet/sctp_usrreq.c
  stable/11/sys/netinet/sctputil.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/sctp_output.c
==
--- stable/11/sys/netinet/sctp_output.c Thu Aug 25 05:50:19 2016
(r304791)
+++ stable/11/sys/netinet/sctp_output.c Thu Aug 25 09:16:25 2016
(r304792)
@@ -12639,7 +12639,10 @@ sctp_lower_sosend(struct socket *so,
}
SCTP_INP_RUNLOCK(inp);
} else if (sinfo_assoc_id) {
-   stcb = sctp_findassociation_ep_asocid(inp, sinfo_assoc_id, 0);
+   stcb = sctp_findassociation_ep_asocid(inp, sinfo_assoc_id, 1);
+   if (stcb != NULL) {
+   hold_tcblock = 1;
+   }
} else if (addr) {
/*-
 * Since we did not use findep we must
@@ -13404,6 +13407,10 @@ skip_preblock:
}
}
SCTP_TCB_SEND_LOCK(stcb);
+   if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
+   SCTP_TCB_SEND_UNLOCK(stcb);
+   goto out_unlocked;
+   }
if (sp) {
if (sp->msg_is_complete == 0) {
strm->last_msg_incomplete = 1;

Modified: stable/11/sys/netinet/sctp_usrreq.c
==
--- stable/11/sys/netinet/sctp_usrreq.c Thu Aug 25 05:50:19 2016
(r304791)
+++ stable/11/sys/netinet/sctp_usrreq.c Thu Aug 25 09:16:25 2016
(r304792)
@@ -1506,11 +1506,6 @@ sctp_do_connect_x(struct socket *so, str
sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
}
SCTP_TCB_UNLOCK(stcb);
-   if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) {
-   stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED;
-   /* Set the connected flag so we can queue data */
-   soisconnecting(so);
-   }
 out_now:
if (creat_lock_on) {
SCTP_ASOC_CREATE_UNLOCK(inp);

Modified: stable/11/sys/netinet/sctputil.c
==
--- stable/11/sys/netinet/sctputil.cThu Aug 25 05:50:19 2016
(r304791)
+++ stable/11/sys/netinet/sctputil.cThu Aug 25 09:16:25 2016
(r304792)
@@ -6356,7 +6356,7 @@ sctp_connectx_helper_find(struct sctp_in
struct sctp_tcb *stcb = NULL;
unsigned int incr, at, i;
 
-   at = incr = 0;
+   at = 0;
sa = addr;
*error = *num_v6 = *num_v4 = 0;
/* account and validate addresses */
@@ -6364,6 +6364,7 @@ sctp_connectx_helper_find(struct sctp_in
switch (sa->sa_family) {
 #ifdef INET
case AF_INET:
+   incr = (unsigned int)sizeof(struct sockaddr_in);
if (sa->sa_len != incr) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTPUTIL, EINVAL);
*error = EINVAL;
@@ -6371,7 +6372,6 @@ sctp_connectx_helper_find(struct sctp_in
return (NULL);
}
(*num_v4) += 1;
-   incr = (unsigned int)sizeof(struct sockaddr_in);
break;
 #endif
 #ifdef INET6
@@ -6387,6 +6387,7 @@ sctp_connectx_helper_find(struct sctp_in
*bad_addr = 1;
return (NULL);
}
+   incr = (unsigned int)sizeof(struct 
sockaddr_in6);
if (sa->sa_len != incr) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTPUTIL, EINVAL);
*error = EINVAL;
@@ -6394,7 +6395,6 @@ sctp_connectx_helper_find(struct sctp_in
return (NULL);
}
(*num_v6) += 1;
-   incr = (unsigned int)sizeof(struct 
sockaddr_in6);
break;
}
 #endif
___
svn-src-all@freebsd.org 

Re: svn commit: r303988 - head/lib/libc/gen

2016-08-25 Thread Guido Falsi
On 08/24/16 21:49, Ed Schouten wrote:
> 2016-08-24 20:30 GMT+02:00 Bryan Drewery :
>> That would only fix stable/11, stable/10, stable/9, releng/11.0.
>>
>> It won't fix releng/10.3, releng/10.2, releng/10.1, releng/9.3, etc...
>> without an EN.
>>
>> It won't fix stable/11 - 1, stable/10 - 1, etc.
>>
>> It will never fix releng/8.4 (unsupported releases) since so@ won't EN
>> to those.  People do sometimes need to build these older releases still.
>>
>> It creates a line in the sand where we can never build checkouts older
>> than where the fix was at.  So I don't think it is the appropriate fix.
> 
> Good point!
> 
> Just for the record: Bryan and I just discussed this matter in more
> detail on IRC. We came up with a workaround that should be pretty
> good.
> 
> Attached is a patch for  that adds some extra logic, so that
> any calls to basename() and dirname() will expand to calls to
> __old_basename() and __old_dirname(). Using __sym_compat(), these will
> cause the compiler to generate calls to basename@FBSD_1.0 and
> dirname@FBSD_1.0.
> 
> According to Bryan, this fixes the problems he was experiencing.
> 

I just tried using the attached patch to build a nanobsd image, host is
amd64 head at r304773 with this patch applied, target is i386
releng/11.0 at r304729.

I've got it failing early during build:

--- _bootstrap-tools-usr.bin/xinstall ---
xinstall.o: In function `install':
/usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall/xinstall.c:(.text+0xf55):
undefined reference to `basename@FBSD_1.0'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [xinstall] Error code 1

make[3]: stopped in /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall
1 error

make[3]: stopped in /usr/local/nanobsd/rr-trunk/src/usr.bin/xinstall
*** [_bootstrap-tools-usr.bin/xinstall] Error code 2

Did I miss some needed procedure?

Thanks!

-- 
Guido Falsi 
___
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"