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 */
|
2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* ethtool.h: Defines for Linux ethtool.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1998 David S. Miller (davem@redhat.com)
|
|
|
|
* Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
|
|
|
|
* Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
|
|
|
|
* Portions Copyright 2002 Intel (eli.kupermann@intel.com,
|
|
|
|
* christopher.leech@intel.com,
|
|
|
|
* scott.feldman@intel.com)
|
2009-02-20 15:58:13 +07:00
|
|
|
* Portions Copyright (C) Sun Microsystems 2008
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
|
|
|
#ifndef _LINUX_ETHTOOL_H
|
|
|
|
#define _LINUX_ETHTOOL_H
|
|
|
|
|
net: ethtool: add new ETHTOOL_xLINKSETTINGS API
This patch defines a new ETHTOOL_GLINKSETTINGS/SLINKSETTINGS API,
handled by the new get_link_ksettings/set_link_ksettings callbacks.
This API provides support for most legacy ethtool_cmd fields, adds
support for larger link mode masks (up to 4064 bits, variable length),
and removes ethtool_cmd deprecated
fields (transceiver/maxrxpkt/maxtxpkt).
This API is deprecating the legacy ETHTOOL_GSET/SSET API and provides
the following backward compatibility properties:
- legacy ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks.
- legacy ethtool with new get/set_link_ksettings drivers: the new
driver callbacks are used, data internally converted to legacy
ethtool_cmd. ETHTOOL_GSET will return only the 1st 32b of each link
mode mask. ETHTOOL_SSET will fail if user tries to set the
ethtool_cmd deprecated fields to
non-0 (transceiver/maxrxpkt/maxtxpkt). A kernel warning is logged if
driver sets higher bits.
- future ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks, internally converted to new data
structure. Deprecated fields (transceiver/maxrxpkt/maxtxpkt) will be
ignored and seen as 0 from user space. Note that that "future"
ethtool tool will not allow changes to these deprecated fields.
- future ethtool with new drivers: direct call to the new callbacks.
By "future" ethtool, what is meant is:
- query: first try ETHTOOL_GLINKSETTINGS, and revert to ETHTOOL_GSET if
fails
- set: query first and remember which of ETHTOOL_GLINKSETTINGS or
ETHTOOL_GSET was successful
+ if ETHTOOL_GLINKSETTINGS was successful, then change config with
ETHTOOL_SLINKSETTINGS. A failure there is final (do not try
ETHTOOL_SSET).
+ otherwise ETHTOOL_GSET was successful, change config with
ETHTOOL_SSET. A failure there is final (do not try
ETHTOOL_SLINKSETTINGS).
The interaction user/kernel via the new API requires a small
ETHTOOL_GLINKSETTINGS handshake first to agree on the length of the link
mode bitmaps. If kernel doesn't agree with user, it returns the bitmap
length it is expecting from user as a negative length (and cmd field is
0). When kernel and user agree, kernel returns valid info in all
fields (ie. link mode length > 0 and cmd is ETHTOOL_GLINKSETTINGS).
Data structure crossing user/kernel boundary is 32/64-bit
agnostic. Converted internally to a legal kernel bitmap.
The internal __ethtool_get_settings kernel helper will gradually be
replaced by __ethtool_get_link_ksettings by the time the first
"link_settings" drivers start to appear. So this patch doesn't change
it, it will be removed before it needs to be changed.
Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-25 01:57:59 +07:00
|
|
|
#include <linux/bitmap.h>
|
2011-03-17 14:34:32 +07:00
|
|
|
#include <linux/compat.h>
|
2012-10-13 16:46:48 +07:00
|
|
|
#include <uapi/linux/ethtool.h>
|
2007-08-16 06:00:51 +07:00
|
|
|
|
2011-03-17 14:34:32 +07:00
|
|
|
#ifdef CONFIG_COMPAT
|
|
|
|
|
|
|
|
struct compat_ethtool_rx_flow_spec {
|
|
|
|
u32 flow_type;
|
2011-04-09 01:01:59 +07:00
|
|
|
union ethtool_flow_union h_u;
|
|
|
|
struct ethtool_flow_ext h_ext;
|
|
|
|
union ethtool_flow_union m_u;
|
|
|
|
struct ethtool_flow_ext m_ext;
|
2011-03-17 14:34:32 +07:00
|
|
|
compat_u64 ring_cookie;
|
|
|
|
u32 location;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct compat_ethtool_rxnfc {
|
|
|
|
u32 cmd;
|
|
|
|
u32 flow_type;
|
|
|
|
compat_u64 data;
|
|
|
|
struct compat_ethtool_rx_flow_spec fs;
|
|
|
|
u32 rule_cnt;
|
|
|
|
u32 rule_locs[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* CONFIG_COMPAT */
|
2006-04-29 07:53:47 +07:00
|
|
|
|
2010-02-15 13:38:54 +07:00
|
|
|
#include <linux/rculist.h>
|
|
|
|
|
2011-04-02 06:35:15 +07:00
|
|
|
/**
|
|
|
|
* enum ethtool_phys_id_state - indicator state for physical identification
|
|
|
|
* @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated
|
|
|
|
* @ETHTOOL_ID_ACTIVE: Physical ID indicator should be activated
|
|
|
|
* @ETHTOOL_ID_ON: LED should be turned on (used iff %ETHTOOL_ID_ACTIVE
|
|
|
|
* is not supported)
|
|
|
|
* @ETHTOOL_ID_OFF: LED should be turned off (used iff %ETHTOOL_ID_ACTIVE
|
|
|
|
* is not supported)
|
|
|
|
*/
|
|
|
|
enum ethtool_phys_id_state {
|
|
|
|
ETHTOOL_ID_INACTIVE,
|
|
|
|
ETHTOOL_ID_ACTIVE,
|
|
|
|
ETHTOOL_ID_ON,
|
|
|
|
ETHTOOL_ID_OFF
|
|
|
|
};
|
|
|
|
|
2014-12-02 23:12:10 +07:00
|
|
|
enum {
|
|
|
|
ETH_RSS_HASH_TOP_BIT, /* Configurable RSS hash function - Toeplitz */
|
|
|
|
ETH_RSS_HASH_XOR_BIT, /* Configurable RSS hash function - Xor */
|
2017-03-08 23:57:00 +07:00
|
|
|
ETH_RSS_HASH_CRC32_BIT, /* Configurable RSS hash function - Crc32 */
|
2014-12-02 23:12:10 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add your fresh new hash function bits above and remember to update
|
|
|
|
* rss_hash_func_strings[] in ethtool.c
|
|
|
|
*/
|
|
|
|
ETH_RSS_HASH_FUNCS_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
#define __ETH_RSS_HASH_BIT(bit) ((u32)1 << (bit))
|
|
|
|
#define __ETH_RSS_HASH(name) __ETH_RSS_HASH_BIT(ETH_RSS_HASH_##name##_BIT)
|
|
|
|
|
|
|
|
#define ETH_RSS_HASH_TOP __ETH_RSS_HASH(TOP)
|
|
|
|
#define ETH_RSS_HASH_XOR __ETH_RSS_HASH(XOR)
|
2017-03-08 23:57:00 +07:00
|
|
|
#define ETH_RSS_HASH_CRC32 __ETH_RSS_HASH(CRC32)
|
2014-12-02 23:12:10 +07:00
|
|
|
|
|
|
|
#define ETH_RSS_HASH_UNKNOWN 0
|
|
|
|
#define ETH_RSS_HASH_NO_CHANGE 0
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
struct net_device;
|
|
|
|
|
|
|
|
/* Some generic methods drivers may use in their ethtool_ops */
|
|
|
|
u32 ethtool_op_get_link(struct net_device *dev);
|
2012-04-04 05:59:22 +07:00
|
|
|
int ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2011-12-15 20:56:49 +07:00
|
|
|
/**
|
|
|
|
* ethtool_rxfh_indir_default - get default value for RX flow hash indirection
|
|
|
|
* @index: Index in RX flow hash indirection table
|
|
|
|
* @n_rx_rings: Number of RX rings to use
|
|
|
|
*
|
|
|
|
* This function provides the default policy for RX flow hash indirection.
|
|
|
|
*/
|
|
|
|
static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
|
|
|
|
{
|
|
|
|
return index % n_rx_rings;
|
|
|
|
}
|
|
|
|
|
net: ethtool: add new ETHTOOL_xLINKSETTINGS API
This patch defines a new ETHTOOL_GLINKSETTINGS/SLINKSETTINGS API,
handled by the new get_link_ksettings/set_link_ksettings callbacks.
This API provides support for most legacy ethtool_cmd fields, adds
support for larger link mode masks (up to 4064 bits, variable length),
and removes ethtool_cmd deprecated
fields (transceiver/maxrxpkt/maxtxpkt).
This API is deprecating the legacy ETHTOOL_GSET/SSET API and provides
the following backward compatibility properties:
- legacy ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks.
- legacy ethtool with new get/set_link_ksettings drivers: the new
driver callbacks are used, data internally converted to legacy
ethtool_cmd. ETHTOOL_GSET will return only the 1st 32b of each link
mode mask. ETHTOOL_SSET will fail if user tries to set the
ethtool_cmd deprecated fields to
non-0 (transceiver/maxrxpkt/maxtxpkt). A kernel warning is logged if
driver sets higher bits.
- future ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks, internally converted to new data
structure. Deprecated fields (transceiver/maxrxpkt/maxtxpkt) will be
ignored and seen as 0 from user space. Note that that "future"
ethtool tool will not allow changes to these deprecated fields.
- future ethtool with new drivers: direct call to the new callbacks.
By "future" ethtool, what is meant is:
- query: first try ETHTOOL_GLINKSETTINGS, and revert to ETHTOOL_GSET if
fails
- set: query first and remember which of ETHTOOL_GLINKSETTINGS or
ETHTOOL_GSET was successful
+ if ETHTOOL_GLINKSETTINGS was successful, then change config with
ETHTOOL_SLINKSETTINGS. A failure there is final (do not try
ETHTOOL_SSET).
+ otherwise ETHTOOL_GSET was successful, change config with
ETHTOOL_SSET. A failure there is final (do not try
ETHTOOL_SLINKSETTINGS).
The interaction user/kernel via the new API requires a small
ETHTOOL_GLINKSETTINGS handshake first to agree on the length of the link
mode bitmaps. If kernel doesn't agree with user, it returns the bitmap
length it is expecting from user as a negative length (and cmd field is
0). When kernel and user agree, kernel returns valid info in all
fields (ie. link mode length > 0 and cmd is ETHTOOL_GLINKSETTINGS).
Data structure crossing user/kernel boundary is 32/64-bit
agnostic. Converted internally to a legal kernel bitmap.
The internal __ethtool_get_settings kernel helper will gradually be
replaced by __ethtool_get_link_ksettings by the time the first
"link_settings" drivers start to appear. So this patch doesn't change
it, it will be removed before it needs to be changed.
Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-25 01:57:59 +07:00
|
|
|
/* number of link mode bits/ulongs handled internally by kernel */
|
|
|
|
#define __ETHTOOL_LINK_MODE_MASK_NBITS \
|
|
|
|
(__ETHTOOL_LINK_MODE_LAST + 1)
|
|
|
|
|
|
|
|
/* declare a link mode bitmap */
|
|
|
|
#define __ETHTOOL_DECLARE_LINK_MODE_MASK(name) \
|
|
|
|
DECLARE_BITMAP(name, __ETHTOOL_LINK_MODE_MASK_NBITS)
|
|
|
|
|
|
|
|
/* drivers must ignore base.cmd and base.link_mode_masks_nwords
|
|
|
|
* fields, but they are allowed to overwrite them (will be ignored).
|
|
|
|
*/
|
|
|
|
struct ethtool_link_ksettings {
|
|
|
|
struct ethtool_link_settings base;
|
|
|
|
struct {
|
|
|
|
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
|
|
|
|
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
|
|
|
|
__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
|
|
|
|
} link_modes;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ethtool_link_ksettings_zero_link_mode - clear link_ksettings link mode mask
|
|
|
|
* @ptr : pointer to struct ethtool_link_ksettings
|
|
|
|
* @name : one of supported/advertising/lp_advertising
|
|
|
|
*/
|
|
|
|
#define ethtool_link_ksettings_zero_link_mode(ptr, name) \
|
|
|
|
bitmap_zero((ptr)->link_modes.name, __ETHTOOL_LINK_MODE_MASK_NBITS)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ethtool_link_ksettings_add_link_mode - set bit in link_ksettings
|
|
|
|
* link mode mask
|
|
|
|
* @ptr : pointer to struct ethtool_link_ksettings
|
|
|
|
* @name : one of supported/advertising/lp_advertising
|
|
|
|
* @mode : one of the ETHTOOL_LINK_MODE_*_BIT
|
|
|
|
* (not atomic, no bound checking)
|
|
|
|
*/
|
|
|
|
#define ethtool_link_ksettings_add_link_mode(ptr, name, mode) \
|
|
|
|
__set_bit(ETHTOOL_LINK_MODE_ ## mode ## _BIT, (ptr)->link_modes.name)
|
|
|
|
|
2017-08-18 21:03:44 +07:00
|
|
|
/**
|
|
|
|
* ethtool_link_ksettings_del_link_mode - clear bit in link_ksettings
|
|
|
|
* link mode mask
|
|
|
|
* @ptr : pointer to struct ethtool_link_ksettings
|
|
|
|
* @name : one of supported/advertising/lp_advertising
|
|
|
|
* @mode : one of the ETHTOOL_LINK_MODE_*_BIT
|
|
|
|
* (not atomic, no bound checking)
|
|
|
|
*/
|
|
|
|
#define ethtool_link_ksettings_del_link_mode(ptr, name, mode) \
|
|
|
|
__clear_bit(ETHTOOL_LINK_MODE_ ## mode ## _BIT, (ptr)->link_modes.name)
|
|
|
|
|
net: ethtool: add new ETHTOOL_xLINKSETTINGS API
This patch defines a new ETHTOOL_GLINKSETTINGS/SLINKSETTINGS API,
handled by the new get_link_ksettings/set_link_ksettings callbacks.
This API provides support for most legacy ethtool_cmd fields, adds
support for larger link mode masks (up to 4064 bits, variable length),
and removes ethtool_cmd deprecated
fields (transceiver/maxrxpkt/maxtxpkt).
This API is deprecating the legacy ETHTOOL_GSET/SSET API and provides
the following backward compatibility properties:
- legacy ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks.
- legacy ethtool with new get/set_link_ksettings drivers: the new
driver callbacks are used, data internally converted to legacy
ethtool_cmd. ETHTOOL_GSET will return only the 1st 32b of each link
mode mask. ETHTOOL_SSET will fail if user tries to set the
ethtool_cmd deprecated fields to
non-0 (transceiver/maxrxpkt/maxtxpkt). A kernel warning is logged if
driver sets higher bits.
- future ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks, internally converted to new data
structure. Deprecated fields (transceiver/maxrxpkt/maxtxpkt) will be
ignored and seen as 0 from user space. Note that that "future"
ethtool tool will not allow changes to these deprecated fields.
- future ethtool with new drivers: direct call to the new callbacks.
By "future" ethtool, what is meant is:
- query: first try ETHTOOL_GLINKSETTINGS, and revert to ETHTOOL_GSET if
fails
- set: query first and remember which of ETHTOOL_GLINKSETTINGS or
ETHTOOL_GSET was successful
+ if ETHTOOL_GLINKSETTINGS was successful, then change config with
ETHTOOL_SLINKSETTINGS. A failure there is final (do not try
ETHTOOL_SSET).
+ otherwise ETHTOOL_GSET was successful, change config with
ETHTOOL_SSET. A failure there is final (do not try
ETHTOOL_SLINKSETTINGS).
The interaction user/kernel via the new API requires a small
ETHTOOL_GLINKSETTINGS handshake first to agree on the length of the link
mode bitmaps. If kernel doesn't agree with user, it returns the bitmap
length it is expecting from user as a negative length (and cmd field is
0). When kernel and user agree, kernel returns valid info in all
fields (ie. link mode length > 0 and cmd is ETHTOOL_GLINKSETTINGS).
Data structure crossing user/kernel boundary is 32/64-bit
agnostic. Converted internally to a legal kernel bitmap.
The internal __ethtool_get_settings kernel helper will gradually be
replaced by __ethtool_get_link_ksettings by the time the first
"link_settings" drivers start to appear. So this patch doesn't change
it, it will be removed before it needs to be changed.
Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-25 01:57:59 +07:00
|
|
|
/**
|
|
|
|
* ethtool_link_ksettings_test_link_mode - test bit in ksettings link mode mask
|
|
|
|
* @ptr : pointer to struct ethtool_link_ksettings
|
|
|
|
* @name : one of supported/advertising/lp_advertising
|
|
|
|
* @mode : one of the ETHTOOL_LINK_MODE_*_BIT
|
|
|
|
* (not atomic, no bound checking)
|
|
|
|
*
|
|
|
|
* Returns true/false.
|
|
|
|
*/
|
|
|
|
#define ethtool_link_ksettings_test_link_mode(ptr, name, mode) \
|
|
|
|
test_bit(ETHTOOL_LINK_MODE_ ## mode ## _BIT, (ptr)->link_modes.name)
|
|
|
|
|
|
|
|
extern int
|
|
|
|
__ethtool_get_link_ksettings(struct net_device *dev,
|
|
|
|
struct ethtool_link_ksettings *link_ksettings);
|
|
|
|
|
2017-10-06 04:53:40 +07:00
|
|
|
/**
|
|
|
|
* ethtool_intersect_link_masks - Given two link masks, AND them together
|
|
|
|
* @dst: first mask and where result is stored
|
|
|
|
* @src: second mask to intersect with
|
|
|
|
*
|
|
|
|
* Given two link mode masks, AND them together and save the result in dst.
|
|
|
|
*/
|
|
|
|
void ethtool_intersect_link_masks(struct ethtool_link_ksettings *dst,
|
|
|
|
struct ethtool_link_ksettings *src);
|
|
|
|
|
2016-04-15 05:34:59 +07:00
|
|
|
void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst,
|
|
|
|
u32 legacy_u32);
|
|
|
|
|
|
|
|
/* return false if src had higher bits set. lower bits always updated. */
|
|
|
|
bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
|
|
|
|
const unsigned long *src);
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/**
|
2011-04-02 05:57:41 +07:00
|
|
|
* struct ethtool_ops - optional netdev operations
|
net: ethtool: add new ETHTOOL_xLINKSETTINGS API
This patch defines a new ETHTOOL_GLINKSETTINGS/SLINKSETTINGS API,
handled by the new get_link_ksettings/set_link_ksettings callbacks.
This API provides support for most legacy ethtool_cmd fields, adds
support for larger link mode masks (up to 4064 bits, variable length),
and removes ethtool_cmd deprecated
fields (transceiver/maxrxpkt/maxtxpkt).
This API is deprecating the legacy ETHTOOL_GSET/SSET API and provides
the following backward compatibility properties:
- legacy ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks.
- legacy ethtool with new get/set_link_ksettings drivers: the new
driver callbacks are used, data internally converted to legacy
ethtool_cmd. ETHTOOL_GSET will return only the 1st 32b of each link
mode mask. ETHTOOL_SSET will fail if user tries to set the
ethtool_cmd deprecated fields to
non-0 (transceiver/maxrxpkt/maxtxpkt). A kernel warning is logged if
driver sets higher bits.
- future ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks, internally converted to new data
structure. Deprecated fields (transceiver/maxrxpkt/maxtxpkt) will be
ignored and seen as 0 from user space. Note that that "future"
ethtool tool will not allow changes to these deprecated fields.
- future ethtool with new drivers: direct call to the new callbacks.
By "future" ethtool, what is meant is:
- query: first try ETHTOOL_GLINKSETTINGS, and revert to ETHTOOL_GSET if
fails
- set: query first and remember which of ETHTOOL_GLINKSETTINGS or
ETHTOOL_GSET was successful
+ if ETHTOOL_GLINKSETTINGS was successful, then change config with
ETHTOOL_SLINKSETTINGS. A failure there is final (do not try
ETHTOOL_SSET).
+ otherwise ETHTOOL_GSET was successful, change config with
ETHTOOL_SSET. A failure there is final (do not try
ETHTOOL_SLINKSETTINGS).
The interaction user/kernel via the new API requires a small
ETHTOOL_GLINKSETTINGS handshake first to agree on the length of the link
mode bitmaps. If kernel doesn't agree with user, it returns the bitmap
length it is expecting from user as a negative length (and cmd field is
0). When kernel and user agree, kernel returns valid info in all
fields (ie. link mode length > 0 and cmd is ETHTOOL_GLINKSETTINGS).
Data structure crossing user/kernel boundary is 32/64-bit
agnostic. Converted internally to a legal kernel bitmap.
The internal __ethtool_get_settings kernel helper will gradually be
replaced by __ethtool_get_link_ksettings by the time the first
"link_settings" drivers start to appear. So this patch doesn't change
it, it will be removed before it needs to be changed.
Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-25 01:57:59 +07:00
|
|
|
* @get_settings: DEPRECATED, use %get_link_ksettings/%set_link_ksettings
|
|
|
|
* API. Get various device settings including Ethernet link
|
2011-04-28 01:32:38 +07:00
|
|
|
* settings. The @cmd parameter is expected to have been cleared
|
net: ethtool: add new ETHTOOL_xLINKSETTINGS API
This patch defines a new ETHTOOL_GLINKSETTINGS/SLINKSETTINGS API,
handled by the new get_link_ksettings/set_link_ksettings callbacks.
This API provides support for most legacy ethtool_cmd fields, adds
support for larger link mode masks (up to 4064 bits, variable length),
and removes ethtool_cmd deprecated
fields (transceiver/maxrxpkt/maxtxpkt).
This API is deprecating the legacy ETHTOOL_GSET/SSET API and provides
the following backward compatibility properties:
- legacy ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks.
- legacy ethtool with new get/set_link_ksettings drivers: the new
driver callbacks are used, data internally converted to legacy
ethtool_cmd. ETHTOOL_GSET will return only the 1st 32b of each link
mode mask. ETHTOOL_SSET will fail if user tries to set the
ethtool_cmd deprecated fields to
non-0 (transceiver/maxrxpkt/maxtxpkt). A kernel warning is logged if
driver sets higher bits.
- future ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks, internally converted to new data
structure. Deprecated fields (transceiver/maxrxpkt/maxtxpkt) will be
ignored and seen as 0 from user space. Note that that "future"
ethtool tool will not allow changes to these deprecated fields.
- future ethtool with new drivers: direct call to the new callbacks.
By "future" ethtool, what is meant is:
- query: first try ETHTOOL_GLINKSETTINGS, and revert to ETHTOOL_GSET if
fails
- set: query first and remember which of ETHTOOL_GLINKSETTINGS or
ETHTOOL_GSET was successful
+ if ETHTOOL_GLINKSETTINGS was successful, then change config with
ETHTOOL_SLINKSETTINGS. A failure there is final (do not try
ETHTOOL_SSET).
+ otherwise ETHTOOL_GSET was successful, change config with
ETHTOOL_SSET. A failure there is final (do not try
ETHTOOL_SLINKSETTINGS).
The interaction user/kernel via the new API requires a small
ETHTOOL_GLINKSETTINGS handshake first to agree on the length of the link
mode bitmaps. If kernel doesn't agree with user, it returns the bitmap
length it is expecting from user as a negative length (and cmd field is
0). When kernel and user agree, kernel returns valid info in all
fields (ie. link mode length > 0 and cmd is ETHTOOL_GLINKSETTINGS).
Data structure crossing user/kernel boundary is 32/64-bit
agnostic. Converted internally to a legal kernel bitmap.
The internal __ethtool_get_settings kernel helper will gradually be
replaced by __ethtool_get_link_ksettings by the time the first
"link_settings" drivers start to appear. So this patch doesn't change
it, it will be removed before it needs to be changed.
Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-25 01:57:59 +07:00
|
|
|
* before get_settings is called. Returns a negative error code
|
|
|
|
* or zero.
|
|
|
|
* @set_settings: DEPRECATED, use %get_link_ksettings/%set_link_ksettings
|
|
|
|
* API. Set various device settings including Ethernet link
|
2011-04-02 05:57:41 +07:00
|
|
|
* settings. Returns a negative error code or zero.
|
|
|
|
* @get_drvinfo: Report driver/device information. Should only set the
|
|
|
|
* @driver, @version, @fw_version and @bus_info fields. If not
|
|
|
|
* implemented, the @driver and @bus_info fields will be filled in
|
|
|
|
* according to the netdev's parent device.
|
|
|
|
* @get_regs_len: Get buffer length required for @get_regs
|
2011-04-02 04:52:34 +07:00
|
|
|
* @get_regs: Get device registers
|
|
|
|
* @get_wol: Report whether Wake-on-Lan is enabled
|
2011-04-02 05:57:41 +07:00
|
|
|
* @set_wol: Turn Wake-on-Lan on or off. Returns a negative error code
|
|
|
|
* or zero.
|
|
|
|
* @get_msglevel: Report driver message level. This should be the value
|
|
|
|
* of the @msg_enable field used by netif logging functions.
|
2011-04-02 04:52:34 +07:00
|
|
|
* @set_msglevel: Set driver message level
|
2011-04-02 05:57:41 +07:00
|
|
|
* @nway_reset: Restart autonegotiation. Returns a negative error code
|
|
|
|
* or zero.
|
|
|
|
* @get_link: Report whether physical link is up. Will only be called if
|
|
|
|
* the netdev is up. Should usually be set to ethtool_op_get_link(),
|
|
|
|
* which uses netif_carrier_ok().
|
2011-04-02 04:52:34 +07:00
|
|
|
* @get_eeprom: Read data from the device EEPROM.
|
2005-04-17 05:20:36 +07:00
|
|
|
* Should fill in the magic field. Don't need to check len for zero
|
|
|
|
* or wraparound. Fill in the data argument with the eeprom values
|
|
|
|
* from offset to offset + len. Update len to the amount read.
|
|
|
|
* Returns an error or zero.
|
2011-04-02 04:52:34 +07:00
|
|
|
* @set_eeprom: Write data to the device EEPROM.
|
2005-04-17 05:20:36 +07:00
|
|
|
* Should validate the magic field. Don't need to check len for zero
|
|
|
|
* or wraparound. Update len to the amount written. Returns an error
|
|
|
|
* or zero.
|
2011-04-02 05:57:41 +07:00
|
|
|
* @get_coalesce: Get interrupt coalescing parameters. Returns a negative
|
|
|
|
* error code or zero.
|
|
|
|
* @set_coalesce: Set interrupt coalescing parameters. Returns a negative
|
|
|
|
* error code or zero.
|
2011-04-02 04:52:34 +07:00
|
|
|
* @get_ringparam: Report ring sizes
|
2011-04-02 05:57:41 +07:00
|
|
|
* @set_ringparam: Set ring sizes. Returns a negative error code or zero.
|
2011-04-02 04:52:34 +07:00
|
|
|
* @get_pauseparam: Report pause parameters
|
2011-04-02 05:57:41 +07:00
|
|
|
* @set_pauseparam: Set pause parameters. Returns a negative error code
|
|
|
|
* or zero.
|
2011-04-02 04:52:34 +07:00
|
|
|
* @self_test: Run specified self-tests
|
|
|
|
* @get_strings: Return a set of strings that describe the requested objects
|
2011-04-02 06:35:15 +07:00
|
|
|
* @set_phys_id: Identify the physical devices, e.g. by flashing an LED
|
|
|
|
* attached to it. The implementation may update the indicator
|
|
|
|
* asynchronously or synchronously, but in either case it must return
|
|
|
|
* quickly. It is initially called with the argument %ETHTOOL_ID_ACTIVE,
|
2011-04-13 20:09:10 +07:00
|
|
|
* and must either activate asynchronous updates and return zero, return
|
|
|
|
* a negative error or return a positive frequency for synchronous
|
|
|
|
* indication (e.g. 1 for one on/off cycle per second). If it returns
|
|
|
|
* a frequency then it will be called again at intervals with the
|
2011-04-02 06:35:15 +07:00
|
|
|
* argument %ETHTOOL_ID_ON or %ETHTOOL_ID_OFF and should set the state of
|
|
|
|
* the indicator accordingly. Finally, it is called with the argument
|
|
|
|
* %ETHTOOL_ID_INACTIVE and must deactivate the indicator. Returns a
|
|
|
|
* negative error code or zero.
|
2011-04-02 05:57:41 +07:00
|
|
|
* @get_ethtool_stats: Return extended statistics about the device.
|
|
|
|
* This is only useful if the device maintains statistics not
|
|
|
|
* included in &struct rtnl_link_stats64.
|
|
|
|
* @begin: Function to be called before any other operation. Returns a
|
|
|
|
* negative error code or zero.
|
|
|
|
* @complete: Function to be called after any other operation except
|
|
|
|
* @begin. Will be called even if the other operation failed.
|
|
|
|
* @get_priv_flags: Report driver-specific feature flags.
|
|
|
|
* @set_priv_flags: Set driver-specific feature flags. Returns a negative
|
|
|
|
* error code or zero.
|
|
|
|
* @get_sset_count: Get number of strings that @get_strings will write.
|
|
|
|
* @get_rxnfc: Get RX flow classification rules. Returns a negative
|
|
|
|
* error code or zero.
|
|
|
|
* @set_rxnfc: Set RX flow classification rules. Returns a negative
|
|
|
|
* error code or zero.
|
|
|
|
* @flash_device: Write a firmware image to device's flash memory.
|
|
|
|
* Returns a negative error code or zero.
|
|
|
|
* @reset: Reset (part of) the device, as specified by a bitmask of
|
|
|
|
* flags from &enum ethtool_reset_flags. Returns a negative
|
|
|
|
* error code or zero.
|
2014-04-21 17:07:59 +07:00
|
|
|
* @get_rxfh_key_size: Get the size of the RX flow hash key.
|
|
|
|
* Returns zero if not supported for this specific device.
|
2011-12-15 20:55:01 +07:00
|
|
|
* @get_rxfh_indir_size: Get the size of the RX flow hash indirection table.
|
|
|
|
* Returns zero if not supported for this specific device.
|
2014-12-02 23:12:10 +07:00
|
|
|
* @get_rxfh: Get the contents of the RX flow hash indirection table, hash key
|
|
|
|
* and/or hash function.
|
2011-04-02 05:57:41 +07:00
|
|
|
* Returns a negative error code or zero.
|
2014-12-02 23:12:10 +07:00
|
|
|
* @set_rxfh: Set the contents of the RX flow hash indirection table, hash
|
|
|
|
* key, and/or hash function. Arguments which are set to %NULL or zero
|
|
|
|
* will remain unchanged.
|
|
|
|
* Returns a negative error code or zero. An error code must be returned
|
|
|
|
* if at least one unsupported change was requested.
|
2011-04-07 08:58:42 +07:00
|
|
|
* @get_channels: Get number of channels.
|
|
|
|
* @set_channels: Set number of channels. Returns a negative error code or
|
|
|
|
* zero.
|
2011-05-12 19:48:32 +07:00
|
|
|
* @get_dump_flag: Get dump flag indicating current dump length, version,
|
|
|
|
* and flag of the device.
|
|
|
|
* @get_dump_data: Get dump data.
|
|
|
|
* @set_dump: Set dump specific flags to the device.
|
2012-04-04 05:59:17 +07:00
|
|
|
* @get_ts_info: Get the time stamping and PTP hardware clock capabilities.
|
|
|
|
* Drivers supporting transmit time stamps in software should set this to
|
|
|
|
* ethtool_op_get_ts_info().
|
2012-04-19 15:44:42 +07:00
|
|
|
* @get_module_info: Get the size and type of the eeprom contained within
|
|
|
|
* a plug-in module.
|
|
|
|
* @get_module_eeprom: Get the eeprom information from the plug-in module
|
2012-06-07 00:13:06 +07:00
|
|
|
* @get_eee: Get Energy-Efficient (EEE) supported and status.
|
|
|
|
* @set_eee: Set EEE status (enable/disable) as well as LPI timers.
|
2016-02-19 21:24:02 +07:00
|
|
|
* @get_per_queue_coalesce: Get interrupt coalescing parameters per queue.
|
|
|
|
* It must check that the given queue number is valid. If neither a RX nor
|
|
|
|
* a TX queue has this number, return -EINVAL. If only a RX queue or a TX
|
|
|
|
* queue has this number, set the inapplicable fields to ~0 and return 0.
|
|
|
|
* Returns a negative error code or zero.
|
2016-02-19 21:24:03 +07:00
|
|
|
* @set_per_queue_coalesce: Set interrupt coalescing parameters per queue.
|
|
|
|
* It must check that the given queue number is valid. If neither a RX nor
|
|
|
|
* a TX queue has this number, return -EINVAL. If only a RX queue or a TX
|
|
|
|
* queue has this number, ignore the inapplicable fields.
|
|
|
|
* Returns a negative error code or zero.
|
net: ethtool: add new ETHTOOL_xLINKSETTINGS API
This patch defines a new ETHTOOL_GLINKSETTINGS/SLINKSETTINGS API,
handled by the new get_link_ksettings/set_link_ksettings callbacks.
This API provides support for most legacy ethtool_cmd fields, adds
support for larger link mode masks (up to 4064 bits, variable length),
and removes ethtool_cmd deprecated
fields (transceiver/maxrxpkt/maxtxpkt).
This API is deprecating the legacy ETHTOOL_GSET/SSET API and provides
the following backward compatibility properties:
- legacy ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks.
- legacy ethtool with new get/set_link_ksettings drivers: the new
driver callbacks are used, data internally converted to legacy
ethtool_cmd. ETHTOOL_GSET will return only the 1st 32b of each link
mode mask. ETHTOOL_SSET will fail if user tries to set the
ethtool_cmd deprecated fields to
non-0 (transceiver/maxrxpkt/maxtxpkt). A kernel warning is logged if
driver sets higher bits.
- future ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks, internally converted to new data
structure. Deprecated fields (transceiver/maxrxpkt/maxtxpkt) will be
ignored and seen as 0 from user space. Note that that "future"
ethtool tool will not allow changes to these deprecated fields.
- future ethtool with new drivers: direct call to the new callbacks.
By "future" ethtool, what is meant is:
- query: first try ETHTOOL_GLINKSETTINGS, and revert to ETHTOOL_GSET if
fails
- set: query first and remember which of ETHTOOL_GLINKSETTINGS or
ETHTOOL_GSET was successful
+ if ETHTOOL_GLINKSETTINGS was successful, then change config with
ETHTOOL_SLINKSETTINGS. A failure there is final (do not try
ETHTOOL_SSET).
+ otherwise ETHTOOL_GSET was successful, change config with
ETHTOOL_SSET. A failure there is final (do not try
ETHTOOL_SLINKSETTINGS).
The interaction user/kernel via the new API requires a small
ETHTOOL_GLINKSETTINGS handshake first to agree on the length of the link
mode bitmaps. If kernel doesn't agree with user, it returns the bitmap
length it is expecting from user as a negative length (and cmd field is
0). When kernel and user agree, kernel returns valid info in all
fields (ie. link mode length > 0 and cmd is ETHTOOL_GLINKSETTINGS).
Data structure crossing user/kernel boundary is 32/64-bit
agnostic. Converted internally to a legal kernel bitmap.
The internal __ethtool_get_settings kernel helper will gradually be
replaced by __ethtool_get_link_ksettings by the time the first
"link_settings" drivers start to appear. So this patch doesn't change
it, it will be removed before it needs to be changed.
Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-25 01:57:59 +07:00
|
|
|
* @get_link_ksettings: When defined, takes precedence over the
|
|
|
|
* %get_settings method. Get various device settings
|
|
|
|
* including Ethernet link settings. The %cmd and
|
|
|
|
* %link_mode_masks_nwords fields should be ignored (use
|
|
|
|
* %__ETHTOOL_LINK_MODE_MASK_NBITS instead of the latter), any
|
|
|
|
* change to them will be overwritten by kernel. Returns a
|
|
|
|
* negative error code or zero.
|
|
|
|
* @set_link_ksettings: When defined, takes precedence over the
|
|
|
|
* %set_settings method. Set various device settings including
|
|
|
|
* Ethernet link settings. The %cmd and %link_mode_masks_nwords
|
|
|
|
* fields should be ignored (use %__ETHTOOL_LINK_MODE_MASK_NBITS
|
|
|
|
* instead of the latter), any change to them will be overwritten
|
|
|
|
* by kernel. Returns a negative error code or zero.
|
2011-04-02 05:57:41 +07:00
|
|
|
*
|
|
|
|
* All operations are optional (i.e. the function pointer may be set
|
|
|
|
* to %NULL) and callers must take this into account. Callers must
|
2012-04-05 21:38:49 +07:00
|
|
|
* hold the RTNL lock.
|
2011-04-02 05:57:41 +07:00
|
|
|
*
|
|
|
|
* See the structures used by these operations for further documentation.
|
2014-02-13 05:14:53 +07:00
|
|
|
* Note that for all operations using a structure ending with a zero-
|
|
|
|
* length array, the array is allocated separately in the kernel and
|
|
|
|
* is passed to the driver as an additional parameter.
|
2011-04-02 05:57:41 +07:00
|
|
|
*
|
|
|
|
* See &struct net_device and &struct net_device_ops for documentation
|
|
|
|
* of the generic netdev features interface.
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
|
|
|
struct ethtool_ops {
|
|
|
|
int (*get_settings)(struct net_device *, struct ethtool_cmd *);
|
|
|
|
int (*set_settings)(struct net_device *, struct ethtool_cmd *);
|
|
|
|
void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
|
|
|
|
int (*get_regs_len)(struct net_device *);
|
|
|
|
void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
|
|
|
|
void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
|
|
|
|
int (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
|
|
|
|
u32 (*get_msglevel)(struct net_device *);
|
|
|
|
void (*set_msglevel)(struct net_device *, u32);
|
|
|
|
int (*nway_reset)(struct net_device *);
|
|
|
|
u32 (*get_link)(struct net_device *);
|
|
|
|
int (*get_eeprom_len)(struct net_device *);
|
2010-04-08 11:54:42 +07:00
|
|
|
int (*get_eeprom)(struct net_device *,
|
|
|
|
struct ethtool_eeprom *, u8 *);
|
|
|
|
int (*set_eeprom)(struct net_device *,
|
|
|
|
struct ethtool_eeprom *, u8 *);
|
2005-04-17 05:20:36 +07:00
|
|
|
int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
|
|
|
|
int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
|
2010-04-08 11:54:42 +07:00
|
|
|
void (*get_ringparam)(struct net_device *,
|
|
|
|
struct ethtool_ringparam *);
|
|
|
|
int (*set_ringparam)(struct net_device *,
|
|
|
|
struct ethtool_ringparam *);
|
|
|
|
void (*get_pauseparam)(struct net_device *,
|
|
|
|
struct ethtool_pauseparam*);
|
|
|
|
int (*set_pauseparam)(struct net_device *,
|
|
|
|
struct ethtool_pauseparam*);
|
2005-04-17 05:20:36 +07:00
|
|
|
void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
|
|
|
|
void (*get_strings)(struct net_device *, u32 stringset, u8 *);
|
2011-04-02 06:35:15 +07:00
|
|
|
int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
|
2010-04-08 11:54:42 +07:00
|
|
|
void (*get_ethtool_stats)(struct net_device *,
|
|
|
|
struct ethtool_stats *, u64 *);
|
2005-04-17 05:20:36 +07:00
|
|
|
int (*begin)(struct net_device *);
|
|
|
|
void (*complete)(struct net_device *);
|
2010-04-08 11:54:42 +07:00
|
|
|
u32 (*get_priv_flags)(struct net_device *);
|
|
|
|
int (*set_priv_flags)(struct net_device *, u32);
|
2007-08-16 06:01:08 +07:00
|
|
|
int (*get_sset_count)(struct net_device *, int);
|
2010-04-08 11:54:42 +07:00
|
|
|
int (*get_rxnfc)(struct net_device *,
|
2011-09-06 20:49:12 +07:00
|
|
|
struct ethtool_rxnfc *, u32 *rule_locs);
|
2009-02-20 15:58:13 +07:00
|
|
|
int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
|
2010-04-08 11:54:42 +07:00
|
|
|
int (*flash_device)(struct net_device *, struct ethtool_flash *);
|
2009-10-05 17:59:58 +07:00
|
|
|
int (*reset)(struct net_device *, u32 *);
|
2014-04-21 17:07:59 +07:00
|
|
|
u32 (*get_rxfh_key_size)(struct net_device *);
|
2011-12-15 20:55:01 +07:00
|
|
|
u32 (*get_rxfh_indir_size)(struct net_device *);
|
2014-12-02 23:12:10 +07:00
|
|
|
int (*get_rxfh)(struct net_device *, u32 *indir, u8 *key,
|
|
|
|
u8 *hfunc);
|
2014-05-15 08:01:23 +07:00
|
|
|
int (*set_rxfh)(struct net_device *, const u32 *indir,
|
2014-12-02 23:12:10 +07:00
|
|
|
const u8 *key, const u8 hfunc);
|
2011-04-07 08:58:42 +07:00
|
|
|
void (*get_channels)(struct net_device *, struct ethtool_channels *);
|
|
|
|
int (*set_channels)(struct net_device *, struct ethtool_channels *);
|
2011-05-12 19:48:32 +07:00
|
|
|
int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
|
|
|
|
int (*get_dump_data)(struct net_device *,
|
|
|
|
struct ethtool_dump *, void *);
|
|
|
|
int (*set_dump)(struct net_device *, struct ethtool_dump *);
|
2012-04-04 05:59:17 +07:00
|
|
|
int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
|
2012-04-19 15:44:42 +07:00
|
|
|
int (*get_module_info)(struct net_device *,
|
|
|
|
struct ethtool_modinfo *);
|
|
|
|
int (*get_module_eeprom)(struct net_device *,
|
|
|
|
struct ethtool_eeprom *, u8 *);
|
2012-06-07 00:13:06 +07:00
|
|
|
int (*get_eee)(struct net_device *, struct ethtool_eee *);
|
|
|
|
int (*set_eee)(struct net_device *, struct ethtool_eee *);
|
2014-09-03 04:47:20 +07:00
|
|
|
int (*get_tunable)(struct net_device *,
|
|
|
|
const struct ethtool_tunable *, void *);
|
|
|
|
int (*set_tunable)(struct net_device *,
|
|
|
|
const struct ethtool_tunable *, const void *);
|
2016-02-19 21:24:02 +07:00
|
|
|
int (*get_per_queue_coalesce)(struct net_device *, u32,
|
|
|
|
struct ethtool_coalesce *);
|
2016-02-19 21:24:03 +07:00
|
|
|
int (*set_per_queue_coalesce)(struct net_device *, u32,
|
|
|
|
struct ethtool_coalesce *);
|
net: ethtool: add new ETHTOOL_xLINKSETTINGS API
This patch defines a new ETHTOOL_GLINKSETTINGS/SLINKSETTINGS API,
handled by the new get_link_ksettings/set_link_ksettings callbacks.
This API provides support for most legacy ethtool_cmd fields, adds
support for larger link mode masks (up to 4064 bits, variable length),
and removes ethtool_cmd deprecated
fields (transceiver/maxrxpkt/maxtxpkt).
This API is deprecating the legacy ETHTOOL_GSET/SSET API and provides
the following backward compatibility properties:
- legacy ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks.
- legacy ethtool with new get/set_link_ksettings drivers: the new
driver callbacks are used, data internally converted to legacy
ethtool_cmd. ETHTOOL_GSET will return only the 1st 32b of each link
mode mask. ETHTOOL_SSET will fail if user tries to set the
ethtool_cmd deprecated fields to
non-0 (transceiver/maxrxpkt/maxtxpkt). A kernel warning is logged if
driver sets higher bits.
- future ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks, internally converted to new data
structure. Deprecated fields (transceiver/maxrxpkt/maxtxpkt) will be
ignored and seen as 0 from user space. Note that that "future"
ethtool tool will not allow changes to these deprecated fields.
- future ethtool with new drivers: direct call to the new callbacks.
By "future" ethtool, what is meant is:
- query: first try ETHTOOL_GLINKSETTINGS, and revert to ETHTOOL_GSET if
fails
- set: query first and remember which of ETHTOOL_GLINKSETTINGS or
ETHTOOL_GSET was successful
+ if ETHTOOL_GLINKSETTINGS was successful, then change config with
ETHTOOL_SLINKSETTINGS. A failure there is final (do not try
ETHTOOL_SSET).
+ otherwise ETHTOOL_GSET was successful, change config with
ETHTOOL_SSET. A failure there is final (do not try
ETHTOOL_SLINKSETTINGS).
The interaction user/kernel via the new API requires a small
ETHTOOL_GLINKSETTINGS handshake first to agree on the length of the link
mode bitmaps. If kernel doesn't agree with user, it returns the bitmap
length it is expecting from user as a negative length (and cmd field is
0). When kernel and user agree, kernel returns valid info in all
fields (ie. link mode length > 0 and cmd is ETHTOOL_GLINKSETTINGS).
Data structure crossing user/kernel boundary is 32/64-bit
agnostic. Converted internally to a legal kernel bitmap.
The internal __ethtool_get_settings kernel helper will gradually be
replaced by __ethtool_get_link_ksettings by the time the first
"link_settings" drivers start to appear. So this patch doesn't change
it, it will be removed before it needs to be changed.
Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-25 01:57:59 +07:00
|
|
|
int (*get_link_ksettings)(struct net_device *,
|
|
|
|
struct ethtool_link_ksettings *);
|
|
|
|
int (*set_link_ksettings)(struct net_device *,
|
|
|
|
const struct ethtool_link_ksettings *);
|
2017-07-28 06:47:26 +07:00
|
|
|
int (*get_fecparam)(struct net_device *,
|
|
|
|
struct ethtool_fecparam *);
|
|
|
|
int (*set_fecparam)(struct net_device *,
|
|
|
|
struct ethtool_fecparam *);
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
#endif /* _LINUX_ETHTOOL_H */
|