Commit cef8dac9 authored by Rahul Lakkireddy's avatar Rahul Lakkireddy Committed by David S. Miller

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: b1396c2b ("cxgb4: parse and configure TC-MQPRIO offload")
Signed-off-by: default avatarRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 41aa8561
...@@ -6671,6 +6671,10 @@ static void shutdown_one(struct pci_dev *pdev) ...@@ -6671,6 +6671,10 @@ static void shutdown_one(struct pci_dev *pdev)
if (adapter->port[i]->reg_state == NETREG_REGISTERED) if (adapter->port[i]->reg_state == NETREG_REGISTERED)
cxgb_close(adapter->port[i]); cxgb_close(adapter->port[i]);
rtnl_lock();
cxgb4_mqprio_stop_offload(adapter);
rtnl_unlock();
if (is_uld(adapter)) { if (is_uld(adapter)) {
detach_ulds(adapter); detach_ulds(adapter);
t4_uld_clean_up(adapter); t4_uld_clean_up(adapter);
......
...@@ -301,6 +301,7 @@ static void cxgb4_mqprio_free_hw_resources(struct net_device *dev) ...@@ -301,6 +301,7 @@ static void cxgb4_mqprio_free_hw_resources(struct net_device *dev)
cxgb4_clear_msix_aff(eorxq->msix->vec, cxgb4_clear_msix_aff(eorxq->msix->vec,
eorxq->msix->aff_mask); eorxq->msix->aff_mask);
free_irq(eorxq->msix->vec, &eorxq->rspq); 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); free_rspq_fl(adap, &eorxq->rspq, &eorxq->fl);
...@@ -611,6 +612,28 @@ int cxgb4_setup_tc_mqprio(struct net_device *dev, ...@@ -611,6 +612,28 @@ int cxgb4_setup_tc_mqprio(struct net_device *dev,
return ret; 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) int cxgb4_init_tc_mqprio(struct adapter *adap)
{ {
struct cxgb4_tc_port_mqprio *tc_port_mqprio, *port_mqprio; struct cxgb4_tc_port_mqprio *tc_port_mqprio, *port_mqprio;
......
...@@ -38,6 +38,7 @@ struct cxgb4_tc_mqprio { ...@@ -38,6 +38,7 @@ struct cxgb4_tc_mqprio {
int cxgb4_setup_tc_mqprio(struct net_device *dev, int cxgb4_setup_tc_mqprio(struct net_device *dev,
struct tc_mqprio_qopt_offload *mqprio); struct tc_mqprio_qopt_offload *mqprio);
void cxgb4_mqprio_stop_offload(struct adapter *adap);
int cxgb4_init_tc_mqprio(struct adapter *adap); int cxgb4_init_tc_mqprio(struct adapter *adap);
void cxgb4_cleanup_tc_mqprio(struct adapter *adap); void cxgb4_cleanup_tc_mqprio(struct adapter *adap);
#endif /* __CXGB4_TC_MQPRIO_H__ */ #endif /* __CXGB4_TC_MQPRIO_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment