Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp230183ybj; Wed, 6 May 2020 16:04:25 -0700 (PDT) X-Google-Smtp-Source: APiQypIYFP1YX6FGbC5WBY6TwpDYEMt5F/IwpJleL7PTOG+ysl24wGzBlUopgsKVfjNrhFqXTLyx X-Received: by 2002:a17:906:2b43:: with SMTP id b3mr9020166ejg.231.1588806265574; Wed, 06 May 2020 16:04:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588806265; cv=none; d=google.com; s=arc-20160816; b=QpKG547lzELy274qVmRrjcBv29SfPqE7fUEPdDH8PUfOVt4kP9XO4vVPgpsBrx/9Qa EX2DR6lhPFyAqHEU6F0hyoXcb6q5Ji3g+A+sVIRAd9VT/Sji308tgqCRHMObnx3whx+d /QixpK75gPY8KxO1xMMec246jrQ1cN/5kEqKhF3Q+WcSW4+cAsE/vPQ2JCGTzhK+OiZv FlS5lQtYI6OBPE99H9jlgO7nLs2dnt1rQdQk2ebyJG79X4HrvUjM58ypOQwXZTMKa5sf Po7dStJRRJ6RalbRlYS22lwEzcNBecF7IZY7F01MJ81hTvrDRdaBQZ7d8xnDeRpUBiQv t0bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:user-agent :mime-version:date:organization:references:in-reply-to:cc:to:from :subject:message-id:dkim-signature; bh=vLYsbiMJHe5P04qPfUk3182VS/dhNwaPh97sPV/RoeE=; b=T2LpgYJ7nXNkQwBv2IvSbqBYm9wxnMUtq2NBrBf4OzUPW3PYAUvvkU+NYpOtjf0bFX AF+UHOVbpk0SB41YjhEJZazBY83CPEDb02K5NrklpkA3fCqqFN+HL4p6QChfX45SWh+T wns4MXLxYt8KtFt9SsquHhnuf3PenjB+CJmCFFQ+NYzRxzfU4oIoBOwk1HFmv7junpFr 0Ab1XuNYKzMaKL/S2qUy45GMdgbDcIxWidJSnkdbrHTLvY/CNldaKCNZAVfDszv6b7Yc 1EVQZxkjhLbNm7IblwsT+6jH2PFjmQMfqs6pcAOJAD5TldaDrjrs11fenKt226YSrCoT p/+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XTt0rStr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y24si1986182edo.538.2020.05.06.16.04.02; Wed, 06 May 2020 16:04:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XTt0rStr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728631AbgEFMyf (ORCPT + 99 others); Wed, 6 May 2020 08:54:35 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:42383 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728081AbgEFMyf (ORCPT ); Wed, 6 May 2020 08:54:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588769674; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vLYsbiMJHe5P04qPfUk3182VS/dhNwaPh97sPV/RoeE=; b=XTt0rStrqdbSRRo4vFkjKyIZbcEWQ31GuFtL+SR5e9PkycxahpvNKiqub9KmXmKjl//64S 66UkQr6VJ/YpUTqTQBHgVqatkkYFyHQmZ69myxx7P2sCc8KielMULathczdEzNbwY0FjRE zgxxhHDEMQ8ho7gcjk5y95DUzs1FnZk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-1IP1S7pRMGCPFPFO13LZjQ-1; Wed, 06 May 2020 08:54:32 -0400 X-MC-Unique: 1IP1S7pRMGCPFPFO13LZjQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C783A468; Wed, 6 May 2020 12:54:30 +0000 (UTC) Received: from new-host-5 (unknown [10.40.194.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BA1C100EBA4; Wed, 6 May 2020 12:54:27 +0000 (UTC) Message-ID: <5fd2df286f6d5bf813361cc8c907a155976a5c82.camel@redhat.com> Subject: Re: [v4,iproute2-next 1/2] iproute2-next:tc:action: add a gate control action From: Davide Caratti To: Po Liu , dsahern@gmail.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: vinicius.gomes@intel.com, stephen@networkplumber.org, davem@davemloft.net, vlad@buslov.dev, claudiu.manoil@nxp.com, vladimir.oltean@nxp.com, alexandru.marginean@nxp.com In-Reply-To: <20200506084020.18106-1-Po.Liu@nxp.com> References: <20200503063251.10915-2-Po.Liu@nxp.com> <20200506084020.18106-1-Po.Liu@nxp.com> Organization: red hat Content-Type: text/plain; charset="UTF-8" Date: Wed, 06 May 2020 14:54:26 +0200 MIME-Version: 1.0 User-Agent: Evolution 3.36.1 (3.36.1-1.fc32) Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-05-06 at 16:40 +0800, Po Liu wrote: > Introduce a ingress frame gate control flow action. [...] hello Po Liu, [...] > +create_entry: > + e = create_gate_entry(gate_state, interval, > + ipv, maxoctets); > + if (!e) { > + fprintf(stderr, "gate: not enough memory\n"); > + free_entries(&gate_entries); > + return -1; > + } > + > + list_add_tail(&e->list, &gate_entries); > + entry_num++; > + > + } else if (matches(*argv, "reclassify") == 0 || > + matches(*argv, "drop") == 0 || > + matches(*argv, "shot") == 0 || > + matches(*argv, "continue") == 0 || > + matches(*argv, "pass") == 0 || > + matches(*argv, "ok") == 0 || > + matches(*argv, "pipe") == 0 || > + matches(*argv, "goto") == 0) { > + if (parse_action_control(&argc, &argv, > + &parm.action, false)) { > + free_entries(&gate_entries); > + return -1; > + } > + } else if (matches(*argv, "help") == 0) { > + usage(); > + } else { > + break; > + } > + > + argc--; > + argv++; > + } > + > + parse_action_control_dflt(&argc, &argv, &parm.action, > + false, TC_ACT_PIPE); it seems that the control action is parsed twice, and the first time it does not allow "jump" and "trap". Is that intentional? IOW, are there some "act_gate" configurations that don't allow jump or trap? I don't see anything similar in kernel act_gate.c, where tcf_gate_act() can return TC_ACT_SHOT or whatever is written in parm.action. That's why I'm asking, if these two control actions are forbidden you should let the kernel return -EINVAL with a proper extack in tcf_gate_init(). Can you please clarify? thank you in advance! -- davide