Commit d1cf33d9 authored by Nathan Fontenot's avatar Nathan Fontenot Committed by David S. Miller

ibmvnic: Add netdev_dbg output for debugging

To ease debugging of the ibmvnic driver add a series of netdev_dbg()
statements to track driver status, especially during initialization,
removal, and resetting of the driver.
Signed-off-by: default avatarNathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7c1885ae
...@@ -399,6 +399,7 @@ static int init_stats_token(struct ibmvnic_adapter *adapter) ...@@ -399,6 +399,7 @@ static int init_stats_token(struct ibmvnic_adapter *adapter)
} }
adapter->stats_token = stok; adapter->stats_token = stok;
netdev_dbg(adapter->netdev, "Stats token initialized (%llx)\n", stok);
return 0; return 0;
} }
...@@ -412,6 +413,8 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter) ...@@ -412,6 +413,8 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)
for (i = 0; i < rx_scrqs; i++) { for (i = 0; i < rx_scrqs; i++) {
rx_pool = &adapter->rx_pool[i]; rx_pool = &adapter->rx_pool[i];
netdev_dbg(adapter->netdev, "Re-setting rx_pool[%d]\n", i);
rc = reset_long_term_buff(adapter, &rx_pool->long_term_buff); rc = reset_long_term_buff(adapter, &rx_pool->long_term_buff);
if (rc) if (rc)
return rc; return rc;
...@@ -444,6 +447,8 @@ static void release_rx_pools(struct ibmvnic_adapter *adapter) ...@@ -444,6 +447,8 @@ static void release_rx_pools(struct ibmvnic_adapter *adapter)
for (i = 0; i < rx_scrqs; i++) { for (i = 0; i < rx_scrqs; i++) {
rx_pool = &adapter->rx_pool[i]; rx_pool = &adapter->rx_pool[i];
netdev_dbg(adapter->netdev, "Releasing rx_pool[%d]\n", i);
kfree(rx_pool->free_map); kfree(rx_pool->free_map);
free_long_term_buff(adapter, &rx_pool->long_term_buff); free_long_term_buff(adapter, &rx_pool->long_term_buff);
...@@ -490,7 +495,7 @@ static int init_rx_pools(struct net_device *netdev) ...@@ -490,7 +495,7 @@ static int init_rx_pools(struct net_device *netdev)
rx_pool = &adapter->rx_pool[i]; rx_pool = &adapter->rx_pool[i];
netdev_dbg(adapter->netdev, netdev_dbg(adapter->netdev,
"Initializing rx_pool %d, %lld buffs, %lld bytes each\n", "Initializing rx_pool[%d], %lld buffs, %lld bytes each\n",
i, adapter->req_rx_add_entries_per_subcrq, i, adapter->req_rx_add_entries_per_subcrq,
be64_to_cpu(size_array[i])); be64_to_cpu(size_array[i]));
...@@ -540,6 +545,8 @@ static int reset_tx_pools(struct ibmvnic_adapter *adapter) ...@@ -540,6 +545,8 @@ static int reset_tx_pools(struct ibmvnic_adapter *adapter)
tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs); tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs);
for (i = 0; i < tx_scrqs; i++) { for (i = 0; i < tx_scrqs; i++) {
netdev_dbg(adapter->netdev, "Re-setting tx_pool[%d]\n", i);
tx_pool = &adapter->tx_pool[i]; tx_pool = &adapter->tx_pool[i];
rc = reset_long_term_buff(adapter, &tx_pool->long_term_buff); rc = reset_long_term_buff(adapter, &tx_pool->long_term_buff);
...@@ -570,6 +577,7 @@ static void release_tx_pools(struct ibmvnic_adapter *adapter) ...@@ -570,6 +577,7 @@ static void release_tx_pools(struct ibmvnic_adapter *adapter)
tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs); tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs);
for (i = 0; i < tx_scrqs; i++) { for (i = 0; i < tx_scrqs; i++) {
netdev_dbg(adapter->netdev, "Releasing tx_pool[%d]\n", i);
tx_pool = &adapter->tx_pool[i]; tx_pool = &adapter->tx_pool[i];
kfree(tx_pool->tx_buff); kfree(tx_pool->tx_buff);
free_long_term_buff(adapter, &tx_pool->long_term_buff); free_long_term_buff(adapter, &tx_pool->long_term_buff);
...@@ -596,6 +604,11 @@ static int init_tx_pools(struct net_device *netdev) ...@@ -596,6 +604,11 @@ static int init_tx_pools(struct net_device *netdev)
for (i = 0; i < tx_subcrqs; i++) { for (i = 0; i < tx_subcrqs; i++) {
tx_pool = &adapter->tx_pool[i]; tx_pool = &adapter->tx_pool[i];
netdev_dbg(adapter->netdev,
"Initializing tx_pool[%d], %lld buffs\n",
i, adapter->req_tx_entries_per_subcrq);
tx_pool->tx_buff = kcalloc(adapter->req_tx_entries_per_subcrq, tx_pool->tx_buff = kcalloc(adapter->req_tx_entries_per_subcrq,
sizeof(struct ibmvnic_tx_buff), sizeof(struct ibmvnic_tx_buff),
GFP_KERNEL); GFP_KERNEL);
...@@ -666,8 +679,10 @@ static void ibmvnic_napi_disable(struct ibmvnic_adapter *adapter) ...@@ -666,8 +679,10 @@ static void ibmvnic_napi_disable(struct ibmvnic_adapter *adapter)
if (!adapter->napi_enabled) if (!adapter->napi_enabled)
return; return;
for (i = 0; i < adapter->req_rx_queues; i++) for (i = 0; i < adapter->req_rx_queues; i++) {
netdev_dbg(adapter->netdev, "Disabling napi[%d]\n", i);
napi_disable(&adapter->napi[i]); napi_disable(&adapter->napi[i]);
}
adapter->napi_enabled = false; adapter->napi_enabled = false;
} }
...@@ -730,8 +745,11 @@ static void release_resources(struct ibmvnic_adapter *adapter) ...@@ -730,8 +745,11 @@ static void release_resources(struct ibmvnic_adapter *adapter)
if (adapter->napi) { if (adapter->napi) {
for (i = 0; i < adapter->req_rx_queues; i++) { for (i = 0; i < adapter->req_rx_queues; i++) {
if (&adapter->napi[i]) if (&adapter->napi[i]) {
netdev_dbg(adapter->netdev,
"Releasing napi[%d]\n", i);
netif_napi_del(&adapter->napi[i]); netif_napi_del(&adapter->napi[i]);
}
} }
} }
} }
...@@ -744,7 +762,8 @@ static int set_link_state(struct ibmvnic_adapter *adapter, u8 link_state) ...@@ -744,7 +762,8 @@ static int set_link_state(struct ibmvnic_adapter *adapter, u8 link_state)
bool resend; bool resend;
int rc; int rc;
netdev_err(netdev, "setting link state %d\n", link_state); netdev_dbg(netdev, "setting link state %d\n", link_state);
memset(&crq, 0, sizeof(crq)); memset(&crq, 0, sizeof(crq));
crq.logical_link_state.first = IBMVNIC_CRQ_CMD; crq.logical_link_state.first = IBMVNIC_CRQ_CMD;
crq.logical_link_state.cmd = LOGICAL_LINK_STATE; crq.logical_link_state.cmd = LOGICAL_LINK_STATE;
...@@ -781,6 +800,9 @@ static int set_real_num_queues(struct net_device *netdev) ...@@ -781,6 +800,9 @@ static int set_real_num_queues(struct net_device *netdev)
struct ibmvnic_adapter *adapter = netdev_priv(netdev); struct ibmvnic_adapter *adapter = netdev_priv(netdev);
int rc; int rc;
netdev_dbg(netdev, "Setting real tx/rx queues (%llx/%llx)\n",
adapter->req_tx_queues, adapter->req_rx_queues);
rc = netif_set_real_num_tx_queues(netdev, adapter->req_tx_queues); rc = netif_set_real_num_tx_queues(netdev, adapter->req_tx_queues);
if (rc) { if (rc) {
netdev_err(netdev, "failed to set the number of tx queues\n"); netdev_err(netdev, "failed to set the number of tx queues\n");
...@@ -818,6 +840,7 @@ static int init_resources(struct ibmvnic_adapter *adapter) ...@@ -818,6 +840,7 @@ static int init_resources(struct ibmvnic_adapter *adapter)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < adapter->req_rx_queues; i++) { for (i = 0; i < adapter->req_rx_queues; i++) {
netdev_dbg(netdev, "Adding napi[%d]\n", i);
netif_napi_add(netdev, &adapter->napi[i], ibmvnic_poll, netif_napi_add(netdev, &adapter->napi[i], ibmvnic_poll,
NAPI_POLL_WEIGHT); NAPI_POLL_WEIGHT);
} }
...@@ -846,6 +869,7 @@ static int __ibmvnic_open(struct net_device *netdev) ...@@ -846,6 +869,7 @@ static int __ibmvnic_open(struct net_device *netdev)
* set the logical link state to up * set the logical link state to up
*/ */
for (i = 0; i < adapter->req_rx_queues; i++) { for (i = 0; i < adapter->req_rx_queues; i++) {
netdev_dbg(netdev, "Enabling rx_scrq[%d] irq\n", i);
if (prev_state == VNIC_CLOSED) if (prev_state == VNIC_CLOSED)
enable_irq(adapter->rx_scrq[i]->irq); enable_irq(adapter->rx_scrq[i]->irq);
else else
...@@ -853,6 +877,7 @@ static int __ibmvnic_open(struct net_device *netdev) ...@@ -853,6 +877,7 @@ static int __ibmvnic_open(struct net_device *netdev)
} }
for (i = 0; i < adapter->req_tx_queues; i++) { for (i = 0; i < adapter->req_tx_queues; i++) {
netdev_dbg(netdev, "Enabling tx_scrq[%d] irq\n", i);
if (prev_state == VNIC_CLOSED) if (prev_state == VNIC_CLOSED)
enable_irq(adapter->tx_scrq[i]->irq); enable_irq(adapter->tx_scrq[i]->irq);
else else
...@@ -926,6 +951,7 @@ static void clean_tx_pools(struct ibmvnic_adapter *adapter) ...@@ -926,6 +951,7 @@ static void clean_tx_pools(struct ibmvnic_adapter *adapter)
if (!tx_pool) if (!tx_pool)
continue; continue;
netdev_dbg(adapter->netdev, "Cleaning tx_pool[%d]\n", i);
for (j = 0; j < tx_entries; j++) { for (j = 0; j < tx_entries; j++) {
if (tx_pool->tx_buff[j].skb) { if (tx_pool->tx_buff[j].skb) {
dev_kfree_skb_any(tx_pool->tx_buff[j].skb); dev_kfree_skb_any(tx_pool->tx_buff[j].skb);
...@@ -953,8 +979,11 @@ static int __ibmvnic_close(struct net_device *netdev) ...@@ -953,8 +979,11 @@ static int __ibmvnic_close(struct net_device *netdev)
if (adapter->tx_scrq) { if (adapter->tx_scrq) {
for (i = 0; i < adapter->req_tx_queues; i++) for (i = 0; i < adapter->req_tx_queues; i++)
if (adapter->tx_scrq[i]->irq) if (adapter->tx_scrq[i]->irq) {
netdev_dbg(adapter->netdev,
"Disabling tx_scrq[%d] irq\n", i);
disable_irq(adapter->tx_scrq[i]->irq); disable_irq(adapter->tx_scrq[i]->irq);
}
} }
rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN); rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN);
...@@ -973,8 +1002,11 @@ static int __ibmvnic_close(struct net_device *netdev) ...@@ -973,8 +1002,11 @@ static int __ibmvnic_close(struct net_device *netdev)
break; break;
} }
if (adapter->rx_scrq[i]->irq) if (adapter->rx_scrq[i]->irq) {
netdev_dbg(adapter->netdev,
"Disabling rx_scrq[%d] irq\n", i);
disable_irq(adapter->rx_scrq[i]->irq); disable_irq(adapter->rx_scrq[i]->irq);
}
} }
} }
...@@ -1367,6 +1399,9 @@ static int do_reset(struct ibmvnic_adapter *adapter, ...@@ -1367,6 +1399,9 @@ static int do_reset(struct ibmvnic_adapter *adapter,
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
int i, rc; int i, rc;
netdev_dbg(adapter->netdev, "Re-setting driver (%d)\n",
rwi->reset_reason);
netif_carrier_off(netdev); netif_carrier_off(netdev);
adapter->reset_reason = rwi->reset_reason; adapter->reset_reason = rwi->reset_reason;
...@@ -1491,6 +1526,7 @@ static void __ibmvnic_reset(struct work_struct *work) ...@@ -1491,6 +1526,7 @@ static void __ibmvnic_reset(struct work_struct *work)
} }
if (rc) { if (rc) {
netdev_dbg(adapter->netdev, "Reset failed\n");
free_all_rwi(adapter); free_all_rwi(adapter);
mutex_unlock(&adapter->reset_lock); mutex_unlock(&adapter->reset_lock);
return; return;
...@@ -1524,7 +1560,7 @@ static void ibmvnic_reset(struct ibmvnic_adapter *adapter, ...@@ -1524,7 +1560,7 @@ static void ibmvnic_reset(struct ibmvnic_adapter *adapter,
list_for_each(entry, &adapter->rwi_list) { list_for_each(entry, &adapter->rwi_list) {
tmp = list_entry(entry, struct ibmvnic_rwi, list); tmp = list_entry(entry, struct ibmvnic_rwi, list);
if (tmp->reset_reason == reason) { if (tmp->reset_reason == reason) {
netdev_err(netdev, "Matching reset found, skipping\n"); netdev_dbg(netdev, "Skipping matching reset\n");
mutex_unlock(&adapter->rwi_lock); mutex_unlock(&adapter->rwi_lock);
return; return;
} }
...@@ -1540,6 +1576,8 @@ static void ibmvnic_reset(struct ibmvnic_adapter *adapter, ...@@ -1540,6 +1576,8 @@ static void ibmvnic_reset(struct ibmvnic_adapter *adapter,
rwi->reset_reason = reason; rwi->reset_reason = reason;
list_add_tail(&rwi->list, &adapter->rwi_list); list_add_tail(&rwi->list, &adapter->rwi_list);
mutex_unlock(&adapter->rwi_lock); mutex_unlock(&adapter->rwi_lock);
netdev_dbg(adapter->netdev, "Scheduling reset (reason %d)\n", reason);
schedule_work(&adapter->ibmvnic_reset); schedule_work(&adapter->ibmvnic_reset);
} }
...@@ -1900,12 +1938,14 @@ static int reset_sub_crq_queues(struct ibmvnic_adapter *adapter) ...@@ -1900,12 +1938,14 @@ static int reset_sub_crq_queues(struct ibmvnic_adapter *adapter)
int i, rc; int i, rc;
for (i = 0; i < adapter->req_tx_queues; i++) { for (i = 0; i < adapter->req_tx_queues; i++) {
netdev_dbg(adapter->netdev, "Re-setting tx_scrq[%d]\n", i);
rc = reset_one_sub_crq_queue(adapter, adapter->tx_scrq[i]); rc = reset_one_sub_crq_queue(adapter, adapter->tx_scrq[i]);
if (rc) if (rc)
return rc; return rc;
} }
for (i = 0; i < adapter->req_rx_queues; i++) { for (i = 0; i < adapter->req_rx_queues; i++) {
netdev_dbg(adapter->netdev, "Re-setting rx_scrq[%d]\n", i);
rc = reset_one_sub_crq_queue(adapter, adapter->rx_scrq[i]); rc = reset_one_sub_crq_queue(adapter, adapter->rx_scrq[i]);
if (rc) if (rc)
return rc; return rc;
...@@ -2009,6 +2049,8 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter) ...@@ -2009,6 +2049,8 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter)
if (!adapter->tx_scrq[i]) if (!adapter->tx_scrq[i])
continue; continue;
netdev_dbg(adapter->netdev, "Releasing tx_scrq[%d]\n",
i);
if (adapter->tx_scrq[i]->irq) { if (adapter->tx_scrq[i]->irq) {
free_irq(adapter->tx_scrq[i]->irq, free_irq(adapter->tx_scrq[i]->irq,
adapter->tx_scrq[i]); adapter->tx_scrq[i]);
...@@ -2028,6 +2070,8 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter) ...@@ -2028,6 +2070,8 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter)
if (!adapter->rx_scrq[i]) if (!adapter->rx_scrq[i])
continue; continue;
netdev_dbg(adapter->netdev, "Releasing rx_scrq[%d]\n",
i);
if (adapter->rx_scrq[i]->irq) { if (adapter->rx_scrq[i]->irq) {
free_irq(adapter->rx_scrq[i]->irq, free_irq(adapter->rx_scrq[i]->irq,
adapter->rx_scrq[i]); adapter->rx_scrq[i]);
...@@ -2182,6 +2226,8 @@ static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter) ...@@ -2182,6 +2226,8 @@ static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter)
int rc = 0; int rc = 0;
for (i = 0; i < adapter->req_tx_queues; i++) { for (i = 0; i < adapter->req_tx_queues; i++) {
netdev_dbg(adapter->netdev, "Initializing tx_scrq[%d] irq\n",
i);
scrq = adapter->tx_scrq[i]; scrq = adapter->tx_scrq[i];
scrq->irq = irq_create_mapping(NULL, scrq->hw_irq); scrq->irq = irq_create_mapping(NULL, scrq->hw_irq);
...@@ -2203,6 +2249,8 @@ static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter) ...@@ -2203,6 +2249,8 @@ static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter)
} }
for (i = 0; i < adapter->req_rx_queues; i++) { for (i = 0; i < adapter->req_rx_queues; i++) {
netdev_dbg(adapter->netdev, "Initializing rx_scrq[%d] irq\n",
i);
scrq = adapter->rx_scrq[i]; scrq = adapter->rx_scrq[i];
scrq->irq = irq_create_mapping(NULL, scrq->hw_irq); scrq->irq = irq_create_mapping(NULL, scrq->hw_irq);
if (!scrq->irq) { if (!scrq->irq) {
......
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