netdev
[Top] [All Lists]

[PATCH 4/8] 2.6.5-rc2 - sis190 update

To: netdev@xxxxxxxxxxx
Subject: [PATCH 4/8] 2.6.5-rc2 - sis190 update
From: Francois Romieu <romieu@xxxxxxxxxxxxx>
Date: Sat, 27 Mar 2004 03:13:51 +0100
Cc: Jeff Garzik <jgarzik@xxxxxxxxx>
In-reply-to: <20040327031302.C31053@xxxxxxxxxxxxxxxxxxxxxxxxxx>; from romieu@xxxxxxxxxxxxx on Sat, Mar 27, 2004 at 03:13:02AM +0100
References: <20040327030853.A30849@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20040327031131.A31053@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20040327031219.B31053@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20040327031302.C31053@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.2.5.1i
New helpers (shamelessly stolen from r8169 driver):
- sis190_mark_as_last_descriptor;
- sis190_give_to_asic.


 drivers/net/sis190.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff -puN drivers/net/sis190.c~sis190-dma-api-rx-buffers-00 drivers/net/sis190.c
--- linux-2.6.5-rc2/drivers/net/sis190.c~sis190-dma-api-rx-buffers-00   
2004-03-27 02:35:56.000000000 +0100
+++ linux-2.6.5-rc2-fr/drivers/net/sis190.c     2004-03-27 02:36:46.000000000 
+0100
@@ -806,6 +806,17 @@ SiS190_hw_start(struct net_device *dev)
 
 }
 
+static inline void sis190_mark_as_last_descriptor(struct RxDesc *desc)
+{
+       desc->buf_Len |= cpu_to_le32(ENDbit);
+}
+
+static inline void sis190_give_to_asic(struct RxDesc *desc, dma_addr_t mapping)
+{
+       desc->buf_addr = cpu_to_le32(mapping);
+       desc->status |= cpu_to_le32(OWNbit | INTbit);
+}
+
 static int SiS190_init_ring(struct net_device *dev)
 {
        struct sis190_private *tp = dev->priv;
@@ -828,19 +839,16 @@ static int SiS190_init_ring(struct net_d
        for (i = 0; i < NUM_RX_DESC; i++) {
                struct RxDesc *desc = tp->RxDescArray + i;
                dma_addr_t mapping;
-               u32 len;
 
                desc->PSize = 0x0;
-
-               len = RX_BUF_SIZE + ENDbit * !((i + 1) % NUM_RX_DESC);
+               desc->buf_Len = cpu_to_le32(RX_BUF_SIZE);
 
                tp->RxBufferRing[i] = tp->RxBufferRings + i * RX_BUF_SIZE;
                mapping = pci_map_single(tp->pci_dev,
                        tp->RxBufferRing[i], RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
-               desc->buf_addr = cpu_to_le32(mapping);
-               desc->buf_Len = cpu_to_le32(len);
-               desc->status = cpu_to_le32(OWNbit | INTbit);
+               sis190_give_to_asic(desc, mapping);
        }
+       sis190_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1);
 
        return 0;
 

_

<Prev in Thread] Current Thread [Next in Thread>