dpdkstreambuf

DPDK: compilation error while freeing MBUF


I am trying a simple MBUF create from an allocated pool and freeing the MBUF, however running into the following compilation issues.. If I comment out the mbuf_free, the program compiles fine.. Any pointers please ?

Code :

        m = rte_pktmbuf_alloc(pktmbuf_pool);
        if (m == NULL)
            printf("Cannot allocate mbuf");
        if (rte_pktmbuf_pkt_len(m) != 0)
            printf("Bad length");

        data = rte_pktmbuf_append(m, packet_len);
        if (data == NULL)
            printf("Cannot append data");
       
        ....

        rte_pktmbuf_free(packet_data_mbuf); <<<<< COMPLAINS here
 

Error:

/usr/local/include/dpdk/rte_memcpy.h: In function ‘__rte_pktmbuf_free_direct’:
/usr/local/include/dpdk/rte_memcpy.h:595:64: error: ‘__builtin_ia32_palignr128’ needs isa option -m32 -mssse3
         _mm_storeu_si128((__m128i *)((uint8_t *)dst + 0 * 16), _mm_alignr_epi8(xmm1, xmm0, offset));        \
                                                                ^
/usr/local/include/dpdk/rte_memcpy.h:644:16: note: in expansion of macro ‘MOVEUNALIGNED_LEFT47_IMM’
     case 0x01: MOVEUNALIGNED_LEFT47_IMM(dst, src, n, 0x01); break;    \
                ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/dpdk/rte_memcpy.h:798:2: note: in expansion of macro ‘MOVEUNALIGNED_LEFT47’
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
......
......

Solution

  • DPDK API __rte_pktmbuf_free_direct makes use of SIMD intrinsics _mm_alignr_epi8. this internally relies on palignr which are part of SSSE3 instruction set.

    based on the compiler message error: ‘__builtin_ia32_palignr128’ needs ISA option -m32 -mssse3, it appears the compiler flag of -mssse3 is not passed during built.

    Solution: update the CFLAGS with minimum DPDK requirement of -mssse3 for x86 platform.

    Note: If the dpdk version is greater than 19.08, for either custom installed or distro released libdpdk, a simple way to set the right flags is to set CFGLAGS+=$(pkg-config --cflags libdpdk)