]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC: r346714: Add accessor function for vm->maxcpus
rgrimes [Sat, 25 May 2019 11:27:56 +0000 (11:27 +0000)]
MFC: r346714: Add accessor function for vm->maxcpus

Replace most VM_MAXCPU constant useses with an accessor function to
vm->maxcpus which for now is initialized and kept at the value of
VM_MAXCPUS.

This is a rework of Fabian Freyer (fabian.freyer_physik.tu-berlin.de)
work from D10070 to adjust it for the cpu topology changes that
occured in r332298

Approved by: re (kib)

4 years agoMFC: r346717: Make bhyve SMBIOS table topology aware
rgrimes [Sat, 25 May 2019 10:17:03 +0000 (10:17 +0000)]
MFC: r346717: Make bhyve SMBIOS table topology aware

When the CPU Topology was added to bhyve in r332298 the SMBIOS table was
missed, this table passes topology information to the system and was still
using the old concept of each vCPU is a socket with 1 core and 1 thread.
This code did not even try to use the old sysctl information to adjust
this data.

Correct that by building a proper SMBios table, mapping the > 254 cases to
0 per the SMBios 2.6 specification that is claimed by the structure.

Approved by: re (kib)

4 years agoMFC r347244:
delphij [Sat, 25 May 2019 01:58:00 +0000 (01:58 +0000)]
MFC r347244:

Move contrib/zlib to sys/contrib/zlib so that we can use it in kernel.
This is a prerequisite of unifying kernel zlib instances.

Submitted by: Yoshihiro Ota <ota at j.email.ne.jp>
Approved by: re (kib)

4 years agoMFC of 348074
mckusick [Sat, 25 May 2019 00:22:07 +0000 (00:22 +0000)]
MFC of 348074

Rewrite fsck_readdir() and dircheck() for clarity and correctness.

Approved by: re (gjb)

4 years agoUpdate stable/11 to BETA1 as part of the 11.3-RELEASE cycle.
gjb [Fri, 24 May 2019 00:00:29 +0000 (00:00 +0000)]
Update stable/11 to BETA1 as part of the 11.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

4 years agoMFC: r332298,333712,334199,334216,334219 bhyve cpu topology
rgrimes [Thu, 23 May 2019 21:23:18 +0000 (21:23 +0000)]
MFC: r332298,333712,334199,334216,334219 bhyve cpu topology

Approved by: re (gjb), bde/phk (mentor, implicit)

4 years agoMFC: r347960: bhyve virtio needs barriers
rgrimes [Thu, 23 May 2019 18:58:06 +0000 (18:58 +0000)]
MFC: r347960: bhyve virtio needs barriers

Under certain tight race conditions, we found that the lack of a memory
barrier in bhyve's virtio handling causes it to miss a NO_NOTIFY state
transition on block devices, resulting in guest stall. The investigation
is recorded in OS-7613. As part of the examination into bhyve's use of
barriers, one other section was found to be problematic, but only on
non-x86 ISAs with less strict memory ordering. That was addressed in
this patch as well, although it was not at all a problem on x86.

PR: 231117
Submitted by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: jhb, kib, rgrimes
Approved by: re (gjb), jhb
Differential Revision: https://reviews.freebsd.org/D19501

4 years agoMFC r347975:
tuexen [Thu, 23 May 2019 16:05:47 +0000 (16:05 +0000)]
MFC r347975:

Improve input validation for the IPPROTO_SCTP level socket options
SCTP_CONNECT_X and SCTP_CONNECT_X_DELAYED.

MFC r347976:
Allow sending on demand SCTP HEARTBEATS only in the ESTABLISHED state.
This issue was found by running syzkaller.

Approved by: re (gjb@)

4 years agoMFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none
kevans [Wed, 22 May 2019 23:34:41 +0000 (23:34 +0000)]
MFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none

These datasets will generally be canmount=noauto,mountpoint=none (e.g.
zroot/var) but have children that may need to be mounted. Instead of
skipping that segment for no good reason, descend.

Approved by: re (kib)

4 years agoMFC r347578: tun/tap: Defer clearing if_softc until after if_detach
kevans [Wed, 22 May 2019 22:56:05 +0000 (22:56 +0000)]
MFC r347578: tun/tap: Defer clearing if_softc until after if_detach

(Commit massaged to match stable structure; tun and tap have been merged in
head)

r346670 added an sx to close a race between the ifioctl handler and
interface destruction. Unfortunately, it clears if_softc immediately after
the interface is closed, but before if_detach has been invoked.

Any time before detachment, an interface that's part of a bridge may still
receive traffic that's pushed through tunstart/tunstart_l2 and promptly
lead to a panic because if_softc is now NULL.

Fix it by deferring the clearing of if_softc until after the interface has
detached and thus been removed from the bridge. if_softc still gets cleared
in case another thread has already entered the ioctl handler before it's
replaced with ifdead_ioctl.

