DCCP protocol discussions
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: dccp@vger.kernel.org
Subject: Re: [PATCH 1/11]: Auxiliary function for smallest-fit option
Date: Mon, 01 Oct 2007 14:47:51 +0000	[thread overview]
Message-ID: <20071001144751.GB5648@ghostprotocols.net> (raw)
In-Reply-To: <200710011518.11436@strip-the-willow>

Em Mon, Oct 01, 2007 at 03:18:11PM +0100, Gerrit Renker escreveu:
> [DCCP]: Auxiliary function for smallest-fit option lengths
> 
> This introduces a function to determine the smallest-fit data type to carry options,
> which is used by the feature-negotiation code to insert option values.
> 
> While doing this, I found that the same code is required to set the NDP length,
> whose length is variable between 1..6 bytes (RFC 4340, 7.7). 
> 
> There seem to be remains of the old code base when apparently NDP count was only 3 
> bytes long. I have removed the annotations, as well as an unused constant limiting
> the maximum NDP value to 3 bytes, and added a FIXME to increase the data type for
> NDP up to u64. I didn't want to add this to this patch also, since various other
> parts (e.g. CCID3) implicitly rely on u32. For the moment, u32 seems to more than
> ample anyway, so the FIXME could even remain until there is a `high-speed' CCID.
> 
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
> ---
>  include/linux/dccp.h |    4 +---
>  net/dccp/feat.h      |    8 ++++++++
>  net/dccp/options.c   |   13 ++++++-------
>  3 files changed, 15 insertions(+), 10 deletions(-)
> 
> --- a/net/dccp/feat.h
> +++ b/net/dccp/feat.h
> @@ -112,4 +112,12 @@ extern int  dccp_feat_clone(struct sock 
>  extern int  dccp_feat_clone_list(struct list_head const *, struct list_head *);
>  extern int  dccp_feat_init(struct sock *sk);
>  
> +/* Find smallest-fit for @value, but not more than 6 bytes (current maximum) */
> +static inline u8 dccp_bytes_per_value(const u64 value)
> +{
> +	if (value > 0xFFFFFFFFull)
> +		return 6;
> +	return value > 0xFFFF? 4 : (value > 0xFF? 2 : 1);

Gerrit, one more coding style request: please always add an space after
the '?'.

- Arnaldo

  reply	other threads:[~2007-10-01 14:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-01 14:18 [PATCH 1/11]: Auxiliary function for smallest-fit option lengths Gerrit Renker
2007-10-01 14:47 ` Arnaldo Carvalho de Melo [this message]
2007-10-01 17:33 ` Gerrit Renker
2007-10-01 20:14 ` Ian McDonald

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=20071001144751.GB5648@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=dccp@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox