From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75F2DC169C4 for ; Tue, 29 Jan 2019 15:44:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C8A6214DA for ; Tue, 29 Jan 2019 15:44:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="COFD51zv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728131AbfA2PoZ (ORCPT ); Tue, 29 Jan 2019 10:44:25 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:41883 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726298AbfA2PoY (ORCPT ); Tue, 29 Jan 2019 10:44:24 -0500 Received: by mail-yw1-f68.google.com with SMTP id f65so8342754ywc.8 for ; Tue, 29 Jan 2019 07:44:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ScKq4/cVaos8KbgxY/ueBil1SXFn3YaSCj7Hb4wHddo=; b=COFD51zvlL2K7Ucpp6hSDi2X/LyYxuF4ptmolQzmURH/50q2UJfQ5QsnQvllNnSZKZ cMaZF8Z/FW3PBw5kJnELHDXf28Olvtp4gK2yV++81cmMP44Is75D8c6GP5EcBI4ghTy1 lGnt6FaRpOjEKpcTFqwpmjx/eQb9zSgwTAde/PS4bseuXV3OKtvM82RRuBo8QfOzIkaN Jtrwig3NGyRmYO5fnBo6lWAswauVdxMOy9o19ikvpZinrs3BKUC3TQhmYnYVqG7GGsLU ICn7m2BtKJvzhYdixEnsjHIkvRPHrTzw4ZFr1UGE83XT9UnNDnT87ICu9YTNU4eaInWv qn7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ScKq4/cVaos8KbgxY/ueBil1SXFn3YaSCj7Hb4wHddo=; b=C/E4vHjqvLeoxJ/dUIEGjJvt32N6JZOJfnl+zasdWwB+JiMBv5cPgRA3IgBoQ97IbU XTBJIYa7QBQNRDQqJlboXe0pEoDNQR8dOVg+EToKe3hbZ2uhB0Ud7hzs4DMome6yS/kP We1a14GPEbYneuP7nA2jZmwYwFOgtdAkMWuKSsRMFqqJRYqKEMwMbNes4jd4qLPtiyHF FSccVFi5Odk/fkIQ2t2/z4PltF2NDGeUU8CsBEdkpdO6N2/c/AKiPG578MSWwZ5TO8ki wjlGSBeIekOgHxw4ZpkCSz7wvAIIB6wZA//NputWFFf+6gSZEwhQK4hpFie4llQC2C+4 981g== X-Gm-Message-State: AJcUukdsvTdbVJTkR8/+EibqjpZmXMqBaYQmiwJDQZMW/afTuHtvtYuP eU2JrkpANweomVFrZuPJ9Wmw4YMk+AEYLc/EIH9AXHRFac0= X-Google-Smtp-Source: ALg8bN74bMw3NCkRCbzHwz3EEZx5PpVTxhiX29S3lAQ6lgCjSHstOqYKSZsquI72indOGku2qGn6tQpOSEx91qtwfpA= X-Received: by 2002:a81:8886:: with SMTP id y128mr25854881ywf.107.1548776663775; Tue, 29 Jan 2019 07:44:23 -0800 (PST) MIME-Version: 1.0 References: <1548587196-10746-1-git-send-email-xiangxia.m.yue@gmail.com> <1548587196-10746-2-git-send-email-xiangxia.m.yue@gmail.com> In-Reply-To: From: Or Gerlitz Date: Tue, 29 Jan 2019 17:44:12 +0200 Message-ID: Subject: Re: [PATCH net v4 2/2] net/mlx5e: Don't overwrite pedit action when multiple pedit used To: Tonghao Zhang Cc: Saeed Mahameed , Linux Netdev List , Or Gerlitz Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Jan 28, 2019 at 6:18 PM Tonghao Zhang wrote: > On Mon, Jan 28, 2019 at 11:34 PM Or Gerlitz wrote: > > On Mon, Jan 28, 2019 at 2:10 PM Tonghao Zhang wrote: > > > On Mon, Jan 28, 2019 at 12:40 AM Or Gerlitz wrote: > > > > > > > > On Sun, Jan 27, 2019 at 1:06 PM wrote: > > > > > From: Tonghao Zhang > > > > > > > > > > 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.. I suggest to remove this zeroing, otherwise the patch LGTM, once you fix it Reviewed-by: Or Gerlitz