The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=cba56bc3427db0bb4efc3d0117cda4bdc7717f98
commit cba56bc3427db0bb4efc3d0117cda4bdc7717f98 Author: Aleksandr Loktionov <[email protected]> AuthorDate: 2026-08-11 19:34:01 +0000 Commit: Kevin Bowling <[email protected]> CommitDate: 2026-08-11 20:59:32 +0000 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: [email protected] Signed-off-by: Aleksandr Loktionov <[email protected]> Signed-off-by: Anatoly Burakov <[email protected]> Acked-by: Bruce Richardson <[email protected]> Obtained from: DPDK (1749e662f6) MFC after: 2 weeks --- sys/dev/igc/igc_mac.c | 4 ++-- 1 file 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
