From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [patch net-next v6 06/11] net: sched: use block index as a handle instead of qdisc when block is shared Date: Sat, 6 Jan 2018 21:43:12 +0100 Message-ID: <20180106204312.GF2099@nanopsycho> References: <20180105230929.5645-1-jiri@resnulli.us> <20180105230929.5645-7-jiri@resnulli.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com, mlxsw@mellanox.com, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com, michael.chan@broadcom.com, ganeshgr@chelsio.com, saeedm@mellanox.com, matanb@mellanox.com, leonro@mellanox.com, idosch@mellanox.com, jakub.kicinski@netronome.com, simon.horman@netronome.com, pieter.jansenvanvuuren@netronome.com, john.hurley@netronome.com, alexander.h.duyck@intel.com, ogerlitz@mellanox.com, john.fastabend@gmail.com, daniel@iogearbox.net, dsahern@gmail.com To: netdev@vger.kernel.org Return-path: Received: from mail-wr0-f196.google.com ([209.85.128.196]:33535 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752397AbeAFUnP (ORCPT ); Sat, 6 Jan 2018 15:43:15 -0500 Received: by mail-wr0-f196.google.com with SMTP id p6so7225486wrd.0 for ; Sat, 06 Jan 2018 12:43:14 -0800 (PST) Content-Disposition: inline In-Reply-To: <20180105230929.5645-7-jiri@resnulli.us> Sender: netdev-owner@vger.kernel.org List-ID: Sat, Jan 06, 2018 at 12:09:24AM CET, jiri@resnulli.us wrote: >From: Jiri Pirko > >As the tcm_ifindex 0 is invalid ifindex, reuse it to indicate that we >work with block, instead of qdisc. So if tcm_ifindex is 0, tcm_parent is >used to carry block_index. > >If the block is set to be shared between at least 2 qdiscs, it is >forbidden to use the qdisc handle to add/delete filters. In that case, >userspace has to pass block_index. > >Also, for dump of the filters, in case the block is shared in between at >least 2 qdiscs, the each filter is dumped with tcm_ifindex 0 and >tcm_parent set to block_index. That gives the user clear indication, >that the filter belongs to a shared block and not only to one qdisc >under which it is dumped. > >Suggested-by: David Ahern >Signed-off-by: Jiri Pirko >--- [...] >@@ -886,8 +887,13 @@ static int tcf_fill_node(struct net *net, struct sk_buff *skb, > tcm->tcm_family = AF_UNSPEC; > tcm->tcm__pad1 = 0; > tcm->tcm__pad2 = 0; >- tcm->tcm_ifindex = qdisc_dev(q)->ifindex; >- tcm->tcm_parent = parent; >+ if (q) { >+ tcm->tcm_ifindex = qdisc_dev(q)->ifindex; >+ tcm->tcm_parent = parent; >+ } else { >+ tcm->tcm_ifindex = 0; /* block index is stored in parent */ >+ tcm->tcm_parent = block->index; >+ } Please guys, please look at this reuse (also on clt side). I would like you to double-check this reuse of existing API for balock_index carrying purpose. I believe it's UAPI safe. But please, check it out carefully.