Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314672
b: refs/heads/master
c: e440cf2
h: refs/heads/master
v: v3
  • Loading branch information
parav.pandit@emulex.com authored and David S. Miller committed Jun 27, 2012
1 parent 20d6fae commit 794cac3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 22911fc581f6a241e2897a7a8603e97344a6ec82
refs/heads/master: e440cf2ca0a1b075c64016240d46c3aa9d877bbf
8 changes: 8 additions & 0 deletions trunk/include/linux/ethtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
18 changes: 6 additions & 12 deletions trunk/net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
}

Expand Down

0 comments on commit 794cac3

Please sign in to comment.