Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bnxt_re/lib: Code refactoring in the resource allocation verbs #1436

Merged
merged 5 commits into from Mar 12, 2024

Conversation

selvintxavier
Copy link
Contributor

Implements few helper functions for better code maintainability. Allocates the queue memory and the shadow queue memory together and manage the pointer for accessing the queue memory and shadow queue memory. Also splits some big functions to smaller sub functions.

@@ -614,4 +620,14 @@ static inline void bnxt_re_sub_sec_busy_wait(uint32_t nsec)
}

#define BNXT_RE_HW_RETX(a) ((a)->comp_mask & BNXT_RE_COMP_MASK_UCNTX_HW_RETX_ENABLED)

static inline uint32_t llog2(uint32_t x)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have this function, "git grep ilog32"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have this function, "git grep ilog32"

Thanks. I missed searching for log32. Will update the PR.

@@ -554,6 +557,11 @@ static inline void bnxt_re_jqq_mod_last(struct bnxt_re_joint_queue *jqq,
jqq->last_idx = jqq->swque[idx].next_idx;
}

static inline uint32_t bnxt_re_get_diff(uint64_t cmask)
Copy link
Member

@rleon rleon Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no value in function which simply returns define

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree that it is not useful with the current patch. I will remove it.
I have a follow up series which avoid this diff for newer adapters, that includes kernel driver changes. We will have to check the compatibility mask for adding the diff. I will re-introduce the function for that series.

Adds few helper functions for the series which reorganize
the queue memory allocation. Includes functions that allocate/free
queue memory and get a buffer address from the allocated memory.
Also, added some data structure changes.

Signed-off-by: Selvin Xavier <[email protected]>
Refactor the implementation of create_qp for better readability
and maintainability. Also, allocate the QP memory and the shadow
memory for SQ and RQ together. Split this allocated memory and assign
the  SQ and RQ virtual address from this memory.

Signed-off-by: Selvin Xavier <[email protected]>
Refactor CQ create function for better maintainability.
Allocate a memory to hold the queue data structure.
Makes corresponding changes where the queue structure
is accessed.

Signed-off-by: Selvin Xavier <[email protected]>
Code refactoring for better maintainability. Allocate the
queue memory and shadow queues together and use the new
helper functions to get the address of the queues.

Signed-off-by: Selvin Xavier <[email protected]>
Remove the unused functions as the lib has moved
to the newer helper functions.

Signed-off-by: Selvin Xavier <[email protected]>
@rleon rleon merged commit 523f68c into linux-rdma:master Mar 12, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants