cvs commit: src/sys/pci if_xl.c if_xlreg.h

John Baldwin jhb at FreeBSD.org
Thu Aug 18 19:24:31 GMT 2005


jhb         2005-08-18 19:24:30 UTC

  FreeBSD src repository

  Modified files:
    sys/pci              if_xl.c if_xlreg.h 
  Log:
  Various fixups to locking:
  - Remove a lot of superfluous locking during attach.  There is no need
    to lock access to the driver until some other thread has a way of getting
    to it.  For ethernet drivers the other ways include registering an
    interrupt handler via bus_setup_intr(), calling ether_ifattach() to hook
    into the network stack, and kicking off a callout-driven timer via
    callout_reset().
  - Use callout_* rather than timeout/untimeout.
  - Break out of xl_rxeof() if IFF_DRV_RUNNING is clear after ifp->if_input
    returns to handle the case where the interface was stopped while we were
    passing a packet up the stack.  Don't call xl_rxeof() in xl_rxeof_task()
    unless IFF_DRV_RUNNING is set.  With these fixes in place, any
    outstanding task will gracefully terminate as soon as it gets a chance to
    run after the interface has been stopped via xl_stop().  As a result,
    taskqueue_drain() is no longer required in xl_stop().  The task is still
    drained in detach() however to make sure that detach() can safely destroy
    the driver mutex at the end of the function.
  - Lock the driver lock in the ifmedia callouts and don't lock across
    ifmedia_ioctl() in xl_ioctl().
  
  Note: glebius came up with most of (3) as well independently.  I took a
  rather roundabout way of arriving at the same conclusion.
  
  MFC after:      3 days
  
  Revision  Changes    Path
  1.195     +32 -48    src/sys/pci/if_xl.c
  1.56      +1 -1      src/sys/pci/if_xlreg.h


More information about the cvs-src mailing list