예제 #1
0
/****************************************************************************
 **                                                                        **
 ** Name:	 _eRALlte_process_clean_pending_mt()                       **
 **                                                                        **
 ** Description: Deletes previously stored pending MT data.                **
 **                                                                        **
 ** Inputs:	 None                                                      **
 ** 	 	 Others:	None                                       **
 **                                                                        **
 ** Outputs:	 None                                                      **
 **		 Return:	None                                       **
 ** 	 	 Others:	ralpriv                                    **
 **                                                                        **
 ***************************************************************************/
static void _eRALlte_process_clean_pending_mt(void)
{
    memset(ralpriv->pending_mt.ipv6_addr, 0 , 16);
    eRALlte_process_clean_channel(&ralpriv->pending_mt.radio_channel[0]);

    ralpriv->pending_mt_timer = -1;
    DEBUG(" Pending MT data deleted\n");
}
/****************************************************************************
 **                                                                        **
 ** Name:  eRALlte_NAS_read_rb_establish_reply()                     **
 **                                                                        **
 ** Description: Reads Radio Bearer establish reply received from the NAS  **
 **    driver.                                                   **
 **    Returns a Link_Up.indication to the MIH-F.                **
 **                                                                        **
 ** Inputs:  None                                                      **
 **      Others:  nas_rg_reply                               **
 **                                                                        **
 ** Outputs:   None                                                      **
 **    Return:  0 if the message type is valid,            **
 **       -1 otherwise.                              **
 **      Others:  ralpriv                                    **
 **                                                                        **
 ***************************************************************************/
static int eRALlte_NAS_read_rb_establish_reply(void)
{
  if (nas_rg_reply->type == NAS_RG_MSG_RB_ESTABLISH_REPLY) {
    struct ral_lte_channel *currChannel;
    struct nas_rg_msg_rb_establish_reply* rb_est_rep = &(nas_rg_reply->tqalNASPrimitive.rb_est_rep);
    int mt_ix, ch_ix;

    MIH_C_LINK_TUPLE_ID_T* ltid;
    int is_unicast = eRALlte_process_find_channel(rb_est_rep->cnxid,
                     &mt_ix, &ch_ix);

    /* Read received parameters */
    if (is_unicast) {
      ralpriv->mt[mt_ix].ue_id = rb_est_rep->ue_id;
      currChannel = &(ralpriv->mt[mt_ix].radio_channel[ch_ix]);
      ltid = &ralpriv->mt[mt_ix].ltid;
    } else {
      currChannel = &(ralpriv->mcast.radio_channel);
      ltid = &ralpriv->mcast.ltid;
    }

    /* Check channel status */
    if (rb_est_rep->result == NAS_CONNECTED) {
      ralpriv->pending_req_status = MIH_C_STATUS_SUCCESS;
      currChannel->cnx_id = rb_est_rep->cnxid;
      currChannel->rbId = rb_est_rep->RBParms.rbId;
      currChannel->RadioQoSclass = rb_est_rep->RBParms.QoSclass;
      currChannel->dscpDL = rb_est_rep->RBParms.dscp;
      currChannel->status = rb_est_rep->result;
    } else {
      ralpriv->pending_req_status = MIH_C_STATUS_REJECTED;
      /* Clean radio resources */
      eRALlte_process_clean_channel(currChannel);
    }

    /* Send Link-Up.indication to the MIH-F */
    if (ralpriv->pending_req_status != MIH_C_STATUS_REJECTED) {
      eRALlte_send_link_up_indication(&ralpriv->pending_req_transaction_id, ltid, NULL, NULL, NULL, NULL);
    }

    ralpriv->pending_req_mt_ix = -1;
    ralpriv->pending_req_ch_ix = -1;
    ralpriv->pending_req_transaction_id = 0;

    return 0;
  }

  return -1;
}
/****************************************************************************
 **                                                                        **
 ** Name:  eRALlte_NAS_read_rb_release_reply()                       **
 **                                                                        **
 ** Description: Reads Radio Bearer release reply received from the NAS    **
 **    driver.                                                   **
 **    Returns a Link_Down.indication to the MIH-F.              **
 **                                                                        **
 ** Inputs:  None                                                      **
 **      Others:  nas_rg_reply                               **
 **                                                                        **
 ** Outputs:   None                                                      **
 **    Return:  0 if the message type is valid,            **
 **       -1 otherwise.                              **
 **      Others:  ralpriv                                    **
 **                                                                        **
 ***************************************************************************/
