net/fm10k/base: use different name for override bit
[dpdk.git] / drivers / net / fm10k / base / fm10k_pf.c
index a1469aa..878d46e 100644 (file)
@@ -216,6 +216,7 @@ STATIC s32 fm10k_init_hw_pf(struct fm10k_hw *hw)
        return FM10K_SUCCESS;
 }
 
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 /**
  *  fm10k_is_slot_appropriate_pf - Indicate appropriate slot for this SKU
  *  @hw: pointer to hardware structure
@@ -231,6 +232,7 @@ STATIC bool fm10k_is_slot_appropriate_pf(struct fm10k_hw *hw)
               (hw->bus.width == hw->bus_caps.width);
 }
 
+#endif
 /**
  *  fm10k_update_vlan_pf - Update status of VLAN ID in VLAN filter table
  *  @hw: pointer to hardware structure
@@ -253,8 +255,8 @@ STATIC s32 fm10k_update_vlan_pf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set)
 
        /* VLAN multi-bit write:
         * The multi-bit write has several parts to it.
-        *    3                   2                   1                   0
-        *  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+        *               24              16               8               0
+        *  7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
         * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         * | RSVD0 |         Length        |C|RSVD0|        VLAN ID        |
         * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -534,6 +536,10 @@ STATIC s32 fm10k_update_lport_state_pf(struct fm10k_hw *hw, u16 glort,
        if (!fm10k_glort_valid_pf(hw, glort))
                return FM10K_ERR_PARAM;
 
+       /* reset multicast mode if deleting lport */
+       if (!enable)
+               fm10k_update_xcast_mode_pf(hw, glort, FM10K_XCAST_MODE_NONE);
+
        /* construct the lport message from the 2 pieces of data we have */
        lport_msg = ((u32)count << 16) | glort;
 
@@ -757,8 +763,8 @@ STATIC s32 fm10k_iov_assign_resources_pf(struct fm10k_hw *hw, u16 num_vfs,
                                        FM10K_RXDCTL_WRITE_BACK_MIN_DELAY |
                                        FM10K_RXDCTL_DROP_ON_EMPTY);
                        FM10K_WRITE_REG(hw, FM10K_RXQCTL(vf_q_idx),
-                                       FM10K_RXQCTL_VF |
-                                       (i << FM10K_RXQCTL_VF_SHIFT));
+                                       (i << FM10K_RXQCTL_VF_SHIFT) |
+                                       FM10K_RXQCTL_VF);
 
                        /* map queue pair to VF */
                        FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), vf_q_idx);
@@ -906,13 +912,13 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
        vf_q_idx = fm10k_vf_queue_index(hw, vf_idx);
        qmap_idx = qmap_stride * vf_idx;
 
-       /* MAP Tx queue back to 0 temporarily, and disable it */
-       FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), 0);
-       FM10K_WRITE_REG(hw, FM10K_TXDCTL(vf_q_idx), 0);
-
-       /* determine correct default VLAN ID */
+       /* Determine correct default VLAN ID. The FM10K_VLAN_OVERRIDE bit is
+        * used here to indicate to the VF that it will not have privilege to
+        * write VLAN_TABLE. All policy is enforced on the PF but this allows
+        * the VF to correctly report errors to userspace rqeuests.
+        */
        if (vf_info->pf_vid)
-               vf_vid = vf_info->pf_vid | FM10K_VLAN_CLEAR;
+               vf_vid = vf_info->pf_vid | FM10K_VLAN_OVERRIDE;
        else
                vf_vid = vf_info->sw_vid;
 
@@ -968,7 +974,7 @@ err_out:
        txqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
                  FM10K_TXQCTL_VF | vf_idx;
 
-       /* assign VID */
+       /* assign VLAN ID */
        for (i = 0; i < queues_per_pool; i++)
                FM10K_WRITE_REG(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);
 
