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

2016-08-16 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 17 05:57:10 2016
New Revision: 304256
URL: https://svnweb.freebsd.org/changeset/base/304256

Log:
  hyperv/hn: Get rid of unused bits
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7518

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 17 05:45:57 2016
(r304255)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 17 05:57:10 2016
(r304256)
@@ -690,8 +690,6 @@ hv_nv_on_device_add(struct hn_softc *sc,
 
/* Initialize the NetVSC channel extension */
 
-   sema_init(_dev->channel_init_sema, 0, "netdev_sema");
-
/*
 * Open the channel
 */
@@ -722,7 +720,6 @@ cleanup:
 * Free the packet buffers on the netvsc device packet queue.
 * Release other resources.
 */
-   sema_destroy(_dev->channel_init_sema);
free(net_dev, M_NETVSC);
 
return (NULL);
@@ -747,7 +744,6 @@ hv_nv_on_device_remove(struct hn_softc *
 
vmbus_chan_close(sc->hn_prichan);
 
-   sema_destroy(_dev->channel_init_sema);
free(net_dev, M_NETVSC);
 
return (0);

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Aug 17 05:45:57 2016
(r304255)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Aug 17 05:57:10 2016
(r304256)
@@ -177,834 +177,6 @@ typedef struct rndis_recv_scale_param_ {
 uint32_t processor_masks_entry_size;
 } rndis_recv_scale_param;
 
-typedef enum nvsp_msg_type_ {
-   nvsp_msg_type_none  = 0,
-
-   /*
-* Init Messages
-*/
-   nvsp_msg_type_init  = 1,
-   nvsp_msg_type_init_complete = 2,
-
-   nvsp_version_msg_start  = 100,
-
-   /*
-* Version 1 Messages
-*/
-   nvsp_msg_1_type_send_ndis_vers  = nvsp_version_msg_start,
-
-   nvsp_msg_1_type_send_rx_buf,
-   nvsp_msg_1_type_send_rx_buf_complete,
-   nvsp_msg_1_type_revoke_rx_buf,
-
-   nvsp_msg_1_type_send_send_buf,
-   nvsp_msg_1_type_send_send_buf_complete,
-   nvsp_msg_1_type_revoke_send_buf,
-
-   nvsp_msg_1_type_send_rndis_pkt,
-   nvsp_msg_1_type_send_rndis_pkt_complete,
-
-   /*
-* Version 2 Messages
-*/
-   nvsp_msg_2_type_send_chimney_delegated_buf,
-   nvsp_msg_2_type_send_chimney_delegated_buf_complete,
-   nvsp_msg_2_type_revoke_chimney_delegated_buf,
-
-   nvsp_msg_2_type_resume_chimney_rx_indication,
-
-   nvsp_msg_2_type_terminate_chimney,
-   nvsp_msg_2_type_terminate_chimney_complete,
-
-   nvsp_msg_2_type_indicate_chimney_event,
-
-   nvsp_msg_2_type_send_chimney_packet,
-   nvsp_msg_2_type_send_chimney_packet_complete,
-
-   nvsp_msg_2_type_post_chimney_rx_request,
-   nvsp_msg_2_type_post_chimney_rx_request_complete,
-
-   nvsp_msg_2_type_alloc_rx_buf,
-   nvsp_msg_2_type_alloc_rx_buf_complete,
-
-   nvsp_msg_2_type_free_rx_buf,
-
-   nvsp_msg_2_send_vmq_rndis_pkt,
-   nvsp_msg_2_send_vmq_rndis_pkt_complete,
-
-   nvsp_msg_2_type_send_ndis_config,
-
-   nvsp_msg_2_type_alloc_chimney_handle,
-   nvsp_msg_2_type_alloc_chimney_handle_complete,
-
-   nvsp_msg2_max = nvsp_msg_2_type_alloc_chimney_handle_complete,
-
-   /*
-* Version 4 Messages
-*/
-   nvsp_msg4_type_send_vf_association,
-   nvsp_msg4_type_switch_data_path,
-   nvsp_msg4_type_uplink_connect_state_deprecated,
-
-   nvsp_msg4_max = nvsp_msg4_type_uplink_connect_state_deprecated,
-
-   /*
-* Version 5 Messages
-*/
-   nvsp_msg5_type_oid_query_ex,
-   nvsp_msg5_type_oid_query_ex_comp,
-   nvsp_msg5_type_subchannel,
-   nvsp_msg5_type_send_indirection_table,
-
-   nvsp_msg5_max = nvsp_msg5_type_send_indirection_table,
-} nvsp_msg_type;
-
-typedef enum nvsp_status_ {
-   nvsp_status_none = 0,
-   nvsp_status_success,
-   nvsp_status_failure,
-   /* Deprecated */
-   nvsp_status_prot_vers_range_too_new,
-   /* Deprecated */
-   nvsp_status_prot_vers_range_too_old,
-   nvsp_status_invalid_rndis_pkt,
-   nvsp_status_busy,
-   nvsp_status_max,
-} nvsp_status;
-
-typedef struct nvsp_msg_hdr_ {
-   uint32_tmsg_type;
-} __packed nvsp_msg_hdr;
-
-/*
- * Init Messages
- */
-
-/*
- * This message is used by the VSC to initialize the channel
- * after the channels has been opened. This message should 
- * never include anything other then versioning (i.e. this
- * message will be the same for ever).
- *
- * 

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

2016-08-16 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 17 05:45:57 2016
New Revision: 304255
URL: https://svnweb.freebsd.org/changeset/base/304255

Log:
  hyperv/hn: Remove reference to nvsp_status
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7517

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 17 05:34:02 2016
(r304254)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 17 05:45:57 2016
(r304255)
@@ -852,7 +852,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st
netvsc_packet *net_vsc_pkt = _pkt;
int count = 0;
int i = 0;
-   int status = nvsp_status_success;
+   int status = HN_NVS_STATUS_OK;
 
/* Make sure that this is a RNDIS message. */
nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr);
@@ -874,15 +874,16 @@ hv_nv_on_receive(netvsc_dev *net_dev, st
 
/* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */
for (i = 0; i < count; i++) {
-   net_vsc_pkt->status = nvsp_status_success;
+   net_vsc_pkt->status = HN_NVS_STATUS_OK;
net_vsc_pkt->data = ((uint8_t *)net_dev->rx_buf +
pkt->cp_rxbuf[i].rb_ofs);
net_vsc_pkt->tot_data_buf_len = pkt->cp_rxbuf[i].rb_len;
 
hv_rf_on_receive(net_dev, rxr, net_vsc_pkt);
-   if (net_vsc_pkt->status != nvsp_status_success) {
-   status = nvsp_status_failure;
-   }
+
+   /* XXX pretty broken; whack it */
+   if (net_vsc_pkt->status != HN_NVS_STATUS_OK)
+   status = HN_NVS_STATUS_FAILED;
}

/*

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cWed Aug 17 05:34:02 
2016(r304254)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cWed Aug 17 05:45:57 
2016(r304255)
@@ -544,7 +544,7 @@ hv_rf_receive_data(struct hn_rx_ring *rx
 
pkt->tot_data_buf_len -= data_offset;
if (pkt->tot_data_buf_len < rndis_pkt->data_length) {
-   pkt->status = nvsp_status_failure;
+   pkt->status = HN_NVS_STATUS_FAILED;
if_printf(rxr->hn_ifp,
"total length %u is less than data length %u\n",
pkt->tot_data_buf_len, rndis_pkt->data_length);
@@ -555,7 +555,7 @@ hv_rf_receive_data(struct hn_rx_ring *rx
pkt->data = (void *)((unsigned long)pkt->data + data_offset);
 
if (hv_rf_find_recvinfo(rndis_pkt, )) {
-   pkt->status = nvsp_status_failure;
+   pkt->status = HN_NVS_STATUS_FAILED;
if_printf(rxr->hn_ifp, "recvinfo parsing failed\n");
return;
}
@@ -580,13 +580,13 @@ hv_rf_on_receive(netvsc_dev *net_dev,
 
/* Make sure the rndis device state is initialized */
if (net_dev->extension == NULL) {
-   pkt->status = nvsp_status_failure;
+   pkt->status = HN_NVS_STATUS_FAILED;
return (ENODEV);
}
 
rndis_dev = (rndis_device *)net_dev->extension;
if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED) {
-   pkt->status = nvsp_status_failure;
+   pkt->status = HN_NVS_STATUS_FAILED;
return (EINVAL);
}
 
___
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: r304254 - head/sys/dev/hyperv/netvsc

2016-08-16 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 17 05:34:02 2016
New Revision: 304254
URL: https://svnweb.freebsd.org/changeset/base/304254

Log:
  hyperv/hn: Remove reference to nvsp_msg
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7516

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 17 05:25:47 2016
(r304253)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 17 05:34:02 2016
(r304254)
@@ -72,7 +72,7 @@ static void hv_nv_on_receive(netvsc_dev 
 const struct vmbus_chanpkt_hdr *pkt);
 static void hn_nvs_sent_none(struct hn_send_ctx *sndc,
 struct netvsc_dev_ *net_dev, struct vmbus_channel *chan,
-const struct nvsp_msg_ *msg, int);
+const void *, int);
 
 static struct hn_send_ctx  hn_send_ctx_none =
 HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL);
@@ -756,16 +756,16 @@ hv_nv_on_device_remove(struct hn_softc *
 void
 hn_nvs_sent_xact(struct hn_send_ctx *sndc,
 struct netvsc_dev_ *net_dev __unused, struct vmbus_channel *chan __unused,
-const struct nvsp_msg_ *msg, int dlen)
+const void *data, int dlen)
 {
 
-   vmbus_xact_wakeup(sndc->hn_cbarg, msg, dlen);
+   vmbus_xact_wakeup(sndc->hn_cbarg, data, dlen);
 }
 
 static void
 hn_nvs_sent_none(struct hn_send_ctx *sndc __unused,
 struct netvsc_dev_ *net_dev __unused, struct vmbus_channel *chan __unused,
-const struct nvsp_msg_ *msg __unused, int dlen __unused)
+const void *data __unused, int dlen __unused)
 {
/* EMPTY */
 }

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Wed Aug 17 05:25:47 
2016(r304253)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Wed Aug 17 05:34:02 
2016(r304254)
@@ -792,8 +792,7 @@ hn_txeof(struct hn_tx_ring *txr)
 
 static void
 hn_tx_done(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev,
-struct vmbus_channel *chan, const struct nvsp_msg_ *msg __unused,
-int dlen __unused)
+struct vmbus_channel *chan, const void *data __unused, int dlen __unused)
 {
struct hn_txdesc *txd = sndc->hn_cbarg;
struct hn_tx_ring *txr;

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cWed Aug 17 05:25:47 
2016(r304253)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cWed Aug 17 05:34:02 
2016(r304254)
@@ -93,10 +93,10 @@ hv_rf_send_offload_request(struct hn_sof
 
 static void hn_rndis_sent_halt(struct hn_send_ctx *sndc,
 struct netvsc_dev_ *net_dev, struct vmbus_channel *chan,
-const struct nvsp_msg_ *msg, int dlen);
+const void *data, int dlen);
 static void hn_rndis_sent_cb(struct hn_send_ctx *sndc,
 struct netvsc_dev_ *net_dev, struct vmbus_channel *chan,
-const struct nvsp_msg_ *msg, int dlen);
+const void *data, int dlen);
 
 /*
  * Set the Per-Packet-Info with the specified type
@@ -1272,7 +1272,7 @@ hv_rf_on_close(struct hn_softc *sc)
 
 static void
 hn_rndis_sent_cb(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev,
-struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused,
+struct vmbus_channel *chan __unused, const void *data __unused,
 int dlen __unused)
 {
if (sndc->hn_chim_idx != HN_NVS_CHIM_IDX_INVALID)
@@ -1281,7 +1281,7 @@ hn_rndis_sent_cb(struct hn_send_ctx *snd
 
 static void
 hn_rndis_sent_halt(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev,
-struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused,
+struct vmbus_channel *chan __unused, const void *data __unused,
 int dlen __unused)
 {
rndis_request *request = sndc->hn_cbarg;

Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h
==
--- head/sys/dev/hyperv/netvsc/if_hnvar.h   Wed Aug 17 05:25:47 2016
(r304253)
+++ head/sys/dev/hyperv/netvsc/if_hnvar.h   Wed Aug 17 05:34:02 2016
(r304254)
@@ -42,7 +42,7 @@ struct hn_send_ctx;
 
 typedef void   (*hn_sent_callback_t)
(struct hn_send_ctx *, struct netvsc_dev_ *,
-struct vmbus_channel *, const struct nvsp_msg_ *, int);
+struct vmbus_channel *, const void *, int);
 
 struct hn_send_ctx {
hn_sent_callback_t  hn_cb;
@@ -98,7 +98,7 @@ hn_nvs_send_sglist(struct vmbus_channel 
 
 void   hn_nvs_sent_xact(struct hn_send_ctx *sndc,
 

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

2016-08-16 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 17 05:25:47 2016
New Revision: 304253
URL: https://svnweb.freebsd.org/changeset/base/304253

Log:
  hyperv/hn: Simplify RNDIS RX packets acknowledgement.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7515

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 17 05:14:26 2016
(r304252)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 17 05:25:47 2016
(r304253)
@@ -902,20 +902,17 @@ static void
 hv_nv_on_receive_completion(struct vmbus_channel *chan, uint64_t tid,
 uint32_t status)
 {
-   nvsp_msg rx_comp_msg;
+   struct hn_nvs_rndis_ack ack;
int retries = 0;
int ret = 0;

-   rx_comp_msg.hdr.msg_type = nvsp_msg_1_type_send_rndis_pkt_complete;
-
-   /* Pass in the status */
-   rx_comp_msg.msgs.vers_1_msgs.send_rndis_pkt_complete.status =
-   status;
+   ack.nvs_type = HN_NVS_TYPE_RNDIS_ACK;
+   ack.nvs_status = status;
 
 retry_send_cmplt:
/* Send the completion */
-   ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, 0,
-   _comp_msg, sizeof(nvsp_msg), tid);
+   ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP,
+   VMBUS_CHANPKT_FLAG_NONE, , sizeof(ack), tid);
if (ret == 0) {
/* success */
/* no-op */

Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h
==
--- head/sys/dev/hyperv/netvsc/if_hnreg.h   Wed Aug 17 05:14:26 2016
(r304252)
+++ head/sys/dev/hyperv/netvsc/if_hnreg.h   Wed Aug 17 05:25:47 2016
(r304253)
@@ -44,6 +44,7 @@
  * NVS message transacion status codes.
  */
 #define HN_NVS_STATUS_OK   1
+#define HN_NVS_STATUS_FAILED   2
 
 /*
  * NVS request/response message types.
@@ -58,6 +59,7 @@
 #define HN_NVS_TYPE_CHIM_CONNRESP  105
 #define HN_NVS_TYPE_CHIM_DISCONN   106
 #define HN_NVS_TYPE_RNDIS  107
+#define HN_NVS_TYPE_RNDIS_ACK  108
 #define HN_NVS_TYPE_NDIS_CONF  125
 #define HN_NVS_TYPE_VFASSOC_NOTE   128 /* notification */
 #define HN_NVS_TYPE_SET_DATAPATH   129
@@ -199,4 +201,11 @@ struct hn_nvs_rndis {
 } __packed;
 CTASSERT(sizeof(struct hn_nvs_rndis) >= HN_NVS_REQSIZE_MIN);
 
+struct hn_nvs_rndis_ack {
+   uint32_tnvs_type;   /* HN_NVS_TYPE_RNDIS_ACK */
+   uint32_tnvs_status; /* HN_NVS_STATUS_ */
+   uint8_t nvs_rsvd[24];
+} __packed;
+CTASSERT(sizeof(struct hn_nvs_rndis_ack) >= HN_NVS_REQSIZE_MIN);
+
 #endif /* !_IF_HNREG_H_ */
___
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: r304252 - head/sys/dev/hyperv/netvsc

2016-08-16 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 17 05:14:26 2016
New Revision: 304252
URL: https://svnweb.freebsd.org/changeset/base/304252

Log:
  hyperv/hn: Ignore the useless TX table.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7514

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 17 05:02:18 2016
(r304251)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Aug 17 05:14:26 2016
(r304252)
@@ -930,44 +930,17 @@ retry_send_cmplt:
}
 }
 
-/*
- * Net VSC receiving vRSS send table from VSP
- */
 static void
-hv_nv_send_table(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt)
+hn_proc_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt)
 {
-   netvsc_dev *net_dev;
-   const nvsp_msg *nvsp_msg_pkt;
-   int i;
-   uint32_t count;
-   const uint32_t *table;
-
-   net_dev = hv_nv_get_inbound_net_device(sc);
-   if (!net_dev)
-   return;
+   const struct hn_nvs_hdr *hdr;
 
-   nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkt);
-
-   if (nvsp_msg_pkt->hdr.msg_type !=
-   nvsp_msg5_type_send_indirection_table) {
-   printf("Netvsc: !Warning! receive msg type not "
-   "send_indirection_table. type = %d\n",
-   nvsp_msg_pkt->hdr.msg_type);
+   hdr = VMBUS_CHANPKT_CONST_DATA(pkt);
+   if (hdr->nvs_type == HN_NVS_TYPE_TXTBL_NOTE) {
+   /* Useless; ignore */
return;
}
-
-   count = nvsp_msg_pkt->msgs.vers_5_msgs.send_table.count;
-   if (count != VRSS_SEND_TABLE_SIZE) {
-   printf("Netvsc: Received wrong send table size: %u\n", count);
-   return;
-   }
-
-   table = (const uint32_t *)
-   ((const uint8_t *)_msg_pkt->msgs.vers_5_msgs.send_table +
-nvsp_msg_pkt->msgs.vers_5_msgs.send_table.offset);
-
-   for (i = 0; i < count; i++)
-   net_dev->vrss_send_table[i] = table[i];
+   if_printf(sc->hn_ifp, "got notify, nvs type %u\n", hdr->nvs_type);
 }
 
 /*
@@ -1005,7 +978,7 @@ hv_nv_on_channel_callback(struct vmbus_c
hv_nv_on_receive(net_dev, rxr, chan, 
pkt);
break;
case VMBUS_CHANPKT_TYPE_INBAND:
-   hv_nv_send_table(sc, pkt);
+   hn_proc_notify(sc, pkt);
break;
default:
if_printf(rxr->hn_ifp,

Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h
==
--- head/sys/dev/hyperv/netvsc/if_hnreg.h   Wed Aug 17 05:02:18 2016
(r304251)
+++ head/sys/dev/hyperv/netvsc/if_hnreg.h   Wed Aug 17 05:14:26 2016
(r304252)
@@ -59,8 +59,11 @@
 #define HN_NVS_TYPE_CHIM_DISCONN   106
 #define HN_NVS_TYPE_RNDIS  107
 #define HN_NVS_TYPE_NDIS_CONF  125
+#define HN_NVS_TYPE_VFASSOC_NOTE   128 /* notification */
+#define HN_NVS_TYPE_SET_DATAPATH   129
 #define HN_NVS_TYPE_SUBCH_REQ  133
 #define HN_NVS_TYPE_SUBCH_RESP 133 /* same as SUBCH_REQ */
+#define HN_NVS_TYPE_TXTBL_NOTE 134 /* notification */
 
 /*
  * Any size less than this one will _not_ work, e.g. hn_nvs_init
___
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: r304251 - head/sys/dev/hyperv/storvsc

2016-08-16 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug 17 05:02:18 2016
New Revision: 304251
URL: https://svnweb.freebsd.org/changeset/base/304251

Log:
  hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error.
  
  SRB status is set to 0x20 by the hypervisor, if the specified LUN is
  unaccessible, and even worse the INQUIRY response will not be set by
  the hypervisor at all under this situation.  Additionally, SRB status
  is 0x20 too, for TUR on an unaccessible LUN.
  
  Deliver CAM_SEL_TIMEOUT to CAM upon SRB status errors as suggested by
  Scott Long, other values seems improper.
  
  This commit fixes the Hyper-V disk hotplug support.
  
  Submitted by: Hongjiang Zhang 
  MFC after:3 days
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7521

Modified:
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  head/sys/dev/hyperv/storvsc/hv_vstorage.h

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Aug 17 
04:41:47 2016(r304250)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Aug 17 
05:02:18 2016(r304251)
@@ -742,6 +742,7 @@ hv_storvsc_on_iocompletion(struct storvs
 * because the fields will be used later in storvsc_io_done().
 */
request->vstor_packet.u.vm_srb.scsi_status = vm_srb->scsi_status;
+   request->vstor_packet.u.vm_srb.srb_status = vm_srb->srb_status;
request->vstor_packet.u.vm_srb.transfer_len = vm_srb->transfer_len;
 
if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) &&
@@ -2007,28 +2008,6 @@ create_storvsc_request(union ccb *ccb, s
return(0);
 }
 
-/*
- * SCSI Inquiry checks qualifier and type.
- * If qualifier is 011b, means the device server is not capable
- * of supporting a peripheral device on this logical unit, and
- * the type should be set to 1Fh.
- * 
- * Return 1 if it is valid, 0 otherwise.
- */
-static inline int
-is_inquiry_valid(const struct scsi_inquiry_data *inq_data)
-{
-   uint8_t type;
-   if (SID_QUAL(inq_data) != SID_QUAL_LU_CONNECTED) {
-   return (0);
-   }
-   type = SID_TYPE(inq_data);
-   if (type == T_NODEVICE) {
-   return (0);
-   }
-   return (1);
-}
-
 /**
  * @brief completion function before returning to CAM
  *
@@ -2047,7 +2026,6 @@ storvsc_io_done(struct hv_storvsc_reques
struct vmscsi_req *vm_srb = >vstor_packet.u.vm_srb;
bus_dma_segment_t *ori_sglist = NULL;
int ori_sg_count = 0;
-
/* destroy bounce buffer if it is used */
if (reqp->bounce_sgl_count) {
ori_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr;
@@ -2102,88 +2080,71 @@ storvsc_io_done(struct hv_storvsc_reques
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
if (vm_srb->scsi_status == SCSI_STATUS_OK) {
const struct scsi_generic *cmd;
-   /*
-* Check whether the data for INQUIRY cmd is valid or
-* not.  Windows 10 and Windows 2016 send all zero
-* inquiry data to VM even for unpopulated slots.
-*/
+
+   if (vm_srb->srb_status != SRB_STATUS_SUCCESS) {
+   if (vm_srb->srb_status == SRB_STATUS_INVALID_LUN) {
+   xpt_print(ccb->ccb_h.path, "invalid LUN %d\n",
+   vm_srb->lun);
+   } else {
+   xpt_print(ccb->ccb_h.path, "Unknown SRB flag: 
%d\n",
+   vm_srb->srb_status);
+   }
+   /*
+* If there are errors, for example, invalid LUN,
+* host will inform VM through SRB status.
+*/
+   ccb->ccb_h.status |= CAM_SEL_TIMEOUT;
+   } else {
+   ccb->ccb_h.status |= CAM_REQ_CMP;
+   }
+
cmd = (const struct scsi_generic *)
((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
 csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes);
if (cmd->opcode == INQUIRY) {
-   /*
-* The host of Windows 10 or 2016 server will response
-* the inquiry request with invalid data for unexisted 
device:
-   [0x7f 0x0 0x5 0x2 0x1f ... ]
-* But on windows 2012 R2, the response is:
-   [0x7f 0x0 0x0 0x0 0x0 ]
-* That is why here wants to validate the inquiry response.
-* The validation will skip the INQUIRY whose response is 
short,
-* which is less than SHORT_INQUIRY_LENGTH (36).
-*
-* For more information about INQUIRY, please refer to:
- 

svn commit: r304249 - head/sys/dev/qlxgbe

2016-08-16 Thread David C Somayajulu
Author: davidcs
Date: Wed Aug 17 02:40:17 2016
New Revision: 304249
URL: https://svnweb.freebsd.org/changeset/base/304249

Log:
  Add support for set/get cam search mode
  
  MFC after: 5 days

Modified:
  head/sys/dev/qlxgbe/ql_dbg.h
  head/sys/dev/qlxgbe/ql_hw.c
  head/sys/dev/qlxgbe/ql_hw.h
  head/sys/dev/qlxgbe/ql_isr.c
  head/sys/dev/qlxgbe/ql_os.c
  head/sys/dev/qlxgbe/ql_ver.h

Modified: head/sys/dev/qlxgbe/ql_dbg.h
==
--- head/sys/dev/qlxgbe/ql_dbg.hWed Aug 17 01:57:58 2016
(r304248)
+++ head/sys/dev/qlxgbe/ql_dbg.hWed Aug 17 02:40:17 2016
(r304249)
@@ -52,6 +52,7 @@ extern void ql_dump_buf32(qla_host_t *ha
 #define INJCT_MBX_CMD_FAILURE  0x8
 #define INJCT_HEARTBEAT_FAILURE0x9
 #define INJCT_TEMPERATURE_FAILURE  0xA
+#define INJCT_M_GETCL_M_GETJCL_FAILURE 0xB
 
 #ifdef QL_DBG
 

Modified: head/sys/dev/qlxgbe/ql_hw.c
==
--- head/sys/dev/qlxgbe/ql_hw.c Wed Aug 17 01:57:58 2016(r304248)
+++ head/sys/dev/qlxgbe/ql_hw.c Wed Aug 17 02:40:17 2016(r304249)
@@ -74,6 +74,8 @@ static int qla_query_fw_dcbx_caps(qla_ho
 static int qla_set_port_config(qla_host_t *ha, uint32_t cfg_bits);
 static int qla_get_port_config(qla_host_t *ha, uint32_t *cfg_bits);
 static void qla_get_quick_stats(qla_host_t *ha);
+static int qla_set_cam_search_mode(qla_host_t *ha, uint32_t search_mode);
+static int qla_get_cam_search_mode(qla_host_t *ha);
 
 static void ql_minidump_free(qla_host_t *ha);
 
@@ -94,11 +96,22 @@ qla_sysctl_get_drvr_stats(SYSCTL_HANDLER
 
 ha = (qla_host_t *)arg1;
 
-   for (i = 0; i < ha->hw.num_sds_rings; i++) 
+   for (i = 0; i < ha->hw.num_sds_rings; i++) {
+
device_printf(ha->pci_dev,
"%s: sds_ring[%d] = %p\n", __func__,i,
(void *)ha->hw.sds[i].intr_count);
 
+   device_printf(ha->pci_dev,
+   "%s: sds_ring[%d].spurious_intr_count = %p\n",
+   __func__,
+   i, (void *)ha->hw.sds[i].spurious_intr_count);
+
+   device_printf(ha->pci_dev,
+   "%s: sds_ring[%d].rx_free = %d\n", __func__,i,
+   ha->hw.sds[i].rx_free);
+   }
+
for (i = 0; i < ha->hw.num_tx_rings; i++) 
device_printf(ha->pci_dev,
"%s: tx[%d] = %p\n", __func__,i,
@@ -255,6 +268,47 @@ qla_sysctl_set_port_cfg_exit:
 return err;
 }
 
+static int
+qla_sysctl_set_cam_search_mode(SYSCTL_HANDLER_ARGS)
+{
+   int err, ret = 0;
+   qla_host_t *ha;
+
+   err = sysctl_handle_int(oidp, , 0, req);
+
+   if (err || !req->newptr)
+   return (err);
+
+   ha = (qla_host_t *)arg1;
+
+   if ((ret == Q8_HW_CONFIG_CAM_SEARCH_MODE_INTERNAL) ||
+   (ret == Q8_HW_CONFIG_CAM_SEARCH_MODE_AUTO)) {
+   err = qla_set_cam_search_mode(ha, (uint32_t)ret);
+   } else {
+   device_printf(ha->pci_dev, "%s: ret = %d\n", __func__, ret);
+   }
+
+   return (err);
+}
+
+static int
+qla_sysctl_get_cam_search_mode(SYSCTL_HANDLER_ARGS)
+{
+   int err, ret = 0;
+   qla_host_t *ha;
+
+   err = sysctl_handle_int(oidp, , 0, req);
+
+   if (err || !req->newptr)
+   return (err);
+
+   ha = (qla_host_t *)arg1;
+   err = qla_get_cam_search_mode(ha);
+
+   return (err);
+}
+
+
 /*
  * Name: ql_hw_add_sysctls
  * Function: Add P3Plus specific sysctls
@@ -362,6 +416,24 @@ ql_hw_add_sysctls(qla_host_t *ha)
 " 1 = xmt only; 2 = rcv only;\n"
 );
 
+   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+   OID_AUTO, "set_cam_search_mode", CTLTYPE_INT | CTLFLAG_RW,
+   (void *)ha, 0,
+   qla_sysctl_set_cam_search_mode, "I",
+   "Set CAM Search Mode"
+   "\t 1 = search mode internal\n"
+   "\t 2 = search mode auto\n");
+
+   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+   OID_AUTO, "get_cam_search_mode", CTLTYPE_INT | CTLFLAG_RW,
+   (void *)ha, 0,
+   qla_sysctl_get_cam_search_mode, "I",
+   "Get CAM Search Mode"
+   "\t 1 = search mode internal\n"
+   "\t 2 = search mode auto\n");
+
 ha->hw.enable_9kb = 1;
 
 SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
@@ -407,7 +479,8 @@ ql_hw_add_sysctls(qla_host_t *ha)
 "\t\t\t 7: ocm: offchip memory rd_wr failure\n"

Re: svn commit: r303646 - head/sys/ofed/drivers/infiniband/ulp/ipoib

2016-08-16 Thread Gleb Smirnoff
On Tue, Aug 16, 2016 at 05:41:28PM -0700, Mark Johnston wrote:
M> > M> Log:
M> > M>   ipoib: Bound the number of egress mbufs buffered during pathrec 
lookups.
M> > M>   
M> > M>   In pathological situations where the master subnet manager becomes
M> > M>   unresponsive for an extended period, we may otherwise end up queuing 
all
M> > M>   of the system's mbufs while waiting for a response to a path record 
lookup.
M> > M>   
M> > M>   This addresses the same issue as commit 1e85b806f9 in Linux.
M> > M>   
M> > M>   Reviewed by:  cem, ngie
M> > M>   MFC after:2 weeks
M> > M>   Sponsored by: EMC / Isilon Storage Division
M> > M> 
M> > M> Modified:
M> > M>   head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
M> > M> 
M> > M> Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
M> > M> 
==
M> > M> --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug 
 1 22:19:23 2016(r303645)
M> > M> +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug 
 1 22:22:11 2016(r303646)
M> > M> @@ -660,7 +660,13 @@ ipoib_unicast_send(struct mbuf *mb, stru
M> > M> new_path = 1;
M> > M> }
M> > M> if (path) {
M> > M> -   _IF_ENQUEUE(>queue, mb);
M> > M> +   if (_IF_QLEN(>queue) < 
IPOIB_MAX_PATH_REC_QUEUE)
M> > M> +   _IF_ENQUEUE(>queue, mb);
M> > M> +   else {
M> > M> +   if_inc_counter(priv->dev, 
IFCOUNTER_OERRORS, 1);
M> > M> +   m_freem(mb);
M> > M> +   }
M> > 
M> > Shouldn't that be IFCOUNTER_ODROPS?
M> 
M> I'm not sure. I used IFCOUNTER_OERRORS to be consistent with other error
M> cases in this function. This error case doesn't represent the normal
M> source of outbound packet drops but rather indicates that a key routing
M> agent on the network is not responding. OQDROPS seems like it's
M> specifically for the case that we can't buffer packets because the
M> transmitter isn't keeping up.

I see. The fact that this is an if_queue has confused me. I expected that
it is an ifqueue belonging to an ifnet.

btw, may be this ifqueue can be reduced to mbufq.

-- 
Totus tuus, Glebius.
___
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: r304248 - head/sys/dev/qlxgbe

2016-08-16 Thread David C Somayajulu
Author: davidcs
Date: Wed Aug 17 01:57:58 2016
New Revision: 304248
URL: https://svnweb.freebsd.org/changeset/base/304248

Log:
  Add ql_minidump.h
  
  MFC after:5 days

Added:
  head/sys/dev/qlxgbe/ql_minidump.h   (contents, props changed)

Added: head/sys/dev/qlxgbe/ql_minidump.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/qlxgbe/ql_minidump.h   Wed Aug 17 01:57:58 2016
(r304248)
@@ -0,0 +1,470 @@
+/*
+ * Copyright (c) 2013-2016 Qlogic Corporation
+ * All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE 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 OWNER 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.
+ */
+
+/*
+ * File: ql_minidump.h
+ *
+ * $FreeBSD$
+ */
+#ifndef _QL_MINIDUMP_H_
+#define _QL_MINIDUMP_H_
+
+#define QL_DBG_STATE_ARRAY_LEN  16
+#define QL_DBG_CAP_SIZE_ARRAY_LEN   8
+#define QL_NO_OF_OCM_WINDOWS16
+
+
+typedef struct ql_mdump_tmplt_hdr {
+uint32_t  entry_type ;
+uint32_t  first_entry_offset ;
+uint32_t  size_of_template ;
+uint32_t  recommended_capture_mask;
+
+uint32_t  num_of_entries ;
+uint32_t  version ;
+uint32_t  driver_timestamp ;
+uint32_t  checksum ;
+
+uint32_t  driver_capture_mask ;
+uint32_t  driver_info_word2 ;
+uint32_t  driver_info_word3 ;
+uint32_t  driver_info_word4 ;
+
+uint32_t  saved_state_array[QL_DBG_STATE_ARRAY_LEN] ;
+uint32_t  capture_size_array[QL_DBG_CAP_SIZE_ARRAY_LEN] ;
+
+uint32_t ocm_window_array[QL_NO_OF_OCM_WINDOWS] ;
+} ql_minidump_template_hdr_t ;
+
+/*
+ * MIU AGENT ADDRESSES.
+ */
+
+#define MD_TA_CTL_ENABLE0x2
+#define MD_TA_CTL_START 0x1
+#define MD_TA_CTL_BUSY  0x8
+#define MD_TA_CTL_CHECK 1000
+
+#define MD_MIU_TEST_AGT_CTRL0x4190
+#define MD_MIU_TEST_AGT_ADDR_LO 0x4194
+#define MD_MIU_TEST_AGT_ADDR_HI 0x4198
+
+#define MD_MIU_TEST_AGT_RDDATA_0_31 0x41A8
+#define MD_MIU_TEST_AGT_RDDATA_32_630x41AC
+#define MD_MIU_TEST_AGT_RDDATA_64_950x41B8
+#define MD_MIU_TEST_AGT_RDDATA_96_127   0x41BC
+
+#define MD_MIU_TEST_AGT_WRDATA_0_31 0x41A0
+#define MD_MIU_TEST_AGT_WRDATA_32_630x41A4
+#define MD_MIU_TEST_AGT_WRDATA_64_950x41B0
+#define MD_MIU_TEST_AGT_WRDATA_96_127   0x41B4
+
+/*
+ * ROM Read Address
+ */
+
+#define MD_DIRECT_ROM_WINDOW0x42110030
+#define MD_DIRECT_ROM_READ_BASE 0x4215
+
+/*
+ * Entry Type Defines
+ */
+
+#define RDNOP  0
+#define RDCRB  1
+#defineRDMUX   2
+#define QUEUE  3
+#define BOARD  4
+#define RDOCM  6
+#define L1DAT  11
+#define L1INS  12
+#define L2DTG  21
+#define L2ITG  22
+#define L2DAT  23
+#define L2INS  24
+#define POLLRD  35
+#define RDMUX2  36
+#define POLLRDMWR   37
+#define RDROM  71
+#define RDMEM  72
+#define CNTRL  98
+#define TLHDR  99
+#define RDEND  255
+
+/*
+ * Index of State Table.  The Template header maintains
+ * an array of 8 (0..7) words that is used to store some
+ * "State Information" from the board.
+ */
+
+#define QL_PCIE_FUNC_INDX   0
+#define QL_CLK_STATE_INDX   1
+#define QL_SRE_STATE_INDX   2
+#define QL_OCM0_ADDR_INDX   3
+
+#define QL_REVID_STATE_INDX 

svn commit: r304247 - head/sys/dev/qlxgbe

2016-08-16 Thread David C Somayajulu
Author: davidcs
Date: Wed Aug 17 01:56:37 2016
New Revision: 304247
URL: https://svnweb.freebsd.org/changeset/base/304247

Log:
  Upgrade fw, bootloader and minidump template to version 5.4.58
  Add minidump retrieval code
  
  MFC after: 5 days

Modified:
  head/sys/dev/qlxgbe/ql_boot.c
  head/sys/dev/qlxgbe/ql_def.h
  head/sys/dev/qlxgbe/ql_fw.c
  head/sys/dev/qlxgbe/ql_glbl.h
  head/sys/dev/qlxgbe/ql_hw.c
  head/sys/dev/qlxgbe/ql_hw.h
  head/sys/dev/qlxgbe/ql_ioctl.c
  head/sys/dev/qlxgbe/ql_ioctl.h
  head/sys/dev/qlxgbe/ql_isr.c
  head/sys/dev/qlxgbe/ql_minidump.c
  head/sys/dev/qlxgbe/ql_os.c
  head/sys/dev/qlxgbe/ql_reset.c
  head/sys/dev/qlxgbe/ql_ver.h

Modified: head/sys/dev/qlxgbe/ql_boot.c
==
--- head/sys/dev/qlxgbe/ql_boot.c   Wed Aug 17 01:24:34 2016
(r304246)
+++ head/sys/dev/qlxgbe/ql_boot.c   Wed Aug 17 01:56:37 2016
(r304247)
@@ -34,14 +34,14 @@ __FBSDID("$FreeBSD$");
 #include "ql_os.h"
 
 unsigned int ql83xx_bootloader_version_major = 5;
-unsigned int ql83xx_bootloader_version_minor = 2;
-unsigned int ql83xx_bootloader_version_sub = 7;
+unsigned int ql83xx_bootloader_version_minor = 4;
+unsigned int ql83xx_bootloader_version_sub = 58;
 unsigned char ql83xx_bootloader[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
-  0x04, 0x00, 0x80, 0x82, 0x05, 0x1f, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00,
+  0x04, 0x00, 0xc0, 0x81, 0x05, 0x1f, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x80, 0x1e, 0x02, 0x21, 0x00, 0x08, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x20, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x70,
@@ -1384,7 +1384,7 @@ unsigned char ql83xx_bootloader[] = {
   0x00, 0x81, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x14,
   0xe0, 0x11, 0x20, 0xa2, 0x02, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
   0xbb, 0x11, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x40, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x5f, 0x21, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x5c, 0x21, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x60,
   0x00, 0x02, 0x00, 0x80, 0x40, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0x0b, 0x00, 0x00, 0x20, 0x50, 0x00, 0x00, 0x00, 0x00,
@@ -1421,14 +1421,14 @@ unsigned char ql83xx_bootloader[] = {
   0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
   0xce, 0x11, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x70, 0x04, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0xc0, 0x1f, 0x02, 0x16, 0x04, 0x00, 0x00, 0x00, 0x60,
-  0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x21, 0x7c, 0x00,
+  0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x21, 0x7c, 0x00,
   0x00, 0x00, 0x00, 0x60, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x5f, 0x21, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x49, 0x07,
+  0x5c, 0x21, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x49, 0x07,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x20, 0x50,
   0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x07, 0x00, 0x00, 0x26, 0x00,
   0xe0, 0x04, 0x00, 0xa0, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x78, 0x00, 0x00, 0x80, 0x01, 0xa0, 0x20, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x5f, 0x21, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x60,
+  0x00, 0x00, 0x00, 0x00, 0x5c, 0x21, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x60,
   0x00, 0x40, 0x00, 0x00, 0x0c, 0x1c, 0x00, 0x00, 0x00, 0x40, 0x30, 0x00,
   0x00, 0x02, 0x00, 0xa0, 0x00, 0x00, 0x5e, 0x06, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xfe, 0x1f, 0x00, 0x20, 0x50, 0x00, 0x00, 0x00, 0x00,
@@ -1535,7 +1535,7 @@ unsigned char ql83xx_bootloader[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x20, 0x50,
   0x00, 0x02, 0x00, 0x00, 0x00, 0x60, 0x52, 0x09, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0xa0, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0xb8, 0x14, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x80, 0x00,
+  0xb5, 0x14, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x80, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0xa0, 0x01, 0xa0,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1589,7 +1589,7 @@ unsigned char ql83xx_bootloader[] = {
   0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x20, 0x50, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
-  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x14, 0x7c, 

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

2016-08-16 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Aug 17 01:24:34 2016
New Revision: 304246
URL: https://svnweb.freebsd.org/changeset/base/304246

Log:
  PCIe HotPlug: Detect bridges that are not really HotPlug capable
  
  Some devices report that they have an MRL when they actually
  do not.  Since they always report that the MRL is open, child
  devices would be ignored.  Try to detect these devices and
  ignore their claim of HotPlug support.  Specifically,
  if there is an open MRL but the Data Link Layer is active,
  the MRL is not real.
  
  Revert r303645 to re-enable HotPlug support for slots with
  power controllers, since it works correctly in my testing.
  
  Start the DLL state-change timer if Presence /or/ MRL state changes,
  along with other conditions.  Previously, we started the timer iff
  Presence changed.  If there is an MRL, it must be closed for power
  to be turned on, so Presence is unlikely to change on an MRL-close event.
  
  Add a printf() of interesting registers on HotPlug interrupts and
  commands (one from erj@).  These were very useful for debugging.
  Guard them with bootverbose, since they're spam in normal operation.
  
  In collaboration with:jhb
  Reviewed by:  jhb
  MFC after:1 day
  Relnotes: yes (re-enable HotPlug support for slots with power controllers)
  Sponsored by: Dell Inc.
  Differential Revision:https://reviews.freebsd.org/D7509

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

Modified: head/sys/dev/pci/pci_pci.c
==
--- head/sys/dev/pci/pci_pci.c  Tue Aug 16 23:00:22 2016(r304245)
+++ head/sys/dev/pci/pci_pci.c  Wed Aug 17 01:24:34 2016(r304246)
@@ -918,6 +918,7 @@ static void
 pcib_probe_hotplug(struct pcib_softc *sc)
 {
device_t dev;
+   uint16_t link_sta, slot_sta;
 
if (!pci_enable_pcie_hp)
return;
@@ -932,15 +933,29 @@ pcib_probe_hotplug(struct pcib_softc *sc
sc->pcie_link_cap = pcie_read_config(dev, PCIER_LINK_CAP, 4);
sc->pcie_slot_cap = pcie_read_config(dev, PCIER_SLOT_CAP, 4);
 
+   if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC) == 0)
+   return;
+
/*
-* XXX: Handling of slots with a power controller needs to be
-* reexamined.  Ignore hotplug on such slots for now.
+* Some devices report that they have an MRL when they actually
+* do not.  Since they always report that the MRL is open, child
+* devices would be ignored.  Try to detect these devices and
+* ignore their claim of HotPlug support.
+*
+* If there is an open MRL but the Data Link Layer is active,
+* the MRL is not real.
 */
-   if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_PCP)
-   return;
-   
-   if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC)
-   sc->flags |= PCIB_HOTPLUG;
+   if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_MRLSP) != 0 &&
+   (sc->pcie_link_cap & PCIEM_LINK_CAP_DL_ACTIVE) != 0) {
+   link_sta = pcie_read_config(dev, PCIER_LINK_STA, 2);
+   slot_sta = pcie_read_config(dev, PCIER_SLOT_STA, 2);
+   if ((slot_sta & PCIEM_SLOT_STA_MRLSS) != 0 &&
+   (link_sta & PCIEM_LINK_STA_DL_ACTIVE) != 0) {
+   return;
+   }
+   }
+
+   sc->flags |= PCIB_HOTPLUG;
 }
 
 /*
@@ -966,6 +981,8 @@ pcib_pcie_hotplug_command(struct pcib_so
new = (ctl & ~mask) | val;
if (new == ctl)
return;
+   if (bootverbose)
+   device_printf(dev, "HotPlug command: %04x -> %04x\n", ctl, new);
pcie_write_config(dev, PCIER_SLOT_CTL, new, 2);
if (!(sc->pcie_slot_cap & PCIEM_SLOT_CAP_NCCS) &&
(ctl & new) & PCIEM_SLOT_CTL_CCIE) {
@@ -1028,9 +1045,6 @@ pcib_hotplug_inserted(struct pcib_softc 
 static int
 pcib_hotplug_present(struct pcib_softc *sc)
 {
-   device_t dev;
-
-   dev = sc->dev;
 
/* Card must be inserted. */
if (!pcib_hotplug_inserted(sc))
@@ -1059,7 +1073,7 @@ pcib_pcie_hotplug_update(struct pcib_sof
 {
bool card_inserted, ei_engaged;
 
-   /* Clear DETACHING if Present Detect has cleared. */
+   /* Clear DETACHING if Presence Detect has cleared. */
if ((sc->pcie_slot_sta & (PCIEM_SLOT_STA_PDC | PCIEM_SLOT_STA_PDS)) ==
PCIEM_SLOT_STA_PDC)
sc->flags &= ~PCIB_DETACHING;
@@ -1101,14 +1115,15 @@ pcib_pcie_hotplug_update(struct pcib_sof
 
/*
 * Start a timer to see if the Data Link Layer times out.
-* Note that we only start the timer if Presence Detect
+* Note that we only start the timer if Presence Detect or MRL Sensor
 * changed on this interrupt.  Stop any scheduled timer if
 * the Data Link Layer is active.
 */
if (sc->pcie_link_cap & PCIEM_LINK_CAP_DL_ACTIVE) {
if (card_inserted &&

Re: svn commit: r303646 - head/sys/ofed/drivers/infiniband/ulp/ipoib

2016-08-16 Thread Mark Johnston
On Tue, Aug 16, 2016 at 05:09:53PM -0700, Gleb Smirnoff wrote:
>   Mark,
> 
> On Mon, Aug 01, 2016 at 10:22:11PM +, Mark Johnston wrote:
> M> Author: markj
> M> Date: Mon Aug  1 22:22:11 2016
> M> New Revision: 303646
> M> URL: https://svnweb.freebsd.org/changeset/base/303646
> M> 
> M> Log:
> M>   ipoib: Bound the number of egress mbufs buffered during pathrec lookups.
> M>   
> M>   In pathological situations where the master subnet manager becomes
> M>   unresponsive for an extended period, we may otherwise end up queuing all
> M>   of the system's mbufs while waiting for a response to a path record 
> lookup.
> M>   
> M>   This addresses the same issue as commit 1e85b806f9 in Linux.
> M>   
> M>   Reviewed by: cem, ngie
> M>   MFC after:   2 weeks
> M>   Sponsored by:EMC / Isilon Storage Division
> M> 
> M> Modified:
> M>   head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
> M> 
> M> Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
> M> 
> ==
> M> --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.cMon Aug 
>  1 22:19:23 2016(r303645)
> M> +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.cMon Aug 
>  1 22:22:11 2016(r303646)
> M> @@ -660,7 +660,13 @@ ipoib_unicast_send(struct mbuf *mb, stru
> M>new_path = 1;
> M>}
> M>if (path) {
> M> -  _IF_ENQUEUE(>queue, mb);
> M> +  if (_IF_QLEN(>queue) < IPOIB_MAX_PATH_REC_QUEUE)
> M> +  _IF_ENQUEUE(>queue, mb);
> M> +  else {
> M> +  if_inc_counter(priv->dev, IFCOUNTER_OERRORS, 1);
> M> +  m_freem(mb);
> M> +  }
> 
> Shouldn't that be IFCOUNTER_ODROPS?

I'm not sure. I used IFCOUNTER_OERRORS to be consistent with other error
cases in this function. This error case doesn't represent the normal
source of outbound packet drops but rather indicates that a key routing
agent on the network is not responding. OQDROPS seems like it's
specifically for the case that we can't buffer packets because the
transmitter isn't keeping up.
___
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: r303646 - head/sys/ofed/drivers/infiniband/ulp/ipoib

2016-08-16 Thread Gleb Smirnoff
  Mark,

On Mon, Aug 01, 2016 at 10:22:11PM +, Mark Johnston wrote:
M> Author: markj
M> Date: Mon Aug  1 22:22:11 2016
M> New Revision: 303646
M> URL: https://svnweb.freebsd.org/changeset/base/303646
M> 
M> Log:
M>   ipoib: Bound the number of egress mbufs buffered during pathrec lookups.
M>   
M>   In pathological situations where the master subnet manager becomes
M>   unresponsive for an extended period, we may otherwise end up queuing all
M>   of the system's mbufs while waiting for a response to a path record lookup.
M>   
M>   This addresses the same issue as commit 1e85b806f9 in Linux.
M>   
M>   Reviewed by:   cem, ngie
M>   MFC after: 2 weeks
M>   Sponsored by:  EMC / Isilon Storage Division
M> 
M> Modified:
M>   head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
M> 
M> Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
M> 
==
M> --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c  Mon Aug  1 
22:19:23 2016(r303645)
M> +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c  Mon Aug  1 
22:22:11 2016(r303646)
M> @@ -660,7 +660,13 @@ ipoib_unicast_send(struct mbuf *mb, stru
M>  new_path = 1;
M>  }
M>  if (path) {
M> -_IF_ENQUEUE(>queue, mb);
M> +if (_IF_QLEN(>queue) < IPOIB_MAX_PATH_REC_QUEUE)
M> +_IF_ENQUEUE(>queue, mb);
M> +else {
M> +if_inc_counter(priv->dev, IFCOUNTER_OERRORS, 1);
M> +m_freem(mb);
M> +}

Shouldn't that be IFCOUNTER_ODROPS?

-- 
Totus tuus, Glebius.
___
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: r304245 - head/sys/kern

2016-08-16 Thread Gleb Smirnoff
Author: glebius
Date: Tue Aug 16 23:00:22 2016
New Revision: 304245
URL: https://svnweb.freebsd.org/changeset/base/304245

Log:
  Fix a stupid typo (or copy/paste buffer malfunction).

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cTue Aug 16 21:55:34 2016
(r304244)
+++ head/sys/kern/kern_timeout.cTue Aug 16 23:00:22 2016
(r304245)
@@ -1061,7 +1061,7 @@ callout_reset_sbt_on(struct callout *c, 
 */
if (c->c_lock != NULL && !cc_exec_cancel(cc, direct))
cancelled = cc_exec_cancel(cc, direct) = true;
-   if (cc_exec_waiting(cc, direct) || cc_exec_drain(cc, dir)) {
+   if (cc_exec_waiting(cc, direct) || cc_exec_drain(cc, direct)) {
/*
 * Someone has called callout_drain to kill this
 * callout.  Don't reschedule.
___
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: r304244 - head/sys/kern

2016-08-16 Thread Gary Jennejohn
On Tue, 16 Aug 2016 21:55:34 + (UTC)
Gleb Smirnoff  wrote:

> Author: glebius
> Date: Tue Aug 16 21:55:34 2016
> New Revision: 304244
> URL: https://svnweb.freebsd.org/changeset/base/304244
> 
> Log:
>   We should not be allowing a timeout to reset when a drain is in progress on
>   it (either async or sync drain).
>   
>   At this moment the only user of drain is TCP, but TCP wouldn't reschedule a
>   callout after it has drained it, since it drains only when a tcpcb is 
> closed.
>   This for now the problem isn't observed.
>   
>   Submitted by:   rrs
> 
> Modified:
>   head/sys/kern/kern_timeout.c
> 
> Modified: head/sys/kern/kern_timeout.c
> ==
> --- head/sys/kern/kern_timeout.c  Tue Aug 16 21:32:05 2016
> (r304243)
> +++ head/sys/kern/kern_timeout.c  Tue Aug 16 21:55:34 2016
> (r304244)
> @@ -1061,7 +1061,7 @@ callout_reset_sbt_on(struct callout *c, 
>*/
>   if (c->c_lock != NULL && !cc_exec_cancel(cc, direct))
>   cancelled = cc_exec_cancel(cc, direct) = true;
> - if (cc_exec_waiting(cc, direct)) {
> + if (cc_exec_waiting(cc, direct) || cc_exec_drain(cc, dir)) { 
> <== dir in this line should really be direct.
>   /*
>* Someone has called callout_drain to kill this
>* callout.  Don't reschedule.

-- 
Gary Jennejohn
___
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: r304244 - head/sys/kern

2016-08-16 Thread Gleb Smirnoff
Author: glebius
Date: Tue Aug 16 21:55:34 2016
New Revision: 304244
URL: https://svnweb.freebsd.org/changeset/base/304244

Log:
  We should not be allowing a timeout to reset when a drain is in progress on
  it (either async or sync drain).
  
  At this moment the only user of drain is TCP, but TCP wouldn't reschedule a
  callout after it has drained it, since it drains only when a tcpcb is closed.
  This for now the problem isn't observed.
  
  Submitted by: rrs

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cTue Aug 16 21:32:05 2016
(r304243)
+++ head/sys/kern/kern_timeout.cTue Aug 16 21:55:34 2016
(r304244)
@@ -1061,7 +1061,7 @@ callout_reset_sbt_on(struct callout *c, 
 */
if (c->c_lock != NULL && !cc_exec_cancel(cc, direct))
cancelled = cc_exec_cancel(cc, direct) = true;
-   if (cc_exec_waiting(cc, direct)) {
+   if (cc_exec_waiting(cc, direct) || cc_exec_drain(cc, dir)) {
/*
 * Someone has called callout_drain to kill this
 * callout.  Don't reschedule.
___
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: r304180 - head/sys/ufs/ffs

2016-08-16 Thread Jilles Tjoelker
On Mon, Aug 15, 2016 at 07:22:24PM +, Konstantin Belousov wrote:
> [snip]
> @@ -254,15 +259,23 @@ loop:
>   if ((bp->b_vflags & BV_SCANNED) != 0)
>   continue;
>   bp->b_vflags |= BV_SCANNED;
> - /* Flush indirects in order. */
> + /*
> +  * Flush indirects in order, if requested.
> +  *
> +  * Note that if only datasync is requested, we can
> +  * skip indirect blocks when softupdates are not
> +  * active.  Otherwise we must flush them with data,
> +  * since dependencies prevent data block writes.
> +  */
>   if (waitfor == MNT_WAIT && bp->b_lblkno <= -NDADDR &&
> - lbn_level(bp->b_lblkno) >= passes)
> + (lbn_level(bp->b_lblkno) >= passes ||
> + ((flags & DATA_ONLY) != 0 && !DOINGSOFTDEP(vp
>   continue;
>   if (bp->b_lblkno > lbn)
>   panic("ffs_syncvnode: syncing truncated data.");
>   if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL) == 0) {
>   BO_UNLOCK(bo);
> - } else if (wait != 0) {
> + } else if (wait) {
>   if (BUF_LOCK(bp,
>   LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK,
>   BO_LOCKPTR(bo)) != 0) {

Hmm, some people interpret POSIX differently than I do, but I think it
is clear that XBD 3.384 Synchronized I/O Data Integrity Completion
requires the indirect blocks to be written (because "all file system
information required to retrieve the data is successfully transferred").
The Linux man page matches this interpretation except that an fsync of
the parent directory may be required.

If the whole file is being considered, then any change to indirect
blocks is needed to access some data (because the file was extended, a
hole was filled or snapshotted data was overwritten). For other
overwrites, there is no change to indirect blocks and no conflict with
fdatasync's performance objectives.

> @@ -330,31 +343,59 @@ next:
>* these will be done with one sync and one async pass.
>*/
>   if (bo->bo_dirty.bv_cnt > 0) {
> - /* Write the inode after sync passes to flush deps. */
> - if (wait && DOINGSOFTDEP(vp) && (flags & NO_INO_UPDT) == 0) {
> - BO_UNLOCK(bo);
> - ffs_update(vp, 1);
> - BO_LOCK(bo);
> + if ((flags & DATA_ONLY) == 0) {
> + still_dirty = true;
> + } else {
> + /*
> +  * For data-only sync, dirty indirect buffers
> +  * are ignored.
> +  */
> + still_dirty = false;
> + TAILQ_FOREACH(bp, >bo_dirty.bv_hd, b_bobufs) {
> + if (bp->b_lblkno > -NDADDR) {
> + still_dirty = true;
> + break;
> + }
> + }
>   }
> - /* switch between sync/async. */
> - wait = !wait;
> - if (wait == 1 || ++passes < NIADDR + 2)
> - goto loop;
> +
> + if (still_dirty) {
> + /* Write the inode after sync passes to flush deps. */
> + if (wait && DOINGSOFTDEP(vp) &&
> + (flags & NO_INO_UPDT) == 0) {
> + BO_UNLOCK(bo);
> + ffs_update(vp, 1);
> + BO_LOCK(bo);
> + }
> + /* switch between sync/async. */
> + wait = !wait;
> + if (wait || ++passes < NIADDR + 2)
> + goto loop;
>  #ifdef INVARIANTS
> - if (!vn_isdisk(vp, NULL))
> - vn_printf(vp, "ffs_fsync: dirty ");
> + if (!vn_isdisk(vp, NULL))
> + vn_printf(vp, "ffs_fsync: dirty ");
>  #endif
> + }
>   }
>   BO_UNLOCK(bo);
>   error = 0;
> - if ((flags & NO_INO_UPDT) == 0)
> - error = ffs_update(vp, 1);
> - if (DOINGSUJ(vp))
> - softdep_journal_fsync(VTOI(vp));
> + if ((flags & DATA_ONLY) == 0) {
> + if ((flags & NO_INO_UPDT) == 0)
> + error = ffs_update(vp, 1);
> + if (DOINGSUJ(vp))
> + softdep_journal_fsync(VTOI(vp));
> + }
>   return (error);
>  }

Ideally, a changed i_size would also cause the inode to be written, but
I don't know how to determine that (there is no i_flag for it). Always
writing the inode would defeat the point of fdatasync.

-- 
Jilles Tjoelker
___
svn-src-all@freebsd.org mailing 

svn commit: r304243 - in head/sys: conf dev/bhnd dev/bhnd/cores/chipc dev/bhnd/nvram dev/bhnd/tools dev/bwn mips/conf modules/bhnd

2016-08-16 Thread Landon J. Fuller
Author: landonf
Date: Tue Aug 16 21:32:05 2016
New Revision: 304243
URL: https://svnweb.freebsd.org/changeset/base/304243

Log:
  bhnd(4): Implement NVRAM support required for PMU bring-up.
  
  - Added a generic bhnd_nvram_parser API, with support for the TLV format
used on WGT634U devices, the standard BCM NVRAM format used on most
modern devices, and the "board text file" format used on some hardware
to supply external NVRAM data at runtime (e.g. via an EFI variable).
  
  - Extended the bhnd_bus_if and bhnd_nvram_if interfaces to support both
string-based and primitive data type variable access, required for
common behavior across both SPROM and NVRAM data sources.
  - Extended the existing SPROM implementation to support the new
string-based NVRAM APIs.
  
  - Added an abstract bhnd_nvram driver, implementing the bhnd_nvram_if
atop the bhnd_nvram_parser API.
  - Added a CFE-based bhnd_nvram driver to provide read-only access to
NVRAM data on MIPS SoCs, pending implementation of a flash-aware
bhnd_nvram driver.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D7489

Added:
  head/sys/dev/bhnd/nvram/bhnd_nvram.c   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_nvram_cfe.c   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_nvram_common.c   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_nvram_common.h
 - copied, changed from r304242, head/sys/dev/bhnd/nvram/nvramvar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_parser.c   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_nvram_parser.h   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_nvram_parserreg.h   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_nvram_parservar.h   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_nvramvar.h
 - copied, changed from r304242, head/sys/dev/bhnd/nvram/bhnd_spromreg.h
  head/sys/dev/bhnd/nvram/bhnd_sprom_parser.c
 - copied, changed from r304242, head/sys/dev/bhnd/nvram/bhnd_sprom_subr.c
  head/sys/dev/bhnd/nvram/bhnd_sprom_parser.h
 - copied, changed from r304242, head/sys/dev/bhnd/nvram/bhnd_spromvar.h
  head/sys/dev/bhnd/nvram/bhnd_sprom_parservar.h
 - copied, changed from r304242, head/sys/dev/bhnd/nvram/bhnd_spromreg.h
Deleted:
  head/sys/dev/bhnd/nvram/bhnd_sprom_subr.c
  head/sys/dev/bhnd/nvram/bhnd_spromreg.h
  head/sys/dev/bhnd/nvram/nvram_subr.c
  head/sys/dev/bhnd/nvram/nvramvar.h
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/bhnd.c
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_bus_if.m
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/bhnd_types.h
  head/sys/dev/bhnd/bhndvar.h
  head/sys/dev/bhnd/cores/chipc/chipc.c
  head/sys/dev/bhnd/nvram/bhnd_nvram.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_if.m
  head/sys/dev/bhnd/nvram/bhnd_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_spromvar.h
  head/sys/dev/bhnd/tools/nvram_map_gen.awk
  head/sys/dev/bwn/bwn_mac.c
  head/sys/mips/conf/BCM
  head/sys/mips/conf/BCM.hints
  head/sys/mips/conf/SENTRY5
  head/sys/mips/conf/SENTRY5.hints
  head/sys/modules/bhnd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Aug 16 21:20:05 2016(r304242)
+++ head/sys/conf/files Tue Aug 16 21:32:05 2016(r304243)
@@ -1163,10 +1163,14 @@ dev/bhnd/cores/pci/bhnd_pcib.c  optional
 dev/bhnd/cores/pcie2/bhnd_pcie2.c  optional bhnd pci
 dev/bhnd/cores/pcie2/bhnd_pcie2_hostb.coptional bhndb bhnd pci
 dev/bhnd/cores/pcie2/bhnd_pcie2b.c optional bhnd_pcie2b bhnd pci
+dev/bhnd/nvram/bhnd_nvram.coptional bhnd
+dev/bhnd/nvram/bhnd_nvram_common.c optional bhnd
+dev/bhnd/nvram/bhnd_nvram_cfe.coptional bhnd siba_nexus cfe | \
+bhnd bcma_nexus cfe
 dev/bhnd/nvram/bhnd_nvram_if.m optional bhnd
+dev/bhnd/nvram/bhnd_nvram_parser.c optional bhnd
 dev/bhnd/nvram/bhnd_sprom.coptional bhnd
-dev/bhnd/nvram/bhnd_sprom_subr.c   optional bhnd
-dev/bhnd/nvram/nvram_subr.coptional bhnd
+dev/bhnd/nvram/bhnd_sprom_parser.c optional bhnd
 dev/bhnd/siba/siba.c   optional siba bhnd
 dev/bhnd/siba/siba_bhndb.c optional siba bhnd bhndb
 dev/bhnd/siba/siba_nexus.c optional siba_nexus siba bhnd

Modified: head/sys/dev/bhnd/bhnd.c
==
--- head/sys/dev/bhnd/bhnd.cTue Aug 16 21:20:05 2016(r304242)
+++ head/sys/dev/bhnd/bhnd.cTue Aug 16 21:32:05 2016(r304243)
@@ -361,7 +361,7 @@ bhnd_finish_attach(struct bhnd_softc *sc
if (ccaps->nvram_src != BHND_NVRAM_SRC_UNKNOWN) {
if ((sc->nvram_dev = bhnd_find_nvram(sc)) == NULL) {
device_printf(sc->dev,
-   "warning: %s NVRAM device not found\n",
+  

svn commit: r304242 - head/sys/dev/bhnd/bhndb

2016-08-16 Thread Landon J. Fuller
Author: landonf
Date: Tue Aug 16 21:20:05 2016
New Revision: 304242
URL: https://svnweb.freebsd.org/changeset/base/304242

Log:
  bhndb(4): Drop MIPS-incompatible __builtin_ctz dependency.
  
  This replaces the bitfield representation of the bhndb register window
  freelist with the bitstring API, eliminating a dependency on
  (MIPS-unsupported) __builtin_ctz().
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D7495

Modified:
  head/sys/dev/bhnd/bhndb/bhndb_private.h
  head/sys/dev/bhnd/bhndb/bhndb_subr.c

Modified: head/sys/dev/bhnd/bhndb/bhndb_private.h
==
--- head/sys/dev/bhnd/bhndb/bhndb_private.h Tue Aug 16 21:17:51 2016
(r304241)
+++ head/sys/dev/bhnd/bhndb/bhndb_private.h Tue Aug 16 21:20:05 2016
(r304242)
@@ -33,6 +33,7 @@
 #define _BHND_BHNDB_PRIVATE_H_
 
 #include 
+#include 
 #include 
 #include 
 
@@ -184,21 +185,23 @@ struct bhndb_resources {
 
struct bhndb_dw_alloc   *dw_alloc;  /**< dynamic window 
allocation records */
size_t   dwa_count; /**< number of dynamic 
windows available. */
-   uint32_t dwa_freelist;  /**< dynamic window 
free list */
+   bitstr_t*dwa_freelist;  /**< dynamic window 
free list */
bhndb_priority_t min_prio;  /**< minimum resource 
priority required to
 allocate a dynamic 
window */
 };
 
 /**
- * Returns true if the all dynamic windows have been exhausted, false
+ * Returns true if the all dynamic windows are marked free, false
  * otherwise.
  * 
  * @param br The resource state to check.
  */
 static inline bool
-bhndb_dw_exhausted(struct bhndb_resources *br)
+bhndb_dw_all_free(struct bhndb_resources *br)
 {
-   return (br->dwa_freelist == 0);
+   int bit;
+   bit_ffs(br->dwa_freelist, br->dwa_count, );
+   return (bit == -1);
 }
 
 /**
@@ -209,12 +212,14 @@ bhndb_dw_exhausted(struct bhndb_resource
 static inline struct bhndb_dw_alloc *
 bhndb_dw_next_free(struct bhndb_resources *br)
 {
-   struct bhndb_dw_alloc *dw_free;
+   struct bhndb_dw_alloc   *dw_free;
+   int  bit;
 
-   if (bhndb_dw_exhausted(br))
+   bit_ffc(br->dwa_freelist, br->dwa_count, );
+   if (bit == -1)
return (NULL);
 
-   dw_free = >dw_alloc[__builtin_ctz(br->dwa_freelist)];
+   dw_free = >dw_alloc[bit];
 
KASSERT(LIST_EMPTY(_free->refs),
("free list out of sync with refs"));
@@ -233,7 +238,7 @@ bhndb_dw_is_free(struct bhndb_resources 
 {
bool is_free = LIST_EMPTY(>refs);
 
-   KASSERT(is_free == ((br->dwa_freelist & (1 << dwa->rnid)) != 0),
+   KASSERT(is_free == !bit_test(br->dwa_freelist, dwa->rnid),
("refs out of sync with free list"));
 
return (is_free);

Modified: head/sys/dev/bhnd/bhndb/bhndb_subr.c
==
--- head/sys/dev/bhnd/bhndb/bhndb_subr.cTue Aug 16 21:17:51 2016
(r304241)
+++ head/sys/dev/bhnd/bhndb/bhndb_subr.cTue Aug 16 21:20:05 2016
(r304242)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include "bhndb_private.h"
 #include "bhndbvar.h"
@@ -264,7 +265,7 @@ bhndb_alloc_resources(device_t dev, devi
const struct bhndb_regwin   *win;
bus_size_t   last_window_size;
size_t   res_num;
-   u_intrnid;
+   int  rnid;
int  error;
bool free_parent_res;
bool free_ht_mem, free_br_mem;
@@ -371,10 +372,10 @@ bhndb_alloc_resources(device_t dev, devi
}
 
/* Fetch the dynamic regwin count and verify that it does not exceed
-* what is representable via our freelist bitmask. */
+* what is representable via our freelist bitstring. */
r->dwa_count = bhndb_regwin_count(cfg->register_windows,
BHNDB_REGWIN_T_DYN);
-   if (r->dwa_count >= (8 * sizeof(r->dwa_freelist))) {
+   if (r->dwa_count >= INT_MAX) {
device_printf(r->dev, "max dynamic regwin count exceeded\n");
goto failed;
}
@@ -385,8 +386,12 @@ bhndb_alloc_resources(device_t dev, devi
if (r->dw_alloc == NULL)
goto failed;
 
-   /* Initialize the dynamic window table and freelist. */
-   r->dwa_freelist = 0;
+   /* Allocate the dynamic window allocation freelist */
+   r->dwa_freelist = bit_alloc(r->dwa_count, M_BHND, M_NOWAIT);
+   if (r->dwa_freelist == NULL)
+   goto failed;
+
+   /* Initialize the dynamic window table */

svn commit: r304239 - head/sys/ufs/ffs

2016-08-16 Thread Kirk McKusick
Author: mckusick
Date: Tue Aug 16 21:02:30 2016
New Revision: 304239
URL: https://svnweb.freebsd.org/changeset/base/304239

Log:
  Bug 211013 reports that a write error to a UFS filesystem running
  with softupdates panics the kernel. The problem that has been pointed
  out is that when there is a transient write error on certain metadata
  blocks, specifically directory blocks (PAGEDEP), inode blocks
  (INODEDEP), indirect pointer blocks (INDIRDEPS), and cylinder group
  (BMSAFEMAP, but only when journaling is enabled), we get a panic
  in one of the routines called by softdep_disk_io_initiation that
  the I/O is "already started" when we retry the write.
  
  These dependency types potentially need to do roll-backs when called
  by softdep_disk_io_initiation before doing a write and then a
  roll-forward when called by softdep_disk_write_complete after the
  I/O completes.  The panic happens when there is a transient error.
  At the top of softdep_disk_write_complete we check to see if the
  write had an error and if an error occurred we just return.  This
  return is correct most of the time because the main role of the routines
  called by softdep_disk_write_complete is to process the now-completed
  dependencies so that the next I/O steps can happen.
  
  But for the four types listed above, they do not get to do their
  rollback operations. This causes the panic when softdep_disk_io_initiation
  gets called on the second attempt to do the write and the roll-back
  routines find that the roll-backs have already been done. As an
  aside I note that there is also the problem that the buffer will
  have been unlocked and thus made visible to the filesystem and to
  user applications with the roll-backs in place.
  
  The way to resolve the problem is to add a flag to the routines called
  by softdep_disk_write_complete for the four dependency types noted
  that indicates whether the write was successful (WRITESUCCEEDED).
  If the write does not succeed, they do just the roll-backs and then
  return. If the write was successful they also do their usual
  processing of the now-completed dependencies.
  
  The fix was tested by selectively injecting write errors for buffers
  holding dependencies of each of the four types noted above and then
  verifying that the kernel no longer paniced and that following the
  successful retry of the write that the filesystem could be unmounted
  and successfully checked cleanly.
  
  PR: 211013
  Reviewed by: kib

Modified:
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ffs/softdep.h

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Tue Aug 16 20:35:36 2016
(r304238)
+++ head/sys/ufs/ffs/ffs_softdep.c  Tue Aug 16 21:02:30 2016
(r304239)
@@ -752,16 +752,16 @@ staticint flush_newblk_dep(struct vnode
 static int flush_inodedep_deps(struct vnode *, struct mount *, ino_t);
 static int flush_deplist(struct allocdirectlst *, int, int *);
 static int sync_cgs(struct mount *, int);
-static int handle_written_filepage(struct pagedep *, struct buf *);
+static int handle_written_filepage(struct pagedep *, struct buf *, int);
 static int handle_written_sbdep(struct sbdep *, struct buf *);
 static void initiate_write_sbdep(struct sbdep *);
 static void diradd_inode_written(struct diradd *, struct inodedep *);
 static int handle_written_indirdep(struct indirdep *, struct buf *,
-   struct buf**);
-static int handle_written_inodeblock(struct inodedep *, struct buf *);
+   struct buf**, int);
+static int handle_written_inodeblock(struct inodedep *, struct buf *, int);
 static int jnewblk_rollforward(struct jnewblk *, struct fs *, struct cg *,
uint8_t *);
-static int handle_written_bmsafemap(struct bmsafemap *, struct buf *);
+static int handle_written_bmsafemap(struct bmsafemap *, struct buf *, int);
 static void handle_written_jaddref(struct jaddref *);
 static void handle_written_jremref(struct jremref *);
 static void handle_written_jseg(struct jseg *, struct buf *);
@@ -10874,6 +10874,10 @@ initiate_write_bmsafemap(bmsafemap, bp)
struct fs *fs;
ino_t ino;
 
+   /*
+* If this is a background write, we did this at the time that
+* the copy was made, so do not need to do it again.
+*/
if (bmsafemap->sm_state & IOSTARTED)
return;
bmsafemap->sm_state |= IOSTARTED;
@@ -10947,10 +10951,39 @@ softdep_disk_write_complete(bp)
 
/*
 * If an error occurred while doing the write, then the data
-* has not hit the disk and the dependencies cannot be unrolled.
+* has not hit the disk and the dependencies cannot be processed.
+* But we do have to go through and roll forward any dependencies
+* that were rolled back before the disk write.
 */
-   if ((bp->b_ioflags & BIO_ERROR) != 0 && (bp->b_flags & 

svn commit: r304238 - head/tests/sys/kern/acct

2016-08-16 Thread Garrett Cooper
Author: ngie
Date: Tue Aug 16 20:35:36 2016
New Revision: 304238
URL: https://svnweb.freebsd.org/changeset/base/304238

Log:
  Only expect :encode_tv_random_million to fail on 64-bit platforms
  
  It passes on i386
  
  MFC after:1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/tests/sys/kern/acct/acct_test.c
Directory Properties:
  head/   (props changed)

Modified: head/tests/sys/kern/acct/acct_test.c
==
--- head/tests/sys/kern/acct/acct_test.cTue Aug 16 20:32:08 2016
(r304237)
+++ head/tests/sys/kern/acct/acct_test.cTue Aug 16 20:35:36 2016
(r304238)
@@ -204,7 +204,10 @@ ATF_TC_BODY(encode_tv_random_million, tc
struct timeval tv;
long k;
 
-   atf_tc_expect_fail("the testcase violates FLT_EPSILON");
+#ifdef __LP64__
+   atf_tc_expect_fail("the testcase violates FLT_EPSILON on 64-bit "
+   "platforms, e.g. amd64");
+#endif
 
ATF_REQUIRE_MSG(unsetenv("TZ") == 0, "unsetting TZ failed; errno=%d", 
errno);
 
___
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: r304235 - head/sys/sys

2016-08-16 Thread Mark Johnston
Author: markj
Date: Tue Aug 16 19:43:17 2016
New Revision: 304235
URL: https://svnweb.freebsd.org/changeset/base/304235

Log:
  Remove prototypes missed in r303951.

Modified:
  head/sys/sys/buf.h

Modified: head/sys/sys/buf.h
==
--- head/sys/sys/buf.h  Tue Aug 16 18:56:56 2016(r304234)
+++ head/sys/sys/buf.h  Tue Aug 16 19:43:17 2016(r304235)
@@ -536,9 +536,6 @@ voidreassignbuf(struct buf *);
 struct buf *trypbuf(int *);
 void   bwait(struct buf *, u_char, const char *);
 void   bdone(struct buf *);
-void   bpin(struct buf *);
-void   bunpin(struct buf *);
-void   bunpin_wait(struct buf *);
 
 #endif /* _KERNEL */
 
___
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: r304234 - stable/11/lib/clang

2016-08-16 Thread Dimitry Andric
Author: dim
Date: Tue Aug 16 18:56:56 2016
New Revision: 304234
URL: https://svnweb.freebsd.org/changeset/base/304234

Log:
  Similar to r256297, disable assertions in llvm and clang for the
  stable/11 branch.  This reduces the size of the clang executable, and
  improves its performance.  Also bump FREEBSD_CC_VERSION to make some
  version number room for the branch.

Modified:
  stable/11/lib/clang/clang.build.mk
  stable/11/lib/clang/freebsd_cc_version.h

Modified: stable/11/lib/clang/clang.build.mk
==
--- stable/11/lib/clang/clang.build.mk  Tue Aug 16 18:32:01 2016
(r304233)
+++ stable/11/lib/clang/clang.build.mk  Tue Aug 16 18:56:56 2016
(r304234)
@@ -8,7 +8,7 @@ CFLAGS+=-I${LLVM_SRCS}/include -I${CLAN
-I${LLVM_SRCS}/${SRCDIR} ${INCDIR:C/^/-I${LLVM_SRCS}\//} -I. \
-I${LLVM_SRCS}/../../lib/clang/include \
-DLLVM_ON_UNIX -DLLVM_ON_FREEBSD \
-   -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS #-DNDEBUG
+   -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG
 
 .if ${MK_CLANG_FULL} != "no"
 CFLAGS+=   -DCLANG_ENABLE_ARCMT \

Modified: stable/11/lib/clang/freebsd_cc_version.h
==
--- stable/11/lib/clang/freebsd_cc_version.hTue Aug 16 18:32:01 2016
(r304233)
+++ stable/11/lib/clang/freebsd_cc_version.hTue Aug 16 18:56:56 2016
(r304234)
@@ -1,3 +1,3 @@
 /* $FreeBSD$ */
 
-#defineFREEBSD_CC_VERSION  114
+#defineFREEBSD_CC_VERSION  1100500
___
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: r304221 - head/sys/boot/efi/boot1

2016-08-16 Thread Warner Losh
On Tue, Aug 16, 2016 at 8:57 AM, Ed Schouten  wrote:
> Hi Emmanuel,
>
> 2016-08-16 16:23 GMT+02:00 Emmanuel Vadot :
>> Author: manu
>> Date: Tue Aug 16 14:23:35 2016
>> New Revision: 304221
>> URL: https://svnweb.freebsd.org/changeset/base/304221
>>
>> Log:
>>   Use %ju modifier for u_int64_t and %jd modifier for off_t.
>>   off_t is long long on arm32 and long on amd64
>
> I think both of these should be solved differently:
>
> - For uint64_t, you can use 's PRIu64 in the formatting
> string. In kernel space, I suspect you need to use something like
> .

cast it to intmax_t and use %jd. We've shunned PRIu64 in the tree.
It's existing practice, but I'm sure bruce will voice mild distaste.

> - For off_t, it's all right to print it with %jd, but then be sure to
> also add a cast to the argument itself. It may not necessarily be
> equal to an intmax_t.

The cast is important.

Warner
___
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: r304232 - head/sys/ufs/ffs

2016-08-16 Thread Konstantin Belousov
Author: kib
Date: Tue Aug 16 17:30:58 2016
New Revision: 304232
URL: https://svnweb.freebsd.org/changeset/base/304232

Log:
  In UFS_BALLOC(), invalidate pages of indirect buffers on failed block
  allocation unwinding.
  
  Dandling buffers are released on UFS_BALLOC() failure to ensure that
  later attempt to allocate blocks in close range do not find the blocks
  with invalid content, since possible partial block allocations are
  unwound.  As such, it is not enough to just release the buffers, the
  pages must also invalidated and removed from the vnode vm_object
  queue.  Otherwise the pages might be found later and used to
  reconstruct indirect buffers when doing allocations at offset close to
  the failure point, and their stale content compromise the filesystem
  integrity.
  
  Note that just marking the buffer as B_INVAL is not enough, B_NOCACHE
  is required.  To be sure, clear the B_CACHE flag as well.  This
  complements the r174973, which started releasing buffers.
  
  Reported and tested by:   pho
  Reviewed by:  mckusick
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/ufs/ffs/ffs_balloc.c

Modified: head/sys/ufs/ffs/ffs_balloc.c
==
--- head/sys/ufs/ffs/ffs_balloc.c   Tue Aug 16 17:18:38 2016
(r304231)
+++ head/sys/ufs/ffs/ffs_balloc.c   Tue Aug 16 17:30:58 2016
(r304232)
@@ -492,8 +492,8 @@ fail:
(intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree,
(uintmax_t)bp->b_blkno,
(uintmax_t)fsbtodb(fs, *blkp)));
-   bp->b_flags |= (B_INVAL | B_RELBUF);
-   bp->b_flags &= ~B_ASYNC;
+   bp->b_flags |= B_INVAL | B_RELBUF | B_NOCACHE;
+   bp->b_flags &= ~(B_ASYNC | B_CACHE);
brelse(bp);
}
deallocated += fs->fs_bsize;
@@ -1087,8 +1087,8 @@ fail:
(intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree,
(uintmax_t)bp->b_blkno,
(uintmax_t)fsbtodb(fs, *blkp)));
-   bp->b_flags |= (B_INVAL | B_RELBUF);
-   bp->b_flags &= ~B_ASYNC;
+   bp->b_flags |= B_INVAL | B_RELBUF | B_NOCACHE;
+   bp->b_flags &= ~(B_ASYNC | B_CACHE);
brelse(bp);
}
deallocated += fs->fs_bsize;
___
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: r304231 - head/sys/ufs/ffs

2016-08-16 Thread Konstantin Belousov
Author: kib
Date: Tue Aug 16 17:18:38 2016
New Revision: 304231
URL: https://svnweb.freebsd.org/changeset/base/304231

Log:
  On unwind after failed block allocation in ffs_balloc_ufs{1,2}, assert
  that recorded allocated blocks numbers match the physical block
  numbers of dandling buffers which are released.
  
  When finally freeing the blocks during unwind, assert that dandling
  buffers where not re-allocated.  They shouldn't, because the vnode lock
  is owned exclusive.
  
  Reviewed by:  mckusick
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/ufs/ffs/ffs_balloc.c

Modified: head/sys/ufs/ffs/ffs_balloc.c
==
--- head/sys/ufs/ffs/ffs_balloc.c   Tue Aug 16 17:07:48 2016
(r304230)
+++ head/sys/ufs/ffs/ffs_balloc.c   Tue Aug 16 17:18:38 2016
(r304231)
@@ -487,6 +487,11 @@ fail:
bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0,
GB_NOCREAT | GB_UNMAPPED);
if (bp != NULL) {
+   KASSERT(bp->b_blkno == fsbtodb(fs, *blkp),
+   ("mismatch1 l %jd %jd b %ju %ju",
+   (intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree,
+   (uintmax_t)bp->b_blkno,
+   (uintmax_t)fsbtodb(fs, *blkp)));
bp->b_flags |= (B_INVAL | B_RELBUF);
bp->b_flags &= ~B_ASYNC;
brelse(bp);
@@ -531,6 +536,18 @@ fail:
 * cleared, free the blocks.
 */
for (blkp = allociblk; blkp < allocblk; blkp++) {
+#ifdef INVARIANTS
+   if (blkp == allociblk)
+   lbns_remfree = lbns;
+   bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0,
+   GB_NOCREAT | GB_UNMAPPED);
+   if (bp != NULL) {
+   panic("zombie1 %jd %ju %ju",
+   (intmax_t)bp->b_lblkno, (uintmax_t)bp->b_blkno,
+   (uintmax_t)fsbtodb(fs, *blkp));
+   }
+   lbns_remfree++;
+#endif
ffs_blkfree(ump, fs, ip->i_devvp, *blkp, fs->fs_bsize,
ip->i_number, vp->v_type, NULL);
}
@@ -1065,6 +1082,11 @@ fail:
bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0,
GB_NOCREAT | GB_UNMAPPED);
if (bp != NULL) {
+   KASSERT(bp->b_blkno == fsbtodb(fs, *blkp),
+   ("mismatch2 l %jd %jd b %ju %ju",
+   (intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree,
+   (uintmax_t)bp->b_blkno,
+   (uintmax_t)fsbtodb(fs, *blkp)));
bp->b_flags |= (B_INVAL | B_RELBUF);
bp->b_flags &= ~B_ASYNC;
brelse(bp);
@@ -1109,6 +1131,18 @@ fail:
 * cleared, free the blocks.
 */
for (blkp = allociblk; blkp < allocblk; blkp++) {
+#ifdef INVARIANTS
+   if (blkp == allociblk)
+   lbns_remfree = lbns;
+   bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0,
+   GB_NOCREAT | GB_UNMAPPED);
+   if (bp != NULL) {
+   panic("zombie2 %jd %ju %ju",
+   (intmax_t)bp->b_lblkno, (uintmax_t)bp->b_blkno,
+   (uintmax_t)fsbtodb(fs, *blkp));
+   }
+   lbns_remfree++;
+#endif
ffs_blkfree(ump, fs, ip->i_devvp, *blkp, fs->fs_bsize,
ip->i_number, vp->v_type, NULL);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304230 - in head: share/man/man3 sys/sys

2016-08-16 Thread Kirk McKusick
Author: mckusick
Date: Tue Aug 16 17:07:48 2016
New Revision: 304230
URL: https://svnweb.freebsd.org/changeset/base/304230

Log:
  Add two new macros, SLIST_CONCAT and LIST_CONCAT. Note in both the
  queue.h header file and in the queue.3 manual page that they are O(n)
  so should be used only in low-usage paths with short lists (otherwise
  an STAILQ or TAILQ should be used).
  
  Reviewed by: kib

Modified:
  head/share/man/man3/queue.3
  head/sys/sys/queue.h

Modified: head/share/man/man3/queue.3
==
--- head/share/man/man3/queue.3 Tue Aug 16 17:05:15 2016(r304229)
+++ head/share/man/man3/queue.3 Tue Aug 16 17:07:48 2016(r304230)
@@ -28,12 +28,13 @@
 .\"@(#)queue.3 8.2 (Berkeley) 1/24/94
 .\" $FreeBSD$
 .\"
-.Dd June 24, 2015
+.Dd August 15, 2016
 .Dt QUEUE 3
 .Os
 .Sh NAME
 .Nm SLIST_CLASS_ENTRY ,
 .Nm SLIST_CLASS_HEAD ,
+.Nm SLIST_CONCAT ,
 .Nm SLIST_EMPTY ,
 .Nm SLIST_ENTRY ,
 .Nm SLIST_FIRST ,
@@ -75,6 +76,7 @@
 .Nm STAILQ_SWAP ,
 .Nm LIST_CLASS_ENTRY ,
 .Nm LIST_CLASS_HEAD ,
+.Nm LIST_CONCAT ,
 .Nm LIST_EMPTY ,
 .Nm LIST_ENTRY ,
 .Nm LIST_FIRST ,
@@ -125,6 +127,7 @@ lists and tail queues
 .\"
 .Fn SLIST_CLASS_ENTRY "CLASSTYPE"
 .Fn SLIST_CLASS_HEAD "HEADNAME" "CLASSTYPE"
+.Fn SLIST_CONCAT "SLIST_HEAD *head1" "SLIST_HEAD *head2" "TYPE" "SLIST_ENTRY 
NAME"
 .Fn SLIST_EMPTY "SLIST_HEAD *head"
 .Fn SLIST_ENTRY "TYPE"
 .Fn SLIST_FIRST "SLIST_HEAD *head"
@@ -168,6 +171,7 @@ lists and tail queues
 .\"
 .Fn LIST_CLASS_ENTRY "CLASSTYPE"
 .Fn LIST_CLASS_HEAD "HEADNAME" "CLASSTYPE"
+.Fn LIST_CONCAT "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME"
 .Fn LIST_EMPTY "LIST_HEAD *head"
 .Fn LIST_ENTRY "TYPE"
 .Fn LIST_FIRST "LIST_HEAD *head"
@@ -249,6 +253,8 @@ Singly-linked lists add the following fu
 .Bl -enum -compact -offset indent
 .It
 O(n) removal of any entry in the list.
+.It
+O(n) concatenation of two lists.
 .El
 .Pp
 Singly-linked tail queues add the following functionality:
@@ -296,6 +302,8 @@ Linked lists are the simplest of the dou
 They add the following functionality over the above:
 .Bl -enum -compact -offset indent
 .It
+O(n) concatenation of two lists.
+.It
 They may be traversed backwards.
 .El
 However:
@@ -401,6 +409,19 @@ evaluates to an initializer for the list
 .Fa head .
 .Pp
 The macro
+.Nm SLIST_CONCAT
+concatenates the list headed by
+.Fa head2
+onto the end of the one headed by
+.Fa head1
+removing all entries from the former.
+Use of this macro should be avoided as it traverses the entirety of the
+.Fa head1
+list.
+A singly-linked tail queue should be used if this macro is needed in
+high-usage code paths or to operate on long lists.
+.Pp
+The macro
 .Nm SLIST_EMPTY
 evaluates to true if there are no elements in the list.
 .Pp
@@ -508,6 +529,9 @@ The macro
 removes the element
 .Fa elm
 from the list.
+Use of this macro should be avoided as it traverses the entire list.
+A doubly-linked list should be used if this macro is needed in
+high-usage code paths or to operate on long lists.
 .Pp
 The macro
 .Nm SLIST_SWAP
@@ -724,6 +748,9 @@ The macro
 removes the element
 .Fa elm
 from the tail queue.
+Use of this macro should be avoided as it traverses the entire list.
+A doubly-linked tail queue should be used if this macro is needed in
+high-usage code paths or to operate on long tail queues.
 .Pp
 The macro
 .Nm STAILQ_SWAP
@@ -823,6 +850,19 @@ evaluates to an initializer for the list
 .Fa head .
 .Pp
 The macro
+.Nm LIST_CONCAT
+concatenates the list headed by
+.Fa head2
+onto the end of the one headed by
+.Fa head1
+removing all entries from the former.
+Use of this macro should be avoided as it traverses the entirety of the
+.Fa head1
+list.
+A tail queue should be used if this macro is needed in
+high-usage code paths or to operate on long lists.
+.Pp
+The macro
 .Nm LIST_EMPTY
 evaluates to true if there are no elements in the list.
 .Pp

Modified: head/sys/sys/queue.h
==
--- head/sys/sys/queue.hTue Aug 16 17:05:15 2016(r304229)
+++ head/sys/sys/queue.hTue Aug 16 17:07:48 2016(r304230)
@@ -76,6 +76,10 @@
  *
  * For details on the use of these macros, see the queue(3) manual page.
  *
+ * Below is a summary of implemented functions where:
+ *  +  means the macro is available
+ *  -  means the macro is not available
+ *  s  means the macro is available but is slow (runs in O(n) time)
  *
  * SLIST   LISTSTAILQ  TAILQ
  * _HEAD   +   +   +   +
@@ -101,10 +105,10 @@
  * _INSERT_BEFORE  -   +   -   +
  * _INSERT_AFTER   +   +   +   +
  * _INSERT_TAIL-   -   +   +
- * _CONCAT -   -   +   +
+ * _CONCAT s   s   +   +
  * _REMOVE_AFTER   +   -

svn commit: r304229 - head/sys/ufs/ffs

2016-08-16 Thread Konstantin Belousov
Author: kib
Date: Tue Aug 16 17:05:15 2016
New Revision: 304229
URL: https://svnweb.freebsd.org/changeset/base/304229

Log:
  When looking up dandling buffers for unwing after failing block
  allocation in UFS_BALLOC(), there is no need to map them.
  
  Reviewed by:  mckusick
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/ufs/ffs/ffs_balloc.c

Modified: head/sys/ufs/ffs/ffs_balloc.c
==
--- head/sys/ufs/ffs/ffs_balloc.c   Tue Aug 16 16:50:48 2016
(r304228)
+++ head/sys/ufs/ffs/ffs_balloc.c   Tue Aug 16 17:05:15 2016
(r304229)
@@ -484,7 +484,8 @@ fail:
 * We shall not leave the freed blocks on the vnode
 * buffer object lists.
 */
-   bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT);
+   bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0,
+   GB_NOCREAT | GB_UNMAPPED);
if (bp != NULL) {
bp->b_flags |= (B_INVAL | B_RELBUF);
bp->b_flags &= ~B_ASYNC;
@@ -1061,7 +1062,8 @@ fail:
 * We shall not leave the freed blocks on the vnode
 * buffer object lists.
 */
-   bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT);
+   bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0,
+   GB_NOCREAT | GB_UNMAPPED);
if (bp != NULL) {
bp->b_flags |= (B_INVAL | B_RELBUF);
bp->b_flags &= ~B_ASYNC;
___
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: r304228 - head/sys/ufs/ffs

2016-08-16 Thread Konstantin Belousov
Author: kib
Date: Tue Aug 16 16:50:48 2016
New Revision: 304228
URL: https://svnweb.freebsd.org/changeset/base/304228

Log:
  When block allocation fails in UFS_BALLOC(), and the volume does not
  have SU enabled, there is no point in calling softdep_request_cleanup().
  
  The call cannot produce free blocks, but we unecessarily lock ufsmount
  and do inode block write.  Usual point of not doing optimizations for
  the corner case of the full volume is not applicable there, the work
  is easily avoidable, and the addition CPU and disk io load do not lead
  to succeeding retry.
  
  Reviewed by:  mckusick
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/ufs/ffs/ffs_balloc.c

Modified: head/sys/ufs/ffs/ffs_balloc.c
==
--- head/sys/ufs/ffs/ffs_balloc.c   Tue Aug 16 16:49:56 2016
(r304227)
+++ head/sys/ufs/ffs/ffs_balloc.c   Tue Aug 16 16:50:48 2016
(r304228)
@@ -311,7 +311,7 @@ retry:
if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
flags | IO_BUFLOCKED, cred, )) != 0) {
brelse(bp);
-   if (++reclaimed == 1) {
+   if (DOINGSOFTDEP(vp) && ++reclaimed == 1) {
UFS_LOCK(ump);
softdep_request_cleanup(fs, vp, cred,
FLUSH_BLOCKS_WAIT);
@@ -390,7 +390,7 @@ retry:
flags | IO_BUFLOCKED, cred, );
if (error) {
brelse(bp);
-   if (++reclaimed == 1) {
+   if (DOINGSOFTDEP(vp) && ++reclaimed == 1) {
UFS_LOCK(ump);
softdep_request_cleanup(fs, vp, cred,
FLUSH_BLOCKS_WAIT);
@@ -881,7 +881,7 @@ retry:
if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
flags | IO_BUFLOCKED, cred, )) != 0) {
brelse(bp);
-   if (++reclaimed == 1) {
+   if (DOINGSOFTDEP(vp) && ++reclaimed == 1) {
UFS_LOCK(ump);
softdep_request_cleanup(fs, vp, cred,
FLUSH_BLOCKS_WAIT);
@@ -961,7 +961,7 @@ retry:
flags | IO_BUFLOCKED, cred, );
if (error) {
brelse(bp);
-   if (++reclaimed == 1) {
+   if (DOINGSOFTDEP(vp) && ++reclaimed == 1) {
UFS_LOCK(ump);
softdep_request_cleanup(fs, vp, cred,
FLUSH_BLOCKS_WAIT);
___
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: r304227 - head/sys/ufs/ffs

2016-08-16 Thread Konstantin Belousov
Author: kib
Date: Tue Aug 16 16:49:56 2016
New Revision: 304227
URL: https://svnweb.freebsd.org/changeset/base/304227

Log:
  In ffs_balloc_ufs{1,2} routines, assert that unwind records do not
  overflow local arrays.  This is not immediately obvious from the
  static code inspection, due to retry logic.
  
  Reviewed by:  mckusick
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/ufs/ffs/ffs_balloc.c

Modified: head/sys/ufs/ffs/ffs_balloc.c
==
--- head/sys/ufs/ffs/ffs_balloc.c   Tue Aug 16 15:53:05 2016
(r304226)
+++ head/sys/ufs/ffs/ffs_balloc.c   Tue Aug 16 16:49:56 2016
(r304227)
@@ -255,6 +255,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t 
}
pref = newb + fs->fs_frag;
nb = newb;
+   MPASS(allocblk < allociblk + nitems(allociblk));
+   MPASS(lbns_remfree < lbns + nitems(lbns));
*allocblk++ = nb;
*lbns_remfree++ = indirs[1].in_lbn;
bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, gbflags);
@@ -325,6 +327,8 @@ retry:
}
pref = newb + fs->fs_frag;
nb = newb;
+   MPASS(allocblk < allociblk + nitems(allociblk));
+   MPASS(lbns_remfree < lbns + nitems(lbns));
*allocblk++ = nb;
*lbns_remfree++ = indirs[i].in_lbn;
nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0);
@@ -401,6 +405,8 @@ retry:
goto fail;
}
nb = newb;
+   MPASS(allocblk < allociblk + nitems(allociblk));
+   MPASS(lbns_remfree < lbns + nitems(lbns));
*allocblk++ = nb;
*lbns_remfree++ = lbn;
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags);
@@ -818,6 +824,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t 
}
pref = newb + fs->fs_frag;
nb = newb;
+   MPASS(allocblk < allociblk + nitems(allociblk));
+   MPASS(lbns_remfree < lbns + nitems(lbns));
*allocblk++ = nb;
*lbns_remfree++ = indirs[1].in_lbn;
bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0,
@@ -889,6 +897,8 @@ retry:
}
pref = newb + fs->fs_frag;
nb = newb;
+   MPASS(allocblk < allociblk + nitems(allociblk));
+   MPASS(lbns_remfree < lbns + nitems(lbns));
*allocblk++ = nb;
*lbns_remfree++ = indirs[i].in_lbn;
nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0,
@@ -966,6 +976,8 @@ retry:
goto fail;
}
nb = newb;
+   MPASS(allocblk < allociblk + nitems(allociblk));
+   MPASS(lbns_remfree < lbns + nitems(lbns));
*allocblk++ = nb;
*lbns_remfree++ = lbn;
nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags);
___
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: r304221 - head/sys/boot/efi/boot1

2016-08-16 Thread Bruce Evans

On Tue, 16 Aug 2016, Ed Schouten wrote:


Hi Emmanuel,


Log:
  Use %ju modifier for u_int64_t and %jd modifier for off_t.
  off_t is long long on arm32 and long on amd64


I think both of these should be solved differently:

- For uint64_t, you can use 's PRIu64 in the formatting
string. In kernel space, I suspect you need to use something like
.


Ugh.


- For off_t, it's all right to print it with %jd, but then be sure to
also add a cast to the argument itself. It may not necessarily be
equal to an intmax_t.


This shows how stupid the PRI* macros are.  They might be available for
0.1% of typedefed types in a medium-sized source tree.  But to use them,
you have to know their exact type, and change all printfs using them
whenever the typedef is changed.  If it is changed to a non-fixed width
type, then the printfs need lots of editing to change to a cast.  Their
only advantage is that they are more space and time efficient, especially
on 16-bit systems.

Extensive use of fixed-width type is another bug.  It asks for a fixed
ABI at any cost to efficiency or space.  FreeBSD almost never uses
"fast" or "least" integer types.  However, if you use these types, there
are PRI* mistakes for them too.

The SCN* macros are not quite as stupid as PRI*, but they should never
be used.  scanf() is already unusable since it gives undefined
behaviour on overflow.  These macros are not quite as stupid as PRI*
since casts don't work so well for input.  The corrsponding thing is
to scan input into variables of type [u]intmax_t and convert to the
corresponding type, of course without any bounds checking so that
you get similar undefined behaviour on overflow as when using SCN*.

Bruce
___
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: r304226 - head/usr.bin/rpcgen

2016-08-16 Thread Marcelo Araujo
Author: araujo
Date: Tue Aug 16 15:53:05 2016
New Revision: 304226
URL: https://svnweb.freebsd.org/changeset/base/304226

Log:
  Use nitems() from sys/param.h.
  
  MFC after:2 weeks.

Modified:
  head/usr.bin/rpcgen/rpc_main.c

Modified: head/usr.bin/rpcgen/rpc_main.c
==
--- head/usr.bin/rpcgen/rpc_main.c  Tue Aug 16 15:52:10 2016
(r304225)
+++ head/usr.bin/rpcgen/rpc_main.c  Tue Aug 16 15:53:05 2016
(r304226)
@@ -82,11 +82,11 @@ static char pathbuf[MAXPATHLEN + 1];
 static const char *allv[] = {
"rpcgen", "-s", "udp", "-s", "tcp",
 };
-static int allc = sizeof (allv)/sizeof (allv[0]);
+static int allc = nitems(allv);
 static const char *allnv[] = {
"rpcgen", "-s", "netpath",
 };
-static int allnc = sizeof (allnv)/sizeof (allnv[0]);
+static int allnc = nitems(allnv);
 
 /*
  * machinations for handling expanding argument list
___
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: r304225 - head/usr.bin/systat

2016-08-16 Thread Marcelo Araujo
Author: araujo
Date: Tue Aug 16 15:52:10 2016
New Revision: 304225
URL: https://svnweb.freebsd.org/changeset/base/304225

Log:
  Use nitems() from sys/param.h.
  
  MFC after:2 weeks.

Modified:
  head/usr.bin/systat/main.c

Modified: head/usr.bin/systat/main.c
==
--- head/usr.bin/systat/main.c  Tue Aug 16 15:17:36 2016(r304224)
+++ head/usr.bin/systat/main.c  Tue Aug 16 15:52:10 2016(r304225)
@@ -261,7 +261,7 @@ display(void)
int i, j;
 
/* Get the load average over the last minute. */
-   (void) getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
+   (void) getloadavg(avenrun, nitems(avenrun));
(*curcmd->c_fetch)();
if (curcmd->c_flags & CF_LOADAV) {
j = 5.0*avenrun[0] + 0.5;
@@ -293,7 +293,7 @@ display(void)
GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc[5]);
GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc[6]);
wmove(wload, 0, 0); wclrtoeol(wload);
-   for (i = 0 ; i < sizeof(arc) / sizeof(arc[0]) ; i++) {
+   for (i = 0 ; i < nitems(arc); i++) {
if (arc[i] > 10llu * 1024 * 1024 * 1024 ) {
wprintw(wload, "%7lluG", arc[i] >> 30);
}
@@ -318,7 +318,7 @@ void
 load(void)
 {
 
-   (void) getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0]));
+   (void) getloadavg(avenrun, nitems(avenrun));
mvprintw(CMDLINE, 0, "%4.1f %4.1f %4.1f",
avenrun[0], avenrun[1], avenrun[2]);
clrtoeol();
___
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: r304011 - head/libexec/rtld-elf

2016-08-16 Thread Bryan Drewery
On 8/16/16 4:32 PM, Ravi Pokala wrote:
> -Original Message-
> From:  on behalf of Bryan Drewery 
> 
> Organization: FreeBSD
> Date: 2016-08-16, Tuesday at 03:30
> To: Ngie Cooper , Konstantin Belousov 
> 
> Cc: , , 
> 
> Subject: Re: svn commit: r304011 - head/libexec/rtld-elf
> 
>> On 8/12/16 7:34 PM, Ngie Cooper wrote:
>>>
>>> ...
>>>
 Log:
  Remove all remaining uses of TAILQ_FOREACH_FROM() from rtld-elf.
>>>
>>> Why?
>>>
>>
>> It's a somewhat error-prone and dangerous macro. See r302908.
> 
> I'll grant you "error-prone", but why do you consider it "dangerous"? It's 
> inefficient to walk the whole list when passing NULL as the starting pointer, 
> but I'm not sure what the danger is.
> 

I don't mean "dangerous" here as in security, but as in "doing the right
thing" or "doing what is expected", which it did not as seen in r302908.
 Granted, the original commit for _FROM noted this problem, but it is
very much not obvious.

> And, if it really *is* dangerous, perhaps we should purge the 
> TAILQ_FOREACH_FROM APIs entirely? It looks like rtld-elf was the last 
> (in-tree) user:
> 

I'm not a fan of having it with this behavior, but I understand why it
was designed like this.

> [freebsd/base/head] rpokala% grep -rl TAILQ_FOREACH_FROM .
> ./share/man/man3/Makefile
> ./share/man/man3/queue.3
> ./sys/sys/queue.h
> 
> I confirmed that queue.h just defines the (S)TAILQ_FOREACH_FROM(_SAFE) 
> macros, but doesn't use them internally to define anything else.
> 
> -Ravi (rpokala@)
> 
>> -- 
>> Regards,
>> Bryan Drewery 
> 
> 
> 


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r304011 - head/libexec/rtld-elf

2016-08-16 Thread Ravi Pokala
-Original Message-
From:  on behalf of Bryan Drewery 

Organization: FreeBSD
Date: 2016-08-16, Tuesday at 03:30
To: Ngie Cooper , Konstantin Belousov 
Cc: , , 

Subject: Re: svn commit: r304011 - head/libexec/rtld-elf

>On 8/12/16 7:34 PM, Ngie Cooper wrote:
>> 
>> ...
>>
>>> Log:
>>>  Remove all remaining uses of TAILQ_FOREACH_FROM() from rtld-elf.
>> 
>> Why?
>> 
> 
> It's a somewhat error-prone and dangerous macro. See r302908.

I'll grant you "error-prone", but why do you consider it "dangerous"? It's 
inefficient to walk the whole list when passing NULL as the starting pointer, 
but I'm not sure what the danger is.

And, if it really *is* dangerous, perhaps we should purge the 
TAILQ_FOREACH_FROM APIs entirely? It looks like rtld-elf was the last (in-tree) 
user:

[freebsd/base/head] rpokala% grep -rl TAILQ_FOREACH_FROM .
./share/man/man3/Makefile
./share/man/man3/queue.3
./sys/sys/queue.h

I confirmed that queue.h just defines the (S)TAILQ_FOREACH_FROM(_SAFE) macros, 
but doesn't use them internally to define anything else.

-Ravi (rpokala@)

> -- 
> Regards,
> Bryan Drewery 


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

2016-08-16 Thread Randall Stewart
Author: rrs
Date: Tue Aug 16 15:17:36 2016
New Revision: 304224
URL: https://svnweb.freebsd.org/changeset/base/304224

Log:
  A few more wording tweaks as suggested (with some modifications
  as well) by Ravi Pokala. Thanks for the comments :-)
  Sponsored by: Netflix Inc.

Modified:
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cTue Aug 16 15:11:46 2016
(r304223)
+++ head/sys/netinet/tcp_timer.cTue Aug 16 15:17:36 2016
(r304224)
@@ -307,15 +307,15 @@ tcp_timer_delack(void *xtp)
  * should only have grabbed the INP_WLOCK() when
  * it entered. To safely switch to holding both the
  * INP_INFO_RLOCK() and the INP_WLOCK() we must first
- * grab a reference on the inp, this will hold the inp
- * so that it can't be removed. We then unlock and grab
- * the info-read lock. Once we have the INP_INFO_RLOCK() we
- * proceed again to get the INP_WLOCK() but after that
- * we must check if someone else deleted the pcb i.e.
- * the inp_flags check.If so we return 1 otherwise 
- * we return 0.
+ * grab a reference on the inp, which will hold the inp
+ * so that it can't be removed. We then unlock the INP_WLOCK(), 
+ * and grab the INP_INFO_RLOCK() lock. Once we have the INP_INFO_RLOCK()
+ * we proceed again to get the INP_WLOCK() (this preserves proper
+ * lock order). After acquiring the INP_WLOCK we must check if someone 
+ * else deleted the pcb i.e. the inp_flags check.
+ * If so we return 1 otherwise we return 0.
  *
- * No matter which the tcp_inpinfo_lock_add() function
+ * No matter what the tcp_inpinfo_lock_add() function
  * returns the caller must afterwards call tcp_inpinfo_lock_del()
  * to drop the locks and reference properly.
  */
___
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: r304223 - in head: share/man/man4 share/man/man9 sys/netinet

2016-08-16 Thread Randall Stewart
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

Modified: head/share/man/man4/tcp.4
==
--- head/share/man/man4/tcp.4   Tue Aug 16 14:33:25 2016(r304222)
+++ head/share/man/man4/tcp.4   Tue Aug 16 15:11:46 2016(r304223)
@@ -633,7 +633,8 @@ when trying to use a TCP function block 
 .Xr mod_cc 4 ,
 .Xr siftr 4 ,
 .Xr syncache 4 ,
-.Xr setkey 8
+.Xr setkey 8 ,
+.Xr tcp_functions 9
 .Rs
 .%A "V. Jacobson"
 .%A "R. Braden"

Modified: head/share/man/man9/tcp_functions.9
==
--- head/share/man/man9/tcp_functions.9 Tue Aug 16 14:33:25 2016
(r304222)
+++ head/share/man/man9/tcp_functions.9 Tue Aug 16 15:11:46 2016
(r304223)
@@ -114,14 +114,17 @@ struct tcp_function_block {
struct inpcb *inp, struct tcpcb *tp);
/* Optional memory allocation/free routine */
void(*tfb_tcp_fb_init)(struct tcpcb *);
-   void(*tfb_tcp_fb_fini)(struct tcpcb *);
+   void(*tfb_tcp_fb_fini)(struct tcpcb *, int);
/* Optional timers, must define all if you define one */
int (*tfb_tcp_timer_stop_all)(struct tcpcb *);
void(*tfb_tcp_timer_activate)(struct tcpcb *,
uint32_t, u_int);
int (*tfb_tcp_timer_active)(struct tcpcb *, uint32_t);
void(*tfb_tcp_timer_stop)(struct tcpcb *, uint32_t);
+   /* Optional functions */
void(*tfb_tcp_rexmit_tmr)(struct tcpcb *);
+   void(*tfb_tcp_handoff_ok)(struct tcpcb *);
+   /* System use */
volatile uint32_t tfb_refcnt;
uint32_t  tfb_flags;
 };
@@ -157,6 +160,16 @@ in the
 .Va tfb_tcp_fb_fini
 field.
 .Pp
+If the
+.Va tfb_tcp_fb_fini
+argument is non-NULL, the function to which it points is called when the
+kernel is destroying the TCP control block or when the socket is transitioning
+to use a different TCP stack.
+The function is called with arguments of the TCP control block and an integer
+flag.
+The flag will be zero if the socket is transitioning to use another TCP stack
+or one if the TCP control block is being destroyed.
+.Pp
 If the TCP stack implements additional timers, the TCP stack should set a
 non-NULL pointer in the
 .Va tfb_tcp_timer_stop_all ,
@@ -193,6 +206,37 @@ However, care must be taken to ensure th
 TCP control block in a valid state for the remainder of the retransmit
 timer logic.
 .Pp
+A user may select a new TCP stack before calling
+.Xr connect 2
+or
+.Xr listen 2 .
+Optionally, a TCP stack may also allow a user to begin using the TCP stack for
+a connection that is in a later state by setting a non-NULL function pointer in
+the
+.Va tfb_tcp_handoff_ok
+field.
+If this field is non-NULL and a user attempts to select that TCP stack after
+calling
+.Xr connect 2
+or
+.Xr listen 2
+for that socket, the kernel will call the function pointed to by the
+.Va tfb_tcp_handoff_ok
+field.
+The function should return 0 if the user is allowed to switch the socket to use
+the TCP stack. Otherwise, the function should return an error code, which will
+be returned to the user.
+If the
+.Va tfb_tcp_handoff_ok
+field is
+.Dv NULL
+and a user attempts to select the TCP stack after calling
+.Xr connect 2
+or
+.Xr listen 2
+for that socket, the operation will fail and the kernel will return
+.Er EINVAL .
+.Pp
 The
 .Va tfb_refcnt
 and
@@ -269,8 +313,10 @@ The
 .Fa blk
 argument references a function block that is not currently registered.
 .Sh SEE ALSO
-.Xr malloc 9 ,
-.Xr tcp 4
+.Xr connect 2 ,
+.Xr listen 2 ,
+.Xr tcp 4 ,
+.Xr malloc 9
 .Sh HISTORY
 This framework first appeared in
 .Fx 11.0 .

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Tue Aug 16 14:33:25 2016(r304222)
+++ head/sys/netinet/tcp_subr.c Tue Aug 16 15:11:46 2016(r304223)
@@ -1187,9 +1187,6 @@ tcp_newtcpcb(struct inpcb *inp)
tp->t_fb = tcp_func_set_ptr;

Re: svn commit: r304221 - head/sys/boot/efi/boot1

2016-08-16 Thread Ed Schouten
Hi Emmanuel,

2016-08-16 16:23 GMT+02:00 Emmanuel Vadot :
> Author: manu
> Date: Tue Aug 16 14:23:35 2016
> New Revision: 304221
> URL: https://svnweb.freebsd.org/changeset/base/304221
>
> Log:
>   Use %ju modifier for u_int64_t and %jd modifier for off_t.
>   off_t is long long on arm32 and long on amd64

I think both of these should be solved differently:

- For uint64_t, you can use 's PRIu64 in the formatting
string. In kernel space, I suspect you need to use something like
.
- For off_t, it's all right to print it with %jd, but then be sure to
also add a cast to the argument itself. It may not necessarily be
equal to an intmax_t.

-- 
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"


svn commit: r304222 - head/sys/boot/efi/libefi

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 14:33:25 2016
New Revision: 304222
URL: https://svnweb.freebsd.org/changeset/base/304222

Log:
  Only use WaitForKeys event if it exists, this is not the case in u-boot efi 
implementation.
  
  Reviewed by:  jhb, emaste
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D6781

Modified:
  head/sys/boot/efi/libefi/efi_console.c

Modified: head/sys/boot/efi/libefi/efi_console.c
==
--- head/sys/boot/efi/libefi/efi_console.c  Tue Aug 16 14:23:35 2016
(r304221)
+++ head/sys/boot/efi/libefi/efi_console.c  Tue Aug 16 14:33:25 2016
(r304222)
@@ -438,8 +438,10 @@ efi_cons_getchar()
 
/* Try to read a key stroke. We wait for one if none is pending. */
status = conin->ReadKeyStroke(conin, );
-   if (status == EFI_NOT_READY) {
-   BS->WaitForEvent(1, >WaitForKey, );
+   while (status == EFI_NOT_READY) {
+   /* Some EFI implementation (u-boot for example) do not support 
WaitForKey */
+   if (conin->WaitForKey != NULL)
+   BS->WaitForEvent(1, >WaitForKey, );
status = conin->ReadKeyStroke(conin, );
}
switch (key.ScanCode) {
@@ -454,6 +456,9 @@ efi_cons_getchar()
 int
 efi_cons_poll()
 {
+
+   if (conin->WaitForKey == NULL)
+   return (1);
/* This can clear the signaled state. */
return (BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS);
 }
___
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: r304221 - head/sys/boot/efi/boot1

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 14:23:35 2016
New Revision: 304221
URL: https://svnweb.freebsd.org/changeset/base/304221

Log:
  Use %ju modifier for u_int64_t and %jd modifier for off_t.
  off_t is long long on arm32 and long on amd64
  
  MFC after:1 week

Modified:
  head/sys/boot/efi/boot1/ufs_module.c
  head/sys/boot/efi/boot1/zfs_module.c

Modified: head/sys/boot/efi/boot1/ufs_module.c
==
--- head/sys/boot/efi/boot1/ufs_module.cTue Aug 16 14:15:09 2016
(r304220)
+++ head/sys/boot/efi/boot1/ufs_module.cTue Aug 16 14:23:35 2016
(r304221)
@@ -56,7 +56,7 @@ dskread(void *buf, u_int64_t lba, int nb
devinfo->dev->Media->MediaId, lba, size, buf);
 
if (status != EFI_SUCCESS) {
-   DPRINTF("dskread: failed dev: %p, id: %u, lba: %lu, size: %d, "
+   DPRINTF("dskread: failed dev: %p, id: %u, lba: %zu, size: %d, "
"status: %lu\n", devinfo->dev,
devinfo->dev->Media->MediaId, lba, size,
EFI_ERROR_CODE(status));

Modified: head/sys/boot/efi/boot1/zfs_module.c
==
--- head/sys/boot/efi/boot1/zfs_module.cTue Aug 16 14:15:09 2016
(r304220)
+++ head/sys/boot/efi/boot1/zfs_module.cTue Aug 16 14:23:35 2016
(r304221)
@@ -53,7 +53,7 @@ vdev_read(vdev_t *vdev, void *priv, off_
status = devinfo->dev->ReadBlocks(devinfo->dev,
devinfo->dev->Media->MediaId, lba, bytes, buf);
if (status != EFI_SUCCESS) {
-   DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %zu, size: 
%zu,"
+   DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %jd, size: 
%zu,"
 " status: %lu\n", devinfo->dev,
 devinfo->dev->Media->MediaId, lba, bytes,
 EFI_ERROR_CODE(status));
___
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: r304220 - head/usr.bin/tty

2016-08-16 Thread Sofian Brabez
Author: sbz (ports committer)
Date: Tue Aug 16 14:15:09 2016
New Revision: 304220
URL: https://svnweb.freebsd.org/changeset/base/304220

Log:
  tty: Use proper definition of exit status code and stdin macro
  
  Reviewed by:  bapt, bdrewery
  Differential Revision:https://reviews.freebsd.org/D6828

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

Modified: head/usr.bin/tty/tty.c
==
--- head/usr.bin/tty/tty.c  Tue Aug 16 13:08:03 2016(r304219)
+++ head/usr.bin/tty/tty.c  Tue Aug 16 14:15:09 2016(r304220)
@@ -63,17 +63,18 @@ main(int argc, char *argv[])
case '?':
default:
usage();
+   /* NOTREACHED */
}
 
-   t = ttyname(0);
+   t = ttyname(STDIN_FILENO);
if (!sflag)
puts(t ? t : "not a tty");
-   exit(t ? 0 : 1);
+   exit(t ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 static void
 usage(void)
 {
-   fprintf(stderr, "usage: tty [-s]\n");
+   fprintf(stderr, "usage: %s [-s]\n", getprogname());
exit(2);
 }
___
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: r304070 - svnadmin/conf

2016-08-16 Thread Bryan Drewery
On 8/16/16 9:14 AM, Glen Barber wrote:
> On Tue, Aug 16, 2016 at 09:00:34AM +0100, Bruce Simpson wrote:
>> On 14/08/16 05:35, Glen Barber wrote:
>>> Author: gjb
>>> Date: Sun Aug 14 04:35:04 2016
>>> New Revision: 304070
>>> URL: https://svnweb.freebsd.org/changeset/base/304070
>>>
>>> Log:
>>>  Do not include C function changes by default in svn commit
>>>  email.
>>
>> Please back out -- this makes the diff output much less useful.
>>
> 
> https://svnweb.freebsd.org/changeset/base/304073
> 

Thank you.  This is incredibly useful, despite being wrong sometimes.
We've recently made ports use this by default for 'make makepatch'.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


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

2016-08-16 Thread Slawa Olhovchenkov
On Tue, Aug 16, 2016 at 06:21:14AM -0700, Randall Stewart via svn-src-all wrote:

> 
> In theory it *could* be MFC’d to stable-10 and 11 but I am not sure we want 
> to do that. I am
> told by Drew that it does improve performance since in stable-10 you are 
> getting the INFO_WLOCK()
> but I am not sure if folks want it MFC’d…
> 
> One thing that this code leads us towards is we *in theory* could move the 
> lock acquisition to the
> timer code itself (I think).. we would have to make sure that the callout 
> functions did do the
> unlock since thats part of the lock-dance with reference… but its 
> theoretically possible :-)

What reason to not MFC?
I mean MFCed all don't break API/ABI.
___
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: r304218 - head/sys/netinet

2016-08-16 Thread Randall Stewart via svn-src-all

In theory it *could* be MFC’d to stable-10 and 11 but I am not sure we want to 
do that. I am
told by Drew that it does improve performance since in stable-10 you are 
getting the INFO_WLOCK()
but I am not sure if folks want it MFC’d…

One thing that this code leads us towards is we *in theory* could move the lock 
acquisition to the
timer code itself (I think).. we would have to make sure that the callout 
functions did do the
unlock since thats part of the lock-dance with reference… but its theoretically 
possible :-)

R

> On Aug 16, 2016, at 6:18 AM, Slawa Olhovchenkov  wrote:
> 
> On Tue, Aug 16, 2016 at 12:40:56PM +, Randall Stewart wrote:
> 
>> Author: rrs
>> Date: Tue Aug 16 12:40:56 2016
>> New Revision: 304218
>> URL: https://svnweb.freebsd.org/changeset/base/304218
>> 
>> Log:
>>  This cleans up the timer code in TCP and also makes it so we do not
>>  take the INFO lock *unless* we are really going to delete the TCB.
>> 
>>  Differential Revision:  D7136
> 
> Is this related to stable/10?


Randall Stewart
r...@netflix.com
803-317-4952





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

2016-08-16 Thread Slawa Olhovchenkov
On Tue, Aug 16, 2016 at 12:40:56PM +, Randall Stewart wrote:

> Author: rrs
> Date: Tue Aug 16 12:40:56 2016
> New Revision: 304218
> URL: https://svnweb.freebsd.org/changeset/base/304218
> 
> Log:
>   This cleans up the timer code in TCP and also makes it so we do not
>   take the INFO lock *unless* we are really going to delete the TCB.
>   
>   Differential Revision:  D7136

Is this related to stable/10?
___
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: r304218 - head/sys/netinet

2016-08-16 Thread Randall Stewart via svn-src-all
Hans:

Take a look at the comments maybe they will help you understand whats going on.

The idea of it is that you *only* need the INFO_RLOCK when the timer function
wants to destroy the tcb (not all timers do this).. and yes usually the timer 
function
is going to call the drop/close path to purge the TCB. So in order to pick-up 
the info
lock you do the refcnt/lock-dance to get both locks in the proper lock order. 
This means
that someone could possibly come in and purge the tcb on you while you are in 
the
process of doing the lock-dance. 

If that occurs (the return code is 1) all the caller has to do is call the 
drop-lock function (the
mate to the add_lock) and then return (since the pcb is in the state the caller 
wants.. i.e. gone).
If the return code is 0, the caller can proceed to purge the tcb.. and then 
call the drop_lock function.

Note that in theory this could be used outside of wanting to kill the tcb.. but 
I am not sure why one
would want to hold the INFO_RLOCK if one did not want to purge the tcb.

R


> On Aug 16, 2016, at 6:14 AM, Hans Petter Selasky  wrote:
> 
> On 08/16/16 15:01, Randall Stewart wrote:
>> Sure
>> 
>> Let me add some comments for you. The idea her is that you pick-up a 
>> reference
>> to the PCB.. so it can’t be removed. Thus when you re-lock the INP you check 
>> the
>> dropped flag (just in case someone did get in).
> 
> And this code is only used before tcp_close() / tcp_drop(), so if others got 
> in it is safe to assume that the inp is dead?
> 
> --HPS


Randall Stewart
r...@netflix.com
803-317-4952





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

2016-08-16 Thread Hans Petter Selasky

On 08/16/16 15:01, Randall Stewart wrote:

Sure

Let me add some comments for you. The idea her is that you pick-up a reference
to the PCB.. so it can’t be removed. Thus when you re-lock the INP you check the
dropped flag (just in case someone did get in).


And this code is only used before tcp_close() / tcp_drop(), so if others 
got in it is safe to assume that the inp is dead?


--HPS
___
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: r304219 - head/sys/netinet

2016-08-16 Thread Randall Stewart
Author: rrs
Date: Tue Aug 16 13:08:03 2016
New Revision: 304219
URL: https://svnweb.freebsd.org/changeset/base/304219

Log:
  Comments describing how to properly use the new lock_add functions
  and its respective companion.
  
  Sponsored by: Netflix Inc.

Modified:
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cTue Aug 16 12:40:56 2016
(r304218)
+++ head/sys/netinet/tcp_timer.cTue Aug 16 13:08:03 2016
(r304219)
@@ -301,6 +301,25 @@ tcp_timer_delack(void *xtp)
CURVNET_RESTORE();
 }
 
+/*
+ * When a timer wants to remove a TCB it must
+ * hold the INP_INFO_RLOCK(). The timer function
+ * should only have grabbed the INP_WLOCK() when
+ * it entered. To safely switch to holding both the
+ * INP_INFO_RLOCK() and the INP_WLOCK() we must first
+ * grab a reference on the inp, this will hold the inp
+ * so that it can't be removed. We then unlock and grab
+ * the info-read lock. Once we have the INP_INFO_RLOCK() we
+ * proceed again to get the INP_WLOCK() but after that
+ * we must check if someone else deleted the pcb i.e.
+ * the inp_flags check.If so we return 1 otherwise 
+ * we return 0.
+ *
+ * No matter which the tcp_inpinfo_lock_add() function
+ * returns the caller must afterwards call tcp_inpinfo_lock_del()
+ * to drop the locks and reference properly.
+ */
+
 int
 tcp_inpinfo_lock_add(struct inpcb *inp)
 {
___
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: r304218 - head/sys/netinet

2016-08-16 Thread Randall Stewart via svn-src-all
Sure

Let me add some comments for you. The idea her is that you pick-up a reference
to the PCB.. so it can’t be removed. Thus when you re-lock the INP you check the
dropped flag (just in case someone did get in).

Let me get that in comments.. (note thats also why when using this function you
have to use its companion function to drop the reference).

> On Aug 16, 2016, at 5:58 AM, Hans Petter Selasky  wrote:
> 
> On 08/16/16 14:40, Randall Stewart wrote:
>> +int
>> +tcp_inpinfo_lock_add(struct inpcb *inp)
>> +{
>> +in_pcbref(inp);
>> +INP_WUNLOCK(inp);
>> +INP_INFO_RLOCK(_tcbinfo);
>> +INP_WLOCK(inp);
>> +if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
>> +return(1);
>> +}
>> +return(0);
>> +
>> +}
> 
> Hi,
> 
> Could you add some comments describing how it is considered safe to drop the 
> INP write-lock and then pick it up again?
> 
> My first impression is that because you are dropping the inp lock, multiple 
> threads can enter the code in question, leaving the window open to races?
> 
> --HPS


Randall Stewart
r...@netflix.com
803-317-4952





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

2016-08-16 Thread Hans Petter Selasky

On 08/16/16 14:40, Randall Stewart wrote:

+int
+tcp_inpinfo_lock_add(struct inpcb *inp)
+{
+   in_pcbref(inp);
+   INP_WUNLOCK(inp);
+   INP_INFO_RLOCK(_tcbinfo);
+   INP_WLOCK(inp);
+   if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
+   return(1);
+   }
+   return(0);
+
+}


Hi,

Could you add some comments describing how it is considered safe to drop 
the INP write-lock and then pick it up again?


My first impression is that because you are dropping the inp lock, 
multiple threads can enter the code in question, leaving the window open 
to races?


--HPS
___
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: r304218 - head/sys/netinet

2016-08-16 Thread Randall Stewart
Author: rrs
Date: Tue Aug 16 12:40:56 2016
New Revision: 304218
URL: https://svnweb.freebsd.org/changeset/base/304218

Log:
  This cleans up the timer code in TCP and also makes it so we do not
  take the INFO lock *unless* we are really going to delete the TCB.
  
  Differential Revision:D7136

Modified:
  head/sys/netinet/tcp_timer.c
  head/sys/netinet/tcp_timer.h

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cTue Aug 16 12:13:12 2016
(r304217)
+++ head/sys/netinet/tcp_timer.cTue Aug 16 12:40:56 2016
(r304218)
@@ -294,11 +294,6 @@ tcp_timer_delack(void *xtp)
CURVNET_RESTORE();
return;
}
-   KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
-   ("%s: tp %p tcpcb can't be stopped here", __func__, tp));
-   KASSERT((tp->t_timers->tt_flags & TT_DELACK) != 0,
-   ("%s: tp %p delack callout should be running", __func__, tp));
-
tp->t_flags |= TF_ACKNOW;
TCPSTAT_INC(tcps_delack);
(void) tp->t_fb->tfb_tcp_output(tp);
@@ -306,6 +301,39 @@ tcp_timer_delack(void *xtp)
CURVNET_RESTORE();
 }
 
+int
+tcp_inpinfo_lock_add(struct inpcb *inp)
+{
+   in_pcbref(inp);
+   INP_WUNLOCK(inp);
+   INP_INFO_RLOCK(_tcbinfo);
+   INP_WLOCK(inp);
+   if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
+   return(1);
+   }
+   return(0);
+
+}
+
+void
+tcp_inpinfo_lock_del(struct inpcb *inp, struct tcpcb *tp)
+{
+   INP_INFO_RUNLOCK(_tcbinfo);
+   if (inp && (tp == NULL)) {
+   /*
+* If tcp_close/drop() gets called and tp
+* returns NULL, then the function dropped
+* the inp lock, we hold a reference keeping
+* this around, so we must re-aquire the 
+* INP_WLOCK() in order to proceed with
+* our dropping the inp reference.
+*/
+   INP_WLOCK(inp);
+   }
+   if (inp && in_pcbrele_wlocked(inp) == 0)
+   INP_WUNLOCK(inp);
+}
+
 void
 tcp_timer_2msl(void *xtp)
 {
@@ -317,7 +345,6 @@ tcp_timer_2msl(void *xtp)
 
ostate = tp->t_state;
 #endif
-   INP_INFO_RLOCK(_tcbinfo);
inp = tp->t_inpcb;
KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
INP_WLOCK(inp);
@@ -325,21 +352,17 @@ tcp_timer_2msl(void *xtp)
if (callout_pending(>t_timers->tt_2msl) ||
!callout_active(>t_timers->tt_2msl)) {
INP_WUNLOCK(tp->t_inpcb);
-   INP_INFO_RUNLOCK(_tcbinfo);
CURVNET_RESTORE();
return;
}
callout_deactivate(>t_timers->tt_2msl);
if ((inp->inp_flags & INP_DROPPED) != 0) {
INP_WUNLOCK(inp);
-   INP_INFO_RUNLOCK(_tcbinfo);
CURVNET_RESTORE();
return;
}
KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
("%s: tp %p tcpcb can't be stopped here", __func__, tp));
-   KASSERT((tp->t_timers->tt_flags & TT_2MSL) != 0,
-   ("%s: tp %p 2msl callout should be running", __func__, tp));
/*
 * 2 MSL timeout in shutdown went off.  If we're closed but
 * still waiting for peer to close and connection has been idle
@@ -355,7 +378,6 @@ tcp_timer_2msl(void *xtp)
 */
if ((inp->inp_flags & INP_TIMEWAIT) != 0) {
INP_WUNLOCK(inp);
-   INP_INFO_RUNLOCK(_tcbinfo);
CURVNET_RESTORE();
return;
}
@@ -363,15 +385,26 @@ tcp_timer_2msl(void *xtp)
tp->t_inpcb && tp->t_inpcb->inp_socket && 
(tp->t_inpcb->inp_socket->so_rcv.sb_state & SBS_CANTRCVMORE)) {
TCPSTAT_INC(tcps_finwait2_drops);
+   if (tcp_inpinfo_lock_add(inp)) {
+   tcp_inpinfo_lock_del(inp, tp);
+   goto out;
+   }
tp = tcp_close(tp); 
+   tcp_inpinfo_lock_del(inp, tp);
+   goto out;
} else {
if (ticks - tp->t_rcvtime <= TP_MAXIDLE(tp)) {
-   if (!callout_reset(>t_timers->tt_2msl,
-  TP_KEEPINTVL(tp), tcp_timer_2msl, tp)) {
-   tp->t_timers->tt_flags &= ~TT_2MSL_RST;
+   callout_reset(>t_timers->tt_2msl,
+ TP_KEEPINTVL(tp), tcp_timer_2msl, tp);
+   } else {
+   if (tcp_inpinfo_lock_add(inp)) {
+   tcp_inpinfo_lock_del(inp, tp);
+   goto out;
}
-   } else
-  tp = tcp_close(tp);
+   tp = tcp_close(tp);
+   tcp_inpinfo_lock_del(inp, tp);
+  

svn commit: r304217 - head

2016-08-16 Thread Bryan Drewery
Author: bdrewery
Date: Tue Aug 16 12:13:12 2016
New Revision: 304217
URL: https://svnweb.freebsd.org/changeset/base/304217

Log:
  Trim unneeded bootstrap after r301470 made 9.1 the minimum supported release.
  
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Aug 16 11:38:45 2016(r304216)
+++ head/Makefile.inc1  Tue Aug 16 12:13:12 2016(r304217)
@@ -1581,10 +1581,6 @@ _groff=  gnu/usr.bin/groff \
 _vtfontcvt=usr.bin/vtfontcvt
 .endif
 
-.if ${BOOTSTRAPPING} < 92
-_sed=  usr.bin/sed
-.endif
-
 .if ${BOOTSTRAPPING} < 133
 _libopenbsd=   lib/libopenbsd
 _m4=   usr.bin/m4
@@ -1623,10 +1619,6 @@ _crunchide=  usr.sbin/crunch/crunchide
 _crunchgen=usr.sbin/crunch/crunchgen
 .endif
 
-.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
-_awk=  usr.bin/awk
-.endif
-
 # r296926 -P keymap search path, MFC to stable/10 in r298297
 .if ${BOOTSTRAPPING} < 1003501 || \
(${BOOTSTRAPPING} >= 110 && ${BOOTSTRAPPING} < 1100103)
@@ -1694,7 +1686,6 @@ bootstrap-tools: .PHONY
 ${_gperf} \
 ${_groff} \
 ${_dtc} \
-${_awk} \
 ${_cat} \
 ${_dd} \
 ${_kbdcontrol} \
@@ -1702,7 +1693,6 @@ bootstrap-tools: .PHONY
 ${_libopenbsd} \
 ${_makewhatis} \
 usr.bin/rpcgen \
-${_sed} \
 ${_yacc} \
 ${_m4} \
 ${_lex} \
___
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: r304216 - head/lib/libc/net

2016-08-16 Thread Brooks Davis
Author: brooks
Date: Tue Aug 16 11:38:45 2016
New Revision: 304216
URL: https://svnweb.freebsd.org/changeset/base/304216

Log:
  Don't conflate enum nss_status return values values with int (NS_SUCCESS,
  NS_RETURN) values.
  
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D6046

Modified:
  head/lib/libc/net/nss_compat.c

Modified: head/lib/libc/net/nss_compat.c
==
--- head/lib/libc/net/nss_compat.c  Tue Aug 16 09:12:45 2016
(r304215)
+++ head/lib/libc/net/nss_compat.c  Tue Aug 16 11:38:45 2016
(r304216)
@@ -97,9 +97,9 @@ __nss_compat_getgrnam_r(void *retval, vo
const char  *name;
struct group*grp;
char*buffer;
-   int *errnop;
+   int *errnop, ns_status;
size_t   bufsize;
-   enum nss_status  status;
+   enum nss_status  nss_status;
 
fn = mdata;
name = va_arg(ap, const char *);
@@ -107,11 +107,11 @@ __nss_compat_getgrnam_r(void *retval, vo
buffer = va_arg(ap, char *);
bufsize = va_arg(ap, size_t);
errnop = va_arg(ap, int *);
-   status = fn(name, grp, buffer, bufsize, errnop);
-   status = __nss_compat_result(status, *errnop);
-   if (status == NS_SUCCESS)
+   nss_status = fn(name, grp, buffer, bufsize, errnop);
+   ns_status = __nss_compat_result(nss_status, *errnop);
+   if (ns_status == NS_SUCCESS)
*(struct group **)retval = grp;
-   return (status);
+   return (ns_status);
 }
 
 
@@ -122,9 +122,9 @@ __nss_compat_getgrgid_r(void *retval, vo
gid_tgid;
struct group*grp;
char*buffer;
-   int *errnop;
+   int *errnop, ns_status;
size_t   bufsize;
-   enum nss_status  status;
+   enum nss_status  nss_status;

fn = mdata;
gid = va_arg(ap, gid_t);
@@ -132,11 +132,11 @@ __nss_compat_getgrgid_r(void *retval, vo
buffer = va_arg(ap, char *);
bufsize = va_arg(ap, size_t);
errnop = va_arg(ap, int *);
-   status = fn(gid, grp, buffer, bufsize, errnop);
-   status = __nss_compat_result(status, *errnop);
-   if (status == NS_SUCCESS)
+   nss_status = fn(gid, grp, buffer, bufsize, errnop);
+   ns_status = __nss_compat_result(nss_status, *errnop);
+   if (ns_status == NS_SUCCESS)
*(struct group **)retval = grp;
-   return (status);
+   return (ns_status);
 }
 
 
@@ -146,9 +146,9 @@ __nss_compat_getgrent_r(void *retval, vo
int (*fn)(struct group *, char *, size_t, int *);
struct group*grp;
char*buffer;
-   int *errnop;
+   int *errnop, ns_status;
size_t   bufsize;
-   enum nss_status  status;
+   enum nss_status  nss_status;
 
if (CHECK_TERMINATOR(group))
return (NS_NOTFOUND);
@@ -157,13 +157,13 @@ __nss_compat_getgrent_r(void *retval, vo
buffer = va_arg(ap, char *);
bufsize = va_arg(ap, size_t);
errnop = va_arg(ap, int *);
-   status = fn(grp, buffer, bufsize, errnop);
-   status = __nss_compat_result(status, *errnop);
-   if (status == NS_SUCCESS)
+   nss_status = fn(grp, buffer, bufsize, errnop);
+   ns_status = __nss_compat_result(nss_status, *errnop);
+   if (ns_status == NS_SUCCESS)
*(struct group **)retval = grp;
-   else if (status != NS_RETURN)
+   else if (ns_status != NS_RETURN)
SET_TERMINATOR(group, );
-   return (status);
+   return (ns_status);
 }
 
 
@@ -198,9 +198,9 @@ __nss_compat_getpwnam_r(void *retval, vo
const char  *name;
struct passwd   *pwd;
char*buffer;
-   int *errnop;
+   int *errnop, ns_status;
size_t   bufsize;
-   enum nss_status  status;
+   enum nss_status  nss_status;
 
fn = mdata;
name = va_arg(ap, const char *);
@@ -208,11 +208,11 @@ __nss_compat_getpwnam_r(void *retval, vo
buffer = va_arg(ap, char *);
bufsize = va_arg(ap, size_t);
errnop = va_arg(ap, int *);
-   status = fn(name, pwd, buffer, bufsize, errnop);
-   status = __nss_compat_result(status, *errnop);
-   if (status == NS_SUCCESS)
+   nss_status = fn(name, pwd, buffer, bufsize, errnop);
+   ns_status = __nss_compat_result(nss_status, *errnop);
+   if (ns_status == NS_SUCCESS)
*(struct passwd **)retval = pwd;
-   return (status);
+   return (ns_status);
 }
 
 
@@ -223,9 +223,9 @@ __nss_compat_getpwuid_r(void *retval, vo
uid_tuid;
struct passwd   *pwd;
char*buffer;
-   int *errnop;
+   int *errnop, ns_status;
size_t  

Re: svn commit: r304011 - head/libexec/rtld-elf

2016-08-16 Thread Bryan Drewery
On 8/12/16 7:34 PM, Ngie Cooper wrote:
> 
>> On Aug 12, 2016, at 11:29, Konstantin Belousov  wrote:
>>
>> Author: kib
>> Date: Fri Aug 12 18:29:11 2016
>> New Revision: 304011
>> URL: https://svnweb.freebsd.org/changeset/base/304011
>>
>> Log:
>>  Remove all remaining uses of TAILQ_FOREACH_FROM() from rtld-elf.
> 
> Why?
> 

It's a somewhat error-prone and dangerous macro. See r302908.


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r304215 - in stable/11/sys: boot/fdt/dts/arm modules/dtb/allwinner

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 09:12:45 2016
New Revision: 304215
URL: https://svnweb.freebsd.org/changeset/base/304215

Log:
  MFC r303974:
  ename pcduino3b.dts to pcduino3.dts
  The only difference between 3 and 3B is the size of the RJ45 port.
  And now we have a uboot port that expect pcduino3.dts to be present.
  
  Reported by:  imp

Added:
  stable/11/sys/boot/fdt/dts/arm/pcduino3.dts
 - copied unchanged from r303974, head/sys/boot/fdt/dts/arm/pcduino3.dts
Deleted:
  stable/11/sys/boot/fdt/dts/arm/pcduino3b.dts
Modified:
  stable/11/sys/modules/dtb/allwinner/Makefile
Directory Properties:
  stable/11/   (props changed)

Copied: stable/11/sys/boot/fdt/dts/arm/pcduino3.dts (from r303974, 
head/sys/boot/fdt/dts/arm/pcduino3.dts)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/sys/boot/fdt/dts/arm/pcduino3.dts Tue Aug 16 09:12:45 2016
(r304215, copy of r303974, head/sys/boot/fdt/dts/arm/pcduino3.dts)
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2016 Emmanuel Vadot 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include "sun7i-a20-pcduino3.dts"
+#include "sun7i-a20-hdmi.dtsi"
+#include "xpowers-axp209.dtsi"
+
+/ {
+   soc@01c0 {
+   hdmi@01c16000 {
+   status = "okay";
+   };
+
+   hdmiaudio {
+   status = "okay";
+   };
+   };
+};
+
+ {
+  pinctrl-0 = <_pins_rgmii_a>;
+  phy-mode = "rgmii";
+};

Modified: stable/11/sys/modules/dtb/allwinner/Makefile
==
--- stable/11/sys/modules/dtb/allwinner/MakefileTue Aug 16 09:10:18 
2016(r304214)
+++ stable/11/sys/modules/dtb/allwinner/MakefileTue Aug 16 09:12:45 
2016(r304215)
@@ -7,7 +7,7 @@ DTS=\
cubieboard2.dts \
olimex-a20-som-evb.dts \
olinuxino-lime.dts \
-   pcduino3b.dts \
+   pcduino3.dts \
sinovoip-bpi-m3.dts
 
 .include 
___
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: r304214 - stable/11/sys/arm/allwinner

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 09:10:18 2016
New Revision: 304214
URL: https://svnweb.freebsd.org/changeset/base/304214

Log:
  MFC r303728:
  We need aw_nmi to be attached which needs GIC so attach a bit later.
  Also the GPIOC doesn't need to be attach early
  
  Reviewed by:  andrew
  Differential Revision:https://reviews.freebsd.org/D7082

Modified:
  stable/11/sys/arm/allwinner/axp209.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/axp209.c
==
--- stable/11/sys/arm/allwinner/axp209.cTue Aug 16 09:08:44 2016
(r304213)
+++ stable/11/sys/arm/allwinner/axp209.cTue Aug 16 09:10:18 2016
(r304214)
@@ -707,10 +707,10 @@ extern devclass_t ofwgpiobus_devclass, g
 extern driver_t ofw_gpiobus_driver, gpioc_driver;
 
 EARLY_DRIVER_MODULE(axp209, iicbus, axp209_driver, axp209_devclass,
-  0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
+  0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
 EARLY_DRIVER_MODULE(ofw_gpiobus, axp209_pmu, ofw_gpiobus_driver,
-ofwgpiobus_devclass, 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
-EARLY_DRIVER_MODULE(gpioc, axp209_pmu, gpioc_driver, gpioc_devclass,
-0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
+ofwgpiobus_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
+DRIVER_MODULE(gpioc, axp209_pmu, gpioc_driver, gpioc_devclass,
+0, 0);
 MODULE_VERSION(axp209, 1);
 MODULE_DEPEND(axp209, iicbus, 1, 1, 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: r304213 - stable/11/sys/arm/allwinner

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 09:08:44 2016
New Revision: 304213
URL: https://svnweb.freebsd.org/changeset/base/304213

Log:
  MFC r303145:
  axp209 needs aw_nmi so attach a bit earlier
  
  Reviewed by:  andrew
  Differential Revision:https://reviews.freebsd.org/D7081

Modified:
  stable/11/sys/arm/allwinner/aw_nmi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/aw_nmi.c
==
--- stable/11/sys/arm/allwinner/aw_nmi.cTue Aug 16 09:06:23 2016
(r304212)
+++ stable/11/sys/arm/allwinner/aw_nmi.cTue Aug 16 09:08:44 2016
(r304213)
@@ -400,4 +400,4 @@ static driver_t aw_nmi_driver = {
 static devclass_t aw_nmi_devclass;
 
 EARLY_DRIVER_MODULE(aw_nmi, simplebus, aw_nmi_driver,
-aw_nmi_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST);
+aw_nmi_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
___
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: r304212 - stable/11/sys/arm/allwinner

2016-08-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 16 09:06:23 2016
New Revision: 304212
URL: https://svnweb.freebsd.org/changeset/base/304212

Log:
  MFC r303144:
  We need the GIC to be attached so attach later at BUS_PASS_INTERRUPT + 
BUS_PASS_ORDER_LATE
  
  Reviewed by:  andrew
  Differential Revision:https://reviews.freebsd.org/D7080

Modified:
  stable/11/sys/arm/allwinner/a10_gpio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_gpio.c
==
--- stable/11/sys/arm/allwinner/a10_gpio.c  Tue Aug 16 08:48:41 2016
(r304211)
+++ stable/11/sys/arm/allwinner/a10_gpio.c  Tue Aug 16 09:06:23 2016
(r304212)
@@ -708,4 +708,4 @@ static driver_t a10_gpio_driver = {
 };
 
 EARLY_DRIVER_MODULE(a10_gpio, simplebus, a10_gpio_driver, a10_gpio_devclass, 
0, 0,
-BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE);
+BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
___
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: r304211 - stable/9/usr.bin/getconf

2016-08-16 Thread Garrett Cooper
Author: ngie
Date: Tue Aug 16 08:48:41 2016
New Revision: 304211
URL: https://svnweb.freebsd.org/changeset/base/304211

Log:
  MFstable/10 r304210:
  
  MFstable/11 r304208:
  
  MFC r303830:
  
  Remove vestigal references to __alpha__
  
  Replace alpha reference in getconf(1) with amd64 [*]
  
  PR:   211300 [*]

Modified:
  stable/9/usr.bin/getconf/getconf.1
  stable/9/usr.bin/getconf/progenv.gperf
Directory Properties:
  stable/9/   (props changed)
  stable/9/usr.bin/   (props changed)

Modified: stable/9/usr.bin/getconf/getconf.1
==
--- stable/9/usr.bin/getconf/getconf.1  Tue Aug 16 08:30:28 2016
(r304210)
+++ stable/9/usr.bin/getconf/getconf.1  Tue Aug 16 08:48:41 2016
(r304211)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 18, 2002
+.Dd August 8, 2016
 .Dt GETCONF 1
 .Os
 .Sh NAME
@@ -122,7 +122,7 @@ Exactly 32-bit integer, long, and pointe
 .It Li POSIX_V6_LP64_OFF64
 Exactly 32-bit integer; exactly 64-bit long, pointer, and file offset.
 .Sy Supported platforms :
-.Tn Alpha ,
+.Tn AMD64 ,
 .Tn SPARC64 .
 .It Li POSIX_V6_LPBIG_OFFBIG
 At least 32-bit integer; at least 64-bit long, pointer, and file offset.

Modified: stable/9/usr.bin/getconf/progenv.gperf
==
--- stable/9/usr.bin/getconf/progenv.gperf  Tue Aug 16 08:30:28 2016
(r304210)
+++ stable/9/usr.bin/getconf/progenv.gperf  Tue Aug 16 08:48:41 2016
(r304211)
@@ -30,7 +30,7 @@ static const struct map *in_word_set(con
  * be updated.  (We cheat here and define the supported environments
  * statically.)
  */
-#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
+#if defined(__sparc64__) || defined(__amd64__)
 #definehave_LP64_OFF64 NULL
 #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: r304210 - stable/10/usr.bin/getconf

2016-08-16 Thread Garrett Cooper
Author: ngie
Date: Tue Aug 16 08:30:28 2016
New Revision: 304210
URL: https://svnweb.freebsd.org/changeset/base/304210

Log:
  MFstable/11 r304208:
  
  MFC r303830:
  
  Remove vestigal references to __alpha__
  
  Replace alpha reference in getconf(1) with amd64 [*]
  
  PR:   211300 [*]

Modified:
  stable/10/usr.bin/getconf/getconf.1
  stable/10/usr.bin/getconf/progenv.gperf
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/getconf/getconf.1
==
--- stable/10/usr.bin/getconf/getconf.1 Tue Aug 16 08:27:03 2016
(r304209)
+++ stable/10/usr.bin/getconf/getconf.1 Tue Aug 16 08:30:28 2016
(r304210)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 18, 2002
+.Dd August 8, 2016
 .Dt GETCONF 1
 .Os
 .Sh NAME
@@ -122,7 +122,7 @@ Exactly 32-bit integer, long, and pointe
 .It Li POSIX_V6_LP64_OFF64
 Exactly 32-bit integer; exactly 64-bit long, pointer, and file offset.
 .Sy Supported platforms :
-.Tn Alpha ,
+.Tn AMD64 ,
 .Tn SPARC64 .
 .It Li POSIX_V6_LPBIG_OFFBIG
 At least 32-bit integer; at least 64-bit long, pointer, and file offset.

Modified: stable/10/usr.bin/getconf/progenv.gperf
==
--- stable/10/usr.bin/getconf/progenv.gperf Tue Aug 16 08:27:03 2016
(r304209)
+++ stable/10/usr.bin/getconf/progenv.gperf Tue Aug 16 08:30:28 2016
(r304210)
@@ -30,7 +30,7 @@ static const struct map *in_word_set(con
  * be updated.  (We cheat here and define the supported environments
  * statically.)
  */
-#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
+#if defined(__sparc64__) || defined(__amd64__)
 #definehave_LP64_OFF64 NULL
 #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: r304209 - in head: lib/libc/include lib/libc/sys lib/libthr/thread share/man/man3

2016-08-16 Thread Konstantin Belousov
Author: kib
Date: Tue Aug 16 08:27:03 2016
New Revision: 304209
URL: https://svnweb.freebsd.org/changeset/base/304209

Log:
  The fdatasync(2) call must be cancellation point.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:13 days

Added:
  head/lib/libc/sys/fdatasync.c   (contents, props changed)
Modified:
  head/lib/libc/include/libc_private.h
  head/lib/libc/sys/Makefile.inc
  head/lib/libc/sys/interposing_table.c
  head/lib/libthr/thread/thr_syscalls.c
  head/share/man/man3/pthread_testcancel.3

Modified: head/lib/libc/include/libc_private.h
==
--- head/lib/libc/include/libc_private.hTue Aug 16 08:16:54 2016
(r304208)
+++ head/lib/libc/include/libc_private.hTue Aug 16 08:27:03 2016
(r304209)
@@ -228,6 +228,7 @@ enum {
INTERPOS_wait6,
INTERPOS_ppoll,
INTERPOS_map_stacks_exec,
+   INTERPOS_fdatasync,
INTERPOS_MAX
 };
 
@@ -318,6 +319,7 @@ int __sys_clock_gettime(__clockid_t, st
 int__sys_close(int);
 int__sys_connect(int, const struct sockaddr *, __socklen_t);
 int__sys_fcntl(int, int, ...);
+int__sys_fdatasync(int);
 int__sys_fsync(int);
 __pid_t__sys_fork(void);
 int__sys_ftruncate(int, __off_t);

Modified: head/lib/libc/sys/Makefile.inc
==
--- head/lib/libc/sys/Makefile.inc  Tue Aug 16 08:16:54 2016
(r304208)
+++ head/lib/libc/sys/Makefile.inc  Tue Aug 16 08:27:03 2016
(r304209)
@@ -37,6 +37,7 @@ INTERPOSED = \
close \
connect \
fcntl \
+   fdatasync \
fsync \
fork \
kevent \

Added: head/lib/libc/sys/fdatasync.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/sys/fdatasync.c   Tue Aug 16 08:27:03 2016
(r304209)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *the first lines of this file unmodified other than the possible
+ *addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice(s), this list of conditions and the following disclaimer in
+ *the documentation and/or other materials provided with the
+ *distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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(S) BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include "libc_private.h"
+
+int
+fdatasync(int fd)
+{
+
+   return (((int (*)(int))__libc_interposing[INTERPOS_fdatasync])(fd));
+}

Modified: head/lib/libc/sys/interposing_table.c
==
--- head/lib/libc/sys/interposing_table.c   Tue Aug 16 08:16:54 2016
(r304208)
+++ head/lib/libc/sys/interposing_table.c   Tue Aug 16 08:27:03 2016
(r304209)
@@ -79,6 +79,7 @@ interpos_func_t __libc_interposing[INTER
SLOT(wait6, __sys_wait6),
SLOT(ppoll, __sys_ppoll),
SLOT(map_stacks_exec, __libc_map_stacks_exec),
+   SLOT(fdatasync, __sys_fdatasync),
 };
 #undef SLOT
 

Modified: head/lib/libthr/thread/thr_syscalls.c
==
--- head/lib/libthr/thread/thr_syscalls.c   Tue Aug 16 08:16:54 2016
(r304208)
+++ head/lib/libthr/thread/thr_syscalls.c   Tue Aug 16 08:27:03 2016
(r304209)
@@ -227,6 +227,20 @@ __thr_fsync(int fd)
return (ret);
 }
 
+static int
+__thr_fdatasync(int fd)
+{
+   struct pthread *curthread;
+   int ret;
+
+   curthread = 

svn commit: r304208 - stable/11/usr.bin/getconf

2016-08-16 Thread Garrett Cooper
Author: ngie
Date: Tue Aug 16 08:16:54 2016
New Revision: 304208
URL: https://svnweb.freebsd.org/changeset/base/304208

Log:
  MFC r303830:
  
  Remove vestigal references to __alpha__
  
  Replace alpha reference in getconf(1) with amd64 [*]
  
  PR:   211300 [*]

Modified:
  stable/11/usr.bin/getconf/getconf.1
  stable/11/usr.bin/getconf/progenv.gperf
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/getconf/getconf.1
==
--- stable/11/usr.bin/getconf/getconf.1 Tue Aug 16 07:51:05 2016
(r304207)
+++ stable/11/usr.bin/getconf/getconf.1 Tue Aug 16 08:16:54 2016
(r304208)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 18, 2002
+.Dd August 8, 2016
 .Dt GETCONF 1
 .Os
 .Sh NAME
@@ -122,7 +122,7 @@ Exactly 32-bit integer, long, and pointe
 .It Li POSIX_V6_LP64_OFF64
 Exactly 32-bit integer; exactly 64-bit long, pointer, and file offset.
 .Sy Supported platforms :
-.Tn Alpha ,
+.Tn AMD64 ,
 .Tn SPARC64 .
 .It Li POSIX_V6_LPBIG_OFFBIG
 At least 32-bit integer; at least 64-bit long, pointer, and file offset.

Modified: stable/11/usr.bin/getconf/progenv.gperf
==
--- stable/11/usr.bin/getconf/progenv.gperf Tue Aug 16 07:51:05 2016
(r304207)
+++ stable/11/usr.bin/getconf/progenv.gperf Tue Aug 16 08:16:54 2016
(r304208)
@@ -30,7 +30,7 @@ static const struct map *in_word_set(con
  * be updated.  (We cheat here and define the supported environments
  * statically.)
  */
-#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
+#if defined(__sparc64__) || defined(__amd64__)
 #definehave_LP64_OFF64 NULL
 #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: r304070 - svnadmin/conf

2016-08-16 Thread Glen Barber
On Tue, Aug 16, 2016 at 09:00:34AM +0100, Bruce Simpson wrote:
> On 14/08/16 05:35, Glen Barber wrote:
> >Author: gjb
> >Date: Sun Aug 14 04:35:04 2016
> >New Revision: 304070
> >URL: https://svnweb.freebsd.org/changeset/base/304070
> >
> >Log:
> >  Do not include C function changes by default in svn commit
> >  email.
> 
> Please back out -- this makes the diff output much less useful.
> 

https://svnweb.freebsd.org/changeset/base/304073

Glen



signature.asc
Description: PGP signature


Re: svn commit: r304070 - svnadmin/conf

2016-08-16 Thread Bruce Simpson

On 14/08/16 05:35, Glen Barber wrote:

Author: gjb
Date: Sun Aug 14 04:35:04 2016
New Revision: 304070
URL: https://svnweb.freebsd.org/changeset/base/304070

Log:
  Do not include C function changes by default in svn commit
  email.


Please back out -- this makes the diff output much less useful.

___
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: r304207 - head/sys/mips/mips

2016-08-16 Thread Adrian Chadd
Author: adrian
Date: Tue Aug 16 07:51:05 2016
New Revision: 304207
URL: https://svnweb.freebsd.org/changeset/base/304207

Log:
  [mips] fix use-before-initialised.
  
  Found by: gcc-5.3

Modified:
  head/sys/mips/mips/cpu.c

Modified: head/sys/mips/mips/cpu.c
==
--- head/sys/mips/mips/cpu.cTue Aug 16 07:45:35 2016(r304206)
+++ head/sys/mips/mips/cpu.cTue Aug 16 07:51:05 2016(r304207)
@@ -164,6 +164,8 @@ mips_get_identity(struct mips_cpuinfo *c
cfg1 = mips_rd_config1();
 
/* Get the Config2 and Config3 registers as well. */
+   cfg2 = 0;
+   cfg3 = 0;
if (cfg1 & MIPS_CONFIG1_M) {
cfg2 = mips_rd_config2();
if (cfg2 & MIPS_CONFIG2_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: r304206 - head/sys/dev/hyperv/netvsc

2016-08-16 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Aug 16 07:45:35 2016
New Revision: 304206
URL: https://svnweb.freebsd.org/changeset/base/304206

Log:
  hyperv/hn: Simplify RNDIS message checks on RX path.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7502

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Aug 16 07:37:02 2016
(r304205)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Aug 16 07:45:35 2016
(r304206)
@@ -847,19 +847,18 @@ hv_nv_on_receive(netvsc_dev *net_dev, st
 struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr)
 {
const struct vmbus_chanpkt_rxbuf *pkt;
-   const nvsp_msg *nvsp_msg_pkt;
+   const struct hn_nvs_hdr *nvs_hdr;
netvsc_packet vsc_pkt;
netvsc_packet *net_vsc_pkt = _pkt;
int count = 0;
int i = 0;
int status = nvsp_status_success;
 
-   nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkthdr);
-
-   /* Make sure this is a valid nvsp packet */
-   if (nvsp_msg_pkt->hdr.msg_type != nvsp_msg_1_type_send_rndis_pkt) {
-   if_printf(rxr->hn_ifp, "packet hdr type %u is invalid!\n",
-   nvsp_msg_pkt->hdr.msg_type);
+   /* Make sure that this is a RNDIS message. */
+   nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr);
+   if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) {
+   if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n",
+   nvs_hdr->nvs_type);
return;
}


Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h
==
--- head/sys/dev/hyperv/netvsc/if_hnreg.h   Tue Aug 16 07:37:02 2016
(r304205)
+++ head/sys/dev/hyperv/netvsc/if_hnreg.h   Tue Aug 16 07:45:35 2016
(r304206)
@@ -69,6 +69,11 @@
  */
 #define HN_NVS_REQSIZE_MIN 32
 
+/* NVS message common header */
+struct hn_nvs_hdr {
+   uint32_tnvs_type;
+} __packed;
+
 struct hn_nvs_init {
uint32_tnvs_type;   /* HN_NVS_TYPE_INIT */
uint32_tnvs_ver_min;
___
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: r304205 - head/sys/dev/hyperv/netvsc

2016-08-16 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Aug 16 07:37:02 2016
New Revision: 304205
URL: https://svnweb.freebsd.org/changeset/base/304205

Log:
  hyperv/hn: Simplify RNDIS NVS message sending.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7501

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Aug 16 07:26:53 2016
(r304204)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Aug 16 07:37:02 2016
(r304205)
@@ -118,7 +118,7 @@ hv_nv_get_next_send_section(netvsc_dev *
unsigned long bitsmap_words = net_dev->bitsmap_words;
unsigned long *bitsmap = net_dev->send_section_bitsmap;
unsigned long idx;
-   int ret = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX;
+   int ret = HN_NVS_CHIM_IDX_INVALID;
int i;
 
for (i = 0; i < bitsmap_words; i++) {
@@ -814,32 +814,23 @@ hv_nv_on_send_completion(netvsc_dev *net
  * Returns 0 on success, non-zero on failure.
  */
 int
-hv_nv_on_send(struct vmbus_channel *chan, bool is_data_pkt,
+hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype,
 struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt)
 {
-   nvsp_msg send_msg;
+   struct hn_nvs_rndis rndis;
int ret;
 
-   send_msg.hdr.msg_type = nvsp_msg_1_type_send_rndis_pkt;
-   if (is_data_pkt) {
-   /* 0 is RMC_DATA */
-   send_msg.msgs.vers_1_msgs.send_rndis_pkt.chan_type = 0;
-   } else {
-   /* 1 is RMC_CONTROL */
-   send_msg.msgs.vers_1_msgs.send_rndis_pkt.chan_type = 1;
-   }
-
-   send_msg.msgs.vers_1_msgs.send_rndis_pkt.send_buf_section_idx =
-   sndc->hn_chim_idx;
-   send_msg.msgs.vers_1_msgs.send_rndis_pkt.send_buf_section_size =
-   sndc->hn_chim_sz;
+   rndis.nvs_type = HN_NVS_TYPE_RNDIS;
+   rndis.nvs_rndis_mtype = rndis_mtype;
+   rndis.nvs_chim_idx = sndc->hn_chim_idx;
+   rndis.nvs_chim_sz = sndc->hn_chim_sz;
 
if (gpa_cnt) {
ret = hn_nvs_send_sglist(chan, gpa, gpa_cnt,
-   _msg, sizeof(nvsp_msg), sndc);
+   , sizeof(rndis), sndc);
} else {
ret = hn_nvs_send(chan, VMBUS_CHANPKT_FLAG_RC,
-   _msg, sizeof(nvsp_msg), sndc);
+   , sizeof(rndis), sndc);
}
 
return (ret);

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Aug 16 07:26:53 2016
(r304204)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Aug 16 07:37:02 2016
(r304205)
@@ -1256,7 +1256,7 @@ netvsc_dev *hv_nv_on_device_add(struct h
 void *additional_info, struct hn_rx_ring *rxr);
 int hv_nv_on_device_remove(struct hn_softc *sc,
 boolean_t destroy_channel);
-int hv_nv_on_send(struct vmbus_channel *chan, bool is_data_pkt,
+int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype,
struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt);
 int hv_nv_get_next_send_section(netvsc_dev *net_dev);
 void hv_nv_subchan_attach(struct vmbus_channel *chan,

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Aug 16 07:26:53 
2016(r304204)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Aug 16 07:37:02 
2016(r304205)
@@ -798,7 +798,7 @@ hn_tx_done(struct hn_send_ctx *sndc, str
struct hn_txdesc *txd = sndc->hn_cbarg;
struct hn_tx_ring *txr;
 
-   if (sndc->hn_chim_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX)
+   if (sndc->hn_chim_idx != HN_NVS_CHIM_IDX_INVALID)
hn_chim_free(net_dev, sndc->hn_chim_idx);
 
txr = txd->txr;
@@ -988,8 +988,7 @@ hn_encap(struct hn_tx_ring *txr, struct 
txr->hn_tx_chimney_tried++;
send_buf_section_idx =
hv_nv_get_next_send_section(net_dev);
-   if (send_buf_section_idx !=
-   NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) {
+   if (send_buf_section_idx != HN_NVS_CHIM_IDX_INVALID) {
uint8_t *dest = ((uint8_t *)net_dev->send_buf +
(send_buf_section_idx *
 net_dev->send_section_size));
@@ -1045,7 +1044,7 @@ hn_encap(struct hn_tx_ring *txr, struct 
gpa->gpa_len = segs[i].ds_len;
}
 
-   

svn commit: r304204 - in head/sys/dev/hyperv: include netvsc

2016-08-16 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Aug 16 07:26:53 2016
New Revision: 304204
URL: https://svnweb.freebsd.org/changeset/base/304204

Log:
  hyperv/hn: Factor out hn_nvs_send/hn_nvs_send_sglist
  
  Avoid unnecessary message type setting and centralize the send context
  to transaction id cast.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7500

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

Modified: head/sys/dev/hyperv/include/vmbus.h
==
--- head/sys/dev/hyperv/include/vmbus.h Tue Aug 16 07:14:09 2016
(r304203)
+++ head/sys/dev/hyperv/include/vmbus.h Tue Aug 16 07:26:53 2016
(r304204)
@@ -83,6 +83,7 @@ struct vmbus_chanpkt_hdr {
 #define VMBUS_CHANPKT_TYPE_GPA 0x0009
 #define VMBUS_CHANPKT_TYPE_COMP0x000b
 
+#define VMBUS_CHANPKT_FLAG_NONE0
 #define VMBUS_CHANPKT_FLAG_RC  0x0001  /* report completion */
 
 #define VMBUS_CHANPKT_CONST_DATA(pkt)  \

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Aug 16 07:14:09 2016
(r304203)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Aug 16 07:26:53 2016
(r304204)
@@ -206,9 +206,8 @@ hv_nv_init_rx_buffer_with_net_vsp(struct
hn_send_ctx_init_simple(, hn_nvs_sent_xact, xact);
vmbus_xact_activate(xact);
 
-   error = vmbus_chan_send(sc->hn_prichan,
-   VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
-   conn, sizeof(*conn), (uint64_t)(uintptr_t));
+   error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC,
+   conn, sizeof(*conn), );
if (error != 0) {
if_printf(sc->hn_ifp, "send nvs rxbuf conn failed: %d\n",
error);
@@ -313,9 +312,8 @@ hv_nv_init_send_buffer_with_net_vsp(stru
hn_send_ctx_init_simple(, hn_nvs_sent_xact, xact);
vmbus_xact_activate(xact);
 
-   error = vmbus_chan_send(sc->hn_prichan,
-   VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
-   chim, sizeof(*chim), (uint64_t)(uintptr_t));
+   error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC,
+   chim, sizeof(*chim), );
if (error) {
if_printf(sc->hn_ifp, "send nvs chim conn failed: %d\n",
error);
@@ -393,9 +391,10 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_
disconn.nvs_type = HN_NVS_TYPE_RXBUF_DISCONN;
disconn.nvs_sig = HN_NVS_RXBUF_SIG;
 
-   ret = vmbus_chan_send(net_dev->sc->hn_prichan,
-   VMBUS_CHANPKT_TYPE_INBAND, 0, , sizeof(disconn),
-   (uint64_t)(uintptr_t)_send_ctx_none);
+   /* NOTE: No response. */
+   ret = hn_nvs_send(net_dev->sc->hn_prichan,
+   VMBUS_CHANPKT_FLAG_NONE, , sizeof(disconn),
+   _send_ctx_none);
if (ret != 0) {
if_printf(net_dev->sc->hn_ifp,
"send rxbuf disconn failed: %d\n", ret);
@@ -445,9 +444,10 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne
disconn.nvs_type = HN_NVS_TYPE_CHIM_DISCONN;
disconn.nvs_sig = HN_NVS_CHIM_SIG;
 
-   ret = vmbus_chan_send(net_dev->sc->hn_prichan,
-   VMBUS_CHANPKT_TYPE_INBAND, 0, , sizeof(disconn),
-   (uint64_t)(uintptr_t)_send_ctx_none);
+   /* NOTE: No response. */
+   ret = hn_nvs_send(net_dev->sc->hn_prichan,
+   VMBUS_CHANPKT_FLAG_NONE, , sizeof(disconn),
+   _send_ctx_none);
if (ret != 0) {
if_printf(net_dev->sc->hn_ifp,
"send chim disconn failed: %d\n", ret);
@@ -509,9 +509,8 @@ hv_nv_negotiate_nvsp_protocol(struct hn_
vmbus_xact_activate(xact);
hn_send_ctx_init_simple(, hn_nvs_sent_xact, xact);
 
-   error = vmbus_chan_send(sc->hn_prichan,
-   VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
-   init, sizeof(*init), (uint64_t)(uintptr_t));
+   error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC,
+   init, sizeof(*init), );
if (error) {
if_printf(sc->hn_ifp, "send nvs init failed: %d\n", error);
vmbus_xact_deactivate(xact);
@@ -560,8 +559,9 @@ hv_nv_send_ndis_config(struct hn_softc *
conf.nvs_mtu = mtu;
conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN;
 
-   error = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0,
-   , sizeof(conf), (uint64_t)(uintptr_t)_send_ctx_none);
+   /* NOTE: No response. */
+   error = hn_nvs_send(sc->hn_prichan, 

svn commit: r304203 - stable/10/lib/libc/gen

2016-08-16 Thread Andrey A. Chernov
Author: ache
Date: Tue Aug 16 07:14:09 2016
New Revision: 304203
URL: https://svnweb.freebsd.org/changeset/base/304203

Log:
  MFC r302943,r302944,r303004,r303010,r303011,r303013,r303014,r303074,
  r303088,r303142,r303208,r303210,r303530,r303536,r303564,r303565,
  r303706
  
  In short:
  
  1) All situations with glob(3) error return codes are well defined by
  POSIX, so rewrite old sporadic errors processing to match those
  definitions.
  
  Including subcases:
  
  Both C99 and POSIX directly prohibits any standard function to set errno
  to 0. Breaking this rule in 2001 NetBSD hack was imported which attempts
  to workaround very limited glob(3) return codes amount.
  Use POSIX-compatible workaround now with E2BIG which can't comes from
  other functions used instead of prohibited 0.
  
  Process errors happpens in (*readdirfunc)() too, as POSIX requires.
  
  Per POSIX GLOB_NOCHECK should return original pattern,
  unmodified, if no matches found. But our code strips all '\'
  returning it. Rewrite the code to allow to return original pattern.
  
  GLOB_ERR and gl_errfunc are supposed to work only for real directories
  per POSIX, so don't act on missing or plain files for ENOENT or ENOTDIR
  (as TODO in the code suggested).
  Remove the hack in the manpage describing how to skip ENOENT and ENOTDIR
  in gl_errfunc, it is unneeded now.
  
  Per POSIX GLOB_ERR must be considered even if gl_errfunc is not set,
  old code skips it in that case.
  
  2) For near MAXPATHLEN long pathes old glob(3) code can operate on
  truncated results, prevent it in several places.
  
  3) Results was not sorted according to collate as POSIX requires.
  
  4) globtilde() forget to convert expanded user home dir from multibyte to
  wide chars. Moreover, those chars are addded as not protected, so
  can be treated as special chars.
  
  5) Backward hack for EILSEQ in g_Ctoc() was not implemented, so all
  pathes with illegal byte sequences are skipped as result, implement it now.
  
  6) GLOB_BRACE was somehow broken. First it repeatedly calls glob0() in
  globexp1() recursive calls, but glob0() was not supposed to be called
  repeatedly in the original code. It finalize results by possible adding
  original pattern for no match case, may return GLOB_NOMATCH error and
  by sorting all things. Original pattern adding or GLOB_NOMATCH error
  can happens each time glob0() called repeatedly, and sorting happens
  for one item only, all things are never sorted. Second, f.e. "a{a"
  pattern does not match "a{a" file but match "a" file instead.
  Third, some errors (f.e. for limits or overflow) can be ignored
  by GLOB_BRACE code because it forces return (0).
  
  Add non-finalizing flag to glob0() and make globexp0() wrapper around
  recursively called globexp1() to finalize things like glob0() does.
  Reorganize braces code to work correctly.
  
  7) Don't allow MB_CUR_MAX * strlen overallocation hits GLOB_LIMIT_STRING
  (ARG_MAX) limit, use final string length, not malloced space for it.

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

Modified: stable/10/lib/libc/gen/glob.3
==
--- stable/10/lib/libc/gen/glob.3   Tue Aug 16 06:40:27 2016
(r304202)
+++ stable/10/lib/libc/gen/glob.3   Tue Aug 16 07:14:09 2016
(r304203)
@@ -275,24 +275,10 @@ is
 .Pf non- Dv NULL ,
 .Fn glob
 calls
-.Fa \*(lp*errfunc\*(rp Ns ( Fa path , errno ) .
-This may be unintuitive: a pattern like
-.Ql */Makefile
-will try to
-.Xr stat 2
-.Ql foo/Makefile
-even if
-.Ql foo
-is not a directory, resulting in a
-call to
-.Fa errfunc .
-The error routine can suppress this action by testing for
-.Er ENOENT
-and
-.Er ENOTDIR ;
+.Fa \*(lp*errfunc\*(rp Ns ( Fa path , errno ) ,
 however, the
 .Dv GLOB_ERR
-flag will still cause an immediate
+flag will cause an immediate
 return when this happens.
 .Pp
 If
@@ -377,7 +363,7 @@ file
 .It Dv GLOB_NOSPACE
 An attempt to allocate memory failed, or if
 .Fa errno
-was 0
+was E2BIG,
 .Dv GLOB_LIMIT
 was specified in the flags and
 .Fa pglob\->gl_matchc

Modified: stable/10/lib/libc/gen/glob.c
==
--- stable/10/lib/libc/gen/glob.c   Tue Aug 16 06:40:27 2016
(r304202)
+++ stable/10/lib/libc/gen/glob.c   Tue Aug 16 07:14:09 2016
(r304203)
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
  * 1. Patterns with illegal byte sequences match nothing - even if
  *GLOB_NOCHECK is specified.
  * 2. Illegal byte sequences in filenames are handled by treating them as
- *single-byte characters with a value of the first byte of the sequence
+ *single-byte characters with a values of such bytes of the sequence
  *cast to wchar_t.
  * 3. State-dependent encodings are not currently supported.
  */
@@ -113,25 +113,20 @@ struct glob_limit {
size_t  

svn commit: r304202 - head/sys/netinet

2016-08-16 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Aug 16 06:40:27 2016
New Revision: 304202
URL: https://svnweb.freebsd.org/changeset/base/304202

Log:
  tcp/lro: Make # of LRO entries tunable
  
  Reviewed by:  hps, gallatin
  Obtained from:rrs, gallatin
  MFC after:2 weeks
  Sponsored by: Netflix (rrs, gallatin), Microsoft (sephe)
  Differential Revision:https://reviews.freebsd.org/D7499

Modified:
  head/sys/netinet/tcp_lro.c

Modified: head/sys/netinet/tcp_lro.c
==
--- head/sys/netinet/tcp_lro.c  Tue Aug 16 02:34:25 2016(r304201)
+++ head/sys/netinet/tcp_lro.c  Tue Aug 16 06:40:27 2016(r304202)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -55,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -71,6 +73,14 @@ static void  tcp_lro_rx_done(struct lro_c
 static int tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m,
uint32_t csum, int use_hash);
 
+SYSCTL_NODE(_net_inet_tcp, OID_AUTO, lro,  CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
+"TCP LRO");
+
+static unsignedtcp_lro_entries = TCP_LRO_ENTRIES;
+SYSCTL_UINT(_net_inet_tcp_lro, OID_AUTO, entries,
+CTLFLAG_RDTUN | CTLFLAG_MPSAFE, _lro_entries, 0,
+"default number of LRO entries");
+
 static __inline void
 tcp_lro_active_insert(struct lro_ctrl *lc, struct lro_head *bucket,
 struct lro_entry *le)
@@ -91,7 +101,7 @@ tcp_lro_active_remove(struct lro_entry *
 int
 tcp_lro_init(struct lro_ctrl *lc)
 {
-   return (tcp_lro_init_args(lc, NULL, TCP_LRO_ENTRIES, 0));
+   return (tcp_lro_init_args(lc, NULL, tcp_lro_entries, 0));
 }
 
 int
___
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"