]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/commitdiff
Updated comments
authorRaghu Nambiath <rnambiath@ti.com>
Wed, 27 Jun 2012 17:38:35 +0000 (13:38 -0400)
committerRaghu Nambiath <rnambiath@ti.com>
Wed, 27 Jun 2012 17:38:35 +0000 (13:38 -0400)
Removed pktIO helper functions and use NWAL TX and RX directly
Update of OSAL to include invalidate during POP

ti/runtime/netapi/netapi.h
ti/runtime/netapi/netapi_tune.h
ti/runtime/netapi/pktio.h
ti/runtime/netapi/src/osal.c
ti/runtime/netapi/test/net_test.c

index 98aa13407dbd2289859c60cd607b321b92209e9d..322628bdf37b1ec0afc58971b26c8ae9f760b2b7 100755 (executable)
@@ -136,20 +136,28 @@ typedef struct NETAPI_CFG_Tag
 }NETAPI_CFG_T;
 /* note:
    each buffer will be allocated:  def_heap_buf_size+def_heap_extra_size bytes
-   each descriptor attached to these buffers will have original_pkt_len of:
+   each descriptor attached to these buffers will have rigBufferLen of:
       def_heap_buf_size.
    for default RX flow,  for rx packet, the bufptr  will be def_flow_pkt_rx_offset.
    for detault RX flow,  threshold (ie max # of bytes in buffer) will be:
        def_heap_buf_size - def_heap_tailroom_size-def_flow_pkt_rx_offset
 
-Origbuffptr
-|
+
+ RX Packet from NetCP
+
+Headroom [Application]     Packet [HW]               Tailroom [Application]    Extra Space [Application]
+<-----------------------><--------------------------><------------------------><----------------------->
+
+Cppi_HostDesc->origBufferLen
+<----------------------------------------------------------------------------->
+Cppi_HostDesc->origBuffPtr
+|                       
 \/
-|------------orig_buf_len---------------.----|----extra_size---|
-|…rx_offset…..|……………buf_len…………..| def_tail--|----extra  size-.|
-                           ^
-                           |
-                       buffPtr
+|------------def_heap_buf_size-------------------------------------------------|--def_heap_extra_size--|
+| def_flow_pkt_rx_offset| max Cppi_HostDesc->buffLen | def_heap_tailroom_size  |   Extra Size          |
+                        ^
+                        |
+                     Cppi_HostDesc->buffPtr
 
 
 */
index b469431053cb98b6a7e6063312ebde59f326e0c4..d6e133bb64b8daa5c051d2633ddb476d42e5969c 100755 (executable)
@@ -87,8 +87,9 @@
 /**
  *  @def TUNE_NETAPI_PERM_MEM_SZ
  * (1) how much contiguous memory to grab. This is used for
- * descriptors and buffers.  Can't be bigger than CMA memory area (or msmc if
- * we are using uncached .  This can be set at netapi_init via NETAPI_CFG_T
+ * descriptors and buffers in the case of uncached configuration only.  
+ * descriptors and buffers.  Can't be bigger than  msmc if
+ * MSMC memory is being using uncached .  This can be set at netapi_init via NETAPI_CFG_T
  */
 #define TUNE_NETAPI_PERM_MEM_SZ   (2*1024*1024) 
 
index 65247d5e797affe031413cb1f0990465eafd16d1..48b6966f622d0cb844e21f0857cf1f845b63f010 100755 (executable)
@@ -361,52 +361,6 @@ static inline nwal_Inst PKTIO_GET_NWAL_INSTANCE(PKTIO_HANDLE_T *h)
 {
 return h->nwalInstanceHandle;
 }
-/* find pointer to proto info fields in descriptor */
-static inline pasahoLongInfo_t* PKTIO_GET_PROTO_INFO( Ti_Pkt * pkt)
-{
-   uint32_t TEMPdataLen;
-   return (pasahoLongInfo_t *) nwalCppi_getPSData ( Cppi_DescType_HOST,Cppi_PSLoc_PS_IN_DESC , (Cppi_Desc *)pkt, &TEMPdataLen);
-}
-
-/** "p" below is return of PKTIO_GET_PROTO_INFO() above**/
-
-/* offset to L3 header */
-#define PKTIO_GET_L3_OFFSET(p)  PASAHO_LINFO_READ_L3_OFFSET(p)
-
-/* offset to L4 header */
-#define PKTIO_GET_L4_OFFSET(p)  PASAHO_LINFO_READ_L4_OFFSET(p)
-
-/* next proto header */
-#define PKTIO_GET_NEXT_HEADER_TYPE(P) PASAHO_LINFO_READ_NXT_HDR_TYPE(p)
-
-/* offset to L4 payload */
-#define PKTIO_GET_L5_OFFSET(p)  PASAHO_LINFO_READ_L5_OFFSET(p)
 
-/* end of L4 payload */
-#define PKTIO_GET_PAYLOAD_END(p) PASAHO_LINFO_READ_END_OFFSET(p)
-
-/* IPSEC ESP done ? */
-#define PKTIO_ESP_DONE(p) PASAHO_LINFO_IS_IPSEC_ESP(p)
-
-/* IPSEC ESP done ? */
-#define PKTIO_AH_DONE(p) PASAHO_LINFO_IS_IPSEC_AH(p)
-
-/* MAC info */
-#define PKTIO_IS_MAC_BROADCAST(p)    PASAHO_READ_BITFIELD(p)
-#define PKTIO_IS_MAC_MULTICAST(p)    PASAHO_READ_BITFIELD(p)
-#define PKTIO_GET_MAC_TYPE(p)        PASAHO_LINFO_READ_MAC_PKTTYPE(p)
-
-/* read input port */
-#define PKTIO_GET_INPUT_PORT(p) PASAHO_LINFO_READ_INPORT(p) 
-
-/* AppId */
-static inline unsigned int PKTIO_GET_APPID( Ti_Pkt * pkt) 
-{
-unsigned char * p_swinfo0;
-Cppi_getSoftwareInfo (Cppi_DescType_HOST,
-                     (Cppi_Desc *)pkt,
-                      &p_swinfo0);
-return *((unsigned int *)p_swinfo0);
-} 
 
 #endif
index 9458362cdf1e302a81e7d698be3aad5da74c8c5f..ddf22d0c5cf65661369b185f44c0d9523b5a8c37 100755 (executable)
@@ -239,8 +239,7 @@ static inline void Osal_invalidateCache (void *blockPtr, uint32_t size)
      
     v1= netapi_timing_stop();
     if ((blockPtr <netapi_VM_mem_start)||( blockPtr>netapi_VM_mem_end)) return;
-    //netapi_utilCacheInv(blockPtr, size);
-    netapi_utilCacheInv(Osal_saGetSCPhyAddr(blockPtr), size);
+    _netapi_utilCacheInv(blockPtr, size);
     v2= netapi_timing_stop();
     cache_op_cycles += (v2-v1); 
     n_cache_op_cycles+=1;
@@ -266,14 +265,10 @@ static inline void Osal_writeBackCache (void *blockPtr, uint32_t size)
      
     v1= netapi_timing_stop();
     if (((uint8_t*)blockPtr <netapi_VM_mem_start)||( (uint8_t*)blockPtr>netapi_VM_mem_end)) return;
-    //netapi_utilCacheWbInv(blockPtr, size);
-    //printf("osal> wbiv %x %x %d ..",  blockPtr, Osal_saGetSCPhyAddr(blockPtr), size);
-    //_netapi_utilCacheWbInv(blockPtr, size);
-    netapi_utilCacheWb(blockPtr, size);
+    _netapi_utilCacheWb(blockPtr, size);
     v2= netapi_timing_stop();
     cache_op_cycles += (v2-v1); 
     n_cache_op_cycles+=1;
-    //printf("done\n"); sleep(1);
 #endif
     return;
 }
@@ -715,12 +710,12 @@ void* Osal_qmssConvertDescPhyToVirt(void *descAddr)
         Cppi_HostDesc *nextBDPtr = (Cppi_HostDesc *)QMSS_DESC_PTR(descAddr);
         while (nextBDPtr)
         {
-            //Osal_invalidateCache(nextBDPtr, TUNE_NETAPI_DESC_SIZE);
+            Osal_invalidateCache(nextBDPtr, TUNE_NETAPI_DESC_SIZE);
             if (nextBDPtr->buffPtr)
             {
                 nextBDPtr->buffPtr = (uint32_t)_Osal_qmssPhyToVirt((void *)(nextBDPtr->buffPtr));
                 if (!(nextBDPtr->buffPtr)) return (void *)0;
-                //Osal_invalidateCache((void *)(nextBDPtr->buffPtr), nextBDPtr->buffLen);
+                Osal_invalidateCache((void *)(nextBDPtr->buffPtr), nextBDPtr->buffLen);
             }
 
             if (nextBDPtr->origBuffPtr)
@@ -743,7 +738,7 @@ void* Osal_qmssConvertDescPhyToVirt(void *descAddr)
     {
         descAddr = _Osal_qmssPhyToVirt(descAddr);
         if (!descAddr) return (void *)0;
-        //Osal_invalidateCache(descAddr, TUNE_NETAPI_DESC_SIZE);
+        Osal_invalidateCache(descAddr, TUNE_NETAPI_DESC_SIZE);
     }
 #endif
     return descAddr;
index a448ce4a5375289da4738ad8539b5f65e5b2a6fb..15ba20ca2e54d584459e6fea5b8f6f0aa4bde206 100644 (file)
@@ -1892,10 +1892,13 @@ for(;;)
 #if 1   
         /* extract some meta data */
         Cppi_getData (Cppi_DescType_HOST, (Cppi_Desc*)tempVA, &buf[jj], &len[jj]);
-        pinfo =  PKTIO_GET_PROTO_INFO(tempVA);
-        l3_off[jj]= PKTIO_GET_L3_OFFSET(pinfo);
-        l4_off[jj]= PKTIO_GET_L4_OFFSET(pinfo);
-        appid[jj]= PKTIO_GET_APPID(tempVA);
+        pinfo =  nwal_mGetProtoInfo(tempVA);
+        l3_off[jj]= nwal_mGetL3OffBytes(pinfo);
+        l4_off[jj]= nwal_mGetL4Offset(pinfo);
+        if(nwal_mGetAppidFmPkt(tempVA,&appid[jj]) != nwal_TRUE)
+        {
+            printf("ERROR!!!! AppID not available in incoming packet \n");
+        }
 //#define VERIFY_SOP
 #ifdef VERIFY_SOP
   if (sump < 200)  printf("..sop off=%d\n", (int) buf[jj]-
@@ -1912,10 +1915,13 @@ for(;;)
 
         /* extract some meta data */
 #if 1
-        pinfo =  PKTIO_GET_PROTO_INFO(tempVA);
-        l3_off[jj]= PKTIO_GET_L3_OFFSET(pinfo);
-        l4_off[jj]= PKTIO_GET_L4_OFFSET(pinfo);
-        appid[jj]= PKTIO_GET_APPID(tempVA);
+        pinfo =  nwal_mGetProtoInfo(tempVA);
+        l3_off[jj]= nwal_mGetL3OffBytes(pinfo);
+        l4_off[jj]= nwal_mGetL4Offset(pinfo);
+        if(nwal_mGetAppidFmPkt(tempVA,&appid[jj]) != nwal_TRUE)
+        {
+            printf("ERROR!!!! AppID not available in incoming packet \n");
+        }
 #endif
         //get ptr (Physical address) and length of associate buffer
         Cppi_getData (Cppi_DescType_HOST, (Cppi_Desc*)tempVA, &buf[jj], &len[jj]);