Commit Graph

501 Commits

Author SHA1 Message Date
Kevin Bowling
725e4008ef iflib: invert default restart on VLAN changes
In rS360398, a new iflib device method was added to opt out of VLAN
events needing an interface reset.

I am switching the default to not requiring a restart for:
* VLAN events
* unknown events

After fixing various bugs, I do not think this would be a common need
of hardware and it is undesirable from the user's perspective causing
link flaps and much slower VLAN configuration. Currently, there are no
other restart events besides VLAN events, and setting the
ifdi_needs_restart default to false will alleviate the need to churn
every driver if an odd event is added in the future for specific
hardware.

markj points out this could cause churn in the other direction; I will
solve that problem with an event registration system as he mentions in
the review should we need it in the future.

These drivers will opt into restart and need further inspection or work:
* ixv (needs code audit, 61a8231 fixed principal issue; re-init probably
not necessary)
* axgbe (needs code audit; re-init probably not necessary)
* iavf - (needs code audit; interaction with Malicious Driver Detection
mentioned in rS360398)
* mgb - no VLAN functions are currently implemented. Left a comment.

MFC after:	2 weeks
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D41558
2023-08-24 13:48:19 -07:00
Marius Strobl
51e235148a iflib drivers: Constify PCI ID LUTs
Since d49e83eac3, iflib(9) is ready
for this change.
While at it, make isc_driver_version strings (static) const where
not apparently un-const on purpose, too.
This reduces the size of the amd64 GENERIC by about 10 KiB.
2023-08-17 20:34:23 +02:00
Warner Losh
78d146160d sys: Remove $FreeBSD$: one-line bare tag
Remove /^\s*\$FreeBSD\$$\n/
2023-08-16 11:55:17 -06:00
Warner Losh
71625ec9ad sys: Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:24 -06:00
Kevin Bowling
eac761e967 e1000: Fix off by one ipcse
This has been off by one in the FreeBSD drivers as far back as I've
looked.  Emperically HW and SW emulations I have available don't seem to
mind.  Noticed while debugging other issues.

MFC after:	3 days
2023-08-15 14:39:35 -07:00
Kevin Bowling
797e480cba e1000: disable TSO on lem(4) and em(4)
Disable TSO on lem(4) and em(4) until a ring stall can be debugged.

I am not able to reproduce the issue on lem(4) but disabling there in
abundance of caution in case the issue is not specific to em(4).

Reported by:	grog
2023-08-14 17:25:39 -07:00
Kevin Bowling
13da84237a e1000: Enable TSO on 82574
Further testing indicates something wrong with particular reciever,
enabling TSO 82574 for wider testing.

Tested by:	karels
MFC after:	3 months
2023-08-09 10:19:37 -07:00
Kevin Bowling
f1b5488f7b e1000: Enable TSO for lem(4) and em(4)
Most em(4) devices now enjoy TSO and TSO6, matching NetBSD and Linux
defaults.

A prior commit automasks TSO on 10/100 Ethernet due to errata and other
bugs for IPv6 were fixed recently allowing this.

Mike Karels identified a performance anomaly on Intel 82574L devices.
These are multiqueue enabled on FreeBSD since the conversion to
iflib.  I am investigating whether this can be fixed, in the mean time
MSI-X with checksum offloads remain default.

i219 SPT devices have an errata that downclocks the DMA engine, which
results in TSO not being able to acheive line rate.  Therefore, it is
disabled on:
* Intel(R) I219-LM and I219-V SPT
* Intel(R) I219-LM and I219-V SPT-H (2)
* Intel(R) I219-LM and I219-V LBG (3)
* Intel(R) I219-LM and I219-V SPT (4)
* Intel(R) I219-LM and I219-V SPT (5)

Many lem(4) devices enjoy TSO, exceptions being 82542, 82543, 82547.
TSO6 may be possible for some chipsets but I am still working through
my testing matrix and that is hidden behind hw.em.unsupported_tso.

If you encounter issues, you may disable TSO with for example:
ifconfig em0 -tso -tso6.
I ask to be informed of any deviations from normal operation requiring
this.

Thanks to cc@ for access to emulab.net.

On a sample I219 system it saves about 16% CPU on IPv4 and 19% on IPv6.

iperf3 -Vc reported numbers:
total%	user%	system%

IPv4 TSO
21.3	7	14.4
21.4	6	15.4
21.5	6	15.5

IPv4 no TSO
36.8	5.4	31.4
38.5	5.1	33.5
38.2	5.7	32.6

