Commit ada02d83 authored by Joanne Hugé's avatar Joanne Hugé

Fix multiple bugs with amarisoft integration

parent 8c9fa1b5
...@@ -31,12 +31,15 @@ ...@@ -31,12 +31,15 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "trx_driver.h"
typedef struct { typedef struct {
const char * re_mac; const char * re_mac;
const char * rec_mac; const char * rec_mac;
const char * rec_if; const char * rec_if;
const char * dpdk_options; const char * dpdk_options;
const char * trace_file; const char * trace_file;
const char * stats_file;
int recv_affinity; int recv_affinity;
int send_affinity; int send_affinity;
int prepare_affinity; int prepare_affinity;
...@@ -47,6 +50,7 @@ typedef struct { ...@@ -47,6 +50,7 @@ typedef struct {
int sample_rate; int sample_rate;
int trace_period; int trace_period;
} TRXEcpriState; } TRXEcpriState;
static void log_error(const char * section, const char * msg, ...) { static void log_error(const char * section, const char * msg, ...) {
time_t t; time_t t;
struct tm ts; struct tm ts;
...@@ -79,7 +83,37 @@ static void log_info(const char * section, const char * msg, ...) { ...@@ -79,7 +83,37 @@ static void log_info(const char * section, const char * msg, ...) {
va_end(arglist); va_end(arglist);
puts(line); puts(line);
} }
int startdpdk(TRXEcpriState * s); // Timestamps utils
#define NSEC_PER_SEC INT64_C(1000000000)
static struct timespec int_to_ts(int64_t t) {
struct timespec ts;
ts.tv_sec = t / NSEC_PER_SEC;
ts.tv_nsec = t - (ts.tv_sec * NSEC_PER_SEC);
return ts;
}
static int64_t ts_to_int(struct timespec ts) {
return ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec;
}
static void add_ns(struct timespec *t, int64_t ns) {
t->tv_nsec += ns;
while (t->tv_nsec >= ((int64_t)NSEC_PER_SEC)) {
t->tv_sec += 1;
t->tv_nsec -= NSEC_PER_SEC;
}
}
static int64_t calcdiff_ns(struct timespec t1, struct timespec t2) {
int64_t diff;
diff = NSEC_PER_SEC * ((int)t1.tv_sec - (int)t2.tv_sec);
diff += ((int)t1.tv_nsec - (int)t2.tv_nsec);
return diff;
}
TRXState s1;
float ** tx_samples;
float ** rx_samples;
void dummy_enb_init(TRXState *s1, TRXEcpriState *s);
static void enb(TRXState *s1, TRXEcpriState * s);
int main(int argc, char * argv[]) { int main(int argc, char * argv[]) {
(void) argc; (void) argc;
...@@ -95,59 +129,11 @@ int main(int argc, char * argv[]) { ...@@ -95,59 +129,11 @@ int main(int argc, char * argv[]) {
s = malloc(sizeof(TRXEcpriState)); s = malloc(sizeof(TRXEcpriState));
memset(s, 0, sizeof(*s)); memset(s, 0, sizeof(*s));
#if 0
// tiogapass-003 MT27710
s->rec_mac = "b8:59:9f:07:7e:2a";
//s->re_mac = "04:09:a5:0f:9f:4c"; // Lille M6424 Switch
s->re_mac = "b8:59:9f:07:86:42"; // tiogapass-004 MT27710
//s->re_mac = "b4:96:91:a7:1c:f4"; // tiogapass-004 XXV710DA2T port0
s->rec_if = "ens9f0";
s->dpdk_options = "-l 10,20 -b 0000:04:00.0 -b 0000:5e:00.1 ";
#endif
#if 0
// tiogapass-003 MT27710 port1
s->rec_mac = "b8:59:9f:07:7e:2b";
s->re_mac = "04:09:a5:0f:9f:4c"; // Lille M6424 Switch
//s->re_mac = "b8:59:9f:07:86:42"; // tiogapass-004 MT27710
//s->re_mac = "b4:96:91:a7:1c:f5"; // tiogapass-004 XXV710DA2T port1
s->rec_if = "ens9f1";
s->dpdk_options = "-l 10,20 -b 0000:04:00.0 -b 0000:5e:00.0 ";
#endif
#if 0
// hfr-tiogapass-001 MT27710
s->rec_mac = "b8:59:9f:07:82:ca";
s->re_mac = "04:09:a5:0f:76:1c"; // HFR M6424 switch
s->rec_if = "ens9f0";
s->dpdk_options = "-l 10,20 -b 0000:04:00.0 -b 0000:18:00.0 -b 0000:18:00.1 -b 0000:5e:00.1 ";
#endif
#if 0
// hfr-tiogapass-001 XXV710DA2T
s->rec_mac = "b4:96:91:a7:1b:28";
s->re_mac = "04:09:a5:0f:76:1c"; // HFR M6424 switch
s->rec_if = "ens1f0";
s->dpdk_options = "-l 10,20 -b 0000:04:00.0 -b 0000:18:00.1 -b 0000:5e:00.0 -b 0000:5e:00.1 ";
#endif
#if 1
// tiogapass-004 MT27710
s->rec_mac = "b8:59:9f:07:86:42";
//s->re_mac = "04:09:a5:0f:9f:4c"; // Lille M6424 Switch
s->re_mac = "b8:59:9f:07:7e:2a"; // tiogapass-003 MT27710
s->rec_if = "ens9f0";
s->dpdk_options = "-l 10,20 -b 0000:04:00.0 -b 0000:3b:00.0 -b 0000:3b:00.1 -b 0000:5e:00.1 ";
#endif
#if 0
// tiogapass-004 XXV710DA2T
s->rec_mac = "b4:96:91:a7:1c:f4"; s->rec_mac = "b4:96:91:a7:1c:f4";
s->re_mac = "04:09:a5:0f:9f:4c"; // Lille M6424 Switch s->re_mac = "04:09:a5:0f:9f:4c";
s->re_mac = "b8:59:9f:07:7e:2a"; // tiogapass-003 MT27710 s->re_mac = "b8:59:9f:07:7e:2a";
s->rec_if = "ens5f0"; s->rec_if = "ens5f0";
s->dpdk_options = "-l 10,20 -b 0000:04:00.0 -b 0000:3b:00.1 -b 0000:5e:00.0 -b 0000:5e:00.1 "; s->dpdk_options = "-l 10,20 -b 0000:04:00.0 -b 0000:3b:00.1 -b 0000:5e:00.0 -b 0000:5e:00.1 ";
#endif
s->recv_affinity = 39; s->recv_affinity = 39;
s->send_affinity = 38; s->send_affinity = 38;
...@@ -158,17 +144,45 @@ int main(int argc, char * argv[]) { ...@@ -158,17 +144,45 @@ int main(int argc, char * argv[]) {
s->flow_id = 0; s->flow_id = 0;
s->sample_rate = 122880000; s->sample_rate = 122880000;
s->trace_file = "/root/ecpri_trace"; s->trace_file = "/root/ecpri-logs/rx.trace";
s->stats_file = "/root/ecpri-logs/ecpri.stats";
s->trace_period = 1000000; s->trace_period = 1000000;
log_info("TEST-DPDK-ECPRI", "Starting test...\n"); log_info("TEST-DPDK-ECPRI", "Starting test...\n");
log_info("TEST-DPDK-ECPRI", "rec-mac: %s, re-mac: %s, rec-if: %s", s->rec_mac, s->re_mac, s->rec_if); log_info("TEST-DPDK-ECPRI", "rec-mac: %s, re-mac: %s, rec-if: %s", s->rec_mac, s->re_mac, s->rec_if);
startdpdk(s); dummy_enb_init(&s1, s);
enb(&s1, s);
}
for(;;) { static void enb(TRXState * s1, TRXEcpriState * s) {
sleep(1); struct timespec next;
trx_timestamp_t ptimestamp;
int64_t p = 1000000 * 100;
int m = 1;
clock_gettime(CLOCK_TAI, &next);
tx_samples = (float**) malloc(sizeof(float*) * 4);
rx_samples = (float**) malloc(sizeof(float*) * 4);
for(int i = 0; i < 4; i++) {
tx_samples[i] = (float*) malloc(sizeof(float) * 65536);
rx_samples[i] = (float*) malloc(sizeof(float) * 65536);
for(int j = 0; j < 65536; j++) {
tx_samples[i][j] = i * j;
}
} }
for(int i = 0;; i++) {
int64_t tx_timestamp = 256 * (INT64_C(3840000) * ((int64_t) p * i + p)) / (INT64_C(1000000000));
add_ns(&next, p);
s1->trx_read_func2(s1, &ptimestamp, rx_samples, 256 * m, 0, NULL);
s1->trx_write_func2(s1, tx_timestamp, tx_samples, 256 * m, 0, NULL);
s1->trx_write_func2(s1, tx_timestamp + 256 * m + 100, tx_samples, 256 * m, 0, NULL);
s1->trx_write_func2(s1, tx_timestamp + 2 * 256 * m + 110, tx_samples, 256 * m, 0, NULL);
clock_nanosleep(CLOCK_TAI, TIMER_ABSTIME, &next, NULL);
}
} }
#!/bin/bash #!/bin/bash
cd ..;
make;
cd ecpri-tests;
make all;
export LD_LIBRARY_PATH="/root/ecpri-priv:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH="/root/ecpri-priv:$LD_LIBRARY_PATH"
cd .. &&
make &&
cd ecpri-tests &&
make all &&
./test-dpdk-ecpri ./test-dpdk-ecpri
This diff is collapsed.
chrt -f 97 taskset -c 39 phc2sys -m -c ens5f0 -s CLOCK_REALTIME -O0 -f $HOME/linuxptp/configs/G.8275.1.cfg # Tiogapass004 test
#chrt -f 97 taskset -c 2 phc2sys -m -c ens9f1 -s CLOCK_REALTIME -O0 -f $HOME/linuxptp/configs/G.8275.1.cfg
#chrt -f 97 taskset -c 2 phc2sys -m -s ens9f1 -c CLOCK_REALTIME -O0 -f $HOME/linuxptp/configs/G.8275.1.cfg
# HFR Switch
chrt -f 97 taskset -c 39 phc2sys -m -c ens9f0 -s CLOCK_REALTIME -O0 -f $HOME/linuxptp/configs/G.8275.1.cfg
# Tiogapass003 test
#chrt -f 97 taskset -c 38 ptp4l -H -i ens9f1 -m -f $HOME/linuxptp/configs/G.8275.1.cfg
# HFR Switch
chrt -f 97 taskset -c 38 ptp4l -H -i ens9f0 -m -f $HOME/linuxptp/configs/G.8275.1.cfg chrt -f 97 taskset -c 38 ptp4l -H -i ens9f0 -m -f $HOME/linuxptp/configs/G.8275.1.cfg
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