Hi, Thomas > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monja...@6wind.com] > Sent: Friday, April 14, 2017 2:31 PM > To: Zhao1, Wei <wei.zh...@intel.com> > Cc: Ananyev, Konstantin <konstantin.anan...@intel.com>; Mcnamara, John > <john.mcnam...@intel.com>; dev@dpdk.org; Lu, Wenzhuo > <wenzhuo...@intel.com> > Subject: Re: [dpdk-dev] [PATCH v4 1/3] lib/librte_ether: add support for port > reset > > 2017-04-14 01:29, Zhao1, Wei: > > From: Thomas Monjalon [mailto:thomas.monja...@6wind.com] > > > 2017-04-13 08:55, Zhao1, Wei: > > > > From: Ananyev, Konstantin > > > > > From: Zhao1, Wei > > > > > > From: Thomas Monjalon [mailto:thomas.monja...@6wind.com] > > > > > > > 2017-04-06 02:57, Zhao1, Wei: > > > > > > > > > /** > > > > > > > > > > + * Reset an ethernet device when it's not working. > > > > > > > > > > + One scenario is, after PF > > > > > > > > > > + * port is down and up, the related VF port should be > > > > > > > > > > reset. > > > > > > > > > > + * The API will stop the port, clear the rx/tx > > > > > > > > > > + queues, re-setup the rx/tx > > > > > > > > > > + * queues, restart the port. > > > > > > > > > > > > > > > > > > s/The API/This function/ > > > > > > > > > > > > > > > > > > Please explain exactly the responsibility of this > > > > > > > > > function, and how it is different from calling > stop/configure/start. > > > > > > > > > > > > > > > > In this reset feature, reset function can do the calling > > > > > > > > stop/configure/start process, but also It can also do some > > > > > > > > restore work for the port, for example, it can restore the > > > > > > > > added parameters of > > > > > > > vlan, mac_addrs, promisc_unicast_enabled falg and > > > > > > > promisc_multicast_enabled flag. > > > > > > > > > > Ok, but why start/stop can't do these things? > > > > > Konstantin > > > > > > > > This is because in i40e PMD code, start and stop process do not > > > > have the process of store and restore the added key parameters. > > > > Not only i40e but also other PMD code. So, in the function > > > > pointed to by dev_reset, > > > we add specific function do store and restore of some of the > > > important parameters listed above. > > > > > > Why store and restore cannot be implemented in start/stop functions? > > > > Because reset and start/stop are used for two purposes, for example: > > Some user maybe just start/stop the port and he do not care what key > > parameters has been configuration last time, and even worse when he > > want to clear all the configuration last time , if we add specific > > function do store and restore in that two function, it is useless for them, > and may cause a result that user do not expect. > > Is it said somewhere in the doc that the configuration is lost when stopping a > device? > Can we say which configuration parameter is kept and which one is lost? > > rte_eth_dev_config_restore() is called in rte_eth_dev_start().
Port reset process not only involve the rte_eth_dev_start() and rte_eth_dev_stop(). It also involve eth_dev_uninit() and eth_dev_init() process, in which PMD device uninit and init. In this case, for example, data->mac_addrs buffer is freed so it need to add store and restore function. BUT, if you only call stop/configure/start process, that is not strictly what named "device reset".