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
eda8ba60
Commit
eda8ba60
authored
Jan 07, 2005
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Plain Diff
Merge pobox.com:/garz/repo/netdev-2.6/e1000
into pobox.com:/garz/repo/net-drivers-2.6
parents
582e0be9
712e3f22
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
289 additions
and
185 deletions
+289
-185
Documentation/networking/e1000.txt
Documentation/networking/e1000.txt
+16
-20
drivers/net/e1000/e1000_ethtool.c
drivers/net/e1000/e1000_ethtool.c
+40
-28
drivers/net/e1000/e1000_hw.c
drivers/net/e1000/e1000_hw.c
+109
-16
drivers/net/e1000/e1000_hw.h
drivers/net/e1000/e1000_hw.h
+8
-0
drivers/net/e1000/e1000_main.c
drivers/net/e1000/e1000_main.c
+111
-109
drivers/net/e1000/e1000_osdep.h
drivers/net/e1000/e1000_osdep.h
+2
-7
drivers/net/e1000/e1000_param.c
drivers/net/e1000/e1000_param.c
+3
-5
No files found.
Documentation/networking/e1000.txt
View file @
eda8ba60
Linux* Base Driver for the Intel(R) PRO/1000 Family of Adapters
===============================================================
September 13
, 2004
November 17
, 2004
Contents
...
...
@@ -20,8 +20,7 @@ In This Release
===============
This file describes the Linux* Base Driver for the Intel(R) PRO/1000 Family
of Adapters, version 5.x.x. This driver includes support for Itanium(TM)2
and EM64T systems.
of Adapters, version 5.x.x.
For questions related to hardware requirements, refer to the documentation
supplied with your Intel PRO/1000 adapter. All hardware requirements listed
...
...
@@ -145,9 +144,11 @@ Valid Range: 80-256 for 82542 and 82543-based adapters
Default Value: 256
This value is the number of receive descriptors allocated by the driver.
Increasing this value allows the driver to buffer more incoming packets.
Each descriptor is 16 bytes. A receive buffer is also allocated for each
descriptor and can be either 2048, 4096, 8192, or 16384 bytes, depending
on the MTU setting. The maximum MTU size is 16110.
Each descriptor is 16 bytes. A receive buffer is allocated for each
descriptor and can either be 2048 or 4096 bytes long, depending on the MTU
setting. An incoming packet can span one or more receive descriptors.
The maximum MTU size is 16110.
NOTE: MTU designates the frame size. It only needs to be set for Jumbo
Frames.
...
...
@@ -251,17 +252,16 @@ For copper-based boards, the keywords interact as follows:
also be forced.
The AutoNeg parameter is used when more control is required over the auto-
negotiation process.
When this parameter is used, Speed and Duplex must not
be specified. This parameter is a bitmap that specifies which speed and
duplex settings are advertised to the link partner.
negotiation process.
When this parameter is used, Speed and Duplex parameters
must not be specified. The following table describes supported values for the
AutoNeg parameter:
Bit 7 6 5 4 3 2 1 0
Speed (Mbps) N/A N/A 1000 N/A 100 100 10 10
Speed (Mbps) 1000 100 100 10 10
Duplex Full Full Half Full Half
Value (in base 16) 0x20 0x08 0x04 0x02 0x01
For example to limit the negotiated speed/duplex on the interface to 10 Mbps
Half or Full duplex, set AutoNeg to 0x02:
insmod e1000 AutoNeg=0x02
Example: insmod e1000 AutoNeg=0x03, loads e1000 and specifies (10 full duplex,
10 half duplex) for negotiation with the peer.
Note that setting AutoNeg does not guarantee that the board will link at the
highest specified speed or duplex mode, but the board will link at the
...
...
@@ -333,11 +333,7 @@ Additional Configurations
version 1.6 or later is required for this functionality.
The latest release of ethtool can be found from
http://sf.net/projects/gkernel. After ethtool is installed,
ethtool-copy.h must be copied and renamed to ethtool.h in your kernel
source tree at <linux_kernel_src>/include/linux. Backup the original
ethtool.h as needed before copying. The driver then must be recompiled
in order to take advantage of the latest ethtool features.
http://sf.net/projects/gkernel.
NOTE: Ethtool 1.6 only supports a limited set of ethtool options. Support
for a more complete ethtool feature set can be enabled by upgrading
...
...
drivers/net/e1000/e1000_ethtool.c
View file @
eda8ba60
...
...
@@ -776,7 +776,7 @@ static int
e1000_intr_test
(
struct
e1000_adapter
*
adapter
,
uint64_t
*
data
)
{
struct
net_device
*
netdev
=
adapter
->
netdev
;
uint32_t
icr
,
mask
,
i
=
0
,
shared_int
=
TRUE
;
uint32_t
mask
,
i
=
0
,
shared_int
=
TRUE
;
uint32_t
irq
=
adapter
->
pdev
->
irq
;
*
data
=
0
;
...
...
@@ -784,7 +784,8 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
/* Hook up test interrupt handler just for this test */
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
)){
}
else
if
(
request_irq
(
irq
,
&
e1000_test_intr
,
SA_SHIRQ
,
netdev
->
name
,
netdev
)){
*
data
=
1
;
return
-
1
;
}
...
...
@@ -793,21 +794,6 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMC
,
0xFFFFFFFF
);
msec_delay
(
10
);
/* Interrupts are disabled, so read interrupt cause
* register (icr) twice to verify that there are no interrupts
* pending. icr is clear on read.
*/
icr
=
E1000_READ_REG
(
&
adapter
->
hw
,
ICR
);
icr
=
E1000_READ_REG
(
&
adapter
->
hw
,
ICR
);
if
(
icr
!=
0
)
{
/* if icr is non-zero, there is no point
* running other interrupt tests.
*/
*
data
=
2
;
i
=
10
;
}
/* Test each interrupt */
for
(;
i
<
10
;
i
++
)
{
...
...
@@ -856,8 +842,10 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
* test failed.
*/
adapter
->
test_icr
=
0
;
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMC
,
~
mask
);
E1000_WRITE_REG
(
&
adapter
->
hw
,
ICS
,
~
mask
);
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMC
,
(
~
mask
&
0x00007FFF
));
E1000_WRITE_REG
(
&
adapter
->
hw
,
ICS
,
(
~
mask
&
0x00007FFF
));
msec_delay
(
10
);
if
(
adapter
->
test_icr
)
{
...
...
@@ -1336,10 +1324,17 @@ e1000_run_loopback_test(struct e1000_adapter *adapter)
msec_delay
(
200
);
pci_dma_sync_single_for_cpu
(
pdev
,
rxdr
->
buffer_info
[
0
].
dma
,
rxdr
->
buffer_info
[
0
].
length
,
PCI_DMA_FROMDEVICE
);
i
=
0
;
do
{
pci_dma_sync_single_for_cpu
(
pdev
,
rxdr
->
buffer_info
[
i
].
dma
,
rxdr
->
buffer_info
[
i
].
length
,
PCI_DMA_FROMDEVICE
);
return
e1000_check_lbtest_frame
(
rxdr
->
buffer_info
[
0
].
skb
,
1024
);
if
(
!
e1000_check_lbtest_frame
(
rxdr
->
buffer_info
[
i
++
].
skb
,
1024
))
return
0
;
}
while
(
i
<
64
);
return
13
;
}
static
int
...
...
@@ -1358,11 +1353,28 @@ static int
e1000_link_test
(
struct
e1000_adapter
*
adapter
,
uint64_t
*
data
)
{
*
data
=
0
;
if
(
adapter
->
hw
.
media_type
==
e1000_media_type_internal_serdes
)
{
int
i
=
0
;
adapter
->
hw
.
serdes_link_down
=
TRUE
;
/* on some blade server designs link establishment */
/* could take as long as 2-3 minutes. */
do
{
e1000_check_for_link
(
&
adapter
->
hw
);
if
(
adapter
->
hw
.
serdes_link_down
==
FALSE
)
return
*
data
;
msec_delay
(
20
);
}
while
(
i
++
<
3750
);
*
data
=
1
;
}
else
{
e1000_check_for_link
(
&
adapter
->
hw
);
if
(
!
(
E1000_READ_REG
(
&
adapter
->
hw
,
STATUS
)
&
E1000_STATUS_LU
))
{
*
data
=
1
;
}
}
return
*
data
;
}
...
...
@@ -1490,6 +1502,8 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
case
E1000_DEV_ID_82543GC_COPPER
:
case
E1000_DEV_ID_82544EI_FIBER
:
case
E1000_DEV_ID_82546EB_QUAD_COPPER
:
case
E1000_DEV_ID_82545EM_FIBER
:
case
E1000_DEV_ID_82545EM_COPPER
:
return
wol
->
wolopts
?
-
EOPNOTSUPP
:
0
;
case
E1000_DEV_ID_82546EB_FIBER
:
...
...
@@ -1554,9 +1568,7 @@ e1000_phys_id(struct net_device *netdev, uint32_t data)
e1000_setup_led
(
&
adapter
->
hw
);
mod_timer
(
&
adapter
->
blink_timer
,
jiffies
);
set_current_state
(
TASK_INTERRUPTIBLE
);
schedule_timeout
(
data
*
HZ
);
msleep_interruptible
(
data
*
1000
);
del_timer_sync
(
&
adapter
->
blink_timer
);
e1000_led_off
(
&
adapter
->
hw
);
clear_bit
(
E1000_LED_ON
,
&
adapter
->
led_status
);
...
...
drivers/net/e1000/e1000_hw.c
View file @
eda8ba60
...
...
@@ -123,16 +123,31 @@ e1000_set_phy_type(struct e1000_hw *hw)
static
void
e1000_phy_init_script
(
struct
e1000_hw
*
hw
)
{
uint32_t
ret_val
;
uint16_t
phy_saved_data
;
DEBUGFUNC
(
"e1000_phy_init_script"
);
if
(
hw
->
phy_init_script
)
{
msec_delay
(
20
);
/* Save off the current value of register 0x2F5B to be restored at
* the end of this routine. */
ret_val
=
e1000_read_phy_reg
(
hw
,
0x2F5B
,
&
phy_saved_data
);
/* Disabled the PHY transmitter */
e1000_write_phy_reg
(
hw
,
0x2F5B
,
0x0003
);
msec_delay
(
20
);
e1000_write_phy_reg
(
hw
,
0x0000
,
0x0140
);
msec_delay
(
5
);
if
(
hw
->
mac_type
==
e1000_82541
||
hw
->
mac_type
==
e1000_82547
)
{
switch
(
hw
->
mac_type
)
{
case
e1000_82541
:
case
e1000_82547
:
e1000_write_phy_reg
(
hw
,
0x1F95
,
0x0001
);
e1000_write_phy_reg
(
hw
,
0x1F71
,
0xBD21
);
...
...
@@ -150,12 +165,23 @@ e1000_phy_init_script(struct e1000_hw *hw)
e1000_write_phy_reg
(
hw
,
0x1F96
,
0x003F
);
e1000_write_phy_reg
(
hw
,
0x2010
,
0x0008
);
}
else
{
break
;
case
e1000_82541_rev_2
:
case
e1000_82547_rev_2
:
e1000_write_phy_reg
(
hw
,
0x1F73
,
0x0099
);
break
;
default:
break
;
}
e1000_write_phy_reg
(
hw
,
0x0000
,
0x3300
);
msec_delay
(
20
);
/* Now enable the transmitter */
e1000_write_phy_reg
(
hw
,
0x2F5B
,
phy_saved_data
);
if
(
hw
->
mac_type
==
e1000_82547
)
{
uint16_t
fused
,
fine
,
coarse
;
...
...
@@ -244,6 +270,7 @@ e1000_set_mac_type(struct e1000_hw *hw)
case
E1000_DEV_ID_82546GB_COPPER
:
case
E1000_DEV_ID_82546GB_FIBER
:
case
E1000_DEV_ID_82546GB_SERDES
:
case
E1000_DEV_ID_82546GB_PCIE
:
hw
->
mac_type
=
e1000_82546_rev_3
;
break
;
case
E1000_DEV_ID_82541EI
:
...
...
@@ -967,7 +994,7 @@ e1000_setup_copper_link(struct e1000_hw *hw)
if
((
hw
->
mac_type
==
e1000_82541
)
||
(
hw
->
mac_type
==
e1000_82547
))
{
hw
->
dsp_config_state
=
e1000_dsp_config_disabled
;
/* Force MDI for
IGP B-0
PHY */
/* Force MDI for
earlier revs of the IGP
PHY */
phy_data
&=
~
(
IGP01E1000_PSCR_AUTO_MDIX
|
IGP01E1000_PSCR_FORCE_MDI_MDIX
);
hw
->
mdix
=
1
;
...
...
@@ -2466,13 +2493,15 @@ e1000_read_phy_reg(struct e1000_hw *hw,
DEBUGFUNC
(
"e1000_read_phy_reg"
);
if
(
hw
->
phy_type
==
e1000_phy_igp
&&
(
reg_addr
>
MAX_PHY_MULTI_PAGE_REG
))
{
ret_val
=
e1000_write_phy_reg_ex
(
hw
,
IGP01E1000_PHY_PAGE_SELECT
,
(
uint16_t
)
reg_addr
);
if
(
ret_val
)
if
(
ret_val
)
{
return
ret_val
;
}
}
ret_val
=
e1000_read_phy_reg_ex
(
hw
,
IGP01E1000_PHY_PAGE_SELECT
&
reg_addr
,
phy_data
);
...
...
@@ -2570,13 +2599,15 @@ e1000_write_phy_reg(struct e1000_hw *hw,
DEBUGFUNC
(
"e1000_write_phy_reg"
);
if
(
hw
->
phy_type
==
e1000_phy_igp
&&
(
reg_addr
>
MAX_PHY_MULTI_PAGE_REG
))
{
ret_val
=
e1000_write_phy_reg_ex
(
hw
,
IGP01E1000_PHY_PAGE_SELECT
,
(
uint16_t
)
reg_addr
);
if
(
ret_val
)
if
(
ret_val
)
{
return
ret_val
;
}
}
ret_val
=
e1000_write_phy_reg_ex
(
hw
,
IGP01E1000_PHY_PAGE_SELECT
&
reg_addr
,
phy_data
);
...
...
@@ -3478,7 +3509,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
/* A check for invalid values: offset too large, too many words, and not
* enough words.
*/
if
((
offset
>
eeprom
->
word_size
)
||
(
words
>
eeprom
->
word_size
-
offset
)
||
if
((
offset
>
=
eeprom
->
word_size
)
||
(
words
>
eeprom
->
word_size
-
offset
)
||
(
words
==
0
))
{
DEBUGOUT
(
"
\"
words
\"
parameter out of bounds
\n
"
);
return
-
E1000_ERR_EEPROM
;
...
...
@@ -3626,7 +3657,7 @@ e1000_write_eeprom(struct e1000_hw *hw,
/* A check for invalid values: offset too large, too many words, and not
* enough words.
*/
if
((
offset
>
eeprom
->
word_size
)
||
(
words
>
eeprom
->
word_size
-
offset
)
||
if
((
offset
>
=
eeprom
->
word_size
)
||
(
words
>
eeprom
->
word_size
-
offset
)
||
(
words
==
0
))
{
DEBUGOUT
(
"
\"
words
\"
parameter out of bounds
\n
"
);
return
-
E1000_ERR_EEPROM
;
...
...
@@ -4918,7 +4949,7 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw,
boolean_t
link_up
)
{
int32_t
ret_val
;
uint16_t
phy_data
,
speed
,
duplex
,
i
;
uint16_t
phy_data
,
phy_saved_data
,
speed
,
duplex
,
i
;
uint16_t
dsp_reg_array
[
IGP01E1000_PHY_CHANNEL_NUM
]
=
{
IGP01E1000_PHY_AGC_PARAM_A
,
IGP01E1000_PHY_AGC_PARAM_B
,
...
...
@@ -4999,6 +5030,21 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw,
}
}
else
{
if
(
hw
->
dsp_config_state
==
e1000_dsp_config_activated
)
{
/* Save off the current value of register 0x2F5B to be restored at
* the end of the routines. */
ret_val
=
e1000_read_phy_reg
(
hw
,
0x2F5B
,
&
phy_saved_data
);
if
(
ret_val
)
return
ret_val
;
/* Disable the PHY transmitter */
ret_val
=
e1000_write_phy_reg
(
hw
,
0x2F5B
,
0x0003
);
if
(
ret_val
)
return
ret_val
;
msec_delay
(
20
);
ret_val
=
e1000_write_phy_reg
(
hw
,
0x0000
,
IGP01E1000_IEEE_FORCE_GIGA
);
if
(
ret_val
)
...
...
@@ -5021,10 +5067,33 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw,
if
(
ret_val
)
return
ret_val
;
msec_delay
(
20
);
/* Now enable the transmitter */
ret_val
=
e1000_write_phy_reg
(
hw
,
0x2F5B
,
phy_saved_data
);
if
(
ret_val
)
return
ret_val
;
hw
->
dsp_config_state
=
e1000_dsp_config_enabled
;
}
if
(
hw
->
ffe_config_state
==
e1000_ffe_config_active
)
{
/* Save off the current value of register 0x2F5B to be restored at
* the end of the routines. */
ret_val
=
e1000_read_phy_reg
(
hw
,
0x2F5B
,
&
phy_saved_data
);
if
(
ret_val
)
return
ret_val
;
/* Disable the PHY transmitter */
ret_val
=
e1000_write_phy_reg
(
hw
,
0x2F5B
,
0x0003
);
if
(
ret_val
)
return
ret_val
;
msec_delay
(
20
);
ret_val
=
e1000_write_phy_reg
(
hw
,
0x0000
,
IGP01E1000_IEEE_FORCE_GIGA
);
if
(
ret_val
)
...
...
@@ -5038,6 +5107,15 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw,
IGP01E1000_IEEE_RESTART_AUTONEG
);
if
(
ret_val
)
return
ret_val
;
msec_delay
(
20
);
/* Now enable the transmitter */
ret_val
=
e1000_write_phy_reg
(
hw
,
0x2F5B
,
phy_saved_data
);
if
(
ret_val
)
return
ret_val
;
hw
->
ffe_config_state
=
e1000_ffe_config_enabled
;
}
}
...
...
@@ -5126,14 +5204,29 @@ e1000_set_d3_lplu_state(struct e1000_hw *hw,
* Dx states where the power conservation is most important. During
* driver activity we should enable SmartSpeed, so performance is
* maintained. */
ret_val
=
e1000_read_phy_reg
(
hw
,
IGP01E1000_PHY_PORT_CONFIG
,
&
phy_data
);
if
(
hw
->
smart_speed
==
e1000_smart_speed_on
)
{
ret_val
=
e1000_read_phy_reg
(
hw
,
IGP01E1000_PHY_PORT_CONFIG
,
&
phy_data
);
if
(
ret_val
)
return
ret_val
;
phy_data
|=
IGP01E1000_PSCFR_SMART_SPEED
;
ret_val
=
e1000_write_phy_reg
(
hw
,
IGP01E1000_PHY_PORT_CONFIG
,
phy_data
);
ret_val
=
e1000_write_phy_reg
(
hw
,
IGP01E1000_PHY_PORT_CONFIG
,
phy_data
);
if
(
ret_val
)
return
ret_val
;
}
else
if
(
hw
->
smart_speed
==
e1000_smart_speed_off
)
{
ret_val
=
e1000_read_phy_reg
(
hw
,
IGP01E1000_PHY_PORT_CONFIG
,
&
phy_data
);
if
(
ret_val
)
return
ret_val
;
phy_data
&=
~
IGP01E1000_PSCFR_SMART_SPEED
;
ret_val
=
e1000_write_phy_reg
(
hw
,
IGP01E1000_PHY_PORT_CONFIG
,
phy_data
);
if
(
ret_val
)
return
ret_val
;
}
}
else
if
((
hw
->
autoneg_advertised
==
AUTONEG_ADVERTISE_SPEED_DEFAULT
)
||
(
hw
->
autoneg_advertised
==
AUTONEG_ADVERTISE_10_ALL
)
||
...
...
drivers/net/e1000/e1000_hw.h
View file @
eda8ba60
...
...
@@ -167,6 +167,12 @@ typedef enum {
e1000_downshift_undefined
=
0xFF
}
e1000_downshift
;
typedef
enum
{
e1000_smart_speed_default
=
0
,
e1000_smart_speed_on
,
e1000_smart_speed_off
}
e1000_smart_speed
;
typedef
enum
{
e1000_polarity_reversal_enabled
=
0
,
e1000_polarity_reversal_disabled
,
...
...
@@ -361,6 +367,7 @@ int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active);
#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_82546GB_PCIE 0x108A
#define E1000_DEV_ID_82547EI 0x1019
#define NODE_ADDRESS_SIZE 6
#define ETH_LENGTH_OF_ADDRESS 6
...
...
@@ -1026,6 +1033,7 @@ struct e1000_hw {
uint8_t
perm_mac_addr
[
NODE_ADDRESS_SIZE
];
boolean_t
disable_polarity_correction
;
boolean_t
speed_downgraded
;
e1000_smart_speed
smart_speed
;
e1000_dsp_config
dsp_config_state
;
boolean_t
get_link_status
;
boolean_t
serdes_link_down
;
...
...
drivers/net/e1000/e1000_main.c
View file @
eda8ba60
...
...
@@ -35,10 +35,19 @@
* - More errlogging support from Jon Mason <jonmason@us.ibm.com>
* - Fix TSO issues on PPC64 machines -- Jon Mason <jonmason@us.ibm.com>
*
* 5.3.11 6/4/04
* - ethtool register dump reads MANC register conditionally.
*
* 5.3.10 6/1/04
* 5.6.5 11/01/04
* - Enabling NETIF_F_SG without checksum offload is illegal -
John Mason <jdmason@us.ibm.com>
* 5.6.3 10/26/04
* - Remove redundant initialization - Jamal Hadi
* - Reset buffer_info->dma in tx resource cleanup logic
* 5.6.2 10/12/04
* - Avoid filling tx_ring completely - shemminger@osdl.org
* - Replace schedule_timeout() with msleep()/msleep_interruptible() -
* nacc@us.ibm.com
* - Sparse cleanup - shemminger@osdl.org
* - Fix tx resource cleanup logic
* - LLTX support - ak@suse.de and hadi@cyberus.ca
*/
char
e1000_driver_name
[]
=
"e1000"
;
...
...
@@ -48,7 +57,7 @@ char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
#else
#define DRIVERNAPI "-NAPI"
#endif
char
e1000_driver_version
[]
=
"5.
5.4
-k2"
DRIVERNAPI
;
char
e1000_driver_version
[]
=
"5.
6.10.1
-k2"
DRIVERNAPI
;
char
e1000_copyright
[]
=
"Copyright (c) 1999-2004 Intel Corporation."
;
/* e1000_pci_tbl - PCI Device ID Table
...
...
@@ -90,6 +99,7 @@ static struct pci_device_id e1000_pci_tbl[] = {
INTEL_E1000_ETHERNET_DEVICE
(
0x107A
),
INTEL_E1000_ETHERNET_DEVICE
(
0x107B
),
INTEL_E1000_ETHERNET_DEVICE
(
0x107C
),
INTEL_E1000_ETHERNET_DEVICE
(
0x108A
),
/* required last entry */
{
0
,}
};
...
...
@@ -128,8 +138,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
static
struct
net_device_stats
*
e1000_get_stats
(
struct
net_device
*
netdev
);
static
int
e1000_change_mtu
(
struct
net_device
*
netdev
,
int
new_mtu
);
static
int
e1000_set_mac
(
struct
net_device
*
netdev
,
void
*
p
);
static
void
e1000_irq_disable
(
struct
e1000_adapter
*
adapter
);
static
void
e1000_irq_enable
(
struct
e1000_adapter
*
adapter
);
static
irqreturn_t
e1000_intr
(
int
irq
,
void
*
data
,
struct
pt_regs
*
regs
);
static
boolean_t
e1000_clean_tx_irq
(
struct
e1000_adapter
*
adapter
);
#ifdef CONFIG_E1000_NAPI
...
...
@@ -146,9 +154,6 @@ static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
void
set_ethtool_ops
(
struct
net_device
*
netdev
);
static
void
e1000_enter_82542_rst
(
struct
e1000_adapter
*
adapter
);
static
void
e1000_leave_82542_rst
(
struct
e1000_adapter
*
adapter
);
static
void
e1000_rx_checksum
(
struct
e1000_adapter
*
adapter
,
struct
e1000_rx_desc
*
rx_desc
,
struct
sk_buff
*
skb
);
static
void
e1000_tx_timeout
(
struct
net_device
*
dev
);
static
void
e1000_tx_timeout_task
(
struct
net_device
*
dev
);
static
void
e1000_smartspeed
(
struct
e1000_adapter
*
adapter
);
...
...
@@ -242,6 +247,33 @@ e1000_exit_module(void)
module_exit
(
e1000_exit_module
);
/**
* e1000_irq_disable - Mask off interrupt generation on the NIC
* @adapter: board private structure
**/
static
inline
void
e1000_irq_disable
(
struct
e1000_adapter
*
adapter
)
{
atomic_inc
(
&
adapter
->
irq_sem
);
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMC
,
~
0
);
E1000_WRITE_FLUSH
(
&
adapter
->
hw
);
synchronize_irq
(
adapter
->
pdev
->
irq
);
}
/**
* e1000_irq_enable - Enable default interrupt generation settings
* @adapter: board private structure
**/
static
inline
void
e1000_irq_enable
(
struct
e1000_adapter
*
adapter
)
{
if
(
likely
(
atomic_dec_and_test
(
&
adapter
->
irq_sem
)))
{
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMS
,
IMS_ENABLE_MASK
);
E1000_WRITE_FLUSH
(
&
adapter
->
hw
);
}
}
int
e1000_up
(
struct
e1000_adapter
*
adapter
)
...
...
@@ -475,8 +507,6 @@ e1000_probe(struct pci_dev *pdev,
NETIF_F_HW_VLAN_TX
|
NETIF_F_HW_VLAN_RX
|
NETIF_F_HW_VLAN_FILTER
;
}
else
{
netdev
->
features
=
NETIF_F_SG
;
}
#ifdef NETIF_F_TSO
...
...
@@ -1061,6 +1091,24 @@ e1000_free_tx_resources(struct e1000_adapter *adapter)
adapter
->
tx_ring
.
desc
=
NULL
;
}
static
inline
void
e1000_unmap_and_free_tx_resource
(
struct
e1000_adapter
*
adapter
,
struct
e1000_buffer
*
buffer_info
)
{
struct
pci_dev
*
pdev
=
adapter
->
pdev
;
if
(
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
;
}
}
/**
* e1000_clean_tx_ring - Free Tx Buffers
* @adapter: board private structure
...
...
@@ -1071,7 +1119,6 @@ e1000_clean_tx_ring(struct e1000_adapter *adapter)
{
struct
e1000_desc_ring
*
tx_ring
=
&
adapter
->
tx_ring
;
struct
e1000_buffer
*
buffer_info
;
struct
pci_dev
*
pdev
=
adapter
->
pdev
;
unsigned
long
size
;
unsigned
int
i
;
...
...
@@ -1079,17 +1126,7 @@ e1000_clean_tx_ring(struct e1000_adapter *adapter)
for
(
i
=
0
;
i
<
tx_ring
->
count
;
i
++
)
{
buffer_info
=
&
tx_ring
->
buffer_info
[
i
];
if
(
buffer_info
->
skb
)
{
pci_unmap_page
(
pdev
,
buffer_info
->
dma
,
buffer_info
->
length
,
PCI_DMA_TODEVICE
);
dev_kfree_skb
(
buffer_info
->
skb
);
buffer_info
->
skb
=
NULL
;
}
e1000_unmap_and_free_tx_resource
(
adapter
,
buffer_info
);
}
size
=
sizeof
(
struct
e1000_buffer
)
*
tx_ring
->
count
;
...
...
@@ -1762,7 +1799,6 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
unsigned
int
mss
=
0
;
int
count
=
0
;
unsigned
int
f
;
nr_frags
=
skb_shinfo
(
skb
)
->
nr_frags
;
len
-=
skb
->
data_len
;
if
(
unlikely
(
skb
->
len
<=
0
))
{
...
...
@@ -1811,7 +1847,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
/* 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
(
unlikely
(
E1000_DESC_UNUSED
(
&
adapter
->
tx_ring
)
<
count
+
2
)
)
{
netif_stop_queue
(
netdev
);
spin_unlock_irqrestore
(
&
adapter
->
tx_lock
,
flags
);
return
NETDEV_TX_BUSY
;
...
...
@@ -1844,6 +1880,10 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
netdev
->
trans_start
=
jiffies
;
/* Make sure there is space in the ring for the next send. */
if
(
unlikely
(
E1000_DESC_UNUSED
(
&
adapter
->
tx_ring
)
<
MAX_SKB_FRAGS
+
2
))
netif_stop_queue
(
netdev
);
spin_unlock_irqrestore
(
&
adapter
->
tx_lock
,
flags
);
return
NETDEV_TX_OK
;
}
...
...
@@ -2073,34 +2113,6 @@ e1000_update_stats(struct e1000_adapter *adapter)
spin_unlock_irqrestore
(
&
adapter
->
stats_lock
,
flags
);
}
/**
* e1000_irq_disable - Mask off interrupt generation on the NIC
* @adapter: board private structure
**/
static
void
e1000_irq_disable
(
struct
e1000_adapter
*
adapter
)
{
atomic_inc
(
&
adapter
->
irq_sem
);
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMC
,
~
0
);
E1000_WRITE_FLUSH
(
&
adapter
->
hw
);
synchronize_irq
(
adapter
->
pdev
->
irq
);
}
/**
* e1000_irq_enable - Enable default interrupt generation settings
* @adapter: board private structure
**/
static
void
e1000_irq_enable
(
struct
e1000_adapter
*
adapter
)
{
if
(
likely
(
atomic_dec_and_test
(
&
adapter
->
irq_sem
)))
{
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMS
,
IMS_ENABLE_MASK
);
E1000_WRITE_FLUSH
(
&
adapter
->
hw
);
}
}
/**
* e1000_intr - Interrupt Handler
* @irq: interrupt number
...
...
@@ -2162,6 +2174,9 @@ e1000_clean(struct net_device *netdev, int *budget)
int
tx_cleaned
;
int
work_done
=
0
;
if
(
!
netif_carrier_ok
(
netdev
))
goto
quit_polling
;
tx_cleaned
=
e1000_clean_tx_irq
(
adapter
);
e1000_clean_rx_irq
(
adapter
,
&
work_done
,
work_to_do
);
...
...
@@ -2171,7 +2186,7 @@ e1000_clean(struct net_device *netdev, int *budget)
/* 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
);
quit_polling:
netif_rx_complete
(
netdev
);
e1000_irq_enable
(
adapter
);
return
0
;
}
...
...
@@ -2190,7 +2205,6 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter)
{
struct
e1000_desc_ring
*
tx_ring
=
&
adapter
->
tx_ring
;
struct
net_device
*
netdev
=
adapter
->
netdev
;
struct
pci_dev
*
pdev
=
adapter
->
pdev
;
struct
e1000_tx_desc
*
tx_desc
,
*
eop_desc
;
struct
e1000_buffer
*
buffer_info
;
unsigned
int
i
,
eop
;
...
...
@@ -2205,19 +2219,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter)
tx_desc
=
E1000_TX_DESC
(
*
tx_ring
,
i
);
buffer_info
=
&
tx_ring
->
buffer_info
[
i
];
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
;
}
e1000_unmap_and_free_tx_resource
(
adapter
,
buffer_info
);
tx_desc
->
buffer_addr
=
0
;
tx_desc
->
lower
.
data
=
0
;
tx_desc
->
upper
.
data
=
0
;
...
...
@@ -2243,6 +2245,41 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter)
return
cleaned
;
}
/**
* e1000_rx_checksum - Receive Checksum Offload for 82543
* @adapter: board private structure
* @rx_desc: receive descriptor
* @sk_buff: socket buffer with received data
**/
static
inline
void
e1000_rx_checksum
(
struct
e1000_adapter
*
adapter
,
struct
e1000_rx_desc
*
rx_desc
,
struct
sk_buff
*
skb
)
{
/* 82543 or newer only */
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
))))
{
skb
->
ip_summed
=
CHECKSUM_NONE
;
return
;
}
/* At this point we know the hardware did the TCP checksum */
/* now look at the TCP checksum error bit */
if
(
rx_desc
->
errors
&
E1000_RXD_ERR_TCPE
)
{
/* let the stack verify checksum errors */
skb
->
ip_summed
=
CHECKSUM_NONE
;
adapter
->
hw_csum_err
++
;
}
else
{
/* TCP checksum is good */
skb
->
ip_summed
=
CHECKSUM_UNNECESSARY
;
adapter
->
hw_csum_good
++
;
}
}
/**
* e1000_clean_rx_irq - Send received data up the network stack
* @adapter: board private structure
...
...
@@ -2376,8 +2413,8 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter)
buffer_info
=
&
rx_ring
->
buffer_info
[
i
];
while
(
!
buffer_info
->
skb
)
{
skb
=
dev_alloc_skb
(
adapter
->
rx_buffer_len
+
NET_IP_ALIGN
);
if
(
unlikely
(
!
skb
))
{
/* Better luck next round */
break
;
...
...
@@ -2587,41 +2624,6 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
return
E1000_SUCCESS
;
}
/**
* e1000_rx_checksum - Receive Checksum Offload for 82543
* @adapter: board private structure
* @rx_desc: receive descriptor
* @sk_buff: socket buffer with received data
**/
static
void
e1000_rx_checksum
(
struct
e1000_adapter
*
adapter
,
struct
e1000_rx_desc
*
rx_desc
,
struct
sk_buff
*
skb
)
{
/* 82543 or newer only */
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
))))
{
skb
->
ip_summed
=
CHECKSUM_NONE
;
return
;
}
/* At this point we know the hardware did the TCP checksum */
/* now look at the TCP checksum error bit */
if
(
rx_desc
->
errors
&
E1000_RXD_ERR_TCPE
)
{
/* let the stack verify checksum errors */
skb
->
ip_summed
=
CHECKSUM_NONE
;
adapter
->
hw_csum_err
++
;
}
else
{
/* TCP checksum is good */
skb
->
ip_summed
=
CHECKSUM_UNNECESSARY
;
adapter
->
hw_csum_good
++
;
}
}
void
e1000_pci_set_mwi
(
struct
e1000_hw
*
hw
)
{
...
...
drivers/net/e1000/e1000_osdep.h
View file @
eda8ba60
...
...
@@ -42,13 +42,8 @@
#include <linux/sched.h>
#ifndef msec_delay
#define msec_delay(x) do { if(in_interrupt()) { \
/* Don't mdelay in interrupt context! */
\
BUG(); \
} else { \
set_current_state(TASK_UNINTERRUPTIBLE); \
schedule_timeout((x * HZ)/1000 + 2); \
} } while(0)
#define msec_delay(x) msleep(x)
/* Some workarounds require millisecond delays and are run during interrupt
* context. Most notably, when establishing link, the phy may need tweaking
* but cannot process phy register reads/writes faster than millisecond
...
...
drivers/net/e1000/e1000_param.c
View file @
eda8ba60
...
...
@@ -47,7 +47,7 @@
#define E1000_PARAM(X, desc) \
static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
static int num_##X = 0; \
module_param_array
(
X, int, &num_##X, 0); \
module_param_array
_named(X,
X, int, &num_##X, 0); \
MODULE_PARM_DESC(X, desc);
/* Transmit Descriptor Count
...
...
@@ -470,9 +470,6 @@ e1000_check_options(struct e1000_adapter *adapter)
if
(
num_InterruptThrottleRate
>
bd
)
{
adapter
->
itr
=
InterruptThrottleRate
[
bd
];
switch
(
adapter
->
itr
)
{
case
-
1
:
adapter
->
itr
=
1
;
break
;
case
0
:
DPRINTK
(
PROBE
,
INFO
,
"%s turned off
\n
"
,
opt
.
name
);
...
...
@@ -481,13 +478,14 @@ e1000_check_options(struct e1000_adapter *adapter)
DPRINTK
(
PROBE
,
INFO
,
"%s set to dynamic mode
\n
"
,
opt
.
name
);
break
;
case
-
1
:
default:
e1000_validate_option
(
&
adapter
->
itr
,
&
opt
,
adapter
);
break
;
}
}
else
{
adapter
->
itr
=
1
;
adapter
->
itr
=
opt
.
def
;
}
}
...
...
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