Index: /branches/rel_apv_10_7/usr/src/sys/click/app/slb/slb.h
===================================================================
--- /branches/rel_apv_10_7/usr/src/sys/click/app/slb/slb.h	(revision 38571)
+++ /branches/rel_apv_10_7/usr/src/sys/click/app/slb/slb.h	(working copy)
@@ -1624,6 +1624,14 @@
 	TAILQ_HEAD(, _orch_policy) orch_backward_policy_list_head;
 	uint32_t orch_attched_l4service_id;
 	uint8_t dns_ecs_enable;
+
+	/* trace syn drop */
+	uint64_t tcps_syndrop_oursinuse;
+	uint64_t tcps_syndrop_maxconnection;
+	uint64_t tcps_syndrop_getmss;
+	uint64_t tcps_syndrop_badmss;
+	uint64_t tcps_syndrop_eroute;
+	uint64_t tcps_synroutebsd;
 } slb_vs_t;
 
 typedef struct _slb_snmp_oid{
Index: /branches/rel_apv_10_7/usr/src/sys/click/app/slb/slb_vs_policy.c
===================================================================
--- /branches/rel_apv_10_7/usr/src/sys/click/app/slb/slb_vs_policy.c	(revision 38571)
+++ /branches/rel_apv_10_7/usr/src/sys/click/app/slb/slb_vs_policy.c	(working copy)
@@ -485,6 +485,15 @@
 		buf += sprintf(buf, " %s", vs_p->redir_url?vs_p->redir_url:"");*/
 	buf += sprintf(buf,"\n");
 
+	/* TCP Related Info for individual Virtual Service */
+	buf += sprintf(buf,"\t drop %ju syns by ours in use\n", vs_p->tcps_syndrop_oursinuse);
+	buf += sprintf(buf,"\t drop %ju syns by over max connection\n", vs_p->tcps_syndrop_maxconnection);
+	buf += sprintf(buf,"\t drop %ju syns by get mss error\n", vs_p->tcps_syndrop_getmss);
+	buf += sprintf(buf,"\t drop %ju syns by bad mss size\n", vs_p->tcps_syndrop_badmss);
+	buf += sprintf(buf,"\t drop %ju syns by eroute error\n", vs_p->tcps_syndrop_eroute);
+	buf += sprintf(buf,"\t route %ju syns to system stack\n", vs_p->tcps_synroutebsd);
+	buf += sprintf(buf,"\n");
+
 	/* if the virtual is disabled, print that here */
 	if (vs_p->flags & SLB_VS_DISABLED)
 		buf += sprintf(buf, "slb virtual disable \"%s\"\n", vs_p->name);
Index: /branches/rel_apv_10_7/usr/src/sys/click/netinet/click_input.c
===================================================================
--- /branches/rel_apv_10_7/usr/src/sys/click/netinet/click_input.c	(revision 38571)
+++ /branches/rel_apv_10_7/usr/src/sys/click/netinet/click_input.c	(working copy)
@@ -9337,6 +9337,9 @@
 	s_data[2] = NULL;/* vs for slb */
 	s_data[3] = NULL;/* bound_pcb for fwd */
 	ours = clicktcp_is_ours(m, s_data, &eroute_rule, ww_res, isipv6);
+	
+	vs = (slb_vs_t *)s_data[2];
+	
 	/* bug 12169, zhangwy, 2005/12/02*/
 	if (ours == OURS_DOWN) {
 		if(!isipv6) {
@@ -9371,6 +9374,12 @@
 		click_route_packet_ww(m, eroute_rule, WW_CHECKED, isipv6);
 		return 0;
 	}
+	
+	if (ours == OURS_YES) {
+		if (vs != NULL) {
+			vs->tcps_synroutebsd++;
+		}
+	}
 
 	if (ours == OURS_INUSE) { /* ours, but for an existing connection */
 		if(!isipv6) {
@@ -9379,6 +9388,11 @@
 		}
 		
 		clicktcpstat.tcps_syndrop_oursinuse++;
+
+		if (vs != NULL) {
+			vs->tcps_syndrop_oursinuse++;
+		}
+
 		m_freem_atcp(m);
 		return 0;
 	}
@@ -9392,6 +9406,11 @@
 		}
 
 	    clicktcpstat.tcps_syndrop_maxconnection++;
+
+		if (vs != NULL) {
+			vs->tcps_syndrop_maxconnection++;
+		}
+
 		m_freem_atcp(m);
 		return 1;
 	}
@@ -10784,6 +10803,9 @@
 	uint32_t temp_m_flags;
 	uint32_t l4device_id;
 
+	slb_vs_t *vs = NULL;
+	vs = (slb_vs_t *)s_data[2];
+
 	ip6 = mtod(m, struct ip6_hdr *);
 
 	/* syn_cache insert */
