@@ -770,38 +770,6 @@ static int rds_ib_move_ip(char *from_dev,
770
770
return ret ;
771
771
}
772
772
773
- static void rds_ib_check_up_port (void )
774
- {
775
- struct net_device * dev ;
776
- int downs ;
777
- int retries = 0 ;
778
-
779
- retry :
780
- downs = 0 ;
781
- read_lock (& dev_base_lock );
782
- for_each_netdev (& init_net , dev ) {
783
- if ((dev -> type == ARPHRD_INFINIBAND ) &&
784
- (dev -> flags & IFF_UP ) &&
785
- !(dev -> flags & IFF_SLAVE ) &&
786
- !(dev -> flags & IFF_MASTER )) {
787
- if (dev -> operstate != IF_OPER_UP )
788
- downs ++ ;
789
- }
790
- }
791
- read_unlock (& dev_base_lock );
792
-
793
- if (downs ) {
794
- if (retries ++ <= 30 ) {
795
- msleep (1000 );
796
- goto retry ;
797
- } else {
798
- printk (KERN_ERR "RDS/IB: Some port(s) may not be "
799
- "operational\n" );
800
- }
801
- }
802
- }
803
-
804
-
805
773
static u8 rds_ib_init_port (struct rds_ib_device * rds_ibdev ,
806
774
struct net_device * net_dev ,
807
775
u8 port_num ,
@@ -1168,9 +1136,8 @@ static void rds_ib_dump_ip_config(void)
1168
1136
if (!rds_ib_active_bonding_enabled || !ip_port_cnt )
1169
1137
return ;
1170
1138
1171
- printk (KERN_ERR "RDS/IB: IP configuration ...\n" );
1172
1139
for (i = 1 ; i <= ip_port_cnt ; i ++ ) {
1173
- printk (KERN_ERR "RDS/IB: %s/port_%d/%s: "
1140
+ printk (KERN_INFO "RDS/IB: %s/port_%d/%s: "
1174
1141
"IP %d.%d.%d.%d/%d.%d.%d.%d/%d.%d.%d.%d "
1175
1142
"state %s\n" ,
1176
1143
((ip_config [i ].rds_ibdev ) ?
@@ -1187,7 +1154,7 @@ static void rds_ib_dump_ip_config(void)
1187
1154
RDS_IB_PORT_UP ? "UP" : "DOWN" ));
1188
1155
1189
1156
for (j = 0 ; j < ip_config [i ].alias_cnt ; j ++ ) {
1190
- printk (KERN_ERR "Alias %s "
1157
+ printk (KERN_INFO "Alias %s "
1191
1158
"IP %d.%d.%d.%d/%d.%d.%d.%d/%d.%d.%d.%d\n" ,
1192
1159
ip_config [i ].aliases [j ].if_name ,
1193
1160
NIPQUAD (ip_config [i ].
@@ -1215,8 +1182,6 @@ static int rds_ib_ip_config_init(void)
1215
1182
if (!rds_ib_active_bonding_enabled )
1216
1183
return 0 ;
1217
1184
1218
- rds_ib_check_up_port ();
1219
-
1220
1185
rcu_read_unlock ();
1221
1186
1222
1187
ip_config = kzalloc (sizeof (struct rds_ib_port ) *
@@ -1269,6 +1234,7 @@ static int rds_ib_ip_config_init(void)
1269
1234
in_dev_put (in_dev );
1270
1235
}
1271
1236
1237
+ printk (KERN_INFO "RDS/IB: IP configuration..\n" );
1272
1238
rds_ib_dump_ip_config ();
1273
1239
read_unlock (& dev_base_lock );
1274
1240
return ret ;
@@ -1585,14 +1551,76 @@ static void rds_ib_update_ip_config(void)
1585
1551
read_unlock (& dev_base_lock );
1586
1552
}
1587
1553
1554
+ static void rds_ib_joining_ip (struct work_struct * _work )
1555
+ {
1556
+ struct rds_ib_port_ud_work * work =
1557
+ container_of (_work , struct rds_ib_port_ud_work , work .work );
1558
+ struct net_device * ndev = work -> dev ;
1559
+ struct in_ifaddr * ifa ;
1560
+ struct in_ifaddr * * ifap ;
1561
+ struct in_device * in_dev ;
1562
+ union ib_gid gid ;
1563
+ struct rds_ib_device * rds_ibdev ;
1564
+ int ret = 0 ;
1565
+ u8 port_num ;
1566
+ u8 port ;
1567
+
1568
+ read_lock (& dev_base_lock );
1569
+ in_dev = in_dev_get (ndev );
1570
+ if (in_dev && !in_dev -> ifa_list && work -> timeout > 0 ) {
1571
+ INIT_DELAYED_WORK (& work -> work , rds_ib_joining_ip );
1572
+ work -> timeout -= msecs_to_jiffies (100 );
1573
+ queue_delayed_work (rds_wq , & work -> work , msecs_to_jiffies (100 ));
1574
+ } else if (in_dev && in_dev -> ifa_list ) {
1575
+ memcpy (& gid , ndev -> dev_addr + 4 , sizeof gid );
1576
+ list_for_each_entry_rcu (rds_ibdev ,
1577
+ & rds_ib_devices , list ) {
1578
+ ret = ib_find_cached_gid (rds_ibdev -> dev ,
1579
+ & gid , & port_num , NULL );
1580
+ if (!ret )
1581
+ break ;
1582
+ }
1583
+ if (ret ) {
1584
+ printk (KERN_ERR "RDS/IB: GID " RDS_IB_GID_FMT
1585
+ " has no associated port\n" ,
1586
+ RDS_IB_GID_ARG (gid ));
1587
+ } else {
1588
+ port = rds_ib_init_port (rds_ibdev , ndev ,
1589
+ port_num , gid );
1590
+ if (port > 0 ) {
1591
+ for (ifap = & in_dev -> ifa_list ;
1592
+ (ifa = * ifap );
1593
+ ifap = & ifa -> ifa_next ) {
1594
+ rds_ib_set_port (rds_ibdev , ndev ,
1595
+ ifa -> ifa_label ,
1596
+ port ,
1597
+ ifa -> ifa_address ,
1598
+ ifa -> ifa_broadcast ,
1599
+ ifa -> ifa_mask );
1600
+ }
1601
+ }
1602
+ }
1603
+ printk (KERN_INFO "RDS/IB: Updated IP configuration..\n" );
1604
+ rds_ib_ip_failover_groups_init ();
1605
+ rds_ib_dump_ip_config ();
1606
+ kfree (work );
1607
+ } else if (!work -> timeout )
1608
+ kfree (work );
1609
+
1610
+ if (in_dev )
1611
+ in_dev_put (in_dev );
1612
+ read_unlock (& dev_base_lock );
1613
+ }
1614
+
1615
+
1588
1616
static int rds_ib_netdev_callback (struct notifier_block * self , unsigned long event , void * ctx )
1589
1617
{
1590
1618
struct net_device * ndev = (struct net_device * )ctx ;
1591
1619
u8 port = 0 ;
1592
1620
u8 i ;
1593
1621
struct rds_ib_port_ud_work * work ;
1594
1622
1595
- if (!rds_ib_active_bonding_enabled || ! ip_port_cnt )
1623
+ if (!rds_ib_active_bonding_enabled )
1596
1624
return NOTIFY_DONE ;
1597
1625
1598
1626
if (event != NETDEV_UP && event != NETDEV_DOWN )
@@ -1608,6 +1636,25 @@ static int rds_ib_netdev_callback(struct notifier_block *self, unsigned long eve
1608
1636
}
1609
1637
}
1610
1638
1639
+ /* check for newly joined IB interface */
1640
+ if (!port && event == NETDEV_UP ) {
1641
+ if ((ndev -> type == ARPHRD_INFINIBAND ) &&
1642
+ (ndev -> flags & IFF_UP ) &&
1643
+ !(ndev -> flags & IFF_SLAVE ) &&
1644
+ !(ndev -> flags & IFF_MASTER )) {
1645
+ work = kzalloc (sizeof * work , GFP_ATOMIC );
1646
+ if (work ) {
1647
+ work -> dev = ndev ;
1648
+ work -> timeout = msecs_to_jiffies (10000 );
1649
+ INIT_DELAYED_WORK (& work -> work , rds_ib_joining_ip );
1650
+ queue_delayed_work (rds_wq , & work -> work ,
1651
+ msecs_to_jiffies (100 ));
1652
+ }
1653
+ }
1654
+
1655
+ return NOTIFY_DONE ;
1656
+ }
1657
+
1611
1658
if (!port )
1612
1659
return NOTIFY_DONE ;
1613
1660
0 commit comments