-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces a new dst_metadata which enables to carry per packet metadata between forwarding and processing elements via the skb->dst pointer. The structure is set up to be a union. Thus, each separate type of metadata requires its own dst instance. If demand arises to carry multiple types of metadata concurrently, metadata dst entries can be made stackable. The metadata dst entry is refcnt'ed as expected for now but a non reference counted use is possible if the reference is forced before queueing the skb. In order to allow allocating dsts with variable length, the existing dst_alloc() is split into a dst_alloc() and dst_init() function. The existing dst_init() function to initialize the subsystem is being renamed to dst_subsys_init() to make it clear what is what. The check before ip_route_input() is changed to ignore metadata dsts and drop the dst inside the routing function thus allowing to interpret metadata in a later commit. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Thomas Graf
authored and
David S. Miller
committed
Jul 21, 2015
1 parent
773a69d
commit f38a9eb
Showing
6 changed files
with
112 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef __NET_DST_METADATA_H | ||
#define __NET_DST_METADATA_H 1 | ||
|
||
#include <linux/skbuff.h> | ||
#include <net/ip_tunnels.h> | ||
#include <net/dst.h> | ||
|
||
struct metadata_dst { | ||
struct dst_entry dst; | ||
size_t opts_len; | ||
}; | ||
|
||
static inline struct metadata_dst *skb_metadata_dst(struct sk_buff *skb) | ||
{ | ||
struct metadata_dst *md_dst = (struct metadata_dst *) skb_dst(skb); | ||
|
||
if (md_dst && md_dst->dst.flags & DST_METADATA) | ||
return md_dst; | ||
|
||
return NULL; | ||
} | ||
|
||
static inline bool skb_valid_dst(const struct sk_buff *skb) | ||
{ | ||
struct dst_entry *dst = skb_dst(skb); | ||
|
||
return dst && !(dst->flags & DST_METADATA); | ||
} | ||
|
||
struct metadata_dst *metadata_dst_alloc(u8 optslen, gfp_t flags); | ||
|
||
#endif /* __NET_DST_METADATA_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters