Commit Graph

2328 Commits

Author SHA1 Message Date
Ruslan Ermilov
e019908ee7 In detach method, move if_free() after bus_teardown_intr(). 2005-10-13 21:11:20 +00:00
Yaroslav Tykhiy
45c11f832a Mark sk(4) as capable of handling extended VLAN frames. NICs
based on XMAC II chip should be ready for this in their initial
mode of operation, and Yukon-based NICs are configured so by
the driver.

PR:		kern/79998
MFC after:	1 month
2005-10-11 22:55:16 +00:00
Gleb Smirnoff
f0796cd26c - Don't pollute opt_global.h with DEVICE_POLLING and introduce
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
2005-10-05 10:09:17 +00:00
Gleb Smirnoff
4092996774 Big polling(4) cleanup.
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
2005-10-01 18:56:19 +00:00
John Baldwin
d1754a9b9c - Use if_printf() and device_printf() in re(4) and remove rl_unit from
the softc.
- Use callout_init_mtx() and rather than timeout/untimeout in both rl(4)
  and re(4).
- Fix locking for ifmedia by locking the driver in the ifmedia handlers
  rather than in the miibus functions.  (re(4) didn't lock the mii stuff
  at all!)
- Fix some locking in re_ioctl().

Note: the two drivers share the same softc declared in if_rlreg.h, so they
had to be change simultaneously.

MFC after:	 1 week
Tested by:	several on rl(4), none on re(4)
2005-09-29 16:52:19 +00:00
John Baldwin
dc6f00687c Use if_printf() and device_printf(). 2005-09-29 16:47:08 +00:00
John Baldwin
ccb7a62ef7 Typo. 2005-09-29 15:04:58 +00:00
Jung-uk Kim
d8e205ef93 - Add a work-around for nForce3-250. Aperture base address encoded in misc.
control register and AGP bridge seems to be inconsistent with some BIOS.
Instead of relying on BIOS settings, we just take the initial aperture size
and encode them for both miscellaneous control register and AGP bridge.
Some idea was borrowed from agp_nvidia.c.

- Add preliminary ULi M1689 chipset support.  The idea was taken from Linux
because hardware and documentation are unavailable.  Not tested.

- Add more VIA chipset PCI IDs taken from Linux driver.

Approved by:	anholt (mentor)
Tested by:	Adam Gregoire <ebola at psychoholics dot org>
		Ganael Laplanche <ganael.laplanche at martymac dot com>
		K Wieland <kwieland at wustl dot edu>
2005-09-27 20:57:50 +00:00
Max Laier
b6de9e91bd Remove bridge(4) from the tree. if_bridge(4) is a full functional
replacement and has additional features which make it superior.

Discussed on:	-arch
Reviewed by:	thompsa
X-MFC-after:	never (RELENG_6 as transition period)
2005-09-27 18:10:43 +00:00
John Baldwin
25067ba265 Small fixes to sis(4):
- Remove sis_unit and use device_printf() and if_printf() instead.
- Use callout_init_mtx() for the callout.
- Remove spls.
- Fix locking for ifmedia to happen in the ifmedia handlers rather than in
  sis_ioctl().
- Log an error message if we fail to allocate any resources.  Perform
  cleanup if we fail to allocate any resources so that we don't leave
  a mutex hanging around.

Tested by:	Jason Tsai jason dot tsai at newcyberian dot com (1-4)
MFC after:	3 days
2005-09-26 18:42:27 +00:00
Poul-Henning Kamp
ca72f67d70 Use the new bus_space/resource convenience functions. 2005-09-24 20:46:02 +00:00
Poul-Henning Kamp
f38deea185 Move code macros from if_sis*reg*.h to if_sis.*c* 2005-09-20 09:52:53 +00:00
Eric Anholt
e3e1ac8615 Add a new AGP driver for ATI IGP chipsets. The driver is based on reading of
the Linux driver, since specs are unavailable.  Many thanks to Adam Kirchhoff
for multiple useful testing cycles, and Ralf Wostrack for the final fix to get
it working.

PR:		i386/75251
Submitted by:	anholt
2005-09-17 03:36:47 +00:00
Eric Anholt
695b15ca91 Fix agp_nvidia.c to behave more like the linux driver, fixing DRI on Radeon
9200 according to one responder.  The primary issue was not setting some bits
to say that the entries were active, but also fix one place where some memory
wasn't being used as volatile as it should.  While here, change some use of ffs
to a relatively short case statement, to make it more obvious what's going on.