IPv4 no TSO no TXCSUM
45.1	5.8	39.3
46	6.3	39.7
46.2	5.9	40.4

IPv6 TSO6
21.7	5.4	16.3
21.6	5.1	16.5
21.9	5.6	16.3

IPv6 no TSO6
41.2	5.2	36
41	5.1	36
40.8	5.2	35.7

IPv6 no TSO6 no TXCSUM6
49	5.9	43.1
48.8	4.9	43.9
49	5.6	43.4

Tested by:	cc (lem(4)), karels (82574L)
MFC after:	3 months
Relnotes:	yes
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D41170
2023-08-03 15:35:28 -07:00
Kevin Bowling
2ddf24f8f5 e1000: Automask TSO on lem(4)/em(4) 10/100 Ethernet
This feature masks TSO capability when a link comes up at 10 or 100mbit
due to errata on the chips.  This behavior matches previous versions of
FreeBSD as well as NetBSD and Linux.

A tunable, hw.em.unsupported_tso may be set if the admin desires to
disabling automasking and configure TSO settings manually.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D41170
2023-08-02 22:52:55 -07:00
Kevin Bowling
e1353dcb63 e1000: Fix lem(4)/em(4) TSO6
* Fix TSO6 by specializing IP checksum insertion and following Intel SDM
  values for IPv6.
* Remove unnecessary 82544 IP-bit handling
* Remove TSO6 from lem(4) capabilitities

Reviewed by:	erj (earlier version)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D41170
2023-07-31 08:19:14 -07:00
Kevin Bowling
38588749af e1000: HWCSUM excemption fixes
Also disable IPV6 checksum offload.

Spell hw->mac.type < e1000_82543 as e1000_82542.  Confusingly, chips
like 82540 and 82541 come later and do not have these issues.  There
is no functional change here, as the enum was defined in such a way
it worked correctly.  But this reads literally.

MFC after:	1 week
2023-07-28 18:17:35 -07:00
Kevin Bowling
cbcab907f8 e1000: Corrections for lem(4)/em(4) txcsum offload
Explicitly set ipcss/ipcse/ipcso for IPv6 per intel SDM as indicated in
inline comments.

Fix and consolidate 82543/82547 hwcsum exemption.

While here rearrange and expand some commentary.
2023-07-27 15:58:05 -07:00
Kevin Bowling
92fd2f39e5 e1000: add missing parens in csum setup
Reported by:	rscheff
Fixes:	4f9a44a215 e1000: Fix/enable IPv6 transmit checksum offload
MFC after:	2 weeks
2023-07-22 17:05:55 -07:00
Kevin Bowling
4f9a44a215 e1000: Fix/enable IPv6 transmit checksum offload
Fixes and enables txcsum6 offload for lem(4) and em(4).

MFC after:	2 weeks
2023-07-22 15:58:34 -07:00
Kevin Bowling
918c25677d e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes
* em(4) obey administrative ifcaps for using hwcsum offload
* em(4) obey administrative ifcaps for hw vlan receive tagging
* em(4) add additional TSO6 ifcap, but disabled by default as is TSO4
* lem(4) obey administrative ifcaps for using hwcsum offload
* lem(4) add support for hw vlan receive tagging
* lem(4) Add ifcaps for TSO offload experimentation, but disabled by
  default due to errata and possibly missing txrx code.
* lem(4) disable HWCSUM ifcaps by default on 82547 due to errata around
  full duplex links.  It may still be administratively enabled.

Reviewed by:	markj (previous version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30072
2023-07-22 12:13:43 -07:00
Kevin Bowling
5d3c982549 Revert "e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes"
Seems to cause a panic when booting under VitrualBox.

Reported by:	yasu

This reverts commit 95f7b36e8f.
2023-07-21 21:42:23 -07:00
Kevin Bowling
95f7b36e8f e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes
* em(4) obey administrative ifcaps for using hwcsum offload
* em(4) obey administrative ifcaps for hw vlan receive tagging
* em(4) add additional TSO6 ifcap, but disabled by default as is TSO4
* lem(4) obey administrative ifcaps for using hwcsum offload
* lem(4) add support for hw vlan receive tagging
* lem(4) Add ifcaps for TSO offload experimentation, but disabled by
  default due to errata and possibly missing txrx code.
* lem(4) disable HWCSUM ifcaps by default on 82547 due to errata around
  full duplex links.  It may still be administratively enabled.

Reviewed by:	markj (previous version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30072
2023-07-20 20:44:04 -07:00
Kevin Bowling
201c4b7c29 e1000: Some fixes for em(4) TSO setup
Always set TXD_CMD_IP for 82544
Otherwise set TXD_CMD_IP for IPv4, not IPv6

Reviewed by:	markj (previous version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30072
2023-07-20 18:52:53 -07:00
Kevin Bowling
5253d74e46 e1000: Format em_txrx
No functional changes intended.

Reviewed by:	markj (prior version)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30072
2023-06-08 19:06:04 -07:00
Kevin Bowling
034f38cdf8 e1000: Add SPDX tag to em_txrx
Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D30072
2023-06-08 18:42:20 -07:00
Piotr Kubaj
d0cdec7a20 em: sync platform detection with Linux
Switch 16 and 23 adapters from tgp to adp.

PR:	270929
Differential revision:	https://reviews.freebsd.org/D39977
Approved by:	erj, kbowling
2023-05-17 12:14:02 +02:00
Kristof Provost
0229fab2fe e1000: fix VLAN 0
VLAN 0 essentially means "Treat as untagged, but with priority bits",
and is used by some ISPs.

On igb/em interfaces we did not receive packets with VLAN tag 0 unless
vlanhwfilter was disabled.

This can be fixed by explicitly listing VLAN 0 in the hardware VLAN
filter (VFTA). Do this from em_setup_vlan_hw_support(), where we already
(re-)write the VFTA.

Reviewed by:	kbowling
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40046
2023-05-11 09:48:50 +02:00
Kevin Bowling
905ae5881b e1000: Add support for future client platforms
MFC after:	2 weeks
Sponsored by:	BBOX.io
2023-02-08 18:14:41 -07:00
Kevin Bowling
5636590214 e1000: Fix packet loss on 11th gen and later
Ungate DMA clock on TGP and later to avoid packet loss.

A similar fix appears in Linux 639e298f432fb058a9496ea16863f53b1ce935fe

This may be needed as far back as SPT but no confirmation from intel or
other OS yet.

Obtained from:	OpenBSD (if_em_hw.c 1.116)
MFC after:	2 weeks
Sponsored by:	BBOX.io
2023-02-08 17:50:33 -07:00
Kevin Bowling
d36fbdb08f e1000: Remove redundant disable_ulp for ich8lan
This call only makes sense for ich8lan, and the shared code does it in
e1000_setup_init_funcs() above this deletion.

Obtained from:	DPDK
MFC after:	2 weeks
Sponsored by:	BBOX.io
Pull Request:	https://github.com/freebsd/freebsd-src/pull/539
2023-02-08 17:24:28 -07:00
Kevin Bowling
647f2d2bc0 e1000: bump driver version
Incrementing these to avoid confusion in users; we are on par with these
out of tree versions.

Reviewed by:	erj
MFC after:	2 weeks
Sponsored by:	BBOX.io
Pull Request:	https://github.com/freebsd/freebsd-src/pull/540
2023-02-08 12:30:35 -07:00
Kevin Bowling
ae1dca798e e1000: fix I219 hang on reset
Clear the rings before reset to avoid a HW hang.

Inspired by em-7.7.8 and DPDK (1fc9701238edcf0541289b9ae15565b6d9d7ab30)

Reviewed by:	erj
MFC after:	2 weeks
Sponsored by:	BBOX.io
Pull Request:	https://github.com/freebsd/freebsd-src/pull/540
2023-02-08 12:30:34 -07:00
Piotr Kubaj
c0548bfc3a
em(4): Add IDs for new Intel(R) I219 devices
These include I219 (20) through I219 (23), which ends at Raptor Lake.

This also corrects a discrepancy where the (16) devices should be
mac type "e1000_pch_tgp" and not "e1000_pch_adp".

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

PR:		269224
Reviewed by:	erj@
MFC after:	1 day
Relnotes:	yes
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D38376
2023-02-06 14:35:56 -08:00
Elliott Mitchell
757cb555ae e1000: purge EOL release compatibility
Remove support for releases before FreeBSD 8.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/603
Differential Revision: https://reviews.freebsd.org/D35560
2023-02-04 09:11:03 -07:00
Justin Hibbits
402810d32e Convert iflib(4) and iflib-based drivers to the DrvAPI
Summary:
Convert iflib(4) and the following drivers:
* axgbe
* em
* ice
* ixl
* vmxnet

Sponsored by:	Juniper Networks, Inc.
Reviewed by:	kbowling, #iflib
Differential Revision: https://reviews.freebsd.org/D37768
2022-12-21 09:20:06 -05:00
Elliott Mitchell
21cc0918c7 sys: Nuke double-semicolons
A distinct number of double-semicolons have ended up in FreeBSD.  Take a
pass at getting rid of many of these harmless typos.

Reviewed by: emaste, rrs
Pull Request: https://github.com/freebsd/freebsd-src/pull/609
Differential Revision: https://reviews.freebsd.org/D31716
2022-11-02 09:34:20 -06:00
Kevin Bowling
66dad2db0a Revert "e1000: Try auto-negotiation for fixed 100 or 10 configuration"
This reverts commit 9ab4dfce8f.

OPNsense users have reported a regression with fixed configs.

The e1000 api is not ready for this change.
2022-10-12 05:01:12 -07:00
Kevin Bowling
6987c47569 e1000: Increase rx_buffer_size to 32b
Extend the size of the local rx_buffer_size variable to account for
larger buffer sizes possible on 82580, i350 chips.

From i350 datasheet, 6.2.10 Initialization Control 4 (LAN Base Address
+ Offset 0x13):
When 4 ports are enabled maximum buffer size is 36 KB. When 2 ports are
enabled maximum buffer size is 72 KB. When only a single port is
enabled maximum buffer size is 144 KB.

and 8.3:
The overall available internal buffer size in the I350 for all ports is
144 KB for receive buffers and 80 KB for transmit Buffers. Disabled
ports memory can be shared between active ports and sharing can be
asymmetric. The default buffer size for each port is loaded from the
EEPROM on initialization.

From the reporter:
But for I350 when only 2 ports are used PBA size can be set as 72KB
(see datasheet RXPbsize or e1000_rxpbs_adjust_82580 function in
e1000_82575.c). In this case calculating the rx_buffer_size overflows
as 0x0048 << 10 = 73728 or 0x12000 pushed into u16. It is then set as
0x2000 or 8192.

PR:		263896
Reported by:	hannula@gmail.com
Tested by:	hannula@gmail.com
Approved by:	markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D35167
2022-05-12 08:43:55 -07:00
John Baldwin
9e0570547b em/igb: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:39:29 -07:00
J.R. Oldroyd
9ab4dfce8f e1000: Try auto-negotiation for fixed 100 or 10 configuration
Currently if an e1000 interface is set to a fixed media configuration,
for gigabit, it will participate in auto-negotiation as required by
IEEE 802.3-2018 Clause 37. However, if set to fixed media configuration
for 100 or 10, it does NOT participate in auto-negotiation.

By my reading of Clauses 28 and 37, while auto-negotiation is optional
for 100 and 10, it is not prohibited and is, in fact, "highly
recommended".

This patch enables auto-negotiation for fixed 100 and 10 media
configuration, in a similar manner to that already performed for 1000.
I.e., the patch enables advertising of just the manually configured
settings with the goal of allowing the remote end to match the manually
configured settings if it has them available.

To be clear, this patch does NOT allow an em(4) interface that has been
manually configured with specific media settings to respond to
auto-negotiation by then configuring different parameters to those that
were manually configured. The intent of this patch is to fully comply
with the requirements of Clause 37, but for 100 and 10.

The need for this has arisen on an em(4) link where the other end is
under a different administrative control and is set to full
auto-negotiation. Due to the cable length GigE is not working well. It
is desired to set the em(4) end to "media 100baseTX mediatype
full-duplex" which does work when both ends are configured that way.
Currently, because em(4) does not participate in autoneg for this
setting, the remote defaults to half-duplex - i.e., there's a duplex
mismatch and things don't work. With this patch, em(4) would inform the
remote that it has only 100baseTX full, the remote would match that and
it will work.

Approved by:	erj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D34449
2022-04-13 09:17:32 -07:00
Kevin Bowling
07ede75161 e1000: Update mc filter before RCTL flags
Update mc filter array before changing RCTL flags as in 5a3eb6207a

Approved by:	grehan
MFC after:	2 weeks
2022-04-13 09:01:19 -07:00
Gordon Bergling
237a666333 e1000: Fix a typos in source code comments
- s/negotation/negotiation/

MFC after:	3 days
2022-04-09 10:14:06 +02:00
Vincenzo Maffione
f7926a6d0c net: iflib: fix vlan processing in the drivers
The logic that sets iri_vtag and M_VLANTAG does not handle the
case where the 802.11q VLAN tag is 0. Fix this issue across
the iflib drivers. While there, also improve and align the
VLAN tag check extraction, by moving it outside the RX descriptor
loop, eliminating a local variable and additional checks.

PR:             260068
Reviewed by:    kbowling, gallatin
Reported by:	erj
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D33156
2021-12-28 11:11:41 +00:00
Vincenzo Maffione
52f45d8ace net: iflib: let the drivers use isc_capenable
Since isc_capenable (private copy of ifp->if_capenable) is
now synchronized to if_capenable, use it in the drivers
when checking the IFCAP_* bits.
This results in better cache usage and avoids indirection
through the ifp pointer.

PR:             260068
Reviewed by:    kbowling, gallatin
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D33156
2021-12-28 11:03:52 +00:00
Vincenzo Maffione
e0f4cdba53 e1000: fix interface capabilities management
The e1000 drivers (em, lem, igb) are currently looking at the
iflib copies of the capabilities bitvectors (scctx->isc_capabilities
and scctx->isc_capenable) rather than the ifnet ones
(ifp->if_capabilities and ifp->if_capenable). However, the latter
are the ones that are actually updated by ifconfig and that should
be used by the drivers during interface operation. The former are
set by the driver on interface attach (for iflib internal use)
and should not be used anymore by the driver.
This patch fixes the e1000 driver to use the correct bitvectors.

PR:		260068
Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33154
2021-12-08 08:55:40 +00:00
Cy Schubert
db0ac6ded6 Revert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816"
This reverts commit 266f97b5e9, reversing
changes made to a10253cffe.

A mismerge of a merge to catch up to main resulted in files being
committed which should not have been.
2021-12-02 14:45:04 -08:00
Cy Schubert
266f97b5e9 wpa: Import wpa_supplicant/hostapd commit 14ab4a816
This is the November update to vendor/wpa committed upstream 2021-11-26.

MFC after:      1 month
2021-12-02 13:35:14 -08:00
Vincenzo Maffione
d0633af765 em: skip rxcsum offload processing when disabled
Similarly to the other Intel drivers, don't try to process
RX checksum offloads when this feature (IFCAP_RXCSUM) is
disabled.

Reviewed by:	gallatin, kbowling, erj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33155
2021-12-01 21:10:46 +00:00
Vincenzo Maffione
d91559564d e1000: remove unused ifp backpointer
The ifp (struct ifnet) backpointer in the e1000 private ifnet
data is not used anymore since the iflib transition.
Remove it so that developers are not tempted to use it and
get a NULL pointer dereference.

Reviewed by:	markj, kbowling, erj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33157
2021-12-01 21:08:31 +00:00
betterentley
f7c32ed617 Fix 'take effect' spelling in menus and comments.
Signed-off-by: John Bentley <johnbentley.public@gmail.com>
Pull Request: https://github.com/freebsd/freebsd-src/pull/559
2021-11-18 23:22:12 -07:00
Gordon Bergling
e9c7c6f5a0 e1000: Fix a typo in a source code comment
- s/overwritting/overwriting/

MFC after:	3 days
2021-11-07 14:12:23 +01:00
Kevin Bowling
293663f4da e1000: print EEPROM/NVM/OROM versions
This is useful for diagnosing problems. In particular, the errata
sheets identify the EEPROM version for many fixes.

Reviewed by:	gallatin
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32333
2021-10-06 16:25:03 -07:00
Kevin Bowling
9b3e252e59 e1000: Lock nvm print sysctl
Otherwise results in KASSERT with debug kernels because we rely on the
iflib CTX lock to implement the software serialization to the NVM model

Reviewed by:	gallatin
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32333
2021-10-06 16:20:26 -07:00
Kevin Bowling
28ccd780a9 e1000: Function prototype cleanup
Drop arguments of function prototypes since the file is mixed between
listing arg names and not.

No functional changes

Reviewed by:	markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D32329
2021-10-06 14:03:38 -07:00
Kevin Bowling
450c3f8b3d e1000: Re-arm link changes
A change to MSI-X link handler was somehow causing issues on
MSI-based em(4) NICs.

Revert the change based on user reports and testing.

PR:		258551
Reported by:	Franco Fichtner <franco@opnsense.org>, t_uemura@macome.co.jp
Reviewed by:	markj, Franco Fichtner <franco@opnsense.org>
Tested by:	t_uemura@macome.co.jp
MFC after:	1 day
2021-09-27 09:25:58 -07:00