On Tue, Sep 16, 2003 at 06:22:17PM +0300, Nick Patavalis wrote: > On Tue, Sep 16, 2003 at 08:09:54AM -0700, Bluesea wrote: > > I've a question, does the Linux TCP/IP stack calculate > > the pseudo-header checksum if skb->ip_summed = > > CHECKSUM_HW, or leave it to the driver? > > Assuming that you are referring to the transmit path, and judging from > the impementation of the e100 driver, it seems that the kernel has > performed no checksum calculation if ip_summed == CHECKSUM_HW. Either > the hardware or the driver has to do it. In the case of e100, the > driver does the pseudo-header checksum calculation and the hardware > does the rest. > While this is what happens in the e100 driver, the kernel *does* seem to calculate the *pseudo-header checksum* even in the "skb->ip_summed == CHECKSUM_HW" case. For TCP packets this is done in "net/ipv4/tcp_ipv4.c:tcp_v4_send_check()" <reformated> /* This routine computes an IPv4 TCP checksum. */ void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, struct sk_buff *skb) { if (skb->ip_summed == CHECKSUM_HW) { th->check = ~tcp_v4_check(th, len, sk->saddr, sk->daddr, 0); skb->csum = offsetof(struct tcphdr, check); } else { th->check = tcp_v4_check(th, len, sk->saddr, sk->daddr, csum_partial((char *)th, th->doff<<2, skb->csum)); } } which is called via the "ipv4_specific" jumptable-structure initialized in: "net/ipv4/tcp_ipv4.c:" struct tcp_func ipv4_specific = { ip_queue_xmit, tcp_v4_send_check, tcp_v4_rebuild_header, Why the e100 driver recalculates the pseude-header checksum, I don't know. /npat -- Hey, maybe I could apply for a saint-hood from the Pope. Does somebody know what his email-address is? I'm so nice it makes you puke. -- Linus Torvalds - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html