V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
feng32
V2EX  ›  程序员

Linux 下用户态程序如何使用 SO_TXTIME 属性指定报文的发送时间?

  •  
  •   feng32 · Sep 15, 2022 · 1234 views
    This topic created in 1321 days ago, the information mentioned may be changed or developed.
    Intel(R) Ethernet Controller I210 and other NICs provide the LaunchTime feature which enables frames to be transmitted at specific times. In Linux, this hardware feature is enabled through the SO_TXTIME sockopt and ETF qdisc.
    

    曾看到一段这样的描述,但是网络上相关的资料太少了。尝试在内核源码中找相关线索,无果

    按照我目前的理解,这个功能应该是内核通过 getsockopt / setsockopt API 暴露给用户态程序的。但是这对 TCP 传输来说似乎没有意义,适用场景大概是 UDP / ICMP / RAW socket 等传输

    2 replies    2022-09-16 08:56:09 +08:00
    pagxir
        1
    pagxir  
       Sep 16, 2022 via Android
    你的使用 sendmsg 的 api ,然后在 msghdr 指定 scm_txtime 。然后 queue 也需要配置
    julyclyde
        2
    julyclyde  
       Sep 16, 2022
    times 是次数( times 本身的复数形式)还是时间(多个 frames 各自的 time )呀?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1004 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 98ms · UTC 19:19 · PVG 03:19 · LAX 12:19 · JFK 15:19
    ♥ Do have faith in what you're doing.