summaryrefslogtreecommitdiffstats
path: root/sys/dev/de/if_de.c
Commit message (Collapse)AuthorAgeFilesLines
* Mechanically substitute flags from historic mbuf allocator withglebius2012-12-041-4/+4
| | | | malloc(9) flags in sys/dev.
* More conversions of drivers to use the PCI parent DMA tag.scottl2012-03-121-3/+4
|
* Replace `inline static' by `static inline'.ed2011-12-131-1/+1
| | | | | | If I interpret the C standard correctly, the storage specifier should be placed before the inline keyword. While at it, replace __inline by inline in the files affected.
* Remove extraneous semicolons, no functional changes.mbr2010-01-071-1/+1
| | | | | Submitted by: Marc Balmer <marc@msys.ch> MFC after: 1 week
* Use a private timer to run the statistics timer instead of (ab)usingjhb2009-11-171-18/+12
| | | | | | if_watchdog and if_timer. Tested by: WATANABE Kazuhiro CQG00620 of nifty.ne.jp
* Align Tx/Rx descriptors on 32 bytes boundary instead of PAGE_SIZE.yongari2009-09-241-8/+8
| | | | | | | | | | | | | | | | | | | Also align setup descriptor on 32 bytes boundary. Tx buffer have no alignment limitation so create dmamap without alignment restriction[1]. Rx buffer still seems to require 4 bytes alignment limitation but we can simply use MCLBYTES for size to map the buffer instead of TULIP_DATA_PER_DESC as the buffer is allocated with m_getcl(9). de(4) supports up to TULIP_MAX_TXSEG segments for Tx buffers, increase maximum dma segment size to TULIP_MAX_TXSEG * MCLBYTES. While I'm here remove TULIP_DATA_PER_DESC as it is not used anymore. This should fix de(4) breakage introduced after r176206. Submitted by: jhb [1] Reported by: WATANABE Kazuhiro < CQG00620 <> nifty dot ne dot jp > Tested by: WATANABE Kazuhiro < CQG00620 <> nifty dot ne dot jp >, Takahashi Yoshihiro < nyan <> jp dot freebsd dot org >
* Destroy dmamap in dma cleanup.yongari2009-09-241-0/+1
|
* Consistently use bus_addr_t.yongari2009-09-241-8/+8
|
* Use __NO_STRICT_ALIGNMENT to determine whether de(4) have to applyyongari2009-09-241-2/+2
| | | | | alignment fixup code for received frames on strict alignment architectures.
* 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
* tulip_busdma_cleanup: pass correct vaddr (2nd arg) to bus_dmamem_free()fjoe2009-02-091-1/+1
| | | | | Found with: Coverity Prevent(tm) CID: 1998
* During attach on some de(4) adapters the driver sends out a test packet asjhb2008-04-051-2/+6
| | | | | | | | | | part of detecting the media. Explicitly ensure that we don't send it to bpf(4) as bpf(4) isn't setup yet. This worked by accident before the bpf interface stuff was reworked to avoid other races (bpf_peers_present, etc.) but now it needs an explicit check to avoid a panic. MFC after: 3 days PR: kern/120915
* The maxsegsz of a dma tag created in de(4) is TULIP_DATA_PER_DESC bytes.yongari2007-06-071-1/+1
| | | | | | | | | | In Rx path it allocates a new mbuf with m_getcl(9) so the length of the mbuf is MCLBYTES which is greater than a segment size specified by the dma tag. This segment size mismatch caused a voluntary panic. Fix the panic by settting the mbuf length to TULIP_DATA_PER_DESC. Reported by: Arne H Juul <arnej AT yahoo-inc DOT com> Tested by: Arne H Juul <arnej AT yahoo-inc DOT com>
* o break newbus api: add a new argument of type driver_filter_t topiso2007-02-231-1/+1
| | | | | | | | | | | | | bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@
* - Consistently use if_printf() only in interface methods: if_start(),glebius2006-09-151-32/+30
| | | | | | | | 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>
* Remove various bits of conditional Alpha code and fixup a few comments.jhb2006-05-121-39/+0
|
* Repo copy de driver to dev/de, and adjust.imp2006-02-261-2/+2
|
* Use the copy of the card's MAC address saved in tulip_enaddr() in the softcjhb2005-12-221-3/+12
| | | | | | | if we need a valid MAC address (for probing the media for example) before ether_ifattach() has been called since IF_LLADDR() is NULL then. Tested by: tisco
* Fix the type of "eaddr" to guarantee the required alignment.ru2005-12-011-8/+8
| | | | Suggested by: marcel
* Byte copy IF_LLADDR() on stack to align it to be safe for typecasts.ru2005-11-301-19/+18
| | | | Tested by: jhb
* Various fixes to make de(4) not panic after ru@'s IF_LLADDR() changes:jhb2005-11-211-28/+20
| | | | | | | | | | | | | | | - Don't call tulip_addr_filter() to reset the RX address filter in tulip_reset() since that gets called before ether_ifattach(). Just call it in tulip_init_locked(). - Use be16dec() and le16dec() to parse MAC addresses when programming the RX filter. - Let ether_ioctl() handle SIOCSIFMTU since we were doing the exact same thing with the added bonus that we leaked the driver lock if the MTU was > ETHERMTU in the homerolled version. This part will be MFC'd. Clue from: wpaul (1) Stolen from: marcel (2 via patch for dc(4)) MFC after: 1 week
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-111-9/+9
| | | | | | | | | | 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.
* - Use m_defrag() instead of homerolling our own variantjhb2005-08-261-68/+55
| | | | | | | | | | | | | | | tulip_mbuf_compress(). If we fail to allocate a new mbuf to copy the data into, put the mbuf back in the driver's send queue so that we can retry it later rather than throwing the packet away. - Use m_devget() instead of doing it inline ourselves in the TULIP_COPY_RXDATA case. If we fail to allocate an mbuf to copy the data into, don't forget about the original mbuf cluster. The old code would lose the pointer and leak the cluster in that case. Now it doesn't lose it but always sticks the original rx buffer back into the receive ring after trying to copy the data out and send it up the stack. Also, if we fail to allocate a new mbuf to copy the data into, log an input error. Also, don't combine the priming case with the received-a-packet case to make the code flow a bit clearer and easier to follow.
* - Remove non-bus-dma code.jhb2005-08-251-428/+134
| | | | | | | | - Remove form feed characters. - Fixup style of function declarations. - Assume that an mbuf cluster is big enough to hold an ethernet frame. (This should really be using m_defrag(), but this diff is just simple changes for now.)
* Major rototill of this driver to add FreeBSD bus-dma support:jhb2005-08-251-445/+701
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Allocate arrays of metadata for the descriptors in the rx and tx rings and change the ring pointers to walk the metadata array rather than the actual descriptor rings. Each metadata object contains a pointer to its descriptor, a pointer to any associated mbuf, and a pointer to the associated bus_dmamap_t in the bus_dma case. The mbuf pointers replace the tulip_txq and tulip_rxq local ifqueue's in the softc. - Add lots of KTR trace entries using a local KTR_TULIP level which defaults to 0, but can be changed to KTR_DEV at the top of the file when debugging. - Rename tulip_init(), tulip_start(), tulip_ifinit(), and tulip_ifstart() to tulip_init_locked(), tulip_start_locked(), tulip_init(), and tulip_start(), respectively, to match the convention in other drivers. - Add a TULIP_SP_MAC() macro to encode two bytes of the MAC address into the setup buffer and use that in place of lots of BYTE_ORDER #ifdef's. Also, remove an incorrect XXX comment I added earlier, the driver was correct (at least it does the same thing dc(4) does). TULIP_SP_MAC was shamelessly copied from DC_SP_MAC() in dc(4). - Remove the #ifdef'd NetBSD bus-dma code and replace it with FreeBSD bus-dma code that not only compiles but even works at runtime. - Use callout_init_mtx() instead of just callout_init(). - Correct the various wrapper macros for bus_dmamap_sync() for the rx and tx buffers to only ask for the sync ops that they actually need. - Tidy the #ifdef TULIP_COPY_RXDATA code by expanding an #ifdef a bit so it becomes easier to read at the expense of a couple of duplicated lines of code. Also, use m_getcl() to get an mbuf cluster rather than MGETHDR() followed by MCLGET(). - Maintain the ring free (ri_free) count for the rx ring metadata since we no longer have tulip_rxq.ifq_len around to indicate how many mbuf's are currently in the rx ring. - Add code to teardown bus_dma resources when attach fails and generally fixup attach to do a better job of cleaning up when it fails. This gets us a good bit closer to possibly having a detach method someday and making this driver an unloadable module. - Add some functions that can be called from ddb to dump the state of a descriptor ring and to dump the state of an individual descriptor. - Various comment grammer and spelling fixes. I have bus-dma turned on by default, but I've left the non-bus-dma code around so that it can be turned off to aid in debugging should any problems turn up later on. I'll be removing the non-bus-dma code in a subsequent commit.
* - Use htole32() instead of using bswap32() conditional on #if BYTE_ORDER.jhb2005-08-171-19/+8
| | | | | | | - Don't set IFF_ALLMULTI in our ifnet's if_flags if we end up allowing all multicast due to limits in the MAC receive filters in hardware. Requested by: rwatson (2)
* Call tulip_start() rather than tulip_ifstart() from the interrupt handlerjhb2005-08-091-1/+1
| | | | | | | to avoid recursing on the driver lock. Not sure why my test box didn't catch this earlier. MFC after: 3 days
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-15/+16
| | | | | | | | | | | | | | 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
* - Use callout_*() rather than timeout() to periodically poll the media.jhb2005-07-271-40/+149
| | | | | | | | | - Add locking to protect the softc and mark this driver as MP safe. There are still some edge cases with multiport cards that need more locking work. MFC after: 1 week Tested on: alpha
* - Use the PCIR_BAR() macro rather than hardcoding rids.jhb2005-07-211-8/+4
| | | | | - Use pci_enable_busmaster() rather than fiddling with the PCI command register directly.
* Don't set if_start to tulip_ifstart all over the place. It is alreadyjhb2005-07-211-6/+0
| | | | | | set in tulip_attach() and its value is never changed, so all the extra sets are redundant. I'm guessing that at some point in time de(4) had an alternate start routine, but that hasn't been true in recent history.
* Remove conditional code that has largely rotted that is also not on byjhb2005-07-211-222/+13
| | | | | | | | | default: - TULIP_NEED_FASTTIMEOUT - tulip_fasttimeout() wasn't called anywhere - BIG_PACKET - only worked on i386 anyway - TULIP_USE_SOFTINTR - doesn't compile and was never updated to handle new netisr registration - non-FreeBSD code
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-146/+141
| | | | | | | | | | | | | | | | | | | | 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
* Return BUS_PROBE_DEFAULT instead of 0.imp2005-02-241-1/+1
|
* Hide link up/down/media printfs behind bootverbosephk2004-11-081-1/+2
|
* fix (for me) the problems where if_de gets really slow after timejmg2004-10-181-21/+0
| | | | | | | (usually taking 20 seconds to transmit a packet).. no longer fall back to only transmitting one packet (instead of the entire queue) after we have processed the entire send queue... I have no idea why we didn't start seeing this problem ~6 years ago when this code was introduced...
* Since the if_de driver doesn't contain locking, mark it asrwatson2004-08-131-1/+1
| | | | | IFF_NEEDSGIANT so that ifp->if_start won't be called without Giant when running debug.mpsafenet=1.
* style(9) pass on prototypes.bms2004-07-051-21/+27
|
* Consistently use __inline instead of __inline__ as the former is an empty macrostefanf2004-07-041-1/+1
| | | | in <sys/cdefs.h> for compilers without support for inline.
* Bring in the first chunk of altq driver modifications. This covers themlaier2004-07-021-9/+14
| | | | | | | | | | | following drivers: bfe(4), em(4), fxp(4), lnc(4), tun(4), de(4) rl(4), sis(4) and xl(4) More patches are pending on: http://peoples.freebsd.org/~mlaier/ Please take a look and tell me if "your" driver is missing, so I can fix this. Tested-by: many No-objection: -current, -net
* Replace handrolled CRC calculation with ether_crc32_[lb]e().naddy2004-06-091-23/+2
|
* Add missing <sys/module.h> includesphk2004-05-301-0/+1
|
* Convert callers to the new bus_alloc_resource_any(9) API.njl2004-03-171-6/+4
| | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde
* Announce ethernet MAC addresss in ether_ifattach().mdodd2004-03-141-0/+2
|
* Stop setting ifp->if_output to ether_output() since ether_ifattach()mux2004-03-111-1/+0
| | | | does it for us already.
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-75/+78
| | | | | | | | | | | | | 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)
* 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.
* Use __FBSDID().obrien2003-06-111-4/+4
|
* Move some FALLTHROUGH comments so they work.phk2003-05-311-6/+5
| | | | | | | | Fix indentation error. Make boardid string long enough. Remove unused variable. Found by: FlexeLint
OpenPOWER on IntegriCloud