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>
This commit is contained in:
committed by
David S. Miller
parent
511c3f92ad
commit
adf30907d6
@@ -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);
|
||||
|
Reference in New Issue
Block a user