aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandr Loktionov <aleksandr.loktionov@intel.com>2026-08-11 19:34:01 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2026-08-11 20:59:32 +0000
commitcba56bc3427db0bb4efc3d0117cda4bdc7717f98 (patch)
tree66d02d924b03d79a771b2cc270786b03d92bdf13
parent5587cb18b168f57a4d68c7e58ec660ab2a5ce4da (diff)
igc: fix MAC address hash bit shift
DPDK commit message net/e1000/base: fix MAC address hash bit shift In e1000_hash_mc_addr_generic() the expression: "mc_addr[4] >> 8 - bit_shift", right shifting "mc_addr[4]" shift by more than 7 bits always yields zero, so hash becomes not so different. Add initialization with bit_shift = 1, and add a loop condition to ensure bit_shift will be always in [1..8] range. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Obtained from: DPDK (1749e662f6) MFC after: 2 weeks
-rw-r--r--sys/dev/igc/igc_mac.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/igc/igc_mac.c b/sys/dev/igc/igc_mac.c
index 6a00867c7a8e..2c32f0c7a606 100644
--- a/sys/dev/igc/igc_mac.c
+++ b/sys/dev/igc/igc_mac.c
@@ -301,7 +301,7 @@ int igc_rar_set_generic(struct igc_hw *hw, u8 *addr, u32 index)
u32 igc_hash_mc_addr_generic(struct igc_hw *hw, u8 *mc_addr)
{
u32 hash_value, hash_mask;
- u8 bit_shift = 0;
+ u8 bit_shift = 1;
DEBUGFUNC("igc_hash_mc_addr_generic");
@@ -311,7 +311,7 @@ u32 igc_hash_mc_addr_generic(struct igc_hw *hw, u8 *mc_addr)
/* For a mc_filter_type of 0, bit_shift is the number of left-shifts
* where 0xFF would still fall within the hash mask.
*/
- while (hash_mask >> bit_shift != 0xFF)
+ while (bit_shift < 4 && hash_mask >> bit_shift != 0xFF)
bit_shift++;
/* The portion of the address that is used for the hash table