Date: Thu, 18 Oct 2012 15:44:27 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241697 - head/sys/ofed/include/rdma Message-ID: <201210181544.q9IFiRkZ069559@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Thu Oct 18 15:44:27 2012 New Revision: 241697 URL: http://svn.freebsd.org/changeset/base/241697 Log: Take advantage of if_baudrate_pf and calculate an effective baud rate on all platforms (not just amd64) to compute an equivalent IB rate. Modified: head/sys/ofed/include/rdma/ib_addr.h Modified: head/sys/ofed/include/rdma/ib_addr.h ============================================================================== --- head/sys/ofed/include/rdma/ib_addr.h Thu Oct 18 15:43:19 2012 (r241696) +++ head/sys/ofed/include/rdma/ib_addr.h Thu Oct 18 15:44:27 2012 (r241697) @@ -247,17 +247,21 @@ static inline int iboe_get_rate(struct n #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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210181544.q9IFiRkZ069559>