int dev_close(struct device *dev) { /* * Only close a device if it is up. */ if (dev->flags != 0) { int ct=0; dev->flags = 0; /* * Call the device specific close. This cannot fail. */ if (dev->stop) dev->stop(dev); notifier_call_chain(&netdev_chain, NETDEV_DOWN, dev); #if 0 /* * Delete the route to the device. */ #ifdef CONFIG_INET ip_rt_flush(dev); arp_device_down(dev); #endif #ifdef CONFIG_IPX ipxrtr_device_down(dev); #endif #endif /* * Flush the multicast chain */ dev_mc_discard(dev); /* * Blank the IP addresses */ dev->pa_addr = 0; dev->pa_dstaddr = 0; dev->pa_brdaddr = 0; dev->pa_mask = 0; /* * Purge any queued packets when we down the link */ while(ct<DEV_NUMBUFFS) { struct sk_buff *skb; while((skb=skb_dequeue(&dev->buffs[ct]))!=NULL) if(skb->free) kfree_skb(skb,FREE_WRITE); ct++; } } return(0); }
int dev_close(struct device *dev) { int ct=0; /* * Call the device specific close. This cannot fail. * Only if device is UP */ if ((dev->flags & IFF_UP) && dev->stop) dev->stop(dev); /* * Device is now down. */ dev->flags&=~(IFF_UP|IFF_RUNNING); /* * Tell people we are going down */ notifier_call_chain(&netdev_chain, NETDEV_DOWN, dev); /* * Flush the multicast chain */ dev_mc_discard(dev); /* * Purge any queued packets when we down the link */ while(ct<DEV_NUMBUFFS) { struct sk_buff *skb; while((skb=skb_dequeue(&dev->buffs[ct]))!=NULL) if(skb->free) kfree_skb(skb,FREE_WRITE); ct++; } return(0); }