Commit Graph

329 Commits

Author SHA1 Message Date
Ian Moffett
99cb088f1a ixgbe: Fix typos in source code comments
- s/feilds/fields/

Reviewed by:	zlei
MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/707
2023-04-28 18:01:58 +08:00
Krzysztof Galazka
04a5e6d7ca
ixgbe(4): Filter out spurious link up indication
Extend SFP+ cage crosstalk fix by re-checking link state after 5ms delay
to filter out spurious link up indication by transceiver with no fiber
cable connected.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	erj@
Tested by:	Gowtham Kumar Ks <gowtham.kumar.ks@intel.com>
MFC after:	3 days
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D38395
2023-02-15 14:38:05 -08:00
Elliott Mitchell
29a4a60fff ixgbe: purge EOL release compatibility
Remove support for pre 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:05 -07:00
Andrew Gallatin
8de48df35c ixgbe: Do not count L3/L4 checksum errors as input errors
NIC input errors have traditionally indicated problems at the link
level (crc errors, runts, etc).  People tend to build monitoring
infrastructure  around such errors in order to monitor for bad network
hardware. When L3/L4 checksum errors are included in the category of
input errors, it breaks such monitoring, as these errors can originate
anywhere on the internet, and do not necessarily indicate faulty
local network hardware.

Reviewed by: erj, glebius
Differential Revision: https://reviews.freebsd.org/D38346
Sponsored by: Netflix
2023-02-02 10:14:12 -05:00
Justin Hibbits
ff06a8dbb6 Mechanically convert ixgbe(4) to IfAPI
Reviewed by:	erj
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37845
2023-01-24 15:05:28 -05:00
Andrey V. Elsukov
8526120ad4 ixgbe: workaround errata about UDP frames with zero checksum
Intel 82599 has errata related to IPv4 UDP frames with zero checksum.
It reports such datagrams with L4 integrity errors in IXGBE_XEC
register. And after afb1aa4e6d commit such errors are reported
via IFCOUNTER_IERRORS. This confuses users, since actually all frames
are handled correctly by the system.
To workaround the problem, let's ignore the XEC register value for
82599 cards for now.

PR:		266048
Discussed with:	erj
MFC after:	1 week
Sponsored by:	Yandex LLC
2022-11-10 12:34:40 +03:00
Kristof Provost
e7abb89701 ixgbe: fix software vlan handling
If hardware vlan tagging is disabled (after a vlan has been added) we
receive double-tagged packets, even if the packet on the wire only has a

single VLAN tag.  That looks like this:

	17:29:30.370787 00:51:82:11:22:02 > 90:ec:77:1f:8a:5f, ethertype 802.1Q (0x8100), length 64: vlan 0, p 0, ethertype 802.1Q, vlan 1001, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.101.0.12 is-at 00:51:82:11:22:02, length 42

This happens because the ixgbe driver does not clear the vlan flags in
the hardware (such as IXGBE_RXDCTL_VME) if IFCAP_VLAN_HWTAGGING is
cleared.

Add code to do so, which fixes this issue.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D36139
2022-08-17 16:39:18 +02:00
Neel Chauhan
4f1d91e413 if_ix: Reset on an ECC error
This mirrors the Linux behavior as seen in the kernel commit d773ce2.

Reviewed by:		kbowling
MFH after:		3 days
Differential Revision:	https://reviews.freebsd.org/D35542
2022-06-21 20:22:25 -07:00
Gordon Bergling
cd7e11f78d ixgbe(4): Fix common typos in source code comments
- s/filer/filter/

Obtained from:	NetBSD
MFC after:	3 days
2022-06-06 07:28:56 +02:00
John Baldwin
964c2b3a6f ix/ixv: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:39:31 -07:00
Kevin Bowling
395cc55d89 ixgbe: Update mc filter before FCTRL flags
Update mc filter array before changing FCTRL flags, similar to 5a3eb6207a

Approved by:	grehan
MFC after:	2 weeks
2022-04-13 08:59:21 -07:00
John Baldwin
c0a42a0451 ix: Remove cpu_id and related code from ixgbe_if_msix_intr_assign.
Reviewed by:	erj
Differential Revision:	https://reviews.freebsd.org/D34828
2022-04-12 17:01:46 -07:00
John Baldwin
c1710eaf32 ix: Mark variables only used in debug traces as unused. 2022-04-06 16:45:29 -07:00
Piotr Pietruszewski
d381c80751
ix(4): Add control of 2.5/5G autonegotiation speeds
This change enables the user to control 2.5G and 5G autonegotiation
speeds via advertise_speed sysctl for X550T devices. Due to reported
interoperability issues with switches, 2.5G and 5G speeds will not be
advertised by default.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Co-authored-by: Krzysztof Galazka <krzysztof.galazka@intel.com>

