summaryrefslogtreecommitdiff
path: root/drivers/net/sis190.c
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2005-07-30 13:13:03 +0200
committerJeff Garzik <jgarzik@pobox.com>2005-07-30 18:21:00 -0400
commit8b5641d4f1f7376257783b79f121a19ccd86b56b (patch)
treeff22ed47573d826d8744effd78edefd30100c8fe /drivers/net/sis190.c
parent830fb7d23217ae748df0b16d4d419110810036b7 (diff)
downloadlinux-3.10-8b5641d4f1f7376257783b79f121a19ccd86b56b.tar.gz
linux-3.10-8b5641d4f1f7376257783b79f121a19ccd86b56b.tar.bz2
linux-3.10-8b5641d4f1f7376257783b79f121a19ccd86b56b.zip
[PATCH] sis190: the size of the Rx buffer is constrained
Add a restriction to the size of the Rx buffer SiS driver forces the size of any Rx buffer to be a multiple of 64 bit. I would not be surprized that it goes along with some alignment issues which have been experienced before. So far it does not make much of a difference (both drivers use 1536 bytes buffer). Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/sis190.c')
-rw-r--r--drivers/net/sis190.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 1e8e7111c26..2229698debb 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -69,6 +69,7 @@
#define TX_RING_BYTES (NUM_TX_DESC * sizeof(struct TxDesc))
#define RX_RING_BYTES (NUM_RX_DESC * sizeof(struct RxDesc))
#define RX_BUF_SIZE 1536
+#define RX_BUF_MASK 0xfff8
#define SIS190_REGS_SIZE 0x80
#define SIS190_TX_TIMEOUT (6*HZ)
@@ -400,7 +401,7 @@ static inline void sis190_give_to_asic(struct RxDesc *desc, u32 rx_buf_sz)
u32 eor = le32_to_cpu(desc->size) & RingEnd;
desc->PSize = 0x0;
- desc->size = cpu_to_le32(rx_buf_sz | eor);
+ desc->size = cpu_to_le32((rx_buf_sz & RX_BUF_MASK) | eor);
wmb();
desc->status = cpu_to_le32(OWNbit | INTbit);
}
@@ -924,6 +925,11 @@ static void sis190_set_rxbufsize(struct sis190_private *tp,
unsigned int mtu = dev->mtu;
tp->rx_buf_sz = (mtu > RX_BUF_SIZE) ? mtu + ETH_HLEN + 8 : RX_BUF_SIZE;
+ /* RxDesc->size has a licence to kill the lower bits */
+ if (tp->rx_buf_sz & 0x07) {
+ tp->rx_buf_sz += 8;
+ tp->rx_buf_sz &= RX_BUF_MASK;
+ }
}
static int sis190_open(struct net_device *dev)