Commit Graph

237 Commits

Author SHA1 Message Date
Andrew Gallatin
bca3808097 Restore SIOCGI2C functionality to ixgbe
When ixgbe was converted to iflib, it lost the SIOCGI2C support
that allows ifconfig to print SFP state, optical light levels, etc.
Restore this by plugging in to the ifdi_i2c_req iflib method.  Note
that the sanity checking on dev_addr that used to be done in ixgbe is
now done in iflib.

Reviewed by:	erj, Matthew Macy <mmacy@mattmacy.io>
Sponsored by:	Netflix
2018-04-17 16:51:27 +00:00
Vincenzo Maffione
2ff91c175e netmap: align codebase to the current upstream (commit id 3fb001303718146)
Changelist:
    - Turn tx_rings and rx_rings arrays into arrays of pointers to kring
      structs. This patch includes fixes for ixv, ixl, ix, re, cxgbe, iflib,
      vtnet and ptnet drivers to cope with the change.
    - Generalize the nm_config() callback to accept a struct containing many
      parameters.
    - Introduce NKR_FAKERING to support buffers sharing (used for netmap
      pipes)
    - Improved API for external VALE modules.
    - Various bug fixes and improvements to the netmap memory allocator,
      including support for externally (userspace) allocated memory.
    - Refactoring of netmap pipes: now linked rings share the same netmap
      buffers, with a separate set of kring pointers (rhead, rcur, rtail).
      Buffer swapping does not need to happen anymore.
    - Large refactoring of the control API towards an extensible solution;
      the goal is to allow the addition of more commands and extension of
      existing ones (with new options) without the need of hacks or the
      risk of running out of configuration space.
      A new NIOCCTRL ioctl has been added to handle all the requests of the
      new control API, which cover all the functionalities so far supported.
      The netmap API bumps from 11 to 12 with this patch. Full backward
      compatibility is provided for the old control command (NIOCREGIF), by
      means of a new netmap_legacy module. Many parts of the old netmap.h
      header has now been moved to netmap_legacy.h (included by netmap.h).

Approved by:	hrs (mentor)
2018-04-12 07:20:50 +00:00
Mark Johnston
fbf8b74c10 Use C99 initializers for iflib function tables.
Reviewed by:	sbruno
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D15041
2018-04-11 15:15:34 +00:00
Eric Joyner
7d48aa4c72 ixgbe(4): Update shared code, add support for X552 1G, fix bug
This patch will:

- Update ixgbe shared code
- Add support for Intel(R) Ethernet Connection X552 1000BASE-T
- Add error handling for link state check preventing VF from stopping traffic
  after changing PF's MTU value

Submitted by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: Intel Networking
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D13885
2018-03-19 20:55:05 +00:00
Eric Joyner
2149fa3ec8 ixv(4): Stop setting editing ifnet flags in ixv_if_init()
In iflib, the device-specific init() function isn't supposed to edit
the struct ifnet driver flags. If it does, it'll cause an MPASS() assert
in iflib to fail.

PR:		225312
Reported by:	bhughes@
2018-01-22 20:56:21 +00:00
Eric Joyner
788a123054 ixgbe(4): Fix build error on i386.
Reported by:	markj
2017-12-21 00:35:14 +00:00
Eric Joyner
c19c7afee3 ixgbe(4): Convert driver to use iflib
Initial update to the ixgbe PF and VF drivers to support the iflib interface.

The PF driver version is bumped to 4.0.0, and the VF driver version is bumped to 2.0.0.

Special thanks to sbruno@ for the support in helping make this conversion happen.

Submitted by:	Jeb Cramer <cramerj@intel.com>, Krzysztof Galazka (Chris) <krzysztof.galazka@intel.com>, Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by:	sbruno@, shurd@, #IntelNetworking
Tested by:	Jeffrey Pieper <jeffrey.e.pieper@intel.com>, Sergey Kozlov <kozlov.sergey.404@gmail.com>
Sponsored by:	Limelight Networks, Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D11727
2017-12-20 18:15:06 +00:00
Pedro F. Giffuni
7282444b10 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

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.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:36:21 +00:00
Sean Bruno
9c92bb71de Fix ixgbe(4) support for ifconfig's vlanhwtag flag. Disabling this flag
will now prevent the driver from stripping vlan tags from packets.

PR:		219390
Submitted by:	Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reported by:	Charles Goncalves <halfling@halfling.com.br>
Obtained from:	1 week
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D12795
2017-11-06 18:08:59 +00:00
Sepherosa Ziehau
9fed8bbef4 ixgbe: Remove never defined UDP_IPV4_EX
Reviewed by:	sbruno
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D12454
2017-10-11 05:55:52 +00:00
Konstantin Belousov
405058aa7a Only make the if_ix module depend on netmap when netmap is configured.
Approved by:	erj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-08-30 18:19:25 +00:00
Eric Joyner
b82c9ba1c4 ixv(4): Add more robust mailbox API negotiation
The previous update to the driver to 3.2.12-k changed the VF's API version
to 1.2, but did not let the VF fall back to 1.1 or 1.0 versions. So, this
patch tries 1.2 first, then the older versions in succession if that fails.

