diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 0112fe10ef1a89a0a91a8a143e78ef0f62757597..7bbbbef4f8891e7e9ceb32a027633810ba4c71aa 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -800,9 +800,9 @@ pdcp_data_ind( */ if (nfapi_mode == 3) { #ifdef UESIM_EXPANSION - ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 0; #else - ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id + 1; + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id; #endif } else { ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 0a49c7d94c9a39bbfbd3250a830bafa29d6d9282..9d0ed19a590b4753dcb8449e00c62cd5c5838742 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -938,7 +938,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) #ifdef UESIM_EXPANSION ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst]; #else - ctxt.module_id = pdcp_read_header_g.inst - 1; + ctxt.module_id = pdcp_read_header_g.inst; #endif } else { ctxt.module_id = 0; diff --git a/openair2/NETWORK_DRIVER/UE_IP/common.c b/openair2/NETWORK_DRIVER/UE_IP/common.c index 1b15ea8aed4b23924841884a83f62076eb17bd9b..d23132d96a306f6512e0c964b98dd9e6ef8c166f 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/common.c +++ b/openair2/NETWORK_DRIVER/UE_IP/common.c @@ -306,10 +306,10 @@ ue_ip_common_ip2wireless( } // modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator start #ifdef UESIM_EXPANSION - if ((src_addr[3] - 1)> instP) { - pdcph.inst = src_addr[3] - 1; + if ((src_addr[3] - 2)> instP) { + pdcph.inst = src_addr[3] - 2; printk("[UE_IP_DRV] change INST from %d to %d\n",instP, pdcph.inst); - instP = src_addr[3] - 1; + instP = src_addr[3] - 2; priv_p=netdev_priv(ue_ip_dev[instP]); } #endif diff --git a/openair2/NETWORK_DRIVER/UE_IP/device.c b/openair2/NETWORK_DRIVER/UE_IP/device.c index e67f67d6e342d2022d50f2e72da1ae36b31ae6ed..4f295543dca310e933694d9b296a7f2c0b7ce87b 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/device.c +++ b/openair2/NETWORK_DRIVER/UE_IP/device.c @@ -61,7 +61,7 @@ int ue_ip_find_inst(struct net_device *dev_pP) //--------------------------------------------------------------------------- int i; - for (i=1; i<=UE_IP_NB_INSTANCES_MAX; i++) + for (i=0; i<UE_IP_NB_INSTANCES_MAX; i++) if (ue_ip_dev[i] == dev_pP) { return(i); } @@ -194,7 +194,7 @@ void ue_ip_teardown(struct net_device *dev_pP) priv_p = netdev_priv(dev_pP); inst = ue_ip_find_inst(dev_pP); - if ((inst<=0) || (inst>UE_IP_NB_INSTANCES_MAX)) { + if ((inst<0) || (inst>=UE_IP_NB_INSTANCES_MAX)) { printk("[UE_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__); return; } @@ -243,7 +243,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP) return -1; } - if ((inst>0) && (inst<=UE_IP_NB_INSTANCES_MAX)) { + if ((inst>=0) && (inst<UE_IP_NB_INSTANCES_MAX)) { #ifdef OAI_DRV_OAI_DRV_DEBUG_DEVICE printk("[UE_IP_DRV][%s] inst %d, begin\n", __FUNCTION__,inst); #endif @@ -392,9 +392,9 @@ int init_module (void) // Initialize parameters shared with RRC printk("[UE_IP_DRV][%s] Starting OAI IP driver", __FUNCTION__); - for (inst=1; inst<=UE_IP_NB_INSTANCES_MAX; inst++) { + for (inst=0; inst<UE_IP_NB_INSTANCES_MAX; inst++) { printk("[UE_IP_DRV][%s] begin init instance %d\n", __FUNCTION__,inst); - sprintf(devicename,"oip%d",inst); + sprintf(devicename,"oip%d",inst+1); #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) ue_ip_dev[inst] = alloc_netdev(sizeof(ue_ip_priv_t),devicename, ue_ip_init); #else @@ -434,7 +434,7 @@ void cleanup_module(void) printk("[UE_IP_DRV][CLEANUP] begin\n"); - for (inst=1; inst<=UE_IP_NB_INSTANCES_MAX; inst++) { + for (inst=0; inst<UE_IP_NB_INSTANCES_MAX; inst++) { #ifdef OAI_DRV_DEBUG_DEVICE printk("[UE_IP_DRV][CLEANUP] unregister and free net device instance %d\n",inst); #endif diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.c b/openair3/NAS/UE/ESM/esm_ebr_context.c index 3dddab5b743e7da3381a030290a1c2adc26785a4..7cf1d8abbdf79f6f41211ae4a00dd576929c0b51 100755 --- a/openair3/NAS/UE/ESM/esm_ebr_context.c +++ b/openair3/NAS/UE/ESM/esm_ebr_context.c @@ -284,16 +284,16 @@ int esm_ebr_context_create( // if it's made too many tables , OS may crush so we use one table. #ifdef PDCP_USE_NETLINK #ifdef UESIM_EXPANSION - uint16_t inst_nic = (pdn->ip_addr[3] & 0x000000FF) - 1; + uint16_t inst_nic = (pdn->ip_addr[3] & 0x000000FF) - 2; res = sprintf(command_line, "ifconfig oip%d %s netmask %s broadcast %s up && " "ip rule add from %s/24 table %d && " "ip rule add to %s/24 table %d && " "ip route add default dev oip%d table %d", - inst_nic, ipv4_addr, netmask, broadcast, + inst_nic + 1, ipv4_addr, netmask, broadcast, ipv4_addr, 201, ipv4_addr, 201, - inst_nic, 201); + inst_nic + 1, 201); inst_pdcp_list[inst_nic] = ueid; #else