From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Ricardo Leitner Subject: Re: [PATCH v3 net-next] net/sched: add skbprio scheduler Date: Wed, 11 Jul 2018 16:33:36 -0300 Message-ID: <20180711193336.GF8880@localhost.localdomain> References: <20180707101351.GA8300@gmail.com> <20180709154409.GC8880@localhost.localdomain> <20180709195319.GD8880@localhost.localdomain> <20180709214016.GD10923@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Michel Machado , Nishanth Devarajan , Jamal Hadi Salim , Jiri Pirko , David Miller , Linux Kernel Network Developers , Cody Doucette To: Cong Wang Return-path: Received: from mail-qt0-f193.google.com ([209.85.216.193]:41945 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbeGKTj1 (ORCPT ); Wed, 11 Jul 2018 15:39:27 -0400 Received: by mail-qt0-f193.google.com with SMTP id e19-v6so7895611qtp.8 for ; Wed, 11 Jul 2018 12:33:40 -0700 (PDT) Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Tue, Jul 10, 2018 at 07:25:53PM -0700, Cong Wang wrote: > On Mon, Jul 9, 2018 at 2:40 PM Marcelo Ricardo Leitner > wrote: > > > > On Mon, Jul 09, 2018 at 05:03:31PM -0400, Michel Machado wrote: > > > Changing TC_PRIO_MAX from 15 to 63 risks breaking backward compatibility > > > with applications. > > > > If done, it needs to be done carefully, indeed. I don't know if it's > > doable, neither I know how hard is your requirement for 64 different > > priorities. > > struct tc_prio_qopt { > int bands; /* Number of bands */ > __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ > }; > > How would you do it carefully? quick shot, multiplex v1 and v2 formats based on bands and sizeof(): #define TCQ_PRIO_BANDS_V1 16 #define TCQ_PRIO_BANDS_V2 64 #define TC_PRIO_MAX_V2 64 struct tc_prio_qopt_v2 { int bands; /* Number of bands */ __u8 priomap[TC_PRIO_MAX_V2+1]; /* Map: logical priority -> PRIO band */ }; static int prio_tune(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) { struct prio_sched_data *q = qdisc_priv(sch); struct Qdisc *queues[TCQ_PRIO_BANDS_V2]; int oldbands = q->bands, i; struct tc_prio_qopt_v2 *qopt; if (nla_len(opt) < sizeof(int)) return -EINVAL; qopt = nla_data(opt); if (qopt->bands <= TCQ_PRIO_BANDS_V1 && nla_len(opt) < sizeof(struct tc_prio_qopt)) return -EINVAL; if (qopt->bands <= TCQ_PRIO_BANDS_V2 && nla_len(opt) < sizeof(*qopt)) return -EINVAL; /* By here, if it has up to 3 bands, we can assume it is using the _v1 * layout, while if it has up to TCQ_PRIO_BANDS_V2 it is using the _v2 * format. */ if (qopt->bands > TCQ_PRIO_BANDS_V2 || qopt->bands < 2) return -EINVAL; ... With something like this I think it can keep compatibility with old software while also allowing the new usage. > Also, it is not only used by prio but also pfifo_fast. Yes. More is needed, indeed. prio2band would also need to be expanded, etc. Yet, I still don't see any blocker.