Tested by:	gowtham.kumar.ks@intel.com
MFC after:	3 days
Sponsored by:	Intel Corporation
Differential Revision: https://reviews.freebsd.org/D26245
2022-03-04 10:53:07 -08:00
Piotr Pietruszewski
a3e719bbc2
ixv(4): Allow PF to control the VF link state
This patch adds checks of a VF link state provided by PF via mailbox
API. Such change enables the PF to disable a VF administratively.

Since command needed by the PF to control the VF is introduced in
mailbox api version 1.2, this patch also bumps supported mailbox api
version to 1.2.

Co-authored-by: Krzysztof Galazka <krzysztof.galazka@intel.com>

Reviewed By:	kbowling@
Tested by:	lukasz.szczepaniak@intel.com
MFC after:	3 days
Sponsored by:	Intel Corporation
Differential Revision: https://reviews.freebsd.org/D32004
2022-03-04 10:53:07 -08: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
Gordon Bergling
8da5034954 ixgbe(4): Fix a few typos in source code comments
- s/Manageblility/Managebility/
- s/alows/allows/

MFC after:	3 days
Obtained from:	NetBSD
2021-11-03 16:16:20 +01:00
Kevin Bowling
3f66b96d86 ixgbe: Update shared code catchup
Leftovers from DPDK sync

Reviewed by:	grehan
Obtained from:	DPDK
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D31621
2021-10-06 18:45:55 -07:00
Kevin Bowling
15d077995b ixgbe: whitespace cleanup pass
Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32131
2021-09-26 11:29:02 -07:00
Kevin Bowling
b1d5caf3c7 ixgbe: Rename 'struct adapter' to 'struct ixgbe_softc'
Rename the 'struct adapter' to 'struct ixgbe_softc' to avoid type
ambiguity in things like kgdb.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32131
2021-09-26 11:18:07 -07:00
Qiming Yang
5fd1f4be8d ixgbe: increase the timeout
Increase SECRX_RDY polling frequency and semaphore timeout which
fixes the FWSW.PT check in ixgbe_mng_present().

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

Approved by:	imp
Obtained from:	DPDK (6175260d12cc22852cecf2fb7ecd95cdb07611b5)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 21:17:19 -07:00
Guinan Sun
46981e903c ixgbe: cleanup spelling mistakes in comments
Several functions in the driver code have a weird function comment
formatting which uses two spaces instead of only one space for the main
function body.

This formatting will be mechanically fixed by sed in a future patch, but
doing so leads to some spelling warnings on that patch. Cleanup the
spelling mistakes that will be detected first. This way, it is easier to
verify the mechanical transformation done by sed in the following patch.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (fc75eee32037c1379e77e57031c1c353badd2272)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 21:17:19 -07:00
Guinan Sun
3a89005394 ixgbe: remove unnecessary return value check
Remove unnecessary return value check.

Signed-off-by: Jakub Chylkowski <jakubx.chylkowski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (4b0ee6529b7897c2a08dd56669f07ac1f46a8474)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 21:17:19 -07:00
Guinan Sun
80a39a2bda ixgbe: create function to restart autoneg
This patch is for restarting auto negotiation on PHY.

Signed-off-by: Jakub Chylkowski <jakubx.chylkowski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (664ea2614eafbec8eda5c86764ff047475a1e5c6)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 21:17:19 -07:00
Guinan Sun
ff8db817ab ixgbe: add register definitions for NVM update
Added additional register for X550 and above device family.

Signed-off-by: Piotr Skajewski <piotrx.skajewski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (4a6847d78814b1c3df896efe31562643d419317d)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 21:17:18 -07:00
Guinan Sun
dc11ba4eb3 ixgbe: move increments after evaluations
The retry variable was being incremented before it was evaluated by the
subsequent conditional against the maximum retries to figure out which
message to print.  So we'll move the increment op to the end.

Signed-off-by: Jeb Cramer <jeb.j.cramer@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (390445ec30b4c52a3d2887c3d2a202d9cf37ea8e)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 21:17:18 -07:00
Kevin Bowling
4cdc5e12a8 ixgbe: remove whitespace in function comments
Remove unnecessary extra whitespace on all function comments, replacing
' *  ' with ' * '.

