Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
7dd822b2
Commit
7dd822b2
authored
Sep 28, 2002
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sundance net drvr: fix reset_tx logic
(contributed by Edward Peng @ D-Link, cleaned up by me)
parent
bb09051b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
28 deletions
+31
-28
drivers/net/sundance.c
drivers/net/sundance.c
+31
-28
No files found.
drivers/net/sundance.c
View file @
7dd822b2
...
...
@@ -322,6 +322,8 @@ enum alta_offsets {
TxDMAPollPeriod
=
0x0a
,
RxDMAStatus
=
0x0c
,
RxListPtr
=
0x10
,
DebugCtrl0
=
0x1a
,
DebugCtrl1
=
0x1c
,
RxDMABurstThresh
=
0x14
,
RxDMAUrgentThresh
=
0x15
,
RxDMAPollPeriod
=
0x16
,
...
...
@@ -480,7 +482,7 @@ static void netdev_timer(unsigned long data);
static
void
tx_timeout
(
struct
net_device
*
dev
);
static
void
init_ring
(
struct
net_device
*
dev
);
static
int
start_tx
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
);
static
int
reset_tx
(
struct
net_device
*
dev
,
int
irq
);
static
int
reset_tx
(
struct
net_device
*
dev
);
static
void
intr_handler
(
int
irq
,
void
*
dev_instance
,
struct
pt_regs
*
regs
);
static
void
rx_poll
(
unsigned
long
data
);
static
void
refill_rx
(
struct
net_device
*
dev
);
...
...
@@ -934,6 +936,7 @@ static void tx_timeout(struct net_device *dev)
long
ioaddr
=
dev
->
base_addr
;
long
flag
;
writew
(
0
,
ioaddr
+
IntrEnable
);
printk
(
KERN_WARNING
"%s: Transmit timed out, TxStatus %2.2x "
"TxFrameId %2.2x,"
" resetting...
\n
"
,
dev
->
name
,
readb
(
ioaddr
+
TxStatus
),
...
...
@@ -948,9 +951,11 @@ static void tx_timeout(struct net_device *dev)
for
(
i
=
0
;
i
<
TX_RING_SIZE
;
i
++
)
printk
(
" %8.8x"
,
np
->
tx_ring
[
i
].
status
);
printk
(
"
\n
"
);
printk
(
KERN_DEBUG
"cur_tx=%d dirty_tx=%d
\n
"
,
np
->
cur_tx
,
np
->
dirty_tx
);
printk
(
KERN_DEBUG
"cur_rx=%d dirty_rx=%d
\n
"
,
np
->
cur_rx
,
np
->
dirty_rx
);
}
spin_lock_irqsave
(
&
np
->
lock
,
flag
);
reset_tx
(
dev
,
0
);
reset_tx
(
dev
);
spin_unlock_irqrestore
(
&
np
->
lock
,
flag
);
/* Perhaps we should reinitialize the hardware here. */
...
...
@@ -962,9 +967,7 @@ static void tx_timeout(struct net_device *dev)
dev
->
trans_start
=
jiffies
;
np
->
stats
.
tx_errors
++
;
if
(
!
netif_queue_stopped
(
dev
))
netif_wake_queue
(
dev
);
netif_wake_queue
(
dev
);
}
...
...
@@ -1067,15 +1070,18 @@ start_tx (struct sk_buff *skb, struct net_device *dev)
writel
(
1000
,
ioaddr
+
DownCounter
);
return
0
;
}
/* Reset hardware tx and reset TxListPtr to TxFrameId */
static
int
reset_tx
(
struct
net_device
*
dev
,
int
irq
)
reset_tx
(
struct
net_device
*
dev
)
{
struct
netdev_private
*
np
=
(
struct
netdev_private
*
)
dev
->
priv
;
long
ioaddr
=
dev
->
base_addr
;
struct
sk_buff
*
skb
;
int
i
;
int
frame_id
;
frame_id
=
readb
(
ioaddr
+
TxFrameId
);
int
irq
=
in_interrupt
();
/* reset tx logic */
writel
(
0
,
dev
->
base_addr
+
TxListPtr
);
writew
(
TxReset
|
DMAReset
|
FIFOReset
|
NetworkReset
,
ioaddr
+
ASICCtrl
+
2
);
for
(
i
=
50
;
i
>
0
;
i
--
)
{
...
...
@@ -1083,25 +1089,22 @@ reset_tx (struct net_device *dev, int irq)
break
;
mdelay
(
1
);
}
for
(;
np
->
cur_tx
-
np
->
dirty_tx
>
0
;
np
->
dirty_tx
++
)
{
int
entry
=
np
->
dirty_tx
%
TX_RING_SIZE
;
struct
sk_buff
*
skb
;
if
(
!
(
np
->
tx_ring
[
entry
].
status
&
0x00010000
))
break
;
skb
=
np
->
tx_skbuff
[
entry
];
/* Free the original skb. */
pci_unmap_single
(
np
->
pci_dev
,
np
->
tx_ring
[
entry
].
frag
[
0
].
addr
,
skb
->
len
,
PCI_DMA_TODEVICE
);
if
(
irq
)
dev_kfree_skb_irq
(
np
->
tx_skbuff
[
entry
]);
else
dev_kfree_skb
(
np
->
tx_skbuff
[
entry
]);
np
->
tx_skbuff
[
entry
]
=
0
;
/* free all tx skbuff */
for
(
i
=
0
;
i
<
TX_RING_SIZE
;
i
++
)
{
skb
=
np
->
tx_skbuff
[
i
];
if
(
skb
)
{
pci_unmap_single
(
np
->
pci_dev
,
np
->
tx_ring
[
i
].
frag
[
0
].
addr
,
skb
->
len
,
PCI_DMA_TODEVICE
);
if
(
irq
)
dev_kfree_skb_irq
(
skb
);
else
dev_kfree_skb
(
skb
);
np
->
tx_skbuff
[
i
]
=
0
;
np
->
stats
.
tx_dropped
++
;
}
}
writel
(
np
->
tx_ring_dma
+
frame_id
*
sizeof
(
*
np
->
tx_ring
),
dev
->
base_addr
+
TxListPtr
);
np
->
cur_tx
=
np
->
dirty_tx
=
0
;
return
0
;
}
...
...
@@ -1156,7 +1159,7 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs)
if
(
tx_status
&
0x10
)
{
/* Reset the Tx. */
np
->
stats
.
tx_fifo_errors
++
;
spin_lock
(
&
np
->
lock
);
reset_tx
(
dev
,
1
);
reset_tx
(
dev
);
spin_unlock
(
&
np
->
lock
);
}
if
(
tx_status
&
0x1e
)
/* Restart the Tx. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment