示例#1
0
//---------------------------------------------------------------------------
// Decode CONN_ESTABLISH_IND message from RRC
void nasrg_ASCTL_DC_decode_cx_establish_ind(struct cx_entity *cx, struct nas_rg_dc_element *p){
//---------------------------------------------------------------------------
  int i;
// Start debug information
#ifdef GRAAL_DEBUG_DC
	printk("nasrg_ASCTL_DC_decode_cx_establish - begin \n");
#endif
  if (!cx || !p){
 	  printk("nasrg_ASCTL_DC_decode_cx_establish - input parameter is NULL \n");
    return;
  }
// End debug information
  if (nasrg_ASCTL_DC_send_cx_establish_confirm(cx, ACCEPTED)>0){
  	nasrg_TOOL_imei2iid(p->nasRGDCPrimitive.conn_establish_ind.InterfaceIMEI, (u8 *)cx->iid6);
  	cx->iid4=97;  // A AUTOMATISER
  	cx->lcr = p->nasRGDCPrimitive.conn_establish_ind.localConnectionRef;
  	cx->state=GRAAL_CX_DCH;
#ifdef GRAAL_DEBUG_DC
 	  printk("nasrg_ASCTL_DC_decode_cx_establish: CONN_ESTABLISH_IND reception\n");
		printk(" primitive length %d\n",p->length);
 		printk(" Local Connection reference %d\n",p->nasRGDCPrimitive.conn_establish_ind.localConnectionRef);
 		printk(" IMEI ");
 		for (i=0; i<14; ++i)
 			printk("%u",p->nasRGDCPrimitive.conn_establish_ind.InterfaceIMEI[i]);
  		printk(" state ");
		nasrg_TOOL_print_state(cx->state);
#endif
	}
}
示例#2
0
//---------------------------------------------------------------------------
// Decode CONN_LOSS_IND message from RRC
void nasrg_ASCTL_DC_decode_cx_loss_ind(struct cx_entity *cx, struct nas_rg_dc_element *p){
//---------------------------------------------------------------------------
// Start debug information
#ifdef GRAAL_DEBUG_DC
	printk("nasrg_ASCTL_DC_decode_cx_loss - begin \n");
#endif
  if (!cx || !p){
 	  printk("nasrg_ASCTL_DC_decode_cx_loss - input parameter is NULL \n");
    return;
  }
// End debug information
 	cx->state = GRAAL_IDLE;
 	cx->iid4=0;
 	nasrg_TOOL_imei2iid(GRAAL_NULL_IMEI, (u8 *)cx->iid6);
 	nasrg_COMMON_flush_rb(cx);
#ifdef GRAAL_DEBUG_DC
 	printk("nasrg_ASCTL_DC_decode_cx_loss: CONN_LOSS_IND reception\n");
 	printk(" Primitive length %u\n",(int)(p->length));
 	printk(" Local Connection reference %u\n",p->nasRGDCPrimitive.conn_loss_ind.localConnectionRef);
 	nasrg_TOOL_print_state(cx->state);
#endif
}
//---------------------------------------------------------------------------
// Initialisation of the network device
void nasrg_init(struct net_device *dev)
{
  //---------------------------------------------------------------------------
  uint8_t cxi, dscpi;

  printk("nasrg_init: begin\n");

  if (dev) {
    gpriv=netdev_priv(dev);

    memset(gpriv, 0, sizeof(struct nas_priv));
    // Initialize function pointers
    dev->netdev_ops = &nasrg_netdev_ops;

#ifndef NAS_DRIVER_TYPE_ETHERNET
    dev->type = ARPHRD_EURUMTS;
    dev->features = NETIF_F_NO_CSUM;
    dev->hard_header_len = 0;
    dev->addr_len = NAS_ADDR_LEN;
    dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
    dev->tx_queue_len = NAS_TX_QUEUE_LEN;
    dev->mtu = NAS_MTU;
#endif
    // Can be one of the following enum defined in include/linux/netdevice.h:
    // enum netdev_state_t {
    // __LINK_STATE_START,
    // __LINK_STATE_PRESENT,
    // __LINK_STATE_NOCARRIER,
    // __LINK_STATE_LINKWATCH_PENDING,
    // __LINK_STATE_DORMANT,
    // };
    set_bit(__LINK_STATE_PRESENT, &dev->state);

#ifdef NAS_DRIVER_TYPE_ETHERNET
    // overwrite values written above ( header_ops,type,hard_header_len,mtu,addr_len,tx_queue_len,flags,broadcast)
    printk("\nnasrg_init: WARNING Driver type ETHERNET\n");
    ether_setup(dev);
#endif
    //
    // Initialize private structure
    gpriv->rx_flags = NAS_RESET_RX_FLAGS;

    gpriv->sap[NAS_GC_SAPI] = RRC_DEVICE_GC;
    gpriv->sap[NAS_NT_SAPI] = RRC_DEVICE_NT;
    gpriv->cx[0].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT0;
    gpriv->cx[0].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT0;
    gpriv->cx[1].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT1;
    gpriv->cx[1].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT1;
    //  gpriv->sap[NAS_CO_INPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_INPUT;
    //  gpriv->sap[NAS_CO_OUTPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_OUTPUT;
    gpriv->sap[NAS_DRB_INPUT_SAPI]  = PDCP2PDCP_USE_RT_FIFO;//QOS_DEVICE_CONVERSATIONAL_INPUT;
    gpriv->sap[NAS_DRB_OUTPUT_SAPI] = NAS2PDCP_FIFO;//QOS_DEVICE_STREAMING_INPUT;
    //
    gpriv->retry_limit=NAS_RETRY_LIMIT_DEFAULT;
    gpriv->timer_establishment=NAS_TIMER_ESTABLISHMENT_DEFAULT;
    gpriv->timer_release=NAS_TIMER_RELEASE_DEFAULT;

    for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi)
      gpriv->rclassifier[dscpi]=NULL;

    gpriv->nrclassifier=0;

    //
    for(cxi=0; cxi<NAS_CX_MAX; ++cxi) {
#ifdef NAS_DEBUG_DEVICE
      printk("nasrg_init: init classifiers, state and timer for MTs %u\n", cxi);
#endif
      gpriv->cx[cxi].state=NAS_IDLE;
      gpriv->cx[cxi].countimer=NAS_TIMER_IDLE;
      gpriv->cx[cxi].retry=0;
      gpriv->cx[cxi].lcr=cxi;
      gpriv->cx[cxi].rb=NULL;
      gpriv->cx[cxi].num_rb=0;

      // initialisation of the classifier
      for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi)
        gpriv->cx[cxi].sclassifier[dscpi]=NULL;

      gpriv->cx[cxi].nsclassifier=0;
      // initialisation of the IP address
      nasrg_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)gpriv->cx[cxi].iid6);
      gpriv->cx[cxi].iid4=0;
    }

    spin_lock_init(&gpriv->lock);

    nasrg_TOOL_RGimei2iid(NAS_RG_IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
    printk("nasrg_init: init IMEI to IID\n");
    nasrg_ASCTL_init();
  } else {
    printk("\n\nnasmt_init: ERROR, Device is NULL!!\n");
  }

  printk("nasrg_init: end\n");
  return ;
}