ionic_bitid_to_qid(9)
π
ionic_bitid_to_qid β Kernel API Manual, bestie edition π
okay so literally welcome to the Kernel API Manual entry for ionic_bitid_to_qid(9) β yes the (9) is part of the name, it's giving very section-nine of her β¨
πΈ NAME πΈ
ionic_bitid_to_qid β transform a resource bit index into a queue id. that's it. that's the whole vibe check π¦
β¨ SYNOPSIS β¨
u32 ionic_bitid_to_qid (u32 bitid , u8 qgrp_shift , u8 half_qid_shift );
three args, one u32 coming back out, no cap π₯
π ARGUMENTS π
bitidβ the bit index, aka the thing we're transforming πqgrp_shiftβ the Log2 number of queues per queue group (yes, Log2, capital L, she's fancy)half_qid_shiftβ the Log2 of half the total number of queues. half!! not the whole thing!! read the label bestie π
β RETURN β
the queue id. that's the whole return value, she's simple like that π«Ά
π DESCRIPTION π
so here's the lore. Udma-constrained queues (that's QPs and CQs, both of them, don't forget) are associated with their udma by queue group. even queue groups go with udma0, odd queue groups go with udma1. periodt. π
for allocating queue ids, we want to arrange the bits into two halves β even queue groups of udma0 in the lower half of the bitset, and odd queue groups of udma1 in the upper half of the bitset. why? because then one or two calls of find_next_zero_bit can examine all the bits for queues of an entire udma in one go. iconic efficiency behavior honestly π
for example, assuming eight queue groups with qgrp qids per group:
bitid 0*qgrp..1*qgrp-1 : qid 0*qgrp..1*qgrp-1
bitid 1*qgrp..2*qgrp-1 : qid 2*qgrp..3*qgrp-1
bitid 2*qgrp..3*qgrp-1 : qid 4*qgrp..5*qgrp-1
bitid 3*qgrp..4*qgrp-1 : qid 6*qgrp..7*qgrp-1
bitid 4*qgrp..5*qgrp-1 : qid 1*qgrp..2*qgrp-1
bitid 5*qgrp..6*qgrp-1 : qid 3*qgrp..4*qgrp-1
bitid 6*qgrp..7*qgrp-1 : qid 5*qgrp..6*qgrp-1
bitid 7*qgrp..8*qgrp-1 : qid 7*qgrp..8*qgrp-1
see how the second half of the bitids maps back down into the first half of the qids? that's the whole point bestie, the rearrangement is the moment π§
there are three important ranges of bits in the qid, and you will learn them:
- the udma bit
"U"sits atqgrp_shift. it's the least significant bit of the group index, and it determines which udma a queue is associated with. main character bit, honestly π - the bits of lesser significance? we call those the idx bits
"I"β the index of the queue within the group π - the bits of greater significance? those are the grp bits
"G"β other bits of the group index that do not determine the udma. those bits are just rearranged in the bit index in the bitset, no drama π
a bitid has the udma bit in the most significant place, then the grp bits, then the idx bits. look at her go:
bitid: 00000000000000 U GGG IIIIII
qid: 00000000000000 GGG U IIIIII
notice how U migrated from the front-ish to the middle? she moved. she's thriving. β¨
transforming from bit index to qid β or from qid to bit index β can be accomplished by rearranging the bits by masking and shifting. that's it. masking and shifting. no magic, just bits ππ
π₯ SEE ALSO π₯
- Kernel file
./drivers/infiniband/hw/ionic/ionic_res.hβ struct ionic_resid_bits(9)ionic_resid_init(9)ionic_resid_destroy(9)ionic_resid_get_shared(9)ionic_resid_get(9)ionic_resid_put(9)ionic_qid_to_bitid(9)β the reverse girly, go say hi π«
lowkey everything above is in the Kernel API Manual, and the whole thing lives in./drivers/infiniband/hw/ionic, dated October 2026, filed underionic_bitid_to_qid(9). that's the sign-off, mwah ππ¦πΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms