Commit 046ef24d authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford

IB/rxe: Enable type checking on SKB_TO_PKT() and PKT_TO_SKB() arguments

Let the compiler check the type of the arguments passed to SKB_TO_PKT()
and PKT_TO_SKB().
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Reviewed-by: default avatarAndrew Boyer <andrew.boyer@dell.com>
Cc: Moni Shoua <monis@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 967335ab
...@@ -53,8 +53,16 @@ struct rxe_pkt_info { ...@@ -53,8 +53,16 @@ struct rxe_pkt_info {
}; };
/* Macros should be used only for received skb */ /* Macros should be used only for received skb */
#define SKB_TO_PKT(skb) ((struct rxe_pkt_info *)(skb)->cb) static inline struct rxe_pkt_info *SKB_TO_PKT(struct sk_buff *skb)
#define PKT_TO_SKB(pkt) container_of((void *)(pkt), struct sk_buff, cb) {
BUILD_BUG_ON(sizeof(struct rxe_pkt_info) > sizeof(skb->cb));
return (void *)skb->cb;
}
static inline struct sk_buff *PKT_TO_SKB(struct rxe_pkt_info *pkt)
{
return container_of((void *)pkt, struct sk_buff, cb);
}
/* /*
* IBA header types and methods * IBA header types and methods
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment