Commit ca04657b authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher

i40e: check for netdev before debugfs use

Make sure the VSI has a netdev before trying to use it
in the debugfs netdev_ops commands.

Change-ID: I2d744fc0c32b3226534ce2cde171d9675c5440a6
Signed-off-by: default avatarShannon Nelson <shannon.nelson@intel.com>
Signed-off-by: default avatarCatherine Sullivan <catherine.sullivan@intel.com>
Tested-by: default avatarKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent c5503603
...@@ -2087,9 +2087,13 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp, ...@@ -2087,9 +2087,13 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
if (!vsi) { if (!vsi) {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"tx_timeout: VSI %d not found\n", vsi_seid); "tx_timeout: VSI %d not found\n", vsi_seid);
goto netdev_ops_write_done; } else if (!vsi->netdev) {
} dev_info(&pf->pdev->dev, "tx_timeout: no netdev for VSI %d\n",
if (rtnl_trylock()) { vsi_seid);
} else if (test_bit(__I40E_DOWN, &vsi->state)) {
dev_info(&pf->pdev->dev, "tx_timeout: VSI %d not UP\n",
vsi_seid);
} else if (rtnl_trylock()) {
vsi->netdev->netdev_ops->ndo_tx_timeout(vsi->netdev); vsi->netdev->netdev_ops->ndo_tx_timeout(vsi->netdev);
rtnl_unlock(); rtnl_unlock();
dev_info(&pf->pdev->dev, "tx_timeout called\n"); dev_info(&pf->pdev->dev, "tx_timeout called\n");
...@@ -2108,9 +2112,10 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp, ...@@ -2108,9 +2112,10 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
if (!vsi) { if (!vsi) {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"change_mtu: VSI %d not found\n", vsi_seid); "change_mtu: VSI %d not found\n", vsi_seid);
goto netdev_ops_write_done; } else if (!vsi->netdev) {
} dev_info(&pf->pdev->dev, "change_mtu: no netdev for VSI %d\n",
if (rtnl_trylock()) { vsi_seid);
} else if (rtnl_trylock()) {
vsi->netdev->netdev_ops->ndo_change_mtu(vsi->netdev, vsi->netdev->netdev_ops->ndo_change_mtu(vsi->netdev,
mtu); mtu);
rtnl_unlock(); rtnl_unlock();
...@@ -2129,9 +2134,10 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp, ...@@ -2129,9 +2134,10 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
if (!vsi) { if (!vsi) {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"set_rx_mode: VSI %d not found\n", vsi_seid); "set_rx_mode: VSI %d not found\n", vsi_seid);
goto netdev_ops_write_done; } else if (!vsi->netdev) {
} dev_info(&pf->pdev->dev, "set_rx_mode: no netdev for VSI %d\n",
if (rtnl_trylock()) { vsi_seid);
} else if (rtnl_trylock()) {
vsi->netdev->netdev_ops->ndo_set_rx_mode(vsi->netdev); vsi->netdev->netdev_ops->ndo_set_rx_mode(vsi->netdev);
rtnl_unlock(); rtnl_unlock();
dev_info(&pf->pdev->dev, "set_rx_mode called\n"); dev_info(&pf->pdev->dev, "set_rx_mode called\n");
...@@ -2149,11 +2155,14 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp, ...@@ -2149,11 +2155,14 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
if (!vsi) { if (!vsi) {
dev_info(&pf->pdev->dev, "napi: VSI %d not found\n", dev_info(&pf->pdev->dev, "napi: VSI %d not found\n",
vsi_seid); vsi_seid);
goto netdev_ops_write_done; } else if (!vsi->netdev) {
dev_info(&pf->pdev->dev, "napi: no netdev for VSI %d\n",
vsi_seid);
} else {
for (i = 0; i < vsi->num_q_vectors; i++)
napi_schedule(&vsi->q_vectors[i]->napi);
dev_info(&pf->pdev->dev, "napi called\n");
} }
for (i = 0; i < vsi->num_q_vectors; i++)
napi_schedule(&vsi->q_vectors[i]->napi);
dev_info(&pf->pdev->dev, "napi called\n");
} else { } else {
dev_info(&pf->pdev->dev, "unknown command '%s'\n", dev_info(&pf->pdev->dev, "unknown command '%s'\n",
i40e_dbg_netdev_ops_buf); i40e_dbg_netdev_ops_buf);
......
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