Blob Blame History Raw
From ab12f71b310c344a4903a7105ea79ff5b2c25a15 Mon Sep 17 00:00:00 2001
From: Ferruh Yigit <ferruh.yigit@intel.com>
Date: Tue, 31 Jan 2017 15:04:48 +0000
Subject: [PATCH] mk: move PMD libraries linking to applications

Some PMDs provide device specific APIs. Bond and xenvirt are existing
samples for this.

And since these are PMD libraries, there are two options on how to link
them for shared library build:

1- They can be linked to all applications by default, using common
rte.app.mk file.

2- They can be explicitly linked to applications that use device
specific API.

Currently option one is in use, this patch switches to the option two.

Moves library linking to the Makefile of application Makefile that uses
device specific API.

This prevent these PMD libraries to be a dependency to applications
that don't use these device specific APIs.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
JWL -- backported this to 16.11.2 base. Most differences from upstream
are contextual, but references to CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER
were removed due to lack of relevance to 16.11.2 base.

 app/test-pmd/Makefile  |    9 +++++++++
 app/test/Makefile      |   21 +++++++++++++++++----
 examples/bond/Makefile |    4 ++++
 mk/rte.app.mk          |    5 ++---
 4 files changed, 32 insertions(+), 7 deletions(-)

diff -up dpdk-stable-16.11.2/app/test-pmd/Makefile.pmd_ring dpdk-stable-16.11.2/app/test-pmd/Makefile
--- dpdk-stable-16.11.2/app/test-pmd/Makefile.pmd_ring	2017-05-31 03:20:05.000000000 -0400
+++ dpdk-stable-16.11.2/app/test-pmd/Makefile	2017-06-08 12:19:58.681959006 -0400
@@ -59,6 +59,11 @@ SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ 
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
+LDLIBS += -lrte_pmd_bond
+endif
+
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
 endif
 
@@ -69,4 +74,8 @@ DEPDIRS-y += lib drivers
 
 include $(RTE_SDK)/mk/rte.app.mk
 
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y)
+LDLIBS += -lrte_pmd_xenvirt
+endif
+
 endif
diff -up dpdk-stable-16.11.2/app/test/Makefile.pmd_ring dpdk-stable-16.11.2/app/test/Makefile
--- dpdk-stable-16.11.2/app/test/Makefile.pmd_ring	2017-05-31 03:20:05.000000000 -0400
+++ dpdk-stable-16.11.2/app/test/Makefile	2017-06-08 12:18:25.439330508 -0400
@@ -185,9 +185,6 @@ endif
 
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_NULL),y)
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding_rssconf.c
-ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
-LDLIBS += -lrte_pmd_null
-endif
 endif
 
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c
@@ -221,11 +218,27 @@ DEPDIRS-y += lib drivers
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
 ifneq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
 $(error Link bonding tests require CONFIG_RTE_LIBRTE_PMD_RING=y)
-else
+endif
+endif
+
 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
+LDLIBS += -lrte_pmd_bond
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_NULL),y)
+LDLIBS += -lrte_pmd_null
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
 LDLIBS += -lrte_pmd_ring
 endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER),y)
+LDLIBS += -lrte_pmd_crypto_scheduler
 endif
+
 endif
 
 ifeq ($(CONFIG_RTE_APP_TEST_RESOURCE_TAR),y)
diff -up dpdk-stable-16.11.2/examples/bond/Makefile.pmd_ring dpdk-stable-16.11.2/examples/bond/Makefile
--- dpdk-stable-16.11.2/examples/bond/Makefile.pmd_ring	2017-05-31 03:20:05.000000000 -0400
+++ dpdk-stable-16.11.2/examples/bond/Makefile	2017-06-08 12:18:25.440330526 -0400
@@ -54,4 +54,8 @@ endif
 
 CFLAGS += -O3
 
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+LDLIBS += -lrte_pmd_bond
+endif
+
 include $(RTE_SDK)/mk/rte.extapp.mk
diff -up dpdk-stable-16.11.2/mk/rte.app.mk.pmd_ring dpdk-stable-16.11.2/mk/rte.app.mk
--- dpdk-stable-16.11.2/mk/rte.app.mk.pmd_ring	2017-05-31 03:20:05.000000000 -0400
+++ dpdk-stable-16.11.2/mk/rte.app.mk	2017-06-08 12:22:48.458924188 -0400
@@ -99,15 +99,13 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE)        += -lrte_cmdline
 _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE)        += -lrte_cfgfile
 
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND)       += -lrte_pmd_bond
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT)    += -lrte_pmd_xenvirt -lxenstore
-
 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
 # plugins (link only if static libraries)
 
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET)  += -lrte_pmd_af_packet
 _LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lrte_pmd_bnx2x -lz
 _LDLIBS-$(CONFIG_RTE_LIBRTE_BNXT_PMD)       += -lrte_pmd_bnxt
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND)       += -lrte_pmd_bond
 _LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD)      += -lrte_pmd_cxgbe
 _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD)      += -lrte_pmd_e1000
 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD)        += -lrte_pmd_ena
@@ -130,6 +128,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST)      += -lrte_pmd_vhost
 endif # $(CONFIG_RTE_LIBRTE_VHOST)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD)    += -lrte_pmd_vmxnet3_uio
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT)    += -lrte_pmd_xenvirt -lxenstore
 
 ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)    += -lrte_pmd_aesni_mb