Messages in this thread | | | Subject | Problem with deallocating sk_buffs | From | Josip Gracin <> | Date | 03 Apr 1998 09:18:12 +0200 |
| |
Hello!
I'm writing a simple protocol for testing purposes. The protocol has to send a frame which is not associated with any sock structure. Here is what I use to create and send a frame:
struct sk_buff *skb;
size = dev->hard_header_len + AMTP_PKT_SIZE; skb = alloc_skb (size, GFP_ATOMIC); skb_reserve (skb, dev->hard_header_len); pkt = (char *) skb_put (skb, AMTP_PKT_SIZE); skb->arp = 1; skb->dev = dev; skb->sk = NULL; skb->free = 1;
dev->hard_header (skb, dev, ETH_P_AMTP, (void *) dstaddr, NULL, skb->len); dev_queue_xmit (skb, dev, SOPRI_NORMAL);
I also have a user space program which kicks the above code using ioctl(). The problem is in a memory leak when user space program is making successive calls very fast. For example, in the following program everything works all right until I remove the usleep():
for (;;) { /* system call to the above kernel code */ kr = ioctl (sfd, SIOCXMITPKT, ...); usleep (100000); }
If I remove the call to usleep(), the number of the "Networking buffers in use" starts to rise and the buffers never get deallocated.
Also, after some time, tcpdump doesn't show any more packets being sent while ioctl() returns without reporting an error. Other processes are normally able to use the network device. Only frames generated with ioctl() and the above code are not passed to tcpdump (nor to the network, which I unfortunately can't check at the moment).
What am I doing wrong, or more probably, what am I not doing that I should be doing? Kernel version 2.0.33 (has to be).
Thanks!
-- | Josip Gracin, student at Faculty of EE and Computing in Zagreb, Croatia | mailto:grac@fly.cc.fer.hr, http://fly.cc.fer.hr/~grac
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |