SlideShare a Scribd company logo
Outline
• introduction
• Netlink API
• Sample code
• Analysis of reliability issue
0
introduction
• Netlink is a ipc mechanism different from
system call
– Advantage
• Eliminate round trip time from user space to kernel
space
• Broadcast message
• Transmission from kernel space to user space
– Shortcoming
• Reliability issue
1
User space API
• int socket(int domain, int type, int protocol)
– Domain is AF_NETLINK;
– Type is either SOCK_RAW or SOCK_DGRAM;
– Protocol:
• Except predefined netlink protocol types, 20~31 is
reserved for user-define protocol.
• Netlink_usersock(2) is available for test.
• Each one acts like a physical network.
2
User space API
• Bind()
– struct sockaddr_nl {
• sa_family_t nl_family; /* AF_NETLINK */
• unsigned short nl_pad; /* zero */
• __u32 nl_pid; /* process pid */
• __u32 nl_groups; /* group which process belong to */
– } nladdr;
– Netlink address has to be bind with the opened
netlink socket.
• bind(fd, (struct sockaddr*)&src_addr, sizeof(src_addr));
3
• Information in socket handle
4
User
process
User
process
User
process
Kernel
Netlink
network
Information in socket handle:
address (process id)
Group number
Protocol number: indicate which netlink
network
User space API
• Pack a netlink message into standard socket message
– Pink area deserved extra attention.
– Pid of sender is not really necessary when receiver is not
intended to know
– Unused member shall be zero out.
– Then we can use this message on sendmsg() and recvmsg()
5
Msg_name
Msg_name len
msg_iov
Msg_Iov_len=1
dest
pid
Dest
group
Iov_base
Iov_len
Len of netlink
message
Pid of sender
Payload of
netlink
message
kernel space API example – receiving message
• netlink_kernel_create(&init_net, NETLINK_USERSOCK, 0,udp_
receive, NULL, THIS_MODULE);
– NETLINK_USERSOCK is protocol unmber we use.
– 0 is identifier of group unmber.
– udp_receive() is call back function which receive netlink message.
– Return value is kernel socket handle.
• Design strategy of receive call back function
– When it takes long time to message process code, programmer can queue
message and return right away, in order to prevent too many other system
call’s blocking
– Message process code can be placed in other kernel thread for processing
message queued before.
6
kernel space API example – sending message
• ret=netlink_unicast(netlink_sock, skb, pid, MSG_DONTWAIT);
– Netlink_sock is opened socket handle.
– Skb carrys netlink message.
– Pid indicates destination process id.
– MSG_DON’TWAIT means non-block when receiving buffer
is full.
• Netlink_broadcast(…)
– It’s deserved our attention that this function has no return
value, we don’t know message delivery is successful or not.
7
Sample code: chat room in local machine
• Traditional ipc like message queue is not easy to applied to
implement chat room
8
Reliability issue
• Kernel send unicast message:
– Nonblock and check error return, re-send message.
– Block until finish putting message into receiving buffer.
• Kernel broadcast message?
• User send message to kernel
– Kernel has call back receiving function to process right
away.
• User send message to other user
– Sendmsg() don’t guarantee successful delivery.
9
Reliability issue
• Reliability solution:
– Ack transmitted message for successful delivery
between user and user.
• If we still want to try netlink messge between user and
user, because that’s unreliable transmission.
– Every receiving thread should queue message for
processing later, then return right away.
10
Reliability issue
• Data layout
11
User
process
User
process
User
process
Kernel
Netlink
network
Receiving
queue
Receiving
queue
Receiving
queue
sending
queue
Kernel space
User space
Draft of proposed scheme
• Partition of driver in FULL-change scheme
– Framework for netlink feature development and test.
– After development, old cm & bridge still can use new driver through lddb
model.
12
Kernel space
User space
Lddb logic:
Receving soc’s data and queue it.
Sending data to soc.
Soc data forwarding logic
and sdio control logic
Connection
Manager
And bridge
Netlink
message
System call interface
New
Connection
Manager
And new bridge
conclusion
– 1. full change or half – further survey in full-change scheme is necessary,
TI’ wifi sdio driver is a reference.
– 2. advantage of half-change scheme : event from kernel to user.
• 1 active error message inform to app
• 2 performance boost in CM query
• 3 minimun modification
– 3. shortcoming of full-change scheme
• 1.kernel sending may have to adjust speed by queuing soc‘s data, otherwise
blocked kernel sending might compromise system performance.
• 2. function return can’t represent execution result anymore, this is a drawback
of asynchronous execution of kernel and user, especially in compare to ioctl
mechanism.(it might be necessary to ack execution result message to sender).
– 4. Other discussion
• 1. debug message option should not be hard-code.
• 2. error handle in driver
13

