forked from torvalds/linux
-
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.
can: add private data space for CAN sk_buffs
The struct can_skb_priv is used to transport additional information along with the stored struct can(fd)_frame that can not be contained in existing struct sk_buff elements. can_skb_priv is located in the skb headroom, which does not touch the existing CAN sk_buff usage with skb->data and skb->len, so that even out-of-tree CAN drivers can be used without changes. Btw. out-of-tree CAN drivers without can_skb_priv in the sk_buff headroom would not support features based on can_skb_priv. The can_skb_priv->ifindex contains the first interface where the CAN frame appeared on the local host. Unfortunately skb->skb_iif can not be used as this value is overwritten in every netif_receive_skb() call. Signed-off-by: Oliver Hartkopp <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
- Loading branch information
1 parent
e2d5f2c
commit 156c2bb
Showing
5 changed files
with
64 additions
and
7 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
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,35 @@ | ||
/* | ||
* linux/can/skb.h | ||
* | ||
* Definitions for the CAN network socket buffer | ||
* | ||
* Copyright (C) 2012 Oliver Hartkopp <[email protected]> | ||
* | ||
*/ | ||
|
||
#ifndef CAN_SKB_H | ||
#define CAN_SKB_H | ||
|
||
#include <linux/types.h> | ||
#include <linux/can.h> | ||
|
||
/* | ||
* The struct can_skb_priv is used to transport additional information along | ||
* with the stored struct can(fd)_frame that can not be contained in existing | ||
* struct sk_buff elements. | ||
* N.B. that this information must not be modified in cloned CAN sk_buffs. | ||
* To modify the CAN frame content or the struct can_skb_priv content | ||
* skb_copy() needs to be used instead of skb_clone(). | ||
*/ | ||
|
||
/** | ||
* struct can_skb_priv - private additional data inside CAN sk_buffs | ||
* @ifindex: ifindex of the first interface the CAN frame appeared on | ||
* @cf: align to the following CAN frame at skb->data | ||
*/ | ||
struct can_skb_priv { | ||
int ifindex; | ||
struct can_frame cf[0]; | ||
}; | ||
|
||
#endif /* CAN_SKB_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