net/mlx5e: Expose ethtool pause and link functions to mlx5e callers
Towards supporting set/get of global pause for the port and get of the port link ksetting from the uplink representor, expose the relevant entries to other mlx5 callers. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
073caf5088
commit
371289b61a
|
@ -973,12 +973,20 @@ int mlx5e_ethtool_get_coalesce(struct mlx5e_priv *priv,
|
||||||
struct ethtool_coalesce *coal);
|
struct ethtool_coalesce *coal);
|
||||||
int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
|
int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
|
||||||
struct ethtool_coalesce *coal);
|
struct ethtool_coalesce *coal);
|
||||||
|
int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
|
||||||
|
struct ethtool_link_ksettings *link_ksettings);
|
||||||
|
int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
|
||||||
|
const struct ethtool_link_ksettings *link_ksettings);
|
||||||
u32 mlx5e_ethtool_get_rxfh_key_size(struct mlx5e_priv *priv);
|
u32 mlx5e_ethtool_get_rxfh_key_size(struct mlx5e_priv *priv);
|
||||||
u32 mlx5e_ethtool_get_rxfh_indir_size(struct mlx5e_priv *priv);
|
u32 mlx5e_ethtool_get_rxfh_indir_size(struct mlx5e_priv *priv);
|
||||||
int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,
|
int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,
|
||||||
struct ethtool_ts_info *info);
|
struct ethtool_ts_info *info);
|
||||||
int mlx5e_ethtool_flash_device(struct mlx5e_priv *priv,
|
int mlx5e_ethtool_flash_device(struct mlx5e_priv *priv,
|
||||||
struct ethtool_flash *flash);
|
struct ethtool_flash *flash);
|
||||||
|
void mlx5e_ethtool_get_pauseparam(struct mlx5e_priv *priv,
|
||||||
|
struct ethtool_pauseparam *pauseparam);
|
||||||
|
int mlx5e_ethtool_set_pauseparam(struct mlx5e_priv *priv,
|
||||||
|
struct ethtool_pauseparam *pauseparam);
|
||||||
|
|
||||||
/* mlx5e generic netdev management API */
|
/* mlx5e generic netdev management API */
|
||||||
int mlx5e_netdev_init(struct net_device *netdev,
|
int mlx5e_netdev_init(struct net_device *netdev,
|
||||||
|
|
|
@ -787,10 +787,9 @@ static void get_lp_advertising(u32 eth_proto_lp,
|
||||||
ptys2ethtool_adver_link(lp_advertising, eth_proto_lp);
|
ptys2ethtool_adver_link(lp_advertising, eth_proto_lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mlx5e_get_link_ksettings(struct net_device *netdev,
|
int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
|
||||||
struct ethtool_link_ksettings *link_ksettings)
|
struct ethtool_link_ksettings *link_ksettings)
|
||||||
{
|
{
|
||||||
struct mlx5e_priv *priv = netdev_priv(netdev);
|
|
||||||
struct mlx5_core_dev *mdev = priv->mdev;
|
struct mlx5_core_dev *mdev = priv->mdev;
|
||||||
u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0};
|
u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0};
|
||||||
u32 rx_pause = 0;
|
u32 rx_pause = 0;
|
||||||
|
@ -806,7 +805,7 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev,
|
||||||
|
|
||||||
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1);
|
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1);
|
||||||
if (err) {
|
if (err) {
|
||||||
netdev_err(netdev, "%s: query port ptys failed: %d\n",
|
netdev_err(priv->netdev, "%s: query port ptys failed: %d\n",
|
||||||
__func__, err);
|
__func__, err);
|
||||||
goto err_query_regs;
|
goto err_query_regs;
|
||||||
}
|
}
|
||||||
|
@ -826,7 +825,7 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev,
|
||||||
|
|
||||||
get_supported(eth_proto_cap, link_ksettings);
|
get_supported(eth_proto_cap, link_ksettings);
|
||||||
get_advertising(eth_proto_admin, tx_pause, rx_pause, link_ksettings);
|
get_advertising(eth_proto_admin, tx_pause, rx_pause, link_ksettings);
|
||||||
get_speed_duplex(netdev, eth_proto_oper, link_ksettings);
|
get_speed_duplex(priv->netdev, eth_proto_oper, link_ksettings);
|
||||||
|
|
||||||
eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap;
|
eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap;
|
||||||
|
|
||||||
|
@ -846,7 +845,7 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev,
|
||||||
Autoneg);
|
Autoneg);
|
||||||
|
|
||||||
if (get_fec_supported_advertised(mdev, link_ksettings))
|
if (get_fec_supported_advertised(mdev, link_ksettings))
|
||||||
netdev_dbg(netdev, "%s: FEC caps query failed: %d\n",
|
netdev_dbg(priv->netdev, "%s: FEC caps query failed: %d\n",
|
||||||
__func__, err);
|
__func__, err);
|
||||||
|
|
||||||
if (!an_disable_admin)
|
if (!an_disable_admin)
|
||||||
|
@ -857,6 +856,14 @@ err_query_regs:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mlx5e_get_link_ksettings(struct net_device *netdev,
|
||||||
|
struct ethtool_link_ksettings *link_ksettings)
|
||||||
|
{
|
||||||
|
struct mlx5e_priv *priv = netdev_priv(netdev);
|
||||||
|
|
||||||
|
return mlx5e_ethtool_get_link_ksettings(priv, link_ksettings);
|
||||||
|
}
|
||||||
|
|
||||||
static u32 mlx5e_ethtool2ptys_adver_link(const unsigned long *link_modes)
|
static u32 mlx5e_ethtool2ptys_adver_link(const unsigned long *link_modes)
|
||||||
{
|
{
|
||||||
u32 i, ptys_modes = 0;
|
u32 i, ptys_modes = 0;
|
||||||
|
@ -871,10 +878,9 @@ static u32 mlx5e_ethtool2ptys_adver_link(const unsigned long *link_modes)
|
||||||
return ptys_modes;
|
return ptys_modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mlx5e_set_link_ksettings(struct net_device *netdev,
|
int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
|
||||||
const struct ethtool_link_ksettings *link_ksettings)
|
const struct ethtool_link_ksettings *link_ksettings)
|
||||||
{
|
{
|
||||||
struct mlx5e_priv *priv = netdev_priv(netdev);
|
|
||||||
struct mlx5_core_dev *mdev = priv->mdev;
|
struct mlx5_core_dev *mdev = priv->mdev;
|
||||||
u32 eth_proto_cap, eth_proto_admin;
|
u32 eth_proto_cap, eth_proto_admin;
|
||||||
bool an_changes = false;
|
bool an_changes = false;
|
||||||
|
@ -894,14 +900,14 @@ static int mlx5e_set_link_ksettings(struct net_device *netdev,
|
||||||
|
|
||||||
err = mlx5_query_port_proto_cap(mdev, ð_proto_cap, MLX5_PTYS_EN);
|
err = mlx5_query_port_proto_cap(mdev, ð_proto_cap, MLX5_PTYS_EN);
|
||||||
if (err) {
|
if (err) {
|
||||||
netdev_err(netdev, "%s: query port eth proto cap failed: %d\n",
|
netdev_err(priv->netdev, "%s: query port eth proto cap failed: %d\n",
|
||||||
__func__, err);
|
__func__, err);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
link_modes = link_modes & eth_proto_cap;
|
link_modes = link_modes & eth_proto_cap;
|
||||||
if (!link_modes) {
|
if (!link_modes) {
|
||||||
netdev_err(netdev, "%s: Not supported link mode(s) requested",
|
netdev_err(priv->netdev, "%s: Not supported link mode(s) requested",
|
||||||
__func__);
|
__func__);
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -909,7 +915,7 @@ static int mlx5e_set_link_ksettings(struct net_device *netdev,
|
||||||
|
|
||||||
err = mlx5_query_port_proto_admin(mdev, ð_proto_admin, MLX5_PTYS_EN);
|
err = mlx5_query_port_proto_admin(mdev, ð_proto_admin, MLX5_PTYS_EN);
|
||||||
if (err) {
|
if (err) {
|
||||||
netdev_err(netdev, "%s: query port eth proto admin failed: %d\n",
|
netdev_err(priv->netdev, "%s: query port eth proto admin failed: %d\n",
|
||||||
__func__, err);
|
__func__, err);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -931,6 +937,14 @@ out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mlx5e_set_link_ksettings(struct net_device *netdev,
|
||||||
|
const struct ethtool_link_ksettings *link_ksettings)
|
||||||
|
{
|
||||||
|
struct mlx5e_priv *priv = netdev_priv(netdev);
|
||||||
|
|
||||||
|
return mlx5e_ethtool_set_link_ksettings(priv, link_ksettings);
|
||||||
|
}
|
||||||
|
|
||||||
u32 mlx5e_ethtool_get_rxfh_key_size(struct mlx5e_priv *priv)
|
u32 mlx5e_ethtool_get_rxfh_key_size(struct mlx5e_priv *priv)
|
||||||
{
|
{
|
||||||
return sizeof(priv->rss_params.toeplitz_hash_key);
|
return sizeof(priv->rss_params.toeplitz_hash_key);
|
||||||
|
@ -1127,25 +1141,31 @@ static int mlx5e_set_tunable(struct net_device *dev,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mlx5e_get_pauseparam(struct net_device *netdev,
|
void mlx5e_ethtool_get_pauseparam(struct mlx5e_priv *priv,
|
||||||
struct ethtool_pauseparam *pauseparam)
|
struct ethtool_pauseparam *pauseparam)
|
||||||
{
|
{
|
||||||
struct mlx5e_priv *priv = netdev_priv(netdev);
|
|
||||||
struct mlx5_core_dev *mdev = priv->mdev;
|
struct mlx5_core_dev *mdev = priv->mdev;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = mlx5_query_port_pause(mdev, &pauseparam->rx_pause,
|
err = mlx5_query_port_pause(mdev, &pauseparam->rx_pause,
|
||||||
&pauseparam->tx_pause);
|
&pauseparam->tx_pause);
|
||||||
if (err) {
|
if (err) {
|
||||||
netdev_err(netdev, "%s: mlx5_query_port_pause failed:0x%x\n",
|
netdev_err(priv->netdev, "%s: mlx5_query_port_pause failed:0x%x\n",
|
||||||
__func__, err);
|
__func__, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mlx5e_set_pauseparam(struct net_device *netdev,
|
static void mlx5e_get_pauseparam(struct net_device *netdev,
|
||||||
struct ethtool_pauseparam *pauseparam)
|
struct ethtool_pauseparam *pauseparam)
|
||||||
|
{
|
||||||
|
struct mlx5e_priv *priv = netdev_priv(netdev);
|
||||||
|
|
||||||
|
mlx5e_ethtool_get_pauseparam(priv, pauseparam);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx5e_ethtool_set_pauseparam(struct mlx5e_priv *priv,
|
||||||
|
struct ethtool_pauseparam *pauseparam)
|
||||||
{
|
{
|
||||||
struct mlx5e_priv *priv = netdev_priv(netdev);
|
|
||||||
struct mlx5_core_dev *mdev = priv->mdev;
|
struct mlx5_core_dev *mdev = priv->mdev;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -1156,13 +1176,21 @@ static int mlx5e_set_pauseparam(struct net_device *netdev,
|
||||||
pauseparam->rx_pause ? 1 : 0,
|
pauseparam->rx_pause ? 1 : 0,
|
||||||
pauseparam->tx_pause ? 1 : 0);
|
pauseparam->tx_pause ? 1 : 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
netdev_err(netdev, "%s: mlx5_set_port_pause failed:0x%x\n",
|
netdev_err(priv->netdev, "%s: mlx5_set_port_pause failed:0x%x\n",
|
||||||
__func__, err);
|
__func__, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mlx5e_set_pauseparam(struct net_device *netdev,
|
||||||
|
struct ethtool_pauseparam *pauseparam)
|
||||||
|
{
|
||||||
|
struct mlx5e_priv *priv = netdev_priv(netdev);
|
||||||
|
|
||||||
|
return mlx5e_ethtool_set_pauseparam(priv, pauseparam);
|
||||||
|
}
|
||||||
|
|
||||||
int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,
|
int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,
|
||||||
struct ethtool_ts_info *info)
|
struct ethtool_ts_info *info)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue