]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r341511,r341512,r341513:
Michal Meloun [Fri, 14 Dec 2018 10:20:26 +0000 (10:20 +0000)]
MFC r341511,r341512,r341513:

  r341511:
    Fix style(9). Not a functional change.
  r341512:
    Implement arm64 version of __tls_get_addr().
  r341513:
    Tidy up arm64 reloc_jmpslots() implementation.
    - don't relocate jump slots multiple times (if LD_BIND_NOW is defined).
    - process only R_AARCH64_JUMP_SLOT here, other relocation types are
      handled by reloc_plt().

5 years agoMFC r341680
Vincenzo Maffione [Fri, 14 Dec 2018 09:06:56 +0000 (09:06 +0000)]
MFC r341680

netmap: remove dead code obsoleted by iflib

The iflib subsystem implements netmap support in a driver-independent
way (sys/net/iflib.c). We can therefore remove the headers that
used to implement netmap support for all the drivers now supported
by iflib (em, igb, ixl, ixgbe, lem).

5 years agopfsync: Performance improvement
Kristof Provost [Thu, 13 Dec 2018 20:00:11 +0000 (20:00 +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%.

Sponsored by: Orange Business Services

5 years agoMFC r340405:
Mark Johnston [Thu, 13 Dec 2018 16:07:35 +0000 (16:07 +0000)]
MFC r340405:
Add accounting to per-domain UMA full bucket caches.

5 years agoMFC r341638:
Mark Johnston [Thu, 13 Dec 2018 15:51:07 +0000 (15:51 +0000)]
MFC r341638:
Let kern.trap_enotcap be set as a tunable.

5 years agoMFC r340394: ipfw.8: Fix part of the SYNOPSIS documenting
Eugene Grosbein [Thu, 13 Dec 2018 10:52:40 +0000 (10:52 +0000)]
MFC r340394: ipfw.8: Fix part of the SYNOPSIS documenting
LIST OF RULES AND PREPROCESSING that is still referred
as last section of the SYNOPSIS later but was erroneously situated
in the section IN-KERNEL NAT.

5 years agoMFC r341726
Vincenzo Maffione [Thu, 13 Dec 2018 09:40:06 +0000 (09:40 +0000)]
MFC r341726

tools: netmap: pkt-gen: check packet length against interface MTU

Validate the value of the -l argument (packet length) against the MTU of the netmap port.
In case the netmap port does not refer to a physical interface (e.g. VALE port or pipe), then
the netmap buffer size is used as MTU.
This change also sets a better default value for the -M option, so that pkt-gen uses
the largest possible fragments in case of multi-slot packets.

Differential Revision:  https://reviews.freebsd.org/D18436

5 years agoMFC r341624
Vincenzo Maffione [Thu, 13 Dec 2018 09:39:05 +0000 (09:39 +0000)]
MFC r341624

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 agoMFC r341650:
Cy Schubert [Thu, 13 Dec 2018 03:12:15 +0000 (03:12 +0000)]
MFC r341650:

Remove an ugly Ultrix hack. Ultrix has been AWOL since the last ice
age, more to come.

5 years agoMFC: r340745, fix CU: output of the --debug-dump=decodedline.
Maxim Sobolev [Wed, 12 Dec 2018 16:25:30 +0000 (16:25 +0000)]
MFC: r340745, fix CU: output of the --debug-dump=decodedline.

5 years agoMFC r341587:
Hans Petter Selasky [Wed, 12 Dec 2018 13:17:49 +0000 (13:17 +0000)]
MFC r341587:
mlx4/mlx5: Updated driver version to 3.5.0

Sponsored by:   Mellanox Technologies

5 years agoMFC r341586:
Hans Petter Selasky [Wed, 12 Dec 2018 13:16:39 +0000 (13:16 +0000)]
MFC r341586:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341585:
Hans Petter Selasky [Wed, 12 Dec 2018 13:13:39 +0000 (13:13 +0000)]
MFC r341585:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341584:
Hans Petter Selasky [Wed, 12 Dec 2018 13:12:10 +0000 (13:12 +0000)]
MFC r341584:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341583:
Hans Petter Selasky [Wed, 12 Dec 2018 13:08:49 +0000 (13:08 +0000)]
MFC r341583:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341582:
Hans Petter Selasky [Wed, 12 Dec 2018 13:04:53 +0000 (13:04 +0000)]
MFC r341582:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341581:
Hans Petter Selasky [Wed, 12 Dec 2018 13:03:50 +0000 (13:03 +0000)]
MFC r341581:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341580:
Hans Petter Selasky [Wed, 12 Dec 2018 13:02:00 +0000 (13:02 +0000)]
MFC r341580:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341579:
Hans Petter Selasky [Wed, 12 Dec 2018 12:59:57 +0000 (12:59 +0000)]
MFC r341579:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341578 and r341655:
Hans Petter Selasky [Wed, 12 Dec 2018 12:57:55 +0000 (12:57 +0000)]
MFC r341578 and r341655:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341577:
Hans Petter Selasky [Wed, 12 Dec 2018 12:55:28 +0000 (12:55 +0000)]
MFC r341577:
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).

Sponsored by:   Mellanox Technologies

5 years agoMFC r341576:
Hans Petter Selasky [Wed, 12 Dec 2018 12:54:21 +0000 (12:54 +0000)]
MFC r341576:
mlx5fpga: Add set and query connect/disconnect FPGA

Submitted by:   kib@
Sponsored by:   Mellanox Technologies

5 years agoMFC r341575:
Hans Petter Selasky [Wed, 12 Dec 2018 12:53:23 +0000 (12:53 +0000)]
MFC r341575:
mlx5fpga: IOCTL for FPGA temperature measurement

Submitted by:   kib@
Sponsored by:   Mellanox Technologies

5 years agoMFC r341574:
Hans Petter Selasky [Wed, 12 Dec 2018 12:52:10 +0000 (12:52 +0000)]
MFC r341574:
mlx5fpga: Support MorseQ board

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

Submitted by:   kib@
Sponsored by:   Mellanox Technologies

5 years agoMFC r341573 and r341643:
Hans Petter Selasky [Wed, 12 Dec 2018 12:50:13 +0000 (12:50 +0000)]
MFC r341573 and r341643:
mlx5fpga_tools initial code import.

Submitted by:   kib@
Sponsored by:   Mellanox Technologies

5 years agoMFC r341572 and r341590:
Hans Petter Selasky [Wed, 12 Dec 2018 12:46:11 +0000 (12:46 +0000)]
MFC r341572 and r341590:
mlx5fpga: Initial code import.

Submitted by:   kib@
Sponsored by:   Mellanox Technologies

5 years agoMFC r341571:
Hans Petter Selasky [Wed, 12 Dec 2018 12:35:33 +0000 (12:35 +0000)]
MFC r341571:
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

Sponsored by:   Mellanox Technologies

5 years agoMFC r341570:
Hans Petter Selasky [Wed, 12 Dec 2018 12:34:30 +0000 (12:34 +0000)]
MFC r341570:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341569:
Hans Petter Selasky [Wed, 12 Dec 2018 12:33:12 +0000 (12:33 +0000)]
MFC r341569:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341568:
Hans Petter Selasky [Wed, 12 Dec 2018 12:31:57 +0000 (12:31 +0000)]
MFC r341568:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341567:
Hans Petter Selasky [Wed, 12 Dec 2018 12:30:47 +0000 (12:30 +0000)]
MFC r341567:
mlx5: Fix driver version location

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

Sponsored by:   Mellanox Technologies

5 years agoMFC r341566:
Hans Petter Selasky [Wed, 12 Dec 2018 12:29:22 +0000 (12:29 +0000)]
MFC r341566:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341565:
Hans Petter Selasky [Wed, 12 Dec 2018 12:28:16 +0000 (12:28 +0000)]
MFC r341565:
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

Sponsored by:   Mellanox Technologies

5 years agoMFC r341564:
Hans Petter Selasky [Wed, 12 Dec 2018 12:26:59 +0000 (12:26 +0000)]
MFC r341564:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341563:
Hans Petter Selasky [Wed, 12 Dec 2018 12:26:01 +0000 (12:26 +0000)]
MFC r341563:
mlx5: Implement support for configuring PCIe packet write ordering via a sysctl.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341562:
Hans Petter Selasky [Wed, 12 Dec 2018 12:25:00 +0000 (12:25 +0000)]
MFC r341562:
mlx5: Extend vector argument to u64.

Else the MLX5_TRIGGERED_CMD_COMP flag will be masked away.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341561:
Hans Petter Selasky [Wed, 12 Dec 2018 12:23:35 +0000 (12:23 +0000)]
MFC r341561:
mlx5: Add global control to disable firmware reset, for all mlx5 devices.

Submitted by:   kib@
Sponsored by:   Mellanox Technologies

5 years agoMFC r341560:
Hans Petter Selasky [Wed, 12 Dec 2018 12:22:28 +0000 (12:22 +0000)]
MFC r341560:
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().

Sponsored by:   Mellanox Technologies

5 years agoMFC r341559 and r341645:
Hans Petter Selasky [Wed, 12 Dec 2018 12:19:49 +0000 (12:19 +0000)]
MFC r341559 and r341645:
mlx5: Move hw.mlx5 node definition to mlx5_core.

Submitted by:   kib@
Sponsored by:   Mellanox Technologies

5 years agoMFC r341558:
Hans Petter Selasky [Wed, 12 Dec 2018 12:08:48 +0000 (12:08 +0000)]
MFC r341558:
mlx5: Convert some spaces into tabs and use device_printf() instead of printf().

Sponsored by:   Mellanox Technologies

5 years agoMFC r341557:
Hans Petter Selasky [Wed, 12 Dec 2018 12:07:21 +0000 (12:07 +0000)]
MFC r341557:
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

Sponsored by:   Mellanox Technologies

5 years agoMFC r341556:
Hans Petter Selasky [Wed, 12 Dec 2018 12:06:20 +0000 (12:06 +0000)]
MFC r341556:
mlx5: Fix for potential memory leaks.

Make sure allocated data gets freed in error cases.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341555:
Hans Petter Selasky [Wed, 12 Dec 2018 12:03:33 +0000 (12:03 +0000)]
MFC r341555:
mlx5: Discard unused return values.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341554:
Hans Petter Selasky [Wed, 12 Dec 2018 12:01:42 +0000 (12:01 +0000)]
MFC r341554:
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

Sponsored by:   Mellanox Technologies

5 years agoMFC r341553:
Hans Petter Selasky [Wed, 12 Dec 2018 12:00:34 +0000 (12:00 +0000)]
MFC r341553:
mlx5: Fix integer overflow while resizing CQ

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

Linux commit:
28e9091e3119933c38933cb8fc48d5618eb784c8

Sponsored by:   Mellanox Technologies

5 years agoMFC r341552:
Hans Petter Selasky [Wed, 12 Dec 2018 11:57:25 +0000 (11:57 +0000)]
MFC r341552:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341551:
Hans Petter Selasky [Wed, 12 Dec 2018 11:55:41 +0000 (11:55 +0000)]
MFC r341551:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341550:
Hans Petter Selasky [Wed, 12 Dec 2018 11:54:14 +0000 (11:54 +0000)]
MFC r341550:
mlx4en: Remove duplicate statistics variable assignment.

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

Sponsored by:   Mellanox Technologies

5 years agoMFC r341549:
Hans Petter Selasky [Wed, 12 Dec 2018 11:52:48 +0000 (11:52 +0000)]
MFC r341549:
mlx4en: Add support for receiving all data using one or more MCLBYTES sized mbufs.
Also when the MTU is greater than MCLBYTES.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341548:
Hans Petter Selasky [Wed, 12 Dec 2018 11:51:06 +0000 (11:51 +0000)]
MFC r341548:
mlx4en: Add support for netdump.

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

Differential Revision: https://reviews.freebsd.org/D15259
Sponsored by:   Mellanox Technologies

5 years agoMFC r341547:
Hans Petter Selasky [Wed, 12 Dec 2018 11:47:29 +0000 (11:47 +0000)]
MFC r341547:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341546:
Hans Petter Selasky [Wed, 12 Dec 2018 11:44:56 +0000 (11:44 +0000)]
MFC r341546:
mlx4en: Add driver version to sysctl desc

Sponsored by:   Mellanox Technologies

5 years agoMFC r341545:
Hans Petter Selasky [Wed, 12 Dec 2018 11:43:52 +0000 (11:43 +0000)]
MFC r341545:
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.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341544:
Hans Petter Selasky [Wed, 12 Dec 2018 11:42:21 +0000 (11:42 +0000)]
MFC r341544:
mlx4core: Add checks for invalid port numbers.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341543:
Hans Petter Selasky [Wed, 12 Dec 2018 11:41:28 +0000 (11:41 +0000)]
MFC r341543:
mlx4: Zero initialize device capabilities to avoid use of uninitialized fields.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341542:
Hans Petter Selasky [Wed, 12 Dec 2018 11:40:19 +0000 (11:40 +0000)]
MFC r341542:
mlx4core: Avoid multiplication overflow by casting multiplication.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341541:
Hans Petter Selasky [Wed, 12 Dec 2018 11:39:00 +0000 (11:39 +0000)]
MFC r341541:
opensm: Use precision specifier for scanf

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

Sponsored by:   Mellanox Technologies

5 years agoMFC r341540:
Hans Petter Selasky [Wed, 12 Dec 2018 11:37:43 +0000 (11:37 +0000)]
MFC r341540:
libibverbs: Fix memory leak in ibv_read_sysfs_file().

Testing packetdrill using valgrind resulted in finding a memory leak in
ibv_read_sysfs_file(). The attached patch fixes it.

Submitted by: tuexen@
Sponsored by:   Mellanox Technologies

5 years agoMFC r341539:
Hans Petter Selasky [Wed, 12 Dec 2018 11:35:36 +0000 (11:35 +0000)]
MFC r341539:
krping: Fix for memory leak in error case.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341538:
Hans Petter Selasky [Wed, 12 Dec 2018 11:33:50 +0000 (11:33 +0000)]
MFC r341538:
ipoib: Notify on modify QP failure only when relevant

Modify QP can fail and it can be acceptable, like when moving from RST to
ERR state, all the rest are not acceptable and a message to the log
should be printed.

The current code prints on all failures and many messages like:
"Failed to modify QP to ERROR state" appear, even when supported by the
state machine of the QP object.

Linux commit:
5dc78ad1904db597bdb4427f3ead437aae86f54c

Sponsored by:   Mellanox Technologies

5 years agoMFC r341537:
Hans Petter Selasky [Wed, 12 Dec 2018 11:32:31 +0000 (11:32 +0000)]
MFC r341537:
ipoib: increase the non-cm queue length

When a packet needs fragmentation, it might generate more than 3 fragments.
With the queue length 3, all fragments are generated faster than the
queue is drained, which effectively drops fourth and later fragments on
the floor.

Submitted by:   kib@
Sponsored by:   Mellanox Technologies

5 years agoMFC r341536:
Hans Petter Selasky [Wed, 12 Dec 2018 11:30:46 +0000 (11:30 +0000)]
MFC r341536:
ipoib: Don't do a light flush when MTU is unchanged.

When changing the MTU of ibX network interfaces, check that the MTU was really
changed before requesting an update of the multicast rules. Else we might go
into an infinite loop joining and leaving ibX multicast groups towards the
opensm master interface.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341535:
Hans Petter Selasky [Wed, 12 Dec 2018 11:17:15 +0000 (11:17 +0000)]
MFC r341535:
ipoib: correct setting MTU from inside ipoib(4).

It is not enough to set ifnet->if_mtu to change the interface MTU.
System saves the MTU for route in the radix tree, and route cache keeps
the interface MTU as well. Since addition of the multicast group causes
recalculation of MTU, even bringing the interface up changes MTU from
4042 to 1500, which makes the system configuration inconsistent. Worse,
ip_output() prefers route MTU over interface MTU, so large packets are
not fragmented and dropped on floor.

Fix it for ipoib(4) using the same approach (or hack) as was applied
for it_tun/if_tap in r339012.  Thanks to bz@ for giving the hint.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341534:
Hans Petter Selasky [Wed, 12 Dec 2018 11:15:12 +0000 (11:15 +0000)]
MFC r341534:
ibcore: Fix clearing of bound device interface.

Binding to a loopback device is not allowed. Make sure the destination
device address is global by clearing the bound device interface.
Only do this conditionally, else link local addresses won't work.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341533:
Hans Petter Selasky [Wed, 12 Dec 2018 11:02:48 +0000 (11:02 +0000)]
MFC r341533:
ibcore: ip6_dev_find() needs to know the scope ID.

Else the wrong network device can be returned for link-local addresses.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341532:
Hans Petter Selasky [Wed, 12 Dec 2018 11:00:36 +0000 (11:00 +0000)]
MFC r341532:
ibcore: Fix sleeping in atomic when RoCE is used

A couple of places in the CM do

    spin_lock_irq(&cm_id_priv->lock);
    ...
    if (cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg))

