diff options
Diffstat (limited to 'net/phonet')
-rw-r--r-- | net/phonet/pep-gprs.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c index e6e8e44852e5..22848dd7d67a 100644 --- a/net/phonet/pep-gprs.c +++ b/net/phonet/pep-gprs.c | |||
@@ -155,12 +155,13 @@ static void gprs_data_ready(struct sock *sk, int len) | |||
155 | static void gprs_write_space(struct sock *sk) | 155 | static void gprs_write_space(struct sock *sk) |
156 | { | 156 | { |
157 | struct gprs_dev *dev = sk->sk_user_data; | 157 | struct gprs_dev *dev = sk->sk_user_data; |
158 | struct net_device *net = dev->net; | ||
158 | unsigned credits = pep_writeable(sk); | 159 | unsigned credits = pep_writeable(sk); |
159 | 160 | ||
160 | spin_lock_bh(&dev->tx_lock); | 161 | spin_lock_bh(&dev->tx_lock); |
161 | dev->tx_max = credits; | 162 | dev->tx_max = credits; |
162 | if (credits > skb_queue_len(&dev->tx_queue)) | 163 | if (credits > skb_queue_len(&dev->tx_queue) && netif_running(net)) |
163 | netif_wake_queue(dev->net); | 164 | netif_wake_queue(net); |
164 | spin_unlock_bh(&dev->tx_lock); | 165 | spin_unlock_bh(&dev->tx_lock); |
165 | } | 166 | } |
166 | 167 | ||
@@ -168,6 +169,23 @@ static void gprs_write_space(struct sock *sk) | |||
168 | * Network device callbacks | 169 | * Network device callbacks |
169 | */ | 170 | */ |
170 | 171 | ||
172 | static int gprs_open(struct net_device *dev) | ||
173 | { | ||
174 | struct gprs_dev *gp = netdev_priv(dev); | ||
175 | |||
176 | gprs_write_space(gp->sk); | ||
177 | return 0; | ||
178 | } | ||
179 | |||
180 | static int gprs_close(struct net_device *dev) | ||
181 | { | ||
182 | struct gprs_dev *gp = netdev_priv(dev); | ||
183 | |||
184 | netif_stop_queue(dev); | ||
185 | flush_work(&gp->tx_work); | ||
186 | return 0; | ||
187 | } | ||
188 | |||
171 | static int gprs_xmit(struct sk_buff *skb, struct net_device *net) | 189 | static int gprs_xmit(struct sk_buff *skb, struct net_device *net) |
172 | { | 190 | { |
173 | struct gprs_dev *dev = netdev_priv(net); | 191 | struct gprs_dev *dev = netdev_priv(net); |
@@ -248,6 +266,8 @@ static void gprs_setup(struct net_device *net) | |||
248 | net->tx_queue_len = 10; | 266 | net->tx_queue_len = 10; |
249 | 267 | ||
250 | net->destructor = free_netdev; | 268 | net->destructor = free_netdev; |
269 | net->open = gprs_open; | ||
270 | net->stop = gprs_close; | ||
251 | net->hard_start_xmit = gprs_xmit; /* mandatory */ | 271 | net->hard_start_xmit = gprs_xmit; /* mandatory */ |
252 | net->change_mtu = gprs_set_mtu; | 272 | net->change_mtu = gprs_set_mtu; |
253 | } | 273 | } |
@@ -311,7 +331,6 @@ int gprs_attach(struct sock *sk) | |||
311 | dev->sk = sk; | 331 | dev->sk = sk; |
312 | 332 | ||
313 | printk(KERN_DEBUG"%s: attached\n", net->name); | 333 | printk(KERN_DEBUG"%s: attached\n", net->name); |
314 | gprs_write_space(sk); /* kick off TX */ | ||
315 | return net->ifindex; | 334 | return net->ifindex; |
316 | 335 | ||
317 | out_rel: | 336 | out_rel: |
@@ -334,7 +353,5 @@ void gprs_detach(struct sock *sk) | |||
334 | 353 | ||
335 | printk(KERN_DEBUG"%s: detached\n", net->name); | 354 | printk(KERN_DEBUG"%s: detached\n", net->name); |
336 | unregister_netdev(net); | 355 | unregister_netdev(net); |
337 | flush_scheduled_work(); | ||
338 | sock_put(sk); | 356 | sock_put(sk); |
339 | skb_queue_purge(&dev->tx_queue); | ||
340 | } | 357 | } |