[ofw] [PATCH] 5 of 6 ipoib_ndis6_cm - conditionalize and move debug code to debug file
Smith, Stan
stan.smith at intel.com
Tue Jun 28 14:37:16 PDT 2011
Migrate debug code into ipoib_debug.cpp and make conditional on EXTRA_DEBUG==1; trim the default compilation base.
Signed-off-by: stan smith <stan.smith at intel.com>
--- C:/Users/scsmith/AppData/Local/Temp/ipoib_debug.cpp-revBASE.svn000.tmp.cpp Tue Jun 28 14:08:22 2011
+++ C:/Users/scsmith/Documents/openIB-windows/SVN/gen1/trunk/ulp/ipoib_NDIS6_CM/kernel/ipoib_debug.cpp Tue Jun 28 11:01:26 2011
@@ -464,3 +464,212 @@
#endif
+#if EXTRA_DBG
+
+char *get_IP_protocol_str(uint8_t proto)
+{
+ static char what[28];
+
+ switch( proto )
+ {
+ case IPPROTO_HOPOPTS:
+ return "IPPROTO_HOPOPTS";
+
+ case IPPROTO_IPV4:
+ return "IPPROTO_IP";
+
+ case IPPROTO_IPV6:
+ return "IPPROTO_ICMP";
+
+ case IPPROTO_TCP:
+ return "IPPROTO_TCP";
+
+ case IPPROTO_UDP:
+ return "IPPROTO_UDP";
+
+ case IPPROTO_IGMP:
+ return "IPPROTO_IGMP";
+
+ case IPPROTO_ICMP:
+ return "IPPROTO_ICMP";
+
+ case IPPROTO_ICMPV6:
+ return "IPPROTO_ICMPV6";
+
+ case IPPROTO_NONE:
+ return "IPPROTO_NONE";
+
+ case IPPROTO_DSTOPTS:
+ return "IPPROTO_DSTOPTS";
+
+ case IPPROTO_SCTP:
+ return "IPPROTO_SCTP";
+
+ default:
+ break;
+ }
+ StringCchPrintf(what,sizeof(what),"Unknown IP protocol %d",proto);
+ return what;
+}
+
+#if 0
+static char *get_ipv6_nxt_hdr_str(UINT8 NH)
+{
+ static char what[28];
+
+ switch( NH )
+ {
+ case IPPROTO_HOPOPTS:
+ return "Hop-by-Hop";
+
+ case IPPROTO_ICMP:
+ return "ICMP";
+
+ case IPPROTO_IGMP:
+ return "IGMP";
+
+ case IPPROTO_GGP:
+ return "GGP";
+
+ case IPPROTO_IPV4:
+ return "IPV4";
+
+ case IPPROTO_ST:
+ return "ST";
+
+ case IPPROTO_TCP:
+ return "TCP";
+
+ case IPPROTO_CBT:
+ return "CBT";
+
+ case IPPROTO_EGP:
+ return "EGP";
+
+ case IPPROTO_IGP:
+ return "IGP";
+
+ case IPPROTO_PUP:
+ return "PUP";
+
+ case IPPROTO_UDP:
+ return "UDP";
+
+ case IPPROTO_IDP:
+ return "IDP";
+
+ case IPPROTO_RDP:
+ return "RDP";
+
+ case IPPROTO_IPV6:
+ return "IPV6";
+
+ case IPPROTO_ROUTING:
+ return "ROUTING";
+
+ case IPPROTO_FRAGMENT:
+ return "FRAGMENT";
+
+ case IPPROTO_ESP:
+ return "ESP";
+
+ case IPPROTO_AH:
+ return "AH";
+
+ case IPPROTO_ICMPV6:
+ return "ICMPV6";
+
+ case IPPROTO_NONE:
+ return "NONE";
+
+ case IPPROTO_DSTOPTS:
+ return "DSTOPTS";
+
+ case IPPROTO_ND:
+ return "ND";
+
+ case IPPROTO_ICLFXBM:
+ return "ICLFXBM";
+
+ case IPPROTO_PIM:
+ return "PIM";
+
+ case IPPROTO_PGM:
+ return "PGM";
+
+ case IPPROTO_L2TP:
+ return "L2TP";
+
+ case IPPROTO_SCTP:
+ return "SCTP";
+
+ default:
+ break;
+ }
+ StringCchPrintf(what,sizeof(what),"Unknown Proto %u",NH);
+ return what;
+}
+#endif // 0
+
+#if 0
+
+static void
+decode_NBL(
+ IN char const *preFix,
+ IN ipoib_port_t *p_port,
+ IN NET_BUFFER_LIST *p_net_buffer_list )
+{
+ ipoib_cm_recv_desc_t *p_desc;
+ NET_BUFFER_LIST *cur_NBL, *next_NBL;
+ LONG NBL_cnt = 0;
+ PNET_BUFFER NB;
+ ULONG len, off, i;
+
+ IPOIB_ENTER(IPOIB_DBG_RECV);
+
+ for (cur_NBL = p_net_buffer_list; cur_NBL != NULL; cur_NBL = next_NBL, NBL_cnt++)
+ {
+ next_NBL = NET_BUFFER_LIST_NEXT_NBL(cur_NBL);
+ /* Get the port and descriptor from the NET_BUFFER_LIST. */
+ CL_ASSERT(p_port == IPOIB_PORT_FROM_NBL(cur_NBL));
+ p_desc = IPOIB_CM_RECV_FROM_NBL(cur_NBL);
+
+ IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_CM,
+ ("%s[%d] curNBL %p p_desc->len %d NblFlags %#x\n",
+ preFix,
+ NBL_cnt,
+ cur_NBL,
+ p_desc->len,
+ NET_BUFFER_LIST_NBL_FLAGS(cur_NBL)) );
+
+ NB = NET_BUFFER_LIST_FIRST_NB(cur_NBL);
+ for(i = 1; NB;i++)
+ {
+ MDL *p_mdl;
+ PUCHAR p_head;
+ UINT mdl_len;
+
+ p_head=NULL;
+ p_mdl = NET_BUFFER_FIRST_MDL(NB);
+ NdisQueryMdl( p_mdl, &p_head, &mdl_len, NormalPagePriority );
+ if( p_head )
+ {
+ len = NET_BUFFER_DATA_LENGTH(NB);
+ off = NET_BUFFER_DATA_OFFSET(NB);
+ IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_CM,
+ (" NB[%d] off %lu len %lu mdl_len %u\n",
+ i,off,len,mdl_len) );
+ //(p_head+off),
+ //(p_desc->p_buf - DATA_OFFSET)) );
+ CL_ASSERT( len == p_desc->len );
+ CL_ASSERT( (p_head+off) == (p_desc->p_buf - DATA_OFFSET));
+ decode_enet_pkt( "\nEdata:", (p_head + off), mdl_len, NULL );
+ }
+ NB=NET_BUFFER_NEXT_NB(NB);
+ }
+ }
+}
+#endif
+
+#endif // EXTRA_DBG
+
More information about the ofw
mailing list