summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 51ae7b8)
raw | patch | inline | side by side (parent: 51ae7b8)
author | David Lide <a0216552@gtudci01.(none)> | |
Fri, 27 Jan 2012 17:30:35 +0000 (12:30 -0500) | ||
committer | David Lide <a0216552@gtudci01.(none)> | |
Fri, 27 Jan 2012 17:30:35 +0000 (12:30 -0500) |
index ae05a1198ec5e82f407854d316a0b504ec610020..0c45131deef0ed2def9cce3cdd3db98ffeec7c65 100644 (file)
clean:
rm -f $(NETAPI_SRC_DIR)/*.o
clean:
rm -f $(NETAPI_SRC_DIR)/*.o
- rm -f *.a
+ rm -f $(NETAPI_LIB_DIR)/*.a
%.o: %.c
%.o: %.c
index 3a67f232185084484741684380137122cf77b314..66ebeb67cfdca184bbb99346c63ac17bc57508bc 100644 (file)
#define TUNE_NETAPI_DESC_SIZE 128 //don't change!!
//(9) Define to 1 for DEBUG MODE [where NETCP just loops pkts that tx back to rx]
#define TUNE_NETAPI_DESC_SIZE 128 //don't change!!
//(9) Define to 1 for DEBUG MODE [where NETCP just loops pkts that tx back to rx]
-#define TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK 0 /*1*/
+#define TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK 1 /*0*/
//(10) NWAL (internal) config. Should not have to change
#define TUNE_NETAPI_CONFIG_MAX_PA_TO_SA_DESC 16
#define TUNE_NETAPI_CONFIG_MAX_SA_TO_PA_DESC 16
//(10) NWAL (internal) config. Should not have to change
#define TUNE_NETAPI_CONFIG_MAX_PA_TO_SA_DESC 16
#define TUNE_NETAPI_CONFIG_MAX_SA_TO_PA_DESC 16
-#define TUNE_NETAPI_CONFIG_MAX_GLOB_DESC (TEST_CONFIG_MAX_PA_TO_SA_DESC + TEST_CONFIG_MAX_SA_TO_PA_DESC)
-#if 0
-#define TEST_CONFIG_GLOB_DESC_SIZE 128 /* todo:could be smaller */
-#define TEST_CONFIG_GLOB_BUF_SIZE 1500 /* MTU Size */
-#endif
-#define TUNE_NETAPI_MAX_NUM_MAC 2
-#define TUNE_NETAPI_MAX_NUM_IP 2
+
+#define TUNE_NETAPI_MAX_NUM_MAC 2 //2 'logical' mac addresses
+#define TUNE_NETAPI_MAX_NUM_IP 2 //2 ip addresses
#define TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE 4 //udp/tcp ports -> for lUT2 )
#define TUNE_NETAPI_MAX_NUM_PORTS (TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE * (TUNE_NETAPI_NUM_CORES))
#define TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE 4 //udp/tcp ports -> for lUT2 )
#define TUNE_NETAPI_MAX_NUM_PORTS (TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE * (TUNE_NETAPI_NUM_CORES))
index c4f1310e40c1256d9d74cdc9f0f246b05c22a399..9a5cabdf1142a4e12fc15d22507217da536e670d 100644 (file)
#include "ti/drv/pa/pa.h"
#include "ti/runtime/pktlib/pktlib.h"
#include "ti/drv/pa/pa.h"
#include "ti/runtime/pktlib/pktlib.h"
-#define CONFIG_MAX_L2_HANDLES 10
-#define CONFIG_MAX_L3_HANDLES 20
-#define CONFIG_MAX_L4_HANDLES 40
-
//NETCP FLOW
typedef struct NETCP_CFG_FLOW_Tag
{
//NETCP FLOW
typedef struct NETCP_CFG_FLOW_Tag
{
#define NETCP_CFG_ACTION_CONTINUE 1 //pass packet on to next classifier
#define NETCP_CFG_ACTION_TO_SW 2
#define NETCP_CFG_ACTION_CONTINUE 1 //pass packet on to next classifier
#define NETCP_CFG_ACTION_TO_SW 2
+/******************************************************************/
+/***********************APP ids for rx meta data********************/
+/******************************************************************/
+// NWAL "AP ids" for PA Rules that are added
+#define NETAPI_NETCP_MATCH_GENERIC_MAC 0x10000000 //lower byte==interface
+#define NETAPI_NETCP_MATCH_GENERIC_IP 0x20000000 //lower byte==interface
+#define NETAPI_NETCP_MATCH_CLASS 0x80000000 //or' in classifier #, lower byte==interface
+
+
+/*---------MAC APPID------------------*/
+typedef uint32_t NETCP_CFG_MACIF_T;
+
/*------------L2----------------------*/
/*------------L2----------------------*/
-typedef void * NETCP_CFG_MACIF_T;
typedef void * NETCP_CFG_VLAN_T;
typedef void * NETCP_CFG_VLAN_T;
-typedef void * NETCP_CFG_IP_T;
+
+/*---------------IP APPID-------------------*/
+typedef uint32_t NETCP_CFG_IP_T;
/* del mac i/f */
void netcp_cfgDelMac(NETAPI_T h,int iface_no, int *err);
/* del mac i/f */
void netcp_cfgDelMac(NETAPI_T h,int iface_no, int *err);
* @oaram[in] @ref NETCP_CFG_VLAN_T : [future[ vlan configuration . Set to NULL
* @param[in] int : [future] interface state (0=down, 1= up)
* @param[out] int * err: pointer to error return
* @oaram[in] @ref NETCP_CFG_VLAN_T : [future[ vlan configuration . Set to NULL
* @param[in] int : [future] interface state (0=down, 1= up)
* @param[out] int * err: pointer to error return
- * @retval @ref NETCP_CFG_MACIF_T : returned handle for interface.
+ * @retval @ref NETCP_CFG_MACIF_T : returned AppID for interface (this is returned in meta data for
+ * received packets matching this rule an no others)
* @pre @ref netapi_init
*/
NETCP_CFG_MACIF_T netcp_cfgCreateMacInterface(
* @pre @ref netapi_init
*/
NETCP_CFG_MACIF_T netcp_cfgCreateMacInterface(
* diffserv category for example
* @param[in] @ref NETCP_CFG_ROUTE_HANDLE_T : [future] handle of a created route or NULL to use internal default route
* @param[out] int * err: pointer to error return
* diffserv category for example
* @param[in] @ref NETCP_CFG_ROUTE_HANDLE_T : [future] handle of a created route or NULL to use internal default route
* @param[out] int * err: pointer to error return
- * @retval @ref NETCP_CFG_IP_T : returned handle for attched rule.
+ * @retval @ref NETCP_CFG_IP_T : returned AppID for attached rule. This is returned in RX meta data for
+ * packets matching this rule and no other.
* @pre @ref netapi_init , @ref netcp_cfgAddMac
*/
NETCP_CFG_IP_T netcp_AddIp(
* @pre @ref netapi_init , @ref netcp_cfgAddMac
*/
NETCP_CFG_IP_T netcp_AddIp(
********************************STATS**************************************
**************************************************************************/
********************************STATS**************************************
**************************************************************************/
+/*
+ * @brief This is the callback function that is used to return statistics from NETCP
+ *
+ * @details The application provides a callback function that NETAPI uses to report statistics.
+* The request for stats is generated from the @ref netcp_cfgReqStats API.
+ * Note: to receive ths stats callback, the @ref netapi_netcpPoll funcition must be called
+ * @param[in] @ref NETAPI_T: NETAPI instance
+ * @param[in] @ref paSysStats_t * : the PA (NETCP packet accelerator subsystem) statistics block
+ * @retval none
+ * @pre @ref netapi_init , @ref netapi_cfgReqStats, @ref netapi_netcpPoll
+ */
//stats CB
typedef void (*NETCP_CFG_STATS_CB)( NETAPI_T h, paSysStats_t* pPaStats);
//stats CB
typedef void (*NETCP_CFG_STATS_CB)( NETAPI_T h, paSysStats_t* pPaStats);
int doClear, //0: don't clear, 1 clear
int *err);
int doClear, //0: don't clear, 1 clear
int *err);
-/******************************************************************/
-/***********************APP ids for rx meta data********************/
-/******************************************************************/
-
-// NWAL "AP ids"
-#define NETAPI_NETCP_MATCH_GENERIC_MAC 0x10000000 //lower byte==interface
-#define NETAPI_NETCP_MATCH_GENERIC_IP 0x20000000 //lower byte==interface
-#define NETAPI_NETCP_MATCH_CLASS 0x80000000 //or' in classifier #
-
-
-
#endif
#endif
index 5ad7343c7b848e74a0bbd035a4f647bad59558f8..2f0deb2b06903ad9737e638d422097b52872e68f 100644 (file)
#include <ti/drv/qmss/device/qmss_device.c>
#include <ti/drv/cppi/device/cppi_device.c>
#include <ti/drv/qmss/device/qmss_device.c>
#include <ti/drv/cppi/device/cppi_device.c>
-/* TODO: */
-#define DNUM 0
+/* TODO verify: */
#define CACHE_LINESZ 64
#define System_printf printf
#define CACHE_LINESZ 64
#define System_printf printf
index 21d5cdd946c114db584c3a7db7a2d6ca3a9f7798..c1c6df516c3552e377abbe81803021dba7580442 100644 (file)
c_seen+=1;
}
((TIMER_GROUP_T*) th)->last_polled = i;
c_seen+=1;
}
((TIMER_GROUP_T*) th)->last_polled = i;
- timer_poll_stats.n_tot = n_tot;
- timer_poll_stats.c_seen = c_seen;
+ if (c_seen) timer_poll_stats.n_tot = n_tot;
+ if (c_seen) timer_poll_stats.c_seen = c_seen;
if (n_tot > timer_poll_stats.max_n_tot) timer_poll_stats.max_n_tot = n_tot;
if (c_seen > timer_poll_stats.max_c_seen) timer_poll_stats.max_c_seen = c_seen;
return n_tot;
if (n_tot > timer_poll_stats.max_n_tot) timer_poll_stats.max_n_tot = n_tot;
if (c_seen > timer_poll_stats.max_c_seen) timer_poll_stats.max_c_seen = c_seen;
return n_tot;
index 7805243cfd7355a78a727a7916cbed7cddeb5c8f..1f72ca71709b39606c325689e24193298effaba3 100644 (file)
(void *) pTransInfo->handle);
pTransInfo->state = NETAPI_NWAL_HANDLE_STATE_IDLE;
pTransInfo->inUse = nwal_FALSE;
(void *) pTransInfo->handle);
pTransInfo->state = NETAPI_NWAL_HANDLE_STATE_IDLE;
pTransInfo->inUse = nwal_FALSE;
- return NULL;
+ return (void *) (NETAPI_NETCP_MATCH_GENERIC_MAC | iface_no);
}
}
if(retValue != nwal_OK)
{
*err = NETAPI_ERR_NWAL_ERR0;
if(retValue != nwal_OK)
{
*err = NETAPI_ERR_NWAL_ERR0;
- printf ("ERROR: nwal_setMacIface returned Error Code %d\n",
+ printf ("ERROR: nwal_setIP returned Error Code %d\n",
retValue);
pTransInfo->inUse = nwal_FALSE;
return NULL;
}
//pTransInfo->inUse = nwal_FALSE;
retValue);
pTransInfo->inUse = nwal_FALSE;
return NULL;
}
//pTransInfo->inUse = nwal_FALSE;
- printf ("MAC Open sent with trans_id: %d\n",trans_id);
+ printf (" SeIPAddr sent with trans_id: %d\n",trans_id);
//wait here until its done since scheduler isn't running yet most likely..
// todo: make this handled by scheduler poll later ??
//wait here until its done since scheduler isn't running yet most likely..
// todo: make this handled by scheduler poll later ??
pTransInfo->handle);
pTransInfo->state = NETAPI_NWAL_HANDLE_STATE_IDLE;
pTransInfo->inUse = nwal_FALSE;
pTransInfo->handle);
pTransInfo->state = NETAPI_NWAL_HANDLE_STATE_IDLE;
pTransInfo->inUse = nwal_FALSE;
- return NULL;
-
+ return (void *) (NETAPI_NETCP_MATCH_GENERIC_IP | iface_no);
}
}
index 95fe2dc97aff5baf13ab7c7f6f1a34bbd4311285..3ddb633ffffcf70f19b412894e94958b380770dd 100644 (file)
@@ -261,12 +261,12 @@ int pktio_send(PKTIO_HANDLE_T * p, Ti_Pkt *pkt, PKTIO_METADATA_T *m, int * err)
if (p->use_nwal)
{
pPktInfo->pPkt = pkt;
if (p->use_nwal)
{
pPktInfo->pPkt = pkt;
- //todo metadata
res=nwal_send(p->nwalInstanceHandle, nwal_HANDLE_INVALID,pPktInfo);
if (res != nwal_OK) *err = NETAPI_ERR_NWAL_TX_ERR -res;
}
else
{
res=nwal_send(p->nwalInstanceHandle, nwal_HANDLE_INVALID,pPktInfo);
if (res != nwal_OK) *err = NETAPI_ERR_NWAL_TX_ERR -res;
}
else
{
+ /* tod: meta data for non netcp xfers */
/* process meta data */
Qmss_queuePushDesc (p->q, (void*)pkt);
}
/* process meta data */
Qmss_queuePushDesc (p->q, (void*)pkt);
}
index 5bcdbc1c8c3d5a70a91bad6413a40e4795ba752b..a0535aa8dad0323b3fe07312f7e485d62d6e9dc3 100644 (file)
} TIM_LIST_T;
} TIM_LIST_T;
+//the timer group context
typedef struct TIMER_GROUP_Tag
{
NETAPI_T h; //back pointer
typedef struct TIMER_GROUP_Tag
{
NETAPI_T h; //back pointer
- int n_cells; //#of cells (hash entries
+ int n_cells; //#of cells (hash entries)
int n_timers; //# of timer objects
int n_timers; //# of timer objects
- int cell_width; //size of each cell (mask)
+ int cell_width; //size of each cell in ticks
TIM_LIST_T free; //free list of timer objects
TIM_LIST_T free; //free list of timer objects
- TIM_LIST_T * cells;//active timers
- unsigned long long last_polled;
- NETAPI_TIMER_CB_T cb;
- int local;
- int exp2cancel;
+ TIM_LIST_T * cells;//active timers hash table
+ unsigned long long last_polled; //in ticks
+ NETAPI_TIMER_CB_T cb; //timer callback
+ int local; //1 => local timer, 0 =>global timer
+ int exp2cancel; //1=> expect to cancel, 0=> expect to fire
+ int tol; //in ticks [FUTURE]
} TIMER_GROUP_T;
/**********************INTERNAL API*******************/
} TIMER_GROUP_T;
/**********************INTERNAL API*******************/
index 9b086de91b77813f176486a6eb5b3991122f99b1..b7ff14ad683fff82d29fbddf46eb3348260b27fe 100644 (file)
if ((got_start) && (!found_end))
{
//cleared the list
if ((got_start) && (!found_end))
{
//cleared the list
- printf("clearingthelist\n");
+ //DEBUGprintf("clearingthelist\n");
tl->head = tl->tail=NULL;
}
return;
tl->head = tl->tail=NULL;
}
return;
index 8d147d0d24987f9f4645ce0551fa6cf5653f3f8a..6ea95fc553e61279c89b82ab7851c8e13209c23f 100755 (executable)
t1 = netapi_TimerGroupStartTimer(
th,
(void *) 1,
t1 = netapi_TimerGroupStartTimer(
th,
(void *) 1,
- 100LL, //every second
+ 100LL, //timer group tics
&err);
else if (cookie ==2)
&err);
else if (cookie ==2)
- t1 = netapi_TimerGroupStartTimer(
+ t2 = netapi_TimerGroupStartTimer(
th,
(void *) 2,
th,
(void *) 2,
- 200LL, //every second
+ 200LL, //timer group ticks
&err);
else
{
t3 = netapi_TimerGroupStartTimer(
th,
(void *) 3,
&err);
else
{
t3 = netapi_TimerGroupStartTimer(
th,
(void *) 3,
- 300LL, //every second
+ 300LL, //timer group ticks
&err);
//cancel 1 and restart 1
netapi_TimerGroupCancel(th,t1,&err);
t1 = netapi_TimerGroupStartTimer(
th,
(void *) 1,
&err);
//cancel 1 and restart 1
netapi_TimerGroupCancel(th,t1,&err);
t1 = netapi_TimerGroupStartTimer(
th,
(void *) 1,
- 100LL, //every second
+ 100LL, //timer group ticks
&err);
&err);
{
printf("C1 number of packets: %d\n", pPaStats->classify1.nPackets);
printf("C1 number IPv4 packets: %d\n", pPaStats->classify1.nIpv4Packets);
{
printf("C1 number of packets: %d\n", pPaStats->classify1.nPackets);
printf("C1 number IPv4 packets: %d\n", pPaStats->classify1.nIpv4Packets);
- printf("C1 number llc/snap fail: %d\n", pPaStats->classify1.nLlcSnapFail);
+ //printf("C1 number llc/snap fail: %d\n", pPaStats->classify1.nLlcSnapFail);
printf("C1 number table matched: %d\n", pPaStats->classify1.nTableMatch);
printf("C1 number failed table matched: %d\n", pPaStats->classify1.nNoTableMatch);
printf ("C1 number of parse fail: %d\n",pPaStats->classify1.nParseFail);
printf("C1 number table matched: %d\n", pPaStats->classify1.nTableMatch);
printf("C1 number failed table matched: %d\n", pPaStats->classify1.nNoTableMatch);
printf ("C1 number of parse fail: %d\n",pPaStats->classify1.nParseFail);
printf ("C1 number of silent discard: %d\n",pPaStats->classify1.nSilentDiscard);
printf("C1 number of invalid control: %d\n", pPaStats->classify1.nInvalidControl);
printf ("C1 number of invalid states: %d\n",pPaStats->classify1.nInvalidState);
printf ("C1 number of silent discard: %d\n",pPaStats->classify1.nSilentDiscard);
printf("C1 number of invalid control: %d\n", pPaStats->classify1.nInvalidControl);
printf ("C1 number of invalid states: %d\n",pPaStats->classify1.nInvalidState);
- printf ("C1 number of system fails: %d\n\n",pPaStats->classify1.nSystemFail);
+ printf ("C1 number of system fails: %d\n",pPaStats->classify1.nSystemFail);
+ printf ("C2 number parse failed : %d\n",pPaStats->classify2.nParseFail);
+ printf ("C2 number Invld Header : %d\n",pPaStats->classify2.nInvldHdr);
+ printf ("C2 number udp : %d\n",pPaStats->classify2.nUdp);
+ printf ("C2 number tcp : %d\n",pPaStats->classify2.nTcp);
+ printf ("C2 number cmd fail : %d\n",pPaStats->classify2.nCommandFail);
+ printf ("C2 number silent drop : %d\n",pPaStats->classify2.nSilentDiscard);
+ printf ("C2 number invalid cntrl : %d\n\n",pPaStats->classify2.nInvalidControl);
}
Pktlib_getHeapStats(OurHeap, &numFreeDataPackets,
&numZeroBufferPackets, &numPacketsinGarbage);
}
Pktlib_getHeapStats(OurHeap, &numFreeDataPackets,
&numZeroBufferPackets, &numPacketsinGarbage);
our_timer_cb,
0, //1 if timers local to thread
0, //1 if expect to cancel
our_timer_cb,
0, //1 if timers local to thread
0, //1 if expect to cancel
- netapi_getTicksPerSec()/100, /* 10 msc resolution for these timers */
- netapi_getTicksPerSec()/1000, /* would like 1msc tolerence */
+ netapi_getTicksPerSec()/1000, /* 1 msc resolution for these timers */
+ netapi_getTicksPerSec()/5000, /* would like .5 msc tolerence */
100,
&err);
if (err) {printf("timergroupcreate failed %d\n",err); exit(1);}
100,
&err);
if (err) {printf("timergroupcreate failed %d\n",err); exit(1);}
t1 = netapi_TimerGroupStartTimer(
ourTimerBlock,
(void *) 1,
t1 = netapi_TimerGroupStartTimer(
ourTimerBlock,
(void *) 1,
- 100LL, //every second
+ 100LL, //timer group ticks
&err);
if (err) {printf("timerstart failed %d\n");}
t2 = netapi_TimerGroupStartTimer(
ourTimerBlock,
(void *) 2,
&err);
if (err) {printf("timerstart failed %d\n");}
t2 = netapi_TimerGroupStartTimer(
ourTimerBlock,
(void *) 2,
- 200LL, //every 1.1second
+ 200LL, //timer group ticks
&err);
if (err) {printf("timerstart failed %d\n");}
t3 = netapi_TimerGroupStartTimer(
ourTimerBlock,
(void *) 3,
&err);
if (err) {printf("timerstart failed %d\n");}
t3 = netapi_TimerGroupStartTimer(
ourTimerBlock,
(void *) 3,
- 300LL, //every 3 seconds
+ 300LL, //timer group ticks
&err);
if (err) {printf("timerstart failed %d\n");}
&err);
if (err) {printf("timerstart failed %d\n");}
index 08dfebb2169bbd99e2cdf2d002c220ccdd4702d3..8a35af34129b758e5542beea29c32f1ca7e80617 100644 (file)
NETAPI_ATOMIC64_T global_int=NETAPI_ATOMIC_INIT64(0LL) ;\r
__thread blah=0;\r
int blah2=0;\r
NETAPI_ATOMIC64_T global_int=NETAPI_ATOMIC_INIT64(0LL) ;\r
__thread blah=0;\r
int blah2=0;\r
+NETAPI_SPINLOCK_T spin_test;\r
+\r
pid_t gettid( void )\r
{\r
return syscall( __NR_gettid );\r
pid_t gettid( void )\r
{\r
return syscall( __NR_gettid );\r
\r
for (i = 0; i < INC_TO; i++)\r
{\r
\r
for (i = 0; i < INC_TO; i++)\r
{\r
-// global_int++;\r
- //__sync_fetch_and_add( &global_int, 1 );\r
\r
v1 = netapi_timing_start(); \r
netapi_atomic_add64(&global_int,1LL);\r
\r
v1 = netapi_timing_start(); \r
netapi_atomic_add64(&global_int,1LL);\r
sched_yield();\r
}\r
printf("thead %d -> blah=%d\n",proc_num, blah);\r
sched_yield();\r
}\r
printf("thead %d -> blah=%d\n",proc_num, blah);\r
+\r
+ printf("now try spin lock test. i'm thread %d, about to grab lock \n", proc_num);\r
+\r
+ //now we try the synch_lock_and_test\r
+ v1 = netapi_timing_start();\r
+ netapi_spinlock_lock(&spin_test);\r
+ v2 = netapi_timing_stop();\r
+ printf("i'm thread %d. I've locked it, val= %d, it took cycles=%d to get it\ngoing to sleep..",proc_num,spin_test,v2-v1);\r
+ sleep(1);\r
+ printf(" i'm back. i'm thread %d. i'm unlocking now\n",proc_num); \r
+ netapi_spinlock_unlock(&spin_test);\r
return NULL;\r
}\r
\r
return NULL;\r
}\r
\r
return -1;\r
}\r
\r
return -1;\r
}\r
\r
+ //initialize spinlock\r
+ netapi_spinlock_init(&spin_test);\r
printf( "Starting %d threads...\n", procs );\r
\r
for (i = 0; i < procs; i++)\r
printf( "Starting %d threads...\n", procs );\r
\r
for (i = 0; i < procs; i++)\r
\r
free( thrs );\r
\r
\r
free( thrs );\r
\r
- printf( "After doing all the math, global_int value is: %lld bare global_int is %d\n",\r
+ printf( "global_int value is: %lld bare global_int is %d\n",\r
global_int.val, blah2 );\r
printf( "Expected value is: %d\n", INC_TO * procs );\r
\r
global_int.val, blah2 );\r
printf( "Expected value is: %d\n", INC_TO * procs );\r
\r