ixgbe: Only enable anti-spoof on VF pools
authorAlexander Duyck <alexander.h.duyck@intel.com>
Sat, 5 May 2012 05:32:58 +0000 (05:32 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 20 Jul 2012 01:20:23 +0000 (18:20 -0700)
The current logic is enabling anti-spoof on all pools and then clearing
anti-spoof on just the first PF pool.  The correct approach is to only set
anti-spoof on the VF pools and to leave all of the PF pools unchecked.

This allows for items such as FCoE to use adjacent pools within the PF for
transmit and receive queues without the traffic being blocked by this
security feature.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c

index bbe9d45..90e41db 100644 (file)
@@ -3225,20 +3225,22 @@ void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int pf)
         * PFVFSPOOF register array is size 8 with 8 bits assigned to
         * MAC anti-spoof enables in each register array element.
         */
-       for (j = 0; j < IXGBE_PFVFSPOOF_REG_COUNT; j++)
+       for (j = 0; j < pf_target_reg; j++)
                IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), pfvfspoof);
 
-       /* If not enabling anti-spoofing then done */
-       if (!enable)
-               return;
-
        /*
         * The PF should be allowed to spoof so that it can support
-        * emulation mode NICs.  Reset the bit assigned to the PF
+        * emulation mode NICs.  Do not set the bits assigned to the PF
+        */
+       pfvfspoof &= (1 << pf_target_shift) - 1;
+       IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), pfvfspoof);
+
+       /*
+        * Remaining pools belong to the PF so they do not need to have
+        * anti-spoofing enabled.
         */
-       pfvfspoof = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(pf_target_reg));
-       pfvfspoof ^= (1 << pf_target_shift);
-       IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(pf_target_reg), pfvfspoof);
+       for (j++; j < IXGBE_PFVFSPOOF_REG_COUNT; j++)
+               IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), 0);
 }
 
 /**