DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: "Singh, Aman Deep" <aman.deep.singh@intel.com>,
	David Marchand <david.marchand@redhat.com>,
	dev@dpdk.org
Cc: Yuying Zhang <yuying.zhang@intel.com>, Robin Jarry <rjarry@redhat.com>
Subject: Re: [PATCH 6/6] app/testpmd: factorize fwd engine Tx
Date: Thu, 16 Feb 2023 10:07:30 +0000	[thread overview]
Message-ID: <74d9d6ac-e360-7b32-e870-6bc0c0d731b8@amd.com> (raw)
In-Reply-To: <4def3139-f828-ffa1-e82c-a88869549f6e@intel.com>

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 <david.marchand@redhat.com>
>> <...>
>>
>>>> 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.


  reply	other threads:[~2023-02-16 10:07 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 10:47 [PATCH 0/6] Testpmd code cleanup David Marchand
2023-01-24 10:47 ` [PATCH 1/6] app/testpmd: factorize core cycles record David Marchand
2023-02-14 18:14   ` Ferruh Yigit
2023-01-24 10:47 ` [PATCH 2/6] app/testpmd: don't send unprepared packets David Marchand
2023-02-14 18:14   ` Ferruh Yigit
2023-01-24 10:47 ` [PATCH 3/6] app/testpmd: bulk free mbufs David Marchand
2023-02-14 18:14   ` Ferruh Yigit
2023-01-24 10:47 ` [PATCH 4/6] app/testpmd: factorize fwd engine init David Marchand
2023-02-14 18:14   ` Ferruh Yigit
2023-01-24 10:47 ` [PATCH 5/6] app/testpmd: factorize fwd engine Rx David Marchand
2023-02-14 18:15   ` Ferruh Yigit
2023-01-24 10:47 ` [PATCH 6/6] app/testpmd: factorize fwd engine Tx David Marchand
2023-02-14 11:03   ` Singh, Aman Deep
2023-02-14 18:17     ` Ferruh Yigit
2023-02-16  8:01       ` Singh, Aman Deep
2023-02-16 10:07         ` Ferruh Yigit [this message]
2023-02-14 18:16   ` Ferruh Yigit
2023-02-20 16:33     ` David Marchand
2023-01-25 13:50 ` [PATCH 0/6] Testpmd code cleanup Robin Jarry
2023-02-14 18:22   ` Ferruh Yigit
2023-02-20 15:02     ` David Marchand
2023-02-20 16:40 ` [PATCH v2 0/9] " David Marchand
2023-02-20 16:40   ` [PATCH v2 1/9] app/testpmd: fix Tx preparation in checksum engine David Marchand
2023-02-20 16:40   ` [PATCH v2 2/9] app/testpmd: fix packet count in ieee15888 engine David Marchand
2023-02-20 16:40   ` [PATCH v2 3/9] app/testpmd: rework ieee1588 engine fwd configuration David Marchand
2023-02-24  9:11     ` Singh, Aman Deep
2023-02-20 16:40   ` [PATCH v2 4/9] app/testpmd: fix packet transmission in noisy VNF engine David Marchand
2023-02-20 16:40   ` [PATCH v2 5/9] app/testpmd: bulk free mbufs David Marchand
2023-02-20 16:41   ` [PATCH v2 6/9] app/testpmd: factorize core cycles record David Marchand
2023-02-20 16:41   ` [PATCH v2 7/9] app/testpmd: factorize fwd engine init David Marchand
2023-02-20 16:41   ` [PATCH v2 8/9] app/testpmd: factorize fwd engine Rx David Marchand
2023-02-20 16:41   ` [PATCH v2 9/9] app/testpmd: factorize fwd engine Tx David Marchand
2023-02-20 18:34 ` [PATCH v3 0/9] Testpmd code cleanup David Marchand
2023-02-20 18:34   ` [PATCH v3 1/9] app/testpmd: fix Tx preparation in checksum engine David Marchand
2023-02-20 18:34   ` [PATCH v3 2/9] app/testpmd: fix packet count in ieee15888 engine David Marchand
2023-02-24  8:24     ` Singh, Aman Deep
2023-02-20 18:34   ` [PATCH v3 3/9] app/testpmd: rework ieee1588 engine fwd configuration David Marchand
2023-02-28 18:50     ` Ferruh Yigit
2023-02-20 18:34   ` [PATCH v3 4/9] app/testpmd: fix packet transmission in noisy VNF engine David Marchand
2023-02-28 18:51     ` Ferruh Yigit
2023-02-20 18:34   ` [PATCH v3 5/9] app/testpmd: bulk free mbufs David Marchand
2023-02-20 18:45     ` Stephen Hemminger
2023-02-20 18:34   ` [PATCH v3 6/9] app/testpmd: factorize core cycles record David Marchand
2023-02-20 18:35   ` [PATCH v3 7/9] app/testpmd: factorize fwd engine init David Marchand
2023-02-20 18:35   ` [PATCH v3 8/9] app/testpmd: factorize fwd engine Rx David Marchand
2023-02-20 18:35   ` [PATCH v3 9/9] app/testpmd: factorize fwd engine Tx David Marchand
2023-02-28 18:35     ` Ferruh Yigit
2023-02-28 18:54   ` [PATCH v3 0/9] Testpmd code cleanup Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74d9d6ac-e360-7b32-e870-6bc0c0d731b8@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=aman.deep.singh@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=rjarry@redhat.com \
    --cc=yuying.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).