Commit Graph

200 Commits

Author SHA1 Message Date
Andrew Rybchenko
435c201468 sfxge: update autogenerated monitors lists
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-12 09:52:38 +00:00
Andrew Rybchenko
5f5c71cc13 sfxge: add medford_impl.h, medford_nic.c, ef10_impl.h
Creating some files together to do the build system changes in one go.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4859
2016-01-12 08:32:53 +00:00
Andrew Rybchenko
b13ad4deb6 sfxge: add Medford sensor support
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/D4858
2016-01-12 06:37:42 +00:00
Andrew Rybchenko
19bc938f5a sfxge: use MCDIv2 on Medford
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/D4857
2016-01-12 06:34:45 +00:00
Andrew Rybchenko
34f6ea2980 sfxge: add Medford PCI IDs to common code
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/D4856
2016-01-12 06:32:56 +00:00
Andrew Rybchenko
8883918d66 sfxge: add sanity checking for EFX_OPT_MEDFORD build option to efx_check.h
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/D4854
2016-01-12 06:29:17 +00:00
Andrew Rybchenko
b53f4a640f sfxge: add Medford build option disabled by default
Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-01-11 09:15:25 +00:00
Andrew Rybchenko
548ebee5d0 sfxge: unify MCDI response polling
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D4496
2015-12-11 07:20:33 +00:00
Andrew Rybchenko
31a7f3730c sfxge: simplify MCDI methods
It is a part of MCDI rework to share more code among NIC families.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D4481
2015-12-11 06:28:15 +00:00
Andrew Rybchenko
af986c757a sfxge: consolidate privilege check functions
To reduce code duplication in common code, consolidate similar privilege
check functions.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4480
2015-12-10 07:42:56 +00:00
Andrew Rybchenko
9f09d81e0d sfxge: cleanup: fix header
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-10 07:35:38 +00:00
Andrew Rybchenko
273302a453 sfxge: simplify privilege checks with macro
Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4455
2015-12-10 07:17:46 +00:00
Andrew Rybchenko
1ff6d62640 sfxge: [6/6] support for MCDI proxy authorization in common code
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D4454
2015-12-10 07:16:21 +00:00
Andrew Rybchenko
90426c9934 sfxge: [5/6] rework event completion error handling
Required for MCDI proxy authorization support.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D4453
2015-12-10 07:15:09 +00:00
Andrew Rybchenko
610126e3a5 sfxge: cleanup: removed unused variable
Submitted by:   Artem V. Andreev <Artem.Andreev at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-09 06:59:04 +00:00
Andrew Rybchenko
0216bcdd5d sfxge: cleanup: fix (unused) EFX_OR_BYTE macro
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-09 06:53:43 +00:00
Andrew Rybchenko
ddfb0c9e8d sfxge: use MAC spoofing TX and MAC change privileges
Update of common code to provide a query on the MAC_SPOOFING_TX and
CHANGE_MAC privileges instead of the deprecated MAC_SPOOFING privilege.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4436
2015-12-09 06:24:22 +00:00
Andrew Rybchenko
083e18ee00 sfxge: [4/6] rework MCDI response polling
Required for MCDI proxy authorization support.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D4435
2015-12-09 06:14:47 +00:00
Andrew Rybchenko
59bfa22ab2 sfxge: [3/6] rework MCDI response handling
Required for MCDI proxy authorization support.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D4420
2015-12-08 06:25:52 +00:00
Andrew Rybchenko
06af9686c1 sfxge: [2/6] rework MCDI response polling
Required to support MCDI proxy authorization.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D4418
2015-12-07 07:22:21 +00:00
Andrew Rybchenko
3edad19717 sfxge: [1/6] add common code MCDI proxy auth build option
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D4417
2015-12-07 07:20:49 +00:00
Andrew Rybchenko
c590f76295 sfxge: fix pointer parameter/value signedness mismatch warnings
TLV routines use 'uint8_t *', NVRAM code uses caddr_t. Just cast to
required type to fix the warning.

Required to build with -Werror=pointer-signg.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4391
2015-12-07 06:07:01 +00:00
Andrew Rybchenko
ef13016e2c sfxge: fix name conflict with crc32_table from sys/crc32.h
The header is not present on FreeBSD, but exists on OmniOS where sfxge
common code is used as well.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4390
2015-12-07 06:05:23 +00:00
Andrew Rybchenko
9dd0e15fab sfxge: switch to TxQ creation specific flags
It is better do not mix TxQ creation and receive event flags since only
checksum flags are applicable to TxQ.
Also it will allow to add a new TxQ creation specific flags.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after: 2    days
Differential Revision: https://reviews.freebsd.org/D4389
2015-12-07 06:04:24 +00:00
Andrew Rybchenko
57396b7a90 sfxge: [Sorrento] support writing of MUM firmware
When writing the MUM firmware the chunk size must be equal to the erase
size.

