From a3e804993dc549f7c64c82fd748a59506606bfae Mon Sep 17 00:00:00 2001 From: David Lide Date: Mon, 2 Jul 2012 16:07:37 -0400 Subject: [PATCH] some cleanup, added example_fast_pushpop back out cache op better in burst send burst send now sends pkts not requiring any netcp offload --- ti/runtime/netapi/test/net_test.c | 113 ++++++++++++++++++++++++++---- 1 file changed, 99 insertions(+), 14 deletions(-) diff --git a/ti/runtime/netapi/test/net_test.c b/ti/runtime/netapi/test/net_test.c index 3e31adc..c01a817 100644 --- a/ti/runtime/netapi/test/net_test.c +++ b/ti/runtime/netapi/test/net_test.c @@ -83,7 +83,7 @@ void dump_header(unsigned long *p, int n, int a, int r) //************for multi pkt burst xfer test in loopback mode -#define TX_BURST 800 +#define TX_BURST 700 int pktloopback=TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK; nwalTxPSCmdInfo_t flowPSCmdInfo; @@ -138,7 +138,9 @@ static uint8_t testPkt[] = { /* The pseudo header checksum of the packet except for the 16 bit length */ #define TEST_PKT_PSEUDO_HDR_CHKSUM_SANS_LEN 0x0FFC -void example_fast_poll( PKTIO_HANDLE_T * p_pktio); +void example_fast_poll( PKTIO_HANDLE_T * p_pktio, int max_pkts); +void example_fast_pushpop(Pktlib_HeapHandle p_heap, int ntrials); + #if 1 //#include "arpa/inet.h" @@ -1310,6 +1312,9 @@ unsigned int nwal_sum_vv6=0; unsigned int nwal_sum_flow_vv1=0; unsigned int nwal_sum_flow_vv2=0; +unsigned int cache_op_b1; +unsigned int cache_op_b2; +int n_c_ops; static int first =0; Cppi_HostDesc* pPktDesc; @@ -1346,6 +1351,8 @@ if ((house_pkts_gened>0) && (! (house_pkts_gened%1000)) ) /* set up meta data */ meta.sa_handle=nwal_HANDLE_INVALID; +//#define BENCH_UDP_SEND +#ifdef BEND_UDP_SEND meta_tx.txFlag1 = (NWAL_TX_FLAG1_DO_IPV4_CHKSUM | NWAL_TX_FLAG1_DO_UDP_CHKSUM| NWAL_TX_FLAG1_META_DATA_VALID); meta_tx.startOffset = 0; //GONE in V2 meta_tx.pktLen = len; @@ -1359,7 +1366,11 @@ if ((house_pkts_gened>0) && (! (house_pkts_gened%1000)) ) pIpHdr = pData + meta_tx.ipOffBytes; meta_tx.pseudoHdrChecksum = test_utilGetIpv4PsudoChkSum(pIpHdr,(TEST_PAYLOAD_LEN+TEST_PKT_UDP_HDR_LEN)); - +#else + meta_tx.txFlag1 = NWAL_TX_FLAG1_META_DATA_VALID; + meta_tx.startOffset = 0; + meta_tx.ploadLen = TEST_PAYLOAD_LEN; +#endif /* post it to netcp tx channel*/ meta.u.tx_meta=&meta_tx; #ifdef DEBUG_DESC @@ -1382,13 +1393,21 @@ if ((house_pkts_gened>0) && (! (house_pkts_gened%1000)) ) nwal_sum_flow_vv2 += (nwal_flow_vv2-nwal_flow_vv1); } + cache_op_b1= Osal_cache_op_measure(&n_c_ops); vv2= netapi_timing_stop(); +#ifdef BEND_UDP_SEND nwal_mCmdSetL4CkSumPort( tip, &flowPSCmdInfo, TEST_PKT_UDP_OFFSET_BYTES, (TEST_PKT_UDP_HDR_LEN + TEST_PAYLOAD_LEN), meta_tx.pseudoHdrChecksum, meta_tx.enetPort); +#else + nwal_mCmdSetPort (tip, + &flowPSCmdInfo, //could be NULL + 0); //port 0 -> switch decides + +#endif pPktDesc = Pktlib_getDescFromPacket(tip); /* Send the packet out to transmit Q*/ @@ -1396,7 +1415,7 @@ if ((house_pkts_gened>0) && (! (house_pkts_gened%1000)) ) pPktDesc, NWAL_DESC_SIZE); vv3= netapi_timing_stop(); - + cache_op_b2= Osal_cache_op_measure(&n_c_ops); sum_vv1 += (vv2-vv1); if(!house_pkts_gened) @@ -1405,7 +1424,7 @@ if ((house_pkts_gened>0) && (! (house_pkts_gened%1000)) ) sum_vv1 = sum_vv1 - nwal_sum_flow_vv2; } - sum_vv3 += (vv3-vv2); + sum_vv3 += (vv3-vv2)-(cache_op_b2-cache_op_b1); //sub out cache op cost // printf("pktio send. full=%d metadata=%d pktio_send=%d\n", vv3-vv1, vv2-vv1, vv3-vv2); @@ -1415,18 +1434,18 @@ if ((house_pkts_gened>0) && (! (house_pkts_gened%1000)) ) } { unsigned int ccycles; - int n_c_ops; ccycles =Osal_cache_op_measure(&n_c_ops); if (sum_vv1) { - printf("BURST NWAL Fast send %d pkts. metadata=%d Cmd Label Creation Cost=%d nwal Fast Send Cost= %d n_c_ops=%d cache_op_time=%d (pp-> %d)\n", + printf("BURST NWAL Fast send %d pkts. metadata=%d Cmd Label Creation Cost=%d nwal Fast Send Cost (less cacheop)= %d n_c_ops=%d cache_op_time=%d (pp-> %d)\n", stats.itx, sum_vv1/stats.itx, nwal_sum_flow_vv2, sum_vv3/stats.itx, n_c_ops, ccycles, n_c_ops? (ccycles/(n_c_ops/2)) : 0); - +#if 0 printf("NWAL Profile Cycles: Prof1= %d,Prof2=%d,Prof3=%d,Prof4=%d,Prof5=%d ,Prof6=%d \n", nwal_sum_vv1/stats.itx,nwal_sum_vv2/stats.itx,nwal_sum_vv3/stats.itx, nwal_sum_vv4/stats.itx,nwal_sum_vv5/stats.itx,nwal_sum_vv6/stats.itx); - + +#endif if(stats.itx2) { @@ -1541,6 +1560,7 @@ printf("net_test> %d bytes left in our CMA area\n", netapi_getBufMemRemainder()) our_sched =netapi_schedOpen(netapi_handle,&our_sched_cfg, &err); if (!our_sched) {printf("sched create failed\n"); exit(1);} +#if 0 /******************************************** * Basic pkt loopback test *********************************************/ @@ -1551,6 +1571,7 @@ our_pktio_bench(1000); our_pktio_bench(1000); our_pktio_bench(1000); /*********************************************/ +#endif @@ -1753,12 +1774,13 @@ if (err!=0) {printf("stats req failed\n");} /*********************************************/ +#if 0 /******************************************** * Basic pkt loopback test *********************************************/ printf("...runnining pure push/pop benchmark\n"); our_pktio_bench(100); - +#endif /**************unused stuff******************/ /* create TRIE */ @@ -1791,7 +1813,8 @@ our_stats_cb(netapi_handle, NULL); #define DO_FAST_POLL #ifdef DO_FAST_POLL -example_fast_poll(netcp_rx_chan); +example_fast_pushpop(OurHeap, 500); +example_fast_poll(netcp_rx_chan,100000); #endif /************************************************* @@ -1854,13 +1877,73 @@ static int l3_off[M], l4_off[M], L3_chk_ok[M], L4_chk_ok[M], len[M] ; static nwal_AppId appid[M]; static unsigned char * buf[M]; #define N2POLL 8 //batch size -void example_fast_poll( PKTIO_HANDLE_T * p_pktio) +#define NTOPOP 190 +Ti_Pkt * pHd[NTOPOP]; +void example_fast_pushpop(Pktlib_HeapHandle h , int n_trials) +{ +int i,j; +unsigned long t1; +unsigned long t2; +unsigned long sumf=0; +unsigned long sumt=0; +unsigned long sump=0; +#define NTOPOP 190 +Ti_Pkt * tempVA; +Qmss_QueueHnd freeQ=Pktlib_getInternalHeapQueue(h); + +//n_trials of NTOPOP actions +for(i=0;iorigBuffPtr - + ((Cppi_HostDesc *) tempVA)->buffPtr); + } + tempVA = _Osal_qmssPhyToVirt(pHd[j-1]); + sumf+= (int) ( ((Cppi_HostDesc *) tempVA)->origBuffPtr - + ((Cppi_HostDesc *) tempVA)->buffPtr); + t2=netapi_timing_stop(); + sumt+= (t2-t1); + + //invalidate/wb + for(j=0;j0;) { t1= netapi_timing_stop(); pHd[0] = (Ti_Pkt *)QMSS_DESC_PTR(PKTIO_QMSS_QUEUE_POP_RAW (rxQ)); @@ -1975,6 +2058,8 @@ for(;;) } sumt += (t2-t1); sump +=(pHd[i-1]? i: (i-1)); + max_pkts -= (pHd[i-1]? i: (i-1)); + //printf("end cleanup %d %d %d\n",sumt,sumf,sump ); if (sump > 10000) { printf("pkts rx %d batches=%d appid=%x l3_off=%d l4_off=%d len=%d buf=0x%x rxcycle= %d pkts/batchx1000=%d maxbatch=%d cycles per rawpush = %d\n", -- 2.39.2