All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv1] net: added support for 40GbE link.
@ 2012-06-27 13:56 Parav Pandit
  2012-06-27 16:03 ` Ben Hutchings
  0 siblings, 1 reply; 3+ messages in thread
From: Parav Pandit @ 2012-06-27 13:56 UTC (permalink / raw)
  To: netdev; +Cc: bhutchings, Parav Pandit

1. removed code replication for tov calculation for 1G, 10G and
made is common for speed > 1G (1G, 10G, 40G, 100G).
2. defines values for #4 different 40G Phys (KR4, LF4, SR4, CR4)

Signed-off-by: Parav Pandit <parav.pandit@emulex.com>
---
 include/linux/ethtool.h |    8 ++++++++
 net/packet/af_packet.c  |   18 ++++++------------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 297370a..21eff41 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -1153,6 +1153,10 @@ struct ethtool_ops {
 #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)
 
 /* Indicates what features are advertised by the interface. */
 #define ADVERTISED_10baseT_Half		(1 << 0)
@@ -1178,6 +1182,10 @@ struct ethtool_ops {
 #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)
 
 /* The following are all involved in forcing a particular link
  * mode for the device for setting things.  When getting the
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 8a10d5b..ceaca7c 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -531,6 +531,7 @@ static int prb_calc_retire_blk_tmo(struct packet_sock *po,
 	unsigned int mbits = 0, msec = 0, div = 0, tmo = 0;
 	struct ethtool_cmd ecmd;
 	int err;
+	u32 speed;
 
 	rtnl_lock();
 	dev = __dev_get_by_index(sock_net(&po->sk), po->ifindex);
@@ -539,25 +540,18 @@ static int prb_calc_retire_blk_tmo(struct packet_sock *po,
 		return DEFAULT_PRB_RETIRE_TOV;
 	}
 	err = __ethtool_get_settings(dev, &ecmd);
+	speed = ethtool_cmd_speed(&ecmd);
 	rtnl_unlock();
 	if (!err) {
-		switch (ecmd.speed) {
-		case SPEED_10000:
-			msec = 1;
-			div = 10000/1000;
-			break;
-		case SPEED_1000:
-			msec = 1;
-			div = 1000/1000;
-			break;
 		/*
 		 * If the link speed is so slow you don't really
 		 * need to worry about perf anyways
 		 */
-		case SPEED_100:
-		case SPEED_10:
-		default:
+		if (speed < SPEED_1000 || speed == SPEED_UNKNOWN) {
 			return DEFAULT_PRB_RETIRE_TOV;
+		} else {
+			msec = 1;
+			div = speed / 1000;
 		}
 	}
 
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCHv1] net: added support for 40GbE link.
  2012-06-27 13:56 [PATCHv1] net: added support for 40GbE link Parav Pandit
@ 2012-06-27 16:03 ` Ben Hutchings
  2012-06-27 22:42   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Hutchings @ 2012-06-27 16:03 UTC (permalink / raw)
  To: Parav Pandit; +Cc: netdev

On Wed, 2012-06-27 at 19:26 +0530, Parav Pandit wrote:
> 1. removed code replication for tov calculation for 1G, 10G and
> made is common for speed > 1G (1G, 10G, 40G, 100G).
> 2. defines values for #4 different 40G Phys (KR4, LF4, SR4, CR4)
> 
> Signed-off-by: Parav Pandit <parav.pandit@emulex.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv1] net: added support for 40GbE link.
  2012-06-27 16:03 ` Ben Hutchings
@ 2012-06-27 22:42   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-06-27 22:42 UTC (permalink / raw)
  To: bhutchings; +Cc: parav.pandit, netdev

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 27 Jun 2012 17:03:00 +0100

> On Wed, 2012-06-27 at 19:26 +0530, Parav Pandit wrote:
>> 1. removed code replication for tov calculation for 1G, 10G and
>> made is common for speed > 1G (1G, 10G, 40G, 100G).
>> 2. defines values for #4 different 40G Phys (KR4, LF4, SR4, CR4)
>> 
>> Signed-off-by: Parav Pandit <parav.pandit@emulex.com>
> Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-27 22:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-27 13:56 [PATCHv1] net: added support for 40GbE link Parav Pandit
2012-06-27 16:03 ` Ben Hutchings
2012-06-27 22:42   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.