Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4176219pxy; Mon, 26 Apr 2021 21:13:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2qRi8yx1+r1EasZZTbkMZS1IRHwb5M3a+EjtZouJxRrpGC8Ex3kK3kfyZQYqCqyaHwWMY X-Received: by 2002:a63:6486:: with SMTP id y128mr1398153pgb.414.1619496799023; Mon, 26 Apr 2021 21:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619496799; cv=none; d=google.com; s=arc-20160816; b=iga4eAbIwrFsoIi+nULhcathjmjXVz3MTaS77RtowEu5s0Mq/TPNiHUMITuSVIIVOz 7LJfpDOf1RaLmbWdmTpB1+Lf2+x4Q5bnWByybX15t3KX/2odprSjEtT3qkCOvsLm+YXv 7JeB+w8cXmBGdKhPG6Hi49AyJCLEa2Aq8gAnjU+eNxXGxuO+raqwhLzDg8uBhhoJM6iR 14YXnTMUMPMDH7WPzwtigh6yud6CuLpJ/wc33JrCXvQyAar/6SLaX1DyjDhF/wg7bBj2 e+nhY4xuxCODguJ3O8sl+f9Wt+HLOj4EygQC/RqOQ5E99qH8A647wN+fVbgaGhyx43l4 kciA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=z9KuWU9ImgrnaGO22L9Gwo6fZFLc6H0uB3/Neg27qIs=; b=CASZ4/hnxYIsRk/x5Yo/8UItbrAoMYquIrWXuqdVwPxaazGEik7Rdru4zS+b9wi/wq GS8W0pjSSVeSyBZNGigNv5KDo92l8yKUzxm0Z8mdS9SxkZhEGPbcjo1hFwaloHqoQfPO OLDYrxBOHjkhw5InwvV6yt6CJawL5YgULbh1uNqEdVOytvsRfKuC57ZSrHSdIRBxV6Qg s8TvQ6wccnD6HZZAm3rF668ZHzgPcfdMU8cESrg14ewqu5GnIPtYGFgNX5kHBjHzA8CW oaXFeYouL3tWa1oIIwpHjjvKJ7T7ygEsEs8nimNb6r6Wfx0A2Z3+k8HoTP6dDG6vlnEG OIxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si19005738pgi.5.2021.04.26.21.12.53; Mon, 26 Apr 2021 21:13:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232286AbhD0EM2 (ORCPT + 99 others); Tue, 27 Apr 2021 00:12:28 -0400 Received: from inva020.nxp.com ([92.121.34.13]:46160 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbhD0EMZ (ORCPT ); Tue, 27 Apr 2021 00:12:25 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C7E471A18B7; Tue, 27 Apr 2021 06:11:41 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 886F01A094A; Tue, 27 Apr 2021 06:11:35 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id B37B9402DA; Tue, 27 Apr 2021 06:11:27 +0200 (CEST) From: Yangbo Lu To: netdev@vger.kernel.org Cc: Yangbo Lu , Richard Cochran , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , Jonathan Corbet , Kurt Kanzenbach , Andrew Lunn , Vivien Didelot , Florian Fainelli , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next, v3, 1/7] net: dsa: check tx timestamp request in core driver Date: Tue, 27 Apr 2021 12:21:57 +0800 Message-Id: <20210427042203.26258-2-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427042203.26258-1-yangbo.lu@nxp.com> References: <20210427042203.26258-1-yangbo.lu@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check tx timestamp request in core driver at very beginning of dsa_skb_tx_timestamp(), so that most skbs not requiring tx timestamp just return. And drop such checking in device drivers. Signed-off-by: Yangbo Lu Tested-by: Kurt Kanzenbach Reviewed-by: Florian Fainelli Acked-by: Richard Cochran --- Changes for v2: - Split from tx timestamp optimization big patch. Changes for v3: - None. --- drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c | 4 ---- drivers/net/dsa/mv88e6xxx/hwtstamp.c | 3 --- drivers/net/dsa/ocelot/felix.c | 3 +-- net/dsa/slave.c | 3 +++ 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c b/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c index 69dd9a2e8bb6..6ba5e2333066 100644 --- a/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c +++ b/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c @@ -382,10 +382,6 @@ bool hellcreek_port_txtstamp(struct dsa_switch *ds, int port, ps = &hellcreek->ports[port].port_hwtstamp; - /* Check if the driver is expected to do HW timestamping */ - if (!(skb_shinfo(clone)->tx_flags & SKBTX_HW_TSTAMP)) - return false; - /* Make sure the message is a PTP message that needs to be timestamped * and the interaction with the HW timestamping is enabled. If not, stop * here diff --git a/drivers/net/dsa/mv88e6xxx/hwtstamp.c b/drivers/net/dsa/mv88e6xxx/hwtstamp.c index 094d17a1d037..05ca1d3c6498 100644 --- a/drivers/net/dsa/mv88e6xxx/hwtstamp.c +++ b/drivers/net/dsa/mv88e6xxx/hwtstamp.c @@ -475,9 +475,6 @@ bool mv88e6xxx_port_txtstamp(struct dsa_switch *ds, int port, struct mv88e6xxx_port_hwtstamp *ps = &chip->port_hwtstamp[port]; struct ptp_header *hdr; - if (!(skb_shinfo(clone)->tx_flags & SKBTX_HW_TSTAMP)) - return false; - hdr = mv88e6xxx_should_tstamp(chip, port, clone, type); if (!hdr) return false; diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 6b5442be0230..1379f86d71ec 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1401,8 +1401,7 @@ static bool felix_txtstamp(struct dsa_switch *ds, int port, struct ocelot *ocelot = ds->priv; struct ocelot_port *ocelot_port = ocelot->ports[port]; - if (ocelot->ptp && (skb_shinfo(clone)->tx_flags & SKBTX_HW_TSTAMP) && - ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) { + if (ocelot->ptp && ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) { ocelot_port_add_txtstamp_skb(ocelot, port, clone); return true; } diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 77b33bd161b8..b2a802e9330e 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -559,6 +559,9 @@ static void dsa_skb_tx_timestamp(struct dsa_slave_priv *p, struct sk_buff *clone; unsigned int type; + if (!(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) + return; + type = ptp_classify_raw(skb); if (type == PTP_CLASS_NONE) return; -- 2.25.1