CASACURSOSESTUDANTESDOAÇÕESVÍDEOSEVENTOSTUTORIAISLINKSNOTÍCIACONTATO


VIDEOS 》 Linux Kernel dst_entry data-structure

For more details refer Linux Source:
https://wiki.linuxfoundation.org/images/1/1c/Network_data_flow_through_kernel.png
http://lxr.free-electrons.com/source/include/net/dst.h
http://lxr.free-electrons.com/source/net/core/dst.c
http://lxr.free-electrons.com/source/net/ipv4/ip_input.c#L396
http://lxr.free-electrons.com/source/include/linux/skbuff.h
http://lxr.free-electrons.com/source/include/linux/skbuff.h#L665
skb_dst() - http://lxr.free-electrons.com/source/include/linux/skbuff.h#L845
skb_dst_set() - http://lxr.free-electrons.com/source/include/linux/skbuff.h#L864

And here is the copy paste of struct dst_entry data-structure (/include/net/dst.h) from the Kernel-source version 4.13 for quick reference:

struct dst_entry {
	struct net_device       *dev;
	struct rcu_head		rcu_head;
	struct dst_entry	*child;
	struct  dst_ops	        *ops;
	unsigned long		_metrics;
	unsigned long           expires;
	struct dst_entry	*path;
	struct dst_entry	*from;
#ifdef CONFIG_XFRM
	struct xfrm_state	*xfrm;
#else
	void			*__pad1;
#endif
	int			(*input)(struct sk_buff *);
	int			(*output)(struct net *net, struct sock *sk, struct sk_buff *skb);

	unsigned short		flags;
#define DST_HOST		0x0001
#define DST_NOXFRM		0x0002
#define DST_NOPOLICY		0x0004
#define DST_NOCOUNT		0x0008
#define DST_FAKE_RTABLE		0x0010
#define DST_XFRM_TUNNEL		0x0020
#define DST_XFRM_QUEUE		0x0040
#define DST_METADATA		0x0080

	short			error;

	/* A non-zero value of dst->obsolete forces by-hand validation
	 * of the route entry.  Positive values are set by the generic
	 * dst layer to indicate that the entry has been forcefully
	 * destroyed.
	 *
	 * Negative values are used by the implementation layer code to
	 * force invocation of the dst_ops->check() method.
	 */
	short			obsolete;
#define DST_OBSOLETE_NONE	0
#define DST_OBSOLETE_DEAD	2
#define DST_OBSOLETE_FORCE_CHK	-1
#define DST_OBSOLETE_KILL	-2
	unsigned short		header_len;	/* more space at head required */
	unsigned short		trailer_len;	/* space to reserve at tail */
	unsigned short		__pad3;

#ifdef CONFIG_IP_ROUTE_CLASSID
	__u32			tclassid;
#else
	__u32			__pad2;
#endif

#ifdef CONFIG_64BIT
	/*
	 * Align __refcnt to a 64 bytes alignment
	 * (L1_CACHE_SIZE would be too much)
	 */
	long			__pad_to_align_refcnt[2];
#endif
	/*
	 * __refcnt wants to be on a different cache line from
	 * input/output/ops or performance tanks badly
	 */
	atomic_t		__refcnt;	/* client references	*/
	int			__use;
	unsigned long		lastuse;
	struct lwtunnel_state   *lwtstate;
	union {
		struct dst_entry	*next;
		struct rtable __rcu	*rt_next;
		struct rt6_info		*rt6_next;
		struct dn_route __rcu	*dn_next;
	};
};

And here is the copy paste of API skb_dst() which returns the dst_entry linked to the corresponding skbuff instance (include/linux/skbuff.h) from the Kernel-source version 4.13 for quick reference:

/**
 * skb_dst - returns skb dst_entry
 * @skb: buffer
 *
 * Returns skb dst_entry, regardless of reference taken or not.
 */
static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
{
	/* If refdst was not refcounted, check we still are in a 
	 * rcu_read_lock section
	 */
	WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) &&
		!rcu_read_lock_held() &&
		!rcu_read_lock_bh_held());
	return (struct dst_entry *)(skb->_skb_refdst & SKB_DST_PTRMASK);
}

Here is the Network data/API flow through kernel for quick reference:
Source: https://wiki.linuxfoundation.org/images/1/1c/Network_data_flow_through_kernel.png
Network data/API flow through kernel for quick reference



Suggested Topics:


Video Episodes :: Linux Kernel programming

Linux Kernel Architecture ↗
Friday' 10-Jul-2020

Linux Kernel - Containers and Namespaces ↗
Friday' 10-Jul-2020

Linux Kernel Compilation ↗
Thursday' 09-Jul-2020

Linux Kernel /proc Interface ↗
Thursday' 09-Jul-2020

Linux ioctl() API interface ↗
Friday' 10-Jul-2020
Watch detailed videos and read topics on Linux Kernel Programming and Linux ioctl() API interface

Linux Operating System - User-space Processes ↗
Friday' 10-Jul-2020

Linux Kernel FileSystems Subsystem ↗
Friday' 10-Jul-2020

Linux Kernel Programming ↗
Friday' 10-Jul-2020

Linux Kernel Programming - Device Drivers ↗
Thursday' 09-Jul-2020
Watch detailed videos and read topics on Linux Kernel Programming - Device Drivers

Join The Linux Channel :: Facebook Group ↗

Visit The Linux Channel :: on Youtube ↗


Join a course:

💎 Linux, Kernel, Networking and Device Drivers: PDF Brochure
💎 PhD or equivalent (or Post Doctoral) looking for assistance: Details
💎 ... or unlimited life-time mentorship: Details


💗 Help shape the future: Sponsor/Donate


Tópicos recomendados:
Featured Video:
Assista no Youtube - [1652//0] VLOG - NETGEAR ReadyNAS RN104 NAS Disk Upgrade Live Demo ↗

Roadmap - How to become Linux Kernel Developer - Device Drivers Programmer and a Systems Software Expert ↗
Friday' 10-Jul-2020
Many viewers and even sometimes my students ask me how I can become a kernel programmer or just device driver developer and so on. So I shot this video (and an add-on video) where I summarized steps and a roadmap to become a full-fledged Linux Kernel Developer.

Compiling a C Compiler with a C Compilter | Compile gcc with gcc ↗
Friday' 10-Jul-2020
The fundamental aspect of a programming language compiler is to translate code written from language to other. But most commonly compilers will compile code written in high-level human friendly language such as C, C++, Java, etc. to native CPU architecture specific (machine understandable) binary code which is nothing but sequence of CPU instructions. Hence if we see that way we should able to compile gcc Compiler source code with a gcc Compiler binary.

AT&T Archives: The UNIX Operating System ↗
Friday' 10-Jul-2020

CEO, CTO Talk ↗
Friday' 10-Jul-2020

Arduino UNO - RO Water Purifier Controller ↗
Friday' 10-Jul-2020
Here is a Youtube VLOG of my DIY RO Water Purifier Controller done via Arduino UNO. I want the Arduino UNO to control the RO pump, so that it pumps for a specific duration and stops automatically. This is done via Opto-isolated 4 Channel 5V 10A Relay Board meant for Arduino UNO, Raspberry Pi or similar SoC boards which offers GPIO pins. To this relay I have connected the RO water purifier booster pump which works at 24V DC connected via 220V AC to 24V DC power supply adaptar. I have also connected a small active 5V buzzer to notify the progress and completion as it fills the tank/canister.

Nmap Network Scanning ↗
Friday' 10-Jul-2020

CYRIL INGÉNIERIE - CoreFreq Linux CPU monitoring software ↗
Friday' 10-Jul-2020

Programming Language Performance and Overheads ↗
Friday' 10-Jul-2020
A detailed Youtube video series of various programming language performance and overheads - a big picture

Linux Kernel Network Programming - Transport Layer L4 TCP/UDP Registration - Protocol APIs ↗
Friday' 10-Jul-2020

mmap() munmap() - map or unmap files or devices into memory ↗
Friday' 10-Jul-2020


Trending Video:
Assista no Youtube - [18725//0] How to start Open-Source Project - Episode1 #TheLinuxChannel #KiranKankipti ↗

B.E(B.Tech, B.S) and M.E(M.Tech, M.S) Collage Final Year Projects ↗
Friday' 10-Jul-2020



Recommended Video:
Assista no Youtube - [97//0] B.E and M.E Final Year Projects - Execute your project ↗