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
408d3faf
Commit
408d3faf
authored
Oct 18, 2002
by
Jeb J. Cramer
Committed by
Jeff Garzik
Oct 18, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
e1000 6/10:
* Adding notifier to track ifname change for /proc info
parent
29c4409a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
17 deletions
+53
-17
drivers/net/e1000/e1000.h
drivers/net/e1000/e1000.h
+1
-0
drivers/net/e1000/e1000_main.c
drivers/net/e1000/e1000_main.c
+39
-4
drivers/net/e1000/e1000_proc.c
drivers/net/e1000/e1000_proc.c
+13
-13
No files found.
drivers/net/e1000/e1000.h
View file @
408d3faf
...
...
@@ -203,5 +203,6 @@ struct e1000_adapter {
uint32_t
pci_state
[
16
];
char
ifname
[
IFNAMSIZ
];
};
#endif
/* _E1000_H_ */
drivers/net/e1000/e1000_main.c
View file @
408d3faf
...
...
@@ -182,17 +182,24 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
static
void
e1000_vlan_rx_kill_vid
(
struct
net_device
*
netdev
,
uint16_t
vid
);
static
int
e1000_notify_reboot
(
struct
notifier_block
*
,
unsigned
long
event
,
void
*
ptr
);
static
int
e1000_notify_netdev
(
struct
notifier_block
*
,
unsigned
long
event
,
void
*
ptr
);
static
int
e1000_suspend
(
struct
pci_dev
*
pdev
,
uint32_t
state
);
#ifdef CONFIG_PM
static
int
e1000_resume
(
struct
pci_dev
*
pdev
);
#endif
struct
notifier_block
e1000_notifier
=
{
struct
notifier_block
e1000_notifier
_reboot
=
{
.
notifier_call
=
e1000_notify_reboot
,
.
next
=
NULL
,
.
priority
=
0
};
struct
notifier_block
e1000_notifier_netdev
=
{
.
notifier_call
=
e1000_notify_netdev
,
.
next
=
NULL
,
.
priority
=
0
};
/* Exported from other modules */
extern
void
e1000_check_options
(
struct
e1000_adapter
*
adapter
);
...
...
@@ -233,8 +240,10 @@ e1000_init_module(void)
printk
(
KERN_INFO
"%s
\n
"
,
e1000_copyright
);
ret
=
pci_module_init
(
&
e1000_driver
);
if
(
ret
>=
0
)
register_reboot_notifier
(
&
e1000_notifier
);
if
(
ret
>=
0
)
{
register_reboot_notifier
(
&
e1000_notifier_reboot
);
register_netdevice_notifier
(
&
e1000_notifier_netdev
);
}
return
ret
;
}
...
...
@@ -250,7 +259,8 @@ module_init(e1000_init_module);
static
void
__exit
e1000_exit_module
(
void
)
{
unregister_reboot_notifier
(
&
e1000_notifier
);
unregister_reboot_notifier
(
&
e1000_notifier_reboot
);
unregister_netdevice_notifier
(
&
e1000_notifier_netdev
);
pci_unregister_driver
(
&
e1000_driver
);
}
...
...
@@ -478,6 +488,8 @@ e1000_probe(struct pci_dev *pdev,
(
void
(
*
)(
void
*
))
e1000_tx_timeout_task
,
netdev
);
register_netdev
(
netdev
);
memcpy
(
adapter
->
ifname
,
netdev
->
name
,
IFNAMSIZ
);
adapter
->
ifname
[
IFNAMSIZ
-
1
]
=
0
;
/* we're going to reset, so assume we have no link for now */
...
...
@@ -2397,6 +2409,29 @@ e1000_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)
return
NOTIFY_DONE
;
}
static
int
e1000_notify_netdev
(
struct
notifier_block
*
nb
,
unsigned
long
event
,
void
*
p
)
{
struct
e1000_adapter
*
adapter
;
struct
net_device
*
netdev
=
p
;
if
(
netdev
==
NULL
)
return
NOTIFY_DONE
;
switch
(
event
)
{
case
NETDEV_CHANGENAME
:
if
(
netdev
->
open
==
e1000_open
)
{
adapter
=
netdev
->
priv
;
/* rename the proc nodes the easy way */
e1000_proc_dev_free
(
adapter
);
memcpy
(
adapter
->
ifname
,
netdev
->
name
,
IFNAMSIZ
);
adapter
->
ifname
[
IFNAMSIZ
-
1
]
=
0
;
e1000_proc_dev_setup
(
adapter
);
}
break
;
}
return
NOTIFY_DONE
;
}
static
int
e1000_suspend
(
struct
pci_dev
*
pdev
,
uint32_t
state
)
{
...
...
drivers/net/e1000/e1000_proc.c
View file @
408d3faf
...
...
@@ -132,7 +132,7 @@ e1000_proc_single_read(char *page, char **start, off_t off,
return
e1000_proc_read
(
page
,
start
,
off
,
count
,
eof
);
}
static
void
__devexit
static
void
e1000_proc_dirs_free
(
char
*
name
,
struct
list_head
*
proc_list_head
)
{
struct
proc_dir_entry
*
intel_proc_dir
,
*
proc_dir
;
...
...
@@ -188,7 +188,7 @@ e1000_proc_dirs_free(char *name, struct list_head *proc_list_head)
}
static
int
__devinit
static
int
e1000_proc_singles_create
(
struct
proc_dir_entry
*
parent
,
struct
list_head
*
proc_list_head
)
{
...
...
@@ -215,7 +215,7 @@ e1000_proc_singles_create(struct proc_dir_entry *parent,
return
1
;
}
static
void
__devinit
static
void
e1000_proc_dirs_create
(
void
*
data
,
char
*
name
,
struct
list_head
*
proc_list_head
)
{
...
...
@@ -255,7 +255,7 @@ e1000_proc_dirs_create(void *data, char *name,
info_entry
->
data
=
proc_list_head
;
}
static
void
__devinit
static
void
e1000_proc_list_add
(
struct
list_head
*
proc_list_head
,
char
*
tag
,
void
*
data
,
size_t
len
,
char
*
(
*
func
)(
void
*
,
size_t
,
char
*
))
...
...
@@ -274,7 +274,7 @@ e1000_proc_list_add(struct list_head *proc_list_head, char *tag,
list_add_tail
(
&
new
->
list
,
proc_list_head
);
}
static
void
__devexit
static
void
e1000_proc_list_free
(
struct
list_head
*
proc_list_head
)
{
struct
proc_list
*
elem
;
...
...
@@ -542,7 +542,7 @@ e1000_proc_rx_status(void *data, size_t len, char *buf)
#define LIST_ADD_H(T,D) LIST_ADD_F((T), (D), e1000_proc_hex)
#define LIST_ADD_U(T,D) LIST_ADD_F((T), (D), e1000_proc_unsigned)
static
void
__devinit
static
void
e1000_proc_list_setup
(
struct
e1000_adapter
*
adapter
)
{
struct
e1000_hw
*
hw
=
&
adapter
->
hw
;
...
...
@@ -572,7 +572,7 @@ e1000_proc_list_setup(struct e1000_adapter *adapter)
}
LIST_ADD_U
(
"IRQ"
,
&
adapter
->
pdev
->
irq
);
LIST_ADD_S
(
"System_Device_Name"
,
adapter
->
netdev
->
name
);
LIST_ADD_S
(
"System_Device_Name"
,
adapter
->
if
name
);
LIST_ADD_F
(
"Current_HWaddr"
,
adapter
->
netdev
->
dev_addr
,
e1000_proc_hwaddr
);
LIST_ADD_F
(
"Permanent_HWaddr"
,
...
...
@@ -670,13 +670,13 @@ e1000_proc_list_setup(struct e1000_adapter *adapter)
* @adapter: board private structure
*/
void
__devinit
void
e1000_proc_dev_setup
(
struct
e1000_adapter
*
adapter
)
{
e1000_proc_list_setup
(
adapter
);
e1000_proc_dirs_create
(
adapter
,
adapter
->
netdev
->
name
,
adapter
->
if
name
,
&
adapter
->
proc_list_head
);
}
...
...
@@ -685,18 +685,18 @@ e1000_proc_dev_setup(struct e1000_adapter *adapter)
* @adapter: board private structure
*/
void
__devexit
void
e1000_proc_dev_free
(
struct
e1000_adapter
*
adapter
)
{
e1000_proc_dirs_free
(
adapter
->
netdev
->
name
,
&
adapter
->
proc_list_head
);
e1000_proc_dirs_free
(
adapter
->
if
name
,
&
adapter
->
proc_list_head
);
e1000_proc_list_free
(
&
adapter
->
proc_list_head
);
}
#else
/* CONFIG_PROC_FS */
void
__devinit
e1000_proc_dev_setup
(
struct
e1000_adapter
*
adapter
)
{}
void
__devexit
e1000_proc_dev_free
(
struct
e1000_adapter
*
adapter
)
{}
void
e1000_proc_dev_setup
(
struct
e1000_adapter
*
adapter
)
{}
void
e1000_proc_dev_free
(
struct
e1000_adapter
*
adapter
)
{}
#endif
/* CONFIG_PROC_FS */
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