On Tue, 24 Mar 2026 13:37:08 +0100
Dariusz Sosnowski <[email protected]> wrote:

> +static uint16_t
> +assign_share_group(struct rte_eth_dev_info *dev_info)
> +{
> +     unsigned int first_free = RTE_DIM(share_group_slots);
> +     bool found = false;
> +     unsigned int i;
> +
> +     for (i = 0; i < RTE_DIM(share_group_slots); i++) {
> +             if (share_group_slots[i].share_group > 0) {
> +                     if (dev_info->switch_info.domain_id == 
> share_group_slots[i].domain_id &&
> +                         dev_info->switch_info.rx_domain == 
> share_group_slots[i].rx_domain) {
> +                             found = true;
> +                             break;
> +                     }
> +             } else if (first_free == RTE_DIM(share_group_slots)) {
> +                     first_free = i;
> +             }
> +     }
> +
> +     if (found)
> +             return share_group_slots[i].share_group;

Please use a short circuit return, that would be simpler and code would be 
shorter.
Same thing below, avoid unnecessary bools.

        
        for (i = 0; i < RTE_DIM(share_group_slots); i++) {
                if (share_group_slots[i].share_group > 0) {
                        if (dev_info->switch_info.domain_id == 
share_group_slots[i].domain_id &&
                            dev_info->switch_info.rx_domain == 
share_group_slots[i].rx_domain)
                                        return share_group_slots[i].share_group;
                } else  if (first_free == RTE_DIM(share_group_slots)) {
                        first_free = i;
                }
        }

Reply via email to