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:

committed by
David S. Miller

parent
c3a321b06a
commit
b6db3f71c9
@@ -7,23 +7,22 @@
|
||||
|
||||
#include "qed_dev_api.h"
|
||||
|
||||
static void qed_chain_init_params(struct qed_chain *chain,
|
||||
u32 page_cnt, u8 elem_size,
|
||||
enum qed_chain_use_mode intended_use,
|
||||
enum qed_chain_mode mode,
|
||||
enum qed_chain_cnt_type cnt_type,
|
||||
const struct qed_chain_ext_pbl *ext_pbl)
|
||||
static void qed_chain_init(struct qed_chain *chain,
|
||||
const struct qed_chain_init_params *params,
|
||||
u32 page_cnt)
|
||||
{
|
||||
memset(chain, 0, sizeof(*chain));
|
||||
|
||||
chain->elem_size = elem_size;
|
||||
chain->intended_use = intended_use;
|
||||
chain->mode = mode;
|
||||
chain->cnt_type = cnt_type;
|
||||
chain->elem_size = params->elem_size;
|
||||
chain->intended_use = params->intended_use;
|
||||
chain->mode = params->mode;
|
||||
chain->cnt_type = params->cnt_type;
|
||||
|
||||
chain->elem_per_page = ELEMS_PER_PAGE(elem_size);
|
||||
chain->usable_per_page = USABLE_ELEMS_PER_PAGE(elem_size, mode);
|
||||
chain->elem_unusable = UNUSABLE_ELEMS_PER_PAGE(elem_size, mode);
|
||||
chain->elem_per_page = ELEMS_PER_PAGE(params->elem_size);
|
||||
chain->usable_per_page = USABLE_ELEMS_PER_PAGE(params->elem_size,
|
||||
params->mode);
|
||||
chain->elem_unusable = UNUSABLE_ELEMS_PER_PAGE(params->elem_size,
|
||||
params->mode);
|
||||
|
||||
chain->elem_per_page_mask = chain->elem_per_page - 1;
|
||||
chain->next_page_mask = chain->usable_per_page &
|
||||
@@ -33,9 +32,9 @@ static void qed_chain_init_params(struct qed_chain *chain,
|
||||
chain->capacity = chain->usable_per_page * page_cnt;
|
||||
chain->size = chain->elem_per_page * page_cnt;
|
||||
|
||||
if (ext_pbl && ext_pbl->p_pbl_virt) {
|
||||
chain->pbl_sp.table_virt = ext_pbl->p_pbl_virt;
|
||||
chain->pbl_sp.table_phys = ext_pbl->p_pbl_phys;
|
||||
if (params->ext_pbl_virt) {
|
||||
chain->pbl_sp.table_virt = params->ext_pbl_virt;
|
||||
chain->pbl_sp.table_phys = params->ext_pbl_phys;
|
||||
|
||||
chain->b_external_pbl = true;
|
||||
}
|
||||
@@ -154,10 +153,16 @@ void qed_chain_free(struct qed_dev *cdev, struct qed_chain *chain)
|
||||
|
||||
static int
|
||||
qed_chain_alloc_sanity_check(struct qed_dev *cdev,
|
||||
enum qed_chain_cnt_type cnt_type,
|
||||
size_t elem_size, u32 page_cnt)
|
||||
const struct qed_chain_init_params *params,
|
||||
u32 page_cnt)
|
||||
{
|
||||
u64 chain_size = ELEMS_PER_PAGE(elem_size) * page_cnt;
|
||||
u64 chain_size;
|
||||
|
||||
chain_size = ELEMS_PER_PAGE(params->elem_size);
|
||||
chain_size *= page_cnt;
|
||||
|
||||
if (!chain_size)
|
||||
return -EINVAL;
|
||||
|
||||
/* The actual chain size can be larger than the maximal possible value
|
||||
* after rounding up the requested elements number to pages, and after
|
||||
@@ -165,7 +170,7 @@ qed_chain_alloc_sanity_check(struct qed_dev *cdev,
|
||||
* The size of a "u16" chain can be (U16_MAX + 1) since the chain
|
||||
* size/capacity fields are of u32 type.
|
||||
*/
|
||||
switch (cnt_type) {
|
||||
switch (params->cnt_type) {
|
||||
case QED_CHAIN_CNT_TYPE_U16:
|
||||
if (chain_size > U16_MAX + 1)
|
||||
break;
|
||||
@@ -298,37 +303,42 @@ alloc_pages:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int qed_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 *chain,
|
||||
struct qed_chain_ext_pbl *ext_pbl)
|
||||
/**
|
||||
* qed_chain_alloc() - Allocate and initialize a chain.
|
||||
*
|
||||
* @cdev: Main device structure.
|
||||
* @chain: Chain to be processed.
|
||||
* @params: Chain initialization parameters.
|
||||
*
|
||||
* Return: 0 on success, negative errno otherwise.
|
||||
*/
|
||||
int qed_chain_alloc(struct qed_dev *cdev, struct qed_chain *chain,
|
||||
struct qed_chain_init_params *params)
|
||||
{
|
||||
u32 page_cnt;
|
||||
int rc;
|
||||
|
||||
if (mode == QED_CHAIN_MODE_SINGLE)
|
||||
if (params->mode == QED_CHAIN_MODE_SINGLE)
|
||||
page_cnt = 1;
|
||||
else
|
||||
page_cnt = QED_CHAIN_PAGE_CNT(num_elems, elem_size, mode);
|
||||
page_cnt = QED_CHAIN_PAGE_CNT(params->num_elems,
|
||||
params->elem_size,
|
||||
params->mode);
|
||||
|
||||
rc = qed_chain_alloc_sanity_check(cdev, cnt_type, elem_size, page_cnt);
|
||||
rc = qed_chain_alloc_sanity_check(cdev, params, page_cnt);
|
||||
if (rc) {
|
||||
DP_NOTICE(cdev,
|
||||
"Cannot allocate a chain with the given arguments:\n");
|
||||
DP_NOTICE(cdev,
|
||||
"[use_mode %d, mode %d, cnt_type %d, num_elems %d, elem_size %zu]\n",
|
||||
intended_use, mode, cnt_type, num_elems, elem_size);
|
||||
params->intended_use, params->mode, params->cnt_type,
|
||||
params->num_elems, params->elem_size);
|
||||
return rc;
|
||||
}
|
||||
|
||||
qed_chain_init_params(chain, page_cnt, elem_size, intended_use, mode,
|
||||
cnt_type, ext_pbl);
|
||||
qed_chain_init(chain, params, page_cnt);
|
||||
|
||||
switch (mode) {
|
||||
switch (params->mode) {
|
||||
case QED_CHAIN_MODE_NEXT_PTR:
|
||||
rc = qed_chain_alloc_next_ptr(cdev, chain);
|
||||
break;
|
||||
|
@@ -254,35 +254,9 @@ int qed_dmae_host2host(struct qed_hwfn *p_hwfn,
|
||||
dma_addr_t dest_addr,
|
||||
u32 size_in_dwords, struct qed_dmae_params *p_params);
|
||||
|
||||
/**
|
||||
* @brief qed_chain_alloc - Allocate and initialize a chain
|
||||
*
|
||||
* @param p_hwfn
|
||||
* @param intended_use
|
||||
* @param mode
|
||||
* @param num_elems
|
||||
* @param elem_size
|
||||
* @param p_chain
|
||||
* @param ext_pbl - a possible external PBL
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int
|
||||
qed_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);
|
||||
|
||||
/**
|
||||
* @brief qed_chain_free - Free chain DMA memory
|
||||
*
|
||||
* @param p_hwfn
|
||||
* @param p_chain
|
||||
*/
|
||||
void qed_chain_free(struct qed_dev *cdev, struct qed_chain *p_chain);
|
||||
int qed_chain_alloc(struct qed_dev *cdev, struct qed_chain *chain,
|
||||
struct qed_chain_init_params *params);
|
||||
void qed_chain_free(struct qed_dev *cdev, struct qed_chain *chain);
|
||||
|
||||
/**
|
||||
* @@brief qed_fw_l2_queue - Get absolute L2 queue ID
|
||||
|
@@ -684,9 +684,13 @@ nomem:
|
||||
static int qed_iscsi_allocate_connection(struct qed_hwfn *p_hwfn,
|
||||
struct qed_iscsi_conn **p_out_conn)
|
||||
{
|
||||
u16 uhq_num_elements = 0, xhq_num_elements = 0, r2tq_num_elements = 0;
|
||||
struct scsi_terminate_extra_params *p_q_cnts = NULL;
|
||||
struct qed_iscsi_pf_params *p_params = NULL;
|
||||
struct qed_chain_init_params params = {
|
||||
.mode = QED_CHAIN_MODE_PBL,
|
||||
.intended_use = QED_CHAIN_USE_TO_CONSUME_PRODUCE,
|
||||
.cnt_type = QED_CHAIN_CNT_TYPE_U16,
|
||||
};
|
||||
struct tcp_upload_params *p_tcp = NULL;
|
||||
struct qed_iscsi_conn *p_conn = NULL;
|
||||
int rc = 0;
|
||||
@@ -727,34 +731,25 @@ static int qed_iscsi_allocate_connection(struct qed_hwfn *p_hwfn,
|
||||
goto nomem_upload_param;
|
||||
p_conn->tcp_upload_params_virt_addr = p_tcp;
|
||||
|
||||
r2tq_num_elements = p_params->num_r2tq_pages_in_ring *
|
||||
QED_CHAIN_PAGE_SIZE / 0x80;
|
||||
rc = qed_chain_alloc(p_hwfn->cdev,
|
||||
QED_CHAIN_USE_TO_CONSUME_PRODUCE,
|
||||
QED_CHAIN_MODE_PBL,
|
||||
QED_CHAIN_CNT_TYPE_U16,
|
||||
r2tq_num_elements, 0x80, &p_conn->r2tq, NULL);
|
||||
params.num_elems = p_params->num_r2tq_pages_in_ring *
|
||||
QED_CHAIN_PAGE_SIZE / sizeof(struct iscsi_wqe);
|
||||
params.elem_size = sizeof(struct iscsi_wqe);
|
||||
|
||||
rc = qed_chain_alloc(p_hwfn->cdev, &p_conn->r2tq, ¶ms);
|
||||
if (rc)
|
||||
goto nomem_r2tq;
|
||||
|
||||
uhq_num_elements = p_params->num_uhq_pages_in_ring *
|
||||
params.num_elems = p_params->num_uhq_pages_in_ring *
|
||||
QED_CHAIN_PAGE_SIZE / sizeof(struct iscsi_uhqe);
|
||||
rc = qed_chain_alloc(p_hwfn->cdev,
|
||||
QED_CHAIN_USE_TO_CONSUME_PRODUCE,
|
||||
QED_CHAIN_MODE_PBL,
|
||||
QED_CHAIN_CNT_TYPE_U16,
|
||||
uhq_num_elements,
|
||||
sizeof(struct iscsi_uhqe), &p_conn->uhq, NULL);
|
||||
params.elem_size = sizeof(struct iscsi_uhqe);
|
||||
|
||||
rc = qed_chain_alloc(p_hwfn->cdev, &p_conn->uhq, ¶ms);
|
||||
if (rc)
|
||||
goto nomem_uhq;
|
||||
|
||||
xhq_num_elements = uhq_num_elements;
|
||||
rc = qed_chain_alloc(p_hwfn->cdev,
|
||||
QED_CHAIN_USE_TO_CONSUME_PRODUCE,
|
||||
QED_CHAIN_MODE_PBL,
|
||||
QED_CHAIN_CNT_TYPE_U16,
|
||||
xhq_num_elements,
|
||||
sizeof(struct iscsi_xhqe), &p_conn->xhq, NULL);
|
||||
params.elem_size = sizeof(struct iscsi_xhqe);
|
||||
|
||||
rc = qed_chain_alloc(p_hwfn->cdev, &p_conn->xhq, ¶ms);
|
||||
if (rc)
|
||||
goto nomem;
|
||||
|
||||
|
@@ -1125,6 +1125,12 @@ static int
|
||||
qed_ll2_acquire_connection_rx(struct qed_hwfn *p_hwfn,
|
||||
struct qed_ll2_info *p_ll2_info)
|
||||
{
|
||||
struct qed_chain_init_params params = {
|
||||
.intended_use = QED_CHAIN_USE_TO_CONSUME_PRODUCE,
|
||||
.cnt_type = QED_CHAIN_CNT_TYPE_U16,
|
||||
.num_elems = p_ll2_info->input.rx_num_desc,
|
||||
};
|
||||
struct qed_dev *cdev = p_hwfn->cdev;
|
||||
struct qed_ll2_rx_packet *p_descq;
|
||||
u32 capacity;
|
||||
int rc = 0;
|
||||
@@ -1132,13 +1138,10 @@ qed_ll2_acquire_connection_rx(struct qed_hwfn *p_hwfn,
|
||||
if (!p_ll2_info->input.rx_num_desc)
|
||||
goto out;
|
||||
|
||||
rc = qed_chain_alloc(p_hwfn->cdev,
|
||||
QED_CHAIN_USE_TO_CONSUME_PRODUCE,
|
||||
QED_CHAIN_MODE_NEXT_PTR,
|
||||
QED_CHAIN_CNT_TYPE_U16,
|
||||
p_ll2_info->input.rx_num_desc,
|
||||
sizeof(struct core_rx_bd),
|
||||
&p_ll2_info->rx_queue.rxq_chain, NULL);
|
||||
params.mode = QED_CHAIN_MODE_NEXT_PTR;
|
||||
params.elem_size = sizeof(struct core_rx_bd);
|
||||
|
||||
rc = qed_chain_alloc(cdev, &p_ll2_info->rx_queue.rxq_chain, ¶ms);
|
||||
if (rc) {
|
||||
DP_NOTICE(p_hwfn, "Failed to allocate ll2 rxq chain\n");
|
||||
goto out;
|
||||
@@ -1154,13 +1157,10 @@ qed_ll2_acquire_connection_rx(struct qed_hwfn *p_hwfn,
|
||||
}
|
||||
p_ll2_info->rx_queue.descq_array = p_descq;
|
||||
|
||||
rc = qed_chain_alloc(p_hwfn->cdev,
|
||||
QED_CHAIN_USE_TO_CONSUME_PRODUCE,
|
||||
QED_CHAIN_MODE_PBL,
|
||||
QED_CHAIN_CNT_TYPE_U16,
|
||||
p_ll2_info->input.rx_num_desc,
|
||||
sizeof(struct core_rx_fast_path_cqe),
|
||||
&p_ll2_info->rx_queue.rcq_chain, NULL);
|
||||
params.mode = QED_CHAIN_MODE_PBL;
|
||||
params.elem_size = sizeof(struct core_rx_fast_path_cqe);
|
||||
|
||||
rc = qed_chain_alloc(cdev, &p_ll2_info->rx_queue.rcq_chain, ¶ms);
|
||||
if (rc) {
|
||||
DP_NOTICE(p_hwfn, "Failed to allocate ll2 rcq chain\n");
|
||||
goto out;
|
||||
@@ -1177,6 +1177,13 @@ out:
|
||||
static int qed_ll2_acquire_connection_tx(struct qed_hwfn *p_hwfn,
|
||||
struct qed_ll2_info *p_ll2_info)
|
||||
{
|
||||
struct qed_chain_init_params params = {
|
||||
.mode = QED_CHAIN_MODE_PBL,
|
||||
.intended_use = QED_CHAIN_USE_TO_CONSUME_PRODUCE,
|
||||
.cnt_type = QED_CHAIN_CNT_TYPE_U16,
|
||||
.num_elems = p_ll2_info->input.tx_num_desc,
|
||||
.elem_size = sizeof(struct core_tx_bd),
|
||||
};
|
||||
struct qed_ll2_tx_packet *p_descq;
|
||||
u32 desc_size;
|
||||
u32 capacity;
|
||||
@@ -1185,13 +1192,8 @@ static int qed_ll2_acquire_connection_tx(struct qed_hwfn *p_hwfn,
|
||||
if (!p_ll2_info->input.tx_num_desc)
|
||||
goto out;
|
||||
|
||||
rc = qed_chain_alloc(p_hwfn->cdev,
|
||||
QED_CHAIN_USE_TO_CONSUME_PRODUCE,
|
||||
QED_CHAIN_MODE_PBL,
|
||||
QED_CHAIN_CNT_TYPE_U16,
|
||||
p_ll2_info->input.tx_num_desc,
|
||||
sizeof(struct core_tx_bd),
|
||||
&p_ll2_info->tx_queue.txq_chain, NULL);
|
||||
rc = qed_chain_alloc(p_hwfn->cdev, &p_ll2_info->tx_queue.txq_chain,
|
||||
¶ms);
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
|
@@ -382,22 +382,26 @@ int qed_eq_completion(struct qed_hwfn *p_hwfn, void *cookie)
|
||||
|
||||
int qed_eq_alloc(struct qed_hwfn *p_hwfn, u16 num_elem)
|
||||
{
|
||||
struct qed_chain_init_params params = {
|
||||
.mode = QED_CHAIN_MODE_PBL,
|
||||
.intended_use = QED_CHAIN_USE_TO_PRODUCE,
|
||||
.cnt_type = QED_CHAIN_CNT_TYPE_U16,
|
||||
.num_elems = num_elem,
|
||||
.elem_size = sizeof(union event_ring_element),
|
||||
};
|
||||
struct qed_eq *p_eq;
|
||||
int ret;
|
||||
|
||||
/* Allocate EQ struct */
|
||||
p_eq = kzalloc(sizeof(*p_eq), GFP_KERNEL);
|
||||
if (!p_eq)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Allocate and initialize EQ chain*/
|
||||
if (qed_chain_alloc(p_hwfn->cdev,
|
||||
QED_CHAIN_USE_TO_PRODUCE,
|
||||
QED_CHAIN_MODE_PBL,
|
||||
QED_CHAIN_CNT_TYPE_U16,
|
||||
num_elem,
|
||||
sizeof(union event_ring_element),
|
||||
&p_eq->chain, NULL))
|
||||
ret = qed_chain_alloc(p_hwfn->cdev, &p_eq->chain, ¶ms);
|
||||
if (ret) {
|
||||
DP_NOTICE(p_hwfn, "Failed to allocate EQ chain\n");
|
||||
goto eq_allocate_fail;
|
||||
}
|
||||
|
||||
/* register EQ completion on the SP SB */
|
||||
qed_int_register_cb(p_hwfn, qed_eq_completion,
|
||||
@@ -408,7 +412,8 @@ int qed_eq_alloc(struct qed_hwfn *p_hwfn, u16 num_elem)
|
||||
|
||||
eq_allocate_fail:
|
||||
kfree(p_eq);
|
||||
return -ENOMEM;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void qed_eq_setup(struct qed_hwfn *p_hwfn)
|
||||
@@ -529,33 +534,40 @@ void qed_spq_setup(struct qed_hwfn *p_hwfn)
|
||||
|
||||
int qed_spq_alloc(struct qed_hwfn *p_hwfn)
|
||||
{
|
||||
struct qed_chain_init_params params = {
|
||||
.mode = QED_CHAIN_MODE_SINGLE,
|
||||
.intended_use = QED_CHAIN_USE_TO_PRODUCE,
|
||||
.cnt_type = QED_CHAIN_CNT_TYPE_U16,
|
||||
.elem_size = sizeof(struct slow_path_element),
|
||||
};
|
||||
struct qed_dev *cdev = p_hwfn->cdev;
|
||||
struct qed_spq_entry *p_virt = NULL;
|
||||
struct qed_spq *p_spq = NULL;
|
||||
dma_addr_t p_phys = 0;
|
||||
u32 capacity;
|
||||
int ret;
|
||||
|
||||
/* SPQ struct */
|
||||
p_spq = kzalloc(sizeof(struct qed_spq), GFP_KERNEL);
|
||||
if (!p_spq)
|
||||
return -ENOMEM;
|
||||
|
||||
/* SPQ ring */
|
||||
if (qed_chain_alloc(p_hwfn->cdev,
|
||||
QED_CHAIN_USE_TO_PRODUCE,
|
||||
QED_CHAIN_MODE_SINGLE,
|
||||
QED_CHAIN_CNT_TYPE_U16,
|
||||
0, /* N/A when the mode is SINGLE */
|
||||
sizeof(struct slow_path_element),
|
||||
&p_spq->chain, NULL))
|
||||
goto spq_allocate_fail;
|
||||
/* SPQ ring */
|
||||
ret = qed_chain_alloc(cdev, &p_spq->chain, ¶ms);
|
||||
if (ret) {
|
||||
DP_NOTICE(p_hwfn, "Failed to allocate SPQ chain\n");
|
||||
goto spq_chain_alloc_fail;
|
||||
}
|
||||
|
||||
/* allocate and fill the SPQ elements (incl. ramrod data list) */
|
||||
capacity = qed_chain_get_capacity(&p_spq->chain);
|
||||
p_virt = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
|
||||
ret = -ENOMEM;
|
||||
|
||||
p_virt = dma_alloc_coherent(&cdev->pdev->dev,
|
||||
capacity * sizeof(struct qed_spq_entry),
|
||||
&p_phys, GFP_KERNEL);
|
||||
if (!p_virt)
|
||||
goto spq_allocate_fail;
|
||||
goto spq_alloc_fail;
|
||||
|
||||
p_spq->p_virt = p_virt;
|
||||
p_spq->p_phys = p_phys;
|
||||
@@ -563,10 +575,12 @@ int qed_spq_alloc(struct qed_hwfn *p_hwfn)
|
||||
|
||||
return 0;
|
||||
|
||||
spq_allocate_fail:
|
||||
qed_chain_free(p_hwfn->cdev, &p_spq->chain);
|
||||
spq_alloc_fail:
|
||||
qed_chain_free(cdev, &p_spq->chain);
|
||||
spq_chain_alloc_fail:
|
||||
kfree(p_spq);
|
||||
return -ENOMEM;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void qed_spq_free(struct qed_hwfn *p_hwfn)
|
||||
@@ -967,30 +981,40 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define QED_SPQ_CONSQ_ELEM_SIZE 0x80
|
||||
|
||||
int qed_consq_alloc(struct qed_hwfn *p_hwfn)
|
||||
{
|
||||
struct qed_chain_init_params params = {
|
||||
.mode = QED_CHAIN_MODE_PBL,
|
||||
.intended_use = QED_CHAIN_USE_TO_PRODUCE,
|
||||
.cnt_type = QED_CHAIN_CNT_TYPE_U16,
|
||||
.num_elems = QED_CHAIN_PAGE_SIZE / QED_SPQ_CONSQ_ELEM_SIZE,
|
||||
.elem_size = QED_SPQ_CONSQ_ELEM_SIZE,
|
||||
};
|
||||
struct qed_consq *p_consq;
|
||||
int ret;
|
||||
|
||||
/* Allocate ConsQ struct */
|
||||
p_consq = kzalloc(sizeof(*p_consq), GFP_KERNEL);
|
||||
if (!p_consq)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Allocate and initialize EQ chain*/
|
||||
if (qed_chain_alloc(p_hwfn->cdev,
|
||||
QED_CHAIN_USE_TO_PRODUCE,
|
||||
QED_CHAIN_MODE_PBL,
|
||||
QED_CHAIN_CNT_TYPE_U16,
|
||||
QED_CHAIN_PAGE_SIZE / 0x80,
|
||||
0x80, &p_consq->chain, NULL))
|
||||
goto consq_allocate_fail;
|
||||
/* Allocate and initialize ConsQ chain */
|
||||
ret = qed_chain_alloc(p_hwfn->cdev, &p_consq->chain, ¶ms);
|
||||
if (ret) {
|
||||
DP_NOTICE(p_hwfn, "Failed to allocate ConsQ chain");
|
||||
goto consq_alloc_fail;
|
||||
}
|
||||
|
||||
p_hwfn->p_consq = p_consq;
|
||||
|
||||
return 0;
|
||||
|
||||
consq_allocate_fail:
|
||||
consq_alloc_fail:
|
||||
kfree(p_consq);
|
||||
return -ENOMEM;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void qed_consq_setup(struct qed_hwfn *p_hwfn)
|
||||
|
Reference in New Issue
Block a user