SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
New ifnet(9) KPI
Gleb Smirnoff
glebius@FreeBSD.org
BSDCan 2015
Ottawa
June 11, 2015
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 1 / 24
Introduction
project wiki page and code
https://wiki.freebsd.org/projects/ifnet
svn+ssh://svn.freebsd.org/base/projects/ifnet
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 2 / 24
Introduction
struct ifnet
Glue between a driver and the stack
Used to be embedded into driver softc, now softc and
ifnet has pointers to each other
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 3 / 24
Introduction
struct ifnet
Glue between a driver and the stack
Used to be embedded into driver softc, now softc and
ifnet has pointers to each other
At attach time driver and stack fill in the structure
At run time driver changes different flags
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 3 / 24
Introduction
Why changes are needed
Extension of the struct ifnet could require
recompilation of all drivers
Editing struct ifnet could require patching all drivers
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 4 / 24
opaque ifnet
The opaque ifnet
Code snippet 1: net/if.h:
typedef struct i f n e t ∗ if_t ;
Code snippet 2: net/if_var.h:
struct i f n e t {
/∗ actual s t r u c t u r e d e f i n i t i o n ∗/
};
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 5 / 24
opaque ifnet
The opaque ifnet
Easy way: substitute any access to struct ifnet fields
with a function
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 6 / 24
opaque ifnet
The opaque ifnet
Easy way: substitute any access to struct ifnet fields
with a function
Hard way: design new KPI
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 6 / 24
new KPI what’s in struct ifnet?
what’s in struct ifnet?
driver
access
instance
specific
if_flags, if_capenable, if_mtu R y
link state, baudrate RW y
counters W y
if_capabilities, if_tso* W once y/n
address lists R y
driver name, if_clone W once n
methods W once n
if_type, dlt_type, header len W once n
if_media W once * y/n
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 7 / 24
new KPI what’s in struct ifnet?
what’s else in struct ifnet?
The stuff the driver shouldn’t be interested at
Layer 2 softc: if_l2com
Address family softcs: if_afdata[AF_MAX]
Bunch of other softcs: if_lagg, if_carp, if_netmap,
etc
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 8 / 24
new KPI what’s in struct ifnet?
what’s else in struct ifnet?
The stuff the driver shouldn’t be interested at
Layer 2 softc: if_l2com
Address family softcs: if_afdata[AF_MAX]
Bunch of other softcs: if_lagg, if_carp, if_netmap,
etc
This all can be generalized!
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 8 / 24
new KPI allocation and attachment
new if_attach()
if_alloc() if_attach(if_attach_args *args)
sleeps, doesn’t fail (save name conflict)
if_attach_args is versioned
if_attach_args contains all the “W once” stuff
ifdriver pointer
softc pointer
lladdr
supported media list
capabilities, TSO limits
initial values: MTU, capenable, baudrate, etc
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 9 / 24
new KPI allocation and attachment
ifdriver, ifops
struct ifdriver is static in the driver, storing all
non-instance specific stuff
Interface methods in special structure ifops
Name, type, DLT, headerlength
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 10 / 24
new KPI allocation and attachment
ifmedia
Code snippet 3: net/if_media.h:
typedef int if_media_t ;
Drivers declare static/dynamic array of if_media_t,
pointed to from if_attach_args
Drivers declare if_media_change_t,
if_media_status_t in ifops
Implementation opaque and private to if_media.c
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 11 / 24
new KPI allocation and attachment
ifmedia + miibus
miibus(4) is completely ifnet(9) agnostic
mii_attach() allocates pointer to if_media_t array,
to be used later in if_attach_args
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 12 / 24
new KPI method changes
if_init is no longer a method, becomes static function
if_poll for polling(4)
if_start
if_transmit doesn’t m_freem() in case of error
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 13 / 24
new KPI runtime modified data
if_flags, if_capenable, if_mtu (R,
instance specific)
if_ioctl method is the only channel to modify the
values
stack does sanity checking
driver may refuse new value
if driver accepts value, it may cache it
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 14 / 24
new KPI runtime modified data
if_drv_flags
IFF_DRV_OACTIVE goes away together with
if_start and generic queue
IFF_DRV_RUNNING goes to driver softc, protected
by driver lock
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 15 / 24
new KPI runtime modified data
link state, baudrate
void if_setbaudrate ( if_t , uint64_t ) ;
void if_link_state_change ( if_t , int ) ;
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 16 / 24
new KPI runtime modified data
counters
if_inc_counter() is already in head
Driver is 100% resposible for the counters
TX counters are updated on TX completion, not on
enqueue
Use if_inc_txcounters() for TX update
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 17 / 24
new KPI runtime modified data
traversing address lists
typedef void
ifaddr_cb_t ( void ∗ , struct sockaddr ∗ ,
struct sockaddr ∗ , struct sockaddr ∗);
typedef void
ifmaddr_cb_t ( void ∗ , struct sockaddr ∗);
void if_foreach_addr ( if_t , ifaddr_cb_t ,
void ∗);
void if_foreach_maddr ( if_t , ifmaddr_cb_t ,
void ∗);
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 18 / 24
new KPI special considerations
net80211 drivers
No ifnet layer in the driver
Task is 50% done
Will be committed to head separately
https://wiki.freebsd.org/projects/ifnet/net80211
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 19 / 24
new KPI special considerations
drivers that do if_start
That’s 80-90% of all legacy drivers
if_start and struct ifqueue go away
driver opts-in for a generic queue in if_attach
stack provides: if_snd_len(), if_snd_enqueue(),
if_snd_dequeue() and if_snd_prepend()
driver’s if_transmit is a short copy&paste
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 20 / 24
new KPI special considerations
lagg(4)
now lagg(4) hijacks if_transmit of an interface
it will hijack ifops
ifops can be stacked, like VOPs
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 21 / 24
new KPI special considerations
ALTQ
now ALTQ works on top of ifqueue
it will hijack ifops
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 22 / 24
new KPI scope of work
scope of work
There are > 200 drivers to be converted
Only 16 has been converted so far
Conversion of typical 100Mbit driver takes 1 hour
Usually driver is reduced by 100 LOC
https://wiki.freebsd.org/projects/ifnet/progress
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 23 / 24
new KPI scope of work
open tasks
Better generic queueing/transmit code?
ALTQ
lagg(4)
VIMAGE
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 24 / 24
Conclusion
Your feedback & help is needed!
Reviewing
Criticizing, proposing better KPIs
Converting drivers
Testing
Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 25 / 24