More Related Content

What's hot

Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory ManagementNi Zo-Ma
 
High-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uringHigh-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uring
ScyllaDB
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
Emertxe Information Technologies Pvt Ltd
 
The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421
Linaro
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Tushar B Kute
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
Tushar B Kute
 
Achieving the ultimate performance with KVM
Achieving the ultimate performance with KVM Achieving the ultimate performance with KVM
Achieving the ultimate performance with KVM
ShapeBlue
 
AndroidとSELinux
AndroidとSELinuxAndroidとSELinux
AndroidとSELinux
android sola
 
Linux monitoring and Troubleshooting for DBA's
Linux monitoring and Troubleshooting for DBA'sLinux monitoring and Troubleshooting for DBA's
Linux monitoring and Troubleshooting for DBA's
Mydbops
 
Linux Booting Process
Linux Booting ProcessLinux Booting Process
Linux Booting Process
Rishabh5121993
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoCMacpaul Lin
 
Page reclaim
Page reclaimPage reclaim
Page reclaim
siburu
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
RuggedBoardGroup
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
Ashish Agrawal
 
Page cache in Linux kernel
Page cache in Linux kernelPage cache in Linux kernel
Page cache in Linux kernel
Adrian Huang
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
Emertxe Information Technologies Pvt Ltd
 
Troubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device DriversTroubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device Drivers
Satpal Parmar
 
Android JNI
Android JNIAndroid JNI
Android JNI
Siva Ramakrishna kv
 
6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot process
Hari Shankar
 
linux device driver
linux device driverlinux device driver
linux device driver
Rahul Batra
 

What's hot (20)

Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
High-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uringHigh-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uring
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
 
The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421The Linux Kernel Scheduler (For Beginners) - SFO17-421
The Linux Kernel Scheduler (For Beginners) - SFO17-421
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
 
Achieving the ultimate performance with KVM
Achieving the ultimate performance with KVM Achieving the ultimate performance with KVM
Achieving the ultimate performance with KVM
 
AndroidとSELinux
AndroidとSELinuxAndroidとSELinux
AndroidとSELinux
 
Linux monitoring and Troubleshooting for DBA's
Linux monitoring and Troubleshooting for DBA'sLinux monitoring and Troubleshooting for DBA's
Linux monitoring and Troubleshooting for DBA's
 
Linux Booting Process
Linux Booting ProcessLinux Booting Process
Linux Booting Process
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
 
Page reclaim
Page reclaimPage reclaim
Page reclaim
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
Page cache in Linux kernel
Page cache in Linux kernelPage cache in Linux kernel
Page cache in Linux kernel
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
 
Troubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device DriversTroubleshooting Linux Kernel Modules And Device Drivers
Troubleshooting Linux Kernel Modules And Device Drivers
 
Android JNI
Android JNIAndroid JNI
Android JNI
 
6 stages of linux boot process
6 stages of linux boot process6 stages of linux boot process
6 stages of linux boot process
 
linux device driver
linux device driverlinux device driver
linux device driver
 

Viewers also liked

