[dpdk-dev] [PATCH v2] net/i40e: fix link_state update for i40e_ethdev_vf drv
Rybalchenko, Kirill
kirill.rybalchenko at intel.com
Wed Mar 14 15:22:17 CET 2018
Hi,
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Tushar Mulkar
> Sent: Wednesday 14 February 2018 12:00
> To: Zhang, Helin <helin.zhang at intel.com>; dev at dpdk.org
> Cc: Xing, Beilei <beilei.xing at intel.com>; Zhang, Qi Z <qi.z.zhang at intel.com>
> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix link_state update for
> i40e_ethdev_vf drv
>
> 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.
I didn't find any place where link_up is assigned to something other than Boolean.
But maybe I'm wrong or I misunderstood what you're saying.
And there is another place in this file with similar evaluation in i40evf_read_pfmsg() function.
Format of commit message should be modified as well - it is formatted in one long line
without line breaks.
>
> Signed-off-by: Tushar Mulkar <tmulkar at 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
More information about the dev
mailing list