Commit f6b35d66 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

Staging: et131x: clean up MP_FLAG macros

Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 356c74b4
...@@ -272,7 +272,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) ...@@ -272,7 +272,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev)
writel(ctl.value, &etdev->regs->txmac.ctl.value); writel(ctl.value, &etdev->regs->txmac.ctl.value);
/* Ready to start the RXDMA/TXDMA engine */ /* Ready to start the RXDMA/TXDMA engine */
if (!MP_TEST_FLAG(etdev, fMP_ADAPTER_LOWER_POWER)) { if (etdev->Flags & fMP_ADAPTER_LOWER_POWER) {
et131x_rx_dma_enable(etdev); et131x_rx_dma_enable(etdev);
et131x_tx_dma_enable(etdev); et131x_tx_dma_enable(etdev);
} else { } else {
......
...@@ -498,7 +498,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev, ...@@ -498,7 +498,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
spin_lock_irqsave(&etdev->Lock, flags); spin_lock_irqsave(&etdev->Lock, flags);
etdev->MediaState = NETIF_STATUS_MEDIA_CONNECT; etdev->MediaState = NETIF_STATUS_MEDIA_CONNECT;
MP_CLEAR_FLAG(etdev, fMP_ADAPTER_LINK_DETECTION); etdev->Flags &= ~fMP_ADAPTER_LINK_DETECTION;
spin_unlock_irqrestore(&etdev->Lock, flags); spin_unlock_irqrestore(&etdev->Lock, flags);
...@@ -529,10 +529,8 @@ void et131x_Mii_check(struct et131x_adapter *etdev, ...@@ -529,10 +529,8 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
* Timer expires, we can report disconnected (handled * Timer expires, we can report disconnected (handled
* in the LinkDetectionDPC). * in the LinkDetectionDPC).
*/ */
if ((MP_IS_FLAG_CLEAR if (!(etdev->Flags & fMP_ADAPTER_LINK_DETECTION) ||
(etdev, fMP_ADAPTER_LINK_DETECTION)) (etdev->MediaState == NETIF_STATUS_MEDIA_DISCONNECT)) {
|| (etdev->MediaState ==
NETIF_STATUS_MEDIA_DISCONNECT)) {
spin_lock_irqsave(&etdev->Lock, flags); spin_lock_irqsave(&etdev->Lock, flags);
etdev->MediaState = etdev->MediaState =
NETIF_STATUS_MEDIA_DISCONNECT; NETIF_STATUS_MEDIA_DISCONNECT;
......
...@@ -134,7 +134,7 @@ void EnablePhyComa(struct et131x_adapter *etdev) ...@@ -134,7 +134,7 @@ void EnablePhyComa(struct et131x_adapter *etdev)
/* Stop sending packets. */ /* Stop sending packets. */
spin_lock_irqsave(&etdev->SendHWLock, flags); spin_lock_irqsave(&etdev->SendHWLock, flags);
MP_SET_FLAG(etdev, fMP_ADAPTER_LOWER_POWER); etdev->Flags |= fMP_ADAPTER_LOWER_POWER;
spin_unlock_irqrestore(&etdev->SendHWLock, flags); spin_unlock_irqrestore(&etdev->SendHWLock, flags);
/* Wait for outstanding Receive packets */ /* Wait for outstanding Receive packets */
...@@ -189,7 +189,7 @@ void DisablePhyComa(struct et131x_adapter *etdev) ...@@ -189,7 +189,7 @@ void DisablePhyComa(struct et131x_adapter *etdev)
et131x_adapter_setup(etdev); et131x_adapter_setup(etdev);
/* Allow Tx to restart */ /* Allow Tx to restart */
MP_CLEAR_FLAG(etdev, fMP_ADAPTER_LOWER_POWER); etdev->Flags &= ~fMP_ADAPTER_LOWER_POWER;
/* Need to re-enable Rx. */ /* Need to re-enable Rx. */
et131x_rx_dma_enable(etdev); et131x_rx_dma_enable(etdev);
......
...@@ -415,7 +415,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) ...@@ -415,7 +415,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
SLAB_HWCACHE_ALIGN, SLAB_HWCACHE_ALIGN,
NULL); NULL);
MP_SET_FLAG(adapter, fMP_ADAPTER_RECV_LOOKASIDE); adapter->Flags |= fMP_ADAPTER_RECV_LOOKASIDE;
/* The RFDs are going to be put on lists later on, so initialize the /* The RFDs are going to be put on lists later on, so initialize the
* lists now. * lists now.
...@@ -569,9 +569,9 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) ...@@ -569,9 +569,9 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
/* Free receive packet pool */ /* Free receive packet pool */
/* Destroy the lookaside (RFD) pool */ /* Destroy the lookaside (RFD) pool */
if (MP_TEST_FLAG(adapter, fMP_ADAPTER_RECV_LOOKASIDE)) { if (adapter->Flags & fMP_ADAPTER_RECV_LOOKASIDE) {
kmem_cache_destroy(rx_ring->RecvLookaside); kmem_cache_destroy(rx_ring->RecvLookaside);
MP_CLEAR_FLAG(adapter, fMP_ADAPTER_RECV_LOOKASIDE); adapter->Flags &= ~fMP_ADAPTER_RECV_LOOKASIDE;
} }
/* Free the FBR Lookup Table */ /* Free the FBR Lookup Table */
...@@ -1223,9 +1223,9 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) ...@@ -1223,9 +1223,9 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
* If length is zero, return the RFD in order to advance the * If length is zero, return the RFD in order to advance the
* Free buffer ring. * Free buffer ring.
*/ */
if ((!etdev->PacketFilter) || if (!etdev->PacketFilter ||
(!MP_LINK_DETECTED(etdev)) || !(etdev->Flags & fMP_ADAPTER_LINK_DETECTION) ||
(pMpRfd->PacketSize == 0)) { pMpRfd->PacketSize == 0) {
continue; continue;
} }
......
...@@ -510,9 +510,9 @@ static int et131x_send_packet(struct sk_buff *skb, ...@@ -510,9 +510,9 @@ static int et131x_send_packet(struct sk_buff *skb,
if ((shbufva[0] == 0xffff) && if ((shbufva[0] == 0xffff) &&
(shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) { (shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) {
MP_SET_FLAG(pMpTcb, fMP_DEST_BROAD); pMpTcb->Flags |= fMP_DEST_BROAD;
} else if ((shbufva[0] & 0x3) == 0x0001) { } else if ((shbufva[0] & 0x3) == 0x0001) {
MP_SET_FLAG(pMpTcb, fMP_DEST_MULTI); pMpTcb->Flags |= fMP_DEST_MULTI;
} }
} }
...@@ -1232,9 +1232,9 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, ...@@ -1232,9 +1232,9 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev,
TX_DESC_ENTRY_t *desc = NULL; TX_DESC_ENTRY_t *desc = NULL;
struct net_device_stats *stats = &etdev->net_stats; struct net_device_stats *stats = &etdev->net_stats;
if (MP_TEST_FLAG(pMpTcb, fMP_DEST_BROAD)) if (pMpTcb->Flags & fMP_DEST_BROAD)
atomic_inc(&etdev->Stats.brdcstxmt); atomic_inc(&etdev->Stats.brdcstxmt);
else if (MP_TEST_FLAG(pMpTcb, fMP_DEST_MULTI)) else if (pMpTcb->Flags & fMP_DEST_MULTI)
atomic_inc(&etdev->Stats.multixmt); atomic_inc(&etdev->Stats.multixmt);
else else
atomic_inc(&etdev->Stats.unixmt); atomic_inc(&etdev->Stats.unixmt);
......
...@@ -100,24 +100,11 @@ ...@@ -100,24 +100,11 @@
#define LO_MARK_PERCENT_FOR_PSR 15 #define LO_MARK_PERCENT_FOR_PSR 15
#define LO_MARK_PERCENT_FOR_RX 15 #define LO_MARK_PERCENT_FOR_RX 15
/* Macros for flag and ref count operations */
#define MP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F))
#define MP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F))
#define MP_CLEAR_FLAGS(_M) ((_M)->Flags = 0)
#define MP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0)
#define MP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
#define MP_IS_FLAG_CLEAR(_M, _F) (((_M)->Flags & (_F)) == 0)
/* Macros specific to the private adapter structure */ /* Macros specific to the private adapter structure */
#define MP_TCB_RESOURCES_AVAILABLE(_M) ((_M)->TxRing.nBusySend < NUM_TCB) #define MP_TCB_RESOURCES_AVAILABLE(_M) ((_M)->TxRing.nBusySend < NUM_TCB)
#define MP_TCB_RESOURCES_NOT_AVAILABLE(_M) ((_M)->TxRing.nBusySend >= NUM_TCB) #define MP_TCB_RESOURCES_NOT_AVAILABLE(_M) ((_M)->TxRing.nBusySend >= NUM_TCB)
#define MP_SHOULD_FAIL_SEND(_M) ((_M)->Flags & fMP_ADAPTER_FAIL_SEND_MASK) #define MP_SHOULD_FAIL_SEND(_M) ((_M)->Flags & fMP_ADAPTER_FAIL_SEND_MASK)
#define MP_IS_NOT_READY(_M) ((_M)->Flags & fMP_ADAPTER_NOT_READY_MASK)
#define MP_IS_READY(_M) (!((_M)->Flags & fMP_ADAPTER_NOT_READY_MASK))
#define MP_HAS_CABLE(_M) (!((_M)->Flags & fMP_ADAPTER_NO_CABLE))
#define MP_LINK_DETECTED(_M) (!((_M)->Flags & fMP_ADAPTER_LINK_DETECTION))
/* Counters for error rate monitoring */ /* Counters for error rate monitoring */
typedef struct _MP_ERR_COUNTERS { typedef struct _MP_ERR_COUNTERS {
......
...@@ -523,7 +523,7 @@ void et131x_link_detection_handler(unsigned long data) ...@@ -523,7 +523,7 @@ void et131x_link_detection_handler(unsigned long data)
spin_lock_irqsave(&etdev->Lock, flags); spin_lock_irqsave(&etdev->Lock, flags);
etdev->MediaState = NETIF_STATUS_MEDIA_DISCONNECT; etdev->MediaState = NETIF_STATUS_MEDIA_DISCONNECT;
MP_CLEAR_FLAG(etdev, fMP_ADAPTER_LINK_DETECTION); etdev->Flags &= ~fMP_ADAPTER_LINK_DETECTION;
spin_unlock_irqrestore(&etdev->Lock, flags); spin_unlock_irqrestore(&etdev->Lock, flags);
......
...@@ -253,7 +253,7 @@ int et131x_open(struct net_device *netdev) ...@@ -253,7 +253,7 @@ int et131x_open(struct net_device *netdev)
/* Enable device interrupts */ /* Enable device interrupts */
et131x_enable_interrupts(adapter); et131x_enable_interrupts(adapter);
MP_SET_FLAG(adapter, fMP_ADAPTER_INTERRUPT_IN_USE); adapter->Flags |= fMP_ADAPTER_INTERRUPT_IN_USE;
/* We're ready to move some data, so start the queue */ /* We're ready to move some data, so start the queue */
netif_start_queue(netdev); netif_start_queue(netdev);
...@@ -285,7 +285,7 @@ int et131x_close(struct net_device *netdev) ...@@ -285,7 +285,7 @@ int et131x_close(struct net_device *netdev)
et131x_disable_interrupts(adapter); et131x_disable_interrupts(adapter);
/* Deregistering ISR */ /* Deregistering ISR */
MP_CLEAR_FLAG(adapter, fMP_ADAPTER_INTERRUPT_IN_USE); adapter->Flags &= ~fMP_ADAPTER_INTERRUPT_IN_USE;
DBG_TRACE(et131x_dbginfo, "Deregistering ISR...\n"); DBG_TRACE(et131x_dbginfo, "Deregistering ISR...\n");
free_irq(netdev->irq, netdev); free_irq(netdev->irq, netdev);
...@@ -615,7 +615,7 @@ void et131x_tx_timeout(struct net_device *netdev) ...@@ -615,7 +615,7 @@ void et131x_tx_timeout(struct net_device *netdev)
DBG_WARNING(et131x_dbginfo, "TX TIMEOUT\n"); DBG_WARNING(et131x_dbginfo, "TX TIMEOUT\n");
/* Just skip this part if the adapter is doing link detection */ /* Just skip this part if the adapter is doing link detection */
if (MP_TEST_FLAG(etdev, fMP_ADAPTER_LINK_DETECTION)) { if (etdev->Flags & fMP_ADAPTER_LINK_DETECTION) {
DBG_ERROR(et131x_dbginfo, "Still doing link detection\n"); DBG_ERROR(et131x_dbginfo, "Still doing link detection\n");
return; return;
} }
...@@ -623,13 +623,13 @@ void et131x_tx_timeout(struct net_device *netdev) ...@@ -623,13 +623,13 @@ void et131x_tx_timeout(struct net_device *netdev)
/* Any nonrecoverable hardware error? /* Any nonrecoverable hardware error?
* Checks adapter->flags for any failure in phy reading * Checks adapter->flags for any failure in phy reading
*/ */
if (MP_TEST_FLAG(etdev, fMP_ADAPTER_NON_RECOVER_ERROR)) { if (etdev->Flags & fMP_ADAPTER_NON_RECOVER_ERROR) {
DBG_WARNING(et131x_dbginfo, "Non recoverable error - remove\n"); DBG_WARNING(et131x_dbginfo, "Non recoverable error - remove\n");
return; return;
} }
/* Hardware failure? */ /* Hardware failure? */
if (MP_TEST_FLAG(etdev, fMP_ADAPTER_HARDWARE_ERROR)) { if (etdev->Flags & fMP_ADAPTER_HARDWARE_ERROR) {
DBG_WARNING(et131x_dbginfo, "hardware error - reset\n"); DBG_WARNING(et131x_dbginfo, "hardware error - reset\n");
return; return;
} }
...@@ -751,7 +751,7 @@ int et131x_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -751,7 +751,7 @@ int et131x_change_mtu(struct net_device *netdev, int new_mtu)
et131x_adapter_setup(adapter); et131x_adapter_setup(adapter);
/* Enable interrupts */ /* Enable interrupts */
if (MP_TEST_FLAG(adapter, fMP_ADAPTER_INTERRUPT_IN_USE)) if (adapter->Flags & fMP_ADAPTER_INTERRUPT_IN_USE)
et131x_enable_interrupts(adapter); et131x_enable_interrupts(adapter);
/* Restart the Tx and Rx DMA engines */ /* Restart the Tx and Rx DMA engines */
...@@ -847,7 +847,7 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac) ...@@ -847,7 +847,7 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)
et131x_adapter_setup(adapter); et131x_adapter_setup(adapter);
/* Enable interrupts */ /* Enable interrupts */
if (MP_TEST_FLAG(adapter, fMP_ADAPTER_INTERRUPT_IN_USE)) if (adapter->Flags & fMP_ADAPTER_INTERRUPT_IN_USE)
et131x_enable_interrupts(adapter); et131x_enable_interrupts(adapter);
/* Restart the Tx and Rx DMA engines */ /* Restart the Tx and Rx DMA engines */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment