Commit Graph

139 Commits

Author SHA1 Message Date
glebius
f90db41611 MFC:
Do not touch ifp->if_baudrate in miibus aware drivers.

Approved by:	re (scottl)
2006-03-17 21:30:57 +00:00
delphij
3527f35222 MFC (by ru)
| 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.
|
| Revision  Changes    Path
| 1.168     +2 -2      src/sys/pci/if_dc.c
| 1.75      +2 -2      src/sys/pci/if_pcn.c
| 1.156     +3 -5      src/sys/pci/if_rl.c (already merged)
| 1.87      +2 -2      src/sys/pci/if_sf.c
| 1.136     +2 -3      src/sys/pci/if_sis.c
| 1.110     +2 -3      src/sys/pci/if_sk.c
| 1.89      +2 -2      src/sys/pci/if_ste.c
| 1.110     +2 -2      src/sys/pci/if_ti.c
| 1.103     +2 -2      src/sys/pci/if_tl.c
| 1.107     +2 -2      src/sys/pci/if_vr.c
| 1.83      +2 -2      src/sys/pci/if_wb.c
| 1.196     +2 -2      src/sys/pci/if_xl.c

Approved by:	re (scottl)
2005-10-09 04:11:20 +00:00
glebius
97d261903e Big overall MFC of polling(4) cleanup:
o First attempt on removing Giant from polling. Details:
  http://lists.freebsd.org/pipermail/cvs-src/2005-September/051848.html
o Second attempt, and big polling cleanup including:
  - Functinal approach to turning polling on/off
  - Deprecating of poll_in_trap
  - Removal of ifnet knowledge from kern_poll.c
  Details:
  http://lists.freebsd.org/pipermail/cvs-src/2005-October/053267.html
o Improved checking of user configurable sysctls. Details:
  http://lists.freebsd.org/pipermail/cvs-src/2005-October/053351.html
o Moving DEVICE_POLLING from opt_global.h to opt_device_polling.h:
  http://lists.freebsd.org/pipermail/cvs-src/2005-October/053479.html

o All related documentation fixes.

Approved by:	re (kensmith)
Thanks to:	everyone, who helped with testing
2005-10-07 14:00:06 +00:00
jhb
81459002f4 MFC various 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().

Approved by:	re (scottl)
2005-09-29 18:52:21 +00:00
rwatson
e13b2df854 Merge linux_ioctl.c:1.128 svr4_sockio.c:1.17 altq_cbq.c:1.3 if_oltr.c:1.38
if_pflog.c:1.14 if_pfsync.c:1.21 if_an.c:1.70 if_ar.c:1.72 if_arl.c:1.11
amrr.c:1.10 onoe.c:1.10 if_ath.c:1.101 awi.c:1.41 if_bfe.c:1.27
if_bge.c:1.93 if_cm_isa.c:1.7 smc90cx6.c:1.16 if_cnw.c:1.20 if_cp.c:1.25
if_cs.c:1.42 if_ct.c:1.26 if_cx.c:1.46 if_ed.c:1.256 if_em.c:1.68
if_en_pci.c:1.37 midway.c:1.66 if_ep.c:1.143 if_ex.c:1.58 if_fatm.c:1.20
if_fe.c:1.93 if_fwe.c:1.38 if_fwip.c:1.8 if_fxp.c:1.244 if_gem.c:1.33
if_hatm.c:1.25 if_hatm_intr.c:1.20 if_hatm_ioctl.c:1.13 if_hatm_rx.c:1.10
if_hatm_tx.c:1.14 if_hme.c:1.39 if_ie.c:1.104 if_ndis.c:1.101
if_ic.c:1.24 if_ipw.c:1.10 if_iwi.c:1.10 if_ixgb.c:1.13 if_lge.c:1.41
if_lnc.c:1.113 if_my.c:1.31 if_nge.c:1.77 if_nve.c:1.10 if_owi.c:1.12
if_patm.c:1.9 if_patm_intr.c:1.6 if_patm_ioctl.c:1.10 if_patm_tx.c:1.10
pdq_ifsubr.c:1.28 if_plip.c:1.38 if_ral.c:1.12 if_ral_pci.c:1.2
if_ray.c:1.81 if_rayvar.h:1.22 if_re.c:1.49 if_sbni.c:1.21 if_sbsh.c:1.14
if_sn.c:1.48 dp83932.c:1.21 if_snc_pccard.c:1.9 if_sr.c:1.70 if_tx.c:1.91
if_txp.c:1.33 if_aue.c:1.92 if_axe.c:1.32 if_cdce.c:1.8 if_cue.c:1.59
if_kue.c:1.66 if_rue.c:1.23 if_udav.c:1.16 if_ural.c:1.12 if_vge.c:1.16
if_vx.c:1.58 if_wi.c:1.185 if_wi_pci.c:1.26 if_wl.c:1.68 if_xe.c:1.60
if_xe_pccard.c:1.30 if_el.c:1.68 i4b_ipr.c:1.35 i4b_isppp.c:1.31
kern_poll.c:1.20 bridge.c:1.94 bridgestp.c:1.4 if_arcsubr.c:1.27
if_atm.h:1.24 if_atmsubr.c:1.40 if_bridge.c:1.16 if_ef.c:1.35
if_ethersubr.c:1.196 if_faith.c:1.37 if_fddisubr.c:1.100 if_fwsubr.c:1.14
if_gif.c:1.54 if_gre.c:1.34 if_iso88025subr.c:1.70 if_loop.c:1.107
if_ppp.c:1.106 if_spppsubr.c:1.121 if_tap.c:1.57 if_tun.c:1.154
if_vlan.c:1.80 ppp_tty.c:1.67 ieee80211_ioctl.c:1.32 atm_if.c:1.31
ng_eiface.c:1.33 ng_ether.c:1.50 ng_fec.c:1.19 ng_iface.c:1.44
ng_sppp.c:1.9 ip_carp.c:1.30 ip_fastfwd.c:1.30 in6.c:1.53 nd6_nbr.c:1.31
natm.c:1.40 if_dc.c:1.162 if_de.c:1.168 if_pcn.c:1.72 if_rl.c:1.154
if_sf.c:1.84 if_sis.c:1.135 if_sk.c:1.108 if_ste.c:1.86 if_ti.c:1.109
if_tl.c:1.101 if_vr.c:1.106 if_wb.c:1.81 if_xl.c:1.194 from HEAD to
RELENG_6:

  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

Approved by:	re (scottl)
2005-08-25 05:01:24 +00:00
rwatson
091aba35eb Merge if_ath.c:1.99 awi.c:1.39 if_bfe.c:1.26 if_bge.c:1.92 if_ed.c:1.255
if_em.c:1.67 if_ex.c:1.57 if_fe.c:1.92 if_fxp.c:1.242 if_gem.c:1.32
if_hme.c:1.38 if_ie.c:1.103 if_ndis.c:1.100 if_ixgb.c:1.12 if_lge.c:1.40
if_lnc.c:1.112 if_my.c:1.30 if_nge.c:1.76 if_nve.c:1.9 if_owi.c:1.11
pdq_ifsubr.c:1.27 if_ray.c:1.80 if_re.c:1.47 if_sn.c:1.47 dp83932.c:1.20
if_tx.c:1.90 if_txp.c:1.32 if_aue.c:1.91 if_axe.c:1.31 if_cue.c:1.58
if_kue.c:1.65 if_rue.c:1.22 if_udav.c:1.15 if_vge.c:1.15 if_wi.c:1.182
if_wl.c:1.67 if_xe.c:1.58 if_dc.c:1.161 if_de.c:1.167 if_pcn.c:1.70
if_rl.c:1.153 if_sf.c:1.83 if_sis.c:1.134 if_sk.c:1.107 if_ste.c:1.85
if_ti.c:1.108 if_tl.c:1.100 if_vr.c:1.105 if_wb.c:1.80 if_xl.c:1.193
from HEAD to RELENG_6:

  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>

Approved by:	re (scottl)
2005-08-24 16:50:46 +00:00
jhb
c429bc012d MFC: Fix a typo in the name of a dmamap for a bus_dmamap_sync().
Approved by:	re (kensmith)
2005-08-04 16:44:17 +00:00
brooks
567ba9b00a 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
nyan
0fce92f5c4 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
obrien
613b483802 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
imp
ca4a8cf386 Return BUS_PROBE_DEFAULT instead of 0. 2005-02-24 21:32:56 +00:00
ru
5556612cc1 Reimplement the fix in rev. 1.126.
OK'ed by:	phk
2005-01-10 09:56:47 +00:00
sam
8ae50c5853 correct direction for bus_dma sync of rx buffer
Submitted by:	Tai-hwa Liang
2005-01-09 19:57:55 +00:00
phk
cd49c1d16c Fix compilation of DEVICE_POLLING code. 2005-01-07 23:52:41 +00:00
imp
f0bf889d0d /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
phk
de4fc049c9 We no longer recurse the mutex. 2005-01-07 00:02:11 +00:00
phk
edf2752b82 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
phk
2d73390de2 Don't tweak DSP on the ..16 chips. 2005-01-06 23:56:13 +00:00
phk
2467640118 Fix for an issue with excessive collisions in half duplex mode. 2005-01-06 23:54:55 +00:00
phk
9f1fe19e57 Nail the short cable problem the exact way National says it should be. 2005-01-06 23:49:26 +00:00
phk
538dbb8988 Simplify and fix bugs in rx/tx ring cleanup. 2005-01-06 23:36:43 +00:00
phk
44b8eade28 Rewrite the rx/tx ring initialization to use pointers instead of arrays. 2005-01-06 23:31:41 +00:00
phk
ebc98c6300 Eliminate a bunch of unnecessary prototypes. 2005-01-06 23:26:13 +00:00
phk
23d430c9fe 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
phk
4f119dfb62 Make sure to clear any pending interrupts when we stop the interface. 2005-01-06 23:18:44 +00:00
phk
962238ddac 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
phk
5bbadf8546 Align if else if properly 2005-01-05 22:28:24 +00:00
phk
372b1d2250 Style: new-speak functions, remove pointless "return". 2005-01-05 22:23:03 +00:00
phk
b5a9e27a67 Make sis_initl() take a typed argument.
Expect caller to lock before calling sis_stop()
Various style stuff.
2005-01-05 10:26:12 +00:00
phk
cb3936de7b Add locked/unlocked variants of sis_init() 2005-01-05 10:11:37 +00:00
phk
9621af4a8b Make a locked and unlocked variant of sis_start() 2005-01-05 10:04:45 +00:00
phk
8895278231 Don't declare variables "register", the compiler ought to know what to do. 2005-01-05 09:02:05 +00:00
phk
f7c28f490d Instead of keeping track of the index into the receive ring use the already
implemented "sis_nextdesc" pointer to keep a pointer instead.
2005-01-04 22:39:35 +00:00
phk
718589faa8 Forget about the sis_list_data and sis_ring_data structures and embedd
their fields directly in the softc structure.

This is a no-op which shortens most of the affected source lines
by N * 10 characters.
2005-01-04 22:25:58 +00:00
phk
f39fbeb0dc Prototype busdma callback using the typedef. 2005-01-04 22:14:18 +00:00
mlaier
b5e56e2ca9 Fix sis, bfe and ndis in the same way dc was fixed:
Do not tell the hardware to send when there were no packets enqueued.

Found and reviewed by:	green
MFC after:		1 days
2004-10-08 16:14:42 +00:00
mlaier
7bc770a254 Bring in the first chunk of altq driver modifications. This covers the
following drivers: bfe(4), em(4), fxp(4), lnc(4), tun(4), de(4) rl(4),
sis(4) and xl(4)

More patches are pending on: http://peoples.freebsd.org/~mlaier/ Please take
a look and tell me if "your" driver is missing, so I can fix this.

Tested-by:	many
No-objection:	-current, -net
2004-07-02 12:16:02 +00:00
imp
d622075765 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
naddy
03b06cd9a3 Replace handrolled CRC calculation with ether_crc32_[lb]e(). 2004-06-09 14:34:04 +00:00
phk
d6f7d2bde6 Add some missing <sys/module.h> includes which are masked by the
one on death-row in <sys/kernel.h>
2004-05-30 17:57:46 +00:00
rwatson
f3abcf3aa7 Only initialize the if_sis callout as MPSAFE if debug.mpsafenet is set
true.  Otherwise, assertion checks for Giant in the network stack will
fail causing a panic.

Reported by:	simon
2004-05-23 22:22:29 +00:00
yar
170d03a0c9 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
ru
bade226899 Implemented per-interface polling(4) control. 2004-04-11 20:34:08 +00:00
njl
05a1f56fc9 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
mdodd
5c1fa8d5da Announce ethernet MAC addresss in ether_ifattach(). 2004-03-14 07:12:25 +00:00
mux
667b43899d Stop setting ifp->if_output to ether_output() since ether_ifattach()
does it for us already.
2004-03-11 14:04:59 +00:00
phk
373c3cc267 Vastly improve performance of IRQ handling on stopped interfaces with
this driver by introducing a flag saying we already stopped the device.

On my Soekris net4801, this took a ping -i 0.001 from spending 80% of
time in interrupt handling to 10% (approx numbers).

This was a particular problem for the net4801 because the tree
interfaces share the same interrupt, but it would be a problem for
any configuration where an unused if_sis interface shares an interrupt
with a busy device.

Other drivers may have similar problems.

Thanks to:	Luigi
2003-12-25 22:14:25 +00:00
phk
599bb62238 Attempt to get the short cable fix to work better on the if_sis:
Only do short-cable on revisions that need it.

Move generic initialization before short-cable fix, in order to not
clobber short cable fix register setting.
2003-12-12 10:15:39 +00:00
obrien
a1cabe1bbb 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
sam
29f07789b1 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