summaryrefslogtreecommitdiffstats
path: root/sys/dev/nfe
Commit message (Collapse)AuthorAgeFilesLines
* Follow up to r225617. In order to maximize the re-usability of kernel codedavide2014-10-161-4/+4
| | | | | | | | in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv(). This fixes a namespace collision with libc symbols. Submitted by: kmacy Tested by: make universe
* Eliminate unnecessary checking for M_EXT on mbufs returned by m_getjcl().rwatson2014-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
* - Remove empty wrappers ether_poll_[de]register_drv(). [1]glebius2014-09-281-2/+2
| | | | | | | - 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]
* - Use if_inc_counter() to increment various counters.glebius2014-09-181-15/+15
| | | | | | | | | - 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.
* It is actually possible to have if_t a typedef to non-void type,glebius2014-08-311-9/+9
| | | | | | | | | | | 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.
* Fix multicast, broken by the conversion of the nfe(4) driver to themarcel2014-08-031-9/+8
| | | | | | driver API. Submitted by: Mikhail <mp@lenta.ru>
* Fixed build with DEVICE_POLLING.pluknet2014-07-021-2/+2
|
* Convert nfe(4) to use the driver API.marcel2014-07-011-174/+190
| | | | Submitted by: Mikhail <mp@lenta.ru>
* Don't bother clearing maps for static DMA allocations to NULL. Instead,jhb2014-06-171-3/+0
| | | | leave them as purely opaque values that are only set by bus_dmamem_alloc().
* Remove some unused variables.brueffer2014-05-161-6/+3
| | | | | Found with: Clang Static Analyzer MFC after: 2 weeks
* Add workaround for MCP61 Ethernet controller found on MSI K9yongari2014-04-091-2/+36
| | | | | | | | | motherboard. PHY hardware used for the controller responded at all possible addresses which in turn resulted in having 32 PHYs for the controller. If driver detects "MSI K9N6PGM2-V2 (MS-7309)" motherboard, tell miibus(4) PHY is located at 0. Tested by: Chris H
* Increase the number of TX DMA segments from 32 to 35. It turnedyongari2014-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
* The r48589 promised to remove implicit inclusion of if_var.h soon. Prepareglebius2013-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.
* Fix clearing MAC stats registers. Previously it cleared everyyongari2013-10-041-2/+2
| | | | | | | fourth register. Submitted by: Paul A. Patience <paul-a.patience@polymtl.ca> Approved by: re (gjb)
* Fix a typo when accounting for tx_broadcast statistics.delphij2013-09-171-1/+1
| | | | | | Submitted by: Paul A. Patience <paul-a patience polymtl ca> MFC after: 2 weeks Approved by: re (hrs)
* Change local variable tso_segsz to tsosegsz to avoid mbuf.h macro conflicts.andre2013-08-241-9/+9
| | | | Sponsored by: The FreeBSD Foundation
* Mechanically substitute flags from historic mbuf allocator withglebius2012-12-041-3/+3
| | | | malloc(9) flags in sys/dev.
* ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it againkevlo2012-01-071-1/+0
| | | | Reviewed by: yongari
* - There's no need to overwrite the default device method with the defaultmarius2011-11-221-5/+1
| | | | | | | | | | 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.
* Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.yongari2011-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)
* If driver is not running, disable interrupts and do not try toyongari2011-05-311-1/+1
| | | | | | | | | process received frames. Previously it was possible to handle RX interrupts even if controller is not fully initialized. This resulted in non-working driver after system is up and running. Reported by: hselasky Tested by: hselasky
* - Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOPmarius2011-05-031-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (reporting IFM_LOOP based on BMCR_LOOP is left in place though as it might provide useful for debugging). For most mii(4) drivers it was unclear whether the PHYs driven by them actually support loopback or not. Moreover, typically loopback mode also needs to be activated on the MAC, which none of the Ethernet drivers using mii(4) implements. Given that loopback media has no real use (and obviously hardly had a chance to actually work) besides for driver development (which just loopback mode should be sufficient for though, i.e one doesn't necessary need support for loopback media) support for it is just dropped as both NetBSD and OpenBSD already did quite some time ago. - Let mii_phy_add_media() also announce the support of IFM_NONE. - Restructure the PHY entry points to use a structure of entry points instead of discrete function pointers, and extend this to include a "reset" entry point. Make sure any PHY-specific reset routine is always used, and provide one for lxtphy(4) which disables MII interrupts (as is done for a few other PHYs we have drivers for). This includes changing NIC drivers which previously just called the generic mii_phy_reset() to now actually call the PHY-specific reset routine, which might be crucial in some cases. While at it, the redundant checks in these NIC drivers for mii->mii_instance not being zero before calling the reset routines were removed because as soon as one PHY driver attaches mii->mii_instance is incremented and we hardly can end up in their media change callbacks etc if no PHY driver has attached as mii_attach() would have failed in that case and not attach a miibus(4) instance. Consequently, NIC drivers now no longer should call mii_phy_reset() directly, so it was removed from EXPORT_SYMS. - Add a mii_phy_dev_attach() as a companion helper to mii_phy_dev_probe(). The purpose of that function is to perform the common steps to attach a PHY driver instance and to hook it up to the miibus(4) instance and to optionally also handle the probing, addition and initialization of the supported media. So all a PHY driver without any special requirements has to do in its bus attach method is to call mii_phy_dev_attach() along with PHY-specific MIIF_* flags, a pointer to its PHY functions and the add_media set to one. All PHY drivers were updated to take advantage of mii_phy_dev_attach() as appropriate. Along with these changes the capability mask was added to the mii_softc structure so PHY drivers taking advantage of mii_phy_dev_attach() but still handling media on their own do not need to fiddle with the MII attach arguments anyway. - Keep track of the PHY offset in the mii_softc structure. This is done for compatibility with NetBSD/OpenBSD. - Keep track of the PHY's OUI, model and revision in the mii_softc structure. Several PHY drivers require this information also after attaching and previously had to wrap their own softc around mii_softc. NetBSD/OpenBSD also keep track of the model and revision on their mii_softc structure. All PHY drivers were updated to take advantage as appropriate. - Convert the mebers of the MII data structure to unsigned where appropriate. This is partly inspired by NetBSD/OpenBSD. - According to IEEE 802.3-2002 the bits actually have to be reversed when mapping an OUI to the MII ID registers. All PHY drivers and miidevs where changed as necessary. Actually this now again allows to largely share miidevs with NetBSD, which fixed this problem already 9 years ago. Consequently miidevs was synced as far as possible. - Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that weren't explicitly converted to support flow control before. It's unclear whether flow control actually works with these but typically it should and their net behavior should be more correct with these changes in place than without if the MAC driver sets MIIF_DOPAUSE. Obtained from: NetBSD (partially) Reviewed by: yongari (earlier version), silence on arch@ and net@
* Do a sweep of the tree replacing calls to pci_find_extcap() with calls tojhb2011-03-231-3/+3
| | | | pci_find_cap() instead.
* Reinitialize driver when MTU is changed and driver is running.yongari2011-01-241-1/+3
| | | | Reported by: Huang, Yusheng ( yusheng.huang <> bluecoat com )
* sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.mdf2011-01-121-1/+1
| | | | Commit the rest of the devices.
* Add a 'locked' variant of the foo_start() routine and call it directlyjhb2011-01-032-19/+12
| | | | | | | | from interrupt handlers and watchdog routines instead of queueing a task to call foo_start(). Reviewed by: yongari MFC after: 1 month
* MCP55 is the only NVIDIA controller that supports VLAN tagyongari2010-11-171-26/+31
| | | | | | | | | | | | | | insertion/stripping and it also supports TSO over VLAN. Implement TSO over VLAN support for MCP55 controller. While I'm here clean up SIOCSIFCAP ioctl handler. Since nfe(4) sets ifp capabilities based on various hardware flags in device attach, there is no need to check hardware flags again in SIOCSIFCAP ioctl handler. Also fix a bug which toggled both TX and RX checksum offloading even if user requested either TX or RX checksum configuration change. Tested by: Rob Farmer ( rfarmer <> predatorlabs dot net )
* Plug memory leakage introduced in r215327.yongari2010-11-151-4/+11
| | | | Submitted by: jkim
* P5N32-SLI PREMIUM from ASUSTeK is known to have MSI/MSI-X issueyongari2010-11-141-0/+43
| | | | | | | | | | | | | | | | | | | | | | such that nfe(4) does not work with MSI-X. When MSI-X support was introduced, I remember MCP55 controller worked without problems so the issue could be either PCI bridge or BIOS issue. But I also noticed snd_hda(4) disabled MSI on all MCP55 chipset so I'm still not sure this is generic issue of MCP55 chipset. If this was PCI bridge issue we would have added it to a system wide black-list table but it's not clear to me at this moment whether it was caused by either broken BIOS or silicon bug of MCP55 chipset. To workaround the issue, maintain a MSI/MSI-X black-list table in driver and lookup base board manufacturer and product name from the table before attempting to use MSI-X. If driver find an matching entry, nfe(4) will not use MSI/MSI-X and fall back on traditional INTx mode. This approach should be the last resort since it relies on smbios and if another instance of MSI/MSI-X breakage is reported with different maker/product, we may have to get the PCI bridge black-listed instead of adding an new entry. PR: kern/152150
* o Flesh out the generic IEEE 802.3 annex 31B full duplex flow controlmarius2010-11-141-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix regression introduced in r215132. Caller always holds a driveryongari2010-11-121-4/+0
| | | | | | lock before accessing mii, so locking is not needed here. Reported by: Rob Farmer (rfarmer <> predatorlabs dot net)
* Add basic WOL support for MCP ethernet controllers. It seems theyongari2010-11-113-56/+175
| | | | | | | | | | | | controller does not perform automatic switching from 1000Mbps link to 10/100Mbps link when WOL is activated. Implement establishing 10/100Mps link with auto-negotiation in driver. Link status change handler was modified to remove taskqueue based approach since driver now needs synchronous handling for link establishment. Submitted by: Yamagi Burmeister (lists <> yamagi.org ) (initial version) Tested by: Yamagi Burmeister (lists <> yamagi.org ) MFC after: 1 week
* Converted the remainder of the NIC drivers to use the mii_attach()marius2010-10-151-4/+4
| | | | | | | introduced in r213878 instead of mii_phy_probe(). Unlike r213893 these are only straight forward conversions though. Reviewed by: yongari
* With r206844, CSUM_TCP is also set for CSUM_TSO case. Modifyyongari2010-04-191-7/+6
| | | | | drivers to take into account for the change. Basically CSUM_TSO should be checked before checking CSUM_TCP.
* Take a step towards removing if_watchdog/if_timer. Don't explicitly setjhb2009-11-061-1/+0
| | | | | if_watchdog/if_timer to NULL/0 when initializing an ifnet. if_alloc() sets those members to NULL/0 already.
* Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/rwatson2009-06-261-2/+2
| | | | | | | | | | | | | IF_ADDR_UNLOCK() across network device drivers when accessing the per-interface multicast address list, if_multiaddrs. This will allow us to change the locking strategy without affecting our driver programming interface or binary interface. For two wireless drivers, remove unnecessary locking, since they don't actually access the multicast address list. Approved by: re (kib) MFC after: 6 weeks
* When user_frac in the polling subsystem is low it is going to busy theattilio2009-05-301-13/+23
| | | | | | | | | | | | | | | | | | | | | CPU for too long period than necessary. Additively, interfaces are kept polled (in the tick) even if no more packets are available. In order to avoid such situations a new generic mechanism can be implemented in proactive way, keeping track of the time spent on any packet and fragmenting the time for any tick, stopping the processing as soon as possible. In order to implement such mechanism, the polling handler needs to change, returning the number of packets processed. While the intended logic is not part of this patch, the polling KPI is broken by this commit, adding an int return value and the new flag IFCAP_POLLING_NOCOUNT (which will signal that the return value is meaningless for the installed handler and checking should be skipped). Bump __FreeBSD_version in order to signal such situation. Reviewed by: emaste Sponsored by: Sandvine Incorporated
* NVIDIA MCP controllers have no Rx buffer alignment restrictions.yongari2009-05-251-1/+1
| | | | | | | | | | Remove PAGE_SIZE alignment used in Rx buffer DMA tag creation. The alignment restriction was used in old local jumbo allocator and nfe(4) switched to UMA backed page allocator for jumbo frame. This change should fix jumbo buffer allocation failure. Reported by: Pascal Braun ( pascal.braun <> continum dot net )
* Fix a typo.yongari2008-12-201-1/+1
| | | | Submitted by: clemens fischer via Shigeaki Tagashira
* Add hardware MAC statistics support. Register information wasyongari2008-10-033-25/+287
| | | | | | | | obtained from Linux forcedeth driver. While I'm here move creating a sysctl node for process_limit to function nfe_sysctl_node(). Tested by: "Arno J. Klaassen" < arno <at> heho dot snv dot jussieu dot fr >
* Add device ids for MCP77/79 and set appropriate support flags.yongari2008-10-012-0/+40
| | | | | Obtained from: OpenBSD PR: kern/127529
* Add support for MCP73 chips.yongari2008-04-102-0/+16
| | | | | Tested by: "Daan Vreeken [PA4DAN]" ( Danovitsch AT vitsch DOT net ) MFC after: 1 week
* Nuke local jumbo allocator and switch to use of UMA backed pageyongari2008-03-063-185/+6
| | | | | | | | allocator for jumbo frame. Also remove unneeded jlist lock which is no longer required to protect jumbo buffers. With these changes jumbo frame performance of nfe(4) was slightly increased and users should not encounter jumbo buffer allocation failure anymore.
* Give MEXTADD() another argument to make both void pointers to thephk2008-02-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | free function controlable, instead of passing the KVA of the buffer storage as the first argument. Fix all conventional users of the API to pass the KVA of the buffer as the first argument, to make this a no-op commit. Likely break the only non-convetional user of the API, after informing the relevant committer. Update the mbuf(9) manual page, which was already out of sync on this point. Bump __FreeBSD_version to 800016 as there is no way to tell how many arguments a CPP macro needs any other way. This paves the way for giving sendfile(9) a way to wait for the passed storage to have been accessed before returning. This does not affect the memory layout or size of mbufs. Parental oversight by: sam and rwatson. No MFC is anticipated.
* - Retire npe_defrag(), gem_defrag(), msk_defrag(), nfe_defrag(), andjhb2008-01-171-89/+1
| | | | | | re_defrag() and use m_collapse() instead. - Replace a reference to ath_defrag() in a comment in if_wpi.c with m_collapse().
* Fix function prototype for device_shutdown method.yongari2007-11-221-2/+4
|
* use the private task q thread instead of the shared system threadsam2007-11-161-6/+5
| | | | | Reviewed by: yongari MFC after: 1 week
* Apparently some NVIDIA NICs store ethernet address in reverse orderyongari2007-11-061-2/+2
| | | | | | | | | | while other variants have inorder ethernet address for the same chipset. Override ethernet address ordering if we already know how it was stored. This fixes the use of inversed ethernet address on MCP67. Submitted by: ariff MFC after: 3 days
* During boot(before setting IP address) PHY can generate link stateyongari2007-09-141-6/+6
| | | | | | | | | | | | change interrupt if the link is established with link parter. However interrupt handler didn't acknowledge the interrupt if nfe(4) was not running at the time of interrupt delivery. This caused endless interrupt generation. Fix the bug by acknowledging the interrupt regardless of running state of the driver. PR: kern/116295 Submitted by: Mark Derbyshire (mark At taom dot com) Approved by: re (kensmith)
* Fix typo.yongari2007-09-141-2/+2
| | | | | Pointed out: marius Approved by: re (bmah)
OpenPOWER on IntegriCloud