crypto/dpaa2_sec: add check for session validity
[dpdk.git] / lib / librte_ethdev / rte_ethdev.c
index 750bc9d..7743205 100644 (file)
@@ -37,8 +37,8 @@
 #include <rte_string_fns.h>
 #include <rte_kvargs.h>
 #include <rte_class.h>
+#include <rte_ether.h>
 
-#include "rte_ether.h"
 #include "rte_ethdev.h"
 #include "rte_ethdev_driver.h"
 #include "ethdev_profile.h"
@@ -1288,6 +1288,9 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
                goto rollback;
        }
 
+       dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf =
+               rte_eth_rss_hf_refine(dev_conf->rx_adv_conf.rss_conf.rss_hf);
+
        /* Check that device supports requested rss hash functions. */
        if ((dev_info.flow_type_rss_offloads |
             dev_conf->rx_adv_conf.rss_conf.rss_hf) !=
@@ -1949,12 +1952,13 @@ rte_eth_promiscuous_enable(uint16_t port_id)
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
        dev = &rte_eth_devices[port_id];
 
+       if (dev->data->promiscuous == 1)
+               return 0;
+
        RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
 
-       if (dev->data->promiscuous == 0) {
-               diag = (*dev->dev_ops->promiscuous_enable)(dev);
-               dev->data->promiscuous = (diag == 0) ? 1 : 0;
-       }
+       diag = (*dev->dev_ops->promiscuous_enable)(dev);
+       dev->data->promiscuous = (diag == 0) ? 1 : 0;
 
        return eth_err(port_id, diag);
 }
@@ -1968,14 +1972,15 @@ rte_eth_promiscuous_disable(uint16_t port_id)
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
        dev = &rte_eth_devices[port_id];
 
+       if (dev->data->promiscuous == 0)
+               return 0;
+
        RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
 
-       if (dev->data->promiscuous == 1) {
-               dev->data->promiscuous = 0;
-               diag = (*dev->dev_ops->promiscuous_disable)(dev);
-               if (diag != 0)
-                       dev->data->promiscuous = 1;
-       }
+       dev->data->promiscuous = 0;
+       diag = (*dev->dev_ops->promiscuous_disable)(dev);
+       if (diag != 0)
+               dev->data->promiscuous = 1;
 
        return eth_err(port_id, diag);
 }
@@ -3131,6 +3136,8 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
        if (ret != 0)
                return ret;
 
+       rss_conf->rss_hf = rte_eth_rss_hf_refine(rss_conf->rss_hf);
+
        dev = &rte_eth_devices[port_id];
        if ((dev_info.flow_type_rss_offloads | rss_conf->rss_hf) !=
            dev_info.flow_type_rss_offloads) {