[v2] net/ice: faster bit check

Message ID 1550254030-216363-1-git-send-email-paul.m.stillwell.jr@intel.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • [v2] net/ice: faster bit check
Related show

Checks

Context Check Description
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch warning coding style issues

Commit Message

Stillwell Jr, Paul M Feb. 15, 2019, 6:07 p.m.
From: Jesse Brandeburg <jesse.brandeburg@intel.com>

Implement a slightly faster bit check, used for checking
descriptors in the hot path.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
---
v2: fixed checkpatch issues
---
 drivers/net/ice/ice_rxtx.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Patch

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index c794ee8..7c82931 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -955,14 +955,13 @@ 
 static inline uint64_t
 ice_rxd_status_to_pkt_flags(uint64_t qword)
 {
-	uint64_t flags;
-
-	/* Check if RSS_HASH */
-	flags = (((qword >> ICE_RX_DESC_STATUS_FLTSTAT_S) &
-		  ICE_RX_DESC_FLTSTAT_RSS_HASH) ==
-		 ICE_RX_DESC_FLTSTAT_RSS_HASH) ? PKT_RX_RSS_HASH : 0;
-
-	return flags;
+	static const uint64_t bitcheck =
+		(ICE_RX_DESC_FLTSTAT_RSS_HASH << ICE_RX_DESC_STATUS_FLTSTAT_S);
+ 	/* Check if RSS_HASH */
+	if ((qword & bitcheck) == bitcheck)
+		return PKT_RX_RSS_HASH;
+ 
+	return 0;
 }
 
 /* Rx L3/L4 checksum */