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

Function mlx5_get_module_info

dpdk/drivers/net/mlx5/linux/mlx5_ethdev_os.c:1203–1229  ·  view source on GitHub ↗

* DPDK callback to retrieve plug-in module EEPROM information (type and size). * * @param dev * Pointer to Ethernet device structure. * @param[out] modinfo * Storage for plug-in module EEPROM information. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

1201 * 0 on success, a negative errno value otherwise and rte_errno is set.
1202 */
1203int
1204mlx5_get_module_info(struct rte_eth_dev *dev,
1205 struct rte_eth_dev_module_info *modinfo)
1206{
1207 struct ethtool_modinfo info = {
1208 .cmd = ETHTOOL_GMODULEINFO,
1209 };
1210 struct ifreq ifr = (struct ifreq) {
1211 .ifr_data = (void *)&info,
1212 };
1213 int ret = 0;
1214
1215 if (!dev) {
1216 DRV_LOG(WARNING, "missing argument, cannot get module info");
1217 rte_errno = EINVAL;
1218 return -rte_errno;
1219 }
1220 ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
1221 if (ret) {
1222 DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL) failed: %s",
1223 dev->data->port_id, strerror(rte_errno));
1224 return ret;
1225 }
1226 modinfo->type = info.type;
1227 modinfo->eeprom_len = info.eeprom_len;
1228 return ret;
1229}
1230
1231/**
1232 * DPDK callback to retrieve plug-in module EEPROM data.

Callers

nothing calls this directly

Calls 1

mlx5_ifreqFunction · 0.85

Tested by

no test coverage detected