Lines Matching refs:neigh
752 struct ipoib_neigh *neigh, *tn; in path_rec_completion() local
808 list_for_each_entry_safe(neigh, tn, &path->neigh_list, list) { in path_rec_completion()
809 if (neigh->ah) { in path_rec_completion()
810 WARN_ON(neigh->ah != old_ah); in path_rec_completion()
818 ipoib_put_ah(neigh->ah); in path_rec_completion()
821 neigh->ah = path->ah; in path_rec_completion()
823 if (ipoib_cm_enabled(dev, neigh->daddr)) { in path_rec_completion()
824 if (!ipoib_cm_get(neigh)) in path_rec_completion()
825 ipoib_cm_set(neigh, ipoib_cm_create_tx(dev, in path_rec_completion()
827 neigh)); in path_rec_completion()
828 if (!ipoib_cm_get(neigh)) { in path_rec_completion()
829 ipoib_neigh_free(neigh); in path_rec_completion()
834 while ((skb = __skb_dequeue(&neigh->queue))) in path_rec_completion()
930 static void neigh_refresh_path(struct ipoib_neigh *neigh, u8 *daddr, in neigh_refresh_path() argument
954 struct ipoib_neigh *neigh; in neigh_add_path() local
958 neigh = ipoib_neigh_alloc(daddr, dev); in neigh_add_path()
959 if (!neigh) { in neigh_add_path()
969 if (unlikely(!list_empty(&neigh->list))) { in neigh_add_path()
971 return neigh; in neigh_add_path()
983 list_add_tail(&neigh->list, &path->neigh_list); in neigh_add_path()
987 neigh->ah = path->ah; in neigh_add_path()
989 if (ipoib_cm_enabled(dev, neigh->daddr)) { in neigh_add_path()
990 if (!ipoib_cm_get(neigh)) in neigh_add_path()
991 ipoib_cm_set(neigh, ipoib_cm_create_tx(dev, path, neigh)); in neigh_add_path()
992 if (!ipoib_cm_get(neigh)) { in neigh_add_path()
993 ipoib_neigh_free(neigh); in neigh_add_path()
996 if (skb_queue_len(&neigh->queue) < in neigh_add_path()
998 push_pseudo_header(skb, neigh->daddr); in neigh_add_path()
999 __skb_queue_tail(&neigh->queue, skb); in neigh_add_path()
1002 skb_queue_len(&neigh->queue)); in neigh_add_path()
1009 ipoib_neigh_put(neigh); in neigh_add_path()
1013 neigh->ah = NULL; in neigh_add_path()
1017 if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE) { in neigh_add_path()
1018 push_pseudo_header(skb, neigh->daddr); in neigh_add_path()
1019 __skb_queue_tail(&neigh->queue, skb); in neigh_add_path()
1026 ipoib_neigh_put(neigh); in neigh_add_path()
1030 ipoib_neigh_free(neigh); in neigh_add_path()
1036 ipoib_neigh_put(neigh); in neigh_add_path()
1100 struct ipoib_neigh *neigh; in ipoib_start_xmit() local
1125 neigh = ipoib_neigh_get(dev, phdr->hwaddr); in ipoib_start_xmit()
1126 if (likely(neigh)) in ipoib_start_xmit()
1137 neigh = ipoib_neigh_get(dev, phdr->hwaddr); in ipoib_start_xmit()
1138 if (unlikely(!neigh)) { in ipoib_start_xmit()
1139 neigh = neigh_add_path(skb, phdr->hwaddr, dev); in ipoib_start_xmit()
1140 if (likely(!neigh)) in ipoib_start_xmit()
1158 if (ipoib_cm_get(neigh)) { in ipoib_start_xmit()
1159 if (ipoib_cm_up(neigh)) { in ipoib_start_xmit()
1160 ipoib_cm_send(dev, skb, ipoib_cm_get(neigh)); in ipoib_start_xmit()
1163 } else if (neigh->ah && neigh->ah->valid) { in ipoib_start_xmit()
1164 neigh->ah->last_send = rn->send(dev, skb, neigh->ah->ah, in ipoib_start_xmit()
1167 } else if (neigh->ah) { in ipoib_start_xmit()
1168 neigh_refresh_path(neigh, phdr->hwaddr, dev); in ipoib_start_xmit()
1171 if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE) { in ipoib_start_xmit()
1174 __skb_queue_tail(&neigh->queue, skb); in ipoib_start_xmit()
1182 ipoib_neigh_put(neigh); in ipoib_start_xmit()
1275 struct ipoib_neigh *neigh = NULL; in ipoib_neigh_get() local
1286 for (neigh = rcu_dereference_bh(htbl->buckets[hash_val]); in ipoib_neigh_get()
1287 neigh != NULL; in ipoib_neigh_get()
1288 neigh = rcu_dereference_bh(neigh->hnext)) { in ipoib_neigh_get()
1289 if (memcmp(daddr, neigh->daddr, INFINIBAND_ALEN) == 0) { in ipoib_neigh_get()
1291 if (!refcount_inc_not_zero(&neigh->refcnt)) { in ipoib_neigh_get()
1293 neigh = NULL; in ipoib_neigh_get()
1297 if (likely(skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE)) in ipoib_neigh_get()
1298 neigh->alive = jiffies; in ipoib_neigh_get()
1305 return neigh; in ipoib_neigh_get()
1331 struct ipoib_neigh *neigh; in __ipoib_reap_neigh() local
1334 while ((neigh = rcu_dereference_protected(*np, in __ipoib_reap_neigh()
1337 if (time_after(neigh_obsolete, neigh->alive)) { in __ipoib_reap_neigh()
1339 ipoib_check_and_add_mcast_sendonly(priv, neigh->daddr + 4, &remove_list); in __ipoib_reap_neigh()
1342 rcu_dereference_protected(neigh->hnext, in __ipoib_reap_neigh()
1345 list_del_init(&neigh->list); in __ipoib_reap_neigh()
1346 call_rcu(&neigh->rcu, ipoib_neigh_reclaim); in __ipoib_reap_neigh()
1348 np = &neigh->hnext; in __ipoib_reap_neigh()
1374 struct ipoib_neigh *neigh; in ipoib_neigh_ctor() local
1376 neigh = kzalloc(sizeof(*neigh), GFP_ATOMIC); in ipoib_neigh_ctor()
1377 if (!neigh) in ipoib_neigh_ctor()
1380 neigh->dev = dev; in ipoib_neigh_ctor()
1381 memcpy(&neigh->daddr, daddr, sizeof(neigh->daddr)); in ipoib_neigh_ctor()
1382 skb_queue_head_init(&neigh->queue); in ipoib_neigh_ctor()
1383 INIT_LIST_HEAD(&neigh->list); in ipoib_neigh_ctor()
1384 ipoib_cm_set(neigh, NULL); in ipoib_neigh_ctor()
1386 refcount_set(&neigh->refcnt, 1); in ipoib_neigh_ctor()
1388 return neigh; in ipoib_neigh_ctor()
1397 struct ipoib_neigh *neigh; in ipoib_neigh_alloc() local
1403 neigh = NULL; in ipoib_neigh_alloc()
1411 for (neigh = rcu_dereference_protected(htbl->buckets[hash_val], in ipoib_neigh_alloc()
1413 neigh != NULL; in ipoib_neigh_alloc()
1414 neigh = rcu_dereference_protected(neigh->hnext, in ipoib_neigh_alloc()
1416 if (memcmp(daddr, neigh->daddr, INFINIBAND_ALEN) == 0) { in ipoib_neigh_alloc()
1418 if (!refcount_inc_not_zero(&neigh->refcnt)) { in ipoib_neigh_alloc()
1420 neigh = NULL; in ipoib_neigh_alloc()
1423 neigh->alive = jiffies; in ipoib_neigh_alloc()
1428 neigh = ipoib_neigh_ctor(daddr, dev); in ipoib_neigh_alloc()
1429 if (!neigh) in ipoib_neigh_alloc()
1433 refcount_inc(&neigh->refcnt); in ipoib_neigh_alloc()
1434 neigh->alive = jiffies; in ipoib_neigh_alloc()
1436 rcu_assign_pointer(neigh->hnext, in ipoib_neigh_alloc()
1439 rcu_assign_pointer(htbl->buckets[hash_val], neigh); in ipoib_neigh_alloc()
1444 return neigh; in ipoib_neigh_alloc()
1447 void ipoib_neigh_dtor(struct ipoib_neigh *neigh) in ipoib_neigh_dtor() argument
1450 struct net_device *dev = neigh->dev; in ipoib_neigh_dtor()
1453 if (neigh->ah) in ipoib_neigh_dtor()
1454 ipoib_put_ah(neigh->ah); in ipoib_neigh_dtor()
1455 while ((skb = __skb_dequeue(&neigh->queue))) { in ipoib_neigh_dtor()
1459 if (ipoib_cm_get(neigh)) in ipoib_neigh_dtor()
1460 ipoib_cm_destroy_tx(ipoib_cm_get(neigh)); in ipoib_neigh_dtor()
1463 IPOIB_QPN(neigh->daddr), in ipoib_neigh_dtor()
1464 neigh->daddr + 4); in ipoib_neigh_dtor()
1465 kfree(neigh); in ipoib_neigh_dtor()
1475 struct ipoib_neigh *neigh = container_of(rp, struct ipoib_neigh, rcu); in ipoib_neigh_reclaim() local
1477 ipoib_neigh_put(neigh); in ipoib_neigh_reclaim()
1480 void ipoib_neigh_free(struct ipoib_neigh *neigh) in ipoib_neigh_free() argument
1482 struct net_device *dev = neigh->dev; in ipoib_neigh_free()
1495 hash_val = ipoib_addr_hash(htbl, neigh->daddr); in ipoib_neigh_free()
1502 if (n == neigh) { in ipoib_neigh_free()
1505 rcu_dereference_protected(neigh->hnext, in ipoib_neigh_free()
1508 list_del_init(&neigh->list); in ipoib_neigh_free()
1509 call_rcu(&neigh->rcu, ipoib_neigh_reclaim); in ipoib_neigh_free()
1580 struct ipoib_neigh *neigh; in ipoib_del_neighs_by_gid() local
1583 while ((neigh = rcu_dereference_protected(*np, in ipoib_del_neighs_by_gid()
1586 if (!memcmp(gid, neigh->daddr + 4, sizeof (union ib_gid))) { in ipoib_del_neighs_by_gid()
1588 rcu_dereference_protected(neigh->hnext, in ipoib_del_neighs_by_gid()
1591 list_del_init(&neigh->list); in ipoib_del_neighs_by_gid()
1592 call_rcu(&neigh->rcu, ipoib_neigh_reclaim); in ipoib_del_neighs_by_gid()
1594 np = &neigh->hnext; in ipoib_del_neighs_by_gid()
1625 struct ipoib_neigh *neigh; in ipoib_flush_neighs() local
1628 while ((neigh = rcu_dereference_protected(*np, in ipoib_flush_neighs()
1631 rcu_dereference_protected(neigh->hnext, in ipoib_flush_neighs()
1634 list_del_init(&neigh->list); in ipoib_flush_neighs()
1635 call_rcu(&neigh->rcu, ipoib_neigh_reclaim); in ipoib_flush_neighs()