11// SPDX-License-Identifier: GPL-2.0-only
2- /*
3- * aQuantia Corporation Network Driver
4- * Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved
2+ /* Atlantic Network Driver
3+ *
4+ * Copyright (C) 2014-2019 aQuantia Corporation
5+ * Copyright (C) 2019-2020 Marvell International Ltd.
56 */
67
78/* File aq_main.c: Main file for aQuantia Linux driver. */
@@ -98,6 +99,7 @@ static int aq_ndev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
9899{
99100 struct aq_nic_s * aq_nic = netdev_priv (ndev );
100101
102+ #if IS_REACHABLE (CONFIG_PTP_1588_CLOCK )
101103 if (unlikely (aq_utils_obj_test (& aq_nic -> flags , AQ_NIC_PTP_DPATH_UP ))) {
102104 /* Hardware adds the Timestamp for PTPv2 802.AS1
103105 * and PTPv2 IPv4 UDP.
@@ -114,6 +116,7 @@ static int aq_ndev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
114116 unlikely (eth_hdr (skb )-> h_proto == htons (ETH_P_1588 )))
115117 return aq_ptp_xmit (aq_nic , skb );
116118 }
119+ #endif
117120
118121 skb_tx_timestamp (skb );
119122 return aq_nic_xmit (aq_nic , skb );
@@ -222,6 +225,7 @@ static void aq_ndev_set_multicast_settings(struct net_device *ndev)
222225 (void )aq_nic_set_multicast_list (aq_nic , ndev );
223226}
224227
228+ #if IS_REACHABLE (CONFIG_PTP_1588_CLOCK )
225229static int aq_ndev_config_hwtstamp (struct aq_nic_s * aq_nic ,
226230 struct hwtstamp_config * config )
227231{
@@ -256,26 +260,31 @@ static int aq_ndev_config_hwtstamp(struct aq_nic_s *aq_nic,
256260
257261 return aq_ptp_hwtstamp_config_set (aq_nic -> aq_ptp , config );
258262}
263+ #endif
259264
260265static int aq_ndev_hwtstamp_set (struct aq_nic_s * aq_nic , struct ifreq * ifr )
261266{
262267 struct hwtstamp_config config ;
268+ #if IS_REACHABLE (CONFIG_PTP_1588_CLOCK )
263269 int ret_val ;
270+ #endif
264271
265272 if (!aq_nic -> aq_ptp )
266273 return - EOPNOTSUPP ;
267274
268275 if (copy_from_user (& config , ifr -> ifr_data , sizeof (config )))
269276 return - EFAULT ;
270-
277+ #if IS_REACHABLE ( CONFIG_PTP_1588_CLOCK )
271278 ret_val = aq_ndev_config_hwtstamp (aq_nic , & config );
272279 if (ret_val )
273280 return ret_val ;
281+ #endif
274282
275283 return copy_to_user (ifr -> ifr_data , & config , sizeof (config )) ?
276284 - EFAULT : 0 ;
277285}
278286
287+ #if IS_REACHABLE (CONFIG_PTP_1588_CLOCK )
279288static int aq_ndev_hwtstamp_get (struct aq_nic_s * aq_nic , struct ifreq * ifr )
280289{
281290 struct hwtstamp_config config ;
@@ -287,6 +296,7 @@ static int aq_ndev_hwtstamp_get(struct aq_nic_s *aq_nic, struct ifreq *ifr)
287296 return copy_to_user (ifr -> ifr_data , & config , sizeof (config )) ?
288297 - EFAULT : 0 ;
289298}
299+ #endif
290300
291301static int aq_ndev_ioctl (struct net_device * netdev , struct ifreq * ifr , int cmd )
292302{
@@ -296,8 +306,10 @@ static int aq_ndev_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
296306 case SIOCSHWTSTAMP :
297307 return aq_ndev_hwtstamp_set (aq_nic , ifr );
298308
309+ #if IS_REACHABLE (CONFIG_PTP_1588_CLOCK )
299310 case SIOCGHWTSTAMP :
300311 return aq_ndev_hwtstamp_get (aq_nic , ifr );
312+ #endif
301313 }
302314
303315 return - EOPNOTSUPP ;
0 commit comments