Skip to content

Instantly share code, notes, and snippets.

@foamdino
Last active April 24, 2025 10:43
Show Gist options
  • Select an option

  • Save foamdino/a87c741a3b0e3464e5420986dd5a8b89 to your computer and use it in GitHub Desktop.

Select an option

Save foamdino/a87c741a3b0e3464e5420986dd5a8b89 to your computer and use it in GitHub Desktop.
Start XSK instance core
/* If we have an IRQ and IRQ Core ID, we should ask the PAL to map the IRQ to
* the provided Core ID. */
if (xi->irq < UINT32_MAX && xi->irq_core_id < UINT32_MAX)
{
/* Initially set all cores off */
bl_pal_clear_coremap(&coremap);
/* Then enable single selected core */
bl_pal_set_coremap_by_cores(
teb, &coremap, BL_PAL_COREMAP_PHYSICAL, &xi->irq_core_id, 1);
/* Ask the PAL if the affinity needs changing. */
res = bl_pal_check_irq_affinity(teb, xi->irq, &coremap, &is_equal);
if (res != BL_OK)
{
bl_log_error_t(
teb,
"Error checking affinity for XSK instance %s IRQ %u: %s",
xi->name,
xi->irq,
bl_error_get_last_msg(teb));
return BL_ERR;
}
/* Finally activate the requested mapping if we need to */
if (is_equal)
bl_log_info_t(
teb,
"XSK instance %s IRQ %u already activated for core 0x%X",
xi->name,
xi->irq,
xi->irq_core_id);
else
{
res = bl_pal_activate_irq_mapping(teb, xi->irq, &coremap);
if (res != BL_OK)
{
bl_log_error_t(
teb,
"Error mapping XSK instance %s IRQ %u affinity to "
"core 0x%X: %s",
xi->name,
xi->irq,
xi->irq_core_id,
bl_error_get_last_msg(teb));
return BL_ERR;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment