app/testpmd: fix crash when attaching a device

Below commit checks global device information to determine if a port uses
the softnic driver once initialized. Problem is that this information is
not available at this point when a port is initialized interactively
through a "port attach XXX" command, crashing testpmd.

This patch systematically initializes global device information to address
this issue.

Fixes: 5b590fbe09 ("app/testpmd: add traffic management forwarding mode")
Cc: stable@dpdk.org

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
This commit is contained in:
Adrien Mazarguil 2018-06-13 18:27:43 +02:00 committed by Ferruh Yigit
parent 5936aa3a39
commit 422515b9aa

View File

@ -2355,16 +2355,15 @@ init_port_config(void)
{
portid_t pid;
struct rte_port *port;
struct rte_eth_dev_info dev_info;
RTE_ETH_FOREACH_DEV(pid) {
port = &ports[pid];
port->dev_conf.fdir_conf = fdir_conf;
rte_eth_dev_info_get(pid, &port->dev_info);
if (nb_rxq > 1) {
rte_eth_dev_info_get(pid, &dev_info);
port->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL;
port->dev_conf.rx_adv_conf.rss_conf.rss_hf =
rss_hf & dev_info.flow_type_rss_offloads;
rss_hf & port->dev_info.flow_type_rss_offloads;
} else {
port->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL;
port->dev_conf.rx_adv_conf.rss_conf.rss_hf = 0;