if (!adapter->rx_pool)
return;
- for (i = 0; i < adapter->num_active_rx_scrqs; i++) {
+ for (i = 0; i < adapter->num_active_rx_pools; i++) {
rx_pool = &adapter->rx_pool[i];
netdev_dbg(adapter->netdev, "Releasing rx_pool[%d]\n", i);
kfree(adapter->rx_pool);
adapter->rx_pool = NULL;
+ adapter->num_active_rx_pools = 0;
}
static int init_rx_pools(struct net_device *netdev)
return -1;
}
+ adapter->num_active_rx_pools = rxadd_subcrqs;
+
for (i = 0; i < rxadd_subcrqs; i++) {
rx_pool = &adapter->rx_pool[i];
if (!adapter->tx_pool)
return;
- for (i = 0; i < adapter->num_active_tx_scrqs; i++) {
+ for (i = 0; i < adapter->num_active_tx_pools; i++) {
netdev_dbg(adapter->netdev, "Releasing tx_pool[%d]\n", i);
tx_pool = &adapter->tx_pool[i];
kfree(tx_pool->tx_buff);
kfree(adapter->tx_pool);
adapter->tx_pool = NULL;
+ adapter->num_active_tx_pools = 0;
}
static int init_tx_pools(struct net_device *netdev)
if (!adapter->tx_pool)
return -1;
+ adapter->num_active_tx_pools = tx_subcrqs;
+
for (i = 0; i < tx_subcrqs; i++) {
tx_pool = &adapter->tx_pool[i];
ibmvnic_poll, NAPI_POLL_WEIGHT);
}
+ adapter->num_active_rx_napi = adapter->req_rx_queues;
return 0;
}
if (!adapter->napi)
return;
- for (i = 0; i < adapter->num_active_rx_scrqs; i++) {
+ for (i = 0; i < adapter->num_active_rx_napi; i++) {
if (&adapter->napi[i]) {
netdev_dbg(adapter->netdev,
"Releasing napi[%d]\n", i);
kfree(adapter->napi);
adapter->napi = NULL;
+ adapter->num_active_rx_napi = 0;
}
static int ibmvnic_login(struct net_device *netdev)
return rc;
rc = init_tx_pools(netdev);
-
- adapter->num_active_tx_scrqs = adapter->req_tx_queues;
- adapter->num_active_rx_scrqs = adapter->req_rx_queues;
-
return rc;
}
release_napi(adapter);
init_napi(adapter);
-
- adapter->num_active_tx_scrqs = adapter->req_tx_queues;
- adapter->num_active_rx_scrqs = adapter->req_rx_queues;
} else {
rc = reset_tx_pools(adapter);
if (rc)
static void release_sub_crqs(struct ibmvnic_adapter *adapter, bool do_h_free)
{
- u64 num_tx_scrqs, num_rx_scrqs;
int i;
- if (adapter->state == VNIC_PROBED) {
- num_tx_scrqs = adapter->req_tx_queues;
- num_rx_scrqs = adapter->req_rx_queues;
- } else {
- num_tx_scrqs = adapter->num_active_tx_scrqs;
- num_rx_scrqs = adapter->num_active_rx_scrqs;
- }
-
if (adapter->tx_scrq) {
- for (i = 0; i < num_tx_scrqs; i++) {
+ for (i = 0; i < adapter->num_active_tx_scrqs; i++) {
if (!adapter->tx_scrq[i])
continue;
kfree(adapter->tx_scrq);
adapter->tx_scrq = NULL;
+ adapter->num_active_tx_scrqs = 0;
}
if (adapter->rx_scrq) {
- for (i = 0; i < num_rx_scrqs; i++) {
+ for (i = 0; i < adapter->num_active_rx_scrqs; i++) {
if (!adapter->rx_scrq[i])
continue;
kfree(adapter->rx_scrq);
adapter->rx_scrq = NULL;
+ adapter->num_active_rx_scrqs = 0;
}
}
for (i = 0; i < adapter->req_tx_queues; i++) {
adapter->tx_scrq[i] = allqueues[i];
adapter->tx_scrq[i]->pool_index = i;
+ adapter->num_active_tx_scrqs++;
}
adapter->rx_scrq = kcalloc(adapter->req_rx_queues,
for (i = 0; i < adapter->req_rx_queues; i++) {
adapter->rx_scrq[i] = allqueues[i + adapter->req_tx_queues];
adapter->rx_scrq[i]->scrq_num = i;
+ adapter->num_active_rx_scrqs++;
}
kfree(allqueues);