aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatthew Vick <matthew.vick@intel.com>2012-08-10 01:40:43 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-09-17 05:04:05 -0400
commit3c89f6d0d4aa92ff252c17f8f6b5c8983ae2b77e (patch)
treebad0f3f664d52709fd942e81296bf5ed565f494a /drivers
parentba01dfe18241bf89b058fd8a60218b218ad2bb30 (diff)
igb: Tidy up wrapping for CONFIG_IGB_PTP.
For users without CONFIG_IGB_PTP=y, we should not be compiling any PTP code into the driver. Tidy up the wrapping in igb to support this. Cc: Richard Cochran <richardcochran@gmail.com> Signed-off-by: Matthew Vick <matthew.vick@intel.com> Acked-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h8
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ethtool.c4
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c23
3 files changed, 25 insertions, 10 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index 0c9f62caa8fa..a3b5b908448a 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -34,9 +34,11 @@
34#include "e1000_mac.h" 34#include "e1000_mac.h"
35#include "e1000_82575.h" 35#include "e1000_82575.h"
36 36
37#ifdef CONFIG_IGB_PTP
37#include <linux/clocksource.h> 38#include <linux/clocksource.h>
38#include <linux/net_tstamp.h> 39#include <linux/net_tstamp.h>
39#include <linux/ptp_clock_kernel.h> 40#include <linux/ptp_clock_kernel.h>
41#endif /* CONFIG_IGB_PTP */
40#include <linux/bitops.h> 42#include <linux/bitops.h>
41#include <linux/if_vlan.h> 43#include <linux/if_vlan.h>
42 44
@@ -376,12 +378,15 @@ struct igb_adapter {
376 int node; 378 int node;
377 u32 *shadow_vfta; 379 u32 *shadow_vfta;
378 380
381#ifdef CONFIG_IGB_PTP
379 struct ptp_clock *ptp_clock; 382 struct ptp_clock *ptp_clock;
380 struct ptp_clock_info caps; 383 struct ptp_clock_info caps;
381 struct delayed_work overflow_work; 384 struct delayed_work overflow_work;
382 spinlock_t tmreg_lock; 385 spinlock_t tmreg_lock;
383 struct cyclecounter cc; 386 struct cyclecounter cc;
384 struct timecounter tc; 387 struct timecounter tc;
388#endif /* CONFIG_IGB_PTP */
389
385 char fw_version[32]; 390 char fw_version[32];
386}; 391};
387 392
@@ -436,12 +441,11 @@ extern void igb_set_fw_version(struct igb_adapter *);
436#ifdef CONFIG_IGB_PTP 441#ifdef CONFIG_IGB_PTP
437extern void igb_ptp_init(struct igb_adapter *adapter); 442extern void igb_ptp_init(struct igb_adapter *adapter);
438extern void igb_ptp_remove(struct igb_adapter *adapter); 443extern void igb_ptp_remove(struct igb_adapter *adapter);
439
440extern void igb_systim_to_hwtstamp(struct igb_adapter *adapter, 444extern void igb_systim_to_hwtstamp(struct igb_adapter *adapter,
441 struct skb_shared_hwtstamps *hwtstamps, 445 struct skb_shared_hwtstamps *hwtstamps,
442 u64 systim); 446 u64 systim);
447#endif /* CONFIG_IGB_PTP */
443 448
444#endif
445static inline s32 igb_reset_phy(struct e1000_hw *hw) 449static inline s32 igb_reset_phy(struct e1000_hw *hw)
446{ 450{
447 if (hw->phy.ops.reset) 451 if (hw->phy.ops.reset)
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index a2944412a55e..0c4e29aa24c7 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2338,8 +2338,8 @@ static int igb_ethtool_get_ts_info(struct net_device *dev,
2338 2338
2339 return 0; 2339 return 0;
2340} 2340}
2341#endif /* CONFIG_IGB_PTP */
2341 2342
2342#endif
2343static const struct ethtool_ops igb_ethtool_ops = { 2343static const struct ethtool_ops igb_ethtool_ops = {
2344 .get_settings = igb_get_settings, 2344 .get_settings = igb_get_settings,
2345 .set_settings = igb_set_settings, 2345 .set_settings = igb_set_settings,
@@ -2370,7 +2370,7 @@ static const struct ethtool_ops igb_ethtool_ops = {
2370 .complete = igb_ethtool_complete, 2370 .complete = igb_ethtool_complete,
2371#ifdef CONFIG_IGB_PTP 2371#ifdef CONFIG_IGB_PTP
2372 .get_ts_info = igb_ethtool_get_ts_info, 2372 .get_ts_info = igb_ethtool_get_ts_info,
2373#endif 2373#endif /* CONFIG_IGB_PTP */
2374}; 2374};
2375 2375
2376void igb_set_ethtool_ops(struct net_device *netdev) 2376void igb_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 73cc273ef98b..03477d7451e4 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2180,11 +2180,12 @@ static int __devinit igb_probe(struct pci_dev *pdev,
2180 } 2180 }
2181 2181
2182#endif 2182#endif
2183
2183#ifdef CONFIG_IGB_PTP 2184#ifdef CONFIG_IGB_PTP
2184 /* do hw tstamp init after resetting */ 2185 /* do hw tstamp init after resetting */
2185 igb_ptp_init(adapter); 2186 igb_ptp_init(adapter);
2187#endif /* CONFIG_IGB_PTP */
2186 2188
2187#endif
2188 dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n"); 2189 dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n");
2189 /* print bus type/speed/width info */ 2190 /* print bus type/speed/width info */
2190 dev_info(&pdev->dev, "%s: (PCIe:%s:%s) %pM\n", 2191 dev_info(&pdev->dev, "%s: (PCIe:%s:%s) %pM\n",
@@ -2260,8 +2261,8 @@ static void __devexit igb_remove(struct pci_dev *pdev)
2260 pm_runtime_get_noresume(&pdev->dev); 2261 pm_runtime_get_noresume(&pdev->dev);
2261#ifdef CONFIG_IGB_PTP 2262#ifdef CONFIG_IGB_PTP
2262 igb_ptp_remove(adapter); 2263 igb_ptp_remove(adapter);
2264#endif /* CONFIG_IGB_PTP */
2263 2265
2264#endif
2265 /* 2266 /*
2266 * The watchdog timer may be rescheduled, so explicitly 2267 * The watchdog timer may be rescheduled, so explicitly
2267 * disable watchdog from being rescheduled. 2268 * disable watchdog from being rescheduled.
@@ -3184,8 +3185,10 @@ void igb_configure_rx_ring(struct igb_adapter *adapter,
3184 srrctl |= (PAGE_SIZE / 2) >> E1000_SRRCTL_BSIZEPKT_SHIFT; 3185 srrctl |= (PAGE_SIZE / 2) >> E1000_SRRCTL_BSIZEPKT_SHIFT;
3185#endif 3186#endif
3186 srrctl |= E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS; 3187 srrctl |= E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;
3188#ifdef CONFIG_IGB_PTP
3187 if (hw->mac.type >= e1000_82580) 3189 if (hw->mac.type >= e1000_82580)
3188 srrctl |= E1000_SRRCTL_TIMESTAMP; 3190 srrctl |= E1000_SRRCTL_TIMESTAMP;
3191#endif /* CONFIG_IGB_PTP */
3189 /* Only set Drop Enable if we are supporting multiple queues */ 3192 /* Only set Drop Enable if we are supporting multiple queues */
3190 if (adapter->vfs_allocated_count || adapter->num_rx_queues > 1) 3193 if (adapter->vfs_allocated_count || adapter->num_rx_queues > 1)
3191 srrctl |= E1000_SRRCTL_DROP_EN; 3194 srrctl |= E1000_SRRCTL_DROP_EN;
@@ -4229,9 +4232,11 @@ static __le32 igb_tx_cmd_type(u32 tx_flags)
4229 if (tx_flags & IGB_TX_FLAGS_VLAN) 4232 if (tx_flags & IGB_TX_FLAGS_VLAN)
4230 cmd_type |= cpu_to_le32(E1000_ADVTXD_DCMD_VLE); 4233 cmd_type |= cpu_to_le32(E1000_ADVTXD_DCMD_VLE);
4231 4234
4235#ifdef CONFIG_IGB_PTP
4232 /* set timestamp bit if present */ 4236 /* set timestamp bit if present */
4233 if (tx_flags & IGB_TX_FLAGS_TSTAMP) 4237 if (tx_flags & IGB_TX_FLAGS_TSTAMP)
4234 cmd_type |= cpu_to_le32(E1000_ADVTXD_MAC_TSTAMP); 4238 cmd_type |= cpu_to_le32(E1000_ADVTXD_MAC_TSTAMP);
4239#endif /* CONFIG_IGB_PTP */
4235 4240
4236 /* set segmentation bits for TSO */ 4241 /* set segmentation bits for TSO */
4237 if (tx_flags & IGB_TX_FLAGS_TSO) 4242 if (tx_flags & IGB_TX_FLAGS_TSO)
@@ -4462,10 +4467,12 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
4462 first->bytecount = skb->len; 4467 first->bytecount = skb->len;
4463 first->gso_segs = 1; 4468 first->gso_segs = 1;
4464 4469
4470#ifdef CONFIG_IGB_PTP
4465 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { 4471 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
4466 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 4472 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
4467 tx_flags |= IGB_TX_FLAGS_TSTAMP; 4473 tx_flags |= IGB_TX_FLAGS_TSTAMP;
4468 } 4474 }
4475#endif /* CONFIG_IGB_PTP */
4469 4476
4470 if (vlan_tx_tag_present(skb)) { 4477 if (vlan_tx_tag_present(skb)) {
4471 tx_flags |= IGB_TX_FLAGS_VLAN; 4478 tx_flags |= IGB_TX_FLAGS_VLAN;
@@ -5772,8 +5779,8 @@ static void igb_tx_hwtstamp(struct igb_q_vector *q_vector,
5772 igb_systim_to_hwtstamp(adapter, &shhwtstamps, regval); 5779 igb_systim_to_hwtstamp(adapter, &shhwtstamps, regval);
5773 skb_tstamp_tx(buffer_info->skb, &shhwtstamps); 5780 skb_tstamp_tx(buffer_info->skb, &shhwtstamps);
5774} 5781}
5782#endif /* CONFIG_IGB_PTP */
5775 5783
5776#endif
5777/** 5784/**
5778 * igb_clean_tx_irq - Reclaim resources after transmit completes 5785 * igb_clean_tx_irq - Reclaim resources after transmit completes
5779 * @q_vector: pointer to q_vector containing needed info 5786 * @q_vector: pointer to q_vector containing needed info
@@ -5821,8 +5828,8 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
5821#ifdef CONFIG_IGB_PTP 5828#ifdef CONFIG_IGB_PTP
5822 /* retrieve hardware timestamp */ 5829 /* retrieve hardware timestamp */
5823 igb_tx_hwtstamp(q_vector, tx_buffer); 5830 igb_tx_hwtstamp(q_vector, tx_buffer);
5831#endif /* CONFIG_IGB_PTP */
5824 5832
5825#endif
5826 /* free the skb */ 5833 /* free the skb */
5827 dev_kfree_skb_any(tx_buffer->skb); 5834 dev_kfree_skb_any(tx_buffer->skb);
5828 tx_buffer->skb = NULL; 5835 tx_buffer->skb = NULL;
@@ -6033,8 +6040,8 @@ static void igb_rx_hwtstamp(struct igb_q_vector *q_vector,
6033 6040
6034 igb_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval); 6041 igb_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval);
6035} 6042}
6043#endif /* CONFIG_IGB_PTP */
6036 6044
6037#endif
6038static void igb_rx_vlan(struct igb_ring *ring, 6045static void igb_rx_vlan(struct igb_ring *ring,
6039 union e1000_adv_rx_desc *rx_desc, 6046 union e1000_adv_rx_desc *rx_desc,
6040 struct sk_buff *skb) 6047 struct sk_buff *skb)
@@ -6147,7 +6154,7 @@ static bool igb_clean_rx_irq(struct igb_q_vector *q_vector, int budget)
6147 6154
6148#ifdef CONFIG_IGB_PTP 6155#ifdef CONFIG_IGB_PTP
6149 igb_rx_hwtstamp(q_vector, rx_desc, skb); 6156 igb_rx_hwtstamp(q_vector, rx_desc, skb);
6150#endif 6157#endif /* CONFIG_IGB_PTP */
6151 igb_rx_hash(rx_ring, rx_desc, skb); 6158 igb_rx_hash(rx_ring, rx_desc, skb);
6152 igb_rx_checksum(rx_ring, rx_desc, skb); 6159 igb_rx_checksum(rx_ring, rx_desc, skb);
6153 igb_rx_vlan(rx_ring, rx_desc, skb); 6160 igb_rx_vlan(rx_ring, rx_desc, skb);
@@ -6340,6 +6347,7 @@ static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
6340 return 0; 6347 return 0;
6341} 6348}
6342 6349
6350#ifdef CONFIG_IGB_PTP
6343/** 6351/**
6344 * igb_hwtstamp_ioctl - control hardware time stamping 6352 * igb_hwtstamp_ioctl - control hardware time stamping
6345 * @netdev: 6353 * @netdev:
@@ -6514,6 +6522,7 @@ static int igb_hwtstamp_ioctl(struct net_device *netdev,
6514 return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? 6522 return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
6515 -EFAULT : 0; 6523 -EFAULT : 0;
6516} 6524}
6525#endif /* CONFIG_IGB_PTP */
6517 6526
6518/** 6527/**
6519 * igb_ioctl - 6528 * igb_ioctl -
@@ -6528,8 +6537,10 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
6528 case SIOCGMIIREG: 6537 case SIOCGMIIREG:
6529 case SIOCSMIIREG: 6538 case SIOCSMIIREG:
6530 return igb_mii_ioctl(netdev, ifr, cmd); 6539 return igb_mii_ioctl(netdev, ifr, cmd);
6540#ifdef CONFIG_IGB_PTP
6531 case SIOCSHWTSTAMP: 6541 case SIOCSHWTSTAMP:
6532 return igb_hwtstamp_ioctl(netdev, ifr, cmd); 6542 return igb_hwtstamp_ioctl(netdev, ifr, cmd);
6543#endif /* CONFIG_IGB_PTP */
6533 default: 6544 default:
6534 return -EOPNOTSUPP; 6545 return -EOPNOTSUPP;
6535 } 6546 }