Changeset 136c19e
- Timestamp:
- 02/09/15 13:28:14 (6 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- 4bdc4c2
- Parents:
- 34dafcc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_dpdk.c
r34dafcc r136c19e 356 356 */ 357 357 static int parse_pciaddr(char * str, struct rte_pci_addr * addr, long * core) { 358 char * wrkstr; 359 char * pch; 358 int matches; 360 359 assert(str); 361 wrkstr = strdup(str); 362 363 pch = strtok(wrkstr,":"); 364 if (pch == NULL || pch[0] == 0) { 365 free(wrkstr); return -1; 366 } 367 addr->domain = (uint16_t) atoi(pch); 368 369 pch = strtok(NULL,":"); 370 if (pch == NULL || pch[0] == 0) { 371 free(wrkstr); return -1; 372 } 373 addr->bus = (uint8_t) atoi(pch); 374 375 pch = strtok(NULL,"."); 376 if (pch == NULL || pch[0] == 0) { 377 free(wrkstr); return -1; 378 } 379 addr->devid = (uint8_t) atoi(pch); 380 381 pch = strtok(NULL,"-"); /* Might not find the '-' it's optional */ 382 if (pch == NULL || pch[0] == 0) { 383 free(wrkstr); return -1; 384 } 385 addr->function = (uint8_t) atoi(pch); 386 387 pch = strtok(NULL, ""); /* Find end of string */ 388 389 if (pch != NULL && pch[0] != 0) { 390 *core = (long) atoi(pch); 391 } 392 393 free(wrkstr); 394 return 0; 360 matches = sscanf(str, "%4"SCNx16":%2"SCNx8":%2"SCNx8".%2"SCNx8"-%ld", 361 &addr->domain, &addr->bus, &addr->devid, &addr->function, core); 362 if (matches >= 4) { 363 return 0; 364 } else { 365 return -1; 366 } 395 367 } 396 368
Note: See TracChangeset
for help on using the changeset viewer.