Introduction to SPI and PMIC with SPI interface (chinese)
Introduction to SPI and PMIC with SPI interface (chinese)Introduction to SPI and PMIC with SPI interface (chinese)
Introduction to SPI and PMIC with SPI interface (chinese)
Sneeker Yeh
 
Concurrency bug identification through kernel panic log (english)
Concurrency bug identification through kernel panic log (english)Concurrency bug identification through kernel panic log (english)
Concurrency bug identification through kernel panic log (english)
Sneeker Yeh
 
Basic Concept of Pixel and MPEG data structure (english)
Basic Concept of Pixel and MPEG data structure (english)Basic Concept of Pixel and MPEG data structure (english)
Basic Concept of Pixel and MPEG data structure (english)
Sneeker Yeh
 
Dead Lock Analysis of spin_lock() in Linux Kernel (english)
Dead Lock Analysis of spin_lock() in Linux Kernel (english)Dead Lock Analysis of spin_lock() in Linux Kernel (english)
Dead Lock Analysis of spin_lock() in Linux Kernel (english)
Sneeker Yeh
 
FAT file system implementation from scratch in boot-loader (chinese)
FAT file system implementation from scratch in boot-loader (chinese)FAT file system implementation from scratch in boot-loader (chinese)
FAT file system implementation from scratch in boot-loader (chinese)
Sneeker Yeh
 
Introduction to Nand Flash interface (chinese)
Introduction to Nand Flash interface (chinese)Introduction to Nand Flash interface (chinese)
Introduction to Nand Flash interface (chinese)
Sneeker Yeh
 
Introduction to synchronous display controller (chinese)
Introduction to synchronous display controller (chinese)Introduction to synchronous display controller (chinese)
Introduction to synchronous display controller (chinese)
Sneeker Yeh
 
Bootloader and MMU (english)
Bootloader and MMU (english)Bootloader and MMU (english)
Bootloader and MMU (english)
Sneeker Yeh
 
Interface between kernel and user space
Interface between kernel and user spaceInterface between kernel and user space
Interface between kernel and user spaceSusant Sahani
 
Fun with Network Interfaces
Fun with Network InterfacesFun with Network Interfaces
Fun with Network Interfaces
Kernel TLV
 
rtnetlink
rtnetlinkrtnetlink
rtnetlink
Taku Fukushima
 
VLANs in the Linux Kernel
VLANs in the Linux KernelVLANs in the Linux Kernel
VLANs in the Linux Kernel
Kernel TLV
 

Viewers also liked (13)

Introduction to SPI and PMIC with SPI interface (chinese)
Introduction to SPI and PMIC with SPI interface (chinese)Introduction to SPI and PMIC with SPI interface (chinese)
Introduction to SPI and PMIC with SPI interface (chinese)
 
Concurrency bug identification through kernel panic log (english)
Concurrency bug identification through kernel panic log (english)Concurrency bug identification through kernel panic log (english)
Concurrency bug identification through kernel panic log (english)
 
Basic Concept of Pixel and MPEG data structure (english)
Basic Concept of Pixel and MPEG data structure (english)Basic Concept of Pixel and MPEG data structure (english)
Basic Concept of Pixel and MPEG data structure (english)
 
Dead Lock Analysis of spin_lock() in Linux Kernel (english)
Dead Lock Analysis of spin_lock() in Linux Kernel (english)Dead Lock Analysis of spin_lock() in Linux Kernel (english)
Dead Lock Analysis of spin_lock() in Linux Kernel (english)
 
FAT file system implementation from scratch in boot-loader (chinese)
FAT file system implementation from scratch in boot-loader (chinese)FAT file system implementation from scratch in boot-loader (chinese)
FAT file system implementation from scratch in boot-loader (chinese)
 
Introduction to Nand Flash interface (chinese)
Introduction to Nand Flash interface (chinese)Introduction to Nand Flash interface (chinese)
Introduction to Nand Flash interface (chinese)
 
