[dpdk-dev] weak functions in some drivers
Damjan Marion (damarion)
damarion at cisco.com
Tue Jun 21 17:01:20 CEST 2016
We just spent few hours troubleshooting why vPMD is not working
in i40e driver. Conclusion was that problem is caused by linker
linking the wrong instance of the i40e_rx_vec_dev_conf_condition_check(...).
That function is defined 2 times, once in i40e_rxtx.c and once in
i40e_rxtx_vec.c. First one is defined as weak and it just returns -1.
librte_pmd_i40e.a contains both versions:
$ objdump -x librte_pmd_i40e.a| grep i40e_rx_vec_dev_conf_condition_check
0000000000006ca0 w F .text 0000000000000006 i40e_rx_vec_dev_conf_condition_check
00000000000007c1 g F .text.unlikely 000000000000001c i40e_rx_vec_dev_conf_condition_check
However when we are linking our app, linker was picking 1st (weak) one and vPMD init was failing.
Workaround we applied to get int working: -Wl,--whole-archive <LIBS> -Wl,—no-whole-archive
What is not clear to me is motivation to use weak here instead of simply using CONFIG_RTE_I40E_INC_VECTOR
macro to exclude stubs in i40e_rxtx.c. It will make library smaller and avoid issues like this one
which are quite hard to troubleshoot.
BTW Looks like same issue is happening with fm10k driver.
More information about the dev