Submitted by:   Laurence Evans <levans at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4388
2015-12-07 06:01:14 +00:00
Andrew Rybchenko
1547de018e sfxge: support PERMIT_SET_MAC_WHEN_FILTERS_INSTALLED flag
Use flag on vadapter alloc when reported as a supported capability.
Use the slow device reset only when the capability is missing.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4387
2015-12-07 05:59:24 +00:00
Andrew Rybchenko
af128f2270 sfxge: erase nvram partitions in chunks equal to their erase size
The erase size is reported by the nvram info command.

Submitted by:   Paul Fox <pfox at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4386
2015-12-05 17:11:14 +00:00
Andrew Rybchenko
4d982a2562 sfxge: pick up the new TLV structures
The header is auto-generated from firmware sources.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-05 08:34:51 +00:00
Andrew Rybchenko
029f0fcd79 sfxge: cleanup: remove set but not used trailer variable
Required to build with -Werror=unused-but-set-variable.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-05 08:26:16 +00:00
Andrew Rybchenko
6f750b3281 sfxge: cleanup: remove set but not used variable with parse error indication
Required to build with -Werror=unused-but-set-variable.
Keep it under #if 0 as a reminder for parse error processing.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-05 08:24:54 +00:00
Andrew Rybchenko
5a28872b84 sfxge: cleanup: remove set but not used saved_spec variable
Required to build with -Werror=unused-but-set-variable.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-05 08:21:45 +00:00
Andrew Rybchenko
3005902f91 sfxge: cleanup: remove SFL9122 "Huntington" PCI IDs
The SFL9122 "Huntington" controller was never built.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-05 08:10:32 +00:00
Andrew Rybchenko
ca8c913582 sfxge: [EF10] support RxQ scattering control
If, for example, a VF is configured to use a 1500 byte MTU, but the port
it is attached to is set to 9000 bytes, overlength frames can be received
by the VF. As Huntington scatters by default, these overlength packets
would be scattered across several descriptors, with all except the last
having the CONT bit set.

To avoid this, disable scatter when creating RXQs if the firmware
supports doing so, which all recent versions do. Then we only get
a single descriptor from an overlength frame. This will have the CONT
bit set to indicate it was truncated, so we can discard it.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4354
2015-12-04 06:54:46 +00:00
Andrew Rybchenko
9cb71b166c sfxge: add additional WRITESIZE value for NVRAM_INFO command
Submitted by:   Paul Fox <pfox at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4353
2015-12-04 06:51:37 +00:00
Andrew Rybchenko
26702cb592 sfxge: regenerate MCDI headers
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-03 08:06:10 +00:00
Andrew Rybchenko
f880676264 sfxge: remove internal register definitions that should not be used by host code
Submitted by:   Guido Barzini <gbarzini at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-03 07:28:57 +00:00
Andrew Rybchenko
946b5480b0 sfxge: add markers for autogenerated defines
Move use defines outside.

Submitted by:   Guido Barzini <gbarzini at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-03 07:24:59 +00:00
Andrew Rybchenko
501fe79d8e sfxge: sync TLV layout headers with firmwaresrc for event merging config
Submitted by:   Tom Millington <tmillington at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-12-03 07:22:53 +00:00
Andrew Rybchenko
870b11865a sfxge: add MCDI logging support to common code
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4331
2015-12-03 07:13:13 +00:00
Andrew Rybchenko
eaf3f5c649 sfxge: retry VF vAdaptor allocation if it fails because of no EVB port yet
After an MC reboot, a VF driver may reset before the PF driver has
finished bringing everything back up. This includes the VFs EVB port.
MC_CMD_VADAPTOR_ALLOC is the first MCDI call after an MC reboot to
require the EVB port, so if it fails with MC_CMD_ERR_NO_EVB_PORT,
retry the command a few times after waiting a while.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4333
2015-12-01 15:54:46 +00:00
Andrew Rybchenko
d486ce4b1b sfxge: add function to query link control privilege
Make link control privilege visible to OS driver to guard updates to
flow control and PHY advertised capabilities.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4330
2015-12-01 15:38:39 +00:00
Andrew Rybchenko
f990a59205 sfxge: FPGA and FPGA backup (diagnostic) partitions added to hunt_parttbl
It allows manftest to program them.

Submitted by:   Paul Fox <pfox at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4329
2015-12-01 15:32:37 +00:00
Andrew Rybchenko
f2588d15ef sfxge: allow VFs to have locally administered MAC addresses
Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4328
2015-12-01 15:29:51 +00:00
Andrew Rybchenko
63fa4a6afc sfxge: support MAC spoofing for 4.2.x firmare
Common code should infer other privileges from Admin privilege to
support firmware that pre-dates introduction of specific privilege
flags.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4327
2015-12-01 15:26:46 +00:00
Andrew Rybchenko
460cb5684c sfxge: add prefast annotation to common code return types
Using a typedef for common code return types (rather than "int")
allows the Prefast static analyser to understand when a function
has been successful (and thus when its postconditions must hold).

This greatly reduces then number of false positives reported by
prefast for error paths in common code functions.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-11-29 05:42:49 +00:00
Andrew Rybchenko
5d4e8a8629 sfxge: cleanup: fix prefast annotations on mac stats updates
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
X-MFC with:     r291397
2015-11-29 05:38:40 +00:00
Andrew Rybchenko
a1ae428b7d sfxge: modify nvram update functions for uio platform to support RFID-selectable presets
Dynamic config partitions on boards that support RFID are divided into
a number of segments, each formatted like a partition, with header,
trailer and end tags. The first segment is the current active
configuration.

The segments are initialised by manftest and each contain a different
configuration e.g. firmware variant. The firmware can be instructed
via RFID to copy a segment over the first segment, hence changing the
active configuration. This allows ops to change the configuration of
a board prior to shipment using RFID.

Changes to the dynamic config may need to be written to all segments (in
particular firmware versions written by manftest) or just the first
segment (changes to the active configuration). See SF-111324-SW.
If only the first segment is written the code still needs to be aware of
the possible presence of subsequent segments as writing to a segment may
cause its size to increase, which would overwrite the subsequent
segments and invalidate them.

Boards that do not support RFID will only have one segment in their
dynamic config partition.

Submitted by:   Paul Fox <pfox at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4302
2015-11-29 05:08:23 +00:00
Andrew Rybchenko
9dbc22c5aa sfxge: cleanup: report error on failure path in efx_vpd_hunk_verify
If the VPD is corrupt and contains an 'RV' keyword before the
END tag, then this function could return without setting the
return code to report the error.

Found by prefast.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-11-27 16:23:27 +00:00
Andrew Rybchenko
14c3e490cd sfxge: cleanup: fix prefast annotations on mac stats updates
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-11-27 16:21:14 +00:00
Andrew Rybchenko
45229bd409 sfxge: fix prefast warning in falconsiena_tx_qcreate
Keep prefast happy by returning the initial queue index
from falconsiena_tx_qcreate(). No change in behaviour, as
etxo_qcreate already zeros *addedp before the call.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-11-27 16:18:59 +00:00
Andrew Rybchenko
536c03c25f sfxge: cleanup: fix prefast annotations for stats buffers
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-11-27 16:16:45 +00:00
Andrew Rybchenko
222fcad248 sfxge: unlink PIO buffers from VIs in WC mapping in hunt_nic_fini()
PIO is not yet supported in the FreeBSD driver.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-11-27 16:07:20 +00:00
Andrew Rybchenko
102c7e9e62 sfxge: infer external port numbering for Pavia
Adjust external port mapping table to distinguish Pavia from Monza.
Now the presence of any 40G mode implies at least 2 outputs per
external port.  So Pavia 4x10G ports are now mapped to 1,2,3,4;
Monza 4x10G ports map to 1,1,2,2 as before.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-11-27 16:03:51 +00:00
Andrew Rybchenko
48ec66b35f sfxge: cleanup: fix prefast annotation
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-11-27 15:58:52 +00:00
Andrew Rybchenko
3519e25d23 sfxge: do not use unnamed union in siena_mc_combo_rom_hdr_t
GCC 4.2.1 used on FreeBSD 8 and 9 branches does not like unnamed
union member in the structure. It is not strictly required in head,
but nice to have to minimize difference with out-of-tree driver.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-11-27 15:54:36 +00:00
Andrew Rybchenko
f765dcf98c sfxge: cleanup: error probe correction
Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2015-11-27 15:50:17 +00:00
Andrew Rybchenko
e31b688a57 sfxge: added fallbacks for pre 4.2.1 firmware support
Driver must be able to start against older firmware that is missing
recently added MCDI calls, otherwise firmware upgrade will not be
possible.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D3145
2015-07-22 16:25:18 +00:00
Andrew Rybchenko
3c838a9f51 sfxge: add 7xxx NICs family support
Support 7xxx adapters including firmware-assisted TSO and VLAN tagging:

  - Solarflare Flareon Ultra 7000 series 10/40G adapters:
    - Solarflare SFN7042Q QSFP+ Server Adapter
    - Solarflare SFN7142Q QSFP+ Server Adapter

  - Solarflare Flareon Ultra 7000 series 10G adapters:
    - Solarflare SFN7022F SFP+ Server Adapter
    - Solarflare SFN7122F SFP+ Server Adapter
    - Solarflare SFN7322F Precision Time Synchronization Server Adapter

  - Solarflare Flareon 7000 series 10G adapters:
    - Solarflare SFN7002F SFP+ Server Adapter

Support utilities to configure adapters and update firmware.

The work is done by Solarflare developers
(Andy Moreton, Andrew Lee and many others),
Artem V. Andreev <Artem.Andreev at oktetlabs.ru> and me.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 weeks
Causually read by: gnn
Differential Revision: https://reviews.freebsd.org/D2618
2015-05-25 08:34:55 +00:00
Andrew Rybchenko
63424713e5 sfxge: do not check MCDI status word
This is a temporary workaround until we determine a reliable sequence
of operations for detecting MC reboots.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D2084
2015-03-23 15:52:57 +00:00
Andrew Rybchenko
5dadbb64d0 sfxge: FreeBSD before 10 does not have bus_space_*_8 on amd64
bus_space_*_8() are not always macros, so it is not correct to use
#ifndef.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D2083
2015-03-23 15:52:05 +00:00
Andrew Rybchenko
1cc8febf4c sfxge: add barriers to BAR write macros
In theory the barriers are required to cope with write combining and
reordering. Two barriers are added (sometimes merged to one):
 1. Before the first write to guarantee that previous writes to the region
    have been done
 2. Before the last write to guarantee that write to the last dword/qword is
    done after previous writes
Barriers are inserted before in the assumption that it is better to
postpone barriers as much as it is possible (more chances that the
operation has already been already done and barrier does not stall CPU).

On x86 and amd64 bus space write barriers are just compiler memory barriers
which are definitely required.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D2077
2015-03-23 15:45:39 +00:00
Andrew Rybchenko
75ba9e1e51 sfxge: correct limit for number of Rx queues
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-25 06:19:00 +00:00
Andrew Rybchenko
2fc13da641 sfxge: add common code support for changing TX queue pace
To delay packets from a particular TX queue by a particular time, write a value
into the TX Pace table s.t. pace time <= TX Pace Clock Period * (2 ^ pace value)
- the TX pace clock is 1/13 of the system clock, so its period should be 104 or
52 ns depending on whether turbo mode is active.

EFX_TX_PACE_CLOCK_BASE added by me.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 19:24:08 +00:00
Andrew Rybchenko
af9078c3f1 sfxge: correct event queue interrupt moderation timer quanta
Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 19:13:52 +00:00
Andrew Rybchenko
83488e1827 sfxge: do no allow EFSYS_MEM_ALLOC sleep
It solves locking problem when EFSYS_MEM_ALLOC is called in
the context holding a mutex (not allowed to sleep).
E.g. on interface bring up or multicast addresses addition.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 18:54:16 +00:00
Andrew Rybchenko
d9ff48ab2c sfxge: using bus_space_*_stream_* API for better portability
Host-bus byte order translation is not requred.

Submitted by:   Artem V. Andreev <Artem.Andreev at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 18:48:54 +00:00
Andrew Rybchenko
24422f5d39 sfxge: add missing Siena sensors to common code
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 18:47:30 +00:00
Andrew Rybchenko
fd7a9912f6 sfxge: add missing common code NVRAM types and map from MCDI
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 18:46:11 +00:00
Andrew Rybchenko
d880a0b3c8 sfxge: add new identities to Siena static config
Submitted by:   Andrew Jackson <ajackson at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 18:44:37 +00:00
Andrew Rybchenko
bce3678745 sfxge: use sparse index to retrieve sensor value
Submitted by:   Andrew Jackson <ajackson at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 07:18:38 +00:00
Andrew Rybchenko
687adefa70 sfxge: use macros to acquire and release BAR locks everywhere
It was the result of invalid merge of the patch from out-of-tree driver.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 07:17:35 +00:00
Andrew Rybchenko
685d4bc2f2 sfxge: use common definitions of MC shared memory offsets and PDU length
Submitted by:   Ben Hutchings
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 07:14:12 +00:00
Andrew Rybchenko
3f6a8fe3b4 sfxge: synchronize EF10 registers header
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 07:11:55 +00:00
Andrew Rybchenko
c071447ac1 sfxge: style fixes and cleanup
Sync endif comment with conditional.
BOOTROM and SIENA_BOOTROM are the same, but highlight that it is Siena.
Restore commented out assertion.
Sync comments with out-of-tree driver.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-22 07:08:57 +00:00
Andrew Rybchenko
9ab060a7cb sfxge: allow TX and RX queue limits to be changed
Before the common code had hard coded limits on the IDs RXQs and TXQs could
be created with which were suited for the Windows driver with VMQ, and so
would prevent queues with IDs greater than or equal to 259 (for TXQs) or 768
(for RXQs) from being created. This change allows the limits to be set in
efsys.h, so that all 1024 queues can be created during new manftest tests.
Also, the descriptor cache sizes were also hard coded to values suited to
the smaller queue counts, and so it was necessary to make them configurable
as well.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-21 06:28:31 +00:00
Andrew Rybchenko
1924cbe5d3 sfxge: check allocations are non-NULL before freeing them
Caught when efx_filter_init() failed and called efx_filter_fini() in the
teardown path.

Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-21 06:27:45 +00:00
Andrew Rybchenko
4e41fb10cb sfxge: keep fw and driver view of autoneg parameters consistent
Previously the driver's view was the expected outcome of any
reconfiguration even if that reconfiguration failed.

Submitted by:   Ben Horgan
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-21 06:27:16 +00:00
Andrew Rybchenko
f95b698965 sfxge: never set RX_DESCQ_EN during self-test
We must not enable RX queues with random parameters when they are
mapped into a VF with an untrusted driver.  It's probably not a good
idea to do this anyway, so take this bit out of the table test masks.

Submitted by:   Ben Hutchings
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-21 06:26:10 +00:00
Andrew Rybchenko
6da0beb5ac sfxge: add assertions that required event handlers are implemented
efx_ev_mcdi() does not assert or check that all event handlers it
calls are non-null.  Add assertions at the top for all required
event handlers, as some events (in the case of this bug, monitor
events) are rare.

Submitted by:   Ben Hutchings
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-20 19:42:05 +00:00
Andrew Rybchenko
612d8e2828 sfxge: style fixes
Use nitem() to get number of array elements.
Remove unused define.
Use TAB to indent.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-20 19:39:40 +00:00
Andrew Rybchenko
9bdc809c17 sfxge: regenerate sensor map
Add Florence R7 and Modena sensors.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-20 19:37:10 +00:00
Andrew Rybchenko
8bf93a0428 sfxge: add Florence R7 turbo mode support to common code
Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-20 07:57:59 +00:00
Andrew Rybchenko
9013400b1c sfxge: regenerate MCDI protocol headers
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-20 07:54:35 +00:00
Andrew Rybchenko
d8574f4f45 sfxge: fix broken MCDI_EV_FIELD() macro
Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-18 06:26:07 +00:00
Andrew Rybchenko
1f69766845 sfxge: support variable-length response to MCDI GET_BOARD_CFG
Allocate the minimum or maximum response length for GET_BOARD_CFG as
appropriate.  When looking up firmware subtypes by partition ID,
check the ID against the actual response length.

