Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v1 08/18] net: ipvlan: use __ethtool_get_ksettings
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>

Signed-off-by: David Decotigny <decot@googlers.com>
---
 drivers/net/ipvlan/ipvlan_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 4f4099d..79e3516 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -342,12 +342,12 @@ static const struct header_ops ipvlan_header_ops = {
 	.cache_update	= eth_header_cache_update,
 };
 
-static int ipvlan_ethtool_get_settings(struct net_device *dev,
-				       struct ethtool_cmd *cmd)
+static int ipvlan_ethtool_get_ksettings(struct net_device *dev,
+					struct ethtool_ksettings *cmd)
 {
 	const struct ipvl_dev *ipvlan = netdev_priv(dev);
 
-	return __ethtool_get_settings(ipvlan->phy_dev, cmd);
+	return __ethtool_get_ksettings(ipvlan->phy_dev, cmd);
 }
 
 static void ipvlan_ethtool_get_drvinfo(struct net_device *dev,
@@ -373,7 +373,7 @@ static void ipvlan_ethtool_set_msglevel(struct net_device *dev, u32 value)
 
 static const struct ethtool_ops ipvlan_ethtool_ops = {
 	.get_link	= ethtool_op_get_link,
-	.get_settings	= ipvlan_ethtool_get_settings,
+	.get_ksettings	= ipvlan_ethtool_get_ksettings,
 	.get_drvinfo	= ipvlan_ethtool_get_drvinfo,
 	.get_msglevel	= ipvlan_ethtool_get_msglevel,
 	.set_msglevel	= ipvlan_ethtool_set_msglevel,
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 10/18] net: team: use __ethtool_get_ksettings
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>

Signed-off-by: David Decotigny <decot@googlers.com>
---
 drivers/net/team/team.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 4b2bfc5..77576d1 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -2767,12 +2767,12 @@ static void __team_port_change_send(struct team_port *port, bool linkup)
 	port->state.linkup = linkup;
 	team_refresh_port_linkup(port);
 	if (linkup) {
-		struct ethtool_cmd ecmd;
+		struct ethtool_ksettings ecmd;
 
-		err = __ethtool_get_settings(port->dev, &ecmd);
+		err = __ethtool_get_ksettings(port->dev, &ecmd);
 		if (!err) {
-			port->state.speed = ethtool_cmd_speed(&ecmd);
-			port->state.duplex = ecmd.duplex;
+			port->state.speed = ecmd.parent.speed;
+			port->state.duplex = ecmd.parent.duplex;
 			goto send_event;
 		}
 	}
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 11/18] net: fcoe: use __ethtool_get_ksettings
From: David Decotigny @ 2015-01-27  1:36 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
In-Reply-To: <1422322574-6188-1-git-send-email-ddecotig-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

From: David Decotigny <decot-Ypc/8FJVVoBWk0Htik3J/w@public.gmane.org>

Signed-off-by: David Decotigny <decot-Ypc/8FJVVoBWk0Htik3J/w@public.gmane.org>
---
 drivers/scsi/fcoe/fcoe_transport.c | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index bdc8989..6097f0d 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -93,36 +93,40 @@ static struct notifier_block libfcoe_notifier = {
 int fcoe_link_speed_update(struct fc_lport *lport)
 {
 	struct net_device *netdev = fcoe_get_netdev(lport);
-	struct ethtool_cmd ecmd;
+	struct ethtool_ksettings ecmd;
 
-	if (!__ethtool_get_settings(netdev, &ecmd)) {
+	if (!__ethtool_get_ksettings(netdev, &ecmd)) {
 		lport->link_supported_speeds &= ~(FC_PORTSPEED_1GBIT  |
 		                                  FC_PORTSPEED_10GBIT |
 		                                  FC_PORTSPEED_20GBIT |
 		                                  FC_PORTSPEED_40GBIT);
 
-		if (ecmd.supported & (SUPPORTED_1000baseT_Half |
-		                      SUPPORTED_1000baseT_Full |
-		                      SUPPORTED_1000baseKX_Full))
+		if (ecmd.link_modes.supported.mask[0] & (
+			    SUPPORTED_1000baseT_Half |
+			    SUPPORTED_1000baseT_Full |
+			    SUPPORTED_1000baseKX_Full))
 			lport->link_supported_speeds |= FC_PORTSPEED_1GBIT;
 
-		if (ecmd.supported & (SUPPORTED_10000baseT_Full   |
-		                      SUPPORTED_10000baseKX4_Full |
-		                      SUPPORTED_10000baseKR_Full  |
-		                      SUPPORTED_10000baseR_FEC))
+		if (ecmd.link_modes.supported.mask[0] & (
+			    SUPPORTED_10000baseT_Full   |
+			    SUPPORTED_10000baseKX4_Full |
+			    SUPPORTED_10000baseKR_Full  |
+			    SUPPORTED_10000baseR_FEC))
 			lport->link_supported_speeds |= FC_PORTSPEED_10GBIT;
 
-		if (ecmd.supported & (SUPPORTED_20000baseMLD2_Full |
-		                      SUPPORTED_20000baseKR2_Full))
+		if (ecmd.link_modes.supported.mask[0] & (
+			    SUPPORTED_20000baseMLD2_Full |
+			    SUPPORTED_20000baseKR2_Full))
 			lport->link_supported_speeds |= FC_PORTSPEED_20GBIT;
 
-		if (ecmd.supported & (SUPPORTED_40000baseKR4_Full |
-		                      SUPPORTED_40000baseCR4_Full |
-		                      SUPPORTED_40000baseSR4_Full |
-		                      SUPPORTED_40000baseLR4_Full))
+		if (ecmd.link_modes.supported.mask[0] & (
+			    SUPPORTED_40000baseKR4_Full |
+			    SUPPORTED_40000baseCR4_Full |
+			    SUPPORTED_40000baseSR4_Full |
+			    SUPPORTED_40000baseLR4_Full))
 			lport->link_supported_speeds |= FC_PORTSPEED_40GBIT;
 
-		switch (ethtool_cmd_speed(&ecmd)) {
+		switch (ecmd.parent.speed) {
 		case SPEED_1000:
 			lport->link_speed = FC_PORTSPEED_1GBIT;
 			break;
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 13/18] net: 8021q: use __ethtool_get_ksettings
From: David Decotigny @ 2015-01-27  1:36 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
In-Reply-To: <1422322574-6188-1-git-send-email-ddecotig-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

From: David Decotigny <decot-Ypc/8FJVVoBWk0Htik3J/w@public.gmane.org>

Signed-off-by: David Decotigny <decot-Ypc/8FJVVoBWk0Htik3J/w@public.gmane.org>
---
 net/8021q/vlan_dev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 1189564..b301bf6 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -655,12 +655,12 @@ static netdev_features_t vlan_dev_fix_features(struct net_device *dev,
 	return features;
 }
 
-static int vlan_ethtool_get_settings(struct net_device *dev,
-				     struct ethtool_cmd *cmd)
+static int vlan_ethtool_get_ksettings(struct net_device *dev,
+				      struct ethtool_ksettings *cmd)
 {
 	const struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
 
-	return __ethtool_get_settings(vlan->real_dev, cmd);
+	return __ethtool_get_ksettings(vlan->real_dev, cmd);
 }
 
 static void vlan_ethtool_get_drvinfo(struct net_device *dev,
@@ -768,7 +768,7 @@ static void vlan_dev_netpoll_cleanup(struct net_device *dev)
 #endif /* CONFIG_NET_POLL_CONTROLLER */
 
 static const struct ethtool_ops vlan_ethtool_ops = {
-	.get_settings	        = vlan_ethtool_get_settings,
+	.get_ksettings	        = vlan_ethtool_get_ksettings,
 	.get_drvinfo	        = vlan_ethtool_get_drvinfo,
 	.get_link		= ethtool_op_get_link,
 	.get_ts_info		= vlan_ethtool_get_ts_info,
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 14/18] net: bridge: use __ethtool_get_ksettings
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>

Signed-off-by: David Decotigny <decot@googlers.com>
---
 net/bridge/br_if.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index b087d27..57282a5 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -35,10 +35,10 @@
  */
 static int port_cost(struct net_device *dev)
 {
-	struct ethtool_cmd ecmd;
+	struct ethtool_ksettings ecmd;
 
-	if (!__ethtool_get_settings(dev, &ecmd)) {
-		switch (ethtool_cmd_speed(&ecmd)) {
+	if (!__ethtool_get_ksettings(dev, &ecmd)) {
+		switch (ecmd.parent.speed) {
 		case SPEED_10000:
 			return 2;
 		case SPEED_1000:
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 15/18] net: core: use __ethtool_get_ksettings
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>

Signed-off-by: David Decotigny <decot@googlers.com>
---
 net/core/net-sysfs.c   | 15 +++++++++------
 net/packet/af_packet.c | 11 +++++------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 9993412..f54ae21 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -191,9 +191,10 @@ static ssize_t speed_show(struct device *dev,
 		return restart_syscall();
 
 	if (netif_running(netdev)) {
-		struct ethtool_cmd cmd;
-		if (!__ethtool_get_settings(netdev, &cmd))
-			ret = sprintf(buf, fmt_udec, ethtool_cmd_speed(&cmd));
+		struct ethtool_ksettings cmd;
+
+		if (!__ethtool_get_ksettings(netdev, &cmd))
+			ret = sprintf(buf, fmt_udec, cmd.parent.speed);
 	}
 	rtnl_unlock();
 	return ret;
@@ -210,10 +211,12 @@ static ssize_t duplex_show(struct device *dev,
 		return restart_syscall();
 
 	if (netif_running(netdev)) {
-		struct ethtool_cmd cmd;
-		if (!__ethtool_get_settings(netdev, &cmd)) {
+		struct ethtool_ksettings cmd;
+
+		if (!__ethtool_get_ksettings(netdev, &cmd)) {
 			const char *duplex;
-			switch (cmd.duplex) {
+
+			switch (cmd.parent.duplex) {
 			case DUPLEX_HALF:
 				duplex = "half";
 				break;
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 9c28cec..fe2fcbe 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -554,9 +554,8 @@ static int prb_calc_retire_blk_tmo(struct packet_sock *po,
 {
 	struct net_device *dev;
 	unsigned int mbits = 0, msec = 0, div = 0, tmo = 0;
-	struct ethtool_cmd ecmd;
+	struct ethtool_ksettings ecmd;
 	int err;
-	u32 speed;
 
 	rtnl_lock();
 	dev = __dev_get_by_index(sock_net(&po->sk), po->ifindex);
@@ -564,19 +563,19 @@ static int prb_calc_retire_blk_tmo(struct packet_sock *po,
 		rtnl_unlock();
 		return DEFAULT_PRB_RETIRE_TOV;
 	}
-	err = __ethtool_get_settings(dev, &ecmd);
-	speed = ethtool_cmd_speed(&ecmd);
+	err = __ethtool_get_ksettings(dev, &ecmd);
 	rtnl_unlock();
 	if (!err) {
 		/*
 		 * If the link speed is so slow you don't really
 		 * need to worry about perf anyways
 		 */
-		if (speed < SPEED_1000 || speed == SPEED_UNKNOWN) {
+		if (ecmd.parent.speed < SPEED_1000 ||
+		    ecmd.parent.speed == SPEED_UNKNOWN) {
 			return DEFAULT_PRB_RETIRE_TOV;
 		} else {
 			msec = 1;
-			div = speed / 1000;
+			div = ecmd.parent.speed / 1000;
 		}
 	}
 
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 16/18] net: ethtool: remove unused __ethtool_get_settings
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>

replaced by __ethtool_get_ksettings.

Signed-off-by: David Decotigny <decot@googlers.com>
---
 include/linux/ethtool.h |  4 ----
 net/core/ethtool.c      | 46 ++++++++++++----------------------------------
 2 files changed, 12 insertions(+), 38 deletions(-)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 49881b6..d9c8fab 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -160,10 +160,6 @@ __ethtool_add_link_modes(ethtool_link_mode_mask_t *dst,
 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: DEPRECATED, use %get_ksettings/%set_ksettings
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index d978d80..1a2b8a6 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -487,15 +487,16 @@ int __ethtool_get_ksettings(struct net_device *dev,
 		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 (!dev->ethtool_ops->get_settings)
+		return -EOPNOTSUPP;
+
+	memset(&cmd, 0, sizeof(cmd));
+	cmd.cmd = ETHTOOL_GSET;
+	err = dev->ethtool_ops->get_settings(dev, &cmd);
 	if (err < 0)
 		return err;
 
@@ -711,30 +712,6 @@ static int ethtool_set_ksettings(struct net_device *dev, void __user *useraddr)
 	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();
-
-	if (!dev->ethtool_ops->get_settings)
-		return -EOPNOTSUPP;
-
-	memset(cmd, 0, sizeof(struct ethtool_cmd));
-	cmd->cmd = ETHTOOL_GSET;
-	return dev->ethtool_ops->get_settings(dev, cmd);
-}
-EXPORT_SYMBOL(__ethtool_get_settings);
-
 /* Query device for its ethtool_cmd settings.
  *
  * Backward compatibility note: for compatibility with legacy ethtool,
@@ -776,15 +753,16 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr)
 		/* 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 (!dev->ethtool_ops->get_settings)
+			return -EOPNOTSUPP;
+
+		memset(&cmd, 0, sizeof(cmd));
+		cmd.cmd = ETHTOOL_GSET;
+		err = dev->ethtool_ops->get_settings(dev, &cmd);
 		if (err < 0)
 			return err;
 	}
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 17/18] net: mlx4: identify predicate for debug messages
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>

Signed-off-by: David Decotigny <decot@googlers.com>
---
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 944a112..96bf728 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -869,9 +869,11 @@ __printf(3, 4)
 void en_print(const char *level, const struct mlx4_en_priv *priv,
 	      const char *format, ...);
 
+#define en_dbg_enabled(mlevel, priv)		\
+	(NETIF_MSG_##mlevel & (priv)->msg_enable)
 #define en_dbg(mlevel, priv, format, ...)				\
 do {									\
-	if (NETIF_MSG_##mlevel & (priv)->msg_enable)			\
+	if (en_dbg_enabled(mlevel, priv))				\
 		en_print(KERN_DEBUG, priv, format, ##__VA_ARGS__);	\
 } while (0)
 #define en_warn(priv, format, ...)					\
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 18/18] net: mlx4: use new ETHTOOL_G/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>

Signed-off-by: David Decotigny <decot@googlers.com>
---
 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    |   1 +
 3 files changed, 161 insertions(+), 167 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index 569eda9..4ad34064 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -388,34 +388,30 @@ static u32 mlx4_en_autoneg_get(struct net_device *dev)
 	return autoneg;
 }
 
-static u32 ptys_get_supported_port(struct mlx4_ptys_reg *ptys_reg)
+static void ptys2ethtool_update_supported_port(ethtool_link_mode_mask_t *mask,
+					       struct mlx4_ptys_reg *ptys_reg)
 {
 	u32 eth_proto = be32_to_cpu(ptys_reg->eth_proto_cap);
 
 	if (eth_proto & (MLX4_PROT_MASK(MLX4_10GBASE_T)
 			 | MLX4_PROT_MASK(MLX4_1000BASE_T)
 			 | MLX4_PROT_MASK(MLX4_100BASE_TX))) {
-			return SUPPORTED_TP;
-	}
-
-	if (eth_proto & (MLX4_PROT_MASK(MLX4_10GBASE_CR)
+		ethtool_add_link_modes(mask, ETHTOOL_LINK_MODE_TP_BIT);
+	} else if (eth_proto & (MLX4_PROT_MASK(MLX4_10GBASE_CR)
 			 | MLX4_PROT_MASK(MLX4_10GBASE_SR)
 			 | MLX4_PROT_MASK(MLX4_56GBASE_SR4)
 			 | MLX4_PROT_MASK(MLX4_40GBASE_CR4)
 			 | MLX4_PROT_MASK(MLX4_40GBASE_SR4)
 			 | MLX4_PROT_MASK(MLX4_1000BASE_CX_SGMII))) {
-			return SUPPORTED_FIBRE;
-	}
-
-	if (eth_proto & (MLX4_PROT_MASK(MLX4_56GBASE_KR4)
+		ethtool_add_link_modes(mask, ETHTOOL_LINK_MODE_FIBRE_BIT);
+	} else if (eth_proto & (MLX4_PROT_MASK(MLX4_56GBASE_KR4)
 			 | MLX4_PROT_MASK(MLX4_40GBASE_KR4)
 			 | MLX4_PROT_MASK(MLX4_20GBASE_KR2)
 			 | MLX4_PROT_MASK(MLX4_10GBASE_KR)
 			 | MLX4_PROT_MASK(MLX4_10GBASE_KX4)
 			 | MLX4_PROT_MASK(MLX4_1000BASE_KX))) {
-			return SUPPORTED_Backplane;
+		ethtool_add_link_modes(mask, ETHTOOL_LINK_MODE_Backplane_BIT);
 	}
-	return 0;
 }
 
 static u32 ptys_get_active_port(struct mlx4_ptys_reg *ptys_reg)
@@ -461,122 +457,91 @@ static u32 ptys_get_active_port(struct mlx4_ptys_reg *ptys_reg)
 enum ethtool_report {
 	SUPPORTED = 0,
 	ADVERTISED = 1,
-	SPEED = 2
 };
 
+struct ptys2ethtool_config {
+	ethtool_link_mode_mask_t link_modes[2];  /* SUPPORTED/ADVERTISED */
+	u32 speed;
+};
+
+#define MLX4_BUILD_PTYS2ETHTOOL_CONFIG(reg_, speed_, ...)		\
+	({								\
+		struct ptys2ethtool_config *cfg;			\
+		cfg = &ptys2ethtool_map[reg_];				\
+		cfg->speed = speed_;					\
+		ethtool_build_link_mode(&cfg->link_modes[SUPPORTED],	\
+					__VA_ARGS__);			\
+		ethtool_build_link_mode(&cfg->link_modes[ADVERTISED],	\
+					__VA_ARGS__);			\
+	})
+
 /* Translates mlx4 link mode to equivalent ethtool Link modes/speed */
-static u32 ptys2ethtool_map[MLX4_LINK_MODES_SZ][3] = {
-	[MLX4_100BASE_TX] = {
-		SUPPORTED_100baseT_Full,
-		ADVERTISED_100baseT_Full,
-		SPEED_100
-		},
-
-	[MLX4_1000BASE_T] = {
-		SUPPORTED_1000baseT_Full,
-		ADVERTISED_1000baseT_Full,
-		SPEED_1000
-		},
-	[MLX4_1000BASE_CX_SGMII] = {
-		SUPPORTED_1000baseKX_Full,
-		ADVERTISED_1000baseKX_Full,
-		SPEED_1000
-		},
-	[MLX4_1000BASE_KX] = {
-		SUPPORTED_1000baseKX_Full,
-		ADVERTISED_1000baseKX_Full,
-		SPEED_1000
-		},
-
-	[MLX4_10GBASE_T] = {
-		SUPPORTED_10000baseT_Full,
-		ADVERTISED_10000baseT_Full,
-		SPEED_10000
-		},
-	[MLX4_10GBASE_CX4] = {
-		SUPPORTED_10000baseKX4_Full,
-		ADVERTISED_10000baseKX4_Full,
-		SPEED_10000
-		},
-	[MLX4_10GBASE_KX4] = {
-		SUPPORTED_10000baseKX4_Full,
-		ADVERTISED_10000baseKX4_Full,
-		SPEED_10000
-		},
-	[MLX4_10GBASE_KR] = {
-		SUPPORTED_10000baseKR_Full,
-		ADVERTISED_10000baseKR_Full,
-		SPEED_10000
-		},
-	[MLX4_10GBASE_CR] = {
-		SUPPORTED_10000baseKR_Full,
-		ADVERTISED_10000baseKR_Full,
-		SPEED_10000
-		},
-	[MLX4_10GBASE_SR] = {
-		SUPPORTED_10000baseKR_Full,
-		ADVERTISED_10000baseKR_Full,
-		SPEED_10000
-		},
-
-	[MLX4_20GBASE_KR2] = {
-		SUPPORTED_20000baseMLD2_Full | SUPPORTED_20000baseKR2_Full,
-		ADVERTISED_20000baseMLD2_Full | ADVERTISED_20000baseKR2_Full,
-		SPEED_20000
-		},
-
-	[MLX4_40GBASE_CR4] = {
-		SUPPORTED_40000baseCR4_Full,
-		ADVERTISED_40000baseCR4_Full,
-		SPEED_40000
-		},
-	[MLX4_40GBASE_KR4] = {
-		SUPPORTED_40000baseKR4_Full,
-		ADVERTISED_40000baseKR4_Full,
-		SPEED_40000
-		},
-	[MLX4_40GBASE_SR4] = {
-		SUPPORTED_40000baseSR4_Full,
-		ADVERTISED_40000baseSR4_Full,
-		SPEED_40000
-		},
-
-	[MLX4_56GBASE_KR4] = {
-		SUPPORTED_56000baseKR4_Full,
-		ADVERTISED_56000baseKR4_Full,
-		SPEED_56000
-		},
-	[MLX4_56GBASE_CR4] = {
-		SUPPORTED_56000baseCR4_Full,
-		ADVERTISED_56000baseCR4_Full,
-		SPEED_56000
-		},
-	[MLX4_56GBASE_SR4] = {
-		SUPPORTED_56000baseSR4_Full,
-		ADVERTISED_56000baseSR4_Full,
-		SPEED_56000
-		},
+static struct ptys2ethtool_config ptys2ethtool_map[MLX4_LINK_MODES_SZ];
+
+void __init mlx4_en_init_ptys2ethtool_map(void)
+{
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_100BASE_TX, SPEED_100,
+				       ETHTOOL_LINK_MODE_100baseT_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_1000BASE_T, SPEED_1000,
+				       ETHTOOL_LINK_MODE_1000baseT_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_1000BASE_CX_SGMII, SPEED_1000,
+				       ETHTOOL_LINK_MODE_1000baseKX_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_1000BASE_KX, SPEED_1000,
+				       ETHTOOL_LINK_MODE_1000baseKX_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_10GBASE_T, SPEED_10000,
+				       ETHTOOL_LINK_MODE_10000baseT_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_10GBASE_CX4, SPEED_10000,
+				       ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_10GBASE_KX4, SPEED_10000,
+				       ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_10GBASE_KR, SPEED_10000,
+				       ETHTOOL_LINK_MODE_10000baseKR_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_10GBASE_CR, SPEED_10000,
+				       ETHTOOL_LINK_MODE_10000baseKR_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_10GBASE_SR, SPEED_10000,
+				       ETHTOOL_LINK_MODE_10000baseKR_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_20GBASE_KR2, SPEED_20000,
+				       ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT,
+				       ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_40GBASE_CR4, SPEED_40000,
+				       ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_40GBASE_KR4, SPEED_40000,
+				       ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_40GBASE_SR4, SPEED_40000,
+				       ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_56GBASE_KR4, SPEED_56000,
+				       ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_56GBASE_CR4, SPEED_56000,
+				       ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT);
+	MLX4_BUILD_PTYS2ETHTOOL_CONFIG(MLX4_56GBASE_SR4, SPEED_56000,
+				       ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT);
 };
 
-static u32 ptys2ethtool_link_modes(u32 eth_proto, enum ethtool_report report)
+static void ptys2ethtool_update_link_modes(ethtool_link_mode_mask_t *link_modes,
+					   u32 eth_proto,
+					   enum ethtool_report report)
 {
 	int i;
-	u32 link_modes = 0;
-
 	for (i = 0; i < MLX4_LINK_MODES_SZ; i++) {
 		if (eth_proto & MLX4_PROT_MASK(i))
-			link_modes |= ptys2ethtool_map[i][report];
+			bitmap_or(link_modes->mask,
+				  link_modes->mask,
+				  ptys2ethtool_map[i].link_modes[report].mask,
+				  __ETHTOOL_LINK_MODE_MASK_NBITS);
 	}
-	return link_modes;
 }
 
-static u32 ethtool2ptys_link_modes(u32 link_modes, enum ethtool_report report)
+static u32 ethtool2ptys_link_modes(const ethtool_link_mode_mask_t *link_modes,
+				   enum ethtool_report report)
 {
 	int i;
 	u32 ptys_modes = 0;
 
 	for (i = 0; i < MLX4_LINK_MODES_SZ; i++) {
-		if (ptys2ethtool_map[i][report] & link_modes)
+		if (bitmap_intersects(
+			    ptys2ethtool_map[i].link_modes[report].mask,
+			    link_modes->mask,
+			    __ETHTOOL_LINK_MODE_MASK_NBITS))
 			ptys_modes |= 1 << i;
 	}
 	return ptys_modes;
@@ -589,14 +554,14 @@ static u32 speed2ptys_link_modes(u32 speed)
 	u32 ptys_modes = 0;
 
 	for (i = 0; i < MLX4_LINK_MODES_SZ; i++) {
-		if (ptys2ethtool_map[i][SPEED] == speed)
+		if (ptys2ethtool_map[i].speed == speed)
 			ptys_modes |= 1 << i;
 	}
 	return ptys_modes;
 }
 
-static int ethtool_get_ptys_settings(struct net_device *dev,
-				     struct ethtool_cmd *cmd)
+static int ethtool_get_ptys_ksettings(struct net_device *dev,
+				      struct ethtool_ksettings *ksettings)
 {
 	struct mlx4_en_priv *priv = netdev_priv(dev);
 	struct mlx4_ptys_reg ptys_reg;
@@ -624,79 +589,94 @@ static int ethtool_get_ptys_settings(struct net_device *dev,
 	en_dbg(DRV, priv, "ptys_reg.eth_proto_lp_adv %x\n",
 	       be32_to_cpu(ptys_reg.eth_proto_lp_adv));
 
-	cmd->supported = 0;
-	cmd->advertising = 0;
+	/* reset supported/advertising masks */
+	ethtool_build_link_mode(&ksettings->link_modes.supported);
+	ethtool_build_link_mode(&ksettings->link_modes.advertising);
 
-	cmd->supported |= ptys_get_supported_port(&ptys_reg);
+	ptys2ethtool_update_supported_port(&ksettings->link_modes.supported,
+					   &ptys_reg);
 
 	eth_proto = be32_to_cpu(ptys_reg.eth_proto_cap);
-	cmd->supported |= ptys2ethtool_link_modes(eth_proto, SUPPORTED);
+	ptys2ethtool_update_link_modes(&ksettings->link_modes.supported,
+				       eth_proto, SUPPORTED);
 
 	eth_proto = be32_to_cpu(ptys_reg.eth_proto_admin);
-	cmd->advertising |= ptys2ethtool_link_modes(eth_proto, ADVERTISED);
+	ptys2ethtool_update_link_modes(&ksettings->link_modes.advertising,
+				       eth_proto, ADVERTISED);
 
-	cmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
-	cmd->advertising |= (priv->prof->tx_pause) ? ADVERTISED_Pause : 0;
+	ethtool_add_link_modes(&ksettings->link_modes.supported,
+			       ETHTOOL_LINK_MODE_Pause_BIT,
+			       ETHTOOL_LINK_MODE_Pause_BIT);
 
-	cmd->advertising |= (priv->prof->tx_pause ^ priv->prof->rx_pause) ?
-		ADVERTISED_Asym_Pause : 0;
+	if (priv->prof->tx_pause)
+		ethtool_add_link_modes(&ksettings->link_modes.advertising,
+				       ETHTOOL_LINK_MODE_Pause_BIT);
+	if (priv->prof->tx_pause ^ priv->prof->rx_pause)
+		ethtool_add_link_modes(&ksettings->link_modes.advertising,
+				       ETHTOOL_LINK_MODE_Asym_Pause_BIT);
 
-	cmd->port = ptys_get_active_port(&ptys_reg);
-	cmd->transceiver = (SUPPORTED_TP & cmd->supported) ?
-		XCVR_EXTERNAL : XCVR_INTERNAL;
+	ksettings->parent.port = ptys_get_active_port(&ptys_reg);
 
 	if (mlx4_en_autoneg_get(dev)) {
-		cmd->supported |= SUPPORTED_Autoneg;
-		cmd->advertising |= ADVERTISED_Autoneg;
+		ethtool_add_link_modes(&ksettings->link_modes.supported,
+				       ETHTOOL_LINK_MODE_Autoneg_BIT);
+		ethtool_add_link_modes(&ksettings->link_modes.advertising,
+				       ETHTOOL_LINK_MODE_Autoneg_BIT);
 	}
 
-	cmd->autoneg = (priv->port_state.flags & MLX4_EN_PORT_ANC) ?
+	ksettings->parent.autoneg
+		= (priv->port_state.flags & MLX4_EN_PORT_ANC) ?
 		AUTONEG_ENABLE : AUTONEG_DISABLE;
 
 	eth_proto = be32_to_cpu(ptys_reg.eth_proto_lp_adv);
-	cmd->lp_advertising = ptys2ethtool_link_modes(eth_proto, ADVERTISED);
 
-	cmd->lp_advertising |= (priv->port_state.flags & MLX4_EN_PORT_ANC) ?
-			ADVERTISED_Autoneg : 0;
+	ethtool_build_link_mode(&ksettings->link_modes.lp_advertising);
+	ptys2ethtool_update_link_modes(&ksettings->link_modes.lp_advertising,
+				       eth_proto, ADVERTISED);
+	if (priv->port_state.flags & MLX4_EN_PORT_ANC)
+		ethtool_add_link_modes(&ksettings->link_modes.lp_advertising,
+				       ETHTOOL_LINK_MODE_Autoneg_BIT);
 
-	cmd->phy_address = 0;
-	cmd->mdio_support = 0;
-	cmd->maxtxpkt = 0;
-	cmd->maxrxpkt = 0;
-	cmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
-	cmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO;
+	ksettings->parent.phy_address = 0;
+	ksettings->parent.mdio_support = 0;
+	ksettings->parent.eth_tp_mdix = ETH_TP_MDI_INVALID;
+	ksettings->parent.eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO;
 
 	return ret;
 }
 
-static void ethtool_get_default_settings(struct net_device *dev,
-					 struct ethtool_cmd *cmd)
+static void ethtool_get_default_ksettings(struct net_device *dev,
+					  struct ethtool_ksettings *ksettings)
 {
 	struct mlx4_en_priv *priv = netdev_priv(dev);
 	int trans_type;
 
-	cmd->autoneg = AUTONEG_DISABLE;
-	cmd->supported = SUPPORTED_10000baseT_Full;
-	cmd->advertising = ADVERTISED_10000baseT_Full;
+	ksettings->parent.autoneg = AUTONEG_DISABLE;
+	ethtool_build_link_mode(&ksettings->link_modes.supported,
+				ETHTOOL_LINK_MODE_10000baseT_Full_BIT);
+	ethtool_build_link_mode(&ksettings->link_modes.advertising,
+				ETHTOOL_LINK_MODE_10000baseT_Full_BIT);
 	trans_type = priv->port_state.transceiver;
 
 	if (trans_type > 0 && trans_type <= 0xC) {
-		cmd->port = PORT_FIBRE;
-		cmd->transceiver = XCVR_EXTERNAL;
-		cmd->supported |= SUPPORTED_FIBRE;
-		cmd->advertising |= ADVERTISED_FIBRE;
+		ksettings->parent.port = PORT_FIBRE;
+		ethtool_add_link_modes(&ksettings->link_modes.supported,
+				       ETHTOOL_LINK_MODE_FIBRE_BIT);
+		ethtool_add_link_modes(&ksettings->link_modes.advertising,
+				       ETHTOOL_LINK_MODE_FIBRE_BIT);
 	} else if (trans_type == 0x80 || trans_type == 0) {
-		cmd->port = PORT_TP;
-		cmd->transceiver = XCVR_INTERNAL;
-		cmd->supported |= SUPPORTED_TP;
-		cmd->advertising |= ADVERTISED_TP;
+		ksettings->parent.port = PORT_TP;
+		ethtool_add_link_modes(&ksettings->link_modes.supported,
+				       ETHTOOL_LINK_MODE_TP_BIT);
+		ethtool_add_link_modes(&ksettings->link_modes.advertising,
+				       ETHTOOL_LINK_MODE_TP_BIT);
 	} else  {
-		cmd->port = -1;
-		cmd->transceiver = -1;
+		ksettings->parent.port = -1;
 	}
 }
 
-static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int mlx4_en_get_ksettings(struct net_device *dev,
+				 struct ethtool_ksettings *ksettings)
 {
 	struct mlx4_en_priv *priv = netdev_priv(dev);
 	int ret = -EINVAL;
@@ -709,16 +689,16 @@ static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 	       priv->port_state.flags & MLX4_EN_PORT_ANE);
 
 	if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL)
-		ret = ethtool_get_ptys_settings(dev, cmd);
+		ret = ethtool_get_ptys_ksettings(dev, ksettings);
 	if (ret) /* ETH PROT CRTL is not supported or PTYS CMD failed */
-		ethtool_get_default_settings(dev, cmd);
+		ethtool_get_default_ksettings(dev, ksettings);
 
 	if (netif_carrier_ok(dev)) {
-		ethtool_cmd_speed_set(cmd, priv->port_state.link_speed);
-		cmd->duplex = DUPLEX_FULL;
+		ksettings->parent.speed = priv->port_state.link_speed;
+		ksettings->parent.duplex = DUPLEX_FULL;
 	} else {
-		ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
-		cmd->duplex = DUPLEX_UNKNOWN;
+		ksettings->parent.speed = SPEED_UNKNOWN;
+		ksettings->parent.duplex = DUPLEX_UNKNOWN;
 	}
 	return 0;
 }
@@ -742,21 +722,33 @@ static __be32 speed_set_ptys_admin(struct mlx4_en_priv *priv, u32 speed,
 	return proto_admin;
 }
 
-static int mlx4_en_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int mlx4_en_set_ksettings(struct net_device *dev,
+				 const struct ethtool_ksettings *ksettings)
 {
 	struct mlx4_en_priv *priv = netdev_priv(dev);
 	struct mlx4_ptys_reg ptys_reg;
 	__be32 proto_admin;
 	int ret;
 
-	u32 ptys_adv = ethtool2ptys_link_modes(cmd->advertising, ADVERTISED);
-	int speed = ethtool_cmd_speed(cmd);
+	u32 ptys_adv = ethtool2ptys_link_modes(
+		&ksettings->link_modes.advertising, ADVERTISED);
+	const int speed = ksettings->parent.speed;
+
+	if (en_dbg_enabled(DRV, priv)) {
+		char dbg_link_mode_buff[64];
 
-	en_dbg(DRV, priv, "Set Speed=%d adv=0x%x autoneg=%d duplex=%d\n",
-	       speed, cmd->advertising, cmd->autoneg, cmd->duplex);
+		bitmap_scnprintf(dbg_link_mode_buff,
+				 sizeof(dbg_link_mode_buff),
+				 ksettings->link_modes.supported.mask,
+				 __ETHTOOL_LINK_MODE_MASK_NBITS);
+		en_dbg(DRV, priv,
+		       "Set Speed=%d adv={%s} autoneg=%d duplex=%d\n",
+		       speed, dbg_link_mode_buff,
+		       ksettings->parent.autoneg, ksettings->parent.duplex);
+	}
 
 	if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL) ||
-	    (cmd->duplex == DUPLEX_HALF))
+	    (ksettings->parent.duplex == DUPLEX_HALF))
 		return -EINVAL;
 
 	memset(&ptys_reg, 0, sizeof(ptys_reg));
@@ -1822,8 +1814,8 @@ static int mlx4_en_get_module_eeprom(struct net_device *dev,
 
 const struct ethtool_ops mlx4_en_ethtool_ops = {
 	.get_drvinfo = mlx4_en_get_drvinfo,
-	.get_settings = mlx4_en_get_settings,
-	.set_settings = mlx4_en_set_settings,
+	.get_ksettings = mlx4_en_get_ksettings,
+	.set_ksettings = mlx4_en_set_ksettings,
 	.get_link = ethtool_op_get_link,
 	.get_strings = mlx4_en_get_strings,
 	.get_sset_count = mlx4_en_get_sset_count,
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_main.c b/drivers/net/ethernet/mellanox/mlx4/en_main.c
index c643d2b..b435349 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_main.c
@@ -348,6 +348,7 @@ static void mlx4_en_verify_params(void)
 static int __init mlx4_en_init(void)
 {
 	mlx4_en_verify_params();
+	mlx4_en_init_ptys2ethtool_map();
 
 	return mlx4_register_interface(&mlx4_en_interface);
 }
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 96bf728..609fc3e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -749,6 +749,7 @@ static inline bool mlx4_en_cq_busy_polling(struct mlx4_en_cq *cq)
 
 #define MLX4_EN_WOL_DO_MODIFY (1ULL << 63)
 
+void mlx4_en_init_ptys2ethtool_map(void);
 void mlx4_en_update_loopback_state(struct net_device *dev,
 				   netdev_features_t features);
 
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 01/18] net: ethtool: propagate get_settings error
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>
---
 net/core/ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 91f74f3..52efb7e 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -364,7 +364,7 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr)
 
 	if (copy_to_user(useraddr, &cmd, sizeof(cmd)))
 		return -EFAULT;
-	return 0;
+	return err;
 }
 
 static int ethtool_set_settings(struct net_device *dev, void __user *useraddr)
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 02/18] net: usnic: remove unused call to ethtool_ops::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, 2 deletions(-)

diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index 53bd6a2..61337c7c 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -253,13 +253,11 @@ int usnic_ib_query_device(struct ib_device *ibdev,
 	struct usnic_ib_dev *us_ibdev = to_usdev(ibdev);
 	union ib_gid gid;
 	struct ethtool_drvinfo info;
-	struct ethtool_cmd cmd;
 	int qp_per_vf;
 
 	usnic_dbg("\n");
 	mutex_lock(&us_ibdev->usdev_lock);
 	us_ibdev->netdev->ethtool_ops->get_drvinfo(us_ibdev->netdev, &info);
-	us_ibdev->netdev->ethtool_ops->get_settings(us_ibdev->netdev, &cmd);
 	memset(props, 0, sizeof(*props));
 	usnic_mac_ip_to_gid(us_ibdev->ufdev->mac, us_ibdev->ufdev->inaddr,
 			&gid.raw[0]);
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 09/18] net: macvlan: use __ethtool_get_ksettings
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>

Signed-off-by: David Decotigny <decot@googlers.com>
---
 drivers/net/macvlan.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 1df38bd..ce934c3 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -925,12 +925,12 @@ static void macvlan_ethtool_get_drvinfo(struct net_device *dev,
 	strlcpy(drvinfo->version, "0.1", sizeof(drvinfo->version));
 }
 
-static int macvlan_ethtool_get_settings(struct net_device *dev,
-					struct ethtool_cmd *cmd)
+static int macvlan_ethtool_get_ksettings(struct net_device *dev,
+					 struct ethtool_ksettings *cmd)
 {
 	const struct macvlan_dev *vlan = netdev_priv(dev);
 
-	return __ethtool_get_settings(vlan->lowerdev, cmd);
+	return __ethtool_get_ksettings(vlan->lowerdev, cmd);
 }
 
 static netdev_features_t macvlan_fix_features(struct net_device *dev,
@@ -998,7 +998,7 @@ static void macvlan_dev_netpoll_cleanup(struct net_device *dev)
 
 static const struct ethtool_ops macvlan_ethtool_ops = {
 	.get_link		= ethtool_op_get_link,
-	.get_settings		= macvlan_ethtool_get_settings,
+	.get_ksettings		= macvlan_ethtool_get_ksettings,
 	.get_drvinfo		= macvlan_ethtool_get_drvinfo,
 };
 
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* [PATCH net-next v1 12/18] net: rdma: use __ethtool_get_ksettings
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>

Signed-off-by: David Decotigny <decot@googlers.com>
---
 include/rdma/ib_addr.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index ce55906..782bb8c 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -241,24 +241,22 @@ static inline enum ib_mtu iboe_get_mtu(int mtu)
 
 static inline int iboe_get_rate(struct net_device *dev)
 {
-	struct ethtool_cmd cmd;
-	u32 speed;
+	struct ethtool_ksettings cmd;
 	int err;
 
 	rtnl_lock();
-	err = __ethtool_get_settings(dev, &cmd);
+	err = __ethtool_get_ksettings(dev, &cmd);
 	rtnl_unlock();
 	if (err)
 		return IB_RATE_PORT_CURRENT;
 
-	speed = ethtool_cmd_speed(&cmd);
-	if (speed >= 40000)
+	if (cmd.parent.speed >= 40000)
 		return IB_RATE_40_GBPS;
-	else if (speed >= 30000)
+	else if (cmd.parent.speed >= 30000)
 		return IB_RATE_30_GBPS;
-	else if (speed >= 20000)
+	else if (cmd.parent.speed >= 20000)
 		return IB_RATE_20_GBPS;
-	else if (speed >= 10000)
+	else if (cmd.parent.speed >= 10000)
 		return IB_RATE_10_GBPS;
 	else
 		return IB_RATE_PORT_CURRENT;
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related

* linux-next: manual merge of the net-next tree with the net tree
From: Stephen Rothwell @ 2015-01-27  2:00 UTC (permalink / raw)
  To: David Miller, netdev; +Cc: linux-next, linux-kernel, Nimrod Andy

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]

Hi all,

Today's linux-next merge of the net-next tree got a conflict in
arch/arm/boot/dts/imx6sx-sdb.dts between commit 9143e398a443 ("ARM:
dts: imx6sx: correct i.MX6sx sdb board enet phy address") from the net
tree and commit fc8347778017 ("ARM: dts: imx6sx: correct i.MX6sx sdb
board enet phy address") from the net-next tree.

I fixed it up (according to the commit comments, the version from the
net tree is newer, so I used that) and can carry the fix as necessary
(no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* linux-next: manual merge of the net-next tree with the arm-soc tree
From: Stephen Rothwell @ 2015-01-27  2:04 UTC (permalink / raw)
  To: David Miller, netdev, Olof Johansson, Arnd Bergmann,
	linux-arm-kernel
  Cc: linux-next, linux-kernel, Roger Chen, Chris Zhong, Heiko Stuebner

[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]

Hi all,

Today's linux-next merge of the net-next tree got a conflict in
arch/arm/boot/dts/rk3288.dtsi between commit eecfe981cecd ("ARM: dts:
rockchip: add RK3288 suspend support") from the arm-soc tree and commit
3d3fb74afc9b ("ARM: dts: rockchip: add gmac info for rk3288") from the
net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc arch/arm/boot/dts/rk3288.dtsi
index 2a878a35facc,910dcad2088a..000000000000
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@@ -734,24 -741,11 +750,29 @@@
  			bias-disable;
  		};
  
+ 		pcfg_pull_none_12ma: pcfg-pull-none-12ma {
+ 			bias-disable;
+ 			drive-strength = <12>;
+ 		};
+ 
 +		sleep {
 +			global_pwroff: global-pwroff {
 +				rockchip,pins = <0 0 RK_FUNC_1 &pcfg_pull_none>;
 +			};
 +
 +			ddrio_pwroff: ddrio-pwroff {
 +				rockchip,pins = <0 1 RK_FUNC_1 &pcfg_pull_none>;
 +			};
 +
 +			ddr0_retention: ddr0-retention {
 +				rockchip,pins = <0 2 RK_FUNC_1 &pcfg_pull_up>;
 +			};
 +
 +			ddr1_retention: ddr1-retention {
 +				rockchip,pins = <0 3 RK_FUNC_1 &pcfg_pull_up>;
 +			};
 +		};
 +
  		i2c0 {
  			i2c0_xfer: i2c0-xfer {
  				rockchip,pins = <0 15 RK_FUNC_1 &pcfg_pull_none>,

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* RE: [PATCH net-next 1/1] net: phy: unbind phy device from generic and specifical driver
From: fugang.duan @ 2015-01-27  2:27 UTC (permalink / raw)
  To: Florian Fainelli, davem@davemloft.net
  Cc: netdev@vger.kernel.org, s.hauer@pengutronix.de,
	bhutchings@solarflare.com, stephen@networkplumber.org
In-Reply-To: <54C67D97.7080203@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com> Sent: Tuesday, January 27, 2015 1:47 AM
> To: Duan Fugang-B38611; davem@davemloft.net
> Cc: netdev@vger.kernel.org; s.hauer@pengutronix.de;
> bhutchings@solarflare.com; stephen@networkplumber.org
> Subject: Re: [PATCH net-next 1/1] net: phy: unbind phy device from
> generic and specifical driver
> 
> On 26/01/15 09:14, Florian Fainelli wrote:
> > On 26/01/15 00:14, Fugang Duan wrote:
> >> The current .phy_detach() function only unbind generic phy driver,
> >> which causes specifical driver suspend/resume function still work like
> Atheros AT803X PHYs.
> >>
> >> For example:
> >> ifconfig eth0 down
> >> echo mem > /sys/power/status
> >>
> >> After eth0 interface down, driver call phy_detach to unbind phy
> >> driver, and then do suspend/resume operation,
> >> at803x_suspend()/at803x_resume() functions still get called that call
> >> mdio bus read/write function. When eth0 interface down, MAC driver may
> close all clocks and mdio bus cannot work. So the issue happens.
> >
> > I was just hitting this problem on Friday evening and was about to
> > submit a similar change. Thanks!
> >
> >>
> >> The patch can unbind generic and specifical driver.
> >>
> >> Signed-off-by: Fugang Duan <B38611@freescale.com>
> >
> > Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> > Tested-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> Humm, this breaks a sequence of ifconfig down then up, the driver is
> removed, and we never get to probe it again, does this work for you using
> the FEC driver?
> 
It works fine for FEC driver with below flow case.
echo enabled > /sys/class/tty/ttymxc0/power/wakeup
echo mem > /sys/power/state
ifconfig eth0 down
echo mem > /sys/power/state
ifconfig eth0 up
ping 10.192.242.204 //ping work fine
echo mem > /sys/power/state
...


I know the reason, the first fec driver use Atheros 8031 ethernet special phy driver, like:
fec 2188000.ethernet eth0: Freescale FEC PHY driver [Atheros 8031 ethernet] (mii_bus:phy_addr=2188000.ethernet:01, irq=-1)

After down and up, fec use generic phy driver, but it still can work fine:
fec 2188000.ethernet eth0: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=2188000.ethernet:01, irq=-1)

After down and up, in here, phy driver only is initialized as generic phy driver.
int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
                      u32 flags, phy_interface_t interface)
{
	 ...
        /* Assume that if there is no driver, that it doesn't
         * exist, and we should use the genphy driver.
         */
        if (NULL == d->driver) {
                if (phydev->is_c45)
                        d->driver = &genphy_driver[GENPHY_DRV_10G].driver;
                else
                        d->driver = &genphy_driver[GENPHY_DRV_1G].driver;

                err = d->driver->probe(d);
                if (err >= 0)
                        err = device_bind_driver(d);

                if (err)
                        return err;
        }
	...
}

So, I suggest to use your patches set.

Regards,
Andy

^ permalink raw reply

* RE: [PATCH net-next 1/4] net: phy: utilize phy_suspend and phy_resume
From: fugang.duan @ 2015-01-27  2:42 UTC (permalink / raw)
  To: Florian Fainelli, netdev@vger.kernel.org
  Cc: davem@davemloft.net, s.hauer@pengutronix.de
In-Reply-To: <1422318673-9418-2-git-send-email-f.fainelli@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com> Sent: Tuesday, January 27, 2015 8:31 AM
> To: netdev@vger.kernel.org
> Cc: davem@davemloft.net; s.hauer@pengutronix.de; Duan Fugang-B38611;
> Florian Fainelli
> Subject: [PATCH net-next 1/4] net: phy: utilize phy_suspend and
> phy_resume
> 
> phy_suspend and phy_resume are an abstraction on top of the PHY device
> driver suspend and resume callbacks, utilize those since they are the
> proper interface to suspending and resuming a PHY device.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  drivers/net/phy/mdio_bus.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 50051f271b10..20447741893a 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -465,7 +465,6 @@ static bool mdio_bus_phy_may_suspend(struct
> phy_device *phydev)
> 
>  static int mdio_bus_suspend(struct device *dev)  {
> -	struct phy_driver *phydrv = to_phy_driver(dev->driver);
>  	struct phy_device *phydev = to_phy_device(dev);
> 
>  	/* We must stop the state machine manually, otherwise it stops out
> of @@ -479,19 +478,18 @@ static int mdio_bus_suspend(struct device *dev)
>  	if (!mdio_bus_phy_may_suspend(phydev))
>  		return 0;
> 
> -	return phydrv->suspend(phydev);
> +	return phy_suspend(phydev);
>  }
> 
>  static int mdio_bus_resume(struct device *dev)  {
> -	struct phy_driver *phydrv = to_phy_driver(dev->driver);
>  	struct phy_device *phydev = to_phy_device(dev);
>  	int ret;
> 
>  	if (!mdio_bus_phy_may_suspend(phydev))
>  		goto no_resume;
> 
> -	ret = phydrv->resume(phydev);
> +	ret = phy_resume(phydev);
>  	if (ret < 0)
>  		return ret;
> 
> --
> 2.1.0

Test on i.MX6q sabresd board, works fine.

Acked-by: Fugang Duan <B38611@freescale.com>
Tested-by: Fugang Duan <B38611@freescale.com>

^ permalink raw reply

* Re: [PATCH net-next v2 3/5] bonding: fix incorrect lacp mux state when agg not active
From: Jay Vosburgh @ 2015-01-27  2:42 UTC (permalink / raw)
  To: Jonathan Toppins
  Cc: Veaceslav Falico, Andy Gospodarek, netdev, Wilson Kok,
	Andy Gospodarek
In-Reply-To: <1422253021-3798-4-git-send-email-jtoppins@cumulusnetworks.com>

Jonathan Toppins <jtoppins@cumulusnetworks.com> wrote:

>From: Wilson Kok <wkok@cumulusnetworks.com>
>
>This patch attempts to fix the following problems when an actor or
>partner's aggregator is not active:
>    1. a slave's lacp port state is marked as AD_STATE_SYNCHRONIZATION
>       even if it is attached to an inactive aggregator. LACP advertises
>       this state to the partner, making the partner think he can move
>       into COLLECTING_DISTRIBUTING state even though this link will not
>       pass traffic on the local side
>
>    2. a slave goes into COLLECTING_DISTRIBUTING state without checking
>       if the aggregator is actually active
>
>    3. when in COLLECTING_DISTRIBUTING state, the partner parameters may
>       change, e.g. the partner_oper_port_state.SYNCHRONIZATION. The
>       local mux machine is not reacting to the change and continue to
>       keep the slave and bond up
>
>    4. When bond slave leaves an inactive aggregator and joins an active
>       aggregator, the actor oper port state need to update to SYNC state.

	This is a lot of subtle changes for one patch, and it's
difficult to read the patch and figure out which of the above points
corresponds to which code change(s).  I think this would have been
better as 2 or 3 patches, perhaps without the first blocks that merely
add debug statements.

	In general, though, I believe I understand the problems and the
solutions, and the solutions appear sound.

	For point 1, what it's doing is introducing an "ATTACHED-ish"
state, ultimately because the standard lacks the concept of "active" or
"inactive" aggregator.  From my reading, when the port transitions to
ATTACHED state, 5.4.15 "Mux machine" requires that it set SYNC at that
time.

	I understand why we would want to not enable SYNC for a port
that's a member of an aggregator that will not currently send or receive
traffic (is inactive in bonding-speak), but in my opinion we are
violating the standard and really should note that fact, and why we're
doing so, in the code.

	Point 2 is similar to point 1 (although here we're not
transitioning from ATTACHED to COLLECTING / COLLECTING_DISTRIBUTING
when the partner's SYNC is true); same comment applies.

	Points 3 and 4 look to be independent issues from points 1 and
2, and could be simple independent patches.

	-J


>v2:
> * fix style issues in bond_3ad.c
>
>Cc: Andy Gospodarek <gospo@cumulusnetworks.com>
>Reviewed-by: Nikolay Aleksandrov <nikolay@redhat.com>
>Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
>Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
>---
> drivers/net/bonding/bond_3ad.c |   44 +++++++++++++++++++++++++++++++---------
> 1 file changed, 34 insertions(+), 10 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>index 8baa87d..e3c96b2 100644
>--- a/drivers/net/bonding/bond_3ad.c
>+++ b/drivers/net/bonding/bond_3ad.c
>@@ -467,11 +467,14 @@ static void __record_pdu(struct lacpdu *lacpdu, struct port *port)
> 		/* set the partner sync. to on if the partner is sync,
> 		 * and the port is matched
> 		 */
>-		if ((port->sm_vars & AD_PORT_MATCHED)
>-		    && (lacpdu->actor_state & AD_STATE_SYNCHRONIZATION))
>+		if ((port->sm_vars & AD_PORT_MATCHED) &&
>+		    (lacpdu->actor_state & AD_STATE_SYNCHRONIZATION)) {
> 			partner->port_state |= AD_STATE_SYNCHRONIZATION;
>-		else
>+			pr_debug("%s partner sync=1\n", port->slave->dev->name);
>+		} else {
> 			partner->port_state &= ~AD_STATE_SYNCHRONIZATION;
>+			pr_debug("%s partner sync=0\n", port->slave->dev->name);
>+		}
> 	}
> }
> 
>@@ -726,6 +729,8 @@ static inline void __update_lacpdu_from_port(struct port *port)
> 	lacpdu->actor_port_priority = htons(port->actor_port_priority);
> 	lacpdu->actor_port = htons(port->actor_port_number);
> 	lacpdu->actor_state = port->actor_oper_port_state;
>+	pr_debug("update lacpdu: %s, actor port state %x\n",
>+		 port->slave->dev->name, port->actor_oper_port_state);
> 
> 	/* lacpdu->reserved_3_1              initialized
> 	 * lacpdu->tlv_type_partner_info     initialized
>@@ -898,7 +903,9 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
> 			if ((port->sm_vars & AD_PORT_SELECTED) &&
> 			    (port->partner_oper.port_state & AD_STATE_SYNCHRONIZATION) &&
> 			    !__check_agg_selection_timer(port)) {
>-				port->sm_mux_state = AD_MUX_COLLECTING_DISTRIBUTING;
>+				if (port->aggregator->is_active)
>+					port->sm_mux_state =
>+					    AD_MUX_COLLECTING_DISTRIBUTING;
> 			} else if (!(port->sm_vars & AD_PORT_SELECTED) ||
> 				   (port->sm_vars & AD_PORT_STANDBY)) {
> 				/* if UNSELECTED or STANDBY */
>@@ -910,12 +917,16 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
> 				 */
> 				__set_agg_ports_ready(port->aggregator, __agg_ports_are_ready(port->aggregator));
> 				port->sm_mux_state = AD_MUX_DETACHED;
>+			} else if (port->aggregator->is_active) {
>+				port->actor_oper_port_state |=
>+				    AD_STATE_SYNCHRONIZATION;
> 			}
> 			break;
> 		case AD_MUX_COLLECTING_DISTRIBUTING:
> 			if (!(port->sm_vars & AD_PORT_SELECTED) ||
> 			    (port->sm_vars & AD_PORT_STANDBY) ||
>-			    !(port->partner_oper.port_state & AD_STATE_SYNCHRONIZATION)) {
>+			    !(port->partner_oper.port_state & AD_STATE_SYNCHRONIZATION) ||
>+			    !(port->actor_oper_port_state & AD_STATE_SYNCHRONIZATION)) {
> 				port->sm_mux_state = AD_MUX_ATTACHED;
> 			} else {
> 				/* if port state hasn't changed make
>@@ -937,8 +948,10 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
> 
> 	/* check if the state machine was changed */
> 	if (port->sm_mux_state != last_state) {
>-		pr_debug("Mux Machine: Port=%d, Last State=%d, Curr State=%d\n",
>-			 port->actor_port_number, last_state,
>+		pr_debug("Mux Machine: Port=%d (%s), Last State=%d, Curr State=%d\n",
>+			 port->actor_port_number,
>+			 port->slave->dev->name,
>+			 last_state,
> 			 port->sm_mux_state);
> 		switch (port->sm_mux_state) {
> 		case AD_MUX_DETACHED:
>@@ -953,7 +966,12 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
> 			port->sm_mux_timer_counter = __ad_timer_to_ticks(AD_WAIT_WHILE_TIMER, 0);
> 			break;
> 		case AD_MUX_ATTACHED:
>-			port->actor_oper_port_state |= AD_STATE_SYNCHRONIZATION;
>+			if (port->aggregator->is_active)
>+				port->actor_oper_port_state |=
>+				    AD_STATE_SYNCHRONIZATION;
>+			else
>+				port->actor_oper_port_state &=
>+				    ~AD_STATE_SYNCHRONIZATION;
> 			port->actor_oper_port_state &= ~AD_STATE_COLLECTING;
> 			port->actor_oper_port_state &= ~AD_STATE_DISTRIBUTING;
> 			ad_disable_collecting_distributing(port,
>@@ -963,6 +981,7 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
> 		case AD_MUX_COLLECTING_DISTRIBUTING:
> 			port->actor_oper_port_state |= AD_STATE_COLLECTING;
> 			port->actor_oper_port_state |= AD_STATE_DISTRIBUTING;
>+			port->actor_oper_port_state |= AD_STATE_SYNCHRONIZATION;
> 			ad_enable_collecting_distributing(port,
> 							  update_slave_arr);
> 			port->ntt = true;
>@@ -1044,8 +1063,10 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
> 
> 	/* check if the State machine was changed or new lacpdu arrived */
> 	if ((port->sm_rx_state != last_state) || (lacpdu)) {
>-		pr_debug("Rx Machine: Port=%d, Last State=%d, Curr State=%d\n",
>-			 port->actor_port_number, last_state,
>+		pr_debug("Rx Machine: Port=%d (%s), Last State=%d, Curr State=%d\n",
>+			 port->actor_port_number,
>+			 port->slave->dev->name,
>+			 last_state,
> 			 port->sm_rx_state);
> 		switch (port->sm_rx_state) {
> 		case AD_RX_INITIALIZE:
>@@ -1394,6 +1415,9 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr)
> 
> 	aggregator = __get_first_agg(port);
> 	ad_agg_selection_logic(aggregator, update_slave_arr);
>+
>+	if (!port->aggregator->is_active)
>+		port->actor_oper_port_state &= ~AD_STATE_SYNCHRONIZATION;
> }
> 
> /* Decide if "agg" is a better choice for the new active aggregator that
>-- 
>1.7.10.4
>

---
	-Jay Vosburgh, jay.vosburgh@canonical.com

^ permalink raw reply

* Re: make allyesconfig i386 build failure with next-20150122 (caused by fb_agm1264k-fl driver)
From: Guenter Roeck @ 2015-01-27  2:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jim Davis, Stephen Rothwell, linux-next, linux-kernel, devel,
	isdn, netdev, Thomas Petazzoni
In-Reply-To: <20150126224654.GA17166@kroah.com>

On 01/26/2015 02:46 PM, Greg Kroah-Hartman wrote:
> On Mon, Jan 26, 2015 at 01:59:59PM -0800, Guenter Roeck wrote:
>> On Thu, Jan 22, 2015 at 12:10:33PM -0700, Jim Davis wrote:
>>> make ARCH=i386 allyesconfig fails with
>>>
>>> drivers/staging/built-in.o: In function `reset':
>>> (.text+0x2ae89d): multiple definition of `reset'
>>> drivers/isdn/built-in.o:(.text+0x185dc2): first defined here
>>> make[1]: *** [drivers/built-in.o] Error 1
>>
>> Culprit:
>>
>> commit b2ebd4be6fa1d2329b63531b044f9e25474981cb
>> Author: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> Date:   Wed Dec 31 10:11:10 2014 +0100
>>
>>      staging: fbtft: add fb_agm1264k-fl driver
>>
>> A global function named 'reset' isn't really a good idea.
>>
>> Not that the global function with the same name in the isdn code
>> is better ;-).
>
> Agreed, the fbtft code is now fixed.  Patches to fix the isdn code would
> be gladly accepted as well :)
>

Did you have a look into the isdn code ? It will need someone
with a lot of spare time to clean this code up.

Guenter

^ permalink raw reply

* RE: [PATCH net-next 3/4] net: phy: keep track of the PHY suspend state
From: fugang.duan @ 2015-01-27  2:43 UTC (permalink / raw)
  To: Florian Fainelli, netdev@vger.kernel.org
  Cc: davem@davemloft.net, s.hauer@pengutronix.de
In-Reply-To: <1422318673-9418-4-git-send-email-f.fainelli@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com> Sent: Tuesday, January 27, 2015 8:31 AM
> To: netdev@vger.kernel.org
> Cc: davem@davemloft.net; s.hauer@pengutronix.de; Duan Fugang-B38611;
> Florian Fainelli
> Subject: [PATCH net-next 3/4] net: phy: keep track of the PHY suspend
> state
> 
> In order to avoid double calls to phydev->drv->suspend and resume, keep
> track of whether the PHY has already been suspended as a consequence of a
> successful call to phy_suspend(). We will use this in our MDIO bus
> suspend/resume hooks to avoid a double suspend call.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  drivers/net/phy/phy_device.c | 22 ++++++++++++++++++----
>  include/linux/phy.h          |  2 ++
>  2 files changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 3fc91e89f5a5..c90cecc0fe15 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -699,6 +699,7 @@ int phy_suspend(struct phy_device *phydev)  {
>  	struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver);
>  	struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
> +	int ret = 0;
> 
>  	/* If the device has WOL enabled, we cannot suspend the PHY */
>  	phy_ethtool_get_wol(phydev, &wol);
> @@ -706,18 +707,31 @@ int phy_suspend(struct phy_device *phydev)
>  		return -EBUSY;
> 
>  	if (phydrv->suspend)
> -		return phydrv->suspend(phydev);
> -	return 0;
> +		ret = phydrv->suspend(phydev);
> +
> +	if (ret)
> +		return ret;
> +
> +	phydev->suspended = true;
> +
> +	return ret;
>  }
>  EXPORT_SYMBOL(phy_suspend);
> 
>  int phy_resume(struct phy_device *phydev)  {
>  	struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver);
> +	int ret;

=> int ret = 0;
[...]

Regards,
Andy

^ permalink raw reply

* Re: [PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
From: Ben Hutchings @ 2015-01-27  2:47 UTC (permalink / raw)
  To: Vladislav Yasevich; +Cc: netdev, edumazet, mst, virtualization
In-Reply-To: <1422283026-27832-2-git-send-email-vyasevic@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 1772 bytes --]

On Mon, 2015-01-26 at 09:37 -0500, Vladislav Yasevich wrote:
> If the IPv6 fragment id has not been set and we perform
> fragmentation due to UFO, select a new fragment id.
> When we store the fragment id into skb_shinfo, set the bit
> in the skb so we can re-use the selected id.
> This preserves the behavior of UFO packets generated on the
> host and solves the issue of id generation for packet sockets
> and tap/macvtap devices.
> 
> This patch moves ipv6_select_ident() back in to the header file.  
> It also provides the helper function that sets skb_shinfo() frag
> id and sets the bit.
> 
> It also makes sure that we select the fragment id when doing
> just gso validation, since it's possible for the packet to
> come from an untrusted source (VM) and be forwarded through
> a UFO enabled device which will expect the fragment id.
> 
> CC: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
> ---
>  include/linux/skbuff.h |  3 ++-
>  include/net/ipv6.h     |  2 ++
>  net/ipv6/ip6_output.c  |  4 ++--
>  net/ipv6/output_core.c |  9 ++++++++-
>  net/ipv6/udp_offload.c | 10 +++++++++-
>  5 files changed, 23 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 85ab7d7..3ad5203 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -605,7 +605,8 @@ struct sk_buff {
>  	__u8			ipvs_property:1;
>  	__u8			inner_protocol_type:1;
>  	__u8			remcsum_offload:1;
> -	/* 3 or 5 bit hole */
> +	__u8			ufo_fragid_set:1;
[...]

Doesn't the flag belong in struct skb_shared_info, rather than struct
sk_buff?  Otherwise this looks fine.

Ben.

-- 
Ben Hutchings
When in doubt, use brute force. - Ken Thompson

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply

* Re: [PATCH 3/3] Revert "drivers/net: Disable UFO through virtio"
From: Ben Hutchings @ 2015-01-27  2:51 UTC (permalink / raw)
  To: Vladislav Yasevich; +Cc: netdev, edumazet, mst, virtualization
In-Reply-To: <1422283026-27832-4-git-send-email-vyasevic@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 572 bytes --]

On Mon, 2015-01-26 at 09:37 -0500, Vladislav Yasevich wrote:
> This reverts commit 3d0ad09412ffe00c9afa201d01effdb6023d09b4.
> 
> Now that UFO functionality can correctly track the fragment
> id has been selected and select a fragment id if necessary,
> we can re-enable UFO on tap/macvap and virtio devices.
> 
> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
[...]

Acked-by: Ben Hutchings <ben@decadent.org.uk>

I think this is sensible even before your other patches.

Ben.

-- 
Ben Hutchings
When in doubt, use brute force. - Ken Thompson

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply

* Please let me know if you need to print color box, display box and labels
From: Jinghao Printing - CHINA @ 2015-01-27  2:58 UTC (permalink / raw)


Hi, this is David Wu from Shanghai, China.
Please let me know if you need color box, display box, corrugated box,
label, hang tag etc.

I will send you the website.

Best regards,
David Wu

^ permalink raw reply

* [PATCH ipsec-next] xfrm: Do not parse 32bits compiled xfrm netlink msg on 64bits host
From: Fan Du @ 2015-01-27  2:54 UTC (permalink / raw)
  To: steffen.klassert; +Cc: herbert, davem, netdev, fengyuleidian0615

structure like xfrm_usersa_info or xfrm_userpolicy_info
has different sizeof when compiled as 32bits and 64bits
due to not appending pack attribute in their definition.
This will result in broken SA and SP information when user
trying to configure them through netlink interface.

Inform user land about this situation instead of keeping
silent, the upper test scripts would behave accordingly.

Quotes from: http://marc.info/?l=linux-netdev&m=142226348715503&w=2
>
> Before a clean solution show up, I think it's better to warn user in some way
> like http://patchwork.ozlabs.org/patch/323842/ did. Otherwise, many people
> who stuck there will always spend time and try to fix this issue in whatever way.

Yes, this is the first thing we should do. I'm willing to accept a patch

Signed-off-by: Fan Du <fan.du@intel.com>
---
ChangeLog:
v2:
  - Rebase with latest tree

---
 net/xfrm/xfrm_user.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 8128594..f960bd9 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2419,6 +2419,11 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 	const struct xfrm_link *link;
 	int type, err;
 
+#ifdef CONFIG_COMPAT
+	if (is_compat_task())
+		return -EPERM;
+#endif
+
 	type = nlh->nlmsg_type;
 	if (type > XFRM_MSG_MAX)
 		return -EINVAL;
-- 
1.7.9.5

^ permalink raw reply related

* RE: [PATCH net-next 4/4] net: phy: avoid suspending twice a PHY
From: fugang.duan @ 2015-01-27  2:44 UTC (permalink / raw)
  To: Florian Fainelli, netdev@vger.kernel.org
  Cc: davem@davemloft.net, s.hauer@pengutronix.de
In-Reply-To: <1422318673-9418-5-git-send-email-f.fainelli@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com> Sent: Tuesday, January 27, 2015 8:31 AM
> To: netdev@vger.kernel.org
> Cc: davem@davemloft.net; s.hauer@pengutronix.de; Duan Fugang-B38611;
> Florian Fainelli
> Subject: [PATCH net-next 4/4] net: phy: avoid suspending twice a PHY
> 
> As part of a call to ndo_close() a netdevice driver may call
> phy_disconnect() -> phy_detach() -> phy_suspend(), such that the PHY is
> suspsended at this point and a netdevice driver may clock gate the
> backing peripheral providing MDIO bus accessses as well.
> 
> Update mdio_bus_phy_may_suspend() to return whether a PHY is allowed to
> be suspended and conversely resumed if and only if it was not previously
> suspended before while it is currently in detached (netdev pointer is
> NULL) state.
> 
> This fixes bus errors seen during S2/S3 suspend/resume cycles for
> netdevice drivers such as GENET which clock gates the entire Ethernet MAC,
> including the MDIO bus block.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  drivers/net/phy/mdio_bus.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 20447741893a..095ef3fe369a 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -443,9 +443,13 @@ static bool mdio_bus_phy_may_suspend(struct
> phy_device *phydev)
>  	if (!drv || !phydrv->suspend)
>  		return false;
> 
> -	/* PHY not attached? May suspend. */
> +	/* PHY not attached? May suspend if the PHY has not already been
> +	 * suspended as part of a prior call to phy_disconnect() ->
> +	 * phy_detach() -> phy_suspend() because the parent netdev might be
> the
> +	 * MDIO bus driver and clock gated at this point.
> +	 */
>  	if (!netdev)
> -		return true;
> +		return !phydev->suspended;
> 
>  	/* Don't suspend PHY if the attched netdev parent may wakeup.
>  	 * The parent may point to a PCI device, as in tg3 driver.
> --
> 2.1.0

Acked-by: Fugang Duan <B38611@freescale.com>
Tested-by: Fugang Duan <B38611@freescale.com>

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox