diff options
author | Alan Cox <alan@linux.intel.com> | 2009-08-27 11:01:57 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 12:02:28 -0700 |
commit | 356c74b401f6b05ae5d793e9d1a9ba8297b8e3ff (patch) | |
tree | 9c5aaad97326bbaf453b825b024b32756d2a951c /drivers/staging/et131x/et1310_rx.c | |
parent | f2c98d27b8e88cd17bb3e77f8fccf70f8d2ebd2f (diff) |
Staging: et131x: clean up DMA10/DMA4 types
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/et131x/et1310_rx.c')
-rw-r--r-- | drivers/staging/et131x/et1310_rx.c | 60 |
1 files changed, 22 insertions, 38 deletions
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 7f36de04703..757a8cd4541 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c @@ -739,20 +739,12 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) writel((uint32_t) (pRxLocal->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi); writel((uint32_t) pRxLocal->Fbr1Realpa, &rx_dma->fbr1_base_lo); writel(pRxLocal->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des.value); - - { - DMA10W_t fbr1_full = { 0 }; - - fbr1_full.bits.val = 0; - fbr1_full.bits.wrap = 1; - writel(fbr1_full.value, &rx_dma->fbr1_full_offset.value); - } + writel(ET_DMA10_WRAP, &rx_dma->fbr1_full_offset); /* This variable tracks the free buffer ring 1 full position, so it * has to match the above. */ - pRxLocal->local_Fbr1_full.bits.val = 0; - pRxLocal->local_Fbr1_full.bits.wrap = 1; + pRxLocal->local_Fbr1_full = ET_DMA10_WRAP; writel(((pRxLocal->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, &rx_dma->fbr1_min_des.value); @@ -769,20 +761,12 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) writel((uint32_t) (pRxLocal->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi); writel((uint32_t) pRxLocal->Fbr0Realpa, &rx_dma->fbr0_base_lo); writel(pRxLocal->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des.value); - - { - DMA10W_t fbr0_full = { 0 }; - - fbr0_full.bits.val = 0; - fbr0_full.bits.wrap = 1; - writel(fbr0_full.value, &rx_dma->fbr0_full_offset.value); - } + writel(ET_DMA10_WRAP, &rx_dma->fbr0_full_offset); /* This variable tracks the free buffer ring 0 full position, so it * has to match the above. */ - pRxLocal->local_Fbr0_full.bits.val = 0; - pRxLocal->local_Fbr0_full.bits.wrap = 1; + pRxLocal->local_Fbr0_full = ET_DMA10_WRAP; writel(((pRxLocal->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, &rx_dma->fbr0_min_des.value); #endif @@ -1282,6 +1266,16 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) DBG_RX_LEAVE(et131x_dbginfo); } +static inline u32 bump_fbr(u32 *fbr, u32 limit) +{ + u32 v = *fbr; + add_10bit(&v, 1); + if (v > limit) + v = (*fbr & ~ET_DMA10_MASK) ^ ET_DMA10_WRAP; + *fbr = v; + return v; +} + /** * NICReturnRFD - Recycle a RFD and put it back onto the receive list * @etdev: pointer to our adapter @@ -1310,7 +1304,7 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) if (ri == 1) { PFBR_DESC_t pNextDesc = (PFBR_DESC_t) (rx_local->pFbr1RingVa) + - rx_local->local_Fbr1_full.bits.val; + INDEX10(rx_local->local_Fbr1_full); /* Handle the Free Buffer Ring advancement here. Write * the PA / Buffer Index for the returned buffer into @@ -1320,20 +1314,15 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) pNextDesc->addr_lo = rx_local->Fbr[1]->PALow[bi]; pNextDesc->word2.value = bi; - if (++rx_local->local_Fbr1_full.bits.val > - (rx_local->Fbr1NumEntries - 1)) { - rx_local->local_Fbr1_full.bits.val = 0; - rx_local->local_Fbr1_full.bits.wrap ^= 1; - } - - writel(rx_local->local_Fbr1_full.value, - &rx_dma->fbr1_full_offset.value); + writel(bump_fbr(&rx_local->local_Fbr1_full, + rx_local->Fbr1NumEntries - 1), + &rx_dma->fbr1_full_offset); } #ifdef USE_FBR0 else { PFBR_DESC_t pNextDesc = (PFBR_DESC_t) rx_local->pFbr0RingVa + - rx_local->local_Fbr0_full.bits.val; + INDEX10(rx_local->local_Fbr0_full); /* Handle the Free Buffer Ring advancement here. Write * the PA / Buffer Index for the returned buffer into @@ -1343,14 +1332,9 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) pNextDesc->addr_lo = rx_local->Fbr[0]->PALow[bi]; pNextDesc->word2.value = bi; - if (++rx_local->local_Fbr0_full.bits.val > - (rx_local->Fbr0NumEntries - 1)) { - rx_local->local_Fbr0_full.bits.val = 0; - rx_local->local_Fbr0_full.bits.wrap ^= 1; - } - - writel(rx_local->local_Fbr0_full.value, - &rx_dma->fbr0_full_offset.value); + writel(bump_fbr(&rx_local->local_Fbr0_full, + rx_local->Fbr0NumEntries - 1), + &rx_dma->fbr0_full_offset); } #endif spin_unlock_irqrestore(&etdev->FbrLock, flags); |