diff options
author | Oliver Hartkopp <oliver@hartkopp.net> | 2009-01-06 20:07:54 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-06 20:07:54 +0100 |
commit | 1fa17d4ba43d7e5aab5e90777b07da06524f6748 (patch) | |
tree | ebe8704bd84c51d29c17a8425b496a13b4935dc5 /net/can/raw.c | |
parent | dm9601: bring datasheet URL up to date (diff) | |
download | linux-1fa17d4ba43d7e5aab5e90777b07da06524f6748.tar.xz linux-1fa17d4ba43d7e5aab5e90777b07da06524f6748.zip |
can: omit unneeded skb_clone() calls
The AF_CAN core delivered always cloned sk_buffs to the AF_CAN
protocols, although this was _only_ needed by the can-raw protocol.
With this (additionally documented) change, the AF_CAN core calls the
callback functions of the registered AF_CAN protocols with the original
(uncloned) sk_buff pointer and let's the can-raw protocol do the
skb_clone() itself which omits all unneeded skb_clone() calls for other
AF_CAN protocols.
Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: Urs Thuermann <urs.thuermann@volkswagen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | net/can/raw.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/net/can/raw.c b/net/can/raw.c index 27aab63df467..0703cba4bf9f 100644 --- a/net/can/raw.c +++ b/net/can/raw.c @@ -99,13 +99,14 @@ static void raw_rcv(struct sk_buff *skb, void *data) struct raw_sock *ro = raw_sk(sk); struct sockaddr_can *addr; - if (!ro->recv_own_msgs) { - /* check the received tx sock reference */ - if (skb->sk == sk) { - kfree_skb(skb); - return; - } - } + /* check the received tx sock reference */ + if (!ro->recv_own_msgs && skb->sk == sk) + return; + + /* clone the given skb to be able to enqueue it into the rcv queue */ + skb = skb_clone(skb, GFP_ATOMIC); + if (!skb) + return; /* * Put the datagram to the queue so that raw_recvmsg() can |