aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bfe
Commit message (Collapse)AuthorAgeFilesLines
* Add a new sysctl node 'dev.bfe.N.stats' that shows various MACPyun YongHyeon2008-08-222-52/+299
| | | | | | | | | | | counters for Rx/Tx statistics. Various counters in ifnet is also updated with these hardware counters. Tested by: kib, Gleb Kurtsou gleb.kurtsou at gmail dot com Ulrich Spoerlein uspoerlein at gmail dot com Notes: svn path=/head/; revision=181994
* Because bfe(4) knows interrupt mask value there is no need to readPyun YongHyeon2008-08-221-6/+4
| | | | | | | | | | | | interrupt mask register again. This saves one register access per each interrupt. Also don't try to process frames when driver is not running. Tested by: kib, Gleb Kurtsou gleb.kurtsou at gmail dot com Ulrich Spoerlein uspoerlein at gmail dot com Notes: svn path=/head/; revision=181992
* Remove bfe_link in softc and introduce two new flags to markPyun YongHyeon2008-08-222-12/+21
| | | | | | | | | | | | link state and detach request. While I'm here make sure established link is IFM_10_T or IFM_100_TX as bfe(4) just supports 10/100Mbps media. Tested by: kib, Gleb Kurtsou gleb.kurtsou at gmail dot com Ulrich Spoerlein uspoerlein at gmail dot com Notes: svn path=/head/; revision=181976
* o Sort includes and add <endian.h> to support endianness.Pyun YongHyeon2008-08-212-367/+491
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Removed unneeded header files. o bus_dma(9) fix: - created parent tag with 1GB dma address limit with no alignment restrictions. - set 4096 alignment limit for Tx/Rx descriptor rings. - separate Rx buffer tag from Tx buffer tag such that Tx tag allows up-to 16 segments while Rx buffer tag only allows single segment. - it seems the controller has no alignment restrictions on Tx/Rx buffers. Remove ETHER_ALIGN alignment restriction in Tx/Rx buffers. - created a spare Rx dma map which would be used to cope with failure of loading a dma map. - make sure to load full Tx/Rx descriptor size for Tx/Rx descriptor dma maps, previously bfe(4) used to load single descriptor size for each descriptor rings. I have no idea how it could be run without problems. - don't blindly cast bus_addr_t type to 32bits in bfe_dma_map(). - created bfe_dma_free() to free allocated dma memory/tags. - make sure to invoke bus_dmamap_sync(9) before/after processing descriptor rings/buffers. Because the hardware has severe dma address space limitation, bounce-buffers would be always used on systems with more than 1GB memory during descriptors/buffers access. - added Tx descriptor ring initialization function, bfe_list_tx_init(). - moved producer/consumer index initialization to bfe_list_tx_init() and bfe_list_rx_init() from bfe_chip_reset(). - added bfe_discard_buf() which will update loaded descriptors without unloading/reloading the dma map to speed up error recovery. - implemented Tx side bus_dmamap_load_mbuf_sg(9). The number of segments allowed was chosen to be 16 which should be enough for non-TSO capable hardwares. Setting SOF bit of Tx descriptor is done in the last to avoid potential race. - don't give up sending frames in bfe_start() until the hardware lacks free descriptors. - added XXX comment to second kick command and possible workaround. - implemented Rx side bus_dmamap_load_mbuf_sg(9). - removed bfe_dma_map_desc() as it's not needed anymore after the conversion to bus_dmamap_load_mbuf_sg(9). - added endianness support. With this change bfe(4) should work on any architectures that can create bounce buffers within 1GB address range. - add missing bus_dmamap_sync() in bfe_tx_eof()/bfe_rx_eof(). o Use PCI_BAR instead of hardcoded value to set BARs. Simplified register access with bus_write_4(9)/bus_read_4(9) and removed bfe_btag, bfe_bhandle, bfe_vhandle in softc as it's not used anymore. o Reorder device detach logic such that bfe_detach() is also used for handling driver attach failure case. o Remove unnecessary KASSERT in bfe_detach(). o Remove bfe_rx_cnt, bfe_up, bfe_vpd_prodname, bfe_vpd_readonly in softc. It's not used at all. o Remove BFE_RX_RING_SIZE/BFE_RX_RING_SIZE/BFE_LINK_DOWN. Tested by: kib, Gleb Kurtsou gleb.kurtsou at gmail dot com Ulrich Spoerlein uspoerlein at gmail dot com Notes: svn path=/head/; revision=181953
* Use device_set_desc() instead of device_set_desc_copy() as we don'tPyun YongHyeon2008-08-111-1/+1
| | | | | | | manipulate the verbose description of a device. Notes: svn path=/head/; revision=181557
* Partial back out r180952.Pyun YongHyeon2008-08-111-4/+2
| | | | | | | | | pci_get_vendor() and pci_get_device() don't do configuration space accessses so cahcing them makes no sense. Pointed out by: jhb, imp, des Notes: svn path=/head/; revision=181556
* style(9) - space after keywords, don't indent case.Pyun YongHyeon2008-07-291-64/+63
| | | | Notes: svn path=/head/; revision=180954
* Cache PCI vendor/device ids to avoid unnecessary PCI configurationPyun YongHyeon2008-07-291-7/+4
| | | | | | | | space access in device probe. Also nuke referencing softc in device probe. Notes: svn path=/head/; revision=180952
* s/printf/device_printf/gPyun YongHyeon2008-07-292-23/+19
| | | | | | | | Don't hard code function name in device_printf() and use __func__. While I'm here nuke bfe_unit in softc as it's not needed anymore. Notes: svn path=/head/; revision=180950
* Don't panic even if bus_dmamap_load(9) was failed. Just returnPyun YongHyeon2008-04-301-3/+11
| | | | | | | | | | ENOBUFS so callers can reuse previous mbuf. Submitted by: Oleg (agile.quad AT gmail DOT com) MFC after: 1 week Notes: svn path=/head/; revision=178687
* Fix link state handling in bfe(4).Pyun YongHyeon2008-01-292-48/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | o conversion to callout(9) API. o add a missing driver lock in bfe_ifmedia_sts(). o use our callout to drive watchdog timer. o restart Tx routine if pending queued packets are present in watchdog handler. o unarm watchdog timer only if there are no queued packets. o don't blindly reset phy and let phy driver handle link change request in bfe_init_locked(). o return the status of mii_mediachg() to caller in bfe_ifmedia_upd(). Previously it always returned 0 to caller. o add check for IFF_DRV_RUNNING flag as well as IFF_DRV_OACTIVE in bfe_start_locked(). o implement miibus_statchg method that keeps track of current link state changes as well as negotiated speed/duplex/ flow-control configuration. Reprogram MAC to appropriate duplex state. Flow-control configuration was also implemented but commented out at the moment. The flow-control configuration will be enabled again after we have general flow-control framework in mii layer. Reported by: Yousif Hassan < yousif () alumni ! jmu ! edu > Tesdted by: Yousif Hassan < yousif () alumni ! jmu ! edu > Notes: svn path=/head/; revision=175787
* Fix function prototype for device_shutdown method.Pyun YongHyeon2007-11-221-3/+4
| | | | Notes: svn path=/head/; revision=173839
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-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@ Notes: svn path=/head/; revision=166901
* Add suspend/resume support. Unlike many other NIC drivers,John Baldwin2006-11-201-0/+38
| | | | | | | | | | | bfe_init_locked() wasn't sufficient to bring the chip back to life, it also required a call to bfe_chip_reset() during resume. Tested by: Stepan Zastupov +redchrom at gmail+ MFC after: 1 week Notes: svn path=/head/; revision=164456
* Back out the BUS_DMA_ALLOCNOW change from rev 1.39. Scottl informed me thatMike Silbersack2006-05-281-3/+3
| | | | | | | it's unnecessary, as the TX/RX lists are static allocations. Notes: svn path=/head/; revision=159021
* Re-revert back to rev 1.8:Mike Silbersack2006-05-281-2/+2
| | | | | | | | | | - Reduce the number of RX and TX buffers bfe uses so that it does not use more bounce buffers than busdma is willing to allow it to use See if_bfe.c for comments on why this is now safe to do. Notes: svn path=/head/; revision=159015
* 1. Make sure that the TX and RX descriptor rings are 4096 byte aligned.Mike Silbersack2006-05-281-6/+21
| | | | | | | | | | | | | | | | | | | | | Also use BUS_DMA_ALLOCNOW to be on the safe side. 2. Look for the Descriptor Error, and Descriptor Protocol Error flags from the card, and down the interface if we detect either. #1 (along with fixes to busdma) makes sure that this card works in all memory situations. Prior to this change, it was just luck that 512 count RX/TX lists were properly aligned. Now we can use any size of RX/TX lists and still have them properly aligned. #2 ensures that we don't get into an endless interrupt storm if busdma fails us. Descriptor Protocol Error would occur if we misaligned the TX/RX rings, and Descriptor Error would occur if we tried to give the card descriptors or rings with addresses > 1G. Trying to reinitialize the card isn't going to fix these errors, hence we don't try. Notes: svn path=/head/; revision=159013
* Since DELAY() was moved, most <machine/clock.h> #includes have beenPoul-Henning Kamp2006-05-161-1/+0
| | | | | | | unnecessary. Notes: svn path=/head/; revision=158651
* Revert if_bfereg.h rev 1.8; restore the RX and TX list sizes to 511.Mike Silbersack2006-05-111-2/+2
| | | | | | | Two users have reported problems due to the smaller list sizes. Notes: svn path=/head/; revision=158447
* Fix three more bugs in bfe:Mike Silbersack2006-05-042-17/+22
| | | | | | | | | | | | | | | | | - Fix bfe_encap so that it will pass the address of the mbuf back up to its caller if/when it modifies it, as it does when doing a m_defrag on a mbuf chain. - Make sure to unload the dmamap for ALL fragments of a packet, not just the first - Use BUS_DMA_NOWAIT for all bus_dmamap_load calls so that the allocation of the map is not delayed - this driver is not set up to handle such delays. - Reduce the number of RX and TX buffers bfe uses so that it does not use more bounce buffers than busdma is willing to allow it to use With these changes, the driver now works properly for a user with a 2GB system, and it also works on my system when the acceptable address range is lowered to 128MB. Previously, both of these setups would act up after a few minutes of activity. Notes: svn path=/head/; revision=158285
* Tweak the DMA limit from rev 1.33, it was off by one byte.Mike Silbersack2006-04-281-1/+1
| | | | | | | Submitted by: scottl Notes: svn path=/head/; revision=158103
* Switch all bus_dmamap_sync calls that used PREREAD to PREWRITE and allMike Silbersack2006-04-281-10/+10
| | | | | | | | | | | POSTWRITE to POSTREAD. No guarantee that all busdma is usage is perfect, but this change (in addition to scott's last two commits) makes if_bfe work with > 1GB of memory in my laptop. Notes: svn path=/head/; revision=158102
* The alignment parameter to busdma must be a power of two, while the if_bfeScott Long2006-04-271-2/+2
| | | | | | | | driver was trying to use an arbitrary rx/tx ring size of the value. Change to using unrestricted values for alignment and boundary instead. Notes: svn path=/head/; revision=158093
* Fix problem with having more than 1GM of RAM. Also fix a nearby busdmaScott Long2006-04-271-5/+8
| | | | | | | | | problem. Submitted by: silby Notes: svn path=/head/; revision=158075
* Don't call bfe_release_resources() twice.Pawel Jakub Dawidek2006-04-041-2/+0
| | | | | | | | | Found by: Coverity Prevent analysis tool CID: 600 MFC after: 1 week Notes: svn path=/head/; revision=157518
* Do not touch ifp->if_baudrate in miibus aware drivers.Gleb Smirnoff2006-02-141-1/+0
| | | | Notes: svn path=/head/; revision=155671
* - Store pointer to the link-level address right in "struct ifnet"Ruslan Ermilov2005-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. Notes: svn path=/head/; revision=152315
* Replace FreeBSD 3.x syntax (controller miibus0) with 4.x syntaxWarner Losh2005-10-221-1/+1
| | | | | | | (device miibus) in time for 7.0 :-) Notes: svn path=/head/; revision=151545
* Fix "struct ifnet" leaks when attach() fails in the middle.Ruslan Ermilov2005-09-161-5/+4
| | | | Notes: svn path=/head/; revision=150215
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andRobert Watson2005-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 Notes: svn path=/head/; revision=148887
* Modify device drivers supporting multicast addresses to lock if_addr_mtxRobert Watson2005-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 Notes: svn path=/head/; revision=148654
* Stop embedding struct ifnet at the top of driver softcs. Instead theBrooks Davis2005-06-102-19/+29
| | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=147256
* Powerstate stuff now done in PCI bus driverWarner Losh2005-06-051-21/+0
| | | | Notes: svn path=/head/; revision=147028
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386Yoshihiro Takahashi2005-05-291-1/+0
| | | | | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr) Notes: svn path=/head/; revision=146734
* Releasing TX/RX descriptor dmamaps during device detachment instead ofTai-hwa Liang2005-03-171-5/+4
| | | | | | | | | | | | | | | | | | | doing that in bfe_stop(). This should fix a panic recently reported on -current occuring when taking device down then up. In the original implementation, an "ifconfig bfe0 down" triggers bfe_stop(), which also destroys all TX/RX descriptor dmamaps. Hence the subsequent "ifconfig bfe0 up" would force the device to use those already-released dmamap and thus panic the kernel. PR: kern/77804 Submitted by: Frank Mayhar <frank at exit dot com> Reviewed by: dmlb, sam (mentor) Tested by: Phil <pcasidy at casidy dot com>, myself MFC after: 1 week Notes: svn path=/head/; revision=143750
* Use BUS_PROBE_DEFAULT for pci probe return valueWarner Losh2005-03-051-1/+1
| | | | Notes: svn path=/head/; revision=143163
* correct direction for bus_dma sync of rx bufferSam Leffler2005-01-091-1/+1
| | | | | | | Submitted by: Tai-hwa Liang Notes: svn path=/head/; revision=139944
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-062-6/+5
| | | | Notes: svn path=/head/; revision=139749
* Locking cleanups to remove the need for a recursive mutexMike Makonnen2004-10-232-60/+49
| | | | | | | | | | | | | | | | | | | | | | o Instead of locking and unlocking all over the place, use lock assertions to make certain that the bfe lock is held where necessary. o Create locked and unlocked versions of bfe_init and bfe_start. These functions can be called from outside the module and by functions within the bfe module. The calls from outside the module don't hold the bfe lock so the unlocked versions called by these functions simple obtain the bfe lock and call the locked version. - Fix a typo (scp) in the locking macros that only worked because in all the instances in which it was called the softc pointer happened to be named 'sc'. - Mark the interrupt MPSAFE Tested by: matusita, Dario Freni <saturnero@gufi.org> Silence from: -net, wpaul Notes: svn path=/head/; revision=136804
* Fix sis, bfe and ndis in the same way dc was fixed:Max Laier2004-10-081-9/+14
| | | | | | | | | | Do not tell the hardware to send when there were no packets enqueued. Found and reviewed by: green MFC after: 1 days Notes: svn path=/head/; revision=136269
* Add PCI ID for the BCM4401-B0.Dag-Erling Smørgrav2004-09-012-0/+3
| | | | | | | | Submitted by: krion MFC after: 3 days Notes: svn path=/head/; revision=134590
* The whitespace crusader strikes!Dag-Erling Smørgrav2004-08-072-95/+95
| | | | Notes: svn path=/head/; revision=133282
* Bring in the first chunk of altq driver modifications. This covers theMax Laier2004-07-021-4/+6
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=131455
* Add missing <sys/module.h> includesPoul-Henning Kamp2004-05-301-0/+1
| | | | Notes: svn path=/head/; revision=129879
* Set the IFCAP_VLAN_MTU bit in capenable as well.Dag-Erling Smørgrav2004-05-251-0/+1
| | | | | | | Reminded by: ru Notes: svn path=/head/; revision=129709
* Set baudrate to 100 Mbps, and advertise our ability to handle extendedDag-Erling Smørgrav2004-05-251-1/+7
| | | | | | | | | frames (802.1q). Submitted by: Steinar Haug <sthaug@nethelp.no> Notes: svn path=/head/; revision=129708
* We don't need to initialize if_output, ether_ifattach() does itMaxime Henrion2004-05-231-1/+0
| | | | | | | for us. Notes: svn path=/head/; revision=129616
* Apply fix for long timeouts on driver initialisation.Duncan Barclay2004-05-231-2/+7
| | | | | | | | | PR: 64656 Submitted by: Jianqin Qu <jqu@its.brooklyn.cuny.edu> Reviewed by: dmlb Notes: svn path=/head/; revision=129602
* Added BSD license, as requested by author.Wes Peters2004-04-041-0/+22
| | | | | | | | Requested-by: Stuart Walsh <stu@ipng.org.uk> Message-ID: <20040331190716.GB32835@deepfreeze.stu> Notes: svn path=/head/; revision=127827
* Convert callers to the new bus_alloc_resource_any(9) API.Nate Lawson2004-03-171-2/+2
| | | | | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde Notes: svn path=/head/; revision=127135