diff options
author | deischen <deischen@FreeBSD.org> | 2003-10-15 05:34:41 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2003-10-15 05:34:41 +0000 |
commit | d5430e82187fc86f4912ee0a3bf41cf20300cb66 (patch) | |
tree | 508dc9515fea72311219b68f88cc0ca40d5445c5 /sys | |
parent | 7b111f7fdf19c38cec8728b604f909a1ae62abdd (diff) | |
download | FreeBSD-src-d5430e82187fc86f4912ee0a3bf41cf20300cb66.zip FreeBSD-src-d5430e82187fc86f4912ee0a3bf41cf20300cb66.tar.gz |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/em/if_em.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/dev/em/if_em.c b/sys/dev/em/if_em.c index 6b9d6a1..27b9d6c 100644 --- a/sys/dev/em/if_em.c +++ b/sys/dev/em/if_em.c @@ -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) { |