Added net_test side band mode low level API changes, removed udpif test application...
authorTinku Mannan <tmannan@ti.com>
Fri, 28 Sep 2012 11:50:33 +0000 (07:50 -0400)
committerTinku Mannan <tmannan@ti.com>
Fri, 28 Sep 2012 11:50:33 +0000 (07:50 -0400)
ti/runtime/netapi/test/build/Makefile
ti/runtime/netapi/test/net_test.c
ti/runtime/netapi/test/net_test.h
ti/runtime/netapi/test/udpif.c [deleted file]

index 6519591df9d35bc379a0dd933e2d4d4c6fc98965..2e6f637cb3deca04c7a0f0d8e77386482af30115 100755 (executable)
@@ -46,7 +46,7 @@ INTERNALLINKDEFS = --start-group -L$(ARMV7LIBDIR) -L$(PDK_ARMV7LIBDIR) $(NETAPI_
 
 all: tests 
 
-tests: $(ARMV7BINDIR)/netapi/test/.created $(ARMV7BINDIR)/netapi/test/net_test $(ARMV7BINDIR)/netapi/test/synchtest $(ARMV7BINDIR)/netapi/test/synchtest2 $(ARMV7BINDIR)/netapi/test/udpif  
+tests: $(ARMV7BINDIR)/netapi/test/.created $(ARMV7BINDIR)/netapi/test/net_test $(ARMV7BINDIR)/netapi/test/synchtest $(ARMV7BINDIR)/netapi/test/synchtest2 
 
 api_clean:
        rm -f  $(ARMV7LIBDIR)/libnetapi.a
@@ -55,7 +55,7 @@ api_clean:
 clean: 
        rm -f $(ARMV7OBJDIR)/netapi/test/*.o
        rm -f $(ARMV7LIBDIR)/libnetapi.a
-       rm -f $(ARMV7BINDIR)/netapi/test/net_test $(ARMV7BINDIR)/netapi/test/synchtest $(ARMV7BINDIR)/netapi/test/synchtest2 $(ARMV7BINDIR)/netapi/test/udpif
+       rm -f $(ARMV7BINDIR)/netapi/test/net_test $(ARMV7BINDIR)/netapi/test/synchtest $(ARMV7BINDIR)/netapi/test/synchtest2
 
 
 $(ARMV7OBJDIR)/netapi/test/%.o:$(NETAPI_INC_DIR)/test/%.c $(ARMV7OBJDIR)/netapi/test/.created
@@ -81,5 +81,3 @@ $(ARMV7BINDIR)/netapi/test/synchtest: $(ARMV7OBJDIR)/netapi/test/synchtest.o
 $(ARMV7BINDIR)/netapi/test/synchtest2: $(ARMV7OBJDIR)/netapi/test/synchtest2.o
        $(CC) $(LDFLAGS) $(ARMV7OBJDIR)/netapi/test/synchtest2.o -o $(ARMV7BINDIR)/netapi/test/synchtest2 -lpthread
 
-$(ARMV7BINDIR)/netapi/test/udpif: $(ARMV7OBJDIR)/netapi/test/udpif.o
-       $(CC) $(LDFLAGS) $(ARMV7OBJDIR)/netapi/test/udpif.o -o $(ARMV7BINDIR)/netapi/test/udpif
index bf1794bdf1a618b98f486f1f7d43c48f282614c9..e3bcd93af9ee6d94f5e35f33322cc211864e51b6 100755 (executable)
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
  *****************************************/
+#define NET_TEST_ENABLE_SIDE_BAND_LOW_LEVEL_API
+#ifdef NET_TEST_ENABLE_SIDE_BAND_LOW_LEVEL_API
+#define NWAL_ENABLE_SA
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/resource.h>
 #include "net_test.h"
 #include <ti/drv/sa/salld.h>
-#define EXPERIMENTAL
+//#define EXPERIMENTAL
 #ifdef EXPERIMENTAL
 #include "router.c"
 Trie * our_router;
 
+
+
+
 OUR_ROUTE_T routes[MAX_ROUTES]=
 {
 {0,{0xD4,0xbe,0xd9,0x00,0xd3,0x7e, 0x00,0x01,0x02,0x03,0x14,0x02,0x08,0x00},0},
@@ -97,6 +104,7 @@ void dump_header(unsigned long *p, int n, int a, int r)
 #define TX_BURST 700 
 int pktloopback=TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK;
 nwalTxPSCmdInfo_t   flowPSCmdInfo;
+nwal_RetValue       nwalRetVal;
 
 //this device: 10.0.0.100, mac 0x,01,02,03,04,05  and .. 0x6
 
@@ -348,7 +356,7 @@ NETCP_CFG_CLASSIFIER_T class_2_cfg=
 PKTIO_CONTROL_T zap_channel_control={PKTIO_CLEAR, NULL};
 
 /* security objects. (for loopback mode) */
-netTestSA_t sa_info[6];
+netTestSA_t sa_info[4];
 int netapi_algorithm_set = 0;
 int netapi_sec_sa_mode = 2;
 /* tmannan-end */
@@ -889,6 +897,7 @@ uint16_t i=1;   /* for testing only */
 uint8_t *p_spi; 
 netTestSA_t * p_sa_info;
 uint8_t p_iv[16];
+Cppi_HostDesc*          pPloadDesc;
 
 Pktlib_setPacketLen(tip,len);
 //mac
@@ -983,7 +992,6 @@ if (flag)
            meta.sa_handle=p_sa_info->tx_data_mode_handle;  //use TX SA context
 
 #if 0
-           meta_tx.ploadLen = len;
 
            meta_tx.encOffset =p_sa_info->tx_payload_info.encOffset;
            
@@ -994,23 +1002,19 @@ if (flag)
            
            //meta_tx.authSize= len -14-20-12;
            meta_tx.authSize = len - meta_tx.authOffset - netTest_ICV_LEN;
-           //meta_tx.encIvSize=16;
-           meta_tx.encIvSize = p_sa_info->tx_payload_info.encIvSize;
            //meta_tx.pEncIV= &p_pkt[14+20+8];  //just use same IV..
 #endif
             memcpy(&meta_tx, &(p_sa_info->tx_payload_info), sizeof(nwalDmTxPayloadInfo_t));
 
-           meta_tx.ploadLen = len;
+          
            meta_tx.encSize = len - p_sa_info->tx_payload_info.encOffset -netTest_ICV_LEN;
            meta_tx.authSize = len - meta_tx.authOffset - netTest_ICV_LEN;
 
-           meta_tx.encIvSize = p_sa_info->tx_payload_info.encIvSize;
 #if 0
             printf("flip_and_send_pkt(): encOffset %d\n", meta_tx.encOffset);
             printf("flip_and_send_pkt():authOffset %d\n", meta_tx.authOffset);
             printf("flip_and_send_pkt(): encSize %d\n", meta_tx.encSize);
             printf("flip_and_send_pkt(): authSize %d\n", meta_tx.authSize);
-            printf("flip_and_send_pkt(): encIvSize %d\n", meta_tx.encIvSize);
 #endif
 
         if (p_sa_info->cipherMode ==  NWAL_SA_EALG_AES_CTR)
@@ -1031,14 +1035,34 @@ if (flag)
         {
             meta_tx.pEncIV = &p_pkt[netTest_MAC_HEADER_LEN +netTest_IP_HEADER_LEN + netTest_ESP_HEADER_LEN ];
         }
-           meta_tx.authIvSize=0;
            meta_tx.pAuthIV=NULL;
            meta_tx.aadSize=0;
            meta_tx.pAad=NULL;
            /* post it to netcp sb tx channel*/
-           meta_tx.appCtxId = netapi_timing_start();
+           meta_tx.appCtxId = (nwal_AppId)netapi_timing_start();
            meta.u.tx_sb_meta=&meta_tx;
+
+#ifdef NET_TEST_ENABLE_SIDE_BAND_LOW_LEVEL_API            
+           nwal_mCmdDMUpdate(tip,
+                              &p_sa_info->tx_dmPSCmdInfo,
+                              meta_tx.appCtxId,
+                              meta_tx.encOffset,
+                              meta_tx.encSize,
+                              meta_tx.pEncIV,
+                              meta_tx.authOffset,
+                              meta_tx.authSize,
+                              meta_tx.pAuthIV,
+                              meta_tx.aadSize,
+                              meta_tx.pAad);
+            pPloadDesc = Pktlib_getDescFromPacket(tip);
+            pPloadDesc = Qmss_osalConvertDescVirtToPhy(pPloadDesc);
+            Qmss_queuePushDescSizeRaw(p_sa_info->tx_dmPSCmdInfo.txQueue,
+                                       pPloadDesc,
+                                       NWAL_DESC_SIZE);
+
+#else
            pktio_send(netcp_sb_tx_chan,tip,&meta,&err);
+#endif
        }
 else
  {
@@ -1286,6 +1310,7 @@ HEAD_T temp_head;
 netTestSA_t *p_sa_info;
 uint8_t *p_spi;
 uint8_t p_iv[16];
+Cppi_HostDesc*          pPloadDesc;
 
     p_head=&temp_head;
 
@@ -1351,7 +1376,7 @@ uint8_t p_iv[16];
 
             //process IP SEC PACKET
         if (config.ipsec_mode_rx == IPSEC_MODE_RX_SIDEBAND)
-        {
+        {      
             p_spi = &(p_pkt[netTest_MAC_HEADER_LEN+netTest_IP_HEADER_LEN]);
             p_sa_info = (netTestSA_t *) trie_lookup(p_trie_sa, (char *)p_spi ,4);
             if (p_sa_info == NULL)
@@ -1359,6 +1384,7 @@ uint8_t p_iv[16];
                 printf("recv_cb(): trie_lookup() failed\n");
                 continue;
             }
+
            //ship to crypto for decrypt!!
            //12 byte auth tag
             PKTIO_METADATA_T meta2 = {PKTIO_META_SB_TX,{0},0};
@@ -1367,17 +1393,14 @@ uint8_t p_iv[16];
 
            memcpy(&meta_tx, &(p_sa_info->tx_payload_info), sizeof(nwalDmTxPayloadInfo_t));
 
-           meta_tx.ploadLen = len;
            meta_tx.encSize = len - p_sa_info->tx_payload_info.encOffset -netTest_ICV_LEN;
            meta_tx.authSize = len - meta_tx.authOffset - netTest_ICV_LEN;
 
-           meta_tx.encIvSize = p_sa_info->tx_payload_info.encIvSize;
 #if 0
             printf("recv_cb(): encOffset %d\n", meta_tx.encOffset);
             printf("recv_cb():authOffset %d\n", meta_tx.authOffset);
             printf("recv_cb(): encSize %d\n", meta_tx.encSize);
             printf("recv_cb(): authSize %d\n", meta_tx.authSize);
-            printf("recv_cb(): encIvSize %d\n", meta_tx.encIvSize);
 #endif
 
             if (p_sa_info->cipherMode ==  NWAL_SA_EALG_AES_CTR)
@@ -1398,12 +1421,32 @@ uint8_t p_iv[16];
             {
                 meta_tx.pEncIV = &p_pkt[netTest_MAC_HEADER_LEN +netTest_IP_HEADER_LEN + netTest_ESP_HEADER_LEN ];
             }
-            meta_tx.appCtxId = netapi_timing_start();
+            meta_tx.appCtxId = (nwal_AppId)netapi_timing_start();
             //printf("recv_cb appCtxId: %lu\n", meta_tx.appCtxId);
 
            /* post it to netcp sb tx channel*/
            meta2.u.tx_sb_meta=&meta_tx;
+#ifdef NET_TEST_ENABLE_SIDE_BAND_LOW_LEVEL_API            
+            nwal_mCmdDMUpdate(tip,
+                              &p_sa_info->rx_dmPSCmdInfo,
+                              meta_tx.appCtxId,
+                              meta_tx.encOffset,
+                              meta_tx.encSize,
+                              meta_tx.pEncIV,
+                              meta_tx.authOffset,
+                              meta_tx.authSize,
+                              meta_tx.pAuthIV,
+                              meta_tx.aadSize,
+                              meta_tx.pAad);
+             pPloadDesc = Pktlib_getDescFromPacket(tip);
+             pPloadDesc = Qmss_osalConvertDescVirtToPhy(pPloadDesc);
+             Qmss_queuePushDescSizeRaw(p_sa_info->tx_dmPSCmdInfo.txQueue,
+                                       pPloadDesc,
+                                       NWAL_DESC_SIZE);
+
+#else
            pktio_send(netcp_sb_tx_chan,tip,&meta2,&err);
+#endif
            continue;
         }
         else 
@@ -1661,40 +1704,37 @@ for(i=0;i<TUNE_NETAPI_CONFIG_MAX_SA_TO_PA_DESC;i++)
     for (i=0; i < 1;i++)
 #endif
     {
-        if (config.ipsec_mode_rx == IPSEC_MODE_RX_INFLOW)
+        /* Statistics for RX Tunnel */
+        memset(&netapi_sa_stats, 0, sizeof(netapi_sa_stats));
+        netapi_getSaStats(netapi_handle, sa_info[i].rx_tunnel, &netapi_sa_stats);
+        if (netapi_sa_stats.validParams & NETAPI_IPSEC_STAT_VALID)
         {
-            memset(&netapi_sa_stats, 0, sizeof(netapi_sa_stats));
-            netapi_getSaStats(netapi_handle, sa_info[i].rx_tunnel, &netapi_sa_stats);
-            if (netapi_sa_stats.mode_active & NETAPI_INFLOW_MODE_ACTIVE)
-                print_ipsec_stats(&(netapi_sa_stats.saIpsecStats), rx_sa[i].authMode, rx_sa[i].cipherMode);
+             print_ipsec_stats(&(netapi_sa_stats.saIpsecStats), 
+                                 rx_sa[i].authMode, 
+                                 rx_sa[i].cipherMode);
         }
-#if 0
-        else
+        if (netapi_sa_stats.validParams & NETAPI_SIDEBAND_DATA_MODE_STAT_VALID)
         {
-            memset(&netapi_sa_stats, 0, sizeof(netapi_sa_stats));
-            netapi_getSaStats(netapi_handle, sa_info[i].rx_tunnel, &netapi_sa_stats);
-             if (netapi_sa_stats.mode_active & NETAPI_SIDEBAND_MODE_ACTIVE)
-            print_datamode_stats(&(netapi_sa_stats.dataModeStats),rx_sa[i].authMode, rx_sa[i].cipherMode);
+            print_datamode_stats(&(netapi_sa_stats.dataModeStats),
+                                   rx_sa[i].authMode, 
+                                   rx_sa[i].cipherMode);
         }
-#endif
-
-        if (config.ipsec_mode_tx == IPSEC_MODE_TX_INFLOW)
+        
+        /* Statistics for TX Tunnel */
+        memset(&netapi_sa_stats, 0, sizeof(netapi_sa_stats));
+        netapi_getSaStats(netapi_handle, sa_info[i].tx_tunnel, &netapi_sa_stats);
+        if (netapi_sa_stats.validParams & NETAPI_IPSEC_STAT_VALID)
         {
-            memset(&netapi_sa_stats, 0, sizeof(netapi_sa_stats));
-            netapi_getSaStats(netapi_handle, sa_info[i].tx_tunnel, &netapi_sa_stats);
-             if (netapi_sa_stats.mode_active & NETAPI_INFLOW_MODE_ACTIVE)
-                print_ipsec_stats(&(netapi_sa_stats.saIpsecStats), tx_sa[i].authMode, tx_sa[i].cipherMode);
+             print_ipsec_stats(&(netapi_sa_stats.saIpsecStats), 
+                                 tx_sa[i].authMode, 
+                                 tx_sa[i].cipherMode);
         }
-#if 0
-        else
+        if (netapi_sa_stats.validParams & NETAPI_SIDEBAND_DATA_MODE_STAT_VALID)
         {
-            memset(&netapi_sa_stats, 0, sizeof(netapi_sa_stats));
-            netapi_getSaStats(netapi_handle, sa_info[i].tx_tunnel, &netapi_sa_stats);
-            if (netapi_sa_stats.mode_active & NETAPI_SIDEBAND_MODE_ACTIVE)
-                print_datamode_stats(&(netapi_sa_stats.dataModeStats),tx_sa[i].authMode, tx_sa[i].cipherMode);
+            print_datamode_stats(&(netapi_sa_stats.dataModeStats),
+                                   tx_sa[i].authMode, 
+                                   tx_sa[i].cipherMode);
         }
- #endif
-        
     }
 }
 
@@ -1904,10 +1944,8 @@ void  build_sa_db(int i)
         /* static configuration, will not change */
         sa_info[i].tx_payload_info.aadSize = 0;
         sa_info[i].tx_payload_info.pAad = NULL;
-        sa_info[i].tx_payload_info.authIvSize = 0;
         sa_info[i].tx_payload_info.pAuthIV = NULL;
-        sa_info[i].tx_payload_info.authOffset = netTest_MAC_HEADER_LEN  + netTest_IP_HEADER_LEN;        /*done: same for all cipher suites */
-        sa_info[i].tx_payload_info.encIvSize = netTest_AES_CBC_IV_LEN;
+        sa_info[i].tx_payload_info.authOffset = netTest_MAC_HEADER_LEN  + netTest_IP_HEADER_LEN;        /*done: same for all cipher suites */         
         sa_info[i].tx_payload_info.encOffset = netTest_MAC_HEADER_LEN +
                                                                      netTest_IP_HEADER_LEN +
                                                                     netTest_ESP_HEADER_LEN +
@@ -1918,9 +1956,8 @@ void  build_sa_db(int i)
         /* dynamic configuration, will  be calculated on the fly */
         sa_info[i].tx_payload_info.authSize = 0; /* pkt len - mac - ip -icv (12) */
         sa_info[i].tx_payload_info.encSize = 0;   /* authSize - esp header size (always 8 bytes) */
-        sa_info[i].tx_payload_info.ploadLen = 0;  /* will be packet length */
         sa_info[i].tx_payload_info.pEncIV = 0;
-       sa_info[i].tx_payload_info.pPkt = 0;     /* not being referenced in net_test */
+        sa_info[i].tx_payload_info.pPkt = 0;     /* not being referenced in net_test */
 
         sa_info[i].cipherMode = NWAL_SA_EALG_AES_CBC;
         sa_info[i].inner_ip_offset = sa_info[i].tx_payload_info.encOffset;
@@ -1955,10 +1992,8 @@ void  build_sa_db(int i)
         /* static configuration, will not change */
         sa_info[i].tx_payload_info.aadSize = 0;
         sa_info[i].tx_payload_info.pAad = NULL;
-        sa_info[i].tx_payload_info.authIvSize = 0;
         sa_info[i].tx_payload_info.pAuthIV = NULL;
         sa_info[i].tx_payload_info.authOffset = netTest_MAC_HEADER_LEN  + netTest_IP_HEADER_LEN;        /*done: same for all cipher suites */
-        sa_info[i].tx_payload_info.encIvSize = netTest_AES_CTR_IV_CONTEXT_LEN;
         sa_info[i].tx_payload_info.encOffset = netTest_MAC_HEADER_LEN +
                                                                      netTest_IP_HEADER_LEN +
                                                                     netTest_ESP_HEADER_LEN +
@@ -1970,7 +2005,6 @@ void  build_sa_db(int i)
         /* dynamic configuration, will  be calculated on the fly */
         sa_info[i].tx_payload_info.authSize = 0;
         sa_info[i].tx_payload_info.encSize = 0;
-        sa_info[i].tx_payload_info.ploadLen = 0;
         sa_info[i].tx_payload_info.pEncIV = 0;
         sa_info[i].tx_payload_info.pPkt = 0;
 
@@ -2006,10 +2040,8 @@ void  build_sa_db(int i)
         /* static configuration, will not change */
         sa_info[i].tx_payload_info.aadSize = 0;
         sa_info[i].tx_payload_info.pAad = NULL;
-        sa_info[i].tx_payload_info.authIvSize = 0;
         sa_info[i].tx_payload_info.pAuthIV = NULL;
         sa_info[i].tx_payload_info.authOffset = netTest_MAC_HEADER_LEN  + netTest_IP_HEADER_LEN;        /*done: same for all cipher suites */
-        sa_info[i].tx_payload_info.encIvSize = netTest_3DES_CBC_IV_LEN;
         sa_info[i].tx_payload_info.encOffset = netTest_MAC_HEADER_LEN +
                                                                      netTest_IP_HEADER_LEN +
                                                                     netTest_ESP_HEADER_LEN +
@@ -2018,7 +2050,6 @@ void  build_sa_db(int i)
         /* dynamic configuration, will  be calculated on the fly */
         sa_info[i].tx_payload_info.authSize = 0;
         sa_info[i].tx_payload_info.encSize = 0;
-        sa_info[i].tx_payload_info.ploadLen = 0;
         sa_info[i].tx_payload_info.pEncIV = 0;
         sa_info[i].tx_payload_info.pPkt = 0;
 
@@ -2054,10 +2085,8 @@ void  build_sa_db(int i)
         /* static configuration, will not change */
         sa_info[i].tx_payload_info.aadSize = 0;
         sa_info[i].tx_payload_info.pAad = NULL;
-        sa_info[i].tx_payload_info.authIvSize = 0;
         sa_info[i].tx_payload_info.pAuthIV = NULL;
         sa_info[i].tx_payload_info.authOffset = netTest_MAC_HEADER_LEN  + netTest_IP_HEADER_LEN;        /*done: same for all cipher suites */
-        sa_info[i].tx_payload_info.encIvSize = netTest_NULL_IV_LEN;
 
         sa_info[i].tx_payload_info.encOffset =         netTest_MAC_HEADER_LEN +
                                                                      netTest_IP_HEADER_LEN +
@@ -2075,7 +2104,6 @@ void  build_sa_db(int i)
         /* dynamic configuration, will  be calculated on the fly */
         sa_info[i].tx_payload_info.authSize = 0;
         sa_info[i].tx_payload_info.encSize = 0;
-        sa_info[i].tx_payload_info.ploadLen = 0;
         sa_info[i].tx_payload_info.pEncIV = 0;
         sa_info[i].tx_payload_info.pPkt = 0;
 
@@ -2634,21 +2662,38 @@ if (err) {printf("addclass2 failed %d\n",err); exit(1);}
             &err);
         if (err) {printf("addRxSa failed %d\n",err); exit(1);}
 
-    if (config.ipsec_mode_rx == IPSEC_MODE_RX_INFLOW)
+        if (config.ipsec_mode_rx == IPSEC_MODE_RX_INFLOW)
+        {
+            //assume inner and outer ip is the same
+            rx_policy[i]= netapi_secAddRxPolicy( netapi_handle,
+                             sa_info[i].rx_tunnel,  //link to tunnel above
+                             4,         //ipv4
+                             &config.remote_ipsec_ip, //src -> them
+                             &config.local_ipsec_ip,  //dst -> us
+                            NULL,  // no qualifiers
+                            NULL,  //default route
+                             &err);
+            if (err) {printf("addSaPolicy failed  %d, for index %d\n",err,i); exit(1);}
+        }
+        else 
+        {
+            rx_policy[i] = 0;
+             
+        }
+#ifdef NET_TEST_ENABLE_SIDE_BAND_LOW_LEVEL_API
+    /* Remember the NetCP Command Label so save cycles per Crypto 
+     * operation
+     * 
+     */
+    if(config.ipsec_mode_rx == IPSEC_MODE_RX_SIDEBAND)
     {
-        //assume inner and outer ip is the same
-        rx_policy[i]= netapi_secAddRxPolicy( netapi_handle,
-                         sa_info[i].rx_tunnel,  //link to tunnel above
-                         4,         //ipv4
-                         &config.remote_ipsec_ip, //src -> them
-                         &config.local_ipsec_ip,  //dst -> us
-                        NULL,  // no qualifiers
-                        NULL,  //default route
-                         &err);
-        if (err) {printf("addSaPolicy failed  %d, for index %d\n",err,i); exit(1);}
+            nwalRetVal =  
+            nwal_initDMPSCmdInfo(PKTIO_GET_NWAL_INSTANCE(netcp_sb_rx_chan),
+                                 sa_info[i].rx_data_mode_handle,
+                                 &sa_info[i].rx_dmPSCmdInfo);
     }
