~ubuntu-branches/ubuntu/saucy/biosdevname/saucy-proposed

« back to all changes in this revision

Viewing changes to src/bios_device.c

  • Committer: Package Import Robot
  • Author(s): Mario Limonciello
  • Date: 2012-08-23 14:07:37 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: package-import@ubuntu.com-20120823140737-kxck3thzudd1jfbk
Tags: upstream-0.4.1
ImportĀ upstreamĀ versionĀ 0.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
230
230
                INIT_LIST_HEAD(&b->node);
231
231
                b->pcidev = p;
232
232
                b->netdev = n;
 
233
                b->slot_num = -1;
 
234
                b->port_num = -1;
233
235
                claim_netdev(b->netdev);
234
236
                list_add(&b->node, &state->bios_devices);
235
237
        }
259
261
                INIT_LIST_HEAD(&b->node);
260
262
                b->pcidev = p;
261
263
                b->netdev = n;
 
264
                b->slot_num = -1;
 
265
                b->port_num = -1;
262
266
                claim_netdev(b->netdev);
263
267
                list_add(&b->node, &state->bios_devices);
264
268
        }
282
286
                memset(b, 0, sizeof(*b));
283
287
                INIT_LIST_HEAD(&b->node);
284
288
                b->netdev = n;
 
289
                b->slot_num = -1;
 
290
                b->port_num = -1;
285
291
                list_add(&b->node, &state->bios_devices);
286
292
        }
287
293
}
302
308
        INIT_LIST_HEAD(&state->bios_devices);
303
309
        INIT_LIST_HEAD(&state->pci_devices);
304
310
        INIT_LIST_HEAD(&state->network_devices);
 
311
        INIT_LIST_HEAD(&state->slots);
305
312
        state->pacc = NULL;
306
313
        state->pirq_table = NULL;
307
314
        return state;
348
355
        }
349
356
}
350
357
 
 
358
extern int addslot(struct libbiosdevname_state *state, int slot);
 
359
 
351
360
/* Fix for RHBZ 816536/757743/756164/: Cards with same PCI but multiple ports
352
361
 * chelsio, mellanox */
353
362
static void check_ports(struct libbiosdevname_state *state)
354
363
{
355
 
        struct bios_device *a, *b;
356
 
        int nports;
 
364
        struct pci_device *dev;
 
365
        struct bios_device *a;
357
366
 
358
367
        list_for_each_entry(a, &state->bios_devices, node) {
359
 
                nports = 1;
360
 
                list_for_each_entry(b, &state->bios_devices, node) {
361
 
                        if (a != b && a->pcidev == b->pcidev && 
362
 
                            a->netdev->ifindex < b->netdev->ifindex && 
363
 
                            !b->nport) 
364
 
                          {
365
 
                                b->nport = ++nports;
366
 
                          }
 
368
                dev = a->pcidev;
 
369
                if (dev == NULL || dev->is_sriov_virtual_function || dev->vpd_port != INT_MAX)
 
370
                        continue;
 
371
                if (dev->physical_slot != PHYSICAL_SLOT_UNKNOWN) {
 
372
                        a->slot_num = dev->physical_slot;
 
373
                        a->port_num = addslot(state, 0x1000 + dev->physical_slot);
367
374
                }
368
375
        }
369
376
}