From: Jiri Benc <jbenc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: "Yang, Yi" <yi.y.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org"
<dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org>,
"netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"e@erig.me" <e@erig.me>,
"davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org"
<davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Subject: Re: [PATCH net-next v7] openvswitch: enable NSH support
Date: Tue, 5 Sep 2017 11:46:45 +0200 [thread overview]
Message-ID: <20170905114645.33bf0e32@griffin> (raw)
In-Reply-To: <20170905055144.GA88800-re2EX8HDrk21gSHoDXDV2kEOCMrvLtNR@public.gmane.org>
On Tue, 5 Sep 2017 13:51:45 +0800, Yang, Yi wrote:
> But if we follow your way, how does nla_for_each_nested handle such
> pattern?
>
> attribute1
> attribute1_mask
> attribute2
> attribute2_mask
> attribute3
> attribute3_mask
Uh? That will just work. Note that nla len contains the size of the
whole attribute, i.e. includes both fields.
> I don't think this can increase performance and readability.
Do you realize you're stating that not copying data around in hot path
can't increase performance? ;-)
> if we use one function to handle both attributes and masks, I can't
> see any substantial difference between two ways as far as the
> performance is concerned.
Except that what you did is so unexpected to netlink that you had to go
out of your way to parse it. Those two memcpys speak for themselves.
> If we consider OVS_KEY_ATTR_NSH as a big attribute, current way is
> precisely following current design pattern
Do you have an idea how nested netlink attributes work? It's very well
defined. What you're doing is breaking the definition. You can't do
that.
The (non-nested) attributes contain header followed by data. The data
is a single value or it is a struct. In ovs for masked actions,
attributes contain a struct of two fields (value and mask). The struct
access is open coded but it's still a struct.
Now, nested attributes are very well defined: it's a nla header
followed by a stream of attributes. There's no requirement on the order
of the attributes. Do you see how you're breaking this assumption? You
expect that each attribute is present exactly twice, once among first
half of attributes, once among second half of attributes. You don't
check that this weird assumption is adhered to. You don't even check
that the point where you split the data is between attributes! You may
very well be splitting an attribute in half and interpreting its data
as nla headers.
Consider your proposal NACKed from my side.
Jiri
next prev parent reply other threads:[~2017-09-05 9:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-30 12:39 [PATCH net-next v7] openvswitch: enable NSH support Yi Yang
[not found] ` <1504096752-102003-1-git-send-email-yi.y.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-08-31 10:45 ` Jiri Benc
2017-09-04 8:00 ` Yang, Yi
[not found] ` <20170904080005.GA70767-re2EX8HDrk21gSHoDXDV2kEOCMrvLtNR@public.gmane.org>
2017-09-04 10:42 ` Jiri Benc
2017-09-04 12:09 ` Yang, Yi
2017-09-04 12:57 ` Jiri Benc
2017-09-05 5:51 ` Yang, Yi
[not found] ` <20170905055144.GA88800-re2EX8HDrk21gSHoDXDV2kEOCMrvLtNR@public.gmane.org>
2017-09-05 9:46 ` Jiri Benc [this message]
2017-09-05 11:03 ` Yang, Yi
2017-09-04 12:57 ` Jan Scheurich
[not found] ` <CFF8EF42F1132E4CBE2BF0AB6C21C58D787F4E84-hqolJogE5njKJFWPz4pdheaU1rCVNFv4@public.gmane.org>
2017-09-04 13:16 ` Jiri Benc
2017-09-04 14:07 ` Jan Scheurich
[not found] ` <CFF8EF42F1132E4CBE2BF0AB6C21C58D787F4EEB-hqolJogE5njKJFWPz4pdheaU1rCVNFv4@public.gmane.org>
2017-09-04 14:13 ` Jiri Benc
2017-09-04 14:45 ` Jan Scheurich
2017-09-05 9:49 ` Jiri Benc
2017-09-05 10:36 ` Jan Scheurich
2017-09-05 6:37 ` Yang, Yi
2017-09-05 9:47 ` Jiri Benc
2017-09-05 10:57 ` Yang, Yi
2017-09-08 6:13 ` Yang, Yi
2017-09-04 13:10 ` Jiri Benc
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=20170905114645.33bf0e32@griffin \
--to=jbenc-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org \
--cc=e@erig.me \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=yi.y.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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;
as well as URLs for NNTP newsgroup(s).