Fix for SDOCM00107104: NETAPI changes to support new mechanism for PA stats collectio...
authorTinku Mannan <tmannan@ti.com>
Mon, 24 Mar 2014 14:15:36 +0000 (10:15 -0400)
committerTinku Mannan <tmannan@ti.com>
Mon, 24 Mar 2014 14:15:36 +0000 (10:15 -0400)
ti/runtime/netapi/device/k2e/src/netapi_device.c
ti/runtime/netapi/device/k2h/src/netapi_device.c
ti/runtime/netapi/device/k2k/src/netapi_device.c
ti/runtime/netapi/device/k2l/src/netapi_device.c
ti/runtime/netapi/netcp_cfg.h
ti/runtime/netapi/src/netapi_loc.h
ti/runtime/netapi/src/netcp_cfg.c
ti/runtime/netapi/test/net_test_loopback.c

index 6f41107bbb20e10c08047b0deb59812085e1588c..313a2af5b578cee15d4ad5b57252885a7fc3806d 100755 (executable)
@@ -58,6 +58,7 @@
 /* NETPAPI initialization parameters */
 NETCP_CFG_GLOB_DEVICE_PARAMS_T netapiDeviceGblCfgParam =
 {
+    NWAL_CFG_NSS_GEN2,
     CSL_NETCP_CFG_REGS,
     CSL_QMSS_CFG_BASE,
     CSL_QMSS_DATA_BASE
index abd353de2733a3aaa28687847186d8a5780dbfcb..d1ebf0111d706bc3919dc759391bab884f4f5ec6 100755 (executable)
@@ -56,6 +56,7 @@
 /* NETPAPI initialization parameters */
 NETCP_CFG_GLOB_DEVICE_PARAMS_T netapiDeviceGblCfgParam =
 {
+    NWAL_CFG_NSS_GEN1,
     CSL_NETCP_CFG_REGS,
     CSL_QMSS_CFG_BASE,
     CSL_QMSS_DATA_BASE
index abd353de2733a3aaa28687847186d8a5780dbfcb..d1ebf0111d706bc3919dc759391bab884f4f5ec6 100755 (executable)
@@ -56,6 +56,7 @@
 /* NETPAPI initialization parameters */
 NETCP_CFG_GLOB_DEVICE_PARAMS_T netapiDeviceGblCfgParam =
 {
+    NWAL_CFG_NSS_GEN1,
     CSL_NETCP_CFG_REGS,
     CSL_QMSS_CFG_BASE,
     CSL_QMSS_DATA_BASE
index abd353de2733a3aaa28687847186d8a5780dbfcb..bfdcdf44c551d3b3f0fec38eb2010287c43be0f6 100755 (executable)
@@ -56,6 +56,7 @@
 /* NETPAPI initialization parameters */
 NETCP_CFG_GLOB_DEVICE_PARAMS_T netapiDeviceGblCfgParam =
 {
+    NWAL_CFG_NSS_GEN2,
     CSL_NETCP_CFG_REGS,
     CSL_QMSS_CFG_BASE,
     CSL_QMSS_DATA_BASE
index ff1c6b3ed4b4cdefa22705e00f782b475fce1453..a950add79186faeb3d87a27ab6e9e88ce21309ac 100755 (executable)
@@ -499,6 +499,7 @@ typedef struct NETCP_CFG_FLOW_CONFIG_Tag
  */
 typedef struct NETCP_CFG_GLOB_DEVICE_PARAMS_Tag
 {
+    uint32_t    nssGen;             /**< Generation of Network Subsystem, 1.0 or 1.5*/
     uint32_t    cslNetCpCfgRegs;    /**< Base address of NETCP configuration Registers */
     uint32_t    cslQmssCfgBase;     /**< Base address of QMSS configuration Registers */
     uint32_t    cslQmssDataBase;    /**< Base address of QMSS Data Registers */
index d3dd9026f35e04eee236212b7797a95abd7b8df5..1cad2e8c0763a4ab5051fba608d8852a2e94a024 100755 (executable)
@@ -228,8 +228,9 @@ typedef struct NETAPI_HANDLE_Tag
     NETAPI_NWAL_LOCAL_CONTEXT_T nwal_local;
 
     /* thread cookie */
-    void*                       cookie;  /*set by calling thread */
+    void*                      cookie;  /*set by calling thread */
     HPLIB_SPINLOCK_IF_T        spinLock;
+    uint32_t                   nssGen;
 } NETAPI_HANDLE_T;
 
 typedef struct NETAPI_SHM_Tag
index c9443da5a43e255e769b2c4caeecf886522b1eaa..5c58d7896bb89ae307fde0dc1f3d5f2598f89078 100755 (executable)
@@ -727,12 +727,14 @@ static void *netapip_netcpCfgGetL3Handle(NETAPI_NWAL_GLOBAL_CONTEXT_T *p,
 void netapi_netcpCfgReqStats(NETAPI_T  h, 
                              NETCP_CFG_STATS_CB cb,
                              int doClear,
-                             int *err) 
+                             int *err)
 {
     nwal_RetValue ret;
     NETAPI_HANDLE_T * n = (NETAPI_HANDLE_T *) h;
     NetapiNwalTransInfo_t *pTransInfo;
     nwal_TransID_t     transId;
+
+    paSysStats_t netcp_stats;
     if ((!n) || (!cb))
     {
         *err = NETAPI_ERR_BAD_INPUT;
@@ -747,16 +749,24 @@ void netapi_netcpCfgReqStats(NETAPI_T  h,
     pTransInfo->transType = NETAPI_NWAL_HANDLE_STAT_REQUEST;
     pTransInfo->netapi_handle = h;
     n->nwal_local.stats_cb = cb;
+
+    memset(&netcp_stats, 0, sizeof(paSysStats_t));
     ret = nwal_getPAStats( ((NETAPI_GLOBAL_T *) n->global)->nwal_context.nwalInstHandle,
                               transId,
-                              NULL,
+                              &netcp_stats,
                               doClear);
     if(ret !=  nwal_OK)
     {
-        //pTransInfo->inUse = nwal_FALSE;
         *err = NETAPI_ERR_BUSY;  //no resources??
         netapi_Log("> netapi_netcpCfg reqStats failed, err=%d\n",ret);
+        netapip_freeTransInfo(pTransInfo);
+        return;
+    }
+    if((n->nssGen == NWAL_CFG_NSS_GEN2) && (cb))
+    {
+        cb(h, &netcp_stats);
     }
+
     netapip_freeTransInfo(pTransInfo);
 }
 /********************************************************************
@@ -1847,7 +1857,6 @@ NETCP_CFG_EXCEPTION_PKT_T netapi_netcpCfgExceptions(NETAPI_T
     nwal_RetValue retVal = 0;
     memset(&ctrl, 0, sizeof(nwalCtlInfo_t));
 
-
     if (p_route != NULL)
     {
         if((p_route->valid_params & NETCP_CFG_VALID_PARAM_ROUTE_TYPE) ==
@@ -1884,8 +1893,8 @@ NETCP_CFG_EXCEPTION_PKT_T netapi_netcpCfgExceptions(NETAPI_T
 
     retVal = nwal_control(((NETAPI_GLOBAL_T*) (n->global))->nwal_context.nwalInstHandle, &ctrl);
 
-    return (NETCP_CFG_EXCEPTION_PKT_T) ctrl.appId;
 
+    return (NETCP_CFG_EXCEPTION_PKT_T) ctrl.appId;
 }
 
 /*************************************************************************/
index 101153ef8d3ba44f0e331c42f73a8b8dba2e0252..285859f7dee3ee103ac4de79d0533bb0cf0a5098 100755 (executable)
@@ -283,7 +283,6 @@ int coreid=0;
             //memcpy(&p_pkt[netTest_MAC_HEADER_LEN+20+2],&new_dest_port[0],2);
             memcpy(&p_pkt[netTest_MAC_HEADER_LEN+netTest_IP_HEADER_LEN+2],&dest_udp_port_config,2);
         }
-
         memset(&p_pkt[netTest_MAC_HEADER_LEN+netTest_IP_HEADER_LEN+6],0,2);//0 udp checksum (we will compute on way out)
     }
 
@@ -525,7 +524,8 @@ void recv_sb_cb(struct PKTIO_HANDLE_Tag * channel, Ti_Pkt* p_recv[],
 
                 /* post it to netcp tx channel*/
                 meta2.u.tx_meta=&meta_tx;
-                netapi_pktioSend(netcp_tx_chan_esp,tip,&meta2,&err);
+                netapi_pktioSend(netcp_tx_chan_no_crypto,tip,&meta2,&err);
+                //netapi_pktioSend(netcp_tx_chan_esp,tip,&meta2,&err);
                 hplib_cacheWbInv(p_pkt,len);
                 stats[coreid].tx +=1;
             }