Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
trx-ecpri
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
trx-ecpri
Commits
a9594fe1
Commit
a9594fe1
authored
Dec 17, 2024
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
370ef0bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
69 deletions
+42
-69
trx_ecpri.c
trx_ecpri.c
+42
-69
No files found.
trx_ecpri.c
View file @
a9594fe1
...
...
@@ -39,22 +39,12 @@
#include "utils.c"
#include "ring_buffer.c"
/* eCPRI Send and Recv */
#define PACKET_SIZE 262
#define RX_N_CHANNEL 1
#define TX_N_CHANNEL 4
#define FRAME_FREQ INT64_C(3840000) // Basic frame frequency
#define TX_PACKET_SIZE 262
#define RX_MAX_PACKET_SIZE 262
#define TX_ECPRI_PACKET_SIZE (TX_PACKET_SIZE - 14)
#define N_SAMPLES (32)
#define SEND_LIMIT 1250
#define TRX_WB_MAX_PARTS 1000
#define TRX_BUF_MAX_SIZE 1000
// Statistics
// Update period for packets per second counter
#define PPS_UPDATE_PERIOD INT64_C(1000000000)
#define STAT_INT_LEN "9"
#define MAX_CHANNELS 4
/* eCPRI frame structure
...
...
@@ -64,14 +54,7 @@ Ethernet header: 18 bytes
| MAC dst | MAC src | Tag | Ethertype |
+---------+---------+-----+-----------+
eCPRI common header: 1 byte
4b 3b 1b
+---------+----------+--------+
| Version | Reserved | Concat |
+---------+----------+--------+
eCPRI common header: 8 bytes
eCPRI common header: 4 bytes
4b 3b 1b 1 2
+---------+----------+--------+---------+---------+
...
...
@@ -83,8 +66,12 @@ Ethernet + eCPRI header: 26 bytes
eCPRI concatenated frames
4 3 4
+-----------+------------------+---------+-----------+------------------+
| eCPRI | | | eCPRI | |
| Common | eCPRI Payload #0 | Padding | Common | eCPRI Payload #1 |
| Header #0 | | | Header #1 | |
+-----------+------------------+---------+-----------+------------------+
*/
...
...
@@ -94,15 +81,30 @@ typedef struct {
}
Complex
;
typedef
struct
{
const
char
*
re_mac
;
const
char
*
rec_mac
;
const
char
*
rec_if
;
const
uint8_t
*
rrh_mac
;
const
uint8_t
*
bbu_mac
;
const
uint8_t
*
bbu_if
;
const
char
*
log_directory
;
int
recv_affinity
;
int
send_affinity
;
int
prepare_affinity
;
int
decompress_affinity
;
int
encode_affinity
;
int
decode_affinity
;
int
statistic_affinity
;
int
ecpri_period
;
int
flow_id
;
int
frame_frequency
;
int
trx_buf_size
;
int
txrx_buf_size
;
int
trace_rx
;
int
trace_tx
;
int
trace_offset
;
int
monitor_pps
;
int
monitor_trigger_duration
;
int
start_sending
;
int
start_receiving
;
int
rx_n_channel
;
int
tx_n_channel
;
int
statistics_refresh_rate_ns
;
int
sample_rate
;
}
TRXEcpriState
;
...
...
@@ -121,49 +123,20 @@ typedef struct {
#include "private/bf1_sse4.c"
// Buffers
/* rx_rbuf stores ethernet frames */
static
ring_buffer_t
rx_rbuf
;
// Received packets
static
ring_buffer_t
trxr_rbuf
[
RX_N_CHANNEL
];
// Decoded IQ samples
static
ring_buffer_t
tx_rbuf
;
// Packets to send
static
ring_buffer_t
trxw_rbuf
[
TX_N_CHANNEL
];
// Uncompressed IQ samples
static
ring_buffer_t
trxw_group_rbuf
;
// Group of IQ samples
static
ring_buffer_t
rx_rbuf
;
// Received packets, ethernet frames
static
ring_buffer_t
trxr_rbuf
[
MAX_CHANNELS
];
// Decoded IQ samples
static
ring_buffer_t
tx_rbuf
;
// Packets to send, ethernet frames
static
ring_buffer_t
trxw_rbuf
[
MAX_CHANNELS
];
// Uncompressed IQ samples
// Counters
static
volatile
counter_stat_t
recv_counter
;
// frames received from
eRE
static
volatile
counter_stat_t
recv_counter
;
// frames received from
RRH
static
volatile
counter_stat_t
decode_counter
;
// decoded frames
static
volatile
counter_stat_t
read_counter
;
// frames passed to amarisoft stack
static
volatile
counter_stat_t
write_counter
;
// samples to write from TRX
static
volatile
counter_stat_t
encode_counter
;
// encoded frames
static
volatile
counter_stat_t
sent_counter
;
// frames sent to eRE
static
volatile
counter_stat_t
rx_drop_counter
;
// frames sent to eRE
static
volatile
counter_stat_t
tx_drop_counter
;
// frames sent to eRE
// OLD
//static ring_buffer_t rx_rbuf;
//static ring_buffer_t trx_read_rbuf;
//static ring_buffer_t tx_rbuf;
//static ring_buffer_t trx_write_rbuf;
//static volatile int trx_wb_part[TRX_WB_MAX_PARTS]; // TODO write next index instead of current
//static volatile int64_t trx_wb_ts[TRX_WB_MAX_PARTS];
//static int trx_wb_part_read_index;
//static int trx_wb_part_write_index;
//// Locks
//pthread_mutex_t tx_mutex;
//pthread_cond_t tx_cond;
//pthread_mutex_t rx_mutex;
//pthread_cond_t rx_cond;
//pthread_mutex_t tx_ready_mutex;
//pthread_cond_t tx_ready_cond;
//sem_t trx_read_sem;
//// Counters
//static volatile int64_t prepared_frame_count;
//static volatile int64_t read_frame_count;
//static volatile int64_t sent_frame_count;
//// Computed values
//static int rxtx_buf_size;
//static int ecpri_period_mult;
// OLD
static
volatile
counter_stat_t
sent_counter
;
// frames sent to RRH
static
volatile
counter_stat_t
rx_drop_counter
;
// frames sent to RRH
static
volatile
counter_stat_t
tx_drop_counter
;
// frames sent to RRH
// Network
static
volatile
int
seq_id
;
...
...
@@ -671,9 +644,9 @@ int start(TRXEcpriState * s) {
}
if
(
sscanf
(
s
->
re_mac
,
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx%*c"
,
&
dst_mac
[
0
],
&
dst_mac
[
1
],
&
dst_mac
[
2
],
&
dst_mac
[
3
],
&
dst_mac
[
4
],
&
dst_mac
[
5
])
!=
6
)
fprintf
(
stderr
,
"Invalid
eRE
MAC address
\n
"
);
fprintf
(
stderr
,
"Invalid
RRH
MAC address
\n
"
);
if
(
sscanf
(
s
->
rec_mac
,
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx%*c"
,
&
src_mac
[
0
],
&
src_mac
[
1
],
&
src_mac
[
2
],
&
src_mac
[
3
],
&
src_mac
[
4
],
&
src_mac
[
5
])
!=
6
)
fprintf
(
stderr
,
"Invalid
eREC
MAC address
\n
"
);
fprintf
(
stderr
,
"Invalid
RRH
MAC address
\n
"
);
if
((
send_sockfd
=
socket
(
AF_PACKET
,
SOCK_RAW
,
htons
(
ETH_P_ALL
)))
==
-
1
)
{
perror
(
"Socket Error"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment