summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_myx.c
AgeCommit message (Collapse)Author
2014-10-28the if_rxring accounting would get screwed up if the first mbuf toDavid Gwynne
be put on the ring couldnt be allocated. this pulls the code that puts the mbufs on the ring out of myx_rx_fill so it can return early if firstmb cant be allocated, which puts it in the right place to return unused slots to the if_rxring. this means myx rx wont lock up if you're DoSsed to the point where you exhaust your mbuf pools and cant allocate mbufs for the ring. ok jmatthew@
2014-10-04replace mutexes to serialise the operations on the flag that restrictsDavid Gwynne
the number of contexts that are refilling the rx rings with atomic ops. this is borrowed from code i wrote for the scsi midlayer but cant put in yet because i havent got atomic.h up to scrach on all archs yet. the archs myx runs on do have enough atomic.h to be fine though.
2014-10-03refill the rx ring in myx_rxeof, not much later at the end of myx_intr.David Gwynne
2014-10-03in rxeof, instead of taking the biglock on every packet to call bpfDavid Gwynne
and ether_input, queue all the mbufs onto an mbuf_list on the stack and then take the biglock once outside the loop.
2014-10-03we dont need the kernel lock to call bus_dmamap_load and unload thanksDavid Gwynne
to ketenis. move the if_ipacket and if_opacket increments out of biglock too. theyre only updated from the interrupt handler, which is only run on a single cpu so there's no chance of the update racing. everywhere else only reads them.
2014-10-03dont need to hold the kernel lock to call MCLGETI and m_freem now.David Gwynne
2014-10-03dont take the kernel lock on every interrupt in case we might changeDavid Gwynne
the link state or to clear OACTIVE, just take it when we know we really are going to do those things.
2014-09-14remove uneeded proc.h includesJonathan Gray
ok mpi@ kspillner@
2014-08-19in myx_start, replaceDavid Gwynne
while (space) { IFQ_POLL; myx_dequeue(free descr); IFQ_DEQUEUE; etc; } with while (space && myx_dequeue(free descr)) { IFQ_DEQUEUE; etc; }
2014-08-18dont rely on mbuf.h to provide pool.h.David Gwynne
ok miod@, who has offerred to help with any MD fallout ok guenther@
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2014-07-10rings that dont rx packets dont need to be refilled.David Gwynne
2014-07-08cut things that relied on mclgeti for rx ring accounting/restriction overDavid Gwynne
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@
2014-06-17whitespace fix.David Gwynne
im sick of fixing this by hand on all my boxes while hacking on other stuff and having it pollute my diffs. no functional change.
2014-03-24nothing after the irq ack posting relies on it being ordered.David Gwynne
2014-02-10the mac addresses you program with MYXCMD_SET_MCASTGROUP are in a differentDavid Gwynne
format to the one used for MYXCMD_SET_LLADDR. for reasons. this lets ospf work if you dont happen to have PROMISC enabled on your interface like my production firewalls happen to have, which is why i never noticed this before.
2014-02-05after running myx(4) without biglock in production for a few daysDavid Gwynne
i discovered that there's a race between the interrupt code and myx_start which causes the count of free tx descriptors to get distorted, which eventually leads to a permanent setting of IFF_OACTIVE, which in turn prevents the driver from transmitting packets. fixing that went horribly wrong when i then discovered that there's a race between the interrupt handler and myx_down, where the interrupt can tell myx_down to wake up and free all the rings while the interrupt handler is still looking at them. free panics for all. this moves the handling of the tx free count under the biglock (for now), and moves myx_up and myx_down to managing a "driver state" variable independantly of the IFF_UP and IFF_RUNNING flags, and very very careful reordering of the checks of that state variable and the hardware state. as a bonus we get to avoid excessive calls to myx_txeof and myx_rxeof in the isr, and less stuff checked unconditionally. on the other hand, the sc_state handling added some more checks so it might not be a win overall. tested on smp sparc64 with msi and nonmsi interrupts, and on amd64 smp in production again.
2014-01-31sc_function is set, but never used for anything useful. clean it up...David Gwynne
2014-01-31sc_lladdr is never used, so we can get the space in the sc back.David Gwynne
2014-01-23a lot of people have pointed out to me that taking a lock just to read anDavid Gwynne
int isnt necessary.
2014-01-23factor the mutex/bus_space handling of the sts block out.David Gwynne
2014-01-21introduce fine grained locking.David Gwynne
this doesnt give up the big lock coming from process context, only from the interrupt side. it is excessively careful about when it takes the big lock again. notably it goes to a lot of effort to not hold a mutex while calling into other subsystems or before taking the big lock. ive been hitting it as hard as i can without problems. intensly read by mpi@ ok claudio@ kettenis@
2014-01-19white space fixDavid Gwynne
2014-01-19introduce fine grained locking around the lists of packet handlersDavid Gwynne
myx maintains. this moves it away from relying on splnet to protect them.
2014-01-19hwflags is never used, so clean it upDavid Gwynne
2014-01-19replace bcmp with memcmpDavid Gwynne
2014-01-19bcopy to memcpyDavid Gwynne
2014-01-19replace bzero with memset.David Gwynne
2014-01-19all 64bit archs myx runs on support bus_space 8 things because of work iDavid Gwynne
did at n2k13.
2013-01-29- Set ENETRESET within myx_ioctl() instead of calling myx_iff() directly, to beBrad Smith
consistent with other drivers. - Clear IFF_ALLMULTI flag early and at the top of myx_iff(). - Set IFF_ALLMULTI when in promisc mode. ok dlg@
2013-01-25we go to a lot of effort to post the first tx descriptor last, but weDavid Gwynne
really should be trying to post everything except the flags field in the first tx descriptor. this shuffles things around so the rest of that first txd is posted as part of the "everything else" before its flags field.
2013-01-25the myx_dmamem struct doesnt need a name.David Gwynne
2013-01-21myx does reads and writes in one direction to packet buffers. lets tryDavid Gwynne
STREAMING them.
2013-01-15dont use amd64 is currently broken cos it has noDavid Gwynne
bus_space_write_raw_region_8. disabling it for now.
2013-01-15use bus_space_write_raw_region_8 on 64bit archs when writing to the ringsDavid Gwynne
2013-01-14map the registers PREFETCHABLE so things that can do write combining canDavid Gwynne
try and do write combining like the myx doco likes.
2013-01-14avoid extra bus_space barriers in the interrupt handler.David Gwynne
2013-01-14when posting descriptors to the chips rings, avoid going write barrierDavid Gwynne
write barrier write barrier when using myx_write to post descriptors. instead let its go write write write barrier by using the appropriate bus_space write directly followed by a single bus_space barrier. the story above is mostly true, except that myx wants use to write all the descriptors except the first, barrier, and then write the first one out to signale that the chip can proceed. it is also worth noting that the barriers cover more address space than what we actually wrote to. this makes the code much simpler, and avoids generating extra fence operations (which is what barrier functions end up as on most of our archs) when we wrap around the end of the ring. the bus_space doco encourages this. bus_space use was discussed with krw@ kettenis@ deraadt@
2013-01-14the myri doco suggests its nice to post stuff by filling in everythingDavid Gwynne
in the rings except the first descriptor. once you've written as much as you can out, then you go back and post the first descriptor to signal that the chip should go ahead and work.
2013-01-14;; is a long way of saying ;David Gwynne
2012-11-29Remove setting an initial assumed baudrate upon driver attach which is notBrad Smith
necessarily correct, there might not even be a link when attaching. ok mikeb@ reyk@
2011-11-28Fix reversed error-handling gotos in myx_buf_fill(), which would lead toBret Lambert
either an mbuf leak or a NULL pointer dereference. ok sthen@ claudio@ dlg@ testing claudio@ dlg@
2011-08-08myx requires the driver pad short ethernet frames to 60 bytes byDavid Gwynne
adding a descriptor pointing at zeroed bytes onto the end of transmit chains. i was accounting for this extra descriptor when i was completing the chain, but not when i was setting this up. this meant the number of free descriptors kept growing until it overflowed. at this point the check for space in the ring failed and packets no longer flowed. this counts the pad descriptor in the tx chain setup too. ok deraadt@
2011-06-23cope with empty rx rings by scheduling a timeout to keep trying until itDavid Gwynne
gets some packets onto the rings. also annoying, but the hardware doesnt report empty rings, we have to handle it ourselves.
2011-06-23this chip has an annoying "feature" where it cannot report the linkDavid Gwynne
state unless the chip is up and handling packets. while its down it does not report the link state, so it is unknown. this tweaks the link state handling, in particular it adds code to myx_down so it moves the link state to unknown, ie, it correctly reflects reality. stupidity pointed out by deraadt
2011-06-22reset the tx_count on UP, since it may have been advanced from non-zeroTheo de Raadt
by a previous use ok claudio
2011-06-22msi support. this is a complicated one...David Gwynne
ok kettenis@
2011-06-22another myri10ge device matched by freebsd/linux driversJonathan Gray
ok dlg@
2011-06-22oops, handle refill like i said i was going to two revisions ago.David Gwynne
2011-06-22set the mac address on the chip correctly (repair the byte order)Theo de Raadt
it now works on sparc64, too ok dlg