From patchwork Sat Apr 21 04:50:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Cochran X-Patchwork-Id: 154200 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1685DB6FC4 for ; Sat, 21 Apr 2012 14:51:27 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753013Ab2DUEvX (ORCPT ); Sat, 21 Apr 2012 00:51:23 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:47181 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752089Ab2DUEvH (ORCPT ); Sat, 21 Apr 2012 00:51:07 -0400 Received: by mail-we0-f174.google.com with SMTP id x9so6444599wej.19 for ; Fri, 20 Apr 2012 21:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references; bh=VnjzCQ7w2rRwtWW34Lk4UdaoA11XuCQHdNY/UC+AozA=; b=p3wTWFOeZwMwkhBO+hWWP2OL72gUK+icyMaUGyWPAq0U1es06NQgDM8WFvs+KzYWpB SvAwRNsvkj3IOKw5IC+praNmO7iQylrE614455QNnHpgcP932huIsLFBtMIAwngtwXum ofFl1TE39YlgwcufoyHZCvF27lLzZBQe+sMKyF/mVFcs/5ydBbN2lW5gJjF6t//6E5Ek anm646KGoxwkxG77xF3jJMqFO2i9pEGUyDUo/fb4GdT9idtVYN6zJmDKVKY6pQ61EYqF XauThsO1VL00xo+QDDujLlA22diXU6GRZyd8H8LufOfTIzoEcH6jDvbsJ4F1QC7B3CHk JqeA== Received: by 10.216.139.29 with SMTP id b29mr5395288wej.55.1334983867034; Fri, 20 Apr 2012 21:51:07 -0700 (PDT) Received: from localhost.localdomain (089144206131.atnat0015.highway.a1.net. [89.144.206.131]) by mx.google.com with ESMTPS id k6sm2512285wiy.7.2012.04.20.21.51.04 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 20 Apr 2012 21:51:06 -0700 (PDT) From: Richard Cochran To: Cc: David Miller , Takahiro Shimizu Subject: [PATCH net-next 7/9] pch_gbe: correct receive time stamp filtering Date: Sat, 21 Apr 2012 06:50:34 +0200 Message-Id: <5678b66eb82302bf55fee639afd2f906eb97c806.1334983471.git.richardcochran@gmail.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Takahiro Shimizu 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 Signed-off-by: Richard Cochran --- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 14 +++++++++++++- drivers/ptp/Kconfig | 10 +++++++--- 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 799a85a..53ac2fb 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; /* 0x44 Time Synchronization Channel Event Register Bits */ #define TX_SNAPSHOT_LOCKED (1<<0) #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 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) struct hwtstamp_config cfg; struct pch_gbe_adapter *adapter = netdev_priv(netdev); struct pci_dev *pdev; + u8 station[20]; if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) return -EFAULT; @@ -269,9 +273,17 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) adapter->hwts_rx_en = 1; pch_ch_control_write(pdev, MASTER_MODE | CAP_MODE0); 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; pch_ch_control_write(pdev, V2_MODE | CAP_MODE2); + strcpy(station, PTP_L2_MULTICAST_SA); + pch_set_station_address(station, pdev); break; default: return -ERANGE; diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig index cd9bc3b..5648dad 100644 --- a/drivers/ptp/Kconfig +++ b/drivers/ptp/Kconfig @@ -78,9 +78,13 @@ config PTP_1588_CLOCK_PCH depends on PCH_GBE help This driver adds support for using the PCH EG20T as a PTP - clock. This clock is only useful if your PTP programs are - getting hardware time stamps on the PTP Ethernet packets - using the SO_TIMESTAMPING API. + clock. The hardware supports time stamping of PTP packets + when using the end-to-end delay (E2E) mechansim. The peer + 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 will be called ptp_pch.