i'm implementing flow control in custom protocol in linux kernel. when receive ack, want remove acked packets write queue. here's code
for(i = (ack->sequence - qp->first_unack); i>0&&sk->sk_write_queue.qlen>0; i++){ skb_del = skb_dequeue(&sk->sk_write_queue); qp->first_unack++; kfree_skb(skb_del); }
i kernel freeze code. works however, when comment out kfree(skb_del)
. ideas why happening? how else can free memory?
as skbs queued socket can use provided socket apis;
sk_eat_skb(struct sock *sk, struct sk_buff *skb, bool copied_early) // copied_ealy = 0
for more details can track tcp_recvmsg, there impementation flow
moreove why using custom apis queuing/dequeuing loop on own. go through include/net/sock.h
hope necessary details
Comments
Post a Comment