@@ -10810,6 +10832,11 @@
 	/*keep same behavior with syncookie*/
 	if(to.to_mss < CLICKTCP_ACCEPTABLE_MIN_MSS) {
 		clicktcpstat.tcps_syndrop_badmss++;
+
+		if (vs != NULL) {
+			vs->tcps_syndrop_badmss++;
+		}
+
 		m_freem_atcp(m);
 		return 1;
 	}
@@ -10860,6 +10887,11 @@
 
 	if (eroute_rule == NULL) {
 		clicktcpstat.tcps_syndrop_eroute++;
+
+		if (vs != NULL) {
+			vs->tcps_syndrop_eroute++;
+		}
+
 		m_freem_atcp(syn_ack_mbuf);
 		return 1;
 	}
@@ -10899,6 +10931,9 @@
 	uint32_t temp_m_flags;
 	uint32_t l4device_id;
 
+	slb_vs_t *vs = NULL;
+	vs = (slb_vs_t *)s_data[2];
+
 	/* syn_cache insert */
 	ip = mtod(m, struct ip *);
 	th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2));
@@ -10924,6 +10959,11 @@
 	/*keep same behavior with syncookie*/
 	if(to.to_mss < CLICKTCP_ACCEPTABLE_MIN_MSS) {
 		clicktcpstat.tcps_syndrop_badmss++;
+
+		if (vs != NULL) {
+			vs->tcps_syndrop_badmss++;
+		}
+
 		m_freem_atcp(m);
 		return 1;
 	}
@@ -10976,6 +11016,11 @@
 		ATCP_DEBUG_SYN_STAT((mtod(syn_ack_mbuf, struct ip *)->ip_src.s_addr),
 		                    syn_stat_array[curatcp].syn_stat_syncache_no_eroute);
 		clicktcpstat.tcps_syndrop_eroute++;
+
+		if (vs != NULL) {
+			vs->tcps_syndrop_eroute++;
+		}
+
 		m_freem_atcp(syn_ack_mbuf);
 		return 1;
 	}
@@ -11317,6 +11362,9 @@
 	int mss;
 	u_int32_t tmp_cookie;
 
+	slb_vs_t *vs = NULL;
+	vs = (slb_vs_t *)s_data[2];
+
 	ATCP_DEBUG_SYN_STAT((mtod(m, struct ip *)->ip_src.s_addr),
 	                    syn_stat_array[curatcp].syn_stat_syncookie_total);
 
@@ -11327,6 +11375,11 @@
 		ATCP_DEBUG_SYN_STAT((mtod(m, struct ip *)->ip_src.s_addr),
 		                    syn_stat_array[curatcp].syn_stat_syncookie_negative_mss);
 		clicktcpstat.tcps_syndrop_getmss++;
+
+		if (vs != NULL) {
+			vs->tcps_syndrop_getmss++;
+		}
+
 		m_freem_atcp(m);
 		return 1;
 	}
@@ -11345,6 +11398,11 @@
 		ATCP_DEBUG_SYN_STAT((mtod(m, struct ip *)->ip_src.s_addr),
 		                    syn_stat_array[curatcp].syn_stat_syncookie_bad_mss);
 			clicktcpstat.tcps_syndrop_badmss++;
+
+		if (vs != NULL) {
+			vs->tcps_syndrop_badmss++;
+		}
+
 		m_freem_atcp(m);
 		return 1;
 	}
@@ -11376,6 +11434,11 @@
 		ATCP_DEBUG_SYN_STAT((mtod(m, struct ip *)->ip_src.s_addr),
 		                    syn_stat_array[curatcp].syn_stat_syncookie_no_eroute);
 		clicktcpstat.tcps_syndrop_eroute++;
+
+		if (vs != NULL) {
+			vs->tcps_syndrop_eroute++;
+		}
+
 		m_freem_atcp(m);
 		return 1;
 	}
Index: /branches/rel_apv_10_7/usr/src/sys/click/netinet6/click6_input.c
===================================================================
--- /branches/rel_apv_10_7/usr/src/sys/click/netinet6/click6_input.c	(revision 38571)
+++ /branches/rel_apv_10_7/usr/src/sys/click/netinet6/click6_input.c	(working copy)
@@ -661,6 +661,9 @@
 	u_int32_t	tmp_cookie;
         struct eroute_rule *eroute_rule;
 
+	slb_vs_t *vs = NULL;
+	vs = (slb_vs_t *)s_data[2];
+
 	mss = get_mss(m, tcph, TCP6_MSS);
 	if (mss < 0) {
 		/*
@@ -685,6 +688,11 @@
 		 * syn_stat_array[curatcp].syn_stat_syncookie_bad_mss);
 		 */
 		clicktcpstat.tcps_syndrop_badmss++;
+
+		if (vs != NULL) {
+			vs->tcps_syndrop_badmss++;
+		}
+
 		m_freem(m);
 		return 1;
 	}