static int eRALlte_NAS_read_rb_release_reply(void)
{
  if (nas_rg_reply->type == NAS_RG_MSG_RB_RELEASE_REPLY) {
    struct ral_lte_channel *currChannel;
    struct nas_rg_msg_rb_release_reply* rb_rel_rep = &(nas_rg_reply->tqalNASPrimitive.rb_rel_rep);
    int mt_ix, ch_ix;
    MIH_C_LINK_DN_REASON_T reason_code = MIH_C_LINK_DOWN_REASON_EXPLICIT_DISCONNECT;
    MIH_C_LINK_TUPLE_ID_T* ltid;

    int is_unicast = eRALlte_process_find_channel(rb_rel_rep->cnxid,
                     &mt_ix, &ch_ix);

    /* Read received parameters */
    if (is_unicast) {
      assert (rb_rel_rep->ue_id == ralpriv->mt[mt_ix].ue_id);
      currChannel = &(ralpriv->mt[mt_ix].radio_channel[ch_ix]);
      ltid = &ralpriv->mt[mt_ix].ltid;
    } else {
      assert (rb_rel_rep->ue_id == RAL_MAX_MT);
      currChannel = &(ralpriv->mcast.radio_channel);
      ltid = &ralpriv->mcast.ltid;
    }

    /* Check channel status */
    if (rb_rel_rep->result == NAS_DISCONNECTED) {
      ralpriv->pending_req_status = MIH_C_STATUS_SUCCESS;
    } else {
      ralpriv->pending_req_status = MIH_C_STATUS_REJECTED;
    }

    /* Clean radio resources */
    eRALlte_process_clean_channel(currChannel);

    /* Send Link-Down.indication to the MIH-F */
    if (ralpriv->pending_req_status != MIH_C_STATUS_REJECTED) {
      eRALlte_send_link_down_indication(&ralpriv->pending_req_transaction_id, ltid, NULL, &reason_code);
    }

    ralpriv->pending_req_mt_ix = -1;
    ralpriv->pending_req_ch_ix = -1;
    ralpriv->pending_req_transaction_id = 0;

    return 0;
  }

  return -1;
}
예제 #4
0
/****************************************************************************
 **                                                                        **
 ** Name:	 _eRALlte_process_waiting_RB()                             **
 **                                                                        **
 ** Description: Allocates a new Radio Bearer parameters to the specified  **
 **		 Mobile Terminal which was pending for RB establishment,   **
 **		 and sends RB establishment request to the NAS sublayer.   **
 **                                                                        **
 ** Inputs:	 mt_ix:		Mobile Terminal index                      **
 ** 	 	 Others:	ralpriv                                    **
 **                                                                        **
 ** Outputs:	 None                                                      **
 **		 Return:	None                                       **
 ** 	 	 Others:	ralpriv                                    **
 **                                                                        **
 ***************************************************************************/
static void _eRALlte_process_waiting_RB(int mt_ix)
{
    struct ral_lte_channel *currChannel;
    struct ral_lte_channel *pendingChannel;
    int ch_ix, f_ix;
    int dir, mapping_result, rc = -1;

    DEBUG(" Establishment of pending RB now starting...\n");
    ch_ix = eRALlte_process_find_new_channel(mt_ix);
    if (ch_ix == RAL_MAX_RB) {
	DEBUG(" No RB available in MT - Deleting request data\n");
	_eRALlte_process_clean_pending_mt();
	return;
    }

    pendingChannel = &(ralpriv->pending_mt.radio_channel[0]);
    currChannel = &(ralpriv->mt[mt_ix].radio_channel[ch_ix]);

    currChannel->cnx_id = (RAL_MAX_RB_PER_UE*mt_ix)+ch_ix+1;
    currChannel->rbId = RAL_DEFAULT_RAB_ID+ch_ix;
    currChannel->multicast = 0;
    DEBUG(" mt_ix %d, ch_ix %d, cnx_id %d, rbId %d\n",
	  mt_ix, ch_ix, currChannel->cnx_id, currChannel->rbId);
    memcpy((char *)&(ralpriv->mt[mt_ix].ipv6_addr),
	   (char *)&(ralpriv->pending_mt.ipv6_addr), 16);
    DEBUG (" MT's address = %s\n",
	   eRALlte_process_mt_addr_to_string(ralpriv->mt[mt_ix].ipv6_addr));

    /* Save the pending data flow identifier into the list of active data flows */
    f_ix = eRALlte_action_save_flow_id(&ralpriv->pending_req_fid, currChannel->cnx_id);
    if (f_ix < 0) {
	DEBUG(" No RB available - Deleting request data\n");
	_eRALlte_process_clean_pending_mt();
	return;
    }
    /* Store resource parameters of the pending MT */
    for (dir = 0; dir < 2; dir++) {
	currChannel->flowId[dir] = f_ix;
	currChannel->classId[dir]= pendingChannel->classId[dir] ;
	currChannel->resBitrate[dir] = pendingChannel->resBitrate[dir];
	currChannel->meanBitrate[dir] = pendingChannel->meanBitrate[dir];
	currChannel->bktDepth[dir] = pendingChannel->bktDepth[dir];
	currChannel->pkBitrate[dir] = pendingChannel->pkBitrate[dir];
	currChannel->MTU[dir] = pendingChannel->MTU[dir];
	DEBUG(" qos value : DIR %d, flowId %d, classId %d, resBitrate %.1f \n",
	      dir, currChannel->flowId[dir], currChannel->classId[dir],
	      currChannel->resBitrate[dir]);
    }

    /* Map Qos */
    mapping_result = eRALlte_process_map_qos(mt_ix, ch_ix);
    if (mapping_result) {
#ifdef RAL_DUMMY
	rc = eRALlte_NAS_send_rb_establish_request(mt_ix, ch_ix);
#endif
#ifdef RAL_REALTIME
	rc = TQAL_process_NAS_message(IO_OBJ_RB, IO_CMD_ADD, mt_ix, ch_ix);
#endif
    }

    if (rc < 0) {
	/* Failed to send RB establishment request; release new RB data */
	eRALlte_process_clean_channel(currChannel);
    }
    else {
	/* RB establishment request has been sent; release pending MT data */
	ralpriv->pending_req_flag = 0;
	_eRALlte_process_clean_pending_mt();
    }
}