Commit 4a8acef7 authored by Arjun Vynipadath's avatar Arjun Vynipadath Committed by David S. Miller

cxgb4vf: Enter debugging mode if FW is inaccessible

If we are not able to reach firmware, enter debugging mode that will
help us to get adapter logs.
Signed-off-by: default avatarArjun Vynipadath <arjun@chelsio.com>
Signed-off-by: default avatarVishal Kulkarni <vishal@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 64f40cdd
...@@ -411,6 +411,7 @@ enum { /* adapter flags */ ...@@ -411,6 +411,7 @@ enum { /* adapter flags */
USING_MSIX = (1UL << 2), USING_MSIX = (1UL << 2),
QUEUES_BOUND = (1UL << 3), QUEUES_BOUND = (1UL << 3),
ROOT_NO_RELAXED_ORDERING = (1UL << 4), ROOT_NO_RELAXED_ORDERING = (1UL << 4),
FW_OK = (1UL << 5),
}; };
/* /*
......
...@@ -844,6 +844,13 @@ static int cxgb4vf_open(struct net_device *dev) ...@@ -844,6 +844,13 @@ static int cxgb4vf_open(struct net_device *dev)
struct port_info *pi = netdev_priv(dev); struct port_info *pi = netdev_priv(dev);
struct adapter *adapter = pi->adapter; struct adapter *adapter = pi->adapter;
/*
* If we don't have a connection to the firmware there's nothing we
* can do.
*/
if (!(adapter->flags & FW_OK))
return -ENXIO;
/* /*
* If this is the first interface that we're opening on the "adapter", * If this is the first interface that we're opening on the "adapter",
* bring the "adapter" up now. * bring the "adapter" up now.
...@@ -2720,6 +2727,7 @@ static int adap_init0(struct adapter *adapter) ...@@ -2720,6 +2727,7 @@ static int adap_init0(struct adapter *adapter)
*/ */
size_nports_qsets(adapter); size_nports_qsets(adapter);
adapter->flags |= FW_OK;
return 0; return 0;
} }
...@@ -3084,7 +3092,9 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, ...@@ -3084,7 +3092,9 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
err = adap_init0(adapter); err = adap_init0(adapter);
if (err) if (err)
goto err_unmap_bar; dev_err(&pdev->dev,
"Adapter initialization failed, error %d. Continuing in debug mode\n",
err);
/* Initialize hash mac addr list */ /* Initialize hash mac addr list */
INIT_LIST_HEAD(&adapter->mac_hlist); INIT_LIST_HEAD(&adapter->mac_hlist);
...@@ -3109,13 +3119,6 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, ...@@ -3109,13 +3119,6 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
break; break;
port_id = ffs(pmask) - 1; port_id = ffs(pmask) - 1;
pmask &= ~(1 << port_id); pmask &= ~(1 << port_id);
viid = t4vf_alloc_vi(adapter, port_id);
if (viid < 0) {
dev_err(&pdev->dev, "cannot allocate VI for port %d:"
" err=%d\n", port_id, viid);
err = viid;
goto err_free_dev;
}
/* /*
* Allocate our network device and stitch things together. * Allocate our network device and stitch things together.
...@@ -3123,7 +3126,6 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, ...@@ -3123,7 +3126,6 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
netdev = alloc_etherdev_mq(sizeof(struct port_info), netdev = alloc_etherdev_mq(sizeof(struct port_info),
MAX_PORT_QSETS); MAX_PORT_QSETS);
if (netdev == NULL) { if (netdev == NULL) {
t4vf_free_vi(adapter, viid);
err = -ENOMEM; err = -ENOMEM;
goto err_free_dev; goto err_free_dev;
} }
...@@ -3133,7 +3135,6 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, ...@@ -3133,7 +3135,6 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
pi->adapter = adapter; pi->adapter = adapter;
pi->pidx = pidx; pi->pidx = pidx;
pi->port_id = port_id; pi->port_id = port_id;
pi->viid = viid;
/* /*
* Initialize the starting state of our "port" and register * Initialize the starting state of our "port" and register
...@@ -3159,6 +3160,23 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, ...@@ -3159,6 +3160,23 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
netdev->ethtool_ops = &cxgb4vf_ethtool_ops; netdev->ethtool_ops = &cxgb4vf_ethtool_ops;
netdev->dev_port = pi->port_id; netdev->dev_port = pi->port_id;
/*
* If we haven't been able to contact the firmware, there's
* nothing else we can do for this "port" ...
*/
if (!(adapter->flags & FW_OK))
continue;
viid = t4vf_alloc_vi(adapter, port_id);
if (viid < 0) {
dev_err(&pdev->dev,
"cannot allocate VI for port %d: err=%d\n",
port_id, viid);
err = viid;
goto err_free_dev;
}
pi->viid = viid;
/* /*
* Initialize the hardware/software state for the port. * Initialize the hardware/software state for the port.
*/ */
...@@ -3302,13 +3320,13 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev, ...@@ -3302,13 +3320,13 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
if (netdev == NULL) if (netdev == NULL)
continue; continue;
pi = netdev_priv(netdev); pi = netdev_priv(netdev);
if (pi->viid)
t4vf_free_vi(adapter, pi->viid); t4vf_free_vi(adapter, pi->viid);
if (test_bit(pidx, &adapter->registered_device_map)) if (test_bit(pidx, &adapter->registered_device_map))
unregister_netdev(netdev); unregister_netdev(netdev);
free_netdev(netdev); free_netdev(netdev);
} }
err_unmap_bar:
if (!is_t4(adapter->params.chip)) if (!is_t4(adapter->params.chip))
iounmap(adapter->bar2); iounmap(adapter->bar2);
...@@ -3381,6 +3399,7 @@ static void cxgb4vf_pci_remove(struct pci_dev *pdev) ...@@ -3381,6 +3399,7 @@ static void cxgb4vf_pci_remove(struct pci_dev *pdev)
continue; continue;
pi = netdev_priv(netdev); pi = netdev_priv(netdev);
if (pi->viid)
t4vf_free_vi(adapter, pi->viid); t4vf_free_vi(adapter, pi->viid);
free_netdev(netdev); free_netdev(netdev);
} }
......
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