Skip to contentSkip to conversation

net/ice: support QoS BW config after VF reset in DCF

PATCH Superseded Ting Xu 2 participants 3 messages Jul 2, 2021 – Jul 8, 2021 Network drivers

lore
Share & tools
lore

Ting Xu

author
#0 lore raw

PATCH 1/1 net/ice: support QoS BW config after VF reset in DCF

When VF reset happens, the QoS bandwidth configuration will be lost. If the reset is not caused by DCB change, it is supposed to replay the bandwidth configuration to VF by DCF. In this patch, when a vsi update PF event is received from PF after VF reset, and it is confirmed that DCB is not changed, bandwidth configuration will be replayed.

---
 drivers/net/ice/ice_dcf.c        | 11 +++++--
 drivers/net/ice/ice_dcf.h        |  2 ++
 drivers/net/ice/ice_dcf_ethdev.c |  1 -
 drivers/net/ice/ice_dcf_parent.c |  3 ++
 drivers/net/ice/ice_dcf_sched.c  | 53 +++++++++++++++++++++++++++++++-
 5 files changed, 66 insertions(+), 4 deletions(-)
drivers/net/ice/ice_dcf.c +9 -2
index 349d23ee4f..045800a2d9 100644
@@ -577,7 +577,7 @@ int
 ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 {
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-	int ret;
+	int ret, size;
 
 	hw->avf.hw_addr = pci_dev->mem_resource[0].addr;
 	hw->avf.back = hw;
@@ -669,8 +669,15 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 		}
 	}
 
-	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS) {
 		ice_dcf_tm_conf_init(eth_dev);
+		size = sizeof(struct virtchnl_dcf_bw_cfg_list *) * hw->num_vfs;
+		hw->qos_bw_cfg = rte_zmalloc("qos_bw_cfg", size, 0);
+		if (!hw->qos_bw_cfg) {
+			PMD_INIT_LOG(ERR, "no memory for qos_bw_cfg");
+			goto err_rss;
+		}
+	}
 
 	hw->eth_dev = eth_dev;
 	rte_intr_callback_register(&pci_dev->intr_handle,
drivers/net/ice/ice_dcf.h +2 -0
index 1c7653de3d..711c0cf3ad 100644
@@ -90,6 +90,7 @@ struct ice_dcf_hw {
 	uint16_t pf_vsi_id;
 
 	struct ice_dcf_tm_conf tm_conf;
+	struct virtchnl_dcf_bw_cfg_list **qos_bw_cfg;
 	struct ice_aqc_port_ets_elem *ets_config;
 	struct virtchnl_version_info virtchnl_version;
 	struct virtchnl_vf_resource *vf_res; /* VF resource */
@@ -131,5 +132,6 @@ int ice_dcf_link_update(struct rte_eth_dev *dev,
 		    __rte_unused int wait_to_complete);
 void ice_dcf_tm_conf_init(struct rte_eth_dev *dev);
 void ice_dcf_tm_conf_uninit(struct rte_eth_dev *dev);
+int ice_dcf_replay_vf_bw(struct ice_dcf_hw *hw, uint16_t vf_id);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +0 -1
index 69fe6e63d1..cab7c4da87 100644
@@ -622,7 +622,6 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 	ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false);
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	ad->pf.adapter_stopped = 1;
-	dcf_ad->real_hw.tm_conf.committed = false;
 
 	return 0;
 }
drivers/net/ice/ice_dcf_parent.c +3 -0
index c59cd0bef9..03155c9df0 100644
@@ -143,6 +143,9 @@ ice_dcf_vsi_update_service_handler(void *param)
 		}
 	}
 
+	if (hw->tm_conf.committed)
+		ice_dcf_replay_vf_bw(hw, reset_param->vf_id);
+
 	rte_spinlock_unlock(&vsi_update_lock);
 
 	free(param);
drivers/net/ice/ice_dcf_sched.c +52 -1

65 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v2 1/1 net/ice: support QoS BW config after VF reset in DCF

When VF reset happens, the QoS bandwidth configuration will be lost. If the reset is not caused by DCB change, it is supposed to replay the bandwidth configuration to VF by DCF. In this patch, when a vsi update PF event is received from PF after VF reset, and it is confirmed that DCB is not changed, bandwidth configuration will be replayed.

