mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 01:32:21 +02:00
net: hsr: simplify fill_last_seq_nrs()
The function checks the HSR_PT_SLAVE_A and HSR_PT_SLAVE_B bitmaps for emptiness right before calling find_last_bit(). This pass may be avoided, because if the bitmap is empty, the find_last_bit() returns >= HSR_SEQ_BLOCK_SIZE Signed-off-by: Yury Norov <ynorov@nvidia.com> Reviewed-by: Felix Maurer <fmaurer@redhat.com> Link: https://patch.msgid.link/20260609171545.1051322-1-ynorov@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
0182b218a0
commit
8058d9755e
|
|
@ -825,18 +825,16 @@ static void fill_last_seq_nrs(struct hsr_node *node, u16 *if1_seq, u16 *if2_seq)
|
|||
block_sz = hsr_seq_block_size(node);
|
||||
block = node->block_buf + block_off * block_sz;
|
||||
|
||||
if (!bitmap_empty(block->seq_nrs[HSR_PT_SLAVE_B - 1],
|
||||
HSR_SEQ_BLOCK_SIZE)) {
|
||||
seq_bit = find_last_bit(block->seq_nrs[HSR_PT_SLAVE_B - 1],
|
||||
HSR_SEQ_BLOCK_SIZE);
|
||||
seq_bit = find_last_bit(block->seq_nrs[HSR_PT_SLAVE_B - 1],
|
||||
HSR_SEQ_BLOCK_SIZE);
|
||||
if (seq_bit < HSR_SEQ_BLOCK_SIZE)
|
||||
*if1_seq = (block->block_idx << HSR_SEQ_BLOCK_SHIFT) | seq_bit;
|
||||
}
|
||||
if (!bitmap_empty(block->seq_nrs[HSR_PT_SLAVE_A - 1],
|
||||
HSR_SEQ_BLOCK_SIZE)) {
|
||||
seq_bit = find_last_bit(block->seq_nrs[HSR_PT_SLAVE_A - 1],
|
||||
HSR_SEQ_BLOCK_SIZE);
|
||||
|
||||
seq_bit = find_last_bit(block->seq_nrs[HSR_PT_SLAVE_A - 1],
|
||||
HSR_SEQ_BLOCK_SIZE);
|
||||
if (seq_bit < HSR_SEQ_BLOCK_SIZE)
|
||||
*if2_seq = (block->block_idx << HSR_SEQ_BLOCK_SHIFT) | seq_bit;
|
||||
}
|
||||
|
||||
spin_unlock_bh(&node->seq_out_lock);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user