All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/i40e: fix assignment of enum values
@ 2017-09-22 12:36 Michal Jastrzebski
  2017-09-22 16:48 ` [dpdk-stable] " Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Jastrzebski @ 2017-09-22 12:36 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing; +Cc: dev, deepak.k.jain, Tomasz Kulasek, stable

From: Tomasz Kulasek <tomaszx.kulasek@intel.com>

mixed_enums: Mixing enum types enum i40e_vsi_type and enum
             virtchnl_vsi_type for type

Coverity issue 158651
Fixes: a58860f68929 ("net/i40e/base: use new virtchnl header file")
Cc: jingjing.wu@intel.com
Cc: stable@dpdk.org

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 73c315a..a8d2740 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1295,7 +1295,15 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
 	if (hw->mac.type == I40E_MAC_X722_VF)
 		vf->flags = I40E_FLAG_RSS_AQ_CAPABLE;
 	vf->vsi.vsi_id = vf->vsi_res->vsi_id;
-	vf->vsi.type = (enum i40e_vsi_type)vf->vsi_res->vsi_type;
+
+	switch (vf->vsi_res->vsi_type) {
+	case VIRTCHNL_VSI_SRIOV:
+		vf->vsi.type = I40E_VSI_SRIOV;
+		break;
+	default:
+		vf->vsi.type = I40E_VSI_TYPE_UNKNOWN;
+		break;
+	}
 	vf->vsi.nb_qps = vf->vsi_res->num_queue_pairs;
 	vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
-- 
1.9.1

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

* Re: [dpdk-stable] [PATCH] net/i40e: fix assignment of enum values
  2017-09-22 12:36 [PATCH] net/i40e: fix assignment of enum values Michal Jastrzebski
@ 2017-09-22 16:48 ` Ferruh Yigit
  2017-09-23  2:05   ` Wu, Jingjing
  0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2017-09-22 16:48 UTC (permalink / raw)
  To: Michal Jastrzebski, jingjing.wu, beilei.xing
  Cc: dev, deepak.k.jain, Tomasz Kulasek, stable

On 9/22/2017 1:36 PM, Michal Jastrzebski wrote:
> From: Tomasz Kulasek <tomaszx.kulasek@intel.com>
> 
> mixed_enums: Mixing enum types enum i40e_vsi_type and enum
>              virtchnl_vsi_type for type
> 
> Coverity issue 158651
> Fixes: a58860f68929 ("net/i40e/base: use new virtchnl header file")
> Cc: jingjing.wu@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
> index 73c315a..a8d2740 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -1295,7 +1295,15 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
>  	if (hw->mac.type == I40E_MAC_X722_VF)
>  		vf->flags = I40E_FLAG_RSS_AQ_CAPABLE;
>  	vf->vsi.vsi_id = vf->vsi_res->vsi_id;
> -	vf->vsi.type = (enum i40e_vsi_type)vf->vsi_res->vsi_type;
> +
> +	switch (vf->vsi_res->vsi_type) {
> +	case VIRTCHNL_VSI_SRIOV:
> +		vf->vsi.type = I40E_VSI_SRIOV;
> +		break;
> +	default:
> +		vf->vsi.type = I40E_VSI_TYPE_UNKNOWN;

This changes the behavior.

Previously:
vsi_type == VIRTCHNL_VSI_TYPE_INVALID ?  type = I40E_VSI_MAIN

Now:
vsi_type == VIRTCHNL_VSI_TYPE_INVALID ?  type = I40E_VSI_TYPE_UNKNOWN

> +		break;
> +	}
>  	vf->vsi.nb_qps = vf->vsi_res->num_queue_pairs;
>  	vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
>  
> 

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

* Re: [dpdk-stable] [PATCH] net/i40e: fix assignment of enum values
  2017-09-22 16:48 ` [dpdk-stable] " Ferruh Yigit
@ 2017-09-23  2:05   ` Wu, Jingjing
  2017-09-25 13:08     ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Wu, Jingjing @ 2017-09-23  2:05 UTC (permalink / raw)
  To: Yigit, Ferruh, Jastrzebski, MichalX K, Xing, Beilei
  Cc: dev, Jain, Deepak K, Kulasek, TomaszX, stable



> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Saturday, September 23, 2017 12:48 AM
> To: Jastrzebski, MichalX K <michalx.k.jastrzebski@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Jain, Deepak K <deepak.k.jain@intel.com>; Kulasek, TomaszX
> <tomaszx.kulasek@intel.com>; stable@dpdk.org
> Subject: Re: [dpdk-stable] [PATCH] net/i40e: fix assignment of enum values
> 
> On 9/22/2017 1:36 PM, Michal Jastrzebski wrote:
> > From: Tomasz Kulasek <tomaszx.kulasek@intel.com>
> >
> > mixed_enums: Mixing enum types enum i40e_vsi_type and enum
> >              virtchnl_vsi_type for type
> >
> > Coverity issue 158651
> > Fixes: a58860f68929 ("net/i40e/base: use new virtchnl header file")
> > Cc: jingjing.wu@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
> > ---
> >  drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
> > index 73c315a..a8d2740 100644
> > --- a/drivers/net/i40e/i40e_ethdev_vf.c
> > +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> > @@ -1295,7 +1295,15 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
> >  	if (hw->mac.type == I40E_MAC_X722_VF)
> >  		vf->flags = I40E_FLAG_RSS_AQ_CAPABLE;
> >  	vf->vsi.vsi_id = vf->vsi_res->vsi_id;
> > -	vf->vsi.type = (enum i40e_vsi_type)vf->vsi_res->vsi_type;
> > +
> > +	switch (vf->vsi_res->vsi_type) {
> > +	case VIRTCHNL_VSI_SRIOV:
> > +		vf->vsi.type = I40E_VSI_SRIOV;
> > +		break;
> > +	default:
> > +		vf->vsi.type = I40E_VSI_TYPE_UNKNOWN;
> 
> This changes the behavior.
> 
> Previously:
> vsi_type == VIRTCHNL_VSI_TYPE_INVALID ?  type = I40E_VSI_MAIN
> 
> Now:
> vsi_type == VIRTCHNL_VSI_TYPE_INVALID ?  type = I40E_VSI_TYPE_UNKNOWN

For vsi_type in VF, only SRIOV type is valid. 
I40E_VSI_MAIN is used for PF Lan vsi, even it doesn't cause error, but 
we need to translate it to correct meaning.

Acked-by: Jingjing Wu <jingjing.wu@intel.com>


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

* Re: [dpdk-stable] [PATCH] net/i40e: fix assignment of enum values
  2017-09-23  2:05   ` Wu, Jingjing
@ 2017-09-25 13:08     ` Ferruh Yigit
  0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2017-09-25 13:08 UTC (permalink / raw)
  To: Wu, Jingjing, Jastrzebski, MichalX K, Xing, Beilei
  Cc: dev, Jain, Deepak K, Kulasek, TomaszX, stable

On 9/23/2017 3:05 AM, Wu, Jingjing wrote:
> 
> 
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Saturday, September 23, 2017 12:48 AM
>> To: Jastrzebski, MichalX K <michalx.k.jastrzebski@intel.com>; Wu, Jingjing
>> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
>> Cc: dev@dpdk.org; Jain, Deepak K <deepak.k.jain@intel.com>; Kulasek, TomaszX
>> <tomaszx.kulasek@intel.com>; stable@dpdk.org
>> Subject: Re: [dpdk-stable] [PATCH] net/i40e: fix assignment of enum values
>>
>> On 9/22/2017 1:36 PM, Michal Jastrzebski wrote:
>>> From: Tomasz Kulasek <tomaszx.kulasek@intel.com>
>>>
>>> mixed_enums: Mixing enum types enum i40e_vsi_type and enum
>>>              virtchnl_vsi_type for type
>>>
>>> Coverity issue 158651
>>> Fixes: a58860f68929 ("net/i40e/base: use new virtchnl header file")
>>> Cc: jingjing.wu@intel.com
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>

> Acked-by: Jingjing Wu <jingjing.wu@intel.com> 

Applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2017-09-25 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-22 12:36 [PATCH] net/i40e: fix assignment of enum values Michal Jastrzebski
2017-09-22 16:48 ` [dpdk-stable] " Ferruh Yigit
2017-09-23  2:05   ` Wu, Jingjing
2017-09-25 13:08     ` Ferruh Yigit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.