summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_sis.c
Commit message (Collapse)AuthorAgeFilesLines
* Clean up locking and resource management for pci/if_*njl2003-03-311-88/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove locking of the softc in the attach method, instead depending on bus_setup_intr being at the end of attach (delaying interrupt enable until after ether_ifattach is called) - Call *_detach directly in the error case of attach, depending on checking in detach to only free resources that were allocated. This puts all resource freeing in one place, avoiding thinkos that lead to memory leaks. - Add bus_child_present check to calls to *_stop in the detach method to be sure hw is present before touching its registers. - Remove bzero softc calls since device_t should do this for us. - dc: move interrupt allocation back where it was before. It was unnecessary to move it. This reverts part of 1.88 - rl: move irq allocation before ether_ifattach. Problems might have been caused by allocating the irq after enabling interrupts on the card. - rl: call rl_stop before ether_ifdetach - sf: call sf_stop before ether_ifdetach - sis: add missed free of sis_tag - sis: check errors from tag creation - sis: move dmamem_alloc and dmamap_load to happen at same time as tag creation - sk: remove duplicate initialization of sk_dev - ste: add missed bus_generic_detach - ti: call ti_stop before ether_ifdetach - ti: add missed error setting in ti_rdata alloc failure - vr: add missed error setting in I/O, memory mapping cases - xl: add missed error setting in I/O, memory mapping cases - xl: remove multi-level goto on attach failure - xl: move dmamem_alloc and dmamap_load to happen at same time as tag creation - Calls to free(9) are unconditional because it is valid to call free with a null pointer. Reviewed by: imp, mdodd
* Have sis_encap use m_defrag if:silby2003-03-291-1/+25
| | | | | | | | | | | | | | | 1. The chain passed in is > 31 fragments long or 2. The chain will not fit in the remaining descriptors without defragmentation. This is slightly less clear than other network drivers because the sis chips share one descriptor list for all packets, it seems. Before this change, a > 127 fragment chain would get stuck in the IFQUEUE permanently, bringing all network traffic to a halt. MFC after: 2 weeks
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Add PCI revision number for 630A and 900B. Enable parity error detectionmbr2003-01-281-19/+82
| | | | | | | | | | on 900B and 635(A). Re-add the enhanced PHY access register method again for older chipsets, they do not seem to work with all old chips. Reviewed by: phk MFC after: 7 days
* 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.
* Make newer integrated SiS900 cards working.mbr2003-01-101-2/+27
| | | | | | | | | | | Allow to read EEPROM from LAN. It is shared between a 1394 controller and the NIC and each time we access it, we need to set SIS_EECMD_REQ. Idea from: linux driver source Reviewed by: luoqi Obtained from: linux driver source (idea)
* Sis no longer implements the enhanced phy controlmbr2003-01-101-53/+241
| | | | | | | | | | register, and phy has to be directly accessed via mdio. Patch converted to CURRENT from STABLE. Submitted by: luoqi Reviewed by: luoqi (again) MFC after: 2 weeks
* SIS_CFG_EDB_MASTER_EN indicates the EDB bus is used instead ofmbr2003-01-101-2/+10
| | | | | | | | | the PCI bus. When this bit is set, the Max DMA Burst Size for TX/RX DMA should be no larger than 64 bytes. Reviewed by: luoqi Obtained from: (idea from linux driver source) MFC after: 2 weeks
* Correct a harmless problem when creating the DMA tagmux2002-12-131-1/+1
| | | | | | | | used to map mbufs. The maximum size should be MCLBYTES and not SIS_TX_LIST_SZ. This is probably a typo in the original commit. Tested by: cognet
* o track either_ifattach/ether_ifdetach API changessam2002-11-141-11/+8
| | | | | | | | | | | o use if_input for input packet processing o don't strip the Ethernet header for input packets o use BPF_* macros bpf tapping o call ether_ioctl to handle default ioctl case o track vlan changes Reviewed by: many Approved by: re
* Be consistent about functions being static.phk2002-10-161-1/+1
| | | | Spotted by: FlexeLint.
* Put return values from functions on a line by themselves.alfred2002-08-231-36/+72
| | | | Ok'd previously by: wpaul
* Remove the SIS_LOCK/SIS_UNLOCK from sis_attach(). It makes WITNESSphk2002-08-191-3/+0
| | | | barf and there seem to be little room for contention during attach.
* Increase size of ifnet.if_flags from 16 bits (short) to 32 bits (int). To avoidsobomax2002-08-181-3/+3
| | | | | | | breaking application ABI use unused ifreq.ifru_flags[1] for upper 16 bits in SIOCSIFFLAGS and SIOCGIFFLAGS ioctl's. Reviewed by: -hackers, -net
* Use new interface for ether_input().luigi2002-08-071-13/+4
| | | | | | | Remove some unnecessary assignments to mbuf fields in sis_newbuf(), the "length" fields are of no use while the mbuf is in the receive ring. MFC after: 3 days
* Use m_getcl() to allocate mbuf+cluster for the receive ring.luigi2002-08-041-25/+9
| | | | | | | Remove the sis_quick variable, as it was there for testing purposes only. MFC after: 3 days
* Make sure that if_timer does not get reset if there are packetsluigi2002-06-301-18/+10
| | | | | | | | | | | still queued for transmission. This should solve the problem of the device stalling on transmissions if some link event prevents transmission. There are other drivers which have the same problem and need to be fixed in the same way. MFC after: 3 days
* Change callers of mtx_init() to pass in an appropriate lock type name. Injhb2002-04-041-1/+2
| | | | | | | most cases NULL is passed, but in some cases such as network driver locks (which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used. Tested on: i386, alpha, sparc64
* Remove __P.alfred2002-03-201-51/+46
|
* Fix support for 630ET support. We don't need the Linux part to set theambrisko2002-02-061-10/+3
| | | | | | | mii access mode. Fix the device ID and make it read the mac via sis_read_mac. Reviewed by: imp MFC after: 1 week
* Fix mind-o: compare sc->sis_rev instead of 'command' when trying towpaul2002-01-141-1/+1
| | | | decide how to read the station address.
* Add support for newer integrated SiS 900 controllers on the 635 and 735wpaul2002-01-121-5/+46
| | | | | | | motherboard chipsets. We need to force the chip to reload its MAC address into the receive filter, and enable software access mode for the PHY. PR: kern/33294
* Fix access-after-free bug added in revision 1.31.archie2001-12-151-4/+5
| | | | | Detected by: INVARIANTS MFC after: 2 days
* Patch up some existing style bugs and some that crept in with thepeter2001-12-151-1/+2
| | | | DEVICE_POLLING stuff.
* Device Polling code for -current.luigi2001-12-141-1/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Non-SMP, i386-only, no polling in the idle loop at the moment. To use this code you must compile a kernel with options DEVICE_POLLING and at runtime enable polling with sysctl kern.polling.enable=1 The percentage of CPU reserved to userland can be set with sysctl kern.polling.user_frac=NN (default is 50) while the remainder is used by polling device drivers and netisr's. These are the only two variables that you should need to touch. There are a few more parameters in kern.polling but the default values are adequate for all purposes. See the code in kern_poll.c for more details on them. Polling in the idle loop will be implemented shortly by introducing a kernel thread which does the job. Until then, the amount of CPU dedicated to polling will never exceed (100-user_frac). The equivalent (actually, better) code for -stable is at http://info.iet.unipi.it/~luigi/polling/ and also supports polling in the idle loop. NOTE to Alpha developers: There is really nothing in this code that is i386-specific. If you move the 2 lines supporting the new option from sys/conf/{files,options}.i386 to sys/conf/{files,options} I am pretty sure that this should work on the Alpha as well, just that I do not have a suitable test box to try it. If someone feels like trying it, I would appreciate it. NOTE to other developers: sure some things could be done better, and as always I am open to constructive criticism, which a few of you have already given and I greatly appreciated. However, before proposing radical architectural changes, please take some time to possibly try out this code, or at the very least read the comments in kern_poll.c, especially re. the reason why I am using a soft netisr and cannot (I believe) replace it with a simple timeout. Quick description of files touched by this commit: sys/conf/files.i386 new file kern/kern_poll.c sys/conf/options.i386 new option sys/i386/i386/trap.c poll in trap (disabled by default) sys/kern/kern_clock.c initialization and hardclock hooks. sys/kern/kern_intr.c minor swi_net changes sys/kern/kern_poll.c the bulk of the code. sys/net/if.h new flag sys/net/if_var.h declaration for functions used in device drivers. sys/net/netisr.h NETISR_POLL sys/dev/fxp/if_fxp.c sys/dev/fxp/if_fxpvar.h sys/pci/if_dc.c sys/pci/if_dcreg.h sys/pci/if_sis.c sys/pci/if_sisreg.h device driver modifications
* MFS (merge from stable): rev 1.13.4.13, fix ordering of IFF_RUNNING mods.peter2001-12-071-2/+3
| | | | | | The reason we are required to commit to -current first is so that later MFC's do not risk the loss of existing bug fixes. Even if this was not strictly required in -current, it should still be fixed there too.
* Add VLAN support.jhay2001-12-051-0/+11
| | | | MFC after: 7 days
* Remove error messages on mbuf allocation failures, nowluigi2001-12-041-6/+1
| | | | | | this is done more safely in kern/subr_mbuf.c Two-days'-delay-thanks-to: @home shutting down service
* Per jlemon request, reintroduce some printf() when anluigi2001-11-291-3/+8
| | | | | | | | | | | | | | mbuf allocation fails, and fix (i hope) a couple of style bugs. I believe these printf() are extremely dangerous because now they can occur on every incoming packet and are not rate limited. They were meant to warn the sysadmin about lack of resources, but now they can become a nice way to panic your system under load. Other drivers (e.g. the fxp driver) have nothing like this. There is a pending discussion on putting this kind of warnings elsewhere, and I hope we can fix this soon.
* Remove the need for an expensive m_devget on the i386, which does notluigi2001-11-281-39/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | have alignment problems. On small boxes (e.g. the net4501 from Soekris, featuring a 486/133) this provides huge performance benefits: the peak forwarding rate with avg.sized packets goes up by 50-70% because of this change alone. Faster CPUs might benefit less from this change, but in any case the CPU has better things to do than waste time on useless memory-to-memory copies. Several drivers (for Tulip-like cards) might benefit from a similar change. Right now the new behaviour is controlled by a sysctl variable, hw.sis_quick which defaults to 1 (on), you can set it to 0 to reintroduce the old behaviour (and compare the results). The variable is only there to show how much you can gain with this change, it will go away soon. Also, slightly simplify the code to initialize the ring buffers, and remove a couple of dangerous printf's which could trigger on any packet in case of mbuf shortage. MFC-after: 3 days
* Fix a bug in the driver -- under load, the receive unit could becomeluigi2001-11-271-13/+11
| | | | | | | | | idle and the driver would not detect the event, requiring userland to cycle the interface to bring it up again. The fix consists in adding SIS_IMR_RX_IDLE to the interrupt mask and add a command in sis_intr() to restart the receiver when this happens. While at it, make the test of status bits more efficient.
* Do not call mii_pollstat() from within device tick routines; the statusjlemon2001-09-291-7/+5
| | | | | | information is updated by mii_tick(). Pointed out by: wpaul (a while back)
* Convert the if_sis and if_rl drivers to use the bus_dma API instead ofwpaul2001-08-151-46/+237
| | | | | | | | | | calling vtophys() and contigmalloc()/contigfree() directly. Hopefully, I have shaken out all of the problems with busdma on the alpha now. (Everything seems to work as expected.) Also, change the max RX DMA limit to 1024 bytes instead of "unlimited," as the latter seems not to work correctly on the alpha that I tested. (At 100Mbps, all attempts to receive frames yield RX errors.)
* Apply patch supplied by Jonathan Chen: use the correct arguments towpaul2001-07-091-2/+2
| | | | | pci_enable_io(). We need to use SYS_RES_IOPORT/SYS_RES_MEMORY instead of PCIM_CMD_PORTEN/PCIM_CMD_MEMEN.
* Change m_devget()'s outdated and unused `offset' argument to actually meanbmilekic2001-06-201-3/+2
| | | | | | | | | | | | | | | | | | | | something: offset into the first mbuf of the target chain before copying the source data over. Make drivers using m_devget() with a first argument "data - ETHER_ALIGN" to use the offset argument to pass ETHER_ALIGN in. The way it was previously done is potentially dangerous if the source data was at the top of a page and the offset caused the previous page to be copied (if the previous page has not yet been appropriately mapped). The old `offset' argument in m_devget() is not used anywhere (it's always 0) and dates back to ~1995 (and earlier?) when support for ethernet trailers existed. With that support gone, it was merely collecting dust. Tested on alpha by: jlemon Partially submitted by: jlemon Reviewed by: jlemon MFC after: 3 weeks
* Big round of minor updates:wpaul2001-02-211-27/+31
| | | | | | | | | | | | | | - Use pci_get_powerstate()/pci_set_powerstate() in all the other drivers that need them so we don't have to fiddle with the PCI power management registers directly. - Use pci_enable_busmaster()/pci_enable_io() to turn on busmastering and PIO/memory mapped accesses. - Add support to the RealTek driver for the D-Link DFE-530TX+ which has a RealTek 8139 with its own PCI ID. (Submitted by Jason Wright) - Have the SiS 900/National DP83815 driver be sure to disable PME mode in sis_reset(). This apparently fixes a problem on some motherboards where the DP83815 chip fails to receive packets. (Submitted by Chuck McCrobie <mccrobie@cablespeed.com>)
* Apply patch to add support for the intergrated ethernet in the SiS630Ewpaul2001-02-091-1/+98
| | | | | | | | | | chipset. The MAC address is stored in the APC CMOS RAM and we have to commit trememdous evil in order to read it. The code to do this is only activated on the i386 platform. Thanks to Cameron Grant for providing access to a test box for me to tinker with. This will fix the problem where the sis driver ends up with a station address of 00:00:00:00:00:00 on boards that use the 630E chipset.
* Convert if_multiaddrs from LIST to TAILQ so that it can be traversedphk2001-02-061-2/+2
| | | | | | backwards in the three drivers which want to do that. Reviewed by: mikeh
* Another round of the <sys/queue.h> FOREACH transmogriffer.phk2001-02-041-2/+1
| | | | | Created with: sed(1) Reviewed by: md5(1)
* Use LIST_FOREACH() to traverse ifp->if_multiaddrs list, instead ofphk2001-02-031-4/+2
| | | | | | | <sys/queue.h> implementation details. Created with: /usr/sbin/sed Reviewed with: /sbin/md5
* Implement MTX_RECURSE flag for mtx_init().bmilekic2001-01-191-1/+1
| | | | | | | | | | | | | | | | | | | All calls to mtx_init() for mutexes that recurse must now include the MTX_RECURSE bit in the flag argument variable. This change is in preparation for an upcoming (further) mutex API cleanup. The witness code will call panic() if a lock is found to recurse but the MTX_RECURSE bit was not set during the lock's initialization. The old MTX_RECURSE "state" bit (in mtx_lock) has been renamed to MTX_RECURSED, which is more appropriate given its meaning. The following locks have been made "recursive," thus far: eventhandler, Giant, callout, sched_lock, possibly some others declared in the architecture-specific code, all of the network card driver locks in pci/, as well as some other locks in dev/ stuff that I've found to be recursive. Reviewed by: jhb
* Initialize/grab the mutex earlier in the attach phase, so thatwpaul2000-12-041-3/+3
| | | | | bailing out to the fail: label where we release/destroy the mutex will work without exploding.
* Fix a couple of cases where I tried to release the I/O space resource twicewpaul2000-11-021-1/+1
| | | | | (once as as an I/O space resource and once as an IRQ resource). There was a problem with this in if_rl too, which is how I found it.
* Remove unneeded #include <machine/clock.h>phk2000-10-151-1/+0
|
* Use device_get_nameunit(dev) as the mutex string when callingwpaul2000-10-131-1/+1
| | | | | mtx_init() instead of hard-coded string constant. Also remember to do the mutex changes to the ste driver, which I forgot in the first commit.
* First round of converting network drivers from spls to mutexes. Thiswpaul2000-10-131-22/+41
| | | | | | | | takes care of all the 10/100 and gigE PCI drivers that I've done. Next will be the wireless drivers, then the USB ones. I may pick up some stragglers along the way. I'm sort of playing this by ear: if anyone spots any places where I've screwed up horribly, please let me know.
* Fix up the sis driver, largely to improve the NatSemi DP83815 support:wpaul2000-08-221-17/+70
| | | | | | | | | | | | | | | | | | | | | | | - Modify the driver to poll the link state and positively set the MAC to full or half duplex as needed. Previously, it was possible for the MAC to remain in half duplex even though the PHY had negotiated full duplex with its link partner, which would result in bursty performance. - Program some of the NatSemi's registers as specified by the datasheet. The manual says these are necessary for "optimum perofrmance," though a couple of them are marked as reserved in the register map. *shrug* - Select the TX DMA burst size correctly for 10 and 100mbps modes. Previously I was using 64 bytes in both modes, which worked in 100mbps mode, but resulting in spotty performance in 10mbps. 32 bytes works much better; without this change, the natsemi chip yields piss poor performance at 10mbps. With these fixes, the NatSemi chip finally performs to my satisfaction. I should be merging the support for this controller into -stable shortly. Phew.
* sis_miibus_writereg() was checking for SIS_TYPE_900 and phy != 0 twicewpaul2000-07-141-3/+0
| | | | | due to a small cut & paste-o on my part. It happens this didn't hurt anything, but it's still wrong.
* Make all Ethernet drivers attach using ether_ifattach() and detach usingarchie2000-07-131-6/+3
| | | | | | | | | ether_ifdetach(). The former consolidates the operations of if_attach(), ng_ether_attach(), and bpfattach(). The latter consolidates the corresponding detach operations. Reviewed by: julian, freebsd-net
* Fix a minor bug in the MAC address unscrambling code.wpaul2000-07-061-3/+3
| | | | (Some shift rights should have been shift lefts.)
OpenPOWER on IntegriCloud