Merge of the patch made by Ben Hutchings in 2011.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-18 06:23:16 +00:00
Andrew Rybchenko
0ff2378988 sfxge: style fixes
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-16 06:12:04 +00:00
Andrew Rybchenko
0f999687bb sfxge: using 64-bit access for x86-64
Submitted by:   Artem V. Andreev <Artem.Andreev at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-05 12:08:25 +00:00
Andrew Rybchenko
33d45dc5e4 sfxge: make lock names unique
Lock name should include interface name.
Tx queue and event queue lock name should include queue number.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-05 11:39:15 +00:00
Andrew Rybchenko
763cab7173 sfxge: Add macros to init, destroy, acquire, release and assert locks
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-04 20:03:57 +00:00
Andrew Rybchenko
7c00963a55 sfxge: Implement EFSYS_MEM_READ_BARRIER()
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-04 19:58:54 +00:00
Andrew Rybchenko
495d35b1d7 sfxge: Remove unused esm_size member of the efsys_mem_t structure
esm_size is not even initialized properly when memory is allocated.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 19:03:33 +00:00
Andrew Rybchenko
fe9000816a sfxge: Make it possible to build without EVQ statistics
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 18:54:43 +00:00
George V. Neville-Neil
b7b0edd17c cleanup: code style fixes
Remove trailing whitespaces and tabs.
Enclose value in return statements in parentheses.
Use tabs after #define.
Do not skip comparison with 0/NULL in boolean expressions.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
2014-09-30 20:18:10 +00:00
George V. Neville-Neil
cf07c70df7 Commit various fixes for the SolarFlare drivers, in particular
this set of patches fixes support for systems with > 32 cores.

Details include

sfxge: RXQ index (not label) comes from FW in flush done/failed events

Change the second argument name of the efx_rxq_flush_done_ev_t and
efx_rxq_flush_failed_ev_t prototypes to highlight that RXQ index (not label)
comes from FW in flush done and failed events.

sfxge: TXQ index (not label) comes from FW in flush done event

Change the second argument name of the efx_txq_flush_done_ev_t prototype to
highlight that TXQ index (not label) comes from FW in flush done event.

sfxge: use TXQ type as label to support more than 32 TXQs

There are 3 TXQs in event queue 0 and 1 TXQ (with TCP/UDP checksum offload)
in all other event queues.

Submitted by:	Andrew Rybchenko <Andrew.Rybchenko at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
2014-04-14 16:31:56 +00:00
Sergey Kandaurov
d9140d3691 Bandaid for compiling with gcc. 2013-11-27 08:39:48 +00:00
Attilio Rao
54366c0bd7 - For kernel compiled only with KDTRACE_HOOKS and not any lock debugging
option, unbreak the lock tracing release semantic by embedding
  calls to LOCKSTAT_PROFILE_RELEASE_LOCK() direclty in the inlined
  version of the releasing functions for mutex, rwlock and sxlock.
  Failing to do so skips the lockstat_probe_func invokation for
  unlocking.
- As part of the LOCKSTAT support is inlined in mutex operation, for
  kernel compiled without lock debugging options, potentially every
  consumer must be compiled including opt_kdtrace.h.
  Fix this by moving KDTRACE_HOOKS into opt_global.h and remove the
  dependency by opt_kdtrace.h for all files, as now only KDTRACE_FRAMES
  is linked there and it is only used as a compile-time stub [0].

[0] immediately shows some new bug as DTRACE-derived support for debug
in sfxge is broken and it was never really tested.  As it was not
including correctly opt_kdtrace.h before it was never enabled so it
was kept broken for a while.  Fix this by using a protection stub,
leaving sfxge driver authors the responsibility for fixing it
appropriately [1].

Sponsored by:	EMC / Isilon storage division
Discussed with:	rstone
[0] Reported by:	rstone
[1] Discussed with:	philip
2013-11-25 07:38:45 +00:00
Eitan Adler
7a2b450ff8 Fxi a bunch of typos.
PR:	misc/174625
Submitted by:	Jeremy Chadwick <jdc@koitsu.org>
2013-05-10 16:41:26 +00:00
Philip Paeps
5dee87d724 sfxge: Add $FreeBSD$ tags to common code files.
Requested by:	bz
2011-11-28 17:19:05 +00:00
Marius Strobl
dc1788e8b0 Implement prefetch_read_{many,once}() for sparc64 and fix compilation on
other !x86 architectures.
2011-11-17 22:59:16 +00:00
Philip Paeps
e948693ed7 Add the sfxge(4) device driver, providing support for 10Gb Ethernet adapters
based on Solarflare SFC9000 family controllers.  The driver supports jumbo
frames, transmit/receive checksum offload, TCP Segmentation Offload (TSO),
Large Receive Offload (LRO), VLAN checksum offload, VLAN TSO, and Receive Side
Scaling (RSS) using MSI-X interrupts.

This work was sponsored by Solarflare Communications, Inc.

My sincere thanks to Ben Hutchings for doing a lot of the hard work!

Sponsored by:	Solarflare Communications, Inc.
MFC after:	3 weeks
2011-11-16 17:11:13 +00:00