mgb: remove set but not used variablesSponsored by: The FreeBSD Foundation(cherry picked from commit c0aa5f6a321b8e7a921eda69ec0ab7373890c155)
mgb: sync with version in mainThis is a combination of 7 commits.mgb: update Microchip URLsSponsored by: The FreeBSD Foundation(cherry picked from commit 6b25b4a73fbe56e15d094895b4c7acdb424ee
mgb: sync with version in mainThis is a combination of 7 commits.mgb: update Microchip URLsSponsored by: The FreeBSD Foundation(cherry picked from commit 6b25b4a73fbe56e15d094895b4c7acdb424ee80d)mgb: enable multicast in mgb_initReceive Filtering Engine (RFE) configuration is not yet implemented,and mgb intended to enable all broadcast, multicast, and unicast.However, MGB_RFE_ALLOW_MULTICAST was missed (MGB_RFE_ALLOW_UNICAST wasincluded twice).MFC after: 1 weekFixes: 8890ab7758b8 ("Introduce if_mgb driver...")Sponsored by: The FreeBSD Foundation(cherry picked from commit ecac5c2928eead57c05ee7d376ff58de0a575d49)mgb: Do not KASSERT on error in mgb_initThere's not much we can do if mii_mediachg() fails, but KASSERT is notappropriate.MFC after: 1 weekFixes: 8890ab7758b8 ("Introduce if_mgb driver...")Sponsored by: The FreeBSD Foundation(cherry picked from commit 8b889b8953828fe22e5de68647a35610dd87ff8f)mgb: Staticize devclass and iflib structs (as is typical)MFC after: 1 weekFixes: 8890ab7758b8 ("Introduce if_mgb driver...")Sponsored by: The FreeBSD Foundation(cherry picked from commit c83ae596f3c2ce8c4ef2bacfb63100aaf8d48bb7)mgb: Apply some style(9)Add parens around return values, rewrap linesMFC after: 1 weekFixes: 8890ab7758b8 ("Introduce if_mgb driver...")Sponsored by: The FreeBSD Foundation(cherry picked from commit 820da5820e60f538d3598d8cb226f51a01bdf01c)mgb: Fix DEBUG (and LINT) buildSponsored by: The FreeBSD Foundation(cherry picked from commit 5f07d7fe408bbca5c2f6755c363128107916c08d)mgb: Fix nop admin interrupt handlingPreviously mgb_admin_intr printed a diagnostic message if no interruptstatus bits were set, but it's not valid to call device_printf() from afilter. Just drop the message as it has no user-facing value.Also return FILTER_STRAY in this case - there is nothing further forthe driver to do.Reviewed by: kbowlingMFC after: 1 weekFixes: 8890ab7758b8 ("Introduce if_mgb driver...")Sponsored by: The FreeBSD FoundationDifferential Revision: https://reviews.freebsd.org/D32231(cherry picked from commit 1ad2d87778970582854082bcedd2df0394fd4933)
show more ...
iflib: ensure that tx interrupts enabled and cleanupsDoing a 'dd' over iscsi will reliably cause stalls. Txcleaning _should_ reliably happen as data is sent.However, currently if the transmit que
iflib: ensure that tx interrupts enabled and cleanupsDoing a 'dd' over iscsi will reliably cause stalls. Txcleaning _should_ reliably happen as data is sent.However, currently if the transmit queue fills it willwait until the iflib timer (hz/2) runs.This change causes the the tx taskq thread to be runif there are completed descriptors.While here:- make timer interrupt delay a sysctl- simplify txd_db_check handling- comment on INTR typesBackground on the change:Initially doorbell updates were minimized by only writing to the registeron every fourth packet. If txq_drain would return without writing to thedoorbell it scheduled a callout on the next tick to do the doorbell writeto ensure that the write otherwise happened "soon". At that time a sysctlwas added for users to avoid the potential added latency by simply writingto the doorbell register on every packet. This worked perfectly well fore1000 and ixgbe ... and appeared to work well on ixl. However, as itturned out there was a race to this approach that would lockup the ixl MAC.It was possible for a lower producer index to be written after a higher one.On e1000 and ixgbe this was harmless - on ixl it was fatal. My initialresponse was to add a lock around doorbell writes - fixing the problem butadding an unacceptable amount of lock contention.The next iteration was to use transmit interrupts to drive delayed doorbellwrites. If there were no packets in the queue all doorbell writes would beimmediate as the queue started to fill up we could delay doorbell writesfurther and further. At the start of drain if we've cleaned any packets weknow we've moved the state machine along and we write the doorbell (anobvious missing optimization was to skip that doorbell write if db_pendingis zero). This change required that tx interrupts be scheduled periodicallyas opposed to just when the hardware txq was full. However, that just leadsto our next problem.Initially dedicated msix vectors were used for both tx and rx. However, itwas often possible to use up all available vectors before we set up all thequeues we wanted. By having rx and tx share a vector for a given queue wecould halve the number of vectors used by a given configuration. The problemhere is that with this change only e1000 passed the necessary value to havethe fast interrupt drive tx when appropriate.Reported by: mav@Tested by: mav@Reviewed by: gallatin@MFC after: 1 monthSponsored by: iXsystemsDifferential Revision: https://reviews.freebsd.org/D27683
mgb: correct macro argument namemgb had a longstanding typo in function-like macro MGB_NEXT_RING_IDX'sargument, but the macro had no consumers. r365061 introduced a use ofthe macro, after which
mgb: correct macro argument namemgb had a longstanding typo in function-like macro MGB_NEXT_RING_IDX'sargument, but the macro had no consumers. r365061 introduced a use ofthe macro, after which mgb failed to build.MFC after: 3 daysSponsored by: The FreeBSD Foundation
mgb: clean up empty lines in .c and .h files
iflib: leave only 1 receive descriptor unusedThe pidx argument of isc_rxd_flush() indicates which is the last validreceive descriptor to be used by the NIC. However, current code hasmultiple issu
iflib: leave only 1 receive descriptor unusedThe pidx argument of isc_rxd_flush() indicates which is the last validreceive descriptor to be used by the NIC. However, current code hasmultiple issues: - Intel drivers write pidx to their RDT register, which means that NICs will only use the descriptors up to pidx-1 (modulo ring size N), and won't actually use the one pointed by pidx. This does not break reception, but it is anyway confusing and suboptimal (the NIC will actually see only N-2 descriptors as available, rather than N-1). Other drivers (if_vmx, if_bnxt, if_mgb) adhere to this semantic). - The semantic used by Intel (RDT is one descriptor past the last valid one) is used by most (if not all) NICs, and it is also used on the TX side (also in iflib). Since iflib is not currently using this semantic for RX, it must decrement fl->ifl_pidx (modulo N) before calling isc_rxd_flush(), and then the per-driver callback implementation must increment the index again (to match the real semantic). This is confusing and suboptimal. - The iflib refill function is also called at initialization. However, in case the ring size is smaller than 128 (e.g. if_mgb), the refill function will actually prepare all the receive descriptors (N), without leaving one unused, as most of NICs assume (e.g. to avoid RDT to overrun RDH). I can speculate that the code looks like this right now because this issue showed up during testing (e.g. with if_mgb), and it was easy to workaround by decrementing pidx before isc_rxd_flush().The goal of this change is to simplify the code (removing a bunchof instructions from the RX fast path), and to make the semantic ofisc_rxd_flush() consistent across drivers. To achieve this, we: - change the semantics of the pidx argument to the usual one (that is the index one past the last valid one), so that both iflib and drivers avoid the decrement/increment dance. - fix the initialization code to prepare at most N-1 descriptors.Reviewed by: markjMFC after: 2 weeksDifferential Revision: https://reviews.freebsd.org/D26191
mgb: Correct spello - recieve -> receiveReported by: N. J. MannMFC with: r354410
Introduce if_mgb driver for Microchip LAN743x PCIe NICThe Microchip LAN7430 is a PCIe 10/100/1000 Ethernet MAC with integratedPHY, and the LAN7431 is a MAC with RGMII interface.To be connected t
Introduce if_mgb driver for Microchip LAN743x PCIe NICThe Microchip LAN7430 is a PCIe 10/100/1000 Ethernet MAC with integratedPHY, and the LAN7431 is a MAC with RGMII interface.To be connected to the build after further testing and review.Committing now so that changes like r354345 (adding a commonETHER_IS_ZERO macro) will update this driver too.Submitted by: Gerald ND Aryeetey <aryeeteygerald_rogers.com>Sponsored by: The FreeBSD FoundationDifferential Revision: https://reviews.freebsd.org/D20079