Introduction to synchronous display controller (chinese)
Introduction to synchronous display controller (chinese)Introduction to synchronous display controller (chinese)
Introduction to synchronous display controller (chinese)
 
Bootloader and MMU (english)
Bootloader and MMU (english)Bootloader and MMU (english)
Bootloader and MMU (english)
 
Interface between kernel and user space
Interface between kernel and user spaceInterface between kernel and user space
Interface between kernel and user space
 
Fun with Network Interfaces
Fun with Network InterfacesFun with Network Interfaces
Fun with Network Interfaces
 
rtnetlink
rtnetlinkrtnetlink
rtnetlink
 
VLANs in the Linux Kernel
VLANs in the Linux KernelVLANs in the Linux Kernel
VLANs in the Linux Kernel
 
Vlan
Vlan Vlan
Vlan
 

Similar to Introduction to netlink in linux kernel (english)

FD.IO Vector Packet Processing
FD.IO Vector Packet ProcessingFD.IO Vector Packet Processing
FD.IO Vector Packet Processing
Kernel TLV
 
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
 
Byte Ordering - Unit 2.pptx
Byte Ordering - Unit 2.pptxByte Ordering - Unit 2.pptx
Byte Ordering - Unit 2.pptx
RockyBhai46825
 
Network architecure (3).pptx
Network architecure (3).pptxNetwork architecure (3).pptx
Network architecure (3).pptx
Kaythry P
 
Chap 1 Network Theory & Java Overview
Chap 1   Network Theory & Java OverviewChap 1   Network Theory & Java Overview
Chap 1 Network Theory & Java Overview
Ministry of Higher Education
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
ICS
 
Netlink-Optimization.pptx
Netlink-Optimization.pptxNetlink-Optimization.pptx
Netlink-Optimization.pptx
KalimuthuVelappan
 
SDN & NFV Introduction - Open Source Data Center Networking
SDN & NFV Introduction - Open Source Data Center NetworkingSDN & NFV Introduction - Open Source Data Center Networking
SDN & NFV Introduction - Open Source Data Center NetworkingThomas Graf
 
Network Virtualization & Software-defined Networking
Network Virtualization & Software-defined NetworkingNetwork Virtualization & Software-defined Networking
Network Virtualization & Software-defined Networking
Digicomp Academy AG
 
RDMA programming design and case studies – for better performance distributed...
RDMA programming design and case studies – for better performance distributed...RDMA programming design and case studies – for better performance distributed...
RDMA programming design and case studies – for better performance distributed...
NTT Software Innovation Center
 
Kernel Proc Connector and Containers
Kernel Proc Connector and ContainersKernel Proc Connector and Containers
Kernel Proc Connector and Containers
Kernel TLV
 
Dccp evaluation for sip signaling ict4 m
Dccp evaluation for sip signaling   ict4 m Dccp evaluation for sip signaling   ict4 m
Dccp evaluation for sip signaling ict4 m
Agus Awaludin
 
Integrating Active Networking and Commercial-Grade Routing Platforms
Integrating Active Networking and Commercial-Grade Routing PlatformsIntegrating Active Networking and Commercial-Grade Routing Platforms
Integrating Active Networking and Commercial-Grade Routing Platforms
Tal Lavian Ph.D.
 
Remote core locking-Andrea Lombardo
Remote core locking-Andrea LombardoRemote core locking-Andrea Lombardo
Remote core locking-Andrea Lombardo
Andrea Lombardo
 
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP..."Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
Edge AI and Vision Alliance
 
Net essentials6e ch5
Net essentials6e ch5Net essentials6e ch5
Net essentials6e ch5
APSU
 
Real time Linux
Real time LinuxReal time Linux
Real time Linux
navid ashrafi
 
IBM System Networking Overview - Jul 2013
IBM System Networking Overview - Jul 2013IBM System Networking Overview - Jul 2013
IBM System Networking Overview - Jul 2013
Angel Villar Garea
 

Similar to Introduction to netlink in linux kernel (english) (20)

FD.IO Vector Packet Processing
FD.IO Vector Packet ProcessingFD.IO Vector Packet Processing
FD.IO Vector Packet Processing
 
FD.io Vector Packet Processing (VPP)
FD.io Vector Packet Processing (VPP)FD.io Vector Packet Processing (VPP)
FD.io Vector Packet Processing (VPP)
 
Byte Ordering - Unit 2.pptx
Byte Ordering - Unit 2.pptxByte Ordering - Unit 2.pptx
Byte Ordering - Unit 2.pptx
 
Network architecure (3).pptx
Network architecure (3).pptxNetwork architecure (3).pptx
Network architecure (3).pptx
 
Chap 1 Network Theory & Java Overview
Chap 1   Network Theory & Java OverviewChap 1   Network Theory & Java Overview
Chap 1 Network Theory & Java Overview
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
 
Netlink-Optimization.pptx
Netlink-Optimization.pptxNetlink-Optimization.pptx
Netlink-Optimization.pptx
 
SDN & NFV Introduction - Open Source Data Center Networking
SDN & NFV Introduction - Open Source Data Center NetworkingSDN & NFV Introduction - Open Source Data Center Networking
SDN & NFV Introduction - Open Source Data Center Networking
 
Network Virtualization & Software-defined Networking
Network Virtualization & Software-defined NetworkingNetwork Virtualization & Software-defined Networking
Network Virtualization & Software-defined Networking
 
RDMA programming design and case studies – for better performance distributed...
RDMA programming design and case studies – for better performance distributed...RDMA programming design and case studies – for better performance distributed...
RDMA programming design and case studies – for better performance distributed...
 
Kernel Proc Connector and Containers
Kernel Proc Connector and ContainersKernel Proc Connector and Containers
Kernel Proc Connector and Containers
 
Dccp evaluation for sip signaling ict4 m
Dccp evaluation for sip signaling   ict4 m Dccp evaluation for sip signaling   ict4 m
Dccp evaluation for sip signaling ict4 m
 
Integrating Active Networking and Commercial-Grade Routing Platforms
Integrating Active Networking and Commercial-Grade Routing PlatformsIntegrating Active Networking and Commercial-Grade Routing Platforms
Integrating Active Networking and Commercial-Grade Routing Platforms
 
Remote core locking-Andrea Lombardo
Remote core locking-Andrea LombardoRemote core locking-Andrea Lombardo
Remote core locking-Andrea Lombardo
 
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP..."Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
"Efficient Implementation of Convolutional Neural Networks using OpenCL on FP...
 
Net essentials6e ch5
Net essentials6e ch5Net essentials6e ch5
Net essentials6e ch5
 
Lecture9
Lecture9Lecture9
Lecture9
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
Real time Linux
Real time LinuxReal time Linux
Real time Linux
 
IBM System Networking Overview - Jul 2013
IBM System Networking Overview - Jul 2013IBM System Networking Overview - Jul 2013
IBM System Networking Overview - Jul 2013
 

Recently uploaded

Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 

Recently uploaded (20)

Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 

Introduction to netlink in linux kernel (english)

  • 1. Outline • introduction • Netlink API • Sample code • Analysis of reliability issue 0
  • 2. introduction • Netlink is a ipc mechanism different from system call – Advantage • Eliminate round trip time from user space to kernel space • Broadcast message • Transmission from kernel space to user space – Shortcoming • Reliability issue 1
  • 3. User space API • int socket(int domain, int type, int protocol) – Domain is AF_NETLINK; – Type is either SOCK_RAW or SOCK_DGRAM; – Protocol: • Except predefined netlink protocol types, 20~31 is reserved for user-define protocol. • Netlink_usersock(2) is available for test. • Each one acts like a physical network. 2
  • 4. User space API • Bind() – struct sockaddr_nl { • sa_family_t nl_family; /* AF_NETLINK */ • unsigned short nl_pad; /* zero */ • __u32 nl_pid; /* process pid */ • __u32 nl_groups; /* group which process belong to */ – } nladdr; – Netlink address has to be bind with the opened netlink socket. • bind(fd, (struct sockaddr*)&src_addr, sizeof(src_addr)); 3
  • 5. • Information in socket handle 4 User process User process User process Kernel Netlink network Information in socket handle: address (process id) Group number Protocol number: indicate which netlink network
  • 6. User space API • Pack a netlink message into standard socket message – Pink area deserved extra attention. – Pid of sender is not really necessary when receiver is not intended to know – Unused member shall be zero out. – Then we can use this message on sendmsg() and recvmsg() 5 Msg_name Msg_name len msg_iov Msg_Iov_len=1 dest pid Dest group Iov_base Iov_len Len of netlink message Pid of sender Payload of netlink message
  • 7. kernel space API example – receiving message • netlink_kernel_create(&init_net, NETLINK_USERSOCK, 0,udp_ receive, NULL, THIS_MODULE); – NETLINK_USERSOCK is protocol unmber we use. – 0 is identifier of group unmber. – udp_receive() is call back function which receive netlink message. – Return value is kernel socket handle. • Design strategy of receive call back function – When it takes long time to message process code, programmer can queue message and return right away, in order to prevent too many other system call’s blocking – Message process code can be placed in other kernel thread for processing message queued before. 6
  • 8. kernel space API example – sending message • ret=netlink_unicast(netlink_sock, skb, pid, MSG_DONTWAIT); – Netlink_sock is opened socket handle. – Skb carrys netlink message. – Pid indicates destination process id. – MSG_DON’TWAIT means non-block when receiving buffer is full. • Netlink_broadcast(…) – It’s deserved our attention that this function has no return value, we don’t know message delivery is successful or not. 7
  • 9. Sample code: chat room in local machine • Traditional ipc like message queue is not easy to applied to implement chat room 8
  • 10. Reliability issue • Kernel send unicast message: – Nonblock and check error return, re-send message. – Block until finish putting message into receiving buffer. • Kernel broadcast message? • User send message to kernel – Kernel has call back receiving function to process right away. • User send message to other user – Sendmsg() don’t guarantee successful delivery. 9
  • 11. Reliability issue • Reliability solution: – Ack transmitted message for successful delivery between user and user. • If we still want to try netlink messge between user and user, because that’s unreliable transmission. – Every receiving thread should queue message for processing later, then return right away. 10
  • 12. Reliability issue • Data layout 11 User process User process User process Kernel Netlink network Receiving queue Receiving queue Receiving queue sending queue Kernel space User space
  • 13. Draft of proposed scheme • Partition of driver in FULL-change scheme – Framework for netlink feature development and test. – After development, old cm & bridge still can use new driver through lddb model. 12 Kernel space User space Lddb logic: Receving soc’s data and queue it. Sending data to soc. Soc data forwarding logic and sdio control logic Connection Manager And bridge Netlink message System call interface New Connection Manager And new bridge
  • 14. conclusion – 1. full change or half – further survey in full-change scheme is necessary, TI’ wifi sdio driver is a reference. – 2. advantage of half-change scheme : event from kernel to user. • 1 active error message inform to app • 2 performance boost in CM query • 3 minimun modification – 3. shortcoming of full-change scheme • 1.kernel sending may have to adjust speed by queuing soc‘s data, otherwise blocked kernel sending might compromise system performance. • 2. function return can’t represent execution result anymore, this is a drawback of asynchronous execution of kernel and user, especially in compare to ioctl mechanism.(it might be necessary to ack execution result message to sender). – 4. Other discussion • 1. debug message option should not be hard-code. • 2. error handle in driver 13

Editor's Notes

  1. 0