From owner-freebsd-ports-bugs@FreeBSD.ORG Sat May 24 02:30:00 2014 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AD949EF4 for ; Sat, 24 May 2014 02:30:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A6022DA0 for ; Sat, 24 May 2014 02:30:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s4O2U08v040664 for ; Sat, 24 May 2014 02:30:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s4O2U0ja040663; Sat, 24 May 2014 02:30:00 GMT (envelope-from gnats) Resent-Date: Sat, 24 May 2014 02:30:00 GMT Resent-Message-Id: <201405240230.s4O2U0ja040663@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Rob Levandowski Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7B951EE0 for ; Sat, 24 May 2014 02:28:10 +0000 (UTC) Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68A5B2D93 for ; Sat, 24 May 2014 02:28:10 +0000 (UTC) Received: from cgiserv.freebsd.org ([127.0.1.6]) by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s4O2SAFX015151 for ; Sat, 24 May 2014 02:28:10 GMT (envelope-from nobody@cgiserv.freebsd.org) Received: (from nobody@localhost) by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s4O2SA9O015146; Sat, 24 May 2014 02:28:10 GMT (envelope-from nobody) Message-Id: <201405240228.s4O2SA9O015146@cgiserv.freebsd.org> Date: Sat, 24 May 2014 02:28:10 GMT From: Rob Levandowski To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/190160: slurm does not display interface speed for gigabit NICs X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 May 2014 02:30:00 -0000 >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: