Commit Graph

96 Commits

Author SHA1 Message Date
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