astyle --recursive --indent=spaces=2 --style=kr --indent-col1-comments --break-blocks --convert-tabs --max-code-length=200
This is done for better merging branch/LG_PRE_RELEASE_0.3 into trunk (same process is applied on this branch) git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7073 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -21,11 +21,11 @@
|
||||
//#include <linux/netdevice.h>
|
||||
|
||||
//#include <graal_constant.h>
|
||||
//#define GRAAL_STATE_IDLE 0
|
||||
//#define GRAAL_STATE_CONNECTED 1
|
||||
//#define GRAAL_STATE_ESTABLISHMENT_REQUEST 2
|
||||
//#define GRAAL_STATE_ESTABLISHMENT_FAILURE 3
|
||||
//#define GRAAL_STATE_RELEASE_FAILURE 4
|
||||
//#define GRAAL_STATE_IDLE 0
|
||||
//#define GRAAL_STATE_CONNECTED 1
|
||||
//#define GRAAL_STATE_ESTABLISHMENT_REQUEST 2
|
||||
//#define GRAAL_STATE_ESTABLISHMENT_FAILURE 3
|
||||
//#define GRAAL_STATE_RELEASE_FAILURE 4
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -42,11 +42,12 @@
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Receive data from FIFO (QOS or DC)
|
||||
// Receive data from FIFO (QOS or DC)
|
||||
//void nasmt_COMMON_receive(uint16_t hlen, uint16_t dlen, int sap){
|
||||
//void nasmt_COMMON_receive(uint16_t hlen, uint16_t dlen, void *pdcp_sdu, int sap){
|
||||
void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct sk_buff *skb;
|
||||
struct ipversion *ipv;
|
||||
unsigned int hard_header_len;
|
||||
@@ -57,37 +58,43 @@ void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *da
|
||||
printk("nasmt_COMMON_receive: begin\n");
|
||||
#endif
|
||||
#ifdef NAS_NETLINK
|
||||
// data_buffer is NULL if FIFOs
|
||||
if (!data_buffer){
|
||||
printk("nasmt_COMMON_receive - input parameter data_buffer is NULL \n");
|
||||
|
||||
// data_buffer is NULL if FIFOs
|
||||
if (!data_buffer) {
|
||||
printk("nasmt_COMMON_receive - input parameter data_buffer is NULL \n");
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
skb = dev_alloc_skb( payload_length + 2 );
|
||||
if(!skb){
|
||||
|
||||
if(!skb) {
|
||||
printk("nasmt_COMMON_receive: low on memory\n");
|
||||
++gpriv->stats.rx_dropped;
|
||||
return;
|
||||
}
|
||||
|
||||
skb_reserve(skb,2);
|
||||
|
||||
#ifndef NAS_NETLINK
|
||||
bytes_read += rtf_get(sap, skb_put(skb, payload_length), payload_length);
|
||||
if (bytes_read != NAS_PDCPH_SIZE + payload_length){
|
||||
|
||||
if (bytes_read != NAS_PDCPH_SIZE + payload_length) {
|
||||
printk("nasmt_COMMON_receive: problem while reading DC sap\n");
|
||||
kfree(skb->data);
|
||||
dev_kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
|
||||
#else
|
||||
memcpy(skb_put(skb, payload_length), data_buffer, payload_length);
|
||||
bytes_read += payload_length;
|
||||
#endif
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasmt_COMMON_receive: received packet from PDCP, length %d\n", bytes_read);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
skb->dev = gdev;
|
||||
hard_header_len = gdev->hard_header_len;
|
||||
@@ -96,125 +103,140 @@ void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *da
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
|
||||
ipv = (struct ipversion *)&(skb->data[hard_header_len]);
|
||||
switch (ipv->version){
|
||||
|
||||
switch (ipv->version) {
|
||||
case 6:
|
||||
#ifdef NAS_DEBUG_RECEIVE_BASIC
|
||||
#ifdef NAS_DEBUG_RECEIVE_BASIC
|
||||
printk("nasmt_COMMON_receive: receive IPv6 message\n");
|
||||
#endif
|
||||
#endif
|
||||
skb->network_header = &skb->data[hard_header_len];
|
||||
// set protocol default value
|
||||
skb->protocol = htons(ETH_P_IPV6);
|
||||
// If type Ethernet, correct it
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
skb->protocol = eth_type_trans(skb, gdev);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case 4:
|
||||
#ifdef NAS_DEBUG_RECEIVE_BASIC
|
||||
printk("nasmt_COMMON_receive: receive IPv4 message\n");
|
||||
#endif
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
case 4:
|
||||
#ifdef NAS_DEBUG_RECEIVE_BASIC
|
||||
printk("nasmt_COMMON_receive: receive IPv4 message\n");
|
||||
#endif
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
|
||||
if (addr){
|
||||
|
||||
if (addr) {
|
||||
printk("nasmt_COMMON_receive: Source %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
|
||||
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
|
||||
if (addr){
|
||||
|
||||
if (addr) {
|
||||
printk("[NAS][COMMON][RECEIVE] Dest %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
|
||||
printk("[NAS][COMMON][RECEIVE] protocol %d\n",((struct iphdr *)&skb->data[hard_header_len])->protocol);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
skb->network_header = &skb->data[hard_header_len];
|
||||
// set protocol default value
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
// If type Ethernet, correct it
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
skb->protocol = eth_type_trans(skb, gdev);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("nasmt_COMMON_receive: Packet is not IPv4 or IPv6 (version=%d)\n", ipv->version);
|
||||
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasmt_COMMON_receive: ether_type=%04X\n", ether_type);
|
||||
#endif
|
||||
skb->protocol = eth_type_trans(skb, gdev);
|
||||
// minus 1(short) instead of 2(bytes) because uint16_t*
|
||||
p_ether_type = (uint16_t *)&(skb->mac_header[hard_header_len-2]);
|
||||
ether_type = ntohs(*p_ether_type);
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasmt_COMMON_receive: ether_type=%04X\n", ether_type);
|
||||
#endif
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasmt_COMMON_receive: ether_type=%04X\n", ether_type);
|
||||
#endif
|
||||
skb->protocol = eth_type_trans(skb, gdev);
|
||||
// minus 1(short) instead of 2(bytes) because uint16_t*
|
||||
p_ether_type = (uint16_t *)&(skb->mac_header[hard_header_len-2]);
|
||||
ether_type = ntohs(*p_ether_type);
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasmt_COMMON_receive: ether_type=%04X\n", ether_type);
|
||||
#endif
|
||||
|
||||
switch (ether_type) {
|
||||
case ETH_P_ARP:
|
||||
printk("[NAS][COMMON] ether_type = ETH_P_ARP\n");
|
||||
skb->protocol = htons(ETH_P_ARP);
|
||||
skb->network_header = &skb->mac_header[hard_header_len];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
switch (ether_type) {
|
||||
case ETH_P_ARP:
|
||||
printk("[NAS][COMMON] ether_type = ETH_P_ARP\n");
|
||||
skb->protocol = htons(ETH_P_ARP);
|
||||
skb->network_header = &skb->mac_header[hard_header_len];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
++gpriv->stats.rx_packets;
|
||||
gpriv->stats.rx_bytes += bytes_read;
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasmt_COMMON_receive: forwarding packet of size %d to kernel\n",skb->len);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
netif_rx(skb);
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasmt_COMMON_receive: end\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Delete the data
|
||||
void nasmt_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp){
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
void nasmt_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("nasmt_COMMON_del_send - updating statistics \n");
|
||||
#endif
|
||||
#endif
|
||||
++gpriv->stats.tx_dropped;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Request the transfer of data (QoS SAP)
|
||||
void nasmt_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
//struct pdcp_data_req pdcph;
|
||||
struct pdcp_data_req_header_t pdcph;
|
||||
int bytes_wrote = 0;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("nasmt_COMMON_QOS_send - begin \n");
|
||||
#endif
|
||||
// if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
|
||||
// {
|
||||
// gpriv->stats.tx_dropped ++;
|
||||
// printk("NAS_QOS_SEND: No connected, so message are dropped \n");
|
||||
// return;
|
||||
// }
|
||||
if (!skb || !gc || !cx){
|
||||
printk("nasmt_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
|
||||
|
||||
// if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
|
||||
// {
|
||||
// gpriv->stats.tx_dropped ++;
|
||||
// printk("NAS_QOS_SEND: No connected, so message are dropped \n");
|
||||
// return;
|
||||
// }
|
||||
if (!skb || !gc || !cx) {
|
||||
printk("nasmt_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
if (gc->rb==NULL){
|
||||
// End debug information
|
||||
|
||||
if (gc->rb==NULL) {
|
||||
gc->rb = nasmt_COMMON_search_rb(cx, gc->rab_id);
|
||||
if (gc->rb==NULL){
|
||||
|
||||
if (gc->rb==NULL) {
|
||||
++gpriv->stats.tx_dropped;
|
||||
printk("nasmt_COMMON_QOS_send: No corresponding Radio Bearer, so message is dropped, rab_id=%u \n", gc->rab_id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("nasmt_COMMON_QOS_send #1 :");
|
||||
printk("lcr %u, rab_id %u, rab_id %u\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id);
|
||||
@@ -234,7 +256,7 @@ void nasmt_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct cla
|
||||
//printk("nasmt_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP fifo\n", bytes_wrote,skb->len);
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
if (bytes_wrote != NAS_PDCPH_SIZE){
|
||||
if (bytes_wrote != NAS_PDCPH_SIZE) {
|
||||
printk("nasmt_COMMON_QOS_send: problem while writing PDCP's header\n");
|
||||
printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
|
||||
gpriv->stats.tx_dropped ++;
|
||||
@@ -248,12 +270,13 @@ void nasmt_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct cla
|
||||
bytes_wrote += rtf_put(NAS2PDCP_FIFO, skb->data, skb->len);
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
if (bytes_wrote != skb->len + NAS_PDCPH_SIZE){
|
||||
if (bytes_wrote != skb->len + NAS_PDCPH_SIZE) {
|
||||
printk("nasmt_COMMON_QOS_send: problem while writing PDCP's data\n"); // congestion
|
||||
printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
|
||||
gpriv->stats.tx_dropped ++;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("nasmt_COMMON_QOS_send - %d bytes wrote to rb_id %d, sap %d \n", bytes_wrote, pdcph.rb_id,NAS2PDCP_FIFO);
|
||||
#endif
|
||||
@@ -266,38 +289,44 @@ void nasmt_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct cla
|
||||
|
||||
#ifndef NAS_NETLINK
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_COMMON_QOS_receive(struct cx_entity *cx){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_COMMON_QOS_receive(struct cx_entity *cx)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t sapi;
|
||||
//struct pdcp_data_ind pdcph;
|
||||
struct pdcp_data_ind_header_t pdcph;
|
||||
int bytes_read = 0;
|
||||
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasmt_COMMON_QOS_receive - begin \n");
|
||||
#endif
|
||||
if (!cx){
|
||||
printk("nasmt_COMMON_QOS_receive - input parameter cx is NULL \n");
|
||||
#endif
|
||||
|
||||
if (!cx) {
|
||||
printk("nasmt_COMMON_QOS_receive - input parameter cx is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
|
||||
// LG force the use of only 1 rt fifo
|
||||
sapi = NAS_DRB_OUTPUT_SAPI;
|
||||
|
||||
bytes_read = rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
|
||||
while (bytes_read>0){
|
||||
if (bytes_read != NAS_PDCPH_SIZE){
|
||||
printk("nasmt_COMMON_QOS_receive: problem while reading PDCP header\n");
|
||||
return;
|
||||
|
||||
while (bytes_read>0) {
|
||||
if (bytes_read != NAS_PDCPH_SIZE) {
|
||||
printk("nasmt_COMMON_QOS_receive: problem while reading PDCP header\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
|
||||
// data_buffer is NULL because FIFO should be read directly in the skbuff (LITE has an intermediary buffer)
|
||||
nasmt_COMMON_receive(NAS_PDCPH_SIZE, pdcph.data_size, NULL, pdcph->rb_id, gpriv->sap[sapi]);
|
||||
// check if another frame is in the FIFO, otherwise return
|
||||
bytes_read = rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasmt_COMMON_QOS_receive - end \n");
|
||||
#endif
|
||||
@@ -305,39 +334,44 @@ void nasmt_COMMON_QOS_receive(struct cx_entity *cx){
|
||||
|
||||
#else
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_COMMON_QOS_receive(struct nlmsghdr *nlh){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_COMMON_QOS_receive(struct nlmsghdr *nlh)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
struct pdcp_data_ind_header_t *pdcph;
|
||||
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasmt_COMMON_QOS_receive - begin \n");
|
||||
#endif
|
||||
if (!nlh){
|
||||
printk("nasmt_COMMON_QOS_receive - input parameter nlh is NULL \n");
|
||||
#endif
|
||||
|
||||
if (!nlh) {
|
||||
printk("nasmt_COMMON_QOS_receive - input parameter nlh is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasmt_COMMON_QOS_receive - receive from PDCP, size %d, rab %d\\n", pdcph->data_size, pdcph->rb_id);
|
||||
#endif //NAS_DEBUG_RECEIVE
|
||||
|
||||
//void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
|
||||
nasmt_COMMON_receive(NAS_PDCPH_SIZE + pdcph->data_size, pdcph->data_size, (unsigned char *)NLMSG_DATA(nlh) + NAS_PDCPH_SIZE, pdcph->rb_id, 0);
|
||||
//void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
|
||||
nasmt_COMMON_receive(NAS_PDCPH_SIZE + pdcph->data_size, pdcph->data_size, (unsigned char *)NLMSG_DATA(nlh) + NAS_PDCPH_SIZE, pdcph->rb_id, 0);
|
||||
|
||||
}
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct cx_entity *nasmt_COMMON_search_cx(nasLocalConnectionRef_t lcr){
|
||||
//---------------------------------------------------------------------------
|
||||
struct cx_entity *nasmt_COMMON_search_cx(nasLocalConnectionRef_t lcr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasmt_COMMON_search_cx - lcr %d\n",lcr);
|
||||
#endif
|
||||
|
||||
if (lcr<NAS_CX_MAX)
|
||||
return gpriv->cx+lcr;
|
||||
else
|
||||
@@ -346,48 +380,54 @@ struct cx_entity *nasmt_COMMON_search_cx(nasLocalConnectionRef_t lcr){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Search a Radio Bearer
|
||||
struct rb_entity *nasmt_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id){
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *nasmt_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *rb;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasmt_COMMON_search_rb - rab_id %d\n", rab_id);
|
||||
#endif
|
||||
if (!cx){
|
||||
printk("nasmt_COMMON_search_rb - input parameter cx is NULL \n");
|
||||
|
||||
if (!cx) {
|
||||
printk("nasmt_COMMON_search_rb - input parameter cx is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
for (rb=cx->rb; rb!=NULL; rb=rb->next)
|
||||
{
|
||||
|
||||
for (rb=cx->rb; rb!=NULL; rb=rb->next) {
|
||||
if (rb->rab_id==rab_id)
|
||||
return rb;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *nasmt_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasQoSTrafficClass_t qos){
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *nasmt_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasQoSTrafficClass_t qos)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *rb;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasmt_COMMON_add_rb - begin for rab_id %d , qos %d\n", rab_id, qos );
|
||||
printk("nasmt_COMMON_add_rb - begin for rab_id %d , qos %d\n", rab_id, qos );
|
||||
#endif
|
||||
if (cx==NULL){
|
||||
printk("nasmt_COMMON_add_rb - input parameter cx is NULL \n");
|
||||
|
||||
if (cx==NULL) {
|
||||
printk("nasmt_COMMON_add_rb - input parameter cx is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rb=nasmt_COMMON_search_rb(cx, rab_id);
|
||||
if (rb==NULL)
|
||||
{
|
||||
|
||||
if (rb==NULL) {
|
||||
rb=(struct rb_entity *)kmalloc(sizeof(struct rb_entity), GFP_KERNEL);
|
||||
if (rb!=NULL)
|
||||
{
|
||||
|
||||
if (rb!=NULL) {
|
||||
rb->retry=0;
|
||||
rb->countimer=NAS_TIMER_IDLE;
|
||||
rb->rab_id=rab_id;
|
||||
// rb->rab_id=rab_id+(32*cx->lcr);
|
||||
#ifdef NAS_DEBUG_DC
|
||||
// rb->rab_id=rab_id+(32*cx->lcr);
|
||||
#ifdef NAS_DEBUG_DC
|
||||
printk("nasmt_COMMON_add_rb: rb rab_id=%u, rab_id=%u, mt_id=%u\n",rb->rab_id,rab_id, cx->lcr);
|
||||
#endif
|
||||
#endif
|
||||
rb->qos=qos;
|
||||
rb->sapi=NAS_DRB_INPUT_SAPI;
|
||||
// LG force the use of only one rt-fifo rb->sapi=NAS_BA_INPUT_SAPI;
|
||||
@@ -395,99 +435,114 @@ struct rb_entity *nasmt_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t r
|
||||
rb->next=cx->rb;
|
||||
cx->rb=rb;
|
||||
++cx->num_rb;
|
||||
}
|
||||
else
|
||||
} else
|
||||
printk("nasmt_COMMON_add_rb: no memory\n");
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasmt_COMMON_add_rb - end \n" );
|
||||
printk("nasmt_COMMON_add_rb - end \n" );
|
||||
#endif
|
||||
return rb;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// free the memory that has previously been allocated to rb and remove from linked list
|
||||
void nasmt_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *rb, *curr_rb, *prev_rb;
|
||||
struct classifier_entity *p;
|
||||
uint16_t classref=0;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasmt_COMMON_del_rb - begin\n");
|
||||
#endif
|
||||
if (cx==NULL){
|
||||
|
||||
if (cx==NULL) {
|
||||
printk("nasmt_COMMON_del_rb - input parameter cx is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// Clear the associated classifier
|
||||
for (p=cx->sclassifier[dscp]; p!=NULL; p=p->next){
|
||||
if (p->classref>=classref){
|
||||
// End debug information
|
||||
|
||||
// Clear the associated classifier
|
||||
for (p=cx->sclassifier[dscp]; p!=NULL; p=p->next) {
|
||||
if (p->classref>=classref) {
|
||||
classref=p->classref;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasmt_COMMON_del_rb: classifier found for dscp %u \n", dscp);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
nasmt_CLASS_del_sclassifier(cx, dscp, classref);
|
||||
|
||||
// Now, delete the RB
|
||||
// Now, delete the RB
|
||||
curr_rb = NULL;
|
||||
prev_rb = NULL;
|
||||
for (rb=cx->rb; rb!=NULL; rb=rb->next){
|
||||
if (rb->rab_id == rab_id){
|
||||
|
||||
for (rb=cx->rb; rb!=NULL; rb=rb->next) {
|
||||
if (rb->rab_id == rab_id) {
|
||||
curr_rb = rb;
|
||||
if (prev_rb!=NULL){
|
||||
|
||||
if (prev_rb!=NULL) {
|
||||
prev_rb->next = rb->next;
|
||||
}else{
|
||||
} else {
|
||||
cx->rb=rb->next;
|
||||
}
|
||||
|
||||
break;
|
||||
}else{
|
||||
} else {
|
||||
prev_rb = rb;
|
||||
}
|
||||
}
|
||||
if (curr_rb!= NULL){
|
||||
|
||||
if (curr_rb!= NULL) {
|
||||
printk("nasmt_COMMON_del_rb: del rab_id %u\n", rb->rab_id);
|
||||
kfree(rb);
|
||||
(cx->num_rb)--;
|
||||
}else{
|
||||
} else {
|
||||
printk("\n\n--nasmt_COMMON_del_rb: ERROR, invalid rab_id %u\n", rb->rab_id);
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasmt_COMMON_del_rb - end\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_COMMON_flush_rb(struct cx_entity *cx){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_COMMON_flush_rb(struct cx_entity *cx)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *rb;
|
||||
struct classifier_entity *gc;
|
||||
uint8_t dscp;
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasmt_COMMON_flush_rb - begin\n");
|
||||
#endif
|
||||
if (cx==NULL){
|
||||
printk("nasmt_COMMON_flush_rb - input parameter cx is NULL \n");
|
||||
|
||||
if (cx==NULL) {
|
||||
printk("nasmt_COMMON_flush_rb - input parameter cx is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
for (rb=cx->rb; rb!=NULL; rb=cx->rb){
|
||||
|
||||
// End debug information
|
||||
for (rb=cx->rb; rb!=NULL; rb=cx->rb) {
|
||||
printk("nasmt_COMMON_flush_rb: del rab_id %u\n", rb->rab_id);
|
||||
cx->rb=rb->next;
|
||||
kfree(rb);
|
||||
}
|
||||
|
||||
cx->num_rb=0;
|
||||
cx->rb=NULL;
|
||||
for(dscp=0; dscp<NAS_DSCP_MAX; ++dscp){
|
||||
|
||||
for(dscp=0; dscp<NAS_DSCP_MAX; ++dscp) {
|
||||
for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next)
|
||||
gc->rb=NULL;
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasmt_COMMON_flush_rb - end\n");
|
||||
#endif
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#define NAS_DEBUG_DEVICE
|
||||
//#define NAS_DEBUG_INTERRUPT
|
||||
//#define NAS_DEBUG_TOOL
|
||||
#define NETLINK_DEBUG
|
||||
#define NETLINK_DEBUG
|
||||
//#define NAS_DEBUG_RRCNL // RRC netlink socket
|
||||
|
||||
// Other flags
|
||||
@@ -98,11 +98,11 @@
|
||||
//#define NAS_IID1_CONTROL 0x0
|
||||
//#define NAS_IID2_CONTROL __constant_htonl(0xffffffff)
|
||||
|
||||
//#define NAS_STATE_IDLE 0
|
||||
//#define NAS_STATE_CONNECTED 1
|
||||
//#define NAS_STATE_ESTABLISHMENT_REQUEST 2
|
||||
//#define NAS_STATE_ESTABLISHMENT_FAILURE 3
|
||||
//#define NAS_STATE_RELEASE_FAILURE 4
|
||||
//#define NAS_STATE_IDLE 0
|
||||
//#define NAS_STATE_CONNECTED 1
|
||||
//#define NAS_STATE_ESTABLISHMENT_REQUEST 2
|
||||
//#define NAS_STATE_ESTABLISHMENT_FAILURE 3
|
||||
//#define NAS_STATE_RELEASE_FAILURE 4
|
||||
#define NAS_CX_RELEASE_UNDEF_CAUSE 1
|
||||
|
||||
// MT+RG NAS States
|
||||
@@ -118,7 +118,7 @@
|
||||
// Radio Bearers
|
||||
#define NAS_RB_ESTABLISHING 0x24
|
||||
#define NAS_RB_RELEASING 0x28
|
||||
#define NAS_RB_DCH 0x2A
|
||||
#define NAS_RB_DCH 0x2A
|
||||
|
||||
|
||||
#define NAS_TIMER_ESTABLISHMENT_DEFAULT 12
|
||||
@@ -130,32 +130,32 @@
|
||||
#define NAS_IPV4_SIZE 20
|
||||
#define NAS_IPV6_SIZE 40
|
||||
|
||||
#define NAS_DIRECTION_SEND 0
|
||||
#define NAS_DIRECTION_RECEIVE 1
|
||||
#define NAS_DIRECTION_SEND 0
|
||||
#define NAS_DIRECTION_RECEIVE 1
|
||||
|
||||
// function number
|
||||
#define NAS_FCT_DEL_SEND 1
|
||||
#define NAS_FCT_QOS_SEND 2
|
||||
#define NAS_FCT_DC_SEND 3
|
||||
#define NAS_FCT_CTL_SEND 4
|
||||
#define NAS_FCT_DEL_SEND 1
|
||||
#define NAS_FCT_QOS_SEND 2
|
||||
#define NAS_FCT_DC_SEND 3
|
||||
#define NAS_FCT_CTL_SEND 4
|
||||
|
||||
// type of IOCTL command
|
||||
#define NASMT_IOCTL_RAL 0x89F0
|
||||
|
||||
// Error cause
|
||||
#define NAS_ERROR_ALREADYEXIST 1
|
||||
#define NAS_ERROR_NOMEMORY 3
|
||||
#define NAS_ERROR_NOTMT 9
|
||||
#define NAS_ERROR_NOTRG 10
|
||||
#define NAS_ERROR_NOTIDLE 11
|
||||
#define NAS_ERROR_NOTCONNECTED 12
|
||||
#define NAS_ERROR_NORB 14
|
||||
#define NAS_ERROR_NOTCORRECTVALUE 32
|
||||
#define NAS_ERROR_NOTCORRECTLCR 33
|
||||
#define NAS_ERROR_NOTCORRECTDIR 34
|
||||
#define NAS_ERROR_NOTCORRECTDSCP 35
|
||||
#define NAS_ERROR_NOTCORRECTVERSION 36
|
||||
#define NAS_ERROR_NOTCORRECTRABI 37
|
||||
#define NAS_ERROR_ALREADYEXIST 1
|
||||
#define NAS_ERROR_NOMEMORY 3
|
||||
#define NAS_ERROR_NOTMT 9
|
||||
#define NAS_ERROR_NOTRG 10
|
||||
#define NAS_ERROR_NOTIDLE 11
|
||||
#define NAS_ERROR_NOTCONNECTED 12
|
||||
#define NAS_ERROR_NORB 14
|
||||
#define NAS_ERROR_NOTCORRECTVALUE 32
|
||||
#define NAS_ERROR_NOTCORRECTLCR 33
|
||||
#define NAS_ERROR_NOTCORRECTDIR 34
|
||||
#define NAS_ERROR_NOTCORRECTDSCP 35
|
||||
#define NAS_ERROR_NOTCORRECTVERSION 36
|
||||
#define NAS_ERROR_NOTCORRECTRABI 37
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
@@ -193,8 +193,8 @@
|
||||
#define NAS_PROTOCOL_ICMP4 IPPROTO_ICMP
|
||||
#define NAS_PROTOCOL_ICMP6 IPPROTO_ICMPV6
|
||||
|
||||
#define NAS_PORT_DEFAULT __constant_htons(65535)
|
||||
#define NAS_PORT_HTTP __constant_htons(80)
|
||||
#define NAS_PORT_DEFAULT __constant_htons(65535)
|
||||
#define NAS_PORT_HTTP __constant_htons(80)
|
||||
|
||||
#define NAS_VERSION_DEFAULT 0
|
||||
#define NAS_VERSION_4 4
|
||||
|
||||
@@ -72,8 +72,8 @@ struct net_device *gdev;
|
||||
struct nas_priv *gpriv;
|
||||
//int bytes_wrote;
|
||||
//int bytes_read;
|
||||
uint8_t NAS_NULL_IMEI[14]={0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00};
|
||||
uint8_t NAS_RG_IMEI[14]={0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x01};
|
||||
uint8_t NAS_NULL_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00};
|
||||
uint8_t NAS_RG_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x01};
|
||||
|
||||
// TEMP
|
||||
//uint8_t nas_IMEI[14];
|
||||
@@ -86,13 +86,14 @@ extern void nasmt_netlink_release(void);
|
||||
extern int nasmt_netlink_init(void);
|
||||
#endif
|
||||
extern void nasmt_ASCTL_timer(unsigned long data);
|
||||
|
||||
|
||||
|
||||
#ifndef NAS_NETLINK
|
||||
//---------------------------------------------------------------------------
|
||||
//void nasmt_interrupt(void){
|
||||
void *nasmt_interrupt(void){
|
||||
//---------------------------------------------------------------------------
|
||||
void *nasmt_interrupt(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t cxi;
|
||||
char *buffer = NULL;
|
||||
#ifdef NAS_DEBUG_INTERRUPT
|
||||
@@ -112,43 +113,48 @@ void *nasmt_interrupt(void){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Called by ifconfig when the device is activated by ifconfig
|
||||
int nasmt_open(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_open(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasmt_open: begin\n");
|
||||
|
||||
gpriv=netdev_priv(dev);
|
||||
|
||||
// Address has already been set at init
|
||||
#ifndef NAS_NETLINK
|
||||
if (gpriv->irq==-EBUSY){
|
||||
|
||||
if (gpriv->irq==-EBUSY) {
|
||||
printk("nasmt_open: irq failure\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
#endif //NETLINK
|
||||
|
||||
// next lines prevent compilation of the driver with kernel version under 2.6.29
|
||||
// ATTENTION !!!!!! NASMT is not usable with these versions
|
||||
// next lines prevent compilation of the driver with kernel version under 2.6.29
|
||||
// ATTENTION !!!!!! NASMT is not usable with these versions
|
||||
|
||||
if(!netif_queue_stopped(dev))
|
||||
netif_start_queue(dev);
|
||||
else
|
||||
netif_wake_queue(dev);
|
||||
//
|
||||
|
||||
//
|
||||
init_timer(&gpriv->timer);
|
||||
(gpriv->timer).expires=jiffies+NAS_TIMER_TICK;
|
||||
(gpriv->timer).data=0L;
|
||||
(gpriv->timer).function=nasmt_ASCTL_timer;
|
||||
// ??LITE comments: add_timer(&gpriv->timer);
|
||||
add_timer(&gpriv->timer);
|
||||
//
|
||||
//
|
||||
printk("nasmt_open: name = %s, end\n", dev->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Called by ifconfig when the device is desactivated by ifconfig
|
||||
int nasmt_stop(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_stop(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_priv *priv = netdev_priv(dev);
|
||||
printk("nasmt_stop: begin\n");
|
||||
del_timer(&priv->timer);
|
||||
@@ -159,27 +165,30 @@ int nasmt_stop(struct net_device *dev){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_teardown(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_teardown(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
int cxi;
|
||||
#ifndef NAS_NETLINK
|
||||
#ifndef NAS_NETLINK
|
||||
struct nas_priv *priv = netdev_priv(dev);
|
||||
#endif //NAS_NETLINK
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
printk("nasmt_teardown: begin\n");
|
||||
// priv=(struct nas_priv *)(gdev.priv);
|
||||
// priv=(struct nas_priv *)(gdev.priv);
|
||||
|
||||
if (dev) {
|
||||
#ifndef NAS_NETLINK
|
||||
if (priv->irq!=-EBUSY){
|
||||
#ifndef NAS_NETLINK
|
||||
|
||||
if (priv->irq!=-EBUSY) {
|
||||
*pt_nas_ue_irq=-1;
|
||||
rt_free_srq(priv->irq);
|
||||
}
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
#ifdef NAS_NETLINK
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
#ifdef NAS_NETLINK
|
||||
nasmt_netlink_release();
|
||||
#endif //NAS_NETLINK
|
||||
#endif //NAS_NETLINK
|
||||
// for (sapi=0; sapi<NAS_SAPI_MAX; ++sapi)
|
||||
// close(priv->sap[sapi]);
|
||||
nasmt_CLASS_flush_rclassifier();
|
||||
@@ -190,75 +199,84 @@ void nasmt_teardown(struct net_device *dev){
|
||||
// close(priv->cx[cxi].sap[sapi]);
|
||||
} // check dev
|
||||
else {
|
||||
printk("nasmt_teardown: Device is null\n");
|
||||
printk("nasmt_teardown: Device is null\n");
|
||||
}
|
||||
|
||||
printk("nasmt_teardown: end\n");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_set_config(struct net_device *dev, struct ifmap *map){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_set_config(struct net_device *dev, struct ifmap *map)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasmt_set_config: begin\n");
|
||||
|
||||
if (dev->flags & IFF_UP)
|
||||
return -EBUSY;
|
||||
if (map->base_addr != dev->base_addr)
|
||||
{
|
||||
|
||||
if (map->base_addr != dev->base_addr) {
|
||||
printk(KERN_WARNING "nasmt_set_config: Can't change I/O address\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (map->irq != dev->irq)
|
||||
dev->irq = map->irq;
|
||||
|
||||
printk("nasmt_set_config: end\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
int nasmt_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_DEVICE
|
||||
int nasmt_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_DEVICE
|
||||
printk("nasmt_hard_start_xmit: begin\n");
|
||||
#endif
|
||||
if ((!skb)||(!dev)){
|
||||
printk("nasmt_hard_start_xmit - input parameter skb or dev is NULL \n");
|
||||
#endif
|
||||
|
||||
if ((!skb)||(!dev)) {
|
||||
printk("nasmt_hard_start_xmit - input parameter skb or dev is NULL \n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
|
||||
netif_stop_queue(dev);
|
||||
dev->trans_start = jiffies;
|
||||
#ifdef NAS_DEBUG_SEND_DETAIL
|
||||
#ifdef NAS_DEBUG_SEND_DETAIL
|
||||
printk("nasmt_hard_start_xmit: step 1\n");
|
||||
#endif
|
||||
#endif
|
||||
nasmt_CLASS_send(skb);
|
||||
#ifdef NAS_DEBUG_SEND_DETAIL
|
||||
#ifdef NAS_DEBUG_SEND_DETAIL
|
||||
printk("nasmt_hard_start_xmit: step 2\n");
|
||||
#endif
|
||||
#endif
|
||||
dev_kfree_skb(skb);
|
||||
#ifdef NAS_DEBUG_SEND_DETAIL
|
||||
#ifdef NAS_DEBUG_SEND_DETAIL
|
||||
printk("nasmt_hard_start_xmit: step 3\n");
|
||||
#endif
|
||||
#endif
|
||||
netif_wake_queue(dev);
|
||||
#ifdef NAS_DEBUG_DEVICE
|
||||
#ifdef NAS_DEBUG_DEVICE
|
||||
printk("nasmt_hard_start_xmit: end\n");
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct net_device_stats *nasmt_get_stats(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
// return &((struct nas_priv *)dev->priv)->stats;
|
||||
struct net_device_stats *nasmt_get_stats(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// return &((struct nas_priv *)dev->priv)->stats;
|
||||
struct nas_priv *npriv = netdev_priv(dev);
|
||||
return &npriv->stats;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// New function from LITE DRIVER
|
||||
int nasmt_set_mac_address(struct net_device *dev, void *mac) {
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_set_mac_address(struct net_device *dev, void *mac)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct sockaddr *addr = mac;
|
||||
printk("nasmt_set_mac_address: begin\n");
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
@@ -267,18 +285,22 @@ int nasmt_set_mac_address(struct net_device *dev, void *mac) {
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_change_mtu(struct net_device *dev, int mtu){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_change_mtu(struct net_device *dev, int mtu)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasmt_change_mtu: begin\n");
|
||||
|
||||
if ((mtu<50) || (mtu>1500))
|
||||
// if ((mtu<1280) || (mtu>1500))
|
||||
// if ((mtu<1280) || (mtu>1500))
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_change_rx_flags(struct net_device *dev, int flags){
|
||||
int nasmt_change_rx_flags(struct net_device *dev, int flags)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
//struct nas_priv *priv = netdev_priv(dev);
|
||||
printk("nasmt_change_rx_flags %08X\n", flags);
|
||||
@@ -287,8 +309,9 @@ int nasmt_change_rx_flags(struct net_device *dev, int flags){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_tx_timeout(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_tx_timeout(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
/* Transmitter timeout, serious problems. */
|
||||
printk("nasmt_tx_timeout: begin\n");
|
||||
//((struct nas_priv *)(dev->priv))->stats.tx_errors++;
|
||||
@@ -301,41 +324,42 @@ void nasmt_tx_timeout(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
// Define pointers for the module
|
||||
static const struct net_device_ops nasmt_netdev_ops = {
|
||||
// ?? nasmt_interrupt
|
||||
//
|
||||
.ndo_open = nasmt_open,
|
||||
.ndo_stop = nasmt_stop,
|
||||
.ndo_start_xmit = nasmt_hard_start_xmit,
|
||||
.ndo_validate_addr = NULL,
|
||||
.ndo_get_stats = nasmt_get_stats,
|
||||
//#ifdef KERNEL_VERSION_GREATER_THAN_32
|
||||
// .ndo_set_multicast_list = NULL,
|
||||
.ndo_set_mac_address = nasmt_set_mac_address,
|
||||
.ndo_set_config = nasmt_set_config,
|
||||
.ndo_do_ioctl = nasmt_CTL_ioctl,
|
||||
.ndo_change_mtu = nasmt_change_mtu,
|
||||
.ndo_tx_timeout = nasmt_tx_timeout,
|
||||
.ndo_change_rx_flags = nasmt_change_rx_flags,
|
||||
//#endif
|
||||
// ?? nasmt_interrupt
|
||||
//
|
||||
.ndo_open = nasmt_open,
|
||||
.ndo_stop = nasmt_stop,
|
||||
.ndo_start_xmit = nasmt_hard_start_xmit,
|
||||
.ndo_validate_addr = NULL,
|
||||
.ndo_get_stats = nasmt_get_stats,
|
||||
//#ifdef KERNEL_VERSION_GREATER_THAN_32
|
||||
// .ndo_set_multicast_list = NULL,
|
||||
.ndo_set_mac_address = nasmt_set_mac_address,
|
||||
.ndo_set_config = nasmt_set_config,
|
||||
.ndo_do_ioctl = nasmt_CTL_ioctl,
|
||||
.ndo_change_mtu = nasmt_change_mtu,
|
||||
.ndo_tx_timeout = nasmt_tx_timeout,
|
||||
.ndo_change_rx_flags = nasmt_change_rx_flags,
|
||||
//#endif
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Initialisation of the network device
|
||||
void nasmt_init(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_init(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t cxi, dscpi;
|
||||
|
||||
printk("nasmt_init: begin\n");
|
||||
|
||||
if (dev){
|
||||
if (dev) {
|
||||
gpriv=netdev_priv(dev);
|
||||
memset(gpriv, 0, sizeof(struct nas_priv));
|
||||
// Initialize function pointers
|
||||
// Initialize function pointers
|
||||
dev->netdev_ops = &nasmt_netdev_ops;
|
||||
|
||||
#ifndef NAS_DRIVER_TYPE_ETHERNET
|
||||
// Update driver properties
|
||||
// Update driver properties
|
||||
dev->type = ARPHRD_EURUMTS;
|
||||
dev->features = NETIF_F_NO_CSUM;
|
||||
dev->hard_header_len = 0;
|
||||
@@ -360,29 +384,30 @@ void nasmt_init(struct net_device *dev){
|
||||
ether_setup(dev);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Initialize private structure
|
||||
gpriv->rx_flags = NAS_RESET_RX_FLAGS;
|
||||
//
|
||||
// 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->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->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] = PDCP2NAS_FIFO;//QOS_DEVICE_CONVERSATIONAL_INPUT;
|
||||
gpriv->sap[NAS_DRB_OUTPUT_SAPI] = NAS2PDCP_FIFO;//QOS_DEVICE_STREAMING_INPUT;
|
||||
//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] = PDCP2NAS_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;
|
||||
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)
|
||||
for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi)
|
||||
gpriv->rclassifier[dscpi] = NULL;
|
||||
gpriv->nrclassifier = 0;
|
||||
//
|
||||
cxi=0;
|
||||
|
||||
gpriv->nrclassifier = 0;
|
||||
//
|
||||
cxi=0;
|
||||
#ifdef NAS_DEBUG_DEVICE
|
||||
printk("nasmt_init: init classifiers, state and timer for MT %u\n", cxi);
|
||||
#endif
|
||||
@@ -392,36 +417,40 @@ void nasmt_init(struct net_device *dev){
|
||||
gpriv->cx[cxi].lcr = cxi;
|
||||
gpriv->cx[cxi].rb = NULL;
|
||||
gpriv->cx[cxi].num_rb = 0;
|
||||
|
||||
// initialisation of the classifiers
|
||||
for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi){
|
||||
for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi) {
|
||||
gpriv->cx[cxi].sclassifier[dscpi]=NULL;
|
||||
}
|
||||
|
||||
gpriv->cx[cxi].nsclassifier=0;
|
||||
// initialisation of the IP address
|
||||
nasmt_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)gpriv->cx[cxi].iid6);
|
||||
gpriv->cx[cxi].iid4=0;
|
||||
//
|
||||
//
|
||||
spin_lock_init(&gpriv->lock);
|
||||
printk("nasmt_init: init IMEI to IID\n");
|
||||
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
nasmt_TOOL_eth_imei2iid(nas_IMEI, dev->dev_addr ,(uint8_t *)gpriv->cx[0].iid6, dev->addr_len);
|
||||
#else
|
||||
#else
|
||||
nasmt_TOOL_imei2iid(nas_IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
|
||||
nasmt_TOOL_imei2iid(nas_IMEI, (uint8_t *)gpriv->cx[0].iid6);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
nasmt_ASCTL_init();
|
||||
} else {
|
||||
printk("\n\nnasmt_init: ERROR, Device is NULL!!\n");
|
||||
}
|
||||
|
||||
printk("nasmt_init: end\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int init_module (void) {
|
||||
//---------------------------------------------------------------------------
|
||||
int init_module (void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
int err;
|
||||
int inst = 0;
|
||||
int index;
|
||||
@@ -432,24 +461,28 @@ int init_module (void) {
|
||||
|
||||
// check IMEI parameter
|
||||
printk("number of IMEI parameters %d, IMEI ", m_arg);
|
||||
|
||||
for (index = 0; index < m_arg; index++) {
|
||||
printk("%02X ", nas_IMEI[index]);
|
||||
printk("%02X ", nas_IMEI[index]);
|
||||
}
|
||||
|
||||
printk("\n");
|
||||
|
||||
|
||||
#ifndef NAS_NETLINK
|
||||
#ifndef NAS_NETLINK
|
||||
|
||||
// Initialize parameters shared with RRC (done first to avoid going further)
|
||||
if (pt_nas_ue_irq==NULL){
|
||||
if (pt_nas_ue_irq==NULL) {
|
||||
printk("init_module: shared irq parameter not initialised\n");
|
||||
err = -EBUSY;
|
||||
printk("init_module: returning %d \n\n", err);
|
||||
return err;
|
||||
}
|
||||
printk("init_module: pt_nas_ue_irq valid \n");
|
||||
#endif
|
||||
|
||||
// Allocate device structure
|
||||
printk("init_module: pt_nas_ue_irq valid \n");
|
||||
#endif
|
||||
|
||||
// Allocate device structure
|
||||
sprintf(devicename,"oai%d",inst);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
|
||||
gdev = alloc_netdev(sizeof(struct nas_priv), devicename, nasmt_init);
|
||||
@@ -457,45 +490,53 @@ int init_module (void) {
|
||||
gdev = alloc_netdev(sizeof(struct nas_priv), devicename, NET_NAME_PREDICTABLE, nasmt_init);
|
||||
#endif
|
||||
priv = netdev_priv(gdev);
|
||||
////
|
||||
#ifndef NAS_NETLINK
|
||||
////
|
||||
#ifndef NAS_NETLINK
|
||||
priv->irq=rt_request_srq(0, nasmt_interrupt, NULL);
|
||||
if (priv->irq == -EBUSY || priv->irq == -EINVAL){
|
||||
|
||||
if (priv->irq == -EBUSY || priv->irq == -EINVAL) {
|
||||
printk("\n init_module: No interrupt resource available\n");
|
||||
if (gdev){
|
||||
|
||||
if (gdev) {
|
||||
free_netdev(gdev);
|
||||
printk("init_module: free_netdev ..\n");
|
||||
}
|
||||
|
||||
return -EBUSY;
|
||||
}
|
||||
else
|
||||
} else
|
||||
printk("init_module: Interrupt %d, ret = %d \n", priv->irq , ret);
|
||||
|
||||
if (pt_nas_ue_irq==NULL){
|
||||
if (pt_nas_ue_irq==NULL) {
|
||||
printk("init_module: shared irq parameter has been reset\n");
|
||||
}else{
|
||||
} else {
|
||||
*pt_nas_ue_irq=priv->irq;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NAS_NETLINK
|
||||
#endif
|
||||
|
||||
#ifdef NAS_NETLINK
|
||||
|
||||
if ((err=nasmt_netlink_init()) == -1)
|
||||
printk("init_module: NETLINK failed\n");
|
||||
|
||||
printk("init_module: NETLINK INIT successful\n");
|
||||
#endif //NETLINK
|
||||
//
|
||||
#endif //NETLINK
|
||||
//
|
||||
err= register_netdev(gdev);
|
||||
if (err){
|
||||
|
||||
if (err) {
|
||||
printk("init_module: error %i registering device %s\n", err, gdev->name);
|
||||
}else{
|
||||
} else {
|
||||
printk("init_module: registering device %s, ifindex = %d\n\n",gdev->name, gdev->ifindex);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void cleanup_module(void){
|
||||
//---------------------------------------------------------------------------
|
||||
void cleanup_module(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasmt_cleanup_module: begin\n");
|
||||
unregister_netdev(gdev);
|
||||
nasmt_teardown(gdev);
|
||||
|
||||
@@ -46,8 +46,9 @@ extern int nasmt_ASCTL_DC_send_cx_establish_request(struct cx_entity *cx);
|
||||
|
||||
// Statistic
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_statistic_reply(struct nas_msg_statistic_reply *msgrep){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_statistic_reply(struct nas_msg_statistic_reply *msgrep)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
msgrep->rx_packets=gpriv->stats.rx_packets;
|
||||
msgrep->tx_packets=gpriv->stats.tx_packets;
|
||||
msgrep->rx_bytes=gpriv->stats.rx_bytes;
|
||||
@@ -59,31 +60,34 @@ void nasmt_set_msg_statistic_reply(struct nas_msg_statistic_reply *msgrep){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_statistic_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_statistic_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_msg_statistic_reply msgrep;
|
||||
printk("nasmt_ioCTL_statistic: stat requested\n");
|
||||
nasmt_set_msg_statistic_reply(&msgrep);
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep)))
|
||||
{
|
||||
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
|
||||
printk("nasmt_ioCTL_statistic: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Connections List
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_cx_list_reply(uint8_t *msgrep){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_cx_list_reply(uint8_t *msgrep)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct cx_entity *cx;
|
||||
nasLocalConnectionRef_t lcr;
|
||||
struct nas_msg_cx_list_reply *list;
|
||||
msgrep[0]=NAS_CX_MAX;
|
||||
list=(struct nas_msg_cx_list_reply *)(msgrep+1);
|
||||
for(lcr=0;lcr<NAS_CX_MAX;++lcr)
|
||||
{
|
||||
|
||||
for(lcr=0; lcr<NAS_CX_MAX; ++lcr) {
|
||||
cx=nasmt_COMMON_search_cx(lcr);
|
||||
list[lcr].lcr=lcr;
|
||||
list[lcr].state=cx->state;
|
||||
@@ -98,16 +102,18 @@ void nasmt_set_msg_cx_list_reply(uint8_t *msgrep){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_cx_list_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_cx_list_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t msgrep[NAS_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1];
|
||||
printk("nasmt_ioCTL_cx_list: connection list requested\n");
|
||||
nasmt_set_msg_cx_list_reply(msgrep);
|
||||
if (copy_to_user(gifr->msg, msgrep, NAS_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1))
|
||||
{
|
||||
|
||||
if (copy_to_user(gifr->msg, msgrep, NAS_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1)) {
|
||||
printk("nasmt_ioCTL_cx_list: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
printk("nasmt_ioCTL_cx_list: end\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -115,86 +121,97 @@ int nasmt_ioCTL_cx_list_request(struct nas_ioctl *gifr){
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Connection Establishment
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_cx_establishment_reply(struct nas_msg_cx_establishment_reply *msgrep, struct nas_msg_cx_establishment_request *msgreq){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_cx_establishment_reply(struct nas_msg_cx_establishment_reply *msgrep, struct nas_msg_cx_establishment_request *msgreq)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef NODE_RG
|
||||
msgrep->status=-NAS_ERROR_NOTMT;
|
||||
#else
|
||||
struct cx_entity *cx;
|
||||
cx=nasmt_COMMON_search_cx(msgreq->lcr);
|
||||
if (cx!=NULL){
|
||||
if (cx->state == NAS_CX_RELEASING){
|
||||
msgrep->status=nasmt_ASCTL_leave_sleep_mode(cx);
|
||||
} else {
|
||||
cx->cellid=msgreq->cellid;
|
||||
msgrep->status=nasmt_ASCTL_DC_send_cx_establish_request(cx);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (cx!=NULL) {
|
||||
if (cx->state == NAS_CX_RELEASING) {
|
||||
msgrep->status=nasmt_ASCTL_leave_sleep_mode(cx);
|
||||
} else {
|
||||
cx->cellid=msgreq->cellid;
|
||||
msgrep->status=nasmt_ASCTL_DC_send_cx_establish_request(cx);
|
||||
}
|
||||
} else
|
||||
msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
|
||||
|
||||
#endif
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_cx_establishment_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_cx_establishment_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_msg_cx_establishment_request msgreq;
|
||||
struct nas_msg_cx_establishment_reply msgrep;
|
||||
printk("nasmt_ioCTL_cx_establishment: connection establishment requested\n");
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq)))
|
||||
{
|
||||
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
|
||||
printk("nasmt_ioCTL_cx_establishment: copy_from_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
nasmt_set_msg_cx_establishment_reply(&msgrep, &msgreq);
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep)))
|
||||
{
|
||||
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
|
||||
printk("nasmt_ioCTL_cx_establishment: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Connection Release
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_cx_release_reply(struct nas_msg_cx_release_reply *msgrep, struct nas_msg_cx_release_request *msgreq){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_cx_release_reply(struct nas_msg_cx_release_reply *msgrep, struct nas_msg_cx_release_request *msgreq)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef NODE_RG
|
||||
msgrep->status=-NAS_ERROR_NOTMT;
|
||||
#else
|
||||
struct cx_entity *cx;
|
||||
cx=nasmt_COMMON_search_cx(msgreq->lcr);
|
||||
if (cx!=NULL){
|
||||
#ifdef ENABLE_SLEEP_MODE
|
||||
msgrep->status=nasmt_ASCTL_enter_sleep_mode(cx);
|
||||
#endif
|
||||
#ifndef ENABLE_SLEEP_MODE
|
||||
|
||||
if (cx!=NULL) {
|
||||
#ifdef ENABLE_SLEEP_MODE
|
||||
msgrep->status=nasmt_ASCTL_enter_sleep_mode(cx);
|
||||
#endif
|
||||
#ifndef ENABLE_SLEEP_MODE
|
||||
msgrep->status=nasmt_ASCTL_DC_send_cx_release_request(cx);
|
||||
#endif
|
||||
#endif
|
||||
} else
|
||||
msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Request the release of a connection
|
||||
int nasmt_ioCTL_cx_release_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_cx_release_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_msg_cx_release_request msgreq;
|
||||
struct nas_msg_cx_release_reply msgrep;
|
||||
|
||||
printk("nasmt_ioCTL_cx_release: connection release requested\n");
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq)))
|
||||
{
|
||||
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
|
||||
printk("nasmt_ioCTL_cx_release: copy_from_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
nasmt_set_msg_cx_release_reply(&msgrep, &msgreq);
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep)))
|
||||
{
|
||||
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
|
||||
printk("nasmt_ioCTL_cx_release: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
printk("nasmt_ioCTL_cx_release: end\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -202,49 +219,54 @@ int nasmt_ioCTL_cx_release_request(struct nas_ioctl *gifr){
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Radio Bearer List
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_rb_list_reply(uint8_t *msgrep, struct nas_msg_rb_list_request *msgreq){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_rb_list_reply(uint8_t *msgrep, struct nas_msg_rb_list_request *msgreq)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct cx_entity *cx;
|
||||
cx=nasmt_COMMON_search_cx(msgreq->lcr);
|
||||
if (cx!=NULL)
|
||||
{
|
||||
|
||||
if (cx!=NULL) {
|
||||
uint8_t rbi;
|
||||
struct rb_entity *rb;
|
||||
struct nas_msg_rb_list_reply *list;
|
||||
|
||||
if (cx->num_rb > NAS_LIST_RB_MAX)
|
||||
msgrep[0] = NAS_LIST_RB_MAX;
|
||||
else
|
||||
msgrep[0] = cx->num_rb;
|
||||
|
||||
list=(struct nas_msg_rb_list_reply *)(msgrep+1);
|
||||
for (rb=cx->rb, rbi=0; (rb!=NULL)&&(rbi<msgrep[0]); rb=rb->next, ++rbi)
|
||||
{
|
||||
|
||||
for (rb=cx->rb, rbi=0; (rb!=NULL)&&(rbi<msgrep[0]); rb=rb->next, ++rbi) {
|
||||
list[rbi].state=rb->state;
|
||||
list[rbi].rab_id=rb->rab_id;
|
||||
list[rbi].sapi=rb->sapi;
|
||||
list[rbi].qos=rb->qos;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
msgrep[0]=0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_rb_list_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_rb_list_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t msgrep[NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1];
|
||||
struct nas_msg_rb_list_request msgreq;
|
||||
printk("nasmt_ioCTL_rb_list: Radio Bearer list requested\n");
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq)))
|
||||
{
|
||||
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
|
||||
printk("nasmt_ioCTL_rb_list: copy_from_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
nasmt_set_msg_rb_list_reply(msgrep, &msgreq);
|
||||
if (copy_to_user(gifr->msg, msgrep, NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1))
|
||||
{
|
||||
|
||||
if (copy_to_user(gifr->msg, msgrep, NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1)) {
|
||||
printk("nasmt_ioCTL_rb_list: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
printk("nasmt_ioCTL_rb_list: end\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -252,107 +274,122 @@ int nasmt_ioCTL_rb_list_request(struct nas_ioctl *gifr){
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Radio Bearer Establishment
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_rb_establishment_reply(struct nas_msg_rb_establishment_reply *msgrep, struct nas_msg_rb_establishment_request *msgreq){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_rb_establishment_reply(struct nas_msg_rb_establishment_reply *msgrep, struct nas_msg_rb_establishment_request *msgreq)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
msgrep->status=-NAS_ERROR_NOTRG;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_rb_establishment_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_rb_establishment_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_msg_rb_establishment_request msgreq;
|
||||
struct nas_msg_rb_establishment_reply msgrep;
|
||||
printk("nasmt_ioCTL_rb_establishment: Radio bearer establishment requested\n");
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq)))
|
||||
{
|
||||
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
|
||||
printk("nasmt_ioCTL_rb_establishment: copy_from_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
nasmt_set_msg_rb_establishment_reply(&msgrep, &msgreq);
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep)))
|
||||
{
|
||||
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
|
||||
printk("nasmt_ioCTL_rb_establishment: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Radio Bearer Release
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_rb_release_reply(struct nas_msg_rb_release_reply *msgrep, struct nas_msg_rb_release_request *msgreq){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_rb_release_reply(struct nas_msg_rb_release_reply *msgrep, struct nas_msg_rb_release_request *msgreq)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
msgrep->status=-NAS_ERROR_NOTRG;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_rb_release_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_rb_release_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_msg_rb_release_request msgreq;
|
||||
struct nas_msg_rb_release_reply msgrep;
|
||||
printk("nasmt_ioCTL_rb_release: Radio bearer release requested\n");
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq)))
|
||||
{
|
||||
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
|
||||
printk("nasmt_ioCTL_rb_release: copy_from_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
nasmt_set_msg_rb_release_reply(&msgrep, &msgreq);
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep)))
|
||||
{
|
||||
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
|
||||
printk("nasmt_ioCTL_rb_release: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Classifier List
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_class_list_reply(uint8_t *msgrep, struct nas_msg_class_list_request *msgreq){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_class_list_reply(uint8_t *msgrep, struct nas_msg_class_list_request *msgreq)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct cx_entity *cx;
|
||||
struct classifier_entity *gc;
|
||||
struct nas_msg_class_list_reply *list;
|
||||
uint8_t cli;
|
||||
list=(struct nas_msg_class_list_reply *)(msgrep+1);
|
||||
switch(msgreq->dir)
|
||||
{
|
||||
|
||||
switch(msgreq->dir) {
|
||||
case NAS_DIRECTION_SEND:
|
||||
cx=nasmt_COMMON_search_cx(msgreq->lcr);
|
||||
if (cx==NULL){
|
||||
|
||||
if (cx==NULL) {
|
||||
msgrep[0]=0;
|
||||
return;
|
||||
}
|
||||
|
||||
gc=cx->sclassifier[msgreq->dscp];
|
||||
break;
|
||||
|
||||
case NAS_DIRECTION_RECEIVE:
|
||||
cx=NULL;
|
||||
gc=gpriv->rclassifier[msgreq->dscp];
|
||||
break;
|
||||
|
||||
default:
|
||||
cx=NULL;
|
||||
msgrep[0]=0;
|
||||
return;
|
||||
}
|
||||
for (cli=0; (gc!=NULL)&&(cli<NAS_LIST_CLASS_MAX); gc=gc->next, ++cli)
|
||||
{
|
||||
|
||||
for (cli=0; (gc!=NULL)&&(cli<NAS_LIST_CLASS_MAX); gc=gc->next, ++cli) {
|
||||
list[cli].classref=gc->classref;
|
||||
list[cli].lcr=msgreq->lcr;
|
||||
list[cli].dir=msgreq->dir;
|
||||
list[cli].dscp=msgreq->dscp;
|
||||
list[cli].rab_id=gc->rab_id;
|
||||
list[cli].version=gc->version;
|
||||
switch(gc->version)
|
||||
{
|
||||
|
||||
switch(gc->version) {
|
||||
case 4:
|
||||
list[cli].saddr.ipv4 = gc->saddr.ipv4;
|
||||
list[cli].daddr.ipv4 = gc->daddr.ipv4;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
list[cli].saddr.ipv6 = gc->saddr.ipv6;
|
||||
list[cli].daddr.ipv6 = gc->daddr.ipv6;
|
||||
break;
|
||||
}
|
||||
|
||||
list[cli].protocol=gc->protocol;
|
||||
list[cli].sport=ntohs(gc->sport);
|
||||
list[cli].dport=ntohs(gc->dport);
|
||||
@@ -360,97 +397,114 @@ void nasmt_set_msg_class_list_reply(uint8_t *msgrep, struct nas_msg_class_list_r
|
||||
list[cli].dplen=gc->dplen;
|
||||
list[cli].fct=nasmt_TOOL_invfct(gc);
|
||||
}
|
||||
|
||||
msgrep[0]=cli;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_class_list_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_class_list_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t msgrep[NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1];
|
||||
struct nas_msg_class_list_request msgreq;
|
||||
printk("nasmt_ioCTL_class_list: classifier list requested\n");
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq)))
|
||||
{
|
||||
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
|
||||
printk("nasmt_ioCTL_class_list: copy_from_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
nasmt_set_msg_class_list_reply(msgrep, &msgreq);
|
||||
if (copy_to_user(gifr->msg, msgrep, NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1))
|
||||
{
|
||||
|
||||
if (copy_to_user(gifr->msg, msgrep, NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1)) {
|
||||
printk("nasmt_ioCTL_class_list: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Request the addition of a classifier rule
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_class_add_reply(struct nas_msg_class_add_reply *msgrep, struct nas_msg_class_add_request *msgreq){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_class_add_reply(struct nas_msg_class_add_reply *msgrep, struct nas_msg_class_add_request *msgreq)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct classifier_entity *gc;
|
||||
if (msgreq->dscp>NAS_DSCP_DEFAULT){
|
||||
|
||||
if (msgreq->dscp>NAS_DSCP_DEFAULT) {
|
||||
printk("nasmt_set_msg_class_add_reply: Incoherent parameter value\n");
|
||||
msgrep->status=-NAS_ERROR_NOTCORRECTDSCP;
|
||||
return;
|
||||
}
|
||||
if (msgreq->dir==NAS_DIRECTION_SEND){
|
||||
|
||||
if (msgreq->dir==NAS_DIRECTION_SEND) {
|
||||
struct cx_entity *cx;
|
||||
cx=nasmt_COMMON_search_cx(msgreq->lcr);
|
||||
if (cx!=NULL){
|
||||
|
||||
if (cx!=NULL) {
|
||||
printk("nasmt_set_msg_class_add_reply: DSCP %d, Classref %d\n",msgreq->dscp, msgreq->classref );
|
||||
gc=nasmt_CLASS_add_sclassifier(cx, msgreq->dscp, msgreq->classref);
|
||||
printk("nasmt_set_msg_class_add_reply: %p %p\n" , msgreq, gc);
|
||||
if (gc==NULL){
|
||||
|
||||
if (gc==NULL) {
|
||||
msgrep->status=-NAS_ERROR_NOMEMORY;
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
|
||||
return;
|
||||
}
|
||||
|
||||
gc->rab_id=msgreq->rab_id;
|
||||
gc->rb=nasmt_COMMON_search_rb(cx, gc->rab_id);
|
||||
}else{
|
||||
if (msgreq->dir==NAS_DIRECTION_RECEIVE){
|
||||
} else {
|
||||
if (msgreq->dir==NAS_DIRECTION_RECEIVE) {
|
||||
gc=nasmt_CLASS_add_rclassifier(msgreq->dscp, msgreq->classref);
|
||||
if (gc==NULL){
|
||||
|
||||
if (gc==NULL) {
|
||||
msgrep->status=-NAS_ERROR_NOMEMORY;
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
msgrep->status=-NAS_ERROR_NOTCORRECTDIR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nasmt_TOOL_fct(gc, msgreq->fct);
|
||||
gc->version=msgreq->version;
|
||||
switch(gc->version){
|
||||
case 4:
|
||||
gc->saddr.ipv4=msgreq->saddr.ipv4;
|
||||
gc->daddr.ipv4=msgreq->daddr.ipv4;
|
||||
gc->splen=msgreq->splen;
|
||||
gc->dplen=msgreq->dplen;
|
||||
break;
|
||||
case 6:
|
||||
gc->saddr.ipv6=msgreq->saddr.ipv6;
|
||||
gc->daddr.ipv6=msgreq->daddr.ipv6;
|
||||
gc->splen=msgreq->splen;
|
||||
gc->dplen=msgreq->dplen;
|
||||
break;
|
||||
case 0:
|
||||
gc->saddr.ipv6.s6_addr32[0]=0;
|
||||
gc->daddr.ipv6.s6_addr32[1]=0;
|
||||
gc->saddr.ipv6.s6_addr32[2]=0;
|
||||
gc->daddr.ipv6.s6_addr32[3]=0;
|
||||
gc->splen=0;
|
||||
gc->dplen=0;
|
||||
break;
|
||||
default:
|
||||
msgrep->status=-NAS_ERROR_NOTCORRECTVERSION;
|
||||
kfree(gc);
|
||||
return;
|
||||
|
||||
switch(gc->version) {
|
||||
case 4:
|
||||
gc->saddr.ipv4=msgreq->saddr.ipv4;
|
||||
gc->daddr.ipv4=msgreq->daddr.ipv4;
|
||||
gc->splen=msgreq->splen;
|
||||
gc->dplen=msgreq->dplen;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
gc->saddr.ipv6=msgreq->saddr.ipv6;
|
||||
gc->daddr.ipv6=msgreq->daddr.ipv6;
|
||||
gc->splen=msgreq->splen;
|
||||
gc->dplen=msgreq->dplen;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
gc->saddr.ipv6.s6_addr32[0]=0;
|
||||
gc->daddr.ipv6.s6_addr32[1]=0;
|
||||
gc->saddr.ipv6.s6_addr32[2]=0;
|
||||
gc->daddr.ipv6.s6_addr32[3]=0;
|
||||
gc->splen=0;
|
||||
gc->dplen=0;
|
||||
break;
|
||||
|
||||
default:
|
||||
msgrep->status=-NAS_ERROR_NOTCORRECTVERSION;
|
||||
kfree(gc);
|
||||
return;
|
||||
}
|
||||
|
||||
gc->protocol=msgreq->protocol;
|
||||
gc->sport=htons(msgreq->sport);
|
||||
gc->dport=htons(msgreq->dport);
|
||||
@@ -458,71 +512,82 @@ void nasmt_set_msg_class_add_reply(struct nas_msg_class_add_reply *msgrep, struc
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_class_add_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_class_add_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_msg_class_add_request msgreq;
|
||||
struct nas_msg_class_add_reply msgrep;
|
||||
printk("nasmt_ioCTL_class_add: Add classifier components requested\n");
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))){
|
||||
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
|
||||
printk("nasmt_ioCTL_class_add: copy_from_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
nasmt_set_msg_class_add_reply(&msgrep, &msgreq);
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))){
|
||||
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
|
||||
printk("nasmt_ioCTL_class_add: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Request the deletion of a classifier rule
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_class_del_reply(struct nas_msg_class_del_reply *msgrep, struct nas_msg_class_del_request *msgreq){
|
||||
//---------------------------------------------------------------------------
|
||||
if (msgreq->dscp>NAS_DSCP_DEFAULT)
|
||||
{
|
||||
void nasmt_set_msg_class_del_reply(struct nas_msg_class_del_reply *msgrep, struct nas_msg_class_del_request *msgreq)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
if (msgreq->dscp>NAS_DSCP_DEFAULT) {
|
||||
printk("nasmt_set_msg_class_del_reply: Incoherent parameter value\n");
|
||||
msgrep->status=-NAS_ERROR_NOTCORRECTDSCP;
|
||||
return;
|
||||
}
|
||||
if (msgreq->dir==NAS_DIRECTION_SEND){
|
||||
|
||||
if (msgreq->dir==NAS_DIRECTION_SEND) {
|
||||
struct cx_entity *cx;
|
||||
cx=nasmt_COMMON_search_cx(msgreq->lcr);
|
||||
|
||||
if (cx!=NULL)
|
||||
nasmt_CLASS_del_sclassifier(cx, msgreq->dscp, msgreq->classref);
|
||||
else{
|
||||
else {
|
||||
msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
if (msgreq->dir==NAS_DIRECTION_RECEIVE)
|
||||
nasmt_CLASS_del_rclassifier(msgreq->dscp, msgreq->classref);
|
||||
else{
|
||||
else {
|
||||
msgrep->status=-NAS_ERROR_NOTCORRECTDIR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
msgrep->status=0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_class_del_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_class_del_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_msg_class_del_request msgreq;
|
||||
struct nas_msg_class_del_reply msgrep;
|
||||
printk("nasmt_ioCTL_class_del: Del classifier components requested\n");
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq)))
|
||||
{
|
||||
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
|
||||
printk("nasmt_ioCTL_class_del: copy_from_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
nasmt_set_msg_class_del_reply(&msgrep, &msgreq);
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep)))
|
||||
{
|
||||
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
|
||||
printk("nasmt_ioCTL_class_del: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -531,43 +596,50 @@ int nasmt_ioCTL_class_del_request(struct nas_ioctl *gifr){
|
||||
// Messages for Measurement transfer
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_measure_reply(struct nas_msg_measure_reply *msgrep, struct nas_msg_measure_request *msgreq){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_measure_reply(struct nas_msg_measure_reply *msgrep, struct nas_msg_measure_request *msgreq)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct cx_entity *cx;
|
||||
int lcr=0; // Temp lcr->mt =0
|
||||
int i;
|
||||
|
||||
cx = nasmt_COMMON_search_cx(lcr);
|
||||
if (cx!=NULL){
|
||||
|
||||
if (cx!=NULL) {
|
||||
msgrep->num_cells = cx->num_measures;
|
||||
for (i=0; i<cx->num_measures; i++){
|
||||
|
||||
for (i=0; i<cx->num_measures; i++) {
|
||||
msgrep-> measures[i].cell_id = cx->meas_cell_id[i];
|
||||
msgrep-> measures[i].level = cx->meas_level[i];
|
||||
msgrep-> measures[i].provider_id = cx->provider_id[i];
|
||||
}
|
||||
|
||||
msgrep->signal_lost_flag = 0;
|
||||
}else{
|
||||
// msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
|
||||
// return;
|
||||
} else {
|
||||
// msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
|
||||
// return;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_measure_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_measure_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_msg_measure_request msgreq;
|
||||
struct nas_msg_measure_reply msgrep;
|
||||
printk("nasmt_ioCTL_measure: Measurement requested\n");
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq)))
|
||||
{
|
||||
|
||||
if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
|
||||
printk("nasmt_ioCTL_measure: copy_from_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
nasmt_set_msg_measure_reply(&msgrep, &msgreq);
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep)))
|
||||
{
|
||||
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
|
||||
printk("nasmt_ioCTL_measure: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -575,32 +647,36 @@ int nasmt_ioCTL_measure_request(struct nas_ioctl *gifr){
|
||||
// IMEI
|
||||
// Messages for IMEI transfer
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_imei_reply(struct nas_msg_l2id_reply *msgrep){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_set_msg_imei_reply(struct nas_msg_l2id_reply *msgrep)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct cx_entity *cx;
|
||||
int lcr=0; // Temp lcr->mt =0
|
||||
int i;
|
||||
|
||||
cx=nasmt_COMMON_search_cx(lcr);
|
||||
if (cx!=NULL){
|
||||
|
||||
if (cx!=NULL) {
|
||||
msgrep->l2id[0] = cx->iid6[0];
|
||||
msgrep->l2id[1] = cx->iid6[1];
|
||||
}else{
|
||||
// msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
|
||||
// return;
|
||||
} else {
|
||||
// msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
|
||||
// return;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_imei_request(struct nas_ioctl *gifr){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_ioCTL_imei_request(struct nas_ioctl *gifr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_msg_l2id_reply msgrep;
|
||||
printk("nasmt_ioCTL_imei: IMEI requested\n");
|
||||
nasmt_set_msg_imei_reply(&msgrep);
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep)))
|
||||
{
|
||||
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
|
||||
printk("nasmt_ioCTL_imei: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -608,71 +684,88 @@ int nasmt_ioCTL_imei_request(struct nas_ioctl *gifr){
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// IOCTL command
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_ioctl *gifr;
|
||||
int r;
|
||||
printk("nasmt_CTL_ioctl: begin\n");
|
||||
|
||||
//spin_lock(&gpriv->lock);
|
||||
switch(cmd)
|
||||
{
|
||||
switch(cmd) {
|
||||
case NASMT_IOCTL_RAL:
|
||||
gifr=(struct nas_ioctl *)ifr;
|
||||
switch(gifr->type)
|
||||
{
|
||||
|
||||
switch(gifr->type) {
|
||||
case NAS_MSG_STATISTIC_REQUEST:
|
||||
r=nasmt_ioCTL_statistic_request(gifr);
|
||||
break;
|
||||
|
||||
case NAS_MSG_CX_ESTABLISHMENT_REQUEST:
|
||||
r=nasmt_ioCTL_cx_establishment_request(gifr);
|
||||
break;
|
||||
|
||||
case NAS_MSG_CX_RELEASE_REQUEST:
|
||||
r=nasmt_ioCTL_cx_release_request(gifr);
|
||||
break;
|
||||
|
||||
case NAS_MSG_CX_LIST_REQUEST:
|
||||
r=nasmt_ioCTL_cx_list_request(gifr);
|
||||
break;
|
||||
|
||||
case NAS_MSG_RB_ESTABLISHMENT_REQUEST:
|
||||
r=nasmt_ioCTL_rb_establishment_request(gifr);
|
||||
break;
|
||||
|
||||
case NAS_MSG_RB_RELEASE_REQUEST:
|
||||
r= nasmt_ioCTL_rb_release_request(gifr);
|
||||
break;
|
||||
|
||||
case NAS_MSG_RB_LIST_REQUEST:
|
||||
r=nasmt_ioCTL_rb_list_request(gifr);
|
||||
break;
|
||||
|
||||
case NAS_MSG_CLASS_ADD_REQUEST:
|
||||
r=nasmt_ioCTL_class_add_request(gifr);
|
||||
break;
|
||||
|
||||
case NAS_MSG_CLASS_LIST_REQUEST:
|
||||
r=nasmt_ioCTL_class_list_request(gifr);
|
||||
break;
|
||||
|
||||
case NAS_MSG_CLASS_DEL_REQUEST:
|
||||
r=nasmt_ioCTL_class_del_request(gifr);
|
||||
break;
|
||||
|
||||
case NAS_MSG_MEAS_REQUEST:
|
||||
r=nasmt_ioCTL_measure_request(gifr);
|
||||
break;
|
||||
|
||||
case NAS_MSG_IMEI_REQUEST:
|
||||
r=nasmt_ioCTL_imei_request(gifr);
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("nasmt_CTL_ioctl: unkwon request type, type=%x\n", gifr->type);
|
||||
r=-EFAULT;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("nasmt_CTL_ioctl: Unknown ioctl command, cmd=%x\n", cmd);
|
||||
r=-EFAULT;
|
||||
}
|
||||
|
||||
//spin_unlock(&gpriv->lock);
|
||||
printk("nasmt_CTL_ioctl: end\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasmt_CTL_send - void \n");
|
||||
}
|
||||
|
||||
|
||||
@@ -78,15 +78,13 @@
|
||||
|
||||
typedef uint16_t nasMsgType_t;
|
||||
|
||||
struct nas_ioctl
|
||||
{
|
||||
struct nas_ioctl {
|
||||
char name[IFNAMSIZ];
|
||||
nasMsgType_t type;
|
||||
char *msg;
|
||||
};
|
||||
|
||||
struct nas_msg_statistic_reply
|
||||
{
|
||||
struct nas_msg_statistic_reply {
|
||||
uint32_t rx_packets;
|
||||
uint32_t tx_packets;
|
||||
uint32_t rx_bytes;
|
||||
@@ -97,8 +95,7 @@ struct nas_msg_statistic_reply
|
||||
uint32_t tx_dropped;
|
||||
};
|
||||
|
||||
struct nas_msg_cx_list_reply
|
||||
{
|
||||
struct nas_msg_cx_list_reply {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
uint8_t state;
|
||||
nasCellID_t cellid; // cell identification
|
||||
@@ -107,58 +104,47 @@ struct nas_msg_cx_list_reply
|
||||
uint16_t num_rb;
|
||||
uint16_t nsclassifier;
|
||||
};
|
||||
struct nas_msg_cx_establishment_reply
|
||||
{
|
||||
struct nas_msg_cx_establishment_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_cx_establishment_request
|
||||
{
|
||||
struct nas_msg_cx_establishment_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasCellID_t cellid; // Cell identification
|
||||
};
|
||||
struct nas_msg_cx_release_reply
|
||||
{
|
||||
struct nas_msg_cx_release_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_cx_release_request
|
||||
{
|
||||
struct nas_msg_cx_release_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
};
|
||||
|
||||
struct nas_msg_rb_list_reply
|
||||
{
|
||||
struct nas_msg_rb_list_reply {
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasSapId_t sapi;
|
||||
nasQoSTrafficClass_t qos;
|
||||
uint8_t state;
|
||||
};
|
||||
struct nas_msg_rb_list_request
|
||||
{
|
||||
struct nas_msg_rb_list_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
};
|
||||
struct nas_msg_rb_establishment_reply
|
||||
{
|
||||
struct nas_msg_rb_establishment_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_rb_establishment_request
|
||||
{
|
||||
struct nas_msg_rb_establishment_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasQoSTrafficClass_t qos;
|
||||
};
|
||||
|
||||
struct nas_msg_rb_release_reply
|
||||
{
|
||||
struct nas_msg_rb_release_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_rb_release_request
|
||||
{
|
||||
struct nas_msg_rb_release_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
};
|
||||
|
||||
struct nas_msg_class_add_request
|
||||
{
|
||||
struct nas_msg_class_add_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
uint8_t dir; // direction (send or receive)
|
||||
@@ -166,14 +152,12 @@ struct nas_msg_class_add_request
|
||||
uint8_t fct;
|
||||
uint16_t classref;
|
||||
uint8_t version;
|
||||
union
|
||||
{
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
} saddr; // IP source address
|
||||
uint8_t splen; // prefix length
|
||||
union
|
||||
{
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
} daddr; // IP destination address
|
||||
@@ -182,24 +166,20 @@ struct nas_msg_class_add_request
|
||||
uint16_t sport; // source port
|
||||
uint16_t dport; // destination port
|
||||
};
|
||||
struct nas_msg_class_add_reply
|
||||
{
|
||||
struct nas_msg_class_add_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_class_del_request
|
||||
{
|
||||
struct nas_msg_class_del_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
uint8_t dir; // direction (send or receive)
|
||||
uint8_t dscp; // codepoint
|
||||
uint16_t classref;
|
||||
};
|
||||
struct nas_msg_class_del_reply
|
||||
{
|
||||
struct nas_msg_class_del_reply {
|
||||
int status;
|
||||
};
|
||||
#define nas_msg_class_list_reply nas_msg_class_add_request
|
||||
struct nas_msg_class_list_request
|
||||
{
|
||||
struct nas_msg_class_list_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
uint8_t dir;
|
||||
uint8_t dscp;
|
||||
@@ -210,20 +190,18 @@ struct nas_msg_class_list_request
|
||||
typedef uint32_t nioctlProviderId_t;
|
||||
typedef uint16_t nioctlSignalLoss_t;
|
||||
typedef struct nioctlMeasures {
|
||||
nasCellID_t cell_id;
|
||||
nasSigLevel_t level;
|
||||
nioctlProviderId_t provider_id;
|
||||
nasCellID_t cell_id;
|
||||
nasSigLevel_t level;
|
||||
nioctlProviderId_t provider_id;
|
||||
} nioctlMeasures_t;
|
||||
|
||||
struct nas_msg_measure_request
|
||||
{
|
||||
struct nas_msg_measure_request {
|
||||
nasNumRGsMeas_t num_cells;
|
||||
nasCellID_t cellid[MAX_MEASURE_NB]; // Cell identification
|
||||
uint16_t num_providers;
|
||||
nioctlProviderId_t provider_id[MAX_MEASURE_NB]; // Provider identification
|
||||
};
|
||||
struct nas_msg_measure_reply
|
||||
{
|
||||
struct nas_msg_measure_reply {
|
||||
nasNumRGsMeas_t num_cells;
|
||||
nioctlMeasures_t measures[MAX_MEASURE_NB];
|
||||
nioctlSignalLoss_t signal_lost_flag;
|
||||
@@ -232,8 +210,7 @@ struct nas_msg_measure_reply
|
||||
// Messages for L2Id transfer - MW
|
||||
typedef uint32_t nioctlL2Id_t[2];
|
||||
|
||||
struct nas_msg_l2id_reply
|
||||
{
|
||||
struct nas_msg_l2id_reply {
|
||||
nioctlL2Id_t l2id;
|
||||
};
|
||||
|
||||
|
||||
@@ -56,19 +56,22 @@ static DEFINE_MUTEX(nasmt_mutex);
|
||||
// This can also be implemented using thread to get the data from PDCP without blocking.
|
||||
//---------------------------------------------------------------------------
|
||||
// Function for transfer with PDCP (from NASLITE)
|
||||
static void nasmt_nl_data_ready (struct sk_buff *skb){
|
||||
//---------------------------------------------------------------------------
|
||||
static void nasmt_nl_data_ready (struct sk_buff *skb)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nlmsghdr *nlh = NULL;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("nasmt_nl_data_ready - begin \n");
|
||||
#endif
|
||||
if (!skb){
|
||||
printk("nasmt_nl_data_ready - input parameter skb is NULL \n");
|
||||
|
||||
if (!skb) {
|
||||
printk("nasmt_nl_data_ready - input parameter skb is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("nasmt_nl_data_ready - Received socket from PDCP\n");
|
||||
@@ -79,21 +82,24 @@ static void nasmt_nl_data_ready (struct sk_buff *skb){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Function for transfer with RRC
|
||||
static void nasmt_rrcnl_data_ready (struct sk_buff *skb){
|
||||
//---------------------------------------------------------------------------
|
||||
static void nasmt_rrcnl_data_ready (struct sk_buff *skb)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nlmsghdr *nlh = NULL;
|
||||
char target_sap;
|
||||
uint8_t cxi = 0;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_RRCNL
|
||||
printk("nasmt_rrcnl_data_ready - begin \n");
|
||||
#endif
|
||||
if (!skb){
|
||||
printk("nasmt_rrcnl_data_ready - input parameter skb is NULL \n");
|
||||
|
||||
if (!skb) {
|
||||
printk("nasmt_rrcnl_data_ready - input parameter skb is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
|
||||
nlh = (struct nlmsghdr *)skb->data;
|
||||
//pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
|
||||
@@ -104,37 +110,42 @@ static void nasmt_rrcnl_data_ready (struct sk_buff *skb){
|
||||
printk("nasmt_rrcnl_data_ready - Received on socket from RRC, SAP %d\n", target_sap);
|
||||
#endif //NAS_DEBUG_RRCNL
|
||||
|
||||
switch (target_sap){
|
||||
case RRC_NAS_GC_OUT:
|
||||
//printk("nasmt_rrcnl_data_ready - Calling nasmt_ASCTL_GC_receive\n");
|
||||
nasmt_ASCTL_GC_receive(&((char*)NLMSG_DATA(nlh))[1]);
|
||||
break;
|
||||
case RRC_NAS_DC0_OUT:
|
||||
//printk("nasmt_rrcnl_data_ready - Calling nasmt_ASCTL_DC_receive\n");
|
||||
nasmt_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
|
||||
break;
|
||||
default:
|
||||
printk("nasmt_rrcnl_data_ready - Invalid SAP value received\n");
|
||||
switch (target_sap) {
|
||||
case RRC_NAS_GC_OUT:
|
||||
//printk("nasmt_rrcnl_data_ready - Calling nasmt_ASCTL_GC_receive\n");
|
||||
nasmt_ASCTL_GC_receive(&((char*)NLMSG_DATA(nlh))[1]);
|
||||
break;
|
||||
|
||||
case RRC_NAS_DC0_OUT:
|
||||
//printk("nasmt_rrcnl_data_ready - Calling nasmt_ASCTL_DC_receive\n");
|
||||
nasmt_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("nasmt_rrcnl_data_ready - Invalid SAP value received\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_netlink_init(void){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_netlink_init(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasmt_netlink_init - begin \n");
|
||||
|
||||
nas_nl_sk = netlink_kernel_create(&init_net,NAS_NETLINK_ID, 0, nasmt_nl_data_ready,
|
||||
&nasmt_mutex, // NULL
|
||||
THIS_MODULE);
|
||||
|
||||
if (!nas_nl_sk) {
|
||||
printk("nasmt_netlink_init - netlink_kernel_create failed for PDCP socket\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
nas_rrcnl_sk = netlink_kernel_create(&init_net,NAS_RRCNL_ID, 0, nasmt_rrcnl_data_ready,
|
||||
&nasmt_mutex, // NULL
|
||||
THIS_MODULE);
|
||||
&nasmt_mutex, // NULL
|
||||
THIS_MODULE);
|
||||
|
||||
if (!nas_rrcnl_sk) {
|
||||
printk("nasmt_rrcnl_init - netlink_kernel_create failed for RRC socket\n");
|
||||
return(-1);
|
||||
@@ -144,43 +155,50 @@ int nasmt_netlink_init(void){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_netlink_release(void) {
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_netlink_release(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasmt_netlink_release - begin \n");
|
||||
|
||||
//exit_netlink_thread=1;
|
||||
printk("nasmt_netlink_release - Releasing netlink sockets\n");
|
||||
|
||||
if(nas_nl_sk){
|
||||
if(nas_nl_sk) {
|
||||
netlink_kernel_release(nas_nl_sk);
|
||||
}
|
||||
if(nas_rrcnl_sk){
|
||||
|
||||
if(nas_rrcnl_sk) {
|
||||
netlink_kernel_release(nas_rrcnl_sk);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination) {
|
||||
//---------------------------------------------------------------------------
|
||||
int nasmt_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct sk_buff *nl_skb;
|
||||
struct nlmsghdr *nlh;
|
||||
int status;
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("nasmt_netlink_send - begin \n");
|
||||
#endif
|
||||
if (!data_buffer){
|
||||
printk("nasmt_netlink_send - ERROR - input parameter data is NULL \n");
|
||||
|
||||
if (!data_buffer) {
|
||||
printk("nasmt_netlink_send - ERROR - input parameter data is NULL \n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (!nas_nl_sk || !nas_rrcnl_sk) {
|
||||
printk("nasmt_netlink_send - ERROR - socket is NULL\n");
|
||||
return(0);
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
|
||||
nl_skb = alloc_skb(NLMSG_SPACE(data_length),GFP_ATOMIC);
|
||||
|
||||
if (!nl_skb) {
|
||||
printk("nasmt_netlink_send - ERROR - could not allocate skbuffer\n");
|
||||
return(0);
|
||||
@@ -197,15 +215,15 @@ int nasmt_netlink_send(unsigned char *data_buffer, unsigned int data_length, int
|
||||
NETLINK_CB(nl_skb).pid = 0;
|
||||
|
||||
// destination 0 = PDCP, 1 = RRC
|
||||
if (!destination){
|
||||
#ifdef NETLINK_DEBUG
|
||||
if (!destination) {
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("nasmt_netlink_send - nl_skb %p, nl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_nl_sk, nlh, nlh->nlmsg_len);
|
||||
#endif //DEBUG_NETLINK
|
||||
#endif //DEBUG_NETLINK
|
||||
status = netlink_unicast(nas_nl_sk, nl_skb, NL_DEST_PID, MSG_DONTWAIT);
|
||||
}else{
|
||||
#ifdef NAS_DEBUG_RRCNL
|
||||
} else {
|
||||
#ifdef NAS_DEBUG_RRCNL
|
||||
printk("nasmt_rrcnl_send - nl_skb %p, nas_rrcnl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_rrcnl_sk, nlh, nlh->nlmsg_len);
|
||||
#endif //NAS_DEBUG_RRCNL
|
||||
#endif //NAS_DEBUG_RRCNL
|
||||
status = netlink_unicast(nas_rrcnl_sk, nl_skb, NL_DEST_RRC_PID, MSG_DONTWAIT);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,127 +42,153 @@
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
void nasmt_TOOL_fct(struct classifier_entity *gc, uint8_t fct){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void nasmt_TOOL_fct(struct classifier_entity *gc, uint8_t fct)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_fct - begin \n");
|
||||
#endif
|
||||
if (gc==NULL){
|
||||
|
||||
if (gc==NULL) {
|
||||
printk("nasmt_TOOL_fct - input parameter gc is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
switch(fct){
|
||||
case NAS_FCT_QOS_SEND:
|
||||
gc->fct=nasmt_COMMON_QOS_send;
|
||||
break;
|
||||
case NAS_FCT_CTL_SEND:
|
||||
gc->fct=nasmt_CTL_send;
|
||||
break;
|
||||
case NAS_FCT_DC_SEND:
|
||||
gc->fct=nasmt_ASCTL_DC_send_sig_data_request;
|
||||
break;
|
||||
case NAS_FCT_DEL_SEND:
|
||||
gc->fct=nasmt_COMMON_del_send;
|
||||
break;
|
||||
default:
|
||||
gc->fct=nasmt_COMMON_del_send;
|
||||
|
||||
// End debug information
|
||||
switch(fct) {
|
||||
case NAS_FCT_QOS_SEND:
|
||||
gc->fct=nasmt_COMMON_QOS_send;
|
||||
break;
|
||||
|
||||
case NAS_FCT_CTL_SEND:
|
||||
gc->fct=nasmt_CTL_send;
|
||||
break;
|
||||
|
||||
case NAS_FCT_DC_SEND:
|
||||
gc->fct=nasmt_ASCTL_DC_send_sig_data_request;
|
||||
break;
|
||||
|
||||
case NAS_FCT_DEL_SEND:
|
||||
gc->fct=nasmt_COMMON_del_send;
|
||||
break;
|
||||
|
||||
default:
|
||||
gc->fct=nasmt_COMMON_del_send;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t nasmt_TOOL_invfct(struct classifier_entity *gc){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
uint8_t nasmt_TOOL_invfct(struct classifier_entity *gc)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_invfct - begin \n");
|
||||
#endif
|
||||
if (gc==NULL){
|
||||
printk("nasmt_TOOL_invfct - input parameter gc is NULL \n");
|
||||
|
||||
if (gc==NULL) {
|
||||
printk("nasmt_TOOL_invfct - input parameter gc is NULL \n");
|
||||
return 0;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
if (gc->fct==nasmt_COMMON_QOS_send)
|
||||
return NAS_FCT_QOS_SEND;
|
||||
|
||||
if (gc->fct==nasmt_CTL_send)
|
||||
return NAS_FCT_CTL_SEND;
|
||||
|
||||
if (gc->fct==nasmt_COMMON_del_send)
|
||||
return NAS_FCT_DEL_SEND;
|
||||
|
||||
if (gc->fct==nasmt_ASCTL_DC_send_sig_data_request)
|
||||
return NAS_FCT_DC_SEND;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t nasmt_TOOL_get_dscp6(struct ipv6hdr *iph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
uint8_t nasmt_TOOL_get_dscp6(struct ipv6hdr *iph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_get_dscp6 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
printk("nasmt_TOOL_get_dscp6 - input parameter ipv6hdr is NULL \n");
|
||||
|
||||
if (iph==NULL) {
|
||||
printk("nasmt_TOOL_get_dscp6 - input parameter ipv6hdr is NULL \n");
|
||||
return 0;
|
||||
}
|
||||
// End debug information
|
||||
// return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>22; //Yan
|
||||
|
||||
// End debug information
|
||||
// return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>22; //Yan
|
||||
return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>20;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t nasmt_TOOL_get_dscp4(struct iphdr *iph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
uint8_t nasmt_TOOL_get_dscp4(struct iphdr *iph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_get_dscp4 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
printk("nasmt_TOOL_get_dscp4 - input parameter ipv4hdr is NULL \n");
|
||||
|
||||
if (iph==NULL) {
|
||||
printk("nasmt_TOOL_get_dscp4 - input parameter ipv4hdr is NULL \n");
|
||||
return 0;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
return ((iph->tos)>>5)<<3;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t *nasmt_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol){
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t *nasmt_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint16_t size;
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_get_protocol6 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
printk("nasmt_TOOL_get_protocol6 - input parameter ipv6hdr is NULL \n");
|
||||
|
||||
if (iph==NULL) {
|
||||
printk("nasmt_TOOL_get_protocol6 - input parameter ipv6hdr is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
if (protocol==NULL){
|
||||
printk("nasmt_TOOL_get_protocol6 - input parameter protocol is NULL \n");
|
||||
|
||||
if (protocol==NULL) {
|
||||
printk("nasmt_TOOL_get_protocol6 - input parameter protocol is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
*protocol=iph->nexthdr;
|
||||
size=NAS_IPV6_SIZE;
|
||||
while (1)
|
||||
{
|
||||
switch(*protocol)
|
||||
{
|
||||
|
||||
while (1) {
|
||||
switch(*protocol) {
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_ICMPV6:
|
||||
return (uint8_t *)((uint8_t *)iph+size);
|
||||
|
||||
case IPPROTO_HOPOPTS:
|
||||
case IPPROTO_ROUTING:
|
||||
case IPPROTO_DSTOPTS:
|
||||
*protocol=((uint8_t *)iph+size)[0];
|
||||
size+=((uint8_t *)iph+size)[1]*8+8;
|
||||
break;
|
||||
|
||||
case IPPROTO_FRAGMENT:
|
||||
*protocol=((uint8_t *)iph+size)[0];
|
||||
size+=((uint8_t *)iph+size)[1]+8;
|
||||
break;
|
||||
|
||||
case IPPROTO_NONE:
|
||||
case IPPROTO_AH:
|
||||
case IPPROTO_ESP:
|
||||
@@ -173,27 +199,33 @@ uint8_t *nasmt_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t *nasmt_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
uint8_t *nasmt_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_get_protocol4 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
printk("nasmt_TOOL_get_protocol4 - input parameter iph is NULL \n");
|
||||
|
||||
if (iph==NULL) {
|
||||
printk("nasmt_TOOL_get_protocol4 - input parameter iph is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
if (protocol==NULL){
|
||||
printk("nasmt_TOOL_get_protocol4 - input parameter protocol is NULL \n");
|
||||
|
||||
if (protocol==NULL) {
|
||||
printk("nasmt_TOOL_get_protocol4 - input parameter protocol is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
*protocol=iph->protocol;
|
||||
switch(*protocol){
|
||||
|
||||
switch(*protocol) {
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_ICMP:
|
||||
return (uint8_t *)((uint8_t *)iph+iph->tot_len);
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@@ -201,21 +233,25 @@ uint8_t *nasmt_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Convert the IMEI to iid
|
||||
void nasmt_TOOL_imei2iid(uint8_t *imei, uint8_t *iid){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void nasmt_TOOL_imei2iid(uint8_t *imei, uint8_t *iid)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_imei2iid - begin \n");
|
||||
#endif
|
||||
if (imei==NULL){
|
||||
printk("nasmt_TOOL_imei2iid - input parameter imei is NULL \n");
|
||||
|
||||
if (imei==NULL) {
|
||||
printk("nasmt_TOOL_imei2iid - input parameter imei is NULL \n");
|
||||
return;
|
||||
}
|
||||
if (iid==NULL){
|
||||
printk("nasmt_TOOL_imei2iid - input parameter iid is NULL \n");
|
||||
|
||||
if (iid==NULL) {
|
||||
printk("nasmt_TOOL_imei2iid - input parameter iid is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
memset(iid, 0, NAS_ADDR_LEN);
|
||||
iid[0] = 0x03;
|
||||
iid[1] = 16*imei[0]+imei[1];
|
||||
@@ -229,25 +265,30 @@ void nasmt_TOOL_imei2iid(uint8_t *imei, uint8_t *iid){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Convert the IMEI to iid
|
||||
void nasmt_TOOL_eth_imei2iid(unsigned char *imei, unsigned char *addr ,unsigned char *iid, unsigned char len){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_TOOL_eth_imei2iid(unsigned char *imei, unsigned char *addr ,unsigned char *iid, unsigned char len)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
unsigned int index;
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_eth_imei2iid - begin \n");
|
||||
#endif
|
||||
if (!imei || !addr || !iid){
|
||||
printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - input parameter imei, addr or iid is NULL \n");
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (!imei || !addr || !iid) {
|
||||
printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - input parameter imei, addr or iid is NULL \n");
|
||||
return;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
// set addr (should be device HW address)
|
||||
memset(addr, 0, len);
|
||||
addr[0] = 0x00; // to be compatible between link local and global
|
||||
|
||||
// len -1 because of insertion of 0 above
|
||||
for (index = 0; index < (len-1); index++) {
|
||||
addr[index+1] = 16*imei[index*2]+imei[index*2+1];
|
||||
addr[index+1] = 16*imei[index*2]+imei[index*2+1];
|
||||
}
|
||||
|
||||
// set iid6
|
||||
memset(iid, 0, NAS_ADDR_LEN);
|
||||
iid[0] = 0x02;
|
||||
@@ -262,106 +303,197 @@ void nasmt_TOOL_eth_imei2iid(unsigned char *imei, unsigned char *addr ,unsigned
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_TOOL_pk_icmp6(struct icmp6hdr *icmph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void nasmt_TOOL_pk_icmp6(struct icmp6hdr *icmph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef GRAAL_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_pk_icmp6 - begin \n");
|
||||
#endif
|
||||
if (!icmph){
|
||||
printk("nasmt_TOOL_pk_icmp6 - input parameter icmph is NULL \n");
|
||||
|
||||
if (!icmph) {
|
||||
printk("nasmt_TOOL_pk_icmp6 - input parameter icmph is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
printk("ICMPv6:\t type= %d, code = %d\n", icmph->icmp6_type, icmph->icmp6_code);
|
||||
switch(icmph->icmp6_type){
|
||||
case ICMPV6_DEST_UNREACH:printk("Destination unreachable\n");break;
|
||||
case ICMPV6_PKT_TOOBIG:printk("Packet too big\n");break;
|
||||
case ICMPV6_TIME_EXCEED:printk("Time exceeded\n");break;
|
||||
case ICMPV6_PARAMPROB:printk("Parameter problem\n");break;
|
||||
case ICMPV6_ECHO_REQUEST:printk("Echo request\n");break;
|
||||
case ICMPV6_ECHO_REPLY:printk("Echo reply\n");break;
|
||||
case ICMPV6_MGM_QUERY:printk("Multicast listener query\n");break;
|
||||
case ICMPV6_MGM_REPORT:printk("Multicast listener report\n");break;
|
||||
case ICMPV6_MGM_REDUCTION:printk("Multicast listener done\n");break;
|
||||
case NDISC_ROUTER_SOLICITATION:printk("Router solicitation\n");break;
|
||||
case NDISC_ROUTER_ADVERTISEMENT:printk("Router advertisment\n");break;
|
||||
case NDISC_NEIGHBOUR_SOLICITATION:printk("Neighbour solicitation\n");break;
|
||||
case NDISC_NEIGHBOUR_ADVERTISEMENT:printk("Neighbour advertisment\n");break;
|
||||
case NDISC_REDIRECT:printk("redirect message\n");break;
|
||||
|
||||
switch(icmph->icmp6_type) {
|
||||
case ICMPV6_DEST_UNREACH:
|
||||
printk("Destination unreachable\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_PKT_TOOBIG:
|
||||
printk("Packet too big\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_TIME_EXCEED:
|
||||
printk("Time exceeded\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_PARAMPROB:
|
||||
printk("Parameter problem\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_ECHO_REQUEST:
|
||||
printk("Echo request\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_ECHO_REPLY:
|
||||
printk("Echo reply\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_MGM_QUERY:
|
||||
printk("Multicast listener query\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_MGM_REPORT:
|
||||
printk("Multicast listener report\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_MGM_REDUCTION:
|
||||
printk("Multicast listener done\n");
|
||||
break;
|
||||
|
||||
case NDISC_ROUTER_SOLICITATION:
|
||||
printk("Router solicitation\n");
|
||||
break;
|
||||
|
||||
case NDISC_ROUTER_ADVERTISEMENT:
|
||||
printk("Router advertisment\n");
|
||||
break;
|
||||
|
||||
case NDISC_NEIGHBOUR_SOLICITATION:
|
||||
printk("Neighbour solicitation\n");
|
||||
break;
|
||||
|
||||
case NDISC_NEIGHBOUR_ADVERTISEMENT:
|
||||
printk("Neighbour advertisment\n");
|
||||
break;
|
||||
|
||||
case NDISC_REDIRECT:
|
||||
printk("redirect message\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasmt_TOOL_print_state(uint8_t state){
|
||||
//---------------------------------------------------------------------------
|
||||
switch(state){
|
||||
case NAS_IDLE:printk("NAS_IDLE\n");return;
|
||||
case NAS_CX_FACH:printk("NAS_CX_FACH\n");return;
|
||||
case NAS_CX_DCH:printk("NAS_CX_DCH\n");return;
|
||||
case NAS_CX_RECEIVED:printk("NAS_CX_RECEIVED\n");return;
|
||||
case NAS_CX_CONNECTING:printk("NAS_CX_CONNECTING\n");return;
|
||||
case NAS_CX_RELEASING:printk("NAS_CX_RELEASING\n");return;
|
||||
case NAS_CX_CONNECTING_FAILURE:printk("NAS_CX_CONNECTING_FAILURE\n");return;
|
||||
case NAS_CX_RELEASING_FAILURE:printk("NAS_CX_RELEASING_FAILURE\n");return;
|
||||
case NAS_RB_ESTABLISHING:printk("NAS_RB_ESTABLISHING\n");return;
|
||||
case NAS_RB_RELEASING:printk("NAS_RB_RELEASING\n");return;
|
||||
case NAS_RB_DCH:printk("NAS_RB_DCH\n");return;
|
||||
default: printk("nasmt_TOOL_print_state - Unknown state\n");
|
||||
void nasmt_TOOL_print_state(uint8_t state)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
switch(state) {
|
||||
case NAS_IDLE:
|
||||
printk("NAS_IDLE\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_FACH:
|
||||
printk("NAS_CX_FACH\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_DCH:
|
||||
printk("NAS_CX_DCH\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_RECEIVED:
|
||||
printk("NAS_CX_RECEIVED\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_CONNECTING:
|
||||
printk("NAS_CX_CONNECTING\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_RELEASING:
|
||||
printk("NAS_CX_RELEASING\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_CONNECTING_FAILURE:
|
||||
printk("NAS_CX_CONNECTING_FAILURE\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_RELEASING_FAILURE:
|
||||
printk("NAS_CX_RELEASING_FAILURE\n");
|
||||
return;
|
||||
|
||||
case NAS_RB_ESTABLISHING:
|
||||
printk("NAS_RB_ESTABLISHING\n");
|
||||
return;
|
||||
|
||||
case NAS_RB_RELEASING:
|
||||
printk("NAS_RB_RELEASING\n");
|
||||
return;
|
||||
|
||||
case NAS_RB_DCH:
|
||||
printk("NAS_RB_DCH\n");
|
||||
return;
|
||||
|
||||
default:
|
||||
printk("nasmt_TOOL_print_state - Unknown state\n");
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Print the content of a buffer in hexadecimal
|
||||
void nasmt_TOOL_print_buffer(unsigned char * buffer,int length) {
|
||||
//-----------------------------------------------------------------------------
|
||||
int i;
|
||||
void nasmt_TOOL_print_buffer(unsigned char * buffer,int length)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
int i;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_print_buffer - begin \n");
|
||||
#endif
|
||||
if (buffer==NULL){
|
||||
printk("nasmt_TOOL_print_buffer - input parameter buffer is NULL \n");
|
||||
|
||||
if (buffer==NULL) {
|
||||
printk("nasmt_TOOL_print_buffer - input parameter buffer is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
printk("\nBuffer content: ");
|
||||
for (i=0;i<length;i++)
|
||||
printk("-%hx-",buffer[i]);
|
||||
printk(",\t length %d\n", length);
|
||||
|
||||
// End debug information
|
||||
printk("\nBuffer content: ");
|
||||
|
||||
for (i=0; i<length; i++)
|
||||
printk("-%hx-",buffer[i]);
|
||||
|
||||
printk(",\t length %d\n", length);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void nasmt_TOOL_print_rb_entity(struct rb_entity *rb){
|
||||
//-----------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void nasmt_TOOL_print_rb_entity(struct rb_entity *rb)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_print_rb_entity - begin \n");
|
||||
#endif
|
||||
if (rb==NULL){
|
||||
printk("nasmt_TOOL_print_rb_entity - input parameter rb is NULL \n");
|
||||
|
||||
if (rb==NULL) {
|
||||
printk("nasmt_TOOL_print_rb_entity - input parameter rb is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
printk("\nrb_entity content: rab_id %d, sapi %d, qos %d, dscp %d, \n", rb->rab_id, rb->sapi, rb->qos, rb->dscp);
|
||||
printk("state %d, retry %d, countimer %d\n",rb->state, rb->retry, rb->countimer);
|
||||
|
||||
// End debug information
|
||||
printk("\nrb_entity content: rab_id %d, sapi %d, qos %d, dscp %d, \n", rb->rab_id, rb->sapi, rb->qos, rb->dscp);
|
||||
printk("state %d, retry %d, countimer %d\n",rb->state, rb->retry, rb->countimer);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void nasmt_TOOL_print_classifier(struct classifier_entity *gc){
|
||||
//-----------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void nasmt_TOOL_print_classifier(struct classifier_entity *gc)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasmt_TOOL_print_classifier - begin \n");
|
||||
#endif
|
||||
if (gc==NULL){
|
||||
printk("nasmt_TOOL_print_classifier - input parameter gc is NULL \n");
|
||||
|
||||
if (gc==NULL) {
|
||||
printk("nasmt_TOOL_print_classifier - input parameter gc is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
printk("\nClassifier content: classref %d, version %d, splen %d, dplen %d,\n", gc->classref, gc->version, gc->splen, gc->dplen);
|
||||
printk("protocol %d, sport %d, dport %d, rab_id %d\n", gc->protocol, gc->sport, gc->dport, gc->rab_id);
|
||||
nasmt_TOOL_print_rb_entity(gc->rb);
|
||||
|
||||
// End debug information
|
||||
printk("\nClassifier content: classref %d, version %d, splen %d, dplen %d,\n", gc->classref, gc->version, gc->splen, gc->dplen);
|
||||
printk("protocol %d, sport %d, dport %d, rab_id %d\n", gc->protocol, gc->sport, gc->dport, gc->rab_id);
|
||||
nasmt_TOOL_print_rb_entity(gc->rb);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -64,8 +64,7 @@
|
||||
|
||||
struct cx_entity;
|
||||
|
||||
struct rb_entity
|
||||
{
|
||||
struct rb_entity {
|
||||
uint32_t cnxid;
|
||||
nasRadioBearerId_t rab_id; //ue_rbId
|
||||
nasSapId_t sapi;
|
||||
@@ -79,15 +78,15 @@ struct rb_entity
|
||||
struct rb_entity *next;
|
||||
};
|
||||
|
||||
struct classifier_entity{
|
||||
struct classifier_entity {
|
||||
uint32_t classref; // classifier identity
|
||||
uint8_t version; // IP version 4 or 6
|
||||
union{
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
} saddr; // IP source address
|
||||
uint8_t splen; // IP prefix size
|
||||
union{
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
} daddr; // IP destination address
|
||||
@@ -102,7 +101,7 @@ struct classifier_entity{
|
||||
};
|
||||
|
||||
|
||||
struct cx_entity{
|
||||
struct cx_entity {
|
||||
int sap[NAS_SAPI_CX_MAX];
|
||||
uint8_t state; // state of the connection
|
||||
nasLocalConnectionRef_t lcr; // Local connection reference
|
||||
@@ -115,18 +114,18 @@ struct cx_entity{
|
||||
uint8_t iid4; // IPv4 interface identification
|
||||
struct rb_entity *rb;
|
||||
uint16_t num_rb;
|
||||
//measures
|
||||
//measures
|
||||
int req_prov_id[MAX_MEASURE_NB];
|
||||
int num_measures;
|
||||
int meas_cell_id[MAX_MEASURE_NB];
|
||||
int meas_level[MAX_MEASURE_NB];
|
||||
int provider_id[MAX_MEASURE_NB];
|
||||
//MBMS
|
||||
//MBMS
|
||||
int joined_services[NASMT_MBMS_SVCES_MAX];
|
||||
|
||||
};
|
||||
|
||||
struct nas_priv{
|
||||
struct nas_priv {
|
||||
int irq;
|
||||
int rx_flags;
|
||||
struct timer_list timer;
|
||||
@@ -147,10 +146,10 @@ struct nas_priv{
|
||||
struct ipversion {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
uint8_t reserved:4,
|
||||
version:4;
|
||||
version:4;
|
||||
#else
|
||||
uint8_t version:4,
|
||||
reserved:4;
|
||||
reserved:4;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -44,8 +44,9 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Receive data from FIFO (QOS or DC)
|
||||
//void nasrg_COMMON_receive(uint16_t hlen, uint16_t dlen, int sap){
|
||||
void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct sk_buff *skb;
|
||||
struct ipversion *ipv;
|
||||
unsigned int hard_header_len;
|
||||
@@ -56,37 +57,43 @@ void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *da
|
||||
printk("nasrg_COMMON_receive: begin\n");
|
||||
#endif
|
||||
#ifdef NAS_NETLINK
|
||||
// data_buffer is NULL if FIFOs
|
||||
if (!data_buffer){
|
||||
printk("nasrg_COMMON_receive - input parameter data_buffer is NULL \n");
|
||||
|
||||
// data_buffer is NULL if FIFOs
|
||||
if (!data_buffer) {
|
||||
printk("nasrg_COMMON_receive - input parameter data_buffer is NULL \n");
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
skb = dev_alloc_skb( payload_length + 2 );
|
||||
if(!skb){
|
||||
|
||||
if(!skb) {
|
||||
printk("nasrg_COMMON_receive: low on memory\n");
|
||||
++gpriv->stats.rx_dropped;
|
||||
return;
|
||||
}
|
||||
|
||||
skb_reserve(skb,2);
|
||||
|
||||
#ifndef NAS_NETLINK
|
||||
bytes_read += rtf_get(sap, skb_put(skb, payload_length), payload_length);
|
||||
if (bytes_read != NAS_PDCPH_SIZE + payload_length){
|
||||
|
||||
if (bytes_read != NAS_PDCPH_SIZE + payload_length) {
|
||||
printk("nasrg_COMMON_receive: problem while reading rtf sap\n");
|
||||
kfree(skb->data);
|
||||
dev_kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
|
||||
#else
|
||||
memcpy(skb_put(skb, payload_length), data_buffer, payload_length);
|
||||
bytes_read += payload_length;
|
||||
#endif
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasrg_COMMON_receive: received packet from PDCP, length %d\n", bytes_read);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
skb->dev = gdev;
|
||||
hard_header_len = gdev->hard_header_len;
|
||||
@@ -95,119 +102,136 @@ void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *da
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
|
||||
ipv = (struct ipversion *)&(skb->data[hard_header_len]);
|
||||
switch (ipv->version){
|
||||
case 6:
|
||||
#ifdef NAS_DEBUG_RECEIVE_BASIC
|
||||
printk("nasrg_COMMON_receive: receive IPv6 message\n");
|
||||
#endif
|
||||
skb->network_header = &skb->data[hard_header_len];
|
||||
// set protocol default value
|
||||
skb->protocol = htons(ETH_P_IPV6);
|
||||
// If type Ethernet, correct it
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
skb->protocol = eth_type_trans(skb, gdev);
|
||||
#endif
|
||||
break;
|
||||
case 4:
|
||||
#ifdef NAS_DEBUG_RECEIVE_BASIC
|
||||
printk("nasrg_COMMON_receive: receive IPv4 message\n");
|
||||
#endif
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
|
||||
if (addr){
|
||||
printk("nasrg_COMMON_receive: Source %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
|
||||
if (addr){
|
||||
printk("nasrg_COMMON_receive Dest %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
printk("nasrg_COMMON_receive protocol %d\n",((struct iphdr *)&skb->data[hard_header_len])->protocol);
|
||||
#endif
|
||||
switch (ipv->version) {
|
||||
case 6:
|
||||
#ifdef NAS_DEBUG_RECEIVE_BASIC
|
||||
printk("nasrg_COMMON_receive: receive IPv6 message\n");
|
||||
#endif
|
||||
skb->network_header = &skb->data[hard_header_len];
|
||||
// set protocol default value
|
||||
skb->protocol = htons(ETH_P_IPV6);
|
||||
// If type Ethernet, correct it
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
skb->protocol = eth_type_trans(skb, gdev);
|
||||
#endif
|
||||
break;
|
||||
|
||||
skb->network_header = &skb->data[hard_header_len];
|
||||
// set protocol default value
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
// If type Ethernet, correct it
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
skb->protocol = eth_type_trans(skb, gdev);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
printk("nasrg_COMMON_receive: Packet is not IPv4 or IPv6 (version=%d)\n", ipv->version);
|
||||
case 4:
|
||||
#ifdef NAS_DEBUG_RECEIVE_BASIC
|
||||
printk("nasrg_COMMON_receive: receive IPv4 message\n");
|
||||
#endif
|
||||
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasrg_COMMON_receive: ether_type=%04X\n", ether_type);
|
||||
#endif
|
||||
skb->protocol = eth_type_trans(skb, gdev);
|
||||
// minus 1(short) instead of 2(bytes) because uint16_t*
|
||||
p_ether_type = (uint16_t *)&(skb->mac_header[hard_header_len-2]);
|
||||
ether_type = ntohs(*p_ether_type);
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasrg_COMMON_receive: ether_type=%04X\n", ether_type);
|
||||
#endif
|
||||
switch (ether_type) {
|
||||
case ETH_P_ARP:
|
||||
printk("nasrg_COMMON_receive: ether_type = ETH_P_ARP\n");
|
||||
skb->protocol = htons(ETH_P_ARP);
|
||||
skb->network_header = &skb->mac_header[hard_header_len];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
|
||||
|
||||
if (addr) {
|
||||
printk("nasrg_COMMON_receive: Source %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
|
||||
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
|
||||
|
||||
if (addr) {
|
||||
printk("nasrg_COMMON_receive Dest %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
|
||||
printk("nasrg_COMMON_receive protocol %d\n",((struct iphdr *)&skb->data[hard_header_len])->protocol);
|
||||
#endif
|
||||
|
||||
skb->network_header = &skb->data[hard_header_len];
|
||||
// set protocol default value
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
// If type Ethernet, correct it
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
skb->protocol = eth_type_trans(skb, gdev);
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("nasrg_COMMON_receive: Packet is not IPv4 or IPv6 (version=%d)\n", ipv->version);
|
||||
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasrg_COMMON_receive: ether_type=%04X\n", ether_type);
|
||||
#endif
|
||||
skb->protocol = eth_type_trans(skb, gdev);
|
||||
// minus 1(short) instead of 2(bytes) because uint16_t*
|
||||
p_ether_type = (uint16_t *)&(skb->mac_header[hard_header_len-2]);
|
||||
ether_type = ntohs(*p_ether_type);
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasrg_COMMON_receive: ether_type=%04X\n", ether_type);
|
||||
#endif
|
||||
|
||||
switch (ether_type) {
|
||||
case ETH_P_ARP:
|
||||
printk("nasrg_COMMON_receive: ether_type = ETH_P_ARP\n");
|
||||
skb->protocol = htons(ETH_P_ARP);
|
||||
skb->network_header = &skb->mac_header[hard_header_len];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
++gpriv->stats.rx_packets;
|
||||
gpriv->stats.rx_bytes += bytes_read;
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasrg_COMMON_receive: forwarding packet of size %d to kernel\n",skb->len);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
netif_rx(skb);
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasrg_COMMON_receive: end\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Delete the data
|
||||
void nasrg_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
++gpriv->stats.tx_dropped;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Request the transfer of data (QoS SAP)
|
||||
void nasrg_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct pdcp_data_req_header_t pdcph;
|
||||
int bytes_wrote = 0;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("nasrg_COMMON_QOS_send - begin \n");
|
||||
#endif
|
||||
// if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
|
||||
// {
|
||||
// gpriv->stats.tx_dropped ++;
|
||||
// printk("NAS_QOS_SEND: No connected, so message are dropped \n");
|
||||
// return;
|
||||
// }
|
||||
if (!skb || !gc || !cx){
|
||||
printk("nasrg_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
|
||||
|
||||
// if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
|
||||
// {
|
||||
// gpriv->stats.tx_dropped ++;
|
||||
// printk("NAS_QOS_SEND: No connected, so message are dropped \n");
|
||||
// return;
|
||||
// }
|
||||
if (!skb || !gc || !cx) {
|
||||
printk("nasrg_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
if (gc->rb==NULL){
|
||||
// End debug information
|
||||
|
||||
if (gc->rb==NULL) {
|
||||
gc->rb=nasrg_COMMON_search_rb(cx, gc->rab_id);
|
||||
if (gc->rb==NULL){
|
||||
|
||||
if (gc->rb==NULL) {
|
||||
++gpriv->stats.tx_dropped;
|
||||
printk("nasrg_COMMON_QOS_send: No corresponding Radio Bearer, so message is dropped, rab_id=%u \n", gc->rab_id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("nasrg_COMMON_QOS_send #1 :");
|
||||
printk("lcr %u, rab_id %u, rab_id %u\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id);
|
||||
@@ -233,7 +257,7 @@ void nasrg_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct cla
|
||||
#endif
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
if (bytes_wrote != NAS_PDCPH_SIZE){
|
||||
if (bytes_wrote != NAS_PDCPH_SIZE) {
|
||||
printk("nasrg_COMMON_QOS_send: problem while writing PDCP's header\n");
|
||||
printk("PDCP rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
|
||||
gpriv->stats.tx_dropped ++;
|
||||
@@ -252,12 +276,13 @@ void nasrg_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct cla
|
||||
bytes_wrote += rtf_put(NAS2PDCP_FIFO, skb->data, skb->len);
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
if (bytes_wrote != skb->len+NAS_PDCPH_SIZE){
|
||||
if (bytes_wrote != skb->len+NAS_PDCPH_SIZE) {
|
||||
printk("nasrg_COMMON_QOS_send: problem while writing PDCP's data\n"); // congestion
|
||||
printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
|
||||
gpriv->stats.tx_dropped ++;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("nasrg_COMMON_QOS_send #3 :");
|
||||
printk(" %d bytes written to rb_id %d, sap %d \n", bytes_wrote, pdcph.rb_id, NAS2PDCP_FIFO);
|
||||
@@ -271,31 +296,34 @@ void nasrg_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct cla
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Request the transfer of data (QoS SAP)
|
||||
void nasrg_COMMON_QOS_send_test_netlink(struct sk_buff *skb){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_COMMON_QOS_send_test_netlink(struct sk_buff *skb)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct pdcp_data_req_header_t pdcph;
|
||||
int bytes_wrote = 0;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("nasrg_COMMON_QOS_send - begin \n");
|
||||
#endif
|
||||
// if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
|
||||
// {
|
||||
// gpriv->stats.tx_dropped ++;
|
||||
// printk("NAS_QOS_SEND: No connected, so message are dropped \n");
|
||||
// return;
|
||||
// }
|
||||
if (!skb ){
|
||||
printk("nasrg_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
|
||||
|
||||
// if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
|
||||
// {
|
||||
// gpriv->stats.tx_dropped ++;
|
||||
// printk("NAS_QOS_SEND: No connected, so message are dropped \n");
|
||||
// return;
|
||||
// }
|
||||
if (!skb ) {
|
||||
printk("nasrg_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("nasrg_COMMON_QOS_send #1 :");
|
||||
// printk("lcr %u, rab_id %u, rab_id %u\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id);
|
||||
// nasrg_TOOL_print_classifier(gc);
|
||||
// printk("lcr %u, rab_id %u, rab_id %u\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id);
|
||||
// nasrg_TOOL_print_classifier(gc);
|
||||
#endif
|
||||
pdcph.data_size = skb->len;
|
||||
//pdcph.rb_id = (gc->rb)->rab_id+(NAS_RB_MAX_NUM*cx->lcr);
|
||||
@@ -311,9 +339,9 @@ void nasrg_COMMON_QOS_send_test_netlink(struct sk_buff *skb){
|
||||
//printk("nasrg_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP fifo\n", bytes_wrote,skb->len);
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
if (bytes_wrote != NAS_PDCPH_SIZE){
|
||||
if (bytes_wrote != NAS_PDCPH_SIZE) {
|
||||
printk("nasrg_COMMON_QOS_send: problem while writing PDCP's header\n");
|
||||
// printk("PDCP rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
|
||||
// printk("PDCP rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
|
||||
gpriv->stats.tx_dropped ++;
|
||||
return;
|
||||
}
|
||||
@@ -330,12 +358,13 @@ void nasrg_COMMON_QOS_send_test_netlink(struct sk_buff *skb){
|
||||
bytes_wrote += rtf_put(NAS2PDCP_FIFO, skb->data, skb->len);
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
if (bytes_wrote != skb->len+NAS_PDCPH_SIZE){
|
||||
if (bytes_wrote != skb->len+NAS_PDCPH_SIZE) {
|
||||
printk("nasrg_COMMON_QOS_send: problem while writing PDCP's data\n"); // congestion
|
||||
// printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
|
||||
// printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
|
||||
gpriv->stats.tx_dropped ++;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("nasrg_COMMON_QOS_send #3 :");
|
||||
printk(" %d bytes wrote to rb_id %d, sap %d \n", bytes_wrote, pdcph.rb_id, NAS2PDCP_FIFO);
|
||||
@@ -349,72 +378,83 @@ void nasrg_COMMON_QOS_send_test_netlink(struct sk_buff *skb){
|
||||
|
||||
#ifndef NAS_NETLINK
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_COMMON_QOS_receive(struct cx_entity *cx){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_COMMON_QOS_receive(struct cx_entity *cx)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t sapi;
|
||||
struct pdcp_data_ind_header_t pdcph;
|
||||
int bytes_read = 0;
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasrg_COMMON_QOS_receive - begin \n");
|
||||
#endif
|
||||
if (!cx){
|
||||
printk("nasrg_COMMON_QOS_receive - input parameter cx is NULL \n");
|
||||
|
||||
if (!cx) {
|
||||
printk("nasrg_COMMON_QOS_receive - input parameter cx is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
|
||||
// LG force the use of only 1 rt fifo
|
||||
sapi = NAS_DRB_OUTPUT_SAPI;
|
||||
|
||||
bytes_read = rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
|
||||
while (bytes_read>0){
|
||||
if (bytes_read != NAS_PDCPH_SIZE){
|
||||
|
||||
while (bytes_read>0) {
|
||||
if (bytes_read != NAS_PDCPH_SIZE) {
|
||||
printk("nasrg_COMMON_QOS_receive: problem while reading PDCP header\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// data_buffer is NULL because FIFO should be read directly in the skbuff (LITE has an intermediary buffer)
|
||||
nasrg_COMMON_receive(NAS_PDCPH_SIZE, pdcph.data_size, NULL, pdcph->rb_id, gpriv->sap[sapi]);
|
||||
// check if another frame is in the FIFO, otherwise return
|
||||
bytes_read = rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasrg_COMMON_QOS_receive - end \n");
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_COMMON_QOS_receive(struct nlmsghdr *nlh){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_COMMON_QOS_receive(struct nlmsghdr *nlh)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
struct pdcp_data_ind_header_t *pdcph;
|
||||
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasrg_COMMON_QOS_receive - begin \n");
|
||||
#endif
|
||||
if (!nlh){
|
||||
printk("nasrg_COMMON_QOS_receive - input parameter nlh is NULL \n");
|
||||
#endif
|
||||
|
||||
if (!nlh) {
|
||||
printk("nasrg_COMMON_QOS_receive - input parameter nlh is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("nasrg_COMMON_QOS_receive - receive from PDCP, size %d, rab %d\\n", pdcph->data_size, pdcph->rb_id);
|
||||
#endif //NAS_DEBUG_RECEIVE
|
||||
|
||||
//void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
|
||||
nasrg_COMMON_receive(NAS_PDCPH_SIZE + pdcph->data_size, pdcph->data_size, (unsigned char *)NLMSG_DATA(nlh) + NAS_PDCPH_SIZE, pdcph->rb_id, 0);
|
||||
//void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
|
||||
nasrg_COMMON_receive(NAS_PDCPH_SIZE + pdcph->data_size, pdcph->data_size, (unsigned char *)NLMSG_DATA(nlh) + NAS_PDCPH_SIZE, pdcph->rb_id, 0);
|
||||
}
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct cx_entity *nasrg_COMMON_search_cx(nasLocalConnectionRef_t lcr){
|
||||
//---------------------------------------------------------------------------
|
||||
struct cx_entity *nasrg_COMMON_search_cx(nasLocalConnectionRef_t lcr)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasrg_COMMON_search_cx - lcr %d\n",lcr);
|
||||
#endif
|
||||
|
||||
if (lcr<NAS_CX_MAX)
|
||||
return gpriv->cx+lcr;
|
||||
else
|
||||
@@ -423,49 +463,55 @@ struct cx_entity *nasrg_COMMON_search_cx(nasLocalConnectionRef_t lcr){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Search a Radio Bearer
|
||||
struct rb_entity *nasrg_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id){
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *nasrg_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *rb;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasrg_COMMON_search_rb - rab_id %d\n", rab_id);
|
||||
#endif
|
||||
if (cx==NULL){
|
||||
printk("nasrg_COMMON_search_rb - input parameter cx is NULL \n");
|
||||
|
||||
if (cx==NULL) {
|
||||
printk("nasrg_COMMON_search_rb - input parameter cx is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
for (rb=cx->rb; rb!=NULL; rb=rb->next)
|
||||
{
|
||||
|
||||
for (rb=cx->rb; rb!=NULL; rb=rb->next) {
|
||||
if (rb->rab_id==rab_id)
|
||||
return rb;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *nasrg_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasQoSTrafficClass_t qos){
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *nasrg_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasQoSTrafficClass_t qos)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *rb;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasrg_COMMON_add_rb - begin for rab_id %d , qos %d\n", rab_id, qos );
|
||||
printk("nasrg_COMMON_add_rb - begin for rab_id %d , qos %d\n", rab_id, qos );
|
||||
#endif
|
||||
if (cx==NULL){
|
||||
printk("nasrg_COMMON_add_rb - input parameter cx is NULL \n");
|
||||
|
||||
if (cx==NULL) {
|
||||
printk("nasrg_COMMON_add_rb - input parameter cx is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rb=nasrg_COMMON_search_rb(cx, rab_id);
|
||||
if (rb==NULL)
|
||||
{
|
||||
|
||||
if (rb==NULL) {
|
||||
rb=(struct rb_entity *)kmalloc(sizeof(struct rb_entity), GFP_KERNEL);
|
||||
if (rb!=NULL)
|
||||
{
|
||||
|
||||
if (rb!=NULL) {
|
||||
rb->retry=0;
|
||||
rb->countimer=NAS_TIMER_IDLE;
|
||||
rb->rab_id=rab_id;
|
||||
// rb->rab_id=rab_id+(32*cx->lcr);
|
||||
#ifdef NAS_DEBUG_DC
|
||||
// rb->rab_id=rab_id+(32*cx->lcr);
|
||||
#ifdef NAS_DEBUG_DC
|
||||
printk("nasrg_COMMON_add_rb: rb rab_id=%u, rab_id=%u, mt_id=%u\n",rb->rab_id,rab_id, cx->lcr);
|
||||
#endif
|
||||
// rb->dscp = NASRG_TEMP_2NDRAB_DSCP; //TEMP
|
||||
#endif
|
||||
// rb->dscp = NASRG_TEMP_2NDRAB_DSCP; //TEMP
|
||||
rb->qos=qos;
|
||||
rb->sapi=NAS_DRB_INPUT_SAPI;
|
||||
// LG force the use of only one rt-fifo
|
||||
@@ -474,101 +520,115 @@ struct rb_entity *nasrg_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t r
|
||||
rb->next=cx->rb;
|
||||
cx->rb=rb;
|
||||
(cx->num_rb)++;
|
||||
}
|
||||
else
|
||||
} else
|
||||
printk("nasrg_COMMON_add_rb: no memory\n");
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasrg_COMMON_add_rb - end \n" );
|
||||
printk("nasrg_COMMON_add_rb - end \n" );
|
||||
#endif
|
||||
return rb;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// free the memory that has previously been allocated to rb and remove from linked list
|
||||
void nasrg_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *rb, *curr_rb, *prev_rb;
|
||||
struct classifier_entity *p;
|
||||
uint16_t classref=0;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasrg_COMMON_del_rb - begin\n");
|
||||
#endif
|
||||
if (cx==NULL){
|
||||
|
||||
if (cx==NULL) {
|
||||
printk("nasrg_COMMON_del_rb - input parameter cx is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// Clear the associated classifier
|
||||
for (p=cx->sclassifier[dscp]; p!=NULL; p=p->next){
|
||||
if (p->classref>=classref){
|
||||
// End debug information
|
||||
|
||||
// Clear the associated classifier
|
||||
for (p=cx->sclassifier[dscp]; p!=NULL; p=p->next) {
|
||||
if (p->classref>=classref) {
|
||||
classref=p->classref;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasrg_COMMON_del_rb: classifier found for dscp %u \n", dscp);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
nasrg_CLASS_del_sclassifier(cx, dscp, classref);
|
||||
|
||||
// Now, delete the RB
|
||||
// Now, delete the RB
|
||||
curr_rb = NULL;
|
||||
prev_rb = NULL;
|
||||
for (rb=cx->rb; rb!=NULL; rb=rb->next){
|
||||
if (rb->rab_id == rab_id){
|
||||
|
||||
for (rb=cx->rb; rb!=NULL; rb=rb->next) {
|
||||
if (rb->rab_id == rab_id) {
|
||||
curr_rb = rb;
|
||||
if (prev_rb!=NULL){
|
||||
|
||||
if (prev_rb!=NULL) {
|
||||
prev_rb->next = rb->next;
|
||||
}else{
|
||||
} else {
|
||||
cx->rb=rb->next;
|
||||
}
|
||||
|
||||
break;
|
||||
}else{
|
||||
} else {
|
||||
prev_rb = rb;
|
||||
}
|
||||
}
|
||||
if (curr_rb!= NULL){
|
||||
|
||||
if (curr_rb!= NULL) {
|
||||
printk("nasrg_COMMON_del_rb: del rab_id %u\n", rb->rab_id);
|
||||
kfree(rb);
|
||||
(cx->num_rb)--;
|
||||
}else{
|
||||
} else {
|
||||
printk("\n\n--nasrg_COMMON_del_rb: ERROR, invalid rab_id %u\n", rb->rab_id);
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasrg_COMMON_del_rb - end\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_COMMON_flush_rb(struct cx_entity *cx){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_COMMON_flush_rb(struct cx_entity *cx)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *rb;
|
||||
struct classifier_entity *gc;
|
||||
uint8_t dscp;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasrg_COMMON_flush_rb - begin\n");
|
||||
#endif
|
||||
if (cx==NULL){
|
||||
printk("nasrg_COMMON_flush_rb - input parameter cx is NULL \n");
|
||||
|
||||
if (cx==NULL) {
|
||||
printk("nasrg_COMMON_flush_rb - input parameter cx is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
for (rb=cx->rb; rb!=NULL; rb=cx->rb){
|
||||
|
||||
// End debug information
|
||||
for (rb=cx->rb; rb!=NULL; rb=cx->rb) {
|
||||
printk("nasrg_COMMON_flush_rb: del rab_id %u\n", rb->rab_id);
|
||||
cx->rb=rb->next;
|
||||
kfree(rb);
|
||||
}
|
||||
|
||||
cx->num_rb=0;
|
||||
cx->rb=NULL;
|
||||
for(dscp=0; dscp<NAS_DSCP_MAX; ++dscp)
|
||||
{
|
||||
|
||||
for(dscp=0; dscp<NAS_DSCP_MAX; ++dscp) {
|
||||
for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next)
|
||||
gc->rb=NULL;
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("nasrg_COMMON_flush_rb - end\n");
|
||||
#endif
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
//#define NAS_DEBUG_INTERRUPT
|
||||
//#define NAS_DEBUG_TOOL
|
||||
//#define NAS_DEBUG_MBMS_PROT //Only one RT-FIFO is used
|
||||
#define NETLINK_DEBUG
|
||||
#define NETLINK_DEBUG
|
||||
#define NAS_DEBUG_RRCNL // RRC netlink socket
|
||||
|
||||
// Other flags
|
||||
@@ -144,32 +144,32 @@
|
||||
#define NAS_IPV4_SIZE 20
|
||||
#define NAS_IPV6_SIZE 40
|
||||
|
||||
#define NAS_DIRECTION_SEND 0
|
||||
#define NAS_DIRECTION_RECEIVE 1
|
||||
#define NAS_DIRECTION_SEND 0
|
||||
#define NAS_DIRECTION_RECEIVE 1
|
||||
|
||||
// function number
|
||||
#define NAS_FCT_DEL_SEND 1
|
||||
#define NAS_FCT_QOS_SEND 2
|
||||
#define NAS_FCT_DC_SEND 3
|
||||
#define NAS_FCT_CTL_SEND 4
|
||||
#define NAS_FCT_DEL_SEND 1
|
||||
#define NAS_FCT_QOS_SEND 2
|
||||
#define NAS_FCT_DC_SEND 3
|
||||
#define NAS_FCT_CTL_SEND 4
|
||||
|
||||
// type of IOCTL command
|
||||
#define NASRG_IOCTL_RAL 0x89F0
|
||||
|
||||
// Error cause
|
||||
#define NAS_ERROR_ALREADYEXIST 1
|
||||
#define NAS_ERROR_NOMEMORY 3
|
||||
#define NAS_ERROR_NOTMT 9
|
||||
#define NAS_ERROR_NOTRG 10
|
||||
#define NAS_ERROR_NOTIDLE 11
|
||||
#define NAS_ERROR_NOTCONNECTED 12
|
||||
#define NAS_ERROR_NORB 14
|
||||
#define NAS_ERROR_NOTCORRECTVALUE 32
|
||||
#define NAS_ERROR_NOTCORRECTLCR 33
|
||||
#define NAS_ERROR_NOTCORRECTDIR 34
|
||||
#define NAS_ERROR_NOTCORRECTDSCP 35
|
||||
#define NAS_ERROR_NOTCORRECTVERSION 36
|
||||
#define NAS_ERROR_NOTCORRECTRABI 37
|
||||
#define NAS_ERROR_ALREADYEXIST 1
|
||||
#define NAS_ERROR_NOMEMORY 3
|
||||
#define NAS_ERROR_NOTMT 9
|
||||
#define NAS_ERROR_NOTRG 10
|
||||
#define NAS_ERROR_NOTIDLE 11
|
||||
#define NAS_ERROR_NOTCONNECTED 12
|
||||
#define NAS_ERROR_NORB 14
|
||||
#define NAS_ERROR_NOTCORRECTVALUE 32
|
||||
#define NAS_ERROR_NOTCORRECTLCR 33
|
||||
#define NAS_ERROR_NOTCORRECTDIR 34
|
||||
#define NAS_ERROR_NOTCORRECTDSCP 35
|
||||
#define NAS_ERROR_NOTCORRECTVERSION 36
|
||||
#define NAS_ERROR_NOTCORRECTRABI 37
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
@@ -204,12 +204,12 @@
|
||||
#define NAS_PROTOCOL_ICMP4 IPPROTO_ICMP
|
||||
#define NAS_PROTOCOL_ICMP6 IPPROTO_ICMPV6
|
||||
|
||||
#define NAS_PORT_DEFAULT __constant_htons(65535)
|
||||
#define NAS_PORT_HTTP __constant_htons(80)
|
||||
#define NAS_PORT_DEFAULT __constant_htons(65535)
|
||||
#define NAS_PORT_HTTP __constant_htons(80)
|
||||
|
||||
#define NAS_VERSION_DEFAULT 0
|
||||
#define NAS_VERSION_4 4
|
||||
#define NAS_VERSION_6 6 //?MW
|
||||
#define NAS_VERSION_DEFAULT 0
|
||||
#define NAS_VERSION_4 4
|
||||
#define NAS_VERSION_6 6 //?MW
|
||||
|
||||
/**********************************************************/
|
||||
/* Constants related with Netlink sockets */
|
||||
|
||||
@@ -70,8 +70,8 @@ struct net_device *gdev;
|
||||
struct nas_priv *gpriv;
|
||||
//int bytes_wrote;
|
||||
//int bytes_read;
|
||||
uint8_t NAS_RG_IMEI[14]={0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x01};
|
||||
uint8_t NAS_NULL_IMEI[14]={0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00};
|
||||
uint8_t NAS_RG_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x01};
|
||||
uint8_t NAS_NULL_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00};
|
||||
|
||||
uint16_t local_rg_cell_id;
|
||||
|
||||
@@ -83,39 +83,46 @@ extern void nasrg_ASCTL_timer(unsigned long data);
|
||||
|
||||
#ifndef NAS_NETLINK
|
||||
//---------------------------------------------------------------------------
|
||||
void *nasrg_interrupt(void){
|
||||
//---------------------------------------------------------------------------
|
||||
void *nasrg_interrupt(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t cxi;
|
||||
#ifdef NAS_DEBUG_INTERRUPT
|
||||
printk("nasrg_interrupt - begin\n");
|
||||
#endif
|
||||
|
||||
//spin_lock(&gpriv->lock);
|
||||
for (cxi=0;cxi<NAS_CX_MAX;++cxi)
|
||||
for (cxi=0; cxi<NAS_CX_MAX; ++cxi)
|
||||
nasrg_COMMON_QOS_receive(gpriv->cx+cxi);
|
||||
for (cxi=0;cxi<NAS_CX_MAX;++cxi)
|
||||
|
||||
for (cxi=0; cxi<NAS_CX_MAX; ++cxi)
|
||||
nasrg_ASCTL_DC_receive(gpriv->cx+cxi);
|
||||
|
||||
//spin_unlock(&gpriv->lock);
|
||||
#ifdef NAS_DEBUG_INTERRUPT
|
||||
printk("nasrg_interrupt: end\n");
|
||||
#endif
|
||||
// return 0;
|
||||
// return 0;
|
||||
}
|
||||
#endif //NETLINK
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Called by ifconfig when the device is activated by ifconfig
|
||||
int nasrg_open(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_open(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasrg_open: begin\n");
|
||||
|
||||
gpriv=netdev_priv(dev);
|
||||
|
||||
// Address has already been set at init
|
||||
#ifndef NAS_NETLINK
|
||||
if (gpriv->irq==-EBUSY){
|
||||
|
||||
if (gpriv->irq==-EBUSY) {
|
||||
printk("nasrg_open: irq failure\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
#endif //NETLINK
|
||||
|
||||
if(!netif_queue_stopped(dev))
|
||||
@@ -123,21 +130,22 @@ int nasrg_open(struct net_device *dev){
|
||||
else
|
||||
netif_wake_queue(dev);
|
||||
|
||||
//
|
||||
//
|
||||
init_timer(&gpriv->timer);
|
||||
(gpriv->timer).expires=jiffies+NAS_TIMER_TICK;
|
||||
(gpriv->timer).data=0L;
|
||||
(gpriv->timer).function=nasrg_ASCTL_timer;
|
||||
add_timer(&gpriv->timer);
|
||||
//
|
||||
//
|
||||
printk("nasrg_open: name = %s, end\n", dev->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Called by ifconfig when the device is desactivated by ifconfig
|
||||
int nasrg_stop(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_stop(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_priv *priv = netdev_priv(dev);
|
||||
printk("nasrg_stop: begin\n");
|
||||
del_timer(&priv->timer);
|
||||
@@ -148,32 +156,36 @@ int nasrg_stop(struct net_device *dev){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_teardown(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_teardown(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
int cxi;
|
||||
#ifndef NAS_NETLINK
|
||||
#ifndef NAS_NETLINK
|
||||
struct nas_priv *priv = netdev_priv(dev);
|
||||
#endif //NAS_NETLINK
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
printk("nasrg_teardown: begin\n");
|
||||
|
||||
if (dev) {
|
||||
#ifndef NAS_NETLINK
|
||||
if (priv->irq!=-EBUSY){
|
||||
*pt_nas_rg_irq=-1;
|
||||
rt_free_srq(priv->irq);
|
||||
#ifndef NAS_NETLINK
|
||||
|
||||
if (priv->irq!=-EBUSY) {
|
||||
*pt_nas_rg_irq=-1;
|
||||
rt_free_srq(priv->irq);
|
||||
}
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
#ifdef NAS_NETLINK
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
#ifdef NAS_NETLINK
|
||||
nasrg_netlink_release();
|
||||
#endif //NAS_NETLINK
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
// for (sapi=0; sapi<NAS_SAPI_MAX; ++sapi)
|
||||
// close(priv->sap[sapi]);
|
||||
// for (sapi=0; sapi<NAS_SAPI_MAX; ++sapi)
|
||||
// close(priv->sap[sapi]);
|
||||
nasrg_CLASS_flush_rclassifier();
|
||||
nasrg_CLASS_flush_mbmsclassifier();
|
||||
for (cxi=0;cxi<NAS_CX_MAX;++cxi){
|
||||
|
||||
for (cxi=0; cxi<NAS_CX_MAX; ++cxi) {
|
||||
nasrg_COMMON_flush_rb(gpriv->cx+cxi);
|
||||
nasrg_CLASS_flush_sclassifier(gpriv->cx+cxi);
|
||||
//for (sapi=0; sapi<NAS_SAPI_CX_MAX; ++sapi)
|
||||
@@ -181,40 +193,47 @@ void nasrg_teardown(struct net_device *dev){
|
||||
}
|
||||
} // check dev
|
||||
else {
|
||||
printk("nasmt_teardown: Device is null\n");
|
||||
printk("nasmt_teardown: Device is null\n");
|
||||
}
|
||||
|
||||
printk("nasrg_teardown: end\n");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_set_config(struct net_device *dev, struct ifmap *map){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_set_config(struct net_device *dev, struct ifmap *map)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasrg_set_config: begin\n");
|
||||
|
||||
if (dev->flags & IFF_UP)
|
||||
return -EBUSY;
|
||||
if (map->base_addr != dev->base_addr)
|
||||
{
|
||||
|
||||
if (map->base_addr != dev->base_addr) {
|
||||
printk(KERN_WARNING "nasrg_set_config: Can't change I/O address\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (map->irq != dev->irq)
|
||||
dev->irq = map->irq;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
int nasrg_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_DEVICE
|
||||
printk("nasrg_hard_start_xmit: begin\n");
|
||||
#endif
|
||||
if ((!skb )||(!dev)){
|
||||
printk("nasrg_hard_start_xmit - input parameter skb or dev is NULL \n");
|
||||
|
||||
if ((!skb )||(!dev)) {
|
||||
printk("nasrg_hard_start_xmit - input parameter skb or dev is NULL \n");
|
||||
return -1;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
netif_stop_queue(dev);
|
||||
dev->trans_start = jiffies;
|
||||
#ifdef NAS_DEBUG_SEND_DETAIL
|
||||
@@ -224,7 +243,7 @@ int nasrg_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
|
||||
#ifdef NAS_DEBUG_SEND_DETAIL
|
||||
printk("nasrg_hard_start_xmit: step 2\n");
|
||||
#endif
|
||||
dev_kfree_skb(skb);
|
||||
dev_kfree_skb(skb);
|
||||
#ifdef NAS_DEBUG_SEND_DETAIL
|
||||
printk("nasrg_hard_start_xmit: step 3\n");
|
||||
#endif
|
||||
@@ -236,16 +255,18 @@ int nasrg_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct net_device_stats *nasrg_get_stats(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
struct net_device_stats *nasrg_get_stats(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_priv *npriv = netdev_priv(dev);
|
||||
return &npriv->stats;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// New function from LITE DRIVER
|
||||
int nasrg_set_mac_address(struct net_device *dev, void *mac) {
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_set_mac_address(struct net_device *dev, void *mac)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct sockaddr *addr = mac;
|
||||
printk("nasrg_set_mac_address: begin\n");
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
@@ -253,18 +274,22 @@ int nasrg_set_mac_address(struct net_device *dev, void *mac) {
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_change_mtu(struct net_device *dev, int mtu){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_change_mtu(struct net_device *dev, int mtu)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasrg_change_mtu: begin\n");
|
||||
|
||||
if ((mtu<50) || (mtu>1500))
|
||||
// if ((mtu<1280) || (mtu>1500))
|
||||
// if ((mtu<1280) || (mtu>1500))
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_change_rx_flags(struct net_device *dev, int flags){
|
||||
int nasrg_change_rx_flags(struct net_device *dev, int flags)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
//struct nas_priv *priv = netdev_priv(dev);
|
||||
printk("nasrg_change_rx_flags %08X\n", flags);
|
||||
@@ -273,11 +298,12 @@ int nasrg_change_rx_flags(struct net_device *dev, int flags){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_tx_timeout(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_tx_timeout(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
/* Transmitter timeout, serious problems. */
|
||||
printk("nasrg_tx_timeout: begin\n");
|
||||
// ((struct nas_priv *)(dev->priv))->stats.tx_errors++;
|
||||
// ((struct nas_priv *)(dev->priv))->stats.tx_errors++;
|
||||
(gpriv->stats).tx_errors++;
|
||||
dev->trans_start = jiffies;
|
||||
netif_wake_queue(dev);
|
||||
@@ -287,35 +313,36 @@ void nasrg_tx_timeout(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
// Define pointers for the module
|
||||
static const struct net_device_ops nasrg_netdev_ops = {
|
||||
// ?? nasrg_ interrupt
|
||||
//
|
||||
// ?? nasrg_ interrupt
|
||||
//
|
||||
.ndo_open = nasrg_open,
|
||||
.ndo_stop = nasrg_stop,
|
||||
.ndo_start_xmit = nasrg_hard_start_xmit,
|
||||
.ndo_validate_addr = NULL,
|
||||
.ndo_get_stats = nasrg_get_stats,
|
||||
//#ifdef KERNEL_VERSION_GREATER_THAN_32
|
||||
// .ndo_set_multicast_list = NULL,
|
||||
//#ifdef KERNEL_VERSION_GREATER_THAN_32
|
||||
// .ndo_set_multicast_list = NULL,
|
||||
.ndo_set_mac_address = nasrg_set_mac_address,
|
||||
.ndo_set_config = nasrg_set_config,
|
||||
.ndo_do_ioctl = nasrg_CTL_ioctl,
|
||||
.ndo_change_mtu = nasrg_change_mtu,
|
||||
.ndo_tx_timeout = nasrg_tx_timeout,
|
||||
.ndo_change_rx_flags = nasrg_change_rx_flags,
|
||||
//#endif
|
||||
//#endif
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Initialisation of the network device
|
||||
void nasrg_init(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_init(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t cxi, dscpi;
|
||||
|
||||
printk("nasrg_init: begin\n");
|
||||
|
||||
if (dev){
|
||||
if (dev) {
|
||||
gpriv=netdev_priv(dev);
|
||||
|
||||
memset(gpriv, 0, sizeof(struct nas_priv));
|
||||
@@ -323,13 +350,13 @@ void nasrg_init(struct net_device *dev){
|
||||
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;
|
||||
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 {
|
||||
@@ -346,8 +373,8 @@ void nasrg_init(struct net_device *dev){
|
||||
printk("\nnasrg_init: WARNING Driver type ETHERNET\n");
|
||||
ether_setup(dev);
|
||||
#endif
|
||||
//
|
||||
// Initialize private structure
|
||||
//
|
||||
// Initialize private structure
|
||||
gpriv->rx_flags = NAS_RESET_RX_FLAGS;
|
||||
|
||||
gpriv->sap[NAS_GC_SAPI] = RRC_DEVICE_GC;
|
||||
@@ -356,19 +383,22 @@ void nasrg_init(struct net_device *dev){
|
||||
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_CO_INPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_INPUT;
|
||||
// gpriv->sap[NAS_CO_OUTPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_OUTPUT;
|
||||
gpriv->sap[NAS_DRB_INPUT_SAPI] = PDCP2NAS_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){
|
||||
|
||||
//
|
||||
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
|
||||
@@ -378,29 +408,34 @@ void nasrg_init(struct net_device *dev){
|
||||
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{
|
||||
} else {
|
||||
printk("\n\nnasmt_init: ERROR, Device is NULL!!\n");
|
||||
}
|
||||
|
||||
printk("nasrg_init: end\n");
|
||||
return ;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int init_module (void) {
|
||||
//---------------------------------------------------------------------------
|
||||
int init_module (void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
int err;
|
||||
int inst = 0;
|
||||
struct nas_priv *priv;
|
||||
@@ -408,30 +443,32 @@ int init_module (void) {
|
||||
|
||||
printk("\n\n\n\nnasrg_init_module: begin \n");
|
||||
|
||||
// Initialize parameters shared with RRC
|
||||
#ifndef NAS_NETLINK
|
||||
if (pt_nas_rg_irq==NULL){
|
||||
// Initialize parameters shared with RRC
|
||||
#ifndef NAS_NETLINK
|
||||
|
||||
if (pt_nas_rg_irq==NULL) {
|
||||
printk("nasrg_init_module: shared irq parameter not initialised\n");
|
||||
err = -EBUSY;
|
||||
printk("nasrg_init_module: returning %d \n\n", err);
|
||||
return err;
|
||||
}
|
||||
printk("nasrg_init_module: pt_nas_rg_irq valid \n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
if (pt_rg_own_cell_id==NULL){
|
||||
printk("nasrg_init_module: shared cell_id parameter not initialised\n");
|
||||
err = -EBUSY;
|
||||
printk("nasrg_init_module: returning %d \n\n\n", err);
|
||||
return err;
|
||||
}
|
||||
printk("nasrg_init_module: pt_rg_own_cell_id valid \n");
|
||||
*pt_rg_own_cell_id = NASRG_OWN_CELLID;
|
||||
*/
|
||||
printk("nasrg_init_module: pt_nas_rg_irq valid \n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
if (pt_rg_own_cell_id==NULL){
|
||||
printk("nasrg_init_module: shared cell_id parameter not initialised\n");
|
||||
err = -EBUSY;
|
||||
printk("nasrg_init_module: returning %d \n\n\n", err);
|
||||
return err;
|
||||
}
|
||||
printk("nasrg_init_module: pt_rg_own_cell_id valid \n");
|
||||
*pt_rg_own_cell_id = NASRG_OWN_CELLID;
|
||||
*/
|
||||
local_rg_cell_id = NASRG_OWN_CELLID;
|
||||
|
||||
// Allocate device structure
|
||||
// Allocate device structure
|
||||
sprintf(devicename,"oai%d",inst);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
|
||||
gdev = alloc_netdev(sizeof(struct nas_priv), devicename, nasrg_init);
|
||||
@@ -440,47 +477,55 @@ int init_module (void) {
|
||||
#endif
|
||||
printk("nasrg_init_module: after alloc_netdev \n");
|
||||
priv = netdev_priv(gdev);
|
||||
////
|
||||
//
|
||||
#ifndef NAS_NETLINK
|
||||
////
|
||||
//
|
||||
#ifndef NAS_NETLINK
|
||||
priv->irq=rt_request_srq(0, nasrg_interrupt, NULL);
|
||||
if (priv->irq == -EBUSY || priv->irq == -EINVAL){
|
||||
|
||||
if (priv->irq == -EBUSY || priv->irq == -EINVAL) {
|
||||
printk("nasrg_init_module: No interrupt resource available\n");
|
||||
if (gdev){
|
||||
free_netdev(gdev);
|
||||
printk("nasrg_init_module: free_netdev ..\n");
|
||||
|
||||
if (gdev) {
|
||||
free_netdev(gdev);
|
||||
printk("nasrg_init_module: free_netdev ..\n");
|
||||
}
|
||||
|
||||
return -EBUSY;
|
||||
}else
|
||||
} else
|
||||
printk("nasrg_init_module: Interrupt %d, ret = %d \n", priv->irq , ret);
|
||||
|
||||
if (pt_nas_rg_irq==NULL){
|
||||
if (pt_nas_rg_irq==NULL) {
|
||||
printk("nasmt_init_module: shared irq parameter has been reset\n");
|
||||
}else{
|
||||
} else {
|
||||
*pt_nas_rg_irq=priv->irq;
|
||||
}
|
||||
#endif
|
||||
//
|
||||
//////
|
||||
#ifdef NAS_NETLINK
|
||||
|
||||
#endif
|
||||
//
|
||||
//////
|
||||
#ifdef NAS_NETLINK
|
||||
|
||||
if ((err=nasrg_netlink_init()) < 0)
|
||||
printk("nasrg_init_module: NETLINK failed\n");
|
||||
|
||||
printk("nasrg_init_module: NETLINK INIT successful\n");
|
||||
#endif //NETLINK
|
||||
#endif //NETLINK
|
||||
|
||||
err= register_netdev(gdev);
|
||||
|
||||
if (err){
|
||||
if (err) {
|
||||
printk("nasrg_init_module: error %i registering device %s\n", err, gdev->name);
|
||||
}else{
|
||||
} else {
|
||||
printk("nasrg_init_module: registering device %s, ifindex = %d\n\n",gdev->name, gdev->ifindex);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void cleanup_module(void){
|
||||
//---------------------------------------------------------------------------
|
||||
void cleanup_module(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasrg_cleanup_module: begin\n");
|
||||
unregister_netdev(gdev);
|
||||
nasrg_teardown(gdev);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -84,81 +84,70 @@
|
||||
|
||||
typedef uint16_t nasMsgType_t;
|
||||
|
||||
struct nas_ioctl
|
||||
{
|
||||
char name[IFNAMSIZ];
|
||||
nasMsgType_t type;
|
||||
char *msg;
|
||||
struct nas_ioctl {
|
||||
char name[IFNAMSIZ];
|
||||
nasMsgType_t type;
|
||||
char *msg;
|
||||
};
|
||||
|
||||
//****
|
||||
struct nas_msg_statistic_reply
|
||||
{
|
||||
uint32_t rx_packets;
|
||||
uint32_t tx_packets;
|
||||
uint32_t rx_bytes;
|
||||
uint32_t tx_bytes;
|
||||
uint32_t rx_errors;
|
||||
uint32_t tx_errors;
|
||||
uint32_t rx_dropped;
|
||||
uint32_t tx_dropped;
|
||||
struct nas_msg_statistic_reply {
|
||||
uint32_t rx_packets;
|
||||
uint32_t tx_packets;
|
||||
uint32_t rx_bytes;
|
||||
uint32_t tx_bytes;
|
||||
uint32_t rx_errors;
|
||||
uint32_t tx_errors;
|
||||
uint32_t rx_dropped;
|
||||
uint32_t tx_dropped;
|
||||
};
|
||||
|
||||
//****
|
||||
struct nas_msg_cx_list_reply
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
uint8_t state;
|
||||
nasCellID_t cellid; // cell identification
|
||||
uint32_t iid6[2]; // IPv6 interface identification
|
||||
uint8_t iid4; // IPv4 interface identification
|
||||
uint16_t num_rb;
|
||||
uint16_t nsclassifier;
|
||||
struct nas_msg_cx_list_reply {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
uint8_t state;
|
||||
nasCellID_t cellid; // cell identification
|
||||
uint32_t iid6[2]; // IPv6 interface identification
|
||||
uint8_t iid4; // IPv4 interface identification
|
||||
uint16_t num_rb;
|
||||
uint16_t nsclassifier;
|
||||
};
|
||||
//****
|
||||
struct nas_msg_cx_establishment_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_cx_establishment_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_cx_establishment_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasCellID_t cellid; // Cell identification
|
||||
struct nas_msg_cx_establishment_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasCellID_t cellid; // Cell identification
|
||||
};
|
||||
//****
|
||||
struct nas_msg_cx_release_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_cx_release_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_cx_release_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
struct nas_msg_cx_release_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
};
|
||||
|
||||
//****
|
||||
struct nas_msg_rb_list_reply
|
||||
{
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasSapId_t sapi;
|
||||
nasQoSTrafficClass_t qos;
|
||||
uint8_t state;
|
||||
struct nas_msg_rb_list_reply {
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasSapId_t sapi;
|
||||
nasQoSTrafficClass_t qos;
|
||||
uint8_t state;
|
||||
uint32_t cnxid;
|
||||
};
|
||||
struct nas_msg_rb_list_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
struct nas_msg_rb_list_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
};
|
||||
//****
|
||||
struct nas_msg_rb_establishment_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_rb_establishment_reply {
|
||||
int status;
|
||||
uint32_t cnxid;
|
||||
};
|
||||
struct nas_msg_rb_establishment_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasQoSTrafficClass_t qos;
|
||||
struct nas_msg_rb_establishment_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasQoSTrafficClass_t qos;
|
||||
uint16_t dscp_ul;
|
||||
uint16_t dscp_dl;
|
||||
uint16_t mcast_flag;
|
||||
@@ -167,95 +156,82 @@ struct nas_msg_rb_establishment_request
|
||||
};
|
||||
|
||||
//****
|
||||
struct nas_msg_rb_release_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_rb_release_reply {
|
||||
int status;
|
||||
uint32_t cnxid;
|
||||
};
|
||||
struct nas_msg_rb_release_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
struct nas_msg_rb_release_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
uint16_t mcast_flag;
|
||||
uint32_t cnxid;
|
||||
};
|
||||
|
||||
//****
|
||||
struct nas_msg_class_add_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
uint8_t dir; // direction (send or receive)
|
||||
uint8_t dscp; // codepoint
|
||||
uint8_t fct;
|
||||
uint16_t classref;
|
||||
uint8_t version;
|
||||
union
|
||||
{
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
} saddr; // IP source address
|
||||
uint8_t splen; // prefix length
|
||||
union
|
||||
{
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
} daddr; // IP destination address
|
||||
uint8_t dplen; // prefix length
|
||||
uint8_t protocol; // high layer protocol type
|
||||
uint16_t sport; // source port
|
||||
uint16_t dport; // destination port
|
||||
struct nas_msg_class_add_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
uint8_t dir; // direction (send or receive)
|
||||
uint8_t dscp; // codepoint
|
||||
uint8_t fct;
|
||||
uint16_t classref;
|
||||
uint8_t version;
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
} saddr; // IP source address
|
||||
uint8_t splen; // prefix length
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
} daddr; // IP destination address
|
||||
uint8_t dplen; // prefix length
|
||||
uint8_t protocol; // high layer protocol type
|
||||
uint16_t sport; // source port
|
||||
uint16_t dport; // destination port
|
||||
};
|
||||
struct nas_msg_class_add_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_class_add_reply {
|
||||
int status;
|
||||
};
|
||||
//****
|
||||
struct nas_msg_class_del_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
uint8_t dir; // direction (send or receive)
|
||||
uint8_t dscp; // codepoint
|
||||
uint16_t classref;
|
||||
struct nas_msg_class_del_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
uint8_t dir; // direction (send or receive)
|
||||
uint8_t dscp; // codepoint
|
||||
uint16_t classref;
|
||||
};
|
||||
struct nas_msg_class_del_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_class_del_reply {
|
||||
int status;
|
||||
};
|
||||
//****
|
||||
#define nas_msg_class_list_reply nas_msg_class_add_request
|
||||
struct nas_msg_class_list_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
uint8_t dir;
|
||||
uint8_t dscp;
|
||||
struct nas_msg_class_list_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
uint8_t dir;
|
||||
uint8_t dscp;
|
||||
};
|
||||
|
||||
//****
|
||||
struct nas_msg_neighbour_cell_list_reply
|
||||
{
|
||||
nasCellID_t cellid; // cell identification
|
||||
uint32_t iid6[4]; // IPv6 address of access router
|
||||
struct nas_msg_neighbour_cell_list_reply {
|
||||
nasCellID_t cellid; // cell identification
|
||||
uint32_t iid6[4]; // IPv6 address of access router
|
||||
};
|
||||
|
||||
//MBMS
|
||||
//****
|
||||
struct nas_msg_mt_mcast_join
|
||||
{
|
||||
nasLocalConnectionRef_t ue_id;
|
||||
uint32_t cnxid;
|
||||
nasRadioBearerId_t rab_id;
|
||||
};
|
||||
|
||||
struct nas_msg_mt_mcast_leave
|
||||
{
|
||||
struct nas_msg_mt_mcast_join {
|
||||
nasLocalConnectionRef_t ue_id;
|
||||
uint32_t cnxid;
|
||||
nasRadioBearerId_t rab_id;
|
||||
};
|
||||
|
||||
struct nas_msg_mt_mcast_reply
|
||||
{
|
||||
struct nas_msg_mt_mcast_leave {
|
||||
nasLocalConnectionRef_t ue_id;
|
||||
uint32_t cnxid;
|
||||
nasRadioBearerId_t rab_id;
|
||||
};
|
||||
|
||||
struct nas_msg_mt_mcast_reply {
|
||||
nasLocalConnectionRef_t ue_id;
|
||||
uint32_t cnxid;
|
||||
int result;
|
||||
@@ -264,17 +240,14 @@ struct nas_msg_mt_mcast_reply
|
||||
|
||||
//MEDIEVAL DEMO 3
|
||||
//****
|
||||
struct nas_msg_enb_measure_trigger
|
||||
{
|
||||
struct nas_msg_enb_measure_trigger {
|
||||
nasCellID_t cell_id;
|
||||
};
|
||||
struct nas_msg_enb_measure_trigger_reply
|
||||
{
|
||||
struct nas_msg_enb_measure_trigger_reply {
|
||||
int status;
|
||||
};
|
||||
|
||||
struct nas_msg_enb_measure_retrieve
|
||||
{
|
||||
struct nas_msg_enb_measure_retrieve {
|
||||
nasCellID_t cell_id;
|
||||
nasNumConnUEs_t num_UEs;
|
||||
nasENbMeasures_t measures[MAX_MEASURE_UE];
|
||||
|
||||
@@ -56,19 +56,22 @@ static DEFINE_MUTEX(nasrg_mutex);
|
||||
// This can also be implemented using thread to get the data from PDCP without blocking.
|
||||
//---------------------------------------------------------------------------
|
||||
// Function for transfer with PDCP (from NASLITE)
|
||||
static void nasrg_nl_data_ready (struct sk_buff *skb){
|
||||
//---------------------------------------------------------------------------
|
||||
static void nasrg_nl_data_ready (struct sk_buff *skb)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nlmsghdr *nlh = NULL;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("nasrg_nl_data_ready - begin \n");
|
||||
#endif
|
||||
if (!skb){
|
||||
printk("nasrg_nl_data_ready - input parameter skb is NULL \n");
|
||||
|
||||
if (!skb) {
|
||||
printk("nasrg_nl_data_ready - input parameter skb is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("nasrg_nl_data_ready - Received socket from PDCP\n");
|
||||
@@ -79,21 +82,24 @@ static void nasrg_nl_data_ready (struct sk_buff *skb){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Function for transfer with RRC
|
||||
static void nasrg_rrcnl_data_ready (struct sk_buff *skb){
|
||||
//---------------------------------------------------------------------------
|
||||
static void nasrg_rrcnl_data_ready (struct sk_buff *skb)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nlmsghdr *nlh = NULL;
|
||||
char target_sap;
|
||||
uint8_t cxi;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_RRCNL
|
||||
printk("nasrg_rrcnl_data_ready - begin \n");
|
||||
#endif
|
||||
if (!skb){
|
||||
printk("nasrg_rrcnl_data_ready - input parameter skb is NULL \n");
|
||||
|
||||
if (!skb) {
|
||||
printk("nasrg_rrcnl_data_ready - input parameter skb is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
|
||||
nlh = (struct nlmsghdr *)skb->data;
|
||||
//pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
|
||||
@@ -104,36 +110,41 @@ static void nasrg_rrcnl_data_ready (struct sk_buff *skb){
|
||||
printk("nasrg_rrcnl_data_ready - Received on socket from RRC, SAP %d\n", target_sap);
|
||||
#endif //NAS_DEBUG_RRCNL
|
||||
|
||||
switch (target_sap){
|
||||
case RRC_NAS_DC0_OUT:
|
||||
//printk("nasrg_rrcnl_data_ready - Calling nasrg_ASCTL_DC_receive\n");
|
||||
cxi = 0;
|
||||
nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
|
||||
break;
|
||||
case RRC_NAS_DC1_OUT:
|
||||
//printk("nasrg_rrcnl_data_ready - Calling nasrg_ASCTL_DC_receive\n");
|
||||
cxi = 1;
|
||||
nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
|
||||
break;
|
||||
case RRC_NAS_DC2_OUT:
|
||||
//printk("nasrg_rrcnl_data_ready - Calling nasrg_ASCTL_DC_receive\n");
|
||||
cxi = 2;
|
||||
nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
|
||||
break;
|
||||
default:
|
||||
printk("nasrg_rrcnl_data_ready - Invalid SAP value received\n");
|
||||
switch (target_sap) {
|
||||
case RRC_NAS_DC0_OUT:
|
||||
//printk("nasrg_rrcnl_data_ready - Calling nasrg_ASCTL_DC_receive\n");
|
||||
cxi = 0;
|
||||
nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
|
||||
break;
|
||||
|
||||
case RRC_NAS_DC1_OUT:
|
||||
//printk("nasrg_rrcnl_data_ready - Calling nasrg_ASCTL_DC_receive\n");
|
||||
cxi = 1;
|
||||
nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
|
||||
break;
|
||||
|
||||
case RRC_NAS_DC2_OUT:
|
||||
//printk("nasrg_rrcnl_data_ready - Calling nasrg_ASCTL_DC_receive\n");
|
||||
cxi = 2;
|
||||
nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("nasrg_rrcnl_data_ready - Invalid SAP value received\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_netlink_init(void){
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_netlink_init(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasrg_netlink_init - begin \n");
|
||||
|
||||
nas_nl_sk = netlink_kernel_create(&init_net,NAS_NETLINK_ID, 0, nasrg_nl_data_ready,
|
||||
&nasrg_mutex, // NULL
|
||||
THIS_MODULE);
|
||||
|
||||
if (!nas_nl_sk) {
|
||||
printk("nasrg_netlink_init - netlink_kernel_create failed for PDCP socket\n");
|
||||
// TEMP printk("nasrg_netlink_init - netlink_kernel_create failed for PDCP socket %d\n", errno);
|
||||
@@ -141,8 +152,9 @@ int nasrg_netlink_init(void){
|
||||
}
|
||||
|
||||
nas_rrcnl_sk = netlink_kernel_create(&init_net,NAS_RRCNL_ID, 0, nasrg_rrcnl_data_ready,
|
||||
&nasrg_mutex, // NULL
|
||||
THIS_MODULE);
|
||||
&nasrg_mutex, // NULL
|
||||
THIS_MODULE);
|
||||
|
||||
if (!nas_rrcnl_sk) {
|
||||
printk("nasrg_rrcnl_init - netlink_kernel_create failed for RRC socket\n");
|
||||
return(-1);
|
||||
@@ -152,43 +164,50 @@ int nasrg_netlink_init(void){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_netlink_release(void) {
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_netlink_release(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("nasrg_netlink_release - begin \n");
|
||||
|
||||
//exit_netlink_thread=1;
|
||||
printk("nasrg_netlink_release - Releasing netlink sockets\n");
|
||||
|
||||
if(nas_nl_sk){
|
||||
if(nas_nl_sk) {
|
||||
netlink_kernel_release(nas_nl_sk);
|
||||
}
|
||||
if(nas_rrcnl_sk){
|
||||
|
||||
if(nas_rrcnl_sk) {
|
||||
netlink_kernel_release(nas_rrcnl_sk);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination) {
|
||||
//---------------------------------------------------------------------------
|
||||
int nasrg_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct sk_buff *nl_skb;
|
||||
struct nlmsghdr *nlh;
|
||||
int status;
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("nasrg_netlink_send - begin \n");
|
||||
#endif
|
||||
if (!data_buffer){
|
||||
printk("nasrg_netlink_send - ERROR - input parameter data is NULL \n");
|
||||
|
||||
if (!data_buffer) {
|
||||
printk("nasrg_netlink_send - ERROR - input parameter data is NULL \n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (!nas_nl_sk || !nas_rrcnl_sk) {
|
||||
printk("nasrg_netlink_send - ERROR - socket is NULL\n");
|
||||
return(0);
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
|
||||
nl_skb = alloc_skb(NLMSG_SPACE(data_length),GFP_ATOMIC);
|
||||
|
||||
if (!nl_skb) {
|
||||
printk("nasrg_netlink_send - ERROR - could not allocate skbuffer\n");
|
||||
return(0);
|
||||
@@ -205,19 +224,19 @@ int nasrg_netlink_send(unsigned char *data_buffer, unsigned int data_length, int
|
||||
NETLINK_CB(nl_skb).pid = 0;
|
||||
|
||||
// destination 0 = PDCP, 1 = RRC
|
||||
if (destination== NASNL_DEST_PDCP){
|
||||
#ifdef NETLINK_DEBUG
|
||||
if (destination== NASNL_DEST_PDCP) {
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("nasrg_netlink_send - Sending to PDCP - nl_skb %p, nl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_nl_sk, nlh, nlh->nlmsg_len);
|
||||
#ifdef NAS_DEBUG_SEND_DETAIL
|
||||
#ifdef NAS_DEBUG_SEND_DETAIL
|
||||
nasrg_TOOL_print_buffer(NLMSG_DATA(nlh),48);
|
||||
#endif
|
||||
#endif //DEBUG_NETLINK
|
||||
#endif
|
||||
#endif //DEBUG_NETLINK
|
||||
status = netlink_unicast(nas_nl_sk, nl_skb, NL_DEST_PID, MSG_DONTWAIT);
|
||||
}else{
|
||||
#ifdef NAS_DEBUG_RRCNL
|
||||
} else {
|
||||
#ifdef NAS_DEBUG_RRCNL
|
||||
printk("nasrg_netlink_send - Sending to RRC - nl_skb %p, nas_rrcnl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_rrcnl_sk, nlh, nlh->nlmsg_len);
|
||||
nasrg_TOOL_print_buffer(NLMSG_DATA(nlh),data_length);
|
||||
#endif //NAS_DEBUG_RRCNL
|
||||
#endif //NAS_DEBUG_RRCNL
|
||||
status = netlink_unicast(nas_rrcnl_sk, nl_skb, NL_DEST_RRC_PID, MSG_DONTWAIT);
|
||||
}
|
||||
|
||||
@@ -225,9 +244,9 @@ int nasrg_netlink_send(unsigned char *data_buffer, unsigned int data_length, int
|
||||
printk("nasrg_netlink_send - SEND status is %d\n",status);
|
||||
return(0);
|
||||
} else {
|
||||
#ifdef NETLINK_DEBUG
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("nasrg_netlink_send - SEND status is %d, data_length %d\n",status, data_length);
|
||||
#endif
|
||||
#endif
|
||||
return data_length;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,178 +12,216 @@
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
void nasrg_TOOL_fct(struct classifier_entity *gc, uint8_t fct){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void nasrg_TOOL_fct(struct classifier_entity *gc, uint8_t fct)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_fct - begin \n");
|
||||
printk("nasrg_TOOL_fct - begin \n");
|
||||
#endif
|
||||
if (gc==NULL){
|
||||
|
||||
if (gc==NULL) {
|
||||
printk("nasrg_TOOL_fct - input parameter gc is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
switch(fct){
|
||||
case NAS_FCT_QOS_SEND:
|
||||
gc->fct=nasrg_COMMON_QOS_send;
|
||||
break;
|
||||
case NAS_FCT_CTL_SEND:
|
||||
gc->fct=nasrg_CTL_send;
|
||||
break;
|
||||
case NAS_FCT_DC_SEND:
|
||||
gc->fct=nasrg_ASCTL_DC_send_sig_data_request;
|
||||
break;
|
||||
case NAS_FCT_DEL_SEND:
|
||||
gc->fct=nasrg_COMMON_del_send;
|
||||
break;
|
||||
default:
|
||||
gc->fct=nasrg_COMMON_del_send;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
switch(fct) {
|
||||
case NAS_FCT_QOS_SEND:
|
||||
gc->fct=nasrg_COMMON_QOS_send;
|
||||
break;
|
||||
|
||||
case NAS_FCT_CTL_SEND:
|
||||
gc->fct=nasrg_CTL_send;
|
||||
break;
|
||||
|
||||
case NAS_FCT_DC_SEND:
|
||||
gc->fct=nasrg_ASCTL_DC_send_sig_data_request;
|
||||
break;
|
||||
|
||||
case NAS_FCT_DEL_SEND:
|
||||
gc->fct=nasrg_COMMON_del_send;
|
||||
break;
|
||||
|
||||
default:
|
||||
gc->fct=nasrg_COMMON_del_send;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t nasrg_TOOL_invfct(struct classifier_entity *gc){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
uint8_t nasrg_TOOL_invfct(struct classifier_entity *gc)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_invfct - begin \n");
|
||||
printk("nasrg_TOOL_invfct - begin \n");
|
||||
#endif
|
||||
if (gc==NULL){
|
||||
|
||||
if (gc==NULL) {
|
||||
printk("nasrg_TOOL_invfct - input parameter gc is NULL \n");
|
||||
return 0;
|
||||
}
|
||||
// End debug information
|
||||
if (gc->fct==nasrg_COMMON_QOS_send)
|
||||
return NAS_FCT_QOS_SEND;
|
||||
if (gc->fct==nasrg_CTL_send)
|
||||
return NAS_FCT_CTL_SEND;
|
||||
if (gc->fct==nasrg_COMMON_del_send)
|
||||
return NAS_FCT_DEL_SEND;
|
||||
if (gc->fct==nasrg_ASCTL_DC_send_sig_data_request)
|
||||
return NAS_FCT_DC_SEND;
|
||||
return 0;
|
||||
|
||||
// End debug information
|
||||
if (gc->fct==nasrg_COMMON_QOS_send)
|
||||
return NAS_FCT_QOS_SEND;
|
||||
|
||||
if (gc->fct==nasrg_CTL_send)
|
||||
return NAS_FCT_CTL_SEND;
|
||||
|
||||
if (gc->fct==nasrg_COMMON_del_send)
|
||||
return NAS_FCT_DEL_SEND;
|
||||
|
||||
if (gc->fct==nasrg_ASCTL_DC_send_sig_data_request)
|
||||
return NAS_FCT_DC_SEND;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t nasrg_TOOL_get_dscp6(struct ipv6hdr *iph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
uint8_t nasrg_TOOL_get_dscp6(struct ipv6hdr *iph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_get_dscp6 - begin \n");
|
||||
printk("nasrg_TOOL_get_dscp6 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
|
||||
if (iph==NULL) {
|
||||
printk("nasrg_TOOL_get_dscp6 - input parameter iph is NULL \n");
|
||||
return 0;
|
||||
}
|
||||
// End debug information
|
||||
// return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>22; //Yan
|
||||
return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>20;
|
||||
|
||||
// End debug information
|
||||
// return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>22; //Yan
|
||||
return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>20;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t nasrg_TOOL_get_dscp4(struct iphdr *iph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
uint8_t nasrg_TOOL_get_dscp4(struct iphdr *iph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_get_dscp4 - begin \n");
|
||||
printk("nasrg_TOOL_get_dscp4 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
|
||||
if (iph==NULL) {
|
||||
printk("nasrg_TOOL_get_dscp4 - input parameter iph is NULL \n");
|
||||
return 0;
|
||||
}
|
||||
// End debug information
|
||||
return ((iph->tos)>>5)<<3;
|
||||
|
||||
// End debug information
|
||||
return ((iph->tos)>>5)<<3;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t *nasrg_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol){
|
||||
//---------------------------------------------------------------------------
|
||||
uint16_t size;
|
||||
// Start debug information
|
||||
uint8_t *nasrg_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint16_t size;
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_get_protocol6 - begin \n");
|
||||
printk("nasrg_TOOL_get_protocol6 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
|
||||
if (iph==NULL) {
|
||||
printk("nasrg_TOOL_get_protocol6 - input parameter iph is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
if (protocol==NULL){
|
||||
|
||||
if (protocol==NULL) {
|
||||
printk("nasrg_TOOL_get_protocol6 - input parameter protocol is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
*protocol=iph->nexthdr;
|
||||
size=NAS_IPV6_SIZE;
|
||||
while (1){
|
||||
switch(*protocol){
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_ICMPV6:
|
||||
return (uint8_t *)((uint8_t *)iph+size);
|
||||
case IPPROTO_HOPOPTS:
|
||||
case IPPROTO_ROUTING:
|
||||
case IPPROTO_DSTOPTS:
|
||||
*protocol=((uint8_t *)iph+size)[0];
|
||||
size+=((uint8_t *)iph+size)[1]*8+8;
|
||||
break;
|
||||
case IPPROTO_FRAGMENT:
|
||||
*protocol=((uint8_t *)iph+size)[0];
|
||||
size+=((uint8_t *)iph+size)[1]+8;
|
||||
break;
|
||||
case IPPROTO_NONE:
|
||||
case IPPROTO_AH:
|
||||
case IPPROTO_ESP:
|
||||
default:
|
||||
return NULL;
|
||||
// End debug information
|
||||
|
||||
*protocol=iph->nexthdr;
|
||||
size=NAS_IPV6_SIZE;
|
||||
|
||||
while (1) {
|
||||
switch(*protocol) {
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_ICMPV6:
|
||||
return (uint8_t *)((uint8_t *)iph+size);
|
||||
|
||||
case IPPROTO_HOPOPTS:
|
||||
case IPPROTO_ROUTING:
|
||||
case IPPROTO_DSTOPTS:
|
||||
*protocol=((uint8_t *)iph+size)[0];
|
||||
size+=((uint8_t *)iph+size)[1]*8+8;
|
||||
break;
|
||||
|
||||
case IPPROTO_FRAGMENT:
|
||||
*protocol=((uint8_t *)iph+size)[0];
|
||||
size+=((uint8_t *)iph+size)[1]+8;
|
||||
break;
|
||||
|
||||
case IPPROTO_NONE:
|
||||
case IPPROTO_AH:
|
||||
case IPPROTO_ESP:
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t *nasrg_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
uint8_t *nasrg_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_get_protocol4 - begin \n");
|
||||
printk("nasrg_TOOL_get_protocol4 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
|
||||
if (iph==NULL) {
|
||||
printk("nasrg_TOOL_get_protocol4 - input parameter iph is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
if (protocol==NULL){
|
||||
|
||||
if (protocol==NULL) {
|
||||
printk("nasrg_TOOL_get_protocol4 - input parameter protocol is NULL \n");
|
||||
return NULL;
|
||||
}
|
||||
// End debug information
|
||||
*protocol=iph->protocol;
|
||||
switch(*protocol){
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_ICMP:
|
||||
return (uint8_t *)((uint8_t *)iph+iph->tot_len);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
*protocol=iph->protocol;
|
||||
|
||||
switch(*protocol) {
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_ICMP:
|
||||
return (uint8_t *)((uint8_t *)iph+iph->tot_len);
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Convert the IMEI to iid
|
||||
void nasrg_TOOL_imei2iid(uint8_t *imei, uint8_t *iid){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void nasrg_TOOL_imei2iid(uint8_t *imei, uint8_t *iid)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_imei2iid - begin \n");
|
||||
#endif
|
||||
if (imei==NULL){
|
||||
|
||||
if (imei==NULL) {
|
||||
printk("nasrg_TOOL_imei2iid - input parameter imei is NULL \n");
|
||||
return;
|
||||
}
|
||||
if (iid==NULL){
|
||||
|
||||
if (iid==NULL) {
|
||||
printk("nasrg_TOOL_imei2iid - input parameter iid is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
memset(iid, 0, NAS_ADDR_LEN);
|
||||
iid[0] = 0x03;
|
||||
#ifdef NAS_DRIVER_TYPE_ETHERNET
|
||||
@@ -204,132 +242,225 @@ void nasrg_TOOL_imei2iid(uint8_t *imei, uint8_t *iid){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Convert the RG IMEI to iid
|
||||
void nasrg_TOOL_RGimei2iid(uint8_t *imei, uint8_t *iid){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void nasrg_TOOL_RGimei2iid(uint8_t *imei, uint8_t *iid)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_RGimei2iid - begin \n");
|
||||
printk("nasrg_TOOL_RGimei2iid - begin \n");
|
||||
#endif
|
||||
if (!imei || !iid){
|
||||
|
||||
if (!imei || !iid) {
|
||||
printk("nasrg_TOOL_RGimei2iid - input parameter imei or iid is NULL \n");
|
||||
return;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
memset(iid, 0, NAS_ADDR_LEN);
|
||||
iid[0] = 0x00; // to be compatible between link local and global
|
||||
iid[1] = 16*imei[0]+imei[1];
|
||||
iid[2] = 16*imei[2]+imei[3];
|
||||
iid[3] = 16*imei[4]+imei[5];
|
||||
iid[4] = 16*imei[6]+imei[7];
|
||||
iid[5] = 16*imei[8]+imei[9];
|
||||
iid[6] = 16*imei[10]+imei[11];
|
||||
iid[7] = 16*imei[12]+imei[13];
|
||||
// End debug information
|
||||
memset(iid, 0, NAS_ADDR_LEN);
|
||||
iid[0] = 0x00; // to be compatible between link local and global
|
||||
iid[1] = 16*imei[0]+imei[1];
|
||||
iid[2] = 16*imei[2]+imei[3];
|
||||
iid[3] = 16*imei[4]+imei[5];
|
||||
iid[4] = 16*imei[6]+imei[7];
|
||||
iid[5] = 16*imei[8]+imei[9];
|
||||
iid[6] = 16*imei[10]+imei[11];
|
||||
iid[7] = 16*imei[12]+imei[13];
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_TOOL_pk_icmp6(struct icmp6hdr *icmph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void nasrg_TOOL_pk_icmp6(struct icmp6hdr *icmph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef GRAAL_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_pk_icmp6 - begin \n");
|
||||
#endif
|
||||
if (!icmph){
|
||||
printk("nasrg_TOOL_pk_icmp6 - input parameter icmph is NULL \n");
|
||||
|
||||
if (!icmph) {
|
||||
printk("nasrg_TOOL_pk_icmp6 - input parameter icmph is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
printk("ICMPv6:\t type= %d, code = %d\n", icmph->icmp6_type, icmph->icmp6_code);
|
||||
switch(icmph->icmp6_type){
|
||||
case ICMPV6_DEST_UNREACH:printk("Destination unreachable\n");break;
|
||||
case ICMPV6_PKT_TOOBIG:printk("Packet too big\n");break;
|
||||
case ICMPV6_TIME_EXCEED:printk("Time exceeded\n");break;
|
||||
case ICMPV6_PARAMPROB:printk("Parameter problem\n");break;
|
||||
case ICMPV6_ECHO_REQUEST:printk("Echo request\n");break;
|
||||
case ICMPV6_ECHO_REPLY:printk("Echo reply\n");break;
|
||||
case ICMPV6_MGM_QUERY:printk("Multicast listener query\n");break;
|
||||
case ICMPV6_MGM_REPORT:printk("Multicast listener report\n");break;
|
||||
case ICMPV6_MGM_REDUCTION:printk("Multicast listener done\n");break;
|
||||
case NDISC_ROUTER_SOLICITATION:printk("Router solicitation\n");break;
|
||||
case NDISC_ROUTER_ADVERTISEMENT:printk("Router advertisment\n");break;
|
||||
case NDISC_NEIGHBOUR_SOLICITATION:printk("Neighbour solicitation\n");break;
|
||||
case NDISC_NEIGHBOUR_ADVERTISEMENT:printk("Neighbour advertisment\n");break;
|
||||
case NDISC_REDIRECT:printk("redirect message\n");break;
|
||||
|
||||
switch(icmph->icmp6_type) {
|
||||
case ICMPV6_DEST_UNREACH:
|
||||
printk("Destination unreachable\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_PKT_TOOBIG:
|
||||
printk("Packet too big\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_TIME_EXCEED:
|
||||
printk("Time exceeded\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_PARAMPROB:
|
||||
printk("Parameter problem\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_ECHO_REQUEST:
|
||||
printk("Echo request\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_ECHO_REPLY:
|
||||
printk("Echo reply\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_MGM_QUERY:
|
||||
printk("Multicast listener query\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_MGM_REPORT:
|
||||
printk("Multicast listener report\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_MGM_REDUCTION:
|
||||
printk("Multicast listener done\n");
|
||||
break;
|
||||
|
||||
case NDISC_ROUTER_SOLICITATION:
|
||||
printk("Router solicitation\n");
|
||||
break;
|
||||
|
||||
case NDISC_ROUTER_ADVERTISEMENT:
|
||||
printk("Router advertisment\n");
|
||||
break;
|
||||
|
||||
case NDISC_NEIGHBOUR_SOLICITATION:
|
||||
printk("Neighbour solicitation\n");
|
||||
break;
|
||||
|
||||
case NDISC_NEIGHBOUR_ADVERTISEMENT:
|
||||
printk("Neighbour advertisment\n");
|
||||
break;
|
||||
|
||||
case NDISC_REDIRECT:
|
||||
printk("redirect message\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nasrg_TOOL_print_state(uint8_t state){
|
||||
//---------------------------------------------------------------------------
|
||||
switch(state){
|
||||
case NAS_IDLE:printk("NAS_IDLE\n");return;
|
||||
case NAS_CX_FACH:printk("NAS_CX_FACH\n");return;
|
||||
case NAS_CX_DCH:printk("NAS_CX_DCH\n");return;
|
||||
case NAS_CX_RECEIVED:printk("NAS_CX_RECEIVED\n");return;
|
||||
case NAS_CX_CONNECTING:printk("NAS_CX_CONNECTING\n");return;
|
||||
case NAS_CX_RELEASING:printk("NAS_CX_RELEASING\n");return;
|
||||
case NAS_CX_CONNECTING_FAILURE:printk("NAS_CX_CONNECTING_FAILURE\n");return;
|
||||
case NAS_CX_RELEASING_FAILURE:printk("NAS_CX_RELEASING_FAILURE\n");return;
|
||||
case NAS_RB_ESTABLISHING:printk("NAS_RB_ESTABLISHING\n");return;
|
||||
case NAS_RB_RELEASING:printk("NAS_RB_RELEASING\n");return;
|
||||
case NAS_RB_ESTABLISHED:printk("NAS_RB_ESTABLISHED\n");return;
|
||||
default: printk(" Unknown state\n");
|
||||
void nasrg_TOOL_print_state(uint8_t state)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
switch(state) {
|
||||
case NAS_IDLE:
|
||||
printk("NAS_IDLE\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_FACH:
|
||||
printk("NAS_CX_FACH\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_DCH:
|
||||
printk("NAS_CX_DCH\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_RECEIVED:
|
||||
printk("NAS_CX_RECEIVED\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_CONNECTING:
|
||||
printk("NAS_CX_CONNECTING\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_RELEASING:
|
||||
printk("NAS_CX_RELEASING\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_CONNECTING_FAILURE:
|
||||
printk("NAS_CX_CONNECTING_FAILURE\n");
|
||||
return;
|
||||
|
||||
case NAS_CX_RELEASING_FAILURE:
|
||||
printk("NAS_CX_RELEASING_FAILURE\n");
|
||||
return;
|
||||
|
||||
case NAS_RB_ESTABLISHING:
|
||||
printk("NAS_RB_ESTABLISHING\n");
|
||||
return;
|
||||
|
||||
case NAS_RB_RELEASING:
|
||||
printk("NAS_RB_RELEASING\n");
|
||||
return;
|
||||
|
||||
case NAS_RB_ESTABLISHED:
|
||||
printk("NAS_RB_ESTABLISHED\n");
|
||||
return;
|
||||
|
||||
default:
|
||||
printk(" Unknown state\n");
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Print the content of a buffer in hexadecimal
|
||||
void nasrg_TOOL_print_buffer(unsigned char * buffer,int length) {
|
||||
//-----------------------------------------------------------------------------
|
||||
int i;
|
||||
void nasrg_TOOL_print_buffer(unsigned char * buffer,int length)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
int i;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_print_buffer - begin \n");
|
||||
printk("nasrg_TOOL_print_buffer - begin \n");
|
||||
#endif
|
||||
if (buffer==NULL){
|
||||
|
||||
if (buffer==NULL) {
|
||||
printk("\n nasrg_TOOL_print_buffer - input parameter buffer is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
printk("Buffer content: ");
|
||||
for (i=0;i<length;i++)
|
||||
printk("-%hx-",buffer[i]);
|
||||
printk(",\t length %d\n", length);
|
||||
|
||||
// End debug information
|
||||
printk("Buffer content: ");
|
||||
|
||||
for (i=0; i<length; i++)
|
||||
printk("-%hx-",buffer[i]);
|
||||
|
||||
printk(",\t length %d\n", length);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void nasrg_TOOL_print_rb_entity(struct rb_entity *rb){
|
||||
//-----------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void nasrg_TOOL_print_rb_entity(struct rb_entity *rb)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_print_rb_entity - begin \n");
|
||||
printk("nasrg_TOOL_print_rb_entity - begin \n");
|
||||
#endif
|
||||
if (rb==NULL){
|
||||
|
||||
if (rb==NULL) {
|
||||
printk("\n nasrg_TOOL_print_rb_entity - input parameter rb is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
printk("\nrb_entity content: rab_id %d, sapi %d, qos %d, dscp %d, \n", rb->rab_id, rb->sapi, rb->qos, rb->dscp);
|
||||
printk("state %d, retry %d, countimer %d\n",rb->state, rb->retry, rb->countimer);
|
||||
|
||||
// End debug information
|
||||
printk("\nrb_entity content: rab_id %d, sapi %d, qos %d, dscp %d, \n", rb->rab_id, rb->sapi, rb->qos, rb->dscp);
|
||||
printk("state %d, retry %d, countimer %d\n",rb->state, rb->retry, rb->countimer);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void nasrg_TOOL_print_classifier(struct classifier_entity *gc){
|
||||
//-----------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void nasrg_TOOL_print_classifier(struct classifier_entity *gc)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_TOOL
|
||||
printk("nasrg_TOOL_print_classifier - begin \n");
|
||||
printk("nasrg_TOOL_print_classifier - begin \n");
|
||||
#endif
|
||||
if (gc==NULL){
|
||||
|
||||
if (gc==NULL) {
|
||||
printk("\n nasrg_TOOL_print_classifier - input parameter gc is NULL \n");
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
printk("\nClassifier content: classref %d, version %d, splen %d, dplen %d,\n", gc->classref, gc->version, gc->splen, gc->dplen);
|
||||
printk("protocol %d, sport %d, dport %d, rab_id %d\n", gc->protocol, gc->sport, gc->dport, gc->rab_id);
|
||||
nasrg_TOOL_print_rb_entity(gc->rb);
|
||||
|
||||
// End debug information
|
||||
printk("\nClassifier content: classref %d, version %d, splen %d, dplen %d,\n", gc->classref, gc->version, gc->splen, gc->dplen);
|
||||
printk("protocol %d, sport %d, dport %d, rab_id %d\n", gc->protocol, gc->sport, gc->dport, gc->rab_id);
|
||||
nasrg_TOOL_print_rb_entity(gc->rb);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
|
||||
struct cx_entity;
|
||||
|
||||
struct rb_entity{
|
||||
// uint16_t default_rab;
|
||||
struct rb_entity {
|
||||
// uint16_t default_rab;
|
||||
uint32_t cnxid;
|
||||
nasRadioBearerId_t rab_id; //ue_rbId
|
||||
nasRadioBearerId_t rg_rbId;
|
||||
@@ -80,24 +80,24 @@ struct rb_entity{
|
||||
uint8_t result;
|
||||
uint8_t retry;
|
||||
uint32_t countimer;
|
||||
//for MBMS
|
||||
//for MBMS
|
||||
uint16_t serviceId;
|
||||
uint16_t sessionId;
|
||||
uint16_t duration;
|
||||
uint8_t mcast_address[16];
|
||||
//
|
||||
//
|
||||
struct rb_entity *next;
|
||||
};
|
||||
|
||||
struct classifier_entity{
|
||||
struct classifier_entity {
|
||||
uint32_t classref; // classifier identity
|
||||
uint8_t version; // IP version 4 or 6
|
||||
union{
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
} saddr; // IP source address
|
||||
uint8_t splen; // IP prefix size
|
||||
union{
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
} daddr; // IP destination address
|
||||
@@ -112,7 +112,7 @@ struct classifier_entity{
|
||||
};
|
||||
|
||||
|
||||
struct cx_entity{
|
||||
struct cx_entity {
|
||||
int sap[NAS_SAPI_CX_MAX];
|
||||
uint8_t state; // state of the connection
|
||||
nasLocalConnectionRef_t lcr; // Local connection reference
|
||||
@@ -151,7 +151,7 @@ struct cx_entity{
|
||||
//};
|
||||
//
|
||||
|
||||
struct nas_priv{
|
||||
struct nas_priv {
|
||||
int irq;
|
||||
int rx_flags;
|
||||
struct timer_list timer;
|
||||
@@ -186,11 +186,11 @@ struct nas_priv{
|
||||
|
||||
struct ipversion {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
uint8_t reserved:4,
|
||||
version:4;
|
||||
uint8_t reserved:4,
|
||||
version:4;
|
||||
#else
|
||||
uint8_t version:4,
|
||||
reserved:4;
|
||||
uint8_t version:4,
|
||||
reserved:4;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/********************
|
||||
// RRC definitions
|
||||
********************/
|
||||
@@ -60,23 +60,26 @@ struct msghdr msg;
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void foo( int sig ){
|
||||
//-----------------------------------------------------------------------------
|
||||
printf("I got cntl-C, closing socket\n");
|
||||
close(sock_fd);
|
||||
close(rrcnl_sock_fd);
|
||||
void foo( int sig )
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
printf("I got cntl-C, closing socket\n");
|
||||
close(sock_fd);
|
||||
close(rrcnl_sock_fd);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int main() {
|
||||
//-----------------------------------------------------------------------------
|
||||
int main()
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
struct sigaction newaction;
|
||||
int i=0;
|
||||
int ret;
|
||||
int len, count;
|
||||
|
||||
newaction.sa_handler = foo;
|
||||
|
||||
// register cntl-C handler
|
||||
if ( sigaction( SIGINT, &newaction, NULL ) == -1)
|
||||
perror("Could not install the new signal handler");
|
||||
@@ -158,35 +161,37 @@ int main() {
|
||||
while (1) {
|
||||
len = recvmsg(sock_fd, &msg, 0);
|
||||
count = recvmsg(rrcnl_sock_fd, &rrcnl_msg, 0);
|
||||
|
||||
if (len<0) {
|
||||
// exit(-1);
|
||||
}
|
||||
else {
|
||||
printf("Received PDCP socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
|
||||
}
|
||||
if (count<0) {
|
||||
// exit(-1);
|
||||
}
|
||||
else {
|
||||
printf("Received RRC socket with length %d (nlmsg_len = %d)\n",count,rrcnl_nlh->nlmsg_len);
|
||||
// exit(-1);
|
||||
} else {
|
||||
printf("Received PDCP socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
|
||||
}
|
||||
|
||||
/* usleep(1000);
|
||||
i=i+1;
|
||||
if ((i % 100) == 0)
|
||||
printf("%d\n",i);*/
|
||||
if (count<0) {
|
||||
// exit(-1);
|
||||
} else {
|
||||
printf("Received RRC socket with length %d (nlmsg_len = %d)\n",count,rrcnl_nlh->nlmsg_len);
|
||||
}
|
||||
|
||||
/* usleep(1000);
|
||||
i=i+1;
|
||||
if ((i % 100) == 0)
|
||||
printf("%d\n",i);*/
|
||||
usleep(50);
|
||||
i=i+1;
|
||||
|
||||
if ((i % 1000) == 0)
|
||||
printf("%d\n",i);
|
||||
|
||||
/*
|
||||
for (i=0;i<nlh->nlmsg_len - sizeof(struct nlmsghdr);i++) {
|
||||
printf("%x ",
|
||||
((unsigned char *)NLMSG_DATA(nlh))[i]);
|
||||
}
|
||||
*/
|
||||
((unsigned char *)NLMSG_DATA(nlh))[i]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/* Close Netlink Socket */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -32,17 +32,18 @@ struct msghdr msg;
|
||||
void foo( int sig )
|
||||
{
|
||||
|
||||
printf("I got cntl-C, closing socket\n");
|
||||
|
||||
printf("I got cntl-C, closing socket\n");
|
||||
|
||||
close(sock_fd);
|
||||
exit(-1);
|
||||
|
||||
close(sock_fd);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
#define NAS_NETLINK_ID 31
|
||||
|
||||
void main() {
|
||||
void main()
|
||||
{
|
||||
|
||||
|
||||
struct sigaction newaction;
|
||||
@@ -51,12 +52,12 @@ void main() {
|
||||
int len;
|
||||
|
||||
newaction.sa_handler = foo;
|
||||
|
||||
|
||||
if ( sigaction( SIGINT, &newaction, NULL ) == -1)
|
||||
perror("Could not install the new signal handler");
|
||||
|
||||
sock_fd = socket(PF_NETLINK, SOCK_RAW,NAS_NETLINK_ID);
|
||||
|
||||
|
||||
printf("Opened socket with fd %d\n",sock_fd);
|
||||
|
||||
ret = fcntl(sock_fd,F_SETFL,O_NONBLOCK);
|
||||
@@ -67,20 +68,20 @@ void main() {
|
||||
src_addr.nl_pid = 1;//getpid(); /* self pid */
|
||||
src_addr.nl_groups = 0; /* not in mcast groups */
|
||||
ret = bind(sock_fd, (struct sockaddr*)&src_addr,
|
||||
sizeof(src_addr));
|
||||
sizeof(src_addr));
|
||||
printf("bind returns %d\n",ret);
|
||||
|
||||
memset(&dest_addr, 0, sizeof(dest_addr));
|
||||
dest_addr.nl_family = AF_NETLINK;
|
||||
dest_addr.nl_pid = 0; /* For Linux Kernel */
|
||||
dest_addr.nl_groups = 0; /* unicast */
|
||||
|
||||
|
||||
nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD));
|
||||
/* Fill the netlink message header */
|
||||
nlh->nlmsg_len = NLMSG_SPACE(MAX_PAYLOAD);
|
||||
nlh->nlmsg_pid = 1;//getpid(); /* self pid */
|
||||
nlh->nlmsg_flags = 0;
|
||||
|
||||
|
||||
iov.iov_base = (void *)nlh;
|
||||
iov.iov_len = nlh->nlmsg_len;
|
||||
memset(&msg,0,sizeof(msg));
|
||||
@@ -88,34 +89,36 @@ void main() {
|
||||
msg.msg_namelen = sizeof(dest_addr);
|
||||
msg.msg_iov = &iov;
|
||||
msg.msg_iovlen = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Read message from kernel */
|
||||
memset(nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
|
||||
|
||||
while (1) {
|
||||
len = recvmsg(sock_fd, &msg, 0);
|
||||
|
||||
|
||||
|
||||
if (len<0) {
|
||||
|
||||
// exit(-1);
|
||||
}
|
||||
else {
|
||||
printf("Received socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
|
||||
|
||||
// exit(-1);
|
||||
} else {
|
||||
printf("Received socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
|
||||
}
|
||||
|
||||
usleep(1000);
|
||||
i=i+1;
|
||||
|
||||
if ((i % 100) == 0)
|
||||
printf("%d\n",i);
|
||||
|
||||
/*
|
||||
for (i=0;i<nlh->nlmsg_len - sizeof(struct nlmsghdr);i++) {
|
||||
printf("%x ",
|
||||
((unsigned char *)NLMSG_DATA(nlh))[i]);
|
||||
}
|
||||
*/
|
||||
((unsigned char *)NLMSG_DATA(nlh))[i]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/* Close Netlink Socket */
|
||||
|
||||
}
|
||||
|
||||
@@ -85,34 +85,37 @@ void IAL_NAS_ioctl_init(int inst)
|
||||
//---------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
struct oai_nw_drv_msg_statistic_reply *msgrep;
|
||||
int err,rc;
|
||||
struct oai_nw_drv_msg_statistic_reply *msgrep;
|
||||
int err,rc;
|
||||
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
|
||||
// Get an UDP IPv6 socket ??
|
||||
fd=socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (fd<0) {
|
||||
printf("Error opening socket\n");
|
||||
exit(1);
|
||||
}
|
||||
// Get an UDP IPv6 socket ??
|
||||
fd=socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
if (fd<0) {
|
||||
printf("Error opening socket\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
gifr.type = OAI_NW_DRV_MSG_STATISTIC_REQUEST;
|
||||
memset ((void *)dummy_buffer,0,800);
|
||||
gifr.msg= &(dummy_buffer[0]);
|
||||
msgrep=(struct oai_nw_drv_msg_statistic_reply *)(gifr.msg);
|
||||
printf("ioctl :Statistics requested\n");
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
if (err<0){
|
||||
printf("IOCTL error, err=%d\n",err);
|
||||
rc = -1;
|
||||
}
|
||||
printf("tx_packets = %u, rx_packets = %u\n", msgrep->tx_packets, msgrep->rx_packets);
|
||||
printf("tx_bytes = %u, rx_bytes = %u\n", msgrep->tx_bytes, msgrep->rx_bytes);
|
||||
printf("tx_errors = %u, rx_errors = %u\n", msgrep->tx_errors, msgrep->rx_errors);
|
||||
printf("tx_dropped = %u, rx_dropped = %u\n", msgrep->tx_dropped, msgrep->rx_dropped);
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
|
||||
gifr.type = OAI_NW_DRV_MSG_STATISTIC_REQUEST;
|
||||
memset ((void *)dummy_buffer,0,800);
|
||||
gifr.msg= &(dummy_buffer[0]);
|
||||
msgrep=(struct oai_nw_drv_msg_statistic_reply *)(gifr.msg);
|
||||
printf("ioctl :Statistics requested\n");
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err<0) {
|
||||
printf("IOCTL error, err=%d\n",err);
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
printf("tx_packets = %u, rx_packets = %u\n", msgrep->tx_packets, msgrep->rx_packets);
|
||||
printf("tx_bytes = %u, rx_bytes = %u\n", msgrep->tx_bytes, msgrep->rx_bytes);
|
||||
printf("tx_errors = %u, rx_errors = %u\n", msgrep->tx_errors, msgrep->rx_errors);
|
||||
printf("tx_dropped = %u, rx_dropped = %u\n", msgrep->tx_dropped, msgrep->rx_dropped);
|
||||
}
|
||||
|
||||
#define NO_ACTION_RB 0
|
||||
@@ -123,364 +126,407 @@ void IAL_NAS_ioctl_init(int inst)
|
||||
int main(int argc,char **argv)
|
||||
//---------------------------------------------------------------------------
|
||||
{
|
||||
int done;
|
||||
int rc;
|
||||
int meas_polling_counter;
|
||||
fd_set readfds;
|
||||
struct timeval tv;
|
||||
int i;
|
||||
int err;
|
||||
char *buffer;
|
||||
int c;
|
||||
int action;
|
||||
int rbset = 0;
|
||||
int cxset = 0;
|
||||
int classrefset = 0;
|
||||
int instset = 0;
|
||||
int saddr_ipv4set = 0;
|
||||
int saddr_ipv6set = 0;
|
||||
int daddr_ipv4set = 0;
|
||||
int daddr_ipv6set = 0;
|
||||
int dscpset = 0;
|
||||
int dplen = 0;
|
||||
int splen = 0;
|
||||
int mpls_outlabelset = 0;
|
||||
int mpls_inlabelset;
|
||||
char rb[20];
|
||||
char cx[20];
|
||||
char classref[20];
|
||||
char dscp[20];
|
||||
char inst[20];
|
||||
char mpls_outgoinglabel[100];
|
||||
char mpls_incominglabel[100];
|
||||
int index;
|
||||
struct oai_nw_drv_msg_rb_establishment_request *msgreq;
|
||||
struct oai_nw_drv_msg_class_add_request *msgreq_class;
|
||||
in_addr_t saddr_ipv4;
|
||||
in_addr_t daddr_ipv4;
|
||||
struct in6_addr saddr_ipv6;
|
||||
struct in6_addr daddr_ipv6;
|
||||
unsigned int mpls_outlabel;
|
||||
unsigned int mpls_inlabel;
|
||||
char addr_str[46];
|
||||
char mask_len_delims[] = "/";
|
||||
char *result;
|
||||
int done;
|
||||
int rc;
|
||||
int meas_polling_counter;
|
||||
fd_set readfds;
|
||||
struct timeval tv;
|
||||
int i;
|
||||
int err;
|
||||
char *buffer;
|
||||
int c;
|
||||
int action;
|
||||
int rbset = 0;
|
||||
int cxset = 0;
|
||||
int classrefset = 0;
|
||||
int instset = 0;
|
||||
int saddr_ipv4set = 0;
|
||||
int saddr_ipv6set = 0;
|
||||
int daddr_ipv4set = 0;
|
||||
int daddr_ipv6set = 0;
|
||||
int dscpset = 0;
|
||||
int dplen = 0;
|
||||
int splen = 0;
|
||||
int mpls_outlabelset = 0;
|
||||
int mpls_inlabelset;
|
||||
char rb[20];
|
||||
char cx[20];
|
||||
char classref[20];
|
||||
char dscp[20];
|
||||
char inst[20];
|
||||
char mpls_outgoinglabel[100];
|
||||
char mpls_incominglabel[100];
|
||||
int index;
|
||||
struct oai_nw_drv_msg_rb_establishment_request *msgreq;
|
||||
struct oai_nw_drv_msg_class_add_request *msgreq_class;
|
||||
in_addr_t saddr_ipv4;
|
||||
in_addr_t daddr_ipv4;
|
||||
struct in6_addr saddr_ipv6;
|
||||
struct in6_addr daddr_ipv6;
|
||||
unsigned int mpls_outlabel;
|
||||
unsigned int mpls_inlabel;
|
||||
char addr_str[46];
|
||||
char mask_len_delims[] = "/";
|
||||
char *result;
|
||||
|
||||
// scan options
|
||||
rb[0] = '\0';
|
||||
cx[0] = '\0';
|
||||
dscp[0] = '\0';
|
||||
mpls_incominglabel[0] = '\0';
|
||||
mpls_outgoinglabel[0] = '\0';
|
||||
action = NO_ACTION_RB;
|
||||
// scan options
|
||||
rb[0] = '\0';
|
||||
cx[0] = '\0';
|
||||
dscp[0] = '\0';
|
||||
mpls_incominglabel[0] = '\0';
|
||||
mpls_outgoinglabel[0] = '\0';
|
||||
action = NO_ACTION_RB;
|
||||
|
||||
while ((c = getopt (argc, argv, "adr:i:c:f:l:m:s:t:x:y:z:")) != -1)
|
||||
switch (c)
|
||||
{
|
||||
case 'a':
|
||||
action = ADD_RB;
|
||||
break;
|
||||
case 'd':
|
||||
action = DEL_RB;
|
||||
break;
|
||||
case 'r':
|
||||
strcpy(rb,optarg);
|
||||
rbset = 1;
|
||||
break;
|
||||
case 'i':
|
||||
strcpy(inst,optarg);
|
||||
instset = 1;
|
||||
break;
|
||||
case 'c':
|
||||
strcpy(cx,optarg);
|
||||
cxset = 1;
|
||||
break;
|
||||
case 'f':
|
||||
strcpy(classref,optarg);
|
||||
classrefset = 1;
|
||||
break;
|
||||
case 'l':
|
||||
strcpy(mpls_outgoinglabel,optarg);
|
||||
mpls_outlabelset=1;
|
||||
break;
|
||||
case 'm':
|
||||
strcpy(mpls_incominglabel,optarg);
|
||||
mpls_inlabelset=1;
|
||||
break;
|
||||
case 's':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
if ( result != NULL ) {
|
||||
inet_aton(result,&saddr_ipv4);
|
||||
printf("Arg Source Addr IPv4 string: %s\n",result);
|
||||
saddr_ipv4set = 1;
|
||||
} else {
|
||||
printf("Arg Source Addr IPv4 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
if ( result != NULL ) {
|
||||
splen = atoi(result);
|
||||
} else {
|
||||
splen = 32;
|
||||
}
|
||||
printf("Arg Source Addr IPv4 mask len: %d\n",splen);
|
||||
break;
|
||||
case 't':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
if ( result != NULL ) {
|
||||
inet_aton(result,&daddr_ipv4);
|
||||
printf("Arg Dest Addr IPv4 string: %s\n",result);
|
||||
daddr_ipv4set = 1;
|
||||
} else {
|
||||
printf("Arg Dest Addr IPv4 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
if ( result != NULL ) {
|
||||
dplen = atoi(result);
|
||||
} else {
|
||||
dplen = 32;
|
||||
}
|
||||
printf("Arg Dest Addr IPv4 mask len: %d\n",dplen);
|
||||
break;
|
||||
case 'x':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
if ( result != NULL ) {
|
||||
printf("Arg Source Addr IPv6 string: %s\n",result);
|
||||
inet_pton(AF_INET6,result,(void *)&saddr_ipv6);
|
||||
saddr_ipv6set = 1;
|
||||
} else {
|
||||
printf("Arg Source Addr IPv6 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
if ( result != NULL ) {
|
||||
splen = atoi(result);
|
||||
} else {
|
||||
splen = 128;
|
||||
}
|
||||
printf("Arg Source Addr IPv6 mask len: %d\n",splen);
|
||||
break;
|
||||
case 'y':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
if ( result != NULL ) {
|
||||
printf("Arg Dest Addr IPv6 string: %s\n",result);
|
||||
inet_pton(AF_INET6,result,(void *)&daddr_ipv6);
|
||||
daddr_ipv6set = 1;
|
||||
} else {
|
||||
printf("Arg Dest Addr IPv6 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
if ( result != NULL ) {
|
||||
dplen = atoi(result);
|
||||
} else {
|
||||
dplen = 128;
|
||||
}
|
||||
printf("Arg Dest Addr IPv6 mask len: %d\n",dplen);
|
||||
break;
|
||||
case 'z':
|
||||
dscpset=1;
|
||||
strcpy(dscp,optarg);
|
||||
break;
|
||||
case '?':
|
||||
if (isprint (optopt))
|
||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Unknown option character `\\x%x'.\n",
|
||||
optopt);
|
||||
return 1;
|
||||
default:
|
||||
abort ();
|
||||
while ((c = getopt (argc, argv, "adr:i:c:f:l:m:s:t:x:y:z:")) != -1)
|
||||
switch (c) {
|
||||
case 'a':
|
||||
action = ADD_RB;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
action = DEL_RB;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
strcpy(rb,optarg);
|
||||
rbset = 1;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
strcpy(inst,optarg);
|
||||
instset = 1;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
strcpy(cx,optarg);
|
||||
cxset = 1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
strcpy(classref,optarg);
|
||||
classrefset = 1;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
strcpy(mpls_outgoinglabel,optarg);
|
||||
mpls_outlabelset=1;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
strcpy(mpls_incominglabel,optarg);
|
||||
mpls_inlabelset=1;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
inet_aton(result,&saddr_ipv4);
|
||||
printf("Arg Source Addr IPv4 string: %s\n",result);
|
||||
saddr_ipv4set = 1;
|
||||
} else {
|
||||
printf("Arg Source Addr IPv4 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
splen = atoi(result);
|
||||
} else {
|
||||
splen = 32;
|
||||
}
|
||||
|
||||
printf("Arg Source Addr IPv4 mask len: %d\n",splen);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
inet_aton(result,&daddr_ipv4);
|
||||
printf("Arg Dest Addr IPv4 string: %s\n",result);
|
||||
daddr_ipv4set = 1;
|
||||
} else {
|
||||
printf("Arg Dest Addr IPv4 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
dplen = atoi(result);
|
||||
} else {
|
||||
dplen = 32;
|
||||
}
|
||||
|
||||
printf("Arg Dest Addr IPv4 mask len: %d\n",dplen);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
printf("Arg Source Addr IPv6 string: %s\n",result);
|
||||
inet_pton(AF_INET6,result,(void *)&saddr_ipv6);
|
||||
saddr_ipv6set = 1;
|
||||
} else {
|
||||
printf("Arg Source Addr IPv6 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
splen = atoi(result);
|
||||
} else {
|
||||
splen = 128;
|
||||
}
|
||||
|
||||
printf("Arg Source Addr IPv6 mask len: %d\n",splen);
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
result = strtok( optarg, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
printf("Arg Dest Addr IPv6 string: %s\n",result);
|
||||
inet_pton(AF_INET6,result,(void *)&daddr_ipv6);
|
||||
daddr_ipv6set = 1;
|
||||
} else {
|
||||
printf("Arg Dest Addr IPv6 string: ERROR\n");
|
||||
break;
|
||||
}
|
||||
|
||||
result = strtok( NULL, mask_len_delims );
|
||||
|
||||
if ( result != NULL ) {
|
||||
dplen = atoi(result);
|
||||
} else {
|
||||
dplen = 128;
|
||||
}
|
||||
|
||||
printf("Arg Dest Addr IPv6 mask len: %d\n",dplen);
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
dscpset=1;
|
||||
strcpy(dscp,optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isprint (optopt))
|
||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Unknown option character `\\x%x'.\n",
|
||||
optopt);
|
||||
|
||||
return 1;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
printf ("action = %d, rb = %s,cx = %s\n", action, rb, cx);
|
||||
printf ("action = %d, rb = %s,cx = %s\n", action, rb, cx);
|
||||
|
||||
if (rbset==0) {
|
||||
printf("ERROR: Specify a RAB id!!\n");
|
||||
exit(-1);
|
||||
}
|
||||
if (cxset==0) {
|
||||
printf("ERROR: Specify an LCR !!\n");
|
||||
exit(-1);
|
||||
}
|
||||
if (classrefset==0) {
|
||||
printf("ERROR: Specify an Class reference !!\n");
|
||||
exit(-1);
|
||||
}
|
||||
if (instset==0){
|
||||
printf("ERROR: Specify an interface !!\n");
|
||||
exit(-1);
|
||||
}
|
||||
if ((mpls_outlabelset == 0) && (saddr_ipv4set==0) && (saddr_ipv6set==0)) {
|
||||
printf("ERROR: Specify a source IP address\n");
|
||||
exit(-1);
|
||||
}
|
||||
if ((mpls_outlabelset == 0) && (daddr_ipv4set==0) && (daddr_ipv6set==0)) {
|
||||
printf("ERROR: Specify a destination IP address\n");
|
||||
exit(-1);
|
||||
}
|
||||
if ((mpls_outlabelset == 1) && (mpls_inlabelset == 0)) {
|
||||
printf("ERROR: Specify an incoming MPLS label\n");
|
||||
exit(-1);
|
||||
}
|
||||
if ((mpls_inlabelset == 1) && (mpls_outlabelset == 0)) {
|
||||
printf("ERROR: Specify an outgoing MPLS label\n");
|
||||
exit(-1);
|
||||
if (rbset==0) {
|
||||
printf("ERROR: Specify a RAB id!!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (cxset==0) {
|
||||
printf("ERROR: Specify an LCR !!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (classrefset==0) {
|
||||
printf("ERROR: Specify an Class reference !!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (instset==0) {
|
||||
printf("ERROR: Specify an interface !!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((mpls_outlabelset == 0) && (saddr_ipv4set==0) && (saddr_ipv6set==0)) {
|
||||
printf("ERROR: Specify a source IP address\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((mpls_outlabelset == 0) && (daddr_ipv4set==0) && (daddr_ipv6set==0)) {
|
||||
printf("ERROR: Specify a destination IP address\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((mpls_outlabelset == 1) && (mpls_inlabelset == 0)) {
|
||||
printf("ERROR: Specify an incoming MPLS label\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((mpls_inlabelset == 1) && (mpls_outlabelset == 0)) {
|
||||
printf("ERROR: Specify an outgoing MPLS label\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
IAL_NAS_ioctl_init(atoi(inst));
|
||||
|
||||
msgreq = (struct oai_nw_drv_msg_rb_establishment_request *)(gifr.msg);
|
||||
msgreq->rab_id = atoi(rb);
|
||||
msgreq->lcr = atoi(cx);
|
||||
msgreq->qos = 0;
|
||||
|
||||
|
||||
if (action == ADD_RB) {
|
||||
gifr.type = OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST;
|
||||
printf("OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST: RB %d LCR %d QOS %d\n ", msgreq->rab_id, msgreq->lcr, msgreq->qos);
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
}
|
||||
|
||||
// only add classification rule
|
||||
if ((action == ADD_RB ) || (action == NO_ACTION_RB)) {
|
||||
if (saddr_ipv4set == 1) {
|
||||
msgreq_class = (struct oai_nw_drv_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 4;
|
||||
msgreq_class->classref = atoi(classref) + (msgreq_class->lcr<<8);
|
||||
msgreq_class->dir = OAI_NW_DRV_DIRECTION_SEND;
|
||||
msgreq_class->fct = OAI_NW_DRV_FCT_QOS_SEND;
|
||||
msgreq_class->saddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->daddr.ipv4 = daddr_ipv4;
|
||||
msgreq_class->dplen = dplen;
|
||||
msgreq_class->splen = splen;
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
|
||||
|
||||
if (dscpset==0) {
|
||||
msgreq_class->dscp=0;
|
||||
} else {
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
}
|
||||
|
||||
printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_SEND RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
|
||||
printf("IPV4: Source = %d.%d.%d.%d/%d ", NIPADDR(msgreq_class->saddr.ipv4), msgreq_class->splen);
|
||||
printf(" IPV4: Dest = %d.%d.%d.%d/%d\n", NIPADDR(msgreq_class->daddr.ipv4), msgreq_class->dplen);
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 4;
|
||||
msgreq_class->classref = atoi(classref) + 1 + (msgreq_class->lcr<<8);
|
||||
msgreq_class->dir = OAI_NW_DRV_DIRECTION_RECEIVE;
|
||||
msgreq_class->fct = OAI_NW_DRV_FCT_QOS_SEND;
|
||||
msgreq_class->daddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->saddr.ipv4 = daddr_ipv4;
|
||||
msgreq_class->dplen = splen;
|
||||
msgreq_class->splen = dplen;
|
||||
printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_RECEIVE RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
|
||||
printf("IPV4: Source = %d.%d.%d.%d/%d ", NIPADDR(msgreq_class->saddr.ipv4), msgreq_class->splen);
|
||||
printf("IPV4: Dest = %d.%d.%d.%d/%d\n", NIPADDR(msgreq_class->daddr.ipv4), msgreq_class->dplen);
|
||||
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
}
|
||||
|
||||
IAL_NAS_ioctl_init(atoi(inst));
|
||||
if (saddr_ipv6set == 1) {
|
||||
msgreq_class = (struct oai_nw_drv_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 6;
|
||||
msgreq_class->dplen = dplen;
|
||||
msgreq_class->splen = splen;
|
||||
|
||||
msgreq = (struct oai_nw_drv_msg_rb_establishment_request *)(gifr.msg);
|
||||
msgreq->rab_id = atoi(rb);
|
||||
msgreq->lcr = atoi(cx);
|
||||
msgreq->qos = 0;
|
||||
if (dscpset==0)
|
||||
msgreq_class->dscp = 0;
|
||||
else
|
||||
msgreq_class->dscp = atoi(dscp);
|
||||
|
||||
msgreq_class->classref = atoi(classref) + (msgreq_class->lcr<<8);
|
||||
msgreq_class->dir = OAI_NW_DRV_DIRECTION_SEND;
|
||||
msgreq_class->fct = OAI_NW_DRV_FCT_QOS_SEND;
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
|
||||
|
||||
if (action == ADD_RB) {
|
||||
gifr.type = OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST;
|
||||
printf("OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST: RB %d LCR %d QOS %d\n ", msgreq->rab_id, msgreq->lcr, msgreq->qos);
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
memcpy(&msgreq_class->saddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->daddr.ipv6,&daddr_ipv6,16);
|
||||
printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_SEND RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
|
||||
printf("IPV6: Source = %x:%x:%x:%x:%x:%x:%x:%x/%d ", NIP6ADDR(&msgreq_class->saddr.ipv6), msgreq_class->splen);
|
||||
printf("IPV6: Dest = %x:%x:%x:%x:%x:%x:%x:%x/%d\n", NIP6ADDR(&msgreq_class->daddr.ipv6), msgreq_class->dplen);
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->dplen = splen;
|
||||
msgreq_class->splen = dplen;
|
||||
msgreq_class->classref = atoi(classref) + 1 + (msgreq_class->lcr<<8);
|
||||
msgreq_class->dir = OAI_NW_DRV_DIRECTION_RECEIVE;
|
||||
memcpy(&msgreq_class->daddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->saddr.ipv6,&daddr_ipv6,16);
|
||||
printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_RECEIVE RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
|
||||
printf("IPV6: Source = %x:%x:%x:%x:%x:%x:%x:%x/%d ", NIP6ADDR(&msgreq_class->saddr.ipv6), msgreq_class->splen);
|
||||
printf("IPV6: Dest = %x:%x:%x:%x:%x:%x:%x:%x/%d\n", NIP6ADDR(&msgreq_class->daddr.ipv6), msgreq_class->dplen);
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
}
|
||||
// only add classification rule
|
||||
if ((action == ADD_RB ) || (action == NO_ACTION_RB)) {
|
||||
if (saddr_ipv4set == 1) {
|
||||
msgreq_class = (struct oai_nw_drv_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 4;
|
||||
msgreq_class->classref = atoi(classref) + (msgreq_class->lcr<<8);
|
||||
msgreq_class->dir = OAI_NW_DRV_DIRECTION_SEND;
|
||||
msgreq_class->fct = OAI_NW_DRV_FCT_QOS_SEND;
|
||||
msgreq_class->saddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->daddr.ipv4 = daddr_ipv4;
|
||||
msgreq_class->dplen = dplen;
|
||||
msgreq_class->splen = splen;
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
|
||||
if (dscpset==0) {
|
||||
msgreq_class->dscp=0;
|
||||
} else {
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
}
|
||||
printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_SEND RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
|
||||
printf("IPV4: Source = %d.%d.%d.%d/%d ", NIPADDR(msgreq_class->saddr.ipv4), msgreq_class->splen);
|
||||
printf(" IPV4: Dest = %d.%d.%d.%d/%d\n", NIPADDR(msgreq_class->daddr.ipv4), msgreq_class->dplen);
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
|
||||
if (mpls_inlabelset == 1) {
|
||||
|
||||
msgreq_class = (struct oai_nw_drv_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = OAI_NW_DRV_MPLS_VERSION_CODE;
|
||||
|
||||
if (dscpset==0)
|
||||
msgreq_class->dscp=0;
|
||||
else
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
|
||||
msgreq_class->classref = atoi(classref) + (msgreq_class->lcr<<8);
|
||||
//msgreq_class->classref = 4 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=OAI_NW_DRV_DIRECTION_SEND;
|
||||
msgreq_class->fct=OAI_NW_DRV_FCT_QOS_SEND;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_outlabel = atoi(mpls_outgoinglabel);
|
||||
|
||||
printf("Setting MPLS outlabel %d with exp %d\n",mpls_outlabel,msgreq_class->dscp);
|
||||
|
||||
msgreq_class->daddr.mpls_label = mpls_outlabel;
|
||||
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = atoi(classref) + 1 + (msgreq_class->lcr<<8);
|
||||
//msgreq_class->classref = 5 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=OAI_NW_DRV_DIRECTION_RECEIVE;
|
||||
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 4;
|
||||
msgreq_class->classref = atoi(classref) + 1 + (msgreq_class->lcr<<8);
|
||||
msgreq_class->dir = OAI_NW_DRV_DIRECTION_RECEIVE;
|
||||
msgreq_class->fct = OAI_NW_DRV_FCT_QOS_SEND;
|
||||
msgreq_class->daddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->saddr.ipv4 = daddr_ipv4;
|
||||
msgreq_class->dplen = splen;
|
||||
msgreq_class->splen = dplen;
|
||||
printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_RECEIVE RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
|
||||
printf("IPV4: Source = %d.%d.%d.%d/%d ", NIPADDR(msgreq_class->saddr.ipv4), msgreq_class->splen);
|
||||
printf("IPV4: Dest = %d.%d.%d.%d/%d\n", NIPADDR(msgreq_class->daddr.ipv4), msgreq_class->dplen);
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
|
||||
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
}
|
||||
mpls_inlabel = atoi(mpls_incominglabel);
|
||||
|
||||
if (saddr_ipv6set == 1) {
|
||||
msgreq_class = (struct oai_nw_drv_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 6;
|
||||
msgreq_class->dplen = dplen;
|
||||
msgreq_class->splen = splen;
|
||||
if (dscpset==0)
|
||||
msgreq_class->dscp = 0;
|
||||
else
|
||||
msgreq_class->dscp = atoi(dscp);
|
||||
msgreq_class->classref = atoi(classref) + (msgreq_class->lcr<<8);
|
||||
msgreq_class->dir = OAI_NW_DRV_DIRECTION_SEND;
|
||||
msgreq_class->fct = OAI_NW_DRV_FCT_QOS_SEND;
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
|
||||
printf("Setting MPLS inlabel %d with exp %d\n",mpls_inlabel,msgreq_class->dscp);
|
||||
|
||||
memcpy(&msgreq_class->saddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->daddr.ipv6,&daddr_ipv6,16);
|
||||
printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_SEND RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
|
||||
printf("IPV6: Source = %x:%x:%x:%x:%x:%x:%x:%x/%d ", NIP6ADDR(&msgreq_class->saddr.ipv6), msgreq_class->splen);
|
||||
printf("IPV6: Dest = %x:%x:%x:%x:%x:%x:%x:%x/%d\n", NIP6ADDR(&msgreq_class->daddr.ipv6), msgreq_class->dplen);
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
msgreq_class->daddr.mpls_label = mpls_inlabel;
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->dplen = splen;
|
||||
msgreq_class->splen = dplen;
|
||||
msgreq_class->classref = atoi(classref) + 1 + (msgreq_class->lcr<<8);
|
||||
msgreq_class->dir = OAI_NW_DRV_DIRECTION_RECEIVE;
|
||||
memcpy(&msgreq_class->daddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->saddr.ipv6,&daddr_ipv6,16);
|
||||
printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_RECEIVE RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
|
||||
printf("IPV6: Source = %x:%x:%x:%x:%x:%x:%x:%x/%d ", NIP6ADDR(&msgreq_class->saddr.ipv6), msgreq_class->splen);
|
||||
printf("IPV6: Dest = %x:%x:%x:%x:%x:%x:%x:%x/%d\n", NIP6ADDR(&msgreq_class->daddr.ipv6), msgreq_class->dplen);
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
}
|
||||
|
||||
if (mpls_inlabelset == 1) {
|
||||
|
||||
msgreq_class = (struct oai_nw_drv_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = OAI_NW_DRV_MPLS_VERSION_CODE;
|
||||
if (dscpset==0)
|
||||
msgreq_class->dscp=0;
|
||||
else
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
|
||||
msgreq_class->classref = atoi(classref) + (msgreq_class->lcr<<8);
|
||||
//msgreq_class->classref = 4 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=OAI_NW_DRV_DIRECTION_SEND;
|
||||
msgreq_class->fct=OAI_NW_DRV_FCT_QOS_SEND;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_outlabel = atoi(mpls_outgoinglabel);
|
||||
|
||||
printf("Setting MPLS outlabel %d with exp %d\n",mpls_outlabel,msgreq_class->dscp);
|
||||
|
||||
msgreq_class->daddr.mpls_label = mpls_outlabel;
|
||||
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = atoi(classref) + 1 + (msgreq_class->lcr<<8);
|
||||
//msgreq_class->classref = 5 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=OAI_NW_DRV_DIRECTION_RECEIVE;
|
||||
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_inlabel = atoi(mpls_incominglabel);
|
||||
|
||||
printf("Setting MPLS inlabel %d with exp %d\n",mpls_inlabel,msgreq_class->dscp);
|
||||
|
||||
msgreq_class->daddr.mpls_label = mpls_inlabel;
|
||||
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
}
|
||||
|
||||
} else if (action == DEL_RB) {
|
||||
gifr.type = OAI_NW_DRV_MSG_RB_RELEASE_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
}
|
||||
|
||||
} else if (action == DEL_RB) {
|
||||
gifr.type = OAI_NW_DRV_MSG_RB_RELEASE_REQUEST;
|
||||
err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,8 @@
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Find the IP traffic type (UNICAST, MULTICAST, BROADCAST)
|
||||
ip_traffic_type_t oai_nw_drv_find_traffic_type(struct sk_buff *skb) {
|
||||
ip_traffic_type_t oai_nw_drv_find_traffic_type(struct sk_buff *skb)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
ip_traffic_type_t traffic_type = TRAFFIC_IPVX_TYPE_UNKNOWN;
|
||||
|
||||
@@ -158,39 +159,44 @@ ip_traffic_type_t oai_nw_drv_find_traffic_type(struct sk_buff *skb) {
|
||||
switch (ntohs(skb->protocol)) {
|
||||
case ETH_P_IPV6:
|
||||
traffic_type = TRAFFIC_IPV6_TYPE_UNKNOWN;
|
||||
#ifdef OAI_DRV_DEBUG_CLASS
|
||||
#ifdef OAI_DRV_DEBUG_CLASS
|
||||
printk("SOURCE ADDR %X:%X:%X:%X:%X:%X:%X:%X",NIP6ADDR(&(ipv6_hdr(skb)->saddr)));
|
||||
printk(" DEST ADDR %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(&(ipv6_hdr(skb)->daddr)));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (IN6_IS_ADDR_MULTICAST(&ipv6_hdr(skb)->daddr.in6_u.u6_addr32[0])) {
|
||||
traffic_type = TRAFFIC_IPV6_TYPE_MULTICAST;
|
||||
traffic_type = TRAFFIC_IPV6_TYPE_MULTICAST;
|
||||
|
||||
} else {
|
||||
traffic_type = TRAFFIC_IPV6_TYPE_UNICAST;
|
||||
traffic_type = TRAFFIC_IPV6_TYPE_UNICAST;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
case ETH_P_IP:
|
||||
traffic_type = TRAFFIC_IPV4_TYPE_UNKNOWN;
|
||||
|
||||
//print_TOOL_pk_ipv4((struct iphdr *)skb->network_header);
|
||||
if (IN_MULTICAST(htonl(ip_hdr(skb)->daddr))) {
|
||||
traffic_type = TRAFFIC_IPV4_TYPE_MULTICAST;
|
||||
traffic_type = TRAFFIC_IPV4_TYPE_MULTICAST;
|
||||
} else {
|
||||
traffic_type = TRAFFIC_IPV4_TYPE_UNICAST;
|
||||
traffic_type = TRAFFIC_IPV4_TYPE_UNICAST;
|
||||
}
|
||||
|
||||
// TO DO BROADCAST
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case ETH_P_ARP:
|
||||
traffic_type = TRAFFIC_IPV4_TYPE_BROADCAST;
|
||||
break;
|
||||
|
||||
default:;
|
||||
|
||||
case ETH_P_ARP:
|
||||
traffic_type = TRAFFIC_IPV4_TYPE_BROADCAST;
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
return traffic_type;
|
||||
}
|
||||
|
||||
|
||||
+290
-262
@@ -71,255 +71,281 @@
|
||||
//#define OAI_DRV_DEBUG_SEND
|
||||
//#define OAI_DRV_DEBUG_RECEIVE
|
||||
void oai_nw_drv_common_class_wireless2ip(uint16_t dlen,
|
||||
void *pdcp_sdu,
|
||||
int inst,
|
||||
OaiNwDrvRadioBearerId_t rb_id) {
|
||||
void *pdcp_sdu,
|
||||
int inst,
|
||||
OaiNwDrvRadioBearerId_t rb_id)
|
||||
{
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct sk_buff *skb;
|
||||
struct ipversion *ipv;
|
||||
struct oai_nw_drv_priv *gpriv=netdev_priv(oai_nw_drv_dev[inst]);
|
||||
unsigned int hard_header_len = 0;
|
||||
uint16_t *p_ether_type;
|
||||
uint16_t ether_type;
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
int i;
|
||||
unsigned char *addr;
|
||||
#endif
|
||||
unsigned char protocol;
|
||||
struct iphdr *network_header;
|
||||
struct sk_buff *skb;
|
||||
struct ipversion *ipv;
|
||||
struct oai_nw_drv_priv *gpriv=netdev_priv(oai_nw_drv_dev[inst]);
|
||||
unsigned int hard_header_len = 0;
|
||||
uint16_t *p_ether_type;
|
||||
uint16_t ether_type;
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
int i;
|
||||
unsigned char *addr;
|
||||
#endif
|
||||
unsigned char protocol;
|
||||
struct iphdr *network_header;
|
||||
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__, rb_id,inst,dlen);
|
||||
#endif
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__, rb_id,inst,dlen);
|
||||
#endif
|
||||
|
||||
skb = dev_alloc_skb( dlen + 2 );
|
||||
skb = dev_alloc_skb( dlen + 2 );
|
||||
|
||||
if(!skb) {
|
||||
printk("[OAI_IP_DRV][%s] low on memory\n",__FUNCTION__);
|
||||
++gpriv->stats.rx_dropped;
|
||||
return;
|
||||
}
|
||||
skb_reserve(skb,2);
|
||||
memcpy(skb_put(skb, dlen), pdcp_sdu,dlen);
|
||||
if(!skb) {
|
||||
printk("[OAI_IP_DRV][%s] low on memory\n",__FUNCTION__);
|
||||
++gpriv->stats.rx_dropped;
|
||||
return;
|
||||
}
|
||||
|
||||
skb->dev = oai_nw_drv_dev[inst];
|
||||
hard_header_len = oai_nw_drv_dev[inst]->hard_header_len;
|
||||
skb_reserve(skb,2);
|
||||
memcpy(skb_put(skb, dlen), pdcp_sdu,dlen);
|
||||
|
||||
skb_set_mac_header(skb, 0);
|
||||
skb->dev = oai_nw_drv_dev[inst];
|
||||
hard_header_len = oai_nw_drv_dev[inst]->hard_header_len;
|
||||
|
||||
skb_set_mac_header(skb, 0);
|
||||
skb_set_network_header(skb, hard_header_len);
|
||||
skb->mark = rb_id;
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
|
||||
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] Receiving packet @%p of size %d from PDCP \n",__FUNCTION__, skb->data, skb->len);
|
||||
|
||||
for (i=0; i<skb->len; i++)
|
||||
printk("%2x ",((unsigned char *)(skb->data))[i]);
|
||||
|
||||
printk("\n");
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// LG TEST skb->ip_summed = CHECKSUM_NONE;
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
|
||||
|
||||
ipv = (struct ipversion *)skb_network_header(skb);
|
||||
|
||||
switch (ipv->version) {
|
||||
|
||||
case 6:
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] receive IPv6 message\n",__FUNCTION__);
|
||||
#endif
|
||||
skb_set_network_header(skb, hard_header_len);
|
||||
skb->mark = rb_id;
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
|
||||
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] Receiving packet @%p of size %d from PDCP \n",__FUNCTION__, skb->data, skb->len);
|
||||
|
||||
for (i=0;i<skb->len;i++)
|
||||
printk("%2x ",((unsigned char *)(skb->data))[i]);
|
||||
printk("\n");
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// LG TEST skb->ip_summed = CHECKSUM_NONE;
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
|
||||
|
||||
ipv = (struct ipversion *)skb_network_header(skb);
|
||||
|
||||
switch (ipv->version) {
|
||||
|
||||
case 6:
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] receive IPv6 message\n",__FUNCTION__);
|
||||
#endif
|
||||
skb_set_network_header(skb, hard_header_len);
|
||||
//skb->network_header = &skb->data[hard_header_len];
|
||||
if (hard_header_len == 0) {
|
||||
skb->protocol = htons(ETH_P_IPV6);
|
||||
} else {
|
||||
#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
|
||||
skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]);
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
//printk("Writing packet with protocol %x\n",ntohs(skb->protocol));
|
||||
break;
|
||||
|
||||
case 4:
|
||||
#ifdef NAS_ADDRESS_FIX
|
||||
// Make the third byte of both the source and destination equal to the fourth of the destination
|
||||
daddr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
|
||||
odaddr = ((struct iphdr *)skb->data)->daddr;
|
||||
//sn = addr[3];
|
||||
saddr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
|
||||
osaddr = ((struct iphdr *)&skb->data[hard_header_len])->saddr;
|
||||
|
||||
if (daddr[0] == saddr[0]) {// same network
|
||||
daddr[2] = daddr[3]; // set third byte of destination to that of local machine so that local IP stack accepts the packet
|
||||
saddr[2] = daddr[3]; // set third byte of source to that of local machine so that local IP stack accepts the packet
|
||||
} else { // get the 3rd byte from device address in net_device structure
|
||||
ifaddr = (unsigned char *)(&(((struct in_device *)((oai_nw_drv_dev[inst])->ip_ptr))->ifa_list->ifa_local));
|
||||
if (saddr[0] == ifaddr[0]) { // source is in same network as local machine
|
||||
daddr[0] += saddr[3]; // fix address of remote destination to undo change at source
|
||||
saddr[2] = ifaddr[2]; // set third byte to that of local machine so that local IP stack accepts the packet
|
||||
} else { // source is remote machine from outside network
|
||||
saddr[0] -= daddr[3]; // fix address of remote source to be understood by destination
|
||||
daddr[2] = daddr[3]; // fix 3rd byte of local address to be understood by IP stack of
|
||||
// destination
|
||||
}
|
||||
}
|
||||
#endif //NAS_ADDRESS_FIX
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
//printk("NAS_TOOL_RECEIVE: receive IPv4 message\n");
|
||||
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
|
||||
if (addr) {
|
||||
//addr[2]^=0x01;
|
||||
printk("[OAI_IP_DRV][%s] Source %d.%d.%d.%d\n",__FUNCTION__, addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
|
||||
if (addr){
|
||||
//addr[2]^=0x01;
|
||||
printk("[OAI_IP_DRV][%s] Dest %d.%d.%d.%d\n",__FUNCTION__, addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
printk("[OAI_IP_DRV][%s] protocol %d\n",__FUNCTION__, ((struct iphdr *)&skb->data[hard_header_len])->protocol);
|
||||
#endif
|
||||
|
||||
skb_set_network_header(skb, hard_header_len);
|
||||
//skb->network_header = &skb->data[hard_header_len];
|
||||
network_header = (struct iphdr *)skb_network_header(skb);
|
||||
protocol = network_header->protocol;
|
||||
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
switch (protocol) {
|
||||
case IPPROTO_IP:
|
||||
printk("[OAI_IP_DRV][%s] Received Raw IPv4 packet\n",__FUNCTION__);
|
||||
break;
|
||||
case IPPROTO_IPV6:
|
||||
printk("[OAI_IP_DRV][%s] Received Raw IPv6 packet\n",__FUNCTION__);
|
||||
break;
|
||||
case IPPROTO_ICMP:
|
||||
printk("[OAI_IP_DRV][%s] Received Raw ICMP packet\n",__FUNCTION__);
|
||||
break;
|
||||
case IPPROTO_TCP:
|
||||
printk("[OAI_IP_DRV][%s] Received TCP packet\n",__FUNCTION__);
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
printk("[OAI_IP_DRV][%s] Received UDP packet\n",__FUNCTION__);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NAS_ADDRESS_FIX
|
||||
network_header->check = 0;
|
||||
network_header->check = ip_fast_csum((unsigned char *) network_header, network_header->ihl);
|
||||
//printk("[OAI_IP_DRV][COMMON][RECEIVE] IP Fast Checksum %x \n", network_header->check);
|
||||
|
||||
switch(protocol) {
|
||||
case IPPROTO_TCP:
|
||||
|
||||
cksum = (uint16_t*)&(((struct tcphdr*)((network_header + (network_header->ihl<<2))))->check);
|
||||
check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum));
|
||||
//check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum));
|
||||
//check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_TCP, ~(*cksum));
|
||||
|
||||
*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, 0, 0, ~check);
|
||||
//*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, dlen, IPPROTO_TCP, ~check);
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] Inst %d TCP packet calculated CS %x, CS = %x (before), SA (%x)%x, DA (%x)%x\n",__FUNCTION__,
|
||||
inst,
|
||||
network_header->check,
|
||||
*cksum,
|
||||
osaddr,
|
||||
((struct iphdr *)skb->data)->saddr,
|
||||
odaddr,
|
||||
((struct iphdr *)skb->data)->daddr);
|
||||
|
||||
printk("[OAI_IP_DRV][%s] Inst %d TCP packet NEW CS %x\n",__FUNCTION__,
|
||||
inst,
|
||||
*cksum);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case IPPROTO_UDP:
|
||||
cksum = (uint16_t*)&(((struct udphdr*)((network_header + (network_header->ihl<<2))))->check);
|
||||
check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum));
|
||||
// check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum));
|
||||
//check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_UDP, ~(*cksum));
|
||||
|
||||
*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,0,0, ~check);
|
||||
//*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,udp_hdr(skb)->len, IPPROTO_UDP, ~check);
|
||||
//*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,dlen, IPPROTO_UDP, ~check);
|
||||
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] Inst %d UDP packet CS = %x (before), SA (%x)%x, DA (%x)%x\n",__FUNCTION__,
|
||||
inst,*cksum,osaddr,((struct iphdr *)&skb->data[hard_header_len])->saddr,odaddr,((struct iphdr *)&skb->data[hard_header_len])->daddr);
|
||||
|
||||
printk("[OAI_IP_DRV][%s] Inst %d UDP packet NEW CS %x\n",__FUNCTION__,inst,*cksum);
|
||||
#endif
|
||||
//if ((check = *cksum) != 0) {
|
||||
// src, dst, len, proto, sum
|
||||
// }
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif //NAS_ADDRESS_FIX
|
||||
if (hard_header_len == 0) {
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
} else {
|
||||
#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
|
||||
skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]);
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
//printk("[OAI_IP_DRV][COMMON] Writing packet with protocol %x\n",ntohs(skb->protocol));
|
||||
break;
|
||||
|
||||
default:
|
||||
// fill skb->pkt_type, skb->dev
|
||||
|
||||
skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]);
|
||||
// minus 1(short) instead of 2(bytes) because uint16_t*
|
||||
p_ether_type = (uint16_t *)(skb_network_header(skb)-2);
|
||||
ether_type = ntohs(*p_ether_type);
|
||||
|
||||
switch (ether_type) {
|
||||
case ETH_P_ARP:
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] ether_type = ETH_P_ARP\n",__FUNCTION__);
|
||||
#endif
|
||||
//skb->pkt_type = PACKET_HOST;
|
||||
skb->protocol = htons(ETH_P_ARP);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__,rb_id,inst,dlen);
|
||||
printk("[OAI_IP_DRV][%s] Inst %d: receive unknown message (version=%d)\n",__FUNCTION__,inst,ipv->version);
|
||||
//skb->network_header = &skb->data[hard_header_len];
|
||||
if (hard_header_len == 0) {
|
||||
skb->protocol = htons(ETH_P_IPV6);
|
||||
} else {
|
||||
#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
|
||||
skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]);
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
++gpriv->stats.rx_packets;
|
||||
gpriv->stats.rx_bytes += dlen;
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] sending packet of size %d to kernel\n",__FUNCTION__,skb->len);
|
||||
for (i=0;i<skb->len;i++)
|
||||
printk("%2x ",((unsigned char *)(skb->data))[i]);
|
||||
printk("\n");
|
||||
#endif //OAI_DRV_DEBUG_RECEIVE
|
||||
netif_rx(skb);
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] end\n",__FUNCTION__);
|
||||
#endif
|
||||
//printk("Writing packet with protocol %x\n",ntohs(skb->protocol));
|
||||
break;
|
||||
|
||||
case 4:
|
||||
#ifdef NAS_ADDRESS_FIX
|
||||
// Make the third byte of both the source and destination equal to the fourth of the destination
|
||||
daddr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
|
||||
odaddr = ((struct iphdr *)skb->data)->daddr;
|
||||
//sn = addr[3];
|
||||
saddr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
|
||||
osaddr = ((struct iphdr *)&skb->data[hard_header_len])->saddr;
|
||||
|
||||
if (daddr[0] == saddr[0]) {// same network
|
||||
daddr[2] = daddr[3]; // set third byte of destination to that of local machine so that local IP stack accepts the packet
|
||||
saddr[2] = daddr[3]; // set third byte of source to that of local machine so that local IP stack accepts the packet
|
||||
} else { // get the 3rd byte from device address in net_device structure
|
||||
ifaddr = (unsigned char *)(&(((struct in_device *)((oai_nw_drv_dev[inst])->ip_ptr))->ifa_list->ifa_local));
|
||||
|
||||
if (saddr[0] == ifaddr[0]) { // source is in same network as local machine
|
||||
daddr[0] += saddr[3]; // fix address of remote destination to undo change at source
|
||||
saddr[2] = ifaddr[2]; // set third byte to that of local machine so that local IP stack accepts the packet
|
||||
} else { // source is remote machine from outside network
|
||||
saddr[0] -= daddr[3]; // fix address of remote source to be understood by destination
|
||||
daddr[2] = daddr[3]; // fix 3rd byte of local address to be understood by IP stack of
|
||||
// destination
|
||||
}
|
||||
}
|
||||
|
||||
#endif //NAS_ADDRESS_FIX
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
//printk("NAS_TOOL_RECEIVE: receive IPv4 message\n");
|
||||
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
|
||||
|
||||
if (addr) {
|
||||
//addr[2]^=0x01;
|
||||
printk("[OAI_IP_DRV][%s] Source %d.%d.%d.%d\n",__FUNCTION__, addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
|
||||
addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
|
||||
|
||||
if (addr) {
|
||||
//addr[2]^=0x01;
|
||||
printk("[OAI_IP_DRV][%s] Dest %d.%d.%d.%d\n",__FUNCTION__, addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
|
||||
printk("[OAI_IP_DRV][%s] protocol %d\n",__FUNCTION__, ((struct iphdr *)&skb->data[hard_header_len])->protocol);
|
||||
#endif
|
||||
|
||||
skb_set_network_header(skb, hard_header_len);
|
||||
//skb->network_header = &skb->data[hard_header_len];
|
||||
network_header = (struct iphdr *)skb_network_header(skb);
|
||||
protocol = network_header->protocol;
|
||||
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
|
||||
switch (protocol) {
|
||||
case IPPROTO_IP:
|
||||
printk("[OAI_IP_DRV][%s] Received Raw IPv4 packet\n",__FUNCTION__);
|
||||
break;
|
||||
|
||||
case IPPROTO_IPV6:
|
||||
printk("[OAI_IP_DRV][%s] Received Raw IPv6 packet\n",__FUNCTION__);
|
||||
break;
|
||||
|
||||
case IPPROTO_ICMP:
|
||||
printk("[OAI_IP_DRV][%s] Received Raw ICMP packet\n",__FUNCTION__);
|
||||
break;
|
||||
|
||||
case IPPROTO_TCP:
|
||||
printk("[OAI_IP_DRV][%s] Received TCP packet\n",__FUNCTION__);
|
||||
break;
|
||||
|
||||
case IPPROTO_UDP:
|
||||
printk("[OAI_IP_DRV][%s] Received UDP packet\n",__FUNCTION__);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef NAS_ADDRESS_FIX
|
||||
network_header->check = 0;
|
||||
network_header->check = ip_fast_csum((unsigned char *) network_header, network_header->ihl);
|
||||
//printk("[OAI_IP_DRV][COMMON][RECEIVE] IP Fast Checksum %x \n", network_header->check);
|
||||
|
||||
switch(protocol) {
|
||||
case IPPROTO_TCP:
|
||||
|
||||
cksum = (uint16_t*)&(((struct tcphdr*)((network_header + (network_header->ihl<<2))))->check);
|
||||
check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum));
|
||||
//check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum));
|
||||
//check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_TCP, ~(*cksum));
|
||||
|
||||
*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, 0, 0, ~check);
|
||||
//*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, dlen, IPPROTO_TCP, ~check);
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] Inst %d TCP packet calculated CS %x, CS = %x (before), SA (%x)%x, DA (%x)%x\n",__FUNCTION__,
|
||||
inst,
|
||||
network_header->check,
|
||||
*cksum,
|
||||
osaddr,
|
||||
((struct iphdr *)skb->data)->saddr,
|
||||
odaddr,
|
||||
((struct iphdr *)skb->data)->daddr);
|
||||
|
||||
printk("[OAI_IP_DRV][%s] Inst %d TCP packet NEW CS %x\n",__FUNCTION__,
|
||||
inst,
|
||||
*cksum);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case IPPROTO_UDP:
|
||||
cksum = (uint16_t*)&(((struct udphdr*)((network_header + (network_header->ihl<<2))))->check);
|
||||
check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum));
|
||||
// check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum));
|
||||
//check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_UDP, ~(*cksum));
|
||||
|
||||
*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,0,0, ~check);
|
||||
//*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,udp_hdr(skb)->len, IPPROTO_UDP, ~check);
|
||||
//*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,dlen, IPPROTO_UDP, ~check);
|
||||
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] Inst %d UDP packet CS = %x (before), SA (%x)%x, DA (%x)%x\n",__FUNCTION__,
|
||||
inst,*cksum,osaddr,((struct iphdr *)&skb->data[hard_header_len])->saddr,odaddr,((struct iphdr *)&skb->data[hard_header_len])->daddr);
|
||||
|
||||
printk("[OAI_IP_DRV][%s] Inst %d UDP packet NEW CS %x\n",__FUNCTION__,inst,*cksum);
|
||||
#endif
|
||||
//if ((check = *cksum) != 0) {
|
||||
// src, dst, len, proto, sum
|
||||
// }
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#endif //NAS_ADDRESS_FIX
|
||||
|
||||
if (hard_header_len == 0) {
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
} else {
|
||||
#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
|
||||
skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]);
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
//printk("[OAI_IP_DRV][COMMON] Writing packet with protocol %x\n",ntohs(skb->protocol));
|
||||
break;
|
||||
|
||||
default:
|
||||
// fill skb->pkt_type, skb->dev
|
||||
|
||||
skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]);
|
||||
// minus 1(short) instead of 2(bytes) because uint16_t*
|
||||
p_ether_type = (uint16_t *)(skb_network_header(skb)-2);
|
||||
ether_type = ntohs(*p_ether_type);
|
||||
|
||||
switch (ether_type) {
|
||||
case ETH_P_ARP:
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] ether_type = ETH_P_ARP\n",__FUNCTION__);
|
||||
#endif
|
||||
//skb->pkt_type = PACKET_HOST;
|
||||
skb->protocol = htons(ETH_P_ARP);
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__,rb_id,inst,dlen);
|
||||
printk("[OAI_IP_DRV][%s] Inst %d: receive unknown message (version=%d)\n",__FUNCTION__,inst,ipv->version);
|
||||
}
|
||||
|
||||
++gpriv->stats.rx_packets;
|
||||
gpriv->stats.rx_bytes += dlen;
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] sending packet of size %d to kernel\n",__FUNCTION__,skb->len);
|
||||
|
||||
for (i=0; i<skb->len; i++)
|
||||
printk("%2x ",((unsigned char *)(skb->data))[i]);
|
||||
|
||||
printk("\n");
|
||||
#endif //OAI_DRV_DEBUG_RECEIVE
|
||||
netif_rx(skb);
|
||||
#ifdef OAI_DRV_DEBUG_RECEIVE
|
||||
printk("[OAI_IP_DRV][%s] end\n",__FUNCTION__);
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Delete the data
|
||||
void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst){
|
||||
void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct oai_nw_drv_priv *priv=netdev_priv(oai_nw_drv_dev[inst]);
|
||||
++priv->stats.tx_dropped;
|
||||
@@ -327,7 +353,8 @@ void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Request the transfer of data (QoS SAP)
|
||||
void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst){
|
||||
void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct pdcp_data_req_header_s pdcph;
|
||||
struct oai_nw_drv_priv *priv=netdev_priv(oai_nw_drv_dev[inst]);
|
||||
@@ -343,7 +370,7 @@ void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst){
|
||||
printk("[OAI_IP_DRV][%s] inst %d begin \n",__FUNCTION__,inst);
|
||||
#endif
|
||||
|
||||
if (skb==NULL){
|
||||
if (skb==NULL) {
|
||||
#ifdef OAI_DRV_DEBUG_SEND
|
||||
printk("[OAI_IP_DRV][%s] input parameter skb is NULL \n",__FUNCTION__);
|
||||
#endif
|
||||
@@ -359,39 +386,39 @@ void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst){
|
||||
bytes_wrote = oai_nw_drv_netlink_send((char *)&pdcph,OAI_NW_DRV_PDCPH_SIZE);
|
||||
#ifdef OAI_DRV_DEBUG_SEND
|
||||
printk("[OAI_IP_DRV][%s] Wrote %d bytes (header for %d byte skb) to PDCP RB %d via netlink\n",__FUNCTION__,
|
||||
bytes_wrote,skb->len, pdcph.rb_id);
|
||||
bytes_wrote,skb->len, pdcph.rb_id);
|
||||
#endif
|
||||
|
||||
|
||||
if (bytes_wrote != OAI_NW_DRV_PDCPH_SIZE)
|
||||
{
|
||||
printk("[OAI_IP_DRV][%s] problem while writing PDCP's header (bytes wrote = %d to fifo %d)\n",__FUNCTION__,bytes_wrote,IP2PDCP_FIFO);
|
||||
printk("rb_id %u, Wrote %u, Header Size %lu \n", pdcph.rb_id , bytes_wrote, OAI_NW_DRV_PDCPH_SIZE);
|
||||
priv->stats.tx_dropped ++;
|
||||
return;
|
||||
}
|
||||
if (bytes_wrote != OAI_NW_DRV_PDCPH_SIZE) {
|
||||
printk("[OAI_IP_DRV][%s] problem while writing PDCP's header (bytes wrote = %d to fifo %d)\n",__FUNCTION__,bytes_wrote,IP2PDCP_FIFO);
|
||||
printk("rb_id %u, Wrote %u, Header Size %lu \n", pdcph.rb_id , bytes_wrote, OAI_NW_DRV_PDCPH_SIZE);
|
||||
priv->stats.tx_dropped ++;
|
||||
return;
|
||||
}
|
||||
|
||||
bytes_wrote += oai_nw_drv_netlink_send((char *)skb->data,skb->len);
|
||||
|
||||
|
||||
if (bytes_wrote != skb->len+OAI_NW_DRV_PDCPH_SIZE)
|
||||
{
|
||||
printk("[OAI_IP_DRV][%s] Inst %d, RB_ID %u: problem while writing PDCP's data, bytes_wrote = %u, Data_len %u, PDCPH_SIZE %lu\n",
|
||||
__FUNCTION__,
|
||||
inst,
|
||||
pdcph.rb_id,
|
||||
bytes_wrote,
|
||||
skb->len,
|
||||
OAI_NW_DRV_PDCPH_SIZE); // congestion
|
||||
if (bytes_wrote != skb->len+OAI_NW_DRV_PDCPH_SIZE) {
|
||||
printk("[OAI_IP_DRV][%s] Inst %d, RB_ID %u: problem while writing PDCP's data, bytes_wrote = %u, Data_len %u, PDCPH_SIZE %lu\n",
|
||||
__FUNCTION__,
|
||||
inst,
|
||||
pdcph.rb_id,
|
||||
bytes_wrote,
|
||||
skb->len,
|
||||
OAI_NW_DRV_PDCPH_SIZE); // congestion
|
||||
|
||||
priv->stats.tx_dropped ++;
|
||||
return;
|
||||
}
|
||||
|
||||
priv->stats.tx_dropped ++;
|
||||
return;
|
||||
}
|
||||
#ifdef OAI_DRV_DEBUG_SEND
|
||||
printk("[OAI_IP_DRV][%s] Sending packet of size %d to PDCP traffic type %d\n",__FUNCTION__,skb->len, pdcph.traffic_type);
|
||||
|
||||
for (j=0;j<skb->len;j++)
|
||||
for (j=0; j<skb->len; j++)
|
||||
printk("%2x ",((unsigned char *)(skb->data))[j]);
|
||||
|
||||
printk("\n");
|
||||
#endif
|
||||
|
||||
@@ -404,8 +431,9 @@ void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst){
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh) {
|
||||
//---------------------------------------------------------------------------
|
||||
void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
struct pdcp_data_ind_header_s *pdcph = (struct pdcp_data_ind_header_s *)NLMSG_DATA(nlh);
|
||||
struct oai_nw_drv_priv *priv;
|
||||
@@ -418,9 +446,9 @@ void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh) {
|
||||
#endif //OAI_DRV_DEBUG_RECEIVE
|
||||
|
||||
oai_nw_drv_common_class_wireless2ip(pdcph->data_size,
|
||||
(unsigned char *)NLMSG_DATA(nlh) + OAI_NW_DRV_PDCPH_SIZE,
|
||||
pdcph->inst,
|
||||
pdcph->rb_id);
|
||||
(unsigned char *)NLMSG_DATA(nlh) + OAI_NW_DRV_PDCPH_SIZE,
|
||||
pdcph->inst,
|
||||
pdcph->rb_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+212
-168
@@ -77,26 +77,29 @@ extern void oai_nw_drv_netlink_release(void);
|
||||
extern int oai_nw_drv_netlink_init(void);
|
||||
#endif
|
||||
|
||||
uint8_t NULL_IMEI[14]={0x05, 0x04, 0x03, 0x01, 0x02 ,0x00, 0x00, 0x00, 0x05, 0x04, 0x03 ,0x00, 0x01, 0x08};
|
||||
uint8_t NULL_IMEI[14]= {0x05, 0x04, 0x03, 0x01, 0x02 ,0x00, 0x00, 0x00, 0x05, 0x04, 0x03 ,0x00, 0x01, 0x08};
|
||||
|
||||
static unsigned char oai_nw_drv_IMEI[14];
|
||||
static int m_arg=0;
|
||||
static unsigned int oai_nw_drv_is_clusterhead=0;
|
||||
//---------------------------------------------------------------------------
|
||||
int oai_nw_drv_find_inst(struct net_device *dev) {
|
||||
//---------------------------------------------------------------------------
|
||||
int oai_nw_drv_find_inst(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
int i;
|
||||
|
||||
for (i=0;i<OAI_NW_DRV_NB_INSTANCES_MAX;i++)
|
||||
for (i=0; i<OAI_NW_DRV_NB_INSTANCES_MAX; i++)
|
||||
if (oai_nw_drv_dev[i] == dev)
|
||||
return(i);
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef OAI_NW_DRIVER_USE_NETLINK
|
||||
void *oai_nw_drv_interrupt(void){
|
||||
void *oai_nw_drv_interrupt(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t cxi;
|
||||
|
||||
@@ -122,7 +125,8 @@ void *oai_nw_drv_interrupt(void){
|
||||
}
|
||||
#endif //NETLINK
|
||||
//---------------------------------------------------------------------------
|
||||
void oai_nw_drv_timer(unsigned long data){
|
||||
void oai_nw_drv_timer(unsigned long data)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct oai_nw_drv_priv *priv=(struct oai_nw_drv_priv *)data;
|
||||
spin_lock(&priv->lock);
|
||||
@@ -132,28 +136,31 @@ void oai_nw_drv_timer(unsigned long data){
|
||||
add_timer(&priv->timer);
|
||||
spin_unlock(&priv->lock);
|
||||
return;
|
||||
// add_timer(&gpriv->timer);
|
||||
// spin_unlock(&gpriv->lock);
|
||||
// add_timer(&gpriv->timer);
|
||||
// spin_unlock(&gpriv->lock);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Called by ifconfig when the device is activated by ifconfig
|
||||
int oai_nw_drv_open(struct net_device *dev){
|
||||
int oai_nw_drv_open(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct oai_nw_drv_priv *priv=netdev_priv(dev);
|
||||
|
||||
// Address has already been set at init
|
||||
#ifndef OAI_NW_DRIVER_USE_NETLINK
|
||||
if (pdcp_2_oai_nw_drv_irq==-EBUSY){
|
||||
printk("[OAI_IP_DRV][%s] : irq failure\n", __FUNCTION__);
|
||||
return -EBUSY;
|
||||
|
||||
if (pdcp_2_oai_nw_drv_irq==-EBUSY) {
|
||||
printk("[OAI_IP_DRV][%s] : irq failure\n", __FUNCTION__);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
#endif //OAI_NW_DRIVER_USE_NETLINK
|
||||
|
||||
if(!netif_queue_stopped(dev))
|
||||
netif_start_queue(dev);
|
||||
netif_start_queue(dev);
|
||||
else
|
||||
netif_wake_queue(dev);
|
||||
netif_wake_queue(dev);
|
||||
|
||||
init_timer(&priv->timer);
|
||||
(priv->timer).expires = jiffies+OAI_NW_DRV_TIMER_TICK;
|
||||
@@ -167,7 +174,8 @@ int oai_nw_drv_open(struct net_device *dev){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Called by ifconfig when the device is desactivated
|
||||
int oai_nw_drv_stop(struct net_device *dev){
|
||||
int oai_nw_drv_stop(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct oai_nw_drv_priv *priv = netdev_priv(dev);
|
||||
|
||||
@@ -180,50 +188,60 @@ int oai_nw_drv_stop(struct net_device *dev){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void oai_nw_drv_teardown(struct net_device *dev){
|
||||
void oai_nw_drv_teardown(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct oai_nw_drv_priv *priv;
|
||||
int inst;
|
||||
|
||||
printk("[OAI_IP_DRV][%s] Begin\n", __FUNCTION__);
|
||||
if (dev) {
|
||||
priv = netdev_priv(dev);
|
||||
inst = oai_nw_drv_find_inst(dev);
|
||||
if ((inst<0) || (inst>=OAI_NW_DRV_NB_INSTANCES_MAX)) {
|
||||
printk("[OAI_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
/*oai_nw_drv_class_flush_recv_classifier(priv);
|
||||
|
||||
for (cxi=0;cxi<OAI_NW_DRV_CX_MAX;cxi++) {
|
||||
oai_nw_drv_common_flush_rb(priv->cx+cxi);
|
||||
oai_nw_drv_class_flush_send_classifier(priv->cx+cxi);
|
||||
}*/
|
||||
printk("[OAI_IP_DRV][%s] End\n", __FUNCTION__);
|
||||
if (dev) {
|
||||
priv = netdev_priv(dev);
|
||||
inst = oai_nw_drv_find_inst(dev);
|
||||
|
||||
if ((inst<0) || (inst>=OAI_NW_DRV_NB_INSTANCES_MAX)) {
|
||||
printk("[OAI_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
/*oai_nw_drv_class_flush_recv_classifier(priv);
|
||||
|
||||
for (cxi=0;cxi<OAI_NW_DRV_CX_MAX;cxi++) {
|
||||
oai_nw_drv_common_flush_rb(priv->cx+cxi);
|
||||
oai_nw_drv_class_flush_send_classifier(priv->cx+cxi);
|
||||
}*/
|
||||
printk("[OAI_IP_DRV][%s] End\n", __FUNCTION__);
|
||||
} // check dev
|
||||
else {
|
||||
printk("[OAI_IP_DRV][%s] Device is null\n", __FUNCTION__);
|
||||
printk("[OAI_IP_DRV][%s] Device is null\n", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int oai_nw_drv_set_config(struct net_device *dev, struct ifmap *map){
|
||||
int oai_nw_drv_set_config(struct net_device *dev, struct ifmap *map)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("[OAI_IP_DRV][%s] Begin\n", __FUNCTION__);
|
||||
|
||||
if (dev->flags & IFF_UP)
|
||||
return -EBUSY;
|
||||
return -EBUSY;
|
||||
|
||||
if (map->base_addr != dev->base_addr) {
|
||||
printk(KERN_WARNING "[OAI_IP_DRV][%s] Can't change I/O address\n", __FUNCTION__);
|
||||
return -EOPNOTSUPP;
|
||||
printk(KERN_WARNING "[OAI_IP_DRV][%s] Can't change I/O address\n", __FUNCTION__);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (map->irq != dev->irq)
|
||||
dev->irq = map->irq;
|
||||
dev->irq = map->irq;
|
||||
|
||||
printk("[OAI_IP_DRV][%s] End\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
int oai_nw_drv_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
|
||||
int oai_nw_drv_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
int inst;
|
||||
|
||||
@@ -235,66 +253,74 @@ int oai_nw_drv_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
|
||||
}
|
||||
|
||||
if ((inst>=0) && (inst<OAI_NW_DRV_NB_INSTANCES_MAX)) {
|
||||
#ifdef OAI_DRV_OAI_DRV_DEBUG_DEVICE
|
||||
printk("[OAI_IP_DRV][%s] inst %d, begin\n", __FUNCTION__,inst);
|
||||
#endif
|
||||
#ifdef OAI_DRV_OAI_DRV_DEBUG_DEVICE
|
||||
printk("[OAI_IP_DRV][%s] inst %d, begin\n", __FUNCTION__,inst);
|
||||
#endif
|
||||
|
||||
if (!skb){
|
||||
printk("[OAI_IP_DRV][%s] input parameter skb is NULL\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
// End debug information
|
||||
netif_stop_queue(dev);
|
||||
dev->trans_start = jiffies;
|
||||
#ifdef OAI_DRV_DEBUG_DEVICE
|
||||
printk("[OAI_IP_DRV][%s] step 1\n", __FUNCTION__);
|
||||
#endif
|
||||
oai_nw_drv_common_ip2wireless(skb,inst);
|
||||
#ifdef OAI_DRV_DEBUG_DEVICE
|
||||
printk("[OAI_IP_DRV][%s] step 2\n", __FUNCTION__);
|
||||
#endif
|
||||
dev_kfree_skb(skb);
|
||||
#ifdef OAI_DRV_DEBUG_DEVICE
|
||||
printk("[OAI_IP_DRV][%s] step 3\n", __FUNCTION__);
|
||||
#endif
|
||||
netif_wake_queue(dev);
|
||||
#ifdef OAI_DRV_DEBUG_DEVICE
|
||||
printk("[OAI_IP_DRV][%s] end\n", __FUNCTION__);
|
||||
#endif
|
||||
if (!skb) {
|
||||
printk("[OAI_IP_DRV][%s] input parameter skb is NULL\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
netif_stop_queue(dev);
|
||||
dev->trans_start = jiffies;
|
||||
#ifdef OAI_DRV_DEBUG_DEVICE
|
||||
printk("[OAI_IP_DRV][%s] step 1\n", __FUNCTION__);
|
||||
#endif
|
||||
oai_nw_drv_common_ip2wireless(skb,inst);
|
||||
#ifdef OAI_DRV_DEBUG_DEVICE
|
||||
printk("[OAI_IP_DRV][%s] step 2\n", __FUNCTION__);
|
||||
#endif
|
||||
dev_kfree_skb(skb);
|
||||
#ifdef OAI_DRV_DEBUG_DEVICE
|
||||
printk("[OAI_IP_DRV][%s] step 3\n", __FUNCTION__);
|
||||
#endif
|
||||
netif_wake_queue(dev);
|
||||
#ifdef OAI_DRV_DEBUG_DEVICE
|
||||
printk("[OAI_IP_DRV][%s] end\n", __FUNCTION__);
|
||||
#endif
|
||||
} else {
|
||||
printk("[OAI_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__);
|
||||
return(-1);
|
||||
printk("[OAI_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct net_device_stats *oai_nw_drv_get_stats(struct net_device *dev){
|
||||
//---------------------------------------------------------------------------
|
||||
struct net_device_stats *oai_nw_drv_get_stats(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// return &((struct oai_nw_drv_priv *)dev->priv)->stats;
|
||||
struct oai_nw_drv_priv *priv = netdev_priv(dev);
|
||||
//printk("[OAI_IP_DRV][%s]\n", __FUNCTION__);
|
||||
return &priv->stats;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int oai_nw_drv_set_mac_address(struct net_device *dev, void *mac) {
|
||||
//---------------------------------------------------------------------------
|
||||
int oai_nw_drv_set_mac_address(struct net_device *dev, void *mac)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct sockaddr *addr = mac;
|
||||
printk("[OAI_IP_DRV][%s] CHANGE MAC ADDRESS\n", __FUNCTION__);
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int oai_nw_drv_change_mtu(struct net_device *dev, int mtu){
|
||||
int oai_nw_drv_change_mtu(struct net_device *dev, int mtu)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("[OAI_IP_DRV][%s] CHANGE MTU %d bytes\n", __FUNCTION__, mtu);
|
||||
|
||||
if ((mtu<50) || (mtu>1500))
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = mtu;
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void oai_nw_drv_change_rx_flags(struct net_device *dev, int flags){
|
||||
void oai_nw_drv_change_rx_flags(struct net_device *dev, int flags)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct oai_nw_drv_priv *priv = netdev_priv(dev);
|
||||
printk("[OAI_IP_DRV][%s] CHANGE RX FLAGS %08X\n", __FUNCTION__, flags);
|
||||
@@ -302,7 +328,8 @@ void oai_nw_drv_change_rx_flags(struct net_device *dev, int flags){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void oai_nw_drv_tx_timeout(struct net_device *dev){
|
||||
void oai_nw_drv_tx_timeout(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Transmitter timeout, serious problems.
|
||||
struct oai_nw_drv_priv *priv = netdev_priv(dev);
|
||||
@@ -316,23 +343,24 @@ void oai_nw_drv_tx_timeout(struct net_device *dev){
|
||||
}
|
||||
|
||||
static const struct net_device_ops nasmesh_netdev_ops = {
|
||||
.ndo_open = oai_nw_drv_open,
|
||||
.ndo_stop = oai_nw_drv_stop,
|
||||
.ndo_start_xmit = oai_nw_drv_hard_start_xmit,
|
||||
.ndo_validate_addr = NULL,
|
||||
.ndo_get_stats = oai_nw_drv_get_stats,
|
||||
.ndo_set_mac_address = oai_nw_drv_set_mac_address,
|
||||
.ndo_set_config = oai_nw_drv_set_config,
|
||||
.ndo_do_ioctl = oai_nw_drv_CTL_ioctl,
|
||||
.ndo_change_mtu = oai_nw_drv_change_mtu,
|
||||
.ndo_tx_timeout = oai_nw_drv_tx_timeout,
|
||||
.ndo_change_rx_flags = oai_nw_drv_change_rx_flags,
|
||||
.ndo_open = oai_nw_drv_open,
|
||||
.ndo_stop = oai_nw_drv_stop,
|
||||
.ndo_start_xmit = oai_nw_drv_hard_start_xmit,
|
||||
.ndo_validate_addr = NULL,
|
||||
.ndo_get_stats = oai_nw_drv_get_stats,
|
||||
.ndo_set_mac_address = oai_nw_drv_set_mac_address,
|
||||
.ndo_set_config = oai_nw_drv_set_config,
|
||||
.ndo_do_ioctl = oai_nw_drv_CTL_ioctl,
|
||||
.ndo_change_mtu = oai_nw_drv_change_mtu,
|
||||
.ndo_tx_timeout = oai_nw_drv_tx_timeout,
|
||||
.ndo_change_rx_flags = oai_nw_drv_change_rx_flags,
|
||||
};
|
||||
/*.ndo_set_multicast_list = NULL,*/
|
||||
/*.ndo_set_multicast_list = NULL,*/
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Initialisation of the network device
|
||||
void oai_nw_drv_init(struct net_device *dev){
|
||||
void oai_nw_drv_init(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t cxi;
|
||||
struct oai_nw_drv_priv *priv;
|
||||
@@ -366,7 +394,7 @@ void oai_nw_drv_init(struct net_device *dev){
|
||||
|
||||
//
|
||||
dev->netdev_ops = &nasmesh_netdev_ops;
|
||||
#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
|
||||
#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
|
||||
printk("[OAI_IP_DRV][%s] Driver type ETHERNET\n", __FUNCTION__);
|
||||
// Memo: linux-source-3.2.0/net/ethernet/eth.c:
|
||||
//334 void ether_setup(struct net_device *dev)
|
||||
@@ -383,7 +411,7 @@ void oai_nw_drv_init(struct net_device *dev){
|
||||
//345 memset(dev->broadcast, 0xFF, ETH_ALEN);
|
||||
//346 }
|
||||
ether_setup(dev);
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
// Initialize private structure
|
||||
priv->rx_flags = OAI_NW_DRV_RESET_RX_FLAGS;
|
||||
@@ -399,76 +427,83 @@ void oai_nw_drv_init(struct net_device *dev){
|
||||
}
|
||||
priv->nrclassifier=0;*/
|
||||
//
|
||||
for (cxi=0;cxi<OAI_NW_DRV_CX_MAX;cxi++) {
|
||||
for (cxi=0; cxi<OAI_NW_DRV_CX_MAX; cxi++) {
|
||||
#ifdef OAI_DRV_DEBUG_DEVICE
|
||||
printk("[OAI_IP_DRV][%s] init classifiers, state and timer for MT %u\n", __FUNCTION__, cxi);
|
||||
printk("[OAI_IP_DRV][%s] init classifiers, state and timer for MT %u\n", __FUNCTION__, cxi);
|
||||
#endif
|
||||
|
||||
// priv->cx[cxi].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT0;
|
||||
// priv->cx[cxi].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT0;
|
||||
priv->cx[cxi].state = OAI_NW_DRV_IDLE;
|
||||
priv->cx[cxi].countimer = OAI_NW_DRV_TIMER_IDLE;
|
||||
priv->cx[cxi].retry = 0;
|
||||
priv->cx[cxi].lcr = cxi;
|
||||
/*priv->cx[cxi].rb = NULL;
|
||||
priv->cx[cxi].num_rb = 0;
|
||||
// initialisation of the classifier
|
||||
for (dscpi=0; dscpi<65; ++dscpi) {
|
||||
priv->cx[cxi].sclassifier[dscpi] = NULL;
|
||||
priv->cx[cxi].fclassifier[dscpi] = NULL;
|
||||
}
|
||||
// priv->cx[cxi].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT0;
|
||||
// priv->cx[cxi].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT0;
|
||||
priv->cx[cxi].state = OAI_NW_DRV_IDLE;
|
||||
priv->cx[cxi].countimer = OAI_NW_DRV_TIMER_IDLE;
|
||||
priv->cx[cxi].retry = 0;
|
||||
priv->cx[cxi].lcr = cxi;
|
||||
/*priv->cx[cxi].rb = NULL;
|
||||
priv->cx[cxi].num_rb = 0;
|
||||
// initialisation of the classifier
|
||||
for (dscpi=0; dscpi<65; ++dscpi) {
|
||||
priv->cx[cxi].sclassifier[dscpi] = NULL;
|
||||
priv->cx[cxi].fclassifier[dscpi] = NULL;
|
||||
}
|
||||
|
||||
priv->cx[cxi].nsclassifier=0;
|
||||
priv->cx[cxi].nfclassifier=0;
|
||||
*/
|
||||
// initialisation of the IP address
|
||||
oai_nw_drv_TOOL_eNB_imei2iid(oai_nw_drv_IMEI, (uint8_t *)priv->cx[cxi].iid6, dev->addr_len);
|
||||
priv->cx[cxi].iid4=0;
|
||||
//
|
||||
priv->cx[cxi].nsclassifier=0;
|
||||
priv->cx[cxi].nfclassifier=0;
|
||||
*/
|
||||
// initialisation of the IP address
|
||||
oai_nw_drv_TOOL_eNB_imei2iid(oai_nw_drv_IMEI, (uint8_t *)priv->cx[cxi].iid6, dev->addr_len);
|
||||
priv->cx[cxi].iid4=0;
|
||||
//
|
||||
}
|
||||
|
||||
spin_lock_init(&priv->lock);
|
||||
//this requires kernel patch for OAI driver: typically for RF/hard realtime emu experimentation
|
||||
//this requires kernel patch for OAI driver: typically for RF/hard realtime emu experimentation
|
||||
#define ADDRCONF
|
||||
#ifdef ADDRCONF
|
||||
|
||||
#ifdef OAI_NW_DRIVER_USE_NETLINK
|
||||
#ifdef OAI_NW_DRIVER_USE_NETLINK
|
||||
oai_nw_drv_TOOL_eNB_imei2iid(oai_nw_drv_IMEI, dev->dev_addr, dev->addr_len);// IMEI to device address (for stateless autoconfiguration address)
|
||||
|
||||
oai_nw_drv_TOOL_eNB_imei2iid(oai_nw_drv_IMEI, (uint8_t *)priv->cx[0].iid6, dev->addr_len);
|
||||
#else
|
||||
#else
|
||||
oai_nw_drv_TOOL_imei2iid(oai_nw_drv_IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
|
||||
oai_nw_drv_TOOL_imei2iid(oai_nw_drv_IMEI, (uint8_t *)priv->cx[0].iid6);
|
||||
#endif
|
||||
// this is more appropriate for user space soft realtime emulation
|
||||
#endif
|
||||
// this is more appropriate for user space soft realtime emulation
|
||||
#else
|
||||
// LG: strange
|
||||
|
||||
// LG: strange
|
||||
for (index = 0; index < dev->addr_len; index++) {
|
||||
dev->dev_addr[index] = 16*oai_nw_drv_IMEI[index]+oai_nw_drv_IMEI[index+1]);
|
||||
dev->dev_addr[index] = 16*oai_nw_drv_IMEI[index]+oai_nw_drv_IMEI[index+1]);
|
||||
}
|
||||
|
||||
memcpy((uint8_t *)priv->cx[0].iid6,&oai_nw_drv_IMEI[0],dev->addr_len);
|
||||
|
||||
printk("INIT: init IMEI to IID\n");
|
||||
#endif
|
||||
printk("[OAI_IP_DRV][%s] Setting HW addr to : ", __FUNCTION__);
|
||||
|
||||
for (index = 0; index < dev->addr_len; index++) {
|
||||
printk("%02X", dev->dev_addr[index]);
|
||||
printk("%02X", dev->dev_addr[index]);
|
||||
}
|
||||
printk("\n[OAI_IP_DRV][%s] Setting priv->cx to : ", __FUNCTION__);
|
||||
for (index = 0; index < 8; index++) {
|
||||
printk("%02X", ((uint8_t *)(priv->cx[0].iid6))[index]);
|
||||
}
|
||||
|
||||
printk("\n[OAI_IP_DRV][%s] Setting priv->cx to : ", __FUNCTION__);
|
||||
|
||||
for (index = 0; index < 8; index++) {
|
||||
printk("%02X", ((uint8_t *)(priv->cx[0].iid6))[index]);
|
||||
}
|
||||
|
||||
printk("\n");
|
||||
printk("[OAI_IP_DRV][%s] INIT: end\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
printk("[OAI_IP_DRV][%s] ERROR, Device is NULL!!\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int init_module (void) {
|
||||
//---------------------------------------------------------------------------
|
||||
int init_module (void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
int err,inst, index;
|
||||
struct oai_nw_drv_priv *priv;
|
||||
char devicename[100];
|
||||
@@ -476,9 +511,11 @@ int init_module (void) {
|
||||
|
||||
// Initialize parameters shared with RRC
|
||||
printk("[OAI_IP_DRV][%s] Starting NASMESH, number of IMEI parameters %d, IMEI ", __FUNCTION__, m_arg);
|
||||
|
||||
for (index = 0; index < m_arg; index++) {
|
||||
printk("%02X", oai_nw_drv_IMEI[index]);
|
||||
printk("%02X", oai_nw_drv_IMEI[index]);
|
||||
}
|
||||
|
||||
printk("\n");
|
||||
|
||||
#ifndef OAI_NW_DRIVER_USE_NETLINK
|
||||
@@ -489,12 +526,12 @@ int init_module (void) {
|
||||
|
||||
#endif
|
||||
|
||||
if (pdcp_2_oai_nw_drv_irq == -EBUSY || pdcp_2_oai_nw_drv_irq == -EINVAL){
|
||||
if (pdcp_2_oai_nw_drv_irq == -EBUSY || pdcp_2_oai_nw_drv_irq == -EINVAL) {
|
||||
printk("[OAI_IP_DRV][%s] No interrupt resource available\n", __FUNCTION__);
|
||||
return -EBUSY;
|
||||
}
|
||||
else
|
||||
} else
|
||||
printk("[OAI_IP_DRV][%s] Interrupt %d\n", __FUNCTION__, pdcp_2_oai_nw_drv_irq);
|
||||
|
||||
//rt_startup_irq(RTAI_IRQ);
|
||||
|
||||
//rt_enable_irq(RTAI_IRQ);
|
||||
@@ -502,7 +539,7 @@ int init_module (void) {
|
||||
|
||||
#endif //NETLINK
|
||||
|
||||
for (inst=0;inst<OAI_NW_DRV_NB_INSTANCES_MAX;inst++) {
|
||||
for (inst=0; inst<OAI_NW_DRV_NB_INSTANCES_MAX; inst++) {
|
||||
printk("[OAI_IP_DRV][%s] begin init instance %d\n", __FUNCTION__,inst);
|
||||
|
||||
|
||||
@@ -510,38 +547,40 @@ int init_module (void) {
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
|
||||
oai_nw_drv_dev[inst] = alloc_netdev(sizeof(struct oai_nw_drv_priv),devicename, oai_nw_drv_init);
|
||||
#else
|
||||
#else
|
||||
oai_nw_drv_dev[inst] = alloc_netdev(sizeof(struct oai_nw_drv_priv),devicename, NET_NAME_PREDICTABLE, oai_nw_drv_init);
|
||||
#endif
|
||||
//netif_stop_queue(oai_nw_drv_dev[inst]);
|
||||
|
||||
if (oai_nw_drv_dev[inst] == NULL) {
|
||||
printk("[OAI_IP_DRV][%s][INST %02d] alloc_netdev FAILED\n", __FUNCTION__,inst);
|
||||
printk("[OAI_IP_DRV][%s][INST %02d] alloc_netdev FAILED\n", __FUNCTION__,inst);
|
||||
} else {
|
||||
|
||||
priv = netdev_priv(oai_nw_drv_dev[inst]);
|
||||
priv = netdev_priv(oai_nw_drv_dev[inst]);
|
||||
|
||||
if (oai_nw_drv_dev[inst]){
|
||||
oai_nw_drv_IMEI[9] += 1;
|
||||
if (oai_nw_drv_IMEI[9] > 0x0F) {
|
||||
oai_nw_drv_IMEI[8] = oai_nw_drv_IMEI[9] >> 4;
|
||||
oai_nw_drv_IMEI[9] = oai_nw_drv_IMEI[9] & 0x0F;
|
||||
}
|
||||
if (oai_nw_drv_dev[inst]) {
|
||||
oai_nw_drv_IMEI[9] += 1;
|
||||
|
||||
if (oai_nw_drv_IMEI[9] > 0x0F) {
|
||||
oai_nw_drv_IMEI[8] = oai_nw_drv_IMEI[9] >> 4;
|
||||
oai_nw_drv_IMEI[9] = oai_nw_drv_IMEI[9] & 0x0F;
|
||||
}
|
||||
}
|
||||
|
||||
// linux/net/core/dev.c line 4767
|
||||
err= register_netdev(oai_nw_drv_dev[inst]);
|
||||
// linux/net/core/dev.c line 4767
|
||||
err= register_netdev(oai_nw_drv_dev[inst]);
|
||||
|
||||
if (err){
|
||||
printk("[OAI_IP_DRV][%s] (inst %d): error %i registering device %s\n", __FUNCTION__, inst,err, oai_nw_drv_dev[inst]->name);
|
||||
}else{
|
||||
printk("[OAI_IP_DRV][%s] registering device %s, ifindex = %d\n\n", __FUNCTION__,oai_nw_drv_dev[inst]->name, oai_nw_drv_dev[inst]->ifindex);
|
||||
}
|
||||
if (err) {
|
||||
printk("[OAI_IP_DRV][%s] (inst %d): error %i registering device %s\n", __FUNCTION__, inst,err, oai_nw_drv_dev[inst]->name);
|
||||
} else {
|
||||
printk("[OAI_IP_DRV][%s] registering device %s, ifindex = %d\n\n", __FUNCTION__,oai_nw_drv_dev[inst]->name, oai_nw_drv_dev[inst]->ifindex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef OAI_NW_DRIVER_USE_NETLINK
|
||||
printk("[OAI_IP_DRV][%s] NETLINK INIT\n", __FUNCTION__);
|
||||
|
||||
if ((err=oai_nw_drv_netlink_init()) == -1)
|
||||
printk("[OAI_IP_DRV][%s] NETLINK failed\n", __FUNCTION__);
|
||||
|
||||
@@ -552,42 +591,47 @@ int init_module (void) {
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void cleanup_module(void){
|
||||
//---------------------------------------------------------------------------
|
||||
int inst;
|
||||
void cleanup_module(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
int inst;
|
||||
|
||||
printk("[OAI_IP_DRV][CLEANUP]nasmesh_cleanup_module: begin\n");
|
||||
printk("[OAI_IP_DRV][CLEANUP]nasmesh_cleanup_module: begin\n");
|
||||
|
||||
#ifndef OAI_NW_DRIVER_USE_NETLINK
|
||||
if (pdcp_2_oai_nw_drv_irq!=-EBUSY) {
|
||||
pdcp_2_oai_nw_drv_irq=0;
|
||||
|
||||
if (pdcp_2_oai_nw_drv_irq!=-EBUSY) {
|
||||
pdcp_2_oai_nw_drv_irq=0;
|
||||
#ifdef RTAI
|
||||
// V1
|
||||
// rt_free_linux_irq(priv->irq, NULL);
|
||||
// END V1
|
||||
rt_free_srq(pdcp_2_oai_nw_drv_irq);
|
||||
// V1
|
||||
// rt_free_linux_irq(priv->irq, NULL);
|
||||
// END V1
|
||||
rt_free_srq(pdcp_2_oai_nw_drv_irq);
|
||||
#endif
|
||||
// Start IRQ linux
|
||||
//free_irq(priv->irq, NULL);
|
||||
// End IRQ linux
|
||||
}
|
||||
// Start IRQ linux
|
||||
//free_irq(priv->irq, NULL);
|
||||
// End IRQ linux
|
||||
}
|
||||
|
||||
#else // NETLINK
|
||||
#endif //NETLINK
|
||||
|
||||
for (inst=0;inst<OAI_NW_DRV_NB_INSTANCES_MAX;inst++) {
|
||||
for (inst=0; inst<OAI_NW_DRV_NB_INSTANCES_MAX; inst++) {
|
||||
#ifdef OAI_DRV_DEBUG_DEVICE
|
||||
printk("nasmesh_cleanup_module: unregister and free net device instance %d\n",inst);
|
||||
printk("nasmesh_cleanup_module: unregister and free net device instance %d\n",inst);
|
||||
#endif
|
||||
if (oai_nw_drv_dev[inst]) {
|
||||
unregister_netdev(oai_nw_drv_dev[inst]);
|
||||
oai_nw_drv_teardown(oai_nw_drv_dev[inst]);
|
||||
free_netdev(oai_nw_drv_dev[inst]);
|
||||
}
|
||||
|
||||
if (oai_nw_drv_dev[inst]) {
|
||||
unregister_netdev(oai_nw_drv_dev[inst]);
|
||||
oai_nw_drv_teardown(oai_nw_drv_dev[inst]);
|
||||
free_netdev(oai_nw_drv_dev[inst]);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef OAI_NW_DRIVER_USE_NETLINK
|
||||
oai_nw_drv_netlink_release();
|
||||
oai_nw_drv_netlink_release();
|
||||
#endif //OAI_NW_DRIVER_USE_NETLINK
|
||||
printk("nasmesh_cleanup_module: end\n");
|
||||
printk("nasmesh_cleanup_module: end\n");
|
||||
}
|
||||
|
||||
#define DRV_NAME "NASMESH"
|
||||
|
||||
@@ -50,7 +50,8 @@ uint8_t g_msgrep[OAI_NW_DRV_LIST_CLASS_MAX*sizeof(struct oai_nw_drv_msg_class_li
|
||||
// Statistic
|
||||
//---------------------------------------------------------------------------
|
||||
void oai_nw_drv_set_msg_statistic_reply(struct oai_nw_drv_msg_statistic_reply *msgrep,
|
||||
struct oai_nw_drv_priv *priv){
|
||||
struct oai_nw_drv_priv *priv)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
msgrep->rx_packets=priv->stats.rx_packets;
|
||||
msgrep->tx_packets=priv->stats.tx_packets;
|
||||
@@ -64,16 +65,18 @@ void oai_nw_drv_set_msg_statistic_reply(struct oai_nw_drv_msg_statistic_reply *m
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int oai_nw_drv_ioCTL_statistic_request(struct oai_nw_drv_ioctl *gifr,
|
||||
struct oai_nw_drv_priv *priv){
|
||||
struct oai_nw_drv_priv *priv)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct oai_nw_drv_msg_statistic_reply msgrep;
|
||||
printk("NAS_IOCTL_STATISTIC: stat requested\n");
|
||||
oai_nw_drv_set_msg_statistic_reply(&msgrep,priv);
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep)))
|
||||
{
|
||||
printk("NAS_IOCTL_STATISTIC: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
|
||||
printk("NAS_IOCTL_STATISTIC: copy_to_user failure\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -89,8 +92,9 @@ int oai_nw_drv_ioCTL_statistic_request(struct oai_nw_drv_ioctl *gifr,
|
||||
// IOCTL command
|
||||
//---------------------------------------------------------------------------
|
||||
int oai_nw_drv_CTL_ioctl(struct net_device *dev,
|
||||
struct ifreq *ifr,
|
||||
int cmd){
|
||||
struct ifreq *ifr,
|
||||
int cmd)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct oai_nw_drv_ioctl *gifr;
|
||||
struct oai_nw_drv_priv *priv=netdev_priv(dev);
|
||||
@@ -99,12 +103,11 @@ int oai_nw_drv_CTL_ioctl(struct net_device *dev,
|
||||
|
||||
// printk("NAS_CTL_IOCTL: begin ioctl for instance %d\n",find_inst(dev));
|
||||
|
||||
switch(cmd)
|
||||
{
|
||||
case OAI_NW_DRV_IOCTL_RRM:
|
||||
gifr=(struct oai_nw_drv_ioctl *)ifr;
|
||||
switch(gifr->type)
|
||||
{
|
||||
switch(cmd) {
|
||||
case OAI_NW_DRV_IOCTL_RRM:
|
||||
gifr=(struct oai_nw_drv_ioctl *)ifr;
|
||||
|
||||
switch(gifr->type) {
|
||||
case OAI_NW_DRV_MSG_STATISTIC_REQUEST:
|
||||
r=oai_nw_drv_ioCTL_statistic_request(gifr,priv);
|
||||
break;
|
||||
@@ -114,17 +117,21 @@ int oai_nw_drv_CTL_ioctl(struct net_device *dev,
|
||||
// printk("NAS_IOCTL_RRM: unkwon request type, type=%x\n", gifr->type);
|
||||
r=-EFAULT;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// printk("NAS_CTL_IOCTL: Unknown ioctl command, cmd=%x\n", cmd);
|
||||
r=-EFAULT;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
// printk("NAS_CTL_IOCTL: Unknown ioctl command, cmd=%x\n", cmd);
|
||||
r=-EFAULT;
|
||||
}
|
||||
|
||||
// printk("NAS_CTL_IOCTL: end\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void oai_nw_drv_CTL_send(struct sk_buff *skb, int inst) {
|
||||
void oai_nw_drv_CTL_send(struct sk_buff *skb, int inst)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("NAS_CTL_SEND - void \n");
|
||||
}
|
||||
|
||||
@@ -87,83 +87,70 @@
|
||||
|
||||
typedef unsigned short oai_nw_drv_MsgType_t;
|
||||
|
||||
struct oai_nw_drv_ioctl
|
||||
{
|
||||
char name[IFNAMSIZ];
|
||||
oai_nw_drv_MsgType_t type;
|
||||
char *msg;
|
||||
struct oai_nw_drv_ioctl {
|
||||
char name[IFNAMSIZ];
|
||||
oai_nw_drv_MsgType_t type;
|
||||
char *msg;
|
||||
};
|
||||
|
||||
struct oai_nw_drv_msg_statistic_reply
|
||||
{
|
||||
unsigned int rx_packets;
|
||||
unsigned int tx_packets;
|
||||
unsigned int rx_bytes;
|
||||
unsigned int tx_bytes;
|
||||
unsigned int rx_errors;
|
||||
unsigned int tx_errors;
|
||||
unsigned int rx_dropped;
|
||||
unsigned int tx_dropped;
|
||||
struct oai_nw_drv_msg_statistic_reply {
|
||||
unsigned int rx_packets;
|
||||
unsigned int tx_packets;
|
||||
unsigned int rx_bytes;
|
||||
unsigned int tx_bytes;
|
||||
unsigned int rx_errors;
|
||||
unsigned int tx_errors;
|
||||
unsigned int rx_dropped;
|
||||
unsigned int tx_dropped;
|
||||
};
|
||||
|
||||
struct oai_nw_drv_msg_cx_list_reply
|
||||
{
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char state;
|
||||
OaiNwDrvCellID_t cellid; // cell identification
|
||||
unsigned int iid6[2]; // IPv6 interface identification
|
||||
unsigned char iid4; // IPv4 interface identification
|
||||
unsigned short num_rb;
|
||||
unsigned short nsclassifier;
|
||||
struct oai_nw_drv_msg_cx_list_reply {
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char state;
|
||||
OaiNwDrvCellID_t cellid; // cell identification
|
||||
unsigned int iid6[2]; // IPv6 interface identification
|
||||
unsigned char iid4; // IPv4 interface identification
|
||||
unsigned short num_rb;
|
||||
unsigned short nsclassifier;
|
||||
};
|
||||
struct oai_nw_drv_msg_cx_establishment_reply
|
||||
{
|
||||
int status;
|
||||
struct oai_nw_drv_msg_cx_establishment_reply {
|
||||
int status;
|
||||
};
|
||||
struct oai_nw_drv_msg_cx_establishment_request
|
||||
{
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
OaiNwDrvCellID_t cellid; // Cell identification
|
||||
struct oai_nw_drv_msg_cx_establishment_request {
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
OaiNwDrvCellID_t cellid; // Cell identification
|
||||
};
|
||||
struct oai_nw_drv_msg_cx_release_reply
|
||||
{
|
||||
int status;
|
||||
struct oai_nw_drv_msg_cx_release_reply {
|
||||
int status;
|
||||
};
|
||||
struct oai_nw_drv_msg_cx_release_request
|
||||
{
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
struct oai_nw_drv_msg_cx_release_request {
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
};
|
||||
|
||||
struct oai_nw_drv_msg_rb_list_reply
|
||||
{
|
||||
OaiNwDrvRadioBearerId_t rab_id;
|
||||
OaiNwDrvSapId_t sapi;
|
||||
OaiNwDrvQoSTrafficClass_t qos;
|
||||
unsigned char state;
|
||||
struct oai_nw_drv_msg_rb_list_reply {
|
||||
OaiNwDrvRadioBearerId_t rab_id;
|
||||
OaiNwDrvSapId_t sapi;
|
||||
OaiNwDrvQoSTrafficClass_t qos;
|
||||
unsigned char state;
|
||||
};
|
||||
struct oai_nw_drv_msg_rb_list_request
|
||||
{
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
struct oai_nw_drv_msg_rb_list_request {
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
};
|
||||
struct oai_nw_drv_msg_rb_establishment_reply
|
||||
{
|
||||
int status;
|
||||
struct oai_nw_drv_msg_rb_establishment_reply {
|
||||
int status;
|
||||
};
|
||||
struct oai_nw_drv_msg_rb_establishment_request
|
||||
{
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
OaiNwDrvRadioBearerId_t rab_id;
|
||||
OaiNwDrvQoSTrafficClass_t qos;
|
||||
struct oai_nw_drv_msg_rb_establishment_request {
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
OaiNwDrvRadioBearerId_t rab_id;
|
||||
OaiNwDrvQoSTrafficClass_t qos;
|
||||
};
|
||||
|
||||
struct oai_nw_drv_msg_rb_release_reply
|
||||
{
|
||||
int status;
|
||||
struct oai_nw_drv_msg_rb_release_reply {
|
||||
int status;
|
||||
};
|
||||
struct oai_nw_drv_msg_rb_release_request
|
||||
{
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
OaiNwDrvRadioBearerId_t rab_id;
|
||||
struct oai_nw_drv_msg_rb_release_request {
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
OaiNwDrvRadioBearerId_t rab_id;
|
||||
};
|
||||
/*
|
||||
struct saddr {
|
||||
@@ -179,8 +166,7 @@ struct daddr {
|
||||
unsigned int mpls_label;
|
||||
};
|
||||
*/
|
||||
struct oai_nw_drv_msg_class_add_request
|
||||
{
|
||||
struct oai_nw_drv_msg_class_add_request {
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
OaiNwDrvRadioBearerId_t rab_id;
|
||||
OaiNwDrvRadioBearerId_t rab_id_rx;
|
||||
@@ -195,8 +181,7 @@ struct oai_nw_drv_msg_class_add_request
|
||||
|
||||
unsigned char splen; // prefix length
|
||||
|
||||
union
|
||||
{
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
|
||||
// begin navid
|
||||
@@ -207,8 +192,7 @@ struct oai_nw_drv_msg_class_add_request
|
||||
unsigned int mpls_label;
|
||||
} daddr; // IP destination address
|
||||
|
||||
union
|
||||
{
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
|
||||
// begin navid
|
||||
@@ -227,27 +211,23 @@ struct oai_nw_drv_msg_class_add_request
|
||||
unsigned short dport; //!< destination port
|
||||
};
|
||||
|
||||
struct oai_nw_drv_msg_class_add_reply
|
||||
{
|
||||
int status;
|
||||
struct oai_nw_drv_msg_class_add_reply {
|
||||
int status;
|
||||
};
|
||||
struct oai_nw_drv_msg_class_del_request
|
||||
{
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char dir; // direction (send or receive)
|
||||
unsigned char dscp; // codepoint
|
||||
unsigned short classref;
|
||||
struct oai_nw_drv_msg_class_del_request {
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char dir; // direction (send or receive)
|
||||
unsigned char dscp; // codepoint
|
||||
unsigned short classref;
|
||||
};
|
||||
struct oai_nw_drv_msg_class_del_reply
|
||||
{
|
||||
int status;
|
||||
struct oai_nw_drv_msg_class_del_reply {
|
||||
int status;
|
||||
};
|
||||
#define oai_nw_drv_msg_class_list_reply oai_nw_drv_msg_class_add_request
|
||||
struct oai_nw_drv_msg_class_list_request
|
||||
{
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char dir;
|
||||
unsigned char dscp;
|
||||
struct oai_nw_drv_msg_class_list_request {
|
||||
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char dir;
|
||||
unsigned char dscp;
|
||||
};
|
||||
|
||||
|
||||
@@ -255,20 +235,18 @@ struct oai_nw_drv_msg_class_list_request
|
||||
typedef unsigned int nioctlProviderId_t;
|
||||
typedef unsigned short nioctlSignalLoss_t;
|
||||
typedef struct nioctlMeasures {
|
||||
OaiNwDrvCellID_t cell_id;
|
||||
OaiNwDrvSigLevel_t level;
|
||||
nioctlProviderId_t provider_id;
|
||||
OaiNwDrvCellID_t cell_id;
|
||||
OaiNwDrvSigLevel_t level;
|
||||
nioctlProviderId_t provider_id;
|
||||
} nioctlMeasures_t;
|
||||
|
||||
struct oai_nw_drv_msg_measure_request
|
||||
{
|
||||
struct oai_nw_drv_msg_measure_request {
|
||||
OaiNwDrvNumRGsMeas_t num_cells;
|
||||
OaiNwDrvCellID_t cellid[OAI_NW_DRV_MAX_MEASURE_NB]; // Cell identification
|
||||
OaiNwDrvCellID_t cellid[OAI_NW_DRV_MAX_MEASURE_NB]; // Cell identification
|
||||
unsigned short num_providers;
|
||||
nioctlProviderId_t provider_id[OAI_NW_DRV_MAX_MEASURE_NB]; // Provider identification
|
||||
nioctlProviderId_t provider_id[OAI_NW_DRV_MAX_MEASURE_NB]; // Provider identification
|
||||
};
|
||||
struct oai_nw_drv_msg_measure_reply
|
||||
{
|
||||
struct oai_nw_drv_msg_measure_reply {
|
||||
OaiNwDrvNumRGsMeas_t num_cells;
|
||||
nioctlMeasures_t measures[OAI_NW_DRV_MAX_MEASURE_NB];
|
||||
nioctlSignalLoss_t signal_lost_flag;
|
||||
@@ -277,8 +255,7 @@ struct oai_nw_drv_msg_measure_reply
|
||||
// Messages for Measurement transfer - MW 01/04/2005
|
||||
typedef unsigned int nioctlL2Id_t[2];
|
||||
|
||||
struct oai_nw_drv_msg_l2id_reply
|
||||
{
|
||||
struct oai_nw_drv_msg_l2id_reply {
|
||||
nioctlL2Id_t l2id;
|
||||
};
|
||||
|
||||
|
||||
@@ -106,11 +106,11 @@ struct oai_nw_drv_priv {
|
||||
|
||||
struct ipversion {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
uint8_t reserved:4,
|
||||
version:4;
|
||||
uint8_t reserved:4,
|
||||
version:4;
|
||||
#else
|
||||
uint8_t version:4,
|
||||
reserved:4;
|
||||
uint8_t version:4,
|
||||
reserved:4;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -68,12 +68,12 @@ static DEFINE_MUTEX(nasmesh_mutex);
|
||||
|
||||
static inline void nasmesh_lock(void)
|
||||
{
|
||||
mutex_lock(&nasmesh_mutex);
|
||||
mutex_lock(&nasmesh_mutex);
|
||||
}
|
||||
|
||||
static inline void nasmesh_unlock(void)
|
||||
{
|
||||
mutex_unlock(&nasmesh_mutex);
|
||||
mutex_unlock(&nasmesh_mutex);
|
||||
}
|
||||
|
||||
// This can also be implemented using thread to get the data from PDCP without blocking.
|
||||
@@ -85,6 +85,7 @@ static void nas_nl_data_ready (struct sk_buff *skb)
|
||||
//nasmesh_unlock();
|
||||
|
||||
struct nlmsghdr *nlh = NULL;
|
||||
|
||||
if (skb) {
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("[OAI_IP_DRV][NETLINK] Received socket from PDCP\n");
|
||||
@@ -108,20 +109,20 @@ int oai_nw_drv_netlink_init(void)
|
||||
oai_netlink_cfg.bind = NULL;
|
||||
|
||||
nas_nl_sk = netlink_kernel_create(
|
||||
&init_net,
|
||||
NAS_NETLINK_ID,
|
||||
&init_net,
|
||||
NAS_NETLINK_ID,
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
|
||||
THIS_MODULE,
|
||||
THIS_MODULE,
|
||||
# endif
|
||||
&oai_netlink_cfg);
|
||||
&oai_netlink_cfg);
|
||||
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
||||
nas_nl_sk = netlink_kernel_create(
|
||||
&init_net,
|
||||
NAS_NETLINK_ID,
|
||||
0,
|
||||
nas_nl_data_ready,
|
||||
&nasmesh_mutex, // NULL
|
||||
THIS_MODULE);
|
||||
&init_net,
|
||||
NAS_NETLINK_ID,
|
||||
0,
|
||||
nas_nl_data_ready,
|
||||
&nasmesh_mutex, // NULL
|
||||
THIS_MODULE);
|
||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
||||
|
||||
if (nas_nl_sk == NULL) {
|
||||
@@ -130,32 +131,34 @@ int oai_nw_drv_netlink_init(void)
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void oai_nw_drv_netlink_release(void) {
|
||||
void oai_nw_drv_netlink_release(void)
|
||||
{
|
||||
|
||||
exit_netlink_thread=1;
|
||||
printk("[OAI_IP_DRV][NETLINK] Releasing netlink socket\n");
|
||||
|
||||
if(nas_nl_sk){
|
||||
|
||||
if(nas_nl_sk) {
|
||||
netlink_kernel_release(nas_nl_sk); //or skb->sk
|
||||
|
||||
|
||||
}
|
||||
|
||||
// printk("[OAI_IP_DRV][NETLINK] Removing netlink_rx_thread\n");
|
||||
//kthread_stop(netlink_rx_thread);
|
||||
|
||||
// printk("[OAI_IP_DRV][NETLINK] Removing netlink_rx_thread\n");
|
||||
//kthread_stop(netlink_rx_thread);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int oai_nw_drv_netlink_send(unsigned char *data,unsigned int len) {
|
||||
int oai_nw_drv_netlink_send(unsigned char *data,unsigned int len)
|
||||
{
|
||||
|
||||
|
||||
struct sk_buff *nl_skb = alloc_skb(NLMSG_SPACE(len),GFP_ATOMIC);
|
||||
@@ -189,17 +192,15 @@ int oai_nw_drv_netlink_send(unsigned char *data,unsigned int len) {
|
||||
// mutex_unlock(&nasmesh_mutex);
|
||||
|
||||
if (status < 0) {
|
||||
printk("[OAI_IP_DRV][NETLINK] SEND status is %d\n",status);
|
||||
return(0);
|
||||
}
|
||||
else {
|
||||
printk("[OAI_IP_DRV][NETLINK] SEND status is %d\n",status);
|
||||
return(0);
|
||||
} else {
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("[OAI_IP_DRV][NETLINK] SEND status is %d\n",status);
|
||||
#endif
|
||||
return len;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
printk("[OAI_IP_DRV][SEND] socket is NULL\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -82,9 +82,9 @@ int oai_nw_drv_find_inst(struct net_device *dev);
|
||||
@param rb_id Radio Bearer Id
|
||||
*/
|
||||
void oai_nw_drv_common_class_wireless2ip(unsigned short dlen,
|
||||
void *pdcp_sdu,
|
||||
int inst,
|
||||
OaiNwDrvRadioBearerId_t rb_id);
|
||||
void *pdcp_sdu,
|
||||
int inst,
|
||||
OaiNwDrvRadioBearerId_t rb_id);
|
||||
|
||||
/**
|
||||
\fn void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst)
|
||||
|
||||
@@ -29,20 +29,20 @@
|
||||
|
||||
#ifndef OAI_SAP_H
|
||||
#define OAI_SAP_H
|
||||
typedef unsigned short OaiNwDrvRadioBearerId_t;
|
||||
typedef unsigned int OaiNwDrvSapId_t; // Id of the QoS SAP to use
|
||||
typedef unsigned short OaiNwDrvQoSTrafficClass_t; // QoS traffic class requested
|
||||
typedef unsigned int OaiNwDrvLocalConnectionRef_t; // local identifier
|
||||
typedef unsigned short OaiNwDrvCellID_t; // ID of the cell for connection
|
||||
typedef unsigned short OaiNwDrvNumRGsMeas_t; // number of RGs that could be measured
|
||||
typedef unsigned int OaiNwDrvSigLevel_t; // Signal level measured
|
||||
typedef unsigned short OaiNwDrvRadioBearerId_t;
|
||||
typedef unsigned int OaiNwDrvSapId_t; // Id of the QoS SAP to use
|
||||
typedef unsigned short OaiNwDrvQoSTrafficClass_t; // QoS traffic class requested
|
||||
typedef unsigned int OaiNwDrvLocalConnectionRef_t; // local identifier
|
||||
typedef unsigned short OaiNwDrvCellID_t; // ID of the cell for connection
|
||||
typedef unsigned short OaiNwDrvNumRGsMeas_t; // number of RGs that could be measured
|
||||
typedef unsigned int OaiNwDrvSigLevel_t; // Signal level measured
|
||||
|
||||
#define OAI_NW_DRV_SAPI_CX_MAX 2
|
||||
#define OAI_NW_DRV_MAX_MEASURE_NB 5
|
||||
#define OAI_NW_DRV_PRIMITIVE_MAX_LENGTH 180 // maximum length of a NAS primitive
|
||||
#define OAI_NW_DRV_SAPI_MAX 4
|
||||
#define OAI_NW_DRV_RAB_INPUT_SAPI 2
|
||||
#define OAI_NW_DRV_RAB_OUTPUT_SAPI 3
|
||||
#define OAI_NW_DRV_MAX_RABS 8 * 64 //NB_RAB_MAX * MAX_MOBILES_PER_RG //27 // = MAXURAB
|
||||
#define OAI_NW_DRV_LIST_RB_MAX 32
|
||||
#define OAI_NW_DRV_SAPI_CX_MAX 2
|
||||
#define OAI_NW_DRV_MAX_MEASURE_NB 5
|
||||
#define OAI_NW_DRV_PRIMITIVE_MAX_LENGTH 180 // maximum length of a NAS primitive
|
||||
#define OAI_NW_DRV_SAPI_MAX 4
|
||||
#define OAI_NW_DRV_RAB_INPUT_SAPI 2
|
||||
#define OAI_NW_DRV_RAB_OUTPUT_SAPI 3
|
||||
#define OAI_NW_DRV_MAX_RABS 8 * 64 //NB_RAB_MAX * MAX_MOBILES_PER_RG //27 // = MAXURAB
|
||||
#define OAI_NW_DRV_LIST_RB_MAX 32
|
||||
#endif
|
||||
|
||||
+453
-336
@@ -42,110 +42,127 @@
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t oai_nw_drv_TOOL_get_dscp6(struct ipv6hdr *iph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
uint8_t oai_nw_drv_TOOL_get_dscp6(struct ipv6hdr *iph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_DSCP6 - begin \n");
|
||||
printk("OAI_NW_DRV_TOOL_GET_DSCP6 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
|
||||
if (iph==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_DSCP6 - input parameter iph is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_GET_DSCP6 - input parameter iph is NULL \n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
return (ntohl(((*(__u32 *)iph)&OAI_NW_DRV_TRAFFICCLASS_MASK)))>>22;
|
||||
//return ntohs(*(const __be16 *)iph) >> 4; // see linux/dsfield.h
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t oai_nw_drv_TOOL_get_dscp4(struct iphdr *iph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
uint8_t oai_nw_drv_TOOL_get_dscp4(struct iphdr *iph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_DSCP4 - begin \n");
|
||||
printk("OAI_NW_DRV_TOOL_GET_DSCP4 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
|
||||
if (iph==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_DSCP4 - input parameter iph is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_GET_DSCP4 - input parameter iph is NULL \n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
// End debug information
|
||||
return (iph->tos);
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int oai_nw_drv_TOOL_network6(struct in6_addr *addr, struct in6_addr *prefix, uint8_t plen){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
int oai_nw_drv_TOOL_network6(struct in6_addr *addr, struct in6_addr *prefix, uint8_t plen)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK6 - begin \n");
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK6 - begin \n");
|
||||
#endif
|
||||
if (addr==NULL){
|
||||
|
||||
if (addr==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK6 - input parameter addr is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK6 - input parameter addr is NULL \n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
if (prefix==NULL){
|
||||
|
||||
if (prefix==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK6 - input parameter prefix is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK6 - input parameter prefix is NULL \n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
// End debug information
|
||||
switch(plen/32)
|
||||
{
|
||||
case 0:
|
||||
return (((addr->s6_addr32[0]>>(32-plen))<<(32-plen))==prefix->s6_addr[0]);
|
||||
case 1:
|
||||
return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
|
||||
|
||||
// End debug information
|
||||
switch(plen/32) {
|
||||
case 0:
|
||||
return (((addr->s6_addr32[0]>>(32-plen))<<(32-plen))==prefix->s6_addr[0]);
|
||||
|
||||
case 1:
|
||||
return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
|
||||
(((addr->s6_addr32[1]>>(64-plen))<<(64-plen))==prefix->s6_addr[1]));
|
||||
case 2:
|
||||
return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
|
||||
|
||||
case 2:
|
||||
return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
|
||||
(addr->s6_addr32[1]==prefix->s6_addr[1])&&
|
||||
(((addr->s6_addr32[2]>>(96-plen))<<(96-plen))==prefix->s6_addr[2]));
|
||||
case 3:
|
||||
return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
|
||||
|
||||
case 3:
|
||||
return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
|
||||
(addr->s6_addr32[1]==prefix->s6_addr[1])&&
|
||||
(addr->s6_addr32[2]==prefix->s6_addr[2])&&
|
||||
(((addr->s6_addr32[3]>>(128-plen))<<(128-plen))==prefix->s6_addr[3]));
|
||||
default:
|
||||
return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
|
||||
|
||||
default:
|
||||
return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
|
||||
(addr->s6_addr32[1]==prefix->s6_addr[1])&&
|
||||
(addr->s6_addr32[2]==prefix->s6_addr[2])&&
|
||||
(addr->s6_addr32[3]==prefix->s6_addr[3]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int oai_nw_drv_TOOL_network4(uint32_t *addr, uint32_t *prefix, uint8_t plen){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
int oai_nw_drv_TOOL_network4(uint32_t *addr, uint32_t *prefix, uint8_t plen)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK4 - begin \n");
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK4 - begin \n");
|
||||
#endif
|
||||
if (addr==NULL){
|
||||
|
||||
if (addr==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK4 - input parameter addr is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK4 - input parameter addr is NULL \n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
if (prefix==NULL){
|
||||
|
||||
if (prefix==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK4 - input parameter prefix is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_NETWORK4 - input parameter prefix is NULL \n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
// End debug information
|
||||
if (plen>=32)
|
||||
return (*addr==*prefix);
|
||||
else
|
||||
return (((*addr>>(32-plen))<<(32-plen))==*prefix);
|
||||
|
||||
// End debug information
|
||||
if (plen>=32)
|
||||
return (*addr==*prefix);
|
||||
else
|
||||
return (((*addr>>(32-plen))<<(32-plen))==*prefix);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -155,145 +172,165 @@ int oai_nw_drv_TOOL_network4(uint32_t *addr, uint32_t *prefix, uint8_t plen){
|
||||
//}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t *oai_nw_drv_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol){
|
||||
//---------------------------------------------------------------------------
|
||||
uint16_t size;
|
||||
// Start debug information
|
||||
uint8_t *oai_nw_drv_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint16_t size;
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL6 - begin \n");
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL6 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL6 - input parameter iph is NULL \n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
if (protocol==NULL){
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL6 - input parameter protocol is NULL \n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
// End debug information
|
||||
*protocol=iph->nexthdr;
|
||||
size=OAI_NW_DRV_IPV6_SIZE;
|
||||
while (1)
|
||||
{
|
||||
switch(*protocol)
|
||||
{
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_ICMPV6:
|
||||
return (uint8_t *)((uint8_t *)iph+size);
|
||||
case IPPROTO_HOPOPTS:
|
||||
case IPPROTO_ROUTING:
|
||||
case IPPROTO_DSTOPTS:
|
||||
*protocol=((uint8_t *)iph+size)[0];
|
||||
size+=((uint8_t *)iph+size)[1]*8+8;
|
||||
break;
|
||||
case IPPROTO_FRAGMENT:
|
||||
*protocol=((uint8_t *)iph+size)[0];
|
||||
size+=((uint8_t *)iph+size)[1]+8;
|
||||
break;
|
||||
case IPPROTO_NONE:
|
||||
case IPPROTO_AH:
|
||||
case IPPROTO_ESP:
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t *oai_nw_drv_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
if (iph==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL4 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL4 - input parameter iph is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL6 - input parameter iph is NULL \n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
if (protocol==NULL){
|
||||
|
||||
if (protocol==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL4 - input parameter protocol is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL6 - input parameter protocol is NULL \n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
// End debug information
|
||||
*protocol=iph->protocol;
|
||||
switch(*protocol)
|
||||
{
|
||||
|
||||
// End debug information
|
||||
*protocol=iph->nexthdr;
|
||||
size=OAI_NW_DRV_IPV6_SIZE;
|
||||
|
||||
while (1) {
|
||||
switch(*protocol) {
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_ICMP:
|
||||
return (uint8_t *)((uint8_t *)iph+iph->tot_len);
|
||||
case IPPROTO_ICMPV6:
|
||||
return (uint8_t *)((uint8_t *)iph+size);
|
||||
|
||||
case IPPROTO_HOPOPTS:
|
||||
case IPPROTO_ROUTING:
|
||||
case IPPROTO_DSTOPTS:
|
||||
*protocol=((uint8_t *)iph+size)[0];
|
||||
size+=((uint8_t *)iph+size)[1]*8+8;
|
||||
break;
|
||||
|
||||
case IPPROTO_FRAGMENT:
|
||||
*protocol=((uint8_t *)iph+size)[0];
|
||||
size+=((uint8_t *)iph+size)[1]+8;
|
||||
break;
|
||||
|
||||
case IPPROTO_NONE:
|
||||
case IPPROTO_AH:
|
||||
case IPPROTO_ESP:
|
||||
default:
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t *oai_nw_drv_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL4 - begin \n");
|
||||
#endif
|
||||
|
||||
if (iph==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL4 - input parameter iph is NULL \n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (protocol==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_PROTOCOL4 - input parameter protocol is NULL \n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
*protocol=iph->protocol;
|
||||
|
||||
switch(*protocol) {
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_ICMP:
|
||||
return (uint8_t *)((uint8_t *)iph+iph->tot_len);
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Convert the IMEI to iid
|
||||
void oai_nw_drv_TOOL_imei2iid(uint8_t *imei, uint8_t *iid){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void oai_nw_drv_TOOL_imei2iid(uint8_t *imei, uint8_t *iid)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_IMEI2IID - begin \n");
|
||||
printk("OAI_NW_DRV_TOOL_IMEI2IID - begin \n");
|
||||
#endif
|
||||
if (imei==NULL){
|
||||
|
||||
if (imei==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_IMEI2IID - input parameter imei is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_IMEI2IID - input parameter imei is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (iid==NULL){
|
||||
|
||||
if (iid==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_IMEI2IID - input parameter iid is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_IMEI2IID - input parameter iid is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
memset(iid, 0, OAI_NW_DRV_ADDR_LEN);
|
||||
iid[0] = 0x03;
|
||||
iid[1] = 16*imei[0]+imei[1];
|
||||
iid[2] = 16*imei[2]+imei[3];
|
||||
iid[3] = 16*imei[4]+imei[5];
|
||||
iid[4] = 16*imei[6]+imei[7];
|
||||
iid[5] = 16*imei[8]+imei[9];
|
||||
iid[6] = 16*imei[10]+imei[11];
|
||||
iid[7] = 16*imei[12]+imei[13];
|
||||
|
||||
// End debug information
|
||||
memset(iid, 0, OAI_NW_DRV_ADDR_LEN);
|
||||
iid[0] = 0x03;
|
||||
iid[1] = 16*imei[0]+imei[1];
|
||||
iid[2] = 16*imei[2]+imei[3];
|
||||
iid[3] = 16*imei[4]+imei[5];
|
||||
iid[4] = 16*imei[6]+imei[7];
|
||||
iid[5] = 16*imei[8]+imei[9];
|
||||
iid[6] = 16*imei[10]+imei[11];
|
||||
iid[7] = 16*imei[12]+imei[13];
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
// Convert the IMEI to iid
|
||||
void oai_nw_drv_TOOL_eNB_imei2iid(unsigned char *imei, unsigned char *iid, unsigned char len){
|
||||
//---------------------------------------------------------------------------
|
||||
void oai_nw_drv_TOOL_eNB_imei2iid(unsigned char *imei, unsigned char *iid, unsigned char len)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
unsigned int index;
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - begin \n");
|
||||
#endif
|
||||
if (imei==NULL){
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - input parameter imei is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (imei==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - input parameter imei is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (iid==NULL){
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - input parameter iid is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
|
||||
if (iid==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - input parameter iid is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
memset(iid, 0, len);
|
||||
iid[0] = 0x00; // to be compatible between link local and global
|
||||
|
||||
// len -1 because of insertion of 0 above
|
||||
for (index = 0; index < (len-1); index++) {
|
||||
iid[index+1] = 16*imei[index*2]+imei[index*2+1];
|
||||
iid[index+1] = 16*imei[index*2]+imei[index*2+1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,247 +341,322 @@ void oai_nw_drv_TOOL_eNB_imei2iid(unsigned char *imei, unsigned char *iid, unsig
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
char *oai_nw_drv_TOOL_get_udpmsg(struct udphdr *udph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
char *oai_nw_drv_TOOL_get_udpmsg(struct udphdr *udph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_UDPMSG - begin \n");
|
||||
printk("OAI_NW_DRV_TOOL_GET_UDPMSG - begin \n");
|
||||
#endif
|
||||
if (udph==NULL){
|
||||
|
||||
if (udph==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_GET_UDPMSG - input parameter udph is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_GET_UDPMSG - input parameter udph is NULL \n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
return ((char *)udph+sizeof(struct udphdr));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Compute the UDP checksum (the data size must be odd)
|
||||
uint16_t oai_nw_drv_TOOL_udpcksum(struct in6_addr *saddr, struct in6_addr *daddr, uint8_t proto, uint32_t udplen, void *data){
|
||||
//---------------------------------------------------------------------------
|
||||
uint32_t i;
|
||||
uint16_t oai_nw_drv_TOOL_udpcksum(struct in6_addr *saddr, struct in6_addr *daddr, uint8_t proto, uint32_t udplen, void *data)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint32_t i;
|
||||
uint16_t *data16;
|
||||
uint32_t csum=0;
|
||||
uint32_t csum=0;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_UDPCKSUM - begin \n");
|
||||
printk("OAI_NW_DRV_TOOL_UDPCKSUM - begin \n");
|
||||
#endif
|
||||
if (saddr==NULL){
|
||||
|
||||
if (saddr==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_UDPCKSUM - input parameter saddr is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_UDPCKSUM - input parameter saddr is NULL \n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
if (daddr==NULL){
|
||||
|
||||
if (daddr==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_UDPCKSUM - input parameter daddr is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_UDPCKSUM - input parameter daddr is NULL \n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
if (data==NULL){
|
||||
|
||||
if (data==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_UDPCKSUM - input parameter data is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_UDPCKSUM - input parameter data is NULL \n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
// End debug information
|
||||
data16=data;
|
||||
for (i=0; i<8; ++i)
|
||||
{
|
||||
csum+=ntohs(saddr->s6_addr16[i]);
|
||||
if (csum>0xffff)
|
||||
csum-=0xffff;
|
||||
}
|
||||
for (i=0; i<8; ++i)
|
||||
{
|
||||
csum+=ntohs(daddr->s6_addr16[i]);
|
||||
if (csum>0xffff)
|
||||
csum-=0xffff;
|
||||
}
|
||||
csum+=(udplen>>16); // udplen checksum
|
||||
|
||||
// End debug information
|
||||
data16=data;
|
||||
|
||||
for (i=0; i<8; ++i) {
|
||||
csum+=ntohs(saddr->s6_addr16[i]);
|
||||
|
||||
if (csum>0xffff)
|
||||
csum -= 0xffff;
|
||||
csum+=udplen & 0xffff;
|
||||
csum-=0xffff;
|
||||
}
|
||||
|
||||
for (i=0; i<8; ++i) {
|
||||
csum+=ntohs(daddr->s6_addr16[i]);
|
||||
|
||||
if (csum>0xffff)
|
||||
csum -= 0xffff;
|
||||
csum+=proto; // protocol checksum
|
||||
csum-=0xffff;
|
||||
}
|
||||
|
||||
csum+=(udplen>>16); // udplen checksum
|
||||
|
||||
if (csum>0xffff)
|
||||
csum -= 0xffff;
|
||||
|
||||
csum+=udplen & 0xffff;
|
||||
|
||||
if (csum>0xffff)
|
||||
csum -= 0xffff;
|
||||
|
||||
csum+=proto; // protocol checksum
|
||||
|
||||
if (csum>0xffff)
|
||||
csum-=0xffff;
|
||||
|
||||
for (i = 0; 2*i < udplen; i++) {
|
||||
csum+=ntohs(data16[i]);
|
||||
|
||||
if (csum>0xffff)
|
||||
csum-=0xffff;
|
||||
for (i = 0; 2*i < udplen; i++)
|
||||
{
|
||||
csum+=ntohs(data16[i]);
|
||||
if (csum>0xffff)
|
||||
csum-=0xffff;
|
||||
}
|
||||
return htons((uint16_t)(~csum)&0xffff);
|
||||
csum-=0xffff;
|
||||
}
|
||||
|
||||
return htons((uint16_t)(~csum)&0xffff);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void print_TOOL_pk_udp(struct udphdr *udph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void print_TOOL_pk_udp(struct udphdr *udph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("PRINT_TOOL_PK_UDP - begin \n");
|
||||
printk("PRINT_TOOL_PK_UDP - begin \n");
|
||||
#endif
|
||||
if (udph==NULL){
|
||||
|
||||
if (udph==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_PK_UDP - input parameter udph is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_PK_UDP - input parameter udph is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
if (udph!=NULL)
|
||||
{
|
||||
printk("UDP:\t source = %u, dest = %u, len = %u, check = %x\n", ntohs(udph->source), ntohs(udph->dest), ntohs(udph->len), udph->check);
|
||||
}
|
||||
|
||||
// End debug information
|
||||
if (udph!=NULL) {
|
||||
printk("UDP:\t source = %u, dest = %u, len = %u, check = %x\n", ntohs(udph->source), ntohs(udph->dest), ntohs(udph->len), udph->check);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void print_TOOL_pk_tcp(struct tcphdr *tcph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void print_TOOL_pk_tcp(struct tcphdr *tcph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("PRINT_TOOL_PK_TDP - begin \n");
|
||||
printk("PRINT_TOOL_PK_TDP - begin \n");
|
||||
#endif
|
||||
if (tcph==NULL){
|
||||
|
||||
if (tcph==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_PK_TDP - input parameter tcph is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_PK_TDP - input parameter tcph is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
if (tcph!=NULL)
|
||||
{
|
||||
printk("TCP:\t source = %u, dest = %u\n", tcph->source, tcph->dest);
|
||||
}
|
||||
|
||||
// End debug information
|
||||
if (tcph!=NULL) {
|
||||
printk("TCP:\t source = %u, dest = %u\n", tcph->source, tcph->dest);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void print_TOOL_pk_icmp6(struct icmp6hdr *icmph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
void print_TOOL_pk_icmp6(struct icmp6hdr *icmph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("PRINT_TOOL_PK_ICMP6 - begin \n");
|
||||
printk("PRINT_TOOL_PK_ICMP6 - begin \n");
|
||||
#endif
|
||||
if (icmph==NULL){
|
||||
|
||||
if (icmph==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_PK_ICMP6 - input parameter icmph is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_PK_ICMP6 - input parameter icmph is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
if (icmph!=NULL)
|
||||
{
|
||||
printk("ICMPv6:\t type= %d, code = %d\n", icmph->icmp6_type, icmph->icmp6_code);
|
||||
switch(icmph->icmp6_type)
|
||||
{
|
||||
case ICMPV6_DEST_UNREACH:printk("Destination unreachable\n");break;
|
||||
case ICMPV6_PKT_TOOBIG:printk("Packet too big\n");break;
|
||||
case ICMPV6_TIME_EXCEED:printk("Time exceeded\n");break;
|
||||
case ICMPV6_PARAMPROB:printk("Parameter problem\n");break;
|
||||
case ICMPV6_ECHO_REQUEST:printk("Echo request\n");break;
|
||||
case ICMPV6_ECHO_REPLY:printk("Echo reply\n");break;
|
||||
case ICMPV6_MGM_QUERY:printk("Multicast listener query\n");break;
|
||||
case ICMPV6_MGM_REPORT:printk("Multicast listener report\n");break;
|
||||
case ICMPV6_MGM_REDUCTION:printk("Multicast listener done\n");break;
|
||||
case NDISC_ROUTER_SOLICITATION:printk("Router solicitation\n");break;
|
||||
case NDISC_ROUTER_ADVERTISEMENT:printk("Router advertisment\n");break;
|
||||
case NDISC_NEIGHBOUR_SOLICITATION:printk("Neighbour solicitation\n");break;
|
||||
case NDISC_NEIGHBOUR_ADVERTISEMENT:printk("Neighbour advertisment\n");break;
|
||||
case NDISC_REDIRECT:printk("redirect message\n");break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void print_TOOL_pk_ipv6(struct ipv6hdr *iph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("PRINT_TOOL_PK_IPv6 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_PK_IPv6 - input parameter iph is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
// End debug information
|
||||
if (icmph!=NULL) {
|
||||
printk("ICMPv6:\t type= %d, code = %d\n", icmph->icmp6_type, icmph->icmp6_code);
|
||||
|
||||
if (iph!=NULL)
|
||||
{
|
||||
// char addr[OAI_NW_DRV_INET6_ADDRSTRLEN];
|
||||
printk("IP:\t version = %u, priority = %u, payload_len = %u\n", iph->version, iph->priority, ntohs(iph->payload_len));
|
||||
printk("\t fl0 = %u, fl1 = %u, fl2 = %u\n",iph->flow_lbl[0],iph->flow_lbl[1],iph->flow_lbl[2]);
|
||||
printk("\t next header = %u, hop_limit = %u\n", iph->nexthdr, iph->hop_limit);
|
||||
// inet_ntop(AF_INET6, (void *)(&iph->saddr), addr, OAI_NW_DRV_INET6_ADDRSTRLEN);
|
||||
// printk("\t saddr = %s",addr);
|
||||
// inet_ntop(AF_INET6, (void *)(&iph->daddr), addr, OAI_NW_DRV_INET6_ADDRSTRLEN);
|
||||
// printk(", daddr = %s\n",addr);
|
||||
switch(iph->nexthdr)
|
||||
{
|
||||
case IPPROTO_UDP:
|
||||
print_TOOL_pk_udp((struct udphdr *)((char *)iph+sizeof(struct ipv6hdr)));
|
||||
break;
|
||||
case IPPROTO_TCP:
|
||||
print_TOOL_pk_tcp((struct tcphdr *)((char *)iph+sizeof(struct ipv6hdr)));
|
||||
break;
|
||||
case IPPROTO_ICMPV6:
|
||||
print_TOOL_pk_icmp6((struct icmp6hdr *)((char *)iph+sizeof(struct ipv6hdr)));
|
||||
break;
|
||||
case IPPROTO_IPV6:
|
||||
print_TOOL_pk_ipv6((struct ipv6hdr *)((char *)iph+sizeof(struct ipv6hdr)));
|
||||
break;
|
||||
default:
|
||||
printk("Unknown upper layer\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void print_TOOL_pk_ipv4(struct iphdr *iph){
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("PRINT_TOOL_PK_IPv4 - begin \n");
|
||||
#endif
|
||||
if (iph==NULL){
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_PK_IPv4 - input parameter iph is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
|
||||
if (iph!=NULL)
|
||||
{
|
||||
// char addr[OAI_NW_DRV_INET_ADDRSTRLEN];
|
||||
printk("IP:\t version = %u, IP length = %u\n", iph->version, iph->ihl);
|
||||
// inet_ntop(AF_INET, (void *)(&iph->saddr), addr, OAI_NW_DRV_INET_ADDRSTRLEN);
|
||||
// printk("\t saddr = %s", addr);
|
||||
// inet_ntop(AF_INET, (void *)(&iph->saddr), addr, OAI_NW_DRV_INET_ADDRSTRLEN);
|
||||
// printk("\t saddr = %s", addr);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void print_TOOL_pk_all(struct sk_buff *skb){
|
||||
//---------------------------------------------------------------------------
|
||||
printk("Skb:\t %u, len = %u\n", (unsigned int)skb, skb->len);
|
||||
//navid: need to calculate the current used space: fixme?
|
||||
printk("Skb:\t available buf space = %u \n", skb->truesize);
|
||||
switch (ntohs(skb->protocol))
|
||||
{
|
||||
case ETH_P_IPV6:
|
||||
print_TOOL_pk_ipv6((struct ipv6hdr *)skb->network_header);
|
||||
switch(icmph->icmp6_type) {
|
||||
case ICMPV6_DEST_UNREACH:
|
||||
printk("Destination unreachable\n");
|
||||
break;
|
||||
case ETH_P_IP:
|
||||
print_TOOL_pk_ipv4((struct iphdr *)skb->network_header);
|
||||
|
||||
case ICMPV6_PKT_TOOBIG:
|
||||
printk("Packet too big\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_TIME_EXCEED:
|
||||
printk("Time exceeded\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_PARAMPROB:
|
||||
printk("Parameter problem\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_ECHO_REQUEST:
|
||||
printk("Echo request\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_ECHO_REPLY:
|
||||
printk("Echo reply\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_MGM_QUERY:
|
||||
printk("Multicast listener query\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_MGM_REPORT:
|
||||
printk("Multicast listener report\n");
|
||||
break;
|
||||
|
||||
case ICMPV6_MGM_REDUCTION:
|
||||
printk("Multicast listener done\n");
|
||||
break;
|
||||
|
||||
case NDISC_ROUTER_SOLICITATION:
|
||||
printk("Router solicitation\n");
|
||||
break;
|
||||
|
||||
case NDISC_ROUTER_ADVERTISEMENT:
|
||||
printk("Router advertisment\n");
|
||||
break;
|
||||
|
||||
case NDISC_NEIGHBOUR_SOLICITATION:
|
||||
printk("Neighbour solicitation\n");
|
||||
break;
|
||||
|
||||
case NDISC_NEIGHBOUR_ADVERTISEMENT:
|
||||
printk("Neighbour advertisment\n");
|
||||
break;
|
||||
|
||||
case NDISC_REDIRECT:
|
||||
printk("redirect message\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void print_TOOL_pk_ipv6(struct ipv6hdr *iph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("PRINT_TOOL_PK_IPv6 - begin \n");
|
||||
#endif
|
||||
|
||||
if (iph==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_PK_IPv6 - input parameter iph is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
|
||||
if (iph!=NULL) {
|
||||
// char addr[OAI_NW_DRV_INET6_ADDRSTRLEN];
|
||||
printk("IP:\t version = %u, priority = %u, payload_len = %u\n", iph->version, iph->priority, ntohs(iph->payload_len));
|
||||
printk("\t fl0 = %u, fl1 = %u, fl2 = %u\n",iph->flow_lbl[0],iph->flow_lbl[1],iph->flow_lbl[2]);
|
||||
printk("\t next header = %u, hop_limit = %u\n", iph->nexthdr, iph->hop_limit);
|
||||
|
||||
// inet_ntop(AF_INET6, (void *)(&iph->saddr), addr, OAI_NW_DRV_INET6_ADDRSTRLEN);
|
||||
// printk("\t saddr = %s",addr);
|
||||
// inet_ntop(AF_INET6, (void *)(&iph->daddr), addr, OAI_NW_DRV_INET6_ADDRSTRLEN);
|
||||
// printk(", daddr = %s\n",addr);
|
||||
switch(iph->nexthdr) {
|
||||
case IPPROTO_UDP:
|
||||
print_TOOL_pk_udp((struct udphdr *)((char *)iph+sizeof(struct ipv6hdr)));
|
||||
break;
|
||||
|
||||
case IPPROTO_TCP:
|
||||
print_TOOL_pk_tcp((struct tcphdr *)((char *)iph+sizeof(struct ipv6hdr)));
|
||||
break;
|
||||
|
||||
case IPPROTO_ICMPV6:
|
||||
print_TOOL_pk_icmp6((struct icmp6hdr *)((char *)iph+sizeof(struct ipv6hdr)));
|
||||
break;
|
||||
|
||||
case IPPROTO_IPV6:
|
||||
print_TOOL_pk_ipv6((struct ipv6hdr *)((char *)iph+sizeof(struct ipv6hdr)));
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("Unknown upper layer\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void print_TOOL_pk_ipv4(struct iphdr *iph)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("PRINT_TOOL_PK_IPv4 - begin \n");
|
||||
#endif
|
||||
|
||||
if (iph==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_PK_IPv4 - input parameter iph is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
|
||||
if (iph!=NULL) {
|
||||
// char addr[OAI_NW_DRV_INET_ADDRSTRLEN];
|
||||
printk("IP:\t version = %u, IP length = %u\n", iph->version, iph->ihl);
|
||||
// inet_ntop(AF_INET, (void *)(&iph->saddr), addr, OAI_NW_DRV_INET_ADDRSTRLEN);
|
||||
// printk("\t saddr = %s", addr);
|
||||
// inet_ntop(AF_INET, (void *)(&iph->saddr), addr, OAI_NW_DRV_INET_ADDRSTRLEN);
|
||||
// printk("\t saddr = %s", addr);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void print_TOOL_pk_all(struct sk_buff *skb)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("Skb:\t %u, len = %u\n", (unsigned int)skb, skb->len);
|
||||
//navid: need to calculate the current used space: fixme?
|
||||
printk("Skb:\t available buf space = %u \n", skb->truesize);
|
||||
|
||||
switch (ntohs(skb->protocol)) {
|
||||
case ETH_P_IPV6:
|
||||
print_TOOL_pk_ipv6((struct ipv6hdr *)skb->network_header);
|
||||
break;
|
||||
|
||||
case ETH_P_IP:
|
||||
print_TOOL_pk_ipv4((struct iphdr *)skb->network_header);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -615,24 +727,29 @@ void print_TOOL_pk_all(struct sk_buff *skb){
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Print the content of a buffer in hexadecimal
|
||||
void oai_nw_drv_tool_print_buffer(char * buffer,int length) {
|
||||
//-----------------------------------------------------------------------------
|
||||
int i;
|
||||
void oai_nw_drv_tool_print_buffer(char * buffer,int length)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
int i;
|
||||
|
||||
// Start debug information
|
||||
// Start debug information
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_PRINT_BUFFER - begin \n");
|
||||
printk("OAI_NW_DRV_TOOL_PRINT_BUFFER - begin \n");
|
||||
#endif
|
||||
if (buffer==NULL){
|
||||
|
||||
if (buffer==NULL) {
|
||||
#ifdef OAI_NW_DRV_DEBUG_TOOL
|
||||
printk("OAI_NW_DRV_TOOL_PRINT_BUFFER - input parameter buffer is NULL \n");
|
||||
printk("OAI_NW_DRV_TOOL_PRINT_BUFFER - input parameter buffer is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
// End debug information
|
||||
printk("\nBuffer content: ");
|
||||
for (i=0;i<length;i++)
|
||||
printk("-%hx-",buffer[i]);
|
||||
printk(",\t length %d\n", length);
|
||||
|
||||
// End debug information
|
||||
printk("\nBuffer content: ");
|
||||
|
||||
for (i=0; i<length; i++)
|
||||
printk("-%hx-",buffer[i]);
|
||||
|
||||
printk(",\t length %d\n", length);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
copyright : (C) 2008 by Eurecom
|
||||
email : raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr
|
||||
***************************************************************************
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -121,31 +121,34 @@ void IAL_NAS_ioctl_init(int inst)
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
|
||||
// Get an UDP IPv6 socket ??
|
||||
fd=socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (fd<0) {
|
||||
printf("Error opening socket\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
fd=socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
|
||||
gifr.type = NAS_MSG_STATISTIC_REQUEST;
|
||||
memset ((void *)dummy_buffer,0,800);
|
||||
gifr.msg= &(dummy_buffer[0]);
|
||||
msgrep=(struct nas_msg_statistic_reply *)(gifr.msg);
|
||||
printf("ioctl :Statistics requested\n");
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
if (err<0){
|
||||
printf("IOCTL error, err=%d\n",err);
|
||||
rc = -1;
|
||||
}
|
||||
printf("tx_packets = %u, rx_packets = %u\n", msgrep->tx_packets, msgrep->rx_packets);
|
||||
printf("tx_bytes = %u, rx_bytes = %u\n", msgrep->tx_bytes, msgrep->rx_bytes);
|
||||
printf("tx_errors = %u, rx_errors = %u\n", msgrep->tx_errors, msgrep->rx_errors);
|
||||
printf("tx_dropped = %u, rx_dropped = %u\n", msgrep->tx_dropped, msgrep->rx_dropped);
|
||||
|
||||
if (fd<0) {
|
||||
printf("Error opening socket\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
sprintf(gifr.name, "oai%d",inst);
|
||||
|
||||
gifr.type = NAS_MSG_STATISTIC_REQUEST;
|
||||
memset ((void *)dummy_buffer,0,800);
|
||||
gifr.msg= &(dummy_buffer[0]);
|
||||
msgrep=(struct nas_msg_statistic_reply *)(gifr.msg);
|
||||
printf("ioctl :Statistics requested\n");
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
if (err<0) {
|
||||
printf("IOCTL error, err=%d\n",err);
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
printf("tx_packets = %u, rx_packets = %u\n", msgrep->tx_packets, msgrep->rx_packets);
|
||||
printf("tx_bytes = %u, rx_bytes = %u\n", msgrep->tx_bytes, msgrep->rx_bytes);
|
||||
printf("tx_errors = %u, rx_errors = %u\n", msgrep->tx_errors, msgrep->rx_errors);
|
||||
printf("tx_dropped = %u, rx_dropped = %u\n", msgrep->tx_dropped, msgrep->rx_dropped);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#define ADD_RB 0
|
||||
@@ -155,276 +158,295 @@ void IAL_NAS_ioctl_init(int inst)
|
||||
int main(int argc,char **argv)
|
||||
//---------------------------------------------------------------------------
|
||||
{
|
||||
int done, rc, meas_polling_counter;
|
||||
fd_set readfds;
|
||||
struct timeval tv;
|
||||
int i;
|
||||
int err;
|
||||
char * buffer;
|
||||
int c;
|
||||
int action,rbset=0,cxset=0,instset=0,saddr_ipv4set=0,saddr_ipv6set=0,daddr_ipv4set=0,daddr_ipv6set=0,dscpset=0,mpls_outlabelset=0,mpls_inlabelset;
|
||||
char rb[100],cx[100],dscp[100],inst[100],mpls_outgoinglabel[100],mpls_incominglabel[100];
|
||||
int index;
|
||||
struct nas_msg_rb_establishment_request *msgreq;
|
||||
struct nas_msg_class_add_request *msgreq_class;
|
||||
in_addr_t saddr_ipv4,daddr_ipv4;
|
||||
struct in6_addr saddr_ipv6,daddr_ipv6;
|
||||
unsigned int mpls_outlabel,mpls_inlabel;
|
||||
|
||||
char addr_str[46];
|
||||
int done, rc, meas_polling_counter;
|
||||
fd_set readfds;
|
||||
struct timeval tv;
|
||||
int i;
|
||||
int err;
|
||||
char * buffer;
|
||||
int c;
|
||||
int action,rbset=0,cxset=0,instset=0,saddr_ipv4set=0,saddr_ipv6set=0,daddr_ipv4set=0,daddr_ipv6set=0,dscpset=0,mpls_outlabelset=0,mpls_inlabelset;
|
||||
char rb[100],cx[100],dscp[100],inst[100],mpls_outgoinglabel[100],mpls_incominglabel[100];
|
||||
int index;
|
||||
struct nas_msg_rb_establishment_request *msgreq;
|
||||
struct nas_msg_class_add_request *msgreq_class;
|
||||
in_addr_t saddr_ipv4,daddr_ipv4;
|
||||
struct in6_addr saddr_ipv6,daddr_ipv6;
|
||||
unsigned int mpls_outlabel,mpls_inlabel;
|
||||
|
||||
char addr_str[46];
|
||||
|
||||
|
||||
|
||||
// scan options
|
||||
rb[0] = '\0';
|
||||
cx[0] = '\0';
|
||||
dscp[0] = '\0';
|
||||
mpls_incominglabel[0] = '\0';
|
||||
mpls_outgoinglabel[0] = '\0';
|
||||
|
||||
while ((c = getopt (argc, argv, "adr:i:c:l:m:s:t:x:y:z:")) != -1)
|
||||
switch (c)
|
||||
{
|
||||
case 'a':
|
||||
action = ADD_RB;
|
||||
break;
|
||||
case 'd':
|
||||
action = DEL_RB;
|
||||
break;
|
||||
case 'r':
|
||||
strcpy(rb,optarg);
|
||||
rbset = 1;
|
||||
break;
|
||||
case 'i':
|
||||
strcpy(inst,optarg);
|
||||
instset = 1;
|
||||
break;
|
||||
case 'c':
|
||||
strcpy(cx,optarg);
|
||||
cxset = 1;
|
||||
break;
|
||||
case 'l':
|
||||
strcpy(mpls_outgoinglabel,optarg);
|
||||
mpls_outlabelset=1;
|
||||
break;
|
||||
case 'm':
|
||||
strcpy(mpls_incominglabel,optarg);
|
||||
mpls_inlabelset=1;
|
||||
break;
|
||||
case 's':
|
||||
inet_aton(optarg,&saddr_ipv4);
|
||||
saddr_ipv4set = 1;
|
||||
break;
|
||||
case 't':
|
||||
inet_aton(optarg,&daddr_ipv4);
|
||||
daddr_ipv4set = 1;
|
||||
break;
|
||||
case 'x':
|
||||
printf("IPv6: %s\n",optarg);
|
||||
inet_pton(AF_INET6,optarg,(void *)&saddr_ipv6);
|
||||
saddr_ipv6set = 1;
|
||||
break;
|
||||
case 'y':
|
||||
inet_pton(AF_INET6,optarg,(void *)&daddr_ipv6);
|
||||
daddr_ipv6set = 1;
|
||||
break;
|
||||
case 'z':
|
||||
dscpset=1;
|
||||
strcpy(dscp,optarg);
|
||||
break;
|
||||
case '?':
|
||||
if (isprint (optopt))
|
||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Unknown option character `\\x%x'.\n",
|
||||
optopt);
|
||||
return 1;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
// scan options
|
||||
rb[0] = '\0';
|
||||
cx[0] = '\0';
|
||||
dscp[0] = '\0';
|
||||
mpls_incominglabel[0] = '\0';
|
||||
mpls_outgoinglabel[0] = '\0';
|
||||
|
||||
while ((c = getopt (argc, argv, "adr:i:c:l:m:s:t:x:y:z:")) != -1)
|
||||
switch (c) {
|
||||
case 'a':
|
||||
action = ADD_RB;
|
||||
break;
|
||||
|
||||
printf ("action = %d, rb = %s,cx = %s\n", action, rb, cx);
|
||||
case 'd':
|
||||
action = DEL_RB;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
strcpy(rb,optarg);
|
||||
rbset = 1;
|
||||
break;
|
||||
|
||||
if (rbset==0) {
|
||||
printf("ERROR: Specify a RAB id!!\n");
|
||||
exit(-1);
|
||||
}
|
||||
if (cxset==0) {
|
||||
printf("ERROR: Specify an LCR !!\n");
|
||||
exit(-1);
|
||||
}
|
||||
if (instset==0){
|
||||
printf("ERROR: Specify an interface !!\n");
|
||||
exit(-1);
|
||||
case 'i':
|
||||
strcpy(inst,optarg);
|
||||
instset = 1;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
strcpy(cx,optarg);
|
||||
cxset = 1;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
strcpy(mpls_outgoinglabel,optarg);
|
||||
mpls_outlabelset=1;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
strcpy(mpls_incominglabel,optarg);
|
||||
mpls_inlabelset=1;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
inet_aton(optarg,&saddr_ipv4);
|
||||
saddr_ipv4set = 1;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
inet_aton(optarg,&daddr_ipv4);
|
||||
daddr_ipv4set = 1;
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
printf("IPv6: %s\n",optarg);
|
||||
inet_pton(AF_INET6,optarg,(void *)&saddr_ipv6);
|
||||
saddr_ipv6set = 1;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
inet_pton(AF_INET6,optarg,(void *)&daddr_ipv6);
|
||||
daddr_ipv6set = 1;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
dscpset=1;
|
||||
strcpy(dscp,optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
if (isprint (optopt))
|
||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Unknown option character `\\x%x'.\n",
|
||||
optopt);
|
||||
|
||||
return 1;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
if ((mpls_outlabelset == 0) && (saddr_ipv4set==0) && (saddr_ipv6set==0)) {
|
||||
printf("ERROR: Specify a source IP address\n");
|
||||
exit(-1);
|
||||
}
|
||||
if ((mpls_outlabelset == 0) && (daddr_ipv4set==0) && (daddr_ipv6set==0)) {
|
||||
printf("ERROR: Specify a destination IP address\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((mpls_outlabelset == 1) && (mpls_inlabelset == 0)) {
|
||||
printf("ERROR: Specify an incoming MPLS label\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((mpls_inlabelset == 1) && (mpls_outlabelset == 0)) {
|
||||
printf("ERROR: Specify an outgoing MPLS label\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
IAL_NAS_ioctl_init(atoi(inst));
|
||||
|
||||
msgreq = (struct nas_msg_rb_establishment_request *)(gifr.msg);
|
||||
msgreq->rab_id = atoi(rb);
|
||||
msgreq->lcr = atoi(cx);
|
||||
msgreq->qos = 0;
|
||||
printf ("action = %d, rb = %s,cx = %s\n", action, rb, cx);
|
||||
|
||||
|
||||
if (action == ADD_RB) {
|
||||
gifr.type = NAS_MSG_RB_ESTABLISHMENT_REQUEST;
|
||||
if (rbset==0) {
|
||||
printf("ERROR: Specify a RAB id!!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (cxset==0) {
|
||||
printf("ERROR: Specify an LCR !!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (instset==0) {
|
||||
printf("ERROR: Specify an interface !!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((mpls_outlabelset == 0) && (saddr_ipv4set==0) && (saddr_ipv6set==0)) {
|
||||
printf("ERROR: Specify a source IP address\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((mpls_outlabelset == 0) && (daddr_ipv4set==0) && (daddr_ipv6set==0)) {
|
||||
printf("ERROR: Specify a destination IP address\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((mpls_outlabelset == 1) && (mpls_inlabelset == 0)) {
|
||||
printf("ERROR: Specify an incoming MPLS label\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((mpls_inlabelset == 1) && (mpls_outlabelset == 0)) {
|
||||
printf("ERROR: Specify an outgoing MPLS label\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
IAL_NAS_ioctl_init(atoi(inst));
|
||||
|
||||
msgreq = (struct nas_msg_rb_establishment_request *)(gifr.msg);
|
||||
msgreq->rab_id = atoi(rb);
|
||||
msgreq->lcr = atoi(cx);
|
||||
msgreq->qos = 0;
|
||||
|
||||
|
||||
if (action == ADD_RB) {
|
||||
gifr.type = NAS_MSG_RB_ESTABLISHMENT_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
|
||||
|
||||
if (saddr_ipv4set == 1) {
|
||||
msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 4;
|
||||
|
||||
msgreq_class->classref = 0 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir = NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct = NAS_FCT_QOS_SEND;
|
||||
msgreq_class->saddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->daddr.ipv4 = daddr_ipv4;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
if (dscpset==0)
|
||||
msgreq_class->dscp=0;
|
||||
else
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 1+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir = NAS_DIRECTION_RECEIVE;
|
||||
|
||||
|
||||
|
||||
if (saddr_ipv4set == 1) {
|
||||
msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 4;
|
||||
|
||||
msgreq_class->classref = 0 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir = NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct = NAS_FCT_QOS_SEND;
|
||||
msgreq_class->saddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->daddr.ipv4 = daddr_ipv4;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
if (dscpset==0)
|
||||
msgreq_class->dscp=0;
|
||||
else
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 1+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir = NAS_DIRECTION_RECEIVE;
|
||||
|
||||
|
||||
msgreq_class->daddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->saddr.ipv4 = daddr_ipv4;
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
}
|
||||
if (saddr_ipv6set == 1) {
|
||||
msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 6;
|
||||
if (dscpset==0)
|
||||
msgreq_class->dscp=0;
|
||||
else
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
|
||||
msgreq_class->classref = 2+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct=NAS_FCT_QOS_SEND;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
memcpy(&msgreq_class->saddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->daddr.ipv6,&daddr_ipv6,16);
|
||||
|
||||
inet_ntop(AF_INET6,(void *)&saddr_ipv6,addr_str,46);
|
||||
printf("IPV6: Source %s\n",addr_str);
|
||||
inet_ntop(AF_INET6,(void *)&daddr_ipv6,addr_str,46);
|
||||
printf("IPV6: Dest %s\n",addr_str);
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 3+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_RECEIVE;
|
||||
memcpy(&msgreq_class->daddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->saddr.ipv6,&daddr_ipv6,16);
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
|
||||
}
|
||||
if (mpls_inlabelset == 1) {
|
||||
|
||||
msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = NAS_MPLS_VERSION_CODE;
|
||||
if (dscpset==0)
|
||||
msgreq_class->dscp=0;
|
||||
else
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
|
||||
msgreq_class->classref = 4 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct=NAS_FCT_QOS_SEND;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_outlabel = atoi(mpls_outgoinglabel);
|
||||
|
||||
printf("Setting MPLS outlabel %d with exp %d\n",mpls_outlabel,msgreq_class->dscp);
|
||||
|
||||
msgreq_class->daddr.mpls_label = mpls_outlabel;
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 5 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_RECEIVE;
|
||||
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_inlabel = atoi(mpls_incominglabel);
|
||||
|
||||
printf("Setting MPLS inlabel %d with exp %d\n",mpls_inlabel,msgreq_class->dscp);
|
||||
|
||||
msgreq_class->daddr.mpls_label = mpls_inlabel;
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else if (action == DEL_RB) {
|
||||
gifr.type = NAS_MSG_RB_RELEASE_REQUEST;
|
||||
msgreq_class->daddr.ipv4 = saddr_ipv4;
|
||||
msgreq_class->saddr.ipv4 = daddr_ipv4;
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
}
|
||||
|
||||
if (saddr_ipv6set == 1) {
|
||||
msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = 6;
|
||||
|
||||
if (dscpset==0)
|
||||
msgreq_class->dscp=0;
|
||||
else
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
|
||||
msgreq_class->classref = 2+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct=NAS_FCT_QOS_SEND;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
memcpy(&msgreq_class->saddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->daddr.ipv6,&daddr_ipv6,16);
|
||||
|
||||
inet_ntop(AF_INET6,(void *)&saddr_ipv6,addr_str,46);
|
||||
printf("IPV6: Source %s\n",addr_str);
|
||||
inet_ntop(AF_INET6,(void *)&daddr_ipv6,addr_str,46);
|
||||
printf("IPV6: Dest %s\n",addr_str);
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 3+(msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_RECEIVE;
|
||||
memcpy(&msgreq_class->daddr.ipv6,&saddr_ipv6,16);
|
||||
memcpy(&msgreq_class->saddr.ipv6,&daddr_ipv6,16);
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (mpls_inlabelset == 1) {
|
||||
|
||||
msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
msgreq_class->version = NAS_MPLS_VERSION_CODE;
|
||||
|
||||
if (dscpset==0)
|
||||
msgreq_class->dscp=0;
|
||||
else
|
||||
msgreq_class->dscp=atoi(dscp);
|
||||
|
||||
msgreq_class->classref = 4 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_SEND;
|
||||
msgreq_class->fct=NAS_FCT_QOS_SEND;
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_outlabel = atoi(mpls_outgoinglabel);
|
||||
|
||||
printf("Setting MPLS outlabel %d with exp %d\n",mpls_outlabel,msgreq_class->dscp);
|
||||
|
||||
msgreq_class->daddr.mpls_label = mpls_outlabel;
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
msgreq_class->rab_id = atoi(rb);
|
||||
msgreq_class->lcr = atoi(cx);
|
||||
|
||||
msgreq_class->classref = 5 + (msgreq_class->lcr<<3);
|
||||
msgreq_class->dir=NAS_DIRECTION_RECEIVE;
|
||||
|
||||
|
||||
// TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
|
||||
msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
|
||||
|
||||
mpls_inlabel = atoi(mpls_incominglabel);
|
||||
|
||||
printf("Setting MPLS inlabel %d with exp %d\n",mpls_inlabel,msgreq_class->dscp);
|
||||
|
||||
msgreq_class->daddr.mpls_label = mpls_inlabel;
|
||||
|
||||
gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
|
||||
|
||||
}
|
||||
} else if (action == DEL_RB) {
|
||||
gifr.type = NAS_MSG_RB_RELEASE_REQUEST;
|
||||
err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,17 +32,18 @@ struct msghdr msg;
|
||||
void foo( int sig )
|
||||
{
|
||||
|
||||
printf("I got cntl-C, closing socket\n");
|
||||
|
||||
printf("I got cntl-C, closing socket\n");
|
||||
|
||||
close(sock_fd);
|
||||
exit(-1);
|
||||
|
||||
close(sock_fd);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
#define NAS_NETLINK_ID 31
|
||||
|
||||
void main() {
|
||||
void main()
|
||||
{
|
||||
|
||||
|
||||
struct sigaction newaction;
|
||||
@@ -51,12 +52,12 @@ void main() {
|
||||
int len;
|
||||
|
||||
newaction.sa_handler = foo;
|
||||
|
||||
|
||||
if ( sigaction( SIGINT, &newaction, NULL ) == -1)
|
||||
perror("Could not install the new signal handler");
|
||||
|
||||
sock_fd = socket(PF_NETLINK, SOCK_RAW,NAS_NETLINK_ID);
|
||||
|
||||
|
||||
printf("Opened socket with fd %d\n",sock_fd);
|
||||
|
||||
ret = fcntl(sock_fd,F_SETFL,O_NONBLOCK);
|
||||
@@ -67,20 +68,20 @@ void main() {
|
||||
src_addr.nl_pid = 1;//getpid(); /* self pid */
|
||||
src_addr.nl_groups = 0; /* not in mcast groups */
|
||||
ret = bind(sock_fd, (struct sockaddr*)&src_addr,
|
||||
sizeof(src_addr));
|
||||
sizeof(src_addr));
|
||||
printf("bind returns %d\n",ret);
|
||||
|
||||
memset(&dest_addr, 0, sizeof(dest_addr));
|
||||
dest_addr.nl_family = AF_NETLINK;
|
||||
dest_addr.nl_pid = 0; /* For Linux Kernel */
|
||||
dest_addr.nl_groups = 0; /* unicast */
|
||||
|
||||
|
||||
nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD));
|
||||
/* Fill the netlink message header */
|
||||
nlh->nlmsg_len = NLMSG_SPACE(MAX_PAYLOAD);
|
||||
nlh->nlmsg_pid = 1;//getpid(); /* self pid */
|
||||
nlh->nlmsg_flags = 0;
|
||||
|
||||
|
||||
iov.iov_base = (void *)nlh;
|
||||
iov.iov_len = nlh->nlmsg_len;
|
||||
memset(&msg,0,sizeof(msg));
|
||||
@@ -88,34 +89,36 @@ void main() {
|
||||
msg.msg_namelen = sizeof(dest_addr);
|
||||
msg.msg_iov = &iov;
|
||||
msg.msg_iovlen = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Read message from kernel */
|
||||
memset(nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
|
||||
|
||||
while (1) {
|
||||
len = recvmsg(sock_fd, &msg, 0);
|
||||
|
||||
|
||||
|
||||
if (len<0) {
|
||||
|
||||
// exit(-1);
|
||||
}
|
||||
else {
|
||||
printf("Received socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
|
||||
|
||||
// exit(-1);
|
||||
} else {
|
||||
printf("Received socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
|
||||
}
|
||||
|
||||
usleep(1000);
|
||||
i=i+1;
|
||||
|
||||
if ((i % 100) == 0)
|
||||
printf("%d\n",i);
|
||||
|
||||
/*
|
||||
for (i=0;i<nlh->nlmsg_len - sizeof(struct nlmsghdr);i++) {
|
||||
printf("%x ",
|
||||
((unsigned char *)NLMSG_DATA(nlh))[i]);
|
||||
}
|
||||
*/
|
||||
((unsigned char *)NLMSG_DATA(nlh))[i]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/* Close Netlink Socket */
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+336
-294
@@ -53,11 +53,12 @@
|
||||
#include <net/udp.h>
|
||||
|
||||
|
||||
void nas_COMMON_receive(uint16_t dlen,
|
||||
void *pdcp_sdu,
|
||||
int inst,
|
||||
struct classifier_entity *rclass,
|
||||
nasRadioBearerId_t rb_id) {
|
||||
void nas_COMMON_receive(uint16_t dlen,
|
||||
void *pdcp_sdu,
|
||||
int inst,
|
||||
struct classifier_entity *rclass,
|
||||
nasRadioBearerId_t rb_id)
|
||||
{
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct sk_buff *skb;
|
||||
@@ -75,26 +76,27 @@ void nas_COMMON_receive(uint16_t dlen,
|
||||
struct tcphdr *th;
|
||||
uint16_t *cksum,check;
|
||||
|
||||
struct iphdr *network_header;
|
||||
struct iphdr *network_header;
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
|
||||
printk("NAS_COMMON_RECEIVE: begin RB %d Inst %d Length %d bytes\n",rb_id,inst,dlen);
|
||||
#endif
|
||||
skb = dev_alloc_skb( dlen + 2 );
|
||||
if(!skb)
|
||||
{
|
||||
printk("NAS_COMMON_RECEIVE: low on memory\n");
|
||||
++gpriv->stats.rx_dropped;
|
||||
return;
|
||||
}
|
||||
|
||||
if(!skb) {
|
||||
printk("NAS_COMMON_RECEIVE: low on memory\n");
|
||||
++gpriv->stats.rx_dropped;
|
||||
return;
|
||||
}
|
||||
|
||||
skb_reserve(skb,2);
|
||||
memcpy(skb_put(skb, dlen), pdcp_sdu,dlen);
|
||||
|
||||
skb->dev = nasdev[inst];
|
||||
|
||||
|
||||
skb_reset_mac_header(skb);
|
||||
//printk("[NAC_COMMIN_RECEIVE]: Packet Type %d (%d,%d)",skb->pkt_type,PACKET_HOST,PACKET_BROADCAST);
|
||||
//printk("[NAC_COMMIN_RECEIVE]: Packet Type %d (%d,%d)",skb->pkt_type,PACKET_HOST,PACKET_BROADCAST);
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
|
||||
if (rclass->version != NAS_MPLS_VERSION_CODE) { // This is an IP packet
|
||||
@@ -103,191 +105,203 @@ void nas_COMMON_receive(uint16_t dlen,
|
||||
|
||||
|
||||
ipv = (struct ipversion *)skb->data;
|
||||
switch (ipv->version)
|
||||
{
|
||||
case 6:
|
||||
|
||||
switch (ipv->version) {
|
||||
case 6:
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("NAS_COMMON_RECEIVE: receive IPv6 message\n");
|
||||
printk("NAS_COMMON_RECEIVE: receive IPv6 message\n");
|
||||
#endif
|
||||
|
||||
|
||||
skb_reset_network_header(skb);
|
||||
skb_reset_network_header(skb);
|
||||
|
||||
skb->protocol = htons(ETH_P_IPV6);
|
||||
// printk("Writing packet with protocol %x\n",ntohs(skb->protocol));
|
||||
skb->protocol = htons(ETH_P_IPV6);
|
||||
// printk("Writing packet with protocol %x\n",ntohs(skb->protocol));
|
||||
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
|
||||
case 4:
|
||||
#ifdef NAS_ADDRESS_FIX
|
||||
// Make the third byte of both the source and destination equal to the fourth of the destination
|
||||
// Make the third byte of both the source and destination equal to the fourth of the destination
|
||||
|
||||
|
||||
|
||||
daddr = (unsigned char *)&((struct iphdr *)skb->data)->daddr;
|
||||
odaddr = ((struct iphdr *)skb->data)->daddr;
|
||||
// sn = addr[3];
|
||||
saddr = (unsigned char *)&((struct iphdr *)skb->data)->saddr;
|
||||
osaddr = ((struct iphdr *)skb->data)->saddr;
|
||||
|
||||
if (daddr[0] == saddr[0]) {// same network
|
||||
daddr[2] = daddr[3]; // set third byte of destination to that of local machine so that local IP stack accepts the packet
|
||||
saddr[2] = daddr[3]; // set third byte of source to that of local machine so that local IP stack accepts the packet
|
||||
}
|
||||
else { // get the 3rd byte from device address in net_device structure
|
||||
ifaddr = (unsigned char *)(&(((struct in_device *)((nasdev[inst])->ip_ptr))->ifa_list->ifa_local));
|
||||
if (saddr[0] == ifaddr[0]) { // source is in same network as local machine
|
||||
daddr[0] += saddr[3]; // fix address of remote destination to undo change at source
|
||||
saddr[2] = ifaddr[2]; // set third byte to that of local machine so that local IP stack accepts the packet
|
||||
}
|
||||
else { // source is remote machine from outside network
|
||||
saddr[0] -= daddr[3]; // fix address of remote source to be understood by destination
|
||||
daddr[2] = daddr[3]; // fix 3rd byte of local address to be understood by IP stack of
|
||||
// destination
|
||||
}
|
||||
}
|
||||
|
||||
daddr = (unsigned char *)&((struct iphdr *)skb->data)->daddr;
|
||||
odaddr = ((struct iphdr *)skb->data)->daddr;
|
||||
// sn = addr[3];
|
||||
saddr = (unsigned char *)&((struct iphdr *)skb->data)->saddr;
|
||||
osaddr = ((struct iphdr *)skb->data)->saddr;
|
||||
|
||||
if (daddr[0] == saddr[0]) {// same network
|
||||
daddr[2] = daddr[3]; // set third byte of destination to that of local machine so that local IP stack accepts the packet
|
||||
saddr[2] = daddr[3]; // set third byte of source to that of local machine so that local IP stack accepts the packet
|
||||
} else { // get the 3rd byte from device address in net_device structure
|
||||
ifaddr = (unsigned char *)(&(((struct in_device *)((nasdev[inst])->ip_ptr))->ifa_list->ifa_local));
|
||||
|
||||
if (saddr[0] == ifaddr[0]) { // source is in same network as local machine
|
||||
daddr[0] += saddr[3]; // fix address of remote destination to undo change at source
|
||||
saddr[2] = ifaddr[2]; // set third byte to that of local machine so that local IP stack accepts the packet
|
||||
} else { // source is remote machine from outside network
|
||||
saddr[0] -= daddr[3]; // fix address of remote source to be understood by destination
|
||||
daddr[2] = daddr[3]; // fix 3rd byte of local address to be understood by IP stack of
|
||||
// destination
|
||||
}
|
||||
}
|
||||
|
||||
#endif //NAS_ADDRESS_FIX
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
// printk("NAS_TOOL_RECEIVE: receive IPv4 message\n");
|
||||
addr = (unsigned char *)&((struct iphdr *)skb->data)->saddr;
|
||||
if (addr) {
|
||||
// addr[2]^=0x01;
|
||||
printk("[NAS][COMMON][RECEIVE] Source %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
addr = (unsigned char *)&((struct iphdr *)skb->data)->daddr;
|
||||
if (addr){
|
||||
// addr[2]^=0x01;
|
||||
printk("[NAS][COMMON][RECEIVE] Dest %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
printk("[NAS][COMMON][RECEIVE] protocol %d\n",((struct iphdr *)skb->data)->protocol);
|
||||
|
||||
// printk("NAS_TOOL_RECEIVE: receive IPv4 message\n");
|
||||
addr = (unsigned char *)&((struct iphdr *)skb->data)->saddr;
|
||||
|
||||
if (addr) {
|
||||
// addr[2]^=0x01;
|
||||
printk("[NAS][COMMON][RECEIVE] Source %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
|
||||
addr = (unsigned char *)&((struct iphdr *)skb->data)->daddr;
|
||||
|
||||
if (addr) {
|
||||
// addr[2]^=0x01;
|
||||
printk("[NAS][COMMON][RECEIVE] Dest %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
|
||||
}
|
||||
|
||||
printk("[NAS][COMMON][RECEIVE] protocol %d\n",((struct iphdr *)skb->data)->protocol);
|
||||
|
||||
#endif
|
||||
|
||||
skb_reset_network_header(skb);
|
||||
network_header = (struct iphdr *)skb_network_header(skb);
|
||||
protocol = network_header->protocol;
|
||||
|
||||
skb_reset_network_header(skb);
|
||||
network_header = (struct iphdr *)skb_network_header(skb);
|
||||
protocol = network_header->protocol;
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
switch (protocol) {
|
||||
case IPPROTO_IP:
|
||||
printk("[NAS][COMMON][RECEIVE] Received Raw IPv4 packet\n");
|
||||
break;
|
||||
case IPPROTO_IPV6:
|
||||
printk("[NAS][COMMON][RECEIVE] Received Raw IPv6 packet\n");
|
||||
break;
|
||||
case IPPROTO_ICMP:
|
||||
printk("[NAS][COMMON][RECEIVE] Received Raw ICMP packet\n");
|
||||
break;
|
||||
case IPPROTO_TCP:
|
||||
printk("[NAS][COMMON][RECEIVE] Received TCP packet\n");
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
printk("[NAS][COMMON][RECEIVE] Received UDP packet\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (protocol) {
|
||||
case IPPROTO_IP:
|
||||
printk("[NAS][COMMON][RECEIVE] Received Raw IPv4 packet\n");
|
||||
break;
|
||||
|
||||
case IPPROTO_IPV6:
|
||||
printk("[NAS][COMMON][RECEIVE] Received Raw IPv6 packet\n");
|
||||
break;
|
||||
|
||||
case IPPROTO_ICMP:
|
||||
printk("[NAS][COMMON][RECEIVE] Received Raw ICMP packet\n");
|
||||
break;
|
||||
|
||||
case IPPROTO_TCP:
|
||||
printk("[NAS][COMMON][RECEIVE] Received TCP packet\n");
|
||||
break;
|
||||
|
||||
case IPPROTO_UDP:
|
||||
printk("[NAS][COMMON][RECEIVE] Received UDP packet\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NAS_ADDRESS_FIX
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("NAS_COMMON_RECEIVE: dumping the packet before the csum recalculation\n",skb->len);
|
||||
for (i=0;i<skb->len;i++)
|
||||
printk("%2x ",((unsigned char *)(skb->data))[i]);
|
||||
printk("\n");
|
||||
printk("NAS_COMMON_RECEIVE: dumping the packet before the csum recalculation\n",skb->len);
|
||||
|
||||
for (i=0; i<skb->len; i++)
|
||||
printk("%2x ",((unsigned char *)(skb->data))[i]);
|
||||
|
||||
printk("\n");
|
||||
#endif //NAS_DEBUG_RECEIVE
|
||||
|
||||
|
||||
network_header->check = 0;
|
||||
network_header->check = ip_fast_csum((unsigned char *) network_header,
|
||||
network_header->ihl);
|
||||
network_header->check = 0;
|
||||
network_header->check = ip_fast_csum((unsigned char *) network_header,
|
||||
network_header->ihl);
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("[NAS][COMMON][RECEIVE] IP Fast Checksum %x \n", network_header->check);
|
||||
printk("[NAS][COMMON][RECEIVE] IP Fast Checksum %x \n", network_header->check);
|
||||
#endif
|
||||
|
||||
// if (!(skb->nh.iph->frag_off & htons(IP_OFFSET))) {
|
||||
|
||||
// if (!(skb->nh.iph->frag_off & htons(IP_OFFSET))) {
|
||||
|
||||
|
||||
|
||||
switch(protocol)
|
||||
{
|
||||
|
||||
case IPPROTO_TCP:
|
||||
|
||||
cksum = (uint16_t*)&(((struct tcphdr*)((network_header + (network_header->ihl<<2))))->check);
|
||||
//check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum));
|
||||
|
||||
|
||||
switch(protocol) {
|
||||
|
||||
case IPPROTO_TCP:
|
||||
|
||||
cksum = (uint16_t*)&(((struct tcphdr*)((network_header + (network_header->ihl<<2))))->check);
|
||||
//check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum));
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("[NAS][COMMON] Inst %d TCP packet calculated CS %x, CS = %x (before), SA (%x)%x, DA (%x)%x\n",
|
||||
inst,
|
||||
network_header->check,
|
||||
*cksum,
|
||||
osaddr,
|
||||
((struct iphdr *)skb->data)->saddr,
|
||||
odaddr,
|
||||
((struct iphdr *)skb->data)->daddr);
|
||||
#endif
|
||||
check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr,0,0, ~(*cksum));
|
||||
*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, 0, 0, ~check);
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("[NAS][COMMON] Inst %d TCP packet NEW CS %x\n",
|
||||
inst,
|
||||
*cksum);
|
||||
printk("[NAS][COMMON] Inst %d TCP packet calculated CS %x, CS = %x (before), SA (%x)%x, DA (%x)%x\n",
|
||||
inst,
|
||||
network_header->check,
|
||||
*cksum,
|
||||
osaddr,
|
||||
((struct iphdr *)skb->data)->saddr,
|
||||
odaddr,
|
||||
((struct iphdr *)skb->data)->daddr);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case IPPROTO_UDP:
|
||||
|
||||
cksum = (uint16_t*)&(((struct udphdr*)((network_header + (network_header->ihl<<2))))->check);
|
||||
// check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum));
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("[NAS][COMMON] Inst %d UDP packet CS = %x (before), SA (%x)%x, DA (%x)%x\n",
|
||||
inst,
|
||||
*cksum,
|
||||
osaddr,
|
||||
((struct iphdr *)skb->data)->saddr,
|
||||
odaddr,
|
||||
((struct iphdr *)skb->data)->daddr);
|
||||
#endif
|
||||
check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr, 0,0, ~(*cksum));
|
||||
*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,0,0, ~check);
|
||||
//*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,udp_hdr(skb)->len, IPPROTO_UDP, ~check);
|
||||
check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr,0,0, ~(*cksum));
|
||||
*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, 0, 0, ~check);
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("[NAS][COMMON] Inst %d UDP packet NEW CS %x\n",
|
||||
inst,
|
||||
*cksum);
|
||||
#endif
|
||||
// if ((check = *cksum) != 0) {
|
||||
// src, dst, len, proto, sum
|
||||
printk("[NAS][COMMON] Inst %d TCP packet NEW CS %x\n",
|
||||
inst,
|
||||
*cksum);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
// }
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// }
|
||||
case IPPROTO_UDP:
|
||||
|
||||
cksum = (uint16_t*)&(((struct udphdr*)((network_header + (network_header->ihl<<2))))->check);
|
||||
// check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum));
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("[NAS][COMMON] Inst %d UDP packet CS = %x (before), SA (%x)%x, DA (%x)%x\n",
|
||||
inst,
|
||||
*cksum,
|
||||
osaddr,
|
||||
((struct iphdr *)skb->data)->saddr,
|
||||
odaddr,
|
||||
((struct iphdr *)skb->data)->daddr);
|
||||
#endif
|
||||
check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr, 0,0, ~(*cksum));
|
||||
*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,0,0, ~check);
|
||||
//*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,udp_hdr(skb)->len, IPPROTO_UDP, ~check);
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("[NAS][COMMON] Inst %d UDP packet NEW CS %x\n",
|
||||
inst,
|
||||
*cksum);
|
||||
#endif
|
||||
// if ((check = *cksum) != 0) {
|
||||
// src, dst, len, proto, sum
|
||||
|
||||
|
||||
// }
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
#endif //NAS_ADDRESS_FIX
|
||||
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
// printk("[NAS][COMMON] Writing packet with protocol %x\n",ntohs(skb->protocol));
|
||||
break;
|
||||
default:
|
||||
printk("NAS_COMMON_RECEIVE: begin RB %d Inst %d Length %d bytes\n",rb_id,inst,dlen);
|
||||
|
||||
printk("[NAS][COMMON] Inst %d: receive unknown message (version=%d)\n",inst,ipv->version);
|
||||
|
||||
}
|
||||
}
|
||||
else { // This is an MPLS packet
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
// printk("[NAS][COMMON] Writing packet with protocol %x\n",ntohs(skb->protocol));
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("NAS_COMMON_RECEIVE: begin RB %d Inst %d Length %d bytes\n",rb_id,inst,dlen);
|
||||
|
||||
printk("[NAS][COMMON] Inst %d: receive unknown message (version=%d)\n",inst,ipv->version);
|
||||
|
||||
}
|
||||
} else { // This is an MPLS packet
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("NAS_COMMON_RECEIVE: Received an MPLS packet on RB %d\n",rb_id);
|
||||
@@ -295,12 +309,15 @@ void nas_COMMON_receive(uint16_t dlen,
|
||||
skb->protocol = htons(ETH_P_MPLS_UC);
|
||||
|
||||
}
|
||||
|
||||
++gpriv->stats.rx_packets;
|
||||
gpriv->stats.rx_bytes += dlen;
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("NAS_COMMON_RECEIVE: sending packet of size %d to kernel\n",skb->len);
|
||||
for (i=0;i<skb->len;i++)
|
||||
printk("%2x ",((unsigned char *)(skb->data))[i]);
|
||||
|
||||
for (i=0; i<skb->len; i++)
|
||||
printk("%2x ",((unsigned char *)(skb->data))[i]);
|
||||
|
||||
printk("\n");
|
||||
#endif //NAS_DEBUG_RECEIVE
|
||||
netif_rx(skb);
|
||||
@@ -311,7 +328,8 @@ void nas_COMMON_receive(uint16_t dlen,
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Delete the data
|
||||
void nas_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp,int inst){
|
||||
void nas_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp,int inst)
|
||||
{
|
||||
struct nas_priv *priv=netdev_priv(nasdev[inst]);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -321,7 +339,8 @@ void nas_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct class
|
||||
//---------------------------------------------------------------------------
|
||||
// Request the transfer of data (QoS SAP)
|
||||
|
||||
void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst){
|
||||
void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct pdcp_data_req_header_s pdcph;
|
||||
struct nas_priv *priv=netdev_priv(nasdev[inst]);
|
||||
@@ -329,46 +348,50 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class
|
||||
int i;
|
||||
#endif
|
||||
unsigned int bytes_wrote;
|
||||
unsigned char j;
|
||||
unsigned char j;
|
||||
// Start debug information
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("NAS_COMMON_QOS_SEND - inst %d begin \n",inst);
|
||||
#endif
|
||||
// if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
|
||||
// {
|
||||
// priv->stats.tx_dropped ++;
|
||||
// printk("NAS_QOS_SEND: No connected, so message are dropped \n");
|
||||
// return;
|
||||
// }
|
||||
if (skb==NULL){
|
||||
|
||||
// if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
|
||||
// {
|
||||
// priv->stats.tx_dropped ++;
|
||||
// printk("NAS_QOS_SEND: No connected, so message are dropped \n");
|
||||
// return;
|
||||
// }
|
||||
if (skb==NULL) {
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("NAS_COMMON_QOS_SEND - input parameter skb is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (gc==NULL){
|
||||
|
||||
if (gc==NULL) {
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("NAS_COMMON_QOS_SEND - input parameter gc is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (cx==NULL){
|
||||
|
||||
if (cx==NULL) {
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("NAS_COMMON_QOS_SEND - input parameter cx is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
if (gc->rb==NULL)
|
||||
{
|
||||
gc->rb=nas_COMMON_search_rb(cx, gc->rab_id);
|
||||
if (gc->rb==NULL)
|
||||
{
|
||||
++priv->stats.tx_dropped;
|
||||
printk("NAS_COMMON_QOS_SEND: No corresponding Radio Bearer, so message are dropped, rab_id=%u \n", gc->rab_id);
|
||||
return;
|
||||
}
|
||||
if (gc->rb==NULL) {
|
||||
gc->rb=nas_COMMON_search_rb(cx, gc->rab_id);
|
||||
|
||||
if (gc->rb==NULL) {
|
||||
++priv->stats.tx_dropped;
|
||||
printk("NAS_COMMON_QOS_SEND: No corresponding Radio Bearer, so message are dropped, rab_id=%u \n", gc->rab_id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("NAS_COMMON_QOS_SEND #1 :");
|
||||
printk("lcr %u, rab_id %u, rab_id %u, skb_len %d\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id,skb->len);
|
||||
@@ -383,49 +406,50 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class
|
||||
bytes_wrote = nas_netlink_send((char *)&pdcph,NAS_PDCPH_SIZE);
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("[NAS] Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n",
|
||||
bytes_wrote,skb->len);
|
||||
bytes_wrote,skb->len);
|
||||
#endif
|
||||
#else
|
||||
bytes_wrote = rtf_put(NAS2PDCP_FIFO, &pdcph, NAS_PDCPH_SIZE);
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("[NAS] Wrote %d bytes (header for %d byte skb) to PDCP fifo\n",
|
||||
bytes_wrote,skb->len);
|
||||
bytes_wrote,skb->len);
|
||||
#endif
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
if (bytes_wrote != NAS_PDCPH_SIZE)
|
||||
{
|
||||
printk("NAS_COMMON_QOS_SEND: problem while writing PDCP's header (bytes wrote = %d )\n",bytes_wrote);
|
||||
printk("rb_id %d, Wrote %d, Header Size %lu\n", pdcph.rb_id , bytes_wrote, NAS_PDCPH_SIZE);
|
||||
|
||||
if (bytes_wrote != NAS_PDCPH_SIZE) {
|
||||
printk("NAS_COMMON_QOS_SEND: problem while writing PDCP's header (bytes wrote = %d )\n",bytes_wrote);
|
||||
printk("rb_id %d, Wrote %d, Header Size %lu\n", pdcph.rb_id , bytes_wrote, NAS_PDCPH_SIZE);
|
||||
#ifndef NAS_NETLINK
|
||||
rtf_reset(NAS2PDCP_FIFO);
|
||||
rtf_reset(NAS2PDCP_FIFO);
|
||||
#endif //NAS_NETLINK
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef NAS_NETLINK
|
||||
bytes_wrote += nas_netlink_send((char *)skb->data,skb->len);
|
||||
#else
|
||||
bytes_wrote += rtf_put(NAS2PDCP_FIFO, skb->data, skb->len);
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
if (bytes_wrote != skb->len+NAS_PDCPH_SIZE)
|
||||
{
|
||||
printk("NAS_COMMON_QOS_SEND: Inst %d, RB_ID %d: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %lu\n",
|
||||
inst,
|
||||
pdcph.rb_id,
|
||||
bytes_wrote,
|
||||
skb->len,
|
||||
NAS_PDCPH_SIZE); // congestion
|
||||
if (bytes_wrote != skb->len+NAS_PDCPH_SIZE) {
|
||||
printk("NAS_COMMON_QOS_SEND: Inst %d, RB_ID %d: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %lu\n",
|
||||
inst,
|
||||
pdcph.rb_id,
|
||||
bytes_wrote,
|
||||
skb->len,
|
||||
NAS_PDCPH_SIZE); // congestion
|
||||
#ifndef NAS_NETLINK
|
||||
rtf_reset(NAS2PDCP_FIFO);
|
||||
rtf_reset(NAS2PDCP_FIFO);
|
||||
#endif //NAS_NETLINK
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_SEND
|
||||
printk("NAS_SEND: Sending packet of size %d to PDCP \n",skb->len);
|
||||
|
||||
for (j=0;j<skb->len;j++)
|
||||
printk("%2x ",((unsigned char *)(skb->data))[j]);
|
||||
|
||||
for (j=0; j<skb->len; j++)
|
||||
printk("%2x ",((unsigned char *)(skb->data))[j]);
|
||||
|
||||
printk("\n");
|
||||
#endif
|
||||
|
||||
@@ -438,7 +462,8 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class
|
||||
|
||||
#ifndef NAS_NETLINK
|
||||
//---------------------------------------------------------------------------
|
||||
void nas_COMMON_QOS_receive(){
|
||||
void nas_COMMON_QOS_receive()
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t sapi;
|
||||
struct pdcp_data_ind_header_s pdcph;
|
||||
@@ -451,48 +476,47 @@ void nas_COMMON_QOS_receive(){
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("NAS_COMMON_QOS_RECEIVE - begin \n");
|
||||
#endif
|
||||
|
||||
|
||||
// End debug information
|
||||
|
||||
|
||||
bytes_read = rtf_get(PDCP2NAS_FIFO,&pdcph, NAS_PDCPH_SIZE);
|
||||
|
||||
|
||||
while (bytes_read>0) {
|
||||
if (bytes_read != NAS_PDCPH_SIZE)
|
||||
{
|
||||
printk("NAS_COMMON_QOS_RECEIVE: problem while reading PDCP header\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (bytes_read != NAS_PDCPH_SIZE) {
|
||||
printk("NAS_COMMON_QOS_RECEIVE: problem while reading PDCP header\n");
|
||||
return;
|
||||
}
|
||||
|
||||
priv=netdev_priv(nasdev[pdcph.inst]);
|
||||
rclass = nas_COMMON_search_class_for_rb(pdcph.rb_id,priv);
|
||||
|
||||
bytes_read+= rtf_get(PDCP2NAS_FIFO,
|
||||
data_buffer,
|
||||
pdcph.data_size);
|
||||
|
||||
|
||||
bytes_read+= rtf_get(PDCP2NAS_FIFO,
|
||||
data_buffer,
|
||||
pdcph.data_size);
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("NAS_COMMON_QOS_RECEIVE - Got header for RB %d, Inst %d \n",
|
||||
pdcph.rb_id,
|
||||
pdcph.inst);
|
||||
pdcph.rb_id,
|
||||
pdcph.inst);
|
||||
#endif
|
||||
|
||||
|
||||
if (rclass) {
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("[NAS][COMMON] Found corresponding connection in classifier for RAB\n");
|
||||
#endif //NAS_DEBUG_RECEIVE
|
||||
|
||||
nas_COMMON_receive(pdcph.data_size,
|
||||
(void *)data_buffer,
|
||||
pdcph.inst,
|
||||
rclass,
|
||||
pdcph.rb_id);
|
||||
|
||||
nas_COMMON_receive(pdcph.data_size,
|
||||
(void *)data_buffer,
|
||||
pdcph.inst,
|
||||
rclass,
|
||||
pdcph.rb_id);
|
||||
}
|
||||
|
||||
|
||||
bytes_read = rtf_get(PDCP2NAS_FIFO, &pdcph, NAS_PDCPH_SIZE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("NAS_COMMON_QOS_RECEIVE - end \n");
|
||||
#endif
|
||||
@@ -511,7 +535,7 @@ void nas_COMMON_QOS_receive(struct nlmsghdr *nlh)
|
||||
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("[NAS][COMMON][NETLINK] QOS receive from PDCP, size %d, rab %d, inst %d\n",
|
||||
pdcph->data_size,pdcph->rb_id,pdcph->inst);
|
||||
pdcph->data_size,pdcph->rb_id,pdcph->inst);
|
||||
#endif //NAS_DEBUG_RECEIVE
|
||||
|
||||
rclass = nas_COMMON_search_class_for_rb(pdcph->rb_id,priv);
|
||||
@@ -520,23 +544,25 @@ void nas_COMMON_QOS_receive(struct nlmsghdr *nlh)
|
||||
#ifdef NAS_DEBUG_RECEIVE
|
||||
printk("[NAS][COMMON][NETLINK] Found corresponding connection in classifier for RAB\n");
|
||||
#endif //NAS_DEBUG_RECEIVE
|
||||
|
||||
nas_COMMON_receive(pdcph->data_size,
|
||||
(unsigned char *)NLMSG_DATA(nlh) + NAS_PDCPH_SIZE,
|
||||
pdcph->inst,
|
||||
rclass,
|
||||
pdcph->rb_id);
|
||||
}
|
||||
|
||||
nas_COMMON_receive(pdcph->data_size,
|
||||
(unsigned char *)NLMSG_DATA(nlh) + NAS_PDCPH_SIZE,
|
||||
pdcph->inst,
|
||||
rclass,
|
||||
pdcph->rb_id);
|
||||
}
|
||||
|
||||
}
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct cx_entity *nas_COMMON_search_cx(nasLocalConnectionRef_t lcr,struct nas_priv *priv){
|
||||
struct cx_entity *nas_COMMON_search_cx(nasLocalConnectionRef_t lcr,struct nas_priv *priv)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_COMMON_SEARCH_CX - lcr %d\n",lcr);
|
||||
#endif
|
||||
|
||||
if (lcr<NAS_CX_MAX)
|
||||
return priv->cx+lcr;
|
||||
else
|
||||
@@ -545,32 +571,37 @@ struct cx_entity *nas_COMMON_search_cx(nasLocalConnectionRef_t lcr,struct nas_pr
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Search a Radio Bearer
|
||||
struct rb_entity *nas_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id){
|
||||
struct rb_entity *nas_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *rb;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d\n", rab_id);
|
||||
#endif
|
||||
|
||||
for (rb=cx->rb; rb!=NULL; rb=rb->next) {
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS\n");
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.rab_id %u \n", rb->rab_id);
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.sapi %u \n", rb->sapi;
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.qos %u \n", rb->qos;
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.state %u \n", rb->state;
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.retry %u \n", rb->retry;
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.countimer %u \n\n", rb->countimer;);
|
||||
printk("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS\n");
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.rab_id %u \n", rb->rab_id);
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.sapi %u \n", rb->sapi;
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.qos %u \n", rb->qos;
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.state %u \n", rb->state;
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.retry %u \n", rb->retry;
|
||||
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.countimer %u \n\n", rb->countimer;);
|
||||
#endif
|
||||
if (rb->rab_id==rab_id)
|
||||
return rb;
|
||||
|
||||
if (rb->rab_id==rab_id)
|
||||
return rb;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Search for a classifier with corresponding radio bearer
|
||||
//
|
||||
// Search for a classifier with corresponding radio bearer
|
||||
|
||||
struct classifier_entity *nas_COMMON_search_class_for_rb(nasRadioBearerId_t rab_id,struct nas_priv *priv) {
|
||||
struct classifier_entity *nas_COMMON_search_class_for_rb(nasRadioBearerId_t rab_id,struct nas_priv *priv)
|
||||
{
|
||||
|
||||
struct rb_entity *rb;
|
||||
int dscp;
|
||||
@@ -579,57 +610,63 @@ struct classifier_entity *nas_COMMON_search_class_for_rb(nasRadioBearerId_t rab_
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("[NAS][COMMON] NAS_COMMON_SEARCH_CLASS_FOR_RB - rab_id %d\n", rab_id);
|
||||
#endif
|
||||
for (dscp=0;dscp<NAS_DSCP_MAX;dscp++) {
|
||||
|
||||
// printk("[NAS][COMMON] priv->rclassifier[%d] = %p\n",dscp,priv->rclassifier[dscp]);
|
||||
for (dscp=0; dscp<NAS_DSCP_MAX; dscp++) {
|
||||
|
||||
// printk("[NAS][COMMON] priv->rclassifier[%d] = %p\n",dscp,priv->rclassifier[dscp]);
|
||||
for (rclass=priv->rclassifier[dscp]; rclass!=NULL; rclass=rclass->next) {
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("[NAS][COMMON] NAS_COMMON_SEARCH_CLASS_FOR_RB - dscp %d, rb %d\n", dscp,rclass->rab_id);
|
||||
#endif
|
||||
|
||||
if (rclass->rab_id==rab_id)
|
||||
return rclass;
|
||||
return rclass;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *nas_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasQoSTrafficClass_t qos){
|
||||
struct rb_entity *nas_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasQoSTrafficClass_t qos)
|
||||
{
|
||||
//--------------------------------------------------------------------------
|
||||
struct rb_entity *rb;
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_COMMON_ADD_RB - begin for rab_id %d , qos %d\n", rab_id, qos );
|
||||
#endif
|
||||
if (cx==NULL){
|
||||
|
||||
if (cx==NULL) {
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_COMMON_ADD_RB - input parameter cx is NULL \n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rb=nas_COMMON_search_rb(cx, rab_id);
|
||||
if (rb==NULL)
|
||||
{
|
||||
rb=(struct rb_entity *)kmalloc(sizeof(struct rb_entity), GFP_KERNEL);
|
||||
if (rb!=NULL)
|
||||
{
|
||||
rb->retry=0;
|
||||
rb->countimer=NAS_TIMER_IDLE;
|
||||
rb->rab_id=rab_id;
|
||||
// rb->rab_id=rab_id+(32*cx->lcr);
|
||||
|
||||
if (rb==NULL) {
|
||||
rb=(struct rb_entity *)kmalloc(sizeof(struct rb_entity), GFP_KERNEL);
|
||||
|
||||
if (rb!=NULL) {
|
||||
rb->retry=0;
|
||||
rb->countimer=NAS_TIMER_IDLE;
|
||||
rb->rab_id=rab_id;
|
||||
// rb->rab_id=rab_id+(32*cx->lcr);
|
||||
#ifdef NAS_DEBUG_DC
|
||||
printk("NAS_COMMON_ADD_RB: rab_id=%u, mt_id=%u\n",rb->rab_id, cx->lcr);
|
||||
printk("NAS_COMMON_ADD_RB: rab_id=%u, mt_id=%u\n",rb->rab_id, cx->lcr);
|
||||
#endif
|
||||
rb->qos=qos;
|
||||
rb->sapi=NAS_RAB_INPUT_SAPI;
|
||||
rb->state=NAS_IDLE;
|
||||
rb->next=cx->rb;
|
||||
cx->rb=rb;
|
||||
++cx->num_rb;
|
||||
}
|
||||
else
|
||||
printk("NAS_ADD_CTL_RB: no memory\n");
|
||||
}
|
||||
rb->qos=qos;
|
||||
rb->sapi=NAS_RAB_INPUT_SAPI;
|
||||
rb->state=NAS_IDLE;
|
||||
rb->next=cx->rb;
|
||||
cx->rb=rb;
|
||||
++cx->num_rb;
|
||||
} else
|
||||
printk("NAS_ADD_CTL_RB: no memory\n");
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_COMMON_ADD_RB - end \n" );
|
||||
#endif
|
||||
@@ -637,7 +674,8 @@ struct rb_entity *nas_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nas_COMMON_flush_rb(struct cx_entity *cx){
|
||||
void nas_COMMON_flush_rb(struct cx_entity *cx)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct rb_entity *rb;
|
||||
struct classifier_entity *gc;
|
||||
@@ -646,25 +684,29 @@ void nas_COMMON_flush_rb(struct cx_entity *cx){
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_COMMON_FLUSH_RB - begin\n");
|
||||
#endif
|
||||
if (cx==NULL){
|
||||
|
||||
if (cx==NULL) {
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_COMMON_FLUSH_RB - input parameter cx is NULL \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
for (rb=cx->rb; rb!=NULL; rb=cx->rb){
|
||||
for (rb=cx->rb; rb!=NULL; rb=cx->rb) {
|
||||
printk("NAS_COMMON_FLUSH_RB: del rab_id %u\n", rb->rab_id);
|
||||
cx->rb=rb->next;
|
||||
kfree(rb);
|
||||
}
|
||||
|
||||
cx->num_rb=0;
|
||||
cx->rb=NULL;
|
||||
for(dscp=0; dscp<NAS_DSCP_MAX; ++dscp)
|
||||
{
|
||||
for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next)
|
||||
gc->rb=NULL;
|
||||
}
|
||||
|
||||
for(dscp=0; dscp<NAS_DSCP_MAX; ++dscp) {
|
||||
for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next)
|
||||
gc->rb=NULL;
|
||||
}
|
||||
|
||||
#ifdef NAS_DEBUG_CLASS
|
||||
printk("NAS_COMMON_FLUSH_RB - end\n");
|
||||
#endif
|
||||
|
||||
@@ -73,11 +73,11 @@
|
||||
//#define NAS_IID1_CONTROL 0x0
|
||||
//#define NAS_IID2_CONTROL __constant_htonl(0xffffffff)
|
||||
|
||||
//#define NAS_STATE_IDLE 0
|
||||
//#define NAS_STATE_CONNECTED 1
|
||||
//#define NAS_STATE_ESTABLISHMENT_REQUEST 2
|
||||
//#define NAS_STATE_ESTABLISHMENT_FAILURE 3
|
||||
//#define NAS_STATE_RELEASE_FAILURE 4
|
||||
//#define NAS_STATE_IDLE 0
|
||||
//#define NAS_STATE_CONNECTED 1
|
||||
//#define NAS_STATE_ESTABLISHMENT_REQUEST 2
|
||||
//#define NAS_STATE_ESTABLISHMENT_FAILURE 3
|
||||
//#define NAS_STATE_RELEASE_FAILURE 4
|
||||
#define NAS_CX_RELEASE_UNDEF_CAUSE 1
|
||||
|
||||
// MT+RG NAS States
|
||||
@@ -119,19 +119,19 @@
|
||||
#define NAS_IOCTL_RRM 0x89F0
|
||||
|
||||
// Error cause
|
||||
#define NAS_ERROR_ALREADYEXIST 1
|
||||
#define NAS_ERROR_NOMEMORY 3
|
||||
#define NAS_ERROR_NOTMT 9
|
||||
#define NAS_ERROR_NOTRG 10
|
||||
#define NAS_ERROR_NOTIDLE 11
|
||||
#define NAS_ERROR_NOTCONNECTED 12
|
||||
#define NAS_ERROR_NORB 14
|
||||
#define NAS_ERROR_NOTCORRECTVALUE 32
|
||||
#define NAS_ERROR_NOTCORRECTLCR 33
|
||||
#define NAS_ERROR_NOTCORRECTDIR 34
|
||||
#define NAS_ERROR_NOTCORRECTDSCP 35
|
||||
#define NAS_ERROR_NOTCORRECTVERSION 36
|
||||
#define NAS_ERROR_NOTCORRECTRABI 37
|
||||
#define NAS_ERROR_ALREADYEXIST 1
|
||||
#define NAS_ERROR_NOMEMORY 3
|
||||
#define NAS_ERROR_NOTMT 9
|
||||
#define NAS_ERROR_NOTRG 10
|
||||
#define NAS_ERROR_NOTIDLE 11
|
||||
#define NAS_ERROR_NOTCONNECTED 12
|
||||
#define NAS_ERROR_NORB 14
|
||||
#define NAS_ERROR_NOTCORRECTVALUE 32
|
||||
#define NAS_ERROR_NOTCORRECTLCR 33
|
||||
#define NAS_ERROR_NOTCORRECTDIR 34
|
||||
#define NAS_ERROR_NOTCORRECTDSCP 35
|
||||
#define NAS_ERROR_NOTCORRECTVERSION 36
|
||||
#define NAS_ERROR_NOTCORRECTRABI 37
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
@@ -157,12 +157,12 @@
|
||||
#define NAS_PROTOCOL_ICMP4 IPPROTO_ICMP
|
||||
#define NAS_PROTOCOL_ICMP6 IPPROTO_ICMPV6
|
||||
|
||||
#define NAS_PORT_DEFAULT __constant_htons(65535)
|
||||
#define NAS_PORT_HTTP __constant_htons(80)
|
||||
#define NAS_PORT_DEFAULT __constant_htons(65535)
|
||||
#define NAS_PORT_HTTP __constant_htons(80)
|
||||
|
||||
#define NAS_VERSION_DEFAULT 0
|
||||
#define NAS_VERSION_4 4
|
||||
#define NAS_VERSION_6 0 //?MW
|
||||
#define NAS_VERSION_DEFAULT 0
|
||||
#define NAS_VERSION_4 4
|
||||
#define NAS_VERSION_6 0 //?MW
|
||||
|
||||
#define NAS_DEFAULT_IPV4_ADDR 0
|
||||
#define NAS_DEFAULT_IPV6_ADDR0 0
|
||||
|
||||
+149
-116
@@ -33,7 +33,7 @@
|
||||
* \company Eurecom
|
||||
* \email: raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr, michelle.wetterwald@eurecom.fr,
|
||||
|
||||
*/
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
|
||||
#ifndef NAS_NETLINK
|
||||
@@ -43,7 +43,7 @@
|
||||
#endif // RTAI
|
||||
#endif // NAS_NETLINK
|
||||
|
||||
#include "constant.h"
|
||||
#include "constant.h"
|
||||
#include "local.h"
|
||||
#include "proto_extern.h"
|
||||
|
||||
@@ -69,27 +69,29 @@
|
||||
struct net_device *nasdev[NB_INSTANCES_MAX];
|
||||
|
||||
#ifdef NAS_NETLINK
|
||||
extern void nas_netlink_release(void);
|
||||
extern void nas_netlink_release(void);
|
||||
extern int nas_netlink_init(void);
|
||||
#endif
|
||||
|
||||
//int bytes_wrote;
|
||||
//int bytes_read;
|
||||
uint8_t NULL_IMEI[14]={0x05, 0x04, 0x03, 0x01, 0x02 ,0x00, 0x00, 0x00, 0x05, 0x04, 0x03 ,0x00, 0x01, 0x08};
|
||||
uint8_t NULL_IMEI[14]= {0x05, 0x04, 0x03, 0x01, 0x02 ,0x00, 0x00, 0x00, 0x05, 0x04, 0x03 ,0x00, 0x01, 0x08};
|
||||
|
||||
|
||||
static unsigned int nas_IMEI[6]={0x03, 0x01, 0x02 ,0x00, 0x00, 0x00}; // may change to char
|
||||
static unsigned int nas_IMEI[6]= {0x03, 0x01, 0x02 ,0x00, 0x00, 0x00}; // may change to char
|
||||
static int m_arg=0;
|
||||
static unsigned int nas_is_clusterhead=0;
|
||||
|
||||
|
||||
int find_inst(struct net_device *dev) {
|
||||
int find_inst(struct net_device *dev)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
for (i=0;i<NB_INSTANCES_MAX;i++)
|
||||
for (i=0; i<NB_INSTANCES_MAX; i++)
|
||||
if (nasdev[i] == dev)
|
||||
return(i);
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@@ -97,13 +99,14 @@ int find_inst(struct net_device *dev) {
|
||||
|
||||
#ifndef NAS_NETLINK
|
||||
//void interrupt(void){
|
||||
void *nas_interrupt(void){
|
||||
void *nas_interrupt(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t cxi;
|
||||
|
||||
// struct nas_priv *priv=netdev_priv(dev_id);
|
||||
// unsigned int flags;
|
||||
|
||||
|
||||
// priv->lock = SPIN_LOCK_UNLOCKED;
|
||||
|
||||
#ifdef DEBUG_INTERRUPT
|
||||
@@ -111,8 +114,8 @@ void *nas_interrupt(void){
|
||||
#endif
|
||||
// spin_lock_irqsave(&priv->lock,flags);
|
||||
cxi=0;
|
||||
// mesh_GC_receive();
|
||||
// mesh_DC_receive(naspriv->cx+cxi);
|
||||
// mesh_GC_receive();
|
||||
// mesh_DC_receive(naspriv->cx+cxi);
|
||||
#ifndef NAS_NETLINK
|
||||
nas_COMMON_QOS_receive();
|
||||
#endif
|
||||
@@ -126,19 +129,22 @@ void *nas_interrupt(void){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Called by ifconfig when the device is activated by ifconfig
|
||||
int nas_open(struct net_device *dev){
|
||||
int nas_open(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_priv *priv=netdev_priv(dev);
|
||||
|
||||
printk("OPEN: begin\n");
|
||||
// MOD_INC_USE_COUNT;
|
||||
// MOD_INC_USE_COUNT;
|
||||
|
||||
// Address has already been set at init
|
||||
#ifndef NAS_NETLINK
|
||||
if (pdcp_2_nas_irq==-EBUSY){
|
||||
printk("OPEN: irq failure\n");
|
||||
return -EBUSY;
|
||||
|
||||
if (pdcp_2_nas_irq==-EBUSY) {
|
||||
printk("OPEN: irq failure\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
#endif //NAS_NETLINK
|
||||
|
||||
/*
|
||||
@@ -157,19 +163,21 @@ int nas_open(struct net_device *dev){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Called by ifconfig when the device is desactivated
|
||||
int nas_stop(struct net_device *dev){
|
||||
int nas_stop(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
struct nas_priv *priv = netdev_priv(dev);
|
||||
printk("STOP: begin\n");
|
||||
del_timer(&(priv->timer));
|
||||
netif_stop_queue(dev);
|
||||
// MOD_DEC_USE_COUNT;
|
||||
// MOD_DEC_USE_COUNT;
|
||||
printk("STOP: name = %s, end\n", dev->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nas_teardown(struct net_device *dev){
|
||||
void nas_teardown(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
int cxi;
|
||||
|
||||
@@ -179,20 +187,22 @@ void nas_teardown(struct net_device *dev){
|
||||
if (dev) {
|
||||
priv = netdev_priv(dev);
|
||||
inst = find_inst(dev);
|
||||
|
||||
if (inst<0) {
|
||||
printk("nas_teardown: ERROR, couldn't find instance\n");
|
||||
}
|
||||
printk("nas_teardown instance %d: begin\n",inst);
|
||||
|
||||
|
||||
|
||||
printk("nas_teardown instance %d: begin\n",inst);
|
||||
|
||||
|
||||
|
||||
nas_CLASS_flush_rclassifier(priv);
|
||||
|
||||
for (cxi=0;cxi<NAS_CX_MAX;cxi++) {
|
||||
|
||||
for (cxi=0; cxi<NAS_CX_MAX; cxi++) {
|
||||
nas_COMMON_flush_rb(priv->cx+cxi);
|
||||
nas_CLASS_flush_sclassifier(priv->cx+cxi);
|
||||
}
|
||||
|
||||
|
||||
printk("nas_teardown: end\n");
|
||||
} // check dev
|
||||
else {
|
||||
@@ -201,24 +211,29 @@ void nas_teardown(struct net_device *dev){
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nas_set_config(struct net_device *dev, struct ifmap *map){
|
||||
int nas_set_config(struct net_device *dev, struct ifmap *map)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
printk("SET_CONFIG: begin\n");
|
||||
|
||||
if (dev->flags & IFF_UP)
|
||||
return -EBUSY;
|
||||
if (map->base_addr != dev->base_addr)
|
||||
{
|
||||
printk(KERN_WARNING "SET_CONFIG: Can't change I/O address\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (map->base_addr != dev->base_addr) {
|
||||
printk(KERN_WARNING "SET_CONFIG: Can't change I/O address\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (map->irq != dev->irq)
|
||||
dev->irq = map->irq;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
int nas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
|
||||
int nas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Start debug information
|
||||
|
||||
@@ -230,15 +245,17 @@ int nas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
|
||||
printk("nas_hard_start_xmit: ERROR, device is null\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (inst>=0) {
|
||||
#ifdef DEBUG_DEVICE
|
||||
printk("HARD_START_XMIT: inst %d, begin\n",inst);
|
||||
#endif
|
||||
if (!skb){
|
||||
|
||||
if (!skb) {
|
||||
printk("HARD_START_XMIT - input parameter skb is NULL \n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// End debug information
|
||||
netif_stop_queue(dev);
|
||||
dev->trans_start = jiffies;
|
||||
@@ -250,7 +267,7 @@ int nas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
|
||||
printk("HARD_START_XMIT: step 2\n");
|
||||
#endif
|
||||
// if (skb==NULL){
|
||||
// printk("HARD_START_XMIT - parameter skb is NULL \n");
|
||||
// printk("HARD_START_XMIT - parameter skb is NULL \n");
|
||||
// return -1;
|
||||
// }else
|
||||
dev_kfree_skb(skb);
|
||||
@@ -261,39 +278,44 @@ int nas_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){
|
||||
#ifdef DEBUG_DEVICE
|
||||
printk("HARD_START_XMIT: end\n");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
printk("nas_hard_start_xmit: ERROR, couldn't find instnace\n");
|
||||
} else {
|
||||
printk("nas_hard_start_xmit: ERROR, couldn't find instnace\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
struct net_device_stats *nas_get_stats(struct net_device *dev){
|
||||
struct net_device_stats *nas_get_stats(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// return &((struct nas_priv *)dev->priv)->stats;
|
||||
// return &((struct nas_priv *)dev->priv)->stats;
|
||||
struct nas_priv *priv = netdev_priv(dev);
|
||||
return &priv->stats;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int nas_change_mtu(struct net_device *dev, int mtu){
|
||||
int nas_change_mtu(struct net_device *dev, int mtu)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
printk("CHANGE_MTU: begin\n");
|
||||
|
||||
if ((mtu<50) || (mtu>1500))
|
||||
return -EINVAL;
|
||||
|
||||
dev->mtu = mtu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void nas_tx_timeout(struct net_device *dev){
|
||||
void nas_tx_timeout(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// Transmitter timeout, serious problems.
|
||||
struct nas_priv *priv = netdev_priv(dev);
|
||||
|
||||
|
||||
printk("TX_TIMEOUT: begin\n");
|
||||
// (struct nas_priv *)(dev->priv)->stats.tx_errors++;
|
||||
(priv->stats).tx_errors++;
|
||||
@@ -304,20 +326,21 @@ void nas_tx_timeout(struct net_device *dev){
|
||||
|
||||
static const struct net_device_ops nasmesh_netdev_ops = {
|
||||
|
||||
.ndo_open = nas_open,
|
||||
.ndo_stop = nas_stop,
|
||||
.ndo_start_xmit = nas_hard_start_xmit,
|
||||
.ndo_validate_addr = NULL,
|
||||
.ndo_set_mac_address = NULL,
|
||||
.ndo_set_config = nas_set_config,
|
||||
.ndo_do_ioctl = nas_CTL_ioctl,
|
||||
.ndo_change_mtu = nas_change_mtu,
|
||||
.ndo_tx_timeout = nas_tx_timeout,
|
||||
.ndo_open = nas_open,
|
||||
.ndo_stop = nas_stop,
|
||||
.ndo_start_xmit = nas_hard_start_xmit,
|
||||
.ndo_validate_addr = NULL,
|
||||
.ndo_set_mac_address = NULL,
|
||||
.ndo_set_config = nas_set_config,
|
||||
.ndo_do_ioctl = nas_CTL_ioctl,
|
||||
.ndo_change_mtu = nas_change_mtu,
|
||||
.ndo_tx_timeout = nas_tx_timeout,
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Initialisation of the network device
|
||||
void nas_init(struct net_device *dev){
|
||||
void nas_init(struct net_device *dev)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
uint8_t cxi, dscpi;
|
||||
struct nas_priv *priv;
|
||||
@@ -327,7 +350,7 @@ void nas_init(struct net_device *dev){
|
||||
priv = netdev_priv(dev);
|
||||
//memset(dev->priv, 0, sizeof(struct nas_priv));
|
||||
memset(priv, 0, sizeof(struct nas_priv));
|
||||
// priv=(struct nas_priv *)(dev->priv);
|
||||
// priv=(struct nas_priv *)(dev->priv);
|
||||
priv=netdev_priv(dev);
|
||||
//
|
||||
dev->netdev_ops = &nasmesh_netdev_ops;
|
||||
@@ -345,20 +368,22 @@ void nas_init(struct net_device *dev){
|
||||
// priv->sap[NAS_NT_SAPI] = RRC_DEVICE_NT;
|
||||
priv->sap[NAS_RAB_INPUT_SAPI] = PDCP2NAS_FIFO;//QOS_DEVICE_CONVERSATIONAL_INPUT;
|
||||
priv->sap[NAS_RAB_OUTPUT_SAPI] = NAS2PDCP_FIFO;//QOS_DEVICE_STREAMING_INPUT;
|
||||
|
||||
|
||||
// priv->retry_limit=RETRY_LIMIT_DEFAULT;
|
||||
// priv->timer_establishment=TIMER_ESTABLISHMENT_DEFAULT;
|
||||
// priv->timer_release=TIMER_RELEASE_DEFAULT;
|
||||
|
||||
|
||||
for (dscpi=0; dscpi<65; ++dscpi)
|
||||
priv->rclassifier[dscpi]=NULL;
|
||||
|
||||
priv->nrclassifier=0;
|
||||
|
||||
//
|
||||
for (cxi=0;cxi<NAS_CX_MAX;cxi++) {
|
||||
for (cxi=0; cxi<NAS_CX_MAX; cxi++) {
|
||||
#ifdef DEBUG_DEVICE
|
||||
printk("INIT: init classifiers, state and timer for MT %u\n", cxi);
|
||||
#endif
|
||||
|
||||
|
||||
// priv->cx[cxi].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT0;
|
||||
// priv->cx[cxi].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT0;
|
||||
priv->cx[cxi].state=NAS_IDLE;
|
||||
@@ -367,10 +392,11 @@ void nas_init(struct net_device *dev){
|
||||
priv->cx[cxi].lcr=cxi;
|
||||
priv->cx[cxi].rb=NULL;
|
||||
priv->cx[cxi].num_rb=0;
|
||||
|
||||
// initialisation of the classifier
|
||||
for (dscpi=0; dscpi<65; ++dscpi) {
|
||||
priv->cx[cxi].sclassifier[dscpi]=NULL;
|
||||
priv->cx[cxi].fclassifier[dscpi]=NULL;
|
||||
priv->cx[cxi].sclassifier[dscpi]=NULL;
|
||||
priv->cx[cxi].fclassifier[dscpi]=NULL;
|
||||
}
|
||||
|
||||
priv->cx[cxi].nsclassifier=0;
|
||||
@@ -380,27 +406,28 @@ void nas_init(struct net_device *dev){
|
||||
priv->cx[cxi].iid4=0;
|
||||
//
|
||||
}
|
||||
|
||||
spin_lock_init(&priv->lock);
|
||||
//this requires kernel patch for OAI driver: typically for RF/hard realtime emu experimentation
|
||||
#ifdef ADDRCONF
|
||||
#ifdef NETLINK
|
||||
nas_TOOL_imei2iid(IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
|
||||
nas_TOOL_imei2iid(IMEI, (uint8_t *)priv->cx[0].iid6);
|
||||
#else
|
||||
nas_TOOL_imei2iid(nas_IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
|
||||
nas_TOOL_imei2iid(nas_IMEI, (uint8_t *)priv->cx[0].iid6);
|
||||
#endif
|
||||
// this is more appropriate for user space soft realtime emulation
|
||||
//this requires kernel patch for OAI driver: typically for RF/hard realtime emu experimentation
|
||||
#ifdef ADDRCONF
|
||||
#ifdef NETLINK
|
||||
nas_TOOL_imei2iid(IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
|
||||
nas_TOOL_imei2iid(IMEI, (uint8_t *)priv->cx[0].iid6);
|
||||
#else
|
||||
memcpy(dev->dev_addr,&nas_IMEI[0],8);
|
||||
printk("Setting HW addr to : %X%X\n",*((unsigned int *)&dev->dev_addr[0]),*((unsigned int *)&dev->dev_addr[4]));
|
||||
|
||||
((unsigned char*)dev->dev_addr)[7] = (unsigned char)find_inst(dev);
|
||||
|
||||
memcpy((uint8_t *)priv->cx[0].iid6,&nas_IMEI[0],8);
|
||||
|
||||
printk("INIT: init IMEI to IID\n");
|
||||
#endif
|
||||
nas_TOOL_imei2iid(nas_IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
|
||||
nas_TOOL_imei2iid(nas_IMEI, (uint8_t *)priv->cx[0].iid6);
|
||||
#endif
|
||||
// this is more appropriate for user space soft realtime emulation
|
||||
#else
|
||||
memcpy(dev->dev_addr,&nas_IMEI[0],8);
|
||||
printk("Setting HW addr to : %X%X\n",*((unsigned int *)&dev->dev_addr[0]),*((unsigned int *)&dev->dev_addr[4]));
|
||||
|
||||
((unsigned char*)dev->dev_addr)[7] = (unsigned char)find_inst(dev);
|
||||
|
||||
memcpy((uint8_t *)priv->cx[0].iid6,&nas_IMEI[0],8);
|
||||
|
||||
printk("INIT: init IMEI to IID\n");
|
||||
#endif
|
||||
|
||||
printk("INIT: end\n");
|
||||
return;
|
||||
@@ -411,8 +438,9 @@ void nas_init(struct net_device *dev){
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int init_module (void) {
|
||||
//---------------------------------------------------------------------------
|
||||
int init_module (void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
int err,inst;
|
||||
struct nas_priv *priv;
|
||||
char devicename[100];
|
||||
@@ -427,23 +455,23 @@ int init_module (void) {
|
||||
#ifdef RTAI //with RTAI you have to indicate which irq# you want
|
||||
|
||||
pdcp_2_nas_irq=rt_request_srq(0, nas_interrupt, NULL);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
if (pdcp_2_nas_irq == -EBUSY || pdcp_2_nas_irq == -EINVAL){
|
||||
|
||||
if (pdcp_2_nas_irq == -EBUSY || pdcp_2_nas_irq == -EINVAL) {
|
||||
printk("[NAS][INIT] No interrupt resource available\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
else
|
||||
} else
|
||||
printk("[NAS][INIT]: Interrupt %d\n", pdcp_2_nas_irq);
|
||||
|
||||
//rt_startup_irq(RTAI_IRQ);
|
||||
|
||||
|
||||
//rt_enable_irq(RTAI_IRQ);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif //NETLINK
|
||||
|
||||
for (inst=0;inst<NB_INSTANCES_MAX;inst++) {
|
||||
|
||||
for (inst=0; inst<NB_INSTANCES_MAX; inst++) {
|
||||
printk("[NAS][INIT] nasmesh_init_module: begin init instance %d\n",inst);
|
||||
|
||||
|
||||
@@ -455,12 +483,12 @@ int init_module (void) {
|
||||
#endif
|
||||
priv = netdev_priv(nasdev[inst]);
|
||||
|
||||
if (nasdev[inst]){
|
||||
if (nasdev[inst]) {
|
||||
nas_mesh_init(inst);
|
||||
//memcpy(nasdev[inst]->dev_addr,&nas_IMEI[0],8);
|
||||
nas_TOOL_imei2iid(nas_IMEI, nasdev[inst]->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
|
||||
nas_TOOL_imei2iid(nas_IMEI, (uint8_t *)priv->cx[0].iid6);
|
||||
// TO HAVE DIFFERENT HW @
|
||||
// TO HAVE DIFFERENT HW @
|
||||
((unsigned char*)nasdev[inst]->dev_addr)[7] = ((unsigned char*)nasdev[inst]->dev_addr)[7] + (unsigned char)inst + 1;
|
||||
printk("Setting HW addr for INST %d to : %X%X\n",inst,*((unsigned int *)&nasdev[inst]->dev_addr[0]),*((unsigned int *)&nasdev[inst]->dev_addr[4]));
|
||||
|
||||
@@ -469,16 +497,19 @@ int init_module (void) {
|
||||
|
||||
|
||||
err= register_netdev(nasdev[inst]);
|
||||
if (err){
|
||||
|
||||
if (err) {
|
||||
printk("[NAS][INIT] nasmesh_init_module (inst %d): error %i registering device %s\n", inst,err, nasdev[inst]->name);
|
||||
}else{
|
||||
} else {
|
||||
printk("nasmesh_init_module: registering device %s, ifindex = %d\n\n",nasdev[inst]->name, nasdev[inst]->ifindex);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NAS_NETLINK
|
||||
|
||||
if ((err=nas_netlink_init()) == -1)
|
||||
printk("[NAS][INIT] NETLINK failed\n");
|
||||
|
||||
printk("[NAS][INIT] NETLINK INIT\n");
|
||||
|
||||
#endif //NETLINK
|
||||
@@ -486,10 +517,11 @@ int init_module (void) {
|
||||
return err;
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void cleanup_module(void){
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void cleanup_module(void)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int inst;
|
||||
|
||||
@@ -497,6 +529,7 @@ void cleanup_module(void){
|
||||
printk("[NAS][CLEANUP]nasmesh_cleanup_module: begin\n");
|
||||
|
||||
#ifndef NAS_NETLINK
|
||||
|
||||
if (pdcp_2_nas_irq!=-EBUSY) {
|
||||
pdcp_2_nas_irq=0;
|
||||
#ifdef RTAI
|
||||
@@ -508,26 +541,26 @@ void cleanup_module(void){
|
||||
// Start IRQ linux
|
||||
// free_irq(priv->irq, NULL);
|
||||
// End IRQ linux
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#else // NETLINK
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif //NETLINK
|
||||
|
||||
for (inst=0;inst<NB_INSTANCES_MAX;inst++) {
|
||||
#ifdef DEBUG_DEVICE
|
||||
printk("nasmesh_cleanup_module: unregister and free net device instance %d\n",inst);
|
||||
#endif
|
||||
unregister_netdev(nasdev[inst]);
|
||||
nas_teardown(nasdev[inst]);
|
||||
free_netdev(nasdev[inst]);
|
||||
}
|
||||
for (inst=0; inst<NB_INSTANCES_MAX; inst++) {
|
||||
#ifdef DEBUG_DEVICE
|
||||
printk("nasmesh_cleanup_module: unregister and free net device instance %d\n",inst);
|
||||
#endif
|
||||
unregister_netdev(nasdev[inst]);
|
||||
nas_teardown(nasdev[inst]);
|
||||
free_netdev(nasdev[inst]);
|
||||
}
|
||||
|
||||
#ifdef NAS_NETLINK
|
||||
nas_netlink_release();
|
||||
nas_netlink_release();
|
||||
#endif //NAS_NETLINK
|
||||
printk("nasmesh_cleanup_module: end\n");
|
||||
}
|
||||
@@ -536,10 +569,10 @@ void cleanup_module(void){
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
|
||||
|
||||
#define DRV_NAME "NASMESH"
|
||||
#define DRV_VERSION "3.0.2"DRV_NAME
|
||||
#define DRV_DESCRIPTION "OPENAIR MESH Device Driver"
|
||||
#define DRV_COPYRIGHT "-Copyright(c) GNU GPL Eurecom 2009"
|
||||
#define DRV_NAME "NASMESH"
|
||||
#define DRV_VERSION "3.0.2"DRV_NAME
|
||||
#define DRV_DESCRIPTION "OPENAIR MESH Device Driver"
|
||||
#define DRV_COPYRIGHT "-Copyright(c) GNU GPL Eurecom 2009"
|
||||
#define DRV_AUTHOR "Raymond Knopp, and Navid Nikaein: <firstname.name@eurecom.fr>"DRV_COPYRIGHT
|
||||
|
||||
module_param_array(nas_IMEI,uint,&m_arg,0444);
|
||||
|
||||
+462
-386
File diff suppressed because it is too large
Load Diff
+109
-132
@@ -23,117 +23,104 @@
|
||||
#define NAS_MSG_MAXLEN 1100/// change???
|
||||
|
||||
// type of CTL message
|
||||
#define NAS_MSG_STATISTIC_REQUEST 1
|
||||
#define NAS_MSG_STATISTIC_REPLY 2
|
||||
#define NAS_MSG_ECHO_REQUEST 3
|
||||
#define NAS_MSG_ECHO_REPLY 4
|
||||
#define NAS_MSG_CX_ESTABLISHMENT_REQUEST 5
|
||||
#define NAS_MSG_CX_ESTABLISHMENT_REPLY 6
|
||||
#define NAS_MSG_CX_RELEASE_REQUEST 7
|
||||
#define NAS_MSG_CX_RELEASE_REPLY 8
|
||||
#define NAS_MSG_CX_LIST_REQUEST 9
|
||||
#define NAS_MSG_CX_LIST_REPLY 10
|
||||
#define NAS_MSG_RB_ESTABLISHMENT_REQUEST 11
|
||||
#define NAS_MSG_RB_ESTABLISHMENT_REPLY 12
|
||||
#define NAS_MSG_RB_RELEASE_REQUEST 13
|
||||
#define NAS_MSG_RB_RELEASE_REPLY 14
|
||||
#define NAS_MSG_RB_LIST_REQUEST 15
|
||||
#define NAS_MSG_RB_LIST_REPLY 16
|
||||
#define NAS_MSG_CLASS_ADD_REQUEST 17
|
||||
#define NAS_MSG_CLASS_ADD_REPLY 18
|
||||
#define NAS_MSG_CLASS_DEL_REQUEST 19
|
||||
#define NAS_MSG_CLASS_DEL_REPLY 20
|
||||
#define NAS_MSG_CLASS_LIST_REQUEST 21
|
||||
#define NAS_MSG_CLASS_LIST_REPLY 22
|
||||
#define NAS_MSG_MEAS_REQUEST 23
|
||||
#define NAS_MSG_MEAS_REPLY 24
|
||||
#define NAS_MSG_IMEI_REQUEST 25
|
||||
#define NAS_MSG_IMEI_REPLY 26
|
||||
#define NAS_MSG_STATISTIC_REQUEST 1
|
||||
#define NAS_MSG_STATISTIC_REPLY 2
|
||||
#define NAS_MSG_ECHO_REQUEST 3
|
||||
#define NAS_MSG_ECHO_REPLY 4
|
||||
#define NAS_MSG_CX_ESTABLISHMENT_REQUEST 5
|
||||
#define NAS_MSG_CX_ESTABLISHMENT_REPLY 6
|
||||
#define NAS_MSG_CX_RELEASE_REQUEST 7
|
||||
#define NAS_MSG_CX_RELEASE_REPLY 8
|
||||
#define NAS_MSG_CX_LIST_REQUEST 9
|
||||
#define NAS_MSG_CX_LIST_REPLY 10
|
||||
#define NAS_MSG_RB_ESTABLISHMENT_REQUEST 11
|
||||
#define NAS_MSG_RB_ESTABLISHMENT_REPLY 12
|
||||
#define NAS_MSG_RB_RELEASE_REQUEST 13
|
||||
#define NAS_MSG_RB_RELEASE_REPLY 14
|
||||
#define NAS_MSG_RB_LIST_REQUEST 15
|
||||
#define NAS_MSG_RB_LIST_REPLY 16
|
||||
#define NAS_MSG_CLASS_ADD_REQUEST 17
|
||||
#define NAS_MSG_CLASS_ADD_REPLY 18
|
||||
#define NAS_MSG_CLASS_DEL_REQUEST 19
|
||||
#define NAS_MSG_CLASS_DEL_REPLY 20
|
||||
#define NAS_MSG_CLASS_LIST_REQUEST 21
|
||||
#define NAS_MSG_CLASS_LIST_REPLY 22
|
||||
#define NAS_MSG_MEAS_REQUEST 23
|
||||
#define NAS_MSG_MEAS_REPLY 24
|
||||
#define NAS_MSG_IMEI_REQUEST 25
|
||||
#define NAS_MSG_IMEI_REPLY 26
|
||||
|
||||
// Max number of entry of a message list
|
||||
#define NAS_LIST_CX_MAX 32
|
||||
#define NAS_LIST_RB_MAX 32
|
||||
#define NAS_LIST_CLASS_MAX 32
|
||||
#define NAS_LIST_CX_MAX 32
|
||||
#define NAS_LIST_RB_MAX 32
|
||||
#define NAS_LIST_CLASS_MAX 32
|
||||
|
||||
typedef unsigned short nasMsgType_t;
|
||||
|
||||
struct nas_ioctl
|
||||
{
|
||||
char name[IFNAMSIZ];
|
||||
nasMsgType_t type;
|
||||
char *msg;
|
||||
struct nas_ioctl {
|
||||
char name[IFNAMSIZ];
|
||||
nasMsgType_t type;
|
||||
char *msg;
|
||||
};
|
||||
|
||||
struct nas_msg_statistic_reply
|
||||
{
|
||||
unsigned int rx_packets;
|
||||
unsigned int tx_packets;
|
||||
unsigned int rx_bytes;
|
||||
unsigned int tx_bytes;
|
||||
unsigned int rx_errors;
|
||||
unsigned int tx_errors;
|
||||
unsigned int rx_dropped;
|
||||
unsigned int tx_dropped;
|
||||
struct nas_msg_statistic_reply {
|
||||
unsigned int rx_packets;
|
||||
unsigned int tx_packets;
|
||||
unsigned int rx_bytes;
|
||||
unsigned int tx_bytes;
|
||||
unsigned int rx_errors;
|
||||
unsigned int tx_errors;
|
||||
unsigned int rx_dropped;
|
||||
unsigned int tx_dropped;
|
||||
};
|
||||
|
||||
struct nas_msg_cx_list_reply
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char state;
|
||||
nasCellID_t cellid; // cell identification
|
||||
unsigned int iid6[2]; // IPv6 interface identification
|
||||
unsigned char iid4; // IPv4 interface identification
|
||||
unsigned short num_rb;
|
||||
unsigned short nsclassifier;
|
||||
struct nas_msg_cx_list_reply {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char state;
|
||||
nasCellID_t cellid; // cell identification
|
||||
unsigned int iid6[2]; // IPv6 interface identification
|
||||
unsigned char iid4; // IPv4 interface identification
|
||||
unsigned short num_rb;
|
||||
unsigned short nsclassifier;
|
||||
};
|
||||
struct nas_msg_cx_establishment_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_cx_establishment_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_cx_establishment_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasCellID_t cellid; // Cell identification
|
||||
struct nas_msg_cx_establishment_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasCellID_t cellid; // Cell identification
|
||||
};
|
||||
struct nas_msg_cx_release_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_cx_release_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_cx_release_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
struct nas_msg_cx_release_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
};
|
||||
|
||||
struct nas_msg_rb_list_reply
|
||||
{
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasSapId_t sapi;
|
||||
nasQoSTrafficClass_t qos;
|
||||
unsigned char state;
|
||||
struct nas_msg_rb_list_reply {
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasSapId_t sapi;
|
||||
nasQoSTrafficClass_t qos;
|
||||
unsigned char state;
|
||||
};
|
||||
struct nas_msg_rb_list_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
struct nas_msg_rb_list_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
};
|
||||
struct nas_msg_rb_establishment_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_rb_establishment_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_rb_establishment_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasQoSTrafficClass_t qos;
|
||||
struct nas_msg_rb_establishment_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasQoSTrafficClass_t qos;
|
||||
};
|
||||
|
||||
struct nas_msg_rb_release_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_rb_release_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_rb_release_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
struct nas_msg_rb_release_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
};
|
||||
/*
|
||||
struct saddr {
|
||||
@@ -149,8 +136,7 @@ struct daddr {
|
||||
unsigned int mpls_label;
|
||||
};
|
||||
*/
|
||||
struct nas_msg_class_add_request
|
||||
{
|
||||
struct nas_msg_class_add_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasRadioBearerId_t rab_id_rx;
|
||||
@@ -165,59 +151,53 @@ struct nas_msg_class_add_request
|
||||
|
||||
unsigned char splen; // prefix length
|
||||
|
||||
union
|
||||
{
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
|
||||
// begin navid
|
||||
//in_addr_t ipv4;
|
||||
//in_addr_t ipv4;
|
||||
unsigned int ipv4;
|
||||
//end navid
|
||||
|
||||
|
||||
unsigned int mpls_label;
|
||||
} daddr; // IP destination address
|
||||
|
||||
union
|
||||
{
|
||||
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
|
||||
// begin navid
|
||||
//in_addr_t ipv4;
|
||||
//in_addr_t ipv4;
|
||||
unsigned int ipv4;
|
||||
//end navid
|
||||
|
||||
} saddr; // IP source address
|
||||
|
||||
|
||||
|
||||
unsigned char dplen; // prefix length
|
||||
|
||||
unsigned char protocol; //!< transport layer protocol type (ANY,TCP,UDP,ICMPv4,ICMPv6)
|
||||
unsigned char protocol; //!< transport layer protocol type (ANY,TCP,UDP,ICMPv4,ICMPv6)
|
||||
unsigned char protocol_message_type; //!< transport layer protocol message (ROUTER_ADV, ROUTER_SOLL, etc.)
|
||||
unsigned short sport; //!< source port
|
||||
unsigned short dport; //!< destination port
|
||||
unsigned short sport; //!< source port
|
||||
unsigned short dport; //!< destination port
|
||||
};
|
||||
|
||||
struct nas_msg_class_add_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_class_add_reply {
|
||||
int status;
|
||||
};
|
||||
struct nas_msg_class_del_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char dir; // direction (send or receive)
|
||||
unsigned char dscp; // codepoint
|
||||
unsigned short classref;
|
||||
struct nas_msg_class_del_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char dir; // direction (send or receive)
|
||||
unsigned char dscp; // codepoint
|
||||
unsigned short classref;
|
||||
};
|
||||
struct nas_msg_class_del_reply
|
||||
{
|
||||
int status;
|
||||
struct nas_msg_class_del_reply {
|
||||
int status;
|
||||
};
|
||||
#define nas_msg_class_list_reply nas_msg_class_add_request
|
||||
struct nas_msg_class_list_request
|
||||
{
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char dir;
|
||||
unsigned char dscp;
|
||||
struct nas_msg_class_list_request {
|
||||
nasLocalConnectionRef_t lcr; // Local Connection reference
|
||||
unsigned char dir;
|
||||
unsigned char dscp;
|
||||
};
|
||||
|
||||
|
||||
@@ -225,20 +205,18 @@ struct nas_msg_class_list_request
|
||||
typedef unsigned int nioctlProviderId_t;
|
||||
typedef unsigned short nioctlSignalLoss_t;
|
||||
typedef struct nioctlMeasures {
|
||||
nasCellID_t cell_id;
|
||||
nasSigLevel_t level;
|
||||
nioctlProviderId_t provider_id;
|
||||
nasCellID_t cell_id;
|
||||
nasSigLevel_t level;
|
||||
nioctlProviderId_t provider_id;
|
||||
} nioctlMeasures_t;
|
||||
|
||||
struct nas_msg_measure_request
|
||||
{
|
||||
struct nas_msg_measure_request {
|
||||
nasNumRGsMeas_t num_cells;
|
||||
nasCellID_t cellid[MAX_MEASURE_NB]; // Cell identification
|
||||
nasCellID_t cellid[MAX_MEASURE_NB]; // Cell identification
|
||||
unsigned short num_providers;
|
||||
nioctlProviderId_t provider_id[MAX_MEASURE_NB]; // Provider identification
|
||||
nioctlProviderId_t provider_id[MAX_MEASURE_NB]; // Provider identification
|
||||
};
|
||||
struct nas_msg_measure_reply
|
||||
{
|
||||
struct nas_msg_measure_reply {
|
||||
nasNumRGsMeas_t num_cells;
|
||||
nioctlMeasures_t measures[MAX_MEASURE_NB];
|
||||
nioctlSignalLoss_t signal_lost_flag;
|
||||
@@ -247,8 +225,7 @@ struct nas_msg_measure_reply
|
||||
// Messages for Measurement transfer - MW 01/04/2005
|
||||
typedef unsigned int nioctlL2Id_t[2];
|
||||
|
||||
struct nas_msg_l2id_reply
|
||||
{
|
||||
struct nas_msg_l2id_reply {
|
||||
nioctlL2Id_t l2id;
|
||||
};
|
||||
|
||||
|
||||
@@ -71,8 +71,7 @@
|
||||
#include "rrc_nas_primitives.h"
|
||||
#include "COMMON/platform_types.h"
|
||||
|
||||
struct rb_entity
|
||||
{
|
||||
struct rb_entity {
|
||||
nasRadioBearerId_t rab_id;
|
||||
nasSapId_t sapi;
|
||||
nasQoSTrafficClass_t qos;
|
||||
@@ -82,19 +81,19 @@ struct rb_entity
|
||||
struct rb_entity *next;
|
||||
};
|
||||
|
||||
struct cx_entity{
|
||||
struct cx_entity {
|
||||
int sap[NAS_SAPI_CX_MAX];
|
||||
uint8_t state; // state of the connection
|
||||
nasLocalConnectionRef_t lcr; // Local connection reference
|
||||
nasCellID_t cellid; // cell identification
|
||||
uint32_t countimer; // timeout's counter
|
||||
uint8_t retry; // number of retransmission
|
||||
uint8_t state; // state of the connection
|
||||
nasLocalConnectionRef_t lcr; // Local connection reference
|
||||
nasCellID_t cellid; // cell identification
|
||||
uint32_t countimer; // timeout's counter
|
||||
uint8_t retry; // number of retransmission
|
||||
struct classifier_entity *sclassifier[NAS_DSCP_MAX]; // send classifier;
|
||||
struct classifier_entity *fclassifier[NAS_DSCP_MAX]; // send classifier;
|
||||
uint16_t nsclassifier;
|
||||
uint16_t nfclassifier;
|
||||
uint32_t iid6[2]; // IPv6 interface identification
|
||||
uint8_t iid4; // IPv4 interface identification
|
||||
uint32_t iid6[2]; // IPv6 interface identification
|
||||
uint8_t iid4; // IPv4 interface identification
|
||||
struct rb_entity *rb;
|
||||
uint16_t num_rb;
|
||||
int lastRRCprimitive;
|
||||
@@ -104,33 +103,32 @@ struct cx_entity{
|
||||
int meas_cell_id[MAX_MEASURE_NB];
|
||||
int meas_level[MAX_MEASURE_NB];
|
||||
int provider_id[MAX_MEASURE_NB];
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct classifier_entity
|
||||
{
|
||||
struct classifier_entity {
|
||||
uint32_t classref;
|
||||
struct classifier_entity *next;
|
||||
uint8_t version;
|
||||
union{
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
} saddr; // IP source address
|
||||
uint8_t splen; // prefix length
|
||||
union{
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
uint32_t ipv4;
|
||||
unsigned int mpls_label;
|
||||
} daddr; // IP destination address
|
||||
uint8_t dplen; // prefix length
|
||||
uint8_t protocol; // high layer protocol type
|
||||
uint8_t protocol; // high layer protocol type
|
||||
unsigned char protocol_message_type;
|
||||
uint16_t sport; // source port
|
||||
uint16_t dport; // destination port
|
||||
uint16_t sport; // source port
|
||||
uint16_t dport; // destination port
|
||||
struct rb_entity *rb; //pointer to rb_entity for sending function or receiving in case of forwarding rule
|
||||
struct rb_entity *rb_rx; //pointer to rb_entity for receiving (in case of forwarding rule)
|
||||
nasRadioBearerId_t rab_id; // RAB identification for sending
|
||||
nasRadioBearerId_t rab_id_rx; // RAB identification for receiving (in case of forwarding rule)
|
||||
nasRadioBearerId_t rab_id_rx; // RAB identification for receiving (in case of forwarding rule)
|
||||
void (*fct)(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst);
|
||||
};
|
||||
|
||||
@@ -138,8 +136,7 @@ struct classifier_entity
|
||||
|
||||
//#define NAS_RETRY_LIMIT_DEFAULT 5
|
||||
|
||||
struct nas_priv
|
||||
{
|
||||
struct nas_priv {
|
||||
int irq;
|
||||
struct timer_list timer;
|
||||
spinlock_t lock;
|
||||
@@ -159,11 +156,11 @@ struct nas_priv
|
||||
|
||||
struct ipversion {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
uint8_t reserved:4,
|
||||
version:4;
|
||||
uint8_t reserved:4,
|
||||
version:4;
|
||||
#else
|
||||
uint8_t version:4,
|
||||
reserved:4;
|
||||
uint8_t version:4,
|
||||
reserved:4;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
+390
-287
File diff suppressed because it is too large
Load Diff
@@ -67,12 +67,12 @@ static DEFINE_MUTEX(nasmesh_mutex);
|
||||
|
||||
static inline void nasmesh_lock(void)
|
||||
{
|
||||
mutex_lock(&nasmesh_mutex);
|
||||
mutex_lock(&nasmesh_mutex);
|
||||
}
|
||||
|
||||
static inline void nasmesh_unlock(void)
|
||||
{
|
||||
mutex_unlock(&nasmesh_mutex);
|
||||
mutex_unlock(&nasmesh_mutex);
|
||||
}
|
||||
|
||||
// This can also be implemented using thread to get the data from PDCP without blocking.
|
||||
@@ -84,16 +84,17 @@ static void nas_nl_data_ready (struct sk_buff *skb)
|
||||
//nasmesh_unlock();
|
||||
|
||||
struct nlmsghdr *nlh = NULL;
|
||||
int j;
|
||||
int j;
|
||||
|
||||
if (skb) {
|
||||
|
||||
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("[NAS][NETLINK] Received socket from PDCP\n");
|
||||
#endif //NETLINK_DEBUG
|
||||
nlh = (struct nlmsghdr *)skb->data;
|
||||
|
||||
|
||||
nas_COMMON_QOS_receive(nlh);
|
||||
|
||||
|
||||
//kfree_skb(skb); // not required,
|
||||
}
|
||||
|
||||
@@ -111,20 +112,20 @@ int nas_netlink_init()
|
||||
oai_netlink_cfg.bind = NULL;
|
||||
|
||||
nas_nl_sk = netlink_kernel_create(
|
||||
&init_net,
|
||||
NAS_NETLINK_ID,
|
||||
&init_net,
|
||||
NAS_NETLINK_ID,
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
|
||||
THIS_MODULE,
|
||||
THIS_MODULE,
|
||||
# endif
|
||||
&oai_netlink_cfg);
|
||||
&oai_netlink_cfg);
|
||||
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
||||
nas_nl_sk = netlink_kernel_create(
|
||||
&init_net,
|
||||
NAS_NETLINK_ID,
|
||||
0,
|
||||
nas_nl_data_ready,
|
||||
&nasmesh_mutex, // NULL
|
||||
THIS_MODULE);
|
||||
&init_net,
|
||||
NAS_NETLINK_ID,
|
||||
0,
|
||||
nas_nl_data_ready,
|
||||
&nasmesh_mutex, // NULL
|
||||
THIS_MODULE);
|
||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
||||
|
||||
if (nas_nl_sk == NULL) {
|
||||
@@ -133,32 +134,34 @@ int nas_netlink_init()
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void nas_netlink_release(void) {
|
||||
void nas_netlink_release(void)
|
||||
{
|
||||
|
||||
exit_netlink_thread=1;
|
||||
printk("[NAS][NETLINK] Releasing netlink socket\n");
|
||||
|
||||
if(nas_nl_sk){
|
||||
|
||||
if(nas_nl_sk) {
|
||||
netlink_kernel_release(nas_nl_sk); //or skb->sk
|
||||
|
||||
|
||||
}
|
||||
|
||||
// printk("[NAS][NETLINK] Removing netlink_rx_thread\n");
|
||||
//kthread_stop(netlink_rx_thread);
|
||||
|
||||
// printk("[NAS][NETLINK] Removing netlink_rx_thread\n");
|
||||
//kthread_stop(netlink_rx_thread);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int nas_netlink_send(unsigned char *data,unsigned int len) {
|
||||
int nas_netlink_send(unsigned char *data,unsigned int len)
|
||||
{
|
||||
|
||||
|
||||
struct sk_buff *nl_skb = alloc_skb(NLMSG_SPACE(len),GFP_ATOMIC);
|
||||
@@ -180,40 +183,38 @@ int nas_netlink_send(unsigned char *data,unsigned int len) {
|
||||
#else
|
||||
NETLINK_CB(nl_skb).pid = 0;
|
||||
#endif
|
||||
|
||||
#ifdef NETLINK_DEBUG
|
||||
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("[NAS][NETLINK] In nas_netlink_send, nl_skb %p, nl_sk %x, nlh %p, nlh->nlmsg_len %d (NAS_NETLINK_ID %d)\n",
|
||||
nl_skb,nas_nl_sk,nlh,nlh->nlmsg_len,
|
||||
NAS_NETLINK_ID);
|
||||
nl_skb,nas_nl_sk,nlh,nlh->nlmsg_len,
|
||||
NAS_NETLINK_ID);
|
||||
#endif //DEBUG_NETLINK
|
||||
|
||||
if (nas_nl_sk) {
|
||||
|
||||
// nasmesh_lock();
|
||||
|
||||
|
||||
status = netlink_unicast(nas_nl_sk, nl_skb, NL_DEST_PID, MSG_DONTWAIT);
|
||||
// mutex_unlock(&nasmesh_mutex);
|
||||
|
||||
if (status < 0) {
|
||||
printk("[NAS][NETLINK] SEND status is %d\n",status);
|
||||
return(0);
|
||||
}
|
||||
else {
|
||||
printk("[NAS][NETLINK] SEND status is %d\n",status);
|
||||
return(0);
|
||||
} else {
|
||||
#ifdef NETLINK_DEBUG
|
||||
printk("[NAS][NETLINK] SEND status is %d\n",status);
|
||||
#endif
|
||||
return len;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
printk("[NAS][SEND] socket is NULL\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
nlmsg_failure: // Used by NLMSG_PUT
|
||||
nlmsg_failure: // Used by NLMSG_PUT
|
||||
if (nl_skb)
|
||||
kfree_skb(nl_skb);
|
||||
*/
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
email : navid.nikaein@eurecom.fr
|
||||
lionel.gauthier@eurecom.fr
|
||||
knopp@eurecom.fr
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _NAS_PROTO_H
|
||||
@@ -87,11 +87,11 @@ int find_inst(struct net_device *dev);
|
||||
@param rclass RX Classifier entity
|
||||
@param rb_id Radio Bearer Id
|
||||
*/
|
||||
void nas_COMMON_receive(unsigned short dlen,
|
||||
void *pdcp_sdu,
|
||||
int inst,
|
||||
struct classifier_entity *rclass,
|
||||
nasRadioBearerId_t rb_id);
|
||||
void nas_COMMON_receive(unsigned short dlen,
|
||||
void *pdcp_sdu,
|
||||
int inst,
|
||||
struct classifier_entity *rclass,
|
||||
nasRadioBearerId_t rb_id);
|
||||
|
||||
/**
|
||||
\fn void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst)
|
||||
@@ -184,12 +184,12 @@ void nas_COMMON_QOS_receive(struct nlmsghdr *nlh);
|
||||
#endif //NAS_NETLINK
|
||||
//nasmesh.c
|
||||
|
||||
/**
|
||||
/**
|
||||
\brief Initialize an interface for a particular instance ID.
|
||||
*/
|
||||
void nas_mesh_init(int inst //!< Instance ID
|
||||
|
||||
);
|
||||
);
|
||||
|
||||
void nas_mesh_timer(unsigned long data,struct nas_priv *gpriv);
|
||||
|
||||
@@ -206,74 +206,74 @@ int nas_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
|
||||
|
||||
// classifier.c
|
||||
|
||||
/**
|
||||
/**
|
||||
\brief Send a socket received from IP to classifier for a particular instance ID.
|
||||
*/
|
||||
void nas_CLASS_send(struct sk_buff *skb, //!< Pointer to socket buffer
|
||||
int inst //!< Instance ID
|
||||
);
|
||||
/**
|
||||
int inst //!< Instance ID
|
||||
);
|
||||
/**
|
||||
\brief
|
||||
*/
|
||||
struct classifier_entity *nas_CLASS_add_sclassifier(struct cx_entity *cx, unsigned char dscp, unsigned short classref);
|
||||
|
||||
/**
|
||||
/**
|
||||
\brief Send a socket received from IP to classifier for a particular instance ID.
|
||||
*/
|
||||
struct classifier_entity *nas_CLASS_add_fclassifier(struct cx_entity *cx,
|
||||
unsigned char dscp,
|
||||
unsigned short classref
|
||||
);
|
||||
struct classifier_entity *nas_CLASS_add_fclassifier(struct cx_entity *cx,
|
||||
unsigned char dscp,
|
||||
unsigned short classref
|
||||
);
|
||||
|
||||
/**
|
||||
/**
|
||||
\brief Send a socket received from IP to classifier for a particular instance ID.
|
||||
*/
|
||||
struct classifier_entity *nas_CLASS_add_rclassifier(unsigned char dscp,
|
||||
unsigned short classref,
|
||||
struct nas_priv*
|
||||
);
|
||||
struct classifier_entity *nas_CLASS_add_rclassifier(unsigned char dscp,
|
||||
unsigned short classref,
|
||||
struct nas_priv*
|
||||
);
|
||||
|
||||
/**
|
||||
\brief
|
||||
/**
|
||||
\brief
|
||||
*/
|
||||
void nas_CLASS_del_sclassifier(struct cx_entity *cx,
|
||||
unsigned char dscp,
|
||||
unsigned short classref
|
||||
);
|
||||
void nas_CLASS_del_sclassifier(struct cx_entity *cx,
|
||||
unsigned char dscp,
|
||||
unsigned short classref
|
||||
);
|
||||
|
||||
/**
|
||||
\brief
|
||||
/**
|
||||
\brief
|
||||
*/
|
||||
void nas_CLASS_del_fclassifier(struct cx_entity *cx,
|
||||
unsigned char dscp,
|
||||
unsigned short classref
|
||||
);
|
||||
void nas_CLASS_del_fclassifier(struct cx_entity *cx,
|
||||
unsigned char dscp,
|
||||
unsigned short classref
|
||||
);
|
||||
|
||||
/**
|
||||
\brief
|
||||
/**
|
||||
\brief
|
||||
*/
|
||||
void nas_CLASS_del_rclassifier(unsigned char dscp,
|
||||
unsigned short classref,
|
||||
struct nas_priv*
|
||||
);
|
||||
void nas_CLASS_del_rclassifier(unsigned char dscp,
|
||||
unsigned short classref,
|
||||
struct nas_priv*
|
||||
);
|
||||
|
||||
/**
|
||||
\brief
|
||||
/**
|
||||
\brief
|
||||
*/
|
||||
void nas_CLASS_flush_sclassifier(struct cx_entity *cx
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
\brief
|
||||
/**
|
||||
\brief
|
||||
*/
|
||||
void nas_CLASS_flush_fclassifier(struct cx_entity *cx
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
\brief
|
||||
/**
|
||||
\brief
|
||||
*/
|
||||
void nas_CLASS_flush_rclassifier(struct nas_priv *gpriv
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
// nas_tool.c
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
knopp@eurecom.fr
|
||||
*********************************************************************
|
||||
Define RRC external interface primitives
|
||||
********************************************************************/
|
||||
********************************************************************/
|
||||
#ifndef __RRC_NASPRIM_H__
|
||||
# define __RRC_NASPRIM_H__
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Primitives
|
||||
//----------------------------------------------------------
|
||||
@@ -62,27 +62,27 @@
|
||||
# define CONN_LOSS_IND 18
|
||||
# define PAGING_REQ 19
|
||||
# define NOTIFICATION_IND 20
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Constants
|
||||
//----------------------------------------------------------
|
||||
// Define max length authorized (to be updated later)
|
||||
# define NAS_MAX_LENGTH 180 // maximum length of a NAS primitive
|
||||
# define NAS_TL_SIZE 4 // size of the Type+Length fields of the primitive
|
||||
# define NAS_TL_SIZE 4 // size of the Type+Length fields of the primitive
|
||||
# define NAS_DATA_MAX_LENGTH NAS_MAX_LENGTH - NAS_TL_SIZE //remaining bytes for the message
|
||||
# define MAX_RABS 8 * 64 //NB_RAB_MAX * MAX_MOBILES_PER_RG //27 // = MAXURAB
|
||||
# define MAX_MEASURE_NB 5
|
||||
|
||||
|
||||
//Connection Establishment status
|
||||
// UE
|
||||
# define TERMINATED 0
|
||||
# define ABORTED 1
|
||||
# define ABORTED 1
|
||||
# define ALREADY_CONNECTED 2
|
||||
// RG + RB Establishment Confirm
|
||||
# define ACCEPTED 0
|
||||
# define FAILURE 1
|
||||
# define FAILURE 1
|
||||
//----------------------------------------------------------
|
||||
|
||||
|
||||
// Parameter types
|
||||
//----------------------------------------------------------
|
||||
typedef unsigned int nasPeriod_t; // Broadcast repetition period
|
||||
@@ -118,11 +118,11 @@ typedef struct nasMeasures {
|
||||
// Primitive definitions
|
||||
//----------------------------------------------------------
|
||||
// -- SAP-GC
|
||||
struct NASInfoBroadcastReq {
|
||||
struct NASInfoBroadcastReq {
|
||||
nasPeriod_t period; // 0 = one-shot, otherwise in x 10 ms
|
||||
nasBroadcastCategory_t category;
|
||||
nasDataLength_t nasDataLength;
|
||||
};
|
||||
nasDataLength_t nasDataLength;
|
||||
};
|
||||
struct NASInfoBroadcastInd {
|
||||
nasDataLength_t nasDataLength;
|
||||
};
|
||||
@@ -131,21 +131,21 @@ struct nas_ue_gc_element {
|
||||
unsigned short length;
|
||||
union {
|
||||
struct NASInfoBroadcastInd broadcast_ind;
|
||||
} nasUEGCPrimitive;
|
||||
};
|
||||
} nasUEGCPrimitive;
|
||||
};
|
||||
struct nas_rg_gc_element {
|
||||
unsigned short type;
|
||||
unsigned short length;
|
||||
union {
|
||||
struct NASInfoBroadcastReq broadcast_req;
|
||||
} nasRGGCPrimitive;
|
||||
};
|
||||
} nasRGGCPrimitive;
|
||||
};
|
||||
|
||||
// -- SAP-DC
|
||||
struct NASConnEstablishReq {
|
||||
struct NASConnEstablishReq {
|
||||
nasLocalConnectionRef_t localConnectionRef; //provided by NAS
|
||||
nasCellID_t cellId;
|
||||
};
|
||||
};
|
||||
struct NASConnEstablishInd {
|
||||
nasLocalConnectionRef_t localConnectionRef;
|
||||
nasIMEI_t InterfaceIMEI;
|
||||
@@ -155,7 +155,7 @@ struct NASConnEstablishConf {
|
||||
nasConnectionStatus_t status; // can be : Accepted, Failure
|
||||
nasNumRBsInList_t num_RBs; // actual number of RBs in the list
|
||||
nasRBList_t RB_List;
|
||||
};
|
||||
};
|
||||
struct NASConnEstablishResp {
|
||||
nasLocalConnectionRef_t localConnectionRef;
|
||||
nasIMEI_t InterfaceIMEI;
|
||||
@@ -220,49 +220,49 @@ struct NASMeasureInd {
|
||||
|
||||
/*****
|
||||
* UE Primitives
|
||||
*****/
|
||||
struct nas_ue_dc_element {
|
||||
*****/
|
||||
struct nas_ue_dc_element {
|
||||
unsigned short type;
|
||||
unsigned short length;
|
||||
union {
|
||||
struct NASConnEstablishReq conn_establish_req;
|
||||
struct NASConnEstablishResp conn_establish_resp;
|
||||
|
||||
// struct NASConnReleaseInd conn_release_ind;
|
||||
struct NASConnEstablishResp conn_establish_resp;
|
||||
|
||||
// struct NASConnReleaseInd conn_release_ind;
|
||||
struct NASConnReleaseReq conn_release_req;
|
||||
struct NASConnLossInd conn_loss_ind;
|
||||
struct NASDataReq data_transfer_req;
|
||||
struct NASDataInd data_transfer_ind;
|
||||
struct NASrbEstablishInd rb_establish_ind;
|
||||
struct NASrbReleaseInd rb_release_ind;
|
||||
struct NASMeasureInd measurement_ind;
|
||||
struct NASMeasureReq measurement_req;
|
||||
} nasUEDCPrimitive;
|
||||
};
|
||||
struct NASConnLossInd conn_loss_ind;
|
||||
struct NASDataReq data_transfer_req;
|
||||
struct NASDataInd data_transfer_ind;
|
||||
struct NASrbEstablishInd rb_establish_ind;
|
||||
struct NASrbReleaseInd rb_release_ind;
|
||||
struct NASMeasureInd measurement_ind;
|
||||
struct NASMeasureReq measurement_req;
|
||||
} nasUEDCPrimitive;
|
||||
};
|
||||
|
||||
/*****
|
||||
* RG Primitives
|
||||
*****/
|
||||
struct nas_rg_dc_element {
|
||||
*****/
|
||||
struct nas_rg_dc_element {
|
||||
unsigned short type;
|
||||
unsigned short length;
|
||||
union {
|
||||
struct NASConnEstablishInd conn_establish_ind;
|
||||
struct NASConnEstablishConf conn_establish_conf;
|
||||
struct NASConnReleaseInd conn_release_ind;
|
||||
|
||||
// struct NASConnReleaseReq conn_release_req;
|
||||
struct NASConnEstablishConf conn_establish_conf;
|
||||
struct NASConnReleaseInd conn_release_ind;
|
||||
|
||||
// struct NASConnReleaseReq conn_release_req;
|
||||
struct NASConnLossInd conn_loss_ind;
|
||||
struct NASDataReq data_transfer_req;
|
||||
struct NASDataInd data_transfer_ind;
|
||||
struct NASrbEstablishReq rb_establish_req;
|
||||
struct NASrbEstablishConf rb_establish_conf;
|
||||
struct NASrbReleaseReq rb_release_req;
|
||||
} nasRGDCPrimitive;
|
||||
};
|
||||
struct NASDataReq data_transfer_req;
|
||||
struct NASDataInd data_transfer_ind;
|
||||
struct NASrbEstablishReq rb_establish_req;
|
||||
struct NASrbEstablishConf rb_establish_conf;
|
||||
struct NASrbReleaseReq rb_release_req;
|
||||
} nasRGDCPrimitive;
|
||||
};
|
||||
|
||||
// -- SAP-NT
|
||||
struct NASPagingReq {
|
||||
struct NASPagingReq {
|
||||
nasPagingUEId_t UeId;
|
||||
nasDataLength_t nasDataLength;
|
||||
};
|
||||
@@ -274,14 +274,14 @@ struct nas_ue_nt_element {
|
||||
unsigned short length;
|
||||
union {
|
||||
struct NASNotificationInd notification_ind;
|
||||
} nasUENTPrimitive;
|
||||
};
|
||||
} nasUENTPrimitive;
|
||||
};
|
||||
struct nas_rg_nt_element {
|
||||
unsigned short type;
|
||||
unsigned short length;
|
||||
union {
|
||||
struct NASPagingReq paging_req;
|
||||
} nasRGNTPrimitive;
|
||||
};
|
||||
} nasRGNTPrimitive;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -50,18 +50,18 @@
|
||||
|
||||
//FIFO indexes in control blocks
|
||||
|
||||
#define NAS_DC_INPUT_SAPI 0
|
||||
#define NAS_DC_OUTPUT_SAPI 1
|
||||
#define NAS_SAPI_CX_MAX 2
|
||||
#define NAS_DC_INPUT_SAPI 0
|
||||
#define NAS_DC_OUTPUT_SAPI 1
|
||||
#define NAS_SAPI_CX_MAX 2
|
||||
|
||||
#define NAS_GC_SAPI 0
|
||||
#define NAS_NT_SAPI 1
|
||||
#define NAS_GC_SAPI 0
|
||||
#define NAS_NT_SAPI 1
|
||||
|
||||
#define NAS_RAB_INPUT_SAPI 2
|
||||
#define NAS_RAB_OUTPUT_SAPI 3
|
||||
#define NAS_RAB_INPUT_SAPI 2
|
||||
#define NAS_RAB_OUTPUT_SAPI 3
|
||||
|
||||
|
||||
#define NAS_SAPI_MAX 4
|
||||
#define NAS_SAPI_MAX 4
|
||||
|
||||
|
||||
|
||||
|
||||
+615
-448
File diff suppressed because it is too large
Load Diff
@@ -35,8 +35,9 @@ int sim_counter=0;
|
||||
|
||||
/* Mobile Station */
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_if_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_if_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Intra-Frequency
|
||||
rrm_control->type = IX_ifM;
|
||||
// measurementCommand SETUP
|
||||
@@ -48,8 +49,9 @@ void nasrg_meas_if_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_if_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_if_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Intra-Frequency
|
||||
rrm_control->type = IX_ifM;
|
||||
// measurementCommand RELEASE
|
||||
@@ -59,8 +61,9 @@ void nasrg_meas_if_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_tv_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_tv_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Traffic Volume
|
||||
rrm_control->type = IX_tvM;
|
||||
// measurementCommand SETUP
|
||||
@@ -72,8 +75,9 @@ void nasrg_meas_tv_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_tv_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_tv_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Traffic Volume
|
||||
rrm_control->type = IX_tvM;
|
||||
// measurementCommand RELEASE
|
||||
@@ -83,8 +87,9 @@ void nasrg_meas_tv_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Quality
|
||||
rrm_control->type = IX_qM;
|
||||
// measurementCommand SETUP
|
||||
@@ -97,8 +102,9 @@ void nasrg_meas_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Quality
|
||||
rrm_control->type = IX_qM;
|
||||
// measurementCommand RELEASE
|
||||
@@ -108,8 +114,9 @@ void nasrg_meas_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_int_ue_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_int_ue_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Internal UE
|
||||
rrm_control->type = IX_iueM;
|
||||
// measurementCommand SETUP
|
||||
@@ -121,8 +128,9 @@ void nasrg_meas_int_ue_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_int_ue_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_int_ue_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Internal UE
|
||||
rrm_control->type = IX_iueM;
|
||||
// measurementCommand RELEASE
|
||||
@@ -134,8 +142,9 @@ void nasrg_meas_int_ue_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_contr
|
||||
|
||||
/* Base Station */
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_bs_tv_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_bs_tv_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Traffic Volume
|
||||
rrm_control->type = IX_tvbM;
|
||||
// measurementCommand SETUP
|
||||
@@ -147,8 +156,9 @@ void nasrg_meas_bs_tv_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_bs_tv_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_bs_tv_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Traffic Volume
|
||||
rrm_control->type = IX_tvbM;
|
||||
// measurementCommand RELEASE
|
||||
@@ -158,8 +168,9 @@ void nasrg_meas_bs_tv_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_contro
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_bs_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_bs_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Quality
|
||||
rrm_control->type = IX_qbM;
|
||||
// measurementCommand SETUP
|
||||
@@ -171,8 +182,9 @@ void nasrg_meas_bs_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_bs_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_bs_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Quality
|
||||
rrm_control->type = IX_qbM;
|
||||
// measurementCommand RELEASE
|
||||
@@ -182,8 +194,9 @@ void nasrg_meas_bs_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_int_bs_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_int_bs_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Internal BS
|
||||
rrm_control->type = IX_ibsM;
|
||||
// measurementCommand SETUP
|
||||
@@ -195,8 +208,9 @@ void nasrg_meas_int_bs_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_int_bs_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_meas_int_bs_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// measurement identity Internal BS
|
||||
rrm_control->type = IX_ibsM;
|
||||
// measurementCommand RELEASE
|
||||
@@ -206,8 +220,9 @@ void nasrg_meas_int_bs_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_contr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_send_meas_request_to_rrc (int ue_id, struct rrc_rrm_measure_ctl *rrm_control){
|
||||
//-------------------------------------------------------------------
|
||||
void nasrg_send_meas_request_to_rrc (int ue_id, struct rrc_rrm_measure_ctl *rrm_control)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
rpc_message rpc_mess;
|
||||
measurement_request meas_request;
|
||||
int count =0;
|
||||
@@ -229,45 +244,50 @@ void nasrg_send_meas_request_to_rrc (int ue_id, struct rrc_rrm_measure_ctl *rrm_
|
||||
meas_request.amount = rrm_control->amount;
|
||||
meas_request.period = rrm_control->period;
|
||||
|
||||
// send to RRC
|
||||
// send to RRC
|
||||
count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
|
||||
count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & meas_request, sizeof (measurement_request));
|
||||
|
||||
if (count > 0) {
|
||||
printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
|
||||
} else {
|
||||
printf ("RRM FIFO transmit failed");
|
||||
}
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
nas_rg_print_buffer ((char *) & rpc_mess, sizeof (rpc_message));
|
||||
nas_rg_print_buffer ((char *) & meas_request, sizeof (meas_request));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// in case not rrc_rg_meas_loop (time,UE_Id);
|
||||
int nasrg_rrm_meas_stop (int time, int UE_Id){
|
||||
//-------------------------------------------------------------------
|
||||
int nasrg_rrm_meas_stop (int time, int UE_Id)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
struct rrc_rrm_measure_ctl control;
|
||||
|
||||
// Measurement Control - Stop Quality previously sent by RRM
|
||||
nasrg_meas_q_release (UE_Id, &control);
|
||||
//rrc_rrm_measure_request (control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
// Measurement Control - Stop Quality previously sent by RRM
|
||||
nasrg_meas_q_release (UE_Id, &control);
|
||||
//rrc_rrm_measure_request (control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
return 0;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// rrc_rg_meas_loop (time,UE_Id);
|
||||
int nasrg_meas_loop (int time, int UE_Id){
|
||||
//-------------------------------------------------------------------
|
||||
int nasrg_meas_loop (int time, int UE_Id)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
struct rrc_rrm_measure_ctl control;
|
||||
|
||||
sim_counter++;
|
||||
// if (time % 5 == 0) {
|
||||
// if (time % 5 == 0) {
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
printf ("\n[NASRG_MEAS_TEST] Simu Measurement Time : %d, counter : %d\n", time, sim_counter);
|
||||
printf ("\n[NASRG_MEAS_TEST] Simu Measurement Time : %d, counter : %d\n", time, sim_counter);
|
||||
#endif
|
||||
// }
|
||||
if (sim_counter == 8){
|
||||
|
||||
// }
|
||||
if (sim_counter == 8) {
|
||||
// Measurement Control - Stop Quality previously sent by RRM
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
printf ("\n\n[NASRG_MEAS_TEST] NAS sends Measurement Control (Stop Quality) message at time : %d\n\n", sim_counter);
|
||||
@@ -277,8 +297,9 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
//rrc_rrm_measure_request (control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
|
||||
// Intra-Frequency
|
||||
// if (sim_counter == 140) {
|
||||
// if (sim_counter == 140) {
|
||||
if (sim_counter == 16) {
|
||||
// Measurement Control - Start Intra-frequency
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -288,7 +309,8 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_if_setup (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
// if (sim_counter == 700) {
|
||||
|
||||
// if (sim_counter == 700) {
|
||||
if (sim_counter == 70) {
|
||||
// Measurement Control - Stop Intra-frequency
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -298,8 +320,9 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_if_release (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
|
||||
// Traffic Volume
|
||||
// if (sim_counter == 100) {
|
||||
// if (sim_counter == 100) {
|
||||
if (sim_counter == 12) {
|
||||
// Measurement Control - Start Traffic Volume
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -309,7 +332,8 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_tv_setup (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
// if (sim_counter == 990) {
|
||||
|
||||
// if (sim_counter == 990) {
|
||||
if (sim_counter == 92) {
|
||||
// Measurement Control - Stop Traffic Volume
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -319,8 +343,9 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_tv_release (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
|
||||
// Quality
|
||||
// if (sim_counter == 503) {
|
||||
// if (sim_counter == 503) {
|
||||
if (sim_counter == 50) {
|
||||
// Measurement Control - Start Quality
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -330,7 +355,8 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_q_setup (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
// if (sim_counter == 995) {
|
||||
|
||||
// if (sim_counter == 995) {
|
||||
if (sim_counter == 96) {
|
||||
// Measurement Control - Stop Quality
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -340,8 +366,9 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_q_release (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
|
||||
// Internal UE
|
||||
// if (sim_counter == 210) {
|
||||
// if (sim_counter == 210) {
|
||||
if (sim_counter == 20) {
|
||||
// Measurement Control - Start Internal UE
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -351,17 +378,19 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_int_ue_setup (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
// if (sim_counter == 999) {
|
||||
|
||||
// if (sim_counter == 999) {
|
||||
if (sim_counter == 98) {
|
||||
// Measurement Control - Stop Internal UE
|
||||
// Measurement Control - Stop Internal UE
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Stop Int UE) message at time : %d\n\n", sim_counter);
|
||||
#endif
|
||||
nasrg_meas_int_ue_release (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
|
||||
// Internal BS
|
||||
// if (sim_counter == 105) {
|
||||
// if (sim_counter == 105) {
|
||||
if (sim_counter == 14) {
|
||||
// Measurement Control - Start Internal BS
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -370,7 +399,8 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_int_bs_setup (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
// if (sim_counter == 980) {
|
||||
|
||||
// if (sim_counter == 980) {
|
||||
if (sim_counter == 86) {
|
||||
// Measurement Control - Stop Internal BS
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -379,8 +409,9 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_int_bs_release (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
|
||||
// Traffic Volume BS
|
||||
// if (sim_counter == 220) {
|
||||
// if (sim_counter == 220) {
|
||||
if (sim_counter == 22) {
|
||||
// Measurement Control - Start Traffic Volume BS
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -389,7 +420,8 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_bs_tv_setup (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
// if (sim_counter == 900) {
|
||||
|
||||
// if (sim_counter == 900) {
|
||||
if (sim_counter == 80) {
|
||||
// Measurement Control - Stop Traffic Volume BS
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -398,8 +430,9 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_bs_tv_release (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
|
||||
// Quality BS
|
||||
// if (sim_counter == 625) {
|
||||
// if (sim_counter == 625) {
|
||||
if (sim_counter == 62) {
|
||||
// Measurement Control - Start Quality BS
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -408,7 +441,8 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_bs_q_setup (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
// if (sim_counter == 989) {
|
||||
|
||||
// if (sim_counter == 989) {
|
||||
if (sim_counter == 90) {
|
||||
// Measurement Control - Stop Quality BS
|
||||
#ifdef DEBUG_NAS_MEAS_SIMU
|
||||
@@ -417,152 +451,184 @@ int nasrg_meas_loop (int time, int UE_Id){
|
||||
nasrg_meas_bs_q_release (UE_Id, &control);
|
||||
nasrg_send_meas_request_to_rrc (UE_Id, &control);
|
||||
}
|
||||
|
||||
|
||||
return sim_counter;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//void rrc_rg_print_meas_report (struct rrc_rg_mt_meas_rep *p){
|
||||
void nasrg_print_meas_report (char *rrc_rrm_meas_payload, uint16_t type){
|
||||
//-----------------------------------------------------------------------------
|
||||
void nasrg_print_meas_report (char *rrc_rrm_meas_payload, uint16_t type)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
int i, j;
|
||||
char *payload[20] =
|
||||
{ "pl0", "pl4", "pl8", "pl16", "pl32", "pl64", "pl128", "pl256", "pl512", "pl1024", "pl2k", "pl4k", "pl8k", "pl16k", "pl32k", "pl64k", "pl128k", "pl256k", "pl512k", "pl1024k" };
|
||||
char *average[20] =
|
||||
{ "pla0", "pla4", "pla8", "pla16", "pla32", "pla64", "pla128", "pla256", "pla512", "pla1024", "pla2k",
|
||||
"pla4k", "pla8k", "pla16k", "pla32k", "pla64k", "pla128k", "pla256k", "pla512k","pla1024k" };
|
||||
{ "pl0", "pl4", "pl8", "pl16", "pl32", "pl64", "pl128", "pl256", "pl512", "pl1024", "pl2k", "pl4k", "pl8k", "pl16k", "pl32k", "pl64k", "pl128k", "pl256k", "pl512k", "pl1024k" };
|
||||
char *average[20] = {
|
||||
"pla0", "pla4", "pla8", "pla16", "pla32", "pla64", "pla128", "pla256", "pla512", "pla1024", "pla2k",
|
||||
"pla4k", "pla8k", "pla16k", "pla32k", "pla64k", "pla128k", "pla256k", "pla512k","pla1024k"
|
||||
};
|
||||
char *variance[14] = { "plv0", "plv4", "plv8", "plv16", "plv32", "plv64", "plv128", "plv256", "plv512", "plv1024", "plv2k", "plv4k", "plv8k", "plv16k" };
|
||||
|
||||
printf ("\n[NASRG-MEAS] ************** MT Measurement Report Message *****************\n");
|
||||
|
||||
switch (type) {
|
||||
case RPC_L1_MEASUREMENT_MT_INTRA_FREQUENCY_REPORT:
|
||||
{
|
||||
struct rrc_rrm_meas_report_mt_if *p;
|
||||
p = (struct rrc_rrm_meas_report_mt_if *)rrc_rrm_meas_payload;
|
||||
printf ("Intra Frequency Measurement\t Number of cells: %d\n", p->if_num_cells);
|
||||
for (i = 0; i < p->if_num_cells; i++) {
|
||||
printf ("[NASRG-MEAS] Cell number: %d\tCell Identity: %d\tCell Parameters Id: %d\tP-CCPCH RSCP: %d\tPathloss: %d\n", i, p->if_cell_id[i], p->if_cell_parms_id[i], p->if_BCH_RSCP[i], p->if_pathloss[i]);
|
||||
printf ("\tTimeslot ISCP for each slot:\t");
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d: %d, ", j, p->if_slot_iscp[i][j]);
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RPC_L1_MEASUREMENT_MT_TRAFFIC_VOLUME_REPORT:
|
||||
{
|
||||
struct rrc_rrm_meas_report_mt_tv *p;
|
||||
p = (struct rrc_rrm_meas_report_mt_tv *)rrc_rrm_meas_payload;
|
||||
printf ("Traffic Volume Measurement -\t Number of RBs: %d\n", p->tv_num_rbs);
|
||||
for (i = 0; i < p->tv_num_rbs; i++)
|
||||
printf ("[NASRG-MEAS] RB_Id : %d\t, RLC_BufferPayload : %s\t, Average : %s\t, Variance : %s\n",
|
||||
p->tv_rbid[i], payload[p->tv_rb_payload[i]], average[p->tv_rb_average[i]], variance[p->tv_rb_variance[i]]);
|
||||
}
|
||||
break;
|
||||
case RPC_L1_MEASUREMENT_MT_QUALITY_REPORT:
|
||||
{
|
||||
struct rrc_rrm_meas_report_mt_q *p;
|
||||
p = (struct rrc_rrm_meas_report_mt_q *)rrc_rrm_meas_payload;
|
||||
printf ("Quality Measurement -\t Number of Transport Channels : %d, Number of TFCS : %d\n", p->q_num_TrCH, p->q_num_tfcs);
|
||||
printf ("[NASRG-MEAS] BLER for each Transport Channel:\t");
|
||||
for (i = 0; i < p->q_num_TrCH; i++)
|
||||
printf ("%d: %d, ", p->q_dl_TrCH_id[i], p->q_dl_TrCH_BLER[i]);
|
||||
printf ("\n");
|
||||
printf ("[NASRG-MEAS] SIR for each TFCS for each slot:\n");
|
||||
for (i = 0; i < p->q_num_tfcs; i++) {
|
||||
printf ("%d: ", p->q_tfcs_id[i]);
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d, ", p->q_sir[i][j]);
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RPC_L1_MEASUREMENT_MT_INTERNAL_REPORT:
|
||||
{
|
||||
struct rrc_rrm_meas_report_mt_int *p;
|
||||
p = (struct rrc_rrm_meas_report_mt_int *)rrc_rrm_meas_payload;
|
||||
printf ("UE internal Measurement\t Timing Advance: %d\n", p->int_timing_advance);
|
||||
printf ("[NASRG-MEAS] Transmitted Power for each slot:\t");
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d: %d, ", j, p->int_xmit_power[j]);
|
||||
printf ("\n");
|
||||
}
|
||||
break;
|
||||
case RPC_L1_MEASUREMENT_MT_INTRA_FREQUENCY_REPORT: {
|
||||
struct rrc_rrm_meas_report_mt_if *p;
|
||||
p = (struct rrc_rrm_meas_report_mt_if *)rrc_rrm_meas_payload;
|
||||
printf ("Intra Frequency Measurement\t Number of cells: %d\n", p->if_num_cells);
|
||||
|
||||
for (i = 0; i < p->if_num_cells; i++) {
|
||||
printf ("[NASRG-MEAS] Cell number: %d\tCell Identity: %d\tCell Parameters Id: %d\tP-CCPCH RSCP: %d\tPathloss: %d\n", i, p->if_cell_id[i], p->if_cell_parms_id[i], p->if_BCH_RSCP[i], p->if_pathloss[i]);
|
||||
printf ("\tTimeslot ISCP for each slot:\t");
|
||||
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d: %d, ", j, p->if_slot_iscp[i][j]);
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RPC_L1_MEASUREMENT_MT_TRAFFIC_VOLUME_REPORT: {
|
||||
struct rrc_rrm_meas_report_mt_tv *p;
|
||||
p = (struct rrc_rrm_meas_report_mt_tv *)rrc_rrm_meas_payload;
|
||||
printf ("Traffic Volume Measurement -\t Number of RBs: %d\n", p->tv_num_rbs);
|
||||
|
||||
for (i = 0; i < p->tv_num_rbs; i++)
|
||||
printf ("[NASRG-MEAS] RB_Id : %d\t, RLC_BufferPayload : %s\t, Average : %s\t, Variance : %s\n",
|
||||
p->tv_rbid[i], payload[p->tv_rb_payload[i]], average[p->tv_rb_average[i]], variance[p->tv_rb_variance[i]]);
|
||||
}
|
||||
break;
|
||||
|
||||
case RPC_L1_MEASUREMENT_MT_QUALITY_REPORT: {
|
||||
struct rrc_rrm_meas_report_mt_q *p;
|
||||
p = (struct rrc_rrm_meas_report_mt_q *)rrc_rrm_meas_payload;
|
||||
printf ("Quality Measurement -\t Number of Transport Channels : %d, Number of TFCS : %d\n", p->q_num_TrCH, p->q_num_tfcs);
|
||||
printf ("[NASRG-MEAS] BLER for each Transport Channel:\t");
|
||||
|
||||
for (i = 0; i < p->q_num_TrCH; i++)
|
||||
printf ("%d: %d, ", p->q_dl_TrCH_id[i], p->q_dl_TrCH_BLER[i]);
|
||||
|
||||
printf ("\n");
|
||||
printf ("[NASRG-MEAS] SIR for each TFCS for each slot:\n");
|
||||
|
||||
for (i = 0; i < p->q_num_tfcs; i++) {
|
||||
printf ("%d: ", p->q_tfcs_id[i]);
|
||||
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d, ", p->q_sir[i][j]);
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RPC_L1_MEASUREMENT_MT_INTERNAL_REPORT: {
|
||||
struct rrc_rrm_meas_report_mt_int *p;
|
||||
p = (struct rrc_rrm_meas_report_mt_int *)rrc_rrm_meas_payload;
|
||||
printf ("UE internal Measurement\t Timing Advance: %d\n", p->int_timing_advance);
|
||||
printf ("[NASRG-MEAS] Transmitted Power for each slot:\t");
|
||||
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d: %d, ", j, p->int_xmit_power[j]);
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
printf ("[NASRG-MEAS] *****END********* Measurement Report Message *******\n\n");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void nasrg_print_bs_meas_report (char *rrc_rrm_meas_payload, uint16_t type){
|
||||
//-----------------------------------------------------------------------------
|
||||
void nasrg_print_bs_meas_report (char *rrc_rrm_meas_payload, uint16_t type)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
int i, j;
|
||||
char *payload[20] =
|
||||
{ "pl0", "pl4", "pl8", "pl16", "pl32", "pl64", "pl128", "pl256", "pl512", "pl1024", "pl2k", "pl4k", "pl8k", "pl16k", "pl32k", "pl64k", "pl128k", "pl256k", "pl512k", "pl1024k" };
|
||||
char *average[20] =
|
||||
{ "pla0", "pla4", "pla8", "pla16", "pla32", "pla64", "pla128", "pla256", "pla512", "pla1024", "pla2k",
|
||||
"pla4k", "pla8k", "pla16k", "pla32k", "pla64k", "pla128k", "pla256k", "pla512k", "pla1024k" };
|
||||
{ "pl0", "pl4", "pl8", "pl16", "pl32", "pl64", "pl128", "pl256", "pl512", "pl1024", "pl2k", "pl4k", "pl8k", "pl16k", "pl32k", "pl64k", "pl128k", "pl256k", "pl512k", "pl1024k" };
|
||||
char *average[20] = {
|
||||
"pla0", "pla4", "pla8", "pla16", "pla32", "pla64", "pla128", "pla256", "pla512", "pla1024", "pla2k",
|
||||
"pla4k", "pla8k", "pla16k", "pla32k", "pla64k", "pla128k", "pla256k", "pla512k", "pla1024k"
|
||||
};
|
||||
char *variance[14] = { "plv0", "plv4", "plv8", "plv16", "plv32", "plv64", "plv128", "plv256", "plv512", "plv1024", "plv2k", "plv4k", "plv8k", "plv16k" };
|
||||
|
||||
printf ("\n[NASRG-MEAS] ************** BS Measurement Report Message *****************\n");
|
||||
|
||||
switch (type) {
|
||||
case RPC_L1_MEASUREMENT_RG_TRAFFIC_VOLUME_REPORT:
|
||||
{
|
||||
struct rrc_rrm_meas_report_bs_tv *p;
|
||||
p = (struct rrc_rrm_meas_report_bs_tv *)rrc_rrm_meas_payload;
|
||||
printf ("Traffic Volume Measurement -\t Number of RBs: %d\n", p->tv_num_rbs);
|
||||
for (i = 0; i < p->tv_num_rbs; i++)
|
||||
printf ("[NASRG-MEAS] RB_Id : %d\t, RLC_BufferPayload : %s\t, Average : %s\t, Variance : %s\n",
|
||||
p->tv_rbid[i], payload[p->tv_rb_payload[i]], average[p->tv_rb_average[i]], variance[p->tv_rb_variance[i]]);
|
||||
}
|
||||
break;
|
||||
case RPC_L1_MEASUREMENT_RG_QUALITY_REPORT:
|
||||
{
|
||||
struct rrc_rrm_meas_report_bs_q *p;
|
||||
p = (struct rrc_rrm_meas_report_bs_q *)rrc_rrm_meas_payload;
|
||||
printf ("Quality Measurement -\t Number of Transport Channels : %d, Number of TFCS : %d\n", p->q_num_TrCH, p->q_num_tfcs);
|
||||
printf ("[NASRG-MEAS] BLER for each Transport Channel:\t");
|
||||
for (i = 0; i < p->q_num_TrCH; i++)
|
||||
printf ("%d: %d, ", p->q_dl_TrCH_id[i], p->q_dl_TrCH_BLER[i]);
|
||||
printf ("\n");
|
||||
printf ("[NASRG-MEAS] SIR for each TFCS for each slot:\n");
|
||||
for (i = 0; i < p->q_num_tfcs; i++) {
|
||||
printf ("%d: ", p->q_tfcs_id[i]);
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d, ", p->q_sir[i][j]);
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RPC_L1_MEASUREMENT_RG_INTERNAL_REPORT:
|
||||
{
|
||||
struct rrc_rrm_meas_report_bs_int *p;
|
||||
p = (struct rrc_rrm_meas_report_bs_int *)rrc_rrm_meas_payload;
|
||||
printf ("BS internal Measurement\n");
|
||||
for (i = 0; i < numANTENNAS; i++) {
|
||||
printf ("[NASRG-MEAS] Transmitted Power for each slot on antenna %d : ", i);
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d: %d, ", j, p->int_xmit_power[i][j]);
|
||||
printf ("\n");
|
||||
}
|
||||
for (i = 0; i < JRRM_SLOTS_PER_FRAME; i++) {
|
||||
printf ("[NASRG-MEAS] RSCP for each channel on slot %d : ", i);
|
||||
for (j = 0; j < MAXCH; j++)
|
||||
printf ("%d: %d, ", j, p->int_rscp[i][j]);
|
||||
printf ("\n");
|
||||
}
|
||||
for (i = 0; i < numANTENNAS; i++) {
|
||||
printf ("[NASRG-MEAS] RSSI RF for each slot on antenna %d : ", i);
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d: %d, ", j, p->int_rssi_rf[i][j]);
|
||||
printf ("\n");
|
||||
}
|
||||
for (i = 0; i < NUMSPARE; i++) {
|
||||
printf ("[NASRG-MEAS] Spare value : %d: %d\n", i, p->int_spare[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RPC_L1_MEASUREMENT_RG_TRAFFIC_VOLUME_REPORT: {
|
||||
struct rrc_rrm_meas_report_bs_tv *p;
|
||||
p = (struct rrc_rrm_meas_report_bs_tv *)rrc_rrm_meas_payload;
|
||||
printf ("Traffic Volume Measurement -\t Number of RBs: %d\n", p->tv_num_rbs);
|
||||
|
||||
for (i = 0; i < p->tv_num_rbs; i++)
|
||||
printf ("[NASRG-MEAS] RB_Id : %d\t, RLC_BufferPayload : %s\t, Average : %s\t, Variance : %s\n",
|
||||
p->tv_rbid[i], payload[p->tv_rb_payload[i]], average[p->tv_rb_average[i]], variance[p->tv_rb_variance[i]]);
|
||||
}
|
||||
break;
|
||||
|
||||
case RPC_L1_MEASUREMENT_RG_QUALITY_REPORT: {
|
||||
struct rrc_rrm_meas_report_bs_q *p;
|
||||
p = (struct rrc_rrm_meas_report_bs_q *)rrc_rrm_meas_payload;
|
||||
printf ("Quality Measurement -\t Number of Transport Channels : %d, Number of TFCS : %d\n", p->q_num_TrCH, p->q_num_tfcs);
|
||||
printf ("[NASRG-MEAS] BLER for each Transport Channel:\t");
|
||||
|
||||
for (i = 0; i < p->q_num_TrCH; i++)
|
||||
printf ("%d: %d, ", p->q_dl_TrCH_id[i], p->q_dl_TrCH_BLER[i]);
|
||||
|
||||
printf ("\n");
|
||||
printf ("[NASRG-MEAS] SIR for each TFCS for each slot:\n");
|
||||
|
||||
for (i = 0; i < p->q_num_tfcs; i++) {
|
||||
printf ("%d: ", p->q_tfcs_id[i]);
|
||||
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d, ", p->q_sir[i][j]);
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RPC_L1_MEASUREMENT_RG_INTERNAL_REPORT: {
|
||||
struct rrc_rrm_meas_report_bs_int *p;
|
||||
p = (struct rrc_rrm_meas_report_bs_int *)rrc_rrm_meas_payload;
|
||||
printf ("BS internal Measurement\n");
|
||||
|
||||
for (i = 0; i < numANTENNAS; i++) {
|
||||
printf ("[NASRG-MEAS] Transmitted Power for each slot on antenna %d : ", i);
|
||||
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d: %d, ", j, p->int_xmit_power[i][j]);
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < JRRM_SLOTS_PER_FRAME; i++) {
|
||||
printf ("[NASRG-MEAS] RSCP for each channel on slot %d : ", i);
|
||||
|
||||
for (j = 0; j < MAXCH; j++)
|
||||
printf ("%d: %d, ", j, p->int_rscp[i][j]);
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < numANTENNAS; i++) {
|
||||
printf ("[NASRG-MEAS] RSSI RF for each slot on antenna %d : ", i);
|
||||
|
||||
for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
|
||||
printf ("%d: %d, ", j, p->int_rssi_rf[i][j]);
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < NUMSPARE; i++) {
|
||||
printf ("[NASRG-MEAS] Spare value : %d: %d\n", i, p->int_spare[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
printf ("[NASRG-MEAS] *****END********* Measurement Report Message *******\n\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,9 @@ struct rrc_rrm_measure_ctl control;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Open FIFOs for RG RRC SAPs
|
||||
void nasrg_rrm_fifos_init (void){
|
||||
//-----------------------------------------------------------------------------
|
||||
void nasrg_rrm_fifos_init (void)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
int write_flag = O_WRONLY | O_NONBLOCK | O_NDELAY;
|
||||
int read_flag = O_RDONLY | O_NONBLOCK | O_NDELAY;
|
||||
|
||||
@@ -60,6 +61,7 @@ void nasrg_rrm_fifos_init (void){
|
||||
fflush(stdout);
|
||||
sleep (1);
|
||||
}
|
||||
|
||||
while ((rrc_rg_rrm_out_fifo = open (RRM_OUTPUT_SAPI, read_flag)) < 0) {
|
||||
printf ("%s returned value %d\n", RRM_OUTPUT_SAPI, rrc_rg_rrm_out_fifo);
|
||||
fflush(stdout);
|
||||
@@ -71,8 +73,9 @@ void nasrg_rrm_fifos_init (void){
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_connection_response (void){
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_connection_response (void)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
rpc_message rpc_mess;
|
||||
connection_response response;
|
||||
int count=0;
|
||||
@@ -89,16 +92,18 @@ void rrm_connection_response (void){
|
||||
count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
|
||||
count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (connection_response));
|
||||
count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
|
||||
|
||||
if (count > 0) {
|
||||
printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
|
||||
} else {
|
||||
} else {
|
||||
printf ("RRM FIFO transmit failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_add_user_response (char *rcve_buffer){
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_add_user_response (char *rcve_buffer)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
rpc_message rpc_mess;
|
||||
add_user_response response;
|
||||
add_user_request *request;
|
||||
@@ -119,16 +124,18 @@ void rrm_add_user_response (char *rcve_buffer){
|
||||
count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
|
||||
count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (add_user_response));
|
||||
count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
|
||||
|
||||
if (count > 0) {
|
||||
printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
|
||||
} else {
|
||||
} else {
|
||||
printf ("RRM FIFO transmit failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_remove_user_response (char *rcve_buffer){
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_remove_user_response (char *rcve_buffer)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
rpc_message rpc_mess;
|
||||
remove_user_response response;
|
||||
remove_user_request *request;
|
||||
@@ -149,12 +156,14 @@ void rrm_remove_user_response (char *rcve_buffer){
|
||||
count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
|
||||
count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (remove_user_response));
|
||||
count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
|
||||
|
||||
if (count > 0) {
|
||||
printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
|
||||
} else {
|
||||
} else {
|
||||
printf ("RRM FIFO transmit failed");
|
||||
}
|
||||
/* Not sure it is really needed here
|
||||
}
|
||||
|
||||
/* Not sure it is really needed here
|
||||
usleep (5000); //wait 5ms
|
||||
// stop q measurement for MT
|
||||
nasrg_meas_q_release (UE_Id, &control);
|
||||
@@ -163,8 +172,9 @@ void rrm_remove_user_response (char *rcve_buffer){
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_add_radio_access_bearer_response (char *rcve_buffer){
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_add_radio_access_bearer_response (char *rcve_buffer)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
rpc_message rpc_mess;
|
||||
add_radio_access_bearer_response response;
|
||||
add_radio_access_bearer_request *request;
|
||||
@@ -185,16 +195,18 @@ void rrm_add_radio_access_bearer_response (char *rcve_buffer){
|
||||
count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
|
||||
count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (add_radio_access_bearer_response));
|
||||
count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
|
||||
|
||||
if (count > 0) {
|
||||
printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
|
||||
} else {
|
||||
} else {
|
||||
printf ("RRM FIFO transmit failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_add_measurement_request (char *rcve_buffer){
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_add_measurement_request (char *rcve_buffer)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
add_radio_access_bearer_confirm *confirm;
|
||||
|
||||
confirm = (add_radio_access_bearer_confirm *)rcve_buffer;
|
||||
@@ -210,8 +222,9 @@ void rrm_add_measurement_request (char *rcve_buffer){
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_remove_radio_access_bearer_response (char *rcve_buffer){
|
||||
//-------------------------------------------------------------------
|
||||
void rrm_remove_radio_access_bearer_response (char *rcve_buffer)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
rpc_message rpc_mess;
|
||||
remove_radio_access_bearer_response response;
|
||||
remove_radio_access_bearer_request *request;
|
||||
@@ -232,11 +245,13 @@ void rrm_remove_radio_access_bearer_response (char *rcve_buffer){
|
||||
count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
|
||||
count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (remove_radio_access_bearer_response));
|
||||
count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
|
||||
|
||||
if (count > 0) {
|
||||
printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
|
||||
} else {
|
||||
} else {
|
||||
printf ("RRM FIFO transmit failed");
|
||||
}
|
||||
}
|
||||
|
||||
usleep (20000); //wait 5ms
|
||||
// stop q measurement for MT
|
||||
nasrg_meas_q_release (request->user_id, &control);
|
||||
@@ -246,8 +261,9 @@ void rrm_remove_radio_access_bearer_response (char *rcve_buffer){
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Check if anything in RRC FIFO and send it to RRM
|
||||
void nasrg_rrm_from_rrc_read (void){
|
||||
//-----------------------------------------------------------------------------
|
||||
void nasrg_rrm_from_rrc_read (void)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
char rcve_buffer[RRM_MSG_MAX_LENGTH];
|
||||
int rpc_header_size=0;
|
||||
int count = 0;
|
||||
@@ -260,70 +276,81 @@ void nasrg_rrm_from_rrc_read (void){
|
||||
|
||||
if ((count = read (rrc_rg_rrm_out_fifo, rcve_buffer, rpc_header_size)) > 0) {
|
||||
//printf("\n RRM FIFO %d, bytes count %d", rrc_rg_rrm_out_fifo, count);
|
||||
#ifdef DEBUG_RRC_RRM_INTF
|
||||
#ifdef DEBUG_RRC_RRM_INTF
|
||||
printf ("\n [DEBUG]Message Received in RRM FIFO %d , length %d, type %d \n", rrc_rg_rrm_out_fifo, rrc_rrm_mess->length, rrc_rrm_mess->type);
|
||||
#endif
|
||||
#endif
|
||||
//get the rest of the primitive
|
||||
count += read (rrc_rg_rrm_out_fifo, &(rcve_buffer[rpc_header_size]), rrc_rrm_mess->length );
|
||||
|
||||
switch (rrc_rrm_mess->type) {
|
||||
switch (rrc_rrm_mess->type) {
|
||||
case RPC_CONNECTION_REQUEST:
|
||||
printf ("\n[CELL-RRM]Received RPC_CONNECTION_REQUEST, length %d\n", rrc_rrm_mess->length);
|
||||
rrm_connection_response();
|
||||
break;
|
||||
|
||||
case RPC_ADD_USER_REQUEST:
|
||||
printf ("\n[CELL-RRM]Received RPC_ADD_USER_REQUEST, length %d\n", rrc_rrm_mess->length);
|
||||
rrm_add_user_response(&(rcve_buffer[rpc_header_size]));
|
||||
break;
|
||||
|
||||
case RPC_REMOVE_USER_REQUEST:
|
||||
printf ("\n[CELL-RRM]Received RPC_REMOVE_USER_REQUEST, length %d\n", rrc_rrm_mess->length);
|
||||
rrm_remove_user_response(&(rcve_buffer[rpc_header_size]));
|
||||
break;
|
||||
|
||||
case RPC_ADD_RADIO_ACCESS_BEARER_REQUEST:
|
||||
printf ("\n[CELL-RRM]Received RPC_ADD_RADIO_ACCESS_BEARER_REQUEST, length %d\n", rrc_rrm_mess->length);
|
||||
rrm_add_radio_access_bearer_response(&(rcve_buffer[rpc_header_size]));
|
||||
break;
|
||||
|
||||
case RPC_REMOVE_RADIO_ACCESS_BEARER_REQUEST:
|
||||
printf ("\n[CELL-RRM]Received RPC_REMOVE_RADIO_ACCESS_BEARER_REQUEST, length %d\n", rrc_rrm_mess->length);
|
||||
rrm_remove_radio_access_bearer_response(&(rcve_buffer[rpc_header_size]));
|
||||
break;
|
||||
|
||||
case RPC_ADD_USER_CONFIRM:
|
||||
printf ("\n[CELL-RRM]Received RPC RPC_ADD_USER_CONFIRM , length %d\n", rrc_rrm_mess->length);
|
||||
break;
|
||||
|
||||
case RPC_ADD_RADIO_ACCESS_BEARER_CONFIRM:
|
||||
printf ("\n[CELL-RRM]Received RPC RPC_ADD_RADIO_ACCESS_BEARER_CONFIRM , length %d\n", rrc_rrm_mess->length);
|
||||
//rrm_add_measurement_request(&(rcve_buffer[rpc_header_size]));
|
||||
break;
|
||||
|
||||
case RPC_L1_MEASUREMENT_RG_INTERNAL_REPORT:
|
||||
case RPC_L1_MEASUREMENT_RG_QUALITY_REPORT:
|
||||
case RPC_L1_MEASUREMENT_RG_TRAFFIC_VOLUME_REPORT:
|
||||
rrc_rrm_meas_payload = (char *)rcve_buffer +12; //12 = rpc_header + equipment_id
|
||||
//nas_rg_print_buffer (rrc_rrm_meas_payload, rrc_rrm_mess->length);
|
||||
nasrg_print_bs_meas_report (rrc_rrm_meas_payload,rrc_rrm_mess->type);
|
||||
rrc_rrm_meas_payload = (char *)rcve_buffer +12; //12 = rpc_header + equipment_id
|
||||
//nas_rg_print_buffer (rrc_rrm_meas_payload, rrc_rrm_mess->length);
|
||||
nasrg_print_bs_meas_report (rrc_rrm_meas_payload,rrc_rrm_mess->type);
|
||||
break;
|
||||
|
||||
case RPC_L1_MEASUREMENT_MT_INTERNAL_REPORT:
|
||||
case RPC_L1_MEASUREMENT_MT_QUALITY_REPORT:
|
||||
case RPC_L1_MEASUREMENT_MT_TRAFFIC_VOLUME_REPORT:
|
||||
case RPC_L1_MEASUREMENT_MT_INTRA_FREQUENCY_REPORT:
|
||||
rrc_rrm_meas_payload = (char *)rcve_buffer +12; //12 = rpc_header + equipment_id
|
||||
//nas_rg_print_buffer (rrc_rrm_meas_payload, rrc_rrm_mess->length);
|
||||
nasrg_print_meas_report (rrc_rrm_meas_payload,rrc_rrm_mess->type);
|
||||
rrc_rrm_meas_payload = (char *)rcve_buffer +12; //12 = rpc_header + equipment_id
|
||||
//nas_rg_print_buffer (rrc_rrm_meas_payload, rrc_rrm_mess->length);
|
||||
nasrg_print_meas_report (rrc_rrm_meas_payload,rrc_rrm_mess->type);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int main (int argc, char **argv){
|
||||
//-----------------------------------------------------------------------------
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
int time = 0;
|
||||
// int rc, sd_rrm;
|
||||
// fd_set readfds;
|
||||
// struct timeval tv;
|
||||
// int rc, sd_rrm;
|
||||
// fd_set readfds;
|
||||
// struct timeval tv;
|
||||
tXmit_id =0;
|
||||
nasrg_rrm_fifos_init ();
|
||||
printf ("[RRM] RRM FIFOs ready\n");
|
||||
|
||||
Reference in New Issue
Block a user