SlideShare ist ein Scribd-Unternehmen logo
1 von 37
Dive into TC – TC basics

        Jeromy Fu
Agenda
• What’s TC

• How it works

• Basic concepts

• Command and parameters
What’s TC
• TC is abbr. of Traffic Control
  - Rate control
  - Bandwidth management
  - Active Queue Management(AQM)
  - Network Emulator, pkt loss, pkt disorder, pkt
  duplication, pkt delay
  - QoS ( diffserv + rsvp )
  - Many more …
What’s tc
• user-level utilities iproute2( iproute2/tc )
• tc kernel (linux/net/sched)
How it works
How it works
Basic concepts- Qdisc
• Qdisc(Queue discipline)
  - Decide which ones to send first, which ones to delay, and which
  ones to drop
  - class/classful Qdisc: Qdisc with/without configurable internal
  subdivision

• Naming convention:
  - Kernel: sch_*.c (sch_netem.c, sch_tbf.c )
  - iproute2: q_*.c (q_netem.c, q_tbf.c)
Qdisc list
•   Class Based Queueing (CBQ)
•   Hierarchical Token Bucket (HTB)
•   Hierarchical Fair Service Curve (HFSC)
•   ATM Virtual Circuits (ATM)
•   Multi Band Priority Queueing (PRIO)
•   Hardware Multiqueue-aware Multi Band Queuing (MULTIQ)
•   Random Early Detection (RED)
•   Stochastic Fairness Queueing (SFQ)
•   True Link Equalizer (TEQL)
•   Token Bucket Filter (TBF)
•   Generic Random Early Detection (GRED)
•   Differentiated Services marker (DSMARK)
•   Network emulator (NETEM)
•   Deficit Round Robin scheduler (DRR)
•   Ingress Qdisc
Basic concepts- Classification
• Classification(Filter)
  - Used to distinguish among different classes of packets
  and process each class in a specific way.

• Naming convention:
  - Kernel: cls_*.c (cls_u32.c, cls_rsvp.c )
  - iproute2: f_*.c (f_u32.c, f_rsvp.c)
Classification list
•   Elementary classification (BASIC)
•   Traffic-Control Index (TCINDEX)
•   Routing decision (ROUTE)
•   Netfilter mark (FW)
•   Universal 32bit comparisons w/ hashing (U32)
•   IPv4 Resource Reservation Protocol (RSVP)
•   IPv6 Resource Reservation Protocol (RSVP6)
•   Flow classifier
•   Control Group Classifier
•   Extended Matches
•   Metadata
•   Incoming device classification
Basic concepts- Action
• Action
  Actions get attached to classifiers and are invoked after
  a successful classification. They are used to overwrite
  the classification result, instantly drop or redirect
  packets, etc. Works on ingress only.

• Naming convention:
  - Kernel: act_*.c (act_police.c, act_skbedit.c )
  - iproute2: m_*.c (m_police.c, m_pedit.c)
Action list
•   Traffic Policing
•   Generic actions
•   Probability support
•   Redirecting and Mirroring
•   IPtables targets
•   Stateless NAT
•   Packet Editing
•   SKB Editing
Basic concepts- Class
• Classes either contain other Classes, or a Qdisc
  is attached
• Qdiscs and Classes are intimately tied together
TC Commands
• OPTIONS: options are effective for all sub
  commands
• OBJECTS: the object of the tc command
  operates on
• COMMAND: the sub command for each object
TC Commands
TC Qdisc
• Operations on qdisc: add | del | replace |
  change | show
• Handle: qdisc handle used to identify qdisc
• root|ingress|parent CLASSID, specify the
  parent node
qdisc handle
• Qdisc handle is used to identify Qdisc
  - {none|major[:]}
  - none is TC_H_UNSPEC
  - major is 16bits HEX number(Without ‘0x’ prefix)
  - : is optional

• Internally, qdisc_handle = major<<16
classid
• Classid is used to identify Class

  - {none|root|[major]:minor}

  - none is TC_H_UNSPEC, root is TC_H_ROOT

  - major/minor are both 16bits HEX numbers(Without
  ‘0x’ prefix), major is optional

• Internally, classid = (major<<16)|minor
stab and rtab
• stab is Size table, rtab is rate table.
• They’re used to speed up the calculation of
  the transmit time of packets.
• The packet size is aligned to a predefined size
  in the stab slot.
• Then the rtab is used to give the pre-
  calculated time of the aligned packet size.
Linklayer
• Link layer affects packet size, if linklayer is
  set, both mpu and overhead must also be set
Linklayer
stab internal
• szopts: stab relating specifications, some are
  specified by the command, some are
  calculated
• data: the size table.
stab internal - user space
• Averagely distribute(*2) the MTU size into size
  table which has tsize slots
stab internal - kernel
rtab internal - user space
• rtab size is constantly 256
rtab internal - kernel
Measure units
• Rate
Measure units
• Size
Measure units
• time
TC Class
• Tc class can only be applied for classful
  qdisc, such as htb, cbq etc
example
• TBF



• HTB
tbf
• limit/latency
• buffer/burst/maxburst, capcity of token
  bucket: size[/cell]
• mpu: minimum process unit
• rate/peakrate
• Max(Rate/HZ,MTU)
tbf - user space
• latency convert to limit finally
tbf - user space
• rtab initialization
tbf - kernel
tbf - kernel
Tbf dequeue

Weitere ähnliche Inhalte

Was ist angesagt?

eBPF Perf Tools 2019
eBPF Perf Tools 2019eBPF Perf Tools 2019
eBPF Perf Tools 2019Brendan Gregg
 
BPF: Tracing and more
BPF: Tracing and moreBPF: Tracing and more
BPF: Tracing and moreBrendan Gregg
 
Meet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracingMeet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracingViller Hsiao
 
Bottom half in linux kernel
Bottom half in linux kernelBottom half in linux kernel
Bottom half in linux kernelKrishnaPrasad630
 
Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)Brendan Gregg
 
Ninja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersNinja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersChang W. Doh
 
How VXLAN works on Linux
How VXLAN works on LinuxHow VXLAN works on Linux
How VXLAN works on LinuxEtsuji Nakai
 
FD.io Vector Packet Processing (VPP)
FD.io Vector Packet Processing (VPP)FD.io Vector Packet Processing (VPP)
FD.io Vector Packet Processing (VPP)Kirill Tsym
 
Stateful Flow Table - SFT 2020 DPDK users pace summit
Stateful Flow Table - SFT 2020 DPDK users pace summitStateful Flow Table - SFT 2020 DPDK users pace summit
Stateful Flow Table - SFT 2020 DPDK users pace summitAndrey Vesnovaty
 
Fast Userspace OVS with AF_XDP, OVS CONF 2018
Fast Userspace OVS with AF_XDP, OVS CONF 2018Fast Userspace OVS with AF_XDP, OVS CONF 2018
Fast Userspace OVS with AF_XDP, OVS CONF 2018Cheng-Chun William Tu
 
Linux Profiling at Netflix
Linux Profiling at NetflixLinux Profiling at Netflix
Linux Profiling at NetflixBrendan Gregg
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking ExplainedThomas Graf
 
New Ways to Find Latency in Linux Using Tracing
New Ways to Find Latency in Linux Using TracingNew Ways to Find Latency in Linux Using Tracing
New Ways to Find Latency in Linux Using TracingScyllaDB
 
Monitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTapMonitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTapPadraig O'Sullivan
 
Intel DPDK Step by Step instructions
Intel DPDK Step by Step instructionsIntel DPDK Step by Step instructions
Intel DPDK Step by Step instructionsHisaki Ohara
 
VLANs in the Linux Kernel
VLANs in the Linux KernelVLANs in the Linux Kernel
VLANs in the Linux KernelKernel TLV
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The AnswerIan Barber
 

Was ist angesagt? (20)

Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
 
eBPF Perf Tools 2019
eBPF Perf Tools 2019eBPF Perf Tools 2019
eBPF Perf Tools 2019
 
BPF: Tracing and more
BPF: Tracing and moreBPF: Tracing and more
BPF: Tracing and more
 
eBPF/XDP
eBPF/XDP eBPF/XDP
eBPF/XDP
 
Meet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracingMeet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracing
 
Bottom half in linux kernel
Bottom half in linux kernelBottom half in linux kernel
Bottom half in linux kernel
 
Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)
 
Ninja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersNinja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for Beginners
 
How VXLAN works on Linux
How VXLAN works on LinuxHow VXLAN works on Linux
How VXLAN works on Linux
 
FD.io Vector Packet Processing (VPP)
FD.io Vector Packet Processing (VPP)FD.io Vector Packet Processing (VPP)
FD.io Vector Packet Processing (VPP)
 
Stateful Flow Table - SFT 2020 DPDK users pace summit
Stateful Flow Table - SFT 2020 DPDK users pace summitStateful Flow Table - SFT 2020 DPDK users pace summit
Stateful Flow Table - SFT 2020 DPDK users pace summit
 
Fast Userspace OVS with AF_XDP, OVS CONF 2018
Fast Userspace OVS with AF_XDP, OVS CONF 2018Fast Userspace OVS with AF_XDP, OVS CONF 2018
Fast Userspace OVS with AF_XDP, OVS CONF 2018
 
Ixgbe internals
Ixgbe internalsIxgbe internals
Ixgbe internals
 
Linux Profiling at Netflix
Linux Profiling at NetflixLinux Profiling at Netflix
Linux Profiling at Netflix
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
 
New Ways to Find Latency in Linux Using Tracing
New Ways to Find Latency in Linux Using TracingNew Ways to Find Latency in Linux Using Tracing
New Ways to Find Latency in Linux Using Tracing
 
Monitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTapMonitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTap
 
Intel DPDK Step by Step instructions
Intel DPDK Step by Step instructionsIntel DPDK Step by Step instructions
Intel DPDK Step by Step instructions
 
VLANs in the Linux Kernel
VLANs in the Linux KernelVLANs in the Linux Kernel
VLANs in the Linux Kernel
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The Answer
 