Approved by: re (kib)

4 years agoMFC r347978:
dim [Wed, 22 May 2019 19:39:55 +0000 (19:39 +0000)]
MFC r347978:

Fix OptionalObsoleteFiles copy/paste mistake from r345236, which
connected libomp to the build.  The comparison should not have been
against ${MK_OPENSSH}, but against ${MK_OPENMP}, obviously.

MFC r347979:

To avoid unnecessarily modifying ports, add a -lgomp symlink, since GCC
does not ship a -lomp symlink.  Also update OptionalObsoleteFiles for
this, and add 32-bit variants while here.

Approved by: re (gjb)
Submitted by: jbeich
PR: 237975

5 years agoMFC r329348 (by brooks):
kib [Mon, 20 May 2019 16:31:45 +0000 (16:31 +0000)]
MFC r329348 (by brooks):
Get rid of the requirement to include SysV IPC headers with _KERNEL
defined in ipcrm by introducing _WANT_SYSVxxx_INTERNALS defines.

MFC r329390 (by lwhsu):
Follow r329348 in ipcs for getting rid of the requirement to include SysV IPC
headers with _KERNEL.

Sponsored by: Mellanox Technologies
Approved by: re (gjb)

5 years agoMFC r347488,347606: Update leap-seconds to leap-seconds.3676924800.
delphij [Sun, 19 May 2019 18:31:21 +0000 (18:31 +0000)]
MFC r347488,347606: Update leap-seconds to leap-seconds.3676924800.

Approved by:    re (kib)

5 years agoMFC r339703, r347365, r347703, r347940
brooks [Sat, 18 May 2019 20:43:13 +0000 (20:43 +0000)]
MFC r339703, r347365, r347703, r347940

r339703:
Deprecate a number of less used 10 and 10/100 Ethernet devices.

The current deprecated list is: ae, bm, cs, de, dme, ed, ep, ex, fe,
pcn, sf, sn, tl, tx, txp, vx, wb, xe

The list as refined as part of FCP-0101. Per the FCP, devices may be
removed from the deprecation list if enough users are found or they are
converted to iflib.

FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md

r347365:
Update dme(4) to reflect that it will not be removed due to FCP-101.

dme(4) is the built-in NIC on a couple non-expandable mips platforms and
thus should remain.  The FCP has been updated to reflect this fact.

Discussed with: imp

r347703:
FCP-101: ae(4) is sufficently popular to be moved to the keep list.

r347940:
Remove the notice that ae(4) will be removed in FreeBSD 13.

MFC requested by: rgrimes
Approved by: re (kib)

5 years agoMFC r347625:
kib [Fri, 17 May 2019 22:14:30 +0000 (22:14 +0000)]
MFC r347625:
Properly announce MD_CLEAR.

Approved by: re (gjb)

5 years agoMFC r337716:
markj [Fri, 17 May 2019 18:10:11 +0000 (18:10 +0000)]
MFC r337716:
Add microcode update configuration to the default loader.conf.

Approved by: re (kib)

5 years agoMFC r345008:
ken [Thu, 16 May 2019 22:03:25 +0000 (22:03 +0000)]
MFC r345008:
  ------------------------------------------------------------------------
  r345008 | ken | 2019-03-11 10:21:14 -0400 (Mon, 11 Mar 2019) | 59 lines

  Fix CRN resets in the isp(4) driver in certain situations.

  The Command Reference Number (CRN) is part of the FC-Tape features
  that we enable when talking to tape drives.  It starts at 1, and
  goes to 255 and wraps around to 1.  There are a number of reset
  type conditions that result in the CRN getting reset to 1.  These
  are detailed in section 4.10 (table 8) of the FCP-4r02b specification.

  One of the conditions is when a PRLI (Process Login) is sent by
  the initiator, and the Establish Image Pair bit is set in Word 0
  of the PRLI.

  Previously, the isp(4) driver core sent a notification via
  isp_async() that the target had changed or stayed in place, but
  there was no indication of whether a PRLI was sent and whether the
  Establish Image Pair bit was set.

  The result of this was that in some situations, notably
  switching back and forth between a direct connection and a switch
  connection to a tape drive, the isp(4) driver would fail to reset
  the CRN in situations that require it according to the spec.  When
  the CRN isn't reset in a situation that requires it, the tape drive
  then rejects every subsequent command that is sent to the drive.
  It is assuming that the commands are being sent out of order.

  So, modify the isp(4) driver to include Word 0 of the PRLI command
  when it sends isp_async() notifications of target changes.  Look at
  the Establish Image Pair bit, and reset the CRN if that bit is set.

  With this change, I am able to switch a tape drive back and forth
  between a direct connection and a switch connection, and the isp(4)
  driver resets the CRN when it should.

  sys/dev/isp_stds.h:
   Add bit definitions for PRLI Word 0.

  sys/dev/ispmbox.h:
   Add PRLI Word 0 to the port database type, isp_pdb_t.

  sys/dev/ispvar.h
   Add PRLI Word 0 to fcportdb_t.

  sys/dev/isp.c:
   Populate the new prli_word0 parameter in the port database.

   In isp_pdb_add_update(), add a check to see if the
   Establish Image Pair bit is set in PRLI Word 0.  If it is,
   then that is an additional reason to create a change
   notification.

  sys/dev/isp_freebsd.c:
   In isp_async(), if the device changed or stayed, look at
   PRLI Word 0 to see if the Establish Image Pair bit is set.
   If it is, reset the CRN if we haven't already.

  Sponsored by: Spectra Logic
  Differential Revision: https://reviews.freebsd.org/D19472

  ------------------------------------------------------------------------

5 years agoMFC 344761:
ken [Thu, 16 May 2019 18:42:27 +0000 (18:42 +0000)]
MFC 344761:
  ------------------------------------------------------------------------
  r344761 | ken | 2019-03-04 09:30:37 -0500 (Mon, 04 Mar 2019) | 18 lines

  Add IBM TS1160 density codes to libmt and the mt(1) man page.

  These are taken directly from the density report from a TS1160
  tape drive.  (Using mt getdensity)

  A TS1160 drive stores 20TB raw (60TB with compression) on a JE tape.

  lib/libmt/mtlib.c:
   Add 3592A6 encrypted/unencrypted density codes, and bpmm/bpi
   values.

  usr.bin/mt/mt.1:
   Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi
   values and number of tracks.  Bump the man page date.

  Sponsored by: Spectra Logic

  ------------------------------------------------------------------------

5 years agoMFC r347325:
hselasky [Thu, 16 May 2019 18:33:30 +0000 (18:33 +0000)]
MFC r347325:
Bump the Mellanox driver version numbers and the FreeBSD version number.

Sponsored by: Mellanox Technologies

5 years agoMFC r347381:
tuexen [Thu, 16 May 2019 18:29:25 +0000 (18:29 +0000)]
MFC r347381:

Prevent cwnd to collapse down to 1 MSS after exiting recovery.

This is descrined in RFC 6582, which updates RFC 3782.

5 years agoMFC r347324:
hselasky [Thu, 16 May 2019 18:28:59 +0000 (18:28 +0000)]
MFC r347324:
Make command workqueue persistant in mlx5core.

There is no reason to re-create the command workqueue during healthcare.
This also fixes an issue where a previous work struct may refer to a
destroyed workqueue.

Sponsored by: Mellanox Technologies

5 years agoMFC r347323:
hselasky [Thu, 16 May 2019 18:28:12 +0000 (18:28 +0000)]
MFC r347323:
Fix race between driver unload and dumping firmware in mlx5core.

Present code uses lock-less accesses to the dump data to prevent top
level ioctls from blocking bottom-level call to dump.  Unfortunately, this
depends on the type stability of the dump data structure, which makes it
non-functional during driver teardown.

Switch to the mutex locking scheme where top levels use the mutex in the
bound regions, while copyouts and drain for completion utilize condvars.
The mutex lifetime is guaranteed to be strictly larger than the time
interval where driver can initiate dump, and most of the control fields
of the old struct mlx5_dump_data are directly embedded into struct
mlx5_core_dev.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347322:
hselasky [Thu, 16 May 2019 18:27:27 +0000 (18:27 +0000)]
MFC r347322:
Ensure the flowtable rules are not freed twice in mlx5en(4).
This can happen when re-loading the driver.

Sponsored by: Mellanox Technologies

5 years agoMFC r347233:
tuexen [Thu, 16 May 2019 18:26:42 +0000 (18:26 +0000)]
MFC r347233:

Remove non-functional SCTP checksum offload support for virtio.

Checksum offloading for SCTP is not currently specified for virtio.
If the hypervisor announces checksum offloading support, it means TCP
and UDP checksum offload. If an SCTP packet is sent and the host announced
checksum offload support, the hypervisor inserts the IP checksum (16-bit)
at the correct offset, but this is not the right checksum, which is a CRC32c.
This results in all outgoing packets having the wrong checksum and therefore
breaking SCTP based communications.

This patch removes SCTP checksum offloading support from the virtio
network interface.

Thanks to Felix Weinrank for making me aware of the issue.

5 years agoMFC r347321:
hselasky [Thu, 16 May 2019 18:26:14 +0000 (18:26 +0000)]
MFC r347321:
Undo previous steps upon returning failure in mlx5en(4).

Else flowtable resources may not be properly freed.

Sponsored by: Mellanox Technologies

