fm10k: introduce ITR_IS_ADAPTIVE macro
authorJacob Keller <jacob.e.keller@intel.com>
Fri, 16 Oct 2015 17:57:06 +0000 (10:57 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sun, 6 Dec 2015 07:55:21 +0000 (23:55 -0800)
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>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/fm10k/fm10k.h
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
drivers/net/ethernet/intel/fm10k/fm10k_main.c

index b178905fa43e794aaf933afe4b7797a7586d9538..cea0d94d8f5fe6764f662035edd329321f6a573d 100644 (file)
@@ -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)
index fd29145a52e4b8f7f3a52d9dae0c3da82badf1c3..a505a502bb8e3a2f62ae798784e4fee6f3d017f4 100644 (file)
@@ -701,12 +701,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;
index 746a1986690b1828be5120bf63f5297777d7b26b..21d49550935e3ba42a01d09910d6e19f11bb281f 100644 (file)
@@ -1366,7 +1366,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;