Hi ,

Thanks Ben and Daniel for looking into this.
Both the issues which I was facing is resolved now.

steps that i took was :

I added "shm_unlink" after "shm_open call".
For the rx issue which I was getting , as suggested by Ben i used gdb to
debug into the libmemif.
and I realised a "memif_refill_queue" call is required  on slave before
master can transmit data, calling memif_refill_queue() on slave provides
buffers for master.

Are you able to run with shm_open without using shm_unlink ?
If you could please post what was your observation.

Thank You
Pragya Nand

On Wed, May 25, 2022 at 1:16 PM Daniel Béreš via lists.fd.io <dberes=
cisco....@lists.fd.io> wrote:

> Hi,
>
> To sync up, can you run loopback example?
>
> I tried to reproduce your problem on 3.10.0-229.1.2.rt56.141.2.el7_1.x86_64
> but I got different result.
>
> diff --git a/extras/libmemif/src/CMakeLists.txt 
> b/extras/libmemif/src/CMakeLists.txt
> index ddb8a52..a11a65f 100644
> --- a/extras/libmemif/src/CMakeLists.txt
> +++ b/extras/libmemif/src/CMakeLists.txt
> @@ -41,6 +41,12 @@ if(LIB_BSD)
>    target_link_libraries(memif ${LIB_BSD})
>  endif()
>
> +find_library(LIB_LRT rt)
> +if(LIB_BSD)
> +  add_compile_definitions(HAS_LIB_LRT)
> +  target_link_libraries(memif ${LIB_LRT})
> +endif()
> +
>  foreach(file ${MEMIF_HEADERS})
>    get_filename_component(dir ${file} DIRECTORY)
>       install(
> diff --git a/extras/libmemif/src/main.c b/extras/libmemif/src/main.c
> index 21b3994..132ce8d 100644
> --- a/extras/libmemif/src/main.c
> +++ b/extras/libmemif/src/main.c
> @@ -184,6 +184,7 @@ memif_get_version_str ()
>
>  #define DBG_TX_BUF (0)
>  #define DBG_RX_BUF (1)
> +#define MEMIF_DBG_SHM 1
>
>  #ifdef MEMIF_DBG_SHM
>  static void
> @@ -1234,13 +1235,17 @@ memif_add_region (memif_connection_t *conn, uint8_t 
> has_buffers)
>    r->region_size = (has_buffers == 0) ? r->buffer_offset : r->buffer_offset +
>      conn->run_args.buffer_size * (1 << conn->run_args.log2_ring_size) *
>      (conn->run_args.num_s2m_rings + conn->run_args.num_m2s_rings);
> -
> +/*
>    if ((r->fd = memfd_create ("memif region 0", MFD_ALLOW_SEALING)) == -1)
>      return memif_syscall_error_handler (errno);
> +*/
> +  if ((r->fd = shm_open ("memif region 0", O_RDWR | O_CREAT, S_IRWXU)) == -1)
> +    return memif_syscall_error_handler (errno);
>
> +/*
>    if ((fcntl (r->fd, F_ADD_SEALS, F_SEAL_SHRINK)) == -1)
>      return memif_syscall_error_handler (errno);
> -
> +*/
>    if ((ftruncate (r->fd, r->region_size)) == -1)
>      return memif_syscall_error_handler (errno);
>
>
> 
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#21468): https://lists.fd.io/g/vpp-dev/message/21468
Mute This Topic: https://lists.fd.io/mt/91224655/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to