Home | History | Annotate | Download | only in ixgbe
History log of /src/sys/dev/pci/ixgbe/ixgbe.c
RevisionDateAuthorComments
 1.354  10-Jul-2024  msaitoh ixgbe: Remove ifdef NET_MPSAFE. Make ixgbe MP-scalable by default.

Same as wm(4).
 1.353  10-Jul-2024  msaitoh ixgbe: ixgbe is always MP-safe, so remove IXGBE_MPSAFE macro.

Before this change, IXGBE_MPSAFE is not defined if NET_MPSAFE is not set.
In this case, the PCI_INTR_MPSAFE flag is not set by pci_intr_setattr()
and interrupt_distribute() fails on arm. Always enable IXGBE_MPSAFE
funciton by removing the macro.
 1.352  29-Jun-2024  riastradh if_stats(9): Add ifp argument to if_stat..._ref.

This will enable us to pass the ifp through to a dtrace probe inside.

No functional change intended in this change, but this is an API
change visible to modules so it shouldn't be pulled up.

PR kern/58377
 1.351  30-May-2024  msaitoh Move RECOVERY_MODE feature test code for readability. No functional change.

ixgbe.c rev. 1.169 inserted RECOVERY_MODE feature test in between
MSI-X allocation and legacy allocation. To improve code readability,
move it to earlier location.
 1.350  13-May-2024  msaitoh Modify comment. The number of queues is not limited to 8.

The number of queue is calculated from both the number of CPUs and
the number of MSI-X vectors.
 1.349  24-Jan-2024  msaitoh ixgbe: Add QPRDC into iqdrops.

A receive packet might drop at two different locations.
One is the packet buffer that packets are received into the chip first.
If the packet buffer is overflowed, the MPC register is incremented.
It's currently added to iqdrops. It's no problem.
Another is descriptor ring(s). A packet from the packet buffer is DMA'ed
into main memory base on the descriptor ring. If the ring is full, the packet
is dropped and the QPRDC register is incremented. It should be added to
iqdrops but it was not done. Fix it.
Reported by ozaki-r@.
 1.348  15-Nov-2023  msaitoh ixgbe: Clear the WTHRESH bit field before writing it.
 1.347  02-Nov-2023  yamaguchi Use ether_bpf_mtap only when the device supports vlan harware tagging

The function is bpf_mtap() for ethernet devices and *currently*
it is just handling VLAN tag stripped by the hardware.
 1.346  02-Nov-2023  msaitoh ixgbe: Whitespace. No functional change.
 1.345  30-Oct-2023  msaitoh ixgbe: Fix comment. No functional change.
 1.344  18-Oct-2023  msaitoh ixgbe: Whitespace. No functional change.
 1.343  12-Oct-2023  msaitoh ixgbe: Don't override the {ixgbe,ixv}_max_interrupt_rate global variable.

Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change all
devices all queues default interrupt rate.
 1.342  12-Oct-2023  msaitoh ixg(4): Don't print wrong error message about ixgbe_num_queues.

Don't override the ixgbe_num_queues global variable. It's the default
value of the number of queues and should not override it because it
will be referenced by later device attach. For example, the number of
MSI-X vector is 64 on X540 and 18 on 82599. When both cards are inserted
to a machine that the number of CPU is 24 and X540 is probed earlier,
ixgbe_num_queues is overridden to 24 and the following error message is
printed when attaching 82599:

ixg2: autoconfiguration error: ixgbe_num_queues (24) is too large,
using reduced amount (17).

Note that the number of queues is in sc->num_queuss and referenced
by hw.ixgN.num_queues sysctl.
 1.341  12-Oct-2023  msaitoh ixgbe: Whitespace. No functional change.
 1.340  11-Oct-2023  msaitoh ixg(4): Print DEVICE_CAPS register.
 1.339  11-Oct-2023  msaitoh ixg(4): Whitespace. No functional change.
 1.338  06-Oct-2023  msaitoh ixgbe: Cleanup. No fucntional change.

Remove unused code, fix whitespace and modify comment to reduce against
FreeBSD(mainly from ix-3.3.35).
 1.337  06-Oct-2023  msaitoh ixgbe: Enable interrupt after setting IFF_RUNNING. Same as FreeBSD x-3.3.35.
 1.336  06-Oct-2023  msaitoh ixgbe: Modify error message of wrong TX/RX descriptor size.

- Based from FreeBSD ix-3.3.35. I think ix-3.3.35's RING_INCREMENT(== 32)
is wrong. It should be 8(DBA_ALIGN / sizeof(union ixgbe_adv_[tr]x_desc)).
Linux also uses 8.
 1.335  06-Oct-2023  msaitoh ixgbe: Simplify definitions. No functional change.

Both DEFAULT_{TX,RX}D and PERFORM_{TX,RX}D are 2048. Use DEFAULT_{TX,RX}D.
Same as FreeBSD.
 1.334  06-Oct-2023  msaitoh ixg(4): Add 82599 LS once again.

- From:
FreeBSD: 9228ac3a69c4c7401a743e6465e118101a2beeb0
DPDK: 549ccd3dc01539e060597b503f2b65b272de3347
- This was removed 5 years ago. From the commit message:
> Remove IXGBE_DEV_ID_82599_LS(0x154f) support again. I don't know why. This
> was added in ix-3.2.18.tar.gz(NetBSD: ixgbe_82599.c rev. 1.20) and
> removed in ix-3.3.6.tar.gz.
 1.333  06-Oct-2023  msaitoh ixgbe: Rename some definitions, modify comment. No functional change.

Apply changes from FreeBSD's ix-3.3.31 and ixv-1.5.32.
- struct adapter *adapter -> struct ixgbe_softc *sc
- master -> primary
- black -> block
 1.332  06-Oct-2023  msaitoh ixg(4): Update FCTRL after writing multicast filter. Same as other OSes.

From FreeBSD 395cc55d896654b8f75071e71e856b22aed87da5.
 1.331  14-Sep-2023  msaitoh ixg(4): Rename some descriptions of flow control related event conters.
 1.330  14-Sep-2023  msaitoh ixg(4): Reorder some flow control related event counters for readability.
 1.329  13-Sep-2023  msaitoh ixg(4): Count Queue Bytes {Transmit, Receive} counter.
 1.328  13-Sep-2023  msaitoh ixg(4): Rename some descriptions of event counters.

- Rename some descriptions from register name to the meaning.
- For the same meaning's counters, add "(soft)" or "(reg)".
The former is for a software level counter and the latter is for a
statistics counter register based.
 1.327  13-Sep-2023  msaitoh ixgbe: Reorder some event counters for readability.
 1.326  15-May-2023  msaitoh Count the number of link down events in the MAC using with LINK_DN_CNT.

- Add new event counter "link_dn_cnt" to count the number of link down
events in the MAC.
- The LINK_DN_CNT register (at 0x0403c) is described only in the
Denverton's datasheet, so use it only on ixgbe_mac_X550EM_a.
 1.325  03-Feb-2023  msaitoh Use thermal sensor code for IXGBE_DEV_ID_X550EM_A_10G_T, too.

PCI device ID 0x15c8 also use X557-AT PHY, so create the thermal sensor
sysctl for it, too.
 1.324  28-Oct-2022  msaitoh branches: 1.324.2;
Make three "Unsupported SFP+ module..." messages the same.
 1.323  06-Jul-2022  msaitoh Call txeof first, then rxeof for the consistency.

There are three functions where the txeof and rxeof are called. The legacy
interrupt function and MSI-X function call rxeof first, then rxeof.
For the workqueue function. rxeof is called first. Modify it to match with
other two.
 1.322  18-Jun-2022  skrll aprintf_normal -> aprint_normal
 1.321  02-Jun-2022  msaitoh Modify comment. ixgbe_enable_queue() can be used on both MSI-X and legacy intr.
 1.320  02-Jun-2022  msaitoh KNF. Modify comment. No functional change.
 1.319  02-Jun-2022  msaitoh KNF. No functional change.
 1.318  01-Jun-2022  msaitoh Correctly enter the recovery mode. Not tested.
 1.317  01-Jun-2022  msaitoh Correctly re-enable queue interrupt in ixgbe_legacy_irq().

- Don't enable queue 1-15 interrupt.
- Don't enable queue 0 interrupt when the queue work is being scheduled.
- OK'd by knakahara.
 1.316  01-Jun-2022  msaitoh Simplify ixgbe_msix_que(). No functional change.
 1.315  30-May-2022  msaitoh Fix a bug that the legacy interrupt doesn't work when MSI-X allocation failed.
Fixes PR kern/56857.
 1.314  25-Apr-2022  msaitoh Add missing num_tx_desc sysctl.
 1.313  25-Apr-2022  msaitoh Limit {tx,rx}_process_limit sysctl values from 1 to num_{tx,rx}_desc.
 1.312  10-Mar-2022  msaitoh Print ECC, PHY and temp error log using with ratecheck().

- The ratecheck() is for just in case. All of the interrupts might occur
only once, but I don't know whether it's true or not. For the fan failure,
it seems it occurs only once.
- All of the interval is 60s.
 1.311  10-Mar-2022  msaitoh Enclose flow director stuff in ixgbe_intr_admin_common() with IXGBE_FIR.
 1.310  10-Mar-2022  msaitoh Move the definition of eicr_mask variable. No functional change.
 1.309  10-Mar-2022  msaitoh Modify comment to clarify EIAC setting.
 1.308  10-Mar-2022  msaitoh Add IFF_RUNNING check in ixgbe_legacy_irq() again.

- This change might fix small race between ifconfig down and an interrupt.
If the race really exists, txeof() is called and it's not so dangerous.
The rxeof is blocked in the beginning of ixgbe_handle_que().
- This change makes consistent with ixgbe_handle_que().
- Found and OK'd by knakahara.
 1.307  16-Feb-2022  msaitoh Print Printed Board Assembly (PBA) number.
 1.306  01-Feb-2022  msaitoh Increment legacy interrupt counter after checking INTx sharing.
 1.305  25-Jan-2022  msaitoh Use atomic_{load,store}_relaxed() for event counters.
 1.304  18-Jan-2022  msaitoh Use 64bit for lxon + lxoff.
 1.303  17-Jan-2022  msaitoh Fix ierror counting again.

ixgbe.c rev. 1.298 added total values kept in evcnt(9) instead of
incremental values read from registers. Fix it.
 1.302  31-Dec-2021  riastradh sys: Use if_init wrapper function.

Exception: Not in kern_pmf.c, for the kind of silly reason that it
avoids having kern_pmf.c refer to symbols defined only in net; this
avoids a pain in the rump.
 1.301  24-Dec-2021  msaitoh Add code to support API version 1.5. No functional change.

- This change adds almost all code to support API 1.5 except real negotiation
and upgrade mailbox functions.
- From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.
 1.300  16-Dec-2021  msaitoh Print NVM image version on 82598.

FreeBSD ix-3.3.29 added code to decode NVM version. On 82598, the NVM
offset is NVM_EEP_OFFSET_82598(== 0x2a). My own three different 82598
cards' value in NVM_EEP_OFFSET_82598 are 0xffff. Instead, the dev starter
version (0x29) has the value. Two of them have 0x1070 and another has 0x2090.
The 82598 specification update notes about 2.9.0.
 1.299  15-Dec-2021  msaitoh Improve PHY's dmesg output for non-MIIVERBOSE case.
 1.298  14-Dec-2021  msaitoh Add some missing error counters to ierror.

- FreeBSD: afb1aa4e6df245d38fd2ba683fa521d5dabe8392 or ix-ix-3.3.22
- Note that the checksum error is not added to the ierror.
 1.297  10-Dec-2021  msaitoh Move PF mailbox initialization from ixgbe_attach() to ixgbe_init_iov().

From FreeBSD ix-3.3.18. No functional change.
 1.296  10-Dec-2021  msaitoh No functional change.

- Sync with FreeBSD ix-3.3.18.
- Rename ixgbe_get_advertise() to ixgbe_get_default_advertise.
- Sort lines, modify comment and whitespace to reduce diff against FreeBSD.
 1.295  07-Dec-2021  andvar fix typos in word "instead", mainly in log messages.
 1.294  12-Nov-2021  skrll KNF
 1.293  30-Sep-2021  yamaguchi Remove vlan_ifdetach() from ixgbe_detach()

The removed function is called in ether_ifdetach().
And ether_ifdetach is changed to be called before a device
is stopped, because vlan_ifdetach called from ether_ifdetach
configures VLAN settings.
 1.292  16-Sep-2021  msaitoh Fix a bug that an mbuf chain which has more than 63488bytes MAY fail on TX.

- Currently, The TX buffer dmamap's max number of segments is set to 32.
MCLBYTES(== 2048) * 32 = 65536 and it's enough for IP_MAXPACKET(65535).
If an mbuf chain has more than 32 mbufs, we call m_defrag() to make
it lower than equal to 32, but it might not work. The reason is that
our m_defrag() don't modify the first mbuf entry of the chain. e.g.:
if an mbuf chain contains 63600bytes data and the first mbuf has 100bytes
in the m_data, the new chain has 100+2048+2048+...+12 and the total number
of the chain is not 32 but 33. It result in 43 TCP packets will drop.
- One of the way to fix this problem is to change m_defrag() which add a
new mbuf cluster to the first mbuf. It's need discussion.
- Another solution is to change the max number of the TX DMA segment.
It should be at least 33 to avoid the m_defrag()'s current limitation.
The document (82599-X550 DS 7.2.1.1 "Transmit Storage in system Memory")
says that a packet can be fragmented into 40 - WTHRESH - 2 (for 82598,
the document say nothing and some people and code says it's unlimited).
Currently WTHRESH is set to 8. 40 - 8 - 2 = 30. !?!?!? {Net,Free,Open}BSD
and Linux use 32. Is that safe? Anyway, we change WTHRESH from 8 to 5
to fit it. The added comment in ixgbe.h is based on DragonFly's
though they don't use WTHRESH.
- Yet another solution is to use the Tx Head Pointer Write Back function
instead of WTHRESH based write back (see 82599-X550 DS 7.2.3.5.2
"Tx Head Pointer Write Back" or 82598 "Transmit Completions Head Write Back"
). DragonFly, illumos and DPDK use it.
- Yet yet another solution is to add tso_maxsize entry to struct ifnet
and use it in the TCP stack.
 1.291  16-Sep-2021  msaitoh Use IXGBE_TXDCTL_WTHRESH_SHIFT macro. No functional change.
 1.290  26-Aug-2021  msaitoh Remove "j" or "jumbo" because we always use MCLBYTES sized buffer.
 1.289  25-Aug-2021  msaitoh Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.

- Before this commit, resource shortage was easily occurred because the total
number of the clusters is small.

- Reviewed by knakahara and ryo.
 1.288  20-Aug-2021  andvar fix various typos in comments and log messages.
 1.287  15-Jul-2021  msaitoh Add a new sysctl to read rxr->next_to_refresh.
 1.286  07-Jul-2021  msaitoh Add new sysctl "rx_copy_len".

ixgbe_rxeof() has an optimization "RX_COPY" to reduce costs of
bus_dmamap_load_mbuf() and bus_dmamap_unload() by copying a mbuf cluster's
memory to a newly allocated mbuf's MH_databuf[] and recycle the original map.
The optimization is used when a length of a packet is smaller than a specific
value. The value is calculated based on MHLEN. The size of MHLEN is
architecture specific. It's 256 or 512. Make the threshold controllable by
adding a new sysctl.
 1.285  29-Jun-2021  pgoyette Rework the xxxVERBOSE option to share the common module-hook-based
verbose mechanism with MIIVERBOSE. This reduces some duplicated code
and allows us to once again permit auto-unload of MIIVERBOSE.

Change details:
* Update dev/devlist2h.awk to accomodate miidevs, including generation
of MII_STR_oui_model definitions and use of oui and model rather than
vendor and product. This also changes the compressed data in the
xxxdevs_data.h files to uint32_t (since mii oui's are up to 6 hex
digits long)
* Update a couple of phy drivers to use new calls to get verbose data
* Regen all of the xxxdevs{,_data}.h files (separate commit, coming
very soon)
* Update mii/mii_verbose.[ch] and mii/mii_physubr.c to use the various
DEV_VERBOSE_xxx macros
* Update the pci, usb, and hdaudio code as needed, to #include the
xxxdevs.h files (in order to get the proper printf format strings)
* Since dev/dev_verbose.c now uses non-literal printf format strings,
(to deal with the vendor/product vs oui/model issue), we need to
make sure it gets compiled with -Wno-error=format-nonliteral, even
in userland's libpci and librumpdev!
* Bump kernel version for the change in module interfaces

Welcome to 9.99.86!

XXX It might be useful in the future to extend the MII_STR_oui_model
XXX definitions to PCI as well (and perhaps USB and HDAUDIO). This
XXX would allow for a single centralized location for the products'
XXX descriptions, rather than being dispersed among individual
XXX drivers' xxx_match tables.
 1.284  16-Jun-2021  riastradh if_attach and if_initialize cannot fail, don't test return value

These were originally made failable back in 2017 when if_initialize
allocated a softint in every interface for link state changes, so
that it could fail gracefully instead of panicking:

https://mail-index.NetBSD.org/source-changes/2017/10/23/msg089053.html

However, this spawned many seldom- or never-tested error branches,
which are risky to have around. And that softint in every interface
has since been replaced by a single global workqueue, because link
state changes require thread context but not low latency or high
throughput:

https://mail-index.NetBSD.org/source-changes/2020/02/06/msg113759.html

So there is no longer any reason for if_initialize to fail. (The
subroutine if_stats_init can't fail because percpu_alloc can't fail
either.)

There is a snag: the softint_establish in if_percpuq_create could
fail, potentially leading to bad consequences later on trying to use
the softint. This change doesn't introduce any new bugs because of
the snag -- if_percpuq_attach was already broken. However, the snag
can be better addressed without spawning error branches, either by
using a single softint or making softints less scarce.

(Separate commit will change the signatures of if_attach and
if_initialize to return void, scheduled to ride whatever is the next
convenient kernel bump.)

Patch and testing on amd64 and evbmips64-eb by maya@; commit message
soliloquy, and compile-testing on evbppc/i386/earmv7hf, by me.
 1.283  18-May-2021  msaitoh - Cleanup an rxbuf entry when bus_dmamap_load_mbuf() failed to prevent panic.
- Print error number when error occurred.
 1.282  07-May-2021  msaitoh branches: 1.282.2;
Print the error value of ixgbe_reset_hw() for debugging.
 1.281  30-Apr-2021  msaitoh Add missing __KERNEL_RCSID().
 1.280  31-Mar-2021  msaitoh branches: 1.280.2;
KNF a bit. No functional change.
 1.279  09-Mar-2021  msaitoh branches: 1.279.2;
Modify some parameters to reduce packet dropping.

- Background: ixgbe doesn't use common MCLGET() interface and use the
driver specific cluster allocation mechanism (jcl). The cluster is
pre-allocated with a fixed number and the current number per queue
is num_rx_desc * 2 (2048*2=4096). It's too small. It also has a problem
that the max length of the pcq which is used in the TX path is big
(4096). Example:

100M <----- [ixg0 ixg1] <----- 1G
2048 TX descs <--- 4096 pcqs <---- 2048 RX descs

If a machine forwards a traffic from 1G interface to 100M interface,
It would require 2048+4096+2048=8192 descriptors, but the current number
is 2048*2=4096. It's too small. Even if the both interface's link speed
is the same and only small number of packet is queued in the pcq, 4096
jcl is small because 2048(RX)+TX(2048)=4096. If jcl is exhausted, not only
forwarding from ixg1 to ixg0 is dropped, but also another forwarding path
from ixg1 to another interface(e.g. wm0) is also dropped. Sockets also
queue packets, so if a lot of sockets are used and/or a socket buffer
size is changed to bigger one, it'll also become a problem. If the jcl
is exhausted, evcnt(9) counter "ixgX qY Rx no jumbo mbuf" is incremented.
Example:
vmstat -ev | grep ixg1 | grep "no jumbo"
ixg1 q0 Rx no jumbo mbuf 0 0 misc
ixg1 q1 Rx no jumbo mbuf 0 0 misc
ixg1 q2 Rx no jumbo mbuf 141326 0 misc
ixg1 q3 Rx no jumbo mbuf 0 0 misc


- To solve this problem:
- Add new config parameter IXGBE_JCLNUM_MULTI and set the default to 3
(2048 * 3). The minimum number is 2. The total number of jcl per queue
is available with hw.ixgN.num_jcl_per_queue sysctl.
- Reduce the max length of the pcq() which is used in the TX path from
4096 to 2048.

- Reviewed by knakahara@ and ozaki-r@.

- TODO: Use MCLGET().
 1.278  14-Jan-2021  msaitoh Add "TX " to "Queue No Descriptor Available" to make it more understandable.
 1.277  31-Dec-2020  msaitoh Reduce code duplication. No functional change.

Add new ixgbe_intr_admin_common() and use it in both ixgbe_msix_admin()
and ixgbe_legacy_irq().
 1.276  26-Dec-2020  msaitoh Copy & paste some missing part (flow director, ECC and temp sensor) from
ixgbe_msix_admin() to ixgbe_legacy_irq(). Now it's ready to make a new
function to share the common part. It'll be done in near future.
 1.275  26-Dec-2020  msaitoh Don't return in the middle of ixgbe_msix_admin() when an flow director reinit
failed. NetBSD currently doesn't support flow director, so this is not a real
bug.
 1.274  26-Dec-2020  msaitoh Disable some interrupt in ixgbe_{legacy_irq,msix_admin}() to prevent log spam.
 1.273  26-Dec-2020  msaitoh Disable/enable the OTHER interrupts correctly.

The OTHER interrupt was not blocked correctly when MSI-X is used.
ixgbe.c rev. 1.260 added new mutex to avoid the race but it didn't
disable the interrupt itself.

Calling ixgbe_enable_intr() enables all interrupts, so it's not good to
call it when some interrupt sources should not be enabled (e.g.:
calling ixgbe_enable_intr() in ixgbe_handle_admin() enables queue
interrupt).

IXGBE_REQUEST_TASK_NEED_ACKINTR doesn't work as expected because
ixgbe_handle_admin() can't know which task is enqueued from the
interrupt context and can't re-enable a specific EIMS bit.

Solve the above three problems by the following two changes:

- MSI-X: Disable the OTHER interrupts in the biginning of
ixgbe_msix_admin().

- Set mask bits correctly at the end of ixgbe_legacy_irq() and
ixgbe_msix_admin() using with eim_orig, eims_enable and eims_disable.

- Remove IXGBE_REQUEST_TASK_NEED_ACKINTR and add
IXGBE_REQUEST_TASK_{MOD,MSF}_WOI.
 1.272  26-Dec-2020  msaitoh Check EICR's queue bit instead of IFF_RUNNING. This change fixes a bug that
it might incorrectly enable interrupt when IFF_RUNNING is not set. It also
changes that the TX/RX is not processed if a queue interrupt isn't occurred.
 1.271  26-Dec-2020  msaitoh Don't use "more" flag for simplify in ixgbe_legacy_irq().
No functional change intended.
 1.270  24-Dec-2020  msaitoh Simplify setting of EIAC register. No functional change intended.
 1.269  24-Dec-2020  msaitoh Fix a bug that INTx is disabled if the INTx line is shared with other device.
ixgbe.c rev. 1.264 was not correct.

Restore EIMS before return. To read ECIR, clearing EIMC is required for
an errata, so
0) save the original EIMS value
1) clear EIMS
2) read EICR
3) restore with the saved value.
 1.268  24-Dec-2020  msaitoh The EICR register are cleared in the beginning of the ixgbe_legacy_irq(),
so it's not required to clear each bit later in the function.
 1.267  24-Dec-2020  msaitoh The EICR register's all OTHER interrupt bits are cleared in the beginning of
the ixgbe_msix_admin(), so it's not required to clear each bit later in the
function.
 1.266  24-Dec-2020  msaitoh Reorder some code to reduce diff between ixgbe_legacy_irq() and
ixgbe_msix_admin. No functional change intended.
 1.265  24-Dec-2020  msaitoh Add some debug printf()s and modify comments.
 1.264  24-Dec-2020  msaitoh Remove strange ixgbe_enable_intr() in ixgbe_legacy_irq().

If the interface is UP and the INTx line is shared with other devices,
it result in enabling all interrupt sources even if some of them are
disabled for the workqueue. Delete ixgbe_enable_intr() in ixgbe_legacy_irq().
 1.263  22-Dec-2020  msaitoh Correctly ACK the fan failure interrupt in ixgbe_legacy_irq().
 1.262  11-Dec-2020  msaitoh Don't use EIMC_OTHER bit because it's read only other than 82598.

Documents say:

82598:
All of bit 31(OTHER bit) of EIxx are reserved. In reality, at least
EIMS_OTHER and EIMC_OTHER exist and the OTHER interrupt doesn't work
without EIMS_OTHER.

