Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Oct 2019 23:27:03 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r353418 - in stable/10/sys: conf dev/cxgbe dev/cxgbe/common dev/cxgbe/firmware modules/cxgbe/t4_firmware modules/cxgbe/t5_firmware modules/cxgbe/t6_firmware
Message-ID:  <201910102327.x9ANR3Ca072447@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Thu Oct 10 23:27:02 2019
New Revision: 353418
URL: https://svnweb.freebsd.org/changeset/base/353418

Log:
  MFC r319872, r321063, r321582, r322034, r322425, r322962, r322985,
  r325596, r326026, r328420, r331472, r333276, r333650, r333652, r334406,
  r334409-r334410, r334489, r336042, r340651, r342603, and r345083.
  
  This updates the cxgbe firmwares in stable/10 and also pulls in support
  for some newer boards and flash parts.
  
  r319872:
  cxgbe(4):  Do not request an FEC setting that the port does not support.
  
  r321063:
  cxgbe(4): Various link/media related improvements.
  
  r321582:
  cxgbe(4): Some updates to the common code.
  
  r322034:
  cxgbe(4): Always use the first and not the last virtual interface
  associated with a port in begin_synchronized_op.
  
  r322425:
  cxgbe(4): Save the last reported link parameters and compare them with
  the current state to determine whether to generate a link-state change
  notification.  This fixes a bug introduced in r321063 that caused the
  driver to sometimes skip these notifications.
  
  r322962:
  cxgbe(4): Remove write only variable from t4_port_init.
  
  r322985:
  cxgbe(4): Maintain one ifmedia per physical port instead of one per
  Virtual Interface (VI).  All autonomous VIs that share a port share the
  same media.
  
  r325596:
  cxgbe(4): Do not request settings not supported by the port.
  
  r326026:
  cxgbe(4): Add a custom board to the device id list.
  
  r328420:
  cxgbe(4): Do not display harmless warning in non-debug builds.
  
  r331472:
  cxgbe(4): Always initialize requested_speed to a valid value.
  
  This fixes an avoidable EINVAL when the user tries to disable AN after
  the port is initialized but l1cfg doesn't have a valid speed to use.
  
  r333276:
  cxgbe(4): Update all firmwares to 1.19.1.0.
  
  r333650:
  cxgbe(4): Claim some more T5 and T6 boards.
  
  r333652:
  cxgbe(4): Add support for two more flash parts.
  
  r334406:
  cxgbe(4): Consider all supported speeds when building the ifmedia list
  for a port.  Fix other related issues while here:
  - Require port lock for access to link_config.
  - Allow 100Mbps operation by tracking the speed in Mbps.  Yes, really.
  - New port flag to indicate that the media list is immutable.  It will
    be used in future refinements.
  
  This also fixes a bug where the driver reports incorrect media with
  recent firmwares.
  
  r334409:
  cxgbe(4): Implement ifm_change callback.
  
  r334410:
  cxgbe(4): Use ifm for ifmedia just like the rest of the kernel.
  
  No functional change.
  
  r334489:
  cxgbe(4): Include full duplex mediaopt in media that can be reported as
  active.  Always report full duplex in active media.
  
  r336042:
  cxgbe(4): Assume that any unknown flash on the card is 4MB and has 64KB
  sectors, instead of refusing to attach to the card.
  
  r340651:
  cxgbe(4): Update T4/5/6 firmwares to 1.22.0.3.
  
  r342603:
  cxgbe(4): Attach to two T540 variants.
  
  r345083:
  cxgbe(4): Update T4/5/6 firmwares to 1.23.0.0.

Added:
  stable/10/sys/dev/cxgbe/firmware/t4fw-1.23.0.0.bin.uu
     - copied unchanged from r345083, head/sys/dev/cxgbe/firmware/t4fw-1.23.0.0.bin.uu
  stable/10/sys/dev/cxgbe/firmware/t5fw-1.23.0.0.bin.uu
     - copied unchanged from r345083, head/sys/dev/cxgbe/firmware/t5fw-1.23.0.0.bin.uu
  stable/10/sys/dev/cxgbe/firmware/t6fw-1.23.0.0.bin.uu
     - copied unchanged from r345083, head/sys/dev/cxgbe/firmware/t6fw-1.23.0.0.bin.uu
Deleted:
  stable/10/sys/dev/cxgbe/firmware/t4fw-1.16.63.0.bin.uu
  stable/10/sys/dev/cxgbe/firmware/t5fw-1.16.63.0.bin.uu
  stable/10/sys/dev/cxgbe/firmware/t6fw-1.16.63.0.bin.uu
Modified:
  stable/10/sys/conf/files
  stable/10/sys/dev/cxgbe/adapter.h
  stable/10/sys/dev/cxgbe/common/common.h
  stable/10/sys/dev/cxgbe/common/t4_hw.c
  stable/10/sys/dev/cxgbe/firmware/t4fw_interface.h
  stable/10/sys/dev/cxgbe/firmware/t5fw_cfg_uwire.txt
  stable/10/sys/dev/cxgbe/firmware/t6fw_cfg_uwire.txt
  stable/10/sys/dev/cxgbe/t4_main.c
  stable/10/sys/dev/cxgbe/t4_sge.c
  stable/10/sys/modules/cxgbe/t4_firmware/Makefile
  stable/10/sys/modules/cxgbe/t5_firmware/Makefile
  stable/10/sys/modules/cxgbe/t6_firmware/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/files
==============================================================================
--- stable/10/sys/conf/files	Thu Oct 10 22:49:45 2019	(r353417)
+++ stable/10/sys/conf/files	Thu Oct 10 23:27:02 2019	(r353418)
@@ -1195,7 +1195,7 @@ t4fw.fwo		optional cxgbe					\
 	no-implicit-rule						\
 	clean		"t4fw.fwo"
 t4fw.fw			optional cxgbe					\
-	dependency	"$S/dev/cxgbe/firmware/t4fw-1.16.63.0.bin.uu"	\
+	dependency	"$S/dev/cxgbe/firmware/t4fw-1.23.0.0.bin.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"t4fw.fw"
@@ -1219,7 +1219,7 @@ t5fw.fwo		optional cxgbe					\
 	no-implicit-rule						\
 	clean		"t5fw.fwo"
 t5fw.fw			optional cxgbe					\
