Date: Wed, 12 Sep 2018 10:53:22 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r338615 - stable/10/sys/ofed/drivers/infiniband/core Message-ID: <201809121053.w8CArM0v099485@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Wed Sep 12 10:53:22 2018 New Revision: 338615 URL: https://svnweb.freebsd.org/changeset/base/338615 Log: Fix incorrect display of the sys.class.infiniband.xxx.ports.1.rate sysctl entry in ibcore by adding support for new rate types. This is a direct commit. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/core/sysfs.c Modified: stable/10/sys/ofed/drivers/infiniband/core/sysfs.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/core/sysfs.c Wed Sep 12 10:27:58 2018 (r338614) +++ stable/10/sys/ofed/drivers/infiniband/core/sysfs.c Wed Sep 12 10:53:22 2018 (r338615) @@ -180,7 +180,7 @@ static ssize_t rate_show(struct ib_port *p, struct por { struct ib_port_attr attr; char *speed = ""; - int rate; + int rate; /* in deci-Gb/sec */ ssize_t ret; ret = ib_query_port(p->ibdev, p->port_num, &attr); @@ -188,11 +188,33 @@ static ssize_t rate_show(struct ib_port *p, struct por return ret; switch (attr.active_speed) { - case 2: speed = " DDR"; break; - case 4: speed = " QDR"; break; + case IB_SPEED_DDR: + speed = " DDR"; + rate = 50; + break; + case IB_SPEED_QDR: + speed = " QDR"; + rate = 100; + break; + case IB_SPEED_FDR10: + speed = " FDR10"; + rate = 100; + break; + case IB_SPEED_FDR: + speed = " FDR"; + rate = 140; + break; + case IB_SPEED_EDR: + speed = " EDR"; + rate = 250; + break; + case IB_SPEED_SDR: + default: /* default to SDR for invalid rates */ + rate = 25; + break; } - rate = 25 * ib_width_enum_to_int(attr.active_width) * attr.active_speed; + rate *= ib_width_enum_to_int(attr.active_width); if (rate < 0) return -EINVAL;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809121053.w8CArM0v099485>