DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
To: jerin.jacob@caviumnetworks.com, lironh@marvell.com,
	bruce.richardson@intel.com, fiona.trahe@intel.com,
	shreyansh.jain@nxp.com, hemant.agrawal@nxp.com
Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Subject: [dpdk-dev]  [PATCH 2/2] octeontx: move mbox to common folder
Date: Mon, 19 Mar 2018 14:57:26 +0530	[thread overview]
Message-ID: <20180319092726.10153-2-pbhagavatula@caviumnetworks.com> (raw)
In-Reply-To: <20180319092726.10153-1-pbhagavatula@caviumnetworks.com>

Move commonly used functions across mempool, event and net devices to a
common folder in drivers.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 drivers/common/Makefile                            |  4 ++++
 drivers/common/meson.build                         |  1 +
 drivers/common/octeontx/Makefile                   | 25 ++++++++++++++++++++++
 drivers/common/octeontx/meson.build                |  8 +++++++
 .../{mempool => common}/octeontx/octeontx_mbox.c   | 12 ++++++++++-
 .../{mempool => common}/octeontx/octeontx_mbox.h   | 11 ++++++++++
 .../{mempool => common}/octeontx/octeontx_ssovf.c  |  1 -
 .../octeontx/rte_octeontx_common_version.map       |  7 ++++++
 drivers/event/octeontx/Makefile                    |  3 ++-
 drivers/event/octeontx/meson.build                 |  2 +-
 drivers/mempool/octeontx/Makefile                  |  5 ++---
 drivers/mempool/octeontx/meson.build               |  6 ++----
 drivers/mempool/octeontx/octeontx_fpavf.c          |  4 ----
 drivers/mempool/octeontx/octeontx_pool_logs.h      |  9 --------
 .../octeontx/rte_mempool_octeontx_version.map      |  6 ------
 drivers/net/octeontx/Makefile                      |  3 ++-
 mk/rte.app.mk                                      |  5 +++++
 17 files changed, 81 insertions(+), 31 deletions(-)
 create mode 100644 drivers/common/octeontx/Makefile
 create mode 100644 drivers/common/octeontx/meson.build
 rename drivers/{mempool => common}/octeontx/octeontx_mbox.c (95%)
 rename drivers/{mempool => common}/octeontx/octeontx_mbox.h (72%)
 rename drivers/{mempool => common}/octeontx/octeontx_ssovf.c (99%)
 create mode 100644 drivers/common/octeontx/rte_octeontx_common_version.map

diff --git a/drivers/common/Makefile b/drivers/common/Makefile
index 192066307..0fd223761 100644
--- a/drivers/common/Makefile
+++ b/drivers/common/Makefile
@@ -4,4 +4,8 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL),yy)
+DIRS-y += octeontx
+endif
+
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/common/meson.build b/drivers/common/meson.build
index 20d4a30ba..558fe7186 100644
--- a/drivers/common/meson.build
+++ b/drivers/common/meson.build
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Cavium, Inc
 
+drivers = ['octeontx']
 std_deps = ['bus_pci']
 config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
 driver_name_fmt = 'rte_@0@_common'
diff --git a/drivers/common/octeontx/Makefile b/drivers/common/octeontx/Makefile
new file mode 100644
index 000000000..1fe0ca35c
--- /dev/null
+++ b/drivers/common/octeontx/Makefile
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Cavium, Inc
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_octeontx_common.a
+
+CFLAGS += $(WERROR_FLAGS)
+EXPORT_MAP := rte_octeontx_common_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-y += octeontx_ssovf.c
+SRCS-y += octeontx_mbox.c
+
+LDLIBS += -lrte_eal -lrte_bus_pci
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/common/octeontx/meson.build b/drivers/common/octeontx/meson.build
new file mode 100644
index 000000000..654eb482e
--- /dev/null
+++ b/drivers/common/octeontx/meson.build
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Cavium, Inc
+#
+
+std_deps += ['bus_pci']
+sources = files('octeontx_mbox.c',
+		'octeontx_ssovf.c'
+)
diff --git a/drivers/mempool/octeontx/octeontx_mbox.c b/drivers/common/octeontx/octeontx_mbox.c
similarity index 95%
rename from drivers/mempool/octeontx/octeontx_mbox.c
rename to drivers/common/octeontx/octeontx_mbox.c
index f8cb6a453..23e90711c 100644
--- a/drivers/mempool/octeontx/octeontx_mbox.c
+++ b/drivers/common/octeontx/octeontx_mbox.c
@@ -11,7 +11,6 @@
 #include <rte_spinlock.h>
 
 #include "octeontx_mbox.h"
-#include "octeontx_pool_logs.h"
 
 /* Mbox operation timeout in seconds */
 #define MBOX_WAIT_TIME_SEC	3
@@ -60,6 +59,17 @@ struct mbox_ram_hdr {
 	};
 };
 
+int octeontx_logtype_mbox;
+
+RTE_INIT(otx_init_log);
+static void
+otx_init_log(void)
+{
+	octeontx_logtype_mbox = rte_log_register("pmd.octeontx.mbox");
+	if (octeontx_logtype_mbox >= 0)
+		rte_log_set_level(octeontx_logtype_mbox, RTE_LOG_NOTICE);
+}
+
 static inline void
 mbox_msgcpy(volatile uint8_t *d, volatile const uint8_t *s, uint16_t size)
 {
diff --git a/drivers/mempool/octeontx/octeontx_mbox.h b/drivers/common/octeontx/octeontx_mbox.h
similarity index 72%
rename from drivers/mempool/octeontx/octeontx_mbox.h
rename to drivers/common/octeontx/octeontx_mbox.h
index 1b056071a..f40b8fb5f 100644
--- a/drivers/mempool/octeontx/octeontx_mbox.h
+++ b/drivers/common/octeontx/octeontx_mbox.h
@@ -10,6 +10,17 @@
 #define SSOW_BAR4_LEN			(64 * 1024)
 #define SSO_VHGRP_PF_MBOX(x)		(0x200ULL | ((x) << 3))
 
+#define MBOX_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, octeontx_logtype_mbox,\
+			"%s() line %u: " fmt "\n", __func__, __LINE__, ## args)
+
+#define mbox_log_info(fmt, ...) MBOX_LOG(INFO, fmt, ##__VA_ARGS__)
+#define mbox_log_dbg(fmt, ...) MBOX_LOG(DEBUG, fmt, ##__VA_ARGS__)
+#define mbox_log_err(fmt, ...) MBOX_LOG(ERR, fmt, ##__VA_ARGS__)
+#define mbox_func_trace mbox_log_dbg
+
+extern int octeontx_logtype_mbox;
+
 struct octeontx_ssovf_info {
 	uint16_t domain; /* Domain id */
 	uint8_t total_ssovfs; /* Total sso groups available in domain */
diff --git a/drivers/mempool/octeontx/octeontx_ssovf.c b/drivers/common/octeontx/octeontx_ssovf.c
similarity index 99%
rename from drivers/mempool/octeontx/octeontx_ssovf.c
rename to drivers/common/octeontx/octeontx_ssovf.c
index 97b240665..778fb7f79 100644
--- a/drivers/mempool/octeontx/octeontx_ssovf.c
+++ b/drivers/common/octeontx/octeontx_ssovf.c
@@ -10,7 +10,6 @@
 #include <rte_bus_pci.h>
 
 #include "octeontx_mbox.h"
-#include "octeontx_pool_logs.h"
 
 #define PCI_VENDOR_ID_CAVIUM              0x177D
 #define PCI_DEVICE_ID_OCTEONTX_SSOGRP_VF  0xA04B
diff --git a/drivers/common/octeontx/rte_octeontx_common_version.map b/drivers/common/octeontx/rte_octeontx_common_version.map
new file mode 100644
index 000000000..cd9ddc9ac
--- /dev/null
+++ b/drivers/common/octeontx/rte_octeontx_common_version.map
@@ -0,0 +1,7 @@
+DPDK_17.11 {
+	global:
+
+	octeontx_ssovf_info;
+	octeontx_ssovf_bar;
+	octeontx_ssovf_mbox_send;
+};
diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile
index 0e49efd84..102cad08c 100644
--- a/drivers/event/octeontx/Makefile
+++ b/drivers/event/octeontx/Makefile
@@ -10,10 +10,11 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_octeontx_ssovf.a
 
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx/
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/
 CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/
 
-LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -lrte_pmd_octeontx
+LDLIBS += -lrte_eal -lrte_eventdev -lrte_octeontx_common -lrte_pmd_octeontx
 LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf -lrte_kvargs
 LDLIBS += -lrte_bus_vdev
 
diff --git a/drivers/event/octeontx/meson.build b/drivers/event/octeontx/meson.build
index 358fc9fc9..4d70ce2bb 100644
--- a/drivers/event/octeontx/meson.build
+++ b/drivers/event/octeontx/meson.build
@@ -6,4 +6,4 @@ sources = files('ssovf_worker.c',
 		'ssovf_evdev_selftest.c'
 )
 
-deps += ['mempool_octeontx', 'bus_vdev', 'pmd_octeontx']
+deps += ['octeontx_common', 'mempool_octeontx', 'bus_vdev', 'pmd_octeontx']
diff --git a/drivers/mempool/octeontx/Makefile b/drivers/mempool/octeontx/Makefile
index dfc373e62..7d12094bb 100644
--- a/drivers/mempool/octeontx/Makefile
+++ b/drivers/mempool/octeontx/Makefile
@@ -10,6 +10,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_mempool_octeontx.a
 
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx/
 EXPORT_MAP := rte_mempool_octeontx_version.map
 
 LIBABIVER := 1
@@ -17,8 +18,6 @@ LIBABIVER := 1
 #
 # all source are stored in SRCS-y
 #
-SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += octeontx_ssovf.c
-SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += octeontx_mbox.c
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += octeontx_fpavf.c
 SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += rte_mempool_octeontx.c
 
@@ -36,6 +35,6 @@ CFLAGS_rte_mempool_octeontx.o += -Ofast
 endif
 
 LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf
-LDLIBS += -lrte_bus_pci
+LDLIBS += -lrte_bus_pci -lrte_octeontx_common
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/mempool/octeontx/meson.build b/drivers/mempool/octeontx/meson.build
index 1e894a56b..86c2ba104 100644
--- a/drivers/mempool/octeontx/meson.build
+++ b/drivers/mempool/octeontx/meson.build
@@ -1,10 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Cavium, Inc
 
-sources = files('octeontx_ssovf.c',
-		'octeontx_mbox.c',
-		'octeontx_fpavf.c',
+sources = files('octeontx_fpavf.c',
 		'rte_mempool_octeontx.c'
 )
 
-deps += ['mbuf', 'bus_pci']
+deps += ['mbuf', 'bus_pci', 'octeontx_common']
diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c
index 61c72c7c8..85c361d20 100644
--- a/drivers/mempool/octeontx/octeontx_fpavf.c
+++ b/drivers/mempool/octeontx/octeontx_fpavf.c
@@ -115,10 +115,6 @@ otx_pool_init_log(void)
 	octeontx_logtype_fpavf = rte_log_register("pmd.mempool.octeontx");
 	if (octeontx_logtype_fpavf >= 0)
 		rte_log_set_level(octeontx_logtype_fpavf, RTE_LOG_NOTICE);
-
-	octeontx_logtype_fpavf_mbox = rte_log_register("pmd.mempool.octeontx.mbox");
-	if (octeontx_logtype_fpavf_mbox >= 0)
-		rte_log_set_level(octeontx_logtype_fpavf_mbox, RTE_LOG_NOTICE);
 }
 
 /* lock is taken by caller */
diff --git a/drivers/mempool/octeontx/octeontx_pool_logs.h b/drivers/mempool/octeontx/octeontx_pool_logs.h
index 958651924..7b4e1b387 100644
--- a/drivers/mempool/octeontx/octeontx_pool_logs.h
+++ b/drivers/mempool/octeontx/octeontx_pool_logs.h
@@ -11,21 +11,12 @@
 	rte_log(RTE_LOG_ ## level, octeontx_logtype_fpavf,\
 			"%s() line %u: " fmt "\n", __func__, __LINE__, ## args)
 
-#define MBOX_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, octeontx_logtype_fpavf_mbox,\
-			"%s() line %u: " fmt "\n", __func__, __LINE__, ## args)
-
 #define fpavf_log_info(fmt, ...) FPAVF_LOG(INFO, fmt, ##__VA_ARGS__)
 #define fpavf_log_dbg(fmt, ...) FPAVF_LOG(DEBUG, fmt, ##__VA_ARGS__)
 #define fpavf_log_err(fmt, ...) FPAVF_LOG(ERR, fmt, ##__VA_ARGS__)
 #define fpavf_func_trace fpavf_log_dbg
 
-#define mbox_log_info(fmt, ...) MBOX_LOG(INFO, fmt, ##__VA_ARGS__)
-#define mbox_log_dbg(fmt, ...) MBOX_LOG(DEBUG, fmt, ##__VA_ARGS__)
-#define mbox_log_err(fmt, ...) MBOX_LOG(ERR, fmt, ##__VA_ARGS__)
-#define mbox_func_trace mbox_log_dbg
 
 extern int octeontx_logtype_fpavf;
-extern int octeontx_logtype_fpavf_mbox;
 
 #endif /* __OCTEONTX_POOL_LOGS_H__*/
diff --git a/drivers/mempool/octeontx/rte_mempool_octeontx_version.map b/drivers/mempool/octeontx/rte_mempool_octeontx_version.map
index fe8cdeca0..a75303172 100644
--- a/drivers/mempool/octeontx/rte_mempool_octeontx_version.map
+++ b/drivers/mempool/octeontx/rte_mempool_octeontx_version.map
@@ -1,9 +1,3 @@
 DPDK_17.11 {
-	global:
-
-	octeontx_ssovf_info;
-	octeontx_ssovf_bar;
-	octeontx_ssovf_mbox_send;
-
 	local: *;
 };
diff --git a/drivers/net/octeontx/Makefile b/drivers/net/octeontx/Makefile
index 3e4a10662..efe38c4ac 100644
--- a/drivers/net/octeontx/Makefile
+++ b/drivers/net/octeontx/Makefile
@@ -10,6 +10,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_octeontx.a
 
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx/
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/
 
 EXPORT_MAP := rte_pmd_octeontx_version.map
@@ -46,7 +47,7 @@ endif
 CFLAGS_octeontx_ethdev.o += -DALLOW_EXPERIMENTAL_API
 
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
-LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_octeontx_common
 LDLIBS += -lrte_mempool_octeontx
 LDLIBS += -lrte_eventdev
 LDLIBS += -lrte_bus_pci
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 94525dc80..452020ac0 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -118,6 +118,7 @@ ifeq ($(CONFIG_RTE_EAL_VFIO),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS)      += -lrte_bus_fslmc
 endif
 
+
 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
 # plugins (link only if static libraries)
 
@@ -223,6 +224,10 @@ endif # CONFIG_RTE_LIBRTE_DPAA_BUS
 
 endif # CONFIG_RTE_LIBRTE_CRYPTODEV
 
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL),yy)
+_LDLIBS-y += -lrte_octeontx_common
+endif
+
 ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += -lrte_pmd_skeleton_event
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += -lrte_pmd_sw_event
-- 
2.16.2

  reply	other threads:[~2018-03-19  9:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19  9:27 [dpdk-dev] [PATCH 1/2] drivers: add " Pavan Nikhilesh
2018-03-19  9:27 ` Pavan Nikhilesh [this message]
2018-03-19 10:35 ` Shreyansh Jain
2018-03-20 14:38   ` Pavan Nikhilesh
2018-03-20 14:40 ` [dpdk-dev] [PATCH v2 " Pavan Nikhilesh
2018-03-20 14:40   ` [dpdk-dev] [PATCH v2 2/2] octeontx: move mbox to " Pavan Nikhilesh
2018-03-20 15:01     ` Hemant Agrawal
2018-03-20 16:00       ` Pavan Nikhilesh
2018-03-20 15:45   ` [dpdk-dev] [PATCH v2 1/2] drivers: add " Thomas Monjalon
2018-03-20 16:06     ` Pavan Nikhilesh
2018-03-20 17:01       ` Bruce Richardson
2018-03-20 17:27         ` Thomas Monjalon
2018-03-20 19:25           ` Trahe, Fiona
2018-03-26  7:53 ` [dpdk-dev] [PATCH v3 " Pavan Nikhilesh
2018-03-26  7:53   ` [dpdk-dev] [PATCH v3 2/2] octeontx: move mbox to " Pavan Nikhilesh
2018-03-27 16:15     ` Thomas Monjalon
2018-03-30 17:23       ` Pavan Nikhilesh
2018-03-27 16:11   ` [dpdk-dev] [PATCH v3 1/2] drivers: add " Thomas Monjalon
2018-04-02  9:09 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh
2018-04-02  9:10   ` [dpdk-dev] [PATCH v4 2/2] octeontx: move mbox to " Pavan Nikhilesh
2018-04-04  3:29     ` Jerin Jacob
2018-04-04  5:06       ` santosh
2018-04-04  9:23     ` Thomas Monjalon
2018-04-03  6:57   ` [dpdk-dev] [PATCH v4 1/2] drivers: add " Hemant Agrawal
2018-04-04  3:08     ` Jerin Jacob
2018-04-04  5:01   ` santosh
2018-04-04 14:30 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh
2018-04-04 14:30   ` [dpdk-dev] [PATCH v5 2/2] octeontx: move mbox to " Pavan Nikhilesh
2018-04-04 14:37     ` Thomas Monjalon
2018-04-04 21:20     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180319092726.10153-2-pbhagavatula@caviumnetworks.com \
    --to=pbhagavatula@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=lironh@marvell.com \
    --cc=shreyansh.jain@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).