diff options
author | Brian King <brking@linux.vnet.ibm.com> | 2007-06-08 15:05:17 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-06-09 18:25:34 -0400 |
commit | ce6eea58eb8f50f563663c6e723b4bbbe55b012e (patch) | |
tree | ee771cadeb8650f5b938935e68fe02858e4d2fa3 /drivers | |
parent | 4aa9c93e1c7911866c546651a5efbbf62914092e (diff) |
ibmveth: Automatically enable larger rx buffer pools for larger mtu
Currently, ibmveth maintains several rx buffer pools, which can
be modified through sysfs. By default, pools are not allocated by
default such that jumbo frames cannot be supported without first
activating larger rx buffer pools. This results in failures when attempting
to change the mtu. This patch makes ibmveth automatically allocate
these larger buffer pools when the mtu is changed.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ibmveth.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index c04957a7df7d..6ec3d500f334 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -915,17 +915,36 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu) | |||
915 | { | 915 | { |
916 | struct ibmveth_adapter *adapter = dev->priv; | 916 | struct ibmveth_adapter *adapter = dev->priv; |
917 | int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; | 917 | int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; |
918 | int i; | 918 | int reinit = 0; |
919 | int i, rc; | ||
919 | 920 | ||
920 | if (new_mtu < IBMVETH_MAX_MTU) | 921 | if (new_mtu < IBMVETH_MAX_MTU) |
921 | return -EINVAL; | 922 | return -EINVAL; |
922 | 923 | ||
924 | for (i = 0; i < IbmVethNumBufferPools; i++) | ||
925 | if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) | ||
926 | break; | ||
927 | |||
928 | if (i == IbmVethNumBufferPools) | ||
929 | return -EINVAL; | ||
930 | |||
923 | /* Look for an active buffer pool that can hold the new MTU */ | 931 | /* Look for an active buffer pool that can hold the new MTU */ |
924 | for(i = 0; i<IbmVethNumBufferPools; i++) { | 932 | for(i = 0; i<IbmVethNumBufferPools; i++) { |
925 | if (!adapter->rx_buff_pool[i].active) | 933 | if (!adapter->rx_buff_pool[i].active) { |
926 | continue; | 934 | adapter->rx_buff_pool[i].active = 1; |
935 | reinit = 1; | ||
936 | } | ||
937 | |||
927 | if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { | 938 | if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { |
928 | dev->mtu = new_mtu; | 939 | if (reinit && netif_running(adapter->netdev)) { |
940 | adapter->pool_config = 1; | ||
941 | ibmveth_close(adapter->netdev); | ||
942 | adapter->pool_config = 0; | ||
943 | dev->mtu = new_mtu; | ||
944 | if ((rc = ibmveth_open(adapter->netdev))) | ||
945 | return rc; | ||
946 | } else | ||
947 | dev->mtu = new_mtu; | ||
929 | return 0; | 948 | return 0; |
930 | } | 949 | } |
931 | } | 950 | } |