This should allow the VF driver to negotiate 1.1 and work with older PF
drivers, such as the one used in Amazon's EC2 service.

PR:		220872
Submitted by:	Jeb Cramer <jeb.j.cramer@intel.com>
MFC after:	1 week
Sponsored by:	Intel Corporation
2017-08-24 22:56:22 +00:00
Sean Bruno
e0ef5a7306 Drop ixgbe RX lock during TCP_LRO processing. This eliminates a "storm"
of LOR detection and a bit of lock release/acquire collision when using LRO.

Submitted by:   Kevin Bowling <kevin.bowling@kev009.com>
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D11712
2017-07-25 14:38:30 +00:00
Sean Bruno
fb6aa95d9f Reset unsupported SFP tuneable back to original entry name.
Reported by:	olivier@
2017-07-12 17:35:32 +00:00
Eric Joyner
8eb6488ebb ixgbe(4): Update HEAD (p3) to 3.2.12-k
Includes:

- Support for X550EM devices.
- Support for Bypass adapters.
- Flow Director code moved to separate files
- SR-IOV code moved to separate files
- Netmap code moved to separate files

Differential Revision:	https://reviews.freebsd.org/D11232
Submitted by:	Jeb Cramer <cramerj@intel.com>
Reviewed by:	erj@
Tested by:	Jeff Pieper <jeffrey.e.pieper@intel.com>
Sponsored by:	Intel Corporation
2017-07-05 17:27:03 +00:00
Sean Bruno
ec2408187e Don't overrite vf->flags variable at the end of ixgbe(4) ixgbe_add_vf().
Found by PVS-Studio Static code analyzer.

PR:		217748
Submitted by:	razmyslov@viva64.com
MFC after:	1 week
2017-04-05 22:01:49 +00:00
Sean Bruno
6916de8666 Fix a double free in ixgbe_rxeof()
Submitted by:	rstone
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10255
2017-04-05 19:52:49 +00:00
Ryan Stone
7d309e8e40 Fix reference to free memory in ixgbe/if_media.c
When ixgbe receives an interrupt indicating that a new optical module
may have been inserted, it discards all of its current media types
by calling ifmedia_removeall() and then creates a new set of media
types for the supported media on the new module.  However,
ifmedia_removeall() was maintaining a pointer to whatever the
current media type was before the call to ifmedia_removealL().
The result of this was that any attempt to read the current media
type of the interface (e.g. via ifconfig) would return potentially
garbage data from free memory (or if one were particularly unlucky
on an architecture that does not malloc() from a direct map, page
fault the kernel).

Fix this by NULL'ing out the current media field in if_media.c,
and have ixgbe update the current media type after recreating
them.

Submitted by:	Matt Joras <matt.joras AT gmail DOT com>
Reviewed by:	sbruno, erj
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9164
2017-01-20 17:16:48 +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
03d28807f5 Fixup DA cable detection routines to not set the cable type to
unknown if they do not match one of two cable types.

PR:		150249
Submitted by:	borjam@sarenet.es
Reviewed by:	erj
MFC after:	3 days
2016-07-19 17:31:48 +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
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
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
Pedro F. Giffuni
74b8d63dcc Cleanup unnecessary semicolons from the kernel.
Found with devel/coccinelle.
2016-04-10 23:07:00 +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
Steven Hartland
d775d23ac5 Prevent invalid ixgbe advertise setting warning
Prevent ixgbe outputting "Invalid advertised speed" warning on boot with
no customisations by moving test from sysctl handler to set handler.

PR:		208022
MFC after:	3 days
Sponsored by:	Multiplay
2016-03-16 01:41:55 +00:00
Michael Tuexen
2602455cc2 In FreeBSD 10 and higher the driver announces SCTP checksum offloading support
also for 82598, which doesn't support it.
The legacy code has a check for it, which was missed when the code for dealing with
CSUM_IP6_* was added. Add the same check for FreeBSD 10 and higher.

Differential Revision:	https://reviews.freebsd.org/D5192
2016-02-04 18:08:50 +00:00
Steven Hartland
0e872751df Fix ixgbe flow control autoneg reporting
Fix ixgbe reporting of flow control autoneg when running under DBG 1

