From patchwork Fri Oct 27 12:16:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 158917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp557264vqb; Fri, 27 Oct 2023 05:17:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGX10lI9gFuUVt+gnU2aPCo/+J34ZuzxGCLLJM+Enx438ThPr4SktKspDeNa916s5YZ14zC X-Received: by 2002:a81:b623:0:b0:59c:678:7a32 with SMTP id u35-20020a81b623000000b0059c06787a32mr2638859ywh.29.1698409038999; Fri, 27 Oct 2023 05:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698409038; cv=none; d=google.com; s=arc-20160816; b=V+jVPb7hoX3xXrjXQ8owLMroy3/NjJnA2M61hQacQbE3DnZ85EZxmIIn14llh1zjqf T8tV7sFEP83uxsegPOr7ccucgyXXL+FOzbVlR6msDg61EIdM+V1Og+jj3YE8zduLnpuB rf9/GCreYV5xhYN+keEEynTZaqGEN6QBaW537nu31RRmHXya4hZuyQLOnIp0cDzEd2b6 oPXkM5Ode0HC4stwkpSvuXA+jCZ/IULZv7e0PBbCZDtUo953EA3shRdSflBnaOJTUY18 K8mHweVLV93b+tbDJPyamB6HtM0rBOJJuQbqm6J1zCqIgltrVc6q7JOP9gjMKuaDzVMm vfIA== 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=NgILK9wtLyMUAwzUUpKcc8XDHZhA7pOaSTnLVOywbdQ=; fh=PUbSZjf2dtyqulLdd5rISVghnntgSGxvYpWMBobeHB0=; b=i5oaCyj28ZtcJA1ErUqS7IXxbYTs5SKx3pDufCs0EfFMZnHXUSVkM/W/ACn9kyjTqu YDZCts2nyYXViGbWNjpksptwbXE0IhSMZbwu35LH+sE4r80nMqGRejYjvbyFydI9bxVw COqDXqtK41/xR/oBukws9AoqHW2QR6engdWLo81eqfSSqBd7udwC7HVX52iBodevGQyD AsiQ//zUaX09q9obugAbmdcMLCcoqERokHF7paWknXb3tBPfuE1Xvx5WI1e4ccl4bOIi qRx1vgeCyQuPUY0RhGdXuIvhv2QKZkezHWCqa07PZihDE+JNXQFUbTVBDNTeQOtxoOG8 /gxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=j+y6QEij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id p206-20020a815bd7000000b0059f7c51f9easi2325380ywb.377.2023.10.27.05.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 05:17:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=j+y6QEij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 9594F8055569; Fri, 27 Oct 2023 05:17:15 -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 S1345585AbjJ0MRG (ORCPT + 25 others); Fri, 27 Oct 2023 08:17:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345804AbjJ0MRF (ORCPT ); Fri, 27 Oct 2023 08:17:05 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9A3E129; Fri, 27 Oct 2023 05:17:02 -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 39R5TnCT012403; Fri, 27 Oct 2023 05:16:55 -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=NgILK9wtLyMUAwzUUpKcc8XDHZhA7pOaSTnLVOywbdQ=; b=j+y6QEijy0fZMfGbAOS4xBaehRxdN8Ze6q+Ts8jT+fxvSFTezgdCg7gHqlRV/FSnxZXl 4aL3cZpb+LiTKnb9PdvSwPXTubnmaSatKKhRka+UT+YME7g18qES6qW/B8i8KTVZUXaX sFz5JUqS8sYKerEjQEMh2WsMU7YiGh6a3gbjDFpMcDdRavHX1EpFnzmrZeIdpRqckneM odY5GzbsJNc/hu3T56igKotHe3OWFTSQnurScM7UdOYT6lYUX/HNJXpBMoe9lOfdSWK+ df4jNVajIyjxFteVuOAToI1uB3usBaVweG4xt2piqnBz7msLuU0zB0I45zCM8Qi6dE5o BQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tywr83b2x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 27 Oct 2023 05:16:55 -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; Fri, 27 Oct 2023 05:16:54 -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; Fri, 27 Oct 2023 05:16:54 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id D8F7D3F7050; Fri, 27 Oct 2023 05:16:53 -0700 (PDT) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v3 1/4] octeon_ep: add padding for small packets Date: Fri, 27 Oct 2023 05:16:36 -0700 Message-ID: <20231027121639.2382565-2-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231027121639.2382565-1-srasheed@marvell.com> References: <20231027121639.2382565-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 3qNwm5EDD6Rh59n-SfkWgtZXvZghafBr X-Proofpoint-ORIG-GUID: 3qNwm5EDD6Rh59n-SfkWgtZXvZghafBr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-27_10,2023-10-27_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 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]); Fri, 27 Oct 2023 05:17:15 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780910956586569118 X-GMAIL-MSGID: 1780910956586569118 Pad small packets to ETH_ZLEN before transmit, as hardware cannot pad and requires software padding to ensure minimum ethernet frame length. Signed-off-by: Shinas Rasheed --- V3: - Updated changelog to provide more info. V2: https://lore.kernel.org/all/20231024145119.2366588-2-srasheed@marvell.com/ - Introduced the 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 Fri Oct 27 12:16:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 158919 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp557491vqb; Fri, 27 Oct 2023 05:17:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFTZPgviWF/pcyherIgkzf34AcP2RMEXlYz+CwWLgoHKRD5F3Xd2TBvyozr4q7S0ZhYpXGK X-Received: by 2002:a81:b723:0:b0:5a7:e4d9:f091 with SMTP id v35-20020a81b723000000b005a7e4d9f091mr2157712ywh.25.1698409063264; Fri, 27 Oct 2023 05:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698409063; cv=none; d=google.com; s=arc-20160816; b=nYPmsq3me8+W+rFu+Aw+wjOpxTrKBejrc6gaOW/8u+u2FIJdG/ngQ+lqyyG5Fu+MVA dQVmWUCl0u1s47UelJ2x64LdFGKrOi5C5+LA9dyUXuMiJJolAGPtw3J9Ig202BPW1hQp hhoroBUW6oeL2trwmecmdSptmN6T5Oty9bAlt27vBepJWFGQda9TuGwBwYrJxZwgKX/N A09MzSBiNRL1Unk82pbD+l3ATRI7Yx7hYXlWmAGOy6yNxrp3+P+OwLXnJF2k/19GPfkh yifDzPjcop3kC+UP0QTi1n8NmloghN3yCoRt7xSjECD4h1AnDLKLSENODNqs9RNvkRZP DnOg== 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=fSqhxtS/1AmnssqhTQOzpYaNfkzU3t8Jj5QZNarTP9M=; fh=PUbSZjf2dtyqulLdd5rISVghnntgSGxvYpWMBobeHB0=; b=jlQE7Trx+hL863FAcvrhiexDmPgZBBetpSLGPvFjgj9dieYMNF7DR0ZGwhyJop+965 R00XGW1QzfONu3awGih0NXe8rrClNyPy7pGzsOgbWrWIKOo/FcKS7Y1a0fW8168fAno9 M1T9WFhksa1kLgZ3juI2VyRviCjwANQRaYJOiNJLShY7CNYpTnoyEBIPQa1gaIfYtl0O Ek97yT+oBoZxQlbY/8AIAead5vsviGdl+UBLdxbSO/zL5V+xnrGcQrjvH+0JsiT2P2kt eWxBFakR4gH/MJp9FkwkqXOsABEpRTpTQ9t62hl/KaSWhm09jqnM2552ZABhyJ+mhlkK ACow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=ERFzmM95; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id m203-20020a0dcad4000000b005a1ffa137easi2129363ywd.319.2023.10.27.05.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 05:17:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=ERFzmM95; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id A85768456519; Fri, 27 Oct 2023 05:17:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345823AbjJ0MRH (ORCPT + 25 others); Fri, 27 Oct 2023 08:17:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345802AbjJ0MRF (ORCPT ); Fri, 27 Oct 2023 08:17:05 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B0EC0; Fri, 27 Oct 2023 05:17:03 -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 39R5TnXB012400; Fri, 27 Oct 2023 05:16:57 -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=fSqhxtS/1AmnssqhTQOzpYaNfkzU3t8Jj5QZNarTP9M=; b=ERFzmM95gEeY82VS4DxohelNb97pXld4kfoPOxb11uVV1myYkkaFKA4aS7mPh7s6KV9d EXGBX9wtBA7KT5XNrxCxRc8nbZhvBv/UmK4nbyIoL3PAtl715wVCJzS9cvjzm8e2SSAS kbyRmLdrWN5MstcVGDLETlfL0lt9oRy0YQFiMOwxl811K7mjfquCkEaSnKMdQR7ZWrE4 iFXO75vdZiK7YjaLBdFD88K5tHsL9RqddaI0rzcg/RuBBrFi+bzaTi5xeGBrog0o25xY skC7I7b43lWIMyilleCSMmmankLTh1zfK48vt8VxdsYFvQeBtwQ1//bN1LjSy2w4I8xX lQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tywr83b33-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 27 Oct 2023 05:16:57 -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; Fri, 27 Oct 2023 05:16:56 -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; Fri, 27 Oct 2023 05:16:56 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id E71B03F7050; Fri, 27 Oct 2023 05:16:55 -0700 (PDT) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v3 2/4] octeon_ep: remove dma sync in trasmit path Date: Fri, 27 Oct 2023 05:16:37 -0700 Message-ID: <20231027121639.2382565-3-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231027121639.2382565-1-srasheed@marvell.com> References: <20231027121639.2382565-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 1-PWzt5bDtpitJb4IAJ7x93ZNFmBZOYr X-Proofpoint-ORIG-GUID: 1-PWzt5bDtpitJb4IAJ7x93ZNFmBZOYr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-27_10,2023-10-27_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,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Fri, 27 Oct 2023 05:17:39 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780910981564580812 X-GMAIL-MSGID: 1780910981564580812 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 --- V3: - No changes. V2: https://lore.kernel.org/all/20231024145119.2366588-3-srasheed@marvell.com/ - 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 Fri Oct 27 12:16:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 158918 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp557442vqb; Fri, 27 Oct 2023 05:17:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPQ3yAZrQFs98jSV3XcpGRk3viTOnLmh9uKZRuCRhjhV/SqyIsBM4caszHgREItev5YqhY X-Received: by 2002:ac8:5dd4:0:b0:40f:d56b:6f8e with SMTP id e20-20020ac85dd4000000b0040fd56b6f8emr3329079qtx.28.1698409057140; Fri, 27 Oct 2023 05:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698409057; cv=none; d=google.com; s=arc-20160816; b=RxDQ9pUeJpWlLUux8xnXyIq9s60vkv/FPP7UJ+uCZvRRm9Bbcjo5LNt49/kHtc27pF I3WLbkWO7eiMe9t7B+t2L8FLkFfECzA47XCCUpsGLSDyCR3BtmJB7Ofv0x9gZyKNWAHB EP+LrGQAjduh9ueqBHXOZorMdnae95rkpsocBS6Cx86zniDf2wJ3pYAaO8hgJWiEds84 X5OPT/8XezODg4aEiaKVCVVgGiwMnJqgTSXbuANM2hPmvIZbtlXi1C9Gg8+IlPkMRjCs nk0KVHvJzd/BhrLNldNF/Y+EzywnevIBNQh3Nh10vvtAKfk7njVZzEp5eeSXLOYvHOLA a94w== 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=WpPrQvBv581xH9Q+hoN7ujJTdwZUV8kAtI0vdK7h3Wc=; fh=PUbSZjf2dtyqulLdd5rISVghnntgSGxvYpWMBobeHB0=; b=PuR19gjEan6G4bOBaOSz8yAlHTrMquLKpxnh26K6QvEQaKCkb94SnH67bUPWxVO3VC kgkKIS4cH2iPZ3qw+nZCVW1wfN7LhLJkIe2td336bp4+QjIL+WhkE5O8kRqEzZICi58Z ruOSHZQSBJas5LHtQLNRqJGwMNUvZgz3jWKw0ODk3i5YSOQhpoZXiEVVNLvLUhcUPf1o ctwzi0E7QNOcIaoVEjpDzJUDU52fm3O8ZkpgCjVZCeNZQz9FFUMewhDLPuVB2hTQWkF0 fm2N0He8cSQnqqzIEv7jnpBMyAJYTrwnoDCviekoqfn7uRSuwswJwEZHxMbe2p2jR6QV ePYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=MvlBu7Ao; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id j19-20020a05622a039300b0041806027aefsi672377qtx.796.2023.10.27.05.17.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 05:17:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=MvlBu7Ao; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 32A6D81D2716; Fri, 27 Oct 2023 05:17:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345856AbjJ0MRQ (ORCPT + 25 others); Fri, 27 Oct 2023 08:17:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345826AbjJ0MRK (ORCPT ); Fri, 27 Oct 2023 08:17:10 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC792128; Fri, 27 Oct 2023 05:17:07 -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 39R5TnCW012403; Fri, 27 Oct 2023 05:17:00 -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=WpPrQvBv581xH9Q+hoN7ujJTdwZUV8kAtI0vdK7h3Wc=; b=MvlBu7AoHhtvPzwZX5URMFpBoBJC9MvK5ABlewpReJ8ilOnKTfvoKeoCoF74mJsvpRyx 6aHOEERKeDJK3jL7CEwzy77oegHiirzp+AwJXJG44PHTtkXABeiwk4iZiLEAFUQN4clI 95zqSoGqVIQoJbhz0CiRJwhyetlQsMdw8xJPHv//Svgiu1RHWW9mrjMiGUNv1Kv9vcVN 3T/gu6WPSOA97L890Yn7JISS3SLtKI2LoywKMqMt5rPRcnhyWc2ZROlDo+S9/HrMDPCr aUvqZcmmWqFyhHMooiZRPz3d1ppliLeknSI3W2bhd0g+gfM2O6baZdOjlu1aEwaFWRaR mQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tywr83b3k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 27 Oct 2023 05:16:59 -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; Fri, 27 Oct 2023 05:16:58 -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; Fri, 27 Oct 2023 05:16:58 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 375CB3F7050; Fri, 27 Oct 2023 05:16:58 -0700 (PDT) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v3 3/4] octeon_ep: implement xmit_more in transmit Date: Fri, 27 Oct 2023 05:16:38 -0700 Message-ID: <20231027121639.2382565-4-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231027121639.2382565-1-srasheed@marvell.com> References: <20231027121639.2382565-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: LoM_VoaeOICPwWDva4kopAa7GEueX_AM X-Proofpoint-ORIG-GUID: LoM_VoaeOICPwWDva4kopAa7GEueX_AM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-27_10,2023-10-27_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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 27 Oct 2023 05:17:32 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780910975261899520 X-GMAIL-MSGID: 1780910975261899520 Add xmit_more handling in tx datapath for octeon_ep pf. Signed-off-by: Shinas Rasheed --- V3: - Stop returning NETDEV_TX_BUSY when ring is full in xmit_patch. Change to inspect early if next packet can fit in ring instead of current packet, and stop queue if not. - Add smp_mb between stopping tx queue and checking if tx queue has free entries again, in queue full check function to let reflect IQ process completions that might have happened on other cpus. V2: https://lore.kernel.org/all/20231024145119.2366588-4-srasheed@marvell.com/ - 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 | 36 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 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..2d1bcdc589f3 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -784,6 +784,13 @@ static inline int octep_iq_full_check(struct octep_iq *iq) /* Stop the queue if unable to send */ netif_stop_subqueue(iq->netdev, iq->q_no); + /* Allow for pending updates in write index + * from iq_process_completion in other cpus + * to reflect, in case queue gets free + * entries. + */ + smp_mb(); + /* check again and restart the queue, in case NAPI has just freed * enough Tx ring entries. */ @@ -818,6 +825,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)) @@ -830,10 +838,6 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, } iq = oct->iq[q_no]; - if (octep_iq_full_check(iq)) { - iq->stats.tx_busy++; - return NETDEV_TX_BUSY; - } shinfo = skb_shinfo(skb); nr_frags = shinfo->nr_frags; @@ -894,19 +898,33 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, hw_desc->dptr = tx_buffer->sglist_dma; } - netdev_tx_sent_queue(iq->netdev_q, skb->len); + xmit_more = netdev_xmit_more(); + + __netdev_tx_sent_queue(iq->netdev_q, skb->len, 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; + + /* octep_iq_full_check stops the queue and returns + * true if so, in case the queue has become full + * by inserting current packet. If so, we can + * go ahead and ring doorbell. + */ + if (!octep_iq_full_check(iq) && xmit_more && + 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 Fri Oct 27 12:16:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 158920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp557503vqb; Fri, 27 Oct 2023 05:17:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBON23Qi8qG8lYo/3HTMu2Fy7Fk6jY1lQGzajTj5DeE/X8jR54paGvo9/S68PelR6E1wOG X-Received: by 2002:a9d:3e11:0:b0:6d2:e1fd:9f3a with SMTP id a17-20020a9d3e11000000b006d2e1fd9f3amr300472otd.10.1698409064894; Fri, 27 Oct 2023 05:17:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698409064; cv=none; d=google.com; s=arc-20160816; b=FNrqjbvb+m71FgbqshEiEO1MWgmfyB66tqyTvGPQXGBvEvcLcjRL76FKsMv3PJ+B3z LmniVDXHXtMSPYeSuZKunIvf05/xyqGH1UNRFsJfsPho9S8Xtzp1azQa8rBpUcg/SXFg coH5RYTXSqwHWkCc/YHsNFbrrE7kJnv9I8CNFSNDjyYHPnC6/spyYCPU6CvTKPUBwpt6 TMVc3urJkbnkX8nn/TyBFgOeHpF54XYaE2A6wE8BzVfqrFqPRzxh7pp6v117xuFg2NML chCy/L1sgaoYl1z4r2odyf5UCLIylUBPw3Okf+JD7K3YitG4RcPAyNc1ooKtj6nvhJqU 4nRg== 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=3wc5P8WLQQ7TN5OjSZbRJnjfWuESLwFLz9t5HbnNk6k=; fh=PUbSZjf2dtyqulLdd5rISVghnntgSGxvYpWMBobeHB0=; b=XUETi2iPT1tXnpE+BFoPEzMP92scPdcrPxhKH1c2Z9EyrmrTmnAli8HMuWZcxXrap7 HXSqSD/IzONTXKzeMbRLOO3bCg2CxRhi7zr2ffFv11Mym6NXMZrIPCqf3wI+ma7kqOaM s0AyKsOGQLBXsxfowD8GoPMsYZGRX5uIldlHS0cJ0YnW9Ylf921xZeDBGUFyr/FLKXd3 Ct/RjWymFV78QUozswDTgc1gjffB55BtJJEq9ky9qIbhqgA31JHR7uaPWNu4UVB7r6qr oHkEc8xZ0rcBX8OpDngW11IJfttArrH1hzmgAuvTAUBYHBRubKPqGDB7zNUuy1oZTSNS xsJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="gr/C/a5j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id z15-20020a81c20f000000b005a1cf486831si2347279ywc.330.2023.10.27.05.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 05:17:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="gr/C/a5j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 1F96D83383AE; Fri, 27 Oct 2023 05:17:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345841AbjJ0MRV (ORCPT + 25 others); Fri, 27 Oct 2023 08:17:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345844AbjJ0MRR (ORCPT ); Fri, 27 Oct 2023 08:17:17 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C72AD72; Fri, 27 Oct 2023 05:17:12 -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 39R5TxFL012574; Fri, 27 Oct 2023 05:17:06 -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=3wc5P8WLQQ7TN5OjSZbRJnjfWuESLwFLz9t5HbnNk6k=; b=gr/C/a5jZ+yck+A+xeimVmQhZg4IavskP6U+b4FJuaqmextI4xv7a3A1UlewR+Vlnt25 1VdqADFlf7Mx+lDvidVIWLWu+OMrt4kN3lOs83uxS0VI2HSWW+vX5JCosrZZIwizEmvs +Zo6LagVWCrmk5PwxeVhovuEbuROGpLNSlCxT1e8i3MGYCkoluEr1PIXH8OkCFKferOa mph0JZ0LWp1d2VXPJ/jkABHObu1dg/yRvDgOdtDpqOwqkZmb3N8oaBMGm2W6f8ipM5KU I6Shb7VwCQE5HsiN670jTrHpJaGJ4wezrK85fUtmZxY+RBZHz3vL7BtNukKe7b6Liwky lA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tywr83b4g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 27 Oct 2023 05:17:05 -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; Fri, 27 Oct 2023 05:17:04 -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; Fri, 27 Oct 2023 05:17:04 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id F0F4A3F709F; Fri, 27 Oct 2023 05:17:03 -0700 (PDT) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v3 4/4] octeon_ep: remove atomic variable usage in Tx data path Date: Fri, 27 Oct 2023 05:16:39 -0700 Message-ID: <20231027121639.2382565-5-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231027121639.2382565-1-srasheed@marvell.com> References: <20231027121639.2382565-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: BuBXPUVKdo1UWaqUCkheC4Oau8gX-Xur X-Proofpoint-ORIG-GUID: BuBXPUVKdo1UWaqUCkheC4Oau8gX-Xur X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-27_10,2023-10-27_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 groat.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 (groat.vger.email [0.0.0.0]); Fri, 27 Oct 2023 05:17:41 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780910983403480539 X-GMAIL-MSGID: 1780910983403480539 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 --- V3: - No changes. V2: https://lore.kernel.org/all/20231024145119.2366588-5-srasheed@marvell.com/ - 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 | 9 +++------ 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, 14 insertions(+), 13 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 2d1bcdc589f3..974a34be9ffa 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; @@ -794,7 +794,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++; @@ -903,12 +903,9 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, __netdev_tx_sent_queue(iq->netdev_q, skb->len, 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; /* octep_iq_full_check stops the queue and returns * true if so, in case the queue has become full 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;