Ähnlich wie Dive into the Basics of Traffic Control (TC

Cache aware hybrid sorter
Cache aware hybrid sorterCache aware hybrid sorter
Cache aware hybrid sorterManchor Ko
 
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...Bruno Castelucci
 
Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase HBaseCon
 
Mum bandwidth management and qos
Mum   bandwidth management and qosMum   bandwidth management and qos
Mum bandwidth management and qosTeav Sovandara
 
High performace network of Cloud Native Taiwan User Group
High performace network of Cloud Native Taiwan User GroupHigh performace network of Cloud Native Taiwan User Group
High performace network of Cloud Native Taiwan User GroupHungWei Chiu
 
VMworld 2016: vSphere 6.x Host Resource Deep Dive
VMworld 2016: vSphere 6.x Host Resource Deep DiveVMworld 2016: vSphere 6.x Host Resource Deep Dive
VMworld 2016: vSphere 6.x Host Resource Deep DiveVMworld
 
06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt CommunicationAndreas Jakl
 
400-101 CCIE Routing and Switching IT Certification
400-101 CCIE Routing and Switching IT Certification400-101 CCIE Routing and Switching IT Certification
400-101 CCIE Routing and Switching IT Certificationwrouthae
 
8 Tc
8 Tc8 Tc
8 Tcgobed
 
CNIT 50: 6. Command Line Packet Analysis Tools
CNIT 50: 6. Command Line Packet Analysis ToolsCNIT 50: 6. Command Line Packet Analysis Tools
CNIT 50: 6. Command Line Packet Analysis ToolsSam Bowne
 
Introduction to DPDK
Introduction to DPDKIntroduction to DPDK
Introduction to DPDKKernel TLV
 
Real-Time Analytics with Kafka, Cassandra and Storm
Real-Time Analytics with Kafka, Cassandra and StormReal-Time Analytics with Kafka, Cassandra and Storm
Real-Time Analytics with Kafka, Cassandra and StormJohn Georgiadis
 
The Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RCThe Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RCThomas Graf
 
Netmap presentation
Netmap presentationNetmap presentation
Netmap presentationAmir Razmjou
 

Ähnlich wie Dive into the Basics of Traffic Control (TC (20)

Cache aware hybrid sorter
Cache aware hybrid sorterCache aware hybrid sorter
Cache aware hybrid sorter
 
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...
 
Paralell
ParalellParalell
Paralell
 
Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase
 
Mum bandwidth management and qos
Mum   bandwidth management and qosMum   bandwidth management and qos
Mum bandwidth management and qos
 
High performace network of Cloud Native Taiwan User Group
High performace network of Cloud Native Taiwan User GroupHigh performace network of Cloud Native Taiwan User Group
High performace network of Cloud Native Taiwan User Group
 
VMworld 2016: vSphere 6.x Host Resource Deep Dive
VMworld 2016: vSphere 6.x Host Resource Deep DiveVMworld 2016: vSphere 6.x Host Resource Deep Dive
VMworld 2016: vSphere 6.x Host Resource Deep Dive
 
06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt Communication
 
Understanding DPDK
Understanding DPDKUnderstanding DPDK
Understanding DPDK
 
400-101 CCIE Routing and Switching IT Certification
400-101 CCIE Routing and Switching IT Certification400-101 CCIE Routing and Switching IT Certification
400-101 CCIE Routing and Switching IT Certification
 
8 Tc
8 Tc8 Tc
8 Tc
 
Brkdct 3101
Brkdct 3101Brkdct 3101
Brkdct 3101
 
mTCP使ってみた
mTCP使ってみたmTCP使ってみた
mTCP使ってみた
 
CNIT 50: 6. Command Line Packet Analysis Tools
CNIT 50: 6. Command Line Packet Analysis ToolsCNIT 50: 6. Command Line Packet Analysis Tools
CNIT 50: 6. Command Line Packet Analysis Tools
 
lect13_programmable_dp.pptx
lect13_programmable_dp.pptxlect13_programmable_dp.pptx
lect13_programmable_dp.pptx
 
Introduction to DPDK
Introduction to DPDKIntroduction to DPDK
Introduction to DPDK
 
Real-Time Analytics with Kafka, Cassandra and Storm
Real-Time Analytics with Kafka, Cassandra and StormReal-Time Analytics with Kafka, Cassandra and Storm
Real-Time Analytics with Kafka, Cassandra and Storm
 
The Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RCThe Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RC
 
Netmap presentation
Netmap presentationNetmap presentation
Netmap presentation
 
dsp-processor-ppt.ppt
dsp-processor-ppt.pptdsp-processor-ppt.ppt
dsp-processor-ppt.ppt
 

Kürzlich hochgeladen

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Kürzlich hochgeladen (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

Dive into the Basics of Traffic Control (TC

  • 1. Dive into TC – TC basics Jeromy Fu
  • 2. Agenda • What’s TC • How it works • Basic concepts • Command and parameters
  • 3. What’s TC • TC is abbr. of Traffic Control - Rate control - Bandwidth management - Active Queue Management(AQM) - Network Emulator, pkt loss, pkt disorder, pkt duplication, pkt delay - QoS ( diffserv + rsvp ) - Many more …
  • 4. What’s tc • user-level utilities iproute2( iproute2/tc ) • tc kernel (linux/net/sched)
  • 7. Basic concepts- Qdisc • Qdisc(Queue discipline) - Decide which ones to send first, which ones to delay, and which ones to drop - class/classful Qdisc: Qdisc with/without configurable internal subdivision • Naming convention: - Kernel: sch_*.c (sch_netem.c, sch_tbf.c ) - iproute2: q_*.c (q_netem.c, q_tbf.c)
  • 8. Qdisc list • Class Based Queueing (CBQ) • Hierarchical Token Bucket (HTB) • Hierarchical Fair Service Curve (HFSC) • ATM Virtual Circuits (ATM) • Multi Band Priority Queueing (PRIO) • Hardware Multiqueue-aware Multi Band Queuing (MULTIQ) • Random Early Detection (RED) • Stochastic Fairness Queueing (SFQ) • True Link Equalizer (TEQL) • Token Bucket Filter (TBF) • Generic Random Early Detection (GRED) • Differentiated Services marker (DSMARK) • Network emulator (NETEM) • Deficit Round Robin scheduler (DRR) • Ingress Qdisc
  • 9. Basic concepts- Classification • Classification(Filter) - Used to distinguish among different classes of packets and process each class in a specific way. • Naming convention: - Kernel: cls_*.c (cls_u32.c, cls_rsvp.c ) - iproute2: f_*.c (f_u32.c, f_rsvp.c)
  • 10. Classification list • Elementary classification (BASIC) • Traffic-Control Index (TCINDEX) • Routing decision (ROUTE) • Netfilter mark (FW) • Universal 32bit comparisons w/ hashing (U32) • IPv4 Resource Reservation Protocol (RSVP) • IPv6 Resource Reservation Protocol (RSVP6) • Flow classifier • Control Group Classifier • Extended Matches • Metadata • Incoming device classification
  • 11. Basic concepts- Action • Action Actions get attached to classifiers and are invoked after a successful classification. They are used to overwrite the classification result, instantly drop or redirect packets, etc. Works on ingress only. • Naming convention: - Kernel: act_*.c (act_police.c, act_skbedit.c ) - iproute2: m_*.c (m_police.c, m_pedit.c)
  • 12. Action list • Traffic Policing • Generic actions • Probability support • Redirecting and Mirroring • IPtables targets • Stateless NAT • Packet Editing • SKB Editing
  • 13. Basic concepts- Class • Classes either contain other Classes, or a Qdisc is attached • Qdiscs and Classes are intimately tied together
  • 14. TC Commands • OPTIONS: options are effective for all sub commands • OBJECTS: the object of the tc command operates on • COMMAND: the sub command for each object
  • 16. TC Qdisc • Operations on qdisc: add | del | replace | change | show • Handle: qdisc handle used to identify qdisc • root|ingress|parent CLASSID, specify the parent node
  • 17. qdisc handle • Qdisc handle is used to identify Qdisc - {none|major[:]} - none is TC_H_UNSPEC - major is 16bits HEX number(Without ‘0x’ prefix) - : is optional • Internally, qdisc_handle = major<<16
  • 18. classid • Classid is used to identify Class - {none|root|[major]:minor} - none is TC_H_UNSPEC, root is TC_H_ROOT - major/minor are both 16bits HEX numbers(Without ‘0x’ prefix), major is optional • Internally, classid = (major<<16)|minor
  • 19. stab and rtab • stab is Size table, rtab is rate table. • They’re used to speed up the calculation of the transmit time of packets. • The packet size is aligned to a predefined size in the stab slot. • Then the rtab is used to give the pre- calculated time of the aligned packet size.
  • 20. Linklayer • Link layer affects packet size, if linklayer is set, both mpu and overhead must also be set
  • 22. stab internal • szopts: stab relating specifications, some are specified by the command, some are calculated • data: the size table.
  • 23. stab internal - user space • Averagely distribute(*2) the MTU size into size table which has tsize slots
  • 24. stab internal - kernel
  • 25. rtab internal - user space • rtab size is constantly 256
  • 26. rtab internal - kernel
  • 30. TC Class • Tc class can only be applied for classful qdisc, such as htb, cbq etc
  • 32. tbf • limit/latency • buffer/burst/maxburst, capcity of token bucket: size[/cell] • mpu: minimum process unit • rate/peakrate • Max(Rate/HZ,MTU)
  • 33. tbf - user space • latency convert to limit finally
  • 34. tbf - user space • rtab initialization