src/dpdk/drivers/event/dlb/dlb.c
static void
dlb_program_sn_allocation(struct dlb_eventdev *dlb,
			  const struct rte_event_queue_conf *queue_conf)
{
	int grp_occupancy[DLB_NUM_SN_GROUPS];
	int grp_alloc[DLB_NUM_SN_GROUPS];
	int i, sequence_numbers;

	sequence_numbers = (int)queue_conf->nb_atomic_order_sequences;

	for (i = 0; i < DLB_NUM_SN_GROUPS; i++) {
		int total_slots;

		grp_alloc[i] = dlb_get_sn_allocation(dlb, i);
		if (grp_alloc[i] < 0)
			return;

		total_slots = DLB_MAX_LDB_SN_ALLOC / grp_alloc[i];

		grp_occupancy[i] = dlb_get_sn_occupancy(dlb, i);
		if (grp_occupancy[i] < 0)
			return;

		/* DLB has at least one available slot for the requested
		 * sequence numbers, so no further configuration required.
		 */
		if (grp_alloc[i] == sequence_numbers &&
		    grp_occupancy[i] < total_slots)
			return;
	}

	/* None of the sequence number groups are configured for the requested
	 * sequence numbers, so we have to reconfigure one of them. This is
	 * only possible if a group is not in use.
	 */
	for (i = 0; i < DLB_NUM_SN_GROUPS; i++) {
		if (grp_occupancy[i] == 0)
			break;
	}

	if (i == DLB_NUM_SN_GROUPS) {
		DLB_LOG_ERR("[%s()] No groups with %d sequence_numbers are available or have free slots\n",
		       __func__, sequence_numbers);
		return;
	}

	/* Attempt to configure slot i with the requested number of sequence
	 * numbers. Ignore the return value -- if this fails, the error will be
	 * caught during subsequent queue configuration.
	 */
	dlb_set_sn_allocation(dlb, i, sequence_numbers);
}
/* Query the current sequence number allocations and, if they conflict with the
 * requested LDB queue configuration, attempt to re-allocate sequence numbers.
 * This is best-effort; if it fails, the PMD will attempt to configure the
 * load-balanced queue and return an error.
 */
Query the current sequence number allocations and, if they conflict with the
requested LDB queue configuration, attempt to re-allocate sequence numbers.
This is best-effort; if it fails, the PMD will attempt to configure the
load-balanced queue and return an error.
Query the current sequence number allocations and if they conflict with the requested LDB queue configuration attempt to re - allocate sequence numbers . This is best - effort ; if it fails the PMD will attempt to configure the load - balanced queue and return an error .
static void
dlb_program_sn_allocation(struct dlb_eventdev *dlb,
			  const struct rte_event_queue_conf *queue_conf)
{
	int grp_occupancy[DLB_NUM_SN_GROUPS];
	int grp_alloc[DLB_NUM_SN_GROUPS];
	int i, sequence_numbers;
	sequence_numbers = (int)queue_conf->nb_atomic_order_sequences;
	for (i = 0; i < DLB_NUM_SN_GROUPS; i++) {
		int total_slots;
		grp_alloc[i] = dlb_get_sn_allocation(dlb, i);
		if (grp_alloc[i] < 0)
			return;
		total_slots = DLB_MAX_LDB_SN_ALLOC / grp_alloc[i];
		grp_occupancy[i] = dlb_get_sn_occupancy(dlb, i);
		if (grp_occupancy[i] < 0)
			return;
		if (grp_alloc[i] == sequence_numbers &&
		    grp_occupancy[i] < total_slots)
			return;
	}
	for (i = 0; i < DLB_NUM_SN_GROUPS; i++) {
		if (grp_occupancy[i] == 0)
			break;
	}
	if (i == DLB_NUM_SN_GROUPS) {
		DLB_LOG_ERR("[%s()] No groups with %d sequence_numbers are available or have free slots\n",
		       __func__, sequence_numbers);
		return;
	}
	dlb_set_sn_allocation(dlb, i, sequence_numbers);
}
static void dlb_program_sn_allocation ( struct dlb_eventdev * dlb , const struct rte_event_queue_conf * queue_conf ) { int grp_occupancy [ DLB_NUM_SN_GROUPS ] ; int grp_alloc [ DLB_NUM_SN_GROUPS ] ; int i , sequence_numbers ; sequence_numbers = ( int ) queue_conf -> nb_atomic_order_sequences ; for ( i = 0 ; i < DLB_NUM_SN_GROUPS ; i ++ ) { int total_slots ; grp_alloc [ i ] = dlb_get_sn_allocation ( dlb , i ) ; if ( grp_alloc [ i ] < 0 ) return ; total_slots = DLB_MAX_LDB_SN_ALLOC / grp_alloc [ i ] ; grp_occupancy [ i ] = dlb_get_sn_occupancy ( dlb , i ) ; if ( grp_occupancy [ i ] < 0 ) return ; if ( grp_alloc [ i ] == sequence_numbers && grp_occupancy [ i ] < total_slots ) return ; } for ( i = 0 ; i < DLB_NUM_SN_GROUPS ; i ++ ) { if ( grp_occupancy [ i ] == 0 ) break ; } if ( i == DLB_NUM_SN_GROUPS ) { DLB_LOG_ERR ( " \n " , __func__ , sequence_numbers ) ; return ; } dlb_set_sn_allocation ( dlb , i , sequence_numbers ) ; }
Query the current sequence number allocations and, if they conflict with the
 requested LDB queue configuration, attempt to re-allocate sequence numbers.
Query the current sequence number allocations and if they conflict with the requested LDB queue configuration attempt to re - allocate sequence numbers .
/* DLB has at least one available slot for the requested
		 * sequence numbers, so no further configuration required.
		 */ /* None of the sequence number groups are configured for the requested
	 * sequence numbers, so we have to reconfigure one of them. This is
	 * only possible if a group is not in use.
	 */ /* Attempt to configure slot i with the requested number of sequence
	 * numbers. Ignore the return value -- if this fails, the error will be
	 * caught during subsequent queue configuration.
	 */