-	dependency	"$S/dev/cxgbe/firmware/t5fw-1.16.63.0.bin.uu"	\
+	dependency	"$S/dev/cxgbe/firmware/t5fw-1.23.0.0.bin.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"t5fw.fw"
@@ -1243,7 +1243,7 @@ t6fw.fwo		optional cxgbe					\
 	no-implicit-rule						\
 	clean		"t6fw.fwo"
 t6fw.fw			optional cxgbe					\
-	dependency	"$S/dev/cxgbe/firmware/t6fw-1.16.63.0.bin.uu"	\
+	dependency	"$S/dev/cxgbe/firmware/t6fw-1.23.0.0.bin.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"t6fw.fw"

Modified: stable/10/sys/dev/cxgbe/adapter.h
==============================================================================
--- stable/10/sys/dev/cxgbe/adapter.h	Thu Oct 10 22:49:45 2019	(r353417)
+++ stable/10/sys/dev/cxgbe/adapter.h	Thu Oct 10 23:27:02 2019	(r353418)
@@ -156,6 +156,7 @@ enum {
 
 	/* port flags */
 	HAS_TRACEQ	= (1 << 3),
+	FIXED_IFMEDIA	= (1 << 4),	/* ifmedia list doesn't change. */
 
 	/* VI flags */
 	DOOMED		= (1 << 0),
@@ -180,7 +181,6 @@ struct vi_info {
 	struct port_info *pi;
 
 	struct ifnet *ifp;
-	struct ifmedia media;
 
 	unsigned long flags;
 	int if_flags;
@@ -281,6 +281,8 @@ struct port_info {
 	uint8_t  rx_chan_map;	/* rx MPS channel bitmap */
 
 	struct link_config link_cfg;
+	struct link_config old_link_cfg;
+	struct ifmedia media;
 
 	struct timeval last_refreshed;
  	struct port_stats stats;
@@ -1026,10 +1028,10 @@ adap2pinfo(struct adapter *sc, int idx)
 }
 
 static inline void
-t4_os_set_hw_addr(struct adapter *sc, int idx, uint8_t hw_addr[])
+t4_os_set_hw_addr(struct port_info *pi, uint8_t hw_addr[])
 {
 
-	bcopy(hw_addr, sc->port[idx]->vi[0].hw_addr, ETHER_ADDR_LEN);
+	bcopy(hw_addr, pi->vi[0].hw_addr, ETHER_ADDR_LEN);
 }
 
 static inline bool
@@ -1079,24 +1081,6 @@ port_top_speed(const struct port_info *pi)
 }
 
 static inline int
-port_top_speed_raw(const struct port_info *pi)
-{
-
-	if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100G)
-		return (FW_PORT_CAP_SPEED_100G);
-	if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G)
-		return (FW_PORT_CAP_SPEED_40G);
-	if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_25G)
-		return (FW_PORT_CAP_SPEED_25G);
-	if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G)
-		return (FW_PORT_CAP_SPEED_10G);
-	if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_1G)
-		return (FW_PORT_CAP_SPEED_1G);
-
-	return (0);
-}
-
-static inline int
 tx_resume_threshold(struct sge_eq *eq)
 {
 
@@ -1132,8 +1116,8 @@ extern device_method_t cxgbe_methods[];
 int t4_os_find_pci_capability(struct adapter *, int);
 int t4_os_pci_save_state(struct adapter *);
 int t4_os_pci_restore_state(struct adapter *);
-void t4_os_portmod_changed(const struct adapter *, int);
-void t4_os_link_changed(struct adapter *, int, int);
+void t4_os_portmod_changed(struct port_info *);
+void t4_os_link_changed(struct port_info *);
 void t4_iterate(void (*)(struct adapter *, void *), void *);
 void t4_init_devnames(struct adapter *);
 void t4_add_adapter(struct adapter *);

Modified: stable/10/sys/dev/cxgbe/common/common.h
==============================================================================
--- stable/10/sys/dev/cxgbe/common/common.h	Thu Oct 10 22:49:45 2019	(r353417)
+++ stable/10/sys/dev/cxgbe/common/common.h	Thu Oct 10 23:27:02 2019	(r353418)
@@ -399,16 +399,18 @@ struct trace_params {
 };
 
 struct link_config {
+	/* OS-specific code owns all the requested_* fields */
+	unsigned char  requested_aneg;   /* link aneg user has requested */
+	unsigned char  requested_fc;     /* flow control user has requested */
+	unsigned char  requested_fec;    /* FEC user has requested */
+	unsigned int   requested_speed;  /* speed user has requested (Mbps) */
+
 	unsigned short supported;        /* link capabilities */
 	unsigned short advertising;      /* advertised capabilities */
 	unsigned short lp_advertising;   /* peer advertised capabilities */
-	unsigned int   requested_speed;  /* speed user has requested */
-	unsigned int   speed;            /* actual link speed */
-	unsigned char  requested_fc;     /* flow control user has requested */
+	unsigned int   speed;            /* actual link speed (Mbps) */
 	unsigned char  fc;               /* actual link flow control */
-	unsigned char  requested_fec;    /* FEC user has requested */
 	unsigned char  fec;              /* actual FEC */
-	unsigned char  autoneg;          /* autonegotiating? */
 	unsigned char  link_ok;          /* link up? */
 	unsigned char  link_down_rc;     /* link down reason */
 };
@@ -576,7 +578,7 @@ int t4_prep_adapter(struct adapter *adapter, u8 *buf);
 int t4_shutdown_adapter(struct adapter *adapter);
 int t4_init_devlog_params(struct adapter *adapter, int fw_attach);
 int t4_init_sge_params(struct adapter *adapter);
-int t4_init_tp_params(struct adapter *adap);
+int t4_init_tp_params(struct adapter *adap, bool sleep_ok);
 int t4_filter_field_shift(const struct adapter *adap, int filter_sel);
 int t4_port_init(struct adapter *adap, int mbox, int pf, int vf, int port_id);
 void t4_fatal_err(struct adapter *adapter);
@@ -594,20 +596,21 @@ int t4_config_vi_rss(struct adapter *adapter, int mbox
 		     unsigned int flags, unsigned int defq, unsigned int skeyidx,
 		     unsigned int skey);
 int t4_read_rss(struct adapter *adapter, u16 *entries);
-void t4_fw_tp_pio_rw(struct adapter *adap, u32 *vals, unsigned int nregs,
-		  unsigned int start_index, unsigned int rw);
-void t4_read_rss_key(struct adapter *adapter, u32 *key);
-void t4_write_rss_key(struct adapter *adap, u32 *key, int idx);
-void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, u32 *valp);
-void t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, u32 val);
+void t4_read_rss_key(struct adapter *adapter, u32 *key, bool sleep_ok);
+void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx,
+		      bool sleep_ok);
+void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index,
+			   u32 *valp, bool sleep_ok);
+void t4_write_rss_pf_config(struct adapter *adapter, unsigned int index,
+			    u32 val, bool sleep_ok);
 void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index,
-			   u32 *vfl, u32 *vfh);
+			   u32 *vfl, u32 *vfh, bool sleep_ok);
 void t4_write_rss_vf_config(struct adapter *adapter, unsigned int index,
-			    u32 vfl, u32 vfh);
-u32 t4_read_rss_pf_map(struct adapter *adapter);
-void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap);
-u32 t4_read_rss_pf_mask(struct adapter *adapter);
-void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask);
+			    u32 vfl, u32 vfh, bool sleep_ok);
+u32 t4_read_rss_pf_map(struct adapter *adapter, bool sleep_ok);
+void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap, bool sleep_ok);
+u32 t4_read_rss_pf_mask(struct adapter *adapter, bool sleep_ok);
+void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask, bool sleep_ok);
 int t4_mps_set_active_ports(struct adapter *adap, unsigned int port_mask);
 void t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]);
 void t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]);
@@ -653,19 +656,24 @@ void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, 
 void t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]);
 void t4_read_pace_tbl(struct adapter *adap, unsigned int pace_vals[NTX_SCHED]);
 void t4_get_tx_sched(struct adapter *adap, unsigned int sched, unsigned int *kbps,
-		     unsigned int *ipg);
+		     unsigned int *ipg, bool sleep_ok);
 void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr,
 			    unsigned int mask, unsigned int val);
 void t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr);
-void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st);
-void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st);
-void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st);
-void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st);
-void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st);
+void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st,
+			 bool sleep_ok);
+void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st,
+    			   bool sleep_ok);
+void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st,
+			 bool sleep_ok);
+void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st,
+			  bool sleep_ok);
+void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st,
+		      bool sleep_ok);
 void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
-			 struct tp_tcp_stats *v6);
+			 struct tp_tcp_stats *v6, bool sleep_ok);
 void t4_get_fcoe_stats(struct adapter *adap, unsigned int idx,
-		       struct tp_fcoe_stats *st);
+		       struct tp_fcoe_stats *st, bool sleep_ok);
 void t4_load_mtus(struct adapter *adap, const unsigned short *mtus,
 		  const unsigned short *alpha, const unsigned short *beta);
 
@@ -676,7 +684,8 @@ int t4_set_sched_ipg(struct adapter *adap, int sched, 
 int t4_set_pace_tbl(struct adapter *adap, const unsigned int *pace_vals,
 		    unsigned int start, unsigned int n);
 void t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate);
-int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map);
+int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map,
+    bool sleep_ok);
 void t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid);
 
 void t4_wol_magic_enable(struct adapter *adap, unsigned int port, const u8 *addr);
@@ -766,6 +775,7 @@ int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned i
 		      u32 *data);
 int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox);
 const char *t4_link_down_rc_str(unsigned char link_down_rc);
+int t4_update_port_info(struct port_info *pi);
 int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl);
 int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, u32 addr, u32 val);
 int t4_sched_config(struct adapter *adapter, int type, int minmaxen,
@@ -787,6 +797,15 @@ int t4_config_watchdog(struct adapter *adapter, unsign
 int t4_get_devlog_level(struct adapter *adapter, unsigned int *level);
 int t4_set_devlog_level(struct adapter *adapter, unsigned int level);
 void t4_sge_decode_idma_state(struct adapter *adapter, int state);
+
+void t4_tp_pio_read(struct adapter *adap, u32 *buff, u32 nregs,
+		    u32 start_index, bool sleep_ok);
+void t4_tp_pio_write(struct adapter *adap, const u32 *buff, u32 nregs,
+		     u32 start_index, bool sleep_ok);
+void t4_tp_tm_pio_read(struct adapter *adap, u32 *buff, u32 nregs,
+		       u32 start_index, bool sleep_ok);
+void t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs,
+		    u32 start_index, bool sleep_ok);
 
 static inline int t4vf_query_params(struct adapter *adapter,
 				    unsigned int nparams, const u32 *params,

Modified: stable/10/sys/dev/cxgbe/common/t4_hw.c
==============================================================================
--- stable/10/sys/dev/cxgbe/common/t4_hw.c	Thu Oct 10 22:49:45 2019	(r353417)
+++ stable/10/sys/dev/cxgbe/common/t4_hw.c	Thu Oct 10 23:27:02 2019	(r353418)
@@ -466,7 +466,7 @@ static int t4_edc_err_read(struct adapter *adap, int i
 		CH_WARN(adap, "%s: T4 NOT supported.\n", __func__);
 		return 0;
 	}
-	if (idx != 0 && idx != 1) {
+	if (idx != MEM_EDC0 && idx != MEM_EDC1) {
 		CH_WARN(adap, "%s: idx %d NOT supported.\n", __func__, idx);
 		return 0;
 	}
@@ -883,7 +883,8 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t
 		0xd010, 0xd03c,
 		0xdfc0, 0xdfe0,
 		0xe000, 0xea7c,
-		0xf000, 0x11190,
+		0xf000, 0x11110,
+		0x11118, 0x11190,
 		0x19040, 0x1906c,
 		0x19078, 0x19080,
 		0x1908c, 0x190e4,
@@ -1421,8 +1422,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t
 		0x1ff00, 0x1ff84,
 		0x1ffc0, 0x1ffc8,
 		0x30000, 0x30030,
-		0x30038, 0x30038,
-		0x30040, 0x30040,
 		0x30100, 0x30144,
 		0x30190, 0x301a0,
 		0x301a8, 0x301b8,
@@ -1533,8 +1532,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t
 		0x33c3c, 0x33c50,
 		0x33cf0, 0x33cfc,
 		0x34000, 0x34030,
-		0x34038, 0x34038,
-		0x34040, 0x34040,
 		0x34100, 0x34144,
 		0x34190, 0x341a0,
 		0x341a8, 0x341b8,
@@ -1645,8 +1642,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t
 		0x37c3c, 0x37c50,
 		0x37cf0, 0x37cfc,
 		0x38000, 0x38030,
-		0x38038, 0x38038,
-		0x38040, 0x38040,
 		0x38100, 0x38144,
 		0x38190, 0x381a0,
 		0x381a8, 0x381b8,
@@ -1757,8 +1752,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t
 		0x3bc3c, 0x3bc50,
 		0x3bcf0, 0x3bcfc,
 		0x3c000, 0x3c030,
-		0x3c038, 0x3c038,
-		0x3c040, 0x3c040,
 		0x3c100, 0x3c144,
 		0x3c190, 0x3c1a0,
 		0x3c1a8, 0x3c1b8,
@@ -2251,13 +2244,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t
 		0x1ff00, 0x1ff84,
 		0x1ffc0, 0x1ffc8,
 		0x30000, 0x30030,
-		0x30038, 0x30038,
-		0x30040, 0x30040,
-		0x30048, 0x30048,
-		0x30050, 0x30050,
-		0x3005c, 0x30060,
-		0x30068, 0x30068,
-		0x30070, 0x30070,
 		0x30100, 0x30168,
 		0x30190, 0x301a0,
 		0x301a8, 0x301b8,
@@ -2320,13 +2306,12 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t
 		0x326a8, 0x326a8,
 		0x326ec, 0x326ec,
 		0x32a00, 0x32abc,
-		0x32b00, 0x32b38,
+		0x32b00, 0x32b18,
+		0x32b20, 0x32b38,
 		0x32b40, 0x32b58,
 		0x32b60, 0x32b78,
 		0x32c00, 0x32c00,
 		0x32c08, 0x32c3c,
-		0x32e00, 0x32e2c,
-		0x32f00, 0x32f2c,
 		0x33000, 0x3302c,
 		0x33034, 0x33050,
 		0x33058, 0x33058,
@@ -2391,13 +2376,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t
 		0x33c38, 0x33c50,
 		0x33cf0, 0x33cfc,
 		0x34000, 0x34030,
-		0x34038, 0x34038,
-		0x34040, 0x34040,
-		0x34048, 0x34048,
-		0x34050, 0x34050,
-		0x3405c, 0x34060,
-		0x34068, 0x34068,
-		0x34070, 0x34070,
 		0x34100, 0x34168,
 		0x34190, 0x341a0,
 		0x341a8, 0x341b8,
@@ -2460,13 +2438,12 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t
 		0x366a8, 0x366a8,
 		0x366ec, 0x366ec,
 		0x36a00, 0x36abc,
-		0x36b00, 0x36b38,
+		0x36b00, 0x36b18,
+		0x36b20, 0x36b38,
 		0x36b40, 0x36b58,
 		0x36b60, 0x36b78,
 		0x36c00, 0x36c00,
 		0x36c08, 0x36c3c,
-		0x36e00, 0x36e2c,
-		0x36f00, 0x36f2c,
 		0x37000, 0x3702c,
 		0x37034, 0x37050,
 		0x37058, 0x37058,
@@ -2697,6 +2674,7 @@ struct t4_vpd_hdr {
 #define EEPROM_MAX_POLL		5000		/* x 5000 == 50ms */
 
 #define EEPROM_STAT_ADDR	0x7bfc
+#define VPD_SIZE		0x800
 #define VPD_BASE		0x400
 #define VPD_BASE_OLD		0
 #define VPD_LEN			1024
@@ -3037,13 +3015,13 @@ enum {
 	SF_ATTEMPTS = 10,	/* max retries for SF operations */
 
 	/* flash command opcodes */
-	SF_PROG_PAGE    = 2,	/* program page */
+	SF_PROG_PAGE    = 2,	/* program 256B page */
 	SF_WR_DISABLE   = 4,	/* disable writes */
 	SF_RD_STATUS    = 5,	/* read status register */
 	SF_WR_ENABLE    = 6,	/* enable writes */
 	SF_RD_DATA_FAST = 0xb,	/* read flash */
 	SF_RD_ID	= 0x9f,	/* read ID */
-	SF_ERASE_SECTOR = 0xd8,	/* erase sector */
+	SF_ERASE_SECTOR = 0xd8,	/* erase 64KB sector */
 };
 
 /**
@@ -3680,9 +3658,6 @@ void t4_ulprx_read_la(struct adapter *adap, u32 *la_bu
 	}
 }
 
-#define ADVERT_MASK (V_FW_PORT_CAP_SPEED(M_FW_PORT_CAP_SPEED) | \
-		     FW_PORT_CAP_ANEG)
-
 /**
  *	t4_link_l1cfg - apply link configuration to MAC/PHY
  *	@phy: the PHY to setup
@@ -3701,7 +3676,7 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int m
 {
 	struct fw_port_cmd c;
 	unsigned int mdi = V_FW_PORT_CAP_MDI(FW_PORT_CAP_MDI_AUTO);
-	unsigned int fc, fec;
+	unsigned int aneg, fc, fec, speed, rcap;
 
 	fc = 0;
 	if (lc->requested_fc & PAUSE_RX)
@@ -3711,12 +3686,51 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int m
 
 	fec = 0;
 	if (lc->requested_fec & FEC_RS)
-		fec |= FW_PORT_CAP_FEC_RS;
-	if (lc->requested_fec & FEC_BASER_RS)
-		fec |= FW_PORT_CAP_FEC_BASER_RS;
-	if (lc->requested_fec & FEC_RESERVED)
-		fec |= FW_PORT_CAP_FEC_RESERVED;
+		fec = FW_PORT_CAP_FEC_RS;
+	else if (lc->requested_fec & FEC_BASER_RS)
+		fec = FW_PORT_CAP_FEC_BASER_RS;
 
+	if (!(lc->supported & FW_PORT_CAP_ANEG) ||
+	    lc->requested_aneg == AUTONEG_DISABLE) {
+		aneg = 0;
+		switch (lc->requested_speed) {
+		case 100000:
+			speed = FW_PORT_CAP_SPEED_100G;
+			break;
+		case 40000:
+			speed = FW_PORT_CAP_SPEED_40G;
+			break;
+		case 25000:
+			speed = FW_PORT_CAP_SPEED_25G;
+			break;
+		case 10000:
+			speed = FW_PORT_CAP_SPEED_10G;
+			break;
+		case 1000:
+			speed = FW_PORT_CAP_SPEED_1G;
+			break;
+		case 100:
+			speed = FW_PORT_CAP_SPEED_100M;
+			break;
+		default:
+			return -EINVAL;
+			break;
+		}
+	} else {
+		aneg = FW_PORT_CAP_ANEG;
+		speed = lc->supported &
+		    V_FW_PORT_CAP_SPEED(M_FW_PORT_CAP_SPEED);
+	}
+
+	rcap = aneg | speed | fc | fec | mdi;
+	if ((rcap | lc->supported) != lc->supported) {
+#ifdef INVARIANTS
+		CH_WARN(adap, "rcap 0x%08x, pcap 0x%08x\n", rcap,
+		    lc->supported);
+#endif
+		rcap &= lc->supported;
+	}
+
 	memset(&c, 0, sizeof(c));
 	c.op_to_portid = cpu_to_be32(V_FW_CMD_OP(FW_PORT_CMD) |
 				     F_FW_CMD_REQUEST | F_FW_CMD_EXEC |
@@ -3724,21 +3738,9 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int m
 	c.action_to_len16 =
 		cpu_to_be32(V_FW_PORT_CMD_ACTION(FW_PORT_ACTION_L1_CFG) |
 			    FW_LEN16(c));
+	c.u.l1cfg.rcap = cpu_to_be32(rcap);
 
-	if (!(lc->supported & FW_PORT_CAP_ANEG)) {
-		c.u.l1cfg.rcap = cpu_to_be32((lc->supported & ADVERT_MASK) |
-					     fc | fec);
-		lc->fc = lc->requested_fc & ~PAUSE_AUTONEG;
-		lc->fec = lc->requested_fec;
-	} else if (lc->autoneg == AUTONEG_DISABLE) {
-		c.u.l1cfg.rcap = cpu_to_be32(lc->requested_speed |
-					     fc | fec | mdi);
-		lc->fc = lc->requested_fc & ~PAUSE_AUTONEG;
-		lc->fec = lc->requested_fec;
-	} else
-		c.u.l1cfg.rcap = cpu_to_be32(lc->advertising | fc | fec | mdi);
-
-	return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
+	return t4_wr_mbox_ns(adap, mbox, &c, sizeof(c), NULL);
 }
 
 /**
@@ -3977,6 +3979,9 @@ static void sge_intr_handler(struct adapter *adapter)
 		  "SGE too many priority ingress contexts", -1, 0 },
 		{ F_INGRESS_SIZE_ERR, "SGE illegal ingress QID", -1, 0 },
 		{ F_EGRESS_SIZE_ERR, "SGE illegal egress QID", -1, 0 },
+		{ F_ERR_PCIE_ERROR0 | F_ERR_PCIE_ERROR1 |
+		  F_ERR_PCIE_ERROR2 | F_ERR_PCIE_ERROR3,
+		  "SGE PCIe error for a DBP thread", -1, 0 },
 		{ 0 }
 	};
 
@@ -3992,8 +3997,6 @@ static void sge_intr_handler(struct adapter *adapter)
  	* For now, treat below interrupts as fatal so that we disable SGE and
  	* get better debug */
 	static const struct intr_info t6_sge_intr_info[] = {
-		{ F_ERR_PCIE_ERROR0 | F_ERR_PCIE_ERROR1,
-		  "SGE PCIe error for a DBP thread", -1, 1 },
 		{ F_FATAL_WRE_LEN,
 		  "SGE Actual WRE packet is less than advertized length",
 		  -1, 1 },
@@ -4048,6 +4051,7 @@ static void cim_intr_handler(struct adapter *adapter)
 		{ F_MBHOSTPARERR, "CIM mailbox host parity error", -1, 1 },
 		{ F_TIEQINPARERRINT, "CIM TIEQ outgoing parity error", -1, 1 },
 		{ F_TIEQOUTPARERRINT, "CIM TIEQ incoming parity error", -1, 1 },
+		{ F_TIMER0INT, "CIM TIMER0 interrupt", -1, 1 },
 		{ 0 }
 	};
 	static const struct intr_info cim_upintr_info[] = {
@@ -4081,11 +4085,26 @@ static void cim_intr_handler(struct adapter *adapter)
 		{ F_TIMEOUTMAINT , "CIM PIF MA timeout", -1, 1 },
 		{ 0 }
 	};
+	u32 val, fw_err;
 	int fat;
 
-	if (t4_read_reg(adapter, A_PCIE_FW) & F_PCIE_FW_ERR)
+	fw_err = t4_read_reg(adapter, A_PCIE_FW);
+	if (fw_err & F_PCIE_FW_ERR)
 		t4_report_fw_error(adapter);
 
+	/* When the Firmware detects an internal error which normally wouldn't
+	 * raise a Host Interrupt, it forces a CIM Timer0 interrupt in order
+	 * to make sure the Host sees the Firmware Crash.  So if we have a
+	 * Timer0 interrupt and don't see a Firmware Crash, ignore the Timer0
+	 * interrupt.
+	 */
+	val = t4_read_reg(adapter, A_CIM_HOST_INT_CAUSE);
+	if (val & F_TIMER0INT)
+		if (!(fw_err & F_PCIE_FW_ERR) ||
+		    (G_PCIE_FW_EVAL(fw_err) != PCIE_FW_EVAL_CRASH))
+			t4_write_reg(adapter, A_CIM_HOST_INT_CAUSE,
+				     F_TIMER0INT);
+
 	fat = t4_handle_intr_status(adapter, A_CIM_HOST_INT_CAUSE,
 				    cim_intr_info) +
 	      t4_handle_intr_status(adapter, A_CIM_HOST_UPACC_INT_CAUSE,
@@ -4833,55 +4852,177 @@ int t4_read_rss(struct adapter *adapter, u16 *map)
 }
 
 /**
- *	t4_fw_tp_pio_rw - Access TP PIO through LDST
- *	@adap: the adapter
- *	@vals: where the indirect register values are stored/written
- *	@nregs: how many indirect registers to read/write
- *	@start_idx: index of first indirect register to read/write
- *	@rw: Read (1) or Write (0)
+ * t4_tp_fw_ldst_rw - Access TP indirect register through LDST
+ * @adap: the adapter
+ * @cmd: TP fw ldst address space type
+ * @vals: where the indirect register values are stored/written
+ * @nregs: how many indirect registers to read/write
+ * @start_idx: index of first indirect register to read/write
+ * @rw: Read (1) or Write (0)
+ * @sleep_ok: if true we may sleep while awaiting command completion
  *
- *	Access TP PIO registers through LDST
- */
-void t4_fw_tp_pio_rw(struct adapter *adap, u32 *vals, unsigned int nregs,
-		     unsigned int start_index, unsigned int rw)
+ * Access TP indirect registers through LDST
+ **/
+static int t4_tp_fw_ldst_rw(struct adapter *adap, int cmd, u32 *vals,
+			    unsigned int nregs, unsigned int start_index,
+			    unsigned int rw, bool sleep_ok)
 {
-	int ret, i;
-	int cmd = FW_LDST_ADDRSPC_TP_PIO;
+	int ret = 0;
+	unsigned int i;
 	struct fw_ldst_cmd c;
 
-	for (i = 0 ; i < nregs; i++) {
+	for (i = 0; i < nregs; i++) {
 		memset(&c, 0, sizeof(c));
 		c.op_to_addrspace = cpu_to_be32(V_FW_CMD_OP(FW_LDST_CMD) |
 						F_FW_CMD_REQUEST |
 						(rw ? F_FW_CMD_READ :
-						     F_FW_CMD_WRITE) |
+						      F_FW_CMD_WRITE) |
 						V_FW_LDST_CMD_ADDRSPACE(cmd));
 		c.cycles_to_len16 = cpu_to_be32(FW_LEN16(c));
 
 		c.u.addrval.addr = cpu_to_be32(start_index + i);
 		c.u.addrval.val  = rw ? 0 : cpu_to_be32(vals[i]);
-		ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c);
-		if (ret == 0) {
-			if (rw)
-				vals[i] = be32_to_cpu(c.u.addrval.val);
-		}
+		ret = t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c,
+				      sleep_ok);
+		if (ret)
+			return ret;
+
+		if (rw)
+			vals[i] = be32_to_cpu(c.u.addrval.val);
 	}
+	return 0;
 }
 
 /**
+ * t4_tp_indirect_rw - Read/Write TP indirect register through LDST or backdoor
+ * @adap: the adapter
+ * @reg_addr: Address Register
+ * @reg_data: Data register
+ * @buff: where the indirect register values are stored/written
+ * @nregs: how many indirect registers to read/write
+ * @start_index: index of first indirect register to read/write
+ * @rw: READ(1) or WRITE(0)
+ * @sleep_ok: if true we may sleep while awaiting command completion
+ *
+ * Read/Write TP indirect registers through LDST if possible.
+ * Else, use backdoor access
+ **/
+static void t4_tp_indirect_rw(struct adapter *adap, u32 reg_addr, u32 reg_data,
+			      u32 *buff, u32 nregs, u32 start_index, int rw,
+			      bool sleep_ok)
+{
+	int rc = -EINVAL;
+	int cmd;
+
+	switch (reg_addr) {
+	case A_TP_PIO_ADDR:
+		cmd = FW_LDST_ADDRSPC_TP_PIO;
+		break;
+	case A_TP_TM_PIO_ADDR:
+		cmd = FW_LDST_ADDRSPC_TP_TM_PIO;
+		break;
+	case A_TP_MIB_INDEX:
+		cmd = FW_LDST_ADDRSPC_TP_MIB;
+		break;
+	default:
+		goto indirect_access;
+	}
+
+	if (t4_use_ldst(adap))
+		rc = t4_tp_fw_ldst_rw(adap, cmd, buff, nregs, start_index, rw,
+				      sleep_ok);
+
+indirect_access:
+
+	if (rc) {
+		if (rw)
+			t4_read_indirect(adap, reg_addr, reg_data, buff, nregs,
+					 start_index);
+		else
+			t4_write_indirect(adap, reg_addr, reg_data, buff, nregs,
+					  start_index);
+	}
+}
+
+/**
+ * t4_tp_pio_read - Read TP PIO registers
+ * @adap: the adapter
+ * @buff: where the indirect register values are written
+ * @nregs: how many indirect registers to read
+ * @start_index: index of first indirect register to read
+ * @sleep_ok: if true we may sleep while awaiting command completion
+ *
+ * Read TP PIO Registers
+ **/
+void t4_tp_pio_read(struct adapter *adap, u32 *buff, u32 nregs,
+		    u32 start_index, bool sleep_ok)
+{
+	t4_tp_indirect_rw(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, buff, nregs,
+			  start_index, 1, sleep_ok);
+}
+
+/**
+ * t4_tp_pio_write - Write TP PIO registers
+ * @adap: the adapter
+ * @buff: where the indirect register values are stored
+ * @nregs: how many indirect registers to write
+ * @start_index: index of first indirect register to write
+ * @sleep_ok: if true we may sleep while awaiting command completion
+ *
+ * Write TP PIO Registers
+ **/
+void t4_tp_pio_write(struct adapter *adap, const u32 *buff, u32 nregs,
+		     u32 start_index, bool sleep_ok)
+{
+	t4_tp_indirect_rw(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA,
+	    __DECONST(u32 *, buff), nregs, start_index, 0, sleep_ok);
+}
+
+/**
+ * t4_tp_tm_pio_read - Read TP TM PIO registers
+ * @adap: the adapter
+ * @buff: where the indirect register values are written
+ * @nregs: how many indirect registers to read
+ * @start_index: index of first indirect register to read
+ * @sleep_ok: if true we may sleep while awaiting command completion
+ *
+ * Read TP TM PIO Registers
+ **/
+void t4_tp_tm_pio_read(struct adapter *adap, u32 *buff, u32 nregs,
+		       u32 start_index, bool sleep_ok)
+{
+	t4_tp_indirect_rw(adap, A_TP_TM_PIO_ADDR, A_TP_TM_PIO_DATA, buff,
+			  nregs, start_index, 1, sleep_ok);
+}
+
+/**
+ * t4_tp_mib_read - Read TP MIB registers
+ * @adap: the adapter
+ * @buff: where the indirect register values are written
+ * @nregs: how many indirect registers to read
+ * @start_index: index of first indirect register to read
+ * @sleep_ok: if true we may sleep while awaiting command completion
+ *
+ * Read TP MIB Registers
+ **/
+void t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs, u32 start_index,
+		    bool sleep_ok)
+{
+	t4_tp_indirect_rw(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, buff, nregs,
+			  start_index, 1, sleep_ok);
+}
+
+/**
  *	t4_read_rss_key - read the global RSS key
  *	@adap: the adapter
  *	@key: 10-entry array holding the 320-bit RSS key
+ * 	@sleep_ok: if true we may sleep while awaiting command completion
  *
  *	Reads the global 320-bit RSS key.
  */
-void t4_read_rss_key(struct adapter *adap, u32 *key)
+void t4_read_rss_key(struct adapter *adap, u32 *key, bool sleep_ok)
 {
-	if (t4_use_ldst(adap))
-		t4_fw_tp_pio_rw(adap, key, 10, A_TP_RSS_SECRET_KEY0, 1);
-	else
-		t4_read_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, key, 10,
-				 A_TP_RSS_SECRET_KEY0);
+	t4_tp_pio_read(adap, key, 10, A_TP_RSS_SECRET_KEY0, sleep_ok);
 }
 
 /**
@@ -4889,12 +5030,14 @@ void t4_read_rss_key(struct adapter *adap, u32 *key)
  *	@adap: the adapter
  *	@key: 10-entry array holding the 320-bit RSS key
  *	@idx: which RSS key to write
+ * 	@sleep_ok: if true we may sleep while awaiting command completion
  *
  *	Writes one of the RSS keys with the given 320-bit value.  If @idx is
  *	0..15 the corresponding entry in the RSS key table is written,
  *	otherwise the global RSS key is written.
  */
