diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2006-11-16 03:59:12 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-16 16:56:45 -0500 |
commit | 073ae841d6a5098f7c6e17fc1f329350d950d1ce (patch) | |
tree | b74472c7e5bd8ab009e111807e13408b87770324 /drivers/infiniband/ulp | |
parent | 0f66c08e9611b9a63f2f2fd5af0d12e486c4a02e (diff) |
IPoIB: Clear high octet in QP number
IPoIB assumes that high (reserved) octet in the hardware address is 0,
and copies it into the QPN. This violates RFC 4391 (which requires
that the high 8 bits are ignored on receive), and will result in an
invalid QPN being used when interoperating with IPoIB connected mode.
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 1eaf00e9862c..85522daeb946 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -49,6 +49,8 @@ | |||
49 | 49 | ||
50 | #include <net/dst.h> | 50 | #include <net/dst.h> |
51 | 51 | ||
52 | #define IPOIB_QPN(ha) (be32_to_cpup((__be32 *) ha) & 0xffffff) | ||
53 | |||
52 | MODULE_AUTHOR("Roland Dreier"); | 54 | MODULE_AUTHOR("Roland Dreier"); |
53 | MODULE_DESCRIPTION("IP-over-InfiniBand net driver"); | 55 | MODULE_DESCRIPTION("IP-over-InfiniBand net driver"); |
54 | MODULE_LICENSE("Dual BSD/GPL"); | 56 | MODULE_LICENSE("Dual BSD/GPL"); |
@@ -520,8 +522,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev) | |||
520 | memcpy(&neigh->dgid.raw, &path->pathrec.dgid.raw, | 522 | memcpy(&neigh->dgid.raw, &path->pathrec.dgid.raw, |
521 | sizeof(union ib_gid)); | 523 | sizeof(union ib_gid)); |
522 | 524 | ||
523 | ipoib_send(dev, skb, path->ah, | 525 | ipoib_send(dev, skb, path->ah, IPOIB_QPN(skb->dst->neighbour->ha)); |
524 | be32_to_cpup((__be32 *) skb->dst->neighbour->ha)); | ||
525 | } else { | 526 | } else { |
526 | neigh->ah = NULL; | 527 | neigh->ah = NULL; |
527 | __skb_queue_tail(&neigh->queue, skb); | 528 | __skb_queue_tail(&neigh->queue, skb); |
@@ -599,8 +600,7 @@ static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev, | |||
599 | ipoib_dbg(priv, "Send unicast ARP to %04x\n", | 600 | ipoib_dbg(priv, "Send unicast ARP to %04x\n", |
600 | be16_to_cpu(path->pathrec.dlid)); | 601 | be16_to_cpu(path->pathrec.dlid)); |
601 | 602 | ||
602 | ipoib_send(dev, skb, path->ah, | 603 | ipoib_send(dev, skb, path->ah, IPOIB_QPN(phdr->hwaddr)); |
603 | be32_to_cpup((__be32 *) phdr->hwaddr)); | ||
604 | } else if ((path->query || !path_rec_start(dev, path)) && | 604 | } else if ((path->query || !path_rec_start(dev, path)) && |
605 | skb_queue_len(&path->queue) < IPOIB_MAX_PATH_REC_QUEUE) { | 605 | skb_queue_len(&path->queue) < IPOIB_MAX_PATH_REC_QUEUE) { |
606 | /* put pseudoheader back on for next time */ | 606 | /* put pseudoheader back on for next time */ |
@@ -661,8 +661,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
661 | goto out; | 661 | goto out; |
662 | } | 662 | } |
663 | 663 | ||
664 | ipoib_send(dev, skb, neigh->ah, | 664 | ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(skb->dst->neighbour->ha)); |
665 | be32_to_cpup((__be32 *) skb->dst->neighbour->ha)); | ||
666 | goto out; | 665 | goto out; |
667 | } | 666 | } |
668 | 667 | ||
@@ -694,7 +693,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
694 | IPOIB_GID_FMT "\n", | 693 | IPOIB_GID_FMT "\n", |
695 | skb->dst ? "neigh" : "dst", | 694 | skb->dst ? "neigh" : "dst", |
696 | be16_to_cpup((__be16 *) skb->data), | 695 | be16_to_cpup((__be16 *) skb->data), |
697 | be32_to_cpup((__be32 *) phdr->hwaddr), | 696 | IPOIB_QPN(phdr->hwaddr), |
698 | IPOIB_GID_RAW_ARG(phdr->hwaddr + 4)); | 697 | IPOIB_GID_RAW_ARG(phdr->hwaddr + 4)); |
699 | dev_kfree_skb_any(skb); | 698 | dev_kfree_skb_any(skb); |
700 | ++priv->stats.tx_dropped; | 699 | ++priv->stats.tx_dropped; |
@@ -777,7 +776,7 @@ static void ipoib_neigh_destructor(struct neighbour *n) | |||
777 | 776 | ||
778 | ipoib_dbg(priv, | 777 | ipoib_dbg(priv, |
779 | "neigh_destructor for %06x " IPOIB_GID_FMT "\n", | 778 | "neigh_destructor for %06x " IPOIB_GID_FMT "\n", |
780 | be32_to_cpup((__be32 *) n->ha), | 779 | IPOIB_QPN(n->ha), |
781 | IPOIB_GID_RAW_ARG(n->ha + 4)); | 780 | IPOIB_GID_RAW_ARG(n->ha + 4)); |
782 | 781 | ||
783 | spin_lock_irqsave(&priv->lock, flags); | 782 | spin_lock_irqsave(&priv->lock, flags); |