Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ptp: Enable clock drivers along with associated net/PHY drivers

Where a PTP clock driver is associated with a net or PHY driver, it
should be enabled automatically whenever that driver is enabled.
Therefore:

- Make PTP clock drivers select rather than depending on PTP_1588_CLOCK
- Remove separate boolean options for PTP clock drivers that are built
as part of net driver modules. (This also fixes cases where the PTP
subsystem is wrongly forced to be built-in.)
- Set 'default y' for PTP clock drivers that depend on specific net
drivers but are built separately

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ben Hutchings and committed by
David S. Miller
a24006ed 42a7ccef

+13 -173
+2 -24
drivers/net/ethernet/intel/Kconfig
··· 93 93 config IGB 94 94 tristate "Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support" 95 95 depends on PCI 96 + select PTP_1588_CLOCK 96 97 ---help--- 97 98 This driver supports Intel(R) 82575/82576 gigabit ethernet family of 98 99 adapters. For more information on how to identify your adapter, go ··· 120 119 Say Y here if you want to use Direct Cache Access (DCA) in the 121 120 driver. DCA is a method for warming the CPU cache before data 122 121 is used, with the intent of lessening the impact of cache misses. 123 - 124 - config IGB_PTP 125 - bool "PTP Hardware Clock (PHC)" 126 - default n 127 - depends on IGB 128 - select PTP_1588_CLOCK 129 - ---help--- 130 - Say Y here if you want to use PTP Hardware Clock (PHC) in the 131 - driver. Only the basic clock operations have been implemented. 132 - 133 - Every timestamp and clock read operations must consult the 134 - overflow counter to form a correct time value. 135 122 136 123 config IGBVF 137 124 tristate "Intel(R) 82576 Virtual Function Ethernet support" ··· 168 179 tristate "Intel(R) 10GbE PCI Express adapters support" 169 180 depends on PCI && INET 170 181 select MDIO 182 + select PTP_1588_CLOCK 171 183 ---help--- 172 184 This driver supports Intel(R) 10GbE PCI Express family of 173 185 adapters. For more information on how to identify your adapter, go ··· 208 218 ---help--- 209 219 Say Y here if you want to use Data Center Bridging (DCB) in the 210 220 driver. 211 - 212 - If unsure, say N. 213 - 214 - config IXGBE_PTP 215 - bool "PTP Clock Support" 216 - default n 217 - depends on IXGBE 218 - select PTP_1588_CLOCK 219 - ---help--- 220 - Say Y here if you want support for 1588 Timestamping with a 221 - PHC device, using the PTP 1588 Clock support. This is 222 - required to enable timestamping support for the device. 223 221 224 222 If unsure, say N. 225 223
+1 -3
drivers/net/ethernet/intel/igb/Makefile
··· 34 34 35 35 igb-objs := igb_main.o igb_ethtool.o e1000_82575.o \ 36 36 e1000_mac.o e1000_nvm.o e1000_phy.o e1000_mbx.o \ 37 - e1000_i210.o 38 - 39 - igb-$(CONFIG_IGB_PTP) += igb_ptp.o 37 + e1000_i210.o igb_ptp.o
-6
drivers/net/ethernet/intel/igb/igb.h
··· 34 34 #include "e1000_mac.h" 35 35 #include "e1000_82575.h" 36 36 37 - #ifdef CONFIG_IGB_PTP 38 37 #include <linux/clocksource.h> 39 38 #include <linux/net_tstamp.h> 40 39 #include <linux/ptp_clock_kernel.h> 41 - #endif /* CONFIG_IGB_PTP */ 42 40 #include <linux/bitops.h> 43 41 #include <linux/if_vlan.h> 44 42 ··· 374 376 u32 wvbr; 375 377 u32 *shadow_vfta; 376 378 377 - #ifdef CONFIG_IGB_PTP 378 379 struct ptp_clock *ptp_clock; 379 380 struct ptp_clock_info ptp_caps; 380 381 struct delayed_work ptp_overflow_work; ··· 382 385 spinlock_t tmreg_lock; 383 386 struct cyclecounter cc; 384 387 struct timecounter tc; 385 - #endif /* CONFIG_IGB_PTP */ 386 388 387 389 char fw_version[32]; 388 390 }; ··· 435 439 extern void igb_set_ethtool_ops(struct net_device *); 436 440 extern void igb_power_up_link(struct igb_adapter *); 437 441 extern void igb_set_fw_version(struct igb_adapter *); 438 - #ifdef CONFIG_IGB_PTP 439 442 extern void igb_ptp_init(struct igb_adapter *adapter); 440 443 extern void igb_ptp_stop(struct igb_adapter *adapter); 441 444 extern void igb_ptp_reset(struct igb_adapter *adapter); ··· 456 461 457 462 extern int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, 458 463 struct ifreq *ifr, int cmd); 459 - #endif /* CONFIG_IGB_PTP */ 460 464 461 465 static inline s32 igb_reset_phy(struct e1000_hw *hw) 462 466 {
-2
drivers/net/ethernet/intel/igb/igb_ethtool.c
··· 2310 2310 struct igb_adapter *adapter = netdev_priv(dev); 2311 2311 2312 2312 switch (adapter->hw.mac.type) { 2313 - #ifdef CONFIG_IGB_PTP 2314 2313 case e1000_82576: 2315 2314 case e1000_82580: 2316 2315 case e1000_i350: ··· 2345 2346 (1 << HWTSTAMP_FILTER_PTP_V2_EVENT); 2346 2347 2347 2348 return 0; 2348 - #endif /* CONFIG_IGB_PTP */ 2349 2349 default: 2350 2350 return -EOPNOTSUPP; 2351 2351 }
-28
drivers/net/ethernet/intel/igb/igb_main.c
··· 1708 1708 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ 1709 1709 wr32(E1000_VET, ETHERNET_IEEE_VLAN_TYPE); 1710 1710 1711 - #ifdef CONFIG_IGB_PTP 1712 1711 /* Re-enable PTP, where applicable. */ 1713 1712 igb_ptp_reset(adapter); 1714 - #endif /* CONFIG_IGB_PTP */ 1715 1713 1716 1714 igb_get_phy_info(hw); 1717 1715 } ··· 2117 2119 2118 2120 #endif 2119 2121 2120 - #ifdef CONFIG_IGB_PTP 2121 2122 /* do hw tstamp init after resetting */ 2122 2123 igb_ptp_init(adapter); 2123 - #endif /* CONFIG_IGB_PTP */ 2124 2124 2125 2125 dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n"); 2126 2126 /* print bus type/speed/width info */ ··· 2193 2197 struct e1000_hw *hw = &adapter->hw; 2194 2198 2195 2199 pm_runtime_get_noresume(&pdev->dev); 2196 - #ifdef CONFIG_IGB_PTP 2197 2200 igb_ptp_stop(adapter); 2198 - #endif /* CONFIG_IGB_PTP */ 2199 2201 2200 2202 /* 2201 2203 * The watchdog timer may be rescheduled, so explicitly ··· 3089 3095 srrctl = IGB_RX_HDR_LEN << E1000_SRRCTL_BSIZEHDRSIZE_SHIFT; 3090 3096 srrctl |= IGB_RX_BUFSZ >> E1000_SRRCTL_BSIZEPKT_SHIFT; 3091 3097 srrctl |= E1000_SRRCTL_DESCTYPE_ADV_ONEBUF; 3092 - #ifdef CONFIG_IGB_PTP 3093 3098 if (hw->mac.type >= e1000_82580) 3094 3099 srrctl |= E1000_SRRCTL_TIMESTAMP; 3095 - #endif /* CONFIG_IGB_PTP */ 3096 3100 /* Only set Drop Enable if we are supporting multiple queues */ 3097 3101 if (adapter->vfs_allocated_count || adapter->num_rx_queues > 1) 3098 3102 srrctl |= E1000_SRRCTL_DROP_EN; ··· 4126 4134 if (tx_flags & IGB_TX_FLAGS_VLAN) 4127 4135 cmd_type |= cpu_to_le32(E1000_ADVTXD_DCMD_VLE); 4128 4136 4129 - #ifdef CONFIG_IGB_PTP 4130 4137 /* set timestamp bit if present */ 4131 4138 if (unlikely(tx_flags & IGB_TX_FLAGS_TSTAMP)) 4132 4139 cmd_type |= cpu_to_le32(E1000_ADVTXD_MAC_TSTAMP); 4133 - #endif /* CONFIG_IGB_PTP */ 4134 4140 4135 4141 /* set segmentation bits for TSO */ 4136 4142 if (tx_flags & IGB_TX_FLAGS_TSO) ··· 4337 4347 netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, 4338 4348 struct igb_ring *tx_ring) 4339 4349 { 4340 - #ifdef CONFIG_IGB_PTP 4341 4350 struct igb_adapter *adapter = netdev_priv(tx_ring->netdev); 4342 - #endif /* CONFIG_IGB_PTP */ 4343 4351 struct igb_tx_buffer *first; 4344 4352 int tso; 4345 4353 u32 tx_flags = 0; ··· 4360 4372 first->bytecount = skb->len; 4361 4373 first->gso_segs = 1; 4362 4374 4363 - #ifdef CONFIG_IGB_PTP 4364 4375 if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && 4365 4376 !(adapter->ptp_tx_skb))) { 4366 4377 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; ··· 4369 4382 if (adapter->hw.mac.type == e1000_82576) 4370 4383 schedule_work(&adapter->ptp_tx_work); 4371 4384 } 4372 - #endif /* CONFIG_IGB_PTP */ 4373 4385 4374 4386 if (vlan_tx_tag_present(skb)) { 4375 4387 tx_flags |= IGB_TX_FLAGS_VLAN; ··· 4762 4776 mod_timer(&adapter->watchdog_timer, jiffies + 1); 4763 4777 } 4764 4778 4765 - #ifdef CONFIG_IGB_PTP 4766 4779 if (icr & E1000_ICR_TS) { 4767 4780 u32 tsicr = rd32(E1000_TSICR); 4768 4781 ··· 4772 4787 schedule_work(&adapter->ptp_tx_work); 4773 4788 } 4774 4789 } 4775 - #endif /* CONFIG_IGB_PTP */ 4776 4790 4777 4791 wr32(E1000_EIMS, adapter->eims_other); 4778 4792 ··· 5523 5539 mod_timer(&adapter->watchdog_timer, jiffies + 1); 5524 5540 } 5525 5541 5526 - #ifdef CONFIG_IGB_PTP 5527 5542 if (icr & E1000_ICR_TS) { 5528 5543 u32 tsicr = rd32(E1000_TSICR); 5529 5544 ··· 5533 5550 schedule_work(&adapter->ptp_tx_work); 5534 5551 } 5535 5552 } 5536 - #endif /* CONFIG_IGB_PTP */ 5537 5553 5538 5554 napi_schedule(&q_vector->napi); 5539 5555 ··· 5575 5593 mod_timer(&adapter->watchdog_timer, jiffies + 1); 5576 5594 } 5577 5595 5578 - #ifdef CONFIG_IGB_PTP 5579 5596 if (icr & E1000_ICR_TS) { 5580 5597 u32 tsicr = rd32(E1000_TSICR); 5581 5598 ··· 5585 5604 schedule_work(&adapter->ptp_tx_work); 5586 5605 } 5587 5606 } 5588 - #endif /* CONFIG_IGB_PTP */ 5589 5607 5590 5608 napi_schedule(&q_vector->napi); 5591 5609 ··· 5869 5889 if ((size <= IGB_RX_HDR_LEN) && !skb_is_nonlinear(skb)) { 5870 5890 unsigned char *va = page_address(page) + rx_buffer->page_offset; 5871 5891 5872 - #ifdef CONFIG_IGB_PTP 5873 5892 if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { 5874 5893 igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb); 5875 5894 va += IGB_TS_HDR_LEN; 5876 5895 size -= IGB_TS_HDR_LEN; 5877 5896 } 5878 5897 5879 - #endif 5880 5898 memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long))); 5881 5899 5882 5900 /* we can reuse buffer as-is, just make sure it is local */ ··· 6199 6221 */ 6200 6222 va = skb_frag_address(frag); 6201 6223 6202 - #ifdef CONFIG_IGB_PTP 6203 6224 if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { 6204 6225 /* retrieve timestamp from buffer */ 6205 6226 igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb); ··· 6213 6236 va += IGB_TS_HDR_LEN; 6214 6237 } 6215 6238 6216 - #endif 6217 6239 /* 6218 6240 * we need the header to contain the greater of either ETH_HLEN or 6219 6241 * 60 bytes if the skb->len is less than 60 for skb_pad. ··· 6293 6317 6294 6318 igb_rx_checksum(rx_ring, rx_desc, skb); 6295 6319 6296 - #ifdef CONFIG_IGB_PTP 6297 6320 igb_ptp_rx_hwtstamp(rx_ring->q_vector, rx_desc, skb); 6298 - #endif /* CONFIG_IGB_PTP */ 6299 6321 6300 6322 if ((dev->features & NETIF_F_HW_VLAN_RX) && 6301 6323 igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) { ··· 6527 6553 case SIOCGMIIREG: 6528 6554 case SIOCSMIIREG: 6529 6555 return igb_mii_ioctl(netdev, ifr, cmd); 6530 - #ifdef CONFIG_IGB_PTP 6531 6556 case SIOCSHWTSTAMP: 6532 6557 return igb_ptp_hwtstamp_ioctl(netdev, ifr, cmd); 6533 - #endif /* CONFIG_IGB_PTP */ 6534 6558 default: 6535 6559 return -EOPNOTSUPP; 6536 6560 }
+1 -2
drivers/net/ethernet/intel/ixgbe/Makefile
··· 34 34 35 35 ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o ixgbe_debugfs.o\ 36 36 ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \ 37 - ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o 37 + ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o ixgbe_ptp.o 38 38 39 39 ixgbe-$(CONFIG_IXGBE_DCB) += ixgbe_dcb.o ixgbe_dcb_82598.o \ 40 40 ixgbe_dcb_82599.o ixgbe_dcb_nl.o 41 41 42 - ixgbe-$(CONFIG_IXGBE_PTP) += ixgbe_ptp.o 43 42 ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o 44 43 ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o
-6
drivers/net/ethernet/intel/ixgbe/ixgbe.h
··· 36 36 #include <linux/aer.h> 37 37 #include <linux/if_vlan.h> 38 38 39 - #ifdef CONFIG_IXGBE_PTP 40 39 #include <linux/clocksource.h> 41 40 #include <linux/net_tstamp.h> 42 41 #include <linux/ptp_clock_kernel.h> 43 - #endif /* CONFIG_IXGBE_PTP */ 44 42 45 43 #include "ixgbe_type.h" 46 44 #include "ixgbe_common.h" ··· 570 572 u32 interrupt_event; 571 573 u32 led_reg; 572 574 573 - #ifdef CONFIG_IXGBE_PTP 574 575 struct ptp_clock *ptp_clock; 575 576 struct ptp_clock_info ptp_caps; 576 577 unsigned long last_overflow_check; ··· 578 581 struct timecounter tc; 579 582 int rx_hwtstamp_filter; 580 583 u32 base_incval; 581 - #endif /* CONFIG_IXGBE_PTP */ 582 584 583 585 /* SR-IOV */ 584 586 DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS); ··· 738 742 return netdev_get_tx_queue(ring->netdev, ring->queue_index); 739 743 } 740 744 741 - #ifdef CONFIG_IXGBE_PTP 742 745 extern void ixgbe_ptp_init(struct ixgbe_adapter *adapter); 743 746 extern void ixgbe_ptp_stop(struct ixgbe_adapter *adapter); 744 747 extern void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); ··· 751 756 extern void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter); 752 757 extern void ixgbe_ptp_reset(struct ixgbe_adapter *adapter); 753 758 extern void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr); 754 - #endif /* CONFIG_IXGBE_PTP */ 755 759 756 760 #endif /* _IXGBE_H_ */
-2
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
··· 2667 2667 struct ixgbe_adapter *adapter = netdev_priv(dev); 2668 2668 2669 2669 switch (adapter->hw.mac.type) { 2670 - #ifdef CONFIG_IXGBE_PTP 2671 2670 case ixgbe_mac_X540: 2672 2671 case ixgbe_mac_82599EB: 2673 2672 info->so_timestamping = ··· 2689 2690 (1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) | 2690 2691 (1 << HWTSTAMP_FILTER_PTP_V2_EVENT); 2691 2692 break; 2692 - #endif /* CONFIG_IXGBE_PTP */ 2693 2693 default: 2694 2694 return ethtool_op_get_ts_info(dev, info); 2695 2695 break;
-28
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 841 841 total_bytes += tx_buffer->bytecount; 842 842 total_packets += tx_buffer->gso_segs; 843 843 844 - #ifdef CONFIG_IXGBE_PTP 845 844 if (unlikely(tx_buffer->tx_flags & IXGBE_TX_FLAGS_TSTAMP)) 846 845 ixgbe_ptp_tx_hwtstamp(q_vector, tx_buffer->skb); 847 - #endif 848 846 849 847 /* free the skb */ 850 848 dev_kfree_skb_any(tx_buffer->skb); ··· 1430 1432 1431 1433 ixgbe_rx_checksum(rx_ring, rx_desc, skb); 1432 1434 1433 - #ifdef CONFIG_IXGBE_PTP 1434 1435 ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector, rx_desc, skb); 1435 - #endif 1436 1436 1437 1437 if ((dev->features & NETIF_F_HW_VLAN_RX) && 1438 1438 ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_VP)) { ··· 2382 2386 break; 2383 2387 } 2384 2388 2385 - #ifdef CONFIG_IXGBE_PTP 2386 2389 if (adapter->hw.mac.type == ixgbe_mac_X540) 2387 2390 mask |= IXGBE_EIMS_TIMESYNC; 2388 - #endif 2389 2391 2390 2392 if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) && 2391 2393 !(adapter->flags2 & IXGBE_FLAG2_FDIR_REQUIRES_REINIT)) ··· 2449 2455 2450 2456 ixgbe_check_fan_failure(adapter, eicr); 2451 2457 2452 - #ifdef CONFIG_IXGBE_PTP 2453 2458 if (unlikely(eicr & IXGBE_EICR_TIMESYNC)) 2454 2459 ixgbe_ptp_check_pps_event(adapter, eicr); 2455 - #endif 2456 2460 2457 2461 /* re-enable the original interrupt state, no lsc, no queues */ 2458 2462 if (!test_bit(__IXGBE_DOWN, &adapter->state)) ··· 2642 2650 } 2643 2651 2644 2652 ixgbe_check_fan_failure(adapter, eicr); 2645 - #ifdef CONFIG_IXGBE_PTP 2646 2653 if (unlikely(eicr & IXGBE_EICR_TIMESYNC)) 2647 2654 ixgbe_ptp_check_pps_event(adapter, eicr); 2648 - #endif 2649 2655 2650 2656 /* would disable interrupts here but EIAM disabled it */ 2651 2657 napi_schedule(&q_vector->napi); ··· 4241 4251 if (hw->mac.san_mac_rar_index) 4242 4252 hw->mac.ops.set_vmdq_san_mac(hw, VMDQ_P(0)); 4243 4253 4244 - #ifdef CONFIG_IXGBE_PTP 4245 4254 if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED) 4246 4255 ixgbe_ptp_reset(adapter); 4247 - #endif 4248 4256 } 4249 4257 4250 4258 /** ··· 4949 4961 if (err) 4950 4962 goto err_set_queues; 4951 4963 4952 - #ifdef CONFIG_IXGBE_PTP 4953 4964 ixgbe_ptp_init(adapter); 4954 - #endif /* CONFIG_IXGBE_PTP*/ 4955 4965 4956 4966 ixgbe_up_complete(adapter); 4957 4967 ··· 4982 4996 { 4983 4997 struct ixgbe_adapter *adapter = netdev_priv(netdev); 4984 4998 4985 - #ifdef CONFIG_IXGBE_PTP 4986 4999 ixgbe_ptp_stop(adapter); 4987 - #endif 4988 5000 4989 5001 ixgbe_down(adapter); 4990 5002 ixgbe_free_irq(adapter); ··· 5545 5561 break; 5546 5562 } 5547 5563 5548 - #ifdef CONFIG_IXGBE_PTP 5549 5564 if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED) 5550 5565 ixgbe_ptp_start_cyclecounter(adapter); 5551 - #endif 5552 5566 5553 5567 e_info(drv, "NIC Link is Up %s, Flow Control: %s\n", 5554 5568 (link_speed == IXGBE_LINK_SPEED_10GB_FULL ? ··· 5591 5609 if (ixgbe_is_sfp(hw) && hw->mac.type == ixgbe_mac_82598EB) 5592 5610 adapter->flags2 |= IXGBE_FLAG2_SEARCH_FOR_SFP; 5593 5611 5594 - #ifdef CONFIG_IXGBE_PTP 5595 5612 if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED) 5596 5613 ixgbe_ptp_start_cyclecounter(adapter); 5597 - #endif 5598 5614 5599 5615 e_info(drv, "NIC Link is Down\n"); 5600 5616 netif_carrier_off(netdev); ··· 5897 5917 ixgbe_watchdog_subtask(adapter); 5898 5918 ixgbe_fdir_reinit_subtask(adapter); 5899 5919 ixgbe_check_hang_subtask(adapter); 5900 - #ifdef CONFIG_IXGBE_PTP 5901 5920 ixgbe_ptp_overflow_check(adapter); 5902 - #endif 5903 5921 5904 5922 ixgbe_service_event_complete(adapter); 5905 5923 } ··· 6050 6072 if (tx_flags & IXGBE_TX_FLAGS_HW_VLAN) 6051 6073 cmd_type |= cpu_to_le32(IXGBE_ADVTXD_DCMD_VLE); 6052 6074 6053 - #ifdef CONFIG_IXGBE_PTP 6054 6075 if (tx_flags & IXGBE_TX_FLAGS_TSTAMP) 6055 6076 cmd_type |= cpu_to_le32(IXGBE_ADVTXD_MAC_TSTAMP); 6056 - #endif 6057 6077 6058 6078 /* set segmentation enable bits for TSO/FSO */ 6059 6079 #ifdef IXGBE_FCOE ··· 6453 6477 6454 6478 skb_tx_timestamp(skb); 6455 6479 6456 - #ifdef CONFIG_IXGBE_PTP 6457 6480 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { 6458 6481 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 6459 6482 tx_flags |= IXGBE_TX_FLAGS_TSTAMP; 6460 6483 } 6461 - #endif 6462 6484 6463 6485 #ifdef CONFIG_PCI_IOV 6464 6486 /* ··· 6606 6632 struct ixgbe_adapter *adapter = netdev_priv(netdev); 6607 6633 6608 6634 switch (cmd) { 6609 - #ifdef CONFIG_IXGBE_PTP 6610 6635 case SIOCSHWTSTAMP: 6611 6636 return ixgbe_ptp_hwtstamp_ioctl(adapter, req, cmd); 6612 - #endif 6613 6637 default: 6614 6638 return mdio_mii_ioctl(&adapter->hw.phy.mdio, if_mii(req), cmd); 6615 6639 }
-14
drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
··· 20 20 purpose use. 21 21 ML7223/ML7831 is companion chip for Intel Atom E6xx series. 22 22 ML7223/ML7831 is completely compatible for Intel EG20T PCH. 23 - 24 - if PCH_GBE 25 - 26 - config PCH_PTP 27 - bool "PCH PTP clock support" 28 - default n 29 - select PTP_1588_CLOCK 30 - select PTP_1588_CLOCK_PCH 31 - ---help--- 32 - Say Y here if you want to use Precision Time Protocol (PTP) in the 33 - driver. PTP is a method to precisely synchronize distributed clocks 34 - over Ethernet networks. 35 - 36 - endif # PCH_GBE
-2
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
··· 649 649 extern void pch_gbe_free_rx_resources(struct pch_gbe_adapter *adapter, 650 650 struct pch_gbe_rx_ring *rx_ring); 651 651 extern void pch_gbe_update_stats(struct pch_gbe_adapter *adapter); 652 - #ifdef CONFIG_PCH_PTP 653 652 extern u32 pch_ch_control_read(struct pci_dev *pdev); 654 653 extern void pch_ch_control_write(struct pci_dev *pdev, u32 val); 655 654 extern u32 pch_ch_event_read(struct pci_dev *pdev); ··· 658 659 extern u64 pch_rx_snap_read(struct pci_dev *pdev); 659 660 extern u64 pch_tx_snap_read(struct pci_dev *pdev); 660 661 extern int pch_set_station_address(u8 *addr, struct pci_dev *pdev); 661 - #endif 662 662 663 663 /* pch_gbe_param.c */ 664 664 extern void pch_gbe_check_options(struct pch_gbe_adapter *adapter);
-14
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
··· 21 21 #include "pch_gbe.h" 22 22 #include "pch_gbe_api.h" 23 23 #include <linux/module.h> 24 - #ifdef CONFIG_PCH_PTP 25 24 #include <linux/net_tstamp.h> 26 25 #include <linux/ptp_classify.h> 27 - #endif 28 26 29 27 #define DRV_VERSION "1.01" 30 28 const char pch_driver_version[] = DRV_VERSION; ··· 96 98 97 99 #define PCH_GBE_INT_DISABLE_ALL 0 98 100 99 - #ifdef CONFIG_PCH_PTP 100 101 /* Macros for ieee1588 */ 101 102 /* 0x40 Time Synchronization Channel Control Register Bits */ 102 103 #define MASTER_MODE (1<<0) ··· 110 113 111 114 #define PTP_L4_MULTICAST_SA "01:00:5e:00:01:81" 112 115 #define PTP_L2_MULTICAST_SA "01:1b:19:00:00:00" 113 - #endif 114 116 115 117 static unsigned int copybreak __read_mostly = PCH_GBE_COPYBREAK_DEFAULT; 116 118 ··· 118 122 int data); 119 123 static void pch_gbe_set_multi(struct net_device *netdev); 120 124 121 - #ifdef CONFIG_PCH_PTP 122 125 static struct sock_filter ptp_filter[] = { 123 126 PTP_FILTER 124 127 }; ··· 286 291 287 292 return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; 288 293 } 289 - #endif 290 294 291 295 inline void pch_gbe_mac_load_mac_addr(struct pch_gbe_hw *hw) 292 296 { ··· 1255 1261 (int)sizeof(struct pch_gbe_tx_desc) * ring_num, 1256 1262 &hw->reg->TX_DSC_SW_P); 1257 1263 1258 - #ifdef CONFIG_PCH_PTP 1259 1264 pch_tx_timestamp(adapter, skb); 1260 - #endif 1261 1265 1262 1266 dev_kfree_skb_any(skb); 1263 1267 } ··· 1763 1771 /* Write meta date of skb */ 1764 1772 skb_put(skb, length); 1765 1773 1766 - #ifdef CONFIG_PCH_PTP 1767 1774 pch_rx_timestamp(adapter, skb); 1768 - #endif 1769 1775 1770 1776 skb->protocol = eth_type_trans(skb, netdev); 1771 1777 if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK) ··· 2359 2369 2360 2370 pr_debug("cmd : 0x%04x\n", cmd); 2361 2371 2362 - #ifdef CONFIG_PCH_PTP 2363 2372 if (cmd == SIOCSHWTSTAMP) 2364 2373 return hwtstamp_ioctl(netdev, ifr, cmd); 2365 - #endif 2366 2374 2367 2375 return generic_mii_ioctl(&adapter->mii, if_mii(ifr), cmd, NULL); 2368 2376 } ··· 2653 2665 goto err_free_netdev; 2654 2666 } 2655 2667 2656 - #ifdef CONFIG_PCH_PTP 2657 2668 adapter->ptp_pdev = pci_get_bus_and_slot(adapter->pdev->bus->number, 2658 2669 PCI_DEVFN(12, 4)); 2659 2670 if (ptp_filter_init(ptp_filter, ARRAY_SIZE(ptp_filter))) { 2660 2671 pr_err("Bad ptp filter\n"); 2661 2672 return -EINVAL; 2662 2673 } 2663 - #endif 2664 2674 2665 2675 netdev->netdev_ops = &pch_gbe_netdev_ops; 2666 2676 netdev->watchdog_timeo = PCH_GBE_WATCHDOG_PERIOD;
-7
drivers/net/ethernet/sfc/Kconfig
··· 34 34 This enables support for the SFC9000 I/O Virtualization 35 35 features, allowing accelerated network performance in 36 36 virtualized environments. 37 - config SFC_PTP 38 - bool "Solarflare SFC9000-family PTP support" 39 - depends on SFC && PTP_1588_CLOCK && !(SFC=y && PTP_1588_CLOCK=m) 40 - default y 41 - ---help--- 42 - This enables support for the Precision Time Protocol (PTP) 43 - on SFC9000-family NICs
+1 -2
drivers/net/ethernet/sfc/Makefile
··· 2 2 falcon_xmac.o mcdi_mac.o \ 3 3 selftest.o ethtool.o qt202x_phy.o mdio_10g.o \ 4 4 tenxpress.o txc43128_phy.o falcon_boards.o \ 5 - mcdi.o mcdi_phy.o mcdi_mon.o 5 + mcdi.o mcdi_phy.o mcdi_mon.o ptp.o 6 6 sfc-$(CONFIG_SFC_MTD) += mtd.o 7 7 sfc-$(CONFIG_SFC_SRIOV) += siena_sriov.o 8 - sfc-$(CONFIG_SFC_PTP) += ptp.o 9 8 10 9 obj-$(CONFIG_SFC) += sfc.o
-2
drivers/net/ethernet/sfc/net_driver.h
··· 868 868 struct work_struct peer_work; 869 869 #endif 870 870 871 - #ifdef CONFIG_SFC_PTP 872 871 struct efx_ptp_data *ptp_data; 873 - #endif 874 872 875 873 /* The following fields may be written more often */ 876 874
-26
drivers/net/ethernet/sfc/nic.h
··· 252 252 bool spoofchk); 253 253 254 254 struct ethtool_ts_info; 255 - #ifdef CONFIG_SFC_PTP 256 255 extern void efx_ptp_probe(struct efx_nic *efx); 257 256 extern int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd); 258 257 extern int efx_ptp_get_ts_info(struct net_device *net_dev, ··· 259 260 extern bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); 260 261 extern int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); 261 262 extern void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev); 262 - #else 263 - static inline void efx_ptp_probe(struct efx_nic *efx) {} 264 - static inline int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd) 265 - { 266 - return -EOPNOTSUPP; 267 - } 268 - static inline int efx_ptp_get_ts_info(struct net_device *net_dev, 269 - struct ethtool_ts_info *ts_info) 270 - { 271 - ts_info->so_timestamping = (SOF_TIMESTAMPING_SOFTWARE | 272 - SOF_TIMESTAMPING_RX_SOFTWARE); 273 - ts_info->phc_index = -1; 274 - 275 - return 0; 276 - } 277 - static inline bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb) 278 - { 279 - return false; 280 - } 281 - static inline int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb) 282 - { 283 - return NETDEV_TX_OK; 284 - } 285 - static inline void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev) {} 286 - #endif 287 263 288 264 extern const struct efx_nic_type falcon_a1_nic_type; 289 265 extern const struct efx_nic_type falcon_b0_nic_type;
+8 -5
drivers/ptp/Kconfig
··· 25 25 26 26 config PTP_1588_CLOCK_GIANFAR 27 27 tristate "Freescale eTSEC as PTP clock" 28 - depends on PTP_1588_CLOCK 29 28 depends on GIANFAR 29 + select PTP_1588_CLOCK 30 + default y 30 31 help 31 32 This driver adds support for using the eTSEC as a PTP 32 33 clock. This clock is only useful if your PTP programs are ··· 39 38 40 39 config PTP_1588_CLOCK_IXP46X 41 40 tristate "Intel IXP46x as PTP clock" 42 - depends on PTP_1588_CLOCK 43 41 depends on IXP4XX_ETH 42 + select PTP_1588_CLOCK 43 + default y 44 44 help 45 45 This driver adds support for using the IXP46X as a PTP 46 46 clock. This clock is only useful if your PTP programs are ··· 52 50 will be called ptp_ixp46x. 53 51 54 52 comment "Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks." 55 - depends on PTP_1588_CLOCK && (PHYLIB=n || NETWORK_PHY_TIMESTAMPING=n) 53 + depends on PHYLIB=n || NETWORK_PHY_TIMESTAMPING=n 56 54 57 55 config DP83640_PHY 58 56 tristate "Driver for the National Semiconductor DP83640 PHYTER" 59 - depends on PTP_1588_CLOCK 60 57 depends on NETWORK_PHY_TIMESTAMPING 61 58 depends on PHYLIB 59 + select PTP_1588_CLOCK 62 60 ---help--- 63 61 Supports the DP83640 PHYTER with IEEE 1588 features. 64 62 ··· 72 70 73 71 config PTP_1588_CLOCK_PCH 74 72 tristate "Intel PCH EG20T as PTP clock" 75 - depends on PTP_1588_CLOCK 76 73 depends on PCH_GBE 74 + select PTP_1588_CLOCK 75 + default y 77 76 help 78 77 This driver adds support for using the PCH EG20T as a PTP 79 78 clock. The hardware supports time stamping of PTP packets