Commit Graph

60 Commits

Author SHA1 Message Date
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
scw eeb9826d3b s/NPBFILTER/NBPFILTER/ in some #endif comments. No functional change. 2007-09-29 18:32:50 +00:00
dyoung 71e77a61b4 Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).
2007-08-26 22:45:55 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
dyoung b7dea03346 Make the members of the descriptors volatile, because the NIC and
the host share them.

Before breaking out of the loop over descriptors in gem_rint(),
DMA-resynchronize the first Rx descriptor we found that does not
belong to the host.  We must avoid a cached descriptor "covering"
a descriptor in RAM, because the cached descriptor may say that
the descriptor still belongs to the NIC, when that is not true,
and the driver will hang.

XXX I believe this driver only works by luck on hosts that both
XXX have a cacheline size greater than the size of a descriptor
XXX (16 bytes) and lack DMA/cache coherency.  I need to add some
XXX trickery to make sure that we don't scribble over the NIC's
XXX changes to a descriptor when we flush a cached descriptor to
XXX RAM with bus_dmamap_sync(9).
2007-04-12 06:14:40 +00:00
dyoung af26ee6d9c Use PRIx64 and PRIx32 format strings. Remark about lack of DMA
synchronization at some debug code that reads descriptors.
2007-04-12 05:56:01 +00:00
christos fffc9c66c9 fix fallout from caddr_t changes. 2007-03-04 07:54:07 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
christos 1665d5e960 fix spelling of accommodate; from Zapher. 2006-11-24 19:46:58 +00:00
martin 3a83155c93 Ooops - make it compile again. 2006-11-24 13:05:29 +00:00
martin bed31b2f32 In preparation for gem @ sbus: split the GEM registers into two halfs
and provide a bus_space_handle_t for each. While there, fix a typo
in gem_bitwait().
2006-11-24 13:01:07 +00:00
martin 22b629efe2 Fix an obvious copy&pasto and make it compile with GEM_DEBUG. 2006-11-23 18:41:25 +00:00
jmcneill f135e0d607 Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
2006-09-24 03:53:07 +00:00
sanjayl 265929b20e 1st cut of Powermac G5 support (uses bridge mode). 2006-08-05 21:26:48 +00:00
blymn a88dd3436a Clean up bogus whitespace 2006-05-26 12:52:45 +00:00
heas b6a4c18d48 Contribute to the rnd entropy pool (already attached as a source). 2006-01-02 05:46:25 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
christos daf2726a5c - delete ugly debugging crap.
- remove bogus multicast handling [pointed out by thorpej]
  and don't reset the chip on ENETRESET; ENETRESET is a sign
  that only the multicast filter needs changing.
2005-10-28 20:56:13 +00:00
christos ffd31cc9b5 According to thorpej, we don't need to stop when we attach. But then again
we don't detach yet...
2005-10-28 13:20:55 +00:00
christos dd3b850e80 From FreeBSD:
- make a few functions static
- introduce gem_bitwait() to factor out some of the register wait code.
- add gem_stop() in attach
- some DEBUG should be GEM_DEBUG
- handle underrun, packet too long, and overflow errors by resetting the chip
- add handler in ioctl for add/del multi
- fix typo
Also:
- add a shadow sc_if_flags member so that we don't reset the chip if we
  don't need to.
2005-10-28 00:01:53 +00:00
bouyer 78b08b48da Pad small packets with a static buffer at the end of the S/G list.
Avoids leaking kernel memory when small packets are transmitted.
Tested on a ibook G4.
2005-05-16 15:56:38 +00:00
yamt 330cc0a11e split IFCAP_CSUM_xxx to IFCAP_CSUM_xxx_Rx and IFCAP_CSUM_xxx_Tx. 2005-05-02 15:34:31 +00:00
heas e7144a2c1a Perform a s/w checksum for packets that are not the same length as the length
field of the IP header (ip->ip-len) indicates they should be.  This handles
the case where an ethernet frame has been padded to meet the minimum ethernet
frame length or erroneously (my cisco switch unnecessarily adds 4 bytes to its
SYN).  This padding will be included in the hardware checksum and may be
non-zero, thus making it incorrect.
2005-03-05 18:32:59 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
thorpej 2f8e8079d1 Define M_CSUM_DATA_IPv4_IPHL() and M_CSUM_DATA_IPv4_OFFSET() macros
to extract data from csum_data, rather than just open-coding it.
2005-02-21 02:12:48 +00:00
heas 9bcc8b955c Have the MAC strip the ethernet FCS on rx so it is not included in the hardware
checksum and add code to support IPv4 TCP/UDP hardware checksums.
2005-02-20 18:29:00 +00:00
perry 18db93c7f6 de-__P 2005-02-04 02:10:35 +00:00
thorpej a0c36aaebd Eliminate use of M_HASFCS. 2005-01-31 02:51:17 +00:00
thorpej e9818f5b5e When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
2004-10-30 18:08:34 +00:00
heas 4cec10fd22 Adjust/add a few comments and add defines for PCS (aka GEM_MII) FSM and
interrupt registers.
drop some trailing WS.

