From patchwork Mon Oct 23 11:44:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 156846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1235091vqx; Mon, 23 Oct 2023 04:46:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYtgM9XWgwGGxkGM+Wncw2DsIJxO0yBYshUA0yb1rHoknEk+mZJXg0qtcnljF0A3wB+1Dn X-Received: by 2002:a05:6358:ee45:b0:168:d346:9ee3 with SMTP id ik5-20020a056358ee4500b00168d3469ee3mr5854484rwb.24.1698061572521; Mon, 23 Oct 2023 04:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698061572; cv=none; d=google.com; s=arc-20160816; b=jkDxD8j5TrjDp6u5UUzGxBy2APq7rOd7I6VholR+H73KiYWflAKRlW34F8HRYmvwIg npDFLxsT9AesPGQkqXahcuEN29yWUTqdykJ1YhrN8aHsmFX7bIUudt0J1WIQrscr1Xt+ PoU+d+KRr7asDRGeCsN/hnRkx5zFcPjCmSIZrkWediUSqQzCfyidZFWB4FG5qMGNFxof nXt5lSGcxoinBhtlk/cH8qo0lk0bzkavFwsRAhSxA4RyMUUUPXxsiSPZ1ADR0q22I7is Y18lxIpDtGYGnDVAf4zSvYhi8pF+6IM8piI2zMoJAnnSJnD6VUTlGS2wAwjyt6wJV/Ju 0Hsg== 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=UH9OxHXbOjRhxSx5V7Clo000R+zwqhWrGr3Zie/QOlk=; fh=ExM9ANAxmdP53lLzdQyGkcWMXv2I2jExERbtPlLSxEw=; b=B2rerwCC3UWY7TSyGVB0YjLgbJhFw4KpLad9600Cme+MmjRLvH+O9GWo/wJekXkbgr kURcrwtyE1w2lgFk/ex8vTjimaPO0yyBhymwMXYR57HzOANJ0tQX3BUsVdxKPhtQpX1l ihqfn6aKDqHHdVioMUpyjDE0zWg7yucoQmBMj95aK1bnl8287DMXUJtzEe/+YC54bicJ moCeaVO22Vi5ewektOhF7hZZ2FKIEQzy7q4Mh//+/Vk4L+z/5+huxShUdRqFYyC8MYnV qb9PK2zVWkJWVvNebycriQAJMzB8Kb7ANPzp7rCqApFBUgEIXWTcfxfbOE2mUPSF3Euv LAjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=IeSKqjle; 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 m9-20020a654389000000b005b884a11fdcsi5029826pgp.28.2023.10.23.04.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 04:46:12 -0700 (PDT) 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=IeSKqjle; 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 499A680A28C2; Mon, 23 Oct 2023 04:46:10 -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 S234622AbjJWLpy (ORCPT + 27 others); Mon, 23 Oct 2023 07:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234451AbjJWLpb (ORCPT ); Mon, 23 Oct 2023 07:45:31 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4127F1705; Mon, 23 Oct 2023 04:45:26 -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 39MLgvgB028356; Mon, 23 Oct 2023 04:45:07 -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=UH9OxHXbOjRhxSx5V7Clo000R+zwqhWrGr3Zie/QOlk=; b=IeSKqjleSZ24eHARBpDON5VP4jPWkfz1nV/B8MxS/ZwUUXzl67bPyTFk9RjCKBN9Bj3L iqpF10YXvBzFpSUkTsuWViT5JeQ8ZRN1oeGIJ3y/Ejc8+mqUgmJPMLOOU/hnYrBfgrFk WVSUTT8L3+WDQjFjcb05XO4ohWwSBC2g8hQ88VEKwVRT1HEwwEl7AtG7g0R4k0ggiyFR eaA7IiFjhesuGo6S/BsbN9SgJfVZYr7Ouh+S/LQsDiOrEZsm+Ozb85QKLhMRmmxzDm4l IRcw77pJeYWuBLkcMwy4s3KDjRbXxkxQmrVDqcuP/LYSXgEdsVNI54e7iobGKQq6JEA2 ug== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3tve5mwjmx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 23 Oct 2023 04:45:07 -0700 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; Mon, 23 Oct 2023 04:45:05 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Mon, 23 Oct 2023 04:45:05 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 6F3A43F7051; Mon, 23 Oct 2023 04:45:05 -0700 (PDT) From: Shinas Rasheed To: , CC: , , , , , , , , Shinas Rasheed , Veerasenareddy Burru , "Sathesh Edara" , Eric Dumazet Subject: [PATCH net-next 1/3] octeon_ep: remove dma sync in trasmit path Date: Mon, 23 Oct 2023 04:44:46 -0700 Message-ID: <20231023114449.2362147-2-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231023114449.2362147-1-srasheed@marvell.com> References: <20231023114449.2362147-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: DdNf9PQmRGDudRphlSMWOwySR6GRBYSI X-Proofpoint-GUID: DdNf9PQmRGDudRphlSMWOwySR6GRBYSI 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-23_09,2023-10-19_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]); Mon, 23 Oct 2023 04:46:10 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780546611182591656 X-GMAIL-MSGID: 1780546611182591656 Cleanup dma sync calls for scatter gather mappings in trasmit path Signed-off-by: Shinas Rasheed --- 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 552970c7dec0..bf1e376a4232 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -869,9 +869,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; @@ -891,10 +888,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 Mon Oct 23 11:44:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 156847 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1235259vqx; Mon, 23 Oct 2023 04:46:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFzZjCZQ8566vk4tbVmzeZ5vN8GefqTidpvRFGPvFG9nTZ9LSlrcFa/RPTUje36NGXx4hx0 X-Received: by 2002:a17:90b:2d8a:b0:27c:ef4b:6dcf with SMTP id sj10-20020a17090b2d8a00b0027cef4b6dcfmr6821289pjb.21.1698061592008; Mon, 23 Oct 2023 04:46:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698061591; cv=none; d=google.com; s=arc-20160816; b=RSHZFxeBcpgfcWLZ0J5OQAsw7pkAzjT9TH/euu5x1Yp6nwFaadYIZhA/UvRvCNocK4 qp5G0mm3yDUL2iE6saUJXbyH88KjzezNJjaCfIjU4w2PapMIEsdjfQJgHI0YLw0y1d9S ewWOq7fgklEnTqmt24kI0LH8FY6szkJr4+o1zfjeg9flu+lFqFAtzGNMgLxnMd+6d2+J bGdLlzsxgEGAdm12QJgQSMrV0wOu8Oaicmk3trBuppUKijmbmyKn0RbVzp0VNC14nfCy 1YlwI44kluVSGPuJRV3rCfJmJZSk7wFUck1ZWQhAvGlWzU2Vw8h/pqoOI7OFrqvncgQK nZsg== 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=R2i59IltX6G13d4qYq4yJKDDqV82Pei87fS6LmLOrQs=; fh=ExM9ANAxmdP53lLzdQyGkcWMXv2I2jExERbtPlLSxEw=; b=Fwctp++GsLzsUbCleElvyzUVYOHEJRlZ8bCg+yInGIvQ/UEavhnbOSXovl95fsrB1r K6crtKtJBR5WqVWzZ4n2IKwqI9OI42GaPeW1nO2s5GMzp83olgIVm7q7MTcfUODwFQxv y2nFuzVbezHEkoFI9LGEsW1uLBCEHd7bm+240rxY22qhkRYEKM1JeWQEv4yr2jwW/RdW nGTU3L/BtzOZE7FDdfJhKWNXUq+1quc8sjAj0IQleaZpaciyip+kyXQKEKs1r/6wA64g WjBW+dW4fDWmz86ZGKdvPKrb6rkyzGNClAnqKwBmBD53FVilKEnOk/gum3sBI0EmEDOE MFUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=M0JTptV0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id lx12-20020a17090b4b0c00b0027dbf69ec11si6730710pjb.160.2023.10.23.04.46.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 04:46:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=M0JTptV0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 15C1D80622A9; Mon, 23 Oct 2023 04:46:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234579AbjJWLpe (ORCPT + 27 others); Mon, 23 Oct 2023 07:45:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234519AbjJWLpR (ORCPT ); Mon, 23 Oct 2023 07:45:17 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6F3610C; Mon, 23 Oct 2023 04:45:14 -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 39MMm3GN014345; Mon, 23 Oct 2023 04:45:09 -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=R2i59IltX6G13d4qYq4yJKDDqV82Pei87fS6LmLOrQs=; b=M0JTptV0VgF0rTtqYxiWPCUZTBNpTGCb1P8Tjj/30YiyYS+jIh4i2D8D9g9lJTvAJd7O g4pEE0IiCNTTs9qviVKvm7vdD4XkIsEbgTo2Bv82l0X8wN4Ir4m1lFRF5t6M9Ii8chYh rP8A3sz2MikQDuxluHR8BDSrLxovruNI8EYNkhGSHMxF/+paVzqZyj/VVSEoKcZdHiL/ OooFXCiJcrsFawMRZYVYDXSCgVan7O90PQCp+lSamrhUarfI5rGJDpjz6HRwE1of3hgT hKF0oE+8wopMGgMvD8KJwNbbUiSsF+KauhkB1PbH20Q6uL2kd0iyuGQeTKvO1VvOdY8W 2g== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tvc0qp119-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 23 Oct 2023 04:45:08 -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; Mon, 23 Oct 2023 04:45:07 -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; Mon, 23 Oct 2023 04:45:07 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 516BF3F70C4; Mon, 23 Oct 2023 04:45:07 -0700 (PDT) From: Shinas Rasheed To: , CC: , , , , , , , , Shinas Rasheed , Veerasenareddy Burru , "Sathesh Edara" , Eric Dumazet Subject: [PATCH net-next 2/3] octeon_ep: implement xmit_more in transmit Date: Mon, 23 Oct 2023 04:44:47 -0700 Message-ID: <20231023114449.2362147-3-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231023114449.2362147-1-srasheed@marvell.com> References: <20231023114449.2362147-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: v4wqu8SxedGL9TnnMBbQinpOVavg1BEf X-Proofpoint-GUID: v4wqu8SxedGL9TnnMBbQinpOVavg1BEf 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-23_10,2023-10-19_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 howler.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 (howler.vger.email [0.0.0.0]); Mon, 23 Oct 2023 04:46:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780546631711953359 X-GMAIL-MSGID: 1780546631711953359 Adds xmit_more handling in tx datapath for octeon_ep pf. Signed-off-by: Shinas Rasheed Reviewed-by: Wojciech Drewek --- .../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 bf1e376a4232..730443ba2f5b 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; q_no = skb_get_queue_mapping(skb); @@ -892,18 +893,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 Mon Oct 23 11:44:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 156848 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1235304vqx; Mon, 23 Oct 2023 04:46:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESAo67abRVx+SadRQDMCHeugFhCAhhO1IaW1Au73bwhUD833m8AdMGXc0Kay+8HWUDXka3 X-Received: by 2002:a17:902:ca83:b0:1c8:a06e:fce9 with SMTP id v3-20020a170902ca8300b001c8a06efce9mr4520513pld.52.1698061595684; Mon, 23 Oct 2023 04:46:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698061595; cv=none; d=google.com; s=arc-20160816; b=QkJWNI1PSw22ULr98ityE6LLaLDWUMmNzv8oJKpKxiK0EtBOFTXAt3GT2oI3bQ+hVx tRCrsJbsd9StHpQdRer8BrF/7KVSIKJM2joMS+ZG/6oecLv2EIyR4OQOlZu2yPyo/0jU jbiH0FUagoEXJhGso60TR95FJSQyxvgpmtI0RHw3Uwm0gNWACpmW/vGR4zLN0hRK7pKO mjb+4WriB8mBxa1IJ69pF+TUuExpDpmTH9VXxH23GC+t3+AMi0/VVhGkum9D2vwuD3Bx diPDMHjiTcoXV+VOOZaFi9PoLQ7k2PGa87Tbd1XprVxiW0ghwM8eM2jzRR6pRKwtRr4g ijfA== 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=loQIiydTkdc8jp4yYaQACpRwZcT5vkJLwSIJdUcrjkQ=; fh=ExM9ANAxmdP53lLzdQyGkcWMXv2I2jExERbtPlLSxEw=; b=i16HTfRVuRFHDvqTcMBMAFRVZUVN7lDqk6eZeQTJZDBE+i6VNbDju/cynYzGDDPLDx V3Cp/rBurYP9SmOqOFIiqq2wPJT0rBglZmaWo5KJoAj/L4yDT+U9CUNTd4G3p2+CQ+su 3GaqSiKYCGdvuxrAvy7dJBGjjkcJfoczvC5Q3Lnkwbsh1Nqv62AXYMYt6iYLsB86+w9R oWf6uXg0zY2ybJCve+owLdlJ9yWGOn6mgqJLHFT/SfAzAHOWgcZofvf75rZP/LDY+YL5 U0WQKtA4X7BJYPW4p648UYmDV8rDHNigUIHyP/OWVD9G8TWzfU+nXAaxXm2HGUCkoARv SA0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=jhEo4Mmv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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. [23.128.96.36]) by mx.google.com with ESMTPS id k5-20020a170902c40500b001c9b5a90a92si6398081plk.344.2023.10.23.04.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 04:46:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=jhEo4Mmv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 C45E58086935; Mon, 23 Oct 2023 04:46:27 -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 S234414AbjJWLpu (ORCPT + 27 others); Mon, 23 Oct 2023 07:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234498AbjJWLp1 (ORCPT ); Mon, 23 Oct 2023 07:45:27 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52F23170D; Mon, 23 Oct 2023 04:45:22 -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 39MN00Pe002349; Mon, 23 Oct 2023 04:45:11 -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=loQIiydTkdc8jp4yYaQACpRwZcT5vkJLwSIJdUcrjkQ=; b=jhEo4MmvTiywViOf0Grv3kKPp24L4TuaQHe+VxkMr+PVnevN4ryxr+3Gr5aCGFs3cy/9 51uvrheWepNG7Ko2jQDmgjfdEkMgXpQoTf6Kyrybq/Nuc49GiZIcju9A44p5HvEZAxMt Ffyosqw8pErICuhDB6qNb8E7AtGEs/yblRDr83x/rN3S216l6/hd9yUJQzSUBUcFLVzP 6KL9Sl7mXyQShaGiRvTJEmDR0jXdW7jlJe+nKqePQzR7Eq0Uo1kmfG0yQiDAEhwKzTeV mouY/QLVwA3RlE8P0ppAqHPZYvY56nR6K46HvHglUO3kGW3Klxp0no0iLW3NAKGWlMMa 4Q== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tvc0qp11b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 23 Oct 2023 04:45:11 -0700 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; Mon, 23 Oct 2023 04:45:09 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Mon, 23 Oct 2023 04:45:09 -0700 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 662523F70BE; Mon, 23 Oct 2023 04:45:09 -0700 (PDT) From: Shinas Rasheed To: , CC: , , , , , , , , Shinas Rasheed , Veerasenareddy Burru , "Sathesh Edara" , Eric Dumazet Subject: [PATCH net-next 3/3] octeon_ep: remove atomic variable usage in Tx data path Date: Mon, 23 Oct 2023 04:44:48 -0700 Message-ID: <20231023114449.2362147-4-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231023114449.2362147-1-srasheed@marvell.com> References: <20231023114449.2362147-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: M0Cs4mk1VzQkZHSPOTPWdRxhXnaJ5QJ7 X-Proofpoint-GUID: M0Cs4mk1VzQkZHSPOTPWdRxhXnaJ5QJ7 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-23_10,2023-10-19_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 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]); Mon, 23 Oct 2023 04:46:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780546636242631536 X-GMAIL-MSGID: 1780546636242631536 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 --- 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 730443ba2f5b..d7498a864385 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++; @@ -897,14 +897,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;