Commit Graph

47 Commits

Author SHA1 Message Date
Sean Bruno
7d0d648446 Add a different #define for the maximum number of transmit and
recieve descriptors for the igb(4) class of devices.  This will
allow a better definition for maximum going forward.  Some igb(4)
devices support more than the default 4K.

Reported by:	Jason (j@nitrology.com)
Sponsored by:	Limelight Networks
2017-08-25 22:38:55 +00:00
Sean Bruno
5f593927a8 Purge deprecated locking macros.
Submitted by:	Matt Macy <matt@mattmacy.io>
Sponsored by:	Limelight Networks
2017-08-10 14:54:36 +00:00
Sean Bruno
d8c2808fcf Restore igb(4) code dropped during iflib conversion
- restore newer code for vf, i350, i210, i211
 - restore dmac init code for i354 and i350
 - restore WUC/WUFC update
 - check for igb mac type before attempting trying to assert
   a media changed event.
 - handle link events for igb(4) and em(4) devices differently
   and appropriately for their respective model types.

Submitted by:	Matt Macy <mmacy@mattmacy.io>
Sponsored by:	Limelight Networks
2017-07-19 22:41:22 +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
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
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
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
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
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
Marius Strobl
0a01ff4d7d Fix and clean up usage of DMA and TSO segments:
- At Intel it is believed that most of their products support "only"
  40 DMA segments so lower {EM,IGB}_MAX_SCATTER accordingly. Actually,
  40 is more than plenty to handle full size TSO packets so it doesn't
  make sense to further distinguish between MAC variants that really
  can do 64 DMA segments. Moreover, capping at 40 DMA segments limits
  the stack usage of {em,igb}_xmit() that - given the rare use of more
  than these - previously hardly was justifiable, while still being
  sufficient to avoid the problems seen with em(4) and EM_MAX_SCATTER
  set to 32.
- In igb(4), pass the actually supported TSO parameters up the stack.
  Previously, the defaults set in if_attach_internal() were applied,
  i. e. a maximum of 35 TSO segments, which made supporting more than
  these in the driver pointless. However, this might explain why no
  problems were seen with IGB_MAX_SCATTER at 64.
- In em(4), take the 5 m_pullup(9) invocations performed by em_xmit()
  in the TSO case into account when reporting TSO parameters upwards.
  In the worst case, each of these calls will add another mbuf and,
  thus, the requirement for an additional DMA segment. So for best
  performance, it doesn't make sense to advertize a maximum of TSO
  segments that typically will require defragmentation in em_xmit().
  Again, this leaves enough room to handle full size TSO packets.
- Drop TSO macros from if_lem.h given that corresponding MACS don't
  support TSO in the first place.

Reviewed by:	erj, sbruno, jeffrey.e.pieper_intel.com
Approved by:	erj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D5238
2016-02-23 01:19:26 +00:00
Eric Joyner
c80429cedb Update em(4) to 7.6.1; update igb(4) to 2.5.3.
Major changes:

- Add i219/i219(2) hardware support. (Found on Skylake generation and newer
  chipsets.)
  - Further to the last Skylake support diff, this one also includes support for
    the Lewisburg chipset (i219(3)).

- Add a workaround to an igb hardware errata.
  All 1G server products need to have IPv6 extension header parsing turned off.
  This should be listed in the specification updates for current 1G server
  products, e.g. for i350 it's errata #37 in this document:
  http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/ethernet-controller-i350-spec-update.pdf

- Avoton (i354) PHY errata workaround added

And a bunch of minor fixes, as well as #defines for things that the current
em(4)/igb(4) drivers don't implement.

Differential Revision: https://reviews.freebsd.org/D3162
Reviewed by: sbruno, marius, gnn
Approved by: gnn
MFC after: 2 weeks
Sponsored by: Intel Corporation
2016-02-05 17:14:37 +00:00
Marius Strobl
e12a9f251e Given that em(4), lem(4) and igb(4) hardware doesn't require the
alignment guarantees provided by m_defrag(9), use m_collapse(9)
instead for performance reasons.
While at it, sanitize the statistics softc members, i. e. retire
unused ones and add SYSCTL nodes missing for actually used ones.

Differential Revision:	https://reviews.freebsd.org/D4717
2016-01-13 21:47:27 +00:00
Sean Bruno
b834dcea9a Switch em(4) to the extended RX descriptor format. This matches the
e1000/e1000e split in linux.

Split rxbuffer and txbuffer apart to support the new RX descriptor format
structures. Move rxbuffer manipulation to em_setup_rxdesc() to unify the
new behavior changes.

Add a RSSKEYLEN macro for help in generating the RSSKEY data structures
in the card.

Change em_receive_checksum() to process the new rxdescriptor format
status bit.

MFC after:	2 weeks
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D3447
2016-01-07 16:42:48 +00:00
Sean Bruno
e373323fe2 Revert 287914,287762.
Reports of breakage on igb(4) have been narrowed down to 287762 and 287914
is an dependant change.

Submitted by:	erj
2015-09-19 18:22:59 +00:00
Sean Bruno
25fd5dd9a0 Add Intel Skylake/I219 Support
- New em(4) device in currently shipping products

Differential Revision:	https://reviews.freebsd.org/D3163
Submitted by:	erj@freebsd.org
Reviewed by:	jfv@freebsd.org
MFC after:	2 weeks
Sponsored by:	Intel Corporation
2015-09-17 15:11:45 +00:00
Sean Bruno
c597a0199e Revert last two commits to em(4)/igb(4). Reports are coming in that
this breaks initialization and reads from EEPROM on boot/driver load.

r287469 is being reverted as a dependancy on r287467
2015-09-05 21:12:19 +00:00
Sean Bruno
98ae230f07 em(4): Add Skylake/I219 support.
- driver rev 7.5.2
- use new functions em_flush* for i219 devices

Differential Revision:	https://reviews.freebsd.org/D3163
Submitted by:	erj jfv
Reviewed by:	jfv
MFC after:	1 month
Relnotes:	Yes
Sponsored by:	Intel Corporation
2015-09-04 17:21:55 +00:00
Sean Bruno
df40405fab Increase EM_MAX_SCATTER to 64 such that the size of em_xmit()::segs[EM_MAX_SCATTER]
doesn't get overrun by things like NFS that can and do shove more than 32 segs when
being used with em(4) and TSO4.

Update tso handling code in em_xmit() with update from jhb@ in email thread:
https://lists.freebsd.org/pipermail/freebsd-net/2014-July/039306.html

set ifp->if_hw_tsomax, ifp->if_hw_tsomaxsegcount & ifp->if_hw_tsomaxsegsize
to appropriate values.

Define a TSO workaround "magic" number  of 4 that is used to avoid an
alignment issue in hardware.

Change a couple of integer values that were used as booleans to actual
bool types.

Ensure that em_enable_intr() enables the appropriate mask of interrupts
and not just a hardcoded define of values.

PR:		200221 199174 195078
Differential Revision:	https://reviews.freebsd.org/D3192
Reviewed by:	erj jhb hiren
MFC after:	2 weeks
Sponsored by:	Limelight Networks
2015-08-16 19:43:44 +00:00
Sean Bruno
23c9098b2a Change EM_MULTIQUEUE to a real kernconf entry and enable support for
up to 2 rx/tx queues for the 82574.

Program the 82574 to enable 5 msix vectors, assign 1 to each rx queue,
1 to each tx queue and 1 to the link handler.

Inspired by DragonFlyBSD, enable some RSS logic for handling tx queue
handling/processing.

Move multiqueue handler functions so that they line up better in a diff
review to if_igb.c

Always enqueue tx work to be done in em_mq_start, if unable to acquire
the TX lock, then this will be processed in the background later by the
taskqueue.  Remove mbuf argument from em_start_mq_locked() as the work
is always enqueued.  (stolen from igb)

Setup TARC, TXDCTL and RXDCTL registers for better performance and stability
in multiqueue and singlequeue implementations. Handle Intel errata  3 and
generic multiqueue behavior with the initialization of TARC(0) and TARC(1)

Bind interrupt threads to cpus in order.  (stolen from igb)

Add 2 new DDB functions, one to display the queue(s) and their settings and
one to reset the adapter.  Primarily used for debugging.

In the multiqueue configuration, bump RXD and TXD ring size to max for the
adapter (4096).  Setup an RDTR of 64 and an RADV of 128 in multiqueue configuration
to cut down on the number of interrupts.  RADV was arbitrarily set to 2x RDTR
and can be adjusted as needed.

Cleanup the display in top a bit to make it clearer where the taskqueue threads
are running and what they should be doing.

Ensure that both queues are processed by em_local_timer() by writing them both
to the IMS register to generate soft interrupts.

Ensure that an soft interrupt is generated when em_msix_link() is run so that
any races between assertion of the link/status interrupt and a rx/tx interrupt
are handled.

Document existing tuneables: hw.em.eee_setting, hw.em.msix, hw.em.smart_pwr_down, hw.em.sbp

Document use of hw.em.num_queues and the new kernel option EM_MULTIQUEUE

Thanks to Intel for their continued support of FreeBSD.

Reviewed by:	erj jfv hiren gnn wblock
Obtained from:	Intel Corporation
MFC after:	2 weeks
Relnotes:	Yes
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D1994
2015-06-03 18:01:09 +00:00
Sean Bruno
b7a728aaba Simplify hang detection by stealing the techniques used in ixl(4) and
applying them to em(4).

Rely on iterations through the local timer, and the tx queue state to
determine if an actual hang has occurred. Any time a descriptor is used
(packet sent), the tx queue is flagged as busy. Then when txeof runs, it
either clears the flag when all is clean, or resets it to 1 if ANY are
cleaned, if nothing is cleaned it increments the flag.

Local timer simply checks to see if busy ever reaches MAX (10, which
is compile time configurable), and then sets it as HUNG, at that point
there is one more timer cycle in which to have any cleans, if not a
watchdog reset will occur.

Differential Revision:	https://reviews.freebsd.org/D2019
Submitted by:	jfv
Reviewed by:	hiren
Obtained from:	Intel Corporation
MFC after:	2 weeks
Relnotes:	Yes
Sponsored by:	Limelight Networks
2015-06-02 18:28:41 +00:00
Marcel Moolenaar
9e11529015 Convert em(4) to use the driver API.
Submitted by:   Anuranjan Shukla <anshukla@juniper.net>
Obtained from:  Juniper Networks, Inc.
2014-06-02 18:52:03 +00:00
Luigi Rizzo
4dc07530d7 if_lem.c: make sure that lem_rxeof() can drain the entire rx queue
irrespective of the setting of lem_rx_process_limit, while
	giving a chance to the taskqueue scheduler to act after
	each chunk.
	This makes lem_rxeof similar to the one in if_em.c and if_igb.c .

if_lem.c and if_em.c: add a sysctl to manually configure the
	'itr' moderation register.

Approved by:	Jack Vogel
2013-05-09 17:07:30 +00:00
Jack F Vogel
fd33ce416e Part 2 of 2 New deltas for the 1G drivers.
There have still been intermittent problems with apparent TX
hangs for some customers. These have been problematic to reproduce
but I believe these changes will address them. Testing on a number
of fronts have been positive.

EM: there is an important 'chicken bit' fix for 82574 in the shared
code this is supported in the core here.
    - The TX path has been tightened up to improve performance. In
      particular UDP with jumbo frames was having problems, and the
      changes here have improved that.
    - OACTIVE has been used more carefully on the theory that some
      hangs may be due to a problem in this interaction
    - Problems with the RX init code, the "lazy" allocation and
      ring initialization has been found to cause problems in some
      newer client systems, and as it really is not that big a win
      (its not in a hot path) it seems best to remove it.
    - HWTSO was broken when VLAN HWTAGGING or HWFILTER is used, I
      found this was due to an error in setting up the descriptors
      in em_xmit.

