]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoUpdate paths based on last-minute changes from libexec to lib.
imp [Thu, 6 Dec 2018 23:40:56 +0000 (23:40 +0000)]
Update paths based on last-minute changes from libexec to lib.

5 years agoDeclare global function print_intel_add_smart in header
imp [Thu, 6 Dec 2018 23:29:06 +0000 (23:29 +0000)]
Declare global function print_intel_add_smart in header

5 years agoUse proper prototypes.
imp [Thu, 6 Dec 2018 23:28:55 +0000 (23:28 +0000)]
Use proper prototypes.

5 years agoIt's useful to have this be a global function.
imp [Thu, 6 Dec 2018 22:59:18 +0000 (22:59 +0000)]
It's useful to have this be a global function.

Other vendors base their additional smart info pages on what Intel did
plus some other bits. So it's convenient to have this be global.

Sponsored by: Netflix

5 years agoThis is not a samsung standard, so remove that alias.
imp [Thu, 6 Dec 2018 22:59:08 +0000 (22:59 +0000)]
This is not a samsung standard, so remove that alias.

This was never documented, and isn't needed, so it's best removed to
avoid confusion.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18460

5 years agoMove intel and wdc files to their own modules
imp [Thu, 6 Dec 2018 22:58:55 +0000 (22:58 +0000)]
Move intel and wdc files to their own modules

Move the intel and wdc vendor specific stuff to their own modules.

Sponsored by: Netflix
Differential Revision:  https://reviews.freebsd.org/D18460

5 years agoConst poison the command interface
imp [Thu, 6 Dec 2018 22:58:42 +0000 (22:58 +0000)]
Const poison the command interface

Make the pointers we pass into the commands const, also make the
linker set mirrors const.

Suggested by: cem@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18459

5 years agoDynamically load .so modules to expand functionality
imp [Thu, 6 Dec 2018 22:58:26 +0000 (22:58 +0000)]
Dynamically load .so modules to expand functionality

o Dynamically load all the .so files found in /libexec/nvmecontrol and
  /usr/local/libexec/nvmecontrol.
o Link nvmecontrol -rdynamic so that its symbols are visible to the
  libraries we load.
o Create concatinated linker sets that we dynamically expand.
o Add the linked-in top and logpage linker sets to the mirrors for them
  and add those sets to the mirrors when we load a new .so.
o Add some macros to help hide the names of the linker sets.
o Update the man page.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18455

fold

5 years agoRename riscv64-freebsd.c to riscv-freebsd.c.
jhb [Thu, 6 Dec 2018 22:35:07 +0000 (22:35 +0000)]
Rename riscv64-freebsd.c to riscv-freebsd.c.

This fixes truss when built as part of a riscv64sf world.  Additionally,
if FreeBSD ever supports RV32 RISC-V most of this file can be used as-is
just as a single file is used for all of the MIPS ABIs.

Sponsored by: DARPA

5 years agoFix build with option RSS, removing unused variables.
kib [Thu, 6 Dec 2018 21:52:40 +0000 (21:52 +0000)]
Fix build with option RSS, removing unused variables.

Reported by: np
Sponsored by: Mellanox Technologies
MFC after: 1 week

5 years agocxgbe(4): Get Linux cxgb4vf working in bhyve VMs with VFs passed
np [Thu, 6 Dec 2018 21:33:08 +0000 (21:33 +0000)]
cxgbe(4): Get Linux cxgb4vf working in bhyve VMs with VFs passed
through.

cxgb4vf doesn't own the buffer size list but still expects the first two
entries to be 4K and some power of 2 respectively.  The BSD cxgbe
doesn't care where its preferred buffer sizes are as long as they're in
the list somewhere, so just move its entries towards the end as a
workaround.

MFC after: 1 month
Sponsored by: Chelsio Communicatons

5 years agohier.7: add /lib/casper directory
emaste [Thu, 6 Dec 2018 21:27:36 +0000 (21:27 +0000)]
hier.7: add /lib/casper directory

Reported by: imp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoUpdate bmake to version 20180919
sjg [Thu, 6 Dec 2018 20:56:19 +0000 (20:56 +0000)]
Update bmake to version 20180919

Cleanup of stats cache
and new :q modifier.

5 years agoDon't reference zfs-specific variables if LOADER_ZFS_SUPPORT is undefined
ian [Thu, 6 Dec 2018 20:28:09 +0000 (20:28 +0000)]
Don't reference zfs-specific variables if LOADER_ZFS_SUPPORT is undefined
because the variables will be undefined too.

Reported by: sjg@
Pointy hat: ian@

5 years agoRemove an ugly Ultrix hack. Ultrix has been AWOL since the last ice
cy [Thu, 6 Dec 2018 20:15:54 +0000 (20:15 +0000)]
Remove an ugly Ultrix hack. Ultrix has been AWOL since the last ice
age, more to come.

MFC after: 1 week

5 years agoMinor mandoc fixes.
joel [Thu, 6 Dec 2018 20:04:01 +0000 (20:04 +0000)]
Minor mandoc fixes.

5 years agoAdd zdopen(3) to complement zopen(3).
markj [Thu, 6 Dec 2018 20:03:06 +0000 (20:03 +0000)]
Add zdopen(3) to complement zopen(3).

zdopen() can be used in capability mode.  Update zopen.3 accordingly
and fix some grammar nits while I'm here.

Reviewed by: delphij
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18456

5 years agoSort .Xr
joel [Thu, 6 Dec 2018 19:49:08 +0000 (19:49 +0000)]
Sort .Xr

5 years agopfsync: Performance improvement
kp [Thu, 6 Dec 2018 19:27:15 +0000 (19:27 +0000)]
pfsync: Performance improvement

pfsync code is called for every new state, state update and state
deletion in pf. While pf itself can operate on multiple states at the
same time (on different cores, assuming the states hash to a different
hashrow), pfsync only had a single lock.
This greatly reduced throughput on multicore systems.

Address this by splitting the pfsync queues into buckets, based on the
state id. This ensures that updates for a given connection always end up
in the same bucket, which allows pfsync to still collapse multiple
updates into one, while allowing multiple cores to proceed at the same
time.

The number of buckets is tunable, but defaults to 2 x number of cpus.
Benchmarking has shown improvement, depending on hardware and setup, from ~30%
to ~100%.

MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D18373

5 years agoAppease gcc build, remove duplicated declaration.
kib [Thu, 6 Dec 2018 19:20:00 +0000 (19:20 +0000)]
Appease gcc build, remove duplicated declaration.

Reported by: np
Sponsored by: Mellanox Technologies
MFC after: 1 week

5 years agoChange u32 to uint32_t to allow the native-xtools target to build
sbruno [Thu, 6 Dec 2018 18:59:33 +0000 (18:59 +0000)]
Change u32 to uint32_t to allow the native-xtools target to build
libsysdecode.

Submitted by: kib

5 years agopf: add a comment describing why do we call pf_map_addr again if port
kp [Thu, 6 Dec 2018 18:58:54 +0000 (18:58 +0000)]
pf: add a comment describing why do we call pf_map_addr again if port
selection process fails

Obtained from: OpenBSD

5 years agoReduce number of DNS queries in mountd.
sef [Thu, 6 Dec 2018 18:21:48 +0000 (18:21 +0000)]
Reduce number of DNS queries in mountd.

As reported by a FreeNAS user (see https://redmine.ixsystems.com/issues/55728),
mountd does more calls to getnameinfo() than it needs to; this changes it to
only call it for the RPC calls it needs the name information for.

Reported by: Dave Flowers
Reviewed by: imp, mav
Approved by: mav (mentor)
MFC after: 2 weeks
Sponsored by: iXsystems Inc
Differential Revision: https://reviews.freebsd.org/D18430

5 years agoApparently @portmgr does not feel like my current level of contribution
sobomax [Thu, 6 Dec 2018 18:12:50 +0000 (18:12 +0000)]
Apparently @portmgr does not feel like my current level of contribution
warrants me a repo access to the ports tree anymore. Move myself into alumni
at least for a time being.

5 years agosyslog(3): stdarg.h is needed only for vsyslog()
yuripv [Thu, 6 Dec 2018 18:03:18 +0000 (18:03 +0000)]
syslog(3): stdarg.h is needed only for vsyslog()

Reported by: Brian Wood <woodbrian77@gmail.com>
Reviewed by: asomers, ngie
Differential revision: https://reviews.freebsd.org/D18334

5 years agoLet kern.trap_enotcap be set as a tunable.
markj [Thu, 6 Dec 2018 17:29:37 +0000 (17:29 +0000)]
Let kern.trap_enotcap be set as a tunable.

This is handy for testing programs that are run by rc.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoAdd examples for "make buildenv".
trasz [Thu, 6 Dec 2018 13:52:02 +0000 (13:52 +0000)]
Add examples for "make buildenv".

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agotermcap: add italics and tmux entries
yuripv [Thu, 6 Dec 2018 13:46:18 +0000 (13:46 +0000)]
termcap: add italics and tmux entries

- add "ecma+italics" cap
- use it in "xterm-basic"
- add "tmux"/"tmux-256color" caps, fixing "so" and "se" caps,
  and sourcing "ecma+italics" and "screen"/"screen-256color"

Reviewed by: bapt
Differential revision: https://reviews.freebsd.org/D18363

5 years agoacpi_{Device,Battery}IsPresent: restore pre-r330957 behaviour
avg [Thu, 6 Dec 2018 12:34:34 +0000 (12:34 +0000)]
acpi_{Device,Battery}IsPresent: restore pre-r330957 behaviour

Specifically, assume that the device is present if evaluation of _STA
method fails.

Before r330957 we ignored any _STA evaluation failure (which was
performed by AcpiGetObjectInfo in ACPICA contrib code) for the purpose
of acpi_DeviceIsPresent and acpi_BatteryIsPresent.  ACPICA 20180313
removed evaluation of _STA from AcpiGetObjectInfo.  So, we added
evaluation of _STA to acpi_DeviceIsPresent and acpi_BatteryIsPresent.
One important difference is that the new code ignored a failure only if
_STA did not exist (AE_NOT_FOUND).  Any other kind of failure was
treated as a fatal failure.  Apparently, on some systems we can get
AE_NOT_EXIST when evaluating _STA.  And that error is not an evil twin
of AE_NOT_FOUND, despite a very similar name, but a distinct error
related to a missing handler for an ACPI operation region.

It's possible that for some people the problem was already fixed by
changes in ACPICA and/or in acpi_ec driver (or even in BIOS) that fixed
the AE_NOT_EXIST failure related to EC operation region.

This work is based on a great analysis by cem and an earlier patch by
Ali Abdallah <aliovx@gmail.com>.

PR: 227191
Reported by: 0mp
MFC after: 2 weeks

5 years agonetmap: netmap_transmit should honor bpf packet tap hook
vmaffione [Thu, 6 Dec 2018 09:45:25 +0000 (09:45 +0000)]
netmap: netmap_transmit should honor bpf packet tap hook

This allows tcpdump to capture outbound kernel packets while
in netmap mode

Submitted by: Marc de la Gueronniere <mdelagueronniere@verisign.com>
Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Verisign, Inc.
Differential Revision: https://reviews.freebsd.org/D17896

5 years agoTemporarily skip flakey test cases
lwhsu [Thu, 6 Dec 2018 09:22:35 +0000 (09:22 +0000)]
Temporarily skip flakey test cases

PR: 233586, 233587, 233588
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18362

5 years agocxgbe(4): Fall back to a basic configuration in case of any error during
np [Thu, 6 Dec 2018 06:18:21 +0000 (06:18 +0000)]
cxgbe(4): Fall back to a basic configuration in case of any error during
card initialization.  This is an expanded version of r333682.

Break up prep_firmware into simpler routines while here.  Load the
firmware/config KLD only if needed.

MFC after: 1 month
Sponsored by: Chelsio Communications

5 years agopowerpc: Set very low priority mode while waiting for AP unleash event
jhibbits [Thu, 6 Dec 2018 04:36:02 +0000 (04:36 +0000)]
powerpc: Set very low priority mode while waiting for AP unleash event

The POWER9 does not recognize 'or 27,27,27' as a thread priority NOP.  On
earlier POWER architectures, this NOP would note to the processor to give up
resources if able, to improve performance of other threads.

All processors that support the thread priority NOPs recognize the
'or 31,31,31' NOP as very low priority, so use this to perform a similar
function, and not burn cycles on POWER9.

5 years agopowerpc: Fix ELFv2 JMP_SLOT relocation fixup
jhibbits [Thu, 6 Dec 2018 04:30:24 +0000 (04:30 +0000)]
powerpc: Fix ELFv2 JMP_SLOT relocation fixup

The jump slot is a function pointer, not a descriptor pointer, in ELFv2.  Just
write the pointer itself over, not the contents of the pointer, which would be
the first instruction of the function.

5 years agopowerpc/powermac: Fix macgpio(4) child interrupt resource handling
jhibbits [Thu, 6 Dec 2018 04:25:12 +0000 (04:25 +0000)]
powerpc/powermac: Fix macgpio(4) child interrupt resource handling

The 'interrupts' property is actually 2 words, not one, on macgpio child
nodes.  Open Firmware's getprop function might be returning the value
copied, not the total size of the property, but FDT's returns the total
size.  Prior to this patch, this would cause the SYS_RES_IRQ resource list
to not be populated when running with the 'usefdt' loader variable set, to
convert the OFW device tree to a FDT.  Since the property is always 2 words,
read both words, and ignore the second.

Tested by: Dennis Clarke (previous attempt)
MFC after: 2 weeks

5 years agoIf the vfs.ffs.dotrimcons sysctl option is enabled while a file
mckusick [Thu, 6 Dec 2018 01:04:56 +0000 (01:04 +0000)]
If the vfs.ffs.dotrimcons sysctl option is enabled while a file
deletion is active, specifically after a call to ffs_blkrelease_start()
but before the call to ffs_blkrelease_finish(), ffs_blkrelease_start()
will have handed out SINGLETON_KEY rather than starting a collection
sequence. Thus if we get a SINGLETON_KEY passed to ffs_blkrelease_finish(),
we just return rather than trying to finish the nonexistent sequence.

Reported by:  Warner Losh (imp@)
Sponsored by: Netflix

5 years agotag bmake-20180919
sjg [Thu, 6 Dec 2018 00:13:51 +0000 (00:13 +0000)]
tag bmake-20180919

5 years agoImport bmake-20180919
sjg [Thu, 6 Dec 2018 00:13:35 +0000 (00:13 +0000)]
Import bmake-20180919

5 years agoNormally when an attempt is made to mount a UFS/FFS filesystem whose
mckusick [Thu, 6 Dec 2018 00:09:39 +0000 (00:09 +0000)]
Normally when an attempt is made to mount a UFS/FFS filesystem whose
superblock has a check-hash error, an error message noting the
superblock check-hash failure is printed and the mount fails. The
administrator then runs fsck to repair the filesystem and when
successful, the filesystem can once again be mounted.

This approach fails if the filesystem in question is a root filesystem
from which you are trying to boot. Here, the loader fails when trying
to access the filesystem to get the kernel to boot. So it is necessary
to allow the loader to ignore the superblock check-hash error and make
a best effort to read the kernel. The filesystem may be suffiently
corrupted that the read attempt fails, but there is no harm in trying
since the loader makes no attempt to write to the filesystem.

Once the kernel is loaded and starts to run, it attempts to mount its
root filesystem. Once again, failure means that it breaks to its prompt
to ask where to get its root filesystem. Unless you have an alternate
root filesystem, you are stuck.

Since the root filesystem is initially mounted read-only, it is
safe to make an attempt to mount the root filesystem with the failed
superblock check-hash. Thus, when asked to mount a root filesystem
with a failed superblock check-hash, the kernel prints a warning
message that the root filesystem superblock check-hash needs repair,
but notes that it is ignoring the error and proceeding. It does
mark the filesystem as needing an fsck which prevents it from being
enabled for writing until fsck has been run on it. The net effect
is that the reboot fails to single user, but at least at that point
the administrator has the tools at hand to fix the problem.

Reported by:    Rick Macklem (rmacklem@)
Discussed with: Warner Losh (imp@)
Sponsored by:   Netflix

5 years agopf tests: Add a defer mode test for pfsync
kp [Wed, 5 Dec 2018 19:53:09 +0000 (19:53 +0000)]
pf tests: Add a defer mode test for pfsync

Repeat the pfsync test, this time with the 'defer' option enabled. This
exercises slightly different code paths.

5 years agoFurther simplify arguments to init.
brooks [Wed, 5 Dec 2018 19:18:16 +0000 (19:18 +0000)]
Further simplify arguments to init.

With the removal of BOOTCDROM and fastboot support, this code always
passed "-s" or "--". The latter simply terminates getopt(3) processing
in init so we only need to pass "-s" in the single user case, or nothing
in other cases.

The passing of "--" seems to have been done to ensure that the number of
arguments passed to init was always the same and thus that argc was the
same.

Also GC the write-only variable pathlen (not in reviewed version).

Reviewed by: kib, jhb
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18441

5 years agoTerminate a blist_alloc search when a blst_meta_alloc call fails with
alc [Wed, 5 Dec 2018 18:26:40 +0000 (18:26 +0000)]
Terminate a blist_alloc search when a blst_meta_alloc call fails with
cursor == 0.

Every call to blst_meta_alloc but the one at the root is made only when the
meta-node is known to include a free block, so that either the allocation
will succeed, the node hint will be updated, or the last block of the meta-
node range is, and remains, free.  But the call at the root is made without
checking that there is a free block, so in the case that every block is
allocated, there is no hint update to prevent the current code from looping
forever.

Submitted by: Doug Moore <dougm@rice.edu>
Reported by: pho
Reviewed by: pho
Tested by: pho
X-MFC with: r340402
Differential Revision: https://reviews.freebsd.org/D17999

5 years agoixl(4) has netdump support via iflib.
markj [Wed, 5 Dec 2018 18:19:29 +0000 (18:19 +0000)]
ixl(4) has netdump support via iflib.

Reported by: kbowling
MFC after: 3 days

5 years agoRemove never enabled support for "fastboot".
brooks [Wed, 5 Dec 2018 17:35:15 +0000 (17:35 +0000)]
Remove never enabled support for "fastboot".

This has been ifdef notyet since the import of BSD 4.4 Lite Kernel
Sources in r1541.

Sponsored by: DARPA, AFRL

5 years agoRemove ifdef BOOTCDROM option to start init.
brooks [Wed, 5 Dec 2018 17:29:14 +0000 (17:29 +0000)]
Remove ifdef BOOTCDROM option to start init.

When BOOTCDROM is defined (via CFLAGS as there is no config option)
it causes -C to be passed to init, but our init and the version of
sysinstall I glanced at in 6.x don't support -C. The last plausibly
related support was removed from the tree in 1995.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18431

5 years agostat(2): clarify which syscalls modify file timestamps
asomers [Wed, 5 Dec 2018 17:28:40 +0000 (17:28 +0000)]
stat(2): clarify which syscalls modify file timestamps

The list of syscalls that modify st_atim, st_mtim, and st_ctim was quite out
of date and probably not accurate to begin with.  Update it, and make it
clear that the list is open-ended.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18410

5 years agoClamp the INPCB port hash tables to IPPORT_MAX + 1 chains.
markj [Wed, 5 Dec 2018 17:06:00 +0000 (17:06 +0000)]
Clamp the INPCB port hash tables to IPPORT_MAX + 1 chains.

Memory beyond that limit was previously unused, wasting roughly 1MB per
8GB of RAM.  Also retire INP_PCBLBGROUP_PORTHASH, which was identical to
INP_PCBPORTHASH.

Reviewed by: glebius
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D17803

5 years agoNetdump support was added to mlx4en(4) in r341548.
markj [Wed, 5 Dec 2018 16:55:45 +0000 (16:55 +0000)]
Netdump support was added to mlx4en(4) in r341548.

MFC with: r341548

5 years agosx: retire SX_NOADAPTIVE
mjg [Wed, 5 Dec 2018 16:43:03 +0000 (16:43 +0000)]
sx: retire SX_NOADAPTIVE

The flag is not used by anything for years and supporting it requires an
explicit read from the lock when entering slow path.

Flag value is left unused on purpose.

Sponsored by: The FreeBSD Foundation

5 years agoRemove redundant declaration after r341517.
hselasky [Wed, 5 Dec 2018 15:56:44 +0000 (15:56 +0000)]
Remove redundant declaration after r341517.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFix some build of LinuxKPI on some platforms after r341518.
hselasky [Wed, 5 Dec 2018 15:53:34 +0000 (15:53 +0000)]
Fix some build of LinuxKPI on some platforms after r341518.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFix LINT build after r341572.
hselasky [Wed, 5 Dec 2018 15:42:31 +0000 (15:42 +0000)]
Fix LINT build after r341572.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agonetmap.h: include stdatomic.h
vmaffione [Wed, 5 Dec 2018 15:38:52 +0000 (15:38 +0000)]
netmap.h: include stdatomic.h

The stdatomic.h header exports atomic_thread_fence(), that
can be used to implement the nm_stst_barrier() macro needed
by netmap.

MFC after: 3 days

5 years agomlx4/mlx5: Updated driver version to 3.5.0
slavash [Wed, 5 Dec 2018 14:25:34 +0000 (14:25 +0000)]
mlx4/mlx5: Updated driver version to 3.5.0

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Implement backpressure indication.
slavash [Wed, 5 Dec 2018 14:25:03 +0000 (14:25 +0000)]
mlx5en: Implement backpressure indication.

The backpressure indication is implemented using an unlimited rate type of
mbuf send tag. When the upper layers typically the socket layer has obtained such
a tag, it can then query the destination driver queue for the current
amount of space available in the send queue.

A single mbuf send tag may be referenced multiple times and a refcount has been added
to the mlx5e_priv structure to track its usage. Because the send tag resides
in the mlx5e_channel structure, there is no need to wait for refcounts to reach
zero until the mlx4en(4) driver is detached. The channels structure is persistant
during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed
without any need of synchronization.

The mlx5e_snd_tag structure was extended to contain a type field, because there are now
two different tag types which end up in the driver which need to be distinguished.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Improve configuration of HW LRO.
slavash [Wed, 5 Dec 2018 14:24:33 +0000 (14:24 +0000)]
mlx5en: Improve configuration of HW LRO.

In order to enable HW LRO, both the "hw_lro" sysctl in the mlx5en(4) config
space must be set, and the ifconfig(8) LRO capability must be set. Any other
settings will disable HW LRO.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Count all transmitted and received bytes.
slavash [Wed, 5 Dec 2018 14:24:02 +0000 (14:24 +0000)]
mlx5en: Count all transmitted and received bytes.

Add counter for all transmitted and received bytes. Currently only all
transmitted and received packets were counted. Fix description of RX LRO
counters while at it.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Statically allocate and free the channel structure(s).
slavash [Wed, 5 Dec 2018 14:23:31 +0000 (14:23 +0000)]
mlx5en: Statically allocate and free the channel structure(s).

By allocating the worst case size channel structure array
at attach time we can eliminate various NULL checks in the
fast path. And also reduce the chance for use-after-free
issues in the transmit fast path.

This change is also a requirement for implementing
backpressure support.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Fix race in mlx5e_ethtool_debug_stats().
slavash [Wed, 5 Dec 2018 14:23:01 +0000 (14:23 +0000)]
mlx5en: Fix race in mlx5e_ethtool_debug_stats().

Writing to the debug stats variable must be locked,
else serialization will be lost which might cause
various kernel panics due to creating and destroying
sysctls out of order.

Make sure the sysctl context is initialized after freeing
the sysctl nodes, else they can be freed twice.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Add support for IFM_10G_LR and IFM_40G_ER4 media types.
slavash [Wed, 5 Dec 2018 14:22:30 +0000 (14:22 +0000)]
mlx5en: Add support for IFM_10G_LR and IFM_40G_ER4 media types.

Inspect the ethernet compliance code to figure out actual cable type by reading
the PDDR module info register.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Don't set rate on SQs when the SQ is already stopped.
slavash [Wed, 5 Dec 2018 14:21:59 +0000 (14:21 +0000)]
mlx5en: Don't set rate on SQs when the SQ is already stopped.

This can happen when connections are short lived and leads to
a firmware error printout in dmesg, syndrome 0x51cfb0, because
the SQ is in the wrong state.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Fix for inlining issues in transmit path
slavash [Wed, 5 Dec 2018 14:21:28 +0000 (14:21 +0000)]
mlx5en: Fix for inlining issues in transmit path

1) Don't exceed the drivers own hardcoded TX inline limit.

The blueflame register size can be much greater than the hardcoded limit
for inlining. Make sure we don't exceed the drivers own limit, because this
also means that the maximum number of TX fragments becomes invalid and
then memory size assumptions in the TX path no longer hold up.

2) Make sure the mlx5_query_min_inline() function returns an error code.

3) Header inlining is required when using TSO.

4) Catch failure to compute inline header size for TSO.

5) Add support for UDP when computing inline header size.

6) Fix for inlining issues with regards to DSCP.

Make sure we inline 4 bytes beyond the ethernet and/or
VLAN header to workaround a hardware bug extracting
the DSCP field from the IPv4/v6 header.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Remove the DRBR and associated logic in the transmit path.
slavash [Wed, 5 Dec 2018 14:20:57 +0000 (14:20 +0000)]
mlx5en: Remove the DRBR and associated logic in the transmit path.

The hardware queues are deep enough currently and using the DRBR and associated
callbacks only leads to more task switching in the TX path. The is also a race
setting the queue_state which can lead to hung TX rings.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Implement support for bandwidth limiting in by ratio, ETS.
slavash [Wed, 5 Dec 2018 14:20:26 +0000 (14:20 +0000)]
mlx5en: Implement support for bandwidth limiting in by ratio, ETS.

Add support for setting the bandwidth limit as a ratio rather than in bits per
second. The ratio must be an integer number between 1 and 100 inclusivly.

Implement the needed firmware commands and SYSCTLs through mlx5en(4).

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5fpga: Add set and query connect/disconnect FPGA
slavash [Wed, 5 Dec 2018 14:19:55 +0000 (14:19 +0000)]
mlx5fpga: Add set and query connect/disconnect FPGA

Submitted by:   kib@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5fpga: IOCTL for FPGA temperature measurement
slavash [Wed, 5 Dec 2018 14:19:23 +0000 (14:19 +0000)]
mlx5fpga: IOCTL for FPGA temperature measurement

Submitted by:   kib@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5fpga: Support MorseQ board
slavash [Wed, 5 Dec 2018 14:18:52 +0000 (14:18 +0000)]
mlx5fpga: Support MorseQ board

Added and supported new enum "morseQ = 4" for fpga_id field

Submitted by:   kib@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5fpga_tools initial code import.
slavash [Wed, 5 Dec 2018 14:17:22 +0000 (14:17 +0000)]
mlx5fpga_tools initial code import.

Submitted by:   kib@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5fpga: Initial code import.
slavash [Wed, 5 Dec 2018 14:11:20 +0000 (14:11 +0000)]
mlx5fpga: Initial code import.

Submitted by:   kib@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5ib: Set default active width and speed when querying port.
slavash [Wed, 5 Dec 2018 13:49:11 +0000 (13:49 +0000)]
mlx5ib: Set default active width and speed when querying port.

Make sure the active width and speed is set in case the
translate_eth_proto_oper() function doesn't recognize the
current port operation mask.

Linux commit:
7672ed33c4c15dbe9d56880683baaba4227cf940

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5ib: Make sure the congestion work timer does not escape the drain procedure.
slavash [Wed, 5 Dec 2018 13:48:39 +0000 (13:48 +0000)]
mlx5ib: Make sure the congestion work timer does not escape the drain procedure.

If the mlx5_ib_read_cong_stats() function was running when mlx5ib was unloaded,
because this function unconditionally restarts the timer, the timer can still
be pending after the delayed work has been cancelled. To fix this simply loop
on the delayed work cancel procedure as long as it returns non-zero.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5ib: Fix null pointer dereference in mlx5_ib_create_srq
slavash [Wed, 5 Dec 2018 13:48:10 +0000 (13:48 +0000)]
mlx5ib: Fix null pointer dereference in mlx5_ib_create_srq

Although "create_srq_user" does overwrite "in.pas" on some paths, it
also contains at least one feasible path which does not overwrite it.

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5ib: Fix sign extension in mlx5_ib_query_device
slavash [Wed, 5 Dec 2018 13:47:41 +0000 (13:47 +0000)]
mlx5ib: Fix sign extension in mlx5_ib_query_device

"fw_rev_min(dev->mdev)" with type "unsigned short" (16 bits, unsigned) is
promoted in "fw_rev_min(dev->mdev) << 16" to type "int" (32 bits, signed), then
sign-extended to type "unsigned long" (64 bits, unsigned). If
"fw_rev_min(dev->mdev) << 16" is greater than 0x7FFFFFFF, the upper bits of the
result will all be 1.

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Fix driver version location
slavash [Wed, 5 Dec 2018 13:47:10 +0000 (13:47 +0000)]
mlx5: Fix driver version location

Driver description should be set by core and not by the Ethernet driver.

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Fixes to allow command polling mode to exist alongside event mode.
slavash [Wed, 5 Dec 2018 13:46:39 +0000 (13:46 +0000)]
mlx5: Fixes to allow command polling mode to exist alongside event mode.

A command is either polling or event driven and the mode cannot change
during execution of a command. Make sure the event handler only handle
commands which are not polled. This is done by checking the command mode
in the command handler before completing commands.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Fix wrong size allocation for QoS ETC TC register
slavash [Wed, 5 Dec 2018 13:46:09 +0000 (13:46 +0000)]
mlx5: Fix wrong size allocation for QoS ETC TC register

The driver allocates wrong size (due to wrong struct name) when issuing
a query/set request to NIC's register.

Linux commit:
d14fcb8d877caf1b8d6bd65d444bf62b21f2070c

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Add software tx_jumbo_packets counter
slavash [Wed, 5 Dec 2018 13:45:37 +0000 (13:45 +0000)]
mlx5: Add software tx_jumbo_packets counter

This counter will represent transmitted packets which has more than
1518 octets.
The NIC has multiple hardware counters for counting transmitted
packets larger than 1518 octets. Each counter counts the packets
in specific range.
We accumulate those counters to have a single counter.

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Implement support for configuring PCIe packet write ordering via a sysctl.
slavash [Wed, 5 Dec 2018 13:45:08 +0000 (13:45 +0000)]
mlx5: Implement support for configuring PCIe packet write ordering via a sysctl.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Extend vector argument to u64.
slavash [Wed, 5 Dec 2018 13:44:38 +0000 (13:44 +0000)]
mlx5: Extend vector argument to u64.

Else the MLX5_TRIGGERED_CMD_COMP flag will be masked away.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Add global control to disable firmware reset, for all mlx5 devices.
slavash [Wed, 5 Dec 2018 13:44:08 +0000 (13:44 +0000)]
mlx5: Add global control to disable firmware reset, for all mlx5 devices.

Submitted by:   kib@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Fix use-after-free in self-healing flow
slavash [Wed, 5 Dec 2018 13:43:37 +0000 (13:43 +0000)]
mlx5: Fix use-after-free in self-healing flow

When the mlx5 health mechanism detects a problem while the driver
is in the middle of init_one or remove_one, the driver needs to prevent
the health mechanism from scheduling future work; if future work
is scheduled, there is a problem with use-after-free: the system WQ
tries to run the work item (which has been freed) at the scheduled
future time.

Prevent this by disabling work item scheduling in the health mechanism
when the driver is in the middle of init_one() or remove_one().

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Move hw.mlx5 node definition to mlx5_core.
slavash [Wed, 5 Dec 2018 13:43:07 +0000 (13:43 +0000)]
mlx5: Move hw.mlx5 node definition to mlx5_core.

Submitted by:   kib@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Convert some spaces into tabs and use device_printf() instead of printf().
slavash [Wed, 5 Dec 2018 13:42:36 +0000 (13:42 +0000)]
mlx5: Convert some spaces into tabs and use device_printf() instead of printf().

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Add SRQ fixes from Linux
slavash [Wed, 5 Dec 2018 13:42:06 +0000 (13:42 +0000)]
mlx5: Add SRQ fixes from Linux

Combine multiple fixes from Linux to SRQ.
Linux commits:
c73b791 IB/mlx5: Assign SRQ type earlier
0fd27a8 IB/mlx5: Fix out-of-bound access
c2b37f7 IB/mlx5: Fix integer overflows in mlx5_ib_create_srq
d63c467 RDMA/mlx5: Fix memory leak in mlx5_ib_create_srq() error path

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Fix for potential memory leaks.
slavash [Wed, 5 Dec 2018 13:41:37 +0000 (13:41 +0000)]
mlx5: Fix for potential memory leaks.

Make sure allocated data gets freed in error cases.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Discard unused return values.
slavash [Wed, 5 Dec 2018 13:41:06 +0000 (13:41 +0000)]
mlx5: Discard unused return values.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Raise fatal IB event when sys error occurs
slavash [Wed, 5 Dec 2018 13:40:36 +0000 (13:40 +0000)]
mlx5: Raise fatal IB event when sys error occurs

All other mlx5_events report the port number as 1 based, which is how FW
reports it in the port event EQE. Reporting 0 for this event causes
mlx5_ib to not raise a fatal event notification to registered clients
due to a seemingly invalid port.

All switch cases in mlx5_ib_event that go through the port check are
supposed to set the port now, so just do it once at variable
declaration.

Linux commit:
aba462134634b502d720e15b23154f21cfa277e5

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5: Fix integer overflow while resizing CQ
slavash [Wed, 5 Dec 2018 13:40:05 +0000 (13:40 +0000)]
mlx5: Fix integer overflow while resizing CQ

The user can provide very large cqe_size which will cause to integer
overflow.

Linux commit:
28e9091e3119933c38933cb8fc48d5618eb784c8

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx4en: Optimise reception of small packets.
slavash [Wed, 5 Dec 2018 13:39:35 +0000 (13:39 +0000)]
mlx4en: Optimise reception of small packets.

Copy small packets like TCP ACKs into a new mbuf
reusing the existing mbuf to receive a new ethernet
frame. This avoids wasting buffer space for
small sized packets.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx4: Make sure default VNET is set when adding a new interface.
slavash [Wed, 5 Dec 2018 13:39:05 +0000 (13:39 +0000)]
mlx4: Make sure default VNET is set when adding a new interface.

Adding an interface might be done outside the device_attach() routine
and will then cause a panic, due to the VNET not being defined.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx4en: Remove duplicate statistics variable assignment.
slavash [Wed, 5 Dec 2018 13:38:35 +0000 (13:38 +0000)]
mlx4en: Remove duplicate statistics variable assignment.

The "priv->pkstats.rx_dropped" is written twice in a row.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx4en: Add support for receiving all data using one or more MCLBYTES sized mbufs.
slavash [Wed, 5 Dec 2018 13:32:46 +0000 (13:32 +0000)]
mlx4en: Add support for receiving all data using one or more MCLBYTES sized mbufs.
Also when the MTU is greater than MCLBYTES.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx4en: Add support for netdump.
slavash [Wed, 5 Dec 2018 13:32:15 +0000 (13:32 +0000)]
mlx4en: Add support for netdump.

Implement the needed callback functions and support for polling the driver.

Differential Revision: https://reviews.freebsd.org/D15259
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx4en: Remove the DRBR and associated logic in the transmit path.
slavash [Wed, 5 Dec 2018 13:31:45 +0000 (13:31 +0000)]
mlx4en: Remove the DRBR and associated logic in the transmit path.

The hardware queues are deep enough currently and using the DRBR and associated
callbacks only leads to more task switching in the TX path. The is also a race
setting the queue_state which can lead to hung TX rings.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx4en: Add driver version to sysctl desc
slavash [Wed, 5 Dec 2018 13:31:14 +0000 (13:31 +0000)]
mlx4en: Add driver version to sysctl desc

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx4: Add board identifier and firmware version to sysctl
slavash [Wed, 5 Dec 2018 13:30:48 +0000 (13:30 +0000)]
mlx4: Add board identifier and firmware version to sysctl

In last mlx4 update (r325841) we lost the sysctl to show the
firmware version for mlx4 devices.
Add both board identifier and firmware version under:
sys.device.mlx4_core0.hw sysctl node.

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx4core: Add checks for invalid port numbers.
slavash [Wed, 5 Dec 2018 13:30:16 +0000 (13:30 +0000)]
mlx4core: Add checks for invalid port numbers.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx4: Zero initialize device capabilities to avoid use of uninitialized fields.
slavash [Wed, 5 Dec 2018 13:29:46 +0000 (13:29 +0000)]
mlx4: Zero initialize device capabilities to avoid use of uninitialized fields.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx4core: Avoid multiplication overflow by casting multiplication.
slavash [Wed, 5 Dec 2018 13:29:16 +0000 (13:29 +0000)]
mlx4core: Avoid multiplication overflow by casting multiplication.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agoopensm: Use precision specifier for scanf
slavash [Wed, 5 Dec 2018 13:28:46 +0000 (13:28 +0000)]
opensm: Use precision specifier for scanf

If user input a string larger than the length of buffer, the stack
memory will be corrupted.

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies