From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8733FA04F7; Tue, 7 Jan 2020 05:15:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 37FC01D8DC; Tue, 7 Jan 2020 05:15:08 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 4BCE21D8DA for ; Tue, 7 Jan 2020 05:15:07 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0074EVd1022802; Mon, 6 Jan 2020 20:15:03 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=dMq5ZEeRlTB2FN0MFO4zmiFKiBYbJVAXechF9PpMEVE=; b=BtcOkiqKmi9GpBJQ6zkvHKcAQBatpiVIK1ztAPRHS9YmCOOpYlz1xIJwz9kJMMXiPnZo 7p4O/ew5dH1o+Nr7Rysna+sZ0Dymo9BgYakiIG5Q360gfoDtpxob1FhEezbRS2KSoL9Y Xeji09UUhcQ9tWdz8/9bpez2zudseb0Z88BrdhbRitwC3EC1rIT6VXZOULrNqQqp3wqG FFzXXmT9DjKEZPGxGSSMHUaCcxySCPTI9yiBo8OnDVSFLCu0Pn+CHqqDaBjBLs2ds0Ow EFJMdQT+gHRYnQQd9V3ibXneA6kZ/krxi/w3P8/30uCFJRrJg5B5VGcAuWb8kNCmNkoS zw== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2xau3srjdh-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 06 Jan 2020 20:15:03 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 6 Jan 2020 20:15:00 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.49) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 6 Jan 2020 20:14:59 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LINFfXzYsSCRJFkqX9G1WAjrObhhIi1kN1I1unT9tevp6S6+WrO7bDPDDRtY9BS6HzHmeIFznuqiMAKJx4uaNdPLD5oO0Xx5hKaA2zvV9gHD3e/tbGfLOIcZQE3CQdTP2afc46MyM2qcK8we0SasmNIsx0sfTlBsK0gIAW78pcvPQZP6DNsNrk39Bp6U5CFxDTrcbRzmU6sM6guHwPr15sZqTJdqyPNdbWjKgESXK0Ft0xhHFT+adr4BZG3c4uE45TLV9jqLfItIs/qX2bc8Mt1U2Qk22ScNELjXnp/DcbxrPOO4IO7lIkeyuE52QEDxE6yvXRZ9Nxy+aBymRfhgpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dMq5ZEeRlTB2FN0MFO4zmiFKiBYbJVAXechF9PpMEVE=; b=MLN8u0tSKBgrJe5eIaedIOm/c7fGL/p3Gaz7JXUX6qnlFFcI43F/Cr2hKj16PoEX2W/gmQ6/HugpkIGdsEdTlw5szS8dkpYUa9MCgEkhz+GTxzEP4Cub9sA9UbSg7zLkg5lVDk+AFOdw/RZyDlMC1Kud9Qz8fQT4TkS44fa7U3kpb5BleukJm62lOHGSjk3LuKy6Bx4N5ooKPdyf6AesYnYiqxODu9vBwB+CD7gYIf3Kq2rFcIDuT0LvU+Skww3ir+32MskVbxKTzNxZLnl/kErsetnAExvA1994j1I/W9NvEifHwlkDxTPtt4unGRy5DDiR7KxgSYgZjd0nZzP1ig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dMq5ZEeRlTB2FN0MFO4zmiFKiBYbJVAXechF9PpMEVE=; b=D8sinhrMqQqquSmObf0y/grnPAo7uDGNFUcuJJ0WNmtAKM+Ktai4Asxb/SfHzxI4/U4DylqZDhBVj3RiHUUePL159KD4qmv66QiGOkBGM2K4EiuzLfNlLQmISPK4a03K0/Y7o4HhYPq0ktG9Kujg6kFKjmcnATjvbK3xzFD0Y0c= Received: from MWHPR18MB1376.namprd18.prod.outlook.com (10.173.243.18) by MWHPR18MB1680.namprd18.prod.outlook.com (10.173.240.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.13; Tue, 7 Jan 2020 04:14:58 +0000 Received: from MWHPR18MB1376.namprd18.prod.outlook.com ([fe80::3d27:53fc:7a3a:f73a]) by MWHPR18MB1376.namprd18.prod.outlook.com ([fe80::3d27:53fc:7a3a:f73a%5]) with mapi id 15.20.2602.016; Tue, 7 Jan 2020 04:14:58 +0000 From: Mahipal Challa To: Gavin Hu , "dev@dpdk.org" CC: Jerin Jacob Kollanukkaran , "Narayana Prasad Raju Athreya" , Subrahmanyam Nilla , Venkateshwarlu Nalla , nd Thread-Topic: [dpdk-dev] [PATCH v3 6/6] raw/octeontx2_ep: add driver self test Thread-Index: AQHVxQlbvaa+z5fpSE+BksTyfMjfUKfeku5A Date: Tue, 7 Jan 2020 04:14:57 +0000 Message-ID: References: <1578312447-17277-1-git-send-email-mchalla@marvell.com> <1578312447-17277-7-git-send-email-mchalla@marvell.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [122.175.93.242] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 37b0ad7c-9614-450e-3d3d-08d793282857 x-ms-traffictypediagnostic: MWHPR18MB1680: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(136003)(366004)(346002)(376002)(39860400002)(189003)(199004)(52294003)(13464003)(66556008)(81166006)(7696005)(66446008)(66476007)(64756008)(66946007)(76116006)(6506007)(71200400001)(54906003)(110136005)(186003)(8936002)(8676002)(316002)(81156014)(86362001)(2906002)(33656002)(26005)(53546011)(9686003)(55016002)(4326008)(5660300002)(52536014)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR18MB1680; H:MWHPR18MB1376.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: IUi2z7B6ed3sfgSGapqDxLD1cMncEBqOr17cir2eBXlYAc1FaB4u2/GuPxx5NChPl5K+TcIlosZwuaDgXW+RUINQGUJjO03sHnOR0D7cpr45f0tBfHymQET5NzmCt9gAUeMAk5i1LFKa7bXrXeU3xem8kSTNqPD3owBiaSZg55PSSUfLT2IOi1REtaw7ntWh0ssYy5rbinwPh02/aQlu61roaI8xSZ6Wxlrw1iuqi0l1bBssoQMFo/2VKhj3gDPknsDc+X2eZDrjT0oTf/fgCeDp0dWYQ+PKj2ef/9lHdkXYZ1n5UwGhdO0Oz3h+OEWY6Sz84027NG+iiIwFoOw/8wMyVC1hOhwIgXWC5WJerQ/uSeMpqxGnq6NxovuVe18vArfcF9KWtdHiBTbQqhsNIiPt5v4lggdecIjTRPa/5z5bAwxKvxbGcd4NUaS2d/RM6rp6Bvv2lRyGa8zQpsafNQFjiPYyi3KjtDfZLFyOzkS1swMQgtBnNMibo1eeyWTgqbqV+bZ0VqWK6u+snm2Klg== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 37b0ad7c-9614-450e-3d3d-08d793282857 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 04:14:57.9456 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lOWa6+r6tDl9tbuzYrdixnmTf7/o6VypAmIC7COGdIfGzXXchy6UPMNrdVG9kmz5WEziLZ8NAkEkIwVg7wiVhg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR18MB1680 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2020-01-06_08:2020-01-06,2020-01-06 signatures=0 Subject: Re: [dpdk-dev] [PATCH v3 6/6] raw/octeontx2_ep: add driver self test X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Gavin, Please see response inline > -----Original Message----- > From: Gavin Hu > Sent: Tuesday, January 7, 2020 8:13 AM > To: Mahipal Challa ; dev@dpdk.org > Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju > Athreya ; Subrahmanyam Nilla > ; Venkateshwarlu Nalla ; nd > > Subject: [EXT] RE: [dpdk-dev] [PATCH v3 6/6] raw/octeontx2_ep: add driver > self test >=20 > External Email >=20 > ---------------------------------------------------------------------- > Hi Mahipal, >=20 > > -----Original Message----- > > From: Mahipal Challa > > Sent: Monday, January 6, 2020 8:07 PM > > To: dev@dpdk.org > > Cc: jerinj@marvell.com; pathreya@marvell.com; snilla@marvell.com; > > venkatn@marvell.com; Gavin Hu > > Subject: [dpdk-dev] [PATCH v3 6/6] raw/octeontx2_ep: add driver self > > test > > > > Add rawdev's selftest feature in SDP VF driver, which verifies the EP > > mode functionality test. > > > > Signed-off-by: Mahipal Challa > > --- > > doc/guides/rawdevs/octeontx2_ep.rst | 13 +++ > > drivers/raw/octeontx2_ep/Makefile | 1 + > > drivers/raw/octeontx2_ep/meson.build | 1 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + > > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 2 + > > drivers/raw/octeontx2_ep/otx2_ep_test.c | 166 > > ++++++++++++++++++++++++++++++ > > 6 files changed, 184 insertions(+) > > > > diff --git a/doc/guides/rawdevs/octeontx2_ep.rst > > b/doc/guides/rawdevs/octeontx2_ep.rst > > index 39a7c29..bbcf530 100644 > > --- a/doc/guides/rawdevs/octeontx2_ep.rst > > +++ b/doc/guides/rawdevs/octeontx2_ep.rst > > @@ -74,3 +74,16 @@ Performing Data Transfer To perform data transfer > > using SDP VF EP rawdev devices use standard > > ``rte_rawdev_enqueue_buffers()`` and ``rte_rawdev_dequeue_buffers()`` > > APIs. > > > > +Self test > > +--------- > > + > > +On EAL initialization, SDP VF devices will be probed and populated > > +into the raw devices. The rawdev ID of the device can be obtained > > +using > > + > > +* Invoke ``rte_rawdev_get_dev_id("SDPEP:x")`` from the test > > +application > > + where x is the VF device's bus id specified in > > +"bus:device.func"(BDF) > > + format. Use this index for further rawdev function calls. > > + > > +* The driver's selftest rawdev API can be used to verify the SDP EP > > +mode > > + functional tests which can send/receive the raw data packets > > +to/from the > > + EP device. > > diff --git a/drivers/raw/octeontx2_ep/Makefile > > b/drivers/raw/octeontx2_ep/Makefile > > index 02853fb..44fdf89 100644 > > --- a/drivers/raw/octeontx2_ep/Makefile > > +++ b/drivers/raw/octeontx2_ep/Makefile > > @@ -37,6 +37,7 @@ LIBABIVER :=3D 1 > > # > > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) +=3D > otx2_ep_rawdev.c > > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) +=3D > otx2_ep_enqdeq.c > > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) +=3D > > otx2_ep_test.c > > SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) +=3D > otx2_ep_vf.c > > > > > > diff --git a/drivers/raw/octeontx2_ep/meson.build > > b/drivers/raw/octeontx2_ep/meson.build > > index 99e6c6d..0e6338f 100644 > > --- a/drivers/raw/octeontx2_ep/meson.build > > +++ b/drivers/raw/octeontx2_ep/meson.build > > @@ -5,4 +5,5 @@ > > deps +=3D ['bus_pci', 'common_octeontx2', 'rawdev'] sources =3D > > files('otx2_ep_rawdev.c', > > 'otx2_ep_enqdeq.c', > > + 'otx2_ep_test.c', > > 'otx2_ep_vf.c') > > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > > b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > > index 7158b97..0778603 100644 > > --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > > +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > > @@ -253,6 +253,7 @@ > > .dev_close =3D sdp_rawdev_close, > > .enqueue_bufs =3D sdp_rawdev_enqueue, > > .dequeue_bufs =3D sdp_rawdev_dequeue, > > + .dev_selftest =3D sdp_rawdev_selftest, > > }; > > > > static int > > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > > b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > > index a77cbab..dab2fb7 100644 > > --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > > +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > > @@ -494,4 +494,6 @@ int sdp_rawdev_enqueue(struct rte_rawdev *dev, > > struct rte_rawdev_buf **buffers, int sdp_rawdev_dequeue(struct > > rte_rawdev *dev, struct rte_rawdev_buf **buffers, > > unsigned int count, rte_rawdev_obj_t context); > > > > +int sdp_rawdev_selftest(uint16_t dev_id); > > + > > #endif /* _OTX2_EP_RAWDEV_H_ */ > > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_test.c > > b/drivers/raw/octeontx2_ep/otx2_ep_test.c > > new file mode 100644 > > index 0000000..fc913a6 > > --- /dev/null > > +++ b/drivers/raw/octeontx2_ep/otx2_ep_test.c > > @@ -0,0 +1,166 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright(C) 2019 Marvell International Ltd. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > + > > +#include "otx2_common.h" > > +#include "otx2_ep_rawdev.h" > > + > > +#define SDP_IOQ_NUM_BUFS (4 * 1024) > > +#define SDP_IOQ_BUF_SIZE (2 * 1024) > > + > > +#define SDP_TEST_PKT_FSZ (0) > > +#define SDP_TEST_PKT_SIZE (1024) > > + > > +static int > > +sdp_validate_data(struct sdp_droq_pkt *oq_pkt, uint8_t *iq_pkt, > > + uint32_t pkt_len) > > +{ > > + if (!oq_pkt) > > + return -EINVAL; > > + > > + if (pkt_len !=3D oq_pkt->len) { > > + otx2_err("Invalid packet length"); > > + return -EINVAL; > > + } > > + > > + if (memcmp(oq_pkt->data, iq_pkt, pkt_len) !=3D 0) { > > + otx2_err("Data validation failed"); > > + return -EINVAL; > > + } > > + otx2_sdp_dbg("Data validation successful"); > > + > > + return 0; > > +} > > + > > +static void > > +sdp_ioq_buffer_fill(uint8_t *addr, uint32_t len) { > > + uint32_t idx; > > + > > + memset(addr, 0, len); > > + > > + for (idx =3D 0; idx < len; idx++) > > + addr[idx] =3D idx; > > +} > > + > > +static struct rte_mempool* > > +sdp_ioq_mempool_create(void) > > +{ > > + struct rte_mempool *mpool; > > + > > + mpool =3D rte_mempool_create("ioqbuf_pool", > > + SDP_IOQ_NUM_BUFS /*num elt*/, > > + SDP_IOQ_BUF_SIZE /*elt size*/, > > + 0 /*cache_size*/, > > + 0 /*private_data_size*/, > > + NULL /*mp_init*/, > > + NULL /*mp_init arg*/, > > + NULL /*obj_init*/, > > + NULL /*obj_init arg*/, > > + rte_socket_id() /*socket id*/, > > + (MEMPOOL_F_SP_PUT | > > MEMPOOL_F_SC_GET)); > > + > > + return mpool; > > +} > > + > > + > > +int > > +sdp_rawdev_selftest(uint16_t dev_id) > > +{ > > + struct sdp_rawdev_info app_info =3D {0}; > > + struct rte_rawdev_info dev_info =3D {0}; > > + > > + struct rte_rawdev_buf *d_buf[1]; > > + struct sdp_droq_pkt oq_pkt; > > + struct sdp_soft_instr si; > > + struct sdp_device sdpvf; > > + > > + uint32_t buf_size; > > + int ret =3D 0; > > + void *buf; > > + > > + otx2_info("SDP RAWDEV Self Test: Started"); > > + > > + memset(&oq_pkt, 0x00, sizeof(oq_pkt)); > > + d_buf[0] =3D (struct rte_rawdev_buf *)&oq_pkt; > > + > > + struct rte_mempool *ioq_mpool =3D sdp_ioq_mempool_create(); > > + if (!ioq_mpool) { > > + otx2_err("IOQ mpool creation failed"); > > + return -ENOMEM; > > + } > > + > > + app_info.enqdeq_mpool =3D ioq_mpool; > > + app_info.app_conf =3D NULL; /* Use default conf */ > > + > > + dev_info.dev_private =3D &app_info; > > + > > + ret =3D rte_rawdev_configure(dev_id, &dev_info); > > + if (ret) { > > + otx2_err("Unable to configure SDP_VF %d", dev_id); >=20 > The ioq_mpool was still not freed in the failure path? [Mahipal]: Will handle it in v4, but I feel there is no harm with this as t= his is a test API for a minimal test application which exits end of this te= st, anyway will handle it. > I see similar possible leakage in the other patches. [Mahipal]: Assuming you are talking about the comment you gave in v2, Pleas= e see the response to the same. We have handled all the err handling, it is= part of the patch " [v3,3/6] raw/octeontx2_ep: add device uninitializatio= n".=20 If you still find anymore please feel free to point me. >=20 > > + return -ENOMEM; > > + } > > + otx2_info("SDP VF rawdev[%d] configured successfully", dev_id); > > + > > + memset(&si, 0x00, sizeof(si)); > > + memset(&sdpvf, 0x00, sizeof(sdpvf)); > > + > > + buf_size =3D SDP_TEST_PKT_SIZE; > > + > > + si.q_no =3D 0; > > + si.reqtype =3D SDP_REQTYPE_NORESP; > > + si.rptr =3D NULL; > > + > > + si.ih.fsz =3D SDP_TEST_PKT_FSZ; > > + si.ih.tlen =3D buf_size; > > + si.ih.gather =3D 0; > > + > > + /* Enqueue raw pkt data */ > > + rte_mempool_get(ioq_mpool, &buf); > > + if (!buf) { > > + otx2_err("Buffer allocation failed"); > > + return -ENOMEM; > > + } > > + > > + sdp_ioq_buffer_fill(buf, buf_size); > > + si.dptr =3D (uint8_t *)buf; > > + > > + rte_rawdev_enqueue_buffers(dev_id, NULL, 1, &si); > > + usleep(10000); > > + > > + /* Dequeue raw pkt data */ > > + ret =3D 0; > > + while (ret < 1) { > > + ret =3D rte_rawdev_dequeue_buffers(dev_id, &d_buf[0], 1, > > &si); > > + rte_pause(); > > + } > > + > > + /* Validate the dequeued raw pkt data */ > > + if (sdp_validate_data((struct sdp_droq_pkt *)d_buf[0], > > + buf, buf_size) !=3D 0) { > > + otx2_err("Data invalid"); > > + return -EINVAL; > > + } > > + > > + rte_mempool_put(ioq_mpool, ((struct sdp_droq_pkt *)d_buf[0])- > > >data); > > + if (ioq_mpool) > > + rte_mempool_free(ioq_mpool); > > + > > + otx2_info("SDP RAWDEV Self Test: Successful"); > > + > > + return 0; > > +} > > + > > -- > > 1.8.3.1 Thanks, Mahipal