aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2016-04-01 19:17:31 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2016-04-21 02:06:22 -0400
commit9de6a1a6b8ed889ecd3ae13bb0a2459485d90a24 (patch)
treea789be9b559d81760efabac67969aaa9d94837e7
parent1e4c32f3ede19bdb738aec2cc3cf69439d7b9310 (diff)
fm10k: drop 1588 support
The 1588 support within fm10k does not work correctly with the current version of the switch management software, and likely never worked correctly to begin with. Remove support for PTP/1588. Update copyright year for all these files while we're touching them. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/fm10k/Makefile3
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k.h34
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c30
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_main.c22
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_netdev.c22
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_pci.c110
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_pf.c101
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_pf.h17
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_ptp.c462
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_type.h17
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_vf.c57
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_vf.h12
12 files changed, 11 insertions, 876 deletions
diff --git a/drivers/net/ethernet/intel/fm10k/Makefile b/drivers/net/ethernet/intel/fm10k/Makefile
index b006ff66d028..2aeaa39d9a25 100644
--- a/drivers/net/ethernet/intel/fm10k/Makefile
+++ b/drivers/net/ethernet/intel/fm10k/Makefile
@@ -1,7 +1,7 @@
1################################################################################ 1################################################################################
2# 2#
3# Intel Ethernet Switch Host Interface Driver 3# Intel Ethernet Switch Host Interface Driver
4# Copyright(c) 2013 - 2015 Intel Corporation. 4# Copyright(c) 2013 - 2016 Intel Corporation.
5# 5#
6# This program is free software; you can redistribute it and/or modify it 6# This program is free software; you can redistribute it and/or modify it
7# under the terms and conditions of the GNU General Public License, 7# under the terms and conditions of the GNU General Public License,
@@ -30,7 +30,6 @@ obj-$(CONFIG_FM10K) += fm10k.o
30fm10k-y := fm10k_main.o \ 30fm10k-y := fm10k_main.o \
31 fm10k_common.o \ 31 fm10k_common.o \
32 fm10k_pci.o \ 32 fm10k_pci.o \
33 fm10k_ptp.o \
34 fm10k_netdev.o \ 33 fm10k_netdev.o \
35 fm10k_ethtool.o \ 34 fm10k_ethtool.o \
36 fm10k_pf.o \ 35 fm10k_pf.o \
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h
index 9c7fafef7cf6..c21fa8699fc4 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2015 Intel Corporation. 2 * Copyright(c) 2013 - 2016 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -27,9 +27,6 @@
27#include <linux/rtnetlink.h> 27#include <linux/rtnetlink.h>
28#include <linux/if_vlan.h> 28#include <linux/if_vlan.h>
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/net_tstamp.h>
31#include <linux/clocksource.h>
32#include <linux/ptp_clock_kernel.h>
33 30
34#include "fm10k_pf.h" 31#include "fm10k_pf.h"
35#include "fm10k_vf.h" 32#include "fm10k_vf.h"
@@ -342,22 +339,8 @@ struct fm10k_intfc {
342 339
343#ifdef CONFIG_DEBUG_FS 340#ifdef CONFIG_DEBUG_FS
344 struct dentry *dbg_intfc; 341 struct dentry *dbg_intfc;
345
346#endif /* CONFIG_DEBUG_FS */ 342#endif /* CONFIG_DEBUG_FS */
347 struct ptp_clock_info ptp_caps;
348 struct ptp_clock *ptp_clock;
349
350 struct sk_buff_head ts_tx_skb_queue;
351 u32 tx_hwtstamp_timeouts;
352 343
353 struct hwtstamp_config ts_config;
354 /* We are unable to actually adjust the clock beyond the frequency
355 * value. Once the clock is started there is no resetting it. As
356 * such we maintain a separate offset from the actual hardware clock
357 * to allow for offset adjustment.
358 */
359 s64 ptp_adjust;
360 rwlock_t systime_lock;
361#ifdef CONFIG_DCB 344#ifdef CONFIG_DCB
362 u8 pfc_en; 345 u8 pfc_en;
363#endif 346#endif
@@ -546,21 +529,6 @@ static inline void fm10k_dbg_init(void) {}
546static inline void fm10k_dbg_exit(void) {} 529static inline void fm10k_dbg_exit(void) {}
547#endif /* CONFIG_DEBUG_FS */ 530#endif /* CONFIG_DEBUG_FS */
548 531
549/* Time Stamping */
550void fm10k_systime_to_hwtstamp(struct fm10k_intfc *interface,
551 struct skb_shared_hwtstamps *hwtstamp,
552 u64 systime);
553void fm10k_ts_tx_enqueue(struct fm10k_intfc *interface, struct sk_buff *skb);
554void fm10k_ts_tx_hwtstamp(struct fm10k_intfc *interface, __le16 dglort,
555 u64 systime);
556void fm10k_ts_reset(struct fm10k_intfc *interface);
557void fm10k_ts_init(struct fm10k_intfc *interface);
558void fm10k_ts_tx_subtask(struct fm10k_intfc *interface);
559void fm10k_ptp_register(struct fm10k_intfc *interface);
560void fm10k_ptp_unregister(struct fm10k_intfc *interface);
561int fm10k_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
562int fm10k_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
563
564/* DCB */ 532/* DCB */
565#ifdef CONFIG_DCB 533#ifdef CONFIG_DCB
566void fm10k_dcbnl_set_ops(struct net_device *dev); 534void fm10k_dcbnl_set_ops(struct net_device *dev);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index 6ab9df52f301..ca276c0a4b8d 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2015 Intel Corporation. 2 * Copyright(c) 2013 - 2016 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -77,8 +77,6 @@ static const struct fm10k_stats fm10k_gstrings_global_stats[] = {
77 FM10K_STAT("mac_rules_avail", hw.swapi.mac.avail), 77 FM10K_STAT("mac_rules_avail", hw.swapi.mac.avail),
78 78
79 FM10K_STAT("tx_hang_count", tx_timeout_count), 79 FM10K_STAT("tx_hang_count", tx_timeout_count),
80
81 FM10K_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts),
82}; 80};
83 81
84static const struct fm10k_stats fm10k_gstrings_pf_stats[] = { 82static const struct fm10k_stats fm10k_gstrings_pf_stats[] = {
@@ -1140,31 +1138,6 @@ static int fm10k_set_channels(struct net_device *dev,
1140 return fm10k_setup_tc(dev, netdev_get_num_tc(dev)); 1138 return fm10k_setup_tc(dev, netdev_get_num_tc(dev));
1141} 1139}
1142 1140
1143static int fm10k_get_ts_info(struct net_device *dev,
1144 struct ethtool_ts_info *info)
1145{
1146 struct fm10k_intfc *interface = netdev_priv(dev);
1147
1148 info->so_timestamping =
1149 SOF_TIMESTAMPING_TX_SOFTWARE |
1150 SOF_TIMESTAMPING_RX_SOFTWARE |
1151 SOF_TIMESTAMPING_SOFTWARE |
1152 SOF_TIMESTAMPING_TX_HARDWARE |
1153 SOF_TIMESTAMPING_RX_HARDWARE |
1154 SOF_TIMESTAMPING_RAW_HARDWARE;
1155
1156 if (interface->ptp_clock)
1157 info->phc_index = ptp_clock_index(interface->ptp_clock);
1158 else
1159 info->phc_index = -1;
1160
1161 info->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON);
1162
1163 info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) | BIT(HWTSTAMP_FILTER_ALL);
1164
1165 return 0;
1166}
1167
1168static const struct ethtool_ops fm10k_ethtool_ops = { 1141static const struct ethtool_ops fm10k_ethtool_ops = {
1169 .get_strings = fm10k_get_strings, 1142 .get_strings = fm10k_get_strings,
1170 .get_sset_count = fm10k_get_sset_count, 1143 .get_sset_count = fm10k_get_sset_count,
@@ -1192,7 +1165,6 @@ static const struct ethtool_ops fm10k_ethtool_ops = {
1192 .set_rxfh = fm10k_set_rssh, 1165 .set_rxfh = fm10k_set_rssh,
1193 .get_channels = fm10k_get_channels, 1166 .get_channels = fm10k_get_channels,
1194 .set_channels = fm10k_set_channels, 1167 .set_channels = fm10k_set_channels,
1195 .get_ts_info = fm10k_get_ts_info,
1196}; 1168};
1197 1169
1198void fm10k_set_ethtool_ops(struct net_device *dev) 1170void fm10k_set_ethtool_ops(struct net_device *dev)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index ca5b9d7eeb22..58092e523bbe 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2016 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -424,19 +424,6 @@ static inline void fm10k_rx_hash(struct fm10k_ring *ring,
424 PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); 424 PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
425} 425}
426 426
427static void fm10k_rx_hwtstamp(struct fm10k_ring *rx_ring,
428 union fm10k_rx_desc *rx_desc,
429 struct sk_buff *skb)
430{
431 struct fm10k_intfc *interface = rx_ring->q_vector->interface;
432
433 FM10K_CB(skb)->tstamp = rx_desc->q.timestamp;
434
435 if (unlikely(interface->flags & FM10K_FLAG_RX_TS_ENABLED))
436 fm10k_systime_to_hwtstamp(interface, skb_hwtstamps(skb),
437 le64_to_cpu(rx_desc->q.timestamp));
438}
439
440static void fm10k_type_trans(struct fm10k_ring *rx_ring, 427static void fm10k_type_trans(struct fm10k_ring *rx_ring,
441 union fm10k_rx_desc __maybe_unused *rx_desc, 428 union fm10k_rx_desc __maybe_unused *rx_desc,
442 struct sk_buff *skb) 429 struct sk_buff *skb)
@@ -486,8 +473,6 @@ static unsigned int fm10k_process_skb_fields(struct fm10k_ring *rx_ring,
486 473
487 fm10k_rx_checksum(rx_ring, rx_desc, skb); 474 fm10k_rx_checksum(rx_ring, rx_desc, skb);
488 475
489 fm10k_rx_hwtstamp(rx_ring, rx_desc, skb);
490
491 FM10K_CB(skb)->fi.w.vlan = rx_desc->w.vlan; 476 FM10K_CB(skb)->fi.w.vlan = rx_desc->w.vlan;
492 477
493 skb_record_rx_queue(skb, rx_ring->queue_index); 478 skb_record_rx_queue(skb, rx_ring->queue_index);
@@ -912,11 +897,6 @@ static u8 fm10k_tx_desc_flags(struct sk_buff *skb, u32 tx_flags)
912 /* set type for advanced descriptor with frame checksum insertion */ 897 /* set type for advanced descriptor with frame checksum insertion */
913 u32 desc_flags = 0; 898 u32 desc_flags = 0;
914 899
915 /* set timestamping bits */
916 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
917 likely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS))
918 desc_flags |= FM10K_TXD_FLAG_TIME;
919
920 /* set checksum offload bits */ 900 /* set checksum offload bits */
921 desc_flags |= FM10K_SET_FLAG(tx_flags, FM10K_TX_FLAGS_CSUM, 901 desc_flags |= FM10K_SET_FLAG(tx_flags, FM10K_TX_FLAGS_CSUM,
922 FM10K_TXD_FLAG_CSUM); 902 FM10K_TXD_FLAG_CSUM);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index 1d0f0583222c..32778dda8c12 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2015 Intel Corporation. 2 * Copyright(c) 2013 - 2016 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -243,9 +243,6 @@ void fm10k_clean_all_tx_rings(struct fm10k_intfc *interface)
243 243
244 for (i = 0; i < interface->num_tx_queues; i++) 244 for (i = 0; i < interface->num_tx_queues; i++)
245 fm10k_clean_tx_ring(interface->tx_ring[i]); 245 fm10k_clean_tx_ring(interface->tx_ring[i]);
246
247 /* remove any stale timestamp buffers and free them */
248 skb_queue_purge(&interface->ts_tx_skb_queue);
249} 246}
250 247
251/** 248/**
@@ -660,10 +657,6 @@ static netdev_tx_t fm10k_xmit_frame(struct sk_buff *skb, struct net_device *dev)
660 __skb_put(skb, pad_len); 657 __skb_put(skb, pad_len);
661 } 658 }
662 659
663 /* prepare packet for hardware time stamping */
664 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))
665 fm10k_ts_tx_enqueue(interface, skb);
666
667 if (r_idx >= interface->num_tx_queues) 660 if (r_idx >= interface->num_tx_queues)
668 r_idx %= interface->num_tx_queues; 661 r_idx %= interface->num_tx_queues;
669 662
@@ -1213,18 +1206,6 @@ static int __fm10k_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
1213 return fm10k_setup_tc(dev, tc->tc); 1206 return fm10k_setup_tc(dev, tc->tc);
1214} 1207}
1215 1208
1216static int fm10k_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
1217{
1218 switch (cmd) {
1219 case SIOCGHWTSTAMP:
1220 return fm10k_get_ts_config(netdev, ifr);
1221 case SIOCSHWTSTAMP:
1222 return fm10k_set_ts_config(netdev, ifr);
1223 default:
1224 return -EOPNOTSUPP;
1225 }
1226}
1227
1228static void fm10k_assign_l2_accel(struct fm10k_intfc *interface, 1209static void fm10k_assign_l2_accel(struct fm10k_intfc *interface,
1229 struct fm10k_l2_accel *l2_accel) 1210 struct fm10k_l2_accel *l2_accel)
1230{ 1211{
@@ -1402,7 +1383,6 @@ static const struct net_device_ops fm10k_netdev_ops = {
1402 .ndo_get_vf_config = fm10k_ndo_get_vf_config, 1383 .ndo_get_vf_config = fm10k_ndo_get_vf_config,
1403 .ndo_add_vxlan_port = fm10k_add_vxlan_port, 1384 .ndo_add_vxlan_port = fm10k_add_vxlan_port,
1404 .ndo_del_vxlan_port = fm10k_del_vxlan_port, 1385 .ndo_del_vxlan_port = fm10k_del_vxlan_port,
1405 .ndo_do_ioctl = fm10k_ioctl,
1406 .ndo_dfwd_add_station = fm10k_dfwd_add_station, 1386 .ndo_dfwd_add_station = fm10k_dfwd_add_station,
1407 .ndo_dfwd_del_station = fm10k_dfwd_del_station, 1387 .ndo_dfwd_del_station = fm10k_dfwd_del_station,
1408#ifdef CONFIG_NET_POLL_CONTROLLER 1388#ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index a604513d0451..29e9402c4352 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2015 Intel Corporation. 2 * Copyright(c) 2013 - 2016 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -209,9 +209,6 @@ static void fm10k_reinit(struct fm10k_intfc *interface)
209 netdev->features |= NETIF_F_HW_VLAN_CTAG_RX; 209 netdev->features |= NETIF_F_HW_VLAN_CTAG_RX;
210 } 210 }
211 211
212 /* reset clock */
213 fm10k_ts_reset(interface);
214
215 err = netif_running(netdev) ? fm10k_open(netdev) : 0; 212 err = netif_running(netdev) ? fm10k_open(netdev) : 0;
216 if (err) 213 if (err)
217 goto err_open; 214 goto err_open;
@@ -559,7 +556,6 @@ static void fm10k_service_task(struct work_struct *work)
559 /* tasks only run when interface is up */ 556 /* tasks only run when interface is up */
560 fm10k_watchdog_subtask(interface); 557 fm10k_watchdog_subtask(interface);
561 fm10k_check_hang_subtask(interface); 558 fm10k_check_hang_subtask(interface);
562 fm10k_ts_tx_subtask(interface);
563 559
564 /* release lock on service events to allow scheduling next event */ 560 /* release lock on service events to allow scheduling next event */
565 fm10k_service_event_complete(interface); 561 fm10k_service_event_complete(interface);
@@ -1204,25 +1200,6 @@ static s32 fm10k_mbx_mac_addr(struct fm10k_hw *hw, u32 **results,
1204 return 0; 1200 return 0;
1205} 1201}
1206 1202
1207static s32 fm10k_1588_msg_vf(struct fm10k_hw *hw, u32 **results,
1208 struct fm10k_mbx_info __always_unused *mbx)
1209{
1210 struct fm10k_intfc *interface;
1211 u64 timestamp;
1212 s32 err;
1213
1214 err = fm10k_tlv_attr_get_u64(results[FM10K_1588_MSG_TIMESTAMP],
1215 &timestamp);
1216 if (err)
1217 return err;
1218
1219 interface = container_of(hw, struct fm10k_intfc, hw);
1220
1221 fm10k_ts_tx_hwtstamp(interface, 0, timestamp);
1222
1223 return 0;
1224}
1225
1226/* generic error handler for mailbox issues */ 1203/* generic error handler for mailbox issues */
1227static s32 fm10k_mbx_error(struct fm10k_hw *hw, u32 **results, 1204static s32 fm10k_mbx_error(struct fm10k_hw *hw, u32 **results,
1228 struct fm10k_mbx_info __always_unused *mbx) 1205 struct fm10k_mbx_info __always_unused *mbx)
@@ -1243,7 +1220,6 @@ static const struct fm10k_msg_data vf_mbx_data[] = {
1243 FM10K_TLV_MSG_TEST_HANDLER(fm10k_tlv_msg_test), 1220 FM10K_TLV_MSG_TEST_HANDLER(fm10k_tlv_msg_test),
1244 FM10K_VF_MSG_MAC_VLAN_HANDLER(fm10k_mbx_mac_addr), 1221 FM10K_VF_MSG_MAC_VLAN_HANDLER(fm10k_mbx_mac_addr),
1245 FM10K_VF_MSG_LPORT_STATE_HANDLER(fm10k_msg_lport_state_vf), 1222 FM10K_VF_MSG_LPORT_STATE_HANDLER(fm10k_msg_lport_state_vf),
1246 FM10K_VF_MSG_1588_HANDLER(fm10k_1588_msg_vf),
1247 FM10K_TLV_MSG_ERROR_HANDLER(fm10k_mbx_error), 1223 FM10K_TLV_MSG_ERROR_HANDLER(fm10k_mbx_error),
1248}; 1224};
1249 1225
@@ -1341,68 +1317,6 @@ static s32 fm10k_update_pvid(struct fm10k_hw *hw, u32 **results,
1341 return 0; 1317 return 0;
1342} 1318}
1343 1319
1344static s32 fm10k_1588_msg_pf(struct fm10k_hw *hw, u32 **results,
1345 struct fm10k_mbx_info __always_unused *mbx)
1346{
1347 struct fm10k_swapi_1588_timestamp timestamp;
1348 struct fm10k_iov_data *iov_data;
1349 struct fm10k_intfc *interface;
1350 u16 sglort, vf_idx;
1351 s32 err;
1352
1353 err = fm10k_tlv_attr_get_le_struct(
1354 results[FM10K_PF_ATTR_ID_1588_TIMESTAMP],
1355 &timestamp, sizeof(timestamp));
1356 if (err)
1357 return err;
1358
1359 interface = container_of(hw, struct fm10k_intfc, hw);
1360
1361 if (timestamp.dglort) {
1362 fm10k_ts_tx_hwtstamp(interface, timestamp.dglort,
1363 le64_to_cpu(timestamp.egress));
1364 return 0;
1365 }
1366
1367 /* either dglort or sglort must be set */
1368 if (!timestamp.sglort)
1369 return FM10K_ERR_PARAM;
1370
1371 /* verify GLORT is at least one of the ones we own */
1372 sglort = le16_to_cpu(timestamp.sglort);
1373 if (!fm10k_glort_valid_pf(hw, sglort))
1374 return FM10K_ERR_PARAM;
1375
1376 if (sglort == interface->glort) {
1377 fm10k_ts_tx_hwtstamp(interface, 0,
1378 le64_to_cpu(timestamp.ingress));
1379 return 0;
1380 }
1381
1382 /* if there is no iov_data then there is no mailbox to process */
1383 if (!ACCESS_ONCE(interface->iov_data))
1384 return FM10K_ERR_PARAM;
1385
1386 rcu_read_lock();
1387
1388 /* notify VF if this timestamp belongs to it */
1389 iov_data = interface->iov_data;
1390 vf_idx = (hw->mac.dglort_map & FM10K_DGLORTMAP_NONE) - sglort;
1391
1392 if (!iov_data || vf_idx >= iov_data->num_vfs) {
1393 err = FM10K_ERR_PARAM;
1394 goto err_unlock;
1395 }
1396
1397 err = hw->iov.ops.report_timestamp(hw, &iov_data->vf_info[vf_idx],
1398 le64_to_cpu(timestamp.ingress));
1399
1400err_unlock:
1401 rcu_read_unlock();
1402
1403 return err;
1404}
1405
1406static const struct fm10k_msg_data pf_mbx_data[] = { 1320static const struct fm10k_msg_data pf_mbx_data[] = {
1407 FM10K_PF_MSG_ERR_HANDLER(XCAST_MODES, fm10k_msg_err_pf), 1321 FM10K_PF_MSG_ERR_HANDLER(XCAST_MODES, fm10k_msg_err_pf),
1408 FM10K_PF_MSG_ERR_HANDLER(UPDATE_MAC_FWD_RULE, fm10k_msg_err_pf), 1322 FM10K_PF_MSG_ERR_HANDLER(UPDATE_MAC_FWD_RULE, fm10k_msg_err_pf),
@@ -1410,7 +1324,6 @@ static const struct fm10k_msg_data pf_mbx_data[] = {
1410 FM10K_PF_MSG_ERR_HANDLER(LPORT_CREATE, fm10k_msg_err_pf), 1324 FM10K_PF_MSG_ERR_HANDLER(LPORT_CREATE, fm10k_msg_err_pf),
1411 FM10K_PF_MSG_ERR_HANDLER(LPORT_DELETE, fm10k_msg_err_pf), 1325 FM10K_PF_MSG_ERR_HANDLER(LPORT_DELETE, fm10k_msg_err_pf),
1412 FM10K_PF_MSG_UPDATE_PVID_HANDLER(fm10k_update_pvid), 1326 FM10K_PF_MSG_UPDATE_PVID_HANDLER(fm10k_update_pvid),
1413 FM10K_PF_MSG_1588_TIMESTAMP_HANDLER(fm10k_1588_msg_pf),
1414 FM10K_TLV_MSG_ERROR_HANDLER(fm10k_mbx_error), 1327 FM10K_TLV_MSG_ERROR_HANDLER(fm10k_mbx_error),
1415}; 1328};
1416 1329
@@ -1789,18 +1702,9 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
1789 return -EIO; 1702 return -EIO;
1790 } 1703 }
1791 1704
1792 /* assign BAR 4 resources for use with PTP */
1793 if (fm10k_read_reg(hw, FM10K_CTRL) & FM10K_CTRL_BAR4_ALLOWED)
1794 interface->sw_addr = ioremap(pci_resource_start(pdev, 4),
1795 pci_resource_len(pdev, 4));
1796 hw->sw_addr = interface->sw_addr;
1797
1798 /* initialize DCBNL interface */ 1705 /* initialize DCBNL interface */
1799 fm10k_dcbnl_set_ops(netdev); 1706 fm10k_dcbnl_set_ops(netdev);
1800 1707
1801 /* Intitialize timestamp data */
1802 fm10k_ts_init(interface);
1803
1804 /* set default ring sizes */ 1708 /* set default ring sizes */
1805 interface->tx_ring_count = FM10K_DEFAULT_TXD; 1709 interface->tx_ring_count = FM10K_DEFAULT_TXD;
1806 interface->rx_ring_count = FM10K_DEFAULT_RXD; 1710 interface->rx_ring_count = FM10K_DEFAULT_RXD;
@@ -2018,9 +1922,6 @@ static int fm10k_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2018 /* kick off service timer now, even when interface is down */ 1922 /* kick off service timer now, even when interface is down */
2019 mod_timer(&interface->service_timer, (HZ * 2) + jiffies); 1923 mod_timer(&interface->service_timer, (HZ * 2) + jiffies);
2020 1924
2021 /* Register PTP interface */
2022 fm10k_ptp_register(interface);
2023
2024 /* print warning for non-optimal configurations */ 1925 /* print warning for non-optimal configurations */
2025 fm10k_slot_warn(interface); 1926 fm10k_slot_warn(interface);
2026 1927
@@ -2077,9 +1978,6 @@ static void fm10k_remove(struct pci_dev *pdev)
2077 if (netdev->reg_state == NETREG_REGISTERED) 1978 if (netdev->reg_state == NETREG_REGISTERED)
2078 unregister_netdev(netdev); 1979 unregister_netdev(netdev);
2079 1980
2080 /* cleanup timestamp handling */
2081 fm10k_ptp_unregister(interface);
2082
2083 /* release VFs */ 1981 /* release VFs */
2084 fm10k_iov_disable(pdev); 1982 fm10k_iov_disable(pdev);
2085 1983
@@ -2152,9 +2050,6 @@ static int fm10k_resume(struct pci_dev *pdev)
2152 /* reset statistics starting values */ 2050 /* reset statistics starting values */
2153 hw->mac.ops.rebind_hw_stats(hw, &interface->stats); 2051 hw->mac.ops.rebind_hw_stats(hw, &interface->stats);
2154 2052
2155 /* reset clock */
2156 fm10k_ts_reset(interface);
2157
2158 rtnl_lock(); 2053 rtnl_lock();
2159 2054
2160 err = fm10k_init_queueing_scheme(interface); 2055 err = fm10k_init_queueing_scheme(interface);
@@ -2365,9 +2260,6 @@ static void fm10k_io_resume(struct pci_dev *pdev)
2365 /* reassociate interrupts */ 2260 /* reassociate interrupts */
2366 fm10k_mbx_request_irq(interface); 2261 fm10k_mbx_request_irq(interface);
2367 2262
2368 /* reset clock */
2369 fm10k_ts_reset(interface);
2370
2371 if (netif_running(netdev)) 2263 if (netif_running(netdev))
2372 err = fm10k_open(netdev); 2264 err = fm10k_open(netdev);
2373 2265
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
index ecc99f9d2cce..c8e8ce5a8327 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2015 Intel Corporation. 2 * Copyright(c) 2013 - 2016 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -1140,19 +1140,6 @@ static void fm10k_iov_update_stats_pf(struct fm10k_hw *hw,
1140 fm10k_update_hw_stats_q(hw, q, idx, qpp); 1140 fm10k_update_hw_stats_q(hw, q, idx, qpp);
1141} 1141}
1142 1142
1143static s32 fm10k_iov_report_timestamp_pf(struct fm10k_hw *hw,
1144 struct fm10k_vf_info *vf_info,
1145 u64 timestamp)
1146{
1147 u32 msg[4];
1148
1149 /* generate port state response to notify VF it is not ready */
1150 fm10k_tlv_msg_init(msg, FM10K_VF_MSG_ID_1588);
1151 fm10k_tlv_attr_put_u64(msg, FM10K_1588_MSG_TIMESTAMP, timestamp);
1152
1153 return vf_info->mbx.ops.enqueue_tx(hw, &vf_info->mbx, msg);
1154}
1155
1156/** 1143/**
1157 * fm10k_iov_msg_msix_pf - Message handler for MSI-X request from VF 1144 * fm10k_iov_msg_msix_pf - Message handler for MSI-X request from VF
1158 * @hw: Pointer to hardware structure 1145 * @hw: Pointer to hardware structure
@@ -1773,89 +1760,6 @@ s32 fm10k_msg_err_pf(struct fm10k_hw *hw, u32 **results,
1773 return 0; 1760 return 0;
1774} 1761}
1775 1762
1776const struct fm10k_tlv_attr fm10k_1588_timestamp_msg_attr[] = {
1777 FM10K_TLV_ATTR_LE_STRUCT(FM10K_PF_ATTR_ID_1588_TIMESTAMP,
1778 sizeof(struct fm10k_swapi_1588_timestamp)),
1779 FM10K_TLV_ATTR_LAST
1780};
1781
1782/* currently there is no shared 1588 timestamp handler */
1783
1784/**
1785 * fm10k_adjust_systime_pf - Adjust systime frequency
1786 * @hw: pointer to hardware structure
1787 * @ppb: adjustment rate in parts per billion
1788 *
1789 * This function will adjust the SYSTIME_CFG register contained in BAR 4
1790 * if this function is supported for BAR 4 access. The adjustment amount
1791 * is based on the parts per billion value provided and adjusted to a
1792 * value based on parts per 2^48 clock cycles.
1793 *
1794 * If adjustment is not supported or the requested value is too large
1795 * we will return an error.
1796 **/
1797static s32 fm10k_adjust_systime_pf(struct fm10k_hw *hw, s32 ppb)
1798{
1799 u64 systime_adjust;
1800
1801 /* if sw_addr is not set we don't have switch register access */
1802 if (!hw->sw_addr)
1803 return ppb ? FM10K_ERR_PARAM : 0;
1804
1805 /* we must convert the value from parts per billion to parts per
1806 * 2^48 cycles. In addition I have opted to only use the 30 most
1807 * significant bits of the adjustment value as the 8 least
1808 * significant bits are located in another register and represent
1809 * a value significantly less than a part per billion, the result
1810 * of dropping the 8 least significant bits is that the adjustment
1811 * value is effectively multiplied by 2^8 when we write it.
1812 *
1813 * As a result of all this the math for this breaks down as follows:
1814 * ppb / 10^9 == adjust * 2^8 / 2^48
1815 * If we solve this for adjust, and simplify it comes out as:
1816 * ppb * 2^31 / 5^9 == adjust
1817 */
1818 systime_adjust = (ppb < 0) ? -ppb : ppb;
1819 systime_adjust <<= 31;
1820 do_div(systime_adjust, 1953125);
1821
1822 /* verify the requested adjustment value is in range */
1823 if (systime_adjust > FM10K_SW_SYSTIME_ADJUST_MASK)
1824 return FM10K_ERR_PARAM;
1825
1826 if (ppb > 0)
1827 systime_adjust |= FM10K_SW_SYSTIME_ADJUST_DIR_POSITIVE;
1828
1829 fm10k_write_sw_reg(hw, FM10K_SW_SYSTIME_ADJUST, (u32)systime_adjust);
1830
1831 return 0;
1832}
1833
1834/**
1835 * fm10k_read_systime_pf - Reads value of systime registers
1836 * @hw: pointer to the hardware structure
1837 *
1838 * Function reads the content of 2 registers, combined to represent a 64 bit
1839 * value measured in nanosecods. In order to guarantee the value is accurate
1840 * we check the 32 most significant bits both before and after reading the
1841 * 32 least significant bits to verify they didn't change as we were reading
1842 * the registers.
1843 **/
1844static u64 fm10k_read_systime_pf(struct fm10k_hw *hw)
1845{
1846 u32 systime_l, systime_h, systime_tmp;
1847
1848 systime_h = fm10k_read_reg(hw, FM10K_SYSTIME + 1);
1849
1850 do {
1851 systime_tmp = systime_h;
1852 systime_l = fm10k_read_reg(hw, FM10K_SYSTIME);
1853 systime_h = fm10k_read_reg(hw, FM10K_SYSTIME + 1);
1854 } while (systime_tmp != systime_h);
1855
1856 return ((u64)systime_h << 32) | systime_l;
1857}
1858
1859static const struct fm10k_msg_data fm10k_msg_data_pf[] = { 1763static const struct fm10k_msg_data fm10k_msg_data_pf[] = {
1860 FM10K_PF_MSG_ERR_HANDLER(XCAST_MODES, fm10k_msg_err_pf), 1764 FM10K_PF_MSG_ERR_HANDLER(XCAST_MODES, fm10k_msg_err_pf),
1861 FM10K_PF_MSG_ERR_HANDLER(UPDATE_MAC_FWD_RULE, fm10k_msg_err_pf), 1765 FM10K_PF_MSG_ERR_HANDLER(UPDATE_MAC_FWD_RULE, fm10k_msg_err_pf),
@@ -1885,8 +1789,6 @@ static const struct fm10k_mac_ops mac_ops_pf = {
1885 .set_dma_mask = fm10k_set_dma_mask_pf, 1789 .set_dma_mask = fm10k_set_dma_mask_pf,
1886 .get_fault = fm10k_get_fault_pf, 1790 .get_fault = fm10k_get_fault_pf,
1887 .get_host_state = fm10k_get_host_state_pf, 1791 .get_host_state = fm10k_get_host_state_pf,
1888 .adjust_systime = fm10k_adjust_systime_pf,
1889 .read_systime = fm10k_read_systime_pf,
1890}; 1792};
1891 1793
1892static const struct fm10k_iov_ops iov_ops_pf = { 1794static const struct fm10k_iov_ops iov_ops_pf = {
@@ -1898,7 +1800,6 @@ static const struct fm10k_iov_ops iov_ops_pf = {
1898 .set_lport = fm10k_iov_set_lport_pf, 1800 .set_lport = fm10k_iov_set_lport_pf,
1899 .reset_lport = fm10k_iov_reset_lport_pf, 1801 .reset_lport = fm10k_iov_reset_lport_pf,
1900 .update_stats = fm10k_iov_update_stats_pf, 1802 .update_stats = fm10k_iov_update_stats_pf,
1901 .report_timestamp = fm10k_iov_report_timestamp_pf,
1902}; 1803};
1903 1804
1904static s32 fm10k_get_invariants_pf(struct fm10k_hw *hw) 1805static s32 fm10k_get_invariants_pf(struct fm10k_hw *hw)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.h b/drivers/net/ethernet/intel/fm10k/fm10k_pf.h
index b2d96b45ca3c..b78210d06213 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.h
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2015 Intel Corporation. 2 * Copyright(c) 2013 - 2016 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -42,8 +42,6 @@ enum fm10k_pf_tlv_msg_id_v1 {
42 FM10K_PF_MSG_ID_UPDATE_FLOW = 0x503, 42 FM10K_PF_MSG_ID_UPDATE_FLOW = 0x503,
43 FM10K_PF_MSG_ID_DELETE_FLOW = 0x504, 43 FM10K_PF_MSG_ID_DELETE_FLOW = 0x504,
44 FM10K_PF_MSG_ID_SET_FLOW_STATE = 0x505, 44 FM10K_PF_MSG_ID_SET_FLOW_STATE = 0x505,
45 FM10K_PF_MSG_ID_GET_1588_INFO = 0x506,
46 FM10K_PF_MSG_ID_1588_TIMESTAMP = 0x701,
47}; 45};
48 46
49enum fm10k_pf_tlv_attr_id_v1 { 47enum fm10k_pf_tlv_attr_id_v1 {
@@ -61,7 +59,6 @@ enum fm10k_pf_tlv_attr_id_v1 {
61 FM10K_PF_ATTR_ID_DELETE_FLOW = 0x0B, 59 FM10K_PF_ATTR_ID_DELETE_FLOW = 0x0B,
62 FM10K_PF_ATTR_ID_PORT = 0x0C, 60 FM10K_PF_ATTR_ID_PORT = 0x0C,
63 FM10K_PF_ATTR_ID_UPDATE_PVID = 0x0D, 61 FM10K_PF_ATTR_ID_UPDATE_PVID = 0x0D,
64 FM10K_PF_ATTR_ID_1588_TIMESTAMP = 0x10,
65}; 62};
66 63
67#define FM10K_MSG_LPORT_MAP_GLORT_SHIFT 0 64#define FM10K_MSG_LPORT_MAP_GLORT_SHIFT 0
@@ -100,13 +97,6 @@ struct fm10k_swapi_error {
100 struct fm10k_global_table_data ffu; 97 struct fm10k_global_table_data ffu;
101} __aligned(4) __packed; 98} __aligned(4) __packed;
102 99
103struct fm10k_swapi_1588_timestamp {
104 __le64 egress;
105 __le64 ingress;
106 __le16 dglort;
107 __le16 sglort;
108} __aligned(4) __packed;
109
110s32 fm10k_msg_lport_map_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *); 100s32 fm10k_msg_lport_map_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
111extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[]; 101extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
112#define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \ 102#define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
@@ -122,11 +112,6 @@ extern const struct fm10k_tlv_attr fm10k_err_msg_attr[];
122#define FM10K_PF_MSG_ERR_HANDLER(msg, func) \ 112#define FM10K_PF_MSG_ERR_HANDLER(msg, func) \
123 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_##msg, fm10k_err_msg_attr, func) 113 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_##msg, fm10k_err_msg_attr, func)
124 114
125extern const struct fm10k_tlv_attr fm10k_1588_timestamp_msg_attr[];
126#define FM10K_PF_MSG_1588_TIMESTAMP_HANDLER(func) \
127 FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_1588_TIMESTAMP, \
128 fm10k_1588_timestamp_msg_attr, func)
129
130s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *); 115s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
131s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **, 116s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
132 struct fm10k_mbx_info *); 117 struct fm10k_mbx_info *);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ptp.c b/drivers/net/ethernet/intel/fm10k/fm10k_ptp.c
deleted file mode 100644
index 1c1ccade6538..000000000000
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ptp.c
+++ /dev/null
@@ -1,462 +0,0 @@
1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2015 Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
15 *
16 * Contact Information:
17 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
18 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
19 */
20
21#include <linux/ptp_classify.h>
22#include <linux/ptp_clock_kernel.h>
23
24#include "fm10k.h"
25
26#define FM10K_TS_TX_TIMEOUT (HZ * 15)
27
28void fm10k_systime_to_hwtstamp(struct fm10k_intfc *interface,
29 struct skb_shared_hwtstamps *hwtstamp,
30 u64 systime)
31{
32 unsigned long flags;
33
34 read_lock_irqsave(&interface->systime_lock, flags);
35 systime += interface->ptp_adjust;
36 read_unlock_irqrestore(&interface->systime_lock, flags);
37
38 hwtstamp->hwtstamp = ns_to_ktime(systime);
39}
40
41static struct sk_buff *fm10k_ts_tx_skb(struct fm10k_intfc *interface,
42 __le16 dglort)
43{
44 struct sk_buff_head *list = &interface->ts_tx_skb_queue;
45 struct sk_buff *skb;
46
47 skb_queue_walk(list, skb) {
48 if (FM10K_CB(skb)->fi.w.dglort == dglort)
49 return skb;
50 }
51
52 return NULL;
53}
54
55void fm10k_ts_tx_enqueue(struct fm10k_intfc *interface, struct sk_buff *skb)
56{
57 struct sk_buff_head *list = &interface->ts_tx_skb_queue;
58 struct sk_buff *clone;
59 unsigned long flags;
60
61 /* create clone for us to return on the Tx path */
62 clone = skb_clone_sk(skb);
63 if (!clone)
64 return;
65
66 FM10K_CB(clone)->ts_tx_timeout = jiffies + FM10K_TS_TX_TIMEOUT;
67 spin_lock_irqsave(&list->lock, flags);
68
69 /* attempt to locate any buffers with the same dglort,
70 * if none are present then insert skb in tail of list
71 */
72 skb = fm10k_ts_tx_skb(interface, FM10K_CB(clone)->fi.w.dglort);
73 if (!skb) {
74 skb_shinfo(clone)->tx_flags |= SKBTX_IN_PROGRESS;
75 __skb_queue_tail(list, clone);
76 }
77
78 spin_unlock_irqrestore(&list->lock, flags);
79
80 /* if list is already has one then we just free the clone */
81 if (skb)
82 dev_kfree_skb(clone);
83}
84
85void fm10k_ts_tx_hwtstamp(struct fm10k_intfc *interface, __le16 dglort,
86 u64 systime)
87{
88 struct skb_shared_hwtstamps shhwtstamps;
89 struct sk_buff_head *list = &interface->ts_tx_skb_queue;
90 struct sk_buff *skb;
91 unsigned long flags;
92
93 spin_lock_irqsave(&list->lock, flags);
94
95 /* attempt to locate and pull the sk_buff out of the list */
96 skb = fm10k_ts_tx_skb(interface, dglort);
97 if (skb)
98 __skb_unlink(skb, list);
99
100 spin_unlock_irqrestore(&list->lock, flags);
101
102 /* if not found do nothing */
103 if (!skb)
104 return;
105
106 /* timestamp the sk_buff and free out copy */
107 fm10k_systime_to_hwtstamp(interface, &shhwtstamps, systime);
108 skb_tstamp_tx(skb, &shhwtstamps);
109 dev_kfree_skb_any(skb);
110}
111
112void fm10k_ts_tx_subtask(struct fm10k_intfc *interface)
113{
114 struct sk_buff_head *list = &interface->ts_tx_skb_queue;
115 struct sk_buff *skb, *tmp;
116 unsigned long flags;
117
118 /* If we're down or resetting, just bail */
119 if (test_bit(__FM10K_DOWN, &interface->state) ||
120 test_bit(__FM10K_RESETTING, &interface->state))
121 return;
122
123 spin_lock_irqsave(&list->lock, flags);
124
125 /* walk though the list and flush any expired timestamp packets */
126 skb_queue_walk_safe(list, skb, tmp) {
127 if (!time_is_after_jiffies(FM10K_CB(skb)->ts_tx_timeout))
128 continue;
129 __skb_unlink(skb, list);
130 kfree_skb(skb);
131 interface->tx_hwtstamp_timeouts++;
132 }
133
134 spin_unlock_irqrestore(&list->lock, flags);
135}
136
137static u64 fm10k_systime_read(struct fm10k_intfc *interface)
138{
139 struct fm10k_hw *hw = &interface->hw;
140
141 return hw->mac.ops.read_systime(hw);
142}
143
144void fm10k_ts_reset(struct fm10k_intfc *interface)
145{
146 s64 ns = ktime_to_ns(ktime_get_real());
147 unsigned long flags;
148
149 /* reinitialize the clock */
150 write_lock_irqsave(&interface->systime_lock, flags);
151 interface->ptp_adjust = fm10k_systime_read(interface) - ns;
152 write_unlock_irqrestore(&interface->systime_lock, flags);
153}
154
155void fm10k_ts_init(struct fm10k_intfc *interface)
156{
157 /* Initialize lock protecting systime access */
158 rwlock_init(&interface->systime_lock);
159
160 /* Initialize skb queue for pending timestamp requests */
161 skb_queue_head_init(&interface->ts_tx_skb_queue);
162
163 /* reset the clock to current kernel time */
164 fm10k_ts_reset(interface);
165}
166
167/**
168 * fm10k_get_ts_config - get current hardware timestamping configuration
169 * @netdev: network interface device structure
170 * @ifreq: ioctl data
171 *
172 * This function returns the current timestamping settings. Rather than
173 * attempt to deconstruct registers to fill in the values, simply keep a copy
174 * of the old settings around, and return a copy when requested.
175 */
176int fm10k_get_ts_config(struct net_device *netdev, struct ifreq *ifr)
177{
178 struct fm10k_intfc *interface = netdev_priv(netdev);
179 struct hwtstamp_config *config = &interface->ts_config;
180
181 return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ?
182 -EFAULT : 0;
183}
184
185/**
186 * fm10k_set_ts_config - control hardware time stamping
187 * @netdev: network interface device structure
188 * @ifreq: ioctl data
189 *
190 * Outgoing time stamping can be enabled and disabled. Play nice and
191 * disable it when requested, although it shouldn't cause any overhead
192 * when no packet needs it. At most one packet in the queue may be
193 * marked for time stamping, otherwise it would be impossible to tell
194 * for sure to which packet the hardware time stamp belongs.
195 *
196 * Incoming time stamping has to be configured via the hardware
197 * filters. Not all combinations are supported, in particular event
198 * type has to be specified. Matching the kind of event packet is
199 * not supported, with the exception of "all V2 events regardless of
200 * level 2 or 4".
201 *
202 * Since hardware always timestamps Path delay packets when timestamping V2
203 * packets, regardless of the type specified in the register, only use V2
204 * Event mode. This more accurately tells the user what the hardware is going
205 * to do anyways.
206 */
207int fm10k_set_ts_config(struct net_device *netdev, struct ifreq *ifr)
208{
209 struct fm10k_intfc *interface = netdev_priv(netdev);
210 struct hwtstamp_config ts_config;
211
212 if (copy_from_user(&ts_config, ifr->ifr_data, sizeof(ts_config)))
213 return -EFAULT;
214
215 /* reserved for future extensions */
216 if (ts_config.flags)
217 return -EINVAL;
218
219 switch (ts_config.tx_type) {
220 case HWTSTAMP_TX_OFF:
221 break;
222 case HWTSTAMP_TX_ON:
223 /* we likely need some check here to see if this is supported */
224 break;
225 default:
226 return -ERANGE;
227 }
228
229 switch (ts_config.rx_filter) {
230 case HWTSTAMP_FILTER_NONE:
231 interface->flags &= ~FM10K_FLAG_RX_TS_ENABLED;
232 break;
233 case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
234 case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
235 case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
236 case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
237 case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
238 case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
239 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
240 case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
241 case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
242 case HWTSTAMP_FILTER_PTP_V2_EVENT:
243 case HWTSTAMP_FILTER_PTP_V2_SYNC:
244 case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
245 case HWTSTAMP_FILTER_ALL:
246 interface->flags |= FM10K_FLAG_RX_TS_ENABLED;
247 ts_config.rx_filter = HWTSTAMP_FILTER_ALL;
248 break;
249 default:
250 return -ERANGE;
251 }
252
253 /* save these settings for future reference */
254 interface->ts_config = ts_config;
255
256 return copy_to_user(ifr->ifr_data, &ts_config, sizeof(ts_config)) ?
257 -EFAULT : 0;
258}
259
260static int fm10k_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
261{
262 struct fm10k_intfc *interface;
263 struct fm10k_hw *hw;
264 int err;
265
266 interface = container_of(ptp, struct fm10k_intfc, ptp_caps);
267 hw = &interface->hw;
268
269 err = hw->mac.ops.adjust_systime(hw, ppb);
270
271 /* the only error we should see is if the value is out of range */
272 return (err == FM10K_ERR_PARAM) ? -ERANGE : err;
273}
274
275static int fm10k_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
276{
277 struct fm10k_intfc *interface;
278 unsigned long flags;
279
280 interface = container_of(ptp, struct fm10k_intfc, ptp_caps);
281
282 write_lock_irqsave(&interface->systime_lock, flags);
283 interface->ptp_adjust += delta;
284 write_unlock_irqrestore(&interface->systime_lock, flags);
285
286 return 0;
287}
288
289static int fm10k_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
290{
291 struct fm10k_intfc *interface;
292 unsigned long flags;
293 u64 now;
294
295 interface = container_of(ptp, struct fm10k_intfc, ptp_caps);
296
297 read_lock_irqsave(&interface->systime_lock, flags);
298 now = fm10k_systime_read(interface) + interface->ptp_adjust;
299 read_unlock_irqrestore(&interface->systime_lock, flags);
300
301 *ts = ns_to_timespec64(now);
302
303 return 0;
304}
305
306static int fm10k_ptp_settime(struct ptp_clock_info *ptp,
307 const struct timespec64 *ts)
308{
309 struct fm10k_intfc *interface;
310 unsigned long flags;
311 u64 ns = timespec64_to_ns(ts);
312
313 interface = container_of(ptp, struct fm10k_intfc, ptp_caps);
314
315 write_lock_irqsave(&interface->systime_lock, flags);
316 interface->ptp_adjust = fm10k_systime_read(interface) - ns;
317 write_unlock_irqrestore(&interface->systime_lock, flags);
318
319 return 0;
320}
321
322static int fm10k_ptp_enable(struct ptp_clock_info *ptp,
323 struct ptp_clock_request *rq,
324 int __always_unused on)
325{
326 struct ptp_clock_time *t = &rq->perout.period;
327 struct fm10k_intfc *interface;
328 struct fm10k_hw *hw;
329 u64 period;
330 u32 step;
331
332 /* we can only support periodic output */
333 if (rq->type != PTP_CLK_REQ_PEROUT)
334 return -EINVAL;
335
336 /* verify the requested channel is there */
337 if (rq->perout.index >= ptp->n_per_out)
338 return -EINVAL;
339
340 /* we cannot enforce start time as there is no
341 * mechanism for that in the hardware, we can only control
342 * the period.
343 */
344
345 /* we cannot support periods greater than 4 seconds due to reg limit */
346 if (t->sec > 4 || t->sec < 0)
347 return -ERANGE;
348
349 interface = container_of(ptp, struct fm10k_intfc, ptp_caps);
350 hw = &interface->hw;
351
352 /* we simply cannot support the operation if we don't have BAR4 */
353 if (!hw->sw_addr)
354 return -ENOTSUPP;
355
356 /* convert to unsigned 64b ns, verify we can put it in a 32b register */
357 period = t->sec * 1000000000LL + t->nsec;
358
359 /* determine the minimum size for period */
360 step = 2 * (fm10k_read_reg(hw, FM10K_SYSTIME_CFG) &
361 FM10K_SYSTIME_CFG_STEP_MASK);
362
363 /* verify the value is in range supported by hardware */
364 if ((period && (period < step)) || (period > U32_MAX))
365 return -ERANGE;
366
367 /* notify hardware of request to being sending pulses */
368 fm10k_write_sw_reg(hw, FM10K_SW_SYSTIME_PULSE(rq->perout.index),
369 (u32)period);
370
371 return 0;
372}
373
374static struct ptp_pin_desc fm10k_ptp_pd[2] = {
375 {
376 .name = "IEEE1588_PULSE0",
377 .index = 0,
378 .func = PTP_PF_PEROUT,
379 .chan = 0
380 },
381 {
382 .name = "IEEE1588_PULSE1",
383 .index = 1,
384 .func = PTP_PF_PEROUT,
385 .chan = 1
386 }
387};
388
389static int fm10k_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
390 enum ptp_pin_function func, unsigned int chan)
391{
392 /* verify the requested pin is there */
393 if (pin >= ptp->n_pins || !ptp->pin_config)
394 return -EINVAL;
395
396 /* enforce locked channels, no changing them */
397 if (chan != ptp->pin_config[pin].chan)
398 return -EINVAL;
399
400 /* we want to keep the functions locked as well */
401 if (func != ptp->pin_config[pin].func)
402 return -EINVAL;
403
404 return 0;
405}
406
407void fm10k_ptp_register(struct fm10k_intfc *interface)
408{
409 struct ptp_clock_info *ptp_caps = &interface->ptp_caps;
410 struct device *dev = &interface->pdev->dev;
411 struct ptp_clock *ptp_clock;
412
413 snprintf(ptp_caps->name, sizeof(ptp_caps->name),
414 "%s", interface->netdev->name);
415 ptp_caps->owner = THIS_MODULE;
416 /* This math is simply the inverse of the math in
417 * fm10k_adjust_systime_pf applied to an adjustment value
418 * of 2^30 - 1 which is the maximum value of the register:
419 * max_ppb == ((2^30 - 1) * 5^9) / 2^31
420 */
421 ptp_caps->max_adj = 976562;
422 ptp_caps->adjfreq = fm10k_ptp_adjfreq;
423 ptp_caps->adjtime = fm10k_ptp_adjtime;
424 ptp_caps->gettime64 = fm10k_ptp_gettime;
425 ptp_caps->settime64 = fm10k_ptp_settime;
426
427 /* provide pins if BAR4 is accessible */
428 if (interface->sw_addr) {
429 /* enable periodic outputs */
430 ptp_caps->n_per_out = 2;
431 ptp_caps->enable = fm10k_ptp_enable;
432
433 /* enable clock pins */
434 ptp_caps->verify = fm10k_ptp_verify;
435 ptp_caps->n_pins = 2;
436 ptp_caps->pin_config = fm10k_ptp_pd;
437 }
438
439 ptp_clock = ptp_clock_register(ptp_caps, dev);
440 if (IS_ERR(ptp_clock)) {
441 ptp_clock = NULL;
442 dev_err(dev, "ptp_clock_register failed\n");
443 } else {
444 dev_info(dev, "registered PHC device %s\n", ptp_caps->name);
445 }
446
447 interface->ptp_clock = ptp_clock;
448}
449
450void fm10k_ptp_unregister(struct fm10k_intfc *interface)
451{
452 struct ptp_clock *ptp_clock = interface->ptp_clock;
453 struct device *dev = &interface->pdev->dev;
454
455 if (!ptp_clock)
456 return;
457
458 interface->ptp_clock = NULL;
459
460 ptp_clock_unregister(ptp_clock);
461 dev_info(dev, "removed PHC %s\n", interface->ptp_caps.name);
462}
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_type.h b/drivers/net/ethernet/intel/fm10k/fm10k_type.h
index 5c0533054c5f..995dceefec25 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_type.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_type.h
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2015 Intel Corporation. 2 * Copyright(c) 2013 - 2016 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -225,11 +225,6 @@ struct fm10k_hw;
225#define FM10K_STATS_LOOPBACK_DROP 0x3806 225#define FM10K_STATS_LOOPBACK_DROP 0x3806
226#define FM10K_STATS_NODESC_DROP 0x3807 226#define FM10K_STATS_NODESC_DROP 0x3807
227 227
228/* Timesync registers */
229#define FM10K_SYSTIME 0x3814
230#define FM10K_SYSTIME_CFG 0x3818
231#define FM10K_SYSTIME_CFG_STEP_MASK 0x0000000F
232
233/* PCIe state registers */ 228/* PCIe state registers */
234#define FM10K_PHYADDR 0x381C 229#define FM10K_PHYADDR 0x381C
235 230
@@ -381,12 +376,6 @@ struct fm10k_hw;
381#define FM10K_VFSYSTIME 0x00040 376#define FM10K_VFSYSTIME 0x00040
382#define FM10K_VFITR(_n) ((_n) + 0x00060) 377#define FM10K_VFITR(_n) ((_n) + 0x00060)
383 378
384/* Registers contained in BAR 4 for Switch management */
385#define FM10K_SW_SYSTIME_ADJUST 0x0224D
386#define FM10K_SW_SYSTIME_ADJUST_MASK 0x3FFFFFFF
387#define FM10K_SW_SYSTIME_ADJUST_DIR_POSITIVE 0x80000000
388#define FM10K_SW_SYSTIME_PULSE(_n) ((_n) + 0x02252)
389
390enum fm10k_int_source { 379enum fm10k_int_source {
391 fm10k_int_mailbox = 0, 380 fm10k_int_mailbox = 0,
392 fm10k_int_pcie_fault = 1, 381 fm10k_int_pcie_fault = 1,
@@ -550,8 +539,6 @@ struct fm10k_mac_ops {
550 struct fm10k_dglort_cfg *); 539 struct fm10k_dglort_cfg *);
551 void (*set_dma_mask)(struct fm10k_hw *, u64); 540 void (*set_dma_mask)(struct fm10k_hw *, u64);
552 s32 (*get_fault)(struct fm10k_hw *, int, struct fm10k_fault *); 541 s32 (*get_fault)(struct fm10k_hw *, int, struct fm10k_fault *);
553 s32 (*adjust_systime)(struct fm10k_hw *, s32 ppb);
554 u64 (*read_systime)(struct fm10k_hw *);
555}; 542};
556 543
557enum fm10k_mac_type { 544enum fm10k_mac_type {
@@ -643,7 +630,6 @@ struct fm10k_iov_ops {
643 s32 (*set_lport)(struct fm10k_hw *, struct fm10k_vf_info *, u16, u8); 630 s32 (*set_lport)(struct fm10k_hw *, struct fm10k_vf_info *, u16, u8);
644 void (*reset_lport)(struct fm10k_hw *, struct fm10k_vf_info *); 631 void (*reset_lport)(struct fm10k_hw *, struct fm10k_vf_info *);
645 void (*update_stats)(struct fm10k_hw *, struct fm10k_hw_stats_q *, u16); 632 void (*update_stats)(struct fm10k_hw *, struct fm10k_hw_stats_q *, u16);
646 s32 (*report_timestamp)(struct fm10k_hw *, struct fm10k_vf_info *, u64);
647}; 633};
648 634
649struct fm10k_iov_info { 635struct fm10k_iov_info {
@@ -667,7 +653,6 @@ struct fm10k_info {
667 653
668struct fm10k_hw { 654struct fm10k_hw {
669 u32 __iomem *hw_addr; 655 u32 __iomem *hw_addr;
670 u32 __iomem *sw_addr;
671 void *back; 656 void *back;
672 struct fm10k_mac_info mac; 657 struct fm10k_mac_info mac;
673 struct fm10k_bus_info bus; 658 struct fm10k_bus_info bus;
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
index 91f8d7311f3b..86c358c37d3f 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2015 Intel Corporation. 2 * Copyright(c) 2013 - 2016 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -451,13 +451,6 @@ static s32 fm10k_update_xcast_mode_vf(struct fm10k_hw *hw, u16 glort, u8 mode)
451 return mbx->ops.enqueue_tx(hw, mbx, msg); 451 return mbx->ops.enqueue_tx(hw, mbx, msg);
452} 452}
453 453
454const struct fm10k_tlv_attr fm10k_1588_msg_attr[] = {
455 FM10K_TLV_ATTR_U64(FM10K_1588_MSG_TIMESTAMP),
456 FM10K_TLV_ATTR_LAST
457};
458
459/* currently there is no shared 1588 timestamp handler */
460
461/** 454/**
462 * fm10k_update_hw_stats_vf - Updates hardware related statistics of VF 455 * fm10k_update_hw_stats_vf - Updates hardware related statistics of VF
463 * @hw: pointer to hardware structure 456 * @hw: pointer to hardware structure
@@ -509,52 +502,6 @@ static s32 fm10k_configure_dglort_map_vf(struct fm10k_hw *hw,
509 return 0; 502 return 0;
510} 503}
511 504
512/**
513 * fm10k_adjust_systime_vf - Adjust systime frequency
514 * @hw: pointer to hardware structure
515 * @ppb: adjustment rate in parts per billion
516 *
517 * This function takes an adjustment rate in parts per billion and will
518 * verify that this value is 0 as the VF cannot support adjusting the
519 * systime clock.
520 *
521 * If the ppb value is non-zero the return is ERR_PARAM else success
522 **/
523static s32 fm10k_adjust_systime_vf(struct fm10k_hw *hw, s32 ppb)
524{
525 /* The VF cannot adjust the clock frequency, however it should
526 * already have a syntonic clock with whichever host interface is
527 * running as the master for the host interface clock domain so
528 * there should be not frequency adjustment necessary.
529 */
530 return ppb ? FM10K_ERR_PARAM : 0;
531}
532
533/**
534 * fm10k_read_systime_vf - Reads value of systime registers
535 * @hw: pointer to the hardware structure
536 *
537 * Function reads the content of 2 registers, combined to represent a 64 bit
538 * value measured in nanoseconds. In order to guarantee the value is accurate
539 * we check the 32 most significant bits both before and after reading the
540 * 32 least significant bits to verify they didn't change as we were reading
541 * the registers.
542 **/
543static u64 fm10k_read_systime_vf(struct fm10k_hw *hw)
544{
545 u32 systime_l, systime_h, systime_tmp;
546
547 systime_h = fm10k_read_reg(hw, FM10K_VFSYSTIME + 1);
548
549 do {
550 systime_tmp = systime_h;
551 systime_l = fm10k_read_reg(hw, FM10K_VFSYSTIME);
552 systime_h = fm10k_read_reg(hw, FM10K_VFSYSTIME + 1);
553 } while (systime_tmp != systime_h);
554
555 return ((u64)systime_h << 32) | systime_l;
556}
557
558static const struct fm10k_msg_data fm10k_msg_data_vf[] = { 505static const struct fm10k_msg_data fm10k_msg_data_vf[] = {
559 FM10K_TLV_MSG_TEST_HANDLER(fm10k_tlv_msg_test), 506 FM10K_TLV_MSG_TEST_HANDLER(fm10k_tlv_msg_test),
560 FM10K_VF_MSG_MAC_VLAN_HANDLER(fm10k_msg_mac_vlan_vf), 507 FM10K_VF_MSG_MAC_VLAN_HANDLER(fm10k_msg_mac_vlan_vf),
@@ -579,8 +526,6 @@ static const struct fm10k_mac_ops mac_ops_vf = {
579 .rebind_hw_stats = fm10k_rebind_hw_stats_vf, 526 .rebind_hw_stats = fm10k_rebind_hw_stats_vf,
580 .configure_dglort_map = fm10k_configure_dglort_map_vf, 527 .configure_dglort_map = fm10k_configure_dglort_map_vf,
581 .get_host_state = fm10k_get_host_state_generic, 528 .get_host_state = fm10k_get_host_state_generic,
582 .adjust_systime = fm10k_adjust_systime_vf,
583 .read_systime = fm10k_read_systime_vf,
584}; 529};
585 530
586static s32 fm10k_get_invariants_vf(struct fm10k_hw *hw) 531static s32 fm10k_get_invariants_vf(struct fm10k_hw *hw)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_vf.h b/drivers/net/ethernet/intel/fm10k/fm10k_vf.h
index c4439f1313a0..f0932f944793 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_vf.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_vf.h
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2016 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -29,7 +29,6 @@ enum fm10k_vf_tlv_msg_id {
29 FM10K_VF_MSG_ID_MSIX, 29 FM10K_VF_MSG_ID_MSIX,
30 FM10K_VF_MSG_ID_MAC_VLAN, 30 FM10K_VF_MSG_ID_MAC_VLAN,
31 FM10K_VF_MSG_ID_LPORT_STATE, 31 FM10K_VF_MSG_ID_LPORT_STATE,
32 FM10K_VF_MSG_ID_1588,
33 FM10K_VF_MSG_ID_MAX, 32 FM10K_VF_MSG_ID_MAX,
34}; 33};
35 34
@@ -49,11 +48,6 @@ enum fm10k_tlv_lport_state_attr_id {
49 FM10K_LPORT_STATE_MSG_MAX 48 FM10K_LPORT_STATE_MSG_MAX
50}; 49};
51 50
52enum fm10k_tlv_1588_attr_id {
53 FM10K_1588_MSG_TIMESTAMP,
54 FM10K_1588_MSG_MAX
55};
56
57#define FM10K_VF_MSG_MSIX_HANDLER(func) \ 51#define FM10K_VF_MSG_MSIX_HANDLER(func) \
58 FM10K_MSG_HANDLER(FM10K_VF_MSG_ID_MSIX, NULL, func) 52 FM10K_MSG_HANDLER(FM10K_VF_MSG_ID_MSIX, NULL, func)
59 53
@@ -70,9 +64,5 @@ extern const struct fm10k_tlv_attr fm10k_lport_state_msg_attr[];
70 FM10K_MSG_HANDLER(FM10K_VF_MSG_ID_LPORT_STATE, \ 64 FM10K_MSG_HANDLER(FM10K_VF_MSG_ID_LPORT_STATE, \
71 fm10k_lport_state_msg_attr, func) 65 fm10k_lport_state_msg_attr, func)
72 66
73extern const struct fm10k_tlv_attr fm10k_1588_msg_attr[];
74#define FM10K_VF_MSG_1588_HANDLER(func) \
75 FM10K_MSG_HANDLER(FM10K_VF_MSG_ID_1588, fm10k_1588_msg_attr, func)
76
77extern const struct fm10k_info fm10k_vf_info; 67extern const struct fm10k_info fm10k_vf_info;
78#endif /* _FM10K_VF_H */ 68#endif /* _FM10K_VF_H */