aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakahiro Shimizu <tshimizu818@gmail.com>2012-04-20 14:50:34 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-21 15:27:45 -0400
commit358dfb6d77c016af764c0f7007697e5f5bc322c2 (patch)
treeaa2636c3b81bbfa9cf521fc8a474d8e4a77bbbfe
parenta6891ac70c99be5312c9aea9e38169e4cbb4f099 (diff)
pch_gbe: correct receive time stamp filtering
This patch fixes the driver so that multicast PTP event messages can be recognized by the hardware time stamping unit. The station address register must be set according to the desired transport type. [ RC - Rebased Takahiro's changes and wrote a commit message explaining the changes. ] Signed-off-by: Takahiro Shimizu <tshimizu818@gmail.com> Signed-off-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c14
-rw-r--r--drivers/ptp/Kconfig10
2 files changed, 20 insertions, 4 deletions
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 799a85aa12b3..53ac2fb78ab6 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -111,6 +111,9 @@ const char pch_driver_version[] = DRV_VERSION;
111/* 0x44 Time Synchronization Channel Event Register Bits */ 111/* 0x44 Time Synchronization Channel Event Register Bits */
112#define TX_SNAPSHOT_LOCKED (1<<0) 112#define TX_SNAPSHOT_LOCKED (1<<0)
113#define RX_SNAPSHOT_LOCKED (1<<1) 113#define RX_SNAPSHOT_LOCKED (1<<1)
114
115#define PTP_L4_MULTICAST_SA "01:00:5e:00:01:81"
116#define PTP_L2_MULTICAST_SA "01:1b:19:00:00:00"
114#endif 117#endif
115 118
116static unsigned int copybreak __read_mostly = PCH_GBE_COPYBREAK_DEFAULT; 119static unsigned int copybreak __read_mostly = PCH_GBE_COPYBREAK_DEFAULT;
@@ -236,6 +239,7 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
236 struct hwtstamp_config cfg; 239 struct hwtstamp_config cfg;
237 struct pch_gbe_adapter *adapter = netdev_priv(netdev); 240 struct pch_gbe_adapter *adapter = netdev_priv(netdev);
238 struct pci_dev *pdev; 241 struct pci_dev *pdev;
242 u8 station[20];
239 243
240 if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) 244 if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
241 return -EFAULT; 245 return -EFAULT;
@@ -269,9 +273,17 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
269 adapter->hwts_rx_en = 1; 273 adapter->hwts_rx_en = 1;
270 pch_ch_control_write(pdev, MASTER_MODE | CAP_MODE0); 274 pch_ch_control_write(pdev, MASTER_MODE | CAP_MODE0);
271 break; 275 break;
272 case HWTSTAMP_FILTER_PTP_V2_EVENT: 276 case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
277 adapter->hwts_rx_en = 1;
278 pch_ch_control_write(pdev, V2_MODE | CAP_MODE2);
279 strcpy(station, PTP_L4_MULTICAST_SA);
280 pch_set_station_address(station, pdev);
281 break;
282 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
273 adapter->hwts_rx_en = 1; 283 adapter->hwts_rx_en = 1;
274 pch_ch_control_write(pdev, V2_MODE | CAP_MODE2); 284 pch_ch_control_write(pdev, V2_MODE | CAP_MODE2);
285 strcpy(station, PTP_L2_MULTICAST_SA);
286 pch_set_station_address(station, pdev);
275 break; 287 break;
276 default: 288 default:
277 return -ERANGE; 289 return -ERANGE;
diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
index cd9bc3b129bc..5648dad71fb3 100644
--- a/drivers/ptp/Kconfig
+++ b/drivers/ptp/Kconfig
@@ -78,9 +78,13 @@ config PTP_1588_CLOCK_PCH
78 depends on PCH_GBE 78 depends on PCH_GBE
79 help 79 help
80 This driver adds support for using the PCH EG20T as a PTP 80 This driver adds support for using the PCH EG20T as a PTP
81 clock. This clock is only useful if your PTP programs are 81 clock. The hardware supports time stamping of PTP packets
82 getting hardware time stamps on the PTP Ethernet packets 82 when using the end-to-end delay (E2E) mechansim. The peer
83 using the SO_TIMESTAMPING API. 83 delay mechansim (P2P) is not supported.
84
85 This clock is only useful if your PTP programs are getting
86 hardware time stamps on the PTP Ethernet packets using the
87 SO_TIMESTAMPING API.
84 88
85 To compile this driver as a module, choose M here: the module 89 To compile this driver as a module, choose M here: the module
86 will be called ptp_pch. 90 will be called ptp_pch.