Commit Graph

497 Commits

Author SHA1 Message Date
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
Andrew Rybchenko
62f5c49637 sfxge(4): stats refresh in SW should depend on HW update period
The period should be taken into account by the function which
refreshes driver stats.

Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9130
2017-01-12 06:30:44 +00:00
Andrew Rybchenko
542c719c02 sfxge(4): do not ignore requested MAC stats update period
Firmware version which takes PERIOD_MS parameter into account is
required.

Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9129
2017-01-12 06:29:14 +00:00
Andrew Rybchenko
e3ef7bb216 sfxge(4): avoid unnecessary mbuf data prefetch
Unnecessary prefetch just loads HW prefetcher and displaces other
cache entries (which could be really useful).

If we parse mbuf for TSO early and use firmware-assisted TSO, we do not
expect mbuf data access when we compose firmware-assisted TSO (v1 or v2)
option descriptors.  If packet header needs to be linearized or finally
FATSO cannot be used because of, for example, too big header, we do not
care about a bit more performance degradation because of prefetch
absence (it is better to optimize more common case).

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9120
2017-01-10 16:25:39 +00:00
Andrew Rybchenko
6a09b20655 sfxge(4): allow DMA descs to cross 4k boundary on EF10
Siena has limitation on maximum byte count and 4k boundary crosssing
(which is stricter than maximum byte count).
EF10 has limitation on maximum byte count only.

Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9061
2017-01-07 10:55:38 +00:00
Andrew Rybchenko
1eec14756f sfxge(4): treat EFX_LINK_UNKOWN as link down
It is safer to consider EFX_LINK_UNKNOWN as link down.
link_mode is set to EFX_LINK_UNKNOWN on port stop and fini.

Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9060
2017-01-07 10:52:02 +00:00
Andrew Rybchenko
f788eb2dd6 sfxge(4): use SFXGE_LINK_UP() to report link up state
Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D9059
2017-01-07 10:51:12 +00:00
Andrew Rybchenko
99e3d68596 sfxge(4): move queue size checks to after the NIC config has been populated
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/D8974
2016-12-30 12:23:02 +00:00
Andrew Rybchenko
a98003dde4 sfxge(4): cleanup: add efsys_lock_state_t for type of state param in EFSYS_LOCK()
This allows the common code to use the correct type for the lock state
local variable passed to EFSYS_LOCK() and EFSYS_UNLOCK().

On Windows, this allows warning supression pragmas to be removed.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-12-30 12:19:40 +00:00
Andrew Rybchenko
44c206993c sfxge(4): support per-command MCDI timeout
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-12-30 12:10:15 +00:00
Andrew Rybchenko
7367e67956 sfxge(4): remove obsolete Wake-On-LAN support
Wake-on-lan is not supported in production on any of our adapters, as
they don't have the required AUX power connector. (It's possible that
AUX power is supplied to some of our ALOM or mezz adapters, but if so
then we've never implemented or tested WoL support.)

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8972
2016-12-30 12:06:55 +00:00
Andrew Rybchenko
63492ab8be sfxge(4): fix efx_filter_supported_filters API
The previous API had various problems, including the length of the
caller provided buffer not being specified, no means being available
to discover how big the buffer needs to be, and a lack of clarity of
what the resulting list contains.

To fix it:
- add the buffer length as a parameter
- if the provided buffer is too short, fail with ENOSPC and return the
  required length
- ensure that the list contents are valid and add comments
  describing it

It is safe to change this API as, unsuprisingly, it has no users.

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/D8971
2016-12-30 12:02:16 +00:00
Andrew Rybchenko
662c835b34 sfxge(4): add functions to efx_bootcfg supporting whole partition access
Expose expcfg partition layout discovery and validating buffer copy
routines.  Needed for whole-partition expcfg operations.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8970
2016-12-30 12:00:17 +00:00
Andrew Rybchenko
f92697a4dd sfxge(4): make verified update result available from ef10_nvram_partn_unlock()
Manftest needs to know exactly what went wrong with the verified update
so that failing boards can be correctly diagnosed.

Submitted by:   Tom Millington <tmillington at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8969
2016-12-30 11:58:23 +00:00
Andrew Rybchenko
8a4fcbd44f sfxge(4): add per-command timeout reporting to the common code
In newer firmware that supports multithreaded MCDI processing,
longer running commands may be run ina background thread. Add
support for drivers to query the appropriate timeout for each
MCDI request.

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/D8968
2016-12-30 11:56:12 +00:00
Andrew Rybchenko
82d2a1482e sfxge(4): support non-interrupting event queues creation
Poll-mode driver does not use interrupts and number of used event queues
should not be limitted by the number of interrupts allocated for the
NIC.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8967
2016-12-30 11:54:27 +00:00
Andrew Rybchenko
e390161841 sfxge(4): cleanup: remove now-unused function flags
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/D8966
2016-12-30 11:52:55 +00:00
Andrew Rybchenko
3bce7d0f3b sfxge(4): cleanup: check deferred packet list tunables once
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8973
2016-12-30 11:49:37 +00:00
Andrew Rybchenko
1e2b4cef91 sfxge(4): cleanup: clarify/unify variable name used for put-list length
get_count is used for get-list.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-12-29 09:15:27 +00:00
Andrew Rybchenko
e9c123a567 sfxge(4): add support for firmware-verified NVRAM updates to the common code
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/D8942
2016-12-29 08:28:42 +00:00
Andrew Rybchenko
4af6e4df7c sfxge(4): sync up tlv_layout.h (from firmwaresrc 82cd8a5715e9)
Submitted by:   Matthew Slattery <mslattery at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-12-29 08:25:00 +00:00
Andrew Rybchenko
cff68e1ab7 sfxge(4): regenerate MCDI headers from firmwaresrc .yml
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-12-29 08:10:51 +00:00
Andrew Rybchenko
54c1459c81 sfxge(4): fix typo in pseudo header accessor function names
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-12-29 07:20:53 +00:00
Andrew Rybchenko
ecd9d64f0d sfxge(4): delete hunt_phy.c
Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-12-29 07:10:25 +00:00
Andrew Rybchenko
19734dbb1e sfxge(4): do not use enum type when values are bitmask
ICC complains that enumerated type mixed with another type.

Found by DPDK upstream build sanity check.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8954
2016-12-29 07:06:49 +00:00
Andrew Rybchenko
57b42dbbbc sfxge(4): do not use enum for filter flags
It is not 100% correct to assign non-enum values to enum type
variables.

Found by ICC build (DPDK PMD upstreaming).

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8953
2016-12-29 07:05:47 +00:00
Andrew Rybchenko
fd4fbb71da sfxge(4): don't use Tx descriptor push with TSO option descriptors
It is not safe to push TSO option descriptors if pacer bypass is
enabled, so to make sure that doesn't happen never push TSO option
descriptors.

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/D8952
2016-12-29 07:04:26 +00:00
Andrew Rybchenko
a85ebf7757 sfxge(4): split EFX_FILTER_MATCH_LOC_MAC_IG back into separate flags
The flag EFX_FILTER_MATCH_LOC_MAC_IG to represent filtering on the
individual/group bit of the MAC address (with the two cases being
distingusished by the MAC address in the filter specification) was
introduced to mirror the Linux driver filtering code, but the
implementations are different enough anyway that it isn't of much value.

Having separate flags for unknown unicast and multicast simplifies
the code and allows the set of flags to match those used by MCDI.

It will also makes it easier to report whether these filters are
supported.

In the MCDI definitions, the unknown multicast and unicast flags have
the values 0x40000000 and 0x80000000 respectively, and so using the
same values for simplicity requires 32 bits in the filter specification
to store the flags. This means the structure is now a little bigger
than 64 bytes, but filters are not often used on critical paths so this
shouldn't have much impact - on Linux they are also bigger than they
used to be.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D8951
2016-12-29 07:02:32 +00:00
Andrew Rybchenko
dae5708683 sfxge(4): allow to have no NIC handle on Rx datapath in DPDK PMD
It is required to minimize RxQ context in the driver or avoid chaising
for the NIC handle in adapter (global per-interface) structure.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8950
2016-12-29 07:00:26 +00:00
Andrew Rybchenko
d5a0c7e00a sfxge(4): add missing barrier in common code MCDI response handling
The semantics of the MCDI interfacve require reading the first
dword of the header before any other data in the buffer. Add
a barrier to the common code MCDI handler to enforce this.

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/D8949
2016-12-29 06:58:51 +00:00
Andrew Rybchenko
b5a8496927 sfxge(4): use correct port number in sensor decoding
The port mask used for per-port sensors in mcdi_sensor_map
assumes zero-based port numbering. The port mask used in
the code is based on the one-based MCDI port number.

Fix this to lookup the correct per-port sensors, and to
allow reporting of sensor events from higher port numbers.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8947
2016-12-29 06:57:36 +00:00
Andrew Rybchenko
f3cacdeb18 sfxge(4): cleanup: simplify disable scatter logic in ef10_rx_qcreate
Reviewed by:    gnn
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8945
2016-12-29 06:56:18 +00:00
Andrew Rybchenko
58a72cb202 sfxge(4): provide a way to find out which MAC stats are supported
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8944
2016-12-29 06:54:40 +00:00
Andrew Rybchenko
b422f9491d sfxge(4): make the common code determine the number of PFs
Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8941
2016-12-29 06:52:42 +00:00
Andrew Rybchenko
9933eabb8e sfxge(4): make the common code retrieve the number of FATSOv2 contexts
Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8940
2016-12-29 06:51:06 +00:00
Andrew Rybchenko
0ca76fa98a sfxge(4): fix efx_ev_qpoll for non-Siena builds
Both Siena and EF10 use the siena_ev_qpoll() implementation, but this
function is not defined in builds without EFSYS_OPT_SIENA.

Remove siena_ev_qpoll and inline it into efx_ev_qpoll to allow it
to be used in non-Siena builds.

Also remove outdated FIXME comment, as EF10 event batching/merging has
been implemented long ago without needing to modify this code.

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/D8939
2016-12-29 06:49:32 +00:00
Andrew Rybchenko
7b37475fef sfxge(4): fix common code for non-Siena builds
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8938
2016-12-29 06:47:53 +00:00
Andrew Rybchenko
897921fc45 sfxge(4): fix misuse of siena_build_filter in common code
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8937
2016-12-29 06:46:20 +00:00
Andrew Rybchenko
7fb55c62f7 sfxge(4): cleanup: remove last use of deprecated function flags with privilege check
The function flags were changed to mirror the privileges, but
the privileges are preferred.

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/D8936
2016-12-28 18:07:17 +00:00
Andrew Rybchenko
cc7a82f5da sfxge(4): move BIST methods from hunt_phy.c to ef10_phy.c
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/D8935
2016-12-28 17:56:03 +00:00