summaryrefslogtreecommitdiffstats
path: root/sys/dev/ic/gem.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Sporadically the network over gem(4) interface hang on sparc64 andbluhm2018-02-071-13/+31
| | | | | | | | | | | | | macppc. Receiving packets stopped, ifconfig down/up made it work again. In the tick timeout handler refill the receive ring if it is empty. The logic is taken from hme(4). Also protect the register access and ifp counters with splnet(). In gem_rx_watchdog() is a workaround for a hardware bug. It resets the hardware when there is no progress. If the fifo pointers advanced a bit, it got stuck anyway. So restart the receive watchdog timeout in that case. OK mpi@
* make the gem tx path MPSAFE.dlg2017-06-081-48/+57
| | | | | | this mostly follows the pattern in ifq.h ok jmatthew@
* move counting if_opackets next to counting if_obytes in if_enqueue.dlg2017-01-221-2/+1
| | | | | | | this means packets are consistently counted in one place, unlike the many and various ways that drivers thought they should do it. ok mpi@ deraadt@
* G/C IFQ_SET_READY().mpi2016-04-131-2/+1
|
* No trailers has been the default and only option for 20 years, yet sometedu2015-12-081-2/+2
| | | | | | | drivers still set IFF_NOTRAILERS while others do not. Remove all usage of the flag from the drivers which in ancient times used it (and the modern drivers which blindly copied it from those drivers of yore). suggested by guenther. ok mpi
* Rework gem_start to check that there's enough space in the ring beforejmatthew2015-11-281-63/+95
| | | | | | | | | | | | | | | | | dequeueing a packet, then drop the packet if it can't be sent, rather than using two phase dequeue then commit. Adjust sc_tx_cnt using atomic operations, take the kernel lock before calling gem_start or gem_init from the interrupt handler, and use an interrupt barrier when taking the interface down. With all this done, we can mark the interrupt handler for pci (but not sbus) attached gem(4) as mpsafe. mpi@ wrote this initially, I fixed bugs to keep sparc64 happy and kept it up to date with ifq changes. ok mpi@ dlg@
* replace IFF_OACTIVE manipulation with mpsafe operations.dlg2015-11-251-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | there are two things shared between the network stack and drivers in the send path: the send queue and the IFF_OACTIVE flag. the send queue is now protected by a mutex. this diff makes the oactive functionality mpsafe too. IFF_OACTIVE is part of if_flags. there are two problems with that. firstly, if_flags is a short and we dont have any MI atomic operations to manipulate a short. secondly, while we could make the IFF_OACTIVE operates mpsafe, all changes to other flags would have to be made safe at the same time, otherwise a read-modify-write cycle on their updates could clobber the oactive change. instead, this moves the oactive mark into struct ifqueue and provides an API for changing it. there's ifq_set_oactive, ifq_clr_oactive, and ifq_is_oactive. these are modelled on ifsq_set_oactive, ifsq_clr_oactive, and ifsq_is_oactive in dragonflybsd. this diff includes changes to all the drivers manipulating IFF_OACTIVE to now use the ifsq_{set,clr_is}_oactive API too. ok kettenis@ mpi@ jmatthew@ deraadt@
* You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.mpi2015-11-241-2/+1
|
* shuffle struct ifqueue so in flight mbufs are protected by a mutex.dlg2015-11-201-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the code is refactored so the IFQ macros call newly implemented ifq functions. the ifq code is split so each discipline (priq and hfsc in our case) is an opaque set of operations that the common ifq code can call. the common code does the locking, accounting (ifq_len manipulation), and freeing of the mbuf if the disciplines enqueue function rejects it. theyre kind of like bufqs in the block layer with their fifo and nscan disciplines. the new api also supports atomic switching of disciplines at runtime. the hfsc setup in pf_ioctl.c has been tweaked to build a complete hfsc_if structure which it attaches to the send queue in a single operation, rather than attaching to the interface up front and building up a list of queues. the send queue is now mutexed, which raises the expectation that packets can be enqueued or purged on one cpu while another cpu is dequeueing them in a driver for transmission. a lot of drivers use IFQ_POLL to peek at an mbuf and attempt to fit it on the ring before committing to it with a later IFQ_DEQUEUE operation. if the mbuf gets freed in between the POLL and DEQUEUE operations, fireworks will ensue. to avoid this, the ifq api introduces ifq_deq_begin, ifq_deq_rollback, and ifq_deq_commit. ifq_deq_begin allows a driver to take the ifq mutex and get a reference to the mbuf they wish to try and tx. if there's space, they can ifq_deq_commit it to remove the mbuf and release the mutex. if there's no space, ifq_deq_rollback simply releases the mutex. this api was developed to make updating the drivers using IFQ_POLL easy, instead of having to do significant semantic changes to avoid POLL that we cannot test on all the hardware. the common code has been tested pretty hard, and all the driver modifications are straightforward except for de(4). if that breaks it can be dealt with later. ok mpi@ jmatthew@
* arp_ifinit() is no longer needed.mpi2015-10-251-4/+1
|
* Make room for media types of the future. Extend the ifmedia word to 64 bits.stsp2015-09-111-3/+3
| | | | | | | | | | | | | | | | This changes numbers of the SIOCSIFMEDIA and SIOCGIFMEDIA ioctls and grows struct ifmediareq. Old ifconfig and dhclient binaries can still assign addresses, however the 'media' subcommand stops working. Recompiling ifconfig and dhclient with new headers before a reboot should not be necessary unless in very special circumstances where non-default media settings must be used to get link and console access is not available. There may be some MD fallout but that will be cleared up later. ok deraadt miod with help and suggestions from several sharks attending l2k15
* Increment if_ipackets in if_input().mpi2015-06-241-3/+1
| | | | | | | Note that pseudo-drivers not using if_input() are not affected by this conversion. ok mikeb@, kettenis@, claudio@, dlg@
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* tweak the new if_input function so it takes an mbuf_list insteaddlg2015-02-091-2/+5
| | | | | | | | | of a single mbuf. this forces us to batch work between the hardware rx handlers and the stack. this includes a converstion of bge from ether_input to if_input. ok claudio@ pelikan@ mpi@
* Convert to if_input().mpi2015-02-081-9/+2
| | | | ok pelikan@, reyk@, blambert@, henning@
* unifdef INETtedu2014-12-221-3/+1
|
* Use <sys/endian.h> instead of <machine/endian.h>guenther2014-12-191-3/+2
| | | | ok dlg@ mpi@ bcook@ millert@ miod@
* rxr ioctl handling.dlg2014-08-271-1/+6
|
* Fewer <netinet/in_systm.h>mpi2014-07-221-7/+1
|
* cut things that relied on mclgeti for rx ring accounting/restriction overdlg2014-07-081-10/+13
| | | | | | | | | | to using if_rxr. cut the reporting systat did over to the rxr ioctl. tested as much as i can on alpha, amd64, and sparc64. mpi@ has run it on macppc. ok mpi@
* Remove RX checksum offloading support. The chip is too limited, andnaddy2014-04-221-96/+1
| | | | | | examining higher protocol layers to adjust the checksum and calculate the pseudo-header in the driver is too complex to be worthwhile. ok henning@
* use lemtoh64 and htolem64 for reading and writing entries in the rings.dlg2014-03-141-8/+8
| | | | | tested on sparc64 and powerpc with and without the MI backends for the lem ops enabled.
* Turns out neither the flow control diff nor the RX checksum offload diffkettenis2013-08-081-8/+121
| | | | is responsible for the hangs seen by Henning. So put them back.
* Backout flow control support (rev 1.97) and RX TCP/UDP checksum offloadkettenis2013-07-251-121/+8
| | | | | | | support (rev 1.98). There is strong evidence that one of these causes hangs on the Sun ERI as found on a v120. ok henning@, deraadt@
* Always use the internal PHY on Apple variants, from FreeBSD. This unbreaksmpi2013-03-091-3/+6
| | | | | | gem(4) on some PowerMac G5. tested by kirby@, ok deraadt@
* Add RX TCP/UDP checksum offload support.brad2012-12-011-2/+100
| | | | ok naddy@ sthen@
* Add flow control support.brad2012-10-221-7/+22
| | | | | | | Tested with Apple/Sun gem(4) with and without flow control (Sun ERI/Apple GEM with FastE PHY). ok kettenis@
* Add detach support to a few more drivers, and in others do the neccessaryderaadt2009-10-151-8/+47
| | | | | | operations in the detach function in the right order. Also ensure that the interrupt handlers not trust registers that go away. read over very carefully by dms, tested by me
* More cases of shutdown hooks not needed after card is already stopped. Inderaadt2009-08-101-16/+1
| | | | | | these cases the xxstop function is a bit more complicated and has a flag of some sort, but the use of that flag does not matter; DMA is already ceased ok dlg
* MCLGETI() will now allocate a mbuf header if it is not provided, thusderaadt2009-08-091-9/+3
| | | | | | reducing the amount of splnet/splx dancing required.. especially in the worst case (of m_cldrop) ok dlg kettenis damien
* Comment fixes and code tidy-up (whitespace and more consistentsthen2009-08-031-11/+10
| | | | numeric values) from Brad. No binary change.
* Remove redundant code for setting the maximum frame receive sizesthen2009-07-181-7/+3
| | | | | and fix the appropriate code in gem_init_regs(). From Brad, tested by Brad (sparc64), todd@ (macppc).
* Simplify receive filter handling, from Brad.sthen2009-07-181-72/+47
| | | | Tested by Brad on sparc64, todd@ on macppc.
* Remove unused prototype.kettenis2009-03-291-2/+1
|
* Add workaround for RX MAC/FIFO hangs on ERI. Tested by matthieu@ and naddy@.kettenis2009-03-221-3/+49
| | | | ok dlg@
* Unconditionally drain the RX ring when stpping the chip.kettenis2009-03-201-8/+7
| | | | ok dlg@, jsg@
* make drivers tell the mclgeti allocator what their maximum ring size isdlg2009-01-271-2/+2
| | | | | | | to prevent the hwm growing beyond that. this allows the livelock mitigation to do something where the hwm used to grow beyond twice the rx rings size. ok kettenis@ claudio@
* Switch gem(4) over to using MCLGETI when allocating mbufs for the rx ring.kettenis2008-12-141-62/+44
| | | | help from dlg@, tested by a few, ok dlg@
* Replace m_free() with m_freem() in foo_start() to ensure that upon errorbrad2008-12-101-2/+2
| | | | | | the full mbuf chain is freed. ok claudio@ kettenis@
* Eliminate the redundant bits of code for MTU and multicast handlingbrad2008-11-281-26/+7
| | | | | | | | | | | | | | from the individual drivers now that ether_ioctl() handles this. Shrinks the i386 kernels by.. RAMDISK - 2176 bytes RAMDISKB - 1504 bytes RAMDISKC - 736 bytes Tested by naddy@/okan@/sthen@/brad@/todd@/jmc@ and lots of users. Build tested on almost all archs by todd@/brad@ ok naddy@
* Use m_defrag instead of collapsing mbufs ourselves.kettenis2008-11-261-25/+5
| | | | ok dlg@
* Simplify the interface flag handling in the ioctl handler.brad2008-11-071-10/+4
|
* Remove storing the Ethernet header in the receve interrupt handler, thebrad2008-11-071-3/+1
| | | | disabled code that used to use this was removed 7 years ago.
* - According to the Apple GMAC driver, the GEM ASIC specification andbrad2008-11-071-4/+20
| | | | | | | | | | | | | | the OpenSolaris eri(7D) the TX FIFO threshold has to be set to 0x4ff for the Gigabit variants and 0x100 for the ERI in order to avoid TX underruns. - Turn on workarounds for silicon bugs in the Apple GMAC variants. This was based on information obtained from the Darwin GMAC and Linux GEM drivers. - Turn on "infinite" (i.e. maximum 31 * 64 bytes in length) DMA bursts. From FreeBSD Tested by a few users with Apple GMAC's and Sun ERI.
* First step towards cleaning up the Ethernet driver ioctl handling.brad2008-10-021-9/+2
| | | | | | | | | | | | | | | | | | | | Move calling ether_ioctl() from the top of the ioctl function, which at the moment does absolutely nothing, to the default switch case. Thus allowing drivers to define their own ioctl handlers and then falling back on ether_ioctl(). The only functional change this results in at the moment is having all Ethernet drivers returning the proper errno of ENOTTY instead of EINVAL/ENXIO when encountering unknown ioctl's. Shrinks the i386 kernels by.. RAMDISK - 1024 bytes RAMDISKB - 1120 bytes RAMDISKC - 832 bytes Tested by martin@/jsing@/todd@/brad@ Build tested on almost all archs by todd@/brad@ ok jsing@
* Convert timeout_add() calls using multiples of hz to timeout_add_sec()blambert2008-09-101-3/+3
| | | | | | | Really just the low-hanging fruit of (hopefully) forthcoming timeout conversions. ok art@, krw@
* Fix an issue initially reported by drahn@ with gem(4) where thesebrad2008-08-301-2/+2
| | | | | | | | drivers can report 2-3x times the number of actual packets being transmitted by only incrementing the counter for descriptors with buffers being freed. ok kettenis@
* Fix a couple of problems that may make gem(4) get stuck:kettenis2008-08-261-67/+91
| | | | | | | | | | | | | | | | | | | 1. If bus_dmamap_load_mbuf() fails because there are not enough segments in the map, defrag the mbuf. 2. If there are not enough free (hardware ring) descriptors, set IFF_OACTIVE and keep the packet on the queue. 3. If there is some other resource starvation that makes bus_dmamap_load_mbuf() or defragmentation fail, drop the packet. Don't set IFF_OACTIVE, since the Tx ring could be empty and we'd be stuck. 4. Only pass packets that are actually handed off to the hardware to BPF. Do so before handing them off to the hardware to make sure the packet isn't freed behind our back. ok dlg@
* Properly set the IFF_OACTIVE flag if all the descriptrs are in use forbrad2008-05-311-4/+6
| | | | | | the TX ring and clear the flag when some have been freed. ok dlg@ kettenis@
* - Count excess and late collisions as output errors.brad2008-05-091-5/+18
| | | | | | | | - Count receive errors as input errors. Based on similar change to the gem(4) driver from NetBSD. ok kettenis@