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 3FC87A0613 for ; Thu, 26 Sep 2019 12:38:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0FF581BEBE; Thu, 26 Sep 2019 12:38:09 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140077.outbound.protection.outlook.com [40.107.14.77]) by dpdk.org (Postfix) with ESMTP id 3A87D1BEB5 for ; Thu, 26 Sep 2019 12:38:08 +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=kdVqItRvreS5HvyIhY0Dxqni0ijsYPSeQRrj12LUMrg=; b=RHI4Zfe2jKXiEAUSrttpLClTaYvEmYzz5hVhTaBlwzExroBllgzbmii0wi456bLAkpeO2hR8oImXKmq06UE7vjpPsKzc000c+E9XciTZ12pQNOHmw/7SSvJpGGnT1YLHV7x3mzsLrGKbjXdrRZ3d5Wbx9IlH9xL+YUfA9B3BnCY= Received: from AM4PR08CA0047.eurprd08.prod.outlook.com (2603:10a6:205:2::18) by DB7PR08MB3467.eurprd08.prod.outlook.com (2603:10a6:10:48::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.26; Thu, 26 Sep 2019 10:38:06 +0000 Received: from DB5EUR03FT062.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::204) by AM4PR08CA0047.outlook.office365.com (2603:10a6:205:2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.15 via Frontend Transport; Thu, 26 Sep 2019 10:38:06 +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 DB5EUR03FT062.mail.protection.outlook.com (10.152.20.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.15 via Frontend Transport; Thu, 26 Sep 2019 10:38:05 +0000 Received: ("Tessian outbound 851a1162fca7:v33"); Thu, 26 Sep 2019 10:38:05 +0000 X-CR-MTA-TID: 64aa7808 Received: from cb90fc73a15a.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.9.52]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 961C8ABD-A211-44EB-AEA7-FADB352BA41F.1; Thu, 26 Sep 2019 10:38:00 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03lp2052.outbound.protection.outlook.com [104.47.9.52]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cb90fc73a15a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Thu, 26 Sep 2019 10:38:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dLHhfg4LXC1oRwmGH2zsu+649UzBDgYv9A9lC4AE+vKjb9utfJ7CBdOUvhRT6QVcm73R78CpO7022gm2AX7iTz6vZOOwTKuoNYPWNcPO3LFRAvLsbOMEwjh3hjXPmIZQItb0Vl3zu+o/pDU+AzWxMzq35LtBaAtJkqXcRasYLm6RcIrNTbVYBsEZXQjlP0olncr8+KwSVPIjn4dEPgCjgzjKL/2CzsYj1HmK8P//iZmFqcXPmYbhGL7j40QjZjxr1tgubPO2BLIDRbUzBgOMoqNcI1e5Cz1OVcj05bi7Ta7toVoxoqb4HheMExKK1JNmsuubqYNb9uzyOvoOUIpuJw== 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=kdVqItRvreS5HvyIhY0Dxqni0ijsYPSeQRrj12LUMrg=; b=SA9jsE+fWWFMCNOMzEkDH4cKUoCP1Vxvc3zeGFP4DpMZ1MO/DJImVBcLUSuUU5wXlwOqZQlQwmLSKBYUmr/6/jQwntv1gTEtyXAJUYbrNxVD+zdNPfQdLcCuLtgMU/A9q/tQh4GFS+2sF1p9l6j4RYXRDPRpWTw+VS4I8/UbtETnEJMGZHmhXDBgdGHjnfWxSvp+Zql2vtSLdyUB5C+1CgU6aIEEnONM8rOJJdIA/TwumY3BU0lakfLXaQmPFq/PkjVDc0YCwKzlKK9dbzti4/rSpXuNXyHu7z/v47PQi4Uk16Q5YfC7JdlRiYyVl8NThtVO6Vp49Q3/p5WjBptysA== 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=kdVqItRvreS5HvyIhY0Dxqni0ijsYPSeQRrj12LUMrg=; b=RHI4Zfe2jKXiEAUSrttpLClTaYvEmYzz5hVhTaBlwzExroBllgzbmii0wi456bLAkpeO2hR8oImXKmq06UE7vjpPsKzc000c+E9XciTZ12pQNOHmw/7SSvJpGGnT1YLHV7x3mzsLrGKbjXdrRZ3d5Wbx9IlH9xL+YUfA9B3BnCY= Received: from VI1PR08MB5376.eurprd08.prod.outlook.com (52.133.244.200) by VI1PR08MB3021.eurprd08.prod.outlook.com (52.133.14.138) 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:37:58 +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:37:58 +0000 From: "Gavin Hu (Arm Technology China)" To: Di ChenxuX , "dev@dpdk.org" CC: "qiming.yang@intel.com" , nd Thread-Topic: [dpdk-dev] [PATCH 1/4] net/fm10k: cleanup Tx buffers Thread-Index: AQHVdFLzsrrTXatlnUqiaNEbJ5T2Sac9xBdw Date: Thu, 26 Sep 2019 10:37:58 +0000 Message-ID: References: <20190926092933.79683-1-chenxux.di@intel.com> <20190926092933.79683-2-chenxux.di@intel.com> In-Reply-To: <20190926092933.79683-2-chenxux.di@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: ad5ae1bd-9bfe-42dc-ac81-f46611e27b42.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: 3a3ca726-33d5-47da-b8a6-08d7426d9d57 X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: VI1PR08MB3021:|DB7PR08MB3467: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:8882;OLM:8882; x-forefront-prvs: 0172F0EF77 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(396003)(346002)(366004)(136003)(13464003)(199004)(189003)(25786009)(86362001)(6436002)(9686003)(8936002)(81156014)(14454004)(81166006)(8676002)(76116006)(2501003)(33656002)(52536014)(14444005)(6246003)(256004)(6116002)(71200400001)(4326008)(71190400001)(66066001)(55016002)(2906002)(3846002)(229853002)(26005)(53546011)(5660300002)(478600001)(6506007)(55236004)(186003)(102836004)(7696005)(66946007)(66446008)(64756008)(66556008)(66476007)(110136005)(54906003)(316002)(74316002)(486006)(446003)(476003)(99286004)(11346002)(305945005)(7736002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3021; 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: jlOeQy4bkUqFf5T4eEudep5MFvPeboE8b9H+hKHtRiNbZXNMYD9XP08RbL/R4Q2lOdzngF7kG+aKdCpp1PPFtjBiouf6pKJxFAganEQ1ShplQtxwRJ3Awg1sF2nyn+fvi/3Jx6YUCmiTF0ZOg4VBaVbLHxn+wTgIvoy/XGUY5gy0gW9f/9kI8yQtIzNoPflaewpPsfAtl8yRCtliBkHm7LhlVio85xZGHK12fbon0xc0Zy+J46gucqQJpMlVzsQDJP+Pn9Sr8k3o4xS8DBV1LA6SfFP+xPNmwIwdWyB76MaXGbDSys8wcHoA0hmL/CSw01FVXECXRuUqJ90yZCyhcnv5Q4jr/ZbG1VN5xManeaIMiF8Ev+lIfc6o5h7i2e9Ng2lgfQQqOccQ2CJrSkW7YXi7msiS6xP/qzBN8UdJvf4= 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: VI1PR08MB3021 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT062.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)(396003)(346002)(136003)(376002)(39860400002)(13464003)(199004)(189003)(70206006)(14454004)(2906002)(63350400001)(52536014)(22756006)(70586007)(8676002)(2501003)(186003)(47776003)(478600001)(26826003)(336012)(102836004)(8746002)(7736002)(46406003)(74316002)(8936002)(97756001)(66066001)(6246003)(81166006)(81156014)(26005)(76130400001)(4326008)(25786009)(486006)(126002)(55016002)(229853002)(50466002)(305945005)(54906003)(9686003)(14444005)(23726003)(3846002)(6116002)(356004)(76176011)(316002)(7696005)(110136005)(6506007)(11346002)(86362001)(53546011)(476003)(446003)(33656002)(5660300002)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB3467; 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: 5c69c2e9-8cf7-49c4-e185-08d7426d9963 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600167)(710020)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DB7PR08MB3467; NoDisclaimer: True X-Forefront-PRVS: 0172F0EF77 X-Microsoft-Antispam-Message-Info: 5JcEYsfbKm5UJ3plISnLND/v0E6ZFTDV8P7qjUQx9JSH/FIGvn5zKAESWsR/BmpIhrPHE3cs+8OOcTdRxUYC8LwCyGlBePWyMK4VORa5EkcqVeQjBANh87W0WpZND5YKARUPzF4BtnxOI1wsqTtSf2XIkNYxUej9tWjWuGZlC24Ze9Vus+iclwQaw18xFVdjJECOyXbJSBSCpOP/D5U5fA2CzcxOn65gCzyFXqhCA0q4eLL6SlzxgsRmkOsXvW9CGNMTZYK/EZGWrbK3VeOPMKy4sRrq7nlL/ViRRcy5EFuJm/WeXe+x72OFijtXfO+5eL/6wXG6ehcDK8X4Zpwy3owz+BCXuq1deZGCpgAkJGBnO+6B+d8TgtdaBUjsMCX1cUWk6Iw6Ox7ablDdSiChAHKPEpSseLSft7oao7SUs/Y= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2019 10:38:05.4364 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a3ca726-33d5-47da-b8a6-08d7426d9d57 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: DB7PR08MB3467 Subject: Re: [dpdk-dev] [PATCH 1/4] net/fm10k: 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 1/4] net/fm10k: cleanup Tx buffers >=20 > Add support to the fm10k 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/fm10k/fm10k.h | 2 ++ > drivers/net/fm10k/fm10k_ethdev.c | 1 + > drivers/net/fm10k/fm10k_rxtx.c | 45 > ++++++++++++++++++++++++++++++++ > 3 files changed, 48 insertions(+) >=20 > diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h > index 916b856ac..ddb1d64ec 100644 > --- a/drivers/net/fm10k/fm10k.h > +++ b/drivers/net/fm10k/fm10k.h > @@ -342,6 +342,8 @@ uint16_t fm10k_xmit_pkts(void *tx_queue, struct > rte_mbuf **tx_pkts, > uint16_t fm10k_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, > uint16_t nb_pkts); >=20 > +int fm10k_tx_done_cleanup(void *txq, uint32_t free_cnt); > + > int fm10k_rxq_vec_setup(struct fm10k_rx_queue *rxq); > int fm10k_rx_vec_condition_check(struct rte_eth_dev *); > void fm10k_rx_queue_release_mbufs_vec(struct fm10k_rx_queue *rxq); > diff --git a/drivers/net/fm10k/fm10k_ethdev.c > b/drivers/net/fm10k/fm10k_ethdev.c > index db4d72129..328468185 100644 > --- a/drivers/net/fm10k/fm10k_ethdev.c > +++ b/drivers/net/fm10k/fm10k_ethdev.c > @@ -2838,6 +2838,7 @@ static const struct eth_dev_ops > fm10k_eth_dev_ops =3D { > .reta_query =3D fm10k_reta_query, > .rss_hash_update =3D fm10k_rss_hash_update, > .rss_hash_conf_get =3D fm10k_rss_hash_conf_get, > + .tx_done_cleanup =3D fm10k_tx_done_cleanup, > }; >=20 > static int ftag_check_handler(__rte_unused const char *key, > diff --git a/drivers/net/fm10k/fm10k_rxtx.c > b/drivers/net/fm10k/fm10k_rxtx.c > index 5c3112183..f67c5bf00 100644 > --- a/drivers/net/fm10k/fm10k_rxtx.c > +++ b/drivers/net/fm10k/fm10k_rxtx.c > @@ -541,6 +541,51 @@ static inline void tx_free_bulk_mbuf(struct > rte_mbuf **txep, int num) > } > } >=20 > +int fm10k_tx_done_cleanup(void *txq, uint32_t free_cnt) > +{ > + struct fm10k_tx_queue *q =3D (struct fm10k_tx_queue *)txq; > + uint16_t next_rs, count =3D 0; "count" should be declared as uint32_t to compare against free_cnt. /Gavin > + > + if (q =3D=3D NULL) > + return -ENODEV; > + > + next_rs =3D fifo_peek(&q->rs_tracker); > + if (!(q->hw_ring[next_rs].flags & FM10K_TXD_FLAG_DONE)) > + return count; > + > + /* the DONE flag is set on this descriptor so remove the ID > + * from the RS bit tracker and free the buffers > + */ > + fifo_remove(&q->rs_tracker); > + > + /* wrap around? if so, free buffers from last_free up to but NOT > + * including nb_desc > + */ > + if (q->last_free > next_rs) { > + count =3D q->nb_desc - q->last_free; > + tx_free_bulk_mbuf(&q->sw_ring[q->last_free], count); > + q->last_free =3D 0; > + > + if (unlikely(count =3D=3D (int)free_cnt)) > + return count; > + } > + > + /* adjust free descriptor count before the next loop */ > + q->nb_free +=3D count + (next_rs + 1 - q->last_free); > + > + /* free buffers from last_free, up to and including next_rs */ > + if (q->last_free <=3D next_rs) { > + count =3D next_rs - q->last_free + 1; > + tx_free_bulk_mbuf(&q->sw_ring[q->last_free], count); > + q->last_free +=3D count; > + } > + > + if (q->last_free =3D=3D q->nb_desc) > + q->last_free =3D 0; > + > + return count; > +} > + > static inline void tx_free_descriptors(struct fm10k_tx_queue *q) > { > uint16_t next_rs, count =3D 0; > -- > 2.17.1