Sometimes configuration and run time environment in PMD layer of a running port is changed and the port has to stop all bi-directional traffic and initialize the port device and restore its configurations and traffic again. Such this procedure can be regarded as restoration. Some customers found that in some VFN scenario a running port with i40e VF DPDK PMD has to be restored when the host PF with kernel driver need to reset the whole PF due to some reasons. For example, i40e HW may need a reset after reconfiguring a few key registers. Then PF host needs to Inform all VFs generated by that PF with the event of 'PF reset'. After VF driver see this event, VF driver needs to restore the VF port.
In order to make restoration as a common functionality of all PMD, based on current implementation of rte_ethdev, most of restoration work can be done in rte_ethdev layer with the settings stored in data structures in rte_ethdev layer. If some settings is not stored in rte_ethdev after they are configured before, they should be stored for restoration by adding data structure in rte_ethdev layer. Ethdev should also add a API like dev_restore( ) for PMD possible specific work in restoration process. The outline of restoration procedure is as follows. 1. rte_eth_dev_stop(port_id); 2. (*dev->dev_ops->dev_uninit)(dev); 3. (*dev->dev_ops->dev_init)(dev); 4. rte_eth_dev_configure(...); 5. rte_eth_dev_rx_queue_config(...) invoked for all Rx queues. 6. rte_eth_dev_tx_queue_config(...) invoked for all Tx queues; 7. rte_eth_start(port) 7.1 rte_eth_dev_config_restore(port); // need to be enhanced 8. (*dev->dev_ops->dev_restore)(dev); // doing PMD specific restoration Wei Dai (7): ethdev: add support of NIC restoration ethdev: add support of restoration of queue state ethdev: add support of restoration of port status ethdev: add support of MTU restoration ethdev: add support of restoration of multicast addr net/ixgbe: add support of restoration net/i40e: add support of restoration drivers/net/i40e/i40e_ethdev.c | 2 + drivers/net/i40e/i40e_ethdev_vf.c | 5 + drivers/net/ixgbe/ixgbe_ethdev.c | 4 + lib/librte_ether/rte_ethdev.c | 280 +++++++++++++++++++++++++++++++-- lib/librte_ether/rte_ethdev.h | 45 +++++- lib/librte_ether/rte_ether_version.map | 6 + 6 files changed, 326 insertions(+), 16 deletions(-) -- 2.7.4