Commit Graph

736 Commits

Author SHA1 Message Date
Andrew Rybchenko
b14569a458 sfxge(4): clarify port mode names and masks
New port mode names are defined for Medford2 and later, and
the existing names are aliased to them. Add comments with the
numeric port mode to clarify the external port modes table.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18199
2018-11-28 09:23:05 +00:00
Andrew Rybchenko
2222409ba1 sfxge(4): support Medford2 event timer semantics
The event timer interface has changed for Medford2 - for
details see bug66418 comment 9. Update the common code to
use the new timer semantics for Medford2.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18198
2018-11-28 09:22:53 +00:00
Andrew Rybchenko
ffde74241a sfxge(4): support FEC mode settings
Medford2 controllers support control and reporting of
FEC modes for 25G and higher links. See SF-109306-TC
for suggested usage in client code.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18197
2018-11-28 09:22:42 +00:00
Andrew Rybchenko
e4c4abb28f sfxge(4): remove obsolete comments
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18196
2018-11-28 06:56:34 +00:00
Andrew Rybchenko
76ecd4a37b sfxge(4): move VI window size config to ef10 NIC board
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18195
2018-11-28 06:56:22 +00:00
Andrew Rybchenko
26fcca572d sfxge(4): move privilege config to ef10 NIC board config
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18194
2018-11-28 06:56:11 +00:00
Andrew Rybchenko
61e0c16d1c sfxge(4): move vector config to ef10 NIC board config
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18193
2018-11-28 06:55:59 +00:00
Andrew Rybchenko
ff8ff86654 sfxge(4): move limits config to ef10 NIC board config
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18192
2018-11-28 06:55:47 +00:00
Andrew Rybchenko
40f5e54c62 sfxge(4): move Tx config to ef10 NIC board config
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18191
2018-11-28 06:55:36 +00:00
Andrew Rybchenko
69aff9bb81 sfxge(4): move Rx config to ef10 NIC board config
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18190
2018-11-28 06:55:24 +00:00
Andrew Rybchenko
deeaf87ffb sfxge(4): move datapath config to ef10 NIC board cfg
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18189
2018-11-28 06:55:12 +00:00
Andrew Rybchenko
e5f6f32f25 sfxge(4): move PHY/link config to ef10 NIC board cfg
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18188
2018-11-28 06:55:00 +00:00
Andrew Rybchenko
233c1e5e89 sfxge(4): move legacy board config to ef10 NIC board cfg
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18187
2018-11-28 06:54:49 +00:00
Andrew Rybchenko
d36ea92c49 sfxge(4): move MAC address config to ef10 NIC board cfg
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18186
2018-11-28 06:54:37 +00:00
Andrew Rybchenko
17f272e7a7 sfxge(4): move PF/VF config to ef10 NIC board config
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18185
2018-11-28 06:54:25 +00:00
Andrew Rybchenko
09eac95749 sfxge(4): move port config to ef10 NIC board config
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18184
2018-11-28 06:54:13 +00:00
Andrew Rybchenko
daf72d82e0 sfxge(4): pacify false positive warning
The warning says that it may be usage of possibly uninitialized value.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18183
2018-11-28 06:54:02 +00:00
Andrew Rybchenko
481943395d sfxge(4): add ef10 NIC board config method
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18182
2018-11-28 06:53:51 +00:00
Andrew Rybchenko
8bff5a20fb sfxge(4): use correct name for frame truncation event
The RX_ECC_ERR flag in RX events was misnamed, as it
reported frame truncation. Use the new RX_TRUNC_ERR
name for this flag.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18181
2018-11-28 06:53:40 +00:00
Andrew Rybchenko
9361c4ad4e sfxge(4): remove MAC stats size define
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18180
2018-11-27 14:16:14 +00:00
Andrew Rybchenko
a98c7b04ae sfxge(4): resolve code analysis warnings
Minimal changes adding buffer size checks and simplifying checksum
processing.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18179
2018-11-27 14:16:03 +00:00
Andrew Rybchenko
747819d260 sfxge(4): decode Medford2 FEC stats if available
Decode Medford2 FEC stats if available in MAC stats DMA buffer.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18178
2018-11-27 14:15:52 +00:00
Andrew Rybchenko
79300430e3 sfxge(4): run mkconfig.py to add FEC MAC stats
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18177
2018-11-27 14:15:41 +00:00
Andrew Rybchenko
fdfd8bfee9 sfxge(4): use MAC stats DMA buffer size when decoding
On Medford2 and later the MAC stats buffer has been enlarged.
Use the MAC stats DMA buffer size to ensure that the stats END
generation count is read from the correct location, and that
over-reading of the DMA buffer is prevented.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18176
2018-11-27 14:15:30 +00:00
Andrew Rybchenko
6c54b7b61f sfxge(4): use MAC stats DMA buffer size from caps
For Medford2 the DMA buffer used for one-shot or periodic MAC stats
has been extended. Ensure the MAC stats DMA buffer size is large
enough to hold the number of stats counters supported by firmware.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18175
2018-11-27 14:15:19 +00:00
Andrew Rybchenko
670be9dddf sfxge(4): improve robustness of MAC stats get via MCDI
Previously the code relied on the callers of efx_mcdi_mac_stats
to provide a DMA buffer or NULL depending on the action. Fix
this so that the DMA buffer is only passed in the request when
needed, and that an error is reported for a missing DMA buffer.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18174
2018-11-27 14:15:08 +00:00
Andrew Rybchenko
807145d9f6 sfxge(4): retrieve number of MAC stats from NIC
This reports the number of stats (and hence the DMA buffer size)
for MAC stats. If MC_GET_CAPABABILITIES_V4 is not supported then
use the legacy Siena-compatible MC_CMD_MAC_NSTATS value.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18173
2018-11-27 14:14:57 +00:00
Andrew Rybchenko
016941e371 sfxge(4): refactor EF10 get datapath capabilities
Inline efx_mcdi_get_capabilities() to prepare for reading
newer capabilities response versions.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18172
2018-11-27 14:14:45 +00:00
Andrew Rybchenko
f50efe9ac2 sfxge(4): handle new speeds in link events
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18170
2018-11-27 13:00:51 +00:00
Andrew Rybchenko
4aaefb9559 sfxge(4): add efsys macro to get memory region size
EFSYS_MEM_SIZE() reports the DMA mapped size of an efsys_mem_t
allocated region (the allocation size may be different due to
memory allocator and DMA alignment restrictions).

This ensures that common code internals have explicit knowledge
of the usable size of DMA mapped memory regions.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18170
2018-11-27 13:00:39 +00:00
Andrew Rybchenko
725bb178d3 sfxge(4): add new loopback modes
Report supported loopback modes for new Medford2 link speeds.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18169
2018-11-27 13:00:28 +00:00
Andrew Rybchenko
d81df2213e sfxge(4): support new link modes
Add basic support for new link modes for Medford2.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18168
2018-11-27 13:00:17 +00:00
Andrew Rybchenko
e5be75536a sfxge(4): removing unneeded assert
Remove ASSERT() from sfxge_link_mode_to_phy_cap() which causes an
unnecessary panic, even though the callers have proper error handling.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18167
2018-11-27 13:00:06 +00:00
Andrew Rybchenko
4add9918a6 sfxge(4): simplify loopback type checking
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18166
2018-11-27 12:59:55 +00:00
Andrew Rybchenko
36641d2b9d sfxge(4): report memory BAR number
Remove EFX_MEM_BAR define as it it is not correct on all platforms.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18165
2018-11-27 12:59:43 +00:00
Andrew Rybchenko
1c057dc083 sfxge(4): update notes on interrupt testing on VFs
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18164
2018-11-27 12:59:32 +00:00
Andrew Rybchenko
b1fc8575b5 sfxge(4): fix ICC warning because of non-enum value usage
Fix ICC warning because of non-enum value asignment to enum variable.

Found by upstreaming to DPDK.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18163
2018-11-27 12:59:21 +00:00
Andrew Rybchenko
b20c54ffe6 sfxge(4): refactoring eliminating code analysis warnings
Addresses most of the warnings reported by the sfn windows driver.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18162
2018-11-27 12:59:09 +00:00
Andrew Rybchenko
f2f1499740 sfxge(4): update hardware headers for Medford2
The changes to efx_regs_ef10.h are auto-generated and include:

 - Updated event RX_L4_CLASS which is now 2 bits (was 3).
   The encoding of TCP, UDP and UNKNOWN are unchanged so
   the narrower Medford2 field definition is compatible with
   all controllers.

 - Fix definition of FATSOv2 option descriptors. These were
   added manually and differ from the auto-generated values
   in some fields (not yet used in common code). The field
   definitions have been corrected to agree with the Linux net
   driver headers and SF-108452-SW.

The remaining changes adapt the common code to use the updated
headers.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18161
2018-11-27 12:58:52 +00:00
Andrew Rybchenko
4effeb9e7b sfxge(4): add method to make checksum option descriptors
Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18160
2018-11-27 12:23:01 +00:00
Andrew Rybchenko
8da3f86b16 sfxge(4): improve comments for EF10 ext port mapping
Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18159
2018-11-27 12:22:50 +00:00
Andrew Rybchenko
c63c836960 sfxge(4): support runtime VI window size
Medford2 uses a configurable VI window size, and requires
updates to register accesses to use a runtime VI window size
rather than the *_STEP register constants used for earlier
controllers.

Update the common code to query the VI window size via MCDI,
and add new EFX_BAR_VI_* accessor macros for per-VI registers.

