DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eventdev: fix dequeue timeout bitmask brackets
@ 2017-04-14 16:04 Harry van Haaren
  2017-04-15  4:58 ` Jerin Jacob
  0 siblings, 1 reply; 3+ messages in thread
From: Harry van Haaren @ 2017-04-14 16:04 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, Harry van Haaren

Fix brackets around the & operator to first mask a single bit
and then perform the not operator. Previously the result was
not as expected, due to the ! operator being performed first.

As noted on list[1] Clang 4.0 warns about a possible bug for
this type of line:
	if (!variable & FLAG) {

Fixes: 4f0804bbdfb9 ("eventdev: implement the northbound APIs")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

[1] http://dpdk.org/ml/archives/dev/2017-April/064089.html
---
 lib/librte_eventdev/rte_eventdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index 8042988..a64071e 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -368,7 +368,8 @@ rte_event_dev_configure(uint8_t dev_id,
 	(*dev->dev_ops->dev_infos_get)(dev, &info);
 
 	/* Check dequeue_timeout_ns value is in limit */
-	if (!dev_conf->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT) {
+	if (!(dev_conf->event_dev_cfg &
+				RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT)) {
 		if (dev_conf->dequeue_timeout_ns < info.min_dequeue_timeout_ns
 			|| dev_conf->dequeue_timeout_ns >
 				 info.max_dequeue_timeout_ns) {
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] eventdev: fix dequeue timeout bitmask brackets
  2017-04-14 16:04 [dpdk-dev] [PATCH] eventdev: fix dequeue timeout bitmask brackets Harry van Haaren
@ 2017-04-15  4:58 ` Jerin Jacob
  2017-04-19 22:21   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Jerin Jacob @ 2017-04-15  4:58 UTC (permalink / raw)
  To: Harry van Haaren; +Cc: dev

-----Original Message-----
> Date: Fri, 14 Apr 2017 17:04:58 +0100
> From: Harry van Haaren <harry.van.haaren@intel.com>
> To: dev@dpdk.org
> CC: jerin.jacob@caviumnetworks.com, Harry van Haaren
>  <harry.van.haaren@intel.com>
> Subject: [PATCH] eventdev: fix dequeue timeout bitmask brackets
> X-Mailer: git-send-email 2.7.4
> 
> Fix brackets around the & operator to first mask a single bit
> and then perform the not operator. Previously the result was
> not as expected, due to the ! operator being performed first.
> 
> As noted on list[1] Clang 4.0 warns about a possible bug for
> this type of line:
> 	if (!variable & FLAG) {
> 
> Fixes: 4f0804bbdfb9 ("eventdev: implement the northbound APIs")
> 
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> 
> [1] http://dpdk.org/ml/archives/dev/2017-April/064089.html
> ---
>  lib/librte_eventdev/rte_eventdev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
> index 8042988..a64071e 100644
> --- a/lib/librte_eventdev/rte_eventdev.c
> +++ b/lib/librte_eventdev/rte_eventdev.c
> @@ -368,7 +368,8 @@ rte_event_dev_configure(uint8_t dev_id,
>  	(*dev->dev_ops->dev_infos_get)(dev, &info);
>  
>  	/* Check dequeue_timeout_ns value is in limit */
> -	if (!dev_conf->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT) {
> +	if (!(dev_conf->event_dev_cfg &
> +				RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT)) {
>  		if (dev_conf->dequeue_timeout_ns < info.min_dequeue_timeout_ns
>  			|| dev_conf->dequeue_timeout_ns >
>  				 info.max_dequeue_timeout_ns) {
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] eventdev: fix dequeue timeout bitmask brackets
  2017-04-15  4:58 ` Jerin Jacob
@ 2017-04-19 22:21   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2017-04-19 22:21 UTC (permalink / raw)
  To: Harry van Haaren; +Cc: dev, Jerin Jacob, ferruh.yigit

> > Fix brackets around the & operator to first mask a single bit
> > and then perform the not operator. Previously the result was
> > not as expected, due to the ! operator being performed first.
> > 
> > As noted on list[1] Clang 4.0 warns about a possible bug for
> > 
> > this type of line:
> > 	if (!variable & FLAG) {
> > 
> > Fixes: 4f0804bbdfb9 ("eventdev: implement the northbound APIs")
> > 
> > Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> 
> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

A similar patch has been applied, sorry:
	http://dpdk.org/commit/27e9fb84

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-19 22:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14 16:04 [dpdk-dev] [PATCH] eventdev: fix dequeue timeout bitmask brackets Harry van Haaren
2017-04-15  4:58 ` Jerin Jacob
2017-04-19 22:21   ` Thomas Monjalon

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).