Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3626013imm; Mon, 4 Jun 2018 06:50:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKy/2rtiFxpr3XWsXcKDcTfluxSOjRpJmPB7GMkFBKvQ74M8lG3s3RCtp84IPojO/h6m879 X-Received: by 2002:a62:211a:: with SMTP id h26-v6mr10808392pfh.133.1528120220329; Mon, 04 Jun 2018 06:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528120220; cv=none; d=google.com; s=arc-20160816; b=T9uYS4OysE6jlrBd19iowfcGdA/UsQGTwrPswIMt/iKKTREXY5MoYwtYVczDOTsvNo oQmRM/qFhWOoB4hZON74Mad3M1PBH6OjWIE37JIuEXKfcolbDqgbXPR1mLBRzCXzzuhK Ax5J0VUL2dWCGsAIJC7BBjww1JMrafIRHpV2qoSmr9X8jEDAC4Iq2+lfuxLqpDR7y6sY OkqGeV18TBCM/9k87u+aktAz92KZgf7DtJ2cy8+wE4HtAw4G/1t03/96sVhApi02Ohlp GJ11708XzPqohVN9u1wolcxGM8SP9fI/QSpEMTj3HEYndRbX0ymJbLrdkaS7vC4tQnxI Sfzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=511tc79nHjJUy57blXtkOV0scAlpCBCWZUYry2U9aa8=; b=0OHYvfgJUSqUA3T1rik7qPyrwt9YicJLcUydRhdQoDuJgPPfv9Yq0ZEgMpD/n0G+2F VJoidyiU9Lru2C2llQbEX/s/AB75us3cEWxSUXgxGXlZ+WH/QyEe6sR0QSl+v6OiHIPw ncsmlrZIZPrHZAb0ZqNbYyEKD40oZUReaekBCvovJbCoiRltgm/pYZKG+AE9ElJuC/FN DzZ+McVFWXKG8NxD5OmyYaQLs5Cv4z0BmsHtrvK7Zl0MNrLmGzeSlOB2h+YQmBa/ZCse RcCaoLEhZaxovQ9qwFfBBuUqCNdKl7A2S0CZTbe5YDl1leR8vyeW1XPGKtQwtuIrns2y NKtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uYupxqVC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8-v6si36270759pgp.527.2018.06.04.06.50.05; Mon, 04 Jun 2018 06:50:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uYupxqVC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753357AbeFDNt1 (ORCPT + 99 others); Mon, 4 Jun 2018 09:49:27 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:34715 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753063AbeFDNtY (ORCPT ); Mon, 4 Jun 2018 09:49:24 -0400 Received: by mail-pl0-f65.google.com with SMTP id g20-v6so1974799plq.1; Mon, 04 Jun 2018 06:49:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=511tc79nHjJUy57blXtkOV0scAlpCBCWZUYry2U9aa8=; b=uYupxqVCsgfaF9ntUNJRFRDE3zhK81X6vVEWQV6rPi9ZVPVTGExf9m/ty6PWCVDZBR TzcS2DMrVrEKDrVNuSeR1vtd7U1ynVIwluvaooVkSKo5pz5MEkcerME3CuBbt/OKIWOV cU8qAdNbGIb2D846fOFkqC4SMERUIYl3xMtXRamztpGJPVwA7WJEpuhT8US8eHLxgTO4 cHeAxu6k6mbXb9LoOY7eYYvEB7+mf5VVzz1S0h3QqWu6urQcrif8HtwzwFfhDi9gB/CZ X15mbLUSlzoXAlh7tWKYBmekYvQjSxu/CdAi0Zd+EM3CmbUwS1bZ17r7wHmPW9NMXFb6 MXvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=511tc79nHjJUy57blXtkOV0scAlpCBCWZUYry2U9aa8=; b=UHQ/3hmydR/m03P8h0l3jRXGti9EInWcbQYDtHj+/USDvdbg9PHIIPdtFr28uKOmrd +03t02GcXz45ChDpNP+h942NpbzPRJiNEvuhmY5A1819VyzA5u9kg7B+QOOSLDIJ0fGA 7KRqeXCqp6yE5JoFNw3OBf5lsZ72QCDzqxJN6TJlqiaGwS05K2KcnNw+jzpP86vcQIgh 2rzI+fT2JWCj6j7uuBdvIpYr/0CnAPLxPozZjOUi+koKLuc67VFZsCGuk5dhDG+FvGPx 5nMSd4mVGvVH/iZVIEGNisISNMGgLIaMmTTU8KUvD020UR+2DghfekHF1ROLQlKzTEgt 921w== X-Gm-Message-State: ALKqPweHFzlMoWgYmI64p/KA9f7AOvxoToMYXfGVqCFsSztRk7KFH2Ga xPJtj4JzN1zmvYUYqMh14e8= X-Received: by 2002:a17:902:1703:: with SMTP id i3-v6mr22134430pli.263.1528120163570; Mon, 04 Jun 2018 06:49:23 -0700 (PDT) Received: from localhost (c-24-4-232-150.hsd1.ca.comcast.net. [24.4.232.150]) by smtp.gmail.com with ESMTPSA id t3-v6sm12989182pfk.161.2018.06.04.06.49.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jun 2018 06:49:22 -0700 (PDT) Date: Mon, 4 Jun 2018 06:49:20 -0700 From: Richard Cochran To: Yangbo Lu Cc: netdev@vger.kernel.org, madalin.bucur@nxp.com, Rob Herring , Shawn Guo , "David S . Miller" , devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/10] dpaa_eth: add support for hardware timestamping Message-ID: <20180604134920.ezhe6jz5ntpnqyzj@localhost> References: <20180604070837.19265-1-yangbo.lu@nxp.com> <20180604070837.19265-10-yangbo.lu@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180604070837.19265-10-yangbo.lu@nxp.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 04, 2018 at 03:08:36PM +0800, Yangbo Lu wrote: > +if FSL_DPAA_ETH > +config FSL_DPAA_ETH_TS > + bool "DPAA hardware timestamping support" > + select PTP_1588_CLOCK_QORIQ > + default n > + help > + Enable DPAA hardware timestamping support. > + This option is useful for applications to get > + hardware time stamps on the Ethernet packets > + using the SO_TIMESTAMPING API. > +endif You should drop this #ifdef. In general, if a MAC supports time stamping and PHC, then the driver support should simply be compiled in. [ When time stamping incurs a large run time performance penalty to non-PTP users, then it might make sense to have a Kconfig option to disable it, but that doesn't appear to be the case here. ] > @@ -1615,6 +1635,24 @@ static int dpaa_eth_refill_bpools(struct dpaa_priv *priv) > skbh = (struct sk_buff **)phys_to_virt(addr); > skb = *skbh; > > +#ifdef CONFIG_FSL_DPAA_ETH_TS > + if (priv->tx_tstamp && > + skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { This condition fits on one line easily. > + struct skb_shared_hwtstamps shhwtstamps; > + u64 ns; Local variables belong at the top of the function. > + memset(&shhwtstamps, 0, sizeof(shhwtstamps)); > + > + if (!dpaa_get_tstamp_ns(priv->net_dev, &ns, > + priv->mac_dev->port[TX], > + (void *)skbh)) { > + shhwtstamps.hwtstamp = ns_to_ktime(ns); > + skb_tstamp_tx(skb, &shhwtstamps); > + } else { > + dev_warn(dev, "dpaa_get_tstamp_ns failed!\n"); > + } > + } > +#endif > if (unlikely(qm_fd_get_format(fd) == qm_fd_sg)) { > nr_frags = skb_shinfo(skb)->nr_frags; > dma_unmap_single(dev, addr, qm_fd_get_offset(fd) + > @@ -2086,6 +2124,14 @@ static int dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) > if (unlikely(err < 0)) > goto skb_to_fd_failed; > > +#ifdef CONFIG_FSL_DPAA_ETH_TS > + if (priv->tx_tstamp && > + skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { One line please. > + fd.cmd |= FM_FD_CMD_UPD; > + skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; > + } > +#endif > + > if (likely(dpaa_xmit(priv, percpu_stats, queue_mapping, &fd) == 0)) > return NETDEV_TX_OK; > Thanks, Richard