summaryrefslogtreecommitdiff
path: root/sys/dev/bge
Commit message (Collapse)AuthorAgeFilesLines
* bge: clean up empty lines in .c and .h filesMateusz Guzik2020-09-012-19/+0
| | | | Notes: svn path=/head/; revision=365122
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-24/+25
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that processGleb Smirnoff2020-02-111-4/+1
| | | | | | | | | | incoming packets in taskqueue context. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D23518 Notes: svn path=/head/; revision=357772
* Remove sparc64 kernel supportWarner Losh2020-02-031-53/+0
| | | | | | | | | Remove all sparc64 specific files Remove all sparc64 ifdefs Removee indireeect sparc64 ifdefs Notes: svn path=/head/; revision=357455
* With MSI interrupts bge(4) just schedules taskqueue. Enter the networkGleb Smirnoff2020-01-231-0/+3
| | | | | | | | | epoch in the taskqueue handler. Reported by: kib Notes: svn path=/head/; revision=357051
* Convert to if_foreach_llmaddr() KPI.Gleb Smirnoff2019-10-211-22/+14
| | | | Notes: svn path=/head/; revision=353812
* Split out a more generic debugnet(4) from netdump(4)Conrad Meyer2019-10-171-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Debugnet is a simplistic and specialized panic- or debug-time reliable datagram transport. It can drive a single connection at a time and is currently unidirectional (debug/panic machine transmit to remote server only). It is mostly a verbatim code lift from netdump(4). Netdump(4) remains the only consumer (until the rest of this patch series lands). The INET-specific logic has been extracted somewhat more thoroughly than previously in netdump(4), into debugnet_inet.c. UDP-layer logic and up, as much as possible as is protocol-independent, remains in debugnet.c. The separation is not perfect and future improvement is welcome. Supporting INET6 is a long-term goal. Much of the diff is "gratuitous" renaming from 'netdump_' or 'nd_' to 'debugnet_' or 'dn_' -- sorry. I thought keeping the netdump name on the generic module would be more confusing than the refactoring. The only functional change here is the mbuf allocation / tracking. Instead of initiating solely on netdump-configured interface(s) at dumpon(8) configuration time, we watch for any debugnet-enabled NIC for link activation and query it for mbuf parameters at that time. If they exceed the existing high-water mark allocation, we re-allocate and track the new high-water mark. Otherwise, we leave the pre-panic mbuf allocation alone. In a future patch in this series, this will allow initiating netdump from panic ddb(4) without pre-panic configuration. No other functional change intended. Reviewed by: markj (earlier version) Some discussion with: emaste, jhb Objection from: marius Differential Revision: https://reviews.freebsd.org/D21421 Notes: svn path=/head/; revision=353685
* bge: check that the bus is a pci bus before using it as suchAndriy Gapon2019-07-161-2/+2
| | | | | | | | | | | | | This fixes the following panic on powerpc: pci_get_vendor failed for pcib1 on bus ofwbus0, error = 2 PR: 238730 Reported by: Dennis Clarke <dclarke@blastwave.org> Tested by: Dennis Clarke <dclarke@blastwave.org> MFC after: 2 weeks Notes: svn path=/head/; revision=350025
* Remove unused define.Tycho Nightingale2019-05-171-8/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=347903
* Fix integer overflow in r346386.Tycho Nightingale2019-05-161-1/+1
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=347896
* reinstate 4GB DMA boundary workarounds for bge and aacTycho Nightingale2019-05-162-6/+37
| | | | | | | | | Reviewed by: kib Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D20277 Notes: svn path=/head/; revision=347890
* remove the 4GB boundary requirement on PCI DMA segmentsTycho Nightingale2019-04-191-0/+8
| | | | | | | | | | Reviewed by: kib Discussed with: jhb Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D19867 Notes: svn path=/head/; revision=346386
* Reapply, with minor tweaks, r338025, from the original commit:Warner Losh2018-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused and easy to misuse PNP macro parameter Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Approved by: re (glen) Notes: svn path=/head/; revision=338948
* Back out r338035 until Warner is finished churning GSoC PNP patchesConrad Meyer2018-08-191-1/+1
| | | | | | | | | | I was not aware Warner was making or planning to make forward progress in this area and have since been informed of that. It's easy to apply/reapply when churn dies down. Notes: svn path=/head/; revision=338037
* Remove unused and easy to misuse PNP macro parameterConrad Meyer2018-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Notes: svn path=/head/; revision=338035
* Use the size of one bge_devs element for the MODULE_PNP_INFO macro,Dimitry Andric2018-08-181-1/+1
| | | | | | | | | | | instead of the size of the whole bge_devs array. This should stop kldxref searching beyond the end of .rodata when it processes relocations, and emitting "unhandled relocation type" errors, at least on i386. Notes: svn path=/head/; revision=338025
* As non-sparc64 undconditionally returns 1, simplify #ifdefs.Cy Schubert2018-08-011-3/+3
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=337026
* bge(4): disable MSI for BGE_ASICREV_BCM5784/BGE_CHIPREV_5784_AXEugene Grosbein2018-07-181-0/+8
| | | | | | | | | | | | | found in some MacBook Pro. PR: 229727 Reported by: Stephan Neuhaus <sten@artdecode.de> and others Tested by: Stephan Neuhaus <sten@artdecode.de> Approved by: mav (mentor) MFC after: 1 month Notes: svn path=/head/; revision=336461
* Add PNP info to PCI attachments of bge driverWarner Losh2018-07-081-0/+2
| | | | | | | | | | Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com> Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15995 Notes: svn path=/head/; revision=336104
* Add netdump hooks to bge(4).Mark Johnston2018-05-061-14/+97
| | | | | | | | | | | | Tested with a NetXtreme BCM5727 adapter. Reviewed by: julian MFC after: 1 month Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D15256 Notes: svn path=/head/; revision=333286
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-182-0/+4
| | | | | | | | | | | | | | | | | | | | The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* bge: Force chipid to 5720 A0 for 5717 C0 in an early placeSepherosa Ziehau2016-06-011-3/+4
| | | | | | | | | Discussed with: yongari MFC after: 1 week Sponsored by: Microsoft OSTC Notes: svn path=/head/; revision=301103
* bge: Support 5717 C0, which is almost same as 5720 A0Sepherosa Ziehau2016-05-302-0/+7
| | | | | | | | | PR: 209758 Obtained from: DragonFlyBSD d79f5d8f5fe94cd6769207b2901422977d502bc0 MFC after: 1 week Notes: svn path=/head/; revision=300985
* bge(4): Small memory leakPedro F. Giffuni2015-03-081-0/+1
| | | | | | | | | CID: 1229985 Reviewed by: marcel Differential Review: https://reviews.freebsd.org/D2024 Notes: svn path=/head/; revision=279786
* In order to reduce use of M_EXT outside of the mbuf allocator andRobert Watson2015-01-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | socket-buffer implementations, introduce a return value for MCLGET() (and m_cljget() that underlies it) to allow the caller to avoid testing M_EXT itself. Update all callers to use the return value. With this change, very few network device drivers remain aware of M_EXT; the primary exceptions lie in mbuf-chain pretty printers for debugging, and in a few cases, custom mbuf and cluster allocation implementations. NB: This is a difficult-to-test change as it touches many drivers for which I don't have physical devices. Instead we've gone for intensive review, but further post-commit review would definitely be appreciated to spot errors where changes could not easily be made mechanically, but were largely mechanical in nature. Differential Revision: https://reviews.freebsd.org/D1440 Reviewed by: adrian, bz, gnn Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=276750
* - Make PCI_QUIRK_MSI_INTX_BUG work by using the ID of the actual PCI deviceMarius Strobl2014-12-271-4/+2
| | | | | | | | | | | | | for the lookup. - For devices affected by PCI_QUIRK_MSI_INTX_BUG, ensure PCIM_CMD_INTxDIS is cleared when using MSI/MSI-X. - Employ PCI_QUIRK_MSI_INTX_BUG for BCM5714(S)/BCM5715(S)/BCM5780(S) rather than clearing PCIM_CMD_INTxDIS unconditionally for all devices in bge(4). MFC after: 3 days Notes: svn path=/head/; revision=276299
* - Remove empty wrappers ether_poll_[de]register_drv(). [1]Gleb Smirnoff2014-09-281-1/+1
| | | | | | | | | | - Move polling(9) declarations out of ifq.h back to if_var.h they are absolutely unrelated to queues. Submitted by: Mikhail <mp lenta.ru> [1] Notes: svn path=/head/; revision=272257
* - Use if_inc_counter() to increment various counters.Gleb Smirnoff2014-09-181-14/+34
| | | | | | | | | | | | - Do not ever set a counter to a value. For those counters that we don't increment, but return directly from hardware create cases in if_get_counter() method. Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=271782
* It is actually possible to have if_t a typedef to non-void type,Gleb Smirnoff2014-08-311-1/+1
| | | | | | | | | | | | | | and keep both converted to drvapi and non-converted drivers compilable. o Make if_t typedef to struct ifnet *. o Remove shim functions. Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=270876
* Fix an apparent conversion error in bge to the new driver api.Peter Wemm2014-07-181-2/+2
| | | | | | | | | if_multiaddr_array() does the LLADDR work, don't do it twice. This broke IPv6 in "interesting" ways in the FreeBSD.org cluster. Notes: svn path=/head/; revision=268833
* Fixed build with DEVICE_POLLING.Sergey Kandaurov2014-07-021-2/+2
| | | | Notes: svn path=/head/; revision=268176
* Fix off-by-one introduced by the conversion to the driver API.Marcel Moolenaar2014-07-021-1/+1
| | | | | | | | Submitted by: Sreekanth Rupavatharam <rupavath@juniper.net> Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=268165
* Convert bge(4) to use the driver API.Marcel Moolenaar2014-07-011-174/+181
| | | | | | | | Submitted by: Sreekanth Rupavatharam <rupavath@juniper.net> Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=268113
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-281-13/+4
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-271-4/+13
| | | | | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky2014-06-271-13/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
* Fix various NIC drivers to properly cleanup static DMA resources.John Baldwin2014-06-111-14/+12
| | | | | | | | | | | | | | | | | | In particular, don't check the value of the bus_dma map against NULL to determine if either bus_dmamem_alloc() or bus_dmamap_load() succeeded. Instead, assume that bus_dmamap_load() succeeeded (and thus that bus_dmamap_unload() should be called) if the bus address for a resource is non-zero, and assume that bus_dmamem_alloc() succeeded (and thus that bus_dmamem_free() should be called) if the virtual address for a resource is not NULL. In many cases these bugs could result in leaks when a driver was detached. Reviewed by: yongari MFC after: 2 weeks Notes: svn path=/head/; revision=267363
* Increase the number of TX DMA segments from 32 to 35. It turnedPyun YongHyeon2014-03-311-1/+1
| | | | | | | | | | | | | out 32 is not enough to support a full sized TSO packet. While I'm here fix a long standing bug introduced in r169632 in bce(4) where it didn't include L2 header length of TSO packet in the maximum DMA segment size calculation. In collaboration with: rmacklem MFC after: 2 weeks Notes: svn path=/head/; revision=263957
* - Simplify MSI allocation and release. For a single one, we don't need toMarius Strobl2013-12-291-18/+12
| | | | | | | | | | | fiddle with the MSI count and pci_release_msi(9) is smart enough to just do nothing in case of INTx. - Don't allocate MSI as RF_SHAREABLE. MFC after: 1 week Notes: svn path=/head/; revision=260045
* Add support for BCM57764, BCM57767, BCM57782, BCM57786 and BCM57787.Pyun YongHyeon2013-12-022-0/+15
| | | | | | | | Submitted by: jhb PR: 184304 Notes: svn path=/head/; revision=258830
* The r48589 promised to remove implicit inclusion of if_var.h soon. PrepareGleb Smirnoff2013-10-261-0/+1
| | | | | | | | | | | to this event, adding if_var.h to files that do need it. Also, include all includes that now are included due to implicit pollution via if_var.h Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=257176
* Fix for IPv4 fragment packets treated as RMCP.Pyun YongHyeon2013-08-092-0/+3
| | | | | | | | | | | | bit25 of rxMode MAC register of 5762 needs to be set for rx mgmt filter to work correctly when processing match for UDP header fields. Otherwise false positive can occur which causes IPv4 fragment to be received by APE instead of host. Reported by: Geans Pin <geanspin@broadcom.com> Notes: svn path=/head/; revision=254118
* 5725 family of devices corrupts TSO packets when TSO DMA buffersPyun YongHyeon2013-07-221-11/+45
| | | | | | | | | | cross into regions which are within MSS bytes of a 4GB boundary. If we encounter the condition, drop the packet. Reviewed by: Geans Pin geanspin@Broacom Notes: svn path=/head/; revision=253540
* Add support for upcoming BCM5725 (ASIC 5762) controller. This is aPyun YongHyeon2013-07-202-12/+49
| | | | | | | | | | | | | | | | | | | | | new 1Gb server controller chip that will be going into production soon. BCM5725 combines MAC with triple-speed PHY, a Network Controller Sideband Interface (NC-SI) and on-chip memory buffer in a single device. BCM5725 has an Application Processing Engine (APE) that is capable of on-chip management and offloading features. BCM5725 supports high-precision clock, time stamp registers for receive/transmit packets and programmable trigger inputs and watchdog timeouts. These new features are not yet supported by bge(4). Many thanks to Broadcom for continuing to support FreeBSD! Submitted by: Geans Pin geanspin@Broacom (initial version) Reviewed by: Geans Pin geanspin@Broacom H/W donated by: Broadcom Notes: svn path=/head/; revision=253483
* Setup the PCIE Fast Training Sequence (FTS) value to preventPyun YongHyeon2013-07-202-0/+19
| | | | | | | | transmit hangs for 57766 and non Ax versions of 57765. While here, correct definition of BGE_CHIPREV_57765_AX. Notes: svn path=/head/; revision=253480
* Implement workaround for BCM5719/BCM5720 TX hang.Pyun YongHyeon2013-07-172-4/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The read DMA request logic operation is based on having sufficient available space in the transmit data buffer (TXMBUF) before a read DMA can be requested. There are four read DMA channels that use the TXMBUF, and the logic checks if the available free space in the TXMBUF is large enough for all the data in the four Send Buffers for which buffer descriptors have been fetched. The Enable_Request signal is asserted only if the free TXMBUF space is larger than the sum of the four DMA length registers. The power-up default value of BGE_RDMA_LSO_CRPTEN_CTRL register bit 25 (bit 21 on BCM5720) is zero, which selects the DMA length registers to connect to the input of the adder block. The DMA length registers are asynchronously reset following BCM5719/BCM5720 power-up, and due to the lack of synchronous deassertion of the length registers reset signal these resisters may contain uninitialized values following the reset deassertion. In the case of the failure the uninitialized DMA length register values added up to more than the TXMBUF size, which prevented the assertion of the Enable_Request signal and any subsequent read DMA to start. This lockup condition is the root cause of failing to generate any transmit traffic. To workaround the issue, select alternate output of multiplexers and transmit the first four Ethernet frames. This overwrites the DMA length registers with valid values. Reported by: Geans Pin <geanspin@broadcom.com> Reviewed by: Geans Pin <geanspin@broadcom.com> Notes: svn path=/head/; revision=253408
* Fix triggering false watchdog timeout as done in bce(4) whenPyun YongHyeon2013-06-302-1/+30
| | | | | | | controller is in PAUSE state. Notes: svn path=/head/; revision=252404
* Don't blidly clear GPIOs configuration. Just use firmware configuredPyun YongHyeon2013-06-261-1/+1
| | | | | | | | | | one. This change also fixes non-working traffic LED on BCM57780. Submitted by: Masanobu SAITOH <msaitoh@NetBSD.org> Tested by: Alexander Milanov <a@amilanov.com> Notes: svn path=/head/; revision=252227
* Fix a typo introduced in r213280. IFM_OPTIONS macro should seePyun YongHyeon2013-06-141-1/+1
| | | | | | | current media word. Notes: svn path=/head/; revision=251733
* Correct setting TX random backoff register. This register isPyun YongHyeon2013-06-072-3/+3
| | | | | | | | | | | | | implemented as a 10 bits linear feedback shift register so only lower 10 bits are valid. Because this register is used to initialize random backoff interval register only when resolved duplex is half-duplex, it wouldn't have caused issues in these days. Submitted by: Masanobu SAITOH <msaitoh@NetBSD.org> Notes: svn path=/head/; revision=251482