struct rte_bbdev_op_turbo_dec *turbo_dec = &ref_op->turbo_dec;
for (i = 0; i < n; ++i) {
- if (turbo_dec->code_block_mode == 0) {
+ if (turbo_dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
ops[i]->turbo_dec.tb_params.ea =
turbo_dec->tb_params.ea;
ops[i]->turbo_dec.tb_params.eb =
unsigned int i;
struct rte_bbdev_op_turbo_enc *turbo_enc = &ref_op->turbo_enc;
for (i = 0; i < n; ++i) {
- if (turbo_enc->code_block_mode == 0) {
+ if (turbo_enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
ops[i]->turbo_enc.tb_params.ea =
turbo_enc->tb_params.ea;
ops[i]->turbo_enc.tb_params.eb =
struct rte_bbdev_op_ldpc_dec *ldpc_dec = &ref_op->ldpc_dec;
for (i = 0; i < n; ++i) {
- if (ldpc_dec->code_block_mode == 0) {
+ if (ldpc_dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
ops[i]->ldpc_dec.tb_params.ea =
ldpc_dec->tb_params.ea;
ops[i]->ldpc_dec.tb_params.eb =
unsigned int i;
struct rte_bbdev_op_ldpc_enc *ldpc_enc = &ref_op->ldpc_enc;
for (i = 0; i < n; ++i) {
- if (ldpc_enc->code_block_mode == 0) {
+ if (ldpc_enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
ops[i]->ldpc_enc.tb_params.ea = ldpc_enc->tb_params.ea;
ops[i]->ldpc_enc.tb_params.eb = ldpc_enc->tb_params.eb;
ops[i]->ldpc_enc.tb_params.cab =
uint8_t i;
uint32_t c, r, tb_size = 0;
- if (op->turbo_dec.code_block_mode) {
+ if (op->turbo_dec.code_block_mode == RTE_BBDEV_CODE_BLOCK) {
tb_size = op->turbo_dec.tb_params.k_neg;
} else {
c = op->turbo_dec.tb_params.c;
uint32_t c, r, tb_size = 0;
uint16_t sys_cols = (op->ldpc_dec.basegraph == 1) ? 22 : 10;
- if (op->ldpc_dec.code_block_mode) {
+ if (op->ldpc_dec.code_block_mode == RTE_BBDEV_CODE_BLOCK) {
tb_size = sys_cols * op->ldpc_dec.z_c - op->ldpc_dec.n_filler;
} else {
c = op->ldpc_dec.tb_params.c;
uint8_t i;
uint32_t c, r, tb_size = 0;
- if (op->turbo_enc.code_block_mode) {
+ if (op->turbo_enc.code_block_mode == RTE_BBDEV_CODE_BLOCK) {
tb_size = op->turbo_enc.tb_params.k_neg;
} else {
c = op->turbo_enc.tb_params.c;
uint32_t c, r, tb_size = 0;
uint16_t sys_cols = (op->ldpc_enc.basegraph == 1) ? 22 : 10;
- if (op->turbo_enc.code_block_mode) {
+ if (op->ldpc_enc.code_block_mode == RTE_BBDEV_CODE_BLOCK) {
tb_size = sys_cols * op->ldpc_enc.z_c - op->ldpc_enc.n_filler;
} else {
c = op->turbo_enc.tb_params.c;
if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) {
printf(
"WARNING: code_block_mode was not specified in vector file and will be set to 1 (0 - TB Mode, 1 - CB mode)\n");
- turbo_dec->code_block_mode = 1;
+ turbo_dec->code_block_mode = RTE_BBDEV_CODE_BLOCK;
}
- if (turbo_dec->code_block_mode == 0) {
+ if (turbo_dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
if (!(mask & TEST_BBDEV_VF_EA))
printf(
"WARNING: ea was not specified in vector file and will be set to 0\n");
if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) {
printf(
"WARNING: code_block_mode was not specified in vector file and will be set to 1 (0 - TB Mode, 1 - CB mode)\n");
- ldpc_dec->code_block_mode = 1;
+ ldpc_dec->code_block_mode = RTE_BBDEV_CODE_BLOCK;
}
- if (ldpc_dec->code_block_mode == 0) {
+ if (ldpc_dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
if (!(mask & TEST_BBDEV_VF_EA))
printf(
"WARNING: ea was not specified in vector file and will be set to 0\n");
if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) {
printf(
"WARNING: code_block_mode was not specified in vector file and will be set to 1\n");
- vector->turbo_enc.code_block_mode = 1;
+ vector->turbo_enc.code_block_mode = RTE_BBDEV_CODE_BLOCK;
}
- if (vector->turbo_enc.code_block_mode == 0) {
+ if (vector->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
if (!(mask & TEST_BBDEV_VF_EA) && (vector->turbo_enc.op_flags &
RTE_BBDEV_TURBO_RATE_MATCH))
printf(
if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) {
printf(
"WARNING: code_block_mode was not specified in vector file and will be set to 1\n");
- vector->turbo_enc.code_block_mode = 1;
+ vector->turbo_enc.code_block_mode = RTE_BBDEV_CODE_BLOCK;
}
- if (vector->turbo_enc.code_block_mode == 0) {
+ if (vector->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
} else {
if (!(mask & TEST_BBDEV_VF_E) && (vector->turbo_enc.op_flags &
RTE_BBDEV_TURBO_RATE_MATCH))
acc100_fcw_te_fill(const struct rte_bbdev_enc_op *op, struct acc100_fcw_te *fcw)
{
fcw->code_block_mode = op->turbo_enc.code_block_mode;
- if (fcw->code_block_mode == 0) { /* For TB mode */
+ if (fcw->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
fcw->k_neg = op->turbo_enc.tb_params.k_neg;
fcw->k_pos = op->turbo_enc.tb_params.k_pos;
fcw->c_neg = op->turbo_enc.tb_params.c_neg;
{
/* Note : Early termination is always enabled for 4GUL */
fcw->fcw_ver = 1;
- if (op->turbo_dec.code_block_mode == 0)
+ if (op->turbo_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
fcw->k_pos = op->turbo_dec.tb_params.k_pos;
else
fcw->k_pos = op->turbo_dec.cb_params.k;
fcw->ncb = op->ldpc_dec.n_cb;
fcw->k0 = get_k0(fcw->ncb, fcw->Zc, op->ldpc_dec.basegraph,
op->ldpc_dec.rv_index);
- if (op->ldpc_dec.code_block_mode == 1)
+ if (op->ldpc_dec.code_block_mode == RTE_BBDEV_CODE_BLOCK)
fcw->rm_e = op->ldpc_dec.cb_params.e;
else
fcw->rm_e = (op->ldpc_dec.tb_params.r <
desc->word3 = 0;
desc->numCBs = 1;
- if (op->turbo_enc.code_block_mode == 0) {
+ if (op->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
ea = op->turbo_enc.tb_params.ea;
eb = op->turbo_enc.tb_params.eb;
cab = op->turbo_enc.tb_params.cab;
desc->word3 = 0;
desc->numCBs = 1;
- if (op->turbo_dec.code_block_mode == 0) {
+ if (op->turbo_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
k = (r < op->turbo_dec.tb_params.c_neg)
? op->turbo_dec.tb_params.k_neg
: op->turbo_dec.tb_params.k_pos;
e = op->turbo_dec.cb_params.e;
}
- if ((op->turbo_dec.code_block_mode == 0)
+ if ((op->turbo_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
&& !check_bit(op->turbo_dec.op_flags,
RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP))
crc24_overlap = 24;
turbo_enc->rv_index);
return -1;
}
- if (turbo_enc->code_block_mode != 0 &&
- turbo_enc->code_block_mode != 1) {
+ if (turbo_enc->code_block_mode != RTE_BBDEV_TRANSPORT_BLOCK &&
+ turbo_enc->code_block_mode != RTE_BBDEV_CODE_BLOCK) {
rte_bbdev_log(ERR,
"code_block_mode (%u) is out of range 0 <= value <= 1",
turbo_enc->code_block_mode);
return -1;
}
- if (turbo_enc->code_block_mode == 0) {
+ if (turbo_enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
tb = &turbo_enc->tb_params;
if ((tb->k_neg < RTE_BBDEV_TURBO_MIN_CB_SIZE
|| tb->k_neg > RTE_BBDEV_TURBO_MAX_CB_SIZE)
ldpc_enc->rv_index);
return -1;
}
- if (ldpc_enc->code_block_mode > 1) {
+ if (ldpc_enc->code_block_mode > RTE_BBDEV_CODE_BLOCK) {
rte_bbdev_log(ERR,
"code_block_mode (%u) is out of range 0 <= value <= 1",
ldpc_enc->code_block_mode);
ldpc_dec->rv_index);
return -1;
}
- if (ldpc_dec->code_block_mode > 1) {
+ if (ldpc_dec->code_block_mode > RTE_BBDEV_CODE_BLOCK) {
rte_bbdev_log(ERR,
"code_block_mode (%u) is out of range 0 <= value <= 1",
ldpc_dec->code_block_mode);
turbo_dec->iter_min, turbo_dec->iter_max);
return -1;
}
- if (turbo_dec->code_block_mode != 0 &&
- turbo_dec->code_block_mode != 1) {
+ if (turbo_dec->code_block_mode != RTE_BBDEV_TRANSPORT_BLOCK &&
+ turbo_dec->code_block_mode != RTE_BBDEV_CODE_BLOCK) {
rte_bbdev_log(ERR,
"code_block_mode (%u) is out of range 0 <= value <= 1",
turbo_dec->code_block_mode);
return -1;
}
- if (turbo_dec->code_block_mode == 0) {
+ if (turbo_dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
tb = &turbo_dec->tb_params;
if ((tb->k_neg < RTE_BBDEV_TURBO_MIN_CB_SIZE
|| tb->k_neg > RTE_BBDEV_TURBO_MAX_CB_SIZE)
{
if (unlikely(num == 0))
return 0;
- if (ops[0]->turbo_enc.code_block_mode == 0)
+ if (ops[0]->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
return acc100_enqueue_enc_tb(q_data, ops, num);
else
return acc100_enqueue_enc_cb(q_data, ops, num);
{
if (unlikely(num == 0))
return 0;
- if (ops[0]->ldpc_enc.code_block_mode == 0)
+ if (ops[0]->ldpc_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
return acc100_enqueue_enc_tb(q_data, ops, num);
else
return acc100_enqueue_ldpc_enc_cb(q_data, ops, num);
{
if (unlikely(num == 0))
return 0;
- if (ops[0]->turbo_dec.code_block_mode == 0)
+ if (ops[0]->turbo_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
return acc100_enqueue_dec_tb(q_data, ops, num);
else
return acc100_enqueue_dec_cb(q_data, ops, num);
if (unlikely((aq_avail == 0) || (num == 0)))
return 0;
- if (ops[0]->ldpc_dec.code_block_mode == 0)
+ if (ops[0]->ldpc_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
return acc100_enqueue_ldpc_dec_tb(q_data, ops, num);
else
return acc100_enqueue_ldpc_dec_cb(q_data, ops, num);
for (i = 0; i < dequeue_num; ++i) {
op = (q->ring_addr + ((q->sw_ring_tail + dequeued_cbs)
& q->sw_ring_wrap_mask))->req.op_addr;
- if (op->turbo_enc.code_block_mode == 0)
+ if (op->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
ret = dequeue_enc_one_op_tb(q, &ops[i], dequeued_cbs,
&aq_dequeued);
else
for (i = 0; i < dequeue_num; ++i) {
op = (q->ring_addr + ((q->sw_ring_tail + dequeued_cbs)
& q->sw_ring_wrap_mask))->req.op_addr;
- if (op->turbo_dec.code_block_mode == 0)
+ if (op->turbo_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
ret = dequeue_dec_one_op_tb(q, &ops[i], dequeued_cbs,
&aq_dequeued);
else
for (i = 0; i < dequeue_num; ++i) {
op = (q->ring_addr + ((q->sw_ring_tail + dequeued_cbs)
& q->sw_ring_wrap_mask))->req.op_addr;
- if (op->ldpc_dec.code_block_mode == 0)
+ if (op->ldpc_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
ret = dequeue_dec_one_op_tb(q, &ops[i], dequeued_cbs,
&aq_dequeued);
else
ldpc_enc->basegraph);
return -1;
}
- if (ldpc_enc->code_block_mode > 1) {
+ if (ldpc_enc->code_block_mode > RTE_BBDEV_CODE_BLOCK) {
rte_bbdev_log(ERR,
"code_block_mode (%u) is out of range 0:Tb 1:CB",
ldpc_enc->code_block_mode);
return -1;
}
- if (ldpc_enc->code_block_mode == 0) {
+ if (ldpc_enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
tb = &ldpc_enc->tb_params;
if (tb->c == 0) {
rte_bbdev_log(ERR,
return -1;
}
- if (ldpc_dec->code_block_mode > 1) {
+ if (ldpc_dec->code_block_mode > RTE_BBDEV_CODE_BLOCK) {
rte_bbdev_log(ERR,
"code_block_mode (%u) is out of range 0 <= value <= 1",
ldpc_dec->code_block_mode);
return -1;
}
- if (ldpc_dec->code_block_mode == 0) {
+ if (ldpc_dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
tb = &ldpc_dec->tb_params;
if (tb->c < 1) {
rte_bbdev_log(ERR,
if (enc->op_flags & RTE_BBDEV_LDPC_CRC_24B_ATTACH)
crc24_bits = 24;
- if (enc->code_block_mode == 0) {
+ if (enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
/* For Transport Block mode */
/* FIXME */
c = enc->tb_params.c;
desc->k = k;
desc->crc_type = !check_bit(op->turbo_dec.op_flags,
RTE_BBDEV_TURBO_CRC_TYPE_24B);
- if ((op->turbo_dec.code_block_mode == 0)
+ if ((op->turbo_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
&& !check_bit(op->turbo_dec.op_flags,
RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP))
desc->drop_crc = 1;
turbo_enc->rv_index);
return -1;
}
- if (turbo_enc->code_block_mode != 0 &&
- turbo_enc->code_block_mode != 1) {
+ if (turbo_enc->code_block_mode != RTE_BBDEV_TRANSPORT_BLOCK &&
+ turbo_enc->code_block_mode != RTE_BBDEV_CODE_BLOCK) {
rte_bbdev_log(ERR,
"code_block_mode (%u) is out of range 0 <= value <= 1",
turbo_enc->code_block_mode);
return -1;
}
- if (turbo_enc->code_block_mode == 0) {
+ if (turbo_enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
tb = &turbo_enc->tb_params;
if ((tb->k_neg < RTE_BBDEV_TURBO_MIN_CB_SIZE
|| tb->k_neg > RTE_BBDEV_TURBO_MAX_CB_SIZE)
turbo_dec->iter_min, turbo_dec->iter_max);
return -1;
}
- if (turbo_dec->code_block_mode != 0 &&
- turbo_dec->code_block_mode != 1) {
+ if (turbo_dec->code_block_mode != RTE_BBDEV_TRANSPORT_BLOCK &&
+ turbo_dec->code_block_mode != RTE_BBDEV_CODE_BLOCK) {
rte_bbdev_log(ERR,
"code_block_mode (%u) is out of range 0 <= value <= 1",
turbo_dec->code_block_mode);
return -1;
}
- if (turbo_dec->code_block_mode == 0) {
+ if (turbo_dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
if ((turbo_dec->op_flags &
RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP) &&
q->ring_ctrl_reg.ring_size + q->head_free_desc - q->tail - 1;
for (i = 0; i < num; ++i) {
- if (ops[i]->turbo_enc.code_block_mode == 0) {
+ if (ops[i]->turbo_enc.code_block_mode ==
+ RTE_BBDEV_TRANSPORT_BLOCK) {
cbs_in_op = get_num_cbs_in_op_enc(&ops[i]->turbo_enc);
/* Check if there is available space for further
* processing
q->ring_ctrl_reg.ring_size + q->head_free_desc - q->tail - 1;
for (i = 0; i < num; ++i) {
- if (ops[i]->turbo_dec.code_block_mode == 0) {
+ if (ops[i]->turbo_dec.code_block_mode ==
+ RTE_BBDEV_TRANSPORT_BLOCK) {
cbs_in_op = get_num_cbs_in_op_dec(&ops[i]->turbo_dec);
/* Check if there is available space for further
* processing
for (i = 0; (i < num) && (dequeued_cbs < avail); ++i) {
op = (q->ring_addr + ((q->head_free_desc + dequeued_cbs)
& q->sw_ring_wrap_mask))->enc_req.op_addr;
- if (op->turbo_enc.code_block_mode == 0)
+ if (op->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
ret = dequeue_enc_one_op_tb(q, &ops[i], dequeued_cbs);
else
ret = dequeue_enc_one_op_cb(q, &ops[i], dequeued_cbs);
for (i = 0; (i < num) && (dequeued_cbs < avail); ++i) {
op = (q->ring_addr + ((q->head_free_desc + dequeued_cbs)
& q->sw_ring_wrap_mask))->dec_req.op_addr;
- if (op->turbo_dec.code_block_mode == 0)
+ if (op->turbo_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
ret = dequeue_dec_one_op_tb(q, &ops[i], dequeued_cbs);
else
ret = dequeue_dec_one_op_cb(q, &ops[i], dequeued_cbs);
/* CRC24A (for TB) */
if ((enc->op_flags & RTE_BBDEV_TURBO_CRC_24A_ATTACH) &&
- (enc->code_block_mode == 1)) {
+ (enc->code_block_mode == RTE_BBDEV_CODE_BLOCK)) {
#ifdef RTE_LIBRTE_BBDEV_DEBUG
ret = is_enc_input_valid(k - 24, k_idx, in_length);
if (ret != 0) {
(enc->op_flags & RTE_BBDEV_TURBO_CRC_24A_ATTACH))
crc24_bits = 24;
- if (enc->code_block_mode == 0) { /* For Transport Block mode */
+ if (enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
c = enc->tb_params.c;
r = enc->tb_params.r;
} else {/* For Code Block mode */
seg_total_left = rte_pktmbuf_data_len(m_in) - in_offset;
- if (enc->code_block_mode == 0) {
+ if (enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
k = (r < enc->tb_params.c_neg) ?
enc->tb_params.k_neg : enc->tb_params.k_pos;
ncb = (r < enc->tb_params.c_neg) ?
(enc->op_flags & RTE_BBDEV_TURBO_CRC_24A_ATTACH))
crc24_bits = 24;
- if (enc->code_block_mode == 0) { /* For Transport Block mode */
+ if (enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
c = enc->tb_params.c;
r = enc->tb_params.r;
} else { /* For Code Block mode */
seg_total_left = rte_pktmbuf_data_len(m_in) - in_offset;
- if (enc->code_block_mode == 0) {
+ if (enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
e = (r < enc->tb_params.cab) ?
enc->tb_params.ea : enc->tb_params.eb;
} else {
return;
}
- if (dec->code_block_mode == 0) { /* For Transport Block mode */
+ if (dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
c = dec->tb_params.c;
} else { /* For Code Block mode */
k = dec->cb_params.k;
crc24_overlap = 24;
while (mbuf_total_left > 0) {
- if (dec->code_block_mode == 0)
+ if (dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
k = (r < dec->tb_params.c_neg) ?
dec->tb_params.k_neg : dec->tb_params.k_pos;
return;
}
- if (dec->code_block_mode == 0) { /* For Transport Block mode */
+ if (dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
c = dec->tb_params.c;
e = dec->tb_params.ea;
} else { /* For Code Block mode */
out_length = ((out_length - crc24_overlap - dec->n_filler) >> 3);
while (mbuf_total_left > 0) {
- if (dec->code_block_mode == 0)
+ if (dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
e = (r < dec->tb_params.cab) ?
dec->tb_params.ea : dec->tb_params.eb;
/* Special case handling when overusing mbuf */
/** Set if a device supports scatter-gather functionality */
RTE_BBDEV_TURBO_DEC_SCATTER_GATHER = (1ULL << 15),
/** Set to keep CRC24B bits appended while decoding. Only usable when
- * decoding Transport Blocks (code_block_mode = 0).
+ * decoding Transport Block mode.
*/
RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP = (1ULL << 16)
};
RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
};
+/** Flags for the Code Block/Transport block mode */
+enum rte_bbdev_op_cb_mode {
+ /** One operation is one or fraction of one transport block */
+ RTE_BBDEV_TRANSPORT_BLOCK = 0,
+ /** One operation is one code block mode */
+ RTE_BBDEV_CODE_BLOCK = 1,
+};
+
/** Data input and output buffer for BBDEV operations */
struct rte_bbdev_op_data {
/** The mbuf data structure representing the data for BBDEV operation.