Change EM_MULTIQUEUE to a real kernconf entry and enable support for

up to 2 rx/tx queues for the 82574.

Program the 82574 to enable 5 msix vectors, assign 1 to each rx queue,
1 to each tx queue and 1 to the link handler.

Inspired by DragonFlyBSD, enable some RSS logic for handling tx queue
handling/processing.

Move multiqueue handler functions so that they line up better in a diff
review to if_igb.c

Always enqueue tx work to be done in em_mq_start, if unable to acquire
the TX lock, then this will be processed in the background later by the
taskqueue.  Remove mbuf argument from em_start_mq_locked() as the work
is always enqueued.  (stolen from igb)

Setup TARC, TXDCTL and RXDCTL registers for better performance and stability
in multiqueue and singlequeue implementations. Handle Intel errata  3 and
generic multiqueue behavior with the initialization of TARC(0) and TARC(1)

Bind interrupt threads to cpus in order.  (stolen from igb)

Add 2 new DDB functions, one to display the queue(s) and their settings and
one to reset the adapter.  Primarily used for debugging.

In the multiqueue configuration, bump RXD and TXD ring size to max for the
adapter (4096).  Setup an RDTR of 64 and an RADV of 128 in multiqueue configuration
to cut down on the number of interrupts.  RADV was arbitrarily set to 2x RDTR
and can be adjusted as needed.

Cleanup the display in top a bit to make it clearer where the taskqueue threads
are running and what they should be doing.

Ensure that both queues are processed by em_local_timer() by writing them both
to the IMS register to generate soft interrupts.

Ensure that an soft interrupt is generated when em_msix_link() is run so that
any races between assertion of the link/status interrupt and a rx/tx interrupt
are handled.

Document existing tuneables: hw.em.eee_setting, hw.em.msix, hw.em.smart_pwr_down, hw.em.sbp

Document use of hw.em.num_queues and the new kernel option EM_MULTIQUEUE

Thanks to Intel for their continued support of FreeBSD.

Reviewed by:	erj jfv hiren gnn wblock
Obtained from:	Intel Corporation
MFC after:	2 weeks
Relnotes:	Yes
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D1994
This commit is contained in:
Sean Bruno 2015-06-03 18:01:09 +00:00
parent 285c9f5c02
commit 23c9098b2a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=283959
8 changed files with 517 additions and 197 deletions

View File

@ -45,6 +45,14 @@ kernel configuration file:
.Cd "device em"
.Ed
.Pp
Optional multiqueue support is available via the following kernel
compile options:
.Bd -ragged -offset indent
.Cd "options EM_MULTIQUEUE"
.Ed
.Pp
Note: Activating EM_MULTIQUEUE support is not supported by Intel.
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
.Xr loader.conf 5 :
@ -197,6 +205,18 @@ Tunables can be set at the
prompt before booting the kernel or stored in
.Xr loader.conf 5 .
.Bl -tag -width indent
.It Va hw.em.eee_setting
Disable or enable Energy Efficient Ethernet.
Default 1 (disabled).
.It Va hw.em.msix
Enable or disable MSI-X style interrupts.
Default 1 (enabled).
.It Va hw.em.smart_pwr_down
Enable or disable smart power down features on newer adapters.
Default 0 (disabled).
.It Va hw.em.sbp
Show bad packets when in promiscuous mode.
Default 0 (off).
.It Va hw.em.rxd
Number of receive descriptors allocated by the driver.
The default value is 1024 for adapters newer than 82547,
@ -228,6 +248,11 @@ If
.Va hw.em.tx_int_delay
is non-zero, this tunable limits the maximum delay in which a transmit
interrupt is generated.
.It Va hw.em.num_queues
Number of hardware queues that will be configured on this adapter (maximum of 2)
Defaults to 1.
Only valid with kernel configuration
.Cd "options EM_MULTIQUEUE".
.El
.Sh FILES
.Bl -tag -width /dev/led/em*
@ -287,3 +312,5 @@ You can enable it on an
.Nm
interface using
.Xr ifconfig 8 .
.Pp
Activating EM_MULTIQUEUE support requires MSI-X features.

View File

@ -2980,6 +2980,9 @@ options RANDOM_DEBUG # Debugging messages
# Module to enable execution of application via emulators like QEMU
options IMAGACT_BINMISC
# Intel em(4) driver
options EM_MULTIQUEUE # Activate multiqueue features/disable MSI-X
# zlib I/O stream support
# This enables support for compressed core dumps.
options GZIO

View File

@ -940,3 +940,6 @@ RCTL opt_global.h
RANDOM_YARROW opt_random.h
RANDOM_FORTUNA opt_random.h
RANDOM_DEBUG opt_random.h
# Intel em(4) driver
EM_MULTIQUEUE opt_em.h

View File

@ -158,10 +158,12 @@
E1000_RXDEXT_STATERR_CXE | \
E1000_RXDEXT_STATERR_RXE)
#define E1000_MRQC_RSS_ENABLE_2Q 0x00000001
#define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000
#define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000
#define E1000_MRQC_RSS_FIELD_IPV4 0x00020000
#define E1000_MRQC_RSS_FIELD_IPV6_TCP_EX 0x00040000
#define E1000_MRQC_RSS_FIELD_IPV6_EX 0x00080000
#define E1000_MRQC_RSS_FIELD_IPV6 0x00100000
#define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00200000

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,11 @@
*/
#define EM_MIN_TXD 80
#define EM_MAX_TXD 4096
#ifdef EM_MULTIQUEUE
#define EM_DEFAULT_TXD 4096
#else
#define EM_DEFAULT_TXD 1024
#endif
/*
* EM_RXD - Maximum number of receive Descriptors
@ -70,7 +74,11 @@
*/
#define EM_MIN_RXD 80
#define EM_MAX_RXD 4096
#ifdef EM_MULTIQUEUE
#define EM_DEFAULT_RXD 4096
#else
#define EM_DEFAULT_RXD 1024
#endif
/*
* EM_TIDV - Transmit Interrupt Delay Value
@ -117,7 +125,11 @@
* restoring the network connection. To eliminate the potential
* for the hang ensure that EM_RDTR is set to 0.
*/
#ifdef EM_MULTIQUEUE
#define EM_RDTR 64
#else
#define EM_RDTR 0
#endif
/*
* Receive Interrupt Absolute Delay Timer (Not valid for 82542/82543/82544)
@ -130,7 +142,11 @@
* along with EM_RDTR, may improve traffic throughput in specific network
* conditions.
*/
#ifdef EM_MULTIQUEUE
#define EM_RADV 128
#else
#define EM_RADV 64
#endif
/*
* This parameter controls the max duration of transmit watchdog.
@ -209,7 +225,15 @@
*/
#define EM_DBA_ALIGN 128
#define SPEED_MODE_BIT (1<<21) /* On PCI-E MACs only */
/*
* See Intel 82574 Driver Programming Interface Manual, Section 10.2.6.9
*/
#define TARC_COMPENSATION_MODE (1 << 7) /* Compensation Mode */
#define TARC_SPEED_MODE_BIT (1 << 21) /* On PCI-E MACs only */
#define TARC_MQ_FIX (1 << 23) | \
(1 << 24) | \
(1 << 25) /* Handle errata in MQ mode */
#define TARC_ERRATA_BIT (1 << 26) /* Note from errata on 82574 */
/* PCI Config defines */
#define EM_BAR_TYPE(v) ((v) & EM_BAR_TYPE_MASK)
@ -259,6 +283,14 @@
* solve it just using this define.
*/
#define EM_EIAC 0x000DC
/*
* 82574 only reports 3 MSI-X vectors by default;
* defines assisting with making it report 5 are
* located here.
*/
#define EM_NVM_PCIE_CTRL 0x1B
#define EM_NVM_MSIX_N_MASK (0x7 << EM_NVM_MSIX_N_SHIFT)
#define EM_NVM_MSIX_N_SHIFT 7
/*
* Bus dma allocation structure used by
@ -391,7 +423,7 @@ struct adapter {
eventhandler_tag vlan_detach;
u16 num_vlans;
u16 num_queues;
u8 num_queues;
/*
* Transmit rings:

View File

@ -70,7 +70,7 @@ em_netmap_unblock_tasks(struct adapter *adapter)
struct rx_ring *rxr = adapter->rx_rings;
int i;
for (i = 0; i < adapter->num_queues; i++) {
for (i = 0; i < adapter->num_queues; i++, txr++, rxr++) {
taskqueue_unblock(txr->tq);
taskqueue_unblock(rxr->tq);
}

View File

@ -2,7 +2,7 @@
.PATH: ${.CURDIR}/../../dev/e1000
KMOD = if_em
SRCS = device_if.h bus_if.h pci_if.h opt_inet.h opt_inet6.h
SRCS = device_if.h bus_if.h pci_if.h opt_ddb.h opt_inet.h opt_inet6.h
SRCS += $(CORE_SRC) $(LEGACY_SRC)
SRCS += $(COMMON_SHARED) $(LEGACY_SHARED) $(PCIE_SHARED)
CORE_SRC = if_em.c e1000_osdep.c