From patchwork Tue Oct 24 14:51:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 157536 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1996452vqx; Tue, 24 Oct 2023 07:52:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHURyAuRK2KdXCZ2zkLwTsumZV8sAoR4OhXX8fd6/q+YBRKEDslzx05CfyrvUkrRnEcEqLA X-Received: by 2002:a17:902:ce8d:b0:1c8:9832:8278 with SMTP id f13-20020a170902ce8d00b001c898328278mr13304930plg.48.1698159124638; Tue, 24 Oct 2023 07:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698159124; cv=none; d=google.com; s=arc-20160816; b=C5iZVjjEhFarw1fwEK1cpXBJDWrnBUH2zuNJIpPyxw5+HNnssBxMA4pSOZ0eof8wsw wM/Wo5w3WRRWhRfzUV7k5IInEsRlF9w8taDkiL612jxnMYvokvgx4rwmp55cpsiIxJKV sZPFM2ISaiK+J5OFo7hS9MBDcoG4PEhwwqgMNXnbZhj4e5IdWRrkm99YfqweDjyyk6r4 DPkoELcaLJonZsK2iKj8XQVxATRnhcNBFH2KjXRumcyB1VpbD4N0Oe+DBoaBzpUnTs8c viv+TzTWKjpVxf5lGwHt4gPIQeD6W8CtTEe5p9s+40+pUt9ibcOTYJDf7DRsWp+8ypqh gv1g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6nzbfkxRkQ7E65eL9WI4SEOv9tmrHHgxnGyQP9GXZZg=; fh=PUbSZjf2dtyqulLdd5rISVghnntgSGxvYpWMBobeHB0=; b=PaF8sf85Dsh/wJdcsyjMKcoLEcPvoZVgDcj0O8sXy9eACpNTg34CaCV2VhPua6oVey LzEjAl/t/6ifdmh8e64CYR5PLVO9CxgCrN3ekEta/PHxWsManES7czr3/SEPa5NUm+tA 8NbbRV/opH7n1wrGKiz7Oc5RgOf3DvnMh+5PF+N2Rqlb845GAXAP46LG9fGU9j9cTcqg zbIlmV/TYvNJlDPwqE4iwnRSjPrW33UbqMkBc3mHDrVyUslh0E6MEVQmoIps67lBBugf zguGe97VbSketxsDqv5Ld2H8IV5jQgAbDw9bY9XEpewThWd2PRbXMf0Bh7Rf9MfF7tki FFsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="FulKWrz/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h24-20020a17090aa89800b0027ced9acac0si11175360pjq.2.2023.10.24.07.52.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:52:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="FulKWrz/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 1ED4F80ADF02; Tue, 24 Oct 2023 07:52:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343655AbjJXOvr (ORCPT + 26 others); Tue, 24 Oct 2023 10:51:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234551AbjJXOvo (ORCPT ); Tue, 24 Oct 2023 10:51:44 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2A6910DB; Tue, 24 Oct 2023 07:51:42 -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 39O2KhT3022546; Tue, 24 Oct 2023 07:51:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=6nzbfkxRkQ7E65eL9WI4SEOv9tmrHHgxnGyQP9GXZZg=; b=FulKWrz/XksriLfdCf5Gq58qHPdjafT85P7M9d4yEc2ZRnLAfIhcY3vXsNafPT2L1npa +Z/pwD45tVVJ0kMo2zcPrLRofmlm5xLNtkTOYmVQ9Lm5sMMsdZfE+s9NklXKjxE1700/ nLdGrFu5Tp7MLOTRpPUtq9VQJWHW4UCLZTR/mShTacE8XCh09r21YnW+ODrAV1KpsHt+ jp0jcUu2joQZtuq0HU677gIa3kfKBsOUmePcJAdEfVodHcj04RDPdf5Ifu8eaU2qAMsJ N5RKM95z9TzUVr+UwGxqrhWghXDkc0x2HJ1VQriszob3BDlRBNcoifQJl3c/usU+0X4D Ug== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tx523tppr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 24 Oct 2023 07:51:36 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 24 Oct 2023 07:51:35 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 24 Oct 2023 07:51:35 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id B8F793F7053; Tue, 24 Oct 2023 07:51:34 -0700 (PDT) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v2 1/4] octeon_ep: add padding for small packets Date: Tue, 24 Oct 2023 07:51:16 -0700 Message-ID: <20231024145119.2366588-2-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231024145119.2366588-1-srasheed@marvell.com> References: <20231024145119.2366588-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: KZh7nXVMofJ4lV8HTn3GcWDsQ85IF_Ug X-Proofpoint-ORIG-GUID: KZh7nXVMofJ4lV8HTn3GcWDsQ85IF_Ug X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-24_15,2023-10-24_01,2023-05-22_02 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Tue, 24 Oct 2023 07:52:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780648902465339482 X-GMAIL-MSGID: 1780648902465339482 Pad small packets to ETH_ZLEN before transmit. Signed-off-by: Shinas Rasheed --- V1->V2: - New patch drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c index 552970c7dec0..2c86b911a380 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -820,6 +820,9 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, u16 nr_frags, si; u16 q_no, wi; + if (skb_put_padto(skb, ETH_ZLEN)) + return NETDEV_TX_OK; + q_no = skb_get_queue_mapping(skb); if (q_no >= oct->num_iqs) { netdev_err(netdev, "Invalid Tx skb->queue_mapping=%d\n", q_no); From patchwork Tue Oct 24 14:51:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 157539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1996602vqx; Tue, 24 Oct 2023 07:52:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9sRGAT+HUTSiVBbgLVOjaLHmlnSB367vps+aPeNfrObfcDp7kbYDQ44P0yU0/BNrNLm3H X-Received: by 2002:a05:6a00:990:b0:690:c887:8cd8 with SMTP id u16-20020a056a00099000b00690c8878cd8mr11532906pfg.32.1698159139675; Tue, 24 Oct 2023 07:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698159139; cv=none; d=google.com; s=arc-20160816; b=hR0GQi0mruRRTadtHPovQQlfk+m4jEk9mVnwlskD+0ULTns6otPz4UHIL1Q4NHasyP xmszF5SL9HqjoUDb5SsNYOnxwdTKUDTTgFVu8YyB7JY8rSXlH5bGjfNrbFJMNzcRNif3 J3ugXmErK/ME1yY9iyzKBrU/avYWCeBENTExCTGH4CIobK4mgf9s71uKid4u1psxIR7R OEkoyRjkv3C1980DM5yHRZQAd/Vo/vFj5MVrFRINHttgiIC486n9ikaxmanSzBAqqrsv fv60BWPIYx1+Rdra8i1CUNre6csVd6K77m+6hpFBOxsjdmp7hf+lksUFIxX2ftzgksON 4xTA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ndvh1aB9dthejQfO+oYbkTOouX5yYrdETKaSV5RkMPU=; fh=PUbSZjf2dtyqulLdd5rISVghnntgSGxvYpWMBobeHB0=; b=g9NtT0wVSCev57KInUtaKBL1HJ91RCEkfgZF2IGGSVCPaE8hi2RbGujJveK7VV5ZpE GxBoRpwQ5Pr/6E2L4nkO0qtyN2sSDKu4XIbFaHN00SFCT3RQQI8gzY9Pbq7fUTsSUtp/ TPgH/lVvJFWMvjDcRxf7HxHarwgrk7yrdZv+VY2edLc4sjr4AvKVQCDhaILB5uJzhNlm ESvJg4Xj5TUlDObN3Yp46JqyHTb35eFSz5J+L7obhmMh4cfyt56KkZR54kTVObLMKX/H XOIdXR5OyPqdnPZPG7enp6Vl93r3ZvRZLDFY5TqozpBd7ifnIvD+D2u2QrA6Ue5FZAdO RwSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=UyDzgSc6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id fj1-20020a056a003a0100b006b6424d826asi8544486pfb.16.2023.10.24.07.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:52:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=UyDzgSc6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 634178062BA5; Tue, 24 Oct 2023 07:52:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343706AbjJXOwG (ORCPT + 26 others); Tue, 24 Oct 2023 10:52:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343700AbjJXOv4 (ORCPT ); Tue, 24 Oct 2023 10:51:56 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 596F01700; Tue, 24 Oct 2023 07:51:53 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39OBAkUY025366; Tue, 24 Oct 2023 07:51:39 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=Ndvh1aB9dthejQfO+oYbkTOouX5yYrdETKaSV5RkMPU=; b=UyDzgSc6p0xaVaSCnpvsnz5mOmOovIMsyXUVVGz28+wm0O9IsbIlcEDbvXO8fPNC1dV9 uS/+JCbfQiMbqX8KjsAZAB4uhhd1onn/mzgwnpw7vALauX/sKIbNaCTq/MkHvaW5sfwn 2WtyToSdBNCdqfqR3F4zafXVU+LKTCwHbUUii0fCQed6SXFzsjXPl5koaYmHVY4yAeV4 k3iP6lp8Ar8IcRDmZGneueg7/L4xZ2WkxMfTMFDwMyCjN5rnBsV62M5u2ZBPqJrf4gi9 oFLydCVQtjO5NFzTOq7PdaByGk8ZY50b54x6Nx3w5RmGtTmI9JF1K6FpeOgd2RJ6tClb wA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3txcsqrucf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 24 Oct 2023 07:51:39 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 24 Oct 2023 07:51:37 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 24 Oct 2023 07:51:37 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id E71CA3F704B; Tue, 24 Oct 2023 07:51:36 -0700 (PDT) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v2 2/4] octeon_ep: remove dma sync in trasmit path Date: Tue, 24 Oct 2023 07:51:17 -0700 Message-ID: <20231024145119.2366588-3-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231024145119.2366588-1-srasheed@marvell.com> References: <20231024145119.2366588-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: x2E5YogpK_8XHeYHQOcOWUwZohY8Zp6t X-Proofpoint-GUID: x2E5YogpK_8XHeYHQOcOWUwZohY8Zp6t X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-24_14,2023-10-24_01,2023-05-22_02 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 24 Oct 2023 07:52:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780648918096098922 X-GMAIL-MSGID: 1780648918096098922 Cleanup dma sync calls for scatter gather mappings, since they are coherent allocations and do not need explicit sync to be called. Signed-off-by: Shinas Rasheed --- V2: - Provided more details in changelog V1: https://lore.kernel.org/all/20231023114449.2362147-2-srasheed@marvell.com/ drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c index 2c86b911a380..1c02304677c9 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -872,9 +872,6 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, if (dma_mapping_error(iq->dev, dma)) goto dma_map_err; - dma_sync_single_for_cpu(iq->dev, tx_buffer->sglist_dma, - OCTEP_SGLIST_SIZE_PER_PKT, - DMA_TO_DEVICE); memset(sglist, 0, OCTEP_SGLIST_SIZE_PER_PKT); sglist[0].len[3] = len; sglist[0].dma_ptr[0] = dma; @@ -894,10 +891,6 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, frag++; si++; } - dma_sync_single_for_device(iq->dev, tx_buffer->sglist_dma, - OCTEP_SGLIST_SIZE_PER_PKT, - DMA_TO_DEVICE); - hw_desc->dptr = tx_buffer->sglist_dma; } From patchwork Tue Oct 24 14:51:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 157537 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1996488vqx; Tue, 24 Oct 2023 07:52:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGppYgOgC+ZUqZOoKvraNU4LWARtstLZa2LG8IJ+jGSM1Uxmq+Yl/j0LvAbLDr1Dya+1j1S X-Received: by 2002:a17:902:facb:b0:1ca:85ae:3b59 with SMTP id ld11-20020a170902facb00b001ca85ae3b59mr12875755plb.9.1698159128351; Tue, 24 Oct 2023 07:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698159128; cv=none; d=google.com; s=arc-20160816; b=EnshBCF86/Ezs+jVWxYvZyCAsgeMb8SLFm996w9pK0I2TXzwKEjFkU8OQkWWcaqtmd B9JAiX9HUnMUvjHWGamR/SFEWcbX/MeKD+8r5OH5QUUmuvGos5S/YpIGFWZbHCSS7m05 T6f2+a8pGRtTLkGPcqizQ0khJCMMYETzEIsCogDUm5W8yDDvK1wmfd1SJ8XRcLueDsFJ 12updhhjiEAT96yWJBkqTObTXmF4pbSbMc24AKUSneLY6Ig9U3nnL0cOtZuGtqsXfilr X/zrKQLR0tZMDAXRR/RnLSvEHiPNra52cogxc0oma796nNkcmTevAli+Kjg4qgrr1rRd 44xg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IFVG9SilRa/MRmDVoe+eoB8mh3aaZAJsY4D9VWbLWRY=; fh=PUbSZjf2dtyqulLdd5rISVghnntgSGxvYpWMBobeHB0=; b=yrAgyGG+2CsRaqitvM7o5/8NMhob0Cj4DQmb2fA188ILqg9t7SogvKhvNOvT9xKFnf nqrCqByhDsF9I+I/PFm8cFctdC0dr4vWzpNoQNJmfp4McaGVW/Hcupu5O5e6noqJMhwI k/FW+ppySTr6l8fbXKJGzyufyqtGoU+jIWUGMQ7F4WbNYVZAKnFtWex9hXRZ31QAPYlb rjZiyzWqae3GVsh1Vh9Wl8pbc5ALRjLprrlt8Ra0ZXl3VFJFr3gbgX4hqKTuwn7akJmY CeFsNKHrEb41N1jvW3RJ1t/cjQDRJXJ3N2gK+KVIfU/J5f6/o3NHDVC3vU4GARwxSBOy RHtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=XZ4fo5pu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i12-20020a170902c94c00b001b222cd9826si8755869pla.349.2023.10.24.07.52.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:52:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=XZ4fo5pu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 892A5802C68C; Tue, 24 Oct 2023 07:52:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234612AbjJXOv6 (ORCPT + 26 others); Tue, 24 Oct 2023 10:51:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343702AbjJXOvu (ORCPT ); Tue, 24 Oct 2023 10:51:50 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 168CF10DE; Tue, 24 Oct 2023 07:51:47 -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 39O2K86x021789; Tue, 24 Oct 2023 07:51:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=IFVG9SilRa/MRmDVoe+eoB8mh3aaZAJsY4D9VWbLWRY=; b=XZ4fo5pu4Iyhq9lENnD7mEUGIwtO6FA315CaIMiVhS41u1jA1RhoM08VNt1rUCIhXcYq VkZuc8FJuITBW86hlMBb5hnFefTWFc4A6wRbXqnxiBcX/3DZqkpPW29xhD3s/MtrUo6O 3bovB0Ew3qCw0NUUMBocCUdD/T5pomVxHF3/Rl8xq3wz43jkhqfrzH6I98VhFYEApVyt wJVmxdqNYbR4tzJjRyrfkDEIfoTrLF9Q9kz6evUyp9Gu0FvqFCaB7/ZVe6bPcYX2c0Wr RiGcQLWiBcV5lzfXPng0OYV8XziLPMJIHPzg3/1227AjK5YgdxmoMWbENby0nEoTl5p+ +g== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tx523tpqa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 24 Oct 2023 07:51:41 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 24 Oct 2023 07:51:40 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 24 Oct 2023 07:51:40 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 072183F7076; Tue, 24 Oct 2023 07:51:39 -0700 (PDT) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v2 3/4] octeon_ep: implement xmit_more in transmit Date: Tue, 24 Oct 2023 07:51:18 -0700 Message-ID: <20231024145119.2366588-4-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231024145119.2366588-1-srasheed@marvell.com> References: <20231024145119.2366588-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: QXrlSMIZs2y_ZRI-5Y15kpvMRNfBDlk9 X-Proofpoint-ORIG-GUID: QXrlSMIZs2y_ZRI-5Y15kpvMRNfBDlk9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-24_15,2023-10-24_01,2023-05-22_02 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Tue, 24 Oct 2023 07:52:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780648906311678812 X-GMAIL-MSGID: 1780648906311678812 Add xmit_more handling in tx datapath for octeon_ep pf. Signed-off-by: Shinas Rasheed --- V2: - Updated changelog to have imperative tone. V1: https://lore.kernel.org/all/20231023114449.2362147-3-srasheed@marvell.com/ .../ethernet/marvell/octeon_ep/octep_config.h | 2 +- .../ethernet/marvell/octeon_ep/octep_main.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_config.h b/drivers/net/ethernet/marvell/octeon_ep/octep_config.h index 1622a6ebf036..ed8b1ace56b9 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_config.h +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_config.h @@ -15,7 +15,7 @@ /* Tx Queue: maximum descriptors per ring */ #define OCTEP_IQ_MAX_DESCRIPTORS 1024 /* Minimum input (Tx) requests to be enqueued to ring doorbell */ -#define OCTEP_DB_MIN 1 +#define OCTEP_DB_MIN 8 /* Packet threshold for Tx queue interrupt */ #define OCTEP_IQ_INTR_THRESHOLD 0x0 diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c index 1c02304677c9..1a88a6bf0598 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -818,6 +818,7 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, struct octep_iq *iq; skb_frag_t *frag; u16 nr_frags, si; + int xmit_more; u16 q_no, wi; if (skb_put_padto(skb, ETH_ZLEN)) @@ -895,18 +896,28 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, } netdev_tx_sent_queue(iq->netdev_q, skb->len); + + xmit_more = netdev_xmit_more(); + skb_tx_timestamp(skb); atomic_inc(&iq->instr_pending); + iq->fill_cnt++; wi++; if (wi == iq->max_count) wi = 0; iq->host_write_index = wi; + if (xmit_more && + (atomic_read(&iq->instr_pending) < + (iq->max_count - OCTEP_WAKE_QUEUE_THRESHOLD)) && + iq->fill_cnt < iq->fill_threshold) + return NETDEV_TX_OK; + /* Flush the hw descriptor before writing to doorbell */ wmb(); - - /* Ring Doorbell to notify the NIC there is a new packet */ - writel(1, iq->doorbell_reg); - iq->stats.instr_posted++; + /* Ring Doorbell to notify the NIC of new packets */ + writel(iq->fill_cnt, iq->doorbell_reg); + iq->stats.instr_posted += iq->fill_cnt; + iq->fill_cnt = 0; return NETDEV_TX_OK; dma_map_sg_err: From patchwork Tue Oct 24 14:51:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 157538 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1996545vqx; Tue, 24 Oct 2023 07:52:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFx/Cl8rFQvo+/SVPhE40P/nUQu3h+PWOY715UViiOh+RDhk/JpzUStnPmUyfkcbq7sbT4M X-Received: by 2002:a17:90b:1c07:b0:276:6be8:8bfe with SMTP id oc7-20020a17090b1c0700b002766be88bfemr17164018pjb.23.1698159134896; Tue, 24 Oct 2023 07:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698159134; cv=none; d=google.com; s=arc-20160816; b=JjMeMF851BwgWQKwe53HrHJ89VbFAMSXYNdGGhqZnLpfWsjczYcbp0JiXAfl10/cpE YT5xD3Ssk6uMlhObHsqYZPH2v1uubP6fsTS0mShgv30sGRTC0zwG/+V2V/Znsm2/PpOl lzpKP4AoIK3XuxCfGD6Go5F6KoqvexUromo/X/vV7+bJhZQ1rl8xLjBHfP7irU4iso/D CDktUvS/h7sw4DYQDBHBNY0I7VVbjCNxELs3bHtyuBX6qYKf0cGd+cOcPhKbFkQmLnmZ c4kFOni2eUasZ8M0HOyG9TuG/A+JrvIyJuS2xutZdP3TK3/67TQx/hrEb54mMuszzOpJ 3tiA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BGTdEvAtLiqmgykdwG7+xPge8E3jhAnU5OgJrH52q8k=; fh=PUbSZjf2dtyqulLdd5rISVghnntgSGxvYpWMBobeHB0=; b=bDlo4zTB3usRIsWIkHAbC11m2VE3Oce50axHhWcuRUaBlxGVbfT+BwTS7zj+shZ+qd peFdPQj4aLS+IM9TIkbjLksC4bD+o8gVAXrZsC0rNKNVhbZpznk8iusT7J+JIt9kyj2S oJt3Sv9NDNqZmtB7zihPYBiAVPqDGjC/whK+/8edQW7OakRHEPNvJjLTp4/a00UTANjk SxNz02gdYctYt/8OOA1nxtBCL+FmRWUlgdAo11BaVsoHfm7XKgJU1y16DAhvt7qLEI0p nb82zPM4FZ2ef+Pgq/OpUlY3oNakJQqzZrVd+43RtApQFj5TmBZgsw6F+kfZZ0Vy+Jij NjYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=VDi7GKny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id pg16-20020a17090b1e1000b0027b0aac2191si8986789pjb.15.2023.10.24.07.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:52:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=VDi7GKny; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id A9F7F802DBA4; Tue, 24 Oct 2023 07:52:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343687AbjJXOwC (ORCPT + 26 others); Tue, 24 Oct 2023 10:52:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234634AbjJXOv5 (ORCPT ); Tue, 24 Oct 2023 10:51:57 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DF0E10E2; Tue, 24 Oct 2023 07:51:54 -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 39O2KOlF021960; Tue, 24 Oct 2023 07:51:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=BGTdEvAtLiqmgykdwG7+xPge8E3jhAnU5OgJrH52q8k=; b=VDi7GKnyNhnotbBJ4TB00ShmXdsGWF+dOR/nDED9aj38P8KSWCWVcN2wGakQUmTY/vSD 9dPVsuEeMT1UABPeVmeoMz9Q6vFoe8ROgzIoRJ4sVknWvls2EL/Q9YyFGLIX94HziqVt AWm0RSITjTCuIIMnCZAvjNTC4j3b5si+T+5J0zwhwiSMqOGZBmRG1z5A8M3X5SakZ10r 3by83tVsL1Ncy7u6M0y+X1u6BH8sW7YRYJt5NhwXETsKOsmjdIJJanpGig/npAuRrWH6 XkxTiDLW//g9xfT31UKcrMT4pXLLTS2lRHxec1QogqFpJMhkhDGo2YHiVdXLYR7IW5+Q VQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tx523tpqd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 24 Oct 2023 07:51:43 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 24 Oct 2023 07:51:41 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 24 Oct 2023 07:51:42 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 4636C3F7067; Tue, 24 Oct 2023 07:51:41 -0700 (PDT) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v2 4/4] octeon_ep: remove atomic variable usage in Tx data path Date: Tue, 24 Oct 2023 07:51:19 -0700 Message-ID: <20231024145119.2366588-5-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231024145119.2366588-1-srasheed@marvell.com> References: <20231024145119.2366588-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 6yPdpZiMzuYoOd8CRQQbXka7VJf7XjMC X-Proofpoint-ORIG-GUID: 6yPdpZiMzuYoOd8CRQQbXka7VJf7XjMC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-24_15,2023-10-24_01,2023-05-22_02 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Tue, 24 Oct 2023 07:52:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780648913301514758 X-GMAIL-MSGID: 1780648913301514758 Replace atomic variable "instr_pending" which represents number of posted tx instructions pending completion, with host_write_idx and flush_index variables in the xmit and completion processing respectively. Signed-off-by: Shinas Rasheed --- V2: - No changes V1: https://lore.kernel.org/all/20231023114449.2362147-4-srasheed@marvell.com/ drivers/net/ethernet/marvell/octeon_ep/octep_config.h | 1 + drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 11 ++++------- drivers/net/ethernet/marvell/octeon_ep/octep_main.h | 9 +++++++++ drivers/net/ethernet/marvell/octeon_ep/octep_tx.c | 5 +---- drivers/net/ethernet/marvell/octeon_ep/octep_tx.h | 3 --- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_config.h b/drivers/net/ethernet/marvell/octeon_ep/octep_config.h index ed8b1ace56b9..91cfa19c65b9 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_config.h +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_config.h @@ -13,6 +13,7 @@ #define OCTEP_64BYTE_INSTR 64 /* Tx Queue: maximum descriptors per ring */ +/* This needs to be a power of 2 */ #define OCTEP_IQ_MAX_DESCRIPTORS 1024 /* Minimum input (Tx) requests to be enqueued to ring doorbell */ #define OCTEP_DB_MIN 8 diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c index 1a88a6bf0598..53b7fbfe39ff 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -777,7 +777,7 @@ static int octep_stop(struct net_device *netdev) */ static inline int octep_iq_full_check(struct octep_iq *iq) { - if (likely((iq->max_count - atomic_read(&iq->instr_pending)) >= + if (likely((IQ_INSTR_SPACE(iq)) > OCTEP_WAKE_QUEUE_THRESHOLD)) return 0; @@ -787,7 +787,7 @@ static inline int octep_iq_full_check(struct octep_iq *iq) /* check again and restart the queue, in case NAPI has just freed * enough Tx ring entries. */ - if (unlikely((iq->max_count - atomic_read(&iq->instr_pending)) >= + if (unlikely(IQ_INSTR_SPACE(iq) > OCTEP_WAKE_QUEUE_THRESHOLD)) { netif_start_subqueue(iq->netdev, iq->q_no); iq->stats.restart_cnt++; @@ -900,14 +900,11 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, xmit_more = netdev_xmit_more(); skb_tx_timestamp(skb); - atomic_inc(&iq->instr_pending); iq->fill_cnt++; wi++; - if (wi == iq->max_count) - wi = 0; - iq->host_write_index = wi; + iq->host_write_index = wi & iq->ring_size_mask; if (xmit_more && - (atomic_read(&iq->instr_pending) < + (IQ_INSTR_PENDING(iq) < (iq->max_count - OCTEP_WAKE_QUEUE_THRESHOLD)) && iq->fill_cnt < iq->fill_threshold) return NETDEV_TX_OK; diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.h b/drivers/net/ethernet/marvell/octeon_ep/octep_main.h index 6df902ebb7f3..c33e046b69a4 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.h +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.h @@ -40,6 +40,15 @@ #define OCTEP_OQ_INTR_RESEND_BIT 59 #define OCTEP_MMIO_REGIONS 3 + +#define IQ_INSTR_PENDING(iq) ({ typeof(iq) iq__ = (iq); \ + ((iq__)->host_write_index - (iq__)->flush_index) & \ + (iq__)->ring_size_mask; \ + }) +#define IQ_INSTR_SPACE(iq) ({ typeof(iq) iq_ = (iq); \ + (iq_)->max_count - IQ_INSTR_PENDING(iq_); \ + }) + /* PCI address space mapping information. * Each of the 3 address spaces given by BAR0, BAR2 and BAR4 of * Octeon gets mapped to different physical address spaces in diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c index d0adb82d65c3..06851b78aa28 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c @@ -21,7 +21,6 @@ static void octep_iq_reset_indices(struct octep_iq *iq) iq->flush_index = 0; iq->pkts_processed = 0; iq->pkt_in_done = 0; - atomic_set(&iq->instr_pending, 0); } /** @@ -82,7 +81,6 @@ int octep_iq_process_completions(struct octep_iq *iq, u16 budget) } iq->pkts_processed += compl_pkts; - atomic_sub(compl_pkts, &iq->instr_pending); iq->stats.instr_completed += compl_pkts; iq->stats.bytes_sent += compl_bytes; iq->stats.sgentry_sent += compl_sg; @@ -91,7 +89,7 @@ int octep_iq_process_completions(struct octep_iq *iq, u16 budget) netdev_tx_completed_queue(iq->netdev_q, compl_pkts, compl_bytes); if (unlikely(__netif_subqueue_stopped(iq->netdev, iq->q_no)) && - ((iq->max_count - atomic_read(&iq->instr_pending)) > + (IQ_INSTR_SPACE(iq) > OCTEP_WAKE_QUEUE_THRESHOLD)) netif_wake_subqueue(iq->netdev, iq->q_no); return !budget; @@ -144,7 +142,6 @@ static void octep_iq_free_pending(struct octep_iq *iq) dev_kfree_skb_any(skb); } - atomic_set(&iq->instr_pending, 0); iq->flush_index = fi; netdev_tx_reset_queue(netdev_get_tx_queue(iq->netdev, iq->q_no)); } diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h index 86c98b13fc44..1ba4ff65e54d 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.h @@ -172,9 +172,6 @@ struct octep_iq { /* Statistics for this input queue. */ struct octep_iq_stats stats; - /* This field keeps track of the instructions pending in this queue. */ - atomic_t instr_pending; - /* Pointer to the Virtual Base addr of the input ring. */ struct octep_tx_desc_hw *desc_ring;