@@ -1033,7 +1039,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
        txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) |
                 (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
                 FM10K_TXQCTL_VF | vf_idx;
-       rxqctl = FM10K_RXQCTL_VF | (vf_idx << FM10K_RXQCTL_VF_SHIFT);
+       rxqctl = (vf_idx << FM10K_RXQCTL_VF_SHIFT) | FM10K_RXQCTL_VF;
 
        /* stop further DMA and reset queue ownership back to VF */
        for (i = vf_q_idx; i < (queues_per_pool + vf_q_idx); i++) {
@@ -1103,7 +1109,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
                FM10K_WRITE_REG(hw, FM10K_RQMAP(qmap_idx + i), vf_q_idx + i);
        }
 
-       /* repeat the first ring for all of the remaining VF rings */
+       /* repeat the first ring for all the remaining VF rings */
        for (i = queues_per_pool; i < qmap_stride; i++) {
                FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx + i), vf_q_idx);
                FM10K_WRITE_REG(hw, FM10K_RQMAP(qmap_idx + i), vf_q_idx);
@@ -1213,12 +1219,12 @@ s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *hw, u32 **results,
 }
 
 /**
- * fm10k_iov_select_vid - Select correct default vid
+ * fm10k_iov_select_vid - Select correct default VLAN ID
  * @hw: Pointer to hardware structure
- * @vid: vid to correct
+ * @vid: VLAN ID to correct
  *
- * Will report an error if vid is out of range. For vid = 0, it will return
- * either the pf_vid or sw_vid depending on which one is set.
+ * Will report an error if the VLAN ID is out of range. For VID = 0, it will
+ * return either the pf_vid or sw_vid depending on which one is set.
  */
 STATIC s32 fm10k_iov_select_vid(struct fm10k_vf_info *vf_info, u16 vid)
 {
@@ -1244,9 +1250,9 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
                              struct fm10k_mbx_info *mbx)
 {
        struct fm10k_vf_info *vf_info = (struct fm10k_vf_info *)mbx;
-       int err = FM10K_SUCCESS;
        u8 mac[ETH_ALEN];
        u32 *result;
+       int err = FM10K_SUCCESS;
        bool set;
        u16 vlan;
        u32 vid;
@@ -1425,10 +1431,10 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
                        err = fm10k_update_lport_state_pf(hw, vf_info->glort,
                                                          1, false);
 
-               /* need to clear VF_FLAG_ENABLED in order to ensure that we
-                * actually re-enable the lport state below. Note that this
-                * has no impact if VF is already disabled, as the flags are
-                * already zeroed.
+               /* we need to clear VF_FLAG_ENABLED flags in order to ensure
+                * that we actually re-enable the LPORT state below. Note that
+                * this has no impact if the VF is already disabled, as the
+                * flags are already cleared.
                 */
                if (!err)
                        vf_info->vf_flags = FM10K_VF_FLAG_CAPABLE(vf_info);
@@ -1699,6 +1705,8 @@ out:
 
 /* This structure defines the attibutes to be parsed below */
 const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[] = {
+       FM10K_TLV_ATTR_LE_STRUCT(FM10K_PF_ATTR_ID_ERR,
+                                sizeof(struct fm10k_swapi_error)),
        FM10K_TLV_ATTR_U32(FM10K_PF_ATTR_ID_LPORT_MAP),
        FM10K_TLV_ATTR_LAST
 };
@@ -1781,7 +1789,7 @@ static s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *hw, u32 **results,
        if (!fm10k_glort_valid_pf(hw, glort))
                return FM10K_ERR_PARAM;
 
-       /* verify VID is valid */
+       /* verify VLAN ID is valid */
        if (pvid >= FM10K_VLAN_TABLE_VID_MAX)
                return FM10K_ERR_PARAM;
 
@@ -2064,7 +2072,9 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw)
        mac->ops.init_hw = &fm10k_init_hw_pf;
        mac->ops.start_hw = &fm10k_start_hw_generic;
        mac->ops.stop_hw = &fm10k_stop_hw_generic;
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
        mac->ops.is_slot_appropriate = &fm10k_is_slot_appropriate_pf;
+#endif
        mac->ops.update_vlan = &fm10k_update_vlan_pf;
        mac->ops.read_mac_addr = &fm10k_read_mac_addr_pf;
        mac->ops.update_uc_addr = &fm10k_update_uc_addr_pf;