Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4219272rwr; Mon, 8 May 2023 04:56:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6KQpXuwPK/xAccsCoujO3vdgeDS0SGErCPYgRTWEV7sGQhxcxguKLR8V0OUbOstUEWtyYo X-Received: by 2002:a17:903:1252:b0:1aa:f0a7:933 with SMTP id u18-20020a170903125200b001aaf0a70933mr12708432plh.25.1683547003494; Mon, 08 May 2023 04:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683547003; cv=none; d=google.com; s=arc-20160816; b=bXTM6cybc4SXozFIcFhZrwEQHa3jPH4RriEPN0D5gBFrECXEyKUVc77ZCmgHCW9+PB QKqW12H0HI78CZ2E+pK8J1Rif7XL4NskHdolI/Sdzfs7T1Zpgn4IQ9z6EKIAr/C4eAOa 4qOCjU0nZQ/iCcF8k1HZKn+1NPZ9a7fIvQXL5C7aqPh/BHyM5AKX4VY2m5sjQ/wpRr4M 4i2YJKUJpBQV6yo91nQ5brHJgpNZvcltYnnPU9qO38WFmiAf77XOpd3WUpVe9vWvVVnY q3J34s3l6dMUKavaZihC94wPxRxw4qBCDOmJrJrPCcqDUk7W/3Eaunjb8664ayKhWX5t CSbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=4ac1PyFGzSyD65jA/7/m9p7M+ymxiLTtNuhIFAnIl/Q=; b=lFItz8Dl9f2Q8zpzph0vIjOvY6IdXkKB6r44VZcn5Ds576XOT4OePEFYcHyBMd4xtc qbJP5Eofn1SW1NZBNsYjyrcLzfhfACLJIP6qC2uKkWzJWvy/SA6mMP00+O7uiRpfi9ph WSEiHOlFCeqn/UFf4uj3TDpDPwWbGdAgZsi1Gz8EkSYTT89cnAu+MGdA51SZ17u/kJMT fG1VIUrH6RY/yDo4SlFb0wxciwwdTEx4UqAXDw9Aqx0PL1ETqVjoobCDXaZwHzhRO2g2 IR+2kri/ZDWb9MFwx/fVuzFhAoGY4OGIDFvr+bBE9+qbVx88y8MuwuKm+sp49PwvfdyO MaWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mojatatu-com.20221208.gappssmtp.com header.s=20221208 header.b=bFHVtn+8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a17090aba8a00b002501b512f6fsi8821225pjr.33.2023.05.08.04.56.31; Mon, 08 May 2023 04:56:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mojatatu-com.20221208.gappssmtp.com header.s=20221208 header.b=bFHVtn+8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235658AbjEHLYW (ORCPT + 99 others); Mon, 8 May 2023 07:24:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235701AbjEHLYL (ORCPT ); Mon, 8 May 2023 07:24:11 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3058B3A5E6 for ; Mon, 8 May 2023 04:24:06 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-b983027d0faso5840871276.0 for ; Mon, 08 May 2023 04:24:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20221208.gappssmtp.com; s=20221208; t=1683545045; x=1686137045; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4ac1PyFGzSyD65jA/7/m9p7M+ymxiLTtNuhIFAnIl/Q=; b=bFHVtn+8TSgWbaTqjdMEHaw/Cts+pAWZReNo6J9oJlZrDogaUC9uBnx/tWcop2CcZh sciKWd8+cAZAMz6JHDqmL2RsO+cgfCW8lKFBtxOSb0s9Ssn107siHJgvuWweWo6V8xdD KxBVxmi14mEWj+U9ncrYh0Dy6wLoplMdMVVF6Ad0Ap9gSoCBwdz2dg89aKS9o6wjpD9V t7ar9Whk4tOS9XymljI3XRT+bqIAI1bh+MHddx30oKobQV0aJGOOP3LQHCs8gq/rFI6B uxX9CgXtSBf+VslUlrHiI67GeRX9Z2fERLRk/O75uLnneHGv5XZqniQmq0CEFotCQNLo g8kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683545045; x=1686137045; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4ac1PyFGzSyD65jA/7/m9p7M+ymxiLTtNuhIFAnIl/Q=; b=dTscG+Tjmi4ZUSp64fdwpUeSLC5eFT1qq7KAnAM2y1Dt+LsCtaYRHPZMtTxYhY4sqy wQmK85+KFyNqiMB9e6YU8s5rrc8zS0XNy2lhAFe9/LweFPekP11BNiiiGzZaFNGPOuUy V4mmEPnx3GnP5TMCUbO2P+xgP2hp/yAiYfBi2i9Nsim3PzjJQY9lOxIfKasQAiU4qEwJ N6Rjn/f26zmJS7B2TT3tnSv6QgRxhPkeAYywVBD5bhLfvrJBl/FEdU90ZUkhbAl2iGRu 04NCdLsy5nzvtuxIG+WT2AuJBQMKuni1t9Z9sRxgLUjfpSrSnWRaK+IYwbOdGIu9fE3E uNCQ== X-Gm-Message-State: AC+VfDxfIEmi0ZZXDdQEx7sCNkx8//jTLlm1vd5jRP0tMF9fO7L7OUVO Q0igJqhzDfelNJ3CsIHjN5rGg/Uzjm4ZKnyp/g/M7A== X-Received: by 2002:a25:2554:0:b0:b9e:6309:9412 with SMTP id l81-20020a252554000000b00b9e63099412mr11554200ybl.60.1683545045368; Mon, 08 May 2023 04:24:05 -0700 (PDT) MIME-Version: 1.0 References: <9969180f9219ed18656d8f3c92e717f6eb398aa1.1683326865.git.peilin.ye@bytedance.com> In-Reply-To: <9969180f9219ed18656d8f3c92e717f6eb398aa1.1683326865.git.peilin.ye@bytedance.com> From: Jamal Hadi Salim Date: Mon, 8 May 2023 07:23:54 -0400 Message-ID: Subject: Re: [PATCH net 3/6] net/sched: Reserve TC_H_INGRESS (TC_H_CLSACT) for ingress (clsact) Qdiscs To: Peilin Ye Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Cong Wang , Jiri Pirko , Peilin Ye , Daniel Borkmann , John Fastabend , Vlad Buslov , Pedro Tammela , Hillf Danton , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 5, 2023 at 8:14=E2=80=AFPM Peilin Ye wr= ote: > > Currently it is possible to add e.g. an HTB Qdisc under ffff:fff1 > (TC_H_INGRESS, TC_H_CLSACT): > > $ ip link add name ifb0 type ifb > $ tc qdisc add dev ifb0 parent ffff:fff1 htb > $ tc qdisc add dev ifb0 clsact > Error: Exclusivity flag on, cannot modify. > $ drgn > ... > >>> ifb0 =3D netdev_get_by_name(prog, "ifb0") > >>> qdisc =3D ifb0.ingress_queue.qdisc_sleeping > >>> print(qdisc.ops.id.string_().decode()) > htb > >>> qdisc.flags.value_() # TCQ_F_INGRESS > 2 > > Only allow ingress and clsact Qdiscs under ffff:fff1. Return -EINVAL > for everything else. Make TCQ_F_INGRESS a static flag of ingress and > clsact Qdiscs. > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Fixes: 1f211a1b929c ("net, sched: add clsact qdisc") > Signed-off-by: Peilin Ye Reviewed-by: Jamal Hadi Salim Acked-by: Jamal Hadi Salim cheers, jamal > --- > net/sched/sch_api.c | 7 ++++++- > net/sched/sch_ingress.c | 4 ++-- > 2 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c > index fdb8f429333d..383195955b7d 100644 > --- a/net/sched/sch_api.c > +++ b/net/sched/sch_api.c > @@ -1252,7 +1252,12 @@ static struct Qdisc *qdisc_create(struct net_devic= e *dev, > sch->parent =3D parent; > > if (handle =3D=3D TC_H_INGRESS) { > - sch->flags |=3D TCQ_F_INGRESS; > + if (!(sch->flags & TCQ_F_INGRESS)) { > + NL_SET_ERR_MSG(extack, > + "Specified parent ID is reserved f= or ingress and clsact Qdiscs"); > + err =3D -EINVAL; > + goto err_out3; > + } > handle =3D TC_H_MAKE(TC_H_INGRESS, 0); > } else { > if (handle =3D=3D 0) { > diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c > index 13218a1fe4a5..caea51e0d4e9 100644 > --- a/net/sched/sch_ingress.c > +++ b/net/sched/sch_ingress.c > @@ -137,7 +137,7 @@ static struct Qdisc_ops ingress_qdisc_ops __read_most= ly =3D { > .cl_ops =3D &ingress_class_ops, > .id =3D "ingress", > .priv_size =3D sizeof(struct ingress_sched_dat= a), > - .static_flags =3D TCQ_F_CPUSTATS, > + .static_flags =3D TCQ_F_INGRESS | TCQ_F_CPUSTATS, > .init =3D ingress_init, > .destroy =3D ingress_destroy, > .dump =3D ingress_dump, > @@ -275,7 +275,7 @@ static struct Qdisc_ops clsact_qdisc_ops __read_mostl= y =3D { > .cl_ops =3D &clsact_class_ops, > .id =3D "clsact", > .priv_size =3D sizeof(struct clsact_sched_data= ), > - .static_flags =3D TCQ_F_CPUSTATS, > + .static_flags =3D TCQ_F_INGRESS | TCQ_F_CPUSTATS, > .init =3D clsact_init, > .destroy =3D clsact_destroy, > .dump =3D ingress_dump, > -- > 2.20.1 >