-void t4_write_rss_key(struct adapter *adap, u32 *key, int idx)
+void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx,
+		      bool sleep_ok)
 {
 	u8 rss_key_addr_cnt = 16;
 	u32 vrt = t4_read_reg(adap, A_TP_RSS_CONFIG_VRT);
@@ -4908,11 +5051,7 @@ void t4_write_rss_key(struct adapter *adap, u32 *key, 
 	    (vrt & F_KEYEXTEND) && (G_KEYMODE(vrt) == 3))
 		rss_key_addr_cnt = 32;
 
-	if (t4_use_ldst(adap))
-		t4_fw_tp_pio_rw(adap, key, 10, A_TP_RSS_SECRET_KEY0, 0);
-	else
-		t4_write_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, key, 10,
-				  A_TP_RSS_SECRET_KEY0);
+	t4_tp_pio_write(adap, key, 10, A_TP_RSS_SECRET_KEY0, sleep_ok);
 
 	if (idx >= 0 && idx < rss_key_addr_cnt) {
 		if (rss_key_addr_cnt > 16)
@@ -4930,19 +5069,15 @@ void t4_write_rss_key(struct adapter *adap, u32 *key, 
  *	@adapter: the adapter
  *	@index: the entry in the PF RSS table to read
  *	@valp: where to store the returned value
+ * 	@sleep_ok: if true we may sleep while awaiting command completion
  *
  *	Reads the PF RSS Configuration Table at the specified index and returns
  *	the value found there.
  */
 void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index,
-			   u32 *valp)
+			   u32 *valp, bool sleep_ok)
 {
-	if (t4_use_ldst(adapter))
-		t4_fw_tp_pio_rw(adapter, valp, 1,
-				A_TP_RSS_PF0_CONFIG + index, 1);
-	else
-		t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA,
-				 valp, 1, A_TP_RSS_PF0_CONFIG + index);
+	t4_tp_pio_read(adapter, valp, 1, A_TP_RSS_PF0_CONFIG + index, sleep_ok);
 }
 
 /**
@@ -4950,19 +5085,16 @@ void t4_read_rss_pf_config(struct adapter *adapter, un
  *	@adapter: the adapter
  *	@index: the entry in the VF RSS table to read
  *	@val: the value to store
+ * 	@sleep_ok: if true we may sleep while awaiting command completion
  *
  *	Writes the PF RSS Configuration Table at the specified index with the
  *	specified value.
  */
 void t4_write_rss_pf_config(struct adapter *adapter, unsigned int index,
-			    u32 val)
+			    u32 val, bool sleep_ok)
 {
-	if (t4_use_ldst(adapter))
-		t4_fw_tp_pio_rw(adapter, &val, 1,
-				A_TP_RSS_PF0_CONFIG + index, 0);
-	else
-		t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA,
-				  &val, 1, A_TP_RSS_PF0_CONFIG + index);
+	t4_tp_pio_write(adapter, &val, 1, A_TP_RSS_PF0_CONFIG + index,
+			sleep_ok);
 }
 
 /**
@@ -4971,12 +5103,13 @@ void t4_write_rss_pf_config(struct adapter *adapter, u
  *	@index: the entry in the VF RSS table to read
  *	@vfl: where to store the returned VFL
  *	@vfh: where to store the returned VFH
+ * 	@sleep_ok: if true we may sleep while awaiting command completion
  *
  *	Reads the VF RSS Configuration Table at the specified index and returns
  *	the (VFL, VFH) values found there.
  */
 void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index,
