From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nishanth Devarajan Subject: Re: [PATCH v2 net-next] net/sched: add skbprio scheduler Date: Tue, 26 Jun 2018 04:57:20 +0530 Message-ID: <20180625232712.GA3708@gmail.com> References: <20180623204745.GA4337@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jamal Hadi Salim , Jiri Pirko , David Miller , netdev@vger.kernel.org, doucette@bu.edu, michel@digirati.com.br To: Cong Wang Return-path: Received: from mail-oi0-f67.google.com ([209.85.218.67]:36928 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753095AbeFYX1y (ORCPT ); Mon, 25 Jun 2018 19:27:54 -0400 Received: by mail-oi0-f67.google.com with SMTP id k81-v6so150764oib.4 for ; Mon, 25 Jun 2018 16:27:54 -0700 (PDT) Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Sat, Jun 23, 2018 at 02:43:16PM -0700, Cong Wang wrote: > On Sat, Jun 23, 2018 at 1:47 PM, Nishanth Devarajan wrote: > > diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h > > index 37b5096..6fd07e8 100644 > > --- a/include/uapi/linux/pkt_sched.h > > +++ b/include/uapi/linux/pkt_sched.h > ... > > +#define SKBPRIO_MAX_PRIORITY 64 > > + > > +struct tc_skbprio_qopt { > > + __u32 limit; /* Queue length in packets. */ > > +}; > > > Since this is just an integer, you can just make it NLA_U32 instead > of a struct? > > Making it NLA_U32, wouldn't that be incurring a nla_policy struct in the code? I also feel uneasy that we'd be straying convention of having a tc qopt struct to pass in essential parameters from userspace. > > +static int skbprio_change(struct Qdisc *sch, struct nlattr *opt, > > + struct netlink_ext_ack *extack) > > +{ > > + struct skbprio_sched_data *q = qdisc_priv(sch); > > + struct tc_skbprio_qopt *ctl = nla_data(opt); > > + const unsigned int min_limit = 1; > > + > > + if (ctl->limit == (typeof(ctl->limit))-1) > > + q->max_limit = max(qdisc_dev(sch)->tx_queue_len, min_limit); > > + else if (ctl->limit < min_limit || > > + ctl->limit > qdisc_dev(sch)->tx_queue_len) > > + return -EINVAL; > > + else > > + q->max_limit = ctl->limit; > > + > > + return 0; > > +} > > Isn't q->max_limit same with sch->limit? > q->max_limit was intended to represent the maximum limit that Skbprio could accomodate i.e the tx queue len of the device attached to the qdisc, to check the limit parameter passed from userspace. I'll correct this in v3. > Also, please avoid dev->tx_queue_len here, it may change > independently of your qdisc change, unless you want to implement > ops->change_tx_queue_len(). OK, will make this change.