From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5943845AD2; Mon, 7 Oct 2024 10:48:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 45B12402EA; Mon, 7 Oct 2024 10:48:53 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 8C46E402EA for ; Mon, 7 Oct 2024 10:48:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728290931; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dwsgRiS2L0eD8LkDDmr2ZVdKk0pErau1dXVtlAsPwdM=; b=irBYJYUFZ8HE8+iidSgLjOFLY6XhF3s3cVOrJhS66GTy8kd3M8T6EOJnEYU9RbLbbmnHuX YUV/fBwsBOIM6L41V98b51GyRPXXrytYykU+yyt2pj9ujK6qUZABYY07i9SuJh1qMv4ws+ ZHFR5dh6VGNYnhPwqoDuUmr1lh0R/38= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-645-56X7YfjzNrOenPIgk_rctA-1; Mon, 07 Oct 2024 04:48:49 -0400 X-MC-Unique: 56X7YfjzNrOenPIgk_rctA-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2fad3541583so30910271fa.2 for ; Mon, 07 Oct 2024 01:48:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728290928; x=1728895728; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dwsgRiS2L0eD8LkDDmr2ZVdKk0pErau1dXVtlAsPwdM=; b=XCZ08x5fyTPSsuFX7pzjzV2Dt0Ocx1YQPD1prA+f/QB9XOz9/xv3lR8wny8XBdgG8P R5sgGv54hBMNZkrgSsBfpZDYYPtPnyCLRdewZ9B23uxGrjN4n14dvL+6P8asgE2W9CEC Xxrwq/8MJWeY+c4wcVP8+kF435R+rLCf2J3mlrm5y+jWYeKrW+OIv5WMTJ9aOwO3oqk/ 2sN0WGMYm/UkGtM8CL3Mo3CKHB1XcjSyuDSQlh7EIqqmHc2YSjxGBmYTMJvf+fcNnD6L jCDBvcQUYcocYj6kSmf3MbdKyXgV0sYP3e3QhZhiIZ1I9QoHyQ8weGM//o7NFnG6ulYv eHWw== X-Gm-Message-State: AOJu0YwBs16dMeMlqARRY9mP5POcNwXQzFDOSMO4WIVmel6UdWrm2K7Y byVTI1WKRod9y+/pkV0ASaBSIJY5HsT/y46MRcy6rQL+KLO7HOPrpLUa8Icrg/PiRM9GiFtNF// NfcMBcKYi6SNfGKzvffgctK1TOUiwxNuwolvR6hO4jbzqS2nUa6U0Dg3b/FEwq1G5EWBt+O84Ej vLAd00E2YDmGA8yrs= X-Received: by 2002:a2e:be84:0:b0:2ef:2b38:879c with SMTP id 38308e7fff4ca-2faf3c0169cmr50715581fa.3.1728290928159; Mon, 07 Oct 2024 01:48:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGTJWO/bzCFCAQAUVaP41Xzv0bczv1KvI4VWRFvTUjrlwuRcI1tmmKM1wEWooeBZU6WK26j3lB0Sujsunq/eiA= X-Received: by 2002:a2e:be84:0:b0:2ef:2b38:879c with SMTP id 38308e7fff4ca-2faf3c0169cmr50715391fa.3.1728290927672; Mon, 07 Oct 2024 01:48:47 -0700 (PDT) MIME-Version: 1.0 References: <20241007084354.852733-1-g.singh@nxp.com> In-Reply-To: <20241007084354.852733-1-g.singh@nxp.com> From: David Marchand Date: Mon, 7 Oct 2024 10:48:36 +0200 Message-ID: Subject: Re: [PATCH] crypto/dpaa2_sec: rework debug code To: Gagandeep Singh Cc: dev@dpdk.org, gakhil@marvell.com, Jun Yang X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, Oct 7, 2024 at 10:44=E2=80=AFAM Gagandeep Singh w= rote: > > Output debug information according to various modes. > > Signed-off-by: Jun Yang > Signed-off-by: Gagandeep Singh > --- > drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 87 +++++++++++++++------ > 1 file changed, 63 insertions(+), 24 deletions(-) > > diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto= /dpaa2_sec/dpaa2_sec_dpseci.c > index 2cdf9308f8..1a897514e1 100644 > --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c > +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c > @@ -1097,7 +1097,7 @@ build_auth_fd(dpaa2_sec_session *sess, struct rte_c= rypto_op *op, > > static int > build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op, > - struct qbman_fd *fd, __rte_unused uint16_t bpid) > + struct qbman_fd *fd, uint16_t bpid) > { > struct rte_crypto_sym_op *sym_op =3D op->sym; > struct qbman_fle *ip_fle, *op_fle, *sge, *fle; > @@ -1107,6 +1107,10 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct= rte_crypto_op *op, > struct rte_mbuf *mbuf; > uint8_t *iv_ptr =3D rte_crypto_op_ctod_offset(op, uint8_t *, > sess->iv.offset); > +#if (RTE_LOG_DEBUG <=3D RTE_LOG_DP_LEVEL) > + char debug_str[1024]; > + int offset; > +#endif > > data_len =3D sym_op->cipher.data.length; > data_offset =3D sym_op->cipher.data.offset; > @@ -1212,14 +1216,26 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struc= t rte_crypto_op *op, > DPAA2_SET_FD_COMPOUND_FMT(fd); > DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc)); > > - DPAA2_SEC_DP_DEBUG( > - "CIPHER SG: fdaddr =3D%" PRIx64 " bpid =3D%d meta =3D%d" > - " off =3D%d, len =3D%d", > +#if (RTE_LOG_DEBUG <=3D RTE_LOG_DP_LEVEL) > + offset =3D sprintf(debug_str, > + "CIPHER SG: fdaddr =3D%" PRIx64 ", from %s pool ", > DPAA2_GET_FD_ADDR(fd), > - DPAA2_GET_FD_BPID(fd), > - rte_dpaa2_bpid_info[bpid].meta_data_size, > - DPAA2_GET_FD_OFFSET(fd), > - DPAA2_GET_FD_LEN(fd)); > + bpid < MAX_BPID ? "SW" : "BMAN"); > + if (bpid < MAX_BPID) { > + offset +=3D sprintf(&debug_str[offset], > + "bpid =3D %d ", bpid); > + } > + offset +=3D sprintf(&debug_str[offset], > + "private size =3D %d ", > + mbuf->pool->private_data_size); > + offset +=3D sprintf(&debug_str[offset], > + "off =3D%d, len =3D%d", > + DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd)); > + DPAA2_SEC_DP_DEBUG("%s", debug_str); > +#else > + RTE_SET_USED(bpid); > +#endif > + > return 0; > } > > @@ -1235,6 +1251,10 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rt= e_crypto_op *op, > uint8_t *iv_ptr =3D rte_crypto_op_ctod_offset(op, uint8_t *, > sess->iv.offset); > struct rte_mbuf *dst; > +#if (RTE_LOG_DEBUG <=3D RTE_LOG_DP_LEVEL) > + char debug_str[1024]; > + int offset; > +#endif > > data_len =3D sym_op->cipher.data.length; > data_offset =3D sym_op->cipher.data.offset; > @@ -1326,14 +1346,23 @@ build_cipher_fd(dpaa2_sec_session *sess, struct r= te_crypto_op *op, > DPAA2_SET_FLE_FIN(sge); > DPAA2_SET_FLE_FIN(fle); > > - DPAA2_SEC_DP_DEBUG( > - "CIPHER: fdaddr =3D%" PRIx64 " bpid =3D%d meta =3D%d" > - " off =3D%d, len =3D%d", > +#if (RTE_LOG_DEBUG <=3D RTE_LOG_DP_LEVEL) > + offset =3D sprintf(debug_str, > + "CIPHER: fdaddr =3D%" PRIx64 ", from %s pool ", > DPAA2_GET_FD_ADDR(fd), > - DPAA2_GET_FD_BPID(fd), > - rte_dpaa2_bpid_info[bpid].meta_data_size, > - DPAA2_GET_FD_OFFSET(fd), > - DPAA2_GET_FD_LEN(fd)); > + bpid < MAX_BPID ? "SW" : "BMAN"); > + if (bpid < MAX_BPID) { > + offset +=3D sprintf(&debug_str[offset], > + "bpid =3D %d ", bpid); > + } > + offset +=3D sprintf(&debug_str[offset], > + "private size =3D %d ", > + dst->pool->private_data_size); > + offset +=3D sprintf(&debug_str[offset], > + "off =3D%d, len =3D%d", > + DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd)); > + DPAA2_SEC_DP_DEBUG("%s", debug_str); > +#endif > > return 0; > } > @@ -1566,6 +1595,10 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct d= paa2_sec_qp *qp) > struct qbman_fle *fle; > struct rte_crypto_op *op; > struct rte_mbuf *dst, *src; > +#if (RTE_LOG_DEBUG <=3D RTE_LOG_DP_LEVEL) > + char debug_str[1024]; > + int offset; > +#endif > > if (DPAA2_FD_GET_FORMAT(fd) =3D=3D qbman_fd_single) > return sec_simple_fd_to_mbuf(fd); > @@ -1604,15 +1637,21 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct = dpaa2_sec_qp *qp) > dst->data_len =3D len; > } > > - DPAA2_SEC_DP_DEBUG("mbuf %p BMAN buf addr %p," > - " fdaddr =3D%" PRIx64 " bpid =3D%d meta =3D%d off =3D%d, = len =3D%d", > - (void *)dst, > - dst->buf_addr, > - DPAA2_GET_FD_ADDR(fd), > - DPAA2_GET_FD_BPID(fd), > - rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size= , > - DPAA2_GET_FD_OFFSET(fd), > - DPAA2_GET_FD_LEN(fd)); > +#if (RTE_LOG_DEBUG <=3D RTE_LOG_DP_LEVEL) > + offset =3D sprintf(debug_str, "Mbuf %p from %s pool ", > + dst, DPAA2_GET_FD_IVP(fd) ? "SW" : "BMAN"); > + if (!DPAA2_GET_FD_IVP(fd)) { > + offset +=3D sprintf(&debug_str[offset], "bpid =3D %d ", > + DPAA2_GET_FD_BPID(fd)); > + } > + offset +=3D sprintf(&debug_str[offset], > + "private size =3D %d ", dst->pool->private_data_s= ize); > + offset +=3D sprintf(&debug_str[offset], > + "addr %p, fdaddr =3D%" PRIx64 ", off =3D%d, len = =3D%d", > + dst->buf_addr, DPAA2_GET_FD_ADDR(fd), > + DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd)); > + DPAA2_SEC_DP_DEBUG("%s", debug_str); > +#endif > > /* free the fle memory */ > if (likely(rte_pktmbuf_is_contiguous(src))) { > -- > 2.25.1 > Thank you for the formatting changes on the logs. --=20 David Marchand