1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2020 Mellanox Technologies, Ltd
8 #include <rte_ethdev_driver.h>
9 #include <rte_interrupts.h>
11 #include <mlx5_glue.h>
12 #include <mlx5_devx_cmds.h>
13 #include <mlx5_common.h>
14 #include <mlx5_win_ext.h>
15 #include <mlx5_malloc.h>
19 * Get MAC address by querying netdevice.
22 * Pointer to Ethernet device.
24 * MAC address output buffer.
27 * 0 on success, a negative errno value otherwise and rte_errno is set.
30 mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])
32 struct mlx5_priv *priv;
33 mlx5_context_st *context_obj;
39 priv = dev->data->dev_private;
40 context_obj = (mlx5_context_st *)priv->sh->ctx;
41 memcpy(mac, context_obj->mlx5_dev.eth_mac, RTE_ETHER_ADDR_LEN);
49 * Pointer to Ethernet device.
54 * 0 on success, a negative errno value otherwise and rte_errno is set.
57 mlx5_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
65 * Unregister callback handler safely. The handler may be active
66 * while we are trying to unregister it, in this case code -EAGAIN
67 * is returned by rte_intr_callback_unregister(). This routine checks
68 * the return code and tries to unregister handler again.
73 * pointer to callback routine
75 * opaque callback parameter
78 mlx5_intr_callback_unregister(const struct rte_intr_handle *handle,
79 rte_intr_callback_fn cb_fn, void *cb_arg)
87 * DPDK callback to get flow control status.
90 * Pointer to Ethernet device structure.
92 * Flow control output buffer.
95 * 0 on success, a negative errno value otherwise and rte_errno is set.
98 mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
101 RTE_SET_USED(fc_conf);
106 * DPDK callback to modify flow control parameters.
109 * Pointer to Ethernet device structure.
111 * Flow control parameters.
114 * 0 on success, a negative errno value otherwise and rte_errno is set.
117 mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
120 RTE_SET_USED(fc_conf);
125 * Query the number of statistics provided by ETHTOOL.
128 * Pointer to Ethernet device.
131 * Number of statistics on success, negative errno value otherwise and
135 mlx5_os_get_stats_n(struct rte_eth_dev *dev)
142 * Init the structures to read device counters.
145 * Pointer to Ethernet device.
148 mlx5_os_stats_init(struct rte_eth_dev *dev)
154 * Read device counters table.
157 * Pointer to Ethernet device.
159 * Counters table output buffer.
162 * 0 on success and stats is filled, negative errno value otherwise and
166 mlx5_os_read_dev_counters(struct rte_eth_dev *dev, uint64_t *stats)
174 * DPDK callback to bring the link DOWN.
177 * Pointer to Ethernet device structure.
180 * 0 on success, a negative errno value otherwise
183 mlx5_set_link_down(struct rte_eth_dev *dev)
190 * DPDK callback to bring the link UP.
193 * Pointer to Ethernet device structure.
196 * 0 on success, a negative errno value otherwise
199 mlx5_set_link_up(struct rte_eth_dev *dev)
206 * DPDK callback to retrieve plug-in module EEPROM information (type and size).
209 * Pointer to Ethernet device structure.
210 * @param[out] modinfo
211 * Storage for plug-in module EEPROM information.
214 * 0 on success, a negative errno value otherwise and rte_errno is set.
217 mlx5_get_module_info(struct rte_eth_dev *dev,
218 struct rte_eth_dev_module_info *modinfo)
221 RTE_SET_USED(modinfo);
226 * DPDK callback to retrieve plug-in module EEPROM data.
229 * Pointer to Ethernet device structure.
231 * Storage for plug-in module EEPROM data.
234 * 0 on success, a negative errno value otherwise and rte_errno is set.
236 int mlx5_get_module_eeprom(struct rte_eth_dev *dev,
237 struct rte_dev_eeprom_info *info)