Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3050322ybi; Tue, 2 Jul 2019 01:09:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2/NosuNDPutJZYFnconaYn008fX1uVEfOvPZrueDQ8/yfK+pcSuOEio9U80p7hb4HMy00 X-Received: by 2002:a17:902:e30d:: with SMTP id cg13mr33504418plb.173.1562054949554; Tue, 02 Jul 2019 01:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562054949; cv=none; d=google.com; s=arc-20160816; b=gVwLzdHoKUhca8PkpAlK1jhX03Oxrh4MsR006HmLBg8/mjSy5xiySHyjoi6wcMN5eg rJaFR+UhNBToga9DS4kfYacn0+dDUA0uc+Fijm6D7uPP1+7BHLGHJWcc6+ROIAjPfF80 PpBSSD/2XtlEg4dXuXKilY5T+L87EmDO3lWwjckokSyWcdg/MEbyrcUD3G0NDWg17PtQ q0OZNKIAnD1udIlGd4y+Qm19U6lqxNsuvwUyJGOfAYgMX/iBzqPONN0hmx0YHPBPMkKn tZXL3H1tnTVch5TMwblLNJO4Yiz/tTrUbDHLCU5SKHVcllvlhkiQnBCAyQg/43JjGoSg cqkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lFKnQmOiupbcjardz1AeqlTh3BFJ7I7SB0t9oWy4Yi8=; b=tIssqKJtyfi4/cLvltzljzhiTW+GUeJ1ITNFvQHXVQGiZV+0tLEkNDkFztFme1lBUO vXsEeovlVawl62eVRmJbhk/Mf6rELj43gyykIfnXODGkEo0lEnmP+2lQnJKWeQIf4ieX +EkJOdwvMkCYHYjjlfh4vRWC7dZEqmmTT22KSJdmJnDput4WlKmVwyMUNFUlVn6V4YDW 8cWK+SwbSYwEmVeH+T5tgSDuEQy+S/uptxf3OWiEn3O9MBS+PlmHCu0bEM0mQpaBttHj NIyR9KqjeKDjZKJ24u6WR3j+spJNQO9PUn2kw/pcxUB3ijcS64Rx1l2Z1QwooIYZ6t0b OSnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qe0LZmTN; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i18si13589028pfa.23.2019.07.02.01.08.55; Tue, 02 Jul 2019 01:09:09 -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=@kernel.org header.s=default header.b=qe0LZmTN; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728305AbfGBIHm (ORCPT + 99 others); Tue, 2 Jul 2019 04:07:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:55008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728297AbfGBIHk (ORCPT ); Tue, 2 Jul 2019 04:07:40 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 991B721479; Tue, 2 Jul 2019 08:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562054859; bh=3KVJGkIrX5Yw69arPwOamrCH2QLo1Lg2uer/BTJA54g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qe0LZmTNK6Snf0TA95WQrQmvnGjnqy6SAu1Rce0RlOjluf3ArTuWH41ze9VHcm2MC GdPUl/uTZbRRafnEe/QayRrbwavFLba0+QdgOeByZg24QMBNDr0kxRvqQzSIHX7xEt hHn1cp+uMlyLWbf+Osl2wgXumEgA1vF1lhz1MvEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roland Hii , Ong Boon Leong , Voon Weifeng , "David S. Miller" Subject: [PATCH 4.19 56/72] net: stmmac: set IC bit when transmitting frames with HW timestamp Date: Tue, 2 Jul 2019 10:01:57 +0200 Message-Id: <20190702080127.502451969@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190702080124.564652899@linuxfoundation.org> References: <20190702080124.564652899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roland Hii [ Upstream commit d0bb82fd60183868f46c8ccc595a3d61c3334a18 ] When transmitting certain PTP frames, e.g. SYNC and DELAY_REQ, the PTP daemon, e.g. ptp4l, is polling the driver for the frame transmit hardware timestamp. The polling will most likely timeout if the tx coalesce is enabled due to the Interrupt-on-Completion (IC) bit is not set in tx descriptor for those frames. This patch will ignore the tx coalesce parameter and set the IC bit when transmitting PTP frames which need to report out the frame transmit hardware timestamp to user space. Fixes: f748be531d70 ("net: stmmac: Rework coalesce timer and fix multi-queue races") Signed-off-by: Roland Hii Signed-off-by: Ong Boon Leong Signed-off-by: Voon Weifeng Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2938,12 +2938,15 @@ static netdev_tx_t stmmac_tso_xmit(struc /* Manage tx mitigation */ tx_q->tx_count_frames += nfrags + 1; - if (priv->tx_coal_frames <= tx_q->tx_count_frames) { + if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) && + !(priv->synopsys_id >= DWMAC_CORE_4_00 && + (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && + priv->hwts_tx_en)) { + stmmac_tx_timer_arm(priv, queue); + } else { + tx_q->tx_count_frames = 0; stmmac_set_tx_ic(priv, desc); priv->xstats.tx_set_ic_bit++; - tx_q->tx_count_frames = 0; - } else { - stmmac_tx_timer_arm(priv, queue); } skb_tx_timestamp(skb); @@ -3157,12 +3160,15 @@ static netdev_tx_t stmmac_xmit(struct sk * element in case of no SG. */ tx_q->tx_count_frames += nfrags + 1; - if (priv->tx_coal_frames <= tx_q->tx_count_frames) { + if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) && + !(priv->synopsys_id >= DWMAC_CORE_4_00 && + (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && + priv->hwts_tx_en)) { + stmmac_tx_timer_arm(priv, queue); + } else { + tx_q->tx_count_frames = 0; stmmac_set_tx_ic(priv, desc); priv->xstats.tx_set_ic_bit++; - tx_q->tx_count_frames = 0; - } else { - stmmac_tx_timer_arm(priv, queue); } skb_tx_timestamp(skb);