IGB:
    - TX is also improved here. With multiqueue I realized its very
      important to handle OACTIVE only under the CORE lock so there
      are no races between the queues.
    - Flow Control handling was broken in a couple ways, I have changed
      and I hope improved that in this delta.
    - UDP also had a problem in the TX path here, it was change to
      improve that.
    - On some hardware, with the driver static, a weird stray interrupt
      seems to sometimes fire and cause a panic in the RX mbuf refresh
      code. This is addressed by setting interrupts late in the init
      path, and also to set all interrupts bits off at the start of that.
2011-12-10 07:08:52 +00:00
Jack F Vogel
e61e0b91af Change the refresh_mbuf logic slightly, add an inline
to calculate the outstanding descriptors that need to be
refreshed at any time, and use THAT in rxeof to determine
if refreshing needs to be done. Also change the local_timer
to simply fire off the appropriate interrupt rather than
schedule a tasklet, its simpler.

MFC in two weeks
2011-04-01 18:48:31 +00:00
Jack F Vogel
1c88efb221 Correct broken define 2011-03-19 00:19:18 +00:00
Jack F Vogel
1fd3c44f77 This delta updates the em driver to version 7.2.2 which has
been undergoing test for some weeks. This improves the RX
mbuf handling to avoid system hang due to depletion. Thanks
to all those who have been testing the code, and to Beezar
Liu for the design changes.

Next the igb driver is updated for similar RX changes, but
also to add new features support for our upcoming i350 family
of adapters.

MFC after a week
2011-03-18 18:54:00 +00:00
Jack F Vogel
7deff7f9b4 Bug fix delta to the em driver:
- Chasin down bogus watchdogs has led to an improved
	  design to this handling, the hang decision takes
	  place in the tx cleanup, with only a simple report
	  check in local_timer. Our tests have shown no false
	  watchdogs with this code.
	- VLAN fixes from jhb, the shadow vfta should be per
	  interface, but as global it was not. Thanks John.
	- Bug fixes in the support for new PCH2 hardware.
	- Thanks for all the help and feedback on the driver,
	  changes to lem with be coming shortly as well.
2010-10-26 00:07:58 +00:00
Jack F Vogel
7d9119bdc4 Update code from Intel:
- Sync shared code with Intel internal
	- New client chipset support added
	- em driver - fixes to 82574, limit queues to 1 but use MSIX
	- em driver - large changes in TX checksum offload and tso
	  code, thanks to yongari.
	- some small changes for watchdog issues.
	- igb driver - local timer watchdog code was missing locking
	  this and a couple other watchdog related fixes.
	- bug in rx discard found by Andrew Boyer, check for null pointer

MFC: a week
2010-09-28 00:13:15 +00:00
Jack F Vogel
d9f1a5aa8e Tighten up the rx mbuf refresh code, there were some
discrepencies from the igb version which was the target.

Change the message when neither MSI or MSIX are enabled
and a fallback to Legacy interrupts happen, the existing
message was confusing.
2010-09-07 20:13:08 +00:00
Pyun YongHyeon
dd20cce19a Do not allocate multicast array memory in multicast filter
configuration function. For failed memory allocations, em(4)/lem(4)
called panic(9) which is not acceptable on production box.
igb(4)/ixgb(4)/ix(4) allocated the required memory in stack which
consumed 768 bytes of stack memory which looks too big.

To address these issues, allocate multicast array memory in device
attach time and make multicast configuration success under any
conditions. This change also removes the excessive use of memory in
stack.

Reviewed by:	jfv
2010-08-28 00:34:22 +00:00
Jack F Vogel
91ce5735bf A few more changes from yongari:
- code flow in handler could let interrupt be
	  reenabled when not wanted.
	- change where the RX lock is taken to improve
	  performance.
	- adapter->msix is true for MSI systems also,
	  it needs to explicitly test for 82574, good one :)
2010-04-09 23:15:37 +00:00
Jack F Vogel
681ac9c018 Incorporate suggested improvements from yongari.
Also, from feedback, make the multiqueue code an
option (EM_MULTIQUEUE) that is off by default.
Problems have been seen with UDP when its on.
2010-04-09 18:42:15 +00:00
Marius Strobl
79c7b7190f Hook the identification LEDs of igb(4), lem(4) and em(4) devices up with
led(4) so they can be lit or f.e. made blink via `echo f2 > /dev/led/em0`
for localization purposes.

