From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Wang Subject: Re: [PATCH net-next] virtio_net: ethtool tx napi configuration Date: Thu, 13 Sep 2018 17:04:04 +0800 Message-ID: References: <20180909224449.203593-1-willemdebruijn.kernel@gmail.com> <2fd8d46f-7466-e507-af31-c587693beb6e@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Cc: Network Development , David Miller , caleb.raitto@gmail.com, "Michael S. Tsirkin" , "Jon Olson (Google Drive)" , Willem de Bruijn To: Willem de Bruijn , f.fainelli@gmail.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:51562 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726835AbeIMOMo (ORCPT ); Thu, 13 Sep 2018 10:12:44 -0400 In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 2018年09月13日 03:11, Willem de Bruijn wrote: > On Wed, Sep 12, 2018 at 2:16 PM Florian Fainelli wrote: >> >> >> On 9/12/2018 11:07 AM, Willem de Bruijn wrote: >>> On Wed, Sep 12, 2018 at 1:42 PM Florian Fainelli wrote: >>>> >>>> >>>> On 9/9/2018 3:44 PM, Willem de Bruijn wrote: >>>>> From: Willem de Bruijn >>>>> >>>>> Implement ethtool .set_coalesce (-C) and .get_coalesce (-c) handlers. >>>>> Interrupt moderation is currently not supported, so these accept and >>>>> display the default settings of 0 usec and 1 frame. >>>>> >>>>> Toggle tx napi through a bit in tx-frames. So as to not interfere >>>>> with possible future interrupt moderation, use bit 10, well outside >>>>> the reasonable range of real interrupt moderation values. >>>>> >>>>> Changes are not atomic. The tx IRQ, napi BH and transmit path must >>>>> be quiesced when switching modes. Only allow changing this setting >>>>> when the device is down. >>>> Humm, would not a private ethtool flag to switch TX NAPI on/off be more >>>> appropriate rather than use the coalescing configuration API here? >>> What do you mean by private ethtool flag? A new field in ethtool >>> --features (-k)? >> I meant using ethtool_drvinfo::n_priv_flags, ETH_SS_PRIV_FLAGS and then >> ETHTOOL_GFPFLAGS and ETHTOOL_SPFLAGS to control the toggling of that >> private flag. mlx5 has a number of privates flags for instance. > Interesting, thanks! I was not at all aware of those ethtool flags. > Am having a look. It definitely looks promising. > >>> Configurable napi-tx is not a common feature across devices. We really >>> want virtio-net to also just convert to napi-tx as default, but need a >>> way to gradually convert with application opt-out if some workloads >>> see regressions. >> The rationale makes sense, no questions about it. >> >>> There is prior art in interpreting coalesce values as >>> more than a direct mapping to usec. The e1000 is one example. >>> >> Looked at both e1000 and e1000e and they both have a similar programming >> of the HW's interrupt target rate register, which is relevant to >> interrupt coalescing, what part of these drivers do you see as doing >> something not quite coalescing related? > It's all coalescing related, for sure. e1000_set_coalesce just does not > translate the tx-usecs values into microsecond latency directly. > > It modifies both the interrupt throttle rate adapter->itr and interrupt mode > adapter->itr_setting, which are initially set in e1000_check_options from > module param InterruptThrottleRate. > > Value 0 disables interrupt moderation. 1 and 3 program a dynamic mode. > 2 is an illegal value as is 5..9. 10..10000 converts from usec to interrupt > rate/sec. > > I took tx-napi to be a similar interrupt related option as, say, dynamic > conservative mode interrupt moderation. Consider we may have interrupt moderation in the future, I tend to use set_coalesce. Otherwise we may need two steps to enable moderation: - tx-napi on - set_coalesce Thanks