PR:		kern/71638, kern/72372, kern/71547?
Submitted by:	Andrew J. Caines <A.J.Caines@halplant.com>,
		Robin Schoonover <end@endif.cjb.net>,
		Jason Henson <jason@ec.rr.com>
2005-09-16 22:59:47 +00:00
Ruslan Ermilov
3badacee8c Fix "struct ifnet" leaks when attach() fails in the middle, e.g.
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.
2005-09-16 11:11:51 +00:00
Giorgos Keramidas
4f867c2d17 When bus_alloc_resource_any() fails, dc_detach() is called and it
attempts to deallocate busdma tags and resources that haven't been
allocated yet, causing a panic every time a dc interface fails to
attach.  Fix by checking that we really have something to dealloc
before calling bus_dma*() functions.

Approved by:	jhb
MFC after:	1 week
2005-09-15 17:51:39 +00:00
John Baldwin
8d75d3087d - Fixup locking and mark MPSAFE.
- Use callout_init_mtx() and static callouts rather than timeout().
- m_getcl() in one place to simplify the code.

Tested by:	Gavin Atkinson gavin dot atkinson at ury dot york dot ac dot uk
MFC after:	1 week
2005-09-15 17:12:29 +00:00
Ruslan Ermilov
8d7a953fb2 Fixed "Memory modified after free" panic in rl_detach() due
to rl_stop() accessing already freed "struct ifnet".

Fixed LOR between rl mutex and some ACPI mutex in rl_detach().
2005-09-14 12:33:23 +00:00
John Baldwin
7afed9d69a Use if_printf() and device_printf() for printf's and remove the unit number
from the softc.

MFC after:	3 days
2005-08-31 18:03:18 +00:00
John Baldwin
a6c222c739 Various locking fixes and mark MPSAFE:
- Add locked variants of start(), init(), ifmedia_upd(), and poll() and stop
  recursing on the driver lock.
- Add locking to ifmedia_upd() and ifmedia_sts().
- Use callout_*() instead of timeout/untimeout.
- Fix locking in ioctl().

Tested by:	Bob Bishop rb at gid dot co dot uk
MFC after:	3 days
2005-08-30 20:35:08 +00:00
Warner Losh
919ccba73e Better comment 2005-08-29 18:45:21 +00:00
Warner Losh
667b0824d7 Fix another instance of old info re: miibus 2005-08-29 17:03:31 +00:00
Warner Losh
c3b6bc1a2a Fix obsolete comment.
MFC After: 2 days
2005-08-29 16:48:28 +00:00
John Baldwin
dbc2a95f40 - Use m_defrag() instead of homerolling our own variant
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.
2005-08-26 14:27:38 +00:00
John Baldwin
4faaaed479 - Remove non-bus-dma code.
- 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.)
2005-08-25 21:06:56 +00:00
John Baldwin
f8190d8dc8 Major rototill of this driver to add FreeBSD bus-dma support:
- 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.
2005-08-25 20:12:43 +00:00
John Baldwin
997452064e Various fixups to locking:
- Remove a lot of superfluous locking during attach.  There is no need
  to lock access to the driver until some other thread has a way of getting
  to it.  For ethernet drivers the other ways include registering an
  interrupt handler via bus_setup_intr(), calling ether_ifattach() to hook
  into the network stack, and kicking off a callout-driven timer via
  callout_reset().
- Use callout_* rather than timeout/untimeout.
- Break out of xl_rxeof() if IFF_DRV_RUNNING is clear after ifp->if_input
  returns to handle the case where the interface was stopped while we were
  passing a packet up the stack.  Don't call xl_rxeof() in xl_rxeof_task()
  unless IFF_DRV_RUNNING is set.  With these fixes in place, any
  outstanding task will gracefully terminate as soon as it gets a chance to
  run after the interface has been stopped via xl_stop().  As a result,
  taskqueue_drain() is no longer required in xl_stop().  The task is still
  drained in detach() however to make sure that detach() can safely destroy
  the driver mutex at the end of the function.
- Lock the driver lock in the ifmedia callouts and don't lock across
  ifmedia_ioctl() in xl_ioctl().

Note: glebius came up with most of (3) as well independently.  I took a
rather roundabout way of arriving at the same conclusion.

MFC after:	3 days
2005-08-18 19:24:30 +00:00
John Baldwin
c8b27aca43 Fixup locking and mark MPSAFE:
- Add locked versions of start and init.  The SRM_MEDIA code in dc_init()
  stayed in dc_init() instead of moving to dc_init_locked() to make the
  locking saner.
- Use callout_init_mtx().
- Fixup locking in detach and ioctl.
- Lock the driver in the ifmedia callouts.
- Don't recurse on the driver lock.
- De-spl.

MFC after:	3 days
2005-08-18 19:10:07 +00:00
John Baldwin
2a3e25a07f Fixup locking for sf(4) and mark MPSAFE:
- Add locked variants of start, init, and ifmedia_upd.
- Use callout_* instead of timeout/untimeout.
- Don't recurse on the driver lock.
- Fixup locking in ioctl.
- Lock the driver lock in the ifmedia handlers rather than across
  ifmedia_ioctl().

Tested by:	brueffer
MFC after:	3 days
2005-08-18 17:09:16 +00:00
John Baldwin
8a8573fdb2 - Use htole32() instead of using bswap32() conditional on #if BYTE_ORDER.
- 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)
2005-08-17 17:46:51 +00:00
John Baldwin
6da5b383f1 Remove the unused TULIP_CSR_{READ,WRITE}BYTE macros. 2005-08-17 17:45:19 +00:00
John Baldwin
f512b596a8 Use callout_init_mtx() to simplify the stats callout.
MFC after:	3 days
2005-08-17 17:44:58 +00:00
John Baldwin
f68d1644f8 Use device_printf() and if_printf() and remove ste_unit from the softc. 2005-08-17 14:37:39 +00:00
Bjoern A. Zeeb
e3c18d1d11 * Solve "No PHY found" problem for more Yukon Lite variants.
* Catch a bus attach error.
* Improve locking.

MFC after:	6 days
2005-08-13 11:13:12 +00:00
John Baldwin
22f6205d3b Use device_printf() and if_printf() and remove dc_unit from softc. 2005-08-10 20:33:46 +00:00
John Baldwin
fc8c1e5d98 Use if_printf() and device_printf() and axe sf_unit from the softc as a
result.
2005-08-10 20:24:39 +00:00
John Baldwin
fcde23065f Call tulip_start() rather than tulip_ifstart() from the interrupt handler
to avoid recursing on the driver lock.  Not sure why my test box didn't
catch this earlier.

MFC after:	3 days
2005-08-09 21:53:26 +00:00
Robert Watson
13f4c340ae Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
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
2005-08-09 10:20:02 +00:00
John Baldwin
718e387c34 Fix up the locking in pcn(4) and mark it MPSAFE.
- Add locked versions of the init() and start() methods.
- Use callout_*() rather than timeout().
- Make the driver lock non-recursive.
- Push down locking in detach() and ioctl().
- Fix the tick routine to bail if the interface has been stopped and use
  callout_drain() in detach() after the call to stop().
- Lock the driver lock in the ifmedia handlers.

Tested by:	Ketrien I. Saihr-Kesenchedra ketrien at error404.nls.net
MFC after:	1 week
2005-08-05 16:03:16 +00:00
Anton Berezin
32aa5f0e3e Recognize D-Link DGE-528(T) Gigabit as an re(4) device.
Submitted by:	Andrus Nomm <andrus@members.ee>
PR:		76780
MFC After:	1 week
2005-08-05 08:19:12 +00:00
Robert Watson
13b203d0d7 Modify device drivers supporting multicast addresses to lock if_addr_mtx
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
2005-08-03 00:18:35 +00:00
John Baldwin
d0e98e85f8 - Use callout_*() rather than timeout() to periodically poll the media.
- 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
2005-07-27 13:51:01 +00:00
John Baldwin
8bc92074e8 Fix a typo in the name of the dmamap for a bus_dmamap_sync().
MFC after:	3 days
2005-07-27 13:48:45 +00:00
Warner Losh
6fa45429f9 The 575A doesn't have funcregs in memio. So don't claim that it does.
This gets my 575A card probing.

Card provided by: James Flemer
MFC After: 3 days
2005-07-27 06:38:55 +00:00
John Baldwin
9cc8edda00 - Use the PCIR_BAR() macro rather than hardcoding rids.
- Use pci_enable_busmaster() rather than fiddling with the PCI command
  register directly.
2005-07-21 16:43:07 +00:00
John Baldwin
88519d6427 Don't set if_start to tulip_ifstart all over the place. It is already
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.
2005-07-21 16:42:21 +00:00
John Baldwin
fe0c8544ff Remove conditional code that has largely rotted that is also not on by
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
2005-07-21 16:40:08 +00:00
John Baldwin
9862c11e9d Use get_cyclecount() rather than hardcoding rdtsc and rpcc in asm for i386
and alpha, respectively.
2005-07-21 16:34:14 +00:00
John Baldwin
e5e871963c Fix a typo and some whitespace nits. 2005-07-21 16:33:05 +00:00
Gleb Smirnoff
016fcebe90 NET_LOCK_GIANT() when entering network code.
Pointy hat to:	glebius
Reported by:	rodrigc
2005-07-13 14:06:13 +00:00
Max Laier
ade6e491fc ALTQify ste(4).
Requested and tested by:	<nike_d at cytexbg dot com>
Approved by:			re (scottl)
2005-07-08 13:05:59 +00:00
Scott Long
8225bf4c36 Fix ifnet fallout in if_ti.
Reviewed by: brooks
Approved by: re
2005-07-07 01:05:45 +00:00
Eric Anholt
11b0d58251 Make the initialization in the AGPv3 case match that of Linux. Fixes hangs on
X startup with DRI enabled, with a v3-capable card.

Tested by:	Tom McLaughlin <tmclaugh@sdf.lonestar.org>
Approved by:	re (scottl)
2005-06-26 04:01:11 +00:00
Brooks Davis
cd036ec193 Move if_alloc() up so it's before mii_phy_probe(). 2005-06-11 01:37:46 +00:00
Brooks Davis
fc74a9f93a Stop embedding struct ifnet at the top of driver softcs. Instead the
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
2005-06-10 16:49:24 +00:00
Yoshihiro Takahashi
d4fcf3cba5 Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64.  The optimization is a trivial on recent machines.

Reviewed by:	-arch (imp, marcel, dfr)
2005-05-29 04:42:30 +00:00
Gleb Smirnoff
e9ace2571c Calling xl_rxeof() at the end of xl_start_locked() leads to recursion
in case of IP fast forwarding. Enqueue a taskqueue(9) task instead of
calling xl_rxeof() directly.

Reported & tested by:	Slava Alpatov
Reviewed by:		wpaul
MFC after:		1 week
2005-05-20 07:16:09 +00:00
Bjoern A. Zeeb
261a19c1ee Deal with failed malloc calls[1].
While there also check for failed device_add_child calls.

Found by:	Coventry Analysis tool[1].
Submitted by:	sam[1]
Approved by:	pjd (mentor)
MFC after:	1 week
2005-04-25 10:18:24 +00:00
Warner Losh
6d431b17c9 Fix newer Xircom CBE2-100 cards that were reporting
dc0: MII without any PHY!
We have to enable the connection to the MII first.  Doing so fixes the
problem cards without breaking the older, working cards.

Bad card provided by: deischen
2005-04-18 03:31:29 +00:00
Matthew N. Dodd
c7ae8b4fa8 Invert conditional and use continue to reduce nesting. 2005-04-13 01:32:06 +00:00
David E. O'Brien
fd92279bef Add nForce3-250. 2005-04-08 18:04:39 +00:00
David E. O'Brien
824a5e96dc nVidia AGP chipsets beyond nForce2 are AMD64-specific.
So move the AGP support to there.

Submitted by:	Jung-uk Kim <jkim@niksun.com>
2005-04-02 01:10:09 +00:00
Scott Long
69bbb4fe70 If resource allocation fails, we could wind up freeing the cdev without it
being allocated.  Add a simple check for this.

Submitted by: yongari
2005-03-31 17:16:40 +00:00
David E. O'Brien
f6bb4f25a4 Bring rev 1.31 to the AMD64 platform.
This adds support for the SiS intergrated NIC on some Athlon64 motherboards.
The MAC address is stored in the APC CMOS RAM and this fixes the
sis driver ending up with a 00:00:00:00:00:00 MAC address.

Submitted by:	Stasys Smailys <ssmailys@komvista.lt>
2005-03-28 18:06:44 +00:00
Sam Leffler
52c94c38dc deal with malloc failure when setting up the multicast filter
Noticed by:	Coverity Prevent analysis tool
2005-03-26 23:26:49 +00:00
Sam Leffler
af5691cdd5 handle malloc failure and sk_vpd_prodname potentially being null for
other reasons

Noticed by:	Coverity Prevent analysis tool
Reviewed by:	bz, jmg
2005-03-26 22:57:28 +00:00
Ruslan Ermilov
77d23c9bc3 xl(4) meets polling(4). Hardware for this work kindly provided by
Eric Masson.

MFC after:	3 weeks
2005-03-26 20:22:58 +00:00
Scott Long
586cfbb265 Start the process of modernizing the Tigon driver by using busdma for the
descriptor and configuration data.  Thanks to Martin Nilsson for providing
hardware.
2005-03-21 07:17:27 +00:00
Bjoern A. Zeeb
e7f8ebb45e Do not try to free non allocated memory in error case.
Do our best to plug some memory leaks (VPD data, jumbo memory buffer,...).
Log if we cannot free because memory still in use[1].
Change locking to avoid ''acquiring duplicate lock of same
  type: "network driver"'' and potential deadlock. Also seems to fix LOR #063.

[1] This change does not solve problems if buffers are still in use when
    unloading if_sk.ko. There is ongoing work which will address jumbogram
    allocations in a more general way.

PR:		kern/75677 (with changes, no mii fixes in here)
Tested by:	net, Antoine Brodin (slightly different version)
Approved by:	rwatson (mentor)
MFC after:	5 days
2005-03-17 14:27:22 +00:00
Bjoern A. Zeeb
9f0877efe3 * Lower interrupt moderation timer 200->100.
Obtained from:	NetBSD if_sk.c rev. 1.11

* Make interrupt moderation configurable via sysctl/tuneable.
PR:		kern/41220
Approved by:	rwatson (mentor)
2005-03-17 14:23:13 +00:00
Bjoern A. Zeeb
2dfd4c0a21 * Improve chip identification.
Obtained from:	NetBSD if_sk.c rev. 1.11

* Take PHY out of reset for Yukon Lite Rev. A3.
Submitted by:	postings on net@ in thread "skc0: no PHY found", 2005-02-22

Tested by:	net
Approved by:	rwatson (mentor)
MFC after:	5 days
2005-03-17 14:21:51 +00:00
Bjoern A. Zeeb
d34019b31e * When adding/deleting multicast addresses, only whack the address filter
if the interface is marked RUNNING.
Obtained from:	NetBSD if_sk.c rev. 1.12

* Don't initialize the card (and start an autonegotiation) every time the IP
  address changes. Makes 'dhclient sk0' invocations way faster and more
  consistant. i.e. one DHCPREQUEST elicits the DHCPACK.
Obtained from:	OpenBSD if_sk.c rev. 1.56

* Additional locking changes in sk_ioctl.

PR:		kern/61296 should see improvements by the last two.
Approved by:	rwatson (mentor)
MFC after:	5 days
2005-03-17 14:18:58 +00:00
Scott Long
ab0d8702bf Bugger, wiped out a needed comma in the previous commit. 2005-03-09 00:54:55 +00:00
Scott Long
c1b677aa80 The DC driver asks for an alignment of PAGE_SIZE for data buffers, but also
asks that each buffer be (2048 * 256) bytes long.  I suspect that alignment
isn't a real requirement since busdma only recently started honoring it.  The
size is also bogus.  Fix both of these and stop busdma from trying to
exhaust the system memory pool with bounce pages.

