mirror of https://gitee.com/openkylin/linux.git
cxgb4: only free allocated fls
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4b7a9168e1
commit
5fa766946b
|
@ -866,6 +866,7 @@ void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat);
|
||||||
void *t4_alloc_mem(size_t size);
|
void *t4_alloc_mem(size_t size);
|
||||||
|
|
||||||
void t4_free_sge_resources(struct adapter *adap);
|
void t4_free_sge_resources(struct adapter *adap);
|
||||||
|
void t4_free_ofld_rxqs(struct adapter *adap, int n, struct sge_ofld_rxq *q);
|
||||||
irq_handler_t t4_intr_handler(struct adapter *adap);
|
irq_handler_t t4_intr_handler(struct adapter *adap);
|
||||||
netdev_tx_t t4_eth_xmit(struct sk_buff *skb, struct net_device *dev);
|
netdev_tx_t t4_eth_xmit(struct sk_buff *skb, struct net_device *dev);
|
||||||
int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
|
int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
|
||||||
|
|
|
@ -2479,6 +2479,22 @@ static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* t4_free_ofld_rxqs - free a block of consecutive Rx queues
|
||||||
|
* @adap: the adapter
|
||||||
|
* @n: number of queues
|
||||||
|
* @q: pointer to first queue
|
||||||
|
*
|
||||||
|
* Release the resources of a consecutive block of offload Rx queues.
|
||||||
|
*/
|
||||||
|
void t4_free_ofld_rxqs(struct adapter *adap, int n, struct sge_ofld_rxq *q)
|
||||||
|
{
|
||||||
|
for ( ; n; n--, q++)
|
||||||
|
if (q->rspq.desc)
|
||||||
|
free_rspq_fl(adap, &q->rspq,
|
||||||
|
q->fl.size ? &q->fl : NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* t4_free_sge_resources - free SGE resources
|
* t4_free_sge_resources - free SGE resources
|
||||||
* @adap: the adapter
|
* @adap: the adapter
|
||||||
|
@ -2490,12 +2506,12 @@ void t4_free_sge_resources(struct adapter *adap)
|
||||||
int i;
|
int i;
|
||||||
struct sge_eth_rxq *eq = adap->sge.ethrxq;
|
struct sge_eth_rxq *eq = adap->sge.ethrxq;
|
||||||
struct sge_eth_txq *etq = adap->sge.ethtxq;
|
struct sge_eth_txq *etq = adap->sge.ethtxq;
|
||||||
struct sge_ofld_rxq *oq = adap->sge.ofldrxq;
|
|
||||||
|
|
||||||
/* clean up Ethernet Tx/Rx queues */
|
/* clean up Ethernet Tx/Rx queues */
|
||||||
for (i = 0; i < adap->sge.ethqsets; i++, eq++, etq++) {
|
for (i = 0; i < adap->sge.ethqsets; i++, eq++, etq++) {
|
||||||
if (eq->rspq.desc)
|
if (eq->rspq.desc)
|
||||||
free_rspq_fl(adap, &eq->rspq, &eq->fl);
|
free_rspq_fl(adap, &eq->rspq,
|
||||||
|
eq->fl.size ? &eq->fl : NULL);
|
||||||
if (etq->q.desc) {
|
if (etq->q.desc) {
|
||||||
t4_eth_eq_free(adap, adap->fn, adap->fn, 0,
|
t4_eth_eq_free(adap, adap->fn, adap->fn, 0,
|
||||||
etq->q.cntxt_id);
|
etq->q.cntxt_id);
|
||||||
|
@ -2506,18 +2522,9 @@ void t4_free_sge_resources(struct adapter *adap)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean up RDMA and iSCSI Rx queues */
|
/* clean up RDMA and iSCSI Rx queues */
|
||||||
for (i = 0; i < adap->sge.ofldqsets; i++, oq++) {
|
t4_free_ofld_rxqs(adap, adap->sge.ofldqsets, adap->sge.ofldrxq);
|
||||||
if (oq->rspq.desc)
|
t4_free_ofld_rxqs(adap, adap->sge.rdmaqs, adap->sge.rdmarxq);
|
||||||
free_rspq_fl(adap, &oq->rspq, &oq->fl);
|
t4_free_ofld_rxqs(adap, adap->sge.rdmaciqs, adap->sge.rdmaciq);
|
||||||
}
|
|
||||||
for (i = 0, oq = adap->sge.rdmarxq; i < adap->sge.rdmaqs; i++, oq++) {
|
|
||||||
if (oq->rspq.desc)
|
|
||||||
free_rspq_fl(adap, &oq->rspq, &oq->fl);
|
|
||||||
}
|
|
||||||
for (i = 0, oq = adap->sge.rdmaciq; i < adap->sge.rdmaciqs; i++, oq++) {
|
|
||||||
if (oq->rspq.desc)
|
|
||||||
free_rspq_fl(adap, &oq->rspq, &oq->fl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* clean up offload Tx queues */
|
/* clean up offload Tx queues */
|
||||||
for (i = 0; i < ARRAY_SIZE(adap->sge.ofldtxq); i++) {
|
for (i = 0; i < ARRAY_SIZE(adap->sge.ofldtxq); i++) {
|
||||||
|
|
Loading…
Reference in New Issue