aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ibmveth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ibmveth.c')
-rw-r--r--drivers/net/ibmveth.c27
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 }