[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <37D7C6CF3E00A74B8858931C1DB2F077019C141F@SHSMSX103.ccr.corp.intel.com>
Date: Mon, 21 Dec 2015 20:12:31 +0000
From: "Liang, Kan" <kan.liang@...el.com>
To: Ben Hutchings <ben@...adent.org.uk>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"bwh@...nel.org" <bwh@...nel.org>
CC: "Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
"andi@...stfloor.org" <andi@...stfloor.org>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"alexander.duyck@...il.com" <alexander.duyck@...il.com>,
"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
"Nelson, Shannon" <shannon.nelson@...el.com>,
"Wyborny, Carolyn" <carolyn.wyborny@...el.com>,
"Skidmore, Donald C" <donald.c.skidmore@...el.com>,
"Williams, Mitch A" <mitch.a.williams@...el.com>,
"ogerlitz@...lanox.com" <ogerlitz@...lanox.com>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"jiri@...lanox.com" <jiri@...lanox.com>,
"sfeldma@...il.com" <sfeldma@...il.com>,
"gospo@...ulusnetworks.com" <gospo@...ulusnetworks.com>,
"sasha.levin@...cle.com" <sasha.levin@...cle.com>,
"dsahern@...il.com" <dsahern@...il.com>,
"tj@...nel.org" <tj@...nel.org>,
"cascardo@...hat.com" <cascardo@...hat.com>,
"corbet@....net" <corbet@....net>
Subject: RE: [RFC 2/5] net/ethtool: support get coalesce per queue
> On Thu, 2015-12-17 at 06:51 +0000, kan.liang@...el.com wrote:
> > From: Kan Liang <kan.liang@...el.com>
> >
> > Device driver has to provide an interface to get per queue coalesce.
> > The interrupt coalescing parameters of each masked queue will be
> > copied back to user space one by one.
> >
> > Signed-off-by: Kan Liang <kan.liang@...el.com>
> > ---
> > include/linux/ethtool.h | 5 ++++-
> > net/core/ethtool.c | 33 ++++++++++++++++++++++++++++++++-
> > 2 files changed, 36 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index
> > 653dc9c..107f75f 100644
> > --- a/include/linux/ethtool.h
> > +++ b/include/linux/ethtool.h
> > @@ -201,6 +201,8 @@ static inline u32 ethtool_rxfh_indir_default(u32
> > index, u32 n_rx_rings)
> > * @get_module_eeprom: Get the eeprom information from the plug-in
> > module
> > * @get_eee: Get Energy-Efficient (EEE) supported and status.
> > * @set_eee: Set EEE status (enable/disable) as well as LPI timers.
> > + * @get_per_queue_coalesce: Get interrupt coalescing parameters per
> queue.
> > + * Returns a negative error code or zero.
>
> Is the ethtool core or the driver responsible for range-checking the queue
> number?
>
> What is reported if the queue number is in range for RX queues but not for
> TX queues (or vice versa)?
>
The driver should do the range-checking.
I think it's also driver to determine which should be reported
in tx_coalesce_usecs, if RX in range but TX not. Maybe ~0 is a good return
for tx_coalesce_usecs.
> > *
> > * All operations are optional (i.e. the function pointer may be set
> > * to %NULL) and callers must take this into account. Callers must
> > @@ -279,7 +281,8 @@ struct ethtool_ops {
> > const struct ethtool_tunable *, void *);
> > int (*set_tunable)(struct net_device *,
> > const struct ethtool_tunable *, const void *);
> > -
> > + int (*get_per_queue_coalesce)(struct net_device *, int,
> > + struct ethtool_coalesce *);
> >
> > };
> > #endif /* _LINUX_ETHTOOL_H */
> > diff --git a/net/core/ethtool.c b/net/core/ethtool.c index
> > 125fb32..22ff69a 100644
> > --- a/net/core/ethtool.c
> > +++ b/net/core/ethtool.c
> > @@ -1748,6 +1748,36 @@ out:
> > return ret;
> > }
> >
> > +static int ethtool_get_per_queue_coalesce(struct net_device *dev,
> > + void __user *useraddr,
> > + struct ethtool_per_queue_op
> *per_queue_opt) {
> > + u64 queue_mask;
> > + int bit, i, ret;
> > +
> > + if (!dev->ethtool_ops->get_per_queue_coalesce)
> > + return -EOPNOTSUPP;
> > +
> > + useraddr += sizeof(*per_queue_opt);
> > + for (i = 0; i < MAX_QUEUE_MASK; i++) {
> > + queue_mask = per_queue_opt->queue_mask[i];
> > + if (queue_mask > 0) {
> > + for_each_set_bit(bit, (unsigned long
> *)&queue_mask, 64) {
> [...]
>
> This assumes a little-endian system.
>
> You should probably build on top of David Decotigny's recent patch series
> that adds conversion of u32-based bitmaps to kernel bitmaps.
>
Thanks for pointing me to the patch.
I will change the code based on his patch.
Thanks,
Kan
Powered by blists - more mailing lists