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 BBFF6A04F3; Fri, 3 Jan 2020 07:50:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0A3721C294; Fri, 3 Jan 2020 07:50:02 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 3A2251C28F for ; Fri, 3 Jan 2020 07:50:00 +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 0036jJXi020490; Thu, 2 Jan 2020 22:49:57 -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 : mime-version; s=pfpt0818; bh=CrR4/aRPeprvU9n8CLUKRgRh/Y/4EXpv7nAaR67X2Ak=; b=SCVIQB7cq4ceMrt6o9rdwYjATtRcBSd/fbohv0JoM0DG2Jrwz104yhy5WZ0T5+UP+0ag TljwL2n5C8MvaFkbj+rLZbLwiqvhuE2I0UWU3Dt64n50CQCIdY8wN7LJ9KOdURxynPZY /dFD97K/HK1Jh/2Xu5rmjlLTt+xq5Vhc1oT4S2FvGtKxsiQfaSBBs+bp8rwS8SST70fn nK3wvmdX+tFS5D64Y71bH3iFZ+Teoen6WNTf3goVzXR65lTjvp/yZUuRdbfPq+8YCrxy VhHG7uYgtBDadD+tkpmvOMGq00WDwzwqTwtcTv4LOm+DHcaaBzRZL94p+ja5QzEy/RdC QQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2x67etqnp8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 02 Jan 2020 22:49:57 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Jan 2020 22:49:54 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.177) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Thu, 2 Jan 2020 22:49:54 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CMRi1cWPD0dFRF0s4MBI5LUJPQzhb+/QsqB88DrErsz6ZcQJekZG9BExSM+NeftRMk/Q9pesa25TCZuD7xK4piD+Wv85PAgLBRToW4XzVsut3Le35FkX1sNeU5F4cszlcO2VE5EkW1cyQZrXZVCl1FkioMfI4ScjnROBXsm3uxmhrLPgOvD9SIyZk0iIxuIEl+ODM+LPgKbMmj3KtvNhG8SIitO1p5NGfEYaOffy51LZ6G4hLXTOjrUmeNJ7FCwzSTcZMwISK06jdKHOFRB7ibUpSY7T72GlLXYuCfpybYM3h8yOX/t+rh4EKa8C2R0Vl8RWte7Sv/KNcgoFJQ0DoA== 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=CrR4/aRPeprvU9n8CLUKRgRh/Y/4EXpv7nAaR67X2Ak=; b=YQHYIJhgo4VLtHNQ1l4sCWXqdt4nrLW073tMwKxc4/6UMz3z8x8aLRAoLP2P71dC6x2QAuIpErWBGtsArp6kZS1Wj0o6ZmjuzOL/xlZY4+fIgR8eYPL1fNmBTzvGPxuk0RBFZ7UHfD5lEZDeTsXlN+huKAFuGQRKT7coZEXkWrn5B/Sm14twRbMTH68wKQU56qWcFCP/9CZ4pfts1HKIY+/d56X15aMHQyRR+HVM5bqivz2A7cvRFFd0QnUngI5yF/OQJ4NUQWVDXQqYJCLQI60BW7sTuvwCFxVYrLwY2z8ODvm7MG0e4WH2bPdh2ZOi1igsuzrHaX5V1wUZiZqvwQ== 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=CrR4/aRPeprvU9n8CLUKRgRh/Y/4EXpv7nAaR67X2Ak=; b=cNos4iB3hn/PGvY76c/zZijiCHXMt3uO5eAnKFf83rZBb+AQZ8HxzsDhBFIQOlsXHS1/EPCXA3AJ2dp7Q6bWvSWa3KD5eIXNeAjlfyFBDH8hCH2vPiUjMA36flriZrF9xk1cYaNawfIObmf5iPF7MKBYQirNlau02LmMLFg7vrQ= Received: from MWHPR18MB1376.namprd18.prod.outlook.com (10.173.243.18) by MWHPR18MB1037.namprd18.prod.outlook.com (10.173.122.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.10; Fri, 3 Jan 2020 06:49:52 +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.012; Fri, 3 Jan 2020 06:49:51 +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] [dpdk-dev PATCH v2 6/6] raw/octeontx2_ep: add driver self test Thread-Index: AQHVvLLqYY1F7lTfCk2pTottJJBBSKfXMqIAgAFTgms= Date: Fri, 3 Jan 2020 06:49:51 +0000 Message-ID: References: <1577450386-16966-1-git-send-email-mchalla@marvell.com> <1577450386-16966-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: [115.113.156.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: be079718-92cf-49c2-b145-08d790192248 x-ms-traffictypediagnostic: MWHPR18MB1037: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 0271483E06 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(396003)(39850400004)(366004)(376002)(346002)(199004)(189003)(13464003)(81166006)(81156014)(55236004)(5660300002)(316002)(9686003)(110136005)(55016002)(26005)(52536014)(54906003)(8936002)(4326008)(53546011)(2906002)(186003)(91956017)(76116006)(7696005)(66446008)(6506007)(478600001)(19627405001)(66476007)(33656002)(86362001)(66946007)(64756008)(71200400001)(66556008); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR18MB1037; H:MWHPR18MB1376.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: 0L1eglB6pmPw28ygag0rK7oO7MgboR6LpTd4e6qZkdCg8ARTbcUI6Rcg2JEgBBPfDMPEaBFj3pIdyJZCO2NXq7H0E/ZR2u03R4gBvOlOOGQNh+nUesyV3J+0OLxksNjQ2LaA1UpSVlklJIv1WbA+FRcefqRpDwn31GpsHPfB/6zXHW9dNmFJFR9NNC/njNehJ01atvzqJhdbpZPKY+QUIpG3GRdDvc61U8mYBsUzr72qxh2tnWbdG89lzm8HNqhEELHqDtBBhmr0iiWzxm826Qip9S5nIOagnhIv6Rm1OtBNdAtNmAS/UHQC2K3isdgVLAO3t1fL0HaFQc+5AiB1mKtcgh/cTPNr/eb9gIEUNhfu2TJDoHg+4plEJDc4R2wwc+BUO8mmWq3Q9IuOV3YZnXbMcYffLXwcNgR01Qwvs5MtM7SHUGedBoyEjOXC35x6AB4jjtSCJMJZRZ2x5PnV+yKUP/onItB2qEnOPKKndNRrCfV/FqUXLwg3D62fTDuQ MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: be079718-92cf-49c2-b145-08d790192248 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jan 2020 06:49:51.7786 (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: cAIvXKW3Bx+5ylJevoQaxR0kJeK2sKZRFxOq21G9UlVZNhVWp021BnSKAyvudD9Z1WV3OavB7R+wY96/FgnRAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR18MB1037 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2020-01-03_01:2020-01-02,2020-01-03 signatures=0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [dpdk-dev PATCH v2 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 the response inline. ________________________________ From: Gavin Hu Sent: Thursday, January 2, 2020 3:48 PM To: Mahipal Challa ; dev@dpdk.org Cc: Jerin Jacob Kollanukkaran ; Narayana Prasad Raju At= hreya ; Subrahmanyam Nilla ; Venk= ateshwarlu Nalla ; nd Subject: [EXT] RE: [dpdk-dev] [dpdk-dev PATCH v2 6/6] raw/octeontx2_ep: add= driver self test External Email ---------------------------------------------------------------------- Hi Mahipal, > -----Original Message----- > From: dev On Behalf Of Mahipal Challa > Sent: Friday, December 27, 2019 8:40 PM > To: dev@dpdk.org > Cc: jerinj@marvell.com; pathreya@marvell.com; snilla@marvell.com; > venkatn@marvell.com > Subject: [dpdk-dev] [dpdk-dev PATCH v2 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 | 164 > ++++++++++++++++++++++++++++++ > 6 files changed, 182 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 t= he > + 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..96fedb5 > --- /dev/null > +++ b/drivers/raw/octeontx2_ep/otx2_ep_test.c > @@ -0,0 +1,164 @@ > +/* 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); > + 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, &s= i); > + 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); >Should the mempool be freed after use? [Mahipal]: Ack, will add this in v3. > + otx2_info("SDP RAWDEV Self Test: Successful"); > + > + return 0; > +} > + > -- > 1.8.3.1