These eth_dev_ops handlers should run only in the primary process.
- filter_ctrl
- reta_update
- rss_hash_update
- set_mc_addr_list
- udp_tunnel_port_add
- udp_tunnel_port_del

Fixes: c2fec27b5cb0 ("net/enic: allow to change RSS settings")
Fixes: 8d496995346c ("net/enic: support multicast filtering")
Fixes: 8a4efd17410c ("net/enic: add handlers to add/delete vxlan port number")
Cc: sta...@dpdk.org

Reported-by: Dirk-Holger Lenz <dirk.l...@ng4t.com>
Signed-off-by: Hyong Youb Kim <hyon...@cisco.com>
Tested-by: Dirk-Holger Lenz <dirk.l...@ng4t.com>
Reviewed-by: John Daley <johnd...@cisco.com>
---
 drivers/net/enic/enic_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 06dc67122..85d785e62 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -129,6 +129,8 @@ enicpmd_dev_filter_ctrl(struct rte_eth_dev *dev,
 {
        int ret = 0;
 
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return -E_RTE_SECONDARY;
        ENICPMD_FUNC_TRACE();
 
        switch (filter_type) {
@@ -710,6 +712,8 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev 
*eth_dev,
        uint32_t i, j;
        int ret;
 
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return -E_RTE_SECONDARY;
        ENICPMD_FUNC_TRACE();
 
        /* Validate the given addresses first */
@@ -826,6 +830,8 @@ static int enicpmd_dev_rss_reta_update(struct rte_eth_dev 
*dev,
        union vnic_rss_cpu rss_cpu;
        uint16_t i, idx, shift;
 
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return -E_RTE_SECONDARY;
        ENICPMD_FUNC_TRACE();
        if (reta_size != ENIC_RSS_RETA_SIZE) {
                dev_err(enic, "reta_update: wrong reta_size. given=%u"
@@ -854,6 +860,8 @@ static int enicpmd_dev_rss_hash_update(struct rte_eth_dev 
*dev,
 {
        struct enic *enic = pmd_priv(dev);
 
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return -E_RTE_SECONDARY;
        ENICPMD_FUNC_TRACE();
        return enic_set_rss_conf(enic, rss_conf);
 }
@@ -986,6 +994,8 @@ static int enicpmd_dev_udp_tunnel_port_add(struct 
rte_eth_dev *eth_dev,
        struct enic *enic = pmd_priv(eth_dev);
        int ret;
 
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return -E_RTE_SECONDARY;
        ENICPMD_FUNC_TRACE();
        ret = udp_tunnel_common_check(enic, tnl);
        if (ret)
@@ -1008,6 +1018,8 @@ static int enicpmd_dev_udp_tunnel_port_del(struct 
rte_eth_dev *eth_dev,
        struct enic *enic = pmd_priv(eth_dev);
        int ret;
 
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return -E_RTE_SECONDARY;
        ENICPMD_FUNC_TRACE();
        ret = udp_tunnel_common_check(enic, tnl);
        if (ret)
-- 
2.22.0

Reply via email to