DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Zhao1, Wei" <wei.zhao1@intel.com>
To: "Wu, Jingjing" <jingjing.wu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>
Subject: Re: [dpdk-dev] [PATCH 3/3] net/i40e: implement device reset on port
Date: Mon, 27 Mar 2017 06:10:45 +0000	[thread overview]
Message-ID: <A2573D2ACFCADC41BB3BE09C6DE313CA0205ADB7@PGSMSX103.gar.corp.intel.com> (raw)
In-Reply-To: <9BB6961774997848B5B42BEC655768F810D1335C@SHSMSX103.ccr.corp.intel.com>



> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, March 24, 2017 5:07 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Zhao1, Wei <wei.zhao1@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH 3/3] net/i40e: implement device reset on
> port
> 
> 
> >  /*
> >   * Structure to store private data specific for VF instance.
> >   */
> > @@ -708,6 +718,10 @@ struct i40e_adapter {
> >  	struct rte_timecounter systime_tc;
> >  	struct rte_timecounter rx_tstamp_tc;
> >  	struct rte_timecounter tx_tstamp_tc;
> > +
> > +	/* For VF reset */
> > +	volatile uint8_t reset_number;
> > +	void *reset_store_data;
> >  };
> 
> How to move it to i40_vf? Or it can be used for PF in future?

This is a legacy from wenzhuo's code, his code is design in this way. If this feature is be used by pf, locus of here is may be  reasonable?
 
> 
> 
> > +
> > +static int
> > +i40evf_store_before_reset(struct rte_eth_dev *dev) {
> > +	struct i40e_adapter *adapter =
> > +		I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> > +	struct i40e_vf_reset_store *store_data;
> > +	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data-
> > >dev_private);
> > +
> > +	adapter->reset_store_data = rte_zmalloc("i40evf_store_reset",
> > +					sizeof(struct i40e_vf_reset_store), 0);
> > +	if (adapter->reset_store_data == NULL) {
> > +		PMD_INIT_LOG(ERR, "Failed to allocate %ld bytes needed
> to"
> > +				" to store data when reset vf",
> > +				sizeof(struct i40e_vf_reset_store));
> > +		return -ENOMEM;
> > +	}
> i40evf_store_before_reset is allocated when reset happens.
> Don't forget to free it when reset is done. Otherwise memory leak.
> 
> The same as below mac_addrs.

Ok, I will add rte_free for them.

> > +	store_data =
> > +		(struct i40e_vf_reset_store *)adapter->reset_store_data;
> > +	store_data->mac_addrs = rte_zmalloc("i40evf_mac_store_reset",
> > +			ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX, 0);
> > +	if (store_data->mac_addrs == NULL) {
> > +		PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to"
> > +				" to store MAC addresses when reset vf",
> > +				ETHER_ADDR_LEN *
> > I40E_NUM_MACADDR_MAX);
> > +	}
> > +
> > +	memcpy(store_data->mac_addrs, dev->data->mac_addrs,
> > +			ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX);
> > +
> > +	store_data->promisc_unicast_enabled = vf-
> >promisc_unicast_enabled;
> > +	store_data->promisc_multicast_enabled = vf-
> > >promisc_multicast_enabled;
> > +
> > +	store_data->vlan_num = vf->vsi.vlan_num;
> > +	memcpy(store_data->vfta, vf->vsi.vfta,
> > +			sizeof(uint32_t) * I40E_VFTA_SIZE);
> > +
> > +	store_data->mac_num = vf->vsi.mac_num;
> > +
> > +	return 0;
> > +}
> 
> 
> 
> > +static int
> > +i40evf_handle_vf_reset(struct rte_eth_dev *dev) {
> > +	struct i40e_adapter *adapter =
> > +		I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> > +
> > +	if (!dev->data->dev_started)
> > +		return 0;
> > +
> I think even the dev is not started, we also need to reset it. Because the VF
> need to reconnect with PF.

Ok.
 
> > +	adapter->reset_number = 1;
> > +	i40e_vf_reset_dev(dev);
> > +	adapter->reset_number = 0;
> > +
> How to name the reset_number to resetting?
> 

I will change name to "adapter->reset_flag"

  reply	other threads:[~2017-03-27  6:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03  4:56 [dpdk-dev] [PATCH 0/3] net/i40e: vf port reset Wei Zhao
2017-03-03  4:56 ` [dpdk-dev] [PATCH 1/3] app/testpmd: add port reset command into testpmd Wei Zhao
2017-03-08 11:07   ` Ferruh Yigit
2017-03-14  7:58     ` Zhao1, Wei
2017-03-27  7:08       ` Zhao1, Wei
2017-03-03  4:56 ` [dpdk-dev] [PATCH 2/3] lib/librte_ether: add support for port reset Wei Zhao
2017-03-03  4:56 ` [dpdk-dev] [PATCH 3/3] net/i40e: implement device reset on port Wei Zhao
2017-03-08 11:20   ` Ferruh Yigit
2017-03-14  6:46     ` Zhao1, Wei
2017-03-24  8:31       ` Wu, Jingjing
2017-03-24  9:07   ` Wu, Jingjing
2017-03-27  6:10     ` Zhao1, Wei [this message]
2017-03-24  5:57 ` [dpdk-dev] [PATCH 0/3] net/i40e: vf port reset Wu, Jingjing
2017-03-27  6:17   ` Zhao1, Wei

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=A2573D2ACFCADC41BB3BE09C6DE313CA0205ADB7@PGSMSX103.gar.corp.intel.com \
    --to=wei.zhao1@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=wenzhuo.lu@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).