On Thu, Sep 5, 2019 at 4:54 PM Ferruh Yigit <ferruh.yi...@intel.com> wrote: > > 'rta_sec_era' global variable is defined in 'crypto/dpaa2_sec', > 'crypto/caam_jr' & 'crypto/dpaa_sec' PMDs with the same name. This means > they share same storage when application linked with static DPDK > library, which is not the intention. Three differing drivers sharing > same global variable is a defect. > > Variable has been used by multiple header files in static inline > functions and these header files are shared by all three PMDs, this > forces using same variable name in three PMDs. > > Since the variable is used only single .c file in 'crypto/dpaa2_sec' & > 'crypto/dpaa_sec' converting global variable to 'static', this requires > removing 'extern' definition from header files, and this requires moving > the global variable definition before including those headers in .c > files. > > For 'crypto/caam_jr' multiple .c files exists and includes these > headers which prevent making variable static, so only one file has the > global variable and others has 'extern' keyword on .c files. > > This change should let all three drivers have their own storage for the > 'rta_sec_era' global variable without multiple definitions. > > Fixes: 1d678de329ab ("crypto/caam_jr: add basic job ring routines") > Fixes: c3e85bdcc6e6 ("crypto/dpaa_sec: add crypto driver for NXP DPAA > platform") > Cc: sta...@dpdk.org
Hit a build issue, with gcc, static build: ../drivers/crypto/dpaa_sec/dpaa_sec.c:33:25: error: static declaration of ‘rta_sec_era’ follows non-static declaration 33 | static enum rta_sec_era rta_sec_era; | ^~~~~~~~~~~ In file included from ../drivers/crypto/dpaa_sec/../dpaa2_sec/hw/rta/sec_run_time_asm.h:10, from ../drivers/crypto/dpaa_sec/dpaa_sec.c:32: ../drivers/crypto/dpaa_sec/../dpaa2_sec/hw/desc.h:21:25: note: previous declaration of ‘rta_sec_era’ was here 21 | extern enum rta_sec_era rta_sec_era; | ^~~~~~~~~~~ And ../drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c:33:25: error: static declaration of ‘rta_sec_era’ follows non-static declaration 33 | static enum rta_sec_era rta_sec_era = RTA_SEC_ERA_8; | ^~~~~~~~~~~ In file included from ../drivers/crypto/dpaa2_sec/hw/rta/sec_run_time_asm.h:10, from ../drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c:32: ../drivers/crypto/dpaa2_sec/hw/desc.h:21:25: note: previous declaration of ‘rta_sec_era’ was here 21 | extern enum rta_sec_era rta_sec_era; | ^~~~~~~~~~~ [5/86] Compiling C object 'drivers/a715181@@tmp_rte_pmd_caam_jr@sta/crypto_caam_jr_caam_jr.c.o'. -- David Marchand