svn commit: r330307 - in stable/11: share/man/man4 sys/conf sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/cudbg sys/dev/cxgbe/firmware sys/dev/cxgbe/iw_cxgbe sys/dev/cxgbe/tom sys/modules/cxgbe/...

Navdeep Parhar np at FreeBSD.org
Sat Mar 3 02:30:54 UTC 2018


Author: np
Date: Sat Mar  3 02:30:52 2018
New Revision: 330307
URL: https://svnweb.freebsd.org/changeset/base/330307

Log:
  MFC r319506, r319872, r321063, r321103, r321179, r321390, r321435,
  r321582, r321671, r322014, r322034, r322055, r322123, r322167, r322425,
  r322549, r322914, r322960, r322962, r322964, r322985, r322990, r323006,
  r323026, r323041, r323069, r323078, r323343, r323514, r323520, r324296,
  r324379, r324386, r324443, r324945, r325596, r325680, r325880,
  r325883-r325884, r325961, r326026, r326042, r327062, r327093, r327332,
  r327528, r328420, and r328423.
  
  r319506:
  cxgbe(4): Update the statistics for compound tx work requests once per
  work request, not once per frame.
  
  r319872:
  cxgbe(4):  Do not request an FEC setting that the port does not support.
  
  r321063:
  cxgbe(4): Various link/media related improvements.
  
  - Deal with changes to port_type, and not just port_mod when a
    transceiver is changed.  This fixes hot swapping of transceivers of
    different types (QSFP+ or QSA or QSFP28 in a QSFP28 port, SFP+ or
    SFP28 in a SFP28 port, etc.).
  
  - Always refresh media information for ifconfig if the port is down.
    The firmware does not generate tranceiver-change interrupts unless at
    least one VI is enabled on the physical port.  Before this change
    ifconfig diplayed potentially stale information for ports that were
    administratively down.
  
  - Always recalculate and reapply L1 config on a transceiver change.
  
  - Display PAUSE settings in ifconfig.  The driver sysctls for this
    continue to work as well.
  
  r321103:
  cxgbe(4): New ioctls to flash bootrom and boot config to the card.
  
  r321179:
  cxgbe/t4_tom: Log more details about the newly ESTABLISHED tid to the
  trace buffer.
  
  r321390:
  cxgbe(4): Install the firmware bundled with the driver to the card if it
  doesn't seem to have one.  This lets the driver recover automatically
  from incomplete firmware upgrades (panic, reboot, power loss, etc. in
  the middle of an upgrade).
  
  r321435:
  cxgbe(4): Display some more TOE parameters related to retransmission
  and keepalive in the sysctl MIB.  Provide tunables to change some of
  these parameters.  These are supposed to be setup by the firmware so
  these tunables are for experimentation only.
  
  r321582:
  cxgbe(4): Some updates to the common code.
  
  - Updated register ranges.
  - Helper routines for access to TP registers.
  - Updated routine to read flash parameters.
  
  r321671:
  cxgbe/iw_cxgbe: Log the end point's history and flags to the trace
  buffer just before it's freed.
  
  r322014:
  cxgbe(4): Initial import of the "collect" component of Chelsio unified
  debug (cudbg) code, hooked up to the main driver via an ioctl.
  
  The ioctl can be used to collect the chip's internal state in a
  compressed dump file.  These dumps can be decoded with the "view"
  component of cudbg.
  
  r322034:
  cxgbe(4): Always use the first and not the last virtual interface
  associated with a port in begin_synchronized_op.
  
  r322055:
  cxgbe(4): Allow the TOE timer tunables to be set with microsecond
  precision.  These timers are already displayed in microseconds in the
  sysctl MIB.  Add variables to track these tunables while here.
  
  r322123:
  cxgbe(4): Avoid a NULL dereference that would occur during module unload
  if there were problems earlier during attach.
  
  r322167:
  cxgbe(4): Add the T6 and T5 Unified Wire configuration files to the
  kernel, just like for T4, when the driver is compiled into the kernel.
  
  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.
  
  r322549:
  cxgbe/t4_tom: Use correct name for the ISS-valid bit in options2.
  
  r322914:
  cxgbe(4): Dump the mailbox contents in the same format as CH_DUMP_MBOX.
  
  r322960:
  cxgbe(4): Verify that the driver accesses the firmware mailbox in a
  thread-safe manner.
  
  r322962:
  cxgbe(4): Remove write only variable from t4_port_init.
  
  r322964:
  cxgbe(4): vi_mac_funcs should include the base Ethernet function.  It is
  already used in the driver as if it does.
  
  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.
  
  r322990:
  cxgbe(4): Do not access the mailbox without appropriate locks while
  creating hardware VIs.
  
  This fixes a bad race on systems with hw.cxgbe.num_vis > 1.
  
  r323006:
  cxgbe(4): Update T6/T5/T4 firmwares to 1.16.59.0.
  
  r323026:
  cxgbe(4): Zero out the memory allocated for the debug dump.
  cudbg_collect seems to expect it this way.
  
  r323041:
  cxgbe(4): Add two new debug flags -- one to allow manual firmware
  install after full initialization, and another to disable the TCB
  cache (T6+).  The latter works as a tunable only.
  
  Note that debug_flags are for debugging only and should not be set
  normally.
  
  r323069:
  cxgbe/t4_tom: Add a knob to select the congestion control algorigthm
  used by the TOE hardware for fully offloaded connections.  The knob
  affects new connections only.
  
  r323078:
  cxgbe/t4_tom: There may not be a tid to update if the connection isn't
  established.
  
  r323343:
  cxgbe(4): Fix a couple of problems in the sge_wrq data path.
  
  - start_wrq_wr must not drain the wr_list if there are incomplete_wrs
    pending.  This can happen when a t4_wrq_tx runs between two
    start_wrq_wr.
  
  - commit_wrq_wr must examine the cookie's pidx and ndesc with the
    queue's lock held.  Otherwise there is a bad race when incomplete WRs
    are being completed and commit_wrq_wr for the WR that is ahead in the
    queue updates the next incomplete WR's cookie's pidx/ndesc but the
    commit_wrq_wr for the second one is using stale values that it read
    without the lock.
  
  r323514:
  cxgbetool(8): mode must be specified when creating the dump file.
  
  r323520:
  cxgbe(4): Ignore capabilities that depend on TOE when the firmware
  reports TOE is not available.
  
  r324296:
  cxgbe(4): Provide knobs to set the holdoff parameters of TOE rx queues
  separately from NIC rx queues instead of using the same parameters for
  both types of queues.
  
  r324379:
  cxgbetool(8): Do not create a large file devoid of useful content when
  the dumpstate ioctl fails.  Make the file world-readable while here.
  
  r324386:
  cxgbe(4): Update T6, T5, and T4 firmwares to 1.16.63.0.
  
  r324443:
  cxgbetool(8): Do not close uninitialized fd on malloc failure.
  
  r324945:
  cxgbe(4): Read the MPS buffer group map from the firmware as it could be
  different from hardware defaults.  The congestion channel map, which is
  still fixed, needs to be tracked separately now.  Change the congestion
  setting for TOE rx queues to match the drivers on other OSes while here.
  
  r325596:
  cxgbe(4): Do not request settings not supported by the port.
  
  r325680:
  cxgbe(4): Excluce mdi from the check against port capabilities.
  
  r325880:
  cxgbe(4):  Combine all _10g and _1g tunables and drop the suffix from
  their names.  The finer-grained knobs weren't practically useful.
  
  r325883:
  cxgbe(4): Sanitize t4_num_vis during MOD_LOAD like all other t4_*
  tunables.  Add num_vis to the intrs_and_queues structure as it affects
  the number of interrupts requested and queues created.  In future
  cfg_itype_and_nqueues might lower it incrementally instead of going
  straight to 1 when enough interrupts aren't available.
  
  r325884:
  cxgbe(4): Remove rsrv_noflowq from intrs_and_queues structure as it does
  not influence or get affected by the number of interrupts or queues.
  
  r325961:
  cxgbe(4): Add core Vdd to the sysctl MIB.
  
  r326026:
  cxgbe(4): Add a custom board to the device id list.
  
  r326042:
  cxgbe(4): Fix unsafe mailbox access in cudbg.
  
  r327062:
  cxgbe(4):  Read the MFG diags version from the VPD and make it available
  in the sysctl MIB.
  
  r327093:
  cxgbe(4): Do not forward interrupts to queues with freelists.  This
  leaves the firmware event queue (fwq) as the only queue that can take
  interrupts for others.
  
  This simplifies cfg_itype_and_nqueues and queue allocation in the driver
  at the cost of a little (never?) used configuration.  It also allows
  service_iq to be split into two specialized variants in the future.
  
  r327332:
  cxgbe(4): Reduce duplication by consolidating minor variations of the
  same code into a single routine.
  
  r327528:
  cxgbe(4): Add a knob to enable/disable PCIe relaxed ordering.  Disable it by
  default when running on Intel CPUs.
  
  r328420:
  cxgbe(4): Do not display harmless warning in non-debug builds.
  
  r328423:
  cxgbe(4): Accept old names of a couple of tunables.
  
  Sponsored by:	Chelsio Communications

