sock_queu_rcv_skb()函数的实现如下:


/*
 * Queue a received datagram if it will fit. Stream and sequenced protocols
 * can't normally use this as they need to fit buffers in and play with them.
 */

int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
{
 unsigned long flags;
 if(sk->rmem_alloc + skb->mem_len >= sk->rcvbuf)
  return -ENOMEM;
 save_flags(flags);
 cli();
 sk->rmem_alloc+=skb->mem_len;
 skb->sk=sk;
 restore_flags(flags);
 skb_queue_tail(&sk->receive_queue,skb);
 if(!sk->dead)
  sk->data_ready(sk,skb->len);
 return 0;
}
 


  这里完成了数据包从网络层到传输层的传输。下面的博文将会分析数据包的从上到下的传输过程。

  本文转自:http://blog.csdn.net/yming0221/article/details/7492423