summaryrefslogtreecommitdiffstats
path: root/sys/dev/nge
Commit message (Collapse)AuthorAgeFilesLines
* Move ethernet VLAN tags from mtags to its own mbuf packet header fieldandre2006-09-171-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | m_pkthdr.ether_vlan. The presence of the M_VLANTAG flag on the mbuf signifies the presence and validity of its content. Drivers that support hardware VLAN tag stripping fill in the received VLAN tag (containing both vlan and priority information) into the ether_vtag mbuf packet header field: m->m_pkthdr.ether_vtag = vlan_id; /* ntohs()? */ m->m_flags |= M_VLANTAG; to mark the packet m with the specified VLAN tag. On output the driver should check the mbuf for the M_VLANTAG flag to see if a VLAN tag is present and valid: if (m->m_flags & M_VLANTAG) { ... = m->m_pkthdr.ether_vtag; /* htons()? */ ... pass tag to hardware ... } VLAN tags are stored in host byte order. Byte swapping may be necessary. (Note: This driver conversion was mechanic and did not add or remove any byte swapping in the drivers.) Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition. No more tag memory allocation have to be done. Reviewed by: thompsa, yar Sponsored by: TCP/IP Optimization Fundraise 2005
* - Consistently use if_printf() only in interface methods: if_start(),glebius2006-09-152-5/+7
| | | | | | | | if_watchdog, etc., or in functions used only in these methods. In all other functions in the driver use device_printf(). - Use __func__ instead of typing function name. Submitted by: Alex Lyashkov <umka sevcity.net>
* Since DELAY() was moved, most <machine/clock.h> #includes have beenphk2006-05-161-1/+0
| | | | unnecessary.
* Remove various bits of conditional Alpha code and fixup a few comments.jhb2006-05-121-5/+0
|
* Do not touch ifp->if_baudrate in miibus aware drivers.glebius2006-02-141-1/+0
|
* - Fix VLAN_INPUT_TAG() macro, so that it doesn't touch mtag inglebius2005-12-181-1/+3
| | | | | | | | | case if memory allocation failed. - Remove fourth argument from VLAN_INPUT_TAG(), that was used incorrectly in almost all drivers. Indicate failure with mbuf value of NULL. In collaboration with: yongari, ru, sam
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-111-3/+3
| | | | | | | | | | rather than in ifindex_table[]; all (except one) accesses are through ifp anyway. IF_LLADDR() works faster, and all (except one) ifaddr_byindex() users were converted to use ifp->if_addr. - Stop storing a (pointer to) Ethernet address in "struct arpcom", and drop the IFP2ENADDR() macro; all users have been converted to use IF_LLADDR() instead.
* Replace FreeBSD 3.x syntax (controller miibus0) with 4.x syntaximp2005-10-221-1/+1
| | | | (device miibus) in time for 7.0 :-)
* Minor tweaks and fixups:jhb2005-10-132-69/+61
| | | | | | | | | | | | | | | - Use device_printf() and if_printf() and remove nge_unit. - Use callout_init_mtx() and remove nge_tick_locked() as nge_tick() is now always called with the driver lock held. - Use M_ZERO to contigmalloc() when allocating nge_ldata. It was possible for the random garbage to be used in certain cases otherwise. - Cleanup attach error handling including no longer leaking nge_ldata. - Add locking to the ifmedia callouts. - Lock accesses to if_hwassist and if_capenable in nge_ioctl(). Submitted by: Yuriy N. Shkandybin jura at networks dot ru (1, 3, 4) Tested by: Yuriy N. Shkandybin jura at networks dot ru MFC after: 3 days
* - Don't pollute opt_global.h with DEVICE_POLLING and introduceglebius2005-10-051-0/+4
| | | | | | | | | opt_device_polling.h - Include opt_device_polling.h into appropriate files. - Embrace with HAVE_KERNEL_OPTION_HEADERS the include in the files that can be compiled as loadable modules. Reviewed by: bde
* Big polling(4) cleanup.glebius2005-10-011-25/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Axe poll in trap. o Axe IFF_POLLING flag from if_flags. o Rework revision 1.21 (Giant removal), in such a way that poll_mtx is not dropped during call to polling handler. This fixes problem with idle polling. o Make registration and deregistration from polling in a functional way, insted of next tick/interrupt. o Obsolete kern.polling.enable. Polling is turned on/off with ifconfig. Detailed kern_poll.c changes: - Remove polling handler flags, introduced in 1.21. The are not needed now. - Forget and do not check if_flags, if_capenable and if_drv_flags. - Call all registered polling handlers unconditionally. - Do not drop poll_mtx, when entering polling handlers. - In ether_poll() NET_LOCK_GIANT prior to locking poll_mtx. - In netisr_poll() axe the block, where polling code asks drivers to unregister. - In netisr_poll() and ether_poll() do polling always, if any handlers are present. - In ether_poll_[de]register() remove a lot of error hiding code. Assert that arguments are correct, instead. - In ether_poll_[de]register() use standard return values in case of error or success. - Introduce poll_switch() that is a sysctl handler for kern.polling.enable. poll_switch() goes through interface list and enabled/disables polling. A message that kern.polling.enable is deprecated is printed. Detailed driver changes: - On attach driver announces IFCAP_POLLING in if_capabilities, but not in if_capenable. - On detach driver calls ether_poll_deregister() if polling is enabled. - In polling handler driver obtains its lock and checks IFF_DRV_RUNNING flag. If there is no, then unlocks and returns. - In ioctl handler driver checks for IFCAP_POLLING flag requested to be set or cleared. Driver first calls ether_poll_[de]register(), then obtains driver lock and [dis/en]ables interrupts. - In interrupt handler driver checks IFCAP_POLLING flag in if_capenable. If present, then returns.This is important to protect from spurious interrupts. Reviewed by: ru, sam, jhb
* Make sure that we call if_free(ifp) after bus_teardown_intr. Since weimp2005-09-191-1/+1
| | | | | | | could get an interrupt after we free the ifp, and the interrupt handler depended on the ifp being still alive, this could, in theory, cause a crash. Eliminate this possibility by moving the if_free to after the bus_teardown_intr() call.
* Add two missing if_free() calls.ru2005-09-151-0/+3
|
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-13/+13
| | | | | | | | | | | | | | IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days
* Modify device drivers supporting multicast addresses to lock if_addr_mtxrwatson2005-08-031-0/+2
| | | | | | | | over iteration of their multicast address lists when synchronizing the hardware address filter with the network stack-maintained list. Problem reported by: Ed Maste (emaste at phaedrus dot sandvine dot ca> MFC after: 1 week
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-102-16/+24
| | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386nyan2005-05-291-2/+0
| | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr)
* fix null ptr deref when nge_newbuf is called with an existing mbufsam2005-03-281-8/+6
| | | | Noticed by: Coverity Prevent analysis tool
* deref correct mbuf ptr to collect any vlan tagsam2005-03-261-1/+1
| | | | Noticed by: Coverity Prevent analysis tool
* Use BUS_PROBE_DEFAULT for pci probe return valueimp2005-03-051-1/+1
|
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-062-2/+2
|
* Hide link up/down/media printfs behind bootverbosephk2004-11-081-3/+4
|
* Fix a typo that affects !i386.alc2004-09-152-2/+2
|
* Add missing NGE_LOCK_DESTROY() to nge_detach().wpaul2004-09-141-0/+2
|
* Make two major changes to this code to address some stability/corruptionwpaul2004-09-142-300/+239
| | | | | | | | | | | | | | | | | | | problems: 1) Add locking for SMP, code provided by Alan Cox 2) While testing Alan's patches, I observed serious problems with the jumbo buffer allocation code (machine crashed twice), so I gutted it and rewrote the receive handler to use multiple chained descriptors. Each RX descriptor gets a single 2K cluster, and the chip will fill in as many as it needs to hold the complete packet. User reports that this corrects the data corruption issues previously observed and discussed on -current. Note that this driver still needs to be hit with the busdma stick. I intend to inflict said beating in the near future. MFC after: 1 week
* Since if_nge doesn't contain locking or run with INTR_MPSAFE, markrwatson2004-08-131-1/+2
| | | | | | | the interface as IFF_NEEDSGIANT so if_start is run holding Giant. Note: this driver does declare and occasionally reference mutexes, but I believe not nearly enough to provide safety.
* Remove the setting of the pci config variables on power state changes.imp2004-06-281-24/+0
| | | | The bus does this now.
* Replace handrolled CRC calculation with ether_crc32_[lb]e().naddy2004-06-091-29/+2
|
* Add missing <sys/module.h> includesphk2004-05-301-0/+1
|
* A handler for ioctl(SIOCSIFCAP) should not alter a bit inyar2004-05-231-1/+2
| | | | | | | if_capenable unless the interface driver is actually able to toggle the respective capability on and off. Reviewed by: ru
* According to the design of checksum offloading framework,yar2004-05-231-2/+5
| | | | | if_hwassist should be in accord with the IFCAP_TXCSUM bit of if_capenable.
* We don't need to initialize if_output, ether_ifattach() does itmux2004-05-231-1/+0
| | | | for us.
* Implemented per-interface polling(4) control.ru2004-04-111-1/+12
|
* Fixed resetting of the watchdog timer and queue full flag.ru2004-04-111-7/+4
|
* Compare IFF_POLLING flag with ifp->if_flags rather than ifp->if_ipending,rwatson2004-04-111-3/+3
| | | | | | | which was almost certainly a bug since polling support was introduced in this driver. Found during discussion with: mlaier
* The VLAN TCI field should be operated in network byte order.ru2004-03-301-2/+2
| | | | | | | This fixes the VLAN support for nge(4). Reported by: Jacob S. Barrett MFC after: 3 days
* Convert callers to the new bus_alloc_resource_any(9) API.njl2004-03-171-3/+2
| | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde
* Announce ethernet MAC addresss in ether_ifattach().mdodd2004-03-141-5/+0
|
* Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.obrien2003-12-081-5/+5
| | | | Requested by: bde,imp
* Remove duplicate FBSDID's, move others to their right place.obrien2003-11-141-3/+0
|
* Try to create some sort of consistency in how the routings to find theobrien2003-11-131-13/+10
| | | | | | | multicast hash are written. There are still two distinct algorithms used, and there actually isn't any reason each driver should have its own copy of this function as they could all share one copy of it (if it grew an additional argument).
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-2/+1
| | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
* Use __FBSDID().obrien2003-08-241-0/+3
| | | | Also some minor style cleanups.
* Prefer new location of pci include files (which have only been in theimp2003-08-221-2/+2
| | | | | tree for two or more years now), except in a few places where there's code to be compatible with older versions of FreeBSD.
* All current uses of pci_set_powerstate are bogus, at least in theory.imp2003-07-031-2/+2
| | | | | | | | | | However, they are presently necessary due to bigger bogusness in the pci bus layer not doing the right thing on suspend/resume or on initial device probe. This is exactly the sort of thing that the BURN_BRIDGES option was invented for. Mark all of them as BURN_BRIDGES. As soon as I have the powerstate stuff properly integrated into the pci bus code, I intend to remove all these workarounds.
* - Don't call pci_enable_io() in drivers (unless needed for resume).mdodd2003-04-161-18/+0
| | | | | - Don't test memory/port status and emit an error message; the PCI bus code will do this now.
* - Express hard dependencies on bus (pci, isa, pccard) andmdodd2003-04-151-1/+3
| | | | | | | | network layer (ether). - Don't abuse module names to facilitate ifconfig module loading; such abuse isn't really needed. (And if we do need type information associated with a module then we should make it explicit and not use hacks.)
* Use __FBSDID rather than rcsid[].obrien2003-04-031-7/+3
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
OpenPOWER on IntegriCloud