From patchwork Tue Oct 10 11:50:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 150693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp135344vqb; Tue, 10 Oct 2023 04:50:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEl5CU++vimh/TO2/6oBtGSommKIsTrGxNseR0rWQxk1b45ZLRcrwws43K2Q+ZDA2H2B/UI X-Received: by 2002:a17:902:c94e:b0:1c7:245a:7fea with SMTP id i14-20020a170902c94e00b001c7245a7feamr24241991pla.58.1696938657903; Tue, 10 Oct 2023 04:50:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696938657; cv=none; d=google.com; s=arc-20160816; b=O7XoAjc09131z3HdkuVcnRt+7gkt+smy5bRBzB0Bx0N80tRiJaNnyFyvY1ajndt5ak RPwuOO2LEBEcZJDrZsHWmTK75+4+Qvz9PfQSSidhLnIF/dqpw5h7VwLbM9JatVq0PHp5 ixDTSQ0TDbezgv22HtAPj31ZYooMxUkq67T/wvRHs/P22Hom60kxOS9sRxo7B3GF7CRM bJbYzK8WU5sch4pfZ4jMspx3F6GTE2l3+3T4yuODNgUGx8tUzbWjUoNsyCHQ2NXxOiIA BEC65pRT4/zJTSKaG2LhrsV5TSwKjdEq1mzIrTGVKY41Yr7VuR52Bsbraq6wXW7ZGBuJ qSyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=869kURQHxyEbzuTjcLLmcIJexFWY1u6w+li4VH7jiQw=; fh=WRGbqGSyy9WXKYOVrb93WOR65gTngSOkfYELSBI2YfQ=; b=Ey/5caCTuM7+xnOzmzJDHiB933i2Q5/3I7T91RWh7TTMecMJmf+VZKWKbY0t+gfImh DFVB6OFaQEZ3b6mRrsvrtu7kK3S9u0TAXrSz6sGpG3j2Y5qcI/x0Mdj4qRgUeuyBWE1f 4etEQnt1wpl9bqWusuQpJiuoiywFSpcZZ/PjOSnJWMmPcf3J5KanhN3dZmCjY1wLLw6l 5odeFyNVrk7/arRpaWA9C3z7/NaTPI7QM0HtFj01C7UqIqqvh7Cm3tT2NBpLz4Wme2Ym JcSiybNQlxm6DmyM6MBcy5EELPLsoEsldCcnzJO8p6jyZ+XIJ+ecEGh2ToAcRqU9HOsC O/TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=LYzNk3z7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id ju3-20020a170903428300b001bbb175a81asi11217870plb.263.2023.10.10.04.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 04:50:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=LYzNk3z7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 89811801D778; Tue, 10 Oct 2023 04:50:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbjJJLuo (ORCPT + 20 others); Tue, 10 Oct 2023 07:50:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231423AbjJJLum (ORCPT ); Tue, 10 Oct 2023 07:50:42 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C737599; Tue, 10 Oct 2023 04:50:39 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39A38Dv8024201; Tue, 10 Oct 2023 04:50:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=869kURQHxyEbzuTjcLLmcIJexFWY1u6w+li4VH7jiQw=; b=LYzNk3z7FZM4lt5zuQmPRaIpRY6WQ2a/5Zn2Mfxqm6LkSuEq1Hd2Qha9PuvQQEMxgSOR rT5CFGsOJAGo4MQpAC87M1YvV1CrKc0GZdczZwjH1aCTBIO6+bB/70599jFv8g9CWzNy /bqnOYf/QiujB7j0/WH8p3e21bA+JzCwz537ljB02CBeECsxoCQ6FmOozfc4mCreWHPh rEOWLCV9bX4CICuPPAK8nKpKn7AgC51ge+j9fMmvhapHLZ0V6V675xhk0vbIaEwegEij PYVE3EhE9MfzRgb+Il0ylEXWBDDncCe3dCH9sVdw+AsEG8W/RoPfiOYuZGNU3snZL7Pn FA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tmxense1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 10 Oct 2023 04:50:23 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 10 Oct 2023 04:50:22 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 10 Oct 2023 04:50:22 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 8ED163F70A9; Tue, 10 Oct 2023 04:50:21 -0700 (PDT) From: Shinas Rasheed To: , , CC: , , , Shinas Rasheed , Veerasenareddy Burru , Sathesh Edara , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Satananda Burla , Abhijit Ayarekar Subject: [net PATCH] octeon_ep: update BQL sent bytes before ringing doorbell Date: Tue, 10 Oct 2023 04:50:15 -0700 Message-ID: <20231010115015.2279977-1-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: uKQmclyPkdhj3WW5UyDKA5GEMu7tg2Xy X-Proofpoint-ORIG-GUID: uKQmclyPkdhj3WW5UyDKA5GEMu7tg2Xy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-10_07,2023-10-10_01,2023-05-22_02 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 10 Oct 2023 04:50:54 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779369150089185586 X-GMAIL-MSGID: 1779369150089185586 Sometimes Tx is completed immediately after doorbell is updated, which causes Tx completion routing to update completion bytes before the same packet bytes are updated in sent bytes in transmit function, hence hitting BUG_ON() in dql_completed(). To avoid this, update BQL sent bytes before ringing doorbell. Fixes: 37d79d059606 ("octeon_ep: add Tx/Rx processing and interrupt support") Signed-off-by: Shinas Rasheed --- drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c index dbc518ff8276..314f9c661f93 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -718,6 +718,7 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, /* Flush the hw descriptor before writing to doorbell */ wmb(); + netdev_tx_sent_queue(iq->netdev_q, skb->len); /* Ring Doorbell to notify the NIC there is a new packet */ writel(1, iq->doorbell_reg); atomic_inc(&iq->instr_pending); @@ -726,7 +727,6 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, wi = 0; iq->host_write_index = wi; - netdev_tx_sent_queue(iq->netdev_q, skb->len); iq->stats.instr_posted++; skb_tx_timestamp(skb); return NETDEV_TX_OK;