Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next-queue v5 12/17] fm10k: introduce ITR_IS_ADAPTIVE macro
Date: Fri, 16 Oct 2015 10:57:06 -0700	[thread overview]
Message-ID: <1445018231-3196-12-git-send-email-jacob.e.keller@intel.com> (raw)
In-Reply-To: <1445018231-3196-1-git-send-email-jacob.e.keller@intel.com>

Define a macro for identifying when the itr value is dynamic or
adaptive. The concept was taken from i40e. This helps make clear what
the check is, and reduces the line length to something more reasonable
in a few places.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k.h         | 2 ++
 drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 6 ++----
 drivers/net/ethernet/intel/fm10k/fm10k_main.c    | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h
index 3495e9337745..a2484cb88d86 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
@@ -172,6 +172,8 @@ struct fm10k_ring_container {
 #define FM10K_ITR_20K		50	/* 50us */
 #define FM10K_ITR_ADAPTIVE	0x8000	/* adaptive interrupt moderation flag */
 
+#define ITR_IS_ADAPTIVE(itr) (!!(itr & FM10K_ITR_ADAPTIVE))
+
 #define FM10K_ITR_ENABLE	(FM10K_ITR_AUTOMASK | FM10K_ITR_MASK_CLEAR)
 
 static inline struct netdev_queue *txring_txq(const struct fm10k_ring *ring)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index b903c4646cf8..2395877f0544 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -705,12 +705,10 @@ static int fm10k_get_coalesce(struct net_device *dev,
 {
 	struct fm10k_intfc *interface = netdev_priv(dev);
 
-	ec->use_adaptive_tx_coalesce =
-		!!(interface->tx_itr & FM10K_ITR_ADAPTIVE);
+	ec->use_adaptive_tx_coalesce = ITR_IS_ADAPTIVE(interface->tx_itr);
 	ec->tx_coalesce_usecs = interface->tx_itr & ~FM10K_ITR_ADAPTIVE;
 
-	ec->use_adaptive_rx_coalesce =
-		!!(interface->rx_itr & FM10K_ITR_ADAPTIVE);
+	ec->use_adaptive_rx_coalesce = ITR_IS_ADAPTIVE(interface->rx_itr);
 	ec->rx_coalesce_usecs = interface->rx_itr & ~FM10K_ITR_ADAPTIVE;
 
 	return 0;
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index c5f7e0d919dc..8207ee189600 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -1370,7 +1370,7 @@ static void fm10k_update_itr(struct fm10k_ring_container *ring_container)
 	unsigned int avg_wire_size, packets;
 
 	/* Only update ITR if we are using adaptive setting */
-	if (!(ring_container->itr & FM10K_ITR_ADAPTIVE))
+	if (!ITR_IS_ADAPTIVE(ring_container->itr))
 		goto clear_counts;
 
 	packets = ring_container->total_packets;
-- 
2.6.1.264.gbab76a9


  parent reply	other threads:[~2015-10-16 17:57 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16 17:56 [Intel-wired-lan] [next-queue v5 01/17] fm10k: conditionally compile DCB and DebugFS support Jacob Keller
2015-10-16 17:56 ` [Intel-wired-lan] [next-queue v5 02/17] fm10k: set netdev features in one location Jacob Keller
2015-10-16 23:41   ` Allan, Bruce W
2015-10-29  1:23   ` Singh, Krishneil K
2015-10-16 17:56 ` [Intel-wired-lan] [next-queue v5 03/17] fm10k: reset max_queues on init_hw_vf failure Jacob Keller
2015-10-16 23:40   ` Allan, Bruce W
2015-10-28  0:48   ` Singh, Krishneil K
2015-10-16 17:56 ` [Intel-wired-lan] [next-queue v5 04/17] fm10k: always check init_hw for errors Jacob Keller
2015-10-16 23:41   ` Allan, Bruce W
2015-10-16 17:56 ` [Intel-wired-lan] [next-queue v5 05/17] fm10k: reinitialize queuing scheme after calling init_hw Jacob Keller
2015-10-16 23:42   ` Allan, Bruce W
2015-10-28  0:44   ` Singh, Krishneil K
2015-10-16 17:57 ` [Intel-wired-lan] [next-queue v5 06/17] fm10k: Correct typecast in fm10k_update_xc_addr_pf Jacob Keller
2015-10-16 23:40   ` Allan, Bruce W
2015-10-28  0:23     ` Singh, Krishneil K
2015-10-16 17:57 ` [Intel-wired-lan] [next-queue v5 07/17] fm10k: explicitly typecast vlan values to u16 Jacob Keller
2015-10-28  0:21   ` Singh, Krishneil K
2015-10-16 17:57 ` [Intel-wired-lan] [next-queue v5 08/17] fm10k: add statistics for actual DWORD count of mbmem mailbox Jacob Keller
2015-10-16 23:41   ` Allan, Bruce W
2015-10-27 19:51   ` Singh, Krishneil K
2015-10-16 17:57 ` [Intel-wired-lan] [next-queue v5 09/17] fm10k: rename mbx_tx_oversized statistic to mbx_tx_dropped Jacob Keller
2015-10-27 17:12   ` Singh, Krishneil K
2015-10-16 17:57 ` [Intel-wired-lan] [next-queue v5 10/17] fm10k: add TEB check to fm10k_gre_is_nvgre Jacob Keller
2015-10-16 23:41   ` Allan, Bruce W
2015-10-28 22:48   ` Singh, Krishneil K
2015-10-16 17:57 ` [Intel-wired-lan] [next-queue v5 11/17] fm10k: Add support for ITR scaling based on PCIe link speed Jacob Keller
2015-10-16 23:41   ` Allan, Bruce W
2015-10-28 22:47   ` Singh, Krishneil K
2015-10-16 17:57 ` Jacob Keller [this message]
2015-10-16 23:41   ` [Intel-wired-lan] [next-queue v5 12/17] fm10k: introduce ITR_IS_ADAPTIVE macro Allan, Bruce W
2015-10-28 22:44   ` Singh, Krishneil K
2015-10-16 17:57 ` [Intel-wired-lan] [next-queue v5 13/17] fm10k: Update adaptive ITR algorithm Jacob Keller
2015-10-28 22:43   ` Singh, Krishneil K
2015-10-16 17:57 ` [Intel-wired-lan] [next-queue v5 14/17] fm10k: use macro for default Tx and Rx ITR values Jacob Keller
2015-10-16 23:42   ` Allan, Bruce W
2015-10-27 17:19   ` Singh, Krishneil K
2015-10-16 17:57 ` [Intel-wired-lan] [next-queue v5 15/17] fm10k: change default Tx ITR to 25usec Jacob Keller
2015-10-27 17:20   ` Singh, Krishneil K
2015-10-16 17:57 ` [Intel-wired-lan] [next-queue v5 16/17] fm10k: TRIVIAL fix typo of hardware Jacob Keller
2015-10-27 17:21   ` Singh, Krishneil K
2015-10-16 17:57 ` [Intel-wired-lan] [next-queue v5 17/17] fm10k: TRIVIAL cleanup order at top of fm10k_xmit_frame Jacob Keller
2015-10-16 23:41 ` [Intel-wired-lan] [next-queue v5 01/17] fm10k: conditionally compile DCB and DebugFS support Allan, Bruce W

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445018231-3196-12-git-send-email-jacob.e.keller@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox