Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Dec 2015 21:35:24 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-net@FreeBSD.org
Subject:   [Bug 205264] XOR logic error in ixgb(4)
Message-ID:  <bug-205264-2472-IHMPNIcOIX@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-205264-2472@https.bugs.freebsd.org/bugzilla/>
References:  <bug-205264-2472@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205264

Don Lewis <truckman@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |truckman@FreeBSD.org

--- Comment #1 from Don Lewis <truckman@FreeBSD.org> ---
IFCAP_HWCSUM is defined as (IFCAP_RXCSUM | IFCAP_TXCSUM), so this code:

    case SIOCSIFCAP:
        IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFCAP (Set Capabilities)");
        mask = ifr->ifr_reqcap ^ ifp->if_capenable;
        [snip]
        if (mask & IFCAP_HWCSUM) {
            if (IFCAP_HWCSUM & ifp->if_capenable)
                ifp->if_capenable &= ~IFCAP_HWCSUM;
            else
                ifp->if_capenable |= IFCAP_HWCSUM;
            if (ifp->if_drv_flags & IFF_DRV_RUNNING)
                ixgb_init(adapter);
        }

will set both bits even if the request only specifies one bit, and it
will clear both bits even if the request only wants to clear one bit.

Replacing the inner if/else block with this should fix the problem:

            ifp->if_capenable ^= (mask & IFCAP_HWCSUM);

or alternatively:

            ifp->if_capenable = (ifr->ifr_reqcap & IFCAP_HWCSUM) |
                (ifp->if_capenable & ~IFCAP_HWCSUM);

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-205264-2472-IHMPNIcOIX>