---
v1->v2: rebase

---
 drivers/net/ice/ice_dcf.c        | 11 +++++--
 drivers/net/ice/ice_dcf.h        |  2 ++
 drivers/net/ice/ice_dcf_ethdev.c |  1 -
 drivers/net/ice/ice_dcf_parent.c |  3 ++
 drivers/net/ice/ice_dcf_sched.c  | 52 +++++++++++++++++++++++++++++++-
 5 files changed, 65 insertions(+), 4 deletions(-)
drivers/net/ice/ice_dcf.c +9 -2
index 349d23ee4f..045800a2d9 100644
@@ -577,7 +577,7 @@ int
 ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 {
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-	int ret;
+	int ret, size;
 
 	hw->avf.hw_addr = pci_dev->mem_resource[0].addr;
 	hw->avf.back = hw;
@@ -669,8 +669,15 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 		}
 	}
 
-	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)
+	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS) {
 		ice_dcf_tm_conf_init(eth_dev);
+		size = sizeof(struct virtchnl_dcf_bw_cfg_list *) * hw->num_vfs;
+		hw->qos_bw_cfg = rte_zmalloc("qos_bw_cfg", size, 0);
+		if (!hw->qos_bw_cfg) {
+			PMD_INIT_LOG(ERR, "no memory for qos_bw_cfg");
+			goto err_rss;
+		}
+	}
 
 	hw->eth_dev = eth_dev;
 	rte_intr_callback_register(&pci_dev->intr_handle,
drivers/net/ice/ice_dcf.h +2 -0
index 1c7653de3d..711c0cf3ad 100644
@@ -90,6 +90,7 @@ struct ice_dcf_hw {
 	uint16_t pf_vsi_id;
 
 	struct ice_dcf_tm_conf tm_conf;
+	struct virtchnl_dcf_bw_cfg_list **qos_bw_cfg;
 	struct ice_aqc_port_ets_elem *ets_config;
 	struct virtchnl_version_info virtchnl_version;
 	struct virtchnl_vf_resource *vf_res; /* VF resource */
@@ -131,5 +132,6 @@ int ice_dcf_link_update(struct rte_eth_dev *dev,
 		    __rte_unused int wait_to_complete);
 void ice_dcf_tm_conf_init(struct rte_eth_dev *dev);
 void ice_dcf_tm_conf_uninit(struct rte_eth_dev *dev);
+int ice_dcf_replay_vf_bw(struct ice_dcf_hw *hw, uint16_t vf_id);
 
 #endif /* _ICE_DCF_H_ */
drivers/net/ice/ice_dcf_ethdev.c +0 -1
index 69fe6e63d1..cab7c4da87 100644
@@ -622,7 +622,6 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 	ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false);
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	ad->pf.adapter_stopped = 1;
-	dcf_ad->real_hw.tm_conf.committed = false;
 
 	return 0;
 }
drivers/net/ice/ice_dcf_parent.c +3 -0
index c59cd0bef9..03155c9df0 100644
@@ -143,6 +143,9 @@ ice_dcf_vsi_update_service_handler(void *param)
 		}
 	}
 
+	if (hw->tm_conf.committed)
+		ice_dcf_replay_vf_bw(hw, reset_param->vf_id);
+
 	rte_spinlock_unlock(&vsi_update_lock);
 
 	free(param);
drivers/net/ice/ice_dcf_sched.c +51 -1

64 lines not on this page · raw message

Signature · 1 line
2.17.1
Acked-by on v2 1/1 Applied
#2 lore raw
Quoted 10 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Thursday, July 8, 2021 10:34 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Xu, Ting <[email protected]>
Subject: [PATCH v2] net/ice: support QoS BW config after VF reset in DCF

Quoted 7 lines

When VF reset happens, the QoS bandwidth configuration will be lost. If the reset is not caused by DCB change, it is supposed to replay the bandwidth configuration to VF by DCF. In this patch, when a vsi update PF event is received from PF after VF reset, and it is confirmed that DCB is not changed, bandwidth configuration will be replayed.

Applied to dpdk-next-net-intel.

Thanks
Qi