Commit Graph

1902 Commits

Author SHA1 Message Date
Martin Blapp
f956e0b3f0 Only use a SIA/SYM media info block if no MII block is detected.
The submitter of PR 32118 told me that this patch also fixes autoselecting
for znyx 4 port cards (10baseT, 100baseTX did work already).

PR:		32118
Reviewed by:	imp
Approved by:	rwatson (re)
2003-05-15 16:53:29 +00:00
Martin Blapp
7eac366be1 Add support for 3Com OfficeConnect 10/100B.
PR:		49059, 50747
Submitted by:	Dax Eckenberg <daxbert@dweebsoft.com>
Reviewed by:	imp, jhb
Approved by:	jhb
MFC after:	2 weeks
2003-05-12 19:50:21 +00:00
Olivier Houchard
0be8f80357 Don't call timeout() in sis_tick(), this is done earlier by mii_tick(), and it
leads to a panic at unload time, as we own 2 instances of callout and
untimeout() only one.
Will I'm there, remove a call to callout_handler_init(), one is enough.

Reviewed by:	wpaul
2003-05-06 02:00:01 +00:00
Hartmut Brandt
2102bdf21a Define a link layer MIB for ATM. Most fields of this MIB are needed by
ILMI daemons. Factor out common softc fields for all ATM interfaces that
need to be externally visible into an ifatm structure and make the midway
driver using this structure and fill the MIB.
2003-05-05 16:35:52 +00:00
Martin Blapp
acc1bccccd Use only a 64bit hash filter table for ADM-Centaur cards like the
Accton EN2242 and the ADMtek AN985 cards.

PR:		32699
Submitted by:	Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
Reviewed by:	phk
MFC after:	2 weeks
2003-05-01 09:31:01 +00:00
Hartmut Brandt
d2c96fc51f Add module data and version to the atm_subr and reference this info from the
(currently) only consumer (en).

Add a sysctl node hw.atm where the atm drivers will hook on their hardware
sysctl sub-trees.

Make atm_ifattach call if_attach and remove the corresponding call to if_attach
from en. Create atm_ifdetach and use that in en.

While the last change actually changes the interface this is not a problem in
practice because the only other consumer of this API is an older LANAI driver
on the net, that is not ready for current anyway.

Reviewed by:	-atm
2003-04-29 08:07:44 +00:00
Hartmut Brandt
33cfde03bc Convert the midway driver to use busdma. Except for this conversion the
following changes have been done:

- stylify. The original code was too hard to read.
- get rid of a number of compilation options (Adaptec-only, Eni-only, no-DMA).
- more debugging features.
- locking. This is not correct yet in the absence of interface layer locking,
  but is correct enough to not to cause lock order reversals.
- remove RAW mode. There are no users of this in the tree and I doubt that
  there are any.
- remove NetBSD compatibility code. There was no way to keep NetBSD non-busdma
  and FreeBSD busdma code together.
- if_en now buildable as a module.

This has been actively tested on sparc64 and i386 with ENI server and
client cards and an Adaptec card (thanks to kjc).

Reviewed by:	mdodd, arr
2003-04-25 16:14:03 +00:00
Warner Losh
214073e5e4 Use newly minted device_is_attached rather than device_is_alive to see
if attach succeeded.  device_is_alive just tells us that probe
succeeded.  Since we were using it to do things like detach net
interfaces, this caused problems when there were errors in the attach
routine.

Symptoms of problem reported by: martin blapp
2003-04-21 18:34:04 +00:00
David E. O'Brien
152385d122 Explicitly declare 'int' parameters. 2003-04-21 16:27:46 +00:00
MIHIRA Sanpei Yoshiro
97f9172896 Add support for Planex FNW-3602-T(CardBus 100M/10M).
Submitted by:	kazz <kazz@v001.vaio.ne.jp>
Obtained from:	[bsd-nomads:16637]
2003-04-18 15:42:25 +00:00
Nate Lawson
693f4477b1 Revise attach/detach resource cleanup
- Unconditionally call *_stop() if device is in the tree. This is to
  prevent callouts from happening after the device is gone. Checks for
  bus_child_present() should be added in the future to keep from touching
  potentially non-existent hardware in *_detach().  Found by iedowse@.
- Always check for and free miibus children, even if the device is not in
  the tree since some failure cases could have gotten here.
- Call ether_ifdetach() in the irq setup failure case
- ti(4), xl(4): move ifmedia_init() calls to the beginning of attach so
  that ifmedia_removeall() can be unconditionally called on detach. There
  is no way to detect whether ifmedia has been initialized without using
  a separate variable (as tl(4) does).
- Add comments to indicate assumptions of code path
2003-04-17 20:32:06 +00:00
Ian Dowse
2ea36df806 Revert part of revision 1.97 by calling dc_stop() unconditionally
in dc_detach() instead of only calling it if the hardware is preset.
This is a workaround for page faults in softclock() after a `dc'
device was detached, caused by not disabling a timer before freeing
its memory. The bus_child_present() checks should probably be
re-added later, but only to avoid the hardware accesses and not the
other resource cleanups in dc_stop().

Approved by:	njl
2003-04-17 08:36:52 +00:00
John Baldwin
918f6e721b Remove another unused variable. 2003-04-16 15:24:17 +00:00
John Baldwin
c3bc903d9a Remove an unused variable so this compiles again. 2003-04-16 15:19:55 +00:00
Matthew N. Dodd
046d2c31c8 Remove some code that managed to escape from my local repository. 2003-04-16 13:18:27 +00:00
Matthew N. Dodd
67a452057c - Remove a block of code I missed in the previous commit.
- Call tl_ifmedia_upd() in tl_init() for cards with bitrate devices.
2003-04-16 06:51:26 +00:00
Matthew N. Dodd
533294b956 - Don't call pci_enable_io() in drivers (unless needed for resume).
- Don't test memory/port status and emit an error message; the PCI
  bus code will do this now.
2003-04-16 03:16:57 +00:00
Matthew N. Dodd
f246e4a17f - Express hard dependencies on bus (pci, isa, pccard) and
network layer (ether).
- Don't abuse module names to facilitate ifconfig module loading;
  such abuse isn't really needed.  (And if we do need type information
  associated with a module then we should make it explicit and not
  use hacks.)
2003-04-15 06:37:30 +00:00
Mike Silbersack
75d8feb42a Rework the rl_encap failure case. Previously, we would stuff the
unencapsulated packet back into the IFQ.  Unfortunately, the only reason
rl_encap would fail was due to m_defrag failing, which should only happen
when we're low on mbufs.  Hence, it was possible for us to end up with
an IFQ full of packets which could never clear the queue because they could
never be defragmented because they were themselves taking up all the mbufs.

To solve this, take if_xl's approach to the problem of encapsulation failure:
drop the packet.

MFC after:	3 days
2003-04-15 04:06:01 +00:00
Maxime Henrion
acabcf7d83 Correct maxsize/maxsegsz parameters to bus_dma_tag_create(). 2003-04-09 15:05:19 +00:00
Mike Silbersack
db5f2ca8df Fix if_vr's handling of vr_encap failures. 3 parts:
- Don't bother setting OACTIVE when the descriptors are all full
  or there's a vr_encap failure, it doesn't help anything.
- Correctly roll back on the descriptor list after a failure
  so as not to corrupt the list.
- Add a missing VR_UNLOCK().

Without these changes, vr_encap failure (which is assured during
a low mbuf situation) would result in the card locking until
the watchdog could fire.

MFC after:	1 week
2003-04-09 02:21:54 +00:00
Mike Silbersack
2590e88477 Quick fix so that the watchdog timer is not set unless packets are
actually queued for transmission.  Without this, a low memory situation
would trigger false watchdog timeouts.

MFC after:	1 week
2003-04-08 03:32:52 +00:00
Mike Silbersack
ee9ad95f0e Fix up callers of xl_encap so that they handle a failure response
properly (likely due to mbuf exhaustion.)  Previously, the driver
got somewhat wedged.

Also, remove the annoying messages printed every time xl_encap
couldn't allocate a mbuf; they served no useful purpose, and just made
an mbuf exhaustion situation more annoying.

MFC after:	1 week
2003-04-08 01:05:54 +00:00
Murray Stokely
887938c12f Fix typo.
PR:		kern/50504
Submitted by:	Alex Semenyaka <alexs@snark.ratmir.ru>
MFC after:	3 days
2003-04-07 10:06:48 +00:00
Maxime Henrion
cc9beb7b77 Use bus_dmamap_load_mbuf() instead of bus_dmamap_load() for the
RX part of this driver too.  It's better since the code wasn't
dealing with bus_dmamap_load() returning EINPROGRESS, and this
can't happen with bus_dmamap_load_mbuf().

Submitted by:	jake
2003-04-05 23:24:23 +00:00
David E. O'Brien
8368cf8f75 Use __FBSDID rather than rcsid[]. 2003-04-03 21:36:33 +00:00
Poul-Henning Kamp
6f46bf604d Fix KASSERT syntax error. 2003-04-01 08:57:28 +00:00
Poul-Henning Kamp
c8d01707ba Fix KASSERT syntax errors.
Please compile LINT before commiting.
2003-04-01 08:10:21 +00:00
John Baldwin
59f47d29b7 Add missing ()'s so that these drivers all compile again.
Noticed by:	jake
Tested on:	i386 (compile)
2003-03-31 20:22:00 +00:00
John Baldwin
726f07979c If we fail to find our PCI ID in attach (this should never happen), then
just return ENXIO directly instead of calling tl_detach() since that would
panic since the softc mutex isn't initialized until after this check.
2003-03-31 19:24:37 +00:00
Nate Lawson
54f1f1d1e6 Clean up locking and resource management for pci/if_*
- 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
2003-03-31 17:29:43 +00:00
Mike Silbersack
709b85c372 Switch rl_encap over to using m_defrag.
No functional change, the previous rl_encap was correct wrt long
mbuf chains; this just reduces code duplication.

MFC after:	2 weeks
2003-03-30 03:45:28 +00:00
Mike Silbersack
63b9b38eb8 Switch vr_encap over to using m_defrag instead of its own version
of the function.

No functional change, this driver already handled long mbuf chains
correctly.

MFC after:	2 weeks
2003-03-29 21:39:49 +00:00
Mike Silbersack
cda97c506e Update if_dc to use m_defrag, removing the semi-duplicate dc_coal
function.

Also, use m_defrag where appropriate to defrag long mbuf chains
in the same fashion as was done in if_sis.c.  Before this change,
if_dc would blow up and take down the interface if fed a really long
mbuf chain.

MFC after:	2 weeks
2003-03-29 21:27:07 +00:00
Mike Silbersack
58b2ce3bee Have sis_encap use m_defrag if:
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
2003-03-29 17:50:37 +00:00
Mike Silbersack
cb3b23ef1e Fix up the long mbuf chain recovery code to use m_defrag; the old
code messed up on B & C chipsets because it lost the packet header
and therefore the flag indicating the need for hardware checksums.

MFC after:	2 weeks
2003-03-29 06:34:25 +00:00
Jake Burkholder
227f9a1c58 - Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
  with PAE.
- Use this to represent physical addresses in the MI vm system and in the
  i386 pmap code.  This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
  detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by:	DARPA, Network Associates Laboratories
Discussed with:	re, phk (cdevsw change)
2003-03-25 00:07:06 +00:00
Matthew N. Dodd
868d8b6286 - Use if_broadcastaddr from struct ifnet rather than relying on
extern 'etherbroadcastaddr'.
- Make 'etherbroadcastaddr' static.

Reviewed by:	 imp
2003-03-21 17:53:16 +00:00
Mike Silbersack
af498ca9eb Make sure to free the correct resources when the card fails to attach
properly.  (Broken in the previous commit.)

Noticed by:	"Niels Chr. Bank-Pedersen" <ncbp@bank-pedersen.dk>
2003-03-19 01:48:14 +00:00
MIHIRA Sanpei Yoshiro
1017eea32d Add support for Planex FNW-3800-TX(CardBus 100M/10M).
Submitted by:	Kunihiro Arai <araik@attglobal.net>
Obtained from:	[bsd-nomads:16625]
2003-03-18 14:57:09 +00:00
Mike Silbersack
16a930f6cb Instead of relying on a compile time define to determine whether the xl
driver should use port or memory based IO, determine it dynamically
at runtime, preferring MMIO where possible.  This helps us support newer
arches which dislike port based access better.

Tested on i386 & sparc64, with 3c900, 905, 905b, and 905C cards.
(in varying combinations by both jake and myself)
2003-03-18 06:29:51 +00:00
Søren Schmidt
64eca1e1f2 Add pci id# for the sis648 2003-03-13 07:55:53 +00:00
Bosko Milekic
544244654a Fix bug introduced in 1.130. For the < MHLEN case, we should
be doing a m_gethdr(), not an m_get().

Pointed out by: Hiten Pandya <hiten@unixdaemons.com>
Pointy hat to: Me
2003-03-04 20:19:26 +00:00
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
Poul-Henning Kamp
dd7a14618b Spell noread() and nowrite() correctly (ie: not "NULL") 2003-03-02 19:23:31 +00:00
Dag-Erling Smørgrav
521f364b80 More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9). 2003-03-02 16:54:40 +00:00
Yoshihiro Takahashi
a5459e94a5 Use rman_get_start() to get start address of the resource. 2003-02-26 13:46:40 +00:00
Maxime Henrion
07159f9c56 Cleanup of the d_mmap_t interface.
- Get rid of the useless atop() / pmap_phys_address() detour.  The
  device mmap handlers must now give back the physical address
  without atop()'ing it.
- Don't borrow the physical address of the mapping in the returned
  int.  Now we properly pass a vm_offset_t * and expect it to be
  filled by the mmap handler when the mapping was successful.  The
  mmap handler must now return 0 when successful, any other value
  is considered as an error.  Previously, returning -1 was the only
  way to fail.  This change thus accidentally fixes some devices
  which were bogusly returning errno constants which would have been
  considered as addresses by the device pager.
- Garbage collect the poorly named pmap_phys_address() now that it's
  no longer used.
- Convert all the d_mmap_t consumers to the new API.

I'm still not sure wheter we need a __FreeBSD_version bump for this,
since and we didn't guarantee API/ABI stability until 5.1-RELEASE.

Discussed with:		alc, phk, jake
Reviewed by:		peter
Compile-tested on:	LINT (i386), GENERIC (alpha and sparc64)
Runtime-tested on:	i386
2003-02-25 03:21:22 +00:00
Marcel Moolenaar
907cf80fbf Remove support for running in SimOS. The support has rotted over
time and there's no indication that it will improve anytime soon.
By removing support for SimOS it is possible to build LINT on
Alpha, which is considered more important at the moment.

Not objected to on: alpha@
2003-02-25 00:42:40 +00:00
Dan Moschuk
25b803ef49 Add support for Peppercon ROL-F Card.
Submitted by: Sascha Holzeiter <sascha@root-login.org>
PR: 48559
2003-02-23 23:35:35 +00:00