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
b1106618
Commit
b1106618
authored
Jul 29, 2004
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Plain Diff
Merge pobox.com:/spare/repo/netdev-2.6/e1000
into pobox.com:/spare/repo/netdev-2.6/ALL
parents
edf609bc
fa88c854
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
369 additions
and
352 deletions
+369
-352
drivers/net/e1000/e1000.h
drivers/net/e1000/e1000.h
+13
-11
drivers/net/e1000/e1000_ethtool.c
drivers/net/e1000/e1000_ethtool.c
+81
-65
drivers/net/e1000/e1000_hw.c
drivers/net/e1000/e1000_hw.c
+4
-12
drivers/net/e1000/e1000_hw.h
drivers/net/e1000/e1000_hw.h
+1
-2
drivers/net/e1000/e1000_main.c
drivers/net/e1000/e1000_main.c
+246
-240
drivers/net/e1000/e1000_param.c
drivers/net/e1000/e1000_param.c
+24
-22
No files found.
drivers/net/e1000/e1000.h
View file @
b1106618
...
...
@@ -49,6 +49,7 @@
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/interrupt.h>
#include <linux/string.h>
#include <linux/pagemap.h>
...
...
@@ -63,6 +64,7 @@
#include <linux/udp.h>
#include <net/pkt_sched.h>
#include <linux/list.h>
#include <linux/rtnetlink.h>
#include <linux/reboot.h>
#ifdef NETIF_F_TSO
#include <net/checksum.h>
...
...
@@ -77,6 +79,8 @@
#define BAR_1 1
#define BAR_5 5
#define INTEL_E1000_ETHERNET_DEVICE(device_id) {\
PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
struct
e1000_adapter
;
...
...
@@ -98,11 +102,12 @@ struct e1000_adapter;
#define E1000_MAX_INTR 10
/*
How many descriptors for TX and RX ?
*/
/*
TX/RX descriptor defines
*/
#define E1000_DEFAULT_TXD 256
#define E1000_MAX_TXD 256
#define E1000_MIN_TXD 80
#define E1000_MAX_82544_TXD 4096
#define E1000_DEFAULT_RXD 256
#define E1000_MAX_RXD 256
#define E1000_MIN_RXD 80
...
...
@@ -123,14 +128,11 @@ struct e1000_adapter;
#define E1000_TX_HEAD_ADDR_SHIFT 7
#define E1000_PBA_TX_MASK 0xFFFF0000
/* Flow Control High-Watermark: 5688 bytes below Rx FIFO size */
#define E1000_FC_HIGH_DIFF 0x1638
/* Flow Control Low-Watermark: 5696 bytes below Rx FIFO size */
#define E1000_FC_LOW_DIFF 0x1640
/* Flow Control Watermarks */
#define E1000_FC_HIGH_DIFF 0x1638
/* High: 5688 bytes below Rx FIFO size */
#define E1000_FC_LOW_DIFF 0x1640
/* Low: 5696 bytes below Rx FIFO size */
/* Flow Control Pause Time: 858 usec */
#define E1000_FC_PAUSE_TIME 0x0680
#define E1000_FC_PAUSE_TIME 0x0680
/* 858 usec */
/* How many Tx Descriptors do we need to call netif_wake_queue ? */
#define E1000_TX_QUEUE_WAKE 16
...
...
@@ -153,9 +155,9 @@ struct e1000_adapter;
struct
e1000_buffer
{
struct
sk_buff
*
skb
;
uint64_t
dma
;
unsigned
long
length
;
unsigned
long
time_stamp
;
unsigned
int
next_to_watch
;
uint16_t
length
;
uint16_t
next_to_watch
;
};
struct
e1000_desc_ring
{
...
...
@@ -202,7 +204,7 @@ struct e1000_adapter {
spinlock_t
stats_lock
;
atomic_t
irq_sem
;
struct
work_struct
tx_timeout_task
;
uint8_t
fc_autoneg
;
uint8_t
fc_autoneg
;
struct
timer_list
blink_timer
;
unsigned
long
led_status
;
...
...
drivers/net/e1000/e1000_ethtool.c
View file @
b1106618
...
...
@@ -88,9 +88,9 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
{
"rx_flow_control_xoff"
,
E1000_STAT
(
stats
.
xoffrxc
)
},
{
"tx_flow_control_xon"
,
E1000_STAT
(
stats
.
xontxc
)
},
{
"tx_flow_control_xoff"
,
E1000_STAT
(
stats
.
xofftxc
)
},
{
"rx_long_byte_count"
,
E1000_STAT
(
stats
.
gorcl
)
},
{
"rx_csum_offload_good"
,
E1000_STAT
(
hw_csum_good
)
},
{
"rx_csum_offload_errors"
,
E1000_STAT
(
hw_csum_err
)
},
{
"rx_long_byte_count"
,
E1000_STAT
(
stats
.
gorcl
)
}
{
"rx_csum_offload_errors"
,
E1000_STAT
(
hw_csum_err
)
}
};
#define E1000_STATS_LEN \
sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats)
...
...
@@ -170,7 +170,8 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ecmd
->
duplex
=
-
1
;
}
ecmd
->
autoneg
=
(
hw
->
autoneg
?
AUTONEG_ENABLE
:
AUTONEG_DISABLE
);
ecmd
->
autoneg
=
((
hw
->
media_type
==
e1000_media_type_fiber
)
||
hw
->
autoneg
)
?
AUTONEG_ENABLE
:
AUTONEG_DISABLE
;
return
0
;
}
...
...
@@ -192,6 +193,7 @@ e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
if
(
netif_running
(
adapter
->
netdev
))
{
e1000_down
(
adapter
);
e1000_reset
(
adapter
);
e1000_up
(
adapter
);
}
else
e1000_reset
(
adapter
);
...
...
@@ -199,12 +201,13 @@ e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
return
0
;
}
static
void
static
void
e1000_get_pauseparam
(
struct
net_device
*
netdev
,
struct
ethtool_pauseparam
*
pause
)
struct
ethtool_pauseparam
*
pause
)
{
struct
e1000_adapter
*
adapter
=
netdev
->
priv
;
struct
e1000_hw
*
hw
=
&
adapter
->
hw
;
pause
->
autoneg
=
(
adapter
->
fc_autoneg
?
AUTONEG_ENABLE
:
AUTONEG_DISABLE
);
...
...
@@ -218,9 +221,9 @@ e1000_get_pauseparam(struct net_device *netdev,
}
}
static
int
static
int
e1000_set_pauseparam
(
struct
net_device
*
netdev
,
struct
ethtool_pauseparam
*
pause
)
struct
ethtool_pauseparam
*
pause
)
{
struct
e1000_adapter
*
adapter
=
netdev
->
priv
;
struct
e1000_hw
*
hw
=
&
adapter
->
hw
;
...
...
@@ -271,7 +274,7 @@ e1000_set_rx_csum(struct net_device *netdev, uint32_t data)
e1000_reset
(
adapter
);
return
0
;
}
static
uint32_t
e1000_get_tx_csum
(
struct
net_device
*
netdev
)
{
...
...
@@ -337,7 +340,7 @@ e1000_get_regs_len(struct net_device *netdev)
static
void
e1000_get_regs
(
struct
net_device
*
netdev
,
struct
ethtool_regs
*
regs
,
void
*
p
)
struct
ethtool_regs
*
regs
,
void
*
p
)
{
struct
e1000_adapter
*
adapter
=
netdev
->
priv
;
struct
e1000_hw
*
hw
=
&
adapter
->
hw
;
...
...
@@ -418,6 +421,10 @@ e1000_get_regs(struct net_device *netdev,
e1000_read_phy_reg
(
hw
,
PHY_1000T_STATUS
,
&
phy_data
);
regs_buff
[
24
]
=
(
uint32_t
)
phy_data
;
/* phy local receiver status */
regs_buff
[
25
]
=
regs_buff
[
24
];
/* phy remote receiver status */
if
(
hw
->
mac_type
>=
e1000_82540
&&
hw
->
media_type
==
e1000_media_type_copper
)
{
regs_buff
[
26
]
=
E1000_READ_REG
(
hw
,
MANC
);
}
}
static
int
...
...
@@ -438,7 +445,7 @@ e1000_get_eeprom(struct net_device *netdev,
int
ret_val
=
0
;
uint16_t
i
;
if
(
eeprom
->
len
==
0
)
if
(
eeprom
->
len
==
0
)
return
-
EINVAL
;
eeprom
->
magic
=
hw
->
vendor_id
|
(
hw
->
device_id
<<
16
);
...
...
@@ -446,9 +453,9 @@ e1000_get_eeprom(struct net_device *netdev,
first_word
=
eeprom
->
offset
>>
1
;
last_word
=
(
eeprom
->
offset
+
eeprom
->
len
-
1
)
>>
1
;
eeprom_buff
=
kmalloc
(
sizeof
(
uint16_t
)
*
eeprom_buff
=
kmalloc
(
sizeof
(
uint16_t
)
*
(
last_word
-
first_word
+
1
),
GFP_KERNEL
);
if
(
!
eeprom_buff
)
if
(
!
eeprom_buff
)
return
-
ENOMEM
;
if
(
hw
->
eeprom
.
type
==
e1000_eeprom_spi
)
...
...
@@ -466,9 +473,8 @@ e1000_get_eeprom(struct net_device *netdev,
for
(
i
=
0
;
i
<
last_word
-
first_word
+
1
;
i
++
)
le16_to_cpus
(
&
eeprom_buff
[
i
]);
memcpy
(
bytes
,
(
uint8_t
*
)
eeprom_buff
+
(
eeprom
->
offset
%
2
),
eeprom
->
len
);
memcpy
(
bytes
,
(
uint8_t
*
)
eeprom_buff
+
(
eeprom
->
offset
&
1
),
eeprom
->
len
);
kfree
(
eeprom_buff
);
return
ret_val
;
...
...
@@ -520,6 +526,7 @@ e1000_set_eeprom(struct net_device *netdev,
le16_to_cpus
(
&
eeprom_buff
[
i
]);
memcpy
(
ptr
,
bytes
,
eeprom
->
len
);
for
(
i
=
0
;
i
<
last_word
-
first_word
+
1
;
i
++
)
eeprom_buff
[
i
]
=
cpu_to_le16
(
eeprom_buff
[
i
]);
...
...
@@ -575,17 +582,16 @@ static int
e1000_set_ringparam
(
struct
net_device
*
netdev
,
struct
ethtool_ringparam
*
ring
)
{
int
err
;
struct
e1000_adapter
*
adapter
=
netdev
->
priv
;
e1000_mac_type
mac_type
=
adapter
->
hw
.
mac_type
;
struct
e1000_desc_ring
*
txdr
=
&
adapter
->
tx_ring
;
struct
e1000_desc_ring
*
rxdr
=
&
adapter
->
rx_ring
;
struct
e1000_desc_ring
tx_old
,
tx_new
;
struct
e1000_desc_ring
rx_old
,
rx_new
;
struct
e1000_desc_ring
tx_old
,
tx_new
,
rx_old
,
rx_new
;
int
err
;
tx_old
=
adapter
->
tx_ring
;
rx_old
=
adapter
->
rx_ring
;
if
(
netif_running
(
adapter
->
netdev
))
e1000_down
(
adapter
);
...
...
@@ -600,15 +606,15 @@ e1000_set_ringparam(struct net_device *netdev,
E1000_ROUNDUP
(
txdr
->
count
,
REQ_TX_DESCRIPTOR_MULTIPLE
);
if
(
netif_running
(
adapter
->
netdev
))
{
/*
t
ry to get new resources before deleting old */
/*
T
ry to get new resources before deleting old */
if
((
err
=
e1000_setup_rx_resources
(
adapter
)))
goto
err_setup_rx
;
if
((
err
=
e1000_setup_tx_resources
(
adapter
)))
goto
err_setup_tx
;
/* save the new, restore the old in order to free it,
* then restore the new back again */
* then restore the new back again */
rx_new
=
adapter
->
rx_ring
;
tx_new
=
adapter
->
tx_ring
;
adapter
->
rx_ring
=
rx_old
;
...
...
@@ -620,6 +626,7 @@ e1000_set_ringparam(struct net_device *netdev,
if
((
err
=
e1000_up
(
adapter
)))
return
err
;
}
return
0
;
err_setup_tx:
e1000_free_rx_resources
(
adapter
);
...
...
@@ -766,13 +773,15 @@ static int
e1000_intr_test
(
struct
e1000_adapter
*
adapter
,
uint64_t
*
data
)
{
struct
net_device
*
netdev
=
adapter
->
netdev
;
uint32_t
icr
,
mask
,
i
=
0
;
uint32_t
icr
,
mask
,
i
=
0
,
shared_int
=
TRUE
;
uint32_t
irq
=
adapter
->
pdev
->
irq
;
*
data
=
0
;
/* Hook up test interrupt handler just for this test */
if
(
request_irq
(
adapter
->
pdev
->
irq
,
&
e1000_test_intr
,
SA_SHIRQ
,
netdev
->
name
,
netdev
))
{
if
(
!
request_irq
(
irq
,
&
e1000_test_intr
,
0
,
netdev
->
name
,
netdev
))
{
shared_int
=
FALSE
;
}
else
if
(
request_irq
(
irq
,
&
e1000_test_intr
,
SA_SHIRQ
,
netdev
->
name
,
netdev
)){
*
data
=
1
;
return
-
1
;
}
...
...
@@ -802,20 +811,22 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
/* Interrupt to test */
mask
=
1
<<
i
;
/* Disable the interrupt to be reported in
* the cause register and then force the same
* interrupt and see if one gets posted. If
* an interrupt was posted to the bus, the
* test failed.
*/
adapter
->
test_icr
=
0
;
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMC
,
mask
);
E1000_WRITE_REG
(
&
adapter
->
hw
,
ICS
,
mask
);
msec_delay
(
10
);
if
(
adapter
->
test_icr
&
mask
)
{
*
data
=
3
;
break
;
if
(
!
shared_int
)
{
/* Disable the interrupt to be reported in
* the cause register and then force the same
* interrupt and see if one gets posted. If
* an interrupt was posted to the bus, the
* test failed.
*/
adapter
->
test_icr
=
0
;
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMC
,
mask
);
E1000_WRITE_REG
(
&
adapter
->
hw
,
ICS
,
mask
);
msec_delay
(
10
);
if
(
adapter
->
test_icr
&
mask
)
{
*
data
=
3
;
break
;
}
}
/* Enable the interrupt to be reported in
...
...
@@ -834,20 +845,22 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
break
;
}
/* Disable the other interrupts to be reported in
* the cause register and then force the other
* interrupts and see if any get posted. If
* an interrupt was posted to the bus, the
* test failed.
*/
adapter
->
test_icr
=
0
;
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMC
,
~
mask
);
E1000_WRITE_REG
(
&
adapter
->
hw
,
ICS
,
~
mask
);
msec_delay
(
10
);
if
(
!
shared_int
)
{
/* Disable the other interrupts to be reported in
* the cause register and then force the other
* interrupts and see if any get posted. If
* an interrupt was posted to the bus, the
* test failed.
*/
adapter
->
test_icr
=
0
;
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMC
,
~
mask
);
E1000_WRITE_REG
(
&
adapter
->
hw
,
ICS
,
~
mask
);
msec_delay
(
10
);
if
(
adapter
->
test_icr
)
{
*
data
=
5
;
break
;
if
(
adapter
->
test_icr
)
{
*
data
=
5
;
break
;
}
}
}
...
...
@@ -856,7 +869,7 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
msec_delay
(
10
);
/* Unhook test interrupt handler */
free_irq
(
adapter
->
pdev
->
irq
,
netdev
);
free_irq
(
irq
,
netdev
);
return
*
data
;
}
...
...
@@ -1021,7 +1034,7 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
return
0
;
err_nomem:
err_nomem:
e1000_free_desc_rings
(
adapter
);
return
ret_val
;
}
...
...
@@ -1312,15 +1325,15 @@ e1000_run_loopback_test(struct e1000_adapter *adapter)
for
(
i
=
0
;
i
<
64
;
i
++
)
{
e1000_create_lbtest_frame
(
txdr
->
buffer_info
[
i
].
skb
,
1024
);
pci_dma_sync_single
(
pdev
,
txdr
->
buffer_info
[
i
].
dma
,
txdr
->
buffer_info
[
i
].
length
,
PCI_DMA_TODEVICE
);
pci_dma_sync_single
_for_device
(
pdev
,
txdr
->
buffer_info
[
i
].
dma
,
txdr
->
buffer_info
[
i
].
length
,
PCI_DMA_TODEVICE
);
}
E1000_WRITE_REG
(
&
adapter
->
hw
,
TDT
,
i
);
msec_delay
(
200
);
pci_dma_sync_single
(
pdev
,
rxdr
->
buffer_info
[
0
].
dma
,
pci_dma_sync_single
_for_cpu
(
pdev
,
rxdr
->
buffer_info
[
0
].
dma
,
rxdr
->
buffer_info
[
0
].
length
,
PCI_DMA_FROMDEVICE
);
return
e1000_check_lbtest_frame
(
rxdr
->
buffer_info
[
0
].
skb
,
1024
);
...
...
@@ -1357,7 +1370,7 @@ e1000_diag_test_count(struct net_device *netdev)
}
static
void
e1000_diag_test
(
struct
net_device
*
netdev
,
e1000_diag_test
(
struct
net_device
*
netdev
,
struct
ethtool_test
*
eth_test
,
uint64_t
*
data
)
{
struct
e1000_adapter
*
adapter
=
netdev
->
priv
;
...
...
@@ -1368,7 +1381,7 @@ e1000_diag_test(struct net_device *netdev,
/* save speed, duplex, autoneg settings */
uint16_t
autoneg_advertised
=
adapter
->
hw
.
autoneg_advertised
;
uint8_t
forced_speed_duplex
=
adapter
->
hw
.
forced_speed_duplex
;
uint8_t
forced_speed_duplex
=
adapter
->
hw
.
forced_speed_duplex
;
uint8_t
autoneg
=
adapter
->
hw
.
autoneg
;
/* Link test performed before hardware reset so autoneg doesn't
...
...
@@ -1396,10 +1409,11 @@ e1000_diag_test(struct net_device *netdev,
if
(
e1000_loopback_test
(
adapter
,
&
data
[
3
]))
eth_test
->
flags
|=
ETH_TEST_FL_FAILED
;
/* restore
Autoneg/speed/duplex
settings */
/* restore
speed, duplex, autoneg
settings */
adapter
->
hw
.
autoneg_advertised
=
autoneg_advertised
;
adapter
->
hw
.
forced_speed_duplex
=
forced_speed_duplex
;
adapter
->
hw
.
autoneg
=
autoneg
;
adapter
->
hw
.
forced_speed_duplex
=
forced_speed_duplex
;
adapter
->
hw
.
autoneg
=
autoneg
;
e1000_reset
(
adapter
);
if
(
if_running
)
e1000_up
(
adapter
);
...
...
@@ -1427,6 +1441,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
case
E1000_DEV_ID_82543GC_FIBER
:
case
E1000_DEV_ID_82543GC_COPPER
:
case
E1000_DEV_ID_82544EI_FIBER
:
case
E1000_DEV_ID_82546EB_QUAD_COPPER
:
wol
->
supported
=
0
;
wol
->
wolopts
=
0
;
return
;
...
...
@@ -1469,6 +1484,7 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
case
E1000_DEV_ID_82543GC_FIBER
:
case
E1000_DEV_ID_82543GC_COPPER
:
case
E1000_DEV_ID_82544EI_FIBER
:
case
E1000_DEV_ID_82546EB_QUAD_COPPER
:
return
wol
->
wolopts
?
-
EOPNOTSUPP
:
0
;
case
E1000_DEV_ID_82546EB_FIBER
:
...
...
@@ -1571,8 +1587,8 @@ e1000_get_ethtool_stats(struct net_device *netdev,
e1000_update_stats
(
adapter
);
for
(
i
=
0
;
i
<
E1000_STATS_LEN
;
i
++
)
{
char
*
p
=
(
char
*
)
adapter
+
e1000_gstrings_stats
[
i
].
stat_offset
;
data
[
i
]
=
(
e1000_gstrings_stats
[
i
].
sizeof_stat
==
sizeof
(
uint64_t
))
?
*
(
uint64_t
*
)
p
:
*
(
uint32_t
*
)
p
;
data
[
i
]
=
(
e1000_gstrings_stats
[
i
].
sizeof_stat
==
sizeof
(
uint64_t
))
?
*
(
uint64_t
*
)
p
:
*
(
uint32_t
*
)
p
;
}
}
...
...
drivers/net/e1000/e1000_hw.c
View file @
b1106618
...
...
@@ -251,6 +251,7 @@ e1000_set_mac_type(struct e1000_hw *hw)
break
;
case
E1000_DEV_ID_82541ER
:
case
E1000_DEV_ID_82541GI
:
case
E1000_DEV_ID_82541GI_LF
:
case
E1000_DEV_ID_82541GI_MOBILE
:
hw
->
mac_type
=
e1000_82541_rev_2
;
break
;
...
...
@@ -920,7 +921,8 @@ e1000_setup_copper_link(struct e1000_hw *hw)
if
(
ret_val
)
return
ret_val
;
if
(
hw
->
mac_type
==
e1000_82545_rev_3
)
{
if
((
hw
->
mac_type
==
e1000_82545_rev_3
)
||
(
hw
->
mac_type
==
e1000_82546_rev_3
))
{
ret_val
=
e1000_read_phy_reg
(
hw
,
M88E1000_PHY_SPEC_CTRL
,
&
phy_data
);
phy_data
|=
0x00000008
;
ret_val
=
e1000_write_phy_reg
(
hw
,
M88E1000_PHY_SPEC_CTRL
,
phy_data
);
...
...
@@ -3057,16 +3059,6 @@ e1000_init_eeprom_params(struct e1000_hw *hw)
}
break
;
default:
eeprom
->
type
=
e1000_eeprom_spi
;
eeprom
->
opcode_bits
=
8
;
eeprom
->
delay_usec
=
1
;
if
(
eecd
&
E1000_EECD_ADDR_BITS
)
{
eeprom
->
page_size
=
32
;
eeprom
->
address_bits
=
16
;
}
else
{
eeprom
->
page_size
=
8
;
eeprom
->
address_bits
=
8
;
}
break
;
}
...
...
@@ -3453,7 +3445,6 @@ e1000_read_eeprom(struct e1000_hw *hw,
uint32_t
i
=
0
;
DEBUGFUNC
(
"e1000_read_eeprom"
);
/* A check for invalid values: offset too large, too many words, and not
* enough words.
*/
...
...
@@ -5224,3 +5215,4 @@ e1000_enable_mng_pass_thru(struct e1000_hw *hw)
}
return
FALSE
;
}
drivers/net/e1000/e1000_hw.h
View file @
b1106618
...
...
@@ -357,11 +357,11 @@ int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active);
#define E1000_DEV_ID_82547GI 0x1075
#define E1000_DEV_ID_82541GI 0x1076
#define E1000_DEV_ID_82541GI_MOBILE 0x1077
#define E1000_DEV_ID_82541GI_LF 0x107C
#define E1000_DEV_ID_82546GB_COPPER 0x1079
#define E1000_DEV_ID_82546GB_FIBER 0x107A
#define E1000_DEV_ID_82546GB_SERDES 0x107B
#define E1000_DEV_ID_82547EI 0x1019
#define NODE_ADDRESS_SIZE 6
#define ETH_LENGTH_OF_ADDRESS 6
...
...
@@ -1043,7 +1043,6 @@ struct e1000_hw {
#define E1000_EEPROM_SWDPIN0 0x0001
/* SWDPIN 0 EEPROM Value */
#define E1000_EEPROM_LED_LOGIC 0x0020
/* Led Logic Word */
/* Register Bit Masks */
/* Device Control */
#define E1000_CTRL_FD 0x00000001
/* Full duplex.0=half; 1=full */
...
...
drivers/net/e1000/e1000_main.c
View file @
b1106618
...
...
@@ -27,73 +27,69 @@
*******************************************************************************/
#include "e1000.h"
#include <linux/rtnetlink.h>
/* Change Log
* 5.3.12 6/7/04
* - kcompat NETIF_MSG for older kernels (2.4.9) <sean.p.mcdermott@intel.com>
* - if_mii support and associated kcompat for older kernels
* - More errlogging support from Jon Mason <jonmason@us.ibm.com>
* - Fix TSO issues on PPC64 machines -- Jon Mason <jonmason@us.ibm.com>
*
* 5.2.51 5/14/04
* o set default configuration to 'NAPI disabled'. NAPI enabled driver
* causes kernel panic when the interface is shutdown while data is being
* transferred.
* 5.2.47 5/04/04
* o fixed ethtool -t implementation
* 5.2.45 4/29/04
* o fixed ethtool -e implementation
* o Support for ethtool ops [Stephen Hemminger (shemminger@osdl.org)]
* 5.2.42 4/26/04
* o Added support for the DPRINTK macro for enhanced error logging. Some
* parts of the patch were supplied by Jon Mason.
* o Move the register_netdevice() donw in the probe routine due to a
* loading/unloading test issue.
* o Added a long RX byte count the the extra ethtool data members for BER
* testing purposes.
* 5.2.39 3/12/04
* 5.3.11 6/4/04
* - ethtool register dump reads MANC register conditionally.
*
* 5.3.10 6/1/04
*/
char
e1000_driver_name
[]
=
"e1000"
;
char
e1000_driver_string
[]
=
"Intel(R) PRO/1000 Network Driver"
;
char
e1000_driver_version
[]
=
"5.2.52-k4"
;
#ifndef CONFIG_E1000_NAPI
#define DRIVERNAPI
#else
#define DRIVERNAPI "-NAPI"
#endif
char
e1000_driver_version
[]
=
"5.3.19-k2"
DRIVERNAPI
;
char
e1000_copyright
[]
=
"Copyright (c) 1999-2004 Intel Corporation."
;
/* e1000_pci_tbl - PCI Device ID Table
*
* Wildcard entries (PCI_ANY_ID) should come last
* Last entry must be all 0s
*
*
{ Vendor ID, Device ID, SubVendor ID, SubDevice ID,
*
Class, Class Mask, private data (not used)
}
*
Macro expands to...
*
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)
}
*/
static
struct
pci_device_id
e1000_pci_tbl
[]
=
{
{
0x8086
,
0x1000
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1001
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1004
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1008
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1009
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x100C
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x100D
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x100E
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x100F
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1010
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1011
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1012
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1013
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1015
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1016
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1017
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1018
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1019
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x101D
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x101E
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1026
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1027
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1028
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1075
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1076
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1077
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1078
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x1079
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x107A
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0x8086
,
0x107B
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
INTEL_E1000_ETHERNET_DEVICE
(
0x1000
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1001
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1004
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1008
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1009
),
INTEL_E1000_ETHERNET_DEVICE
(
0x100C
),
INTEL_E1000_ETHERNET_DEVICE
(
0x100D
),
INTEL_E1000_ETHERNET_DEVICE
(
0x100E
),
INTEL_E1000_ETHERNET_DEVICE
(
0x100F
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1010
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1011
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1012
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1013
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1015
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1016
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1017
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1018
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1019
),
INTEL_E1000_ETHERNET_DEVICE
(
0x101D
),
INTEL_E1000_ETHERNET_DEVICE
(
0x101E
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1026
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1027
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1028
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1075
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1076
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1077
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1078
),
INTEL_E1000_ETHERNET_DEVICE
(
0x1079
),
INTEL_E1000_ETHERNET_DEVICE
(
0x107A
),
INTEL_E1000_ETHERNET_DEVICE
(
0x107B
),
INTEL_E1000_ETHERNET_DEVICE
(
0x107C
),
/* required last entry */
{
0
,}
};
...
...
@@ -172,7 +168,7 @@ static int e1000_resume(struct pci_dev *pdev);
#ifdef CONFIG_NET_POLL_CONTROLLER
/* for netdump / net console */
static
void
e1000_netpoll
(
struct
net_device
*
dev
);
static
void
e1000_netpoll
(
struct
net_device
*
net
dev
);
#endif
struct
notifier_block
e1000_notifier_reboot
=
{
...
...
@@ -185,7 +181,6 @@ struct notifier_block e1000_notifier_reboot = {
extern
void
e1000_check_options
(
struct
e1000_adapter
*
adapter
);
static
struct
pci_driver
e1000_driver
=
{
.
name
=
e1000_driver_name
,
.
id_table
=
e1000_pci_tbl
,
...
...
@@ -202,7 +197,7 @@ MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
MODULE_DESCRIPTION
(
"Intel(R) PRO/1000 Network Driver"
);
MODULE_LICENSE
(
"GPL"
);
static
int
debug
=
3
;
static
int
debug
=
NETIF_MSG_DRV
|
NETIF_MSG_PROBE
;
module_param
(
debug
,
int
,
0
);
MODULE_PARM_DESC
(
debug
,
"Debug level (0=none,...,16=all)"
);
...
...
@@ -256,6 +251,14 @@ e1000_up(struct e1000_adapter *adapter)
/* hardware has been reset, we need to reload some things */
/* Reset the PHY if it was previously powered down */
if
(
adapter
->
hw
.
media_type
==
e1000_media_type_copper
)
{
uint16_t
mii_reg
;
e1000_read_phy_reg
(
&
adapter
->
hw
,
PHY_CTRL
,
&
mii_reg
);
if
(
mii_reg
&
MII_CR_POWER_DOWN
)
e1000_phy_reset
(
&
adapter
->
hw
);
}
e1000_set_multi
(
netdev
);
e1000_restore_vlan
(
adapter
);
...
...
@@ -294,6 +297,15 @@ e1000_down(struct e1000_adapter *adapter)
e1000_reset
(
adapter
);
e1000_clean_tx_ring
(
adapter
);
e1000_clean_rx_ring
(
adapter
);
/* If WoL is not enabled
* Power down the PHY so no link is implied when interface is down */
if
(
!
adapter
->
wol
&&
adapter
->
hw
.
media_type
==
e1000_media_type_copper
)
{
uint16_t
mii_reg
;
e1000_read_phy_reg
(
&
adapter
->
hw
,
PHY_CTRL
,
&
mii_reg
);
mii_reg
|=
MII_CR_POWER_DOWN
;
e1000_write_phy_reg
(
&
adapter
->
hw
,
PHY_CTRL
,
mii_reg
);
}
}
void
...
...
@@ -323,10 +335,10 @@ e1000_reset(struct e1000_adapter *adapter)
E1000_WRITE_REG
(
&
adapter
->
hw
,
PBA
,
pba
);
/* flow control settings */
adapter
->
hw
.
fc_high_water
=
(
pba
<<
E1000_PBA_BYTES_SHIFT
)
-
E1000_FC_HIGH_DIFF
;
adapter
->
hw
.
fc_low_water
=
(
pba
<<
E1000_PBA_BYTES_SHIFT
)
-
E1000_FC_LOW_DIFF
;
adapter
->
hw
.
fc_high_water
=
(
pba
<<
E1000_PBA_BYTES_SHIFT
)
-
E1000_FC_HIGH_DIFF
;
adapter
->
hw
.
fc_low_water
=
(
pba
<<
E1000_PBA_BYTES_SHIFT
)
-
E1000_FC_LOW_DIFF
;
adapter
->
hw
.
fc_pause_time
=
E1000_FC_PAUSE_TIME
;
adapter
->
hw
.
fc_send_xon
=
1
;
adapter
->
hw
.
fc
=
adapter
->
hw
.
original_fc
;
...
...
@@ -334,7 +346,8 @@ e1000_reset(struct e1000_adapter *adapter)
e1000_reset_hw
(
&
adapter
->
hw
);
if
(
adapter
->
hw
.
mac_type
>=
e1000_82544
)
E1000_WRITE_REG
(
&
adapter
->
hw
,
WUC
,
0
);
e1000_init_hw
(
&
adapter
->
hw
);
if
(
e1000_init_hw
(
&
adapter
->
hw
))
DPRINTK
(
PROBE
,
ERR
,
"Hardware Error
\n
"
);
/* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
E1000_WRITE_REG
(
&
adapter
->
hw
,
VET
,
ETHERNET_IEEE_VLAN_TYPE
);
...
...
@@ -410,8 +423,8 @@ e1000_probe(struct pci_dev *pdev,
adapter
->
msg_enable
=
(
1
<<
debug
)
-
1
;
rtnl_lock
();
/* we need to set the name early
since the DPRINTK macro needs it set
*/
if
(
dev_alloc_name
(
netdev
,
netdev
->
name
)
<
0
)
/* we need to set the name early
for the DPRINTK macro
*/
if
(
dev_alloc_name
(
netdev
,
netdev
->
name
)
<
0
)
goto
err_free_unlock
;
mmio_start
=
pci_resource_start
(
pdev
,
BAR_0
);
...
...
@@ -476,7 +489,6 @@ e1000_probe(struct pci_dev *pdev,
}
#ifdef NETIF_F_TSO
#ifdef BROKEN_ON_NON_IA_ARCHS
/* Disbaled for now until root-cause is found for
* hangs reported against non-IA archs. TSO can be
* enabled using ethtool -K eth<x> tso on */
...
...
@@ -484,11 +496,10 @@ e1000_probe(struct pci_dev *pdev,
(
adapter
->
hw
.
mac_type
!=
e1000_82547
))
netdev
->
features
|=
NETIF_F_TSO
;
#endif
#endif
if
(
pci_using_dac
)
netdev
->
features
|=
NETIF_F_HIGHDMA
;
adapter
->
en_mng_pt
=
e1000_enable_mng_pass_thru
(
&
adapter
->
hw
);
/* before reading the EEPROM, reset the controller to
...
...
@@ -506,10 +517,12 @@ e1000_probe(struct pci_dev *pdev,
/* copy the MAC address out of the EEPROM */
e1000_read_mac_addr
(
&
adapter
->
hw
);
if
(
e1000_read_mac_addr
(
&
adapter
->
hw
))
DPRINTK
(
PROBE
,
ERR
,
"EEPROM Read Error
\n
"
);
memcpy
(
netdev
->
dev_addr
,
adapter
->
hw
.
mac_addr
,
netdev
->
addr_len
);
if
(
!
is_valid_ether_addr
(
netdev
->
dev_addr
))
{
DPRINTK
(
PROBE
,
ERR
,
"Invalid MAC Address
\n
"
);
err
=
-
EIO
;
goto
err_eeprom
;
}
...
...
@@ -569,10 +582,9 @@ e1000_probe(struct pci_dev *pdev,
adapter
->
wol
|=
E1000_WUFC_MAG
;
/* reset the hardware with the new settings */
e1000_reset
(
adapter
);
/*
since we are holding the rtnl lock already,
call the no-lock version */
/*
We're already holding the rtnl lock;
call the no-lock version */
if
((
err
=
register_netdevice
(
netdev
)))
goto
err_register
;
...
...
@@ -663,7 +675,7 @@ e1000_sw_init(struct e1000_adapter *adapter)
/* identify the MAC */
if
(
e1000_set_mac_type
(
hw
))
{
if
(
e1000_set_mac_type
(
hw
))
{
DPRINTK
(
PROBE
,
ERR
,
"Unknown MAC Type
\n
"
);
return
-
EIO
;
}
...
...
@@ -672,19 +684,19 @@ e1000_sw_init(struct e1000_adapter *adapter)
e1000_init_eeprom_params
(
hw
);
if
((
hw
->
mac_type
==
e1000_82541
)
||
(
hw
->
mac_type
==
e1000_82547
)
||
(
hw
->
mac_type
==
e1000_82541_rev_2
)
||
(
hw
->
mac_type
==
e1000_82547_rev_2
))
switch
(
hw
->
mac_type
)
{
default:
break
;
case
e1000_82541
:
case
e1000_82547
:
case
e1000_82541_rev_2
:
case
e1000_82547_rev_2
:
hw
->
phy_init_script
=
1
;
break
;
}
e1000_set_media_type
(
hw
);
if
(
hw
->
mac_type
<
e1000_82543
)
hw
->
report_tx_early
=
0
;
else
hw
->
report_tx_early
=
1
;
hw
->
wait_autoneg_complete
=
FALSE
;
hw
->
tbi_compatibility_en
=
TRUE
;
hw
->
adaptive_ifs
=
TRUE
;
...
...
@@ -736,7 +748,7 @@ e1000_open(struct net_device *netdev)
if
((
err
=
e1000_up
(
adapter
)))
goto
err_up
;
return
0
;
return
E1000_SUCCESS
;
err_up:
e1000_free_rx_resources
(
adapter
);
...
...
@@ -788,8 +800,10 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter)
int
size
;
size
=
sizeof
(
struct
e1000_buffer
)
*
txdr
->
count
;
txdr
->
buffer_info
=
kmalloc
(
size
,
GFP_KERNEL
);
txdr
->
buffer_info
=
vmalloc
(
size
);
if
(
!
txdr
->
buffer_info
)
{
DPRINTK
(
PROBE
,
ERR
,
"Unble to Allocate Memory for the Transmit descriptor ring
\n
"
);
return
-
ENOMEM
;
}
memset
(
txdr
->
buffer_info
,
0
,
size
);
...
...
@@ -801,7 +815,9 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter)
txdr
->
desc
=
pci_alloc_consistent
(
pdev
,
txdr
->
size
,
&
txdr
->
dma
);
if
(
!
txdr
->
desc
)
{
kfree
(
txdr
->
buffer_info
);
DPRINTK
(
PROBE
,
ERR
,
"Unble to Allocate Memory for the Transmit descriptor ring
\n
"
);
vfree
(
txdr
->
buffer_info
);
return
-
ENOMEM
;
}
memset
(
txdr
->
desc
,
0
,
txdr
->
size
);
...
...
@@ -878,10 +894,10 @@ e1000_configure_tx(struct e1000_adapter *adapter)
adapter
->
txd_cmd
=
E1000_TXD_CMD_IDE
|
E1000_TXD_CMD_EOP
|
E1000_TXD_CMD_IFCS
;
if
(
adapter
->
hw
.
report_tx_early
==
1
)
adapter
->
txd_cmd
|=
E1000_TXD_CMD_RS
;
else
if
(
adapter
->
hw
.
mac_type
<
e1000_82543
)
adapter
->
txd_cmd
|=
E1000_TXD_CMD_RPS
;
else
adapter
->
txd_cmd
|=
E1000_TXD_CMD_RS
;
/* Cache if we're 82544 running in PCI-X because we'll
* need this to apply a workaround later in the send path. */
...
...
@@ -905,8 +921,10 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter)
int
size
;
size
=
sizeof
(
struct
e1000_buffer
)
*
rxdr
->
count
;
rxdr
->
buffer_info
=
kmalloc
(
size
,
GFP_KERNEL
);
rxdr
->
buffer_info
=
vmalloc
(
size
);
if
(
!
rxdr
->
buffer_info
)
{
DPRINTK
(
PROBE
,
ERR
,
"Unble to Allocate Memory for the Recieve descriptor ring
\n
"
);
return
-
ENOMEM
;
}
memset
(
rxdr
->
buffer_info
,
0
,
size
);
...
...
@@ -919,7 +937,9 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter)
rxdr
->
desc
=
pci_alloc_consistent
(
pdev
,
rxdr
->
size
,
&
rxdr
->
dma
);
if
(
!
rxdr
->
desc
)
{
kfree
(
rxdr
->
buffer_info
);
DPRINTK
(
PROBE
,
ERR
,
"Unble to Allocate Memory for the Recieve descriptor ring
\n
"
);
vfree
(
rxdr
->
buffer_info
);
return
-
ENOMEM
;
}
memset
(
rxdr
->
desc
,
0
,
rxdr
->
size
);
...
...
@@ -953,7 +973,9 @@ e1000_setup_rctl(struct e1000_adapter *adapter)
else
rctl
&=
~
E1000_RCTL_SBP
;
/* Setup buffer sizes */
rctl
&=
~
(
E1000_RCTL_SZ_4096
);
rctl
|=
(
E1000_RCTL_BSEX
|
E1000_RCTL_LPE
);
switch
(
adapter
->
rx_buffer_len
)
{
case
E1000_RXBUFFER_2048
:
default:
...
...
@@ -961,13 +983,13 @@ e1000_setup_rctl(struct e1000_adapter *adapter)
rctl
&=
~
(
E1000_RCTL_BSEX
|
E1000_RCTL_LPE
);
break
;
case
E1000_RXBUFFER_4096
:
rctl
|=
E1000_RCTL_SZ_4096
|
E1000_RCTL_BSEX
|
E1000_RCTL_LPE
;
rctl
|=
E1000_RCTL_SZ_4096
;
break
;
case
E1000_RXBUFFER_8192
:
rctl
|=
E1000_RCTL_SZ_8192
|
E1000_RCTL_BSEX
|
E1000_RCTL_LPE
;
rctl
|=
E1000_RCTL_SZ_8192
;
break
;
case
E1000_RXBUFFER_16384
:
rctl
|=
E1000_RCTL_SZ_16384
|
E1000_RCTL_BSEX
|
E1000_RCTL_LPE
;
rctl
|=
E1000_RCTL_SZ_16384
;
break
;
}
...
...
@@ -989,13 +1011,11 @@ e1000_configure_rx(struct e1000_adapter *adapter)
uint32_t
rctl
;
uint32_t
rxcsum
;
/* make sure receives are disabled while setting up the descriptors */
/* disable receives while setting up the descriptors */
rctl
=
E1000_READ_REG
(
&
adapter
->
hw
,
RCTL
);
E1000_WRITE_REG
(
&
adapter
->
hw
,
RCTL
,
rctl
&
~
E1000_RCTL_EN
);
/* set the Receive Delay Timer Register */
E1000_WRITE_REG
(
&
adapter
->
hw
,
RDTR
,
adapter
->
rx_int_delay
);
if
(
adapter
->
hw
.
mac_type
>=
e1000_82540
)
{
...
...
@@ -1006,7 +1026,6 @@ e1000_configure_rx(struct e1000_adapter *adapter)
}
/* Setup the Base and Length of the Rx Descriptor Ring */
E1000_WRITE_REG
(
&
adapter
->
hw
,
RDBAL
,
(
rdba
&
0x00000000ffffffffULL
));
E1000_WRITE_REG
(
&
adapter
->
hw
,
RDBAH
,
(
rdba
>>
32
));
...
...
@@ -1025,7 +1044,6 @@ e1000_configure_rx(struct e1000_adapter *adapter)
}
/* Enable Receives */
E1000_WRITE_REG
(
&
adapter
->
hw
,
RCTL
,
rctl
);
}
...
...
@@ -1043,7 +1061,7 @@ e1000_free_tx_resources(struct e1000_adapter *adapter)
e1000_clean_tx_ring
(
adapter
);
k
free
(
adapter
->
tx_ring
.
buffer_info
);
v
free
(
adapter
->
tx_ring
.
buffer_info
);
adapter
->
tx_ring
.
buffer_info
=
NULL
;
pci_free_consistent
(
pdev
,
adapter
->
tx_ring
.
size
,
...
...
@@ -1073,9 +1091,9 @@ e1000_clean_tx_ring(struct e1000_adapter *adapter)
if
(
buffer_info
->
skb
)
{
pci_unmap_page
(
pdev
,
buffer_info
->
dma
,
buffer_info
->
length
,
PCI_DMA_TODEVICE
);
buffer_info
->
dma
,
buffer_info
->
length
,
PCI_DMA_TODEVICE
);
dev_kfree_skb
(
buffer_info
->
skb
);
...
...
@@ -1112,7 +1130,7 @@ e1000_free_rx_resources(struct e1000_adapter *adapter)
e1000_clean_rx_ring
(
adapter
);
k
free
(
rx_ring
->
buffer_info
);
v
free
(
rx_ring
->
buffer_info
);
rx_ring
->
buffer_info
=
NULL
;
pci_free_consistent
(
pdev
,
rx_ring
->
size
,
rx_ring
->
desc
,
rx_ring
->
dma
);
...
...
@@ -1141,12 +1159,11 @@ e1000_clean_rx_ring(struct e1000_adapter *adapter)
if
(
buffer_info
->
skb
)
{
pci_unmap_single
(
pdev
,
buffer_info
->
dma
,
buffer_info
->
length
,
PCI_DMA_FROMDEVICE
);
buffer_info
->
dma
,
buffer_info
->
length
,
PCI_DMA_FROMDEVICE
);
dev_kfree_skb
(
buffer_info
->
skb
);
buffer_info
->
skb
=
NULL
;
}
}
...
...
@@ -1312,7 +1329,8 @@ e1000_set_multi(struct net_device *netdev)
e1000_leave_82542_rst
(
adapter
);
}
/* need to wait a few seconds after link up to get diagnostic information from the phy */
/* Need to wait a few seconds after link up to get diagnostic information from
* the phy */
static
void
e1000_update_phy_info
(
unsigned
long
data
)
...
...
@@ -1420,7 +1438,7 @@ e1000_watchdog(unsigned long data)
adapter
->
tpt_old
=
adapter
->
stats
.
tpt
;
adapter
->
hw
.
collision_delta
=
adapter
->
stats
.
colc
-
adapter
->
colc_old
;
adapter
->
colc_old
=
adapter
->
stats
.
colc
;
adapter
->
gorcl
=
adapter
->
stats
.
gorcl
-
adapter
->
gorcl_old
;
adapter
->
gorcl_old
=
adapter
->
stats
.
gorcl
;
adapter
->
gotcl
=
adapter
->
stats
.
gotcl
-
adapter
->
gotcl_old
;
...
...
@@ -1477,8 +1495,9 @@ e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb)
#ifdef NETIF_F_TSO
struct
e1000_context_desc
*
context_desc
;
unsigned
int
i
;
uint
8_t
ipcss
,
ipcso
,
tucss
,
tucso
,
hdr_len
;
uint
32_t
cmd_length
=
0
;
uint16_t
ipcse
,
tucse
,
mss
;
uint8_t
ipcss
,
ipcso
,
tucss
,
tucso
,
hdr_len
;
if
(
skb_shinfo
(
skb
)
->
tso_size
)
{
hdr_len
=
((
skb
->
h
.
raw
-
skb
->
data
)
+
(
skb
->
h
.
th
->
doff
<<
2
));
...
...
@@ -1497,6 +1516,10 @@ e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb)
tucso
=
(
void
*
)
&
(
skb
->
h
.
th
->
check
)
-
(
void
*
)
skb
->
data
;
tucse
=
0
;
cmd_length
|=
(
E1000_TXD_CMD_DEXT
|
E1000_TXD_CMD_TSE
|
E1000_TXD_CMD_IP
|
E1000_TXD_CMD_TCP
|
(
skb
->
len
-
(
hdr_len
)));
i
=
adapter
->
tx_ring
.
next_to_use
;
context_desc
=
E1000_CONTEXT_DESC
(
adapter
->
tx_ring
,
i
);
...
...
@@ -1508,10 +1531,7 @@ e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb)
context_desc
->
upper_setup
.
tcp_fields
.
tucse
=
cpu_to_le16
(
tucse
);
context_desc
->
tcp_seg_setup
.
fields
.
mss
=
cpu_to_le16
(
mss
);
context_desc
->
tcp_seg_setup
.
fields
.
hdr_len
=
hdr_len
;
context_desc
->
cmd_and_length
=
cpu_to_le32
(
E1000_TXD_CMD_DEXT
|
E1000_TXD_CMD_TSE
|
E1000_TXD_CMD_IP
|
E1000_TXD_CMD_TCP
|
(
skb
->
len
-
(
hdr_len
)));
context_desc
->
cmd_and_length
=
cpu_to_le32
(
cmd_length
);
if
(
++
i
==
adapter
->
tx_ring
.
count
)
i
=
0
;
adapter
->
tx_ring
.
next_to_use
=
i
;
...
...
@@ -1528,22 +1548,21 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb)
{
struct
e1000_context_desc
*
context_desc
;
unsigned
int
i
;
uint8_t
css
,
cso
;
uint8_t
css
;
if
(
skb
->
ip_summed
==
CHECKSUM_HW
)
{
if
(
likely
(
skb
->
ip_summed
==
CHECKSUM_HW
)
)
{
css
=
skb
->
h
.
raw
-
skb
->
data
;
cso
=
(
skb
->
h
.
raw
+
skb
->
csum
)
-
skb
->
data
;
i
=
adapter
->
tx_ring
.
next_to_use
;
context_desc
=
E1000_CONTEXT_DESC
(
adapter
->
tx_ring
,
i
);
context_desc
->
upper_setup
.
tcp_fields
.
tucss
=
css
;
context_desc
->
upper_setup
.
tcp_fields
.
tucso
=
cs
o
;
context_desc
->
upper_setup
.
tcp_fields
.
tucso
=
cs
s
+
skb
->
csum
;
context_desc
->
upper_setup
.
tcp_fields
.
tucse
=
0
;
context_desc
->
tcp_seg_setup
.
data
=
0
;
context_desc
->
cmd_and_length
=
cpu_to_le32
(
E1000_TXD_CMD_DEXT
);
if
(
++
i
==
adapter
->
tx_ring
.
count
)
i
=
0
;
if
(
unlikely
(
++
i
==
adapter
->
tx_ring
.
count
)
)
i
=
0
;
adapter
->
tx_ring
.
next_to_use
=
i
;
return
TRUE
;
...
...
@@ -1567,7 +1586,6 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
unsigned
int
f
;
len
-=
skb
->
data_len
;
i
=
tx_ring
->
next_to_use
;
while
(
len
)
{
...
...
@@ -1576,14 +1594,14 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
#ifdef NETIF_F_TSO
/* Workaround for premature desc write-backs
* in TSO mode. Append 4-byte sentinel desc */
if
(
mss
&&
!
nr_frags
&&
size
==
len
&&
size
>
8
)
if
(
unlikely
(
mss
&&
!
nr_frags
&&
size
==
len
&&
size
>
8
)
)
size
-=
4
;
#endif
/* Workaround for potential 82544 hang in PCI-X. Avoid
* terminating buffers within evenly-aligned dwords. */
if
(
adapter
->
pcix_82544
&&
if
(
unlikely
(
adapter
->
pcix_82544
&&
!
((
unsigned
long
)(
skb
->
data
+
offset
+
size
-
1
)
&
4
)
&&
size
>
4
)
size
>
4
)
)
size
-=
4
;
buffer_info
->
length
=
size
;
...
...
@@ -1597,7 +1615,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
len
-=
size
;
offset
+=
size
;
count
++
;
if
(
++
i
==
tx_ring
->
count
)
i
=
0
;
if
(
unlikely
(
++
i
==
tx_ring
->
count
)
)
i
=
0
;
}
for
(
f
=
0
;
f
<
nr_frags
;
f
++
)
{
...
...
@@ -1613,15 +1631,15 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
#ifdef NETIF_F_TSO
/* Workaround for premature desc write-backs
* in TSO mode. Append 4-byte sentinel desc */
if
(
mss
&&
f
==
(
nr_frags
-
1
)
&&
size
==
len
&&
size
>
8
)
if
(
unlikely
(
mss
&&
f
==
(
nr_frags
-
1
)
&&
size
==
len
&&
size
>
8
)
)
size
-=
4
;
#endif
/* Workaround for potential 82544 hang in PCI-X.
* Avoid terminating buffers within evenly-aligned
* dwords. */
if
(
adapter
->
pcix_82544
&&
if
(
unlikely
(
adapter
->
pcix_82544
&&
!
((
unsigned
long
)(
frag
->
page
+
offset
+
size
-
1
)
&
4
)
&&
size
>
4
)
size
>
4
)
)
size
-=
4
;
buffer_info
->
length
=
size
;
...
...
@@ -1636,13 +1654,14 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
len
-=
size
;
offset
+=
size
;
count
++
;
if
(
++
i
==
tx_ring
->
count
)
i
=
0
;
if
(
unlikely
(
++
i
==
tx_ring
->
count
)
)
i
=
0
;
}
}
i
=
(
i
==
0
)
?
tx_ring
->
count
-
1
:
i
-
1
;
tx_ring
->
buffer_info
[
i
].
skb
=
skb
;
tx_ring
->
buffer_info
[
first
].
next_to_watch
=
i
;
return
count
;
}
...
...
@@ -1655,18 +1674,18 @@ e1000_tx_queue(struct e1000_adapter *adapter, int count, int tx_flags)
uint32_t
txd_upper
=
0
,
txd_lower
=
E1000_TXD_CMD_IFCS
;
unsigned
int
i
;
if
(
tx_flags
&
E1000_TX_FLAGS_TSO
)
{
if
(
likely
(
tx_flags
&
E1000_TX_FLAGS_TSO
)
)
{
txd_lower
|=
E1000_TXD_CMD_DEXT
|
E1000_TXD_DTYP_D
|
E1000_TXD_CMD_TSE
;
txd_upper
|=
(
E1000_TXD_POPTS_IXSM
|
E1000_TXD_POPTS_TXSM
)
<<
8
;
}
if
(
tx_flags
&
E1000_TX_FLAGS_CSUM
)
{
if
(
likely
(
tx_flags
&
E1000_TX_FLAGS_CSUM
)
)
{
txd_lower
|=
E1000_TXD_CMD_DEXT
|
E1000_TXD_DTYP_D
;
txd_upper
|=
E1000_TXD_POPTS_TXSM
<<
8
;
}
if
(
tx_flags
&
E1000_TX_FLAGS_VLAN
)
{
if
(
unlikely
(
tx_flags
&
E1000_TX_FLAGS_VLAN
)
)
{
txd_lower
|=
E1000_TXD_CMD_VLE
;
txd_upper
|=
(
tx_flags
&
E1000_TX_FLAGS_VLAN_MASK
);
}
...
...
@@ -1680,7 +1699,7 @@ e1000_tx_queue(struct e1000_adapter *adapter, int count, int tx_flags)
tx_desc
->
lower
.
data
=
cpu_to_le32
(
txd_lower
|
buffer_info
->
length
);
tx_desc
->
upper
.
data
=
cpu_to_le32
(
txd_upper
);
if
(
++
i
==
tx_ring
->
count
)
i
=
0
;
if
(
unlikely
(
++
i
==
tx_ring
->
count
)
)
i
=
0
;
}
tx_desc
->
lower
.
data
|=
cpu_to_le32
(
adapter
->
txd_cmd
);
...
...
@@ -1733,7 +1752,7 @@ e1000_82547_fifo_workaround(struct e1000_adapter *adapter, struct sk_buff *skb)
return
0
;
}
#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 )
#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 )
static
int
e1000_xmit_frame
(
struct
sk_buff
*
skb
,
struct
net_device
*
netdev
)
{
...
...
@@ -1741,22 +1760,23 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
unsigned
int
first
,
max_per_txd
=
E1000_MAX_DATA_PER_TXD
;
unsigned
int
max_txd_pwr
=
E1000_MAX_TXD_PWR
;
unsigned
int
tx_flags
=
0
;
unsigned
long
flags
;
unsigned
int
len
=
skb
->
len
;
int
count
=
0
;
unsigned
int
mss
=
0
;
unsigned
long
flags
;
unsigned
int
nr_frags
=
0
;
unsigned
int
mss
=
0
;
int
count
=
0
;
unsigned
int
f
;
nr_frags
=
skb_shinfo
(
skb
)
->
nr_frags
;
len
-=
skb
->
data_len
;
if
(
skb
->
len
<=
0
)
{
if
(
unlikely
(
skb
->
len
<=
0
))
{
dev_kfree_skb_any
(
skb
);
return
0
;
}
#ifdef NETIF_F_TSO
mss
=
skb_shinfo
(
skb
)
->
tso_size
;
/* The controller does a simple calculation to
/* The controller does a simple calculation to
* make sure there is enough room in the FIFO before
* initiating the DMA for each buffer. The calc is:
* 4 = ceil(buffer len/mss). To make sure we don't
...
...
@@ -1766,57 +1786,60 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
max_per_txd
=
min
(
mss
<<
2
,
max_per_txd
);
max_txd_pwr
=
fls
(
max_per_txd
)
-
1
;
}
if
((
mss
)
||
(
skb
->
ip_summed
==
CHECKSUM_HW
))
count
++
;
count
++
;
/*
for sentinel desc
*/
count
++
;
/*
for sentinel desc
*/
#else
if
(
skb
->
ip_summed
==
CHECKSUM_HW
)
count
++
;
#endif
count
+=
TXD_USE_COUNT
(
len
,
max_txd_pwr
);
if
(
adapter
->
pcix_82544
)
count
++
;
nr_frags
=
skb_shinfo
(
skb
)
->
nr_frags
;
for
(
f
=
0
;
f
<
nr_frags
;
f
++
)
count
+=
TXD_USE_COUNT
(
skb_shinfo
(
skb
)
->
frags
[
f
].
size
,
max_txd_pwr
);
max_txd_pwr
);
if
(
adapter
->
pcix_82544
)
count
+=
nr_frags
;
spin_lock_irqsave
(
&
adapter
->
tx_lock
,
flags
);
/* need: count + 2 desc gap to keep tail from touching
/* need: count + 2 desc gap to keep tail from touching
* head, otherwise try next time */
if
(
E1000_DESC_UNUSED
(
&
adapter
->
tx_ring
)
<
count
+
2
)
{
if
(
E1000_DESC_UNUSED
(
&
adapter
->
tx_ring
)
<
count
+
2
)
{
netif_stop_queue
(
netdev
);
spin_unlock_irqrestore
(
&
adapter
->
tx_lock
,
flags
);
return
1
;
}
spin_unlock_irqrestore
(
&
adapter
->
tx_lock
,
flags
);
if
(
adapter
->
hw
.
mac_type
==
e1000_82547
)
{
if
(
e1000_82547_fifo_workaround
(
adapter
,
skb
))
{
if
(
unlikely
(
adapter
->
hw
.
mac_type
==
e1000_82547
)
)
{
if
(
unlikely
(
e1000_82547_fifo_workaround
(
adapter
,
skb
)
))
{
netif_stop_queue
(
netdev
);
mod_timer
(
&
adapter
->
tx_fifo_stall_timer
,
jiffies
);
return
1
;
}
}
if
(
adapter
->
vlgrp
&&
vlan_tx_tag_present
(
skb
))
{
if
(
unlikely
(
adapter
->
vlgrp
&&
vlan_tx_tag_present
(
skb
)
))
{
tx_flags
|=
E1000_TX_FLAGS_VLAN
;
tx_flags
|=
(
vlan_tx_tag_get
(
skb
)
<<
E1000_TX_FLAGS_VLAN_SHIFT
);
}
first
=
adapter
->
tx_ring
.
next_to_use
;
if
(
e1000_tso
(
adapter
,
skb
))
if
(
likely
(
e1000_tso
(
adapter
,
skb
)
))
tx_flags
|=
E1000_TX_FLAGS_TSO
;
else
if
(
e1000_tx_csum
(
adapter
,
skb
))
else
if
(
likely
(
e1000_tx_csum
(
adapter
,
skb
)
))
tx_flags
|=
E1000_TX_FLAGS_CSUM
;
e1000_tx_queue
(
adapter
,
e1000_tx_map
(
adapter
,
skb
,
first
,
max_per_txd
,
nr_frags
,
mss
),
e1000_tx_queue
(
adapter
,
e1000_tx_map
(
adapter
,
skb
,
first
,
max_per_txd
,
nr_frags
,
mss
),
tx_flags
);
netdev
->
trans_start
=
jiffies
;
...
...
@@ -1843,10 +1866,8 @@ e1000_tx_timeout_task(struct net_device *netdev)
{
struct
e1000_adapter
*
adapter
=
netdev
->
priv
;
netif_device_detach
(
netdev
);
e1000_down
(
adapter
);
e1000_up
(
adapter
);
netif_device_attach
(
netdev
);
}
/**
...
...
@@ -1905,7 +1926,6 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
}
if
(
old_mtu
!=
adapter
->
rx_buffer_len
&&
netif_running
(
netdev
))
{
e1000_down
(
adapter
);
e1000_up
(
adapter
);
}
...
...
@@ -1951,8 +1971,6 @@ e1000_update_stats(struct e1000_adapter *adapter)
adapter
->
stats
.
prc1023
+=
E1000_READ_REG
(
hw
,
PRC1023
);
adapter
->
stats
.
prc1522
+=
E1000_READ_REG
(
hw
,
PRC1522
);
/* the rest of the counters are only modified here */
adapter
->
stats
.
symerrs
+=
E1000_READ_REG
(
hw
,
SYMERRS
);
adapter
->
stats
.
mpc
+=
E1000_READ_REG
(
hw
,
MPC
);
adapter
->
stats
.
scc
+=
E1000_READ_REG
(
hw
,
SCC
);
...
...
@@ -2076,7 +2094,7 @@ e1000_irq_disable(struct e1000_adapter *adapter)
static
inline
void
e1000_irq_enable
(
struct
e1000_adapter
*
adapter
)
{
if
(
atomic_dec_and_test
(
&
adapter
->
irq_sem
))
{
if
(
likely
(
atomic_dec_and_test
(
&
adapter
->
irq_sem
)
))
{
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMS
,
IMS_ENABLE_MASK
);
E1000_WRITE_FLUSH
(
&
adapter
->
hw
);
}
...
...
@@ -2095,21 +2113,21 @@ e1000_intr(int irq, void *data, struct pt_regs *regs)
struct
net_device
*
netdev
=
data
;
struct
e1000_adapter
*
adapter
=
netdev
->
priv
;
struct
e1000_hw
*
hw
=
&
adapter
->
hw
;
uint32_t
icr
=
E1000_READ_REG
(
&
adapter
->
hw
,
ICR
);
uint32_t
icr
=
E1000_READ_REG
(
hw
,
ICR
);
#ifndef CONFIG_E1000_NAPI
unsigned
int
i
;
#endif
if
(
!
icr
)
if
(
unlikely
(
!
icr
)
)
return
IRQ_NONE
;
/* Not our interrupt */
if
(
icr
&
(
E1000_ICR_RXSEQ
|
E1000_ICR_LSC
))
{
if
(
unlikely
(
icr
&
(
E1000_ICR_RXSEQ
|
E1000_ICR_LSC
)
))
{
hw
->
get_link_status
=
1
;
mod_timer
(
&
adapter
->
watchdog_timer
,
jiffies
);
}
#ifdef CONFIG_E1000_NAPI
if
(
netif_rx_schedule_prep
(
netdev
))
{
if
(
likely
(
netif_rx_schedule_prep
(
netdev
)
))
{
/* Disable interrupts and register for poll. The flush
of the posted write is intentionally left out.
...
...
@@ -2121,8 +2139,8 @@ e1000_intr(int irq, void *data, struct pt_regs *regs)
}
#else
for
(
i
=
0
;
i
<
E1000_MAX_INTR
;
i
++
)
if
(
!
e1000_clean_rx_irq
(
adapter
)
&
!
e1000_clean_tx_irq
(
adapter
))
if
(
unlikely
(
!
e1000_clean_rx_irq
(
adapter
)
&
!
e1000_clean_tx_irq
(
adapter
))
)
break
;
#endif
...
...
@@ -2140,15 +2158,18 @@ e1000_clean(struct net_device *netdev, int *budget)
{
struct
e1000_adapter
*
adapter
=
netdev
->
priv
;
int
work_to_do
=
min
(
*
budget
,
netdev
->
quota
);
int
tx_cleaned
;
int
work_done
=
0
;
e1000_clean_tx_irq
(
adapter
);
tx_cleaned
=
e1000_clean_tx_irq
(
adapter
);
e1000_clean_rx_irq
(
adapter
,
&
work_done
,
work_to_do
);
*
budget
-=
work_done
;
netdev
->
quota
-=
work_done
;
if
(
work_done
<
work_to_do
||
!
netif_running
(
netdev
))
{
/* if no Rx and Tx cleanup work was done, exit the polling mode */
if
(
!
tx_cleaned
||
(
work_done
<
work_to_do
)
||
!
netif_running
(
netdev
))
{
netif_rx_complete
(
netdev
);
e1000_irq_enable
(
adapter
);
return
0
;
...
...
@@ -2156,8 +2177,8 @@ e1000_clean(struct net_device *netdev, int *budget)
return
(
work_done
>=
work_to_do
);
}
#endif
#endif
/**
* e1000_clean_tx_irq - Reclaim resources after transmit completes
* @adapter: board private structure
...
...
@@ -2174,31 +2195,25 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter)
unsigned
int
i
,
eop
;
boolean_t
cleaned
=
FALSE
;
i
=
tx_ring
->
next_to_clean
;
eop
=
tx_ring
->
buffer_info
[
i
].
next_to_watch
;
eop_desc
=
E1000_TX_DESC
(
*
tx_ring
,
eop
);
while
(
eop_desc
->
upper
.
data
&
cpu_to_le32
(
E1000_TXD_STAT_DD
))
{
for
(
cleaned
=
FALSE
;
!
cleaned
;
)
{
tx_desc
=
E1000_TX_DESC
(
*
tx_ring
,
i
);
buffer_info
=
&
tx_ring
->
buffer_info
[
i
];
if
(
buffer_info
->
dma
)
{
if
(
likely
(
buffer_info
->
dma
))
{
pci_unmap_page
(
pdev
,
buffer_info
->
dma
,
buffer_info
->
length
,
PCI_DMA_TODEVICE
);
buffer_info
->
dma
=
0
;
}
if
(
buffer_info
->
skb
)
{
dev_kfree_skb_any
(
buffer_info
->
skb
);
buffer_info
->
skb
=
NULL
;
}
...
...
@@ -2207,7 +2222,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter)
tx_desc
->
upper
.
data
=
0
;
cleaned
=
(
i
==
eop
);
if
(
++
i
==
tx_ring
->
count
)
i
=
0
;
if
(
unlikely
(
++
i
==
tx_ring
->
count
)
)
i
=
0
;
}
eop
=
tx_ring
->
buffer_info
[
i
].
next_to_watch
;
...
...
@@ -2218,7 +2233,8 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter)
spin_lock
(
&
adapter
->
tx_lock
);
if
(
cleaned
&&
netif_queue_stopped
(
netdev
)
&&
netif_carrier_ok
(
netdev
))
if
(
unlikely
(
cleaned
&&
netif_queue_stopped
(
netdev
)
&&
netif_carrier_ok
(
netdev
)))
netif_wake_queue
(
netdev
);
spin_unlock
(
&
adapter
->
tx_lock
);
...
...
@@ -2227,7 +2243,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter)
}
/**
* e1000_clean_rx_irq - Send received data up the network stack
,
* e1000_clean_rx_irq - Send received data up the network stack
* @adapter: board private structure
**/
...
...
@@ -2256,14 +2272,11 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter)
while
(
rx_desc
->
status
&
E1000_RXD_STAT_DD
)
{
buffer_info
=
&
rx_ring
->
buffer_info
[
i
];
#ifdef CONFIG_E1000_NAPI
if
(
*
work_done
>=
work_to_do
)
break
;
(
*
work_done
)
++
;
#endif
cleaned
=
TRUE
;
pci_unmap_single
(
pdev
,
...
...
@@ -2274,49 +2287,28 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter)
skb
=
buffer_info
->
skb
;
length
=
le16_to_cpu
(
rx_desc
->
length
);
if
(
!
(
rx_desc
->
status
&
E1000_RXD_STAT_EOP
))
{
if
(
unlikely
(
!
(
rx_desc
->
status
&
E1000_RXD_STAT_EOP
)))
{
/* All receives must fit into a single buffer */
E1000_DBG
(
"%s: Receive packet consumed multiple buffers
\n
"
,
netdev
->
name
);
E1000_DBG
(
"%s: Receive packet consumed multiple"
" buffers
\n
"
,
netdev
->
name
);
dev_kfree_skb_irq
(
skb
);
rx_desc
->
status
=
0
;
buffer_info
->
skb
=
NULL
;
if
(
++
i
==
rx_ring
->
count
)
i
=
0
;
rx_desc
=
E1000_RX_DESC
(
*
rx_ring
,
i
);
continue
;
goto
next_desc
;
}
if
(
rx_desc
->
errors
&
E1000_RXD_ERR_FRAME_ERR_MASK
)
{
if
(
unlikely
(
rx_desc
->
errors
&
E1000_RXD_ERR_FRAME_ERR_MASK
))
{
last_byte
=
*
(
skb
->
data
+
length
-
1
);
if
(
TBI_ACCEPT
(
&
adapter
->
hw
,
rx_desc
->
status
,
rx_desc
->
errors
,
length
,
last_byte
))
{
spin_lock_irqsave
(
&
adapter
->
stats_lock
,
flags
);
e1000_tbi_adjust_stats
(
&
adapter
->
hw
,
&
adapter
->
stats
,
length
,
skb
->
data
);
spin_unlock_irqrestore
(
&
adapter
->
stats_lock
,
flags
);
length
--
;
}
else
{
dev_kfree_skb_irq
(
skb
);
rx_desc
->
status
=
0
;
buffer_info
->
skb
=
NULL
;
if
(
++
i
==
rx_ring
->
count
)
i
=
0
;
rx_desc
=
E1000_RX_DESC
(
*
rx_ring
,
i
);
continue
;
goto
next_desc
;
}
}
...
...
@@ -2328,17 +2320,19 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter)
skb
->
protocol
=
eth_type_trans
(
skb
,
netdev
);
#ifdef CONFIG_E1000_NAPI
if
(
adapter
->
vlgrp
&&
(
rx_desc
->
status
&
E1000_RXD_STAT_VP
))
{
if
(
unlikely
(
adapter
->
vlgrp
&&
(
rx_desc
->
status
&
E1000_RXD_STAT_VP
)))
{
vlan_hwaccel_receive_skb
(
skb
,
adapter
->
vlgrp
,
le16_to_cpu
(
rx_desc
->
special
&
E1000_RXD_SPC_VLAN_MASK
));
le16_to_cpu
(
rx_desc
->
special
&
E1000_RXD_SPC_VLAN_MASK
));
}
else
{
netif_receive_skb
(
skb
);
}
#else
/* CONFIG_E1000_NAPI */
if
(
adapter
->
vlgrp
&&
(
rx_desc
->
status
&
E1000_RXD_STAT_VP
))
{
if
(
unlikely
(
adapter
->
vlgrp
&&
(
rx_desc
->
status
&
E1000_RXD_STAT_VP
)))
{
vlan_hwaccel_rx
(
skb
,
adapter
->
vlgrp
,
le16_to_cpu
(
rx_desc
->
special
&
le16_to_cpu
(
rx_desc
->
special
&
E1000_RXD_SPC_VLAN_MASK
));
}
else
{
netif_rx
(
skb
);
...
...
@@ -2346,10 +2340,10 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter)
#endif
/* CONFIG_E1000_NAPI */
netdev
->
last_rx
=
jiffies
;
next_desc:
rx_desc
->
status
=
0
;
buffer_info
->
skb
=
NULL
;
if
(
++
i
==
rx_ring
->
count
)
i
=
0
;
if
(
unlikely
(
++
i
==
rx_ring
->
count
))
i
=
0
;
rx_desc
=
E1000_RX_DESC
(
*
rx_ring
,
i
);
}
...
...
@@ -2381,11 +2375,9 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter)
buffer_info
=
&
rx_ring
->
buffer_info
[
i
];
while
(
!
buffer_info
->
skb
)
{
rx_desc
=
E1000_RX_DESC
(
*
rx_ring
,
i
);
skb
=
dev_alloc_skb
(
adapter
->
rx_buffer_len
+
NET_IP_ALIGN
);
if
(
!
skb
)
{
if
(
unlikely
(
!
skb
))
{
/* Better luck next round */
break
;
}
...
...
@@ -2400,15 +2392,15 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter)
buffer_info
->
skb
=
skb
;
buffer_info
->
length
=
adapter
->
rx_buffer_len
;
buffer_info
->
dma
=
pci_map_single
(
pdev
,
skb
->
data
,
adapter
->
rx_buffer_len
,
PCI_DMA_FROMDEVICE
);
buffer_info
->
dma
=
pci_map_single
(
pdev
,
skb
->
data
,
adapter
->
rx_buffer_len
,
PCI_DMA_FROMDEVICE
);
rx_desc
=
E1000_RX_DESC
(
*
rx_ring
,
i
);
rx_desc
->
buffer_addr
=
cpu_to_le64
(
buffer_info
->
dma
);
if
(
(
i
&
~
(
E1000_RX_BUFFER_WRITE
-
1
))
==
i
)
{
if
(
unlikely
((
i
&
~
(
E1000_RX_BUFFER_WRITE
-
1
))
==
i
)
)
{
/* Force memory writes to complete before letting h/w
* know there are new descriptors to fetch. (Only
* applicable for weak-ordered memory model archs,
...
...
@@ -2418,7 +2410,7 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter)
E1000_WRITE_REG
(
&
adapter
->
hw
,
RDT
,
i
);
}
if
(
++
i
==
rx_ring
->
count
)
i
=
0
;
if
(
unlikely
(
++
i
==
rx_ring
->
count
)
)
i
=
0
;
buffer_info
=
&
rx_ring
->
buffer_info
[
i
];
}
...
...
@@ -2537,22 +2529,24 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
return
-
EFAULT
;
mii_reg
=
data
->
val_in
;
if
(
e1000_write_phy_reg
(
&
adapter
->
hw
,
data
->
reg_num
,
data
->
val_in
))
mii_reg
))
return
-
EIO
;
if
(
adapter
->
hw
.
phy_type
==
e1000_phy_m88
)
{
switch
(
data
->
reg_num
)
{
case
PHY_CTRL
:
if
(
data
->
val_in
&
MII_CR_AUTO_NEG_EN
)
{
if
(
mii_reg
&
MII_CR_POWER_DOWN
)
break
;
if
(
mii_reg
&
MII_CR_AUTO_NEG_EN
)
{
adapter
->
hw
.
autoneg
=
1
;
adapter
->
hw
.
autoneg_advertised
=
0x2F
;
}
else
{
if
(
data
->
val_in
&
0x40
)
if
(
mii_reg
&
0x40
)
spddplx
=
SPEED_1000
;
else
if
(
data
->
val_in
&
0x2000
)
else
if
(
mii_reg
&
0x2000
)
spddplx
=
SPEED_100
;
else
spddplx
=
SPEED_10
;
spddplx
+=
(
data
->
val_in
&
0x100
)
spddplx
+=
(
mii_reg
&
0x100
)
?
FULL_DUPLEX
:
HALF_DUPLEX
;
retval
=
e1000_set_spd_dplx
(
adapter
,
...
...
@@ -2572,6 +2566,18 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
return
-
EIO
;
break
;
}
}
else
{
switch
(
data
->
reg_num
)
{
case
PHY_CTRL
:
if
(
mii_reg
&
MII_CR_POWER_DOWN
)
break
;
if
(
netif_running
(
adapter
->
netdev
))
{
e1000_down
(
adapter
);
e1000_up
(
adapter
);
}
else
e1000_reset
(
adapter
);
break
;
}
}
break
;
default:
...
...
@@ -2593,11 +2599,11 @@ e1000_rx_checksum(struct e1000_adapter *adapter,
struct
sk_buff
*
skb
)
{
/* 82543 or newer only */
if
((
adapter
->
hw
.
mac_type
<
e1000_82543
)
||
if
(
unlikely
(
(
adapter
->
hw
.
mac_type
<
e1000_82543
)
||
/* Ignore Checksum bit is set */
(
rx_desc
->
status
&
E1000_RXD_STAT_IXSM
)
||
/* TCP Checksum has not been calculated */
(
!
(
rx_desc
->
status
&
E1000_RXD_STAT_TCPCS
)))
{
(
!
(
rx_desc
->
status
&
E1000_RXD_STAT_TCPCS
)))
)
{
skb
->
ip_summed
=
CHECKSUM_NONE
;
return
;
}
...
...
@@ -2609,7 +2615,7 @@ e1000_rx_checksum(struct e1000_adapter *adapter,
skb
->
ip_summed
=
CHECKSUM_NONE
;
adapter
->
hw_csum_err
++
;
}
else
{
/* TCP checksum is good */
/* TCP checksum is good */
skb
->
ip_summed
=
CHECKSUM_UNNECESSARY
;
adapter
->
hw_csum_good
++
;
}
...
...
@@ -2620,7 +2626,8 @@ e1000_pci_set_mwi(struct e1000_hw *hw)
{
struct
e1000_adapter
*
adapter
=
hw
->
back
;
pci_set_mwi
(
adapter
->
pdev
);
int
ret
;
ret
=
pci_set_mwi
(
adapter
->
pdev
);
}
void
...
...
@@ -2670,26 +2677,22 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
if
(
grp
)
{
/* enable VLAN tag insert/strip */
ctrl
=
E1000_READ_REG
(
&
adapter
->
hw
,
CTRL
);
ctrl
|=
E1000_CTRL_VME
;
E1000_WRITE_REG
(
&
adapter
->
hw
,
CTRL
,
ctrl
);
/* enable VLAN receive filtering */
rctl
=
E1000_READ_REG
(
&
adapter
->
hw
,
RCTL
);
rctl
|=
E1000_RCTL_VFE
;
rctl
&=
~
E1000_RCTL_CFIEN
;
E1000_WRITE_REG
(
&
adapter
->
hw
,
RCTL
,
rctl
);
}
else
{
/* disable VLAN tag insert/strip */
ctrl
=
E1000_READ_REG
(
&
adapter
->
hw
,
CTRL
);
ctrl
&=
~
E1000_CTRL_VME
;
E1000_WRITE_REG
(
&
adapter
->
hw
,
CTRL
,
ctrl
);
/* disable VLAN filtering */
rctl
=
E1000_READ_REG
(
&
adapter
->
hw
,
RCTL
);
rctl
&=
~
E1000_RCTL_VFE
;
E1000_WRITE_REG
(
&
adapter
->
hw
,
RCTL
,
rctl
);
...
...
@@ -2705,7 +2708,6 @@ e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid)
uint32_t
vfta
,
index
;
/* add VID to filter table */
index
=
(
vid
>>
5
)
&
0x7F
;
vfta
=
E1000_READ_REG_ARRAY
(
&
adapter
->
hw
,
VFTA
,
index
);
vfta
|=
(
1
<<
(
vid
&
0x1F
));
...
...
@@ -2725,8 +2727,7 @@ e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid)
e1000_irq_enable
(
adapter
);
/* remove VID from filter table*/
/* remove VID from filter table */
index
=
(
vid
>>
5
)
&
0x7F
;
vfta
=
E1000_READ_REG_ARRAY
(
&
adapter
->
hw
,
VFTA
,
index
);
vfta
&=
~
(
1
<<
(
vid
&
0x1F
));
...
...
@@ -2772,6 +2773,8 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
break
;
case
SPEED_1000
+
DUPLEX_HALF
:
/* not supported */
default:
DPRINTK
(
PROBE
,
ERR
,
"Unsupported Speed/Duplexity configuration
\n
"
);
return
-
EINVAL
;
}
return
0
;
...
...
@@ -2865,6 +2868,8 @@ e1000_suspend(struct pci_dev *pdev, uint32_t state)
}
}
pci_disable_device
(
pdev
);
state
=
(
state
>
0
)
?
3
:
0
;
pci_set_power_state
(
pdev
,
state
);
...
...
@@ -2879,6 +2884,7 @@ e1000_resume(struct pci_dev *pdev)
struct
e1000_adapter
*
adapter
=
netdev
->
priv
;
uint32_t
manc
;
pci_enable_device
(
pdev
);
pci_set_power_state
(
pdev
,
0
);
pci_restore_state
(
pdev
,
adapter
->
pci_state
);
...
...
@@ -2910,12 +2916,12 @@ e1000_resume(struct pci_dev *pdev)
* without having to re-enable interrupts. It's not called while
* the interrupt routine is executing.
*/
static
void
e1000_netpoll
(
struct
net_device
*
dev
)
static
void
e1000_netpoll
(
struct
net_device
*
net
dev
)
{
struct
e1000_adapter
*
adapter
=
dev
->
priv
;
struct
e1000_adapter
*
adapter
=
net
dev
->
priv
;
disable_irq
(
adapter
->
pdev
->
irq
);
e1000_intr
(
adapter
->
pdev
->
irq
,
dev
,
NULL
);
e1000_intr
(
adapter
->
pdev
->
irq
,
net
dev
,
NULL
);
enable_irq
(
adapter
->
pdev
->
irq
);
}
#endif
...
...
drivers/net/e1000/e1000_param.c
View file @
b1106618
...
...
@@ -235,7 +235,7 @@ struct e1000_option {
static
int
__devinit
e1000_validate_option
(
int
*
value
,
struct
e1000_option
*
opt
,
struct
e1000_adapter
*
adapter
)
struct
e1000_adapter
*
adapter
)
{
if
(
*
value
==
OPTION_UNSET
)
{
*
value
=
opt
->
def
;
...
...
@@ -256,7 +256,7 @@ e1000_validate_option(int *value, struct e1000_option *opt,
case
range_option
:
if
(
*
value
>=
opt
->
arg
.
r
.
min
&&
*
value
<=
opt
->
arg
.
r
.
max
)
{
DPRINTK
(
PROBE
,
INFO
,
"%s set to %i
\n
"
,
opt
->
name
,
*
value
);
"%s set to %i
\n
"
,
opt
->
name
,
*
value
);
return
0
;
}
break
;
...
...
@@ -449,8 +449,7 @@ e1000_check_options(struct e1000_adapter *adapter)
DPRINTK
(
PROBE
,
INFO
,
"%s turned off
\n
"
,
opt
.
name
);
break
;
case
1
:
DPRINTK
(
PROBE
,
INFO
,
"%s set to dynamic mode
\n
"
,
opt
.
name
);
DPRINTK
(
PROBE
,
INFO
,
"%s set to dynamic mode
\n
"
,
opt
.
name
);
break
;
default:
e1000_validate_option
(
&
adapter
->
itr
,
&
opt
,
adapter
);
...
...
@@ -493,8 +492,9 @@ e1000_check_fiber_options(struct e1000_adapter *adapter)
"parameter ignored
\n
"
);
}
if
((
AutoNeg
[
bd
]
!=
OPTION_UNSET
)
&&
(
AutoNeg
[
bd
]
!=
0x20
))
{
DPRINTK
(
PROBE
,
INFO
,
"AutoNeg other than Full/1000 is "
"not valid for fiber adapters, parameter ignored
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"AutoNeg other than 1000/Full is "
"not valid for fiber adapters, "
"parameter ignored
\n
"
);
}
}
...
...
@@ -611,24 +611,24 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
break
;
case
HALF_DUPLEX
:
DPRINTK
(
PROBE
,
INFO
,
"Half Duplex specified without Speed
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"
Using Autonegotiation at
Half Duplex only
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"Using Autonegotiation at "
"Half Duplex only
\n
"
);
adapter
->
hw
.
autoneg
=
adapter
->
fc_autoneg
=
1
;
adapter
->
hw
.
autoneg_advertised
=
ADVERTISE_10_HALF
|
ADVERTISE_100_HALF
;
break
;
case
FULL_DUPLEX
:
DPRINTK
(
PROBE
,
INFO
,
"Full Duplex specified without Speed
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"
Using Autonegotiation at
Full Duplex only
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"Using Autonegotiation at "
"Full Duplex only
\n
"
);
adapter
->
hw
.
autoneg
=
adapter
->
fc_autoneg
=
1
;
adapter
->
hw
.
autoneg_advertised
=
ADVERTISE_10_FULL
|
ADVERTISE_100_FULL
|
ADVERTISE_1000_FULL
;
break
;
case
SPEED_10
:
DPRINTK
(
PROBE
,
INFO
,
"
10 Mbps Speed specified
without Duplex
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"10 Mbps Speed specified "
"without Duplex
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"Using Autonegotiation at 10 Mbps only
\n
"
);
adapter
->
hw
.
autoneg
=
adapter
->
fc_autoneg
=
1
;
adapter
->
hw
.
autoneg_advertised
=
ADVERTISE_10_HALF
|
...
...
@@ -647,10 +647,10 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
adapter
->
hw
.
autoneg_advertised
=
0
;
break
;
case
SPEED_100
:
DPRINTK
(
PROBE
,
INFO
,
"
100 Mbps Speed specified
without Duplex
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"
Using Autonegotiation at
100 Mbps only
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"100 Mbps Speed specified "
"without Duplex
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"Using Autonegotiation at "
"100 Mbps only
\n
"
);
adapter
->
hw
.
autoneg
=
adapter
->
fc_autoneg
=
1
;
adapter
->
hw
.
autoneg_advertised
=
ADVERTISE_100_HALF
|
ADVERTISE_100_FULL
;
...
...
@@ -668,10 +668,11 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
adapter
->
hw
.
autoneg_advertised
=
0
;
break
;
case
SPEED_1000
:
DPRINTK
(
PROBE
,
INFO
,
"1000 Mbps Speed specified without "
"Duplex
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"1000 Mbps Speed specified without Duplex
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"Using Autonegotiation at 1000 Mbps Full Duplex only
\n
"
);
"Using Autonegotiation at 1000 Mbps "
"Full Duplex only
\n
"
);
adapter
->
hw
.
autoneg
=
adapter
->
fc_autoneg
=
1
;
adapter
->
hw
.
autoneg_advertised
=
ADVERTISE_1000_FULL
;
break
;
...
...
@@ -679,7 +680,8 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
DPRINTK
(
PROBE
,
INFO
,
"Half Duplex is not supported at 1000 Mbps
\n
"
);
DPRINTK
(
PROBE
,
INFO
,
"Using Autonegotiation at 1000 Mbps Full Duplex only
\n
"
);
"Using Autonegotiation at 1000 Mbps "
"Full Duplex only
\n
"
);
adapter
->
hw
.
autoneg
=
adapter
->
fc_autoneg
=
1
;
adapter
->
hw
.
autoneg_advertised
=
ADVERTISE_1000_FULL
;
break
;
...
...
@@ -696,8 +698,8 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
/* Speed, AutoNeg and MDI/MDI-X must all play nice */
if
(
e1000_validate_mdi_setting
(
&
(
adapter
->
hw
))
<
0
)
{
DPRINTK
(
PROBE
,
INFO
,
"Speed, AutoNeg and MDI-X specifications are "
"incompatible. Setting MDI-X to a compatible value.
\n
"
);
"Speed, AutoNeg and MDI-X specifications are "
"incompatible. Setting MDI-X to a compatible value.
\n
"
);
}
}
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