1
0
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
TP-Link_Archer-XR500v/EN7526G_3.18Kernel_SDK/linux-3.18.21/include/trace/tpdebug.h
2024-07-22 01:58:46 -03:00

106 lines
3.3 KiB
C
Executable File

/********************************************************************************
* Copyright(c) 2012-2017, Shenzhen TP-LINK Technologies Co.,Ltd.
*
* File tpdebug.h
* Brief
* Details
*
* Author Shangguan Weijie
* Version
* Date 2017-04-12
*
* History \arg
*
********************************************************************************/
#ifndef __TP_DEBUG__
#define __TP_DEBUG__
#if 0
#define DATAPATH_DOWN_DEBUG_PRINT(skb, format, arg...) do{ \
if(skb != NULL) \
{ \
if(skb->dev != NULL) \
printk("[%s(%d)] Dev=%s "format"\n", __FUNCTION__, __LINE__, skb->dev->name, ##arg); \
else \
printk("[%s(%d)] "format"\n", __FUNCTION__, __LINE__, ##arg); \
} \
}while(0)
#else
#define DATAPATH_DOWN_DEBUG_PRINT(format, arg...)
#endif
#if 0
#define DATAPATH_DOWN_DEBUG_DUMP(skb) do{ \
if(skb != NULL && skb->dev != NULL && (skb->dev->name[0] == 'p' || skb->dev->name[0] == 'n')) \
{ \
unsigned char * dest = (unsigned char *)&(ip_hdr(skb)->daddr); \
unsigned char * src = (unsigned char *)&(ip_hdr(skb)->saddr); \
printk("[%s(%d)] This is DataPath. The dev name is %s\n", __FUNCTION__, __LINE__, skb->dev->name); \
int duii = 0; \
for(duii = 0; duii < 18; duii++) \
printk("%02X",skb->data[duii]); \
printk("\nSrc: %d.%d.%d.%d, Dest: %d.%d.%d.%d\n", src[0],src[1],src[2],src[3], dest[0],dest[1],dest[2],dest[3]); \
} \
}while(0)
#else
#define DATAPATH_DOWN_DEBUG_DUMP(skb)
#endif
#if 0
#define VLAN_DEBUG_PRINT(skb, format, arg...) do{ \
if(skb != NULL) \
{ \
if(skb->dev != NULL && (skb->dev->name[0] == 'p' || skb->dev->name[0] == 'n')) \
printk("[%s(%d)] Dev=%s "format"\n", __FUNCTION__, __LINE__, skb->dev->name, ##arg); \
} \
}while(0)
#else
#define VLAN_DEBUG_PRINT(skb, format, arg...)
#endif
#if 0
#define VLAN_DEBUG_DUMP(skb) do{ \
if(skb != NULL && skb->len >= 18) \
{ \
if(skb->dev != NULL && (skb->dev->name[0] == 'p' || skb->dev->name[0] == 'n')) \
{ \
printk("[%s(%d)] Receive a packet: Dev=%s\n", __FUNCTION__, __LINE__, skb->dev->name); \
int vii; \
for(vii = 0; vii < 18; vii++) \
printk("%02X", skb->data[vii]); \
printk("\n"); \
} \
} \
}while(0)
#else
#define VLAN_DEBUG_DUMP(skb)
#endif
#if 0
#define IGMP_DEBUG_PRINT(format, arg...) do{ \
printk("[%s(%d)] "format"\n", __FUNCTION__, __LINE__, ##arg); \
}while(0)
#else
#define IGMP_DEBUG_PRINT(format, arg...)
#endif
#if 0
#define IGMP_DEBUG_DUMP(skb) do{ \
if(skb != NULL && ip_hdr(skb)->protocol == IPPROTO_IGMP) \
{ \
printk("[%s(%d)] Receive a IGMP packet: \n", __FUNCTION__, __LINE__); \
unsigned char * src = (unsigned char *)&(ip_hdr(skb)->saddr); \
unsigned char * dest = (unsigned char *)&(ip_hdr(skb)->daddr); \
int iii; \
for(iii = 0; iii < skb->len; iii++) \
printk("%02X", skb->data[iii]); \
printk("\nSrcAddr: %d.%d.%d.%d, DestAddr: %d.%d.%d.%d.\n", src[0],src[1],src[2],src[3],dest[0],dest[1],dest[2],dest[3]); \
} \
}while(0)
#else
#define IGMP_DEBUG_DUMP(skb)
#endif
#endif /* __TP_DEBUG__ */