From: Hangbin Liu <liuhangbin@gmail.com>
To: Nikolay Aleksandrov <nikolay@nvidia.com>
Cc: netdev@vger.kernel.org, Jay Vosburgh <j.vosburgh@gmail.com>,
Veaceslav Falico <vfalico@gmail.com>,
Andy Gospodarek <andy@greyhouse.net>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH RFC net-next 3/5] bonding: add ip6_addr for bond_opt_value
Date: Thu, 27 Jan 2022 20:09:36 +0800 [thread overview]
Message-ID: <YfKLgL6qMDEQTS3Y@Laptop-X1> (raw)
In-Reply-To: <7501da6a-1956-6fcf-d55e-5a06a15eb0e3@nvidia.com>
On Thu, Jan 27, 2022 at 10:56:29AM +0200, Nikolay Aleksandrov wrote:
> You're right in that we shouldn't overload value. My point was that bond_opt_val is supposed to be generic,
> also it wouldn't work as expected for bond_opt_parse(). Perhaps a better solution would be to add a generic
> extra storage field and length and initialize them with a helper that copies the needed bytes there. As for
Not sure if I understand your suggestion correctly. Do you mean add a field
in bond_opt_value like:
#define MAX_LEN 128
struct bond_opt_value {
char *string;
u64 value;
u32 flags;
char extra[MAX_LEN];
};
And init it before using?
or define a char *extra and alloc/init the memory when using it?
Thanks
Hangbin
> value in that case you can just set it to 0, since all of this would be used internally the options which
> support this new extra storage would expect it and should error out if it's missing (wrong/zero length).
> Maybe something like:
> static inline void __bond_opt_init(struct bond_opt_value *optval,
> - char *string, u64 value)
> + char *string, u64 value,
> + void *extra, size_t extra_len)
>
> with sanity and length checks of course, and:
> +#define bond_opt_initextra(optval, extra, len) __bond_opt_init(optval, NULL, 0, extra, len)
>
> It is similar to your solution, but it can be used by other options to store larger values and
> it uses the value field as indicator that string shouldn't be parsed.
>
> There are other alternatives like using the bond_opt_val flags to denote what has been set instead
> of using the current struct field checks, but they would cause much more changes that seems
> unnecessary just for this case.
>
> Cheers,
> Nik
>
>
>
>
next prev parent reply other threads:[~2022-01-27 12:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-26 7:35 [PATCH RFC net-next 0/5] bonding: add IPv6 NS/NA monitor support Hangbin Liu
2022-01-26 7:35 ` [PATCH RFC net-next 1/5] ipv6: separate ndisc_ns_create() from ndisc_send_ns() Hangbin Liu
2022-01-26 7:35 ` [PATCH RFC net-next 2/5] Bonding: split bond_handle_vlan from bond_arp_send Hangbin Liu
2022-01-26 7:35 ` [PATCH RFC net-next 3/5] bonding: add ip6_addr for bond_opt_value Hangbin Liu
2022-01-26 11:35 ` Nikolay Aleksandrov
2022-01-27 7:02 ` Hangbin Liu
2022-01-27 8:56 ` Nikolay Aleksandrov
2022-01-27 12:09 ` Hangbin Liu [this message]
2022-01-27 12:14 ` Nikolay Aleksandrov
2022-01-28 8:04 ` Hangbin Liu
2022-01-26 7:35 ` [PATCH RFC net-next 4/5] bonding: add new parameter ns_targets Hangbin Liu
2022-01-26 7:35 ` [PATCH RFC net-next 5/5] bonding: add new option ns_ip6_target Hangbin Liu
2022-01-26 11:47 ` [PATCH RFC net-next 0/5] bonding: add IPv6 NS/NA monitor support Nikolay Aleksandrov
2022-01-27 7:13 ` Hangbin Liu
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=YfKLgL6qMDEQTS3Y@Laptop-X1 \
--to=liuhangbin@gmail.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=j.vosburgh@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=vfalico@gmail.com \
/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