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 3C78141CB0; Thu, 16 Feb 2023 11:07:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1938640EE3; Thu, 16 Feb 2023 11:07:41 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2065.outbound.protection.outlook.com [40.107.94.65]) by mails.dpdk.org (Postfix) with ESMTP id 6A92D40E0F for ; Thu, 16 Feb 2023 11:07:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WtbMLXTvYC2LrM6XNT1shk+Fj1x7R33NItfp7K5n1kWHk3kE27ZO2wpZbpWTYoyVbej1lMO54kzmDHFubHfFZyVdA+LgXLLXw3Ebd11ppzPjBUrDzR3YcccsOGo5ajx/lEvF5fKLkUgxg8HZF8TTJfNMxBUEDf4+P1Yei/17PllC8a/zoTjO+7il88AncxDFwTP98LMmu+bjWdp0afwaSE4JEk5mSIZncCqVXLvHXcbrRHAd1I5xsLOb9KKYqqzOeT97A0QBwaQmdaBUbSzwdFEPtt/ACU+FUfP8wUkINVEw9ygudNzCVmoZgFnt7clSOUFigRLrME6TCZuIRq30TA== 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=j2YHuNNNWY8G3hc338mpsrqpefcirDoxN0QYRAglouo=; b=oWyws0LO+FelvrWd1U1+CQd1xVZx0be2p+2iqtjGSvorbJJ0dlAwqsVoVD1r0cPl9aiJxlfXArmtnU89p/Z9NGGsJhwXWbJtl2g5rixID+IDLPSPn1wV8tPjslZPrqLYlUz9F3XmTPw4HjG/Xiu10Znj03zPFCyk57E1WSkZZKmxV8a+v9c4B8UiJSIZJLO1UVUa2pN90rdo5KJO9OTPi5oSEYiSh2xJDV5QlaHwEkay+4DHt3R4YDgGPjG8k+9IiyakP1lt1+BQmBtHrUmVxnoA423NZqYikYiJdjD2Cc+DwJPj2eVVJJncSJZnt0MQG1P9en37ZPkvIv1sjnWdow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=j2YHuNNNWY8G3hc338mpsrqpefcirDoxN0QYRAglouo=; b=zunw7CnzfDYX1wFKTLQqIbIsf6kgO9nyGiqyos+r9fKPYFz8uLSgdqR1wn3W2WdXZQUK24WlykJhOmdhXhWCZ6nX1NgWbRPXtsSupCc/szQsYrXt5U7lilEkEkHpBHeox8UaavCVsUJIElSxTlbJwYPSkOIGLHJKtV6VUBfkJBM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by PH7PR12MB7966.namprd12.prod.outlook.com (2603:10b6:510:274::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 10:07:36 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48%7]) with mapi id 15.20.6111.013; Thu, 16 Feb 2023 10:07:36 +0000 Message-ID: <74d9d6ac-e360-7b32-e870-6bc0c0d731b8@amd.com> Date: Thu, 16 Feb 2023 10:07:30 +0000 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 Content-Language: en-US To: "Singh, Aman Deep" , David Marchand , dev@dpdk.org Cc: Yuying Zhang , Robin Jarry References: <20230124104742.1265439-1-david.marchand@redhat.com> <20230124104742.1265439-7-david.marchand@redhat.com> <033b5750-827d-02aa-0031-d2d3834a41fd@intel.com> <05073ac4-9188-0887-c39c-0d5f215df947@amd.com> <4def3139-f828-ffa1-e82c-a88869549f6e@intel.com> From: Ferruh Yigit In-Reply-To: <4def3139-f828-ffa1-e82c-a88869549f6e@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P265CA0253.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:37c::6) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|PH7PR12MB7966:EE_ X-MS-Office365-Filtering-Correlation-Id: 677e56c8-569d-40fb-3ce9-08db1005a0a6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r+FwTmZ2hRV9Yt4t4KgvLLCngy/5lbl01eEcRAnV3n2Cngs+JJopake/pAKTOb63pjZk+MFYYDj3oiofKJ/SWyf1E2F9emP/cpxJcgNwL4fz6Y4tiA6RuusONAHzub7u03BJ//0NeW7sleRc0j6AOm1bAzeAqv0reumcfdlFMtsSS30lAU0tau/GGQys1EjA9MyeyWNoNVkYtfqXdwZ2K5v0IG2ut6SfsYFIz2g6fMPLVhNEr+LeNsKBJlUr+U2Ihv3CVncbA7OlMto2SlRP/D861nUhPadyBzaurMm8OcgERRA6zB15i1Vzav4mY72iQBbVPnA2WVhoHZxLau6X1dWI5JM4LVK2K66mhi871i+7J5cSlwDm3zYFQOWXJQprLxO9dliKnRDEuVXCAVxmxvOX3vtm82pec3kIi42zPFq4qj8lZ8PmHMnULQXtKaIY7GbBhT0Mo3fXzwyPwT4di8OTdgSUwFsDs3SNGQ4uzZn+VVGbyKY+wG+kzN8htGQGE2EDWP2NICBzDz85F0XEzOVLClAdv+coG4mNZ9hcAPVhv/44ma/OBA0i/aSlzIH6B3Dk6u7SYtXE+TxDcK2h3HtlZ93kxn/eyhQG7TXQpTTMlGmDgAgpc7/VcMXcMJ0awv5KRCedJbCnvk01dMQsidku44La5wGthO5tsU3GTGG4lxj01zxkf2/9MDET0vtkXFf/4YlWYjwhWhgbrIvHY/FLPKS999sLMBAstLa+l+E= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(39860400002)(366004)(136003)(376002)(396003)(451199018)(36756003)(66476007)(44832011)(41300700001)(5660300002)(8936002)(2906002)(6486002)(110136005)(478600001)(4326008)(8676002)(66556008)(66946007)(54906003)(316002)(38100700002)(31686004)(2616005)(6666004)(53546011)(6506007)(86362001)(186003)(31696002)(26005)(6512007)(83380400001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cUp6RkdSNTFHYWJPWlhndURSWWNzV1Q5OWtFREIvMFFVYmMycEl1aU4vT0Yz?= =?utf-8?B?TVh4QUpCYnRDV1lyZmFBdHVkT0t3NzFUZXNDWXFTclVGZzJCTU5tUjdNbEE4?= =?utf-8?B?bVV1cHF3NU9Pc2hkQ3k4TDFnR3lRbXRCTWQ3YS9MSEk4M2dxdkhQbXY2cWt3?= =?utf-8?B?TkxrKzRhU2JMbGtCeTNIejh4VHhnaGdJazBFVjFNcmNSZ3I3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WkMwU0ovVHFQTDZKcmNINmdrSlFLUlZHV0Zx?= =?utf-8?B?cC9kSVU4bnRKaHozbktPdFdoUGF3bnZBRm1sVFhjSjhPVFNaNFR6Z1FZUnRI?= =?utf-8?Q?h0UiYB1mX2iq/U5/l/laoqEZ8?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 677e56c8-569d-40fb-3ce9-08db1005a0a6 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 10:07:36.1374 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uql0TBcYsanmsHHmDoSWKu3LWAppLmv+WUaHf1ZlG7wEboQpa5HbM0AlanXEzDe8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7966 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 2/16/2023 8:01 AM, Singh, Aman Deep wrote: > > On 2/14/2023 11:47 PM, Ferruh Yigit wrote: >> On 2/14/2023 11:03 AM, Singh, Aman Deep wrote: >>> 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 >> <...> >> >>>> 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] >>> >> both 'nb_pkt' & 'nb_dropped' are 'uint16_t' (unsigned short), I wonder >> which argument is causing this warning? > > I think, subtraction of two unsigned numbers promotes the result to int. > As 'nb_pkt > nb_dropped', we may explicitly typecast it- > '(unsigned)(nb_pkt - nb_dropped)' > You are right, subtraction promoted to int. May be better to cast to 'uint16_t', since warning is not just sign but also type related.