5 years agoMFC r347320:
hselasky [Thu, 16 May 2019 18:25:26 +0000 (18:25 +0000)]
MFC r347320:
Make sure the flow destination structure does not use values off the stack
in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r347319:
hselasky [Thu, 16 May 2019 18:24:51 +0000 (18:24 +0000)]
MFC r347319:
Flush command workqueue when command completion is triggered in mlx5core.

Avoid race for command completion when triggering a command completions event.
Serialize operation by queueing all commands on the same work queue.
This can happen when healthcare triggers.

Sponsored by: Mellanox Technologies

5 years agoMFC r347318:
hselasky [Thu, 16 May 2019 18:24:05 +0000 (18:24 +0000)]
MFC r347318:
Make command timeout way shorter in mlx5core.

The command timeout is terribly long, whole two hours. Make it 60s so if
things do go wrong, the user gets feedback in relatively short time, so
they can take corrective actions and/or investigate using tools and such.

Linux commit:
6b6c07bdcdc97ccac2596063bfc32a5faddfe884

Sponsored by: Mellanox Technologies

5 years agoMFC r347317:
hselasky [Thu, 16 May 2019 18:23:28 +0000 (18:23 +0000)]
MFC r347317:
Remove non-functional MLX5E_MAX_RX_SEGS macro in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r347316:
hselasky [Thu, 16 May 2019 18:22:46 +0000 (18:22 +0000)]
MFC r347316:
Fix for compilation warning in mlx5en(4).

Function 'mlx5e_alloc_rx_wqe' can never be inlined because it uses alloca
(override using the always_inline attribute)

Sponsored by: Mellanox Technologies

5 years agoMFC r347315:
hselasky [Thu, 16 May 2019 18:22:02 +0000 (18:22 +0000)]
MFC r347315:
Rename functions from mlx5_fwdump to mlx5_ctl in mlx5core.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347314:
hselasky [Thu, 16 May 2019 18:20:47 +0000 (18:20 +0000)]
MFC r347314:
Ensure that only one command is specified at a time in mlx5tool(8).

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347313:
hselasky [Thu, 16 May 2019 18:20:14 +0000 (18:20 +0000)]
MFC r347313:
Implement firmware reset from userspace in mlx5tool(8).

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347312:
hselasky [Thu, 16 May 2019 18:19:08 +0000 (18:19 +0000)]
MFC r347312:
Add Firmware Reset Level, MFRL, register accessors in mlx5core.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347311:
hselasky [Thu, 16 May 2019 18:18:22 +0000 (18:18 +0000)]
MFC r347311:
Add ConnectX-6 DX HCA ID to libmlx5.

In addition, add "ConnectX family mlx5Gen Virtual Function" device ID.
Every new HCA VF will be identified with this device ID.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347310:
hselasky [Thu, 16 May 2019 18:17:38 +0000 (18:17 +0000)]
MFC r347310:
Expose per-lane counters before correction mechanism in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r347309:
hselasky [Thu, 16 May 2019 18:16:57 +0000 (18:16 +0000)]
MFC r347309:
Add support for extended PCIe counters in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r347308:
hselasky [Thu, 16 May 2019 18:16:08 +0000 (18:16 +0000)]
MFC r347308:
Extend the counters framework in mlx5en(4).

Allow more macro arguments and split the variable type and name into
separate arguments. This allows simple and powerful copy and extraction
of values from IFC based structures into SYSCTLs with the use of a single
macro.

Sponsored by: Mellanox Technologies

5 years agoMFC r347307:
hselasky [Thu, 16 May 2019 18:13:47 +0000 (18:13 +0000)]
MFC r347307:
Update performance counter bits in mlx5core.

Sponsored by: Mellanox Technologies

5 years agoMFC r347306:
hselasky [Thu, 16 May 2019 18:13:02 +0000 (18:13 +0000)]
MFC r347306:
Implement reading PCI power status in mlx5core.

Implement a watchdog as part of the healtcare subsystem which
reads the PCI power status during startup and upon the PCI
power status change event and store it into the core device
structure. This value is then exported to user-space via a
read-only SYSCTL. A dmesg print has been added to inform
the admin about the PCI power status.

Sponsored by: Mellanox Technologies

5 years agoMFC r347305:
hselasky [Thu, 16 May 2019 18:12:14 +0000 (18:12 +0000)]
MFC r347305:
Move workqueue from mlx5en(4) to mlx5core.

This avoids creating more workqueues in mlx5core to do
simple firmware command polling tasks.

Sponsored by: Mellanox Technologies

5 years agoMFC r347304:
hselasky [Thu, 16 May 2019 18:11:25 +0000 (18:11 +0000)]
MFC r347304:
Always return success for RoCE modify port in mlx5ib.

CM layer calls ib_modify_port() regardless of the link layer.

For the Ethernet ports, qkey violation and Port capabilities
are meaningless. Therefore, always return success for ib_modify_port
calls on the Ethernet ports.

Linux Commit:
ec2558796d25e6024071b6bcb8e11392538d57bf

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347303:
hselasky [Thu, 16 May 2019 18:10:10 +0000 (18:10 +0000)]
MFC r347303:
Add support for new rates to mlx5ib.

Submitted by: slavash@
Sponsored by:   Mellanox Technologies

5 years agoMFC r347302:
hselasky [Thu, 16 May 2019 18:09:34 +0000 (18:09 +0000)]
MFC r347302:
Add support for 200Gbit speeds to libibverbs.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347301:
hselasky [Thu, 16 May 2019 18:08:33 +0000 (18:08 +0000)]
MFC r347301:
Add new rates to ibcore.

Add the new rates that were added to the Infiniband specification as part of
HDR and 2x support.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347300:
hselasky [Thu, 16 May 2019 18:07:52 +0000 (18:07 +0000)]
MFC r347300:
Do not add IFM_10G_LR and IFM_40G_ER4 to supported media types by default in
mlx5en(4).

IFM_10G_LR and IFM_40G_ER4 media should be added only if the device
has the needed capability bit set for it.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347299:
hselasky [Thu, 16 May 2019 18:06:56 +0000 (18:06 +0000)]
MFC r347299:
Add support for 200Gb ethernet speeds to mlx5core.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347298:
hselasky [Thu, 16 May 2019 18:06:10 +0000 (18:06 +0000)]
MFC r347298:
Remove unused speed enums in mlx5core.

Submitted by: slavash@
Sponsored by:   Mellanox Technologies

5 years agoMFC r347297:
hselasky [Thu, 16 May 2019 18:05:16 +0000 (18:05 +0000)]
MFC r347297:
Control automatic update of firmware on driver load with a tunable in mlx5core.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347295:
hselasky [Thu, 16 May 2019 18:02:09 +0000 (18:02 +0000)]
MFC r347295:
Let rx_out_of_buffer be a 32-bit counter in mlx5en(4).

This fixes counting issues when the firmware resets the counter during
allocation of the counter set where the counter belongs.

Sponsored by: Mellanox Technologies

5 years agoMFC r347294:
hselasky [Thu, 16 May 2019 18:01:23 +0000 (18:01 +0000)]
MFC r347294:
Add vnic steering drop statistics in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r347293:
hselasky [Thu, 16 May 2019 18:00:37 +0000 (18:00 +0000)]
MFC r347293:
Use software counters for rx_packets and rx_bytes in mlx5en(4).

The physical- and virtual- port counters might not reflect the amount
of data received after address filtering. Use the software counters
instead for rx_packets and rx_bytes to know exactly how much data
was received.

Sponsored by: Mellanox Technologies

5 years agoMFC r347292:
hselasky [Thu, 16 May 2019 17:59:43 +0000 (17:59 +0000)]
MFC r347292:
Add mlx5_firmware_update() in mlx5core.
Add support for upgrading firmware on mlx5 module load.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347291:
hselasky [Thu, 16 May 2019 17:59:02 +0000 (17:59 +0000)]
MFC r347291:
Handle IB_EVENT_DEVICE_FATAL event in ipoib.
Perform flush if IB_EVENT_DEVICE_FATAL was received.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347290:
hselasky [Thu, 16 May 2019 17:57:55 +0000 (17:57 +0000)]
MFC r347290:
Fix for double bus master disable in mlx5core.

mlx5_pci_disable_device is calling pci_disable_device which disables
bus master. No need to explicitly call pci_clear_master.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoFix minor compile issue after MFC r347288.
hselasky [Thu, 16 May 2019 17:57:09 +0000 (17:57 +0000)]
Fix minor compile issue after MFC r347288.

This is a direct commit.

Sponsored by: Mellanox Technologies

5 years agoMFC r347289:
hselasky [Thu, 16 May 2019 17:51:30 +0000 (17:51 +0000)]
MFC r347289:
Document userspace firmware flash in mlx5tool(8) and mlx5io(4).

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347288:
hselasky [Thu, 16 May 2019 17:50:52 +0000 (17:50 +0000)]
MFC r347288:
Implement userspace firmware update for ConnectX-4/5/6.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347287:
hselasky [Thu, 16 May 2019 17:50:15 +0000 (17:50 +0000)]
MFC r347287:
Rename mlx5_fwdump_addr to more neutral mlx5_tool_addr in mlx5core.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347286:
hselasky [Thu, 16 May 2019 17:49:29 +0000 (17:49 +0000)]
MFC r347286:
Add mlxfw callbacks in mlx5core.

Add mlx5 implementation for the ones defined by the mlxfw
shared module to be used while flashing the device firmware.

The callbacks do their job through the MCQI, MCC and MCDA registers.

