From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9533EA0471 for ; Thu, 20 Jun 2019 03:02:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6FBFC1D0C2; Thu, 20 Jun 2019 03:02:15 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 162F51D0A4 for ; Thu, 20 Jun 2019 03:02:10 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2019 18:02:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,394,1557212400"; d="scan'208";a="358788525" Received: from skx-5gnr-sc12-1.sc.intel.com ([172.25.69.194]) by fmsmga006.fm.intel.com with ESMTP; 19 Jun 2019 18:02:09 -0700 From: Nicolas Chautru To: akhil.goyal@nxp.com, dev@dpdk.org Cc: ferruh.yigit@intel.com, thomas@monjalon.net, amr.mokhtar@intel.com, kamilx.chalupnik@intel.com, aconole@redhat.com, Nicolas Chautru Date: Wed, 19 Jun 2019 10:48:36 -0700 Message-Id: <1560966518-75547-2-git-send-email-nicolas.chautru@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1560966518-75547-1-git-send-email-nicolas.chautru@intel.com> References: <1560964274-83070-2-git-send-email-nicolas.chautru@intel.com> <1560966518-75547-1-git-send-email-nicolas.chautru@intel.com> Subject: [dpdk-dev] [PATCH v7 1/3] baseband/turbo_sw: option to build turbosw PMD without SDK X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Adding compile flag to allow to build the turbo_sw PMD without dependency to have the SDK libraries installed. Signed-off-by: Nicolas Chautru --- config/common_base | 3 +- drivers/baseband/turbo_sw/Makefile | 13 +++--- drivers/baseband/turbo_sw/bbdev_turbo_software.c | 51 +++++++++++++++++++++++- mk/rte.app.mk | 3 ++ 4 files changed, 61 insertions(+), 9 deletions(-) diff --git a/config/common_base b/config/common_base index e406e78..21ab606 100644 --- a/config/common_base +++ b/config/common_base @@ -528,6 +528,7 @@ CONFIG_RTE_PMD_PACKET_PREFETCH=y CONFIG_RTE_LIBRTE_BBDEV=y CONFIG_RTE_BBDEV_MAX_DEVS=128 CONFIG_RTE_BBDEV_OFFLOAD_COST=y +CONFIG_RTE_BBDEV_SDK_AVX2=n # # Compile PMD for NULL bbdev device @@ -537,7 +538,7 @@ CONFIG_RTE_LIBRTE_PMD_BBDEV_NULL=y # # Compile PMD for turbo software bbdev device # -CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW=n +CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW=y # # Compile generic crypto device library diff --git a/drivers/baseband/turbo_sw/Makefile b/drivers/baseband/turbo_sw/Makefile index d364677..414d0d9 100644 --- a/drivers/baseband/turbo_sw/Makefile +++ b/drivers/baseband/turbo_sw/Makefile @@ -3,9 +3,6 @@ include $(RTE_SDK)/mk/rte.vars.mk -ifeq ($(FLEXRAN_SDK),) -$(error "Please define FLEXRAN_SDK environment variable") -endif # library name LIB = librte_pmd_bbdev_turbo_sw.a @@ -21,17 +18,21 @@ LDLIBS += -lrte_bus_vdev # versioning export map EXPORT_MAP := rte_pmd_bbdev_turbo_sw_version.map -# external library dependencies +# external library dependencies if available +ifeq ($(CONFIG_RTE_BBDEV_SDK_AVX2),y) +ifeq ($(FLEXRAN_SDK),) +$(error "Please define FLEXRAN_SDK environment variable") +endif CFLAGS += -I$(FLEXRAN_SDK)/lib_common CFLAGS += -I$(FLEXRAN_SDK)/lib_turbo CFLAGS += -I$(FLEXRAN_SDK)/lib_crc CFLAGS += -I$(FLEXRAN_SDK)/lib_rate_matching - LDLIBS += -L$(FLEXRAN_SDK)/lib_turbo -lturbo LDLIBS += -L$(FLEXRAN_SDK)/lib_crc -lcrc LDLIBS += -L$(FLEXRAN_SDK)/lib_rate_matching -lrate_matching LDLIBS += -L$(FLEXRAN_SDK)/lib_common -lcommon -LDLIBS += -lstdc++ -lirc -limf -lipps +LDLIBS += -lstdc++ -lirc -limf -lipps -lsvml +endif # library version LIBABIVER := 1 diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c index 5204a77..94aa536 100644 --- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c +++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c @@ -14,10 +14,11 @@ #include #include +#ifdef RTE_BBDEV_SDK_AVX2 #include #include #include -#include +#endif #define DRIVER_NAME baseband_turbo_sw @@ -83,6 +84,7 @@ struct turbo_sw_queue { enum rte_bbdev_op_type type; } __rte_cache_aligned; +#ifdef RTE_BBDEV_SDK_AVX2 static inline char * mbuf_append(struct rte_mbuf *m_head, struct rte_mbuf *m, uint16_t len) { @@ -128,6 +130,7 @@ struct turbo_sw_queue { return result; } +#endif /* Read flag value 0/1 from bitmap */ static inline bool @@ -143,6 +146,7 @@ struct turbo_sw_queue { struct bbdev_private *internals = dev->data->dev_private; static const struct rte_bbdev_op_cap bbdev_capabilities[] = { +#ifdef RTE_BBDEV_SDK_AVX2 { .type = RTE_BBDEV_OP_TURBO_DEC, .cap.turbo_dec = { @@ -172,6 +176,7 @@ struct turbo_sw_queue { .num_buffers_dst = RTE_BBDEV_MAX_CODE_BLOCKS, } }, +#endif RTE_BBDEV_END_OF_CAPABILITIES_LIST() }; @@ -179,7 +184,12 @@ struct turbo_sw_queue { .queue_size = RTE_BBDEV_QUEUE_SIZE_LIMIT, }; +#ifdef RTE_BBDEV_SDK_AVX2 static const enum rte_cpu_flag_t cpu_flag = RTE_CPUFLAG_SSE4_2; + dev_info->cpu_flag_reqs = &cpu_flag; +#else + dev_info->cpu_flag_reqs = NULL; +#endif default_queue_conf.socket = dev->data->socket_id; @@ -191,7 +201,6 @@ struct turbo_sw_queue { dev_info->max_ul_queue_priority = 0; dev_info->default_queue_conf = default_queue_conf; dev_info->capabilities = bbdev_capabilities; - dev_info->cpu_flag_reqs = &cpu_flag; dev_info->min_alignment = 64; rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id); @@ -410,6 +419,7 @@ struct turbo_sw_queue { .queue_release = q_release }; +#ifdef RTE_BBDEV_SDK_AVX2 /* Checks if the encoder input buffer is correct. * Returns 0 if it's valid, -1 otherwise. */ @@ -464,6 +474,7 @@ struct turbo_sw_queue { return 0; } +#endif static inline void process_enc_cb(struct turbo_sw_queue *q, struct rte_bbdev_enc_op *op, @@ -472,6 +483,7 @@ struct turbo_sw_queue { struct rte_mbuf *m_out, uint16_t in_offset, uint16_t out_offset, uint16_t in_length, struct rte_bbdev_stats *q_stats) { +#ifdef RTE_BBDEV_SDK_AVX2 int ret; int16_t k_idx; uint16_t m; @@ -724,6 +736,22 @@ struct turbo_sw_queue { } *tmp_out = 0; } +#else + RTE_SET_USED(q); + RTE_SET_USED(op); + RTE_SET_USED(r); + RTE_SET_USED(c); + RTE_SET_USED(k); + RTE_SET_USED(ncb); + RTE_SET_USED(e); + RTE_SET_USED(m_in); + RTE_SET_USED(m_out_head); + RTE_SET_USED(m_out); + RTE_SET_USED(in_offset); + RTE_SET_USED(out_offset); + RTE_SET_USED(in_length); + RTE_SET_USED(q_stats); +#endif } static inline void @@ -835,6 +863,7 @@ struct turbo_sw_queue { NULL); } +#ifdef RTE_BBDEV_SDK_AVX2 static inline void move_padding_bytes(const uint8_t *in, uint8_t *out, uint16_t k, uint16_t ncb) @@ -847,6 +876,7 @@ struct turbo_sw_queue { rte_memcpy(&out[nd + kpi + 64], &in[kpi], d); rte_memcpy(&out[(nd - 1) + 2 * (kpi + 64)], &in[2 * kpi], d); } +#endif static inline void process_dec_cb(struct turbo_sw_queue *q, struct rte_bbdev_dec_op *op, @@ -856,6 +886,7 @@ struct turbo_sw_queue { uint16_t crc24_overlap, uint16_t in_length, struct rte_bbdev_stats *q_stats) { +#ifdef RTE_BBDEV_SDK_AVX2 int ret; int32_t k_idx; int32_t iter_cnt; @@ -972,6 +1003,22 @@ struct turbo_sw_queue { rte_bbdev_log(ERR, "Turbo Decoder failed"); return; } +#else + RTE_SET_USED(q); + RTE_SET_USED(op); + RTE_SET_USED(c); + RTE_SET_USED(k); + RTE_SET_USED(kw); + RTE_SET_USED(m_in); + RTE_SET_USED(m_out_head); + RTE_SET_USED(m_out); + RTE_SET_USED(in_offset); + RTE_SET_USED(out_offset); + RTE_SET_USED(check_crc_24b); + RTE_SET_USED(crc24_overlap); + RTE_SET_USED(in_length); + RTE_SET_USED(q_stats); +#endif } static inline void diff --git a/mk/rte.app.mk b/mk/rte.app.mk index d0df0b0..2c3d07a 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -219,11 +219,14 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_NULL) += -lrte_pmd_bbdev_null # TURBO SOFTWARE PMD is dependent on the FLEXRAN library _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -lrte_pmd_bbdev_turbo_sw +ifeq ($(CONFIG_RTE_BBDEV_SDK_AVX2),y) +# Dependency on the FLEXRAN SDK library if available _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -L$(FLEXRAN_SDK)/lib_crc -lcrc _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -L$(FLEXRAN_SDK)/lib_turbo -lturbo _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -L$(FLEXRAN_SDK)/lib_rate_matching -lrate_matching _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -L$(FLEXRAN_SDK)/lib_common -lcommon _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -lirc -limf -lstdc++ -lipps +endif # CONFIG_RTE_BBDEV_SDK_AVX2 endif # CONFIG_RTE_LIBRTE_BBDEV ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) -- 1.8.3.1