Skip to content

Commit a24006e

Browse files
Ben Hutchingsdavem330
authored andcommitted
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>
1 parent 42a7cce commit a24006e

17 files changed

Lines changed: 13 additions & 173 deletions

File tree

‎drivers/net/ethernet/intel/Kconfig‎

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ config E1000E
9393
config IGB
9494
tristate "Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support"
9595
depends on PCI
96+
select PTP_1588_CLOCK
9697
---help---
9798
This driver supports Intel(R) 82575/82576 gigabit ethernet family of
9899
adapters. For more information on how to identify your adapter, go
@@ -120,18 +121,6 @@ config IGB_DCA
120121
driver. DCA is a method for warming the CPU cache before data
121122
is used, with the intent of lessening the impact of cache misses.
122123

123-
config IGB_PTP
124-
bool "PTP Hardware Clock (PHC)"
125-
default n
126-
depends on IGB
127-
select PTP_1588_CLOCK
128-
---help---
129-
Say Y here if you want to use PTP Hardware Clock (PHC) in the
130-
driver. Only the basic clock operations have been implemented.
131-
132-
Every timestamp and clock read operations must consult the
133-
overflow counter to form a correct time value.
134-
135124
config IGBVF
136125
tristate "Intel(R) 82576 Virtual Function Ethernet support"
137126
depends on PCI
@@ -179,6 +168,7 @@ config IXGBE
179168
tristate "Intel(R) 10GbE PCI Express adapters support"
180169
depends on PCI && INET
181170
select MDIO
171+
select PTP_1588_CLOCK
182172
---help---
183173
This driver supports Intel(R) 10GbE PCI Express family of
184174
adapters. For more information on how to identify your adapter, go
@@ -221,18 +211,6 @@ config IXGBE_DCB
221211

222212
If unsure, say N.
223213

224-
config IXGBE_PTP
225-
bool "PTP Clock Support"
226-
default n
227-
depends on IXGBE
228-
select PTP_1588_CLOCK
229-
---help---
230-
Say Y here if you want support for 1588 Timestamping with a
231-
PHC device, using the PTP 1588 Clock support. This is
232-
required to enable timestamping support for the device.
233-
234-
If unsure, say N.
235-
236214
config IXGBEVF
237215
tristate "Intel(R) 82599 Virtual Function Ethernet support"
238216
depends on PCI_MSI

‎drivers/net/ethernet/intel/igb/Makefile‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,4 @@ obj-$(CONFIG_IGB) += igb.o
3434

3535
igb-objs := igb_main.o igb_ethtool.o e1000_82575.o \
3636
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

‎drivers/net/ethernet/intel/igb/igb.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@
3434
#include "e1000_mac.h"
3535
#include "e1000_82575.h"
3636

37-
#ifdef CONFIG_IGB_PTP
3837
#include <linux/clocksource.h>
3938
#include <linux/net_tstamp.h>
4039
#include <linux/ptp_clock_kernel.h>
41-
#endif /* CONFIG_IGB_PTP */
4240
#include <linux/bitops.h>
4341
#include <linux/if_vlan.h>
4442

