Add a wrapper for a function that takes and releases the adapter

lock around a call to the original function.  Make the timeout
function in callout_reset() use the wrapped function to avoid a
lock assertion panic.

Reviewed by:	sam
Reported by:	cgiordano@ids.net
This commit is contained in:
Daniel Eischen 2003-10-15 05:34:41 +00:00
parent b8ead740b8
commit 0bea487cfa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=121106

View file

@ -167,6 +167,7 @@ static int em_82547_fifo_workaround(struct adapter *, int);
static void em_82547_update_fifo_head(struct adapter *, int);
static int em_82547_tx_fifo_reset(struct adapter *);
static void em_82547_move_tail(void *arg);
static void em_82547_move_tail_locked(struct adapter *);
static int em_dma_malloc(struct adapter *, bus_size_t,
struct em_dma_alloc *, int);
static void em_dma_free(struct adapter *, struct em_dma_alloc *);
@ -1284,7 +1285,7 @@ em_encap(struct adapter *adapter, struct mbuf *m_head)
*/
if (adapter->hw.mac_type == em_82547 &&
adapter->link_duplex == HALF_DUPLEX) {
em_82547_move_tail(adapter);
em_82547_move_tail_locked(adapter);
} else {
E1000_WRITE_REG(&adapter->hw, TDT, i);
if (adapter->hw.mac_type == em_82547) {
@ -1304,9 +1305,8 @@ em_encap(struct adapter *adapter, struct mbuf *m_head)
*
**********************************************************************/
static void
em_82547_move_tail(void *arg)
em_82547_move_tail_locked(struct adapter *adapter)
{
struct adapter *adapter = arg;
uint16_t hw_tdt;
uint16_t sw_tdt;
struct em_tx_desc *tx_desc;
@ -1340,6 +1340,16 @@ em_82547_move_tail(void *arg)
return;
}
static void
em_82547_move_tail(void *arg)
{
struct adapter *adapter = arg;
EM_LOCK(adapter);
em_82547_move_tail_locked(adapter);
EM_UNLOCK(adapter);
}
static int
em_82547_fifo_workaround(struct adapter *adapter, int len)
{