The existing EFX_BAR_TBL_* macros can be used for non-VI
register tables (and for code that can never be called for
a Medford2 controller e.g. Siena-only code).

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18158
2018-11-27 12:22:37 +00:00
Andrew Rybchenko
bbefcb4c11 sfxge(4): add Medford2 support to MON module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18157
2018-11-27 12:22:25 +00:00
Andrew Rybchenko
77226f8941 sfxge(4): add Medford2 support to VPD module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18156
2018-11-27 12:22:14 +00:00
Andrew Rybchenko
df0385e554 sfxge(4): add Medford2 support to BOOTCFG module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18155
2018-11-27 12:22:03 +00:00
Andrew Rybchenko
d5f7db3790 sfxge(4): add Medford2 support to SRAM module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18154
2018-11-27 12:21:53 +00:00
Andrew Rybchenko
824c97ed5c sfxge(4): add Medford2 support to NVRAM module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18153
2018-11-27 12:21:41 +00:00
Andrew Rybchenko
20c5aab398 sfxge(4): add Medford2 support to Tx module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18152
2018-11-27 12:21:30 +00:00
Andrew Rybchenko
34352ef8c3 sfxge(4): add Medford2 support to Rx module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18151
2018-11-27 12:21:19 +00:00
Andrew Rybchenko
10d4c14d98 sfxge(4): add Medford2 support to PHY module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18150
2018-11-27 12:21:08 +00:00
Andrew Rybchenko
eecf8d281f sfxge(4): add Medford2 support to MCDI module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18149
2018-11-27 12:20:57 +00:00
Andrew Rybchenko
cbc3f94f08 sfxge(4): add Medford2 support to MAC module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18148
2018-11-27 12:20:46 +00:00
Andrew Rybchenko
1bef83ea41 sfxge(4): add Medford2 support to INTR module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18147
2018-11-27 12:20:35 +00:00
Andrew Rybchenko
d6f0fbb15b sfxge(4): add Medford2 support to FILTER module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18146
2018-11-27 12:20:23 +00:00
Andrew Rybchenko
5095efd4f5 sfxge(4): add Medford2 support to EV module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18145
2018-11-27 12:20:12 +00:00
Andrew Rybchenko
45becd7603 sfxge(4): move RxDP config get to EF10 NIC code
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18144
2018-11-27 12:20:01 +00:00
Andrew Rybchenko
4f58306ca6 sfxge(4): correct PIO buffer dimensions for Medford2
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18143
2018-11-27 12:19:49 +00:00
Andrew Rybchenko
ae64ac9336 sfxge(4): add Medford2 support to NIC module
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18142
2018-11-27 12:14:16 +00:00
Andrew Rybchenko
553455ea93 sfxge(4): put Siena-specific code under its efsys option
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18141
2018-11-27 12:14:05 +00:00
Andrew Rybchenko
97ce60b7d6 sfxge(4): add efsys option for Medford2
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18140
2018-11-27 12:13:54 +00:00
Andrew Rybchenko
e995da72bb sfxge(4): add Medford2 PCI IDs
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18139
2018-11-27 12:13:39 +00:00
Andrew Rybchenko
acc84f29fe sfxge(4): add 3.3V and 12.0V current sensors
Automatically generated using mkconfig.py.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18138
2018-11-26 07:42:52 +00:00
Andrew Rybchenko
9ed106d0b4 sfxge(4): update autogenerated headers from firmwaresrc
Pick up Medford2 interfaces.

Split AOE operations out into own header.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18137
2018-11-26 07:23:02 +00:00
Andrew Rybchenko
208539a4f7 sfxge(4): regenerate files with genfwdef after ID update
Add security level to image boot header.

Submitted by:   Andrew Jackson <ajackson at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18289
2018-11-26 07:15:19 +00:00
Andrew Rybchenko
fdbe38cf9d sfxge(4): add API to control UDP tunnel ports
HW needs to know which UDP packets should be treated as tunnel
encapsulation to do inner packet recognition, classification and
offloads.

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18134
2018-11-26 06:20:13 +00:00
Andrew Rybchenko
4ed151b893 sfxge(4): allow to request inner classes for Rx packets
If HW/FW supports tunnel encapsulations, Rx event may contain
either inner or outer packet classes. By default outer classes
are requested. Make it possible to request inner classes to
have more information about packet type and allow to interpret
inner frame checksum validation results correctly.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18133
2018-11-24 18:13:34 +00:00
Andrew Rybchenko
074cfb5c75 sfxge(4): add function to create packed stream RxQ
Encoding packed stream buffer size in RxQ type is not a future-proof
idea taking into account a new RxQ types with extra parameters.
To be consistent make packet stream buffer size a separate parameter.
In order to avoid blowing of the default RxQ create function prototype
add a dedicated function to create packed stream RxQ without not
applicable paramters.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18132
2018-11-24 18:13:21 +00:00
Andrew Rybchenko
9445d1c5e0 sfxge(4): control RxQ scatter using flag instead of type
Rx scatter may be applicable to different Rx queue types.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18131
2018-11-24 18:13:07 +00:00
Andrew Rybchenko
687e45b163 sfxge(4): remove Falcon-specific concurrency check
Falcon support has been withdrawn from libefx, however, there is still
an obsolete Falcon-specific assertion that efx_mac_stats_upload()
and efx_port_poll() aren't concurrent. To be consistent with an overall
Falcon support revocation it's desirable to remove it.

Fix debug build invalid assertion failure.

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18130
2018-11-24 16:31:43 +00:00
Andrew Rybchenko
afd307d69c sfxge(4): move BIU test code into Siena-specific file
Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18129
2018-11-24 16:31:31 +00:00
Andrew Rybchenko
9a3efb216c sfxge(4): fix PreFAST static analysis warning (C6001)
Fix warning
"C6001: Using uninitialized memory '*sensor_maskp'"
which could occur when the npages argument to efx_mcdi_sensor_info()
is less than or equal to zero.

Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18128
2018-11-24 16:31:20 +00:00
Andrew Rybchenko
ee1d6deeeb sfxge(4): expand on comment on number of queues field
Expand on comment on RSS_CONTEXT_ALLOC_IN_NUM_QUEUES field.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18127
2018-11-24 16:31:08 +00:00
Andrew Rybchenko
3651ecc55b sfxge(4): remove obsolete check for pre-Siena hardware
The fail4 label was used twice, so it doesn't need removing.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18126
2018-11-24 16:30:57 +00:00
Andrew Rybchenko
c708002c5f sfxge(4): fix warnings from VS2015 C compiler (C4214)
Fix multiple level 4 warnings
"C4214: nonstandard extension used: bit field types other than int";
no functional changes.

Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18125
2018-11-24 16:30:46 +00:00
Andrew Rybchenko
7e17c17d9f sfxge(4): fix warnings from VS2015 C compiler (C4057)
Fix two level 4 warnings
"C4057: 'function': 'const uint8_t *' differs in indirection to
slightly different base types from 'caddr_t'"; no functional changes.

Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18124
2018-11-24 16:30:34 +00:00
Andrew Rybchenko
cc8d2b2393 sfxge(4): fix warnings from VS2015 C compiler (C4189)
Fix multiple level 4 warnings
"C4189: 'xxx': local variable is initialized but not referenced";
no functional changes.

Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18123
2018-11-24 16:30:22 +00:00
Andrew Rybchenko
bbea960434 sfxge(4): fix warnings from VS2015 C compiler (C4100)
Fix multiple level 4 warnings
"C4100: 'xxx': unreferenced formal parameter"
no functional changes.

The _NOTE(ARGUNUSED(xxx)) annotations are being exposed to the Visual
Studio 2015 C compiler with the following:

    #define _NOTE_ARGUNUSED(...) UNREFERENCED_PARAMETER((__VA_ARGS__));
    #define _NOTE(_annotation)   _NOTE_ ## _annotation

Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18122
2018-11-24 16:30:09 +00:00
Andrew Rybchenko
54bee5b4fd sfxge(4): fix warnings from VS2015 C compiler (C4245)
Fix level 4 warning
"C4245: 'initializing': conversion from 'int' to 'uint32_t',
signed/unsigned mismatch" warning; no functional changes.

Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18121
2018-11-24 16:29:58 +00:00
Andrew Rybchenko
5ef1830c5c sfxge(4): fix warnings from VS2015 C compiler (C4244)
Fix level 4 warning
"C4244: '+=': conversion from 'unsigned int' to 'uint16_t', possible loss
of data"; no functional changes.

Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18120
2018-11-24 16:29:46 +00:00
Andrew Rybchenko
5e7bb158cb sfxge(4): fix warnings from VS2015 C compiler (C4310)
Fix level 4 warning
"C4310: cast truncates constant value";
no functional changes.

Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18119
2018-11-24 16:29:35 +00:00
Andrew Rybchenko
79ddc22463 sfxge(4): fix probes in licensing support
EFSYS_PROBE1 takes one typed value (in addition to the probe name),
whereas EFSYS_PROBE has just the probe name.

Which to use is determined by the probe name - "fail1" probes are
expected to include the function result.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18118
2018-11-24 16:29:23 +00:00
Andrew Rybchenko
07542d7365 sfxge(4): fix diagnostics support build without Siena
The compilation failed because __efx_sram_pattern_fns was used in
efx_nic.c, but defined in efx_sram.c which is only needed when
supporting Siena.