Other than 82598:
EIMS_OTHER is read only and EIMC_OTHER doesn't exist. If one of
bit 29..16 is set, EIMS_OTHER is set to 1 (Note that bit 30(TCP timer
isn't included)). Even if write bit 31 of EIMC to 1, it's ignored
(EIMS_OTHER doesn't set).

We introduced new spin mutex in ixgbe.c rev. 1.260, so it's OK to remove
EIMC_OTHER stuff. We already set EIMS_OTHER in if_init(), so keep it for
82598. No functional change other than 82598.

Another solution is to control bit 30..16 directly to mask/unmask interrupt
instead of the mutex.

TODO:
Some MSI-X interrupt(LSC, module insertion/removal etc.)'s mask/unmask
code between ixgbe_msix_admin() and ixgbe_handle_admin() may be wrong.
It'll be fixed later.
 1.261  30-Nov-2020  msaitoh Apply ixgbe.c rev. 1.204 which was for ixgbe_msix_admin() to
ixgbe_legacy_irq(), too.

> An interrupt might not arrive when a module is inserted. When an link
> status change interrupt occurred and the driver still regard SFP as
> unplugged, issue the module softint before issuing LSC interrupt.

TODO: Reduce duplicated code.
 1.260  17-Nov-2020  knakahara Add new spin mutex to avoid race between ixgbe_msix_admin() and ixgbe_handle_admin().

At first, it seems "IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_OTHER)"
cannot stop interrupts, because 31th bit is reserved for 82598, 82599,
X540 and X550. So, the current following design
(1) ixgbe_msix_admin() disables interrupts
(2) ixgbe_msix_admin() calls workqueue_enqueue() for ixgbe_handle_admin()
(3) ixgbe_handle_admin() does interrupt processing
(4) after ixgbe_handle_admin() has done all interrupt processings,
ixgbe_handle_admin() enables interrupts
does not work correctly, that is, interrupts can be lost while
ixgbe_handle_admin() is running.

To fix that, add new spin mutex(adapter->admmin_mtx) which protects
atomically the following two members.
- adapter->admin_pending
- adapter->task_requests

The unnecessary "IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_OTHER)"
code will be removed later.

Reviewed and tested by hikaru@n.o and msaitoh@n.o, thanks.
 1.259  13-Nov-2020  msaitoh Fix a bug that some advertise speeds can't be set with hw.ixgN.advertise_speed
if both 2.5G and 5G are set. Fix the error message, too.
 1.258  07-Sep-2020  knakahara branches: 1.258.2;
Fix race between ixgbe_msix_admin() and ixgbe_handle_admin(), pointed out by ozaki-r@n.o.

The race is caused by the following.
CPU#A processes workqueue, CPU#B processes admin interrupt.
(0) one of CPUs already calls ixgbe_schedule_admin_tasklet()
such as ixgbe_handle_timer()
(1) CPU#A: read adapter->task_requests
(2) CPU#B: set adapter->task_requests
(3) CPU#B: read(and try to set) adapter->admin_pending
but adapter->admin_pending is set, so does not
call workqueue_enqueue()
(4) CPU#A: clear adapter->admin_pending
that is, the tasks set by (2) is not processed as missfire workqueue by (3).
 1.257  07-Sep-2020  msaitoh - Remove extra callout_stop() in ixgbe_detach(). Found by knakahara@.
- Rename ix{gbe,v}_free_workqueue() to ix{gbe,v}_free_deferred_handlers().
- Add KASSERT() to functions who are called from ixgbe_handle_admin().
 1.256  07-Sep-2020  msaitoh __predict_false() should be __predict_true() for adapter->osdep.detaching
== false check.
 1.255  07-Sep-2020  msaitoh Don't schedule admin work while shutdown like the recovery mode timer.

The admin workqueue also runs while !IFF_UP like the recovery mode timer.
Apply the same change of ixgbe.c 1.254 to ixgbe_schedule_admin_tasklet()
to prevent panic. Found by ozaki-r@.
 1.254  01-Sep-2020  msaitoh Fix a panic on shutdown on a machine which use the recovery mode timer.

The recovery mode timer is first issued by the callout and it schedule
the workqueue. The workqueue then reschedule the callout. It's hard to
stop both of them without race only with callout_stop() and workqueue_wait.
To solve this problem. add new "detaching" flag and use it.

The situation is almost the same as schedule_wqs_ok for the local_timer's
callout and workqueue, but the difference is that the local_timer isn't
required to run if the interface is not up. If it's not important to prevent
running timer while !IFF_UP, the flag can be integrated into one.
 1.253  01-Sep-2020  msaitoh Call ixgbe_ifstop() instead of ixgbe_stop_locked() in
ixgbe_setup_low_power_mode() to stop the timer workqueue.
 1.252  31-Aug-2020  msaitoh Rename ix{gbe,v}_stop() with ix{gbe,v}_stop_locked(). No functional change.
 1.251  31-Aug-2020  msaitoh If an SFP+ module is not inserted, don't try to access SFP+ EEPROM.
This change eliminate long timeout.

Reduce code duplication using with ixgbe_sfp_cage_full(hw).
 1.250  31-Aug-2020  msaitoh Fix typo in comment.
 1.249  31-Aug-2020  msaitoh Fix 82598 SFP+ problems.

On 82598, SFP+'s MOD_ABS isn't connected to the MAC's GPIO pin, so we can't
call ixgbe_sfp_cage_full(). Always issue TASK_MOD from ixgbe_handle_timer()
on 82598.

Fix ixgbe_identify_sfp_module_generic() for ixgbe_phy_nl. In the driver,
hw->phy.type sometimes be compared with ixgbe_phy_nl.
In ixgbe_identify_sfp_module_generic(), hw->phy.type may be overridden with
another value. For ixgbe_phy_nl, some code don't override phy.type but others
were not. Make it consistently keep ixgbe_phy_nl. This change fixes a problem
that ixgbe_is_sfp() change the return value true to false when any SFP+
devices are connected to the cage on 82598 and never recover from it.

Don't schedule MSF(multi speed fiber) task from ixgbe_handle_mod() on 82598.
This task is only for devices which support multi speed fiber and 82598
doesn't support it. Before ixgbe.c rev. 1.237, ixgbe_handle_mod() isn't
called on 82598 because 82598 has no SFP+ module insertion/removal interrupt.
ixgbe.c rev. 1.237 changed to call the function via timer on 82598.
This change fixes a bug that 82598 DA interface's link flaps.
 1.248  27-Aug-2020  msaitoh Limit MA10-ST0's quirk only for on-chip devices.
 1.247  27-Aug-2020  msaitoh Fix compile error.
 1.246  27-Aug-2020  msaitoh Minor change.

- Print "X550EM X" instead of "X550EM" for Xeon D devices.
- Fix typo in comment. Same as FreeBSD.
 1.245  27-Aug-2020  msaitoh ADD SFP+ MOD_ABS inversion quirk.

On X550 EM, GPIO(SDP) and SFP+'s MOD_ABS is directly connected. It has
no inverter. GIGABYTE MA10-ST0 has a inverter, so add new quirk for it.
 1.244  24-Aug-2020  msaitoh Fix handling of IXGBE_REQUEST_TASK_NEED_ACKINTR again...
 1.243  24-Aug-2020  msaitoh The admin workqueue can be used even if the interface is not up.
OK'd by thorpej@. Will fixes PR#55534 reported by Shinichi Doyashiki
 1.242  24-Aug-2020  msaitoh Fix ixgbe_sfp_cage_full() on X550EM_A.

In ixgbe_handle_mod():

switch (hw->mac.type) {
case ixgbe_mac_82599EB:
cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
IXGBE_ESDP_SDP2;
break;
case ixgbe_mac_X550EM_x:
case ixgbe_mac_X550EM_a:
cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
IXGBE_ESDP_SDP0;
break;
default:
break;
}

so I had thought that IXGBE_ESDP_SDP0 bit is 1 on cage is full.
In reality, at least, X550EM_A's SFP+ cage is 0 on cage is full.
So invert the logic of ixgbe_sfp_cage_full() on X550EM_A
 1.241  24-Aug-2020  msaitoh Fix race in ixgbe_detach() to prevent panic on shutdown.
 1.240  24-Aug-2020  msaitoh Fix handling of IXGBE_REQUEST_TASK_NEED_ACKINTR in ixgbe_handle_admin().
 1.239  17-Aug-2020  msaitoh Simplify SFP+ check. No functional change.
 1.238  17-Aug-2020  msaitoh Re-enabling interrupt is required only when a work is scheduled form the
interrput context.
 1.237  17-Aug-2020  msaitoh Fix a bug that the driver sometimes missed module insertion.

The ixgbe_sfp_probe() function was only for 82598 and other chips had no
way to poll SFP+ cage. The ixgbe_handle_mod() already has function to treat
module insertion/removal for all chips, so enqueue the work if the cage
status changed. All of ixgbe chips' SFP+ module interrupt is only on the
inserstion. This change also detect the removal by the timer.
 1.236  17-Aug-2020  msaitoh Add missing workqueue_wait() for the recovery_mode_timer workqueue.
 1.235  13-Aug-2020  msaitoh Set recovery_mode_timer workqueue's name correctly.
 1.234  13-Aug-2020  msaitoh Use atomic_cas_uint() and atomic_store_relaxed(). Advised by thorpej@.
Tested by me. OK'd by knakahara.
 1.233  25-Jun-2020  msaitoh Reduce ixgbe's busy loop using with workqueue and kpause.

- Use workqueue instead of softint to make some functions sleepable.
- Use new workqueue and enqueue it in ixgbe_local_timer() and
ixgbe_recovery_mode_timer() to make them sleepable.
- Make new ixgbe_delay() and use it. This functions sleeps if the time is
more than equals 1 tick. If it's not, do delay().
 1.232  18-Jun-2020  msaitoh Modify a liitle to reduce diff between ixgbe.c and ixv.c. No functional change.
 1.231  17-Jun-2020  msaitoh Add missing callout_stop() for recovery_mode_timer.

NOTE: One of the difference between the local_timer and recovery_mode_timer
is that local_timer runs only when IFF_UP and recovery_mode_timer always runs
(it's enabled on attach).
 1.230  12-Jun-2020  msaitoh - Remove extra kpreempt_disable() -> kpreempt_enable() because
ixgbe_handle_msf() was changed from softint to workqueue.
- Set schedule_wqs_ok before enabling interrupt to prevent the race.
- Fix comment.
 1.229  11-Jun-2020  msaitoh Fix typo. No functional change.
 1.228  17-Apr-2020  msaitoh No functional change:
- modify comment
- whitespace fix
 1.227  15-Mar-2020  thorpej branches: 1.227.2;
Define and implement a locking protocol for the ifmedia / mii layers:
- MP-safe drivers provide a mutex to ifmedia that is used to serialize
access to media-related structures / hardware regsiters. Converted
drivers use the new ifmedia_init_with_lock() function for this. The
new name is provided to ease the transition.
- Un-converted drivers continue to call ifmedia_init(), which will supply
a compatibility lock to be used instead. Several media-related entry
points must be aware of this compatibility lock, and are able to acquire
it recursively a limited number of times, if needed. This is a SPIN
mutex with priority IPL_NET.
- This same lock is used to serialize access to PHY registers and other
MII-related data structures.

The PHY drivers are modified to acquire and release the lock, as needed,
and assert the lock is held as a diagnostic aid.

The "usbnet" framework has had an overhaul of its internal locking
protocols to fit in with the media / mii changes, and the drivers adapted.

USB wifi drivers have been changed to provide their own adaptive mutex
to the ifmedia later via a new ieee80211_media_init_with_lock() function.
This is required because the USB drivers need an adaptive mutex.

Besised "usbnet", a few other drivers are converted: vmx, wm, ixgbe / ixv.

mcx also now calls ifmedia_init_with_lock() because it needs to also use
an adaptive mutex. The mcx driver still needs to be fully converted to
NET_MPSAFE.
 1.226  06-Feb-2020  thorpej Ensure we don't call workqueue_enqueue() if the pluggable optics
handler is already pending.
 1.225  05-Feb-2020  msaitoh No functional change:

- Add debug printf()s.
- Remove unused macros.
- Remove extra newline.
 1.224  05-Feb-2020  msaitoh Update comment in ixgbe_update_stats_counters() to clarify why we update
if_iqdrops and if_ierrors only. No functional change.
OK'd by knakahara and thorpej.
 1.223  04-Feb-2020  thorpej - Fix locking problem with optics module interrupts: ifmedia_add()
may block on memory allocation, and so it cannot be safely done from
a softint nor can it be done while holding a spin lock. Fix this by
using a workqueue rather than a softint, and hold the IFNET_LOCK
across the entire handler, and the CORE_LOCK only across the code that
needs to serialize access to the hardware state.
- Use ifmedia_fini().

Tested in a variety of devices by msaitoh@. (Thanks!)
 1.222  01-Feb-2020  thorpej Adopt <net/if_stats.h>.

XXX This driver needs some work in this regard (practually no
stats are reported).
 1.221  21-Jan-2020  msaitoh Fix the freeing code for some error paths. Found and tested by Patrick Welche.
 1.220  03-Jan-2020  pgoyette branches: 1.220.2;
Fix some typos in comments.

From vezhlys on freenode IRC.
 1.219  23-Dec-2019  msaitoh Add recovery code for unsupported SFP+.

Before this commit:
If an unsuppored SFP module is inserted before booting, the driver attach
failed and there was no way to recover form it without rebooting or
detaching/reattaching drvier (drvctl -d && drvctl -r pciN).
After this commit:
We can automatically recover any time by replacing it with a supported
module.
 1.218  23-Dec-2019  msaitoh Add missing core lock in ixgbe_handle_mod().
 1.217  17-Dec-2019  msaitoh Use bus_space_barrier() instead of x86 specific *fence instruction.
Written by riastradh@.
 1.216  18-Nov-2019  msaitoh Print MAC address.

XXX Should we move such type of printf() to ether_ifattach?
 1.215  10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.214  16-Oct-2019  msaitoh Apply FreeBSD r353599:

> 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
 1.213  18-Sep-2019  msaitoh s/ixgbe_set_multi/ixgbe_set_rxfilter/. No functional change.
 1.212  18-Sep-2019  msaitoh Remove ixgbe_set_promisc() and use ixgbe_set_multi() to reduce code
duplication.
 1.211  18-Sep-2019  msaitoh Fix a bug that the multicast filter isn't correctly initialized when
the total number of the Ethernet multicast addresses is just 128.
Changing "<" with "<=" fixes this problem, but it's better to check
ETHER_F_ALLMULTI than it because it's straightforward.
 1.210  13-Sep-2019  msaitoh if_flags is neither int nor short. It's unsigned short.
 1.209  05-Sep-2019  msaitoh Fix a bug that MBSDC (Bad SFD Count) isn't counted on X550EM_X and X550EM_A.
The register is for X550 and newer.
 1.208  04-Sep-2019  msaitoh Set IFM_1000_BX10 correctly.
 1.207  04-Sep-2019  msaitoh printf -> device_printf
 1.206  29-Aug-2019  knakahara Fix panic when ncpu == 1 && sysctl -w hw.ixg0.txrx_workqueue=1. Reported by nonaka@n.o.

ok by msaitoh@n.o and nonaka@n.o

pullup-8, pullup-9
 1.205  29-Aug-2019  knakahara fix typo in error handling of ixgbe_allocate_legacy().

ok by msaitoh@n.o

pullup-8, pullup-9
 1.204  28-Aug-2019  msaitoh An interrupt might not arrive when a module is inserted. When an link status
change interrupt occurred and the driver still regard SFP as unplugged, link
becomes up and the real media type is unknown. e.g:

% ifconfig -m ixg0
(snip)
media: Ethernet autoselect (autoselect rxpause,txpause)
status: active
supported Ethernet media:
media none
media autoselect
(snip)

To resolve this problem, when an link status change interrupt occurred and the
driver still regard SFP as unplugged, issue the module softint before issuing
LSC interrupt.
 1.203  28-Aug-2019  msaitoh X550EM supports QSFP, so check ixgbe_media_type_fiber_qsfp too.
 1.202  21-Aug-2019  msaitoh Simplify ix{gbe,v}_[un]register_vlan() API suggestesd by knakahara.

The API was the same as FreeBSD's pre-iflib's. They use iflib now and it's
not required for us to keep the old API.
 1.201  21-Aug-2019  msaitoh Use ETHER_LOCK()/ETHER_UNLOCK() suggested by knakahara.
 1.200  20-Aug-2019  msaitoh Fix a bug that VLAN HW "tagging" enable/disable may not refrect correctly.

- Always call ec_vlan_cb() if it exists.
- Some (or all?) ethernet drivers don't enable HW tagging if no any vlan is
attached. ixgbe is one of them. Check the the transition and update
VLAN HW tagging function.

XXX pullup-9
 1.199  30-Jul-2019  msaitoh branches: 1.199.2;
ixgbe_setup_low_power_mode() calls ixgbe_stop() in it. ixgbe_detach() first
called ixgbe_stop() and then called ixgbe_setup_low_power_mode() which resulted
in calling ixgbe_stop() twice. Call only ixgbe_setup_low_power_mode() first to
remove extra ixgbe_stop() call.
 1.198  26-Jul-2019  msaitoh Set IVAR (Interrupt Vector Allocation Register) correctly for 82598 in
ixgbe_set_ivar(). Found by KUBSan.
 1.197  26-Jul-2019  msaitoh Simplify code. No functional change intended.
 1.196  25-Jul-2019  msaitoh Fix VLAN hardware filter initialization. Use unsigned. Found by KUBSan.
 1.195  25-Jul-2019  msaitoh Fix VLAN filter setting. Found by KUBSan.
 1.194  24-Jul-2019  msaitoh Fix some problems found by KUBSan:
- Set TQSM and RQSM (TX/RX queue statistics mapping) correctly.
- Set IVAR (Interrupt Vector Allocation Register) correctly in
ixgbe_set_ivar().
- Define IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART correctly. This macro is used
in ixgbe_restart_an_internal_phy_x550em().
- Define IXGBE_KRM_TX_COEFF_CTRL_1_OVRRD_EN correctly. This macro is used
in ixgbe_setup_ixfi_x550em_x().
- Define IXGBE_SB_IOSF_CTRL_BUSY correctly. This macro is used in
ixgbe_iosf_wait() (X550EM only).
 1.193  17-Jul-2019  msaitoh Implement VLAN hardware filter function(ETHERCAP_VLAN_HWFILTER).
First proposed by jmcneill in 2017 and modified by me.

How to use:

- Set callback function:

ether_set_vlan_cb(struct ethercom *, ether_vlancb_t)

- Callback. This function is called when a vlan is attached/detached to the
parent interface:

int (*ether_vlancb_t)(struct ethercom *ec, uint16_t vlanid, bool set);

- ifconfig(8)

ifconfig ixg0 [-]vlan-hwfilter

Note that ETHERCAP_VLAN_HWFILTER is set by default on ixg(4) because
the PF driver usually enable "all block" filter by default.
 1.192  04-Jul-2019  msaitoh On ENETRESET case, not continue and quit the ifflags_cb() function because
if_init() will do the same thing.
 1.191  02-Jul-2019  msaitoh Sync with FreeBSD ix-3.3.10 part 2:
- Calculate vector's bit location correctly when the vector >= 31
in ixgbe_allocate_msix().
 1.190  02-Jul-2019  msaitoh Sync with FreeBSD ix-3.3.10 part 1. No functional change in this part:
- "(u64)1" -> "1ULL"
- Add some not-yet-used register definitions.
 1.189  27-Jun-2019  msaitoh Sync with FreeBSD ix-3.3.8 part 1. No functional change in this part:
- Move ixgbe_toggle_txdctl() to ixgbe_common.c and modify a bit.
No functional change because this function is currently used for SR-IOV
and it's not used in NetBSD.
- Some modification to match the latest netmap API.
- Modify ixgbe_hic_unlocked(). No functional change because neither
IXGBE_HOST_INTERFACE_APPLY_UPDATE_CMD(0x38) nor
IXGBE_HOST_INTERFACE_SHADOW_RAM_READ_CMD(0x31) are used.
- Add ixgbe_clear_mbx(). No functional change because this function is not
used yet.
- Add some not-yet-used register definitions.
- Whitespace fixes.
 1.188  04-Jun-2019  msaitoh Match the follwing devices:

82598_BX (0x1508)
82599_KR (0x1517)
82599_SFP_EM (0x1507)
X550EM_X_XFI (0x15b0)
X550EM_A_QSFP (0x15ca)
X550EM_A_QSFP_N(0x15cc)
 1.187  29-May-2019  msaitoh Even if we don't use MII(4), use the common path of SIOC[GS]IFMEDIA in
sys/net/if_ethersubr.c if we can.
- Add ec_ifmedia into struct ethercom.
- ec_mii in struct ethercom is kept and used as it is. It might be used in
future. Note that some Ethernet drivers which _DOESN'T_ use mii(4) use
ec_mii for keeping the if_media. Those should be changed in future.
 1.186  23-May-2019  msaitoh Whitespace fix (mainly tabify).
 1.185  23-May-2019  msaitoh -No functional change:
- KNF
- u_int*_t -> uint*_t.
 1.184  17-May-2019  msaitoh Use new media types.
 1.183  15-May-2019  ozaki-r Store IFF_ALLMULTI in ec_flags instead of if_flags to avoid data races

IFF_ALLMULTI is set/unset to if_flags via if_mcast_op. To avoid data races on
if_flags, IFNET_LOCK was added for if_mcast_op. Unfortunately it produces
a deadlock so we want to remove added IFNET_LOCK by avoiding the data races by
another approach.

This fix introduces ec_flags to struct ethercom and stores IFF_ALLMULTI to it.
ec_flags is protected by ETHER_LOCK and thus IFNET_LOCK is no longer necessary
for if_mcast_op. Note that the fix is applied only to MP-safe drivers that
the data races matter.

In the kernel, IFF_ALLMULTI is set by a driver and used by the driver itself.
So changing the storing place doesn't break anything. One exception is
ioctl(SIOCGIFFLAGS); we have to include IFF_ALLMULTI in a result if needed to
export the flag as well as before.

A upcoming commit will remove IFNET_LOCK.

PR kern/54189
 1.182  14-May-2019  ozaki-r Remove unnecessary checks of IFF_ALLMULTI

IFF_ALLMULTI is changed by only driver itself, so we don't need to check its
change on ec_ifflags_cb.

This is part of PR kern/54189. NFCI.
 1.181  13-May-2019  msaitoh Fix a bug that manual setting of 10GBASE-SR or 10GBASE-CX4 didn't work
if IFM_ETH_XTYPE was set. We don't use IFM_ETH_XTYPE macro, so this was not a
real bug.
 1.180  10-May-2019  msaitoh Fix typo. This code is not used yet.
 1.179  18-Mar-2019  msaitoh s/pakcet/packet/ in comment.
 1.178  15-Mar-2019  msaitoh - Simplily. Suggested by knakahara.
- Modify comment. Per queue VLAN enable flags is on 82599 and later.
- Fix typo in comment.
 1.177  13-Mar-2019  msaitoh - Fix a bug that the VLAN HW tagging function is not correctly disabled
when all vlan is detached.
- Fix a bug that VLAN HW tagging function is not correctly controlled on 82598.
- Control VLAN HW filter function correctly.
- Don't clear IXGBE_VLNCTRL_CFIEN bit When ETHERCAP_VLAN_HWFILTER is set.
I think it's not required (and Linux doesn't do it). This change has no
effect to NetBSD because ETHERCAP_VLAN_HWFILTER is not supported yet.
 1.176  05-Mar-2019  msaitoh It's not required to calculate unused queues' statistics.
 1.175  05-Mar-2019  msaitoh NetBSD currently uses traffic class 0 only. Other traffic classes aren't used
yet. When IXGBE_TC_COUNTER_NUM is set to lower than IXGBE_DCB_MAX_TRAFFIC_CLASS
(e.g. 1), other traffic classes' counters are not used. It means we don't
generate evcnt for them and don't add the values in
ixgbe_update_stats_counters().
 1.174  22-Feb-2019  msaitoh Fix a bug that if_link_state_change(ifp, LINK_STATE_DOWN) isn't called unless
link goes up at least one time. Without this change, never linkup-ed media
keeps LINK_STATE_UNKNOWN instead of LINK_STATE_DOWN.
 1.173  23-Jan-2019  msaitoh - Move the location of calling setup_eee() in ixgbe_attach(). The previous
location was too early. The new location is before calling
ixgbe_set_phy_power().
- Restore call of setup_eee() in ixgbe_init_locked(). It was removed in
rev. 1.99 (FreeBSD r320688).
- When calling setup_eee(), pass enable/disable correctly.
 1.172  23-Jan-2019  msaitoh Call ixgbe_init_swfw_semaphore(hw) before calling ixgbe_check_wol_support()
because ixgbe_check_wol_support()->ixgbe_check_wol_support()->
ixgbe_get_device_caps() accesses semaphore.
 1.171  23-Jan-2019  msaitoh Nowadays some UEFI BIOSes don't enable some PCI devices' address decoding.
To resolve this problem, pci_map.c rev. 1.34-1.36 changed the
pci_mapreg_(sub)map()'s to set the decode bit if it's not set. It's good for
almost all drivers, but some other drivers don't use pci_mapreg_map().
In drivers which don't use pci_mapreg_map(), some of them expilicitly enable
decoding but others don't. Add code to enable decoding to them.

See also the following discussion:
http://mail-index.netbsd.org/tech-kern/2017/03/22/msg021678.html
 1.170  08-Dec-2018  msaitoh Don't call callout_halt() if it's not initialzied.
 1.169  06-Dec-2018  msaitoh Apply FreeBSD ix-3.3.6.tar.gz's change to NetBSD. Tested on C3000 and X550-T1,
but not tested on Xeon D:
- Add firmware recovery mode for X550, X550A(Xeon D) and X550EM (C3000):
- FreeBSD always set IXGBE_FEATURE_RECOVERY_MODE without checking the
NVM image version. We compare it against 2.0 to not to make new callout and
not to call extra atomic operations.
- In some FreeBSD's sysctl functions, atomic_load_acq_int() is called
before a null pointer check. We call it after null pointer check.
- Before calling atomic_load_acq_uint(), check adapter->feat_en flags
to save atomic operation call.
- We don't check recovery_mode in ixgbe_set_sysctl_value() because this
function doesn't touch any hardware register.
- NetBSD don't have FreeBSD's atomic_load_acq_int()-like function, so do it
with membar_sync(). Thanks riastradh@ for the advice.
- FreeBSD's ix-3.3.6 changed ixgbe_enable_aim from TRUE to FALSE, but we will
keep it as TRUE because we have already fixed some bugs.
- Remove IXGBE_DEV_ID_82599_LS(0x154f) support again. I don't know why. This
was added in ix-3.2.18.tar.gz(NetBSD: ixgbe_82599.c rev. 1.20) and removed in
ix-3.3.6.tar.gz.
- On X550EMU, use ixgbe_identify_sfp_module_X550em() instead of
ixgbe_identify_module_generic(). ixgbe_identify_sfp_module_X550em() has
extra check (e.g. exclude 1G copper).
- if_sriov.c's change doesn't affect to NetBSD because we don't support
SR-IOV PF function.
 1.168  03-Dec-2018  msaitoh Some counters are not per queue but per traffic class. Make new evcnt group
"ixgM tcN" (N = 0..7) and move those counters into it. We are using only
traffic class 0, so we will see only tc0's counter are updated.
 1.167  27-Sep-2018  msaitoh Don't set LRO capability flags because we don't support it yet.
This doesn't change any behavior other than if_capabilities' visibility
(e.g. ifconfig).
 1.166  14-Sep-2018  msaitoh - Fix a bug that Denverton accessed wrong register in
ixgbe_setup_low_power_mode(). The location of some registers in Denverton
were changed. The GRC register is one of them, so use IXGBE_GRC_BY_MAC(hw)
instead of IXGBE_GRC.
- ixgbe_check_wol_support() tests the capability of WOL, but the sysctl
knobs for WOL were added only for IXGBE_DEV_ID_X550EM_X_10G_T. Add the
knobs when adapter->wol_support is not 0.

XXX pullup-8
 1.165  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.164  29-Aug-2018  msaitoh Fix a bug that media change may fail. I noticed that ifconfig ixgN media XXX
took a 10 or more seconds on a Denverton machie. I occurred by trying take a
lock and timed out. The reason was that ixgbe_media_change() didn't take
CORE_LOCK. Do it.

This problem was from FreeBSD's pre-iflib ixgbe (I don't know whether this
problem really occurs on FreeBSD or not). Post-iflib ixgbe has no problem
because iflib_media_change() takes a lock.

XXX pullup-8
 1.163  06-Jul-2018  msaitoh Add force_10_100_autonego sysctl. The default vaule is 0(false).
This sysctl is only for 550EM_a with PHY firmware for a while.
 1.162  03-Jul-2018  msaitoh Remove nmbclusters check. We don't use the mbuf cluster. The old code also had
a bug that ixgbe_total_ports adds two every port and never decrement in
the detach path. Found by hikaru@.

The code was removed in FreeBSD when it switched to use iflib and OpenBSD
removed the code 8 years ago.
 1.161  06-Jun-2018  kamil branches: 1.161.2;
Comment out unused functions in order to fix Clang build

ixv_rearm_queues() and ixgbe_rearm_queues() are unused.

Sponsored by <The NetBSD Foundation>
 1.160  04-Jun-2018  msaitoh Don't call ixgbe_rearm_queues() in ixgbe_local_timer1().

ixgbe_enable_queue() and ixgbe_disable_queue() try to enable/disable queue
interrupt safely. It has the internal counter. When a queue's MSI-X is
received, ixgbe_msix_que() is called (IPL_NET). This function disable the
queue's interrupt by ixgbe_disable_queue() and issues an softint.
ixgbe_handle() queue is called by the softint (IPL_SOFTNET), process TX, RX
and call ixgbe_enable_queue() at the end.

ixgbe_local_timer1() is a callout and run always on CPU 0 (IPL_SOFTCLOCK).
When ixgbe_rearm_queues() called, an MSI-X interrupt is issued for a specific
queue. It may not CPU 0. If this interrupt's ixgbe_msix_que() is called and
sofint_schedule() is called before the last sofint's softint_execute() is not
called, the softint_schedule() fails because of SOFTINT_PENDING. It result
in breaking ixgbe_{enable,disable}_queue()'s internal counter.

ixgbe_local_timer1() is written not to call ixgbe_rearm_queues() if
the interrupt is disabled, but it's called because of unknown bug or a race.
One solution to avoid this problem is to not to use the internal counter,
but it's little difficult. Another solution is stop using
ixgbe_rearm_queues() at all. Essentially, ixgbe_rearm_queues() is not
required (it was added in ixgbe.c rev. 1.43 (2016/12/01)).
ixgbe_rearm_queues() helps for lost interrupt problem but I've never seen it
other than ixgbe_rearm_queues() problem.

XXX pullup-8.
 1.159  03-Jun-2018  maxv Constify several variables in ixgbe/ so that they land in .rodata (1038
bytes).
 1.158  30-May-2018  msaitoh Add hw.ixgN.debug sysctl. "sysctl -w hw.ixgN.debug=1" dumps some registers
to console.
 1.157  30-May-2018  msaitoh Clear que->disabled_count in {ixgbe,ixv}_init_locked(). Without this,
interrupt mask state and EIMS may mismatch and if_init doesn't recover
from TX/RX stall problem.

This change itself doesn't fix PR#53294.
 1.156  25-May-2018  ozaki-r Ensure to call if_register after interface initializations finish
 1.155  23-May-2018  msaitoh Add "bool txr_no_space" for TX descriptor shortage. Use it like IFF_OACTIVE.
 1.154  23-May-2018  msaitoh Add rxd_nxck (Receive Descriptor next to check) read only sysctl.
 1.153  18-May-2018  msaitoh Revert new watchdog timer commits. The new watchdog timer made stability
worse than before. It seems unknown problems exists.

http://mail-index.netbsd.org/source-changes/2018/05/08/msg095020.html
http://mail-index.netbsd.org/source-changes/2018/05/16/msg095240.html
 1.152  15-May-2018  msaitoh The TQSMR register is not for receiving but for transmitting, so move the
initialization from ixgbe_initialize_receive_units() to
ixgbe_initialize_transmit_units(). No functional change.
 1.151  10-May-2018  msaitoh Count some register correctly:
- QPRDC register is only for 82599 and newer.
- Count IXGBE_QPRDC, PX{ON,OFF}{T,R}XC[NT].
 1.150  08-May-2018  msaitoh - Fix broken watchdog timer. This change detects TX device timeout correctly.
NOTE: It's supporsed not to be called {ixgbe,ixv}_rearm_queues() in the
timer. Those are not required if any chip have no bug. In reality,
ixgbe_rearm_queues() is required on 82599 and newer chip AND other than
queue 0 to prevent device timeout. When it occured, packet was sent but the
descriptor's DD bit wasn't set even though IXGBE_TXD_CMD_EOP and
IXGBE_TXD_CMD_RS were set. After forcing interrupt by writing EICS register
in ixgbe_rearm_queues(), DD is set. Why? Is this an undocumented errata? It
might be possible not call rearm_queues on 82598 or queue 0, we call in any
cases in case the problem occurs. On ixv(4), I have not seen this problem yet
(though I tested only on X550_X(Xeon D 12xx)'s virtual function), but we
do rearm in case TX device timeout happen.
- ixv(4): Call callout_stop() earlier in ixv_stop() like ixgbe_stop().
- KNF.
 1.149  19-Apr-2018  msaitoh Use ixgbe_eitr_write() when writing the EITR for the link interrupt like
queue's EITR to write the register safely. This change is not relatively
so important than queue's EITR because link's EITR is written in if_init().
 1.148  17-Apr-2018  msaitoh Remove unused structure entries. No functional change.
 1.147  17-Apr-2018  knakahara Fix panic when "sysctl -w hw.ixg0.txrx_workqueue=[01]" while there is traffic.

The operation is not supported, however causing panic is problem.
 1.146  12-Apr-2018  msaitoh Read sc_if_flags after taking core lock. Same as if_wm.c rev. 1.418.
 1.145  04-Apr-2018  msaitoh Sync with FreeBSD r331224 except ixv_if_update_admin_status()'s change:
- Fix length of reading buffer when the command is Read Flash in
ixgbe_host_interface_command().
- Add missing start_hw() call in ixv_init_locked(). This is not a real bug
because start_hw just set hw->adapter_stopped to false and anyone refer it.
- Style change.
- Update comment.
 1.144  04-Apr-2018  msaitoh Sync with the remaining part of FreeBSD r328265 except sfp_reinit stuff:
- Always schedule module intterrupt in ixgbe_config_link() when a device is
SFP+ based.
- Use not loop index but txr->me in ixv_initialize_{transmit,receive}_units().
It's required for VMDQ but NetBSD doesn't use it, so it's not a bug in
NetBSD.
- Simplify ixgbe_bp_wd_set(). No functional change.
- Whitespace.
 1.143  04-Apr-2018  msaitoh Fix a bug that "ifconfig ixgN down up" forgot IFM_NONE setting.
- Don't assume autoneg == 0 is the first call of ixgbe_config_link().
Check ifm_media, too.
- Don't override autoneg_advertised in ixgbe_get_phy_id_fw() to not to
be inconsistent with if_media value.
 1.142  02-Apr-2018  msaitoh Fix long standing bug that 82598 SFP+ panics in ixgbe_handle_mod() because
hw->mac.ops.setup_sfp is NULL. This change is a part of FreeBSD r327031.
 1.141  02-Apr-2018  knakahara Avoid issues caused by sending old packets at next link-up time.

This modification consists by the following two parts.
- drain packets in if_snd queue or corresponding txr->txr_interq
when link_active == false in ifp->if_start(), ifp->if_transmit(),
and deferred Tx processing
- drain packets in if_snd queue and all of txr->txr_interq's
at link-down time

ok by msaitoh@n.o.
 1.140  30-Mar-2018  msaitoh - Add missing IFM_NONE support. If a interface support linkdown,
"ifconfig ixgN media none" drpos link. Not all interface can do link down.

Tested:
82598 AT2 (T)
92599 SF+(SFI) (X520-DA2)
X540
X550-T1
X550EM_x (X10SDV-8C-TLN4F)
X550EM_a (A2SDi-H-TP4F port 0, 1 (T))

Doesn't work:
X550EM_a (A2SDi-H-TP4F port 2, 3 (SFP+ (KR)))
X550EM_a (MA10-ST0 port 2, 3 (SFP+ (SFI)))
(Denverton SFP+ can't force link down because SFP+'s TX_DISABLE pin is
pull down. Is there a way to shutdown SFP+ cage's power?)
Not tested:
82598 fiber.

- Change some functions static.
 1.139  30-Mar-2018  knakahara Don't write EIMC directly. It is required to manage with struct ix_queue status.

XXX pullup-8
 1.138  30-Mar-2018  knakahara Fix the problem between eitr and link_speed.

In ixgbe_msix_que(), que->eitr_setting is limited to IXGBE_MIN_RSC_EITR_10G1G
when link_speed is 1Gbps or 10Gbps. However, que->eitr_setting is set to EITR
register in the *next* Tx/Rx interrupt. If link_speed changes from 100Mbps to
1Gbps ro 10Gbps, que->eitr_setting which is not limited can be set to EITR
register, that is, the problem fixed by ixgbe.c:r1.124 can occur in this case.

To fix this case, que->eitr_setting should be clear when link_speed is changed
or link state is changed.

Furthermore, expand the variants used for AIM (txr->bytes, txr->packets,
rxr->bytes and rxr->packets) from u32 to u64 to avoid wraparound which causes
que->eitr_setting calculation mistake.

XXX pullup-8
 1.137  26-Mar-2018  msaitoh - Add link related softint's counter.
- Fix indent.
 1.136  20-Mar-2018  knakahara Fix race about writing adapter->link_active for ixg(4).

adapter->link_active is updated by ixgbe_update_link_status() only.
The function is called from the following four functions.
- ixgbe_media_status()
- ixgbe_local_timer1()
- ixgbe_stop()
- ixgbe_handle_link()

The functions other than ixgbe_handle_link() call ixgbe_update_link_status()
with holding IXGBE_CORE_LOCK, however ixgbe_handle_link() calls it without
holding IXGBE_CORE_LOCK. That can cause race. So, add IXGBE_CORE_LOCK to
ixgbe_handle_link().

Tested by msaitoh@n.o and me.
 1.135  15-Mar-2018  msaitoh Add some changes from ix-3.2.17.tar.gz and r328265. Not fully synchronized.
Some others (e.g. sfp cage interrupt and bypass adapter stuff) will be merged
later:
- Initialize firmware command buffer correctly in ixgbe_read_ee_hostif_X550()
and ixgbe_read_ee_hostif_buffer_X550(). These functions are used when reading
NVM.
- Fix a bug that ixgbe_mng_present() misunderstand management capability on
X550 and newer on some environment. X550 changed FWSM bit definition.
See X540 document and X550's document and compare them.
- Fix checksum calculation in ixgbe_set_fw_drv_ver_generic(). This function is
not used in NetBSD.
- Add some unused funtions.
- Whitespace fix.
 1.134  09-Mar-2018  msaitoh Make some event counters MP safe. Now all of the event counters are
MP safe.
 1.133  08-Mar-2018  knakahara Reduce duplicated code which schedule deferred packet processing. No functional change.
 1.132  08-Mar-2018  knakahara Fix INTx/MSI handler did not schedule workqueue. Pointed out by msaitoh@n.o.
 1.131  07-Mar-2018  knakahara Fix another poll mode assumption breaking. Implemented by msaitoh@n.o, I just commit by proxy.

ixgbe_rearm_queues() writes EICS register(s). 82599, X540 and X550
specifications say "Following a write of 1b to any bit in the EICS register
(interrupt cause set), its corresponding bit in the EIMS register is auto
set as well enabling its interrupt." in "Extended Interrupt Auto Mask Enable
(EIAM) Register" section. That is, ixgbe_rearm_queues() causes interrupts
regardless of the status managed by ixgbe_enable_queue()/ixgbe_disable_queue().
That can break poll mode assumption.

In fact, the problem occurs in the following situation
- CPU#A has high load traffic, in contrast, CPU#B has not so high load traffic
- CPU#A is occurred interrupt by its NIC queue
- CPU#A calls ixgbe_disable_queue() in interrupt handler(ixgbe_msix_que())
- CPU#A kick softint handler(ixgbe_handle_que())
- CPU#A begins softint
- CPU#A's NIC queue is set que->txr->busy flag
- With some reason, CPU#A can do ixg interrupt handler
E.g. when one of CPU#A's softnet handlers sleeps, ipl is lowered
- CPU#B starts callout
- CPU#B calls ixgbe_local_timer1()
- CPU#B writes EICS bit corresponding CPU#A's NIC queue bit
- CPU#A's NIC queue causes interrupt whie CPU#A is running in poll mode
- CPU#A calls ixgbe_disable_queue() in interrupt handler *again*
- CPU#A has done polling, and then CPU#A calls ixgbe_enable_queue() *once*
- CPU#A's NIC queue interrupt is disabled until ixg is detached as
ixgbe_disable_queue() is called twice though ixgbe_disable_queue() is
called once only

NOTE:
82598 does not say so, but it is treated in the same way because of no harm.

By the way, we will refactor ixgbe_local_timer(watchdog processing) later.

XXX pullup-8
 1.130  07-Mar-2018  msaitoh Don't increment que->req.ev_count in MSI-X interrupt because it's not
reschedule.
 1.129  07-Mar-2018  msaitoh - Make "Handled queue in softint" and "Requeued in softint" evcnt(9) per queue
and count them correctly.
- Remove #if 0'ed code.
 1.128  02-Mar-2018  knakahara branches: 1.128.2;
ixg(4) supports workqueue poll mode, but not enabled by default yet. (that is, the default behavior is *not* changed)

At the time of high load near the wire rate, the turnaround time
of update/delete processing such as "ifconfig ixg0 inet XXX" or
"ifconfig ixg0 delete" is very long. The main reason is CPU
starvation caused by ixg(4)'s softint poll mode. ixg(4) uses
workqueue poll mode instead of softint poll mode, so that this
problem will be fix.

This change may cause performance issues, so it is not enabled
by default yet. Although there are that issues, if you want to use
workqueue poll mode, do "sysctl -w hw.ixgXX.txrx_workqueue=1" while
there is no traffic on the ixgXX.

ok by msaitoh@n.o.
 1.127  26-Feb-2018  knakahara Fix poll mode assumption breaking.

ixgbe_{enable,disable}_intr() forcibly enable/disable all interrupts
regardless of current state. That can break poll mode assumption,
that is, queue interrupts must not occur while polling Tx/Rx rings.

E.g. "ifconfig ixg0 delete && ifconfig ixg0 192.168.0.1" on heavy
load traffic can causes this issue.

This fix may have 1% or 2% performance impact at short packets.

XXX
ixgbe_rearm_queues() which is called only via watchdog can also break
this poll mode assumption because writing EICS casues interrupts
immediately when interrupt auto mask enabled.
We will fix it with other issues about watchdog later.

ok by msaitoh@n.o.
 1.126  22-Feb-2018  msaitoh Fix a potential bug that TX/RX might stall when TX rate limit reached.
This change is almost the same as the RX rate limit bug fix in ixgbe.c
rev. 1.121. I've never got any stall, but this must be a bug.
 1.125  20-Feb-2018  knakahara Improve a comment about reading EICS register defined write-only by spec.

It seems that is workaround for silicon errata.

ok by msaitoh@n.o.
 1.124  20-Feb-2018  msaitoh - Fix a bug that RX may stall on heavy load on ixg(4) derived from FreeBSD's
AIM (Auto Interrupt Moderation) bug.
When I use a machine as a NFS client, sometimes one of queue pairs doesn't
get any interrupt other than every second tick via ixgbe_local_timer1().
When the problem occured, the queue pair's hw.ixgM.qN.interrupt_rate is
always 500000. When this problem occuring, set hw.ixgM.qN.interrupt_rate lower
than 166667 recover from stall. i.e.:

sysctl -w hw.ixgM.qN.interrupt_rate=166667 (don't revocer)
sysctl -w hw.ixgM.qN.interrupt_rate=166666 (recover)

Relatios between the interrupt_rate and EICR's ITR_INTERVAL field is as
follows:

int_rate | EICR[11:0] | interval in us | recover |
|(ITR_INTERVAL)| (10G and 1G) | |
---------+--------------+----------------+---------+
500000 | 0x008(0) | 2 | not |
166667 | 0x010(1) | 4 | not |
166666 | 0x018(2) | 6 | recover |

The reason why int_rate becomes 500000 is that xgbe_tx_eof() doesn't
increment rxr->packets(*1). Even if we fix rxr->packets' bug, interrupt_rate
might become greater than 166666 and it might cause stall.

While reading datasheets, knakahara noticed a section titled with "ITR
Affect on RSC Functionality". It says "When RSC is enabled on specific RX
queues, the associated ITR interval with these queus must be enabled and must
be larger (in time uints) than RSC delay". Currently, RSC_DELAY field in the
GPIE register is 0 and it means 4us for 10G and 1G. The greater ITR_INTERVAL
value of 4us is 6us == 166666. Yes, BINGO!

This description is noted in 82599 and newer datasheets and not in 82598
datasheet. I don't know if 82598 has this limitation but, I apply this
limitation all of chips.

(*1) Note that this bug is going to be fixed in the next commit to distinct
between two different bugs.

- The bitfield of EITR register is different between 82598 and others.
Only ixgbe_msix_que() taken care of it. Make new function ixgbe_eitr_write()
and use it in all of functions which modify ITR_INTERVAL.

XXX pullup-8
 1.123  16-Feb-2018  msaitoh Fix a bug that the first call of ifflags_cb() causes linkdown. The first
call of ix(gbe|v)_ifflags_cb() refered uninitialized adapter->if_flags.
adapter->if_flags should be initialized in the end of xxx_init().

XXX pullup-[678] (ixgbe)
XXX pullup-8 (ixv)
 1.122  16-Feb-2018  knakahara Apply RSS utility to ixg(4) and ixv(4).

ok by msaitoh@n.o.
 1.121  14-Feb-2018  msaitoh Fix a bug that RX may stall on heavy load on ixg(4). ixgbe_rxeof() has loop
limit and the function returns true if a packet are still in the RX ring.
ixgbe_handle_que() didn't check the return value. Check the return vaule
and issue a softint.

This bug is derived from FreeBSD and ixv(4) has no this bug.

XXX pullup-8
 1.120  26-Jan-2018  msaitoh CID-1427719: Integer handling issues (BAD_SHIFT). Print bus/slot info
correctly on 82599_SFP_SF_QP(DID 0x154a) and 82599_QSFP_SF_QP(DID 0x1558).
 1.119  28-Dec-2017  msaitoh Fallback from MSI-X to MSI or INTx if MSI-X setup failed.
 1.118  21-Dec-2017  msaitoh - If MSI can't be used on some environment, fallback to INTx correctly.
- Use single vector MSI when number of CPU is 1 to save interrupt slot.
 1.117  21-Dec-2017  msaitoh Fix panic when only link interrupt can't be established.
 1.116  20-Dec-2017  msaitoh Don't panic when resource shortage occured. Fixes PR#52820 reported by
kardel@:
- Don't use if_free() because ixgbe(4) don't use if_alloc().
- Move location of {ixgbe,ixv}_setup_interface() call at a position that
any error don't occur. One of the reason is that it should be. Another
reason is that it's hard to call ether_ifdetach() and if_detach() when
cold == 1 (because of pserialize_perform, xc_wait, timing of domaininit
and maybe more).
 1.115  06-Dec-2017  msaitoh Sync with FreeBSD's r326022. All of the following changes have no influence
to netbsd:
- Check ETHERCAP_VLAN_HWTAGGING in ixgbe_setup_vlan_hw_support(). This change
has no influence to netbsd because it's enabled by default and NetBSD has
no API to disable it.
- Fix for netmap module.
- Remove never defined UDP_IPV4_EX
- Add SPDX-License-Identifier
 1.114  24-Nov-2017  msaitoh On X540, print PHY FW Revision with %u.%x. 0x4030 will be printed
as "Revision 4.3 ID 0x0"
 1.113  22-Nov-2017  msaitoh Fix a bug that bypass adapter's sysctls aren't set. Tested with non-genuine
X550-T2 bypass adapter:
- Call ixgbe_sysctl_instance() in ixgbe_bypass_init() to get sysctl's top node
correctly.
- ixgbe_init_device_features() refers adapter->hw.bus.func for bypass adapter.
Call set_lan_id() to set adapter->hw.bus.func before calling
ixgbe_init_device_features(). Without this, bypass sysctl's are added to
both the first and second port.
- Initalize node.sysctl_data before calling sysctl_lookup() to read correct
value.
 1.112  16-Nov-2017  ozaki-r Unify IFEF_*_MPSAFE into IFEF_MPSAFE

There are already two flags for if_output and if_start, however, it seems such
MPSAFE flags are eventually needed for all if_XXX operations. Having discrete
flags for each operation is wasteful of if_extflags bits. So let's unify
the flags into one: IFEF_MPSAFE.

Fortunately IFEF_*_MPSAFE flags have never been included in any releases, so
we can change them without breaking backward compatibility of the releases
(though the kernel version of -current should be bumped).

Note that if an interface have both MP-safe and non-MP-safe operations at a
time, we have to set the IFEF_MPSAFE flag and let callees of non-MP-safe
opeartions take the kernel lock.

Proposed on tech-kern@ and tech-net@
 1.111  12-Nov-2017  msaitoh Remove obsoleted comment. This comment should have been removed in rev. 1.97.
 1.110  09-Nov-2017  msaitoh On device which has SFP(+) cage and a module is inserted, hw->phy.id is not
MII PHY id but SFF 8024 ID. So checking hw->phy.id with 0 doesn't work.
Print PHY ID only for copper PHY.
 1.109  02-Nov-2017  msaitoh - Handle hw.ixgN.advertise_speed correctly.
- Fix hw.ixgN.advertise_speed sysctl's description.
 1.108  26-Oct-2017  msaitoh - Remove all half duplex setting.
- Remove special handling of IXGBE_DEV_ID_82598AT's 1000BaseT. The PHY is
compliant with clause 45, so the media is added in the beginning of
ixgbe_add_media_types().
 1.107  25-Oct-2017  msaitoh - For X550 and newer, print NVM Image Version with %u.%02x (e.g. "0.05").
- Fix value check of OEM_NVM_IMAGE_VER.
 1.106  23-Oct-2017  msaitoh If if_initialize() failed in the attach function, free resources and return.
 1.105  18-Oct-2017  msaitoh Protect ec_multi* with mutex like other MP safe Ethernet drivers.
See if_ether.h rev. 1.66 and related stuff:
http://mail-index.netbsd.org/source-changes/2016/12/28/msg080289.html
 1.104  13-Oct-2017  msaitoh Set baudrate correctly. A device which use mii(4) interface can set
if_baudrate atomatically by mii_phy_statusmsg(). ixg(4) and ixv(4) don't
use mii(4), so calling ifmedia_baudrate() directly is required.

XXX need the same same work for wm(4)'s TBI and SERDEV devices.
 1.103  04-Oct-2017  msaitoh - Remove half-duplex setting for more than 1000Mbps in ixgbe_add_media_types()
because those medias are not in the spec.
- Add 2.5GBASE-T and 5GBASE-T support. Tested with X550-T1.

Example:
ixg0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities=fff80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx>
capabilities=fff80<TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx>
capabilities=fff80<TCP6CSUM_Tx,UDP6CSUM_Rx,UDP6CSUM_Tx,TSO6,LRO>
enabled=7ff80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx>
enabled=7ff80<TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx>
enabled=7ff80<TCP6CSUM_Tx,UDP6CSUM_Rx,UDP6CSUM_Tx,TSO6>
ec_capabilities=7<VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU>
ec_enabled=7<VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU>
address: a0:36:9f:b0:f5:b0
media: Ethernet 2.5GBASE-T full-duplex
status: active
supported Ethernet media:
media 10Gbase-T
media 10Gbase-T mediaopt full-duplex
media 1000baseT
media 1000baseT mediaopt full-duplex
media 100baseTX
media 100baseTX mediaopt full-duplex
media 2.5GBASE-T mediaopt full-duplex
media 5GBASE-T mediaopt full-duplex
media autoselect
inet 172.16.0.1/24 broadcast 172.16.0.255 flags 0x0
inet6 fe80::a236:9fff:feb0:f5b0%ixg0/64 flags 0x0 scopeid 0x1
 1.102  04-Oct-2017  msaitoh Fix a bug that X550EM (Denverton) can't force 10BaseT.
 1.101  27-Sep-2017  msaitoh Print device name in ixv_attach().
 1.100  31-Aug-2017  msaitoh Fix 2500 KX media setting in last commit.
 1.99  30-Aug-2017  msaitoh - Sync with FreeBSD r320688 (and up to r322865):
- Add C3000(Denvertion(-NS)) support.
- Add bypass function support for bypass adapters. Sysctls are provided.
Not tested because I have no any bypass adapter.
- ixv(4): set RSS mapping.
- Change EEE sysctl.
- ixv(4): Add TSOv6.
- ixv(4): Mailbox API 1.2 and more are implemented and comment says it
negotiate with 1.2 but it really does 1.1...
- Remove thermal test sysctl.
- Fix unknown bugs.
- Print driver feature capabilities and enable bits when verbose boot.
 1.98  30-Aug-2017  msaitoh FreeBSD r320688 sorted a lot of functions. Merging that change by one commit
makes difficult to know what was really changed. To make change understandable,
commit only function sort and white space changes before real change.
 1.97  30-Aug-2017  msaitoh Don't limit number of queue pair to 8. Take max TX queues and max RX queues
into account. 82598 has 32 TX queue and 64 RX queues. Others has 128 TX queues
and 128 RX queues. Number of MSI-X table entries is 64, so the max queue pairs
is 63 (64 minus the Others (e.g. link status change)).
 1.96  24-Aug-2017  msaitoh Remove unused counters.
 1.95  03-Jul-2017  msaitoh Print PHY ID.
 1.94  27-Jun-2017  msaitoh Fix a bug of ixg(4)'s media setting.

Before:
ifconfig ixg0 media 100baseTX -> advertise 100Mbps only
ifconfig ixg0 media 1000baseT -> advertise 1Gbps and 1000Mbps (NG)
ifconfig ixg0 media 10Gbase-T -> advertise all (NG)
ifconfig ixg0 media auto -> advertise all

After:
ifconfig ixg0 media 100baseTX -> advertise 100Mbps only
ifconfig ixg0 media 1000baseT -> advertise 1Gbps only
ifconfig ixg0 media 10Gbase-T -> advertise 10Gbps only
ifconfig ixg0 media auto -> advertise all
 1.93  27-Jun-2017  msaitoh Reduce diff against FreeBSD. change hw.ixgN.ts to hw.ixgN.thermal_test
(FreeBSD r282289).
 1.92  27-Jun-2017  msaitoh Reduce diff against FreeBSD. No functional change.
 1.91  23-Jun-2017  msaitoh Print verbose outout in ixgbe_update_link_status() correctly on 5Gbps and
2.5Gbps (NBASE-T) for X550T[12] and newer.
 1.90  23-Jun-2017  msaitoh Use IFM_1000_KX more.
 1.89  12-Jun-2017  msaitoh Use IFM_1000_KX and IFM_2500_KX.
 1.88  02-Jun-2017  msaitoh branches: 1.88.2;
- Print NVM Image Version, PHY FW Revision, NVM Map version and OEM NVM
Image version
- s/TrackID/ETrackID/
 1.87  26-May-2017  msaitoh Add missing {ixgbe,ixv}_stop() in the detach function. Without this change,
shutdown won't finish or panic on heay traffic.
 1.86  26-May-2017  msaitoh Count Bad SFD (Start Frame Delimiter). X550 and newer have this register.
 1.85  26-May-2017  msaitoh Clear all event counters when SIOCZIFDATA(ifconfig -z) is called.
 1.84  22-May-2017  msaitoh Fix a bug that the driver prints "Link is up 1 Gbps" even if the link is
100Mbps. This change is the same as a part of ixv.c rev. 1.42.
 1.83  22-May-2017  msaitoh Document says M[LR]FC are valid when link is up and 10Gbps, so:
- Add those values when link is up and 10Gbps
- Discard those vaules when link becomes up and the speed is 10Gbps
 1.82  18-May-2017  msaitoh - Count "Total Packets Missed" by evcnt(9)
- Call evcnt_attach_dynamic()/detach() for stats->mngpdc
(Management Packets Dropped).
- Make stats->rnbc (Receive No Buffers) evcnt(9). Only 82598 has this register.
- Set RQSMR, TQSM (or TQSMR on 82598) to count qprc, qptc, qbrc, qbtc and qprdc
in each queue counter. Without this change, all queue's counts are counted in
queue 0's. Even if with this change, only MPC[0] is counted and other MPCs
are not counted.
 1.81  28-Apr-2017  msaitoh Fix a bug that reading hw.ixgM.qN.interrupt_rate cause the interrupt
throtting rate register to 0. Check sysctl read/write correctly...
 1.80  03-Mar-2017  msaitoh branches: 1.80.4;
Set PCI_INTR_MPSAFE, SOFTINT_MPSAFE, CALLOUT_MPSAFE and IFEF_START_MPSAFE
if NET_MPSAFE is defined.
 1.79  24-Feb-2017  msaitoh Print mac.type and the TrackID.
 1.78  16-Feb-2017  msaitoh Do if_snd check even if IXGBE_LEGACY_TX is used. It's used by ALTQ.
 1.77  16-Feb-2017  msaitoh txt_si softint is used only for multiqueue (ixgbe_mq_start_locked()), so don't
schedule it in ixgbe_legacy_irq().
 1.76  13-Feb-2017  msaitoh Remove more ix*_start_locked() from interrupt context like previous commit.
> Fix a bug that ix*_start_locked() is called in interrput context
> (ix*_msix_que). The function is called in softint(ix*_handle_que()). OK'd by
>k-nakahara.
 1.75  13-Feb-2017  msaitoh Use percpuq.
 1.74  13-Feb-2017  msaitoh Fix a bug that ix*_start_locked() is called in interrput context
(ix*_msix_que). The function is called in softint(ix*_handle_que()). OK'd by
k-nakahara.
 1.73  10-Feb-2017  msaitoh Change the Interrupt Moderation flag from global variable to per device.
 1.72  10-Feb-2017  msaitoh - Both mbuf_defrag_failed and m_defrag_failed existed. Remove m_defrag_failed.
- rx_irq, dropped_pkts, morerx, moretx and txloops counters are uncounted, so
remove them.
- Count handleq in ixv_handle_que().
- Detach event counters correctly.
- Set some per-queue event names correctly.
 1.71  08-Feb-2017  msaitoh Print CPU number correctly.
 1.70  08-Feb-2017  msaitoh Call IFQ_SET_MAXLEN() even if TX multiqueue is used. ALTQ uses it.
 1.69  08-Feb-2017  msaitoh Add queue number into interrupt name.
 1.68  08-Feb-2017  msaitoh Set ifm_active to IFM_NONE when the physical interface's link is down.
Now ifconfig shows "media: Ethernet autoselect '(none)'".
 1.67  01-Feb-2017  msaitoh TX multiqueue. If you want to disable it, enable IXGBE_LEGACY_TX
in ixgbe_netbsd.h
 1.66  25-Jan-2017  msaitoh Call ixgbe_get_supported_physical_layer() before ixgbe_add_media_types() to
set new media types correctly.
 1.65  25-Jan-2017  msaitoh Remove debug printf()s.
 1.64  25-Jan-2017  msaitoh Fix SFP+ insersion or replacement stuff.
 1.63  19-Jan-2017  msaitoh Reduce diff against FreeBSD. No functional change.
 1.62  18-Jan-2017  msaitoh Now we can use multiqueue. It's default on ixg(4). Not yet for ixv(4).
 1.61  18-Jan-2017  msaitoh Fix sysctl stuff. Make the top sysctl node and keep the pointer.
 1.60  18-Jan-2017  msaitoh Use 64bit DMA tag. If not, a lot of bounce buffer is allocated.
Fixes PR#49968 reported by Hauke.

XXX pullup-[67].
 1.59  05-Jan-2017  msaitoh branches: 1.59.2;
Fix INIT_DEBUGOUT() messages.
 1.58  28-Dec-2016  msaitoh Fix a bug that hw.ixgN.wol_enable=0 doesn't work correctly. Clear the WUC
and WUFC register if wol_enable is 0. ixgbe_setup_low_power_mode() calls
ixgbe_stop() and it resets the chip. The reset change WUC and WUFC registers to
the default, so clearing WUC and WUFC should be done after ixgbe_stop().
 1.57  28-Dec-2016  msaitoh Allow 0 as the defalut of hw.ixgN.advertise_speed sysctl.
 1.56  27-Dec-2016  msaitoh Fix flow control setting sysctl. I don't know why disabling autonego when
the flow control parameter is changed. Now the ixgN.fc sysctl works as
expected.
 1.55  16-Dec-2016  msaitoh Add missing IFM_FDX.
 1.54  16-Dec-2016  msaitoh Remove extra newline in debug printfs. ixgbe's *DEBUGOUT* macros automatically
add newline.
 1.53  05-Dec-2016  msaitoh - Fix wol_enable, fc and wufc sysctls to work correctly.
- Fix RCS Id.
 1.52  05-Dec-2016  msaitoh Update ixg(4) and ixv(4) up to FreeBSD r303890:
- 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. (FreeBSD r295093)
- Fixup DA cable detection routine. (FreeBSD r303032)
- Some minor changes
 1.51  02-Dec-2016  msaitoh Update ixg(4) and ixv(4) up to FreeBSD r294578:
- 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.
FreeBSD r293334.
- 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. FreeBSD r294578.
- Some others (e.g. LRO(not used by NetBSD)).
 1.50  02-Dec-2016  msaitoh Fix ix{gbe,v}_set_sysctlvalue().
 1.49  02-Dec-2016  msaitoh - Add missing pmf_device_deregister() in ixgbe_detach()
- Remove extra newline from an sysctl description.
- Fix dmesg output when the number of PCIe lane can't get.
 1.48  02-Dec-2016  msaitoh Update ixg(4) and ixv(4) up to FreeBSD r292674:
- Add X552 SFP+ and X550T single port.
- Bug fixes.
 1.47  02-Dec-2016  msaitoh Update ixg(4) and ixv(4) up to FreeBSD r289238:
- Add support for sysctl knobs to live tune the per interrupt rx/tx packet
processing limits in ixgbe(4)
- Some others (netmap, etc.)
 1.46  02-Dec-2016  msaitoh Update ixg(4) and ixv(4) up to FreeBSD r285590:
- 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).
 1.45  02-Dec-2016  msaitoh Update ixg(4) and ixv(4) up to FreeBSD r283881:
- SRIOV support (not enabled because NetBSD doesn't support it).
 1.44  01-Dec-2016  msaitoh Update ixg(4) and ixv(4) up to FreeBSD r282299:
- Add support for X55x.
- ADD EEE support (not tested).
- Add WOL support (not tested).
- Add suspend/resume support (not testd).
- Add LPLU support (not tested).
- Add DMA Coalescing (note verified).
- Not tested well for sysctls.
- Fix ixgbe_set_advertise() a bit. At least, FreeBSD r294578 is required
to work hw.ixg0.advertise_speed sysctl correctly.
 1.43  01-Dec-2016  msaitoh Update ixg(4) and ixv(4) up to FreeBSD r280197:
- Add support for 82599_QSFP_SF_QP and X540T1.
- Add partial support for X55x. It's required to sync with FreeBSD r282299
to support X55x.
- Bugfixes.
 1.42  28-Nov-2016  msaitoh FreeBSD r280182 made new file ix_txrx.c and moved ixgbe.c and ixv's common
code into it. Before sync with whole of them, just move ixgbe.c and ixv.c's
common code into ix_txrx.c from ixgbe.c. In this commit, only ixgbe.c is split
into the device dependent part and the common part. ixv.c isn't change to make
this commit no functional change. To use ixv.c with ix_txrx.c, it's required
to modify the common part's API and functions themselves.

This commit is done to make the next change easy to understand.
 1.41  25-Nov-2016  msaitoh Remove #ifdef NETBSD_MSI_OR_MSIX to be simple. ixv(4) isn't attached if
__HAVE_PCI_MSI_MSIX isn't set because MSI-X must be used.
 1.40  13-Oct-2016  jdolecek provide intr xname
 1.39  11-Jul-2016  knakahara branches: 1.39.2;
pci_intr_type() is required pci_chipset_tag_t argument by other than x86.

pointed out by nonaka@n.o.
 1.38  10-Jun-2016  ozaki-r Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.37  09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.36  17-Aug-2015  knakahara Add kernel code to support intrctl(8).
 1.35  13-Aug-2015  msaitoh Reduce diff against FreeBSD r280181.
 1.34  13-Aug-2015  msaitoh - Add MSI/MSI-X support. The multiqueue function is not supported yet.
- Make ixv.c compilable. _NOT_TESTED_YET_
 1.33  05-Aug-2015  msaitoh Sync ixg(4) up to FreeBSD r279805 (or r280181) which include some bugfixes.
TODO:
- Merge r280182 and newer. It's required to support X55x.
- MSI/MSI-X support.
 1.32  05-Aug-2015  msaitoh Fix error path in ixgbe_attach() and ixgbe_detatch() to prevent panic.
 1.31  03-Aug-2015  msaitoh Add missing evcnt_detach(&rxr->rx_copies) in ixgbe_detach().
 1.30  09-May-2015  christos remove unreachable code.
 1.29  06-May-2015  msaitoh Fixes link error without vlan. PR#49879.
 1.28  24-Apr-2015  msaitoh Sync ixg(4) up to FreeBSD r250108:
- Cleanup some unused counters and some unused code.
- Improve performance.
- Fix flow control - don't override user value on re-init
- Fix to make 1G optics work correctly
- Change to interrupt enabling - some bits were incorrect
for certain hardware.
- Certain stats fixes, remove a duplicate increment of
ierror, thanks to Scott Long for pointing these out.
- Fix the setting of RX which related to multicast.
- Some netmap related fixes.
 1.27  14-Apr-2015  msaitoh Fix a bug that ifconfig -z (SOICZIFDATA) doesn't work.
 1.26  14-Apr-2015  msaitoh Sync ixg(4) up to FreeBSD r243716:
- A lot of bugfixes. Some of them are realted to multi queue and those
have not affected in NetBSD because we have not used it yet.
- Show 1000Base-SX correctly.
- Fix if_baudrate from 1G to 10G.
- Improve performance.
 1.25  02-Apr-2015  msaitoh Update our ixg(4) driver up to FreeBSD r238149:
- Add TSO6 support.
- The max size in dma tag is changed from 65535 to 262140 (IXGBE_TSO_SIZE).
The value is the same as other *BSDs. The change might cause a address
space shortage (ixgbe_dmamap_create() might fail) on some machines.
- Fix a lot of bugs.
- Improve performance.
 1.24  27-Mar-2015  msaitoh Synchronize our ixg(4) driver up to FreeBSD r230775:
- Add X540 support.
- Add 100BaseTX support.
- Fix a lot of bugs.
- Improve performance.
 1.23  25-Mar-2015  msaitoh Fix a bug that vlan setting may not apply to the parent interface correctly.
 1.22  19-Mar-2015  msaitoh Sync ixg(4) up to FreeBSD r230572.

- Fix in the interrupt handler to make sure the stack TX queue is processed.
(FreeBSD r222588)
- The maximum read size of incoming packets is done in 1024-byte increments.
The current code was rounding down the maximum frame size instead of
routing up, resulting in a read size of 1024 bytes, in the non-jumbo
frame case, and splitting the packets across multiple mbufs.
(FreeBSD r225045)
- Consequently the above problem exposed another issue, which is when
packets were splitted across multiple mbufs, and all of the mbufs in the
chain have the M_PKTHDR flag set. (FreeBSD r225045)
- Use the correct constant for conversion between interrupt rate
and EITR values (the previous values were off by a factor of 2)
(FreeBSD r230572)
- Make dev.ix.N.queueM.interrupt_rate a RW sysctl variable. Changing
individual values affects the queue immediately, and propagates to all
interfaces at the next reinit. (FreeBSD r230572)
- Add dev.ix.N.queueM.irqs rdonly sysctl, to export the actual interrupt
counts. (FreeBSD r230572)
- Some netmap related changes.
 1.21  24-Feb-2015  msaitoh Add 82599EN_SFP and 82599_SFP_SF_QP. Not tested.
 1.20  24-Feb-2015  msaitoh Change macro name IXGBE_DEV_ID_82599_SFP_DELL to IXGBE_DEV_ID_82599_SFP_SF2.
Same as OpenBSD and Linux. No binary change.
 1.19  07-Feb-2015  christos disable preemption while scheduling the softint to configure the link.
 1.18  04-Feb-2015  msaitoh Fix mutex related problem reported by Uwe Toenjes in PR#49328:
- Revert ixgbe_netbsd.c rev. 1.2
- make CORE_LOCK adaptive
- Release spin lock while reinitializing the jumb buffer structure.
 1.17  04-Feb-2015  msaitoh Remove extra IXGBE_TX_LOCK()/IXGBE_TX_UNLOCK() from
ixgbe_free_transmit_structures(). This function is called in the end of
the detach function. if_stop was called and almost all resources were
freed, so it's not required to block the TX stuff.
 1.16  04-Feb-2015  msaitoh Add missing IXGBE_RX_LOCK_DESTROY() for the detach path.
 1.15  13-Jan-2015  msaitoh Fix a legacy interrupt problem. If the INTx line was shared with another
device, the ixgbe_legacy_irq() enabled the interrupt even if the interface
was down. Check the interface state and call functions appropriately.
 1.14  21-Apr-2014  chs branches: 1.14.2; 1.14.4;
only attach/detach stats->mngptc once.
remove a low-value printf().
 1.13  17-Apr-2014  christos CID/1008347, CID/1008348, CID/1008349: overflow before widen
CID/1203198, CID/1203199: Uninitialized scalar variable
 1.12  15-Apr-2014  hannken Add __diagused.
 1.11  11-Apr-2014  joerg Mark ixgbe_disable_queue as unused.
 1.10  08-Apr-2014  christos Add dell's flavor (from uwe, in current-users@)
 1.9  30-Mar-2014  skrll branches: 1.9.2;
Make this compile

- Fix pci_intr_string usage
- Remove ununsed
- define variables with their usage

kern/48690: ixg* driver doesn't compile

Untested.
 1.8  29-Mar-2014  christos make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.7  25-Feb-2014  pooka Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.6  09-Feb-2014  njoly Remove a few noisy debug printf.
 1.5  18-Jun-2012  dsl branches: 1.5.2; 1.5.4;
Missed one of the (void *) casts on the args to sysctl_createv().
 1.4  16-Jun-2012  dsl Add explicit (void *) casts for when sysctl_createv() is passed
CTLTYPE_INT but the address of a structure (and a function).
 1.3  02-Jun-2012  dsl Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.2  19-Nov-2011  tls branches: 1.2.4;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.1  12-Aug-2011  dyoung branches: 1.1.2;
Add sources for ixgbe(4), a Intel 82599 10-gigabit ethernet driver
ported from FreeBSD.
 1.1.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.2.2  30-Oct-2012  yamt sync with head
 1.1.2.1  17-Apr-2012  yamt sync with head
 1.2.4.1  25-Mar-2017  snj Pull up following revision(s) (requested by msaitoh in ticket #1439):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.60 via patch
Use 64bit DMA tag. If not, a lot of bounce buffer is allocated.
Fixes PR#49968 reported by Hauke.
 1.5.4.1  18-May-2014  rmind sync with head
 1.5.2.2  03-Dec-2017  jdolecek update from HEAD
 1.5.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.2.1  10-Aug-2014  tls Rebase.
 1.14.4.9  28-Aug-2017  skrll Sync with HEAD
 1.14.4.8  05-Feb-2017  skrll Sync with HEAD
 1.14.4.7  05-Dec-2016  skrll Sync with HEAD
 1.14.4.6  05-Oct-2016  skrll Sync with HEAD
 1.14.4.5  09-Jul-2016  skrll Sync with HEAD
 1.14.4.4  19-Mar-2016  skrll Sync with HEAD
 1.14.4.3  22-Sep-2015  skrll Sync with HEAD
 1.14.4.2  06-Jun-2015  skrll Sync with HEAD
 1.14.4.1  06-Apr-2015  skrll Sync with HEAD
 1.14.2.7  09-Mar-2017  snj Pull up following revision(s) (requested by msaitoh in ticket #1370):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.60
Use 64bit DMA tag. If not, a lot of bounce buffer is allocated.
Fixes PR#49968 reported by Hauke.
 1.14.2.6  14-Jun-2016  snj branches: 1.14.2.6.2;
Pull up following revision(s) (requested by msaitoh in ticket #1174):
sys/dev/pci/ixgbe/README: 1.2
sys/dev/pci/ixgbe/ixgbe.c: 1.30-1.33, 1.35 via patch
sys/dev/pci/ixgbe/ixgbe.h: 1.8 via patch
sys/dev/pci/ixgbe/ixgbe_82598.c: 1.5 via patch
sys/dev/pci/ixgbe/ixgbe_82599.c: 1.10 via patch
sys/dev/pci/ixgbe/ixgbe_api.c: 1.8-1.11 via patch
sys/dev/pci/ixgbe/ixgbe_api.h: 1.5-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_common.c: 1.6-1.7 via patch
sys/dev/pci/ixgbe/ixgbe_common.h: 1.5 via patch
sys/dev/pci/ixgbe/ixgbe_osdep.h: 1.9 via patch
sys/dev/pci/ixgbe/ixgbe_phy.c: 1.6 via patch
sys/dev/pci/ixgbe/ixgbe_phy.h: 1.5 via patch
sys/dev/pci/ixgbe/ixgbe_type.h: 1.11, 1.13 via patch
sys/dev/pci/ixgbe/ixgbe_vf.c: 1.5-1.6 via patch
sys/dev/pci/ixgbe/ixv.c: 1.9-1.10, 1.12-1.14 via patch
sys/dev/pci/ixgbe/ixv.h: 1.6 via patch
sys/dev/pci/ixgbe/ixgbe_dcb.c: 1.1
sys/dev/pci/ixgbe/ixgbe_dcb.h: 1.1
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c: 1.1
sys/dev/pci/ixgbe/ixgbe_dcb_82598.h: 1.1
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c: 1.1
sys/dev/pci/ixgbe/ixgbe_dcb_82599.h: 1.1
Sync ixg(4) up to ixgbe.c rev. 1.35 except MSI/MSI-X and NET_MPSAFE:
- Sync ixg(4) up to FreeBSD r279805 (or r280181) which include some
bugfixes.
- Add missing evcnt_detach(&rxr->rx_copies) in ixgbe_detach().
- Fix error path in ixgbe_attach() and ixgbe_detatch() to prevent
panic.
- Remove unreachable code.
- Remove duplicated assignment of mh->m_len.
- Reduce the diff against FreeBSD (tabs, spaces and comments)
- ixv.c: Fix unintialized data. Include vlan.h and check NVLAN.
- Avoid shadowing global `min'.
 1.14.2.5  06-May-2015  riz Pull up following revisions (requested by msaitoh in ticket #734):
sys/dev/pci/ixgbe/LICENSE 1.2
sys/dev/pci/ixgbe/ixgbe.c 1.28-1.29
sys/dev/pci/ixgbe/ixgbe.h 1.7
sys/dev/pci/ixgbe/ixgbe_82598.c 1.4
sys/dev/pci/ixgbe/ixgbe_82598.h 1.3
sys/dev/pci/ixgbe/ixgbe_82599.c 1.9
sys/dev/pci/ixgbe/ixgbe_82599.h 1.2
sys/dev/pci/ixgbe/ixgbe_api.c 1.7
sys/dev/pci/ixgbe/ixgbe_api.h 1.4
sys/dev/pci/ixgbe/ixgbe_common.c 1.5
sys/dev/pci/ixgbe/ixgbe_common.h 1.4
sys/dev/pci/ixgbe/ixgbe_mbx.h 1.4
sys/dev/pci/ixgbe/ixgbe_netbsd.h 1.3
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.7
sys/dev/pci/ixgbe/ixgbe_phy.c 1.5
sys/dev/pci/ixgbe/ixgbe_phy.h 1.4
sys/dev/pci/ixgbe/ixgbe_type.h 1.10
sys/dev/pci/ixgbe/ixgbe_vf.c 1.4
sys/dev/pci/ixgbe/ixgbe_vf.h 1.5
sys/dev/pci/ixgbe/ixgbe_x540.c 1.3
sys/dev/pci/ixgbe/ixgbe_x540.h 1.2
sys/dev/pci/ixgbe/ixv.c 1.8

- Sync ixg(4) up to FreeBSD r250108:
- Cleanup some unused counters and some unused code.
- Improve performance.
- Fix flow control - don't override user value on re-init
- Fix to make 1G optics work correctly
- Change to interrupt enabling - some bits were incorrect
for certain hardware.
- Certain stats fixes, remove a duplicate increment of
ierror, thanks to Scott Long for pointing these out.
- Fix the setting of RX which related to multicast.
- Some netmap related fixes.
- Fixes link error without vlan. PR#49879 reported by Hauke Fath.
[msaitoh, ticket #734]
 1.14.2.4  19-Apr-2015  riz Apply patch (requested by msaitoh in ticket #697):
sys/dev/pci/files.pci 1.375 via patch
sys/dev/pci/ixgbe/ixgbe.c 1.24-1.27 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.4-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_82598.c 1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_82598.h 1.1-1.2 via patch
sys/dev/pci/ixgbe/ixgbe_82599.c 1.6-1.8 via patch
sys/dev/pci/ixgbe/ixgbe_82599.h 1.1 via patch
sys/dev/pci/ixgbe/ixgbe_api.c 1.5-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_api.h 1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_common.c 1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_common.h 1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.c 1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.h 1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.4-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_phy.c 1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_phy.h 1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_type.h 1.8-1.9 via patch
sys/dev/pci/ixgbe/ixgbe_vf.c 1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_vf.h 1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_x540.c 1.1-1.2 via patch
sys/dev/pci/ixgbe/ixgbe_x540.h 1.1 via patch
sys/dev/pci/ixgbe/ixv.c 1.5-1.7 via patch
sys/dev/pci/ixgbe/ixv.h 1.4-1.5 via patch

Synchronize our ixg(4) driver up to FreeBSD r243716:
- Add X540 support.
- Add TSO6 support.
- Add 100BaseTX support.
- The max size in dma tag is changed from 65535 to 262140 (IXGBE_TSO_SIZE).
The value is the same as other *BSDs. The change might cause a address
space shortage (ixgbe_dmamap_create() might fail) on some machines.
- Show 1000Base-SX correctly.
- Fix if_baudrate from 1G to 10G.
- Fix a bug that ifconfig -z (SOICZIFDATA) doesn't work.
- Fix a lot of bugs.
- Improve performance.
[msaitoh, ticket #697]
 1.14.2.3  26-Mar-2015  martin Pull up the following revisions (via patch), requested by msaitoh in #641:

sys/dev/pci/files.pci 1.374
sys/dev/pci/ixgbe/ixgbe.h 1.3
sys/dev/pci/ixgbe/ixgbe.c 1.20-1.23
sys/dev/pci/ixgbe/ixgbe_type.h 1.3-1.7
sys/dev/pci/ixgbe/ixgbe_82599.c 1.4-1.5
sys/dev/pci/ixgbe/ixgbe_api.c 1.3-1.4
sys/dev/pci/ixgbe/ixgbe_vf.h 1.2
sys/dev/pci/ixgbe/ixv.c 1.3-1.4
sys/dev/pci/ixgbe/ixv.h 1.3

- Sync ixg(4) up to FreeBSD r230572.
- Fix in the interrupt handler to make sure the stack TX queue is processed.
(FreeBSD r222588)
- The maximum read size of incoming packets is done in 1024-byte increments.
The current code was rounding down the maximum frame size instead of
routing up, resulting in a read size of 1024 bytes, in the non-jumbo
frame case, and splitting the packets across multiple mbufs.
(FreeBSD r225045)
- Consequently the above problem exposed another issue, which is when
packets were splitted across multiple mbufs, and all of the mbufs in the
chain have the M_PKTHDR flag set. (FreeBSD r225045)
- Use the correct constant for conversion between interrupt rate
and EITR values (the previous values were off by a factor of 2)
(FreeBSD r230572)
- Make dev.ix.N.queueM.interrupt_rate a RW sysctl variable. Changing
individual values affects the queue immediately, and propagates to all
interfaces at the next reinit. (FreeBSD r230572)
- Add dev.ix.N.queueM.irqs rdonly sysctl, to export the actual interrupt
counts. (FreeBSD r230572)
- Some netmap related changes.
- Fix a bug that vlan setting may not apply to the parent interface correctly.
- Add 82599EN_SFP and 82599_SFP_SF_QP.
- Modify to make Intel Intel 10G Ethernet (ixg(4)) virtual function ixv(4)
compilable. Not completed yet. It's required to use MSI-X.
- Change comments, tabs and spaces to make difference among *BSDs small.
- Enclose macro argument correctly. Same as *BSDs. No binary change.
- Add missing parenthesis in IXGBE_CORE_LOCK_ASSERT() macro. No binary change.
 1.14.2.2  24-Feb-2015  martin Pull up following revision(s) (requested by msaitoh in ticket #545):
sys/dev/pci/ixgbe/ixgbe.h: revision 1.2
sys/dev/pci/ixgbe/ixgbe_netbsd.c: revision 1.3
sys/dev/pci/ixgbe/ixgbe.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe.c: revision 1.18
sys/dev/pci/ixgbe/ixgbe.c: revision 1.19
Add missing IXGBE_RX_LOCK_DESTROY() for the detach path.
Remove extra IXGBE_TX_LOCK()/IXGBE_TX_UNLOCK() from
ixgbe_free_transmit_structures(). This function is called in the end of
the detach function. if_stop was called and almost all resources were
freed, so it's not required to block the TX stuff.
Fix mutex related problem reported by Uwe Toenjes in PR#49328:
- Revert ixgbe_netbsd.c rev. 1.2
- make CORE_LOCK adaptive
- Release spin lock while reinitializing the jumb buffer structure.
disable preemption while scheduling the softint to configure the link.
 1.14.2.1  17-Feb-2015  martin Pull up following revision(s) (requested by msaitoh in ticket #527):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.15
Fix a legacy interrupt problem. If the INTx line was shared with another
device, the ixgbe_legacy_irq() enabled the interrupt even if the interface
was down. Check the interface state and call functions appropriately.
 1.14.2.6.2.1  13-Mar-2017  skrll Sync with netbsd-7-1-RELEASE
 1.39.2.3  20-Mar-2017  pgoyette Sync with HEAD
 1.39.2.2  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.39.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.59.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.80.4.2  19-May-2017  pgoyette Resolve conflicts from previous merge (all resulting from $NetBSD
keywork expansion)
 1.80.4.1  02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.88.2.59  03-Feb-2024  martin Pull up the following, requested by msaitoh in ticket #1933:

sys/dev/pci/ixgbe/ix_txrx.c 1.105-1.116 via patch
sys/dev/pci/ixgbe/ixgbe.c 1.345-1.346,1.349 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.94-1.98
sys/dev/pci/ixgbe/ixgbe_type.h 1.62
sys/dev/pci/ixgbe/ixv.c 1.193,1.195-1.196

- Clear the WTHRESH bit field before writing it.
- Optimize ixgbe_txeof().
- Use kmem_zalloc() instead of malloc(,M_ZERO).
- Add QPRDC(Queue Packet Receive Drop Count) into iqdrops.
- No functional change
- Move assignment of TXD.
- ixv(4): Remove unused IFF_OACTIVE.
- Don't include the Flow Director related members to reduce the
size of struct tx_ring. On amd64 and aarch64, the real size is
not changed because of the alignment.
- The descriptor ring size and the alignment are tested in the
attach function, so it's not required to use
roundup2(size, DBA_ALIGN).
- Use #ifdef LRO more to reduce the size of struct rx_ring.
- Change "me" from 32bit to 8bit because the max is 128.
This commit doesn't change the real size of ix_queue, tx_ring
and rx_ring because of the alignment.
- Th RSC (hardware receive side coalescing) feature has been
disabled all along, so enclose the code with #ifdef RSC.
- Remove unused.
- Modify for the readability.
- Modify comment.
- Fix comment. Whitespace.
 1.88.2.58  18-Oct-2023  martin Pull up the following, requested by msaitoh in ticket #1914:

sys/dev/pci/ixgbe/ix_txrx.c 1.103-1.104
sys/dev/pci/ixgbe/ixgbe.c 1.334-1.338,
1.341-1.344 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.90-1.93
sys/dev/pci/ixgbe/ixgbe_82599.c 1.31-1.32
sys/dev/pci/ixgbe/ixgbe_api.c 1.29
sys/dev/pci/ixgbe/ixgbe_bypass.h 1.5
sys/dev/pci/ixgbe/ixgbe_common.c 1.46-1.47
sys/dev/pci/ixgbe/ixgbe_common.h 1.18
sys/dev/pci/ixgbe/ixgbe_dcb.c 1.14-1.15
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.13
sys/dev/pci/ixgbe/ixgbe_type.h 1.59-1.61
sys/dev/pci/ixgbe/ixgbe_x540.c 1.24
sys/dev/pci/ixgbe/ixgbe_x550.c 1.28
sys/dev/pci/ixgbe/ixv.c 1.187-1.192 via patch

- ixg(4): Add 82599 LS support once again.
- ixg(4): Filter out spurious link up indication more.
- ixg(4): Print DEVICE_CAPS register.
- ixg(4): Fix a bug that the number of queues is unintentionally
limited to a small number or wrong error message may be printed
when two devices' number of MSI-X vectors are different.
- Modify error message of wrong TX/RX descriptor size.
- Enable interrupt after setting IFF_RUNNING.
- Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change
all devices all queues default interrupt rate.
- Cleanup the code.
 1.88.2.57  13-Oct-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #1912):

sys/dev/pci/ixgbe/if_bypass.c 1.10
sys/dev/pci/ixgbe/if_fdir.c 1.6 via patch
sys/dev/pci/ixgbe/if_sriov.c 1.18 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.102 via patch
sys/dev/pci/ixgbe/ixgbe.c 1.333,1.339 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.89
sys/dev/pci/ixgbe/ixgbe_api.h 1.17
sys/dev/pci/ixgbe/ixgbe_common.h 1.17
sys/dev/pci/ixgbe/ixgbe_bypass.h 1.4
sys/dev/pci/ixgbe/ixgbe_common.c 1.45
sys/dev/pci/ixgbe/ixgbe_fdir.h 1.5
sys/dev/pci/ixgbe/ixgbe_netmap.h 1.3
sys/dev/pci/ixgbe/ixgbe_netmap.c 1.6
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.9
sys/dev/pci/ixgbe/ixgbe_sriov.h 1.6
sys/dev/pci/ixgbe/ixgbe_type.h 1.58
sys/dev/pci/ixgbe/ixgbe_x550.c 1.27
sys/dev/pci/ixgbe/ixv.c 1.186 via patch

ixgbe: Rename some definitions, modify comment. No functional change.
Apply changes from FreeBSD's ix-3.3.31 and ixv-1.5.32.
- struct adapter *adapter -> struct ixgbe_softc *sc
- master -> primary
- black -> block

ixg(4): Whitespace. No functional change.
 1.88.2.56  08-Oct-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #1745):

sys/dev/pci/ixgbe/ixgbe.c 1.327-1.332 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.87-1.88
sys/dev/pci/ixgbe/ixv.c 1.184-1.185
sys/dev/pci/ixgbe/ix_txrx.c 1.101
sys/dev/pci/ixgbe/ixgbe_82599.c 1.30
sys/dev/pci/ixgbe/ixgbe_vf.c 1.32-1.33
sys/dev/pci/ixgbe/ixgbe_vf.h 1.18
sys/dev/pci/ixgbe/ixgbe_mbx.h 1.20
sys/dev/pci/ixgbe/ixgbe_type.h 1.57

- Reorder some event counters for readability.
- Rename some descriptions of event counters.
- Count Queue Bytes {Transmit, Receive} counter.
- Improve error check in ixgbe_check_mac_link_vf().
- Add new IXGBE_VF_GET_LINK_STATE message support.
The VF's link state can be forced to down by PF.
- Update FCTRL after writing multicast filter.
- Update comments.
 1.88.2.55  21-Jun-2023  martin Pullup the following revisions, requested by msaitoh in ticket #1828:

sys/dev/pci/ixgbe/ixgbe.c 1.325-1.326 via patch
sys/dev/pci/ixgbe/ixgbe_common.c 1.44
sys/dev/pci/ixgbe/ixgbe_type.h 1.56

- PCI device ID 0x15c8 also uses X557-AT PHY, so create the thermal
sensor sysctl for it, too.
- Count the number of link down events in the MAC using with
LINK_DN_CNT register.
 1.88.2.54  23-Jan-2023  martin Pull up the following revisions, requested by msaitoh in ticket #1796:

sys/dev/pci/files.pci 1.442
sys/dev/pci/ixgbe/ix_txrx.c 1.99-1.100
sys/dev/pci/ixgbe/ixgbe.c 1.320-1.324 via patch
sys/dev/pci/ixgbe/ixgbe_82598.c 1.19
sys/dev/pci/ixgbe/ixgbe_api.c 1.28
sys/dev/pci/ixgbe/ixgbe_common.c 1.43
sys/dev/pci/ixgbe/ixgbe_netbsd.h 1.17
sys/dev/pci/ixgbe/ixv.c 1.183

- Add an option for Tx to use deferred softint regardless of whether
can get txq lock or not. It's off by default.
- Call txeof first, then rxeof for the consistency.
- Make three "Unsupported SFP+ module..." messages the same.
- KNF. Modify comment. Fix typo.
 1.88.2.53  06-Jun-2022  martin Apply patch, requested by msaitoh in ticket #1746:

sys/dev/pci/ixgbe/ixgbe.c (apply patch)

Fix the location of "break" statement. No functional change intended.
 1.88.2.52  03-Jun-2022  martin Pull up the following revisions, requestes by msaitoh in ticket #1746:

sys/dev/pci/ixgbe/ix_txrx.c 1.95
sys/dev/pci/ixgbe/ixgbe.c 1.261,1.263,
1.265-1.268,1.273,
1.275-1.277,1.305,
1.312,
1.316-1.321 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.85 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.c 1.19
sys/dev/pci/ixgbe/ixgbe_netbsd.h 1.15-1.16
sys/dev/pci/ixgbe/ixgbe_type.h 1.46-1.47
sys/dev/pci/ixgbe/ixgbe_x550.c 1.26
sys/dev/pci/ixgbe/ixv.c 1.178,1.182 via patch

- Reduce code duplication between ixgbe_msix_admin() and
ixgbe_legacy_irq().
- Add missing code which was not in ixgbe_msix_admin() from
ixgbe_legacy_irq() and vice versa.
- Reorder code.
- Disable/enable the OTHER interrupts correctly.
- Don't return in the middle of ixgbe_msix_admin() when an flow
director reinit failed. NetBSD currently doesn't support flow
director, so this is not a real bug.
- Print ECC, PHY and temp error log using with ratecheck().
- Correctly re-enable queue interrupt in ixgbe_legacy_irq().
- Correctly enter the recovery mode.
- No functional change:
- Add some debug printf()s.
- Don't use "more" flag for simplify.
- Use macro.
- Fix typos in comment.
- KNF.
 1.88.2.51  31-May-2022  martin Pull up following revision(s) (requested by msaitoh in ticket #1745):

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.98
sys/dev/pci/ixgbe/ixv.c: revision 1.181
sys/dev/pci/ixgbe/ixgbe.c: revision 1.315
sys/dev/pci/ixgbe/ixgbe.h: revision 1.86

bus_dmamem_unmap() before bus_dmamem_free(), otherwise we may give back meomry
which is still (and will stay) mapped.

Fixes one instance of "panic: HYPERVISOR_mmu_update failed" on Xen.
There may be others.

Fix a bug that the legacy interrupt doesn't work when MSI-X allocation failed.
Fixes PR kern/56857.

Remove unused adapter->msix_mem.
 1.88.2.50  30-May-2022  martin Pull up the following revisions, requested by msaitoh in ticket #1744:

sys/dev/pci/ixgbe/ixgbe.c 1.270,1.280,1.307-1.311,
1.313-1.314 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97
sys/dev/pci/ixgbe/ixv.c 1.179-1.180 via patch


- ixg(4): Print Printed Board Assembly (PBA) number.
- ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might
fix small race but it's not so dangerous.
- Add value check for {tx,rx}_process_limit sysctl to avoid setting
wrong value.
- Add missing num_tx_desc sysctl.
- No functional change:
- KNF a bit.
- Simplify setting of EIAC register.
- Move the definition of eicr_mask variable.
- Enclose flow director stuff in ixgbe_intr_admin_common() with
IXGBE_FIR which is not defined in NetBSD.
- Modify comment for consistency.
- Use cached rx_copy_len in ixgbe_rxeof().
 1.88.2.49  01-Feb-2022  martin Pull up the following revisions, requested by msaitoh in ticket #1734:

sys/dev/pci/ixgbe/ixgbe.c 1.264,1.269,1.272,
1.306 via patch

Four INTx related fixes:
- Fix a bug that the all interrupt sources are enabled when the
interface is UP and the INTx line is shared with other devices.
- Fix a bug that it might incorrectly enable interrupt when
IFF_RUNNING is not set.
- Don't process TX/RX if a queue interrupt isn't occurred.
- Increment legacy interrupt counter after checking INTx sharing.
 1.88.2.48  31-Jan-2022  martin Pull up following revision(s) (requested by msaitoh in ticket #1730):

sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.31
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.23
sys/dev/pci/ixgbe/if_sriov.c: revision 1.17
sys/dev/pci/ixgbe/ixv.c: revision 1.172
sys/dev/pci/ixgbe/ixv.c: revision 1.173
sys/dev/pci/ixgbe/ixgbe.c: revision 1.301
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.55
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.29
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.18

Add code to support API version 1.5. No functional change.
- This change adds almost all code to support API 1.5 except real negotiation
and upgrade mailbox functions.
- From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.

Enable mailbox API 1.5 support. Tested on ESXi with ixgben 1.10.3.0.

Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_vf().
Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_pf().
 1.88.2.47  30-Jan-2022  martin Pull up the following, requested by msaitoh in ticket #1729:

sys/dev/pci/ixgbe/if_sriov.c 1.12-1.16
sys/dev/pci/ixgbe/ixgbe.c 1.295-1.297,1.300,1.304 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.84
sys/dev/pci/ixgbe/ixgbe_82598.c 1.17-1.18
sys/dev/pci/ixgbe/ixgbe_82598.h 1.9
sys/dev/pci/ixgbe/ixgbe_82599.c 1.24-1.28
sys/dev/pci/ixgbe/ixgbe_82599.h 1.8
sys/dev/pci/ixgbe/ixgbe_api.c 1.26-1.27
sys/dev/pci/ixgbe/ixgbe_api.h 1.16
sys/dev/pci/ixgbe/ixgbe_bypass.h 1.3
sys/dev/pci/ixgbe/ixgbe_common.c 1.34-1.42
sys/dev/pci/ixgbe/ixgbe_common.h 1.15-1.16
sys/dev/pci/ixgbe/ixgbe_dcb.c 1.12-1.13
sys/dev/pci/ixgbe/ixgbe_dcb.h 1.8-1.9
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.10-1.12
sys/dev/pci/ixgbe/ixgbe_dcb_82598.h 1.8
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c 1.10-1.11
sys/dev/pci/ixgbe/ixgbe_dcb_82599.h 1.8
sys/dev/pci/ixgbe/ixgbe_fdir.h 1.4
sys/dev/pci/ixgbe/ixgbe_features.h 1.4
sys/dev/pci/ixgbe/ixgbe_mbx.c 1.13-1.15
sys/dev/pci/ixgbe/ixgbe_mbx.h 1.15-1.18
sys/dev/pci/ixgbe/ixgbe_netmap.c 1.5
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.8
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.31
sys/dev/pci/ixgbe/ixgbe_phy.c 1.25-1.29
sys/dev/pci/ixgbe/ixgbe_phy.h 1.13
sys/dev/pci/ixgbe/ixgbe_rss.h 1.6
sys/dev/pci/ixgbe/ixgbe_sriov.h 1.5
sys/dev/pci/ixgbe/ixgbe_type.h 1.51-1.54
sys/dev/pci/ixgbe/ixgbe_vf.c 1.28-1.29
sys/dev/pci/ixgbe/ixgbe_vf.h 1.15
sys/dev/pci/ixgbe/ixgbe_x540.c 1.20-1.22
sys/dev/pci/ixgbe/ixgbe_x540.h 1.10
sys/dev/pci/ixgbe/ixgbe_x550.c 1.21-1.25
sys/dev/pci/ixgbe/ixgbe_x550.h 1.7
sys/dev/pci/ixgbe/ixv.c 1.170, 1.174-1.175 via patch

- Add typecast for type mismatch.
- Fix retry count calculation of I2C read/write.
- Wait longer for link after fiber MAC setup.
- ixv(4): Use adapter->mta for the multicast array memory instead of
the on-stack array.
- Match X550_PHY_ID correctly on X550.
- Print NVM image version on 82598.
- Use 64bit for lxon + lxoff.
- Don't expose garbage data of hw.ixvN.debug.
- Some NetBSD unrelated changes:
- Fix infinite recursion on PCIe link down if VMDQ is used.
- Move PF mailbox initialization from ixgbe_attach() to
ixgbe_init_iov().
- Add IPv6 mask for flow director.
- Change error level in ixgbe_fc_autoneg().
- Check host interface return status when writing NVM.
- Change DCB credit parameters.
- Restore some mailbox related functions. Revert part of ixgbe_mbx.c
rev. 1.7 and ixgbe_mbx.h rev. 1.11. No functional change.
- Rename IXGBE_VT_MSGTYPE_{ACK,NACK} to
IXGBE_VT_MSGTYPE_{SUCCESS,FAILURE}. No functional change.
- Remove unused argument. Change argument.
- Remove unnecessary return value check.
- Remove debug error message.
- Remove dead code.
- Add some unused macros.
- Fix typo in comment.
- Rename some functions.
- Sort lines, modify comment.
- Whitespace fix.
 1.88.2.46  29-Jan-2022  martin Pull up the following revisions, requested by msaitoh in ticket #1724:

sys/dev/pci/ixgbe/ixgbe.c 1.298, 1.303 via patch

Add some missing error counters to ierror.
 1.88.2.45  20-Nov-2021  martin Pull up the following, requested by msaitoh in ticket #1708:

sys/dev/pci/ixgbe/ixgbe.h 1.81-1.83
sys/dev/pci/ixgbe/ixgbe.c 1.291-1.292 via patch
sys/dev/pci/ixgbe/ixgbe_type.h 1.50
sys/dev/pci/ixgbe/ixv.c 1.167-1.168 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.94

- Fix a bug that a near 64KB TSO segment can't send.
- Reduce bus_dmamap_sync() cost.
- Use macro. Fix typos in comment.
 1.88.2.44  15-Sep-2021  martin Pull up the following (all via patch), requested by msaitoh in ticket #1696:

sysdev/pci/ixgbe/ixgbe.c 1.252, 1.280-1.283, 1.286-1.287, 1.289-1.290 via patch
sysdev/pci/ixgbe/ixgbe.h 1.73, 1.76-1.80 via patch
sysdev/pci/ixgbe/ix_txrx.c 1.68-1.93
sysdev/pci/ixgbe/ixv.c 1.153, 1.157-1.161, 1.163-1.166 via patch
sysdev/pci/ixgbe/if_bypass.c 1.7-1.9
sysdev/pci/ixgbe/if_fdir.c 1.4-1.5
sysdev/pci/ixgbe/if_sriov.c 1.10-1.11
sysdev/pci/ixgbe/ixgbe_82598.c 1.16
sysdev/pci/ixgbe/ixgbe_82599.c 1.23
sysdev/pci/ixgbe/ixgbe_api.c 1.25
sysdev/pci/ixgbe/ixgbe_bypass.h 1.2
sysdev/pci/ixgbe/ixgbe_common.c 1.30-1.33
sysdev/pci/ixgbe/ixgbe_dcb.c 1.10-1.11
sysdev/pci/ixgbe/ixgbe_dcb.h 1.7
sysdev/pci/ixgbe/ixgbe_dcb_82598.c 1.8-1.9
sysdev/pci/ixgbe/ixgbe_dcb_82598.h 1.7
sysdev/pci/ixgbe/ixgbe_dcb_82599.c 1.8-1.9
sysdev/pci/ixgbe/ixgbe_dcb_82599.h 1.7
sysdev/pci/ixgbe/ixgbe_fdir.h 1.3
sysdev/pci/ixgbe/ixgbe_features.h 1.3
sysdev/pci/ixgbe/ixgbe_mbx.c 1.12
sysdev/pci/ixgbe/ixgbe_netbsd.c 1.16-1.17
sysdev/pci/ixgbe/ixgbe_netbsd.h 1.13-1.14
sysdev/pci/ixgbe/ixgbe_netmap.c 1.3-1.4
sysdev/pci/ixgbe/ixgbe_netmap.h 1.2
sysdev/pci/ixgbe/ixgbe_osdep.c 1.7
sysdev/pci/ixgbe/ixgbe_osdep.h 1.29-1.30
sysdev/pci/ixgbe/ixgbe_phy.c 1.24
sysdev/pci/ixgbe/ixgbe_rss.h 1.5
sysdev/pci/ixgbe/ixgbe_sriov.h 1.4
sysdev/pci/ixgbe/ixgbe_type.h 1.49
sysdev/pci/ixgbe/ixgbe_vf.c 1.27
sysdev/pci/ixgbe/ixgbe_x540.c 1.18-1.19
sysdev/pci/ixgbe/ixgbe_x540.h 1.9
sysdev/pci/ixgbe/ixgbe_x550.c 1.19-1.20
sysdev/pci/ixgbe/ixgbe_x550.h 1.6
sysdev/pci/files.pci 1.438
share/man/man4/ixg.4 1.15
share/man/man4/ixv.4 1.8

- Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
Before this commit, resource shortage was easily occurred because
the total number of the clusters is small.
- Improve performance:
- Use m_adj(ETHER_ALIGN) more.
- Sprinkle __predict_false() in the RX path.
- Don't pre-allocate a cluster for RXCOPY case to improve short
packet's performance.
- Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
DMA buffer. Also, when the buffer is already freed, do not call
bus_dmamap_unload(9) (no resource leaks with this change). This
change is required to make ixg(4) work on alpha.
- Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
- Fix panic when bus_dmamap_load_mbuf() failed in
ixgbe_setup_receive_ring().
- Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability
on aarch64.
- Use uint64_t instead of bus_addr_t for the TX descriptor's buffer
address. At least, this change is required for macppc
(sizeof(bus_addr_t) == 4) to make TX work.
- Fix little-endian dependence.
- Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().
- Refresh unrefreshed descriptors' buffers correctly.
- Don't call bus_dmamap_sync with rx_mbuf_sz(== MCLBYTES) to prevent
panic.
- Save the discard_multidesc state to not to forget the state by
exiting rxeof().
- Add missing increment of no_mbuf error counter.
- Don't increment no_mbuf evcnt(9) when discarding multi-descriptor
packet.
- ixv: Modify error message to sync with ixgbe.c
- Print the error value of ixgbe_reset_hw() for debugging.
- Remove extra unlock/lock processing around if_percpuq_enqueue().
- Refactor rxr->next_to_check updating.
- Add new sysctl "rx_copy_len".
- Add a new sysctl to read rxr->next_to_refresh.
- Print error number when error occurred.
- Rename ix{gbe,v}_stop() with ix{gbe,v}_stop_locked(). No functional
change.
- Don't use fixed value.
- Comment out flow director processing in fast path.
- Add missing NetBSD RCS IDs and __KERNEL_RCSID()s.
- KNF.
- Fix typos.
 1.88.2.43  11-Mar-2021  martin Pull up the following (all via patch), requested by msaitoh in ticket #1663:

sys/dev/pci/ixgbe/ixgbe.c 1.259, 1.278-1.279
sys/dev/pci/ixgbe/ixgbe.h 1.75
sys/dev/pci/ixgbe/ixgbe_netbsd.h 1.12
sys/dev/pci/ixgbe/ixgbe_vf.c 1.24-1.26
sys/dev/pci/ixgbe/ixgbe_x550.c 1.17
sys/dev/pci/ixgbe/ixv.c 1.155-1.156
sys/dev/pci/ixgbe/ix_txrx.c 1.64-67
sys/dev/pci/files.pci 1.436
share/man/man4/ixg.4 1.13-1.14
share/man/man4/ixv.4 1.3, 1.6-1.7

- Fix a problem that the RX path stalled when the mbuf cluster is
exhausted.
- Modify some parameters to reduce packet dropping. See also the
manual's OPTIONS section for the detail.
- ixv(4): The max number of queue(pair) is not 7 but 8. Correctly
reset the hardware.
- Add "TX " to "Queue No Descriptor Available" evcnt(9) name to make
it more understandable.
- Fix a bug that some advertise speeds can't be set with
hw.ixgN.advertise_speed if both 2.5G and 5G are set. Fix the error
message, too.
- Fix typo in comment or debug message.
 1.88.2.42  02-Sep-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1601):

sys/dev/pci/ixgbe/ixgbe_82598.c: revision 1.13
sys/dev/pci/ixgbe/ixgbe.c: revision 1.219
sys/dev/pci/ixgbe/ixgbe_phy.c: revision 1.20
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.22
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.44

Add recovery code for unsupported SFP+.

Before this commit:
If an unsupported SFP module is inserted before booting, the driver attach
failed and there was no way to recover form it without rebooting or
detaching/reattaching driver (drvctl -d && drvctl -r pciN).

After this commit:
We can automatically recover any time by replacing it with a supported
module.
 1.88.2.41  02-Sep-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1600):

sys/dev/pci/ixgbe/if_bypass.c: revision 1.6
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.28
sys/dev/pci/ixgbe/ixgbe.c: revision 1.246

Fix checking return value of atomic_cas_uint().

This change fixes a bug that extra delay() is called only once even if
atomic_cas_uint() isn't failed or delay() isn't called when atomic_cas_uint()
failed.

The reason of this bug was that I simply converted FreeBSD' atomic_cmpset_int()
to atomic_cas_uint(). The return value's semantics is different.

-

Minor change.
- Print "X550EM X" instead of "X550EM" for Xeon D devices.
- Fix typo in comment. Same as FreeBSD.
 1.88.2.40  05-Aug-2020  martin Pull up the following revisions, requested by msaitoh in ticket #1587:

sys/dev/pci/ixgbe/ix_txrx.c 1.62-1.63 via patch
sys/dev/pci/ixgbe/ixgbe.c 1.225, 1.228-1.229,
1.232 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.64, 1.66
sys/dev/pci/ixgbe/ixv.c 1.146, 1.148-1.150
via patch
sys/dev/pci/ixgbe/ixgbe_common.c 1.27
sys/dev/pci/ixgbe/ixgbe_vf.c 1.23
sys/dev/pci/ixgbe/ixgbe_82598.c 1.15
sys/dev/pci/ixgbe/ixgbe_x550.c 1.18
sys/dev/pci/ixgbe/ixgbe_netbsd.c 1.14
sys/dev/pci/ixgbe/ixgbe_phy.c 1.21
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.26

- Fix IXGBE_LE32_TO_CPUS() macro for big endian machine. This problem
was only on X550.
- Add debug printf()s.
- Use unsigned to avoid undefined behavior in
ixgbe_fc_enable_generic().
- Modify a little to reduce diff between ixgbe.c and ixv.c.
No functional change.
- Modify comment.
- Remove unused macros.
- Whitespace fix.
- Fix typos.
 1.88.2.39  24-Jan-2020  martin Pull up the following, requested by msaitoh in ticket #1490:

sys/dev/pci/ixgbe/if_bypass.c 1.5
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.5
sys/dev/pci/ixgbe/ix_txrx.c 1.58-1.60
sys/dev/pci/ixgbe/ixgbe.c 1.195,1.220-1.221 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.60-1.2
sys/dev/pci/ixgbe/ixgbe_api.c 1.24
sys/dev/pci/ixgbe/ixgbe_common.c 1.26
sys/dev/pci/ixgbe/ixgbe_netbsd.c 1.11-1.12
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.24
sys/dev/pci/ixgbe/ixgbe_phy.c 1.19
sys/dev/pci/ixgbe/ixgbe_82598.c 1.14
sys/dev/pci/ixgbe/ixv.c 1.122,1.142,1.144 via patch

- Use unsigned to avoid undefined behavior in
ix{gbe,v}_[un]register_vlan().
- Free RX structure correctly when detaching.
- Remove unused code.
- Remove extra spaces.
- Fix some typos in comment.
- KNF.
 1.88.2.38  26-Dec-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1478):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.218

Add missing core lock in ixgbe_handle_mod().
 1.88.2.37  19-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1451):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.216
sys/dev/pci/ixgbe/ixv.c: revision 1.141

Print MAC address.

XXX Should we move such type of printf() to ether_ifattach?
 1.88.2.36  17-Oct-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1408):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.214

Apply FreeBSD r353599:
> 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
 1.88.2.35  26-Sep-2019  martin Pull up the following revisions, requested by msaitoh in ticket #1389:

sys/dev/pci/ixgbe/ixgbe_type.h 1.42-1.43
sys/dev/pci/ixgbe/ixgbe.c 1.209-1.213 via patch
sys/dev/pci/ixgbe/ixv.c 1.131-1.138 via patch
sys/dev/pci/ixgbe/ixgbe_vf.c 1.19-1.22
sys/dev/pci/ixgbe/ixgbe_vf.h 1.14
sys/dev/pci/ixgbe/ixgbe.h 1.57-1.58 via patch
share/man/man4/ixv.4 1.5 via patch

- Fix a bug that MBSDC (Bad SFD Count) isn't counted on X550EM_X and
X550EM_A. The register is for X550 and newer.
- ixv(4): Make SIOCADDMULTI returns ENOSPC and print error message
when the Ethernet multicast address list exceeds the limit(30) and
can't be ALLMULTI.
- ixv(4): SIOCZIFDATA clear the event counters as ixgbe.c.
- Reduce ixv(4)'s multicast table array size in ixv_set_multi from
MAX_NUM_MULTICAST_ADDRESSES(128) to IXGBE_MAX_VF_MC(30).
- ixv(4): Add support ALLMULTI and PROMISC.
- if_flags is neither int nor short. It's unsigned short.
- Fix a bug that the multicast filter isn't correctly initialized when
the total number of the Ethernet multicast addresses is just 128.
- Make ixv_set_multi() work correctly (especially for PROMISC) when the
function is called from if_init().
- Remove *_set_promisc() and use *_set_multi(). And then, rename
*_set_multi() to *_set_rxfilter().
- ixv(4): If a multicast entry has range, use ALLMULTI like others.
 1.88.2.34  06-Sep-2019  martin Apply patch, requested by msaitoh in ticket #1367:

fix mistake in previous.
 1.88.2.33  05-Sep-2019  martin Apply patch, requested by msaitoh in ticket #1367, to pull up the following
revisions:

sys/dev/pci/ixgbe/ixgbe_x550.c 1.16
sys/dev/pci/ixgbe/ixgbe.c 1.180,1.203-1.204,
1.207-1.208 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.55
sys/dev/pci/ixgbe/ixgbe_netbsd.c 1.10
sys/dev/pci/ixgbe/ixgbe_common.c 1.25
sys/dev/pci/ixgbe/ixv.c 1.129-1.130

- X550EM supports QSFP, so check ixgbe_media_type_fiber_qsfp too.
- An interrupt might not arrive when a module is inserted. When an link
status change interrupt occurred and the driver still regard SFP as
unplugged, issue the module softint before issuing LSC softint.
- Add 10000BASE-LX media if it's 1000BASE-BX.
- printf -> device_printf
- Avoid undefined behavior of VLAN filter setting.
- Simplify code.
- Fix typo in unused code.
- Fix typo in comment. Found by Wataru Ashihara.
 1.88.2.32  29-Aug-2019  martin Pull up following revision(s) (requested by knakahara in ticket #1347):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.205
sys/dev/pci/ixgbe/ixgbe.c: revision 1.206

fix typo in error handling of ixgbe_allocate_legacy().
ok by msaitoh@n.o
pullup-8, pullup-9

-

Fix panic when ncpu == 1 && sysctl -w hw.ixg0.txrx_workqueue=1. Reported by nonaka@n.o.

ok by msaitoh@n.o and nonaka@n.o
pullup-8, pullup-9
 1.88.2.31  01-Aug-2019  martin Pull up the following revisions, requested by msaitoh in ticket #1313:

sys/dev/pci/ixgbe/ixgbe_type.h 1.41
sys/dev/pci/ixgbe/ixgbe.c 1.194,1.197-1.199
via patch
sys/dev/pci/ixgbe/ixgbe_common.c 1.24
sys/dev/pci/ixgbe/ixv.c 1.121,1.124-1.125

- Avoid undefined behavior of interrupt vector setting.
- Avoid undefined behavior of TX/RX queue statistics calculation.
- Avoid undefined behavior of X550EM's PHY accesses.
- Avoid undefined behavior of Flow Control Transmit Timer setting.
- Don't call {ixgbe,ixv}_stop() twice while detaching.
 1.88.2.30  22-Jul-2019  martin Pull up the following revisions (via patch), requested by msaitoh in
ticket #1301:

sys/dev/pci/ixgbe/if_sriov.c 1.5-1.6
sys/dev/pci/ixgbe/ix_txrx.c 1.53-1.54
sys/dev/pci/ixgbe/ixgbe_x550.h 1.5
sys/dev/pci/ixgbe/ixgbe.c 1.169-1.170,1.176,1.179,1.181,1.185-1.186,1.188-1.192 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.53,1.55
sys/dev/pci/ixgbe/ixgbe_82599.c 1.21
sys/dev/pci/ixgbe/ixgbe_api.c 1.22-1.23
sys/dev/pci/ixgbe/ixgbe_api.h 1.14-1.15
sys/dev/pci/ixgbe/ixgbe_x550.c 1.14-1.15
sys/dev/pci/ixgbe/ixgbe_common.c 1.23
sys/dev/pci/ixgbe/ixgbe_common.h 1.14
sys/dev/pci/ixgbe/ixgbe_mbx.c 1.11
sys/dev/pci/ixgbe/ixgbe_mbx.h 1.14
sys/dev/pci/ixgbe/ixgbe_netmap.c 1.2
sys/dev/pci/ixgbe/ixgbe_features.h 1.2
sys/dev/pci/ixgbe/ixgbe_netbsd.c 1.9
sys/dev/pci/ixgbe/ixgbe_netbsd.h 1.9-1.10
sys/dev/pci/ixgbe/ixgbe_phy.c 1.18
sys/dev/pci/ixgbe/ixgbe_type.h 1.37,1.39-1.40
sys/dev/pci/ixgbe/ixgbe_vf.c 1.18
sys/dev/pci/ixgbe/ixv.c 1.112-1.114,1.117,1.119 via patch

Sync ixgbe up to 20190717 except ETHERCAP or ixv's VLAN stuff:
- Add firmware recovery mode for X550, X550A(Xeon D) and X550EM(C3000).
- Remove IXGBE_DEV_ID_82599_LS(0x154f) support again.
- On X550EMU, use ixgbe_identify_sfp_module_X550em() instead of
ixgbe_identify_module_generic(). ixgbe_identify_sfp_module_X550em()
has extra check (e.g. exclude 1G copper).
- It's not required to calculate unused queues' statistics.
- Remove ETHERCAP_VLAN_HWFILTER's definition.
- Match 82598_BX(0x1508), 82599_KR(0x1517), 82599_SFP_EM(0x1507),
X550EM_X_XFI(0x15b0), X550EM_A_QSFP(0x15ca) and
X550EM_A_QSFP_N(0x15cc)
- Add missing XFI support into ixgbe_get_link_capabilities_X550em().
- Other than IXGBE_VF_RESET should wait ACK, so use
ixgbevf_write_msg_read_ack() instead of write_posted() in
ixgbe_update_mc_addr_list_vf().
- When ixv_check_link() failed in the watchdog function, reset the
interface.
- Remove RXCSUM register modification in
ixv_initialize_receive_units(). It seems it's not required.
- Remove some debug printf in ixv_print_debug_info().
- Calculate vector's bit location correctly when the vector >= 31
in ixgbe_allocate_msix().
- Fix hung queue check when the queue number >= 31.
- On ENETRESET case, not continue and quit the ifflags_cb() function
because if_init() will do the same thing.
- Fix bugs in unused code.
- Fix typo in comment.
- Fix typo in unused code.
- Whitespace fixes. KNF.
 1.88.2.29  01-Apr-2019  martin Pull up the following, requested by msaitohin ticket #1225:

sys/dev/pci/ixgbe/ixgbe.c 1.175-1.178
sys/dev/pci/ixgbe/ixv.c 1.110-1.111 via patch

- NetBSD currently uses traffic class 0 only. Other traffic classes
aren't used yet. When IXGBE_TC_COUNTER_NUM is set to lower than
IXGBE_DCB_MAX_TRAFFIC_CLASS (e.g. 1), other traffic classes' counters
are not used. It means we don't generate evcnt for them and don't
add the values in ixgbe_update_stats_counters().
- It's not required to calculate unused queues' statistics.
- Fix a bug that the VLAN HW tagging function is not correctly disabled
when all vlan is detached.
- Fix a bug that VLAN HW tagging function is not correctly controlled
on 82598.
- Control VLAN HW filter function correctly. Note that currently
VLAN HW filter function doesn't work because NetBSD doesn't support
it yet.
- Don't clear IXGBE_VLNCTRL_CFIEN bit When ETHERCAP_VLAN_HWFILTER is
set. I think it's not required (and Linux doesn't do it). This change
has no effect to NetBSD because ETHERCAP_VLAN_HWFILTER is not
supported yet.
 1.88.2.28  01-Mar-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1199):

sys/dev/pci/ixgbe/ixv.c: revision 1.109
sys/dev/pci/ixgbe/ixgbe.h: revision 1.54
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.52
sys/dev/pci/ixgbe/ixgbe.c: revision 1.174

Fix a bug that if_link_state_change(ifp, LINK_STATE_DOWN) isn't called unless
link goes up at least one time. Without this change, never linkup-ed media
keeps LINK_STATE_UNKNOWN instead of LINK_STATE_DOWN.
 1.88.2.27  28-Jan-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1171):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.168
sys/dev/pci/ixgbe/ixgbe.h: revision 1.52
sys/dev/pci/ixgbe/ixgbe.c: revision 1.172
sys/dev/pci/ixgbe/ixgbe.c: revision 1.173

Some counters are not per queue but per traffic class. Make new evcnt group
"ixgM tcN" (N = 0..7) and move those counters into it. We are using only
traffic class 0, so we will see only tc0's counter are updated.

-

Call ixgbe_init_swfw_semaphore(hw) before calling ixgbe_check_wol_support()
because ixgbe_check_wol_support()->ixgbe_check_wol_support()->
ixgbe_get_device_caps() accesses semaphore.

-

- Move the location of calling setup_eee() in ixgbe_attach(). The previous
location was too early. The new location is before calling
ixgbe_set_phy_power().
- Restore call of setup_eee() in ixgbe_init_locked(). It was removed in
rev. 1.99 (FreeBSD r320688).
- When calling setup_eee(), pass enable/disable correctly.
 1.88.2.26  27-Jan-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1172):

sys/dev/pci/nvme_pci.c: revision 1.26
sys/dev/pci/xhci_pci.c: revision 1.21
sys/dev/pci/ixgbe/ixv.c: revision 1.108
sys/dev/pci/ixgbe/ixgbe.c: revision 1.171
sys/dev/pci/if_fxp_pci.c: revision 1.84
sys/dev/pci/if_fxp_pci.c: revision 1.85
sys/dev/pci/xhci_pci.c: revision 1.16

remove #ifdef DEBUG printf, it seems to have outlived it's usefulness

-

KNF. No functional change.

-

Nowadays some UEFI BIOSes don't enable some PCI devices' address decoding.
To resolve this problem, pci_map.c rev. 1.34-1.36 changed the
pci_mapreg_(sub)map()'s to set the decode bit if it's not set. It's good for
almost all drivers, but some other drivers don't use pci_mapreg_map().
In drivers which don't use pci_mapreg_map(), some of them explicitly enable
decoding but others don't. Add code to enable decoding to them.

See also the following discussion:
http://mail-index.netbsd.org/tech-kern/2017/03/22/msg021678.html
 1.88.2.25  08-Nov-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #1084):

sys/dev/pci/ixgbe/ixv.c: revision 1.107
sys/dev/pci/ixgbe/ixgbe.c: revision 1.167

Don't set LRO capability flag because we don't support it yet.

This doesn't change any behavior other than if_capabilities' visibility
(e.g. ifconfig).
 1.88.2.24  23-Sep-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #1029):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.166

- Fix a bug that Denverton accessed wrong register in
ixgbe_setup_low_power_mode(). The location of some registers in Denverton
were changed. The GRC register is one of them, so use IXGBE_GRC_BY_MAC(hw)
instead of IXGBE_GRC.

- ixgbe_check_wol_support() tests the capability of WOL, but the sysctl
knobs for WOL were added only for IXGBE_DEV_ID_X550EM_X_10G_T. Add the
knobs when adapter->wol_support is not 0.

XXX pullup-8
 1.88.2.23  05-Sep-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #1006):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.164

Fix a bug that media change may fail. I noticed that ifconfig ixgN media XXX
took a 10 or more seconds on a Denverton machie. I occurred by trying take a
lock and timed out. The reason was that ixgbe_media_change() didn't take
CORE_LOCK. Do it.

This problem was from FreeBSD's pre-iflib ixgbe (I don't know whether this
problem really occurs on FreeBSD or not). Post-iflib ixgbe has no problem
because iflib_media_change() takes a lock.
XXX pullup-8
 1.88.2.22  07-Aug-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #961):

sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.13
sys/dev/pci/ixgbe/ixgbe.h: revision 1.51
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.36
sys/dev/pci/ixgbe/ixgbe_osdep.h: revision 1.23
sys/dev/pci/ixgbe/ixgbe_netbsd.c: revision 1.8
sys/dev/pci/ixgbe/ixgbe.c: revision 1.163
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.49

Add force_10_100_autonego sysctl. The default value is 0(false).

This sysctl is only for 550EM_a with PHY firmware for a while.

Make jcl allocation per queue to reduce mutex spin. Tested by me and
knakahara.
 1.88.2.21  26-Jul-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #935):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.162
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.20
sys/dev/pci/ixgbe/ixgbe_api.c: revision 1.21
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.35
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.16
Apply changes of FreeBSD ix-3.2.18.tgz:
- Add IXGBE_DEV_ID_82599_LS(0x154f) support.
- Increase timeout for newer than ixgbe_mac_X550 (i.e. Xeon-D and Denverton)
in ixgbe_acquire_swfw_sync_X540().
- Add some unused macros (IXGBE_FW_LESM_*).
--
Remove nmbclusters check. We don't use the mbuf cluster. The old code also had
a bug that ixgbe_total_ports adds two every port and never decrement in
the detach path. Found by hikaru@.
The code was removed in FreeBSD when it switched to use iflib and OpenBSD
removed the code 8 years ago.
 1.88.2.20  09-Jun-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #864):

sys/dev/pci/ixgbe/ix_txrx.c 1.40-1.47 (patch)
sys/dev/pci/ixgbe/ixgbe.c 1.148,1.149,1.151,
1.152,1.154,
1.155,1.157-1.160 (patch)
sys/dev/pci/ixgbe/ixgbe.h 1.43,1.44,1.46,1.49 (patch)
sys/dev/pci/ixgbe/ixgbe_netbsd.c 1.7 (patch)
sys/dev/pci/ixgbe/ixgbe_netbsd.h 1.8 (patch)
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.22 (patch)
sys/dev/pci/ixgbe/ixv.c 1.100-1.104 (patch)
sys/dev/pci/ixgbe/ixv.c 1.94,1.95,1.99 (patch)

Remove unused structure entries. No functional change.
-
Remove unused IXGBE_FC_HI and IXGBE_FC_LO. The watermark of the flow control
is automatically calculated from the size of the packet buffer.
-
Use ixgbe_eitr_write() when writing the EITR for the link interrupt like
queue's EITR to write the register safely. This change is not relatively
so important than queue's EITR because link's EITR is written in if_init().
-
Don't free and reallocate bus_dmamem when it's not required. Currently,
the watchdog timer is completely broken and never fire (it's from FreeBSD
(pre iflib)). If the problem is fixed and watchdog fired, ixgbe_init() always
calls ixgbe_jcl_reinit() and it causes panic. The reason is that
ixgbe_local_timer1(it includes watchdog function) is softint and
xgbe_jcl_reinit() calls bus_dmamem*() functions. bus_dmamem*() can't be called
from interrupt context.

One of the way to prevent panic is use worqueue for the timer, but it's
not a small change. (I'll do it in future).

Another way is not reallocate dmamem if it's not required. If both the MTU
(rx_mbuf_sz in reality) and the number of RX descriptors are not changed, it's
not required to call bus_dmamem_{unmap,free}(). Even if we use workque, this
change save time of ixgbe_init().

I have a code to fix broken watchdog timer but it sometime causes watchdog
timeout, so I don't commit it yet.
-
Count some register correctly:
- QPRDC register is only for 82599 and newer.
- Count IXGBE_QPRDC, PX{ON,OFF}{T,R}XC[NT].
The TQSMR register is not for receiving but for transmitting, so move the
initialization from ixgbe_initialize_receive_units() to
ixgbe_initialize_transmit_units(). No functional change.
-
Whitespace fix. No functional change.
-
Add rxd_nxck (Receive Descriptor next to check) read only sysctl.
Don't check IFF_RUNNING in ixgbe_rxeof(). Doing break and leaving a deacriptor
with DD bit is worse than just processing the entry. And it's also racy to
check IFF_RUNNING in rxeof(). If you'd like to strictly obey IFF_RUNNING,
it would be better to do it in the upper layer.
Same as DragonFly (a part of 79251f5ebe4cf9dd2f3e6aed590e09d756d39922).
Add "bool txr_no_space" for TX descriptor shortage. Use it like IFF_OACTIVE.
Clear que->disabled_count in {ixgbe,ixv}_init_locked(). Without this,
interrupt mask state and EIMS may mismatch and if_init doesn't recover
from TX/RX stall problem.
This change itself doesn't fix PR#53294.
-
Add hw.ixgN.debug sysctl. "sysctl -w hw.ixgN.debug=1" dumps some registers
to console.
-
Constify several variables in ixgbe/ so that they land in .rodata (1038
bytes).
-
Don't call ixgbe_rearm_queues() in ixgbe_local_timer1().
ixgbe_enable_queue() and ixgbe_disable_queue() try to enable/disable queue
interrupt safely. It has the internal counter. When a queue's MSI-X is
received, ixgbe_msix_que() is called (IPL_NET). This function disable the
queue's interrupt by ixgbe_disable_queue() and issues an softint.
ixgbe_handle() queue is called by the softint (IPL_SOFTNET), process TX, RX
and call ixgbe_enable_queue() at the end.

ixgbe_local_timer1() is a callout and run always on CPU 0 (IPL_SOFTCLOCK).
When ixgbe_rearm_queues() called, an MSI-X interrupt is issued for a specific
queue. It may not CPU 0. If this interrupt's ixgbe_msix_que() is called and
sofint_schedule() is called before the last sofint's softint_execute() is not
called, the softint_schedule() fails because of SOFTINT_PENDING. It result
in breaking ixgbe_{enable,disable}_queue()'s internal counter.
ixgbe_local_timer1() is written not to call ixgbe_rearm_queues() if
the interrupt is disabled, but it's called because of unknown bug or a race.

One solution to avoid this problem is to not to use the internal counter,
but it's little difficult. Another solution is stop using
ixgbe_rearm_queues() at all. Essentially, ixgbe_rearm_queues() is not
required (it was added in ixgbe.c rev. 1.43 (2016/12/01)).
ixgbe_rearm_queues() helps for lost interrupt problem but I've never seen it
other than ixgbe_rearm_queues() problem.

XXX pullup-8.
 1.88.2.19  07-Jun-2018  martin Pull up following revision(s) (requested by ozaki-r in ticket #843):

sys/dev/pci/ixgbe/ixv.c: revision 1.101
sys/net/if_bridge.c: revision 1.156
sys/net/if_pppoe.c: revision 1.138
sys/dev/pci/if_wm.c: revision 1.580
sys/dev/pci/ixgbe/ixgbe.c: revision 1.156
sys/net/if_gif.c: revision 1.142

Ensure to call if_register after interface initializations finish
 1.88.2.18  17-Apr-2018  martin Pull up following revision(s) (requested by knakahara in ticket #769):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.147
sys/dev/pci/ixgbe/ixgbe.h: revision 1.42

Fix panic when "sysctl -w hw.ixg0.txrx_workqueue=[01]" while there is traffic.
The operation is not supported, however causing panic is problem.
 1.88.2.17  14-Apr-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #750):

sys/dev/pci/ixgbe/ixgbe_x540.h: revision 1.8
sys/dev/pci/ixgbe/ixgbe_82598.c: revision 1.11
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c: revision 1.6
sys/dev/pci/ixgbe/ixgbe_82598.c: revision 1.12
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c: revision 1.7
sys/dev/pci/ixgbe/ixgbe_dcb_82598.h: revision 1.6
sys/dev/pci/ixgbe/ixgbe_fdir.h: revision 1.2
sys/dev/pci/ixgbe/ixgbe_dcb_82599.h: revision 1.6
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c: revision 1.6
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.18
sys/dev/pci/ixgbe/if_sriov.c: revision 1.3
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c: revision 1.7
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.13
sys/dev/pci/ixgbe/ixgbe_dcb.c: revision 1.7
sys/dev/pci/ixgbe/ixgbe_api.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_dcb.c: revision 1.8
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_dcb.h: revision 1.6
sys/dev/pci/ixgbe/if_bypass.c: revision 1.4
sys/dev/pci/ixgbe/ixv.c: revision 1.91
sys/dev/pci/ixgbe/ixgbe_rss.h: revision 1.4
sys/dev/pci/ixgbe/ixv.c: revision 1.92
sys/dev/pci/ixgbe/ixv.c: revision 1.93
sys/dev/pci/ixgbe/ixgbe_osdep.c: revision 1.4
sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.12
sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.13
sys/dev/pci/ixgbe/ixgbe_api.h: revision 1.13
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.12
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.33
sys/dev/pci/ixgbe/if_fdir.c: revision 1.2
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.34
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.39
sys/dev/pci/ixgbe/ixgbe_vf.h: revision 1.13
sys/dev/pci/ixgbe/ixgbe_api.c: revision 1.20
sys/dev/pci/ixgbe/ixgbe_sriov.h: revision 1.3
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.21
sys/dev/pci/ixgbe/ixgbe_osdep.h: revision 1.21
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.22
sys/dev/pci/ixgbe/ixgbe_82599.h: revision 1.7
sys/dev/pci/ixgbe/ixgbe.c: revision 1.144
sys/dev/pci/ixgbe/ixgbe.c: revision 1.145
sys/dev/pci/ixgbe/ixgbe_phy.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe.c: revision 1.146
sys/dev/pci/ixgbe/ixgbe_phy.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_82598.h: revision 1.8
sys/dev/pci/ixgbe/ixgbe.h: revision 1.41
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.10
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.14
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.15
sys/dev/pci/ixgbe/ixgbe_phy.h: revision 1.11

Sync with the remaining part of FreeBSD r328265 except sfp_reinit stuff:
- Always schedule module intterrupt in ixgbe_config_link() when a device is
SFP+ based.
- Use not loop index but txr->me in ixv_initialize_{transmit,receive}_units().
It's required for VMDQ but NetBSD doesn't use it, so it's not a bug in
NetBSD.
- Simplify ixgbe_bp_wd_set(). No functional change.
- Whitespace.

Sync with FreeBSD r331224 except ixv_if_update_admin_status()'s change:
- Fix length of reading buffer when the command is Read Flash in
ixgbe_host_interface_command().
- Add missing start_hw() call in ixv_init_locked(). This is not a real bug
because start_hw just set hw->adapter_stopped to false and anyone refer it.
- Style change.
- Update comment.

Read sc_if_flags after taking core lock. Same as if_wm.c rev. 1.418.
 1.88.2.16  04-Apr-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #690):
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe.c: revision 1.138
sys/dev/pci/ixgbe/ixv.c: revision 1.90
sys/dev/pci/ixgbe/ixgbe.c: revision 1.139
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.11
sys/dev/pci/ixgbe/ixgbe.h: revision 1.38
sys/dev/pci/ixgbe/ixgbe_api.h: revision 1.12
sys/dev/pci/ixgbe/ixgbe.h: revision 1.39
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.10
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.11
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.37
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.38
sys/dev/pci/ixgbe/ixgbe.c: revision 1.140
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.20
sys/dev/pci/ixgbe/ixgbe.c: revision 1.141
sys/dev/pci/ixgbe/ixgbe.c: revision 1.142
sys/dev/pci/ixgbe/ixgbe.c: revision 1.143
sys/dev/pci/ixgbe/ixgbe.h: revision 1.40
sys/dev/pci/ixgbe/ixgbe_x550.h: revision 1.4

Fix the problem between eitr and link_speed.

In ixgbe_msix_que(), que->eitr_setting is limited to IXGBE_MIN_RSC_EITR_10G1G
when link_speed is 1Gbps or 10Gbps. However, que->eitr_setting is set to EITR
register in the *next* Tx/Rx interrupt. If link_speed changes from 100Mbps to
1Gbps ro 10Gbps, que->eitr_setting which is not limited can be set to EITR
register, that is, the problem fixed by ixgbe.c:r1.124 can occur in this case.

To fix this case, que->eitr_setting should be clear when link_speed is changed
or link state is changed.

Furthermore, expand the variants used for AIM (txr->bytes, txr->packets,
rxr->bytes and rxr->packets) from u32 to u64 to avoid wraparound which causes
que->eitr_setting calculation mistake.
XXX pullup-8

Don't write EIMC directly. It is required to manage with struct ix_queue status.
XXX pullup-8

- Add missing IFM_NONE support. If a interface support linkdown,
"ifconfig ixgN media none" drpos link. Not all interface can do link down.
Tested:
82598 AT2 (T)
92599 SF+(SFI) (X520-DA2)
X540
X550-T1
X550EM_x (X10SDV-8C-TLN4F)
X550EM_a (A2SDi-H-TP4F port 0, 1 (T))
Doesn't work:
X550EM_a (A2SDi-H-TP4F port 2, 3 (SFP+ (KR)))
X550EM_a (MA10-ST0 port 2, 3 (SFP+ (SFI)))
(Denverton SFP+ can't force link down because SFP+'s TX_DISABLE pin is
pull down. Is there a way to shutdown SFP+ cage's power?)
Not tested:
82598 fiber.
- Change some functions static.

Avoid issues caused by sending old packets at next link-up time.

This modification consists by the following two parts.
- drain packets in if_snd queue or corresponding txr->txr_interq
when link_active == false in ifp->if_start(), ifp->if_transmit(),
and deferred Tx processing
- drain packets in if_snd queue and all of txr->txr_interq's
at link-down time
ok by msaitoh@n.o.

Fix long standing bug that 82598 SFP+ panics in ixgbe_handle_mod() because
hw->mac.ops.setup_sfp is NULL. This change is a part of FreeBSD r327031.

Fix a bug that "ifconfig ixgN down up" forgot IFM_NONE setting.
- Don't assume autoneg == 0 is the first call of ixgbe_config_link().
Check ifm_media, too.
- Don't override autoneg_advertised in ixgbe_get_phy_id_fw() to not to
be inconsistent with if_media value.
 1.88.2.15  30-Mar-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #673):

sys/dev/pci/ixgbe/if_sriov.c: revision 1.2
sys/dev/pci/ixgbe/ixgbe.c: revision 1.135
sys/dev/pci/ixgbe/ixgbe.c: revision 1.136
sys/dev/pci/ixgbe/ixgbe.c: revision 1.137
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.17
sys/dev/pci/ixgbe/if_bypass.c: revision 1.3
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.18
sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.10
sys/dev/pci/ixgbe/ixgbe.h: revision 1.36
sys/dev/pci/ixgbe/ixgbe_osdep.c: revision 1.3
sys/dev/pci/ixgbe/ixgbe.h: revision 1.37
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.36
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.32
sys/dev/pci/ixgbe/ixgbe_vf.h: revision 1.12
sys/dev/pci/ixgbe/ixgbe_sriov.h: revision 1.2
sys/dev/pci/ixgbe/ixgbe_osdep.h: revision 1.20
sys/dev/pci/ixgbe/ixv.c: revision 1.88
sys/dev/pci/ixgbe/ixgbe_phy.c: revision 1.15
sys/dev/pci/ixgbe/ixv.c: revision 1.89
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.13
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.8
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.9

Add some changes from ix-3.2.17.tar.gz and r328265. Not fully synchronized.

Some others (e.g. sfp cage interrupt and bypass adapter stuff) will be merged
later:

- Initialize firmware command buffer correctly in ixgbe_read_ee_hostif_X550()
and ixgbe_read_ee_hostif_buffer_X550(). These functions are used when reading
NVM.
- Fix a bug that ixgbe_mng_present() misunderstand management capability on
X550 and newer on some environment. X550 changed FWSM bit definition.
See X540 document and X550's document and compare them.
- Fix checksum calculation in ixgbe_set_fw_drv_ver_generic(). This function is
not used in NetBSD.
- Add some unused funtions.
- Whitespace fix.
- Check offset correctly in ixgbe_get_oem_prod_version(). Note that this
function is not used.
- Set PHY correctly in ixgbe_setup_mac_link_sfp_x550a() if a device is a
C3000 KR SFP+.

Fix race about writing adapter->link_active for ixg(4).
adapter->link_active is updated by ixgbe_update_link_status() only.

The function is called from the following four functions.
- ixgbe_media_status()
- ixgbe_local_timer1()
- ixgbe_stop()
- ixgbe_handle_link()

The functions other than ixgbe_handle_link() call ixgbe_update_link_status()
with holding IXGBE_CORE_LOCK, however ixgbe_handle_link() calls it without
holding IXGBE_CORE_LOCK. That can cause race. So, add IXGBE_CORE_LOCK to
ixgbe_handle_link().

Tested by msaitoh@n.o and me.

Fix race about writing adapter->link_active for ixv(4).
adapter->link_active is updated by ixv_update_link_status() only.

The function is called from the following two functions.
- ixv_media_status()
- ixv_handle_link()

ixv_media_status() calls ixv_update_link_status() with holding
IXGBE_CORE_LOCK, however ixv_handle_link() calls it without
holding IXGBE_CORE_LOCK, the same as ixg(4).

ok by msaitoh@n.o.

- Add link related softint's counter.
- Fix indent.
 1.88.2.14  13-Mar-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #626):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.134
sys/dev/pci/ixgbe/ixgbe.h: revision 1.35
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.35
sys/dev/pci/ixgbe/ixv.c: revision 1.87
Make some event counters MP safe. Now all of the event counters are
MP safe.
 1.88.2.13  08-Mar-2018  martin Pull up following revision(s) (requested by knakahara in ticket #612):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.129-1.133
sys/dev/pci/ixgbe/ixgbe.h: revision 1.34
sys/dev/pci/ixgbe/ixv.c: revision 1.85,1.86

- Make "Handled queue in softint" and "Requeued in softint" evcnt(9) per queue
and count them correctly.
- Remove #if 0'ed code.

Don't increment que->req.ev_count in MSI-X interrupt because it's not
reschedule.

Fix another poll mode assumption breaking. Implemented by msaitoh@n.o, I just commit by proxy.
ixgbe_rearm_queues() writes EICS register(s). 82599, X540 and X550
specifications say "Following a write of 1b to any bit in the EICS register
(interrupt cause set), its corresponding bit in the EIMS register is auto
set as well enabling its interrupt." in "Extended Interrupt Auto Mask Enable
(EIAM) Register" section. That is, ixgbe_rearm_queues() causes interrupts
regardless of the status managed by ixgbe_enable_queue()/ixgbe_disable_queue().

That can break poll mode assumption.

In fact, the problem occurs in the following situation
- CPU#A has high load traffic, in contrast, CPU#B has not so high load traffic
- CPU#A is occurred interrupt by its NIC queue
- CPU#A calls ixgbe_disable_queue() in interrupt handler(ixgbe_msix_que())
- CPU#A kick softint handler(ixgbe_handle_que())
- CPU#A begins softint
- CPU#A's NIC queue is set que->txr->busy flag
- With some reason, CPU#A can do ixg interrupt handler
E.g. when one of CPU#A's softnet handlers sleeps, ipl is lowered
- CPU#B starts callout
- CPU#B calls ixgbe_local_timer1()
- CPU#B writes EICS bit corresponding CPU#A's NIC queue bit
- CPU#A's NIC queue causes interrupt whie CPU#A is running in poll mode
- CPU#A calls ixgbe_disable_queue() in interrupt handler *again*
- CPU#A has done polling, and then CPU#A calls ixgbe_enable_queue() *once*
- CPU#A's NIC queue interrupt is disabled until ixg is detached as
ixgbe_disable_queue() is called twice though ixgbe_disable_queue() is
called once only
NOTE:
82598 does not say so, but it is treated in the same way because of no harm.
By the way, we will refactor ixgbe_local_timer(watchdog processing) later.

Fix INTx/MSI handler did not schedule workqueue. Pointed out by msaitoh@n.o.

Reduce duplicated code which schedule deferred packet processing. No functional change.
 1.88.2.12  06-Mar-2018  martin Pull up following revision(s) (requested by knakahara in ticket #605):
sys/dev/pci/ixgbe/ixgbe.h: revision 1.32
sys/dev/pci/ixgbe/ixgbe.h: revision 1.33
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.34
sys/dev/pci/ixgbe/ixgbe.c: revision 1.128
sys/dev/pci/ixgbe/ixv.c: revision 1.83
sys/dev/pci/ixgbe/ixv.c: revision 1.84

Add hw.ixvM.q[01].{interrupt_rate,[tr]xd_head,[tr]xd_tail} sysctls as ixg(4).

ixg(4) supports workqueue poll mode, but not enabled by default yet. (that is, the default behavior is *not* changed)

At the time of high load near the wire rate, the turnaround time
of update/delete processing such as "ifconfig ixg0 inet XXX" or
"ifconfig ixg0 delete" is very long. The main reason is CPU
starvation caused by ixg(4)'s softint poll mode. ixg(4) uses
workqueue poll mode instead of softint poll mode, so that this
problem will be fix.

This change may cause performance issues, so it is not enabled
by default yet. Although there are that issues, if you want to use
workqueue poll mode, do "sysctl -w hw.ixgXX.txrx_workqueue=1" while
there is no traffic on the ixgXX.

ok by msaitoh@n.o.

ixv(4) also supports workqueue poll mode, but not enabled by default yet, either.
ok by msaitoh@n.o.

Move the location of "struct work" as FreeBSD's "struct task" in ixgbe.h.
No functional change.
 1.88.2.11  01-Mar-2018  martin Pull up following revision(s) (requested by knakahara in ticket #597):
sys/dev/pci/ixgbe/ixgbe.h: revision 1.31
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.33
sys/dev/pci/ixgbe/ixgbe.c: revision 1.127
sys/dev/pci/ixgbe/ixv.c: revision 1.82
Fix poll mode assumption breaking.
ixgbe_{enable,disable}_intr() forcibly enable/disable all interrupts
regardless of current state. That can break poll mode assumption,
that is, queue interrupts must not occur while polling Tx/Rx rings.
E.g. "ifconfig ixg0 delete && ifconfig ixg0 192.168.0.1" on heavy
load traffic can causes this issue.
This fix may have 1% or 2% performance impact at short packets.
XXX
ixgbe_rearm_queues() which is called only via watchdog can also break
this poll mode assumption because writing EICS casues interrupts
immediately when interrupt auto mask enabled.
We will fix it with other issues about watchdog later.
ok by msaitoh@n.o.
Apply ixgbe.c:r1.127 to ixv.c. Pointed out by msaitoh@n.o.
 1.88.2.10  26-Feb-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #592):
sys/dev/pci/ixgbe/ixv.c: revision 1.79
sys/dev/pci/ixgbe/ixgbe.h: revision 1.30
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.31
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.32
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.31
sys/dev/pci/ixgbe/ixgbe.c: revision 1.120
sys/dev/pci/ixgbe/ixgbe.c: revision 1.121
sys/dev/pci/ixgbe/ixgbe.c: revision 1.123
sys/dev/pci/ixgbe/ixgbe.c: revision 1.124
sys/dev/pci/ixgbe/ixgbe.c: revision 1.125
sys/dev/pci/ixgbe/ixgbe.c: revision 1.126
sys/dev/pci/ixgbe/ixv.c: revision 1.80
sys/dev/pci/ixgbe/ixv.c: revision 1.81
CID-1427719: Integer handling issues (BAD_SHIFT). Print bus/slot info
correctly on 82599_SFP_SF_QP(DID 0x154a) and 82599_QSFP_SF_QP(DID 0x1558).
Fix a bug that RX may stall on heavy load on ixg(4). ixgbe_rxeof() has loop
limit and the function returns true if a packet are still in the RX ring.
ixgbe_handle_que() didn't check the return value. Check the return vaule
and issue a softint.
This bug is derived from FreeBSD and ixv(4) has no this bug.
XXX pullup-8
Fix a bug that the first call of ifflags_cb() causes linkdown. The first
call of ix(gbe|v)_ifflags_cb() refered uninitialized adapter->if_flags.
adapter->if_flags should be initialized in the end of xxx_init().
XXX pullup-[678] (ixgbe)
XXX pullup-8 (ixv)
- Fix a bug that RX may stall on heavy load on ixg(4) derived from FreeBSD's
AIM (Auto Interrupt Moderation) bug.
When I use a machine as a NFS client, sometimes one of queue pairs doesn't
get any interrupt other than every second tick via ixgbe_local_timer1().
When the problem occured, the queue pair's hw.ixgM.qN.interrupt_rate is
always 500000. When this problem occuring, set hw.ixgM.qN.interrupt_rate lower
than 166667 recover from stall. i.e.:
sysctl -w hw.ixgM.qN.interrupt_rate=166667 (don't revocer)
sysctl -w hw.ixgM.qN.interrupt_rate=166666 (recover)
Relatios between the interrupt_rate and EICR's ITR_INTERVAL field is as
follows:
int_rate | EICR[11:0] | interval in us | recover |
|(ITR_INTERVAL)| (10G and 1G) | |
---------+--------------+----------------+---------+
500000 | 0x008(0) | 2 | not |
166667 | 0x010(1) | 4 | not |
166666 | 0x018(2) | 6 | recover |
The reason why int_rate becomes 500000 is that xgbe_tx_eof() doesn't
increment rxr->packets(*1). Even if we fix rxr->packets' bug, interrupt_rate
might become greater than 166666 and it might cause stall.
While reading datasheets, knakahara noticed a section titled with "ITR
Affect on RSC Functionality". It says "When RSC is enabled on specific RX
queues, the associated ITR interval with these queus must be enabled and must
be larger (in time uints) than RSC delay". Currently, RSC_DELAY field in the
GPIE register is 0 and it means 4us for 10G and 1G. The greater ITR_INTERVAL
value of 4us is 6us == 166666. Yes, BINGO!
This description is noted in 82599 and newer datasheets and not in 82598
datasheet. I don't know if 82598 has this limitation but, I apply this
limitation all of chips.
(*1) Note that this bug is going to be fixed in the next commit to distinct
between two different bugs.
- The bitfield of EITR register is different between 82598 and others.
Only ixgbe_msix_que() taken care of it. Make new function ixgbe_eitr_write()
and use it in all of functions which modify ITR_INTERVAL.
XXX pullup-8
Increment rxr->packets correctly in ixgbe_rxeof() to calculate ITR value
of AIM (Auto Interrupt Moderation) correctly. See also ixgbe.c rev. 1.124.
XXX pullup-8
Improve a comment about reading EICS register defined write-only by spec.
It seems that is workaround for silicon errata.
ok by msaitoh@n.o.
- Apply ixgbe.c rev. 1.124 to ixv.c. Fix a bug that RX may stall on heavy load
on ixv(4) derived from FreeBSD's AIM (Auto Interrupt Moderation) bug.
ITR_INTERVAL value must be larger than 4us.
- The bitfield of EITR register is different between 82598 and others.
ixv.c had a bug that it accessed 82598's way even though only 82599 and
newer support virtual function. Fix it using with new ixv_eitr_write()
function.
Fix a potential bug that TX/RX might stall when TX rate limit reached.
This change is almost the same as the RX rate limit bug fix in ixgbe.c
rev. 1.121. I've never got any stall, but this must be a bug.
 1.88.2.9  26-Feb-2018  snj Pull up following revision(s) (requested by knakahara in ticket #567):
distrib/sets/lists/comp/mi: 1.2182-1.2183
sys/dev/pci/if_wm.c: 1.564
sys/dev/pci/ixgbe/ixgbe.c: 1.122
sys/dev/pci/ixgbe/ixgbe_rss.h: 1.3
sys/dev/pci/ixgbe/ixv.c: 1.78
sys/net/Makefile: 1.35-1.36
sys/net/files.net: 1.15
sys/net/rss_config.c: 1.1
sys/net/rss_config.h: 1.1
Introduce very simple Receive Side Scaling (RSS) utility.
ok by msaitoh@n.o.
--
Apply RSS utility to wm(4).
ok by msaitoh@n.o.
--
Apply RSS utility to ixg(4) and ixv(4).
ok by msaitoh@n.o.
--
Fix build failure, sorry.
--
Currently, it is not necessary to install rss_config.h. Pointed out by msaitoh@n.o.
 1.88.2.8  13-Jan-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #490):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.116-1.119
sys/dev/pci/ixgbe/ixv.c: revision 1.76-1.77
Don't panic when resource shortage occured. Fixes PR#52820 reported by
kardel@:
- Don't use if_free() because ixgbe(4) don't use if_alloc().
- Move location of {ixgbe,ixv}_setup_interface() call at a position that
any error don't occur. One of the reason is that it should be. Another
reason is that it's hard to call ether_ifdetach() and if_detach() when
cold == 1 (because of pserialize_perform, xc_wait, timing of domaininit
and maybe more).
--
Don't panic when resource shortage occured. Like ixgbe.c rev. 1.116.
- Move location of {ixgbe,ixv}_setup_interface() call at a position that
any error don't occur. One of the reason is that it should be. Another
reason is that it's hard to call ether_ifdetach() and if_detach() when
cold == 1 (because of pserialize_perform, xc_wait, timing of domaininit
and maybe more).
--
Fix panic when only link interrupt can't be established.
--
- If MSI can't be used on some environment, fallback to INTx correctly.
- Use single vector MSI when number of CPU is 1 to save interrupt slot.
--
Fallback from MSI-X to MSI or INTx if MSI-X setup failed.
 1.88.2.7  02-Jan-2018  snj Pull up following revision(s) (requested by ozaki-r in ticket #456):
sys/arch/arm/sunxi/sunxi_emac.c: 1.9
sys/dev/ic/dwc_gmac.c: 1.43-1.44
sys/dev/pci/if_iwm.c: 1.75
sys/dev/pci/if_wm.c: 1.543
sys/dev/pci/ixgbe/ixgbe.c: 1.112
sys/dev/pci/ixgbe/ixv.c: 1.74
sys/kern/sys_socket.c: 1.75
sys/net/agr/if_agr.c: 1.43
sys/net/bpf.c: 1.219
sys/net/if.c: 1.397, 1.399, 1.401-1.403, 1.406-1.410, 1.412-1.416
sys/net/if.h: 1.242-1.247, 1.250, 1.252-1.257
sys/net/if_bridge.c: 1.140 via patch, 1.142-1.146
sys/net/if_etherip.c: 1.40
sys/net/if_ethersubr.c: 1.243, 1.246
sys/net/if_faith.c: 1.57
sys/net/if_gif.c: 1.132
sys/net/if_l2tp.c: 1.15, 1.17
sys/net/if_loop.c: 1.98-1.101
sys/net/if_media.c: 1.35
sys/net/if_pppoe.c: 1.131-1.132
sys/net/if_spppsubr.c: 1.176-1.177
sys/net/if_tun.c: 1.142
sys/net/if_vlan.c: 1.107, 1.109, 1.114-1.121
sys/net/npf/npf_ifaddr.c: 1.3
sys/net/npf/npf_os.c: 1.8-1.9
sys/net/rtsock.c: 1.230
sys/netcan/if_canloop.c: 1.3-1.5
sys/netinet/if_arp.c: 1.255
sys/netinet/igmp.c: 1.65
sys/netinet/in.c: 1.210-1.211
sys/netinet/in_pcb.c: 1.180
sys/netinet/ip_carp.c: 1.92, 1.94
sys/netinet/ip_flow.c: 1.81
sys/netinet/ip_input.c: 1.362
sys/netinet/ip_mroute.c: 1.147
sys/netinet/ip_output.c: 1.283, 1.285, 1.287
sys/netinet6/frag6.c: 1.61
sys/netinet6/in6.c: 1.251, 1.255
sys/netinet6/in6_pcb.c: 1.162
sys/netinet6/ip6_flow.c: 1.35
sys/netinet6/ip6_input.c: 1.183
sys/netinet6/ip6_output.c: 1.196
sys/netinet6/mld6.c: 1.90
sys/netinet6/nd6.c: 1.239-1.240
sys/netinet6/nd6_nbr.c: 1.139
sys/netinet6/nd6_rtr.c: 1.136
sys/netipsec/ipsec_output.c: 1.65
sys/rump/net/lib/libnetinet/netinet_component.c: 1.9-1.10
kmem_intr_free kmem_intr_[z]alloced memory
the underlying pools are the same but api-wise those should match
Unify IFEF_*_MPSAFE into IFEF_MPSAFE
There are already two flags for if_output and if_start, however, it seems such
MPSAFE flags are eventually needed for all if_XXX operations. Having discrete
flags for each operation is wasteful of if_extflags bits. So let's unify
the flags into one: IFEF_MPSAFE.
Fortunately IFEF_*_MPSAFE flags have never been included in any releases, so
we can change them without breaking backward compatibility of the releases
(though the kernel version of -current should be bumped).
Note that if an interface have both MP-safe and non-MP-safe operations at a
time, we have to set the IFEF_MPSAFE flag and let callees of non-MP-safe
opeartions take the kernel lock.
Proposed on tech-kern@ and tech-net@
Provide macros for softnet_lock and KERNEL_LOCK hiding NET_MPSAFE switch
It reduces C&P codes such as "#ifndef NET_MPSAFE KERNEL_LOCK(1, NULL); ..."
scattered all over the source code and makes it easy to identify remaining
KERNEL_LOCK and/or softnet_lock that are held even if NET_MPSAFE.
No functional change
Hold KERNEL_LOCK on if_ioctl selectively based on IFEF_MPSAFE
If IFEF_MPSAFE is set, hold the lock and otherwise don't hold.
This change requires additions of KERNEL_LOCK to subsequence functions from
if_ioctl such as ifmedia_ioctl and ifioctl_common to protect non-MP-safe
components.
Proposed on tech-kern@ and tech-net@
Ensure to hold if_ioctl_lock when calling if_flags_set
Fix locking against myself on ifpromisc
vlan_unconfig_locked could be called with holding if_ioctl_lock.
Ensure to not turn on IFF_RUNNING of an interface until its initialization completes
And ensure to turn off it before destruction as per IFF_RUNNING's description
"resource allocated". (The description is a bit doubtful though, I believe the
change is still proper.)
Ensure to hold if_ioctl_lock on if_up and if_down
One exception for if_down is if_detach; in the case the lock isn't needed
because it's guaranteed that no other one can access ifp at that point.
Make if_link_queue MP-safe if IFEF_MPSAFE
if_link_queue is a queue to store events of link state changes, which is
used to pass events from (typically) an interrupt handler to
if_link_state_change softint. The queue was protected by KERNEL_LOCK so far,
but if IFEF_MPSAFE is enabled, it becomes unsafe because (perhaps) an interrupt
handler of an interface with IFEF_MPSAFE doesn't take KERNEL_LOCK. Protect it
by a spin mutex.
Additionally with this change KERNEL_LOCK of if_link_state_change softint is
omitted if NET_MPSAFE is enabled.
Note that the spin mutex is now ifp->if_snd.ifq_lock as well as the case of
if_timer (see the comment).
Use IFADDR_WRITER_FOREACH instead of IFADDR_READER_FOREACH
At that point no other one modifies the list so IFADDR_READER_FOREACH
is unnecessary. Use of IFADDR_READER_FOREACH is harmless in general though,
if we try to detect contract violations of pserialize, using it violates
the contract. So avoid using it makes life easy.
Ensure to call if_addr_init with holding if_ioctl_lock
Get rid of outdated comments
Fix build of kernels without ether
By throwing out if_enable_vlan_mtu and if_disable_vlan_mtu that
created a unnecessary dependency from if.c to if_ethersubr.c.
PR kern/52790
Rename IFNET_LOCK to IFNET_GLOBAL_LOCK
IFNET_LOCK will be used in another lock, if_ioctl_lock (might be renamed then).
Wrap if_ioctl_lock with IFNET_* macros (NFC)
Also if_ioctl_lock perhaps needs to be renamed to something because it's now
not just for ioctl...
Reorder some destruction routines in if_detach
- Destroy if_ioctl_lock at the end of the if_detach because it's used in various
destruction routines
- Move psref_target_destroy after pr_purgeif because we want to use psref in
pr_purgeif (otherwise destruction procedures can be tricky)
Ensure to call if_mcast_op with holding IFNET_LOCK
Note that CARP doesn't deal with IFNET_LOCK yet.
Remove IFNET_GLOBAL_LOCK where it's unnecessary because IFNET_LOCK is held
Describe which lock is used to protect each member variable of struct ifnet
Requested by skrll@
Write a guideline for converting an interface to IFEF_MPSAFE
Requested by skrll@
Note that IFNET_LOCK must not be held in softint
Don't set IFEF_MPSAFE unless NET_MPSAFE at this point
Because recent investigations show that interfaces with IFEF_MPSAFE need to
follow additional restrictions to work with the flag safely. We should enable it
on an interface by default only if the interface surely satisfies the
restrictions, which are described in if.h.
Note that enabling IFEF_MPSAFE solely gains a few benefit on performance because
the network stack is still serialized by the big kernel locks by default.
 1.88.2.6  21-Dec-2017  snj Pull up following revision(s) (requested by msaitoh in ticket #441):
sys/dev/pci/files.pci: 1.390
sys/dev/pci/ixgbe/if_bypass.c: new
sys/dev/pci/ixgbe/if_fdir.c: new
sys/dev/pci/ixgbe/if_sriov.c: new
sys/dev/pci/ixgbe/ixgbe_bypass.h: new
sys/dev/pci/ixgbe/ixgbe_fdir.h: new
sys/dev/pci/ixgbe/ixgbe_features.h: new
sys/dev/pci/ixgbe/ixgbe_netmap.c: new
sys/dev/pci/ixgbe/ixgbe_netmap.h: new
sys/dev/pci/ixgbe/ixgbe_rss.h: new
sys/dev/pci/ixgbe/ixgbe_sriov.h: new
sys/dev/pci/ixgbe/ix_txrx.c: 1.28, 1.30 via patch
sys/dev/pci/ixgbe/ixgbe.c: 1.97-1.105, 1.107-1.111, 1.113-1.115
sys/dev/pci/ixgbe/ixgbe.h: 1.26-1.29 via patch
sys/dev/pci/ixgbe/ixv.c: 1.57-1.58, 1.60-1.61, 1.63-1.64, 1.66-1.72, 1.75 via patch
sys/dev/pci/ixgbe/ixgbe_api.c: 1.17-1.18 via patch
sys/dev/pci/ixgbe/ixgbe_type.h: 1.26-1.30 via patch
sys/dev/pci/ixgbe/ixgbe_82598.c: 1.9-1.10 via patch
sys/dev/pci/ixgbe/ixgbe_82598.h: 1.6-1.7
sys/dev/pci/ixgbe/ixgbe_82599.c: 1.15-1.16 via patch
sys/dev/pci/ixgbe/ixgbe_82599.h: 1.5-1.6
sys/dev/pci/ixgbe/ixgbe_api.h: 1.10-1.11 via patch
sys/dev/pci/ixgbe/ixgbe_common.c: 1.14-1.16 via patch
sys/dev/pci/ixgbe/ixgbe_common.h: 1.8-1.9 via patch
sys/dev/pci/ixgbe/ixgbe_dcb.c: 1.5-1.6
sys/dev/pci/ixgbe/ixgbe_dcb.h: 1.4-1.5
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c: 1.4-1.5
sys/dev/pci/ixgbe/ixgbe_dcb_82598.h: 1.4-1.5
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c: 1.4-1.5
sys/dev/pci/ixgbe/ixgbe_dcb_82599.h: 1.4-1.5
sys/dev/pci/ixgbe/ixgbe_mbx.c: 1.7-1.9 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.h: 1.11-1.12 via patch
sys/dev/pci/ixgbe/ixgbe_osdep.c: 1.2
sys/dev/pci/ixgbe/ixgbe_osdep.h: 1.18-1.19 via patch
sys/dev/pci/ixgbe/ixgbe_phy.c: 1.12-1.14 via patch
sys/dev/pci/ixgbe/ixgbe_phy.h: 1.9-1.10 via patch
sys/dev/pci/ixgbe/ixgbe_vf.c: 1.13-1.15 via patch
sys/dev/pci/ixgbe/ixgbe_vf.h: 1.9-1.11 via patch
sys/dev/pci/ixgbe/ixgbe_x540.c: 1.10-1.12
sys/dev/pci/ixgbe/ixgbe_x540.h: 1.6-1.7
sys/dev/pci/ixgbe/ixgbe_x550.c: 1.6-1.7
sys/dev/pci/ixgbe/ixgbe_x550.h: 1.3
Sync with FreeBSD's up to r326022, fix bugs and some improvements:
- Don't limit number of queue pair to 8. Take chip's max TX queues and
max RX queues into account.
- Add C3000 (Denverton) support.
- Add bypass function support for bypass adapters.
- Change EEE sysctl.
- Remove thermal test sysctl.
- ixv(4): set RSS mapping.
- ixv(4): Add TSOv6.
- ixv(4): Fix hardware counter.
- ixv(4): Make TX/RX descriptors size the same as ixg(4).
- ixv(4): Print device name in ixv_attach().
- ixv(4): Make mailbox statistic counters evcnt(9).
- ixv(4): Fix a problem that mailbox interrupt never occurred.
- ixv(4): Don't check neither VTEICR nor VTEICS same as Linux. It
seems that both registers can't be used to check which MSI-X vector
is triggered.
- ixv(4): Print Mailbox API version.
- Print driver feature capabilities and enable bits when verbose boot.
- Fix a bug that X550EM_A (Denverton) can't force 10BaseT.
- Remove all half-duplex setting because of the chip specification.
- Add 2.5GBASE-T and 5GBASE-T support.
- Set ifm_baudrate correctly.
- Protect ec_multi* with mutex like other MP safe Ethernet drivers.
- On X550 and newer, print NVM Image Version with %u.%02x.
- On X540, print PHY FW Revision with %u.%x. 0x4030 will be printed
as "Revision 4.3 ID 0x0"
- Fix value check of OEM_NVM_IMAGE_VER.
- Print PHY ID only for copper PHY.
- Fix a bug that X550 and newer didn't linkup if it forces
100BaseTX-FDX or 10BaseT-FDX.
- Fix a bug that RX may accesses freed area. It also fixes a problem
that if_init() takes long time on many core machine.
- Check ETHERCAP_VLAN_HWTAGGING in ixgbe_setup_vlan_hw_support(). This
change has no influence to netbsd because it's enabled by default
and NetBSD has no API to disable it.
- Whitespace fix.
 1.88.2.5  10-Dec-2017  snj Pull up following revision(s) (requested by msaitoh in ticket #427):
sys/arch/amiga/dev/if_bah_zbus.c: 1.17
sys/arch/arm/broadcom/bcm53xx_eth.c: 1.30
sys/arch/powerpc/booke/dev/pq3etsec.c: 1.32
sys/arch/usermode/dev/if_veth.c: 1.9
sys/dev/ic/an.c: 1.66
sys/dev/ic/athn.c: 1.17
sys/dev/ic/atw.c: 1.162
sys/dev/ic/bwi.c: 1.33
sys/dev/ic/dwc_gmac.c: 1.41-1.42
sys/dev/ic/malo.c: 1.10
sys/dev/ic/rt2560.c: 1.31
sys/dev/ic/rt2661.c: 1.36
sys/dev/ic/rt2860.c: 1.29
sys/dev/ic/rtw.c: 1.127
sys/dev/ic/rtwvar.h: 1.46
sys/dev/ic/smc90cx6.c: 1.71
sys/dev/ic/smc90cx6var.h: 1.12
sys/dev/ic/wi.c: 1.244
sys/dev/pci/if_ipw.c: 1.66
sys/dev/pci/if_iwi.c: 1.104
sys/dev/pci/if_iwm.c: 1.76
sys/dev/pci/if_iwn.c: 1.86
sys/dev/pci/if_rtwn.c: 1.13
sys/dev/pci/if_wm.c: 1.541
sys/dev/pci/if_wpi.c: 1.79
sys/dev/pci/ixgbe/ixgbe.c: 1.106
sys/dev/pci/ixgbe/ixv.c: 1.73 via patch
sys/dev/pcmcia/if_malo_pcmcia.c: 1.15
sys/dev/scsipi/if_se.c: 1.95
sys/dev/usb/if_upl.c: 1.60
sys/net/if.c: 1.396
sys/net/if.h: 1.241
sys/net/if_arc.h: 1.23
sys/net/if_arcsubr.c: 1.78
sys/net/if_bridge.c: 1.136-1.137
sys/net/if_etherip.c: 1.39
sys/net/if_faith.c: 1.56
sys/net/if_gif.c: 1.131
sys/net/if_loop.c: 1.96
sys/net/if_mpls.c: 1.30
sys/net/if_pppoe.c: 1.129
sys/net/if_srt.c: 1.27
sys/net/if_stf.c: 1.102
sys/net/if_tap.c: 1.100
sys/net/if_vlan.c: 1.105
sys/netinet/ip_carp.c: 1.91
sys/rump/net/lib/libshmif/if_shmem.c: 1.73-1.74
sys/rump/net/lib/libvirtif/if_virt.c: 1.55-1.56
if_initalize() and if_attach() failed when resource allocation failed
(e.g. allocating softint). Without this change, it panics. It's bad because
resource shortage really occured when a lot of pseudo interface is created.
To avoid this problem, don't panic and change return value of if_initialize()
and if_attach() to int. Caller fanction will be recover from error cleanly by
checking the return value.
Return if bah_attach_subr() failed.
If if_attach() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add some missing frees in bridge_clone_destroy().
- KNF
If error occured in bcmeth_ccb_attach(), free resources and return.
If error occured in pq3etsec_attach(), free resources and return.
If error occured in the attach function, free resources and return.
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().
- Free resources correctly on some errors in atw_attach().
- Use apint*() insread of printf() in the attach function.
If if_initialize() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add missing dwc_gmac_free_dma_rings() and mutex_destroy() when attach
failed.
- If if_initialize() failed in the attach function, free resources and return.
- ifp is always not NULL in iwi_detach(). Check correctly with ifp->if_softc.
- If if_initialize() failed in the attach function, free resources and return.
- Fix error path in the attach function correctly.
If if_initialize() failed in the attach function, free resources and return.
If if_attach() failed in the attach function, free resources and return.
- If if_initialize() failed in the attach function, free resources and return.
- KNF
- If if_attach() failed in the attach function, free resources and return.
- KNF
Fix compile error.
Fix compile error.
We don't need '&mii', but just 'mii' for mii_detach().
Don't free sc_rthash twice
 1.88.2.4  21-Nov-2017  martin Revert the pullup of the following revision(s) (requested by msaitoh in ticket #361):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.97
Revert a part of ticket #248 because it panics when attaching.
It is hard to fix with a small change.
 1.88.2.3  31-Aug-2017  martin Pull up following revision(s) (requested by msaitoh in ticket #248):
sys/dev/pci/ixgbe/ixgbe.h: revision 1.25
sys/dev/pci/ixgbe/ixgbe.c: revision 1.96
sys/dev/pci/ixgbe/ixgbe.c: revision 1.97
Remove unused counters.
Don't limit number of queue pair to 8. Take max TX queues and max RX queues
into account. 82598 has 32 TX queue and 64 RX queues. Others has 128 TX queues
and 128 RX queues. Number of MSI-X table entries is 64, so the max queue pairs
is 63 (64 minus the Others (e.g. link status change)).
 1.88.2.2  05-Aug-2017  snj Pull up following revision(s) (requested by msaitoh in ticket #175):
sys/dev/pci/ixgbe/ix_txrx.c: 1.25-1.27
sys/dev/pci/ixgbe/ixgbe.c: 1.91-1.95
sys/dev/pci/ixgbe/ixgbe_type.h: 1.23-1.25
sys/dev/pci/ixgbe/ixgbe_api.c: 1.16
sync ixg(4) up to ixgbe.c rev. 1.95:
- Increase total number of RX buffers on multiqueue.
- Fix the partial chain check in ixgbe_rx_discard(). This bug was
added in ixgbe.c rev. 1.33.
- Fix a double free in ixgbe_rxeof().
- Print verbose output in ixgbe_update_link_status() correctly on 5Gbps
and 2.5Gbps (NBASE-T) for X550T[12] and newer.
- Change hw.ixgN.ts to hw.ixgN.thermal_test. Same as FreeBSD.
- Fix a bug that ifconfig ixgN media 1000baseT and 10Gbase-T advertised
additional unwanted speeds.
- Print PHY ID.
- Remove unused variable.
 1.88.2.1  04-Jul-2017  martin Pull up following revision(s) (requested by msaitoh in ticket #81):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.89
sys/dev/pci/if_wm.c: revision 1.509
sys/dev/pci/ixgbe/ixgbe.c: revision 1.90
Use IFM_1000_KX and IFM_2500_KX.
Use IFM_1000_KX more.
 1.128.2.13  26-Jan-2019  pgoyette Sync with HEAD
 1.128.2.12  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.128.2.11  30-Sep-2018  pgoyette Ssync with HEAD
 1.128.2.10  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.128.2.9  28-Jul-2018  pgoyette Sync with HEAD
 1.128.2.8  25-Jun-2018  pgoyette Sync with HEAD
 1.128.2.7  21-May-2018  pgoyette Sync with HEAD
 1.128.2.6  22-Apr-2018  pgoyette Sync with HEAD
 1.128.2.5  16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.128.2.4  07-Apr-2018  pgoyette Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$
 1.128.2.3  30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.128.2.2  22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.128.2.1  15-Mar-2018  pgoyette Synch with HEAD
 1.161.2.3  21-Apr-2020  martin Sync with HEAD
 1.161.2.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.161.2.1  10-Jun-2019  christos Sync with HEAD
 1.199.2.30  03-Feb-2024  martin Pull up the following, requested by msaitoh in ticket #1792:

sys/dev/pci/ixgbe/ix_txrx.c 1.105-1.116 via patch
sys/dev/pci/ixgbe/ixgbe.c 1.345-1.346,1.349 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.94-1.98
sys/dev/pci/ixgbe/ixgbe_type.h 1.62
sys/dev/pci/ixgbe/ixv.c 1.193,1.195-1.196

- Clear the WTHRESH bit field before writing it.
- Optimize ixgbe_txeof().
- Use kmem_zalloc() instead of malloc(,M_ZERO).
- Add QPRDC(Queue Packet Receive Drop Count) into iqdrops.
- No functional change
- Move assignment of TXD.
- ixv(4): Remove unused IFF_OACTIVE.
- Don't include the Flow Director related members to reduce the
size of struct tx_ring. On amd64 and aarch64, the real size is
not changed because of the alignment.
- The descriptor ring size and the alignment are tested in the
attach function, so it's not required to use
roundup2(size, DBA_ALIGN).
- Use #ifdef LRO more to reduce the size of struct rx_ring.
- Change "me" from 32bit to 8bit because the max is 128.
This commit doesn't change the real size of ix_queue, tx_ring
and rx_ring because of the alignment.
- Th RSC (hardware receive side coalescing) feature has been
disabled all along, so enclose the code with #ifdef RSC.
- Remove unused.
- Modify for the readability.
- Modify comment.
- Fix comment. Whitespace.
 1.199.2.29  18-Oct-2023  martin Pull up the following, requested by msaitoh in ticket #1753:

sys/dev/pci/ixgbe/ix_txrx.c 1.103-1.104
sys/dev/pci/ixgbe/ixgbe.c 1.334-1.338,
1.341-1.344 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.90-1.93
sys/dev/pci/ixgbe/ixgbe_82599.c 1.31-1.32
sys/dev/pci/ixgbe/ixgbe_api.c 1.29
sys/dev/pci/ixgbe/ixgbe_bypass.h 1.5
sys/dev/pci/ixgbe/ixgbe_common.c 1.46-1.47
sys/dev/pci/ixgbe/ixgbe_common.h 1.18
sys/dev/pci/ixgbe/ixgbe_dcb.c 1.14-1.15
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.13
sys/dev/pci/ixgbe/ixgbe_type.h 1.59-1.61
sys/dev/pci/ixgbe/ixgbe_x540.c 1.24
sys/dev/pci/ixgbe/ixgbe_x550.c 1.28
sys/dev/pci/ixgbe/ixv.c 1.187-1.192

- ixg(4): Add 82599 LS support once again.
- ixg(4): Filter out spurious link up indication more.
- ixg(4): Print DEVICE_CAPS register.
- ixg(4): Fix a bug that the number of queues is unintentionally
limited to a small number or wrong error message may be printed
when two devices' number of MSI-X vectors are different.
- Modify error message of wrong TX/RX descriptor size.
- Enable interrupt after setting IFF_RUNNING.
- Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change
all devices all queues default interrupt rate.
- Cleanup the code.
 1.199.2.28  13-Oct-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #1749):

sys/dev/pci/ixgbe/if_bypass.c 1.10
sys/dev/pci/ixgbe/if_fdir.c 1.6 via patch
sys/dev/pci/ixgbe/if_sriov.c 1.18 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.102 via patch
sys/dev/pci/ixgbe/ixgbe.c 1.333,1.339 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.89
sys/dev/pci/ixgbe/ixgbe_api.h 1.17
sys/dev/pci/ixgbe/ixgbe_common.h 1.17
sys/dev/pci/ixgbe/ixgbe_bypass.h 1.4
sys/dev/pci/ixgbe/ixgbe_common.c 1.45
sys/dev/pci/ixgbe/ixgbe_fdir.h 1.5
sys/dev/pci/ixgbe/ixgbe_netmap.h 1.3
sys/dev/pci/ixgbe/ixgbe_netmap.c 1.6
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.9
sys/dev/pci/ixgbe/ixgbe_sriov.h 1.6
sys/dev/pci/ixgbe/ixgbe_type.h 1.58
sys/dev/pci/ixgbe/ixgbe_x550.c 1.27
sys/dev/pci/ixgbe/ixv.c 1.186 via patch

ixgbe: Rename some definitions, modify comment. No functional change.
Apply changes from FreeBSD's ix-3.3.31 and ixv-1.5.32.
- struct adapter *adapter -> struct ixgbe_softc *sc
- master -> primary
- black -> block

ixg(4): Whitespace. No functional change.
 1.199.2.27  08-Oct-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #1745):

sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.30
sys/dev/pci/ixgbe/ixv.c: revision 1.184
sys/dev/pci/ixgbe/ixv.c: revision 1.185
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.32
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.33
sys/dev/pci/ixgbe/ixgbe.h: revision 1.87
sys/dev/pci/ixgbe/ixgbe.h: revision 1.88
sys/dev/pci/ixgbe/ixgbe.c: revision 1.330
sys/dev/pci/ixgbe/ixgbe.c: revision 1.331
sys/dev/pci/ixgbe/ixgbe.c: revision 1.332
sys/dev/pci/ixgbe/ixgbe_vf.h: revision 1.18
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.101
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.57
sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.20
sys/dev/pci/ixgbe/ixgbe.c: revision 1.327
sys/dev/pci/ixgbe/ixgbe.c: revision 1.328
sys/dev/pci/ixgbe/ixgbe.c: revision 1.329

ixgbe: Reorder some event counters for readability.

ixg(4): Rename some descriptions of event counters.
- Rename some descriptions from register name to the meaning.
- For the same meaning's counters, add "(soft)" or "(reg)".
The former is for a software level counter and the latter is for a
statistics counter register based.

ixg(4): Count Queue Bytes {Transmit, Receive} counter.

ixg(4): Reorder some flow control related event counters for readability.

ixg(4): Rename some descriptions of flow control related event conters.
Remove obsolete comment.

ixgbe: Fix typo in comment. No functional change.

ixv(4): Improve error check.
ixgbe_vf.c rev. 1.31 changed the behavior of the ixgbe_check_mac_link_vf()
function. It was from FreeBSD's ixv-1.5.25 to resolve mailbox collision
problem. The change had a problem that error checks have not done at all if
the API version >= 1.5. Fix it. From FreeBSD ixv-1.5.27.

ixv(4): Add new IXGBE_VF_GET_LINK_STATE message support.
PF can control vf's link state by this change. Note that Linux's PF driver
can't control the link to force up (i.e. ip link set XXX vf Y state enable).
From FreeBSD ixv-1.5.30.

ixg(4): Update FCTRL after writing multicast filter. Same as other OSes.
From FreeBSD 395cc55d896654b8f75071e71e856b22aed87da5.
 1.199.2.26  21-Jun-2023  martin Pull up the following revisions, requested by msaitoh in ticket #1647:

sys/dev/pci/ixgbe/ixgbe.c 1.325-1.326 via patch
sys/dev/pci/ixgbe/ixgbe_common.c 1.44
sys/dev/pci/ixgbe/ixgbe_type.h 1.56

- PCI device ID 0x15c8 also uses X557-AT PHY, so create the thermal
sensor sysctl for it, too.
- Count the number of link down events in the MAC using with
LINK_DN_CNT register.
 1.199.2.25  23-Jan-2023  martin Pull up the following revisions, requested by msaitoh in ticket #1579:

sys/dev/pci/files.pci 1.442
sys/dev/pci/ixgbe/ix_txrx.c 1.99-1.100
sys/dev/pci/ixgbe/ixgbe.c 1.320-1.324 via patch
sys/dev/pci/ixgbe/ixgbe_82598.c 1.19
sys/dev/pci/ixgbe/ixgbe_api.c 1.28
sys/dev/pci/ixgbe/ixgbe_common.c 1.43
sys/dev/pci/ixgbe/ixgbe_netbsd.h 1.17
sys/dev/pci/ixgbe/ixv.c 1.183

- Add an option for Tx to use deferred softint regardless of whether
can get txq lock or not. It's off by default.
- Call txeof first, then rxeof for the consistency.
- Make three "Unsupported SFP+ module..." messages the same.
- KNF. Modify comment. Fix typo.
 1.199.2.24  03-Jun-2022  snj Pull up following revision(s) (requested by msaitoh in ticket #1460):
sys/dev/pci/ixgbe/ixgbe.c: patch
Fix previous to re-enable legacy interrupt correctly. It's a part of
ixgbe.c rev. 1.273.
 1.199.2.23  02-Jun-2022  martin Pull up the following revisions, all via patch, requested by msaitoh
in ticket #1459:

sys/dev/pci/ixgbe/ixgbe.c 1.261,1.265-1.268,1.273,1.275-1.277,
1.312,1.316-1.319 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.85 via patch
sys/dev/pci/ixgbe/ixgbe_type.h 1.46-1.47
sys/dev/pci/ixgbe/ixgbe_x550.c 1.26
sys/dev/pci/ixgbe/ixv.c 1.182

- Reduce code duplication between ixgbe_msix_admin() and
ixgbe_legacy_irq().
- Add missing code which was not in ixgbe_msix_admin() from
ixgbe_legacy_irq() and vice versa.
- Reorder code.
- Disable/enable the OTHER interrupts correctly.
- Don't return in the middle of ixgbe_msix_admin() when an flow
director reinit failed. NetBSD currently doesn't support flow
director, so this is not a real bug.
- Print ECC, PHY and temp error log using with ratecheck().
- Correctly re-enable queue interrupt in ixgbe_legacy_irq().
- Correctly enter the recovery mode.
- No functional change:
- Add some debug printf()s.
- Don't use "more" flag for simplify.
- Fix typos in comment.
- KNF.
 1.199.2.22  31-May-2022  martin Pull up following revision(s) (requested by msaitoh in ticket #1458):

sys/dev/pci/ixgbe/ixv.c: revision 1.181
sys/dev/pci/ixgbe/ixgbe.c: revision 1.315
sys/dev/pci/ixgbe/ixgbe.h: revision 1.86

Fix a bug that the legacy interrupt doesn't work when MSI-X allocation failed.
Fixes PR kern/56857.

Remove unused adapter->msix_mem.
 1.199.2.21  30-May-2022  martin Pull up the following revisions, requested by msaitoh:

sys/dev/pci/ixgbe/ixgbe.c 1.270,1.280,1.307-1.311,
1.313-1.314 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97
sys/dev/pci/ixgbe/ixv.c 1.158,1.179-1.180 via patch


- ixg(4): Print Printed Board Assembly (PBA) number.
- ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might
fix small race but it's not so dangerous.
- Add value check for {tx,rx}_process_limit sysctl to avoid setting
wrong value.
- Add missing num_tx_desc sysctl.
- No functional change:
- KNF a bit.
- Simplify setting of EIAC register.
- Move the definition of eicr_mask variable.
- Enclose flow director stuff in ixgbe_intr_admin_common() with
IXGBE_FIR which is not defined in NetBSD.
- Modify comment for consistency.
- Use cached rx_copy_len in ixgbe_rxeof().
 1.199.2.20  02-Feb-2022  martin Pull up the following revisions (requested by msaitoh in ticket #1424):

sys/dev/pci/ixgbe/ix_txrx.c 1.95
sys/dev/pci/ixgbe/ixgbe.c 1.305 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.c 1.19
sys/dev/pci/ixgbe/ixgbe_netbsd.h 1.15-1.16
sys/dev/pci/ixgbe/ixv.c 1.178 via patch

Use atomic_{load,store}_relaxed() for event counters.
 1.199.2.19  01-Feb-2022  martin Pull up the following revisions, requested by msaitoh in ticket #1420:

sys/dev/pci/ixgbe/ixgbe.c 1.264,1.269,1.272,
1.306 via patch

Four INTx related fixes:
- Fix a bug that the all interrupt sources are enabled when the
interface is UP and the INTx line is shared with other devices.
- Fix a bug that it might incorrectly enable interrupt when
IFF_RUNNING is not set.
- Don't process TX/RX if a queue interrupt isn't occurred.
- Increment legacy interrupt counter after checking INTx sharing.
 1.199.2.18  31-Jan-2022  martin Pull up following revision(s) (requested by msaitoh in ticket #1416):

sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.31
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.23
sys/dev/pci/ixgbe/if_sriov.c: revision 1.17
sys/dev/pci/ixgbe/ixv.c: revision 1.172
sys/dev/pci/ixgbe/ixv.c: revision 1.173
sys/dev/pci/ixgbe/ixgbe.c: revision 1.301
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.55
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.29
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.18

Add code to support API version 1.5. No functional change.
- This change adds almost all code to support API 1.5 except real negotiation
and upgrade mailbox functions.
- From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.

Enable mailbox API 1.5 support. Tested on ESXi with ixgben 1.10.3.0.

Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_vf().
Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_pf().
 1.199.2.17  30-Jan-2022  martin Pull up the following revisions, requested by msaitoh in ticket #1414:

sys/dev/pci/ixgbe/if_sriov.c 1.12-1.16
sys/dev/pci/ixgbe/ixgbe.c 1.295-1.297,1.300,1.304 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.84
sys/dev/pci/ixgbe/ixgbe_82598.c 1.17-1.18
sys/dev/pci/ixgbe/ixgbe_82598.h 1.9
sys/dev/pci/ixgbe/ixgbe_82599.c 1.24-1.28
sys/dev/pci/ixgbe/ixgbe_82599.h 1.8
sys/dev/pci/ixgbe/ixgbe_api.c 1.26-1.27
sys/dev/pci/ixgbe/ixgbe_api.h 1.16
sys/dev/pci/ixgbe/ixgbe_bypass.h 1.3
sys/dev/pci/ixgbe/ixgbe_common.c 1.34-1.42
sys/dev/pci/ixgbe/ixgbe_common.h 1.15-1.16
sys/dev/pci/ixgbe/ixgbe_dcb.c 1.12-1.13
sys/dev/pci/ixgbe/ixgbe_dcb.h 1.8-1.9
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.10-1.12
sys/dev/pci/ixgbe/ixgbe_dcb_82598.h 1.8
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c 1.10-1.11
sys/dev/pci/ixgbe/ixgbe_dcb_82599.h 1.8
sys/dev/pci/ixgbe/ixgbe_fdir.h 1.4
sys/dev/pci/ixgbe/ixgbe_features.h 1.4
sys/dev/pci/ixgbe/ixgbe_mbx.c 1.13-1.15
sys/dev/pci/ixgbe/ixgbe_mbx.h 1.15-1.18
sys/dev/pci/ixgbe/ixgbe_netmap.c 1.5
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.8
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.31
sys/dev/pci/ixgbe/ixgbe_phy.c 1.25-1.29
sys/dev/pci/ixgbe/ixgbe_phy.h 1.13
sys/dev/pci/ixgbe/ixgbe_rss.h 1.6
sys/dev/pci/ixgbe/ixgbe_sriov.h 1.5
sys/dev/pci/ixgbe/ixgbe_type.h 1.51-1.54
sys/dev/pci/ixgbe/ixgbe_vf.c 1.28-1.29
sys/dev/pci/ixgbe/ixgbe_vf.h 1.15
sys/dev/pci/ixgbe/ixgbe_x540.c 1.20-1.22
sys/dev/pci/ixgbe/ixgbe_x540.h 1.10
sys/dev/pci/ixgbe/ixgbe_x550.c 1.21-1.25
sys/dev/pci/ixgbe/ixgbe_x550.h 1.7
sys/dev/pci/ixgbe/ixv.c 1.170, 1.174-1.175 via patch

- Add typecast for type mismatch.
- Fix retry count calculation of I2C read/write.
- Wait longer for link after fiber MAC setup.
- ixv(4): Use adapter->mta for the multicast array memory instead of
the on-stack array.
- Match X550_PHY_ID correctly on X550.
- Print NVM image version on 82598.
- Use 64bit for lxon + lxoff.
- Don't expose garbage data of hw.ixvN.debug.
- Some NetBSD unrelated changes:
- Fix infinite recursion on PCIe link down if VMDQ is used.
- Move PF mailbox initialization from ixgbe_attach() to
ixgbe_init_iov().
- Add IPv6 mask for flow director.
- Change error level in ixgbe_fc_autoneg().
- Check host interface return status when writing NVM.
- Change DCB credit parameters.
- Restore some mailbox related functions. Revert part of ixgbe_mbx.c
rev. 1.7 and ixgbe_mbx.h rev. 1.11. No functional change.
- Rename IXGBE_VT_MSGTYPE_{ACK,NACK} to
IXGBE_VT_MSGTYPE_{SUCCESS,FAILURE}. No functional change.
- Remove unused argument. Change argument.
- Remove unnecessary return value check.
- Remove debug error message.
- Remove dead code.
- Add some unused macros.
- Fix typo in comment.
- Rename some functions.
- Sort lines, modify comment.
- Whitespace fix.
 1.199.2.16  29-Jan-2022  martin Pullup the following revisions, requested by msaitoh:

sys/dev/pci/ixgbe/ixgbe.c 1.298, 1.303 via patch

Add some missing error counters to ierror.
 1.199.2.15  20-Nov-2021  martin Pull up the following, requested by msaitoh in ticket #1374:

sys/dev/pci/ixgbe/ixgbe.h 1.81-1.83
sys/dev/pci/ixgbe/ixgbe.c 1.291-1.292 via patch
sys/dev/pci/ixgbe/ixgbe_type.h 1.50
sys/dev/pci/ixgbe/ixv.c 1.167-1.168 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.94

- Fix a bug that a near 64KB TSO segment can't send.
- Reduce bus_dmamap_sync() cost.
- Use macro. Fix typos in comment.
 1.199.2.14  15-Sep-2021  martin Pull up the following (via patch), requested by msaitoh in ticket #1346:

sys/dev/pci/ixgbe/ixgbe.c 1.252, 1.280-1.283, 1.286-1.287, 1.289-1.290 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.73, 1.76-1.80 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.68-1.93
sys/dev/pci/ixgbe/ixv.c 1.153, 1.157-1.161, 1.163-1.166 via patch
sys/dev/pci/ixgbe/if_bypass.c 1.7-1.9
sys/dev/pci/ixgbe/if_fdir.c 1.4-1.5
sys/dev/pci/ixgbe/if_sriov.c 1.10-1.11
sys/dev/pci/ixgbe/ixgbe_82598.c 1.16
sys/dev/pci/ixgbe/ixgbe_82599.c 1.23
sys/dev/pci/ixgbe/ixgbe_api.c 1.25
sys/dev/pci/ixgbe/ixgbe_bypass.h 1.2
sys/dev/pci/ixgbe/ixgbe_common.c 1.30-1.33
sys/dev/pci/ixgbe/ixgbe_dcb.c 1.10-1.11
sys/dev/pci/ixgbe/ixgbe_dcb.h 1.7
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.8-1.9
sys/dev/pci/ixgbe/ixgbe_dcb_82598.h 1.7
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c 1.8-1.9
sys/dev/pci/ixgbe/ixgbe_dcb_82599.h 1.7
sys/dev/pci/ixgbe/ixgbe_fdir.h 1.3
sys/dev/pci/ixgbe/ixgbe_features.h 1.3
sys/dev/pci/ixgbe/ixgbe_mbx.c 1.12
sys/dev/pci/ixgbe/ixgbe_netbsd.c 1.13, 1.16-1.17
sys/dev/pci/ixgbe/ixgbe_netbsd.h 1.13-1.14
sys/dev/pci/ixgbe/ixgbe_netmap.c 1.3-1.4
sys/dev/pci/ixgbe/ixgbe_netmap.h 1.2
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.7
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.29-1.30
sys/dev/pci/ixgbe/ixgbe_phy.c 1.24
sys/dev/pci/ixgbe/ixgbe_rss.h 1.5
sys/dev/pci/ixgbe/ixgbe_sriov.h 1.4
sys/dev/pci/ixgbe/ixgbe_type.h 1.49
sys/dev/pci/ixgbe/ixgbe_vf.c 1.27
sys/dev/pci/ixgbe/ixgbe_x540.c 1.18-1.19
sys/dev/pci/ixgbe/ixgbe_x540.h 1.9
sys/dev/pci/ixgbe/ixgbe_x550.c 1.19-1.20
sys/dev/pci/ixgbe/ixgbe_x550.h 1.6
sys/dev/pci/files.pci 1.438
share/man/man4/ixg.4 1.15
share/man/man4/ixv.4 1.8

- Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
Before this commit, resource shortage was easily occurred because
the total number of the clusters is small.
- Improve performance:
- Use m_adj(ETHER_ALIGN) more.
- Sprinkle __predict_false() in the RX path.
- Don't pre-allocate a cluster for RXCOPY case to improve short
packet's performance.
- Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
DMA buffer. Also, when the buffer is already freed, do not call
bus_dmamap_unload(9) (no resource leaks with this change). This
change is required to make ixg(4) work on alpha.
- Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
- Fix panic when bus_dmamap_load_mbuf() failed in
ixgbe_setup_receive_ring().
- Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability
on aarch64.
- Use uint64_t instead of bus_addr_t for the TX descriptor's buffer
address. At least, this change is required for macppc
(sizeof(bus_addr_t) == 4) to make TX work.
- Fix little-endian dependence.
- Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().
- Refresh unrefreshed descriptors' buffers correctly.
- Don't call bus_dmamap_sync with rx_mbuf_sz(== MCLBYTES) to prevent
panic.
- Save the discard_multidesc state to not to forget the state by
exiting rxeof().
- Add missing increment of no_mbuf error counter.
- Don't increment no_mbuf evcnt(9) when discarding multi-descriptor
packet.
- ixv: Modify error message to sync with ixgbe.c
- Print the error value of ixgbe_reset_hw() for debugging.
- Remove extra unlock/lock processing around if_percpuq_enqueue().
- Refactor rxr->next_to_check updating.
- Add new sysctl "rx_copy_len".
- Add a new sysctl to read rxr->next_to_refresh.
- Print error number when error occurred.
- Rename ix{gbe,v}_stop() with ix{gbe,v}_stop_locked(). No functional
change.
- Don't use fixed value.
- Comment out flow director processing in fast path.
- Add missing NetBSD RCS IDs and __KERNEL_RCSID()s.
- KNF.
- Fix typos.
 1.199.2.13  11-Mar-2021  martin Pull up the following (all via patch) requested by msaitoh in ticket #1231:

sys/dev/pci/ixgbe/ixgbe.c 1.259, 1.278-1.279
sys/dev/pci/ixgbe/ixgbe.h 1.75
sys/dev/pci/ixgbe/ixgbe_netbsd.h 1.12
sys/dev/pci/ixgbe/ixgbe_vf.c 1.24-1.26
sys/dev/pci/ixgbe/ixgbe_x550.c 1.17
sys/dev/pci/ixgbe/ixv.c 1.155-1.156
sys/dev/pci/ixgbe/ix_txrx.c 1.64-67
sys/dev/pci/files.pci 1.436
share/man/man4/ixg.4 1.13-1.14
share/man/man4/ixv.4 1.6-1.7

- Fix a problem that the RX path stalled when the mbuf cluster is
exhausted.
- Modify some parameters to reduce packet dropping. See also the
manual's OPTIONS section for the detail.
- ixv(4): The max number of queue(pair) is not 7 but 8. Correctly
reset the hardware.
- Add "TX " to "Queue No Descriptor Available" evcnt(9) name to make
it more understandable.
- Fix a bug that some advertise speeds can't be set with
hw.ixgN.advertise_speed if both 2.5G and 5G are set. Fix the error
message, too.
- Fix typo in comment or debug message.
 1.199.2.12  02-Sep-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1070):

sys/dev/pci/ixgbe/if_bypass.c: revision 1.6
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.28
sys/dev/pci/ixgbe/ixgbe.c: revision 1.246

Fix checking return value of atomic_cas_uint().

This change fixes a bug that extra delay() is called only once even if
atomic_cas_uint() isn't failed or delay() isn't called when atomic_cas_uint()
failed.

The reason of this bug was that I simply converted FreeBSD' atomic_cmpset_int()
to atomic_cas_uint(). The return value's semantics is different.

-

Minor change.
- Print "X550EM X" instead of "X550EM" for Xeon D devices.
- Fix typo in comment. Same as FreeBSD.
 1.199.2.11  10-Jul-2020  martin Pull up the following revisions, requested by msaitoh in ticket #997:

sys/dev/pci/ixgbe/ix_txrx.c 1.62-1.63 via patch
sys/dev/pci/ixgbe/ixgbe.c 1.225, 1.228-1.229,
1.232 via patch
sys/dev/pci/ixgbe/ixgbe.h 1.64, 1.66
sys/dev/pci/ixgbe/ixv.c 1.146, 1.148-1.150
sys/dev/pci/ixgbe/ixgbe_common.c 1.27
sys/dev/pci/ixgbe/ixgbe_vf.c 1.23
sys/dev/pci/ixgbe/ixgbe_82598.c 1.15
sys/dev/pci/ixgbe/ixgbe_x550.c 1.18
sys/dev/pci/ixgbe/ixgbe_netbsd.c 1.14
sys/dev/pci/ixgbe/ixgbe_phy.c 1.21
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.26

- Fix IXGBE_LE32_TO_CPUS() macro for big endian machine. This problem
was only on X550*.
- Add debug printf()s.
- Use unsigned to avoid undefined behavior in
ixgbe_fc_enable_generic().
- Modify a little to reduce diff between ixgbe.c and ixv.c.
No functional change.
- Modify comment.
- Remove unused macros.
- Whitespace fix.
- Fix typos.
 1.199.2.10  28-Jan-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #664):

sys/dev/pci/ixgbe/ixgbe_82598.c: revision 1.13
sys/dev/pci/ixgbe/ixgbe.c: revision 1.219
sys/dev/pci/ixgbe/ixgbe_phy.c: revision 1.20
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.22
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.44

Add recovery code for unsupported SFP+.

Before this commit:
If an unsupported SFP module is inserted before booting, the driver attach
failed and there was no way to recover form it without rebooting or
detaching/reattaching driver (drvctl -d && drvctl -r pciN).

After this commit:
We can automatically recover any time by replacing it with a supported
module.
 1.199.2.9  26-Jan-2020  martin Pull up the following (via patch), requested by msaitoh in ticket #648

sys/dev/pci/ixgbe/if_bypass.c 1.5
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.5
sys/dev/pci/ixgbe/ix_txrx.c 1.58-1.60
sys/dev/pci/ixgbe/ixgbe.c 1.220-1.221
sys/dev/pci/ixgbe/ixgbe.h 1.60-1.2
sys/dev/pci/ixgbe/ixgbe_api.c 1.24
sys/dev/pci/ixgbe/ixgbe_common.c 1.26
sys/dev/pci/ixgbe/ixgbe_netbsd.c 1.11-1.12
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.24
sys/dev/pci/ixgbe/ixgbe_phy.c 1.19
sys/dev/pci/ixgbe/ixgbe_82598.c 1.14
sys/dev/pci/ixgbe/ixv.c 1.142,1.144

- Free RX structure correctly when detaching.
- Remove unused code.
- Fix some typos in comment.
- Remove extra spaces.
- KNF.
 1.199.2.8  24-Dec-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #580):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.217
sys/dev/pci/ixgbe/ixgbe.c: revision 1.218
sys/dev/pci/ixgbe/ixgbe_osdep.c: revision 1.6
sys/dev/pci/ixgbe/ixv.c: revision 1.143
sys/dev/pci/ixgbe/ixgbe_osdep.h: revision 1.25

Use bus_space_barrier() instead of x86 specific *fence instruction.
Written by riastradh@.

Add missing core lock in ixgbe_handle_mod().
 1.199.2.7  19-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #453):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.216
sys/dev/pci/ixgbe/ixv.c: revision 1.141

Print MAC address.

XXX Should we move such type of printf() to ether_ifattach?
 1.199.2.6  17-Oct-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #348):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.214

Apply FreeBSD r353599:
> 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
 1.199.2.5  26-Sep-2019  martin Pull up the following revisions, requested by msaitoh in ticket #246:

sys/dev/pci/ixgbe/ixgbe_type.h 1.42-1.43
sys/dev/pci/ixgbe/ixgbe.c 1.209-1.213
sys/dev/pci/ixgbe/ixgbe_x550.c 1.16
sys/dev/pci/ixgbe/ixv.c 1.131-1.138
sys/dev/pci/ixgbe/ixgbe_vf.c 1.19-1.22
sys/dev/pci/ixgbe/ixgbe_vf.h 1.14
sys/dev/pci/ixgbe/ixgbe.h 1.57-1.58
share/man/man4/ixv.4 1.5

- Fix a bug that MBSDC (Bad SFD Count) isn't counted on X550EM_X and
X550EM_A. The register is for X550 and newer.
- ixv(4): Make SIOCADDMULTI returns ENOSPC and print error message
when the Ethernet multicast address list exceeds the limit(30) and
can't be ALLMULTI.
- ixv(4): SIOCZIFDATA clear the event counters as ixgbe.c.
- Reduce ixv(4)'s multicast table array size in ixv_set_multi from
MAX_NUM_MULTICAST_ADDRESSES(128) to IXGBE_MAX_VF_MC(30).
- ixv(4): Add support ALLMULTI and PROMISC.
- if_flags is neither int nor short. It's unsigned short.
- ixg(4): Fix a bug that the multicast filter isn't correctly
initialized when the total number of the Ethernet multicast
addresses is just 128.
- Make ixv_set_multi() work correctly (especially for PROMISC) when the
function is called from if_init().
- Remove *_set_promisc() and use *_set_multi(). And then, rename
*_set_multi() to *_set_rxfilter().
- ixv(4): If a multicast entry has range, use ALLMULTI like others.
- Fix typo in comment. Found by Wataru Ashihara.
 1.199.2.4  05-Sep-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #180):

sys/dev/pci/ixgbe/ixv.c: revision 1.130
sys/dev/pci/ixgbe/ixgbe.c: revision 1.207
sys/dev/pci/ixgbe/ixgbe.c: revision 1.208
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.55
sys/dev/pci/ixgbe/ixv.c: revision 1.129
sys/dev/pci/ixgbe/ixgbe_netbsd.c: revision 1.10

printf -> device_printf

Set IFM_1000_BX10 correctly.

Use aprint_*() in the attach function.
 1.199.2.3  01-Sep-2019  martin Pull up following revision(s) (requested by knakahara in ticket #136):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.205
sys/dev/pci/ixgbe/ixgbe.c: revision 1.206

fix typo in error handling of ixgbe_allocate_legacy().
ok by msaitoh@n.o

pullup-8, pullup-9

-

Fix panic when ncpu == 1 && sysctl -w hw.ixg0.txrx_workqueue=1. Reported by nonaka@n.o.

ok by msaitoh@n.o and nonaka@n.o

pullup-8, pullup-9
 1.199.2.2  01-Sep-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #134):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.202
sys/dev/pci/ixgbe/ixgbe.c: revision 1.203
sys/dev/pci/ixgbe/ixgbe.c: revision 1.204
sys/dev/pci/ixgbe/ixv.c: revision 1.128

Simplify ix{gbe,v}_[un]register_vlan() API suggested by knakahara.

The API was the same as FreeBSD's pre-iflib's. They use iflib now and it's
not required for us to keep the old API.
X550EM supports QSFP, so check ixgbe_media_type_fiber_qsfp too.

An interrupt might not arrive when a module is inserted. When an link status
change interrupt occurred and the driver still regard SFP as unplugged, link
becomes up and the real media type is unknown. e.g:

% ifconfig -m ixg0
(snip)
media: Ethernet autoselect (autoselect rxpause,txpause)
status: active
supported Ethernet media:
media none
media autoselect
(snip)

To resolve this problem, when an link status change interrupt occurred and the
driver still regard SFP as unplugged, issue the module softint before issuing
LSC interrupt.
 1.199.2.1  01-Sep-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #133):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.200
sys/dev/pci/ixgbe/ixgbe.c: revision 1.201
sys/dev/pci/ixgbe/ixv.c: revision 1.126
sys/dev/pci/ixgbe/ixv.c: revision 1.127
sys/net/if_vlan.c: revision 1.142
sys/net/if_vlan.c: revision 1.143
sys/net/if_vlan.c: revision 1.144
sys/net/if_vlan.c: revision 1.145
sys/net/if_vlan.c: revision 1.146

Check ec_capenable instead of ec_capabilities to control TX side of VLAN HW
tagging correctly.
XXX pullup-9

Add missing IFNET_LOCK() and IFNET_UNLOCK() in vlan_config().
XXX pullup-9

Fix a bug that VLAN HW "tagging" enable/disable may not reflect correctly.
- Always call ec_vlan_cb() if it exists.
- Some (or all?) ethernet drivers don't enable HW tagging if no any vlan is
attached. ixgbe is one of them. Check the the transition and update
VLAN HW tagging function.
XXX pullup-9

Use ETHER_LOCK()/ETHER_UNLOCK() suggested by knakahara.
- kmem_alloc(,KM_SLEEP) never return NULL, so remove NULL check.
- VLAN ID is never duplicated, so break the loop when found. Also move
kmen_free() outside of ETHER_LOCK(ec)/ETHER_UNLOCK(ec) to reduce the hold
time. suggested by ozaki-r.
- Whitespace fix.
 1.220.2.2  29-Feb-2020  ad Sync with head.
 1.220.2.1  25-Jan-2020  ad Sync with head.
 1.227.2.1  20-Apr-2020  bouyer Sync with HEAD
 1.258.2.3  03-Apr-2021  thorpej Sync with HEAD.
 1.258.2.2  03-Jan-2021  thorpej Sync w/ HEAD.
 1.258.2.1  14-Dec-2020  thorpej Sync w/ HEAD.
 1.279.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.280.2.3  01-Aug-2021  thorpej Sync with HEAD.
 1.280.2.2  17-Jun-2021  thorpej Sync w/ HEAD.
 1.280.2.1  13-May-2021  thorpej Sync with HEAD.
 1.282.2.1  31-May-2021  cjep sync with head
 1.324.2.8  23-Feb-2024  martin Pull up following revision(s) (requested by msaitoh in ticket #604):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.349

ixgbe: Add QPRDC into iqdrops.

A receive packet might drop at two different locations.

One is the packet buffer that packets are received into the chip first.
If the packet buffer is overflowed, the MPC register is incremented.
It's currently added to iqdrops. It's no problem.

Another is descriptor ring(s). A packet from the packet buffer is DMA'ed
into main memory base on the descriptor ring. If the ring is full, the packet
is dropped and the QPRDC register is incremented. It should be added to
iqdrops but it was not done. Fix it.

Reported by ozaki-r@.
 1.324.2.7  03-Feb-2024  martin Pull up following revision(s) (requested by msaitoh in ticket #563):

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.110
sys/dev/pci/ixgbe/ixgbe.c: revision 1.345
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.111
sys/dev/pci/ixgbe/ixgbe.c: revision 1.346
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.112
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.62
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.113
sys/dev/pci/ixgbe/ixgbe.c: revision 1.348
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.114
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.115
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.116
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.105
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.106
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.107
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.108
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.109
sys/dev/pci/ixgbe/ixv.c: revision 1.193
sys/dev/pci/ixgbe/ixv.c: revision 1.195
sys/dev/pci/ixgbe/ixv.c: revision 1.196
sys/dev/pci/ixgbe/ixgbe.h: revision 1.94
sys/dev/pci/ixgbe/ixgbe.h: revision 1.95
sys/dev/pci/ixgbe/ixgbe.h: revision 1.96
sys/dev/pci/ixgbe/ixgbe.h: revision 1.97
sys/dev/pci/ixgbe/ixgbe.h: revision 1.98

ixgbe: Fix comment. No functional change.
ixgbe: Whitespace. No functional change.
ixgbe(4): Move assignment of TXD. NFCI.
ixgbe(4): Modify comment. No functional change.
ixgbe_tx_ctx_setup() may or may not consume one TX descriptor.
ixv(4): Remove unused IFF_OACTIVE. No functional change.
ixgbe: Clear the WTHRESH bit field before writing it.
ixgbe: Modify for the readability. No functional change.
ixgbe: micro-optimize ixgbe_txeof()
Update txr->tx_avail and txr->txr_no_space outside the loop in ixgbe_txeof().
ixgbe: Update if_opackets outside the loop in ixgbe_txeof().
ixgbe: micro-optimize ixgbe_txeof()
Update txr->packets outside the loop in ixgbe_txeof().
ixgbe: Use #ifdef IXGBE_FDIR more
Don't include the Flow Director related members to reduce the size of
struct tx_ring. On amd64 and aarch64, the real size is not changed
because of the alignment.
ixgbe: Simplify. No functional change.
The descriptor ring size and the alignment are tested in the attach
function, so it's not required to use roundup2(size, DBA_ALIGN).
ixgbe: Use kmem_zalloc() instead of malloc(,M_ZERO).
ixgbe: Remove unused to reduce the size of struct rx_ring.
ixgbe: Use #ifdef LRO more to reduce the size of struct rx_ring.
ixgbe: Change "me" from 32bit to 8bit because the max is 128.
This commit doesn't change the real size of ix_queue, tx_ring and rx_ring
because of the alignment.
ixgbe: Use #ifdef RSC
This feature (hardware receive side coalescing) has been disabled all along,
so enclose the code with #ifdef RSC.
 1.324.2.6  03-Nov-2023  martin Pull up following revision(s) (requested by yamaguchi in ticket #455):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.347
sys/net/if_l2tp.c: revision 1.49
tests/net/if_vlan/t_vlan.sh: revision 1.25
sys/net/if_vlan.c: revision 1.171
sys/net/if_ethersubr.c: revision 1.326
sys/dev/pci/ixgbe/ixv.c: revision 1.194
Use ether_bpf_mtap only when the device supports vlan harware tagging
The function is bpf_mtap() for ethernet devices and *currently*
it is just handling VLAN tag stripped by the hardware.
l2tp(4): use ether_ifattach() to initialize ethercom
Support vlan(4) over l2tp(4)
Added the test for vlan over l2tp
 1.324.2.5  18-Oct-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #420):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.340
sys/dev/pci/ixgbe/ixgbe.c: revision 1.341
sys/dev/pci/ixgbe/ixgbe.c: revision 1.342
sys/dev/pci/ixgbe/ixgbe.c: revision 1.343
sys/dev/pci/ixgbe/ixgbe.c: revision 1.344
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.61
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.104
sys/dev/pci/ixgbe/ixv.c: revision 1.190
sys/dev/pci/ixgbe/ixv.c: revision 1.191
sys/dev/pci/ixgbe/ixv.c: revision 1.192
sys/dev/pci/ixgbe/ixgbe.h: revision 1.93

ixg(4): Print DEVICE_CAPS register.

ixgbe: Whitespace. No functional change.

ixg(4): Don't print wrong error message about ixgbe_num_queues.
Don't override the ixgbe_num_queues global variable. It's the default
value of the number of queues and should not override it because it
will be referenced by later device attach. For example, the number of
MSI-X vector is 64 on X540 and 18 on 82599. When both cards are inserted
to a machine that the number of CPU is 24 and X540 is probed earlier,
ixgbe_num_queues is overridden to 24 and the following error message is
printed when attaching 82599:
ixg2: autoconfiguration error: ixgbe_num_queues (24) is too large,
using reduced amount (17).

Note that the number of queues is in sc->num_queuss and referenced
by hw.ixgN.num_queues sysctl.

ixgbe: Don't override the {ixgbe,ixv}_max_interrupt_rate global variable.

Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change all
devices all queues default interrupt rate.

ixgbe: Whitespace. No functional change.
 1.324.2.4  13-Oct-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #407):

sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.47
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.28
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.60
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.31
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.32
sys/dev/pci/ixgbe/ixv.c: revision 1.187
sys/dev/pci/ixgbe/ixv.c: revision 1.188
sys/dev/pci/ixgbe/ixv.c: revision 1.189
sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.18
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.24
sys/dev/pci/ixgbe/ixgbe.c: revision 1.334
sys/dev/pci/ixgbe/ixgbe.c: revision 1.335
sys/dev/pci/ixgbe/ixgbe.c: revision 1.336
sys/dev/pci/ixgbe/ixgbe.c: revision 1.337
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.103
sys/dev/pci/ixgbe/ixgbe.c: revision 1.338
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.59
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c: revision 1.13
sys/dev/pci/ixgbe/ixgbe_dcb.c: revision 1.14
sys/dev/pci/ixgbe/ixgbe_dcb.c: revision 1.15
sys/dev/pci/ixgbe/ixgbe_api.c: revision 1.29
sys/dev/pci/ixgbe/ixgbe_bypass.h: revision 1.5
sys/dev/pci/ixgbe/ixgbe.h: revision 1.90
sys/dev/pci/ixgbe/ixgbe.h: revision 1.91
sys/dev/pci/ixgbe/ixgbe.h: revision 1.92
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.46

ixg(4): Remove unused and old function. No functional change.
- From FreeBSD's ix-3.3.32.

ixg(4): Add 82599 LS once again.
- From:
FreeBSD: 9228ac3a69c4c7401a743e6465e118101a2beeb0
DPDK: 549ccd3dc01539e060597b503f2b65b272de3347
- This was removed 5 years ago. From the commit message:
> Remove IXGBE_DEV_ID_82599_LS(0x154f) support again. I don't know why. This
> was added in ix-3.2.18.tar.gz(NetBSD: ixgbe_82599.c rev. 1.20) and
> removed in ix-3.3.6.tar.gz.

ixg(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.
- From FreeBSD:
In-tree: 04a5e6d7cadd06b10169c3c3a560649e7dc7444c
Out of tree: ix-3.3.33.

ixgbe: Simplify definitions. No functional change.
Both DEFAULT_{TX,RX}D and PERFORM_{TX,RX}D are 2048. Use DEFAULT_{TX,RX}D.
Same as FreeBSD.

ixgbe: Modify error message of wrong TX/RX descriptor size.
- Based from FreeBSD ix-3.3.35. I think ix-3.3.35's RING_INCREMENT(== 32)
is wrong. It should be 8(DBA_ALIGN / sizeof(union ixgbe_adv_[tr]x_desc)).
Linux also uses 8.

ixgbe: Remove NO_82599_SUPPORT and NO_X540_SUPPORT support. NFCI.
From FreeBSD ix-3.3.35. Note that this file is not used in NetBSD.

ixgbe: Enable interrupt after setting IFF_RUNNING. Same as FreeBSD x-3.3.35.

ixgbe: Cleanup. No fucntional change.

Remove unused code, fix whitespace and modify comment to reduce against
FreeBSD(mainly from ix-3.3.35).
 1.324.2.3  13-Oct-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #405):

sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.27
sys/dev/pci/ixgbe/ixgbe_fdir.h: revision 1.5
sys/dev/pci/ixgbe/ixv.c: revision 1.186
sys/dev/pci/ixgbe/ixgbe_osdep.c: revision 1.9
sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.17
sys/dev/pci/ixgbe/ixgbe_api.h: revision 1.17
sys/dev/pci/ixgbe/ixgbe.h: revision 1.89
sys/dev/pci/ixgbe/if_fdir.c: revision 1.6
sys/dev/pci/ixgbe/if_sriov.c: revision 1.18
sys/dev/pci/ixgbe/ixgbe.c: revision 1.333
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.102
sys/dev/pci/ixgbe/ixgbe.c: revision 1.339
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.58
sys/dev/pci/ixgbe/ixgbe_sriov.h: revision 1.6
sys/dev/pci/ixgbe/if_bypass.c: revision 1.10
sys/dev/pci/ixgbe/ixgbe_bypass.h: revision 1.4
sys/dev/pci/ixgbe/ixgbe_netmap.h: revision 1.3
sys/dev/pci/ixgbe/ixgbe_netmap.c: revision 1.6
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.45

ixgbe: Rename some definitions, modify comment. No functional change.
Apply changes from FreeBSD's ix-3.3.31 and ixv-1.5.32.
- struct adapter *adapter -> struct ixgbe_softc *sc
- master -> primary
- black -> block

ixg(4): Whitespace. No functional change.
 1.324.2.2  08-Oct-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #395):

sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.30
sys/dev/pci/ixgbe/ixv.c: revision 1.184
sys/dev/pci/ixgbe/ixv.c: revision 1.185
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.32
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.33
sys/dev/pci/ixgbe/ixgbe.h: revision 1.87
sys/dev/pci/ixgbe/ixgbe.h: revision 1.88
sys/dev/pci/ixgbe/ixgbe.c: revision 1.330
sys/dev/pci/ixgbe/ixgbe.c: revision 1.331
sys/dev/pci/ixgbe/ixgbe.c: revision 1.332
sys/dev/pci/ixgbe/ixgbe_vf.h: revision 1.18
sys/dev/pci/ixgbe/ix_txrx.c: revision 1.101
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.57
sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.20
sys/dev/pci/ixgbe/ixgbe.c: revision 1.327
sys/dev/pci/ixgbe/ixgbe.c: revision 1.328
sys/dev/pci/ixgbe/ixgbe.c: revision 1.329

ixgbe: Reorder some event counters for readability.

ixg(4): Rename some descriptions of event counters.
- Rename some descriptions from register name to the meaning.
- For the same meaning's counters, add "(soft)" or "(reg)".
The former is for a software level counter and the latter is for a
statistics counter register based.

ixg(4): Count Queue Bytes {Transmit, Receive} counter.

ixg(4): Reorder some flow control related event counters for readability.

ixg(4): Rename some descriptions of flow control related event conters.
Remove obsolete comment.

ixgbe: Fix typo in comment. No functional change.

ixv(4): Improve error check.
ixgbe_vf.c rev. 1.31 changed the behavior of the ixgbe_check_mac_link_vf()
function. It was from FreeBSD's ixv-1.5.25 to resolve mailbox collision
problem. The change had a problem that error checks have not done at all if
the API version >= 1.5. Fix it. From FreeBSD ixv-1.5.27.

ixv(4): Add new IXGBE_VF_GET_LINK_STATE message support.
PF can control vf's link state by this change. Note that Linux's PF driver
can't control the link to force up (i.e. ip link set XXX vf Y state enable).
From FreeBSD ixv-1.5.30.

ixg(4): Update FCTRL after writing multicast filter. Same as other OSes.
From FreeBSD 395cc55d896654b8f75071e71e856b22aed87da5.
 1.324.2.1  21-Jun-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #202):

sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.56
sys/dev/pci/ixgbe/ixgbe.c: revision 1.325
sys/dev/pci/ixgbe/ixgbe.c: revision 1.326
sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.44

Use thermal sensor code for IXGBE_DEV_ID_X550EM_A_10G_T, too.
PCI device ID 0x15c8 also use X557-AT PHY, so create the thermal sensor
sysctl for it, too.

Count the number of link down events in the MAC using with LINK_DN_CNT.
- Add new event counter "link_dn_cnt" to count the number of link down
events in the MAC.
- The LINK_DN_CNT register (at 0x0403c) is described only in the
Denverton's datasheet, so use it only on ixgbe_mac_X550EM_a.

RSS XML Feed