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.
out/libpotoml.so: common/hashtable.lo libpotoml/toml.lo
gcc -shared -fPIC -DPIC -o $@ $^ $(LIB_FLAGS)
out/libtrx_rdma.so: libtrx/trx_rdma.lo out/libcapulet.so
gcc -shared -fPIC -DPIC -o $@ $< $(LIB_FLAGS) -lcapulet
out/libtrx_rdma.so: common/circular_buffer.lo libtrx/trx_rdma.lo
gcc -shared -fPIC -DPIC -o $@ $^ $(LIB_FLAGS) -lcapulet
out/libtrx_play.so: common/circular_buffer.lo libtrx/trx_play.lo
gcc -shared -fPIC -DPIC -o $@ $^ $(LIB_FLAGS)
......
#pragma once
#include <pthread.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <pthread.h>
#include "amarisoft/trx_driver.h"
#include "common/hashtable.h"
#include "common/circular_buffer.h"
#include "libcapulet/rdma_ib.h"
#include "libcapulet/net_udp.h"
struct SDRServeMrThreadContext {
struct CommonHashtableTable *mr_mgr;
int server_socket;
};
#define TRX_RDMA_BUFFER_SIZE 4096
// XXX: hardcoded parameter
#define TRX_RDMA_CHANNEL_COUNT 2
struct SDRMetadata {
uint8_t version;
uint16_t mr_length;
uint16_t sample_count;
uint8_t __unused[27];
};
struct SDRMemoryRegion {
struct SDRMetadata meta;
float iq[4096];
TRXComplex iq[TRX_RDMA_CHANNEL_COUNT][TRX_RDMA_BUFFER_SIZE];
};
struct SDRContext {
struct CommonHashtableTable mr_mgr;
struct CapuletRdmaIbContext ib_ctx;
struct CapuletNetUdpContext *udp_ctx;
struct CapuletNetUdpMrInfoPacket in_remote;
struct CapuletNetUdpMrInfoPacket out_remote;
// Not an RDMA MR buffer, but local buffer used to store samples after
// 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 *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