xref: /dpdk/lib/net/meson.build (revision 1a2b549bb482b580424ed40b3b33d0673fcd89b0)
199a2dd95SBruce Richardson# SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson# Copyright(c) 2017-2020 Intel Corporation
399a2dd95SBruce Richardson
499a2dd95SBruce Richardsonheaders = files(
54149b1fbSRobin Jarry        'rte_cksum.h',
699a2dd95SBruce Richardson        'rte_ip.h',
7*1a2b549bSRobin Jarry        'rte_ip4.h',
8*1a2b549bSRobin Jarry        'rte_ip6.h',
999a2dd95SBruce Richardson        'rte_tcp.h',
1099a2dd95SBruce Richardson        'rte_udp.h',
11cc11f659SAkhil Goyal        'rte_tls.h',
12cc11f659SAkhil Goyal        'rte_dtls.h',
1399a2dd95SBruce Richardson        'rte_esp.h',
1499a2dd95SBruce Richardson        'rte_sctp.h',
1599a2dd95SBruce Richardson        'rte_icmp.h',
1699a2dd95SBruce Richardson        'rte_arp.h',
1799a2dd95SBruce Richardson        'rte_ether.h',
1832ae9939SAkhil Goyal        'rte_macsec.h',
1999a2dd95SBruce Richardson        'rte_vxlan.h',
2099a2dd95SBruce Richardson        'rte_gre.h',
2199a2dd95SBruce Richardson        'rte_gtp.h',
2299a2dd95SBruce Richardson        'rte_net.h',
2399a2dd95SBruce Richardson        'rte_net_crc.h',
2499a2dd95SBruce Richardson        'rte_mpls.h',
2599a2dd95SBruce Richardson        'rte_higig.h',
2699a2dd95SBruce Richardson        'rte_ecpri.h',
27895ec77bSVolodymyr Fialko        'rte_pdcp_hdr.h',
2899a2dd95SBruce Richardson        'rte_geneve.h',
293a929df1SJie Wang        'rte_l2tpv2.h',
303a929df1SJie Wang        'rte_ppp.h',
31e9b8532eSDong Zhou        'rte_ib.h',
3299a2dd95SBruce Richardson)
3399a2dd95SBruce Richardson
3499a2dd95SBruce Richardsonsources = files(
3599a2dd95SBruce Richardson        'rte_arp.c',
3699a2dd95SBruce Richardson        'rte_ether.c',
3799a2dd95SBruce Richardson        'rte_net.c',
3899a2dd95SBruce Richardson        'rte_net_crc.c',
3999a2dd95SBruce Richardson)
4099a2dd95SBruce Richardsondeps += ['mbuf']
4199a2dd95SBruce Richardson
4299a2dd95SBruce Richardsonif dpdk_conf.has('RTE_ARCH_X86_64')
4399a2dd95SBruce Richardson    net_crc_sse42_cpu_support = (cc.get_define('__PCLMUL__', args: machine_args) != '')
4499a2dd95SBruce Richardson    net_crc_avx512_cpu_support = (
4582621e2fSBruce Richardson            target_has_avx512 and
4699a2dd95SBruce Richardson            cc.get_define('__VPCLMULQDQ__', args: machine_args) != ''
4799a2dd95SBruce Richardson    )
4899a2dd95SBruce Richardson
4999a2dd95SBruce Richardson    net_crc_sse42_cc_support = (cc.has_argument('-mpclmul') and cc.has_argument('-maes'))
5082621e2fSBruce Richardson    net_crc_avx512_cc_support = (cc.has_argument('-mvpclmulqdq') and cc_has_avx512)
5199a2dd95SBruce Richardson
5299a2dd95SBruce Richardson    build_static_net_crc_sse42_lib = 0
5399a2dd95SBruce Richardson    build_static_net_crc_avx512_lib = 0
5499a2dd95SBruce Richardson
5599a2dd95SBruce Richardson    if net_crc_sse42_cpu_support == true
5699a2dd95SBruce Richardson        sources += files('net_crc_sse.c')
5799a2dd95SBruce Richardson        cflags += ['-DCC_X86_64_SSE42_PCLMULQDQ_SUPPORT']
5899a2dd95SBruce Richardson        if net_crc_avx512_cpu_support == true
5999a2dd95SBruce Richardson            sources += files('net_crc_avx512.c')
6099a2dd95SBruce Richardson            cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT']
6199a2dd95SBruce Richardson        elif net_crc_avx512_cc_support == true
6299a2dd95SBruce Richardson            build_static_net_crc_avx512_lib = 1
6382621e2fSBruce Richardson            net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq']
6499a2dd95SBruce Richardson            cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT']
6599a2dd95SBruce Richardson        endif
6699a2dd95SBruce Richardson    elif net_crc_sse42_cc_support == true
6799a2dd95SBruce Richardson        build_static_net_crc_sse42_lib = 1
6899a2dd95SBruce Richardson        net_crc_sse42_lib_cflags = ['-mpclmul', '-maes']
6999a2dd95SBruce Richardson        cflags += ['-DCC_X86_64_SSE42_PCLMULQDQ_SUPPORT']
7099a2dd95SBruce Richardson        if net_crc_avx512_cc_support == true
7199a2dd95SBruce Richardson            build_static_net_crc_avx512_lib = 1
7282621e2fSBruce Richardson            net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq', '-mpclmul']
7399a2dd95SBruce Richardson            cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT']
7499a2dd95SBruce Richardson        endif
7599a2dd95SBruce Richardson    endif
7699a2dd95SBruce Richardson
7799a2dd95SBruce Richardson    if build_static_net_crc_sse42_lib == 1
7899a2dd95SBruce Richardson        net_crc_sse42_lib = static_library(
7999a2dd95SBruce Richardson                'net_crc_sse42_lib',
8099a2dd95SBruce Richardson                'net_crc_sse.c',
8199a2dd95SBruce Richardson                dependencies: static_rte_eal,
8299a2dd95SBruce Richardson                c_args: [cflags,
8399a2dd95SBruce Richardson                    net_crc_sse42_lib_cflags])
8499a2dd95SBruce Richardson        objs += net_crc_sse42_lib.extract_objects('net_crc_sse.c')
8599a2dd95SBruce Richardson    endif
8699a2dd95SBruce Richardson
8799a2dd95SBruce Richardson    if build_static_net_crc_avx512_lib == 1
8899a2dd95SBruce Richardson        net_crc_avx512_lib = static_library(
8999a2dd95SBruce Richardson                'net_crc_avx512_lib',
9099a2dd95SBruce Richardson                'net_crc_avx512.c',
9199a2dd95SBruce Richardson                dependencies: static_rte_eal,
9299a2dd95SBruce Richardson                c_args: [cflags,
9399a2dd95SBruce Richardson                    net_crc_avx512_lib_cflags])
9499a2dd95SBruce Richardson        objs += net_crc_avx512_lib.extract_objects('net_crc_avx512.c')
9599a2dd95SBruce Richardson    endif
9699a2dd95SBruce Richardson
9799a2dd95SBruce Richardsonelif (dpdk_conf.has('RTE_ARCH_ARM64') and
9899a2dd95SBruce Richardson        cc.get_define('__ARM_FEATURE_CRYPTO', args: machine_args) != '')
9999a2dd95SBruce Richardson    sources += files('net_crc_neon.c')
10099a2dd95SBruce Richardson    cflags += ['-DCC_ARM64_NEON_PMULL_SUPPORT']
10199a2dd95SBruce Richardsonendif
102