Submitted by: Kevin Oberman
MFC After: 7 days
2005-03-08 23:25:46 +00:00
Olivier Houchard
4ac78327de Add device id for the Ali M1671 host to AGP bridge. 2005-02-27 13:05:34 +00:00
Warner Losh
576f8ba203 Add back 'n' that went missing in last commit 2005-02-25 03:43:43 +00:00
Warner Losh
d24ae19d0e Fix style(9) issues with __P removal.
Noticed by: bde
2005-02-24 22:33:05 +00:00
Warner Losh
d701c91325 Return BUS_PROBE_DEFAULT instead of 0. 2005-02-24 21:32:56 +00:00
Eric Anholt
9271f7b6d5 Correct the SiS 755 PCI ID. Confirmed against Linux code.
PR:		kern/76411
Submitted by:	Jonathan Fosburgh, jonathan at fosburgh dot org
Obtained from:	Jung-uk Kim, jkim at niksun.com
2005-02-14 07:30:04 +00:00
Eric Anholt
ba16275b9f No use for this AMD64 special-case "return NULL;" in probe now that we don't
do fake "generic" support.
2005-02-14 07:16:25 +00:00
Max Laier
0afa9c9e2c Adjust TX threshold on every TX underrun. Some supported cards (8139-based)
can retransmit on TX underrun and set TOK in addition to TUND.  Also add a
check to prevent overflow of the addressable threshold.

This fixes some reports of rl(4) slowness, believed to be related to ALTQ
before.

PR:		kern/61448
Submitted by:	Tim Draegen-Gilman <timNOeudaemonSPAMnet> (with changes)
MFC after:	1 week
2005-02-11 01:05:52 +00:00
Bjoern A. Zeeb
9eed64cad9 Cleanup debugging code and put it under bootverbose
(includes minor style polishing).

Approved by:	rwatson (mentor)
2005-01-29 19:26:53 +00:00
Warner Losh
5fb99dcabe Bring in support for SUGOI LAN GIGA NIC made by System TALKS, Inc from
a RealTek 8169SB.

PR: 74262
Submitted by: Yoshikazu GOTO-san

# Submitter notes that he's unsure of the revision string for 8169SB
2005-01-22 22:40:53 +00:00
Ruslan Ermilov
37c3875846 Reimplement the fix in rev. 1.126.
OK'ed by:	phk
2005-01-10 09:56:47 +00:00
Sam Leffler
b03eb9a092 correct direction for bus_dma sync of rx buffer
Submitted by:	Tai-hwa Liang
2005-01-09 19:57:55 +00:00
Poul-Henning Kamp
90711964ef Revert local experiment which leaked into commit. 2005-01-07 23:54:16 +00:00
Poul-Henning Kamp
aeaf0a3a68 Fix compilation of DEVICE_POLLING code. 2005-01-07 23:52:41 +00:00
Scott Long
45a0fd86e1 Fix typos from previous commit. 2005-01-07 05:01:24 +00:00
Warner Losh
60727d8b86 /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
Poul-Henning Kamp
72f0eb9104 We no longer recurse the mutex. 2005-01-07 00:02:11 +00:00
Poul-Henning Kamp
8397f22c34 If we get an interrupt and the interface is down, return before we
grab the lock.  This should help a tiny bit on machines where unused
if_sis interfaces share IRQ.
2005-01-07 00:01:43 +00:00
Poul-Henning Kamp
41166e0488 Don't tweak DSP on the ..16 chips. 2005-01-06 23:56:13 +00:00
Poul-Henning Kamp
4ce7885f87 Fix for an issue with excessive collisions in half duplex mode. 2005-01-06 23:54:55 +00:00
Poul-Henning Kamp
bce3bc624c Nail the short cable problem the exact way National says it should be. 2005-01-06 23:49:26 +00:00
Poul-Henning Kamp
0608b4a20c Simplify and fix bugs in rx/tx ring cleanup. 2005-01-06 23:36:43 +00:00
Poul-Henning Kamp
7302042943 Rewrite the rx/tx ring initialization to use pointers instead of arrays. 2005-01-06 23:31:41 +00:00
Poul-Henning Kamp
1bad258b05 Eliminate a bunch of unnecessary prototypes. 2005-01-06 23:26:13 +00:00
Poul-Henning Kamp
878f347274 Move the module related stuff to the bottom of the file. This will
allow us to save prototypes.
2005-01-06 23:22:38 +00:00
Poul-Henning Kamp
951365068b Make sure to clear any pending interrupts when we stop the interface. 2005-01-06 23:18:44 +00:00
Poul-Henning Kamp
c884a1dc23 Close a theoretical race: By the time the watchdog comes around
the interface may have been stopped, so we should not restart it.
2005-01-06 23:13:50 +00:00