aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/msk/if_msk.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove now-redundant calls to device_delete_childJohn Baldwin2025-01-021-20/+1
| | | | | | | | Deleting a child explicitly before calling bus_generic_detach is now redundant, so remove those calls and rely on bus_generic_detach to delete children instead. Differential Revision: https://reviews.freebsd.org/D47961
* Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin2024-12-061-5/+1
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
* msk/sk: Use a bus_child_deleted method to free ivars for childrenJohn Baldwin2024-11-011-4/+8
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47365
* newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh2024-07-251-2/+2
| | | | Sponsored by: Netflix
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-06-281-5/+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
* msk: Use device_set_descf()Mark Johnston2024-06-161-3/+1
| | | | | | No functional change intended. MFC after: 1 week
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Mechanically convert msk(4) to IfAPIJustin Hibbits2023-02-061-139/+138
| | | | | Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37830
* msk: Use a void cast to mark values of dummy reads as unused.John Baldwin2022-10-051-5/+5
| | | | | | | | | | | | | Note that this required adding missing ()'s around the outermost level of MSK_READ_MIB*. Otherwise, the void cast was only applied to the first register read. This also meant that MSK_READ_MIB64 was pretty broken as the uint64_t cast only applied to the first 16-bit register read in each MSK_READ_MIB32 invocation and the 32-bit shift was only applied to the second register read of the pair. Reviewed by: imp, emaste Reported by: GCC -Wunused-value Differential Revision: https://reviews.freebsd.org/D36777
* msk: Don't bother reading spare stats registers.John Baldwin2022-10-051-4/+0
| | | | | | | | msk_stats_update reads stats registers named "spare" whose values are discarded. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D36871
* msk: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-061-6/+2
|
* Remove unused miibus_devclass and miibus_fdt_devclass.John Baldwin2022-05-061-1/+1
|
* msk: Remove write only variables, but leave hardware reads in placeWarner Losh2022-04-061-7/+5
| | | | Sponsored by: Netflix
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-9/+12
| | | | | | | | | | | | | | | | | | | 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
* Enter net epoch in msk_tick.Alexander Kabaev2020-01-271-0/+3
| | | | | | | | | | One more instance of if_input being called outside of interrupt, by means of msk_handle_events. Differential Revision: https://reviews.freebsd.org/D23379 Notes: svn path=/head/; revision=357161
* Convert to if_foreach_llmaddr() KPI.Gleb Smirnoff2019-10-211-14/+16
| | | | Notes: svn path=/head/; revision=353820
* 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
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-181-0/+2
| | | | | | | | | | | | | | | | | | | | 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
* Remove unnecessary assignment.Pyun YongHyeon2017-04-141-1/+1
| | | | | | | Found by: PVS-Studio Notes: svn path=/head/; revision=316819
* Remove NULL checks after M_WAITOK allocations from msk(4).Edward Tomasz Napierala2016-08-091-12/+0
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=303873
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-031-1/+1
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* ifnet lock was changed to use sx(9) long time ago.Pyun YongHyeon2016-02-221-2/+2
| | | | | | | Don't hold a driver lock for if_free(9). Notes: svn path=/head/; revision=295873
* Fix variable assignment.Pyun YongHyeon2016-02-181-1/+1
| | | | | | | Found by: PVS-Studio Notes: svn path=/head/; revision=295735
* Eliminate unnecessary checking for M_EXT on mbufs returned by m_getjcl().Robert Watson2014-10-131-4/+0
| | | | | | | | | | Reviewed by: bz, glebius, yongari MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D938 Notes: svn path=/head/; revision=273028
* Mechanically convert to if_inc_counter().Gleb Smirnoff2014-09-181-10/+10
| | | | Notes: svn path=/head/; revision=271801
* Use define from if_var.h to access a field inside struct if_data,Gleb Smirnoff2014-08-301-1/+1
| | | | | | | | | that resides in struct ifnet. Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=270856
* Fix various NIC drivers to properly cleanup static DMA resources.John Baldwin2014-06-111-19/+16
| | | | | | | | | | | | | | | | | | 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
* Revert r234666. Clearing TWSI IRQ seems to cause watchdog timeoutPyun YongHyeon2014-02-071-3/+0
| | | | | | | | | | on old Yukon II controllers. Tested by: bsam MFC after: 2 weeks Notes: svn path=/head/; revision=261577
* Perform media change after setting IFF_DRV_RUNNING flag. Without it,Pyun YongHyeon2013-11-011-3/+3
| | | | | | | | | | | driver would ignore the first link state update if controller already established a link. Reported by: bsam Tested by: bsam Notes: svn path=/head/; revision=257490
* 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
* - Merge from r249476: Ensure that PCI bus BUS_GET_DMA_TAG() method seesMarius Strobl2013-05-301-7/+16
| | | | | | | | | | | | | the actual PCI device which makes the request for DMA tag, instead of some descendant of the PCI device, by creating a pass-through trampoline. - Sprinkle const on tables. - Use NULL instead of 0 for pointers. - Take advantage of nitems(). MFC after: 1 week Notes: svn path=/head/; revision=251133
* - Correct mispellings of the word occurrenceGabor Kovesdan2013-04-171-1/+1
| | | | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> (via private mail) Notes: svn path=/head/; revision=249582
* RX checksum offloading on old Yukon controllers seem to cause morePyun YongHyeon2013-02-271-0/+6
| | | | | | | | | problems. Disable RX checksum offloading on controllers that don't use new descriptor format but give chance to enable it with ifconfig(8). Notes: svn path=/head/; revision=247382
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-041-4/+4
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* For Yukon II controllers that implement optional temperature sensorPyun YongHyeon2012-04-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | and voltage sensor, TWSI is used to get sensor data. msk(4) does not monitor these sensors and interrupt for TWSI completion is disabled by default. However, due to unknown reason, the TWSI completion interrupt fires and it resulted in interrupt storm. To fix it, acknowledges the TWSI completion interrupt if driver see the event. Given that not all Yukon II controllers show the issue it could be a silicon bug which does not honor interrupt masking. Probably the right way to address the issue is disabling automatic TWSI cycle initiation against these sensors. It would be even better to implement reading voltage/temperature from the NIC but it requires access to National LM80 through TWSI and documentation to do that is not available yet(probably will never happen). Reported by: jhb Tested by: jhb MFC after: 2 weeks Notes: svn path=/head/; revision=234666
* ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it againKevin Lo2012-01-071-1/+0
| | | | | | | Reviewed by: yongari Notes: svn path=/head/; revision=229767
* Increase wait time for OP_TCPSTART command processing. It seemsPyun YongHyeon2011-12-191-2/+2
| | | | | | | 100us is not enough to ensure prefetch unit work. Notes: svn path=/head/; revision=228717
* - There's no need to overwrite the default device method with the defaultMarius Strobl2011-11-221-10/+2
| | | | | | | | | | | | | one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID. Notes: svn path=/head/; revision=227843
* Enable 64bit DMA addressing support for all msk(4) controllers.Pyun YongHyeon2011-11-161-52/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | Unnecessarily complex LE format used on Marvell controller was main reason not to enable 64bit DMA addressing in driver. If high 32bit address of DMA address of TX/RX buffer is changed, driver has to generate a new LE. In TX path, driver will keep track of lastly used high 32bit address of DMA address and generate a new LE whenever it sees high address change in the DMA address. In RX path, driver will always use two LEs to specify 64bit DMA address of RX buffer. If the high 32bit address of DMA address of RX buffer is the same as previous DMA address of RX buffer, driver does not have to use two LEs but driver will use two LEs for simplicity in RX ring management. One of draw back for switching to 64bit DMA addressing is that the large amount of LEs are used to specify 64bit DMA address such that number of available LEs for TX/RX buffers are considerably reduced. To mitigate the issue, increase number of available LEs from 256 to 384 for TX and from 256 to 512 for RX. For 32bit architectures, msk(4) does not use 64bit DMA addressing to save resources. Tested by: das Notes: svn path=/head/; revision=227582
* Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.Pyun YongHyeon2011-10-171-1/+1
| | | | | | | | | | | Because driver is accessing a common MII structure in mii_pollstat(), updating user supplied structure should be done before dropping a driver lock. Reported by: Karim (fodillemlinkarimi <> gmail dot com) Notes: svn path=/head/; revision=226478
* Correctly check MAC running status before disabling TX/RX MACs.Pyun YongHyeon2011-05-311-1/+1
| | | | Notes: svn path=/head/; revision=222516
* style(9)Pyun YongHyeon2011-05-241-16/+17
| | | | Notes: svn path=/head/; revision=222269
* When MTU is changed, check whether driver should be reinitialized orPyun YongHyeon2011-05-231-1/+4
| | | | | | | not. If reinitialized is required, clear driver running flag. Notes: svn path=/head/; revision=222231
* Add initial support for Marvell 88E8055/88E8075 Yukon Supreme.Pyun YongHyeon2011-05-231-4/+19
| | | | Notes: svn path=/head/; revision=222230
* Do not touch ASF related register for controllers that do not havePyun YongHyeon2011-05-231-17/+24
| | | | | | | these registers. Also disable Watchdog of ASF microcontroller. Notes: svn path=/head/; revision=222227
* Make sure to enable all clocks before accessing registers.Pyun YongHyeon2011-05-231-31/+23
| | | | | | | | Releasing PHY from power down/COMA is done after enabling all clocks. While I'm here remove unnecessary controller reset. Notes: svn path=/head/; revision=222226
* Do not configure RAM registers for controllers that do not havePyun YongHyeon2011-05-231-2/+8
| | | | | | | | them. These registers are defined only for Yukon XL, Yukon EC and Yukon FE. Notes: svn path=/head/; revision=222223
* Rework store and forward configuration of TX MAC FIFO. Basically itPyun YongHyeon2011-05-231-23/+10
| | | | | | | | enables store and forward mode except for jumbo frame on Yukon Ultra. Notes: svn path=/head/; revision=222221
* Do not blindly clear entire GPHY control register. It seems somePyun YongHyeon2011-05-231-2/+2
| | | | | | | | | | | | | bits of the register is used for other purposes such that clearing these bits resulted in unexpected results such as corrupted RX frames or missing LE status updates. For old controllers like Yukon EC it had no effect but it caused all kind of troubles on Yukon Supreme. This change shall improve stability of controllers like Yukon Ultra, Ultra2, Extreme, Optima and Supreme. Notes: svn path=/head/; revision=222219