提交 8a494920 编写于 作者: J Jesse Brandeburg 提交者: Jeff Kirsher

i40e: check multi-bit state correctly

The hash is reported correctly in the rss field if and only if
the filter status is 3.  Other values of filter status mean
different things and we shouldn't depend on a bitwise result.

The issue was that
a & b --> returns true for b={1,2,3}
the fix is
a & b == b

Also refactor this function to use constant operations because we
are in fast path.

Change-Id: I4e29be87439c1cf8b60bc31bea29dff89596c013
Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: NKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 dcf8f55b
...@@ -891,13 +891,15 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi, ...@@ -891,13 +891,15 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
static inline u32 i40e_rx_hash(struct i40e_ring *ring, static inline u32 i40e_rx_hash(struct i40e_ring *ring,
union i40e_rx_desc *rx_desc) union i40e_rx_desc *rx_desc)
{ {
if (ring->netdev->features & NETIF_F_RXHASH) { const __le64 rss_mask =
if ((le64_to_cpu(rx_desc->wb.qword1.status_error_len) >> cpu_to_le64((u64)I40E_RX_DESC_FLTSTAT_RSS_HASH <<
I40E_RX_DESC_STATUS_FLTSTAT_SHIFT) & I40E_RX_DESC_STATUS_FLTSTAT_SHIFT);
I40E_RX_DESC_FLTSTAT_RSS_HASH)
return le32_to_cpu(rx_desc->wb.qword0.hi_dword.rss); if ((ring->netdev->features & NETIF_F_RXHASH) &&
} (rx_desc->wb.qword1.status_error_len & rss_mask) == rss_mask)
return 0; return le32_to_cpu(rx_desc->wb.qword0.hi_dword.rss);
else
return 0;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册