From patchwork Tue Nov 14 13:45:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 164906 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1867310vqg; Tue, 14 Nov 2023 05:47:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGY56RgXUus2VypPWXVxMI9V1ljrPFYt7h7+zYP7DtmYf6mn5hxJRa1dDDu+cNHZml6c0Na X-Received: by 2002:a05:6808:2a0b:b0:3a3:b39d:a8bf with SMTP id ez11-20020a0568082a0b00b003a3b39da8bfmr11334154oib.45.1699969631387; Tue, 14 Nov 2023 05:47:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699969631; cv=none; d=google.com; s=arc-20160816; b=l1sToJ87Lc5T3f1QBqoBQP8yGZJsEje0KbST3dyFP1HnzgORRDIaIvsWQgQeME7WB5 ptWTOzbGwAepg24Hwu7Gb5waCIz+RodrkOAZH4NwIAXS3j0lYk8PXBV5S8OaPfE193B2 a+akSO+zYNAZvcQ8MjK0l5HSQbSxtDjAJZ7IGthwu9dA6tbia+TTZOiMt4Ii+aPGmbEK BW8eGHMVhBUSvdk5hNwXa3Zvzc+fxpJVHRfH9mF/lWy1FN37jV4RvRpJ0qIbaog5IIkK F+bI9M8Qo6wqiIGfcPEK/y6faEr4A6dSjyPeC2j0r1604Db4nDiZBVzoy5zt5hhpXydW pgwA== 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=l9yAGliR4jTTrLNBahKh6ItB0wiKs4rAGslfy1smUIM6Nhl22Mn2NbSpRO9qeR2idV D7QTTZmq3KxlfvFpuZln7pekKAmtMZAgsb3VkEvavNKwiZfk/uJg3gePVmpEhXzlduve 0+0E91MCwhbcK69xQ1i7W4DfhCZ2gksi9UZ7BH3rFNyQ5ZEPgmoACfVZ0p8sGyFiFpv+ GDCuXV77cHphfl56q0A19uHv8vZK8BsoKU1Nv/6UFUygE6t6Z6mhFNSVHlVDvVu5ZRKm L3ViRPsv+5LSdZk78tsMUSnqscp/P5+T7rGS6LTalzhEbzgpsQBj7l4+1QepKvVXn3td U3dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="A/d4yDKM"; 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 k127-20020a632485000000b00584e731e7fbsi7420368pgk.280.2023.11.14.05.47.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 05:47:11 -0800 (PST) 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="A/d4yDKM"; 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 B46E48087274; Tue, 14 Nov 2023 05:46:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233286AbjKNNqF (ORCPT + 29 others); Tue, 14 Nov 2023 08:46:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233233AbjKNNp6 (ORCPT ); Tue, 14 Nov 2023 08:45:58 -0500 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1215E1B6; Tue, 14 Nov 2023 05:45:55 -0800 (PST) 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 3AE84dfn017588; Tue, 14 Nov 2023 05:45:43 -0800 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=A/d4yDKMlXNQi07eAhEsK9oKc01xK93KL2ojqhPWri1VLYy8pPUl5hoXI6cUwdIiZ4ib EDPPmxjgSa2LXFQaUB1XSWLh+t4xBo4F6PbXLUhowZcQjeEfbH4FcsVwlv8llxoTQhMs laxs5TcQfV8d8fFdJ6UDGKu9It4mhvEuEl9KAMknPDDBNy6V7HteiZzZeiTEhZO5/GJc iqZ8vLDBQbAkjhl+8tXL7l0N+k63VRRQenUAeEU3IEYuTko6I6ocMK9XaO+Wo68rnly4 w6qhHnVFkEesF2ZvyU67qFL3kDQcoHAwktNLpZCfgQhaGWS0czfU+z9i54AUnRAJ5keA 2Q== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3uc52eh2g5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 14 Nov 2023 05:45:42 -0800 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, 14 Nov 2023 05:45:41 -0800 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, 14 Nov 2023 05:45:41 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 9942C3F7055; Tue, 14 Nov 2023 05:45:40 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v3 RESEND 1/4] octeon_ep: add padding for small packets Date: Tue, 14 Nov 2023 05:45:32 -0800 Message-ID: <20231114134535.2455051-2-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231114134535.2455051-1-srasheed@marvell.com> References: <20231114134535.2455051-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: GikNC_wqM2QJ-1u8si3NPMUdv7dHLvYj X-Proofpoint-ORIG-GUID: GikNC_wqM2QJ-1u8si3NPMUdv7dHLvYj 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-11-14_13,2023-11-09_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,T_SCC_BODY_TEXT_LINE 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, 14 Nov 2023 05:46:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782547356284393640 X-GMAIL-MSGID: 1782547356284393640 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 Tue Nov 14 13:45:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 164908 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1867333vqg; Tue, 14 Nov 2023 05:47:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IE188UEmipnqO16ZETdVqePc5qxOPWSUQqiTyp1T7DxE59Im3OrXp1AabViH/8qw28VK11U X-Received: by 2002:a05:6808:4442:b0:3b2:e3d0:863f with SMTP id ep2-20020a056808444200b003b2e3d0863fmr9815159oib.13.1699969633879; Tue, 14 Nov 2023 05:47:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699969633; cv=none; d=google.com; s=arc-20160816; b=DCGE77vQ5BkacUkCgfCFY5AFK/FdzAautlihS8xos2dI7JFBja8B6w+Rgaabke2a1J jftt9EIqa14Yk4AqbtmcIu8hdRkLPPFC4jNkBxwBA1roV5EUw9yPVAf5qiJjQAq4Jmq9 pIqbey70wzYRIn3Mq0boqTKdN2+X0kTn1uKWpSQ+FSYLmkkdyoSYEYGubso6VbyPg97C u0ZTsvGZXkv6MxazTVJm894zgz81KNEs9LZv4807xZ86ngq812Rfc04+0CHCxjRYa/zi UdKFb+Cdlxx7oUIQmabX7D/JtfkOKRdd4NFwXnaeojoM8jjbppt4GoHpN/nXM+wNq7KD JPeg== 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=O64LU1VsxyikEmBlB/npRO0ptffniSgUb+mTTQErg0nOfIwuy5NbY1zDbrfbYpLUmU qZJvXIMLl/eGTrfIxvDefkX4YRHWf55bzj2sXmoK65Q6W1uikyTIIj/ZZKbCNhRIuLQD d3ebtawnf+esG8X70vqci85ZY/J3WS0xG5F/pFUGaOhsRPPdI+cUR1l44jePzVUXbZb/ nDlx2zVd+7FmvsyaskrXccOWQDbGZeB1NY3EJsKaMx5uBl+6lg8nJJYwdUPt+rOSx3V0 Q+deozmaxTUz8fO0HBPNaB3ncv7h63ApcnCJPv8H8F7zC6rb/nlLO88YdJz06XQ2zybZ 3S6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="ZG4jR/hY"; 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 w123-20020a636281000000b005bdf5961e67si8191356pgb.639.2023.11.14.05.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 05:47:13 -0800 (PST) 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="ZG4jR/hY"; 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 1E5B98069F10; Tue, 14 Nov 2023 05:46:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233294AbjKNNqH (ORCPT + 29 others); Tue, 14 Nov 2023 08:46:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233237AbjKNNp7 (ORCPT ); Tue, 14 Nov 2023 08:45:59 -0500 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CDBC1BC; Tue, 14 Nov 2023 05:45:56 -0800 (PST) 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 3AE84a2l017584; Tue, 14 Nov 2023 05:45:44 -0800 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=ZG4jR/hYjx+YNWsKoemHf9jzllhG/ehzG6u5xMymx1QBdo+84Z5/ArZSsZM1E5BhbcWf tnjWwMRqEuFDl/gDYm9ZcyjJm2DG2mouAf4djqTpY+dncA2n9tBMaf6ozKHSU4dJPhkh VwwaYOIqxJA/EWUc6wTQbiI9R6mqAz/Jxxyn3Vbb2gi0/PnJdPuLndyl+F0M5uLRjQiU aIaJfAPMYlkCi4yA+pmsHfMCyhLspu3hU9/UmRBkq9fvRxENmZ80FVcaGPlulgGe24vj OcsSbm72eeEA28CbVnDZprPnrWObm75xXaKL4V6AekWdHN0rVKZODgLglK6PEGemQI5e jg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3uc52eh2gb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 14 Nov 2023 05:45:44 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 14 Nov 2023 05:45:43 -0800 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, 14 Nov 2023 05:45:43 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 911B73F7055; Tue, 14 Nov 2023 05:45:42 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v3 RESEND 2/4] octeon_ep: remove dma sync in trasmit path Date: Tue, 14 Nov 2023 05:45:33 -0800 Message-ID: <20231114134535.2455051-3-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231114134535.2455051-1-srasheed@marvell.com> References: <20231114134535.2455051-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: uxXA49tBbC49GUy1NidEsVXOjcvv0rVh X-Proofpoint-ORIG-GUID: uxXA49tBbC49GUy1NidEsVXOjcvv0rVh 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-11-14_13,2023-11-09_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,T_SCC_BODY_TEXT_LINE 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, 14 Nov 2023 05:46:17 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782547358882758814 X-GMAIL-MSGID: 1782547358882758814 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 Tue Nov 14 13:45:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 164905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1866973vqg; Tue, 14 Nov 2023 05:46:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFY0Hyj7CeX6IhxuawGbzDP3jN51LzFyxGcdm1hRaM+aEB5s5TUbIdHxY4bxOV5WFmflClW X-Received: by 2002:a05:6a00:2d1:b0:6be:b79:eca with SMTP id b17-20020a056a0002d100b006be0b790ecamr8985508pft.32.1699969595578; Tue, 14 Nov 2023 05:46:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699969595; cv=none; d=google.com; s=arc-20160816; b=Gy6T/rplUHiT2DwVQHhOftPZ1QYQ2RZ7rvm0E5Jhoa7LaYbmZA7388zgquRCxbC2TB quQqWs8DzBLRQW2glkkH8pjyKTYZKydIWynUJByjZCxq8OpaP3n6KcfvyRgPW25UBJHD dqhPE7/uUFG01G3SbDut0JFkAkkcA3CfDTevUjV5q0M2fnt/7GoEWrDXXBqWC3A3zdZM X57STVY8NdqhOUeNM+fUGwNC+sDxPpGSrbCx0vVTrFS6L4jhJfxywSIApNZtCtegsDfH ylxV0vnuq+M4cjdMfIIOXPaS27fU69bwvGQQPkaUEMrLPHHLdsMiwGiI846X9wn0MKqH QVVA== 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=ZJe6vjqd8jN38L7SsYJHj/X/zNeCiFEqhHewijRe+DLcLdxx1pMT1RjEw9AmdPRiru t26vQpWqx5lbuqL2byaoqjc0t0bbEx98XQKH3vVgfTYXrZso1dwXK0rjgiXJoP1hPNl/ 8gXQlEcYm7UBami9u37ZZ7g8pQvbZbeV1F2K4Wvt/1IAX8SzjDJNR0KuSH+/BA0cEnv1 T9DS4YC+G8WqUHCv9vnvH9hkgZFq9WSacAe7e7H/sZeafsxELXUEpX2ycaW3agdX7Ayb AGmICCMolyzMHJM5RUNAUmPo3ofaUVJYycXabLAbGBrRU9MHfb/k9WNKAlptP97mqCcL MvWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=BJv6ol9y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id j19-20020a056a00235300b006bc3f09ea09si7880740pfj.26.2023.11.14.05.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 05:46:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=BJv6ol9y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 B5D2B802B545; Tue, 14 Nov 2023 05:46:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233252AbjKNNqB (ORCPT + 29 others); Tue, 14 Nov 2023 08:46:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbjKNNp6 (ORCPT ); Tue, 14 Nov 2023 08:45:58 -0500 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD3411B5; Tue, 14 Nov 2023 05:45:54 -0800 (PST) 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 3AEBtemi021217; Tue, 14 Nov 2023 05:45:47 -0800 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=BJv6ol9yJ1GUe/HUSTPU/BzR0VL8RdYvnkiyUbutI343tqmy1c2MWaAbHKYQh6ubo38V BGf9jHiBahCjKkVFRbwkFm3xk7tu99bmXatKlxk5hD9rEW9lr/f2DXKPTmKCwJDdvCOa XhUZ7LfknP+rvgDkmWw2NGOrRpz3K0kffQMatO/1Lt0Bw15ZEyMjYoDdZAmRP+kikNk7 UFpXUmi1pN295lLiwvTBl9ZnKZzWEC9fLJLB2AKotJRZZ3F/al0gB5KUVN92X9u4SVQy Nr2v8IDyRvhuQq0AUkL48gOojohDScpvWvm71RclP7J0xIuLBLBIBBk+AtITufZBKIVr Sw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3uc5vmgufs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 14 Nov 2023 05:45:47 -0800 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, 14 Nov 2023 05:45:45 -0800 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, 14 Nov 2023 05:45:45 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 8E8DE3F705B; Tue, 14 Nov 2023 05:45:44 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v3 RESEND 3/4] octeon_ep: implement xmit_more in transmit Date: Tue, 14 Nov 2023 05:45:34 -0800 Message-ID: <20231114134535.2455051-4-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231114134535.2455051-1-srasheed@marvell.com> References: <20231114134535.2455051-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: BGQfsUGJJ1-YWqAUjqoYfpiHj6_hAfl9 X-Proofpoint-GUID: BGQfsUGJJ1-YWqAUjqoYfpiHj6_hAfl9 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-11-14_13,2023-11-09_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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]); Tue, 14 Nov 2023 05:46:29 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782547318613591907 X-GMAIL-MSGID: 1782547318613591907 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 Tue Nov 14 13:45:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 164907 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1867320vqg; Tue, 14 Nov 2023 05:47:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJwFtNU57Vyn60i7zklpt1QVt6NSUj+vn3JcjEbu6u68OaCBhVqE4EOcWZrZ8IvX3UrbTp X-Received: by 2002:a05:6808:3c4b:b0:3b2:ee79:c0fd with SMTP id gl11-20020a0568083c4b00b003b2ee79c0fdmr13704850oib.1.1699969632237; Tue, 14 Nov 2023 05:47:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699969632; cv=none; d=google.com; s=arc-20160816; b=RvW/5XV8SwY2eOGlmT7EHMmrZ9k5iukaTHvdonwXW0zC2grt4P1tkVDP5DupkNmrMS K1pMyXkIruCUBEpiXKy3odGU92vJIjvkl5sUa8qjSB6sei9QbWKOtlNLFL5eFs0JiBBj 0YbG8cd6BvxRMaJOC2dpRGcRnlh/yN3SrvAhxXddNrWYwXxpr1YKg+u7ft1+MgAX8Pn2 Yl5z0YKU4A1F0ATTAAc36fnUYqwW2KPdigEpSnNMBQVy0FXLHaY1XLShfXCF8nvdkptA bBYykzWtcUpE/EUM98GjzUrk6/ZQN0u9BPK6iW2vO7gQbCpjVkeXQqSiikzdu4bTd3yA BI7Q== 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=u6IVb7EGHzaJvFXCjUwjpUfmLRoDiHbjBhzVciO0ulQT1sCtYMkxhwUjIXvyioz8NV n2sqXregbR/72bfVDhsmfzeWniE1bJFukxrUTh+qHCqiw0VgodpsIjBdj4ofkiB9plLF RqH0FR77XFEkufHAz/cczvUzhBFUTVJrnns09Qe2sHlOTp4TTnUw1zjn5swiugMmDzcU UK2PJdJhb/Y7clYjpmQZq6HrcdA2nRCk7Wi6wjNCCiRrIn+D0lbWCEWR+yDYyuTrIVm2 4uAvjRhauxccJtfg1RkcTbi+e9UWSoHrhc67Ab6Nm/f9o4UKT+ObB/sMr8t3tRwCZ9Hx TR6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=X6hBJshj; 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 i75-20020a636d4e000000b00584b2a790absi7990520pgc.821.2023.11.14.05.47.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 05:47:12 -0800 (PST) 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=X6hBJshj; 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 B66E280713EE; Tue, 14 Nov 2023 05:46:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233257AbjKNNqD (ORCPT + 29 others); Tue, 14 Nov 2023 08:46:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233234AbjKNNp7 (ORCPT ); Tue, 14 Nov 2023 08:45:59 -0500 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9639132; Tue, 14 Nov 2023 05:45:55 -0800 (PST) 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 3AE84nPL017684; Tue, 14 Nov 2023 05:45:49 -0800 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=X6hBJshj6Pq/aoYfwwNE2Vu0pwzr1Gg5h+5dD/lLqLS82OAuLp9L470F0zuqXzS749Vm 6iFcDwPN6n2qvnQCotVF9vWdezfhdgbIGs0pBXvkjmnhZFiWsckN7XqUYuAcW1f9MrcK /mixDTjWHBx6mel5EASOrgNrMavaGZCztTPMEAhS2r+pPEZGtaWTEVnOdT4bDflrgtbA xdWKwNXzrFocRQSWko1sotA/rxQNT9wX/l30l/Dv/TJXXumei/rfoLNwnye15mtwnF92 +5pT0jS0yER6UzqWqlQ3J0RUIDO+K5KTFRCVXe9d4C7rg1X2SBjRnAeZjSduAzCb6dIQ pw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3uc52eh2gq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 14 Nov 2023 05:45:49 -0800 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, 14 Nov 2023 05:45:48 -0800 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, 14 Nov 2023 05:45:48 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 6AE873F7055; Tue, 14 Nov 2023 05:45:47 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v3 RESEND 4/4] octeon_ep: remove atomic variable usage in Tx data path Date: Tue, 14 Nov 2023 05:45:35 -0800 Message-ID: <20231114134535.2455051-5-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231114134535.2455051-1-srasheed@marvell.com> References: <20231114134535.2455051-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: Hi5Ev0UPbINi1FZW_ZzhJXTqtv9l6sB_ X-Proofpoint-ORIG-GUID: Hi5Ev0UPbINi1FZW_ZzhJXTqtv9l6sB_ 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-11-14_13,2023-11-09_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,T_SCC_BODY_TEXT_LINE 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, 14 Nov 2023 05:46:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782547356946751787 X-GMAIL-MSGID: 1782547356946751787 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;