Linux commit:
62bd22cf326dc4ac5be673c11cef4602dc1f5e47

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347285 and r347327:
hselasky [Thu, 16 May 2019 17:48:36 +0000 (17:48 +0000)]
MFC r347285 and r347327:
Initial version of Mellanox in-kernel firmware upgrade support.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347284:
hselasky [Thu, 16 May 2019 17:38:59 +0000 (17:38 +0000)]
MFC r347284:
Convert remaining module parameters into SYSCTLs in mlx5core.

Sponsored by: Mellanox Technologies

5 years agoMFC r347283:
hselasky [Thu, 16 May 2019 17:38:11 +0000 (17:38 +0000)]
MFC r347283:
Remove redundant line of code in mlx5core.

Sponsored by: Mellanox Technologies

5 years agoMFC r347282:
hselasky [Thu, 16 May 2019 17:37:34 +0000 (17:37 +0000)]
MFC r347282:
Change implicit and probably erronous EPERM to EIO on command status error
in mlx5core.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347281:
hselasky [Thu, 16 May 2019 17:36:52 +0000 (17:36 +0000)]
MFC r347281:
Fix typo.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347280:
hselasky [Thu, 16 May 2019 17:36:18 +0000 (17:36 +0000)]
MFC r347280:
Fix style.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347279:
hselasky [Thu, 16 May 2019 17:35:39 +0000 (17:35 +0000)]
MFC r347279:
Fix netstat counters mapping in mlx5en(4).

The current mapping of driver counters to netstat counters is wrong.
For example, a single jabber packet, will cause the Ierrs counter to
count three times.

The work for mapping the hardware and software counters to their right
place in netstat counters were already done in Linux, take that as is
to the FreeBSD driver.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347278:
hselasky [Thu, 16 May 2019 17:34:54 +0000 (17:34 +0000)]
MFC r347278:
Fix endless loop in ipoib_poll().

ib_req_notify_cq may return negative value which will indicate a
failure. In the case of uncorrectable error, we will end up in an
endless loop. Fix that, by going to another loop with poll_more
only if there is anything left to poll.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347277:
hselasky [Thu, 16 May 2019 17:34:09 +0000 (17:34 +0000)]
MFC r347277:
Avoid leaking send queue mbufs during error recovery in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r347276:
hselasky [Thu, 16 May 2019 17:33:24 +0000 (17:33 +0000)]
MFC r347276:
Add helper functions to set/query MCC/MCDA/MCQI registers in mlx5core.

To be used by the mlx5 callbacks exposed to the mlxfw module.

Linux commit:
d2ad488b0073bd1a2c3f5d2ea50a7eb632103e5d

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347275:
hselasky [Thu, 16 May 2019 17:32:47 +0000 (17:32 +0000)]
MFC r347275:
Enhance MCAM reg to allow query on access reg support in mlx5core.

Enhance MCAM to allow the driver to query which access regs are
supported. For now, expose the regs needed for FW flashing.

Linux commit:
0ab87743cc8c5bcd482daf71961ed5fc45349e01

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347274:
hselasky [Thu, 16 May 2019 17:32:08 +0000 (17:32 +0000)]
MFC r347274:
Add MCC (Management Component Control) register definitions in mlx5core.

MCC (Management Component Control) allows to control a firmware
component update.

MCDA (Management Component Data Access) allows to read and write
a firmware component.

MCQI (Management Component Query Information) allows to query
information about firmware components.

Linux commit:
4717628938423fcba0aa8fa889e9fed4eb6a655f

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347273:
hselasky [Thu, 16 May 2019 17:31:31 +0000 (17:31 +0000)]
MFC r347273:
Add reading the mcam_reg in mlx5core.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347272:
hselasky [Thu, 16 May 2019 17:30:55 +0000 (17:30 +0000)]
MFC r347272:
Query and cache PCAM, MCAM registers on initialization in mlx5core.

On load_one, we now cache our capabilities registers internally, similar
to QUERY_HCA_CAP. Capabilities can later be queried using macros
introduced in this patch.

Linux commit:
71862561f3a62015a11de16d1c306481e8415c08

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347271:
hselasky [Thu, 16 May 2019 17:30:20 +0000 (17:30 +0000)]
MFC r347271:
Implement PCAM, MCAM access register commands in mlx5core.

Introduced registers will expose capabilities of new registers and
features related to port/management.
Driver will query MCAM and PCAM in order to avoid failing on old
firmwares with lack of support.

Linux commit:
c835ad64683bd3e2d1b31ed2cb1ff4366932edb1

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347270:
hselasky [Thu, 16 May 2019 17:29:43 +0000 (17:29 +0000)]
MFC r347270:
Expose PCAM, MCAM registers infrastructure in mlx5core.

PCAM: Ports capabilities mask register.
MCAM: Management capabilities mask register.

PCAM and MCAM registers will provide information regarding firmware
support for different features, in order to avoid cases where new driver
combined with old firmware results in syndromes (for ex. PCIe counters
before this patchset).

Linux commit:
cfdcbceaeffc669b70d904d80a2df9c86c232566

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347269:
hselasky [Thu, 16 May 2019 17:29:04 +0000 (17:29 +0000)]
MFC r347269:
Add sysctl(8) to control fast unload support in mlx5core.

Sponsored by: Mellanox Technologies

5 years agoMFC r347268:
hselasky [Thu, 16 May 2019 17:28:30 +0000 (17:28 +0000)]
MFC r347268:
Add Fast teardown support to mlx5core.

Today mlx5 devices support two teardown modes:
1- Regular teardown
2- Force teardown

This change introduces the enhanced version of the "Force teardown" that
allows SW to perform teardown in a faster way without the need to reclaim
all the pages.

Fast teardown provides the following advantages:
1- Fix a FW race condition that could cause command timeout
2- Avoid moving to polling mode
3- Close the vport to prevent PCI ACK to be sent without been
   scattered to memory

Linux commit:
fcd29ad17c6ff885dfae58f557e9323941e63ba2

Sponsored by: Mellanox Technologies

5 years agoMFC r347266:
hselasky [Thu, 16 May 2019 17:25:41 +0000 (17:25 +0000)]
MFC r347266:
Implement get and set nic state as global functions in mlx5core.

Sponsored by: Mellanox Technologies

5 years agoMFC r347265:
hselasky [Thu, 16 May 2019 17:25:01 +0000 (17:25 +0000)]
MFC r347265:
Ticks are integer type in FreeBSD.

Sponsored by: Mellanox Technologies

5 years agoMFC r347264:
hselasky [Thu, 16 May 2019 17:24:21 +0000 (17:24 +0000)]
MFC r347264:
Configure firmware to use RX hash format in mini CQE in mlx5en(4).

When using CQE zipping, one can choose between RX hash and Checksum.
This will indicate the parameter on which a zipping session should be
stopped.

While porting the Linux code, Checksum was chosen. However, the value
of Checksum is not being used anywhere.
For the FreeBSD driver, we prefer to use the RX hash format which will
guarantee the RX hash value for all the mini CQEs.
While at it, make sure to initialize the Checksum value in the
decompressed CQE.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347263:
hselasky [Thu, 16 May 2019 17:23:36 +0000 (17:23 +0000)]
MFC r347263:
Disable CQE zipping by default in mlx5en(4).

After doing performance measurements, it seems like CQE zipping doesn't
have any significant benefit.
Moreover, we know that this feature is disabled by default on other
operating systems (Linux for example).

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347262:
hselasky [Thu, 16 May 2019 17:22:57 +0000 (17:22 +0000)]
MFC r347262:
Split mlx5e_update_stats_work() in mlx5en(4).

Split the function into the mlx5e_update_stats_locked() core and make
mlx5e_update_stats_work() call the _locked helper, similar to many other
places in the kernel. This improves the code structure, making the
locking clean.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347261:
hselasky [Thu, 16 May 2019 17:22:11 +0000 (17:22 +0000)]
MFC r347261:
Implement fast close of RX channel in mlx5en(4).

Instead of waiting for all jobs to be cancelled, simply close the completion
queue to prevent more completion events and let mlx5e_destroy_rq() cleanup
the remaining mbufs.

Sponsored by: Mellanox Technologies

5 years agoMFC r347260 and r347326:
hselasky [Thu, 16 May 2019 17:21:27 +0000 (17:21 +0000)]
MFC r347260 and r347326:
Correct number of elements for priority to traffic class mappings in mlx5en(4).

The number of priorities is always 8, while the number of traffic classes
supported can vary. While at it convert the sysctl node into an array.

Sponsored by: Mellanox Technologies

5 years agoMFC r347259:
hselasky [Thu, 16 May 2019 17:19:48 +0000 (17:19 +0000)]
MFC r347259:
Remove unused module parameter in mlx5ib.

Sponsored by: Mellanox Technologies

5 years agoMFC r347258:
hselasky [Thu, 16 May 2019 17:19:03 +0000 (17:19 +0000)]
MFC r347258:
Make sure to error out when arming the CQ fails in mlx4ib and mlx5ib.

Sponsored by: Mellanox Technologies

5 years agoMFC r347257:
hselasky [Thu, 16 May 2019 17:18:29 +0000 (17:18 +0000)]
MFC r347257:
Make sure to error out when arming the CQ fails in ibcore.

Sponsored by: Mellanox Technologies

5 years agoMFC r347256:
hselasky [Thu, 16 May 2019 17:17:52 +0000 (17:17 +0000)]
MFC r347256:
Destroy port stats debug context in correct order in mlx5en(4).
Destroy children nodes before parent nodes.

Sponsored by: Mellanox Technologies

5 years agoMFC r347255:
hselasky [Thu, 16 May 2019 17:17:12 +0000 (17:17 +0000)]
MFC r347255:
Fix tx_jumbo_packets counter in mlx5en(4).

Instead of reading Ethernet RFC 2819 pXtoYoctets counters from
hardware which counts RX octets, count tx_stat_pXtoYoctets from
Ethernet extended counters which counts TX octets.

TX jumbo counters should be accumulated only after the PPCNT
counters were fetched from hardware with their latest value.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347254:
hselasky [Thu, 16 May 2019 17:16:31 +0000 (17:16 +0000)]
MFC r347254:
Update Ethernet extended counters in mlx5en(4).

Expose all Ethernet extended counters those counters via debug_stats
sysctl:
dev.mce.X.debug_stats

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347253:
hselasky [Thu, 16 May 2019 17:15:41 +0000 (17:15 +0000)]
MFC r347253:
Protect from infinite sw-reset loop in mlx5core.

Avoid an infinite software firmware reset loop that may be caused by a
hardware bug by limiting the maximum number of resets.
The counter between resets is reset by request for reset, and not by a
successful reset.
The interval between two resets can be configured via sysctl:
hw.mlx5.sw_reset_timeout
which is global to all mlx5 devices in the system.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347252:
hselasky [Thu, 16 May 2019 17:15:00 +0000 (17:15 +0000)]
MFC r347252:
Disable all MSIX interrupts before shutdown in mlx5.

Make sure the interrupt handlers don't race with the fast unload one
code in the shutdown handler.

Sponsored by: Mellanox Technologies

5 years agoMFC r347251:
hselasky [Thu, 16 May 2019 17:14:08 +0000 (17:14 +0000)]
MFC r347251:
Import Linux code to implement mlx5_ib_disassociate_ucontext() in mlx5ib.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347250:
hselasky [Thu, 16 May 2019 17:13:21 +0000 (17:13 +0000)]
MFC r347250:
Add temperature warning event to log in mlx5core.

Temperature warning event is sent by FW to indicate high temperature
as detected by one of the sensors on the board.
Add handling of this event by writing the numbers of the alert sensors
to the kernel log.

Linux commit:
1865ea9adbfaf341c5cd5d8f7d384f19948b2fe9

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347249:
hselasky [Thu, 16 May 2019 17:12:38 +0000 (17:12 +0000)]
MFC r347249:
Correctly define the interface state bits in mlx5en(4).

While at it remove unused interface state bits. This also fixes and issue
during shutdown:

There is an issue where the firmware fails during mlx5_load_one,
the health_care timer detects the issue and schedules a health_care call.
Then the mlx5_load_one detects the issue, cleans up and quits. Then
the health_care starts and calls mlx5_unload_one to clean up the resources
that no longer exist and causes kernel panic.

The root cause is that the bit MLX5_INTERFACE_STATE_DOWN is not set
after mlx5_load_one fails. The solution is removing the bit
MLX5_INTERFACE_STATE_DOWN and quit mlx5_unload_one if the
bit MLX5_INTERFACE_STATE_UP is not set. The bit MLX5_INTERFACE_STATE_DOWN
is redundant and we can use MLX5_INTERFACE_STATE_UP instead.

Linux commit:
10a8d00707082955b177164d4b4e758ffcbd4017
b3cb5388499c5e219324bfe7da2e46cbad82bfcf

Sponsored by: Mellanox Technologies

5 years agoMFC r347248:
hselasky [Thu, 16 May 2019 17:11:45 +0000 (17:11 +0000)]
MFC r347248:
Enable FPGA and FPGA QP errors for EQ and call the handler in mlx5core.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347247:
hselasky [Thu, 16 May 2019 17:11:02 +0000 (17:11 +0000)]
MFC r347247:
Add MLX5_FPGA_RELOAD IOCTL(2) to mlx5fpga.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347246:
hselasky [Thu, 16 May 2019 17:09:06 +0000 (17:09 +0000)]
MFC r347246:
Add support for Dynamic Interrupt Moderation, DIM, in mlx5en(4).

Add support for DIM based on Linux,
with some minor adaptions specific to FreeBSD.

Linux commit
f97c3dc3c0e8d23a5c4357d182afeef4c67f5c33

Sponsored by: Mellanox Technologies

5 years agoMFC r347190:
hselasky [Thu, 16 May 2019 17:04:15 +0000 (17:04 +0000)]
MFC r347190:
Use PCIV_INVALID in pci_channel_offline() in the LinuxKPI.

Build tested drm-current-kmod prior to commit.

Submitted by: slavash@
Sponsored by: Mellanox Technologies