Changes in / [c66a465:21f5f0f]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_dpdk.c

    r2badac9 r59e8400  
    375375 */
    376376static int parse_pciaddr(char * str, struct rte_pci_addr * addr, long * core) {
    377     char * wrkstr;
    378     char * pch;
     377    int matches;
    379378    assert(str);
    380     wrkstr = strdup(str);
    381    
    382     pch = strtok(wrkstr,":");
    383     if (pch == NULL || pch[0] == 0) {
    384         free(wrkstr); return -1;
    385     }
    386     addr->domain = (uint16_t) atoi(pch);
    387 
    388     pch = strtok(NULL,":");
    389     if (pch == NULL || pch[0] == 0) {
    390         free(wrkstr); return -1;
    391     }
    392     addr->bus = (uint8_t) atoi(pch);
    393 
    394     pch = strtok(NULL,".");
    395     if (pch == NULL || pch[0] == 0) {
    396         free(wrkstr); return -1;
    397     }
    398     addr->devid = (uint8_t) atoi(pch);
    399 
    400     pch = strtok(NULL,"-"); /* Might not find the '-' it's optional */
    401     if (pch == NULL || pch[0] == 0) {
    402         free(wrkstr); return -1;
    403     }
    404     addr->function = (uint8_t) atoi(pch);
    405 
    406     pch = strtok(NULL, ""); /* Find end of string */
    407    
    408     if (pch != NULL && pch[0] != 0) {
    409         *core = (long) atoi(pch);
    410     }
    411 
    412     free(wrkstr);
    413     return 0;
     379    matches = sscanf(str, "%4"SCNx16":%2"SCNx8":%2"SCNx8".%2"SCNx8"-%d", &addr->domain, &addr->bus, &addr->devid, &addr->function, core);
     380    if (matches >= 4) {
     381        return 0;
     382    } else {
     383        return -1;
     384    }
    414385}
    415386
     
    624595#if !DPDK_USE_BLACKLIST
    625596    /* Black list all ports besides the one that we want to use */
    626         if ((ret = whitelist_devices(format_data, &use_addr)) < 0) {
     597        if ((ret = whitelist_device(format_data, &use_addr)) < 0) {
    627598                snprintf(err, errlen, "Intel DPDK - Whitelisting PCI device failed,"
    628599                         " are you sure the address is correct?: %s", strerror(-ret));
Note: See TracChangeset for help on using the changeset viewer.