[dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion from PF
Lu, Wenzhuo
wenzhuo.lu at intel.com
Mon Jan 9 01:32:21 CET 2017
Hi Bernard,
> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Friday, January 6, 2017 7:29 PM
> To: Lu, Wenzhuo; Wu, Jingjing; dev at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion from
> PF
>
> Hi Jinqjing, Wenzhuo,
>
> > -----Original Message-----
> > From: Lu, Wenzhuo
> > Sent: Friday, January 6, 2017 8:20 AM
> > To: Wu, Jingjing <jingjing.wu at intel.com>; dev at dpdk.org
> > Cc: Iremonger, Bernard <bernard.iremonger at intel.com>
> > Subject: RE: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN
> > insertion from PF
> >
> > Hi Jingjing, Bernard,
> >
> >
> > > -----Original Message-----
> > > From: Wu, Jingjing
> > > Sent: Friday, January 6, 2017 8:33 AM
> > > To: Lu, Wenzhuo; dev at dpdk.org
> > > Cc: Iremonger, Bernard
> > > Subject: RE: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN
> > > insertion from PF
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Wenzhuo Lu
> > > > Sent: Tuesday, January 3, 2017 2:55 PM
> > > > To: dev at dpdk.org
> > > > Cc: Iremonger, Bernard <bernard.iremonger at intel.com>
> > > > Subject: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN
> > > > insertion from PF
> > > >
> > > > From: Bernard Iremonger <bernard.iremonger at intel.com>
> > > >
> > > > Support inserting VF VLAN id from PF.
> > > > User can call the API on PF to insert a VLAN id to a specific VF.
> > > >
> > > > Signed-off-by: Bernard Iremonger <bernard.iremonger at intel.com>
> > > > ---
> > > > drivers/net/i40e/i40e_ethdev.c | 56
> > > > +++++++++++++++++++++++++++++++
> > > > drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++
> > > > drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
> > > > 3 files changed, 76 insertions(+)
> > > >
> > > > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > > > b/drivers/net/i40e/i40e_ethdev.c index 7ab1c93..31c387d 100644
> > > > --- a/drivers/net/i40e/i40e_ethdev.c
> > > > +++ b/drivers/net/i40e/i40e_ethdev.c
> > > > @@ -10266,3 +10266,59 @@ static void
> > > > i40e_set_default_mac_addr(struct rte_eth_dev *dev,
> > > > else
> > > > return -EINVAL;
> > > > }
> > > > +
> > > > +int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
> > > > + uint16_t vlan_id)
> > > > +{
> > > > + struct rte_eth_dev *dev;
> > > > + struct rte_eth_dev_info dev_info;
> > > > + struct i40e_pf *pf;
> > > > + struct i40e_hw *hw;
> > > > + struct i40e_vsi *vsi;
> > > > + struct i40e_vsi_context ctxt;
> > > > + int ret;
> > > > +
> > > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
> > > > +
> > > > + dev = &rte_eth_devices[port];
> > > > + rte_eth_dev_info_get(port, &dev_info);
> > >
> > > It looks dev_info is not used in this function.
> > I'll delete it.
>
> It was intended to use dev_info have a check on max_vfs.
>
> if (vf_id >= dev_info.max_vfs)
> return -EINVAL;
>
> Should this check be added instead of deleting dev_info ?
It's not wrong to check it. But we don't think this check is necessary because there's the check below, "vf_id >= pf->vf_num".
>
> > >
> > > > + pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> > > > + hw = I40E_PF_TO_HW(pf);
> > > > +
> > > > + /**
> > > > + * return -ENODEV if SRIOV not enabled, VF number not configured
> > > > + * or no queue assigned.
> > > > + */
> > > > + if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 ||
> > > > + pf->vf_nb_qps == 0)
> > > > + return -ENODEV;
> > > > +
> > > > + if (vf_id >= pf->vf_num || !pf->vfs)
> > > > + return -EINVAL;
> > > > +
> > > > + if (vlan_id > ETHER_MAX_VLAN_ID)
> > > > + return -EINVAL;
> > > > +
> > > > + vsi = pf->vfs[vf_id].vsi;
> > > > + if (!vsi)
> > > > + return -EINVAL;
> > > > +
> > > > + vsi->info.valid_sections =
> > > > cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
> > > > + vsi->info.pvid = vlan_id;
> > > > + if (vlan_id > 0)
> > > > + vsi->info.port_vlan_flags |=
> > > I40E_AQ_VSI_PVLAN_INSERT_PVID;
> > > > + else
> > > > + vsi->info.port_vlan_flags &=
> > > > ~I40E_AQ_VSI_PVLAN_INSERT_PVID;
> > > So, Pvid is used here for insert. Does it has any relationship with
> > > vlan anti- spoof patch?
> > > If so, it's better to consider how to deal with that.
> > It's vlan insertion not filtering. So I think not related.
> >
> > >
> > > Thanks
> > > Jingjing
>
> Regards,
>
> Bernard.
More information about the dev
mailing list