Reviewed by:	erj
MFC after:	2 days
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D5089
2016-01-31 15:18:03 +00:00
Steven Hartland
1ebf555beb Configure ixgbe phy & gbic power
Setup phy and gbic power as per Linux 4.3.13 driver.

This fixes link not detected on X540-AT2 after booting to Linux which turns
the phy power off on detach.

Reviewed by:	sbruno
MFC after:	2 days
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D5107
2016-01-31 15:14:23 +00:00
Steven Hartland
f2c4db545f ixgbe sysctl hardware defaults
Added hw.ix.flow_control which enables the default flow_control of all ix
interfaces to be set in loader.conf.

Added hw.ix.advertise_speed which enables the default advertised_speed of
all ix interfaces to be set in loader.conf.

Made enable_aim device independent based on hw.ix.enable_aim default.

Reviewed by:	erj
MFC after:	1 week
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D5060
2016-01-26 12:30:17 +00:00
Steven Hartland
94241c6011 Fix ixgbe compliation with DBG 1
Fixed ERROR_REPORTXX macros so that ixgbe compiles with #define DBG 1

MFC after:	1 week
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D5061
2016-01-25 16:18:53 +00:00
Steven Hartland
1566d8d57a Fix ix advertise value after media change
When ifconfig sets media then the values displayed by the advertise_speed
value are invalidated.

Fix this by setting the bits correctly including setting advertise to 0 for
media = auto.

Reviewed by:	sbruno
MFC after:	1 week
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D5034
2016-01-22 17:03:32 +00:00
Hans Petter Selasky
e936121d31 Add optimizing LRO wrapper:
- Add optimizing LRO wrapper which pre-sorts all incoming packets
  according to the hash type and flowid. This prevents exhaustion of
  the LRO entries due to too many connections at the same time.
  Testing using a larger number of higher bandwidth TCP connections
  showed that the incoming ACK packet aggregation rate increased from
  ~1.3:1 to almost 3:1. Another test showed that for a number of TCP
  connections greater than 16 per hardware receive ring, where 8 TCP
  connections was the LRO active entry limit, there was a significant
  improvement in throughput due to being able to fully aggregate more
  than 8 TCP stream. For very few very high bandwidth TCP streams, the
  optimizing LRO wrapper will add CPU usage instead of reducing CPU
  usage. This is expected. Network drivers which want to use the
  optimizing LRO wrapper needs to call "tcp_lro_queue_mbuf()" instead
  of "tcp_lro_rx()" and "tcp_lro_flush_all()" instead of
  "tcp_lro_flush()". Further the LRO control structure must be
  initialized using "tcp_lro_init_args()" passing a non-zero number
  into the "lro_mbufs" argument.

- Make LRO statistics 64-bit. Previously 32-bit integers were used for
  statistics which can be prone to wrap-around. Fix this while at it
  and update all SYSCTL's which expose LRO statistics.

- Ensure all data is freed when destroying a LRO control structures,
  especially leftover LRO entries.

- Reduce number of memory allocations needed when setting up a LRO
  control structure by precomputing the total amount of memory needed.

- Add own memory allocation counter for LRO.

- Bump the FreeBSD version to force recompilation of all KLDs due to
  change of the LRO control structure size.

Sponsored by:	Mellanox Technologies
Reviewed by:	gallatin, sbruno, rrs, gnn, transport
Tested by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D4914
2016-01-19 15:33:28 +00:00
Sean Bruno
9030be4bad Fix VF handling of VLANs.
This helps immensily with our ability to operate in the Amazon Cloud.

Discussed on Intel Networking Community call this morning.

Submitted by:	Jarrod Petz(petz@nisshoko.net)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D4788
2016-01-07 18:34:56 +00:00
Sean Bruno
97f9586e97 Fixup SFP module insertion on the 82599 when insertion happens after
the system is booted and running.

Add PHY detection logic to ixgbe_handle_mod() and add locking to
ixgbe_handle_msf() as well.

PR:		150251
Submitted by:	aboyer@averesystems.com
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D3188
2016-01-07 17:02:34 +00:00
Bjoern A. Zeeb
376760cc96 Add missing #ifdef INET after r292674 to allow NOIP and NOINET kernels
to build.
2015-12-26 17:27:48 +00:00
Sean Bruno
037985317a Fix NO INET6 build broken at svn r292674
Reported by: ohartman@zedat.fu-berlin.de
2015-12-24 17:05:25 +00:00
Sean Bruno
a9ca1c79c6 ixgbe(4): Update to version 3.1.13-k
Add support for two new devices:  X552 SFP+ 10 GbE, and the single port
version of X550T.

Submitted by:	erj
Reviewed by:	gnn
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D4186
2015-12-23 22:45:17 +00:00
Sean Bruno
b0c041f887 Add support for sysctl knobs to live tune the per interrupt rx/tx packet
processing limits in ixgbe(4)

Differential Revision:	https://reviews.freebsd.org/D3719
Submitted by:	jason wolfe (j-nitrology.com)
MFC after:	2 weeks
2015-10-13 17:34:18 +00:00
Sean Bruno
e5cb6169d3 A misplaced #endif in ixgbe_ioctl() causes interface MTU to become
zero when INET and INET6 are undefined.

PR:		162028
Differential Revision:	https://reviews.freebsd.org/D3187
Submitted by:	hoomanfazaeli@gmail.com pluknet
Reviewed by:	erj hiren gelbius
MFC after:	2 weeks
2015-08-03 16:39:25 +00:00
Hiren Panchasara
4d5e6ef665 Remove a couple of TUNABLE_INT() calls which are unnecessary after r267961.
r267961 did remove them but they "reappeared" when ixgbe(4) rewrite happened in
r280182.

Sponsored by:		Limelight Networks
2015-07-21 06:48:36 +00:00
Patrick Kelsey
8aa7fdbd78 Add netmap support for ixgbe SRIOV VFs (that is, to if_ixv).
Differential Revision: https://reviews.freebsd.org/D2923
Reviewed by: erj, gnn
Approved by: jmallett (mentor)
Sponsored by: Norse Corp, Inc.
2015-07-15 01:02:01 +00:00
Hiren Panchasara
fd3e9bafbd Remove FreeBSD version check for deprecated M_FLOWID.
Reviewed by:	    erj
Sponsored by:	    Limelight Networks
2015-07-15 01:01:17 +00:00
Patrick Kelsey
c8ed84db3a Fix igxbe SRIOV VF (if_ixv) initialization bugs. The MAC address for
an if_ixv instance can now set at creation time, and the receive ring
tail pointer is correctly initialized (previously, things still worked
because the receive ring tail pointer was being fixed up as a side
effect of other activity).

Differential Revision: https://reviews.freebsd.org/D2922
Reviewed by: erj, gnn
Approved by: jmallett (mentor)
Sponsored by: Norse Corp, Inc.
2015-07-15 00:35:50 +00:00
Hiren Panchasara
df7b11fa09 Expose full 32bit RSS hash from card regardless of whether RSS is defined or
not. When doing multiqueue, we are all setup to have full 32bit RSS hash from
the card. We do not need to hide that under "ifdef RSS" and should expose that
by default so others like lagg(4) can use that and avoid hashing the traffic by
themselves.

While here, delete the FreeBSD version check and use of deprecated M_FLOWID.

Reviewed by:	adrian, erj
MFC after:	1 week
Sponsored by:	Limelight Networks
2015-07-14 09:13:18 +00:00
Luigi Rizzo
847bf38369 Sync netmap sources with the version in our private tree.
This commit contains large contributions from Giuseppe Lettieri and
Stefano Garzarella, is partly supported by grants from Verisign and Cisco,
and brings in the following:

- fix zerocopy monitor ports and introduce copying monitor ports
  (the latter are lower performance but give access to all traffic
  in parallel with the application)

- exclusive open mode, useful to implement solutions that recover
  from crashes of the main netmap client (suggested by Patrick Kelsey)

- revised memory allocator in preparation for the 'passthrough mode'
  (ptnetmap) recently presented at bsdcan. ptnetmap is described in
        S. Garzarella, G. Lettieri, L. Rizzo;
        Virtual device passthrough for high speed VM networking,
        ACM/IEEE ANCS 2015, Oakland (CA) May 2015
        http://info.iet.unipi.it/~luigi/research.html

- fix rx CRC handing on ixl

- add module dependencies for netmap when building drivers as modules

- minor simplifications to device-specific routines (*txsync, *rxsync)

- general code cleanup (remove unused variables, introduce macros
  to access rings and remove duplicate code,

Applications do not need to be recompiled, unless of course
they want to use the new features (monitors and exclusive open).

Those willing to try this code on stable/10 can just update the
sys/dev/netmap/*, sys/net/netmap* with the version in HEAD
and apply the small patches to individual device drivers.

MFC after:	1 month
Sponsored by:	(partly) Verisign, Cisco
2015-07-10 05:51:36 +00:00
John Baldwin
9e34aea25c Catch up to the SRIOV API changes in r283670. 2015-06-01 20:05:06 +00:00
Jack F Vogel
48056c88e1 Delta D2489 - Add SRIOV support to the Intel 10G driver.
NOTE: This is a technology preview, while it has undergone
      development testing, Intel has not yet completed full
      validation of the feature. It is being integrated for
      early access and customer testing.
2015-06-01 17:43:34 +00:00
Jack F Vogel
3012653750 Revert last commit, to remove added skeleton tree. 2015-06-01 17:35:29 +00:00