From: "Wang, Haiyue" <haiyue.wang@intel.com>
To: "Yang, Qiming" <qiming.yang@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Wu, Jingjing" <jingjing.wu@intel.com>,
"Zhang, Qi Z" <qi.z.zhang@intel.com>,
"Xing, Beilei" <beilei.xing@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 5/5] net/iavf: support new VLAN virtchnl opcodes
Date: Tue, 15 Dec 2020 05:27:07 +0000 [thread overview]
Message-ID: <BN8PR11MB37953369CC0D518208F7B6A9F7C60@BN8PR11MB3795.namprd11.prod.outlook.com> (raw)
In-Reply-To: <BN6PR11MB001768A020CFF16207D9E70DE5C60@BN6PR11MB0017.namprd11.prod.outlook.com>
> -----Original Message-----
> From: Yang, Qiming <qiming.yang@intel.com>
> Sent: Tuesday, December 15, 2020 13:20
> To: Wang, Haiyue <haiyue.wang@intel.com>; dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>
> Subject: RE: [PATCH v2 5/5] net/iavf: support new VLAN virtchnl opcodes
>
>
>
> > -----Original Message-----
> > From: Wang, Haiyue <haiyue.wang@intel.com>
> > Sent: Monday, December 14, 2020 15:12
> > To: dev@dpdk.org
> > Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> > <jingjing.wu@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Haiyue
> > <haiyue.wang@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> > Subject: [PATCH v2 5/5] net/iavf: support new VLAN virtchnl opcodes
> >
> > The new VLAN virtchnl opcodes introduce rich capabilities setting like
> > outer/inner different TPIDs.
> >
> > Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> > ---
> > drivers/net/iavf/iavf.h | 6 ++
> > drivers/net/iavf/iavf_ethdev.c | 46 +++++++++++
> > drivers/net/iavf/iavf_vchnl.c | 147 +++++++++++++++++++++++++++++++++
> > 3 files changed, 199 insertions(+)
> >
> > diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index
> > 6d5912d8c..c57ad6175 100644
> > --- a/drivers/net/iavf/iavf.h
> > +++ b/drivers/net/iavf/iavf.h
> > @@ -132,6 +132,7 @@ struct iavf_info {
> > struct virtchnl_version_info virtchnl_version;
> > struct virtchnl_vf_resource *vf_res; /* VF resource */
> > struct virtchnl_vsi_resource *vsi_res; /* LAN VSI */
> > + struct virtchnl_vlan_caps vlan_v2_caps;
> > uint64_t supported_rxdid;
> > uint8_t *proto_xtr; /* proto xtr type for all queues */
> > volatile enum virtchnl_ops pend_cmd; /* pending command not
> > finished */ @@ -288,7 +289,9 @@ int iavf_check_api_version(struct
> > iavf_adapter *adapter); int iavf_get_vf_resource(struct iavf_adapter
> > *adapter); void iavf_handle_virtchnl_msg(struct rte_eth_dev *dev); int
> > iavf_enable_vlan_strip(struct iavf_adapter *adapter);
> > +int iavf_enable_vlan_strip_v2(struct iavf_adapter *adapter);
> > int iavf_disable_vlan_strip(struct iavf_adapter *adapter);
> > +int iavf_disable_vlan_strip_v2(struct iavf_adapter *adapter);
> > int iavf_switch_queue(struct iavf_adapter *adapter, uint16_t qid,
> > bool rx, bool on);
> > int iavf_switch_queue_lv(struct iavf_adapter *adapter, uint16_t qid, @@ -
> > 302,6 +305,7 @@ int iavf_configure_rss_key(struct iavf_adapter *adapter);
> > int iavf_configure_queues(struct iavf_adapter *adapter,
> > uint16_t num_queue_pairs, uint16_t index); int
> > iavf_get_supported_rxdid(struct iavf_adapter *adapter);
> > +int iavf_get_vlan_offload_caps_v2(struct iavf_adapter *adapter);
> > int iavf_config_irq_map(struct iavf_adapter *adapter); int
> > iavf_config_irq_map_lv(struct iavf_adapter *adapter, uint16_t num,
> > uint16_t index);
> > @@ -315,6 +319,8 @@ int iavf_config_promisc(struct iavf_adapter *adapter,
> > bool enable_unicast, int iavf_add_del_eth_addr(struct iavf_adapter
> > *adapter,
> > struct rte_ether_addr *addr, bool add); int
> > iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add);
> > +int iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid,
> > + bool add);
> > int iavf_fdir_add(struct iavf_adapter *adapter, struct iavf_fdir_conf *filter);
> > int iavf_fdir_del(struct iavf_adapter *adapter, struct iavf_fdir_conf *filter);
> > int iavf_fdir_check(struct iavf_adapter *adapter, diff --git
> > a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index
> > 0fd06e4b4..4d946013c 100644
> > --- a/drivers/net/iavf/iavf_ethdev.c
> > +++ b/drivers/net/iavf/iavf_ethdev.c
> > @@ -384,6 +384,14 @@ iavf_dev_configure(struct rte_eth_dev *dev)
> > vf->max_rss_qregion = IAVF_MAX_NUM_QUEUES_DFLT;
> > }
> >
> > + /* Vlan stripping setting v2 */
> > + if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) {
> > + if (dev_conf->rxmode.offloads &
> > DEV_RX_OFFLOAD_VLAN_STRIP)
> > + iavf_enable_vlan_strip_v2(ad);
> > + else
> > + iavf_disable_vlan_strip_v2(ad);
> > + }
> > +
> > /* Vlan stripping setting */
> > if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) {
> > if (dev_conf->rxmode.offloads &
> > DEV_RX_OFFLOAD_VLAN_STRIP) @@ -992,6 +1000,13 @@
> > iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
> > struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
> > int err;
> >
> > + if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) {
> > + err = iavf_add_del_vlan_v2(adapter, vlan_id, on);
> > + if (err)
> > + return -EIO;
> > + return 0;
> > + }
> > +
> > if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
> > return -ENOTSUP;
> >
> > @@ -1001,6 +1016,27 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev,
> > uint16_t vlan_id, int on)
> > return 0;
> > }
> >
> > +static int
> > +iavf_dev_vlan_offload_set_v2(struct rte_eth_dev *dev, int mask) {
> > + struct iavf_adapter *adapter =
> > + IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> > + struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
> > + int err;
> > +
> > + if (mask & ETH_VLAN_STRIP_MASK) {
> > + if (dev_conf->rxmode.offloads &
> > DEV_RX_OFFLOAD_VLAN_STRIP)
> > + err = iavf_enable_vlan_strip_v2(adapter);
> > + else
> > + err = iavf_disable_vlan_strip_v2(adapter);
> > +
> > + if (err)
> > + return -EIO;
> > + }
> > +
> > + return 0;
> > +}
> > +
> > static int
> > iavf_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask) { @@ -1010,6
> > +1046,9 @@ iavf_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)
> > struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
> > int err;
> >
> > + if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2)
> > + return iavf_dev_vlan_offload_set_v2(dev, mask);
> > +
> > if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
> > return -ENOTSUP;
> >
> > @@ -1861,6 +1900,13 @@ iavf_init_vf(struct rte_eth_dev *dev)
> > }
> > }
> >
> > + if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) {
> > + if (iavf_get_vlan_offload_caps_v2(adapter) != 0) {
> > + PMD_INIT_LOG(ERR, "failed to do get VLAN offload
> > v2 capabilities");
> > + goto err_rss;
> > + }
> > + }
> > +
> > iavf_init_proto_xtr(dev);
> >
> > return 0;
> > diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index
> > 3f949c9e3..6b571924f 100644
> > --- a/drivers/net/iavf/iavf_vchnl.c
> > +++ b/drivers/net/iavf/iavf_vchnl.c
> > @@ -174,6 +174,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter,
> > struct iavf_cmd_info *args)
> > case VIRTCHNL_OP_VERSION:
> > case VIRTCHNL_OP_GET_VF_RESOURCES:
> > case VIRTCHNL_OP_GET_SUPPORTED_RXDIDS:
> > + case VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS:
> > /* for init virtchnl ops, need to poll the response */
> > do {
> > result = iavf_read_msg_from_pf(adapter, args-
> > >out_size, @@ -366,6 +367,45 @@ iavf_enable_vlan_strip(struct
> > iavf_adapter *adapter)
> > return ret;
> > }
> >
> > +int
> > +iavf_enable_vlan_strip_v2(struct iavf_adapter *adapter) {
>
> Why we don't use one function to implement vlan strip v2?
> iavf_switch_vlan_strip_v2(struct iavf_adapter *adapter, bool on)
> args.ops = on ? VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2
> : VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2;
Make the code align to VLAN v1, like:
/* Vlan stripping setting v2 */
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) {
if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
iavf_enable_vlan_strip_v2(ad);
else
iavf_disable_vlan_strip_v2(ad);
}
/* Vlan stripping setting */
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) {
if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
iavf_enable_vlan_strip(ad);
else
iavf_disable_vlan_strip(ad);
}
>
> > + struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
> > + struct virtchnl_vlan_offload_caps *offload_caps;
> > + struct virtchnl_vlan_strip vlan_strip;
> > + struct iavf_cmd_info args;
> > + bool outer;
> > + int ret;
> > +
> > + offload_caps = &vf->vlan_v2_caps.offloads;
> > + if (offload_caps->outer_stripping &
> > VIRTCHNL_VLAN_ETHERTYPE_8100)
> > + outer = true;
> > + else if (offload_caps->inner_stripping &
> > VIRTCHNL_VLAN_ETHERTYPE_8100)
> > + outer = false;
> > + else
> > + return -ENOTSUP;
> > +
> > + memset(&vlan_strip, 0, sizeof(vlan_strip));
> > + vlan_strip.vsi_id = vf->vsi_res->vsi_id;
> > + if (outer)
> > + vlan_strip.outer_ethertype_setting =
> > + VIRTCHNL_VLAN_ETHERTYPE_8100;
> > + else
> > + vlan_strip.inner_ethertype_setting =
> > + VIRTCHNL_VLAN_ETHERTYPE_8100;
> > +
> > + args.ops = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2;
> > + args.in_args = (uint8_t *)&vlan_strip;
> > + args.in_args_size = sizeof(vlan_strip);
> > + args.out_buffer = vf->aq_resp;
> > + args.out_size = IAVF_AQ_BUF_SZ;
> > + ret = iavf_execute_vf_cmd(adapter, &args);
> > + if (ret)
> > + PMD_DRV_LOG(ERR, "fail to execute command
> > +VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2");
> > +
> > + return ret;
> > +}
> > +
> > int
> > iavf_disable_vlan_strip(struct iavf_adapter *adapter) { @@ -387,6 +427,45
> > @@ iavf_disable_vlan_strip(struct iavf_adapter *adapter)
> > return ret;
> > }
> >
> > +int
> > +iavf_disable_vlan_strip_v2(struct iavf_adapter *adapter) {
>
> Same comment.
>
Ditto.
> > 2.29.2
next prev parent reply other threads:[~2020-12-15 5:27 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-14 7:11 [dpdk-dev] [PATCH v2 0/5] Add AVF & DCF VLAN feaure Haiyue Wang
2020-12-14 7:11 ` [dpdk-dev] [PATCH v2 1/5] common/iavf: new VLAN opcode Haiyue Wang
2020-12-14 7:11 ` [dpdk-dev] [PATCH v2 2/5] net/iavf: support Ethernet CRC strip disable Haiyue Wang
2020-12-14 7:11 ` [dpdk-dev] [PATCH v2 3/5] net/ice: enable QinQ filter for switch Haiyue Wang
2020-12-14 7:11 ` [dpdk-dev] [PATCH v2 4/5] net/ice: add DCF port representor Haiyue Wang
2020-12-14 7:11 ` [dpdk-dev] [PATCH v2 5/5] net/iavf: support new VLAN virtchnl opcodes Haiyue Wang
2020-12-15 5:20 ` Yang, Qiming
2020-12-15 5:27 ` Wang, Haiyue [this message]
2020-12-15 5:21 ` [dpdk-dev] [PATCH v2 0/5] Add AVF & DCF VLAN feaure Yang, Qiming
2020-12-15 5:25 ` Wang, Haiyue
2020-12-28 5:07 ` [dpdk-dev] [PATCH v3 " Haiyue Wang
2020-12-28 5:07 ` [dpdk-dev] [PATCH v3 1/5] common/iavf: new VLAN opcode Haiyue Wang
2020-12-28 5:07 ` [dpdk-dev] [PATCH v3 2/5] net/iavf: support Ethernet CRC strip disable Haiyue Wang
2020-12-28 5:07 ` [dpdk-dev] [PATCH v3 3/5] net/ice: enable QinQ filter for switch Haiyue Wang
2020-12-28 5:07 ` [dpdk-dev] [PATCH v3 4/5] net/ice: add the DCF VLAN handling Haiyue Wang
2020-12-28 5:07 ` [dpdk-dev] [PATCH v3 5/5] net/iavf: implement new VLAN capability handling Haiyue Wang
2020-12-28 11:21 ` [dpdk-dev] [PATCH v4 0/5] Add AVF & DCF VLAN feaure Haiyue Wang
2020-12-28 11:21 ` [dpdk-dev] [PATCH v4 1/5] common/iavf: new VLAN opcode Haiyue Wang
2020-12-28 11:21 ` [dpdk-dev] [PATCH v4 2/5] net/iavf: support Ethernet CRC strip disable Haiyue Wang
2020-12-28 11:21 ` [dpdk-dev] [PATCH v4 3/5] net/ice: enable QinQ filter for switch Haiyue Wang
2020-12-28 11:21 ` [dpdk-dev] [PATCH v4 4/5] net/ice: add the DCF VLAN handling Haiyue Wang
2020-12-28 11:21 ` [dpdk-dev] [PATCH v4 5/5] net/iavf: implement new VLAN capability handling Haiyue Wang
2021-01-11 13:34 ` [dpdk-dev] [PATCH v5 0/4] Add AVF & DCF VLAN feaure Haiyue Wang
2021-01-11 13:34 ` [dpdk-dev] [PATCH v5 1/4] common/iavf: new VLAN opcode Haiyue Wang
2021-01-11 13:34 ` [dpdk-dev] [PATCH v5 2/4] net/iavf: support Ethernet CRC strip disable Haiyue Wang
2021-01-11 13:34 ` [dpdk-dev] [PATCH v5 3/4] net/ice: add the DCF VLAN handling Haiyue Wang
2021-01-11 13:34 ` [dpdk-dev] [PATCH v5 4/4] net/iavf: implement new VLAN capability handling Haiyue Wang
2021-01-12 8:12 ` [dpdk-dev] [PATCH v6 0/3] Add AVF & DCF VLAN feaure Haiyue Wang
2021-01-12 8:13 ` [dpdk-dev] [PATCH v6 1/3] net/iavf: support Ethernet CRC strip disable Haiyue Wang
2021-01-12 8:13 ` [dpdk-dev] [PATCH v6 2/3] net/ice: add the DCF VLAN handling Haiyue Wang
2021-01-12 8:13 ` [dpdk-dev] [PATCH v6 3/3] net/iavf: implement new VLAN capability handling Haiyue Wang
2021-01-12 8:39 ` [dpdk-dev] [PATCH v6 0/3] Add AVF & DCF VLAN feaure Zhang, Qi Z
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BN8PR11MB37953369CC0D518208F7B6A9F7C60@BN8PR11MB3795.namprd11.prod.outlook.com \
--to=haiyue.wang@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).