Commit b5706454 authored by Titouan Soulard's avatar Titouan Soulard

libtrx: refactor trx_rdma driver

- Use common circular buffer implementation
- Handle two channels (hardcoded)
- Receive samples asynchronously from RDMA
- Handle timestamps correctly
parent 1aadefaf
...@@ -31,8 +31,8 @@ out/libcapulet.so: common/hashtable.lo libcapulet/net_udp.lo libcapulet/rdma_ib. ...@@ -31,8 +31,8 @@ out/libcapulet.so: common/hashtable.lo libcapulet/net_udp.lo libcapulet/rdma_ib.
out/libpotoml.so: common/hashtable.lo libpotoml/toml.lo out/libpotoml.so: common/hashtable.lo libpotoml/toml.lo
gcc -shared -fPIC -DPIC -o $@ $^ $(LIB_FLAGS) gcc -shared -fPIC -DPIC -o $@ $^ $(LIB_FLAGS)
out/libtrx_rdma.so: libtrx/trx_rdma.lo out/libcapulet.so out/libtrx_rdma.so: common/circular_buffer.lo libtrx/trx_rdma.lo
gcc -shared -fPIC -DPIC -o $@ $< $(LIB_FLAGS) -lcapulet gcc -shared -fPIC -DPIC -o $@ $^ $(LIB_FLAGS) -lcapulet
out/libtrx_play.so: common/circular_buffer.lo libtrx/trx_play.lo out/libtrx_play.so: common/circular_buffer.lo libtrx/trx_play.lo
gcc -shared -fPIC -DPIC -o $@ $^ $(LIB_FLAGS) gcc -shared -fPIC -DPIC -o $@ $^ $(LIB_FLAGS)
......
#pragma once #pragma once
#include <pthread.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <pthread.h>
#include "amarisoft/trx_driver.h" #include "amarisoft/trx_driver.h"
#include "common/hashtable.h" #include "common/circular_buffer.h"
#include "libcapulet/rdma_ib.h" #include "libcapulet/rdma_ib.h"
#include "libcapulet/net_udp.h" #include "libcapulet/net_udp.h"
struct SDRServeMrThreadContext { #define TRX_RDMA_BUFFER_SIZE 4096
struct CommonHashtableTable *mr_mgr; // XXX: hardcoded parameter
int server_socket; #define TRX_RDMA_CHANNEL_COUNT 2
};
struct SDRMetadata { struct SDRMetadata {
uint8_t version; uint8_t version;
uint16_t mr_length; uint16_t sample_count;
uint8_t __unused[27]; uint8_t __unused[27];
}; };
struct SDRMemoryRegion { struct SDRMemoryRegion {
struct SDRMetadata meta; struct SDRMetadata meta;
float iq[4096]; TRXComplex iq[TRX_RDMA_CHANNEL_COUNT][TRX_RDMA_BUFFER_SIZE];
}; };
struct SDRContext { struct SDRContext {
struct CommonHashtableTable mr_mgr;
struct CapuletRdmaIbContext ib_ctx; struct CapuletRdmaIbContext ib_ctx;
struct CapuletNetUdpContext *udp_ctx; struct CapuletNetUdpContext *udp_ctx;
struct CapuletNetUdpMrInfoPacket in_remote; // Not an RDMA MR buffer, but local buffer used to store samples after
struct CapuletNetUdpMrInfoPacket out_remote; // reception before they are dispatched.
struct CommonCBBuffer *recv_buffer;
trx_timestamp_t last_timestamp;
struct ibv_mr *in_mr;
struct ibv_mr *out_mr;
char *server_addr; char *server_addr;
char *device_name; char *device_name;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment