summaryrefslogtreecommitdiffstats
path: root/sys/dev/ti/if_ti.c
Commit message (Collapse)AuthorAgeFilesLines
* Neither the page lock nor the page queues lock is required to unwire andalc2010-05-031-2/+0
| | | | free a VM_ALLOC_NOOBJ page. (Such pages are unmanaged.)
* - Add a private timer to drive the transmit watchdog instead of usingjhb2009-11-191-21/+22
| | | | | | if_watchdog and if_timer. - Fix some issues in detach for sn(4), ste(4), and ti(4). Primarily this means calling ether_ifdetach() before anything else.
* 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
* Remove some remnant alpha hacks.marius2008-04-261-12/+1
| | | | Approved by: PCI-maintainers (imp, jhb)
* Fix some "in in" typos in comments.brueffer2008-03-261-1/+1
| | | | | | | PR: 121490 Submitted by: Anatoly Borodin <anatoly.borodin@gmail.com> Approved by: rwatson (mentor), jkoshy MFC after: 3 days
* Set the baudrate for if_ti.remko2008-02-191-0/+1
| | | | | | | PR: kern/40516 Submitted by: "Jin Guojun[VFF]" <jin at adsl-63-198-35-122 dot dsl dot snfc21 dot pacbell dot net> Approved by: imp (mentor, implicit for minor changes) MFC After: 1 week
* Give MEXTADD() another argument to make both void pointers to thephk2008-02-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix function prototype for device_shutdown method.yongari2007-11-221-2/+4
|
* Catch up the rest of the drivers with the ether_vlan_mtap modifications.csjp2007-03-041-1/+1
| | | | | | | | | | If these drivers are setting M_VLANTAG because they are stripping the layer 2 802.1Q headers, then they need to be re-inserting them so any bpf(4) peers can properly decode them. It should be noted that this is compiled tested only. MFC after: 3 weeks
* 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@
* Change the remainder of the drivers for DMA'ing devices enabled in themarius2007-01-211-1/+1
| | | | | | | | sparc64 GENERIC and the sound device drivers known working on sparc64 to use bus_get_dma_tag() to obtain the parent DMA tag so we can get rid of the sparc64_root_dma_tag kludge eventually. Except for ath(4), sk(4), stge(4) and ti(4) these changes are runtime tested (unless I booted up the wrong kernels again...).
* Move ethernet VLAN tags from mtags to its own mbuf packet header fieldandre2006-09-171-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-151-46/+47
| | | | | | | | 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>
* Fix invalid reference of mbuf chains.yongari2006-08-121-25/+25
| | | | | | | | | | Use proper pointer dereference to inform modified mbuf chains to caller. While I'm here perform checksum offload setup after loading DMA maps. In collaboration with: glebius
* - Tx side bus_dmamap_load_mbuf_sg(9) support. This reduces bookkeepingyongari2006-01-031-157/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | requiried to keep consistent softc state before/after callback function invocation and supposed to be sligntly faster than previous one as it wouldn't incur callback overhead. With this change callback function was gone. - Decrease TI_MAXTXSEGS to 32 from 128. It seems that most mbuf chain length is less than 32 and it would be re-packed with m_defrag(9) if its chain length is larger than TI_MAXTXSEGS. This would protect ti(4) against possible kernel stack overflow when txsegs[] is put on stack. Alternatively, we can embed the txsegs[] into softc. However, that would waste memory and make Tx/Rx speration hard when we want to sperate Tx/Rx handlers to optimize locking. - Fix dma map tracking used in Tx path. Previously it used the dma map of the last mbuf chain in ti_txeof() which was incorrect as ti(4) used dma map of the first mbuf chain when it loads a mbuf chain with bus_dmamap_load_mbuf(9). Correct the bug by introducing queues that keep track of active/inactive dma maps/mbuf chain. - Use ti_txcnt to check whether driver need to set watchdog timer instead of blidnly clearing the timer in ti_txeof(). - Remove the 3rd arg. of ti_encap(). Since ti(4) now caches the last descriptor index(ti_tx_saved_prodidx) used in Tx there is no need to pass it as a fuction arg. - Change data type of producer/consumer index to int from u_int16_t in order to remove implicit type conversions in Tx/Rx handlers. - Check interface queue before getting a mbuf chain to reduce locking overhead. - Check number of available Tx descriptores to be 16 or higher in ti_start(). This wouldn't protect Tx descriptor shortage but it would reduce number of bus_dmamap_unload(9) calls in ti_encap() when we are about to running out of Tx descriptors. - Command NIC to send packets ony when the driver really has packets enqueued. Previously it always set TI_MB_SENDPROD_IDX which would command NIC to DMA Tx descriptors into NIC local memory regardless of Tx descriptor changes. Reviewed by: scottl
* Cache the tx producer index instead of reading it every time ti_start isscottl2005-12-281-1/+3
| | | | called.
* Fix a serious regression from the busdma conversion. Check to make surescottl2005-12-281-10/+17
| | | | | that we don't overrun the tx descriptor ring before actually trying to overrun it.
* Bring big-endian architecture support for ti(4).yongari2005-12-281-175/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | . remove unnecessay header files after Scott's bus_dma(9) commit. . remove global variable tis which was introduced at the time of zero_copy(9) changes. The variable tis was not used at all. The same applyes to ti_links in softc so axe it. . deregister variables. . axe ti_vhandle and switch to use explicit register access for accessing NIC local memory. Creates three variants of ti_mem to read/write NIC local memory(ti_mem_read, ti_mem_write) and clearing NIC local memory(ti_mem_zero). This greatly enhances code readability and have ti(4) drop using shared memory scheme for Tigon 1. As Tigon 1 switched to use explicit register access for Tx, axe ti_tx_ring_nic/ti_cmd_ring in softc.(Tigon 2 used to host ring scheme which means there is no need to access NIC local memory via register access for Tx and NIC would DMA the modified Tx rings into its local memory.) [1] . introduce new macro TI_EVENT_*/TI_CMD_* to handle NIC envent/command. Instead of using bit fields assginment for accessing the event, use shift operations to set/get it. [1] . add additional check for valid DMA tags in ti_free_dmamaps(). . add missing bus_dmamap_sync/bus_dmamap_unload in ti_free_*_ring_*. . fix locking nits(MTX_RECURSE mutex) and make ti(4) MPSAFE. . change data type of ti_rdata_phys to bus_addr_t and don't blindly cast to uint32_t. . rearrange detach path and make ti(4) survive during device detach. . for Tigon 1, use explicit register access for checking Tx descriptors in ti_encap()/ti_txeof(). [1] . properly call bus_dmamap_sync(9) for updating statistics. . remove extra semicolon in ti_encap() . rewrite loading MAC address to work on strict-alignment architectures. . move TI_RD_OFF macro to if_tireg.h . axe ETHER_ALIGN as it's already defined in <net/ethernet.h>. . make macros immuine from expansion by adding parenthesis and do-while. . remove alpha specific hack as vtophys(9) is no longer used in ti(4) after Scott's bus_dma(9) fix. Reviewed by: scottl Obtained from: OpenBSD [1]
* - Fix VLAN_INPUT_TAG() macro, so that it doesn't touch mtag inglebius2005-12-181-2/+5
| | | | | | | | | 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
* Fix the Tigon I/II driver to support 64-bit DMA. In the process, convert itscottl2005-12-141-86/+321
| | | | | | | | | | | | | | | | | | | | to use busdma. Unlike most of the other drivers, but similar to the if_em driver, pre-allocate the dmamaps at init time instead of allocating them on the fly when descriptors need to be filled. This isn't ideal right now because a map is allocated for every descriptor slot in the tx, rx, mini, and jumbo rings (which is a lot!) in order to simplify the bookkeeping, even though the driver might support filling only a subset of those slots. Luckily, maps are typically NULL on i386 and amd64, so the cost isn't very high. It could be an issue with sparc64, but the driver isn't endian clean either, and that is a much bigger problem to solve first. Note that jumbo frame support is under-tested, and I'm not even sure if it till really works correctly given the evil VM magic that is does. The changes here attempt to preserve the existing semanitcs. Thanks to Martin Nillson for contributing the Netgear card for this work. MFC-After: 3 weeks
* Allocate the jumbo rx frame buffer with busdma.scottl2005-12-101-15/+26
|
* if_ti has been operating with locks for a while, so remove the GIANT markers.scottl2005-12-101-20/+29
| | | | Also fix man potential locking problems in the cdev ioctl handler.
* The if_ti Tigon I/II driver has moved to /sys/dev/tiscottl2005-12-101-3/+3
|
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-111-1/+1
| | | | | | | | | | 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.
* In detach method, move if_free() after bus_teardown_intr().ru2005-10-131-2/+2
|
* Use if_printf() and device_printf().jhb2005-09-291-90/+92
|
* Fix "struct ifnet" leaks when attach() fails in the middle, e.g.ru2005-09-161-2/+2
| | | | | | when mii_phy_probe() or bus_setup_intr() fails. For drivers that call their detach() in this case, call if_free() there to cover this case too.
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-13/+14
| | | | | | | | | | | | | | 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
* Fix ifnet fallout in if_ti.scottl2005-07-071-8/+7
| | | | | Reviewed by: brooks Approved by: re
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-28/+36
| | | | | | | | | | | | | | | | | | | | 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-1/+0
| | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr)
* If resource allocation fails, we could wind up freeing the cdev without itscottl2005-03-311-1/+2
| | | | | | being allocated. Add a simple check for this. Submitted by: yongari
* deal with malloc failure when setting up the multicast filtersam2005-03-261-0/+4
| | | | Noticed by: Coverity Prevent analysis tool
* Start the process of modernizing the Tigon driver by using busdma for thescottl2005-03-211-21/+88
| | | | | descriptor and configuration data. Thanks to Martin Nilsson for providing hardware.
* Fix style(9) issues with __P removal.imp2005-02-241-59/+55
| | | | Noticed by: bde
* Return BUS_PROBE_DEFAULT instead of 0.imp2005-02-241-1/+1
|
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Update the Tigon 1 and 2 driver to use the sf_buf API for implementingalc2004-12-061-15/+23
| | | | | | | | | | | | zero-copy receive of jumbo frames. This eliminates the need for the jumbo frame allocator implemented in kern/uipc_jumbo.c and sys/jumbo.h. Remove it. Note: Zero-copy receive of jumbo frames did not work without these changes; I believe there was insufficient locking on the jumbo vm object. Tested by: ken@ Discussed with: gallatin@
* Tag a last set of PCI network interfaces as IFF_NEEDSGIANT until theyrwatson2004-08-281-1/+2
| | | | are either locked down or demonstrated MPSAFE.
* Whitespace pass.bms2004-07-051-40/+39
|
* style(9):bms2004-07-051-75/+75
| | | | | - Space before bracketized non-void function returns. - Space before condition for conditional blocks.
* Eliminate redundant return keywords.bms2004-07-051-48/+0
|
* Whitespace nitsbms2004-07-051-23/+23
|
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-3/+3
| | | | Bump __FreeBSD_version accordingly.
* Add missing <sys/module.h> includesphk2004-05-301-0/+1
|
* Convert callers to the new bus_alloc_resource_any(9) API.njl2004-03-171-3/+3
| | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde
* Announce ethernet MAC addresss in ether_ifattach().mdodd2004-03-141-6/+0
|
* Stop setting ifp->if_output to ether_output() since ether_ifattach()mux2004-03-111-1/+0
| | | | does it for us already.
* Device megapatch 4/6:phk2004-02-211-0/+2
| | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
OpenPOWER on IntegriCloud