net/i40e: fix memory allocation for hash table
authorBeilei Xing <beilei.xing@intel.com>
Fri, 17 Feb 2017 08:37:56 +0000 (16:37 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 13:52:50 +0000 (15:52 +0200)
Testpmd failed to start in another hugetlbfs mount point on
i40e, the root cause is that hash table is always allocated
on socket 0.

Issue can be reproduced by forcing testpmd to allocate memory
only from node 1:

testpmd --socket-mem=0,8192 -- -i --socket-num=1

EAL: PCI device 0000:81:00.0 on NUMA socket 1
EAL:   probe driver: 8086:1572 net_i40e
PMD: eth_i40e_dev_init(): FW 4.40 API 1.4 NVM 04.05.03 eetrack 80001cd8
RING: Cannot reserve memory
HASH: memory allocation failed
PMD: i40e_init_ethtype_filter_list(): Failed to create ethertype hash
table!
EAL: Error - exiting with code: 1
  Cause: Requested device 0000:81:00.0 cannot be used

Fix the issue by assigning socket id during hash parameter definition.

Fixes: 5c53c82c8174 ("net/i40e: store flow director filter")
Fixes: 425c3325f0b0 ("net/i40e: store tunnel filter")
Fixes: 078259773da9 ("net/i40e: store ethertype filter")
Cc: stable@dpdk.org
Reported-by: Ivan Nardi <nardi.ivan@gmail.com>
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
drivers/net/i40e/i40e_ethdev.c

index f54a158..799de05 100644 (file)
@@ -901,6 +901,8 @@ i40e_init_ethtype_filter_list(struct rte_eth_dev *dev)
                .entries = I40E_MAX_ETHERTYPE_FILTER_NUM,
                .key_len = sizeof(struct i40e_ethertype_filter_input),
                .hash_func = rte_hash_crc,
+               .hash_func_init_val = 0,
+               .socket_id = rte_socket_id(),
        };
 
        /* Initialize ethertype filter rule list and hash */
@@ -944,6 +946,8 @@ i40e_init_tunnel_filter_list(struct rte_eth_dev *dev)
                .entries = I40E_MAX_TUNNEL_FILTER_NUM,
                .key_len = sizeof(struct i40e_tunnel_filter_input),
                .hash_func = rte_hash_crc,
+               .hash_func_init_val = 0,
+               .socket_id = rte_socket_id(),
        };
 
        /* Initialize tunnel filter rule list and hash */
@@ -987,6 +991,8 @@ i40e_init_fdir_filter_list(struct rte_eth_dev *dev)
                .entries = I40E_MAX_FDIR_FILTER_NUM,
                .key_len = sizeof(struct rte_eth_fdir_input),
                .hash_func = rte_hash_crc,
+               .hash_func_init_val = 0,
+               .socket_id = rte_socket_id(),
        };
 
        /* Initialize flow director filter rule list and hash */