Contenu connexe

Tendances

Stargz Snapshotter: イメージのpullを省略してcontainerdでコンテナを高速に起動する
Stargz Snapshotter: イメージのpullを省略してcontainerdでコンテナを高速に起動するStargz Snapshotter: イメージのpullを省略してcontainerdでコンテナを高速に起動する
Stargz Snapshotter: イメージのpullを省略してcontainerdでコンテナを高速に起動するKohei Tokunaga
 
Debugging node in prod
Debugging node in prodDebugging node in prod
Debugging node in prodYunong Xiao
 
Understanding eBPF in a Hurry!
Understanding eBPF in a Hurry!Understanding eBPF in a Hurry!
Understanding eBPF in a Hurry!Ray Jenkins
 
Global Interpreter Lock: Episode III - cat < /dev/zero > GIL;
Global Interpreter Lock: Episode III - cat < /dev/zero > GIL;Global Interpreter Lock: Episode III - cat < /dev/zero > GIL;
Global Interpreter Lock: Episode III - cat < /dev/zero > GIL;Tzung-Bi Shih
 
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
Tracing Software Build Processes to Uncover License Compliance InconsistenciesTracing Software Build Processes to Uncover License Compliance Inconsistencies
Tracing Software Build Processes to Uncover License Compliance InconsistenciesShane McIntosh
 
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDP
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDPDockerCon 2017 - Cilium - Network and Application Security with BPF and XDP
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDPThomas Graf
 
Global Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealTzung-Bi Shih
 
Lopug docker end_of_distro
Lopug docker end_of_distroLopug docker end_of_distro
Lopug docker end_of_distroChris Swan
 
P4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC OffloadP4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC OffloadOpen-NFP
 
Golang execution modes
Golang execution modesGolang execution modes
Golang execution modesTing-Li Chou
 
p4alu: Arithmetic Logic Unit in P4
p4alu: Arithmetic Logic Unit in P4p4alu: Arithmetic Logic Unit in P4
p4alu: Arithmetic Logic Unit in P4Kentaro Ebisawa
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemTommaso Visconti
 
Fun with Github webhooks: verifying Signed-off-by
Fun with Github webhooks: verifying Signed-off-byFun with Github webhooks: verifying Signed-off-by
Fun with Github webhooks: verifying Signed-off-byJeff Squyres
 
[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtooling[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtoolingDouglas Chen
 
Profiling and optimizing go programs
Profiling and optimizing go programsProfiling and optimizing go programs
Profiling and optimizing go programsBadoo Development
 
HCQC : HPC Compiler Quality Checker
HCQC : HPC Compiler Quality CheckerHCQC : HPC Compiler Quality Checker
HCQC : HPC Compiler Quality CheckerLinaro
 
Brief introduction to kselftest
Brief introduction to kselftestBrief introduction to kselftest
Brief introduction to kselftestSeongJae Park
 

Tendances (20)

Stargz Snapshotter: イメージのpullを省略してcontainerdでコンテナを高速に起動する
Stargz Snapshotter: イメージのpullを省略してcontainerdでコンテナを高速に起動するStargz Snapshotter: イメージのpullを省略してcontainerdでコンテナを高速に起動する
Stargz Snapshotter: イメージのpullを省略してcontainerdでコンテナを高速に起動する
 
Debugging node in prod
Debugging node in prodDebugging node in prod
Debugging node in prod
 
Understanding eBPF in a Hurry!
Understanding eBPF in a Hurry!Understanding eBPF in a Hurry!
Understanding eBPF in a Hurry!
 
Global Interpreter Lock: Episode III - cat < /dev/zero > GIL;
Global Interpreter Lock: Episode III - cat < /dev/zero > GIL;Global Interpreter Lock: Episode III - cat < /dev/zero > GIL;
Global Interpreter Lock: Episode III - cat < /dev/zero > GIL;
 
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
Tracing Software Build Processes to Uncover License Compliance InconsistenciesTracing Software Build Processes to Uncover License Compliance Inconsistencies
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
 
Go 1.8 Release Party
Go 1.8 Release PartyGo 1.8 Release Party
Go 1.8 Release Party
 
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDP
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDPDockerCon 2017 - Cilium - Network and Application Security with BPF and XDP
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDP
 
Global Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the Seal
 
Streams for the Web
Streams for the WebStreams for the Web
Streams for the Web
 
Lopug docker end_of_distro
Lopug docker end_of_distroLopug docker end_of_distro
Lopug docker end_of_distro
 
How to Build & Use OpenCL on OpenCV & Android NDK
How to Build & Use OpenCL on OpenCV & Android NDKHow to Build & Use OpenCL on OpenCV & Android NDK
How to Build & Use OpenCL on OpenCV & Android NDK
 
P4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC OffloadP4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC Offload
 
Golang execution modes
Golang execution modesGolang execution modes
Golang execution modes
 
p4alu: Arithmetic Logic Unit in P4
p4alu: Arithmetic Logic Unit in P4p4alu: Arithmetic Logic Unit in P4
p4alu: Arithmetic Logic Unit in P4
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control System
 
Fun with Github webhooks: verifying Signed-off-by
Fun with Github webhooks: verifying Signed-off-byFun with Github webhooks: verifying Signed-off-by
Fun with Github webhooks: verifying Signed-off-by
 
[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtooling[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtooling
 
Profiling and optimizing go programs
Profiling and optimizing go programsProfiling and optimizing go programs
Profiling and optimizing go programs
 
HCQC : HPC Compiler Quality Checker
HCQC : HPC Compiler Quality CheckerHCQC : HPC Compiler Quality Checker
HCQC : HPC Compiler Quality Checker
 
Brief introduction to kselftest
Brief introduction to kselftestBrief introduction to kselftest
Brief introduction to kselftest
 

Similaire à new ifnet(9) KPI for FreeBSD network stack

Flink Apachecon Presentation
Flink Apachecon PresentationFlink Apachecon Presentation
Flink Apachecon PresentationGyula Fóra
 
Automate your Cloud Integration governance with CPILint @ SIT Netherlands 2022
Automate your Cloud Integration governance with CPILint @ SIT Netherlands 2022Automate your Cloud Integration governance with CPILint @ SIT Netherlands 2022
Automate your Cloud Integration governance with CPILint @ SIT Netherlands 2022Morten Wittrock
 
Modern Web Applications with Sightly
Modern Web Applications with SightlyModern Web Applications with Sightly
Modern Web Applications with SightlyRadu Cotescu
 
Plugin for other browsers - webRTC Conference and Expo June 2014 @ atlanta
Plugin for other browsers - webRTC Conference and Expo June 2014 @ atlantaPlugin for other browsers - webRTC Conference and Expo June 2014 @ atlanta
Plugin for other browsers - webRTC Conference and Expo June 2014 @ atlantaAlexandre Gouaillard
 
Getting Started with Apache Geode
Getting Started with Apache GeodeGetting Started with Apache Geode
Getting Started with Apache GeodeJohn Blum
 
Automate Your Integration Governance with Open Source Software
Automate Your Integration Governance with Open Source SoftwareAutomate Your Integration Governance with Open Source Software
Automate Your Integration Governance with Open Source SoftwareMorten Wittrock
 
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...Anil Sharma
 
Airflow - a data flow engine
Airflow - a data flow engineAirflow - a data flow engine
Airflow - a data flow engineWalter Liu
 
Functest in Depth
Functest in DepthFunctest in Depth
Functest in DepthOPNFV
 
7 lessons from velocity 2011 (Meetup feedback session for London Web Performa...
7 lessons from velocity 2011 (Meetup feedback session for London Web Performa...7 lessons from velocity 2011 (Meetup feedback session for London Web Performa...
7 lessons from velocity 2011 (Meetup feedback session for London Web Performa...Stephen Thair
 
FOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group ReplicationFOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group ReplicationShivji Kumar Jha
 
.NET Application Modernization with PAS and Azure DevOps
.NET Application Modernization with PAS and Azure DevOps.NET Application Modernization with PAS and Azure DevOps
.NET Application Modernization with PAS and Azure DevOpsVMware Tanzu
 
Building an MLOps Stack for Companies at Reasonable Scale
Building an MLOps Stack for Companies at Reasonable ScaleBuilding an MLOps Stack for Companies at Reasonable Scale
Building an MLOps Stack for Companies at Reasonable ScaleMerelda
 
TechEvent OpenShift for Developers
TechEvent OpenShift for DevelopersTechEvent OpenShift for Developers
TechEvent OpenShift for DevelopersTrivadis
 
DevOps by examples - Azure Meetup Frankfurt 06-2017
DevOps by examples - Azure Meetup Frankfurt 06-2017DevOps by examples - Azure Meetup Frankfurt 06-2017
DevOps by examples - Azure Meetup Frankfurt 06-2017Giulio Vian
 
Spring Boot with Kotlin, Kofu and Coroutines
 Spring Boot with Kotlin, Kofu and Coroutines Spring Boot with Kotlin, Kofu and Coroutines
Spring Boot with Kotlin, Kofu and CoroutinesVMware Tanzu
 
St.Louis OpenStack February meetup
St.Louis OpenStack February meetupSt.Louis OpenStack February meetup
St.Louis OpenStack February meetupopenstackstl
 

Similaire à new ifnet(9) KPI for FreeBSD network stack (20)

Flink Apachecon Presentation
Flink Apachecon PresentationFlink Apachecon Presentation
Flink Apachecon Presentation
 
Automate your Cloud Integration governance with CPILint @ SIT Netherlands 2022
Automate your Cloud Integration governance with CPILint @ SIT Netherlands 2022Automate your Cloud Integration governance with CPILint @ SIT Netherlands 2022
Automate your Cloud Integration governance with CPILint @ SIT Netherlands 2022
 
Modern Web Applications with Sightly
Modern Web Applications with SightlyModern Web Applications with Sightly
Modern Web Applications with Sightly
 
Plugin for other browsers - webRTC Conference and Expo June 2014 @ atlanta
Plugin for other browsers - webRTC Conference and Expo June 2014 @ atlantaPlugin for other browsers - webRTC Conference and Expo June 2014 @ atlanta
Plugin for other browsers - webRTC Conference and Expo June 2014 @ atlanta
 
Getting Started with Apache Geode
Getting Started with Apache GeodeGetting Started with Apache Geode
Getting Started with Apache Geode
 
Automate Your Integration Governance with Open Source Software
Automate Your Integration Governance with Open Source SoftwareAutomate Your Integration Governance with Open Source Software
Automate Your Integration Governance with Open Source Software
 
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
 
Airflow - a data flow engine
Airflow - a data flow engineAirflow - a data flow engine
Airflow - a data flow engine
 
Functest in Depth
Functest in DepthFunctest in Depth
Functest in Depth
 
7 lessons from velocity 2011 (Meetup feedback session for London Web Performa...
7 lessons from velocity 2011 (Meetup feedback session for London Web Performa...7 lessons from velocity 2011 (Meetup feedback session for London Web Performa...
7 lessons from velocity 2011 (Meetup feedback session for London Web Performa...
 
FOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group ReplicationFOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group Replication
 
Griffon Presentation
Griffon PresentationGriffon Presentation
Griffon Presentation
 
.NET Application Modernization with PAS and Azure DevOps
.NET Application Modernization with PAS and Azure DevOps.NET Application Modernization with PAS and Azure DevOps
.NET Application Modernization with PAS and Azure DevOps
 
Building an MLOps Stack for Companies at Reasonable Scale
Building an MLOps Stack for Companies at Reasonable ScaleBuilding an MLOps Stack for Companies at Reasonable Scale
Building an MLOps Stack for Companies at Reasonable Scale
 
TechEvent OpenShift for Developers
TechEvent OpenShift for DevelopersTechEvent OpenShift for Developers
TechEvent OpenShift for Developers
 
Marcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL WorkbenchMarcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL Workbench
 
DevOps by examples - Azure Meetup Frankfurt 06-2017
DevOps by examples - Azure Meetup Frankfurt 06-2017DevOps by examples - Azure Meetup Frankfurt 06-2017
DevOps by examples - Azure Meetup Frankfurt 06-2017
 
Spring Boot with Kotlin, Kofu and Coroutines
 Spring Boot with Kotlin, Kofu and Coroutines Spring Boot with Kotlin, Kofu and Coroutines
Spring Boot with Kotlin, Kofu and Coroutines
 
Kube cfg-mgmt
Kube cfg-mgmtKube cfg-mgmt
Kube cfg-mgmt
 
St.Louis OpenStack February meetup
St.Louis OpenStack February meetupSt.Louis OpenStack February meetup
St.Louis OpenStack February meetup
 

Dernier

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 

Dernier (20)

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 

new ifnet(9) KPI for FreeBSD network stack

  • 1. New ifnet(9) KPI Gleb Smirnoff glebius@FreeBSD.org BSDCan 2015 Ottawa June 11, 2015 Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 1 / 24
  • 2. Introduction project wiki page and code https://wiki.freebsd.org/projects/ifnet svn+ssh://svn.freebsd.org/base/projects/ifnet Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 2 / 24
  • 3. Introduction struct ifnet Glue between a driver and the stack Used to be embedded into driver softc, now softc and ifnet has pointers to each other Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 3 / 24
  • 4. Introduction struct ifnet Glue between a driver and the stack Used to be embedded into driver softc, now softc and ifnet has pointers to each other At attach time driver and stack fill in the structure At run time driver changes different flags Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 3 / 24
  • 5. Introduction Why changes are needed Extension of the struct ifnet could require recompilation of all drivers Editing struct ifnet could require patching all drivers Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 4 / 24
  • 6. opaque ifnet The opaque ifnet Code snippet 1: net/if.h: typedef struct i f n e t ∗ if_t ; Code snippet 2: net/if_var.h: struct i f n e t { /∗ actual s t r u c t u r e d e f i n i t i o n ∗/ }; Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 5 / 24
  • 7. opaque ifnet The opaque ifnet Easy way: substitute any access to struct ifnet fields with a function Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 6 / 24
  • 8. opaque ifnet The opaque ifnet Easy way: substitute any access to struct ifnet fields with a function Hard way: design new KPI Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 6 / 24
  • 9. new KPI what’s in struct ifnet? what’s in struct ifnet? driver access instance specific if_flags, if_capenable, if_mtu R y link state, baudrate RW y counters W y if_capabilities, if_tso* W once y/n address lists R y driver name, if_clone W once n methods W once n if_type, dlt_type, header len W once n if_media W once * y/n Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 7 / 24
  • 10. new KPI what’s in struct ifnet? what’s else in struct ifnet? The stuff the driver shouldn’t be interested at Layer 2 softc: if_l2com Address family softcs: if_afdata[AF_MAX] Bunch of other softcs: if_lagg, if_carp, if_netmap, etc Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 8 / 24
  • 11. new KPI what’s in struct ifnet? what’s else in struct ifnet? The stuff the driver shouldn’t be interested at Layer 2 softc: if_l2com Address family softcs: if_afdata[AF_MAX] Bunch of other softcs: if_lagg, if_carp, if_netmap, etc This all can be generalized! Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 8 / 24
  • 12. new KPI allocation and attachment new if_attach() if_alloc() if_attach(if_attach_args *args) sleeps, doesn’t fail (save name conflict) if_attach_args is versioned if_attach_args contains all the “W once” stuff ifdriver pointer softc pointer lladdr supported media list capabilities, TSO limits initial values: MTU, capenable, baudrate, etc Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 9 / 24
  • 13. new KPI allocation and attachment ifdriver, ifops struct ifdriver is static in the driver, storing all non-instance specific stuff Interface methods in special structure ifops Name, type, DLT, headerlength Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 10 / 24
  • 14. new KPI allocation and attachment ifmedia Code snippet 3: net/if_media.h: typedef int if_media_t ; Drivers declare static/dynamic array of if_media_t, pointed to from if_attach_args Drivers declare if_media_change_t, if_media_status_t in ifops Implementation opaque and private to if_media.c Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 11 / 24
  • 15. new KPI allocation and attachment ifmedia + miibus miibus(4) is completely ifnet(9) agnostic mii_attach() allocates pointer to if_media_t array, to be used later in if_attach_args Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 12 / 24
  • 16. new KPI method changes if_init is no longer a method, becomes static function if_poll for polling(4) if_start if_transmit doesn’t m_freem() in case of error Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 13 / 24
  • 17. new KPI runtime modified data if_flags, if_capenable, if_mtu (R, instance specific) if_ioctl method is the only channel to modify the values stack does sanity checking driver may refuse new value if driver accepts value, it may cache it Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 14 / 24
  • 18. new KPI runtime modified data if_drv_flags IFF_DRV_OACTIVE goes away together with if_start and generic queue IFF_DRV_RUNNING goes to driver softc, protected by driver lock Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 15 / 24
  • 19. new KPI runtime modified data link state, baudrate void if_setbaudrate ( if_t , uint64_t ) ; void if_link_state_change ( if_t , int ) ; Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 16 / 24
  • 20. new KPI runtime modified data counters if_inc_counter() is already in head Driver is 100% resposible for the counters TX counters are updated on TX completion, not on enqueue Use if_inc_txcounters() for TX update Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 17 / 24
  • 21. new KPI runtime modified data traversing address lists typedef void ifaddr_cb_t ( void ∗ , struct sockaddr ∗ , struct sockaddr ∗ , struct sockaddr ∗); typedef void ifmaddr_cb_t ( void ∗ , struct sockaddr ∗); void if_foreach_addr ( if_t , ifaddr_cb_t , void ∗); void if_foreach_maddr ( if_t , ifmaddr_cb_t , void ∗); Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 18 / 24
  • 22. new KPI special considerations net80211 drivers No ifnet layer in the driver Task is 50% done Will be committed to head separately https://wiki.freebsd.org/projects/ifnet/net80211 Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 19 / 24
  • 23. new KPI special considerations drivers that do if_start That’s 80-90% of all legacy drivers if_start and struct ifqueue go away driver opts-in for a generic queue in if_attach stack provides: if_snd_len(), if_snd_enqueue(), if_snd_dequeue() and if_snd_prepend() driver’s if_transmit is a short copy&paste Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 20 / 24
  • 24. new KPI special considerations lagg(4) now lagg(4) hijacks if_transmit of an interface it will hijack ifops ifops can be stacked, like VOPs Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 21 / 24
  • 25. new KPI special considerations ALTQ now ALTQ works on top of ifqueue it will hijack ifops Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 22 / 24
  • 26. new KPI scope of work scope of work There are > 200 drivers to be converted Only 16 has been converted so far Conversion of typical 100Mbit driver takes 1 hour Usually driver is reduced by 100 LOC https://wiki.freebsd.org/projects/ifnet/progress Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 23 / 24
  • 27. new KPI scope of work open tasks Better generic queueing/transmit code? ALTQ lagg(4) VIMAGE Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 24 / 24
  • 28. Conclusion Your feedback & help is needed! Reviewing Criticizing, proposing better KPIs Converting drivers Testing Gleb Smirnoff glebius@FreeBSD.org New ifnet(9) KPI June 11, 2015 25 / 24