hwrm_req_replace(9)
π hwrm_req_replace(9) β from the Kernel API Manual, bestie
Okay so real talk, this page is literally called hwrm_req_replace, and it lives in the Kernel API Manual. It's a lil function in the bnxt driver that swaps out your request data, and honestly? It's giving "glow-up for a request object." Let's get into it π
β¨ NAME β¨
hwrm_req_replace β replace request data. That's it, that's the whole vibe.
π¦ SYNOPSIS π¦
int hwrm_req_replace (struct bnxt *bp , void *req , void *new_req , u32
len );
πΈ ARGUMENTS πΈ
bpβ the driver context. Your main character struct, the whole reason we're here.reqβ the request you wanna modify. And okay, important: callinghwrm_req_replaceis conceptually an assignment ofnew_reqtoreq. So after this, when you hit up HWRM API functions likehwrm_req_send, you usereqand NOTnew_req. Fr fr. And actually β calls to HWRM API functions will fail if you pass non-managed request objects. So don't do that πnew_reqβ the pre-built request you're copying or referencing. The new fit β¨lenβ the length ofnew_req. Gotta know how big the outfit is.
π DESCRIPTION π
So what it does: replaces the request data in req with the data from new_req. Iconic.
This is lowkey perfect for those scenarios where a request object has already been constructed by a third party, before you even created a resource-managed request using hwrm_req_init. Like, the request walked in already dressed and you're just fitting it into the managed-request system.
Depending on the length, hwrm_req_replace will do one of two things:
- copy the new request data into the DMA memory allocated for
req, or - simply reference the new request and use it in lieu of
reqduring subsequent calls tohwrm_req_send.
Either way, the resource management is associated with req, and it is independent of and does not apply to new_req. That's the key part, bestie π«Ά
β οΈ The caller must ensure that the lifetime ofnew_reqis at least as long asreq. Like, not shorter. Don't let it ghost early. π
Also: any slices that may have been associated with the original request are released. Out with the old π
π₯ RETURN π₯
0on success π- A negative error code otherwise:
E2BIGβ request is too large. It ate too much πEINVALβ invalid request to modify. Not it. π
π SEE ALSO π
Kernel file ./drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c, plus the whole friend group:
__hwrm_req_init(9), hwrm_req_timeout(9), hwrm_req_alloc_flags(9), hwrm_req_flags(9), hwrm_req_hold(9), hwrm_req_drop(9), hwrm_req_send(9), hwrm_req_send_silent(9), hwrm_req_dma_slice(9)
Alright bestie, that's the page π it's from ./drivers/net/ethernet/broadco... (the path got a lil truncated, we don't gatekeep), dated October 2026, and the whole thing is signed hwrm_req_replace(9) top and bottom like a true signature scent. Slay, go manage those requests responsibly ππ§
π¦ 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