examples: fix RSS hash function configuration
[dpdk.git] / examples / l3fwd-vf / main.c
index dd0e057..5edd91a 100644 (file)
@@ -161,7 +161,6 @@ static struct rte_eth_conf port_conf = {
                .mq_mode        = ETH_MQ_RX_RSS,
                .max_rx_pkt_len = ETHER_MAX_LEN,
                .split_hdr_size = 0,
-               .ignore_offload_bitfield = 1,
                .offloads = (DEV_RX_OFFLOAD_CRC_STRIP |
                             DEV_RX_OFFLOAD_CHECKSUM),
        },
@@ -949,7 +948,7 @@ main(int argc, char **argv)
        if (ret < 0)
                rte_exit(EXIT_FAILURE, "init_lcore_rx_queues failed\n");
 
-       nb_ports = rte_eth_dev_count();
+       nb_ports = rte_eth_dev_count_avail();
 
        if (check_port_config() < 0)
                rte_exit(EXIT_FAILURE, "check_port_config failed\n");
@@ -981,6 +980,18 @@ main(int argc, char **argv)
                if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
                                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+
+               local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
+                       dev_info.flow_type_rss_offloads;
+               if (local_port_conf.rx_adv_conf.rss_conf.rss_hf !=
+                               port_conf.rx_adv_conf.rss_conf.rss_hf) {
+                       printf("Port %u modified RSS hash function based on hardware support,"
+                               "requested:%#"PRIx64" configured:%#"PRIx64"\n",
+                               portid,
+                               port_conf.rx_adv_conf.rss_conf.rss_hf,
+                               local_port_conf.rx_adv_conf.rss_conf.rss_hf);
+               }
+
                ret = rte_eth_dev_configure(portid, nb_rx_queue,
                                            n_tx_queue, &local_port_conf);
                if (ret < 0)
@@ -1009,7 +1020,6 @@ main(int argc, char **argv)
                fflush(stdout);
 
                txconf = &dev_info.default_txconf;
-               txconf->txq_flags = ETH_TXQ_FLAGS_IGNORE;
                txconf->offloads = local_port_conf.txmode.offloads;
                ret = rte_eth_tx_queue_setup(portid, 0, nb_txd,
                                                 socketid, txconf);