Approved by:	jfv
MFC afer:	1 week (after r205869)
2010-03-31 20:43:24 +00:00
Jack F Vogel
eaa9db2bb6 Fix lint build problem. 2010-03-30 17:05:24 +00:00
Jack F Vogel
8ec87fc514 Update to igb and em:
em revision 7.0.0:
	- Using driver devclass, seperate legacy (pre-pcie) code
	  into a seperate source file. This will at least help
	  protect against regression issues. It compiles along
	  with em, and is transparent to end use, devices in each
	  appear to be 'emX'. When using em in a modular form this
	  also allows the legacy stuff to be defined out.
	- Add tx and rx rings as in igb, in the 82574 this becomes
	  actual multiqueue for the first time (2 queues) while in
	  other PCIE adapters its just make code cleaner.
	- Add RX mbuf handling logic that matches igb, this will
	  eliminate packet drops due to temporary mbuf shortage.

igb revision 1.9.3:
	- Following the ixgbe code, use a new approach in what
	  was called 'get_buf', the routine now has been made
	  independent of rxeof, it now does the update to the
	  engine TDT register, this design allows temporary
	  mbuf resources to become non-critical, not requiring
	  a packet to be discarded, instead it just returns and
	  does not increment the tail pointer.
	- With the above change it was also unnecessary to keep
	  'spare' maps around, since we do not have the discard
	  issue.
	- Performance tweaks and improvements to the code also.

MFC in a week
2010-03-29 23:36:34 +00:00
Jack F Vogel
afb98829ac Two more build problems, missing includes and semicolon. 2010-01-27 18:00:24 +00:00
Jack F Vogel
6c8d4b16d4 Opps, completely wrong version of if_em.h got into
the checkin, sorry all :(
2010-01-27 17:35:58 +00:00
Jack F Vogel
a69ed8dfb3 Update the 1G drivers, shared code sync with Intel,
igb now has a queue notion that has a single interrupt
with an RX/TX pair, this will reduce the total interrupts
seen on a system. Both em and igb have a new watchdog
method. igb has fixes from Pyun Yong-Hyeon that have
improved stability, thank you :)

I wish to MFC this for 7.3 asap, please test if able.
2010-01-26 22:32:22 +00:00
Jack F Vogel
4edd8523d4 Resync with Intel versions of both the em and igb
drivers. These add new hardware support, most importantly
the pch (i5 chipset) in the em driver. Also, both drivers
now have the simplified (and I hope improved) watchdog
code. The igb driver uses the new RX cleanup that I
first implemented in ixgbe.

em  - version 6.9.24
igb - version 1.8.4
2009-12-08 01:07:44 +00:00
Jack F Vogel
9d81738f8f Updates for both the em and igb drivers, add support
for multiqueue tx, shared code updates, new device
support, and some bug fixes.
2009-06-24 17:41:29 +00:00
Kip Macy
b3e6cec7b3 collapse the two em_start_locked routines in to one 2009-04-27 22:55:48 +00:00
Kip Macy
f2502470b5 - define em_transmit and em_qflush
- make buF_ring usage conditional but enabled by default

Reviewed by:	jfv
2009-04-14 03:36:59 +00:00
Jack F Vogel
daf9197cff This delta is primarily a fix for es2lan devices that
will sometimes fail to initialize problem due to a lock
contention with management hardware. However, in order to
deliver that fix it was necessary to take a shared code
update as a whole, and this required scattered changes in
the core code to be compatible.

The em driver now has VLAN HW support added as the igb
driver had previously.

MFC after:  ASAP - in time for 7.1 RELEASE
2008-11-26 23:57:23 +00:00
Jack F Vogel
8cfa0ad266 Merge of the source for igb and em into dev/e1000, this
proved to be necessary to make the static drivers work
in EITHER/OR or BOTH configurations. Modules will still
build in sys/modules/igb or em as before.

This also updates the igb driver for support for the 82576
adapter, adds shared code fixes, and etc....

MFC after:	ASAP
2008-07-30 21:56:53 +00:00