Commit 1170fbd8 authored by Feras Daoud's avatar Feras Daoud Committed by Saeed Mahameed

net/mlx5e: IPoIB, Add ioctl support to IPoIB device driver

Add ioctl support to IPoIB device driver. For now, this
ioctl will support timestamp get and set.
Signed-off-by: default avatarFeras Daoud <ferasda@mellanox.com>
Signed-off-by: default avatarEitan Rabin <rabin@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 3844b07e
...@@ -853,8 +853,8 @@ void mlx5e_timestamp_init(struct mlx5e_priv *priv); ...@@ -853,8 +853,8 @@ void mlx5e_timestamp_init(struct mlx5e_priv *priv);
void mlx5e_timestamp_cleanup(struct mlx5e_priv *priv); void mlx5e_timestamp_cleanup(struct mlx5e_priv *priv);
void mlx5e_pps_event_handler(struct mlx5e_priv *priv, void mlx5e_pps_event_handler(struct mlx5e_priv *priv,
struct ptp_clock_event *event); struct ptp_clock_event *event);
int mlx5e_hwstamp_set(struct net_device *dev, struct ifreq *ifr); int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr);
int mlx5e_hwstamp_get(struct net_device *dev, struct ifreq *ifr); int mlx5e_hwstamp_get(struct mlx5e_priv *priv, struct ifreq *ifr);
int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val); int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val);
int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto, int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
......
...@@ -86,9 +86,8 @@ static void mlx5e_timestamp_overflow(struct work_struct *work) ...@@ -86,9 +86,8 @@ static void mlx5e_timestamp_overflow(struct work_struct *work)
schedule_delayed_work(&tstamp->overflow_work, tstamp->overflow_period); schedule_delayed_work(&tstamp->overflow_work, tstamp->overflow_period);
} }
int mlx5e_hwstamp_set(struct net_device *dev, struct ifreq *ifr) int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
{ {
struct mlx5e_priv *priv = netdev_priv(dev);
struct hwtstamp_config config; struct hwtstamp_config config;
int err; int err;
...@@ -130,10 +129,10 @@ int mlx5e_hwstamp_set(struct net_device *dev, struct ifreq *ifr) ...@@ -130,10 +129,10 @@ int mlx5e_hwstamp_set(struct net_device *dev, struct ifreq *ifr)
case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
case HWTSTAMP_FILTER_NTP_ALL: case HWTSTAMP_FILTER_NTP_ALL:
/* Disable CQE compression */ /* Disable CQE compression */
netdev_warn(dev, "Disabling cqe compression"); netdev_warn(priv->netdev, "Disabling cqe compression");
err = mlx5e_modify_rx_cqe_compression_locked(priv, false); err = mlx5e_modify_rx_cqe_compression_locked(priv, false);
if (err) { if (err) {
netdev_err(dev, "Failed disabling cqe compression err=%d\n", err); netdev_err(priv->netdev, "Failed disabling cqe compression err=%d\n", err);
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
return err; return err;
} }
...@@ -151,9 +150,8 @@ int mlx5e_hwstamp_set(struct net_device *dev, struct ifreq *ifr) ...@@ -151,9 +150,8 @@ int mlx5e_hwstamp_set(struct net_device *dev, struct ifreq *ifr)
sizeof(config)) ? -EFAULT : 0; sizeof(config)) ? -EFAULT : 0;
} }
int mlx5e_hwstamp_get(struct net_device *dev, struct ifreq *ifr) int mlx5e_hwstamp_get(struct mlx5e_priv *priv, struct ifreq *ifr)
{ {
struct mlx5e_priv *priv = netdev_priv(dev);
struct hwtstamp_config *cfg = &priv->tstamp.hwtstamp_config; struct hwtstamp_config *cfg = &priv->tstamp.hwtstamp_config;
if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz)) if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz))
......
...@@ -3317,11 +3317,13 @@ static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -3317,11 +3317,13 @@ static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu)
static int mlx5e_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) static int mlx5e_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ {
struct mlx5e_priv *priv = netdev_priv(dev);
switch (cmd) { switch (cmd) {
case SIOCSHWTSTAMP: case SIOCSHWTSTAMP:
return mlx5e_hwstamp_set(dev, ifr); return mlx5e_hwstamp_set(priv, ifr);
case SIOCGHWTSTAMP: case SIOCGHWTSTAMP:
return mlx5e_hwstamp_get(dev, ifr); return mlx5e_hwstamp_get(priv, ifr);
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -43,6 +43,7 @@ static int mlx5i_close(struct net_device *netdev); ...@@ -43,6 +43,7 @@ static int mlx5i_close(struct net_device *netdev);
static int mlx5i_dev_init(struct net_device *dev); static int mlx5i_dev_init(struct net_device *dev);
static void mlx5i_dev_cleanup(struct net_device *dev); static void mlx5i_dev_cleanup(struct net_device *dev);
static int mlx5i_change_mtu(struct net_device *netdev, int new_mtu); static int mlx5i_change_mtu(struct net_device *netdev, int new_mtu);
static int mlx5i_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
static const struct net_device_ops mlx5i_netdev_ops = { static const struct net_device_ops mlx5i_netdev_ops = {
.ndo_open = mlx5i_open, .ndo_open = mlx5i_open,
...@@ -50,6 +51,7 @@ static const struct net_device_ops mlx5i_netdev_ops = { ...@@ -50,6 +51,7 @@ static const struct net_device_ops mlx5i_netdev_ops = {
.ndo_init = mlx5i_dev_init, .ndo_init = mlx5i_dev_init,
.ndo_uninit = mlx5i_dev_cleanup, .ndo_uninit = mlx5i_dev_cleanup,
.ndo_change_mtu = mlx5i_change_mtu, .ndo_change_mtu = mlx5i_change_mtu,
.ndo_do_ioctl = mlx5i_ioctl,
}; };
/* IPoIB mlx5 netdev profile */ /* IPoIB mlx5 netdev profile */
...@@ -356,6 +358,20 @@ static int mlx5i_dev_init(struct net_device *dev) ...@@ -356,6 +358,20 @@ static int mlx5i_dev_init(struct net_device *dev)
return 0; return 0;
} }
static int mlx5i_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
struct mlx5e_priv *priv = mlx5i_epriv(dev);
switch (cmd) {
case SIOCSHWTSTAMP:
return mlx5e_hwstamp_set(priv, ifr);
case SIOCGHWTSTAMP:
return mlx5e_hwstamp_get(priv, ifr);
default:
return -EOPNOTSUPP;
}
}
static void mlx5i_dev_cleanup(struct net_device *dev) static void mlx5i_dev_cleanup(struct net_device *dev)
{ {
struct mlx5e_priv *priv = mlx5i_epriv(dev); struct mlx5e_priv *priv = mlx5i_epriv(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment