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 2907FA04F0; Thu, 19 Dec 2019 07:48:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 098921BE8E; Thu, 19 Dec 2019 07:48:52 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 863C41BE8A for ; Thu, 19 Dec 2019 07:48:49 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xBJ6jXm9018423; Wed, 18 Dec 2019 22:48:45 -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=Rgu/NDOmVrUju9jw28mV/cbXNu5obqDqDMpQTSaEk78=; b=WQeJ8e+YpgF4S7625zl/7T10LDSCOrOOrpS1VO0v6QTTbSznCY/SKkixHhQ7j2IJ/Lj0 MpUZNffhvIDAcw2yReSor/xE7alnioY7U7dtjHRmPU9IEExtt/j+kHIIgVMjO8IszVVr w+XxrIrz7+pYBy3sbu81niwsGeWzWV/xq+/8yG3M1OKuP3AbJPymHE/+DVViBpTeuC8E TdBnW2mz+3I5ZcGrpDHB0AxITGSVBPdn82pmP1qaDAJpf09p5yV7mX++8ai/Ko7s1YyD f1sGseEdnEvTvhCLYR6BpQGQV4jsXxTtv4KdnYol/PrJr7ewH96rSwKJUHk6HyknFHBP Bw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2wxneb1wua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 18 Dec 2019 22:48:45 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 18 Dec 2019 22:48:44 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.171) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Wed, 18 Dec 2019 22:48:44 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W24ZjvtKWeAJL3zek71HlwGukifhzCn+3S50/ycu3kcp/jVQM0buBpNB8uWGfaVtb4YoDe+DNDLpNFCVg/NGJgb6jkaoZJfkgJZU4euUPFAb0lmVrH0HmRwgTZO4SJAlum62Ja1WzQHwFFCalZX1P5JJaWW9G009fUb/hSnlETn04izWblBxEwNiHfXIDZbeOLD60OIG13cWkjLEmqwhetaYWe/yBSMgSVjqKf1AkX5YB0TJkM2BBwq+E56vPocr2PjPKwsPctbKXu6TEK7mE5v8aXut5vvZmHTVRoGPP9mAfTCaBv7C+T5uxzFAvl/YMQynipOnGGhN/Kyo2jdrYw== 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=Rgu/NDOmVrUju9jw28mV/cbXNu5obqDqDMpQTSaEk78=; b=ch80JBcvUVaTb3tSAXNClVez3rMTjnw2ujmgp75xKqEaVjtn+Fmu0HIMwIKrv6QS1SdziXkj47E6ZEZOC4UihttEe7LLepFL+HbuUSFINj3d2xGX8YFukku47OPupugkJDrNXHTW/TsGxC7Q4rlEAoqfbg6UQqX+mor1iZkVhKrf5UphoosycmX5mCrcVVS4VEZMvOYYFfDuR0qiAdiyBrQOhp7mJbN6GjJvKVg+hqg4oo4RTQ/j/3pjd9kwwcvN+kdcEv8ugVVn+46EgGrP3Rubnfak9aRS14n3G+PnHqwNaMP+eMxJAOAFPH59T4RndnxTrixCZsgcFO8F2rqvyA== 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=Rgu/NDOmVrUju9jw28mV/cbXNu5obqDqDMpQTSaEk78=; b=s4+kqM/GCNHfPSAbbxrLHAuWgL1AyCJ9m9NSDtIt7A3rO+TffYss/lwxdtuJrvQ3naZ1r4a2QZASnB8mgMRRPeeN9lE+71ns6whsdNadVP9p15PqK1lYx22n53z/N+qrvu4zMgpQumrhwy6aQeGLCj1RHvu1+GVIKvgy08I1AQs= Received: from MWHPR18MB1376.namprd18.prod.outlook.com (10.173.243.18) by MWHPR18MB1518.namprd18.prod.outlook.com (10.173.243.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.16; Thu, 19 Dec 2019 06:48:41 +0000 Received: from MWHPR18MB1376.namprd18.prod.outlook.com ([fe80::24f5:9254:413a:4695]) by MWHPR18MB1376.namprd18.prod.outlook.com ([fe80::24f5:9254:413a:4695%7]) with mapi id 15.20.2559.012; Thu, 19 Dec 2019 06:48:41 +0000 From: Mahipal Challa To: "Gavin Hu (Arm Technology China)" , "dev@dpdk.org" CC: Jerin Jacob Kollanukkaran , "Narayana Prasad Raju Athreya" , Subrahmanyam Nilla , Venkateshwarlu Nalla , nd Thread-Topic: [dpdk-dev] [PATCH v1 4/6] raw/octeontx2_ep: add enqueue operation Thread-Index: AQHVrnLqeL1JvjUpjkq1wP43EwpuDqe52OwAgAct9pA= Date: Thu, 19 Dec 2019 06:48:41 +0000 Message-ID: References: <1575614365-8907-1-git-send-email-mchalla@marvell.com> <1575614365-8907-5-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: 420355de-9f2c-485d-ecc6-08d7844f7c53 x-ms-traffictypediagnostic: MWHPR18MB1518: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0256C18696 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(366004)(396003)(346002)(376002)(136003)(13464003)(199004)(189003)(4326008)(81156014)(66446008)(81166006)(7696005)(86362001)(33656002)(55236004)(26005)(76116006)(64756008)(66556008)(66476007)(316002)(91956017)(186003)(71200400001)(8936002)(478600001)(2906002)(54906003)(6506007)(55016002)(110136005)(9686003)(5660300002)(53546011)(30864003)(52536014)(8676002)(66946007)(19627405001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR18MB1518; 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: vHD5TDNdInBXgCCyPQBoGDNnfzHJ6fWZwOQTfkQtN6lRp1R7G85C5NmveHb1PPRR/KHx1CBIE6wXCazSkzR+8sVGcw8KvyFK/lMXf47luVGQEp5ZHYhXNlmoP/DMKlKrNVVDSi3O0GQMXvUIwmPiWhgEdqPjV4qHEfJe4v+W2gclriLlaOeTk9f56HvlTuBlHEKb20Vj6kxvpnaRCjtn6ah6I5TeiG6m5GC//yB6bHcKu6hghlCNOcIHt+Wv6CdEXkYs2zLmcLkSRAskGaBHRei7AXp8i0u3jccruBsi5fM0mRAqLFntIfIfjzuo9ZJmNWuM5vTSylut1ZETAP4VN1OkNkXkGAajsuBvyPxbsnzHIQOPkZqv7BKbILKfqQXjVIB3bNJlH/Ak/nI10A9+GCm455dHobt1lC8z/G+YLFEAf+Y6nYOD+zZsZ7iGcY36Wq53vJ6ZqDkWpvuC6NHF5WBlZckpz3UrLBTmAaA+AQV9bWBimB/nln7if8kWB0Gi MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 420355de-9f2c-485d-ecc6-08d7844f7c53 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Dec 2019 06:48:41.7363 (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: oXVz3HYRv8qYSlialaLY9gpqEekbXic1GdmtEVyRyzc6ix6E2RJIYbP9XiI7KRfjxl9NFknRCL6UERwENVxr3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR18MB1518 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-18_08:2019-12-17,2019-12-18 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] [PATCH v1 4/6] raw/octeontx2_ep: add enqueue operation 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 (Arm Technology China) Sent: Saturday, December 14, 2019 9:54 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] [PATCH v1 4/6] raw/octeontx2_ep: add enqueue = operation External Email ---------------------------------------------------------------------- Hi Mahipal, > -----Original Message----- > From: dev On Behalf Of Mahipal Challa > Sent: Friday, December 6, 2019 2:39 PM > To: dev@dpdk.org > Cc: jerinj@marvell.com; pathreya@marvell.com; snilla@marvell.com; > venkatn@marvell.com > Subject: [dpdk-dev] [PATCH v1 4/6] raw/octeontx2_ep: add enqueue > operation > > Add rawdev enqueue operation for SDP VF devices. > > Signed-off-by: Mahipal Challa > --- > doc/guides/rawdevs/octeontx2_ep.rst | 6 + > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c | 242 > ++++++++++++++++++++++++++++++ > drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h | 39 +++++ > drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 1 + > drivers/raw/octeontx2_ep/otx2_ep_rawdev.h | 20 +++ > drivers/raw/octeontx2_ep/otx2_ep_vf.c | 24 +++ > 6 files changed, 332 insertions(+) > > diff --git a/doc/guides/rawdevs/octeontx2_ep.rst > b/doc/guides/rawdevs/octeontx2_ep.rst > index 2507fcf..39a7c29 100644 > --- a/doc/guides/rawdevs/octeontx2_ep.rst > +++ b/doc/guides/rawdevs/octeontx2_ep.rst > @@ -68,3 +68,9 @@ The following code shows how the device is configured > > rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info); > > +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. > + > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > index 584b818..ebbacfb 100644 > --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.c > @@ -403,3 +403,245 @@ > return -ENOMEM; > } > > +static inline void > +sdp_iqreq_delete(struct sdp_device *sdpvf, > + struct sdp_instr_queue *iq, uint32_t idx) > +{ > + uint32_t reqtype; > + void *buf; > + > + buf =3D iq->req_list[idx].buf; > + reqtype =3D iq->req_list[idx].reqtype; > + > + switch (reqtype) { > + case SDP_REQTYPE_NORESP: > + rte_mempool_put(sdpvf->enqdeq_mpool, buf); > + otx2_sdp_dbg("IQ buffer freed at idx[%d]", idx); > + break; > + > + case SDP_REQTYPE_NORESP_GATHER: > + case SDP_REQTYPE_NONE: > + default: > + otx2_info("This iqreq mode is not supported:%d", reqtype); > + > + } > + > + /* Reset the request list at this index */ > + iq->req_list[idx].buf =3D NULL; > + iq->req_list[idx].reqtype =3D 0; > +} > + > +static inline void > +sdp_iqreq_add(struct sdp_instr_queue *iq, void *buf, > + uint32_t reqtype) > +{ > + iq->req_list[iq->host_write_index].buf =3D buf; > + iq->req_list[iq->host_write_index].reqtype =3D reqtype; > + > + otx2_sdp_dbg("IQ buffer added at idx[%d]", iq->host_write_index); > + > +} > + > +static void > +sdp_flush_iq(struct sdp_device *sdpvf, > + struct sdp_instr_queue *iq, > + uint32_t pending_thresh __rte_unused) > +{ > + uint32_t instr_processed =3D 0; > + > + rte_spinlock_lock(&iq->lock); > + > + iq->otx_read_index =3D sdpvf->fn_list.update_iq_read_idx(iq); > + while (iq->flush_index !=3D iq->otx_read_index) { > + /* Free the IQ data buffer to the pool */ > + sdp_iqreq_delete(sdpvf, iq, iq->flush_index); > + iq->flush_index =3D > + sdp_incr_index(iq->flush_index, 1, iq->nb_desc); > + > + instr_processed++; > + } > + > + iq->stats.instr_processed =3D instr_processed; > + rte_atomic64_sub(&iq->instr_pending, instr_processed); > + > + rte_spinlock_unlock(&iq->lock); > +} > + > +static inline void > +sdp_ring_doorbell(struct sdp_device *sdpvf __rte_unused, > + struct sdp_instr_queue *iq) > +{ > + otx2_write64(iq->fill_cnt, iq->doorbell_reg); > + > + /* Make sure doorbell write goes through */ > + rte_wmb(); This is overkill, no need to wait for the completeness, is it ok to just en= sure the doorbell ring is seen by the device before the new fill_cnt is see= n by lcore? If yes, therefore rte_cio_wmb is sufficient. [Mahipal]: Yes, this is to ensure the doorbell ring write completion, will = replace it with rte_cio_wmb(). > + iq->fill_cnt =3D 0; > + > +} > + > +static inline int > +post_iqcmd(struct sdp_instr_queue *iq, uint8_t *iqcmd) > +{ > + uint8_t *iqptr, cmdsize; > + > + /* This ensures that the read index does not wrap around to > + * the same position if queue gets full before OCTEON TX2 could > + * fetch any instr. > + */ > + if (rte_atomic64_read(&iq->instr_pending) >=3D > + (int32_t)(iq->nb_desc - 1)) { > + otx2_err("IQ is full, pending:%ld", > + (long)rte_atomic64_read(&iq->instr_pending)); > + > + return SDP_IQ_SEND_FAILED; > + } > + > + /* Copy cmd into iq */ > + cmdsize =3D ((iq->iqcmd_64B) ? 64 : 32); > + iqptr =3D iq->base_addr + (cmdsize * iq->host_write_index); > + > + rte_memcpy(iqptr, iqcmd, cmdsize); > + > + otx2_sdp_dbg("IQ cmd posted @ index:%d", iq->host_write_index); > + > + /* Increment the host write index */ > + iq->host_write_index =3D > + sdp_incr_index(iq->host_write_index, 1, iq->nb_desc); > + > + iq->fill_cnt++; > + > + /* Flush the command into memory. We need to be sure the data > + * is in memory before indicating that the instruction is > + * pending. > + */ > + rte_wmb(); This barrier can be saved. [Mahipal]: will replace it with the rte_io_wmb() API, as it is required to = ensure the command write completion before doorbell ring. > + rte_atomic64_inc(&iq->instr_pending); > + > + /* SDP_IQ_SEND_SUCCESS */ > + return 0; > +} > + > + > +static int > +sdp_send_data(struct sdp_device *sdpvf, > + struct sdp_instr_queue *iq, void *cmd) > +{ > + uint32_t ret; > + > + /* Lock this IQ command queue before posting instruction */ > + rte_spinlock_lock(&iq->post_lock); > + > + /* Submit IQ command */ > + ret =3D post_iqcmd(iq, cmd); > + > + if (ret =3D=3D SDP_IQ_SEND_SUCCESS) { > + sdp_ring_doorbell(sdpvf, iq); > + > + iq->stats.instr_posted++; > + otx2_sdp_dbg("Instr submit success posted: %ld\n", > + (long)iq->stats.instr_posted); > + > + } else { > + iq->stats.instr_dropped++; > + otx2_err("Instr submit failled, dropped: %ld\n", > + (long)iq->stats.instr_dropped); > + > + } > + > + rte_spinlock_unlock(&iq->post_lock); > + > + return ret; > +} > + > + > +/* Enqueue requests/packets to SDP IQ queue. > + * returns number of requests enqueued successfully > + */ > +int > +sdp_rawdev_enqueue(struct rte_rawdev *rawdev, > + struct rte_rawdev_buf **buffers __rte_unused, > + unsigned int count, rte_rawdev_obj_t context) > +{ > + struct sdp_instr_64B *iqcmd; > + struct sdp_instr_queue *iq; > + struct sdp_soft_instr *si; > + struct sdp_device *sdpvf; > + > + struct sdp_instr_ih ihx; > + > + sdpvf =3D (struct sdp_device *)rawdev->dev_private; > + si =3D (struct sdp_soft_instr *)context; > + > + iq =3D sdpvf->instr_queue[si->q_no]; > + > + if ((count > 1) || (count < 1)) { > + otx2_err("This mode not supported: req[%d]", count); > + goto enq_fail; > + } > + > + memset(&ihx, 0, sizeof(struct sdp_instr_ih)); > + > + iqcmd =3D &si->command; > + memset(iqcmd, 0, sizeof(struct sdp_instr_64B)); > + > + iqcmd->dptr =3D (uint64_t)si->dptr; > + > + /* Populate SDP IH */ > + ihx.pkind =3D sdpvf->pkind; > + ihx.fsz =3D si->ih.fsz + 8; /* 8B for NIX IH */ > + ihx.gather =3D si->ih.gather; > + > + /* Direct data instruction */ > + ihx.tlen =3D si->ih.tlen + ihx.fsz; > + > + switch (ihx.gather) { > + case 0: /* Direct data instr */ > + ihx.tlen =3D si->ih.tlen + ihx.fsz; > + break; > + > + default: /* Gather */ > + switch (si->ih.gsz) { > + case 0: /* Direct gather instr */ > + otx2_err("Direct Gather instr : not supported"); > + goto enq_fail; > + > + default: /* Indirect gather instr */ > + otx2_err("Indirect Gather instr : not supported"); > + goto enq_fail; > + } > + } > + > + rte_memcpy(&iqcmd->ih, &ihx, sizeof(uint64_t)); > + iqcmd->rptr =3D (uint64_t)si->rptr; > + rte_memcpy(&iqcmd->irh, &si->irh, sizeof(uint64_t)); > + > + /* Swap FSZ(front data) here, to avoid swapping on OCTEON TX2 side > */ > + sdp_swap_8B_data(&iqcmd->rptr, 1); > + sdp_swap_8B_data(&iqcmd->irh, 1); > + > + otx2_sdp_dbg("After swapping"); > + otx2_sdp_dbg("Word0 [dptr]: 0x%016lx", (unsigned long)iqcmd- > >dptr); > + otx2_sdp_dbg("Word1 [ihtx]: 0x%016lx", (unsigned long)iqcmd->ih); > + otx2_sdp_dbg("Word2 [rptr]: 0x%016lx", (unsigned long)iqcmd->rptr); > + otx2_sdp_dbg("Word3 [irh]: 0x%016lx", (unsigned long)iqcmd->irh); > + otx2_sdp_dbg("Word4 [exhdr[0]]: 0x%016lx", > + (unsigned long)iqcmd->exhdr[0]); > + > + sdp_iqreq_add(iq, si->dptr, si->reqtype); > + > + if (sdp_send_data(sdpvf, iq, iqcmd)) { > + otx2_err("Data send failled :"); > + sdp_iqreq_delete(sdpvf, iq, iq->host_write_index); > + goto enq_fail; > + } > + > + if (rte_atomic64_read(&iq->instr_pending) >=3D 1) > + sdp_flush_iq(sdpvf, iq, 1 /*(iq->nb_desc / 2)*/); > + > + /* Return no# of instructions posted successfully. */ > + return count; > + > +enq_fail: > + return SDP_IQ_SEND_FAILED; > +} > + > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h > b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h > index 4c28283..b9b7c0b 100644 > --- a/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h > +++ b/drivers/raw/octeontx2_ep/otx2_ep_enqdeq.h > @@ -8,4 +8,43 @@ > #include > #include "otx2_ep_rawdev.h" > > +#define SDP_IQ_SEND_FAILED (-1) > +#define SDP_IQ_SEND_SUCCESS (0) > + > + > +static inline uint64_t > +sdp_endian_swap_8B(uint64_t _d) > +{ > + return ((((((uint64_t)(_d)) >> 0) & (uint64_t)0xff) << 56) | > + (((((uint64_t)(_d)) >> 8) & (uint64_t)0xff) << 48) | > + (((((uint64_t)(_d)) >> 16) & (uint64_t)0xff) << 40) | > + (((((uint64_t)(_d)) >> 24) & (uint64_t)0xff) << 32) | > + (((((uint64_t)(_d)) >> 32) & (uint64_t)0xff) << 24) | > + (((((uint64_t)(_d)) >> 40) & (uint64_t)0xff) << 16) | > + (((((uint64_t)(_d)) >> 48) & (uint64_t)0xff) << 8) | > + (((((uint64_t)(_d)) >> 56) & (uint64_t)0xff) << 0)); > +} > + > +static inline void > +sdp_swap_8B_data(uint64_t *data, uint32_t blocks) > +{ > + /* Swap 8B blocks */ > + while (blocks) { > + *data =3D sdp_endian_swap_8B(*data); > + blocks--; > + data++; > + } > +} > + > +static inline uint32_t > +sdp_incr_index(uint32_t index, uint32_t count, uint32_t max) > +{ > + if ((index + count) >=3D max) > + index =3D index + count - max; > + else > + index +=3D count; > + > + return index; > +} > + > #endif /* _OTX2_EP_ENQDEQ_H_ */ > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > index 2c43d3f..4ba8473 100644 > --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.c > @@ -251,6 +251,7 @@ > .dev_start =3D sdp_rawdev_start, > .dev_stop =3D sdp_rawdev_stop, > .dev_close =3D sdp_rawdev_close, > + .enqueue_bufs =3D sdp_rawdev_enqueue, > }; > > static int > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > index a01f48d..8fd06fb 100644 > --- a/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > +++ b/drivers/raw/octeontx2_ep/otx2_ep_rawdev.h > @@ -8,6 +8,10 @@ > #include > #include > > +/* IQ instruction req types */ > +#define SDP_REQTYPE_NONE (0) > +#define SDP_REQTYPE_NORESP (1) > +#define SDP_REQTYPE_NORESP_GATHER (2) > > /* Input Request Header format */ > struct sdp_instr_irh { > @@ -128,6 +132,13 @@ struct sdp_instr_list { > }; > #define SDP_IQREQ_LIST_SIZE (sizeof(struct sdp_instr_list)) > > +/* Input Queue statistics. Each input queue has four stats fields. */ > +struct sdp_iq_stats { > + uint64_t instr_posted; /* Instructions posted to this queue. */ > + uint64_t instr_processed; /* Instructions processed in this queue. = */ > + uint64_t instr_dropped; /* Instructions that could not be processed= */ > +}; > + > /* Structure to define the configuration attributes for each Input queue= . */ > struct sdp_iq_config { > /* Max number of IQs available */ > @@ -195,6 +206,9 @@ struct sdp_instr_queue { > /* Number of instructions pending to be posted to OCTEON TX2. */ > uint32_t fill_cnt; > > + /* Statistics for this input queue. */ > + struct sdp_iq_stats stats; > + > /* DMA mapped base address of the input descriptor ring. */ > uint64_t base_addr_dma; > > @@ -380,6 +394,8 @@ struct sdp_fn_list { > void (*setup_oq_regs)(struct sdp_device *sdpvf, uint32_t q_no); > > int (*setup_device_regs)(struct sdp_device *sdpvf); > + uint32_t (*update_iq_read_idx)(struct sdp_instr_queue *iq); > + > void (*enable_io_queues)(struct sdp_device *sdpvf); > void (*disable_io_queues)(struct sdp_device *sdpvf); > > @@ -458,4 +474,8 @@ struct sdp_device { > int sdp_setup_oqs(struct sdp_device *sdpvf, uint32_t oq_no); > int sdp_delete_oqs(struct sdp_device *sdpvf, uint32_t oq_no); > > +int sdp_rawdev_enqueue(struct rte_rawdev *dev, struct rte_rawdev_buf > **buffers, > + unsigned int count, rte_rawdev_obj_t context); > + > + > #endif /* _OTX2_EP_RAWDEV_H_ */ > diff --git a/drivers/raw/octeontx2_ep/otx2_ep_vf.c > b/drivers/raw/octeontx2_ep/otx2_ep_vf.c > index 8e79fe8..c5c0bc3 100644 > --- a/drivers/raw/octeontx2_ep/otx2_ep_vf.c > +++ b/drivers/raw/octeontx2_ep/otx2_ep_vf.c > @@ -409,6 +409,28 @@ > sdp_vf_disable_oq(sdpvf, q_no); > } > > +static uint32_t > +sdp_vf_update_read_index(struct sdp_instr_queue *iq) > +{ > + uint32_t new_idx =3D rte_read32(iq->inst_cnt_reg); > + > + /* The new instr cnt reg is a 32-bit counter that can roll over. > + * We have noted the counter's initial value at init time into > + * reset_instr_cnt > + */ > + if (iq->reset_instr_cnt < new_idx) > + new_idx -=3D iq->reset_instr_cnt; > + else > + new_idx +=3D (0xffffffff - iq->reset_instr_cnt) + 1; > + > + /* Modulo of the new index with the IQ size will give us > + * the new index. > + */ > + new_idx %=3D iq->nb_desc; > + > + return new_idx; > +} > + > int > sdp_vf_setup_device(struct sdp_device *sdpvf) > { > @@ -436,6 +458,8 @@ > sdpvf->fn_list.setup_oq_regs =3D sdp_vf_setup_oq_regs; > > sdpvf->fn_list.setup_device_regs =3D sdp_vf_setup_device_regs; > + sdpvf->fn_list.update_iq_read_idx =3D sdp_vf_update_read_index; > + > sdpvf->fn_list.enable_io_queues =3D sdp_vf_enable_io_queues; > sdpvf->fn_list.disable_io_queues =3D sdp_vf_disable_io_queues; > > -- > 1.8.3.1