Commit 584373f5 authored by Jacob Keller's avatar Jacob Keller Committed by Jeff Kirsher

fm10k: introduce ITR_IS_ADAPTIVE macro

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: default avatarJacob Keller <jacob.e.keller@intel.com>
Reviewed-by: default avatarBruce Allan <bruce.w.allan@intel.com>
Tested-by: default avatarKrishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 20076fa1
...@@ -172,6 +172,8 @@ struct fm10k_ring_container { ...@@ -172,6 +172,8 @@ struct fm10k_ring_container {
#define FM10K_ITR_20K 50 /* 50us */ #define FM10K_ITR_20K 50 /* 50us */
#define FM10K_ITR_ADAPTIVE 0x8000 /* adaptive interrupt moderation flag */ #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) #define FM10K_ITR_ENABLE (FM10K_ITR_AUTOMASK | FM10K_ITR_MASK_CLEAR)
static inline struct netdev_queue *txring_txq(const struct fm10k_ring *ring) static inline struct netdev_queue *txring_txq(const struct fm10k_ring *ring)
......
...@@ -701,12 +701,10 @@ static int fm10k_get_coalesce(struct net_device *dev, ...@@ -701,12 +701,10 @@ static int fm10k_get_coalesce(struct net_device *dev,
{ {
struct fm10k_intfc *interface = netdev_priv(dev); struct fm10k_intfc *interface = netdev_priv(dev);
ec->use_adaptive_tx_coalesce = ec->use_adaptive_tx_coalesce = ITR_IS_ADAPTIVE(interface->tx_itr);
!!(interface->tx_itr & FM10K_ITR_ADAPTIVE);
ec->tx_coalesce_usecs = interface->tx_itr & ~FM10K_ITR_ADAPTIVE; ec->tx_coalesce_usecs = interface->tx_itr & ~FM10K_ITR_ADAPTIVE;
ec->use_adaptive_rx_coalesce = ec->use_adaptive_rx_coalesce = ITR_IS_ADAPTIVE(interface->rx_itr);
!!(interface->rx_itr & FM10K_ITR_ADAPTIVE);
ec->rx_coalesce_usecs = interface->rx_itr & ~FM10K_ITR_ADAPTIVE; ec->rx_coalesce_usecs = interface->rx_itr & ~FM10K_ITR_ADAPTIVE;
return 0; return 0;
......
...@@ -1366,7 +1366,7 @@ static void fm10k_update_itr(struct fm10k_ring_container *ring_container) ...@@ -1366,7 +1366,7 @@ static void fm10k_update_itr(struct fm10k_ring_container *ring_container)
unsigned int avg_wire_size, packets; unsigned int avg_wire_size, packets;
/* Only update ITR if we are using adaptive setting */ /* 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; goto clear_counts;
packets = ring_container->total_packets; packets = ring_container->total_packets;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment