From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 475F941C49; Tue, 14 Feb 2023 12:04:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 34BF840EE4; Tue, 14 Feb 2023 12:04:22 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id C0B1140ED9 for ; Tue, 14 Feb 2023 12:04:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676372660; x=1707908660; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=NWv7xxmwJGwelELCt4bx+PA16oLNkg8bHHdhCDQ3NJ8=; b=Qdj/w7yd6tNvxuZPO4T2Jn1BqEymc6ZwOlWCm5N9qggC6xEd9ZCz3nT/ IJcsTVCkTaGD0vC81+cMV2PQMHa2TCUEzPg/e3Y2x9iGTElQg3K+SZoU8 EZqtIywbfbAQYA8zmyIbpqui24EOKMVuugPIToDfSg733lMC2mBQyyr7x wGVDe7C1VFxx+ehENSy/Zk0fFhgq91M19UpRenVdHAmkVkNqboZsvwA+9 bc50WSGPjBZzm1Ap8oZCbeDFiI8ctf7DOS+Kog7AAfVputd2ThuORT8JR Fp6de53jegqPmgwlWLplTEIFL93swiyD4A8pAjmZvV73q9ilsIgEaJnwx w==; X-IronPort-AV: E=McAfee;i="6500,9779,10620"; a="393536604" X-IronPort-AV: E=Sophos;i="5.97,296,1669104000"; d="scan'208";a="393536604" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2023 03:04:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10620"; a="669127615" X-IronPort-AV: E=Sophos;i="5.97,296,1669104000"; d="scan'208";a="669127615" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga002.jf.intel.com with ESMTP; 14 Feb 2023 03:04:19 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 14 Feb 2023 03:04:18 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 14 Feb 2023 03:04:18 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Tue, 14 Feb 2023 03:04:18 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.107) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Tue, 14 Feb 2023 03:03:33 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PEAtN2iMCQG6MGgvShBr9jI/M6Q7Ms3EsKTz4iNPp6pYZvCF09W4Rq+dzdlxN45suWJ25u2I5kauGNUMf8W6Yx4ROI3L7YWpU0BdlpNjLK3jraxfzlp4qh4UAT+vLydxW6C2aVX5TFearA1vicWGZoETPa3+0dTSjZ1JWpmB0nOmNDbiCtsUGOMjiogyreFKB9Wz7RnGGH2ARw0Vt4aLV8+aJ29qWD6e+MVys3w809wkk0+qrVRVuVDrbQTD8mCAxBtTP5xGiYRMYvHAI7pNKW/SWKNuRxN3IL/TcR99saX2kFcxA5y+MZg0Q8+l24T+aIHEbtLj4z1W6aouQb2tKw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wVuL2SWKOxU8a/FJJ6tJskUgUsr+vvMcvMnTfkEA0E8=; b=CN1QWfEZZWiTnY0xz+OWpynxvKpcOjqou2QIGfVZBTKMp2EoXZRFEEY3g1YqIsfQYE/O2peX58Yfu23nDG5HtzmC+MBldqukxwAQ3/MgDW33n3c/1CJZqTDUUnf/YovLpNaUi1X09VqrYQnITfYigRdAvkSD15N9MOSgmqZ967iWCJv6VGEP+gRQXFM0usN3/ier34IVEZVm6EzOId1YzpluBPdNpHvb3Qdnrtfv4v0fhVL6Ln7jJlNWd+Wyqn547pKBSzFJHmzZJ3j9Foq95KgGRWcbD1Vtg9W2TbF2soP6Tc8IXkyDD5hpdZ+l3mrHr6Mo6RGLzVFl01FX6+J+QQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) by PH7PR11MB5793.namprd11.prod.outlook.com (2603:10b6:510:13a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.23; Tue, 14 Feb 2023 11:03:31 +0000 Received: from MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::7b62:475f:32a5:d4]) by MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::7b62:475f:32a5:d4%3]) with mapi id 15.20.6086.017; Tue, 14 Feb 2023 11:03:31 +0000 Message-ID: <033b5750-827d-02aa-0031-d2d3834a41fd@intel.com> Date: Tue, 14 Feb 2023 16:33:20 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: Re: [PATCH 6/6] app/testpmd: factorize fwd engine Tx To: David Marchand , CC: Ferruh Yigit , Yuying Zhang , Robin Jarry References: <20230124104742.1265439-1-david.marchand@redhat.com> <20230124104742.1265439-7-david.marchand@redhat.com> Content-Language: en-US From: "Singh, Aman Deep" In-Reply-To: <20230124104742.1265439-7-david.marchand@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN2PR01CA0059.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:22::34) To MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR11MB0062:EE_|PH7PR11MB5793:EE_ X-MS-Office365-Filtering-Correlation-Id: a5c6600c-c5f2-4cf3-423f-08db0e7b1ba0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nMZ29Qt1T3QxZNXCO9ChCthGrwBzRb345sQPnhlbFTokaZ53+4W/4CLV5P+8KKSKLIlcxa8azoaqZegkCGZuwm4Eo3E/jHY9i7P7EQBuuSTf8FfjE6iH25SCnHEA6Xf9wfVoFvOUYjfHJRnkFnmTfLVxEQOv/O5eaYfuTVNZDgC7fK3bGYLx/vFY+yCdhjYEmXBmAHU7Tuv0gYL2DG/zPHwiI6GP8fWKPOFTtkvw9xkp5gFgAW+lkQgPhYUYBlmMzBIF5UQx004I2ha5uBSqMXtx0flmIpeq+7B9TVbL69XPgEIHgUC6VViG00yR73AGjCJXD/3TCx7+PB7IsnQnn8/Yzu5RBOTmhNyKWrkxW+jtH7nc1xUU7DQIXqP4pd8m2hpsgdQHc0h744A1gWTORpJlKBJZE1pKdMQF/u6RvlFCoikUdiUiYuB7wN3sbEK0v+v8i7h7lftpF3UhUTsSvm/KHyLLBYOeU9AnARPJI56qF4+RBsKGaTDWURebPpQUWZySz5llXV9KeoBgqFqrDFTb9zNacpx2pPVljX7L7mUzPqGIz45w7AetW5zauWlBGBioQUBb1B56mGSqrtRYqfw2DbHenY886rZYxc3ZfFmmStX1LHoOrlRdfaF0fehu6Km38mLt4USpfEMWD3kHPpq0tu8Xx2fiZ7xiM1DdM8eGf5pDB4sDnE1oFZ9QtMVTGTrydfcnS3NNs9ec3R1fc+S5+zN4EIaIaJk6GFisAfU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB0062.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199018)(6666004)(2616005)(8676002)(41300700001)(66556008)(66946007)(66476007)(4326008)(5660300002)(30864003)(2906002)(38100700002)(8936002)(82960400001)(478600001)(86362001)(6486002)(83380400001)(31696002)(36756003)(54906003)(316002)(6506007)(31686004)(186003)(6512007)(26005)(53546011)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TDFBZkswQ245UitLSko4YjU0REFBNmJPdDRpcW85Yi9lSG1LN1d2czNDVUlj?= =?utf-8?B?anBoWG8zd3l6b2xPdTdPdDR0b2NHM0NKcFpNaWhNZnlvMXVUYzZDTFEvdUlZ?= =?utf-8?B?K0U5SHhSd0ZpZjJmWEllSndZSzFqU3d3R1k3NC9jMUdMbS9RcFVlRkc2SmVN?= =?utf-8?B?VVBGUnJhYlJGWDZFMDlCVmNUS1pGWnZIeWVZUlVPN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VWRy9ETkpIMkpodGpoYlZpaUxDYnRYU1l5OHBLSWk1?= =?utf-8?B?Yy9sWWxWNk5wQzdkQVIzVWVNeEZSN05vcVVKYndGSFJ2eWp0VXhxZUFBY1di?= =?utf-8?B?NnVXUDVuQTUvb2VxNWoxOE1QSlhNUlVhWWdQQzRwL2czTXArdFp5WFpTQnVO?= =?utf-8?B?UVE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: a5c6600c-c5f2-4cf3-423f-08db0e7b1ba0 X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB0062.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 11:03:31.3279 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FwbtLXdXW+YRVzSLrMoYO9z1GTf4KACnvjqQk+weUPYv/fGPSCNnLbdfAP8P/VhxjMdpY0zB6yC0Jns/sH4MvIZikWvvKRHksgw5P8ngA1M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB5793 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 1/24/2023 4:17 PM, David Marchand wrote: > Reduce code duplication by introducing a helper that takes care of > transmitting, retrying if enabled and incrementing tx counter. > > Signed-off-by: David Marchand > --- > app/test-pmd/5tswap.c | 22 +------------ > app/test-pmd/csumonly.c | 23 +------------- > app/test-pmd/flowgen.c | 22 +------------ > app/test-pmd/icmpecho.c | 28 ++--------------- > app/test-pmd/iofwd.c | 22 +------------ > app/test-pmd/macfwd.c | 21 +------------ > app/test-pmd/macswap.c | 27 ++-------------- > app/test-pmd/noisy_vnf.c | 67 +++++++--------------------------------- > app/test-pmd/testpmd.h | 30 ++++++++++++++++++ > app/test-pmd/txonly.c | 33 +++++--------------- > 10 files changed, 58 insertions(+), 237 deletions(-) > > diff --git a/app/test-pmd/5tswap.c b/app/test-pmd/5tswap.c > index 27da867d7f..ff8c2dcde5 100644 > --- a/app/test-pmd/5tswap.c > +++ b/app/test-pmd/5tswap.c > @@ -91,9 +91,6 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs) > uint64_t ol_flags; > uint16_t proto; > uint16_t nb_rx; > - uint16_t nb_tx; > - uint32_t retry; > - > int i; > union { > struct rte_ether_hdr *eth; > @@ -155,24 +152,7 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs) > } > mbuf_field_set(mb, ol_flags); > } > - nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx); > - /* > - * Retry if necessary > - */ > - if (unlikely(nb_tx < nb_rx) && fs->retry_enabled) { > - retry = 0; > - while (nb_tx < nb_rx && retry++ < burst_tx_retry_num) { > - rte_delay_us(burst_tx_delay_time); > - nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > - &pkts_burst[nb_tx], nb_rx - nb_tx); > - } > - } > - fs->tx_packets += nb_tx; > - inc_tx_burst_stats(fs, nb_tx); > - if (unlikely(nb_tx < nb_rx)) { > - fs->fwd_dropped += (nb_rx - nb_tx); > - rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx); > - } > + common_fwd_stream_transmit(fs, pkts_burst, nb_rx); > > return true; > } > diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c > index d758ae0ac6..fc85c22a77 100644 > --- a/app/test-pmd/csumonly.c > +++ b/app/test-pmd/csumonly.c > @@ -847,12 +847,10 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) > uint8_t gro_enable; > #endif > uint16_t nb_rx; > - uint16_t nb_tx; > uint16_t nb_prep; > uint16_t i; > uint64_t rx_ol_flags, tx_ol_flags; > uint64_t tx_offloads; > - uint32_t retry; > uint32_t rx_bad_ip_csum; > uint32_t rx_bad_l4_csum; > uint32_t rx_bad_outer_l4_csum; > @@ -1169,32 +1167,13 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) > rte_pktmbuf_free_bulk(&tx_pkts_burst[nb_prep], nb_rx - nb_prep); > } > > - nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, tx_pkts_burst, > - nb_prep); > + common_fwd_stream_transmit(fs, tx_pkts_burst, nb_prep); > > - /* > - * Retry if necessary > - */ > - if (unlikely(nb_tx < nb_prep) && fs->retry_enabled) { > - retry = 0; > - while (nb_tx < nb_prep && retry++ < burst_tx_retry_num) { > - rte_delay_us(burst_tx_delay_time); > - nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > - &tx_pkts_burst[nb_tx], nb_prep - nb_tx); > - } > - } > - fs->tx_packets += nb_tx; > fs->rx_bad_ip_csum += rx_bad_ip_csum; > fs->rx_bad_l4_csum += rx_bad_l4_csum; > fs->rx_bad_outer_l4_csum += rx_bad_outer_l4_csum; > fs->rx_bad_outer_ip_csum += rx_bad_outer_ip_csum; > > - inc_tx_burst_stats(fs, nb_tx); > - if (unlikely(nb_tx < nb_prep)) { > - fs->fwd_dropped += (nb_prep - nb_tx); > - rte_pktmbuf_free_bulk(&tx_pkts_burst[nb_tx], nb_prep - nb_tx); > - } > - > return true; > } > > diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c > index 3705cc60c5..5a0d096309 100644 > --- a/app/test-pmd/flowgen.c > +++ b/app/test-pmd/flowgen.c > @@ -71,11 +71,9 @@ pkt_burst_flow_gen(struct fwd_stream *fs) > uint16_t vlan_tci, vlan_tci_outer; > uint64_t ol_flags = 0; > uint16_t nb_rx; > - uint16_t nb_tx; > uint16_t nb_dropped; > uint16_t nb_pkt; > uint16_t nb_clones = nb_pkt_flowgen_clones; > - uint32_t retry; > uint64_t tx_offloads; > int next_flow = RTE_PER_LCORE(_next_flow); > > @@ -158,30 +156,12 @@ pkt_burst_flow_gen(struct fwd_stream *fs) > next_flow = 0; > } > > - nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pkt); > - /* > - * Retry if necessary > - */ > - if (unlikely(nb_tx < nb_pkt) && fs->retry_enabled) { > - retry = 0; > - while (nb_tx < nb_pkt && retry++ < burst_tx_retry_num) { > - rte_delay_us(burst_tx_delay_time); > - nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > - &pkts_burst[nb_tx], nb_pkt - nb_tx); > - } > - } > - fs->tx_packets += nb_tx; > - > - inc_tx_burst_stats(fs, nb_tx); > - nb_dropped = nb_pkt - nb_tx; > + nb_dropped = common_fwd_stream_transmit(fs, pkts_burst, nb_pkt); > if (unlikely(nb_dropped > 0)) { > /* Back out the flow counter. */ > next_flow -= nb_dropped; > while (next_flow < 0) > next_flow += nb_flows_flowgen; > - > - fs->fwd_dropped += nb_dropped; > - rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_pkt - nb_tx); > } > > RTE_PER_LCORE(_next_flow) = next_flow; > diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c > index 48f8fe0bf1..68524484e3 100644 > --- a/app/test-pmd/icmpecho.c > +++ b/app/test-pmd/icmpecho.c > @@ -280,10 +280,8 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) > struct rte_ipv4_hdr *ip_h; > struct rte_icmp_hdr *icmp_h; > struct rte_ether_addr eth_addr; > - uint32_t retry; > uint32_t ip_addr; > uint16_t nb_rx; > - uint16_t nb_tx; > uint16_t nb_replies; > uint16_t eth_type; > uint16_t vlan_id; > @@ -476,30 +474,8 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) > } > > /* Send back ICMP echo replies, if any. */ > - if (nb_replies > 0) { > - nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, > - nb_replies); > - /* > - * Retry if necessary > - */ > - if (unlikely(nb_tx < nb_replies) && fs->retry_enabled) { > - retry = 0; > - while (nb_tx < nb_replies && > - retry++ < burst_tx_retry_num) { > - rte_delay_us(burst_tx_delay_time); > - nb_tx += rte_eth_tx_burst(fs->tx_port, > - fs->tx_queue, > - &pkts_burst[nb_tx], > - nb_replies - nb_tx); > - } > - } > - fs->tx_packets += nb_tx; > - inc_tx_burst_stats(fs, nb_tx); > - if (unlikely(nb_tx < nb_replies)) { > - fs->fwd_dropped += (nb_replies - nb_tx); > - rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_replies - nb_tx); > - } > - } > + if (nb_replies > 0) > + common_fwd_stream_transmit(fs, pkts_burst, nb_replies); > > return true; > } > diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c > index 69b583cb5b..ba06fae4a6 100644 > --- a/app/test-pmd/iofwd.c > +++ b/app/test-pmd/iofwd.c > @@ -46,8 +46,6 @@ pkt_burst_io_forward(struct fwd_stream *fs) > { > struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; > uint16_t nb_rx; > - uint16_t nb_tx; > - uint32_t retry; > > /* > * Receive a burst of packets and forward them. > @@ -56,25 +54,7 @@ pkt_burst_io_forward(struct fwd_stream *fs) > if (unlikely(nb_rx == 0)) > return false; > > - nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > - pkts_burst, nb_rx); > - /* > - * Retry if necessary > - */ > - if (unlikely(nb_tx < nb_rx) && fs->retry_enabled) { > - retry = 0; > - while (nb_tx < nb_rx && retry++ < burst_tx_retry_num) { > - rte_delay_us(burst_tx_delay_time); > - nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > - &pkts_burst[nb_tx], nb_rx - nb_tx); > - } > - } > - fs->tx_packets += nb_tx; > - inc_tx_burst_stats(fs, nb_tx); > - if (unlikely(nb_tx < nb_rx)) { > - fs->fwd_dropped += (nb_rx - nb_tx); > - rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx); > - } > + common_fwd_stream_transmit(fs, pkts_burst, nb_rx); > > return true; > } > diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c > index a72f5ccb75..7316d73315 100644 > --- a/app/test-pmd/macfwd.c > +++ b/app/test-pmd/macfwd.c > @@ -48,9 +48,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) > struct rte_port *txp; > struct rte_mbuf *mb; > struct rte_ether_hdr *eth_hdr; > - uint32_t retry; > uint16_t nb_rx; > - uint16_t nb_tx; > uint16_t i; > uint64_t ol_flags = 0; > uint64_t tx_offloads; > @@ -87,25 +85,8 @@ pkt_burst_mac_forward(struct fwd_stream *fs) > mb->vlan_tci = txp->tx_vlan_id; > mb->vlan_tci_outer = txp->tx_vlan_id_outer; > } > - nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx); > - /* > - * Retry if necessary > - */ > - if (unlikely(nb_tx < nb_rx) && fs->retry_enabled) { > - retry = 0; > - while (nb_tx < nb_rx && retry++ < burst_tx_retry_num) { > - rte_delay_us(burst_tx_delay_time); > - nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > - &pkts_burst[nb_tx], nb_rx - nb_tx); > - } > - } > > - fs->tx_packets += nb_tx; > - inc_tx_burst_stats(fs, nb_tx); > - if (unlikely(nb_tx < nb_rx)) { > - fs->fwd_dropped += (nb_rx - nb_tx); > - rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx); > - } > + common_fwd_stream_transmit(fs, pkts_burst, nb_rx); > > return true; > } > diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c > index ab37123404..57f77003fe 100644 > --- a/app/test-pmd/macswap.c > +++ b/app/test-pmd/macswap.c > @@ -51,10 +51,7 @@ static bool > pkt_burst_mac_swap(struct fwd_stream *fs) > { > struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; > - struct rte_port *txp; > uint16_t nb_rx; > - uint16_t nb_tx; > - uint32_t retry; > > /* > * Receive a burst of packets and forward them. > @@ -63,28 +60,8 @@ pkt_burst_mac_swap(struct fwd_stream *fs) > if (unlikely(nb_rx == 0)) > return false; > > - txp = &ports[fs->tx_port]; > - > - do_macswap(pkts_burst, nb_rx, txp); > - > - nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx); > - /* > - * Retry if necessary > - */ > - if (unlikely(nb_tx < nb_rx) && fs->retry_enabled) { > - retry = 0; > - while (nb_tx < nb_rx && retry++ < burst_tx_retry_num) { > - rte_delay_us(burst_tx_delay_time); > - nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > - &pkts_burst[nb_tx], nb_rx - nb_tx); > - } > - } > - fs->tx_packets += nb_tx; > - inc_tx_burst_stats(fs, nb_tx); > - if (unlikely(nb_tx < nb_rx)) { > - fs->fwd_dropped += (nb_rx - nb_tx); > - rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx); > - } > + do_macswap(pkts_burst, nb_rx, &ports[fs->tx_port]); > + common_fwd_stream_transmit(fs, pkts_burst, nb_rx); > > return true; > } > diff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c > index 937d5a1d7d..3875590132 100644 > --- a/app/test-pmd/noisy_vnf.c > +++ b/app/test-pmd/noisy_vnf.c > @@ -93,30 +93,6 @@ sim_memory_lookups(struct noisy_config *ncf, uint16_t nb_pkts) > } > } > > -static uint16_t > -do_retry(uint16_t nb_rx, uint16_t nb_tx, struct rte_mbuf **pkts, > - struct fwd_stream *fs) > -{ > - uint32_t retry = 0; > - > - while (nb_tx < nb_rx && retry++ < burst_tx_retry_num) { > - rte_delay_us(burst_tx_delay_time); > - nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > - &pkts[nb_tx], nb_rx - nb_tx); > - } > - > - return nb_tx; > -} > - > -static uint32_t > -drop_pkts(struct rte_mbuf **pkts, uint16_t nb_rx, uint16_t nb_tx) > -{ > - if (nb_tx < nb_rx) > - rte_pktmbuf_free_bulk(&pkts[nb_tx], nb_rx - nb_tx); > - > - return nb_rx - nb_tx; > -} > - > /* > * Forwarding of packets in noisy VNF mode. Forward packets but perform > * memory operations first as specified on cmdline. > @@ -156,38 +132,23 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs) > > if (!ncf->do_buffering) { > sim_memory_lookups(ncf, nb_rx); > - nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > - pkts_burst, nb_rx); > - if (unlikely(nb_tx < nb_rx) && fs->retry_enabled) > - nb_tx += do_retry(nb_rx, nb_tx, pkts_burst, fs); > - inc_tx_burst_stats(fs, nb_tx); > - fs->tx_packets += nb_tx; > - fs->fwd_dropped += drop_pkts(pkts_burst, nb_rx, nb_tx); > + nb_tx = common_fwd_stream_transmit(fs, pkts_burst, nb_rx); > > return true; > } > > fifo_free = rte_ring_free_count(ncf->f); > if (fifo_free >= nb_rx) { > - nb_enqd = rte_ring_enqueue_burst(ncf->f, > - (void **) pkts_burst, nb_rx, NULL); > - if (nb_enqd < nb_rx) > - fs->fwd_dropped += drop_pkts(pkts_burst, > - nb_rx, nb_enqd); > - } else { > - nb_deqd = rte_ring_dequeue_burst(ncf->f, > - (void **) tmp_pkts, nb_rx, NULL); > - nb_enqd = rte_ring_enqueue_burst(ncf->f, > - (void **) pkts_burst, nb_deqd, NULL); > - if (nb_deqd > 0) { > - nb_tx = rte_eth_tx_burst(fs->tx_port, > - fs->tx_queue, tmp_pkts, > - nb_deqd); > - if (unlikely(nb_tx < nb_rx) && fs->retry_enabled) > - nb_tx += do_retry(nb_rx, nb_tx, tmp_pkts, fs); > - inc_tx_burst_stats(fs, nb_tx); > - fs->fwd_dropped += drop_pkts(tmp_pkts, nb_deqd, nb_tx); > + nb_enqd = rte_ring_enqueue_burst(ncf->f, (void **) pkts_burst, nb_rx, NULL); > + if (nb_enqd < nb_rx) { > + fs->fwd_dropped += nb_rx - nb_enqd; > + rte_pktmbuf_free_bulk(&pkts_burst[nb_enqd], nb_rx - nb_enqd); > } > + } else { > + nb_deqd = rte_ring_dequeue_burst(ncf->f, (void **) tmp_pkts, nb_rx, NULL); > + nb_enqd = rte_ring_enqueue_burst(ncf->f, (void **) pkts_burst, nb_deqd, NULL); > + if (nb_deqd > 0) > + nb_tx = common_fwd_stream_transmit(fs, tmp_pkts, nb_deqd); > } > > sim_memory_lookups(ncf, nb_enqd); > @@ -204,15 +165,9 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs) > needs_flush = delta_ms >= noisy_tx_sw_buf_flush_time && > noisy_tx_sw_buf_flush_time > 0 && !nb_tx; > while (needs_flush && !rte_ring_empty(ncf->f)) { > - unsigned int sent; > nb_deqd = rte_ring_dequeue_burst(ncf->f, (void **)tmp_pkts, > MAX_PKT_BURST, NULL); > - sent = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > - tmp_pkts, nb_deqd); > - if (unlikely(sent < nb_deqd) && fs->retry_enabled) > - nb_tx += do_retry(nb_rx, nb_tx, tmp_pkts, fs); > - inc_tx_burst_stats(fs, nb_tx); > - fs->fwd_dropped += drop_pkts(tmp_pkts, nb_deqd, sent); > + nb_tx = common_fwd_stream_transmit(fs, tmp_pkts, nb_deqd); > ncf->prev_time = rte_get_timer_cycles(); > } > > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h > index e6b28b4748..71ff70f55b 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -870,6 +870,36 @@ common_fwd_stream_receive(struct fwd_stream *fs, struct rte_mbuf **burst, > return nb_rx; > } > > +/* Returns count of dropped packets. */ > +static inline uint16_t > +common_fwd_stream_transmit(struct fwd_stream *fs, struct rte_mbuf **burst, > + unsigned int count) > +{ > + uint16_t nb_tx; > + uint32_t retry; > + > + nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, burst, count); > + /* > + * Retry if necessary > + */ > + if (unlikely(nb_tx < count) && fs->retry_enabled) { > + retry = 0; > + while (nb_tx < count && retry++ < burst_tx_retry_num) { > + rte_delay_us(burst_tx_delay_time); > + nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > + &burst[nb_tx], count - nb_tx); > + } > + } > + fs->tx_packets += nb_tx; > + inc_tx_burst_stats(fs, nb_tx); > + if (unlikely(nb_tx < count)) { > + fs->fwd_dropped += (count - nb_tx); > + rte_pktmbuf_free_bulk(&burst[nb_tx], count - nb_tx); > + } > + > + return count - nb_tx; > +} > + > /* Prototypes */ > unsigned int parse_item_list(const char *str, const char *item_name, > unsigned int max_items, > diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c > index b80ab6f5df..7144b3d5eb 100644 > --- a/app/test-pmd/txonly.c > +++ b/app/test-pmd/txonly.c > @@ -331,10 +331,9 @@ pkt_burst_transmit(struct fwd_stream *fs) > struct rte_mbuf *pkt; > struct rte_mempool *mbp; > struct rte_ether_hdr eth_hdr; > - uint16_t nb_tx; > + uint16_t nb_dropped; > uint16_t nb_pkt; > uint16_t vlan_tci, vlan_tci_outer; > - uint32_t retry; > uint64_t ol_flags = 0; > uint64_t tx_offloads; > > @@ -391,34 +390,18 @@ pkt_burst_transmit(struct fwd_stream *fs) > if (nb_pkt == 0) > return false; > > - nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pkt); > - > - /* > - * Retry if necessary > - */ > - if (unlikely(nb_tx < nb_pkt) && fs->retry_enabled) { > - retry = 0; > - while (nb_tx < nb_pkt && retry++ < burst_tx_retry_num) { > - rte_delay_us(burst_tx_delay_time); > - nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > - &pkts_burst[nb_tx], nb_pkt - nb_tx); > - } > - } > - fs->tx_packets += nb_tx; > + nb_dropped = common_fwd_stream_transmit(fs, pkts_burst, nb_pkt); > > if (txonly_multi_flow) > - RTE_PER_LCORE(_ip_var) -= nb_pkt - nb_tx; > + RTE_PER_LCORE(_ip_var) -= nb_dropped; > > - inc_tx_burst_stats(fs, nb_tx); > - if (unlikely(nb_tx < nb_pkt)) { > + if (unlikely(nb_dropped > 0)) { > if (verbose_level > 0 && fs->fwd_dropped == 0) > printf("port %d tx_queue %d - drop " > - "(nb_pkt:%u - nb_tx:%u)=%u packets\n", > - fs->tx_port, fs->tx_queue, > - (unsigned) nb_pkt, (unsigned) nb_tx, > - (unsigned) (nb_pkt - nb_tx)); > - fs->fwd_dropped += (nb_pkt - nb_tx); > - rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_pkt - nb_tx); > + "(nb_pkt:%"PRIu16" - nb_tx:%"PRIu16")=" > + "%"PRIu16" packets\n", > + fs->tx_port, fs->tx_queue, nb_pkt, > + nb_pkt - nb_dropped, nb_dropped); Build error reported in this file here- ../app/test-pmd/txonly.c:404:5: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] > } > > return true;