Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3844b07e authored by Feras Daoud's avatar Feras Daoud Committed by Saeed Mahameed
Browse files

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



Enable PTP for IPoIB rdma_netdev and add the ability
to get the time stamping parameters using ethtool.

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 4ec5cf78
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -1045,6 +1045,8 @@ 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_ts_info(struct mlx5e_priv *priv,
			      struct ethtool_ts_info *info);


/* mlx5e generic netdev management API */
/* mlx5e generic netdev management API */
struct net_device*
struct net_device*
+11 −4
Original line number Original line Diff line number Diff line
@@ -1372,13 +1372,12 @@ static int mlx5e_set_pauseparam(struct net_device *netdev,
	return err;
	return err;
}
}


static int mlx5e_get_ts_info(struct net_device *dev,
int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,
			      struct ethtool_ts_info *info)
			      struct ethtool_ts_info *info)
{
{
	struct mlx5e_priv *priv = netdev_priv(dev);
	int ret;
	int ret;


	ret = ethtool_op_get_ts_info(dev, info);
	ret = ethtool_op_get_ts_info(priv->netdev, info);
	if (ret)
	if (ret)
		return ret;
		return ret;


@@ -1401,6 +1400,14 @@ static int mlx5e_get_ts_info(struct net_device *dev,
	return 0;
	return 0;
}
}


static int mlx5e_get_ts_info(struct net_device *dev,
			     struct ethtool_ts_info *info)
{
	struct mlx5e_priv *priv = netdev_priv(dev);

	return mlx5e_ethtool_get_ts_info(priv, info);
}

static __u32 mlx5e_get_wol_supported(struct mlx5_core_dev *mdev)
static __u32 mlx5e_get_wol_supported(struct mlx5_core_dev *mdev)
{
{
	__u32 ret = 0;
	__u32 ret = 0;
+4 −0
Original line number Original line Diff line number Diff line
@@ -1046,6 +1046,7 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,
					 struct sk_buff *skb)
					 struct sk_buff *skb)
{
{
	struct net_device *netdev = rq->netdev;
	struct net_device *netdev = rq->netdev;
	struct mlx5e_tstamp *tstamp = rq->tstamp;
	char *pseudo_header;
	char *pseudo_header;
	u8 *dgid;
	u8 *dgid;
	u8 g;
	u8 g;
@@ -1070,6 +1071,9 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,
	skb->ip_summed = CHECKSUM_COMPLETE;
	skb->ip_summed = CHECKSUM_COMPLETE;
	skb->csum = csum_unfold((__force __sum16)cqe->check_sum);
	skb->csum = csum_unfold((__force __sum16)cqe->check_sum);


	if (unlikely(mlx5e_rx_hw_stamp(tstamp)))
		mlx5e_fill_hwstamp(tstamp, get_cqe_ts(cqe), skb_hwtstamps(skb));

	skb_record_rx_queue(skb, rq->ix);
	skb_record_rx_queue(skb, rq->ix);


	if (likely(netdev->features & NETIF_F_RXHASH))
	if (likely(netdev->features & NETIF_F_RXHASH))
+9 −0
Original line number Original line Diff line number Diff line
@@ -113,6 +113,14 @@ static int mlx5i_get_coalesce(struct net_device *netdev,
	return mlx5e_ethtool_get_coalesce(priv, coal);
	return mlx5e_ethtool_get_coalesce(priv, coal);
}
}


static int mlx5i_get_ts_info(struct net_device *netdev,
			     struct ethtool_ts_info *info)
{
	struct mlx5e_priv *priv = mlx5i_epriv(netdev);

	return mlx5e_ethtool_get_ts_info(priv, info);
}

const struct ethtool_ops mlx5i_ethtool_ops = {
const struct ethtool_ops mlx5i_ethtool_ops = {
	.get_drvinfo       = mlx5i_get_drvinfo,
	.get_drvinfo       = mlx5i_get_drvinfo,
	.get_strings       = mlx5i_get_strings,
	.get_strings       = mlx5i_get_strings,
@@ -124,4 +132,5 @@ const struct ethtool_ops mlx5i_ethtool_ops = {
	.set_channels      = mlx5i_set_channels,
	.set_channels      = mlx5i_set_channels,
	.get_coalesce      = mlx5i_get_coalesce,
	.get_coalesce      = mlx5i_get_coalesce,
	.set_coalesce      = mlx5i_set_coalesce,
	.set_coalesce      = mlx5i_set_coalesce,
	.get_ts_info       = mlx5i_get_ts_info,
};
};
+2 −0
Original line number Original line Diff line number Diff line
@@ -382,6 +382,7 @@ static int mlx5i_open(struct net_device *netdev)


	mlx5e_refresh_tirs(priv, false);
	mlx5e_refresh_tirs(priv, false);
	mlx5e_activate_priv_channels(priv);
	mlx5e_activate_priv_channels(priv);
	mlx5e_timestamp_init(priv);


	mutex_unlock(&priv->state_lock);
	mutex_unlock(&priv->state_lock);
	return 0;
	return 0;
@@ -406,6 +407,7 @@ static int mlx5i_close(struct net_device *netdev)


	clear_bit(MLX5E_STATE_OPENED, &priv->state);
	clear_bit(MLX5E_STATE_OPENED, &priv->state);


	mlx5e_timestamp_cleanup(priv);
	netif_carrier_off(priv->netdev);
	netif_carrier_off(priv->netdev);
	mlx5e_deactivate_priv_channels(priv);
	mlx5e_deactivate_priv_channels(priv);
	mlx5e_close_channels(&priv->channels);
	mlx5e_close_channels(&priv->channels);