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.1 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 2436DC282C8 for ; Mon, 28 Jan 2019 15:34:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D89572147A for ; Mon, 28 Jan 2019 15:34:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I4Eon0Vt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726851AbfA1PeZ (ORCPT ); Mon, 28 Jan 2019 10:34:25 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:42052 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726765AbfA1PeZ (ORCPT ); Mon, 28 Jan 2019 10:34:25 -0500 Received: by mail-yw1-f65.google.com with SMTP id x2so6858316ywc.9 for ; Mon, 28 Jan 2019 07:34: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=0B2IcDB9wSuwRDj/9dwSoWLCgl8tBHGaE9U326RQmqM=; b=I4Eon0VtStRuWE48QxE6jgFV0TN3YtE+T3Hov65IlZcOeJoBamvuGGnRb27N8IqOK3 q49vo5Dsh2k87yOSZYTXVa/stEbJZHcwlyupvdQ4YvBEj1IxARo6OnWh5bsa3QYYXHfa ULtcvonhdsiuXEiKdyiMIfuC0pG2DR+wD1h33SMnxg10dCX12jnaB6iFJ1zE39sokY2Z l45TqA69CDcTEHWrtt95Mnw6sl8bcV/wYY4j+53S+uJEV8jiz1bzO0ZCCSoGsigREPEU B0HyW/dHxz+at52pRKPrEcqHH0ME0Qcq0mHv6k3+9xIPHIi9nOwWnWDgSxF9V8pYJYVA l++w== 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=0B2IcDB9wSuwRDj/9dwSoWLCgl8tBHGaE9U326RQmqM=; b=nLrgErm86Dx93On8mQpR8BeZbvku12RA4FXI7m4ufyGi5wC/WLE/v2B8YxSglmrJM4 zMEs128+pXY//DgvPWVAk6DhNbOjI4Zx4tHDbMDwk3a2bV+inq0jZd2mCpnqswt76dVh hznkdJPXQe4aTUBogOYZCy42SMWAVAlU/bqsBc5VJ3CvziRI1K2e0GV1h8SEKtriJoVl hu5W1oq0R89Mf05H+m+S3zc/vOTucw1efDXA9mGrGZx/3rmjoWsqmVhE2Ml4DQagfIDt uNyKwWgsl7iGkbmfsaDfucwS85Li1+a+ui1wJlt+OQ8ih4GcHf8GM85/JR70ppV/sLeR NGug== X-Gm-Message-State: AJcUukcq6zgbk96wYPjLt9w+SyYNiwKujMWR0umTdJtrTC9NdPrIpFnZ m6g2489CT1TYkK8+ec9roOl71QyIY/ILTIdpmnE= X-Google-Smtp-Source: ALg8bN7+kswcclmuKEOvHYYFt+xEtBmz9VYsrjGhZt0zlF1rlf4qm2PmtqO0RMUtFNh8E+jGFKnhNheM1Cv7TL4UenI= X-Received: by 2002:a81:8886:: with SMTP id y128mr21727673ywf.107.1548689664241; Mon, 28 Jan 2019 07:34:24 -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: Mon, 28 Jan 2019 17:34:10 +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 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? [1] https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c#L179