@@ -376,7 +374,6 @@ struct igb_adapter {
376374
u32 wvbr;
377375
u32 *shadow_vfta;
378376

379-
#ifdef CONFIG_IGB_PTP
380377
struct ptp_clock *ptp_clock;
381378
struct ptp_clock_info ptp_caps;
382379
struct delayed_work ptp_overflow_work;
@@ -385,7 +382,6 @@ struct igb_adapter {
385382
spinlock_t tmreg_lock;
386383
struct cyclecounter cc;
387384
struct timecounter tc;
388-
#endif /* CONFIG_IGB_PTP */
389385

390386
char fw_version[32];
391387
};
@@ -439,7 +435,6 @@ extern bool igb_has_link(struct igb_adapter *adapter);
439435
extern void igb_set_ethtool_ops(struct net_device *);
440436
extern void igb_power_up_link(struct igb_adapter *);
441437
extern void igb_set_fw_version(struct igb_adapter *);
442-
#ifdef CONFIG_IGB_PTP
443438
extern void igb_ptp_init(struct igb_adapter *adapter);
444439
extern void igb_ptp_stop(struct igb_adapter *adapter);
445440
extern void igb_ptp_reset(struct igb_adapter *adapter);
@@ -461,7 +456,6 @@ static inline void igb_ptp_rx_hwtstamp(struct igb_q_vector *q_vector,
461456

462457
extern int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
463458
struct ifreq *ifr, int cmd);
464-
#endif /* CONFIG_IGB_PTP */
465459

466460
static inline s32 igb_reset_phy(struct e1000_hw *hw)
467461
{

‎drivers/net/ethernet/intel/igb/igb_ethtool.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,7 +2310,6 @@ static int igb_get_ts_info(struct net_device *dev,
23102310
struct igb_adapter *adapter = netdev_priv(dev);
23112311

23122312
switch (adapter->hw.mac.type) {
2313-
#ifdef CONFIG_IGB_PTP
23142313
case e1000_82576:
23152314
case e1000_82580:
23162315
case e1000_i350:
@@ -2346,7 +2345,6 @@ static int igb_get_ts_info(struct net_device *dev,
23462345
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
23472346

23482347
return 0;
2349-
#endif /* CONFIG_IGB_PTP */
23502348
default:
23512349
return -EOPNOTSUPP;
23522350
}

‎drivers/net/ethernet/intel/igb/igb_main.c‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,10 +1708,8 @@ void igb_reset(struct igb_adapter *adapter)
17081708
/* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
17091709
wr32(E1000_VET, ETHERNET_IEEE_VLAN_TYPE);
17101710

1711-
#ifdef CONFIG_IGB_PTP
17121711
/* Re-enable PTP, where applicable. */
17131712
igb_ptp_reset(adapter);
1714-
#endif /* CONFIG_IGB_PTP */
17151713

17161714
igb_get_phy_info(hw);
17171715
}
@@ -2119,10 +2117,8 @@ static int __devinit igb_probe(struct pci_dev *pdev,
21192117

21202118
#endif
21212119

2122-
#ifdef CONFIG_IGB_PTP
21232120
/* do hw tstamp init after resetting */
21242121
igb_ptp_init(adapter);
2125-
#endif /* CONFIG_IGB_PTP */
21262122

21272123
dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n");
21282124
/* print bus type/speed/width info */
@@ -2197,9 +2193,7 @@ static void __devexit igb_remove(struct pci_dev *pdev)
21972193
struct e1000_hw *hw = &adapter->hw;
21982194

21992195
pm_runtime_get_noresume(&pdev->dev);
2200-
#ifdef CONFIG_IGB_PTP
22012196
igb_ptp_stop(adapter);
2202-
#endif /* CONFIG_IGB_PTP */
22032197

22042198
/*
22052199
* The watchdog timer may be rescheduled, so explicitly
@@ -3095,10 +3089,8 @@ void igb_configure_rx_ring(struct igb_adapter *adapter,
30953089
srrctl = IGB_RX_HDR_LEN << E1000_SRRCTL_BSIZEHDRSIZE_SHIFT;
30963090
srrctl |= IGB_RX_BUFSZ >> E1000_SRRCTL_BSIZEPKT_SHIFT;
30973091
srrctl |= E1000_SRRCTL_DESCTYPE_ADV_ONEBUF;
3098-
#ifdef CONFIG_IGB_PTP
30993092
if (hw->mac.type >= e1000_82580)
31003093
srrctl |= E1000_SRRCTL_TIMESTAMP;
3101-
#endif /* CONFIG_IGB_PTP */
31023094
/* Only set Drop Enable if we are supporting multiple queues */
31033095
if (adapter->vfs_allocated_count || adapter->num_rx_queues > 1)
31043096
srrctl |= E1000_SRRCTL_DROP_EN;
@@ -4134,11 +4126,9 @@ static __le32 igb_tx_cmd_type(u32 tx_flags)
41344126
if (tx_flags & IGB_TX_FLAGS_VLAN)
41354127
cmd_type |= cpu_to_le32(E1000_ADVTXD_DCMD_VLE);
41364128

4137-
#ifdef CONFIG_IGB_PTP
41384129
/* set timestamp bit if present */
41394130
if (unlikely(tx_flags & IGB_TX_FLAGS_TSTAMP))
41404131
cmd_type |= cpu_to_le32(E1000_ADVTXD_MAC_TSTAMP);
4141-
#endif /* CONFIG_IGB_PTP */
41424132

41434133
/* set segmentation bits for TSO */
41444134
if (tx_flags & IGB_TX_FLAGS_TSO)
@@ -4347,9 +4337,7 @@ static inline int igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size)
43474337
netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
43484338
struct igb_ring *tx_ring)
43494339
{
4350-
#ifdef CONFIG_IGB_PTP
43514340
struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
4352-
#endif /* CONFIG_IGB_PTP */
43534341
struct igb_tx_buffer *first;
43544342
int tso;
43554343
u32 tx_flags = 0;
@@ -4372,7 +4360,6 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
43724360
first->bytecount = skb->len;
43734361
first->gso_segs = 1;
43744362

4375-
#ifdef CONFIG_IGB_PTP
43764363
if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
43774364
!(adapter->ptp_tx_skb))) {
43784365
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
@@ -4382,7 +4369,6 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
43824369
if (adapter->hw.mac.type == e1000_82576)
43834370
schedule_work(&adapter->ptp_tx_work);
43844371
}
4385-
#endif /* CONFIG_IGB_PTP */
43864372

43874373
if (vlan_tx_tag_present(skb)) {
43884374
tx_flags |= IGB_TX_FLAGS_VLAN;
@@ -4776,7 +4762,6 @@ static irqreturn_t igb_msix_other(int irq, void *data)
47764762
mod_timer(&adapter->watchdog_timer, jiffies + 1);
47774763
}
47784764

4779-
#ifdef CONFIG_IGB_PTP
47804765
if (icr & E1000_ICR_TS) {
47814766
u32 tsicr = rd32(E1000_TSICR);
47824767

@@ -4787,7 +4772,6 @@ static irqreturn_t igb_msix_other(int irq, void *data)
47874772
schedule_work(&adapter->ptp_tx_work);
47884773
}
47894774
}
4790-
#endif /* CONFIG_IGB_PTP */
47914775

47924776
wr32(E1000_EIMS, adapter->eims_other);
47934777

@@ -5539,7 +5523,6 @@ static irqreturn_t igb_intr_msi(int irq, void *data)
55395523
mod_timer(&adapter->watchdog_timer, jiffies + 1);
55405524
}
55415525

5542-
#ifdef CONFIG_IGB_PTP
55435526
if (icr & E1000_ICR_TS) {
55445527
u32 tsicr = rd32(E1000_TSICR);
55455528

@@ -5550,7 +5533,6 @@ static irqreturn_t igb_intr_msi(int irq, void *data)
55505533
schedule_work(&adapter->ptp_tx_work);
55515534
}
55525535
}
5553-
#endif /* CONFIG_IGB_PTP */
55545536

55555537
napi_schedule(&q_vector->napi);
55565538

@@ -5593,7 +5575,6 @@ static irqreturn_t igb_intr(int irq, void *data)
55935575
mod_timer(&adapter->watchdog_timer, jiffies + 1);
55945576
}
55955577

5596-
#ifdef CONFIG_IGB_PTP
55975578
if (icr & E1000_ICR_TS) {
55985579
u32 tsicr = rd32(E1000_TSICR);
55995580

@@ -5604,7 +5585,6 @@ static irqreturn_t igb_intr(int irq, void *data)
56045585
schedule_work(&adapter->ptp_tx_work);
56055586
}
56065587
}
5607-
#endif /* CONFIG_IGB_PTP */
56085588

56095589
napi_schedule(&q_vector->napi);
56105590

@@ -5889,14 +5869,12 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring,
58895869
if ((size <= IGB_RX_HDR_LEN) && !skb_is_nonlinear(skb)) {
58905870
unsigned char *va = page_address(page) + rx_buffer->page_offset;
58915871

5892-
#ifdef CONFIG_IGB_PTP
58935872
if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
58945873
igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb);
58955874
va += IGB_TS_HDR_LEN;
58965875
size -= IGB_TS_HDR_LEN;
58975876
}
58985877

5899-
#endif
59005878
memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long)));
59015879

59025880
/* we can reuse buffer as-is, just make sure it is local */
@@ -6221,7 +6199,6 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
62216199
*/
62226200
va = skb_frag_address(frag);
62236201

6224-
#ifdef CONFIG_IGB_PTP
62256202
if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
62266203
/* retrieve timestamp from buffer */
62276204
igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb);
@@ -6236,7 +6213,6 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
62366213
va += IGB_TS_HDR_LEN;
62376214
}
62386215

