Merge remote-tracking branch 'origin/develop' into develop-uedirectorysplit
Conflicts: openair1/PHY/INIT/lte_init.c openair1/PHY/LTE_TRANSPORT/dci_tools.c openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h openair1/PHY/defs_eNB.h openair1/SCHED_UE/phy_procedures_lte_ue.c openair2/LAYER2/MAC/mac.h targets/RT/USER/lte-enb.c targets/RT/USER/lte-softmodem.h
This commit is contained in:
@@ -39,6 +39,13 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include "platform_constants.h"
|
||||
#ifdef UE_NAS_USE_TUN
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_tun.h>
|
||||
#include "openairinterface5g_limits.h"
|
||||
#endif
|
||||
|
||||
char nl_rx_buf[NL_MAX_PAYLOAD];
|
||||
|
||||
@@ -47,12 +54,121 @@ struct nlmsghdr *nas_nlh_tx = NULL;
|
||||
struct nlmsghdr *nas_nlh_rx = NULL;
|
||||
struct iovec nas_iov_tx;
|
||||
struct iovec nas_iov_rx = {nl_rx_buf, sizeof(nl_rx_buf)};
|
||||
#ifdef UE_NAS_USE_TUN
|
||||
int nas_sock_fd[NUMBER_OF_UE_MAX];
|
||||
#else
|
||||
int nas_sock_fd;
|
||||
#endif
|
||||
struct msghdr nas_msg_tx;
|
||||
struct msghdr nas_msg_rx;
|
||||
|
||||
#define GRAAL_NETLINK_ID 31
|
||||
|
||||
#ifdef UE_NAS_USE_TUN
|
||||
|
||||
static int tun_alloc(char *dev)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
int fd, err;
|
||||
|
||||
if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) {
|
||||
printf("[TUN] failed to open /dev/net/tun\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
|
||||
/* Flags: IFF_TUN - TUN device (no Ethernet headers)
|
||||
* IFF_TAP - TAP device
|
||||
*
|
||||
* IFF_NO_PI - Do not provide packet information
|
||||
*/
|
||||
ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
|
||||
if( *dev )
|
||||
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
|
||||
|
||||
if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ){
|
||||
close(fd);
|
||||
return err;
|
||||
}
|
||||
strcpy(dev, ifr.ifr_name);
|
||||
return fd;
|
||||
}
|
||||
|
||||
int netlink_init(void)
|
||||
{
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
char ifname[64];
|
||||
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
|
||||
sprintf(ifname, "oip%d", i+1);
|
||||
nas_sock_fd[i] = tun_alloc(ifname);
|
||||
|
||||
if (nas_sock_fd[i] == -1) {
|
||||
printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd[i],errno, strerror(errno));
|
||||
#if defined(LINK_ENB_PDCP_TO_IP_DRIVER)
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
printf("[NETLINK]Opened socket with fd %d\n",nas_sock_fd[i]);
|
||||
|
||||
#if !defined(PDCP_USE_NETLINK_QUEUES)
|
||||
ret = fcntl(nas_sock_fd[i],F_SETFL,O_NONBLOCK);
|
||||
|
||||
if (ret == -1) {
|
||||
printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
|
||||
#if defined(LINK_ENB_PDCP_TO_IP_DRIVER)
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
memset(&nas_src_addr, 0, sizeof(nas_src_addr));
|
||||
nas_src_addr.nl_family = AF_NETLINK;
|
||||
nas_src_addr.nl_pid = 1;//getpid(); /* self pid */
|
||||
nas_src_addr.nl_groups = 0; /* not in mcast groups */
|
||||
ret = bind(nas_sock_fd[i], (struct sockaddr*)&nas_src_addr, sizeof(nas_src_addr));
|
||||
|
||||
|
||||
|
||||
memset(&nas_dest_addr, 0, sizeof(nas_dest_addr));
|
||||
nas_dest_addr.nl_family = AF_NETLINK;
|
||||
nas_dest_addr.nl_pid = 0; /* For Linux Kernel */
|
||||
nas_dest_addr.nl_groups = 0; /* unicast */
|
||||
|
||||
// TX PART
|
||||
nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
/* Fill the netlink message header */
|
||||
nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD);
|
||||
nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */
|
||||
nas_nlh_tx->nlmsg_flags = 0;
|
||||
|
||||
nas_iov_tx.iov_base = (void *)nas_nlh_tx;
|
||||
nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len;
|
||||
memset(&nas_msg_tx,0,sizeof(nas_msg_tx));
|
||||
nas_msg_tx.msg_name = (void *)&nas_dest_addr;
|
||||
nas_msg_tx.msg_namelen = sizeof(nas_dest_addr);
|
||||
nas_msg_tx.msg_iov = &nas_iov_tx;
|
||||
nas_msg_tx.msg_iovlen = 1;
|
||||
|
||||
|
||||
// RX PART
|
||||
memset(&nas_msg_rx,0,sizeof(nas_msg_rx));
|
||||
nas_msg_rx.msg_name = (void *)&nas_src_addr;
|
||||
nas_msg_rx.msg_namelen = sizeof(nas_src_addr);
|
||||
nas_msg_rx.msg_iov = &nas_iov_rx;
|
||||
nas_msg_rx.msg_iovlen = 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* UE_NAS_USE_TUN */
|
||||
|
||||
int netlink_init(void)
|
||||
{
|
||||
int ret;
|
||||
@@ -119,3 +235,5 @@ int netlink_init(void)
|
||||
|
||||
return(nas_sock_fd);
|
||||
}
|
||||
|
||||
#endif /* UE_NAS_USE_TUN */
|
||||
|
||||
@@ -76,6 +76,8 @@ double t_rx_min = 1000000000; /*!< \brief initial min process time for rx */
|
||||
int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
|
||||
int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
|
||||
|
||||
int codingw = 0;
|
||||
|
||||
void handler(int sig)
|
||||
{
|
||||
void *array[10];
|
||||
|
||||
@@ -95,6 +95,8 @@ nfapi_tx_request_pdu_t tx_pdu_list[MAX_NUM_TX_REQUEST_PDU];
|
||||
nfapi_tx_request_t TX_req;
|
||||
Sched_Rsp_t sched_resp;
|
||||
|
||||
int codingw = 0;
|
||||
|
||||
void
|
||||
fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu,
|
||||
uint8_t cqi_req,
|
||||
|
||||
@@ -91,10 +91,8 @@ double dac_fixed_gain(double *s_re[2],
|
||||
|
||||
int i;
|
||||
int aa;
|
||||
double amp,amp1_local,*amp1p;
|
||||
|
||||
amp = //sqrt(NB_RE)*pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna
|
||||
pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna
|
||||
double amp1_local,*amp1p;
|
||||
double amp = pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna
|
||||
|
||||
if (amp1==NULL) amp1p = &1_local;
|
||||
else amp1p = amp1;
|
||||
@@ -123,7 +121,7 @@ double dac_fixed_gain(double *s_re[2],
|
||||
//printf("DL: amp1 %f dB (%d,%d), tx_power %f\n",20*log10(amp1),input_offset,input_offset_meas,txpwr_dBm);
|
||||
*/
|
||||
|
||||
|
||||
// printf("DAC: amp/amp1p %f amp1 %f dB (%d,%d), tx_power %f\n",amp/(*amp1p),20*log10(*amp1p),input_offset,input_offset_meas,txpwr_dBm);
|
||||
for (i=0; i<length; i++) {
|
||||
for (aa=0; aa<nb_tx_antennas; aa++) {
|
||||
s_re[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)])/(*amp1p);
|
||||
@@ -131,7 +129,7 @@ double dac_fixed_gain(double *s_re[2],
|
||||
}
|
||||
}
|
||||
|
||||
// printf("ener %e\n",signal_energy_fp(s_re,s_im,nb_tx_antennas,length,0));
|
||||
// printf("ener %e\n",signal_energy_fp(s_re,s_im,nb_tx_antennas,length<length_meas?length:length_meas,0));
|
||||
|
||||
return(signal_energy_fp(s_re,s_im,nb_tx_antennas,length<length_meas?length:length_meas,0)/NB_RE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user