Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
63906e41
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
153
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
63906e41
编写于
9月 27, 2005
作者:
L
Linus Torvalds
浏览文件
操作
浏览文件
下载
差异文件
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
上级
59175839
c8a6c296
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
94 addition
and
24 deletion
+94
-24
drivers/net/tg3.c
drivers/net/tg3.c
+79
-15
drivers/net/tg3.h
drivers/net/tg3.h
+1
-0
net/core/neighbour.c
net/core/neighbour.c
+14
-9
未找到文件。
drivers/net/tg3.c
浏览文件 @
63906e41
...
@@ -67,8 +67,8 @@
...
@@ -67,8 +67,8 @@
#define DRV_MODULE_NAME "tg3"
#define DRV_MODULE_NAME "tg3"
#define PFX DRV_MODULE_NAME ": "
#define PFX DRV_MODULE_NAME ": "
#define DRV_MODULE_VERSION "3.4
0
"
#define DRV_MODULE_VERSION "3.4
1
"
#define DRV_MODULE_RELDATE "September
15
, 2005"
#define DRV_MODULE_RELDATE "September
27
, 2005"
#define TG3_DEF_MAC_MODE 0
#define TG3_DEF_MAC_MODE 0
#define TG3_DEF_RX_MODE 0
#define TG3_DEF_RX_MODE 0
...
@@ -3389,7 +3389,8 @@ static irqreturn_t tg3_test_isr(int irq, void *dev_id,
...
@@ -3389,7 +3389,8 @@ static irqreturn_t tg3_test_isr(int irq, void *dev_id,
struct
tg3
*
tp
=
netdev_priv
(
dev
);
struct
tg3
*
tp
=
netdev_priv
(
dev
);
struct
tg3_hw_status
*
sblk
=
tp
->
hw_status
;
struct
tg3_hw_status
*
sblk
=
tp
->
hw_status
;
if
(
sblk
->
status
&
SD_STATUS_UPDATED
)
{
if
((
sblk
->
status
&
SD_STATUS_UPDATED
)
||
!
(
tr32
(
TG3PCI_PCISTATE
)
&
PCISTATE_INT_NOT_ACTIVE
))
{
tw32_mailbox
(
MAILBOX_INTERRUPT_0
+
TG3_64BIT_REG_LOW
,
tw32_mailbox
(
MAILBOX_INTERRUPT_0
+
TG3_64BIT_REG_LOW
,
0x00000001
);
0x00000001
);
return
IRQ_RETVAL
(
1
);
return
IRQ_RETVAL
(
1
);
...
@@ -5395,6 +5396,9 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p)
...
@@ -5395,6 +5396,9 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p)
struct
tg3
*
tp
=
netdev_priv
(
dev
);
struct
tg3
*
tp
=
netdev_priv
(
dev
);
struct
sockaddr
*
addr
=
p
;
struct
sockaddr
*
addr
=
p
;
if
(
!
is_valid_ether_addr
(
addr
->
sa_data
))
return
-
EINVAL
;
memcpy
(
dev
->
dev_addr
,
addr
->
sa_data
,
dev
->
addr_len
);
memcpy
(
dev
->
dev_addr
,
addr
->
sa_data
,
dev
->
addr_len
);
spin_lock_bh
(
&
tp
->
lock
);
spin_lock_bh
(
&
tp
->
lock
);
...
@@ -5806,6 +5810,13 @@ static int tg3_reset_hw(struct tg3 *tp)
...
@@ -5806,6 +5810,13 @@ static int tg3_reset_hw(struct tg3 *tp)
}
}
memset
(
tp
->
hw_status
,
0
,
TG3_HW_STATUS_SIZE
);
memset
(
tp
->
hw_status
,
0
,
TG3_HW_STATUS_SIZE
);
if
(
tp
->
tg3_flags2
&
TG3_FLG2_MII_SERDES
)
{
tp
->
tg3_flags2
&=
~
TG3_FLG2_PARALLEL_DETECT
;
/* reset to prevent losing 1st rx packet intermittently */
tw32_f
(
MAC_RX_MODE
,
RX_MODE_RESET
);
udelay
(
10
);
}
tp
->
mac_mode
=
MAC_MODE_TXSTAT_ENABLE
|
MAC_MODE_RXSTAT_ENABLE
|
tp
->
mac_mode
=
MAC_MODE_TXSTAT_ENABLE
|
MAC_MODE_RXSTAT_ENABLE
|
MAC_MODE_TDE_ENABLE
|
MAC_MODE_RDE_ENABLE
|
MAC_MODE_FHDE_ENABLE
;
MAC_MODE_TDE_ENABLE
|
MAC_MODE_RDE_ENABLE
|
MAC_MODE_FHDE_ENABLE
;
tw32_f
(
MAC_MODE
,
tp
->
mac_mode
|
MAC_MODE_RXSTAT_CLEAR
|
MAC_MODE_TXSTAT_CLEAR
);
tw32_f
(
MAC_MODE
,
tp
->
mac_mode
|
MAC_MODE_RXSTAT_CLEAR
|
MAC_MODE_TXSTAT_CLEAR
);
...
@@ -5937,7 +5948,7 @@ static int tg3_reset_hw(struct tg3 *tp)
...
@@ -5937,7 +5948,7 @@ static int tg3_reset_hw(struct tg3 *tp)
tw32
(
MAC_LED_CTRL
,
tp
->
led_ctrl
);
tw32
(
MAC_LED_CTRL
,
tp
->
led_ctrl
);
tw32
(
MAC_MI_STAT
,
MAC_MI_STAT_LNKSTAT_ATTN_ENAB
);
tw32
(
MAC_MI_STAT
,
MAC_MI_STAT_LNKSTAT_ATTN_ENAB
);
if
(
tp
->
tg3_flags2
&
TG3_FLG2_
AN
Y_SERDES
)
{
if
(
tp
->
tg3_flags2
&
TG3_FLG2_
PH
Y_SERDES
)
{
tw32_f
(
MAC_RX_MODE
,
RX_MODE_RESET
);
tw32_f
(
MAC_RX_MODE
,
RX_MODE_RESET
);
udelay
(
10
);
udelay
(
10
);
}
}
...
@@ -7360,12 +7371,17 @@ static int tg3_nway_reset(struct net_device *dev)
...
@@ -7360,12 +7371,17 @@ static int tg3_nway_reset(struct net_device *dev)
if
(
!
netif_running
(
dev
))
if
(
!
netif_running
(
dev
))
return
-
EAGAIN
;
return
-
EAGAIN
;
if
(
tp
->
tg3_flags2
&
TG3_FLG2_PHY_SERDES
)
return
-
EINVAL
;
spin_lock_bh
(
&
tp
->
lock
);
spin_lock_bh
(
&
tp
->
lock
);
r
=
-
EINVAL
;
r
=
-
EINVAL
;
tg3_readphy
(
tp
,
MII_BMCR
,
&
bmcr
);
tg3_readphy
(
tp
,
MII_BMCR
,
&
bmcr
);
if
(
!
tg3_readphy
(
tp
,
MII_BMCR
,
&
bmcr
)
&&
if
(
!
tg3_readphy
(
tp
,
MII_BMCR
,
&
bmcr
)
&&
(
bmcr
&
BMCR_ANENABLE
))
{
((
bmcr
&
BMCR_ANENABLE
)
||
tg3_writephy
(
tp
,
MII_BMCR
,
bmcr
|
BMCR_ANRESTART
);
(
tp
->
tg3_flags2
&
TG3_FLG2_PARALLEL_DETECT
)))
{
tg3_writephy
(
tp
,
MII_BMCR
,
bmcr
|
BMCR_ANRESTART
|
BMCR_ANENABLE
);
r
=
0
;
r
=
0
;
}
}
spin_unlock_bh
(
&
tp
->
lock
);
spin_unlock_bh
(
&
tp
->
lock
);
...
@@ -7927,19 +7943,32 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
...
@@ -7927,19 +7943,32 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
struct
tg3_rx_buffer_desc
*
desc
;
struct
tg3_rx_buffer_desc
*
desc
;
if
(
loopback_mode
==
TG3_MAC_LOOPBACK
)
{
if
(
loopback_mode
==
TG3_MAC_LOOPBACK
)
{
/* HW errata - mac loopback fails in some cases on 5780.
* Normal traffic and PHY loopback are not affected by
* errata.
*/
if
(
GET_ASIC_REV
(
tp
->
pci_chip_rev_id
)
==
ASIC_REV_5780
)
return
0
;
mac_mode
=
(
tp
->
mac_mode
&
~
MAC_MODE_PORT_MODE_MASK
)
|
mac_mode
=
(
tp
->
mac_mode
&
~
MAC_MODE_PORT_MODE_MASK
)
|
MAC_MODE_PORT_INT_LPBACK
|
MAC_MODE_LINK_POLARITY
|
MAC_MODE_PORT_INT_LPBACK
|
MAC_MODE_LINK_POLARITY
|
MAC_MODE_PORT_MODE_GMII
;
MAC_MODE_PORT_MODE_GMII
;
tw32
(
MAC_MODE
,
mac_mode
);
tw32
(
MAC_MODE
,
mac_mode
);
}
else
if
(
loopback_mode
==
TG3_PHY_LOOPBACK
)
{
}
else
if
(
loopback_mode
==
TG3_PHY_LOOPBACK
)
{
tg3_writephy
(
tp
,
MII_BMCR
,
BMCR_LOOPBACK
|
BMCR_FULLDPLX
|
BMCR_SPEED1000
);
udelay
(
40
);
/* reset to prevent losing 1st rx packet intermittently */
if
(
tp
->
tg3_flags2
&
TG3_FLG2_MII_SERDES
)
{
tw32_f
(
MAC_RX_MODE
,
RX_MODE_RESET
);
udelay
(
10
);
tw32_f
(
MAC_RX_MODE
,
tp
->
rx_mode
);
}
mac_mode
=
(
tp
->
mac_mode
&
~
MAC_MODE_PORT_MODE_MASK
)
|
mac_mode
=
(
tp
->
mac_mode
&
~
MAC_MODE_PORT_MODE_MASK
)
|
MAC_MODE_LINK_POLARITY
|
MAC_MODE_PORT_MODE_GMII
;
MAC_MODE_LINK_POLARITY
|
MAC_MODE_PORT_MODE_GMII
;
if
((
tp
->
phy_id
&
PHY_ID_MASK
)
==
PHY_ID_BCM5401
)
if
((
tp
->
phy_id
&
PHY_ID_MASK
)
==
PHY_ID_BCM5401
)
mac_mode
&=
~
MAC_MODE_LINK_POLARITY
;
mac_mode
&=
~
MAC_MODE_LINK_POLARITY
;
tw32
(
MAC_MODE
,
mac_mode
);
tw32
(
MAC_MODE
,
mac_mode
);
tg3_writephy
(
tp
,
MII_BMCR
,
BMCR_LOOPBACK
|
BMCR_FULLDPLX
|
BMCR_SPEED1000
);
}
}
else
else
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -10324,6 +10353,44 @@ static char * __devinit tg3_phy_string(struct tg3 *tp)
...
@@ -10324,6 +10353,44 @@ static char * __devinit tg3_phy_string(struct tg3 *tp)
};
};
}
}
static
char
*
__devinit
tg3_bus_string
(
struct
tg3
*
tp
,
char
*
str
)
{
if
(
tp
->
tg3_flags2
&
TG3_FLG2_PCI_EXPRESS
)
{
strcpy
(
str
,
"PCI Express"
);
return
str
;
}
else
if
(
tp
->
tg3_flags
&
TG3_FLAG_PCIX_MODE
)
{
u32
clock_ctrl
=
tr32
(
TG3PCI_CLOCK_CTRL
)
&
0x1f
;
strcpy
(
str
,
"PCIX:"
);
if
((
clock_ctrl
==
7
)
||
((
tr32
(
GRC_MISC_CFG
)
&
GRC_MISC_CFG_BOARD_ID_MASK
)
==
GRC_MISC_CFG_BOARD_ID_5704CIOBE
))
strcat
(
str
,
"133MHz"
);
else
if
(
clock_ctrl
==
0
)
strcat
(
str
,
"33MHz"
);
else
if
(
clock_ctrl
==
2
)
strcat
(
str
,
"50MHz"
);
else
if
(
clock_ctrl
==
4
)
strcat
(
str
,
"66MHz"
);
else
if
(
clock_ctrl
==
6
)
strcat
(
str
,
"100MHz"
);
else
if
(
clock_ctrl
==
7
)
strcat
(
str
,
"133MHz"
);
}
else
{
strcpy
(
str
,
"PCI:"
);
if
(
tp
->
tg3_flags
&
TG3_FLAG_PCI_HIGH_SPEED
)
strcat
(
str
,
"66MHz"
);
else
strcat
(
str
,
"33MHz"
);
}
if
(
tp
->
tg3_flags
&
TG3_FLAG_PCI_32BIT
)
strcat
(
str
,
":32-bit"
);
else
strcat
(
str
,
":64-bit"
);
return
str
;
}
static
struct
pci_dev
*
__devinit
tg3_find_5704_peer
(
struct
tg3
*
tp
)
static
struct
pci_dev
*
__devinit
tg3_find_5704_peer
(
struct
tg3
*
tp
)
{
{
struct
pci_dev
*
peer
;
struct
pci_dev
*
peer
;
...
@@ -10386,6 +10453,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
...
@@ -10386,6 +10453,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
struct
net_device
*
dev
;
struct
net_device
*
dev
;
struct
tg3
*
tp
;
struct
tg3
*
tp
;
int
i
,
err
,
pci_using_dac
,
pm_cap
;
int
i
,
err
,
pci_using_dac
,
pm_cap
;
char
str
[
40
];
if
(
tg3_version_printed
++
==
0
)
if
(
tg3_version_printed
++
==
0
)
printk
(
KERN_INFO
"%s"
,
version
);
printk
(
KERN_INFO
"%s"
,
version
);
...
@@ -10631,16 +10699,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
...
@@ -10631,16 +10699,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
pci_set_drvdata
(
pdev
,
dev
);
pci_set_drvdata
(
pdev
,
dev
);
printk
(
KERN_INFO
"%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (
PCI%s:%s:
%s) %sBaseT Ethernet "
,
printk
(
KERN_INFO
"%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (%s) %sBaseT Ethernet "
,
dev
->
name
,
dev
->
name
,
tp
->
board_part_number
,
tp
->
board_part_number
,
tp
->
pci_chip_rev_id
,
tp
->
pci_chip_rev_id
,
tg3_phy_string
(
tp
),
tg3_phy_string
(
tp
),
((
tp
->
tg3_flags
&
TG3_FLAG_PCIX_MODE
)
?
"X"
:
""
),
tg3_bus_string
(
tp
,
str
),
((
tp
->
tg3_flags
&
TG3_FLAG_PCI_HIGH_SPEED
)
?
((
tp
->
tg3_flags
&
TG3_FLAG_PCIX_MODE
)
?
"133MHz"
:
"66MHz"
)
:
((
tp
->
tg3_flags
&
TG3_FLAG_PCIX_MODE
)
?
"100MHz"
:
"33MHz"
)),
((
tp
->
tg3_flags
&
TG3_FLAG_PCI_32BIT
)
?
"32-bit"
:
"64-bit"
),
(
tp
->
tg3_flags
&
TG3_FLAG_10_100_ONLY
)
?
"10/100"
:
"10/100/1000"
);
(
tp
->
tg3_flags
&
TG3_FLAG_10_100_ONLY
)
?
"10/100"
:
"10/100/1000"
);
for
(
i
=
0
;
i
<
6
;
i
++
)
for
(
i
=
0
;
i
<
6
;
i
++
)
...
...
drivers/net/tg3.h
浏览文件 @
63906e41
...
@@ -2246,6 +2246,7 @@ struct tg3 {
...
@@ -2246,6 +2246,7 @@ struct tg3 {
(X) == PHY_ID_BCM5411 || (X) == PHY_ID_BCM5701 || \
(X) == PHY_ID_BCM5411 || (X) == PHY_ID_BCM5701 || \
(X) == PHY_ID_BCM5703 || (X) == PHY_ID_BCM5704 || \
(X) == PHY_ID_BCM5703 || (X) == PHY_ID_BCM5704 || \
(X) == PHY_ID_BCM5705 || (X) == PHY_ID_BCM5750 || \
(X) == PHY_ID_BCM5705 || (X) == PHY_ID_BCM5750 || \
(X) == PHY_ID_BCM5752 || (X) == PHY_ID_BCM5780 || \
(X) == PHY_ID_BCM8002)
(X) == PHY_ID_BCM8002)
struct
tg3_hw_stats
*
hw_stats
;
struct
tg3_hw_stats
*
hw_stats
;
...
...
net/core/neighbour.c
浏览文件 @
63906e41
...
@@ -727,6 +727,13 @@ static __inline__ int neigh_max_probes(struct neighbour *n)
...
@@ -727,6 +727,13 @@ static __inline__ int neigh_max_probes(struct neighbour *n)
p
->
ucast_probes
+
p
->
app_probes
+
p
->
mcast_probes
);
p
->
ucast_probes
+
p
->
app_probes
+
p
->
mcast_probes
);
}
}
static
inline
void
neigh_add_timer
(
struct
neighbour
*
n
,
unsigned
long
when
)
{
if
(
unlikely
(
mod_timer
(
&
n
->
timer
,
when
)))
{
printk
(
"NEIGH: BUG, double timer add, state is %x
\n
"
,
n
->
nud_state
);
}
}
/* Called when a timer expires for a neighbour entry. */
/* Called when a timer expires for a neighbour entry. */
...
@@ -811,8 +818,7 @@ static void neigh_timer_handler(unsigned long arg)
...
@@ -811,8 +818,7 @@ static void neigh_timer_handler(unsigned long arg)
neigh_hold
(
neigh
);
neigh_hold
(
neigh
);
if
(
time_before
(
next
,
jiffies
+
HZ
/
2
))
if
(
time_before
(
next
,
jiffies
+
HZ
/
2
))
next
=
jiffies
+
HZ
/
2
;
next
=
jiffies
+
HZ
/
2
;
neigh
->
timer
.
expires
=
next
;
neigh_add_timer
(
neigh
,
next
);
add_timer
(
&
neigh
->
timer
);
}
}
if
(
neigh
->
nud_state
&
(
NUD_INCOMPLETE
|
NUD_PROBE
))
{
if
(
neigh
->
nud_state
&
(
NUD_INCOMPLETE
|
NUD_PROBE
))
{
struct
sk_buff
*
skb
=
skb_peek
(
&
neigh
->
arp_queue
);
struct
sk_buff
*
skb
=
skb_peek
(
&
neigh
->
arp_queue
);
...
@@ -854,8 +860,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
...
@@ -854,8 +860,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
atomic_set
(
&
neigh
->
probes
,
neigh
->
parms
->
ucast_probes
);
atomic_set
(
&
neigh
->
probes
,
neigh
->
parms
->
ucast_probes
);
neigh
->
nud_state
=
NUD_INCOMPLETE
;
neigh
->
nud_state
=
NUD_INCOMPLETE
;
neigh_hold
(
neigh
);
neigh_hold
(
neigh
);
neigh
->
timer
.
expires
=
now
+
1
;
neigh_add_timer
(
neigh
,
now
+
1
);
add_timer
(
&
neigh
->
timer
);
}
else
{
}
else
{
neigh
->
nud_state
=
NUD_FAILED
;
neigh
->
nud_state
=
NUD_FAILED
;
write_unlock_bh
(
&
neigh
->
lock
);
write_unlock_bh
(
&
neigh
->
lock
);
...
@@ -868,8 +873,8 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
...
@@ -868,8 +873,8 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
NEIGH_PRINTK2
(
"neigh %p is delayed.
\n
"
,
neigh
);
NEIGH_PRINTK2
(
"neigh %p is delayed.
\n
"
,
neigh
);
neigh_hold
(
neigh
);
neigh_hold
(
neigh
);
neigh
->
nud_state
=
NUD_DELAY
;
neigh
->
nud_state
=
NUD_DELAY
;
neigh
->
timer
.
expires
=
jiffies
+
neigh
->
parms
->
delay_probe_time
;
neigh
_add_timer
(
neigh
,
add_timer
(
&
neigh
->
timer
);
jiffies
+
neigh
->
parms
->
delay_probe_time
);
}
}
if
(
neigh
->
nud_state
==
NUD_INCOMPLETE
)
{
if
(
neigh
->
nud_state
==
NUD_INCOMPLETE
)
{
...
@@ -1015,10 +1020,10 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
...
@@ -1015,10 +1020,10 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
neigh_del_timer
(
neigh
);
neigh_del_timer
(
neigh
);
if
(
new
&
NUD_IN_TIMER
)
{
if
(
new
&
NUD_IN_TIMER
)
{
neigh_hold
(
neigh
);
neigh_hold
(
neigh
);
neigh
->
timer
.
expires
=
jiffies
+
neigh
_add_timer
(
neigh
,
(
jiffies
+
((
new
&
NUD_REACHABLE
)
?
((
new
&
NUD_REACHABLE
)
?
neigh
->
parms
->
reachable_time
:
0
);
neigh
->
parms
->
reachable_time
:
add_timer
(
&
neigh
->
timer
);
0
))
);
}
}
neigh
->
nud_state
=
new
;
neigh
->
nud_state
=
new
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录