Commit ab5b7680 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'convert-mlx5e-and-ipoib-to-ndo_hwtstamp_get-set'

Tariq Toukan says:

====================
Convert mlx5e and IPoIB to ndo_hwtstamp_get/set

This series by Carolina migrates mlx5e and IPoIB to the
ndo_hwtstamp_get/set interface and removes legacy hardware timestamp
ioctl handling.  While doing so, it also cleans up naming and removes
redundant code.

No functional change in timestamp behavior.

Cleanup patches:
- net/mlx5e: Remove redundant tstamp pointer from channel structures
- net/mlx5e: Remove unnecessary tstamp local variable in mlx5i_complete_rx_cqe
- net/mlx5e: Rename hwstamp functions to hwtstamp
- net/mlx5e: Rename timestamp fields to hwtstamp_config

Add suppport in ipoib:
- IB/IPoIB: Add support for hwtstamp get/set ndos

Convert mlx5:
- net/mlx5e: Convert to new hwtstamp_get/set interface
====================

Link: https://patch.msgid.link/1761819910-1011051-1-git-send-email-tariqt@nvidia.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 54133f9b 1c7fe48a
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -1825,6 +1825,31 @@ static int ipoib_ioctl(struct net_device *dev, struct ifreq *ifr,
	return priv->rn_ops->ndo_eth_ioctl(dev, ifr, cmd);
}

static int ipoib_hwtstamp_get(struct net_device *dev,
			      struct kernel_hwtstamp_config *config)
{
	struct ipoib_dev_priv *priv = ipoib_priv(dev);

	if (!priv->rn_ops->ndo_hwtstamp_get)
		/* legacy */
		return dev_eth_ioctl(dev, config->ifr, SIOCGHWTSTAMP);

	return priv->rn_ops->ndo_hwtstamp_get(dev, config);
}

static int ipoib_hwtstamp_set(struct net_device *dev,
			      struct kernel_hwtstamp_config *config,
			      struct netlink_ext_ack *extack)
{
	struct ipoib_dev_priv *priv = ipoib_priv(dev);

	if (!priv->rn_ops->ndo_hwtstamp_set)
		/* legacy */
		return dev_eth_ioctl(dev, config->ifr, SIOCSHWTSTAMP);

	return priv->rn_ops->ndo_hwtstamp_set(dev, config, extack);
}

static int ipoib_dev_init(struct net_device *dev)
{
	struct ipoib_dev_priv *priv = ipoib_priv(dev);
@@ -2149,6 +2174,8 @@ static const struct net_device_ops ipoib_netdev_ops_pf = {
	.ndo_set_mac_address	 = ipoib_set_mac,
	.ndo_get_stats64	 = ipoib_get_stats,
	.ndo_eth_ioctl		 = ipoib_ioctl,
	.ndo_hwtstamp_get	 = ipoib_hwtstamp_get,
	.ndo_hwtstamp_set	 = ipoib_hwtstamp_set,
};

static const struct net_device_ops ipoib_netdev_ops_vf = {
@@ -2164,6 +2191,8 @@ static const struct net_device_ops ipoib_netdev_ops_vf = {
	.ndo_get_iflink		 = ipoib_get_iflink,
	.ndo_get_stats64	 = ipoib_get_stats,
	.ndo_eth_ioctl		 = ipoib_ioctl,
	.ndo_hwtstamp_get	 = ipoib_hwtstamp_get,
	.ndo_hwtstamp_set	 = ipoib_hwtstamp_set,
};

static const struct net_device_ops ipoib_netdev_default_pf = {
+7 −5
Original line number Diff line number Diff line
@@ -696,7 +696,7 @@ struct mlx5e_rq {
	struct mlx5e_rq_stats *stats;
	struct mlx5e_cq        cq;
	struct mlx5e_cq_decomp cqd;
	struct hwtstamp_config *tstamp;
	struct kernel_hwtstamp_config *hwtstamp_config;
	struct mlx5_clock      *clock;
	struct mlx5e_icosq    *icosq;
	struct mlx5e_priv     *priv;
@@ -784,7 +784,6 @@ struct mlx5e_channel {
	/* control */
	struct mlx5e_priv         *priv;
	struct mlx5_core_dev      *mdev;
	struct hwtstamp_config    *tstamp;
	DECLARE_BITMAP(state, MLX5E_CHANNEL_NUM_STATES);
	int                        ix;
	int                        vec_ix;
@@ -918,7 +917,7 @@ struct mlx5e_priv {
	u8                         max_opened_tc;
	bool                       tx_ptp_opened;
	bool                       rx_ptp_opened;
	struct hwtstamp_config     tstamp;
	struct kernel_hwtstamp_config hwtstamp_config;
	u16                        q_counter[MLX5_SD_MAX_GROUP_SZ];
	u16                        drop_rq_q_counter;
	struct notifier_block      events_nb;
@@ -1027,8 +1026,11 @@ void mlx5e_self_test(struct net_device *ndev, struct ethtool_test *etest,
		     u64 *buf);
void mlx5e_set_rx_mode_work(struct work_struct *work);

int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr);
int mlx5e_hwstamp_get(struct mlx5e_priv *priv, struct ifreq *ifr);
int mlx5e_hwtstamp_set(struct mlx5e_priv *priv,
		       struct kernel_hwtstamp_config *config,
		       struct netlink_ext_ack *extack);
int mlx5e_hwtstamp_get(struct mlx5e_priv *priv,
		       struct kernel_hwtstamp_config *config);
int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val, bool rx_filter);

int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
+1 −2
Original line number Diff line number Diff line
@@ -713,7 +713,7 @@ static int mlx5e_init_ptp_rq(struct mlx5e_ptp *c, struct mlx5e_params *params,
	rq->netdev       = priv->netdev;
	rq->priv         = priv;
	rq->clock        = mdev->clock;
	rq->tstamp       = &priv->tstamp;
	rq->hwtstamp_config = &priv->hwtstamp_config;
	rq->mdev         = mdev;
	rq->hw_mtu       = MLX5E_SW2HW_MTU(params, params->sw_mtu);
	rq->stats        = &c->priv->ptp_stats.rq;
@@ -896,7 +896,6 @@ int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,

	c->priv     = priv;
	c->mdev     = priv->mdev;
	c->tstamp   = &priv->tstamp;
	c->pdev     = mlx5_core_dma_dev(priv->mdev);
	c->netdev   = priv->netdev;
	c->mkey_be  = cpu_to_be32(priv->mdev->mlx5e_res.hw_objs.mkey);
+0 −1
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ struct mlx5e_ptp {
	/* control */
	struct mlx5e_priv         *priv;
	struct mlx5_core_dev      *mdev;
	struct hwtstamp_config    *tstamp;
	DECLARE_BITMAP(state, MLX5E_PTP_STATE_NUM_STATES);
	struct mlx5_sq_bfreg      *bfreg;
};
+2 −1
Original line number Diff line number Diff line
@@ -318,7 +318,8 @@ mlx5e_rx_reporter_diagnose_common_ptp_config(struct mlx5e_priv *priv, struct mlx
					     struct devlink_fmsg *fmsg)
{
	mlx5e_health_fmsg_named_obj_nest_start(fmsg, "PTP");
	devlink_fmsg_u32_pair_put(fmsg, "filter_type", priv->tstamp.rx_filter);
	devlink_fmsg_u32_pair_put(fmsg, "filter_type",
				  priv->hwtstamp_config.rx_filter);
	mlx5e_rx_reporter_diagnose_generic_rq(&ptp_ch->rq, fmsg);
	mlx5e_health_fmsg_named_obj_nest_end(fmsg);
}
Loading