Patchwork [net-next,02/12] ixgbe: Fix return value from macvlan filter function

login
register
mail settings
Submitter Jeff Kirsher
Date Oct. 27, 2012, 12:08 a.m.
Message ID <1351296518-31174-3-git-send-email-jeffrey.t.kirsher@intel.com>
Download mbox | patch
Permalink /patch/194580/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Jeff Kirsher - Oct. 27, 2012, 12:08 a.m.
From: Greg Rose <gregory.v.rose@intel.com>

The function to set the macvlan filter should return success or failure
instead of the index of the filter.  The message processing function was
misinterpreting the index as a non-zero return code indicating failure and
NACKing MAC filter set messages that actually succeeded.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Robert Garrett <robertx.e.garrett@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Konstantin Stepanyuk - Oct. 27, 2012, 6:36 p.m.
On Fri, Oct 26, 2012 at 6:08 PM, Jeff Kirsher
<jeffrey.t.kirsher@intel.com> wrote:
> From: Greg Rose <gregory.v.rose@intel.com>
>
> The function to set the macvlan filter should return success or failure
> instead of the index of the filter.  The message processing function was
> misinterpreting the index as a non-zero return code indicating failure and
> NACKing MAC filter set messages that actually succeeded.
>
> Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
> Tested-by: Robert Garrett <robertx.e.garrett@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> index 96876b7..b68bf0f 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> @@ -742,7 +742,8 @@ static int ixgbe_set_vf_macvlan_msg(struct ixgbe_adapter *adapter,
>                 e_warn(drv,
>                        "VF %d has requested a MACVLAN filter but there is no space for it\n",
>                        vf);
> -       return err;
> +
> +       return !!err < 0;
This expression always resolves to false, either 0 < 0 or 1 < 0,
because '!' has higher precedence than '<'.

Thanks,
Konstantin
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rose, Gregory V - Oct. 29, 2012, 4:27 p.m.
> -----Original Message-----

> From: Konstantin Stepanyuk [mailto:konstantin.stepanyuk@gmail.com]

> Sent: Saturday, October 27, 2012 11:37 AM

> To: Kirsher, Jeffrey T

> Cc: davem@davemloft.net; Rose, Gregory V; netdev@vger.kernel.org;

> gospo@redhat.com; sassmann@redhat.com

> Subject: Re: [net-next 02/12] ixgbe: Fix return value from macvlan filter

> function

> 

> On Fri, Oct 26, 2012 at 6:08 PM, Jeff Kirsher

> <jeffrey.t.kirsher@intel.com> wrote:

> > From: Greg Rose <gregory.v.rose@intel.com>

> >

> > The function to set the macvlan filter should return success or

> > failure instead of the index of the filter.  The message processing

> > function was misinterpreting the index as a non-zero return code

> > indicating failure and NACKing MAC filter set messages that actually

> succeeded.

> >

> > Signed-off-by: Greg Rose <gregory.v.rose@intel.com>

> > Tested-by: Robert Garrett <robertx.e.garrett@intel.com>

> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

> > ---

> >  drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 3 ++-

> >  1 file changed, 2 insertions(+), 1 deletion(-)

> >

> > diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

> > b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

> > index 96876b7..b68bf0f 100644

> > --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

> > +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

> > @@ -742,7 +742,8 @@ static int ixgbe_set_vf_macvlan_msg(struct

> ixgbe_adapter *adapter,

> >                 e_warn(drv,

> >                        "VF %d has requested a MACVLAN filter but there

> is no space for it\n",

> >                        vf);

> > -       return err;

> > +

> > +       return !!err < 0;

> This expression always resolves to false, either 0 < 0 or 1 < 0, because

> '!' has higher precedence than '<'.


It's a typo.  I'll fix it.

- Greg

> 

> Thanks,

> Konstantin

Patch

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 96876b7..b68bf0f 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -742,7 +742,8 @@  static int ixgbe_set_vf_macvlan_msg(struct ixgbe_adapter *adapter,
 		e_warn(drv,
 		       "VF %d has requested a MACVLAN filter but there is no space for it\n",
 		       vf);
-	return err;
+
+	return !!err < 0;
 }
 
 static int ixgbe_negotiate_vf_api(struct ixgbe_adapter *adapter,