Commit Graph

338 Commits

Author SHA1 Message Date
Toomas Soome
6afab5ccc5 e1000api: misleading-indentation
Two blocks in e1000_ich8lan.c are misaligned, causing noise with some
compilers (gcc 6).

Reviewed by:	imp, erj
Differential Revision:	https://reviews.freebsd.org/D10741
2017-05-15 16:53:02 +00:00
Sean Bruno
60596476cf Move pause frame counter out of struct if_ctx and into struct if_softc_ctx_t
so that we can use it in iflib to detect pause frames.

The igb(4) driver definitely used to use this in its old timer function and
I see no reason to restrict it to that driver only.

Sponsored by:	Limelight Networks
2017-04-07 00:33:03 +00:00
Sean Bruno
fd70242dbc no_desc_avail is tracked in iflib now making this redundant.
Sponsored by:	Limelight Networks
2017-04-04 16:54:46 +00:00
Sean Bruno
548b549ade Remove unsafe and non-functional DDB functions that I added long ago
for debugging.
2017-04-03 21:19:12 +00:00
Sean Bruno
c45420ccac Remove rx_processing_limit sysctl and now orphaned function em_set_sysctl_value
Sponsored by:	Limelight Networks
2017-04-03 21:17:57 +00:00
Sean Bruno
935ca1ae7c Access *correct* ifp data structure when debug sysctl is invoked.
Submitted by:	Kevin Bowling <kevin.bowling@kev009.com>
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D10126
2017-03-27 15:08:02 +00:00
Sean Bruno
cb101e1257 Add missing 'else' to conditional. This doesn't really affect the code
flow or configuration in any way.
2017-03-24 14:27:29 +00:00
Sean Bruno
fdb25f38cb Add missing 'else' to 3-state conditional during setup of interrupts.
We don't want to overwrite the 82574 interrupt setup with a different
configuration.

PR:		218041
Submitted by:	razmyslov@viva64.com
2017-03-24 14:25:56 +00:00
Sean Bruno
b207ed2b4a Actually set the MTU to the requested value and fixup handling of jumbo
frames.

Submitted by:	Matt Macy <mmacy@nextbsd.org>
Reported by:	pho
Sponsored by:	Limelight Networks
2017-03-15 14:44:59 +00:00
Sean Bruno
95246abb21 IFLIB updates
- unconditionally enable BUS_DMA on non-x86 architectures
- speed up rxd zeroing via customized function
- support out of order updates to rxd's
- add prefetching to hardware descriptor rings
- only prefetch on 10G or faster hardware
- add seperate tx queue intr function
- preliminary rework of NETMAP interfaces, WIP

Submitted by:	Matt Macy <mmacy@nextbsd.org>
Sponsored by:	Limelight Networks
2017-03-13 22:53:06 +00:00
Sean Bruno
38b7de95a1 Restore PBA setup for igb(4) class devices.
Do no write to PBA register on igb(4) devices unless we need
to make adjustments for the 82575 and jumbo frames.

Remove redundant LPE/~LPE assignments.

Move e1000_lv_jumbo_workaround_ich8lan() invokcation into a block
so that its not executed in the igb case.

Move em(4) class assignments of RCTL values to its own code block.

Adjust a few direct accesses of ifp->mtu to use accessor functions.

PR:		216734
Submitted by:	Kaho Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>
2017-02-19 05:06:29 +00:00
Sean Bruno
9c030a21d0 Push max_frame_len back into iflib so that jumbo frame sizes work.
Reported by:	pho
2017-02-17 21:30:16 +00:00
Sean Bruno
bcc537c59d Only trigger em_local_timer on queue index 0. This was causing continuous
em_local_timer() executions during normal operation and was very likely
to cause a lock up on igb(4) devices.

Submitted by:	Matt Macy (mmacy@nextbsd.org)
Reported by:	jtl
Reviewed by:	gallatin
Sponsored by:	Limelight Networks & Netflix
2017-02-12 23:06:41 +00:00
Andrew Turner
2a3c5de4f7 Add support for the Intel 82572EI back to em(4), it seems it was dropped
when oving to iflib.

Reviewed by:	sbruno
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D9511
2017-02-09 17:48:33 +00:00
Stephen J. Kiernan
d0b2cad1ca Add the folowing set accessor functions for recently-added members of ifnet
structure:

if_gethwtsomax(), if_sethwtsomax()                 - if_hw_tsomax
if_gethwtsomaxsegcount(), if_sethwtsomaxsegcount() - if_hw_tsomaxsegcount
if_gethwtsomaxsegsize(), if_sethwtsomaxsegsize()   - if_hw_tsomaxsegsize

Update em and vnic drivers which had already been coverted to use accessor
functions for the other ifnet structure members.

Reviewed by:	erj
Approved by:	sjg (mentor)
Obtained from:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D8544
2017-01-31 16:12:31 +00:00
Sean Bruno
cbf1505df9 Implement RSS queue tagging for em(4) class devices from a copy and massage
of functions from igb(4).  This enables 2 queue routing on 82574L class
devices again.
2017-01-25 23:12:03 +00:00
Sean Bruno
bd84f70044 iflib:
Add internal tracking of smp startup status to reliably figure out
     what methods are to be used to get gtaskqueue up and running.

e1000:
     Calculating this pointer gives undefined behaviour when (last == -1)
     (it is before the buffer).  The pointer is always followed.  Panics
     occurred when it points to an unmapped page.  Otherwise, the pointed-to
     garbage tends to not have the E1000_TXD_STAT_DD bit set in it, so in the
     broken case the loop was usually null and the function just returned, and
     this was acidentally correct.

Submitted by:	bde
Reported by:	Matt Macy <mmacy@nextbsd.org>
2017-01-24 16:05:42 +00:00
Sean Bruno
36fa5d5b64 Revert 312696 due to build tests. 2017-01-24 15:55:52 +00:00
Sean Bruno
562a3182f6 iflib:
Add internal tracking of smp startup status to reliably figure out
   what methods are to be used to get gtaskqueue up and running.

e1000:
   Calculating this pointer gives undefined behaviour when (last == -1)
   (it is before the buffer).  The pointer is always followed.  Panics
   occurred when it points to an unmapped page.  Otherwise, the pointed-to
   garbage tends to not have the E1000_TXD_STAT_DD bit set in it, so in the
   broken case the loop was usually null and the function just returned, and
   this was acidentally correct.

Submitted by:	bde
Reviewed by:	Matt Macy <mmacy@nextbsd.org>
2017-01-24 14:48:32 +00:00
Sean Bruno
db569544d1 igb(4) enable WOL features for this class of devices.
PR:	208343
Submitted by:	Kaho Tashikazu <kaho@elam.kais.kyoto-u.ac.jp>
2017-01-22 18:04:57 +00:00
Eric Joyner
295df609df e1000: Add support for Kaby Lake generation i219 (4) and i219 (5) devices
MFC after:	1 week
Sponsored by:	Intel Corporation
2017-01-19 18:52:38 +00:00
Sean Bruno
5a9c658286 ugh, device_t not device_t *
Reported by:	hps
2017-01-18 14:23:43 +00:00
Sean Bruno
70e316da4f Change device type to unbreak drm-next testing and builds.
Submitted by:	Matt Macy <mmacy@nextbsd.org>
2017-01-18 13:57:29 +00:00
Sean Bruno
653e35e69f Restore fixup for newer em(4) devices WOL capabilities post iflib integration.
PR:	208343
2017-01-12 14:47:44 +00:00
Sean Bruno
062a4b8c68 Deprecate kernel configuration option EM_MULTIQUEUE now that the em(4)
driver conforms to iflib.
2017-01-12 14:38:18 +00:00
Sean Bruno
0aa7d3ff9e Reset the EIAC register to include the LINK status bit and restore
link up/down notifications.

Submitted by:	Franco Fichtner <franco@opnsense.org>
2017-01-12 14:28:32 +00:00
Sean Bruno
8bc3dfc424 Attempt to use the "new" BAR address for newer igb(4) devices. This code
was dropped during the IFLIB migration.