-    else 
-        rx_policy[i] = 0;
+
+#endif
     }
 
 //tx SA
@@ -2670,7 +2715,22 @@ if (err) {printf("addclass2 failed %d\n",err); exit(1);}
                 &err);
 if (err) {printf("addTxSa failed %d\n",err); exit(1);}
 
+#ifdef NET_TEST_ENABLE_SIDE_BAND_LOW_LEVEL_API
+    /* Remember the NetCP Command Label so save cycles per Crypto 
+     * operation
+     * 
+     */
+    if(config.ipsec_mode_tx == IPSEC_MODE_TX_SIDEBAND)
+    {
+            nwalRetVal =  
+            nwal_initDMPSCmdInfo(PKTIO_GET_NWAL_INSTANCE(netcp_sb_tx_chan),
+                                 sa_info[i].tx_data_mode_handle,
+                                 &sa_info[i].tx_dmPSCmdInfo);
     }
+
+#endif
+    }
+
 #ifdef TEST_TIMERS
 //timers
 ourTimerBlock = netapi_TimerGroupCreate(
index f537b94c7c2f4ec4dcf98ffde0842dc3d92781d4..4500846944c0fb5869de33767cdfc4f695801ea7 100755 (executable)
@@ -78,7 +78,6 @@
 
 
 
-
 #define MAX_ROUTES 16
 /* tmannan - begin */
 
@@ -102,6 +101,11 @@ typedef struct {
     unsigned int seq;  //BE
     int iv_len; //iv len (size of iv in pkt)
     int bl; //block len (for padding calc)
+#ifdef NET_TEST_ENABLE_SIDE_BAND_LOW_LEVEL_API
+   /* Save NETCP CMD details during create time */
+    nwalTxDmPSCmdInfo_t     rx_dmPSCmdInfo;
+    nwalTxDmPSCmdInfo_t     tx_dmPSCmdInfo;
+#endif
 } netTestSA_t;
 
 
diff --git a/ti/runtime/netapi/test/udpif.c b/ti/runtime/netapi/test/udpif.c
deleted file mode 100755 (executable)
index 0af9b15..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- *
- * udpIf.c - provides udp 
- *
- */
-//#define BENCHMARK
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/time.h>
-
-int nSent=0;
-
-#ifdef BENCHMARK
-struct timeval stime,mtime,etime;
-#endif
-
-#define SENDSZ 1396
-int SendSize=SENDSZ;
-
-#define MAIN_NEEDED
-#ifdef MAIN_NEEDED
-/******************************************************************************
-    main
-*******************************************************************************/
-/* argv[1] = S for Send, R for Receive
-   argv[2] = fileName
-   argv[3] = port
-   argv[4] = ipAddress
-   argv[5] = send size
-*/
-main(argc,argv)
-int argc;
-char **argv;
-{
-int  sending = 0;
-char fileName[256];
-int  port;
-char ipAddress[64];
-    if (argc < 4) 
-        {
-        printf ("usage:udpIf S|R fileName port [ipAddress] [send size]\n");
-        exit(-1);
-        }
-    sending = (*argv[1] == 'S') ? 1 : 0;
-    strcpy(fileName,argv[2]);
-    port = atoi(argv[3]);
-    if (argc >= 5)
-        strcpy(ipAddress,argv[4]);
-    else
-        strcpy(ipAddress,"");
-    if (argc ==6) SendSize=atoi(argv[5]);
-    if (SendSize > SENDSZ) SendSize=SENDSZ;
-    udpif(sending,fileName,port,ipAddress);
-}
-#endif
-char startstring[]="start";
-char endstring[]="done";
-/******************************************************************************
-    udpif
-*******************************************************************************/
-udpif(sending,fileName,port,ipAddress)
-int  sending;
-char *fileName;
-int  port;
-char *ipAddress;
-{
-struct sockaddr_in addr,fraddr;
-int    addrlen, fd, cnt;
-socklen_t fraddrlen;
-char message[SENDSZ+3];
-int  numTries = 0;
-#define MAX_TRIES 5
-int rc;
-int sstate=0;
-int total, rtotal;
-total=rtotal=0; 
-    if (sending)
-        {    
-        int inFile;
-        inFile = open(fileName,O_RDONLY);
-        if (inFile < 0)
-            {
-            printf ("Can't read %s in tcpIf\n",fileName);
-            exit(-1);
-            }
-        fd = socket(AF_INET, SOCK_DGRAM, 0);
-        printf ("socket is %d\n",fd);
-        if (fd < 0) 
-            {
-            perror("socket");
-            exit(1);
-            }
-        bzero(&addr, sizeof(addr));
-        addr.sin_family = AF_INET;
-        addr.sin_addr.s_addr = INADDR_ANY;
-        addr.sin_port = 0;
-        addrlen = sizeof(addr);
-        rc = bind(fd, &addr, sizeof(addr));
-        printf ("Sender:bind rc is %d\n",rc);
-        if (rc < 0) 
-            {
-            perror("bind");
-            exit(1);
-            }
-        addr.sin_addr.s_addr = inet_addr(ipAddress);
-        addr.sin_port = htons(port);
-        printf("dbg: %x %x\n", addr.sin_addr.s_addr, addr.sin_port);
-#ifdef BENCHMARK
-               sendto(fd,
-                     startstring,
-                     strlen(startstring)+1,
-                     0,&addr,sizeof(addr));
-#endif
-        while(1)
-            {
-            char *mPtr;
-            int len;
-            int count = read(inFile,message,/*4096*/ /*SENDSZ*/SendSize);
-#ifndef BENCHMARK
-            //printf ("Sender:in count is %d\n",count);
-#endif
-            if (count == 0) 
-                {
-                close(inFile);
-#ifdef BENCHMARK
-               sendto(fd,
-                     endstring,
-                     strlen(endstring)+1,
-                     0,&addr,sizeof(addr));
-                                     
- sendto(fd,
-                     endstring,
-                     strlen(endstring)+1,
-                     0,&addr,sizeof(addr));
- sendto(fd,
-                     endstring,
-                     strlen(endstring)+1,
-                     0,&addr,sizeof(addr));
-               printf("sending done %d\n",nSent);
-               sleep(1);
-#endif
-                printf("sending done %d\n",nSent);
-
-                break;
-                }
-            mPtr = message;
-            len = count==-1 ? 5: count;
-            do {
-                cnt = sendto(fd, 
-                     mPtr,
-                     len,
-                     0,&addr,sizeof(addr));
-#ifndef BENCHMARK
-               // printf ("Sender:sendto count is %d\n",cnt);
-#endif
-                if (cnt < 0) 
-                    {
-                    close(inFile);
-                    perror("sendto");
-                    exit(1);
-                    }
-                nSent+=1;
-                mPtr += cnt;
-                len -= cnt;
-                } while(len > 0);
-            }
-        } 
-    else 
-        { 
-        /* receive */
-        int outFile;
-        int newSocket;
-        int rc;
-        fd = socket(AF_INET, SOCK_DGRAM, 0);
-        printf ("socket is %d\n",fd);
-        if (fd < 0) 
-            {
-            perror("socket");
-            exit(1);
-            }
-        bzero(&addr, sizeof(addr));
-        addr.sin_family = AF_INET;
-        addr.sin_addr.s_addr = htonl(INADDR_ANY);
-        addr.sin_port = htons(port);
-        addrlen = sizeof(addr);
-        rc = bind(fd, &addr, sizeof(addr));
-        printf ("Receiver:bind is %d\n",rc);
-        if (rc < 0) 
-            {
-            perror("bind");
-            exit(1);
-            }
-        /*outFile = open(fileName,O_WRONLY | O_CREAT);
-        if (outFile < 0)
-            {
-            printf ("Can't write to %s in tcpIf\n",fileName);
-            exit(-1);
-            }*/
-       memset(&fraddr,0,sizeof(fraddr));
-       fraddr.sin_family= AF_INET;
-       fraddrlen = sizeof(fraddr); 
-#ifdef BENCHMARK
-        gettimeofday(&stime, 0                  );
-        printf("rcv start @ %d: %d\n",stime.tv_sec, stime.tv_usec);
-
-#endif
-       while(1)
-            {
-#ifdef BENCHMARK
-
-        gettimeofday(&mtime, 0                  );
-        if(rtotal >= 10000000) 
-        {
-        printf("rcv mtime @ %d: %d %d %d\n",mtime.tv_sec, mtime.tv_usec,total, rtotal);
-        rtotal=0;
-        }
-#endif
-            cnt = recvfrom(fd, 
-                       message, 
-                       sizeof(message), 
-                       0,
-                       NULL,
-                       &fraddrlen);
-            //printf ("Receiver:recv count = %d\n",cnt);
-            if (cnt == 0) 
-                {
-                /*close(outFile);*/
-                continue;
-                }
-            if (cnt < 0) 
-                {
-                /*close(outFile);*/
-                perror("recvfrom");
-                exit(1);
-                }
-           rtotal+=cnt;
-           total+=cnt;
-           message[cnt+1] = '\0';
-#ifndef BENCHMARK
-            printf("rcvd %s\n",message);
-#else
-            if (strcmp("done",message)==0)
-            {
-                time_t blah1;
-                suseconds_t blah2;
-                gettimeofday(&etime, 0                  );
-                blah1= (etime.tv_usec>stime.tv_usec) ?
-                               etime.tv_sec-stime.tv_sec :
-                               etime.tv_sec-stime.tv_sec-1;
-                blah2 = (etime.tv_usec>stime.tv_usec) ?
-                                     etime.tv_usec-stime.tv_usec :
-                                     1000000-stime.tv_usec+etime.tv_usec;
-                printf("DONE @ %d: %d {%d %d}\n",etime.tv_sec, etime.tv_usec,
-                                                 blah1, blah2 );
-                gettimeofday(&etime, 0                  );
-            }
-            if (strcmp("start",message)==0)
-            {
-                gettimeofday(&stime, 0                  );
-                printf("START @ %d: %d\n",stime.tv_sec, stime.tv_usec);
-            }
-
-#endif
-            }
-        }
-}