ether_input question

John Polstra jdp at polstra.com
Sat Mar 17 22:11:55 UTC 2007


Aniruddha Bohra wrote:
> Hi,
> In two drivers, fxp and em, the assumptions about entering the 
> ether_input routine are different.
>  From em_rxeof:
> 
> #ifdef DEVICE_POLLING
> EM_UNLOCK()
> (*ifp->if_input)()
> EM_UNLOCK()
> #else
>  (*ifp->if_input)()
> #endif
> 
> While in fxp:
> 
> FXP_UNLOCK()
> (*ifp->if_input)()
> FXP_LOCK()
> 
> 
> My question is :
> Does ether_input() assume it is the only thread executing the code? If 
> it is the case, what is the
> reason for dropping the lock in the DEVICE_POLLING case?

There is actually no difference between these cases.  In the 
!DEVICE_POLLING case, the em driver does not hold its driver lock when 
it calls em_rxeof.  The call is made from em_handle_rxtx, where you'll 
see that the driver has not acquired a lock when it calls em_rxeof. 
Thus, in all cases the if_input function is called without holding the 
driver lock.

John


More information about the freebsd-net mailing list