Message ID | 1476818007-13659-1-git-send-email-daniels@research.att.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Bruce Richardson |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id B72CE68F8; Tue, 18 Oct 2016 21:14:03 +0200 (CEST) Received: from mx0a-00191d01.pphosted.com (mx0a-00191d01.pphosted.com [67.231.149.140]) by dpdk.org (Postfix) with ESMTP id 6F1705A33 for <dev@dpdk.org>; Tue, 18 Oct 2016 21:14:02 +0200 (CEST) Received: from pps.filterd (m0053301.ppops.net [127.0.0.1]) by mx0a-00191d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9IJ5gNm046337; Tue, 18 Oct 2016 15:14:01 -0400 Received: from alpi155.enaf.aldc.att.com (sbcsmtp7.sbc.com [144.160.229.24]) by mx0a-00191d01.pphosted.com with ESMTP id 265s6na477-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Oct 2016 15:14:01 -0400 Received: from enaf.aldc.att.com (localhost [127.0.0.1]) by alpi155.enaf.aldc.att.com (8.14.5/8.14.5) with ESMTP id u9IJDxC8021739; Tue, 18 Oct 2016 15:14:00 -0400 Received: from mlpi409.sfdc.sbc.com (mlpi409.sfdc.sbc.com [130.9.128.241]) by alpi155.enaf.aldc.att.com (8.14.5/8.14.5) with ESMTP id u9IJDo53021531 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 18 Oct 2016 15:13:53 -0400 Received: from clpi183.sldc.sbc.com (clpi183.sldc.sbc.com [135.41.1.46]) by mlpi409.sfdc.sbc.com (RSA Interceptor); Tue, 18 Oct 2016 19:13:38 GMT Received: from sldc.sbc.com (localhost [127.0.0.1]) by clpi183.sldc.sbc.com (8.14.5/8.14.5) with ESMTP id u9IJDcpX031357; Tue, 18 Oct 2016 14:13:38 -0500 Received: from mail-green.research.att.com (mail-green.research.att.com [135.207.255.15]) by clpi183.sldc.sbc.com (8.14.5/8.14.5) with ESMTP id u9IJDWUn031019; Tue, 18 Oct 2016 14:13:32 -0500 Received: from cheetah.research.att.com (mt-230-10.research.att.com [135.207.230.10]) by mail-green.research.att.com (Postfix) with ESMTP id E0EABE0767; Tue, 18 Oct 2016 15:13:22 -0400 (EDT) From: "E. Scott Daniels" <daniels@research.att.com> To: helin.zhang@intel.com, bernard.iremonger@intel.com Cc: dev@dpdk.org, az5157@att.com, "E. Scott Daniels" <daniels@research.att.com> Date: Tue, 18 Oct 2016 15:13:27 -0400 Message-Id: <1476818007-13659-1-git-send-email-daniels@research.att.com> X-Mailer: git-send-email 2.1.4 X-RSA-Inspected: yes X-RSA-Classifications: public X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-18_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_policy_notspam policy=outbound_policy score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610180315 Subject: [dpdk-dev] [PATCH] net/ixgbe: fix vlan insert parameter type and its use 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> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Scott Daniels
Oct. 18, 2016, 7:13 p.m. UTC
The final parameter to rte_pmd_ixgbe_set_vf_vlan_insert is uint8_t
and treated as a binary flag when it needs to be a uint16_t
and treated as a VLAN id. The data sheet (sect 8.2.3.27.13) describes
the right most 16 bits as the VLAN id that is to be inserted; the
16.11 code is accepting only a 1 or 0 thus effectively only
allowing the VLAN id 1 to be inserted (0 disables the insertion
setting).
This patch changes the final parm name to represent the data that
is being accepted (vlan_id), changes the type to permit all valid
VLAN ids, and validates the parameter based on the range of 0 to
4095. Corresponding changes to prototype and documentation in the
.h file.
Fixes: 49e248223e9f71 ("net/ixgbe: add API for VF management")
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
---
drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++----
drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +++++----
2 files changed, 9 insertions(+), 8 deletions(-)
Comments
Hi Daniels, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of E. Scott Daniels > Sent: Wednesday, October 19, 2016 3:13 AM > To: Zhang, Helin; Iremonger, Bernard > Cc: dev@dpdk.org; az5157@att.com; E. Scott Daniels > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix vlan insert parameter type and its use > > The final parameter to rte_pmd_ixgbe_set_vf_vlan_insert is uint8_t and treated > as a binary flag when it needs to be a uint16_t and treated as a VLAN id. The > data sheet (sect 8.2.3.27.13) describes the right most 16 bits as the VLAN id that > is to be inserted; the > 16.11 code is accepting only a 1 or 0 thus effectively only allowing the VLAN id 1 > to be inserted (0 disables the insertion setting). > > This patch changes the final parm name to represent the data that is being > accepted (vlan_id), changes the type to permit all valid VLAN ids, and validates > the parameter based on the range of 0 to 4095. Corresponding changes to > prototype and documentation in the .h file. > > Fixes: 49e248223e9f71 ("net/ixgbe: add API for VF management") > > Signed-off-by: E. Scott Daniels <daniels@research.att.com> > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++---- > drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +++++---- > 2 files changed, 9 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c > index 4ca5747..316af73 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -4727,7 +4727,7 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, > uint16_t vf, uint8_t on) } > > int > -rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on) > +rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t > +vlan_id) > { > struct ixgbe_hw *hw; > uint32_t ctrl; > @@ -4742,13 +4742,13 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, > uint16_t vf, uint8_t on) > if (vf >= dev_info.max_vfs) > return -EINVAL; > > - if (on > 1) > + if (vlan_id > 4095) > return -EINVAL; > > hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf)); > - if (on) { > - ctrl = on; > + if (vlan_id) { > + ctrl = vlan_id; I believe this patch is a good idea of an enhancement. But you cannot leverage the existing code like this. The register IXGBE_VMVIR is only for enable/disable. We cannot write the VLAN ID into it. If you want to merge the 2 things, enabling/disabling and setting VLAN ID together. I think we need a totally new implementation. So NACK. > ctrl |= IXGBE_VMVIR_VLANA_DEFAULT; > } else { > ctrl = 0; > diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h > b/drivers/net/ixgbe/rte_pmd_ixgbe.h > index 2fdf530..c2fb826 100644 > --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h > +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h > @@ -99,16 +99,17 @@ int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, > uint16_t vf, uint8_t on); > * The port identifier of the Ethernet device. > * @param vf > * ID specifying VF. > - * @param on > - * 1 - Enable VF's vlan insert. > - * 0 - Disable VF's vlan insert > + * @param vlan_id > + * 0 - Disable VF's vlan insert. > + * n - Enable; n is inserted as the vlan id. > * > * @return > * - (0) if successful. > * - (-ENODEV) if *port* invalid. > * - (-EINVAL) if bad parameter. > */ > -int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on); > +int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, > + uint16_t vlan_id); > > /** > * Enable/Disable tx loopback > -- > 1.9.1
Hi Wenzhuo, Scott, <snip> > > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix vlan insert parameter type > > and its use > > > > The final parameter to rte_pmd_ixgbe_set_vf_vlan_insert is uint8_t and > > treated as a binary flag when it needs to be a uint16_t and treated as > > a VLAN id. The data sheet (sect 8.2.3.27.13) describes the right most > > 16 bits as the VLAN id that is to be inserted; the > > 16.11 code is accepting only a 1 or 0 thus effectively only allowing > > the VLAN id 1 to be inserted (0 disables the insertion setting). > > > > This patch changes the final parm name to represent the data that is > > being accepted (vlan_id), changes the type to permit all valid VLAN > > ids, and validates the parameter based on the range of 0 to 4095. > > Corresponding changes to prototype and documentation in the .h file. > > > > Fixes: 49e248223e9f71 ("net/ixgbe: add API for VF management") > > > > Signed-off-by: E. Scott Daniels <daniels@research.att.com> > > --- > > drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++---- > > drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +++++---- > > 2 files changed, 9 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index 4ca5747..316af73 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -4727,7 +4727,7 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t > > port, uint16_t vf, uint8_t on) } > > > > int > > -rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t > > on) > > +rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t > > +vlan_id) > > { > > struct ixgbe_hw *hw; > > uint32_t ctrl; > > @@ -4742,13 +4742,13 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t > port, > > uint16_t vf, uint8_t on) > > if (vf >= dev_info.max_vfs) > > return -EINVAL; > > > > - if (on > 1) > > + if (vlan_id > 4095) > > return -EINVAL; > > > > hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf)); > > - if (on) { > > - ctrl = on; > > + if (vlan_id) { > > + ctrl = vlan_id; > I believe this patch is a good idea of an enhancement. But you cannot > leverage the existing code like this. > The register IXGBE_VMVIR is only for enable/disable. We cannot write the > VLAN ID into it. > If you want to merge the 2 things, enabling/disabling and setting VLAN ID > together. I think we need a totally new implementation. So NACK. Reading the 82599 data sheet (sect 8.2.3.27.13), the change from Scott is correct. The NACK is not correct. However changing the API means that where it is called needs to be changed too. It is called at present from app/testpmd/cmdline.c line 4731. > > ctrl |= IXGBE_VMVIR_VLANA_DEFAULT; > > } else { > > ctrl = 0; > > diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h > > b/drivers/net/ixgbe/rte_pmd_ixgbe.h > > index 2fdf530..c2fb826 100644 > > --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h > > +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h > > @@ -99,16 +99,17 @@ int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t > > port, uint16_t vf, uint8_t on); > > * The port identifier of the Ethernet device. > > * @param vf > > * ID specifying VF. > > - * @param on > > - * 1 - Enable VF's vlan insert. > > - * 0 - Disable VF's vlan insert > > + * @param vlan_id > > + * 0 - Disable VF's vlan insert. > > + * n - Enable; n is inserted as the vlan id. > > * > > * @return > > * - (0) if successful. > > * - (-ENODEV) if *port* invalid. > > * - (-EINVAL) if bad parameter. > > */ > > -int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, > > uint8_t on); > > +int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, > > + uint16_t vlan_id); > > > > /** > > * Enable/Disable tx loopback > > -- > > 1.9.1 Regards, Bernard.
------------------------------------------------------------------------ E. Scott Daniels PMTS - Cloud Software Research AT&T Labs - Research daniels@research.att.com 440.389.0011 On Wed, 19 Oct 2016, Lu, Wenzhuo wrote: > Hi Daniels, > > >> -----Original Message----- >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of E. Scott Daniels >> Sent: Wednesday, October 19, 2016 3:13 AM >> To: Zhang, Helin; Iremonger, Bernard >> Cc: dev@dpdk.org; az5157@att.com; E. Scott Daniels >> Subject: [dpdk-dev] [PATCH] net/ixgbe: fix vlan insert parameter type and its use >> >> The final parameter to rte_pmd_ixgbe_set_vf_vlan_insert is uint8_t and treated >> as a binary flag when it needs to be a uint16_t and treated as a VLAN id. The >> data sheet (sect 8.2.3.27.13) describes the right most 16 bits as the VLAN id that >> is to be inserted; the >> 16.11 code is accepting only a 1 or 0 thus effectively only allowing the VLAN id 1 >> to be inserted (0 disables the insertion setting). >> >> This patch changes the final parm name to represent the data that is being >> accepted (vlan_id), changes the type to permit all valid VLAN ids, and validates >> the parameter based on the range of 0 to 4095. Corresponding changes to >> prototype and documentation in the .h file. >> >> Fixes: 49e248223e9f71 ("net/ixgbe: add API for VF management") >> >> Signed-off-by: E. Scott Daniels <daniels@research.att.com> >> --- >> drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++---- >> drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +++++---- >> 2 files changed, 9 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c >> index 4ca5747..316af73 100644 >> --- a/drivers/net/ixgbe/ixgbe_ethdev.c >> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c >> @@ -4727,7 +4727,7 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, >> uint16_t vf, uint8_t on) } >> >> int >> -rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on) >> +rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t >> +vlan_id) >> { >> struct ixgbe_hw *hw; >> uint32_t ctrl; >> @@ -4742,13 +4742,13 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, >> uint16_t vf, uint8_t on) >> if (vf >= dev_info.max_vfs) >> return -EINVAL; >> >> - if (on > 1) >> + if (vlan_id > 4095) >> return -EINVAL; >> >> hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); >> ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf)); >> - if (on) { >> - ctrl = on; >> + if (vlan_id) { >> + ctrl = vlan_id; > I believe this patch is a good idea of an enhancement. But you cannot leverage the existing code like this. > The register IXGBE_VMVIR is only for enable/disable. We cannot write the VLAN ID into it. > If you want to merge the 2 things, enabling/disabling and setting VLAN ID together. I think we need a totally new implementation. So NACK. > I'm a bit confused. According to the data sheet (section 8.2.3.27.13) this register accepts the "port VLAN tag to insert if the VLANA field = 01b" in the right most 16 bits. This allows the given tag to be inserted in outgoing packets. The current implementation always sets this bit (via the IXGBE_VMVIR_VLANA_DEFAULT constant) which causes the tag in the right most bits to be inserted. The current code, which I belive is broken, only ever inserts a 1 or 0 into the right most bits as it takes the value passed in and ORs it with the constant, effectively only allowing the VLAN tag of 1 to be inserted. The value passed in is not being used to set/reset the always/never insert VLAN action bit. The only way to insert VLAN tags 2 through 4095 is to modify the code to accept the tag and insert it as described in the patch. Scott >> ctrl |= IXGBE_VMVIR_VLANA_DEFAULT; >> } else { >> ctrl = 0; >> diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h >> b/drivers/net/ixgbe/rte_pmd_ixgbe.h >> index 2fdf530..c2fb826 100644 >> --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h >> +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h >> @@ -99,16 +99,17 @@ int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, >> uint16_t vf, uint8_t on); >> * The port identifier of the Ethernet device. >> * @param vf >> * ID specifying VF. >> - * @param on >> - * 1 - Enable VF's vlan insert. >> - * 0 - Disable VF's vlan insert >> + * @param vlan_id >> + * 0 - Disable VF's vlan insert. >> + * n - Enable; n is inserted as the vlan id. >> * >> * @return >> * - (0) if successful. >> * - (-ENODEV) if *port* invalid. >> * - (-EINVAL) if bad parameter. >> */ >> -int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on); >> +int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, >> + uint16_t vlan_id); >> >> /** >> * Enable/Disable tx loopback >> -- >> 1.9.1 > >
------------------------------------------------------------------------ E. Scott Daniels PMTS - Cloud Software Research AT&T Labs - Research daniels@research.att.com 440.389.0011 On Wed, 19 Oct 2016, Iremonger, Bernard wrote: > Hi Wenzhuo, Scott, > > <snip> > >>> Subject: [dpdk-dev] [PATCH] net/ixgbe: fix vlan insert parameter type >>> and its use >>> >>> The final parameter to rte_pmd_ixgbe_set_vf_vlan_insert is uint8_t and >>> treated as a binary flag when it needs to be a uint16_t and treated as >>> a VLAN id. The data sheet (sect 8.2.3.27.13) describes the right most >>> 16 bits as the VLAN id that is to be inserted; the >>> 16.11 code is accepting only a 1 or 0 thus effectively only allowing >>> the VLAN id 1 to be inserted (0 disables the insertion setting). >>> >>> This patch changes the final parm name to represent the data that is >>> being accepted (vlan_id), changes the type to permit all valid VLAN >>> ids, and validates the parameter based on the range of 0 to 4095. >>> Corresponding changes to prototype and documentation in the .h file. >>> >>> Fixes: 49e248223e9f71 ("net/ixgbe: add API for VF management") >>> >>> Signed-off-by: E. Scott Daniels <daniels@research.att.com> >>> --- >>> drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++---- >>> drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +++++---- >>> 2 files changed, 9 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c >>> b/drivers/net/ixgbe/ixgbe_ethdev.c >>> index 4ca5747..316af73 100644 >>> --- a/drivers/net/ixgbe/ixgbe_ethdev.c >>> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c >>> @@ -4727,7 +4727,7 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t >>> port, uint16_t vf, uint8_t on) } >>> >>> int >>> -rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t >>> on) >>> +rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t >>> +vlan_id) >>> { >>> struct ixgbe_hw *hw; >>> uint32_t ctrl; >>> @@ -4742,13 +4742,13 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t >> port, >>> uint16_t vf, uint8_t on) >>> if (vf >= dev_info.max_vfs) >>> return -EINVAL; >>> >>> - if (on > 1) >>> + if (vlan_id > 4095) >>> return -EINVAL; >>> >>> hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); >>> ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf)); >>> - if (on) { >>> - ctrl = on; >>> + if (vlan_id) { >>> + ctrl = vlan_id; >> I believe this patch is a good idea of an enhancement. But you cannot >> leverage the existing code like this. >> The register IXGBE_VMVIR is only for enable/disable. We cannot write the >> VLAN ID into it. >> If you want to merge the 2 things, enabling/disabling and setting VLAN ID >> together. I think we need a totally new implementation. So NACK. > > Reading the 82599 data sheet (sect 8.2.3.27.13), the change from Scott is correct. > The NACK is not correct. > > However changing the API means that where it is called needs to be changed too. > It is called at present from app/testpmd/cmdline.c line 4731. > > Bernard, Should I add this change to the patch? (Didn't occur to me to look for use). Scott > >>> ctrl |= IXGBE_VMVIR_VLANA_DEFAULT; >>> } else { >>> ctrl = 0; >>> diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h >>> b/drivers/net/ixgbe/rte_pmd_ixgbe.h >>> index 2fdf530..c2fb826 100644 >>> --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h >>> +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h >>> @@ -99,16 +99,17 @@ int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t >>> port, uint16_t vf, uint8_t on); >>> * The port identifier of the Ethernet device. >>> * @param vf >>> * ID specifying VF. >>> - * @param on >>> - * 1 - Enable VF's vlan insert. >>> - * 0 - Disable VF's vlan insert >>> + * @param vlan_id >>> + * 0 - Disable VF's vlan insert. >>> + * n - Enable; n is inserted as the vlan id. >>> * >>> * @return >>> * - (0) if successful. >>> * - (-ENODEV) if *port* invalid. >>> * - (-EINVAL) if bad parameter. >>> */ >>> -int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, >>> uint8_t on); >>> +int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, >>> + uint16_t vlan_id); >>> >>> /** >>> * Enable/Disable tx loopback >>> -- >>> 1.9.1 > > Regards, > > Bernard. >
Hi Scott, <snip> > >>> Subject: [dpdk-dev] [PATCH] net/ixgbe: fix vlan insert parameter > >>> type and its use > >>> > >>> The final parameter to rte_pmd_ixgbe_set_vf_vlan_insert is uint8_t > >>> and treated as a binary flag when it needs to be a uint16_t and > >>> treated as a VLAN id. The data sheet (sect 8.2.3.27.13) describes > >>> the right most > >>> 16 bits as the VLAN id that is to be inserted; the > >>> 16.11 code is accepting only a 1 or 0 thus effectively only > >>> allowing the VLAN id 1 to be inserted (0 disables the insertion setting). > >>> > >>> This patch changes the final parm name to represent the data that is > >>> being accepted (vlan_id), changes the type to permit all valid VLAN > >>> ids, and validates the parameter based on the range of 0 to 4095. > >>> Corresponding changes to prototype and documentation in the .h file. > >>> > >>> Fixes: 49e248223e9f71 ("net/ixgbe: add API for VF management") > >>> > >>> Signed-off-by: E. Scott Daniels <daniels@research.att.com> > >>> --- > >>> drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++---- > >>> drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +++++---- > >>> 2 files changed, 9 insertions(+), 8 deletions(-) > >>> > >>> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > >>> b/drivers/net/ixgbe/ixgbe_ethdev.c > >>> index 4ca5747..316af73 100644 > >>> --- a/drivers/net/ixgbe/ixgbe_ethdev.c > >>> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > >>> @@ -4727,7 +4727,7 @@ > rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t > >>> port, uint16_t vf, uint8_t on) } > >>> > >>> int > >>> -rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t > >>> on) > >>> +rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, > >>> +uint16_t > >>> +vlan_id) > >>> { > >>> struct ixgbe_hw *hw; > >>> uint32_t ctrl; > >>> @@ -4742,13 +4742,13 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t > >> port, > >>> uint16_t vf, uint8_t on) > >>> if (vf >= dev_info.max_vfs) > >>> return -EINVAL; > >>> > >>> - if (on > 1) > >>> + if (vlan_id > 4095) > >>> return -EINVAL; > >>> > >>> hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > >>> ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf)); > >>> - if (on) { > >>> - ctrl = on; > >>> + if (vlan_id) { > >>> + ctrl = vlan_id; > >> I believe this patch is a good idea of an enhancement. But you cannot > >> leverage the existing code like this. > >> The register IXGBE_VMVIR is only for enable/disable. We cannot write > >> the VLAN ID into it. > >> If you want to merge the 2 things, enabling/disabling and setting > >> VLAN ID together. I think we need a totally new implementation. So > NACK. > > > > Reading the 82599 data sheet (sect 8.2.3.27.13), the change from Scott is > correct. > > The NACK is not correct. > > > > However changing the API means that where it is called needs to be > changed too. > > It is called at present from app/testpmd/cmdline.c line 4731. > > > > > Bernard, > Should I add this change to the patch? (Didn't occur to me to look for use). > > Scott No, it would be better to make the testpmd change in a separate patch, and send a v2 patchset with two patches. > >>> ctrl |= IXGBE_VMVIR_VLANA_DEFAULT; > >>> } else { > >>> ctrl = 0; > >>> diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h > >>> b/drivers/net/ixgbe/rte_pmd_ixgbe.h > >>> index 2fdf530..c2fb826 100644 > >>> --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h > >>> +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h > >>> @@ -99,16 +99,17 @@ int > rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t > >>> port, uint16_t vf, uint8_t on); > >>> * The port identifier of the Ethernet device. > >>> * @param vf > >>> * ID specifying VF. > >>> - * @param on > >>> - * 1 - Enable VF's vlan insert. > >>> - * 0 - Disable VF's vlan insert > >>> + * @param vlan_id > >>> + * 0 - Disable VF's vlan insert. > >>> + * n - Enable; n is inserted as the vlan id. > >>> * > >>> * @return > >>> * - (0) if successful. > >>> * - (-ENODEV) if *port* invalid. > >>> * - (-EINVAL) if bad parameter. > >>> */ > >>> -int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, > >>> uint8_t on); > >>> +int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, > >>> + uint16_t vlan_id); > >>> > >>> /** > >>> * Enable/Disable tx loopback > >>> -- > >>> 1.9.1 Regards, Bernard.
On Wed, 19 Oct 2016, Iremonger, Bernard wrote: > Hi Scott, > > <snip> > >>>>> Subject: [dpdk-dev] [PATCH] net/ixgbe: fix vlan insert parameter >>>>> type and its use >>>>> >>>>> The final parameter to rte_pmd_ixgbe_set_vf_vlan_insert is uint8_t >>>>> and treated as a binary flag when it needs to be a uint16_t and >>>>> treated as a VLAN id. The data sheet (sect 8.2.3.27.13) describes >>>>> the right most >>>>> 16 bits as the VLAN id that is to be inserted; the >>>>> 16.11 code is accepting only a 1 or 0 thus effectively only >>>>> allowing the VLAN id 1 to be inserted (0 disables the insertion setting). >>>>> >>>>> This patch changes the final parm name to represent the data that is >>>>> being accepted (vlan_id), changes the type to permit all valid VLAN >>>>> ids, and validates the parameter based on the range of 0 to 4095. >>>>> Corresponding changes to prototype and documentation in the .h file. >>>>> >>>>> Fixes: 49e248223e9f71 ("net/ixgbe: add API for VF management") >>>>> >>>>> Signed-off-by: E. Scott Daniels <daniels@research.att.com> >>>>> --- >>>>> drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++---- >>>>> drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +++++---- >>>>> 2 files changed, 9 insertions(+), 8 deletions(-) >>>>> >>>>> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c >>>>> b/drivers/net/ixgbe/ixgbe_ethdev.c >>>>> index 4ca5747..316af73 100644 >>>>> --- a/drivers/net/ixgbe/ixgbe_ethdev.c >>>>> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c >>>>> @@ -4727,7 +4727,7 @@ >> rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t >>>>> port, uint16_t vf, uint8_t on) } >>>>> >>>>> int >>>>> -rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t >>>>> on) >>>>> +rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, >>>>> +uint16_t >>>>> +vlan_id) >>>>> { >>>>> struct ixgbe_hw *hw; >>>>> uint32_t ctrl; >>>>> @@ -4742,13 +4742,13 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t >>>> port, >>>>> uint16_t vf, uint8_t on) >>>>> if (vf >= dev_info.max_vfs) >>>>> return -EINVAL; >>>>> >>>>> - if (on > 1) >>>>> + if (vlan_id > 4095) >>>>> return -EINVAL; >>>>> >>>>> hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); >>>>> ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf)); >>>>> - if (on) { >>>>> - ctrl = on; >>>>> + if (vlan_id) { >>>>> + ctrl = vlan_id; >>>> I believe this patch is a good idea of an enhancement. But you cannot >>>> leverage the existing code like this. >>>> The register IXGBE_VMVIR is only for enable/disable. We cannot write >>>> the VLAN ID into it. >>>> If you want to merge the 2 things, enabling/disabling and setting >>>> VLAN ID together. I think we need a totally new implementation. So >> NACK. >>> >>> Reading the 82599 data sheet (sect 8.2.3.27.13), the change from Scott is >> correct. >>> The NACK is not correct. >>> >>> However changing the API means that where it is called needs to be >> changed too. >>> It is called at present from app/testpmd/cmdline.c line 4731. >>> >>> >> Bernard, >> Should I add this change to the patch? (Didn't occur to me to look for use). >> >> Scott > > No, it would be better to make the testpmd change in a separate patch, and send a v2 patchset with two patches. > Will do, thanks. New to the patch world, so I appreciate your patience! Scott > >>>>> ctrl |= IXGBE_VMVIR_VLANA_DEFAULT; >>>>> } else { >>>>> ctrl = 0; >>>>> diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h >>>>> b/drivers/net/ixgbe/rte_pmd_ixgbe.h >>>>> index 2fdf530..c2fb826 100644 >>>>> --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h >>>>> +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h >>>>> @@ -99,16 +99,17 @@ int >> rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t >>>>> port, uint16_t vf, uint8_t on); >>>>> * The port identifier of the Ethernet device. >>>>> * @param vf >>>>> * ID specifying VF. >>>>> - * @param on >>>>> - * 1 - Enable VF's vlan insert. >>>>> - * 0 - Disable VF's vlan insert >>>>> + * @param vlan_id >>>>> + * 0 - Disable VF's vlan insert. >>>>> + * n - Enable; n is inserted as the vlan id. >>>>> * >>>>> * @return >>>>> * - (0) if successful. >>>>> * - (-ENODEV) if *port* invalid. >>>>> * - (-EINVAL) if bad parameter. >>>>> */ >>>>> -int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, >>>>> uint8_t on); >>>>> +int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, >>>>> + uint16_t vlan_id); >>>>> >>>>> /** >>>>> * Enable/Disable tx loopback >>>>> -- >>>>> 1.9.1 > > Regards, > > Bernard. > >
Changes in v2: Add testpmd patch. Update testpmd for change to rte_pmd_ixgbe_set_vf_vlan_insert function. Bernard Iremonger (1): app/test_pmd: change to the VF VLAN insert command E. Scott Daniels (1): net/ixgbe: fix VLAN insert parameter type and its use app/test-pmd/cmdline.c | 19 +++++++++---------- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +- drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++---- drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +++++---- 4 files changed, 19 insertions(+), 19 deletions(-)
Hi Bernard, > -----Original Message----- > From: Iremonger, Bernard > Sent: Wednesday, October 19, 2016 6:56 PM > To: Lu, Wenzhuo; E. Scott Daniels; Zhang, Helin > Cc: dev@dpdk.org; az5157@att.com > Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix vlan insert parameter type and its > use > > Hi Wenzhuo, Scott, > > <snip> > > > > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix vlan insert parameter > > > type and its use > > > > > > The final parameter to rte_pmd_ixgbe_set_vf_vlan_insert is uint8_t > > > and treated as a binary flag when it needs to be a uint16_t and > > > treated as a VLAN id. The data sheet (sect 8.2.3.27.13) describes > > > the right most > > > 16 bits as the VLAN id that is to be inserted; the > > > 16.11 code is accepting only a 1 or 0 thus effectively only > > > allowing the VLAN id 1 to be inserted (0 disables the insertion setting). > > > > > > This patch changes the final parm name to represent the data that is > > > being accepted (vlan_id), changes the type to permit all valid VLAN > > > ids, and validates the parameter based on the range of 0 to 4095. > > > Corresponding changes to prototype and documentation in the .h file. > > > > > > Fixes: 49e248223e9f71 ("net/ixgbe: add API for VF management") > > > > > > Signed-off-by: E. Scott Daniels <daniels@research.att.com> > > > --- > > > drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++---- > > > drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +++++---- > > > 2 files changed, 9 insertions(+), 8 deletions(-) > > > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > > index 4ca5747..316af73 100644 > > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > > @@ -4727,7 +4727,7 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t > > > port, uint16_t vf, uint8_t on) } > > > > > > int > > > -rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t > > > on) > > > +rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, > > > +uint16_t > > > +vlan_id) > > > { > > > struct ixgbe_hw *hw; > > > uint32_t ctrl; > > > @@ -4742,13 +4742,13 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t > > port, > > > uint16_t vf, uint8_t on) > > > if (vf >= dev_info.max_vfs) > > > return -EINVAL; > > > > > > - if (on > 1) > > > + if (vlan_id > 4095) > > > return -EINVAL; > > > > > > hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > > ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf)); > > > - if (on) { > > > - ctrl = on; > > > + if (vlan_id) { > > > + ctrl = vlan_id; > > I believe this patch is a good idea of an enhancement. But you cannot > > leverage the existing code like this. > > The register IXGBE_VMVIR is only for enable/disable. We cannot write > > the VLAN ID into it. > > If you want to merge the 2 things, enabling/disabling and setting VLAN > > ID together. I think we need a totally new implementation. So NACK. > > Reading the 82599 data sheet (sect 8.2.3.27.13), the change from Scott is > correct. > The NACK is not correct. You're right. I made a mistake about the words 'default vlan'. It's not fixed but the value of 'Port VLAN ID'. So the previous patch is not good, we need to fix it. Thanks for correcting me. > > However changing the API means that where it is called needs to be changed > too. > It is called at present from app/testpmd/cmdline.c line 4731. > > > > > > ctrl |= IXGBE_VMVIR_VLANA_DEFAULT; > > > } else { > > > ctrl = 0; > > > diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h > > > b/drivers/net/ixgbe/rte_pmd_ixgbe.h > > > index 2fdf530..c2fb826 100644 > > > --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h > > > +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h > > > @@ -99,16 +99,17 @@ int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t > > > port, uint16_t vf, uint8_t on); > > > * The port identifier of the Ethernet device. > > > * @param vf > > > * ID specifying VF. > > > - * @param on > > > - * 1 - Enable VF's vlan insert. > > > - * 0 - Disable VF's vlan insert > > > + * @param vlan_id > > > + * 0 - Disable VF's vlan insert. > > > + * n - Enable; n is inserted as the vlan id. > > > * > > > * @return > > > * - (0) if successful. > > > * - (-ENODEV) if *port* invalid. > > > * - (-EINVAL) if bad parameter. > > > */ > > > -int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, > > > uint8_t on); > > > +int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, > > > + uint16_t vlan_id); > > > > > > /** > > > * Enable/Disable tx loopback > > > -- > > > 1.9.1 > > Regards, > > Bernard.
Hi, > -----Original Message----- > From: Iremonger, Bernard > Sent: Wednesday, October 19, 2016 10:48 PM > To: dev@dpdk.org; daniels@research.att.com; Lu, Wenzhuo; az5157@att.com > Cc: Iremonger, Bernard > Subject: [PATCH v2 0/2] net/ixgbe: fix VF VLAN insert > > Changes in v2: > Add testpmd patch. > Update testpmd for change to rte_pmd_ixgbe_set_vf_vlan_insert function. > > Bernard Iremonger (1): > app/test_pmd: change to the VF VLAN insert command > > E. Scott Daniels (1): > net/ixgbe: fix VLAN insert parameter type and its use > > app/test-pmd/cmdline.c | 19 +++++++++---------- > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +- > drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++---- > drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +++++---- > 4 files changed, 19 insertions(+), 19 deletions(-) > > -- > 2.10.1 Series-Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com>
On Thu, Oct 20, 2016 at 12:54:52AM +0000, Lu, Wenzhuo wrote: > Hi, > > > -----Original Message----- > > From: Iremonger, Bernard > > Sent: Wednesday, October 19, 2016 10:48 PM > > To: dev@dpdk.org; daniels@research.att.com; Lu, Wenzhuo; az5157@att.com > > Cc: Iremonger, Bernard > > Subject: [PATCH v2 0/2] net/ixgbe: fix VF VLAN insert > > > > Changes in v2: > > Add testpmd patch. > > Update testpmd for change to rte_pmd_ixgbe_set_vf_vlan_insert function. > > > > Bernard Iremonger (1): > > app/test_pmd: change to the VF VLAN insert command > > > > E. Scott Daniels (1): > > net/ixgbe: fix VLAN insert parameter type and its use > > > > app/test-pmd/cmdline.c | 19 +++++++++---------- > > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +- > > drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++---- > > drivers/net/ixgbe/rte_pmd_ixgbe.h | 9 +++++---- > > 4 files changed, 19 insertions(+), 19 deletions(-) > > > > -- > > 2.10.1 > Series-Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com> > Applied to dpdk-next-net/rel_16_11 /Bruce
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4ca5747..316af73 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -4727,7 +4727,7 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on) } int -rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on) +rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t vlan_id) { struct ixgbe_hw *hw; uint32_t ctrl; @@ -4742,13 +4742,13 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on) if (vf >= dev_info.max_vfs) return -EINVAL; - if (on > 1) + if (vlan_id > 4095) return -EINVAL; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); ctrl = IXGBE_READ_REG(hw, IXGBE_VMVIR(vf)); - if (on) { - ctrl = on; + if (vlan_id) { + ctrl = vlan_id; ctrl |= IXGBE_VMVIR_VLANA_DEFAULT; } else { ctrl = 0; diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h index 2fdf530..c2fb826 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h @@ -99,16 +99,17 @@ int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on); * The port identifier of the Ethernet device. * @param vf * ID specifying VF. - * @param on - * 1 - Enable VF's vlan insert. - * 0 - Disable VF's vlan insert + * @param vlan_id + * 0 - Disable VF's vlan insert. + * n - Enable; n is inserted as the vlan id. * * @return * - (0) if successful. * - (-ENODEV) if *port* invalid. * - (-EINVAL) if bad parameter. */ -int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint8_t on); +int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, + uint16_t vlan_id); /** * Enable/Disable tx loopback