From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <michalx.k.jastrzebski@intel.com>
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by dpdk.org (Postfix) with ESMTP id 00087B54A
 for <dev@dpdk.org>; Fri, 20 Feb 2015 10:08:59 +0100 (CET)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by orsmga103.jf.intel.com with ESMTP; 20 Feb 2015 01:03:30 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.09,613,1418112000"; d="scan'208";a="669019913"
Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66])
 by fmsmga001.fm.intel.com with ESMTP; 20 Feb 2015 01:08:49 -0800
Received: from irsmsx109.ger.corp.intel.com ([169.254.13.103]) by
 IRSMSX152.ger.corp.intel.com ([169.254.6.205]) with mapi id 14.03.0195.001;
 Fri, 20 Feb 2015 09:08:48 +0000
From: "Jastrzebski, MichalX K" <michalx.k.jastrzebski@intel.com>
To: "Qiu, Michael" <michael.qiu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH v2] testpmd check return value of
 rte_eth_dev_vlan_filter()
Thread-Index: AQHQOlWONzXA3DdUckeUcFfEuAkeAJz5Wy9w
Date: Fri, 20 Feb 2015 09:08:48 +0000
Message-ID: <60ABE07DBB3A454EB7FAD707B4BB1582138EAEE4@IRSMSX109.ger.corp.intel.com>
References: <1422379175-10004-1-git-send-email-michalx.k.jastrzebski@intel.com>
 <533710CFB86FA344BFBF2D6802E60286CBF07B@shsmsx102.ccr.corp.intel.com>
In-Reply-To: <533710CFB86FA344BFBF2D6802E60286CBF07B@shsmsx102.ccr.corp.intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [163.33.239.182]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v2] testpmd check return value
	of	rte_eth_dev_vlan_filter()
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Feb 2015 09:09:01 -0000

> -----Original Message-----
> From: Qiu, Michael
> Sent: Wednesday, January 28, 2015 2:38 AM
> To: Jastrzebski, MichalX K; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] testpmd check return value of
> rte_eth_dev_vlan_filter()
>=20
> On 1/28/2015 1:20 AM, Michal Jastrzebski wrote:
> > This patch modifies testpmd behavior when setting:
> > rx_vlan add all vf_port (enabling all vlanids
> > to be passed thru rx filter on VF).
> > Rx_vlan_all_filter_set() function,
> > checks if the next vlanid can be enabled by the driver.
> > Number of vlanids is limited by the NIC and thus the NIC
> > do not allow to enable more vlanids than it can allocate
> > in VFTA table.
>=20
> But what about if it is caused by other issue to lead a enable failure?

Hi Michael,
I am sorry I am writing almost a month after you reply
But I had another issues required a 100% attention.

As I see in the function:
rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on);
arguments like port_id and vlan_id are checked.  Also if vlan-filtering
is enabled is checked. Each error is printed so the user is informed that
something went wrong and where to look for it.
I don't know what else could be checked here?

>=20
>=20
> > v2 - fix formatting errors
> >
> > Signed-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
> > ---
> >  app/test-pmd/config.c         |   15 +++++++++------
> >  app/test-pmd/testpmd.h        |    2 +-
> >  lib/librte_ether/rte_ethdev.c |    4 ++--
> >  3 files changed, 12 insertions(+), 9 deletions(-)
> >
> > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> > index c40f819..eda737e 100644
> > --- a/app/test-pmd/config.c
> > +++ b/app/test-pmd/config.c
> > @@ -1643,21 +1643,22 @@ rx_vlan_filter_set(portid_t port_id, int on)
> >  	       "diag=3D%d\n", port_id, on, diag);
> >  }
> >
> > -void
> > +int
> >  rx_vft_set(portid_t port_id, uint16_t vlan_id, int on)
> >  {
> >  	int diag;
> >
> >  	if (port_id_is_invalid(port_id))
> > -		return;
> > +		return 1;
> >  	if (vlan_id_is_invalid(vlan_id))
> > -		return;
> > +		return 1;
> >  	diag =3D rte_eth_dev_vlan_filter(port_id, vlan_id, on);
> >  	if (diag =3D=3D 0)
> > -		return;
> > +		return 0;
> >  	printf("rte_eth_dev_vlan_filter(port_pi=3D%d, vlan_id=3D%d, on=3D%d)
> failed "
> >  	       "diag=3D%d\n",
> >  	       port_id, vlan_id, on, diag);
> > +	return -1;
> >  }
> >
> >  void
> > @@ -1667,8 +1668,10 @@ rx_vlan_all_filter_set(portid_t port_id, int on)
> >
> >  	if (port_id_is_invalid(port_id))
> >  		return;
> > -	for (vlan_id =3D 0; vlan_id < 4096; vlan_id++)
> > -		rx_vft_set(port_id, vlan_id, on);
> > +	for (vlan_id =3D 0; vlan_id < 4096; vlan_id++)	{
>=20
> Before "{" you use a Tab? One white space is OK.
>=20
> Thanks,
> Michael
>=20
> > +		if (rx_vft_set(port_id, vlan_id, on))
> > +			break;
> > +	}
> >  }
> >
> >  void
> > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> > index 8f5e6c7..e0186b9 100644
> > --- a/app/test-pmd/testpmd.h
> > +++ b/app/test-pmd/testpmd.h
> > @@ -492,7 +492,7 @@ void rx_vlan_strip_set_on_queue(portid_t port_id,
> uint16_t queue_id, int on);
> >
> >  void rx_vlan_filter_set(portid_t port_id, int on);
> >  void rx_vlan_all_filter_set(portid_t port_id, int on);
> > -void rx_vft_set(portid_t port_id, uint16_t vlan_id, int on);
> > +int rx_vft_set(portid_t port_id, uint16_t vlan_id, int on);
> >  void vlan_extend_set(portid_t port_id, int on);
> >  void vlan_tpid_set(portid_t port_id, uint16_t tp_id);
> >  void tx_vlan_set(portid_t port_id, uint16_t vlan_id);
> > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethde=
v.c
> > index ea3a1fb..064b5d6 100644
> > --- a/lib/librte_ether/rte_ethdev.c
> > +++ b/lib/librte_ether/rte_ethdev.c
> > @@ -1519,8 +1519,8 @@ rte_eth_dev_vlan_filter(uint8_t port_id,
> uint16_t vlan_id, int on)
> >  		return (-EINVAL);
> >  	}
> >  	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -
> ENOTSUP);
> > -	(*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
> > -	return (0);
> > +
> > +	return (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
> >  }
> >
> >  int