net/mlx5e: clock.c depends on CONFIG_PTP_1588_CLOCK
lib/clock.c includes clock related functions which require ptp support. Thus compile out lib/clock.c and add the needed function stubs in case kconfig CONFIG_PTP_1588_CLOCK is off. Signed-off-by: Moshe Shemesh <moshe@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
c5791ab0ab
commit
6dbc80ca41
@ -5,7 +5,7 @@ subdir-ccflags-y += -I$(src)
|
||||
mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
|
||||
health.o mcg.o cq.o srq.o alloc.o qp.o port.o mr.o pd.o \
|
||||
mad.o transobj.o vport.o sriov.o fs_cmd.o fs_core.o \
|
||||
fs_counters.o rl.o lag.o dev.o wq.o lib/gid.o lib/clock.o \
|
||||
fs_counters.o rl.o lag.o dev.o wq.o lib/gid.o \
|
||||
diag/fs_tracepoint.o diag/fw_tracer.o
|
||||
|
||||
mlx5_core-$(CONFIG_MLX5_ACCEL) += accel/ipsec.o accel/tls.o
|
||||
@ -15,6 +15,7 @@ mlx5_core-$(CONFIG_MLX5_FPGA) += fpga/cmd.o fpga/core.o fpga/conn.o fpga/sdk.o \
|
||||
|
||||
mlx5_core-$(CONFIG_MLX5_MPFS) += lib/mpfs.o
|
||||
mlx5_core-$(CONFIG_VXLAN) += lib/vxlan.o
|
||||
mlx5_core-$(CONFIG_PTP_1588_CLOCK) += lib/clock.o
|
||||
|
||||
mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \
|
||||
en_tx.o en_rx.o en_dim.o en_txrx.o en/xdp.o en_stats.o \
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "en.h"
|
||||
#include "en/port.h"
|
||||
#include "lib/clock.h"
|
||||
|
||||
void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv,
|
||||
struct ethtool_drvinfo *drvinfo)
|
||||
@ -1106,10 +1107,10 @@ int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
info->phc_index = mdev->clock.ptp ?
|
||||
ptp_clock_index(mdev->clock.ptp) : -1;
|
||||
info->phc_index = mlx5_clock_get_ptp_index(mdev);
|
||||
|
||||
if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz))
|
||||
if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz) ||
|
||||
info->phc_index == -1)
|
||||
return 0;
|
||||
|
||||
info->so_timestamping |= SOF_TIMESTAMPING_TX_HARDWARE |
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "accel/ipsec.h"
|
||||
#include "accel/tls.h"
|
||||
#include "lib/vxlan.h"
|
||||
#include "lib/clock.h"
|
||||
#include "en/port.h"
|
||||
#include "en/xdp.h"
|
||||
|
||||
@ -3782,7 +3783,8 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
|
||||
struct hwtstamp_config config;
|
||||
int err;
|
||||
|
||||
if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz))
|
||||
if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz) ||
|
||||
(mlx5_clock_get_ptp_index(priv->mdev) == -1))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "mlx5_core.h"
|
||||
#include "fpga/core.h"
|
||||
#include "eswitch.h"
|
||||
#include "lib/clock.h"
|
||||
#include "diag/fw_tracer.h"
|
||||
|
||||
enum {
|
||||
|
@ -33,8 +33,15 @@
|
||||
#ifndef __LIB_CLOCK_H__
|
||||
#define __LIB_CLOCK_H__
|
||||
|
||||
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
|
||||
void mlx5_init_clock(struct mlx5_core_dev *mdev);
|
||||
void mlx5_cleanup_clock(struct mlx5_core_dev *mdev);
|
||||
void mlx5_pps_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe);
|
||||
|
||||
static inline int mlx5_clock_get_ptp_index(struct mlx5_core_dev *mdev)
|
||||
{
|
||||
return mdev->clock.ptp ? ptp_clock_index(mdev->clock.ptp) : -1;
|
||||
}
|
||||
|
||||
static inline ktime_t mlx5_timecounter_cyc2time(struct mlx5_clock *clock,
|
||||
u64 timestamp)
|
||||
@ -48,4 +55,21 @@ static inline ktime_t mlx5_timecounter_cyc2time(struct mlx5_clock *clock,
|
||||
return ns_to_ktime(nsec);
|
||||
}
|
||||
|
||||
#else
|
||||
static inline void mlx5_init_clock(struct mlx5_core_dev *mdev) {}
|
||||
static inline void mlx5_cleanup_clock(struct mlx5_core_dev *mdev) {}
|
||||
static inline void mlx5_pps_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe) {}
|
||||
|
||||
static inline int mlx5_clock_get_ptp_index(struct mlx5_core_dev *mdev)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline ktime_t mlx5_timecounter_cyc2time(struct mlx5_clock *clock,
|
||||
u64 timestamp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -99,7 +99,6 @@ void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event,
|
||||
unsigned long param);
|
||||
void mlx5_core_page_fault(struct mlx5_core_dev *dev,
|
||||
struct mlx5_pagefault *pfault);
|
||||
void mlx5_pps_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe);
|
||||
void mlx5_port_module_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe);
|
||||
void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force);
|
||||
void mlx5_disable_device(struct mlx5_core_dev *dev);
|
||||
|
Loading…
Reference in New Issue
Block a user