Linux 网卡设备驱动程序设计(3)

三。网络子系统深度分析

  用户程序通过网络发送这个网络数据包

  通过

      SCI

      协议无关接口

      协议栈 《   UDP的实现  会选择路由

          《    IP的实现   会建立这个邻居子系统,建立邻居信息

      设备无关接口

      驱动

  函数调用关系(对应上面)

      socket_file_ops

      do_sock_write

      _sock_sendmsg

      (SCI 接口)

      

      udp_sendmsg(路由ip_route_output_flow)

      udp_push_pending_frames

      (选择路由)

      

      ip_push_penging_frames

      ip_local_out(实现防火墙)

      dst_output

      ip_finish_output

      ip_finish_output2(dev->neighbour->output)

      // 邻居子系统

      arp_generic_ops->neigh_resolve_output

      (建立邻居子系统)

      

      dev_queue_xmit

      dev_hard_start_xmit

      (协议无关接口)

    

      dev->netdev_ops->ndo_start_xmit

      (驱动)

      

  2.网卡收到数据包如何交给用户来处理

      收到函数Receive()

      会产生一个中断

      1. 接受

        (1). 从硬件中读取数据到SKB中

        (2).调用Netif_rx()函数

      2.

原文地址:https://www.cnblogs.com/lvxiaoning/p/5080458.html