However when the underlying transport is RoCE, this leads to a sleeping function
being called with the lock held - the callchain is

    cm_alloc_response_msg() ->
      ib_create_ah_from_wc() ->
        ib_init_ah_from_wc() ->
          rdma_addr_find_l2_eth_by_grh() ->
            rdma_resolve_ip()

and rdma_resolve_ip() starts out by doing

    req = kzalloc(sizeof *req, GFP_KERNEL);

not to mention rdma_addr_find_l2_eth_by_grh() doing

    wait_for_completion(&ctx.comp);

to wait for the task that rdma_resolve_ip() queues up.

Fix this by moving the AH creation out of the lock.

Linux commit:
c76161181193985087cd716fdf69b5cb6cf9ee85

Sponsored by:   Mellanox Technologies

5 years agoMFC r341531:
Hans Petter Selasky [Wed, 12 Dec 2018 10:57:58 +0000 (10:57 +0000)]
MFC r341531:
ibcore: Add missing unref of netdevice.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341530:
Hans Petter Selasky [Wed, 12 Dec 2018 10:55:55 +0000 (10:55 +0000)]
MFC r341530:
ibcore: Fix loopback with rdma-cm.

Trying to validate loopback fails because rtalloc1() resolves system
local addresses to the loopback network interface, lo0. Fix this by
explicitly checking for loopback during validation of the source
and destination network address. If the source address belongs to
a local network interface and is equal to the destination address,
there is no need to run the destination address through rtalloc1().

Sponsored by:   Mellanox Technologies

5 years agoMFC r341529:
Hans Petter Selasky [Wed, 12 Dec 2018 10:49:41 +0000 (10:49 +0000)]
MFC r341529:
ibcore: Make sure all VNETs are scanned for VLAN interfaces.

The master network interface and the VLANs may reside in different VNETs.
Make sure that all VNETs are searched when scanning for GID entries.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341528:
Hans Petter Selasky [Wed, 12 Dec 2018 10:32:59 +0000 (10:32 +0000)]
MFC r341528:
ibcore: Always check return value from ib_init_ah_from_wc().

This prevents code from accepting RoCEv1 connections when
only ROCEv2 is enabled and vice versa.

Linux commit:
0c4386ec77cfcd0ccbdbe8c2e67dd3a49b2a4c7f

Sponsored by:   Mellanox Technologies

5 years agoMFC r341527:
Hans Petter Selasky [Wed, 12 Dec 2018 10:30:54 +0000 (10:30 +0000)]
MFC r341527:
ibcore: Add missing check for failure.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341526:
Hans Petter Selasky [Wed, 12 Dec 2018 10:28:50 +0000 (10:28 +0000)]
MFC r341526:
ibcore: Fix an array index check

The array ib_mad_mgmt_class_table.method_table has MAX_MGMT_CLASS
(80) elements. Hence compare the array index with that value instead
of with IB_MGMT_MAX_METHODS (128). This patch avoids that Coverity
reports the following:

