All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, kaber@coreworks.de, jmorris@namei.org
Subject: Re: [ PATCH 2.6.17-rc6 1/1] udp.c: counting InDatagrams which are never delivered
Date: Mon, 12 Jun 2006 07:02:45 +0100	[thread overview]
Message-ID: <200606120702.46014@strip-the-willow> (raw)
In-Reply-To: <20060611.212913.70218067.davem@davemloft.net>

Quoting David Miller:
|  
|  > Fix:   Move the `UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS)' statement from 
|  >        udp_queue_rcv_skb to udp_recvmsg. Now InDatagrams only counts those
|  >        datagrams which were really delivered (as per RFC 2013). 
|  > 
|  
|  Unfortunately this breaks NFS and other in-kernel UDP socket usages,
|  which never call recvmsg() and instead take the packet via the
|  ->data_ready() callback done by sock_queue_receive_skb().
|  
|  Your patch will make the counter never get incremented when such
|  a user is using the UDP socket.
|  
|  Probably a better way to handle this is to correct the
|  INDATAGRAMS value by decrementing it when we notice that
|  the checksum is incorrect in a deferred manner.
This is clearly preferable - would it look like this:

csum_copy_err:
     UDP_INC_STATS_BH(UDP_MIB_INERRORS);
     UDP_DEC_STATS_BH(UDP_MIB_INDATAGRAMS); /* requires new macro */

     skb_kill_datagram(sk, skb, flags);
     /* ... */

in udp_recvmsg? Here I must pass - there is no xxx_DEC_BH macro in 
include/net/snmp.h and I don't know whether the following guess is correct:

#define SNMP_DEC_STATS_BH(mib, field) 	\
	(per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]--)

If this is correct, then it seems done; one could use this macro or add
a corresponding UDP_DEC_STATS_BH to include/net/udp.h .




  reply	other threads:[~2006-06-12  6:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-06 18:25 [ PATCH 2.6.17-rc6 1/1] udp.c: counting InDatagrams which are never delivered Gerrit Renker
2006-06-12  4:29 ` David Miller
2006-06-12  6:02   ` Gerrit Renker [this message]
2006-06-12  6:13     ` David Miller
2006-06-12  7:22       ` Gerrit Renker
2006-06-12  6:18   ` Herbert Xu
2006-06-12  6:49     ` David Miller
2006-06-12  7:43       ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200606120702.46014@strip-the-willow \
    --to=gerrit@erg.abdn.ac.uk \
    --cc=davem@davemloft.net \
    --cc=jmorris@namei.org \
    --cc=kaber@coreworks.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.