aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/af_packet.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 8a10d5b3c832..ceaca7c134a0 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,
531 unsigned int mbits = 0, msec = 0, div = 0, tmo = 0; 531 unsigned int mbits = 0, msec = 0, div = 0, tmo = 0;
532 struct ethtool_cmd ecmd; 532 struct ethtool_cmd ecmd;
533 int err; 533 int err;
534 u32 speed;
534 535
535 rtnl_lock(); 536 rtnl_lock();
536 dev = __dev_get_by_index(sock_net(&po->sk), po->ifindex); 537 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,
539 return DEFAULT_PRB_RETIRE_TOV; 540 return DEFAULT_PRB_RETIRE_TOV;
540 } 541 }
541 err = __ethtool_get_settings(dev, &ecmd); 542 err = __ethtool_get_settings(dev, &ecmd);
543 speed = ethtool_cmd_speed(&ecmd);
542 rtnl_unlock(); 544 rtnl_unlock();
543 if (!err) { 545 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;
553 /* 546 /*
554 * If the link speed is so slow you don't really 547 * If the link speed is so slow you don't really
555 * need to worry about perf anyways 548 * need to worry about perf anyways
556 */ 549 */
557 case SPEED_100: 550 if (speed < SPEED_1000 || speed == SPEED_UNKNOWN) {
558 case SPEED_10:
559 default:
560 return DEFAULT_PRB_RETIRE_TOV; 551 return DEFAULT_PRB_RETIRE_TOV;
552 } else {
553 msec = 1;
554 div = speed / 1000;
561 } 555 }
562 } 556 }
563 557