Commit Graph

284 Commits

Author SHA1 Message Date
Martin Blapp
593a1aea1a Fix card/device names, no functional change
The ADMtek AN985 is the cardbus variant of ADMtek AN983
The Netgear FA511 is just a relabled ADMtek AN985

PR:		kern/50574
MFC after:	1 month
2010-01-03 13:59:59 +00:00
Robert Watson
eb956cd041 Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/
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
2009-06-26 11:45:06 +00:00
Attilio Rao
1abcdbd127 When user_frac in the polling subsystem is low it is going to busy the
CPU for too long period than necessary.  Additively, interfaces are kept
polled (in the tick) even if no more packets are available.
In order to avoid such situations a new generic mechanism can be
implemented in proactive way, keeping track of the time spent on any
packet and fragmenting the time for any tick, stopping the processing
as soon as possible.

In order to implement such mechanism, the polling handler needs to
change, returning the number of packets processed.
While the intended logic is not part of this patch, the polling KPI is
broken by this commit, adding an int return value and the new flag
IFCAP_POLLING_NOCOUNT (which will signal that the return value is
meaningless for the installed handler and checking should be skipped).

Bump __FreeBSD_version in order to signal such situation.

Reviewed by:	emaste
Sponsored by:	Sandvine Incorporated
2009-05-30 15:14:44 +00:00
Marius Strobl
b54282f61e - Set MIIF_NOLOOP and don't add IFM_LOOP as loopback apparently isn't
supported with these pseudo-PHYs. The MIIF_NOLOOP flag currently triggers
  nothing but hopefully will be respected by mii_phy_setmedia() later on.
- Don't add IFM_NONE as isolation isn't supported by these pseudo-PHYs.
- Use mii_phy_add_media() instead of mii_add_media() so the latter can
  be eventually retired.
2009-03-19 22:34:55 +00:00
Warner Losh
155a83e87a remove now-redunant cardbus attachment. 2009-03-09 13:23:54 +00:00
Marius Strobl
155781198a - According to the corresponding Linux, NetBSD and OpenSolaris
drivers, there should be a 1us delay after every write when
  bit-banging the MII. Also insert barriers in order to ensure
  the intended ordering. These changes hopefully will solve the
  bus wedging occasionally experienced with DM9102A since r182461.
- Deobfuscate dc_mii_readreg() a bit.
2008-12-07 23:02:37 +00:00
Marius Strobl
36bef328f5 cosmetic changes and style fixes 2008-09-30 20:53:15 +00:00
Marius Strobl
d0d67284f8 For chips with a broken DC_ISR_RX_STATE which f.e. never signals
stopped nor the waiting state and also no other means to check
whether the receiver is idle (see also r163774), we have no choice
than to call mii_tick(9) unconditionally even in the case of the
DC_REDUCED_MII_POLL handling as far as the RX side is concerned.
This isn't necessarily worse than checking whether RX is idle
though because unlike as with TX we're racing with the hardware,
which might receive packets any time while we poll the MII, anyway.

Reported and tested by:	Jacob Owens
Reviewed by:		yongari
MFC after:		3 days
2008-08-29 20:31:41 +00:00
Marius Strobl
993a741ac6 - Use m_collapse(9) instead of m_defrag(9) if possible. This results
in a noticeable reduction in system time spent.
- If bus_dmamap_load_mbuf_sg(9) fails with EFBIG and we already have
  defragmented the mbuf chain, don't bother to defragment and load it
  a second time just yet as it's likely to fail again anyway.

MFC after:	3 days
2008-08-23 20:57:48 +00:00
Pyun YongHyeon
2e3d4b798b Ethernet hardware address stored in DC_AL_PAR0/DC_AL_PAR1 register
is in little endian form. Likewise setting DC_AL_PAR0/DC_AL_PAR1
register expect the address to be in little endian form. For big
endian architectures the address should be swapped to get correct
one.
Change setting/getting ethernet hardware address to big endian
architecture frendly.

Reported by:	Robert Murillo ( billypilgrim782001 at yahoo dot com )
Tested by:	Robert Murillo ( billypilgrim782001 at yahoo dot com )
2008-06-08 02:52:26 +00:00
Marius Strobl
ebc284cc83 - Const'ify the dc_devs array.
- Correct the maxsize parameter when creating the mbufs busdma tag to
  reflect the actual requirement of dc(4).
- Move the KASSERT in dc_newbuf() to the right spot.
- Also convert the TX side to take advantage of bus_dmamap_load_mbuf_sg(9).
- Move the comment regarding dc_start_locked() to the right spot.

MFC after:	2 weeks
2008-03-24 17:38:24 +00:00
Pyun YongHyeon
6a087a8722 Fix function prototype for device_shutdown method. 2007-11-22 02:45:00 +00:00
Pyun YongHyeon
d612cc5947 IEEE 802.3 Annex 28B.3 explicitly specifies the following relative
priorities of the technologies supported by 802.3 Selector Field
value.

1000BASE-T full duplex
1000BASE-T
100BASE-T2 full duplex
100BASE-TX full duplex
100BASE-T2
100BASE-T4
100BASE-TX
10BASE-T full duplex
10BAST-T

However PHY drivers didn't honor the order such that 100BASE-T4 had
higher priority than 100BASE-TX full duplex. Fix that long standing
bugs such that have PHY drivers choose the highest common denominator
ability.
Fix a bug in dcphy which inadvertently aceepts 100BASE-T4.

PR:	92599
2007-11-16 10:25:36 +00:00
Marius Strobl
82a67a70a2 o In order to reduce bug and code duplication fold handling of NICs
requiring DC_TX_ALIGN or DC_TX_COALESCE, which was previously done
  in dc_start_locked(), into dc_encap().
o In dc_encap():
  - If m_defrag() fails just drop the packet like other NIC drivers
    do. This should only happen when there's a mbuf shortage, in which
    case it was possible to end up with an IFQ full of packets which
    couldn't be processed as they couldn't be defragmented as they
    were taking up all the mbufs themselves. This includes adjusting
    dc_start_locked() to not trying to prepend the mbuf (chain) if
    dc_encap() has freed it.
  - Likewise, if bus_dmamap_load_mbuf() fails as dc_dma_map_txbuf()
    failed, free the mbuf possibly allocated by the above call to
    m_defrag() and drop the packet.
o In dc_txeof():
  - Don't clear IFF_DRV_OACTIVE unless there are at least 6 free TX
    descriptors. Further down the road dc_encap() will bail if there
    are only 5 or fewer free TX descriptors, causing dc_start_locked()
    to abort and prepend the dequeued mbuf again so it makes no sense
    to pretend we could process mbufs again when in fact we won't.
    While at it replace this magic 5 with a macro DC_TX_LIST_RSVD.
  - Just always assign idx to sc->dc_cdata.dc_tx_cons; it doesn't
    make much sense to exclude the idx == sc->dc_cdata.dc_tx_cons
    case.
o In dc_dma_map_txbuf() there's no need to set sc->dc_cdata.dc_tx_err
  to error if the latter is != 0, bus_dmamap_load_mbuf() already
  returns the same error value in that case anyway.
o For less overhead, convert to use bus_dmamap_load_mbuf_sg() for
  loading RX buffers.
o Remove some banal and/or outdated comments.

Approved by:	re (kensmith)
MFC after:	1 week
2007-08-05 11:28:19 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
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@
2007-02-23 12:19:07 +00:00
Marius Strobl
3e0e67263b Fix a bug originally introduced in rev. 1.74; don't reloaded the
watchdog timer in dc_txeof() in case there are still unhandled
descriptors as dc_poll() invokes dc_poll() unconditionally.
Otherwise this would result in the watchdog timer constantly being
being reloaded and thus circumvent that the watchdog ever fires in
the DEVICE_POLLING case.

