Commit graph

13 commits

Author SHA1 Message Date
vmaffione
b2aae03b53 MFC r365061
iflib: leave only 1 receive descriptor unused

The pidx argument of isc_rxd_flush() indicates which is the last valid
receive descriptor to be used by the NIC. However, current code has
multiple issues:
  - Intel drivers write pidx to their RDT register, which means that
    NICs will only use the descriptors up to pidx-1 (modulo ring size N),
    and won't actually use the one pointed by pidx. This does not break
    reception, but it is anyway confusing and suboptimal (the NIC will
    actually see only N-2 descriptors as available, rather than N-1).
    Other drivers (if_vmx, if_bnxt, if_mgb) adhere to this semantic.
  - The semantic used by Intel (RDT is one descriptor past the last
    valid one) is used by most (if not all) NICs, and it is also used
    on the TX side (also in iflib). Since iflib is not currently
    using this semantic for RX, it must decrement fl->ifl_pidx
    (modulo N) before calling isc_rxd_flush(), and then the
    per-driver callback implementation must increment the index
    again (to match the real semantic). This is confusing and suboptimal.
  - The iflib refill function is also called at initialization.
    However, in case the ring size is smaller than 128 (e.g. if_mgb),
    the refill function will actually prepare all the receive
    descriptors (N), without leaving one unused, as most of NICs assume
    (e.g. to avoid RDT to overrun RDH). I can speculate that the code
    looks like this right now because this issue showed up during
    testing (e.g. with if_mgb), and it was easy to workaround by
    decrementing pidx before isc_rxd_flush().

The goal of this change is to simplify the code (removing a bunch
of instructions from the RX fast path), and to make the semantic of
isc_rxd_flush() consistent across drivers. To achieve this, we:
  - change the semantics of the pidx argument to the usual one (that
    is the index one past the last valid one), so that both iflib and
    drivers avoid the decrement/increment dance.
  - fix the initialization code to prepare at most N-1 descriptors.

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D26191
2020-11-17 15:03:10 +01:00
markj
0773a3e477 MFC r358996 (by pkelsey):
Fix iflib zero-length fragment handling

MFC r358997 (by pkelsey):
Remove freelist contiguous-indexes assertion from rxd_frag_to_sd()

MFC r358998 (by pkelsey):
Allow iflib drivers to specify the buffer size used for each receive queue

MFC r358999 (by pkelsey):
Remove refill budget from iflib

MFC r359000 (by pkelsey):
Fix if_vmx receive checksum offload bug and harden against the device
skipping receive descriptors

MFC r359001 (by pkelsey):
Adjust if_vmx default receive parameters for better out-of-box performance

MFC r359002 (by pkelsey):
Remove extraneous code from iflib

MFC r359029 (by pkelsey):
Restore power-of-2 queue count constraint from r290948

Tested by:	marcus, mav
2020-11-17 15:02:21 +01:00
gordon
95d5b91a97 Fix vmx driver packet loss and degraded performance.
Approved by:	so
Security:	FreeBSD-EN-20:16.vmx
2020-08-06 16:16:58 +02:00
markj
9f0dbb43c8 MFS r353051:
Add IFLIB_SINGLE_IRQ_RX_ONLY.

PR:		239118
Approved by:	re (gjb)
2019-10-29 11:47:51 +01:00
Franco Fichtner
41ba6e29a8 src: clean-cut move to releng/12.1
Taken from: FreeBSD
Commit ref: 991ac913fd9
2019-09-25 16:17:31 +02:00
vmaffione
f2eb6a63bc vmx(4): add native netmap support
This change adds native netmap support for the vmx(4) adapter
(vmxnet3). Native support comes for free in 12, since the driver has been
ported to iflib. To make it minimally intrusive, the native support is
only enabled if vmxnet3.netmap_native is set at boot (e.g., in loader.conf).

Tested on stable/11 running inside vmplayer.

Submitted by:	Giuseppe Lettieri <g.lettieri@iet.unipi.it>
Reviewed by:	vmaffione, bryanv
Sponsored by:	Sunny Valley Networks
Differential Revision:	https://reviews.freebsd.org/D19104
2019-03-10 08:43:27 +01:00
Franco Fichtner
0dc4b34cbd src: switch to release/11.2.0
Taken from: FreeBSD commit 62a489e1688b21b7cbdab9ffdb449a67bacc770c
2018-10-07 14:26:34 +02:00
Franco Fichtner
3c09b4c3de src: clean-cut move to release/11.1.0
Taken from: FreeBSD
Commit ref: 2f4b735c66d
2017-08-20 13:44:58 +02:00
Franco Fichtner
eb99233983 src: clean-cut move to release/11.0.0
Taken from: FreeBSD
Commit ref: d508cb8c8f
2016-10-03 12:28:21 +02:00
Franco Fichtner
51aeb3f459 src: clean-cut move to release/10.3.0
Taken from: FreeBSD
Commit ref: b62280e683e2
2016-05-21 08:25:57 +02:00
Franco Fichtner
cd6ee62847 src: clean-cut move to 10.2-RELEASE
Start fresh on master, only apply needed patches on top now.

Upstream commit:	56279fdef34eb28a4655b489b992c651bd8379fc
Taken from:		FreeBSD
2015-08-14 14:15:00 +02:00
Franco Fichtner
87f480af48 *: upgrade to 10.1 as a bulk commit
Taken from: freebsd.git@29f4af53a2c8248b634f48923da8eb35f5ed0515
2015-02-10 19:21:02 +01:00
Franco Fichtner
402e7dde73 src: initial commit based on FreeBSD-10.0
Taken from:	https://github.com/freebsd/freebsd.git
Commit id:	d44ce30d3054a38723f89a161c5e003e64d1aaae
2014-11-09 09:30:14 +01:00