cxgb4: free MQPRIO resources in shutdown path

Perform missing MQPRIO resource cleanup in PCI shutdown path. Also,
fix MQPRIO MSIX bitmap leak in resource cleanup.

Fixes: b1396c2bd6 ("cxgb4: parse and configure TC-MQPRIO offload")
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Rahul Lakkireddy 2020-04-01 01:17:01 +05:30 committed by David S. Miller
parent 41aa8561ca
commit cef8dac96b
3 changed files with 28 additions and 0 deletions

View File

@ -6671,6 +6671,10 @@ static void shutdown_one(struct pci_dev *pdev)
if (adapter->port[i]->reg_state == NETREG_REGISTERED)
cxgb_close(adapter->port[i]);
rtnl_lock();
cxgb4_mqprio_stop_offload(adapter);
rtnl_unlock();
if (is_uld(adapter)) {
detach_ulds(adapter);
t4_uld_clean_up(adapter);

View File

@ -301,6 +301,7 @@ static void cxgb4_mqprio_free_hw_resources(struct net_device *dev)
cxgb4_clear_msix_aff(eorxq->msix->vec,
eorxq->msix->aff_mask);
free_irq(eorxq->msix->vec, &eorxq->rspq);
cxgb4_free_msix_idx_in_bmap(adap, eorxq->msix->idx);
}
free_rspq_fl(adap, &eorxq->rspq, &eorxq->fl);
@ -611,6 +612,28 @@ out:
return ret;
}
void cxgb4_mqprio_stop_offload(struct adapter *adap)
{
struct cxgb4_tc_port_mqprio *tc_port_mqprio;
struct net_device *dev;
u8 i;
if (!adap->tc_mqprio || !adap->tc_mqprio->port_mqprio)
return;
for_each_port(adap, i) {
dev = adap->port[i];
if (!dev)
continue;
tc_port_mqprio = &adap->tc_mqprio->port_mqprio[i];
if (!tc_port_mqprio->mqprio.qopt.num_tc)
continue;
cxgb4_mqprio_disable_offload(dev);
}
}
int cxgb4_init_tc_mqprio(struct adapter *adap)
{
struct cxgb4_tc_port_mqprio *tc_port_mqprio, *port_mqprio;

View File

@ -38,6 +38,7 @@ struct cxgb4_tc_mqprio {
int cxgb4_setup_tc_mqprio(struct net_device *dev,
struct tc_mqprio_qopt_offload *mqprio);
void cxgb4_mqprio_stop_offload(struct adapter *adap);
int cxgb4_init_tc_mqprio(struct adapter *adap);
void cxgb4_cleanup_tc_mqprio(struct adapter *adap);
#endif /* __CXGB4_TC_MQPRIO_H__ */