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

Function mlx4_flow_ctrl_set

dpdk/drivers/net/mlx4/mlx4_ethdev.c:890–923  ·  view source on GitHub ↗

* DPDK callback to modify flow control parameters. * * @param dev * Pointer to Ethernet device structure. * @param[in] fc_conf * Flow control parameters. * * @return * 0 on success, negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

888 * 0 on success, negative errno value otherwise and rte_errno is set.
889 */
890int
891mlx4_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
892{
893 struct mlx4_priv *priv = dev->data->dev_private;
894 struct ifreq ifr;
895 struct ethtool_pauseparam ethpause = {
896 .cmd = ETHTOOL_SPAUSEPARAM,
897 };
898 int ret;
899
900 ifr.ifr_data = (void *)&ethpause;
901 ethpause.autoneg = fc_conf->autoneg;
902 if (((fc_conf->mode & RTE_ETH_FC_FULL) == RTE_ETH_FC_FULL) ||
903 (fc_conf->mode & RTE_ETH_FC_RX_PAUSE))
904 ethpause.rx_pause = 1;
905 else
906 ethpause.rx_pause = 0;
907 if (((fc_conf->mode & RTE_ETH_FC_FULL) == RTE_ETH_FC_FULL) ||
908 (fc_conf->mode & RTE_ETH_FC_TX_PAUSE))
909 ethpause.tx_pause = 1;
910 else
911 ethpause.tx_pause = 0;
912 if (mlx4_ifreq(priv, SIOCETHTOOL, &ifr)) {
913 ret = rte_errno;
914 WARN("ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
915 " failed: %s",
916 strerror(rte_errno));
917 goto out;
918 }
919 ret = 0;
920out:
921 MLX4_ASSERT(ret >= 0);
922 return -ret;
923}
924
925/**
926 * DPDK callback to retrieve the received packet types that are recognized

Callers

nothing calls this directly

Calls 1

mlx4_ifreqFunction · 0.85

Tested by

no test coverage detected