aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-06-02 01:19:30 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-03 05:51:04 -0400
commitadf30907d63893e4208dfe3f5c88ae12bc2f25d5 (patch)
tree0f07542bb95de2ad537540868aba6cf87a86e17d /drivers
parent511c3f92ad5b6d9f8f6464be1b4f85f0422be91a (diff)
net: skb->dst accessors
Define three accessors to get/set dst attached to a skb struct dst_entry *skb_dst(const struct sk_buff *skb) void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) void skb_dst_drop(struct sk_buff *skb) This one should replace occurrences of : dst_release(skb->dst) skb->dst = NULL; Delete skb->dst field Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c30
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c10
-rw-r--r--drivers/net/pppol2tp.c11
-rw-r--r--drivers/s390/net/qeth_core_main.c4
-rw-r--r--drivers/s390/net/qeth_l3_main.c8
6 files changed, 33 insertions, 34 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 4248c3139364..181b1f32325f 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -1394,8 +1394,8 @@ void ipoib_cm_skb_too_long(struct net_device *dev, struct sk_buff *skb,
1394 struct ipoib_dev_priv *priv = netdev_priv(dev); 1394 struct ipoib_dev_priv *priv = netdev_priv(dev);
1395 int e = skb_queue_empty(&priv->cm.skb_queue); 1395 int e = skb_queue_empty(&priv->cm.skb_queue);
1396 1396
1397 if (skb->dst) 1397 if (skb_dst(skb))
1398 skb->dst->ops->update_pmtu(skb->dst, mtu); 1398 skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu);
1399 1399
1400 skb_queue_tail(&priv->cm.skb_queue, skb); 1400 skb_queue_tail(&priv->cm.skb_queue, skb);
1401 if (e) 1401 if (e)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 69c6304cc943..e319d91f60a6 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -561,7 +561,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
561 struct ipoib_neigh *neigh; 561 struct ipoib_neigh *neigh;
562 unsigned long flags; 562 unsigned long flags;
563 563
564 neigh = ipoib_neigh_alloc(skb->dst->neighbour, skb->dev); 564 neigh = ipoib_neigh_alloc(skb_dst(skb)->neighbour, skb->dev);
565 if (!neigh) { 565 if (!neigh) {
566 ++dev->stats.tx_dropped; 566 ++dev->stats.tx_dropped;
567 dev_kfree_skb_any(skb); 567 dev_kfree_skb_any(skb);
@@ -570,9 +570,9 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
570 570
571 spin_lock_irqsave(&priv->lock, flags); 571 spin_lock_irqsave(&priv->lock, flags);
572 572
573 path = __path_find(dev, skb->dst->neighbour->ha + 4); 573 path = __path_find(dev, skb_dst(skb)->neighbour->ha + 4);
574 if (!path) { 574 if (!path) {
575 path = path_rec_create(dev, skb->dst->neighbour->ha + 4); 575 path = path_rec_create(dev, skb_dst(skb)->neighbour->ha + 4);
576 if (!path) 576 if (!path)
577 goto err_path; 577 goto err_path;
578 578
@@ -605,7 +605,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
605 goto err_drop; 605 goto err_drop;
606 } 606 }
607 } else 607 } else
608 ipoib_send(dev, skb, path->ah, IPOIB_QPN(skb->dst->neighbour->ha)); 608 ipoib_send(dev, skb, path->ah, IPOIB_QPN(skb_dst(skb)->neighbour->ha));
609 } else { 609 } else {
610 neigh->ah = NULL; 610 neigh->ah = NULL;
611 611
@@ -635,15 +635,15 @@ static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev)
635 struct ipoib_dev_priv *priv = netdev_priv(skb->dev); 635 struct ipoib_dev_priv *priv = netdev_priv(skb->dev);
636 636
637 /* Look up path record for unicasts */ 637 /* Look up path record for unicasts */
638 if (skb->dst->neighbour->ha[4] != 0xff) { 638 if (skb_dst(skb)->neighbour->ha[4] != 0xff) {
639 neigh_add_path(skb, dev); 639 neigh_add_path(skb, dev);
640 return; 640 return;
641 } 641 }
642 642
643 /* Add in the P_Key for multicasts */ 643 /* Add in the P_Key for multicasts */
644 skb->dst->neighbour->ha[8] = (priv->pkey >> 8) & 0xff; 644 skb_dst(skb)->neighbour->ha[8] = (priv->pkey >> 8) & 0xff;
645 skb->dst->neighbour->ha[9] = priv->pkey & 0xff; 645 skb_dst(skb)->neighbour->ha[9] = priv->pkey & 0xff;
646 ipoib_mcast_send(dev, skb->dst->neighbour->ha + 4, skb); 646 ipoib_mcast_send(dev, skb_dst(skb)->neighbour->ha + 4, skb);
647} 647}
648 648
649static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev, 649static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev,
@@ -708,16 +708,16 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
708 struct ipoib_neigh *neigh; 708 struct ipoib_neigh *neigh;
709 unsigned long flags; 709 unsigned long flags;
710 710
711 if (likely(skb->dst && skb->dst->neighbour)) { 711 if (likely(skb_dst(skb) && skb_dst(skb)->neighbour)) {
712 if (unlikely(!*to_ipoib_neigh(skb->dst->neighbour))) { 712 if (unlikely(!*to_ipoib_neigh(skb_dst(skb)->neighbour))) {
713 ipoib_path_lookup(skb, dev); 713 ipoib_path_lookup(skb, dev);
714 return NETDEV_TX_OK; 714 return NETDEV_TX_OK;
715 } 715 }
716 716
717 neigh = *to_ipoib_neigh(skb->dst->neighbour); 717 neigh = *to_ipoib_neigh(skb_dst(skb)->neighbour);
718 718
719 if (unlikely((memcmp(&neigh->dgid.raw, 719 if (unlikely((memcmp(&neigh->dgid.raw,
720 skb->dst->neighbour->ha + 4, 720 skb_dst(skb)->neighbour->ha + 4,
721 sizeof(union ib_gid))) || 721 sizeof(union ib_gid))) ||
722 (neigh->dev != dev))) { 722 (neigh->dev != dev))) {
723 spin_lock_irqsave(&priv->lock, flags); 723 spin_lock_irqsave(&priv->lock, flags);
@@ -743,7 +743,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
743 return NETDEV_TX_OK; 743 return NETDEV_TX_OK;
744 } 744 }
745 } else if (neigh->ah) { 745 } else if (neigh->ah) {
746 ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(skb->dst->neighbour->ha)); 746 ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(skb_dst(skb)->neighbour->ha));
747 return NETDEV_TX_OK; 747 return NETDEV_TX_OK;
748 } 748 }
749 749
@@ -772,7 +772,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
772 if ((be16_to_cpup((__be16 *) skb->data) != ETH_P_ARP) && 772 if ((be16_to_cpup((__be16 *) skb->data) != ETH_P_ARP) &&
773 (be16_to_cpup((__be16 *) skb->data) != ETH_P_RARP)) { 773 (be16_to_cpup((__be16 *) skb->data) != ETH_P_RARP)) {
774 ipoib_warn(priv, "Unicast, no %s: type %04x, QPN %06x %pI6\n", 774 ipoib_warn(priv, "Unicast, no %s: type %04x, QPN %06x %pI6\n",
775 skb->dst ? "neigh" : "dst", 775 skb_dst(skb) ? "neigh" : "dst",
776 be16_to_cpup((__be16 *) skb->data), 776 be16_to_cpup((__be16 *) skb->data),
777 IPOIB_QPN(phdr->hwaddr), 777 IPOIB_QPN(phdr->hwaddr),
778 phdr->hwaddr + 4); 778 phdr->hwaddr + 4);
@@ -817,7 +817,7 @@ static int ipoib_hard_header(struct sk_buff *skb,
817 * destination address onto the front of the skb so we can 817 * destination address onto the front of the skb so we can
818 * figure out where to send the packet later. 818 * figure out where to send the packet later.
819 */ 819 */
820 if ((!skb->dst || !skb->dst->neighbour) && daddr) { 820 if ((!skb_dst(skb) || !skb_dst(skb)->neighbour) && daddr) {
821 struct ipoib_pseudoheader *phdr = 821 struct ipoib_pseudoheader *phdr =
822 (struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr); 822 (struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr);
823 memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN); 823 memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 425e31112ed7..a0e97532e714 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -261,7 +261,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
261 261
262 skb->dev = dev; 262 skb->dev = dev;
263 263
264 if (!skb->dst || !skb->dst->neighbour) { 264 if (!skb_dst(skb) || !skb_dst(skb)->neighbour) {
265 /* put pseudoheader back on for next time */ 265 /* put pseudoheader back on for next time */
266 skb_push(skb, sizeof (struct ipoib_pseudoheader)); 266 skb_push(skb, sizeof (struct ipoib_pseudoheader));
267 } 267 }
@@ -707,10 +707,10 @@ void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb)
707 707
708out: 708out:
709 if (mcast && mcast->ah) { 709 if (mcast && mcast->ah) {
710 if (skb->dst && 710 if (skb_dst(skb) &&
711 skb->dst->neighbour && 711 skb_dst(skb)->neighbour &&
712 !*to_ipoib_neigh(skb->dst->neighbour)) { 712 !*to_ipoib_neigh(skb_dst(skb)->neighbour)) {
713 struct ipoib_neigh *neigh = ipoib_neigh_alloc(skb->dst->neighbour, 713 struct ipoib_neigh *neigh = ipoib_neigh_alloc(skb_dst(skb)->neighbour,
714 skb->dev); 714 skb->dev);
715 715
716 if (neigh) { 716 if (neigh) {
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index 5981debcde5e..e7935d09c896 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -433,8 +433,7 @@ static void pppol2tp_recv_dequeue_skb(struct pppol2tp_session *session, struct s
433 * to the inner packet either 433 * to the inner packet either
434 */ 434 */
435 secpath_reset(skb); 435 secpath_reset(skb);
436 dst_release(skb->dst); 436 skb_dst_drop(skb);
437 skb->dst = NULL;
438 nf_reset(skb); 437 nf_reset(skb);
439 438
440 po = pppox_sk(session_sock); 439 po = pppox_sk(session_sock);
@@ -976,7 +975,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
976 /* Calculate UDP checksum if configured to do so */ 975 /* Calculate UDP checksum if configured to do so */
977 if (sk_tun->sk_no_check == UDP_CSUM_NOXMIT) 976 if (sk_tun->sk_no_check == UDP_CSUM_NOXMIT)
978 skb->ip_summed = CHECKSUM_NONE; 977 skb->ip_summed = CHECKSUM_NONE;
979 else if (!(skb->dst->dev->features & NETIF_F_V4_CSUM)) { 978 else if (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM)) {
980 skb->ip_summed = CHECKSUM_COMPLETE; 979 skb->ip_summed = CHECKSUM_COMPLETE;
981 csum = skb_checksum(skb, 0, udp_len, 0); 980 csum = skb_checksum(skb, 0, udp_len, 0);
982 uh->check = csum_tcpudp_magic(inet->saddr, inet->daddr, 981 uh->check = csum_tcpudp_magic(inet->saddr, inet->daddr,
@@ -1172,14 +1171,14 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1172 nf_reset(skb); 1171 nf_reset(skb);
1173 1172
1174 /* Get routing info from the tunnel socket */ 1173 /* Get routing info from the tunnel socket */
1175 dst_release(skb->dst); 1174 skb_dst_drop(skb);
1176 skb->dst = dst_clone(__sk_dst_get(sk_tun)); 1175 skb_dst_set(skb, dst_clone(__sk_dst_get(sk_tun)));
1177 pppol2tp_skb_set_owner_w(skb, sk_tun); 1176 pppol2tp_skb_set_owner_w(skb, sk_tun);
1178 1177
1179 /* Calculate UDP checksum if configured to do so */ 1178 /* Calculate UDP checksum if configured to do so */
1180 if (sk_tun->sk_no_check == UDP_CSUM_NOXMIT) 1179 if (sk_tun->sk_no_check == UDP_CSUM_NOXMIT)
1181 skb->ip_summed = CHECKSUM_NONE; 1180 skb->ip_summed = CHECKSUM_NONE;
1182 else if (!(skb->dst->dev->features & NETIF_F_V4_CSUM)) { 1181 else if (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM)) {
1183 skb->ip_summed = CHECKSUM_COMPLETE; 1182 skb->ip_summed = CHECKSUM_COMPLETE;
1184 csum = skb_checksum(skb, 0, udp_len, 0); 1183 csum = skb_checksum(skb, 0, udp_len, 0);
1185 uh->check = csum_tcpudp_magic(inet->saddr, inet->daddr, 1184 uh->check = csum_tcpudp_magic(inet->saddr, inet->daddr,
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 2994aa1ed466..74c49d9a8dba 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -2937,8 +2937,8 @@ int qeth_get_cast_type(struct qeth_card *card, struct sk_buff *skb)
2937 if (card->info.type == QETH_CARD_TYPE_OSN) 2937 if (card->info.type == QETH_CARD_TYPE_OSN)
2938 return cast_type; 2938 return cast_type;
2939 2939
2940 if (skb->dst && skb->dst->neighbour) { 2940 if (skb_dst(skb) && skb_dst(skb)->neighbour) {
2941 cast_type = skb->dst->neighbour->type; 2941 cast_type = skb_dst(skb)->neighbour->type;
2942 if ((cast_type == RTN_BROADCAST) || 2942 if ((cast_type == RTN_BROADCAST) ||
2943 (cast_type == RTN_MULTICAST) || 2943 (cast_type == RTN_MULTICAST) ||
2944 (cast_type == RTN_ANYCAST)) 2944 (cast_type == RTN_ANYCAST))
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index cb64b0b534a2..6f2386e9d6e2 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2549,9 +2549,9 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
2549 /* IPv4 */ 2549 /* IPv4 */
2550 hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type); 2550 hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type);
2551 memset(hdr->hdr.l3.dest_addr, 0, 12); 2551 memset(hdr->hdr.l3.dest_addr, 0, 12);
2552 if ((skb->dst) && (skb->dst->neighbour)) { 2552 if ((skb_dst(skb)) && (skb_dst(skb)->neighbour)) {
2553 *((u32 *) (&hdr->hdr.l3.dest_addr[12])) = 2553 *((u32 *) (&hdr->hdr.l3.dest_addr[12])) =
2554 *((u32 *) skb->dst->neighbour->primary_key); 2554 *((u32 *) skb_dst(skb)->neighbour->primary_key);
2555 } else { 2555 } else {
2556 /* fill in destination address used in ip header */ 2556 /* fill in destination address used in ip header */
2557 *((u32 *) (&hdr->hdr.l3.dest_addr[12])) = 2557 *((u32 *) (&hdr->hdr.l3.dest_addr[12])) =
@@ -2562,9 +2562,9 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
2562 hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags6(cast_type); 2562 hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags6(cast_type);
2563 if (card->info.type == QETH_CARD_TYPE_IQD) 2563 if (card->info.type == QETH_CARD_TYPE_IQD)
2564 hdr->hdr.l3.flags &= ~QETH_HDR_PASSTHRU; 2564 hdr->hdr.l3.flags &= ~QETH_HDR_PASSTHRU;
2565 if ((skb->dst) && (skb->dst->neighbour)) { 2565 if ((skb_dst(skb)) && (skb_dst(skb)->neighbour)) {
2566 memcpy(hdr->hdr.l3.dest_addr, 2566 memcpy(hdr->hdr.l3.dest_addr,
2567 skb->dst->neighbour->primary_key, 16); 2567 skb_dst(skb)->neighbour->primary_key, 16);
2568 } else { 2568 } else {
2569 /* fill in destination address used in ip header */ 2569 /* fill in destination address used in ip header */
2570 memcpy(hdr->hdr.l3.dest_addr, 2570 memcpy(hdr->hdr.l3.dest_addr,