当前位置:网站首页>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);
边栏推荐
- JS-寄生组合式继承
- Shell script text three swordsman awk
- EfficientNet
- Several banks adjusted the redemption rules of cash management financial products: the confirmation time limit of redemption changed from "t+0" to "t+1"
- 微商的差商近似
- Principle of control system based on feedback rate
- 广东财政多举措助力稳住粮食安全“压舱石”
- Temporary use of solo, difficult choice of Blog
- LAN SDN hard core technology insider 24 outlook for the future - RDMA (middle)
- Wilcoxon rank sum and signed rank
猜你喜欢

Adobe audit prompts that the sampling rate of audio input does not match the output device - problem solving

Principle, concept and construction process of MySQL database master-slave replication cluster

PWM的原理和PWM波的产生

求不同采样周期下的传递函数有限零点

N ¨UWA: Visual Synthesis Pre-training for Neural visUal World creAtionChenfei

Iptables firewall

阿里云云数据库RDS版Exception during pool initialization

Interaction free shell programming

npm踩坑

快抖抢救“失意人”
随机推荐
Iptables firewall
Shell脚本文本三剑客之sed
解决方案:idea project没有显示树状图
Unexpected harvest of epic distributed resources, from basic to advanced are full of dry goods, big guys are strong!
LeetCode 03: T58. 最后一个单词的长度(简单); 剑指 Offer 05. 替换空格(简单); 剑指 Offer 58 - II. 左旋转字符串(简单)
多种进制之间的转换
日本福岛废堆安全监视协议会认可排海计划“安全”
EfficientNet
我在英国TikTok做直播电商
Sword finger offer notes: T53 - ii Missing numbers from 0 to n-1
剑指 Offer 笔记: T53 - II. 0~n-1 中缺失的数字
Synchronous use reference of the new version of data warehouse (for beginners)
A possibility that ch340 module cannot be recognized / burned
[machine learning whiteboard derivation series] learning notes --- conditional random fields
N ¨UWA: Visual Synthesis Pre-training for Neural visUal World creAtionChenfei
Can you really write binary search - variant binary search
Principle, concept and construction process of MySQL database master-slave replication cluster
kazoo使用教程
N ¨UWA: Visual Synthesis Pre-training for Neural visUal World creAtionChenfei
Keil MDK编译出现..\USER\stm32f10x.h(428): error: #67: expected a “}“错误的解决办法