diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /net/ipv4/ipconfig.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'net/ipv4/ipconfig.c')
-rw-r--r-- | net/ipv4/ipconfig.c | 69 |
1 files changed, 39 insertions, 30 deletions
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 3a6e1ec5e9ae..ab7e5542c1cf 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -87,8 +87,8 @@ | |||
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | /* Define the friendly delay before and after opening net devices */ | 89 | /* Define the friendly delay before and after opening net devices */ |
90 | #define CONF_PRE_OPEN 500 /* Before opening: 1/2 second */ | 90 | #define CONF_POST_OPEN 10 /* After opening: 10 msecs */ |
91 | #define CONF_POST_OPEN 1 /* After opening: 1 second */ | 91 | #define CONF_CARRIER_TIMEOUT 120000 /* Wait for carrier timeout */ |
92 | 92 | ||
93 | /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */ | 93 | /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */ |
94 | #define CONF_OPEN_RETRIES 2 /* (Re)open devices twice */ | 94 | #define CONF_OPEN_RETRIES 2 /* (Re)open devices twice */ |
@@ -188,14 +188,14 @@ struct ic_device { | |||
188 | static struct ic_device *ic_first_dev __initdata = NULL;/* List of open device */ | 188 | static struct ic_device *ic_first_dev __initdata = NULL;/* List of open device */ |
189 | static struct net_device *ic_dev __initdata = NULL; /* Selected device */ | 189 | static struct net_device *ic_dev __initdata = NULL; /* Selected device */ |
190 | 190 | ||
191 | static bool __init ic_device_match(struct net_device *dev) | 191 | static bool __init ic_is_init_dev(struct net_device *dev) |
192 | { | 192 | { |
193 | if (user_dev_name[0] ? !strcmp(dev->name, user_dev_name) : | 193 | if (dev->flags & IFF_LOOPBACK) |
194 | return false; | ||
195 | return user_dev_name[0] ? !strcmp(dev->name, user_dev_name) : | ||
194 | (!(dev->flags & IFF_LOOPBACK) && | 196 | (!(dev->flags & IFF_LOOPBACK) && |
195 | (dev->flags & (IFF_POINTOPOINT|IFF_BROADCAST)) && | 197 | (dev->flags & (IFF_POINTOPOINT|IFF_BROADCAST)) && |
196 | strncmp(dev->name, "dummy", 5))) | 198 | strncmp(dev->name, "dummy", 5)); |
197 | return true; | ||
198 | return false; | ||
199 | } | 199 | } |
200 | 200 | ||
201 | static int __init ic_open_devs(void) | 201 | static int __init ic_open_devs(void) |
@@ -203,6 +203,7 @@ static int __init ic_open_devs(void) | |||
203 | struct ic_device *d, **last; | 203 | struct ic_device *d, **last; |
204 | struct net_device *dev; | 204 | struct net_device *dev; |
205 | unsigned short oflags; | 205 | unsigned short oflags; |
206 | unsigned long start; | ||
206 | 207 | ||
207 | last = &ic_first_dev; | 208 | last = &ic_first_dev; |
208 | rtnl_lock(); | 209 | rtnl_lock(); |
@@ -216,9 +217,7 @@ static int __init ic_open_devs(void) | |||
216 | } | 217 | } |
217 | 218 | ||
218 | for_each_netdev(&init_net, dev) { | 219 | for_each_netdev(&init_net, dev) { |
219 | if (dev->flags & IFF_LOOPBACK) | 220 | if (ic_is_init_dev(dev)) { |
220 | continue; | ||
221 | if (ic_device_match(dev)) { | ||
222 | int able = 0; | 221 | int able = 0; |
223 | if (dev->mtu >= 364) | 222 | if (dev->mtu >= 364) |
224 | able |= IC_BOOTP; | 223 | able |= IC_BOOTP; |
@@ -252,6 +251,17 @@ static int __init ic_open_devs(void) | |||
252 | dev->name, able, d->xid)); | 251 | dev->name, able, d->xid)); |
253 | } | 252 | } |
254 | } | 253 | } |
254 | |||
255 | /* wait for a carrier on at least one device */ | ||
256 | start = jiffies; | ||
257 | while (jiffies - start < msecs_to_jiffies(CONF_CARRIER_TIMEOUT)) { | ||
258 | for_each_netdev(&init_net, dev) | ||
259 | if (ic_is_init_dev(dev) && netif_carrier_ok(dev)) | ||
260 | goto have_carrier; | ||
261 | |||
262 | msleep(1); | ||
263 | } | ||
264 | have_carrier: | ||
255 | rtnl_unlock(); | 265 | rtnl_unlock(); |
256 | 266 | ||
257 | *last = NULL; | 267 | *last = NULL; |
@@ -1191,13 +1201,13 @@ static int __init ic_dynamic(void) | |||
1191 | (ic_proto_enabled & IC_USE_DHCP) && | 1201 | (ic_proto_enabled & IC_USE_DHCP) && |
1192 | ic_dhcp_msgtype != DHCPACK) { | 1202 | ic_dhcp_msgtype != DHCPACK) { |
1193 | ic_got_reply = 0; | 1203 | ic_got_reply = 0; |
1194 | printk(","); | 1204 | printk(KERN_CONT ","); |
1195 | continue; | 1205 | continue; |
1196 | } | 1206 | } |
1197 | #endif /* IPCONFIG_DHCP */ | 1207 | #endif /* IPCONFIG_DHCP */ |
1198 | 1208 | ||
1199 | if (ic_got_reply) { | 1209 | if (ic_got_reply) { |
1200 | printk(" OK\n"); | 1210 | printk(KERN_CONT " OK\n"); |
1201 | break; | 1211 | break; |
1202 | } | 1212 | } |
1203 | 1213 | ||
@@ -1205,7 +1215,7 @@ static int __init ic_dynamic(void) | |||
1205 | continue; | 1215 | continue; |
1206 | 1216 | ||
1207 | if (! --retries) { | 1217 | if (! --retries) { |
1208 | printk(" timed out!\n"); | 1218 | printk(KERN_CONT " timed out!\n"); |
1209 | break; | 1219 | break; |
1210 | } | 1220 | } |
1211 | 1221 | ||
@@ -1215,7 +1225,7 @@ static int __init ic_dynamic(void) | |||
1215 | if (timeout > CONF_TIMEOUT_MAX) | 1225 | if (timeout > CONF_TIMEOUT_MAX) |
1216 | timeout = CONF_TIMEOUT_MAX; | 1226 | timeout = CONF_TIMEOUT_MAX; |
1217 | 1227 | ||
1218 | printk("."); | 1228 | printk(KERN_CONT "."); |
1219 | } | 1229 | } |
1220 | 1230 | ||
1221 | #ifdef IPCONFIG_BOOTP | 1231 | #ifdef IPCONFIG_BOOTP |
@@ -1236,7 +1246,7 @@ static int __init ic_dynamic(void) | |||
1236 | ((ic_got_reply & IC_RARP) ? "RARP" | 1246 | ((ic_got_reply & IC_RARP) ? "RARP" |
1237 | : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), | 1247 | : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), |
1238 | &ic_servaddr); | 1248 | &ic_servaddr); |
1239 | printk("my address is %pI4\n", &ic_myaddr); | 1249 | printk(KERN_CONT "my address is %pI4\n", &ic_myaddr); |
1240 | 1250 | ||
1241 | return 0; | 1251 | return 0; |
1242 | } | 1252 | } |
@@ -1324,14 +1334,13 @@ static int __init wait_for_devices(void) | |||
1324 | { | 1334 | { |
1325 | int i; | 1335 | int i; |
1326 | 1336 | ||
1327 | msleep(CONF_PRE_OPEN); | ||
1328 | for (i = 0; i < DEVICE_WAIT_MAX; i++) { | 1337 | for (i = 0; i < DEVICE_WAIT_MAX; i++) { |
1329 | struct net_device *dev; | 1338 | struct net_device *dev; |
1330 | int found = 0; | 1339 | int found = 0; |
1331 | 1340 | ||
1332 | rtnl_lock(); | 1341 | rtnl_lock(); |
1333 | for_each_netdev(&init_net, dev) { | 1342 | for_each_netdev(&init_net, dev) { |
1334 | if (ic_device_match(dev)) { | 1343 | if (ic_is_init_dev(dev)) { |
1335 | found = 1; | 1344 | found = 1; |
1336 | break; | 1345 | break; |
1337 | } | 1346 | } |
@@ -1378,7 +1387,7 @@ static int __init ip_auto_config(void) | |||
1378 | return err; | 1387 | return err; |
1379 | 1388 | ||
1380 | /* Give drivers a chance to settle */ | 1389 | /* Give drivers a chance to settle */ |
1381 | ssleep(CONF_POST_OPEN); | 1390 | msleep(CONF_POST_OPEN); |
1382 | 1391 | ||
1383 | /* | 1392 | /* |
1384 | * If the config information is insufficient (e.g., our IP address or | 1393 | * If the config information is insufficient (e.g., our IP address or |
@@ -1444,7 +1453,7 @@ static int __init ip_auto_config(void) | |||
1444 | root_server_addr = addr; | 1453 | root_server_addr = addr; |
1445 | 1454 | ||
1446 | /* | 1455 | /* |
1447 | * Use defaults whereever applicable. | 1456 | * Use defaults wherever applicable. |
1448 | */ | 1457 | */ |
1449 | if (ic_defaults() < 0) | 1458 | if (ic_defaults() < 0) |
1450 | return -1; | 1459 | return -1; |
@@ -1468,19 +1477,19 @@ static int __init ip_auto_config(void) | |||
1468 | /* | 1477 | /* |
1469 | * Clue in the operator. | 1478 | * Clue in the operator. |
1470 | */ | 1479 | */ |
1471 | printk("IP-Config: Complete:"); | 1480 | printk("IP-Config: Complete:\n"); |
1472 | printk("\n device=%s", ic_dev->name); | 1481 | printk(" device=%s", ic_dev->name); |
1473 | printk(", addr=%pI4", &ic_myaddr); | 1482 | printk(KERN_CONT ", addr=%pI4", &ic_myaddr); |
1474 | printk(", mask=%pI4", &ic_netmask); | 1483 | printk(KERN_CONT ", mask=%pI4", &ic_netmask); |
1475 | printk(", gw=%pI4", &ic_gateway); | 1484 | printk(KERN_CONT ", gw=%pI4", &ic_gateway); |
1476 | printk(",\n host=%s, domain=%s, nis-domain=%s", | 1485 | printk(KERN_CONT ",\n host=%s, domain=%s, nis-domain=%s", |
1477 | utsname()->nodename, ic_domain, utsname()->domainname); | 1486 | utsname()->nodename, ic_domain, utsname()->domainname); |
1478 | printk(",\n bootserver=%pI4", &ic_servaddr); | 1487 | printk(KERN_CONT ",\n bootserver=%pI4", &ic_servaddr); |
1479 | printk(", rootserver=%pI4", &root_server_addr); | 1488 | printk(KERN_CONT ", rootserver=%pI4", &root_server_addr); |
1480 | printk(", rootpath=%s", root_server_path); | 1489 | printk(KERN_CONT ", rootpath=%s", root_server_path); |
1481 | if (ic_dev_mtu) | 1490 | if (ic_dev_mtu) |
1482 | printk(", mtu=%d", ic_dev_mtu); | 1491 | printk(KERN_CONT ", mtu=%d", ic_dev_mtu); |
1483 | printk("\n"); | 1492 | printk(KERN_CONT "\n"); |
1484 | #endif /* !SILENT */ | 1493 | #endif /* !SILENT */ |
1485 | 1494 | ||
1486 | return 0; | 1495 | return 0; |