qed: simplify chain allocation with init params struct

To simplify qed_chain_alloc() prototype and call sites, introduce struct
qed_chain_init_params to specify chain params, and pass a pointer to
filled struct to the actual qed_chain_alloc() instead of a long list
of separate arguments.

Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Alexander Lobakin
2020-07-23 01:10:38 +03:00
committed by David S. Miller
parent c3a321b06a
commit b6db3f71c9
10 changed files with 242 additions and 233 deletions

View File

@@ -54,11 +54,6 @@ struct qed_chain_pbl_u32 {
u32 cons_page_idx;
};
struct qed_chain_ext_pbl {
dma_addr_t p_pbl_phys;
void *p_pbl_virt;
};
struct qed_chain_u16 {
/* Cyclic index of next element to produce/consme */
u16 prod_idx;
@@ -119,7 +114,7 @@ struct qed_chain {
u16 usable_per_page;
u8 elem_unusable;
u8 cnt_type;
enum qed_chain_cnt_type cnt_type;
/* Slowpath of the chain - required for initialization and destruction,
* but isn't involved in regular functionality.
@@ -142,11 +137,23 @@ struct qed_chain {
/* Total number of elements [for entire chain] */
u32 size;
u8 intended_use;
enum qed_chain_use_mode intended_use;
bool b_external_pbl;
};
struct qed_chain_init_params {
enum qed_chain_mode mode;
enum qed_chain_use_mode intended_use;
enum qed_chain_cnt_type cnt_type;
u32 num_elems;
size_t elem_size;
void *ext_pbl_virt;
dma_addr_t ext_pbl_phys;
};
#define QED_CHAIN_PAGE_SIZE 0x1000
#define ELEMS_PER_PAGE(elem_size) \

View File

@@ -948,13 +948,8 @@ struct qed_common_ops {
u8 dp_level);
int (*chain_alloc)(struct qed_dev *cdev,
enum qed_chain_use_mode intended_use,
enum qed_chain_mode mode,
enum qed_chain_cnt_type cnt_type,
u32 num_elems,
size_t elem_size,
struct qed_chain *p_chain,
struct qed_chain_ext_pbl *ext_pbl);
struct qed_chain *chain,
struct qed_chain_init_params *params);
void (*chain_free)(struct qed_dev *cdev,
struct qed_chain *p_chain);