]> www.infradead.org Git - users/jedix/linux-maple.git/commit
i40e: refactor macro INTRL_USEC_TO_REG
authorAlan Brady <alan.brady@intel.com>
Tue, 29 Nov 2016 00:06:02 +0000 (16:06 -0800)
committerJack Vogel <jack.vogel@oracle.com>
Sat, 10 Jun 2017 01:57:01 +0000 (18:57 -0700)
commit2a77c3bba8d5e7edc2033977b7b2ef6933b68c3b
treec49a8508178fd91169464501d6691c06fec329cf
parente14400cc6408ac28f2be3f8efa4efac877120360
i40e: refactor macro INTRL_USEC_TO_REG

This patch refactors the macro INTRL_USEC_TO_REG into a static inline
function and fixes a couple subtle bugs caused by the macro.

This patch fixes a bug which was caused by passing a bad register value
to the firmware.  If enabling interrupt rate limiting, a non-zero value
for the rate limit must be used.  Otherwise the firmware sets the
interrupt rate limit to the maximum value.  Due to the limited
resolution of the register, attempting to set a value of 1, 2, or 3
would be rounded down to 0 and limiting was left enabled, causing
unexpected behavior.

This patch also fixes a possible bug in which using the macro itself can
introduce unintended side-affects because the macro argument is used
more than once in the macro definition (e.g. a variable post-increment
argument would perform a double increment on the variable).

Without this patch, attempting to set interrupt rate limits of 1, 2, or
3 results in unexpected behavior and future use of this macro could
cause subtle bugs.

Change-Id: I83ac842de0ca9c86761923d6e3a4d7b1b95f2b3f
Signed-off-by: Alan Brady <alan.brady@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Orabug: 26132523
(cherry picked from commit 1c0e6a3613d3f0bb088a3160095c8da4c1214d02)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_txrx.h