From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 824E42E8A for ; Wed, 12 Apr 2017 13:19:07 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP; 12 Apr 2017 04:19:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,190,1488873600"; d="scan'208";a="1154783664" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 12 Apr 2017 04:19:06 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 12 Apr 2017 04:19:06 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 12 Apr 2017 04:19:05 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by shsmsx102.ccr.corp.intel.com ([169.254.2.246]) with mapi id 14.03.0319.002; Wed, 12 Apr 2017 19:19:02 +0800 From: "Zhang, Qi Z" To: "Zhang, Qi Z" CC: "'dev@dpdk.org'" , "Zhang, Helin" , "Wu, Jingjing" , "Yigit, Ferruh" Thread-Topic: [PATCH] net/i40e: enable statistic reset for VF Thread-Index: AQHSjj3Drk13tFTmD06h6aQUdJRHgaGvYVWAgAKzDkCAD8nYoA== Date: Wed, 12 Apr 2017 11:19:01 +0000 Message-ID: <039ED4275CED7440929022BC67E706115308B0DB@SHSMSX103.ccr.corp.intel.com> References: <1487874421-11934-1-git-send-email-qi.z.zhang@intel.com> <039ED4275CED7440929022BC67E706115307CC65@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <039ED4275CED7440929022BC67E706115307CC65@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/i40e: enable statistic reset for VF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Apr 2017 11:19:08 -0000 > -----Original Message----- > From: Zhang, Qi Z > Sent: Wednesday, April 12, 2017 7:08 PM > To: Zhang, Qi Z > Subject: RE: [PATCH] net/i40e: enable statistic reset for VF >=20 > -----Original Message----- > From: Zhang, Qi Z > Sent: Friday, February 24, 2017 2:27 AM > To: Wu, Jingjing; Zhang, Helin > Cc: dev@dpdk.org; Zhang, Qi Z > Subject: [PATCH] net/i40e: enable statistic reset for VF >=20 > The patch implements the dev_ops "stats_reset" for VF. >=20 > Signed-off-by: Qi Zhang > --- > drivers/net/i40e/i40e_ethdev_vf.c | 34 > ++++++++++++++++++++++++++++++++++ > drivers/net/i40e/i40e_pf.c | 25 +++++++++++++++++++++++++ > drivers/net/i40e/i40e_pf.h | 1 + > 3 files changed, 60 insertions(+) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c > b/drivers/net/i40e/i40e_ethdev_vf.c > index 55fd344..5155b25 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -110,6 +110,7 @@ static int i40evf_dev_link_update(struct > rte_eth_dev *dev, > __rte_unused int wait_to_complete); static void > i40evf_dev_stats_get(struct rte_eth_dev *dev, > struct rte_eth_stats *stats); > +static void i40evf_dev_stats_reset(struct rte_eth_dev *dev); > static int i40evf_dev_xstats_get(struct rte_eth_dev *dev, > struct rte_eth_xstat *xstats, unsigned n); static int > i40evf_dev_xstats_get_names(struct rte_eth_dev *dev, @@ -199,6 > +200,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops =3D { > .allmulticast_disable =3D i40evf_dev_allmulticast_disable, > .link_update =3D i40evf_dev_link_update, > .stats_get =3D i40evf_dev_stats_get, > + .stats_reset =3D i40evf_dev_stats_reset, > .xstats_get =3D i40evf_dev_xstats_get, > .xstats_get_names =3D i40evf_dev_xstats_get_names, > .xstats_reset =3D i40evf_dev_xstats_reset, > @@ -988,6 +990,27 @@ i40evf_get_statistics(struct rte_eth_dev *dev, > struct rte_eth_stats *stats) > return 0; > } >=20 > +static int > +i40evf_reset_statistics(struct rte_eth_dev *dev) { > + struct i40e_vf *vf =3D I40EVF_DEV_PRIVATE_TO_VF(dev->data- > >dev_private); > + int err; > + struct vf_cmd_info args; > + u16 vsi_id =3D vf->vsi_res->vsi_id; > + > + args.ops =3D (enum i40e_virtchnl_ops)I40E_VIRTCHNL_OP_RESET_STATS; > + args.in_args =3D (uint8_t *)&vsi_id; > + args.in_args_size =3D sizeof(vsi_id); > + args.out_buffer =3D vf->aq_resp; > + args.out_size =3D I40E_AQ_BUF_SZ; > + > + err =3D i40evf_execute_vf_cmd(dev, &args); > + if (err) > + PMD_DRV_LOG(ERR, "fail to execute command > CFG_VLAN_OFFLOAD"); > + > + return err; > +} > + > static void > i40evf_dev_xstats_reset(struct rte_eth_dev *dev) { @@ -2310,6 > +2333,17 @@ i40evf_dev_stats_get(struct rte_eth_dev *dev, struct > rte_eth_stats > *stats) } >=20 > static void > +i40evf_dev_stats_reset(struct rte_eth_dev *dev) { > + struct i40e_vf *vf =3D I40EVF_DEV_PRIVATE_TO_VF(dev->data- > >dev_private); > + /* only DPDK PF support this */ > + if (vf->version_major =3D=3D I40E_DPDK_VERSION_MAJOR) { > + if (i40evf_reset_statistics(dev)) > + PMD_DRV_LOG(ERR, "Reset statistics failed"); > + } > +} > + > +static void > i40evf_dev_close(struct rte_eth_dev *dev) { > struct i40e_hw *hw =3D > I40E_DEV_PRIVATE_TO_HW(dev->data- >dev_private); diff --git > a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index > f771dfb..62d2bfd 100644 > --- a/drivers/net/i40e/i40e_pf.c > +++ b/drivers/net/i40e/i40e_pf.c > @@ -1155,6 +1155,27 @@ i40e_pf_host_process_cmd_cfg_pvid(struct > i40e_pf_vf *vf, > return ret; > } >=20 > +static int > +i40e_pf_host_process_cmd_reset_stats(struct i40e_pf_vf *vf, > + bool b_op) > +{ > + vf->vsi->offset_loaded =3D false; > + i40e_update_vsi_stats(vf->vsi); >=20 > + > + if (b_op) > + i40e_pf_host_send_msg_to_vf(vf, > I40E_VIRTCHNL_OP_RESET_STATS, > + I40E_SUCCESS, > + NULL, > + 0); > + else > + i40e_pf_host_send_msg_to_vf(vf, > I40E_VIRTCHNL_OP_RESET_STATS, > + I40E_NOT_SUPPORTED, > + NULL, > + 0); > + > + return I40E_SUCCESS; > +} > + > void > i40e_notify_vf_link_status(struct rte_eth_dev *dev, struct i40e_pf_vf > *vf) { @@ -1300,6 +1321,10 @@ i40e_pf_host_handle_vf_msg(struct > rte_eth_dev *dev, > PMD_DRV_LOG(INFO, "OP_CFG_VLAN_PVID received"); > i40e_pf_host_process_cmd_cfg_pvid(vf, msg, msglen, b_op); > break; > + case I40E_VIRTCHNL_OP_RESET_STATS: > + PMD_DRV_LOG(INFO, "OP_RESET_STATS received"); > + i40e_pf_host_process_cmd_reset_stats(vf, b_op); > + break; > /* Don't add command supported below, which will > * return an error code. > */ > diff --git a/drivers/net/i40e/i40e_pf.h b/drivers/net/i40e/i40e_pf.h in= dex > b4c2287..69ef873 100644 > --- a/drivers/net/i40e/i40e_pf.h > +++ b/drivers/net/i40e/i40e_pf.h > @@ -58,6 +58,7 @@ enum i40e_virtchnl_ops_dpdk { > I40E_DPDK_OFFSET, > I40E_VIRTCHNL_OP_CFG_VLAN_PVID, > I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT, > + I40E_VIRTCHNL_OP_RESET_STATS, > }; >=20 > /* A structure to support extended info of a receive queue. */ > -- > 2.7.4 This patch will not take effect since vf->version_major =3D=3D I40E_DPDK_VE= RSION_MAJOR=20 will always be false based on current implementation, so=20 Nacked-by: Qi Zhang