SDOCM00113322: kernel RX UDP/TCP checksum offload to NETCP breaks user space tranport...
authorTinku Mannan <tmannan@ti.com>
Tue, 25 Nov 2014 15:28:50 +0000 (10:28 -0500)
committerTinku Mannan <tmannan@ti.com>
Tue, 25 Nov 2014 20:18:56 +0000 (15:18 -0500)
ti/runtime/netapi/demo/src/transport_dpi_demo.c
ti/runtime/netapi/netcp_cfg.h
ti/runtime/netapi/src/netcp_cfg.c
ti/runtime/netapi/test/ifdma_test.c
ti/runtime/netapi/test/net_test_bench.c
ti/runtime/netapi/test/net_test_loopback.c
ti/runtime/netapi/test/net_test_max_params.c
ti/runtime/netapi/test/net_test_router.c
ti/runtime/netapi/test/net_test_utils.c
ti/runtime/netapi/test/net_test_utils.h
ti/runtime/netapi/test/nt_bridge.c

index cb938fcb4592784f728f255817289d98cb097dd5..0a887ef8f9ab40282c89fc6909dae67bbab8af4f 100755 (executable)
@@ -290,7 +290,10 @@ NETCP_CFG_ROUTE_T  test_route=
 0,
 NULL,
 NULL,
-0//* to be filled in
+0,
+0,
+0,
+1
 };
 
 NETCP_CFG_FLOW_HANDLE_T kernelFlow22;
index a668fd40d5476ab19ef1d747e8361413b934015b..1953a98f7c68cd9fbf083301078183b4d15851bf 100755 (executable)
@@ -178,6 +178,28 @@ typedef NETCP_CFG_FLOW_T* NETCP_CFG_FLOW_HANDLE_T;
 
 #define NETCP_CFG_VALID_PARAM_ROUTE_TYPE        0x01
 /*  @}  */
+/* @{ */
+/**
+ *  @def  NETCP_CFG_VALID_PARAM_MATCH_ACTION_DEST
+ *        Valid Match Destination configuration present,
+ *        When set, NetCP to terminate packet at configured destination
+ *        if classification matches as specified by match_destination of
+ *        @NETCP_CFG_ROUTE_T
+ *
+ */
+#define NETCP_CFG_VALID_PARAM_MATCH_ACTION_DEST        0x02
+/*  @}  */
+/* @{ */
+/**
+ *  @def  NETCP_CFG_VALID_PARAM_FAIL_ACTION_DEST
+ *        Valid Fail Destination configuration present,
+ *        When set, NetCP to terminate packet at configured destination
+ *        if next route classification fails as specified by fail_destination of
+ *        @NETCP_CFG_ROUTE_T
+ *
+ */
+#define NETCP_CFG_VALID_PARAM_FAIL_ACTION_DEST          0x04
+/*  @}  */
 /** @} */
 
 
@@ -206,7 +228,14 @@ typedef struct NETCP_CFG_ROUTE_Tag
     nwalRouteType_t     routeType;          /**< Optional: Routing priority,
                                               *  @see nwal.h for nwalRouteType_t
                                               */
-   uint16_t             egress_swith_port;   /* learned swithc port #, from ale_table */
+   uint16_t             egress_swith_port;  /* learned swithc port #, from ale_table */
+    uint16_t            match_destination;  /**< Optional: NetCP to terminate packet at specified destination 
+                                                  if classification matches
+                                                  @see nwal.h for nwal_matchAction_t*/
+    uint16_t            fail_destination;   /**< Optional: NetCP to terminate packet at specified destination 
+                                                  if next route classification match fails 
+                                                  @see nwal.h for nwal_failAction_t*/
+
 } NETCP_CFG_ROUTE_T;
 
 
index 5ea355975e3d0e56a8bbbee4df0dd0ba21245bc4..e836174e9a44e2c1e4cfba6874b55c37bc943e54 100755 (executable)
@@ -848,12 +848,20 @@ NETCP_CFG_MACIF_T  netapi_netcpCfgCreateMacInterface(NETAPI_T  h,
            if(route->routeType == NWAL_ROUTE_PKTTYPE_EQOS)
            {
                 macInfo.egress_switch_port = route->egress_swith_port;
-                //macInfo.appRxPktFlowId = route->p_flow;
-                //macInfo.appRxPktQueue = route->p_dest_q;
                 macInfo.routeType = NWAL_ROUTE_PKTTYPE_EQOS;
                 macInfo.matchAction = NWAL_MATCH_ACTION_HOST;
            }
         }
