aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ibmveth.c
diff options
context:
space:
mode:
authorRobert Jennings <rcj@linux.vnet.ibm.com>2010-08-17 05:15:45 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-19 03:09:48 -0400
commit0645bab7da3cb021157e5c661ef35f1d1226785a (patch)
tree8bdc3c309ca649e2410eed484ac50ff8973c3984 /drivers/net/ibmveth.c
parent2928db4c3c62552d3caf9ab53ccc6f7ae9865a23 (diff)
ibmveth: Fix opps during MTU change on an active device
This fixes the following opps which can occur when trying to deallocate receive buffer pools when changing the MTU of an active ibmveth device. Oops: Kernel access of bad area, sig: 11 [#1] NIP: d000000004db00e8 LR: d000000004db00ac CTR: 0000000000591038 REGS: c00000007fff39d0 TRAP: 0300 Not tainted (2.6.36-rc1) MSR: 8000000000009032 <EE,ME,IR,DR> CR: 22248244 XER: 00000002 DAR: 0000000000000488, DSISR: 0000000042000000 TASK = c00000007c463790[6531] 'netserver' THREAD: c00000007a154000 CPU: 0 GPR00: 0000000000000000 c00000007fff3c50 d000000004dbd360 0000000000000001 GPR04: 0000000000000001 1fffffffffffffff 000000000000043c c00000007a8e9f60 GPR08: c00000007a8e9e20 0000000000000245 0000000000000488 0000000000000000 GPR12: 00000000000000c0 c000000006d70000 c00000007bfec098 c00000007bfebc2c GPR16: c00000007a157c78 0000000000000000 0000000000000001 0000000000000000 GPR20: 0000000000000001 0000000000000010 c000000000b51180 c00000007a8e9d90 GPR24: c00000007a8e9da0 c00000007a8e9580 00000000000005ea 00000000000002ff GPR28: 0000000000000004 0000000000000080 c000000000a946f8 c00000007a8e9d80 NIP [d000000004db00e8] .ibmveth_remove_buffer_from_pool+0xe8/0x130 [ibmveth] LR [d000000004db00ac] .ibmveth_remove_buffer_from_pool+0xac/0x130 [ibmveth] Call Trace: [c00000007fff3c50] [d000000004db00ac] .ibmveth_remove_buffer_from_pool+0xac/0x130 [ibmveth] (unreliable) [c00000007fff3cf0] [d000000004db31dc] .ibmveth_poll+0x30c/0x460 [ibmveth] [c00000007fff3dd0] [c00000000042c4b8] .net_rx_action+0x178/0x278 [c00000007fff3eb0] [c000000000093cf0] .__do_softirq+0x118/0x1f8 [c00000007fff3f90] [c00000000002ab3c] .call_do_softirq+0x14/0x24 [c00000007a157600] [c00000000000e3e4] .do_softirq+0xec/0x110 [c00000007a1576a0] [c000000000093394] .local_bh_enable_ip+0xb4/0xe0 [c00000007a157720] [c0000000004f0bac] ._raw_spin_unlock_bh+0x3c/0x50 [c00000007a157790] [c0000000004186e0] .release_sock+0x158/0x188 [c00000007a157840] [c000000000479660] .tcp_recvmsg+0x560/0x9b8 [c00000007a157970] [c0000000004a0d78] .inet_recvmsg+0x80/0xd8 [c00000007a157a00] [c000000000413e28] .sock_recvmsg+0x128/0x178 [c00000007a157bf0] [c0000000004164ac] .SyS_recvfrom+0xb4/0x148 [c00000007a157d70] [c000000000411f3c] .SyS_socketcall+0x274/0x360 [c00000007a157e30] [c0000000000085b4] syscall_exit+0x0/0x40 Reported-by: Rafael Camarda Silva Folco <rfolco@linux.vnet.ibm.com> Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com> Acked-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ibmveth.c')
-rw-r--r--drivers/net/ibmveth.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 2602852cc55a..4734c939ad03 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -1113,7 +1113,8 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
1113 struct ibmveth_adapter *adapter = netdev_priv(dev); 1113 struct ibmveth_adapter *adapter = netdev_priv(dev);
1114 struct vio_dev *viodev = adapter->vdev; 1114 struct vio_dev *viodev = adapter->vdev;
1115 int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; 1115 int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH;
1116 int i; 1116 int i, rc;
1117 int need_restart = 0;
1117 1118
1118 if (new_mtu < IBMVETH_MAX_MTU) 1119 if (new_mtu < IBMVETH_MAX_MTU)
1119 return -EINVAL; 1120 return -EINVAL;
@@ -1127,35 +1128,32 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
1127 1128
1128 /* Deactivate all the buffer pools so that the next loop can activate 1129 /* Deactivate all the buffer pools so that the next loop can activate
1129 only the buffer pools necessary to hold the new MTU */ 1130 only the buffer pools necessary to hold the new MTU */
1130 for (i = 0; i < IbmVethNumBufferPools; i++) 1131 if (netif_running(adapter->netdev)) {
1131 if (adapter->rx_buff_pool[i].active) { 1132 need_restart = 1;
1132 ibmveth_free_buffer_pool(adapter, 1133 adapter->pool_config = 1;
1133 &adapter->rx_buff_pool[i]); 1134 ibmveth_close(adapter->netdev);
1134 adapter->rx_buff_pool[i].active = 0; 1135 adapter->pool_config = 0;
1135 } 1136 }
1136 1137
1137 /* Look for an active buffer pool that can hold the new MTU */ 1138 /* Look for an active buffer pool that can hold the new MTU */
1138 for(i = 0; i<IbmVethNumBufferPools; i++) { 1139 for(i = 0; i<IbmVethNumBufferPools; i++) {
1139 adapter->rx_buff_pool[i].active = 1; 1140 adapter->rx_buff_pool[i].active = 1;
1140 1141
1141 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { 1142 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) {
1142 if (netif_running(adapter->netdev)) {
1143 adapter->pool_config = 1;
1144 ibmveth_close(adapter->netdev);
1145 adapter->pool_config = 0;
1146 dev->mtu = new_mtu;
1147 vio_cmo_set_dev_desired(viodev,
1148 ibmveth_get_desired_dma
1149 (viodev));
1150 return ibmveth_open(adapter->netdev);
1151 }
1152 dev->mtu = new_mtu; 1143 dev->mtu = new_mtu;
1153 vio_cmo_set_dev_desired(viodev, 1144 vio_cmo_set_dev_desired(viodev,
1154 ibmveth_get_desired_dma 1145 ibmveth_get_desired_dma
1155 (viodev)); 1146 (viodev));
1147 if (need_restart) {
1148 return ibmveth_open(adapter->netdev);
1149 }
1156 return 0; 1150 return 0;
1157 } 1151 }
1158 } 1152 }
1153
1154 if (need_restart && (rc = ibmveth_open(adapter->netdev)))
1155 return rc;
1156
1159 return -EINVAL; 1157 return -EINVAL;
1160} 1158}
1161 1159