6239-
#endif
62406216
/*
62416217
* we need the header to contain the greater of either ETH_HLEN or
62426218
* 60 bytes if the skb->len is less than 60 for skb_pad.
@@ -6317,9 +6293,7 @@ static void igb_process_skb_fields(struct igb_ring *rx_ring,
63176293

63186294
igb_rx_checksum(rx_ring, rx_desc, skb);
63196295

6320-
#ifdef CONFIG_IGB_PTP
63216296
igb_ptp_rx_hwtstamp(rx_ring->q_vector, rx_desc, skb);
6322-
#endif /* CONFIG_IGB_PTP */
63236297

63246298
if ((dev->features & NETIF_F_HW_VLAN_RX) &&
63256299
igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) {
@@ -6553,10 +6527,8 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
65536527
case SIOCGMIIREG:
65546528
case SIOCSMIIREG:
65556529
return igb_mii_ioctl(netdev, ifr, cmd);
6556-
#ifdef CONFIG_IGB_PTP
65576530
case SIOCSHWTSTAMP:
65586531
return igb_ptp_hwtstamp_ioctl(netdev, ifr, cmd);
6559-
#endif /* CONFIG_IGB_PTP */
65606532
default:
65616533
return -EOPNOTSUPP;
65626534
}

‎drivers/net/ethernet/intel/ixgbe/Makefile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ obj-$(CONFIG_IXGBE) += ixgbe.o
3434

3535
ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o ixgbe_debugfs.o\
3636
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
3838

3939
ixgbe-$(CONFIG_IXGBE_DCB) += ixgbe_dcb.o ixgbe_dcb_82598.o \
4040
ixgbe_dcb_82599.o ixgbe_dcb_nl.o
4141

42-
ixgbe-$(CONFIG_IXGBE_PTP) += ixgbe_ptp.o
4342
ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o
4443
ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o

‎drivers/net/ethernet/intel/ixgbe/ixgbe.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@
3636
#include <linux/aer.h>
3737
#include <linux/if_vlan.h>
3838

39-
#ifdef CONFIG_IXGBE_PTP
4039
#include <linux/clocksource.h>
4140
#include <linux/net_tstamp.h>
4241
#include <linux/ptp_clock_kernel.h>
43-
#endif /* CONFIG_IXGBE_PTP */
4442

4543
#include "ixgbe_type.h"
4644
#include "ixgbe_common.h"
@@ -572,7 +570,6 @@ struct ixgbe_adapter {
572570
u32 interrupt_event;
573571
u32 led_reg;
574572

575-
#ifdef CONFIG_IXGBE_PTP
576573
struct ptp_clock *ptp_clock;
577574
struct ptp_clock_info ptp_caps;
578575
unsigned long last_overflow_check;
@@ -581,7 +578,6 @@ struct ixgbe_adapter {
581578
struct timecounter tc;
582579
int rx_hwtstamp_filter;
583580
u32 base_incval;
584-
#endif /* CONFIG_IXGBE_PTP */
585581

586582
/* SR-IOV */
587583
DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS);
@@ -742,7 +738,6 @@ static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring)
742738
return netdev_get_tx_queue(ring->netdev, ring->queue_index);
743739
}
744740

745-
#ifdef CONFIG_IXGBE_PTP
746741
extern void ixgbe_ptp_init(struct ixgbe_adapter *adapter);
747742
extern void ixgbe_ptp_stop(struct ixgbe_adapter *adapter);
748743
extern void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter);
@@ -756,6 +751,5 @@ extern int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter,
756751
extern void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter);
757752
extern void ixgbe_ptp_reset(struct ixgbe_adapter *adapter);
758753
extern void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr);
759-
#endif /* CONFIG_IXGBE_PTP */
760754

761755
#endif /* _IXGBE_H_ */

‎drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,7 +2667,6 @@ static int ixgbe_get_ts_info(struct net_device *dev,
26672667
struct ixgbe_adapter *adapter = netdev_priv(dev);
26682668

26692669
switch (adapter->hw.mac.type) {
2670-
#ifdef CONFIG_IXGBE_PTP
26712670
case ixgbe_mac_X540:
26722671
case ixgbe_mac_82599EB:
26732672
info->so_timestamping =
@@ -2690,7 +2689,6 @@ static int ixgbe_get_ts_info(struct net_device *dev,
26902689
(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
26912690
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
26922691
break;
2693-
#endif /* CONFIG_IXGBE_PTP */
26942692
default:
26952693
return ethtool_op_get_ts_info(dev, info);
26962694
break;

0 commit comments

Comments
 (0)