* [PATCH net-next v1 04/18] net: ethtool: add new ETHTOOL_GSETTINGS/SSETTINGS API
From: David Decotigny @ 2015-01-27 1:36 UTC (permalink / raw)
To: David S. Miller, Ben Hutchings, Amir Vadai, linux-kernel, netdev,
linux-api
Cc: Eric Dumazet, Eugenia Emantayev, Or Gerlitz, Ido Shamay,
Joe Perches, Saeed Mahameed, Govindarajulu Varadarajan,
Venkata Duvvuru, Jeff Kirsher, Eyal Perry, Pravin B Shelar,
Ed Swierk, David Decotigny
In-Reply-To: <1422322574-6188-1-git-send-email-ddecotig@gmail.com>
From: David Decotigny <decot@googlers.com>
This patch defines a new ETHTOOL_GSETTINGS/SSETTINGS API, handled by
the new get_ksettings/set_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_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 printed if
driver exports higher bits or if user request changes in deprecated
fields mentioned earlier.
- future ethtool with legacy drivers: no change, still using the
get_settings/set_settings callbacks, internally converted to new
data structure. Note that that "future" ethtool tool will not allow
changes to deprecated fields (transceiver/maxrxpkt/maxtxpkt), as
they cannot be expressed for the kernel.
- future ethtool with new drivers: direct call to the new callbacks.
By "future" ethtool, what is meant is:
- query: first try ETHTOOL_GSETTINGS, and revert to ETHTOOL_GSET if fails
- set: query first and remember which of ETHTOOL_GSETTINGS or
ETHTOOL_GSET was successful
- if ETHTOOL_GSETTINGS was successful, then change config with
ETHTOOL_SSETTINGS. 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_SSETTINGS).
The interaction user/kernel via the new API requires a small
ETHTOOL_GSETTINGS 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_GSETTINGS).
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_ksettings by the time the first ksettings
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>
---
include/linux/ethtool.h | 100 ++++++++-
include/uapi/linux/ethtool.h | 319 ++++++++++++++++++++++------
net/core/ethtool.c | 486 ++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 826 insertions(+), 79 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 653dc9c..49881b6 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -12,6 +12,7 @@
#ifndef _LINUX_ETHTOOL_H
#define _LINUX_ETHTOOL_H
+#include <linux/bitmap.h>
#include <linux/compat.h>
#include <uapi/linux/ethtool.h>
@@ -40,9 +41,6 @@ struct compat_ethtool_rxnfc {
#include <linux/rculist.h>
-extern int __ethtool_get_settings(struct net_device *dev,
- struct ethtool_cmd *cmd);
-
/**
* enum ethtool_phys_id_state - indicator state for physical identification
* @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated
@@ -97,13 +95,84 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
return index % n_rx_rings;
}
+/* number of link mode bits handled internally by kernel */
+#define __ETHTOOL_LINK_MODE_MASK_NBITS (__ETHTOOL_LINK_MODE_LAST+1)
+
+#define __ETHTOOL_LINK_MODE_IS_VALID_BIT(indice) \
+ ((indice) >= 0 && (indice) < __ETHTOOL_LINK_MODE_MASK_NBITS)
+
+typedef struct {
+ unsigned long mask[BITS_TO_LONGS(__ETHTOOL_LINK_MODE_MASK_NBITS)];
+} ethtool_link_mode_mask_t;
+
+/* drivers must ignore parent.cmd and parent.link_mode_masks_nwords
+ * fields, but they are allowed to overwrite them (will be ignored) */
+struct ethtool_ksettings {
+ struct ethtool_settings parent;
+ struct {
+ ethtool_link_mode_mask_t supported;
+ ethtool_link_mode_mask_t advertising;
+ ethtool_link_mode_mask_t lp_advertising;
+ } link_modes;
+};
+
+/* helper function for ethtool_build_link_mode and ethtool_add_link_modes */
+static inline int
+__ethtool_add_link_modes(ethtool_link_mode_mask_t *dst,
+ unsigned nindices,
+ const enum ethtool_link_mode_bit_indices *indices) {
+ unsigned i;
+ int rv = 0;
+
+ for (i = 0 ; i < nindices ; ++i) {
+ if (__ETHTOOL_LINK_MODE_IS_VALID_BIT(indices[i]))
+ set_bit(indices[i], dst->mask);
+ else
+ rv = -1;
+ }
+ return rv;
+}
+
+/* build link mode mask from variadic list of bit indices, return 0
+ * when all indices are valid, -1 otherwise
+ */
+#define ethtool_build_link_mode(dst, ...) \
+ ({ \
+ const enum ethtool_link_mode_bit_indices indices[] = { \
+ __VA_ARGS__ }; \
+ bitmap_zero((dst)->mask, \
+ __ETHTOOL_LINK_MODE_MASK_NBITS); \
+ __ethtool_add_link_modes((dst), \
+ ARRAY_SIZE(indices), indices); \
+ })
+
+/* update link mode mask by setting variadic list of bit indices,
+ * return 0 when all indices are valid, -1 otherwise
+ */
+#define ethtool_add_link_modes(dst, ...) \
+ ({ \
+ const enum ethtool_link_mode_bit_indices indices[] = { \
+ __VA_ARGS__ }; \
+ __ethtool_add_link_modes((dst), \
+ ARRAY_SIZE(indices), indices); \
+ })
+
+extern int __ethtool_get_ksettings(struct net_device *dev,
+ struct ethtool_ksettings *ksettings);
+
+/* DEPRECATED, use __ethtool_get_ksettings */
+extern int __ethtool_get_settings(struct net_device *dev,
+ struct ethtool_cmd *cmd);
+
/**
* struct ethtool_ops - optional netdev operations
- * @get_settings: Get various device settings including Ethernet link
+ * @get_settings: DEPRECATED, use %get_ksettings/%set_ksettings
+ * API. Get various device settings including Ethernet link
* settings. The @cmd parameter is expected to have been cleared
- * before get_settings is called. Returns a negative error code or
- * zero.
- * @set_settings: Set various device settings including Ethernet link
+ * before get_settings is called. Returns a negative error code
+ * or zero.
+ * @set_settings: DEPRECATED, use %get_ksettings/%set_ksettings
+ * API. Set various device settings including Ethernet link
* 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
@@ -201,6 +270,18 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
* @get_module_eeprom: Get the eeprom information from the plug-in module
* @get_eee: Get Energy-Efficient (EEE) supported and status.
* @set_eee: Set EEE status (enable/disable) as well as LPI timers.
+ * @get_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_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.
*
* All operations are optional (i.e. the function pointer may be set
* to %NULL) and callers must take this into account. Callers must
@@ -280,6 +361,9 @@ struct ethtool_ops {
int (*set_tunable)(struct net_device *,
const struct ethtool_tunable *, const void *);
-
+ int (*get_ksettings)(struct net_device *,
+ struct ethtool_ksettings *);
+ int (*set_ksettings)(struct net_device *,
+ const struct ethtool_ksettings *);
};
#endif /* _LINUX_ETHTOOL_H */
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 5f66d9c..c85cc2f 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -21,7 +21,8 @@
*/
/**
- * struct ethtool_cmd - link control and status
+ * struct ethtool_cmd - DEPRECATED, link control and status
+ * This structure is DEPRECATED, please use struct ethtool_settings.
* @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET
* @supported: Bitmask of %SUPPORTED_* flags for the link modes,
* physical connectors and other link features for which the
@@ -1108,8 +1109,10 @@ enum ethtool_sfeatures_retval_bits {
/* CMDs currently supported */
-#define ETHTOOL_GSET 0x00000001 /* Get settings. */
-#define ETHTOOL_SSET 0x00000002 /* Set settings. */
+#define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings.
+ Please use ETHTOOL_GSETTINGS */
+#define ETHTOOL_SSET 0x00000002 /* DEPRECATED, Set settings.
+ Please use ETHTOOL_SSETTINGS */
#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
@@ -1188,73 +1191,137 @@ enum ethtool_sfeatures_retval_bits {
#define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */
#define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */
+#define ETHTOOL_GSETTINGS 0x0000004a /* Get ethtool_settings */
+#define ETHTOOL_SSETTINGS 0x0000004b /* Set ethtool_settings */
+
+
/* compatibility with older code */
#define SPARC_ETH_GSET ETHTOOL_GSET
#define SPARC_ETH_SSET ETHTOOL_SSET
-#define SUPPORTED_10baseT_Half (1 << 0)
-#define SUPPORTED_10baseT_Full (1 << 1)
-#define SUPPORTED_100baseT_Half (1 << 2)
-#define SUPPORTED_100baseT_Full (1 << 3)
-#define SUPPORTED_1000baseT_Half (1 << 4)
-#define SUPPORTED_1000baseT_Full (1 << 5)
-#define SUPPORTED_Autoneg (1 << 6)
-#define SUPPORTED_TP (1 << 7)
-#define SUPPORTED_AUI (1 << 8)
-#define SUPPORTED_MII (1 << 9)
-#define SUPPORTED_FIBRE (1 << 10)
-#define SUPPORTED_BNC (1 << 11)
-#define SUPPORTED_10000baseT_Full (1 << 12)
-#define SUPPORTED_Pause (1 << 13)
-#define SUPPORTED_Asym_Pause (1 << 14)
-#define SUPPORTED_2500baseX_Full (1 << 15)
-#define SUPPORTED_Backplane (1 << 16)
-#define SUPPORTED_1000baseKX_Full (1 << 17)
-#define SUPPORTED_10000baseKX4_Full (1 << 18)
-#define SUPPORTED_10000baseKR_Full (1 << 19)
-#define SUPPORTED_10000baseR_FEC (1 << 20)
-#define SUPPORTED_20000baseMLD2_Full (1 << 21)
-#define SUPPORTED_20000baseKR2_Full (1 << 22)
-#define SUPPORTED_40000baseKR4_Full (1 << 23)
-#define SUPPORTED_40000baseCR4_Full (1 << 24)
-#define SUPPORTED_40000baseSR4_Full (1 << 25)
-#define SUPPORTED_40000baseLR4_Full (1 << 26)
-#define SUPPORTED_56000baseKR4_Full (1 << 27)
-#define SUPPORTED_56000baseCR4_Full (1 << 28)
-#define SUPPORTED_56000baseSR4_Full (1 << 29)
-#define SUPPORTED_56000baseLR4_Full (1 << 30)
-
-#define ADVERTISED_10baseT_Half (1 << 0)
-#define ADVERTISED_10baseT_Full (1 << 1)
-#define ADVERTISED_100baseT_Half (1 << 2)
-#define ADVERTISED_100baseT_Full (1 << 3)
-#define ADVERTISED_1000baseT_Half (1 << 4)
-#define ADVERTISED_1000baseT_Full (1 << 5)
-#define ADVERTISED_Autoneg (1 << 6)
-#define ADVERTISED_TP (1 << 7)
-#define ADVERTISED_AUI (1 << 8)
-#define ADVERTISED_MII (1 << 9)
-#define ADVERTISED_FIBRE (1 << 10)
-#define ADVERTISED_BNC (1 << 11)
-#define ADVERTISED_10000baseT_Full (1 << 12)
-#define ADVERTISED_Pause (1 << 13)
-#define ADVERTISED_Asym_Pause (1 << 14)
-#define ADVERTISED_2500baseX_Full (1 << 15)
-#define ADVERTISED_Backplane (1 << 16)
-#define ADVERTISED_1000baseKX_Full (1 << 17)
-#define ADVERTISED_10000baseKX4_Full (1 << 18)
-#define ADVERTISED_10000baseKR_Full (1 << 19)
-#define ADVERTISED_10000baseR_FEC (1 << 20)
-#define ADVERTISED_20000baseMLD2_Full (1 << 21)
-#define ADVERTISED_20000baseKR2_Full (1 << 22)
-#define ADVERTISED_40000baseKR4_Full (1 << 23)
-#define ADVERTISED_40000baseCR4_Full (1 << 24)
-#define ADVERTISED_40000baseSR4_Full (1 << 25)
-#define ADVERTISED_40000baseLR4_Full (1 << 26)
-#define ADVERTISED_56000baseKR4_Full (1 << 27)
-#define ADVERTISED_56000baseCR4_Full (1 << 28)
-#define ADVERTISED_56000baseSR4_Full (1 << 29)
-#define ADVERTISED_56000baseLR4_Full (1 << 30)
+/* Link mode bit indices */
+enum ethtool_link_mode_bit_indices {
+ ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0,
+ ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1,
+ ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2,
+ ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3,
+ ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4,
+ ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5,
+ ETHTOOL_LINK_MODE_Autoneg_BIT = 6,
+ ETHTOOL_LINK_MODE_TP_BIT = 7,
+ ETHTOOL_LINK_MODE_AUI_BIT = 8,
+ ETHTOOL_LINK_MODE_MII_BIT = 9,
+ ETHTOOL_LINK_MODE_FIBRE_BIT = 10,
+ ETHTOOL_LINK_MODE_BNC_BIT = 11,
+ ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12,
+ ETHTOOL_LINK_MODE_Pause_BIT = 13,
+ ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14,
+ ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15,
+ ETHTOOL_LINK_MODE_Backplane_BIT = 16,
+ ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17,
+ ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18,
+ ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19,
+ ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20,
+ ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21,
+ ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22,
+ ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23,
+ ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24,
+ ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25,
+ ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26,
+ ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27,
+ ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28,
+ ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29,
+ ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30,
+
+ /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit
+ 31. Please do NOT define any SUPPORTED_* or ADVERTISED_*
+ macro for bits > 31. The only way to use indices > 31 is to
+ use the new ETHTOOL_GSETTINGS/ETHTOOL_SSETTINGS API */
+
+ __ETHTOOL_LINK_MODE_LAST
+ = ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT,
+};
+
+#define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \
+ (1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT))
+
+/* DEPRECATED macros. Please migrate to
+ ETHTOOL_GSETTINGS/ETHTOOL_SSETTINGS API. Please do NOT define any new
+ SUPPORTED_* macro for bits > 31. */
+#define SUPPORTED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
+#define SUPPORTED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
+#define SUPPORTED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
+#define SUPPORTED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
+#define SUPPORTED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
+#define SUPPORTED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
+#define SUPPORTED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
+#define SUPPORTED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
+#define SUPPORTED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
+#define SUPPORTED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
+#define SUPPORTED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
+#define SUPPORTED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
+#define SUPPORTED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
+#define SUPPORTED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
+#define SUPPORTED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
+#define SUPPORTED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
+#define SUPPORTED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
+#define SUPPORTED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
+#define SUPPORTED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
+#define SUPPORTED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
+#define SUPPORTED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
+#define SUPPORTED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
+#define SUPPORTED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
+#define SUPPORTED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
+#define SUPPORTED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
+#define SUPPORTED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
+#define SUPPORTED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
+#define SUPPORTED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
+#define SUPPORTED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
+#define SUPPORTED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
+#define SUPPORTED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
+/* Please do not define any new SUPPORTED_* macro for bits > 31, see
+ * notice above.
+ */
+
+/*
+ * DEPRECATED macros. Please migrate to
+ * ETHTOOL_GSETTINGS/ETHTOOL_SSETTINGS API. Please do NOT define any new
+ * ADERTISE_* macro for bits > 31.
+ */
+#define ADVERTISED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
+#define ADVERTISED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
+#define ADVERTISED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
+#define ADVERTISED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
+#define ADVERTISED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
+#define ADVERTISED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
+#define ADVERTISED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
+#define ADVERTISED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
+#define ADVERTISED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
+#define ADVERTISED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
+#define ADVERTISED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
+#define ADVERTISED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
+#define ADVERTISED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
+#define ADVERTISED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
+#define ADVERTISED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
+#define ADVERTISED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
+#define ADVERTISED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
+#define ADVERTISED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
+#define ADVERTISED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
+#define ADVERTISED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
+#define ADVERTISED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
+#define ADVERTISED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
+#define ADVERTISED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
+#define ADVERTISED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
+#define ADVERTISED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
+#define ADVERTISED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
+#define ADVERTISED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
+#define ADVERTISED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
+#define ADVERTISED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
+#define ADVERTISED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
+#define ADVERTISED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
+/* Please do not define any new ADVERTISED_* macro for bits > 31, see
+ * notice above.
+ */
/* The following are all involved in forcing a particular link
* mode for the device for setting things. When getting the
@@ -1396,4 +1463,124 @@ enum ethtool_reset_flags {
};
#define ETH_RESET_SHARED_SHIFT 16
+
+/**
+ * struct ethtool_settings - link control and status
+ * This structure deprecates struct %ethtool_cmd.
+ *
+ * IMPORTANT, Backward compatibility notice: When implementing new
+ * user-space tools, please first try %ETHTOOL_GSETTINGS, and if
+ * it succeeds use %ETHTOOL_SSETTINGS to change settings; do not
+ * use %ETHTOOL_SSET if %ETHTOOL_GSETTINGS succeeded: stick to
+ * %ETHTOOL_GSETTINGS/%SSETTINGS in that case. Conversely, if
+ * %ETHTOOL_GSETTINGS fails, use %ETHTOOL_GSET to query and
+ * %ETHTOOL_SSET to change settings; do not use
+ * %ETHTOOL_SSETTINGS if %ETHTOOL_GSETTINGS failed: stick to
+ * %ETHTOOL_GSET/%ETHTOOL_SSET in that case.
+ *
+ * @cmd: Command number = %ETHTOOL_GSETTINGS or %ETHTOOL_SSETTINGS
+ * @speed: Link speed (Mbps)
+ * @duplex: Duplex mode; one of %DUPLEX_*
+ * @port: Physical connector type; one of %PORT_*
+ * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
+ * applicable. For clause 45 PHYs this is the PRTAD.
+ * @autoneg: Enable/disable autonegotiation and auto-detection;
+ * either %AUTONEG_DISABLE or %AUTONEG_ENABLE
+ * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
+ * protocols supported by the interface; 0 if unknown.
+ * Read-only.
+ * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
+ * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
+ * value will be %ETH_TP_MDI_INVALID. Read-only.
+ * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
+ * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads
+ * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
+ * When written successfully, the link should be renegotiated if
+ * necessary.
+ * @link_mode_masks_nwords: Number of 32-bit words for each of the
+ * supported, advertising, lp_advertising link mode bitmaps. For
+ * %ETHTOOL_GSETTINGS: on entry, number of words passed by user
+ * (>= 0); on return, if handshake in progress, negative if
+ * request size unsupported by kernel: absolute value indicates
+ * kernel recommended size and cmd field is 0, as well as all the
+ * other fields; otherwise (handshake completed), strictly
+ * positive to indicate size used by kernel and cmd field is
+ * %ETHTOOL_GSETTINGS, all other fields populated by driver. For
+ * %ETHTOOL_SSETTINGS: must be valid on entry, ie. a positive
+ * value returned previously by %ETHTOOL_GSETTINGS, otherwise
+ * refused. For drivers: ignore this field (use kernel's
+ * __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will
+ * be overwritten by kernel.
+ * @supported: Bitmap with each bit meaning given by
+ * %ethtool_link_mode_bit_indices for the link modes, physical
+ * connectors and other link features for which the interface
+ * supports autonegotiation or auto-detection. Read-only.
+ * @advertising: Bitmap with each bit meaning given by
+ * %ethtool_link_mode_bit_indices for the link modes, physical
+ * connectors and other link features that are advertised through
+ * autonegotiation or enabled for auto-detection.
+ * @lp_advertising: Bitmap with each bit meaning given by
+ * %ethtool_link_mode_bit_indices for the link modes, and other
+ * link features that the link partner advertised through
+ * autonegotiation; 0 if unknown or not applicable. Read-only.
+ *
+ * If autonegotiation is disabled, the speed and @duplex represent the
+ * fixed link mode and are writable if the driver supports multiple
+ * link modes. If it is enabled then they are read-only; if the link
+ * is up they represent the negotiated link mode; if the link is down,
+ * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
+ * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
+ *
+ * Some hardware interfaces may have multiple PHYs and/or physical
+ * connectors fitted or do not allow the driver to detect which are
+ * fitted. For these interfaces @port and/or @phy_address may be
+ * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
+ * Otherwise, attempts to write different values may be ignored or
+ * rejected.
+ *
+ * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt
+ * are not available in %ethtool_settings. Until all drivers are
+ * converted to ignore them or to the new %ethtool_settings API, for
+ * both queries and changes, users should always try
+ * %ETHTOOL_GSETTINGS first, and if it fails with -ENOTSUPP stick only
+ * to %ETHTOOL_GSET and %ETHTOOL_SSET consistently. If it succeeds,
+ * then users should stick to %ETHTOOL_GSETTINGS and
+ * %ETHTOOL_SSETTINGS (which would support drivers implementing either
+ * %ethtool_cmd or %ethtool_settings).
+ *
+ * Users should assume that all fields not marked read-only are
+ * writable and subject to validation by the driver. They should use
+ * %ETHTOOL_GSETTINGS to get the current values before making specific
+ * changes and then applying them with %ETHTOOL_SSETTINGS.
+ *
+ * Drivers that implement %get_ksettings and/or %set_ksettings should
+ * ignore the @cmd and @link_mode_masks_nwords fields (any change to
+ * them overwritten by kernel), and rely only on kernel's internal
+ * %__ETHTOOL_LINK_MODE_MASK_NBITS and
+ * %ethtool_link_mode_mask_t. Drivers that implement %set_ksettings()
+ * should validate all fields other than @cmd
+ * and @link_mode_masks_nwords that are not described as read-only or
+ * deprecated, and must ignore all fields described as read-only.
+ *
+ * Deprecated fields should be ignored by both users and drivers.
+ */
+struct ethtool_settings {
+ __u32 cmd;
+ __u32 speed;
+ __u8 duplex;
+ __u8 port;
+ __u8 phy_address;
+ __u8 autoneg;
+ __u8 mdio_support;
+ __u8 eth_tp_mdix;
+ __u8 eth_tp_mdix_ctrl;
+ __s8 link_mode_masks_nwords;
+ __u32 reserved[8];
+ __u32 link_mode_masks[0];
+ /* layout of link_mode_masks fields:
+ * __u32 map_supported[link_mode_masks_nwords];
+ * __u32 map_advertising[link_mode_masks_nwords];
+ * __u32 map_lp_advertising[link_mode_masks_nwords];
+ */
+};
#endif /* _UAPI_LINUX_ETHTOOL_H */
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 52efb7e..d978d80 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -340,6 +340,388 @@ static int __ethtool_set_flags(struct net_device *dev, u32 data)
return 0;
}
+/* TODO: remove when %ETHTOOL_GSET/%ETHTOOL_SSET disappear */
+static void convert_legacy_u32_to_link_mode(ethtool_link_mode_mask_t *dst,
+ u32 legacy_u32)
+{
+ bitmap_zero(dst->mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
+ dst->mask[0] = legacy_u32;
+}
+
+/* return false if src had higher bits set. lower bits always updated.
+ * TODO: remove when %ETHTOOL_GSET/%ETHTOOL_SSET disappear
+ */
+static bool convert_link_mode_to_legacy_u32(u32 *legacy_u32,
+ const ethtool_link_mode_mask_t *src)
+{
+ bool retval = true;
+
+ /* TODO: following test will soon always be true */
+ if (__ETHTOOL_LINK_MODE_MASK_NBITS > 32) {
+ ethtool_link_mode_mask_t ext;
+
+ bitmap_zero(ext.mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
+ bitmap_fill(ext.mask, 32);
+ bitmap_complement(ext.mask, ext.mask,
+ __ETHTOOL_LINK_MODE_MASK_NBITS);
+ if (bitmap_intersects(ext.mask, src->mask,
+ __ETHTOOL_LINK_MODE_MASK_NBITS)) {
+ /* src mask goes beyond bit 31 */
+ retval = false;
+ }
+ }
+ *legacy_u32 = src->mask[0];
+ return retval;
+}
+
+/* return false if legacy contained non-0 deprecated fields
+ * transceiver/maxtxpkt/maxrxpkt. rest of ksettings always updated
+ * TODO: remove when %ETHTOOL_GSET/%ETHTOOL_SSET disappear
+ */
+static bool
+convert_legacy_settings_to_ksettings(struct ethtool_ksettings *ksettings,
+ const struct ethtool_cmd *legacy_settings)
+{
+ bool retval = true;
+
+ memset(ksettings, 0, sizeof(*ksettings));
+
+ /* This is used to tell users that driver is still using these
+ * deprecated legacy fields, and they should not use
+ * %ETHTOOL_GSETTINGS/%ETHTOOL_SSETTINGS
+ */
+ if (legacy_settings->transceiver ||
+ legacy_settings->maxtxpkt ||
+ legacy_settings->maxrxpkt)
+ retval = false;
+
+ convert_legacy_u32_to_link_mode(&ksettings->link_modes.supported,
+ legacy_settings->supported);
+ convert_legacy_u32_to_link_mode(&ksettings->link_modes.advertising,
+ legacy_settings->advertising);
+ convert_legacy_u32_to_link_mode(&ksettings->link_modes.lp_advertising,
+ legacy_settings->lp_advertising);
+ ksettings->parent.speed = ethtool_cmd_speed(legacy_settings);
+ ksettings->parent.duplex = legacy_settings->duplex;
+ ksettings->parent.port = legacy_settings->port;
+ ksettings->parent.phy_address = legacy_settings->phy_address;
+ ksettings->parent.autoneg = legacy_settings->autoneg;
+ ksettings->parent.mdio_support = legacy_settings->mdio_support;
+ ksettings->parent.eth_tp_mdix = legacy_settings->eth_tp_mdix;
+ ksettings->parent.eth_tp_mdix_ctrl = legacy_settings->eth_tp_mdix_ctrl;
+ return retval;
+}
+
+/* return false if ksettings link modes had higher bits
+ * set. legacy_settings always updated (best effort)
+ * TODO: remove when %ETHTOOL_GSET/%ETHTOOL_SSET disappear
+ */
+static bool
+convert_ksettings_to_legacy_settings(struct ethtool_cmd *legacy_settings,
+ const struct ethtool_ksettings *ksettings)
+{
+ bool retval = true;
+
+ memset(legacy_settings, 0, sizeof(*legacy_settings));
+ /* this also clears the deprecated fields in legacy structure:
+ * __u8 transceiver;
+ * __u32 maxtxpkt;
+ * __u32 maxrxpkt;
+ */
+
+ retval &= convert_link_mode_to_legacy_u32(
+ &legacy_settings->supported,
+ &ksettings->link_modes.supported);
+ retval &= convert_link_mode_to_legacy_u32(
+ &legacy_settings->advertising,
+ &ksettings->link_modes.advertising);
+ retval &= convert_link_mode_to_legacy_u32(
+ &legacy_settings->lp_advertising,
+ &ksettings->link_modes.lp_advertising);
+ ethtool_cmd_speed_set(legacy_settings, ksettings->parent.speed);
+ legacy_settings->duplex = ksettings->parent.duplex;
+ legacy_settings->port = ksettings->parent.port;
+ legacy_settings->phy_address = ksettings->parent.phy_address;
+ legacy_settings->autoneg = ksettings->parent.autoneg;
+ legacy_settings->mdio_support = ksettings->parent.mdio_support;
+ legacy_settings->eth_tp_mdix = ksettings->parent.eth_tp_mdix;
+ legacy_settings->eth_tp_mdix_ctrl = ksettings->parent.eth_tp_mdix_ctrl;
+ return retval;
+}
+
+/* number of 32-bit words to store the user's link mode bitmaps */
+#define __ETHTOOL_LINK_MODE_MASK_NU32 \
+ ((__ETHTOOL_LINK_MODE_MASK_NBITS + 31) / 32)
+
+/* layout of the struct passed from/to userland */
+struct ethtool_usettings {
+ struct ethtool_settings parent;
+ struct {
+ __u32 supported[__ETHTOOL_LINK_MODE_MASK_NU32] __aligned(4);
+ __u32 advertising[__ETHTOOL_LINK_MODE_MASK_NU32] __aligned(4);
+ __u32 lp_advertising[
+ __ETHTOOL_LINK_MODE_MASK_NU32]__aligned(4);
+ } link_modes;
+};
+
+/* Internal kernel helper to query a device ethtool_settings.
+ *
+ * Backward compatibility note: for compatibility with legacy drivers
+ * that implement only the ethtool_cmd API, this has to work with both
+ * drivers implementing get_ksettings API and drivers implementing
+ * get_settings API. When drivers implement get_settings and report
+ * ethtool_cmd deprecated fields (transceiver/maxrxpkt/maxtxpkt),
+ * these fields are silently ignored because the resulting struct
+ * ethtool_settings does not report them.
+ */
+int __ethtool_get_ksettings(struct net_device *dev,
+ struct ethtool_ksettings *ksettings)
+{
+ int err;
+ struct ethtool_cmd cmd;
+
+ ASSERT_RTNL();
+
+ if (dev->ethtool_ops->get_ksettings) {
+ memset(ksettings, 0, sizeof(*ksettings));
+ return dev->ethtool_ops->get_ksettings(dev, ksettings);
+ }
+
+ /* TODO: remove what follows when ethtool_ops::get_settings
+ * disappears internally
+ */
+
+ /* driver doesn't support %ethtool_ksettings API. revert to
+ * legacy %ethtool_cmd API, unless it's not supported either.
+ * TODO: remove when ethtool_ops::get_settings disappears internally
+ */
+ err = __ethtool_get_settings(dev, &cmd);
+ if (err < 0)
+ return err;
+
+ /* we ignore deprecated fields transceiver/maxrxpkt/maxtxpkt
+ */
+ convert_legacy_settings_to_ksettings(ksettings, &cmd);
+ return err;
+}
+EXPORT_SYMBOL(__ethtool_get_ksettings);
+
+#if BITS_PER_LONG == 64
+static unsigned long _shl32(__u32 v)
+{
+ return ((unsigned long)v) << 32;
+}
+#endif
+
+/* convert a user's __u32[] bitmap in user space to a kernel internal
+ * bitmap. return 0 on success, errno on error. this assumes that
+ * link_mode_masks_nwords was already verified
+ */
+static int load_ksettings_from_user(struct ethtool_ksettings *to,
+ const void __user *from)
+{
+ struct ethtool_usettings usettings;
+#if BITS_PER_LONG != 32
+ unsigned i;
+#endif
+
+ if (copy_from_user(&usettings, from, sizeof(usettings)))
+ return -EFAULT;
+
+ /* make sure we didn't receive garbage between last allowed bit
+ * and end of last u32 word
+ */
+ if (__ETHTOOL_LINK_MODE_MASK_NBITS % 32) {
+ const u32 allowed = (
+ 1U << (__ETHTOOL_LINK_MODE_MASK_NBITS % 32)) - 1;
+ if (usettings.link_modes.supported[
+ __ETHTOOL_LINK_MODE_MASK_NU32-1] & ~allowed)
+ return -EINVAL;
+ if (usettings.link_modes.advertising[
+ __ETHTOOL_LINK_MODE_MASK_NU32-1] & ~allowed)
+ return -EINVAL;
+ if (usettings.link_modes.lp_advertising[
+ __ETHTOOL_LINK_MODE_MASK_NU32-1] & ~allowed)
+ return -EINVAL;
+ }
+
+#if BITS_PER_LONG == 32
+ compiletime_assert(sizeof(*to) == sizeof(usettings),
+ "sizeof(ulong) != 32");
+ memcpy(to, &usettings, sizeof(*to));
+#elif BITS_PER_LONG == 64
+ memset(to, 0, sizeof(*to));
+ memcpy(&to->parent, &usettings.parent, sizeof(to->parent));
+ for (i = 0 ; i < __ETHTOOL_LINK_MODE_MASK_NU32 ; ++i) {
+ if (0 == (i & 1)) {
+ to->link_modes.supported.mask[i>>1]
+ = usettings.link_modes.supported[i];
+ to->link_modes.advertising.mask[i>>1]
+ = usettings.link_modes.advertising[i];
+ to->link_modes.lp_advertising.mask[i>>1]
+ = usettings.link_modes.lp_advertising[i];
+ } else {
+ to->link_modes.supported.mask[i>>1] |= _shl32(
+ usettings.link_modes.supported[i]);
+ to->link_modes.advertising.mask[i>>1] |= _shl32(
+ usettings.link_modes.advertising[i]);
+ to->link_modes.lp_advertising.mask[i>>1] |= _shl32(
+ usettings.link_modes.lp_advertising[i]);
+ }
+ }
+#else
+# error "unsupported ulong width"
+#endif
+ return 0;
+}
+
+/* convert a kernel internal bitmap to a user space __u32[]
+ * bitmap. return 0 on success, errno on error.
+ */
+static int store_ksettings_for_user(void __user *to,
+ const struct ethtool_ksettings *from)
+{
+ struct ethtool_usettings usettings;
+#if BITS_PER_LONG != 32
+ unsigned i;
+#endif
+
+ compiletime_assert(__ETHTOOL_LINK_MODE_MASK_NU32 <= S8_MAX,
+ "need too many bits for link modes!");
+
+#if BITS_PER_LONG == 32
+ compiletime_assert(sizeof(*from) == sizeof(usettings),
+ "sizeof(ulong) != 32");
+ memcpy(&usettings, from, sizeof(usettings));
+#elif BITS_PER_LONG == 64
+ memset(&usettings, 0, sizeof(usettings));
+ memcpy(&usettings.parent, &from->parent, sizeof(usettings));
+ for (i = 0 ; i < __ETHTOOL_LINK_MODE_MASK_NU32 ; ++i) {
+ if (0 == (i & 1)) {
+ usettings.link_modes.supported[i] = lower_32_bits(
+ from->link_modes.supported.mask[i>>1]);
+ usettings.link_modes.advertising[i] = lower_32_bits(
+ from->link_modes.advertising.mask[i>>1]);
+ usettings.link_modes.lp_advertising[i] = lower_32_bits(
+ from->link_modes.lp_advertising.mask[i>>1]);
+ } else {
+ usettings.link_modes.supported[i] = upper_32_bits(
+ from->link_modes.supported.mask[i>>1]);
+ usettings.link_modes.advertising[i] = upper_32_bits(
+ from->link_modes.advertising.mask[i>>1]);
+ usettings.link_modes.lp_advertising[i] = upper_32_bits(
+ from->link_modes.lp_advertising.mask[i>>1]);
+ }
+ }
+#else
+# error "unsupported ulong width"
+#endif
+ if (copy_to_user(to, &usettings, sizeof(usettings)))
+ return -EFAULT;
+
+ return 0;
+}
+
+/* Query device for its ethtool_settings.
+ *
+ * Backward compatibility note: this function must fail when driver
+ * does not implement ethtool::get_ksettings, even if legacy
+ * ethtool_ops::get_settings is implemented. This tells new versions
+ * of ethtool that they should use the legacy API %ETHTOOL_GSET for
+ * this driver, so that they can correctly access the ethtool_cmd
+ * deprecated fields (transceiver/maxrxpkt/maxtxpkt), until no driver
+ * implements ethtool_ops::get_settings anymore.
+ */
+static int ethtool_get_ksettings(struct net_device *dev, void __user *useraddr)
+{
+ int err;
+ struct ethtool_ksettings ksettings;
+
+ if (!dev->ethtool_ops->get_ksettings)
+ return -EOPNOTSUPP;
+
+ /* handle bitmap nbits handshake */
+ if (copy_from_user(&ksettings.parent, useraddr,
+ sizeof(ksettings.parent)))
+ return -EFAULT;
+
+ if (__ETHTOOL_LINK_MODE_MASK_NU32
+ != ksettings.parent.link_mode_masks_nwords) {
+ /* wrong link mode nbits requested */
+ memset(&ksettings, 0, sizeof(ksettings));
+ /* keep cmd field reset to 0 */
+ /* send back number of words required as negative val */
+ ksettings.parent.link_mode_masks_nwords
+ = -((s8)__ETHTOOL_LINK_MODE_MASK_NU32);
+ err = 0;
+ } else {
+ memset(&ksettings, 0, sizeof(ksettings));
+ err = dev->ethtool_ops->get_ksettings(dev, &ksettings);
+ if (err < 0)
+ return err;
+
+ /* make sure we tell the right values to user */
+ ksettings.parent.cmd = ETHTOOL_GSETTINGS;
+ ksettings.parent.link_mode_masks_nwords
+ = __ETHTOOL_LINK_MODE_MASK_NU32;
+ }
+
+ return store_ksettings_for_user(useraddr, &ksettings);
+}
+
+/* Update device ethtool_settings.
+ *
+ * Backward compatibility note: this function must fail when driver
+ * does not implement ethtool::set_ksettings, even if legacy
+ * ethtool_ops::set_settings is implemented. This tells new versions
+ * of ethtool that they should use the legacy API %ETHTOOL_SSET for
+ * this driver, so that they can correctly update the ethtool_cmd
+ * deprecated fields (transceiver/maxrxpkt/maxtxpkt), until no driver
+ * implements ethtool_ops::get_settings anymore.
+ */
+static int ethtool_set_ksettings(struct net_device *dev, void __user *useraddr)
+{
+ int err;
+ struct ethtool_ksettings ksettings;
+
+ if (!dev->ethtool_ops->set_ksettings)
+ return -EOPNOTSUPP;
+
+ /* make sure nbits field has expected value */
+ if (copy_from_user(&ksettings.parent, useraddr,
+ sizeof(ksettings.parent)))
+ return -EFAULT;
+
+ if (__ETHTOOL_LINK_MODE_MASK_NU32
+ != ksettings.parent.link_mode_masks_nwords)
+ return -EINVAL;
+
+ /* copy the whole structure, now that we know it has expected
+ * format
+ */
+ err = load_ksettings_from_user(&ksettings, useraddr);
+ if (err)
+ return err;
+
+ /* re-check nwords field, just in case */
+ if (__ETHTOOL_LINK_MODE_MASK_NU32
+ != ksettings.parent.link_mode_masks_nwords)
+ return -EINVAL;
+
+ return dev->ethtool_ops->set_ksettings(dev, &ksettings);
+}
+
+/* Internal kernel helper to query a device ethtool_cmd settings.
+ *
+ * Note about transition to ethtool_settings API: We do not need (or
+ * want) this function to support "dev" instances that implement the
+ * ethtool_settings API as we will update the drivers calling this
+ * function to call __ethtool_get_ksettings instead, before the first
+ * drivers implement ethtool_ops::get_ksettings.
+ *
+ * TODO 1: at least make this function static when no driver is using it
+ * TODO 2: remove when ethtool_ops::get_settings disappears internally
+ */
int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
ASSERT_RTNL();
@@ -353,30 +735,118 @@ int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
}
EXPORT_SYMBOL(__ethtool_get_settings);
+/* Query device for its ethtool_cmd settings.
+ *
+ * Backward compatibility note: for compatibility with legacy ethtool,
+ * this has to work with both drivers implementing get_ksettings API
+ * and drivers implementing get_settings API. When drivers implement
+ * get_ksettings and report higher link mode bits, a kernel warning is
+ * logged once (with name of 1st driver/device) to recommend user to
+ * upgrade ethtool, but the command is successful (only the lower link
+ * mode bits reported back to user).
+ *
+ * TODO: remove when %ETHTOOL_GSET/%ETHTOOL_SSET disappear
+ */
static int ethtool_get_settings(struct net_device *dev, void __user *useraddr)
{
int err;
struct ethtool_cmd cmd;
- err = __ethtool_get_settings(dev, &cmd);
- if (err < 0)
- return err;
+ ASSERT_RTNL();
+
+ if (dev->ethtool_ops->get_ksettings) {
+ /* First, use ksettings API if it is supported */
+ struct ethtool_ksettings ksettings;
+
+ memset(&ksettings, 0, sizeof(ksettings));
+ err = dev->ethtool_ops->get_ksettings(dev, &ksettings);
+ if (err < 0)
+ return err;
+ if (!convert_ksettings_to_legacy_settings(&cmd, &ksettings)) {
+ static int __warned;
+
+ /* not all bitmaps could be translated
+ * acurately to legacy API: print warning with
+ * netdev name, but does still succeed
+ */
+ if (!__warned)
+ netdev_warn(dev, "please upgrade ethtool\n");
+ __warned = 1;
+ }
+ /* send a sensible cmd tag back to user */
+ cmd.cmd = ETHTOOL_GSET;
+ } else {
+ /* TODO: return -EOPNOTSUPP when
+ * ethtool_ops::get_settings disappears internally
+ */
+
+ /* driver doesn't support %ethtool_ksettings
+ * API. revert to legacy %ethtool_cmd API, unless it's
+ * not supported either.
+ */
+ err = __ethtool_get_settings(dev, &cmd);
+ if (err < 0)
+ return err;
+ }
if (copy_to_user(useraddr, &cmd, sizeof(cmd)))
return -EFAULT;
+
return err;
}
+/* Update device settings with given ethtool_cmd.
+ *
+ * Backward compatibility note: for compatibility with legacy ethtool,
+ * this has to work with both drivers implementing set_ksettings API
+ * and drivers implementing set_settings API. When drivers implement
+ * set_ksettings and user's request updates deprecated ethtool_cmd
+ * fields (transceiver/maxrxpkt/maxtxpkt), a kernel warning is logged
+ * once (with name of 1st driver/device) to recommend user to upgrade
+ * ethtool, and the request is rejected.
+ *
+ * TODO: remove when %ETHTOOL_GSET/%ETHTOOL_SSET disappear
+ */
static int ethtool_set_settings(struct net_device *dev, void __user *useraddr)
{
struct ethtool_cmd cmd;
- if (!dev->ethtool_ops->set_settings)
- return -EOPNOTSUPP;
+ ASSERT_RTNL();
if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
return -EFAULT;
+ /* first, try new %ethtool_ksettings API. */
+ if (dev->ethtool_ops->set_ksettings) {
+ struct ethtool_ksettings ksettings;
+
+ if (!convert_legacy_settings_to_ksettings(&ksettings, &cmd)) {
+ static int __warned;
+
+ /* rejecting setting deprecated fields
+ * transceiver/maxtxpkt/maxrxpkt
+ */
+ if (!__warned)
+ netdev_warn(dev, "please upgrade ethtool");
+ __warned = 1;
+ return -EINVAL;
+ }
+
+ ksettings.parent.cmd = ETHTOOL_SSETTINGS;
+ ksettings.parent.link_mode_masks_nwords
+ = __ETHTOOL_LINK_MODE_MASK_NU32;
+ return dev->ethtool_ops->set_ksettings(dev, &ksettings);
+ }
+
+ /* legacy %ethtool_cmd API */
+
+ /* TODO: return -EOPNOTSUPP when ethtool_ops::get_settings
+ * disappears internally
+ */
+
+ if (!dev->ethtool_ops->set_settings)
+ return -EOPNOTSUPP;
+
return dev->ethtool_ops->set_settings(dev, &cmd);
}
@@ -1979,6 +2449,12 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
case ETHTOOL_STUNABLE:
rc = ethtool_set_tunable(dev, useraddr);
break;
+ case ETHTOOL_GSETTINGS:
+ rc = ethtool_get_ksettings(dev, useraddr);
+ break;
+ case ETHTOOL_SSETTINGS:
+ rc = ethtool_set_ksettings(dev, useraddr);
+ break;
default:
rc = -EOPNOTSUPP;
}
--
2.2.0.rc0.207.ga3a616c
^ permalink raw reply related
* [PATCH net-next v1 03/18] net: usnic: use __ethtool_get_settings
From: David Decotigny @ 2015-01-27 1:35 UTC (permalink / raw)
To: David S. Miller, Ben Hutchings, Amir Vadai, linux-kernel, netdev,
linux-api
Cc: Eric Dumazet, Eugenia Emantayev, Or Gerlitz, Ido Shamay,
Joe Perches, Saeed Mahameed, Govindarajulu Varadarajan,
Venkata Duvvuru, Jeff Kirsher, Eyal Perry, Pravin B Shelar,
Ed Swierk, David Decotigny
In-Reply-To: <1422322574-6188-1-git-send-email-ddecotig@gmail.com>
From: David Decotigny <decot@googlers.com>
Signed-off-by: David Decotigny <decot@googlers.com>
---
drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index 61337c7c..d71ba62 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -310,7 +310,7 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,
usnic_dbg("\n");
mutex_lock(&us_ibdev->usdev_lock);
- us_ibdev->netdev->ethtool_ops->get_settings(us_ibdev->netdev, &cmd);
+ __ethtool_get_settings(us_ibdev->netdev, &cmd);
memset(props, 0, sizeof(*props));
props->lid = 0;
--
2.2.0.rc0.207.ga3a616c
^ permalink raw reply related
* [PATCH net-next v1 00/18] RFC: new ETHTOOL_GSETTINGS/SSETTINGS API
From: David Decotigny @ 2015-01-27 1:35 UTC (permalink / raw)
To: David S. Miller, Ben Hutchings, Amir Vadai,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA
Cc: Eric Dumazet, Eugenia Emantayev, Or Gerlitz, Ido Shamay,
Joe Perches, Saeed Mahameed, Govindarajulu Varadarajan,
Venkata Duvvuru, Jeff Kirsher, Eyal Perry, Pravin B Shelar,
Ed Swierk, David Decotigny
From: David Decotigny <decot-Ypc/8FJVVoBWk0Htik3J/w@public.gmane.org>
The main goal of this series is to support ethtool link mode masks
larger than 32 bits. It implements a new ioctl pair
(ETHTOOL_GSETTINGS/SSETTINGS), its associated callbacks
(get/set_settings) and a new struct ethtool_settings, which should
eventually replace legacy ethtool_cmd. Internally, the kernel uses
fixed length link mode masks defined at compilation time in ethtool.h
(for now: 31 bits), that can be increased by changing
__ETHTOOL_LINK_MODE_LAST in ethtool.h (absolute max is 4064 bits,
checked at compile time), and the user/kernel interface allows this
length to be arbitrary within 1..4064. This should allow some
flexibility without using too much malloc/stack space, at the cost of
a small kernel/user handshake for the user to determine the sizes of
those bitmaps.
Along the way, I chose to drop in the new structure the 3 ethtool_cmd
fields marked "deprecated" (transceiver/maxrxpkt/maxtxpkt). They are
still available for old drivers via the old ETHTOOL_GSET/SSET API, but
are not available to drivers that switch to new API. Of those 3
fields, ethtool_cmd::transceiver seems to be still actively used by
several drivers, maybe we should not consider this field deprecated?
The 2 other fields are basically not used. This transition requires
some care in the way old and new ethtool talk to the kernel.
More technical details provided in the description for main patch. In
particular details about backward compatibility properties.
Some questions to more experts than me:
- the kernel/interface multiplexes the "tell me the bitmap length"
handshake and the "give me the settings" inside the new
ETHTOOL_GSETTINGS cmd. I was thinking of making this into 2
separate cmds: 1 cmd ETHTOOL_GKERNELPROPERTIES which would be
kernel-wide rather than device-specific, would return properties
like "length of the link mode bitmaps", and possibly others. And
ETHTOOL_GSETTINGS would expect the proper bitmaps
- the link mode bitmaps are piggybacked at tail of the new struct
ethtool_settings. Since its user-visible definition does not assume
specific bitmap width, I am using a 0-length array as the publicly
visible placeholder. But then, the kernel needs to specialize it
(struct ethtool_ksettings) to specify its current link mode
masks. This means that kernel code is "littered" with
"ksettings->parent.field" to access "field" inside
ethtool_settings:
+ I don't like the field name "parent", any suggestion welcome
+ and/or: I could use ethtool_settings everywhere (instead of a new
ethtool_ksettings) and an accessor to retrieve the link mode
masks?
+ or: we could decide to make the link mode masks statically
bounded again, ie. make their width public, but larger than
current 32, and unchangeable forever. This would make everything
straightforward, but we might hit limits later, or have an
unneeded memory/stack usage for unused bits.
any preference?
- crossing user/kernel boundary requires conversion of the kernel
bitmaps (unsigned long[]) to something more strict (in my case:
u32) to accomodate for 32/64 compat. Maybe I should add a
copy_bitmap_from_user/copy_bitmap_to_user API inside bitmap.h
instead of defining my own in ethtool.c?
- I am using a typedef struct (ethtool_link_mode_mask_t) to build and
hold the new masks. Makes it handy to use in the drivers (see mlx4
for an example). Not very nice.
- I foresee bugs where people use the legacy/deprecated SUPPORTED_x
macros instead of the new ETHTOOL_LINK_MODE_x_BIT enums in the new
get/set__ksettings callbacks. Not sure how to prevent problems with
this.
The only driver which was converted for now is mlx4. I am not
considering fcoe as fully converted, but I updated it a minima to be
able to remove __ethtool_get_settings, now known as
__ethtool_get_ksettings.
Tested with legacy and "future" ethtool on 64b x86 kernel and 32+64b
ethtool, and on a 32b x86 kernel + 32b ethtool.
############################################
# Patch Set Summary:
David Decotigny (18):
net: ethtool: propagate get_settings error
net: usnic: remove unused call to ethtool_ops::get_settings
net: usnic: use __ethtool_get_settings
net: ethtool: add new ETHTOOL_GSETTINGS/SSETTINGS API
net: tx4939: use __ethtool_get_ksettings
net: usnic: use __ethtool_get_ksettings
net: bonding: use __ethtool_get_ksettings
net: ipvlan: use __ethtool_get_ksettings
net: macvlan: use __ethtool_get_ksettings
net: team: use __ethtool_get_ksettings
net: fcoe: use __ethtool_get_ksettings
net: rdma: use __ethtool_get_ksettings
net: 8021q: use __ethtool_get_ksettings
net: bridge: use __ethtool_get_ksettings
net: core: use __ethtool_get_ksettings
net: ethtool: remove unused __ethtool_get_settings
net: mlx4: identify predicate for debug messages
net: mlx4: use new ETHTOOL_G/SSETTINGS API
arch/mips/txx9/generic/setup_tx4939.c | 7 +-
drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 10 +-
drivers/net/bonding/bond_main.c | 14 +-
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 326 ++++++++--------
drivers/net/ethernet/mellanox/mlx4/en_main.c | 1 +
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 5 +-
drivers/net/ipvlan/ipvlan_main.c | 8 +-
drivers/net/macvlan.c | 8 +-
drivers/net/team/team.c | 8 +-
drivers/scsi/fcoe/fcoe_transport.c | 36 +-
include/linux/ethtool.h | 96 ++++-
include/rdma/ib_addr.h | 14 +-
include/uapi/linux/ethtool.h | 319 ++++++++++++----
net/8021q/vlan_dev.c | 8 +-
net/bridge/br_if.c | 6 +-
net/core/ethtool.c | 476 +++++++++++++++++++++++-
net/core/net-sysfs.c | 15 +-
net/packet/af_packet.c | 11 +-
18 files changed, 1043 insertions(+), 325 deletions(-)
--
2.2.0.rc0.207.ga3a616c
^ permalink raw reply
* Re: pull-request: mac80211 2015-01-23
From: David Miller @ 2015-01-27 1:33 UTC (permalink / raw)
To: johannes-cdvu00un1VgdHxzADdlk8Q
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1422027188.2728.37.camel-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
From: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
Date: Fri, 23 Jan 2015 16:33:08 +0100
> I have a few more fixes that seemed relevant for the current cycle and
> low enough impact to merge at this point.
>
> However, I can live with all of this going to -next as well since most
> are difficult to hit in practice.
Pulled, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH net v3] ipv4: try to cache dst_entries which would cause a redirect
From: David Miller @ 2015-01-27 1:29 UTC (permalink / raw)
To: hannes; +Cc: netdev, ja, mleitner, fw
In-Reply-To: <996db187263dc0419ea3ab4d6e3fad4c0e0e5b44.1422010254.git.hannes@stressinduktion.org>
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Fri, 23 Jan 2015 12:01:26 +0100
> Not caching dst_entries which cause redirects could be exploited by hosts
> on the same subnet, causing a severe DoS attack. This effect aggravated
> since commit f88649721268999 ("ipv4: fix dst race in sk_dst_get()").
>
> Lookups causing redirects will be allocated with DST_NOCACHE set which
> will force dst_release to free them via RCU. Unfortunately waiting for
> RCU grace period just takes too long, we can end up with >1M dst_entries
> waiting to be released and the system will run OOM. rcuos threads cannot
> catch up under high softirq load.
>
> Attaching the flag to emit a redirect later on to the specific skb allows
> us to cache those dst_entries thus reducing the pressure on allocation
> and deallocation.
>
> This issue was discovered by Marcelo Leitner.
>
> Cc: Julian Anastasov <ja@ssi.bg>
> Signed-off-by: Marcelo Leitner <mleitner@redhat.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Applied and queued up for -stable, thanks.
^ permalink raw reply
* Re: [PATCH] net: macb: Remove CONFIG_PM ifdef because of compilation warning
From: David Miller @ 2015-01-27 1:26 UTC (permalink / raw)
To: michal.simek; +Cc: linux-kernel, monstr, nicolas.ferre, netdev
In-Reply-To: <7970145ad4d864eaf31d694d22f2fecbcf6825c9.1422002161.git.michal.simek@xilinx.com>
From: Michal Simek <michal.simek@xilinx.com>
Date: Fri, 23 Jan 2015 09:36:03 +0100
> Fix compilation warning:
> drivers/net/ethernet/cadence/macb.c:2415:12: warning: 'macb_suspend'
> defined but not used [-Wunused-function]
> static int macb_suspend(struct device *dev)
> drivers/net/ethernet/cadence/macb.c:2432:12: warning: 'macb_resume'
> defined but not used [-Wunused-function]
> static int macb_resume(struct device *dev)
>
> when CONFIG_PM=y, CONFIG_PM_SLEEP=n are used.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Applied.
^ permalink raw reply
* Re: [PATCH net 0/2] bpf: fix two bugs
From: David Miller @ 2015-01-27 1:21 UTC (permalink / raw)
To: ast; +Cc: holzheu, schwidefsky, netdev, linux-kernel
In-Reply-To: <1421975469-13035-1-git-send-email-ast@plumgrid.com>
From: Alexei Starovoitov <ast@plumgrid.com>
Date: Thu, 22 Jan 2015 17:11:07 -0800
> Michael Holzheu caught two issues (in bpf syscall and in the test).
> Fix them. Details in corresponding patches.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH] net: macb: allow deffered probe of the driver
From: David Miller @ 2015-01-27 1:10 UTC (permalink / raw)
To: nicolae.rosia; +Cc: netdev, nicolas.ferre
In-Reply-To: <1421947441.717.4.camel@uti.ro>
From: Nicolae Rosia <nicolae.rosia@certsign.ro>
Date: Thu, 22 Jan 2015 17:31:05 +0000
> The driver is trying to acquire clocks which maybe
> are not available yet. Allow the driver to request
> deffered probe by providing a probe function and
> registering it with module_platform_driver. [1]
> This patch is based on 3.19-rc5.
>
> [1] https://lkml.org/lkml/2013/9/23/118
>
> Signed-off-by: Nicolae Rosia <nicolae.rosia@certsign.ro>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] net: phy: Invalidate LP advertising flags when restarting or disabling AN
From: Florian Fainelli @ 2015-01-27 1:06 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev, linux-kernel
In-Reply-To: <1422320295.3524.26.camel@xylophone.i.decadent.org.uk>
On 26/01/15 16:58, Ben Hutchings wrote:
> It is possible to see the old value of the LP advertising flags
> through ethtool after reconfiguring the PHY and before autonegotiation
> completes. If autonegotiation is turned off then the last value seen
> will persist indefinitely.
Good catch!
>
> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> drivers/net/phy/phy.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 767cd11..cdcac6a 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -439,6 +439,9 @@ int phy_start_aneg(struct phy_device *phydev)
> if (AUTONEG_DISABLE == phydev->autoneg)
> phy_sanitize_settings(phydev);
>
> + /* Invalidate LP advertising flags */
> + phydev->lp_advertising = 0;
> +
> err = phydev->drv->config_aneg(phydev);
> if (err < 0)
> goto out_unlock;
>
--
Florian
^ permalink raw reply
* Re: [PATCH net] net: sctp: fix slab corruption from use after free on INIT collisions
From: David Miller @ 2015-01-27 1:05 UTC (permalink / raw)
To: dborkman; +Cc: vyasevich, netdev, linux-sctp
In-Reply-To: <1421947614-31407-1-git-send-email-dborkman@redhat.com>
From: Daniel Borkmann <dborkman@redhat.com>
Date: Thu, 22 Jan 2015 18:26:54 +0100
> When hitting an INIT collision case during the 4WHS with AUTH enabled, as
> already described in detail in commit 1be9a950c646 ("net: sctp: inherit
> auth_capable on INIT collisions"), it can happen that we occasionally
> still remotely trigger the following panic on server side which seems to
> have been uncovered after the fix from commit 1be9a950c646 ...
...
> Fixes: 730fc3d05cd4 ("[SCTP]: Implete SCTP-AUTH parameter processing")
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply
* Re: [PATCH net-next 2/2] flow_dissector: add tipc support
From: David Miller @ 2015-01-27 1:04 UTC (permalink / raw)
To: erik.hugne; +Cc: richard.alpe, netdev, jon.maloy, ying.xue, tipc-discussion
In-Reply-To: <1421943032-29924-2-git-send-email-erik.hugne@ericsson.com>
From: <erik.hugne@ericsson.com>
Date: Thu, 22 Jan 2015 17:10:32 +0100
> From: Erik Hugne <erik.hugne@ericsson.com>
>
> The flows are hashed on the sending node address, which allows us
> to spread out the TIPC link processing to RPS enabled cores. There
> is no point to include the destination address in the hash as that
> will always be the same for all inbound links. We have experimented
> with a 3-tuple hash over [srcnode, sport, dport], but this showed to
> give slightly lower performance because of increased lock contention
> when the same link was handled by multiple cores.
>
> Signed-off-by: Ying Xue <ying.xue@windriver.com>
> Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 1/2] tipc: fix excessive network event logging
From: David Miller @ 2015-01-27 1:04 UTC (permalink / raw)
To: erik.hugne; +Cc: richard.alpe, netdev, jon.maloy, ying.xue, tipc-discussion
In-Reply-To: <1421943032-29924-1-git-send-email-erik.hugne@ericsson.com>
From: <erik.hugne@ericsson.com>
Date: Thu, 22 Jan 2015 17:10:31 +0100
> From: Erik Hugne <erik.hugne@ericsson.com>
>
> If a large number of namespaces is spawned on a node and TIPC is
> enabled in each of these, the excessive printk tracing of network
> events will cause the system to grind down to a near halt.
> The traces are still of debug value, so instead of removing them
> completely we fix it by changing the link state and node availability
> logging debug traces.
>
> Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Applied.
^ permalink raw reply
* [PATCH net-next] net: phy: Invalidate LP advertising flags when restarting or disabling AN
From: Ben Hutchings @ 2015-01-27 0:58 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, linux-kernel
It is possible to see the old value of the LP advertising flags
through ethtool after reconfiguring the PHY and before autonegotiation
completes. If autonegotiation is turned off then the last value seen
will persist indefinitely.
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
drivers/net/phy/phy.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 767cd11..cdcac6a 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -439,6 +439,9 @@ int phy_start_aneg(struct phy_device *phydev)
if (AUTONEG_DISABLE == phydev->autoneg)
phy_sanitize_settings(phydev);
+ /* Invalidate LP advertising flags */
+ phydev->lp_advertising = 0;
+
err = phydev->drv->config_aneg(phydev);
if (err < 0)
goto out_unlock;
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH net-next 2/2] flow_dissector: add tipc support
From: David Miller @ 2015-01-27 0:57 UTC (permalink / raw)
To: eric.dumazet
Cc: erik.hugne, richard.alpe, netdev, jon.maloy, ying.xue,
tipc-discussion
In-Reply-To: <1421947751.3471.12.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 22 Jan 2015 09:29:11 -0800
> On Thu, 2015-01-22 at 17:10 +0100, erik.hugne@ericsson.com wrote:
>> From: Erik Hugne <erik.hugne@ericsson.com>
>>
>> The flows are hashed on the sending node address, which allows us
>> to spread out the TIPC link processing to RPS enabled cores. There
>> is no point to include the destination address in the hash as that
>> will always be the same for all inbound links. We have experimented
>> with a 3-tuple hash over [srcnode, sport, dport], but this showed to
>> give slightly lower performance because of increased lock contention
>> when the same link was handled by multiple cores.
>>
>> Signed-off-by: Ying Xue <ying.xue@windriver.com>
>> Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
>> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
>> ---
>> net/core/flow_dissector.c | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>>
>> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
>> index 4508493..beb83d1 100644
>> --- a/net/core/flow_dissector.c
>> +++ b/net/core/flow_dissector.c
>> @@ -178,6 +178,20 @@ ipv6:
>> return false;
>> }
>> }
>> + case htons(ETH_P_TIPC): {
>> + struct {
>> + __be32 pre[3];
>> + __be32 srcnode;
>> + } *hdr, _hdr;
>
> Is this header defined somewhere in an include file ?
>
> This looks a bit ugly to locally define the format...
I'd like this situation improved but I plan to apply this as-is for
now.
^ permalink raw reply
* Re: [Linux-kernel] [PATCH kernel 0/4] Fixes for sh_eth #3
From: Ben Hutchings @ 2015-01-27 0:51 UTC (permalink / raw)
To: David S.Miller
Cc: linux-kernel, Yoshihiro Kaneko, Mitsuhiro Kimura, netdev,
Hisashi Nakamura, Nobuhiro Iwamatsu
In-Reply-To: <1422319232.3524.14.camel@xylophone.i.decadent.org.uk>
On Tue, 2015-01-27 at 00:40 +0000, Ben Hutchings wrote:
> I'm continuing review and testing of Ethernet support on the R-Car H2
> chip. This series fixes the last of the more serious issues I've found.
>
> These are not tested on any of the other supported chips.
Excuse me, that subject prefix should be 'PATCH net'.
Ben.
^ permalink raw reply
* [PATCH kernel 4/4] sh_eth: Fix DMA-API usage for RX buffers
From: Ben Hutchings @ 2015-01-27 0:50 UTC (permalink / raw)
To: David S.Miller
Cc: netdev, linux-kernel, Nobuhiro Iwamatsu, Mitsuhiro Kimura,
Hisashi Nakamura, Yoshihiro Kaneko
In-Reply-To: <1422319232.3524.14.camel@xylophone.i.decadent.org.uk>
- Use the return value of dma_map_single(), rather than calling
virt_to_page() separately
- Check for mapping failue
- Call dma_unmap_single() rather than dma_sync_single_for_cpu()
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
drivers/net/ethernet/renesas/sh_eth.c | 34 ++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 48610ed..4da8bd2 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1123,6 +1123,7 @@ static void sh_eth_ring_format(struct net_device *ndev)
int rx_ringsize = sizeof(*rxdesc) * mdp->num_rx_ring;
int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring;
int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1;
+ dma_addr_t dma_addr;
mdp->cur_rx = 0;
mdp->cur_tx = 0;
@@ -1136,7 +1137,6 @@ static void sh_eth_ring_format(struct net_device *ndev)
/* skb */
mdp->rx_skbuff[i] = NULL;
skb = netdev_alloc_skb(ndev, skbuff_size);
- mdp->rx_skbuff[i] = skb;
if (skb == NULL)
break;
sh_eth_set_receive_align(skb);
@@ -1145,9 +1145,15 @@ static void sh_eth_ring_format(struct net_device *ndev)
rxdesc = &mdp->rx_ring[i];
/* The size of the buffer is a multiple of 16 bytes. */
rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16);
- dma_map_single(&ndev->dev, skb->data, rxdesc->buffer_length,
- DMA_FROM_DEVICE);
- rxdesc->addr = virt_to_phys(skb->data);
+ dma_addr = dma_map_single(&ndev->dev, skb->data,
+ rxdesc->buffer_length,
+ DMA_FROM_DEVICE);
+ if (dma_mapping_error(&ndev->dev, dma_addr)) {
+ kfree_skb(skb);
+ break;
+ }
+ mdp->rx_skbuff[i] = skb;
+ rxdesc->addr = dma_addr;
rxdesc->status = cpu_to_edmac(mdp, RD_RACT | RD_RFP);
/* Rx descriptor address set */
@@ -1432,6 +1438,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
u16 pkt_len = 0;
u32 desc_status;
int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1;
+ dma_addr_t dma_addr;
boguscnt = min(boguscnt, *quota);
limit = boguscnt;
@@ -1479,9 +1486,9 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
mdp->rx_skbuff[entry] = NULL;
if (mdp->cd->rpadir)
skb_reserve(skb, NET_IP_ALIGN);
- dma_sync_single_for_cpu(&ndev->dev, rxdesc->addr,
- ALIGN(mdp->rx_buf_sz, 16),
- DMA_FROM_DEVICE);
+ dma_unmap_single(&ndev->dev, rxdesc->addr,
+ ALIGN(mdp->rx_buf_sz, 16),
+ DMA_FROM_DEVICE);
skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, ndev);
netif_receive_skb(skb);
@@ -1501,15 +1508,20 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
if (mdp->rx_skbuff[entry] == NULL) {
skb = netdev_alloc_skb(ndev, skbuff_size);
- mdp->rx_skbuff[entry] = skb;
if (skb == NULL)
break; /* Better luck next round. */
sh_eth_set_receive_align(skb);
- dma_map_single(&ndev->dev, skb->data,
- rxdesc->buffer_length, DMA_FROM_DEVICE);
+ dma_addr = dma_map_single(&ndev->dev, skb->data,
+ rxdesc->buffer_length,
+ DMA_FROM_DEVICE);
+ if (dma_mapping_error(&ndev->dev, dma_addr)) {
+ kfree_skb(skb);
+ break;
+ }
+ mdp->rx_skbuff[entry] = skb;
skb_checksum_none_assert(skb);
- rxdesc->addr = virt_to_phys(skb->data);
+ rxdesc->addr = dma_addr;
}
if (entry >= mdp->num_rx_ring - 1)
rxdesc->status |=
--
1.7.10.4
^ permalink raw reply related
* [PATCH kernel 3/4] sh_eth: Check for DMA mapping errors on transmit
From: Ben Hutchings @ 2015-01-27 0:49 UTC (permalink / raw)
To: David S.Miller
Cc: netdev, linux-kernel, Nobuhiro Iwamatsu, Mitsuhiro Kimura,
Hisashi Nakamura, Yoshihiro Kaneko
In-Reply-To: <1422319232.3524.14.camel@xylophone.i.decadent.org.uk>
dma_map_single() may fail if an IOMMU or swiotlb is in use, so
we need to check for this.
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
drivers/net/ethernet/renesas/sh_eth.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index e43c9ce..48610ed 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2174,6 +2174,10 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
skb->len + 2);
txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len,
DMA_TO_DEVICE);
+ if (dma_mapping_error(&ndev->dev, txdesc->addr)) {
+ kfree_skb(skb);
+ return NETDEV_TX_OK;
+ }
txdesc->buffer_length = skb->len;
if (entry >= mdp->num_tx_ring - 1)
--
1.7.10.4
^ permalink raw reply related
* [PATCH kernel 2/4] sh_eth: Ensure DMA engines are stopped before freeing buffers
From: Ben Hutchings @ 2015-01-27 0:49 UTC (permalink / raw)
To: David S.Miller
Cc: netdev, linux-kernel, Nobuhiro Iwamatsu, Mitsuhiro Kimura,
Hisashi Nakamura, Yoshihiro Kaneko
In-Reply-To: <1422319232.3524.14.camel@xylophone.i.decadent.org.uk>
Currently we try to clear EDRRR and EDTRR and immediately continue to
free buffers. This is unsafe because:
- In general, register writes are not serialised with DMA, so we still
have to wait for DMA to complete somehow
- The R8A7790 (R-Car H2) manual states that the TX running flag cannot
be cleared by writing to EDTRR
- The same manual states that clearing the RX running flag only stops
RX DMA at the next packet boundary
I applied this patch to the driver to detect DMA writes to freed
buffers:
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -1098,7 +1098,14 @@ static void sh_eth_ring_free(struct net_device *ndev)
> /* Free Rx skb ringbuffer */
> if (mdp->rx_skbuff) {
> for (i = 0; i < mdp->num_rx_ring; i++)
> + memcpy(mdp->rx_skbuff[i]->data,
> + "Hello, world", 12);
> + msleep(100);
> + for (i = 0; i < mdp->num_rx_ring; i++) {
> + WARN_ON(memcmp(mdp->rx_skbuff[i]->data,
> + "Hello, world", 12));
> dev_kfree_skb(mdp->rx_skbuff[i]);
> + }
> }
> kfree(mdp->rx_skbuff);
> mdp->rx_skbuff = NULL;
then ran the loop:
while ethtool -G eth0 rx 128 ; ethtool -G eth0 rx 64; do echo -n .; done
and 'ping -f' toward the sh_eth port from another machine. The
warning fired several times a minute.
To fix these issues:
- Deactivate all TX descriptors rather than writing to EDTRR
- As there seems to be no way of telling when RX DMA is stopped,
perform a soft reset to ensure that both DMA enginess are stopped
- To reduce the possibility of the reset truncating a transmitted
frame, disable egress and wait a reasonable time to reach a
packet boundary before resetting
- Update statistics before resetting
(The 'reasonable time' does not allow for CS/CD in half-duplex
mode, but half-duplex no longer seems reasonable!)
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
I would prefer to find a way to wait for the DMA engines to stop, so
that it's only necessary to reset if they fail to do so within some time
limit. But I just don't see it.
Ben.
drivers/net/ethernet/renesas/sh_eth.c | 39 +++++++++++++++++++++++++++------
1 file changed, 32 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 3b49375..e43c9ce 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -396,6 +396,9 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = {
[TSU_ADRL31] = 0x01fc,
};
+static void sh_eth_rcv_snd_disable(struct net_device *ndev);
+static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev);
+
static bool sh_eth_is_gether(struct sh_eth_private *mdp)
{
return mdp->reg_offset == sh_eth_offset_gigabit;
@@ -1358,6 +1361,33 @@ static int sh_eth_dev_init(struct net_device *ndev, bool start)
return ret;
}
+static void sh_eth_dev_exit(struct net_device *ndev)
+{
+ struct sh_eth_private *mdp = netdev_priv(ndev);
+ int i;
+
+ /* Deactivate all TX descriptors, so DMA should stop at next
+ * packet boundary if it's currently running
+ */
+ for (i = 0; i < mdp->num_tx_ring; i++)
+ mdp->tx_ring[i].status &= ~cpu_to_edmac(mdp, TD_TACT);
+
+ /* Disable TX FIFO egress to MAC */
+ sh_eth_rcv_snd_disable(ndev);
+
+ /* Stop RX DMA at next packet boundary */
+ sh_eth_write(ndev, 0, EDRRR);
+
+ /* Aside from TX DMA, we can't tell when the hardware is
+ * really stopped, so we need to reset to make sure.
+ * Before doing that, wait for long enough to *probably*
+ * finish transmitting the last packet and poll stats.
+ */
+ msleep(2); /* max frame time at 10 Mbps < 1250 us */
+ sh_eth_get_stats(ndev);
+ sh_eth_reset(ndev);
+}
+
/* free Tx skb function */
static int sh_eth_txfree(struct net_device *ndev)
{
@@ -1986,9 +2016,7 @@ static int sh_eth_set_ringparam(struct net_device *ndev,
napi_synchronize(&mdp->napi);
sh_eth_write(ndev, 0x0000, EESIPR);
- /* Stop the chip's Tx and Rx processes. */
- sh_eth_write(ndev, 0, EDTRR);
- sh_eth_write(ndev, 0, EDRRR);
+ sh_eth_dev_exit(ndev);
/* Free all the skbuffs in the Rx queue. */
sh_eth_ring_free(ndev);
@@ -2207,11 +2235,8 @@ static int sh_eth_close(struct net_device *ndev)
napi_disable(&mdp->napi);
sh_eth_write(ndev, 0x0000, EESIPR);
- /* Stop the chip's Tx and Rx processes. */
- sh_eth_write(ndev, 0, EDTRR);
- sh_eth_write(ndev, 0, EDRRR);
+ sh_eth_dev_exit(ndev);
- sh_eth_get_stats(ndev);
/* PHY Disconnect */
if (mdp->phydev) {
phy_stop(mdp->phydev);
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH net-next v2 0/5] bonding: various 802.3ad fixes
From: Andy Gospodarek @ 2015-01-27 0:49 UTC (permalink / raw)
To: Jonathan Toppins; +Cc: Jay Vosburgh, Veaceslav Falico, netdev
In-Reply-To: <1422253021-3798-1-git-send-email-jtoppins@cumulusnetworks.com>
On Mon, Jan 26, 2015 at 01:16:56AM -0500, Jonathan Toppins wrote:
> This patch series is a forward porting of patches we (Cumulus) are shipping
> in our 3.2 series kernels. These fixes attempt to make 802.3ad bonding mode
> more predictable in certian state machine transtions in addition to fixing
> 802.3ad bond carrier determination when bonding min_links option is changed.
> Specific notes are contained within each patch.
>
> For this patch series there are no userspace facing changes, a diff between
> the modinfo output showed no difference. However, there are behavioral
> facing changes, primarily in the bond carrier state. Please make sure to
> review carefully.
>
> v2:
> * fixed some style issues
> * dropped a portion of patch 1 in favor of more testing on my side
>
> Jonathan Toppins (2):
> bonding: update bond carrier state when min_links option changes
> bonding: cleanup and remove dead code
>
> Satish Ashok (1):
> bonding: fix LACP PDU not sent on slave port sometimes
>
> Wilson Kok (2):
> bonding: fix bond_open() don't always set slave active flag
> bonding: fix incorrect lacp mux state when agg not active
>
> drivers/net/bonding/bond_3ad.c | 55 +++++++++++++++++++++++++++---------
> drivers/net/bonding/bond_main.c | 6 ++--
> drivers/net/bonding/bond_options.c | 1 +
> include/net/bond_3ad.h | 1 -
> include/net/bonding.h | 1 +
> 5 files changed, 47 insertions(+), 17 deletions(-)
Great work on this, Jon.
For the series:
Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
^ permalink raw reply
* Re: [PATCH net-next v2 5/5] bonding: cleanup and remove dead code
From: Jay Vosburgh @ 2015-01-27 0:46 UTC (permalink / raw)
To: Jonathan Toppins; +Cc: Veaceslav Falico, Andy Gospodarek, netdev
In-Reply-To: <1422253021-3798-6-git-send-email-jtoppins@cumulusnetworks.com>
Jonathan Toppins <jtoppins@cumulusnetworks.com> wrote:
>fix sparse warning about non-static function
>
>drivers/net/bonding/bond_main.c:3737:5: warning: symbol
>'bond_3ad_xor_xmit' was not declared. Should it be static?
>
>Reviewed-by: Nikolay Aleksandrov <nikolay@redhat.com>
>Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
>---
> drivers/net/bonding/bond_main.c | 2 +-
> include/net/bond_3ad.h | 1 -
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index c475d90..67437f3 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -3734,7 +3734,7 @@ out:
> * usable slave array is formed in the control path. The xmit function
> * just calculates hash and sends the packet out.
> */
>-int bond_3ad_xor_xmit(struct sk_buff *skb, struct net_device *dev)
>+static int bond_3ad_xor_xmit(struct sk_buff *skb, struct net_device *dev)
> {
> struct bonding *bond = netdev_priv(dev);
> struct slave *slave;
>diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h
>index e01d903..f04cdbb 100644
>--- a/include/net/bond_3ad.h
>+++ b/include/net/bond_3ad.h
>@@ -274,7 +274,6 @@ void bond_3ad_handle_link_change(struct slave *slave, char link);
> int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info);
> int __bond_3ad_get_active_agg_info(struct bonding *bond,
> struct ad_info *ad_info);
>-int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev);
> int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
> struct slave *slave);
> int bond_3ad_set_carrier(struct bonding *bond);
>--
>1.7.10.4
>
^ permalink raw reply
* Re: [PATCH net-next v2 4/5] bonding: fix LACP PDU not sent on slave port sometimes
From: Jay Vosburgh @ 2015-01-27 0:45 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Jonathan Toppins, Veaceslav Falico, Andy Gospodarek, netdev,
Satish Ashok, Andy Gospodarek
In-Reply-To: <54C62D5E.9030200@cogentembedded.com>
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
>Hello.
>
>On 1/26/2015 9:17 AM, Jonathan Toppins wrote:
>
>> From: Satish Ashok <sashok@cumulusnetworks.com>
>
>> When a slave is added to a bond and it is not in full duplex mode,
>> AD_PORT_LACP_ENABLED flag is cleared, due to this LACP PDU is not sent
>
> s/is not/not being/.
I don't have an issue with the original text, or the updating of
nearby debug messages to include the device name (below). Worst case
would be to respin and add a mention of this to the commit message.
-J
Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
>> on slave. When the duplex is changed to full, the flag needs to be set
>> to send LACP PDU.
>
>> Cc: Andy Gospodarek <gospo@cumulusnetworks.com>
>> Reviewed-by: Nikolay Aleksandrov <nikolay@redhat.com>
>> Signed-off-by: Satish Ashok <sashok@cumulusnetworks.com>
>> Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
>> ---
>> drivers/net/bonding/bond_3ad.c | 11 ++++++++---
>> 1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>> index e3c96b2..cfc4a9c 100644
>> --- a/drivers/net/bonding/bond_3ad.c
>> +++ b/drivers/net/bonding/bond_3ad.c
>> @@ -2219,8 +2219,10 @@ static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave,
>> switch (lacpdu->subtype) {
>> case AD_TYPE_LACPDU:
>> ret = RX_HANDLER_CONSUMED;
>> - netdev_dbg(slave->bond->dev, "Received LACPDU on port %d\n",
>> - port->actor_port_number);
>> + netdev_dbg(slave->bond->dev,
>> + "Received LACPDU on port %d slave %s\n",
>> + port->actor_port_number,
>> + slave->dev->name);
>> /* Protect against concurrent state machines */
>> spin_lock(&slave->bond->mode_lock);
>> ad_rx_machine(lacpdu, port);
>> @@ -2312,7 +2314,10 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave)
>> port->actor_admin_port_key &= ~AD_DUPLEX_KEY_MASKS;
>> port->actor_oper_port_key = port->actor_admin_port_key |=
>> __get_duplex(port);
>> - netdev_dbg(slave->bond->dev, "Port %d changed duplex\n", port->actor_port_number);
>> + netdev_dbg(slave->bond->dev, "Port %d slave %s changed duplex\n",
>> + port->actor_port_number, slave->dev->name);
>
> The above 2 changes seem unrelated/undocumented in the change log...
>
>[...]
>
>WBR, Sergei
>
---
-Jay Vosburgh, jay.vosburgh@canonical.com
^ permalink raw reply
* Re: [PATCH 0/2] sh_eth: massage PM code
From: David Miller @ 2015-01-26 23:27 UTC (permalink / raw)
To: sergei.shtylyov; +Cc: netdev, linux-sh
In-Reply-To: <5608250.lrFkJTjgSf@wasted.cogentembedded.com>
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Thu, 22 Jan 2015 01:16:54 +0300
> Here's a set of 2 patches against DaveM's 'net-next.git' repo. We're adding
> the support for suspend/hibernation as well as somewhat changing the existing
> code. There are still MDIO-related issue with suspend (kernel exception), we've
> been working on it and shall address it with a separate patch...
Series applied, thanks.
^ permalink raw reply
* [PATCH kernel 1/4] sh_eth: Remove RX overflow log messages
From: Ben Hutchings @ 2015-01-27 0:41 UTC (permalink / raw)
To: David S.Miller
Cc: netdev, linux-kernel, Nobuhiro Iwamatsu, Mitsuhiro Kimura,
Hisashi Nakamura, Yoshihiro Kaneko
In-Reply-To: <1422319232.3524.14.camel@xylophone.i.decadent.org.uk>
If RX traffic is overflowing the FIFO or DMA ring, logging every time
this happens just makes things worse. These errors are visible in the
statistics anyway.
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
drivers/net/ethernet/renesas/sh_eth.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 2c4820a..3b49375 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1575,7 +1575,6 @@ ignore_link:
if (intr_status & EESR_RFRMER) {
/* Receive Frame Overflow int */
ndev->stats.rx_frame_errors++;
- netif_err(mdp, rx_err, ndev, "Receive Abort\n");
}
}
@@ -1594,13 +1593,11 @@ ignore_link:
if (intr_status & EESR_RDE) {
/* Receive Descriptor Empty int */
ndev->stats.rx_over_errors++;
- netif_err(mdp, rx_err, ndev, "Receive Descriptor Empty\n");
}
if (intr_status & EESR_RFE) {
/* Receive FIFO Overflow int */
ndev->stats.rx_fifo_errors++;
- netif_err(mdp, rx_err, ndev, "Receive FIFO Overflow\n");
}
if (!mdp->cd->no_ade && (intr_status & EESR_ADE)) {
--
1.7.10.4
^ permalink raw reply related
* [PATCH kernel 0/4] Fixes for sh_eth #3
From: Ben Hutchings @ 2015-01-27 0:40 UTC (permalink / raw)
To: David S.Miller
Cc: netdev, linux-kernel, Nobuhiro Iwamatsu, Mitsuhiro Kimura,
Hisashi Nakamura, Yoshihiro Kaneko
I'm continuing review and testing of Ethernet support on the R-Car H2
chip. This series fixes the last of the more serious issues I've found.
These are not tested on any of the other supported chips.
Ben.
Ben Hutchings (4):
sh_eth: Remove RX overflow log messages
sh_eth: Ensure DMA engines are stopped before freeing buffers
sh_eth: Check for DMA mapping errors on transmit
sh_eth: Fix DMA-API usage for RX buffers
drivers/net/ethernet/renesas/sh_eth.c | 80 ++++++++++++++++++++++++---------
1 file changed, 59 insertions(+), 21 deletions(-)
--
1.7.10.4
^ permalink raw reply
* Re: Anyone have working cable for Intel 40GB Ethernet NIC?
From: Greg Rose @ 2015-01-27 0:39 UTC (permalink / raw)
To: Ben Greear; +Cc: netdev
In-Reply-To: <54C6D5E7.30906@candelatech.com>
On Mon, Jan 26, 2015 at 4:03 PM, Ben Greear <greearb@candelatech.com> wrote:
> I cannot find info on a direct-attached cable that is known to work..and the
> one I bought is not accepted by the driver/NIC.
>
> If anyone knows of a cable that works, please let me know
> so I can order one.
>
> Thanks,
> Ben
The cable I'm using here is a QSFP+ DA cable made by Amphenol. The
part # G47684-001.
Hope that helps.
- Greg Rose
Intel Corp.
Networking Division
<gregory.v.rose@intel.com>
>
> --
> Ben Greear <greearb@candelatech.com>
> Candela Technologies Inc http://www.candelatech.com
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox