aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/msk
Commit message (Collapse)AuthorAgeFilesLines
* 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
* 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
* 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
* Fix undefined behavior: (1 << 31) is not defined as 1 is an int and thisEitan Adler2013-11-301-1/+1
| | | | | | | | | | | | | | | | shifts into the sign bit. Instead use (1U << 31) which gets the expected result. This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD. Discussed with: -arch, rdivacky Reviewed by: cperciva Notes: svn path=/head/; revision=258780
* 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-162-67/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-232-4/+28
| | | | Notes: svn path=/head/; revision=222230
* Do not touch ASF related register for controllers that do not havePyun YongHyeon2011-05-232-17/+25
| | | | | | | 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
* When msk_detach() is called from msk_attach(), ifp may beGleb Smirnoff2011-04-251-1/+2
| | | | | | | yet not initialized. Notes: svn path=/head/; revision=221005
* Do a sweep of the tree replacing calls to pci_find_extcap() with calls toJohn Baldwin2011-03-231-2/+2
| | | | | | | pci_find_cap() instead. Notes: svn path=/head/; revision=219902
* Introduce signed and unsigned version of CTLTYPE_QUAD, renamingMatthew D Fleming2011-01-191-3/+3
| | | | | | | existing uses. Rename sysctl_handle_quad() to sysctl_handle_64(). Notes: svn path=/head/; revision=217616
* Fix a few more SYSCTL_PROC() that were missing a CTLFLAG type specifier.Matthew D Fleming2011-01-191-1/+1
| | | | Notes: svn path=/head/; revision=217566
* Fix endianness bug introduced in r205091.Pyun YongHyeon2010-12-311-1/+1
| | | | | | | | | | | | | | | | After controller updates control word in a RX LE, driver converts it to host byte order. The checksum value in the control word is stored in big endian form by controller. r205091 didn't account for the host byte order conversion such that the checksum value was incorrectly interpreted on big endian architectures which in turn made all TCP/UDP frames dropped. Make RX checksum offload work on any architectures by swapping the checksum value. Reported by: Sreekanth M. ( kanthms <> netlogicmicro dot com ) Tested by: Sreekanth M. ( kanthms <> netlogicmicro dot com ) Notes: svn path=/head/; revision=216860
* o Flesh out the generic IEEE 802.3 annex 31B full duplex flow controlMarius Strobl2010-11-141-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | support in mii(4): - Merge generic flow control advertisement (which can be enabled by passing by MIIF_DOPAUSE to mii_attach(9)) and parsing support from NetBSD into mii_physubr.c and ukphy_subr.c. Unlike as in NetBSD, IFM_FLOW isn't implemented as a global option via the "don't care mask" but instead as a media specific option this. This has the following advantages: o allows flow control advertisement with autonegotiation to be turned on and off via ifconfig(8) with the default typically being off (though MIIF_FORCEPAUSE has been added causing flow control to be always advertised, allowing to easily MFC this changes for drivers that previously used home-grown support for flow control that behaved that way without breaking POLA) o allows to deal with PHY drivers where flow control advertisement with manual selection doesn't work or at least isn't implemented, like it's the case with brgphy(4), e1000phy(4) and ip1000phy(4), by setting MIIF_NOMANPAUSE o the available combinations of media options are readily available from the `ifconfig -m` output - Add IFM_FLOW to IFM_SHARED_OPTION_DESCRIPTIONS and IFM_ETH_RXPAUSE and IFM_ETH_TXPAUSE to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so these are understood by ifconfig(8). o Make the master/slave support in mii(4) actually usable: - Change IFM_ETH_MASTER from being implemented as a global option via the "don't care mask" to a media specific one as it actually is only applicable to IFM_1000_T to date. - Let mii_phy_setmedia() set GTCR_MAN_MS in IFM_1000_T slave mode to actually configure manually selected slave mode (like we also do in the PHY specific implementations). - Add IFM_ETH_MASTER to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so it is understood by ifconfig(8). o Switch bge(4), bce(4), msk(4), nfe(4) and stge(4) along with brgphy(4), e1000phy(4) and ip1000phy(4) to use the generic flow control support instead of home-grown solutions via IFM_FLAGs. This includes changing these PHY drivers and smcphy(4) to no longer unconditionally advertise support for flow control but only if the selected media has IFM_FLOW set (or MIIF_FORCEPAUSE is set) and implemented for these media variants, i.e. typically only for copper. o Switch brgphy(4), ciphy(4), e1000phy(4) and ip1000phy(4) to report and set IFM_1000_T master mode via IFM_ETH_MASTER instead of via IFF_LINK0 and some IFM_FLAGn. o Switch brgphy(4) to add at least the the supported copper media based on the contents of the BMSR via mii_phy_add_media() instead of hardcoding them. The latter approach seems to have developed historically, besides causing unnecessary code duplication it was also undesirable because brgphy_mii_phy_auto() already based the capability advertisement on the contents of the BMSR though. o Let brgphy(4) set IFM_1000_T master mode on all supported PHY and not just BCM5701. Apparently this was a misinterpretation of a workaround in the Linux tg3 driver; BCM5701 seem to require RGPHY_1000CTL_MSE and BRGPHY_1000CTL_MSC to be set when configuring autonegotiation but this doesn't mean we can't set these as well on other PHYs for manual media selection. o Let ukphy_status() report IFM_1000_T master mode via IFM_ETH_MASTER so IFM_1000_T master mode support now is generally available with all PHY drivers. o Don't let e1000phy(4) set master/slave bits for IFM_1000_SX as it's not applicable there. Reviewed by: yongari (plus additional testing) Obtained from: NetBSD (partially), OpenBSD (partially) MFC after: 2 weeks Notes: svn path=/head/; revision=215297
* Fix typos.Rebecca Cran2010-11-091-9/+9
| | | | | | | | PR: bin/148894 Submitted by: olgeni Notes: svn path=/head/; revision=215034
* Convert the PHY drivers to honor the mii_flags passed down and convertMarius Strobl2010-10-151-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). Reviewed by: jhb, yongari Notes: svn path=/head/; revision=213893
* Catch up to rename of the constant for the Master Data Parity Error bit inJohn Baldwin2010-09-091-2/+2
| | | | | | | | | | the PCI status register. Pointed out by: mdf Pointy hat to: jhb Notes: svn path=/head/; revision=212378
* When VLAN hardware tagging is disabled, make sure to disable VLANPyun YongHyeon2010-05-041-1/+2
| | | | | | | | | checksum offloading as well as TSO over VLAN. Reported by: jhb Notes: svn path=/head/; revision=207638
* Make sure to check whether driver is running before processingPyun YongHyeon2010-05-041-9/+6
| | | | | | | | | | | | | | | received frames. Also check driver has valid ifp pointer before calling msk_stop() in device_shutdown handler. While I'm here remove unnecessary accesses to interrupt mask registers in device_shutdown handler because driver puts the controller into reset state. With these changes, msk(4) now survive from heavy RX traffic(1byte UDP frame) while reboot is in progress. Reported by: Mark Atkinson < atkin901 <> gmail dot com > Notes: svn path=/head/; revision=207623
* Drop driver lock before exiting from interrupt handler.Pyun YongHyeon2010-05-041-0/+1
| | | | | | | | Submitted by: jhb MFC after: 3 days Notes: svn path=/head/; revision=207622
* Add basic support for Marvell 88E8059 Yukon Optima.Pyun YongHyeon2010-04-302-3/+23
| | | | | | | | Tested by: James LaLagna < jameslalagna <> gmail dot com > MFC after: 5 days Notes: svn path=/head/; revision=207445
* Disable non-ASF packet flushing on Yukon Extreme as vendor's driverPyun YongHyeon2010-04-302-0/+7
| | | | | | | | | | | | | | | | does. Without this change, Yukon Extreme seems to generate lots of RX FIFO overruns even though controller has available RX buffers. These excessive RX FIFO overruns generated lots of pause frames which in turn killed devices plugged into switch. It seems there is still occasional RX frame corruption on Yukon Extreme but this change seems to fix the pause frame storm. Reported by: jhb Tested by: jhb MFC after: 5 days Notes: svn path=/head/; revision=207442
* Both RX_GMF_LP_THR and RX_GMF_UP_THR must be 16 bits register. IfPyun YongHyeon2010-04-302-4/+4
| | | | | | | | it is 8bits register then RX FIFO size can't exceed 2KB which is not true for almost all Yukon II controller. Notes: svn path=/head/; revision=207409
* With r206844, CSUM_TCP is also set for CSUM_TSO case. ModifyPyun YongHyeon2010-04-191-24/+24
| | | | | | | | drivers to take into account for the change. Basically CSUM_TSO should be checked before checking CSUM_TCP. Notes: svn path=/head/; revision=206876
* Partial revert r204545.Pyun YongHyeon2010-04-071-1/+4
| | | | | | | | | | | | | | | Just relying on status LE ownership of status block seems to cause poor performance. Always read current status index register first and then check status ownership as we had before. Accessing status index register seems to trigger immediate status update if controller have pending status updates. MFC after: 1 week Reported by: Andre Albsmeier <Andre.Albsmeier <> siemens dot com> Tested by: Andre Albsmeier <Andre.Albsmeier <> siemens dot com> Notes: svn path=/head/; revision=206364
* It seems PCI_OUR_REG_[1-5] registers are not mapped on PCIPyun YongHyeon2010-03-141-10/+10
| | | | | | | | | | | | | | | configuration space on Yukon Ultra(88E8056) such that accesses to these registers were NOPs which in turn make msk(4) instable on this controller. Use indirect access method to access PCI_OUR_REG_[1-5] registers. This should fix a long standing instability bug which prevented msk(4) working on Yukon Ultra. Special thanks to koitsu who gave me remote access to his system. PR: kern/114631, kern/116853 MFC after: 1 week Notes: svn path=/head/; revision=205161
* Implement Rx checksum offloading for Yukon EC, Yukon Ultra,Pyun YongHyeon2010-03-122-47/+204
| | | | | | | | | | | | | | | | | | | | | | | Yukon FE and Yukon Ultra2. These controllers provide very simple checksum computation mechanism and it requires additional pseudo header checksum computation in upper stack. Even though I couldn't see much performance difference with/without Rx checksum offloading it may help notebook based controllers. Actually controller can compute two checksum value by giving different starting position of checksum computation on received frame. However, for long time, Marvell's checksum offloading engine have been known to have several silicon bugs so don't blindly trust computed partial checksum value. Instead, compute partial checksum twice by giving the same checksum computation position and compare the result. If the value is different it's clear indication of hardware bug. This configuration lose IP checksum offloading capability but I think it's better to take safe route. Note, Rx checksum offloading for Yukon XL was still disabled due to known silicon bug. Notes: svn path=/head/; revision=205091
* Remove taskqueue based interrupt handling. After r204541 msk(4)Pyun YongHyeon2010-03-022-155/+26
| | | | | | | | | | | | | does not generate excessive interrupts any more so we don't need to have two copies of interrupt handler. While I'm here remove two STAT_PUT_IDX register accesses in LE status event handler. After r204539 msk(4) always sync status LEs so there is no need to resort to reading STAT_PUT_IDX register to know the end of status LE processing. Just trust status LE's ownership bit. Notes: svn path=/head/; revision=204545
* Implement rudimentary interrupt moderation with programmablePyun YongHyeon2010-03-012-20/+23
| | | | | | | | | | | | | | | | | | | | countdown timer register. The timer resolution may vary among controllers but the value would be represented by core clock cycles. msk(4) will automatically computes number of required clock cycles from given micro-seconds unit. The default interrupt holdoff timer value is 100us which will ensure less than 10k interrupts under load. The timer value can be changed with dev.mskc.0.int_holdoff sysctl node. Note, the interrupt moderation is shared resource on dual-port controllers so you can't use separate interrupt moderation value for each port. This means we can't stop interrupt moderation in driver stop routine. Also have msk_tick() reclaim transmitted Tx buffers as safety belt. With this change there is no need to check missing Tx completion interrupt in watchdog handler, so remove it. Notes: svn path=/head/; revision=204541
* Make sure to enable flow-control only if established link isPyun YongHyeon2010-03-011-14/+11
| | | | | | | | | | | full-duplex. Previously msk(4) used to allow flow-control on 1000baseT half-duplex media. Also GMAC pause is enabled if link partner is capable of handling it. While I'm here use IFM_OPTIONS instead of using IFM_GMASK to check optional flags of link. Notes: svn path=/head/; revision=204540