aboutsummaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
authorOliver Hartkopp <socketcan@hartkopp.net>2013-01-28 03:33:33 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-28 18:17:25 -0500
commit2bf3440d7b8755f2627232e6a4c37efbbe053685 (patch)
tree07e31649ec6a5d58649f6b3c9f8cd1a76e76b24f /net/can
parentcef401de7be8c4e155c6746bfccf721a4fa5fab9 (diff)
can: rework skb reserved data handling
Added accessor and skb_reserve helpers for struct can_skb_priv. Removed pointless skb_headroom() check. Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> CC: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/can')
-rw-r--r--net/can/bcm.c8
-rw-r--r--net/can/gw.c4
-rw-r--r--net/can/raw.c4
3 files changed, 7 insertions, 9 deletions
diff --git a/net/can/bcm.c b/net/can/bcm.c
index ccc27b9e8384..28e12d18f0f1 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -261,8 +261,8 @@ static void bcm_can_tx(struct bcm_op *op)
261 if (!skb) 261 if (!skb)
262 goto out; 262 goto out;
263 263
264 skb_reserve(skb, sizeof(struct can_skb_priv)); 264 can_skb_reserve(skb);
265 ((struct can_skb_priv *)(skb->head))->ifindex = dev->ifindex; 265 can_skb_prv(skb)->ifindex = dev->ifindex;
266 266
267 memcpy(skb_put(skb, CFSIZ), cf, CFSIZ); 267 memcpy(skb_put(skb, CFSIZ), cf, CFSIZ);
268 268
@@ -1207,7 +1207,7 @@ static int bcm_tx_send(struct msghdr *msg, int ifindex, struct sock *sk)
1207 if (!skb) 1207 if (!skb)
1208 return -ENOMEM; 1208 return -ENOMEM;
1209 1209
1210 skb_reserve(skb, sizeof(struct can_skb_priv)); 1210 can_skb_reserve(skb);
1211 1211
1212 err = memcpy_fromiovec(skb_put(skb, CFSIZ), msg->msg_iov, CFSIZ); 1212 err = memcpy_fromiovec(skb_put(skb, CFSIZ), msg->msg_iov, CFSIZ);
1213 if (err < 0) { 1213 if (err < 0) {
@@ -1221,7 +1221,7 @@ static int bcm_tx_send(struct msghdr *msg, int ifindex, struct sock *sk)
1221 return -ENODEV; 1221 return -ENODEV;
1222 } 1222 }
1223 1223
1224 ((struct can_skb_priv *)(skb->head))->ifindex = dev->ifindex; 1224 can_skb_prv(skb)->ifindex = dev->ifindex;
1225 skb->dev = dev; 1225 skb->dev = dev;
1226 skb->sk = sk; 1226 skb->sk = sk;
1227 err = can_send(skb, 1); /* send with loopback */ 1227 err = can_send(skb, 1); /* send with loopback */
diff --git a/net/can/gw.c b/net/can/gw.c
index acdd4656cc3b..c185fcd5e828 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -381,9 +381,7 @@ static void can_can_gw_rcv(struct sk_buff *skb, void *data)
381 381
382 /* is sending the skb back to the incoming interface not allowed? */ 382 /* is sending the skb back to the incoming interface not allowed? */
383 if (!(gwj->flags & CGW_FLAGS_CAN_IIF_TX_OK) && 383 if (!(gwj->flags & CGW_FLAGS_CAN_IIF_TX_OK) &&
384 skb_headroom(skb) == sizeof(struct can_skb_priv) && 384 can_skb_prv(skb)->ifindex == gwj->dst.dev->ifindex)
385 (((struct can_skb_priv *)(skb->head))->ifindex ==
386 gwj->dst.dev->ifindex))
387 return; 385 return;
388 386
389 /* 387 /*
diff --git a/net/can/raw.c b/net/can/raw.c
index 5d860e8dcc52..c1764e41ddaf 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -705,8 +705,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
705 if (!skb) 705 if (!skb)
706 goto put_dev; 706 goto put_dev;
707 707
708 skb_reserve(skb, sizeof(struct can_skb_priv)); 708 can_skb_reserve(skb);
709 ((struct can_skb_priv *)(skb->head))->ifindex = dev->ifindex; 709 can_skb_prv(skb)->ifindex = dev->ifindex;
710 710
711 err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); 711 err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
712 if (err < 0) 712 if (err < 0)