Lines Matching refs:tcph
38 #define TCP_HDR_LEN(tcph) (tcph->doff << 2) argument
40 #define TCP_PAYLOAD_LENGTH(iph, tcph) \ argument
41 (ntohs(iph->tot_len) - IP_HDR_LEN(iph) - TCP_HDR_LEN(tcph))
55 static int lro_tcp_ip_check(const struct iphdr *iph, const struct tcphdr *tcph, in lro_tcp_ip_check() argument
62 if (TCP_PAYLOAD_LENGTH(iph, tcph) == 0) in lro_tcp_ip_check()
68 if (tcph->cwr || tcph->ece || tcph->urg || !tcph->ack || in lro_tcp_ip_check()
69 tcph->rst || tcph->syn || tcph->fin) in lro_tcp_ip_check()
75 if (tcph->doff != TCPH_LEN_WO_OPTIONS && in lro_tcp_ip_check()
76 tcph->doff != TCPH_LEN_W_TIMESTAMP) in lro_tcp_ip_check()
80 if (tcph->doff == TCPH_LEN_W_TIMESTAMP) { in lro_tcp_ip_check()
81 __be32 *topt = (__be32 *)(tcph + 1); in lro_tcp_ip_check()
106 struct tcphdr *tcph = lro_desc->tcph; in lro_update_tcp_ip_header() local
110 tcph->ack_seq = lro_desc->tcp_ack; in lro_update_tcp_ip_header()
111 tcph->window = lro_desc->tcp_window; in lro_update_tcp_ip_header()
114 p = (__be32 *)(tcph + 1); in lro_update_tcp_ip_header()
121 tcph->check = 0; in lro_update_tcp_ip_header()
122 tcp_hdr_csum = csum_partial(tcph, TCP_HDR_LEN(tcph), 0); in lro_update_tcp_ip_header()
124 tcph->check = csum_tcpudp_magic(iph->saddr, iph->daddr, in lro_update_tcp_ip_header()
130 static __wsum lro_tcp_data_csum(struct iphdr *iph, struct tcphdr *tcph, int len) in lro_tcp_data_csum() argument
136 tcp_csum = ~csum_unfold(tcph->check); in lro_tcp_data_csum()
137 tcp_hdr_csum = csum_partial(tcph, TCP_HDR_LEN(tcph), tcp_csum); in lro_tcp_data_csum()
140 len + TCP_HDR_LEN(tcph), in lro_tcp_data_csum()
148 struct iphdr *iph, struct tcphdr *tcph) in lro_init_desc() argument
152 u32 tcp_data_len = TCP_PAYLOAD_LENGTH(iph, tcph); in lro_init_desc()
158 lro_desc->tcph = tcph; in lro_init_desc()
159 lro_desc->tcp_next_seq = ntohl(tcph->seq) + tcp_data_len; in lro_init_desc()
160 lro_desc->tcp_ack = tcph->ack_seq; in lro_init_desc()
161 lro_desc->tcp_window = tcph->window; in lro_init_desc()
166 if (tcph->doff == 8) { in lro_init_desc()
167 ptr = (__be32 *)(tcph+1); in lro_init_desc()
176 lro_desc->data_csum = lro_tcp_data_csum(iph, tcph, in lro_init_desc()
186 struct tcphdr *tcph, int tcp_data_len) in lro_add_common() argument
194 lro_desc->tcp_window = tcph->window; in lro_add_common()
195 lro_desc->tcp_ack = tcph->ack_seq; in lro_add_common()
199 topt = (__be32 *) (tcph + 1); in lro_add_common()
204 lro_tcp_data_csum(iph, tcph, in lro_add_common()
215 struct iphdr *iph, struct tcphdr *tcph) in lro_add_packet() argument
218 int tcp_data_len = TCP_PAYLOAD_LENGTH(iph, tcph); in lro_add_packet()
220 lro_add_common(lro_desc, iph, tcph, tcp_data_len); in lro_add_packet()
236 struct tcphdr *tcph) in lro_check_tcp_conn() argument
240 (lro_desc->tcph->source != tcph->source) || in lro_check_tcp_conn()
241 (lro_desc->tcph->dest != tcph->dest)) in lro_check_tcp_conn()
249 struct tcphdr *tcph) in lro_get_desc() argument
259 if (!lro_check_tcp_conn(tmp, iph, tcph)) { in lro_get_desc()
299 struct tcphdr *tcph; in __lro_proc_skb() local
304 lro_mgr->get_skb_header(skb, (void *)&iph, (void *)&tcph, in __lro_proc_skb()
311 lro_desc = lro_get_desc(lro_mgr, lro_mgr->lro_arr, iph, tcph); in __lro_proc_skb()
320 if (lro_tcp_ip_check(iph, tcph, skb->len - vlan_hdr_len, NULL)) in __lro_proc_skb()
324 lro_init_desc(lro_desc, skb, iph, tcph); in __lro_proc_skb()
329 if (lro_desc->tcp_next_seq != ntohl(tcph->seq)) in __lro_proc_skb()
332 if (lro_tcp_ip_check(iph, tcph, skb->len, lro_desc)) in __lro_proc_skb()
335 lro_add_packet(lro_desc, skb, iph, tcph); in __lro_proc_skb()