aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShannon Nelson <shannon.nelson@intel.com>2014-03-06 04:00:02 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-03-28 09:54:00 -0400
commitca04657b9d529f11ca6f85f83016d77bcb41b6b4 (patch)
tree094d75e001ce3ff4c5e3cbe15006ea39e32156b9
parentc5503603430bb255f67f518466fd79e924aabe31 (diff)
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: Shannon Nelson <shannon.nelson@intel.com> Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com> Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_debugfs.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index afd43d7973fa..3c37386fd138 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -2087,9 +2087,13 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
2087 if (!vsi) { 2087 if (!vsi) {
2088 dev_info(&pf->pdev->dev, 2088 dev_info(&pf->pdev->dev,
2089 "tx_timeout: VSI %d not found\n", vsi_seid); 2089 "tx_timeout: VSI %d not found\n", vsi_seid);
2090 goto netdev_ops_write_done; 2090 } else if (!vsi->netdev) {
2091 } 2091 dev_info(&pf->pdev->dev, "tx_timeout: no netdev for VSI %d\n",
2092 if (rtnl_trylock()) { 2092 vsi_seid);
2093 } else if (test_bit(__I40E_DOWN, &vsi->state)) {
2094 dev_info(&pf->pdev->dev, "tx_timeout: VSI %d not UP\n",
2095 vsi_seid);
2096 } else if (rtnl_trylock()) {
2093 vsi->netdev->netdev_ops->ndo_tx_timeout(vsi->netdev); 2097 vsi->netdev->netdev_ops->ndo_tx_timeout(vsi->netdev);
2094 rtnl_unlock(); 2098 rtnl_unlock();
2095 dev_info(&pf->pdev->dev, "tx_timeout called\n"); 2099 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 if (!vsi) { 2112 if (!vsi) {
2109 dev_info(&pf->pdev->dev, 2113 dev_info(&pf->pdev->dev,
2110 "change_mtu: VSI %d not found\n", vsi_seid); 2114 "change_mtu: VSI %d not found\n", vsi_seid);
2111 goto netdev_ops_write_done; 2115 } else if (!vsi->netdev) {
2112 } 2116 dev_info(&pf->pdev->dev, "change_mtu: no netdev for VSI %d\n",
2113 if (rtnl_trylock()) { 2117 vsi_seid);
2118 } else if (rtnl_trylock()) {
2114 vsi->netdev->netdev_ops->ndo_change_mtu(vsi->netdev, 2119 vsi->netdev->netdev_ops->ndo_change_mtu(vsi->netdev,
2115 mtu); 2120 mtu);
2116 rtnl_unlock(); 2121 rtnl_unlock();
@@ -2129,9 +2134,10 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
2129 if (!vsi) { 2134 if (!vsi) {
2130 dev_info(&pf->pdev->dev, 2135 dev_info(&pf->pdev->dev,
2131 "set_rx_mode: VSI %d not found\n", vsi_seid); 2136 "set_rx_mode: VSI %d not found\n", vsi_seid);
2132 goto netdev_ops_write_done; 2137 } else if (!vsi->netdev) {
2133 } 2138 dev_info(&pf->pdev->dev, "set_rx_mode: no netdev for VSI %d\n",
2134 if (rtnl_trylock()) { 2139 vsi_seid);
2140 } else if (rtnl_trylock()) {
2135 vsi->netdev->netdev_ops->ndo_set_rx_mode(vsi->netdev); 2141 vsi->netdev->netdev_ops->ndo_set_rx_mode(vsi->netdev);
2136 rtnl_unlock(); 2142 rtnl_unlock();
2137 dev_info(&pf->pdev->dev, "set_rx_mode called\n"); 2143 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 if (!vsi) { 2155 if (!vsi) {
2150 dev_info(&pf->pdev->dev, "napi: VSI %d not found\n", 2156 dev_info(&pf->pdev->dev, "napi: VSI %d not found\n",
2151 vsi_seid); 2157 vsi_seid);
2152 goto netdev_ops_write_done; 2158 } else if (!vsi->netdev) {
2159 dev_info(&pf->pdev->dev, "napi: no netdev for VSI %d\n",
2160 vsi_seid);
2161 } else {
2162 for (i = 0; i < vsi->num_q_vectors; i++)
2163 napi_schedule(&vsi->q_vectors[i]->napi);
2164 dev_info(&pf->pdev->dev, "napi called\n");
2153 } 2165 }
2154 for (i = 0; i < vsi->num_q_vectors; i++)
2155 napi_schedule(&vsi->q_vectors[i]->napi);
2156 dev_info(&pf->pdev->dev, "napi called\n");
2157 } else { 2166 } else {
2158 dev_info(&pf->pdev->dev, "unknown command '%s'\n", 2167 dev_info(&pf->pdev->dev, "unknown command '%s'\n",
2159 i40e_dbg_netdev_ops_buf); 2168 i40e_dbg_netdev_ops_buf);