summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
324d657)
Fix resource cleanup in port close.
Once the pointers are freed, set them to NULL.
Make sure access to the pointers is validated before use.
Fixes:
bb81e07323bb ("net/bnxt: support LED on/off")
Fixes:
804e746c7b73 ("net/bnxt: add hardware resource manager init code")
Fixes:
1d0704f4d793 ("net/bnxt: add device configure operation")
Fixes:
698aa7e95325 ("net/bnxt: add code to determine the Tx COS queue")
Fixes:
322bd6e70272 ("net/bnxt: add port representor infrastructure")
Fixes:
0bf5a0b5ebb8 ("net/bnxt: add a failure log")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
static void bnxt_free_parent_info(struct bnxt *bp)
{
rte_free(bp->parent);
static void bnxt_free_parent_info(struct bnxt *bp)
{
rte_free(bp->parent);
}
static void bnxt_free_pf_info(struct bnxt *bp)
{
rte_free(bp->pf);
}
static void bnxt_free_pf_info(struct bnxt *bp)
{
rte_free(bp->pf);
}
static void bnxt_free_link_info(struct bnxt *bp)
{
rte_free(bp->link_info);
}
static void bnxt_free_link_info(struct bnxt *bp)
{
rte_free(bp->link_info);
}
static void bnxt_free_leds_info(struct bnxt *bp)
}
static void bnxt_free_leds_info(struct bnxt *bp)
static void bnxt_free_cos_queues(struct bnxt *bp)
{
rte_free(bp->rx_cos_queue);
static void bnxt_free_cos_queues(struct bnxt *bp)
{
rte_free(bp->rx_cos_queue);
+ bp->rx_cos_queue = NULL;
rte_free(bp->tx_cos_queue);
rte_free(bp->tx_cos_queue);
+ bp->tx_cos_queue = NULL;
}
static void bnxt_free_mem(struct bnxt *bp, bool reconfig)
}
static void bnxt_free_mem(struct bnxt *bp, bool reconfig)
uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)
{
uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)
{
- uint32_t link_speed = bp->link_info->support_speeds;
+ uint32_t link_speed = 0;
+ if (bp->link_info == NULL)
+ return 0;
+
+ link_speed = bp->link_info->support_speeds;
+
/* If PAM4 is configured, use PAM4 supported speed */
if (link_speed == 0 && bp->link_info->support_pam4_speeds > 0)
link_speed = bp->link_info->support_pam4_speeds;
/* If PAM4 is configured, use PAM4 supported speed */
if (link_speed == 0 && bp->link_info->support_pam4_speeds > 0)
link_speed = bp->link_info->support_pam4_speeds;
- if (bp->switch_domain_id) {
- rc = rte_eth_switch_domain_free(bp->switch_domain_id);
- if (rc)
- PMD_DRV_LOG(ERR, "free switch domain:%d fail: %d\n",
- bp->switch_domain_id, rc);
- }
+ if (!(BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp)))
+ return;
+
+ rc = rte_eth_switch_domain_free(bp->switch_domain_id);
+ if (rc)
+ PMD_DRV_LOG(ERR, "free switch domain:%d fail: %d\n",
+ bp->switch_domain_id, rc);
}
static void bnxt_ptp_get_current_time(void *arg)
}
static void bnxt_ptp_get_current_time(void *arg)
static void bnxt_drv_uninit(struct bnxt *bp)
{
static void bnxt_drv_uninit(struct bnxt *bp)
{
- bnxt_free_switch_domain(bp);
bnxt_free_leds_info(bp);
bnxt_free_cos_queues(bp);
bnxt_free_link_info(bp);
bnxt_free_leds_info(bp);
bnxt_free_cos_queues(bp);
bnxt_free_link_info(bp);
bnxt_free_parent_info(bp);
bnxt_uninit_locks(bp);
bnxt_free_parent_info(bp);
bnxt_uninit_locks(bp);
bp->rx_mem_zone = NULL;
bnxt_free_vf_info(bp);
bp->rx_mem_zone = NULL;
bnxt_free_vf_info(bp);
rte_free(bp->grp_info);
bp->grp_info = NULL;
rte_free(bp->grp_info);
bp->grp_info = NULL;
return rc;
memset(&new, 0, sizeof(new));
return rc;
memset(&new, 0, sizeof(new));
+
+ if (bp->link_info == NULL)
+ goto out;
+
do {
/* Retrieve link info from hardware */
rc = bnxt_get_hwrm_link_config(bp, &new);
do {
/* Retrieve link info from hardware */
rc = bnxt_get_hwrm_link_config(bp, &new);
bnxt_free_mem(bp, reconfig_dev);
bnxt_hwrm_func_buf_unrgtr(bp);
bnxt_free_mem(bp, reconfig_dev);
bnxt_hwrm_func_buf_unrgtr(bp);
- rte_free(bp->pf->vf_req_buf);
+ if (bp->pf != NULL) {
+ rte_free(bp->pf->vf_req_buf);
+ bp->pf->vf_req_buf = NULL;
+ }
rc = bnxt_hwrm_func_driver_unregister(bp, 0);
bp->flags &= ~BNXT_FLAG_REGISTERED;
rc = bnxt_hwrm_func_driver_unregister(bp, 0);
bp->flags &= ~BNXT_FLAG_REGISTERED;
bnxt_uninit_ctx_mem(bp);
bnxt_free_flow_stats_info(bp);
bnxt_uninit_ctx_mem(bp);
bnxt_free_flow_stats_info(bp);
+ if (bp->rep_info != NULL)
+ bnxt_free_switch_domain(bp);
bnxt_free_rep_info(bp);
rte_free(bp->ptp_cfg);
bp->ptp_cfg = NULL;
bnxt_free_rep_info(bp);
rte_free(bp->ptp_cfg);
bp->ptp_cfg = NULL;
+ if (bp->pf == NULL)
+ return;
+
if (bp->pf->vf_info == NULL)
return;
if (bp->pf->vf_info == NULL)
return;