+        if((route->valid_params & NETCP_CFG_VALID_PARAM_MATCH_ACTION_DEST) ==
+            NETCP_CFG_VALID_PARAM_MATCH_ACTION_DEST)
+        {
+            macInfo.matchAction = route->match_destination;
+        }
+        if((route->valid_params & NETCP_CFG_VALID_PARAM_FAIL_ACTION_DEST) ==
+            NETCP_CFG_VALID_PARAM_FAIL_ACTION_DEST)
+        {
+            macInfo.failAction = route->fail_destination;
+        }
 
         netapip_netcpCfgBuildRoute(route,
                                    &macInfo.appRxPktFlowId,
index da6bebc8dc9c9cb9a4a722c910298d1c2ae85c81..2f91761bfb9036b6d8ac40b7620f3257454ab81d 100755 (executable)
@@ -157,7 +157,10 @@ NETCP_CFG_ROUTE_T  test_route=
 0,
 NULL,
 NULL,
-0//* to be filled in
+0,
+0,
+0,
+1
 };
 
 
index 6917a259bca7d40ec13a2e02b03b39404698b774..80fbc547cb5496a51226f467d06a1fd13edcb760 100755 (executable)
@@ -211,7 +211,10 @@ NETCP_CFG_ROUTE_T  test_route=
 0,
 NULL,
 NULL,
-0//* to be filled in
+0,
+0,
+0,
+1
 };
 
 
@@ -303,6 +306,7 @@ int main(int argc, char **argv)
     Pktlib_HeapCfg heapCfg;
     long t1, t2 ;
     cpu_set_t cpu_set;
+    NETCP_CFG_ROUTE_T test_route;
 
 
      //install signal handler for ^c
@@ -373,12 +377,19 @@ printf("\n\n******STARTING RECV BENCHMARK (q to quit)*****\n\n");
 
 //now creaate a simple netcp rule
 //to get a lot of packets
+memset(&test_route, 0, sizeof(NETCP_CFG_ROUTE_T));
+test_route.valid_params = NETCP_CFG_VALID_PARAM_MATCH_ACTION_DEST;
+test_route.match_destination = NETCP_CFG_ACTION_TO_SW;
+test_route.routeType = 0;
+test_route.p_flow = NULL;
+test_route.p_dest_q = NULL;
+
 netapi_netcpCfgCreateMacInterface(
                   netapi_handle,
                   &all_mac[0],
                   NULL,
                   0,0,
-                  (NETCP_CFG_ROUTE_HANDLE_T)  NULL,
+                  (NETCP_CFG_ROUTE_HANDLE_T)  &test_route,
                   (NETCP_CFG_VLAN_T ) NULL ,  //future
                   0,
                   1,
index 7049f46ef8cb9d83bc23f775700803370b512852..245828b2455889090685817c52e51c952009b533 100755 (executable)
@@ -1259,7 +1259,7 @@ int main(int argc, char **argv)
 
 
     /*create net_test MAC interfaces, attach IP to created MAC interfaces */
-    netTest_utilCreateInterfaces(netTestCfg.num_macs, netTestCfg.num_ips);
+    netTest_utilCreateInterfaces(netTestCfg.num_macs, netTestCfg.num_ips, 0);
 
     /* lookup Database for SA context, this is used by packet processing routines to get RX and TX SA information*/
     p_trie_sa_rx = trie_new();
index b90bccee1ec1617323ee7fe88d5df2ebddfe7087..888942cb762ef60bce29cf39ee04ff11cc778302 100755 (executable)
@@ -409,7 +409,7 @@ int main(int argc, char **argv)
 
 
     /*create net_test MAC interfaces, attach IP to created MAC interfaces */
-    netTest_utilCreateInterfaces(netTestCfg.num_macs, netTestCfg.num_ips);
+    netTest_utilCreateInterfaces(netTestCfg.num_macs, netTestCfg.num_ips,0);
 
     /* lookup Database for SA context, this is used by packet processing routines to get RX and TX SA information*/
     p_trie_sa_rx = trie_new();
index 20b61a00860864ea28a537cdbe52e916ba289b6e..c6d1875e24924b3da79be42f0031aba2e327a2f6 100755 (executable)
@@ -554,7 +554,7 @@ int main(int argc, char **argv)
 
 
     /*create net_test MAC interfaces, attach IP to created MAC interfaces */
-    netTest_utilCreateInterfaces(netTestCfg.num_macs, netTestCfg.num_ips);
+    netTest_utilCreateInterfaces(netTestCfg.num_macs, netTestCfg.num_ips,1);
 
     /* Lookup Database for SA context, this is used by packet processing routines to get RX and TX SA information*/
     p_trie_sa_rx = trie_new();
index 18b3cff79f8f084989573195f0b911b0344db2e6..c9fe429fcafb5232cd83aa26f34abd1bc45b573c 100755 (executable)
@@ -1302,27 +1302,60 @@ void house(NETAPI_SCHED_HANDLE_T * s)
     }
 #endif
 }
+NETCP_CFG_ROUTE_T test_route;
 
-void netTest_utilCreateInterfaces(uint8_t num_macs, uint8_t num_ips)
+void netTest_utilCreateInterfaces(uint8_t num_macs, uint8_t num_ips, Bool match_action_host)
 {
     int err, i;
 
-    for (i = 0; i < num_macs; i++)
+    if (match_action_host)
     {
-        /* add mac intefaces */
-        mac[i] = netapi_netcpCfgCreateMacInterface(
-                          netapi_handle,
-                          &netTestCfg.mac[i][0],
-                          NULL,
-                          i,
-                          netTestCfg.switch_port[i],
-                          (NETCP_CFG_ROUTE_HANDLE_T)  NULL,
-                          (NETCP_CFG_VLAN_T ) NULL ,  //future
-                          0,
-                          1, 
-                          &err);
-       if (err)
-           netapi_Log("netapi_netcpCfgCreateMacInterface failed with error: %d\n",err);
+        memset(&test_route, 0, sizeof(NETCP_CFG_ROUTE_T));
+        test_route.valid_params = NETCP_CFG_VALID_PARAM_MATCH_ACTION_DEST;
+        test_route.match_destination = NETCP_CFG_ACTION_TO_SW;
+        test_route.routeType = 0;
+        test_route.p_flow = NULL;
+        test_route.p_dest_q = NULL;
+    
+        for (i = 0; i < num_macs; i++)
+        {
+            /* add mac intefaces */
+            mac[i] = netapi_netcpCfgCreateMacInterface(
+                              netapi_handle,
+                              &netTestCfg.mac[i][0],
+                              NULL,
+                              i,
+                              netTestCfg.switch_port[i],
+                              (NETCP_CFG_ROUTE_HANDLE_T)  &test_route,
+                              (NETCP_CFG_VLAN_T ) NULL ,  //future
+                              0,
+                              1, 
+                              &err);
+           if (err)
+               netapi_Log("netapi_netcpCfgCreateMacInterface failed with error: %d\n",err);
+    
+        }
+    }
+    else
+    {
+        for (i = 0; i < num_macs; i++)
+        {
+            /* add mac intefaces */
+            mac[i] = netapi_netcpCfgCreateMacInterface(
+                              netapi_handle,
+                              &netTestCfg.mac[i][0],
+                              NULL,
+                              i,
+                              netTestCfg.switch_port[i],
+                              (NETCP_CFG_ROUTE_HANDLE_T)  NULL,
+                              (NETCP_CFG_VLAN_T ) NULL ,  //future
+                              0,
+                              1, 
+                              &err);
+           if (err)
+               netapi_Log("netapi_netcpCfgCreateMacInterface failed with error: %d\n",err);
+    
+        }
 
     }
     for (i = 0; i < num_ips; i++)
index d6f611fe6b06376827466c3a22ddb45b6925fca3..f7706fa0d7bd293b0c4292022ddfd0d0d7f4b147 100755 (executable)
@@ -179,7 +179,7 @@ typedef struct
 
 
 void house(NETAPI_SCHED_HANDLE_T *s);
-void netTest_utilCreateInterfaces(uint8_t num_macs, uint8_t num_ips);
+void netTest_utilCreateInterfaces(uint8_t num_macs, uint8_t num_ips, Bool match_action_host);
 void netTest_utilDeleteInterfaces(uint8_t num_macs, uint8_t num_ips);
 
 int netTest_utilCheckHeader(netTestHead_T * p_head, PKTIO_METADATA_T * p_meta);
index a28f3f27936790e023758319f733db39cf720635..839bfb62aee6c6cbce62ada3aa3611ce75556362 100755 (executable)
@@ -544,7 +544,9 @@ NETCP_CFG_ROUTE_T  test_route1 =
 0,
 NULL,
 NULL,
-0, //* to be filled in
+0,
+1,
+0,
 1
 };
 NETCP_CFG_ROUTE_T  test_route2 =
@@ -552,8 +554,10 @@ NETCP_CFG_ROUTE_T  test_route2 =
 0,
 NULL,
 NULL,
-0, //* to be filled in
-2
+0,
+2,
+0,
+1
 };