From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1.sandvine.com (Mail1.sandvine.com [64.7.137.134]) by dpdk.org (Postfix) with ESMTP id 3E5931B295 for ; Wed, 14 Feb 2018 13:00:29 +0100 (CET) Received: from WTL-EXCHSV1-1.sandvine.com (192.168.196.60) by WTL-EXCHSV2-1.sandvine.com (192.168.194.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Wed, 14 Feb 2018 07:00:26 -0500 Received: from WTL-EXCHSV2-1.sandvine.com (192.168.194.58) by WTL-EXCHSV1-1.sandvine.com (192.168.196.60) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Wed, 14 Feb 2018 07:00:26 -0500 Received: from BLR-EXCHSV1-2.sandvine.com (10.30.4.75) by WTL-EXCHSV2-1.sandvine.com (192.168.194.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26 via Frontend Transport; Wed, 14 Feb 2018 07:00:26 -0500 Received: from blr-exchsv1-1.sandvine.com (10.30.4.73) by BLR-EXCHSV1-2.sandvine.com (10.30.4.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Wed, 14 Feb 2018 17:30:21 +0530 Received: from blr-exchsv1-1.sandvine.com ([fe80::8cb6:e09c:f011:98f6]) by blr-exchsv1-1.sandvine.com ([fe80::8cb6:e09c:f011:98f6%24]) with mapi id 15.01.1034.026; Wed, 14 Feb 2018 17:30:21 +0530 From: Tushar Mulkar To: "Zhang, Helin" , "dev@dpdk.org" CC: "Xing, Beilei" , "Zhang, Qi Z" Thread-Topic: [PATCH v2] net/i40e: fix link_state update for i40e_ethdev_vf drv Thread-Index: AQHTpYrgIRh/5+Xo3E2D0Xa0Z1IJnKOjyr+Q Date: Wed, 14 Feb 2018 12:00:21 +0000 Message-ID: References: <20180214115630.136681-1-tmulkar@sandvine.com> In-Reply-To: <20180214115630.136681-1-tmulkar@sandvine.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.30.10.127] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-C2ProcessedOrg: b2f06e69-072f-40ee-90c5-80a34e700794 Subject: [dpdk-dev] [PATCH v2] net/i40e: fix link_state update for i40e_ethdev_vf drv X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 12:00:29 -0000 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 ju= st need to account LSB form the bool value . This can be easily done by and= ing the value with true. Signed-off-by: Tushar Mulkar --- 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_ethd= ev_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 =3D ETH_LINK_FULL_DUPLEX; - new_link.link_status =3D vf->link_up ? ETH_LINK_UP : - ETH_LINK_DOWN; + new_link.link_status =3D (vf->link_up & true) ?=20 + ETH_LINK_UP : ETH_LINK_DOWN; new_link.link_autoneg =3D dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED; =20 -- 2.11.0