-			   u32 *vfl, u32 *vfh)
+			   u32 *vfl, u32 *vfh, bool sleep_ok)
 {
 	u32 vrt, mask, data;
 
@@ -4998,15 +5131,8 @@ void t4_read_rss_vf_config(struct adapter *adapter, un
 	/*
 	 * Grab the VFL/VFH values ...
 	 */
-	if (t4_use_ldst(adapter)) {
-		t4_fw_tp_pio_rw(adapter, vfl, 1, A_TP_RSS_VFL_CONFIG, 1);
-		t4_fw_tp_pio_rw(adapter, vfh, 1, A_TP_RSS_VFH_CONFIG, 1);
-	} else {
-		t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA,
-				 vfl, 1, A_TP_RSS_VFL_CONFIG);
-		t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA,
-				 vfh, 1, A_TP_RSS_VFH_CONFIG);
-	}
+	t4_tp_pio_read(adapter, vfl, 1, A_TP_RSS_VFL_CONFIG, sleep_ok);
+	t4_tp_pio_read(adapter, vfh, 1, A_TP_RSS_VFH_CONFIG, sleep_ok);
 }
 
 /**
@@ -5021,7 +5147,7 @@ void t4_read_rss_vf_config(struct adapter *adapter, un
  *	specified (VFL, VFH) values.
  */
 void t4_write_rss_vf_config(struct adapter *adapter, unsigned int index,
-			    u32 vfl, u32 vfh)
+			    u32 vfl, u32 vfh, bool sleep_ok)
 {
 	u32 vrt, mask, data;
 
@@ -5036,15 +5162,8 @@ void t4_write_rss_vf_config(struct adapter *adapter, u
 	/*
 	 * Load up VFL/VFH with the values to be written ...
 	 */
-	if (t4_use_ldst(adapter)) {
-		t4_fw_tp_pio_rw(adapter, &vfl, 1, A_TP_RSS_VFL_CONFIG, 0);
-		t4_fw_tp_pio_rw(adapter, &vfh, 1, A_TP_RSS_VFH_CONFIG, 0);
-	} else {
-		t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA,
-				  &vfl, 1, A_TP_RSS_VFL_CONFIG);
-		t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA,
-				  &vfh, 1, A_TP_RSS_VFH_CONFIG);
-	}
+	t4_tp_pio_write(adapter, &vfl, 1, A_TP_RSS_VFL_CONFIG, sleep_ok);
+	t4_tp_pio_write(adapter, &vfh, 1, A_TP_RSS_VFH_CONFIG, sleep_ok);
 
 	/*
 	 * Write the VFL/VFH into the VF Table at index'th location.
@@ -5058,18 +5177,16 @@ void t4_write_rss_vf_config(struct adapter *adapter, u
 /**
  *	t4_read_rss_pf_map - read PF RSS Map
  *	@adapter: the adapter
+ * 	@sleep_ok: if true we may sleep while awaiting command completion
  *
  *	Reads the PF RSS Map register and returns its value.
  */
-u32 t4_read_rss_pf_map(struct adapter *adapter)
+u32 t4_read_rss_pf_map(struct adapter *adapter, bool sleep_ok)
 {
 	u32 pfmap;
 
-	if (t4_use_ldst(adapter))
-		t4_fw_tp_pio_rw(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, 1);
-	else
-		t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA,
-				 &pfmap, 1, A_TP_RSS_PF_MAP);
+	t4_tp_pio_read(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, sleep_ok);
+
 	return pfmap;
 }
 
@@ -5080,30 +5197,24 @@ u32 t4_read_rss_pf_map(struct adapter *adapter)
  *
  *	Writes the specified value to the PF RSS Map register.
  */
-void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap)
+void t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap, bool sleep_ok)
 {
-	if (t4_use_ldst(adapter))
-		t4_fw_tp_pio_rw(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, 0);
-	else
-		t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA,
-				  &pfmap, 1, A_TP_RSS_PF_MAP);
+	t4_tp_pio_write(adapter, &pfmap, 1, A_TP_RSS_PF_MAP, sleep_ok);
 }
 
 /**
  *	t4_read_rss_pf_mask - read PF RSS Mask
  *	@adapter: the adapter
+ * 	@sleep_ok: if true we may sleep while awaiting command completion
  *
  *	Reads the PF RSS Mask register and returns its value.
  */
-u32 t4_read_rss_pf_mask(struct adapter *adapter)
+u32 t4_read_rss_pf_mask(struct adapter *adapter, bool sleep_ok)
 {
 	u32 pfmask;
 
-	if (t4_use_ldst(adapter))
-		t4_fw_tp_pio_rw(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, 1);
-	else
-		t4_read_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA,
-				 &pfmask, 1, A_TP_RSS_PF_MSK);
+	t4_tp_pio_read(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, sleep_ok);
+
 	return pfmask;
 }
 
@@ -5114,13 +5225,9 @@ u32 t4_read_rss_pf_mask(struct adapter *adapter)
  *
  *	Writes the specified value to the PF RSS Mask register.
  */
-void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask)
+void t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask, bool sleep_ok)
 {
-	if (t4_use_ldst(adapter))
-		t4_fw_tp_pio_rw(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, 0);
-	else
-		t4_write_indirect(adapter, A_TP_PIO_ADDR, A_TP_PIO_DATA,
-				  &pfmask, 1, A_TP_RSS_PF_MSK);
+	t4_tp_pio_write(adapter, &pfmask, 1, A_TP_RSS_PF_MSK, sleep_ok);
 }
 
 /**
@@ -5128,12 +5235,13 @@ void t4_write_rss_pf_mask(struct adapter *adapter, u32
  *	@adap: the adapter
  *	@v4: holds the TCP/IP counter values
  *	@v6: holds the TCP/IPv6 counter values
+ * 	@sleep_ok: if true we may sleep while awaiting command completion
  *
  *	Returns the values of TP's TCP/IP and TCP/IPv6 MIB counters.
  *	Either @v4 or @v6 may be %NULL to skip the corresponding stats.
  */
 void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
-			 struct tp_tcp_stats *v6)
+			 struct tp_tcp_stats *v6, bool sleep_ok)
 {
 	u32 val[A_TP_MIB_TCP_RXT_SEG_LO - A_TP_MIB_TCP_OUT_RST + 1];
 
@@ -5142,16 +5250,16 @@ void t4_tp_get_tcp_stats(struct adapter *adap, struct 
 #define STAT64(x)   (((u64)STAT(x##_HI) << 32) | STAT(x##_LO))
 
 	if (v4) {
-		t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, val,
-				 ARRAY_SIZE(val), A_TP_MIB_TCP_OUT_RST);
+		t4_tp_mib_read(adap, val, ARRAY_SIZE(val),
+			       A_TP_MIB_TCP_OUT_RST, sleep_ok);
 		v4->tcp_out_rsts = STAT(OUT_RST);
 		v4->tcp_in_segs  = STAT64(IN_SEG);
 		v4->tcp_out_segs = STAT64(OUT_SEG);
 		v4->tcp_retrans_segs = STAT64(RXT_SEG);
 	}
 	if (v6) {
-		t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, val,
-				 ARRAY_SIZE(val), A_TP_MIB_TCP_V6OUT_RST);
+		t4_tp_mib_read(adap, val, ARRAY_SIZE(val),
+			       A_TP_MIB_TCP_V6OUT_RST, sleep_ok);
 		v6->tcp_out_rsts = STAT(OUT_RST);
 		v6->tcp_in_segs  = STAT64(IN_SEG);
 		v6->tcp_out_segs = STAT64(OUT_SEG);
@@ -5166,32 +5274,41 @@ void t4_tp_get_tcp_stats(struct adapter *adap, struct 
  *	t4_tp_get_err_stats - read TP's error MIB counters
  *	@adap: the adapter
  *	@st: holds the counter values
+ * 	@sleep_ok: if true we may sleep while awaiting command completion
  *
  *	Returns the values of TP's error counters.
  */
-void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st)
+void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st,
+			 bool sleep_ok)
 {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910102327.x9ANR3Ca072447>