* [PATCH 0/2] ET131x regression fixes
@ 2009-10-12 14:38 Alan Cox
2009-10-12 14:38 ` [PATCH 1/2] et131x: Correct WRAP bit handling Alan Cox
2009-10-12 14:38 ` [PATCH 2/2] et131x: Fix the add_10bit macro Alan Cox
0 siblings, 2 replies; 3+ messages in thread
From: Alan Cox @ 2009-10-12 14:38 UTC (permalink / raw)
To: greg, linux-kernel
These fix an RX and a TX bug in the wrap handling logic when converting it
from a mass of bitfields. They'll apply before or after the big block I sent
earlier.
---
Alan Cox (2):
et131x: Fix the add_10bit macro
et131x: Correct WRAP bit handling
drivers/staging/et131x/et1310_address_map.h | 2 +-
drivers/staging/et131x/et1310_rx.c | 20 ++++++++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)
--
The lunar night club was most disappointing - not atmosphere at all.
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 1/2] et131x: Correct WRAP bit handling
2009-10-12 14:38 [PATCH 0/2] ET131x regression fixes Alan Cox
@ 2009-10-12 14:38 ` Alan Cox
2009-10-12 14:38 ` [PATCH 2/2] et131x: Fix the add_10bit macro Alan Cox
1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2009-10-12 14:38 UTC (permalink / raw)
To: greg, linux-kernel
add_10bit loses the existing wrap value
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_rx.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 8f2e91f..10e21db 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -1177,12 +1177,20 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
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;
+ u32 v = *fbr;
+ v++;
+ /* This works for all cases where limit < 1024. The 1023 case
+ works because 1023++ is 1024 which means the if condition is not
+ taken but the carry of the bit into the wrap bit toggles the wrap
+ value correctly */
+ if ((v & ET_DMA10_MASK) > limit) {
+ v &= ~ET_DMA10_MASK;
+ v ^= ET_DMA10_WRAP;
+ }
+ /* For the 1023 case */
+ v &= (ET_DMA10_MASK|ET_DMA10_WRAP);
+ *fbr = v;
+ return v;
}
/**
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] et131x: Fix the add_10bit macro
2009-10-12 14:38 [PATCH 0/2] ET131x regression fixes Alan Cox
2009-10-12 14:38 ` [PATCH 1/2] et131x: Correct WRAP bit handling Alan Cox
@ 2009-10-12 14:38 ` Alan Cox
1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2009-10-12 14:38 UTC (permalink / raw)
To: greg, linux-kernel
Duh.. we need to preserve the wrap bit when adding.
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/et131x/et1310_address_map.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index 6294d38..2c3d65a 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -223,7 +223,7 @@ typedef union _TXDMA_PR_NUM_DES_t {
extern inline void add_10bit(u32 *v, int n)
{
- *v = INDEX10(*v + n);
+ *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP);
}
/*
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-12 14:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-12 14:38 [PATCH 0/2] ET131x regression fixes Alan Cox
2009-10-12 14:38 ` [PATCH 1/2] et131x: Correct WRAP bit handling Alan Cox
2009-10-12 14:38 ` [PATCH 2/2] et131x: Fix the add_10bit macro Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®