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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:47:30 2018
New Revision: 341215
URL: https://svnweb.freebsd.org/changeset/base/341215

Log:
  sfxge(4): fix build because of no declaration
  
  Functions declared in mcdi_mon.h are implemented in mcdi_mon.c.
  The build fails if compiler options require declaration before definition.
  
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D18246

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

Modified: head/sys/dev/sfxge/common/mcdi_mon.c
==
--- head/sys/dev/sfxge/common/mcdi_mon.cThu Nov 29 06:47:19 2018
(r341214)
+++ head/sys/dev/sfxge/common/mcdi_mon.cThu Nov 29 06:47:30 2018
(r341215)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 
 #include "efx.h"
 #include "efx_impl.h"
+#include "mcdi_mon.h"
 
 #if EFSYS_OPT_MON_MCDI
 
___
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: r341213 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:47:06 2018
New Revision: 341213
URL: https://svnweb.freebsd.org/changeset/base/341213

Log:
  sfxge(4): fix PreFAST warnings because of unused return
  
  Submitted by:   Martin Harvey 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D18244

Modified:
  head/sys/dev/sfxge/common/ef10_filter.c
  head/sys/dev/sfxge/common/ef10_mac.c
  head/sys/dev/sfxge/common/ef10_nic.c
  head/sys/dev/sfxge/common/ef10_nvram.c
  head/sys/dev/sfxge/common/ef10_tx.c
  head/sys/dev/sfxge/common/efx_port.c

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:46:55 2018
(r341212)
+++ head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:47:06 2018
(r341213)
@@ -1171,12 +1171,15 @@ ef10_filter_insert_unicast(
efx_filter_spec_init_rx(, EFX_FILTER_PRI_AUTO,
filter_flags,
eftp->eft_default_rxq);
-   efx_filter_spec_set_eth_local(, EFX_FILTER_SPEC_VID_UNSPEC, addr);
+   rc = efx_filter_spec_set_eth_local(, EFX_FILTER_SPEC_VID_UNSPEC,
+   addr);
+   if (rc != 0)
+   goto fail1;
 
rc = ef10_filter_add_internal(enp, , B_TRUE,
>eft_unicst_filter_indexes[eftp->eft_unicst_filter_count]);
if (rc != 0)
-   goto fail1;
+   goto fail2;
 
eftp->eft_unicst_filter_count++;
EFSYS_ASSERT(eftp->eft_unicst_filter_count <=
@@ -1184,6 +1187,8 @@ ef10_filter_insert_unicast(
 
return (0);
 
+fail2:
+   EFSYS_PROBE(fail2);
 fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
@@ -1202,11 +1207,13 @@ ef10_filter_insert_all_unicast(
efx_filter_spec_init_rx(, EFX_FILTER_PRI_AUTO,
filter_flags,
eftp->eft_default_rxq);
-   efx_filter_spec_set_uc_def();
+   rc = efx_filter_spec_set_uc_def();
+   if (rc != 0)
+   goto fail1;
rc = ef10_filter_add_internal(enp, , B_TRUE,
>eft_unicst_filter_indexes[eftp->eft_unicst_filter_count]);
if (rc != 0)
-   goto fail1;
+   goto fail2;
 
eftp->eft_unicst_filter_count++;
EFSYS_ASSERT(eftp->eft_unicst_filter_count <=
@@ -1214,6 +1221,8 @@ ef10_filter_insert_all_unicast(
 
return (0);
 
+fail2:
+   EFSYS_PROBE(fail2);
 fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
@@ -1255,9 +1264,21 @@ ef10_filter_insert_multicast_list(
filter_flags,
eftp->eft_default_rxq);
 
-   efx_filter_spec_set_eth_local(,
+   rc = efx_filter_spec_set_eth_local(,
EFX_FILTER_SPEC_VID_UNSPEC,
[i * EFX_MAC_ADDR_LEN]);
+   if (rc != 0) {
+   if (rollback == B_TRUE) {
+   /* Only stop upon failure if told to rollback */
+   goto rollback;
+   } else {
+   /*
+* Don't try to add a filter with a corrupt
+* specification.
+*/
+   continue;
+   }
+   }
 
rc = ef10_filter_add_internal(enp, , B_TRUE,
_index);
@@ -1280,8 +1301,12 @@ ef10_filter_insert_multicast_list(
eftp->eft_default_rxq);
 
EFX_MAC_BROADCAST_ADDR_SET(addr);
-   efx_filter_spec_set_eth_local(, EFX_FILTER_SPEC_VID_UNSPEC,
-   addr);
+   rc = efx_filter_spec_set_eth_local(,
+   EFX_FILTER_SPEC_VID_UNSPEC, addr);
+   if ((rc != 0) && (rollback == B_TRUE)) {
+   /* Only stop upon failure if told to rollback */
+   goto rollback;
+   }
 
rc = ef10_filter_add_internal(enp, , B_TRUE,
_index);
@@ -1329,12 +1354,14 @@ ef10_filter_insert_all_multicast(
efx_filter_spec_init_rx(, EFX_FILTER_PRI_AUTO,
filter_flags,
eftp->eft_default_rxq);
-   efx_filter_spec_set_mc_def();
+   rc = efx_filter_spec_set_mc_def();
+   if (rc != 0)
+   goto fail1;
 
rc = ef10_filter_add_internal(enp, , B_TRUE,
>eft_mulcst_filter_indexes[0]);
if (rc != 0)
-   goto fail1;
+   goto fail2;
 
eftp->eft_mulcst_filter_count = 1;
eftp->eft_using_all_mulcst = B_TRUE;
@@ -1345,6 +1372,8 @@ ef10_filter_insert_all_multicast(
 
return (0);
 
+fail2:
+   EFSYS_PROBE(fail2);
 fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
 

Modified: 

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:46:10 2018
New Revision: 341208
URL: https://svnweb.freebsd.org/changeset/base/341208

Log:
  sfxge(4): support MARK and FLAG actions in filters
  
  This patch adds support for DPDK rte_flow "MARK" and "FLAG" filter
  actions to filters on EF10 family NICs.
  
  Submitted by:   Roman Zhukov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18239

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

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:46:01 2018
(r341207)
+++ head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:46:10 2018
(r341208)
@@ -199,7 +199,7 @@ efx_mcdi_filter_op_add(
__inout ef10_filter_handle_t *handle)
 {
efx_mcdi_req_t req;
-   uint8_t payload[MAX(MC_CMD_FILTER_OP_EXT_IN_LEN,
+   uint8_t payload[MAX(MC_CMD_FILTER_OP_V3_IN_LEN,
MC_CMD_FILTER_OP_EXT_OUT_LEN)];
efx_filter_match_flags_t match_flags;
efx_rc_t rc;
@@ -207,7 +207,7 @@ efx_mcdi_filter_op_add(
memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_FILTER_OP;
req.emr_in_buf = payload;
-   req.emr_in_length = MC_CMD_FILTER_OP_EXT_IN_LEN;
+   req.emr_in_length = MC_CMD_FILTER_OP_V3_IN_LEN;
req.emr_out_buf = payload;
req.emr_out_length = MC_CMD_FILTER_OP_EXT_OUT_LEN;
 
@@ -343,16 +343,37 @@ efx_mcdi_filter_op_add(
spec->efs_ifrm_loc_mac, EFX_MAC_ADDR_LEN);
}
 
+   /*
+* Set the "MARK" or "FLAG" action for all packets matching this filter
+* if necessary (only useful with equal stride packed stream Rx mode
+* which provide the information in pseudo-header).
+* These actions require MC_CMD_FILTER_OP_V3_IN msgrequest.
+*/
+   if ((spec->efs_flags & EFX_FILTER_FLAG_ACTION_MARK) &&
+   (spec->efs_flags & EFX_FILTER_FLAG_ACTION_FLAG)) {
+   rc = EINVAL;
+   goto fail3;
+   }
+   if (spec->efs_flags & EFX_FILTER_FLAG_ACTION_MARK) {
+   MCDI_IN_SET_DWORD(req, FILTER_OP_V3_IN_MATCH_ACTION,
+   MC_CMD_FILTER_OP_V3_IN_MATCH_ACTION_MARK);
+   MCDI_IN_SET_DWORD(req, FILTER_OP_V3_IN_MATCH_MARK_VALUE,
+   spec->efs_mark);
+   } else if (spec->efs_flags & EFX_FILTER_FLAG_ACTION_FLAG) {
+   MCDI_IN_SET_DWORD(req, FILTER_OP_V3_IN_MATCH_ACTION,
+   MC_CMD_FILTER_OP_V3_IN_MATCH_ACTION_FLAG);
+   }
+
efx_mcdi_execute(enp, );
 
if (req.emr_rc != 0) {
rc = req.emr_rc;
-   goto fail3;
+   goto fail4;
}
 
if (req.emr_out_length_used < MC_CMD_FILTER_OP_EXT_OUT_LEN) {
rc = EMSGSIZE;
-   goto fail4;
+   goto fail5;
}
 
handle->efh_lo = MCDI_OUT_DWORD(req, FILTER_OP_EXT_OUT_HANDLE_LO);
@@ -360,6 +381,8 @@ efx_mcdi_filter_op_add(
 
return (0);
 
+fail5:
+   EFSYS_PROBE(fail5);
 fail4:
EFSYS_PROBE(fail4);
 fail3:

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:46:01 2018
(r341207)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:46:10 2018
(r341208)
@@ -2651,6 +2651,10 @@ efx_tx_qdestroy(
 #defineEFX_FILTER_FLAG_RX  0x08
 /* Filter is for TX */
 #defineEFX_FILTER_FLAG_TX  0x10
+/* Set match flag on the received packet */
+#defineEFX_FILTER_FLAG_ACTION_FLAG 0x20
+/* Set match mark on the received packet */
+#defineEFX_FILTER_FLAG_ACTION_MARK 0x40
 
 typedef uint8_t efx_filter_flags_t;
 
@@ -2723,6 +2727,8 @@ typedef struct efx_filter_spec_s {
efx_filter_flags_t  efs_flags;
uint16_tefs_dmaq_id;
uint32_tefs_rss_context;
+   uint32_tefs_mark;
+   /* Fields below here are hashed for software filter lookup */
uint16_tefs_outer_vid;
uint16_tefs_inner_vid;
uint8_t efs_loc_mac[EFX_MAC_ADDR_LEN];

Modified: head/sys/dev/sfxge/common/efx_filter.c
==
--- head/sys/dev/sfxge/common/efx_filter.c  Thu Nov 29 06:46:01 2018
(r341207)
+++ head/sys/dev/sfxge/common/efx_filter.c  Thu Nov 29 06:46:10 2018
(r341208)
@@ -103,12 +103,33 @@ efx_filter_insert(
__inout efx_filter_spec_t *spec)
 {
const efx_filter_ops_t *efop = enp->en_efop;
+   

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:45:26 2018
New Revision: 341204
URL: https://svnweb.freebsd.org/changeset/base/341204

Log:
  sfxge(4): detect equal stride super-buffer support
  
  Equal stride super-buffer Rx mode is supported on Medford2 by
  DPDK firmware variant.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18235

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

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:45:15 2018
(r341203)
+++ head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:45:26 2018
(r341204)
@@ -1141,6 +1141,12 @@ ef10_get_datapath_caps(
else
encp->enc_rx_var_packed_stream_supported = B_FALSE;
 
+   /* Check if the firmware supports equal stride super-buffer mode */
+   if (CAP_FLAGS2(req, EQUAL_STRIDE_SUPER_BUFFER))
+   encp->enc_rx_es_super_buffer_supported = B_TRUE;
+   else
+   encp->enc_rx_es_super_buffer_supported = B_FALSE;
+
/* Check if the firmware supports FW subvariant w/o Tx checksumming */
if (CAP_FLAGS2(req, FW_SUBVARIANT_NO_TX_CSUM))
encp->enc_fw_subvariant_no_tx_csum_supported = B_TRUE;

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:45:15 2018
(r341203)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:45:26 2018
(r341204)
@@ -1298,6 +1298,7 @@ typedef struct efx_nic_cfg_s {
boolean_t   enc_init_evq_v2_supported;
boolean_t   enc_rx_packed_stream_supported;
boolean_t   enc_rx_var_packed_stream_supported;
+   boolean_t   enc_rx_es_super_buffer_supported;
boolean_t   enc_fw_subvariant_no_tx_csum_supported;
boolean_t   enc_pm_and_rxdp_counters;
boolean_t   enc_mac_stats_40g_tx_size_bins;

Modified: head/sys/dev/sfxge/common/siena_nic.c
==
--- head/sys/dev/sfxge/common/siena_nic.c   Thu Nov 29 06:45:15 2018
(r341203)
+++ head/sys/dev/sfxge/common/siena_nic.c   Thu Nov 29 06:45:26 2018
(r341204)
@@ -190,6 +190,7 @@ siena_board_cfg(
encp->enc_allow_set_mac_with_installed_filters = B_TRUE;
encp->enc_rx_packed_stream_supported = B_FALSE;
encp->enc_rx_var_packed_stream_supported = B_FALSE;
+   encp->enc_rx_es_super_buffer_supported = B_FALSE;
encp->enc_fw_subvariant_no_tx_csum_supported = B_FALSE;
 
/* Siena supports two 10G ports, and 8 lanes of PCIe Gen2 */
___
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: r341202 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:45:04 2018
New Revision: 341202
URL: https://svnweb.freebsd.org/changeset/base/341202

Log:
  sfxge(4): update autogenerated MCDI and TLV headers
  
  Equal stride super-buffer is a new name instead of deprecated equal
  stride packed stream to avoid confusion with previous packed stream.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18233

Modified:
  head/sys/dev/sfxge/common/ef10_tlv_layout.h
  head/sys/dev/sfxge/common/efx_regs_mcdi.h

Modified: head/sys/dev/sfxge/common/ef10_tlv_layout.h
==
--- head/sys/dev/sfxge/common/ef10_tlv_layout.h Thu Nov 29 06:44:51 2018
(r341201)
+++ head/sys/dev/sfxge/common/ef10_tlv_layout.h Thu Nov 29 06:45:04 2018
(r341202)
@@ -30,6 +30,14 @@
  * $FreeBSD$
  */
 
+/*
+ * This is NOT the original source file. Do NOT edit it.
+ * To update the tlv layout, please edit the copy in
+ * the sfregistry repo and then, in that repo,
+ * "make tlv_headers" or "make export" to
+ * regenerate and export all types of headers.
+ */
+
 /* These structures define the layouts for the TLV items stored in static and
  * dynamic configuration partitions in NVRAM for EF10 (Huntington etc.).
  *
@@ -435,6 +443,7 @@ struct tlv_firmware_options {
  
MC_CMD_FW_PACKED_STREAM_HASH_MODE_1
 #define TLV_FIRMWARE_VARIANT_RULES_ENGINEMC_CMD_FW_RULES_ENGINE
 #define TLV_FIRMWARE_VARIANT_DPDKMC_CMD_FW_DPDK
+#define TLV_FIRMWARE_VARIANT_L3XUDP  MC_CMD_FW_L3XUDP
 };
 
 /* Voltage settings
@@ -518,6 +527,17 @@ struct tlv_0v9_atb_target {
   uint16_t reserved;
 };
 
+/* Factory settings for amplitude calibration of the PCIE TX serdes */
+#define TLV_TAG_TX_PCIE_AMP_CONFIG  (0x0022)
+struct tlv_pcie_tx_amp_config {
+  uint32_t tag;
+  uint32_t length;
+  uint8_t quad_tx_imp2k[4];
+  uint8_t quad_tx_imp50[4];
+  uint8_t lane_amp[16];
+};
+
+
 /* Global PCIe configuration, second revision. This represents the visible PFs
  * by a bitmap rather than having the number of the highest visible one. As 
such
  * it can (for a 16-PF chip) represent a superset of what 
TLV_TAG_GLOBAL_PCIE_CONFIG
@@ -851,20 +871,6 @@ struct tlv_tx_event_merging_config {
 #define TLV_TX_EVENT_MERGING_TIMEOUT_NS_DEFAULT (0x)
 #define TLV_TX_EVENT_MERGING_QEMPTY_TIMEOUT_NS_DEFAULT (0x)
 
-/* BIU mode
- *
- * Medford2 tag for selecting VI window decode (see values below)
- */
-#define TLV_TAG_BIU_VI_WINDOW_MODE   (0x1028)
-struct tlv_biu_vi_window_mode {
-  uint32_t tag;
-  uint32_t length;
-  uint8_t  mode;
-#define TLV_BIU_VI_WINDOW_MODE_8K0  /*  8k per VI, CTPIO not mapped, 
medford/hunt compatible */
-#define TLV_BIU_VI_WINDOW_MODE_16K   1  /* 16k per VI, CTPIO mapped */
-#define TLV_BIU_VI_WINDOW_MODE_64K   2  /* 64k per VI, CTPIO mapped, 
POWER-friendly */
-};
-
 #define TLV_TAG_LICENSE (0x3080)
 
 typedef struct tlv_license {
@@ -985,6 +991,47 @@ struct tlv_tx_vfifo_ull_mode {
   uint32_t length;
   uint8_t  mode;
 #define TLV_TX_VFIFO_ULL_MODE_DEFAULT0
+};
+
+/* BIU mode
+ *
+ * Medford2 tag for selecting VI window decode (see values below)
+ */
+#define TLV_TAG_BIU_VI_WINDOW_MODE   (0x1028)
+struct tlv_biu_vi_window_mode {
+  uint32_t tag;
+  uint32_t length;
+  uint8_t  mode;
+#define TLV_BIU_VI_WINDOW_MODE_8K0  /*  8k per VI, CTPIO not mapped, 
medford/hunt compatible */
+#define TLV_BIU_VI_WINDOW_MODE_16K   1  /* 16k per VI, CTPIO mapped */
+#define TLV_BIU_VI_WINDOW_MODE_64K   2  /* 64k per VI, CTPIO mapped, 
POWER-friendly */
+};
+
+/* FastPD mode
+ *
+ * Medford2 tag for configuring the FastPD mode (see values below)
+ */
+#define TLV_TAG_FASTPD_MODE(port)   (0x1029 + (port))
+struct tlv_fastpd_mode {
+  uint32_t tag;
+  uint32_t length;
+  uint8_t  mode;
+#define TLV_FASTPD_MODE_SOFT_ALL   0  /* All packets to the SoftPD */
+#define TLV_FASTPD_MODE_FAST_ALL   1  /* All packets to the FastPD */
+#define TLV_FASTPD_MODE_FAST_SUPPORTED 2  /* Supported packet types to the 
FastPD; everything else to the SoftPD  */
+};
+
+/* L3xUDP datapath firmware UDP port configuration
+ *
+ * Sets the list of UDP ports on which the encapsulation will be handled.
+ * The number of ports in the list is implied by the length of the TLV item.
+ */
+#define TLV_TAG_L3XUDP_PORTS(0x102a)
+struct tlv_l3xudp_ports {
+  uint32_t tag;
+  uint32_t length;
+  uint16_t ports[];
+#define TLV_TAG_L3XUDP_PORTS_MAX_NUM_PORTS 16
 };
 
 #endif /* CI_MGMT_TLV_LAYOUT_H */

Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_regs_mcdi.h   Thu Nov 29 06:44:51 2018
(r341201)
+++ head/sys/dev/sfxge/common/efx_regs_mcdi.h   Thu Nov 29 06:45:04 2018
(r341202)
@@ -2761,6 +2761,8 @@
 #define

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:44:51 2018
New Revision: 341201
URL: https://svnweb.freebsd.org/changeset/base/341201

Log:
  sfxge(4): honour packed stream RSS restriction
  
  Packed stream firmware variant on EF10 adapters has a
  number of properties which must be taken into account:
  
   - Only one exclusive RSS context is available per port.
   - Only IP addresses can contribute to the hash value.
  
  Huntington and Medford have one more limitation which
  is important for the drivers capable of packed stream:
  
   - Hash algorithm is non-standard (i.e. non-Toeplitz).
 This implies XORing together source + destination
 IP addresses (or last four bytes in the case of IPv6)
 and using the result as the input to a Toeplitz hash.
  
  This patch provides a number of improvements in order
  to treat the mentioned limitations in the common code.
  
  If the firmware variant is packed stream, the list of
  supported hash tuples will include less variants, and
  the maximum number of RSS contexts will be set to one.
  
  Submitted by:   Ivan Malov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18232

Modified:
  head/sys/dev/sfxge/common/ef10_nic.c
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_rx.c
  head/sys/dev/sfxge/common/siena_nic.c

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:44:39 2018
(r341200)
+++ head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:44:51 2018
(r341201)
@@ -1266,11 +1266,63 @@ ef10_get_datapath_caps(
else
encp->enc_fec_counters = B_FALSE;
 
+   if (CAP_FLAGS1(req, RX_RSS_LIMITED)) {
+   /* Only one exclusive RSS context is available per port. */
+   encp->enc_rx_scale_max_exclusive_contexts = 1;
+
+   switch (enp->en_family) {
+   case EFX_FAMILY_MEDFORD2:
+   encp->enc_rx_scale_hash_alg_mask =
+   (1U << EFX_RX_HASHALG_TOEPLITZ);
+   break;
+
+   case EFX_FAMILY_MEDFORD:
+   case EFX_FAMILY_HUNTINGTON:
+   /*
+* Packed stream firmware variant maintains a
+* non-standard algorithm for hash computation.
+* It implies explicit XORing together
+* source + destination IP addresses (or last
+* four bytes in the case of IPv6) and using the
+* resulting value as the input to a Toeplitz hash.
+*/
+   encp->enc_rx_scale_hash_alg_mask =
+   (1U << EFX_RX_HASHALG_PACKED_STREAM);
+   break;
+
+   default:
+   rc = EINVAL;
+   goto fail5;
+   }
+
+   /* Port numbers cannot contribute to the hash value */
+   encp->enc_rx_scale_l4_hash_supported = B_FALSE;
+   } else {
+   /*
+* Maximum number of exclusive RSS contexts.
+* EF10 hardware supports 64 in total, but 6 are reserved
+* for shared contexts. They are a global resource so
+* not all may be available.
+*/
+   encp->enc_rx_scale_max_exclusive_contexts = 64 - 6;
+
+   encp->enc_rx_scale_hash_alg_mask =
+   (1U << EFX_RX_HASHALG_TOEPLITZ);
+
+   /*
+* It is possible to use port numbers as
+* the input data for hash computation.
+*/
+   encp->enc_rx_scale_l4_hash_supported = B_TRUE;
+   }
+
 #undef CAP_FLAGS1
 #undef CAP_FLAGS2
 
return (0);
 
+fail5:
+   EFSYS_PROBE(fail5);
 fail4:
EFSYS_PROBE(fail4);
 fail3:
@@ -1739,13 +1791,6 @@ ef10_nic_board_cfg(
 
/* Alignment for WPTR updates */
encp->enc_rx_push_align = EF10_RX_WPTR_ALIGN;
-
-   /*
-* Maximum number of exclusive RSS contexts. EF10 hardware supports 64
-* in total, but 6 are reserved for shared contexts. They are a global
-* resource so not all may be available.
-*/
-   encp->enc_rx_scale_max_exclusive_contexts = 64 - 6;
 
encp->enc_tx_dma_desc_size_max = EFX_MASK32(ESF_DZ_RX_KER_BYTE_CNT);
/* No boundary crossing limits */

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Thu Nov 29 06:44:39 2018
(r341200)
+++ head/sys/dev/sfxge/common/ef10_rx.c Thu Nov 29 06:44:51 2018
(r341201)
@@ -643,12 +643,13 @@ ef10_rx_scale_mode_set(
__in

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:47:19 2018
New Revision: 341214
URL: https://svnweb.freebsd.org/changeset/base/341214

Log:
  sfxge(4): fix SAL annotation for input buffers
  
  Submitted by:   Martin Harvey 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D18245

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

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Thu Nov 29 06:47:06 2018
(r341213)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Thu Nov 29 06:47:19 2018
(r341214)
@@ -456,7 +456,7 @@ ef10_nvram_partn_read(
__inefx_nic_t *enp,
__inuint32_t partn,
__inunsigned int offset,
-   __out_bcount(size)  caddr_t data,
+   __in_bcount(size)   caddr_t data,
__insize_t size);
 
 extern __checkReturn   efx_rc_t

Modified: head/sys/dev/sfxge/common/ef10_nvram.c
==
--- head/sys/dev/sfxge/common/ef10_nvram.c  Thu Nov 29 06:47:06 2018
(r341213)
+++ head/sys/dev/sfxge/common/ef10_nvram.c  Thu Nov 29 06:47:19 2018
(r341214)
@@ -2027,7 +2027,7 @@ ef10_nvram_partn_write(
__inefx_nic_t *enp,
__inuint32_t partn,
__inunsigned int offset,
-   __out_bcount(size)  caddr_t data,
+   __in_bcount(size)   caddr_t data,
__insize_t size)
 {
size_t chunk;

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hThu Nov 29 06:47:06 2018
(r341213)
+++ head/sys/dev/sfxge/common/efx_impl.hThu Nov 29 06:47:19 2018
(r341214)
@@ -611,7 +611,7 @@ efx_mcdi_nvram_write(
__inefx_nic_t *enp,
__inuint32_t partn,
__inuint32_t offset,
-   __out_bcount(size)  caddr_t data,
+   __in_bcount(size)   caddr_t data,
__insize_t size);
 
__checkReturn   efx_rc_t

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==
--- head/sys/dev/sfxge/common/efx_nvram.c   Thu Nov 29 06:47:06 2018
(r341213)
+++ head/sys/dev/sfxge/common/efx_nvram.c   Thu Nov 29 06:47:19 2018
(r341214)
@@ -894,7 +894,7 @@ efx_mcdi_nvram_write(
__inefx_nic_t *enp,
__inuint32_t partn,
__inuint32_t offset,
-   __out_bcount(size)  caddr_t data,
+   __in_bcount(size)   caddr_t data,
__insize_t size)
 {
efx_mcdi_req_t req;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:47:41 2018
New Revision: 341216
URL: https://svnweb.freebsd.org/changeset/base/341216

Log:
  sfxge(4): add more definitions of partitions
  
  Add definitions of dynamic config and expansion ROM backup
  partitions.
  
  Submitted by:   Paul Fox 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18247

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

Modified: head/sys/dev/sfxge/common/ef10_nvram.c
==
--- head/sys/dev/sfxge/common/ef10_nvram.c  Thu Nov 29 06:47:30 2018
(r341215)
+++ head/sys/dev/sfxge/common/ef10_nvram.c  Thu Nov 29 06:47:41 2018
(r341216)
@@ -2195,6 +2195,8 @@ static ef10_parttbl_entry_t medford2_parttbl[] = {
PARTN_MAP_ENTRY(LICENSE,ALL,LICENSE),
PARTN_MAP_ENTRY(EXPANSION_UEFI, ALL,UEFIROM),
PARTN_MAP_ENTRY(MUM_FIRMWARE,   ALL,MUM_FIRMWARE),
+   PARTN_MAP_ENTRY(DYNCONFIG_DEFAULTS, ALL,DYNCONFIG_DEFAULTS),
+   PARTN_MAP_ENTRY(ROMCONFIG_DEFAULTS, ALL,ROMCONFIG_DEFAULTS),
 };
 
 static __checkReturn   efx_rc_t

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:47:30 2018
(r341215)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:47:41 2018
(r341216)
@@ -1511,6 +1511,8 @@ typedef enum efx_nvram_type_e {
EFX_NVRAM_LICENSE,
EFX_NVRAM_UEFIROM,
EFX_NVRAM_MUM_FIRMWARE,
+   EFX_NVRAM_DYNCONFIG_DEFAULTS,
+   EFX_NVRAM_ROMCONFIG_DEFAULTS,
EFX_NVRAM_NTYPES,
 } efx_nvram_type_t;
 
___
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: r341198 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:44:20 2018
New Revision: 341198
URL: https://svnweb.freebsd.org/changeset/base/341198

Log:
  sfxge(4): cope with clang warning on negative shift
  
  clang 4.0.1-6 on Ubuntu generates false positive warning that shift
  is negative.  It is done regardless of the fact that the branch is
  not taken because of previous check.
  
  The warning is generate in EFX_INSERT_NATIVE32 used by
  EFX_INSERT_FIELD_NATIVE32. All similar cases are fixed as well.
  
  It is undesirable to suppress the warning completely.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18229

Modified:
  head/sys/dev/sfxge/common/efx_types.h

Modified: head/sys/dev/sfxge/common/efx_types.h
==
--- head/sys/dev/sfxge/common/efx_types.h   Thu Nov 29 06:44:09 2018
(r341197)
+++ head/sys/dev/sfxge/common/efx_types.h   Thu Nov 29 06:44:20 2018
(r341198)
@@ -357,6 +357,16 @@ extern int fix_lint;
 #endif
 
 /*
+ * Saturation arithmetic subtract with minimum equal to zero.
+ *
+ * Use saturating arithmetic to ensure a non-negative result. This
+ * avoids undefined behaviour (and compiler warnings) when used as a
+ * shift count.
+ */
+#defineEFX_SSUB(_val, _sub) \
+   ((_val) > (_sub) ? ((_val) - (_sub)) : 0)
+
+/*
  * Extract bit field portion [low,high) from the native-endian element
  * which contains bits [min,max).
  *
@@ -375,8 +385,8 @@ extern int fix_lint;
((FIX_LINT(_low > _max) || FIX_LINT(_high < _min)) ?\
0U :\
((_low > _min) ?\
-   ((_element) >> (_low - _min)) : \
-   ((_element) << (_min - _low
+   ((_element) >> EFX_SSUB(_low, _min)) :  \
+   ((_element) << EFX_SSUB(_min, _low
 
 /*
  * Extract bit field portion [low,high) from the 64-bit little-endian
@@ -565,29 +575,29 @@ extern int fix_lint;
(((_low > _max) || (_high < _min)) ?\
0U :\
((_low > _min) ?\
-   (((uint64_t)(_value)) << (_low - _min)) :   \
-   (((uint64_t)(_value)) >> (_min - _low
+   (((uint64_t)(_value)) << EFX_SSUB(_low, _min)) :\
+   (((uint64_t)(_value)) >> EFX_SSUB(_min, _low
 
 #defineEFX_INSERT_NATIVE32(_min, _max, _low, _high, _value)
\
(((_low > _max) || (_high < _min)) ?\
0U :\
((_low > _min) ?\
-   (((uint32_t)(_value)) << (_low - _min)) :   \
-   (((uint32_t)(_value)) >> (_min - _low
+   (((uint32_t)(_value)) << EFX_SSUB(_low, _min)) :\
+   (((uint32_t)(_value)) >> EFX_SSUB(_min, _low
 
 #defineEFX_INSERT_NATIVE16(_min, _max, _low, _high, _value)
\
(((_low > _max) || (_high < _min)) ?\
0U :\
(uint16_t)((_low > _min) ?  \
-   ((_value) << (_low - _min)) :   \
-   ((_value) >> (_min - _low
+   ((_value) << EFX_SSUB(_low, _min)) :\
+   ((_value) >> EFX_SSUB(_min, _low
 
 #defineEFX_INSERT_NATIVE8(_min, _max, _low, _high, _value) 
\
(((_low > _max) || (_high < _min)) ?\
0U :\
(uint8_t)((_low > _min) ?   \
-   ((_value) << (_low - _min)) :   \
-   ((_value) >> (_min - _low
+   ((_value) << EFX_SSUB(_low, _min)) :\
+   ((_value) >> EFX_SSUB(_min, _low
 
 /*
  * Construct bit field portion
@@ -1316,22 +1326,22 @@ extern int fix_lint;
 
 #defineEFX_SHIFT64(_bit, _base)
\
(((_bit) >= (_base) && (_bit) < (_base) + 64) ? \
-   ((uint64_t)1 << ((_bit) - (_base))) :   \
+   ((uint64_t)1 << EFX_SSUB((_bit), (_base))) :\
0U)
 
 #defineEFX_SHIFT32(_bit, _base)
\
(((_bit) >= (_base) && (_bit) < (_base) + 32) ? \

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:46:33 2018
New Revision: 341210
URL: https://svnweb.freebsd.org/changeset/base/341210

Log:
  sfxge(4): generate Medford2 RxDP stats
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18241

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

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:46:21 2018
(r341209)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:46:33 2018
(r341210)
@@ -364,7 +364,7 @@ efx_intr_fini(
 
 #if EFSYS_OPT_MAC_STATS
 
-/* START MKCONFIG GENERATED EfxHeaderMacBlock 7d59c0d68431a5d1 */
+/* START MKCONFIG GENERATED EfxHeaderMacBlock ea466a9bc8789994 */
 typedef enum efx_mac_stat_e {
EFX_MAC_RX_OCTETS,
EFX_MAC_RX_PKTS,
@@ -469,6 +469,9 @@ typedef enum efx_mac_stat_e {
EFX_MAC_CTPIO_FALLBACK,
EFX_MAC_CTPIO_POISON,
EFX_MAC_CTPIO_ERASE,
+   EFX_MAC_RXDP_SCATTER_DISABLED_TRUNC,
+   EFX_MAC_RXDP_HLB_IDLE,
+   EFX_MAC_RXDP_HLB_TIMEOUT,
EFX_MAC_NSTATS
 } efx_mac_stat_t;
 

Modified: head/sys/dev/sfxge/common/efx_mac.c
==
--- head/sys/dev/sfxge/common/efx_mac.c Thu Nov 29 06:46:21 2018
(r341209)
+++ head/sys/dev/sfxge/common/efx_mac.c Thu Nov 29 06:46:33 2018
(r341210)
@@ -521,7 +521,7 @@ efx_mac_filter_default_rxq_clear(
 
 #if EFSYS_OPT_NAMES
 
-/* START MKCONFIG GENERATED EfxMacStatNamesBlock 3cfa8780abd28993 */
+/* START MKCONFIG GENERATED EfxMacStatNamesBlock 1a45a82fcfb30c1b */
 static const char * const __efx_mac_stat_name[] = {
"rx_octets",
"rx_pkts",
@@ -626,6 +626,9 @@ static const char * const __efx_mac_stat_name[] = {
"ctpio_fallback",
"ctpio_poison",
"ctpio_erase",
+   "rxdp_scatter_disabled_trunc",
+   "rxdp_hlb_idle",
+   "rxdp_hlb_timeout",
 };
 /* END MKCONFIG GENERATED EfxMacStatNamesBlock */
 
___
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: r341212 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:46:55 2018
New Revision: 341212
URL: https://svnweb.freebsd.org/changeset/base/341212

Log:
  sfxge(4): add Medford2 head-of-line blocking stats
  
  These stats are availble on Medford2 DPDK firmware variant
  which support equal stride super-buffer Rx mode. RXDP_HLB_IDLE
  capability bit is set when the stats are available.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18243

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

Modified: head/sys/dev/sfxge/common/ef10_mac.c
==
--- head/sys/dev/sfxge/common/ef10_mac.cThu Nov 29 06:46:44 2018
(r341211)
+++ head/sys/dev/sfxge/common/ef10_mac.cThu Nov 29 06:46:55 2018
(r341212)
@@ -571,8 +571,19 @@ ef10_mac_stats_get_mask(
goto fail8;
}
 
+   if (encp->enc_hlb_counters) {
+   const struct efx_mac_stats_range ef10_hlb[] = {
+   { EFX_MAC_RXDP_HLB_IDLE, EFX_MAC_RXDP_HLB_TIMEOUT },
+   };
+   if ((rc = efx_mac_stats_mask_add_ranges(maskp, mask_size,
+   ef10_hlb, EFX_ARRAY_SIZE(ef10_hlb))) != 0)
+   goto fail9;
+   }
+
return (0);
 
+fail9:
+   EFSYS_PROBE(fail9);
 fail8:
EFSYS_PROBE(fail8);
 fail7:
@@ -1025,6 +1036,13 @@ ef10_mac_stats_update(
);
EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_RXDP_SCATTER_DISABLED_TRUNC]),
);
+
+   /* Head-of-line blocking */
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_RXDP_HLB_IDLE, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_RXDP_HLB_IDLE]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_RXDP_HLB_TIMEOUT, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_RXDP_HLB_TIMEOUT]), );
 
 done:
/* Read START generation counter */

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:46:44 2018
(r341211)
+++ head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:46:55 2018
(r341212)
@@ -1272,6 +1272,12 @@ ef10_get_datapath_caps(
else
encp->enc_fec_counters = B_FALSE;
 
+   /* Check if the firmware provides head-of-line blocking counters */
+   if (CAP_FLAGS2(req, RXDP_HLB_IDLE))
+   encp->enc_hlb_counters = B_TRUE;
+   else
+   encp->enc_hlb_counters = B_FALSE;
+
if (CAP_FLAGS1(req, RX_RSS_LIMITED)) {
/* Only one exclusive RSS context is available per port. */
encp->enc_rx_scale_max_exclusive_contexts = 1;

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:46:44 2018
(r341211)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:46:55 2018
(r341212)
@@ -1324,6 +1324,7 @@ typedef struct efx_nic_cfg_s {
/* Firmware support for extended MAC_STATS buffer */
uint32_tenc_mac_stats_nstats;
boolean_t   enc_fec_counters;
+   boolean_t   enc_hlb_counters;
/* Firmware support for "FLAG" and "MARK" filter actions */
boolean_t   enc_filter_action_flag_supported;
boolean_t   enc_filter_action_mark_supported;
___
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: r341209 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:46:21 2018
New Revision: 341209
URL: https://svnweb.freebsd.org/changeset/base/341209

Log:
  sfxge(4): get max supported value for action MARK
  
  The mark value for MATCH_ACTION_MARK has a maximum value.
  Requesting a value larger than the maximum will cause the
  filter insertion to fail with EINVAL. This patch allows the
  driver to check the value at the filter validation.
  
  Submitted by:   Roman Zhukov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18240

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

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:46:10 2018
(r341208)
+++ head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:46:21 2018
(r341209)
@@ -1023,7 +1023,7 @@ ef10_get_datapath_caps(
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_GET_CAPABILITIES_IN_LEN,
-   MC_CMD_GET_CAPABILITIES_V4_OUT_LEN)];
+   MC_CMD_GET_CAPABILITIES_V5_OUT_LEN)];
efx_rc_t rc;
 
if ((rc = ef10_mcdi_get_pf_count(enp, >enc_hw_pf_count)) != 0)
@@ -1035,7 +1035,7 @@ ef10_get_datapath_caps(
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_GET_CAPABILITIES_IN_LEN;
req.emr_out_buf = payload;
-   req.emr_out_length = MC_CMD_GET_CAPABILITIES_V4_OUT_LEN;
+   req.emr_out_length = MC_CMD_GET_CAPABILITIES_V5_OUT_LEN;
 
efx_mcdi_execute_quiet(enp, );
 
@@ -1331,6 +1331,13 @@ ef10_get_datapath_caps(
encp->enc_filter_action_mark_supported = B_TRUE;
else
encp->enc_filter_action_mark_supported = B_FALSE;
+
+   /* Get maximum supported value for "MARK" filter action */
+   if (req.emr_out_length_used >= MC_CMD_GET_CAPABILITIES_V5_OUT_LEN)
+   encp->enc_filter_action_mark_max = MCDI_OUT_DWORD(req,
+   GET_CAPABILITIES_V5_OUT_FILTER_ACTION_MARK_MAX);
+   else
+   encp->enc_filter_action_mark_max = 0;
 
 #undef CAP_FLAGS1
 #undef CAP_FLAGS2

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:46:10 2018
(r341208)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:46:21 2018
(r341209)
@@ -1324,6 +1324,7 @@ typedef struct efx_nic_cfg_s {
/* Firmware support for "FLAG" and "MARK" filter actions */
boolean_t   enc_filter_action_flag_supported;
boolean_t   enc_filter_action_mark_supported;
+   uint32_tenc_filter_action_mark_max;
 } efx_nic_cfg_t;
 
 #defineEFX_PCI_FUNCTION_IS_PF(_encp)   ((_encp)->enc_vf == 0x)

Modified: head/sys/dev/sfxge/common/siena_nic.c
==
--- head/sys/dev/sfxge/common/siena_nic.c   Thu Nov 29 06:46:10 2018
(r341208)
+++ head/sys/dev/sfxge/common/siena_nic.c   Thu Nov 29 06:46:21 2018
(r341209)
@@ -203,6 +203,7 @@ siena_board_cfg(
 
encp->enc_filter_action_flag_supported = B_FALSE;
encp->enc_filter_action_mark_supported = B_FALSE;
+   encp->enc_filter_action_mark_max = 0;
 
return (0);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:43:57 2018
New Revision: 341196
URL: https://svnweb.freebsd.org/changeset/base/341196

Log:
  sfxge(4): support FW subvariant choice
  
  If DPDK application or OS does not need checksumming on transmit,
  it may be disabled in firmware to achieve higher packet rates.
  Choice must be done before VIS allocation and is allowed if
  no other non-preboot and firmware subvariant-unaware drivers are
  attached.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18227

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_nic.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_nic.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Thu Nov 29 06:43:46 2018
(r341195)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Thu Nov 29 06:43:57 2018
(r341196)
@@ -1193,6 +1193,22 @@ ef10_get_privilege_mask(
__inefx_nic_t *enp,
__out   uint32_t *maskp);
 
+#if EFSYS_OPT_FW_SUBVARIANT_AWARE
+
+extern __checkReturn   efx_rc_t
+efx_mcdi_get_nic_global(
+   __inefx_nic_t *enp,
+   __inuint32_t key,
+   __out   uint32_t *valuep);
+
+extern __checkReturn   efx_rc_t
+efx_mcdi_set_nic_global(
+   __inefx_nic_t *enp,
+   __inuint32_t key,
+   __inuint32_t value);
+
+#endif /* EFSYS_OPT_FW_SUBVARIANT_AWARE */
+
 
 #if EFSYS_OPT_RX_PACKED_STREAM
 

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:43:46 2018
(r341195)
+++ head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:43:57 2018
(r341196)
@@ -2324,5 +2324,87 @@ fail1:
 
 #endif /* EFSYS_OPT_DIAG */
 
+#if EFSYS_OPT_FW_SUBVARIANT_AWARE
+
+   __checkReturn   efx_rc_t
+efx_mcdi_get_nic_global(
+   __inefx_nic_t *enp,
+   __inuint32_t key,
+   __out   uint32_t *valuep)
+{
+   efx_mcdi_req_t req;
+   uint8_t payload[MAX(MC_CMD_GET_NIC_GLOBAL_IN_LEN,
+   MC_CMD_GET_NIC_GLOBAL_OUT_LEN)];
+   efx_rc_t rc;
+
+   (void) memset(payload, 0, sizeof (payload));
+   req.emr_cmd = MC_CMD_GET_NIC_GLOBAL;
+   req.emr_in_buf = payload;
+   req.emr_in_length = MC_CMD_GET_NIC_GLOBAL_IN_LEN;
+   req.emr_out_buf = payload;
+   req.emr_out_length = MC_CMD_GET_NIC_GLOBAL_OUT_LEN;
+
+   MCDI_IN_SET_DWORD(req, GET_NIC_GLOBAL_IN_KEY, key);
+
+   efx_mcdi_execute(enp, );
+
+   if (req.emr_rc != 0) {
+   rc = req.emr_rc;
+   goto fail1;
+   }
+
+   if (req.emr_out_length_used != MC_CMD_GET_NIC_GLOBAL_OUT_LEN) {
+   rc = EMSGSIZE;
+   goto fail2;
+   }
+
+   *valuep = MCDI_OUT_DWORD(req, GET_NIC_GLOBAL_OUT_VALUE);
+
+   return (0);
+
+fail2:
+   EFSYS_PROBE(fail2);
+fail1:
+   EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+   return (rc);
+}
+
+   __checkReturn   efx_rc_t
+efx_mcdi_set_nic_global(
+   __inefx_nic_t *enp,
+   __inuint32_t key,
+   __inuint32_t value)
+{
+   efx_mcdi_req_t req;
+   uint8_t payload[MC_CMD_SET_NIC_GLOBAL_IN_LEN];
+   efx_rc_t rc;
+
+   (void) memset(payload, 0, sizeof (payload));
+   req.emr_cmd = MC_CMD_SET_NIC_GLOBAL;
+   req.emr_in_buf = payload;
+   req.emr_in_length = MC_CMD_SET_NIC_GLOBAL_IN_LEN;
+   req.emr_out_buf = NULL;
+   req.emr_out_length = 0;
+
+   MCDI_IN_SET_DWORD(req, SET_NIC_GLOBAL_IN_KEY, key);
+   MCDI_IN_SET_DWORD(req, SET_NIC_GLOBAL_IN_VALUE, value);
+
+   efx_mcdi_execute(enp, );
+
+   if (req.emr_rc != 0) {
+   rc = req.emr_rc;
+   goto fail1;
+   }
+
+   return (0);
+
+fail1:
+   EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+   return (rc);
+}
+
+#endif /* EFSYS_OPT_FW_SUBVARIANT_AWARE */
 
 #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:43:46 2018
(r341195)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:43:57 2018
(r341196)
@@ -2891,6 +2891,38 @@ efx_tunnel_reconfigure(
 
 #endif /* EFSYS_OPT_TUNNEL */
 
+#if EFSYS_OPT_FW_SUBVARIANT_AWARE
+
+/**
+ * Firmware subvariant choice options.
+ *
+ * It may be switched to no Tx checksum if attached drivers are either
+ * preboot or firmware subvariant aware and no VIS are allocated.
+ * If may be always switched to default explicitly using set request or
+ * implicitly if unaware driver is 

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:46:44 2018
New Revision: 341211
URL: https://svnweb.freebsd.org/changeset/base/341211

Log:
  sfxge(4): support RxDP scatter disabled truncate counter
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18242

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

Modified: head/sys/dev/sfxge/common/ef10_mac.c
==
--- head/sys/dev/sfxge/common/ef10_mac.cThu Nov 29 06:46:33 2018
(r341210)
+++ head/sys/dev/sfxge/common/ef10_mac.cThu Nov 29 06:46:44 2018
(r341211)
@@ -560,8 +560,21 @@ ef10_mac_stats_get_mask(
goto fail7;
}
 
+   if (encp->enc_mac_stats_nstats >= MC_CMD_MAC_NSTATS_V4) {
+   const struct efx_mac_stats_range ef10_rxdp_sdt[] = {
+   { EFX_MAC_RXDP_SCATTER_DISABLED_TRUNC,
+   EFX_MAC_RXDP_SCATTER_DISABLED_TRUNC },
+   };
+
+   if ((rc = efx_mac_stats_mask_add_ranges(maskp, mask_size,
+   ef10_rxdp_sdt, EFX_ARRAY_SIZE(ef10_rxdp_sdt))) != 0)
+   goto fail8;
+   }
+
return (0);
 
+fail8:
+   EFSYS_PROBE(fail8);
 fail7:
EFSYS_PROBE(fail7);
 fail6:
@@ -1004,6 +1017,14 @@ ef10_mac_stats_update(
 
EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_ERASE, );
EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_ERASE]), );
+
+   if (encp->enc_mac_stats_nstats < MC_CMD_MAC_NSTATS_V4)
+   goto done;
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_RXDP_SCATTER_DISABLED_TRUNC,
+   );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_RXDP_SCATTER_DISABLED_TRUNC]),
+   );
 
 done:
/* Read START generation counter */
___
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: r341206 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:45:50 2018
New Revision: 341206
URL: https://svnweb.freebsd.org/changeset/base/341206

Log:
  sfxge(4): add equal stride super-buffer prefix layout
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18237

Modified:
  head/sys/dev/sfxge/common/efx_regs_ef10.h

Modified: head/sys/dev/sfxge/common/efx_regs_ef10.h
==
--- head/sys/dev/sfxge/common/efx_regs_ef10.h   Thu Nov 29 06:45:38 2018
(r341205)
+++ head/sys/dev/sfxge/common/efx_regs_ef10.h   Thu Nov 29 06:45:50 2018
(r341206)
@@ -726,6 +726,21 @@ extern "C" {
 #defineES_DZ_PS_RX_PREFIX_ORIG_LEN_LBN 48
 #defineES_DZ_PS_RX_PREFIX_ORIG_LEN_WIDTH 16
 
+/* Equal stride super-buffer RX packet prefix (see SF-119419-TC) */
+#defineES_EZ_ESSB_RX_PREFIX_LEN 8
+#defineES_EZ_ESSB_RX_PREFIX_DATA_LEN_LBN 0
+#defineES_EZ_ESSB_RX_PREFIX_DATA_LEN_WIDTH 16
+#defineES_EZ_ESSB_RX_PREFIX_MARK_LBN 16
+#defineES_EZ_ESSB_RX_PREFIX_MARK_WIDTH 8
+#defineES_EZ_ESSB_RX_PREFIX_HASH_VALID_LBN 28
+#defineES_EZ_ESSB_RX_PREFIX_HASH_VALID_WIDTH 1
+#defineES_EZ_ESSB_RX_PREFIX_MARK_VALID_LBN 29
+#defineES_EZ_ESSB_RX_PREFIX_MARK_VALID_WIDTH 1
+#defineES_EZ_ESSB_RX_PREFIX_MATCH_FLAG_LBN 30
+#defineES_EZ_ESSB_RX_PREFIX_MATCH_FLAG_WIDTH 1
+#defineES_EZ_ESSB_RX_PREFIX_HASH_LBN 32
+#defineES_EZ_ESSB_RX_PREFIX_HASH_WIDTH 32
+
 /*
  * An extra flag for the packed stream mode,
  * signalling the start of a new buffer
___
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: r341207 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:46:01 2018
New Revision: 341207
URL: https://svnweb.freebsd.org/changeset/base/341207

Log:
  sfxge(4): get actions MARK and FLAG support
  
  Filter actions MARK and FLAG are supported on Medford2 by DPDK
  firmware variant.
  
  Submitted by:   Roman Zhukov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18238

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

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:45:50 2018
(r341206)
+++ head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:46:01 2018
(r341207)
@@ -1321,6 +1321,16 @@ ef10_get_datapath_caps(
 */
encp->enc_rx_scale_l4_hash_supported = B_TRUE;
}
+   /* Check if the firmware supports "FLAG" and "MARK" filter actions */
+   if (CAP_FLAGS2(req, FILTER_ACTION_FLAG))
+   encp->enc_filter_action_flag_supported = B_TRUE;
+   else
+   encp->enc_filter_action_flag_supported = B_FALSE;
+
+   if (CAP_FLAGS2(req, FILTER_ACTION_MARK))
+   encp->enc_filter_action_mark_supported = B_TRUE;
+   else
+   encp->enc_filter_action_mark_supported = B_FALSE;
 
 #undef CAP_FLAGS1
 #undef CAP_FLAGS2

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:45:50 2018
(r341206)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:46:01 2018
(r341207)
@@ -1321,6 +1321,9 @@ typedef struct efx_nic_cfg_s {
/* Firmware support for extended MAC_STATS buffer */
uint32_tenc_mac_stats_nstats;
boolean_t   enc_fec_counters;
+   /* Firmware support for "FLAG" and "MARK" filter actions */
+   boolean_t   enc_filter_action_flag_supported;
+   boolean_t   enc_filter_action_mark_supported;
 } efx_nic_cfg_t;
 
 #defineEFX_PCI_FUNCTION_IS_PF(_encp)   ((_encp)->enc_vf == 0x)

Modified: head/sys/dev/sfxge/common/siena_nic.c
==
--- head/sys/dev/sfxge/common/siena_nic.c   Thu Nov 29 06:45:50 2018
(r341206)
+++ head/sys/dev/sfxge/common/siena_nic.c   Thu Nov 29 06:46:01 2018
(r341207)
@@ -201,6 +201,9 @@ siena_board_cfg(
 
encp->enc_mac_stats_nstats = MC_CMD_MAC_NSTATS;
 
+   encp->enc_filter_action_flag_supported = B_FALSE;
+   encp->enc_filter_action_mark_supported = B_FALSE;
+
return (0);
 
 fail2:
___
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: r341205 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:45:38 2018
New Revision: 341205
URL: https://svnweb.freebsd.org/changeset/base/341205

Log:
  sfxge(4): support equal stride super-buffer Rx mode
  
  Equal stride super-buffer Rx mode is supported by DPDK firmware
  variant. One Rx descriptor provides many Rx buffers to firmware.
  Rx buffers follow each other with specified stride.
  Also it supports head of line blocking with timeout to address
  drops when no Rx descriptors are available. So it gives extra time
  to the driver to provide Rx descriptors before drop.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18236

Modified:
  head/sys/dev/sfxge/common/ef10_ev.c
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efsys.h
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_check.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_rx.c

Modified: head/sys/dev/sfxge/common/ef10_ev.c
==
--- head/sys/dev/sfxge/common/ef10_ev.c Thu Nov 29 06:45:26 2018
(r341204)
+++ head/sys/dev/sfxge/common/ef10_ev.c Thu Nov 29 06:45:38 2018
(r341205)
@@ -776,7 +776,7 @@ ef10_ev_qstats_update(
 }
 #endif /* EFSYS_OPT_QSTATS */
 
-#if EFSYS_OPT_RX_PACKED_STREAM
+#if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER
 
 static __checkReturn   boolean_t
 ef10_ev_rx_packed_stream(
@@ -815,7 +815,18 @@ ef10_ev_rx_packed_stream(
 
if (new_buffer) {
flags |= EFX_PKT_PACKED_STREAM_NEW_BUFFER;
+#if EFSYS_OPT_RX_PACKED_STREAM
+   /*
+* If both packed stream and equal stride super-buffer
+* modes are compiled in, in theory credits should be
+* be maintained for packed stream only, but right now
+* these modes are not distinguished in the event queue
+* Rx queue state and it is OK to increment the counter
+* regardless (it might be event cheaper than branching
+* since neighbour structure member are updated as well).
+*/
eersp->eers_rx_packed_stream_credits++;
+#endif
eersp->eers_rx_read_ptr++;
}
current_id = eersp->eers_rx_read_ptr & eersp->eers_rx_mask;
@@ -857,7 +868,7 @@ deliver:
return (should_abort);
 }
 
-#endif /* EFSYS_OPT_RX_PACKED_STREAM */
+#endif /* EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER */
 
 static __checkReturn   boolean_t
 ef10_ev_rx(
@@ -891,7 +902,7 @@ ef10_ev_rx(
label = EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_QLABEL);
eersp = >ee_rxq_state[label];
 
-#if EFSYS_OPT_RX_PACKED_STREAM
+#if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER
/*
 * Packed stream events are very different,
 * so handle them separately
@@ -1391,8 +1402,9 @@ ef10_ev_rxlabel_init(
__inefx_rxq_type_t type)
 {
efx_evq_rxq_state_t *eersp;
-#if EFSYS_OPT_RX_PACKED_STREAM
+#if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER
boolean_t packed_stream = (type == EFX_RXQ_TYPE_PACKED_STREAM);
+   boolean_t es_super_buffer = (type == EFX_RXQ_TYPE_ES_SUPER_BUFFER);
 #endif
 
_NOTE(ARGUNUSED(type))
@@ -1414,9 +1426,11 @@ ef10_ev_rxlabel_init(
eersp->eers_rx_read_ptr = 0;
 #endif
eersp->eers_rx_mask = erp->er_mask;
-#if EFSYS_OPT_RX_PACKED_STREAM
+#if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER
eersp->eers_rx_stream_npackets = 0;
-   eersp->eers_rx_packed_stream = packed_stream;
+   eersp->eers_rx_packed_stream = packed_stream || es_super_buffer;
+#endif
+#if EFSYS_OPT_RX_PACKED_STREAM
if (packed_stream) {
eersp->eers_rx_packed_stream_credits = (eep->ee_mask + 1) /
EFX_DIV_ROUND_UP(EFX_RX_PACKED_STREAM_MEM_PER_CREDIT,
@@ -1450,9 +1464,11 @@ ef10_ev_rxlabel_fini(
 
eersp->eers_rx_read_ptr = 0;
eersp->eers_rx_mask = 0;
-#if EFSYS_OPT_RX_PACKED_STREAM
+#if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER
eersp->eers_rx_stream_npackets = 0;
eersp->eers_rx_packed_stream = B_FALSE;
+#endif
+#if EFSYS_OPT_RX_PACKED_STREAM
eersp->eers_rx_packed_stream_credits = 0;
 #endif
 }

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Thu Nov 29 06:45:26 2018
(r341204)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Thu Nov 29 06:45:38 2018
(r341205)
@@ -1242,6 +1242,16 @@ efx_mcdi_set_nic_global(
 
 #endif /* EFSYS_OPT_RX_PACKED_STREAM */
 
+#if EFSYS_OPT_RX_ES_SUPER_BUFFER
+
+/*
+ * Maximum DMA length and buffer stride alignment.
+ * (see SF-119419-TC, 3.2)
+ */
+#defineEFX_RX_ES_SUPER_BUFFER_BUF_ALIGNMENT64
+

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:45:15 2018
New Revision: 341203
URL: https://svnweb.freebsd.org/changeset/base/341203

Log:
  sfxge(4): make RxQ type data an union
  
  The type is an internal interface. Single integer is insufficient
  to carry RxQ type-specific information in the case of equal stride
  super-buffer Rx mode (packet buffers per bucket, maximum DMA length,
  packet stride, head of line block timeout).
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18234

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_rx.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Thu Nov 29 06:45:04 2018
(r341202)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Thu Nov 29 06:45:15 2018
(r341203)
@@ -993,13 +993,15 @@ externvoid
 ef10_rx_qenable(
__inefx_rxq_t *erp);
 
+union efx_rxq_type_data_u;
+
 extern __checkReturn   efx_rc_t
 ef10_rx_qcreate(
__inefx_nic_t *enp,
__inunsigned int index,
__inunsigned int label,
__inefx_rxq_type_t type,
-   __inuint32_t type_data,
+   __inconst union efx_rxq_type_data_u *type_data,
__inefsys_mem_t *esmp,
__insize_t ndescs,
__inuint32_t id,

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Thu Nov 29 06:45:04 2018
(r341202)
+++ head/sys/dev/sfxge/common/ef10_rx.c Thu Nov 29 06:45:15 2018
(r341203)
@@ -1027,7 +1027,7 @@ ef10_rx_qcreate(
__inunsigned int index,
__inunsigned int label,
__inefx_rxq_type_t type,
-   __inuint32_t type_data,
+   __inconst efx_rxq_type_data_t *type_data,
__inefsys_mem_t *esmp,
__insize_t ndescs,
__inuint32_t id,
@@ -1066,7 +1066,7 @@ ef10_rx_qcreate(
break;
 #if EFSYS_OPT_RX_PACKED_STREAM
case EFX_RXQ_TYPE_PACKED_STREAM:
-   switch (type_data) {
+   switch (type_data->ertd_packed_stream.eps_buf_size) {
case EFX_RXQ_PACKED_STREAM_BUF_SIZE_1M:
ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M;
break;

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hThu Nov 29 06:45:04 2018
(r341202)
+++ head/sys/dev/sfxge/common/efx_impl.hThu Nov 29 06:45:15 2018
(r341203)
@@ -157,6 +157,16 @@ typedef struct efx_tx_ops_s {
 #endif
 } efx_tx_ops_t;
 
+typedef union efx_rxq_type_data_u {
+   /* Dummy member to have non-empty union if no options are enabled */
+   uint32_tertd_dummy;
+#if EFSYS_OPT_RX_PACKED_STREAM
+   struct {
+   uint32_teps_buf_size;
+   } ertd_packed_stream;
+#endif
+} efx_rxq_type_data_t;
+
 typedef struct efx_rx_ops_s {
efx_rc_t(*erxo_init)(efx_nic_t *);
void(*erxo_fini)(efx_nic_t *);
@@ -193,7 +203,8 @@ typedef struct efx_rx_ops_s {
efx_rc_t(*erxo_qflush)(efx_rxq_t *);
void(*erxo_qenable)(efx_rxq_t *);
efx_rc_t(*erxo_qcreate)(efx_nic_t *enp, unsigned int,
-   unsigned int, efx_rxq_type_t, uint32_t,
+   unsigned int, efx_rxq_type_t,
+   const efx_rxq_type_data_t *,
efsys_mem_t *, size_t, uint32_t,
unsigned int,
efx_evq_t *, efx_rxq_t *);

Modified: head/sys/dev/sfxge/common/efx_rx.c
==
--- head/sys/dev/sfxge/common/efx_rx.c  Thu Nov 29 06:45:04 2018
(r341202)
+++ head/sys/dev/sfxge/common/efx_rx.c  Thu Nov 29 06:45:15 2018
(r341203)
@@ -136,7 +136,7 @@ siena_rx_qcreate(
__inunsigned int index,
__inunsigned int label,
__inefx_rxq_type_t type,
-   __inuint32_t type_data,
+   __inconst efx_rxq_type_data_t *type_data,
__inefsys_mem_t *esmp,
__insize_t ndescs,
__inuint32_t id,
@@ -780,7 +780,7 @@ efx_rx_qcreate_internal(
__inunsigned int index,
__inunsigned int label,
__in 

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:43:46 2018
New Revision: 341195
URL: https://svnweb.freebsd.org/changeset/base/341195

Log:
  sfxge(4): report no Tx checksum FW subvariant support
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18226

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

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:43:34 2018
(r341194)
+++ head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:43:46 2018
(r341195)
@@ -1135,6 +1135,12 @@ ef10_get_datapath_caps(
else
encp->enc_rx_var_packed_stream_supported = B_FALSE;
 
+   /* Check if the firmware supports FW subvariant w/o Tx checksumming */
+   if (CAP_FLAGS2(req, FW_SUBVARIANT_NO_TX_CSUM))
+   encp->enc_fw_subvariant_no_tx_csum_supported = B_TRUE;
+   else
+   encp->enc_fw_subvariant_no_tx_csum_supported = B_FALSE;
+
/* Check if the firmware supports set mac with running filters */
if (CAP_FLAGS1(req, VADAPTOR_PERMIT_SET_MAC_WHEN_FILTERS_INSTALLED))
encp->enc_allow_set_mac_with_installed_filters = B_TRUE;

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:43:34 2018
(r341194)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:43:46 2018
(r341195)
@@ -1287,6 +1287,7 @@ typedef struct efx_nic_cfg_s {
boolean_t   enc_init_evq_v2_supported;
boolean_t   enc_rx_packed_stream_supported;
boolean_t   enc_rx_var_packed_stream_supported;
+   boolean_t   enc_fw_subvariant_no_tx_csum_supported;
boolean_t   enc_pm_and_rxdp_counters;
boolean_t   enc_mac_stats_40g_tx_size_bins;
uint32_tenc_tunnel_encapsulations_supported;

Modified: head/sys/dev/sfxge/common/siena_nic.c
==
--- head/sys/dev/sfxge/common/siena_nic.c   Thu Nov 29 06:43:34 2018
(r341194)
+++ head/sys/dev/sfxge/common/siena_nic.c   Thu Nov 29 06:43:46 2018
(r341195)
@@ -178,6 +178,7 @@ siena_board_cfg(
encp->enc_allow_set_mac_with_installed_filters = B_TRUE;
encp->enc_rx_packed_stream_supported = B_FALSE;
encp->enc_rx_var_packed_stream_supported = B_FALSE;
+   encp->enc_fw_subvariant_no_tx_csum_supported = B_FALSE;
 
/* Siena supports two 10G ports, and 8 lanes of PCIe Gen2 */
encp->enc_required_pcie_bandwidth_mbps = 2 * 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: r341194 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:43:34 2018
New Revision: 341194
URL: https://svnweb.freebsd.org/changeset/base/341194

Log:
  sfxge(4): add firmware subvariant aware driver option
  
  FW subvariants allow to tweak NIC global features. For example,
  if no drivers require checksumming on transmit, it may be disabled
  in FW to increase packet rate.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18225

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

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Thu Nov 29 06:43:23 2018
(r341193)
+++ head/sys/dev/sfxge/common/efsys.h   Thu Nov 29 06:43:34 2018
(r341194)
@@ -287,6 +287,8 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t ma
 
 #defineEFSYS_OPT_TUNNEL 0
 
+#defineEFSYS_OPT_FW_SUBVARIANT_AWARE 0
+
 /* ID */
 
 typedef struct __efsys_identifier_sefsys_identifier_t;

Modified: head/sys/dev/sfxge/common/efx_check.h
==
--- head/sys/dev/sfxge/common/efx_check.h   Thu Nov 29 06:43:23 2018
(r341193)
+++ head/sys/dev/sfxge/common/efx_check.h   Thu Nov 29 06:43:34 2018
(r341194)
@@ -377,4 +377,11 @@
 # endif
 #endif /* EFSYS_OPT_TUNNEL */
 
+#if EFSYS_OPT_FW_SUBVARIANT_AWARE
+/* Advertise that the driver is firmware subvariant aware */
+# if !(EFSYS_OPT_MEDFORD2)
+#  error "FW_SUBVARIANT_AWARE requires MEDFORD2"
+# endif
+#endif
+
 #endif /* _SYS_EFX_CHECK_H */

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cThu Nov 29 06:43:23 2018
(r341193)
+++ head/sys/dev/sfxge/common/efx_mcdi.cThu Nov 29 06:43:34 2018
(r341194)
@@ -1303,7 +1303,9 @@ efx_mcdi_drv_attach(
 * FULL_FEATURED datapath firmware type first and fall backs to
 * DONT_CARE datapath firmware type if MC_CMD_DRV_ATTACH fails.
 */
-   MCDI_IN_SET_DWORD(req, DRV_ATTACH_IN_NEW_STATE, attach ? 1 : 0);
+   MCDI_IN_POPULATE_DWORD_2(req, DRV_ATTACH_IN_NEW_STATE,
+   DRV_ATTACH_IN_ATTACH, attach ? 1 : 0,
+   DRV_ATTACH_IN_SUBVARIANT_AWARE, EFSYS_OPT_FW_SUBVARIANT_AWARE);
MCDI_IN_SET_DWORD(req, DRV_ATTACH_IN_UPDATE, 1);
MCDI_IN_SET_DWORD(req, DRV_ATTACH_IN_FIRMWARE_ID, enp->efv);
 
___
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: r341200 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:44:39 2018
New Revision: 341200
URL: https://svnweb.freebsd.org/changeset/base/341200

Log:
  sfxge(4): support more RSS hash configurations
  
  Modern firmwares on EF10 adapters have support for
  more traffic classes eligible for hash computation.
  Also, it has become possible to adjust hashing per
  individual class and select distinct packet fields
  which will be able to contribute to the hash value.
  
  This patch adds support for the mentioned features.
  
  Submitted by:   Ivan Malov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18231

Modified:
  head/sys/dev/sfxge/common/ef10_nic.c
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_rx.c
  head/sys/dev/sfxge/common/siena_nic.c

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:44:28 2018
(r341199)
+++ head/sys/dev/sfxge/common/ef10_nic.cThu Nov 29 06:44:39 2018
(r341200)
@@ -1068,6 +1068,12 @@ ef10_get_datapath_caps(
}
encp->enc_rx_prefix_size = 14;
 
+   /* Check if the firmware supports additional RSS modes */
+   if (CAP_FLAGS1(req, ADDITIONAL_RSS_MODES))
+   encp->enc_rx_scale_additional_modes_supported = B_TRUE;
+   else
+   encp->enc_rx_scale_additional_modes_supported = B_FALSE;
+
/* Check if the firmware supports TSO */
if (CAP_FLAGS1(req, TX_TSO))
encp->enc_fw_assisted_tso_enabled = B_TRUE;

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Thu Nov 29 06:44:28 2018
(r341199)
+++ head/sys/dev/sfxge/common/ef10_rx.c Thu Nov 29 06:44:39 2018
(r341200)
@@ -325,10 +325,12 @@ efx_mcdi_rss_context_set_flags(
__inuint32_t rss_context,
__inefx_rx_hash_type_t type)
 {
+   efx_nic_cfg_t *encp = >en_nic_cfg;
efx_rx_hash_type_t type_ipv4;
efx_rx_hash_type_t type_ipv4_tcp;
efx_rx_hash_type_t type_ipv6;
efx_rx_hash_type_t type_ipv6_tcp;
+   efx_rx_hash_type_t modes;
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_LEN,
MC_CMD_RSS_CONTEXT_SET_FLAGS_OUT_LEN)];
@@ -366,12 +368,35 @@ efx_mcdi_rss_context_set_flags(
MCDI_IN_SET_DWORD(req, RSS_CONTEXT_SET_FLAGS_IN_RSS_CONTEXT_ID,
rss_context);
 
-   type_ipv4 = EFX_RX_HASH(IPV4, 2TUPLE) | EFX_RX_HASH(IPV4_TCP, 2TUPLE);
+   type_ipv4 = EFX_RX_HASH(IPV4, 2TUPLE) | EFX_RX_HASH(IPV4_TCP, 2TUPLE) |
+   EFX_RX_HASH(IPV4_UDP, 2TUPLE);
type_ipv4_tcp = EFX_RX_HASH(IPV4_TCP, 4TUPLE);
-   type_ipv6 = EFX_RX_HASH(IPV6, 2TUPLE) | EFX_RX_HASH(IPV6_TCP, 2TUPLE);
+   type_ipv6 = EFX_RX_HASH(IPV6, 2TUPLE) | EFX_RX_HASH(IPV6_TCP, 2TUPLE) |
+   EFX_RX_HASH(IPV6_UDP, 2TUPLE);
type_ipv6_tcp = EFX_RX_HASH(IPV6_TCP, 4TUPLE);
 
-   MCDI_IN_POPULATE_DWORD_4(req, RSS_CONTEXT_SET_FLAGS_IN_FLAGS,
+   /*
+* Create a copy of the original hash type.
+* The copy will be used to fill in RSS_MODE bits and
+* may be cleared beforehand. The original variable
+* and, thus, EN bits will remain unaffected.
+*/
+   modes = type;
+
+   /*
+* If the firmware lacks support for additional modes, RSS_MODE
+* fields must contain zeros, otherwise the operation will fail.
+*/
+   if (encp->enc_rx_scale_additional_modes_supported == B_FALSE)
+   modes = 0;
+
+#defineEXTRACT_RSS_MODE(_type, _class) \
+   (EFX_EXTRACT_NATIVE(_type, 0, 31,   \
+   EFX_LOW_BIT(EFX_RX_CLASS_##_class), \
+   EFX_HIGH_BIT(EFX_RX_CLASS_##_class)) &  \
+   EFX_MASK32(EFX_RX_CLASS_##_class))
+
+   MCDI_IN_POPULATE_DWORD_10(req, RSS_CONTEXT_SET_FLAGS_IN_FLAGS,
RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_IPV4_EN,
((type & type_ipv4) == type_ipv4) ? 1 : 0,
RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_TCPV4_EN,
@@ -379,7 +404,21 @@ efx_mcdi_rss_context_set_flags(
RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_IPV6_EN,
((type & type_ipv6) == type_ipv6) ? 1 : 0,
RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_TCPV6_EN,
-   ((type & type_ipv6_tcp) == type_ipv6_tcp) ? 1 : 0);
+   ((type & type_ipv6_tcp) == type_ipv6_tcp) ? 1 : 0,
+   RSS_CONTEXT_SET_FLAGS_IN_TCP_IPV4_RSS_MODE,
+   EXTRACT_RSS_MODE(modes, IPV4_TCP),
+   RSS_CONTEXT_SET_FLAGS_IN_UDP_IPV4_RSS_MODE,
+   EXTRACT_RSS_MODE(modes, IPV4_UDP),
+   RSS_CONTEXT_SET_FLAGS_IN_OTHER_IPV4_RSS_MODE,
+   EXTRACT_RSS_MODE(modes, IPV4),
+   

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:44:09 2018
New Revision: 341197
URL: https://svnweb.freebsd.org/changeset/base/341197

Log:
  sfxge(4): fix comparison always true warning
  
  Loopback type used as bit index has efx_loopback_type_t type
  which is enum. clang complains that it is always true when it
  is compared with qword (64 bit) bits number boundary.
  
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D18228

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

Modified: head/sys/dev/sfxge/common/efx_port.c
==
--- head/sys/dev/sfxge/common/efx_port.cThu Nov 29 06:43:57 2018
(r341196)
+++ head/sys/dev/sfxge/common/efx_port.cThu Nov 29 06:44:09 2018
(r341197)
@@ -149,7 +149,7 @@ efx_port_loopback_set(
EFSYS_ASSERT(link_mode < EFX_LINK_NMODES);
 
if (EFX_TEST_QWORD_BIT(encp->enc_loopback_types[link_mode],
-   loopback_type) == 0) {
+   (int)loopback_type) == 0) {
rc = ENOTSUP;
goto fail1;
}
___
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: r341199 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:44:28 2018
New Revision: 341199
URL: https://svnweb.freebsd.org/changeset/base/341199

Log:
  sfxge(4): add a new means to control RSS hash
  
  Currently, libefx has no support for additional RSS modes
  available with later controllers. In order to support this,
  libefx should be able to list available hash configurations.
  
  This patch provides basic infrastructure for the new interface.
  The client drivers will be able to query the list of supported
  hash configurations for a particular hash algorithm. Also, it
  will be possible to configure hashing by means of new definitions.
  
  Submitted by:   Ivan Malov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18230

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

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Thu Nov 29 06:44:20 2018
(r341198)
+++ head/sys/dev/sfxge/common/ef10_rx.c Thu Nov 29 06:44:28 2018
(r341199)
@@ -325,11 +325,32 @@ efx_mcdi_rss_context_set_flags(
__inuint32_t rss_context,
__inefx_rx_hash_type_t type)
 {
+   efx_rx_hash_type_t type_ipv4;
+   efx_rx_hash_type_t type_ipv4_tcp;
+   efx_rx_hash_type_t type_ipv6;
+   efx_rx_hash_type_t type_ipv6_tcp;
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_LEN,
MC_CMD_RSS_CONTEXT_SET_FLAGS_OUT_LEN)];
efx_rc_t rc;
 
+   EFX_STATIC_ASSERT(EFX_RX_CLASS_IPV4_TCP_LBN ==
+   MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_TCP_IPV4_RSS_MODE_LBN);
+   EFX_STATIC_ASSERT(EFX_RX_CLASS_IPV4_TCP_WIDTH ==
+   MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_TCP_IPV4_RSS_MODE_WIDTH);
+   EFX_STATIC_ASSERT(EFX_RX_CLASS_IPV4_LBN ==
+   MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_OTHER_IPV4_RSS_MODE_LBN);
+   EFX_STATIC_ASSERT(EFX_RX_CLASS_IPV4_WIDTH ==
+   MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_OTHER_IPV4_RSS_MODE_WIDTH);
+   EFX_STATIC_ASSERT(EFX_RX_CLASS_IPV6_TCP_LBN ==
+   MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_TCP_IPV6_RSS_MODE_LBN);
+   EFX_STATIC_ASSERT(EFX_RX_CLASS_IPV6_TCP_WIDTH ==
+   MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_TCP_IPV6_RSS_MODE_WIDTH);
+   EFX_STATIC_ASSERT(EFX_RX_CLASS_IPV6_LBN ==
+   MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_OTHER_IPV6_RSS_MODE_LBN);
+   EFX_STATIC_ASSERT(EFX_RX_CLASS_IPV6_WIDTH ==
+   MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_OTHER_IPV6_RSS_MODE_WIDTH);
+
if (rss_context == EF10_RSS_CONTEXT_INVALID) {
rc = EINVAL;
goto fail1;
@@ -345,15 +366,20 @@ efx_mcdi_rss_context_set_flags(
MCDI_IN_SET_DWORD(req, RSS_CONTEXT_SET_FLAGS_IN_RSS_CONTEXT_ID,
rss_context);
 
+   type_ipv4 = EFX_RX_HASH(IPV4, 2TUPLE) | EFX_RX_HASH(IPV4_TCP, 2TUPLE);
+   type_ipv4_tcp = EFX_RX_HASH(IPV4_TCP, 4TUPLE);
+   type_ipv6 = EFX_RX_HASH(IPV6, 2TUPLE) | EFX_RX_HASH(IPV6_TCP, 2TUPLE);
+   type_ipv6_tcp = EFX_RX_HASH(IPV6_TCP, 4TUPLE);
+
MCDI_IN_POPULATE_DWORD_4(req, RSS_CONTEXT_SET_FLAGS_IN_FLAGS,
RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_IPV4_EN,
-   (type & EFX_RX_HASH_IPV4) ? 1 : 0,
+   ((type & type_ipv4) == type_ipv4) ? 1 : 0,
RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_TCPV4_EN,
-   (type & EFX_RX_HASH_TCPIPV4) ? 1 : 0,
+   ((type & type_ipv4_tcp) == type_ipv4_tcp) ? 1 : 0,
RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_IPV6_EN,
-   (type & EFX_RX_HASH_IPV6) ? 1 : 0,
+   ((type & type_ipv6) == type_ipv6) ? 1 : 0,
RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_TCPV6_EN,
-   (type & EFX_RX_HASH_TCPIPV6) ? 1 : 0);
+   ((type & type_ipv6_tcp) == type_ipv6_tcp) ? 1 : 0);
 
efx_mcdi_execute(enp, );
 

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:44:20 2018
(r341198)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:44:28 2018
(r341199)
@@ -2098,11 +2098,30 @@ typedef enum efx_rx_hash_alg_e {
EFX_RX_HASHALG_TOEPLITZ
 } efx_rx_hash_alg_t;
 
+/*
+ * Legacy hash type flags.
+ *
+ * They represent standard tuples for distinct traffic classes.
+ */
 #defineEFX_RX_HASH_IPV4(1U << 0)
 #defineEFX_RX_HASH_TCPIPV4 (1U << 1)
 #defineEFX_RX_HASH_IPV6(1U << 2)
 #defineEFX_RX_HASH_TCPIPV6 (1U << 3)
 
+#defineEFX_RX_HASH_LEGACY_MASK \
+   (EFX_RX_HASH_IPV4   |   \
+   EFX_RX_HASH_TCPIPV4 |   \
+   EFX_RX_HASH_IPV6|   \
+   EFX_RX_HASH_TCPIPV6)
+
+/*
+ * The type of the argument used by 

svn commit: r341191 - in head/sys/dev/sfxge: . common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:43:00 2018
New Revision: 341191
URL: https://svnweb.freebsd.org/changeset/base/341191

Log:
  sfxge(4): support choosing firmware variant
  
  Submitted by:   Gautam Dawar 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18222

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

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:42:49 2018
(r341190)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:43:00 2018
(r341191)
@@ -157,9 +157,22 @@ efx_nic_create(
__inefsys_lock_t *eslp,
__deref_out efx_nic_t **enpp);
 
+/* EFX_FW_VARIANT codes map one to one on MC_CMD_FW codes */
+typedef enum efx_fw_variant_e {
+   EFX_FW_VARIANT_FULL_FEATURED,
+   EFX_FW_VARIANT_LOW_LATENCY,
+   EFX_FW_VARIANT_PACKED_STREAM,
+   EFX_FW_VARIANT_HIGH_TX_RATE,
+   EFX_FW_VARIANT_PACKED_STREAM_HASH_MODE_1,
+   EFX_FW_VARIANT_RULES_ENGINE,
+   EFX_FW_VARIANT_DPDK,
+   EFX_FW_VARIANT_DONT_CARE = 0x
+} efx_fw_variant_t;
+
 extern __checkReturn   efx_rc_t
 efx_nic_probe(
-   __inefx_nic_t *enp);
+   __inefx_nic_t *enp,
+   __inefx_fw_variant_t efv);
 
 extern __checkReturn   efx_rc_t
 efx_nic_init(

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hThu Nov 29 06:42:49 2018
(r341190)
+++ head/sys/dev/sfxge/common/efx_impl.hThu Nov 29 06:43:00 2018
(r341191)
@@ -675,6 +675,7 @@ struct efx_nic_s {
const efx_ev_ops_t  *en_eevop;
const efx_tx_ops_t  *en_etxop;
const efx_rx_ops_t  *en_erxop;
+   efx_fw_variant_tefv;
 #if EFSYS_OPT_FILTER
efx_filter_ten_filter;
const efx_filter_ops_t  *en_efop;

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cThu Nov 29 06:42:49 2018
(r341190)
+++ head/sys/dev/sfxge/common/efx_mcdi.cThu Nov 29 06:43:00 2018
(r341191)
@@ -1293,13 +1293,19 @@ efx_mcdi_drv_attach(
req.emr_out_length = MC_CMD_DRV_ATTACH_EXT_OUT_LEN;
 
/*
-* Use DONT_CARE for the datapath firmware type to ensure that the
-* driver can attach to an unprivileged function. The datapath firmware
-* type to use is controlled by the 'sfboot' utility.
+* Typically, client drivers use DONT_CARE for the datapath firmware
+* type to ensure that the driver can attach to an unprivileged
+* function. The datapath firmware type to use is controlled by the
+* 'sfboot' utility.
+* If a client driver wishes to attach with a specific datapath firmware
+* type, that can be passed in second argument of efx_nic_probe API. One
+* such example is the ESXi native driver that attempts attaching with
+* FULL_FEATURED datapath firmware type first and fall backs to
+* DONT_CARE datapath firmware type if MC_CMD_DRV_ATTACH fails.
 */
MCDI_IN_SET_DWORD(req, DRV_ATTACH_IN_NEW_STATE, attach ? 1 : 0);
MCDI_IN_SET_DWORD(req, DRV_ATTACH_IN_UPDATE, 1);
-   MCDI_IN_SET_DWORD(req, DRV_ATTACH_IN_FIRMWARE_ID, MC_CMD_FW_DONT_CARE);
+   MCDI_IN_SET_DWORD(req, DRV_ATTACH_IN_FIRMWARE_ID, enp->efv);
 
efx_mcdi_execute(enp, );
 

Modified: head/sys/dev/sfxge/common/efx_nic.c
==
--- head/sys/dev/sfxge/common/efx_nic.c Thu Nov 29 06:42:49 2018
(r341190)
+++ head/sys/dev/sfxge/common/efx_nic.c Thu Nov 29 06:43:00 2018
(r341191)
@@ -319,7 +319,8 @@ fail1:
 
__checkReturn   efx_rc_t
 efx_nic_probe(
-   __inefx_nic_t *enp)
+   __inefx_nic_t *enp,
+   __inefx_fw_variant_t efv)
 {
const efx_nic_ops_t *enop;
efx_rc_t rc;
@@ -330,7 +331,27 @@ efx_nic_probe(
 #endif /* EFSYS_OPT_MCDI */
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_PROBE));
 
+   /* Ensure FW variant codes match with MC_CMD_FW codes */
+   EFX_STATIC_ASSERT(EFX_FW_VARIANT_FULL_FEATURED ==
+   MC_CMD_FW_FULL_FEATURED);
+   EFX_STATIC_ASSERT(EFX_FW_VARIANT_LOW_LATENCY ==
+   MC_CMD_FW_LOW_LATENCY);
+   EFX_STATIC_ASSERT(EFX_FW_VARIANT_PACKED_STREAM ==
+   MC_CMD_FW_PACKED_STREAM);
+   EFX_STATIC_ASSERT(EFX_FW_VARIANT_HIGH_TX_RATE ==
+   MC_CMD_FW_HIGH_TX_RATE);
+   

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:43:23 2018
New Revision: 341193
URL: https://svnweb.freebsd.org/changeset/base/341193

Log:
  sfxge(4): update MCDI headers
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18224

Modified:
  head/sys/dev/sfxge/common/efx_regs_mcdi.h
  head/sys/dev/sfxge/common/efx_regs_mcdi_aoe.h

Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_regs_mcdi.h   Thu Nov 29 06:43:12 2018
(r341192)
+++ head/sys/dev/sfxge/common/efx_regs_mcdi.h   Thu Nov 29 06:43:23 2018
(r341193)
@@ -301,7 +301,8 @@
 #define MC_CMD_ERR_NO_PRIVILEGE 0x1013
 /* Workaround 26807 could not be turned on/off because some functions
  * have already installed filters. See the comment at
- * MC_CMD_WORKAROUND_BUG26807. */
+ * MC_CMD_WORKAROUND_BUG26807.
+ * May also returned for other operations such as sub-variant switching. */
 #define MC_CMD_ERR_FILTERS_PRESENT 0x1014
 /* The clock whose frequency you've attempted to set set
  * doesn't exist on this NIC */
@@ -320,6 +321,10 @@
  * away.  This is distinct from MC_CMD_ERR_DATAPATH_DISABLED in that the
  * datapath absence may be temporary*/
 #define MC_CMD_ERR_NO_DATAPATH 0x1019
+/* The operation could not complete because some VIs are allocated */
+#define MC_CMD_ERR_VIS_PRESENT 0x101a
+/* The operation could not complete because some PIO buffers are allocated */
+#define MC_CMD_ERR_PIOBUFS_PRESENT 0x101b
 
 #define MC_CMD_ERR_CODE_OFST 0
 
@@ -404,7 +409,7 @@
 #defineMCDI_EVENT_LEVEL_LBN 33
 #defineMCDI_EVENT_LEVEL_WIDTH 3
 /* enum: Info. */
-#defineMCDI_EVENT_LEVEL_INFO  0x0
+#defineMCDI_EVENT_LEVEL_INFO 0x0
 /* enum: Warning. */
 #defineMCDI_EVENT_LEVEL_WARN 0x1
 /* enum: Error. */
@@ -424,21 +429,21 @@
 #defineMCDI_EVENT_LINKCHANGE_SPEED_LBN 16
 #defineMCDI_EVENT_LINKCHANGE_SPEED_WIDTH 4
 /* enum: Link is down or link speed could not be determined */
-#defineMCDI_EVENT_LINKCHANGE_SPEED_UNKNOWN  0x0
+#defineMCDI_EVENT_LINKCHANGE_SPEED_UNKNOWN 0x0
 /* enum: 100Mbs */
-#defineMCDI_EVENT_LINKCHANGE_SPEED_100M  0x1
+#defineMCDI_EVENT_LINKCHANGE_SPEED_100M 0x1
 /* enum: 1Gbs */
-#defineMCDI_EVENT_LINKCHANGE_SPEED_1G  0x2
+#defineMCDI_EVENT_LINKCHANGE_SPEED_1G 0x2
 /* enum: 10Gbs */
-#defineMCDI_EVENT_LINKCHANGE_SPEED_10G  0x3
+#defineMCDI_EVENT_LINKCHANGE_SPEED_10G 0x3
 /* enum: 40Gbs */
-#defineMCDI_EVENT_LINKCHANGE_SPEED_40G  0x4
+#defineMCDI_EVENT_LINKCHANGE_SPEED_40G 0x4
 /* enum: 25Gbs */
-#defineMCDI_EVENT_LINKCHANGE_SPEED_25G  0x5
+#defineMCDI_EVENT_LINKCHANGE_SPEED_25G 0x5
 /* enum: 50Gbs */
-#defineMCDI_EVENT_LINKCHANGE_SPEED_50G  0x6
+#defineMCDI_EVENT_LINKCHANGE_SPEED_50G 0x6
 /* enum: 100Gbs */
-#defineMCDI_EVENT_LINKCHANGE_SPEED_100G  0x7
+#defineMCDI_EVENT_LINKCHANGE_SPEED_100G 0x7
 #defineMCDI_EVENT_LINKCHANGE_FCNTL_LBN 20
 #defineMCDI_EVENT_LINKCHANGE_FCNTL_WIDTH 4
 #defineMCDI_EVENT_LINKCHANGE_LINK_FLAGS_LBN 24
@@ -645,23 +650,23 @@
 /* enum: Transmit error */
 #defineMCDI_EVENT_CODE_TX_ERR 0xb
 /* enum: Tx flush has completed */
-#defineMCDI_EVENT_CODE_TX_FLUSH  0xc
+#defineMCDI_EVENT_CODE_TX_FLUSH 0xc
 /* enum: PTP packet received timestamp */
-#defineMCDI_EVENT_CODE_PTP_RX  0xd
+#defineMCDI_EVENT_CODE_PTP_RX 0xd
 /* enum: PTP NIC failure */
-#defineMCDI_EVENT_CODE_PTP_FAULT  0xe
+#defineMCDI_EVENT_CODE_PTP_FAULT 0xe
 /* enum: PTP PPS event */
-#defineMCDI_EVENT_CODE_PTP_PPS  0xf
+#defineMCDI_EVENT_CODE_PTP_PPS 0xf
 /* enum: Rx flush has completed */
-#defineMCDI_EVENT_CODE_RX_FLUSH  0x10
+#defineMCDI_EVENT_CODE_RX_FLUSH 0x10
 /* enum: Receive error */
 #defineMCDI_EVENT_CODE_RX_ERR 0x11
 /* enum: AOE fault */
-#defineMCDI_EVENT_CODE_AOE  0x12
+#defineMCDI_EVENT_CODE_AOE 0x12
 /* enum: Network port calibration failed (VCAL). */
-#defineMCDI_EVENT_CODE_VCAL_FAIL  0x13
+#defineMCDI_EVENT_CODE_VCAL_FAIL 0x13
 /* enum: HW PPS event */
-#defineMCDI_EVENT_CODE_HW_PPS  0x14
+#defineMCDI_EVENT_CODE_HW_PPS 0x14
 /* enum: The MC has rebooted (huntington and later, siena uses CODE_REBOOT and
  * a different format)
  */
@@ -693,7 +698,7 @@
 /* enum: Artificial event generated by host and posted via MC for test
  * purposes.
  */
-#defineMCDI_EVENT_CODE_TESTGEN  0xfa
+#defineMCDI_EVENT_CODE_TESTGEN 0xfa
 #defineMCDI_EVENT_CMDDONE_DATA_OFST 0
 #defineMCDI_EVENT_CMDDONE_DATA_LEN 4
 #defineMCDI_EVENT_CMDDONE_DATA_LBN 0
@@ -823,7 +828,7 @@
 #defineFCDI_EVENT_LEVEL_LBN 33
 #defineFCDI_EVENT_LEVEL_WIDTH 3
 /* enum: Info. */
-#defineFCDI_EVENT_LEVEL_INFO  0x0
+#define  

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:42:38 2018
New Revision: 341189
URL: https://svnweb.freebsd.org/changeset/base/341189

Log:
  sfxge(4): distinguish filters for encapsulated packets
  
  Add filter match flag to distinguish filters applied only to
  encapsulated packets.
  
  Match flags set should allow to determine whether a filter
  is supported or not. The problem is that if specification
  has supported set outer match flags and specified
  encapsulation without any inner flags, check says that it
  is supported, and filter insertion is performed. However,
  there is no filtering of the encapsulated traffic. A new
  flag is added to solve this problem and separate the
  filters for the encapsulated packets.
  
  Submitted by:   Roman Zhukov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18220

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

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:42:26 2018
(r341188)
+++ head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:42:38 2018
(r341189)
@@ -201,6 +201,7 @@ efx_mcdi_filter_op_add(
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_FILTER_OP_EXT_IN_LEN,
MC_CMD_FILTER_OP_EXT_OUT_LEN)];
+   efx_filter_match_flags_t match_flags;
efx_rc_t rc;
 
memset(payload, 0, sizeof (payload));
@@ -210,6 +211,12 @@ efx_mcdi_filter_op_add(
req.emr_out_buf = payload;
req.emr_out_length = MC_CMD_FILTER_OP_EXT_OUT_LEN;
 
+   /*
+* Remove match flag for encapsulated filters that does not correspond
+* to the MCDI match flags
+*/
+   match_flags = spec->efs_match_flags & ~EFX_FILTER_MATCH_ENCAP_TYPE;
+
switch (filter_op) {
case MC_CMD_FILTER_OP_IN_OP_REPLACE:
MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_HANDLE_LO,
@@ -230,7 +237,7 @@ efx_mcdi_filter_op_add(
MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_PORT_ID,
EVB_PORT_ID_ASSIGNED);
MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_MATCH_FIELDS,
-   spec->efs_match_flags);
+   match_flags);
MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_RX_DEST,
MC_CMD_FILTER_OP_EXT_IN_RX_DEST_HOST);
MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_RX_QUEUE,
@@ -1035,13 +1042,17 @@ ef10_filter_supported_filters(
EFX_FILTER_MATCH_IFRM_LOC_MAC |
EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST |
EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST |
+   EFX_FILTER_MATCH_ENCAP_TYPE |
EFX_FILTER_MATCH_UNKNOWN_MCAST_DST |
EFX_FILTER_MATCH_UNKNOWN_UCAST_DST);
 
/*
 * Two calls to MC_CMD_GET_PARSER_DISP_INFO are needed: one to get the
 * list of supported filters for ordinary packets, and then another to
-* get the list of supported filters for encapsulated packets.
+* get the list of supported filters for encapsulated packets. To
+* distinguish the second list from the first, the
+* EFX_FILTER_MATCH_ENCAP_TYPE flag is added to each filter for
+* encapsulated packets.
 */
rc = efx_mcdi_get_parser_disp_info(enp, buffer, buffer_length, B_FALSE,
_list_length);
@@ -1069,6 +1080,10 @@ ef10_filter_supported_filters(
no_space = B_TRUE;
else
goto fail2;
+   } else {
+   for (i = next_buf_idx;
+   i < next_buf_idx + mcdi_encap_list_length; i++)
+   buffer[i] |= EFX_FILTER_MATCH_ENCAP_TYPE;
}
} else {
mcdi_encap_list_length = 0;

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:42:26 2018
(r341188)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:42:38 2018
(r341189)
@@ -2514,6 +2514,11 @@ typedef uint8_t efx_filter_flags_t;
 #defineEFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST 0x0100
 /* For encapsulated packets, match all unicast inner frames */
 #defineEFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST 0x0200
+/*
+ * Match by encap type, this flag does not correspond to
+ * the MCDI match flags and any unoccupied value may be used
+ */
+#defineEFX_FILTER_MATCH_ENCAP_TYPE 0x2000
 /* Match otherwise-unmatched multicast and broadcast packets */
 #defineEFX_FILTER_MATCH_UNKNOWN_MCAST_DST  0x4000
 /* Match otherwise-unmatched unicast packets */

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

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:43:12 2018
New Revision: 341192
URL: https://svnweb.freebsd.org/changeset/base/341192

Log:
  sfxge(4): add values for RxDPCPU firmware id recognition
  
  Submitted by:   Roman Zhukov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18223

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

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:43:00 2018
(r341191)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:43:12 2018
(r341192)
@@ -1322,6 +1322,13 @@ extern   const efx_nic_cfg_t *
 efx_nic_cfg_get(
__inefx_nic_t *enp);
 
+/* RxDPCPU firmware id values by which FW variant can be identified */
+#defineEFX_RXDP_FULL_FEATURED_FW_ID0x0
+#defineEFX_RXDP_LOW_LATENCY_FW_ID  0x1
+#defineEFX_RXDP_PACKED_STREAM_FW_ID0x2
+#defineEFX_RXDP_RULES_ENGINE_FW_ID 0x5
+#defineEFX_RXDP_DPDK_FW_ID 0x6
+
 typedef struct efx_nic_fw_info_s {
/* Basic FW version information */
uint16_tenfi_mc_fw_version[4];

Modified: head/sys/dev/sfxge/common/efx_nic.c
==
--- head/sys/dev/sfxge/common/efx_nic.c Thu Nov 29 06:43:00 2018
(r341191)
+++ head/sys/dev/sfxge/common/efx_nic.c Thu Nov 29 06:43:12 2018
(r341192)
@@ -636,6 +636,18 @@ efx_nic_get_fw_version(
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_MCDI);
EFSYS_ASSERT3U(enp->en_features, &, EFX_FEATURE_MCDI);
 
+   /* Ensure RXDP_FW_ID codes match with MC_CMD_GET_CAPABILITIES codes */
+   EFX_STATIC_ASSERT(EFX_RXDP_FULL_FEATURED_FW_ID ==
+   MC_CMD_GET_CAPABILITIES_OUT_RXDP);
+   EFX_STATIC_ASSERT(EFX_RXDP_LOW_LATENCY_FW_ID ==
+   MC_CMD_GET_CAPABILITIES_OUT_RXDP_LOW_LATENCY);
+   EFX_STATIC_ASSERT(EFX_RXDP_PACKED_STREAM_FW_ID ==
+   MC_CMD_GET_CAPABILITIES_OUT_RXDP_PACKED_STREAM);
+   EFX_STATIC_ASSERT(EFX_RXDP_RULES_ENGINE_FW_ID ==
+   MC_CMD_GET_CAPABILITIES_OUT_RXDP_RULES_ENGINE);
+   EFX_STATIC_ASSERT(EFX_RXDP_DPDK_FW_ID ==
+   MC_CMD_GET_CAPABILITIES_OUT_RXDP_DPDK);
+
rc = efx_mcdi_version(enp, mc_fw_version, NULL, NULL);
if (rc != 0)
goto fail2;
___
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: r341188 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:42:26 2018
New Revision: 341188
URL: https://svnweb.freebsd.org/changeset/base/341188

Log:
  sfxge(4): support VXLAN filter creation
  
  Submitted by:   Vijay Srivastava 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18219

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

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:42:15 2018
(r341187)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:42:26 2018
(r341188)
@@ -2653,6 +2653,13 @@ efx_filter_spec_set_encap_type(
__inefx_tunnel_protocol_t encap_type,
__inefx_filter_inner_frame_match_t inner_frame_match);
 
+extern __checkReturn   efx_rc_t
+efx_filter_spec_set_vxlan_full(
+   __inout efx_filter_spec_t *spec,
+   __inconst uint8_t *vxlan_id,
+   __inconst uint8_t *inner_addr,
+   __inconst uint8_t *outer_addr);
+
 #if EFSYS_OPT_RX_SCALE
 extern __checkReturn   efx_rc_t
 efx_filter_spec_set_rss_context(

Modified: head/sys/dev/sfxge/common/efx_filter.c
==
--- head/sys/dev/sfxge/common/efx_filter.c  Thu Nov 29 06:42:15 2018
(r341187)
+++ head/sys/dev/sfxge/common/efx_filter.c  Thu Nov 29 06:42:26 2018
(r341188)
@@ -497,6 +497,42 @@ fail1:
return (rc);
 }
 
+/*
+ * Specify inner and outer Ethernet address and VXLAN ID in filter
+ * specification.
+ */
+   __checkReturn   efx_rc_t
+efx_filter_spec_set_vxlan_full(
+   __inout efx_filter_spec_t *spec,
+   __inconst uint8_t *vxlan_id,
+   __inconst uint8_t *inner_addr,
+   __inconst uint8_t *outer_addr)
+{
+   EFSYS_ASSERT3P(spec, !=, NULL);
+   EFSYS_ASSERT3P(vxlan_id, !=, NULL);
+   EFSYS_ASSERT3P(inner_addr, !=, NULL);
+   EFSYS_ASSERT3P(outer_addr, !=, NULL);
+
+   if ((inner_addr == NULL) && (outer_addr == NULL))
+   return (EINVAL);
+
+   if (vxlan_id != NULL) {
+   spec->efs_match_flags |= EFX_FILTER_MATCH_VNI_OR_VSID;
+   memcpy(spec->efs_vni_or_vsid, vxlan_id, EFX_VNI_OR_VSID_LEN);
+   }
+   if (outer_addr != NULL) {
+   spec->efs_match_flags |= EFX_FILTER_MATCH_LOC_MAC;
+   memcpy(spec->efs_loc_mac, outer_addr, EFX_MAC_ADDR_LEN);
+   }
+   if (inner_addr != NULL) {
+   spec->efs_match_flags |= EFX_FILTER_MATCH_IFRM_LOC_MAC;
+   memcpy(spec->efs_ifrm_loc_mac, inner_addr, EFX_MAC_ADDR_LEN);
+   }
+   spec->efs_encap_type = EFX_TUNNEL_PROTOCOL_VXLAN;
+
+   return (0);
+}
+
 #if EFSYS_OPT_RX_SCALE
__checkReturn   efx_rc_t
 efx_filter_spec_set_rss_context(
___
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: r341190 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:42:49 2018
New Revision: 341190
URL: https://svnweb.freebsd.org/changeset/base/341190

Log:
  sfxge(4): support drop filters on EF10 family NICs
  
  Add support for filters which drop packets when forming MCDI request
  for a filter.
  
  Submitted by:   Roman Zhukov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18221

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

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:42:38 2018
(r341189)
+++ head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:42:49 2018
(r341190)
@@ -238,10 +238,15 @@ efx_mcdi_filter_op_add(
EVB_PORT_ID_ASSIGNED);
MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_MATCH_FIELDS,
match_flags);
-   MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_RX_DEST,
-   MC_CMD_FILTER_OP_EXT_IN_RX_DEST_HOST);
-   MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_RX_QUEUE,
-   spec->efs_dmaq_id);
+   if (spec->efs_dmaq_id == EFX_FILTER_SPEC_RX_DMAQ_ID_DROP) {
+   MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_RX_DEST,
+   MC_CMD_FILTER_OP_EXT_IN_RX_DEST_DROP);
+   } else {
+   MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_RX_DEST,
+   MC_CMD_FILTER_OP_EXT_IN_RX_DEST_HOST);
+   MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_RX_QUEUE,
+   spec->efs_dmaq_id);
+   }
 
 #if EFSYS_OPT_RX_SCALE
if (spec->efs_flags & EFX_FILTER_FLAG_RX_RSS) {
___
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: r341187 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:42:15 2018
New Revision: 341187
URL: https://svnweb.freebsd.org/changeset/base/341187

Log:
  sfxge(4): support VNI/VSID and inner frame local MAC
  
  This supports VNI/VSID and inner frame local MAC fields to
  match in VXLAN, GENEVE, or NVGRE packets.
  
  Submitted by:   Roman Zhukov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18218

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

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:42:04 2018
(r341186)
+++ head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:42:15 2018
(r341187)
@@ -146,6 +146,10 @@ ef10_filter_init(
MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_OUTER_VLAN));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IP_PROTO ==
MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IP_PROTO));
+   EFX_STATIC_ASSERT(EFX_FILTER_MATCH_VNI_OR_VSID ==
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_VNI_OR_VSID));
+   EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IFRM_LOC_MAC ==
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IFRM_DST_MAC));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST ==
MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IFRM_UNKNOWN_MCAST_DST));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST ==
@@ -319,6 +323,12 @@ efx_mcdi_filter_op_add(
rc = EINVAL;
goto fail2;
}
+
+   memcpy(MCDI_IN2(req, uint8_t, FILTER_OP_EXT_IN_VNI_OR_VSID),
+   spec->efs_vni_or_vsid, EFX_VNI_OR_VSID_LEN);
+
+   memcpy(MCDI_IN2(req, uint8_t, FILTER_OP_EXT_IN_IFRM_DST_MAC),
+   spec->efs_ifrm_loc_mac, EFX_MAC_ADDR_LEN);
}
 
efx_mcdi_execute(enp, );
@@ -442,6 +452,12 @@ ef10_filter_equal(
return (B_FALSE);
if (left->efs_encap_type != right->efs_encap_type)
return (B_FALSE);
+   if (memcmp(left->efs_vni_or_vsid, right->efs_vni_or_vsid,
+   EFX_VNI_OR_VSID_LEN))
+   return (B_FALSE);
+   if (memcmp(left->efs_ifrm_loc_mac, right->efs_ifrm_loc_mac,
+   EFX_MAC_ADDR_LEN))
+   return (B_FALSE);
 
return (B_TRUE);
 
@@ -1015,6 +1031,8 @@ ef10_filter_supported_filters(
EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_PORT |
EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_INNER_VID |
EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_IP_PROTO |
+   EFX_FILTER_MATCH_VNI_OR_VSID |
+   EFX_FILTER_MATCH_IFRM_LOC_MAC |
EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST |
EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST |
EFX_FILTER_MATCH_UNKNOWN_MCAST_DST |

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:42:04 2018
(r341186)
+++ head/sys/dev/sfxge/common/efx.h Thu Nov 29 06:42:15 2018
(r341187)
@@ -482,6 +482,8 @@ typedef enum efx_link_mode_e {
 
 #defineEFX_MAC_ADDR_LEN 6
 
+#defineEFX_VNI_OR_VSID_LEN 3
+
 #defineEFX_MAC_ADDR_IS_MULTICAST(_address) (((uint8_t *)_address)[0] & 
0x01)
 
 #defineEFX_MAC_MULTICAST_LIST_MAX  256
@@ -2504,6 +2506,10 @@ typedef uint8_t efx_filter_flags_t;
 #defineEFX_FILTER_MATCH_OUTER_VID  0x0100
 /* Match by IP transport protocol */
 #defineEFX_FILTER_MATCH_IP_PROTO   0x0200
+/* Match by VNI or VSID */
+#defineEFX_FILTER_MATCH_VNI_OR_VSID0x0800
+/* For encapsulated packets, match by inner frame local MAC address */
+#defineEFX_FILTER_MATCH_IFRM_LOC_MAC   0x0001
 /* For encapsulated packets, match all multicast inner frames */
 #defineEFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST 0x0100
 /* For encapsulated packets, match all unicast inner frames */
@@ -2550,6 +2556,8 @@ typedef struct efx_filter_spec_s {
uint16_tefs_rem_port;
efx_oword_t efs_rem_host;
efx_oword_t efs_loc_host;
+   uint8_t efs_vni_or_vsid[EFX_VNI_OR_VSID_LEN];
+   uint8_t efs_ifrm_loc_mac[EFX_MAC_ADDR_LEN];
 } efx_filter_spec_t;
 
 
___
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: r341186 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:42:04 2018
New Revision: 341186
URL: https://svnweb.freebsd.org/changeset/base/341186

Log:
  sfxge(4): support filters for encapsulated packets
  
  This adds filters for encapsulated packets to the list
  returned by ef10_filter_supported_filters().
  
  Submitted by:   Roman Zhukov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18217

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

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:41:53 2018
(r341185)
+++ head/sys/dev/sfxge/common/ef10_filter.c Thu Nov 29 06:42:04 2018
(r341186)
@@ -922,6 +922,7 @@ efx_mcdi_get_parser_disp_info(
__inefx_nic_t *enp,
__out_ecount(buffer_length) uint32_t *buffer,
__insize_t buffer_length,
+   __inboolean_t encap,
__out   size_t *list_lengthp)
 {
efx_mcdi_req_t req;
@@ -938,7 +939,8 @@ efx_mcdi_get_parser_disp_info(
req.emr_out_buf = payload;
req.emr_out_length = MC_CMD_GET_PARSER_DISP_INFO_OUT_LENMAX;
 
-   MCDI_IN_SET_DWORD(req, GET_PARSER_DISP_INFO_OUT_OP,
+   MCDI_IN_SET_DWORD(req, GET_PARSER_DISP_INFO_OUT_OP, encap ?
+   MC_CMD_GET_PARSER_DISP_INFO_IN_OP_GET_SUPPORTED_ENCAP_RX_MATCHES :
MC_CMD_GET_PARSER_DISP_INFO_IN_OP_GET_SUPPORTED_RX_MATCHES);
 
efx_mcdi_execute(enp, );
@@ -998,30 +1000,68 @@ ef10_filter_supported_filters(
__insize_t buffer_length,
__out   size_t *list_lengthp)
 {
-
+   efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
size_t mcdi_list_length;
+   size_t mcdi_encap_list_length;
size_t list_length;
uint32_t i;
+   uint32_t next_buf_idx;
+   size_t next_buf_length;
efx_rc_t rc;
+   boolean_t no_space = B_FALSE;
efx_filter_match_flags_t all_filter_flags =
(EFX_FILTER_MATCH_REM_HOST | EFX_FILTER_MATCH_LOC_HOST |
EFX_FILTER_MATCH_REM_MAC | EFX_FILTER_MATCH_REM_PORT |
EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_LOC_PORT |
EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_INNER_VID |
EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_IP_PROTO |
+   EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST |
+   EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST |
EFX_FILTER_MATCH_UNKNOWN_MCAST_DST |
EFX_FILTER_MATCH_UNKNOWN_UCAST_DST);
 
-   rc = efx_mcdi_get_parser_disp_info(enp, buffer, buffer_length,
-   _list_length);
+   /*
+* Two calls to MC_CMD_GET_PARSER_DISP_INFO are needed: one to get the
+* list of supported filters for ordinary packets, and then another to
+* get the list of supported filters for encapsulated packets.
+*/
+   rc = efx_mcdi_get_parser_disp_info(enp, buffer, buffer_length, B_FALSE,
+   _list_length);
if (rc != 0) {
-   if (rc == ENOSPC) {
-   /* Pass through mcdi_list_length for the list length */
-   *list_lengthp = mcdi_list_length;
+   if (rc == ENOSPC)
+   no_space = B_TRUE;
+   else
+   goto fail1;
+   }
+
+   if (no_space) {
+   next_buf_idx = 0;
+   next_buf_length = 0;
+   } else {
+   EFSYS_ASSERT(mcdi_list_length <= buffer_length);
+   next_buf_idx = mcdi_list_length;
+   next_buf_length = buffer_length - mcdi_list_length;
+   }
+
+   if (encp->enc_tunnel_encapsulations_supported != 0) {
+   rc = efx_mcdi_get_parser_disp_info(enp, [next_buf_idx],
+   next_buf_length, B_TRUE, _encap_list_length);
+   if (rc != 0) {
+   if (rc == ENOSPC)
+   no_space = B_TRUE;
+   else
+   goto fail2;
}
-   goto fail1;
+   } else {
+   mcdi_encap_list_length = 0;
}
 
+   if (no_space) {
+   *list_lengthp = mcdi_list_length + mcdi_encap_list_length;
+   rc = ENOSPC;
+   goto fail3;
+   }
+
/*
 * The static assertions in ef10_filter_init() ensure that the values of
 * the EFX_FILTER_MATCH flags match those used by MCDI, so they don't
@@ -1032,9 +1072,10 @@ ef10_filter_supported_filters(
 * of the matches is preserved as they are ordered from highest to
 * lowest priority.
 */
-   EFSYS_ASSERT(mcdi_list_length <= buffer_length);
+   EFSYS_ASSERT(mcdi_list_length + 

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:41:53 2018
New Revision: 341185
URL: https://svnweb.freebsd.org/changeset/base/341185

Log:
  sfxge(4): sync MCDI headers and TLV layout
  
  Regenerate MCDI and TLV layout headers from firmwaresrc to
  pick up DPDK firmware variant and related Rx queue and filtering
  extensions.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18216

Modified:
  head/sys/dev/sfxge/common/ef10_tlv_layout.h
  head/sys/dev/sfxge/common/efx_regs_mcdi.h

Modified: head/sys/dev/sfxge/common/ef10_tlv_layout.h
==
--- head/sys/dev/sfxge/common/ef10_tlv_layout.h Thu Nov 29 06:41:41 2018
(r341184)
+++ head/sys/dev/sfxge/common/ef10_tlv_layout.h Thu Nov 29 06:41:53 2018
(r341185)
@@ -434,6 +434,7 @@ struct tlv_firmware_options {
 #define TLV_FIRMWARE_VARIANT_PACKED_STREAM_HASH_MODE_1 \
  
MC_CMD_FW_PACKED_STREAM_HASH_MODE_1
 #define TLV_FIRMWARE_VARIANT_RULES_ENGINEMC_CMD_FW_RULES_ENGINE
+#define TLV_FIRMWARE_VARIANT_DPDKMC_CMD_FW_DPDK
 };
 
 /* Voltage settings
@@ -562,6 +563,17 @@ struct tlv_global_port_mode {
   uint32_t length;
   uint32_t port_mode;
 #define TLV_PORT_MODE_DEFAULT   (0x) /* Default for given 
platform */
+
+/* Huntington port modes */
+#define TLV_PORT_MODE_10G(0)
+#define TLV_PORT_MODE_40G(1)
+#define TLV_PORT_MODE_10G_10G(2)
+#define TLV_PORT_MODE_40G_40G(3)
+#define TLV_PORT_MODE_10G_10G_10G_10G(4)
+#define TLV_PORT_MODE_40G_10G_10G(6)
+#define TLV_PORT_MODE_10G_10G_40G(7)
+
+/* Medford (and later) port modes */
 #define TLV_PORT_MODE_1x1_NA (0) /* Single 10G/25G on mdi0 
*/
 #define TLV_PORT_MODE_1x4_NA (1) /* Single 100G/40G on 
mdi0 */
 #define TLV_PORT_MODE_NA_1x4 (22) /* Single 100G/40G on 
mdi1 */
@@ -569,8 +581,8 @@ struct tlv_global_port_mode {
 #define TLV_PORT_MODE_NA_1x2 (11) /* Single 50G on mdi1 */
 #define TLV_PORT_MODE_1x1_1x1(2) /* Single 10G/25G on 
mdi0, single 10G/25G on mdi1 */
 #define TLV_PORT_MODE_1x4_1x4(3) /* Single 40G on mdi0, 
single 40G on mdi1 */
-#define TLV_PORT_MODE_2x1_2x1(4) /* Dual 10G/25G on mdi0, 
dual 10G/25G on mdi1 - WARNING: bug3720: On Newport only, this is actually Quad 
10G on mdi0 */
-#define TLV_PORT_MODE_4x1_NA (5) /* Quad 10G/25G on mdi0 */
+#define TLV_PORT_MODE_2x1_2x1(5) /* Dual 10G/25G on mdi0, 
dual 10G/25G on mdi1 */
+#define TLV_PORT_MODE_4x1_NA (4) /* Quad 10G/25G on mdi0 */
 #define TLV_PORT_MODE_NA_4x1 (8) /* Quad 10G/25G on mdi1 */
 #define TLV_PORT_MODE_1x4_2x1(6) /* Single 40G on mdi0, 
dual 10G/25G on mdi1 */
 #define TLV_PORT_MODE_2x1_1x4(7) /* Dual 10G/25G on mdi0, 
single 40G on mdi1 */
@@ -581,7 +593,13 @@ struct tlv_global_port_mode {
 #define TLV_PORT_MODE_1x2_1x4(16) /* Single 50G on mdi0, 
single 40G on mdi1 */
 #define TLV_PORT_MODE_1x2_2x1(17) /* Single 50G on mdi0, 
dual 10G/25G on mdi1 */
 #define TLV_PORT_MODE_2x1_1x2(18) /* Dual 10G/25G on mdi0, 
single 50G on mdi1 */
-/* Below modes are eftest only, to allow snapper explicit selection between 
multi-channel and LLPCS. In production, this selection is automatic and outside 
world should not care about LLPCS */
+
+/* Snapper-only Medford2 port modes.
+ * These modes are eftest only, to allow snapper explicit
+ * selection between multi-channel and LLPCS. In production,
+ * this selection is automatic and outside world should not
+ * care about LLPCS.
+ */
 #define TLV_PORT_MODE_2x1_2x1_LL (19) /* Dual 10G/25G on mdi0, 
dual 10G/25G on mdi1, low-latency PCS */
 #define TLV_PORT_MODE_4x1_NA_LL  (20) /* Quad 10G/25G on mdi0, 
low-latency PCS */
 #define TLV_PORT_MODE_NA_4x1_LL  (21) /* Quad 10G/25G on mdi1, 
low-latency PCS */
@@ -590,42 +608,13 @@ struct tlv_global_port_mode {
 #define TLV_PORT_MODE_BUG63720_DO_NOT_USE(9) /* bug63720: Do not use */
 #define TLV_PORT_MODE_MAX TLV_PORT_MODE_1x1_1x1_LL
 
-/* Deprecated aliases */
-#define TLV_PORT_MODE_10GTLV_PORT_MODE_1x1_NA
-#define TLV_PORT_MODE_40GTLV_PORT_MODE_1x4_NA
-#define TLV_PORT_MODE_10G_10GTLV_PORT_MODE_1x1_1x1
-#define TLV_PORT_MODE_40G_40GTLV_PORT_MODE_1x4_1x4
-#define TLV_PORT_MODE_10G_10G_10G_10GTLV_PORT_MODE_2x1_2x1
-#define TLV_PORT_MODE_10G_10G_10G_10G_Q1 TLV_PORT_MODE_2x1_2x1 /* 
bug63720: Do not use */
-#define TLV_PORT_MODE_10G_10G_10G_10G_Q  

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:41:41 2018
New Revision: 341184
URL: https://svnweb.freebsd.org/changeset/base/341184

Log:
  sfxge(4): add signed image layout support
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18215

Modified:
  head/sys/dev/sfxge/common/ef10_image.c   (contents, props changed)
  head/sys/dev/sfxge/common/efx.h

Modified: head/sys/dev/sfxge/common/ef10_image.c
==
--- head/sys/dev/sfxge/common/ef10_image.c  Thu Nov 29 06:29:24 2018
(r341183)
+++ head/sys/dev/sfxge/common/ef10_image.c  Thu Nov 29 06:41:41 2018
(r341184)
@@ -40,7 +40,873 @@ __FBSDID("$FreeBSD$");
 
 #if EFSYS_OPT_IMAGE_LAYOUT
 
-#include "ef10_signed_image_layout.h"
+/*
+ * Utility routines to support limited parsing of ASN.1 tags. This is not a
+ * general purpose ASN.1 parser, but is sufficient to locate the required
+ * objects in a signed image with CMS headers.
+ */
+
+/* DER encodings for ASN.1 tags (see ITU-T X.690) */
+#defineASN1_TAG_INTEGER(0x02)
+#defineASN1_TAG_OCTET_STRING   (0x04)
+#defineASN1_TAG_OBJ_ID (0x06)
+#defineASN1_TAG_SEQUENCE   (0x30)
+#defineASN1_TAG_SET(0x31)
+
+#defineASN1_TAG_IS_PRIM(tag)   ((tag & 0x20) == 0)
+
+#defineASN1_TAG_PRIM_CONTEXT(n)(0x80 + (n))
+#defineASN1_TAG_CONS_CONTEXT(n)(0xA0 + (n))
+
+typedef struct efx_asn1_cursor_s {
+   uint8_t *buffer;
+   uint32_tlength;
+
+   uint8_t tag;
+   uint32_thdr_size;
+   uint32_tval_size;
+} efx_asn1_cursor_t;
+
+
+/* Parse header of DER encoded ASN.1 TLV and match tag */
+static __checkReturn   efx_rc_t
+efx_asn1_parse_header_match_tag(
+   __inout efx_asn1_cursor_t   *cursor,
+   __inuint8_t tag)
+{
+   efx_rc_t rc;
+
+   if (cursor == NULL || cursor->buffer == NULL || cursor->length < 2) {
+   rc = EINVAL;
+   goto fail1;
+   }
+
+   cursor->tag = cursor->buffer[0];
+   if (cursor->tag != tag) {
+   /* Tag not matched */
+   rc = ENOENT;
+   goto fail2;
+   }
+
+   if ((cursor->tag & 0x1F) == 0x1F) {
+   /* Long tag format not used in CMS syntax */
+   rc = EINVAL;
+   goto fail3;
+   }
+
+   if ((cursor->buffer[1] & 0x80) == 0) {
+   /* Short form: length is 0..127 */
+   cursor->hdr_size = 2;
+   cursor->val_size = cursor->buffer[1];
+   } else {
+   /* Long form: length encoded as [0x80+nbytes][length bytes] */
+   uint32_t nbytes = cursor->buffer[1] & 0x7F;
+   uint32_t offset;
+
+   if (nbytes == 0) {
+   /* Indefinite length not allowed in DER encoding */
+   rc = EINVAL;
+   goto fail4;
+   }
+   if (2 + nbytes > cursor->length) {
+   /* Header length overflows image buffer */
+   rc = EINVAL;
+   goto fail6;
+   }
+   if (nbytes > sizeof (uint32_t)) {
+   /* Length encoding too big */
+   rc = E2BIG;
+   goto fail5;
+   }
+   cursor->hdr_size = 2 + nbytes;
+   cursor->val_size = 0;
+   for (offset = 2; offset < cursor->hdr_size; offset++) {
+   cursor->val_size =
+   (cursor->val_size << 8) | cursor->buffer[offset];
+   }
+   }
+
+   if ((cursor->hdr_size + cursor->val_size) > cursor->length) {
+   /* Length overflows image buffer */
+   rc = E2BIG;
+   goto fail7;
+   }
+
+   return (0);
+
+fail7:
+   EFSYS_PROBE(fail7);
+fail6:
+   EFSYS_PROBE(fail6);
+fail5:
+   EFSYS_PROBE(fail5);
+fail4:
+   EFSYS_PROBE(fail4);
+fail3:
+   EFSYS_PROBE(fail3);
+fail2:
+   EFSYS_PROBE(fail2);
+fail1:
+   EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+   return (rc);
+}
+
+/* Enter nested ASN.1 TLV (contained in value of current TLV) */
+static __checkReturn   efx_rc_t
+efx_asn1_enter_tag(
+   __inout efx_asn1_cursor_t   *cursor,
+   __inuint8_t tag)
+{
+   efx_rc_t rc;
+
+   if (cursor == NULL) {
+   rc = EINVAL;
+   goto fail1;
+   }
+
+   if (ASN1_TAG_IS_PRIM(tag)) {
+   /* Cannot enter a primitive tag */
+   rc = ENOTSUP;
+   goto fail2;
+   }
+   rc = efx_asn1_parse_header_match_tag(cursor, tag);
+   if (rc != 0) {
+   /* Invalid TLV or wrong tag */
+

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Nov 29 06:29:24 2018
New Revision: 341183
URL: https://svnweb.freebsd.org/changeset/base/341183

Log:
  sfxge(4): add firmware image layout option
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18214

Added:
  head/sys/dev/sfxge/common/ef10_image.c   (contents, props changed)
  head/sys/dev/sfxge/common/ef10_signed_image_layout.h   (contents, props 
changed)
Modified:
  head/sys/conf/files.amd64
  head/sys/dev/sfxge/common/efsys.h
  head/sys/dev/sfxge/common/efx_check.h
  head/sys/modules/sfxge/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Thu Nov 29 05:17:16 2018(r341182)
+++ head/sys/conf/files.amd64   Thu Nov 29 06:29:24 2018(r341183)
@@ -413,6 +413,7 @@ dev/qlnx/qlnxe/qlnx_os.coptionalqlnxe pci \
compile-with "${LINUXKPI_C}"
 dev/sfxge/common/ef10_ev.c optionalsfxge pci
 dev/sfxge/common/ef10_filter.c optionalsfxge pci
+dev/sfxge/common/ef10_image.c  optionalsfxge pci
 dev/sfxge/common/ef10_intr.c   optionalsfxge pci
 dev/sfxge/common/ef10_mac.coptionalsfxge pci
 dev/sfxge/common/ef10_mcdi.c   optionalsfxge pci

Added: head/sys/dev/sfxge/common/ef10_image.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/sfxge/common/ef10_image.c  Thu Nov 29 06:29:24 2018
(r341183)
@@ -0,0 +1,49 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2017-2018 Solarflare Communications Inc.
+ * 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.
+ *
+ * The views and conclusions contained in the software and documentation are
+ * those of the authors and should not be interpreted as representing official
+ * policies, either expressed or implied, of the FreeBSD Project.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "efx.h"
+#include "efx_impl.h"
+
+#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
+
+#if EFSYS_OPT_IMAGE_LAYOUT
+
+#include "ef10_signed_image_layout.h"
+
+
+
+#endif /* EFSYS_OPT_IMAGE_LAYOUT */
+
+#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */

Added: head/sys/dev/sfxge/common/ef10_signed_image_layout.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/sfxge/common/ef10_signed_image_layout.hThu Nov 29 
06:29:24 2018(r341183)
@@ -0,0 +1,104 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2016-2018 Solarflare Communications Inc.
+ * 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 

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

2018-11-28 Thread Mateusz Guzik
Author: mjg
Date: Thu Nov 29 05:08:46 2018
New Revision: 341181
URL: https://svnweb.freebsd.org/changeset/base/341181

Log:
  Deinline racct throttling out of syscall exit path.
  
  racct is not enabled by default and even when it is enabled processes are
  typically not throttled. The order of checks is left unchanged since
  racct_enable will be annotated as __read_frequently, while checking for the
  flag in the processes would probably require an extra fetch.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_racct.c
  head/sys/kern/subr_trap.c
  head/sys/sys/racct.h

Modified: head/sys/kern/kern_racct.c
==
--- head/sys/kern/kern_racct.c  Thu Nov 29 04:48:22 2018(r341180)
+++ head/sys/kern/kern_racct.c  Thu Nov 29 05:08:46 2018(r341181)
@@ -1087,6 +1087,22 @@ racct_move(struct racct *dest, struct racct *src)
RACCT_UNLOCK();
 }
 
+void
+racct_proc_throttled(struct proc *p)
+{
+
+   ASSERT_RACCT_ENABLED();
+
+   PROC_LOCK(p);
+   while (p->p_throttled != 0) {
+   msleep(p->p_racct, >p_mtx, 0, "racct",
+   p->p_throttled < 0 ? 0 : p->p_throttled);
+   if (p->p_throttled > 0)
+   p->p_throttled = 0;
+   }
+   PROC_UNLOCK(p);
+}
+
 /*
  * Make the process sleep in userret() for 'timeout' ticks.  Setting
  * timeout to -1 makes it sleep until woken up by racct_proc_wakeup().

Modified: head/sys/kern/subr_trap.c
==
--- head/sys/kern/subr_trap.c   Thu Nov 29 04:48:22 2018(r341180)
+++ head/sys/kern/subr_trap.c   Thu Nov 29 05:08:46 2018(r341181)
@@ -198,16 +198,8 @@ userret(struct thread *td, struct trapframe *frame)
(td->td_vnet_lpush != NULL) ? td->td_vnet_lpush : "N/A"));
 #endif
 #ifdef RACCT
-   if (racct_enable && p->p_throttled != 0) {
-   PROC_LOCK(p);
-   while (p->p_throttled != 0) {
-   msleep(p->p_racct, >p_mtx, 0, "racct",
-   p->p_throttled < 0 ? 0 : p->p_throttled);
-   if (p->p_throttled > 0)
-   p->p_throttled = 0;
-   }
-   PROC_UNLOCK(p);
-   }
+   if (__predict_false(racct_enable && p->p_throttled != 0))
+   racct_proc_throttled(p);
 #endif
 }
 

Modified: head/sys/sys/racct.h
==
--- head/sys/sys/racct.hThu Nov 29 04:48:22 2018(r341180)
+++ head/sys/sys/racct.hThu Nov 29 05:08:46 2018(r341181)
@@ -194,6 +194,7 @@ voidracct_proc_exit(struct proc *p);
 void   racct_proc_ucred_changed(struct proc *p, struct ucred *oldcred,
struct ucred *newcred);
 void   racct_move(struct racct *dest, struct racct *src);
+void   racct_proc_throttled(struct proc *p);
 void   racct_proc_throttle(struct proc *p, int timeout);
 
 #else
___
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: r341182 - in head/sys: kern sys

2018-11-28 Thread Mateusz Guzik
Author: mjg
Date: Thu Nov 29 05:17:16 2018
New Revision: 341182
URL: https://svnweb.freebsd.org/changeset/base/341182

Log:
  Convert racct_enable to bool and annotate as __read_frequently
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_racct.c
  head/sys/sys/racct.h

Modified: head/sys/kern/kern_racct.c
==
--- head/sys/kern/kern_racct.c  Thu Nov 29 05:08:46 2018(r341181)
+++ head/sys/kern/kern_racct.c  Thu Nov 29 05:17:16 2018(r341182)
@@ -74,13 +74,13 @@ FEATURE(racct, "Resource Accounting");
  */
 static int pcpu_threshold = 1;
 #ifdef RACCT_DEFAULT_TO_DISABLED
-int racct_enable = 0;
+bool __read_frequently racct_enable = false;
 #else
-int racct_enable = 1;
+bool __read_frequently racct_enable = true;
 #endif
 
 SYSCTL_NODE(_kern, OID_AUTO, racct, CTLFLAG_RW, 0, "Resource Accounting");
-SYSCTL_UINT(_kern_racct, OID_AUTO, enable, CTLFLAG_RDTUN, _enable,
+SYSCTL_BOOL(_kern_racct, OID_AUTO, enable, CTLFLAG_RDTUN, _enable,
 0, "Enable RACCT/RCTL");
 SYSCTL_UINT(_kern_racct, OID_AUTO, pcpu_threshold, CTLFLAG_RW, _threshold,
 0, "Processes with higher %cpu usage than this value can be throttled.");

Modified: head/sys/sys/racct.h
==
--- head/sys/sys/racct.hThu Nov 29 05:08:46 2018(r341181)
+++ head/sys/sys/racct.hThu Nov 29 05:17:16 2018(r341182)
@@ -91,7 +91,7 @@ struct ucred;
 #defineRACCT_DECAYING  0x20
 
 extern int racct_types[];
-extern int racct_enable;
+extern bool racct_enable;
 
 #define ASSERT_RACCT_ENABLED() KASSERT(racct_enable, \
("%s called with !racct_enable", __func__))
___
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: r341180 - head/sys/kern

2018-11-28 Thread Mateusz Guzik
Author: mjg
Date: Thu Nov 29 04:48:22 2018
New Revision: 341180
URL: https://svnweb.freebsd.org/changeset/base/341180

Log:
  Annotate td_cowgen check as unlikely.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/subr_syscall.c

Modified: head/sys/kern/subr_syscall.c
==
--- head/sys/kern/subr_syscall.cThu Nov 29 03:57:06 2018
(r341179)
+++ head/sys/kern/subr_syscall.cThu Nov 29 04:48:22 2018
(r341180)
@@ -66,7 +66,7 @@ syscallenter(struct thread *td)
sa = >td_sa;
 
td->td_pticks = 0;
-   if (td->td_cowgen != p->p_cowgen)
+   if (__predict_false(td->td_cowgen != p->p_cowgen))
thread_cow_update(td);
traced = (p->p_flag & P_TRACED) != 0;
if (traced || td->td_dbgflags & TDB_USERWR) {
___
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: r341179 - head/usr.bin/truss

2018-11-28 Thread Justin Hibbits
Author: jhibbits
Date: Thu Nov 29 03:57:06 2018
New Revision: 341179
URL: https://svnweb.freebsd.org/changeset/base/341179

Log:
  Allow truss to operate on ELFv2 processes.
  
  Summary:
  Currently, truss doesn't work on ELFv2 processes due to not recognizing the 
ABI.
  
  Since there's no special handling needed here, just adding a PROCABI struct 
for
  it is sufficient to get it working.
  
  Submitted by: git_bdragon.rtk0.net
  Differential Revision: https://reviews.freebsd.org/D18352

Modified:
  head/usr.bin/truss/powerpc64-freebsd.c

Modified: head/usr.bin/truss/powerpc64-freebsd.c
==
--- head/usr.bin/truss/powerpc64-freebsd.c  Thu Nov 29 03:44:02 2018
(r341178)
+++ head/usr.bin/truss/powerpc64-freebsd.c  Thu Nov 29 03:57:06 2018
(r341179)
@@ -117,3 +117,14 @@ static struct procabi powerpc64_freebsd = {
 };
 
 PROCABI(powerpc64_freebsd);
+
+static struct procabi powerpc64_freebsd_elfv2 = {
+   "FreeBSD ELF64 V2",
+   SYSDECODE_ABI_FREEBSD,
+   powerpc64_fetch_args,
+   powerpc64_fetch_retval,
+   STAILQ_HEAD_INITIALIZER(powerpc64_freebsd_elfv2.extra_syscalls),
+   { NULL }
+};
+
+PROCABI(powerpc64_freebsd_elfv2);
___
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: r341178 - head/sys/kern

2018-11-28 Thread Mateusz Guzik
Author: mjg
Date: Thu Nov 29 03:44:02 2018
New Revision: 341178
URL: https://svnweb.freebsd.org/changeset/base/341178

Log:
  Tidy up hardclock.
  
  - use fcmpset for updating ticks
  - move (rarely used) itimer handling to a dedicated function
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_clock.c

Modified: head/sys/kern/kern_clock.c
==
--- head/sys/kern/kern_clock.c  Thu Nov 29 03:39:11 2018(r341177)
+++ head/sys/kern/kern_clock.c  Thu Nov 29 03:44:02 2018(r341178)
@@ -421,6 +421,36 @@ initclocks(void *dummy)
 #endif
 }
 
+static __noinline void
+hardclock_itimer(struct thread *td, struct pstats *pstats, int cnt, int 
usermode)
+{
+   struct proc *p;
+   int flags;
+
+   flags = 0;
+   p = td->td_proc;
+   if (usermode &&
+   timevalisset(>p_timer[ITIMER_VIRTUAL].it_value)) {
+   PROC_ITIMLOCK(p);
+   if (itimerdecr(>p_timer[ITIMER_VIRTUAL],
+   tick * cnt) == 0)
+   flags |= TDF_ALRMPEND | TDF_ASTPENDING;
+   PROC_ITIMUNLOCK(p);
+   }
+   if (timevalisset(>p_timer[ITIMER_PROF].it_value)) {
+   PROC_ITIMLOCK(p);
+   if (itimerdecr(>p_timer[ITIMER_PROF],
+   tick * cnt) == 0)
+   flags |= TDF_PROFPEND | TDF_ASTPENDING;
+   PROC_ITIMUNLOCK(p);
+   }
+   if (flags != 0) {
+   thread_lock(td);
+   td->td_flags |= flags;
+   thread_unlock(td);
+   }
+}
+
 void
 hardclock(int cnt, int usermode)
 {
@@ -428,15 +458,14 @@ hardclock(int cnt, int usermode)
struct thread *td = curthread;
struct proc *p = td->td_proc;
int *t = DPCPU_PTR(pcputicks);
-   int flags, global, newticks;
-   int i;
+   int global, i, newticks;
 
/*
 * Update per-CPU and possibly global ticks values.
 */
*t += cnt;
+   global = ticks;
do {
-   global = ticks;
newticks = *t - global;
if (newticks <= 0) {
if (newticks < -1)
@@ -444,33 +473,16 @@ hardclock(int cnt, int usermode)
newticks = 0;
break;
}
-   } while (!atomic_cmpset_int(, global, *t));
+   } while (!atomic_fcmpset_int(, , *t));
 
/*
 * Run current process's virtual and profile time, as needed.
 */
pstats = p->p_stats;
-   flags = 0;
-   if (usermode &&
-   timevalisset(>p_timer[ITIMER_VIRTUAL].it_value)) {
-   PROC_ITIMLOCK(p);
-   if (itimerdecr(>p_timer[ITIMER_VIRTUAL],
-   tick * cnt) == 0)
-   flags |= TDF_ALRMPEND | TDF_ASTPENDING;
-   PROC_ITIMUNLOCK(p);
-   }
-   if (timevalisset(>p_timer[ITIMER_PROF].it_value)) {
-   PROC_ITIMLOCK(p);
-   if (itimerdecr(>p_timer[ITIMER_PROF],
-   tick * cnt) == 0)
-   flags |= TDF_PROFPEND | TDF_ASTPENDING;
-   PROC_ITIMUNLOCK(p);
-   }
-   if (flags != 0) {
-   thread_lock(td);
-   td->td_flags |= flags;
-   thread_unlock(td);
-   }
+   if (__predict_false(
+   timevalisset(>p_timer[ITIMER_VIRTUAL].it_value) ||
+   timevalisset(>p_timer[ITIMER_PROF].it_value)))
+   hardclock_itimer(td, pstats, cnt, usermode);
 
 #ifdef HWPMC_HOOKS
if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid)))
___
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: r341177 - head/sys/powerpc/powerpc

2018-11-28 Thread Justin Hibbits
Author: jhibbits
Date: Thu Nov 29 03:39:11 2018
New Revision: 341177
URL: https://svnweb.freebsd.org/changeset/base/341177

Log:
  Fix thread creation in PowerPC64 ELFv2 processes.
  
  Summary:
  Currently, the upcall used to create threads assumes ELFv1.
  
  Instead, we should check which sysentvec is in use on the process and act
  accordingly.
  
  This makes ELFv2 threaded processes work.
  
  Submitted by: git_bdragon.rtk0.net
  Differential Revision: https://reviews.freebsd.org/D18330

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

Modified: head/sys/powerpc/powerpc/exec_machdep.c
==
--- head/sys/powerpc/powerpc/exec_machdep.c Thu Nov 29 02:52:08 2018
(r341176)
+++ head/sys/powerpc/powerpc/exec_machdep.c Thu Nov 29 03:39:11 2018
(r341177)
@@ -124,6 +124,10 @@ static int grab_mcontext32(struct thread *td, mcontext
 
 static int grab_mcontext(struct thread *, mcontext_t *, int);
 
+#ifdef __powerpc64__
+extern struct sysentvec elf64_freebsd_sysvec_v2;
+#endif
+
 void
 sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 {
@@ -1014,11 +1018,18 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *
#endif
} else {
#ifdef __powerpc64__
-   register_t entry_desc[3];
-   (void)copyin((void *)entry, entry_desc, sizeof(entry_desc));
-   tf->srr0 = entry_desc[0];
-   tf->fixreg[2] = entry_desc[1];
-   tf->fixreg[11] = entry_desc[2];
+   if (td->td_proc->p_sysent == _freebsd_sysvec_v2) {
+   tf->srr0 = (register_t)entry;
+   /* ELFv2 ABI requires that the global entry point be in 
r12. */
+   tf->fixreg[12] = (register_t)entry;
+   }
+   else {
+   register_t entry_desc[3];
+   (void)copyin((void *)entry, entry_desc, 
sizeof(entry_desc));
+   tf->srr0 = entry_desc[0];
+   tf->fixreg[2] = entry_desc[1];
+   tf->fixreg[11] = entry_desc[2];
+   }
tf->srr1 = psl_userset | PSL_FE_DFLT;
#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: r341176 - in head/sys: kern sys

2018-11-28 Thread Mateusz Guzik
Author: mjg
Date: Thu Nov 29 02:52:08 2018
New Revision: 341176
URL: https://svnweb.freebsd.org/changeset/base/341176

Log:
  proc: create a dedicated lock for zombproc to ligthen the load on allproc_lock
  
  waitpid always takes proctree to evaluate the list, but only takes allproc
  if it can reap. With this patch allproc is no longer taken, which helps during
  poudriere -j 128.
  
  Discussed with: kib
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_proc.c
  head/sys/kern/kern_racct.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Thu Nov 29 01:31:12 2018(r341175)
+++ head/sys/kern/kern_exit.c   Thu Nov 29 02:52:08 2018(r341176)
@@ -432,8 +432,10 @@ exit1(struct thread *td, int rval, int signo)
 * Move proc from allproc queue to zombproc.
 */
sx_xlock(_lock);
+   sx_xlock(_lock);
LIST_REMOVE(p, p_list);
LIST_INSERT_HEAD(, p, p_list);
+   sx_xunlock(_lock);
sx_xunlock(_lock);
 
/*
@@ -871,9 +873,9 @@ proc_reap(struct thread *td, struct proc *p, int *stat
 * Remove other references to this process to ensure we have an
 * exclusive reference.
 */
-   sx_xlock(_lock);
+   sx_xlock(_lock);
LIST_REMOVE(p, p_list); /* off zombproc */
-   sx_xunlock(_lock);
+   sx_xunlock(_lock);
sx_xlock(PIDHASHLOCK(p->p_pid));
LIST_REMOVE(p, p_hash);
sx_xunlock(PIDHASHLOCK(p->p_pid));

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Thu Nov 29 01:31:12 2018(r341175)
+++ head/sys/kern/kern_fork.c   Thu Nov 29 02:52:08 2018(r341176)
@@ -238,6 +238,7 @@ fork_findpid(int flags)
struct proc *p;
int trypid;
static int pidchecked = 0;
+   bool locked_zomb = false;
 
/*
 * Requires allproc_lock in order to iterate over the list
@@ -318,6 +319,10 @@ again:
}
if (!doingzomb) {
doingzomb = 1;
+   if (!locked_zomb) {
+   sx_slock(_lock);
+   locked_zomb = true;
+   }
p = LIST_FIRST();
goto again;
}
@@ -330,6 +335,9 @@ again:
pidchecked = 0;
else
lastpid = trypid;
+
+   if (locked_zomb)
+   sx_sunlock(_lock);
 
return (trypid);
 }

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Thu Nov 29 01:31:12 2018(r341175)
+++ head/sys/kern/kern_proc.c   Thu Nov 29 02:52:08 2018(r341176)
@@ -125,6 +125,7 @@ u_long pgrphash;
 struct proclist allproc;
 struct proclist zombproc;
 struct sx __exclusive_cache_line allproc_lock;
+struct sx __exclusive_cache_line zombproc_lock;
 struct sx __exclusive_cache_line proctree_lock;
 struct mtx __exclusive_cache_line ppeers_lock;
 uma_zone_t proc_zone;
@@ -177,6 +178,7 @@ procinit(void)
u_long i;
 
sx_init(_lock, "allproc");
+   sx_init(_lock, "zombproc");
sx_init(_lock, "proctree");
mtx_init(_lock, "p_peers", NULL, MTX_DEF);
LIST_INIT();
@@ -1194,14 +1196,14 @@ zpfind(pid_t pid)
 {
struct proc *p;
 
-   sx_slock(_lock);
+   sx_slock(_lock);
LIST_FOREACH(p, , p_list) {
if (p->p_pid == pid) {
PROC_LOCK(p);
break;
}
}
-   sx_sunlock(_lock);
+   sx_sunlock(_lock);
return (p);
 }
 

Modified: head/sys/kern/kern_racct.c
==
--- head/sys/kern/kern_racct.c  Thu Nov 29 01:31:12 2018(r341175)
+++ head/sys/kern/kern_racct.c  Thu Nov 29 02:52:08 2018(r341176)
@@ -1228,11 +1228,13 @@ racctd(void)
 
sx_slock(_lock);
 
+   sx_slock(_lock);
LIST_FOREACH(p, , p_list) {
PROC_LOCK(p);
racct_set(p, RACCT_PCTCPU, 0);
PROC_UNLOCK(p);
}
+   sx_sunlock(_lock);
 
FOREACH_PROC_IN_SYSTEM(p) {
PROC_LOCK(p);

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Thu Nov 29 01:31:12 2018(r341175)
+++ head/sys/sys/proc.h Thu Nov 29 02:52:08 2018(r341176)
@@ -959,6 +959,7 @@ extern u_long pgrphash;
 
 extern struct sx allproc_lock;
 extern int allproc_gen;
+extern struct sx zombproc_lock;
 extern struct sx 

svn commit: r341175 - releng/12.0/sbin/bectl

2018-11-28 Thread Yuri Pankov
Author: yuripv
Date: Thu Nov 29 01:31:12 2018
New Revision: 341175
URL: https://svnweb.freebsd.org/changeset/base/341175

Log:
  MFS12 r341168:
  MFC r340974:
  bectl: sync usage with man page, removing stray multibyte characters
  in the process.
  
  PR: 233526
  Submitted by:   tigersha...@gmail.com (original version)
  Reviewed by:kevans
  Approved by:  re (gjb)
  Differential revision:  https://reviews.freebsd.org/D18335

Modified:
  releng/12.0/sbin/bectl/bectl.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sbin/bectl/bectl.c
==
--- releng/12.0/sbin/bectl/bectl.c  Thu Nov 29 01:28:13 2018
(r341174)
+++ releng/12.0/sbin/bectl/bectl.c  Thu Nov 29 01:31:12 2018
(r341175)
@@ -66,22 +66,24 @@ usage(bool explicit)
FILE *fp;
 
fp =  explicit ? stdout : stderr;
-   fprintf(fp,
+   fprintf(fp, "%s",
"usage:\tbectl {-h | -? | subcommand [args...]}\n"
+#if SOON
+   "\tbectl add (path)*\n"
+#endif
"\tbectl activate [-t] beName\n"
-   "\tbectl create [-e {nonActiveBe | -e beName@snapshot}] beName\n"
-   "\tbectl create beName@snapshot\n"
+   "\tbectl create [-r] [-e {nonActiveBe | beName@snapshot}] beName\n"
+   "\tbectl create [-r] beName@snapshot\n"
"\tbectl destroy [-F] {beName | beName@snapshot}\n"
"\tbectl export sourceBe\n"
"\tbectl import targetBe\n"
-#if SOON
-   "\tbectl add (path)*\n"
-#endif
-   "\tbectl jail [{-b | -U}] [{-o key=value | -u key}]... bootenv 
[utility [argument ...]]\n"
-   "\tbectl list [-a] [-D] [-H] [-s]\n"
+   "\tbectl jail {-b | -U} [{-o key=value | -u key}]... "
+   "{jailID | jailName}\n"
+   "\t  bootenv [utility [argument ...]]\n"
+   "\tbectl list [-DHas]\n"
"\tbectl mount beName [mountpoint]\n"
"\tbectl rename origBeName newBeName\n"
-   "\tbectl {ujail | unjail} ⟨jailID | jailName | bootenv)\n"
+   "\tbectl {ujail | unjail} {jailID | jailName} bootenv\n"
"\tbectl {umount | unmount} [-f] beName\n");
 
return (explicit ? 0 : EX_USAGE);
___
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: r341174 - stable/11/sbin/ipfw

2018-11-28 Thread Eugene Grosbein
Author: eugen
Date: Thu Nov 29 01:28:13 2018
New Revision: 341174
URL: https://svnweb.freebsd.org/changeset/base/341174

Log:
  MFC r340978-340979: ipfw.8: new section to EXAMPLES: SELECTIVE MIRRORING

Modified:
  stable/11/sbin/ipfw/ipfw.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ipfw/ipfw.8
==
--- stable/11/sbin/ipfw/ipfw.8  Thu Nov 29 01:24:20 2018(r341173)
+++ stable/11/sbin/ipfw/ipfw.8  Thu Nov 29 01:28:13 2018(r341174)
@@ -4011,6 +4011,55 @@ option could be used to (re)mark user traffic,
 by adding the following to the appropriate place in ruleset:
 .Pp
 .Dl "ipfw add setdscp be ip from any to any dscp af11,af21"
+.Ss SELECTIVE MIRRORING
+If your network has network traffic analyzer
+connected to your host directly via dedicated interface
+or remotely via RSPAN vlan, you can selectively mirror
+some ethernet layer2 frames to the analyzer.
+.Pp
+First, make sure your firewall is already configured and runs.
+Then, enable layer2 processing if not already enabled:
+.Pp
+.Dl "sysctl net.link.ether.ipfw=1"
+.Pp
+Next, load needed additional kernel modules:
+.Pp
+.Dl "kldload ng_ether ng_ipfw"
+.Pp
+Optionally, make system load these modules automatically
+at startup:
+.Pp
+.Dl sysrc kld_list+="ng_ether ng_ipfw"
+.Pp
+Next, configure
+.Xr ng_ipfw 4
+kernel module to transmit mirrored copies of layer2 frames
+out via vlan900 interface:
+.Pp
+.Dl "ngctl connect ipfw: vlan900: 1 lower"
+.Pp
+Think of "1" here as of "mirroring instance index" and vlan900 is its
+destination.
+You can have arbitrary number of instances.
+Refer to
+.Xr ng_ipfw 4
+for details.
+.Pp
+At last, actually start mirroring of selected frames using "instance 1".
+For frames incoming from em0 interface:
+.Pp
+.Dl "ipfw add ngtee 1 ip from any to 192.168.0.1 layer2 in recv em0"
+.Pp
+For frames outgoing to em0 interface:
+.Pp
+.Dl "ipfw add ngtee 1 ip from any to 192.168.0.1 layer2 out xmit em0"
+.Pp
+For both incoming and outgoing frames while flowing through em0:
+.Pp
+.Dl "ipfw add ngtee 1 ip from any to 192.168.0.1 layer2 via em0"
+.Pp
+Make sure you do not perform mirroring for already duplicated frames
+or kernel may hang as there is no safety net.
 .Ss DYNAMIC RULES
 In order to protect a site from flood attacks involving fake
 TCP packets, it is safer to use dynamic rules:
@@ -4449,6 +4498,7 @@ can be changed in a similar way as for
 .Xr if_bridge 4 ,
 .Xr ip 4 ,
 .Xr ipfirewall 4 ,
+.Xr ng_ether 4 ,
 .Xr ng_ipfw 4 ,
 .Xr protocols 5 ,
 .Xr services 5 ,
@@ -4456,6 +4506,7 @@ can be changed in a similar way as for
 .Xr kldload 8 ,
 .Xr reboot 8 ,
 .Xr sysctl 8 ,
+.Xr sysrc 8 ,
 .Xr syslogd 8
 .Sh HISTORY
 The
___
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: r341173 - stable/12/sbin/ipfw

2018-11-28 Thread Eugene Grosbein
Author: eugen
Date: Thu Nov 29 01:24:20 2018
New Revision: 341173
URL: https://svnweb.freebsd.org/changeset/base/341173

Log:
  MFC r340978-340979: ipfw.8: new section to EXAMPLES: SELECTIVE MIRRORING

Modified:
  stable/12/sbin/ipfw/ipfw.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ipfw/ipfw.8
==
--- stable/12/sbin/ipfw/ipfw.8  Thu Nov 29 01:15:53 2018(r341172)
+++ stable/12/sbin/ipfw/ipfw.8  Thu Nov 29 01:24:20 2018(r341173)
@@ -4056,6 +4056,55 @@ option could be used to (re)mark user traffic,
 by adding the following to the appropriate place in ruleset:
 .Pp
 .Dl "ipfw add setdscp be ip from any to any dscp af11,af21"
+.Ss SELECTIVE MIRRORING
+If your network has network traffic analyzer
+connected to your host directly via dedicated interface
+or remotely via RSPAN vlan, you can selectively mirror
+some ethernet layer2 frames to the analyzer.
+.Pp
+First, make sure your firewall is already configured and runs.
+Then, enable layer2 processing if not already enabled:
+.Pp
+.Dl "sysctl net.link.ether.ipfw=1"
+.Pp
+Next, load needed additional kernel modules:
+.Pp
+.Dl "kldload ng_ether ng_ipfw"
+.Pp
+Optionally, make system load these modules automatically
+at startup:
+.Pp
+.Dl sysrc kld_list+="ng_ether ng_ipfw"
+.Pp
+Next, configure
+.Xr ng_ipfw 4
+kernel module to transmit mirrored copies of layer2 frames
+out via vlan900 interface:
+.Pp
+.Dl "ngctl connect ipfw: vlan900: 1 lower"
+.Pp
+Think of "1" here as of "mirroring instance index" and vlan900 is its
+destination.
+You can have arbitrary number of instances.
+Refer to
+.Xr ng_ipfw 4
+for details.
+.Pp
+At last, actually start mirroring of selected frames using "instance 1".
+For frames incoming from em0 interface:
+.Pp
+.Dl "ipfw add ngtee 1 ip from any to 192.168.0.1 layer2 in recv em0"
+.Pp
+For frames outgoing to em0 interface:
+.Pp
+.Dl "ipfw add ngtee 1 ip from any to 192.168.0.1 layer2 out xmit em0"
+.Pp
+For both incoming and outgoing frames while flowing through em0:
+.Pp
+.Dl "ipfw add ngtee 1 ip from any to 192.168.0.1 layer2 via em0"
+.Pp
+Make sure you do not perform mirroring for already duplicated frames
+or kernel may hang as there is no safety net.
 .Ss DYNAMIC RULES
 In order to protect a site from flood attacks involving fake
 TCP packets, it is safer to use dynamic rules:
@@ -4494,6 +4543,7 @@ can be changed in a similar way as for
 .Xr if_bridge 4 ,
 .Xr ip 4 ,
 .Xr ipfirewall 4 ,
+.Xr ng_ether 4 ,
 .Xr ng_ipfw 4 ,
 .Xr protocols 5 ,
 .Xr services 5 ,
@@ -4501,6 +4551,7 @@ can be changed in a similar way as for
 .Xr kldload 8 ,
 .Xr reboot 8 ,
 .Xr sysctl 8 ,
+.Xr sysrc 8 ,
 .Xr syslogd 8
 .Sh HISTORY
 The
___
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: r341172 - in head/sys: conf dev/cxgbe dev/cxgbe/tom modules/cxgbe/if_cxgbe

2018-11-28 Thread John Baldwin
Author: jhb
Date: Thu Nov 29 01:15:53 2018
New Revision: 341172
URL: https://svnweb.freebsd.org/changeset/base/341172

Log:
  Move CLIP table handling out of TOM and into the base driver.
  
  - Store the clip table in 'struct adapter' instead of in the TOM softc.
  - Init the clip table during attach and teardown during detach.
  - While here, add a dev...misc.clip sysctl to dump the
CLIP table.
  
  This does mean that we update the clip table even if TOE is not enabled,
  but non-TOE things need the CLIP table anyway.
  
  Reviewed by:  np, Krishnamraju Eraparaju @ Chelsio
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D18010

Added:
  head/sys/dev/cxgbe/t4_clip.c   (contents, props changed)
  head/sys/dev/cxgbe/t4_clip.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/tom/t4_connect.c
  head/sys/dev/cxgbe/tom/t4_listen.c
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/dev/cxgbe/tom/t4_tom.h
  head/sys/modules/cxgbe/if_cxgbe/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Nov 29 01:05:21 2018(r341171)
+++ head/sys/conf/files Thu Nov 29 01:15:53 2018(r341172)
@@ -1382,6 +1382,8 @@ dev/cxgb/sys/uipc_mvec.c  optional cxgb pci \
compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/cxgb_t3fw.c   optional cxgb cxgb_t3fw \
compile-with "${NORMAL_C} -I$S/dev/cxgb"
+dev/cxgbe/t4_clip.coptional cxgbe pci \
+   compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_filter.c  optional cxgbe pci \
compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_if.m  optional cxgbe pci

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hThu Nov 29 01:05:21 2018
(r341171)
+++ head/sys/dev/cxgbe/adapter.hThu Nov 29 01:15:53 2018
(r341172)
@@ -771,6 +771,8 @@ struct devnames {
const char *vf_ifnet_name;
 };
 
+struct clip_entry;
+
 struct adapter {
SLIST_ENTRY(adapter) link;
device_t dev;
@@ -816,6 +818,10 @@ struct adapter {
struct taskqueue *tq[MAX_NCHAN];/* General purpose taskqueues */
struct port_info *port[MAX_NPORTS];
uint8_t chan_map[MAX_NCHAN];/* channel -> port */
+
+   struct mtx clip_table_lock;
+   TAILQ_HEAD(, clip_entry) clip_table;
+   int clip_gen;
 
void *tom_softc;/* (struct tom_data *) */
struct tom_tunables tt;

Added: head/sys/dev/cxgbe/t4_clip.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/cxgbe/t4_clip.cThu Nov 29 01:15:53 2018
(r341172)
@@ -0,0 +1,382 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2012 Chelsio Communications, Inc.
+ * All rights reserved.
+ * Written by: Navdeep Parhar 
+ *
+ * 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "common/common.h"
+#include "t4_clip.h"
+
+static int add_lip(struct adapter *, struct in6_addr *);
+static int delete_lip(struct adapter *, struct in6_addr *);
+static struct clip_entry *search_lip(struct adapter *, struct in6_addr *);
+static void update_clip(struct adapter *, void *);
+static void t4_clip_task(void *, 

svn commit: r341171 - stable/11/usr.sbin/mountd

2018-11-28 Thread Sean Eric Fagan
Author: sef
Date: Thu Nov 29 01:05:21 2018
New Revision: 341171
URL: https://svnweb.freebsd.org/changeset/base/341171

Log:
  MFC r340442
  
  mountd has no way to configure the listen queue depth; rather than add a new
  option, we pass -1 down to listen, which causes it to use the
  kern.ipc.soacceptqueue sysctl.
  
  Approved by:  mav
  Sponsored by: iXsystems Inc

Modified:
  stable/11/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/mountd/mountd.c
==
--- stable/11/usr.sbin/mountd/mountd.c  Thu Nov 29 01:04:24 2018
(r341170)
+++ stable/11/usr.sbin/mountd/mountd.c  Thu Nov 29 01:05:21 2018
(r341171)
@@ -906,8 +906,12 @@ complete_service(struct netconfig *nconf, char *port_s
if (fd < 0)
continue;
 
+   /*
+* Using -1 tells listen(2) to use
+* kern.ipc.soacceptqueue for the backlog.
+*/
if (nconf->nc_semantics != NC_TPI_CLTS)
-   listen(fd, SOMAXCONN);
+   listen(fd, -1);
 
if (nconf->nc_semantics == NC_TPI_CLTS )
transp = svc_dg_create(fd, 0, 0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341170 - stable/12/usr.sbin/mountd

2018-11-28 Thread Sean Eric Fagan
Author: sef
Date: Thu Nov 29 01:04:24 2018
New Revision: 341170
URL: https://svnweb.freebsd.org/changeset/base/341170

Log:
  MFC r340442
  
  mountd has no way to configure the listen queue depth; rather than add a new
  option, we pass -1 down to listen, which causes it to use the
  kern.ipc.soacceptqueue sysctl.
  
  Approved by:  mav
  Sponsored by: iXsystems Inc

Modified:
  stable/12/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/mountd/mountd.c
==
--- stable/12/usr.sbin/mountd/mountd.c  Thu Nov 29 01:02:52 2018
(r341169)
+++ stable/12/usr.sbin/mountd/mountd.c  Thu Nov 29 01:04:24 2018
(r341170)
@@ -908,8 +908,12 @@ complete_service(struct netconfig *nconf, char *port_s
if (fd < 0)
continue;
 
+   /*
+* Using -1 tells listen(2) to use
+* kern.ipc.soacceptqueue for the backlog.
+*/
if (nconf->nc_semantics != NC_TPI_CLTS)
-   listen(fd, SOMAXCONN);
+   listen(fd, -1);
 
if (nconf->nc_semantics == NC_TPI_CLTS )
transp = svc_dg_create(fd, 0, 0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341169 - releng/12.0/release/tools

2018-11-28 Thread Glen Barber
Author: gjb
Date: Thu Nov 29 01:02:52 2018
New Revision: 341169
URL: https://svnweb.freebsd.org/changeset/base/341169

Log:
  MFS12 r341167:
   MFC r340983:
   Fix NTP query on GCE due to unresolved hostname.
  
  PR:   232456
  Submitted by: Lucas Kanashiro
  Approved by:  re (delphij)
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/12.0/release/tools/gce.conf
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/release/tools/gce.conf
==
--- releng/12.0/release/tools/gce.conf  Thu Nov 29 00:34:55 2018
(r341168)
+++ releng/12.0/release/tools/gce.conf  Thu Nov 29 01:02:52 2018
(r341169)
@@ -49,7 +49,7 @@ aesni_load="YES"
 nvme_load="YES"
 EOF
 
-   echo '169.254.169.254 metadata.google.internal metadata' > \
+   echo '169.254.169.254 metadata.google.internal metadata' >> \
${DESTDIR}/etc/hosts
 
 # overwrite ntp.conf
___
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: r341168 - stable/12/sbin/bectl

2018-11-28 Thread Yuri Pankov
Author: yuripv
Date: Thu Nov 29 00:34:55 2018
New Revision: 341168
URL: https://svnweb.freebsd.org/changeset/base/341168

Log:
  MFC r340974:
  bectl: sync usage with man page, removing stray multibyte characters
  in the process.
  
  PR: 233526
  Submitted by:   tigersha...@gmail.com (original version)
  Reviewed by:kevans
  Differential revision:  https://reviews.freebsd.org/D18335

Modified:
  stable/12/sbin/bectl/bectl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/bectl/bectl.c
==
--- stable/12/sbin/bectl/bectl.cThu Nov 29 00:28:08 2018
(r341167)
+++ stable/12/sbin/bectl/bectl.cThu Nov 29 00:34:55 2018
(r341168)
@@ -66,22 +66,24 @@ usage(bool explicit)
FILE *fp;
 
fp =  explicit ? stdout : stderr;
-   fprintf(fp,
+   fprintf(fp, "%s",
"usage:\tbectl {-h | -? | subcommand [args...]}\n"
+#if SOON
+   "\tbectl add (path)*\n"
+#endif
"\tbectl activate [-t] beName\n"
-   "\tbectl create [-e {nonActiveBe | -e beName@snapshot}] beName\n"
-   "\tbectl create beName@snapshot\n"
+   "\tbectl create [-r] [-e {nonActiveBe | beName@snapshot}] beName\n"
+   "\tbectl create [-r] beName@snapshot\n"
"\tbectl destroy [-F] {beName | beName@snapshot}\n"
"\tbectl export sourceBe\n"
"\tbectl import targetBe\n"
-#if SOON
-   "\tbectl add (path)*\n"
-#endif
-   "\tbectl jail [{-b | -U}] [{-o key=value | -u key}]... bootenv 
[utility [argument ...]]\n"
-   "\tbectl list [-a] [-D] [-H] [-s]\n"
+   "\tbectl jail {-b | -U} [{-o key=value | -u key}]... "
+   "{jailID | jailName}\n"
+   "\t  bootenv [utility [argument ...]]\n"
+   "\tbectl list [-DHas]\n"
"\tbectl mount beName [mountpoint]\n"
"\tbectl rename origBeName newBeName\n"
-   "\tbectl {ujail | unjail} ⟨jailID | jailName | bootenv)\n"
+   "\tbectl {ujail | unjail} {jailID | jailName} bootenv\n"
"\tbectl {umount | unmount} [-f] beName\n");
 
return (explicit ? 0 : EX_USAGE);
___
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: r341167 - in stable: 11/release/tools 12/release/tools

2018-11-28 Thread Glen Barber
Author: gjb
Date: Thu Nov 29 00:28:08 2018
New Revision: 341167
URL: https://svnweb.freebsd.org/changeset/base/341167

Log:
  MFC r340983:
   Fix NTP query on GCE due to unresolved hostname.
  
  PR:   232456
  Submitted by: Lucas Kanashiro
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/tools/gce.conf
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/release/tools/gce.conf
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/release/tools/gce.conf
==
--- stable/11/release/tools/gce.confWed Nov 28 21:20:51 2018
(r341166)
+++ stable/11/release/tools/gce.confThu Nov 29 00:28:08 2018
(r341167)
@@ -49,7 +49,7 @@ aesni_load="YES"
 nvme_load="YES"
 EOF
 
-   echo '169.254.169.254 metadata.google.internal metadata' > \
+   echo '169.254.169.254 metadata.google.internal metadata' >> \
${DESTDIR}/etc/hosts
 
 # overwrite ntp.conf
___
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: r341167 - in stable: 11/release/tools 12/release/tools

2018-11-28 Thread Glen Barber
Author: gjb
Date: Thu Nov 29 00:28:08 2018
New Revision: 341167
URL: https://svnweb.freebsd.org/changeset/base/341167

Log:
  MFC r340983:
   Fix NTP query on GCE due to unresolved hostname.
  
  PR:   232456
  Submitted by: Lucas Kanashiro
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/release/tools/gce.conf
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/release/tools/gce.conf
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/release/tools/gce.conf
==
--- stable/12/release/tools/gce.confWed Nov 28 21:20:51 2018
(r341166)
+++ stable/12/release/tools/gce.confThu Nov 29 00:28:08 2018
(r341167)
@@ -49,7 +49,7 @@ aesni_load="YES"
 nvme_load="YES"
 EOF
 
-   echo '169.254.169.254 metadata.google.internal metadata' > \
+   echo '169.254.169.254 metadata.google.internal metadata' >> \
${DESTDIR}/etc/hosts
 
 # overwrite ntp.conf
___
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: r340676 - in head/sys: kern sys

2018-11-28 Thread Mateusz Guzik
On 11/26/18, John Baldwin  wrote:
> On 11/22/18 9:28 AM, Mateusz Guzik wrote:
>> diff --git a/sys/sys/systm.h b/sys/sys/systm.h
>> index a1b98c5660c..fab94ee7979 100644
>> --- a/sys/sys/systm.h
>> +++ b/sys/sys/systm.h
>> @@ -523,7 +523,11 @@ int alloc_unr_specific(struct unrhdr *uh, u_int
>> item);
>>  int alloc_unrl(struct unrhdr *uh);
>>  void free_unr(struct unrhdr *uh, u_int item);
>>
>> -#if defined(__mips__) || defined(__powerpc__)
>> +#if defined(mips) && !defined(__mips_n64) && !defined(__mips_n32)
>> +#define UNR64_LOCKED
>> +#endif
>
> This would perhaps be shorter as:
>
> #if defined(__mips__) && defined(__mips_o32)
>
>> +
>> +#if defined(__powerpc__) && !defined(__powerpc64__)
>>  #define UNR64_LOCKED
>>  #endif
>
> It's not clear to me why this isn't just conditional on LP64 though.
> If 32-bit riscv existed in FreeBSD it would also not have this.  If we
> really care that much about i386 and 32-bit arm you could write it as:
>
> #if !(defined(__LP64__) || defined(__i386__) || defined(__arm__))
>
> (I'm not sure we care that much though and think we could just use __LP64__
> alone and call it a day.)
>

There will be future optimizations which would be defeated for platforms
resorting to the lock, but playing around it may not be worth it.

That said, if noone objects I'll just __LP64__ as suggested:

diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index a1b98c5660c..b250c54033c 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -523,7 +523,7 @@ int alloc_unr_specific(struct unrhdr *uh, u_int item);
 int alloc_unrl(struct unrhdr *uh);
 void free_unr(struct unrhdr *uh, u_int item);

-#if defined(__mips__) || defined(__powerpc__)
+#ifndef __LP64__
 #define UNR64_LOCKED
 #endif

-- 
Mateusz Guzik 
___
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: r341166 - in stable/11/sys: arm/arm arm64/arm64 riscv/riscv

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 21:20:51 2018
New Revision: 341166
URL: https://svnweb.freebsd.org/changeset/base/341166

Log:
  MFC r340995
  
  Prevent kernel stack disclosure in signal delivery
  
  On arm64 and riscv platforms, sendsig() failed to zero the signal
  frame before copying it out to userspace.  Zero it.
  
  On arm, I believe all the contents of the frame were initialized,
  so there was no disclosure.  However, explicitly zero the whole frame
  because that fact could inadvertently change in the future,
  it's more clear to the reader, and I could be wrong in the first place.
  
  Security: similar to FreeBSD-EN-18:12.mem and CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/sys/arm/arm/machdep.c
  stable/11/sys/arm64/arm64/machdep.c
  stable/11/sys/riscv/riscv/machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/arm/machdep.c
==
--- stable/11/sys/arm/arm/machdep.c Wed Nov 28 21:19:58 2018
(r341165)
+++ stable/11/sys/arm/arm/machdep.c Wed Nov 28 21:20:51 2018
(r341166)
@@ -609,6 +609,7 @@ sendsig(catcher, ksi, mask)
/* make the stack aligned */
fp = (struct sigframe *)STACKALIGN(fp);
/* Populate the siginfo frame. */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
 #ifdef VFP
get_vfpcontext(td, _vfp);

Modified: stable/11/sys/arm64/arm64/machdep.c
==
--- stable/11/sys/arm64/arm64/machdep.c Wed Nov 28 21:19:58 2018
(r341165)
+++ stable/11/sys/arm64/arm64/machdep.c Wed Nov 28 21:20:51 2018
(r341166)
@@ -590,6 +590,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;

Modified: stable/11/sys/riscv/riscv/machdep.c
==
--- stable/11/sys/riscv/riscv/machdep.c Wed Nov 28 21:19:58 2018
(r341165)
+++ stable/11/sys/riscv/riscv/machdep.c Wed Nov 28 21:20:51 2018
(r341166)
@@ -522,6 +522,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
___
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: r341165 - in stable/11/sys: amd64/ia32 mips/mips powerpc/powerpc

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 21:19:58 2018
New Revision: 341165
URL: https://svnweb.freebsd.org/changeset/base/341165

Log:
  MFC r340994
  
  Prevent kernel stack disclosure in getcontext/swapcontext
  
  Expand r338982 to cover freebsd32 interfaces on amd64, mips, and powerpc.
  
  Security: FreeBSD-EN-18:12.mem
  Security: CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/sys/amd64/ia32/ia32_signal.c
  stable/11/sys/mips/mips/freebsd32_machdep.c
  stable/11/sys/powerpc/powerpc/exec_machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/ia32/ia32_signal.c
==
--- stable/11/sys/amd64/ia32/ia32_signal.c  Wed Nov 28 20:03:53 2018
(r341164)
+++ stable/11/sys/amd64/ia32/ia32_signal.c  Wed Nov 28 21:19:58 2018
(r341165)
@@ -260,6 +260,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -300,6 +301,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: stable/11/sys/mips/mips/freebsd32_machdep.c
==
--- stable/11/sys/mips/mips/freebsd32_machdep.c Wed Nov 28 20:03:53 2018
(r341164)
+++ stable/11/sys/mips/mips/freebsd32_machdep.c Wed Nov 28 21:19:58 2018
(r341165)
@@ -290,6 +290,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -329,6 +330,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: stable/11/sys/powerpc/powerpc/exec_machdep.c
==
--- stable/11/sys/powerpc/powerpc/exec_machdep.cWed Nov 28 20:03:53 
2018(r341164)
+++ stable/11/sys/powerpc/powerpc/exec_machdep.cWed Nov 28 21:19:58 
2018(r341165)
@@ -801,6 +801,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -840,6 +841,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
___
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: r341164 - in head/bin/sh: . tests/expansion

2018-11-28 Thread Jilles Tjoelker
Author: jilles
Date: Wed Nov 28 20:03:53 2018
New Revision: 341164
URL: https://svnweb.freebsd.org/changeset/base/341164

Log:
  sh: Fix ${param?} default error message
  
  If word in ${param?word} is missing, the shell shall write a default error
  message. So expanding ${param?} when param is not set should write an error
  message like
  
  sh: param: parameter not set
  
  This was broken by r316417.
  
  PR:   233585

Added:
  head/bin/sh/tests/expansion/question2.0   (contents, props changed)
Modified:
  head/bin/sh/expand.c
  head/bin/sh/tests/expansion/Makefile

Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cWed Nov 28 19:54:02 2018(r341163)
+++ head/bin/sh/expand.cWed Nov 28 20:03:53 2018(r341164)
@@ -623,10 +623,11 @@ static const char *
 subevalvar_misc(const char *p, struct nodelist **restrict argbackq,
 const char *var, int subtype, int startloc, int varflags)
 {
+   const char *end;
char *startp;
int amount;
 
-   p = argstr(p, argbackq, EXP_TILDE, NULL);
+   end = argstr(p, argbackq, EXP_TILDE, NULL);
STACKSTRNUL(expdest);
startp = stackblock() + startloc;
 
@@ -635,7 +636,7 @@ subevalvar_misc(const char *p, struct nodelist **restr
setvar(var, startp, 0);
amount = startp - expdest;
STADJUST(amount, expdest);
-   return p;
+   return end;
 
case VSQUESTION:
if (*p != CTLENDVAR) {

Modified: head/bin/sh/tests/expansion/Makefile
==
--- head/bin/sh/tests/expansion/MakefileWed Nov 28 19:54:02 2018
(r341163)
+++ head/bin/sh/tests/expansion/MakefileWed Nov 28 20:03:53 2018
(r341164)
@@ -86,6 +86,7 @@ ${PACKAGE}FILES+= plus-minus7.0
 ${PACKAGE}FILES+=  plus-minus8.0
 ${PACKAGE}FILES+=  plus-minus9.0
 ${PACKAGE}FILES+=  question1.0
+${PACKAGE}FILES+=  question2.0
 ${PACKAGE}FILES+=  readonly1.0
 ${PACKAGE}FILES+=  redir1.0
 ${PACKAGE}FILES+=  set-u1.0

Added: head/bin/sh/tests/expansion/question2.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/expansion/question2.0 Wed Nov 28 20:03:53 2018
(r341164)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+unset dummyvar
+msg=`(: ${dummyvar?}) 2>&1`
+r=$?
+[ "$r" != 0 ] && case $msg in
+*dummyvar?* | *?dummyvar*) : ;;
+*)
+   printf 'Bad message: [%s]\n' "$msg"
+   exit 1
+esac
___
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: r341163 - head/sys/vm

2018-11-28 Thread Gleb Smirnoff
Author: glebius
Date: Wed Nov 28 19:54:02 2018
New Revision: 341163
URL: https://svnweb.freebsd.org/changeset/base/341163

Log:
  Fix yet another edge case in uma_startup_count(). If zone size fits into
  several pages, but leaves no space for struct uma_slab at the end we
  miscalculate number of pages by one. Totally mimic keg_large_init() math
  here to cover that problem.
  
  Reported by:  gallatin

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Wed Nov 28 19:17:27 2018(r341162)
+++ head/sys/vm/uma_core.c  Wed Nov 28 19:54:02 2018(r341163)
@@ -1991,10 +1991,17 @@ uma_startup_count(int vm_zones)
 #endif
 
/* Memory for the rest of startup zones, UMA and VM, ... */
-   if (zsize > UMA_SLAB_SPACE)
-   pages += (zones + vm_zones) *
-   howmany(roundup2(zsize, UMA_BOOT_ALIGN), UMA_SLAB_SIZE);
-   else if (roundup2(zsize, UMA_BOOT_ALIGN) > UMA_SLAB_SPACE)
+   if (zsize > UMA_SLAB_SPACE) {
+   /* See keg_large_init(). */
+   u_int ppera;
+
+   ppera = howmany(roundup2(zsize, UMA_BOOT_ALIGN), PAGE_SIZE);
+   if (PAGE_SIZE * ppera - roundup2(zsize, UMA_BOOT_ALIGN) <
+   SIZEOF_UMA_SLAB)
+   ppera++;
+   pages += (zones + vm_zones) * ppera;
+   } else if (roundup2(zsize, UMA_BOOT_ALIGN) > UMA_SLAB_SPACE)
+   /* See keg_small_init() special case for uk_ppera = 1. */
pages += zones;
else
pages += howmany(zones,
___
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: r341162 - head/sys/vm

2018-11-28 Thread Gleb Smirnoff
Author: glebius
Date: Wed Nov 28 19:17:27 2018
New Revision: 341162
URL: https://svnweb.freebsd.org/changeset/base/341162

Log:
  For not offpage zones the slab is placed at the end of page. Keg's uk_pgoff
  is calculated to guarantee that struct uma_slab is placed at pointer size
  alignment. Calculation of real struct uma_slab size is done in keg_ctor()
  and yet again in keg_large_init(), to check if we need an extra page. This
  calculation can actually be performed at compile time.
  
  - Add SIZEOF_UMA_SLAB macro to calculate size of struct uma_slab placed at
an end of a page with alignment requirement.
  - Use SIZEOF_UMA_SLAB in keg_ctor() and in keg_large_init(). This is a not
a functional change.
  - Use SIZEOF_UMA_SLAB in UMA_SLAB_SPACE definition and in keg_small_init().
This is a potential bugfix, but in reality I don't think there are any
systems affected, since compiler aligns struct uma_slab anyway.

Modified:
  head/sys/vm/uma_core.c
  head/sys/vm/uma_int.h

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Wed Nov 28 18:42:42 2018(r341161)
+++ head/sys/vm/uma_core.c  Wed Nov 28 19:17:27 2018(r341162)
@@ -1453,7 +1453,7 @@ keg_small_init(uma_keg_t keg)
if (keg->uk_flags & UMA_ZONE_OFFPAGE)
shsize = 0;
else 
-   shsize = sizeof(struct uma_slab);
+   shsize = SIZEOF_UMA_SLAB;
 
if (rsize <= slabsize - shsize)
keg->uk_ipers = (slabsize - shsize) / rsize;
@@ -1523,7 +1523,6 @@ keg_small_init(uma_keg_t keg)
 static void
 keg_large_init(uma_keg_t keg)
 {
-   u_int shsize;
 
KASSERT(keg != NULL, ("Keg is null in keg_large_init"));
KASSERT((keg->uk_flags & UMA_ZFLAG_CACHEONLY) == 0,
@@ -1536,23 +1535,17 @@ keg_large_init(uma_keg_t keg)
keg->uk_rsize = keg->uk_size;
 
/* Check whether we have enough space to not do OFFPAGE. */
-   if ((keg->uk_flags & UMA_ZONE_OFFPAGE) == 0) {
-   shsize = sizeof(struct uma_slab);
-   if (shsize & UMA_ALIGN_PTR)
-   shsize = (shsize & ~UMA_ALIGN_PTR) +
-   (UMA_ALIGN_PTR + 1);
-
-   if (PAGE_SIZE * keg->uk_ppera - keg->uk_rsize < shsize) {
-   /*
-* We can't do OFFPAGE if we're internal, in which case
-* we need an extra page per allocation to contain the
-* slab header.
-*/
-   if ((keg->uk_flags & UMA_ZFLAG_INTERNAL) == 0)
-   keg->uk_flags |= UMA_ZONE_OFFPAGE;
-   else
-   keg->uk_ppera++;
-   }
+   if ((keg->uk_flags & UMA_ZONE_OFFPAGE) == 0 &&
+   PAGE_SIZE * keg->uk_ppera - keg->uk_rsize < SIZEOF_UMA_SLAB) {
+   /*
+* We can't do OFFPAGE if we're internal, in which case
+* we need an extra page per allocation to contain the
+* slab header.
+*/
+   if ((keg->uk_flags & UMA_ZFLAG_INTERNAL) == 0)
+   keg->uk_flags |= UMA_ZONE_OFFPAGE;
+   else
+   keg->uk_ppera++;
}
 
if ((keg->uk_flags & UMA_ZONE_OFFPAGE) &&
@@ -1693,20 +1686,11 @@ keg_ctor(void *mem, int size, void *udata, int flags)
 
/*
 * If we're putting the slab header in the actual page we need to
-* figure out where in each page it goes.  This calculates a right
-* justified offset into the memory on an ALIGN_PTR boundary.
+* figure out where in each page it goes.  See SIZEOF_UMA_SLAB
+* macro definition.
 */
if (!(keg->uk_flags & UMA_ZONE_OFFPAGE)) {
-   u_int totsize;
-
-   /* Size of the slab struct and free list */
-   totsize = sizeof(struct uma_slab);
-
-   if (totsize & UMA_ALIGN_PTR)
-   totsize = (totsize & ~UMA_ALIGN_PTR) +
-   (UMA_ALIGN_PTR + 1);
-   keg->uk_pgoff = (PAGE_SIZE * keg->uk_ppera) - totsize;
-
+   keg->uk_pgoff = (PAGE_SIZE * keg->uk_ppera) - SIZEOF_UMA_SLAB;
/*
 * The only way the following is possible is if with our
 * UMA_ALIGN_PTR adjustments we are now bigger than
@@ -1714,13 +1698,10 @@ keg_ctor(void *mem, int size, void *udata, int flags)
 * mathematically possible for all cases, so we make
 * sure here anyway.
 */
-   totsize = keg->uk_pgoff + sizeof(struct uma_slab);
-   if (totsize > PAGE_SIZE * keg->uk_ppera) {
-   printf("zone %s ipers %d rsize %d size %d\n",
-   zone->uz_name, keg->uk_ipers, keg->uk_rsize,
-  

svn commit: r341161 - in stable/12/sys: kern vm

2018-11-28 Thread Konstantin Belousov
Author: kib
Date: Wed Nov 28 18:42:42 2018
New Revision: 341161
URL: https://svnweb.freebsd.org/changeset/base/341161

Log:
  MFC r339506, r339508, r340064 (by markj), r340546 (by alc):
  Tidy up code to merge vm_entry neighbors and simplify related checks.
  
  r339506:
  Reduce code duplication in merging vm_entry neighbors.
  r339508:
  Unindent.
  r340064:
  Initialize the eflags field of vm_map headers.
  r340546:
  Tidy up vm_map_simplify_entry() and its recently introduced helper functions.
  
  Discussed with:   markj

Modified:
  stable/12/sys/kern/sys_process.c
  stable/12/sys/vm/vm_map.c
  stable/12/sys/vm/vm_map.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/sys_process.c
==
--- stable/12/sys/kern/sys_process.cWed Nov 28 18:09:42 2018
(r341160)
+++ stable/12/sys/kern/sys_process.cWed Nov 28 18:42:42 2018
(r341161)
@@ -387,8 +387,9 @@ ptrace_vm_entry(struct thread *td, struct proc *p, str
error = EINVAL;
break;
}
-   while (entry != >header &&
-   (entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) {
+   KASSERT((map->header.eflags & MAP_ENTRY_IS_SUB_MAP) == 0,
+   ("Submap in map header"));
+   while ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) {
entry = entry->next;
index++;
}

Modified: stable/12/sys/vm/vm_map.c
==
--- stable/12/sys/vm/vm_map.c   Wed Nov 28 18:09:42 2018(r341160)
+++ stable/12/sys/vm/vm_map.c   Wed Nov 28 18:42:42 2018(r341161)
@@ -796,6 +796,7 @@ _vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t mi
 {
 
map->header.next = map->header.prev = >header;
+   map->header.eflags = MAP_ENTRY_HEADER;
map->needs_wakeup = FALSE;
map->system_map = 0;
map->pmap = pmap;
@@ -1277,8 +1278,8 @@ charged:
if (object->ref_count > 1 || object->shadow_count != 0)
vm_object_clear_flag(object, OBJ_ONEMAPPING);
VM_OBJECT_WUNLOCK(object);
-   } else if (prev_entry != >header &&
-   (prev_entry->eflags & ~MAP_ENTRY_USER_WIRED) == protoeflags &&
+   } else if ((prev_entry->eflags & ~MAP_ENTRY_USER_WIRED) ==
+   protoeflags &&
(cow & (MAP_STACK_GROWS_DOWN | MAP_STACK_GROWS_UP)) == 0 &&
prev_entry->end == start && (prev_entry->cred == cred ||
(prev_entry->object.vm_object != NULL &&
@@ -1644,6 +1645,54 @@ vm_map_find_min(vm_map_t map, vm_object_t object, vm_o
 }
 
 /*
+ * A map entry with any of the following flags set must not be merged with
+ * another entry.
+ */
+#defineMAP_ENTRY_NOMERGE_MASK  (MAP_ENTRY_GROWS_DOWN | 
MAP_ENTRY_GROWS_UP | \
+   MAP_ENTRY_IN_TRANSITION | MAP_ENTRY_IS_SUB_MAP)
+
+static bool
+vm_map_mergeable_neighbors(vm_map_entry_t prev, vm_map_entry_t entry)
+{
+
+   KASSERT((prev->eflags & MAP_ENTRY_NOMERGE_MASK) == 0 ||
+   (entry->eflags & MAP_ENTRY_NOMERGE_MASK) == 0,
+   ("vm_map_mergeable_neighbors: neither %p nor %p are mergeable",
+   prev, entry));
+   return (prev->end == entry->start &&
+   prev->object.vm_object == entry->object.vm_object &&
+   (prev->object.vm_object == NULL ||
+   prev->offset + (prev->end - prev->start) == entry->offset) &&
+   prev->eflags == entry->eflags &&
+   prev->protection == entry->protection &&
+   prev->max_protection == entry->max_protection &&
+   prev->inheritance == entry->inheritance &&
+   prev->wired_count == entry->wired_count &&
+   prev->cred == entry->cred);
+}
+
+static void
+vm_map_merged_neighbor_dispose(vm_map_t map, vm_map_entry_t entry)
+{
+
+   /*
+* If the backing object is a vnode object, vm_object_deallocate()
+* calls vrele().  However, vrele() does not lock the vnode because
+* the vnode has additional references.  Thus, the map lock can be
+* kept without causing a lock-order reversal with the vnode lock.
+*
+* Since we count the number of virtual page mappings in
+* object->un_pager.vnp.writemappings, the writemappings value
+* should not be adjusted when the entry is disposed of.
+*/
+   if (entry->object.vm_object != NULL)
+   vm_object_deallocate(entry->object.vm_object);
+   if (entry->cred != NULL)
+   crfree(entry->cred);
+   vm_map_entry_dispose(map, entry);
+}
+
+/*
  * vm_map_simplify_entry:
  *
  * Simplify the given map entry by merging with either neighbor.  This
@@ -1659,81 +1708,27 @@ void
 vm_map_simplify_entry(vm_map_t map, vm_map_entry_t entry)
 {
vm_map_entry_t next, prev;
-   

svn commit: r341160 - in head/stand/i386: common gptboot zfsboot

2018-11-28 Thread Ian Lepore
Author: ian
Date: Wed Nov 28 18:09:42 2018
New Revision: 341160
URL: https://svnweb.freebsd.org/changeset/base/341160

Log:
  Add comments describing the bootargs handoff between loader(8) and gptboot
  or zfsboot, when loader(8) is the BTX loader.  No functional changes.

Modified:
  head/stand/i386/common/bootargs.h
  head/stand/i386/gptboot/gptboot.c
  head/stand/i386/zfsboot/zfsboot.c

Modified: head/stand/i386/common/bootargs.h
==
--- head/stand/i386/common/bootargs.h   Wed Nov 28 18:06:16 2018
(r341159)
+++ head/stand/i386/common/bootargs.h   Wed Nov 28 18:09:42 2018
(r341160)
@@ -43,6 +43,24 @@
 
 #ifndef __ASSEMBLER__
 
+/*
+ * This struct describes the contents of the stack on entry to btxldr.S.  This
+ * is the data that follows the return address, so it begins at 4(%esp).  On
+ * the sending side, this data is passed as individual args to __exec().  On 
the
+ * receiving side, code in btxldr.S copies the data from the entry stack to a
+ * known fixed location in the new address space.  Then, btxcsu.S sets the
+ * global variable __args to point to that known fixed location before calling
+ * main(), which casts __args to a struct bootargs pointer to access the data.
+ * The btxldr.S code is aware of KARGS_FLAGS_EXTARG, and if it's set, the extra
+ * args data is copied along with the other bootargs from the entry stack to 
the
+ * fixed location in the new address space.
+ *
+ * The bootinfo field is actually a pointer to a bootinfo struct that has been
+ * converted to uint32_t using VTOP().  On the receiving side it must be
+ * converted back to a pointer using PTOV().  Code in btxldr.S is aware of this
+ * field and if it's non-NULL it copies the data it points to into another 
known
+ * fixed location, and adjusts the bootinfo field to point to that new 
location.
+ */
 struct bootargs
 {
uint32_thowto;

Modified: head/stand/i386/gptboot/gptboot.c
==
--- head/stand/i386/gptboot/gptboot.c   Wed Nov 28 18:06:16 2018
(r341159)
+++ head/stand/i386/gptboot/gptboot.c   Wed Nov 28 18:09:42 2018
(r341160)
@@ -487,6 +487,12 @@ load(void)
geliargs.keybuf_sentinel = KEYBUF_SENTINEL;
geliargs.keybuf = gelibuf;
 #endif
+   /*
+* Note that the geliargs struct is passed by value, not by pointer.
+* Code in btxldr.S copies the values from the entry stack to a fixed
+* location within loader(8) at startup due to the presence of the
+* KARGS_FLAGS_EXTARG flag.
+*/
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
MAKEBOOTDEV(dev_maj[gdsk.dsk.type], gdsk.dsk.part + 1, 
gdsk.dsk.unit, 0xff),
 #ifdef LOADER_GELI_SUPPORT

Modified: head/stand/i386/zfsboot/zfsboot.c
==
--- head/stand/i386/zfsboot/zfsboot.c   Wed Nov 28 18:06:16 2018
(r341159)
+++ head/stand/i386/zfsboot/zfsboot.c   Wed Nov 28 18:09:42 2018
(r341160)
@@ -1005,6 +1005,11 @@ load(void)
zfsargs.primary_vdev = primary_vdev->v_guid;
 else
printf("failed to detect primary vdev\n");
+/*
+ * Note that the zfsargs struct is passed by value, not by pointer.  Code 
in
+ * btxldr.S copies the values from the entry stack to a fixed location
+ * within loader(8) at startup due to the presence of KARGS_FLAGS_EXTARG.
+ */
 __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
   bootdev,
   KARGS_FLAGS_ZFS | KARGS_FLAGS_EXTARG,
___
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: r341159 - releng/12.0/sys/kern

2018-11-28 Thread Mark Johnston
Author: markj
Date: Wed Nov 28 18:06:16 2018
New Revision: 341159
URL: https://svnweb.freebsd.org/changeset/base/341159

Log:
  MFstable/12 r341082:
  Ensure that knotes do not get registered when KQ_CLOSING is set.
  
  PR:   228858
  Approved by:  re (gjb)

Modified:
  releng/12.0/sys/kern/kern_event.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sys/kern/kern_event.c
==
--- releng/12.0/sys/kern/kern_event.c   Wed Nov 28 18:02:59 2018
(r341158)
+++ releng/12.0/sys/kern/kern_event.c   Wed Nov 28 18:06:16 2018
(r341159)
@@ -1463,8 +1463,11 @@ findkn:
break;
}
} else {
-   if ((kev->flags & EV_ADD) == EV_ADD)
-   kqueue_expand(kq, fops, kev->ident, waitok);
+   if ((kev->flags & EV_ADD) == EV_ADD) {
+   error = kqueue_expand(kq, fops, kev->ident, waitok);
+   if (error != 0)
+   goto done;
+   }
 
KQ_LOCK(kq);
 
@@ -1700,12 +1703,12 @@ kqueue_expand(struct kqueue *kq, struct filterops *fop
 {
struct klist *list, *tmp_knhash, *to_free;
u_long tmp_knhashmask;
-   int size;
-   int fd;
+   int error, fd, size;
int mflag = waitok ? M_WAITOK : M_NOWAIT;
 
KQ_NOTOWNED(kq);
 
+   error = 0;
to_free = NULL;
if (fops->f_isfd) {
fd = ident;
@@ -1717,9 +1720,11 @@ kqueue_expand(struct kqueue *kq, struct filterops *fop
if (list == NULL)
return ENOMEM;
KQ_LOCK(kq);
-   if (kq->kq_knlistsize > fd) {
+   if ((kq->kq_state & KQ_CLOSING) != 0) {
to_free = list;
-   list = NULL;
+   error = EBADF;
+   } else if (kq->kq_knlistsize > fd) {
+   to_free = list;
} else {
if (kq->kq_knlist != NULL) {
bcopy(kq->kq_knlist, list,
@@ -1740,9 +1745,12 @@ kqueue_expand(struct kqueue *kq, struct filterops *fop
tmp_knhash = hashinit(KN_HASHSIZE, M_KQUEUE,
_knhashmask);
if (tmp_knhash == NULL)
-   return ENOMEM;
+   return (ENOMEM);
KQ_LOCK(kq);
-   if (kq->kq_knhashmask == 0) {
+   if ((kq->kq_state & KQ_CLOSING) != 0) {
+   to_free = tmp_knhash;
+   error = EBADF;
+   } else if (kq->kq_knhashmask == 0) {
kq->kq_knhash = tmp_knhash;
kq->kq_knhashmask = tmp_knhashmask;
} else {
@@ -1754,7 +1762,7 @@ kqueue_expand(struct kqueue *kq, struct filterops *fop
free(to_free, M_KQUEUE);
 
KQ_NOTOWNED(kq);
-   return 0;
+   return (error);
 }
 
 static void
@@ -2605,6 +2613,8 @@ knote_attach(struct knote *kn, struct kqueue *kq)
KASSERT(kn_in_flux(kn), ("knote %p not marked influx", kn));
KQ_OWNED(kq);
 
+   if ((kq->kq_state & KQ_CLOSING) != 0)
+   return (EBADF);
if (kn->kn_fop->f_isfd) {
if (kn->kn_id >= kq->kq_knlistsize)
return (ENOMEM);
___
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: r341158 - stable/12/tests/sys/acl

2018-11-28 Thread Mark Johnston
Author: markj
Date: Wed Nov 28 18:02:59 2018
New Revision: 341158
URL: https://svnweb.freebsd.org/changeset/base/341158

Log:
  MFC r339795:
  Add a very basic regression test for setfacl -R with NFSv4 ACLs.

Modified:
  stable/12/tests/sys/acl/tools-nfs4-psarc.test
  stable/12/tests/sys/acl/tools-nfs4.test
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tests/sys/acl/tools-nfs4-psarc.test
==
--- stable/12/tests/sys/acl/tools-nfs4-psarc.test   Wed Nov 28 17:40:08 
2018(r341157)
+++ stable/12/tests/sys/acl/tools-nfs4-psarc.test   Wed Nov 28 18:02:59 
2018(r341158)
@@ -557,6 +557,29 @@ $ rmdir yyy
 $ rm xxx
 $ cd ..
 $ rmdir ddd
-
 $ rm xxx
 
+# Test basic recursive setting of ACLs.
+$ mkdir ddd
+$ touch ddd/xxx
+$ mkdir ddd/eee
+$ touch ddd/eee/yyy
+$ setfacl -R -m 
owner@:full_set:f:allow,group@:full_set::allow,everyone@:full_set::allow ddd
+$ getfacl -q ddd
+> owner@:rwxpDdaARWcCos:f--:allow
+> group@:rwxpDdaARWcCos:---:allow
+>  everyone@:rwxpDdaARWcCos:---:allow
+$ getfacl -q ddd/xxx
+> owner@:rwxpDdaARWcCos:---:allow
+> group@:rwxpDdaARWcCos:---:allow
+>  everyone@:rwxpDdaARWcCos:---:allow
+$ getfacl -q ddd/eee
+> owner@:rwxpDdaARWcCos:f--:allow
+> group@:rwxpDdaARWcCos:---:allow
+>  everyone@:rwxpDdaARWcCos:---:allow
+$ getfacl -q ddd/eee/yyy
+> owner@:rwxpDdaARWcCos:---:allow
+> group@:rwxpDdaARWcCos:---:allow
+>  everyone@:rwxpDdaARWcCos:---:allow
+
+$ rm -r ddd

Modified: stable/12/tests/sys/acl/tools-nfs4.test
==
--- stable/12/tests/sys/acl/tools-nfs4.test Wed Nov 28 17:40:08 2018
(r341157)
+++ stable/12/tests/sys/acl/tools-nfs4.test Wed Nov 28 18:02:59 2018
(r341158)
@@ -823,6 +823,41 @@ $ rmdir yyy
 $ rm xxx
 $ cd ..
 $ rmdir ddd
-
 $ rm xxx
 
+# Test basic recursive setting of ACLs.
+$ mkdir ddd
+$ touch ddd/xxx
+$ mkdir ddd/eee
+$ touch ddd/eee/yyy
+$ setfacl -R -m 
owner@:full_set:f:allow,group@:full_set::allow,everyone@:full_set::allow ddd
+$ getfacl -q ddd
+> owner@:--:---:deny
+> owner@:rwxpDdaARWcCos:f--:allow
+> group@:-w-p--:---:deny
+> group@:rwxpDdaARWcCos:---:allow
+>  everyone@:-w-p---A-W-Co-:---:deny
+>  everyone@:rwxpDdaARWcCos:---:allow
+$ getfacl -q ddd/xxx
+> owner@:--x---:---:deny
+> owner@:rwxpDdaARWcCos:---:allow
+> group@:-wxp--:---:deny
+> group@:rwxpDdaARWcCos:---:allow
+>  everyone@:-wxp---A-W-Co-:---:deny
+>  everyone@:rwxpDdaARWcCos:---:allow
+$ getfacl -q ddd/eee
+> owner@:--:---:deny
+> owner@:rwxpDdaARWcCos:f--:allow
+> group@:-w-p--:---:deny
+> group@:rwxpDdaARWcCos:---:allow
+>  everyone@:-w-p---A-W-Co-:---:deny
+>  everyone@:rwxpDdaARWcCos:---:allow
+$ getfacl -q ddd/eee/yyy
+> owner@:--x---:---:deny
+> owner@:rwxpDdaARWcCos:---:allow
+> group@:-wxp--:---:deny
+> group@:rwxpDdaARWcCos:---:allow
+>  everyone@:-wxp---A-W-Co-:---:deny
+>  everyone@:rwxpDdaARWcCos:---:allow
+
+$ rm -r ddd
___
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: r341157 - releng/12.0/sys/kern

2018-11-28 Thread Mark Johnston
Author: markj
Date: Wed Nov 28 17:40:08 2018
New Revision: 341157
URL: https://svnweb.freebsd.org/changeset/base/341157

Log:
  MFstable/12 r341077:
  Lock the knlist before releasing the in-flux state in knote_fork().
  
  PR:   228858
  Approved by:  re (gjb)

Modified:
  releng/12.0/sys/kern/kern_event.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sys/kern/kern_event.c
==
--- releng/12.0/sys/kern/kern_event.c   Wed Nov 28 17:37:17 2018
(r341156)
+++ releng/12.0/sys/kern/kern_event.c   Wed Nov 28 17:40:08 2018
(r341157)
@@ -603,10 +603,10 @@ knote_fork(struct knlist *list, int pid)
kn->kn_fflags |= NOTE_TRACKERR;
if (kn->kn_fop->f_event(kn, NOTE_FORK))
KNOTE_ACTIVATE(kn, 0);
+   list->kl_lock(list->kl_lockarg);
KQ_LOCK(kq);
kn_leave_flux(kn);
KQ_UNLOCK_FLUX(kq);
-   list->kl_lock(list->kl_lockarg);
}
list->kl_unlock(list->kl_lockarg);
 }
___
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: r341156 - in head/sys/dev: ixgbe ixl

2018-11-28 Thread Stephen Hurd
Author: shurd
Date: Wed Nov 28 17:37:17 2018
New Revision: 341156
URL: https://svnweb.freebsd.org/changeset/base/341156

Log:
  Fix first-packet completion
  
  The first packet after the ring is initialized was never
  completed as isc_txd_credits_update() would not include it in the
  count of completed packets. This caused netmap to never complete
  a batch. See PR 233022 for more details.
  
  This is the same fix as the r340310 for e1000
  
  PR:   233607
  Reported by:  lev
  Reviewed by:  lev
  MFC after:3 days
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D18368

Modified:
  head/sys/dev/ixgbe/ix_txrx.c
  head/sys/dev/ixl/ixl_txrx.c

Modified: head/sys/dev/ixgbe/ix_txrx.c
==
--- head/sys/dev/ixgbe/ix_txrx.cWed Nov 28 17:31:34 2018
(r341155)
+++ head/sys/dev/ixgbe/ix_txrx.cWed Nov 28 17:37:17 2018
(r341156)
@@ -297,6 +297,8 @@ ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid
ntxd = scctx->isc_ntxd[0];
do {
delta = (int32_t)cur - (int32_t)prev;
+   if (prev == 0 && cur == 0)
+   delta += 1;
if (delta < 0)
delta += ntxd;
 

Modified: head/sys/dev/ixl/ixl_txrx.c
==
--- head/sys/dev/ixl/ixl_txrx.c Wed Nov 28 17:31:34 2018(r341155)
+++ head/sys/dev/ixl/ixl_txrx.c Wed Nov 28 17:37:17 2018(r341156)
@@ -516,7 +516,13 @@ ixl_isc_txd_credits_update_dwb(void *arg, uint16_t txq
ntxd = scctx->isc_ntxd[0];
do {
delta = (int32_t)cur - (int32_t)prev;
+   /*
+* XXX This appears to be a hack for first-packet.
+* A correct fix would prevent prev == cur in the first place.
+*/
MPASS(prev == 0 || delta != 0);
+   if (prev == 0 && cur == 0)
+   delta += 1;
if (delta < 0)
delta += ntxd;
 #if 0
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341155 - releng/12.0/sys/kern

2018-11-28 Thread Mark Johnston
Author: markj
Date: Wed Nov 28 17:31:34 2018
New Revision: 341155
URL: https://svnweb.freebsd.org/changeset/base/341155

Log:
  MFstable/12 r341075:
  Plug some kernel memory disclosures via kevent(2).
  
  Approved by:  re (gjb)

Modified:
  releng/12.0/sys/kern/kern_event.c
  releng/12.0/sys/kern/vfs_aio.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sys/kern/kern_event.c
==
--- releng/12.0/sys/kern/kern_event.c   Wed Nov 28 17:00:18 2018
(r341154)
+++ releng/12.0/sys/kern/kern_event.c   Wed Nov 28 17:31:34 2018
(r341155)
@@ -535,8 +535,9 @@ knote_fork(struct knlist *list, int pid)
 
if (list == NULL)
return;
-   list->kl_lock(list->kl_lockarg);
 
+   memset(, 0, sizeof(kev));
+   list->kl_lock(list->kl_lockarg);
SLIST_FOREACH(kn, >kl_list, kn_selnext) {
kq = kn->kn_kq;
KQ_LOCK(kq);

Modified: releng/12.0/sys/kern/vfs_aio.c
==
--- releng/12.0/sys/kern/vfs_aio.c  Wed Nov 28 17:00:18 2018
(r341154)
+++ releng/12.0/sys/kern/vfs_aio.c  Wed Nov 28 17:31:34 2018
(r341155)
@@ -1589,6 +1589,7 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, stru
goto aqueue_fail;
}
kqfd = job->uaiocb.aio_sigevent.sigev_notify_kqueue;
+   memset(, 0, sizeof(kev));
kev.ident = (uintptr_t)job->ujob;
kev.filter = EVFILT_AIO;
kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1 | evflags;
@@ -2155,6 +2156,7 @@ kern_lio_listio(struct thread *td, int mode, struct ai
bcopy(sig, >lioj_signal, sizeof(lj->lioj_signal));
if (lj->lioj_signal.sigev_notify == SIGEV_KEVENT) {
/* Assume only new style KEVENT */
+   memset(, 0, sizeof(kev));
kev.filter = EVFILT_LIO;
kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1;
kev.ident = (uintptr_t)uacb_list; /* something unique */
___
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: r341154 - in stable/11: share/man/man9 sys/kern sys/sys

2018-11-28 Thread Mark Johnston
Author: markj
Date: Wed Nov 28 17:00:18 2018
New Revision: 341154
URL: https://svnweb.freebsd.org/changeset/base/341154

Log:
  MFC r340730, r340731:
  Add taskqueue_quiesce(9) and use it to implement taskq_wait().
  
  PR:   227784

Modified:
  stable/11/share/man/man9/Makefile
  stable/11/share/man/man9/taskqueue.9
  stable/11/sys/kern/subr_taskqueue.c
  stable/11/sys/sys/taskqueue.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man9/Makefile
==
--- stable/11/share/man/man9/Makefile   Wed Nov 28 16:58:35 2018
(r341153)
+++ stable/11/share/man/man9/Makefile   Wed Nov 28 17:00:18 2018
(r341154)
@@ -1814,6 +1814,7 @@ MLINKS+=taskqueue.9 TASK_INIT.9 \
taskqueue.9 TASKQUEUE_FAST_DEFINE_THREAD.9 \
taskqueue.9 taskqueue_free.9 \
taskqueue.9 taskqueue_member.9 \
+   taskqueue.9 taskqueue_quiesce.9 \
taskqueue.9 taskqueue_run.9 \
taskqueue.9 taskqueue_set_callback.9 \
taskqueue.9 taskqueue_start_threads.9 \

Modified: stable/11/share/man/man9/taskqueue.9
==
--- stable/11/share/man/man9/taskqueue.9Wed Nov 28 16:58:35 2018
(r341153)
+++ stable/11/share/man/man9/taskqueue.9Wed Nov 28 17:00:18 2018
(r341154)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 30, 2017
+.Dd November 21, 2018
 .Dt TASKQUEUE 9
 .Os
 .Sh NAME
@@ -94,6 +94,8 @@ struct timeout_task;
 .Ft void
 .Fn taskqueue_drain_all "struct taskqueue *queue"
 .Ft void
+.Fn taskqueue_quiesce "struct taskqueue *queue"
+.Ft void
 .Fn taskqueue_block "struct taskqueue *queue"
 .Ft void
 .Fn taskqueue_unblock "struct taskqueue *queue"
@@ -298,6 +300,12 @@ do not extend the wait time of
 and may complete after
 .Fn taskqueue_drain_all
 returns.
+The
+.Fn taskqueue_quiesce
+function is used to wait for the queue to become empty and for all
+running tasks to finish.
+To avoid blocking indefinitely, the caller must ensure by some mechanism
+that tasks will eventually stop being posted to the queue.
 .Pp
 The
 .Fn taskqueue_block

Modified: stable/11/sys/kern/subr_taskqueue.c
==
--- stable/11/sys/kern/subr_taskqueue.c Wed Nov 28 16:58:35 2018
(r341153)
+++ stable/11/sys/kern/subr_taskqueue.c Wed Nov 28 17:00:18 2018
(r341154)
@@ -344,13 +344,13 @@ taskqueue_task_nop_fn(void *context, int pending)
  * have begun execution.  Tasks queued during execution of
  * this function are ignored.
  */
-static void
+static int
 taskqueue_drain_tq_queue(struct taskqueue *queue)
 {
struct task t_barrier;
 
if (STAILQ_EMPTY(>tq_queue))
-   return;
+   return (0);
 
/*
 * Enqueue our barrier after all current tasks, but with
@@ -370,6 +370,7 @@ taskqueue_drain_tq_queue(struct taskqueue *queue)
 */
while (t_barrier.ta_pending != 0)
TQ_SLEEP(queue, _barrier, >tq_mutex, PWAIT, "-", 0);
+   return (1);
 }
 
 /*
@@ -377,13 +378,13 @@ taskqueue_drain_tq_queue(struct taskqueue *queue)
  * complete.  Tasks that begin execution during the execution
  * of this function are ignored.
  */
-static void
+static int
 taskqueue_drain_tq_active(struct taskqueue *queue)
 {
struct taskqueue_busy tb_marker, *tb_first;
 
if (TAILQ_EMPTY(>tq_active))
-   return;
+   return (0);
 
/* Block taskq_terminate().*/
queue->tq_callouts++;
@@ -410,6 +411,7 @@ taskqueue_drain_tq_active(struct taskqueue *queue)
queue->tq_callouts--;
if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0)
wakeup_one(queue->tq_threads);
+   return (1);
 }
 
 void
@@ -580,8 +582,8 @@ taskqueue_drain_all(struct taskqueue *queue)
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__);
 
TQ_LOCK(queue);
-   taskqueue_drain_tq_queue(queue);
-   taskqueue_drain_tq_active(queue);
+   (void)taskqueue_drain_tq_queue(queue);
+   (void)taskqueue_drain_tq_active(queue);
TQ_UNLOCK(queue);
 }
 
@@ -607,6 +609,20 @@ taskqueue_drain_timeout(struct taskqueue *queue,
 */
TQ_LOCK(queue);
timeout_task->f &= ~DT_DRAIN_IN_PROGRESS;
+   TQ_UNLOCK(queue);
+}
+
+void
+taskqueue_quiesce(struct taskqueue *queue)
+{
+   int ret;
+
+   TQ_LOCK(queue);
+   do {
+   ret = taskqueue_drain_tq_queue(queue);
+   if (ret == 0)
+   ret = taskqueue_drain_tq_active(queue);
+   } while (ret != 0);
TQ_UNLOCK(queue);
 }
 

Modified: stable/11/sys/sys/taskqueue.h
==
--- stable/11/sys/sys/taskqueue.h   Wed Nov 28 16:58:35 2018
(r341153)
+++ stable/11/sys/sys/taskqueue.h   Wed Nov 28 17:00:18 

svn commit: r341153 - in releng/12.0/sys: arm/arm arm64/arm64 riscv/riscv

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 16:58:35 2018
New Revision: 341153
URL: https://svnweb.freebsd.org/changeset/base/341153

Log:
  MFS r341147
  
  MFC r340995
  
  Prevent kernel stack disclosure in signal delivery
  
  On arm64 and riscv platforms, sendsig() failed to zero the signal
  frame before copying it out to userspace.  Zero it.
  
  On arm, I believe all the contents of the frame were initialized,
  so there was no disclosure.  However, explicitly zero the whole frame
  because that fact could inadvertently change in the future,
  it's more clear to the reader, and I could be wrong in the first place.
  
  Approved by:  re (gjb)
  Security: similar to FreeBSD-EN-18:12.mem and CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  releng/12.0/sys/arm/arm/machdep.c
  releng/12.0/sys/arm64/arm64/machdep.c
  releng/12.0/sys/riscv/riscv/machdep.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sys/arm/arm/machdep.c
==
--- releng/12.0/sys/arm/arm/machdep.c   Wed Nov 28 16:52:41 2018
(r341152)
+++ releng/12.0/sys/arm/arm/machdep.c   Wed Nov 28 16:58:35 2018
(r341153)
@@ -641,6 +641,7 @@ sendsig(catcher, ksi, mask)
/* make the stack aligned */
fp = (struct sigframe *)STACKALIGN(fp);
/* Populate the siginfo frame. */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
 #ifdef VFP
get_vfpcontext(td, _vfp);

Modified: releng/12.0/sys/arm64/arm64/machdep.c
==
--- releng/12.0/sys/arm64/arm64/machdep.c   Wed Nov 28 16:52:41 2018
(r341152)
+++ releng/12.0/sys/arm64/arm64/machdep.c   Wed Nov 28 16:58:35 2018
(r341153)
@@ -656,6 +656,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;

Modified: releng/12.0/sys/riscv/riscv/machdep.c
==
--- releng/12.0/sys/riscv/riscv/machdep.c   Wed Nov 28 16:52:41 2018
(r341152)
+++ releng/12.0/sys/riscv/riscv/machdep.c   Wed Nov 28 16:58:35 2018
(r341153)
@@ -583,6 +583,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
___
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: r341152 - in stable/12: share/man/man9 sys/cddl/compat/opensolaris/kern sys/kern sys/sys

2018-11-28 Thread Mark Johnston
Author: markj
Date: Wed Nov 28 16:52:41 2018
New Revision: 341152
URL: https://svnweb.freebsd.org/changeset/base/341152

Log:
  MFC r340730, r340731:
  Add taskqueue_quiesce(9) and use it to implement taskq_wait().
  
  PR:   227784

Modified:
  stable/12/share/man/man9/Makefile
  stable/12/share/man/man9/taskqueue.9
  stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
  stable/12/sys/kern/subr_taskqueue.c
  stable/12/sys/sys/taskqueue.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man9/Makefile
==
--- stable/12/share/man/man9/Makefile   Wed Nov 28 16:51:11 2018
(r341151)
+++ stable/12/share/man/man9/Makefile   Wed Nov 28 16:52:41 2018
(r341152)
@@ -2053,6 +2053,7 @@ MLINKS+=taskqueue.9 TASK_INIT.9 \
taskqueue.9 TASKQUEUE_FAST_DEFINE_THREAD.9 \
taskqueue.9 taskqueue_free.9 \
taskqueue.9 taskqueue_member.9 \
+   taskqueue.9 taskqueue_quiesce.9 \
taskqueue.9 taskqueue_run.9 \
taskqueue.9 taskqueue_set_callback.9 \
taskqueue.9 taskqueue_start_threads.9 \

Modified: stable/12/share/man/man9/taskqueue.9
==
--- stable/12/share/man/man9/taskqueue.9Wed Nov 28 16:51:11 2018
(r341151)
+++ stable/12/share/man/man9/taskqueue.9Wed Nov 28 16:52:41 2018
(r341152)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 30, 2017
+.Dd November 21, 2018
 .Dt TASKQUEUE 9
 .Os
 .Sh NAME
@@ -94,6 +94,8 @@ struct timeout_task;
 .Ft void
 .Fn taskqueue_drain_all "struct taskqueue *queue"
 .Ft void
+.Fn taskqueue_quiesce "struct taskqueue *queue"
+.Ft void
 .Fn taskqueue_block "struct taskqueue *queue"
 .Ft void
 .Fn taskqueue_unblock "struct taskqueue *queue"
@@ -298,6 +300,12 @@ do not extend the wait time of
 and may complete after
 .Fn taskqueue_drain_all
 returns.
+The
+.Fn taskqueue_quiesce
+function is used to wait for the queue to become empty and for all
+running tasks to finish.
+To avoid blocking indefinitely, the caller must ensure by some mechanism
+that tasks will eventually stop being posted to the queue.
 .Pp
 The
 .Fn taskqueue_block

Modified: stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
==
--- stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c  Wed Nov 
28 16:51:11 2018(r341151)
+++ stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c  Wed Nov 
28 16:52:41 2018(r341152)
@@ -171,11 +171,11 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void
 void
 taskq_wait(taskq_t *tq)
 {
-   taskqueue_drain_all(tq->tq_queue);
+   taskqueue_quiesce(tq->tq_queue);
 }
 
 void
 taskq_wait_id(taskq_t *tq, taskqid_t id)
 {
-taskq_wait(tq);
+   taskqueue_drain_all(tq->tq_queue);
 }

Modified: stable/12/sys/kern/subr_taskqueue.c
==
--- stable/12/sys/kern/subr_taskqueue.c Wed Nov 28 16:51:11 2018
(r341151)
+++ stable/12/sys/kern/subr_taskqueue.c Wed Nov 28 16:52:41 2018
(r341152)
@@ -346,13 +346,13 @@ taskqueue_task_nop_fn(void *context, int pending)
  * have begun execution.  Tasks queued during execution of
  * this function are ignored.
  */
-static void
+static int
 taskqueue_drain_tq_queue(struct taskqueue *queue)
 {
struct task t_barrier;
 
if (STAILQ_EMPTY(>tq_queue))
-   return;
+   return (0);
 
/*
 * Enqueue our barrier after all current tasks, but with
@@ -372,6 +372,7 @@ taskqueue_drain_tq_queue(struct taskqueue *queue)
 */
while (t_barrier.ta_pending != 0)
TQ_SLEEP(queue, _barrier, >tq_mutex, PWAIT, "-", 0);
+   return (1);
 }
 
 /*
@@ -379,13 +380,13 @@ taskqueue_drain_tq_queue(struct taskqueue *queue)
  * complete.  Tasks that begin execution during the execution
  * of this function are ignored.
  */
-static void
+static int
 taskqueue_drain_tq_active(struct taskqueue *queue)
 {
struct taskqueue_busy tb_marker, *tb_first;
 
if (TAILQ_EMPTY(>tq_active))
-   return;
+   return (0);
 
/* Block taskq_terminate().*/
queue->tq_callouts++;
@@ -412,6 +413,7 @@ taskqueue_drain_tq_active(struct taskqueue *queue)
queue->tq_callouts--;
if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0)
wakeup_one(queue->tq_threads);
+   return (1);
 }
 
 void
@@ -582,8 +584,8 @@ taskqueue_drain_all(struct taskqueue *queue)
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__);
 
TQ_LOCK(queue);
-   taskqueue_drain_tq_queue(queue);
-   taskqueue_drain_tq_active(queue);
+   (void)taskqueue_drain_tq_queue(queue);
+   (void)taskqueue_drain_tq_active(queue);
TQ_UNLOCK(queue);
 }

svn commit: r341151 - in stable/12/sys: kern sys

2018-11-28 Thread Mark Johnston
Author: markj
Date: Wed Nov 28 16:51:11 2018
New Revision: 341151
URL: https://svnweb.freebsd.org/changeset/base/341151

Log:
  MFC r340733:
  Remove KN_HASKQLOCK.

Modified:
  stable/12/sys/kern/kern_event.c
  stable/12/sys/sys/event.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_event.c
==
--- stable/12/sys/kern/kern_event.c Wed Nov 28 16:48:40 2018
(r341150)
+++ stable/12/sys/kern/kern_event.c Wed Nov 28 16:51:11 2018
(r341151)
@@ -550,10 +550,8 @@ knote_fork(struct knlist *list, int pid)
 * The same as knote(), activate the event.
 */
if ((kn->kn_sfflags & NOTE_TRACK) == 0) {
-   kn->kn_status |= KN_HASKQLOCK;
if (kn->kn_fop->f_event(kn, NOTE_FORK))
KNOTE_ACTIVATE(kn, 1);
-   kn->kn_status &= ~KN_HASKQLOCK;
KQ_UNLOCK(kq);
continue;
}
@@ -2286,10 +2284,8 @@ knote(struct knlist *list, long hint, int lockflags)
KNOTE_ACTIVATE(kn, 1);
KQ_UNLOCK_FLUX(kq);
} else {
-   kn->kn_status |= KN_HASKQLOCK;
if (kn->kn_fop->f_event(kn, hint))
KNOTE_ACTIVATE(kn, 1);
-   kn->kn_status &= ~KN_HASKQLOCK;
KQ_UNLOCK(kq);
}
}

Modified: stable/12/sys/sys/event.h
==
--- stable/12/sys/sys/event.h   Wed Nov 28 16:48:40 2018(r341150)
+++ stable/12/sys/sys/event.h   Wed Nov 28 16:51:11 2018(r341151)
@@ -294,7 +294,6 @@ struct knote {
 #define KN_DETACHED0x08/* knote is detached */
 #define KN_MARKER  0x20/* ignore this knote */
 #define KN_KQUEUE  0x40/* this knote belongs to a kq */
-#define KN_HASKQLOCK   0x80/* for _inevent */
 #defineKN_SCAN 0x100   /* flux set in 
kqueue_scan() */
int kn_influx;
int kn_sfflags; /* saved filter flags */
___
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: r341150 - stable/12/sys/kern

2018-11-28 Thread Mark Johnston
Author: markj
Date: Wed Nov 28 16:48:40 2018
New Revision: 341150
URL: https://svnweb.freebsd.org/changeset/base/341150

Log:
  MFC r339497 (by cem):
  ZSTDIO: Correctly initialize zstd context with provided 'level'

Modified:
  stable/12/sys/kern/subr_compressor.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/subr_compressor.c
==
--- stable/12/sys/kern/subr_compressor.cWed Nov 28 16:20:04 2018
(r341149)
+++ stable/12/sys/kern/subr_compressor.cWed Nov 28 16:48:40 2018
(r341150)
@@ -275,8 +275,9 @@ zstdio_init(size_t maxiosize, int level)
ZSTD_CCtx *dump_compressor;
struct zstdio_stream *s;
void *wkspc, *owkspc, *buffer;
-   size_t wkspc_size, buf_size;
+   size_t wkspc_size, buf_size, rc;
 
+   s = NULL;
wkspc_size = ZSTD_estimateCStreamSize(level);
owkspc = wkspc = malloc(wkspc_size + 8, M_COMPRESS,
M_WAITOK | M_NODUMP);
@@ -286,12 +287,23 @@ zstdio_init(size_t maxiosize, int level)
 
dump_compressor = ZSTD_initStaticCCtx(wkspc, wkspc_size);
if (dump_compressor == NULL) {
-   free(owkspc, M_COMPRESS);
printf("%s: workspace too small.\n", __func__);
-   return (NULL);
+   goto out;
}
 
-   (void)ZSTD_CCtx_setParameter(dump_compressor, ZSTD_p_checksumFlag, 1);
+   rc = ZSTD_CCtx_setParameter(dump_compressor, ZSTD_p_checksumFlag, 1);
+   if (ZSTD_isError(rc)) {
+   printf("%s: error setting checksumFlag: %s\n", __func__,
+   ZSTD_getErrorName(rc));
+   goto out;
+   }
+   rc = ZSTD_CCtx_setParameter(dump_compressor, ZSTD_p_compressionLevel,
+   level);
+   if (ZSTD_isError(rc)) {
+   printf("%s: error setting compressLevel: %s\n", __func__,
+   ZSTD_getErrorName(rc));
+   goto out;
+   }
 
buf_size = ZSTD_CStreamOutSize() * 2;
buffer = malloc(buf_size, M_COMPRESS, M_WAITOK | M_NODUMP);
@@ -306,6 +318,9 @@ zstdio_init(size_t maxiosize, int level)
 
zstdio_reset(s);
 
+out:
+   if (s == NULL)
+   free(owkspc, M_COMPRESS);
return (s);
 }
 
___
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: r341149 - in releng/12.0/sys: amd64/ia32 mips/mips powerpc/powerpc

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 16:20:04 2018
New Revision: 341149
URL: https://svnweb.freebsd.org/changeset/base/341149

Log:
  MFS r341146
  
  MFC r340994
  
  Prevent kernel stack disclosure in getcontext/swapcontext
  
  Expand r338982 to cover freebsd32 interfaces on amd64, mips, and powerpc.
  
  Approved by:  re (gjb)
  Security: FreeBSD-EN-18:12.mem
  Security: CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  releng/12.0/sys/amd64/ia32/ia32_signal.c
  releng/12.0/sys/mips/mips/freebsd32_machdep.c
  releng/12.0/sys/powerpc/powerpc/exec_machdep.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sys/amd64/ia32/ia32_signal.c
==
--- releng/12.0/sys/amd64/ia32/ia32_signal.cWed Nov 28 16:00:52 2018
(r341148)
+++ releng/12.0/sys/amd64/ia32/ia32_signal.cWed Nov 28 16:20:04 2018
(r341149)
@@ -261,6 +261,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -301,6 +302,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: releng/12.0/sys/mips/mips/freebsd32_machdep.c
==
--- releng/12.0/sys/mips/mips/freebsd32_machdep.c   Wed Nov 28 16:00:52 
2018(r341148)
+++ releng/12.0/sys/mips/mips/freebsd32_machdep.c   Wed Nov 28 16:20:04 
2018(r341149)
@@ -294,6 +294,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -333,6 +334,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: releng/12.0/sys/powerpc/powerpc/exec_machdep.c
==
--- releng/12.0/sys/powerpc/powerpc/exec_machdep.c  Wed Nov 28 16:00:52 
2018(r341148)
+++ releng/12.0/sys/powerpc/powerpc/exec_machdep.c  Wed Nov 28 16:20:04 
2018(r341149)
@@ -783,6 +783,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -822,6 +823,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
___
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: r341148 - in head/sys/powerpc: aim include powerpc

2018-11-28 Thread Justin Hibbits
Author: jhibbits
Date: Wed Nov 28 16:00:52 2018
New Revision: 341148
URL: https://svnweb.freebsd.org/changeset/base/341148

Log:
  powerpc: Don't include KERNBASE in genassym, it's unnecessary
  
  A related future change, which changes KERNBASE for Book-E for some reason
  causes a "KERNBASE redefined" error with assym.inc, even though it only 
changed
  the value of KERNBASE and nothing else.  Since machine/vmparam.h is already
  included in booke/locore.S, and the requisite guards are already in place for
  properly handling KERNBASE in vmparam.h, just remove it from genassym, and
  include vmparam.h in the AIM locore files.

Modified:
  head/sys/powerpc/aim/locore32.S
  head/sys/powerpc/aim/locore64.S
  head/sys/powerpc/include/vmparam.h
  head/sys/powerpc/powerpc/genassym.c

Modified: head/sys/powerpc/aim/locore32.S
==
--- head/sys/powerpc/aim/locore32.S Wed Nov 28 15:34:46 2018
(r341147)
+++ head/sys/powerpc/aim/locore32.S Wed Nov 28 16:00:52 2018
(r341148)
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "opt_platform.h"
 
 /* Locate the per-CPU data structure */

Modified: head/sys/powerpc/aim/locore64.S
==
--- head/sys/powerpc/aim/locore64.S Wed Nov 28 15:34:46 2018
(r341147)
+++ head/sys/powerpc/aim/locore64.S Wed Nov 28 16:00:52 2018
(r341148)
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef _CALL_ELF
 .abiversion _CALL_ELF

Modified: head/sys/powerpc/include/vmparam.h
==
--- head/sys/powerpc/include/vmparam.h  Wed Nov 28 15:34:46 2018
(r341147)
+++ head/sys/powerpc/include/vmparam.h  Wed Nov 28 16:00:52 2018
(r341148)
@@ -117,7 +117,7 @@
 #endif
 
 #ifdef AIM
-#defineKERNBASE0x00100100UL/* start of kernel 
virtual */
+#defineKERNBASE0x00100100  /* start of kernel 
virtual */
 
 #ifndef __powerpc64__
 #defineVM_MIN_KERNEL_ADDRESS   ((vm_offset_t)KERNEL_SR << ADDR_SR_SHFT)

Modified: head/sys/powerpc/powerpc/genassym.c
==
--- head/sys/powerpc/powerpc/genassym.c Wed Nov 28 15:34:46 2018
(r341147)
+++ head/sys/powerpc/powerpc/genassym.c Wed Nov 28 16:00:52 2018
(r341148)
@@ -225,7 +225,6 @@ ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
 
 ASSYM(SF_UC, offsetof(struct sigframe, sf_uc));
 
-ASSYM(KERNBASE, KERNBASE);
 ASSYM(DMAP_BASE_ADDRESS, DMAP_BASE_ADDRESS);
 ASSYM(MAXCOMLEN, MAXCOMLEN);
 
___
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: r341147 - in stable/12/sys: arm/arm arm64/arm64 riscv/riscv

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 15:34:46 2018
New Revision: 341147
URL: https://svnweb.freebsd.org/changeset/base/341147

Log:
  MFC r340995
  
  Prevent kernel stack disclosure in signal delivery
  
  On arm64 and riscv platforms, sendsig() failed to zero the signal
  frame before copying it out to userspace.  Zero it.
  
  On arm, I believe all the contents of the frame were initialized,
  so there was no disclosure.  However, explicitly zero the whole frame
  because that fact could inadvertently change in the future,
  it's more clear to the reader, and I could be wrong in the first place.
  
  Security: similar to FreeBSD-EN-18:12.mem and CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sys/arm/arm/machdep.c
  stable/12/sys/arm64/arm64/machdep.c
  stable/12/sys/riscv/riscv/machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/arm/machdep.c
==
--- stable/12/sys/arm/arm/machdep.c Wed Nov 28 15:31:05 2018
(r341146)
+++ stable/12/sys/arm/arm/machdep.c Wed Nov 28 15:34:46 2018
(r341147)
@@ -641,6 +641,7 @@ sendsig(catcher, ksi, mask)
/* make the stack aligned */
fp = (struct sigframe *)STACKALIGN(fp);
/* Populate the siginfo frame. */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
 #ifdef VFP
get_vfpcontext(td, _vfp);

Modified: stable/12/sys/arm64/arm64/machdep.c
==
--- stable/12/sys/arm64/arm64/machdep.c Wed Nov 28 15:31:05 2018
(r341146)
+++ stable/12/sys/arm64/arm64/machdep.c Wed Nov 28 15:34:46 2018
(r341147)
@@ -656,6 +656,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;

Modified: stable/12/sys/riscv/riscv/machdep.c
==
--- stable/12/sys/riscv/riscv/machdep.c Wed Nov 28 15:31:05 2018
(r341146)
+++ stable/12/sys/riscv/riscv/machdep.c Wed Nov 28 15:34:46 2018
(r341147)
@@ -583,6 +583,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
fp = (struct sigframe *)STACKALIGN(fp);
 
/* Fill in the frame to copy out */
+   bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
___
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: r341146 - in stable/12/sys: amd64/ia32 mips/mips powerpc/powerpc

2018-11-28 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Nov 28 15:31:05 2018
New Revision: 341146
URL: https://svnweb.freebsd.org/changeset/base/341146

Log:
  MFC r340994
  
  Prevent kernel stack disclosure in getcontext/swapcontext
  
  Expand r338982 to cover freebsd32 interfaces on amd64, mips, and powerpc.
  
  Security: FreeBSD-EN-18:12.mem
  Security: CVE-2018-17155
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sys/amd64/ia32/ia32_signal.c
  stable/12/sys/mips/mips/freebsd32_machdep.c
  stable/12/sys/powerpc/powerpc/exec_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/ia32/ia32_signal.c
==
--- stable/12/sys/amd64/ia32/ia32_signal.c  Wed Nov 28 15:29:58 2018
(r341145)
+++ stable/12/sys/amd64/ia32/ia32_signal.c  Wed Nov 28 15:31:05 2018
(r341146)
@@ -261,6 +261,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -301,6 +302,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
ia32_get_mcontext(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: stable/12/sys/mips/mips/freebsd32_machdep.c
==
--- stable/12/sys/mips/mips/freebsd32_machdep.c Wed Nov 28 15:29:58 2018
(r341145)
+++ stable/12/sys/mips/mips/freebsd32_machdep.c Wed Nov 28 15:31:05 2018
(r341146)
@@ -294,6 +294,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -333,6 +334,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;

Modified: stable/12/sys/powerpc/powerpc/exec_machdep.c
==
--- stable/12/sys/powerpc/powerpc/exec_machdep.cWed Nov 28 15:29:58 
2018(r341145)
+++ stable/12/sys/powerpc/powerpc/exec_machdep.cWed Nov 28 15:31:05 
2018(r341146)
@@ -783,6 +783,7 @@ freebsd32_getcontext(struct thread *td, struct freebsd
if (uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
@@ -822,6 +823,7 @@ freebsd32_swapcontext(struct thread *td, struct freebs
if (uap->oucp == NULL || uap->ucp == NULL)
ret = EINVAL;
else {
+   bzero(, sizeof(uc));
get_mcontext32(td, _mcontext, GET_MC_CLEAR_RET);
PROC_LOCK(td->td_proc);
uc.uc_sigmask = td->td_sigmask;
___
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: r341145 - head/sys/dev/cxgbe

2018-11-28 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Nov 28 15:29:58 2018
New Revision: 341145
URL: https://svnweb.freebsd.org/changeset/base/341145

Log:
  cxgbe: revert r309725
  
  After the fix contained in r341144, cxgbe does not need anymore
  to set the IFCAP_NETMAP flag manually.
  
  Reviewed by:  np
  Approved by:  gnn (mentor)
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D17987

Modified:
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_netmap.c

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cWed Nov 28 14:07:34 2018
(r341144)
+++ head/sys/dev/cxgbe/t4_main.cWed Nov 28 15:29:58 2018
(r341145)
@@ -1633,10 +1633,6 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi)
if (vi->nofldrxq != 0)
ifp->if_capabilities |= IFCAP_TOE;
 #endif
-#ifdef DEV_NETMAP
-   if (vi->nnmrxq != 0)
-   ifp->if_capabilities |= IFCAP_NETMAP;
-#endif
 #ifdef RATELIMIT
if (is_ethoffload(vi->pi->adapter) && vi->nofldtxq != 0) {
ifp->if_capabilities |= IFCAP_TXRTLMT;
@@ -1656,7 +1652,7 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi)
 
ether_ifattach(ifp, vi->hw_addr);
 #ifdef DEV_NETMAP
-   if (ifp->if_capabilities & IFCAP_NETMAP)
+   if (vi->nnmrxq != 0)
cxgbe_nm_attach(vi);
 #endif
sb = sbuf_new_auto();

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Wed Nov 28 14:07:34 2018
(r341144)
+++ head/sys/dev/cxgbe/t4_netmap.c  Wed Nov 28 15:29:58 2018
(r341145)
@@ -982,7 +982,7 @@ cxgbe_nm_attach(struct vi_info *vi)
na.nm_register = cxgbe_netmap_reg;
na.num_tx_rings = vi->nnmtxq;
na.num_rx_rings = vi->nnmrxq;
-   netmap_attach();
+   netmap_attach(); /* This adds IFCAP_NETMAP to if_capabilities */
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341144 - head/sys/dev/netmap

2018-11-28 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Nov 28 14:07:34 2018
New Revision: 341144
URL: https://svnweb.freebsd.org/changeset/base/341144

Log:
  netmap: set IFCAP_NETMAP in if_capabilities
  
  Revision r307394 removed (by mistake) the code that sets IFCAP_NETMAP
  in if_capabilities on netmap_attach. This patch reverts this change.
  
  Reviewed by:  np
  Approved by:  gnn (mentor)
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D17987

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

Modified: head/sys/dev/netmap/netmap_freebsd.c
==
--- head/sys/dev/netmap/netmap_freebsd.cWed Nov 28 13:54:39 2018
(r341143)
+++ head/sys/dev/netmap/netmap_freebsd.cWed Nov 28 14:07:34 2018
(r341144)
@@ -1549,6 +1549,7 @@ out:
 void
 nm_os_onattach(struct ifnet *ifp)
 {
+   ifp->if_capabilities |= IFCAP_NETMAP;
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341143 - head/sys/arm64/conf

2018-11-28 Thread Emmanuel Vadot
Author: manu
Date: Wed Nov 28 13:54:39 2018
New Revision: 341143
URL: https://svnweb.freebsd.org/changeset/base/341143

Log:
  arm64: Add rk_i2c and rk805 to GENERIC
  
  MFC after:1 month

Modified:
  head/sys/arm64/conf/GENERIC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Wed Nov 28 13:53:43 2018(r341142)
+++ head/sys/arm64/conf/GENERIC Wed Nov 28 13:54:39 2018(r341143)
@@ -209,6 +209,7 @@ device  bcm2835_bsc # Broadcom BCM283x I2C 
bus
 device iicbus
 device iic
 device twsi# Allwinner I2C controller
+device rk_i2c  # RockChip I2C controller
 
 # Clock and reset controllers
 device aw_ccu  # Allwinner clock controller
@@ -225,6 +226,7 @@ device  aw_wdog # Allwinner Watchdog
 
 # Power management controllers
 device axp81x  # X-Powers AXP81x PMIC
+device rk805   # RockChip RK805 PMIC
 
 # EFUSE
 device aw_sid  # Allwinner Secure ID EFUSE
___
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: r341142 - in head/sys: arm64/rockchip conf modules/rockchip modules/rockchip/rk805

2018-11-28 Thread Emmanuel Vadot
Author: manu
Date: Wed Nov 28 13:53:43 2018
New Revision: 341142
URL: https://svnweb.freebsd.org/changeset/base/341142

Log:
  Add RK805 PMIC Support
  
  RK805 is the companion PMIC for RK3328 SoC.
  Add a driver for it with most of it's regulators supported.
  
  MFC after:1 month

Added:
  head/sys/arm64/rockchip/rk805.c   (contents, props changed)
  head/sys/arm64/rockchip/rk805reg.h   (contents, props changed)
  head/sys/modules/rockchip/rk805/
  head/sys/modules/rockchip/rk805/Makefile   (contents, props changed)
Modified:
  head/sys/conf/files.arm64
  head/sys/modules/rockchip/Makefile

Added: head/sys/arm64/rockchip/rk805.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/rockchip/rk805.c Wed Nov 28 13:53:43 2018
(r341142)
@@ -0,0 +1,422 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2018 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include "regdev_if.h"
+
+MALLOC_DEFINE(M_RK805_REG, "RK805 regulator", "RK805 power regulator");
+
+static struct ofw_compat_data compat_data[] = {
+   {"rockchip,rk805", 1},
+   {NULL, 0}
+};
+
+struct rk805_regdef {
+   intptr_tid;
+   char*name;
+   uint8_t enable_reg;
+   uint8_t enable_mask;
+   uint8_t voltage_reg;
+   uint8_t voltage_mask;
+   int voltage_min;
+   int voltage_max;
+   int voltage_step;
+   int voltage_nstep;
+};
+
+struct rk805_reg_sc {
+   struct regnode  *regnode;
+   device_tbase_dev;
+   struct rk805_regdef *def;
+   phandle_t   xref;
+   struct regnode_std_param *param;
+};
+
+struct rk805_softc {
+   device_tdev;
+   struct mtx  mtx;
+   struct resource *   res[1];
+   void *  intrcookie;
+   struct intr_config_hook intr_hook;
+
+   struct rk805_reg_sc **regs;
+   int nregs;
+};
+
+static struct rk805_regdef rk805_regdefs[] = {
+   {
+   .id = RK805_DCDC1,
+   .name = "DCDC_REG1",
+   .enable_reg = RK805_DCDC_EN,
+   .enable_mask = 0x11,
+   .voltage_reg = RK805_DCDC1_ON_VSEL,
+   .voltage_mask = 0x3F,
+   .voltage_min = 712500,
+   .voltage_max = 145,
+   .voltage_step = 12500,
+   .voltage_nstep = 64,
+   },
+   {
+   .id = RK805_DCDC2,
+   .name = "DCDC_REG2",
+   .enable_reg = RK805_DCDC_EN,
+   .enable_mask = 0x22,
+   .voltage_reg = RK805_DCDC2_ON_VSEL,
+   .voltage_mask = 0x3F,
+   .voltage_min = 712500,
+   .voltage_max = 145,
+   .voltage_step = 12500,
+   .voltage_nstep = 64,
+   },
+   {
+   .id = RK805_DCDC3,
+   .name = "DCDC_REG3",
+   .enable_reg = RK805_DCDC_EN,
+   .enable_mask = 0x44,
+   },
+   {
+   .id = RK805_DCDC4,
+   .name = "DCDC_REG4",
+   .enable_reg = RK805_DCDC_EN,
+   .enable_mask = 0x88,
+   

svn commit: r341140 - head/sys/mips/conf

2018-11-28 Thread Sean Bruno
Author: sbruno
Date: Wed Nov 28 13:25:10 2018
New Revision: 341140
URL: https://svnweb.freebsd.org/changeset/base/341140

Log:
  Add CAPABILITIES to the ERL kernel config so that tools that have been
  modified with Capsicum work on this target platform.
  
  This came up after the conversion of wc(8).

Modified:
  head/sys/mips/conf/ERL

Modified: head/sys/mips/conf/ERL
==
--- head/sys/mips/conf/ERL  Wed Nov 28 11:58:40 2018(r341139)
+++ head/sys/mips/conf/ERL  Wed Nov 28 13:25:10 2018(r341140)
@@ -91,6 +91,8 @@ options   KDTRACE_HOOKS   # Kernel DTrace hooks
 optionsDDB_CTF # Kernel ELF linker loads CTF data
 optionsINCLUDE_CONFIG_FILE # Include this file in kernel
 optionsTMPFS   # Temporary file system
+optionsCAPABILITY_MODE # Capsicum capability mode
+optionsCAPABILITIES# Capsicum capabilities
 
 # Debugging for use in -current
 #options   KDB # Enable kernel debugger support.
___
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: r341141 - head/sys/arm64/rockchip/clk

2018-11-28 Thread Emmanuel Vadot
Author: manu
Date: Wed Nov 28 13:25:22 2018
New Revision: 341141
URL: https://svnweb.freebsd.org/changeset/base/341141

Log:
  rk_clk_composite: Fix set_mux
  
  Pointy Hat: manu

Modified:
  head/sys/arm64/rockchip/clk/rk_clk_composite.c

Modified: head/sys/arm64/rockchip/clk/rk_clk_composite.c
==
--- head/sys/arm64/rockchip/clk/rk_clk_composite.c  Wed Nov 28 13:25:10 
2018(r341140)
+++ head/sys/arm64/rockchip/clk/rk_clk_composite.c  Wed Nov 28 13:25:22 
2018(r341141)
@@ -126,7 +126,7 @@ rk_clk_composite_set_mux(struct clknode *clk, int inde
 
DEVICE_LOCK(clk);
READ4(clk, sc->muxdiv_offset, );
-   val &= ~(sc->mux_mask >> sc->mux_shift);
+   val &= ~sc->mux_mask;
val |= index << sc->mux_shift;
WRITE4(clk, sc->muxdiv_offset, val);
DEVICE_UNLOCK(clk);
___
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: r341139 - stable/12/sys/net

2018-11-28 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Nov 28 11:58:40 2018
New Revision: 341139
URL: https://svnweb.freebsd.org/changeset/base/341139

Log:
  MFC r340724:
  
  Unbreak kernel build with VLAN_ARRAY defined.

Modified:
  stable/12/sys/net/if_vlan.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/if_vlan.c
==
--- stable/12/sys/net/if_vlan.c Wed Nov 28 09:25:43 2018(r341138)
+++ stable/12/sys/net/if_vlan.c Wed Nov 28 11:58:40 2018(r341139)
@@ -314,15 +314,15 @@ VNET_DEFINE_STATIC(struct if_clone *, vlan_cloner);
 #defineV_vlan_cloner   VNET(vlan_cloner)
 #endif
 
-#ifndef VLAN_ARRAY
-#define HASH(n, m) n) >> 8) ^ ((n) >> 4) ^ (n)) & (m))
-
 static void
 vlan_mc_free(struct epoch_context *ctx)
 {
struct vlan_mc_entry *mc = __containerof(ctx, struct vlan_mc_entry, 
mc_epoch_ctx);
free(mc, M_VLAN);
 }
+
+#ifndef VLAN_ARRAY
+#define HASH(n, m) n) >> 8) ^ ((n) >> 4) ^ (n)) & (m))
 
 static void
 vlan_inithash(struct ifvlantrunk *trunk)
___
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: r341137 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:25:31 2018
New Revision: 341137
URL: https://svnweb.freebsd.org/changeset/base/341137

Log:
  sfxge(4): add encapsulated TSOv2 capability
  
  Submitted by:   Vijay Srivastava 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18212

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

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cWed Nov 28 09:25:21 2018
(r341136)
+++ head/sys/dev/sfxge/common/ef10_nic.cWed Nov 28 09:25:31 2018
(r341137)
@@ -1084,6 +1084,12 @@ ef10_get_datapath_caps(
encp->enc_fw_assisted_tso_v2_n_contexts = 0;
}
 
+   /* Check if the firmware supports FATSOv2 encap */
+   if (CAP_FLAGS2(req, TX_TSO_V2_ENCAP))
+   encp->enc_fw_assisted_tso_v2_encap_enabled = B_TRUE;
+   else
+   encp->enc_fw_assisted_tso_v2_encap_enabled = B_FALSE;
+
/* Check if the firmware has vadapter/vport/vswitch support */
if (CAP_FLAGS1(req, EVB))
encp->enc_datapath_cap_evb = B_TRUE;

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Wed Nov 28 09:25:21 2018
(r341136)
+++ head/sys/dev/sfxge/common/efx.h Wed Nov 28 09:25:31 2018
(r341137)
@@ -1258,6 +1258,7 @@ typedef struct efx_nic_cfg_s {
uint32_tenc_tx_tso_tcp_header_offset_limit;
boolean_t   enc_fw_assisted_tso_enabled;
boolean_t   enc_fw_assisted_tso_v2_enabled;
+   boolean_t   enc_fw_assisted_tso_v2_encap_enabled;
/* Number of TSO contexts on the NIC (FATSOv2) */
uint32_tenc_fw_assisted_tso_v2_n_contexts;
boolean_t   enc_hw_tx_insert_vlan_enabled;
___
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: r341134 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:24:58 2018
New Revision: 341134
URL: https://svnweb.freebsd.org/changeset/base/341134

Log:
  sfxge(4): add bit to indicate CTPIO availability
  
  Submitted by:   Guido Barzini 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18209

Modified:
  head/sys/dev/sfxge/common/efx_regs_mcdi.h

Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Nov 28 09:24:47 2018
(r341133)
+++ head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Nov 28 09:24:58 2018
(r341134)
@@ -9578,6 +9578,8 @@
 #defineMC_CMD_GET_CAPABILITIES_V2_OUT_MCDI_BACKGROUND_WIDTH 1
 #defineMC_CMD_GET_CAPABILITIES_V2_OUT_MCDI_DB_RETURN_LBN 14
 #defineMC_CMD_GET_CAPABILITIES_V2_OUT_MCDI_DB_RETURN_WIDTH 1
+#defineMC_CMD_GET_CAPABILITIES_V2_OUT_CTPIO_LBN 15
+#defineMC_CMD_GET_CAPABILITIES_V2_OUT_CTPIO_WIDTH 1
 /* Number of FATSOv2 contexts per datapath supported by this NIC. Not present
  * on older firmware (check the length).
  */
@@ -9865,6 +9867,8 @@
 #defineMC_CMD_GET_CAPABILITIES_V3_OUT_MCDI_BACKGROUND_WIDTH 1
 #defineMC_CMD_GET_CAPABILITIES_V3_OUT_MCDI_DB_RETURN_LBN 14
 #defineMC_CMD_GET_CAPABILITIES_V3_OUT_MCDI_DB_RETURN_WIDTH 1
+#defineMC_CMD_GET_CAPABILITIES_V3_OUT_CTPIO_LBN 15
+#defineMC_CMD_GET_CAPABILITIES_V3_OUT_CTPIO_WIDTH 1
 /* Number of FATSOv2 contexts per datapath supported by this NIC. Not present
  * on older firmware (check the length).
  */
@@ -10177,6 +10181,8 @@
 #defineMC_CMD_GET_CAPABILITIES_V4_OUT_MCDI_BACKGROUND_WIDTH 1
 #defineMC_CMD_GET_CAPABILITIES_V4_OUT_MCDI_DB_RETURN_LBN 14
 #defineMC_CMD_GET_CAPABILITIES_V4_OUT_MCDI_DB_RETURN_WIDTH 1
+#defineMC_CMD_GET_CAPABILITIES_V4_OUT_CTPIO_LBN 15
+#defineMC_CMD_GET_CAPABILITIES_V4_OUT_CTPIO_WIDTH 1
 /* Number of FATSOv2 contexts per datapath supported by this NIC. Not present
  * on older firmware (check the length).
  */
___
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: r341138 - in head/sys/dev/sfxge: . common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:25:43 2018
New Revision: 341138
URL: https://svnweb.freebsd.org/changeset/base/341138

Log:
  sfxge(4): add outer IP ID parameter to TSOv2 descriptor
  
  Set outer_ip_id in the TX option descriptor for encapsulated packets.
  
  Submitted by:   Vijay Srivastava 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18213

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_tx.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_tx.c
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Wed Nov 28 09:25:31 2018
(r341137)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Wed Nov 28 09:25:43 2018
(r341138)
@@ -782,6 +782,7 @@ extern  void
 ef10_tx_qdesc_tso2_create(
__inefx_txq_t *etp,
__inuint16_t ipv4_id,
+   __inuint16_t outer_ipv4_id,
__inuint32_t tcp_seq,
__inuint16_t tcp_mss,
__out_ecount(count) efx_desc_t *edp,

Modified: head/sys/dev/sfxge/common/ef10_tx.c
==
--- head/sys/dev/sfxge/common/ef10_tx.c Wed Nov 28 09:25:31 2018
(r341137)
+++ head/sys/dev/sfxge/common/ef10_tx.c Wed Nov 28 09:25:43 2018
(r341138)
@@ -650,6 +650,7 @@ ef10_tx_qdesc_tso_create(
 ef10_tx_qdesc_tso2_create(
__inefx_txq_t *etp,
__inuint16_t ipv4_id,
+   __inuint16_t outer_ipv4_id,
__inuint32_t tcp_seq,
__inuint16_t tcp_mss,
__out_ecount(count) efx_desc_t *edp,
@@ -671,13 +672,14 @@ ef10_tx_qdesc_tso2_create(
ESE_DZ_TX_TSO_OPTION_DESC_FATSO2A,
ESF_DZ_TX_TSO_IP_ID, ipv4_id,
ESF_DZ_TX_TSO_TCP_SEQNO, tcp_seq);
-   EFX_POPULATE_QWORD_4(edp[1].ed_eq,
+   EFX_POPULATE_QWORD_5(edp[1].ed_eq,
ESF_DZ_TX_DESC_IS_OPT, 1,
ESF_DZ_TX_OPTION_TYPE,
ESE_DZ_TX_OPTION_DESC_TSO,
ESF_DZ_TX_TSO_OPTION_TYPE,
ESE_DZ_TX_TSO_OPTION_DESC_FATSO2B,
-   ESF_DZ_TX_TSO_TCP_MSS, tcp_mss);
+   ESF_DZ_TX_TSO_TCP_MSS, tcp_mss,
+   ESF_DZ_TX_TSO_OUTER_IPID, outer_ipv4_id);
 }
 
void

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Wed Nov 28 09:25:31 2018
(r341137)
+++ head/sys/dev/sfxge/common/efx.h Wed Nov 28 09:25:43 2018
(r341138)
@@ -2323,6 +2323,7 @@ externvoid
 efx_tx_qdesc_tso2_create(
__inefx_txq_t *etp,
__inuint16_t ipv4_id,
+   __inuint16_t outer_ipv4_id,
__inuint32_t tcp_seq,
__inuint16_t tcp_mss,
__out_ecount(count) efx_desc_t *edp,

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hWed Nov 28 09:25:31 2018
(r341137)
+++ head/sys/dev/sfxge/common/efx_impl.hWed Nov 28 09:25:43 2018
(r341138)
@@ -145,7 +145,7 @@ typedef struct efx_tx_ops_s {
uint32_t, uint8_t,
efx_desc_t *);
void(*etxo_qdesc_tso2_create)(efx_txq_t *, uint16_t,
-   uint32_t, uint16_t,
+   uint16_t, uint32_t, uint16_t,
efx_desc_t *, int);
void(*etxo_qdesc_vlantci_create)(efx_txq_t *, uint16_t,
efx_desc_t *);

Modified: head/sys/dev/sfxge/common/efx_tx.c
==
--- head/sys/dev/sfxge/common/efx_tx.c  Wed Nov 28 09:25:31 2018
(r341137)
+++ head/sys/dev/sfxge/common/efx_tx.c  Wed Nov 28 09:25:43 2018
(r341138)
@@ -654,6 +654,7 @@ efx_tx_qdesc_tso_create(
 efx_tx_qdesc_tso2_create(
__inefx_txq_t *etp,
__inuint16_t ipv4_id,
+   __inuint16_t outer_ipv4_id,
__inuint32_t tcp_seq,
__inuint16_t mss,

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:24:25 2018
New Revision: 341131
URL: https://svnweb.freebsd.org/changeset/base/341131

Log:
  sfxge(4): document the event type for CTPIO sends
  
  Document the TX_EV_TYPE used for TX completion events corresponding
  to CTPIO sends.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18206

Modified:
  head/sys/dev/sfxge/common/efx_regs_mcdi.h

Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Nov 28 09:24:14 2018
(r341130)
+++ head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Nov 28 09:24:25 2018
(r341131)
@@ -6751,6 +6751,10 @@
 #defineTX_TIMESTAMP_EVENT_TX_EV_TYPE_LEN 1
 /* enum: This is a TX completion event, not a timestamp */
 #defineTX_TIMESTAMP_EVENT_TX_EV_COMPLETION  0x0
+/* enum: This is a TX completion event for a CTPIO transmit. The event format
+ * is the same as for TX_EV_COMPLETION.
+ */
+#defineTX_TIMESTAMP_EVENT_TX_EV_CTPIO_COMPLETION  0x11
 /* enum: This is the low part of a TX timestamp event */
 #defineTX_TIMESTAMP_EVENT_TX_EV_TSTAMP_LO  0x51
 /* enum: This is the high part of a TX timestamp event */
___
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: r341135 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:25:09 2018
New Revision: 341135
URL: https://svnweb.freebsd.org/changeset/base/341135

Log:
  sfxge(4): regenerate headers to pick up CTPIO stats
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18210

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

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Wed Nov 28 09:24:58 2018
(r341134)
+++ head/sys/dev/sfxge/common/efx.h Wed Nov 28 09:25:09 2018
(r341135)
@@ -351,7 +351,7 @@ efx_intr_fini(
 
 #if EFSYS_OPT_MAC_STATS
 
-/* START MKCONFIG GENERATED EfxHeaderMacBlock 7b5f45054a3b45bc */
+/* START MKCONFIG GENERATED EfxHeaderMacBlock 7d59c0d68431a5d1 */
 typedef enum efx_mac_stat_e {
EFX_MAC_RX_OCTETS,
EFX_MAC_RX_PKTS,
@@ -440,6 +440,22 @@ typedef enum efx_mac_stat_e {
EFX_MAC_FEC_CORRECTED_SYMBOLS_LANE1,
EFX_MAC_FEC_CORRECTED_SYMBOLS_LANE2,
EFX_MAC_FEC_CORRECTED_SYMBOLS_LANE3,
+   EFX_MAC_CTPIO_VI_BUSY_FALLBACK,
+   EFX_MAC_CTPIO_LONG_WRITE_SUCCESS,
+   EFX_MAC_CTPIO_MISSING_DBELL_FAIL,
+   EFX_MAC_CTPIO_OVERFLOW_FAIL,
+   EFX_MAC_CTPIO_UNDERFLOW_FAIL,
+   EFX_MAC_CTPIO_TIMEOUT_FAIL,
+   EFX_MAC_CTPIO_NONCONTIG_WR_FAIL,
+   EFX_MAC_CTPIO_FRM_CLOBBER_FAIL,
+   EFX_MAC_CTPIO_INVALID_WR_FAIL,
+   EFX_MAC_CTPIO_VI_CLOBBER_FALLBACK,
+   EFX_MAC_CTPIO_UNQUALIFIED_FALLBACK,
+   EFX_MAC_CTPIO_RUNT_FALLBACK,
+   EFX_MAC_CTPIO_SUCCESS,
+   EFX_MAC_CTPIO_FALLBACK,
+   EFX_MAC_CTPIO_POISON,
+   EFX_MAC_CTPIO_ERASE,
EFX_MAC_NSTATS
 } efx_mac_stat_t;
 

Modified: head/sys/dev/sfxge/common/efx_mac.c
==
--- head/sys/dev/sfxge/common/efx_mac.c Wed Nov 28 09:24:58 2018
(r341134)
+++ head/sys/dev/sfxge/common/efx_mac.c Wed Nov 28 09:25:09 2018
(r341135)
@@ -521,7 +521,7 @@ efx_mac_filter_default_rxq_clear(
 
 #if EFSYS_OPT_NAMES
 
-/* START MKCONFIG GENERATED EfxMacStatNamesBlock 8726fc355b6e7c1a */
+/* START MKCONFIG GENERATED EfxMacStatNamesBlock 3cfa8780abd28993 */
 static const char * const __efx_mac_stat_name[] = {
"rx_octets",
"rx_pkts",
@@ -610,6 +610,22 @@ static const char * const __efx_mac_stat_name[] = {
"fec_corrected_symbols_lane1",
"fec_corrected_symbols_lane2",
"fec_corrected_symbols_lane3",
+   "ctpio_vi_busy_fallback",
+   "ctpio_long_write_success",
+   "ctpio_missing_dbell_fail",
+   "ctpio_overflow_fail",
+   "ctpio_underflow_fail",
+   "ctpio_timeout_fail",
+   "ctpio_noncontig_wr_fail",
+   "ctpio_frm_clobber_fail",
+   "ctpio_invalid_wr_fail",
+   "ctpio_vi_clobber_fallback",
+   "ctpio_unqualified_fallback",
+   "ctpio_runt_fallback",
+   "ctpio_success",
+   "ctpio_fallback",
+   "ctpio_poison",
+   "ctpio_erase",
 };
 /* END MKCONFIG GENERATED EfxMacStatNamesBlock */
 
___
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: r341130 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:24:14 2018
New Revision: 341130
URL: https://svnweb.freebsd.org/changeset/base/341130

Log:
  sfxge(4): add 1.3V voltage and current sensors
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18205

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

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Wed Nov 28 09:24:03 2018
(r341129)
+++ head/sys/dev/sfxge/common/efx.h Wed Nov 28 09:24:14 2018
(r341130)
@@ -655,7 +655,7 @@ efx_mon_init(
 #defineEFX_MON_STATS_PAGE_SIZE 0x100
 #defineEFX_MON_MASK_ELEMENT_SIZE 32
 
-/* START MKCONFIG GENERATED MonitorHeaderStatsBlock fcc1b6748432e1ac */
+/* START MKCONFIG GENERATED MonitorHeaderStatsBlock 400fdb0517af1fca */
 typedef enum efx_mon_stat_e {
EFX_MON_STAT_2_5V,
EFX_MON_STAT_VCCP1,
@@ -738,6 +738,8 @@ typedef enum efx_mon_stat_e {
EFX_MON_STAT_I2V5,
EFX_MON_STAT_I3V3,
EFX_MON_STAT_I12V0,
+   EFX_MON_STAT_1_3V,
+   EFX_MON_STAT_I1V3,
EFX_MON_NSTATS
 } efx_mon_stat_t;
 

Modified: head/sys/dev/sfxge/common/efx_mon.c
==
--- head/sys/dev/sfxge/common/efx_mon.c Wed Nov 28 09:24:03 2018
(r341129)
+++ head/sys/dev/sfxge/common/efx_mon.c Wed Nov 28 09:24:14 2018
(r341130)
@@ -128,7 +128,7 @@ fail1:
 
 #if EFSYS_OPT_NAMES
 
-/* START MKCONFIG GENERATED MonitorStatNamesBlock a808884b01444549 */
+/* START MKCONFIG GENERATED MonitorStatNamesBlock 8150a068198c0f96 */
 static const char * const __mon_stat_name[] = {
"value_2_5v",
"value_vccp1",
@@ -211,6 +211,8 @@ static const char * const __mon_stat_name[] = {
"i2v5",
"i3v3",
"i12v0",
+   "1v3",
+   "i1v3",
 };
 
 /* END MKCONFIG GENERATED MonitorStatNamesBlock */

Modified: head/sys/dev/sfxge/common/mcdi_mon.c
==
--- head/sys/dev/sfxge/common/mcdi_mon.cWed Nov 28 09:24:03 2018
(r341129)
+++ head/sys/dev/sfxge/common/mcdi_mon.cWed Nov 28 09:24:14 2018
(r341130)
@@ -162,6 +162,10 @@ static const struct mcdi_sensor_map_s {
STAT(Px, BOARD_BACK_TEMP),  /* 0x50 BOARD_BACK_TEMP */
STAT(Px, I1V8), /* 0x51 IN_I1V8 */
STAT(Px, I2V5), /* 0x52 IN_I2V5 */
+   STAT(Px, I3V3), /* 0x53 IN_I3V3 */
+   STAT(Px, I12V0),/* 0x54 IN_I12V0 */
+   STAT(Px, 1_3V), /* 0x55 IN_1V3 */
+   STAT(Px, I1V3), /* 0x56 IN_I1V3 */
 };
 
 #defineMCDI_STATIC_SENSOR_ASSERT(_field)   
\
___
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: r341133 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:24:47 2018
New Revision: 341133
URL: https://svnweb.freebsd.org/changeset/base/341133

Log:
  sfxge(4): add CTPIO statistics
  
  Submitted by:   Guido Barzini 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18208

Modified:
  head/sys/dev/sfxge/common/efx_regs_mcdi.h

Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Nov 28 09:24:36 2018
(r341132)
+++ head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Nov 28 09:24:47 2018
(r341133)
@@ -4125,10 +4125,86 @@
 #defineMC_CMD_MAC_FEC_CORRECTED_SYMBOLS_LANE2  0x65
 /* enum: Number of corrected 10-bit symbol errors, lane 3 (RS-FEC only) */
 #defineMC_CMD_MAC_FEC_CORRECTED_SYMBOLS_LANE3  0x66
-/* enum: This includes the final GENERATION_END */
+/* enum: This includes the space at offset 103 which is the final
+ * GENERATION_END in a MAC_STATS_V2 response and otherwise unused.
+ */
 #defineMC_CMD_MAC_NSTATS_V2  0x68
 /*Other enum values, see field(s): */
 /*   MC_CMD_MAC_STATS_OUT_NO_DMA/STATISTICS */
+
+/* MC_CMD_MAC_STATS_V3_OUT_DMA msgresponse */
+#defineMC_CMD_MAC_STATS_V3_OUT_DMA_LEN 0
+
+/* MC_CMD_MAC_STATS_V3_OUT_NO_DMA msgresponse */
+#defineMC_CMD_MAC_STATS_V3_OUT_NO_DMA_LEN 
(((MC_CMD_MAC_NSTATS_V3*64))>>3)
+#defineMC_CMD_MAC_STATS_V3_OUT_NO_DMA_STATISTICS_OFST 0
+#defineMC_CMD_MAC_STATS_V3_OUT_NO_DMA_STATISTICS_LEN 8
+#defineMC_CMD_MAC_STATS_V3_OUT_NO_DMA_STATISTICS_LO_OFST 0
+#defineMC_CMD_MAC_STATS_V3_OUT_NO_DMA_STATISTICS_HI_OFST 4
+#defineMC_CMD_MAC_STATS_V3_OUT_NO_DMA_STATISTICS_NUM 
MC_CMD_MAC_NSTATS_V3
+/* enum: Start of CTPIO stats buffer space, Medford2 and up */
+#defineMC_CMD_MAC_CTPIO_DMABUF_START  0x68
+/* enum: Number of CTPIO fallbacks because a DMA packet was in progress on the
+ * target VI
+ */
+#defineMC_CMD_MAC_CTPIO_VI_BUSY_FALLBACK  0x68
+/* enum: Number of times a CTPIO send wrote beyond frame end (informational
+ * only)
+ */
+#defineMC_CMD_MAC_CTPIO_LONG_WRITE_SUCCESS  0x69
+/* enum: Number of CTPIO failures because the TX doorbell was written before
+ * the end of the frame data
+ */
+#defineMC_CMD_MAC_CTPIO_MISSING_DBELL_FAIL  0x6a
+/* enum: Number of CTPIO failures because the internal FIFO overflowed */
+#defineMC_CMD_MAC_CTPIO_OVERFLOW_FAIL  0x6b
+/* enum: Number of CTPIO failures because the host did not deliver data fast
+ * enough to avoid MAC underflow
+ */
+#defineMC_CMD_MAC_CTPIO_UNDERFLOW_FAIL  0x6c
+/* enum: Number of CTPIO failures because the host did not deliver all the
+ * frame data within the timeout
+ */
+#defineMC_CMD_MAC_CTPIO_TIMEOUT_FAIL  0x6d
+/* enum: Number of CTPIO failures because the frame data arrived out of order
+ * or with gaps
+ */
+#defineMC_CMD_MAC_CTPIO_NONCONTIG_WR_FAIL  0x6e
+/* enum: Number of CTPIO failures because the host started a new frame before
+ * completing the previous one
+ */
+#defineMC_CMD_MAC_CTPIO_FRM_CLOBBER_FAIL  0x6f
+/* enum: Number of CTPIO failures because a write was not a multiple of 32 bits
+ * or not 32-bit aligned
+ */
+#defineMC_CMD_MAC_CTPIO_INVALID_WR_FAIL  0x70
+/* enum: Number of CTPIO fallbacks because another VI on the same port was
+ * sending a CTPIO frame
+ */
+#defineMC_CMD_MAC_CTPIO_VI_CLOBBER_FALLBACK  0x71
+/* enum: Number of CTPIO fallbacks because target VI did not have CTPIO enabled
+ */
+#defineMC_CMD_MAC_CTPIO_UNQUALIFIED_FALLBACK  0x72
+/* enum: Number of CTPIO fallbacks because length in header was less than 29
+ * bytes
+ */
+#defineMC_CMD_MAC_CTPIO_RUNT_FALLBACK  0x73
+/* enum: Total number of successful CTPIO sends on this port */
+#defineMC_CMD_MAC_CTPIO_SUCCESS  0x74
+/* enum: Total number of CTPIO fallbacks on this port */
+#defineMC_CMD_MAC_CTPIO_FALLBACK  0x75
+/* enum: Total number of CTPIO poisoned frames on this port, whether erased or
+ * not
+ */
+#defineMC_CMD_MAC_CTPIO_POISON  0x76
+/* enum: Total number of CTPIO erased frames on this port */
+#defineMC_CMD_MAC_CTPIO_ERASE  0x77
+/* enum: This includes the space at offset 120 which is the final
+ * GENERATION_END in a MAC_STATS_V3 response and otherwise unused.
+ */
+#defineMC_CMD_MAC_NSTATS_V3  0x79
+/*Other enum values, see field(s): */
+/*   MC_CMD_MAC_STATS_V2_OUT_NO_DMA/STATISTICS */
 
 
 /***/
___
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: r341136 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:25:21 2018
New Revision: 341136
URL: https://svnweb.freebsd.org/changeset/base/341136

Log:
  sfxge(4): support CTPIO stats
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18211

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

Modified: head/sys/dev/sfxge/common/ef10_mac.c
==
--- head/sys/dev/sfxge/common/ef10_mac.cWed Nov 28 09:25:09 2018
(r341135)
+++ head/sys/dev/sfxge/common/ef10_mac.cWed Nov 28 09:25:21 2018
(r341136)
@@ -950,6 +950,61 @@ ef10_mac_stats_update(
EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_FEC_CORRECTED_SYMBOLS_LANE3]),
);
 
+   if (encp->enc_mac_stats_nstats < MC_CMD_MAC_NSTATS_V3)
+   goto done;
+
+   /* CTPIO exceptions */
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_VI_BUSY_FALLBACK, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_VI_BUSY_FALLBACK]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_LONG_WRITE_SUCCESS, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_LONG_WRITE_SUCCESS]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_MISSING_DBELL_FAIL, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_MISSING_DBELL_FAIL]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_OVERFLOW_FAIL, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_OVERFLOW_FAIL]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_UNDERFLOW_FAIL, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_UNDERFLOW_FAIL]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_TIMEOUT_FAIL, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_TIMEOUT_FAIL]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_NONCONTIG_WR_FAIL, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_NONCONTIG_WR_FAIL]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_FRM_CLOBBER_FAIL, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_FRM_CLOBBER_FAIL]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_INVALID_WR_FAIL, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_INVALID_WR_FAIL]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_VI_CLOBBER_FALLBACK, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_VI_CLOBBER_FALLBACK]),
+   );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_UNQUALIFIED_FALLBACK, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_UNQUALIFIED_FALLBACK]),
+   );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_RUNT_FALLBACK, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_RUNT_FALLBACK]), );
+
+   /* CTPIO per-port stats */
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_SUCCESS, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_SUCCESS]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_FALLBACK, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_FALLBACK]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_POISON, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_POISON]), );
+
+   EF10_MAC_STAT_READ(esmp, MC_CMD_MAC_CTPIO_ERASE, );
+   EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_CTPIO_ERASE]), );
+
 done:
/* Read START generation counter */
EFSYS_DMA_SYNC_FOR_KERNEL(esmp, 0, EFSYS_MEM_SIZE(esmp));
___
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: r341129 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:24:03 2018
New Revision: 341129
URL: https://svnweb.freebsd.org/changeset/base/341129

Log:
  sfxge(4): provide a flag for controlling CTPIO mode
  
  Either cut-through or store-and-forward mode.
  
  Submitted by:   Guido Barzini 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18204

Modified:
  head/sys/dev/sfxge/common/efx_regs_mcdi.h

Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Nov 28 09:23:52 2018
(r341128)
+++ head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Nov 28 09:24:03 2018
(r341129)
@@ -7304,6 +7304,8 @@
 #defineMC_CMD_INIT_TXQ_EXT_IN_FLAG_TSOV2_EN_WIDTH 1
 #defineMC_CMD_INIT_TXQ_EXT_IN_FLAG_CTPIO_LBN 13
 #defineMC_CMD_INIT_TXQ_EXT_IN_FLAG_CTPIO_WIDTH 1
+#defineMC_CMD_INIT_TXQ_EXT_IN_FLAG_CTPIO_UTHRESH_LBN 14
+#defineMC_CMD_INIT_TXQ_EXT_IN_FLAG_CTPIO_UTHRESH_WIDTH 1
 /* Owner ID to use if in buffer mode (zero if physical) */
 #defineMC_CMD_INIT_TXQ_EXT_IN_OWNER_ID_OFST 20
 #defineMC_CMD_INIT_TXQ_EXT_IN_OWNER_ID_LEN 4
___
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: r341127 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:23:41 2018
New Revision: 341127
URL: https://svnweb.freebsd.org/changeset/base/341127

Log:
  sfxge(4): add Medford2 support for licensing
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18202

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

Modified: head/sys/dev/sfxge/common/efx_lic.c
==
--- head/sys/dev/sfxge/common/efx_lic.c Wed Nov 28 09:23:30 2018
(r341126)
+++ head/sys/dev/sfxge/common/efx_lic.c Wed Nov 28 09:23:41 2018
(r341127)
@@ -192,7 +192,7 @@ static const efx_lic_ops_t  __efx_lic_v2_ops = {
 
 #endif /* EFSYS_OPT_HUNTINGTON */
 
-#if EFSYS_OPT_MEDFORD
+#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
 
 static __checkReturn   efx_rc_t
 efx_mcdi_licensing_v3_update_licenses(
@@ -316,7 +316,7 @@ static const efx_lic_ops_t  __efx_lic_v3_ops = {
efx_lic_v3_finish_partition,/* elo_finish_partition */
 };
 
-#endif /* EFSYS_OPT_MEDFORD */
+#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
 
 
 /* V1 Licensing - used in Siena Modena only */
@@ -849,7 +849,7 @@ fail1:
 
 /* V3 Licensing - used starting from Medford family. See SF-114884-SW */
 
-#if EFSYS_OPT_MEDFORD
+#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
 
 static __checkReturn   efx_rc_t
 efx_mcdi_licensing_v3_update_licenses(
@@ -859,7 +859,8 @@ efx_mcdi_licensing_v3_update_licenses(
uint8_t payload[MC_CMD_LICENSING_V3_IN_LEN];
efx_rc_t rc;
 
-   EFSYS_ASSERT(enp->en_family == EFX_FAMILY_MEDFORD);
+   EFSYS_ASSERT((enp->en_family == EFX_FAMILY_MEDFORD) ||
+   (enp->en_family == EFX_FAMILY_MEDFORD2));
 
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_LICENSING_V3;
@@ -896,7 +897,8 @@ efx_mcdi_licensing_v3_report_license(
MC_CMD_LICENSING_V3_OUT_LEN)];
efx_rc_t rc;
 
-   EFSYS_ASSERT(enp->en_family == EFX_FAMILY_MEDFORD);
+   EFSYS_ASSERT((enp->en_family == EFX_FAMILY_MEDFORD) ||
+   (enp->en_family == EFX_FAMILY_MEDFORD2));
 
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_LICENSING_V3;
@@ -960,7 +962,8 @@ efx_mcdi_licensing_v3_app_state(
uint32_t app_state;
efx_rc_t rc;
 
-   EFSYS_ASSERT(enp->en_family == EFX_FAMILY_MEDFORD);
+   EFSYS_ASSERT((enp->en_family == EFX_FAMILY_MEDFORD) ||
+   (enp->en_family == EFX_FAMILY_MEDFORD2));
 
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_GET_LICENSED_V3_APP_STATE;
@@ -1292,7 +1295,7 @@ fail1:
 }
 
 
-#endif /* EFSYS_OPT_MEDFORD */
+#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
 
__checkReturn   efx_rc_t
 efx_lic_init(
@@ -1325,6 +1328,12 @@ efx_lic_init(
elop = &__efx_lic_v3_ops;
break;
 #endif /* EFSYS_OPT_MEDFORD */
+
+#if EFSYS_OPT_MEDFORD2
+   case EFX_FAMILY_MEDFORD2:
+   elop = &__efx_lic_v3_ops;
+   break;
+#endif /* EFSYS_OPT_MEDFORD2 */
 
default:
EFSYS_ASSERT(0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:23:05 2018
New Revision: 341124
URL: https://svnweb.freebsd.org/changeset/base/341124

Log:
  sfxge(4): clarify port mode names and masks
  
  New port mode names are defined for Medford2 and later, and
  the existing names are aliased to them. Add comments with the
  numeric port mode to clarify the external port modes table.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18199

Modified:
  head/sys/dev/sfxge/common/ef10_nic.c
  head/sys/dev/sfxge/common/hunt_nic.c

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cWed Nov 28 09:22:53 2018
(r341123)
+++ head/sys/dev/sfxge/common/ef10_nic.cWed Nov 28 09:23:05 2018
(r341124)
@@ -1372,11 +1372,11 @@ static struct ef10_external_port_map_s {
 */
{
EFX_FAMILY_HUNTINGTON,
-   (1 << TLV_PORT_MODE_10G) |
-   (1 << TLV_PORT_MODE_10G_10G) |
-   (1 << TLV_PORT_MODE_10G_10G_10G_10G),
-   1,
-   1
+   (1U << TLV_PORT_MODE_10G) | /* mode 0 */
+   (1U << TLV_PORT_MODE_10G_10G) | /* mode 2 */
+   (1U << TLV_PORT_MODE_10G_10G_10G_10G),  /* mode 4 */
+   1,  /* ports per cage */
+   1   /* first cage */
},
/*
 * Modes that on Medford allocate each port number to a separate
@@ -1388,10 +1388,10 @@ static struct ef10_external_port_map_s {
 */
{
EFX_FAMILY_MEDFORD,
-   (1 << TLV_PORT_MODE_10G) |
-   (1 << TLV_PORT_MODE_10G_10G),
-   1,
-   1
+   (1U << TLV_PORT_MODE_10G) | /* mode 0 */
+   (1U << TLV_PORT_MODE_10G_10G),  /* mode 2 */
+   1,  /* ports per cage */
+   1   /* first cage */
},
/*
 * Modes which for Huntington identify a chip variant where 2
@@ -1404,12 +1404,12 @@ static struct ef10_external_port_map_s {
 */
{
EFX_FAMILY_HUNTINGTON,
-   (1 << TLV_PORT_MODE_40G) |
-   (1 << TLV_PORT_MODE_40G_40G) |
-   (1 << TLV_PORT_MODE_40G_10G_10G) |
-   (1 << TLV_PORT_MODE_10G_10G_40G),
-   2,
-   1
+   (1U << TLV_PORT_MODE_40G) | /* mode 1 */
+   (1U << TLV_PORT_MODE_40G_40G) | /* mode 3 */
+   (1U << TLV_PORT_MODE_40G_10G_10G) | /* mode 6 */
+   (1U << TLV_PORT_MODE_10G_10G_40G),  /* mode 7 */
+   2,  /* ports per cage */
+   1   /* first cage */
},
/*
 * Modes that on Medford allocate 2 adjacent port numbers to each
@@ -1421,13 +1421,14 @@ static struct ef10_external_port_map_s {
 */
{
EFX_FAMILY_MEDFORD,
-   (1 << TLV_PORT_MODE_40G) |
-   (1 << TLV_PORT_MODE_40G_40G) |
-   (1 << TLV_PORT_MODE_40G_10G_10G) |
-   (1 << TLV_PORT_MODE_10G_10G_40G) |
-   (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2),
-   2,
-   1
+   (1U << TLV_PORT_MODE_40G) | /* mode 1 */
+   (1U << TLV_PORT_MODE_40G_40G) | /* mode 3 */
+   (1U << TLV_PORT_MODE_40G_10G_10G) | /* mode 6 */
+   (1U << TLV_PORT_MODE_10G_10G_40G) | /* mode 7 */
+   /* Do not use 10G_10G_10G_10G_Q1_Q2 (see bug63270) */
+   (1U << TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2),/* mode 9 */
+   2,  /* ports per cage */
+   1   /* first cage */
},
/*
 * Modes that on Medford allocate 4 adjacent port numbers to each
@@ -1439,10 +1440,11 @@ static struct ef10_external_port_map_s {
 */
{
EFX_FAMILY_MEDFORD,
-   (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q) |
-   (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q1),
-   4,
-   1,
+   (1U << TLV_PORT_MODE_10G_10G_10G_10G_Q) |   /* mode 5 */
+   /* Do not use 10G_10G_10G_10G_Q1 (see bug63270) */
+   (1U << TLV_PORT_MODE_10G_10G_10G_10G_Q1),   /* mode 4 */
+   4,  /* ports per cage */
+   1   /* first cage */
},
/*
 * Modes that on Medford allocate 4 adjacent port numbers to each
@@ -1454,9 +1456,9 @@ static struct ef10_external_port_map_s {
 */
{
EFX_FAMILY_MEDFORD,
-   (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q2),
-   4,
-   2
+  

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:24:36 2018
New Revision: 341132
URL: https://svnweb.freebsd.org/changeset/base/341132

Log:
  sfxge(4): run genfwdef to update headers
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18207

Modified:
  head/sys/dev/sfxge/common/ef10_tlv_layout.h

Modified: head/sys/dev/sfxge/common/ef10_tlv_layout.h
==
--- head/sys/dev/sfxge/common/ef10_tlv_layout.h Wed Nov 28 09:24:25 2018
(r341131)
+++ head/sys/dev/sfxge/common/ef10_tlv_layout.h Wed Nov 28 09:24:36 2018
(r341132)
@@ -58,6 +58,7 @@
  *1: dynamic configuration
  *2: firmware internal use
  *3: license partition
+ *4: tsa configuration
  *
  *   -  TTT is a type, which is just a unique value.  The same type value
  *  might appear in both locations, indicating a relationship between
@@ -580,6 +581,7 @@ struct tlv_global_port_mode {
 #define TLV_PORT_MODE_1x2_1x4(16) /* Single 50G on mdi0, 
single 40G on mdi1 */
 #define TLV_PORT_MODE_1x2_2x1(17) /* Single 50G on mdi0, 
dual 10G/25G on mdi1 */
 #define TLV_PORT_MODE_2x1_1x2(18) /* Dual 10G/25G on mdi0, 
single 50G on mdi1 */
+/* Below modes are eftest only, to allow snapper explicit selection between 
multi-channel and LLPCS. In production, this selection is automatic and outside 
world should not care about LLPCS */
 #define TLV_PORT_MODE_2x1_2x1_LL (19) /* Dual 10G/25G on mdi0, 
dual 10G/25G on mdi1, low-latency PCS */
 #define TLV_PORT_MODE_4x1_NA_LL  (20) /* Quad 10G/25G on mdi0, 
low-latency PCS */
 #define TLV_PORT_MODE_NA_4x1_LL  (21) /* Quad 10G/25G on mdi1, 
low-latency PCS */
@@ -618,6 +620,7 @@ struct tlv_global_port_mode {
 #define TLV_PORT_MODE_50G_40GTLV_PORT_MODE_1x2_1x4/* 
Single 50G on mdi0, single 40G on mdi1 */
 #define TLV_PORT_MODE_50G_25G_25GTLV_PORT_MODE_1x2_2x1/* 
Single 50G on mdi0, dual 25G on mdi1 */
 #define TLV_PORT_MODE_25G_25G_50GTLV_PORT_MODE_2x1_1x2/* 
Dual 25G on mdi0, single 50G on mdi1 */
+/* eftest only, see comments for _LL modes above */
 #define TLV_PORT_MODE_25G_25G_25G_25G_Q1_Q2_LL   TLV_PORT_MODE_2x1_2x1_LL /* 
Dual 25G on mdi0, dual 25G on mdi1, low-latency PCS */
 #define TLV_PORT_MODE_25G_25G_25G_25G_Q1_LL  TLV_PORT_MODE_4x1_NA_LL  /* 
Quad 25G on mdi0, low-latency PCS */
 #define TLV_PORT_MODE_25G_25G_25G_25G_Q2_LL  TLV_PORT_MODE_NA_4x1_LL  /* 
Quad 25G on mdi1, low-latency PCS */
@@ -881,7 +884,7 @@ typedef struct tlv_license {
   uint8_t   data[];
 } tlv_license_t;
 
-/* TSA NIC IP address configuration
+/* TSA NIC IP address configuration (DEPRECATED)
  *
  * Sets the TSA NIC IP address statically via configuration tool or dynamically
  * via DHCP via snooping based on the mode selection (0=Static, 1=DHCP, 
2=Snoop)
@@ -891,7 +894,7 @@ typedef struct tlv_license {
  * released code yet.
  */
 
-#define TLV_TAG_TMP_TSAN_CONFIG (0x1022)
+#define TLV_TAG_TMP_TSAN_CONFIG (0x1022) /* DEPRECATED */
 
 #define TLV_TSAN_IP_MODE_STATIC (0)
 #define TLV_TSAN_IP_MODE_DHCP   (1)
@@ -908,7 +911,7 @@ typedef struct tlv_tsan_config {
   uint32_t bind_bkout;  /* DEPRECATED */
 } tlv_tsan_config_t;
 
-/* TSA Controller IP address configuration
+/* TSA Controller IP address configuration (DEPRECATED)
  *
  * Sets the TSA Controller IP address statically via configuration tool
  *
@@ -917,7 +920,7 @@ typedef struct tlv_tsan_config {
  * released code yet.
  */
 
-#define TLV_TAG_TMP_TSAC_CONFIG (0x1023)
+#define TLV_TAG_TMP_TSAC_CONFIG (0x1023) /* DEPRECATED */
 
 #define TLV_MAX_TSACS (4)
 typedef struct tlv_tsac_config {
@@ -928,7 +931,7 @@ typedef struct tlv_tsac_config {
   uint32_t port[TLV_MAX_TSACS];
 } tlv_tsac_config_t;
 
-/* Binding ticket
+/* Binding ticket (DEPRECATED)
  *
  * Sets the TSA NIC binding ticket used for binding process between the TSA NIC
  * and the TSA Controller
@@ -938,7 +941,7 @@ typedef struct tlv_tsac_config {
  * released code yet.
  */
 
-#define TLV_TAG_TMP_BINDING_TICKET  (0x1024)
+#define TLV_TAG_TMP_BINDING_TICKET  (0x1024) /* DEPRECATED */
 
 typedef struct tlv_binding_ticket {
   uint32_t tag;
@@ -963,7 +966,7 @@ typedef struct tlv_pik_sf {
   uint8_t  bytes[];
 } tlv_pik_sf_t;
 
-/* CA root certificate
+/* CA root certificate (DEPRECATED)
  *
  * Sets the CA root certificate used for TSA Controller verfication during
  * TLS connection setup between the TSA NIC and the TSA Controller
@@ -973,7 +976,7 @@ typedef struct tlv_pik_sf {
  * released code yet.
  */
 
-#define TLV_TAG_TMP_CA_ROOT_CERT(0x1026)
+#define TLV_TAG_TMP_CA_ROOT_CERT(0x1026) /* DEPRECATED */
 
 typedef struct tlv_ca_root_cert {
   

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

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:23:52 2018
New Revision: 341128
URL: https://svnweb.freebsd.org/changeset/base/341128

Log:
  sfxge(4): add Medford2 support for tunnel encapsulations
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18203

Modified:
  head/sys/dev/sfxge/common/efx_check.h
  head/sys/dev/sfxge/common/efx_tunnel.c

Modified: head/sys/dev/sfxge/common/efx_check.h
==
--- head/sys/dev/sfxge/common/efx_check.h   Wed Nov 28 09:23:41 2018
(r341127)
+++ head/sys/dev/sfxge/common/efx_check.h   Wed Nov 28 09:23:52 2018
(r341128)
@@ -365,8 +365,8 @@
 
 /* Support hardware assistance for tunnels */
 #if EFSYS_OPT_TUNNEL
-# if !EFSYS_OPT_MEDFORD
-#  error "TUNNEL requires MEDFORD"
+# if !(EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2)
+#  error "TUNNEL requires MEDFORD or MEDFORD2"
 # endif
 #endif /* EFSYS_OPT_TUNNEL */
 

Modified: head/sys/dev/sfxge/common/efx_tunnel.c
==
--- head/sys/dev/sfxge/common/efx_tunnel.c  Wed Nov 28 09:23:41 2018
(r341127)
+++ head/sys/dev/sfxge/common/efx_tunnel.c  Wed Nov 28 09:23:52 2018
(r341128)
@@ -46,20 +46,20 @@ static const efx_tunnel_ops_t   __efx_tunnel_dummy_ops =
 };
 #endif /* EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON */
 
-#if EFSYS_OPT_MEDFORD
+#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
 static __checkReturn   boolean_t
-medford_udp_encap_supported(
+ef10_udp_encap_supported(
__inefx_nic_t *enp);
 
 static __checkReturn   efx_rc_t
-medford_tunnel_reconfigure(
+ef10_tunnel_reconfigure(
__inefx_nic_t *enp);
 
-static const efx_tunnel_ops_t  __efx_tunnel_medford_ops = {
-   medford_udp_encap_supported,/* eto_udp_encap_supported */
-   medford_tunnel_reconfigure, /* eto_reconfigure */
+static const efx_tunnel_ops_t  __efx_tunnel_ef10_ops = {
+   ef10_udp_encap_supported,   /* eto_udp_encap_supported */
+   ef10_tunnel_reconfigure,/* eto_reconfigure */
 };
-#endif /* EFSYS_OPT_MEDFORD */
+#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
 
 static __checkReturn   efx_rc_t
 efx_mcdi_set_tunnel_encap_udp_ports(
@@ -190,10 +190,16 @@ efx_tunnel_init(
 
 #if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
-   etop = &__efx_tunnel_medford_ops;
+   etop = &__efx_tunnel_ef10_ops;
break;
 #endif /* EFSYS_OPT_MEDFORD */
 
+#if EFSYS_OPT_MEDFORD2
+   case EFX_FAMILY_MEDFORD2:
+   etop = &__efx_tunnel_ef10_ops;
+   break;
+#endif /* EFSYS_OPT_MEDFORD2 */
+
default:
EFSYS_ASSERT(0);
rc = ENOTSUP;
@@ -423,9 +429,9 @@ fail1:
return (rc);
 }
 
-#if EFSYS_OPT_MEDFORD
+#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
 static __checkReturn   boolean_t
-medford_udp_encap_supported(
+ef10_udp_encap_supported(
__inefx_nic_t *enp)
 {
const efx_nic_cfg_t *encp = >en_nic_cfg;
@@ -439,7 +445,7 @@ medford_udp_encap_supported(
 }
 
 static __checkReturn   efx_rc_t
-medford_tunnel_reconfigure(
+ef10_tunnel_reconfigure(
__inefx_nic_t *enp)
 {
efx_tunnel_cfg_t *etcp = >en_tunnel_cfg;
@@ -452,7 +458,7 @@ medford_tunnel_reconfigure(
memcpy(, etcp, sizeof (etc));
EFSYS_UNLOCK(enp->en_eslp, state);
 
-   if (medford_udp_encap_supported(enp) == B_FALSE) {
+   if (ef10_udp_encap_supported(enp) == B_FALSE) {
/*
 * It is OK to apply empty UDP tunnel ports when UDP
 * tunnel encapsulations are not supported - just nothing
@@ -487,6 +493,6 @@ fail1:
 
return (rc);
 }
-#endif /* EFSYS_OPT_MEDFORD */
+#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
 
 #endif /* EFSYS_OPT_TUNNEL */
___
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: r341125 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:23:19 2018
New Revision: 341125
URL: https://svnweb.freebsd.org/changeset/base/341125

Log:
  sfxge(4): group Medford external port mapping entries
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18200

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

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cWed Nov 28 09:23:05 2018
(r341124)
+++ head/sys/dev/sfxge/common/ef10_nic.cWed Nov 28 09:23:19 2018
(r341125)
@@ -1379,21 +1379,6 @@ static struct ef10_external_port_map_s {
1   /* first cage */
},
/*
-* Modes that on Medford allocate each port number to a separate
-* cage.
-*  port 0 -> cage 1
-*  port 1 -> cage 2
-*  port 2 -> cage 3
-*  port 3 -> cage 4
-*/
-   {
-   EFX_FAMILY_MEDFORD,
-   (1U << TLV_PORT_MODE_10G) | /* mode 0 */
-   (1U << TLV_PORT_MODE_10G_10G),  /* mode 2 */
-   1,  /* ports per cage */
-   1   /* first cage */
-   },
-   /*
 * Modes which for Huntington identify a chip variant where 2
 * adjacent port numbers map to each cage.
 * SFN7x42Q (Monza):
@@ -1409,6 +1394,21 @@ static struct ef10_external_port_map_s {
(1U << TLV_PORT_MODE_40G_10G_10G) | /* mode 6 */
(1U << TLV_PORT_MODE_10G_10G_40G),  /* mode 7 */
2,  /* ports per cage */
+   1   /* first cage */
+   },
+   /*
+* Modes that on Medford allocate each port number to a separate
+* cage.
+*  port 0 -> cage 1
+*  port 1 -> cage 2
+*  port 2 -> cage 3
+*  port 3 -> cage 4
+*/
+   {
+   EFX_FAMILY_MEDFORD,
+   (1U << TLV_PORT_MODE_10G) | /* mode 0 */
+   (1U << TLV_PORT_MODE_10G_10G),  /* mode 2 */
+   1,  /* ports per cage */
1   /* first cage */
},
/*
___
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: r341126 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:23:30 2018
New Revision: 341126
URL: https://svnweb.freebsd.org/changeset/base/341126

Log:
  sfxge(4): add Medford2 support for external port numbers
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18201

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

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cWed Nov 28 09:23:19 2018
(r341125)
+++ head/sys/dev/sfxge/common/ef10_nic.cWed Nov 28 09:23:30 2018
(r341126)
@@ -1460,6 +1460,93 @@ static struct ef10_external_port_map_s {
4,  /* ports per cage */
2   /* first cage */
},
+   /*
+* Modes that on Medford2 allocate each port number to a separate
+* cage.
+*  port 0 -> cage 1
+*  port 1 -> cage 2
+*  port 2 -> cage 3
+*  port 3 -> cage 4
+*/
+   {
+   EFX_FAMILY_MEDFORD2,
+   (1U << TLV_PORT_MODE_1x1_NA) |  /* mode 0 */
+   (1U << TLV_PORT_MODE_1x4_NA) |  /* mode 1 */
+   (1U << TLV_PORT_MODE_1x1_1x1) | /* mode 2 */
+   (1U << TLV_PORT_MODE_1x2_NA) |  /* mode 10 */
+   (1U << TLV_PORT_MODE_1x2_1x2) | /* mode 12 */
+   (1U << TLV_PORT_MODE_1x4_1x2) | /* mode 15 */
+   (1U << TLV_PORT_MODE_1x2_1x4),  /* mode 16 */
+   1,  /* ports per cage */
+   1   /* first cage */
+   },
+   /*
+* FIXME: Some port modes are not representable in this mapping:
+*  - TLV_PORT_MODE_1x2_2x1 (mode 17):
+*  port 0 -> cage 1
+*  port 1 -> cage 2
+*  port 2 -> cage 2
+*/
+   /*
+* Modes that on Medford2 allocate 2 adjacent port numbers to each
+* cage, starting on cage 1.
+*  port 0 -> cage 1
+*  port 1 -> cage 1
+*  port 2 -> cage 2
+*  port 3 -> cage 2
+*/
+   {
+   EFX_FAMILY_MEDFORD2,
+   (1U << TLV_PORT_MODE_1x4_1x4) | /* mode 3 */
+   (1U << TLV_PORT_MODE_2x1_2x1) | /* mode 4 */
+   (1U << TLV_PORT_MODE_1x4_2x1) | /* mode 6 */
+   (1U << TLV_PORT_MODE_2x1_1x4) | /* mode 7 */
+   (1U << TLV_PORT_MODE_2x2_NA) |  /* mode 13 */
+   (1U << TLV_PORT_MODE_2x1_1x2),  /* mode 18 */
+   2,  /* ports per cage */
+   1   /* first cage */
+   },
+   /*
+* Modes that on Medford2 allocate 2 adjacent port numbers to each
+* cage, starting on cage 2.
+*  port 0 -> cage 2
+*  port 1 -> cage 2
+*/
+   {
+   EFX_FAMILY_MEDFORD2,
+   (1U << TLV_PORT_MODE_NA_2x2),   /* mode 14 */
+   2,  /* ports per cage */
+   2   /* first cage */
+   },
+   /*
+* Modes that on Medford2 allocate 4 adjacent port numbers to each
+* connector, starting on cage 1.
+*  port 0 -> cage 1
+*  port 1 -> cage 1
+*  port 2 -> cage 1
+*  port 3 -> cage 1
+*/
+   {
+   EFX_FAMILY_MEDFORD2,
+   (1U << TLV_PORT_MODE_4x1_NA),   /* mode 5 */
+   4,  /* ports per cage */
+   1   /* first cage */
+   },
+   /*
+* Modes that on Medford2 allocate 4 adjacent port numbers to each
+* connector, starting on cage 2.
+*  port 0 -> cage 2
+*  port 1 -> cage 2
+*  port 2 -> cage 2
+*  port 3 -> cage 2
+*/
+   {
+   EFX_FAMILY_MEDFORD2,
+   (1U << TLV_PORT_MODE_NA_4x1) |  /* mode 8 */
+   (1U << TLV_PORT_MODE_NA_1x2),   /* mode 11 */
+   4,  /* ports per cage */
+   2   /* first cage */
+   },
 };
 
 static __checkReturn   efx_rc_t
___
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: r341122 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:22:42 2018
New Revision: 341122
URL: https://svnweb.freebsd.org/changeset/base/341122

Log:
  sfxge(4): support FEC mode settings
  
  Medford2 controllers support control and reporting of
  FEC modes for 25G and higher links. See SF-109306-TC
  for suggested usage in client code.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18197

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

Modified: head/sys/dev/sfxge/common/ef10_phy.c
==
--- head/sys/dev/sfxge/common/ef10_phy.cWed Nov 28 09:10:28 2018
(r341121)
+++ head/sys/dev/sfxge/common/ef10_phy.cWed Nov 28 09:22:42 2018
(r341122)
@@ -61,6 +61,12 @@ mcdi_phy_decode_cap(
CHECK_CAP(ASYM);
CHECK_CAP(AN);
CHECK_CAP(DDM);
+   CHECK_CAP(BASER_FEC);
+   CHECK_CAP(BASER_FEC_REQUESTED);
+   CHECK_CAP(RS_FEC);
+   CHECK_CAP(RS_FEC_REQUESTED);
+   CHECK_CAP(25G_BASER_FEC);
+   CHECK_CAP(25G_BASER_FEC_REQUESTED);
 #undef CHECK_CAP
 
mask = 0;
@@ -94,6 +100,22 @@ mcdi_phy_decode_cap(
if (mcdi_cap & (1 << MC_CMD_PHY_CAP_AN_LBN))
mask |= (1 << EFX_PHY_CAP_AN);
 
+   /* FEC caps (supported on Medford2 and later) */
+   if (mcdi_cap & (1 << MC_CMD_PHY_CAP_BASER_FEC_LBN))
+   mask |= (1 << EFX_PHY_CAP_BASER_FEC);
+   if (mcdi_cap & (1 << MC_CMD_PHY_CAP_BASER_FEC_REQUESTED_LBN))
+   mask |= (1 << EFX_PHY_CAP_BASER_FEC_REQUESTED);
+
+   if (mcdi_cap & (1 << MC_CMD_PHY_CAP_RS_FEC_LBN))
+   mask |= (1 << EFX_PHY_CAP_RS_FEC);
+   if (mcdi_cap & (1 << MC_CMD_PHY_CAP_RS_FEC_REQUESTED_LBN))
+   mask |= (1 << EFX_PHY_CAP_RS_FEC_REQUESTED);
+
+   if (mcdi_cap & (1 << MC_CMD_PHY_CAP_25G_BASER_FEC_LBN))
+   mask |= (1 << EFX_PHY_CAP_25G_BASER_FEC);
+   if (mcdi_cap & (1 << MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_LBN))
+   mask |= (1 << EFX_PHY_CAP_25G_BASER_FEC_REQUESTED);
+
*maskp = mask;
 }
 
@@ -349,6 +371,25 @@ ef10_phy_reconfigure(
PHY_CAP_5FDX, (cap_mask >> EFX_PHY_CAP_5FDX) & 0x1);
MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
PHY_CAP_10FDX, (cap_mask >> EFX_PHY_CAP_10FDX) & 0x1);
+
+   MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
+   PHY_CAP_BASER_FEC, (cap_mask >> EFX_PHY_CAP_BASER_FEC) & 0x1);
+   MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
+   PHY_CAP_BASER_FEC_REQUESTED,
+   (cap_mask >> EFX_PHY_CAP_BASER_FEC_REQUESTED) & 0x1);
+
+   MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
+   PHY_CAP_RS_FEC, (cap_mask >> EFX_PHY_CAP_RS_FEC) & 0x1);
+   MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
+   PHY_CAP_RS_FEC_REQUESTED,
+   (cap_mask >> EFX_PHY_CAP_RS_FEC_REQUESTED) & 0x1);
+
+   MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
+   PHY_CAP_25G_BASER_FEC,
+   (cap_mask >> EFX_PHY_CAP_25G_BASER_FEC) & 0x1);
+   MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
+   PHY_CAP_25G_BASER_FEC_REQUESTED,
+   (cap_mask >> EFX_PHY_CAP_25G_BASER_FEC_REQUESTED) & 0x1);
 
 #if EFSYS_OPT_LOOPBACK
MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_MODE,

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Wed Nov 28 09:10:28 2018
(r341121)
+++ head/sys/dev/sfxge/common/efx.h Wed Nov 28 09:22:42 2018
(r341122)
@@ -904,6 +904,12 @@ typedef enum efx_phy_cap_type_e {
EFX_PHY_CAP_10FDX,
EFX_PHY_CAP_25000FDX,
EFX_PHY_CAP_5FDX,
+   EFX_PHY_CAP_BASER_FEC,
+   EFX_PHY_CAP_BASER_FEC_REQUESTED,
+   EFX_PHY_CAP_RS_FEC,
+   EFX_PHY_CAP_RS_FEC_REQUESTED,
+   EFX_PHY_CAP_25G_BASER_FEC,
+   EFX_PHY_CAP_25G_BASER_FEC_REQUESTED,
EFX_PHY_CAP_NTYPES
 } efx_phy_cap_type_t;
 
___
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: r341123 - head/sys/dev/sfxge/common

2018-11-28 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Nov 28 09:22:53 2018
New Revision: 341123
URL: https://svnweb.freebsd.org/changeset/base/341123

Log:
  sfxge(4): support Medford2 event timer semantics
  
  The event timer interface has changed for Medford2 - for
  details see bug66418 comment 9. Update the common code to
  use the new timer semantics for Medford2.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18198

Modified:
  head/sys/dev/sfxge/common/ef10_ev.c
  head/sys/dev/sfxge/common/efx_regs_ef10.h

Modified: head/sys/dev/sfxge/common/ef10_ev.c
==
--- head/sys/dev/sfxge/common/ef10_ev.c Wed Nov 28 09:22:42 2018
(r341122)
+++ head/sys/dev/sfxge/common/ef10_ev.c Wed Nov 28 09:22:53 2018
(r341123)
@@ -732,9 +732,15 @@ ef10_ev_qmoderate(
EFX_BAR_VI_WRITED(enp, ER_DD_EVQ_INDIRECT,
eep->ee_index, , 0);
} else {
-   EFX_POPULATE_DWORD_2(dword,
+   /*
+* NOTE: The TMR_REL field introduced in Medford2 is
+* ignored on earlier EF10 controllers. See bug66418
+* comment 9 for details.
+*/
+   EFX_POPULATE_DWORD_3(dword,
ERF_DZ_TC_TIMER_MODE, mode,
-   ERF_DZ_TC_TIMER_VAL, ticks);
+   ERF_DZ_TC_TIMER_VAL, ticks,
+   ERF_FZ_TC_TMR_REL_VAL, ticks);
EFX_BAR_VI_WRITED(enp, ER_DZ_EVQ_TMR_REG,
eep->ee_index, , 0);
}

Modified: head/sys/dev/sfxge/common/efx_regs_ef10.h
==
--- head/sys/dev/sfxge/common/efx_regs_ef10.h   Wed Nov 28 09:22:42 2018
(r341122)
+++ head/sys/dev/sfxge/common/efx_regs_ef10.h   Wed Nov 28 09:22:53 2018
(r341123)
@@ -184,6 +184,8 @@ extern "C" {
 #defineER_FZ_EVQ_TMR_REG_64K_RESET 0x0
 
 
+#defineERF_FZ_TC_TMR_REL_VAL_LBN 16
+#defineERF_FZ_TC_TMR_REL_VAL_WIDTH 14
 #defineERF_FZ_TC_TIMER_MODE_LBN 14
 #defineERF_FZ_TC_TIMER_MODE_WIDTH 2
 #defineERF_FZ_TC_TIMER_VAL_LBN 0
@@ -202,6 +204,8 @@ extern "C" {
 #defineER_FZ_EVQ_TMR_REG_16K_RESET 0x0
 
 
+/* defined as ERF_FZ_TC_TMR_REL_VAL_LBN 16; */
+/* defined as ERF_FZ_TC_TMR_REL_VAL_WIDTH 14 */
 /* defined as ERF_FZ_TC_TIMER_MODE_LBN 14; */
 /* defined as ERF_FZ_TC_TIMER_MODE_WIDTH 2 */
 /* defined as ERF_FZ_TC_TIMER_VAL_LBN 0; */
@@ -220,6 +224,8 @@ extern "C" {
 #defineER_DZ_EVQ_TMR_REG_RESET 0x0
 
 
+/* defined as ERF_FZ_TC_TMR_REL_VAL_LBN 16; */
+/* defined as ERF_FZ_TC_TMR_REL_VAL_WIDTH 14 */
 #defineERF_DZ_TC_TIMER_MODE_LBN 14
 #defineERF_DZ_TC_TIMER_MODE_WIDTH 2
 #defineERF_DZ_TC_TIMER_VAL_LBN 0
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341121 - stable/12/sbin/ipfw

2018-11-28 Thread Guangyuan Yang
Author: ygy (doc committer)
Date: Wed Nov 28 09:10:28 2018
New Revision: 341121
URL: https://svnweb.freebsd.org/changeset/base/341121

Log:
  MFC r340717:
  
  Fix incorrect DSCP value range from 0..64 to 0..63.
  
  PR:   232786
  Submitted by: Sergey Akhmatov 
  Reviewed by:  AllanJude

Modified:
  stable/12/sbin/ipfw/ipfw.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ipfw/ipfw.8
==
--- stable/12/sbin/ipfw/ipfw.8  Wed Nov 28 06:56:34 2018(r341120)
+++ stable/12/sbin/ipfw/ipfw.8  Wed Nov 28 09:10:28 2018(r341121)
@@ -1138,11 +1138,11 @@ Supported values are:
 .Pq Dv 101110 ,
 .Cm be
 .Pq Dv 00 .
-Additionally, DSCP value can be specified by number (0..64).
+Additionally, DSCP value can be specified by number (0..63).
 It is also possible to use the
 .Cm tablearg
 keyword with setdscp.
-If the tablearg value is not within the 0..64 range, lower 6 bits of supplied
+If the tablearg value is not within the 0..63 range, lower 6 bits of supplied
 value are used.
 .It Cm tcp-setmss Ar mss
 Set the Maximum Segment Size (MSS) in the TCP segment to value
___
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"