DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Sivaprasad Tummala <sivaprasad.tummala@amd.com>,
	david.marchand@redhat.com, aman.deep.singh@intel.com,
	yuying.zhang@intel.com, dev@dpdk.org, stable@dpdk.org
Subject: Re: [PATCH v2] app/testpmd: fix lcore ID restriction
Date: Fri, 14 Jun 2024 16:39:49 +0100	[thread overview]
Message-ID: <dc7e5205-fe92-4601-bf39-034babb3fb95@amd.com> (raw)
In-Reply-To: <20240614082707.3a2becec@hermes.local>

On 6/14/2024 4:27 PM, Stephen Hemminger wrote:
> On Fri, 14 Jun 2024 10:01:02 +0100
> Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> 
>> On 6/13/2024 8:13 PM, Stephen Hemminger wrote:
>>> On Thu, 13 Jun 2024 17:51:14 +0100
>>> Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>>>   
>>>>> Hi Sivaprasad,
>>>>>
>>>>> Is this '(lcoreid_t)' cast required? Because of integer promotion I
>>>>> think result will be correct without casting.
>>>>>
>>>>> (And without integer promotion considered, casting needs to be done on
>>>>> one of the variables, not to the result, because result may be already
>>>>> cast down I think. Anyway this is not required for this case since
>>>>> variables are u16.)
>>>>>    
>>>>
>>>> Why casing required (for record) is,
>>>> 'nb_txq' -> uint16_t, promoted to 'int'
>>>> 'nb_fwd_ports' -> uint16_t, promoted to 'int'
>>>> (nb_txq * nb_fwd_ports) -> result 'int'
>>>> nb_fwd_lcores  -> 'uint32_t'
>>>>
>>>> comparison between 'int' & 'uint32_t' gives warning. After some compiler
>>>> version it is smart enough to not give a warning, but casting is
>>>> required for old compilers.
>>>>
>>>> And back to my comment above, casting one of the parameter to
>>>> 'lcoreid_t' also works, as it forcing promotion to 'unsigned int'
>>>> instead. But logically casting looks odd, so keeping casting result.  
>>>
>>> Where is the integer promotion happening?
>>>  
>>
>> Raslan reported following compile error, this version of the patch has
>> the cast, but merged version, v3, doesn't.
>>
>>
>> ```
>> ../../root/dpdk/app/test-pmd/config.c: In function 'icmp_echo_config_setup':
>> ../../root/dpdk/app/test-pmd/config.c:5159:30: error: comparison between
>> signed and unsigned integer expressions [-Werror=sign-compare]
>>   if ((nb_txq * nb_fwd_ports) < nb_fwd_lcores)
> 
> That does look like a compiler bug. uint16 multiplied by uint16 should be uint16.
>

Probably, this warning goes away with newer version of compiler.

> Not sure why DPDK keeps using small types like uint16 so much, doesn't have any
> real benefit since all this is in registers.                             ^


  reply	other threads:[~2024-06-14 15:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15 19:46 [PATCH] " Sivaprasad Tummala
2024-04-15 21:54 ` Stephen Hemminger
2024-04-15 21:56 ` Stephen Hemminger
2024-04-16  9:55 ` [PATCH v2] " Sivaprasad Tummala
2024-04-19  8:24   ` Ferruh Yigit
2024-04-19 11:30   ` Ferruh Yigit
2024-06-06  9:56     ` Tummala, Sivaprasad
2024-06-13 16:51     ` Ferruh Yigit
2024-06-13 19:13       ` Stephen Hemminger
2024-06-14  9:01         ` Ferruh Yigit
2024-06-14 15:27           ` Stephen Hemminger
2024-06-14 15:39             ` Ferruh Yigit [this message]
2024-06-14 17:50             ` Morten Brørup
2024-06-14 18:11               ` Stephen Hemminger
2024-06-06 11:27   ` [PATCH v3] " Sivaprasad Tummala
2024-06-11 23:37     ` Ferruh Yigit
2024-06-13 16:36       ` 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=dc7e5205-fe92-4601-bf39-034babb3fb95@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=aman.deep.singh@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=sivaprasad.tummala@amd.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --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).