当前位置:网站首页>USB network card drive data stream
USB network card drive data stream
2022-07-27 11:53:00 【Be good to me】
1. peripheral
1.1 Sending data tx
(1) Application layer through system call , Go to the kernel layer ;
(2) The data link layer of the kernel sends data to the driver layer ;
(3)USB The network card driver sends data to UDC controller ;( take req write in in Endpoint )
(4)UDC The controller writes the register to pass the data phy Send out .
// \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(in, req, GFP_ATOMIC); // take req write in in Endpoint
== 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);
1.2 Receive data rx
(1) Application layer through system call , Go to the kernel layer ;
(2) The data link layer of the kernel sends data to the driver layer ;
(3)USB The network card driver sends data to UDC controller ;( take req write in out Endpoint , Means to read buf)
(4)UDC Controller reception host interrupt ;
(5)req Completion function of ;
(6) The completion function returns the data to the data link layer .
// \drivers\usb\gadget\function\u_ether.c //.ndo_open = eth_open,
== 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;
== req->complete = rx_complete;
== usb_ep_queue(out, req, gfp_flags); // take req write in out Endpoint , Means to read buf
== dwc3_gadget_start(); // Registration interrupted
== request_threaded_irq(irq, dwc3_interrupt, dwc3_thread_interrupt, IRQF_SHARED, "dwc3", dwc->ev_buf);
== dwc3_thread_interrupt(); // Interrupt generation (host Send a message ), Call callback function
== dwc3_process_event_buf(); // Handling interrupt events buf(dwc3_event_buffer )
== dwc3_process_event_entry(); trace_dwc3_event(event->raw, dwc);
== dwc3_endpoint_interrupt(); // Interruption of endpoint processing
== dwc3_gadget_endpoint_transfer_complete(); // Transmission complete
== dwc3_gadget_endpoint_trbs_complete();
== dwc3_gadget_ep_cleanup_completed_requests()
== dwc3_gadget_giveback(); // The data returned
== dwc3_gadget_del_and_unmap_request(); trace_dwc3_gadget_giveback(req);
== usb_gadget_giveback_request() trace_usb_gadget_giveback_request(ep, req, 0);// give the request back to the gadget layer
== req->complete(ep, req);
== rx_complete(struct usb_ep *ep, struct usb_request *req); // u_ether Callback function for
== rx_complete();
== skb_dequeue(); // obtain skb
== netif_rx(struct sk_buff *skb); // post buffer to the network code
2. host
2.1 Sending data tx
(1) Application layer through system call , Go to the kernel layer ;
(2) The data link layer of the kernel sends data to the driver layer ;
(3)USB The network card driver sends data to XHCI controller ;
(4)XHCI The controller writes the register to pass the data phy Send out .
// \drivers\net\usb\usbnet.c .ndo_start_xmit = usbnet_start_xmit,
== usbnet_start_xmit();
== usb_alloc_urb();
== usb_fill_bulk_urb();
== usb_submit_urb();
== 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);
2.2 Receive data rx
(1) Application layer through system call , Go to the kernel layer ;
(2) The data link layer of the kernel sends data to the driver layer ;
(3)USB The network card driver sends data to XHCI controller ;
(4)XHCI The controller receives the interrupt ;
(5)urb Completion function of ;
(6) The completion function returns the data to the data link layer .
// \drivers\net\usb\usbnet.c //.ndo_open = usbnet_open,
== usbnet_open(struct net_device *net);
== tasklet_schedule (&dev->bh);
== usbnet_bh();
== rx_alloc_submit();
== rx_submit(struct usbnet *dev, struct urb *urb, gfp_t flags);
== usb_fill_bulk_urb (urb, dev->udev, dev->in, skb->data, size, rx_complete, skb);
== usb_submit_urb();
== xhci_irq(struct usb_hcd *hcd)
== xhci_handle_event(struct xhci_hcd *xhci) trace_xhci_handle_event(xhci->event_ring, &event->generic);
== handle_tx_event() trace_xhci_handle_transfer(ep_ring, (struct xhci_generic_trb *) ep_trb)
== process_bulk_intr_td() //Process bulk and interrupt tds, update urb status and actual_length.
== finish_td()
== xhci_td_cleanup()
== xhci_giveback_urb_in_irq() trace_xhci_urb_giveback(urb);
== usb_hcd_unlink_urb_from_ep(hcd, urb);
== usb_hcd_giveback_urb(hcd, urb, status);
== urb->complete(urb);
== rx_complete();
== rx_complete();
== defer_bh();
== tasklet_schedule (&dev->bh);
== usbnet_bh(); // tasklet (work deferred from completions, in_irq) or timer
== rx_process(); // skb_state = rx_done
== usbnet_skb_return();
== netif_rx (skb);
边栏推荐
- Adobe audit prompts that the sampling rate of audio input does not match the output device - problem solving
- EfficientNet
- JS-寄生组合式继承
- [unity entry program] creator kitfps: first person shooting 3D game
- NewTicker使用
- [untitled] multimodal model clip
- 数据库 cli 工具 docker 镜像
- Proteus8专业版破解后用数码管闪退的解决
- Sword finger offer notes: t57 - I. and two numbers of S
- 阿里云云数据库RDS版Exception during pool initialization
猜你喜欢

为什么TCP三次握手的时候ACK=Seq+1

SMA TE: Semi-Supervised Spatio-Temporal RepresentationLearning on Multivariate Time Series

【机器学习-白板推导系列】学习笔记---支持向量机和主成分分析法

Could not load dynamic library ‘libcudnn.so.8‘;

IDEA: Can‘t use Subversion command line client:svn 解决方案

严控室外作业时间!佛山住建局发文:加强高温期间建筑施工安全管理

go 用本地代码replace
![[machine learning whiteboard derivation series] learning notes - probability graph model and exponential family distribution](/img/cc/a27db6c5a380102029b85255df79c9.png)
[machine learning whiteboard derivation series] learning notes - probability graph model and exponential family distribution

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

【无标题】多模态模型 CLIP
随机推荐
go语言之sync.Map
数据包传输:应用层-内核-硬件
查看系统下各个进程打开的文件描述符数量
LeetCode 01: T1. 两数之和 ; T1108. IP 地址无效化 ; T344. 反转字符串
LeetCode 02: 剑指 Offer 58 - I. 翻转单词顺序(简单); T123. 验证回文串 ; T9. 回文数
新版数据仓库的同步使用参考(新手向)
Common power supply problems and solutions of Arduino
Difference quotient approximation of wechat quotient
剑指 Offer 笔记: T58 - II. 左旋转字符串
CH340模块无法识别/烧写不进的一种可能性
origin如何作一张图中多张子图是柱状图(或其他图)
Summary of leetcode SQL exercises (MySQL Implementation)
Leetcode 04: T26. Delete duplicate items in the sorting array (simple); Sword finger offer 67. convert the string to an integer (medium); Interview question 01.08. zero matrix (simple)
Temporary use of solo, difficult choice of Blog
剑指 Offer 笔记: T39. 数组中出现次数超过一半的数字
美现首例孕妇猴痘病例:新生儿被注射免疫球蛋白,已安全出生
广东:剧本杀等新行业新业态场所,消防安全监管不再“缺位”
STS下载教程(include官网无法下载解决方案)
shell中的while循环实例
Synchronous use reference of the new version of data warehouse (for beginners)