Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit adf30907 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

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: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 511c3f92
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1394,8 +1394,8 @@ void ipoib_cm_skb_too_long(struct net_device *dev, struct sk_buff *skb,
	struct ipoib_dev_priv *priv = netdev_priv(dev);
	int e = skb_queue_empty(&priv->cm.skb_queue);

	if (skb->dst)
		skb->dst->ops->update_pmtu(skb->dst, mtu);
	if (skb_dst(skb))
		skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu);

	skb_queue_tail(&priv->cm.skb_queue, skb);
	if (e)
+15 −15
Original line number Diff line number Diff line
@@ -561,7 +561,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
	struct ipoib_neigh *neigh;
	unsigned long flags;

	neigh = ipoib_neigh_alloc(skb->dst->neighbour, skb->dev);
	neigh = ipoib_neigh_alloc(skb_dst(skb)->neighbour, skb->dev);
	if (!neigh) {
		++dev->stats.tx_dropped;
		dev_kfree_skb_any(skb);
@@ -570,9 +570,9 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)

	spin_lock_irqsave(&priv->lock, flags);

	path = __path_find(dev, skb->dst->neighbour->ha + 4);
	path = __path_find(dev, skb_dst(skb)->neighbour->ha + 4);
	if (!path) {
		path = path_rec_create(dev, skb->dst->neighbour->ha + 4);
		path = path_rec_create(dev, skb_dst(skb)->neighbour->ha + 4);
		if (!path)
			goto err_path;

@@ -605,7 +605,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
				goto err_drop;
			}
		} else
			ipoib_send(dev, skb, path->ah, IPOIB_QPN(skb->dst->neighbour->ha));
			ipoib_send(dev, skb, path->ah, IPOIB_QPN(skb_dst(skb)->neighbour->ha));
	} else {
		neigh->ah  = NULL;

@@ -635,15 +635,15 @@ static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev)
	struct ipoib_dev_priv *priv = netdev_priv(skb->dev);

	/* Look up path record for unicasts */
	if (skb->dst->neighbour->ha[4] != 0xff) {
	if (skb_dst(skb)->neighbour->ha[4] != 0xff) {
		neigh_add_path(skb, dev);
		return;
	}

	/* Add in the P_Key for multicasts */
	skb->dst->neighbour->ha[8] = (priv->pkey >> 8) & 0xff;
	skb->dst->neighbour->ha[9] = priv->pkey & 0xff;
	ipoib_mcast_send(dev, skb->dst->neighbour->ha + 4, skb);
	skb_dst(skb)->neighbour->ha[8] = (priv->pkey >> 8) & 0xff;
	skb_dst(skb)->neighbour->ha[9] = priv->pkey & 0xff;
	ipoib_mcast_send(dev, skb_dst(skb)->neighbour->ha + 4, skb);
}

static 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)
	struct ipoib_neigh *neigh;
	unsigned long flags;

	if (likely(skb->dst && skb->dst->neighbour)) {
		if (unlikely(!*to_ipoib_neigh(skb->dst->neighbour))) {
	if (likely(skb_dst(skb) && skb_dst(skb)->neighbour)) {
		if (unlikely(!*to_ipoib_neigh(skb_dst(skb)->neighbour))) {
			ipoib_path_lookup(skb, dev);
			return NETDEV_TX_OK;
		}

		neigh = *to_ipoib_neigh(skb->dst->neighbour);
		neigh = *to_ipoib_neigh(skb_dst(skb)->neighbour);

		if (unlikely((memcmp(&neigh->dgid.raw,
				     skb->dst->neighbour->ha + 4,
				     skb_dst(skb)->neighbour->ha + 4,
				     sizeof(union ib_gid))) ||
			     (neigh->dev != dev))) {
			spin_lock_irqsave(&priv->lock, flags);
@@ -743,7 +743,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
				return NETDEV_TX_OK;
			}
		} else if (neigh->ah) {
			ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(skb->dst->neighbour->ha));
			ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(skb_dst(skb)->neighbour->ha));
			return NETDEV_TX_OK;
		}

@@ -772,7 +772,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
			if ((be16_to_cpup((__be16 *) skb->data) != ETH_P_ARP) &&
			    (be16_to_cpup((__be16 *) skb->data) != ETH_P_RARP)) {
				ipoib_warn(priv, "Unicast, no %s: type %04x, QPN %06x %pI6\n",
					   skb->dst ? "neigh" : "dst",
					   skb_dst(skb) ? "neigh" : "dst",
					   be16_to_cpup((__be16 *) skb->data),
					   IPOIB_QPN(phdr->hwaddr),
					   phdr->hwaddr + 4);
@@ -817,7 +817,7 @@ static int ipoib_hard_header(struct sk_buff *skb,
	 * destination address onto the front of the skb so we can
	 * figure out where to send the packet later.
	 */
	if ((!skb->dst || !skb->dst->neighbour) && daddr) {
	if ((!skb_dst(skb) || !skb_dst(skb)->neighbour) && daddr) {
		struct ipoib_pseudoheader *phdr =
			(struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr);
		memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN);
+5 −5
Original line number Diff line number Diff line
@@ -261,7 +261,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,

		skb->dev = dev;

		if (!skb->dst || !skb->dst->neighbour) {
		if (!skb_dst(skb) || !skb_dst(skb)->neighbour) {
			/* put pseudoheader back on for next time */
			skb_push(skb, sizeof (struct ipoib_pseudoheader));
		}
@@ -707,10 +707,10 @@ void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb)

out:
	if (mcast && mcast->ah) {
		if (skb->dst		&&
		    skb->dst->neighbour &&
		    !*to_ipoib_neigh(skb->dst->neighbour)) {
			struct ipoib_neigh *neigh = ipoib_neigh_alloc(skb->dst->neighbour,
		if (skb_dst(skb)		&&
		    skb_dst(skb)->neighbour &&
		    !*to_ipoib_neigh(skb_dst(skb)->neighbour)) {
			struct ipoib_neigh *neigh = ipoib_neigh_alloc(skb_dst(skb)->neighbour,
									skb->dev);

			if (neigh) {
+5 −6
Original line number Diff line number Diff line
@@ -433,8 +433,7 @@ static void pppol2tp_recv_dequeue_skb(struct pppol2tp_session *session, struct s
		 *   to the inner packet either
		 */
		secpath_reset(skb);
		dst_release(skb->dst);
		skb->dst = NULL;
		skb_dst_drop(skb);
		nf_reset(skb);

		po = pppox_sk(session_sock);
@@ -976,7 +975,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
	/* Calculate UDP checksum if configured to do so */
	if (sk_tun->sk_no_check == UDP_CSUM_NOXMIT)
		skb->ip_summed = CHECKSUM_NONE;
	else if (!(skb->dst->dev->features & NETIF_F_V4_CSUM)) {
	else if (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM)) {
		skb->ip_summed = CHECKSUM_COMPLETE;
		csum = skb_checksum(skb, 0, udp_len, 0);
		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)
	nf_reset(skb);

	/* Get routing info from the tunnel socket */
	dst_release(skb->dst);
	skb->dst = dst_clone(__sk_dst_get(sk_tun));
	skb_dst_drop(skb);
	skb_dst_set(skb, dst_clone(__sk_dst_get(sk_tun)));
	pppol2tp_skb_set_owner_w(skb, sk_tun);

	/* Calculate UDP checksum if configured to do so */
	if (sk_tun->sk_no_check == UDP_CSUM_NOXMIT)
		skb->ip_summed = CHECKSUM_NONE;
	else if (!(skb->dst->dev->features & NETIF_F_V4_CSUM)) {
	else if (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM)) {
		skb->ip_summed = CHECKSUM_COMPLETE;
		csum = skb_checksum(skb, 0, udp_len, 0);
		uh->check = csum_tcpudp_magic(inet->saddr, inet->daddr,
+2 −2
Original line number Diff line number Diff line
@@ -2937,8 +2937,8 @@ int qeth_get_cast_type(struct qeth_card *card, struct sk_buff *skb)
	if (card->info.type == QETH_CARD_TYPE_OSN)
		return cast_type;

	if (skb->dst && skb->dst->neighbour) {
		cast_type = skb->dst->neighbour->type;
	if (skb_dst(skb) && skb_dst(skb)->neighbour) {
		cast_type = skb_dst(skb)->neighbour->type;
		if ((cast_type == RTN_BROADCAST) ||
		    (cast_type == RTN_MULTICAST) ||
		    (cast_type == RTN_ANYCAST))
Loading