diff options
author | Moshe Shemesh <moshe@mellanox.com> | 2018-07-29 06:29:45 -0400 |
---|---|---|
committer | Saeed Mahameed <saeedm@mellanox.com> | 2018-08-13 15:50:17 -0400 |
commit | 6dbc80ca41f5a76e0d2ae4e96b2476d68a2ea17f (patch) | |
tree | 21fdc608cbe20d3cec4c79df6c267d33cf4bc41b | |
parent | c5791ab0abecb5e4a41673b83e3660f731b0717b (diff) |
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>
6 files changed, 34 insertions, 6 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Makefile b/drivers/net/ethernet/mellanox/mlx5/core/Makefile index 09b5e235527b..9e78c48b22dd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/Makefile +++ b/drivers/net/ethernet/mellanox/mlx5/core/Makefile | |||
@@ -5,7 +5,7 @@ subdir-ccflags-y += -I$(src) | |||
5 | mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \ | 5 | mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \ |
6 | health.o mcg.o cq.o srq.o alloc.o qp.o port.o mr.o pd.o \ | 6 | health.o mcg.o cq.o srq.o alloc.o qp.o port.o mr.o pd.o \ |
7 | mad.o transobj.o vport.o sriov.o fs_cmd.o fs_core.o \ | 7 | mad.o transobj.o vport.o sriov.o fs_cmd.o fs_core.o \ |
8 | fs_counters.o rl.o lag.o dev.o wq.o lib/gid.o lib/clock.o \ | 8 | fs_counters.o rl.o lag.o dev.o wq.o lib/gid.o \ |
9 | diag/fs_tracepoint.o diag/fw_tracer.o | 9 | diag/fs_tracepoint.o diag/fw_tracer.o |
10 | 10 | ||
11 | mlx5_core-$(CONFIG_MLX5_ACCEL) += accel/ipsec.o accel/tls.o | 11 | 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 \ | |||
15 | 15 | ||
16 | mlx5_core-$(CONFIG_MLX5_MPFS) += lib/mpfs.o | 16 | mlx5_core-$(CONFIG_MLX5_MPFS) += lib/mpfs.o |
17 | mlx5_core-$(CONFIG_VXLAN) += lib/vxlan.o | 17 | mlx5_core-$(CONFIG_VXLAN) += lib/vxlan.o |
18 | mlx5_core-$(CONFIG_PTP_1588_CLOCK) += lib/clock.o | ||
18 | 19 | ||
19 | mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \ | 20 | mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \ |
20 | en_tx.o en_rx.o en_dim.o en_txrx.o en/xdp.o en_stats.o \ | 21 | en_tx.o en_rx.o en_dim.o en_txrx.o en/xdp.o en_stats.o \ |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 7787cc3a2c84..98dd3e0ada72 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | #include "en.h" | 33 | #include "en.h" |
34 | #include "en/port.h" | 34 | #include "en/port.h" |
35 | #include "lib/clock.h" | ||
35 | 36 | ||
36 | void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv, | 37 | void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv, |
37 | struct ethtool_drvinfo *drvinfo) | 38 | struct ethtool_drvinfo *drvinfo) |
@@ -1106,10 +1107,10 @@ int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv, | |||
1106 | if (ret) | 1107 | if (ret) |
1107 | return ret; | 1108 | return ret; |
1108 | 1109 | ||
1109 | info->phc_index = mdev->clock.ptp ? | 1110 | info->phc_index = mlx5_clock_get_ptp_index(mdev); |
1110 | ptp_clock_index(mdev->clock.ptp) : -1; | ||
1111 | 1111 | ||
1112 | if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz)) | 1112 | if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz) || |
1113 | info->phc_index == -1) | ||
1113 | return 0; | 1114 | return 0; |
1114 | 1115 | ||
1115 | info->so_timestamping |= SOF_TIMESTAMPING_TX_HARDWARE | | 1116 | info->so_timestamping |= SOF_TIMESTAMPING_TX_HARDWARE | |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index e09086f41365..5a7939e70190 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "accel/ipsec.h" | 46 | #include "accel/ipsec.h" |
47 | #include "accel/tls.h" | 47 | #include "accel/tls.h" |
48 | #include "lib/vxlan.h" | 48 | #include "lib/vxlan.h" |
49 | #include "lib/clock.h" | ||
49 | #include "en/port.h" | 50 | #include "en/port.h" |
50 | #include "en/xdp.h" | 51 | #include "en/xdp.h" |
51 | 52 | ||
@@ -3782,7 +3783,8 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) | |||
3782 | struct hwtstamp_config config; | 3783 | struct hwtstamp_config config; |
3783 | int err; | 3784 | int err; |
3784 | 3785 | ||
3785 | if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz)) | 3786 | if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz) || |
3787 | (mlx5_clock_get_ptp_index(priv->mdev) == -1)) | ||
3786 | return -EOPNOTSUPP; | 3788 | return -EOPNOTSUPP; |
3787 | 3789 | ||
3788 | if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) | 3790 | if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index 7669b4380779..48864f4988a4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "mlx5_core.h" | 40 | #include "mlx5_core.h" |
41 | #include "fpga/core.h" | 41 | #include "fpga/core.h" |
42 | #include "eswitch.h" | 42 | #include "eswitch.h" |
43 | #include "lib/clock.h" | ||
43 | #include "diag/fw_tracer.h" | 44 | #include "diag/fw_tracer.h" |
44 | 45 | ||
45 | enum { | 46 | enum { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h index a8eecedd46c2..02e2e4575e4f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h | |||
@@ -33,8 +33,15 @@ | |||
33 | #ifndef __LIB_CLOCK_H__ | 33 | #ifndef __LIB_CLOCK_H__ |
34 | #define __LIB_CLOCK_H__ | 34 | #define __LIB_CLOCK_H__ |
35 | 35 | ||
36 | #if IS_ENABLED(CONFIG_PTP_1588_CLOCK) | ||
36 | void mlx5_init_clock(struct mlx5_core_dev *mdev); | 37 | void mlx5_init_clock(struct mlx5_core_dev *mdev); |
37 | void mlx5_cleanup_clock(struct mlx5_core_dev *mdev); | 38 | void mlx5_cleanup_clock(struct mlx5_core_dev *mdev); |
39 | void mlx5_pps_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe); | ||
40 | |||
41 | static inline int mlx5_clock_get_ptp_index(struct mlx5_core_dev *mdev) | ||
42 | { | ||
43 | return mdev->clock.ptp ? ptp_clock_index(mdev->clock.ptp) : -1; | ||
44 | } | ||
38 | 45 | ||
39 | static inline ktime_t mlx5_timecounter_cyc2time(struct mlx5_clock *clock, | 46 | static inline ktime_t mlx5_timecounter_cyc2time(struct mlx5_clock *clock, |
40 | u64 timestamp) | 47 | u64 timestamp) |
@@ -48,4 +55,21 @@ static inline ktime_t mlx5_timecounter_cyc2time(struct mlx5_clock *clock, | |||
48 | return ns_to_ktime(nsec); | 55 | return ns_to_ktime(nsec); |
49 | } | 56 | } |
50 | 57 | ||
58 | #else | ||
59 | static inline void mlx5_init_clock(struct mlx5_core_dev *mdev) {} | ||
60 | static inline void mlx5_cleanup_clock(struct mlx5_core_dev *mdev) {} | ||
61 | static inline void mlx5_pps_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe) {} | ||
62 | |||
63 | static inline int mlx5_clock_get_ptp_index(struct mlx5_core_dev *mdev) | ||
64 | { | ||
65 | return -1; | ||
66 | } | ||
67 | |||
68 | static inline ktime_t mlx5_timecounter_cyc2time(struct mlx5_clock *clock, | ||
69 | u64 timestamp) | ||
70 | { | ||
71 | return 0; | ||
72 | } | ||
73 | #endif | ||
74 | |||
51 | #endif | 75 | #endif |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h index 49955117ae36..b4134fa0bba3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | |||
@@ -99,7 +99,6 @@ void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event, | |||
99 | unsigned long param); | 99 | unsigned long param); |
100 | void mlx5_core_page_fault(struct mlx5_core_dev *dev, | 100 | void mlx5_core_page_fault(struct mlx5_core_dev *dev, |
101 | struct mlx5_pagefault *pfault); | 101 | struct mlx5_pagefault *pfault); |
102 | void mlx5_pps_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe); | ||
103 | void mlx5_port_module_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe); | 102 | void mlx5_port_module_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe); |
104 | void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force); | 103 | void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force); |
105 | void mlx5_disable_device(struct mlx5_core_dev *dev); | 104 | void mlx5_disable_device(struct mlx5_core_dev *dev); |