Replace redundant macro ROUNDUP* with predefined macros.
Signed-off-by: Archana Muniganti <marchana@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
#define CPT_COUNT_THOLD 32
#define CPT_TIMER_THOLD 0x3F
-#ifndef ROUNDUP4
-#define ROUNDUP4(val) (((val) + 3) & 0xfffffffc)
-#endif
-
-#ifndef ROUNDUP8
-#define ROUNDUP8(val) (((val) + 7) & 0xfffffff8)
-#endif
-
-#ifndef ROUNDUP16
-#define ROUNDUP16(val) (((val) + 15) & 0xfffffff0)
-#endif
-
#define MOD_INC(i, l) ((i) == (l - 1) ? (i) = 0 : (i)++)
struct cpt_qp_meta_info {
len += sizeof(struct cpt_request_info);
len += CPT_OFFSET_CONTROL_BYTES + CPT_MAX_IV_LEN;
- len += ROUNDUP8(SG_LIST_HDR_SIZE +
- (ROUNDUP4(CPT_MAX_SG_IN_OUT_CNT) >> 2) * SG_ENTRY_SIZE);
+ len += RTE_ALIGN_CEIL((SG_LIST_HDR_SIZE +
+ (RTE_ALIGN_CEIL(CPT_MAX_SG_IN_OUT_CNT, 4) >> 2) *
+ SG_ENTRY_SIZE), 8);
len += 2 * COMPLETION_CODE_SIZE;
len += 2 * sizeof(cpt_res_s_t);
return len;
if (ctx->hmac) {
vq_cmd_w0.s.opcode.major = CPT_MAJOR_OP_HMAC | CPT_DMA_MODE;
vq_cmd_w0.s.param1 = key_len;
- vq_cmd_w0.s.dlen = data_len + ROUNDUP8(key_len);
+ vq_cmd_w0.s.dlen = data_len + RTE_ALIGN_CEIL(key_len, 8);
} else {
vq_cmd_w0.s.opcode.major = CPT_MAJOR_OP_HASH | CPT_DMA_MODE;
vq_cmd_w0.s.param1 = 0;
uint64_t k_dma = params->ctx_buf.dma_addr +
offsetof(struct cpt_ctx, auth_key);
/* Key */
- i = fill_sg_comp(gather_comp, i, k_dma, ROUNDUP8(key_len));
+ i = fill_sg_comp(gather_comp, i, k_dma,
+ RTE_ALIGN_CEIL(key_len, 8));
}
/* input data */
enc_dlen = encr_data_len + encr_offset;
if (unlikely(encr_data_len & 0xf)) {
if ((cipher_type == DES3_CBC) || (cipher_type == DES3_ECB))
- enc_dlen = ROUNDUP8(encr_data_len) + encr_offset;
+ enc_dlen = RTE_ALIGN_CEIL(encr_data_len, 8) +
+ encr_offset;
else if (likely((cipher_type == AES_CBC) ||
(cipher_type == AES_ECB)))
- enc_dlen = ROUNDUP16(encr_data_len) + encr_offset;
+ enc_dlen = RTE_ALIGN_CEIL(encr_data_len, 8) +
+ encr_offset;
}
if (unlikely(auth_dlen > enc_dlen)) {
/* Truncate input length to curve prime length */
if (message_len > prime_len)
message_len = prime_len;
- m_align = ROUNDUP8(message_len);
+ m_align = RTE_ALIGN_CEIL(message_len, 8);
- p_align = ROUNDUP8(prime_len);
- k_align = ROUNDUP8(k_len);
+ p_align = RTE_ALIGN_CEIL(prime_len, 8);
+ k_align = RTE_ALIGN_CEIL(k_len, 8);
/* Set write offset for order and private key */
o_offset = prime_len - order_len;
if (message_len > prime_len)
message_len = prime_len;
- m_align = ROUNDUP8(message_len);
- p_align = ROUNDUP8(prime_len);
+ m_align = RTE_ALIGN_CEIL(message_len, 8);
+ p_align = RTE_ALIGN_CEIL(prime_len, 8);
/* Set write offset for sign, order and public key coordinates */
o_offset = prime_len - order_len;
/* Input buffer */
dptr = RTE_PTR_ADD(req, sizeof(struct cpt_request_info));
- p_align = ROUNDUP8(prime_len);
- scalar_align = ROUNDUP8(ecpm->scalar.length);
+ p_align = RTE_ALIGN_CEIL(prime_len, 8);
+ scalar_align = RTE_ALIGN_CEIL(ecpm->scalar.length, 8);
/*
* Set dlen = sum(ROUNDUP8(input point(x and y coordinates), prime,
/* Separate out sign r and s components */
memcpy(ecdsa->r.data, req->rptr, prime_len);
- memcpy(ecdsa->s.data, req->rptr + ROUNDUP8(prime_len), prime_len);
+ memcpy(ecdsa->s.data, req->rptr + RTE_ALIGN_CEIL(prime_len, 8),
+ prime_len);
ecdsa->r.length = prime_len;
ecdsa->s.length = prime_len;
}
int prime_len = ec_grp[ec->curveid].prime.length;
memcpy(ecpm->r.x.data, req->rptr, prime_len);
- memcpy(ecpm->r.y.data, req->rptr + ROUNDUP8(prime_len), prime_len);
+ memcpy(ecpm->r.y.data, req->rptr + RTE_ALIGN_CEIL(prime_len, 8),
+ prime_len);
ecpm->r.x.length = prime_len;
ecpm->r.y.length = prime_len;
}
/* Separate out sign r and s components */
memcpy(ecdsa->r.data, req->rptr, prime_len);
- memcpy(ecdsa->s.data, req->rptr + ROUNDUP8(prime_len), prime_len);
+ memcpy(ecdsa->s.data, req->rptr + RTE_ALIGN_CEIL(prime_len, 8),
+ prime_len);
ecdsa->r.length = prime_len;
ecdsa->s.length = prime_len;
}
int prime_len = ec_grp[ec->curveid].prime.length;
memcpy(ecpm->r.x.data, req->rptr, prime_len);
- memcpy(ecpm->r.y.data, req->rptr + ROUNDUP8(prime_len), prime_len);
+ memcpy(ecpm->r.y.data, req->rptr + RTE_ALIGN_CEIL(prime_len, 8),
+ prime_len);
ecpm->r.x.length = prime_len;
ecpm->r.y.length = prime_len;
}