From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
To: Or Gerlitz <gerlitz.or@gmail.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>,
Linux Netdev List <netdev@vger.kernel.org>,
Or Gerlitz <ogerlitz@mellanox.com>
Subject: Re: [PATCH net v4 2/2] net/mlx5e: Don't overwrite pedit action when multiple pedit used
Date: Wed, 30 Jan 2019 01:47:14 +0800 [thread overview]
Message-ID: <CAMDZJNVhDfmZ6OR5Pn3qDGAvq-4ZkcndoBwHWv6WCr9S-tZtuQ@mail.gmail.com> (raw)
In-Reply-To: <CAJ3xEMjHnoP8c17pki40vGs2S8xOSxP9Gm2RagtUxxBw_B7aLw@mail.gmail.com>
On Tue, Jan 29, 2019 at 11:44 PM Or Gerlitz <gerlitz.or@gmail.com> wrote:
>
> On Mon, Jan 28, 2019 at 6:18 PM Tonghao Zhang <xiangxia.m.yue@gmail.com> wrote:
> > On Mon, Jan 28, 2019 at 11:34 PM Or Gerlitz <gerlitz.or@gmail.com> wrote:
> > > On Mon, Jan 28, 2019 at 2:10 PM Tonghao Zhang <xiangxia.m.yue@gmail.com> wrote:
> > > > On Mon, Jan 28, 2019 at 12:40 AM Or Gerlitz <gerlitz.or@gmail.com> wrote:
> > > > >
> > > > > On Sun, Jan 27, 2019 at 1:06 PM <xiangxia.m.yue@gmail.com> wrote:
> > > > > > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > > > > >
> > > > > > In some case, we may use multiple pedit actions to modify packets.
> > > > > > The command shown as below: the last pedit action is effective.
> > > > >
> > > > > > @@ -2073,7 +2076,8 @@ static int alloc_mod_hdr_actions(struct mlx5e_priv *priv,
> > > > > > if (!parse_attr->mod_hdr_actions)
> > > > > > return -ENOMEM;
> > > > > >
> > > > > > - parse_attr->num_mod_hdr_actions = max_actions;
> > > > > > + parse_attr->max_mod_hdr_actions = max_actions;
> > > > > > + parse_attr->num_mod_hdr_actions = 0;
> > > > >
> > > > > why would we want to do this zeroing? what purpose does it serve?
> > > > Because we use the num_mod_hdr_actions to store the number of actions
> > > > we have parsed,
> > > > and when we alloc it, we init it 0 as default.
> > > >
> > > > > On a probably related note, I suspect that the patch broke the caching
> > > > > we do for modify header contexts, see mlx5e_attach_mod_hdr where we
> > > > > look if a given set of modify header operations already has hw modify header
> > > > > context and we use it.
> > > > >
> > > > > To test that, put two tc rules with different matching but same set of
> > > > > modify header
> > > > > (pedit) actions and see that only one modify header context is used.
> > >
> > > > The patch does't break the cache, I think that different matching may
> > > > share the same set of pedit actions.
> > >
> > > I suspect it does break it.. at [1] we have this code for the cache lookup:
> > >
> > > num_actions = parse_attr->num_mod_hdr_actions;
> > > [..]
> > > key.actions = parse_attr->mod_hdr_actions;
> > > key.num_actions = num_actions;
> > >
> > > hash_key = hash_mod_hdr_info(&key);
> > >
> > > so we are doing the cached insertion and lookup with
> > > parse_attr->num_mod_hdr_actions
> > > which was zeroed along the way and not accounting for the full set of
> > > pedit actions, agree?
>
> > not really, before calling the mlx5e_attach_mod_hdr, we have call
> > the offload_pedit_fields that will
> > update the attr->num_mod_hdr_actions that indicate how many pedit
> > action we parsed.
>
> ok, got you, so why do we need this line
>
> parse_attr->num_mod_hdr_actions = 0;
>
> in alloc_mod_hdr_actions()? this should be zero
> by kzalloc somewhere, it got to confuse me..
yes, should be removed
> I suggest to remove this zeroing, otherwise the patch LGTM, once you fix it
>
> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
next prev parent reply other threads:[~2019-01-29 17:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-27 11:06 [PATCH net v4 1/2] net/mlx5e: Update hw flows when encap source mac changed xiangxia.m.yue
2019-01-27 11:06 ` [PATCH net v4 2/2] net/mlx5e: Don't overwrite pedit action when multiple pedit used xiangxia.m.yue
2019-01-27 16:39 ` Or Gerlitz
2019-01-28 12:09 ` Tonghao Zhang
2019-01-28 15:34 ` Or Gerlitz
2019-01-28 16:18 ` Tonghao Zhang
2019-01-29 15:44 ` Or Gerlitz
2019-01-29 17:47 ` Tonghao Zhang [this message]
2019-01-27 16:32 ` [PATCH net v4 1/2] net/mlx5e: Update hw flows when encap source mac changed Or Gerlitz
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=CAMDZJNVhDfmZ6OR5Pn3qDGAvq-4ZkcndoBwHWv6WCr9S-tZtuQ@mail.gmail.com \
--to=xiangxia.m.yue@gmail.com \
--cc=gerlitz.or@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=saeedm@mellanox.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;
as well as URLs for NNTP newsgroup(s).