Skip to content

Commit e440cf2

Browse files
parav.pandit@emulex.comdavem330
authored andcommitted
net: added support for 40GbE link.
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 <[email protected]> Reviewed-by: Ben Hutchings <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 22911fc commit e440cf2

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

include/linux/ethtool.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,10 @@ struct ethtool_ops {
11531153
#define SUPPORTED_10000baseR_FEC (1 << 20)
11541154
#define SUPPORTED_20000baseMLD2_Full (1 << 21)
11551155
#define SUPPORTED_20000baseKR2_Full (1 << 22)
1156+
#define SUPPORTED_40000baseKR4_Full (1 << 23)
1157+
#define SUPPORTED_40000baseCR4_Full (1 << 24)
1158+
#define SUPPORTED_40000baseSR4_Full (1 << 25)
1159+
#define SUPPORTED_40000baseLR4_Full (1 << 26)
11561160

11571161
/* Indicates what features are advertised by the interface. */
11581162
#define ADVERTISED_10baseT_Half (1 << 0)
@@ -1178,6 +1182,10 @@ struct ethtool_ops {
11781182
#define ADVERTISED_10000baseR_FEC (1 << 20)
11791183
#define ADVERTISED_20000baseMLD2_Full (1 << 21)
11801184
#define ADVERTISED_20000baseKR2_Full (1 << 22)
1185+
#define ADVERTISED_40000baseKR4_Full (1 << 23)
1186+
#define ADVERTISED_40000baseCR4_Full (1 << 24)
1187+
#define ADVERTISED_40000baseSR4_Full (1 << 25)
1188+
#define ADVERTISED_40000baseLR4_Full (1 << 26)
11811189

11821190
/* The following are all involved in forcing a particular link
11831191
* mode for the device for setting things. When getting the

net/packet/af_packet.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ static int prb_calc_retire_blk_tmo(struct packet_sock *po,
531531
unsigned int mbits = 0, msec = 0, div = 0, tmo = 0;
532532
struct ethtool_cmd ecmd;
533533
int err;
534+
u32 speed;
534535

535536
rtnl_lock();
536537
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,
539540
return DEFAULT_PRB_RETIRE_TOV;
540541
}
541542
err = __ethtool_get_settings(dev, &ecmd);
543+
speed = ethtool_cmd_speed(&ecmd);
542544
rtnl_unlock();
543545
if (!err) {
544-
switch (ecmd.speed) {
545-
case SPEED_10000:
546-
msec = 1;
547-
div = 10000/1000;
548-
break;
549-
case SPEED_1000:
550-
msec = 1;
551-
div = 1000/1000;
552-
break;
553546
/*
554547
* If the link speed is so slow you don't really
555548
* need to worry about perf anyways
556549
*/
557-
case SPEED_100:
558-
case SPEED_10:
559-
default:
550+
if (speed < SPEED_1000 || speed == SPEED_UNKNOWN) {
560551
return DEFAULT_PRB_RETIRE_TOV;
552+
} else {
553+
msec = 1;
554+
div = speed / 1000;
561555
}
562556
}
563557

0 commit comments

Comments
 (0)