From nobody@FreeBSD.org  Mon Jul 30 04:07:20 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 3D5D9106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 30 Jul 2012 04:07:20 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 28CDA8FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 30 Jul 2012 04:07:20 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q6U47Ioh028315
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 30 Jul 2012 04:07:18 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q6U47ICo028314;
	Mon, 30 Jul 2012 04:07:18 GMT
	(envelope-from nobody)
Message-Id: <201207300407.q6U47ICo028314@red.freebsd.org>
Date: Mon, 30 Jul 2012 04:07:18 GMT
From: Rich Lowe <richlowe@richlowe.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: IXGBE_LE32_TO_CPUS is probably an unintentional no-op
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         170267
>Category:       kern
>Synopsis:       [ixgbe] IXGBE_LE32_TO_CPUS is probably an unintentional no-op
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-net
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 30 04:10:10 UTC 2012
>Closed-Date:    
>Last-Modified:  Mon Jul 30 04:51:47 UTC 2012
>Originator:     Rich Lowe
>Release:        CURRENT
>Organization:
>Environment:
>Description:
Fixing a bug in another system, using an ixgbe driver derived from yours,
I've happened upon the fact that IXGBE_LE32_TO_CPUS appears to be a no-op.

On FreeBSD, it's defined to be le32dec(), which is a pure function, however
the uses in ixgbe_common.c are as if it were side-effecting its argument:

  3964          /* Pull in the rest of the buffer (bi is where we left off)*/
  3965          for (; bi <= dword_len; bi++) {
  3966                  buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
  3967                  IXGBE_LE32_TO_CPUS(&buffer[bi]);
  3968          }
>How-To-Repeat:
Read through ixgbe_common.c and ixgbe_osdep.h.  I'm unsure if this causes
practical problems (I don't have a big-endian system with this board).
>Fix:
Guessing suggests that:
    buffer[bi] = IXGBE_LE32_TO_CPUS(buffer[bi]);

(there are two instances).

Is what was intended.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Jul 30 04:50:51 UTC 2012 
Responsible-Changed-Why:  

http://www.freebsd.org/cgi/query-pr.cgi?pr=170267 
>Unformatted:
