]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/commitdiff
remove compile warnings
authorDavid Lide <a0216552@gtudci01.(none)>
Tue, 31 Jan 2012 20:43:00 +0000 (15:43 -0500)
committerDavid Lide <a0216552@gtudci01.(none)>
Tue, 31 Jan 2012 20:43:00 +0000 (15:43 -0500)
ti/runtime/netapi/src/netapi.c
ti/runtime/netapi/src/netapi_loc.h
ti/runtime/netapi/src/netapi_sched.c
ti/runtime/netapi/src/netapi_timer.c
ti/runtime/netapi/src/netcp_cfg.c
ti/runtime/netapi/src/pktio.c
ti/runtime/netapi/test/net_test.c
ti/runtime/netapi/test/synchtest.c

index 30ee6eb625792c4a4291235d82eb39af0ccf46ca..5397bb430bab226e4ea72749e137b1627b716b9a 100644 (file)
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
  * *****************************/
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
  * *****************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
 #include "netapi.h"
 
 typedef struct PRESET_Tag
 #include "netapi.h"
 
 typedef struct PRESET_Tag
@@ -208,7 +212,7 @@ static int system_init(NETAPI_HANDLE_T * handle)
     result= netapi_qm_setup_mem_region( 
                       NUM_SHARED_DESC,
                       SIZE_SHARED_DESC,
     result= netapi_qm_setup_mem_region( 
                       NUM_SHARED_DESC,
                       SIZE_SHARED_DESC,
-                      netapi_VM_QMemGlobalDescRam,
+                      (unsigned int *) netapi_VM_QMemGlobalDescRam,
                       NETAPI_GLOBAL_REGION);
     if(result <0) {printf(">netapi; can't setup QM shared region\n"); return -1;}
 
                       NETAPI_GLOBAL_REGION);
     if(result <0) {printf(">netapi; can't setup QM shared region\n"); return -1;}
 
index abe023ef62879cf23dd4c8417406480346638127..3af673cec04653f29b59fb9ccbd6d88301c3f882 100644 (file)
@@ -193,7 +193,7 @@ int netapi_qm_setup_mem_region(
 
 //nwal callbacks
 void netapi_NWALRxPktCallback     (uint32_t            appCookie,
 
 //nwal callbacks
 void netapi_NWALRxPktCallback     (uint32_t            appCookie,
-                                uint8_t             numPkts,
+                                uint16_t             numPkts,
                                 nwalRxPktInfo_t*    pPktInfo,
                                 uint64_t            timestamp,
                                 nwal_Bool_t*        pFreePkt);
                                 nwalRxPktInfo_t*    pPktInfo,
                                 uint64_t            timestamp,
                                 nwal_Bool_t*        pFreePkt);
index f08512b8c3cb7d953223cf7991172f377f759541..05037f45221f2a9985467e8f61b9dfa9939598c9 100644 (file)
@@ -95,8 +95,6 @@ int netapi_schedWaitForEvents(NETAPI_SCHED_HANDLE_T *s, int *p_err)
   int next_house;
 
   next_house =  s->config.interval;
   int next_house;
 
   next_house =  s->config.interval;
-  printf(">entering scheduling loop @%llx until  %llx . interval=%x, (1st house=%lx)\n", t,  s->shutdown_time,
-         s->config.interval, next_house);
   /* loop for duration or until shutdown */
   for(;t< s->shutdown_time;)
   {
   /* loop for duration or until shutdown */
   for(;t< s->shutdown_time;)
   {
index 1da8eaab9b847966d8af6aab24aa344508f83380..34b118e95d69055d7a04c2a89d436cc2ac19febd 100644 (file)
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  ***************************************************************/
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  ***************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
 #include "netapi.h"
 #include "netapi_timer.h"
 #include "timer_loc.h"
 #include "netapi.h"
 #include "netapi_timer.h"
 #include "timer_loc.h"
index 6b5e54dd8b57ecc70bb26ab71c71801494399d66..eb971fa1568db72310f2a7e6bf2bc4abbaeb07e1 100644 (file)
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
  ******************************************************/
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
  ******************************************************/
-
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
 #include "netapi.h"
 #include "netcp_cfg.h"
 #include "netapi_loc.h"
 #include "netapi.h"
 #include "netcp_cfg.h"
 #include "netapi_loc.h"
@@ -196,11 +199,11 @@ nwal_RetValue       retValue;
 NetapiNwalTransInfo_t *pTransInfo;
 nwal_TransID_t     trans_id;
 
 NetapiNwalTransInfo_t *pTransInfo;
 nwal_TransID_t     trans_id;
 
-    if ((!n) || (!p_mac)) {*err = NETAPI_ERR_BAD_INPUT; return NULL;}
+    if ((!n) || (!p_mac)) {*err = NETAPI_ERR_BAD_INPUT; return -1;}
     *err =0;
 
     pTransInfo = netapi_GetFreeTransInfo((NETAPI_GLOBAL_T *) n->global, &trans_id);
     *err =0;
 
     pTransInfo = netapi_GetFreeTransInfo((NETAPI_GLOBAL_T *) n->global, &trans_id);
-    if (!pTransInfo) { *err =  NETAPI_ERR_BUSY; return NULL;}
+    if (!pTransInfo) { *err =  NETAPI_ERR_BUSY; return -1;}
     pTransInfo->transType = NETAPI_NWAL_HANDLE_TRANS_MAC;
     pTransInfo->netapi_handle = h; 
 
     pTransInfo->transType = NETAPI_NWAL_HANDLE_TRANS_MAC;
     pTransInfo->netapi_handle = h; 
 
@@ -229,7 +232,7 @@ nwal_TransID_t     trans_id;
         printf (">netcp cfg - ERROR: nwal_setMacIface returned Error Code %d\n",
                     retValue);
         pTransInfo->inUse = nwal_FALSE;
         printf (">netcp cfg - ERROR: nwal_setMacIface returned Error Code %d\n",
                     retValue);
         pTransInfo->inUse = nwal_FALSE;
-        return NULL;
+        return -1;
     }
     //pTransInfo->inUse = nwal_FALSE;
 
     }
     //pTransInfo->inUse = nwal_FALSE;
 
@@ -251,7 +254,7 @@ nwal_TransID_t     trans_id;
                           (void *) pTransInfo->handle);
     pTransInfo->state =  NETAPI_NWAL_HANDLE_STATE_IDLE;
     pTransInfo->inUse = nwal_FALSE;
                           (void *) pTransInfo->handle);
     pTransInfo->state =  NETAPI_NWAL_HANDLE_STATE_IDLE;
     pTransInfo->inUse = nwal_FALSE;
-    return (void *) (NETAPI_NETCP_MATCH_GENERIC_MAC | iface_no);
+    return  (NETAPI_NETCP_MATCH_GENERIC_MAC | iface_no);
 }
 
 
 }
 
 
@@ -299,7 +302,7 @@ nwal_TransID_t     trans_id;
 
 
      //verify that iface has been configurred 
 
 
      //verify that iface has been configurred 
-     if ((iface_no<0) || (iface_no>= TUNE_NETAPI_MAX_INTERFACES)) {*err = NETAPI_ERR_BAD_INPUT; return NULL;}
+     if ((iface_no<0) || (iface_no>= TUNE_NETAPI_MAX_INTERFACES)) {*err = NETAPI_ERR_BAD_INPUT; return -1;}
 
      if(netapi_get_global()->nwal_context.interfaces[iface_no].in_use)
      {
 
      if(netapi_get_global()->nwal_context.interfaces[iface_no].in_use)
      {
@@ -308,12 +311,12 @@ nwal_TransID_t     trans_id;
      else
      {
        *err = NETAPI_ERR_BAD_INPUT;
      else
      {
        *err = NETAPI_ERR_BAD_INPUT;
-       return NULL;
+       return -1;
      }
 
      //get a transaction object for config action
     pTransInfo = netapi_GetFreeTransInfo((NETAPI_GLOBAL_T *) n->global, &trans_id);
      }
 
      //get a transaction object for config action
     pTransInfo = netapi_GetFreeTransInfo((NETAPI_GLOBAL_T *) n->global, &trans_id);
-    if (!pTransInfo) { *err =  NETAPI_ERR_BUSY; return NULL;}
+    if (!pTransInfo) { *err =  NETAPI_ERR_BUSY; return -1;}
     pTransInfo->transType = NETAPI_NWAL_HANDLE_TRANS_IP;
     pTransInfo->netapi_handle = h;
 
     pTransInfo->transType = NETAPI_NWAL_HANDLE_TRANS_IP;
     pTransInfo->netapi_handle = h;
 
@@ -345,7 +348,7 @@ nwal_TransID_t     trans_id;
         printf (">netcp cfg: nwal_setIP returned Error Code %d\n",
                     retValue);
         pTransInfo->inUse = nwal_FALSE;
         printf (">netcp cfg: nwal_setIP returned Error Code %d\n",
                     retValue);
         pTransInfo->inUse = nwal_FALSE;
-        return NULL;
+        return -1;
     }
     //wait here until its done since scheduler isn't running yet most likely..
     // todo:  make this handled by scheduler poll later ??
     }
     //wait here until its done since scheduler isn't running yet most likely..
     // todo:  make this handled by scheduler poll later ??
@@ -365,7 +368,7 @@ nwal_TransID_t     trans_id;
                           pTransInfo->handle);
     pTransInfo->state =  NETAPI_NWAL_HANDLE_STATE_IDLE;
     pTransInfo->inUse = nwal_FALSE;
                           pTransInfo->handle);
     pTransInfo->state =  NETAPI_NWAL_HANDLE_STATE_IDLE;
     pTransInfo->inUse = nwal_FALSE;
-    return (void *) (NETAPI_NETCP_MATCH_GENERIC_IP | iface_no);
+    return  (NETAPI_NETCP_MATCH_GENERIC_IP | iface_no);
 }
 
 
 }
 
 
index c0816a1f0787133659a2016880f7e4e810206541..1388faedb07dad29a3d97bd2d850a63502b07b0f 100644 (file)
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
  ********************************/
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
  ********************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
 #include "netapi.h"
 
 /*--------------------Utilites-----------------*/
 #include "netapi.h"
 
 /*--------------------Utilites-----------------*/
@@ -354,7 +358,7 @@ uint64_t ts= netapi_getTimestamp();  //get_ts
                        pkt_list[r]= temp;
                        meta_s[r].flags1=0x1;
                }       
                        pkt_list[r]= temp;
                        meta_s[r].flags1=0x1;
                }       
-               if (r) p->cb(p, pkt_list, &meta_s[0], r, ts);
+               if (r) p->cb((struct PKTIO_HANDLE_tag *)p, pkt_list, &meta_s[0], r, ts);
        }
        return r;
 }
        }
        return r;
 }
@@ -385,7 +389,7 @@ return r;
 /***** this is the callback we registered with NWAL for pkt reception *****/
 /* appcookie -> pktio handle */
 void netapi_NWALRxPktCallback     (uint32_t            appCookie,
 /***** this is the callback we registered with NWAL for pkt reception *****/
 /* appcookie -> pktio handle */
 void netapi_NWALRxPktCallback     (uint32_t            appCookie,
-                                uint8_t             numPkts,
+                                uint16_t             numPkts,
                                 nwalRxPktInfo_t*    pPktInfo,
                                 uint64_t            timestamp,
                                 nwal_Bool_t*        pFreePkt)
                                 nwalRxPktInfo_t*    pPktInfo,
                                 uint64_t            timestamp,
                                 nwal_Bool_t*        pFreePkt)
@@ -401,7 +405,7 @@ PKTIO_METADATA_T meta_s[PKTIO_MAX_RECV];
         meta_s[r].flags1 = PKTIO_META_RX;
         meta_s[r].u.rx_meta = &pPktInfo[r];
     }
         meta_s[r].flags1 = PKTIO_META_RX;
         meta_s[r].u.rx_meta = &pPktInfo[r];
     }
-    if (r) p->cb(p, pkt_list, &meta_s[0], r, timestamp);
+    if (r) p->cb((struct PKTIO_HANDLE_tag *)p, pkt_list, &meta_s[0], r, timestamp);
 
 }
                                                   
 
 }
                                                   
index 99105f9ca3a1a4e53e970f926693264a33d0fccc..11d9c5dd14772060bef1e31fc012b22c81894427 100755 (executable)
 
  *****************************************/
 
 
  *****************************************/
 
-#include "stdlib.h"
-#include "stdio.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
 
 #include "trie.h"
 #include "string.h"
 
 #include "trie.h"
 #include "string.h"
@@ -278,21 +281,16 @@ void update_header(HEAD_T * p_head, int len)
    *(p+1) = len&0xff;
 }
 
    *(p+1) = len&0xff;
 }
 
+#if 0
 void gen_pkts(int np)
 {
 int i;
 int ip = START_SRC_IP &0xff;
 int port= START_SRC_PORT;
 void gen_pkts(int np)
 {
 int i;
 int ip = START_SRC_IP &0xff;
 int port= START_SRC_PORT;
-HEAD_T temp={{0x25000200,0xdead0000,0x80110000,START_SRC_IP,DST_IP},
-             {START_SRC_PORT<<16|DST_PORT,0x01ec<<16|0x0000}};
-/* endian convert header */
-temp.ip[0]=htonl(temp.ip[0]);
-temp.ip[1]=htonl(temp.ip[1]);
-temp.ip[2]=htonl(temp.ip[2]);
-temp.ip[3]=htonl(temp.ip[3]);
-temp.ip[4]=htonl(temp.ip[4]);
-temp.udp[0]=htonl(temp.udp[0]);
-temp.udp[1]=htonl(temp.udp[1]);
+//HEAD_T temp={{0x25000200,0xdead0000,0x80110000,START_SRC_IP,DST_IP},
+//             {START_SRC_PORT<<16|DST_PORT,0x01ec<<16|0x0000}};
+HEAD_T temp;
+memcpy(&temp,&testPkt[0],sizeof(HEAD_T));
 
 for(i=0;(i<np) && (i<NP);i++)
   {
 
 for(i=0;(i<np) && (i<NP);i++)
   {
@@ -308,58 +306,68 @@ for(i=0;(i<np) && (i<NP);i++)
   }
   n_pkt=np;
 }
   }
   n_pkt=np;
 }
+#endif
+
 void build_table(Trie * p_trie)
 {
 int i;
 void build_table(Trie * p_trie)
 {
 int i;
-int sip=NEW_START_SRC_IP&0xff;
 int sport=NEW_START_SRC_PORT; 
 int sport=NEW_START_SRC_PORT; 
-HEAD_T temp;
+HEAD_T temp,temp2;
 KEY_T key;
 KEY_T key;
-int skip;
-int nskip=0;
-for(i=0;(i<n_pkt) && (i<NE);i++)
+
+memcpy(&temp,&testPkt[14],sizeof(temp));
+
+ //insert entry into trie
+key.src_ip = temp.ip[3];
+key.dst_ip = temp.ip[4];
+key.src_port= (temp.udp[0]&0xffff0000)>>16;
+key.dst_port= (temp.udp[0]&0x0000ffff);
+trie_insert(p_trie,(char *)&key,sizeof(key), (void *) &nat[0]); //asociate with nat entry 0
+
+//build nat table
+for(i=0;i<100;i++)
 {
 {
-   skip = rand()%100;
-   if (skip<perslow) {nskip++;continue;}
-   memcpy(&temp,&pkts[i],sizeof(temp));
-   temp.ip[3]=htonl(((NEW_START_SRC_IP)&(0xffffff00))|(sip));
-   temp.udp[0] = htonl((temp.udp[0]&0xffff)| (sport<<16));
-   memcpy(&nat[i], &temp, sizeof(temp));
-
-   //insert entry
-   key.src_ip = pkts[i].ip[3];
-   key.dst_ip = pkts[i].ip[4];
-   key.src_port= (pkts[i].udp[0]&0xffff0000)>>16;
-   key.dst_port= (pkts[i].udp[0]&0x0000ffff);
-   trie_insert(p_trie,(char *)&key,sizeof(key), (void *) &nat[i]);
-   /* update */
-  sport+= 1;
-  if (sport > 60000) { sport = NEW_START_SRC_PORT; sip+=1; }
+   memcpy(&temp2,&testPkt[14],sizeof(temp));
+   temp2.udp[0] = (temp2.udp[0] & 0xffff0000) |  sport;
+   memcpy(&nat[i], &temp2, sizeof(temp2));
+   sport+= 1;
 }
 }
- //printf("build tab: %d %d\n", n_pkt , nskip);
 }
 
 //===========stub transmitter==================
 void send_pkt(Ti_Pkt *pkt, int len)
 {
 }
 
 //===========stub transmitter==================
 void send_pkt(Ti_Pkt *pkt, int len)
 {
+//just free pkt.  Don't send
 Pktlib_freePacket((Ti_Pkt*)pkt);
        return;
 }
 
 Pktlib_freePacket((Ti_Pkt*)pkt);
        return;
 }
 
-
+//==========stub slow path============
 void slow_path(Ti_Pkt *pkt, int len)
 {
 void slow_path(Ti_Pkt *pkt, int len)
 {
-
+// debug: check descriptor for validity by verifying that desciptor link field is null as expected\n");
          {Ti_Pkt * k= Pktlib_getNextPacket(pkt); if(k != 0) {printf(" slowpath, nexpkt != NULL");}}
          {Ti_Pkt * k= Pktlib_getNextPacket(pkt); if(k != 0) {printf(" slowpath, nexpkt != NULL");}}
+//just free pkt
 Pktlib_freePacket((Ti_Pkt*)pkt);
        return;
 }
 /* check header */
 Pktlib_freePacket((Ti_Pkt*)pkt);
        return;
 }
 /* check header */
-int check_header(HEAD_T * p_head)
+struct LastPktInfo
+{
+int iface;
+int ipcsum;
+int l4csum;
+} ;
+static struct LastPktInfo lpInfo;
+
+int check_header(HEAD_T * p_head, PKTIO_METADATA_T * p_meta)
 {
 {
- /* check version */
- /* ip check sum */
- /* udp check sum */
+if (NWAL_RX_FLAG1_META_DATA_VALID & p_meta->u.rx_meta->rxFlag1)
+{
+lpInfo.iface = ((unsigned int)p_meta->u.rx_meta->appId) &0xff; //last byte is interface num
+lpInfo.ipcsum =(p_meta->u.rx_meta->rxFlag1 & NWAL_RX_FLAG1_IPV4_CHKSUM_VERIFY_MASK )== NWAL_RX_FLAG1_IPV4_CHKSUM_VERIFY_ACK ? 1 : 0;
+lpInfo.l4csum = (p_meta->u.rx_meta->rxFlag1 & NWAL_RX_FLAG1_L4_CHKSUM_VERIFY_MASK )== ((NWAL_RX_FLAG1_L4_CHKSUM_VERIFY_ACK) << NWAL_RX_FLAG1_L4_CHKSUM_VERIFY_SHIFT) ? 1 : 0; 
+}
  return 1;
 }
 
  return 1;
 }
 
@@ -394,19 +402,6 @@ Ti_Pkt * get_pkt(int n, unsigned int *p_len)
   if (!b) 
     {printf("net_test: get_pkt() heap empty!! %d pkts gen'd %d \n", n); return NULL;};
 
   if (!b) 
     {printf("net_test: get_pkt() heap empty!! %d pkts gen'd %d \n", n); return NULL;};
 
-   //debug
-   //printf("pkt= %x %x\n", b, Pktlib_getNextPacket(b));
-
-#if 0
-/*temp patch - should move inside nwal **/
-{
-Cppi_Desc * pHdrDesc = Pktlib_getDescFromPacket(b);
-
-/* Initialize the PS for no control info.  */
-Cppi_setPSLen (Cppi_DescType_HOST, (Cppi_Desc *)pHdrDesc, 0);
-}
-#endif
-
     //debug - way to validate descriptor
     {Ti_Pkt* k= Pktlib_getNextPacket(b); 
          if(k != 0) {printf(" genpkt, nexpkt != NULL");}}
     //debug - way to validate descriptor
     {Ti_Pkt* k= Pktlib_getNextPacket(b); 
          if(k != 0) {printf(" genpkt, nexpkt != NULL");}}
@@ -497,7 +492,7 @@ HEAD_T temp_head;
 
        /* check header */
        memcpy(p_head,&p_pkt[14],sizeof(HEAD_T));
 
        /* check header */
        memcpy(p_head,&p_pkt[14],sizeof(HEAD_T));
-       if (!check_header(p_head)) { 
+       if (!check_header(p_head,&meta[i])) { 
                stats.n_bad+=1;Pktlib_freePacket(tip); continue;
        }
 
                stats.n_bad+=1;Pktlib_freePacket(tip); continue;
        }
 
@@ -512,12 +507,10 @@ HEAD_T temp_head;
        /* copy header */
        memcpy((char *) p_head, (char *) p_res, sizeof(HEAD_T));
 
        /* copy header */
        memcpy((char *) p_head, (char *) p_res, sizeof(HEAD_T));
 
-       /* update checksums */
-       //update_header(p_head,len);
        memcpy(&p_pkt[14],p_head,sizeof(HEAD_T));
         /* update_mac(&p_pkt[0]);  */
 
        memcpy(&p_pkt[14],p_head,sizeof(HEAD_T));
         /* update_mac(&p_pkt[0]);  */
 
-       /* send pkt */
+       /* 'simulate' send pkt */
        send_pkt(tip,len);
        stats.tx+=1;
     }
        send_pkt(tip,len);
        stats.tx+=1;
     }
@@ -568,11 +561,7 @@ for(i=0;i<n_fired;i++)
         (void *) 1,
         100LL,  //timer group ticks
         &err);
         (void *) 1,
         100LL,  //timer group ticks
         &err);
-
-
  }
  }
-
-
   tx = netapi_TimerGetNext(fired_list,tx); 
 }
 }
   tx = netapi_TimerGetNext(fired_list,tx); 
 }
 }
@@ -615,7 +604,7 @@ Pktlib_getHeapStats(OurHeap, &numFreeDataPackets,
                              &numZeroBufferPackets, &numPacketsinGarbage);
 printf("heap stats>  #free=%d #zb=%d #garbage=%d\n", numFreeDataPackets,
                                 numZeroBufferPackets, numPacketsinGarbage);
                              &numZeroBufferPackets, &numPacketsinGarbage);
 printf("heap stats>  #free=%d #zb=%d #garbage=%d\n", numFreeDataPackets,
                                 numZeroBufferPackets, numPacketsinGarbage);
-//debug
+//debug = dump timer polling stats
 dump_poll_stats();
 
 
 dump_poll_stats();
 
 
@@ -734,13 +723,13 @@ OurHeap = Pktlib_findHeapByName("netapi");
 if (!OurHeap) {printf("findheapbyname fail\n"); exit(1);}
 
 /* create a pktio channel */
 if (!OurHeap) {printf("findheapbyname fail\n"); exit(1);}
 
 /* create a pktio channel */
-our_chan=pktio_create(netapi_handle,"our1stq",recv_cb, &our_chan_cfg,&err);
+our_chan=pktio_create(netapi_handle,"our1stq",(PKTIO_CB) recv_cb, &our_chan_cfg,&err);
 if (!our_chan) {printf("pktio create failed err=%d\n",err); exit(1);}
 
 /* open netcp default tx, rx queues */
 netcp_tx_chan= pktio_open(netapi_handle, NETCP_TX, NULL, &netcp_tx_cfg,  &err);
 if (!netcp_tx_chan) {printf("pktio open TX failed err=%d\n",err); exit(1);}
 if (!our_chan) {printf("pktio create failed err=%d\n",err); exit(1);}
 
 /* open netcp default tx, rx queues */
 netcp_tx_chan= pktio_open(netapi_handle, NETCP_TX, NULL, &netcp_tx_cfg,  &err);
 if (!netcp_tx_chan) {printf("pktio open TX failed err=%d\n",err); exit(1);}
-netcp_rx_chan= pktio_open(netapi_handle, NETCP_RX, recv_cb, &netcp_rx_cfg,  &err);
+netcp_rx_chan= pktio_open(netapi_handle, NETCP_RX, (PKTIO_CB) recv_cb, &netcp_rx_cfg,  &err);
 if (!netcp_rx_chan) {printf("pktio open RX failed err=%d\n",err); exit(1);}
 
 
 if (!netcp_rx_chan) {printf("pktio open RX failed err=%d\n",err); exit(1);}
 
 
@@ -846,7 +835,8 @@ if (!P_trie) {printf("trie alloc failed\n"); exit(1);}
 nat = (HEAD_T *) malloc(NE * sizeof(HEAD_T));
 if (!nat) {printf("malloc of nat table failed\n"); exit(1);}
 
 nat = (HEAD_T *) malloc(NE * sizeof(HEAD_T));
 if (!nat) {printf("malloc of nat table failed\n"); exit(1);}
 
-gen_pkts(np2process<NP ? np2process:NP);
+//gen_pkts(np2process<NP ? np2process:NP);
+n_pkt= np2process;
 
 /* build table */
 build_table(P_trie);
 
 /* build table */
 build_table(P_trie);
index f916ba323609a7c3ee2d2414772e30bbdbd49447..d5de741960fa97c13bf53f8feda00fc7307f625f 100644 (file)
  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  ******************************/
  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  ******************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
 #include "netsync.h"
 #include "netapi_util.h"
 
 #include "netsync.h"
 #include "netapi_util.h"