All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, nicolas.dichtel@6wind.com,
	johannes@sipsolutions.net, fw@strlen.de, pablo@netfilter.org,
	mkubecek@suse.cz, aleksander.lobakin@intel.com
Subject: Re: [RFC] netlink: add variable-length / auto integers
Date: Wed, 11 Oct 2023 19:01:53 +0200	[thread overview]
Message-ID: <ZSbVASHPVoNfWwce@nanopsycho> (raw)
In-Reply-To: <20231011091624.4057e456@kernel.org>

Wed, Oct 11, 2023 at 06:16:24PM CEST, kuba@kernel.org wrote:
>On Wed, 11 Oct 2023 15:46:47 +0200 Jiri Pirko wrote:
>> >Thoughts?  
>> 
>> Hmm, I assume that genetlink.yaml schema should only allow uint and sint
>> to be defined after this, so new genetlink implementations use just uint
>> and sint, correct?
>
>No, fixed types are still allowed, just discouraged.

Why? Is there goint to be warn in ynl gen?

>
>> Than we have genetlink.yaml genetlink-legacy.yaml genetlink-legacy2.yaml
>> ?
>> I guess in the future there might be other changes to require new
>> implemetation not to use legacy things. How does this scale?
>>
>> >This is completely untested. YNL to follow.
>> >---
>> > include/net/netlink.h        | 62 ++++++++++++++++++++++++++++++++++--
>> > include/uapi/linux/netlink.h |  5 +++
>> > lib/nlattr.c                 |  9 ++++++
>> > net/netlink/policy.c         | 14 ++++++--
>> > 4 files changed, 85 insertions(+), 5 deletions(-)
>> >
>> >diff --git a/include/net/netlink.h b/include/net/netlink.h
>> >index 8a7cd1170e1f..523486dfe4f3 100644
>> >--- a/include/net/netlink.h
>> >+++ b/include/net/netlink.h
>> >@@ -183,6 +183,8 @@ enum {
>> > 	NLA_REJECT,
>> > 	NLA_BE16,
>> > 	NLA_BE32,
>> >+	NLA_SINT,  
>> 
>> Why not just NLA_INT?
>
>Coin toss. Signed types are much less common in netlink
>so it shouldn't matter much.
>
>> >+static inline int nla_put_uint(struct sk_buff *skb, int attrtype, u64 value)
>> >+{
>> >+	u64 tmp64 = value;
>> >+	u32 tmp32 = value;
>> >+
>> >+	if (tmp64 == tmp32)
>> >+		return nla_put_u32(skb, attrtype, tmp32);  
>> 
>> It's a bit confusing, perheps better just to use nla_put() here as well?
>
>I want to underscore the equivalency to u32 for smaller types.

  parent reply	other threads:[~2023-10-11 17:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11  0:33 [RFC] netlink: add variable-length / auto integers Jakub Kicinski
2023-10-11  3:20 ` kernel test robot
2023-10-11 13:11 ` Johannes Berg
2023-10-11 14:03   ` Nicolas Dichtel
2023-10-11 15:52     ` Jakub Kicinski
2023-10-11 16:01       ` Johannes Berg
2023-10-11 16:45         ` Stephen Hemminger
2023-10-12  9:26           ` David Laight
2023-10-12  6:47       ` Nicolas Dichtel
2023-10-11 16:08   ` Jakub Kicinski
2023-10-11 16:16     ` Johannes Berg
2023-10-11 16:19       ` Jakub Kicinski
2023-10-11 13:46 ` Jiri Pirko
2023-10-11 16:16   ` Jakub Kicinski
2023-10-11 16:21     ` Johannes Berg
2023-10-11 16:34       ` Jakub Kicinski
2023-10-11 16:37         ` Johannes Berg
2023-10-11 17:01     ` Jiri Pirko [this message]
2023-10-11 20:21       ` Jakub Kicinski
2023-10-12 12:36 ` kernel test robot
2023-10-14 12:35 ` kernel test robot

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=ZSbVASHPVoNfWwce@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=aleksander.lobakin@intel.com \
    --cc=fw@strlen.de \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=pablo@netfilter.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.