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
Kirill Smelkov
linux
Commits
6f005af3
Commit
6f005af3
authored
Mar 14, 2002
by
Jes Sorensen
Committed by
Jeff Garzik
Mar 14, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
acenic gige net driver updates:
* various small cleanups * ETHTOOL_GDRVINFO support
parent
88873604
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
19 deletions
+41
-19
drivers/net/acenic.c
drivers/net/acenic.c
+41
-19
No files found.
drivers/net/acenic.c
View file @
6f005af3
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* acenic.c: Linux driver for the Alteon AceNIC Gigabit Ethernet card
* acenic.c: Linux driver for the Alteon AceNIC Gigabit Ethernet card
* and other Tigon based cards.
* and other Tigon based cards.
*
*
* Copyright 1998-200
1
by Jes Sorensen, <jes@trained-monkey.org>.
* Copyright 1998-200
2
by Jes Sorensen, <jes@trained-monkey.org>.
*
*
* Thanks to Alteon and 3Com for providing hardware and documentation
* Thanks to Alteon and 3Com for providing hardware and documentation
* enabling me to write this driver.
* enabling me to write this driver.
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
* Pierrick Pinasseau (CERN): For lending me an Ultra 5 to test the
* Pierrick Pinasseau (CERN): For lending me an Ultra 5 to test the
* driver under Linux/Sparc64
* driver under Linux/Sparc64
* Matt Domsch <Matt_Domsch@dell.com>: Detect Alteon 1000baseT cards
* Matt Domsch <Matt_Domsch@dell.com>: Detect Alteon 1000baseT cards
* ETHTOOL_GDRVINFO support
* Chip Salzenberg <chip@valinux.com>: Fix race condition between tx
* Chip Salzenberg <chip@valinux.com>: Fix race condition between tx
* handler and close() cleanup.
* handler and close() cleanup.
* Ken Aaker <kdaaker@rchland.vnet.ibm.com>: Correct check for whether
* Ken Aaker <kdaaker@rchland.vnet.ibm.com>: Correct check for whether
...
@@ -553,7 +554,7 @@ static int tx_ratio[ACE_MAX_MOD_PARMS];
...
@@ -553,7 +554,7 @@ static int tx_ratio[ACE_MAX_MOD_PARMS];
static
int
dis_pci_mem_inval
[
ACE_MAX_MOD_PARMS
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
};
static
int
dis_pci_mem_inval
[
ACE_MAX_MOD_PARMS
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
};
static
char
version
[]
__initdata
=
static
char
version
[]
__initdata
=
"acenic.c: v0.8
5 11/08/2001
Jes Sorensen, linux-acenic@SunSITE.dk
\n
"
"acenic.c: v0.8
7 03/14/2002
Jes Sorensen, linux-acenic@SunSITE.dk
\n
"
" http://home.cern.ch/~jes/gige/acenic.html
\n
"
;
" http://home.cern.ch/~jes/gige/acenic.html
\n
"
;
static
struct
net_device
*
root_dev
;
static
struct
net_device
*
root_dev
;
...
@@ -620,7 +621,6 @@ int __devinit acenic_probe (ACE_PROBE_ARG)
...
@@ -620,7 +621,6 @@ int __devinit acenic_probe (ACE_PROBE_ARG)
ap
=
dev
->
priv
;
ap
=
dev
->
priv
;
ap
->
pdev
=
pdev
;
ap
->
pdev
=
pdev
;
dev
->
irq
=
pdev
->
irq
;
dev
->
open
=
&
ace_open
;
dev
->
open
=
&
ace_open
;
dev
->
hard_start_xmit
=
&
ace_start_xmit
;
dev
->
hard_start_xmit
=
&
ace_start_xmit
;
dev
->
features
|=
NETIF_F_SG
|
NETIF_F_IP_CSUM
;
dev
->
features
|=
NETIF_F_SG
|
NETIF_F_IP_CSUM
;
...
@@ -725,9 +725,9 @@ int __devinit acenic_probe (ACE_PROBE_ARG)
...
@@ -725,9 +725,9 @@ int __devinit acenic_probe (ACE_PROBE_ARG)
ap
->
name
[
sizeof
(
ap
->
name
)
-
1
]
=
'\0'
;
ap
->
name
[
sizeof
(
ap
->
name
)
-
1
]
=
'\0'
;
printk
(
"Gigabit Ethernet at 0x%08lx, "
,
dev
->
base_addr
);
printk
(
"Gigabit Ethernet at 0x%08lx, "
,
dev
->
base_addr
);
#ifdef __sparc__
#ifdef __sparc__
printk
(
"irq %s
\n
"
,
__irq_itoa
(
dev
->
irq
));
printk
(
"irq %s
\n
"
,
__irq_itoa
(
p
dev
->
irq
));
#else
#else
printk
(
"irq %i
\n
"
,
dev
->
irq
);
printk
(
"irq %i
\n
"
,
p
dev
->
irq
);
#endif
#endif
#ifdef CONFIG_ACENIC_OMIT_TIGON_I
#ifdef CONFIG_ACENIC_OMIT_TIGON_I
...
@@ -1086,6 +1086,7 @@ static int __init ace_init(struct net_device *dev)
...
@@ -1086,6 +1086,7 @@ static int __init ace_init(struct net_device *dev)
struct
ace_private
*
ap
;
struct
ace_private
*
ap
;
struct
ace_regs
*
regs
;
struct
ace_regs
*
regs
;
struct
ace_info
*
info
=
NULL
;
struct
ace_info
*
info
=
NULL
;
struct
pci_dev
*
pdev
;
unsigned
long
myjif
;
unsigned
long
myjif
;
u64
tmp_ptr
;
u64
tmp_ptr
;
u32
tig_ver
,
mac1
,
mac2
,
tmp
,
pci_state
;
u32
tig_ver
,
mac1
,
mac2
,
tmp
,
pci_state
;
...
@@ -1224,7 +1225,8 @@ static int __init ace_init(struct net_device *dev)
...
@@ -1224,7 +1225,8 @@ static int __init ace_init(struct net_device *dev)
* Ie. having two NICs in the machine, one will have the cache
* Ie. having two NICs in the machine, one will have the cache
* line set at boot time, the other will not.
* line set at boot time, the other will not.
*/
*/
pci_read_config_byte
(
ap
->
pdev
,
PCI_CACHE_LINE_SIZE
,
&
cache_size
);
pdev
=
ap
->
pdev
;
pci_read_config_byte
(
pdev
,
PCI_CACHE_LINE_SIZE
,
&
cache_size
);
cache_size
<<=
2
;
cache_size
<<=
2
;
if
(
cache_size
!=
SMP_CACHE_BYTES
)
{
if
(
cache_size
!=
SMP_CACHE_BYTES
)
{
printk
(
KERN_INFO
" PCI cache line size set incorrectly "
printk
(
KERN_INFO
" PCI cache line size set incorrectly "
...
@@ -1233,7 +1235,7 @@ static int __init ace_init(struct net_device *dev)
...
@@ -1233,7 +1235,7 @@ static int __init ace_init(struct net_device *dev)
printk
(
"expecting %i
\n
"
,
SMP_CACHE_BYTES
);
printk
(
"expecting %i
\n
"
,
SMP_CACHE_BYTES
);
else
{
else
{
printk
(
"correcting to %i
\n
"
,
SMP_CACHE_BYTES
);
printk
(
"correcting to %i
\n
"
,
SMP_CACHE_BYTES
);
pci_write_config_byte
(
ap
->
pdev
,
PCI_CACHE_LINE_SIZE
,
pci_write_config_byte
(
pdev
,
PCI_CACHE_LINE_SIZE
,
SMP_CACHE_BYTES
>>
2
);
SMP_CACHE_BYTES
>>
2
);
}
}
}
}
...
@@ -1265,7 +1267,7 @@ static int __init ace_init(struct net_device *dev)
...
@@ -1265,7 +1267,7 @@ static int __init ace_init(struct net_device *dev)
dis_pci_mem_inval
[
board_idx
])
{
dis_pci_mem_inval
[
board_idx
])
{
if
(
ap
->
pci_command
&
PCI_COMMAND_INVALIDATE
)
{
if
(
ap
->
pci_command
&
PCI_COMMAND_INVALIDATE
)
{
ap
->
pci_command
&=
~
PCI_COMMAND_INVALIDATE
;
ap
->
pci_command
&=
~
PCI_COMMAND_INVALIDATE
;
pci_write_config_word
(
ap
->
pdev
,
PCI_COMMAND
,
pci_write_config_word
(
pdev
,
PCI_COMMAND
,
ap
->
pci_command
);
ap
->
pci_command
);
printk
(
KERN_INFO
" Disabling PCI memory "
printk
(
KERN_INFO
" Disabling PCI memory "
"write and invalidate
\n
"
);
"write and invalidate
\n
"
);
...
@@ -1292,7 +1294,7 @@ static int __init ace_init(struct net_device *dev)
...
@@ -1292,7 +1294,7 @@ static int __init ace_init(struct net_device *dev)
"supported, PCI write and invalidate "
"supported, PCI write and invalidate "
"disabled
\n
"
,
SMP_CACHE_BYTES
);
"disabled
\n
"
,
SMP_CACHE_BYTES
);
ap
->
pci_command
&=
~
PCI_COMMAND_INVALIDATE
;
ap
->
pci_command
&=
~
PCI_COMMAND_INVALIDATE
;
pci_write_config_word
(
ap
->
pdev
,
PCI_COMMAND
,
pci_write_config_word
(
pdev
,
PCI_COMMAND
,
ap
->
pci_command
);
ap
->
pci_command
);
}
}
}
}
...
@@ -1334,16 +1336,16 @@ static int __init ace_init(struct net_device *dev)
...
@@ -1334,16 +1336,16 @@ static int __init ace_init(struct net_device *dev)
if (!(ap->pci_command & PCI_COMMAND_FAST_BACK)) {
if (!(ap->pci_command & PCI_COMMAND_FAST_BACK)) {
printk(KERN_INFO " Enabling PCI Fast Back to Back\n");
printk(KERN_INFO " Enabling PCI Fast Back to Back\n");
ap->pci_command |= PCI_COMMAND_FAST_BACK;
ap->pci_command |= PCI_COMMAND_FAST_BACK;
pci_write_config_word(
ap->
pdev, PCI_COMMAND, ap->pci_command);
pci_write_config_word(pdev, PCI_COMMAND, ap->pci_command);
}
}
#endif
#endif
/*
/*
* Configure DMA attributes.
* Configure DMA attributes.
*/
*/
if
(
!
pci_set_dma_mask
(
ap
->
pdev
,
0xffffffffffffffffULL
))
{
if
(
!
pci_set_dma_mask
(
pdev
,
0xffffffffffffffffULL
))
{
ap
->
pci_using_dac
=
1
;
ap
->
pci_using_dac
=
1
;
}
else
if
(
!
pci_set_dma_mask
(
ap
->
pdev
,
0xffffffffULL
))
{
}
else
if
(
!
pci_set_dma_mask
(
pdev
,
0xffffffffULL
))
{
ap
->
pci_using_dac
=
0
;
ap
->
pci_using_dac
=
0
;
}
else
{
}
else
{
ecode
=
-
ENODEV
;
ecode
=
-
ENODEV
;
...
@@ -1370,12 +1372,14 @@ static int __init ace_init(struct net_device *dev)
...
@@ -1370,12 +1372,14 @@ static int __init ace_init(struct net_device *dev)
goto
init_error
;
goto
init_error
;
}
}
ecode
=
request_irq
(
dev
->
irq
,
ace_interrupt
,
SA_SHIRQ
,
dev
->
name
,
dev
);
ecode
=
request_irq
(
pdev
->
irq
,
ace_interrupt
,
SA_SHIRQ
,
dev
->
name
,
dev
);
if
(
ecode
)
{
if
(
ecode
)
{
printk
(
KERN_WARNING
"%s: Requested IRQ %d is busy
\n
"
,
printk
(
KERN_WARNING
"%s: Requested IRQ %d is busy
\n
"
,
dev
->
name
,
dev
->
irq
);
dev
->
name
,
p
dev
->
irq
);
goto
init_error
;
goto
init_error
;
}
}
else
dev
->
irq
=
pdev
->
irq
;
/*
/*
* Register the device here to be able to catch allocated
* Register the device here to be able to catch allocated
...
@@ -2562,6 +2566,7 @@ static int ace_close(struct net_device *dev)
...
@@ -2562,6 +2566,7 @@ static int ace_close(struct net_device *dev)
return
0
;
return
0
;
}
}
static
inline
dma_addr_t
static
inline
dma_addr_t
ace_map_tx_skb
(
struct
ace_private
*
ap
,
struct
sk_buff
*
skb
,
ace_map_tx_skb
(
struct
ace_private
*
ap
,
struct
sk_buff
*
skb
,
struct
sk_buff
*
tail
,
u32
idx
)
struct
sk_buff
*
tail
,
u32
idx
)
...
@@ -2607,7 +2612,6 @@ static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev)
...
@@ -2607,7 +2612,6 @@ static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev)
if
(
early_stop_netif_stop_queue
(
dev
))
if
(
early_stop_netif_stop_queue
(
dev
))
return
1
;
return
1
;
restart:
restart:
idx
=
ap
->
tx_prd
;
idx
=
ap
->
tx_prd
;
...
@@ -2776,8 +2780,8 @@ static int ace_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
...
@@ -2776,8 +2780,8 @@ static int ace_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
return
-
EOPNOTSUPP
;
return
-
EOPNOTSUPP
;
if
(
copy_from_user
(
&
ecmd
,
ifr
->
ifr_data
,
sizeof
(
ecmd
)))
if
(
copy_from_user
(
&
ecmd
,
ifr
->
ifr_data
,
sizeof
(
ecmd
)))
return
-
EFAULT
;
return
-
EFAULT
;
switch
(
ecmd
.
cmd
)
{
if
(
ecmd
.
cmd
==
ETHTOOL_GSET
)
{
case
ETHTOOL_GSET
:
{
ecmd
.
supported
=
ecmd
.
supported
=
(
SUPPORTED_10baseT_Half
|
SUPPORTED_10baseT_Full
|
(
SUPPORTED_10baseT_Half
|
SUPPORTED_10baseT_Full
|
SUPPORTED_100baseT_Half
|
SUPPORTED_100baseT_Full
|
SUPPORTED_100baseT_Half
|
SUPPORTED_100baseT_Full
|
...
@@ -2825,7 +2829,8 @@ static int ace_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
...
@@ -2825,7 +2829,8 @@ static int ace_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if
(
copy_to_user
(
ifr
->
ifr_data
,
&
ecmd
,
sizeof
(
ecmd
)))
if
(
copy_to_user
(
ifr
->
ifr_data
,
&
ecmd
,
sizeof
(
ecmd
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
else
if
(
ecmd
.
cmd
==
ETHTOOL_SSET
)
{
}
case
ETHTOOL_SSET
:
{
if
(
!
capable
(
CAP_NET_ADMIN
))
if
(
!
capable
(
CAP_NET_ADMIN
))
return
-
EPERM
;
return
-
EPERM
;
...
@@ -2883,6 +2888,23 @@ static int ace_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
...
@@ -2883,6 +2888,23 @@ static int ace_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
}
}
return
0
;
return
0
;
}
}
case
ETHTOOL_GDRVINFO
:
{
struct
ethtool_drvinfo
info
=
{
ETHTOOL_GDRVINFO
};
strncpy
(
info
.
driver
,
"acenic"
,
sizeof
(
info
.
driver
)
-
1
);
sprintf
(
info
.
fw_version
,
"%i.%i.%i"
,
tigonFwReleaseMajor
,
tigonFwReleaseMinor
,
tigonFwReleaseFix
);
strncpy
(
info
.
version
,
version
,
sizeof
(
info
.
version
)
-
1
);
if
(
ap
&&
ap
->
pdev
)
strcpy
(
info
.
bus_info
,
ap
->
pdev
->
slot_name
);
if
(
copy_to_user
(
ifr
->
ifr_data
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
0
;
}
default:
break
;
}
#endif
#endif
return
-
EOPNOTSUPP
;
return
-
EOPNOTSUPP
;
...
...
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