Reported by:	olivier
Reviewed by:	mmacy@nextbsd.org
2017-01-12 14:18:52 +00:00
Sean Bruno
8237905651 Restore v6 offload caps for igb(4) class devices.
Reported by:	tuxen
2017-01-11 19:29:33 +00:00
Sean Bruno
d37cece2b0 Add copywrite notices, 2-clause BSD.
Reported by:	jmallett
2017-01-10 04:50:26 +00:00
Sean Bruno
f2d6ace4a6 Migrate e1000 to the IFLIB framework:
- em(4) igb(4) and lem(4)
- deprecate the igb device from kernel configurations
- create a symbolic link in /boot/kernel from if_em.ko to if_igb.ko

Devices tested:
- 82574L
- I218-LM
- 82546GB
- 82579LM
- I350
- I217

Please report problems to freebsd-net@freebsd.org

Partial review from jhb and suggestions on how to *not* brick folks who
originally would have lost their igbX device.

Submitted by:	mmacy@nextbsd.org
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Limelight Networks and Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8299
2017-01-10 03:23:22 +00:00
Sean Bruno
751e35548b Update WOL support for newer em(4) devices.
Do not overwrite the contents of the WUC register, add E1000_WUC_PME_EN
to the register contents, leaving the default contents intact.

PR:		208343
Submitted by:	Kaho Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>
Reviewed by:	jeffrey piper <jeffrey.e.pieper@intel.com>
Approved by:	erj@
MFC after:	2 weeks
2016-11-14 17:19:03 +00:00
Sean Bruno
525e07418c The igb driver currently requires a VF interface to have a non-zero MAC
address, but the associated PF is giving the VF an all zeros MAC address
when one is not administratively assigned. The driver should check for
this case and generate a random address, similar to how the linux igbvf
driver does.

Submitted by:	skoumjian@juniper.net (Scott Koumjian)
MFH:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D8399
2016-11-07 22:24:37 +00:00
Sean Bruno
b1b6afa587 r295133 attempted to deactivate TSO in the 100Mbit link case with this
adapter to work around bugs in TSO handling at this speed.

em_init_locked is called during first boot of the adapter and will
see that link_speed is unitialized, effectively turning off tso for
all cards at all speeds, which I believe was *not* the intent.

Move the handling of TSO deactivation to the link handler where we can
more effectively make the decision about what to do.  In addition,
completely purge the TSO capabilities instead of disabling just CSUM_TSO.

Thanks to jhb for explanation of the hw capabilites api.

Thanks to royger and cognet for testing the 100Mbit failure case to
ensure that their adapters do indeed still work.

MFC after:	1 week
Sponsored by:	Limelight Networks
2016-11-05 16:30:42 +00:00
Sean Bruno
7846f73cc8 Removed unused M_TSO_LEN.
MFC after:	2 weeks
2016-11-02 14:25:30 +00:00
Konstantin Belousov
cb31871867 Partial workaround for Intel PCI adapters reading past the end of the
host-programmed DMA regions.  This change seemingly fixes the
descriptor fetches, but the packet memory accesses are left
problematic.

Reviewed by:	emaste, erj, sbruno
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D8282
2016-10-19 18:15:44 +00:00
Luigi Rizzo
d782d9fd35 remove conditional code for an obsolete feature. if_ptnet now does better. 2016-10-18 15:50:20 +00:00
Sean Bruno
e760e292ae e1000: Add support for Kaby Lake IDs
Fixup some errors when transitioning to/from low power states.

Submitted by:	erj
Reviewed by:	Jeffery Piper (jeffrey.e.piper@intel.com)
MFC after:	3 days
Relnotes:	yes
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D7478
2016-08-15 11:24:30 +00:00
Jean-Sébastien Pédron
bd937497ea Consistently use device_t
Several files use the internal name of `struct device` instead of
`device_t` which is part of the public API. This patch changes all
`struct device *` to `device_t`.

The remaining occurrences of `struct device` are those referring to the
Linux or OpenBSD version of the structure, or the code is not built on
FreeBSD and it's unclear what to do.

Submitted by:	Matthew Macy <mmacy@nextbsd.org> (previous version)
Approved by:	emaste, jhibbits, sbruno
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D7447
2016-08-09 19:32:06 +00:00
Sean Bruno
e72a746a6e r293331 mistakingly failed to add an assignment of paddr to the rxbuf
but only in the NETMAP code.  This lead to the NETMAP code paths
passing nothing up to userland.

Submitted by:	Ad Schellevis <ad@opnsense.org>
Reported by:	Franco Fichtner <franco@opnsense.org>
MFC after:	1 day
2016-08-01 21:19:51 +00:00
Sean Bruno
c25b4c97a1 Remove uneeded parens.
MFC after:	1 day
2016-07-20 19:21:11 +00:00
Sean Bruno
761e526185 Do not initialize the adapter on MTU change when adapter status is down.
This fixes long-standing problems when changing settings of the adapter.

Discussed in:
https://lists.freebsd.org/pipermail/freebsd-net/2016-June/045509.html

Submitted by:	arnaud.ysmal@stormshield.eu
Reviewed by:	erj@freebsd.org
Approved by:	re (gjb)
Differential Revision:	https://reviews.freebsd.org/D7030
2016-07-07 03:39:18 +00:00
Sepherosa Ziehau
36ad8372d4 net: Use M_HASHTYPE_OPAQUE_HASH if the mbuf flowid has hash properties
Reviewed by:	hps, erj, tuexen
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6688
2016-06-07 04:51:50 +00:00
Eitan Adler
cef367e6a1 Don't repeat the the word 'the'
(one manual change to fix grammar)

Confirmed With: db
Approved by: secteam (not really, but this is a comment typo fix)
2016-05-17 12:52:31 +00:00
Pedro F. Giffuni
363089d89e dev/e1000,ixgbe: minor spelling fixes.
No functional change.

Differential Revision:	https://reviews.freebsd.org/D6177
2016-05-06 22:54:56 +00:00
Sean Bruno
40b6008fc5 Since igb_detach() cleans up all the data structures that will be
free'd by the functions following its call, we can simply return instead
of crashing and burning in the event of igb_detach() failing.

PR:		197139
Submitted by:	rupavath@juniper.net
MFC after:	2 weeks
2016-05-06 17:00:45 +00:00
Sean Bruno
eb9f04ddd9 If ALTQ is defined in the kern conf, switch to Legacy Mode.
PR:		208409
Submitted by:	freebsd@mcwest.org
MFC after:	2 weeks
2016-05-06 15:41:38 +00:00
Sean Bruno
ae6bd5b7be Correct possible underflow conditions when checking for available space
in the tx h/w ring buffer.

Reviewed by:	gnn jeb.j.cramer@intel.com
MFC after:	1 week
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D5918
2016-04-18 20:33:44 +00:00
Sepherosa Ziehau
6dd38b8716 tcp/lro: Use tcp_lro_flush_all in device drivers to avoid code duplication
And factor out tcp_lro_rx_done, which deduplicates the same logic with
netinet/tcp_lro.c

Reviewed by:	gallatin (1st version), hps, zbb, np, Dexuan Cui <decui microsoft com>
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5725
2016-04-01 06:28:33 +00:00
Michael Tuexen
e180827abc Support checksum offloading for TCP/IPV6 and UDP/IPV6.
Support SCTP checksum offloading for SCTP/IPV6.
Support SCTP checksum offloading on all controllers except 82575.

Reviewed by:	sbruno@, erj@
MFC after: 	4 weeks
Differential Revision:	D5193
2016-03-22 12:40:09 +00:00
Sean Bruno
7bfed09e02 The register read/write mphy functions have misleading whitespace around
the locked check. This cleanup merely preserves the existing functionality
while improving the ready check.

Submitted by:	Jim Thompson
Reviewed by:	gnn erj
Obtained from:	Netgate
MFC after:	2 weeks
Sponsored by:	Netgate
Differential Revision:	https://reviews.freebsd.org/D5448
2016-03-04 14:23:34 +00:00