summaryrefslogtreecommitdiffstats
path: root/sys/ofed
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2012-10-18 15:44:27 +0000
committerjhb <jhb@FreeBSD.org>2012-10-18 15:44:27 +0000
commit7ea1149f3592785c0999dfbb42e50da57b243284 (patch)
tree87979e2e1d46e9802bee5c8e709b1119ab2e67dc /sys/ofed
parent71b8b1e9de0f93ed16506c7a8dca0fc0bd5c940c (diff)
downloadFreeBSD-src-7ea1149f3592785c0999dfbb42e50da57b243284.zip
FreeBSD-src-7ea1149f3592785c0999dfbb42e50da57b243284.tar.gz
Take advantage of if_baudrate_pf and calculate an effective baud rate on
all platforms (not just amd64) to compute an equivalent IB rate.
Diffstat (limited to 'sys/ofed')
-rw-r--r--sys/ofed/include/rdma/ib_addr.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/ofed/include/rdma/ib_addr.h b/sys/ofed/include/rdma/ib_addr.h
index 0783abe..6a3790f 100644
--- a/sys/ofed/include/rdma/ib_addr.h
+++ b/sys/ofed/include/rdma/ib_addr.h
@@ -247,17 +247,21 @@ static inline int iboe_get_rate(struct net_device *dev)
#else
static inline int iboe_get_rate(struct net_device *dev)
{
-#ifdef __amd64__
- if (dev->if_baudrate >= IF_Gbps(40ULL))
+ uintmax_t baudrate;
+ int exp;
+
+ baudrate = dev->if_baudrate;
+ for (exp = dev->if_baudrate_pf; exp > 0; exp--)
+ baudrate *= 10;
+ if (baudrate >= IF_Gbps(40))
return IB_RATE_40_GBPS;
- else if (dev->if_baudrate >= IF_Gbps(30ULL))
+ else if (baudrate >= IF_Gbps(30))
return IB_RATE_30_GBPS;
- else if (dev->if_baudrate >= IF_Gbps(20ULL))
+ else if (baudrate >= IF_Gbps(20))
return IB_RATE_20_GBPS;
- else if (dev->if_baudrate >= IF_Gbps(10ULL))
+ else if (baudrate >= IF_Gbps(10))
return IB_RATE_10_GBPS;
else
-#endif
return IB_RATE_PORT_CURRENT;
}
#endif
OpenPOWER on IntegriCloud