Added:
  stable/11/sys/dev/cxgbe/cudbg/
     - copied from r322014, head/sys/dev/cxgbe/cudbg/
  stable/11/sys/dev/cxgbe/firmware/t4fw-1.16.63.0.bin.uu
     - copied unchanged from r324386, head/sys/dev/cxgbe/firmware/t4fw-1.16.63.0.bin.uu
  stable/11/sys/dev/cxgbe/firmware/t5fw-1.16.63.0.bin.uu
     - copied unchanged from r324386, head/sys/dev/cxgbe/firmware/t5fw-1.16.63.0.bin.uu
  stable/11/sys/dev/cxgbe/firmware/t6fw-1.16.63.0.bin.uu
     - copied unchanged from r324386, head/sys/dev/cxgbe/firmware/t6fw-1.16.63.0.bin.uu
Deleted:
  stable/11/sys/dev/cxgbe/firmware/t4fw-1.16.45.0.bin.uu
  stable/11/sys/dev/cxgbe/firmware/t5fw-1.16.45.0.bin.uu
  stable/11/sys/dev/cxgbe/firmware/t6fw-1.16.45.0.bin.uu
Modified:
  stable/11/share/man/man4/cxgbe.4
  stable/11/share/man/man4/cxgbev.4
  stable/11/sys/conf/files
  stable/11/sys/dev/cxgbe/adapter.h
  stable/11/sys/dev/cxgbe/common/common.h
  stable/11/sys/dev/cxgbe/common/t4_hw.c
  stable/11/sys/dev/cxgbe/common/t4_hw.h
  stable/11/sys/dev/cxgbe/cudbg/cudbg_lib.c
  stable/11/sys/dev/cxgbe/firmware/t4fw_interface.h
  stable/11/sys/dev/cxgbe/firmware/t6fw_cfg.txt
  stable/11/sys/dev/cxgbe/firmware/t6fw_cfg_uwire.txt
  stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c
  stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c
  stable/11/sys/dev/cxgbe/offload.h
  stable/11/sys/dev/cxgbe/t4_ioctl.h
  stable/11/sys/dev/cxgbe/t4_main.c
  stable/11/sys/dev/cxgbe/t4_netmap.c
  stable/11/sys/dev/cxgbe/t4_sched.c
  stable/11/sys/dev/cxgbe/t4_sge.c
  stable/11/sys/dev/cxgbe/t4_vf.c
  stable/11/sys/dev/cxgbe/tom/t4_connect.c
  stable/11/sys/dev/cxgbe/tom/t4_cpl_io.c
  stable/11/sys/dev/cxgbe/tom/t4_listen.c
  stable/11/sys/dev/cxgbe/tom/t4_tom.c
  stable/11/sys/modules/cxgbe/if_cxgbe/Makefile
  stable/11/sys/modules/cxgbe/t4_firmware/Makefile
  stable/11/sys/modules/cxgbe/t5_firmware/Makefile
  stable/11/sys/modules/cxgbe/t6_firmware/Makefile
  stable/11/usr.sbin/cxgbetool/cxgbetool.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/cxgbe.4
==============================================================================
--- stable/11/share/man/man4/cxgbe.4	Sat Mar  3 02:06:48 2018	(r330306)
+++ stable/11/share/man/man4/cxgbe.4	Sat Mar  3 02:30:52 2018	(r330307)
@@ -172,37 +172,22 @@ types.
 A negative value for such a tunable instructs the driver to create
 up to that many queues if there are enough CPU cores available.
 .Bl -tag -width indent
-.It Va hw.cxgbe.ntxq10g
-Number of tx queues used for a 10Gb or higher-speed port.
+.It Va hw.cxgbe.ntxq
+Number of NIC tx queues used for a port.
 The default is 16 or the number
 of CPU cores in the system, whichever is less.
-.It Va hw.cxgbe.nrxq10g
-Number of rx queues used for a 10Gb or higher-speed port.
+.It Va hw.cxgbe.nrxq
+Number of NIC rx queues used for a port.
 The default is 8 or the number
 of CPU cores in the system, whichever is less.
-.It Va hw.cxgbe.ntxq1g
-Number of tx queues used for a 1Gb port.
-The default is 4 or the number
-of CPU cores in the system, whichever is less.
-.It Va hw.cxgbe.nrxq1g
-Number of rx queues used for a 1Gb port.
-The default is 2 or the number
-of CPU cores in the system, whichever is less.
-.It Va hw.cxgbe.nofldtxq10g
-Number of TOE tx queues used for a 10Gb or higher-speed port.
+.It Va hw.cxgbe.nofldtxq
+Number of TOE tx queues used for a port.
 The default is 8 or the
 number of CPU cores in the system, whichever is less.
-.It Va hw.cxgbe.nofldrxq10g
-Number of TOE rx queues used for a 10Gb or higher-speed port.
+.It Va hw.cxgbe.nofldrxq
+Number of TOE rx queues used for a port.
 The default is 2 or the
 number of CPU cores in the system, whichever is less.
-.It Va hw.cxgbe.nofldtxq1g
-Number of TOE tx queues used for a 1Gb port.
-The default is 2 or the
-number of CPU cores in the system, whichever is less.
-.It Va hw.cxgbe.nofldrxq1g
-Number of TOE rx queues used for a 1Gb port.
-The default is 1.
 .It Va hw.cxgbe.num_vis
 Number of virtual interfaces (VIs) created for each port.
 Each virtual interface creates a separate network interface.
@@ -213,25 +198,27 @@ name from the table above.
 Additional virtual interfaces use a single pair of queues
 for rx and tx as well an additional pair of queues for TOE rx and tx.
 The default is 1.
-.It Va hw.cxgbe.holdoff_timer_idx_10G
-.It Va hw.cxgbe.holdoff_timer_idx_1G
+.It Va hw.cxgbe.holdoff_timer_idx
+.It Va hw.cxgbe.holdoff_timer_idx_ofld
 Timer index value used to delay interrupts.
 The holdoff timer list has the values 1, 5, 10, 50, 100, and 200
 by default (all values are in microseconds) and the index selects a
 value from this list.
+holdoff_timer_idx_ofld applies to queues used for TOE rx.
 The default value is 1 which means the timer value is 5us.
 Different interfaces can be assigned different values at any time via the
-dev.<port>.X.holdoff_tmr_idx sysctl.
-.It Va hw.cxgbe.holdoff_pktc_idx_10G
-.It Va hw.cxgbe.holdoff_pktc_idx_1G
+dev.<port>.X.holdoff_tmr_idx and dev.<port>.X.holdoff_tmr_idx_ofld sysctls.
+.It Va hw.cxgbe.holdoff_pktc_idx
+.It Va hw.cxgbe.holdoff_pktc_idx_ofld
 Packet-count index value used to delay interrupts.
 The packet-count list has the values 1, 8, 16, and 32 by default,
 and the index selects a value from this list.
