* Re: [PATCH 2.6] RTL8169 Suspend and Resume Stuff
[not found] <1070212415.1607.17.camel@oxygenium>
@ 2003-12-01 1:04 ` Francois Romieu
2003-12-02 0:06 ` [PATCH 2.6] 2.6.0-test11 - more rtl8169 Francois Romieu
0 siblings, 1 reply; 7+ messages in thread
From: Francois Romieu @ 2003-12-01 1:04 UTC (permalink / raw)
To: Fernando Alencar Maróstica; +Cc: Brad House, netdev, jgarzik
I have queued it with the following modifications (mostly to keep the style
of the driver consistent):
- no whitespace before parenthesis for functions;
- s/ethernet_device/dev/ (like other drivers in drivers/net);
- write{b/w/l} -> RTL_W{8/16/32};
- netif_start_queue() done in rtl8169_hw_start().
See http://www.fr.zoreil.com/people/francois/misc/r8169/r8169-suspend.patch
for patch.
Btw, there is a flaw in r8169-dma-api-rx-buffers.patch so don't bother
testing it. I'll do it again tomorrow.
--
Ueimor
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2.6] 2.6.0-test11 - more rtl8169
2003-12-01 1:04 ` [PATCH 2.6] RTL8169 Suspend and Resume Stuff Francois Romieu
@ 2003-12-02 0:06 ` Francois Romieu
2003-12-03 23:26 ` [PATCH 2.6] 2.6.0-test11 - rtl8169 endianness Francois Romieu
2003-12-07 18:14 ` [PATCH 2.6] 2.6.0-test11 - more rtl8169 Jeff Garzik
0 siblings, 2 replies; 7+ messages in thread
From: Francois Romieu @ 2003-12-02 0:06 UTC (permalink / raw)
To: netdev; +Cc: =?unknown-8bit?Q?Fernando_Alencar_Mar=F3stica?=, Brad House,
jgarzik
[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]
Francois Romieu <romieu@fr.zoreil.com> :
[...]
> Btw, there is a flaw in r8169-dma-api-rx-buffers.patch so don't bother
> testing it. I'll do it again tomorrow.
Attached patch should fix it.
Executive summary:
o Pure 2.6.0-test11:
Get:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11/r8169-blob.tar.bz2
debuntarzipe and apply/compile/test in following order:
r8169-dma-api-tx.patch
r8169-dma-api-rx-buffers.patch <-+ Do not test these two patches
r8169-dma-api-rx-buffers-ahum.patch <-+ separately
r8169-start-xmit-fixes.patch
r8169-dma-api-tx-buffers.patch
r8169-rx_copybreak.patch
r8169-mac-phy-version.patch
r8169-init_one.patch
r8169-timer.patch
r8169-hw_start.patch
r8169-missing-tx-stats.patch
r8169-intr_mask.patch
r8169-suspend.patch
The same directory contains each patch alone as well.
o 2.6.0-test11 + 2.6.0-test9-bk25-netdrvr-exp1
Get:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-netdrv/r8169-blob.tar.bz2
Same thing as above with:
r8169-mac-phy-version.patch
r8169-init_one.patch
r8169-timer.patch
r8169-hw_start.patch
r8169-missing-tx-stats.patch
r8169-intr_mask.patch
r8169-suspend.patch
r8169-dma-api-rx-buffers-ahum.patch
Applying r8169-dma-api-rx-buffers-ahum.patch before
r8169-mac-phy-version.patch generates a few offsets but works as well.
--
Ueimor
[-- Attachment #2: r8169-dma-api-rx-buffers-ahum.patch --]
[-- Type: text/plain, Size: 2214 bytes --]
Brown paper bag time: the Rx descriptors are contiguous and EORbit only
marks the last descriptor in the array. OWNbit implicitly marks the end
of the Rx descriptors segment which is owned by the nic.
drivers/net/r8169.c | 20 ++++++--------------
1 files changed, 6 insertions(+), 14 deletions(-)
diff -puN drivers/net/r8169.c~r8169-dma-api-rx-buffers-ahum drivers/net/r8169.c
--- linux-2.6.0-test11/drivers/net/r8169.c~r8169-dma-api-rx-buffers-ahum 2003-12-02 00:22:41.000000000 +0100
+++ linux-2.6.0-test11-fr/drivers/net/r8169.c 2003-12-02 00:22:41.000000000 +0100
@@ -283,6 +283,8 @@ enum _DescStatusBit {
LSbit = 0x10000000,
};
+#define RsvdMask 0x3fffc000
+
struct TxDesc {
u32 status;
u32 vlan_tag;
@@ -1121,7 +1123,7 @@ rtl8169_hw_start(struct net_device *dev)
static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
{
desc->buf_addr = 0xdeadbeef;
- desc->status = EORbit;
+ desc->status &= ~(OWNbit | RsvdMask);
}
static void rtl8169_free_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
@@ -1141,7 +1143,7 @@ static inline void rtl8169_return_to_asi
static inline void rtl8169_give_to_asic(struct RxDesc *desc, dma_addr_t mapping)
{
desc->buf_addr = mapping;
- desc->status = OWNbit + RX_BUF_SIZE;
+ desc->status |= OWNbit + RX_BUF_SIZE;
}
static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev,
@@ -1209,11 +1211,6 @@ static inline void rtl8169_mark_as_last_
desc->status |= EORbit;
}
-static inline void rtl8169_unmark_as_last_descriptor(struct RxDesc *desc)
-{
- desc->status &= ~EORbit;
-}
-
static int rtl8169_init_ring(struct net_device *dev)
{
struct rtl8169_private *tp = dev->priv;
@@ -1460,14 +1457,9 @@ rtl8169_rx_interrupt(struct net_device *
}
delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx);
- if (delta > 0) {
- u32 old_last = (tp->dirty_rx - 1) % NUM_RX_DESC;
-
+ if (delta > 0)
tp->dirty_rx += delta;
- rtl8169_mark_as_last_descriptor(tp->RxDescArray +
- (tp->dirty_rx - 1)%NUM_RX_DESC);
- rtl8169_unmark_as_last_descriptor(tp->RxDescArray + old_last);
- } else if (delta < 0)
+ else if (delta < 0)
printk(KERN_INFO "%s: no Rx buffer allocated\n", dev->name);
/*
_
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2.6] 2.6.0-test11 - rtl8169 endianness
2003-12-02 0:06 ` [PATCH 2.6] 2.6.0-test11 - more rtl8169 Francois Romieu
@ 2003-12-03 23:26 ` Francois Romieu
2003-12-03 23:30 ` Brad House
2003-12-07 18:14 ` [PATCH 2.6] 2.6.0-test11 - more rtl8169 Jeff Garzik
1 sibling, 1 reply; 7+ messages in thread
From: Francois Romieu @ 2003-12-03 23:26 UTC (permalink / raw)
To: netdev
Cc: =?unknown-8bit?Q?Fernando_Alencar_Mar=F3stica?=, Brad House,
Matthew Gregan, jgarzik
[-- Attachment #1: Type: text/plain, Size: 607 bytes --]
See patch in attachment.
Francois Romieu <romieu@fr.zoreil.com> :
[...]
> o Pure 2.6.0-test11:
>
> Get:
> http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11/r8169-blob.tar.bz2
> debuntarzipe and apply/compile/test in following order:
> r8169-dma-api-tx.patch
[...]
> r8169-suspend.patch
Insert here.
[...]
> o 2.6.0-test11 + 2.6.0-test9-bk25-netdrvr-exp1
>
> Get:
> http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-netdrv/r8169-blob.tar.bz2
> Same thing as above with:
> r8169-mac-phy-version.patch
[...]
> r8169-suspend.patch
> r8169-dma-api-rx-buffers-ahum.patch
Or here.
--
Ueimor
[-- Attachment #2: r8169-endianness.patch --]
[-- Type: text/plain, Size: 3854 bytes --]
Endianness update (original idea from Alexandra N. Kossovsky):
- descriptors status (bitfields enumerated as _DescStatusBit);
- address of buffers stored in Rx/Tx descriptors.
drivers/net/r8169.c | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
diff -puN drivers/net/r8169.c~r8169-endianness drivers/net/r8169.c
--- linux-2.6.0-test11/drivers/net/r8169.c~r8169-endianness 2003-12-03 23:29:40.000000000 +0100
+++ linux-2.6.0-test11-fr/drivers/net/r8169.c 2003-12-03 23:50:54.000000000 +0100
@@ -1123,13 +1123,14 @@ rtl8169_hw_start(struct net_device *dev)
static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
{
desc->buf_addr = 0xdeadbeef;
- desc->status &= ~(OWNbit | RsvdMask);
+ desc->status &= ~cpu_to_le32(OWNbit | RsvdMask);
}
static void rtl8169_free_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
struct RxDesc *desc)
{
- pci_unmap_single(pdev, desc->buf_addr, RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+ pci_unmap_single(pdev, le32_to_cpu(desc->buf_addr), RX_BUF_SIZE,
+ PCI_DMA_FROMDEVICE);
dev_kfree_skb(*sk_buff);
*sk_buff = NULL;
rtl8169_make_unusable_by_asic(desc);
@@ -1137,13 +1138,13 @@ static void rtl8169_free_rx_skb(struct p
static inline void rtl8169_return_to_asic(struct RxDesc *desc)
{
- desc->status |= OWNbit + RX_BUF_SIZE;
+ desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE);
}
static inline void rtl8169_give_to_asic(struct RxDesc *desc, dma_addr_t mapping)
{
- desc->buf_addr = mapping;
- desc->status |= OWNbit + RX_BUF_SIZE;
+ desc->buf_addr = cpu_to_le32(mapping);
+ desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE);
}
static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev,
@@ -1208,7 +1209,7 @@ static u32 rtl8169_rx_fill(struct rtl816
static inline void rtl8169_mark_as_last_descriptor(struct RxDesc *desc)
{
- desc->status |= EORbit;
+ desc->status |= cpu_to_le32(EORbit);
}
static int rtl8169_init_ring(struct net_device *dev)
@@ -1240,8 +1241,8 @@ static void rtl8169_unmap_tx_skb(struct
{
u32 len = sk_buff[0]->len;
- pci_unmap_single(pdev, desc->buf_addr, len < ETH_ZLEN ? ETH_ZLEN : len,
- PCI_DMA_TODEVICE);
+ pci_unmap_single(pdev, le32_to_cpu(desc->buf_addr),
+ len < ETH_ZLEN ? ETH_ZLEN : len, PCI_DMA_TODEVICE);
desc->buf_addr = 0x00;
*sk_buff = NULL;
}
@@ -1307,17 +1308,17 @@ rtl8169_start_xmit(struct sk_buff *skb,
spin_lock_irq(&tp->lock);
- if ((tp->TxDescArray[entry].status & OWNbit) == 0) {
+ if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) {
dma_addr_t mapping;
mapping = pci_map_single(tp->pci_dev, skb->data, len,
PCI_DMA_TODEVICE);
tp->Tx_skbuff[entry] = skb;
- tp->TxDescArray[entry].buf_addr = mapping;
+ tp->TxDescArray[entry].buf_addr = cpu_to_le32(mapping);
- tp->TxDescArray[entry].status = OWNbit | FSbit | LSbit | len |
- (EORbit * !((entry + 1) % NUM_TX_DESC));
+ tp->TxDescArray[entry].status = cpu_to_le32(OWNbit | FSbit |
+ LSbit | len | (EORbit * !((entry + 1) % NUM_TX_DESC)));
RTL_W8(TxPoll, 0x40); //set polling bit
@@ -1358,7 +1359,7 @@ rtl8169_tx_interrupt(struct net_device *
tx_left = tp->cur_tx - dirty_tx;
while (tx_left > 0) {
- if ((tp->TxDescArray[entry].status & OWNbit) == 0) {
+ if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) {
int cur = dirty_tx % NUM_TX_DESC;
struct sk_buff *skb = tp->Tx_skbuff[cur];
@@ -1416,8 +1417,8 @@ rtl8169_rx_interrupt(struct net_device *
cur_rx = tp->cur_rx % RX_BUF_SIZE;
- while ((tp->RxDescArray[cur_rx].status & OWNbit) == 0) {
- u32 status = tp->RxDescArray[cur_rx].status;
+ while (!(le32_to_cpu(tp->RxDescArray[cur_rx].status) & OWNbit)) {
+ u32 status = le32_to_cpu(tp->RxDescArray[cur_rx].status);
if (status & RxRES) {
printk(KERN_INFO "%s: Rx ERROR!!!\n", dev->name);
_
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.6] 2.6.0-test11 - rtl8169 endianness
2003-12-03 23:26 ` [PATCH 2.6] 2.6.0-test11 - rtl8169 endianness Francois Romieu
@ 2003-12-03 23:30 ` Brad House
0 siblings, 0 replies; 7+ messages in thread
From: Brad House @ 2003-12-03 23:30 UTC (permalink / raw)
To: Francois Romieu
Cc: netdev, Fernando Alencar Maróstica, Brad House,
Matthew Gregan, jgarzik
k, cool ... I should have time to test all this tonight ...
-Brad
Francois Romieu wrote:
> See patch in attachment.
>
> Francois Romieu <romieu@fr.zoreil.com> :
> [...]
>
>>o Pure 2.6.0-test11:
>>
>>Get:
>>http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11/r8169-blob.tar.bz2
>>debuntarzipe and apply/compile/test in following order:
>>r8169-dma-api-tx.patch
>
> [...]
>
>>r8169-suspend.patch
>
>
> Insert here.
>
> [...]
>
>>o 2.6.0-test11 + 2.6.0-test9-bk25-netdrvr-exp1
>>
>>Get:
>>http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-netdrv/r8169-blob.tar.bz2
>>Same thing as above with:
>>r8169-mac-phy-version.patch
>
> [...]
>
>>r8169-suspend.patch
>>r8169-dma-api-rx-buffers-ahum.patch
>
>
> Or here.
>
> --
> Ueimor
>
>
> ------------------------------------------------------------------------
>
>
> Endianness update (original idea from Alexandra N. Kossovsky):
> - descriptors status (bitfields enumerated as _DescStatusBit);
> - address of buffers stored in Rx/Tx descriptors.
>
>
>
> drivers/net/r8169.c | 31 ++++++++++++++++---------------
> 1 files changed, 16 insertions(+), 15 deletions(-)
>
> diff -puN drivers/net/r8169.c~r8169-endianness drivers/net/r8169.c
> --- linux-2.6.0-test11/drivers/net/r8169.c~r8169-endianness 2003-12-03 23:29:40.000000000 +0100
> +++ linux-2.6.0-test11-fr/drivers/net/r8169.c 2003-12-03 23:50:54.000000000 +0100
> @@ -1123,13 +1123,14 @@ rtl8169_hw_start(struct net_device *dev)
> static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
> {
> desc->buf_addr = 0xdeadbeef;
> - desc->status &= ~(OWNbit | RsvdMask);
> + desc->status &= ~cpu_to_le32(OWNbit | RsvdMask);
> }
>
> static void rtl8169_free_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
> struct RxDesc *desc)
> {
> - pci_unmap_single(pdev, desc->buf_addr, RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
> + pci_unmap_single(pdev, le32_to_cpu(desc->buf_addr), RX_BUF_SIZE,
> + PCI_DMA_FROMDEVICE);
> dev_kfree_skb(*sk_buff);
> *sk_buff = NULL;
> rtl8169_make_unusable_by_asic(desc);
> @@ -1137,13 +1138,13 @@ static void rtl8169_free_rx_skb(struct p
>
> static inline void rtl8169_return_to_asic(struct RxDesc *desc)
> {
> - desc->status |= OWNbit + RX_BUF_SIZE;
> + desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE);
> }
>
> static inline void rtl8169_give_to_asic(struct RxDesc *desc, dma_addr_t mapping)
> {
> - desc->buf_addr = mapping;
> - desc->status |= OWNbit + RX_BUF_SIZE;
> + desc->buf_addr = cpu_to_le32(mapping);
> + desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE);
> }
>
> static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev,
> @@ -1208,7 +1209,7 @@ static u32 rtl8169_rx_fill(struct rtl816
>
> static inline void rtl8169_mark_as_last_descriptor(struct RxDesc *desc)
> {
> - desc->status |= EORbit;
> + desc->status |= cpu_to_le32(EORbit);
> }
>
> static int rtl8169_init_ring(struct net_device *dev)
> @@ -1240,8 +1241,8 @@ static void rtl8169_unmap_tx_skb(struct
> {
> u32 len = sk_buff[0]->len;
>
> - pci_unmap_single(pdev, desc->buf_addr, len < ETH_ZLEN ? ETH_ZLEN : len,
> - PCI_DMA_TODEVICE);
> + pci_unmap_single(pdev, le32_to_cpu(desc->buf_addr),
> + len < ETH_ZLEN ? ETH_ZLEN : len, PCI_DMA_TODEVICE);
> desc->buf_addr = 0x00;
> *sk_buff = NULL;
> }
> @@ -1307,17 +1308,17 @@ rtl8169_start_xmit(struct sk_buff *skb,
>
> spin_lock_irq(&tp->lock);
>
> - if ((tp->TxDescArray[entry].status & OWNbit) == 0) {
> + if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) {
> dma_addr_t mapping;
>
> mapping = pci_map_single(tp->pci_dev, skb->data, len,
> PCI_DMA_TODEVICE);
>
> tp->Tx_skbuff[entry] = skb;
> - tp->TxDescArray[entry].buf_addr = mapping;
> + tp->TxDescArray[entry].buf_addr = cpu_to_le32(mapping);
>
> - tp->TxDescArray[entry].status = OWNbit | FSbit | LSbit | len |
> - (EORbit * !((entry + 1) % NUM_TX_DESC));
> + tp->TxDescArray[entry].status = cpu_to_le32(OWNbit | FSbit |
> + LSbit | len | (EORbit * !((entry + 1) % NUM_TX_DESC)));
>
> RTL_W8(TxPoll, 0x40); //set polling bit
>
> @@ -1358,7 +1359,7 @@ rtl8169_tx_interrupt(struct net_device *
> tx_left = tp->cur_tx - dirty_tx;
>
> while (tx_left > 0) {
> - if ((tp->TxDescArray[entry].status & OWNbit) == 0) {
> + if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) {
> int cur = dirty_tx % NUM_TX_DESC;
> struct sk_buff *skb = tp->Tx_skbuff[cur];
>
> @@ -1416,8 +1417,8 @@ rtl8169_rx_interrupt(struct net_device *
>
> cur_rx = tp->cur_rx % RX_BUF_SIZE;
>
> - while ((tp->RxDescArray[cur_rx].status & OWNbit) == 0) {
> - u32 status = tp->RxDescArray[cur_rx].status;
> + while (!(le32_to_cpu(tp->RxDescArray[cur_rx].status) & OWNbit)) {
> + u32 status = le32_to_cpu(tp->RxDescArray[cur_rx].status);
>
> if (status & RxRES) {
> printk(KERN_INFO "%s: Rx ERROR!!!\n", dev->name);
>
> _
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.6] 2.6.0-test11 - more rtl8169
2003-12-02 0:06 ` [PATCH 2.6] 2.6.0-test11 - more rtl8169 Francois Romieu
2003-12-03 23:26 ` [PATCH 2.6] 2.6.0-test11 - rtl8169 endianness Francois Romieu
@ 2003-12-07 18:14 ` Jeff Garzik
2003-12-07 23:01 ` [PATCH 2.6] 2.6.0-test11-bk5 - rtl8169 Francois Romieu
1 sibling, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2003-12-07 18:14 UTC (permalink / raw)
To: Francois Romieu; +Cc: netdev, Fernando Alencar Maróstica, Brad House
Francois Romieu wrote:
> Get:
> http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-netdrv/r8169-blob.tar.bz2
> Same thing as above with:
> r8169-mac-phy-version.patch
> r8169-init_one.patch
> r8169-timer.patch
> r8169-hw_start.patch
> r8169-missing-tx-stats.patch
> r8169-intr_mask.patch
> r8169-suspend.patch
> r8169-dma-api-rx-buffers-ahum.patch
All the above patches applied, in the above order.
Thanks much, Francois!
Is there anything left?
Jeff
P.S. Will release updated 2.5-exp patch soon.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2.6] 2.6.0-test11-bk5 - rtl8169
2003-12-07 18:14 ` [PATCH 2.6] 2.6.0-test11 - more rtl8169 Jeff Garzik
@ 2003-12-07 23:01 ` Francois Romieu
2003-12-08 0:00 ` Jeff Garzik
0 siblings, 1 reply; 7+ messages in thread
From: Francois Romieu @ 2003-12-07 23:01 UTC (permalink / raw)
To: Jeff Garzik
Cc: netdev, =?unknown-8bit?Q?Fernando_Alencar_Mar=F3stica?=,
Brad House
[-- Attachment #1: Type: text/plain, Size: 344 bytes --]
Jeff Garzik <jgarzik@pobox.com> :
[...]
> Is there anything left?
See attachment for
r8169-endianness.patch
r8169-getstats.patch
(against 2.6.0-test11-bk5 + 2.6.0-test11-bk5-netdrvr-exp1).
I diffed the whole thing against pure 2.6.0-test11 as well.
It is available at:
http://www.fr.zoreil.com/linux/kernel/2.6.x/2.6.0-test11-bk5
--
Ueimor
[-- Attachment #2: r8169-endianness.patch --]
[-- Type: text/plain, Size: 3862 bytes --]
Endianness update (original idea from Alexandra N. Kossovsky):
- descriptors status (bitfields enumerated as _DescStatusBit);
- address of buffers stored in Rx/Tx descriptors.
drivers/net/r8169.c | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
diff -puN drivers/net/r8169.c~r8169-endianness drivers/net/r8169.c
--- linux-2.6.0-test11-bk5/drivers/net/r8169.c~r8169-endianness 2003-12-07 23:26:32.000000000 +0100
+++ linux-2.6.0-test11-bk5-fr/drivers/net/r8169.c 2003-12-07 23:26:32.000000000 +0100
@@ -1116,13 +1116,14 @@ rtl8169_hw_start(struct net_device *dev)
static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
{
desc->buf_addr = 0xdeadbeef;
- desc->status &= ~(OWNbit | RsvdMask);
+ desc->status &= ~cpu_to_le32(OWNbit | RsvdMask);
}
static void rtl8169_free_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
struct RxDesc *desc)
{
- pci_unmap_single(pdev, desc->buf_addr, RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+ pci_unmap_single(pdev, le32_to_cpu(desc->buf_addr), RX_BUF_SIZE,
+ PCI_DMA_FROMDEVICE);
dev_kfree_skb(*sk_buff);
*sk_buff = NULL;
rtl8169_make_unusable_by_asic(desc);
@@ -1130,13 +1131,13 @@ static void rtl8169_free_rx_skb(struct p
static inline void rtl8169_return_to_asic(struct RxDesc *desc)
{
- desc->status |= OWNbit + RX_BUF_SIZE;
+ desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE);
}
static inline void rtl8169_give_to_asic(struct RxDesc *desc, dma_addr_t mapping)
{
- desc->buf_addr = mapping;
- desc->status |= OWNbit + RX_BUF_SIZE;
+ desc->buf_addr = cpu_to_le32(mapping);
+ desc->status |= cpu_to_le32(OWNbit + RX_BUF_SIZE);
}
static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct net_device *dev,
@@ -1201,7 +1202,7 @@ static u32 rtl8169_rx_fill(struct rtl816
static inline void rtl8169_mark_as_last_descriptor(struct RxDesc *desc)
{
- desc->status |= EORbit;
+ desc->status |= cpu_to_le32(EORbit);
}
static int rtl8169_init_ring(struct net_device *dev)
@@ -1233,8 +1234,8 @@ static void rtl8169_unmap_tx_skb(struct
{
u32 len = sk_buff[0]->len;
- pci_unmap_single(pdev, desc->buf_addr, len < ETH_ZLEN ? ETH_ZLEN : len,
- PCI_DMA_TODEVICE);
+ pci_unmap_single(pdev, le32_to_cpu(desc->buf_addr),
+ len < ETH_ZLEN ? ETH_ZLEN : len, PCI_DMA_TODEVICE);
desc->buf_addr = 0x00;
*sk_buff = NULL;
}
@@ -1300,17 +1301,17 @@ rtl8169_start_xmit(struct sk_buff *skb,
spin_lock_irq(&tp->lock);
- if ((tp->TxDescArray[entry].status & OWNbit) == 0) {
+ if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) {
dma_addr_t mapping;
mapping = pci_map_single(tp->pci_dev, skb->data, len,
PCI_DMA_TODEVICE);
tp->Tx_skbuff[entry] = skb;
- tp->TxDescArray[entry].buf_addr = mapping;
+ tp->TxDescArray[entry].buf_addr = cpu_to_le32(mapping);
- tp->TxDescArray[entry].status = OWNbit | FSbit | LSbit | len |
- (EORbit * !((entry + 1) % NUM_TX_DESC));
+ tp->TxDescArray[entry].status = cpu_to_le32(OWNbit | FSbit |
+ LSbit | len | (EORbit * !((entry + 1) % NUM_TX_DESC)));
RTL_W8(TxPoll, 0x40); //set polling bit
@@ -1351,7 +1352,7 @@ rtl8169_tx_interrupt(struct net_device *
tx_left = tp->cur_tx - dirty_tx;
while (tx_left > 0) {
- if ((tp->TxDescArray[entry].status & OWNbit) == 0) {
+ if (!(le32_to_cpu(tp->TxDescArray[entry].status) & OWNbit)) {
int cur = dirty_tx % NUM_TX_DESC;
struct sk_buff *skb = tp->Tx_skbuff[cur];
@@ -1409,8 +1410,8 @@ rtl8169_rx_interrupt(struct net_device *
cur_rx = tp->cur_rx % RX_BUF_SIZE;
- while ((tp->RxDescArray[cur_rx].status & OWNbit) == 0) {
- u32 status = tp->RxDescArray[cur_rx].status;
+ while (!(le32_to_cpu(tp->RxDescArray[cur_rx].status) & OWNbit)) {
+ u32 status = le32_to_cpu(tp->RxDescArray[cur_rx].status);
if (status & RxRES) {
printk(KERN_INFO "%s: Rx ERROR!!!\n", dev->name);
_
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: r8169-getstats.patch --]
[-- Type: text/plain; charset=unknown-8bit, Size: 1109 bytes --]
Stats fix (Fernando Alencar Maróstica <famarost@unimep.br>).
drivers/net/r8169.c | 15 +++++++++++++++
1 files changed, 15 insertions(+)
diff -puN drivers/net/r8169.c~r8169-getstats drivers/net/r8169.c
--- linux-2.6.0-test11-bk5/drivers/net/r8169.c~r8169-getstats 2003-12-07 23:26:37.000000000 +0100
+++ linux-2.6.0-test11-bk5-fr/drivers/net/r8169.c 2003-12-07 23:26:37.000000000 +0100
@@ -1610,11 +1610,26 @@ rtl8169_set_rx_mode(struct net_device *d
spin_unlock_irqrestore(&tp->lock, flags);
}
+/**
+ * rtl8169_get_stats - Get rtl8169 read/write statistics
+ * @dev: The Ethernet Device to get statistics for
+ *
+ * Get TX/RX statistics for rtl8169
+ */
struct net_device_stats *
rtl8169_get_stats(struct net_device *dev)
{
struct rtl8169_private *tp = dev->priv;
+ void *ioaddr = tp->mmio_addr;
+ unsigned long flags;
+ if (netif_running(dev)) {
+ spin_lock_irqsave(&tp->lock, flags);
+ tp->stats.rx_missed_errors += RTL_R32(RxMissed);
+ RTL_W32(RxMissed, 0);
+ spin_unlock_irqrestore(&tp->lock, flags);
+ }
+
return &tp->stats;
}
_
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.6] 2.6.0-test11-bk5 - rtl8169
2003-12-07 23:01 ` [PATCH 2.6] 2.6.0-test11-bk5 - rtl8169 Francois Romieu
@ 2003-12-08 0:00 ` Jeff Garzik
0 siblings, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2003-12-08 0:00 UTC (permalink / raw)
To: Francois Romieu; +Cc: netdev, Fernando Alencar Maróstica, Brad House
thanks, applied both -endianness and -getstats patches.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-12-08 0:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1070212415.1607.17.camel@oxygenium>
2003-12-01 1:04 ` [PATCH 2.6] RTL8169 Suspend and Resume Stuff Francois Romieu
2003-12-02 0:06 ` [PATCH 2.6] 2.6.0-test11 - more rtl8169 Francois Romieu
2003-12-03 23:26 ` [PATCH 2.6] 2.6.0-test11 - rtl8169 endianness Francois Romieu
2003-12-03 23:30 ` Brad House
2003-12-07 18:14 ` [PATCH 2.6] 2.6.0-test11 - more rtl8169 Jeff Garzik
2003-12-07 23:01 ` [PATCH 2.6] 2.6.0-test11-bk5 - rtl8169 Francois Romieu
2003-12-08 0:00 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).