Pointed out by:	bde
2006-12-20 01:49:56 +00:00
Marius Strobl
b1d161435e - Use our own callout (the dc_tick() callout uses varying periods
depending on the NIC and isn't used at all with HomePNA links)
  instead of if_slowtimo() for driving dc_watchdog() in order to
  avoid races accessing if_timer.
- Use bus_get_dma_tag() so dc(4) works on platforms requiring it.
- Don't bother to set if_mtu to ETHERMTU, ether_ifattach() does that.
- Remove an alpha remnant in dc_softc.
2006-12-06 01:56:38 +00:00
Marius Strobl
9e264172bd Remove <sys/types.h>; including both <sys/param.h> and <sys/types.h>
violates style(9).
2006-11-02 00:05:15 +00:00
Marius Strobl
432120f2bb - Wrap code optimized for architectures without alignment constraints
in #ifdef __NO_STRICT_ALIGNMENT rather than #ifdef __i386__. This
  means that amd64 now also uses the optimized code. [1]
  While at it, fix a nearby style(9) bug.
- Remove the hw.dc_quick SYSCTL, which allowed to turn off the above
  mentioned optimization, as like the equivalent and already removed
- In dc_setcfg() suppress printing a warning when forcing the receiver
  and transceiver to idle state times out for chips where the status
  bits in question just never change (observed in detail with DM9102A)
  and therefore the warning would be highly likely false positive. [2]
- In dc_ifmedia_sts() add a missing DC_UNLOCK().

Tested by:	Hans-Joerg Sirtl on amd64 [1]
PR:		82681 [2]
Obtained from:	NetBSD tlp(4) [2]
MFC after:	1 week
2006-10-29 20:24:27 +00:00
Gleb Smirnoff
6b9f5c941c - Consistently use if_printf() only in interface methods: if_start(),
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>
2006-09-15 15:16:12 +00:00
Pyun YongHyeon
07c4a8dfa6 Replace hard-coded magic constants to system defined constants
(BUS_PROBE_DEFAULT, BUS_PROBE_GENERIC etc). These pseudo PHY
drivers were forgotten from the conversion due to the repo copy
to dc driver location.
2006-08-02 05:28:52 +00:00
Gleb Smirnoff
177625694d Fix the last commit.
Submitted by:	jhb
Pointy hat to:	glebius
2006-06-08 08:15:21 +00:00
Gleb Smirnoff
f67dea8260 Add device IDs for Linksys PCMPC200 Cardbus card.
PR:		kern/75582
Submitted by:	Gary Palmer
2006-06-07 12:26:23 +00:00
John Baldwin
1e2e70b1d6 - Switch on the full 32-bit device ID to avoid collisions between the
vendor-specific device ids across vendors.
- Include the revision in the dc_devs[] array instead of special casing
  the revid handling in dc_devtype().
- Use PCI bus accessors to read registers instead of pci_read_config()
  where possible.
- Use an 8-bit write to update the latency timer.
- Use PCIR_xxx constants and remove unused DC_xxx related to standard
  PCI config registers.

MFC after:	1 week
2006-06-03 20:41:55 +00:00
John Baldwin
344823993b Use PCI bus accessors rather than reading config registers directly to
get the subvendor device id.
2006-06-03 20:37:56 +00:00
John Baldwin
73dbd3da73 Remove various bits of conditional Alpha code and fixup a few comments. 2006-05-12 05:04:46 +00:00
John Baldwin
9be0993cdb Add device-id for the Neteasy DRP-32TXD cardbus 10/100 card. It's another
ADMTek AN985 clone.

MFC after:	3 days
Tested by:	Lila liladude at aruba dot it
2006-03-16 20:00:39 +00:00
Gleb Smirnoff
23033eebf4 Do not touch ifp->if_baudrate in miibus aware drivers. 2006-02-14 12:44:56 +00:00
Gleb Smirnoff
5108cc565a Add missing parens.
Submitted by:	njl
2005-12-28 18:00:37 +00:00
Gleb Smirnoff
7ed2454cb3 Check for IFF_DRV_RUNNING in the interrupt loop.
Reported & tested by:	Martin P. Hansen <mph lima.dyndns.dk>
2005-12-28 13:21:05 +00:00
Marius Strobl
802cab0330 - Rev. 1.175 fixed compilation on sparc64 but also backed out zeroing of
the eaddr array (introduced in rev. 1.174) prior to writing to it. As
  dc_read_eeprom() is told to write only 3 16-bit words to eaddr but eaddr
  in fact is somewhat larger removal of the zeroing defeated the check
  whether the MAC address is all zero as there can be some random garbage
  in eaddr past the 3 words written to it and the check verifys all bits
  in eaddr. Solve this by changing the check to verify only the 3 words
  (happenning to be ETHER_ADDR_LEN bytes) written to eaddr.
- While here change the notation of "FCode" in a nearby comment to the
  official way.

Ok'ed by:	marcel, ru
2005-12-05 12:32:20 +00:00
Ruslan Ermilov
8069c79ddd Fix on sparc64. 2005-12-04 07:45:12 +00:00
Marcel Moolenaar
8df1ebe9aa Fix the misalignment bugs differently than was done in the previous
commit. Copy the ethernet address into a local buffer, which we know
is sufficiently aligned for the width of the memory accesses that we
do. This also eliminates all suspicious and potentionally harmful
casts.

In collaboration with: ru
2005-12-02 01:23:20 +00:00
Marcel Moolenaar
829733d045 Resolve misalignment traps caused by changes to IF_LLADDR().
Use de16dec() and le16dec() to fetch the link-level address
from struct ifnet.

Tested on: alpha
Reviewed by: jhb
See also: de(4)
2005-11-22 01:51:57 +00:00
Ruslan Ermilov
4a0d6638b3 - Store pointer to the link-level address right in "struct ifnet"
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.
2005-11-11 16:04:59 +00:00
Warner Losh
6a3033a8b4 Make dc compile after repo-copy. 2005-10-18 06:09:42 +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
Warner Losh
7d830ac9c2 Use ansi function definitions in preference to K&R to reduce diffs
with NetBSD (and cause it looks cooler).
2005-09-30 19:39:27 +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
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
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
22f6205d3b Use device_printf() and if_printf() and remove dc_unit from softc. 2005-08-10 20:33:46 +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
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
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
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
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
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
Warner Losh
60727d8b86 /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Maxime Henrion
8c7ff1f331 Read the MAC address in the EEPROM in the correct byte order. This
is a no-op on little endian architectures, but fixes getting the MAC
address for some dc(4) cards on big endian architectures.

This is a RELENG_5 candidate.

Tested by:	gallatin (powerpc), marius (sparc64)
First version of the patch written by:	gallatin
2004-10-01 15:23:31 +00:00
Brian Feldman
cbaf877f7d Add ALTQ support for dc(4), based upon a mostly-working patch from mlaier. 2004-10-01 07:04:09 +00:00
Brian Feldman
3d57a2e58e Conditionalize IFF_NEEDSGIANT, like everything else here, on IS_MPSAFE.
The driver doesn't look any less safe without Giant than with, and works
with IS_MPSAFE set to 1 here, so others should probably test it as such.
2004-10-01 07:01:38 +00:00
Robert Watson
5162f7de6f if_dc includes locking, but that locking is disabled by a #ifdef
by default.  As such, mark if_dc as IFF_NEEDSGIANT until such
time as appropriate locking review and testing can take place,
and the locking can be enabled by default.

RELENG_5 candidate.
2004-08-25 03:37:25 +00:00
Marius Strobl
b7b6c9e6fa - Make OF_getetheraddr() honour the "local-mac-address?" system config
variable. If set to "true" OF_getetheraddr() will now return the unique
  MAC address stored in the "local-mac-address" property of the device's
  OFW node if present and the host address/system default MAC address if
  the node doesn't doesn't have such a property. If set to "false" the
  host address will be returned for all devices like before this change.
  This brings the behaviour of device drivers for NICs with OFW support/
  FCode, i.e. dc(4) for on-board DM9102A on Sun machines, gem(4) and hme(4),
  regarding "local-mac-address?" in line with NetBSD and Solaris.
  The man pages of the respective drivers will be updated separately to
  reflect this change.
- Remove OF_getetheraddr2() which was used as a stopgap in dc(4). Its
  functionality is now part of OF_getetheraddr().
2004-08-14 21:43:37 +00:00
Bruce M Simpson
fdafab8443 Whitespace nits 2004-07-05 22:35:18 +00:00
Warner Losh
2756272aea Remove saved_* from dc_softc. They are now no longer needed.
Submitted by: Marius Strobl
2004-06-29 20:38:44 +00:00
Warner Losh
c3e7434f34 Remove burn bridges code that saved/restored the pci config registers
that are now handled in the pci bus layer.  They are no longer
necessary.
2004-06-28 20:07:03 +00:00
Christian Weisgerber
0e939c0cea Replace handrolled CRC calculation with ether_crc32_[lb]e(). 2004-06-09 14:34:04 +00:00
Poul-Henning Kamp
f11d01c3bc Add missing <sys/module.h> includes 2004-05-30 20:00:41 +00:00
Marius Strobl
b78791d37e Spelling fix in a comment. 2004-05-29 18:13:44 +00:00
Marius Strobl
50aa106108 Remove double __FBSDID and move the remaining one into a common place after
the license(s) and before the driver comment (the latter only in drivers not
having __FBSDID at that location).
2004-05-29 18:09:10 +00:00
Yaroslav Tykhiy
25fbb2c38c A handler for ioctl(SIOCSIFCAP) should not alter a bit in
if_capenable unless the interface driver is actually able
to toggle the respective capability on and off.

Reviewed by:	ru
2004-05-23 21:05:08 +00:00
Andre Oppermann
9a54cbb95d Correct the phy_service() routine case MII_TICK to correctly track
the falling edge of a media state change.

This is in preparation for media state change notification to the
routing socket.

No objections by:	sam, wpaul, ru, bms
Brucification by:	bde
2004-05-03 13:01:34 +00:00
Ruslan Ermilov
e695984e6f First driver with user-configurable polling(4). 2004-04-11 13:47:15 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Matthew N. Dodd
e3bbbec2ca Announce ethernet MAC addresss in ether_ifattach(). 2004-03-14 07:12:25 +00:00
Maxime Henrion
ec6a729924 Some integrated Davicom cards in sparc64 boxes have an all zeros
MAC address in the EEPROM, and we need to get it from OpenFirmware.
This isn't very pretty but time is lacking to do this in a better
way this near 5.2-RELEASE.  This is a RELENG_5_2 candidate.

Original version by:	Marius Strobl <marius@alchemy.franken.de>
Tested by:		Pete Bentley <pete@sorted.org>
Reviewed by:		jake
2004-01-08 19:08:27 +00:00
Don Lewis
4ff4a9bee9 The transmit frame status is stored in the last transmit descriptor for the
frame, not the first.  It is probably also not safe to free the mbuf chain
as soon as the OWN bit is cleared on the first descriptor since the chip
may not be done copying the frame into the transmit FIFO.  Revert the part of
of busdma conversion (if_dc.c rev 1.115) which changed dc_txeof() to look for
the status in the first descriptor and free the mbuf chain when processing
the first descriptor for the frame, and revert the matching changes elsewhere
in the driver.  This part of the busdma change caused the driver to report
spurious collisions and output errors, even when running in full-duplex mode.
Reverting the mbuf chain handling slightly complicates dc_dma_map_txbuf(),
since it is responsible for setting the OWN bits on the descriptors, but does
not normally have direct access to the mbuf chain.

Tested by:
  Dejan Lesjak <dejan.lesjak at ijs.si>  alpha/<Intel 21143 10/100BaseTX>
  "Xin LI" <delphij at frontfree.net>    i386/<Macronix 98713 10/100BaseTX>
  Wiktor Niesiobedzki <bsd at w.evip.pl> i386/<3Com OfficeConnect 10/100B>

Reviewed by:	mux
2004-01-08 06:22:15 +00:00
MIHIRA Sanpei Yoshiro
773c505f3c Add support for ELECOM/Laneed CardBus FastEtherner Card(LD-CBL/TXA)
Submitted by:	Masahiro Yamagishi <night@pluto.dti.ne.jp>
Approved by:	re (scottl)
2003-12-06 02:29:31 +00:00
Warner Losh
347934fa63 Sometimes cardbus attachments don't attach, so while we track down
this problem put these lines back in.  While they should be
unnecessary, they appear to be sometimes necessary.

Reviewed in concept: dfr
Approved by: re (scottl@)
2003-11-28 05:28:29 +00:00
Sam Leffler
5120abbfb4 Drop the driver lock around calls to if_input to avoid a LOR when
the packets are immediately returned for sending (e.g.  when bridging
or packet forwarding).  There are more efficient ways to do this
but for now use the least intrusive approach.

Reviewed by:	imp, rwatson
2003-11-14 19:00:32 +00:00
David E. O'Brien
4dc52c32bf Remove duplicate FBSDID's, move others to their right place. 2003-11-14 17:16:58 +00:00
Warner Losh
3373489b49 reconst poison
re-de u_intXX_t
2003-11-14 05:45:39 +00:00
David E. O'Brien
aa8255025a Try to create some sort of consistency in how the routings to find the
multicast hash are written.  There are still two distinct algorithms used,
and there actually isn't any reason each driver should have its own copy
of this function as they could all share one copy of it (if it grew an
additional argument).
2003-11-13 20:55:53 +00:00
Doug Rabson
0be389f3ca Remove explicit cardbus attachments from drivers where this is identical
to the pci attachment. Cardbus is a derived class of pci so all pci
drivers are automatically available for matching against cardbus devices.

Reviewed by: imp
2003-11-03 09:22:18 +00:00
Ruslan Ermilov
05992bb56b Correct the spelling of m_devget() in the sysctl variable description. 2003-11-02 21:43:29 +00:00
Brooks Davis
9bf40ede4a Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
Warner Losh
9d51aaa4e8 Const poison crc routines (why these aren't centralized, I'm not sure). 2003-10-23 16:57:38 +00:00
Mike Silbersack
a10c0e4574 Fix a problem where m_defrag would allocate a new mbuf to replace the
chain passed into dc_encap, which dc_start was unaware of.  This caused
the old (now invalid) mbuf to be passed to BPF_MTAP.

Spotted by:	Kenjiro Cho <kjc@csl.sony.co.jp>
2003-10-19 23:05:19 +00:00
Martin Blapp
87f4fa1512 Ignore CSR13, CSR14, CSR15 'Media Specific Data' registers
for 21143 based cards which use SIA mode.

This fixes 10mbit mode for ZNYX ZX346Q cards and other
21143 based cards.

PR:		32118
Submitted by:	Rene de Vries <rene@tunix.nl>
		Geert Jan de Groot <GeertJan.deGroot@tunix.nl>

Obtained from:	BSDI

MFC after:	2 weeks
2003-10-05 19:57:10 +00:00
Martin Blapp
129eaf7996 Don't read the MAC address from a copy of the EEPROM in the softc
that has been recorded earlier and overwrite it again later by
reading it directly from the EEPROM again.

Read the MAC address from the PAR0/PAR1 registers instead, which
are autoloaded on reboot.

Tested on AN985, AN983B. According to the datasheets, it should
also work for the AL981 (I don't have such a chip on a card at home)

PR:             52988
Submitted by:   Andrew Gordon <arg-bsd@arg.me.uk>
MFC after:      2 weeks
2003-09-16 05:01:27 +00:00
John Baldwin
e27951b29c Use PCIR_BAR(x) instead of PCIR_MAPS.
Glanced over by:	imp, gibbs
Tested by:		i386 LINT
2003-09-02 17:30:40 +00:00
Martin Blapp
4a80e74bf3 All davicom cards seem to need DC_TX_ALIGN. 2003-08-27 08:13:34 +00:00
Martin Blapp
7dfdc26c46 Make TX on davicom 9102A working again. This chip needs
its mbufs aligned on TX.

PR:		53656, 42714
MFC after:	3 days
2003-08-24 23:47:44 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
19b7ffd1b8 Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 07:20:27 +00:00
Warner Losh
38d8c9940b Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 06:42:59 +00:00
Sam Leffler
c06eb4e293 Change instances of callout_init that specify MPSAFE behaviour to
use CALLOUT_MPSAFE instead of "1" for the second parameter.  This
does not change the behaviour; it just makes the intent more clear.
2003-08-19 17:51:11 +00:00
Maxime Henrion
aafb3ebbe3 Use the BUS_DMA_ZERO flag. 2003-07-27 14:00:02 +00:00
Warner Losh
4c16d09eda Add support for FA-511; Submitted by: Kenneth P. Stox; Pr 42858 2003-07-19 06:01:15 +00:00
Bill Paul
e7b9ab3aaa Add support for a bunch of Microsoft networking products:
- MN-110 10/100 USB ethernet (ADMtek Pegasus II, if_aue)
- MN-120 10/100 cardbus (ADMtek Centaur-C, if_dc)
- MN-130 10/100 PCI (ADMtek Centaur-P, if_dc)

Also update dc(4) man page to mention support for MN-120 and MN-130.
2003-07-10 18:43:17 +00:00
Maxime Henrion
af4358c71e Make the dc(4) driver endian-clean, so to that it works on sparc64.
There are such cards in Netra X1 boxes, which should thus be fully
supported now.

Tested by:	jake
2003-07-09 15:03:10 +00:00
Maxime Henrion
56e5e7ae57 Convert the dc(4) driver to the busdma API. This is a necessary step
to have this driver working on sparc64.  It still needs to be made
endian-clean before it can work there.

Special thanks to dragonk@evilcode.net for sending me a dc(4) card so
that I was able to do this work.

Many cheers to all the people that tested this change, thanks to them,
this change shouldn't break anything :-).

Tested by:	marcel (i386 and ia64), ru (i386), wilko (alpha),
		mbr (i386), wpaul (i386) and
		Will Saxon <WillS@housing.ufl.edu> (i386)
2003-07-06 21:45:31 +00:00