aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ibmveth.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 3bec0f733f01..c04957a7df7d 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -1243,16 +1243,19 @@ const char * buf, size_t count)
1243 1243
1244 if (attr == &veth_active_attr) { 1244 if (attr == &veth_active_attr) {
1245 if (value && !pool->active) { 1245 if (value && !pool->active) {
1246 if(ibmveth_alloc_buffer_pool(pool)) { 1246 if (netif_running(netdev)) {
1247 ibmveth_error_printk("unable to alloc pool\n"); 1247 if(ibmveth_alloc_buffer_pool(pool)) {
1248 return -ENOMEM; 1248 ibmveth_error_printk("unable to alloc pool\n");
1249 } 1249 return -ENOMEM;
1250 pool->active = 1; 1250 }
1251 adapter->pool_config = 1; 1251 pool->active = 1;
1252 ibmveth_close(netdev); 1252 adapter->pool_config = 1;
1253 adapter->pool_config = 0; 1253 ibmveth_close(netdev);
1254 if ((rc = ibmveth_open(netdev))) 1254 adapter->pool_config = 0;
1255 return rc; 1255 if ((rc = ibmveth_open(netdev)))
1256 return rc;
1257 } else
1258 pool->active = 1;
1256 } else if (!value && pool->active) { 1259 } else if (!value && pool->active) {
1257 int mtu = netdev->mtu + IBMVETH_BUFF_OH; 1260 int mtu = netdev->mtu + IBMVETH_BUFF_OH;
1258 int i; 1261 int i;
@@ -1281,23 +1284,29 @@ const char * buf, size_t count)
1281 if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT) 1284 if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT)
1282 return -EINVAL; 1285 return -EINVAL;
1283 else { 1286 else {
1284 adapter->pool_config = 1; 1287 if (netif_running(netdev)) {
1285 ibmveth_close(netdev); 1288 adapter->pool_config = 1;
1286 adapter->pool_config = 0; 1289 ibmveth_close(netdev);
1287 pool->size = value; 1290 adapter->pool_config = 0;
1288 if ((rc = ibmveth_open(netdev))) 1291 pool->size = value;
1289 return rc; 1292 if ((rc = ibmveth_open(netdev)))
1293 return rc;
1294 } else
1295 pool->size = value;
1290 } 1296 }
1291 } else if (attr == &veth_size_attr) { 1297 } else if (attr == &veth_size_attr) {
1292 if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE) 1298 if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE)
1293 return -EINVAL; 1299 return -EINVAL;
1294 else { 1300 else {
1295 adapter->pool_config = 1; 1301 if (netif_running(netdev)) {
1296 ibmveth_close(netdev); 1302 adapter->pool_config = 1;
1297 adapter->pool_config = 0; 1303 ibmveth_close(netdev);
1298 pool->buff_size = value; 1304 adapter->pool_config = 0;
1299 if ((rc = ibmveth_open(netdev))) 1305 pool->buff_size = value;
1300 return rc; 1306 if ((rc = ibmveth_open(netdev)))
1307 return rc;
1308 } else
1309 pool->buff_size = value;
1301 } 1310 }
1302 } 1311 }
1303 1312