[keystone-rtos/netapi.git] / ti / runtime / netapi / applications / ipsec_offload / ipsecmgr / src / netapi_ipsecmgr.c
diff --git a/ti/runtime/netapi/applications/ipsec_offload/ipsecmgr/src/netapi_ipsecmgr.c b/ti/runtime/netapi/applications/ipsec_offload/ipsecmgr/src/netapi_ipsecmgr.c
index 8e95419a79c7205791056d7c74f0ae03b821c45e..ea91baa801c43c61fc235b5fb6b9b468116fda8c 100755 (executable)
#include <netinet/in.h>
#include <string.h>
+#if defined(DEVICE_K2H)
+#include <ti/runtime/hplib/device/k2h/src/hplib_device.c>
+#include <ti/drv/nwal/device/k2h/src/nwal_device.c>
+#include <ti/runtime/netapi/device/k2h/src/netapi_device.c>
+#include <ti/drv/qmss/device/k2h/src/qmss_device.c>
+#include <ti/drv/cppi/device/k2h/src/cppi_device.c>
+char* DTS_LOG_FILE_QUEUE_ETHx[] = {
+ "/proc/device-tree/soc/pktdma@2004000/channels/netrx0/complete-queue"};
+char* DTS_LOG_FILE_FLOW_ETHx[] = {
+"/proc/device-tree/soc/pktdma@2004000/channels/netrx0/flow"};
+#elif defined (DEVICE_K2K)
+#include <ti/runtime/hplib/device/k2k/src/hplib_device.c>
+#include <ti/drv/nwal/device/k2k/src/nwal_device.c>
+#include <ti/runtime/netapi/device/k2k/src/netapi_device.c>
+#include <ti/drv/qmss/device/k2k/src/qmss_device.c>
+#include <ti/drv/cppi/device/k2k/src/cppi_device.c>
+char* DTS_LOG_FILE_QUEUE_ETHx[] = {
+ "/proc/device-tree/soc/pktdma@2004000/channels/netrx0/complete-queue"};
+char* DTS_LOG_FILE_FLOW_ETHx[] = {
+"/proc/device-tree/soc/pktdma@2004000/channels/netrx0/flow"};
+#elif defined (DEVICE_K2L)
+#include <ti/runtime/hplib/device/k2l/src/hplib_device.c>
+#include <ti/drv/nwal/device/k2l/src/nwal_device.c>
+#include <ti/runtime/netapi/device/k2l/src/netapi_device.c>
+#include <ti/drv/qmss/device/k2l/src/qmss_device.c>
+#include <ti/drv/cppi/device/k2l/src/cppi_device.c>
+char* DTS_LOG_FILE_QUEUE_ETHx[] = {
+ "/proc/device-tree/soc/pktdma@26186000/channels/netrx0/complete-queue"};
+char* DTS_LOG_FILE_FLOW_ETHx[] = {
+"/proc/device-tree/soc/pktdma@26186000/channels/netrx0/flow"};
+#elif defined (DEVICE_K2E)
+#include <ti/runtime/hplib/device/k2e/src/hplib_device.c>
+#include <ti/drv/nwal/device/k2e/src/nwal_device.c>
+#include <ti/runtime/netapi/device/k2e/src/netapi_device.c>
+#include <ti/drv/qmss/device/k2e/src/qmss_device.c>
+#include <ti/drv/cppi/device/k2e/src/cppi_device.c>
+char* DTS_LOG_FILE_QUEUE_ETHx[] = {
+ "/proc/device-tree/soc/pktdma@26186000/channels/netrx0/complete-queue"};
+char* DTS_LOG_FILE_FLOW_ETHx[] = {
+"/proc/device-tree/soc/pktdma@26186000/channels/netrx0/flow"};
+
+#else /*Default */
+#include <ti/runtime/hplib/device/k2h/src/hplib_device.c>
+#include <ti/drv/nwal/device/k2h/src/nwal_device.c>
+#include <ti/runtime/netapi/device/k2h/src/netapi_device.c>
+#include <ti/drv/qmss/device/k2h/src/qmss_device.c>
+#include <ti/drv/cppi/device/k2h/src/cppi_device.c>
+char* DTS_LOG_FILE_QUEUE_ETHx[] = {
+ "/proc/device-tree/soc/pktdma@2004000/channels/netrx0/complete-queue"};
+char* DTS_LOG_FILE_FLOW_ETHx[] = {
+"/proc/device-tree/soc/pktdma@2004000/channels/netrx0/flow"};
+
+#endif
+
/**********************************************************************
************************** Local Definitions *************************
**********************************************************************/
+#if 0
+
char* DTS_LOG_FILE_QUEUE_ETHx[] = {
"/proc/device-tree/soc/pktdma@2004000/channels/netrx0/complete-queue"};
char* DTS_LOG_FILE_FLOW_ETHx[] = {
"/proc/device-tree/soc/pktdma@2004000/channels/netrx0/flow"};
+char* DTS_LOG_FILE_QUEUE_ETHx[] = {
+ "/proc/device-tree/soc/pktdma@26186000/channels/netrx0/complete-queue"};
+char* DTS_LOG_FILE_FLOW_ETHx[] = {
+"/proc/device-tree/soc/pktdma@26186000/channels/netrx0/flow"};
+#endif
+
/**********************************************************************
************************** Global Variables **************************
static ipsecmgr_ipc_daemon_send_if_t *send_iface;
NETAPI_T netapi_handle;
-//paSysStats_t netcp_stats;
ipsecMgrMcb_t globalDB;
/* Lock file for the daemon */
}
}
-//void netTest_utilsStatsCb(NETAPI_T h, paSysStats_t* pPaStats)
-NETAPI_SA_STATS_T netapi_sa_statsrx;
-NETAPI_SA_STATS_T netapi_sa_statstx;
-
-
-void printIPSecStats(Sa_IpsecStats_t* p_saIpsecStats,
- nwal_saAALG auth,
- nwal_saEALG cipher,
- uint32_t saAppId)
-{
-
- printf("\n appId: 0x%x: Autentication mode: %d, Encryption Mode: %d\n",
- saAppId,
- auth,
- cipher);
-
- printf("IPSec replayOld:0x%x,replayDup:0x%x,authFail:0x%x \n",
- p_saIpsecStats->replayOld,p_saIpsecStats->replayDup,p_saIpsecStats->authFail);
- printf("IPSec txESN:0x%x,rxESN:0x%x,pktEncHi:0x%x,pktEncLo:0x%x,pktDecHi:0x%x,pktDecLo:0x%x \n",
- p_saIpsecStats->txESN,p_saIpsecStats->rxESN,p_saIpsecStats->pktEncHi,
- p_saIpsecStats->pktEncLo,p_saIpsecStats->pktDecHi,p_saIpsecStats->pktDecLo);
-}
-
-
-
-
-
-void utilsStatsCb(NETAPI_T h)
-{
- uint32_t numFreeDataPackets;
- uint32_t numZeroBufferPackets;
- uint32_t numPacketsinGarbage;
- Pktlib_HeapStats pktLibHeapStats;
- int i,j;
-
-
-
- if(globalDB.rx_sa[0].saAppId)
- {
- /* Statistics for RX Tunnel */
- memset(&netapi_sa_statsrx, 0, sizeof(netapi_sa_statsrx));
- netapi_getSaStats(netapi_handle,
- globalDB.rx_sa[0].saAppId,
- &netapi_sa_statsrx);
- if (netapi_sa_statsrx.validParams & NETAPI_IPSEC_STAT_VALID)
- {
- printIPSecStats(&netapi_sa_statsrx.saIpsecStats,
- NWAL_SA_AALG_HMAC_SHA1,
- NWAL_SA_EALG_AES_CBC,
- globalDB.rx_sa[0].saAppId);
- }
- }
-#if 1
- if (globalDB.tx_sa[0].saAppId)
- {
- memset(&netapi_sa_statstx, 0, sizeof(netapi_sa_statstx));
- netapi_getSaStats(netapi_handle,
- globalDB.tx_sa[0].saAppId,
- &netapi_sa_statstx);
- if (netapi_sa_statstx.validParams & NETAPI_IPSEC_STAT_VALID)
- {
- printIPSecStats(&netapi_sa_statstx.saIpsecStats,
- NWAL_SA_AALG_HMAC_SHA1,
- NWAL_SA_EALG_AES_CBC,
- globalDB.tx_sa[0].saAppId);
- }
- }
-#endif
-}
static void* snoop_run_thread (void* arg)
{
cpu_set_t cpu_set;
hplib_utilSetupThread(0, &cpu_set, hplib_spinLock_Type_LOL);
ipsecmgr_syslog_msg(SYSLOG_LEVEL_INFO,
"snoop_run_thread: daemon entering forever event loop\n");
- int count=0;
- int sat=500000;
+
while (1)
{
/* Poll for message from user application */
/* Poll for message from Kernel */
ipsecmgr_snoop_run();
-#if 1
- if((count % 500000) == 0)
- utilsStatsCb(netapi_handle);
-
-#endif
- count++;
if (QUIT == 1)
break;
}
ipsecmgr_syslog_msg(SYSLOG_LEVEL_INFO,
"snoop_run_thread: calling shutdown\n");
- utilsStatsCb(netapi_handle);
ipsecmgr_snoop_shutdown ();
cleanup_sa_sp();
netapi_shutdown(netapi_handle);
return -1;
}
- printf("create_pktio_channel: qnum: %d, pktio_handle: 0x%x\n",
- pktio_cfg.qnum,
- globalDB.pktio_channel);
flow.dma_engine= 1;
flow.flowid = globalDB.flowId;
7,
NETCP_CFG_ACTION_TO_SW,
(NETCP_CFG_ROUTE_HANDLE_T) &route);
- printf("create_pktio_channel: expPkt appid: 0x%x\n", expPkt_appid);
return 0;
}
hplib_utilSetupThread(0, &cpu_set, hplib_spinLock_Type_LOL);
/* create netapi */
netapi_handle = netapi_init(NETAPI_SYS_MASTER,
- &our_netapi_default_cfg);
+ &our_netapi_default_cfg,
+ &hplibDeviceGblCfgParam,
+ &nwalDeviceGblCfgParam,
+ &netapiDeviceGblCfgParam);
if(netapi_handle == NULL)
{
ipsecmgr_syslog_msg (SYSLOG_LEVEL_ERROR,