From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 78EDEA0613 for ; Thu, 26 Sep 2019 12:36:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 898E11B203; Thu, 26 Sep 2019 12:36:31 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20056.outbound.protection.outlook.com [40.107.2.56]) by dpdk.org (Postfix) with ESMTP id 6B7B83977 for ; Thu, 26 Sep 2019 12:36:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ORZFBvcob0wWnqQgaEn8DpGxnBVhdvwz6RgB6T9j1pQ=; b=CF7w/j+AYbwLBRc0vd0yBO9lxYpuAnrOvD/Va/60t773WpqhwEtGbJgssUL4IKYK2/foeHMLxPfeGuGjO/FYW3oiCF69G8vhaY06ymWA7+VhFQP+nH+LS8uUd+b/xnJDMZv09pk5hRepyZl9FDKrADW3JW+0SlIe45nWQb0JSZI= Received: from AM6PR08CA0010.eurprd08.prod.outlook.com (2603:10a6:20b:b2::22) by DB7PR08MB3580.eurprd08.prod.outlook.com (2603:10a6:10:49::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.23; Thu, 26 Sep 2019 10:36:26 +0000 Received: from VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::209) by AM6PR08CA0010.outlook.office365.com (2603:10a6:20b:b2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.17 via Frontend Transport; Thu, 26 Sep 2019 10:36:26 +0000 Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=none action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT035.mail.protection.outlook.com (10.152.18.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Thu, 26 Sep 2019 10:36:25 +0000 Received: ("Tessian outbound 927f2cdd66cc:v33"); Thu, 26 Sep 2019 10:36:25 +0000 X-CR-MTA-TID: 64aa7808 Received: from 2a840ba3214f.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.9.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2520A864-93DB-4828-95A6-8CD9E4C5A130.1; Thu, 26 Sep 2019 10:36:20 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03lp2053.outbound.protection.outlook.com [104.47.9.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2a840ba3214f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Thu, 26 Sep 2019 10:36:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VoRTQMo4cEqELLDwzWVumMreUzLBqAU0zgODBCyTAiymaw8NKoo/eUSs6A3K8sSlVfysSlubrwrIBK5hG5ZPKDh+JYsADQXlFPF3w6Z4B2NqBe4zVHUe+j/xQp7Djcza33qGojCjmK4w71opMdImwCV0AHs2kQsoEHm4U/26zFI6XCy+2fCoIJUvARoEVyn9zVkjZAlZpf2T3ii1J0XFjVk0QpSU8FiYellgQfACT3qurkSUN4t/GmNIfRL+OBX1ENU1KgiJxW4FuqeVa07OVRgbf6qh2Ocqa/4z6WkINW1IosnIWwOq9feVjWU/Ry3XUGWEHb7SHrWBnCsaSJyDjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ORZFBvcob0wWnqQgaEn8DpGxnBVhdvwz6RgB6T9j1pQ=; b=fBJTNQ639c0ss2baXVyYDuTCGFnI2H+4SVtp0Wmev/+3T3haekqpaPzPno+sp5O+Z8qHyLOd1c/cbicqFgCYLfhJ30mtPNI3puWv/zJLHRrSCa40JWvCVOAYGQQRuB0WBKtGVEGhin0cFP7AzoR5QbytE1dqmwgkytFLd0VaLGw3JiqcHnQEPc3zDc3fYsunrvBhuE75zwgEyxh8+JiSWFGGwPXAQeOVQwcUcG4Zqo1qHVwrjM052EqqYfUUCJ4Xf7Xvajj939mmaS8fkB4PJmuKTqN1L0lCZVh1Z3H6NMODHJ4vsN+TBt85HBUYTO6AR2uOuNcaaaPjqmPyc+4fhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ORZFBvcob0wWnqQgaEn8DpGxnBVhdvwz6RgB6T9j1pQ=; b=CF7w/j+AYbwLBRc0vd0yBO9lxYpuAnrOvD/Va/60t773WpqhwEtGbJgssUL4IKYK2/foeHMLxPfeGuGjO/FYW3oiCF69G8vhaY06ymWA7+VhFQP+nH+LS8uUd+b/xnJDMZv09pk5hRepyZl9FDKrADW3JW+0SlIe45nWQb0JSZI= Received: from VI1PR08MB5376.eurprd08.prod.outlook.com (52.133.244.200) by VI1PR08MB4221.eurprd08.prod.outlook.com (20.178.13.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.15; Thu, 26 Sep 2019 10:36:17 +0000 Received: from VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::c09a:49d3:eab2:f707]) by VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::c09a:49d3:eab2:f707%3]) with mapi id 15.20.2284.023; Thu, 26 Sep 2019 10:36:17 +0000 From: "Gavin Hu (Arm Technology China)" To: Di ChenxuX , "dev@dpdk.org" CC: "qiming.yang@intel.com" , nd Thread-Topic: [dpdk-dev] [PATCH 2/4] net/i40e: cleanup Tx buffers Thread-Index: AQHVdFL5eeJuedqvPEiE5JeS5iPloac9wzIA Date: Thu, 26 Sep 2019 10:36:17 +0000 Message-ID: References: <20190926092933.79683-1-chenxux.di@intel.com> <20190926092933.79683-3-chenxux.di@intel.com> In-Reply-To: <20190926092933.79683-3-chenxux.di@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 1a09598d-f562-4b52-b9a8-dd88c803025c.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: f989a6d0-af08-4f58-f0cd-08d7426d619c X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: VI1PR08MB4221:|DB7PR08MB3580: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:4941;OLM:4941; x-forefront-prvs: 0172F0EF77 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(136003)(346002)(39860400002)(366004)(376002)(199004)(189003)(13464003)(6506007)(53546011)(66066001)(55016002)(305945005)(9686003)(8936002)(4326008)(486006)(99286004)(33656002)(316002)(14454004)(102836004)(2501003)(86362001)(229853002)(74316002)(7736002)(81156014)(81166006)(55236004)(71200400001)(186003)(478600001)(71190400001)(5660300002)(54906003)(2906002)(446003)(52536014)(256004)(110136005)(6246003)(26005)(8676002)(6436002)(76176011)(7696005)(25786009)(64756008)(66946007)(11346002)(66476007)(66446008)(66556008)(76116006)(6116002)(3846002)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB4221; H:VI1PR08MB5376.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: x78k7B+Jc4U6HkgXMItoOyWmRcxXD7mX8l5rxveswjudRx+EufrEpZhVd8NVLZbZ0CIPkDbzEfyV9OrdzZUmSiRwrlmblgHBMA9AGvhs3VBVS3HMd6WXWSFb4M2axnEOTswflMEdkDZmwEKqor7lRzAghBhRaySUxcdlvgQYqll6yEZRCjTiEshVM1XoeKhPKyv0Jwdfcq6XkqEZWJ+NNPKToCaFBMokw/A7F8/IzEnjalvCUT0hHToT80eHZ4NIqgYXFFn1ngNPZdV4TpERFNN1aH2Xq0h6foUG+DRCpSRZPahRxVvEcLVWds55g0sXMW7CLipqW2M41Gzf5un2n1v0KddJ9sob6O6Tw5Ln1/8tnH8ri7i+bj5KBFd41XmId/6sMOTMtYSgD096DOGv7KZ79/OEW0qHgqiAJTb6r0U= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4221 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(346002)(136003)(39860400002)(396003)(376002)(13464003)(199004)(189003)(52536014)(8936002)(8746002)(126002)(70206006)(70586007)(2501003)(33656002)(76130400001)(97756001)(4326008)(99286004)(8676002)(66066001)(74316002)(478600001)(47776003)(25786009)(81166006)(86362001)(5660300002)(50466002)(2906002)(305945005)(7736002)(356004)(14454004)(23726003)(6116002)(3846002)(46406003)(11346002)(6246003)(9686003)(63350400001)(446003)(7696005)(26826003)(54906003)(76176011)(81156014)(110136005)(53546011)(229853002)(6506007)(55016002)(336012)(486006)(102836004)(26005)(36906005)(186003)(476003)(22756006)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB3580; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; A:1; MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 48515c3e-8d0c-4641-5b33-08d7426d5d21 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(710020)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:DB7PR08MB3580; NoDisclaimer: True X-Forefront-PRVS: 0172F0EF77 X-Microsoft-Antispam-Message-Info: LpLOZ0QZnakjq4T9x9wpEtf/EkUPZvJpQk2kNFjyq63hdnfXdPzGJNHnSMhJB/EwX6JOTjNyBG8sbh5FRFovVwmBHiNyj8vd93446kahMDphBlSEREfZIOv4jMJ959SSnvzbvNNyucW0OdgbyA+EDQpuvJdt4q1udOsqGIkIehtm+W4GIf9B2rO+jfv8lm1FX9VJONHMDCbQwZhOSnuy+huA9dhiyighVhd6iIE5o9fRKKdhXsbfzYFUYD9Ag2B+2qKPdJR6ybhl3StJa2S1qsEWWbUTWWlfsmzKZgnh9CttYc0nbkITLkGlKYF1bXu3jEbsR0bPNM7ahVZjLyoXScvBaUZq7iC3fJvilaKCqgMCXPKYRMFGk7JULULR2AtpShVAAUbCbh6XyzpLY40vy4B79g5Y1AZA953oEBOIiII= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2019 10:36:25.1757 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f989a6d0-af08-4f58-f0cd-08d7426d619c X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3580 Subject: Re: [dpdk-dev] [PATCH 2/4] net/i40e: cleanup Tx buffers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: dev On Behalf Of Di ChenxuX > Sent: Thursday, September 26, 2019 5:30 PM > To: dev@dpdk.org > Cc: qiming.yang@intel.com; Di ChenxuX > Subject: [dpdk-dev] [PATCH 2/4] net/i40e: cleanup Tx buffers >=20 > Add support to the i40e driver for the API rte_eth_tx_done_cleanup > to force free consumed buffers on Tx ring. >=20 > Signed-off-by: Di ChenxuX > --- > drivers/net/i40e/i40e_ethdev.c | 1 + > drivers/net/i40e/i40e_ethdev_vf.c | 1 + > drivers/net/i40e/i40e_rxtx.c | 42 +++++++++++++++++++++++++++++++ > drivers/net/i40e/i40e_rxtx.h | 1 + > 4 files changed, 45 insertions(+) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethde= v.c > index 4e40b7ab5..cf35fb5da 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -509,6 +509,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops =3D > { > .mac_addr_set =3D i40e_set_default_mac_addr, > .mtu_set =3D i40e_dev_mtu_set, > .tm_ops_get =3D i40e_tm_ops_get, > + .tx_done_cleanup =3D i40e_tx_done_cleanup, > }; >=20 > /* store statistics names and its offset in stats structure */ > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c > b/drivers/net/i40e/i40e_ethdev_vf.c > index c77b30c54..b462a9d8c 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -215,6 +215,7 @@ static const struct eth_dev_ops > i40evf_eth_dev_ops =3D { > .rss_hash_conf_get =3D i40evf_dev_rss_hash_conf_get, > .mtu_set =3D i40evf_dev_mtu_set, > .mac_addr_set =3D i40evf_set_default_mac_addr, > + .tx_done_cleanup =3D i40e_tx_done_cleanup, > }; >=20 > /* > diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c > index 692c3bab4..29793a1b7 100644 > --- a/drivers/net/i40e/i40e_rxtx.c > +++ b/drivers/net/i40e/i40e_rxtx.c > @@ -1416,6 +1416,8 @@ i40e_xmit_pkts_vec(void *tx_queue, struct > rte_mbuf **tx_pkts, > break; > } >=20 > + //eth_i40e_tx_done_cleanup(tx_queue,5); > + > return nb_tx; > } >=20 > @@ -2467,6 +2469,46 @@ i40e_tx_queue_release_mbufs(struct > i40e_tx_queue *txq) > } > } >=20 > +int i40e_tx_done_cleanup(void *txq, uint32_t free_cnt) > +{ > + struct i40e_tx_queue *q =3D (struct i40e_tx_queue *)txq; > + struct i40e_tx_entry *sw_ring; > + uint16_t tx_id; /* Current segment being processed. */ > + uint16_t tx_cleaned; > + > + int count =3D 0; uint32_t is better, then you will not get trouble into a negative value. > + > + if (q =3D=3D NULL) > + return -ENODEV; > + > + sw_ring =3D q->sw_ring; > + tx_cleaned =3D q->last_desc_cleaned; > + tx_id =3D sw_ring[q->last_desc_cleaned].next_id; > + if ((q->tx_ring[tx_id].cmd_type_offset_bsz & > + > rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=3D > + > rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)) > + return 0; > + > + do { > + if (sw_ring[tx_id].mbuf =3D=3D NULL) > + break; > + > + rte_pktmbuf_free_seg(sw_ring[tx_id].mbuf); > + sw_ring[tx_id].mbuf =3D NULL; > + sw_ring[tx_id].last_id =3D tx_id; > + > + /* Move to next segemnt. */ > + tx_cleaned =3D tx_id; > + tx_id =3D sw_ring[tx_id].next_id; > + count++; > + } while (count !=3D (int)free_cnt); This force conversation is not needed if "count" declared as uint32_t above= . /Gavin > + > + q->nb_tx_free +=3D (uint16_t)count; > + q->last_desc_cleaned =3D tx_cleaned; > + > + return count; > +} > + > void > i40e_reset_tx_queue(struct i40e_tx_queue *txq) > { > diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h > index 3fc619af9..1a70eda2c 100644 > --- a/drivers/net/i40e/i40e_rxtx.h > +++ b/drivers/net/i40e/i40e_rxtx.h > @@ -204,6 +204,7 @@ void i40e_dev_free_queues(struct rte_eth_dev > *dev); > void i40e_reset_rx_queue(struct i40e_rx_queue *rxq); > void i40e_reset_tx_queue(struct i40e_tx_queue *txq); > void i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq); > +int i40e_tx_done_cleanup(void *txq, uint32_t free_cnt); > int i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq); > void i40e_rx_queue_release_mbufs(struct i40e_rx_queue *rxq); >=20 > -- > 2.17.1