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
93f47055
Commit
93f47055
authored
Sep 11, 2003
by
Amir Noam
Committed by
Stephen Hemminger
Sep 11, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[bonding 2.6] make each bond device use its own /proc entry
parent
d8bf4cb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
106 deletions
+102
-106
drivers/net/bonding/bond_main.c
drivers/net/bonding/bond_main.c
+102
-106
No files found.
drivers/net/bonding/bond_main.c
View file @
93f47055
...
@@ -545,14 +545,6 @@ static int bond_release(struct net_device *master, struct net_device *slave);
...
@@ -545,14 +545,6 @@ static int bond_release(struct net_device *master, struct net_device *slave);
static
int
bond_release_all
(
struct
net_device
*
master
);
static
int
bond_release_all
(
struct
net_device
*
master
);
static
int
bond_sethwaddr
(
struct
net_device
*
master
,
struct
net_device
*
slave
);
static
int
bond_sethwaddr
(
struct
net_device
*
master
,
struct
net_device
*
slave
);
/*
* bond_get_info is the interface into the /proc filesystem. This is
* a different interface than the BOND_INFO_QUERY ioctl. That is done
* through the generic networking ioctl interface, and bond_info_query
* is the internal function which provides that information.
*/
static
int
bond_get_info
(
char
*
buf
,
char
**
start
,
off_t
offset
,
int
length
);
/* Caller must hold bond->ptrlock for write */
/* Caller must hold bond->ptrlock for write */
static
inline
struct
slave
*
static
inline
struct
slave
*
bond_assign_current_slave
(
struct
bonding
*
bond
,
struct
slave
*
newslave
)
bond_assign_current_slave
(
struct
bonding
*
bond
,
struct
slave
*
newslave
)
...
@@ -3337,132 +3329,136 @@ static struct net_device_stats *bond_get_stats(struct net_device *dev)
...
@@ -3337,132 +3329,136 @@ static struct net_device_stats *bond_get_stats(struct net_device *dev)
return
stats
;
return
stats
;
}
}
static
int
bond_get_info
(
char
*
buf
,
char
**
start
,
off_t
offset
,
int
length
)
#ifdef CONFIG_PROC_FS
static
int
bond_read_proc
(
char
*
buf
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
bonding_t
*
bond
;
struct
bonding
*
bond
=
(
struct
bonding
*
)
data
;
int
len
=
0
;
int
len
=
0
;
off_t
begin
=
0
;
u16
link
;
u16
link
;
slave_t
*
slave
=
NULL
;
slave_t
*
slave
=
NULL
;
/* make sure the bond won't be taken away */
read_lock
(
&
dev_base_lock
);
len
+=
sprintf
(
buf
+
len
,
"%s
\n
"
,
version
);
len
+=
sprintf
(
buf
+
len
,
"%s
\n
"
,
version
);
read_lock
(
&
dev_base_lock
);
/*
list_for_each_entry
(
bond
,
&
bond_dev_list
,
bond_list
)
{
* This function locks the mutex, so we can't lock it until
/*
* afterwards
* This function locks the mutex, so we can't lock it until
*/
* afterwards
link
=
bond_check_mii_link
(
bond
);
*/
link
=
bond_check_mii_link
(
bond
);
len
+=
sprintf
(
buf
+
len
,
"Bonding Mode: %s
\n
"
,
len
+=
sprintf
(
buf
+
len
,
"Bonding Mode: %s
\n
"
,
bond_mode_name
());
bond_mode_name
());
if
((
bond_mode
==
BOND_MODE_ACTIVEBACKUP
)
||
if
((
bond_mode
==
BOND_MODE_ACTIVEBACKUP
)
||
(
bond_mode
==
BOND_MODE_TLB
)
||
(
bond_mode
==
BOND_MODE_TLB
)
||
(
bond_mode
==
BOND_MODE_ALB
))
{
(
bond_mode
==
BOND_MODE_ALB
))
{
read_lock_bh
(
&
bond
->
lock
);
read_lock_bh
(
&
bond
->
lock
);
read_lock
(
&
bond
->
ptrlock
);
read_lock
(
&
bond
->
ptrlock
);
if
(
bond
->
current_slave
!=
NULL
)
{
if
(
bond
->
current_slave
!=
NULL
)
{
len
+=
sprintf
(
buf
+
len
,
len
+=
sprintf
(
buf
+
len
,
"Currently Active Slave: %s
\n
"
,
"Currently Active Slave: %s
\n
"
,
bond
->
current_slave
->
dev
->
name
);
bond
->
current_slave
->
dev
->
name
);
}
read_unlock
(
&
bond
->
ptrlock
);
read_unlock_bh
(
&
bond
->
lock
);
}
}
read_unlock
(
&
bond
->
ptrlock
);
read_unlock_bh
(
&
bond
->
lock
);
}
len
+=
sprintf
(
buf
+
len
,
"MII Status: "
);
len
+=
sprintf
(
buf
+
len
,
"MII Status: "
);
len
+=
sprintf
(
buf
+
len
,
len
+=
sprintf
(
buf
+
len
,
link
==
BMSR_LSTATUS
?
"up
\n
"
:
"down
\n
"
);
link
==
BMSR_LSTATUS
?
"up
\n
"
:
"down
\n
"
);
len
+=
sprintf
(
buf
+
len
,
"MII Polling Interval (ms): %d
\n
"
,
len
+=
sprintf
(
buf
+
len
,
"MII Polling Interval (ms): %d
\n
"
,
miimon
);
miimon
);
len
+=
sprintf
(
buf
+
len
,
"Up Delay (ms): %d
\n
"
,
len
+=
sprintf
(
buf
+
len
,
"Up Delay (ms): %d
\n
"
,
updelay
*
miimon
);
updelay
*
miimon
);
len
+=
sprintf
(
buf
+
len
,
"Down Delay (ms): %d
\n
"
,
len
+=
sprintf
(
buf
+
len
,
"Down Delay (ms): %d
\n
"
,
downdelay
*
miimon
);
downdelay
*
miimon
);
len
+=
sprintf
(
buf
+
len
,
"Multicast Mode: %s
\n
"
,
len
+=
sprintf
(
buf
+
len
,
"Multicast Mode: %s
\n
"
,
multicast_mode_name
());
multicast_mode_name
());
read_lock_bh
(
&
bond
->
lock
);
read_lock_bh
(
&
bond
->
lock
);
if
(
bond_mode
==
BOND_MODE_8023AD
)
{
if
(
bond_mode
==
BOND_MODE_8023AD
)
{
struct
ad_info
ad_info
;
struct
ad_info
ad_info
;
len
+=
sprintf
(
buf
+
len
,
"
\n
802.3ad info
\n
"
);
len
+=
sprintf
(
buf
+
len
,
"
\n
802.3ad info
\n
"
);
if
(
bond_3ad_get_active_agg_info
(
bond
,
&
ad_info
))
{
if
(
bond_3ad_get_active_agg_info
(
bond
,
&
ad_info
))
{
len
+=
sprintf
(
buf
+
len
,
"bond %s has no active aggregator
\n
"
,
bond
->
device
->
name
);
len
+=
sprintf
(
buf
+
len
,
"bond %s has no active aggregator
\n
"
,
bond
->
device
->
name
);
}
else
{
}
else
{
len
+=
sprintf
(
buf
+
len
,
"Active Aggregator Info:
\n
"
);
len
+=
sprintf
(
buf
+
len
,
"Active Aggregator Info:
\n
"
);
len
+=
sprintf
(
buf
+
len
,
"
\t
Aggregator ID: %d
\n
"
,
ad_info
.
aggregator_id
);
len
+=
sprintf
(
buf
+
len
,
"
\t
Aggregator ID: %d
\n
"
,
ad_info
.
aggregator_id
);
len
+=
sprintf
(
buf
+
len
,
"
\t
Number of ports: %d
\n
"
,
ad_info
.
ports
);
len
+=
sprintf
(
buf
+
len
,
"
\t
Number of ports: %d
\n
"
,
ad_info
.
ports
);
len
+=
sprintf
(
buf
+
len
,
"
\t
Actor Key: %d
\n
"
,
ad_info
.
actor_key
);
len
+=
sprintf
(
buf
+
len
,
"
\t
Actor Key: %d
\n
"
,
ad_info
.
actor_key
);
len
+=
sprintf
(
buf
+
len
,
"
\t
Partner Key: %d
\n
"
,
ad_info
.
partner_key
);
len
+=
sprintf
(
buf
+
len
,
"
\t
Partner Key: %d
\n
"
,
ad_info
.
partner_key
);
len
+=
sprintf
(
buf
+
len
,
"
\t
Partner Mac Address: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
len
+=
sprintf
(
buf
+
len
,
"
\t
Partner Mac Address: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
ad_info
.
partner_system
[
0
],
ad_info
.
partner_system
[
0
],
ad_info
.
partner_system
[
1
],
ad_info
.
partner_system
[
1
],
ad_info
.
partner_system
[
2
],
ad_info
.
partner_system
[
2
],
ad_info
.
partner_system
[
3
],
ad_info
.
partner_system
[
3
],
ad_info
.
partner_system
[
4
],
ad_info
.
partner_system
[
4
],
ad_info
.
partner_system
[
5
]);
ad_info
.
partner_system
[
5
]);
}
}
}
}
for
(
slave
=
bond
->
prev
;
slave
!=
(
slave_t
*
)
bond
;
for
(
slave
=
bond
->
prev
;
slave
!=
(
slave_t
*
)
bond
;
slave
=
slave
->
prev
)
{
slave
=
slave
->
prev
)
{
len
+=
sprintf
(
buf
+
len
,
"
\n
Slave Interface: %s
\n
"
,
slave
->
dev
->
name
);
len
+=
sprintf
(
buf
+
len
,
"
\n
Slave Interface: %s
\n
"
,
slave
->
dev
->
name
);
len
+=
sprintf
(
buf
+
len
,
"MII Status: "
);
len
+=
sprintf
(
buf
+
len
,
"MII Status: "
);
len
+=
sprintf
(
buf
+
len
,
len
+=
sprintf
(
buf
+
len
,
slave
->
link
==
BOND_LINK_UP
?
slave
->
link
==
BOND_LINK_UP
?
"up
\n
"
:
"down
\n
"
);
"up
\n
"
:
"down
\n
"
);
len
+=
sprintf
(
buf
+
len
,
"Link Failure Count: %d
\n
"
,
len
+=
sprintf
(
buf
+
len
,
"Link Failure Count: %d
\n
"
,
slave
->
link_failure_count
);
slave
->
link_failure_count
);
if
(
app_abi_ver
>=
1
)
{
if
(
app_abi_ver
>=
1
)
{
len
+=
sprintf
(
buf
+
len
,
len
+=
sprintf
(
buf
+
len
,
"Permanent HW addr: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
"Permanent HW addr: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
slave
->
perm_hwaddr
[
0
],
slave
->
perm_hwaddr
[
0
],
slave
->
perm_hwaddr
[
1
],
slave
->
perm_hwaddr
[
1
],
slave
->
perm_hwaddr
[
2
],
slave
->
perm_hwaddr
[
2
],
slave
->
perm_hwaddr
[
3
],
slave
->
perm_hwaddr
[
3
],
slave
->
perm_hwaddr
[
4
],
slave
->
perm_hwaddr
[
4
],
slave
->
perm_hwaddr
[
5
]);
slave
->
perm_hwaddr
[
5
]);
}
}
if
(
bond_mode
==
BOND_MODE_8023AD
)
{
if
(
bond_mode
==
BOND_MODE_8023AD
)
{
struct
aggregator
*
agg
=
SLAVE_AD_INFO
(
slave
).
port
.
aggregator
;
struct
aggregator
*
agg
=
SLAVE_AD_INFO
(
slave
).
port
.
aggregator
;
if
(
agg
)
{
if
(
agg
)
{
len
+=
sprintf
(
buf
+
len
,
"Aggregator ID: %d
\n
"
,
len
+=
sprintf
(
buf
+
len
,
"Aggregator ID: %d
\n
"
,
agg
->
aggregator_identifier
);
agg
->
aggregator_identifier
);
}
else
{
}
else
{
len
+=
sprintf
(
buf
+
len
,
"Aggregator ID: N/A
\n
"
);
len
+=
sprintf
(
buf
+
len
,
"Aggregator ID: N/A
\n
"
);
}
}
}
}
}
read_unlock_bh
(
&
bond
->
lock
);
}
read_unlock_bh
(
&
bond
->
lock
);
/*
* Figure out the calcs for the /proc/net interface
*/
*
start
=
buf
+
(
offset
-
begin
);
len
-=
(
offset
-
begin
);
if
(
len
>
length
)
{
len
=
length
;
}
if
(
len
<
0
)
{
len
=
0
;
}
/*
* Figure out the calcs for the /proc/net interface
*/
if
(
len
<=
off
+
count
)
{
*
eof
=
1
;
}
*
start
=
buf
+
off
;
len
-=
off
;
if
(
len
>
count
)
{
len
=
count
;
}
}
if
(
len
<
0
)
{
len
=
0
;
}
read_unlock
(
&
dev_base_lock
);
read_unlock
(
&
dev_base_lock
);
return
len
;
return
len
;
}
}
#endif
/* CONFIG_PROC_FS */
static
int
bond_event
(
struct
notifier_block
*
this
,
unsigned
long
event
,
static
int
bond_event
(
struct
notifier_block
*
this
,
unsigned
long
event
,
void
*
ptr
)
void
*
ptr
)
...
@@ -3594,8 +3590,8 @@ static int __init bond_init(struct net_device *dev)
...
@@ -3594,8 +3590,8 @@ static int __init bond_init(struct net_device *dev)
bond
->
bond_proc_dir
->
owner
=
THIS_MODULE
;
bond
->
bond_proc_dir
->
owner
=
THIS_MODULE
;
bond
->
bond_proc_info_file
=
bond
->
bond_proc_info_file
=
create_proc_
info_entry
(
"info"
,
0
,
bond
->
bond_proc_dir
,
create_proc_
read_entry
(
"info"
,
0
,
bond
->
bond_proc_dir
,
bond_
get_info
);
bond_
read_proc
,
bond
);
if
(
bond
->
bond_proc_info_file
==
NULL
)
{
if
(
bond
->
bond_proc_info_file
==
NULL
)
{
printk
(
KERN_ERR
"%s: Cannot init /proc/net/%s/info
\n
"
,
printk
(
KERN_ERR
"%s: Cannot init /proc/net/%s/info
\n
"
,
dev
->
name
,
dev
->
name
);
dev
->
name
,
dev
->
name
);
...
...
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