diff options
author | Or Gerlitz | 2012-02-28 18:49:50 +0200 |
---|---|---|
committer | Roland Dreier | 2012-03-05 09:25:16 -0800 |
commit | 2e96691c31ecf749f48aa94ea837b95dd656f5c2 (patch) | |
tree | 5e2bfaf522d66bc23c1ec0490fb3364c09aad4f2 /drivers/infiniband/core | |
parent | e9319b0cb00d4d68792fdae37e81e316cb632cb9 (diff) |
IB: Use central enum for speed instead of hard-coded values
The kernel IB stack uses one enumeration for IB speed, which wasn't
explicitly specified in the verbs header file. Add that enum, and use
it all over the code.
The IB speed/width notation is also used by iWARP and IBoE HW drivers,
which use the convention of rate = speed * width to advertise their
port link rate.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/sysfs.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index a860b6ddbb61..83b720ef6c34 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -187,27 +187,26 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, return ret; switch (attr.active_speed) { - case 1: - /* SDR */ + case IB_SPEED_SDR: rate = 25; break; - case 2: + case IB_SPEED_DDR: speed = " DDR"; rate = 50; break; - case 4: + case IB_SPEED_QDR: speed = " QDR"; rate = 100; break; - case 8: + case IB_SPEED_FDR10: speed = " FDR10"; rate = 100; break; - case 16: + case IB_SPEED_FDR: speed = " FDR"; rate = 140; break; - case 32: + case IB_SPEED_EDR: speed = " EDR"; rate = 250; break; |