Overrunning array class->method_table of 80 8-byte elements at element index 127
(byte offset 1016) using index convert_mgmt_class(mad_hdr->mgmt_class)
(which evaluates to 127).

Linux commit:
2fe2f378dd45847d2643638c07a7658822087836

Sponsored by:   Mellanox Technologies

5 years agoMFC r341525:
Hans Petter Selasky [Wed, 12 Dec 2018 10:25:55 +0000 (10:25 +0000)]
MFC r341525:
ibcore: Check ib_find_pkey() return value.

Linux commit:
d3a2418ee36a59bc02e9d454723f3175dcf4bfd9

Sponsored by:   Mellanox Technologies

5 years agoMFC r341524:
Hans Petter Selasky [Wed, 12 Dec 2018 10:23:49 +0000 (10:23 +0000)]
MFC r341524:
ibcore: Add support for IB_SPEED_HDR in sysfs rate printout.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341523:
Hans Petter Selasky [Wed, 12 Dec 2018 10:21:10 +0000 (10:21 +0000)]
MFC r341523:
ibcore: Don't access invalid port.

The port number in the listen_id_priv has been observed to be zero which
means no port has been selected. The current code lacks a check for invalid
port number.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341522:
Hans Petter Selasky [Wed, 12 Dec 2018 10:18:51 +0000 (10:18 +0000)]
MFC r341522:
ibcore: Discard unused error codes.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341521:
Hans Petter Selasky [Wed, 12 Dec 2018 10:16:35 +0000 (10:16 +0000)]
MFC r341521:
ibcore: Make sure GID index variable gets initialized.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341520:
Hans Petter Selasky [Wed, 12 Dec 2018 10:13:49 +0000 (10:13 +0000)]
MFC r341520:
linuxkpi: Really check if PCI is offline

