net/i40e: fix queue region DCB configure
[dpdk.git] / drivers / net / i40e / rte_pmd_i40e.c
index 3577eff..c49c872 100644 (file)
@@ -338,7 +338,7 @@ i40e_vsi_set_tx_loopback(struct i40e_vsi *vsi, uint8_t on)
        hw = I40E_VSI_TO_HW(vsi);
 
        /* Use the FW API if FW >= v5.0 */
-       if (hw->aq.fw_maj_ver < 5) {
+       if (hw->aq.fw_maj_ver < 5 && hw->mac.type != I40E_MAC_X722) {
                PMD_INIT_LOG(ERR, "FW < v5.0, cannot enable loopback");
                return -ENOTSUP;
        }
@@ -570,6 +570,49 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id,
        return 0;
 }
 
+static const struct ether_addr null_mac_addr;
+
+int
+rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id,
+       struct ether_addr *mac_addr)
+{
+       struct rte_eth_dev *dev;
+       struct i40e_pf_vf *vf;
+       struct i40e_vsi *vsi;
+       struct i40e_pf *pf;
+
+       if (i40e_validate_mac_addr((u8 *)mac_addr) != I40E_SUCCESS)
+               return -EINVAL;
+
+       RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+       dev = &rte_eth_devices[port];
+
+       if (!is_i40e_supported(dev))
+               return -ENOTSUP;
+
+       pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+       if (vf_id >= pf->vf_num || !pf->vfs)
+               return -EINVAL;
+
+       vf = &pf->vfs[vf_id];
+       vsi = vf->vsi;
+       if (!vsi) {
+               PMD_DRV_LOG(ERR, "Invalid VSI.");
+               return -EINVAL;
+       }
+
+       if (is_same_ether_addr(mac_addr, &vf->mac_addr))
+               /* Reset the mac with NULL address */
+               ether_addr_copy(&null_mac_addr, &vf->mac_addr);
+
+       /* Remove the mac */
+       i40e_vsi_delete_mac(vsi, mac_addr);
+
+       return 0;
+}
+
 /* Set vlan strip on/off for specific VF from host */
 int
 rte_pmd_i40e_set_vf_vlan_stripq(uint16_t port, uint16_t vf_id, uint8_t on)
@@ -1610,8 +1653,6 @@ rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff,
                return -EINVAL;
        }
 
-       i40e_update_customized_info(dev, buff, size);
-
        /* Find metadata segment */
        metadata_seg_hdr = i40e_find_segment_in_package(SEGMENT_TYPE_METADATA,
                                                        pkg_hdr);
@@ -1668,6 +1709,7 @@ rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff,
                                PMD_DRV_LOG(ERR, "Profile of group 0 already exists.");
                        else if (is_exist == 3)
                                PMD_DRV_LOG(ERR, "Profile of different group already exists");
+                       i40e_update_customized_info(dev, buff, size, op);
                        rte_free(profile_info_sec);
                        return -EEXIST;
                }
@@ -1715,6 +1757,10 @@ rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff,
                }
        }
 
+       if (op == RTE_PMD_I40E_PKG_OP_WR_ADD ||
+           op == RTE_PMD_I40E_PKG_OP_WR_DEL)
+               i40e_update_customized_info(dev, buff, size, op);
+
        rte_free(profile_info_sec);
        return status;
 }
@@ -2772,13 +2818,23 @@ i40e_queue_region_dcb_configure(struct i40e_hw *hw,
        struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
        int32_t ret = -EINVAL;
        uint16_t i, j, prio_index, region_index;
-       uint8_t tc_map, tc_bw, bw_lf;
+       uint8_t tc_map, tc_bw, bw_lf, dcb_flag = 0;
 
        if (!info->queue_region_number) {
                PMD_DRV_LOG(ERR, "No queue region been set before");
                return ret;
        }
 
+       for (i = 0; i < info->queue_region_number; i++) {
+               if (info->region[i].user_priority_num) {
+                       dcb_flag = 1;
+                       break;
+               }
+       }
+
+       if (dcb_flag == 0)
+               return 0;
+
        dcb_cfg = &dcb_cfg_local;
        memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
 
@@ -3101,10 +3157,6 @@ rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
                return -ENOTSUP;
        }
 
-       /* Clear mask first */
-       for (i = 0; i < 2; i++)
-               i40e_check_write_reg(hw, I40E_GLQF_FD_MSK(i, pctype), 0);
-
        inset_reg = inset->inset;
        for (i = 0; i < 2; i++)
                mask_reg[i] = (inset->mask[i].field_idx << 16) |
@@ -3121,8 +3173,6 @@ rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
                        i40e_check_write_global_reg(hw,
                                                  I40E_GLQF_HASH_MSK(i, pctype),
                                                  mask_reg[i]);
-               i40e_global_cfg_warning(I40E_WARNING_HASH_INSET);
-               i40e_global_cfg_warning(I40E_WARNING_HASH_MSK);
                break;
        case INSET_FDIR:
                i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 0),
@@ -3134,7 +3184,6 @@ rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
                        i40e_check_write_global_reg(hw,
                                                    I40E_GLQF_FD_MSK(i, pctype),
                                                    mask_reg[i]);
-               i40e_global_cfg_warning(I40E_WARNING_FD_MSK);
                break;
        case INSET_FDIR_FLX:
                i40e_check_write_reg(hw, I40E_PRTQF_FD_FLXINSET(pctype),