当前位置:网站首页>Packet transmission: application layer - kernel - hardware
Packet transmission: application layer - kernel - hardware
2022-07-27 11:53:00 【Be good to me】
following , Sort out the ping request message , from application layer , the kernel , arrive Hardware , Of data path.
1. application layer
// application layer
busybox/ping.c
== ping_main()
== common_ping_main()
== ping()
== create_icmp_socket()
== socket(AF_INET, SOCK_RAW, 1);
== ping4()
== sendping4()
== sendping_tail()
== xsendto()
== sendto() // system call
2. kernel
2.1 kernel - The Internet
// (1) kernel - The Internet
// net/socket.c
== __sys_sendto() // sendto() The system call service program in the kernel is __sys_sendto()
== sock_sendmsg()
== sock_sendmsg_nosec()
== raw_sendmsg() // sock->ops->sendmsg, Application layer usage SOCK_RAW establish socket, so sock->ops->sendmsg Point to raw_sendmsg()
// net/ipv4/ip_output.c
== ip_push_pending_frames()
== ip_send_skb()
== ip_local_out()
== __ip_local_out() // after NF Of LOCAL_OUT hookpoint
== dst_output()
== ip_output() // skb_dst(skb)->output
== ip_finish_output()
== __ip_finish_output()
== ip_finish_output2()
// net/core/neighbour.c/h
== neigh_output()
== neigh_resolve_output()
// net/core/dev.c
== dev_queue_xmit()
== __dev_queue_xmit()
== dev_hard_start_xmit()
== xmit_one()
// include/linux/netdevice.h
== netdev_start_xmit()
== __netdev_start_xmit()
== ops->ndo_start_xmit(skb, dev); // Feed drive
== dev_open(struct net_device *dev);
== __dev_open();
== ops->ndo_open(dev);
== eth_open(struct net_device *net);
== eth_start(struct eth_dev *dev, gfp_t gfp_flags);
== rx_fill(struct eth_dev *dev, gfp_t gfp_flags);
== rx_submit(struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags);
req->complete = rx_complete;
== rx_complete(struct usb_ep *ep, struct usb_request *req);
== dev->unwrap(dev->port_usb, skb, &dev->rx_frames);
== eem_unwrap();
2.2 kernel - drive
// (2) kernel - drive
// drivers/net/usb/lan78xx.c
== lan78xx_start_xmit() // .ndo_start_xmit = lan78xx_start_xmit
== skb_queue_tail() // Insert queue
== tasklet_schedule(&dev->bh); // Trigger task scheduling lan78xx_bh
== lan78xx_bh()
== lan78xx_tx_bh()
== skb_dequeue() // Take out the data
== usb_fill_bulk_urb() // Fill data to USB
// drivers/usb/core
== usb_submit_urb() // USB send data
about usb gadget In mode , Use function eem Network card driver for :
// \drivers\usb\gadget\function\u_ether.c // .ndo_start_xmit = eth_start_xmit,
== eth_start_xmit(struct sk_buff *skb, struct net_device *net)
== usb_ep_queue(struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) // Insert queue
== ret = ep->ops->queue(ep, req, gfp_flags);
== dwc3_gadget_ep_queue();
== __dwc3_gadget_ep_queue();
== __dwc3_gadget_kick_transfer();
== dwc3_prepare_trbs();
== dwc3_send_gadget_ep_cmd(); trace_dwc3_gadget_ep_cmd(dep, cmd, params, cmd_status);
== dwc3_writel(dep->regs, DWC3_DEPCMDPAR0, params->param0);
3. Hardware
// Hardware
== usb_submit_urb(cmdinfo->cmd_urb, GFP_ATOMIC);
== usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags)
hcd->driver->urb_enqueue(hcd, urb, mem_flags);
== xhci_urb_enqueue(); trace_xhci_urb_enqueue(urb);
== xhci_queue_bulk_tx(); // Bulk transfer
== prepare_transfer();
== usb_hcd_link_urb_to_ep() //add an URB to its endpoint queue
== list_add_tail(&urb->urb_list, &urb->ep->urb_list);
== queue_trb() trace_xhci_queue_trb(ring, trb); //queueing a TRB on a ring
== inc_enq() trace_xhci_inc_enq(ring);
== giveback_first_trb() //Pass all the TRBs to the hardware at once and make sure this write isn't reordered.
== xhci_ring_ep_doorbell() trace_xhci_ring_ep_doorbell(slot_id, DB_VALUE(ep_index, stream_id));
== writel(DB_VALUE(ep_index, stream_id), db_addr);
边栏推荐
- 意外收获史诗级分布式资源,从基础到进阶都干货满满,大佬就是强!
- w.r.t. ; i.e.; etc.; e. G. what does it mean
- Beyond Compare 3 下一个差异段/向下搜索箭头 找不到了
- Adobe Audition提示 音频输入的采样率与输出设备不匹配——问题解决
- 广东:剧本杀等新行业新业态场所,消防安全监管不再“缺位”
- 暂用 Solo,博客选择困难
- Principle, concept and construction process of MySQL database master-slave replication cluster
- EfficientNet
- Source code compilation and installation lamp
- kazoo使用教程
猜你喜欢

iptables防火墙

解决方案:Can not issue executeUpdate() or executeLargeUpdate() for SELECTs

Proteus8专业版破解后用数码管闪退的解决

NPM step pit

PWM的原理和PWM波的产生

Why is ack=seq+1 when TCP shakes hands three times

origin如何作一张图中多张子图是柱状图(或其他图)

How to make a graph? Multiple subgraphs in a graph are histogram (or other graphs)

Shell script text three swordsmen sed

源码编译安装LAMP
随机推荐
Difference between verification and calibration
go语言之sync.Map
Firewall firewall
USB 网卡驱动数据流
Sword finger offer note: t45. arrange the array into the smallest number
NewTicker使用
STM32 compilation error: l6235e: more than one section matches selector - cannot all be first/l
剑指 Offer 笔记: T39. 数组中出现次数超过一半的数字
kazoo使用教程
omitempty在go中的使用
Analysis of the use of JUC framework from runnable to callable to futuretask
N ¨UWA: Visual Synthesis Pre-training for Neural visUal World creAtionChenfei
Shell脚本文本三剑客之sed
Docker Mysql的使用note
Detailed explanation of hash table
JS字符串方法总结
iptables防火墙
Open source Flink has datastream connector written with holo or Flink SQL Conn
日本福岛废堆安全监视协议会认可排海计划“安全”
你真的会写二分查找吗——变种二分查找