Commit 65f8d8de authored by Joanne Hugé's avatar Joanne Hugé

wip

parent f602b253
...@@ -48,7 +48,8 @@ ...@@ -48,7 +48,8 @@
#define ETHERNET_HEADER 14 #define ETHERNET_HEADER 14
#define ECPRI_COMMON_HEADER 4 #define ECPRI_COMMON_HEADER 4
#define ECPRI_IQ_HEADER (ECPRI_COMMON_HEADER + 4) #define ECPRI_IQ_HEADER (ECPRI_COMMON_HEADER + 4)
#define PACKET_HEADER (ETHERNET_HEADER + ECPRI_IQ_HEADER) #define ORAN_HEADER 8
#define PACKET_HEADER (ETHERNET_HEADER + ECPRI_IQ_HEADER + ORAN_HEADER)
/* eCPRI frame structure /* eCPRI frame structure
...@@ -157,7 +158,7 @@ static volatile int seq_id; ...@@ -157,7 +158,7 @@ static volatile int seq_id;
static int send_sockfd; static int send_sockfd;
static int recv_sockfd; static int recv_sockfd;
static struct sockaddr_ll connect_sk_addr; static struct sockaddr_ll connect_sk_addr;
static uint8_t ecpri_iq_header[ECPRI_IQ_HEADER]; static uint8_t ecpri_iq_header[ECPRI_IQ_HEADER + ORAN_HEADER];
static uint8_t packet_header[PACKET_HEADER]; // ethernet + ecpri + iq header static uint8_t packet_header[PACKET_HEADER]; // ethernet + ecpri + iq header
static void print_stats(FILE * f, int print_header) { static void print_stats(FILE * f, int print_header) {
...@@ -419,6 +420,7 @@ static void *encode_thread(void *p) { ...@@ -419,6 +420,7 @@ static void *encode_thread(void *p) {
int64_t target_counter = 0; int64_t target_counter = 0;
struct timespec next; struct timespec next;
int reset_encode_counter = 1; int reset_encode_counter = 1;
uint8_t * data;
// Set thread CPU affinity // Set thread CPU affinity
CPU_ZERO(&mask); CPU_ZERO(&mask);
...@@ -436,7 +438,13 @@ static void *encode_thread(void *p) { ...@@ -436,7 +438,13 @@ static void *encode_thread(void *p) {
// If there are frames from trx_write callback to encode // If there are frames from trx_write callback to encode
if(to_write && to_read) { if(to_write && to_read) {
data = rbuf_write(&tx_rbuf);
memcpy(data, packet_header, PACKET_HEADER);
// SEQ_ID
*((uint16_t *) data[ETHERNET_HEADER + ECPRI_COMMON_HEADER + 2]) = htons(seq_id++);
// Frame ID
data[ETHERNET_HEADER + ECPRI_IQ_HEADER + 1] = seq_id;
// TODO // TODO
...@@ -735,7 +743,7 @@ int start(TRXEcpriState * s) { ...@@ -735,7 +743,7 @@ int start(TRXEcpriState * s) {
} }
memset((uint8_t *) packet_header, 0, PACKET_HEADER); memset((uint8_t *) packet_header, 0, PACKET_HEADER);
memset((uint8_t *) ecpri_iq_header, 0, ECPRI_IQ_HEADER); memset((uint8_t *) ecpri_iq_header, 0, ECPRI_IQ_HEADER + ORAN_HEADER);
if(sscanf((char *) s->rrh_mac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx%*c", if(sscanf((char *) s->rrh_mac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx%*c",
&d_addr.addr_bytes[0], &d_addr.addr_bytes[0],
...@@ -787,7 +795,16 @@ int start(TRXEcpriState * s) { ...@@ -787,7 +795,16 @@ int start(TRXEcpriState * s) {
/* IQ message header */ /* IQ message header */
*((uint16_t *) (ecpri_iq_header + ECPRI_COMMON_HEADER)) = htons(s->flow_id); *((uint16_t *) (ecpri_iq_header + ECPRI_COMMON_HEADER)) = htons(s->flow_id);
memcpy(packet_header + ETHERNET_HEADER, ecpri_iq_header, ECPRI_IQ_HEADER); /* ORAN HEADER */
ecpri_iq_header[ECPRI_IQ_HEADER] = 0x90;
ecpri_iq_header[ECPRI_IQ_HEADER + 3] = 0x00;
ecpri_iq_header[ECPRI_IQ_HEADER + 4] = 0x00;
ecpri_iq_header[ECPRI_IQ_HEADER + 5] = 0x00;
ecpri_iq_header[ECPRI_IQ_HEADER + 6] = 0x00;
memcpy(packet_header + ETHERNET_HEADER,
ecpri_iq_header,
ECPRI_IQ_HEADER + ORAN_HEADER);
start_threads(s); start_threads(s);
return 0; return 0;
......
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