diff options
author | David S. Miller <davem@davemloft.net> | 2011-07-18 02:09:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-18 02:11:35 -0400 |
commit | 69cce1d1404968f78b177a0314f5822d5afdbbfb (patch) | |
tree | 26223264fd69ea8078d0013fd5a76eb7aeb04c12 /drivers/infiniband | |
parent | 9cbb7ecbcff85077bb12301aaf4c9b5a56c5993d (diff) |
net: Abstract dst->neighbour accesses behind helpers.
dst_{get,set}_neighbour()
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/addr.c | 7 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb3/iwch_cm.c | 12 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/cm.c | 42 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_cm.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 41 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 20 |
6 files changed, 74 insertions, 50 deletions
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index 8e21d457b899..236ad9a89c0a 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c | |||
@@ -215,7 +215,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, | |||
215 | 215 | ||
216 | neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, rt->dst.dev); | 216 | neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, rt->dst.dev); |
217 | if (!neigh || !(neigh->nud_state & NUD_VALID)) { | 217 | if (!neigh || !(neigh->nud_state & NUD_VALID)) { |
218 | neigh_event_send(rt->dst.neighbour, NULL); | 218 | neigh_event_send(dst_get_neighbour(&rt->dst), NULL); |
219 | ret = -ENODATA; | 219 | ret = -ENODATA; |
220 | if (neigh) | 220 | if (neigh) |
221 | goto release; | 221 | goto release; |
@@ -273,9 +273,10 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, | |||
273 | goto put; | 273 | goto put; |
274 | } | 274 | } |
275 | 275 | ||
276 | neigh = dst->neighbour; | 276 | neigh = dst_get_neighbour(dst); |
277 | if (!neigh || !(neigh->nud_state & NUD_VALID)) { | 277 | if (!neigh || !(neigh->nud_state & NUD_VALID)) { |
278 | neigh_event_send(dst->neighbour, NULL); | 278 | if (neigh) |
279 | neigh_event_send(neigh, NULL); | ||
279 | ret = -ENODATA; | 280 | ret = -ENODATA; |
280 | goto put; | 281 | goto put; |
281 | } | 282 | } |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index 0a5008fbebac..17bf9d95463c 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
@@ -1328,6 +1328,7 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1328 | struct iwch_ep *child_ep, *parent_ep = ctx; | 1328 | struct iwch_ep *child_ep, *parent_ep = ctx; |
1329 | struct cpl_pass_accept_req *req = cplhdr(skb); | 1329 | struct cpl_pass_accept_req *req = cplhdr(skb); |
1330 | unsigned int hwtid = GET_TID(req); | 1330 | unsigned int hwtid = GET_TID(req); |
1331 | struct neighbour *neigh; | ||
1331 | struct dst_entry *dst; | 1332 | struct dst_entry *dst; |
1332 | struct l2t_entry *l2t; | 1333 | struct l2t_entry *l2t; |
1333 | struct rtable *rt; | 1334 | struct rtable *rt; |
@@ -1364,7 +1365,8 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1364 | goto reject; | 1365 | goto reject; |
1365 | } | 1366 | } |
1366 | dst = &rt->dst; | 1367 | dst = &rt->dst; |
1367 | l2t = t3_l2t_get(tdev, dst->neighbour, dst->neighbour->dev); | 1368 | neigh = dst_get_neighbour(dst); |
1369 | l2t = t3_l2t_get(tdev, neigh, neigh->dev); | ||
1368 | if (!l2t) { | 1370 | if (!l2t) { |
1369 | printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", | 1371 | printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", |
1370 | __func__); | 1372 | __func__); |
@@ -1874,10 +1876,11 @@ static int is_loopback_dst(struct iw_cm_id *cm_id) | |||
1874 | 1876 | ||
1875 | int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | 1877 | int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) |
1876 | { | 1878 | { |
1877 | int err = 0; | ||
1878 | struct iwch_dev *h = to_iwch_dev(cm_id->device); | 1879 | struct iwch_dev *h = to_iwch_dev(cm_id->device); |
1880 | struct neighbour *neigh; | ||
1879 | struct iwch_ep *ep; | 1881 | struct iwch_ep *ep; |
1880 | struct rtable *rt; | 1882 | struct rtable *rt; |
1883 | int err = 0; | ||
1881 | 1884 | ||
1882 | if (is_loopback_dst(cm_id)) { | 1885 | if (is_loopback_dst(cm_id)) { |
1883 | err = -ENOSYS; | 1886 | err = -ENOSYS; |
@@ -1933,9 +1936,10 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
1933 | } | 1936 | } |
1934 | ep->dst = &rt->dst; | 1937 | ep->dst = &rt->dst; |
1935 | 1938 | ||
1939 | neigh = dst_get_neighbour(ep->dst); | ||
1940 | |||
1936 | /* get a l2t entry */ | 1941 | /* get a l2t entry */ |
1937 | ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst->neighbour, | 1942 | ep->l2t = t3_l2t_get(ep->com.tdev, neigh, neigh->dev); |
1938 | ep->dst->neighbour->dev); | ||
1939 | if (!ep->l2t) { | 1943 | if (!ep->l2t) { |
1940 | printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); | 1944 | printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); |
1941 | err = -ENOMEM; | 1945 | err = -ENOMEM; |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 31fb44085c9b..77f769d9227d 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -1325,6 +1325,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) | |||
1325 | unsigned int stid = GET_POPEN_TID(ntohl(req->tos_stid)); | 1325 | unsigned int stid = GET_POPEN_TID(ntohl(req->tos_stid)); |
1326 | struct tid_info *t = dev->rdev.lldi.tids; | 1326 | struct tid_info *t = dev->rdev.lldi.tids; |
1327 | unsigned int hwtid = GET_TID(req); | 1327 | unsigned int hwtid = GET_TID(req); |
1328 | struct neighbour *neigh; | ||
1328 | struct dst_entry *dst; | 1329 | struct dst_entry *dst; |
1329 | struct l2t_entry *l2t; | 1330 | struct l2t_entry *l2t; |
1330 | struct rtable *rt; | 1331 | struct rtable *rt; |
@@ -1357,11 +1358,11 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) | |||
1357 | goto reject; | 1358 | goto reject; |
1358 | } | 1359 | } |
1359 | dst = &rt->dst; | 1360 | dst = &rt->dst; |
1360 | if (dst->neighbour->dev->flags & IFF_LOOPBACK) { | 1361 | neigh = dst_get_neighbour(dst); |
1362 | if (neigh->dev->flags & IFF_LOOPBACK) { | ||
1361 | pdev = ip_dev_find(&init_net, peer_ip); | 1363 | pdev = ip_dev_find(&init_net, peer_ip); |
1362 | BUG_ON(!pdev); | 1364 | BUG_ON(!pdev); |
1363 | l2t = cxgb4_l2t_get(dev->rdev.lldi.l2t, dst->neighbour, | 1365 | l2t = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh, pdev, 0); |
1364 | pdev, 0); | ||
1365 | mtu = pdev->mtu; | 1366 | mtu = pdev->mtu; |
1366 | tx_chan = cxgb4_port_chan(pdev); | 1367 | tx_chan = cxgb4_port_chan(pdev); |
1367 | smac_idx = (cxgb4_port_viid(pdev) & 0x7F) << 1; | 1368 | smac_idx = (cxgb4_port_viid(pdev) & 0x7F) << 1; |
@@ -1372,17 +1373,16 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) | |||
1372 | rss_qid = dev->rdev.lldi.rxq_ids[cxgb4_port_idx(pdev) * step]; | 1373 | rss_qid = dev->rdev.lldi.rxq_ids[cxgb4_port_idx(pdev) * step]; |
1373 | dev_put(pdev); | 1374 | dev_put(pdev); |
1374 | } else { | 1375 | } else { |
1375 | l2t = cxgb4_l2t_get(dev->rdev.lldi.l2t, dst->neighbour, | 1376 | l2t = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh, neigh->dev, 0); |
1376 | dst->neighbour->dev, 0); | ||
1377 | mtu = dst_mtu(dst); | 1377 | mtu = dst_mtu(dst); |
1378 | tx_chan = cxgb4_port_chan(dst->neighbour->dev); | 1378 | tx_chan = cxgb4_port_chan(neigh->dev); |
1379 | smac_idx = (cxgb4_port_viid(dst->neighbour->dev) & 0x7F) << 1; | 1379 | smac_idx = (cxgb4_port_viid(neigh->dev) & 0x7F) << 1; |
1380 | step = dev->rdev.lldi.ntxq / dev->rdev.lldi.nchan; | 1380 | step = dev->rdev.lldi.ntxq / dev->rdev.lldi.nchan; |
1381 | txq_idx = cxgb4_port_idx(dst->neighbour->dev) * step; | 1381 | txq_idx = cxgb4_port_idx(neigh->dev) * step; |
1382 | ctrlq_idx = cxgb4_port_idx(dst->neighbour->dev); | 1382 | ctrlq_idx = cxgb4_port_idx(neigh->dev); |
1383 | step = dev->rdev.lldi.nrxq / dev->rdev.lldi.nchan; | 1383 | step = dev->rdev.lldi.nrxq / dev->rdev.lldi.nchan; |
1384 | rss_qid = dev->rdev.lldi.rxq_ids[ | 1384 | rss_qid = dev->rdev.lldi.rxq_ids[ |
1385 | cxgb4_port_idx(dst->neighbour->dev) * step]; | 1385 | cxgb4_port_idx(neigh->dev) * step]; |
1386 | } | 1386 | } |
1387 | if (!l2t) { | 1387 | if (!l2t) { |
1388 | printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", | 1388 | printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", |
@@ -1847,6 +1847,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
1847 | struct c4iw_ep *ep; | 1847 | struct c4iw_ep *ep; |
1848 | struct rtable *rt; | 1848 | struct rtable *rt; |
1849 | struct net_device *pdev; | 1849 | struct net_device *pdev; |
1850 | struct neighbour *neigh; | ||
1850 | int step; | 1851 | int step; |
1851 | 1852 | ||
1852 | if ((conn_param->ord > c4iw_max_read_depth) || | 1853 | if ((conn_param->ord > c4iw_max_read_depth) || |
@@ -1908,14 +1909,15 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
1908 | } | 1909 | } |
1909 | ep->dst = &rt->dst; | 1910 | ep->dst = &rt->dst; |
1910 | 1911 | ||
1912 | neigh = dst_get_neighbour(ep->dst); | ||
1913 | |||
1911 | /* get a l2t entry */ | 1914 | /* get a l2t entry */ |
1912 | if (ep->dst->neighbour->dev->flags & IFF_LOOPBACK) { | 1915 | if (neigh->dev->flags & IFF_LOOPBACK) { |
1913 | PDBG("%s LOOPBACK\n", __func__); | 1916 | PDBG("%s LOOPBACK\n", __func__); |
1914 | pdev = ip_dev_find(&init_net, | 1917 | pdev = ip_dev_find(&init_net, |
1915 | cm_id->remote_addr.sin_addr.s_addr); | 1918 | cm_id->remote_addr.sin_addr.s_addr); |
1916 | ep->l2t = cxgb4_l2t_get(ep->com.dev->rdev.lldi.l2t, | 1919 | ep->l2t = cxgb4_l2t_get(ep->com.dev->rdev.lldi.l2t, |
1917 | ep->dst->neighbour, | 1920 | neigh, pdev, 0); |
1918 | pdev, 0); | ||
1919 | ep->mtu = pdev->mtu; | 1921 | ep->mtu = pdev->mtu; |
1920 | ep->tx_chan = cxgb4_port_chan(pdev); | 1922 | ep->tx_chan = cxgb4_port_chan(pdev); |
1921 | ep->smac_idx = (cxgb4_port_viid(pdev) & 0x7F) << 1; | 1923 | ep->smac_idx = (cxgb4_port_viid(pdev) & 0x7F) << 1; |
@@ -1930,20 +1932,18 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
1930 | dev_put(pdev); | 1932 | dev_put(pdev); |
1931 | } else { | 1933 | } else { |
1932 | ep->l2t = cxgb4_l2t_get(ep->com.dev->rdev.lldi.l2t, | 1934 | ep->l2t = cxgb4_l2t_get(ep->com.dev->rdev.lldi.l2t, |
1933 | ep->dst->neighbour, | 1935 | neigh, neigh->dev, 0); |
1934 | ep->dst->neighbour->dev, 0); | ||
1935 | ep->mtu = dst_mtu(ep->dst); | 1936 | ep->mtu = dst_mtu(ep->dst); |
1936 | ep->tx_chan = cxgb4_port_chan(ep->dst->neighbour->dev); | 1937 | ep->tx_chan = cxgb4_port_chan(neigh->dev); |
1937 | ep->smac_idx = (cxgb4_port_viid(ep->dst->neighbour->dev) & | 1938 | ep->smac_idx = (cxgb4_port_viid(neigh->dev) & 0x7F) << 1; |
1938 | 0x7F) << 1; | ||
1939 | step = ep->com.dev->rdev.lldi.ntxq / | 1939 | step = ep->com.dev->rdev.lldi.ntxq / |
1940 | ep->com.dev->rdev.lldi.nchan; | 1940 | ep->com.dev->rdev.lldi.nchan; |
1941 | ep->txq_idx = cxgb4_port_idx(ep->dst->neighbour->dev) * step; | 1941 | ep->txq_idx = cxgb4_port_idx(neigh->dev) * step; |
1942 | ep->ctrlq_idx = cxgb4_port_idx(ep->dst->neighbour->dev); | 1942 | ep->ctrlq_idx = cxgb4_port_idx(neigh->dev); |
1943 | step = ep->com.dev->rdev.lldi.nrxq / | 1943 | step = ep->com.dev->rdev.lldi.nrxq / |
1944 | ep->com.dev->rdev.lldi.nchan; | 1944 | ep->com.dev->rdev.lldi.nchan; |
1945 | ep->rss_qid = ep->com.dev->rdev.lldi.rxq_ids[ | 1945 | ep->rss_qid = ep->com.dev->rdev.lldi.rxq_ids[ |
1946 | cxgb4_port_idx(ep->dst->neighbour->dev) * step]; | 1946 | cxgb4_port_idx(neigh->dev) * step]; |
1947 | } | 1947 | } |
1948 | if (!ep->l2t) { | 1948 | if (!ep->l2t) { |
1949 | printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); | 1949 | printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); |
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index e74cdf9ef471..73bc18465c9c 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
@@ -1151,7 +1151,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi | |||
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | if ((neigh == NULL) || (!(neigh->nud_state & NUD_VALID))) | 1153 | if ((neigh == NULL) || (!(neigh->nud_state & NUD_VALID))) |
1154 | neigh_event_send(rt->dst.neighbour, NULL); | 1154 | neigh_event_send(dst_get_neighbour(&rt->dst), NULL); |
1155 | 1155 | ||
1156 | ip_rt_put(rt); | 1156 | ip_rt_put(rt); |
1157 | return rc; | 1157 | return rc; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 86addca9ddf6..43f89ba0a908 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -560,9 +560,11 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev) | |||
560 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 560 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
561 | struct ipoib_path *path; | 561 | struct ipoib_path *path; |
562 | struct ipoib_neigh *neigh; | 562 | struct ipoib_neigh *neigh; |
563 | struct neighbour *n; | ||
563 | unsigned long flags; | 564 | unsigned long flags; |
564 | 565 | ||
565 | neigh = ipoib_neigh_alloc(skb_dst(skb)->neighbour, skb->dev); | 566 | n = dst_get_neighbour(skb_dst(skb)); |
567 | neigh = ipoib_neigh_alloc(n, skb->dev); | ||
566 | if (!neigh) { | 568 | if (!neigh) { |
567 | ++dev->stats.tx_dropped; | 569 | ++dev->stats.tx_dropped; |
568 | dev_kfree_skb_any(skb); | 570 | dev_kfree_skb_any(skb); |
@@ -571,9 +573,9 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev) | |||
571 | 573 | ||
572 | spin_lock_irqsave(&priv->lock, flags); | 574 | spin_lock_irqsave(&priv->lock, flags); |
573 | 575 | ||
574 | path = __path_find(dev, skb_dst(skb)->neighbour->ha + 4); | 576 | path = __path_find(dev, n->ha + 4); |
575 | if (!path) { | 577 | if (!path) { |
576 | path = path_rec_create(dev, skb_dst(skb)->neighbour->ha + 4); | 578 | path = path_rec_create(dev, n->ha + 4); |
577 | if (!path) | 579 | if (!path) |
578 | goto err_path; | 580 | goto err_path; |
579 | 581 | ||
@@ -607,7 +609,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev) | |||
607 | } | 609 | } |
608 | } else { | 610 | } else { |
609 | spin_unlock_irqrestore(&priv->lock, flags); | 611 | spin_unlock_irqrestore(&priv->lock, flags); |
610 | ipoib_send(dev, skb, path->ah, IPOIB_QPN(skb_dst(skb)->neighbour->ha)); | 612 | ipoib_send(dev, skb, path->ah, IPOIB_QPN(n->ha)); |
611 | return; | 613 | return; |
612 | } | 614 | } |
613 | } else { | 615 | } else { |
@@ -637,17 +639,20 @@ err_drop: | |||
637 | static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev) | 639 | static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev) |
638 | { | 640 | { |
639 | struct ipoib_dev_priv *priv = netdev_priv(skb->dev); | 641 | struct ipoib_dev_priv *priv = netdev_priv(skb->dev); |
642 | struct dst_entry *dst = skb_dst(skb); | ||
643 | struct neighbour *n; | ||
640 | 644 | ||
641 | /* Look up path record for unicasts */ | 645 | /* Look up path record for unicasts */ |
642 | if (skb_dst(skb)->neighbour->ha[4] != 0xff) { | 646 | n = dst_get_neighbour(dst); |
647 | if (n->ha[4] != 0xff) { | ||
643 | neigh_add_path(skb, dev); | 648 | neigh_add_path(skb, dev); |
644 | return; | 649 | return; |
645 | } | 650 | } |
646 | 651 | ||
647 | /* Add in the P_Key for multicasts */ | 652 | /* Add in the P_Key for multicasts */ |
648 | skb_dst(skb)->neighbour->ha[8] = (priv->pkey >> 8) & 0xff; | 653 | n->ha[8] = (priv->pkey >> 8) & 0xff; |
649 | skb_dst(skb)->neighbour->ha[9] = priv->pkey & 0xff; | 654 | n->ha[9] = priv->pkey & 0xff; |
650 | ipoib_mcast_send(dev, skb_dst(skb)->neighbour->ha + 4, skb); | 655 | ipoib_mcast_send(dev, n->ha + 4, skb); |
651 | } | 656 | } |
652 | 657 | ||
653 | static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev, | 658 | static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev, |
@@ -712,18 +717,20 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
712 | { | 717 | { |
713 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 718 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
714 | struct ipoib_neigh *neigh; | 719 | struct ipoib_neigh *neigh; |
720 | struct neighbour *n; | ||
715 | unsigned long flags; | 721 | unsigned long flags; |
716 | 722 | ||
717 | if (likely(skb_dst(skb) && skb_dst(skb)->neighbour)) { | 723 | n = dst_get_neighbour(skb_dst(skb)); |
718 | if (unlikely(!*to_ipoib_neigh(skb_dst(skb)->neighbour))) { | 724 | if (likely(skb_dst(skb) && n)) { |
725 | if (unlikely(!*to_ipoib_neigh(n))) { | ||
719 | ipoib_path_lookup(skb, dev); | 726 | ipoib_path_lookup(skb, dev); |
720 | return NETDEV_TX_OK; | 727 | return NETDEV_TX_OK; |
721 | } | 728 | } |
722 | 729 | ||
723 | neigh = *to_ipoib_neigh(skb_dst(skb)->neighbour); | 730 | neigh = *to_ipoib_neigh(n); |
724 | 731 | ||
725 | if (unlikely((memcmp(&neigh->dgid.raw, | 732 | if (unlikely((memcmp(&neigh->dgid.raw, |
726 | skb_dst(skb)->neighbour->ha + 4, | 733 | n->ha + 4, |
727 | sizeof(union ib_gid))) || | 734 | sizeof(union ib_gid))) || |
728 | (neigh->dev != dev))) { | 735 | (neigh->dev != dev))) { |
729 | spin_lock_irqsave(&priv->lock, flags); | 736 | spin_lock_irqsave(&priv->lock, flags); |
@@ -749,7 +756,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
749 | return NETDEV_TX_OK; | 756 | return NETDEV_TX_OK; |
750 | } | 757 | } |
751 | } else if (neigh->ah) { | 758 | } else if (neigh->ah) { |
752 | ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(skb_dst(skb)->neighbour->ha)); | 759 | ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(n->ha)); |
753 | return NETDEV_TX_OK; | 760 | return NETDEV_TX_OK; |
754 | } | 761 | } |
755 | 762 | ||
@@ -812,6 +819,8 @@ static int ipoib_hard_header(struct sk_buff *skb, | |||
812 | const void *daddr, const void *saddr, unsigned len) | 819 | const void *daddr, const void *saddr, unsigned len) |
813 | { | 820 | { |
814 | struct ipoib_header *header; | 821 | struct ipoib_header *header; |
822 | struct dst_entry *dst; | ||
823 | struct neighbour *n; | ||
815 | 824 | ||
816 | header = (struct ipoib_header *) skb_push(skb, sizeof *header); | 825 | header = (struct ipoib_header *) skb_push(skb, sizeof *header); |
817 | 826 | ||
@@ -823,7 +832,11 @@ static int ipoib_hard_header(struct sk_buff *skb, | |||
823 | * destination address onto the front of the skb so we can | 832 | * destination address onto the front of the skb so we can |
824 | * figure out where to send the packet later. | 833 | * figure out where to send the packet later. |
825 | */ | 834 | */ |
826 | if ((!skb_dst(skb) || !skb_dst(skb)->neighbour) && daddr) { | 835 | dst = skb_dst(skb); |
836 | n = NULL; | ||
837 | if (dst) | ||
838 | n = dst_get_neighbour(dst); | ||
839 | if ((!dst || !n) && daddr) { | ||
827 | struct ipoib_pseudoheader *phdr = | 840 | struct ipoib_pseudoheader *phdr = |
828 | (struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr); | 841 | (struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr); |
829 | memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN); | 842 | memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 3871ac663554..ecea4fe1ed00 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -258,11 +258,15 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, | |||
258 | netif_tx_lock_bh(dev); | 258 | netif_tx_lock_bh(dev); |
259 | while (!skb_queue_empty(&mcast->pkt_queue)) { | 259 | while (!skb_queue_empty(&mcast->pkt_queue)) { |
260 | struct sk_buff *skb = skb_dequeue(&mcast->pkt_queue); | 260 | struct sk_buff *skb = skb_dequeue(&mcast->pkt_queue); |
261 | struct dst_entry *dst = skb_dst(skb); | ||
262 | struct neighbour *n = NULL; | ||
263 | |||
261 | netif_tx_unlock_bh(dev); | 264 | netif_tx_unlock_bh(dev); |
262 | 265 | ||
263 | skb->dev = dev; | 266 | skb->dev = dev; |
264 | 267 | if (dst) | |
265 | if (!skb_dst(skb) || !skb_dst(skb)->neighbour) { | 268 | n = dst_get_neighbour(dst); |
269 | if (!dst || !n) { | ||
266 | /* put pseudoheader back on for next time */ | 270 | /* put pseudoheader back on for next time */ |
267 | skb_push(skb, sizeof (struct ipoib_pseudoheader)); | 271 | skb_push(skb, sizeof (struct ipoib_pseudoheader)); |
268 | } | 272 | } |
@@ -715,11 +719,13 @@ void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb) | |||
715 | 719 | ||
716 | out: | 720 | out: |
717 | if (mcast && mcast->ah) { | 721 | if (mcast && mcast->ah) { |
718 | if (skb_dst(skb) && | 722 | struct dst_entry *dst = skb_dst(skb); |
719 | skb_dst(skb)->neighbour && | 723 | struct neighbour *n = NULL; |
720 | !*to_ipoib_neigh(skb_dst(skb)->neighbour)) { | 724 | if (dst) |
721 | struct ipoib_neigh *neigh = ipoib_neigh_alloc(skb_dst(skb)->neighbour, | 725 | n = dst_get_neighbour(dst); |
722 | skb->dev); | 726 | if (n && !*to_ipoib_neigh(n)) { |
727 | struct ipoib_neigh *neigh = ipoib_neigh_alloc(n, | ||
728 | skb->dev); | ||
723 | 729 | ||
724 | if (neigh) { | 730 | if (neigh) { |
725 | kref_get(&mcast->ah->ref); | 731 | kref_get(&mcast->ah->ref); |