[openib-commits] r1314 - gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib

roland at openib.org
Mon Dec 6 11:58:23 PST 2004


Author: roland
Date: 2004-12-06 11:58:22 -0800 (Mon, 06 Dec 2004)
New Revision: 1314

Modified:
   gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib.h
   gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib_main.c
   gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib_multicast.c
Log:
Back out inadvertent commit (WIP ipoib diffs got mixed in with other changes)

Signed-off-by: Roland Dreier <roland at topspin.com>


Modified: gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib.h
===================================================================
--- gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib.h    2004-12-06 19:25:47 UTC (rev 1313)
+++ gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib.h    2004-12-06 19:58:22 UTC (rev 1314)
@@ -93,12 +93,6 @@
        DECLARE_PCI_UNMAP_ADDR(mapping)
 };
 
-/*
- * Device private locking: tx_lock protects members used in TX fast
- * path (and we use LLTX so upper layers don't do extra locking).
- * lock protects everything else.  lock nests inside of tx_lock (ie
- * tx_lock must be acquired first if needed).
- */
 struct ipoib_dev_priv {
        spinlock_t lock;
 
@@ -109,8 +103,6 @@
        struct semaphore mcast_mutex;
        struct semaphore vlan_mutex;
 
-       struct rb_root path_tree;
-
        struct ipoib_mcast *broadcast;
        struct list_head multicast_list;
        struct rb_root multicast_tree;
@@ -170,25 +162,16 @@
 };
 
 struct ipoib_path {
-       struct ib_sa_path_rec pathrec;
-       struct list_head      neigh_list;
-
-       struct rb_node        rb_node;
-};
-
-struct ipoib_neigh {
        struct ipoib_ah    *ah;
        struct sk_buff_head queue;
 
        struct net_device  *dev;
        struct neighbour   *neighbour;
-
-       struct list_head    list;
 };
 
-static inline struct ipoib_neigh **to_ipoib_neigh(struct neighbour *neigh)
+static inline struct ipoib_path **to_ipoib_path(struct neighbour *neigh)
 {
-       return (struct ipoib_neigh **) (neigh->ha + 24);
+       return (struct ipoib_path **) (neigh->ha + 24);
 }
 
 extern struct workqueue_struct *ipoib_workqueue;

Modified: gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib_main.c
===================================================================
--- gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib_main.c       2004-12-06 19:25:47 UTC (rev 1313)
+++ gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib_main.c       2004-12-06 19:58:22 UTC (rev 1314)
@@ -149,65 +149,12 @@
        return 0;
 }
 
-static struct ipoib_path *__path_find(struct net_device *dev,
-                                     union ib_gid *gid)
-{
-       struct ipoib_dev_priv *priv = netdev_priv(dev);
-       struct rb_node *n = priv->path_tree.rb_node;
-       struct ipoib_path *path;
-       int ret;
-
-       while (n) {
-               path = rb_entry(n, struct ipoib_path, rb_node);
-
-               ret = memcmp(path->pathrec.dgid.raw, gid->raw,
-                            sizeof (union ib_gid));
-
-               if (ret < 0)
-                       n = n->rb_left;
-               else if (ret > 0)
-                       n = n->rb_right;
-               else
-                       return path;
-       }
-
-       return NULL;
-}
-
-static int __path_add(struct net_device *dev, struct ipoib_path *path)
-{
-       struct ipoib_dev_priv *priv = netdev_priv(dev);
-       struct rb_node **n = &priv->path_tree.rb_node;
-       struct rb_node *pn = NULL;
-       struct ipoib_path *tpath;
-       int ret;
-
-       while (*n) {
-               pn = *n;
-               tpath = rb_entry(pn, struct ipoib_path, rb_node);
-
-               ret = memcmp(path->pathrec.dgid.raw, tpath->pathrec.dgid.raw,
-                            sizeof (union ib_gid));
-               if (ret < 0)
-                       n = &pn->rb_left;
-               else if (ret > 0)
-                       n = &pn->rb_right;
-               else
-                       return -EEXIST;
-       }
-
-       rb_link_node(&path->rb_node, pn, n);
-       rb_insert_color(&path->rb_node, &priv->path_tree);
-
-       return 0;
-}
-
 static void path_rec_completion(int status,
                                struct ib_sa_path_rec *pathrec,
-                               void *neigh_ptr)
+                               void *path_ptr)
 {
-       struct ipoib_neigh *neigh = neigh_ptr;
-       struct ipoib_dev_priv *priv = netdev_priv(neigh->dev);
+       struct ipoib_path *path = path_ptr;
+       struct ipoib_dev_priv *priv = netdev_priv(path->dev);
        struct sk_buff *skb;
        struct ipoib_ah *ah;
 
@@ -227,19 +174,19 @@
                        .port_num      = priv->port
                };
 
-               ah = ipoib_create_ah(neigh->dev, priv->pd, &av);
+               ah = ipoib_create_ah(path->dev, priv->pd, &av);
        }
 
        if (!ah)
                goto err;
 
-       neigh->ah = ah;
+       path->ah = ah;
 
        ipoib_dbg(priv, "created address handle %p for LID 0x%04x, SL %d\n",
                  ah, pathrec->dlid, pathrec->sl);
 
-       while ((skb = __skb_dequeue(&neigh->queue))) {
-               skb->dev = neigh->dev;
+       while ((skb = __skb_dequeue(&path->queue))) {
+               skb->dev = path->dev;
                if (dev_queue_xmit(skb))
                        ipoib_warn(priv, "dev_queue_xmit failed "
                                   "to requeue packet\n");
@@ -248,32 +195,32 @@
        return;
 
 err:
-       while ((skb = __skb_dequeue(&neigh->queue)))
+       while ((skb = __skb_dequeue(&path->queue)))
                dev_kfree_skb(skb);
        
-       if (neigh->neighbour)
-               *to_ipoib_neigh(neigh->neighbour) = NULL;
+       if (path->neighbour)
+               *to_ipoib_path(path->neighbour) = NULL;
 
-       kfree(neigh);
+       kfree(path);
 }
 
 static void path_rec_start(struct sk_buff *skb, struct net_device *dev)
 {
        struct ipoib_dev_priv *priv = netdev_priv(dev);
-       struct ipoib_neigh *neigh = kmalloc(sizeof *neigh, GFP_ATOMIC);
+       struct ipoib_path *path = kmalloc(sizeof *path, GFP_ATOMIC);
        struct ib_sa_path_rec rec = {
                .numb_path = 1
        };
        struct ib_sa_query *query;
 
-       if (!neigh)
+       if (!path)
                goto err;
 
-       neigh->ah  = NULL;
-       neigh->dev = dev;
-       skb_queue_head_init(&neigh->queue);
-       __skb_queue_tail(&neigh->queue, skb);
-       neigh->neighbour = NULL;
+       path->ah  = NULL;
+       path->dev = dev;
+       skb_queue_head_init(&path->queue);
+       __skb_queue_tail(&path->queue, skb);
+       path->neighbour = NULL;
 
        rec.sgid = priv->local_gid;
        memcpy(rec.dgid.raw, skb->dst->neighbour->ha + 4, 16);
@@ -290,17 +237,17 @@
                               IB_SA_PATH_REC_PKEY,
                               1000, GFP_ATOMIC,
                               path_rec_completion,
-                              neigh, &query) < 0) {
+                              path, &query) < 0) {
                ipoib_warn(priv, "ib_sa_path_rec_get failed\n");
                goto err;
        }
 
-       neigh->neighbour = skb->dst->neighbour;
-       *to_ipoib_neigh(skb->dst->neighbour) = neigh;
+       path->neighbour = skb->dst->neighbour;
+       *to_ipoib_path(skb->dst->neighbour) = path;
        return;
 
 err:
-       kfree(neigh);
+       kfree(path);
        ++priv->stats.tx_dropped;
        dev_kfree_skb_any(skb);
 }
@@ -438,7 +385,7 @@
 static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct ipoib_dev_priv *priv = netdev_priv(dev);
-       struct ipoib_neigh *neigh;
+       struct ipoib_path *path;
        unsigned long flags;
 
        local_irq_save(flags);
@@ -448,21 +395,21 @@
        } 
 
        if (skb->dst && skb->dst->neighbour) {
-               if (unlikely(!*to_ipoib_neigh(skb->dst->neighbour))) {
+               if (unlikely(!*to_ipoib_path(skb->dst->neighbour))) {
                        path_lookup(skb, dev);
                        goto out;
                }
 
-               neigh = *to_ipoib_neigh(skb->dst->neighbour);
+               path = *to_ipoib_path(skb->dst->neighbour);
 
-               if (likely(neigh->ah)) {
-                       ipoib_send(dev, skb, neigh->ah,
+               if (likely(path->ah)) {
+                       ipoib_send(dev, skb, path->ah,
                                   be32_to_cpup((__be32 *) skb->dst->neighbour->ha));
                        goto out;
                }
 
-               if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE)
-                       __skb_queue_tail(&neigh->queue, skb);
+               if (skb_queue_len(&path->queue) < IPOIB_MAX_PATH_REC_QUEUE)
+                       __skb_queue_tail(&path->queue, skb);
                else
                        goto err;
        } else {
@@ -569,27 +516,19 @@
        schedule_work(&priv->restart_task);
 }
 
-static void ipoib_neigh_destructor(struct neighbour *n)
+static void ipoib_neigh_destructor(struct neighbour *neigh)
 {
-       struct ipoib_neigh *neigh = *to_ipoib_neigh(n);
-       struct ipoib_dev_priv *priv = netdev_priv(n->dev);
-       unsigned long flags;
+       struct ipoib_path     *path = *to_ipoib_path(neigh);
 
-       ipoib_dbg(priv,
+       ipoib_dbg(netdev_priv(neigh->dev),
                  "neigh_destructor for %06x " IPOIB_GID_FMT "\n",
-                 be32_to_cpup((__be32 *) n->ha),
-                 IPOIB_GID_ARG(*((union ib_gid *) (n->ha + 4))));
+                 be32_to_cpup((__be32 *) neigh->ha),
+                 IPOIB_GID_ARG(*((union ib_gid *) (neigh->ha + 4))));
 
-       spin_lock_irqsave(&priv->lock, flags);
-
-       if (neigh && neigh->ah) {
-               ipoib_put_ah(neigh->ah);
-               kfree(neigh);
-               list_del(&neigh->list);
-               *to_ipoib_neigh(n) = NULL;
+       if (path && path->ah) {
+               ipoib_put_ah(path->ah);
+               kfree(path);
        }
-
-       spin_unlock_irqrestore(&priv->lock, flags);
 }
 
 static int ipoib_neigh_setup(struct neighbour *neigh)

Modified: gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib_multicast.c
===================================================================
--- gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib_multicast.c  2004-12-06 19:25:47 UTC (rev 1313)
+++ gen2/trunk/src/linux-kernel/infiniband/ulp/ipoib/ipoib_multicast.c  2004-12-06 19:58:22 UTC (rev 1314)
@@ -60,8 +60,6 @@
        unsigned long flags;
        unsigned char logcount;
 
-       struct list_head  neigh_list;
-
        struct sk_buff_head pkt_queue;
 
        struct net_device *dev;
@@ -116,7 +114,6 @@
        mcast->logcount = 0;
 
        INIT_LIST_HEAD(&mcast->list);
-       INIT_LIST_HEAD(&mcast->neigh_list);
        skb_queue_head_init(&mcast->pkt_queue);
 
        mcast->ah    = NULL;
@@ -674,26 +671,24 @@
        }
 
 out:
+       spin_unlock_irqrestore(&priv->lock, flags);
        if (mcast && mcast->ah) {
                if (skb->dst            &&
                    skb->dst->neighbour &&
-                   !*to_ipoib_neigh(skb->dst->neighbour)) {
-                       struct ipoib_neigh *neigh = kmalloc(sizeof *neigh, GFP_ATOMIC);
+                   !*to_ipoib_path(skb->dst->neighbour)) {
+                       struct ipoib_path *path = kmalloc(sizeof *path, GFP_ATOMIC);
 
-                       if (neigh) {
+                       if (path) {
                                kref_get(&mcast->ah->ref);
-                               neigh->ah    = mcast->ah;
-                               neigh->dev   = dev;
-                               neigh->neighbour = skb->dst->neighbour;
-                               *to_ipoib_neigh(skb->dst->neighbour) = neigh;
-                               list_add_tail(&neigh->list, &mcast->neigh_list);
+                               path->ah     = mcast->ah;
+                               path->dev    = dev;
+                               path->neighbour = skb->dst->neighbour;
+                               *to_ipoib_path(skb->dst->neighbour) = path;
                        }
                }
 
                ipoib_send(dev, skb, mcast->ah, IB_MULTICAST_QPN);
        }
-
-       spin_unlock_irqrestore(&priv->lock, flags);
 }
 
 void ipoib_mcast_dev_flush(struct net_device *dev)



More information about the openib-commits mailing list