~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to net/ipv4/ipconfig.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
#endif
88
88
 
89
89
/* Define the friendly delay before and after opening net devices */
90
 
#define CONF_PRE_OPEN           500     /* Before opening: 1/2 second */
91
 
#define CONF_POST_OPEN          1       /* After opening: 1 second */
 
90
#define CONF_POST_OPEN          10      /* After opening: 10 msecs */
 
91
#define CONF_CARRIER_TIMEOUT    120000  /* Wait for carrier timeout */
92
92
 
93
93
/* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */
94
94
#define CONF_OPEN_RETRIES       2       /* (Re)open devices twice */
188
188
static struct ic_device *ic_first_dev __initdata = NULL;/* List of open device */
189
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
196
            (!(dev->flags & IFF_LOOPBACK) &&
195
197
             (dev->flags & (IFF_POINTOPOINT|IFF_BROADCAST)) &&
196
 
             strncmp(dev->name, "dummy", 5)))
197
 
                return true;
198
 
        return false;
 
198
             strncmp(dev->name, "dummy", 5));
199
199
}
200
200
 
201
201
static int __init ic_open_devs(void)
203
203
        struct ic_device *d, **last;
204
204
        struct net_device *dev;
205
205
        unsigned short oflags;
 
206
        unsigned long start;
206
207
 
207
208
        last = &ic_first_dev;
208
209
        rtnl_lock();
216
217
        }
217
218
 
218
219
        for_each_netdev(&init_net, dev) {
219
 
                if (dev->flags & IFF_LOOPBACK)
220
 
                        continue;
221
 
                if (ic_device_match(dev)) {
 
220
                if (ic_is_init_dev(dev)) {
222
221
                        int able = 0;
223
222
                        if (dev->mtu >= 364)
224
223
                                able |= IC_BOOTP;
252
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
265
        rtnl_unlock();
256
266
 
257
267
        *last = NULL;
1324
1334
{
1325
1335
        int i;
1326
1336
 
1327
 
        msleep(CONF_PRE_OPEN);
1328
1337
        for (i = 0; i < DEVICE_WAIT_MAX; i++) {
1329
1338
                struct net_device *dev;
1330
1339
                int found = 0;
1331
1340
 
1332
1341
                rtnl_lock();
1333
1342
                for_each_netdev(&init_net, dev) {
1334
 
                        if (ic_device_match(dev)) {
 
1343
                        if (ic_is_init_dev(dev)) {
1335
1344
                                found = 1;
1336
1345
                                break;
1337
1346
                        }
1378
1387
                return err;
1379
1388
 
1380
1389
        /* Give drivers a chance to settle */
1381
 
        ssleep(CONF_POST_OPEN);
 
1390
        msleep(CONF_POST_OPEN);
1382
1391
 
1383
1392
        /*
1384
1393
         * If the config information is insufficient (e.g., our IP address or
1444
1453
                root_server_addr = addr;
1445
1454
 
1446
1455
        /*
1447
 
         * Use defaults whereever applicable.
 
1456
         * Use defaults wherever applicable.
1448
1457
         */
1449
1458
        if (ic_defaults() < 0)
1450
1459
                return -1;