aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bce
Commit message (Collapse)AuthorAgeFilesLines
* bce(4): Fix a typo in a source code commentGordon Bergling2025-08-281-1/+1
| | | | | | - s/firwmare/firmware/ (cherry picked from commit a848c85d27c8f8d6b8394a372417703a2969314c)
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-10-081-6/+0
| | | | | | | | | | | | | | | | | | Change 4787572d0580 made if_alloc_domain() never fail, then also do the wrappers if_alloc(), if_alloc_dev(), and if_gethandle(). No functional change intended. Reviewed by: kp, imp, glebius, stevek MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D45740 MFC note: This is only a partial MFC, as some drivers do not exist in stable/13 branch. The if_epair(4) drifts too much from stable/14 so not included in this MFC. (cherry picked from commit aa3860851b9f6a6002d135b1cac7736e0995eedc) (cherry picked from commit 6b1f530935c5f84ec65dad87b7c20c6b7a72a6d3)
* bce(4): Fix a typo in a kernel messageGordon Bergling2024-01-251-1/+1
| | | | | | - s/adddress/address/ (cherry picked from commit e1c0d368d630cce01691e1967ada9f36d6b8c751)
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-231-2/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in current: (cherry picked from commit 685dc743dc3b)
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-232-4/+0
| | | | | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/ Similar commit in current: (cherry picked from commit 95ee2897e98f)
* bce(4): Fix a typo in a source code commentGordon Bergling2022-09-061-1/+1
| | | | | | - s/overriden/overridden/ (cherry picked from commit ddf38e0204f8146709d3a278520873a68d1802a4)
* bce(4): Fix two typos in kernel messagesGordon Bergling2022-08-091-2/+2
| | | | | | - s/bufferred/buffered/ (cherry picked from commit 1ffd352bc25bb74eb4026c271dea1410e0098fb3)
* bce(4): Fix a typo in a source code commentGordon Bergling2022-04-091-1/+1
| | | | | | - s/exisitng/existing/ (cherry picked from commit 24926c487b59c7d80637ea77b13ffb6eb797b7f6)
* bce(4): Fix a typo in a sysctl descriptionGordon Bergling2021-12-051-1/+1
| | | | | | - s/duirng/during/ (cherry picked from commit 25d0ccbe1018814064d60432012bc2ef70054e58)
* Fix some common typos in source code commentsGordon Bergling2021-08-191-2/+2
| | | | | | | - s/struture/structure/ - s/structre/structure/ (cherry picked from commit 17db4b52fb41aeabeb945c68c1b5edd4db4eac31)
* bce: clean up empty lines in .c and .h filesMateusz Guzik2020-09-013-246/+0
| | | | Notes: svn path=/head/; revision=365119
* Remove all the compatibility hacks for systems that predate FreeBSD 8. Some ofWarner Losh2020-03-012-50/+0
| | | | | | | | | these look to be cut and pasted from other drivers since this driver was committed to FreeBSD 7-current and MFC'd to FreeBSD 6. The ones for FreeBSD 4 and 5 likely never were working... Notes: svn path=/head/; revision=358486
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-19/+21
| | | | | | | | | | | | | | | | | | | 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
* Convert to if_foreach_llmaddr() KPI.Gleb Smirnoff2019-10-211-12/+14
| | | | Notes: svn path=/head/; revision=353810
* 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
* ifnet: Replace if_addr_lock rwlock with epoch + mutexMatt Macy2018-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Run on LLNW canaries and tested by pho@ gallatin: Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5 based ConnectX 4-LX NIC, I see an almost 12% improvement in received packet rate, and a larger improvement in bytes delivered all the way to userspace. When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1, I see, using nstat -I mce0 1 before the patch: InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree 4.98 0.00 4.42 0.00 4235592 33 83.80 4720653 2149771 1235 247.32 4.73 0.00 4.20 0.00 4025260 33 82.99 4724900 2139833 1204 247.32 4.72 0.00 4.20 0.00 4035252 33 82.14 4719162 2132023 1264 247.32 4.71 0.00 4.21 0.00 4073206 33 83.68 4744973 2123317 1347 247.32 4.72 0.00 4.21 0.00 4061118 33 80.82 4713615 2188091 1490 247.32 4.72 0.00 4.21 0.00 4051675 33 85.29 4727399 2109011 1205 247.32 4.73 0.00 4.21 0.00 4039056 33 84.65 4724735 2102603 1053 247.32 After the patch InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree 5.43 0.00 4.20 0.00 3313143 33 84.96 5434214 1900162 2656 245.51 5.43 0.00 4.20 0.00 3308527 33 85.24 5439695 1809382 2521 245.51 5.42 0.00 4.19 0.00 3316778 33 87.54 5416028 1805835 2256 245.51 5.42 0.00 4.19 0.00 3317673 33 90.44 5426044 1763056 2332 245.51 5.42 0.00 4.19 0.00 3314839 33 88.11 5435732 1792218 2499 245.52 5.44 0.00 4.19 0.00 3293228 33 91.84 5426301 1668597 2121 245.52 Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch Reviewed by: gallatin Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D15366 Notes: svn path=/head/; revision=333813
* Add PNP info to the bce driver.Warner Losh2018-04-171-1/+2
| | | | | | | | Submitted by: Lakhan Shiva Kamireddy Pull Request: https://github.com/freebsd/freebsd/pull/136 Notes: svn path=/head/; revision=332651
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-203-0/+6
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. 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. Notes: svn path=/head/; revision=326022
* sys/dev: Replace zero with NULL for pointers.Pedro F. Giffuni2017-02-201-1/+1
| | | | | | | | | | | Makes things easier to read, plus architectures may set NULL to something different than zero. Found with: devel/coccinelle MFC after: 3 weeks Notes: svn path=/head/; revision=313982
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-032-4/+4
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* sys: use our roundup2/rounddown2() macros when param.h is available.Pedro F. Giffuni2016-04-211-1/+1
| | | | | | | | | | | | | rounddown2 tends to produce longer lines than the original code and when the code has a high indentation level it was not really advantageous to do the replacement. This tries to strike a balance between readability using the macros and flexibility of having the expressions, so not everything is converted. Notes: svn path=/head/; revision=298433
* Correct a typo.Pyun YongHyeon2015-02-241-1/+1
| | | | | | | Reported by: jmg Notes: svn path=/head/; revision=279223
* Const'ify a firmware image missed in r251142.Marius Strobl2014-12-271-3/+3
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=276313
* - Provide bce_get_counter() to return counters that are not collected,Gleb Smirnoff2014-09-252-45/+49
| | | | | | | | | | | but taken from hardware. - Mechanically convert to if_inc_counter() the rest of counters. - While here fix 3 instances of the same bug, when error counter was ++ in one place and then assigned in other place, losing the increment. Achieve that storing soft errors counters in softc. Notes: svn path=/head/; revision=272096
* Use CSUM_BITS instead of incorrect copy.Gleb Smirnoff2014-09-031-5/+1
| | | | | | | Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=271005
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-281-15/+0
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-271-0/+15
| | | | | | | | | | | | | 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-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* - Unmap static DMA buffers allocated via bus_dmemem_alloc() beforeJohn Baldwin2014-06-111-58/+42
| | | | | | | | | | | | freeing them instead of after. - Check the bus address of a static DMA buffer to decide if the associated map should be unloaded. - Don't try to destroy bus dma maps for static DMA buffers. Reviewed by: davidcs Notes: svn path=/head/; revision=267377
* Modify Copyright information and other strings to reflect Qlogic ↵David C Somayajulu2014-05-083-23/+11
| | | | | | | | | | | | Corporation's purchase of Broadcom's NetXtreme business. Added clean option to Makefile Submitted by:David C Somayajulu (davidcs@freebsd.org) QLogic Corporation MFC after:5 days Notes: svn path=/head/; revision=265703
* Increase the number of TX DMA segments from 32 to 35. It turnedPyun YongHyeon2014-03-311-2/+2
| | | | | | | | | | | | | 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
* Fix regression introduced in r235816.Pyun YongHyeon2013-10-291-3/+5
| | | | | | | | | | | | | | | r235816 triggered kernel panic or hang after warm boot. Don't blindly restore BCE_EMAC_MODE media configuration in bce_reset(). If driver is about to shutdown it will invoke bce_reset() which in turn results in restoring BCE_EMAC_MODE media configuration. This operation seems to confuse controller firmware. Reported by: Paul Herman (herman <> cleverbridge dot com) Tested by: sbruno, Paul Herman (herman <> cleverbridge dot com) Notes: svn path=/head/; revision=257307
* Move includes from if_bcereg.h to .c files.Gleb Smirnoff2013-10-262-45/+48
| | | | Notes: svn path=/head/; revision=257173
* Remove unused and incomplete support for delayed fragment checksumsAndre Oppermann2013-08-191-3/+1
| | | | | | | from bce(4), bxe(4), mge(4) and ti(4) drivers. Notes: svn path=/head/; revision=254516
* Fix triggering false watchdog timeout when controller is in PAUSEPyun YongHyeon2013-06-302-3/+31
| | | | | | | | | | | | state. Previously it used to check if controller has sent a PAUSE frame to the remote peer. Reported by: David Imhoff via Brad Smith <brad@OpenBSD.org> Submitted by: davidch (initial version) Reviewed by: davidch, David Imhoff <dimhoff_devel@xs4all.nl> Notes: svn path=/head/; revision=252402
* - Checking for spurious interrupts is only necessary when using INTx.Marius Strobl2013-05-301-11/+17
| | | | | | | | | | | | | Actually, this may be further optimized for controller variants supporting one-shot MSIs but I'm lacking the necessary hardware for testing. - Add some missing synchronization of the statistics and status DMA maps. MFC after: 1 week Notes: svn path=/head/; revision=251159
* - Do supply arguments as pointers to bce_get_{pg,rx}_buf() that are notMarius Strobl2013-05-301-114/+86
| | | | | | | | | | | | | | | | | | | | altered or actually needed there any longer. - Honor errors passed to the DMA mapping callbacks. - In bce_get_rx_buf(), do not reserve stack space for more DMA segments than actually necessary. - In bce_get_pg_buf(), take advantage of bus_dmamap_load_mbuf_sg(9). - In bce_rx_intr(), remove a pointless check for an empty mbuf pointer which can only happen in case of a severe programming error. Moreover, recovering from that situation would require way more actions with header splitting enabled (which it is by default). - Fix VLAN tagging in the RX path; do not attach the VLAN tag twice if the firmware has been told to keep it. [1] Obtained from: OpenBSD [1] MFC after: 1 week Notes: svn path=/head/; revision=251146
* - As a follow-up to r247565, make firmware images that do not requireMarius Strobl2013-05-303-157/+101
| | | | | | | | | | | | | | | patching at runtime actually const. - Remove pointless softc members by employing the corresponding constants directly. - Remove pointless returns. - Remove unnecessary inclusion of opt_device_polling.h. - Replace an outdated and now bogus comment in bce_tick() with the appropriate one. MFC after: 1 week Notes: svn path=/head/; revision=251142
* Initialize count in order to appease clang.Marius Strobl2013-03-011-0/+1
| | | | | | | Submitted by: delphij Notes: svn path=/head/; revision=247590
* - Make tables, device ID strings etc const.Marius Strobl2013-03-012-59/+34
| | | | | | | | | | | | | | | - Use NULL instead of 0 for pointers. - Remove redundant bzero(9)'ing of the softc. - Remove redundant/unused softc members. - Don't allocate MSI/MSI-X as RF_SHAREABLE. - Re-use bus accessor macros instead of duplicating them. - In bce_miibus_{read,write}_reg(), remove superfluous limiting of the PHY address (missed in r213893). MFC after: 1 week Notes: svn path=/head/; revision=247565
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-041-5/+5
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* Remove unused and unnecessary CSUM_IP_FRAGS checksumming capability.Andre Oppermann2012-11-271-1/+1
| | | | | | | | | | | Checksumming the IP header of fragments is no different from doing normal IP headers. Discussed with: yongari MFC after: 1 week Notes: svn path=/head/; revision=243624
* - Remove BCE_JUMBO_HDRSPLIT kernel option which was forgotten in r218423.Andrey Zonov2012-10-301-1/+0
| | | | | | | | Approved by: davidch Approved by: kib (mentor) Notes: svn path=/head/; revision=242360
* Remove a spurious bace which cause build fail in case BCE_DEBUG optionDavide Italiano2012-08-061-1/+1
| | | | | | | | | | | | is turned on. Reviewed by: delphij Approved by: gnn (mentor) Sponsored by: Google Summer of Code 2012 MFC after: 1 week Notes: svn path=/head/; revision=239110
* Make IPMI work in the bce driver even when the interface isPyun YongHyeon2012-05-231-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | configured down. Formerly, IPMI communication was lost whenever the interface was not up. The reason was that the BCE_EMAC_MODE register was not configured with the correct media settings. There are two parts to the fix. First, resetting the chip in bce_reset() causes the BCE_EMAC_MODE register to be initialized to a default value that does not necessarily correspond to the actual media settings. The fix implemented here is a bit of a hack. Ideally, at the end of bce_reset() we would poll the PHY to determine the negotiated media, and then we would set the BCE_EMAC_MODE register accordingly. That is difficult, since the PHY is abstracted behind the MII layer and is not supposed to be queried directly from the MAC driver. Instead, we read the BCE_EMAC_MODE register at the beginning of bce_reset() and then restore its media bits to their original values before returning. If IPMI is up and running, then the link is already established and the BCE_EMAC_MODE register is already set appropriately when bce_reset() is called. If IPMI is not running, no harm is done by preserving the BCE_EMAC_MODE settings. The driver will set the register properly once the interface is configured up and link is established. Second, bce_miibus_statchg() is sometimes called when the link is down. In that case, the reported media settings are invalid. Formerly, the driver used them anyway to setup the BCE_EMAC_MODE register. We now avoid changing any MAC registers unless link is active and the reported media settings are valid. Submitted by: jdp Tested by: jdp MFC after: 5 days Notes: svn path=/head/; revision=235816
* Implement basic remote PHY support. Remote PHY allows thePyun YongHyeon2012-05-092-52/+444
| | | | | | | | | | | | | | | | | | | | | | | | | controller to perform MDIO type accesses to a remote transceiver using message pages defined through MRBE(multirate backplane ethernet). It's used in blade systems(e.g Dell Blade m610) which are connected to pass-through blades rather than traditional switches. This change directly manipulates firmware's mailboxes to control remote PHY such that it does not use mii(4). Alternatively, as David said, it could be implemented in brgphy(4) by creating a fake PHY and let brgphy(4) do necessary mii accesses and bce(4) can implement mailbox accesses based on the type of brgphy(4)'s mii accesses. Personally, I think it would make brgphy(4) hard to maintain since it would have to access many bce(4) registers in brgphy(4). Given that there are users who are suffering from lack of remote PHY support, it would be better to get working system rather than waiting for complete/perfect implementation. Tested by: Jan Winter ( jan.winter <> kantarmedia dot de ) Reviewed by: davidch (initial version) MFC after: 2 weeks Notes: svn path=/head/; revision=235151
* - Rename sysctl "loose_rx_mtu" to "strict_rx_mtu" to match code usage.David Christensen2012-05-081-1/+1
| | | | | | | | Submitted by: davidch MFC after: 1 day Notes: svn path=/head/; revision=235145
* Restore jumbo frame configuration which was broken in r218423.Pyun YongHyeon2012-05-071-14/+4
| | | | | | | | | Submitted by: Andrey Zonov <andrey <> zonov dot org > (initial version) Tested by: Andrey Zonov <andrey <> zonov dot org > MFC after: 1 week Notes: svn path=/head/; revision=235119