Subject: Re[2]: calculation in UDP
To: None <netbsd@gve.ch>
From: Thomas Finneid <tfinneid@ifi.uio.no>
List: tech-net
Date: 12/08/2002 03:22:19
Yes I did find this, unfortunately it does not seem to do the work, at
least not for the payload of the udp packet (I just realised I might have
been a bit inconcise about that part in my original question). I did
measure it to check, and it only used 36 clock cycles on average (for 
packets sized from 128B to 9KB) and it is definately not checksumming the
payload. 

This is why I am asking the question, it basically does not add up. I am
using 1.6 and am assuming checksumming is turned on by default (as all
literature and experience has told us it should be). 


On Sat, 7 Dec 2002 14:57:46 +0100 netbsd@gve.ch wrote:

> hi,
> it seems the code is in the file sys/netinet/udp_usrreq.c
> in udp_output():
> 
>         /*
>          * Set up checksum and output datagram.
>          */
>                 ui->ui_sum = in_cksum_phdr(ui->ui_src.s_addr,
>                   ui->ui_dst.s_addr, htons((u_int16_t)len +
>                   sizeof(struct udphdr) + IPPROTO_UDP));
>                 m->m_pkthdr.csum_flags = M_CSUM_UDPv4;
>                 m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum);
> 
> 
> 
> On Sat, Dec 07, 2002 at 01:45:05PM +0100, Thomas Finneid wrote:
> > 
> > Hi
> > 
> > I am doing some analysis work on the network protocol stack, and are
> trying
> > to find out where in the code in_cksum is being called in a udp output
> > scenario. I have search the through the code and I found it for the
> input
> > chain of udp but not for output. I have also search through the web
> and the
> > mail but found nothing. Could any one be as kind as to point me in the
> > right direction, or give me an explenation of how checksumming is
> invoked
> > in udp output.
> > 
> > regards
> > 
> > -- 
> > Thomas Finneid
> > 
> > email: tfinneid@ifi.uio.no
> > 
> > 
> > 
> 
> --------------------------------------------------------------------
> Key fingerprint = D34A 577C 869B 28A2 3886  4298 50CB DC18 31A4 ACAD
> --------------------------------------------------------------------
> email: jmab@gve.ch / netbsd@gve.ch -- www.netbsd.org
> 

-- 
Thomas Finneid

email: tfinneid@ifi.uio.no