+holdoff_pktc_idx_ofld applies to queues used for TOE rx.
 The default value is -1 which means packet counting is disabled and interrupts
 are generated based solely on the holdoff timer value.
 Different interfaces can be assigned different values via the
-dev.<port>.X.holdoff_pktc_idx sysctl.
-This sysctl works only when the interface has never been marked up (as done by
+dev.<port>.X.holdoff_pktc_idx and dev.<port>.X.holdoff_pktc_idx_ofld sysctls.
+These sysctls work only when the interface has never been marked up (as done by
 ifconfig up).
 .It Va hw.cxgbe.qsize_txq
 Number of entries in a transmit queue's descriptor ring.
@@ -256,6 +243,13 @@ Permitted interrupt types.
 Bit 0 represents INTx (line interrupts), bit 1 MSI, and bit 2 MSI-X.
 The default is 7 (all allowed).
 The driver selects the best possible type out of the allowed types.
+.It Va hw.cxgbe.pcie_relaxed_ordering
+PCIe Relaxed Ordering.
+-1 indicates the driver should determine whether to enable or disable PCIe RO.
+0 disables PCIe RO.
+1 enables PCIe RO.
+2 indicates the driver should not modify the PCIe RO setting.
+The default is -1.
 .It Va hw.cxgbe.fw_install
 0 prohibits the driver from installing a firmware on the card.
 1 allows the driver to install a new firmware if internal driver

Modified: stable/11/share/man/man4/cxgbev.4
==============================================================================
--- stable/11/share/man/man4/cxgbev.4	Sat Mar  3 02:06:48 2018	(r330306)
+++ stable/11/share/man/man4/cxgbev.4	Sat Mar  3 02:30:52 2018	(r330307)
@@ -172,24 +172,15 @@ Tunables can be set at the
 prompt before booting the kernel or stored in
 .Xr loader.conf 5 .
 .Bl -tag -width indent
-.It Va hw.cxgbe.ntxq10g
-Number of tx queues used for a 10Gb or higher-speed port.
+.It Va hw.cxgbe.ntxq
+Number of tx queues used for a port.
 The default is 16 or the number
 of CPU cores in the system, whichever is less.
-.It Va hw.cxgbe.nrxq10g
-Number of rx queues used for a 10Gb or higher-speed port.
+.It Va hw.cxgbe.nrxq
+Number of rx queues used for a port.
 The default is 8 or the number
 of CPU cores in the system, whichever is less.
-.It Va hw.cxgbe.ntxq1g
-Number of tx queues used for a 1Gb port.
-The default is 4 or the number
-of CPU cores in the system, whichever is less.
-.It Va hw.cxgbe.nrxq1g
-Number of rx queues used for a 1Gb port.
-The default is 2 or the number
-of CPU cores in the system, whichever is less.
-.It Va hw.cxgbe.holdoff_timer_idx_10G
-.It Va hw.cxgbe.holdoff_timer_idx_1G
+.It Va hw.cxgbe.holdoff_timer_idx
 Timer index value used to delay interrupts.
 The holdoff timer list has the values 1, 5, 10, 50, 100, and 200
 by default (all values are in microseconds) and the index selects a
@@ -197,8 +188,7 @@ value from this list.
 The default value is 1 which means the timer value is 5us.
 Different interfaces can be assigned different values at any time via the
 dev.<port>.X.holdoff_tmr_idx sysctl.
-.It Va hw.cxgbe.holdoff_pktc_idx_10G
-.It Va hw.cxgbe.holdoff_pktc_idx_1G
+.It Va hw.cxgbe.holdoff_pktc_idx
 Packet-count index value used to delay interrupts.
 The packet-count list has the values 1, 8, 16, and 32 by default,
 and the index selects a value from this list.

Modified: stable/11/sys/conf/files
==============================================================================
--- stable/11/sys/conf/files	Sat Mar  3 02:06:48 2018	(r330306)
+++ stable/11/sys/conf/files	Sat Mar  3 02:30:52 2018	(r330307)
@@ -1331,6 +1331,18 @@ dev/cxgbe/common/t4_hw.c	optional cxgbe pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/common/t4vf_hw.c	optional cxgbev pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
+dev/cxgbe/cudbg/cudbg_common.c	optional cxgbe \
+	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
+dev/cxgbe/cudbg/cudbg_flash_utils.c	optional cxgbe \
+	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
+dev/cxgbe/cudbg/cudbg_lib.c	optional cxgbe \
+	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
+dev/cxgbe/cudbg/cudbg_wtp.c	optional cxgbe \
+	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
+dev/cxgbe/cudbg/fastlz.c	optional cxgbe \
+	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
+dev/cxgbe/cudbg/fastlz_api.c	optional cxgbe \
+	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 t4fw_cfg.c		optional cxgbe					\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk t4fw_cfg.fw:t4fw_cfg t4fw_cfg_uwire.fw:t4fw_cfg_uwire t4fw.fw:t4fw -mt4fw_cfg -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
@@ -1361,12 +1373,12 @@ t4fw.fwo		optional cxgbe					\
 	no-implicit-rule						\
 	clean		"t4fw.fwo"
 t4fw.fw			optional cxgbe					\
-	dependency	"$S/dev/cxgbe/firmware/t4fw-1.16.45.0.bin.uu"	\
+	dependency	"$S/dev/cxgbe/firmware/t4fw-1.16.63.0.bin.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"t4fw.fw"
 t5fw_cfg.c		optional cxgbe					\
-	compile-with	"${AWK} -f $S/tools/fw_stub.awk t5fw_cfg.fw:t5fw_cfg t5fw.fw:t5fw -mt5fw_cfg -c${.TARGET}" \
+	compile-with	"${AWK} -f $S/tools/fw_stub.awk t5fw_cfg.fw:t5fw_cfg t5fw_cfg_uwire.fw:t5fw_cfg_uwire t4fw.fw:t4fw -mt5fw_cfg -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"t5fw_cfg.c"
 t5fw_cfg.fwo		optional cxgbe					\
@@ -1379,18 +1391,28 @@ t5fw_cfg.fw		optional cxgbe					\
 	compile-with	"${CP} ${.ALLSRC} ${.TARGET}"			\
 	no-obj no-implicit-rule						\
 	clean		"t5fw_cfg.fw"
+t5fw_cfg_uwire.fwo	optional cxgbe					\
+	dependency	"t5fw_cfg_uwire.fw"				\
+	compile-with	"${NORMAL_FWO}"					\
+	no-implicit-rule						\
+	clean		"t5fw_cfg_uwire.fwo"
+t5fw_cfg_uwire.fw	optional cxgbe					\
+	dependency	"$S/dev/cxgbe/firmware/t5fw_cfg_uwire.txt"	\
+	compile-with	"${CP} ${.ALLSRC} ${.TARGET}"			\
+	no-obj no-implicit-rule						\
+	clean		"t5fw_cfg_uwire.fw"
 t5fw.fwo		optional cxgbe					\
 	dependency	"t5fw.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"t5fw.fwo"
 t5fw.fw			optional cxgbe					\
-	dependency	"$S/dev/cxgbe/firmware/t5fw-1.16.45.0.bin.uu"	\
+	dependency	"$S/dev/cxgbe/firmware/t5fw-1.16.63.0.bin.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"t5fw.fw"
 t6fw_cfg.c		optional cxgbe					\
-	compile-with	"${AWK} -f $S/tools/fw_stub.awk t6fw_cfg.fw:t6fw_cfg t6fw.fw:t6fw -mt6fw_cfg -c${.TARGET}" \
+	compile-with	"${AWK} -f $S/tools/fw_stub.awk t6fw_cfg.fw:t6fw_cfg t6fw_cfg_uwire.fw:t6fw_cfg_uwire t6fw.fw:t6fw -mt6fw_cfg -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"t6fw_cfg.c"
 t6fw_cfg.fwo		optional cxgbe					\
@@ -1403,13 +1425,23 @@ t6fw_cfg.fw		optional cxgbe					\
 	compile-with	"${CP} ${.ALLSRC} ${.TARGET}"			\
 	no-obj no-implicit-rule						\
 	clean		"t6fw_cfg.fw"
+t6fw_cfg_uwire.fwo	optional cxgbe					\
+	dependency	"t6fw_cfg_uwire.fw"				\
+	compile-with	"${NORMAL_FWO}"					\
+	no-implicit-rule						\
+	clean		"t6fw_cfg_uwire.fwo"
+t6fw_cfg_uwire.fw	optional cxgbe					\
+	dependency	"$S/dev/cxgbe/firmware/t6fw_cfg_uwire.txt"	\
+	compile-with	"${CP} ${.ALLSRC} ${.TARGET}"			\
+	no-obj no-implicit-rule						\
+	clean		"t6fw_cfg_uwire.fw"
 t6fw.fwo		optional cxgbe					\
 	dependency	"t6fw.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"t6fw.fwo"
 t6fw.fw			optional cxgbe					\
-	dependency	"$S/dev/cxgbe/firmware/t6fw-1.16.45.0.bin.uu"	\
+	dependency	"$S/dev/cxgbe/firmware/t6fw-1.16.63.0.bin.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"t6fw.fw"

Modified: stable/11/sys/dev/cxgbe/adapter.h
==============================================================================
--- stable/11/sys/dev/cxgbe/adapter.h	Sat Mar  3 02:06:48 2018	(r330306)
+++ stable/11/sys/dev/cxgbe/adapter.h	Sat Mar  3 02:30:52 2018	(r330307)
@@ -151,7 +151,7 @@ enum {
 	/* adapter flags */
 	FULL_INIT_DONE	= (1 << 0),
 	FW_OK		= (1 << 1),
-	/* INTR_DIRECT	= (1 << 2),	No longer used. */
+	CHK_MBOX_ACCESS	= (1 << 2),
 	MASTER_PF	= (1 << 3),
 	ADAP_SYSCTL_CTX	= (1 << 4),
 	/* TOM_INIT_DONE= (1 << 5),	No longer used */
@@ -167,12 +167,11 @@ enum {
 	DOOMED		= (1 << 0),
 	VI_INIT_DONE	= (1 << 1),
 	VI_SYSCTL_CTX	= (1 << 2),
-	INTR_RXQ	= (1 << 4),	/* All NIC rxq's take interrupts */
-	INTR_OFLD_RXQ	= (1 << 5),	/* All TOE rxq's take interrupts */
-	INTR_ALL	= (INTR_RXQ | INTR_OFLD_RXQ),
 
 	/* adapter debug_flags */
-	DF_DUMP_MBOX	= (1 << 0),
+	DF_DUMP_MBOX		= (1 << 0),	/* Log all mbox cmd/rpl. */
+	DF_LOAD_FW_ANYTIME	= (1 << 1),	/* Allow LOAD_FW after init */
+	DF_DISABLE_TCB_CACHE	= (1 << 2),	/* Disable TCB cache (T6+) */
 };
 
 #define IS_DOOMED(vi)	((vi)->flags & DOOMED)
@@ -186,7 +185,6 @@ struct vi_info {
 	struct port_info *pi;
 
 	struct ifnet *ifp;
-	struct ifmedia media;
 
 	unsigned long flags;
 	int if_flags;
@@ -218,7 +216,9 @@ struct vi_info {
 	int nnmrxq;
 	int first_nm_rxq;
 	int tmr_idx;
+	int ofld_tmr_idx;
 	int pktc_idx;
+	int ofld_pktc_idx;
 	int qsize_rxq;
 	int qsize_txq;
 
@@ -284,9 +284,12 @@ struct port_info {
 	uint8_t  mod_type;
 	uint8_t  port_id;
 	uint8_t  tx_chan;
-	uint8_t  rx_chan_map;	/* rx MPS channel bitmap */
+	uint8_t  mps_bg_map;	/* rx MPS buffer group bitmap */
+	uint8_t  rx_e_chan_map;	/* rx TP e-channel bitmap */
 
 	struct link_config link_cfg;
+	struct link_config old_link_cfg;
+	struct ifmedia media;
 
 	struct timeval last_refreshed;
  	struct port_stats stats;
@@ -341,7 +344,7 @@ enum {
 	/* iq flags */
 	IQ_ALLOCATED	= (1 << 0),	/* firmware resources allocated */
 	IQ_HAS_FL	= (1 << 1),	/* iq associated with a freelist */
-	IQ_INTR		= (1 << 2),	/* iq takes direct interrupt */
+					/* 1 << 2 Used to be IQ_INTR */
 	IQ_LRO_ENABLED	= (1 << 3),	/* iq is an eth rxq with LRO enabled */
 	IQ_ADJ_CREDIT	= (1 << 4),	/* hw is off by 1 credit for this iq */
 
@@ -790,7 +793,7 @@ struct adapter {
 
 	struct taskqueue *tq[MAX_NCHAN];	/* General purpose taskqueues */
 	struct port_info *port[MAX_NPORTS];
-	uint8_t chan_map[MAX_NCHAN];
+	uint8_t chan_map[MAX_NCHAN];		/* channel -> port */
 
 	void *tom_softc;	/* (struct tom_data *) */
 	struct tom_tunables tt;
@@ -945,6 +948,13 @@ struct adapter {
 /* One for firmware events */
 #define T4VF_EXTRA_INTR 1
 
+static inline int
+forwarding_intr_to_fwq(struct adapter *sc)
+{
+
+	return (sc->intr_count == 1);
+}
+
 static inline uint32_t
 t4_read_reg(struct adapter *sc, uint32_t reg)
 {
@@ -1034,10 +1044,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
@@ -1087,24 +1097,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)
 {
 
@@ -1124,15 +1116,11 @@ t4_use_ldst(struct adapter *sc)
 }
 
 /* t4_main.c */
-extern int t4_ntxq10g;
-extern int t4_nrxq10g;
-extern int t4_ntxq1g;
-extern int t4_nrxq1g;
+extern int t4_ntxq;
+extern int t4_nrxq;
 extern int t4_intr_types;
-extern int t4_tmr_idx_10g;
-extern int t4_pktc_idx_10g;
-extern int t4_tmr_idx_1g;
-extern int t4_pktc_idx_1g;
+extern int t4_tmr_idx;
+extern int t4_pktc_idx;
 extern unsigned int t4_qsize_rxq;
 extern unsigned int t4_qsize_txq;
 extern device_method_t cxgbe_methods[];
@@ -1140,8 +1128,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/11/sys/dev/cxgbe/common/common.h
==============================================================================
--- stable/11/sys/dev/cxgbe/common/common.h	Sat Mar  3 02:06:48 2018	(r330306)
+++ stable/11/sys/dev/cxgbe/common/common.h	Sat Mar  3 02:30:52 2018	(r330307)
@@ -42,6 +42,7 @@ enum {
 	EC_LEN         = 16,    /* E/C length */
 	ID_LEN         = 16,    /* ID length */
 	PN_LEN         = 16,    /* Part Number length */
+	MD_LEN         = 16,    /* MFG diags version length */
 	MACADDR_LEN    = 12,    /* MAC Address length */
 };
 
@@ -254,6 +255,7 @@ struct vpd_params {
 	u8 id[ID_LEN + 1];
 	u8 pn[PN_LEN + 1];
 	u8 na[MACADDR_LEN + 1];
+	u8 md[MD_LEN + 1];
 };
 
 struct pci_params {
@@ -332,6 +334,7 @@ struct adapter_params {
 	struct devlog_params devlog;	/* PF-only */
 	struct rss_params rss;		/* VF-only */
 	struct vf_resources vfres;	/* VF-only */
+	unsigned int core_vdd;
 
 	unsigned int sf_size;             /* serial flash size in bytes */
 	unsigned int sf_nsec;             /* # of flash sectors */
@@ -369,6 +372,8 @@ struct adapter_params {
 
 	unsigned int max_ordird_qp;
 	unsigned int max_ird_adapter;
+
+	uint32_t mps_bg_map;	/* rx buffer group map for all ports (upto 4) */
 };
 
 #define CHELSIO_T4		0x4
@@ -399,16 +404,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 */
+
 	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 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 */
 };
@@ -499,6 +506,12 @@ static inline unsigned int dack_ticks_to_usec(const st
 	return (ticks << adap->params.tp.dack_re) / core_ticks_per_usec(adap);
 }
 
+static inline u_int us_to_tcp_ticks(const struct adapter *adap, u_long us)
+{
+
+	return (us * adap->params.vpd.cclk / 1000 >> adap->params.tp.tre);
+}
+
 void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, u32 val);
 
 int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
@@ -572,11 +585,11 @@ int t4_get_vpd_version(struct adapter *adapter, u32 *v
 int t4_get_version_info(struct adapter *adapter);
 int t4_init_hw(struct adapter *adapter, u32 fw_params);
 const struct chip_params *t4_get_chip_params(int chipid);
-int t4_prep_adapter(struct adapter *adapter, u8 *buf);
+int t4_prep_adapter(struct adapter *adapter, u32 *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 +607,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 +667,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 +695,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);
@@ -691,6 +711,8 @@ int t4_fw_halt(struct adapter *adap, unsigned int mbox
 int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset);
 int t4_fw_upgrade(struct adapter *adap, unsigned int mbox,
 		  const u8 *fw_data, unsigned int size, int force);
+int t4_fw_forceinstall(struct adapter *adap, const u8 *fw_data,
+    unsigned int size);
 int t4_fw_initialize(struct adapter *adap, unsigned int mbox);
 int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
 		    unsigned int vf, unsigned int nparams, const u32 *params,
@@ -766,6 +788,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 +810,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/11/sys/dev/cxgbe/common/t4_hw.c
==============================================================================
--- stable/11/sys/dev/cxgbe/common/t4_hw.c	Sat Mar  3 02:06:48 2018	(r330306)
+++ stable/11/sys/dev/cxgbe/common/t4_hw.c	Sat Mar  3 02:30:52 2018	(r330307)
@@ -286,6 +286,9 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int 
 	__be64 cmd_rpl[MBOX_LEN/8];
 	u32 pcie_fw;
 
+	if (adap->flags & CHK_MBOX_ACCESS)
+		ASSERT_SYNCHRONIZED_OP(adap);
+
 	if ((size & 15) || size > MBOX_LEN)
 		return -EINVAL;
 
@@ -333,9 +336,9 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int 
 	 * presaged the firmware crashing ...
 	 */
 	if (ctl & F_MBMSGVALID) {
-		CH_ERR(adap, "found VALID command in mbox %u: "
-		       "%llx %llx %llx %llx %llx %llx %llx %llx\n", mbox,
-		       (unsigned long long)t4_read_reg64(adap, data_reg),
+		CH_ERR(adap, "found VALID command in mbox %u: %016llx %016llx "
+		       "%016llx %016llx %016llx %016llx %016llx %016llx\n",
+		       mbox, (unsigned long long)t4_read_reg64(adap, data_reg),
 		       (unsigned long long)t4_read_reg64(adap, data_reg + 8),
 		       (unsigned long long)t4_read_reg64(adap, data_reg + 16),
 		       (unsigned long long)t4_read_reg64(adap, data_reg + 24),
@@ -469,7 +472,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;
 	}
@@ -886,7 +889,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,
@@ -1424,8 +1428,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,
@@ -1536,8 +1538,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,
@@ -1648,8 +1648,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,
@@ -1760,8 +1758,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,
@@ -2254,13 +2250,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,
@@ -2323,13 +2312,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,
@@ -2394,13 +2382,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,
@@ -2463,13 +2444,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,
@@ -2682,13 +2662,16 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t
 }
 
 /*
- * Partial EEPROM Vital Product Data structure.  Includes only the ID and
- * VPD-R sections.
+ * Partial EEPROM Vital Product Data structure.  The VPD starts with one ID
+ * header followed by one or more VPD-R sections, each with its own header.
  */
 struct t4_vpd_hdr {
 	u8  id_tag;
 	u8  id_len[2];
 	u8  id_data[ID_LEN];
+};
+
+struct t4_vpdr_hdr {
 	u8  vpdr_tag;
 	u8  vpdr_len[2];
 };
@@ -2700,6 +2683,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
@@ -2922,32 +2906,43 @@ int t4_seeprom_wp(struct adapter *adapter, int enable)
 
 /**
  *	get_vpd_keyword_val - Locates an information field keyword in the VPD
- *	@v: Pointer to buffered vpd data structure
+ *	@vpd: Pointer to buffered vpd data structure
  *	@kw: The keyword to search for
+ *	@region: VPD region to search (starting from 0)
  *
  *	Returns the value of the information field keyword or
  *	-ENOENT otherwise.
  */
-static int get_vpd_keyword_val(const struct t4_vpd_hdr *v, const char *kw)
+static int get_vpd_keyword_val(const u8 *vpd, const char *kw, int region)
 {
-	int i;
-	unsigned int offset , len;
-	const u8 *buf = (const u8 *)v;
-	const u8 *vpdr_len = &v->vpdr_len[0];
+	int i, tag;
+	unsigned int offset, len;
+	const struct t4_vpdr_hdr *vpdr;
+
 	offset = sizeof(struct t4_vpd_hdr);
-	len =  (u16)vpdr_len[0] + ((u16)vpdr_len[1] << 8);
+	vpdr = (const void *)(vpd + offset);
+	tag = vpdr->vpdr_tag;
+	len = (u16)vpdr->vpdr_len[0] + ((u16)vpdr->vpdr_len[1] << 8);
+	while (region--) {
+		offset += sizeof(struct t4_vpdr_hdr) + len;
+		vpdr = (const void *)(vpd + offset);
+		if (++tag != vpdr->vpdr_tag)
+			return -ENOENT;
+		len = (u16)vpdr->vpdr_len[0] + ((u16)vpdr->vpdr_len[1] << 8);
+	}
+	offset += sizeof(struct t4_vpdr_hdr);
 
-	if (len + sizeof(struct t4_vpd_hdr) > VPD_LEN) {
+	if (offset + len > VPD_LEN) {
 		return -ENOENT;
 	}
 
 	for (i = offset; i + VPD_INFO_FLD_HDR_SIZE <= offset + len;) {
-		if(memcmp(buf + i , kw , 2) == 0){
+		if (memcmp(vpd + i , kw , 2) == 0){
 			i += VPD_INFO_FLD_HDR_SIZE;
 			return i;
 		}
 
-		i += VPD_INFO_FLD_HDR_SIZE + buf[i+2];
+		i += VPD_INFO_FLD_HDR_SIZE + vpd[i+2];
 	}
 
 	return -ENOENT;
@@ -2963,18 +2958,18 @@ static int get_vpd_keyword_val(const struct t4_vpd_hdr
  *	Reads card parameters stored in VPD EEPROM.
  */
 static int get_vpd_params(struct adapter *adapter, struct vpd_params *p,
-    u8 *vpd)
+    u32 *buf)
 {
 	int i, ret, addr;
-	int ec, sn, pn, na;
+	int ec, sn, pn, na, md;
 	u8 csum;
-	const struct t4_vpd_hdr *v;
+	const u8 *vpd = (const u8 *)buf;
 
 	/*
 	 * Card information normally starts at VPD_BASE but early cards had
 	 * it at 0.
 	 */
-	ret = t4_seeprom_read(adapter, VPD_BASE, (u32 *)(vpd));
+	ret = t4_seeprom_read(adapter, VPD_BASE, buf);
 	if (ret)
 		return (ret);
 
@@ -2988,14 +2983,13 @@ static int get_vpd_params(struct adapter *adapter, str
 	addr = *vpd == CHELSIO_VPD_UNIQUE_ID ? VPD_BASE : VPD_BASE_OLD;
 
 	for (i = 0; i < VPD_LEN; i += 4) {
-		ret = t4_seeprom_read(adapter, addr + i, (u32 *)(vpd + i));
+		ret = t4_seeprom_read(adapter, addr + i, buf++);
 		if (ret)
 			return ret;
 	}
- 	v = (const struct t4_vpd_hdr *)vpd;
 
 #define FIND_VPD_KW(var,name) do { \
-	var = get_vpd_keyword_val(v , name); \
+	var = get_vpd_keyword_val(vpd, name, 0); \
 	if (var < 0) { \
 		CH_ERR(adapter, "missing VPD keyword " name "\n"); \
 		return -EINVAL; \
@@ -3018,7 +3012,7 @@ static int get_vpd_params(struct adapter *adapter, str
 	FIND_VPD_KW(na, "NA");
 #undef FIND_VPD_KW
 
-	memcpy(p->id, v->id_data, ID_LEN);
+	memcpy(p->id, vpd + offsetof(struct t4_vpd_hdr, id_data), ID_LEN);
 	strstrip(p->id);
 	memcpy(p->ec, vpd + ec, EC_LEN);
 	strstrip(p->ec);
@@ -3032,6 +3026,14 @@ static int get_vpd_params(struct adapter *adapter, str
 	memcpy(p->na, vpd + na, min(i, MACADDR_LEN));
 	strstrip((char *)p->na);
 
+	md = get_vpd_keyword_val(vpd, "VF", 1);
+	if (md < 0) {
+		snprintf(p->md, sizeof(p->md), "unknown");
+	} else {
+		i = vpd[md - VPD_INFO_FLD_HDR_SIZE + 2];
+		memcpy(p->md, vpd + md, min(i, MD_LEN));
+	}
+
 	return 0;
 }
 
@@ -3040,13 +3042,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 */
 };
 
 /**
@@ -3683,9 +3685,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
@@ -3704,7 +3703,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)
@@ -3714,12 +3713,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;
+	else if (lc->requested_fec & FEC_RESERVED)
+		fec = FW_PORT_CAP_FEC_RESERVED;
 
+	if (!(lc->supported & FW_PORT_CAP_ANEG) ||
+	    lc->requested_aneg == AUTONEG_DISABLE) {
+		aneg = 0;
+		switch (lc->requested_speed) {
+		case 100:
+			speed = FW_PORT_CAP_SPEED_100G;
+			break;
+		case 40:
+			speed = FW_PORT_CAP_SPEED_40G;
+			break;
+		case 25:
+			speed = FW_PORT_CAP_SPEED_25G;
+			break;
+		case 10:
+			speed = FW_PORT_CAP_SPEED_10G;
+			break;
+		case 1:
+			speed = FW_PORT_CAP_SPEED_1G;
+			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;
+	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;
+	}
+	rcap |= mdi;
+
 	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 |
@@ -3727,21 +3765,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);
 }
 
 /**
@@ -3980,6 +4006,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 }
 	};
 
@@ -3995,8 +4024,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 */

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


More information about the svn-src-all mailing list