Author: arybchik
Date: Sat May 16 06:04:53 2015
New Revision: 283000
URL: https://svnweb.freebsd.org/changeset/base/283000

Log:
  sfxge: add local variable with changed capabilities mask
  
  It is required for the next patch which adds dependency of TSO
  capabilities from Tx checksum offloads.
  
  Reviewed by:    gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:      2 days
  Differential Revision: https://reviews.freebsd.org/D2553

Modified:
  head/sys/dev/sfxge/sfxge.c

Modified: head/sys/dev/sfxge/sfxge.c
==============================================================================
--- head/sys/dev/sfxge/sfxge.c  Sat May 16 05:59:25 2015        (r282999)
+++ head/sys/dev/sfxge/sfxge.c  Sat May 16 06:04:53 2015        (r283000)
@@ -258,26 +258,36 @@ sfxge_if_ioctl(struct ifnet *ifp, unsign
                        sfxge_mac_filter_set(sc);
                break;
        case SIOCSIFCAP:
+       {
+               int reqcap = ifr->ifr_reqcap;
+               int capchg_mask;
+
                SFXGE_ADAPTER_LOCK(sc);
 
+               /* Capabilities to be changed in accordance with request */
+               capchg_mask = ifp->if_capenable ^ reqcap;
+
                /*
                 * The networking core already rejects attempts to
                 * enable capabilities we don't have.  We still have
                 * to reject attempts to disable capabilities that we
                 * can't (yet) disable.
                 */
-               if (~ifr->ifr_reqcap & SFXGE_CAP_FIXED) {
+               KASSERT((reqcap & ~ifp->if_capabilities) == 0,
+                   ("Unsupported capabilities %x requested %x vs %x",
+                    reqcap & ~ifp->if_capabilities,
+                    reqcap , ifp->if_capabilities));
+               if (capchg_mask & SFXGE_CAP_FIXED) {
                        error = EINVAL;
                        SFXGE_ADAPTER_UNLOCK(sc);
                        break;
                }
 
-               ifp->if_capenable = ifr->ifr_reqcap;
-               if (ifp->if_capenable & IFCAP_TXCSUM)
+               if (reqcap & IFCAP_TXCSUM)
                        ifp->if_hwassist |= (CSUM_IP | CSUM_TCP | CSUM_UDP);
                else
                        ifp->if_hwassist &= ~(CSUM_IP | CSUM_TCP | CSUM_UDP);
-               if (ifp->if_capenable & IFCAP_TXCSUM_IPV6)
+               if (reqcap & IFCAP_TXCSUM_IPV6)
                        ifp->if_hwassist |= (CSUM_TCP_IPV6 | CSUM_UDP_IPV6);
                else
                        ifp->if_hwassist &= ~(CSUM_TCP_IPV6 | CSUM_UDP_IPV6);
@@ -290,8 +300,11 @@ sfxge_if_ioctl(struct ifnet *ifp, unsign
                 * but both bits are set in IPv4 and IPv6 mbufs.
                 */
 
+               ifp->if_capenable = reqcap;
+
                SFXGE_ADAPTER_UNLOCK(sc);
                break;
+       }
        case SIOCSIFMEDIA:
        case SIOCGIFMEDIA:
                error = ifmedia_ioctl(ifp, ifr, &sc->media, command);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to