DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Singh, Jasvinder" <jasvinder.singh@intel.com>
To: "Yigit, Ferruh" <ferruh.yigit@intel.com>,
	"Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] net/softnic: remove useless address check
Date: Wed, 13 Oct 2021 15:54:49 +0000	[thread overview]
Message-ID: <BN9PR11MB52584C846100C93C8EE48681E0B79@BN9PR11MB5258.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20211004172722.3461540-1-ferruh.yigit@intel.com>



> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Monday, October 4, 2021 6:27 PM
> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org
> Subject: [PATCH] net/softnic: remove useless address check
> 
> Reported by "gcc (GCC) 12.0.0 20211003 (experimental)":
> 
> ./drivers/net/softnic/rte_eth_softnic_cli.c:
> 	In function ‘tmgr_hierarchy_default’:
> ./drivers/net/softnic/rte_eth_softnic_cli.c:634:73:
> 	error: the comparison will always evaluate as ‘true’ for the
> 	address of ‘tc_valid’ will never be NULL [-Werror=address]
>   634 | (&params->shared_shaper_id.tc_valid[0]) ? 1 : 0,
>       |                                         ^
> 
> Fixing it by removing useless check.
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Intention of the check is not clear, sending the basic fix to trigger the
> discussion for proper fix.
> ---
>  drivers/net/softnic/rte_eth_softnic_cli.c | 26 +++++++++++------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c
> b/drivers/net/softnic/rte_eth_softnic_cli.c
> index 932ec15f49b0..b04e78c6e0af 100644
> --- a/drivers/net/softnic/rte_eth_softnic_cli.c
> +++ b/drivers/net/softnic/rte_eth_softnic_cli.c
> @@ -631,7 +631,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[0],
>  			.shared_shaper_id = &shared_shaper_id[0],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[0]) ? 1
> : 0,
> +				(params->shared_shaper_id.tc_valid[0]) ? 1 :
> 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -641,7 +641,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[1],
>  			.shared_shaper_id = &shared_shaper_id[1],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[1]) ? 1
> : 0,
> +				(params->shared_shaper_id.tc_valid[1]) ? 1 :
> 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -651,7 +651,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[2],
>  			.shared_shaper_id = &shared_shaper_id[2],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[2]) ? 1
> : 0,
> +				(params->shared_shaper_id.tc_valid[2]) ? 1 :
> 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -661,7 +661,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[3],
>  			.shared_shaper_id = &shared_shaper_id[3],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[3]) ? 1
> : 0,
> +				(params->shared_shaper_id.tc_valid[3]) ? 1 :
> 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -671,7 +671,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[4],
>  			.shared_shaper_id = &shared_shaper_id[4],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[4]) ? 1
> : 0,
> +				(params->shared_shaper_id.tc_valid[4]) ? 1 :
> 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -681,7 +681,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[5],
>  			.shared_shaper_id = &shared_shaper_id[5],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[5]) ? 1
> : 0,
> +				(params->shared_shaper_id.tc_valid[5]) ? 1 :
> 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -691,7 +691,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[6],
>  			.shared_shaper_id = &shared_shaper_id[6],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[6]) ? 1
> : 0,
> +				(params->shared_shaper_id.tc_valid[6]) ? 1 :
> 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -701,7 +701,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[7],
>  			.shared_shaper_id = &shared_shaper_id[7],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[7]) ? 1
> : 0,
> +				(params->shared_shaper_id.tc_valid[7]) ? 1 :
> 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -711,7 +711,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[8],
>  			.shared_shaper_id = &shared_shaper_id[8],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[8]) ? 1
> : 0,
> +				(params->shared_shaper_id.tc_valid[8]) ? 1 :
> 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -721,7 +721,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[9],
>  			.shared_shaper_id = &shared_shaper_id[9],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[9]) ? 1
> : 0,
> +				(params->shared_shaper_id.tc_valid[9]) ? 1 :
> 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -731,7 +731,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[10],
>  			.shared_shaper_id = &shared_shaper_id[10],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[10]) ?
> 1 : 0,
> +				(params->shared_shaper_id.tc_valid[10]) ? 1
> : 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -741,7 +741,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[11],
>  			.shared_shaper_id = &shared_shaper_id[11],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[11]) ?
> 1 : 0,
> +				(params->shared_shaper_id.tc_valid[11]) ? 1
> : 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> @@ -751,7 +751,7 @@ tmgr_hierarchy_default(struct pmd_internals
> *softnic,
>  			.shaper_profile_id = params-
> >shaper_profile_id.tc[12],
>  			.shared_shaper_id = &shared_shaper_id[12],
>  			.n_shared_shapers =
> -				(&params->shared_shaper_id.tc_valid[12]) ?
> 1 : 0,
> +				(params->shared_shaper_id.tc_valid[12]) ? 1
> : 0,
>  			.nonleaf = {
>  				.n_sp_priorities = 1,
>  			},
> --
> 2.31.1


Thanks, Ferruh.

Ached-by: Jasvinder Singh <jasvinder.singh@intel.com>


  reply	other threads:[~2021-10-13 15:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04 17:27 Ferruh Yigit
2021-10-13 15:54 ` Singh, Jasvinder [this message]
2021-10-13 21:45   ` 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=BN9PR11MB52584C846100C93C8EE48681E0B79@BN9PR11MB5258.namprd11.prod.outlook.com \
    --to=jasvinder.singh@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@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).