Currently we always return false if for PCI offline query.
Try to read PCI config, if the return value if 0xffff probably the
PCI is offline.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341519:
Hans Petter Selasky [Wed, 12 Dec 2018 10:10:56 +0000 (10:10 +0000)]
MFC r341519:
linuxkpi: properly implement netif_carrier_ok().

Submitted by:   kib@
Sponsored by:   Mellanox Technologies

5 years agoMFC r341518:
Hans Petter Selasky [Wed, 12 Dec 2018 10:08:15 +0000 (10:08 +0000)]
MFC r341518:
linuxkpi: Fix for use-after-free when tearing down character devices.

Make sure we hold a reference on the character device for every opened file
to prevent the character device to be freed prematurely.

Sponsored by:   Mellanox Technologies

5 years agoMFC r341591:
Hans Petter Selasky [Wed, 12 Dec 2018 10:04:34 +0000 (10:04 +0000)]
MFC r341591:
Fix build of the atomic long LinuxKPI header file on some platforms.

Sponsored by: Mellanox Technologies

5 years agoMFC r341517 and r341592:
Hans Petter Selasky [Wed, 12 Dec 2018 10:00:09 +0000 (10:00 +0000)]
MFC r341517 and r341592:
linuxkpi: implement idr_is_empty() and ida_is_empty().

Submitted by:   kib@
Sponsored by:   Mellanox Technologies

5 years agoMFC r340360:
Andrey V. Elsukov [Wed, 12 Dec 2018 09:03:10 +0000 (09:03 +0000)]
MFC r340360:
  Add ability to use dynamic external prefix in ipfw_nptv6 module.

  Now an interface name can be specified for nptv6 instance instead of
  ext_prefix. The module will track if_addr_ext events and when suitable
  IPv6 address will be added to specified interface, it will be configured
  as external prefix. When address disappears instance becomes unusable,
  i.e. it doesn't match any packets.

  Reviewed by: 0mp (manpages)
  Tested by: Dries Michiels <driesm dot michiels gmail com>
  Differential Revision: https://reviews.freebsd.org/D17765

5 years agoMFC r341469:
Andrey V. Elsukov [Wed, 12 Dec 2018 08:55:54 +0000 (08:55 +0000)]
MFC r341469:
  Add assertion to check that named object has correct type.

5 years agoMFC 340694: Enable evdev on ppc32
Niclas Zeising [Tue, 11 Dec 2018 21:01:38 +0000 (21:01 +0000)]
MFC 340694: Enable evdev on ppc32

Enable evdev on ppc32 as well, similar to what was done i386 and amd64 in
r340387 and ppc64 in r340632.

Evdev can be used by X and is used by wayland to handle input devices.

Approved by: jhibbits

5 years agoMFC 340632
Niclas Zeising [Tue, 11 Dec 2018 20:56:05 +0000 (20:56 +0000)]
MFC 340632

Enable evdev on ppc64

Enable evdev on ppc64 as well, similar to what was done for amd64 and i386
in r340387.

Evdev can be used by X and is used by wayland to handle input devices.

Approved by: mmacy

5 years agoCall stable/12 -STABLE now that 12.0-RELEASE is out.
Glen Barber [Tue, 11 Dec 2018 19:12:44 +0000 (19:12 +0000)]
Call stable/12 -STABLE now that 12.0-RELEASE is out.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r341516, r341589
Vincenzo Maffione [Tue, 11 Dec 2018 11:31:13 +0000 (11:31 +0000)]
MFC r341516, r341589

netmap: align codebase to the current upstream (760279cfb2730a585)

Changelist:
  - Replace netmap passthrough host support with a more general
    mechanism to call TXSYNC/RXSYNC from an in-kernel event-loop.
    No kernel threads are used to use this feature: the application
    is required to spawn a thread (or a process) and issue a
    SYNC_KLOOP_START (NIOCCTRL) command in the thread body. The
    kernel loop is executed by the ioctl implementation, which returns
    to userspace only when a different thread calls SYNC_KLOOP_STOP
    or the netmap file descriptor is closed.
  - Update the if_ptnet driver to cope with the new data structures,
    and prune all the obsolete ptnetmap code.
  - Add support for "null" netmap ports, useful to allocate netmap_if,
    netmap_ring and netmap buffers to be used by specialized applications
    (e.g. hypervisors). TXSYNC/RXSYNC on these ports have no effect.
  - Various fixes and code refactoring.

Sponsored by: Sunny Valley Networks
Differential Revision: https://reviews.freebsd.org/D18015

5 years agoAs part of the general cleanup of the ipfilter code, special cases
Cy Schubert [Tue, 11 Dec 2018 01:49:06 +0000 (01:49 +0000)]
As part of the general cleanup of the ipfilter code, special cases
are committed separately to document fixing them separately from
the general cleanup. In this case we don't want to hide the utter
brokenness of what is being fixed.

Clean up a discombobulated block of #if's, with one block unreachable.
ip_fil.c is used in ipftest which is used to dry-run test ipfilter
rules in userspace without loading them in the kernel. The call to
(*ifp->if_output) matches that in the FreeBSD kernel.

Further testing and work will be required to make ipftest fully
functional.

5 years agoMFC r340322-r340324,r340327: periodic/etc/weekly/340.noid
Eugene Grosbein [Mon, 10 Dec 2018 14:19:57 +0000 (14:19 +0000)]
MFC r340322-r340324,r340327: periodic/etc/weekly/340.noid

Prevent periodic/etc/weekly/340.noid from descending into root directories
of jails. Jails have their own user/group databases and this script
can produce multiple false warnings, not to mention significant extra
load in case of large jailed subtrees. Leave this check for jailed
invocations of the same script.

5 years agoMFC r340321: Move definition of $jail_conf variable to /etc/defaults/rc.conf
Eugene Grosbein [Mon, 10 Dec 2018 14:09:15 +0000 (14:09 +0000)]
MFC r340321: Move definition of $jail_conf variable to /etc/defaults/rc.conf
from jail startup script so it can be successfully queried
with the command "sysrc jail_conf".

5 years agoMFC r340319: jail(8): introduce new command option -e to exhibit
Eugene Grosbein [Mon, 10 Dec 2018 13:41:28 +0000 (13:41 +0000)]
MFC r340319: jail(8): introduce new command option -e to exhibit
a list of configured non-wildcard jails with their parameters,
no matter running or not.

The option -e takes separator argument that is used
to separate printed parameters. It will be used with following
additions to system periodic scripts to differentiate parts
of directory tree belonging jails as opposed to host's.

5 years agoMFC r341448:
Konstantin Belousov [Mon, 10 Dec 2018 01:03:16 +0000 (01:03 +0000)]
MFC r341448:
Print type designator 'D' for the KF_TYPE_DEV files.

5 years agoMFC r341447:
Konstantin Belousov [Mon, 10 Dec 2018 01:01:43 +0000 (01:01 +0000)]
MFC r341447:
Improve procstat reporting for the linux cdev file descriptors.

5 years agoMFC r341439:
Konstantin Belousov [Mon, 10 Dec 2018 00:56:07 +0000 (00:56 +0000)]
MFC r341439:
Provide naive but self-contained implementations of memset(3) and
bzero(3) for rtld.

5 years agoMFC r341441:
Konstantin Belousov [Mon, 10 Dec 2018 00:54:18 +0000 (00:54 +0000)]
MFC r341441:
Some fixes for LD_BIND_NOW + ifuncs.

5 years agoMFC r341164: sh: Fix ${param?} default error message
Jilles Tjoelker [Sun, 9 Dec 2018 19:14:21 +0000 (19:14 +0000)]
MFC r341164: sh: Fix ${param?} default error message

If word in ${param?word} is missing, the shell shall write a default error
message. So expanding ${param?} when param is not set should write an error
message like

sh: param: parameter not set

This was broken by r316417.

PR: 233585

5 years agoMFC r340211:
Marcelo Araujo [Sun, 9 Dec 2018 06:48:44 +0000 (06:48 +0000)]
MFC r340211:

Comestic change to try to inline the memset with SSE/AVX instructions.
Also switch from int to size_t to keep portability.

Reviewed by: brooks
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D17795

5 years agoMFC r341393:
Michal Meloun [Sun, 9 Dec 2018 06:46:53 +0000 (06:46 +0000)]
MFC r341393:

  Return computed real memory size, not a value from similarly named global
  variable.

5 years agoMFC r340046, r340050
Marcelo Araujo [Sun, 9 Dec 2018 06:41:57 +0000 (06:41 +0000)]
MFC r340046, r340050

r340046:
Add support ps/2 scancodes for NumLock, ScrollLock and numerical keypad
keys.

PR: 213835
Submitted by: Vasily Postnicov <ivan.zhmudo@gmail.com>
Relnotes: Yes
Sponsored by: iXsystems Inc.

r340050:
Remove printf for debug purpose forgotten on r340046.

Reported by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>