Commit Graph

69 Commits

Author SHA1 Message Date
Maxim Konovalov
727e7d8621 o Fix printf(9) formatting: do not use hardcode "0x" and "#" flags
simultaneously.  Remove "#' flag to match a style of the rest of
file.

PR:		kern/85477
Submitted by:	Oliver Fromme
2006-04-15 11:41:40 +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
Ruslan Ermilov
f5071cacb1 Catch up with IFP2ENADDR() type change (array -> pointer). 2005-11-11 12:17:31 +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
Warner Losh
3dd22bbe78 Other changes to this driver preclude its use on 4.x, so remove 4.x compat
code elsewhere in the driver.
2005-08-07 23:16:22 +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
Warner Losh
730b64121c Fix a couple of leaking situations when errors happen. 2005-07-15 06:08:26 +00:00
Warner Losh
8eed5fe88e Stop using OLDCARD shims. rename xe_pccard_match to xe_pccard_probe
and combine the old xe_pccard_{probe,attach} into one routine _attach.
Create a lookup function to lookup items in the table.  Eliminate the
check for network cards, since many modems were eliminated by it.
Tweak a few printfs as well.

This gets many of my older cards working again CEM2, CEM28, CEM36,
etc.
2005-07-13 14:57:36 +00:00
Brooks Davis
fc569a7488 Remove a duplicate assignment.
Reported by:    delphij
Approved by:	re (ifnet blanket)
2005-06-14 17:38:36 +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
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Robert Watson
7e3a88ea3c Since if_xe doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-14 00:15:26 +00:00
Christian Weisgerber
ea48e26883 Replace convoluted and broken CRC calcuation with ether_crc32_le().
This should fix multicast reception.
2004-06-09 00:30:11 +00:00
Maxime Henrion
866a788cc2 We don't need to initialize if_output, ether_ifattach() does it
for us.
2004-05-23 16:11:53 +00:00
Luigi Rizzo
0318355d0e Remove improper use of if_addrhead in device drivers to check
if the link-level address has been initialized already.

The majority of modern drivers never does this and works fine, which
makes me think that the check is totally unnecessary and a residue
of cut&paste from other drivers.

This change is done to simplify locking because now almost none of the
drivers uses this field. The exceptions are "ct" "ctau" and "cx"
where i am not sure if i can remove that part.
2004-04-15 20:31:10 +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
David E. O'Brien
a55a017f42 Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.
Requested by:	bde,imp
2003-12-08 07:54:15 +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
Scott Mitchell
e0bd2c16cc Disable the (currently unused) xe_reg_dump() function, until I know for
sure that it's not needed any more.

Reviewed by:	imp (mentor)
2003-11-06 08:54:43 +00:00
Warner Losh
5cf7816f16 Make xe_reg_dump non-static to avoid warnings (and tinerbox mail)
for now.
2003-11-05 08:27:13 +00:00
Scott Mitchell
e24e36cbe2 Convert XE_DEBUG define to hw.xe.debug sysctl, to set debug logging level
from the xe driver.  Should probably be removed when current probe/attach
problems with the driver are fixed, but is useful now when requesting
diagnostic information from users.

Reviewed by:	imp (mentor)
2003-11-04 21:09:37 +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
Brooks Davis
c020a92f9f There is no way to enter the attach routine twice with the same softc
without a detach call in between so don't try to deal with that
possiability.

This is a diff-reduction commit for the upcoming if_xname conversion.
2003-10-30 19:45:58 +00:00
Scott Mitchell
846b8315a2 Major update to xe driver:
- Make multicast work
- Fix (some of) the watchdog timeouts after card reset
- Add support for CE2, CEM28 and CEM33 cards
- General code cleanup

Any card that worked previously should still work, as well as a lot that
didn't.

The driver is not yet style(9) compliant; those changes are forthcoming,
once the functional changes are done.

PR:		kern/50644
Reviewed by:	imp
Approved by:	imp
2003-10-14 22:51:35 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Poul-Henning Kamp
85dc30cf82 Remove unused variable(s).
Put XXX comment where intent is unclear.

Found by:       FlexeLint
2003-05-31 20:27:42 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Joerg Wunsch
501901c61d The Xircom hardware always delivers received packets with the FCS appended.
Thus, mark the M_HASFCS flag so the generic ethernet layers will account
for this.
2003-01-29 15:19:20 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Martin Blapp
e808cf6260 When reading PHY regs over the i2c bus, the turnaround ACK bit
is read one clock edge too late. This bit is driven low by
slave (as any other input data bits from slave) when the clock
is LOW. The current code did read the bit after the clock was
driven high again.

Reviewed by:	luoqi
MFC after:	2 weeks
2003-01-10 08:09:58 +00:00
Sam Leffler
673d91916d network interface driver changes:
o don't strip the Ethernet header from inbound packets; pass packets
  up the stack intact (required significant changes to some drivers)
o reference common definitions in net/ethernet.h (e.g. ETHER_ALIGN)
o track ether_ifattach/ether_ifdetach API changes
o track bpf changes (use BPF_TAP and BPF_MTAP)
o track vlan changes (ifnet capabilities, revised processing scheme, etc.)
o use if_input to pass packets "up"
o call ether_ioctl for default handling of ioctls

Reviewed by:	many
Approved by:	re
2002-11-14 23:54:55 +00:00
Brooks Davis
13d4f45b18 Use if_printf(ifp, "foo") instead of printf("xe%d: foo", ifp->it_unit). 2002-10-01 01:03:02 +00:00
Warner Losh
375b025257 Remove an unused variable. 2002-02-26 03:37:35 +00:00
Takeshi Shibagaki
16f27fa757 Update xe driver to probe and attach in a NEWCARD kernel.
And separate probe and attach routine for PC Card from if_xe.c
to if_xe_pccard.c.

Reviewed by: imp
2002-02-20 14:23:58 +00:00
Warner Losh
0f78b1c02b Add some seat belts. If we set the error rc, then return it and don't
pretend things succeeded.  This can happen if the address returned
form bus_alloc_resource for the cis memory is occupied by some of
thing.
2001-08-29 05:11:44 +00:00
Poul-Henning Kamp
6817526d14 Convert if_multiaddrs from LIST to TAILQ so that it can be traversed
backwards in the three drivers which want to do that.

Reviewed by:    mikeh
2001-02-06 10:12:15 +00:00
Poul-Henning Kamp
fc2ffbe604 Mechanical change to use <sys/queue.h> macro API instead of
fondling implementation details.

Created with: sed(1)
Reviewed by: md5(1)
2001-02-04 13:13:25 +00:00
John Baldwin
1c827e2d15 Tag unused functions with __unused. 2001-01-23 22:24:26 +00:00
Garrett Wollman
0a2c3d48c6 select() DKI is now in <sys/selinfo.h>. 2001-01-09 04:33:49 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Archie Cobbs
21b8ebd926 Make all Ethernet drivers attach using ether_ifattach() and detach using
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
2000-07-13 22:54:34 +00:00
Warner Losh
ce1dd19461 Remove the XE_DEBUG define. It shouldn't be defined now that things
are working.  Add a small blurb about XE_DEBUG as it might be useful
to some people troubelshooting problems in the future.

Submitted by:	"Kevin Oberman" <oberman@es.net>
2000-07-10 16:46:21 +00:00
Warner Losh
c373152ae6 Add support for the modem side of the 56k combo card.
Submitted by:	Duncan Barclay <dmlb@ragnet.demon.co.uk>
2000-05-30 05:42:57 +00:00
Archie Cobbs
2e2de7f23f Move code to handle BPF and bridging for incoming Ethernet packets out
of the individual drivers and into the common routine ether_input().
Also, remove the (incomplete) hack for matching ethernet headers
in the ip_fw code.

The good news: net result of 1016 lines removed, and this should make
bridging now work with *all* Ethernet drivers.

The bad news: it's nearly impossible to test every driver, especially
for bridging, and I was unable to get much testing help on the mailing
lists.

Reviewed by:	freebsd-net
2000-05-14 02:18:43 +00:00
Warner Losh
de3958c256 Now that I've got reports that this works, let's turn the debugging off.
MIHIRA-san pointed out that debugging is rather big for tcpdump...

Submitted by:	sanpei@sanpei.org (MIHIRA Yoshiro)
2000-05-01 04:41:04 +00:00
Warner Losh
f490231eb3 Return 0 from attach.
Submitted by: mihira-san <sanpei@sanpei.org>
2000-04-29 17:43:12 +00:00
Warner Losh
58af1c5edd First cut at adding CIS reading to xe driver. I don't have a card
that seems to be working (I have a MF card that has a 336 modem and
ethernet that the probe routine finds, but the attach fails on because
pccardd doesn't do what you'd like with MF cards all the time).
2000-04-25 06:09:54 +00:00
Warner Losh
db5ca7b1d2 o Preliminary support for mapping the CIS by the driver.
o Modify xe driver to use this.

There's still some issues with this code, so xe can't map the cis just
yet.  I'm thinking about how to resolve the issue.  pccard_nbk's
pccard_alloc_resource is getting in the way.
2000-04-20 08:37:46 +00:00
Poul-Henning Kamp
3389ae9350 Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>
2000-04-19 14:58:28 +00:00