Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
f3b197ac
C
clone-Linux
项目概览
gsplhtlxg
/
clone-Linux
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
clone-Linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f3b197ac
编写于
5月 26, 2006
作者:
J
Jeff Garzik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[netdrvr] trim trailing whitespace: 8139*.c, epic100, forcedeth, tulip/*
上级
4c0c2fd4
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
686 addition
and
686 deletion
+686
-686
drivers/net/8139cp.c
drivers/net/8139cp.c
+7
-7
drivers/net/8139too.c
drivers/net/8139too.c
+7
-7
drivers/net/epic100.c
drivers/net/epic100.c
+28
-28
drivers/net/forcedeth.c
drivers/net/forcedeth.c
+20
-20
drivers/net/tulip/de2104x.c
drivers/net/tulip/de2104x.c
+29
-29
drivers/net/tulip/de4x5.c
drivers/net/tulip/de4x5.c
+358
-358
drivers/net/tulip/de4x5.h
drivers/net/tulip/de4x5.h
+7
-7
drivers/net/tulip/dmfe.c
drivers/net/tulip/dmfe.c
+1
-1
drivers/net/tulip/eeprom.c
drivers/net/tulip/eeprom.c
+4
-4
drivers/net/tulip/interrupt.c
drivers/net/tulip/interrupt.c
+63
-63
drivers/net/tulip/media.c
drivers/net/tulip/media.c
+1
-1
drivers/net/tulip/tulip.h
drivers/net/tulip/tulip.h
+1
-1
drivers/net/tulip/tulip_core.c
drivers/net/tulip/tulip_core.c
+3
-3
drivers/net/tulip/uli526x.c
drivers/net/tulip/uli526x.c
+40
-40
drivers/net/tulip/winbond-840.c
drivers/net/tulip/winbond-840.c
+13
-13
drivers/net/tulip/xircom_cb.c
drivers/net/tulip/xircom_cb.c
+104
-104
未找到文件。
drivers/net/8139cp.c
浏览文件 @
f3b197ac
...
...
@@ -19,11 +19,11 @@
See the file COPYING in this distribution for more information.
Contributors:
Wake-on-LAN support - Felipe Damasio <felipewd@terra.com.br>
PCI suspend/resume - Felipe Damasio <felipewd@terra.com.br>
LinkChg interrupt - Felipe Damasio <felipewd@terra.com.br>
TODO:
* Test Tx checksumming thoroughly
* Implement dev->tx_timeout
...
...
@@ -461,7 +461,7 @@ static void cp_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
static
inline
void
cp_set_rxbufsize
(
struct
cp_private
*
cp
)
{
unsigned
int
mtu
=
cp
->
dev
->
mtu
;
if
(
mtu
>
ETH_DATA_LEN
)
/* MTU + ethernet header + FCS + optional VLAN tag */
cp
->
rx_buf_sz
=
mtu
+
ETH_HLEN
+
8
;
...
...
@@ -510,7 +510,7 @@ static void cp_rx_err_acct (struct cp_private *cp, unsigned rx_tail,
static
inline
unsigned
int
cp_rx_csum_ok
(
u32
status
)
{
unsigned
int
protocol
=
(
status
>>
16
)
&
0x3
;
if
(
likely
((
protocol
==
RxProtoTCP
)
&&
(
!
(
status
&
TCPFail
))))
return
1
;
else
if
((
protocol
==
RxProtoUDP
)
&&
(
!
(
status
&
UDPFail
)))
...
...
@@ -1061,7 +1061,7 @@ static void cp_init_hw (struct cp_private *cp)
cpw8
(
Config3
,
PARMEnable
);
cp
->
wol_enabled
=
0
;
cpw8
(
Config5
,
cpr8
(
Config5
)
&
PMEStatus
);
cpw8
(
Config5
,
cpr8
(
Config5
)
&
PMEStatus
);
cpw32_f
(
HiTxRingAddr
,
0
);
cpw32_f
(
HiTxRingAddr
+
4
,
0
);
...
...
@@ -1351,7 +1351,7 @@ static void netdev_get_wol (struct cp_private *cp,
WAKE_MCAST
|
WAKE_UCAST
;
/* We don't need to go on if WOL is disabled */
if
(
!
cp
->
wol_enabled
)
return
;
options
=
cpr8
(
Config3
);
if
(
options
&
LinkUp
)
wol
->
wolopts
|=
WAKE_PHY
;
if
(
options
&
MagicPacket
)
wol
->
wolopts
|=
WAKE_MAGIC
;
...
...
@@ -1919,7 +1919,7 @@ static int cp_resume (struct pci_dev *pdev)
mii_check_media
(
&
cp
->
mii_if
,
netif_msg_link
(
cp
),
FALSE
);
spin_unlock_irqrestore
(
&
cp
->
lock
,
flags
);
return
0
;
}
#endif
/* CONFIG_PM */
...
...
drivers/net/8139too.c
浏览文件 @
f3b197ac
...
...
@@ -165,7 +165,7 @@ static int multicast_filter_limit = 32;
static
int
debug
=
-
1
;
/*
* Receive ring size
* Receive ring size
* Warning: 64K ring has hardware issues and may lock up.
*/
#if defined(CONFIG_SH_DREAMCAST)
...
...
@@ -257,7 +257,7 @@ static struct pci_device_id rtl8139_pci_tbl[] = {
{
0x018a
,
0x0106
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
RTL8139
},
{
0x126c
,
0x1211
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
RTL8139
},
{
0x1743
,
0x8139
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
RTL8139
},
{
0x021b
,
0x8139
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
RTL8139
},
{
0x021b
,
0x8139
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
RTL8139
},
#ifdef CONFIG_SH_SECUREEDGE5410
/* Bogus 8139 silicon reports 8129 without external PROM :-( */
...
...
@@ -1824,7 +1824,7 @@ static void rtl8139_rx_err (u32 rx_status, struct net_device *dev,
int
tmp_work
;
#endif
if
(
netif_msg_rx_err
(
tp
))
if
(
netif_msg_rx_err
(
tp
))
printk
(
KERN_DEBUG
"%s: Ethernet frame had errors, status %8.8x.
\n
"
,
dev
->
name
,
rx_status
);
tp
->
stats
.
rx_errors
++
;
...
...
@@ -1944,7 +1944,7 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,
RTL_R16
(
RxBufAddr
),
RTL_R16
(
RxBufPtr
),
RTL_R8
(
ChipCmd
));
while
(
netif_running
(
dev
)
&&
received
<
budget
while
(
netif_running
(
dev
)
&&
received
<
budget
&&
(
RTL_R8
(
ChipCmd
)
&
RxBufEmpty
)
==
0
)
{
u32
ring_offset
=
cur_rx
%
RX_BUF_LEN
;
u32
rx_status
;
...
...
@@ -2031,7 +2031,7 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,
netif_receive_skb
(
skb
);
}
else
{
if
(
net_ratelimit
())
if
(
net_ratelimit
())
printk
(
KERN_WARNING
"%s: Memory squeeze, dropping packet.
\n
"
,
dev
->
name
);
...
...
@@ -2158,13 +2158,13 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance,
status
=
RTL_R16
(
IntrStatus
);
/* shared irq? */
if
(
unlikely
((
status
&
rtl8139_intr_mask
)
==
0
))
if
(
unlikely
((
status
&
rtl8139_intr_mask
)
==
0
))
goto
out
;
handled
=
1
;
/* h/w no longer present (hotplug?) or major error, bail */
if
(
unlikely
(
status
==
0xFFFF
))
if
(
unlikely
(
status
==
0xFFFF
))
goto
out
;
/* close possible race's with dev_close */
...
...
drivers/net/epic100.c
浏览文件 @
f3b197ac
...
...
@@ -21,15 +21,15 @@
http://www.scyld.com/network/epic100.html
---------------------------------------------------------------------
Linux kernel-specific changes:
LK1.1.2 (jgarzik):
* Merge becker version 1.09 (4/08/2000)
LK1.1.3:
* Major bugfix to 1.09 driver (Francis Romieu)
LK1.1.4 (jgarzik):
* Merge becker test version 1.09 (5/29/2000)
...
...
@@ -66,7 +66,7 @@
LK1.1.14 (Kryzsztof Halasa):
* fix spurious bad initializations
* pound phy a la SMSC's app note on the subject
AC1.1.14ac
* fix power up/down for ethtool that broke in 1.11
...
...
@@ -244,7 +244,7 @@ static struct pci_device_id epic_pci_tbl[] = {
};
MODULE_DEVICE_TABLE
(
pci
,
epic_pci_tbl
);
#ifndef USE_IO_OPS
#undef inb
#undef inw
...
...
@@ -370,7 +370,7 @@ static int epic_close(struct net_device *dev);
static
struct
net_device_stats
*
epic_get_stats
(
struct
net_device
*
dev
);
static
void
set_rx_mode
(
struct
net_device
*
dev
);
static
int
__devinit
epic_init_one
(
struct
pci_dev
*
pdev
,
const
struct
pci_device_id
*
ent
)
...
...
@@ -392,9 +392,9 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
printk
(
KERN_INFO
"%s"
KERN_INFO
"%s"
KERN_INFO
"%s"
,
version
,
version2
,
version3
);
#endif
card_idx
++
;
ret
=
pci_enable_device
(
pdev
);
if
(
ret
)
goto
out
;
...
...
@@ -405,7 +405,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
ret
=
-
ENODEV
;
goto
err_out_disable
;
}
pci_set_master
(
pdev
);
ret
=
pci_request_regions
(
pdev
,
DRV_NAME
);
...
...
@@ -498,7 +498,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
ep
->
pci_dev
=
pdev
;
ep
->
chip_id
=
chip_idx
;
ep
->
chip_flags
=
pci_id_tbl
[
chip_idx
].
drv_flags
;
ep
->
irq_mask
=
ep
->
irq_mask
=
(
ep
->
chip_flags
&
TYPE2_INTR
?
PCIBusErr175
:
PCIBusErr170
)
|
CntFull
|
TxUnderrun
|
EpicNapiEvent
;
...
...
@@ -587,7 +587,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
pci_disable_device
(
pdev
);
goto
out
;
}
/* Serial EEPROM section. */
/* EEPROM_Ctrl bits. */
...
...
@@ -709,7 +709,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int loc, int value)
outw
(
value
,
ioaddr
+
MIIData
);
outl
((
phy_id
<<
9
)
|
(
loc
<<
4
)
|
MII_WRITEOP
,
ioaddr
+
MIICtrl
);
for
(
i
=
10000
;
i
>
0
;
i
--
)
{
for
(
i
=
10000
;
i
>
0
;
i
--
)
{
barrier
();
if
((
inl
(
ioaddr
+
MIICtrl
)
&
MII_WRITEOP
)
==
0
)
break
;
...
...
@@ -717,7 +717,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int loc, int value)
return
;
}
static
int
epic_open
(
struct
net_device
*
dev
)
{
struct
epic_private
*
ep
=
dev
->
priv
;
...
...
@@ -760,7 +760,7 @@ static int epic_open(struct net_device *dev)
#endif
udelay
(
20
);
/* Looks like EPII needs that if you want reliable RX init. FIXME: pci posting bug? */
for
(
i
=
0
;
i
<
3
;
i
++
)
outl
(
cpu_to_le16
(((
u16
*
)
dev
->
dev_addr
)[
i
]),
ioaddr
+
LAN0
+
i
*
4
);
...
...
@@ -803,7 +803,7 @@ static int epic_open(struct net_device *dev)
/* Enable interrupts by setting the interrupt mask. */
outl
((
ep
->
chip_flags
&
TYPE2_INTR
?
PCIBusErr175
:
PCIBusErr170
)
|
CntFull
|
TxUnderrun
|
CntFull
|
TxUnderrun
|
RxError
|
RxHeader
|
EpicNapiEvent
,
ioaddr
+
INTMASK
);
if
(
debug
>
1
)
...
...
@@ -831,7 +831,7 @@ static void epic_pause(struct net_device *dev)
struct
epic_private
*
ep
=
dev
->
priv
;
netif_stop_queue
(
dev
);
/* Disable interrupts by clearing the interrupt mask. */
outl
(
0x00000000
,
ioaddr
+
INTMASK
);
/* Stop the chip's Tx and Rx DMA processes. */
...
...
@@ -987,7 +987,7 @@ static void epic_init_ring(struct net_device *dev)
for
(
i
=
0
;
i
<
RX_RING_SIZE
;
i
++
)
{
ep
->
rx_ring
[
i
].
rxstatus
=
0
;
ep
->
rx_ring
[
i
].
buflength
=
cpu_to_le32
(
ep
->
rx_buf_sz
);
ep
->
rx_ring
[
i
].
next
=
ep
->
rx_ring_dma
+
ep
->
rx_ring
[
i
].
next
=
ep
->
rx_ring_dma
+
(
i
+
1
)
*
sizeof
(
struct
epic_rx_desc
);
ep
->
rx_skbuff
[
i
]
=
NULL
;
}
...
...
@@ -1002,7 +1002,7 @@ static void epic_init_ring(struct net_device *dev)
break
;
skb
->
dev
=
dev
;
/* Mark as being used by this device. */
skb_reserve
(
skb
,
2
);
/* 16 byte align the IP header. */
ep
->
rx_ring
[
i
].
bufaddr
=
pci_map_single
(
ep
->
pci_dev
,
ep
->
rx_ring
[
i
].
bufaddr
=
pci_map_single
(
ep
->
pci_dev
,
skb
->
data
,
ep
->
rx_buf_sz
,
PCI_DMA_FROMDEVICE
);
ep
->
rx_ring
[
i
].
rxstatus
=
cpu_to_le32
(
DescOwn
);
}
...
...
@@ -1013,7 +1013,7 @@ static void epic_init_ring(struct net_device *dev)
for
(
i
=
0
;
i
<
TX_RING_SIZE
;
i
++
)
{
ep
->
tx_skbuff
[
i
]
=
NULL
;
ep
->
tx_ring
[
i
].
txstatus
=
0x0000
;
ep
->
tx_ring
[
i
].
next
=
ep
->
tx_ring_dma
+
ep
->
tx_ring
[
i
].
next
=
ep
->
tx_ring_dma
+
(
i
+
1
)
*
sizeof
(
struct
epic_tx_desc
);
}
ep
->
tx_ring
[
i
-
1
].
next
=
ep
->
tx_ring_dma
;
...
...
@@ -1026,7 +1026,7 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev)
int
entry
,
free_count
;
u32
ctrl_word
;
unsigned
long
flags
;
if
(
skb
->
len
<
ETH_ZLEN
)
{
skb
=
skb_padto
(
skb
,
ETH_ZLEN
);
if
(
skb
==
NULL
)
...
...
@@ -1042,7 +1042,7 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev)
entry
=
ep
->
cur_tx
%
TX_RING_SIZE
;
ep
->
tx_skbuff
[
entry
]
=
skb
;
ep
->
tx_ring
[
entry
].
bufaddr
=
pci_map_single
(
ep
->
pci_dev
,
skb
->
data
,
ep
->
tx_ring
[
entry
].
bufaddr
=
pci_map_single
(
ep
->
pci_dev
,
skb
->
data
,
skb
->
len
,
PCI_DMA_TODEVICE
);
if
(
free_count
<
TX_QUEUE_LEN
/
2
)
{
/* Typical path */
ctrl_word
=
cpu_to_le32
(
0x100000
);
/* No interrupt */
...
...
@@ -1126,7 +1126,7 @@ static void epic_tx(struct net_device *dev, struct epic_private *ep)
/* Free the original skb. */
skb
=
ep
->
tx_skbuff
[
entry
];
pci_unmap_single
(
ep
->
pci_dev
,
ep
->
tx_ring
[
entry
].
bufaddr
,
pci_unmap_single
(
ep
->
pci_dev
,
ep
->
tx_ring
[
entry
].
bufaddr
,
skb
->
len
,
PCI_DMA_TODEVICE
);
dev_kfree_skb_irq
(
skb
);
ep
->
tx_skbuff
[
entry
]
=
NULL
;
...
...
@@ -1281,8 +1281,8 @@ static int epic_rx(struct net_device *dev, int budget)
ep
->
rx_buf_sz
,
PCI_DMA_FROMDEVICE
);
}
else
{
pci_unmap_single
(
ep
->
pci_dev
,
ep
->
rx_ring
[
entry
].
bufaddr
,
pci_unmap_single
(
ep
->
pci_dev
,
ep
->
rx_ring
[
entry
].
bufaddr
,
ep
->
rx_buf_sz
,
PCI_DMA_FROMDEVICE
);
skb_put
(
skb
=
ep
->
rx_skbuff
[
entry
],
pkt_len
);
ep
->
rx_skbuff
[
entry
]
=
NULL
;
...
...
@@ -1307,7 +1307,7 @@ static int epic_rx(struct net_device *dev, int budget)
break
;
skb
->
dev
=
dev
;
/* Mark as being used by this device. */
skb_reserve
(
skb
,
2
);
/* Align IP on 16 byte boundaries */
ep
->
rx_ring
[
entry
].
bufaddr
=
pci_map_single
(
ep
->
pci_dev
,
ep
->
rx_ring
[
entry
].
bufaddr
=
pci_map_single
(
ep
->
pci_dev
,
skb
->
data
,
ep
->
rx_buf_sz
,
PCI_DMA_FROMDEVICE
);
work_done
++
;
}
...
...
@@ -1403,7 +1403,7 @@ static int epic_close(struct net_device *dev)
ep
->
rx_ring
[
i
].
rxstatus
=
0
;
/* Not owned by Epic chip. */
ep
->
rx_ring
[
i
].
buflength
=
0
;
if
(
skb
)
{
pci_unmap_single
(
ep
->
pci_dev
,
ep
->
rx_ring
[
i
].
bufaddr
,
pci_unmap_single
(
ep
->
pci_dev
,
ep
->
rx_ring
[
i
].
bufaddr
,
ep
->
rx_buf_sz
,
PCI_DMA_FROMDEVICE
);
dev_kfree_skb
(
skb
);
}
...
...
@@ -1414,7 +1414,7 @@ static int epic_close(struct net_device *dev)
ep
->
tx_skbuff
[
i
]
=
NULL
;
if
(
!
skb
)
continue
;
pci_unmap_single
(
ep
->
pci_dev
,
ep
->
tx_ring
[
i
].
bufaddr
,
pci_unmap_single
(
ep
->
pci_dev
,
ep
->
tx_ring
[
i
].
bufaddr
,
skb
->
len
,
PCI_DMA_TODEVICE
);
dev_kfree_skb
(
skb
);
}
...
...
@@ -1607,7 +1607,7 @@ static void __devexit epic_remove_one (struct pci_dev *pdev)
{
struct
net_device
*
dev
=
pci_get_drvdata
(
pdev
);
struct
epic_private
*
ep
=
dev
->
priv
;
pci_free_consistent
(
pdev
,
TX_TOTAL_SIZE
,
ep
->
tx_ring
,
ep
->
tx_ring_dma
);
pci_free_consistent
(
pdev
,
RX_TOTAL_SIZE
,
ep
->
rx_ring
,
ep
->
rx_ring_dma
);
unregister_netdev
(
dev
);
...
...
drivers/net/forcedeth.c
浏览文件 @
f3b197ac
...
...
@@ -458,7 +458,7 @@ typedef union _ring_type {
#define RX_RING 128
#define TX_RING 256
/*
/*
* If your nic mysteriously hangs then try to reduce the limits
* to 1/0: It might be required to set NV_TX_LASTPACKET in the
* last valid ring entry. But this would be impossible to
...
...
@@ -480,7 +480,7 @@ typedef union _ring_type {
#define POLL_WAIT (1+HZ/100)
#define LINK_TIMEOUT (3*HZ)
/*
/*
* desc_ver values:
* The nic supports three different descriptor types:
* - DESC_VER_1: Original
...
...
@@ -619,7 +619,7 @@ static int max_interrupt_work = 5;
/*
* Optimization can be either throuput mode or cpu mode
*
*
* Throughput Mode: Every tx and rx packet will generate an interrupt.
* CPU Mode: Interrupts are controlled by a timer.
*/
...
...
@@ -1119,7 +1119,7 @@ static void nv_do_rx_refill(unsigned long data)
}
}
static
void
nv_init_rx
(
struct
net_device
*
dev
)
static
void
nv_init_rx
(
struct
net_device
*
dev
)
{
struct
fe_priv
*
np
=
netdev_priv
(
dev
);
int
i
;
...
...
@@ -1183,7 +1183,7 @@ static void nv_drain_tx(struct net_device *dev)
{
struct
fe_priv
*
np
=
netdev_priv
(
dev
);
unsigned
int
i
;
for
(
i
=
0
;
i
<
TX_RING
;
i
++
)
{
if
(
np
->
desc_ver
==
DESC_VER_1
||
np
->
desc_ver
==
DESC_VER_2
)
np
->
tx_ring
.
orig
[
i
].
FlagLen
=
0
;
...
...
@@ -1329,7 +1329,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
else
{
np
->
tx_ring
.
ex
[
start_nr
].
TxVlan
=
cpu_to_le32
(
tx_flags_vlan
);
np
->
tx_ring
.
ex
[
start_nr
].
FlagLen
|=
cpu_to_le32
(
tx_flags
|
tx_flags_extra
);
}
}
dprintk
(
KERN_DEBUG
"%s: nv_start_xmit: packet %d (entries %d) queued for transmission. tx_flags_extra: %x
\n
"
,
dev
->
name
,
np
->
next_tx
,
entries
,
tx_flags_extra
);
...
...
@@ -1404,7 +1404,7 @@ static void nv_tx_done(struct net_device *dev)
}
else
{
np
->
stats
.
tx_packets
++
;
np
->
stats
.
tx_bytes
+=
skb
->
len
;
}
}
}
}
nv_release_txskb
(
dev
,
i
);
...
...
@@ -1450,7 +1450,7 @@ static void nv_tx_timeout(struct net_device *dev)
for
(
i
=
0
;
i
<
TX_RING
;
i
+=
4
)
{
if
(
np
->
desc_ver
==
DESC_VER_1
||
np
->
desc_ver
==
DESC_VER_2
)
{
printk
(
KERN_INFO
"%03x: %08x %08x // %08x %08x // %08x %08x // %08x %08x
\n
"
,
i
,
i
,
le32_to_cpu
(
np
->
tx_ring
.
orig
[
i
].
PacketBuffer
),
le32_to_cpu
(
np
->
tx_ring
.
orig
[
i
].
FlagLen
),
le32_to_cpu
(
np
->
tx_ring
.
orig
[
i
+
1
].
PacketBuffer
),
...
...
@@ -1461,7 +1461,7 @@ static void nv_tx_timeout(struct net_device *dev)
le32_to_cpu
(
np
->
tx_ring
.
orig
[
i
+
3
].
FlagLen
));
}
else
{
printk
(
KERN_INFO
"%03x: %08x %08x %08x // %08x %08x %08x // %08x %08x %08x // %08x %08x %08x
\n
"
,
i
,
i
,
le32_to_cpu
(
np
->
tx_ring
.
ex
[
i
].
PacketBufferHigh
),
le32_to_cpu
(
np
->
tx_ring
.
ex
[
i
].
PacketBufferLow
),
le32_to_cpu
(
np
->
tx_ring
.
ex
[
i
].
FlagLen
),
...
...
@@ -2067,7 +2067,7 @@ static int nv_update_linkspeed(struct net_device *dev)
if
(
lpa_pause
==
LPA_PAUSE_ASYM
)
{
np
->
pause_flags
|=
NV_PAUSEFRAME_RX_ENABLE
;
}
}
break
;
}
}
...
...
@@ -2086,7 +2086,7 @@ static int nv_update_linkspeed(struct net_device *dev)
writel
(
regmisc
|
NVREG_MISC1_PAUSE_TX
,
base
+
NvRegMisc1
);
}
else
{
writel
(
NVREG_TX_PAUSEFRAME_DISABLE
,
base
+
NvRegTxPauseFrame
);
writel
(
regmisc
,
base
+
NvRegMisc1
);
writel
(
regmisc
,
base
+
NvRegMisc1
);
}
}
...
...
@@ -2150,7 +2150,7 @@ static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs)
spin_lock
(
&
np
->
lock
);
nv_tx_done
(
dev
);
spin_unlock
(
&
np
->
lock
);
nv_rx_process
(
dev
);
if
(
nv_alloc_rx
(
dev
))
{
spin_lock
(
&
np
->
lock
);
...
...
@@ -2158,7 +2158,7 @@ static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs)
mod_timer
(
&
np
->
oom_kick
,
jiffies
+
OOM_REFILL
);
spin_unlock
(
&
np
->
lock
);
}
if
(
events
&
NVREG_IRQ_LINK
)
{
spin_lock
(
&
np
->
lock
);
nv_link_irq
(
dev
);
...
...
@@ -2223,7 +2223,7 @@ static irqreturn_t nv_nic_irq_tx(int foo, void *data, struct pt_regs *regs)
spin_lock_irq
(
&
np
->
lock
);
nv_tx_done
(
dev
);
spin_unlock_irq
(
&
np
->
lock
);
if
(
events
&
(
NVREG_IRQ_TX_ERR
))
{
dprintk
(
KERN_DEBUG
"%s: received irq with events 0x%x. Probably TX fail.
\n
"
,
dev
->
name
,
events
);
...
...
@@ -2266,7 +2266,7 @@ static irqreturn_t nv_nic_irq_rx(int foo, void *data, struct pt_regs *regs)
dprintk
(
KERN_DEBUG
"%s: rx irq: %08x
\n
"
,
dev
->
name
,
events
);
if
(
!
(
events
&
np
->
irqmask
))
break
;
nv_rx_process
(
dev
);
if
(
nv_alloc_rx
(
dev
))
{
spin_lock_irq
(
&
np
->
lock
);
...
...
@@ -2274,7 +2274,7 @@ static irqreturn_t nv_nic_irq_rx(int foo, void *data, struct pt_regs *regs)
mod_timer
(
&
np
->
oom_kick
,
jiffies
+
OOM_REFILL
);
spin_unlock_irq
(
&
np
->
lock
);
}
if
(
i
>
max_interrupt_work
)
{
spin_lock_irq
(
&
np
->
lock
);
/* disable interrupts on the nic */
...
...
@@ -2313,7 +2313,7 @@ static irqreturn_t nv_nic_irq_other(int foo, void *data, struct pt_regs *regs)
dprintk
(
KERN_DEBUG
"%s: irq: %08x
\n
"
,
dev
->
name
,
events
);
if
(
!
(
events
&
np
->
irqmask
))
break
;
if
(
events
&
NVREG_IRQ_LINK
)
{
spin_lock_irq
(
&
np
->
lock
);
nv_link_irq
(
dev
);
...
...
@@ -2386,7 +2386,7 @@ static void nv_do_nic_poll(unsigned long data)
np
->
nic_poll_irq
=
0
;
/* FIXME: Do we need synchronize_irq(dev->irq) here? */
writel
(
mask
,
base
+
NvRegIrqMask
);
pci_push
(
base
);
...
...
@@ -3165,7 +3165,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
if
(
id
->
driver_data
&
DEV_HAS_PAUSEFRAME_TX
)
{
np
->
pause_flags
|=
NV_PAUSEFRAME_TX_CAPABLE
;
}
err
=
-
ENOMEM
;
np
->
base
=
ioremap
(
addr
,
np
->
register_size
);
...
...
@@ -3313,7 +3313,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
pci_name
(
pci_dev
));
goto
out_freering
;
}
/* reset it */
phy_init
(
dev
);
...
...
drivers/net/tulip/de2104x.c
浏览文件 @
f3b197ac
...
...
@@ -227,12 +227,12 @@ enum {
SROMC0InfoLeaf
=
27
,
MediaBlockMask
=
0x3f
,
MediaCustomCSRs
=
(
1
<<
6
),
/* PCIPM bits */
PM_Sleep
=
(
1
<<
31
),
PM_Snooze
=
(
1
<<
30
),
PM_Mask
=
PM_Sleep
|
PM_Snooze
,
/* SIAStatus bits */
NWayState
=
(
1
<<
14
)
|
(
1
<<
13
)
|
(
1
<<
12
),
NWayRestart
=
(
1
<<
12
),
...
...
@@ -858,7 +858,7 @@ static void de_stop_rxtx (struct de_private *de)
return
;
cpu_relax
();
}
printk
(
KERN_WARNING
"%s: timeout expired stopping DMA
\n
"
,
de
->
dev
->
name
);
}
...
...
@@ -931,7 +931,7 @@ static void de_set_media (struct de_private *de)
macmode
|=
FullDuplex
;
else
macmode
&=
~
FullDuplex
;
if
(
netif_msg_link
(
de
))
{
printk
(
KERN_INFO
"%s: set link %s
\n
"
KERN_INFO
"%s: mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x
\n
"
...
...
@@ -966,9 +966,9 @@ static void de21040_media_timer (unsigned long data)
u32
status
=
dr32
(
SIAStatus
);
unsigned
int
carrier
;
unsigned
long
flags
;
carrier
=
(
status
&
NetCxnErr
)
?
0
:
1
;
if
(
carrier
)
{
if
(
de
->
media_type
!=
DE_MEDIA_AUI
&&
(
status
&
LinkFailStatus
))
goto
no_link_yet
;
...
...
@@ -985,7 +985,7 @@ static void de21040_media_timer (unsigned long data)
return
;
}
de_link_down
(
de
);
de_link_down
(
de
);
if
(
de
->
media_lock
)
return
;
...
...
@@ -1039,7 +1039,7 @@ static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media)
return
0
;
break
;
}
return
1
;
}
...
...
@@ -1050,9 +1050,9 @@ static void de21041_media_timer (unsigned long data)
u32
status
=
dr32
(
SIAStatus
);
unsigned
int
carrier
;
unsigned
long
flags
;
carrier
=
(
status
&
NetCxnErr
)
?
0
:
1
;
if
(
carrier
)
{
if
((
de
->
media_type
==
DE_MEDIA_TP_AUTO
||
de
->
media_type
==
DE_MEDIA_TP
||
...
...
@@ -1072,7 +1072,7 @@ static void de21041_media_timer (unsigned long data)
return
;
}
de_link_down
(
de
);
de_link_down
(
de
);
/* if media type locked, don't switch media */
if
(
de
->
media_lock
)
...
...
@@ -1124,7 +1124,7 @@ static void de21041_media_timer (unsigned long data)
u32
next_states
[]
=
{
DE_MEDIA_AUI
,
DE_MEDIA_BNC
,
DE_MEDIA_TP_AUTO
};
de_next_media
(
de
,
next_states
,
ARRAY_SIZE
(
next_states
));
}
set_media:
spin_lock_irqsave
(
&
de
->
lock
,
flags
);
de_stop_rxtx
(
de
);
...
...
@@ -1148,7 +1148,7 @@ static void de_media_interrupt (struct de_private *de, u32 status)
mod_timer
(
&
de
->
media_timer
,
jiffies
+
DE_TIMER_LINK
);
return
;
}
BUG_ON
(
!
(
status
&
LinkFail
));
if
(
netif_carrier_ok
(
de
->
dev
))
{
...
...
@@ -1227,7 +1227,7 @@ static int de_init_hw (struct de_private *de)
int
rc
;
de_adapter_wake
(
de
);
macmode
=
dr32
(
MacMode
)
&
~
MacModeClear
;
rc
=
de_reset_mac
(
de
);
...
...
@@ -1413,7 +1413,7 @@ static int de_close (struct net_device *dev)
netif_stop_queue
(
dev
);
netif_carrier_off
(
dev
);
spin_unlock_irqrestore
(
&
de
->
lock
,
flags
);
free_irq
(
dev
->
irq
,
dev
);
de_free_rings
(
de
);
...
...
@@ -1441,7 +1441,7 @@ static void de_tx_timeout (struct net_device *dev)
spin_unlock_irq
(
&
de
->
lock
);
enable_irq
(
dev
->
irq
);
/* Update the error counts. */
__de_get_stats
(
de
);
...
...
@@ -1451,7 +1451,7 @@ static void de_tx_timeout (struct net_device *dev)
de_init_rings
(
de
);
de_init_hw
(
de
);
netif_wake_queue
(
dev
);
}
...
...
@@ -1459,7 +1459,7 @@ static void __de_get_regs(struct de_private *de, u8 *buf)
{
int
i
;
u32
*
rbuf
=
(
u32
*
)
buf
;
/* read all CSRs */
for
(
i
=
0
;
i
<
DE_NUM_REGS
;
i
++
)
rbuf
[
i
]
=
dr32
(
i
*
8
);
...
...
@@ -1474,7 +1474,7 @@ static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd)
ecmd
->
transceiver
=
XCVR_INTERNAL
;
ecmd
->
phy_address
=
0
;
ecmd
->
advertising
=
de
->
media_advertise
;
switch
(
de
->
media_type
)
{
case
DE_MEDIA_AUI
:
ecmd
->
port
=
PORT_AUI
;
...
...
@@ -1489,7 +1489,7 @@ static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd)
ecmd
->
speed
=
SPEED_10
;
break
;
}
if
(
dr32
(
MacMode
)
&
FullDuplex
)
ecmd
->
duplex
=
DUPLEX_FULL
;
else
...
...
@@ -1529,7 +1529,7 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
if
(
ecmd
->
autoneg
==
AUTONEG_ENABLE
&&
(
!
(
ecmd
->
advertising
&
ADVERTISED_Autoneg
)))
return
-
EINVAL
;
switch
(
ecmd
->
port
)
{
case
PORT_AUI
:
new_media
=
DE_MEDIA_AUI
;
...
...
@@ -1554,22 +1554,22 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
return
-
EINVAL
;
break
;
}
media_lock
=
(
ecmd
->
autoneg
==
AUTONEG_ENABLE
)
?
0
:
1
;
if
((
new_media
==
de
->
media_type
)
&&
(
media_lock
==
de
->
media_lock
)
&&
(
ecmd
->
advertising
==
de
->
media_advertise
))
return
0
;
/* nothing to change */
de_link_down
(
de
);
de_stop_rxtx
(
de
);
de
->
media_type
=
new_media
;
de
->
media_lock
=
media_lock
;
de
->
media_advertise
=
ecmd
->
advertising
;
de_set_media
(
de
);
return
0
;
}
...
...
@@ -1817,7 +1817,7 @@ static void __init de21041_get_srom_info (struct de_private *de)
case
0x0204
:
de
->
media_type
=
DE_MEDIA_TP_FD
;
break
;
default:
de
->
media_type
=
DE_MEDIA_TP_AUTO
;
break
;
}
if
(
netif_msg_probe
(
de
))
printk
(
KERN_INFO
"de%d: SROM leaf offset %u, default media %s
\n
"
,
de
->
board_idx
,
ofs
,
...
...
@@ -1886,7 +1886,7 @@ static void __init de21041_get_srom_info (struct de_private *de)
de
->
media
[
idx
].
csr13
,
de
->
media
[
idx
].
csr14
,
de
->
media
[
idx
].
csr15
);
}
else
if
(
netif_msg_probe
(
de
))
printk
(
"
\n
"
);
...
...
@@ -2118,7 +2118,7 @@ static int de_suspend (struct pci_dev *pdev, pm_message_t state)
spin_unlock_irq
(
&
de
->
lock
);
enable_irq
(
dev
->
irq
);
/* Update the error counts. */
__de_get_stats
(
de
);
...
...
drivers/net/tulip/de4x5.c
浏览文件 @
f3b197ac
此差异已折叠。
点击以展开。
drivers/net/tulip/de4x5.h
浏览文件 @
f3b197ac
...
...
@@ -38,11 +38,11 @@
/*
** EISA Register Address Map
*/
#define EISA_ID iobase+0x0c80
/* EISA ID Registers */
#define EISA_ID0 iobase+0x0c80
/* EISA ID Register 0 */
#define EISA_ID1 iobase+0x0c81
/* EISA ID Register 1 */
#define EISA_ID2 iobase+0x0c82
/* EISA ID Register 2 */
#define EISA_ID3 iobase+0x0c83
/* EISA ID Register 3 */
#define EISA_ID iobase+0x0c80
/* EISA ID Registers */
#define EISA_ID0 iobase+0x0c80
/* EISA ID Register 0 */
#define EISA_ID1 iobase+0x0c81
/* EISA ID Register 1 */
#define EISA_ID2 iobase+0x0c82
/* EISA ID Register 2 */
#define EISA_ID3 iobase+0x0c83
/* EISA ID Register 3 */
#define EISA_CR iobase+0x0c84
/* EISA Control Register */
#define EISA_REG0 iobase+0x0c88
/* EISA Configuration Register 0 */
#define EISA_REG1 iobase+0x0c89
/* EISA Configuration Register 1 */
...
...
@@ -1008,8 +1008,8 @@ struct de4x5_ioctl {
unsigned
char
__user
*
data
;
/* Pointer to the data buffer */
};
/*
** Recognised commands for the driver
/*
** Recognised commands for the driver
*/
#define DE4X5_GET_HWADDR 0x01
/* Get the hardware address */
#define DE4X5_SET_HWADDR 0x02
/* Set the hardware address */
...
...
drivers/net/tulip/dmfe.c
浏览文件 @
f3b197ac
...
...
@@ -50,7 +50,7 @@
forget to unmap PCI mapped skbs.
Alan Cox <alan@redhat.com>
Added new PCI identifiers provided by Clear Zhang at ALi
Added new PCI identifiers provided by Clear Zhang at ALi
for their 1563 ethernet device.
TODO
...
...
drivers/net/tulip/eeprom.c
浏览文件 @
f3b197ac
...
...
@@ -96,11 +96,11 @@ static const char *block_name[] __devinitdata = {
* tulip_build_fake_mediatable - Build a fake mediatable entry.
* @tp: Ptr to the tulip private data.
*
* Some cards like the 3x5 HSC cards (J3514A) do not have a standard
* Some cards like the 3x5 HSC cards (J3514A) do not have a standard
* srom and can not be handled under the fixup routine. These cards
* still need a valid mediatable entry for correct csr12 setup and
* still need a valid mediatable entry for correct csr12 setup and
* mii handling.
*
*
* Since this is currently a parisc-linux specific function, the
* #ifdef __hppa__ should completely optimize this function away for
* non-parisc hardware.
...
...
@@ -140,7 +140,7 @@ static void __devinit tulip_build_fake_mediatable(struct tulip_private *tp)
tp
->
flags
|=
HAS_PHY_IRQ
;
tp
->
csr12_shadow
=
-
1
;
}
#endif
#endif
}
void
__devinit
tulip_parse_eeprom
(
struct
net_device
*
dev
)
...
...
drivers/net/tulip/interrupt.c
浏览文件 @
f3b197ac
...
...
@@ -139,22 +139,22 @@ int tulip_poll(struct net_device *dev, int *budget)
}
/* Acknowledge current RX interrupt sources. */
iowrite32
((
RxIntr
|
RxNoBuf
),
tp
->
base_addr
+
CSR5
);
/* If we own the next entry, it is a new packet. Send it up. */
while
(
!
(
tp
->
rx_ring
[
entry
].
status
&
cpu_to_le32
(
DescOwned
)))
{
s32
status
=
le32_to_cpu
(
tp
->
rx_ring
[
entry
].
status
);
if
(
tp
->
dirty_rx
+
RX_RING_SIZE
==
tp
->
cur_rx
)
break
;
if
(
tulip_debug
>
5
)
printk
(
KERN_DEBUG
"%s: In tulip_rx(), entry %d %8.8x.
\n
"
,
dev
->
name
,
entry
,
status
);
if
(
--
rx_work_limit
<
0
)
goto
not_done
;
if
((
status
&
0x38008300
)
!=
0x0300
)
{
if
((
status
&
0x38000300
)
!=
0x0300
)
{
/* Ingore earlier buffers. */
...
...
@@ -180,7 +180,7 @@ int tulip_poll(struct net_device *dev, int *budget)
/* Omit the four octet CRC from the length. */
short
pkt_len
=
((
status
>>
16
)
&
0x7ff
)
-
4
;
struct
sk_buff
*
skb
;
#ifndef final_version
if
(
pkt_len
>
1518
)
{
printk
(
KERN_WARNING
"%s: Bogus packet size of %d (%#x).
\n
"
,
...
...
@@ -213,7 +213,7 @@ int tulip_poll(struct net_device *dev, int *budget)
}
else
{
/* Pass up the skb already on the Rx ring. */
char
*
temp
=
skb_put
(
skb
=
tp
->
rx_buffers
[
entry
].
skb
,
pkt_len
);
#ifndef final_version
if
(
tp
->
rx_buffers
[
entry
].
mapping
!=
le32_to_cpu
(
tp
->
rx_ring
[
entry
].
buffer1
))
{
...
...
@@ -225,17 +225,17 @@ int tulip_poll(struct net_device *dev, int *budget)
skb
->
head
,
temp
);
}
#endif
pci_unmap_single
(
tp
->
pdev
,
tp
->
rx_buffers
[
entry
].
mapping
,
PKT_BUF_SZ
,
PCI_DMA_FROMDEVICE
);
tp
->
rx_buffers
[
entry
].
skb
=
NULL
;
tp
->
rx_buffers
[
entry
].
mapping
=
0
;
}
skb
->
protocol
=
eth_type_trans
(
skb
,
dev
);
netif_receive_skb
(
skb
);
dev
->
last_rx
=
jiffies
;
tp
->
stats
.
rx_packets
++
;
tp
->
stats
.
rx_bytes
+=
pkt_len
;
...
...
@@ -245,12 +245,12 @@ int tulip_poll(struct net_device *dev, int *budget)
entry
=
(
++
tp
->
cur_rx
)
%
RX_RING_SIZE
;
if
(
tp
->
cur_rx
-
tp
->
dirty_rx
>
RX_RING_SIZE
/
4
)
tulip_refill_rx
(
dev
);
}
/* New ack strategy... irq does not ack Rx any longer
hopefully this helps */
/* Really bad things can happen here... If new packet arrives
* and an irq arrives (tx or just due to occasionally unset
* mask), it will be acked by irq handler, but new thread
...
...
@@ -259,28 +259,28 @@ int tulip_poll(struct net_device *dev, int *budget)
* tomorrow (night 011029). If it will not fail, we won
* finally: amount of IO did not increase at all. */
}
while
((
ioread32
(
tp
->
base_addr
+
CSR5
)
&
RxIntr
));
done:
#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
/* We use this simplistic scheme for IM. It's proven by
real life installations. We can have IM enabled
continuesly but this would cause unnecessary latency.
Unfortunely we can't use all the NET_RX_* feedback here.
This would turn on IM for devices that is not contributing
to backlog congestion with unnecessary latency.
continuesly but this would cause unnecessary latency.
Unfortunely we can't use all the NET_RX_* feedback here.
This would turn on IM for devices that is not contributing
to backlog congestion with unnecessary latency.
We monitor the the device RX-ring and have:
HW Interrupt Mitigation either ON or OFF.
ON: More then 1 pkt received (per intr.) OR we are dropping
ON: More then 1 pkt received (per intr.) OR we are dropping
OFF: Only 1 pkt received
Note. We only use min and max (0, 15) settings from mit_table */
if
(
tp
->
flags
&
HAS_INTR_MITIGATION
)
{
if
(
received
>
1
)
{
if
(
!
tp
->
mit_on
)
{
...
...
@@ -297,20 +297,20 @@ int tulip_poll(struct net_device *dev, int *budget)
}
#endif
/* CONFIG_TULIP_NAPI_HW_MITIGATION */
dev
->
quota
-=
received
;
*
budget
-=
received
;
tulip_refill_rx
(
dev
);
/* If RX ring is not full we are out of memory. */
if
(
tp
->
rx_buffers
[
tp
->
dirty_rx
%
RX_RING_SIZE
].
skb
==
NULL
)
goto
oom
;
/* Remove us from polling list and enable RX intr. */
netif_rx_complete
(
dev
);
iowrite32
(
tulip_tbl
[
tp
->
chip_id
].
valid_intrs
,
tp
->
base_addr
+
CSR7
);
/* The last op happens after poll completion. Which means the following:
* 1. it can race with disabling irqs in irq handler
* 2. it can race with dise/enabling irqs in other poll threads
...
...
@@ -321,9 +321,9 @@ int tulip_poll(struct net_device *dev, int *budget)
* due to races in masking and due to too late acking of already
* processed irqs. But it must not result in losing events.
*/
return
0
;
not_done:
if
(
!
received
)
{
...
...
@@ -331,29 +331,29 @@ int tulip_poll(struct net_device *dev, int *budget)
}
dev
->
quota
-=
received
;
*
budget
-=
received
;
if
(
tp
->
cur_rx
-
tp
->
dirty_rx
>
RX_RING_SIZE
/
2
||
tp
->
rx_buffers
[
tp
->
dirty_rx
%
RX_RING_SIZE
].
skb
==
NULL
)
tulip_refill_rx
(
dev
);
if
(
tp
->
rx_buffers
[
tp
->
dirty_rx
%
RX_RING_SIZE
].
skb
==
NULL
)
goto
oom
;
return
1
;
oom:
/* Executed with RX ints disabled */
/* Start timer, stop polling, but do not enable rx interrupts. */
mod_timer
(
&
tp
->
oom_timer
,
jiffies
+
1
);
/* Think: timer_pending() was an explicit signature of bug.
* Timer can be pending now but fired and completed
* before we did netif_rx_complete(). See? We would lose it. */
/* remove ourselves from the polling list */
netif_rx_complete
(
dev
);
return
0
;
}
...
...
@@ -521,9 +521,9 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
/* Let's see whether the interrupt really is for us */
csr5
=
ioread32
(
ioaddr
+
CSR5
);
if
(
tp
->
flags
&
HAS_PHY_IRQ
)
if
(
tp
->
flags
&
HAS_PHY_IRQ
)
handled
=
phy_interrupt
(
dev
);
if
((
csr5
&
(
NormalIntr
|
AbnormalIntr
))
==
0
)
return
IRQ_RETVAL
(
handled
);
...
...
@@ -538,17 +538,17 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
/* Mask RX intrs and add the device to poll list. */
iowrite32
(
tulip_tbl
[
tp
->
chip_id
].
valid_intrs
&~
RxPollInt
,
ioaddr
+
CSR7
);
netif_rx_schedule
(
dev
);
if
(
!
(
csr5
&~
(
AbnormalIntr
|
NormalIntr
|
RxPollInt
|
TPLnkPass
)))
break
;
}
/* Acknowledge the interrupt sources we handle here ASAP
the poll function does Rx and RxNoBuf acking */
iowrite32
(
csr5
&
0x0001ff3f
,
ioaddr
+
CSR5
);
#else
#else
/* Acknowledge all of the current interrupt sources ASAP. */
iowrite32
(
csr5
&
0x0001ffff
,
ioaddr
+
CSR5
);
...
...
@@ -559,11 +559,11 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
}
#endif
/* CONFIG_TULIP_NAPI */
if
(
tulip_debug
>
4
)
printk
(
KERN_DEBUG
"%s: interrupt csr5=%#8.8x new csr5=%#8.8x.
\n
"
,
dev
->
name
,
csr5
,
ioread32
(
ioaddr
+
CSR5
));
if
(
csr5
&
(
TxNoBuf
|
TxDied
|
TxIntr
|
TimerInt
))
{
unsigned
int
dirty_tx
;
...
...
@@ -737,17 +737,17 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
#ifdef CONFIG_TULIP_NAPI
if
(
rxd
)
csr5
&=
~
RxPollInt
;
}
while
((
csr5
&
(
TxNoBuf
|
TxDied
|
TxIntr
|
}
while
((
csr5
&
(
TxNoBuf
|
TxDied
|
TxIntr
|
TimerInt
|
/* Abnormal intr. */
RxDied
|
TxFIFOUnderflow
|
TxJabber
|
TPLnkFail
|
RxDied
|
TxFIFOUnderflow
|
TxJabber
|
TPLnkFail
|
SytemError
))
!=
0
);
#else
#else
}
while
((
csr5
&
(
NormalIntr
|
AbnormalIntr
))
!=
0
);
tulip_refill_rx
(
dev
);
...
...
drivers/net/tulip/media.c
浏览文件 @
f3b197ac
...
...
@@ -140,7 +140,7 @@ void tulip_mdio_write(struct net_device *dev, int phy_id, int location, int val)
spin_unlock_irqrestore
(
&
tp
->
mii_lock
,
flags
);
return
;
}
/* Establish sync by sending 32 logic ones. */
for
(
i
=
32
;
i
>=
0
;
i
--
)
{
iowrite32
(
MDIO_ENB
|
MDIO_DATA_WRITE1
,
mdio_addr
);
...
...
drivers/net/tulip/tulip.h
浏览文件 @
f3b197ac
...
...
@@ -259,7 +259,7 @@ enum t21143_csr6_bits {
There are no ill effects from too-large receive rings. */
#define TX_RING_SIZE 32
#define RX_RING_SIZE 128
#define RX_RING_SIZE 128
#define MEDIA_MASK 31
#define PKT_BUF_SZ 1536
/* Size of each temporary Rx buffer. */
...
...
drivers/net/tulip/tulip_core.c
浏览文件 @
f3b197ac
...
...
@@ -1224,7 +1224,7 @@ static void __devinit tulip_mwi_config (struct pci_dev *pdev,
* Chips that have the MRM/reserved bit quirk and the burst quirk. That
* is the DM910X and the on chip ULi devices
*/
static
int
tulip_uli_dm_quirk
(
struct
pci_dev
*
pdev
)
{
if
(
pdev
->
vendor
==
0x1282
&&
pdev
->
device
==
0x9102
)
...
...
@@ -1297,7 +1297,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
*/
/* 1. Intel Saturn. Switch to 8 long words burst, 8 long word cache
aligned. Aries might need this too. The Saturn errata are not
aligned. Aries might need this too. The Saturn errata are not
pretty reading but thankfully it's an old 486 chipset.
2. The dreaded SiS496 486 chipset. Same workaround as Intel
...
...
@@ -1500,7 +1500,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
}
#endif
#ifdef CONFIG_MIPS_COBALT
if
((
pdev
->
bus
->
number
==
0
)
&&
if
((
pdev
->
bus
->
number
==
0
)
&&
((
PCI_SLOT
(
pdev
->
devfn
)
==
7
)
||
(
PCI_SLOT
(
pdev
->
devfn
)
==
12
)))
{
/* Cobalt MAC address in first EEPROM locations. */
...
...
drivers/net/tulip/uli526x.c
浏览文件 @
f3b197ac
...
...
@@ -9,7 +9,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#define DRV_NAME "uli526x"
...
...
@@ -185,7 +185,7 @@ struct uli526x_board_info {
/* NIC SROM data */
unsigned
char
srom
[
128
];
u8
init
;
u8
init
;
};
enum
uli526x_offsets
{
...
...
@@ -258,7 +258,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
struct
uli526x_board_info
*
db
;
/* board information structure */
struct
net_device
*
dev
;
int
i
,
err
;
ULI526X_DBUG
(
0
,
"uli526x_init_one()"
,
0
);
if
(
!
printed_version
++
)
...
...
@@ -316,7 +316,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
err
=
-
ENOMEM
;
goto
err_out_nomem
;
}
db
->
first_tx_desc
=
(
struct
tx_desc
*
)
db
->
desc_pool_ptr
;
db
->
first_tx_desc_dma
=
db
->
desc_pool_dma_ptr
;
db
->
buf_pool_start
=
db
->
buf_pool_ptr
;
...
...
@@ -324,14 +324,14 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
db
->
chip_id
=
ent
->
driver_data
;
db
->
ioaddr
=
pci_resource_start
(
pdev
,
0
);
db
->
pdev
=
pdev
;
db
->
init
=
1
;
dev
->
base_addr
=
db
->
ioaddr
;
dev
->
irq
=
pdev
->
irq
;
pci_set_drvdata
(
pdev
,
dev
);
/* Register some necessary functions */
dev
->
open
=
&
uli526x_open
;
dev
->
hard_start_xmit
=
&
uli526x_start_xmit
;
...
...
@@ -341,7 +341,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
dev
->
ethtool_ops
=
&
netdev_ethtool_ops
;
spin_lock_init
(
&
db
->
lock
);
/* read 64 word srom data */
for
(
i
=
0
;
i
<
64
;
i
++
)
((
u16
*
)
db
->
srom
)[
i
]
=
cpu_to_le16
(
read_srom_word
(
db
->
ioaddr
,
i
));
...
...
@@ -374,7 +374,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
goto
err_out_res
;
printk
(
KERN_INFO
"%s: ULi M%04lx at pci%s,"
,
dev
->
name
,
ent
->
driver_data
>>
16
,
pci_name
(
pdev
));
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
"%c%02x"
,
i
?
':'
:
' '
,
dev
->
dev_addr
[
i
]);
printk
(
", irq %d.
\n
"
,
dev
->
irq
);
...
...
@@ -389,7 +389,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
if
(
db
->
desc_pool_ptr
)
pci_free_consistent
(
pdev
,
sizeof
(
struct
tx_desc
)
*
DESC_ALL_CNT
+
0x20
,
db
->
desc_pool_ptr
,
db
->
desc_pool_dma_ptr
);
if
(
db
->
buf_pool_ptr
!=
NULL
)
pci_free_consistent
(
pdev
,
TX_BUF_ALLOC
*
TX_DESC_CNT
+
4
,
db
->
buf_pool_ptr
,
db
->
buf_pool_dma_ptr
);
...
...
@@ -433,7 +433,7 @@ static int uli526x_open(struct net_device *dev)
{
int
ret
;
struct
uli526x_board_info
*
db
=
netdev_priv
(
dev
);
ULI526X_DBUG
(
0
,
"uli526x_open"
,
0
);
ret
=
request_irq
(
dev
->
irq
,
&
uli526x_interrupt
,
SA_SHIRQ
,
dev
->
name
,
dev
);
...
...
@@ -454,7 +454,7 @@ static int uli526x_open(struct net_device *dev)
/* CR6 operation mode decision */
db
->
cr6_data
|=
ULI526X_TXTH_256
;
db
->
cr0_data
=
CR0_DEFAULT
;
/* Initialize ULI526X board */
uli526x_init
(
dev
);
...
...
@@ -604,7 +604,7 @@ static int uli526x_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Restore CR7 to enable interrupt */
spin_unlock_irqrestore
(
&
db
->
lock
,
flags
);
outl
(
db
->
cr7_data
,
dev
->
base_addr
+
DCR7
);
/* free this SKB */
dev_kfree_skb
(
skb
);
...
...
@@ -782,7 +782,7 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info
struct
sk_buff
*
skb
;
int
rxlen
;
u32
rdes0
;
rxptr
=
db
->
rx_ready_ptr
;
while
(
db
->
rx_avail_cnt
)
{
...
...
@@ -821,7 +821,7 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info
if
(
!
(
rdes0
&
0x8000
)
||
((
db
->
cr6_data
&
CR6_PM
)
&&
(
rxlen
>
6
))
)
{
skb
=
rxptr
->
rx_skb_ptr
;
/* Good packet, send to upper layer */
/* Shorst packet used new SKB */
if
(
(
rxlen
<
RX_COPY_SIZE
)
&&
...
...
@@ -841,7 +841,7 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info
dev
->
last_rx
=
jiffies
;
db
->
stats
.
rx_packets
++
;
db
->
stats
.
rx_bytes
+=
rxlen
;
}
else
{
/* Reuse SKB buffer when the packet is error */
ULI526X_DBUG
(
0
,
"Reuse SK buffer, rdes0"
,
rdes0
);
...
...
@@ -911,7 +911,7 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
SUPPORTED_100baseT_Full
|
SUPPORTED_Autoneg
|
SUPPORTED_MII
);
ecmd
->
advertising
=
(
ADVERTISED_10baseT_Half
|
ADVERTISED_10baseT_Full
|
ADVERTISED_100baseT_Half
|
...
...
@@ -924,13 +924,13 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
ecmd
->
phy_address
=
db
->
phy_addr
;
ecmd
->
transceiver
=
XCVR_EXTERNAL
;
ecmd
->
speed
=
10
;
ecmd
->
duplex
=
DUPLEX_HALF
;
if
(
db
->
op_mode
==
ULI526X_100MHF
||
db
->
op_mode
==
ULI526X_100MFD
)
{
ecmd
->
speed
=
100
;
ecmd
->
speed
=
100
;
}
if
(
db
->
op_mode
==
ULI526X_10MFD
||
db
->
op_mode
==
ULI526X_100MFD
)
{
...
...
@@ -939,11 +939,11 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
if
(
db
->
link_failed
)
{
ecmd
->
speed
=
-
1
;
ecmd
->
duplex
=
-
1
;
ecmd
->
duplex
=
-
1
;
}
if
(
db
->
media_mode
&
ULI526X_AUTO
)
{
{
ecmd
->
autoneg
=
AUTONEG_ENABLE
;
}
}
...
...
@@ -964,15 +964,15 @@ static void netdev_get_drvinfo(struct net_device *dev,
static
int
netdev_get_settings
(
struct
net_device
*
dev
,
struct
ethtool_cmd
*
cmd
)
{
struct
uli526x_board_info
*
np
=
netdev_priv
(
dev
);
ULi_ethtool_gset
(
np
,
cmd
);
return
0
;
}
static
u32
netdev_get_link
(
struct
net_device
*
dev
)
{
struct
uli526x_board_info
*
np
=
netdev_priv
(
dev
);
if
(
np
->
link_failed
)
return
0
;
else
...
...
@@ -1005,11 +1005,11 @@ static void uli526x_timer(unsigned long data)
struct
uli526x_board_info
*
db
=
netdev_priv
(
dev
);
unsigned
long
flags
;
u8
TmpSpeed
=
10
;
//ULI526X_DBUG(0, "uli526x_timer()", 0);
spin_lock_irqsave
(
&
db
->
lock
,
flags
);
/* Dynamic reset ULI526X : system error or transmit time-out */
tmp_cr8
=
inl
(
db
->
ioaddr
+
DCR8
);
if
(
(
db
->
interval_rx_cnt
==
0
)
&&
(
tmp_cr8
)
)
{
...
...
@@ -1021,9 +1021,9 @@ static void uli526x_timer(unsigned long data)
/* TX polling kick monitor */
if
(
db
->
tx_packet_cnt
&&
time_after
(
jiffies
,
dev
->
trans_start
+
ULI526X_TX_KICK
)
)
{
outl
(
0x1
,
dev
->
base_addr
+
DCR1
);
// Tx polling again
outl
(
0x1
,
dev
->
base_addr
+
DCR1
);
// Tx polling again
// TX Timeout
// TX Timeout
if
(
time_after
(
jiffies
,
dev
->
trans_start
+
ULI526X_TX_TIMEOUT
)
)
{
db
->
reset_TXtimeout
++
;
db
->
wait_reset
=
1
;
...
...
@@ -1073,7 +1073,7 @@ static void uli526x_timer(unsigned long data)
uli526x_sense_speed
(
db
)
)
db
->
link_failed
=
1
;
uli526x_process_mode
(
db
);
if
(
db
->
link_failed
==
0
)
{
if
(
db
->
op_mode
==
ULI526X_100MHF
||
db
->
op_mode
==
ULI526X_100MFD
)
...
...
@@ -1404,7 +1404,7 @@ static u8 uli526x_sense_speed(struct uli526x_board_info * db)
phy_mode
=
phy_read
(
db
->
ioaddr
,
db
->
phy_addr
,
1
,
db
->
chip_id
);
if
(
(
phy_mode
&
0x24
)
==
0x24
)
{
phy_mode
=
((
phy_read
(
db
->
ioaddr
,
db
->
phy_addr
,
5
,
db
->
chip_id
)
&
0x01e0
)
<<
7
);
if
(
phy_mode
&
0x8000
)
phy_mode
=
0x8000
;
...
...
@@ -1414,7 +1414,7 @@ static u8 uli526x_sense_speed(struct uli526x_board_info * db)
phy_mode
=
0x2000
;
else
phy_mode
=
0x1000
;
/* printk(DRV_NAME ": Phy_mode %x ",phy_mode); */
switch
(
phy_mode
)
{
case
0x1000
:
db
->
op_mode
=
ULI526X_10MHF
;
break
;
...
...
@@ -1442,7 +1442,7 @@ static u8 uli526x_sense_speed(struct uli526x_board_info * db)
static
void
uli526x_set_phyxcer
(
struct
uli526x_board_info
*
db
)
{
u16
phy_reg
;
/* Phyxcer capability setting */
phy_reg
=
phy_read
(
db
->
ioaddr
,
db
->
phy_addr
,
4
,
db
->
chip_id
)
&
~
0x01e0
;
...
...
@@ -1457,7 +1457,7 @@ static void uli526x_set_phyxcer(struct uli526x_board_info *db)
case
ULI526X_100MHF
:
phy_reg
|=
0x80
;
break
;
case
ULI526X_100MFD
:
phy_reg
|=
0x100
;
break
;
}
}
/* Write new capability to Phyxcer Reg4 */
...
...
@@ -1556,7 +1556,7 @@ static void phy_write(unsigned long iobase, u8 phy_addr, u8 offset, u16 phy_data
/* Write a word data to PHY controller */
for
(
i
=
0x8000
;
i
>
0
;
i
>>=
1
)
phy_write_1bit
(
ioaddr
,
phy_data
&
i
?
PHY_DATA_1
:
PHY_DATA_0
,
chip_id
);
}
...
...
@@ -1574,7 +1574,7 @@ static u16 phy_read(unsigned long iobase, u8 phy_addr, u8 offset, u32 chip_id)
return
phy_readby_cr10
(
iobase
,
phy_addr
,
offset
);
/* M5261/M5263 Chip */
ioaddr
=
iobase
+
DCR9
;
/* Send 33 synchronization clock to Phy controller */
for
(
i
=
0
;
i
<
35
;
i
++
)
phy_write_1bit
(
ioaddr
,
PHY_DATA_1
,
chip_id
);
...
...
@@ -1610,7 +1610,7 @@ static u16 phy_read(unsigned long iobase, u8 phy_addr, u8 offset, u32 chip_id)
static
u16
phy_readby_cr10
(
unsigned
long
iobase
,
u8
phy_addr
,
u8
offset
)
{
unsigned
long
ioaddr
,
cr10_value
;
ioaddr
=
iobase
+
DCR10
;
cr10_value
=
phy_addr
;
cr10_value
=
(
cr10_value
<<
5
)
+
offset
;
...
...
@@ -1629,7 +1629,7 @@ static u16 phy_readby_cr10(unsigned long iobase, u8 phy_addr, u8 offset)
static
void
phy_writeby_cr10
(
unsigned
long
iobase
,
u8
phy_addr
,
u8
offset
,
u16
phy_data
)
{
unsigned
long
ioaddr
,
cr10_value
;
ioaddr
=
iobase
+
DCR10
;
cr10_value
=
phy_addr
;
cr10_value
=
(
cr10_value
<<
5
)
+
offset
;
...
...
@@ -1659,7 +1659,7 @@ static void phy_write_1bit(unsigned long ioaddr, u32 phy_data, u32 chip_id)
static
u16
phy_read_1bit
(
unsigned
long
ioaddr
,
u32
chip_id
)
{
u16
phy_data
;
outl
(
0x50000
,
ioaddr
);
udelay
(
1
);
phy_data
=
(
inl
(
ioaddr
)
>>
19
)
&
0x1
;
...
...
drivers/net/tulip/winbond-840.c
浏览文件 @
f3b197ac
...
...
@@ -38,12 +38,12 @@
Copyright (C) 2001 Manfred Spraul
* ethtool support (jgarzik)
* Replace some MII-related magic numbers with constants (jgarzik)
TODO:
* enable pci_power_off
* Wake-On-LAN
*/
#define DRV_NAME "winbond-840"
#define DRV_VERSION "1.01-d"
#define DRV_RELDATE "Nov-17-2001"
...
...
@@ -57,7 +57,7 @@ c-help-name: Winbond W89c840 PCI Ethernet support
c-help-symbol: CONFIG_WINBOND_840
c-help: This driver is for the Winbond W89c840 chip. It also works with
c-help: the TX9882 chip on the Compex RL100-ATX board.
c-help: More specific information and updates are available from
c-help: More specific information and updates are available from
c-help: http://www.scyld.com/network/drivers.html
*/
...
...
@@ -207,7 +207,7 @@ Test with 'ping -s 10000' on a fast computer.
*/
/*
PCI probe table.
...
...
@@ -374,7 +374,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static
struct
ethtool_ops
netdev_ethtool_ops
;
static
int
netdev_close
(
struct
net_device
*
dev
);
static
int
__devinit
w840_probe1
(
struct
pci_dev
*
pdev
,
const
struct
pci_device_id
*
ent
)
...
...
@@ -434,7 +434,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
np
->
mii_if
.
mdio_read
=
mdio_read
;
np
->
mii_if
.
mdio_write
=
mdio_write
;
np
->
base_addr
=
ioaddr
;
pci_set_drvdata
(
pdev
,
dev
);
if
(
dev
->
mem_start
)
...
...
@@ -510,7 +510,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
return
-
ENODEV
;
}
/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. These are
often serial bit streams generated by the host processor.
The example below is for the common 93c46 EEPROM, 64 16 bit words. */
...
...
@@ -660,7 +660,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
return
;
}
static
int
netdev_open
(
struct
net_device
*
dev
)
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
...
...
@@ -731,7 +731,7 @@ static int update_link(struct net_device *dev)
dev
->
name
,
np
->
phys
[
0
]);
netif_carrier_on
(
dev
);
}
if
((
np
->
mii
&
~
0xf
)
==
MII_DAVICOM_DM9101
)
{
/* If the link partner doesn't support autonegotiation
* the MII detects it's abilities with the "parallel detection".
...
...
@@ -761,7 +761,7 @@ static int update_link(struct net_device *dev)
result
|=
0x20000000
;
if
(
result
!=
np
->
csr6
&&
debug
)
printk
(
KERN_INFO
"%s: Setting %dMBit-%s-duplex based on MII#%d
\n
"
,
dev
->
name
,
fasteth
?
100
:
10
,
dev
->
name
,
fasteth
?
100
:
10
,
duplex
?
"full"
:
"half"
,
np
->
phys
[
0
]);
return
result
;
}
...
...
@@ -947,7 +947,7 @@ static void init_registers(struct net_device *dev)
iowrite32
(
i
,
ioaddr
+
PCIBusCfg
);
np
->
csr6
=
0
;
/* 128 byte Tx threshold;
/* 128 byte Tx threshold;
Transmit on; Receive on; */
update_csr6
(
dev
,
0x00022002
|
update_link
(
dev
)
|
__set_rx_mode
(
dev
));
...
...
@@ -1584,7 +1584,7 @@ static int netdev_close(struct net_device *dev)
static
void
__devexit
w840_remove1
(
struct
pci_dev
*
pdev
)
{
struct
net_device
*
dev
=
pci_get_drvdata
(
pdev
);
if
(
dev
)
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
unregister_netdev
(
dev
);
...
...
@@ -1640,7 +1640,7 @@ static int w840_suspend (struct pci_dev *pdev, pm_message_t state)
spin_unlock_wait
(
&
dev
->
xmit_lock
);
synchronize_irq
(
dev
->
irq
);
np
->
stats
.
rx_missed_errors
+=
ioread32
(
ioaddr
+
RxMissed
)
&
0xffff
;
/* no more hardware accesses behind this line. */
...
...
drivers/net/tulip/xircom_cb.c
浏览文件 @
f3b197ac
/*
* xircom_cb: A driver for the (tulip-like) Xircom Cardbus ethernet cards
* xircom_cb: A driver for the (tulip-like) Xircom Cardbus ethernet cards
*
* This software is (C) by the respective authors, and licensed under the GPL
* License.
*
* Written by Arjan van de Ven for Red Hat, Inc.
* Based on work by Jeff Garzik, Doug Ledford and Donald Becker
* Based on work by Jeff Garzik, Doug Ledford and Donald Becker
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
...
...
@@ -93,7 +93,7 @@ struct xircom_private {
unsigned
long
io_port
;
int
open
;
/* transmit_used is the rotating counter that indicates which transmit
descriptor has to be used next */
int
transmit_used
;
...
...
@@ -153,10 +153,10 @@ static struct pci_device_id xircom_pci_table[] = {
MODULE_DEVICE_TABLE
(
pci
,
xircom_pci_table
);
static
struct
pci_driver
xircom_ops
=
{
.
name
=
"xircom_cb"
,
.
id_table
=
xircom_pci_table
,
.
probe
=
xircom_probe
,
.
remove
=
xircom_remove
,
.
name
=
"xircom_cb"
,
.
id_table
=
xircom_pci_table
,
.
probe
=
xircom_probe
,
.
remove
=
xircom_remove
,
.
suspend
=
NULL
,
.
resume
=
NULL
};
...
...
@@ -174,7 +174,7 @@ static void print_binary(unsigned int number)
buffer
[
i2
++
]
=
'1'
;
else
buffer
[
i2
++
]
=
'0'
;
if
((
i
&
3
)
==
0
)
if
((
i
&
3
)
==
0
)
buffer
[
i2
++
]
=
' '
;
}
printk
(
"%s
\n
"
,
buffer
);
...
...
@@ -196,10 +196,10 @@ static struct ethtool_ops netdev_ethtool_ops = {
/* xircom_probe is the code that gets called on device insertion.
it sets up the hardware and registers the device to the networklayer.
TODO: Send 1 or 2 "dummy" packets here as the card seems to discard the
first two packets that get send, and pump hates that.
*/
static
int
__devinit
xircom_probe
(
struct
pci_dev
*
pdev
,
const
struct
pci_device_id
*
id
)
{
...
...
@@ -209,7 +209,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
unsigned
long
flags
;
unsigned
short
tmp16
;
enter
(
"xircom_probe"
);
/* First do the PCI initialisation */
if
(
pci_enable_device
(
pdev
))
...
...
@@ -217,24 +217,24 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
/* disable all powermanagement */
pci_write_config_dword
(
pdev
,
PCI_POWERMGMT
,
0x0000
);
pci_set_master
(
pdev
);
/* Why isn't this done by pci_enable_device ?*/
/* clear PCI status, if any */
pci_read_config_word
(
pdev
,
PCI_STATUS
,
&
tmp16
);
/* clear PCI status, if any */
pci_read_config_word
(
pdev
,
PCI_STATUS
,
&
tmp16
);
pci_write_config_word
(
pdev
,
PCI_STATUS
,
tmp16
);
pci_read_config_byte
(
pdev
,
PCI_REVISION_ID
,
&
chip_rev
);
if
(
!
request_region
(
pci_resource_start
(
pdev
,
0
),
128
,
"xircom_cb"
))
{
printk
(
KERN_ERR
"xircom_probe: failed to allocate io-region
\n
"
);
return
-
ENODEV
;
}
/*
/*
Before changing the hardware, allocate the memory.
This way, we can fail gracefully if not enough memory
is available.
is available.
*/
dev
=
alloc_etherdev
(
sizeof
(
struct
xircom_private
));
if
(
!
dev
)
{
...
...
@@ -242,13 +242,13 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
goto
device_fail
;
}
private
=
netdev_priv
(
dev
);
/* Allocate the send/receive buffers */
private
->
rx_buffer
=
pci_alloc_consistent
(
pdev
,
8192
,
&
private
->
rx_dma_handle
);
if
(
private
->
rx_buffer
==
NULL
)
{
printk
(
KERN_ERR
"xircom_probe: no memory for rx buffer
\n
"
);
goto
rx_buf_fail
;
}
}
private
->
tx_buffer
=
pci_alloc_consistent
(
pdev
,
8192
,
&
private
->
tx_dma_handle
);
if
(
private
->
tx_buffer
==
NULL
)
{
printk
(
KERN_ERR
"xircom_probe: no memory for tx buffer
\n
"
);
...
...
@@ -265,11 +265,11 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
spin_lock_init
(
&
private
->
lock
);
dev
->
irq
=
pdev
->
irq
;
dev
->
base_addr
=
private
->
io_port
;
initialize_card
(
private
);
read_mac_address
(
private
);
setup_descriptors
(
private
);
dev
->
open
=
&
xircom_open
;
dev
->
hard_start_xmit
=
&
xircom_start_xmit
;
dev
->
stop
=
&
xircom_close
;
...
...
@@ -285,19 +285,19 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
printk
(
KERN_ERR
"xircom_probe: netdevice registration failed.
\n
"
);
goto
reg_fail
;
}
printk
(
KERN_INFO
"%s: Xircom cardbus revision %i at irq %i
\n
"
,
dev
->
name
,
chip_rev
,
pdev
->
irq
);
/* start the transmitter to get a heartbeat */
/* TODO: send 2 dummy packets here */
transceiver_voodoo
(
private
);
spin_lock_irqsave
(
&
private
->
lock
,
flags
);
activate_transmitter
(
private
);
activate_receiver
(
private
);
spin_unlock_irqrestore
(
&
private
->
lock
,
flags
);
trigger_receive
(
private
);
leave
(
"xircom_probe"
);
return
0
;
...
...
@@ -332,7 +332,7 @@ static void __devexit xircom_remove(struct pci_dev *pdev)
free_netdev
(
dev
);
pci_set_drvdata
(
pdev
,
NULL
);
leave
(
"xircom_remove"
);
}
}
static
irqreturn_t
xircom_interrupt
(
int
irq
,
void
*
dev_instance
,
struct
pt_regs
*
regs
)
{
...
...
@@ -346,11 +346,11 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs
spin_lock
(
&
card
->
lock
);
status
=
inl
(
card
->
io_port
+
CSR5
);
#ifdef DEBUG
#ifdef DEBUG
print_binary
(
status
);
printk
(
"tx status 0x%08x 0x%08x
\n
"
,
card
->
tx_buffer
[
0
],
card
->
tx_buffer
[
4
]);
printk
(
"rx status 0x%08x 0x%08x
\n
"
,
card
->
rx_buffer
[
0
],
card
->
rx_buffer
[
4
]);
#endif
#endif
/* Handle shared irq and hotplug */
if
(
status
==
0
||
status
==
0xffffffff
)
{
spin_unlock
(
&
card
->
lock
);
...
...
@@ -366,21 +366,21 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs
netif_carrier_on
(
dev
);
else
netif_carrier_off
(
dev
);
}
/* Clear all remaining interrupts */
/* Clear all remaining interrupts */
status
|=
0xffffffff
;
/* FIXME: make this clear only the
real existing bits */
outl
(
status
,
card
->
io_port
+
CSR5
);
for
(
i
=
0
;
i
<
NUMDESCRIPTORS
;
i
++
)
for
(
i
=
0
;
i
<
NUMDESCRIPTORS
;
i
++
)
investigate_write_descriptor
(
dev
,
card
,
i
,
bufferoffsets
[
i
]);
for
(
i
=
0
;
i
<
NUMDESCRIPTORS
;
i
++
)
for
(
i
=
0
;
i
<
NUMDESCRIPTORS
;
i
++
)
investigate_read_descriptor
(
dev
,
card
,
i
,
bufferoffsets
[
i
]);
spin_unlock
(
&
card
->
lock
);
leave
(
"xircom_interrupt"
);
return
IRQ_HANDLED
;
...
...
@@ -393,38 +393,38 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev)
int
nextdescriptor
;
int
desc
;
enter
(
"xircom_start_xmit"
);
card
=
netdev_priv
(
dev
);
spin_lock_irqsave
(
&
card
->
lock
,
flags
);
/* First see if we can free some descriptors */
for
(
desc
=
0
;
desc
<
NUMDESCRIPTORS
;
desc
++
)
for
(
desc
=
0
;
desc
<
NUMDESCRIPTORS
;
desc
++
)
investigate_write_descriptor
(
dev
,
card
,
desc
,
bufferoffsets
[
desc
]);
nextdescriptor
=
(
card
->
transmit_used
+
1
)
%
(
NUMDESCRIPTORS
);
desc
=
card
->
transmit_used
;
/* only send the packet if the descriptor is free */
if
(
card
->
tx_buffer
[
4
*
desc
]
==
0
)
{
/* Copy the packet data; zero the memory first as the card
sometimes sends more than you ask it to. */
memset
(
&
card
->
tx_buffer
[
bufferoffsets
[
desc
]
/
4
],
0
,
1536
);
memcpy
(
&
(
card
->
tx_buffer
[
bufferoffsets
[
desc
]
/
4
]),
skb
->
data
,
skb
->
len
);
/* FIXME: The specification tells us that the length we send HAS to be a multiple of
4 bytes. */
card
->
tx_buffer
[
4
*
desc
+
1
]
=
skb
->
len
;
if
(
desc
==
NUMDESCRIPTORS
-
1
)
card
->
tx_buffer
[
4
*
desc
+
1
]
|=
(
1
<<
25
);
/* bit 25: last descriptor of the ring */
card
->
tx_buffer
[
4
*
desc
+
1
]
|=
0xF0000000
;
/* 0xF0... means want interrupts*/
/* 0xF0... means want interrupts*/
card
->
tx_skb
[
desc
]
=
skb
;
wmb
();
/* This gives the descriptor to the card */
card
->
tx_buffer
[
4
*
desc
]
=
0x80000000
;
...
...
@@ -433,18 +433,18 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue
(
dev
);
}
card
->
transmit_used
=
nextdescriptor
;
leave
(
"xircom-start_xmit - sent"
);
leave
(
"xircom-start_xmit - sent"
);
spin_unlock_irqrestore
(
&
card
->
lock
,
flags
);
return
0
;
}
/* Uh oh... no free descriptor... drop the packet */
netif_stop_queue
(
dev
);
spin_unlock_irqrestore
(
&
card
->
lock
,
flags
);
trigger_transmit
(
card
);
return
-
EIO
;
}
...
...
@@ -462,7 +462,7 @@ static int xircom_open(struct net_device *dev)
leave
(
"xircom_open - No IRQ"
);
return
retval
;
}
xircom_up
(
xp
);
xp
->
open
=
1
;
leave
(
"xircom_open"
);
...
...
@@ -473,31 +473,31 @@ static int xircom_close(struct net_device *dev)
{
struct
xircom_private
*
card
;
unsigned
long
flags
;
enter
(
"xircom_close"
);
card
=
netdev_priv
(
dev
);
netif_stop_queue
(
dev
);
/* we don't want new packets */
spin_lock_irqsave
(
&
card
->
lock
,
flags
);
disable_all_interrupts
(
card
);
#if 0
#if 0
/* We can enable this again once we send dummy packets on ifconfig ethX up */
deactivate_receiver(card);
deactivate_transmitter(card);
#endif
#endif
remove_descriptors
(
card
);
spin_unlock_irqrestore
(
&
card
->
lock
,
flags
);
card
->
open
=
0
;
free_irq
(
dev
->
irq
,
dev
);
leave
(
"xircom_close"
);
return
0
;
}
...
...
@@ -506,8 +506,8 @@ static struct net_device_stats *xircom_get_stats(struct net_device *dev)
{
struct
xircom_private
*
card
=
netdev_priv
(
dev
);
return
&
card
->
stats
;
}
}
#ifdef CONFIG_NET_POLL_CONTROLLER
static
void
xircom_poll_controller
(
struct
net_device
*
dev
)
...
...
@@ -540,7 +540,7 @@ static void initialize_card(struct xircom_private *card)
outl
(
val
,
card
->
io_port
+
CSR0
);
val
=
0
;
/* Value 0x00 is a safe and conservative value
val
=
0
;
/* Value 0x00 is a safe and conservative value
for the PCI configuration settings */
outl
(
val
,
card
->
io_port
+
CSR0
);
...
...
@@ -617,23 +617,23 @@ static void setup_descriptors(struct xircom_private *card)
/* Rx Descr2: address of the buffer
we store the buffer at the 2nd half of the page */
address
=
(
unsigned
long
)
card
->
rx_dma_handle
;
card
->
rx_buffer
[
i
*
4
+
2
]
=
cpu_to_le32
(
address
+
bufferoffsets
[
i
]);
/* Rx Desc3: address of 2nd buffer -> 0 */
card
->
rx_buffer
[
i
*
4
+
3
]
=
0
;
}
wmb
();
/* Write the receive descriptor ring address to the card */
address
=
(
unsigned
long
)
card
->
rx_dma_handle
;
val
=
cpu_to_le32
(
address
);
val
=
cpu_to_le32
(
address
);
outl
(
val
,
card
->
io_port
+
CSR3
);
/* Receive descr list address */
/* transmit descriptors */
memset
(
card
->
tx_buffer
,
0
,
128
);
/* clear the descriptors */
for
(
i
=
0
;
i
<
NUMDESCRIPTORS
;
i
++
)
{
/* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */
card
->
tx_buffer
[
i
*
4
+
0
]
=
0x00000000
;
...
...
@@ -641,7 +641,7 @@ static void setup_descriptors(struct xircom_private *card)
card
->
tx_buffer
[
i
*
4
+
1
]
=
1536
;
if
(
i
==
NUMDESCRIPTORS
-
1
)
card
->
tx_buffer
[
i
*
4
+
1
]
|=
(
1
<<
25
);
/* bit 25 is "last descriptor" */
/* Tx Descr2: address of the buffer
we store the buffer at the 2nd half of the page */
address
=
(
unsigned
long
)
card
->
tx_dma_handle
;
...
...
@@ -748,7 +748,7 @@ static int receive_active(struct xircom_private *card)
activate_receiver enables the receiver on the card.
Before being allowed to active the receiver, the receiver
must be completely de-activated. To achieve this,
this code actually disables the receiver first; then it waits for the
this code actually disables the receiver first; then it waits for the
receiver to become inactive, then it activates the receiver and then
it waits for the receiver to be active.
...
...
@@ -762,13 +762,13 @@ static void activate_receiver(struct xircom_private *card)
val
=
inl
(
card
->
io_port
+
CSR6
);
/* Operation mode */
/* If the "active" bit is set and the receiver is already
active, no need to do the expensive thing */
if
((
val
&
2
)
&&
(
receive_active
(
card
)))
return
;
val
=
val
&
~
2
;
/* disable the receiver */
outl
(
val
,
card
->
io_port
+
CSR6
);
...
...
@@ -805,7 +805,7 @@ static void activate_receiver(struct xircom_private *card)
/*
deactivate_receiver disables the receiver on the card.
To achieve this this code disables the receiver first;
To achieve this this code disables the receiver first;
then it waits for the receiver to become inactive.
must be called with the lock held and interrupts disabled.
...
...
@@ -840,7 +840,7 @@ static void deactivate_receiver(struct xircom_private *card)
activate_transmitter enables the transmitter on the card.
Before being allowed to active the transmitter, the transmitter
must be completely de-activated. To achieve this,
this code actually disables the transmitter first; then it waits for the
this code actually disables the transmitter first; then it waits for the
transmitter to become inactive, then it activates the transmitter and then
it waits for the transmitter to be active again.
...
...
@@ -856,7 +856,7 @@ static void activate_transmitter(struct xircom_private *card)
val
=
inl
(
card
->
io_port
+
CSR6
);
/* Operation mode */
/* If the "active" bit is set and the receiver is already
active, no need to do the expensive thing */
active, no need to do the expensive thing */
if
((
val
&
(
1
<<
13
))
&&
(
transmit_active
(
card
)))
return
;
...
...
@@ -896,7 +896,7 @@ static void activate_transmitter(struct xircom_private *card)
/*
deactivate_transmitter disables the transmitter on the card.
To achieve this this code disables the transmitter first;
To achieve this this code disables the transmitter first;
then it waits for the transmitter to become inactive.
must be called with the lock held and interrupts disabled.
...
...
@@ -990,7 +990,7 @@ static void disable_all_interrupts(struct xircom_private *card)
{
unsigned
int
val
;
enter
(
"enable_all_interrupts"
);
val
=
0
;
/* disable all interrupts */
outl
(
val
,
card
->
io_port
+
CSR7
);
...
...
@@ -1031,8 +1031,8 @@ static int enable_promisc(struct xircom_private *card)
unsigned
int
val
;
enter
(
"enable_promisc"
);
val
=
inl
(
card
->
io_port
+
CSR6
);
val
=
val
|
(
1
<<
6
);
val
=
inl
(
card
->
io_port
+
CSR6
);
val
=
val
|
(
1
<<
6
);
outl
(
val
,
card
->
io_port
+
CSR6
);
leave
(
"enable_promisc"
);
...
...
@@ -1042,7 +1042,7 @@ static int enable_promisc(struct xircom_private *card)
/*
/*
link_status() checks the the links status and will return 0 for no link, 10 for 10mbit link and 100 for.. guess what.
Must be called in locked state with interrupts disabled
...
...
@@ -1051,15 +1051,15 @@ static int link_status(struct xircom_private *card)
{
unsigned
int
val
;
enter
(
"link_status"
);
val
=
inb
(
card
->
io_port
+
CSR12
);
if
(
!
(
val
&
(
1
<<
2
)))
/* bit 2 is 0 for 10mbit link, 1 for not an 10mbit link */
return
10
;
if
(
!
(
val
&
(
1
<<
1
)))
/* bit 1 is 0 for 100mbit link, 1 for not an 100mbit link */
return
100
;
/* If we get here -> no link at all */
/* If we get here -> no link at all */
leave
(
"link_status"
);
return
0
;
...
...
@@ -1071,7 +1071,7 @@ static int link_status(struct xircom_private *card)
/*
read_mac_address() reads the MAC address from the NIC and stores it in the "dev" structure.
This function will take the spinlock itself and can, as a result, not be called with the lock helt.
*/
static
void
read_mac_address
(
struct
xircom_private
*
card
)
...
...
@@ -1081,7 +1081,7 @@ static void read_mac_address(struct xircom_private *card)
int
i
;
enter
(
"read_mac_address"
);
spin_lock_irqsave
(
&
card
->
lock
,
flags
);
outl
(
1
<<
12
,
card
->
io_port
+
CSR9
);
/* enable boot rom access */
...
...
@@ -1095,7 +1095,7 @@ static void read_mac_address(struct xircom_private *card)
outl
(
i
+
3
,
card
->
io_port
+
CSR10
);
data_count
=
inl
(
card
->
io_port
+
CSR9
)
&
0xff
;
if
((
tuple
==
0x22
)
&&
(
data_id
==
0x04
)
&&
(
data_count
==
0x06
))
{
/*
/*
* This is it. We have the data we want.
*/
for
(
j
=
0
;
j
<
6
;
j
++
)
{
...
...
@@ -1136,12 +1136,12 @@ static void transceiver_voodoo(struct xircom_private *card)
spin_lock_irqsave
(
&
card
->
lock
,
flags
);
outl
(
0x0008
,
card
->
io_port
+
CSR15
);
udelay
(
25
);
udelay
(
25
);
outl
(
0xa8050000
,
card
->
io_port
+
CSR15
);
udelay
(
25
);
outl
(
0xa00f0000
,
card
->
io_port
+
CSR15
);
udelay
(
25
);
spin_unlock_irqrestore
(
&
card
->
lock
,
flags
);
netif_start_queue
(
card
->
dev
);
...
...
@@ -1163,15 +1163,15 @@ static void xircom_up(struct xircom_private *card)
spin_lock_irqsave
(
&
card
->
lock
,
flags
);
enable_link_interrupt
(
card
);
enable_transmit_interrupt
(
card
);
enable_receive_interrupt
(
card
);
enable_common_interrupts
(
card
);
enable_promisc
(
card
);
/* The card can have received packets already, read them away now */
for
(
i
=
0
;
i
<
NUMDESCRIPTORS
;
i
++
)
for
(
i
=
0
;
i
<
NUMDESCRIPTORS
;
i
++
)
investigate_read_descriptor
(
card
->
dev
,
card
,
i
,
bufferoffsets
[
i
]);
...
...
@@ -1185,15 +1185,15 @@ static void xircom_up(struct xircom_private *card)
/* Bufferoffset is in BYTES */
static
void
investigate_read_descriptor
(
struct
net_device
*
dev
,
struct
xircom_private
*
card
,
int
descnr
,
unsigned
int
bufferoffset
)
{
int
status
;
int
status
;
enter
(
"investigate_read_descriptor"
);
status
=
card
->
rx_buffer
[
4
*
descnr
];
if
((
status
>
0
))
{
/* packet received */
/* TODO: discard error packets */
short
pkt_len
=
((
status
>>
16
)
&
0x7ff
)
-
4
;
/* minus 4, we don't want the CRC */
struct
sk_buff
*
skb
;
...
...
@@ -1216,7 +1216,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
dev
->
last_rx
=
jiffies
;
card
->
stats
.
rx_packets
++
;
card
->
stats
.
rx_bytes
+=
pkt_len
;
out:
/* give the buffer back to the card */
card
->
rx_buffer
[
4
*
descnr
]
=
0x80000000
;
...
...
@@ -1234,9 +1234,9 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p
int
status
;
enter
(
"investigate_write_descriptor"
);
status
=
card
->
tx_buffer
[
4
*
descnr
];
#if 0
#if 0
if (status & 0x8000) { /* Major error */
printk(KERN_ERR "Major transmit error status %x \n", status);
card->tx_buffer[4*descnr] = 0;
...
...
@@ -1258,7 +1258,7 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p
}
leave
(
"investigate_write_descriptor"
);
}
...
...
@@ -1271,8 +1271,8 @@ static int __init xircom_init(void)
static
void
__exit
xircom_exit
(
void
)
{
pci_unregister_driver
(
&
xircom_ops
);
}
}
module_init
(
xircom_init
)
module_init
(
xircom_init
)
module_exit
(
xircom_exit
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录