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
67155877
Commit
67155877
authored
Jan 10, 2004
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[netdrvr tulip] support NAPI
Contributed by Robert Ollsson.
parent
4576b4fa
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
351 additions
and
152 deletions
+351
-152
drivers/net/tulip/Kconfig
drivers/net/tulip/Kconfig
+20
-0
drivers/net/tulip/interrupt.c
drivers/net/tulip/interrupt.c
+300
-110
drivers/net/tulip/tulip.h
drivers/net/tulip/tulip.h
+11
-7
drivers/net/tulip/tulip_core.c
drivers/net/tulip/tulip_core.c
+20
-35
No files found.
drivers/net/tulip/Kconfig
View file @
67155877
...
@@ -68,6 +68,26 @@ config TULIP_MMIO
...
@@ -68,6 +68,26 @@ config TULIP_MMIO
obscure bugs if your mainboard has memory controller timing issues.
obscure bugs if your mainboard has memory controller timing issues.
If in doubt, say N.
If in doubt, say N.
config TULIP_NAPI
bool "Use NAPI RX polling "
depends on TULIP
---help---
This is of useful for servers and routers dealing with high network loads.
See <file:Documentation/networking/NAPI_HOWTO.txt>.
If in doubt, say N.
config TULIP_NAPI_HW_MITIGATION
bool "Use Interrupt Mitigation "
depends on TULIP_NAPI
---help---
Use HW to reduce RX interrupts. Not strict necessary since NAPI reduces
RX interrupts but itself. Although this reduces RX interrupts even at
low levels traffic at the cost of a small latency.
If in doubt, say Y.
config DE4X5
config DE4X5
tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA"
tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA"
depends on NET_TULIP && (PCI || EISA)
depends on NET_TULIP && (PCI || EISA)
...
...
drivers/net/tulip/interrupt.c
View file @
67155877
This diff is collapsed.
Click to expand it.
drivers/net/tulip/tulip.h
View file @
67155877
...
@@ -126,6 +126,7 @@ enum pci_cfg_driver_reg {
...
@@ -126,6 +126,7 @@ enum pci_cfg_driver_reg {
CFDD_Snooze
=
(
1
<<
30
),
CFDD_Snooze
=
(
1
<<
30
),
};
};
#define RxPollInt (RxIntr|RxNoBuf|RxDied|RxJabber)
/* The bits in the CSR5 status registers, mostly interrupt sources. */
/* The bits in the CSR5 status registers, mostly interrupt sources. */
enum
status_bits
{
enum
status_bits
{
...
@@ -251,9 +252,9 @@ enum t21143_csr6_bits {
...
@@ -251,9 +252,9 @@ enum t21143_csr6_bits {
Making the Tx ring too large decreases the effectiveness of channel
Making the Tx ring too large decreases the effectiveness of channel
bonding and packet priority.
bonding and packet priority.
There are no ill effects from too-large receive rings. */
There are no ill effects from too-large receive rings. */
#define TX_RING_SIZE 16
#define RX_RING_SIZE 32
#define TX_RING_SIZE 32
#define RX_RING_SIZE 128
#define MEDIA_MASK 31
#define MEDIA_MASK 31
#define PKT_BUF_SZ 1536
/* Size of each temporary Rx buffer. */
#define PKT_BUF_SZ 1536
/* Size of each temporary Rx buffer. */
...
@@ -343,17 +344,15 @@ struct tulip_private {
...
@@ -343,17 +344,15 @@ struct tulip_private {
int
flags
;
int
flags
;
struct
net_device_stats
stats
;
struct
net_device_stats
stats
;
struct
timer_list
timer
;
/* Media selection timer. */
struct
timer_list
timer
;
/* Media selection timer. */
struct
timer_list
oom_timer
;
/* Out of memory timer. */
u32
mc_filter
[
2
];
u32
mc_filter
[
2
];
spinlock_t
lock
;
spinlock_t
lock
;
spinlock_t
mii_lock
;
spinlock_t
mii_lock
;
unsigned
int
cur_rx
,
cur_tx
;
/* The next free ring entry */
unsigned
int
cur_rx
,
cur_tx
;
/* The next free ring entry */
unsigned
int
dirty_rx
,
dirty_tx
;
/* The ring entries to be free()ed. */
unsigned
int
dirty_rx
,
dirty_tx
;
/* The ring entries to be free()ed. */
#ifdef CONFIG_NET_HW_FLOWCONTROL
#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
#define RX_A_NBF_STOP 0xffffff3f
/* To disable RX and RX-NOBUF ints. */
int
mit_on
;
int
fc_bit
;
int
mit_sel
;
int
mit_change
;
/* Signal for Interrupt Mitigtion */
#endif
#endif
unsigned
int
full_duplex
:
1
;
/* Full-duplex operation requested. */
unsigned
int
full_duplex
:
1
;
/* Full-duplex operation requested. */
unsigned
int
full_duplex_lock
:
1
;
unsigned
int
full_duplex_lock
:
1
;
...
@@ -415,6 +414,10 @@ extern unsigned int tulip_max_interrupt_work;
...
@@ -415,6 +414,10 @@ extern unsigned int tulip_max_interrupt_work;
extern
int
tulip_rx_copybreak
;
extern
int
tulip_rx_copybreak
;
irqreturn_t
tulip_interrupt
(
int
irq
,
void
*
dev_instance
,
struct
pt_regs
*
regs
);
irqreturn_t
tulip_interrupt
(
int
irq
,
void
*
dev_instance
,
struct
pt_regs
*
regs
);
int
tulip_refill_rx
(
struct
net_device
*
dev
);
int
tulip_refill_rx
(
struct
net_device
*
dev
);
#ifdef CONFIG_TULIP_NAPI
int
tulip_poll
(
struct
net_device
*
dev
,
int
*
budget
);
#endif
/* media.c */
/* media.c */
int
tulip_mdio_read
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
);
int
tulip_mdio_read
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
);
...
@@ -438,6 +441,7 @@ extern int tulip_debug;
...
@@ -438,6 +441,7 @@ extern int tulip_debug;
extern
const
char
*
const
medianame
[];
extern
const
char
*
const
medianame
[];
extern
const
char
tulip_media_cap
[];
extern
const
char
tulip_media_cap
[];
extern
struct
tulip_chip_table
tulip_tbl
[];
extern
struct
tulip_chip_table
tulip_tbl
[];
void
oom_timer
(
unsigned
long
data
);
extern
u8
t21040_csr13
[];
extern
u8
t21040_csr13
[];
#ifndef USE_IO_OPS
#ifndef USE_IO_OPS
...
...
drivers/net/tulip/tulip_core.c
View file @
67155877
...
@@ -14,11 +14,17 @@
...
@@ -14,11 +14,17 @@
*/
*/
#include <linux/config.h>
#define DRV_NAME "tulip"
#define DRV_NAME "tulip"
#ifdef CONFIG_TULIP_NAPI
#define DRV_VERSION "1.1.13-NAPI"
/* Keep at least for test */
#else
#define DRV_VERSION "1.1.13"
#define DRV_VERSION "1.1.13"
#endif
#define DRV_RELDATE "May 11, 2002"
#define DRV_RELDATE "May 11, 2002"
#include <linux/config.h>
#include <linux/module.h>
#include <linux/module.h>
#include "tulip.h"
#include "tulip.h"
#include <linux/pci.h>
#include <linux/pci.h>
...
@@ -466,29 +472,16 @@ static void tulip_up(struct net_device *dev)
...
@@ -466,29 +472,16 @@ static void tulip_up(struct net_device *dev)
to an alternate media type. */
to an alternate media type. */
tp
->
timer
.
expires
=
RUN_AT
(
next_tick
);
tp
->
timer
.
expires
=
RUN_AT
(
next_tick
);
add_timer
(
&
tp
->
timer
);
add_timer
(
&
tp
->
timer
);
}
#ifdef CONFIG_TULIP_NAPI
init_timer
(
&
tp
->
oom_timer
);
#ifdef CONFIG_NET_HW_FLOWCONTROL
tp
->
oom_timer
.
data
=
(
unsigned
long
)
dev
;
/* Enable receiver */
tp
->
oom_timer
.
function
=
oom_timer
;
void
tulip_xon
(
struct
net_device
*
dev
)
{
struct
tulip_private
*
tp
=
(
struct
tulip_private
*
)
dev
->
priv
;
clear_bit
(
tp
->
fc_bit
,
&
netdev_fc_xoff
);
if
(
netif_running
(
dev
)){
tulip_refill_rx
(
dev
);
outl
(
tulip_tbl
[
tp
->
chip_id
].
valid_intrs
,
dev
->
base_addr
+
CSR7
);
}
}
#endif
#endif
}
static
int
static
int
tulip_open
(
struct
net_device
*
dev
)
tulip_open
(
struct
net_device
*
dev
)
{
{
#ifdef CONFIG_NET_HW_FLOWCONTROL
struct
tulip_private
*
tp
=
(
struct
tulip_private
*
)
dev
->
priv
;
#endif
int
retval
;
int
retval
;
if
((
retval
=
request_irq
(
dev
->
irq
,
&
tulip_interrupt
,
SA_SHIRQ
,
dev
->
name
,
dev
)))
if
((
retval
=
request_irq
(
dev
->
irq
,
&
tulip_interrupt
,
SA_SHIRQ
,
dev
->
name
,
dev
)))
...
@@ -498,10 +491,6 @@ tulip_open(struct net_device *dev)
...
@@ -498,10 +491,6 @@ tulip_open(struct net_device *dev)
tulip_up
(
dev
);
tulip_up
(
dev
);
#ifdef CONFIG_NET_HW_FLOWCONTROL
tp
->
fc_bit
=
netdev_register_fc
(
dev
,
tulip_xon
);
#endif
netif_start_queue
(
dev
);
netif_start_queue
(
dev
);
return
0
;
return
0
;
...
@@ -582,10 +571,7 @@ static void tulip_tx_timeout(struct net_device *dev)
...
@@ -582,10 +571,7 @@ static void tulip_tx_timeout(struct net_device *dev)
#endif
#endif
/* Stop and restart the chip's Tx processes . */
/* Stop and restart the chip's Tx processes . */
#ifdef CONFIG_NET_HW_FLOWCONTROL
if
(
tp
->
fc_bit
&&
test_bit
(
tp
->
fc_bit
,
&
netdev_fc_xoff
))
printk
(
"BUG tx_timeout restarting rx when fc on
\n
"
);
#endif
tulip_restart_rxtx
(
tp
);
tulip_restart_rxtx
(
tp
);
/* Trigger an immediate transmit demand. */
/* Trigger an immediate transmit demand. */
outl
(
0
,
ioaddr
+
CSR1
);
outl
(
0
,
ioaddr
+
CSR1
);
...
@@ -742,7 +728,9 @@ static void tulip_down (struct net_device *dev)
...
@@ -742,7 +728,9 @@ static void tulip_down (struct net_device *dev)
unsigned
long
flags
;
unsigned
long
flags
;
del_timer_sync
(
&
tp
->
timer
);
del_timer_sync
(
&
tp
->
timer
);
#ifdef CONFIG_TULIP_NAPI
del_timer_sync
(
&
tp
->
oom_timer
);
#endif
spin_lock_irqsave
(
&
tp
->
lock
,
flags
);
spin_lock_irqsave
(
&
tp
->
lock
,
flags
);
/* Disable interrupts by clearing the interrupt mask. */
/* Disable interrupts by clearing the interrupt mask. */
...
@@ -781,13 +769,6 @@ static int tulip_close (struct net_device *dev)
...
@@ -781,13 +769,6 @@ static int tulip_close (struct net_device *dev)
netif_stop_queue
(
dev
);
netif_stop_queue
(
dev
);
#ifdef CONFIG_NET_HW_FLOWCONTROL
if
(
tp
->
fc_bit
)
{
int
bit
=
tp
->
fc_bit
;
tp
->
fc_bit
=
0
;
netdev_unregister_fc
(
bit
);
}
#endif
tulip_down
(
dev
);
tulip_down
(
dev
);
if
(
tulip_debug
>
1
)
if
(
tulip_debug
>
1
)
...
@@ -1629,6 +1610,10 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
...
@@ -1629,6 +1610,10 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
dev
->
hard_start_xmit
=
tulip_start_xmit
;
dev
->
hard_start_xmit
=
tulip_start_xmit
;
dev
->
tx_timeout
=
tulip_tx_timeout
;
dev
->
tx_timeout
=
tulip_tx_timeout
;
dev
->
watchdog_timeo
=
TX_TIMEOUT
;
dev
->
watchdog_timeo
=
TX_TIMEOUT
;
#ifdef CONFIG_TULIP_NAPI
dev
->
poll
=
tulip_poll
;
dev
->
weight
=
16
;
#endif
dev
->
stop
=
tulip_close
;
dev
->
stop
=
tulip_close
;
dev
->
get_stats
=
tulip_get_stats
;
dev
->
get_stats
=
tulip_get_stats
;
dev
->
do_ioctl
=
private_ioctl
;
dev
->
do_ioctl
=
private_ioctl
;
...
...
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