ixgbe: cleanup move setting PFQDE.HIDE_VLAN to support function.
authorDon Skidmore <donald.c.skidmore@intel.com>
Wed, 5 Nov 2014 04:52:09 +0000 (04:52 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 11 Nov 2014 14:18:49 +0000 (06:18 -0800)
Move setting of drop enable to support function.  This not only makes the
code more readable but is also prep for following patches that add
additional MAC support.

Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

index 07d1c047d1c6c0eba2c588b11a0f97f1a8c78f51..0c25df5062473a6b3089348633f05858567800e4 100644 (file)
@@ -618,6 +618,27 @@ int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask)
        return 0;
 }
 
+static inline void ixgbe_write_qde(struct ixgbe_adapter *adapter, u32 vf,
+                                  u32 qde)
+{
+       struct ixgbe_hw *hw = &adapter->hw;
+       struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ];
+       u32 q_per_pool = __ALIGN_MASK(1, ~vmdq->mask);
+       int i;
+
+       for (i = vf * q_per_pool; i < ((vf + 1) * q_per_pool); i++) {
+               u32 reg;
+
+               /* flush previous write */
+               IXGBE_WRITE_FLUSH(hw);
+
+               /* indicate to hardware that we want to set drop enable */
+               reg = IXGBE_QDE_WRITE | IXGBE_QDE_ENABLE;
+               reg |= i <<  IXGBE_QDE_IDX_SHIFT;
+               IXGBE_WRITE_REG(hw, IXGBE_QDE, reg);
+       }
+}
+
 static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf)
 {
        struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ];
@@ -647,15 +668,7 @@ static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf)
        IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), reg);
 
        /* force drop enable for all VF Rx queues */
-       for (i = vf * q_per_pool; i < ((vf + 1) * q_per_pool); i++) {
-               /* flush previous write */
-               IXGBE_WRITE_FLUSH(hw);
-
-               /* indicate to hardware that we want to set drop enable */
-               reg = IXGBE_QDE_WRITE | IXGBE_QDE_ENABLE;
-               reg |= i <<  IXGBE_QDE_IDX_SHIFT;
-               IXGBE_WRITE_REG(hw, IXGBE_QDE, reg);
-       }
+       ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE);
 
        /* enable receive for vf */
        reg = IXGBE_READ_REG(hw, IXGBE_VFRE(reg_offset));