changes for ifdma mode. some fixes to previous merge
authorDavid Lide <a0216552@gtudci01.(none)>
Fri, 22 Feb 2013 22:33:24 +0000 (17:33 -0500)
committerDavid Lide <a0216552@gtudci01.(none)>
Fri, 22 Feb 2013 22:33:24 +0000 (17:33 -0500)
ti/runtime/netapi/src/pktio.c

index 33d70a1662d7a9fae191c318889e5eb6f78f5b33..3c40a53f5e3f4e81831117dd3a26c82622041fd7 100755 (executable)
@@ -117,6 +117,12 @@ static int netapip_pktioSendL4CkSumCryptPort(struct PKTIO_HANDLE_tag * pp,
                                   pPloadDesc,
                                   NWAL_DESC_SIZE);
     }
+    else
+    {
+          *err=NETAPI_ERR_BAD_INPUT;
+          return -1;
+    }
+
     return 1;
 }
 
@@ -157,6 +163,12 @@ static int netapip_pktioSendCryptPort(struct PKTIO_HANDLE_tag * pp,
                                   pPloadDesc,
                                   NWAL_DESC_SIZE);
     }
+    else
+    {
+          *err=NETAPI_ERR_BAD_INPUT;
+          return -1;
+    }
+
     return 1;
 }
 
@@ -202,6 +214,12 @@ static int netapip_pktioSendL4CkSumAHCryptPort(struct PKTIO_HANDLE_tag * pp,
                                   pPloadDesc,
                                   NWAL_DESC_SIZE);
     }
+    else
+    {
+          *err=NETAPI_ERR_BAD_INPUT;
+          return -1;
+    }
+
     return 1;
 }
 
@@ -244,6 +262,11 @@ static int netapip_pktioSendAHCryptPort(struct PKTIO_HANDLE_tag * pp,
                                   pPloadDesc,
                                   NWAL_DESC_SIZE);
     }
+    else
+    {
+       *err= NETAPI_ERR_BAD_INPUT;
+       return -1;
+    }
     return 1;
 }
 
@@ -342,6 +365,7 @@ static int netapip_pktioSendNwal(struct PKTIO_HANDLE_tag * pp,
     if (res != nwal_OK)
     {
         *err = NETAPI_ERR_NWAL_TX_ERR -res;
+       return -1;
     }
     return 1;
 }
@@ -375,6 +399,11 @@ static int netapip_pktioSendSb(struct PKTIO_HANDLE_tag * pp,
         {
             dmPSCmdInfo->rxSbSaQ = rxQ;
         }
+       else 
+        {
+          *err=NETAPI_ERR_BAD_INPUT;
+          return -1;
+        }
         nwal_mCmdDMUpdate(pkt,
             dmPSCmdInfo,
             pPktInfoSB->appCtxId,
@@ -392,6 +421,11 @@ static int netapip_pktioSendSb(struct PKTIO_HANDLE_tag * pp,
                                              pPloadDesc,
                                              NWAL_DESC_SIZE); 
     }
+    else
+    {
+          *err=NETAPI_ERR_BAD_INPUT;
+          return -1;
+    }
     return 1;
 }
 
@@ -406,11 +440,16 @@ static int netapip_pktioSendIfdma(struct PKTIO_HANDLE_tag * pp,
                                  int * err)
 {
         Cppi_DescTag            tag={0};
+        Cppi_HostDesc*          pPloadDesc;
         PKTIO_HANDLE_T *p=(PKTIO_HANDLE_T*) pp;
         *err=0;
         tag.srcTagLo = m->u.tx_ifdma_dest;
         Cppi_setTag (Cppi_DescType_HOST, (Cppi_Desc *)pkt, &tag);
-        Qmss_queuePushDesc (p->q, (void*)pkt);
+        pPloadDesc = Pktlib_getDescFromPacket(pkt);
+        pPloadDesc = Qmss_osalConvertDescVirtToPhy(pPloadDesc);
+        Qmss_queuePushDescSizeRaw(p->q,
+                                  pPloadDesc,
+                                  NWAL_DESC_SIZE);
         return 1;
 }
 
@@ -615,8 +654,9 @@ PKTIO_HANDLE_T * netapi_pktioCreate(NETAPI_T n,
 
 
     /* create a  general queue */
-     p->q  = Qmss_queueOpen(Qmss_QueueType_GENERAL_PURPOSE_QUEUE,
-                       QMSS_PARAM_NOT_SPECIFIED, &isAllocated);
+     p->q  = Qmss_queueOpen(qtype,
+                                q, 
+                                &isAllocated);
     if (p->q == (Qmss_QueueHnd) NULL)
     {
         netapi_Log("netapi_pktioCreate:  queueOpen failed\n");
@@ -748,32 +788,6 @@ PKTIO_HANDLE_T * netapi_pktioOpen(NETAPI_T  n,
         if (!strcmp(name,NETCP_SB_RX)) p->_poll=netapip_pktioPollSb;
         if (!strcmp(name,NETCP_SB_TX)) p->_send=netapip_pktioSendSb;
     }
-#if 0
-    else if (!(strncmp(name,"NETCP_IFDMA:",strlen("NETCP_IFDMA:")) ) )
-    {
-        p_qnum = netapip_findGlobalPktio(n, name);
-        if (!p_qnum )
-        {
-            netapi_Log("pktio_open: can't find %s\n",name);
-            p->inuse=0;
-            *err= NETAPI_ERR_NOTFOUND;  ///queue lld error
-            return NULL;
-        }
-
-        p->q  = Qmss_queueOpen(Qmss_QueueType_INFRASTRUCTURE_QUEUE,
-                           p_qnum->qNum , &isAllocated);
-        if (p->q == (Qmss_QueueHnd) NULL)
-        {
-            netapi_Log("pktio_create:  queueOpen failed\n");
-            p->inuse=0;
-            *err= NETAPI_ERR_QLLD;  ///queue lld error
-            return NULL;
-        }
-        p->qInfo = Qmss_getQueueNumber(p->q);
-        p->_send= pktio_send_ifdma;
-        p->use_nwal = 0;
-    }
-#endif
     else
     {
         hplib_mSpinLockLock(&netapi_pktio_lock);