License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 21:07:57 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2011-03-07 04:58:46 +07:00
|
|
|
#include <linux/proc_fs.h>
|
2011-05-28 03:14:23 +07:00
|
|
|
#include <linux/export.h>
|
2011-03-07 04:58:46 +07:00
|
|
|
#include <net/net_namespace.h>
|
|
|
|
#include <net/netns/generic.h>
|
2014-11-11 01:27:49 +07:00
|
|
|
#include <net/bonding.h>
|
2011-03-07 04:58:46 +07:00
|
|
|
|
2015-04-26 19:55:57 +07:00
|
|
|
#include "bonding_priv.h"
|
2011-03-07 04:58:46 +07:00
|
|
|
|
|
|
|
static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos)
|
|
|
|
__acquires(RCU)
|
|
|
|
{
|
2018-04-11 16:00:32 +07:00
|
|
|
struct bonding *bond = PDE_DATA(file_inode(seq->file));
|
2013-09-25 14:20:14 +07:00
|
|
|
struct list_head *iter;
|
2011-03-07 04:58:46 +07:00
|
|
|
struct slave *slave;
|
2013-09-25 14:20:14 +07:00
|
|
|
loff_t off = 0;
|
2011-03-07 04:58:46 +07:00
|
|
|
|
|
|
|
rcu_read_lock();
|
|
|
|
|
|
|
|
if (*pos == 0)
|
|
|
|
return SEQ_START_TOKEN;
|
|
|
|
|
2014-09-10 04:17:01 +07:00
|
|
|
bond_for_each_slave_rcu(bond, slave, iter)
|
2011-03-07 04:58:46 +07:00
|
|
|
if (++off == *pos)
|
|
|
|
return slave;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
|
|
|
{
|
2018-04-11 16:00:32 +07:00
|
|
|
struct bonding *bond = PDE_DATA(file_inode(seq->file));
|
2013-09-27 21:12:04 +07:00
|
|
|
struct list_head *iter;
|
|
|
|
struct slave *slave;
|
|
|
|
bool found = false;
|
2011-03-07 04:58:46 +07:00
|
|
|
|
|
|
|
++*pos;
|
|
|
|
if (v == SEQ_START_TOKEN)
|
2014-09-10 04:17:01 +07:00
|
|
|
return bond_first_slave_rcu(bond);
|
2011-03-07 04:58:46 +07:00
|
|
|
|
2014-09-10 04:17:01 +07:00
|
|
|
bond_for_each_slave_rcu(bond, slave, iter) {
|
2013-09-27 21:12:04 +07:00
|
|
|
if (found)
|
|
|
|
return slave;
|
|
|
|
if (slave == v)
|
|
|
|
found = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
2011-03-07 04:58:46 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void bond_info_seq_stop(struct seq_file *seq, void *v)
|
|
|
|
__releases(RCU)
|
|
|
|
{
|
|
|
|
rcu_read_unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void bond_info_show_master(struct seq_file *seq)
|
|
|
|
{
|
2018-04-11 16:00:32 +07:00
|
|
|
struct bonding *bond = PDE_DATA(file_inode(seq->file));
|
2014-03-07 05:20:17 +07:00
|
|
|
const struct bond_opt_value *optval;
|
2014-09-10 04:17:00 +07:00
|
|
|
struct slave *curr, *primary;
|
2011-03-07 04:58:46 +07:00
|
|
|
int i;
|
|
|
|
|
2014-02-21 15:08:53 +07:00
|
|
|
curr = rcu_dereference(bond->curr_active_slave);
|
2011-03-07 04:58:46 +07:00
|
|
|
|
|
|
|
seq_printf(seq, "Bonding Mode: %s",
|
2014-05-16 02:39:55 +07:00
|
|
|
bond_mode_name(BOND_MODE(bond)));
|
2011-03-07 04:58:46 +07:00
|
|
|
|
2014-05-16 02:39:55 +07:00
|
|
|
if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP &&
|
2014-01-22 20:53:22 +07:00
|
|
|
bond->params.fail_over_mac) {
|
|
|
|
optval = bond_opt_get_val(BOND_OPT_FAIL_OVER_MAC,
|
|
|
|
bond->params.fail_over_mac);
|
|
|
|
seq_printf(seq, " (fail_over_mac %s)", optval->string);
|
|
|
|
}
|
2011-03-07 04:58:46 +07:00
|
|
|
|
|
|
|
seq_printf(seq, "\n");
|
|
|
|
|
2014-10-05 07:44:44 +07:00
|
|
|
if (bond_mode_uses_xmit_hash(bond)) {
|
2014-01-22 20:53:19 +07:00
|
|
|
optval = bond_opt_get_val(BOND_OPT_XMIT_HASH,
|
|
|
|
bond->params.xmit_policy);
|
2011-03-07 04:58:46 +07:00
|
|
|
seq_printf(seq, "Transmit Hash Policy: %s (%d)\n",
|
2014-01-22 20:53:19 +07:00
|
|
|
optval->string, bond->params.xmit_policy);
|
2011-03-07 04:58:46 +07:00
|
|
|
}
|
|
|
|
|
2014-05-16 02:39:54 +07:00
|
|
|
if (bond_uses_primary(bond)) {
|
2014-09-10 04:17:00 +07:00
|
|
|
primary = rcu_dereference(bond->primary_slave);
|
2011-03-07 04:58:46 +07:00
|
|
|
seq_printf(seq, "Primary Slave: %s",
|
2014-09-10 04:17:00 +07:00
|
|
|
primary ? primary->dev->name : "None");
|
|
|
|
if (primary) {
|
2014-01-22 20:53:33 +07:00
|
|
|
optval = bond_opt_get_val(BOND_OPT_PRIMARY_RESELECT,
|
|
|
|
bond->params.primary_reselect);
|
2011-03-07 04:58:46 +07:00
|
|
|
seq_printf(seq, " (primary_reselect %s)",
|
2014-01-22 20:53:33 +07:00
|
|
|
optval->string);
|
|
|
|
}
|
2011-03-07 04:58:46 +07:00
|
|
|
|
|
|
|
seq_printf(seq, "\nCurrently Active Slave: %s\n",
|
|
|
|
(curr) ? curr->dev->name : "None");
|
|
|
|
}
|
|
|
|
|
|
|
|
seq_printf(seq, "MII Status: %s\n", netif_carrier_ok(bond->dev) ?
|
|
|
|
"up" : "down");
|
|
|
|
seq_printf(seq, "MII Polling Interval (ms): %d\n", bond->params.miimon);
|
|
|
|
seq_printf(seq, "Up Delay (ms): %d\n",
|
|
|
|
bond->params.updelay * bond->params.miimon);
|
|
|
|
seq_printf(seq, "Down Delay (ms): %d\n",
|
|
|
|
bond->params.downdelay * bond->params.miimon);
|
|
|
|
|
|
|
|
|
|
|
|
/* ARP information */
|
|
|
|
if (bond->params.arp_interval > 0) {
|
|
|
|
int printed = 0;
|
|
|
|
seq_printf(seq, "ARP Polling Interval (ms): %d\n",
|
|
|
|
bond->params.arp_interval);
|
|
|
|
|
|
|
|
seq_printf(seq, "ARP IP target/s (n.n.n.n form):");
|
|
|
|
|
|
|
|
for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) {
|
|
|
|
if (!bond->params.arp_targets[i])
|
|
|
|
break;
|
|
|
|
if (printed)
|
|
|
|
seq_printf(seq, ",");
|
|
|
|
seq_printf(seq, " %pI4", &bond->params.arp_targets[i]);
|
|
|
|
printed = 1;
|
|
|
|
}
|
|
|
|
seq_printf(seq, "\n");
|
|
|
|
}
|
|
|
|
|
2014-05-16 02:39:55 +07:00
|
|
|
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
|
2011-03-07 04:58:46 +07:00
|
|
|
struct ad_info ad_info;
|
|
|
|
|
|
|
|
seq_puts(seq, "\n802.3ad info\n");
|
|
|
|
seq_printf(seq, "LACP rate: %s\n",
|
|
|
|
(bond->params.lacp_fast) ? "fast" : "slow");
|
2011-06-22 16:54:39 +07:00
|
|
|
seq_printf(seq, "Min links: %d\n", bond->params.min_links);
|
2014-01-22 20:53:29 +07:00
|
|
|
optval = bond_opt_get_val(BOND_OPT_AD_SELECT,
|
|
|
|
bond->params.ad_select);
|
2011-03-07 04:58:46 +07:00
|
|
|
seq_printf(seq, "Aggregator selection policy (ad_select): %s\n",
|
2014-01-22 20:53:29 +07:00
|
|
|
optval->string);
|
2015-06-19 01:30:54 +07:00
|
|
|
if (capable(CAP_NET_ADMIN)) {
|
|
|
|
seq_printf(seq, "System priority: %d\n",
|
|
|
|
BOND_AD_INFO(bond).system.sys_priority);
|
|
|
|
seq_printf(seq, "System MAC address: %pM\n",
|
|
|
|
&BOND_AD_INFO(bond).system.sys_mac_addr);
|
|
|
|
|
|
|
|
if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
|
|
|
|
seq_printf(seq,
|
|
|
|
"bond %s has no active aggregator\n",
|
|
|
|
bond->dev->name);
|
|
|
|
} else {
|
|
|
|
seq_printf(seq, "Active Aggregator Info:\n");
|
|
|
|
|
|
|
|
seq_printf(seq, "\tAggregator ID: %d\n",
|
|
|
|
ad_info.aggregator_id);
|
|
|
|
seq_printf(seq, "\tNumber of ports: %d\n",
|
|
|
|
ad_info.ports);
|
|
|
|
seq_printf(seq, "\tActor Key: %d\n",
|
|
|
|
ad_info.actor_key);
|
|
|
|
seq_printf(seq, "\tPartner Key: %d\n",
|
|
|
|
ad_info.partner_key);
|
|
|
|
seq_printf(seq, "\tPartner Mac Address: %pM\n",
|
|
|
|
ad_info.partner_system);
|
|
|
|
}
|
2011-03-07 04:58:46 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void bond_info_show_slave(struct seq_file *seq,
|
|
|
|
const struct slave *slave)
|
|
|
|
{
|
2018-04-11 16:00:32 +07:00
|
|
|
struct bonding *bond = PDE_DATA(file_inode(seq->file));
|
2011-03-07 04:58:46 +07:00
|
|
|
|
|
|
|
seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name);
|
2012-06-15 05:39:27 +07:00
|
|
|
seq_printf(seq, "MII Status: %s\n", bond_slave_link_status(slave->link));
|
2011-11-04 15:21:38 +07:00
|
|
|
if (slave->speed == SPEED_UNKNOWN)
|
bonding:update speed/duplex for NETDEV_CHANGE
Zheng Liang(lzheng@redhat.com) found a bug that if we config bonding with
arp monitor, sometimes bonding driver cannot get the speed and duplex from
its slaves, it will assume them to be 100Mb/sec and Full, please see
/proc/net/bonding/bond0.
But there is no such problem when uses miimon.
(Take igb for example)
I find that the reason is that after dev_open() in bond_enslave(),
bond_update_speed_duplex() will call igb_get_settings()
, but in that function,
it runs ethtool_cmd_speed_set(ecmd, -1); ecmd->duplex = -1;
because igb get an error value of status.
So even dev_open() is called, but the device is not really ready to get its
settings.
Maybe it is safe for us to call igb_get_settings() only after
this message shows up, that is "igb: p4p1 NIC Link is Up 1000 Mbps Full Duplex,
Flow Control: RX".
So I prefer to update the speed and duplex for a slave when reseices
NETDEV_CHANGE/NETDEV_UP event.
Changelog
V2:
1 remove the "fake 100/Full" logic in bond_update_speed_duplex(),
set speed and duplex to -1 when it gets error value of speed and duplex.
2 delete the warning in bond_enslave() if bond_update_speed_duplex() returns
error.
3 make bond_info_show_slave() handle bad values of speed and duplex.
Signed-off-by: Weiping Pan <wpan@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-11-01 00:20:48 +07:00
|
|
|
seq_printf(seq, "Speed: %s\n", "Unknown");
|
|
|
|
else
|
|
|
|
seq_printf(seq, "Speed: %d Mbps\n", slave->speed);
|
|
|
|
|
2011-11-04 15:21:38 +07:00
|
|
|
if (slave->duplex == DUPLEX_UNKNOWN)
|
bonding:update speed/duplex for NETDEV_CHANGE
Zheng Liang(lzheng@redhat.com) found a bug that if we config bonding with
arp monitor, sometimes bonding driver cannot get the speed and duplex from
its slaves, it will assume them to be 100Mb/sec and Full, please see
/proc/net/bonding/bond0.
But there is no such problem when uses miimon.
(Take igb for example)
I find that the reason is that after dev_open() in bond_enslave(),
bond_update_speed_duplex() will call igb_get_settings()
, but in that function,
it runs ethtool_cmd_speed_set(ecmd, -1); ecmd->duplex = -1;
because igb get an error value of status.
So even dev_open() is called, but the device is not really ready to get its
settings.
Maybe it is safe for us to call igb_get_settings() only after
this message shows up, that is "igb: p4p1 NIC Link is Up 1000 Mbps Full Duplex,
Flow Control: RX".
So I prefer to update the speed and duplex for a slave when reseices
NETDEV_CHANGE/NETDEV_UP event.
Changelog
V2:
1 remove the "fake 100/Full" logic in bond_update_speed_duplex(),
set speed and duplex to -1 when it gets error value of speed and duplex.
2 delete the warning in bond_enslave() if bond_update_speed_duplex() returns
error.
3 make bond_info_show_slave() handle bad values of speed and duplex.
Signed-off-by: Weiping Pan <wpan@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-11-01 00:20:48 +07:00
|
|
|
seq_printf(seq, "Duplex: %s\n", "Unknown");
|
|
|
|
else
|
|
|
|
seq_printf(seq, "Duplex: %s\n", slave->duplex ? "full" : "half");
|
|
|
|
|
2011-03-07 04:58:46 +07:00
|
|
|
seq_printf(seq, "Link Failure Count: %u\n",
|
|
|
|
slave->link_failure_count);
|
|
|
|
|
bonding: attempt to better support longer hw addresses
People are using bonding over Infiniband IPoIB connections, and who knows
what else. Infiniband has a hardware address length of 20 octets
(INFINIBAND_ALEN), and the network core defines a MAX_ADDR_LEN of 32.
Various places in the bonding code are currently hard-wired to 6 octets
(ETH_ALEN), such as the 3ad code, which I've left untouched here. Besides,
only alb is currently possible on Infiniband links right now anyway, due
to commit 1533e7731522, so the alb code is where most of the changes are.
One major component of this change is the addition of a bond_hw_addr_copy
function that takes a length argument, instead of using ether_addr_copy
everywhere that hardware addresses need to be copied about. The other
major component of this change is converting the bonding code from using
struct sockaddr for address storage to struct sockaddr_storage, as the
former has an address storage space of only 14, while the latter is 128
minus a few, which is necessary to support bonding over device with up to
MAX_ADDR_LEN octet hardware addresses. Additionally, this probably fixes
up some memory corruption issues with the current code, where it's
possible to write an infiniband hardware address into a sockaddr declared
on the stack.
Lightly tested on a dual mlx4 IPoIB setup, which properly shows a 20-octet
hardware address now:
$ cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup) (fail_over_mac active)
Primary Slave: mlx4_ib0 (primary_reselect always)
Currently Active Slave: mlx4_ib0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 100
Down Delay (ms): 100
Slave Interface: mlx4_ib0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr:
80:00:02:08:fe:80:00:00:00:00:00:00:e4:1d:2d:03:00:1d:67:01
Slave queue ID: 0
Slave Interface: mlx4_ib1
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr:
80:00:02:09:fe:80:00:00:00:00:00:01:e4:1d:2d:03:00:1d:67:02
Slave queue ID: 0
Also tested with a standard 1Gbps NIC bonding setup (with a mix of
e1000 and e1000e cards), running LNST's bonding tests.
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-04-05 04:32:42 +07:00
|
|
|
seq_printf(seq, "Permanent HW addr: %*phC\n",
|
|
|
|
slave->dev->addr_len, slave->perm_hwaddr);
|
2015-02-24 08:50:11 +07:00
|
|
|
seq_printf(seq, "Slave queue ID: %d\n", slave->queue_id);
|
2011-03-07 04:58:46 +07:00
|
|
|
|
2014-05-16 02:39:55 +07:00
|
|
|
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
|
2015-02-24 08:50:11 +07:00
|
|
|
const struct port *port = &SLAVE_AD_INFO(slave)->port;
|
|
|
|
const struct aggregator *agg = port->aggregator;
|
2011-03-07 04:58:46 +07:00
|
|
|
|
2015-02-24 08:50:11 +07:00
|
|
|
if (agg) {
|
2011-03-07 04:58:46 +07:00
|
|
|
seq_printf(seq, "Aggregator ID: %d\n",
|
|
|
|
agg->aggregator_identifier);
|
2015-02-24 08:50:11 +07:00
|
|
|
seq_printf(seq, "Actor Churn State: %s\n",
|
|
|
|
bond_3ad_churn_desc(port->sm_churn_actor_state));
|
|
|
|
seq_printf(seq, "Partner Churn State: %s\n",
|
|
|
|
bond_3ad_churn_desc(port->sm_churn_partner_state));
|
|
|
|
seq_printf(seq, "Actor Churned Count: %d\n",
|
|
|
|
port->churn_actor_count);
|
|
|
|
seq_printf(seq, "Partner Churned Count: %d\n",
|
|
|
|
port->churn_partner_count);
|
|
|
|
|
2015-06-19 01:30:54 +07:00
|
|
|
if (capable(CAP_NET_ADMIN)) {
|
|
|
|
seq_puts(seq, "details actor lacp pdu:\n");
|
|
|
|
seq_printf(seq, " system priority: %d\n",
|
|
|
|
port->actor_system_priority);
|
|
|
|
seq_printf(seq, " system mac address: %pM\n",
|
|
|
|
&port->actor_system);
|
|
|
|
seq_printf(seq, " port key: %d\n",
|
|
|
|
port->actor_oper_port_key);
|
|
|
|
seq_printf(seq, " port priority: %d\n",
|
|
|
|
port->actor_port_priority);
|
|
|
|
seq_printf(seq, " port number: %d\n",
|
|
|
|
port->actor_port_number);
|
|
|
|
seq_printf(seq, " port state: %d\n",
|
|
|
|
port->actor_oper_port_state);
|
|
|
|
|
|
|
|
seq_puts(seq, "details partner lacp pdu:\n");
|
|
|
|
seq_printf(seq, " system priority: %d\n",
|
|
|
|
port->partner_oper.system_priority);
|
|
|
|
seq_printf(seq, " system mac address: %pM\n",
|
|
|
|
&port->partner_oper.system);
|
|
|
|
seq_printf(seq, " oper key: %d\n",
|
|
|
|
port->partner_oper.key);
|
|
|
|
seq_printf(seq, " port priority: %d\n",
|
|
|
|
port->partner_oper.port_priority);
|
|
|
|
seq_printf(seq, " port number: %d\n",
|
|
|
|
port->partner_oper.port_number);
|
|
|
|
seq_printf(seq, " port state: %d\n",
|
|
|
|
port->partner_oper.port_state);
|
|
|
|
}
|
2015-02-24 08:50:11 +07:00
|
|
|
} else {
|
2011-03-07 04:58:46 +07:00
|
|
|
seq_puts(seq, "Aggregator ID: N/A\n");
|
2015-02-24 08:50:11 +07:00
|
|
|
}
|
2011-03-07 04:58:46 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int bond_info_seq_show(struct seq_file *seq, void *v)
|
|
|
|
{
|
|
|
|
if (v == SEQ_START_TOKEN) {
|
|
|
|
seq_printf(seq, "%s\n", bond_version);
|
|
|
|
bond_info_show_master(seq);
|
|
|
|
} else
|
|
|
|
bond_info_show_slave(seq, v);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct seq_operations bond_info_seq_ops = {
|
|
|
|
.start = bond_info_seq_start,
|
|
|
|
.next = bond_info_seq_next,
|
|
|
|
.stop = bond_info_seq_stop,
|
|
|
|
.show = bond_info_seq_show,
|
|
|
|
};
|
|
|
|
|
|
|
|
void bond_create_proc_entry(struct bonding *bond)
|
|
|
|
{
|
|
|
|
struct net_device *bond_dev = bond->dev;
|
|
|
|
struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id);
|
|
|
|
|
|
|
|
if (bn->proc_dir) {
|
2018-04-11 16:00:32 +07:00
|
|
|
bond->proc_entry = proc_create_seq_data(bond_dev->name, 0444,
|
|
|
|
bn->proc_dir, &bond_info_seq_ops, bond);
|
2011-03-07 04:58:46 +07:00
|
|
|
if (bond->proc_entry == NULL)
|
2014-07-16 00:36:07 +07:00
|
|
|
netdev_warn(bond_dev, "Cannot create /proc/net/%s/%s\n",
|
|
|
|
DRV_NAME, bond_dev->name);
|
2011-03-07 04:58:46 +07:00
|
|
|
else
|
|
|
|
memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void bond_remove_proc_entry(struct bonding *bond)
|
|
|
|
{
|
|
|
|
struct net_device *bond_dev = bond->dev;
|
|
|
|
struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id);
|
|
|
|
|
|
|
|
if (bn->proc_dir && bond->proc_entry) {
|
|
|
|
remove_proc_entry(bond->proc_file_name, bn->proc_dir);
|
|
|
|
memset(bond->proc_file_name, 0, IFNAMSIZ);
|
|
|
|
bond->proc_entry = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create the bonding directory under /proc/net, if doesn't exist yet.
|
|
|
|
* Caller must hold rtnl_lock.
|
|
|
|
*/
|
|
|
|
void __net_init bond_create_proc_dir(struct bond_net *bn)
|
|
|
|
{
|
|
|
|
if (!bn->proc_dir) {
|
|
|
|
bn->proc_dir = proc_mkdir(DRV_NAME, bn->net->proc_net);
|
|
|
|
if (!bn->proc_dir)
|
2014-02-16 07:01:45 +07:00
|
|
|
pr_warn("Warning: Cannot create /proc/net/%s\n",
|
2014-02-16 06:57:04 +07:00
|
|
|
DRV_NAME);
|
2011-03-07 04:58:46 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Destroy the bonding directory under /proc/net, if empty.
|
|
|
|
* Caller must hold rtnl_lock.
|
|
|
|
*/
|
|
|
|
void __net_exit bond_destroy_proc_dir(struct bond_net *bn)
|
|
|
|
{
|
|
|
|
if (bn->proc_dir) {
|
|
|
|
remove_proc_entry(DRV_NAME, bn->net->proc_net);
|
|
|
|
bn->proc_dir = NULL;
|
|
|
|
}
|
|
|
|
}
|