From patchwork Wed Sep 14 13:02:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 9331419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 60102607FD for ; Wed, 14 Sep 2016 13:04:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50F532921C for ; Wed, 14 Sep 2016 13:04:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45BB229DC7; Wed, 14 Sep 2016 13:04:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C7BE29DC2 for ; Wed, 14 Sep 2016 13:03:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762274AbcINNDz (ORCPT ); Wed, 14 Sep 2016 09:03:55 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:51700 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762008AbcINNCp (ORCPT ); Wed, 14 Sep 2016 09:02:45 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id u8ED2h8i016713; Wed, 14 Sep 2016 08:02:43 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u8ED2gGW028849; Wed, 14 Sep 2016 08:02:42 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Wed, 14 Sep 2016 08:02:41 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u8ED2fKx012883; Wed, 14 Sep 2016 08:02:41 -0500 From: Grygorii Strashko To: "David S. Miller" , , Mugunthan V N , Richard Cochran CC: Sekhar Nori , , , WingMan Kwok , Grygorii Strashko Subject: [PATCH 5/9] net: ethernet: ti: cpts: add return value to tx and rx timestamp funcitons Date: Wed, 14 Sep 2016 16:02:27 +0300 Message-ID: <20160914130231.3035-6-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160914130231.3035-1-grygorii.strashko@ti.com> References: <20160914130231.3035-1-grygorii.strashko@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: WingMan Kwok Added return values in tx and rx timestamp funcitons facilitate the possibililies of timestamping by CPSW modules other than CPTS, such as packet accelerator on Keystone 2 devices. Signed-off-by: WingMan Kwok Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/cpts.c | 16 ++++++++++------ drivers/net/ethernet/ti/cpts.h | 11 +++++++---- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index 1ee64c6..970d4e2 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c @@ -302,34 +302,38 @@ static u64 cpts_find_ts(struct cpts *cpts, struct sk_buff *skb, int ev_type) return ns; } -void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb) +int cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb) { u64 ns; struct skb_shared_hwtstamps *ssh; if (!cpts || !cpts->rx_enable) - return; + return -EPERM; ns = cpts_find_ts(cpts, skb, CPTS_EV_RX); if (!ns) - return; + return -ENOENT; ssh = skb_hwtstamps(skb); memset(ssh, 0, sizeof(*ssh)); ssh->hwtstamp = ns_to_ktime(ns); + + return 0; } -void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb) +int cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb) { u64 ns; struct skb_shared_hwtstamps ssh; if (!cpts || !(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) - return; + return -EPERM; ns = cpts_find_ts(cpts, skb, CPTS_EV_TX); if (!ns) - return; + return -ENOENT; memset(&ssh, 0, sizeof(ssh)); ssh.hwtstamp = ns_to_ktime(ns); skb_tstamp_tx(skb, &ssh); + + return 0; } int cpts_register(struct cpts *cpts) diff --git a/drivers/net/ethernet/ti/cpts.h b/drivers/net/ethernet/ti/cpts.h index a865193..47026ec 100644 --- a/drivers/net/ethernet/ti/cpts.h +++ b/drivers/net/ethernet/ti/cpts.h @@ -129,8 +129,8 @@ struct cpts { struct cpts_event pool_data[CPTS_MAX_EVENTS]; }; -void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb); -void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb); +int cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb); +int cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb); int cpts_register(struct cpts *cpts); void cpts_unregister(struct cpts *cpts); struct cpts *cpts_create(struct device *dev, void __iomem *regs, @@ -162,11 +162,14 @@ static inline bool cpts_is_tx_enabled(struct cpts *cpts) #else struct cpts; -static inline void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb) +static inline int cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb) { + return -EOPNOTSUPP; } -static inline void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb) + +static inline int cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb) { + return -EOPNOTSUPP; } static inline