This was done automatically via sed using the following transformation:

  sed 's/^ \*  / * /'

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (40023f73c76579e58a859dab87b4c30278eb2e48)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 21:17:18 -07:00
Xiaoyun Li
9e65ae746d ixgbe: support DCB registers dump
Add support for DCB registers dump.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Approved by:	imp
Obtained from:	DPDK (36a036bc6fdd0da74576a39ab74e50954598ba82)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 21:17:18 -07:00
Xiaoyun Li
0a4f0befab ixgbe: update X550 SFP identification
Use ixgbe_identify_sfp_module_X550em to update SFP identification
flow. ixgbe_identify_sfp_module_X550em includes specific checks for
X550 about supported SFP modules.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Approved by:	imp
Obtained from:	DPDK (175bedb0cc8f801be3050fa35b8d8d0971cea7cc)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 21:17:13 -07:00
Kevin Bowling
8455e365f7 ixgbe: Update copyright to 2020
Synced to the ixgbe shared code with DPDK shared code which has local
fixes on top of "not-released-cid-ixgbe.2020.06.09.tar.gz"

Approved by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 20:13:28 -07:00
Ferruh Yigit
0b487fb454 ixgbe: remove dead code
The question around getting rid of the assignments seems lived
long enough, if they are not needed until now, we can drop them.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Approved by:	imp
Obtained from:	DPDK (a6395d471e14e5a7432875dad8fb3533238c5167)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 20:06:53 -07:00
Xiaoyun Li
c85b6f2901 ixgbe: replace an operation in X550 setup
Replace "=" operation with "|=" operation to only set the intended
register bits.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Approved by:	imp
Obtained from:	DPDK (1b665ccd9cd73499e934b807bec2fd77193912ef)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 20:01:35 -07:00
Kevin Bowling
79b36ec91d ixgbe: Use C99 bool types
Approved by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:54:22 -07:00
Xiaoyun Li
b622bdb4eb ixgbe: add FW recovery mode check
Add FM NVM recovery mode check. Allow the software to detect this.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Approved by:	imp
Obtained from:	DPDK (5fb0a9acbb844b21691568c0014866e0e887bd19)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:40:59 -07:00
Guinan Sun
994dd6328c ixgbe: add typecast for type mismatch
Add typecast for type mismatch.

Signed-off-by: Jakub Chylkowski <jakubx.chylkowski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (d8e52b2cf771c31b523b46852fd86225b5a2c721)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:30:05 -07:00
Ashijeet Acharya
d5bbb5500c ixgbe: wait for link after copper MAC setup
After setting up the link on x552/X557-AT 10GBASE-T NICs, sometimes the
link does not get set up properly and as a result all the subsequent
calls to ixgbe_check_link() from ixgbe_dev_link_update_share() fail.

Introduce a delay time of 1s in ixgbe_setup_mac_link_t_X550em() before
beginning to set up the external PHY link speed to ensure that the
controller can acquire the link.

Signed-off-by: Ashijeet Acharya <ashijeet.acharya@6wind.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Approved by:	imp
Obtained from:	DPDK (d31b95860d8e9dd7c6e242bd08baaac00a9714f0)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:13 -07:00
Guinan Sun
c1a56b6f5f ixgbe: check host interface return status
Writing to read-only fields returns a non-OK Return Status
for shadow RAM write command for X550.
This information was previously discarded.

Signed-off-by: Stanislaw Grzeszczak <stanislaw.a.grzeszczak@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (db18e37090a3b9af47d6a6886248520f6b220bf9)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:12 -07:00
Guinan Sun
b3ebe337ff ixgbe: initialize data field in struct buffer
While sending request using ixgbe_hic_unlocked() the data field in
buffer struct is not used. It is set when the struct is overwritten by
FW to deliver the response. To not pass random data to FW the whole
structure should be zeroed before use.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (40543be5376ca415b2a7e196315d0555725b8bdf)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:12 -07:00
Guinan Sun
8e9f1b239d ixgbe: fix x550em 10G NIC link status
With the NVM image for x550em XFI will not report
the auto-negotiation feature correctly. The auto-negotiation
should be "No" for supports and advertised items.
At the same time update speed makes it support 1G and 10G.

Signed-off-by: Piotr Skajewski <piotrx.skajewski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (fb03b51da940f1d56d701776fd85a0dfc1ace098)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:12 -07:00
Xiaolong Ye
96ef6eb3ae ixgbe: fix maximum wait time in comment
As the code has changed the max wait time to 1000ms, the comment should
be changed accordingly.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Approved by:	imp
Obtained from:	DPDK (73247f1ced303c16987bb366d38a2d8a0fc40db4)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:12 -07:00
Matthew Smith
aaa3af802f ixgbe: wait longer for link after fiber MAC setup
After setting up the link on a fiber port, the maximum wait time for
the link to come up is 500 ms in ixgbe_setup_mac_link_multispeed_fiber().
On an x550 SFP+ port, this is often not sufficiently long for the link
to come up. This can result in never being able to retrieve accurate
link status for the port using rte_eth_link_get_nowait().

Increase the maximum wait time in ixgbe_setup_mac_link_multispeed_fiber()
to 1 s.

Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Approved by:	imp
Obtained from:	DPDK (64f1c8539c8ce99214b9eb1fb728a2c6745f3300)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:12 -07:00
Guinan Sun
31a23e3eb5 ixgbe: fix host interface shadow RAM read
Host interface Shadow RAM Read (0x31) command response
buffer length should be stored in two bytes, instead of one byte.
This patch fixes it.

Signed-off-by: Mateusz Kowalski <mateusz.kowalski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (713fc4dd340e5eadd3bfa9a468446afaa5188624)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:11 -07:00
Guinan Sun
c966c431c7 ixgbe: fix response to apply-update command
For the "Apply Update" command the firmware does not
given an response. For this command, success should
be return.

Signed-off-by: Mateusz Kowalski <mateusz.kowalski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (03b09c71c0c6c516ce05cad8e8aa75e8b9e14fba)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:11 -07:00
Guinan Sun
f511cd2258 ixgbe: improve log about autoneg being disabled
On ESXi OS, when user disables auto negotiation, the following log
appears: "(unsupported) Flow control autoneg is disabled".
It is true that auto negotiation is disabled but it is
not necessarily true that it is not supported.

Signed-off-by: Jakub Chylkowski <jakubx.chylkowski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (ab6ac48d483ef7f906b90f45182f2ddf3254d876)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:11 -07:00
Guinan Sun
c4f73d5d6a ixgbe: add IPv6 mask for flow director
Write FDIRIP6M register to allow flow director filter
to set ipv6 rules without setting ipv6 source/destination address.

Signed-off-by: Piotr Skajewski <piotrx.skajewski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (21feefa2fcd5899ee26a10be405c17c0a1109860)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:11 -07:00
Guinan Sun
8270b7174c ixgbe: fix infinite recursion on PCIe link down
In some corner cases the functions ixgbe_clear_rar_generic and
ixgbe_clear_vmdq_generic may call one another leading to infinite
recursion.

When ixgbe_clear_vmdq_generic is called with IXGBE_CLEAR_VMDQ_ALL
flag, it's going to clear MPSAR registers, and proceed to call
ixgbe_clear_rar_generic, which in turn will clear the RAR registers,
and recursively call back ixgbe_clear_vmdq_generic. Normally, the
latter would detect that MPSAR registers have already been cleared
and terminate the recursion.

However, when PCIe link is down, and before the driver has had the
opportunity to shut itself down, all register reads return 0xFFFFFFFF,
and all register writes fail silently. In such case, because
ixgbe_clear_vmdq_generic blindly assumes that clearing MPSAR registers
succeeded, it's going to always call ixgbe_clear_rar_generic, which
in turn will always call back ixgbe_clear_vmdq_generic, creating
infinite recursion.

This patch re-reads MPSAR register values after they had been cleared.
In case of PCIe link failure, the values read will be non-zero, which
will terminate the recursion. On the other hand, under normal
circumstances the value read from MPSAR registers is going to be equal
to the value previously written, so this patch is expected not to cause
any regressions.

Signed-off-by: Robert Konklewski <robertx.konklewski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>

Approved by:	imp
Obtained from:	DPDK (2d04b9e856125197ec8e967471426d56ab7efcf0)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:11 -07:00
Simon Ellmann
7165504a17 ixgbe: clear all queues on VF reset
ixgbe devices support up to 8 Rx and Tx queues per virtual function.
Currently, the registers of only seven queues are set to default when
resetting a VF.

Signed-off-by: Simon Ellmann <simon.ellmann@tum.de>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>

Approved by:	imp
Obtained from:	DPDK (d2565b347915def3a0f3c68bde6824acf096a0e6)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31621
2021-09-06 19:22:11 -07:00
Kevin Bowling
5de5419b5e ixgbe: Avoid sbuf_trim(9) in sysctl handler
This was an error, we cannot use sbuf_trim(9) in the
ixgbe_sbuf_fw_version function because it also gets called in
the context of sbuf_new_for_sysctl(9). sbuf(9) explains the interaction
with drain functions as used by sbuf_new_for_sysctl(9).

Reviewed by:	imp
Fixes:		7660e4ea5c
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D31633
2021-08-23 10:28:59 -07:00
Kevin Bowling
0e5811a2a9 intel ethernet: Use ether_gen_addr(9)
Use ether_gen_addr(9) for VF MAC generation

Reviewed by:	Intel Networking (erj), kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31616
2021-08-20 14:21:48 -07:00