Commit Graph

311 Commits

Author SHA1 Message Date
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
Kevin Bowling
51e46835e1 ixgbe: Clean up ix_txrx
The intention here is to reduce differences with D30072.
The only functional change is logical simplification in
ixgbe_rx_checksum.

Reviewed by:	gallatin
Differential Revision:	https://reviews.freebsd.org/D30074
2021-07-17 23:25:56 -07:00
Kevin Bowling
7660e4ea5c ixgbe: Print FW NVM and Option ROM versions
It can be useful for system operators to see this kind of information
when correlating issues or requesting support from the OEM or Intel for
hardware and firmware issues.

Reviewed by:	gallatin
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30178
2021-07-15 23:53:23 -07:00
Sai Rajesh Tallamraju
64881da478 ixgbe: Restore AIM support
AIM (adaptive interrupt moderation) was part of BSD11 driver. Upon IFLIB
migration, AIM feature got lost. Re-introducing AIM back into IFLIB
based IXGBE driver.

One caveat is that in BSD11 driver, a queue comprises both Rx and Tx
ring. Starting from BSD12, Rx and Tx have their own queues and rings.
Also, IRQ is now only configured for Rx side. So, when AIM is
re-enabled, we should now consider only Rx stats for configuring EITR
register in contrast to BSD11 where Rx and Tx stats were considered to
manipulate EITR register.

Reviewed by:	gallatin, markj
Sponsored by:	NetApp, Inc.
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D27344
2021-05-03 13:47:14 -04:00
Kevin Bowling
fdbcd35a75 ixgbe: Improve device name strings
This is just clerical work to ease bug triage and may be used to set
expectations around the ability for anyone in the community to perform
testing and development on older parts.

Approved by:	erj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D29876
2021-04-28 10:29:59 -07:00
Kevin Bowling
deecaa1445 ixgbe: Clean up unneeded set in ixgbe_if_multi_set
We don't need to set the bits here since the if/else if/else statements
fully cover setting these bit pairs.

Reported by:	markj
Reviewed by:	markj, erj
Approved by:	#intel_networking
MFC aftter:	1 week
Differential Revision:	https://reviews.freebsd.org/D29827
2021-04-19 12:37:30 -07:00
Kevin Bowling
21afed4b1d ixgbe: Clarify index name in ixgbe_mc_filter_apply
"It looks like it would be less confusing to rename 'count' to
something like 'idx', since that's what it's used for in this
function."

Reviewed by:	erj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D29798
2021-04-16 18:20:41 -07:00
Mark Johnston
ffe3def903 iflib: Make if_shared_ctx_t a pointer to const
This structure is shared among multiple instances of a driver, so we
should ensure that it doesn't somehow get treated as if there's a
separate instance per interface.  This is especially important for
software-only drivers like wg.

DEVICE_REGISTER() still returns a void * and so the per-driver sctx
structures are not yet defined with the const qualifier.

Reviewed by:	gallatin, erj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29102
2021-03-08 12:39:06 -05:00
Piotr Pietruszewski
afb1aa4e6d ix(4): Report RX errors as sum of all RX error counters
HW keeps track of RX errors using several counters, each for
specific type of errors. Report RX errors to OS as sum
of all those counters: CRC errors, illegal bytes, checksum,
length, undersize, fragment, oversize and jabber errors.

Also, add new "rx_errs" sysctl in the dev.ix.N.mac_stats tree. This is
to provide an another way to display the sum of RX errors.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>

Reviewed By: erj
Tested By: gowtham.kumar.ks@intel.com
Sponsored By: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D27191
2021-03-02 17:25:32 -08:00
Matt Macy
81be655266 iflib: ensure that tx interrupts enabled and cleanups
Doing a 'dd' over iscsi will reliably cause stalls. Tx
cleaning _should_ reliably happen as data is sent.
However, currently if the transmit queue fills it will
wait until the iflib timer (hz/2) runs.

This change causes the the tx taskq thread to be run
if there are completed descriptors.

While here:

- make timer interrupt delay a sysctl

- simplify txd_db_check handling

- comment on INTR types

Background on the change:

Initially doorbell updates were minimized by only writing to the register
on every fourth packet. If txq_drain would return without writing to the
doorbell it scheduled a callout on the next tick to do the doorbell write
to ensure that the write otherwise happened "soon". At that time a sysctl
was added for users to avoid the potential added latency by simply writing
to the doorbell register on every packet. This worked perfectly well for
e1000 and ixgbe ... and appeared to work well on ixl. However, as it
turned out there was a race to this approach that would lockup the ixl MAC.
It was possible for a lower producer index to be written after a higher one.
On e1000 and ixgbe this was harmless - on ixl it was fatal. My initial
response was to add a lock around doorbell writes - fixing the problem but
adding an unacceptable amount of lock contention.

The next iteration was to use transmit interrupts to drive delayed doorbell
writes. If there were no packets in the queue all doorbell writes would be
immediate as the queue started to fill up we could delay doorbell writes
further and further. At the start of drain if we've cleaned any packets we
know we've moved the state machine along and we write the doorbell (an
obvious missing optimization was to skip that doorbell write if db_pending
is zero). This change required that tx interrupts be scheduled periodically
as opposed to just when the hardware txq was full. However, that just leads
to our next problem.

Initially dedicated msix vectors were used for both tx and rx. However, it
was often possible to use up all available vectors before we set up all the
queues we wanted. By having rx and tx share a vector for a given queue we
could halve the number of vectors used by a given configuration. The problem
here is that with this change only e1000 passed the necessary value to have
the fast interrupt drive tx when appropriate.

Reported by: mav@
Tested by: mav@
Reviewed by:    gallatin@
MFC after:      1 month
Sponsored by:   iXsystems
Differential Revision:  https://reviews.freebsd.org/D27683
2021-01-07 14:07:35 -08:00
Eric van Gyzen
ab1c54fec6 ixgbe: fix impossible condition
Coverity flagged this condition: The condition
    offset == 0 && offset == 65535
can never be true because offset cannot be equal
to two different values at the same time.

Submitted by:	bret_ketchum@dell.com
Reported by:	Coverity
Reviewed by:	tsoome, cem
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D26144
2020-08-21 19:34:41 +00:00
Eric Joyner
cf1509179c em/ix/ixv/ixl/iavf: Implement ifdi_needs_restart iflib method
Pursuant to r360398, implement driver-specific versions of the
ifdi_needs_restart iflib device method.

Some (if not most?) Intel network cards don't need reinitializing when a
VLAN is added or removed from the device hardware, so these implement
ifdi_needs_restart in a way that tell iflib not to bring the interface
up or down when a VLAN is added or removed, regardless of whether the
VLAN_HWFILTER interface capability flag is set or not.

This could potentially solve several PRs relating to link flaps that
occur when VLANs are added/removed to devices.

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

PR:		240818, 241785
Reviewed by:	gallatin@, olivier@
MFC after:	3 days
MFC with:	r360398
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D24659
2020-05-11 17:42:04 +00:00
Pawel Biernacki
20b91f0aa5 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (15 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.
2020-02-24 10:51:26 +00:00
Conrad Meyer
d09fbcd0b6 ixgbe(4): Eliminate bogus sizeof() expressions
All of these uses of sizeof() were on the wrong type in relation to the pointer
passed to SYSCTL_ADD_PROC as arg1.  Fortunately, none of the handlers actually
use arg2.  So just don't pass a (non-zero) arg2.

Reported by:	Coverity
CID:		1007701
2020-01-29 05:31:40 +00:00
Andriy Gapon
236204ee0f if_ixv: disable RSS configuration on 82599 and X540 VFs
It is reported that those VFs share their RSS configuration with PF and,
thus, they cannot be configured independently.

Also:
- add missing opt_rss.h to if_ixv.c, otherwise RSS kernel option could
  not be seen
- do not enable IXGBE_FEATURE_RSS on the older VFs
- set flowid / hash type to M_HASHTYPE_NONE or M_HASHTYPE_OPAQUE_HASH
  (based on what the hardware reports) if IXGBE_FEATURE_RSS is not set

Reviewed by:	nobody
MFC after:	4 weeks
Sponsored by: Panzura
Differential Revision: https://reviews.freebsd.org/D21705
2019-11-05 06:34:20 +00:00
Eric Joyner
e37d3dc11c ix: report isc_pause_frames during stat update
From Jake:
Notify the iflib stack of whether we received any pause frames during
the timer window. This allows the stack to avoid reporting a Tx hang due
to the device being paused.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>

Submitted by:	Jacob Keller <jacob.e.keller@intel.com>
Reviewed by:	gallatin@
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D21869
2019-10-16 17:16:32 +00:00
Eric Joyner
d61b6a41dd ixgbe: Disable EEE for backplane X550EM_X
From Zach:
Intel documentation indicates that backplane X550EM_X KR devices do not
support Energy Efficient Ethernet. Prior to this patch, X552 devices
(device ID 0x15AB) will crash the system when transitioning EEE state
via sysctl.

Signed-off-by: Zach Vargas <zvargas@xes-inc.com>

PR:		240320
Submitted by:	Zach Vargas <zvargas@xes-inc.com>
Reviewed by:	erj@
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D21673
2019-10-15 21:56:19 +00:00
Gleb Smirnoff
ba76aa6357 Convert if_foreach_llmaddr() KPI.
Reviewed by:	erj
2019-10-14 20:21:02 +00:00
Eric Joyner
749597dc1d ix, ixv: Read msix_bar from device configuration
Instead of predicting the MSI-X bar index based on the device's MAC
type, read it from the device's PCI configuration instead.

PR:		239704
Submitted by:	Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by:	erj@
MFC after:	3 days
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D21547
2019-09-24 17:06:32 +00:00