MCPcopy Create free account
hub / github.com/F-Stack/f-stack / port_eeprom_display

Function port_eeprom_display

dpdk/app/test-pmd/config.c:1001–1063  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

999}
1000
1001void
1002port_eeprom_display(portid_t port_id)
1003{
1004 struct rte_dev_eeprom_info einfo;
1005 int ret;
1006 if (port_id_is_invalid(port_id, ENABLED_WARN)) {
1007 print_valid_ports();
1008 return;
1009 }
1010
1011 int len_eeprom = rte_eth_dev_get_eeprom_length(port_id);
1012 if (len_eeprom < 0) {
1013 switch (len_eeprom) {
1014 case -ENODEV:
1015 fprintf(stderr, "port index %d invalid\n", port_id);
1016 break;
1017 case -ENOTSUP:
1018 fprintf(stderr, "operation not supported by device\n");
1019 break;
1020 case -EIO:
1021 fprintf(stderr, "device is removed\n");
1022 break;
1023 default:
1024 fprintf(stderr, "Unable to get EEPROM: %d\n",
1025 len_eeprom);
1026 break;
1027 }
1028 return;
1029 }
1030
1031 einfo.offset = 0;
1032 einfo.length = len_eeprom;
1033 einfo.data = calloc(1, len_eeprom);
1034 if (!einfo.data) {
1035 fprintf(stderr,
1036 "Allocation of port %u eeprom data failed\n",
1037 port_id);
1038 return;
1039 }
1040
1041 ret = rte_eth_dev_get_eeprom(port_id, &einfo);
1042 if (ret != 0) {
1043 switch (ret) {
1044 case -ENODEV:
1045 fprintf(stderr, "port index %d invalid\n", port_id);
1046 break;
1047 case -ENOTSUP:
1048 fprintf(stderr, "operation not supported by device\n");
1049 break;
1050 case -EIO:
1051 fprintf(stderr, "device is removed\n");
1052 break;
1053 default:
1054 fprintf(stderr, "Unable to get EEPROM: %d\n", ret);
1055 break;
1056 }
1057 free(einfo.data);
1058 return;

Callers 1

cmd_showeeprom_parsedFunction · 0.85

Calls 8

port_id_is_invalidFunction · 0.85
print_valid_portsFunction · 0.85
callocFunction · 0.85
rte_eth_dev_get_eepromFunction · 0.85
rte_hexdumpFunction · 0.85
freeFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected