net/cnxk: enable VLAN processing in vector Tx
[dpdk.git] / drivers / net / hns3 / hns3_dcb.c
index bea4115..90c0d04 100644 (file)
@@ -1543,7 +1543,8 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)
        enum hns3_fc_status fc_status = hw->current_fc_status;
        enum hns3_fc_mode requested_fc_mode = hw->requested_fc_mode;
        uint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map;
-       int ret, status;
+       uint8_t pfc_en = hw->dcb_info.pfc_en;
+       int ret;
 
        if (pf->tx_sch_mode != HNS3_FLAG_TC_BASE_SCH_MODE &&
            pf->tx_sch_mode != HNS3_FLAG_VNET_BASE_SCH_MODE)
@@ -1568,7 +1569,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)
 
                ret = hns3_buffer_alloc(hw);
                if (ret)
-                       return ret;
+                       goto buffer_alloc_fail;
 
                hw->current_fc_status = HNS3_FC_STATUS_PFC;
                hw->requested_fc_mode = HNS3_FC_FULL;
@@ -1594,10 +1595,10 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)
 pfc_setup_fail:
        hw->requested_fc_mode = requested_fc_mode;
        hw->current_fc_status = fc_status;
+
+buffer_alloc_fail:
+       hw->dcb_info.pfc_en = pfc_en;
        hw->dcb_info.hw_pfc_map = hw_pfc_map;
-       status = hns3_buffer_alloc(hw);
-       if (status)
-               hns3_err(hw, "recover packet buffer fail! status = %d", status);
 
        return ret;
 }
@@ -1616,8 +1617,7 @@ hns3_dcb_configure(struct hns3_adapter *hns)
        int ret;
 
        hns3_dcb_cfg_validate(hns, &num_tc, &map_changed);
-       if (map_changed ||
-           __atomic_load_n(&hw->reset.resetting,  __ATOMIC_RELAXED)) {
+       if (map_changed) {
                ret = hns3_dcb_info_update(hns, num_tc);
                if (ret) {
                        hns3_err(hw, "dcb info update failed: %d", ret);
@@ -1713,14 +1713,18 @@ hns3_dcb_init(struct hns3_hw *hw)
        return 0;
 }
 
-static int
+int
 hns3_update_queue_map_configure(struct hns3_adapter *hns)
 {
        struct hns3_hw *hw = &hns->hw;
+       enum rte_eth_rx_mq_mode mq_mode = hw->data->dev_conf.rxmode.mq_mode;
        uint16_t nb_rx_q = hw->data->nb_rx_queues;
        uint16_t nb_tx_q = hw->data->nb_tx_queues;
        int ret;
 
+       if ((uint32_t)mq_mode & ETH_MQ_RX_DCB_FLAG)
+               return 0;
+
        ret = hns3_dcb_update_tc_queue_mapping(hw, nb_rx_q, nb_tx_q);
        if (ret) {
                hns3_err(hw, "failed to update tc queue mapping, ret = %d.",
@@ -1734,32 +1738,6 @@ hns3_update_queue_map_configure(struct hns3_adapter *hns)
        return ret;
 }
 
-int
-hns3_dcb_cfg_update(struct hns3_adapter *hns)
-{
-       struct hns3_hw *hw = &hns->hw;
-       enum rte_eth_rx_mq_mode mq_mode = hw->data->dev_conf.rxmode.mq_mode;
-       int ret;
-
-       if ((uint32_t)mq_mode & ETH_MQ_RX_DCB_FLAG) {
-               ret = hns3_dcb_configure(hns);
-               if (ret)
-                       hns3_err(hw, "Failed to config dcb: %d", ret);
-       } else {
-               /*
-                * Update queue map without PFC configuration,
-                * due to queues reconfigured by user.
-                */
-               ret = hns3_update_queue_map_configure(hns);
-               if (ret)
-                       hns3_err(hw,
-                                "Failed to update queue mapping configure: %d",
-                                ret);
-       }
-
-       return ret;
-}
-
 static void
 hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode)
 {
@@ -1801,7 +1779,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)
        uint8_t pfc_en = hw->dcb_info.pfc_en;
        uint8_t priority = pfc_conf->priority;
        uint16_t pause_time = pf->pause_time;
-       int ret, status;
+       int ret;
 
        pf->pause_time = pfc_conf->fc.pause_time;
        hns3_get_fc_mode(hw, pfc_conf->fc.mode);
@@ -1831,9 +1809,6 @@ pfc_setup_fail:
        pf->pause_time = pause_time;
        hw->dcb_info.pfc_en = pfc_en;
        hw->dcb_info.hw_pfc_map = hw_pfc_map;
-       status = hns3_buffer_alloc(hw);
-       if (status)
-               hns3_err(hw, "recover packet buffer fail: %d", status);
 
        return ret;
 }