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

Function port_module_eeprom_display

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

Source from the content-addressed store, hash-verified

1063}
1064
1065void
1066port_module_eeprom_display(portid_t port_id)
1067{
1068 struct rte_eth_dev_module_info minfo;
1069 struct rte_dev_eeprom_info einfo;
1070 int ret;
1071
1072 if (port_id_is_invalid(port_id, ENABLED_WARN)) {
1073 print_valid_ports();
1074 return;
1075 }
1076
1077
1078 ret = rte_eth_dev_get_module_info(port_id, &minfo);
1079 if (ret != 0) {
1080 switch (ret) {
1081 case -ENODEV:
1082 fprintf(stderr, "port index %d invalid\n", port_id);
1083 break;
1084 case -ENOTSUP:
1085 fprintf(stderr, "operation not supported by device\n");
1086 break;
1087 case -EIO:
1088 fprintf(stderr, "device is removed\n");
1089 break;
1090 default:
1091 fprintf(stderr, "Unable to get module EEPROM: %d\n",
1092 ret);
1093 break;
1094 }
1095 return;
1096 }
1097
1098 einfo.offset = 0;
1099 einfo.length = minfo.eeprom_len;
1100 einfo.data = calloc(1, minfo.eeprom_len);
1101 if (!einfo.data) {
1102 fprintf(stderr,
1103 "Allocation of port %u eeprom data failed\n",
1104 port_id);
1105 return;
1106 }
1107
1108 ret = rte_eth_dev_get_module_eeprom(port_id, &einfo);
1109 if (ret != 0) {
1110 switch (ret) {
1111 case -ENODEV:
1112 fprintf(stderr, "port index %d invalid\n", port_id);
1113 break;
1114 case -ENOTSUP:
1115 fprintf(stderr, "operation not supported by device\n");
1116 break;
1117 case -EIO:
1118 fprintf(stderr, "device is removed\n");
1119 break;
1120 default:
1121 fprintf(stderr, "Unable to get module EEPROM: %d\n",
1122 ret);

Callers 1

cmd_showeeprom_parsedFunction · 0.85

Calls 8

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

Tested by

no test coverage detected