Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
You need to sign in or sign up before continuing.
  • linux
  • net
  • core
  • dev.c
Find file BlameHistoryPermalink
  • Peilin Ye's avatar
    bpf: Fix dev's rx stats for bpf_redirect_peer traffic · 024ee930
    Peilin Ye authored Nov 14, 2023
    Traffic redirected by bpf_redirect_peer() (used by recent CNIs like Cilium)
    is not accounted for in the RX stats of supported devices (that is, veth
    and netkit), confusing user space metrics collectors such as cAdvisor [0],
    as reported by Youlun.
    
    Fix it by calling dev_sw_netstats_rx_add() in skb_do_redirect(), to update
    RX traffic counters. Devices that support ndo_get_peer_dev _must_ use the
    @tstats per-CPU counters (instead of @lstats, or @dstats).
    
    To make this more fool-proof, error out when ndo_get_peer_dev is set but
    @tstats are not selected.
    
      [0] Specifically, the "container_network_receive_{byte,packet}s_total"
          counters are affected.
    
    Fixes: 9aa1206e
    
     ("bpf: Add redirect_peer helper")
    Reported-by: default avatarYoulun Zhang <zhangyoulun@bytedance.com>
    Signed-off-by: default avatarPeilin Ye <peilin.ye@bytedance.com>
    Co-developed-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
    Link: https://lore.kernel.org/r/20231114004220.6495-6-daniel@iogearbox.net
    
    
    Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
    024ee930
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7