To fix it move all the code using __efx_sram_pattern_fns into
Siena-specific files (except for the definition in efx_sram.c itself,
as that file only needs to be included in Siena-supporting builds
anyway).

The functions to test registers and tables are unlikely to apply to any
new hardware and so can be moved into Siena files. Since Huntington
such tests have been implemented in firmware.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18117
2018-11-24 16:29:11 +00:00
Andrew Rybchenko
a6f6c2f06d sfxge(4): allow to use PHY stats on Huntington/Medford
EFSYS_OPT_PHY_STATS can be used with Huntington or Medford, not just Siena.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18116
2018-11-24 16:28:58 +00:00
Andrew Rybchenko
95c45bd003 sfxge(4): fix coding style
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18115
2018-11-24 15:24:47 +00:00
Andrew Rybchenko
dda2b341f9 sfxge(4): remove unused defined for WPTR alignment
MEDFORD_RX_WPTR_ALIGN is not used.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18114
2018-11-24 15:24:35 +00:00
Andrew Rybchenko
17a2b32ade sfxge(4): support new sensors
Submitted by:   Andrew Jackson <ajackson at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18113
2018-11-24 15:24:23 +00:00
Andrew Rybchenko
df2215d5d2 sfxge(4): add new sensors
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18112
2018-11-24 15:24:12 +00:00
Andrew Rybchenko
2d99dff8ca sfxge(4): move Siena-specific defs to right header
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18111
2018-11-24 15:23:58 +00:00
Andrew Rybchenko
c68c424c14 sfxge(4): fix build issue with PHY LED control enabled
Fixed build issue with the EFSYS_OPT_PHY_LED_CONTROL for Huntigton and
Medford.

Submitted by:   Vijay Srivastava <vijays at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18110
2018-11-24 15:23:46 +00:00
Andrew Rybchenko
0c9ef1f52e sfxge(4): improve names for TXQ descriptor counts
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18109
2018-11-24 15:23:34 +00:00
Andrew Rybchenko
59ee8172c5 sfxge(4): improve names for RXQ descriptor counts
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18108
2018-11-24 15:23:22 +00:00
Andrew Rybchenko
6995308309 sfxge(4): improve names for EVQ descriptor counts
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18107
2018-11-24 15:23:09 +00:00
Andrew Rybchenko
ddef7d7980 sfxge(4): remove assertion on no longer used define
MC_CMD_INIT_RXQ_OUT_LEN is not used any more.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18106
2018-11-24 15:22:57 +00:00
Andrew Rybchenko
fbca55a51c sfxge(4): request info about outer frame in Rx events
For encapsulated packets, the firmware gives info about the inner frame
fields by default. When not using encapsulation offload, ask for info
about the outer frame instead.

On SFN8xxx with firmware version before v6.4.2.1007 driver reload is
needed after switching from full-feature to low-latency firmware
variant since the driver still thinks that firmware supports
encapsulation, but firmware does not tolerate request to provide info
about outer frame in Rx events.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18105
2018-11-23 16:18:36 +00:00
Andrew Rybchenko
9d89c911bb sfxge(4): ignore error in completion event on MCDIv2 HW
With MCDIv2, the reponse length can be to big to fit into the
CMDDONE_DATALEN field in the MCDI completion event. But rather that
the length being truncated, it can overflow into the CMDDONE_ERRNO
field (this is a longstanding firmware bug). Hence the CMDDONE_ERRNO
field may not be valid.

It isn't necessary to use the value in the CMDDONE_ERRNO field though,
so it can be ignored. The actual error code is already read from the
response header on MCDIv2 capable hardware and stored in emr_rc, so
that can be used instead.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18104
2018-11-23 15:59:49 +00:00
Andrew Rybchenko
641c3370f4 sfxge(4): use MCDIv2 for requests with too long response
Use MCDIv2 for requests with a response size too long for MCDIv1.

Required for MC_CMD_MAC_STATS to reports the stats without using DMA.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18103
2018-11-23 15:59:37 +00:00
Andrew Rybchenko
18b602f954 sfxge(4): support inner checksum offload on transmit
Inner checksum offloads may be used only if firmware supports
these tunnels.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18102
2018-11-23 13:12:04 +00:00
Andrew Rybchenko
ae346558f1 sfxge(4): make MAC naming consistent with other modules
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18101
2018-11-23 11:39:24 +00:00
Andrew Rybchenko
3caf31e90e sfxge(4): enforce packed stream fake buffer size
In the case of packed stream real size of the buffer does not fit in
Rx descriptor byte count. Real size is specified on Rx queue setup.
Non-zero fake should be used to bypass hardware checks.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18100
2018-11-23 11:39:13 +00:00
Andrew Rybchenko
5fb80fd41b sfxge(4): provide simple access to RxQ state in EvQ
Packed stream Rx datapath requires access to packed stream state
stored in event queue. Number of credits is upstead in event handler
on a new buffer, packets parsing on 64k boundary crossing and
Rx doorbell push to give credits back.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18099
2018-11-23 11:39:02 +00:00
Andrew Rybchenko
1aa1b495ed sfxge(4): improve RxQ label init prototype
RxQ type provides more information which may be useful to
setup event queue appropriately.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18098
2018-11-23 11:38:50 +00:00
Andrew Rybchenko
e50a6f3eb4 sfxge(4): support MUM/SUC firmware partitions
Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18097
2018-11-23 11:31:57 +00:00
Andrew Rybchenko
1b5bd0997a sfxge(4): fix ignoring function return value
fix PreFAST issue, add missing annotation that function return value
should not be ignored. Fix alignment.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18096
2018-11-23 11:31:45 +00:00
Andrew Rybchenko
e7144483bb sfxge(4): quieten get version methods
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18095
2018-11-23 10:22:01 +00:00
Andrew Rybchenko
0ab1d25fc4 sfxge(4): remove duplicate NVRAM asserts
The checking performed in the ->envo_type_to_partn
internal method make these assertions unnecessary.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18094
2018-11-23 10:21:50 +00:00
Andrew Rybchenko
ede1a3edaa sfxge(4): precheck and verify flash writes
Read existing flash content before writing, so the flash write can be
avoided if the existing partition content matches the new image. This
avoids unnecessary write cycles for the flash device, and may also be
faster. If the flash does need to be updated, verify the content after
writing.

Note that reading the flash content after writing but before calling
efx_nvram-rw_finish() avoids firmware bug68170, which can lead to
signed image updates failing on Medford.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18093
2018-11-23 10:21:36 +00:00
Andrew Rybchenko
6a869fec96 sfxge(4): fix check in NVRAM validate
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18092
2018-11-23 10:21:28 +00:00
Andrew Rybchenko
558eb6e7f1 sfxge(4): report correct partition write chunk size
If the firmware reports a non-zero write chunk size then nvram writes
may fail if a different granularity is used (e.g. for MUM firmware on
Sorrento).

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18091
2018-11-23 10:21:17 +00:00
Andrew Rybchenko
3d670ff531 sfxge(4): check NVRAM locking by partition ID
Tracking which partition is locked avoids being overly conservative
when EFX_NVRAM_xxx maps to more than one partition (depnding on the
current port number).

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18090
2018-11-23 10:21:06 +00:00
Andrew Rybchenko
8241ccd203 sfxge(4): simplify NVRAM type to partition mappings
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18089
2018-11-23 10:20:55 +00:00
Andrew Rybchenko
348d35299c sfxge(4): rename firmware update verify result cap field
The existing name confuses support for secure boot with
support for reporting a verify result after an NVRAM update.

As the capability only reports support for returning a verify
result, change the name to be less confusing.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18088
2018-11-23 10:20:44 +00:00
Andrew Rybchenko
d5106d0503 sfxge(4): extend NVRAM RW finish to return verify result
Extend efx_nvram_rw_finish() to return firmware verify result code.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18087
2018-11-23 10:20:32 +00:00
Andrew Rybchenko
a21b2f207d sfxge(4): report verify result from RW finish callback
This makes the verify result visible to efx_nvram_rw_finish(), which
can be extended to report it in a later patch.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18086
2018-11-23 10:20:20 +00:00
Andrew Rybchenko
f0d3455bf8 sfxge(4): simplify verify result handling
Simplify verify result handling in NVRAM update finish

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18085
2018-11-23 10:20:08 +00:00
Andrew Rybchenko
c703323657 sfxge(4): fix result code in MCDI NVRAM update finish
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18084
2018-11-23 10:19:57 +00:00
Andrew Rybchenko
4fe33ae862 sfxge(4): copy new header from firmware src
Submitted by:   Andrew Jackson <ajackson at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18083
2018-11-23 10:19:46 +00:00
Andrew Rybchenko
44d836f8d0 sfxge(4): add RSS key size define
Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18082
2018-11-23 09:16:07 +00:00
Andrew Rybchenko
e9038435e7 sfxge(4): add API to set an RSS context for a filter
Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18081
2018-11-23 09:15:56 +00:00
Andrew Rybchenko
82af879c05 sfxge(4): update RSS API to take RSS context parameter
Update efx_rx_scale_mode_set(), efx_rx_scale_key_set()
and efx_rx_scale_tbl_set().

Submitted by:   Mark Spender <mspender at solarflare.com>
Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18080
2018-11-23 09:15:44 +00:00
Andrew Rybchenko
e6d55a0b58 sfxge(4): add API to allocate and free RSS contexts
Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18079
2018-11-23 09:15:32 +00:00
Andrew Rybchenko
39023729c3 sfxge(4): rename API to check Rx scale and hash support
Rename efx_rx_scale_support_get() to efx_rx_scale_default_support_get(),
and efx_rx_hash_support_get() to efx_rx_hash_default_support_get().

All these really report is whether an exclusive RSS context was
successfully acquired at efx_rx_init().

efx_rx_scale_support_get() sounds like it reports whether the device
supports RSS, and whether exclusive or shared contexts are supported,
but it doesn't do that. Renaming it to
efx_rx_scale_default_support_get() helps to reflect that it reports
what RSS support the client gets without trying to allocate RSS
contexts itself.

Also rename efx_rx_scale_support_t to efx_rx_scale_context_type_t, to
make the enum more suitable for specifying the type of an RSS context
to be allocated.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18078
2018-11-23 09:15:20 +00:00
Andrew Rybchenko
7283cea3c5 sfxge(4): add the max number of RSS exclusive contexts
The patch adds enc_rx_scale_max_exclusive_contexts member
to nic_cfg_t structure and sets the corresponding values
for Siena, Huntington and Medford

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18077
2018-11-23 09:15:08 +00:00
Andrew Rybchenko
7ae12f5b45 sfxge(4): fix default RSS context check on Siena
Default RSS context check is carried out during filter
insertion on Siena and it needs to be fixed

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18076
2018-11-23 09:14:57 +00:00
Andrew Rybchenko
c09d2224f7 sfxge(4): define a handle to denote default RSS context
Make the existing filter-specific define more general.
This is the same as MC_CMD_RSS_CONTEXT_ALLOC_OUT_RSS_CONTEXT_ID_INVALID.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18075
2018-11-23 09:14:45 +00:00
Andrew Rybchenko
f4e2f6a5b3 sfxge(4): insert filters for encapsulated packets
On Medford, with full-featured firmware running, encapsulated
packets may not be delivered unless filters are inserted for
them, as ordinary filters are not applied to encapsulated
packets. So filters for encapsulated packets need to be
inserted for each class of encapsulated packet. For simplicity,
catch-all filters are always inserted. These may match more
packets than the OS has asked for, but trying to insert more
precise filters increases complexity for little gain.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18074
2018-11-23 09:03:32 +00:00
Andrew Rybchenko
127ef94733 sfxge(4): support filters for encapsulated packets
This supports filters which match all unicast or multicast
inner frames in VXLAN, GENEVE, or NVGRE packets.
(Additional fields to match on can be added easily.)

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18073
2018-11-23 09:03:20 +00:00
Andrew Rybchenko
540c7dd5d9 sfxge(4): use proper MCDI command for encap filters
MC_CMD_FILTER_OP_IN_EXT is needed to set filters for encapsulated
packets.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18072
2018-11-23 09:03:09 +00:00
Andrew Rybchenko
799fadbeb5 sfxge(4): provide information about supported tunnels
VXLAN/NVGRE (and Geneve) support is available on SFN8xxx with
full-feature firmware variant running.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18071
2018-11-23 09:02:58 +00:00
Andrew Rybchenko
7e1059e821 sfxge(4): let caller know that queue is already flushed
Tx/Rx queue may be already flushed due to Tx/Rx error on the queue or
MC reboot. Caller needs to know that the queue is already flushed to
avoid waiting for flush done event.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18070
2018-11-23 07:50:56 +00:00
Andrew Rybchenko
73b39f6834 sfxge(4): fix error code usage
MCDI results returned in req.emr_rc have already been translated
from MC_CMD_ERR_* to errno names, so using an MC_CMD_ERR_* value
is incorrect.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18069
2018-11-23 07:50:45 +00:00
Andrew Rybchenko
454502b9f1 sfxge(4): fix out of bounds read in VIs allocation
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18068
2018-11-23 07:50:34 +00:00
Andrew Rybchenko
8302d100a0 sfxge(4): fix potential buffer overflow in Tx queue init
Improve error checking to avoid a caller overflowing the MCDI
request buffer if the requested TXQ size was excessively large.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18067
2018-11-23 07:50:22 +00:00
Andrew Rybchenko
1695ac20dc sfxge(4): fix failure path in EF10 Tx queue PIO enable
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18066
2018-11-23 07:43:44 +00:00
Andrew Rybchenko
d55882df3e sfxge(4): add advanced function to extract FW version
Some libefx-based drivers might need this functionality to
indicate DPCPU FW IDs as part of FW version info to assist
experienced users.

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18065
2018-11-23 07:38:59 +00:00
Andrew Rybchenko
31e518b4c4 sfxge(4): add MCDI agnostic wrapper for MAC stats clear
If a libefx-based driver needs some way to clear port statistics,
then an MCDI agnostic method is required.

Submitted by:   Ivan Malov <ivan.malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18064
2018-11-23 07:26:37 +00:00
Andrew Rybchenko
d343a7f403 sfxge(4): limit max TXQ size on Medford to 2048
Queues with 4096 descriptors are not supported as the top bit is used for vfifo
stuffing.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8948
2018-11-22 16:15:24 +00:00
Andrew Rybchenko
8e0c482762 sfxge(4): support packed stream Rx mode in libefx
Submitted by:   Artem V. Andreev <Artem.Andreev@oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18022
2018-11-22 14:31:35 +00:00
Andrew Rybchenko
621cf62162 sfxge(4): cleanup: move into right place
Due to incorrect merge the piece of code was put in incorrect
place and diverge from libefx in other locations.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18024
2018-11-22 14:10:46 +00:00
Matt Macy
d7c5a620e2 ifnet: Replace if_addr_lock rwlock with epoch + mutex
Run on LLNW canaries and tested by pho@

gallatin:
Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5
based ConnectX 4-LX NIC, I see an almost 12% improvement in received
packet rate, and a larger improvement in bytes delivered all the way
to userspace.

When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1,
I see, using nstat -I mce0 1 before the patch:

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
4.98   0.00   4.42   0.00 4235592     33   83.80 4720653 2149771   1235 247.32
4.73   0.00   4.20   0.00 4025260     33   82.99 4724900 2139833   1204 247.32
4.72   0.00   4.20   0.00 4035252     33   82.14 4719162 2132023   1264 247.32
4.71   0.00   4.21   0.00 4073206     33   83.68 4744973 2123317   1347 247.32
4.72   0.00   4.21   0.00 4061118     33   80.82 4713615 2188091   1490 247.32
4.72   0.00   4.21   0.00 4051675     33   85.29 4727399 2109011   1205 247.32
4.73   0.00   4.21   0.00 4039056     33   84.65 4724735 2102603   1053 247.32

After the patch

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
5.43   0.00   4.20   0.00 3313143     33   84.96 5434214 1900162   2656 245.51
5.43   0.00   4.20   0.00 3308527     33   85.24 5439695 1809382   2521 245.51
5.42   0.00   4.19   0.00 3316778     33   87.54 5416028 1805835   2256 245.51
5.42   0.00   4.19   0.00 3317673     33   90.44 5426044 1763056   2332 245.51
5.42   0.00   4.19   0.00 3314839     33   88.11 5435732 1792218   2499 245.52
5.44   0.00   4.19   0.00 3293228     33   91.84 5426301 1668597   2121 245.52

Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch

Reviewed by:	gallatin
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15366
2018-05-18 20:13:34 +00:00
Brooks Davis
541d96aaaf Use an accessor function to access ifr_data.
This fixes 32-bit compat (no ioctl command defintions are required
as struct ifreq is the same size).  This is believed to be sufficent to
fully support ifconfig on 32-bit systems.

Reviewed by:	kib
Obtained from:	CheriBSD
MFC after:	1 week
Relnotes:	yes
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14900
2018-03-30 18:50:13 +00:00
Eitan Adler
caa7e52f3f kernel: Fix several typos and minor errors
- duplicate words
- typos
- references to old versions of FreeBSD

Reviewed by:	imp, benno
2017-12-27 03:23:21 +00:00
Pedro F. Giffuni
718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 14:52:40 +00:00
Andrew Rybchenko
2fb1df8fe0 sfxge(4): compact the first hot part of RxQ control
buf_base_id is used on RxQ control operations only and not used on
datapath.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2017-01-27 11:59:02 +00:00
Andrew Rybchenko
ecfb79144f sfxge(4): fix RxQ structure layout vs usage on datapath
Recent changes in the pseudo header accessor prototypes start to
use common code RxQ handle on datapath. The handle was located
at the end of the structure with members not used on datapath.

Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9359
2017-01-27 11:57:19 +00:00
Andrew Rybchenko
1baf03a4dc sfxge(4): fix invalid VLAN tagging after stop/start
TxQ is destroyed on stop and last used tag should be reset to default 0
on the next start.

Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9358
2017-01-27 11:56:18 +00:00
Andrew Rybchenko
a7668ace83 sfxge(4): cleanup: remove unused soft context struct member rxq_cache
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2017-01-27 08:54:33 +00:00
Andrew Rybchenko
a18fb3eed5 sfxge(4): cleanup: remvoe trailing tab
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2017-01-27 08:53:11 +00:00
Andrew Rybchenko
5c4dffdfb7 sfxge(4): cleanup: remove unused txq_index TxQ control structure member
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2017-01-27 08:51:48 +00:00
Andrew Rybchenko
a0e88689f0 sfxge(4): add sysctl to change MAC stats update period
The sysctl controls the period per interface.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9153
2017-01-12 15:26:23 +00:00
Andrew Rybchenko
58223d5b7a sfxge(4): add tunable to configure MAC stats update period
Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9151
2017-01-12 13:00:17 +00:00