* [dpdk-dev] [PATCH 1/2] drivers: add common folder @ 2018-03-19 9:27 Pavan Nikhilesh 2018-03-19 9:27 ` [dpdk-dev] [PATCH 2/2] octeontx: move mbox to " Pavan Nikhilesh ` (5 more replies) 0 siblings, 6 replies; 30+ messages in thread From: Pavan Nikhilesh @ 2018-03-19 9:27 UTC (permalink / raw) To: jerin.jacob, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev, Pavan Nikhilesh Add driver/common folder and skeleton makefile for adding commonly used functions across mempool, event and net devices. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- drivers/Makefile | 14 ++++++++------ drivers/common/Makefile | 7 +++++++ drivers/common/meson.build | 6 ++++++ drivers/meson.build | 9 +++++---- 4 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 drivers/common/Makefile create mode 100644 drivers/common/meson.build diff --git a/drivers/Makefile b/drivers/Makefile index ee65c87b0..bd83ad9f3 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -4,17 +4,19 @@ include $(RTE_SDK)/mk/rte.vars.mk DIRS-y += bus +DIRS-y += common +DEPDIRS-common := bus DIRS-y += mempool -DEPDIRS-mempool := bus +DEPDIRS-mempool := bus common DIRS-y += net -DEPDIRS-net := bus mempool +DEPDIRS-net := bus common mempool DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += bbdev -DEPDIRS-bbdev := bus mempool +DEPDIRS-bbdev := bus common mempool DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto -DEPDIRS-crypto := bus mempool +DEPDIRS-crypto := bus common mempool DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event -DEPDIRS-event := bus mempool net +DEPDIRS-event := bus common mempool net DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw -DEPDIRS-raw := bus mempool net event +DEPDIRS-raw := bus common mempool net event include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/Makefile b/drivers/common/Makefile new file mode 100644 index 000000000..192066307 --- /dev/null +++ b/drivers/common/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +include $(RTE_SDK)/mk/rte.vars.mk + +include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/meson.build b/drivers/common/meson.build new file mode 100644 index 000000000..20d4a30ba --- /dev/null +++ b/drivers/common/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc + +std_deps = ['bus_pci'] +config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' +driver_name_fmt = 'rte_@0@_common' diff --git a/drivers/meson.build b/drivers/meson.build index b41a0f18e..9494e5d76 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -3,10 +3,11 @@ # Defines the order in which the drivers are buit. driver_classes = ['bus', - 'mempool', # depends on bus. - 'net', # depends on bus and mempool. - 'crypto', # depenss on bus, mempool (net in future). - 'event'] # depends on bus, mempool and net. + 'common', # depends on bus. + 'mempool', # depends on bus and common. + 'net', # depends on bus, common and mempool. + 'crypto', # depenss on bus, common and mempool (net in future). + 'event'] # depends on bus, common, mempool and net. foreach class:driver_classes drivers = [] -- 2.16.2 ^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH 2/2] octeontx: move mbox to common folder 2018-03-19 9:27 [dpdk-dev] [PATCH 1/2] drivers: add common folder Pavan Nikhilesh @ 2018-03-19 9:27 ` Pavan Nikhilesh 2018-03-19 10:35 ` [dpdk-dev] [PATCH 1/2] drivers: add " Shreyansh Jain ` (4 subsequent siblings) 5 siblings, 0 replies; 30+ messages in thread From: Pavan Nikhilesh @ 2018-03-19 9:27 UTC (permalink / raw) To: jerin.jacob, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev, Pavan Nikhilesh 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 ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] drivers: add common folder 2018-03-19 9:27 [dpdk-dev] [PATCH 1/2] drivers: add common folder Pavan Nikhilesh 2018-03-19 9:27 ` [dpdk-dev] [PATCH 2/2] octeontx: move mbox to " Pavan Nikhilesh @ 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 ` (3 subsequent siblings) 5 siblings, 1 reply; 30+ messages in thread From: Shreyansh Jain @ 2018-03-19 10:35 UTC (permalink / raw) To: Pavan Nikhilesh Cc: jerin.jacob, lironh, Bruce Richardson, fiona.trahe, Hemant Agrawal, dev Hi Pavan, On Mon, Mar 19, 2018 at 2:57 PM, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> wrote: > Add driver/common folder and skeleton makefile for adding commonly used > functions across mempool, event and net devices. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > --- > drivers/Makefile | 14 ++++++++------ > drivers/common/Makefile | 7 +++++++ > drivers/common/meson.build | 6 ++++++ > drivers/meson.build | 9 +++++---- > 4 files changed, 26 insertions(+), 10 deletions(-) > create mode 100644 drivers/common/Makefile > create mode 100644 drivers/common/meson.build > > diff --git a/drivers/Makefile b/drivers/Makefile > index ee65c87b0..bd83ad9f3 100644 > --- a/drivers/Makefile > +++ b/drivers/Makefile > @@ -4,17 +4,19 @@ > include $(RTE_SDK)/mk/rte.vars.mk > > DIRS-y += bus > +DIRS-y += common > +DEPDIRS-common := bus Why should common be dependent on bus? Shouldn't common be independent in itself? > DIRS-y += mempool > -DEPDIRS-mempool := bus > +DEPDIRS-mempool := bus common > DIRS-y += net > -DEPDIRS-net := bus mempool > +DEPDIRS-net := bus common mempool > DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += bbdev > -DEPDIRS-bbdev := bus mempool > +DEPDIRS-bbdev := bus common mempool > DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto > -DEPDIRS-crypto := bus mempool > +DEPDIRS-crypto := bus common mempool > DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event > -DEPDIRS-event := bus mempool net > +DEPDIRS-event := bus common mempool net > DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw > -DEPDIRS-raw := bus mempool net event > +DEPDIRS-raw := bus common mempool net event [...] - Shreyansh ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] drivers: add common folder 2018-03-19 10:35 ` [dpdk-dev] [PATCH 1/2] drivers: add " Shreyansh Jain @ 2018-03-20 14:38 ` Pavan Nikhilesh 0 siblings, 0 replies; 30+ messages in thread From: Pavan Nikhilesh @ 2018-03-20 14:38 UTC (permalink / raw) To: Shreyansh Jain, jerin.jacob, lironh, Bruce Richardson, fiona.trahe, Hemant Agrawal Cc: dev Hi Shreyansh, On Mon, Mar 19, 2018 at 04:05:13PM +0530, Shreyansh Jain wrote: > Hi Pavan, > > On Mon, Mar 19, 2018 at 2:57 PM, Pavan Nikhilesh > <pbhagavatula@caviumnetworks.com> wrote: > > Add driver/common folder and skeleton makefile for adding commonly used > > functions across mempool, event and net devices. > > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > --- > > drivers/Makefile | 14 ++++++++------ > > drivers/common/Makefile | 7 +++++++ > > drivers/common/meson.build | 6 ++++++ > > drivers/meson.build | 9 +++++---- > > 4 files changed, 26 insertions(+), 10 deletions(-) > > create mode 100644 drivers/common/Makefile > > create mode 100644 drivers/common/meson.build > > > > diff --git a/drivers/Makefile b/drivers/Makefile > > index ee65c87b0..bd83ad9f3 100644 > > --- a/drivers/Makefile > > +++ b/drivers/Makefile > > @@ -4,17 +4,19 @@ > > include $(RTE_SDK)/mk/rte.vars.mk > > > > DIRS-y += bus > > +DIRS-y += common > > +DEPDIRS-common := bus > > Why should common be dependent on bus? Shouldn't common be independent > in itself? Yup will send out v2 soon. > > > DIRS-y += mempool > > -DEPDIRS-mempool := bus > > +DEPDIRS-mempool := bus common > > DIRS-y += net > > -DEPDIRS-net := bus mempool > > +DEPDIRS-net := bus common mempool > > DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += bbdev > > -DEPDIRS-bbdev := bus mempool > > +DEPDIRS-bbdev := bus common mempool > > DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto > > -DEPDIRS-crypto := bus mempool > > +DEPDIRS-crypto := bus common mempool > > DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event > > -DEPDIRS-event := bus mempool net > > +DEPDIRS-event := bus common mempool net > > DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw > > -DEPDIRS-raw := bus mempool net event > > +DEPDIRS-raw := bus common mempool net event > > [...] > > - > Shreyansh Thanks, Pavan. ^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH v2 1/2] drivers: add common folder 2018-03-19 9:27 [dpdk-dev] [PATCH 1/2] drivers: add common folder Pavan Nikhilesh 2018-03-19 9:27 ` [dpdk-dev] [PATCH 2/2] octeontx: move mbox to " Pavan Nikhilesh 2018-03-19 10:35 ` [dpdk-dev] [PATCH 1/2] drivers: add " Shreyansh Jain @ 2018-03-20 14:40 ` Pavan Nikhilesh 2018-03-20 14:40 ` [dpdk-dev] [PATCH v2 2/2] octeontx: move mbox to " Pavan Nikhilesh 2018-03-20 15:45 ` [dpdk-dev] [PATCH v2 1/2] drivers: add " Thomas Monjalon 2018-03-26 7:53 ` [dpdk-dev] [PATCH v3 " Pavan Nikhilesh ` (2 subsequent siblings) 5 siblings, 2 replies; 30+ messages in thread From: Pavan Nikhilesh @ 2018-03-20 14:40 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev, Pavan Nikhilesh Add driver/common folder and skeleton makefile for adding commonly used functions across mempool, event and net devices. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- v2 Changes: - Removed dependency on bus. drivers/Makefile | 13 +++++++------ drivers/common/Makefile | 7 +++++++ drivers/common/meson.build | 5 +++++ drivers/meson.build | 11 ++++++----- 4 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 drivers/common/Makefile create mode 100644 drivers/common/meson.build diff --git a/drivers/Makefile b/drivers/Makefile index ee65c87b0..d279c4892 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -3,18 +3,19 @@ include $(RTE_SDK)/mk/rte.vars.mk +DIRS-y += common DIRS-y += bus DIRS-y += mempool -DEPDIRS-mempool := bus +DEPDIRS-mempool := bus common DIRS-y += net -DEPDIRS-net := bus mempool +DEPDIRS-net := bus common mempool DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += bbdev -DEPDIRS-bbdev := bus mempool +DEPDIRS-bbdev := bus common mempool DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto -DEPDIRS-crypto := bus mempool +DEPDIRS-crypto := bus common mempool DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event -DEPDIRS-event := bus mempool net +DEPDIRS-event := bus common mempool net DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw -DEPDIRS-raw := bus mempool net event +DEPDIRS-raw := bus common mempool net event include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/Makefile b/drivers/common/Makefile new file mode 100644 index 000000000..192066307 --- /dev/null +++ b/drivers/common/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +include $(RTE_SDK)/mk/rte.vars.mk + +include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/meson.build b/drivers/common/meson.build new file mode 100644 index 000000000..9c2565f00 --- /dev/null +++ b/drivers/common/meson.build @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc + +config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' +driver_name_fmt = 'rte_@0@_common' diff --git a/drivers/meson.build b/drivers/meson.build index b41a0f18e..5a0b5bc34 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -2,11 +2,12 @@ # Copyright(c) 2017 Intel Corporation # Defines the order in which the drivers are buit. -driver_classes = ['bus', - 'mempool', # depends on bus. - 'net', # depends on bus and mempool. - 'crypto', # depenss on bus, mempool (net in future). - 'event'] # depends on bus, mempool and net. +driver_classes = ['common', + 'bus', + 'mempool', # depends on bus and common. + 'net', # depends on bus, common and mempool. + 'crypto', # depenss on bus, common and mempool (net in future). + 'event'] # depends on bus, common, mempool and net. foreach class:driver_classes drivers = [] -- 2.16.2 ^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] octeontx: move mbox to common folder 2018-03-20 14:40 ` [dpdk-dev] [PATCH v2 " Pavan Nikhilesh @ 2018-03-20 14:40 ` Pavan Nikhilesh 2018-03-20 15:01 ` Hemant Agrawal 2018-03-20 15:45 ` [dpdk-dev] [PATCH v2 1/2] drivers: add " Thomas Monjalon 1 sibling, 1 reply; 30+ messages in thread From: Pavan Nikhilesh @ 2018-03-20 14:40 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev, Pavan Nikhilesh 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 | 24 ++++++++ drivers/common/octeontx/meson.build | 6 ++ .../{mempool => common}/octeontx/octeontx_mbox.c | 65 +++++++++++++++++----- .../{mempool => common}/octeontx/octeontx_mbox.h | 14 +++++ .../octeontx/rte_octeontx_common_version.map | 9 +++ drivers/event/octeontx/Makefile | 4 +- drivers/event/octeontx/meson.build | 5 +- .../{mempool => event}/octeontx/octeontx_ssovf.c | 20 ++++++- 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 | 4 ++ 17 files changed, 144 insertions(+), 45 deletions(-) create mode 100644 drivers/common/octeontx/Makefile create mode 100644 drivers/common/octeontx/meson.build rename drivers/{mempool => common}/octeontx/octeontx_mbox.c (83%) rename drivers/{mempool => common}/octeontx/octeontx_mbox.h (66%) create mode 100644 drivers/common/octeontx/rte_octeontx_common_version.map rename drivers/{mempool => event}/octeontx/octeontx_ssovf.c (92%) 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 9c2565f00..fcb3617d0 100644 --- a/drivers/common/meson.build +++ b/drivers/common/meson.build @@ -1,5 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Cavium, Inc +drivers = ['octeontx'] 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..62b021f4a --- /dev/null +++ b/drivers/common/octeontx/Makefile @@ -0,0 +1,24 @@ +# 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_mbox.c + +LDLIBS += -lrte_eal + +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..8a28ce800 --- /dev/null +++ b/drivers/common/octeontx/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +sources = files('octeontx_mbox.c' +) diff --git a/drivers/mempool/octeontx/octeontx_mbox.c b/drivers/common/octeontx/octeontx_mbox.c similarity index 83% rename from drivers/mempool/octeontx/octeontx_mbox.c rename to drivers/common/octeontx/octeontx_mbox.c index f8cb6a453..c98e110f3 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) { @@ -181,22 +191,49 @@ mbox_send(struct mbox *m, struct octeontx_mbox_hdr *hdr, const void *txmsg, return res; } -static inline int -mbox_setup(struct mbox *m) +int +octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base) +{ + struct mbox *m = &octeontx_mbox; + + if (m->init_once) + return -EALREADY; + + if (ram_mbox_base == NULL) { + mbox_log_err("Invalid ram_mbox_base=%p", ram_mbox_base); + return -EINVAL; + } + + m->ram_mbox_base = ram_mbox_base; + + if (m->reg != NULL) { + rte_spinlock_init(&m->lock); + m->init_once = 1; + } + + return 0; +} + +int +octeontx_mbox_set_reg(uint8_t *reg) { - if (unlikely(m->init_once == 0)) { + struct mbox *m = &octeontx_mbox; + + if (m->init_once) + return -EALREADY; + + if (reg == NULL) { + mbox_log_err("Invalid reg=%p", reg); + return -EINVAL; + } + + m->reg = reg; + + if (m->ram_mbox_base != NULL) { rte_spinlock_init(&m->lock); - m->ram_mbox_base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); - m->reg = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); - m->reg += SSO_VHGRP_PF_MBOX(1); - - if (m->ram_mbox_base == NULL || m->reg == NULL) { - mbox_log_err("Invalid ram_mbox_base=%p or reg=%p", - m->ram_mbox_base, m->reg); - return -EINVAL; - } m->init_once = 1; } + return 0; } @@ -207,7 +244,7 @@ octeontx_ssovf_mbox_send(struct octeontx_mbox_hdr *hdr, void *txdata, struct mbox *m = &octeontx_mbox; RTE_BUILD_BUG_ON(sizeof(struct mbox_ram_hdr) != 8); - if (rte_eal_process_type() != RTE_PROC_PRIMARY || mbox_setup(m)) + if (rte_eal_process_type() != RTE_PROC_PRIMARY) return -EINVAL; return mbox_send(m, hdr, txdata, txlen, rxdata, rxlen); diff --git a/drivers/mempool/octeontx/octeontx_mbox.h b/drivers/common/octeontx/octeontx_mbox.h similarity index 66% rename from drivers/mempool/octeontx/octeontx_mbox.h rename to drivers/common/octeontx/octeontx_mbox.h index 1b056071a..52fae4ef9 100644 --- a/drivers/mempool/octeontx/octeontx_mbox.h +++ b/drivers/common/octeontx/octeontx_mbox.h @@ -6,10 +6,22 @@ #define __OCTEONTX_MBOX_H__ #include <rte_common.h> +#include <rte_spinlock.h> #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 */ @@ -30,6 +42,8 @@ struct octeontx_mbox_hdr { int octeontx_ssovf_info(struct octeontx_ssovf_info *info); void *octeontx_ssovf_bar(enum octeontx_ssovf_type, uint8_t id, uint8_t bar); +int octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base); +int octeontx_mbox_set_reg(uint8_t *reg); int octeontx_ssovf_mbox_send(struct octeontx_mbox_hdr *hdr, void *txdata, uint16_t txlen, void *rxdata, uint16_t rxlen); 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..ca3a815a7 --- /dev/null +++ b/drivers/common/octeontx/rte_octeontx_common_version.map @@ -0,0 +1,9 @@ +DPDK_18.02 { + global: + + octeontx_ssovf_info; + octeontx_ssovf_bar; + octeontx_mbox_set_ram_mbox_base; + octeontx_mbox_set_reg; + octeontx_ssovf_mbox_send; +}; diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index 0e49efd84..097608061 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 @@ -27,6 +28,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev_selftest.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx_ssovf.c ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_ssovf_worker.o += -fno-prefetch-loop-arrays diff --git a/drivers/event/octeontx/meson.build b/drivers/event/octeontx/meson.build index 358fc9fc9..c5e88dfd8 100644 --- a/drivers/event/octeontx/meson.build +++ b/drivers/event/octeontx/meson.build @@ -3,7 +3,8 @@ sources = files('ssovf_worker.c', 'ssovf_evdev.c', - 'ssovf_evdev_selftest.c' + 'ssovf_evdev_selftest.c', + 'octeontx_ssovf.c' ) -deps += ['mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] +deps += ['octeontx_common', 'mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] diff --git a/drivers/mempool/octeontx/octeontx_ssovf.c b/drivers/event/octeontx/octeontx_ssovf.c similarity index 92% rename from drivers/mempool/octeontx/octeontx_ssovf.c rename to drivers/event/octeontx/octeontx_ssovf.c index 97b240665..c32b49a01 100644 --- a/drivers/mempool/octeontx/octeontx_ssovf.c +++ b/drivers/event/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 @@ -142,6 +141,7 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) uint16_t vfid; struct ssowvf_res *res; struct ssowvf_identify *id; + uint8_t *ram_mbox_base; RTE_SET_USED(pci_drv); @@ -180,6 +180,14 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) res->domain = id->domain; sdev.total_ssowvfs++; + if (!vfid) { + ram_mbox_base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); + if (octeontx_mbox_set_ram_mbox_base(ram_mbox_base)) { + mbox_log_err("Invalid Failed to set ram mbox base"); + return -EINVAL; + } + } + rte_wmb(); mbox_log_dbg("Domain=%d hws=%d total_ssowvfs=%d", res->domain, res->vfid, sdev.total_ssowvfs); @@ -213,6 +221,7 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) uint16_t vfid; uint8_t *idreg; struct ssovf_res *res; + uint8_t *reg; RTE_SET_USED(pci_drv); @@ -246,6 +255,15 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) res->domain = val & 0xffff; sdev.total_ssovfs++; + if (!vfid) { + reg = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); + reg += SSO_VHGRP_PF_MBOX(1); + if (octeontx_mbox_set_reg(reg)) { + mbox_log_err("Invalid Failed to set mbox_reg"); + return -EINVAL; + } + } + rte_wmb(); mbox_log_dbg("Domain=%d group=%d total_ssovfs=%d", res->domain, res->vfid, sdev.total_ssovfs); 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..4bcc4bbf0 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -223,6 +223,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 ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] octeontx: move mbox to common folder 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 0 siblings, 1 reply; 30+ messages in thread From: Hemant Agrawal @ 2018-03-20 15:01 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev HI Pavan, One quick comment On 3/20/2018 8:10 PM, Pavan Nikhilesh wrote: > -LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -lrte_pmd_octeontx > +LDLIBS += -lrte_eal -lrte_eventdev -lrte_octeontx_common -lrte_pmd_octeontx Typically the naming convention for driver based libraries is "rte_type_specific" e.g. rte_mempool_octeontx. rte_octeontx_common is breaking the tradition. Regards, Hemant ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] octeontx: move mbox to common folder 2018-03-20 15:01 ` Hemant Agrawal @ 2018-03-20 16:00 ` Pavan Nikhilesh 0 siblings, 0 replies; 30+ messages in thread From: Pavan Nikhilesh @ 2018-03-20 16:00 UTC (permalink / raw) To: Hemant Agrawal, jerin.jacob, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain Cc: dev Hi Hemant, On Tue, Mar 20, 2018 at 08:31:42PM +0530, Hemant Agrawal wrote: > > HI Pavan, > One quick comment > > On 3/20/2018 8:10 PM, Pavan Nikhilesh wrote: > > -LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -lrte_pmd_octeontx > > +LDLIBS += -lrte_eal -lrte_eventdev -lrte_octeontx_common -lrte_pmd_octeontx > Typically the naming convention for driver based libraries is > "rte_type_specific" e.g. rte_mempool_octeontx. > rte_octeontx_common is breaking the tradition. Currently, meson uses that scheme where as traditional make uses rte_mempool_octeontx style. I will change it to rte_common_octeontx for traditional make in v3. <meson> config_flag_fmt = 'RTE_LIBRTE_@0@_MEMPOOL' driver_name_fmt = 'rte_mempool_@0@' > > Regards, > Hemant Thanks, Pavan. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] drivers: add common folder 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:45 ` Thomas Monjalon 2018-03-20 16:06 ` Pavan Nikhilesh 1 sibling, 1 reply; 30+ messages in thread From: Thomas Monjalon @ 2018-03-20 15:45 UTC (permalink / raw) To: Pavan Nikhilesh Cc: jerin.jacob, santosh.shukla, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal, dev 20/03/2018 15:40, Pavan Nikhilesh: > Add driver/common folder and skeleton makefile for adding commonly used > functions across mempool, event and net devices. I am not sure there is a real benefit of introducing such new directory. Is it only solving the choice of where you add files used by several drivers? Is drivers/bus/X/ the directory of choice for platform shared files? ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] drivers: add common folder 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 0 siblings, 1 reply; 30+ messages in thread From: Pavan Nikhilesh @ 2018-03-20 16:06 UTC (permalink / raw) To: Thomas Monjalon, jerin.jacob, santosh.shukla, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev Hi Thomas, On Tue, Mar 20, 2018 at 04:45:47PM +0100, Thomas Monjalon wrote: > 20/03/2018 15:40, Pavan Nikhilesh: > > Add driver/common folder and skeleton makefile for adding commonly used > > functions across mempool, event and net devices. > > I am not sure there is a real benefit of introducing such new directory. > Is it only solving the choice of where you add files used > by several drivers? > Is drivers/bus/X/ the directory of choice for platform shared files? drivers/bus doesn't seem to be a appropriate abstraction common API's used across multiple PMD's. This change is in regards with the discussion on ml: http://dpdk.org/ml/archives/dev/2018-March/092822.html drivers/common seems to be a popular opinion but maybe we could use something like drivers/SoC or if you have something in mind please suggest. Thanks, Pavan. > > > ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] drivers: add common folder 2018-03-20 16:06 ` Pavan Nikhilesh @ 2018-03-20 17:01 ` Bruce Richardson 2018-03-20 17:27 ` Thomas Monjalon 0 siblings, 1 reply; 30+ messages in thread From: Bruce Richardson @ 2018-03-20 17:01 UTC (permalink / raw) To: Pavan Nikhilesh Cc: Thomas Monjalon, jerin.jacob, santosh.shukla, anatoly.burakov, lironh, fiona.trahe, shreyansh.jain, hemant.agrawal, dev On Tue, Mar 20, 2018 at 09:36:25PM +0530, Pavan Nikhilesh wrote: > Hi Thomas, > > On Tue, Mar 20, 2018 at 04:45:47PM +0100, Thomas Monjalon wrote: > > 20/03/2018 15:40, Pavan Nikhilesh: > > > Add driver/common folder and skeleton makefile for adding commonly > > > used functions across mempool, event and net devices. > > > > I am not sure there is a real benefit of introducing such new > > directory. Is it only solving the choice of where you add files used > > by several drivers? Is drivers/bus/X/ the directory of choice for > > platform shared files? > > drivers/bus doesn't seem to be a appropriate abstraction common API's > used across multiple PMD's. > > This change is in regards with the discussion on ml: > http://dpdk.org/ml/archives/dev/2018-March/092822.html > > drivers/common seems to be a popular opinion but maybe we could use > something like drivers/SoC or if you have something in mind please > suggest. > I think drivers/common is a better solution as it's not just platform buses or SoC's that this occurs with. Even PCI devices can export multiple functions, such as in the QAT case, which leads to the case where you have shared code between different driver classes. I don't think the PCI bus driver is a good place to put QAT shared code. :-) ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] drivers: add common folder 2018-03-20 17:01 ` Bruce Richardson @ 2018-03-20 17:27 ` Thomas Monjalon 2018-03-20 19:25 ` Trahe, Fiona 0 siblings, 1 reply; 30+ messages in thread From: Thomas Monjalon @ 2018-03-20 17:27 UTC (permalink / raw) To: Bruce Richardson Cc: Pavan Nikhilesh, jerin.jacob, santosh.shukla, anatoly.burakov, lironh, fiona.trahe, shreyansh.jain, hemant.agrawal, dev 20/03/2018 18:01, Bruce Richardson: > On Tue, Mar 20, 2018 at 09:36:25PM +0530, Pavan Nikhilesh wrote: > > Hi Thomas, > > > > On Tue, Mar 20, 2018 at 04:45:47PM +0100, Thomas Monjalon wrote: > > > 20/03/2018 15:40, Pavan Nikhilesh: > > > > Add driver/common folder and skeleton makefile for adding commonly > > > > used functions across mempool, event and net devices. > > > > > > I am not sure there is a real benefit of introducing such new > > > directory. Is it only solving the choice of where you add files used > > > by several drivers? Is drivers/bus/X/ the directory of choice for > > > platform shared files? > > > > drivers/bus doesn't seem to be a appropriate abstraction common API's > > used across multiple PMD's. > > > > This change is in regards with the discussion on ml: > > http://dpdk.org/ml/archives/dev/2018-March/092822.html > > > > drivers/common seems to be a popular opinion but maybe we could use > > something like drivers/SoC or if you have something in mind please > > suggest. > > > I think drivers/common is a better solution as it's not just platform buses > or SoC's that this occurs with. Even PCI devices can export multiple > functions, such as in the QAT case, which leads to the case where you have > shared code between different driver classes. I don't think the PCI bus > driver is a good place to put QAT shared code. :-) If drivers X and Y share some code, it is possible to link files from X directory in Y library. If we want a more explicit and separate directory for shared code, what would be the name of the sub-directories? drivers/common/qat? drivers/common/octeontx? drivers/common/marvell? drivers/common/mellanox? ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] drivers: add common folder 2018-03-20 17:27 ` Thomas Monjalon @ 2018-03-20 19:25 ` Trahe, Fiona 0 siblings, 0 replies; 30+ messages in thread From: Trahe, Fiona @ 2018-03-20 19:25 UTC (permalink / raw) To: Thomas Monjalon, Richardson, Bruce Cc: Pavan Nikhilesh, jerin.jacob, santosh.shukla, Burakov, Anatoly, lironh, shreyansh.jain, hemant.agrawal, dev, Trahe, Fiona > -----Original Message----- > From: Thomas Monjalon [mailto:thomas@monjalon.net] > Sent: Tuesday, March 20, 2018 5:28 PM > To: Richardson, Bruce <bruce.richardson@intel.com> > Cc: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>; jerin.jacob@caviumnetworks.com; > santosh.shukla@caviumnetworks.com; Burakov, Anatoly <anatoly.burakov@intel.com>; > lironh@marvell.com; Trahe, Fiona <fiona.trahe@intel.com>; shreyansh.jain@nxp.com; > hemant.agrawal@nxp.com; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 1/2] drivers: add common folder > > 20/03/2018 18:01, Bruce Richardson: > > On Tue, Mar 20, 2018 at 09:36:25PM +0530, Pavan Nikhilesh wrote: > > > Hi Thomas, > > > > > > On Tue, Mar 20, 2018 at 04:45:47PM +0100, Thomas Monjalon wrote: > > > > 20/03/2018 15:40, Pavan Nikhilesh: > > > > > Add driver/common folder and skeleton makefile for adding commonly > > > > > used functions across mempool, event and net devices. > > > > > > > > I am not sure there is a real benefit of introducing such new > > > > directory. Is it only solving the choice of where you add files used > > > > by several drivers? Is drivers/bus/X/ the directory of choice for > > > > platform shared files? > > > > > > drivers/bus doesn't seem to be a appropriate abstraction common API's > > > used across multiple PMD's. > > > > > > This change is in regards with the discussion on ml: > > > http://dpdk.org/ml/archives/dev/2018-March/092822.html > > > > > > drivers/common seems to be a popular opinion but maybe we could use > > > something like drivers/SoC or if you have something in mind please > > > suggest. > > > > > I think drivers/common is a better solution as it's not just platform buses > > or SoC's that this occurs with. Even PCI devices can export multiple > > functions, such as in the QAT case, which leads to the case where you have > > shared code between different driver classes. I don't think the PCI bus > > driver is a good place to put QAT shared code. :-) > > If drivers X and Y share some code, it is possible to link files from > X directory in Y library. > > If we want a more explicit and separate directory for shared code, > what would be the name of the sub-directories? > drivers/common/qat? > drivers/common/octeontx? > drivers/common/marvell? > drivers/common/mellanox? > [Fiona] Yes. We plan to add drivers/common/qat. ^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH v3 1/2] drivers: add common folder 2018-03-19 9:27 [dpdk-dev] [PATCH 1/2] drivers: add common folder Pavan Nikhilesh ` (2 preceding siblings ...) 2018-03-20 14:40 ` [dpdk-dev] [PATCH v2 " Pavan Nikhilesh @ 2018-03-26 7:53 ` Pavan Nikhilesh 2018-03-26 7:53 ` [dpdk-dev] [PATCH v3 2/2] octeontx: move mbox to " 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-04 14:30 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh 5 siblings, 2 replies; 30+ messages in thread From: Pavan Nikhilesh @ 2018-03-26 7:53 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev, Pavan Nikhilesh Add driver/common folder and skeleton makefile for adding commonly used functions across mempool, event and net devices. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- v3 Changes: - Fix common lib naming scheme. v2 Changes: - Removed dependency on bus. Based on discussion on ml http://dpdk.org/ml/archives/dev/2018-March/092822.html http://dpdk.org/ml/archives/dev/2018-March/093271.html drivers/Makefile | 13 +++++++------ drivers/common/Makefile | 7 +++++++ drivers/common/meson.build | 6 ++++++ drivers/meson.build | 11 ++++++----- 4 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 drivers/common/Makefile create mode 100644 drivers/common/meson.build diff --git a/drivers/Makefile b/drivers/Makefile index ee65c87b0..d279c4892 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -3,18 +3,19 @@ include $(RTE_SDK)/mk/rte.vars.mk +DIRS-y += common DIRS-y += bus DIRS-y += mempool -DEPDIRS-mempool := bus +DEPDIRS-mempool := bus common DIRS-y += net -DEPDIRS-net := bus mempool +DEPDIRS-net := bus common mempool DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += bbdev -DEPDIRS-bbdev := bus mempool +DEPDIRS-bbdev := bus common mempool DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto -DEPDIRS-crypto := bus mempool +DEPDIRS-crypto := bus common mempool DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event -DEPDIRS-event := bus mempool net +DEPDIRS-event := bus common mempool net DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw -DEPDIRS-raw := bus mempool net event +DEPDIRS-raw := bus common mempool net event include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/Makefile b/drivers/common/Makefile new file mode 100644 index 000000000..192066307 --- /dev/null +++ b/drivers/common/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +include $(RTE_SDK)/mk/rte.vars.mk + +include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/meson.build b/drivers/common/meson.build new file mode 100644 index 000000000..ab774b8ef --- /dev/null +++ b/drivers/common/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc + +std_deps = ['eal'] +config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' +driver_name_fmt = 'rte_common_@0@' diff --git a/drivers/meson.build b/drivers/meson.build index b41a0f18e..5a0b5bc34 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -2,11 +2,12 @@ # Copyright(c) 2017 Intel Corporation # Defines the order in which the drivers are buit. -driver_classes = ['bus', - 'mempool', # depends on bus. - 'net', # depends on bus and mempool. - 'crypto', # depenss on bus, mempool (net in future). - 'event'] # depends on bus, mempool and net. +driver_classes = ['common', + 'bus', + 'mempool', # depends on bus and common. + 'net', # depends on bus, common and mempool. + 'crypto', # depenss on bus, common and mempool (net in future). + 'event'] # depends on bus, common, mempool and net. foreach class:driver_classes drivers = [] -- 2.16.2 ^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH v3 2/2] octeontx: move mbox to common folder 2018-03-26 7:53 ` [dpdk-dev] [PATCH v3 " Pavan Nikhilesh @ 2018-03-26 7:53 ` Pavan Nikhilesh 2018-03-27 16:15 ` Thomas Monjalon 2018-03-27 16:11 ` [dpdk-dev] [PATCH v3 1/2] drivers: add " Thomas Monjalon 1 sibling, 1 reply; 30+ messages in thread From: Pavan Nikhilesh @ 2018-03-26 7:53 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev, Pavan Nikhilesh 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 | 24 ++++++++ drivers/common/octeontx/meson.build | 6 ++ .../{mempool => common}/octeontx/octeontx_mbox.c | 65 +++++++++++++++++----- .../{mempool => common}/octeontx/octeontx_mbox.h | 14 +++++ .../octeontx/rte_common_octeontx_version.map | 9 +++ drivers/event/octeontx/Makefile | 4 +- drivers/event/octeontx/meson.build | 5 +- .../{mempool => event}/octeontx/octeontx_ssovf.c | 20 ++++++- 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 | 4 ++ 17 files changed, 144 insertions(+), 45 deletions(-) create mode 100644 drivers/common/octeontx/Makefile create mode 100644 drivers/common/octeontx/meson.build rename drivers/{mempool => common}/octeontx/octeontx_mbox.c (83%) rename drivers/{mempool => common}/octeontx/octeontx_mbox.h (66%) create mode 100644 drivers/common/octeontx/rte_common_octeontx_version.map rename drivers/{mempool => event}/octeontx/octeontx_ssovf.c (92%) 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 ab774b8ef..5f6341b8f 100644 --- a/drivers/common/meson.build +++ b/drivers/common/meson.build @@ -2,5 +2,6 @@ # Copyright(c) 2018 Cavium, Inc std_deps = ['eal'] +drivers = ['octeontx'] config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' driver_name_fmt = 'rte_common_@0@' diff --git a/drivers/common/octeontx/Makefile b/drivers/common/octeontx/Makefile new file mode 100644 index 000000000..dfdb9f196 --- /dev/null +++ b/drivers/common/octeontx/Makefile @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_common_octeontx.a + +CFLAGS += $(WERROR_FLAGS) +EXPORT_MAP := rte_common_octeontx_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-y += octeontx_mbox.c + +LDLIBS += -lrte_eal + +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..8a28ce800 --- /dev/null +++ b/drivers/common/octeontx/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +sources = files('octeontx_mbox.c' +) diff --git a/drivers/mempool/octeontx/octeontx_mbox.c b/drivers/common/octeontx/octeontx_mbox.c similarity index 83% rename from drivers/mempool/octeontx/octeontx_mbox.c rename to drivers/common/octeontx/octeontx_mbox.c index f8cb6a453..c98e110f3 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) { @@ -181,22 +191,49 @@ mbox_send(struct mbox *m, struct octeontx_mbox_hdr *hdr, const void *txmsg, return res; } -static inline int -mbox_setup(struct mbox *m) +int +octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base) +{ + struct mbox *m = &octeontx_mbox; + + if (m->init_once) + return -EALREADY; + + if (ram_mbox_base == NULL) { + mbox_log_err("Invalid ram_mbox_base=%p", ram_mbox_base); + return -EINVAL; + } + + m->ram_mbox_base = ram_mbox_base; + + if (m->reg != NULL) { + rte_spinlock_init(&m->lock); + m->init_once = 1; + } + + return 0; +} + +int +octeontx_mbox_set_reg(uint8_t *reg) { - if (unlikely(m->init_once == 0)) { + struct mbox *m = &octeontx_mbox; + + if (m->init_once) + return -EALREADY; + + if (reg == NULL) { + mbox_log_err("Invalid reg=%p", reg); + return -EINVAL; + } + + m->reg = reg; + + if (m->ram_mbox_base != NULL) { rte_spinlock_init(&m->lock); - m->ram_mbox_base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); - m->reg = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); - m->reg += SSO_VHGRP_PF_MBOX(1); - - if (m->ram_mbox_base == NULL || m->reg == NULL) { - mbox_log_err("Invalid ram_mbox_base=%p or reg=%p", - m->ram_mbox_base, m->reg); - return -EINVAL; - } m->init_once = 1; } + return 0; } @@ -207,7 +244,7 @@ octeontx_ssovf_mbox_send(struct octeontx_mbox_hdr *hdr, void *txdata, struct mbox *m = &octeontx_mbox; RTE_BUILD_BUG_ON(sizeof(struct mbox_ram_hdr) != 8); - if (rte_eal_process_type() != RTE_PROC_PRIMARY || mbox_setup(m)) + if (rte_eal_process_type() != RTE_PROC_PRIMARY) return -EINVAL; return mbox_send(m, hdr, txdata, txlen, rxdata, rxlen); diff --git a/drivers/mempool/octeontx/octeontx_mbox.h b/drivers/common/octeontx/octeontx_mbox.h similarity index 66% rename from drivers/mempool/octeontx/octeontx_mbox.h rename to drivers/common/octeontx/octeontx_mbox.h index 1b056071a..52fae4ef9 100644 --- a/drivers/mempool/octeontx/octeontx_mbox.h +++ b/drivers/common/octeontx/octeontx_mbox.h @@ -6,10 +6,22 @@ #define __OCTEONTX_MBOX_H__ #include <rte_common.h> +#include <rte_spinlock.h> #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 */ @@ -30,6 +42,8 @@ struct octeontx_mbox_hdr { int octeontx_ssovf_info(struct octeontx_ssovf_info *info); void *octeontx_ssovf_bar(enum octeontx_ssovf_type, uint8_t id, uint8_t bar); +int octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base); +int octeontx_mbox_set_reg(uint8_t *reg); int octeontx_ssovf_mbox_send(struct octeontx_mbox_hdr *hdr, void *txdata, uint16_t txlen, void *rxdata, uint16_t rxlen); diff --git a/drivers/common/octeontx/rte_common_octeontx_version.map b/drivers/common/octeontx/rte_common_octeontx_version.map new file mode 100644 index 000000000..59dbed5b2 --- /dev/null +++ b/drivers/common/octeontx/rte_common_octeontx_version.map @@ -0,0 +1,9 @@ +DPDK_18.05 { + global: + + octeontx_ssovf_info; + octeontx_ssovf_bar; + octeontx_mbox_set_ram_mbox_base; + octeontx_mbox_set_reg; + octeontx_ssovf_mbox_send; +}; diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index 0e49efd84..34dcb844c 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_common_octeontx -lrte_pmd_octeontx LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf -lrte_kvargs LDLIBS += -lrte_bus_vdev @@ -27,6 +28,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev_selftest.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx_ssovf.c ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_ssovf_worker.o += -fno-prefetch-loop-arrays diff --git a/drivers/event/octeontx/meson.build b/drivers/event/octeontx/meson.build index 358fc9fc9..1181f337b 100644 --- a/drivers/event/octeontx/meson.build +++ b/drivers/event/octeontx/meson.build @@ -3,7 +3,8 @@ sources = files('ssovf_worker.c', 'ssovf_evdev.c', - 'ssovf_evdev_selftest.c' + 'ssovf_evdev_selftest.c', + 'octeontx_ssovf.c' ) -deps += ['mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] +deps += ['common_octeontx', 'mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] diff --git a/drivers/mempool/octeontx/octeontx_ssovf.c b/drivers/event/octeontx/octeontx_ssovf.c similarity index 92% rename from drivers/mempool/octeontx/octeontx_ssovf.c rename to drivers/event/octeontx/octeontx_ssovf.c index 97b240665..c32b49a01 100644 --- a/drivers/mempool/octeontx/octeontx_ssovf.c +++ b/drivers/event/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 @@ -142,6 +141,7 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) uint16_t vfid; struct ssowvf_res *res; struct ssowvf_identify *id; + uint8_t *ram_mbox_base; RTE_SET_USED(pci_drv); @@ -180,6 +180,14 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) res->domain = id->domain; sdev.total_ssowvfs++; + if (!vfid) { + ram_mbox_base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); + if (octeontx_mbox_set_ram_mbox_base(ram_mbox_base)) { + mbox_log_err("Invalid Failed to set ram mbox base"); + return -EINVAL; + } + } + rte_wmb(); mbox_log_dbg("Domain=%d hws=%d total_ssowvfs=%d", res->domain, res->vfid, sdev.total_ssowvfs); @@ -213,6 +221,7 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) uint16_t vfid; uint8_t *idreg; struct ssovf_res *res; + uint8_t *reg; RTE_SET_USED(pci_drv); @@ -246,6 +255,15 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) res->domain = val & 0xffff; sdev.total_ssovfs++; + if (!vfid) { + reg = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); + reg += SSO_VHGRP_PF_MBOX(1); + if (octeontx_mbox_set_reg(reg)) { + mbox_log_err("Invalid Failed to set mbox_reg"); + return -EINVAL; + } + } + rte_wmb(); mbox_log_dbg("Domain=%d group=%d total_ssovfs=%d", res->domain, res->vfid, sdev.total_ssovfs); diff --git a/drivers/mempool/octeontx/Makefile b/drivers/mempool/octeontx/Makefile index dfc373e62..a3e1dce88 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_common_octeontx include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/octeontx/meson.build b/drivers/mempool/octeontx/meson.build index 1e894a56b..3baaf7db2 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', 'common_octeontx'] 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..885f17684 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_common_octeontx LDLIBS += -lrte_mempool_octeontx LDLIBS += -lrte_eventdev LDLIBS += -lrte_bus_pci diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 3eb41d176..c18f6a6a2 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -217,6 +217,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_common_octeontx +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 ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v3 2/2] octeontx: move mbox to common folder 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 0 siblings, 1 reply; 30+ messages in thread From: Thomas Monjalon @ 2018-03-27 16:15 UTC (permalink / raw) To: Pavan Nikhilesh Cc: dev, jerin.jacob, santosh.shukla, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Hi, 26/03/2018 09:53, Pavan Nikhilesh: > 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 | 24 ++++++++ > drivers/common/octeontx/meson.build | 6 ++ > .../{mempool => common}/octeontx/octeontx_mbox.c | 65 +++++++++++++++++----- > .../{mempool => common}/octeontx/octeontx_mbox.h | 14 +++++ > .../octeontx/rte_common_octeontx_version.map | 9 +++ > drivers/event/octeontx/Makefile | 4 +- > drivers/event/octeontx/meson.build | 5 +- > .../{mempool => event}/octeontx/octeontx_ssovf.c | 20 ++++++- > 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 +- You need to update MAINTAINERS for this new directory. > --- a/mk/rte.app.mk > +++ b/mk/rte.app.mk > @@ -217,6 +217,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_common_octeontx > +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 It is strange to insert common lib in the middle of PMDs after crypto and before eventdev, in the "static-only" section. I think it should be just after bus libs. Please test static and shared library compilation. Thanks ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v3 2/2] octeontx: move mbox to common folder 2018-03-27 16:15 ` Thomas Monjalon @ 2018-03-30 17:23 ` Pavan Nikhilesh 0 siblings, 0 replies; 30+ messages in thread From: Pavan Nikhilesh @ 2018-03-30 17:23 UTC (permalink / raw) To: Thomas Monjalon, jerin.jacob, santosh.shukla, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev Hi Thomas, Thanks for the comments, will send out v4 soon addressing the comments. I have verified static and shared builds already and everything seems to be good. Pavan On Tue, Mar 27, 2018 at 06:15:56PM +0200, Thomas Monjalon wrote: > Hi, > > 26/03/2018 09:53, Pavan Nikhilesh: > > 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 | 24 ++++++++ > > drivers/common/octeontx/meson.build | 6 ++ > > .../{mempool => common}/octeontx/octeontx_mbox.c | 65 +++++++++++++++++----- > > .../{mempool => common}/octeontx/octeontx_mbox.h | 14 +++++ > > .../octeontx/rte_common_octeontx_version.map | 9 +++ > > drivers/event/octeontx/Makefile | 4 +- > > drivers/event/octeontx/meson.build | 5 +- > > .../{mempool => event}/octeontx/octeontx_ssovf.c | 20 ++++++- > > 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 +- > > You need to update MAINTAINERS for this new directory. > > > --- a/mk/rte.app.mk > > +++ b/mk/rte.app.mk > > @@ -217,6 +217,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_common_octeontx > > +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 > > It is strange to insert common lib in the middle of PMDs after crypto > and before eventdev, in the "static-only" section. > I think it should be just after bus libs. > > Please test static and shared library compilation. > > Thanks > > ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/2] drivers: add common folder 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:11 ` Thomas Monjalon 1 sibling, 0 replies; 30+ messages in thread From: Thomas Monjalon @ 2018-03-27 16:11 UTC (permalink / raw) To: Pavan Nikhilesh Cc: dev, jerin.jacob, santosh.shukla, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal 26/03/2018 09:53, Pavan Nikhilesh: > --- a/drivers/Makefile > +++ b/drivers/Makefile > @@ -3,18 +3,19 @@ > > include $(RTE_SDK)/mk/rte.vars.mk > > +DIRS-y += common > DIRS-y += bus > DIRS-y += mempool > -DEPDIRS-mempool := bus > +DEPDIRS-mempool := bus common > DIRS-y += net > -DEPDIRS-net := bus mempool > +DEPDIRS-net := bus common mempool > DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += bbdev > -DEPDIRS-bbdev := bus mempool > +DEPDIRS-bbdev := bus common mempool > DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto > -DEPDIRS-crypto := bus mempool > +DEPDIRS-crypto := bus common mempool > DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event > -DEPDIRS-event := bus mempool net > +DEPDIRS-event := bus common mempool net > DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw > -DEPDIRS-raw := bus mempool net event > +DEPDIRS-raw := bus common mempool net event > --- a/drivers/meson.build > +++ b/drivers/meson.build > @@ -2,11 +2,12 @@ > # Copyright(c) 2017 Intel Corporation > > # Defines the order in which the drivers are buit. > -driver_classes = ['bus', > - 'mempool', # depends on bus. > - 'net', # depends on bus and mempool. > - 'crypto', # depenss on bus, mempool (net in future). > - 'event'] # depends on bus, mempool and net. > +driver_classes = ['common', > + 'bus', > + 'mempool', # depends on bus and common. > + 'net', # depends on bus, common and mempool. > + 'crypto', # depenss on bus, common and mempool (net in future). > + 'event'] # depends on bus, common, mempool and net. It seems you used alphabetical order to list dependencies in the Makefile and in meson.build. I think it would be more logical to have common before bus in dependencies. You can also take the opportunity to fix the typo on "depenss". Thanks ^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH v4 1/2] drivers: add common folder 2018-03-19 9:27 [dpdk-dev] [PATCH 1/2] drivers: add common folder Pavan Nikhilesh ` (3 preceding siblings ...) 2018-03-26 7:53 ` [dpdk-dev] [PATCH v3 " Pavan Nikhilesh @ 2018-04-02 9:09 ` Pavan Nikhilesh 2018-04-02 9:10 ` [dpdk-dev] [PATCH v4 2/2] octeontx: move mbox to " Pavan Nikhilesh ` (2 more replies) 2018-04-04 14:30 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh 5 siblings, 3 replies; 30+ messages in thread From: Pavan Nikhilesh @ 2018-04-02 9:09 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev, Pavan Nikhilesh Add driver/common folder and skeleton makefile for adding commonly used functions across mempool, event and net devices. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- v4 Changes: - modified dependency order i.e common before bus. - updated MAINTAINERS file. - moved linking common lib in rte.app.mk above bus. v3 Changes: - Fix common lib naming scheme. v2 Changes: - Removed dependency on bus. Based on discussion on ml http://dpdk.org/ml/archives/dev/2018-March/092822.html http://dpdk.org/ml/archives/dev/2018-March/093271.html drivers/Makefile | 13 +++++++------ drivers/common/Makefile | 7 +++++++ drivers/common/meson.build | 6 ++++++ drivers/meson.build | 11 ++++++----- 4 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 drivers/common/Makefile create mode 100644 drivers/common/meson.build diff --git a/drivers/Makefile b/drivers/Makefile index a1fa8b917..3d9f86b00 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -3,18 +3,19 @@ include $(RTE_SDK)/mk/rte.vars.mk +DIRS-y += common DIRS-y += bus DIRS-y += mempool -DEPDIRS-mempool := bus +DEPDIRS-mempool := common bus DIRS-y += net -DEPDIRS-net := bus mempool +DEPDIRS-net := common bus mempool DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += baseband -DEPDIRS-baseband := bus mempool +DEPDIRS-baseband := common bus mempool DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto -DEPDIRS-crypto := bus mempool +DEPDIRS-crypto := common bus mempool DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event -DEPDIRS-event := bus mempool net +DEPDIRS-event := common bus mempool net DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw -DEPDIRS-raw := bus mempool net event +DEPDIRS-raw := common bus mempool net event include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/Makefile b/drivers/common/Makefile new file mode 100644 index 000000000..192066307 --- /dev/null +++ b/drivers/common/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +include $(RTE_SDK)/mk/rte.vars.mk + +include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/meson.build b/drivers/common/meson.build new file mode 100644 index 000000000..ab774b8ef --- /dev/null +++ b/drivers/common/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc + +std_deps = ['eal'] +config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' +driver_name_fmt = 'rte_common_@0@' diff --git a/drivers/meson.build b/drivers/meson.build index b41a0f18e..b146f09c5 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -2,11 +2,12 @@ # Copyright(c) 2017 Intel Corporation # Defines the order in which the drivers are buit. -driver_classes = ['bus', - 'mempool', # depends on bus. - 'net', # depends on bus and mempool. - 'crypto', # depenss on bus, mempool (net in future). - 'event'] # depends on bus, mempool and net. +driver_classes = ['common', + 'bus', + 'mempool', # depends on common and bus. + 'net', # depends on common, bus and mempool. + 'crypto', # depends on common, bus and mempool (net in future). + 'event'] # depends on common, bus, mempool and net. foreach class:driver_classes drivers = [] -- 2.16.2 ^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH v4 2/2] octeontx: move mbox to common folder 2018-04-02 9:09 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh @ 2018-04-02 9:10 ` Pavan Nikhilesh 2018-04-04 3:29 ` Jerin Jacob 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 5:01 ` santosh 2 siblings, 2 replies; 30+ messages in thread From: Pavan Nikhilesh @ 2018-04-02 9:10 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev, Pavan Nikhilesh Move commonly used functions across mempool, event and net devices to a common folder in drivers. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> --- MAINTAINERS | 1 + drivers/common/Makefile | 4 ++ drivers/common/meson.build | 1 + drivers/common/octeontx/Makefile | 24 ++++++++ drivers/common/octeontx/meson.build | 6 ++ .../{mempool => common}/octeontx/octeontx_mbox.c | 65 +++++++++++++++++----- .../{mempool => common}/octeontx/octeontx_mbox.h | 14 +++++ .../octeontx/rte_common_octeontx_version.map | 9 +++ drivers/event/octeontx/Makefile | 4 +- drivers/event/octeontx/meson.build | 5 +- .../{mempool => event}/octeontx/octeontx_ssovf.c | 20 ++++++- 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 | 4 ++ 18 files changed, 145 insertions(+), 45 deletions(-) create mode 100644 drivers/common/octeontx/Makefile create mode 100644 drivers/common/octeontx/meson.build rename drivers/{mempool => common}/octeontx/octeontx_mbox.c (83%) rename drivers/{mempool => common}/octeontx/octeontx_mbox.h (66%) create mode 100644 drivers/common/octeontx/rte_common_octeontx_version.map rename drivers/{mempool => event}/octeontx/octeontx_ssovf.c (92%) diff --git a/MAINTAINERS b/MAINTAINERS index d4c0cc1bc..ed3251da7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -412,6 +412,7 @@ F: doc/guides/nics/features/liquidio.ini Cavium OcteonTX M: Santosh Shukla <santosh.shukla@caviumnetworks.com> M: Jerin Jacob <jerin.jacob@caviumnetworks.com> +F: drivers/common/octeontx/ F: drivers/mempool/octeontx/ F: drivers/net/octeontx/ F: doc/guides/nics/octeontx.rst 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 ab774b8ef..5f6341b8f 100644 --- a/drivers/common/meson.build +++ b/drivers/common/meson.build @@ -2,5 +2,6 @@ # Copyright(c) 2018 Cavium, Inc std_deps = ['eal'] +drivers = ['octeontx'] config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' driver_name_fmt = 'rte_common_@0@' diff --git a/drivers/common/octeontx/Makefile b/drivers/common/octeontx/Makefile new file mode 100644 index 000000000..dfdb9f196 --- /dev/null +++ b/drivers/common/octeontx/Makefile @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_common_octeontx.a + +CFLAGS += $(WERROR_FLAGS) +EXPORT_MAP := rte_common_octeontx_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-y += octeontx_mbox.c + +LDLIBS += -lrte_eal + +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..8a28ce800 --- /dev/null +++ b/drivers/common/octeontx/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +sources = files('octeontx_mbox.c' +) diff --git a/drivers/mempool/octeontx/octeontx_mbox.c b/drivers/common/octeontx/octeontx_mbox.c similarity index 83% rename from drivers/mempool/octeontx/octeontx_mbox.c rename to drivers/common/octeontx/octeontx_mbox.c index f8cb6a453..c98e110f3 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) { @@ -181,22 +191,49 @@ mbox_send(struct mbox *m, struct octeontx_mbox_hdr *hdr, const void *txmsg, return res; } -static inline int -mbox_setup(struct mbox *m) +int +octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base) +{ + struct mbox *m = &octeontx_mbox; + + if (m->init_once) + return -EALREADY; + + if (ram_mbox_base == NULL) { + mbox_log_err("Invalid ram_mbox_base=%p", ram_mbox_base); + return -EINVAL; + } + + m->ram_mbox_base = ram_mbox_base; + + if (m->reg != NULL) { + rte_spinlock_init(&m->lock); + m->init_once = 1; + } + + return 0; +} + +int +octeontx_mbox_set_reg(uint8_t *reg) { - if (unlikely(m->init_once == 0)) { + struct mbox *m = &octeontx_mbox; + + if (m->init_once) + return -EALREADY; + + if (reg == NULL) { + mbox_log_err("Invalid reg=%p", reg); + return -EINVAL; + } + + m->reg = reg; + + if (m->ram_mbox_base != NULL) { rte_spinlock_init(&m->lock); - m->ram_mbox_base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); - m->reg = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); - m->reg += SSO_VHGRP_PF_MBOX(1); - - if (m->ram_mbox_base == NULL || m->reg == NULL) { - mbox_log_err("Invalid ram_mbox_base=%p or reg=%p", - m->ram_mbox_base, m->reg); - return -EINVAL; - } m->init_once = 1; } + return 0; } @@ -207,7 +244,7 @@ octeontx_ssovf_mbox_send(struct octeontx_mbox_hdr *hdr, void *txdata, struct mbox *m = &octeontx_mbox; RTE_BUILD_BUG_ON(sizeof(struct mbox_ram_hdr) != 8); - if (rte_eal_process_type() != RTE_PROC_PRIMARY || mbox_setup(m)) + if (rte_eal_process_type() != RTE_PROC_PRIMARY) return -EINVAL; return mbox_send(m, hdr, txdata, txlen, rxdata, rxlen); diff --git a/drivers/mempool/octeontx/octeontx_mbox.h b/drivers/common/octeontx/octeontx_mbox.h similarity index 66% rename from drivers/mempool/octeontx/octeontx_mbox.h rename to drivers/common/octeontx/octeontx_mbox.h index 1b056071a..52fae4ef9 100644 --- a/drivers/mempool/octeontx/octeontx_mbox.h +++ b/drivers/common/octeontx/octeontx_mbox.h @@ -6,10 +6,22 @@ #define __OCTEONTX_MBOX_H__ #include <rte_common.h> +#include <rte_spinlock.h> #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 */ @@ -30,6 +42,8 @@ struct octeontx_mbox_hdr { int octeontx_ssovf_info(struct octeontx_ssovf_info *info); void *octeontx_ssovf_bar(enum octeontx_ssovf_type, uint8_t id, uint8_t bar); +int octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base); +int octeontx_mbox_set_reg(uint8_t *reg); int octeontx_ssovf_mbox_send(struct octeontx_mbox_hdr *hdr, void *txdata, uint16_t txlen, void *rxdata, uint16_t rxlen); diff --git a/drivers/common/octeontx/rte_common_octeontx_version.map b/drivers/common/octeontx/rte_common_octeontx_version.map new file mode 100644 index 000000000..59dbed5b2 --- /dev/null +++ b/drivers/common/octeontx/rte_common_octeontx_version.map @@ -0,0 +1,9 @@ +DPDK_18.05 { + global: + + octeontx_ssovf_info; + octeontx_ssovf_bar; + octeontx_mbox_set_ram_mbox_base; + octeontx_mbox_set_reg; + octeontx_ssovf_mbox_send; +}; diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index 0e49efd84..34dcb844c 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_common_octeontx -lrte_pmd_octeontx LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf -lrte_kvargs LDLIBS += -lrte_bus_vdev @@ -27,6 +28,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev_selftest.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx_ssovf.c ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_ssovf_worker.o += -fno-prefetch-loop-arrays diff --git a/drivers/event/octeontx/meson.build b/drivers/event/octeontx/meson.build index 358fc9fc9..1181f337b 100644 --- a/drivers/event/octeontx/meson.build +++ b/drivers/event/octeontx/meson.build @@ -3,7 +3,8 @@ sources = files('ssovf_worker.c', 'ssovf_evdev.c', - 'ssovf_evdev_selftest.c' + 'ssovf_evdev_selftest.c', + 'octeontx_ssovf.c' ) -deps += ['mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] +deps += ['common_octeontx', 'mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] diff --git a/drivers/mempool/octeontx/octeontx_ssovf.c b/drivers/event/octeontx/octeontx_ssovf.c similarity index 92% rename from drivers/mempool/octeontx/octeontx_ssovf.c rename to drivers/event/octeontx/octeontx_ssovf.c index 97b240665..c32b49a01 100644 --- a/drivers/mempool/octeontx/octeontx_ssovf.c +++ b/drivers/event/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 @@ -142,6 +141,7 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) uint16_t vfid; struct ssowvf_res *res; struct ssowvf_identify *id; + uint8_t *ram_mbox_base; RTE_SET_USED(pci_drv); @@ -180,6 +180,14 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) res->domain = id->domain; sdev.total_ssowvfs++; + if (!vfid) { + ram_mbox_base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); + if (octeontx_mbox_set_ram_mbox_base(ram_mbox_base)) { + mbox_log_err("Invalid Failed to set ram mbox base"); + return -EINVAL; + } + } + rte_wmb(); mbox_log_dbg("Domain=%d hws=%d total_ssowvfs=%d", res->domain, res->vfid, sdev.total_ssowvfs); @@ -213,6 +221,7 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) uint16_t vfid; uint8_t *idreg; struct ssovf_res *res; + uint8_t *reg; RTE_SET_USED(pci_drv); @@ -246,6 +255,15 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) res->domain = val & 0xffff; sdev.total_ssovfs++; + if (!vfid) { + reg = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); + reg += SSO_VHGRP_PF_MBOX(1); + if (octeontx_mbox_set_reg(reg)) { + mbox_log_err("Invalid Failed to set mbox_reg"); + return -EINVAL; + } + } + rte_wmb(); mbox_log_dbg("Domain=%d group=%d total_ssovfs=%d", res->domain, res->vfid, sdev.total_ssovfs); diff --git a/drivers/mempool/octeontx/Makefile b/drivers/mempool/octeontx/Makefile index dfc373e62..a3e1dce88 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_common_octeontx include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/octeontx/meson.build b/drivers/mempool/octeontx/meson.build index 1e894a56b..3baaf7db2 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', 'common_octeontx'] 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..885f17684 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_common_octeontx LDLIBS += -lrte_mempool_octeontx LDLIBS += -lrte_eventdev LDLIBS += -lrte_bus_pci diff --git a/mk/rte.app.mk b/mk/rte.app.mk index a9b4b0502..bf39c4ab0 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -111,6 +111,10 @@ ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni endif +ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL),yy) +_LDLIBS-y += -lrte_common_octeontx +endif + _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += -lrte_bus_pci _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += -lrte_bus_dpaa -- 2.16.2 ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v4 2/2] octeontx: move mbox to common folder 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 1 sibling, 1 reply; 30+ messages in thread From: Jerin Jacob @ 2018-04-04 3:29 UTC (permalink / raw) To: Pavan Nikhilesh Cc: santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal, dev -----Original Message----- > Date: Mon, 2 Apr 2018 14:40:00 +0530 > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, > thomas@monjalon.net, anatoly.burakov@intel.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 v4 2/2] octeontx: move mbox to common folder > X-Mailer: git-send-email 2.16.3 > > Move commonly used functions across mempool, event and net devices to a > common folder in drivers. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > --- > +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..8a28ce800 > --- /dev/null > +++ b/drivers/common/octeontx/meson.build > @@ -0,0 +1,6 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2018 Cavium, Inc > +# > + > +sources = files('octeontx_mbox.c' > +) Does it make sense to change to, sources = files('octeontx_mbox.c') i.e no sepreate line for ")" > diff --git a/drivers/mempool/octeontx/octeontx_mbox.c b/drivers/common/octeontx/octeontx_mbox.c > similarity index 83% > rename from drivers/mempool/octeontx/octeontx_mbox.c > rename to drivers/common/octeontx/octeontx_mbox.c > index f8cb6a453..c98e110f3 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 { > }; > }; > > +++ b/drivers/common/octeontx/octeontx_mbox.h > @@ -6,10 +6,22 @@ > #define __OCTEONTX_MBOX_H__ > > #include <rte_common.h> > +#include <rte_spinlock.h> > > #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 */ > @@ -30,6 +42,8 @@ struct octeontx_mbox_hdr { > > int octeontx_ssovf_info(struct octeontx_ssovf_info *info); > void *octeontx_ssovf_bar(enum octeontx_ssovf_type, uint8_t id, uint8_t bar); IMO, prototype for octeontx_ssovf_bar(), octeontx_ssovf_info(), and defintion octeontx_ssovf_info can be moved to driver/event/octeontx as it is the only driver is using that(i.e no need not to be in common code) > +int octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base); > +int octeontx_mbox_set_reg(uint8_t *reg); > int octeontx_ssovf_mbox_send(struct octeontx_mbox_hdr *hdr, > void *txdata, uint16_t txlen, void *rxdata, uint16_t rxlen); > > diff --git a/drivers/common/octeontx/rte_common_octeontx_version.map b/drivers/common/octeontx/rte_common_octeontx_version.map > new file mode 100644 > index 000000000..59dbed5b2 > --- /dev/null > +++ b/drivers/common/octeontx/rte_common_octeontx_version.map > @@ -0,0 +1,9 @@ > +DPDK_18.05 { > + global: > + > + octeontx_ssovf_info; > + octeontx_ssovf_bar; Same as above, move above stuff from rte_common_octeontx_version.map > + octeontx_mbox_set_ram_mbox_base; > + octeontx_mbox_set_reg; > + octeontx_ssovf_mbox_send; I think, octeontx_ssovf_mbox_send can be replaced with octeontx_mbox_send() to inline with other APIs above(octeontx_mbox_set*) > +}; > diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile > index 0e49efd84..34dcb844c 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_common_octeontx -lrte_pmd_octeontx > LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf -lrte_kvargs > LDLIBS += -lrte_bus_vdev > > @@ -27,6 +28,7 @@ LIBABIVER := 1 > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev_selftest.c > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx_ssovf.c s/octeontx_ssovf.c/ssovf_probe.c see next comment. > > ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) > CFLAGS_ssovf_worker.o += -fno-prefetch-loop-arrays > diff --git a/drivers/event/octeontx/meson.build b/drivers/event/octeontx/meson.build > index 358fc9fc9..1181f337b 100644 > --- a/drivers/event/octeontx/meson.build > +++ b/drivers/event/octeontx/meson.build > @@ -3,7 +3,8 @@ > > sources = files('ssovf_worker.c', > 'ssovf_evdev.c', > - 'ssovf_evdev_selftest.c' > + 'ssovf_evdev_selftest.c', > + 'octeontx_ssovf.c' I think, it makes sense to change the name to ssovf_probe.c as all files in this directory starts with ssovf_* > ) > > -deps += ['mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] > +deps += ['common_octeontx', 'mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] > diff --git a/drivers/mempool/octeontx/octeontx_ssovf.c b/drivers/event/octeontx/octeontx_ssovf.c > similarity index 92% > rename from drivers/mempool/octeontx/octeontx_ssovf.c > rename to drivers/event/octeontx/octeontx_ssovf.c > index 97b240665..c32b49a01 100644 > --- a/drivers/mempool/octeontx/octeontx_ssovf.c > +++ b/drivers/event/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 > @@ -142,6 +141,7 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > uint16_t vfid; > struct ssowvf_res *res; > struct ssowvf_identify *id; > + uint8_t *ram_mbox_base; > > RTE_SET_USED(pci_drv); > > @@ -180,6 +180,14 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > res->domain = id->domain; > > sdev.total_ssowvfs++; > + if (!vfid) { vfid == 0 ? > + ram_mbox_base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); > + if (octeontx_mbox_set_ram_mbox_base(ram_mbox_base)) { > + mbox_log_err("Invalid Failed to set ram mbox base"); > + return -EINVAL; > + } > + } > + > rte_wmb(); > mbox_log_dbg("Domain=%d hws=%d total_ssowvfs=%d", res->domain, > res->vfid, sdev.total_ssowvfs); > @@ -213,6 +221,7 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > uint16_t vfid; > uint8_t *idreg; > struct ssovf_res *res; > + uint8_t *reg; > > RTE_SET_USED(pci_drv); > > @@ -246,6 +255,15 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > res->domain = val & 0xffff; > > sdev.total_ssovfs++; > + if (!vfid) { vfid == 0 ? > + reg = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); > + reg += SSO_VHGRP_PF_MBOX(1); > + if (octeontx_mbox_set_reg(reg)) { > + mbox_log_err("Invalid Failed to set mbox_reg"); > + return -EINVAL; > + } > + } > + > rte_wmb(); > mbox_log_dbg("Domain=%d group=%d total_ssovfs=%d", res->domain, > res->vfid, sdev.total_ssovfs); With above changes: Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v4 2/2] octeontx: move mbox to common folder 2018-04-04 3:29 ` Jerin Jacob @ 2018-04-04 5:06 ` santosh 0 siblings, 0 replies; 30+ messages in thread From: santosh @ 2018-04-04 5:06 UTC (permalink / raw) To: Jerin Jacob, Pavan Nikhilesh Cc: thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal, dev On Wednesday 04 April 2018 08:59 AM, Jerin Jacob wrote: > -----Original Message----- >> Date: Mon, 2 Apr 2018 14:40:00 +0530 >> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> >> To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, >> thomas@monjalon.net, anatoly.burakov@intel.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 v4 2/2] octeontx: move mbox to common folder >> X-Mailer: git-send-email 2.16.3 >> >> Move commonly used functions across mempool, event and net devices to a >> common folder in drivers. >> >> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> >> --- snip >> vfid == 0 ? >> >> + ram_mbox_base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); also ram_mbox_base may throw build warning in case vfid>0..right? >> + if (octeontx_mbox_set_ram_mbox_base(ram_mbox_base)) { >> + mbox_log_err("Invalid Failed to set ram mbox base"); >> + return -EINVAL; >> + } >> + } >> + >> rte_wmb(); >> mbox_log_dbg("Domain=%d hws=%d total_ssowvfs=%d", res->domain, >> res->vfid, sdev.total_ssowvfs); >> @@ -213,6 +221,7 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) >> uint16_t vfid; >> uint8_t *idreg; >> struct ssovf_res *res; >> + uint8_t *reg; >> >> RTE_SET_USED(pci_drv); >> >> @@ -246,6 +255,15 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) >> res->domain = val & 0xffff; >> >> sdev.total_ssovfs++; >> + if (!vfid) { > vfid == 0 ? > >> + reg = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); ditto for reg. >> + reg += SSO_VHGRP_PF_MBOX(1); >> + if (octeontx_mbox_set_reg(reg)) { >> + mbox_log_err("Invalid Failed to set mbox_reg"); >> + return -EINVAL; >> + } >> + } >> + >> rte_wmb(); >> mbox_log_dbg("Domain=%d group=%d total_ssovfs=%d", res->domain, >> res->vfid, sdev.total_ssovfs); > With above changes: > > Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> > Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com> Thanks. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v4 2/2] octeontx: move mbox to common folder 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 9:23 ` Thomas Monjalon 1 sibling, 0 replies; 30+ messages in thread From: Thomas Monjalon @ 2018-04-04 9:23 UTC (permalink / raw) To: Pavan Nikhilesh Cc: dev, jerin.jacob, santosh.shukla, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal 02/04/2018 11:10, Pavan Nikhilesh: > +++ b/drivers/common/octeontx/Makefile > @@ -0,0 +1,24 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2018 Cavium, Inc > +# > + > +include $(RTE_SDK)/mk/rte.vars.mk > + > +# > +# library name > +# > +LIB = librte_common_octeontx.a > + > +CFLAGS += $(WERROR_FLAGS) > +EXPORT_MAP := rte_common_octeontx_version.map > + > +LIBABIVER := 1 You should add this new library in the release notes section: "Shared Library Versions" ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/2] drivers: add common folder 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-03 6:57 ` Hemant Agrawal 2018-04-04 3:08 ` Jerin Jacob 2018-04-04 5:01 ` santosh 2 siblings, 1 reply; 30+ messages in thread From: Hemant Agrawal @ 2018-04-03 6:57 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev On 4/2/2018 2:39 PM, Pavan Nikhilesh wrote: > Add driver/common folder and skeleton makefile for adding commonly used > functions across mempool, event and net devices. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > --- Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/2] drivers: add common folder 2018-04-03 6:57 ` [dpdk-dev] [PATCH v4 1/2] drivers: add " Hemant Agrawal @ 2018-04-04 3:08 ` Jerin Jacob 0 siblings, 0 replies; 30+ messages in thread From: Jerin Jacob @ 2018-04-04 3:08 UTC (permalink / raw) To: Hemant Agrawal Cc: Pavan Nikhilesh, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, dev -----Original Message----- > Date: Tue, 3 Apr 2018 12:27:53 +0530 > From: Hemant Agrawal <hemant.agrawal@nxp.com> > To: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>, > jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, > thomas@monjalon.net, anatoly.burakov@intel.com, lironh@marvell.com, > bruce.richardson@intel.com, fiona.trahe@intel.com, shreyansh.jain@nxp.com, > hemant.agrawal@nxp.com > CC: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v4 1/2] drivers: add common folder > User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 > Thunderbird/52.6.0 > > > On 4/2/2018 2:39 PM, Pavan Nikhilesh wrote: > > Add driver/common folder and skeleton makefile for adding commonly used > > functions across mempool, event and net devices. > > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > > --- > Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/2] drivers: add common folder 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-03 6:57 ` [dpdk-dev] [PATCH v4 1/2] drivers: add " Hemant Agrawal @ 2018-04-04 5:01 ` santosh 2 siblings, 0 replies; 30+ messages in thread From: santosh @ 2018-04-04 5:01 UTC (permalink / raw) To: Pavan Nikhilesh, jerin.jacob, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev On Monday 02 April 2018 02:39 PM, Pavan Nikhilesh wrote: > Add driver/common folder and skeleton makefile for adding commonly used > functions across mempool, event and net devices. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > --- Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com> ^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH v5 1/2] drivers: add common folder 2018-03-19 9:27 [dpdk-dev] [PATCH 1/2] drivers: add common folder Pavan Nikhilesh ` (4 preceding siblings ...) 2018-04-02 9:09 ` [dpdk-dev] [PATCH v4 " Pavan Nikhilesh @ 2018-04-04 14:30 ` Pavan Nikhilesh 2018-04-04 14:30 ` [dpdk-dev] [PATCH v5 2/2] octeontx: move mbox to " Pavan Nikhilesh 5 siblings, 1 reply; 30+ messages in thread From: Pavan Nikhilesh @ 2018-04-04 14:30 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev, Pavan Nikhilesh Add driver/common folder and skeleton makefile for adding commonly used functions across mempool, event and net devices. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com> --- v5 Changes: - Move all ssovf related stuff from driver/common to driver/event.(jerin) - Update shared library details in release notes (Thomas). v4 Changes: - modified dependency order i.e common before bus. - updated MAINTAINERS file. - moved linking common lib in rte.app.mk above bus. v3 Changes: - Fix common lib naming scheme. v2 Changes: - Removed dependency on bus. drivers/Makefile | 13 +++++++------ drivers/common/Makefile | 7 +++++++ drivers/common/meson.build | 6 ++++++ drivers/meson.build | 11 ++++++----- 4 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 drivers/common/Makefile create mode 100644 drivers/common/meson.build diff --git a/drivers/Makefile b/drivers/Makefile index a1fa8b917..3d9f86b00 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -3,18 +3,19 @@ include $(RTE_SDK)/mk/rte.vars.mk +DIRS-y += common DIRS-y += bus DIRS-y += mempool -DEPDIRS-mempool := bus +DEPDIRS-mempool := common bus DIRS-y += net -DEPDIRS-net := bus mempool +DEPDIRS-net := common bus mempool DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += baseband -DEPDIRS-baseband := bus mempool +DEPDIRS-baseband := common bus mempool DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto -DEPDIRS-crypto := bus mempool +DEPDIRS-crypto := common bus mempool DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event -DEPDIRS-event := bus mempool net +DEPDIRS-event := common bus mempool net DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw -DEPDIRS-raw := bus mempool net event +DEPDIRS-raw := common bus mempool net event include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/Makefile b/drivers/common/Makefile new file mode 100644 index 000000000..192066307 --- /dev/null +++ b/drivers/common/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +include $(RTE_SDK)/mk/rte.vars.mk + +include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/meson.build b/drivers/common/meson.build new file mode 100644 index 000000000..ab774b8ef --- /dev/null +++ b/drivers/common/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc + +std_deps = ['eal'] +config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' +driver_name_fmt = 'rte_common_@0@' diff --git a/drivers/meson.build b/drivers/meson.build index b41a0f18e..b146f09c5 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -2,11 +2,12 @@ # Copyright(c) 2017 Intel Corporation # Defines the order in which the drivers are buit. -driver_classes = ['bus', - 'mempool', # depends on bus. - 'net', # depends on bus and mempool. - 'crypto', # depenss on bus, mempool (net in future). - 'event'] # depends on bus, mempool and net. +driver_classes = ['common', + 'bus', + 'mempool', # depends on common and bus. + 'net', # depends on common, bus and mempool. + 'crypto', # depends on common, bus and mempool (net in future). + 'event'] # depends on common, bus, mempool and net. foreach class:driver_classes drivers = [] -- 2.16.2 ^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH v5 2/2] octeontx: move mbox to common folder 2018-04-04 14:30 ` [dpdk-dev] [PATCH v5 " Pavan Nikhilesh @ 2018-04-04 14:30 ` Pavan Nikhilesh 2018-04-04 14:37 ` Thomas Monjalon 2018-04-04 21:20 ` Thomas Monjalon 0 siblings, 2 replies; 30+ messages in thread From: Pavan Nikhilesh @ 2018-04-04 14:30 UTC (permalink / raw) To: jerin.jacob, santosh.shukla, thomas, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal Cc: dev, Pavan Nikhilesh Move commonly used functions across mempool, event and net devices to a common folder in drivers. Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com> --- MAINTAINERS | 1 + doc/guides/rel_notes/release_18_05.rst | 1 + drivers/common/Makefile | 4 ++ drivers/common/meson.build | 1 + drivers/common/octeontx/Makefile | 24 ++++++++ drivers/common/octeontx/meson.build | 5 ++ .../{mempool => common}/octeontx/octeontx_mbox.c | 67 +++++++++++++++++----- drivers/common/octeontx/octeontx_mbox.h | 37 ++++++++++++ .../octeontx/rte_common_octeontx_version.map | 7 +++ drivers/event/octeontx/Makefile | 4 +- drivers/event/octeontx/meson.build | 5 +- drivers/event/octeontx/ssovf_evdev.c | 20 +++---- drivers/event/octeontx/ssovf_evdev.h | 12 ++++ .../octeontx/ssovf_probe.c} | 25 +++++++- drivers/event/octeontx/ssovf_worker.c | 2 +- drivers/mempool/octeontx/Makefile | 5 +- drivers/mempool/octeontx/meson.build | 6 +- drivers/mempool/octeontx/octeontx_fpavf.c | 14 ++--- drivers/mempool/octeontx/octeontx_mbox.h | 36 ------------ drivers/mempool/octeontx/octeontx_pool_logs.h | 9 --- .../octeontx/rte_mempool_octeontx_version.map | 6 -- drivers/net/octeontx/Makefile | 3 +- drivers/net/octeontx/base/octeontx_bgx.c | 22 +++---- drivers/net/octeontx/base/octeontx_pkivf.c | 10 ++-- drivers/net/octeontx/base/octeontx_pkivf.h | 10 ++-- mk/rte.app.mk | 4 ++ 26 files changed, 219 insertions(+), 121 deletions(-) create mode 100644 drivers/common/octeontx/Makefile create mode 100644 drivers/common/octeontx/meson.build rename drivers/{mempool => common}/octeontx/octeontx_mbox.c (82%) create mode 100644 drivers/common/octeontx/octeontx_mbox.h create mode 100644 drivers/common/octeontx/rte_common_octeontx_version.map rename drivers/{mempool/octeontx/octeontx_ssovf.c => event/octeontx/ssovf_probe.c} (91%) delete mode 100644 drivers/mempool/octeontx/octeontx_mbox.h diff --git a/MAINTAINERS b/MAINTAINERS index d4c0cc1bc..ed3251da7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -412,6 +412,7 @@ F: doc/guides/nics/features/liquidio.ini Cavium OcteonTX M: Santosh Shukla <santosh.shukla@caviumnetworks.com> M: Jerin Jacob <jerin.jacob@caviumnetworks.com> +F: drivers/common/octeontx/ F: drivers/mempool/octeontx/ F: drivers/net/octeontx/ F: doc/guides/nics/octeontx.rst diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst index 9cc77f893..1576fba29 100644 --- a/doc/guides/rel_notes/release_18_05.rst +++ b/doc/guides/rel_notes/release_18_05.rst @@ -182,6 +182,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_table.so.3 librte_timer.so.1 librte_vhost.so.3 + librte_common_octeontx.so.1 Tested Platforms 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 ab774b8ef..5f6341b8f 100644 --- a/drivers/common/meson.build +++ b/drivers/common/meson.build @@ -2,5 +2,6 @@ # Copyright(c) 2018 Cavium, Inc std_deps = ['eal'] +drivers = ['octeontx'] config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' driver_name_fmt = 'rte_common_@0@' diff --git a/drivers/common/octeontx/Makefile b/drivers/common/octeontx/Makefile new file mode 100644 index 000000000..dfdb9f196 --- /dev/null +++ b/drivers/common/octeontx/Makefile @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_common_octeontx.a + +CFLAGS += $(WERROR_FLAGS) +EXPORT_MAP := rte_common_octeontx_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-y += octeontx_mbox.c + +LDLIBS += -lrte_eal + +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..203d1ef49 --- /dev/null +++ b/drivers/common/octeontx/meson.build @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +sources = files('octeontx_mbox.c') diff --git a/drivers/mempool/octeontx/octeontx_mbox.c b/drivers/common/octeontx/octeontx_mbox.c similarity index 82% rename from drivers/mempool/octeontx/octeontx_mbox.c rename to drivers/common/octeontx/octeontx_mbox.c index f8cb6a453..93e6e8579 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) { @@ -181,33 +191,60 @@ mbox_send(struct mbox *m, struct octeontx_mbox_hdr *hdr, const void *txmsg, return res; } -static inline int -mbox_setup(struct mbox *m) +int +octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base) +{ + struct mbox *m = &octeontx_mbox; + + if (m->init_once) + return -EALREADY; + + if (ram_mbox_base == NULL) { + mbox_log_err("Invalid ram_mbox_base=%p", ram_mbox_base); + return -EINVAL; + } + + m->ram_mbox_base = ram_mbox_base; + + if (m->reg != NULL) { + rte_spinlock_init(&m->lock); + m->init_once = 1; + } + + return 0; +} + +int +octeontx_mbox_set_reg(uint8_t *reg) { - if (unlikely(m->init_once == 0)) { + struct mbox *m = &octeontx_mbox; + + if (m->init_once) + return -EALREADY; + + if (reg == NULL) { + mbox_log_err("Invalid reg=%p", reg); + return -EINVAL; + } + + m->reg = reg; + + if (m->ram_mbox_base != NULL) { rte_spinlock_init(&m->lock); - m->ram_mbox_base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); - m->reg = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); - m->reg += SSO_VHGRP_PF_MBOX(1); - - if (m->ram_mbox_base == NULL || m->reg == NULL) { - mbox_log_err("Invalid ram_mbox_base=%p or reg=%p", - m->ram_mbox_base, m->reg); - return -EINVAL; - } m->init_once = 1; } + return 0; } int -octeontx_ssovf_mbox_send(struct octeontx_mbox_hdr *hdr, void *txdata, +octeontx_mbox_send(struct octeontx_mbox_hdr *hdr, void *txdata, uint16_t txlen, void *rxdata, uint16_t rxlen) { struct mbox *m = &octeontx_mbox; RTE_BUILD_BUG_ON(sizeof(struct mbox_ram_hdr) != 8); - if (rte_eal_process_type() != RTE_PROC_PRIMARY || mbox_setup(m)) + if (rte_eal_process_type() != RTE_PROC_PRIMARY) return -EINVAL; return mbox_send(m, hdr, txdata, txlen, rxdata, rxlen); diff --git a/drivers/common/octeontx/octeontx_mbox.h b/drivers/common/octeontx/octeontx_mbox.h new file mode 100644 index 000000000..43fbda282 --- /dev/null +++ b/drivers/common/octeontx/octeontx_mbox.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Cavium, Inc + */ + +#ifndef __OCTEONTX_MBOX_H__ +#define __OCTEONTX_MBOX_H__ + +#include <rte_common.h> +#include <rte_spinlock.h> + +#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_mbox_hdr { + uint16_t vfid; /* VF index or pf resource index local to the domain */ + uint8_t coproc; /* Coprocessor id */ + uint8_t msg; /* Message id */ + uint8_t res_code; /* Functional layer response code */ +}; + +int octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base); +int octeontx_mbox_set_reg(uint8_t *reg); +int octeontx_mbox_send(struct octeontx_mbox_hdr *hdr, + void *txdata, uint16_t txlen, void *rxdata, uint16_t rxlen); + +#endif /* __OCTEONTX_MBOX_H__ */ diff --git a/drivers/common/octeontx/rte_common_octeontx_version.map b/drivers/common/octeontx/rte_common_octeontx_version.map new file mode 100644 index 000000000..f04b3b7f8 --- /dev/null +++ b/drivers/common/octeontx/rte_common_octeontx_version.map @@ -0,0 +1,7 @@ +DPDK_18.05 { + global: + + octeontx_mbox_set_ram_mbox_base; + octeontx_mbox_set_reg; + octeontx_mbox_send; +}; diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index 0e49efd84..6a6073b4d 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_common_octeontx -lrte_pmd_octeontx LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf -lrte_kvargs LDLIBS += -lrte_bus_vdev @@ -27,6 +28,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev_selftest.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_probe.c ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_ssovf_worker.o += -fno-prefetch-loop-arrays diff --git a/drivers/event/octeontx/meson.build b/drivers/event/octeontx/meson.build index 358fc9fc9..56d4207bd 100644 --- a/drivers/event/octeontx/meson.build +++ b/drivers/event/octeontx/meson.build @@ -3,7 +3,8 @@ sources = files('ssovf_worker.c', 'ssovf_evdev.c', - 'ssovf_evdev_selftest.c' + 'ssovf_evdev_selftest.c', + 'ssovf_probe.c' ) -deps += ['mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] +deps += ['common_octeontx', 'mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index a1086077d..649ee7979 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -49,7 +49,7 @@ ssovf_mbox_dev_info(struct ssovf_mbox_dev_info *info) hdr.vfid = 0; memset(info, 0, len); - return octeontx_ssovf_mbox_send(&hdr, NULL, 0, info, len); + return octeontx_mbox_send(&hdr, NULL, 0, info, len); } struct ssovf_mbox_getwork_wait { @@ -69,7 +69,7 @@ ssovf_mbox_getwork_tmo_set(uint32_t timeout_ns) hdr.vfid = 0; tmo_set.wait_ns = timeout_ns; - ret = octeontx_ssovf_mbox_send(&hdr, &tmo_set, len, NULL, 0); + ret = octeontx_mbox_send(&hdr, &tmo_set, len, NULL, 0); if (ret) ssovf_log_err("Failed to set getwork timeout(%d)", ret); @@ -99,7 +99,7 @@ ssovf_mbox_priority_set(uint8_t queue, uint8_t prio) grp.affinity = 0xff; grp.priority = prio / 32; /* Normalize to 0 to 7 */ - ret = octeontx_ssovf_mbox_send(&hdr, &grp, len, NULL, 0); + ret = octeontx_mbox_send(&hdr, &grp, len, NULL, 0); if (ret) ssovf_log_err("Failed to set grp=%d prio=%d", queue, prio); @@ -125,7 +125,7 @@ ssovf_mbox_timeout_ticks(uint64_t ns, uint64_t *tmo_ticks) memset(&ns2iter, 0, len); ns2iter.wait_ns = ns; - ret = octeontx_ssovf_mbox_send(&hdr, &ns2iter, len, &ns2iter, len); + ret = octeontx_mbox_send(&hdr, &ns2iter, len, &ns2iter, len); if (ret < 0 || (ret != len)) { ssovf_log_err("Failed to get tmo ticks ns=%"PRId64"", ns); return -EIO; @@ -276,7 +276,7 @@ ssovf_port_setup(struct rte_eventdev *dev, uint8_t port_id, return -ENOMEM; } - ws->base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, port_id, 0); + ws->base = ssovf_bar(OCTEONTX_SSO_HWS, port_id, 0); if (ws->base == NULL) { rte_free(ws); ssovf_log_err("Failed to get hws base addr port=%d", port_id); @@ -290,7 +290,7 @@ ssovf_port_setup(struct rte_eventdev *dev, uint8_t port_id, ws->port = port_id; for (q = 0; q < edev->nb_event_queues; q++) { - ws->grps[q] = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, q, 2); + ws->grps[q] = ssovf_bar(OCTEONTX_SSO_GROUP, q, 2); if (ws->grps[q] == NULL) { rte_free(ws); ssovf_log_err("Failed to get grp%d base addr", q); @@ -531,7 +531,7 @@ ssovf_start(struct rte_eventdev *dev) /* Consume all the events through HWS0 */ ssows_flush_events(dev->data->ports[0], i); - base = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, i, 0); + base = ssovf_bar(OCTEONTX_SSO_GROUP, i, 0); base += SSO_VHGRP_QCTL; ssovf_write64(1, base); /* Enable SSO group */ } @@ -559,7 +559,7 @@ ssovf_stop(struct rte_eventdev *dev) /* Consume all the events through HWS0 */ ssows_flush_events(dev->data->ports[0], i); - base = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, i, 0); + base = ssovf_bar(OCTEONTX_SSO_GROUP, i, 0); base += SSO_VHGRP_QCTL; ssovf_write64(0, base); /* Disable SSO group */ } @@ -621,7 +621,7 @@ static const struct rte_eventdev_ops ssovf_ops = { static int ssovf_vdev_probe(struct rte_vdev_device *vdev) { - struct octeontx_ssovf_info oinfo; + struct ssovf_info oinfo; struct ssovf_mbox_dev_info info; struct ssovf_evdev *edev; struct rte_eventdev *eventdev; @@ -679,7 +679,7 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) return 0; } - ret = octeontx_ssovf_info(&oinfo); + ret = ssovf_info(&oinfo); if (ret) { ssovf_log_err("Failed to probe and validate ssovfs %d", ret); goto error; diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index d1825b4f3..b336bd24e 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -119,6 +119,16 @@ do { \ } while (0) #endif +struct ssovf_info { + uint16_t domain; /* Domain id */ + uint8_t total_ssovfs; /* Total sso groups available in domain */ + uint8_t total_ssowvfs;/* Total sso hws available in domain */ +}; + +enum ssovf_type { + OCTEONTX_SSO_GROUP, /* SSO group vf */ + OCTEONTX_SSO_HWS, /* SSO hardware workslot vf */ +}; struct ssovf_evdev { uint8_t max_event_queues; @@ -166,6 +176,8 @@ uint16_t ssows_deq_timeout_burst(void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); void ssows_flush_events(struct ssows *ws, uint8_t queue_id); void ssows_reset(struct ssows *ws); +int ssovf_info(struct ssovf_info *info); +void *ssovf_bar(enum ssovf_type, uint8_t id, uint8_t bar); int test_eventdev_octeontx(void); #endif /* __SSOVF_EVDEV_H__ */ diff --git a/drivers/mempool/octeontx/octeontx_ssovf.c b/drivers/event/octeontx/ssovf_probe.c similarity index 91% rename from drivers/mempool/octeontx/octeontx_ssovf.c rename to drivers/event/octeontx/ssovf_probe.c index 97b240665..b3db596d4 100644 --- a/drivers/mempool/octeontx/octeontx_ssovf.c +++ b/drivers/event/octeontx/ssovf_probe.c @@ -10,7 +10,7 @@ #include <rte_bus_pci.h> #include "octeontx_mbox.h" -#include "octeontx_pool_logs.h" +#include "ssovf_evdev.h" #define PCI_VENDOR_ID_CAVIUM 0x177D #define PCI_DEVICE_ID_OCTEONTX_SSOGRP_VF 0xA04B @@ -52,7 +52,7 @@ static struct ssodev sdev; /* Interface functions */ int -octeontx_ssovf_info(struct octeontx_ssovf_info *info) +ssovf_info(struct ssovf_info *info) { uint8_t i; uint16_t domain; @@ -97,7 +97,7 @@ octeontx_ssovf_info(struct octeontx_ssovf_info *info) } void* -octeontx_ssovf_bar(enum octeontx_ssovf_type type, uint8_t id, uint8_t bar) +ssovf_bar(enum ssovf_type type, uint8_t id, uint8_t bar) { if (rte_eal_process_type() != RTE_PROC_PRIMARY || type > OCTEONTX_SSO_HWS) @@ -142,6 +142,7 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) uint16_t vfid; struct ssowvf_res *res; struct ssowvf_identify *id; + uint8_t *ram_mbox_base; RTE_SET_USED(pci_drv); @@ -180,6 +181,14 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) res->domain = id->domain; sdev.total_ssowvfs++; + if (vfid == 0) { + ram_mbox_base = ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); + if (octeontx_mbox_set_ram_mbox_base(ram_mbox_base)) { + mbox_log_err("Invalid Failed to set ram mbox base"); + return -EINVAL; + } + } + rte_wmb(); mbox_log_dbg("Domain=%d hws=%d total_ssowvfs=%d", res->domain, res->vfid, sdev.total_ssowvfs); @@ -213,6 +222,7 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) uint16_t vfid; uint8_t *idreg; struct ssovf_res *res; + uint8_t *reg; RTE_SET_USED(pci_drv); @@ -246,6 +256,15 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) res->domain = val & 0xffff; sdev.total_ssovfs++; + if (vfid == 0) { + reg = ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); + reg += SSO_VHGRP_PF_MBOX(1); + if (octeontx_mbox_set_reg(reg)) { + mbox_log_err("Invalid Failed to set mbox_reg"); + return -EINVAL; + } + } + rte_wmb(); mbox_log_dbg("Domain=%d group=%d total_ssovfs=%d", res->domain, res->vfid, sdev.total_ssovfs); diff --git a/drivers/event/octeontx/ssovf_worker.c b/drivers/event/octeontx/ssovf_worker.c index 753c1e9f5..771e3ac6c 100644 --- a/drivers/event/octeontx/ssovf_worker.c +++ b/drivers/event/octeontx/ssovf_worker.c @@ -204,7 +204,7 @@ ssows_flush_events(struct ssows *ws, uint8_t queue_id) uint64_t aq_cnt = 1; uint64_t cq_ds_cnt = 1; uint64_t enable, get_work0, get_work1; - uint8_t *base = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, queue_id, 0); + uint8_t *base = ssovf_bar(OCTEONTX_SSO_GROUP, queue_id, 0); enable = ssovf_read64(base + SSO_VHGRP_QCTL); if (!enable) diff --git a/drivers/mempool/octeontx/Makefile b/drivers/mempool/octeontx/Makefile index dfc373e62..a3e1dce88 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_common_octeontx include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/octeontx/meson.build b/drivers/mempool/octeontx/meson.build index 1e894a56b..3baaf7db2 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', 'common_octeontx'] diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c index 61c72c7c8..7aecaa85d 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 */ @@ -253,7 +249,7 @@ octeontx_fpapf_pool_setup(unsigned int gpool, unsigned int buf_size, cfg.pool_stack_end = phys_addr + memsz; cfg.aura_cfg = (1 << 9); - ret = octeontx_ssovf_mbox_send(&hdr, &cfg, + ret = octeontx_mbox_send(&hdr, &cfg, sizeof(struct octeontx_mbox_fpa_cfg), &resp, sizeof(resp)); if (ret < 0) { @@ -298,7 +294,7 @@ octeontx_fpapf_pool_destroy(unsigned int gpool_index) cfg.pool_stack_end = 0; cfg.aura_cfg = 0; - ret = octeontx_ssovf_mbox_send(&hdr, &cfg, + ret = octeontx_mbox_send(&hdr, &cfg, sizeof(struct octeontx_mbox_fpa_cfg), &resp, sizeof(resp)); if (ret < 0) { @@ -333,7 +329,7 @@ octeontx_fpapf_aura_attach(unsigned int gpool_index) memset(&cfg, 0x0, sizeof(struct octeontx_mbox_fpa_cfg)); cfg.aid = gpool_index; /* gpool is guara */ - ret = octeontx_ssovf_mbox_send(&hdr, &cfg, + ret = octeontx_mbox_send(&hdr, &cfg, sizeof(struct octeontx_mbox_fpa_cfg), &resp, sizeof(resp)); if (ret < 0) { @@ -363,7 +359,7 @@ octeontx_fpapf_aura_detach(unsigned int gpool_index) hdr.coproc = FPA_COPROC; hdr.msg = FPA_DETACHAURA; hdr.vfid = gpool_index; - ret = octeontx_ssovf_mbox_send(&hdr, &cfg, sizeof(cfg), NULL, 0); + ret = octeontx_mbox_send(&hdr, &cfg, sizeof(cfg), NULL, 0); if (ret < 0) { fpavf_log_err("Couldn't detach FPA aura %d Err=%d FuncErr=%d\n", gpool_index, ret, hdr.res_code); @@ -410,7 +406,7 @@ octeontx_fpapf_start_count(uint16_t gpool_index) hdr.coproc = FPA_COPROC; hdr.msg = FPA_START_COUNT; hdr.vfid = gpool_index; - ret = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + ret = octeontx_mbox_send(&hdr, NULL, 0, NULL, 0); if (ret < 0) { fpavf_log_err("Could not start buffer counting for "); fpavf_log_err("FPA pool %d. Err=%d. FuncErr=%d\n", diff --git a/drivers/mempool/octeontx/octeontx_mbox.h b/drivers/mempool/octeontx/octeontx_mbox.h deleted file mode 100644 index 1b056071a..000000000 --- a/drivers/mempool/octeontx/octeontx_mbox.h +++ /dev/null @@ -1,36 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2017 Cavium, Inc - */ - -#ifndef __OCTEONTX_MBOX_H__ -#define __OCTEONTX_MBOX_H__ - -#include <rte_common.h> - -#define SSOW_BAR4_LEN (64 * 1024) -#define SSO_VHGRP_PF_MBOX(x) (0x200ULL | ((x) << 3)) - -struct octeontx_ssovf_info { - uint16_t domain; /* Domain id */ - uint8_t total_ssovfs; /* Total sso groups available in domain */ - uint8_t total_ssowvfs;/* Total sso hws available in domain */ -}; - -enum octeontx_ssovf_type { - OCTEONTX_SSO_GROUP, /* SSO group vf */ - OCTEONTX_SSO_HWS, /* SSO hardware workslot vf */ -}; - -struct octeontx_mbox_hdr { - uint16_t vfid; /* VF index or pf resource index local to the domain */ - uint8_t coproc; /* Coprocessor id */ - uint8_t msg; /* Message id */ - uint8_t res_code; /* Functional layer response code */ -}; - -int octeontx_ssovf_info(struct octeontx_ssovf_info *info); -void *octeontx_ssovf_bar(enum octeontx_ssovf_type, uint8_t id, uint8_t bar); -int octeontx_ssovf_mbox_send(struct octeontx_mbox_hdr *hdr, - void *txdata, uint16_t txlen, void *rxdata, uint16_t rxlen); - -#endif /* __OCTEONTX_MBOX_H__ */ 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..885f17684 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_common_octeontx LDLIBS += -lrte_mempool_octeontx LDLIBS += -lrte_eventdev LDLIBS += -lrte_bus_pci diff --git a/drivers/net/octeontx/base/octeontx_bgx.c b/drivers/net/octeontx/base/octeontx_bgx.c index 8576d8edb..0e2388264 100644 --- a/drivers/net/octeontx/base/octeontx_bgx.c +++ b/drivers/net/octeontx/base/octeontx_bgx.c @@ -19,7 +19,7 @@ octeontx_bgx_port_open(int port, octeontx_mbox_bgx_port_conf_t *conf) hdr.msg = MBOX_BGX_PORT_OPEN; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, &bgx_conf, len); + res = octeontx_mbox_send(&hdr, NULL, 0, &bgx_conf, len); if (res < 0) return -EACCES; @@ -49,7 +49,7 @@ octeontx_bgx_port_close(int port) hdr.msg = MBOX_BGX_PORT_CLOSE; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + res = octeontx_mbox_send(&hdr, NULL, 0, NULL, 0); if (res < 0) return -EACCES; @@ -66,7 +66,7 @@ octeontx_bgx_port_start(int port) hdr.msg = MBOX_BGX_PORT_START; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + res = octeontx_mbox_send(&hdr, NULL, 0, NULL, 0); if (res < 0) return -EACCES; @@ -83,7 +83,7 @@ octeontx_bgx_port_stop(int port) hdr.msg = MBOX_BGX_PORT_STOP; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + res = octeontx_mbox_send(&hdr, NULL, 0, NULL, 0); if (res < 0) return -EACCES; @@ -103,7 +103,7 @@ octeontx_bgx_port_get_config(int port, octeontx_mbox_bgx_port_conf_t *conf) hdr.vfid = port; memset(&bgx_conf, 0, sizeof(octeontx_mbox_bgx_port_conf_t)); - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, &bgx_conf, len); + res = octeontx_mbox_send(&hdr, NULL, 0, &bgx_conf, len); if (res < 0) return -EACCES; @@ -135,7 +135,7 @@ octeontx_bgx_port_status(int port, octeontx_mbox_bgx_port_status_t *stat) hdr.msg = MBOX_BGX_PORT_GET_STATUS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, &bgx_stat, len); + res = octeontx_mbox_send(&hdr, NULL, 0, &bgx_stat, len); if (res < 0) return -EACCES; @@ -156,7 +156,7 @@ octeontx_bgx_port_stats(int port, octeontx_mbox_bgx_port_stats_t *stats) hdr.msg = MBOX_BGX_PORT_GET_STATS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, &bgx_stats, len); + res = octeontx_mbox_send(&hdr, NULL, 0, &bgx_stats, len); if (res < 0) return -EACCES; @@ -181,7 +181,7 @@ octeontx_bgx_port_stats_clr(int port) hdr.msg = MBOX_BGX_PORT_CLR_STATS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + res = octeontx_mbox_send(&hdr, NULL, 0, NULL, 0); if (res < 0) return -EACCES; @@ -200,7 +200,7 @@ octeontx_bgx_port_link_status(int port) hdr.msg = MBOX_BGX_PORT_GET_LINK_STATUS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, &link, len); + res = octeontx_mbox_send(&hdr, NULL, 0, &link, len); if (res < 0) return -EACCES; @@ -219,7 +219,7 @@ octeontx_bgx_port_promisc_set(int port, int en) hdr.vfid = port; prom = en ? 1 : 0; - res = octeontx_ssovf_mbox_send(&hdr, &prom, sizeof(prom), NULL, 0); + res = octeontx_mbox_send(&hdr, &prom, sizeof(prom), NULL, 0); if (res < 0) return -EACCES; @@ -237,7 +237,7 @@ octeontx_bgx_port_mac_set(int port, uint8_t *mac_addr) hdr.msg = MBOX_BGX_PORT_SET_MACADDR; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, mac_addr, len, NULL, 0); + res = octeontx_mbox_send(&hdr, mac_addr, len, NULL, 0); if (res < 0) return -EACCES; diff --git a/drivers/net/octeontx/base/octeontx_pkivf.c b/drivers/net/octeontx/base/octeontx_pkivf.c index 58a7f1101..1babea0e8 100644 --- a/drivers/net/octeontx/base/octeontx_pkivf.c +++ b/drivers/net/octeontx/base/octeontx_pkivf.c @@ -19,7 +19,7 @@ octeontx_pki_port_open(int port) hdr.msg = MBOX_PKI_PORT_OPEN; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, NULL, 0, NULL, 0); + res = octeontx_mbox_send(&hdr, NULL, 0, NULL, 0); if (res < 0) return -EACCES; return res; @@ -38,7 +38,7 @@ octeontx_pki_port_hash_config(int port, pki_hash_cfg_t *hash_cfg) hdr.msg = MBOX_PKI_PORT_HASH_CONFIG; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &h_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &h_cfg, len, NULL, 0); if (res < 0) return -EACCES; @@ -58,7 +58,7 @@ octeontx_pki_port_pktbuf_config(int port, pki_pktbuf_cfg_t *buf_cfg) hdr.msg = MBOX_PKI_PORT_PKTBUF_CONFIG; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &b_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &b_cfg, len, NULL, 0); if (res < 0) return -EACCES; return res; @@ -77,7 +77,7 @@ octeontx_pki_port_create_qos(int port, pki_qos_cfg_t *qos_cfg) hdr.msg = MBOX_PKI_PORT_CREATE_QOS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &q_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &q_cfg, len, NULL, 0); if (res < 0) return -EACCES; @@ -99,7 +99,7 @@ octeontx_pki_port_errchk_config(int port, pki_errchk_cfg_t *cfg) hdr.msg = MBOX_PKI_PORT_ERRCHK_CONFIG; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &e_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &e_cfg, len, NULL, 0); if (res < 0) return -EACCES; diff --git a/drivers/net/octeontx/base/octeontx_pkivf.h b/drivers/net/octeontx/base/octeontx_pkivf.h index d036054ce..764aff53f 100644 --- a/drivers/net/octeontx/base/octeontx_pkivf.h +++ b/drivers/net/octeontx/base/octeontx_pkivf.h @@ -422,7 +422,7 @@ octeontx_pki_port_modify_qos(int port, pki_mod_qos_t *qos_cfg) hdr.msg = MBOX_PKI_PORT_MODIFY_QOS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &q_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &q_cfg, len, NULL, 0); if (res < 0) return -EACCES; @@ -442,7 +442,7 @@ octeontx_pki_port_delete_qos(int port, pki_del_qos_t *qos_cfg) hdr.msg = MBOX_PKI_PORT_DELETE_QOS; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &q_cfg, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &q_cfg, len, NULL, 0); if (res < 0) return -EACCES; @@ -464,7 +464,7 @@ octeontx_pki_port_close(int port) hdr.msg = MBOX_PKI_PORT_CLOSE; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &ptype, len, NULL, 0); if (res < 0) return -EACCES; @@ -486,7 +486,7 @@ octeontx_pki_port_start(int port) hdr.msg = MBOX_PKI_PORT_START; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &ptype, len, NULL, 0); if (res < 0) return -EACCES; @@ -508,7 +508,7 @@ octeontx_pki_port_stop(int port) hdr.msg = MBOX_PKI_PORT_STOP; hdr.vfid = port; - res = octeontx_ssovf_mbox_send(&hdr, &ptype, len, NULL, 0); + res = octeontx_mbox_send(&hdr, &ptype, len, NULL, 0); if (res < 0) return -EACCES; diff --git a/mk/rte.app.mk b/mk/rte.app.mk index a9b4b0502..bf39c4ab0 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -111,6 +111,10 @@ ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni endif +ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL),yy) +_LDLIBS-y += -lrte_common_octeontx +endif + _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += -lrte_bus_pci _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += -lrte_bus_dpaa -- 2.16.2 ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v5 2/2] octeontx: move mbox to common folder 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 1 sibling, 0 replies; 30+ messages in thread From: Thomas Monjalon @ 2018-04-04 14:37 UTC (permalink / raw) To: Pavan Nikhilesh Cc: jerin.jacob, santosh.shukla, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal, dev Hi Pavan, 04/04/2018 16:30, Pavan Nikhilesh: > --- a/doc/guides/rel_notes/release_18_05.rst > +++ b/doc/guides/rel_notes/release_18_05.rst > @@ -182,6 +182,7 @@ The libraries prepended with a plus sign were incremented in this version. > librte_table.so.3 > librte_timer.so.1 > librte_vhost.so.3 > + librte_common_octeontx.so.1 General tip: when we have lists, we want to keep them in an order which will be easy to read and maintain. In this case, it is an alphabetical order. I will fix it on apply. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH v5 2/2] octeontx: move mbox to common folder 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 1 sibling, 0 replies; 30+ messages in thread From: Thomas Monjalon @ 2018-04-04 21:20 UTC (permalink / raw) To: Pavan Nikhilesh Cc: dev, jerin.jacob, santosh.shukla, anatoly.burakov, lironh, bruce.richardson, fiona.trahe, shreyansh.jain, hemant.agrawal 04/04/2018 16:30, Pavan Nikhilesh: > Move commonly used functions across mempool, event and net devices to a > common folder in drivers. > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> > Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> > Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com> Series applied, thanks ^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2018-04-04 21:20 UTC | newest] Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-03-19 9:27 [dpdk-dev] [PATCH 1/2] drivers: add common folder Pavan Nikhilesh 2018-03-19 9:27 ` [dpdk-dev] [PATCH 2/2] octeontx: move mbox to " Pavan Nikhilesh 2018-03-19 10:35 ` [dpdk-dev] [PATCH 1/2] drivers: add " 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
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).