Commit 358dfb6d authored by Takahiro Shimizu's avatar Takahiro Shimizu Committed by David S. Miller

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: default avatarTakahiro Shimizu <tshimizu818@gmail.com>
Signed-off-by: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a6891ac7
...@@ -111,6 +111,9 @@ const char pch_driver_version[] = DRV_VERSION; ...@@ -111,6 +111,9 @@ const char pch_driver_version[] = DRV_VERSION;
/* 0x44 Time Synchronization Channel Event Register Bits */ /* 0x44 Time Synchronization Channel Event Register Bits */
#define TX_SNAPSHOT_LOCKED (1<<0) #define TX_SNAPSHOT_LOCKED (1<<0)
#define RX_SNAPSHOT_LOCKED (1<<1) #define RX_SNAPSHOT_LOCKED (1<<1)
#define PTP_L4_MULTICAST_SA "01:00:5e:00:01:81"
#define PTP_L2_MULTICAST_SA "01:1b:19:00:00:00"
#endif #endif
static unsigned int copybreak __read_mostly = PCH_GBE_COPYBREAK_DEFAULT; static 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,6 +239,7 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
struct hwtstamp_config cfg; struct hwtstamp_config cfg;
struct pch_gbe_adapter *adapter = netdev_priv(netdev); struct pch_gbe_adapter *adapter = netdev_priv(netdev);
struct pci_dev *pdev; struct pci_dev *pdev;
u8 station[20];
if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
return -EFAULT; return -EFAULT;
...@@ -269,9 +273,17 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) ...@@ -269,9 +273,17 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
adapter->hwts_rx_en = 1; adapter->hwts_rx_en = 1;
pch_ch_control_write(pdev, MASTER_MODE | CAP_MODE0); pch_ch_control_write(pdev, MASTER_MODE | CAP_MODE0);
break; break;
case HWTSTAMP_FILTER_PTP_V2_EVENT: case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
adapter->hwts_rx_en = 1;
pch_ch_control_write(pdev, V2_MODE | CAP_MODE2);
strcpy(station, PTP_L4_MULTICAST_SA);
pch_set_station_address(station, pdev);
break;
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
adapter->hwts_rx_en = 1; adapter->hwts_rx_en = 1;
pch_ch_control_write(pdev, V2_MODE | CAP_MODE2); pch_ch_control_write(pdev, V2_MODE | CAP_MODE2);
strcpy(station, PTP_L2_MULTICAST_SA);
pch_set_station_address(station, pdev);
break; break;
default: default:
return -ERANGE; return -ERANGE;
......
...@@ -78,9 +78,13 @@ config PTP_1588_CLOCK_PCH ...@@ -78,9 +78,13 @@ config PTP_1588_CLOCK_PCH
depends on PCH_GBE depends on PCH_GBE
help help
This driver adds support for using the PCH EG20T as a PTP This driver adds support for using the PCH EG20T as a PTP
clock. This clock is only useful if your PTP programs are clock. The hardware supports time stamping of PTP packets
getting hardware time stamps on the PTP Ethernet packets when using the end-to-end delay (E2E) mechansim. The peer
using the SO_TIMESTAMPING API. delay mechansim (P2P) is not supported.
This clock is only useful if your PTP programs are getting
hardware time stamps on the PTP Ethernet packets using the
SO_TIMESTAMPING API.
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
will be called ptp_pch. will be called ptp_pch.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment