* DPDK callback to get flow control status. * * @param dev * Pointer to Ethernet device structure. * @param[out] fc_conf * Flow control output buffer. * * @return * 0 on success, negative errno value otherwise and rte_errno is set. */
| 844 | * 0 on success, negative errno value otherwise and rte_errno is set. |
| 845 | */ |
| 846 | int |
| 847 | mlx4_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) |
| 848 | { |
| 849 | struct mlx4_priv *priv = dev->data->dev_private; |
| 850 | struct ifreq ifr; |
| 851 | struct ethtool_pauseparam ethpause = { |
| 852 | .cmd = ETHTOOL_GPAUSEPARAM, |
| 853 | }; |
| 854 | int ret; |
| 855 | |
| 856 | ifr.ifr_data = (void *)ðpause; |
| 857 | if (mlx4_ifreq(priv, SIOCETHTOOL, &ifr)) { |
| 858 | ret = rte_errno; |
| 859 | WARN("ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM)" |
| 860 | " failed: %s", |
| 861 | strerror(rte_errno)); |
| 862 | goto out; |
| 863 | } |
| 864 | fc_conf->autoneg = ethpause.autoneg; |
| 865 | if (ethpause.rx_pause && ethpause.tx_pause) |
| 866 | fc_conf->mode = RTE_ETH_FC_FULL; |
| 867 | else if (ethpause.rx_pause) |
| 868 | fc_conf->mode = RTE_ETH_FC_RX_PAUSE; |
| 869 | else if (ethpause.tx_pause) |
| 870 | fc_conf->mode = RTE_ETH_FC_TX_PAUSE; |
| 871 | else |
| 872 | fc_conf->mode = RTE_ETH_FC_NONE; |
| 873 | ret = 0; |
| 874 | out: |
| 875 | MLX4_ASSERT(ret >= 0); |
| 876 | return -ret; |
| 877 | } |
| 878 | |
| 879 | /** |
| 880 | * DPDK callback to modify flow control parameters. |
nothing calls this directly
no test coverage detected