Date: Sat, 24 May 2014 02:28:10 GMT From: Rob Levandowski <robl@macwhiz.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/190160: slurm does not display interface speed for gigabit NICs Message-ID: <201405240228.s4O2SA9O015146@cgiserv.freebsd.org> Resent-Message-ID: <201405240230.s4O2U0ja040663@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 190160 >Category: ports >Synopsis: slurm does not display interface speed for gigabit NICs >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat May 24 02:30:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Rob Levandowski >Release: 9.1-RELEASE-p11 >Organization: >Environment: FreeBSD murphy.robl 9.1-RELEASE-p11 FreeBSD 9.1-RELEASE-p11 #0 r264309: Thu Apr 10 09:14:07 EDT 2014 root@murphy.robl:/usr/obj/usr/src/sys/DQ77MK-G530 amd64 >Description: Port net/slurm 0.3.3 does not display the interface speed correctly for at least some gigabit NICs (and, I suspect, all of them on FreeBSD). Specifically, I know it doesn't work for Intel gigabit NICs that use the em(4) driver. This appears to be due to dodgy bitwise math in the upstream code. However, I note that the website given for the upstream code no longer appears to be working, so I'm not sure that there IS an upstream maintainer any longer. >How-To-Repeat: Run slurm against a gigabit interface (e.g., "slurm -i em0"). The "Interface Speed:" will display as "unknown". >Fix: Patch the src/if_media.c file in the source distribution to use the IFM_TYPE and IFM_SUBTYPE macros on FreeBSD, instead of using bitmasks. See attached patch. (Note: I haven't researched to see what other UNIX variants supply these macros. For portability, and to future-proof the code against any future changes to the if_media options word, the macros should probably be used on as many systems as possible, instead of using hard-coded bitwise math.) Patch attached with submission follows: --- if_media.c.orig 2014-05-23 14:46:12.000000000 -0400 +++ if_media.c 2014-05-23 14:46:24.000000000 -0400 @@ -95,8 +95,13 @@ * */ +#if __FreeBSD__ >= 2 + type = IFM_TYPE(ifmr.ifm_active); + physical = IFM_SUBTYPE(ifmr.ifm_active); +#else type = ifmr.ifm_active & 0xf0; physical = ifmr.ifm_active & 0x0f; +#endif #ifdef MEDIADEBUG printf(" all: %6d\n", ifmr.ifm_current); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405240228.s4O2SA9O015146>