aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-12 00:00:52 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-12 18:08:42 -0500
commit78fbfd8a653ca972afe479517a40661bfff6d8c3 (patch)
tree9dccc5c16bf269d53d8499064ec95a998e84c646 /drivers/infiniband/hw
parent1561747ddf9d28185548687b11aae7074d6129c4 (diff)
ipv4: Create and use route lookup helpers.
The idea here is this minimizes the number of places one has to edit in order to make changes to how flows are defined and used. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_cm.c21
-rw-r--r--drivers/infiniband/hw/cxgb4/cm.c21
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c5
3 files changed, 9 insertions, 38 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index e0ccbc53fbc..3216bcad7e8 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -338,23 +338,10 @@ static struct rtable *find_route(struct t3cdev *dev, __be32 local_ip,
338 __be16 peer_port, u8 tos) 338 __be16 peer_port, u8 tos)
339{ 339{
340 struct rtable *rt; 340 struct rtable *rt;
341 struct flowi fl = { 341
342 .oif = 0, 342 rt = ip_route_output_ports(&init_net, NULL, peer_ip, local_ip,
343 .nl_u = { 343 peer_port, local_port, IPPROTO_TCP,
344 .ip4_u = { 344 tos, 0);
345 .daddr = peer_ip,
346 .saddr = local_ip,
347 .tos = tos}
348 },
349 .proto = IPPROTO_TCP,
350 .uli_u = {
351 .ports = {
352 .sport = local_port,
353 .dport = peer_port}
354 }
355 };
356
357 rt = ip_route_output_flow(&init_net, &fl, NULL);
358 if (IS_ERR(rt)) 345 if (IS_ERR(rt))
359 return NULL; 346 return NULL;
360 return rt; 347 return rt;
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 77b0eef2aad..97a876a0f20 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -315,23 +315,10 @@ static struct rtable *find_route(struct c4iw_dev *dev, __be32 local_ip,
315 __be16 peer_port, u8 tos) 315 __be16 peer_port, u8 tos)
316{ 316{
317 struct rtable *rt; 317 struct rtable *rt;
318 struct flowi fl = { 318
319 .oif = 0, 319 rt = ip_route_output_ports(&init_net, NULL, peer_ip, local_ip,
320 .nl_u = { 320 peer_port, local_port, IPPROTO_TCP,
321 .ip4_u = { 321 tos, 0);
322 .daddr = peer_ip,
323 .saddr = local_ip,
324 .tos = tos}
325 },
326 .proto = IPPROTO_TCP,
327 .uli_u = {
328 .ports = {
329 .sport = local_port,
330 .dport = peer_port}
331 }
332 };
333
334 rt = ip_route_output_flow(&init_net, &fl, NULL);
335 if (IS_ERR(rt)) 322 if (IS_ERR(rt))
336 return NULL; 323 return NULL;
337 return rt; 324 return rt;
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index e81599cb1fe..ef3291551bc 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -1104,15 +1104,12 @@ static inline int mini_cm_accelerated(struct nes_cm_core *cm_core,
1104static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpindex) 1104static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpindex)
1105{ 1105{
1106 struct rtable *rt; 1106 struct rtable *rt;
1107 struct flowi fl;
1108 struct neighbour *neigh; 1107 struct neighbour *neigh;
1109 int rc = arpindex; 1108 int rc = arpindex;
1110 struct net_device *netdev; 1109 struct net_device *netdev;
1111 struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter; 1110 struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;
1112 1111
1113 memset(&fl, 0, sizeof fl); 1112 rt = ip_route_output(&init_net, htonl(dst_ip), 0, 0, 0);
1114 fl.nl_u.ip4_u.daddr = htonl(dst_ip);
1115 rt = ip_route_output_key(&init_net, &fl);
1116 if (IS_ERR(rt)) { 1113 if (IS_ERR(rt)) {
1117 printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n", 1114 printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n",
1118 __func__, dst_ip); 1115 __func__, dst_ip);