Commit e7a71480 authored by Raymond Knopp's avatar Raymond Knopp

Merge branch 'enhancement-10-harmony' of...

Merge branch 'enhancement-10-harmony' of https://gitlab.eurecom.fr/oai/openairinterface5g into enhancement-10-harmony
parents 0d227769 bf75df22
...@@ -65,9 +65,7 @@ uint16_t pck_seq_num_prev=0; ...@@ -65,9 +65,7 @@ uint16_t pck_seq_num_prev=0;
int eth_socket_init_udp(openair0_device *device) { int eth_socket_init_udp(openair0_device *device) {
int i = 0;
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
int Mod_id = device->Mod_id;
char str_local[INET_ADDRSTRLEN]; char str_local[INET_ADDRSTRLEN];
char str_remote[INET_ADDRSTRLEN]; char str_remote[INET_ADDRSTRLEN];
const char *local_ip, *remote_ip; const char *local_ip, *remote_ip;
...@@ -102,23 +100,22 @@ int eth_socket_init_udp(openair0_device *device) { ...@@ -102,23 +100,22 @@ int eth_socket_init_udp(openair0_device *device) {
} }
/* initialize addresses */ /* initialize addresses */
for (i=0; i< MAX_INST; i++) { bzero((void *)&(eth->dest_addr), sizeof(eth->dest_addr));
bzero((void *)&(dest_addr[i]), sizeof(dest_addr[i])); bzero((void *)&(eth->local_addr), sizeof(eth->local_addr));
bzero((void *)&(local_addr[i]), sizeof(local_addr[i]));
}
eth->udp.addr_len = sizeof(struct sockaddr_in); eth->addr_len = sizeof(struct sockaddr_in);
eth->udp.dest_addr.sin_family = AF_INET; eth->dest_addr.sin_family = AF_INET;
inet_pton(AF_INET,remote_ip,&(dest_addr.sin_addr.s_addr)); inet_pton(AF_INET,remote_ip,&(eth->dest_addr.sin_addr.s_addr));
eth->udp.dest_addr.sin_port=htons(remote_port); eth->dest_addr.sin_port=htons(remote_port);
inet_ntop(AF_INET, &(eth->udp.dest_addr.sin_addr), str_remote, INET_ADDRSTRLEN); inet_ntop(AF_INET, &(eth->dest_addr.sin_addr), str_remote, INET_ADDRSTRLEN);
device->local_addr.sin_family = AF_INET; eth->local_addr.sin_family = AF_INET;
inet_pton(AF_INET,local_ip,&(device->local_addr.sin_addr.s_addr)); inet_pton(AF_INET,local_ip,&(eth->local_addr.sin_addr.s_addr));
device->local_addr.sin_port=htons(local_port); eth->local_addr.sin_port=htons(local_port);
inet_ntop(AF_INET, &(device->local_addr.sin_addr), str_local, INET_ADDRSTRLEN); inet_ntop(AF_INET, &(eth->local_addr.sin_addr), str_local, INET_ADDRSTRLEN);
/* set reuse address flag */ /* set reuse address flag */
...@@ -128,11 +125,11 @@ int eth_socket_init_udp(openair0_device *device) { ...@@ -128,11 +125,11 @@ int eth_socket_init_udp(openair0_device *device) {
} }
/* want to receive -> so bind */ /* want to receive -> so bind */
if (bind(eth->sockfd,(struct sockaddr *)&eth->udp.local_addr,addr_len[Mod_id])<0) { if (bind(eth->sockfd,(struct sockaddr *)&eth->local_addr,eth->addr_len)<0) {
perror("ETHERNET: Cannot bind to socket"); perror("ETHERNET: Cannot bind to socket");
exit(0); exit(0);
} else { } else {
printf("[%s] binding mod_%d to %s:%d\n","RRH",Mod_id,str_local,ntohs(eth->udp.local_addr.sin_port)); printf("[%s] binding to %s:%d\n","RRH",str_local,ntohs(eth->local_addr.sin_port));
} }
return 0; return 0;
...@@ -144,8 +141,7 @@ int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestam ...@@ -144,8 +141,7 @@ int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestam
int nblocks = nsamps; int nblocks = nsamps;
int bytes_received=-1; int bytes_received=-1;
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
int Mod_id = device->Mod_id;
ssize_t packet_size = sizeof_IF4p5_header_t; ssize_t packet_size = sizeof_IF4p5_header_t;
IF4p5_header_t *test_header = (IF4p5_header_t*)(buff[0]); IF4p5_header_t *test_header = (IF4p5_header_t*)(buff[0]);
...@@ -159,8 +155,8 @@ int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestam ...@@ -159,8 +155,8 @@ int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestam
buff[0], buff[0],
packet_size, packet_size,
0, 0,
(struct sockaddr *)&eth->udp.dest_addr, (struct sockaddr *)&eth->dest_addr,
(socklen_t *)&addr_len[Mod_id]); (socklen_t *)&eth->addr_len);
if (bytes_received ==-1) { if (bytes_received ==-1) {
eth->num_rx_errors++; eth->num_rx_errors++;
if (errno == EAGAIN) { if (errno == EAGAIN) {
...@@ -206,7 +202,6 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam ...@@ -206,7 +202,6 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam
int bytes_sent = 0; int bytes_sent = 0;
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
int Mod_id = device->Mod_id;
ssize_t packet_size; ssize_t packet_size;
...@@ -227,8 +222,8 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam ...@@ -227,8 +222,8 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam
buff[0], buff[0],
packet_size, packet_size,
0, 0,
(struct sockaddr*)&eth->udp.dest_addr, (struct sockaddr*)&eth->dest_addr,
addr_len[Mod_id]); eth->addr_len);
if (bytes_sent == -1) { if (bytes_sent == -1) {
eth->num_tx_errors++; eth->num_tx_errors++;
...@@ -246,7 +241,6 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi ...@@ -246,7 +241,6 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
int bytes_sent=0; int bytes_sent=0;
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
int Mod_id = device->Mod_id;
int sendto_flag =0; int sendto_flag =0;
int i=0; int i=0;
//sendto_flag|=flags; //sendto_flag|=flags;
...@@ -284,8 +278,8 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi ...@@ -284,8 +278,8 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
buff2, buff2,
UDP_PACKET_SIZE_BYTES(nsamps), UDP_PACKET_SIZE_BYTES(nsamps),
sendto_flag, sendto_flag,
(struct sockaddr*)&eth->udp.dest_addr, (struct sockaddr*)&eth->dest_addr,
addr_len[Mod_id]); eth->addr_len);
if ( bytes_sent == -1) { if ( bytes_sent == -1) {
eth->num_tx_errors++; eth->num_tx_errors++;
...@@ -321,7 +315,6 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi ...@@ -321,7 +315,6 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
int bytes_received=0; int bytes_received=0;
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
// openair0_timestamp prev_timestamp = -1; // openair0_timestamp prev_timestamp = -1;
int Mod_id = device->Mod_id;
int rcvfrom_flag =0; int rcvfrom_flag =0;
int block_cnt=0; int block_cnt=0;
int again_cnt=0; int again_cnt=0;
...@@ -354,8 +347,8 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi ...@@ -354,8 +347,8 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
buff2, buff2,
UDP_PACKET_SIZE_BYTES(nsamps), UDP_PACKET_SIZE_BYTES(nsamps),
rcvfrom_flag, rcvfrom_flag,
(struct sockaddr *)&eth->udp.dest_addr, (struct sockaddr *)&eth->dest_addr,
(socklen_t *)&device->udp.addr_len); (socklen_t *)&eth->addr_len);
if (bytes_received ==-1) { if (bytes_received ==-1) {
eth->num_rx_errors++; eth->num_rx_errors++;
...@@ -401,7 +394,7 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi ...@@ -401,7 +394,7 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
/* get the packet sequence number from packet's header */ /* get the packet sequence number from packet's header */
pck_seq_num_cur = *(uint16_t *)buff2; pck_seq_num_cur = *(uint16_t *)buff2;
//printf("cur=%d prev=%d buff=%d\n",pck_seq_num_cur,pck_seq_num_prev,*(uint16_t *)(buff2)); //printf("cur=%d prev=%d buff=%d\n",pck_seq_num_cur,pck_seq_num_prev,*(uint16_t *)(buff2));
if ( ( pck_seq_num_cur != (pck_seq_num_prev + 1) ) && !((pck_seq_num_prev==MAX_PACKET_SEQ_NUM(nsamps,device->openair0_cfg->samples_per_frame)) && (pck_seq_num_cur==1 )) && !((pck_seq_num_prev==1) && (pck_seq_num_cur==1))) { if ( ( pck_seq_num_cur != (pck_seq_num_prev + 1) ) && !((pck_seq_num_prev==MAX_PACKET_SEQ_NUM(nsamps,device->openair0_cfg->samples_per_frame)) && (pck_seq_num_cur==1 )) && !((pck_seq_num_prev==1) && (pck_seq_num_cur==1))) {
printf("out of order packet received1! %d|%d|%d\n",pck_seq_num_cur,pck_seq_num_prev,(int)*timestamp); printf("out of order packet received1! %d|%d|%d\n",pck_seq_num_cur,pck_seq_num_prev,(int)*timestamp);
} }
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM,pck_seq_num_cur); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM,pck_seq_num_cur);
...@@ -424,7 +417,6 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi ...@@ -424,7 +417,6 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
int eth_set_dev_conf_udp(openair0_device *device) { int eth_set_dev_conf_udp(openair0_device *device) {
int Mod_id = device->Mod_id;
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
void *msg; void *msg;
ssize_t msg_len; ssize_t msg_len;
...@@ -438,12 +430,9 @@ int eth_set_dev_conf_udp(openair0_device *device) { ...@@ -438,12 +430,9 @@ int eth_set_dev_conf_udp(openair0_device *device) {
msg_len=sizeof(openair0_config_t); msg_len=sizeof(openair0_config_t);
memcpy(msg,(void*)device->openair0_cfg,msg_len); memcpy(msg,(void*)device->openair0_cfg,msg_len);
printf("Sending configuration to device %p (%d.%d.%d.%d)\n",device, if (sendto(eth->sockfd,msg,msg_len,0,(struct sockaddr *)&eth->dest_addr,eth->addr_len)==-1) {
eth->udp.dest_addr[3],eth->udp.dest_addr[2],eth->udp.dest_addr[1],eth->udp.dest_addr[0],msg_len); perror("ETHERNET: sendto conf_udp");
printf("addr_len : %d, msg_len %d\n",eth->addr_len,msg_len);
if (sendto(eth->sockfd,msg,msg_len,0,(struct sockaddr *)&eth->udp.dest_addr,device->udp.addr_len)==-1) {
perror("ETHERNET: ");
printf("addr_len[%d] : %d, msg_len %d\n",Mod_id,device->udp.addr_len,msg_len);
exit(0); exit(0);
} }
...@@ -453,7 +442,6 @@ int eth_set_dev_conf_udp(openair0_device *device) { ...@@ -453,7 +442,6 @@ int eth_set_dev_conf_udp(openair0_device *device) {
int eth_get_dev_conf_udp(openair0_device *device) { int eth_get_dev_conf_udp(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
int Mod_id = device->Mod_id;
char str1[INET_ADDRSTRLEN],str[INET_ADDRSTRLEN]; char str1[INET_ADDRSTRLEN],str[INET_ADDRSTRLEN];
void *msg; void *msg;
ssize_t msg_len; ssize_t msg_len;
...@@ -461,29 +449,29 @@ int eth_get_dev_conf_udp(openair0_device *device) { ...@@ -461,29 +449,29 @@ int eth_get_dev_conf_udp(openair0_device *device) {
msg=malloc(sizeof(openair0_config_t)); msg=malloc(sizeof(openair0_config_t));
msg_len=sizeof(openair0_config_t); msg_len=sizeof(openair0_config_t);
inet_ntop(AF_INET, &(eth->udp.local_addr.sin_addr), str, INET_ADDRSTRLEN); inet_ntop(AF_INET, &(eth->local_addr.sin_addr), str, INET_ADDRSTRLEN);
inet_ntop(AF_INET, &(eth->udp.dest_addr.sin_addr), str1, INET_ADDRSTRLEN); inet_ntop(AF_INET, &(eth->dest_addr.sin_addr), str1, INET_ADDRSTRLEN);
/* RRH receives from BBU openair0_config_t */ /* RRH receives from BBU openair0_config_t */
if (recvfrom(eth->sockfd, if (recvfrom(eth->sockfd,
msg, msg,
msg_len, msg_len,
0, 0,
(struct sockaddr *)&eth->udp.dest_addr, (struct sockaddr *)&eth->dest_addr,
(socklen_t *)&addr_len[Mod_id])==-1) { (socklen_t *)&eth->addr_len)==-1) {
perror("ETHERNET: "); perror("ETHERNET: recv_from conf_udp");
exit(0); exit(0);
} }
device->openair0_cfg=(openair0_config_t *)msg; device->openair0_cfg=(openair0_config_t *)msg;
/* get remote ip address and port */ /* get remote ip address and port */
/* inet_ntop(AF_INET, &(eth->udp.dest_addr.sin_addr), str1, INET_ADDRSTRLEN); */ /* inet_ntop(AF_INET, &(eth->dest_addr.sin_addr), str1, INET_ADDRSTRLEN); */
/* device->openair0_cfg->remote_port =ntohs(eth->udp.dest_addr.sin_port); */ /* device->openair0_cfg->remote_port =ntohs(eth->dest_addr.sin_port); */
/* device->openair0_cfg->remote_addr =str1; */ /* device->openair0_cfg->remote_addr =str1; */
/* /\* restore local ip address and port *\/ */ /* /\* restore local ip address and port *\/ */
/* inet_ntop(AF_INET, &(eth->udp.local_addr.sin_addr), str, INET_ADDRSTRLEN); */ /* inet_ntop(AF_INET, &(eth->local_addr.sin_addr), str, INET_ADDRSTRLEN); */
/* device->openair0_cfg->my_port =ntohs(eth->udp.local_addr.sin_port); */ /* device->openair0_cfg->my_port =ntohs(eth->local_addr.sin_port); */
/* device->openair0_cfg->my_addr =str; */ /* device->openair0_cfg->my_addr =str; */
/* printf("[RRH] mod_%d socket %d connected to BBU %s:%d %s:%d\n", Mod_id, eth->sockfd,str1, device->openair0_cfg->remote_port, str, device->openair0_cfg->my_port); */ /* printf("[RRH] mod_%d socket %d connected to BBU %s:%d %s:%d\n", Mod_id, eth->sockfd,str1, device->openair0_cfg->remote_port, str, device->openair0_cfg->my_port); */
......
...@@ -119,13 +119,12 @@ int trx_eth_start(openair0_device *device) { ...@@ -119,13 +119,12 @@ int trx_eth_start(openair0_device *device) {
void trx_eth_end(openair0_device *device) { void trx_eth_end(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
int Mod_id = device->Mod_id;
/* destroys socket only for the processes that call the eth_end fuction-- shutdown() for beaking the pipe */ /* destroys socket only for the processes that call the eth_end fuction-- shutdown() for beaking the pipe */
if ( close(eth->sockfd) <0 ) { if ( close(eth->sockfd) <0 ) {
perror("ETHERNET: Failed to close socket"); perror("ETHERNET: Failed to close socket");
exit(0); exit(0);
} else { } else {
printf("[%s] socket for mod_id %d has been successfully closed.\n",(device->host_type == BBU_HOST)? "BBU":"RRH",Mod_id); printf("[%s] socket has been successfully closed.\n",(device->host_type == BBU_HOST)? "BBU":"RRH");
} }
} }
...@@ -133,22 +132,14 @@ void trx_eth_end(openair0_device *device) { ...@@ -133,22 +132,14 @@ void trx_eth_end(openair0_device *device) {
int trx_eth_request(openair0_device *device, void *msg, ssize_t msg_len) { int trx_eth_request(openair0_device *device, void *msg, ssize_t msg_len) {
int Mod_id = device->Mod_id;
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
/* BBU sends a message to RRH */ /* BBU sends a message to RRH */
if ((eth->flags == ETH_RAW_MODE) || (eth->flags == ETH_RAW_IF4p5_MODE)) if (sendto(eth->sockfd,msg,msg_len,0,(struct sockaddr *)&eth->dest_addr,eth->addr_len)==-1) {
if (sendto(eth->sockfd,msg,msg_len,0,(struct sockaddr *)&eth->raw.dest_addr,eth->raw.dest_addr_len)==-1) { perror("ETHERNET: ");
perror("ETHERNET: "); exit(0);
exit(0); }
}
else
if (sendto(eth->sockfd,msg,msg_len,0,(struct sockaddr *)&eth->udp.dest_addr,eth->udp.dest_addr_len)==-1) {
perror("ETHERNET: ");
exit(0);
}
return 0; return 0;
} }
...@@ -156,32 +147,17 @@ int trx_eth_request(openair0_device *device, void *msg, ssize_t msg_len) { ...@@ -156,32 +147,17 @@ int trx_eth_request(openair0_device *device, void *msg, ssize_t msg_len) {
int trx_eth_reply(openair0_device *device, void *msg, ssize_t msg_len) { int trx_eth_reply(openair0_device *device, void *msg, ssize_t msg_len) {
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
int Mod_id = device->Mod_id;
/* RRH receives from BBU a message */ /* RRH receives from BBU a message */
if ((eth->flags == ETH_RAW_MODE) || (eth->flags == ETH_RAW_IF4p5_MODE)) { if (recvfrom(eth->sockfd,
msg,
if (recvfrom(eth->sockfd, msg_len,
msg, 0,
msg_len, (struct sockaddr *)&eth->dest_addr,
0, (socklen_t *)&eth->addr_len)==-1) {
(struct sockaddr *)&eth->raw.dest_addr, perror("ETHERNET: recv_from in trx_eth_reply ");
(socklen_t *)&eth->raw.dest_addr_len)==-1) { exit(0);
perror("ETHERNET: ");
exit(0);
}
}
else {
if (recvfrom(eth->sockfd,
msg,
msg_len,
0,
(struct sockaddr *)&eth->udp.dest_addr,
(socklen_t *)&eth->udp.dest_addr_len)==-1) {
perror("ETHERNET: ");
exit(0);
}
} }
...@@ -215,7 +191,6 @@ int trx_eth_reset_stats(openair0_device* device) { ...@@ -215,7 +191,6 @@ int trx_eth_reset_stats(openair0_device* device) {
int ethernet_tune(openair0_device *device, unsigned int option, int value) { int ethernet_tune(openair0_device *device, unsigned int option, int value) {
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
int Mod_id=device->Mod_id;
struct timeval timeout; struct timeval timeout;
struct ifreq ifr; struct ifreq ifr;
char system_cmd[256]; char system_cmd[256];
...@@ -279,27 +254,27 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -279,27 +254,27 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
/******************* interface level options *************************/ /******************* interface level options *************************/
case MTU_SIZE: /* change MTU of the eth interface */ case MTU_SIZE: /* change MTU of the eth interface */
ifr.ifr_addr.sa_family = AF_INET; ifr.ifr_addr.sa_family = AF_INET;
strncpy(ifr.ifr_name,eth->if_name[Mod_id], sizeof(ifr.ifr_name)); strncpy(ifr.ifr_name,eth->if_name, sizeof(ifr.ifr_name));
ifr.ifr_mtu =value; ifr.ifr_mtu =value;
if (ioctl(eth->sockfd,SIOCSIFMTU,(caddr_t)&ifr) < 0 ) if (ioctl(eth->sockfd,SIOCSIFMTU,(caddr_t)&ifr) < 0 )
perror ("[ETHERNET] Can't set the MTU"); perror ("[ETHERNET] Can't set the MTU");
else else
printf("[ETHERNET] %s MTU size has changed to %d\n",eth->if_name[Mod_id],ifr.ifr_mtu); printf("[ETHERNET] %s MTU size has changed to %d\n",eth->if_name,ifr.ifr_mtu);
break; break;
case TX_Q_LEN: /* change TX queue length of eth interface */ case TX_Q_LEN: /* change TX queue length of eth interface */
ifr.ifr_addr.sa_family = AF_INET; ifr.ifr_addr.sa_family = AF_INET;
strncpy(ifr.ifr_name,eth->if_name[Mod_id], sizeof(ifr.ifr_name)); strncpy(ifr.ifr_name,eth->if_name, sizeof(ifr.ifr_name));
ifr.ifr_qlen =value; ifr.ifr_qlen =value;
if (ioctl(eth->sockfd,SIOCSIFTXQLEN,(caddr_t)&ifr) < 0 ) if (ioctl(eth->sockfd,SIOCSIFTXQLEN,(caddr_t)&ifr) < 0 )
perror ("[ETHERNET] Can't set the txqueuelen"); perror ("[ETHERNET] Can't set the txqueuelen");
else else
printf("[ETHERNET] %s txqueuelen size has changed to %d\n",eth->if_name[Mod_id],ifr.ifr_qlen); printf("[ETHERNET] %s txqueuelen size has changed to %d\n",eth->if_name,ifr.ifr_qlen);
break; break;
/******************* device level options *************************/ /******************* device level options *************************/
case COALESCE_PAR: case COALESCE_PAR:
ret=snprintf(system_cmd,sizeof(system_cmd),"ethtool -C %s rx-usecs %d",eth->if_name[Mod_id],value); ret=snprintf(system_cmd,sizeof(system_cmd),"ethtool -C %s rx-usecs %d",eth->if_name,value);
if (ret > 0) { if (ret > 0) {
ret=system(system_cmd); ret=system(system_cmd);
if (ret == -1) { if (ret == -1) {
...@@ -314,8 +289,8 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -314,8 +289,8 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
break; break;
case PAUSE_PAR: case PAUSE_PAR:
if (value==1) ret=snprintf(system_cmd,sizeof(system_cmd),"ethtool -A %s autoneg off rx off tx off",eth->if_name[Mod_id]); if (value==1) ret=snprintf(system_cmd,sizeof(system_cmd),"ethtool -A %s autoneg off rx off tx off",eth->if_name);
else if (value==0) ret=snprintf(system_cmd,sizeof(system_cmd),"ethtool -A %s autoneg on rx on tx on",eth->if_name[Mod_id]); else if (value==0) ret=snprintf(system_cmd,sizeof(system_cmd),"ethtool -A %s autoneg on rx on tx on",eth->if_name);
else break; else break;
if (ret > 0) { if (ret > 0) {
ret=system(system_cmd); ret=system(system_cmd);
...@@ -331,7 +306,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -331,7 +306,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
break; break;
case RING_PAR: case RING_PAR:
ret=snprintf(system_cmd,sizeof(system_cmd),"ethtool -G %s val %d",eth->if_name[Mod_id],value); ret=snprintf(system_cmd,sizeof(system_cmd),"ethtool -G %s val %d",eth->if_name,value);
if (ret > 0) { if (ret > 0) {
ret=system(system_cmd); ret=system(system_cmd);
if (ret == -1) { if (ret == -1) {
...@@ -407,7 +382,7 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth ...@@ -407,7 +382,7 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
//device->trx_read_func = trx_eth_read_udp_IF4p5; //device->trx_read_func = trx_eth_read_udp_IF4p5;
} }
eth->if_name[device->Mod_id] = eth_params->local_if_name; eth->if_name = eth_params->local_if_name;
device->priv = eth; device->priv = eth;
/* device specific */ /* device specific */
......
...@@ -62,11 +62,23 @@ ...@@ -62,11 +62,23 @@
typedef struct { typedef struct {
/*!\brief socket file desc */ /*!\brief socket file desc */
int sockfd[MAX_INST]; int sockfd;
/*!\brief interface name */ /*!\brief interface name */
char *if_name[MAX_INST]; char *if_name;
/*!\brief buffer size */ /*!\brief buffer size */
unsigned int buffer_size; unsigned int buffer_size;
/*!\brief destination address for UDP socket*/
struct sockaddr_in dest_addr;
/*!\brief local address for UDP socket*/
struct sockaddr_in local_addr;
/*!\brief address length for both UDP and RAW socket*/
int addr_len;
/*!\brief destination address for RAW socket*/
struct sockaddr_ll dest_addr_ll;
/*!\brief local address for RAW socket*/
struct sockaddr_ll local_addr_ll;
/*!\brief inteface index for RAW socket*/
struct ifreq if_index;
/*!\brief timeout ms */ /*!\brief timeout ms */
unsigned int rx_timeout_ms; unsigned int rx_timeout_ms;
/*!\brief timeout ms */ /*!\brief timeout ms */
......
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