DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tushar Mulkar <tmulkar@sandvine.com>
To: "Zhang, Helin" <helin.zhang@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Xing, Beilei" <beilei.xing@intel.com>,
	"Zhang, Qi Z" <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix link_state update for i40e_ethdev_vf drv
Date: Wed, 14 Feb 2018 12:00:21 +0000	[thread overview]
Message-ID: <d3535e69b45a4139bb322a0ba8383479@sandvine.com> (raw)
In-Reply-To: <20180214115630.136681-1-tmulkar@sandvine.com>

The check for bool was accounting unwanted bits in the calulation of truth value. In dpdk unsingned int is typedefed to bool but all it cares about is Least Significant Bit. But in calculation of condition expression the bits other than LSB was used which doesn't make sense. Some time these bits has values which results in to incorrect expression results. To fix this we just need to account LSB form the bool value . This can be easily done by anding the value with true.

Signed-off-by: Tushar Mulkar <tmulkar@sandvine.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index b96d77a0c..d23dff044 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2095,8 +2095,8 @@ i40evf_dev_link_update(struct rte_eth_dev *dev,
 	}
 	/* full duplex only */
 	new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
-	new_link.link_status = vf->link_up ? ETH_LINK_UP :
-					     ETH_LINK_DOWN;
+	new_link.link_status = (vf->link_up & true) ? 
+                            ETH_LINK_UP : ETH_LINK_DOWN;
 	new_link.link_autoneg =
 		dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED;
 
--
2.11.0

       reply	other threads:[~2018-02-14 12:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <B100BEBE3931D74C91B0DFE67C1055F9035BC999>
     [not found] ` <20180214115630.136681-1-tmulkar@sandvine.com>
2018-02-14 12:00   ` Tushar Mulkar [this message]
2018-03-14 14:22     ` Rybalchenko, Kirill
2018-03-27 16:29     ` Zhang, Helin
2018-03-30  3:07       ` Zhang, Helin

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=d3535e69b45a4139bb322a0ba8383479@sandvine.com \
    --to=tmulkar@sandvine.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=qi.z.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).