10/04/2017 05:02, Wei Zhao: > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -1509,6 +1512,9 @@ struct eth_dev_ops { > eth_l2_tunnel_offload_set_t l2_tunnel_offload_set; > /** Enable/disable l2 tunnel offload functions. */ > > + /** Reset device. */ > + eth_dev_reset_t dev_reset; > + > eth_set_queue_rate_limit_t set_queue_rate_limit; /**< Set queue rate > limit. */ > > rss_hash_update_t rss_hash_update; /** Configure RSS hash
This new op should be added at the end of the structure to avoid ABI issue. > protocols. */ @@ -4413,6 +4419,28 @@ int > rte_eth_dev_get_name_by_port(uint8_t port_id, char *name); > > /** > + * 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. > + * Before calling this API, APP should stop the rx/tx. When tx is being > stopped, + * APP can drop the packets and release the buffer instead of > sending them. + * This function can also do some restore work for the port, > for example, it can + * restore the added parameters of vlan, mac_addrs, > promisc_unicast_enabled + * flag and promisc_multicast_enabled flag. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * > + * @return > + * - (0) if successful. > + * - (-ENODEV) if port identifier is invalid. > + * - (-ENOTSUP) if hardware doesn't support this function. > + */ > +int > +rte_eth_dev_reset(uint8_t port_id); The declarations and function definitions should be better placed after start and stop functions.