no functional changes.
2004-10-17 21:49:08 +00:00
christos 05f07448b6 Another possibly uninitialized lasttx 2003-10-26 19:11:33 +00:00
christos 93af726cde Don't return random garbage in the default case; return the smallest ring
descriptor instead.
2003-10-26 18:20:43 +00:00
chs f217b85c1f make this build with GEM_DEBUG. fix rxhist counters. 2003-08-24 18:07:03 +00:00
wiz 1ffa7b76c4 DMA, not dma nor Dma. 2003-05-03 18:10:37 +00:00
matt 65e5548a17 Add MBUFTRACE kernel option.
Do a little mbuf rework while here.  Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *).  These are not performance critical and making them
call m_get saves considerable space.  Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.
2003-02-26 06:31:08 +00:00
matt 4630a8e7f3 Add a MIIF_FORCEANEG flag to be passed to mii_attach. This forces an
autonegotiation to take place if IFM_AUTO is selected in mii_media_set.
Make the gem driver use it.  (XXX hme probably should use it but I can't
test that).
2003-02-20 00:55:21 +00:00
thorpej 749715f6ee Use aprint_*(). 2003-01-31 00:26:25 +00:00
fair 96b8b890ed Change the "dontcare bits" argument to ifmedia_init() to IFM_IMASK
so that it is possible select PHY instances other than the first
one (instance zero), if there is more than one PHY attached.
2002-10-22 00:01:55 +00:00
matt e25f13dfbe From OpenBSD:
- Fix one typo (instead of two disable_rx, one disable_rx and one disable_tx)
[The other bug fix isn't appropriate since the was OACTIVE is dealt with
has been changed in NetBSD.]
2002-08-28 17:46:58 +00:00
lukem 06de426449 SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field).  whilst it's O(n),
  this mirrors the functionality of SLIST_REMOVE() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
  this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
2002-06-01 23:50:52 +00:00
matt 496a3cb868 Let's put a s = splnet(); to match the splx(s); already in the routine.
(yes, we were doing an splx with an uninitialized variable).
2002-05-15 23:51:49 +00:00
matt a61a41b6b0 Only enable detailed evcnts if GEM_COUNTERS is defined. But always count
interrupts.
2002-05-15 21:05:23 +00:00
matt 486ad92d2a Add evcnt stuff for interrupts.
Fix receiver lockups.  When writing the RX Kick register, we need back up
on descriptor since we advanced one in the for loop.  That will be the
last descriptor we haven't processed which is what we should write.
2002-05-15 02:36:11 +00:00
matt d6f9a400fe Fix initialization of GEM_RX_MAC_INTR. 1 means mask. 2002-05-14 23:33:41 +00:00
matt 3b2e959dfc Supress RX_MAC interrupts regarding the FRAME_COUNT register. 2002-05-11 20:53:52 +00:00
matt c1fc5d35dc Many fixes. Multicast hash filter works now. Autonegotiation with GigE
on Mac G4's now works.  XXX Checksum offload still needs to be done.
2002-05-11 00:36:02 +00:00
matt 2f836188fb If the detected media is gigabit, change the gem to use GMII mode otherwise
switch back to MII mode.  Keep a sliding window for TX segments and when it
gets > 2/3 full, request a TX interrupt (window gets reset when the h/w TX
queue is empty).  Add dv_xname to a few printfs.  With the above changes,
the gem driver will now work on Macintoshes, even in GigE mode.  On a 733
PowerMac G4 it gets ~355Mb/s TX and ~280Mb/s RX to/from an Alpha XP1000.

XXX mii autoselect is still flakey.
2002-05-08 02:12:55 +00:00
matt 8a30192c27 Correct a comment and cleanup slightly how the local ethernet is programmed
into the chip.
2002-03-29 00:00:10 +00:00
eeh 160abd5faf Remove some obsolete code. 2002-01-19 03:16:38 +00:00
thorpej 1466b9ca1d Back out the last two changes I made to this driver -- some people
have reported lossage.
2001-11-17 00:56:04 +00:00