aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSantiago Leon <santil@us.ibm.com>2008-07-23 14:34:23 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-25 01:44:44 -0400
commitea866e6526b8a2ead92875732d41b26fdb470312 (patch)
treeb6645f5f136691defbe6a73941a05d0649811a37 /drivers
parent22e1a4dd3f2a9009d1d8896a5e833b6094877008 (diff)
ibmveth: Automatically enable larger rx buffer pools for larger mtu
Activates larger rx buffer pools when the MTU is changed to a larger value. This patch de-activates the large rx buffer pools when the MTU changes to a smaller value. Signed-off-by: Santiago Leon <santil@us.ibm.com> Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com> Acked-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ibmveth.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 00527805e4f1..007ca8735a94 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -1054,7 +1054,6 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
1054{ 1054{
1055 struct ibmveth_adapter *adapter = dev->priv; 1055 struct ibmveth_adapter *adapter = dev->priv;
1056 int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; 1056 int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH;
1057 int reinit = 0;
1058 int i, rc; 1057 int i, rc;
1059 1058
1060 if (new_mtu < IBMVETH_MAX_MTU) 1059 if (new_mtu < IBMVETH_MAX_MTU)
@@ -1067,15 +1066,21 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
1067 if (i == IbmVethNumBufferPools) 1066 if (i == IbmVethNumBufferPools)
1068 return -EINVAL; 1067 return -EINVAL;
1069 1068
1069 /* Deactivate all the buffer pools so that the next loop can activate
1070 only the buffer pools necessary to hold the new MTU */
1071 for (i = 0; i < IbmVethNumBufferPools; i++)
1072 if (adapter->rx_buff_pool[i].active) {
1073 ibmveth_free_buffer_pool(adapter,
1074 &adapter->rx_buff_pool[i]);
1075 adapter->rx_buff_pool[i].active = 0;
1076 }
1077
1070 /* Look for an active buffer pool that can hold the new MTU */ 1078 /* Look for an active buffer pool that can hold the new MTU */
1071 for(i = 0; i<IbmVethNumBufferPools; i++) { 1079 for(i = 0; i<IbmVethNumBufferPools; i++) {
1072 if (!adapter->rx_buff_pool[i].active) { 1080 adapter->rx_buff_pool[i].active = 1;
1073 adapter->rx_buff_pool[i].active = 1;
1074 reinit = 1;
1075 }
1076 1081
1077 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { 1082 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) {
1078 if (reinit && netif_running(adapter->netdev)) { 1083 if (netif_running(adapter->netdev)) {
1079 adapter->pool_config = 1; 1084 adapter->pool_config = 1;
1080 ibmveth_close(adapter->netdev); 1085 ibmveth_close(adapter->netdev);
1081 adapter->pool_config = 0; 1086 adapter->pool_config = 0;
@@ -1402,14 +1407,15 @@ const char * buf, size_t count)
1402 return -EPERM; 1407 return -EPERM;
1403 } 1408 }
1404 1409
1405 pool->active = 0;
1406 if (netif_running(netdev)) { 1410 if (netif_running(netdev)) {
1407 adapter->pool_config = 1; 1411 adapter->pool_config = 1;
1408 ibmveth_close(netdev); 1412 ibmveth_close(netdev);
1413 pool->active = 0;
1409 adapter->pool_config = 0; 1414 adapter->pool_config = 0;
1410 if ((rc = ibmveth_open(netdev))) 1415 if ((rc = ibmveth_open(netdev)))
1411 return rc; 1416 return rc;
1412 } 1417 }
1418 pool->active = 0;
1413 } 1419 }
1414 } else if (attr == &veth_num_attr) { 1420 } else if (attr == &veth_num_attr) {
1415 if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT) 1421 if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT)