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 76BFB45A11; Mon, 23 Sep 2024 17:24:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 203704027C; Mon, 23 Sep 2024 17:24:21 +0200 (CEST) Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by mails.dpdk.org (Postfix) with ESMTP id CFA4940274 for ; Mon, 23 Sep 2024 17:24:19 +0200 (CEST) Received: by mail-qt1-f174.google.com with SMTP id d75a77b69052e-458311b338eso38259871cf.2 for ; Mon, 23 Sep 2024 08:24:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727105059; x=1727709859; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=e3fW9XysqiLTZJQxPGZGtys6/oKj0JdBGDeNrThhJic=; b=jBCTRer34RSFkJRBoOCyMBBS9T/xpfJ9gYQck7I6gImPy0GSIwULQafmb0LwGKCwBE veCq7f/GOJvFOsc+DynK1lYrOMLRhn+e1vIxqWRV3Gnf77rZtD/gipF8oDPBbmS6tBl7 Njn+ebmoU1hVc6Tq4sBk/PtUh2CQXNi6A5aJOD61xDZeBbrzF9JdN2MvHKWaWbxVNHHQ MLqsqqQlzysj7yQrerjTFP6tgtcSg9C0UxpAVWvJP47sg3hvU10GeT/Is3ppDWIRoY9D QgHxXSel9TIFXVXAynEkMgZPqPTw9Ls/MMcjl+Tn+seriN7C+Vauiw0Rjxh/0wNjvg9y VDag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727105059; x=1727709859; 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=e3fW9XysqiLTZJQxPGZGtys6/oKj0JdBGDeNrThhJic=; b=XEuCwjdhSZzzk83rA8zJOkep/EWFod5KsLMlbDtMwaTnnbB4+li3H2H3T/cOd1kLhv w6Ja7Sj/Gd0YhQ8pCyJ4t2io6aQSh3qr/5QqN6PCQgGiA/0/+TDZ4AZbLcAVy05LHdOo 26M0bIxNBJn3xyBmnuzwLkXM8WGTKbNKLrBOGo6oPu2YbszQeLbB1KGmoAMinLrMFwyg dxq9CklSE13rTR/KPjFbYIshRw48KleHVdc2rZjsnBmMZLek3VSRz3XFi82zPQLX9Urq y4Fxpsgy7nh6AR16dHrIiI7qJEvQa3T1XrNrXKZObtBOaOz5Gl9E4g0WAFPAyH2zS/Aj esmw== X-Gm-Message-State: AOJu0YwCgtluJ6AIh7irkbvB1dVSW8uLl/IHTbGdtMRwVLBMAQlP8AKA iWGH5xTdx6Rv2zT/iDI6uy7i0iPi7PBiL3qAohL+IGVXKrJLk7Cw8bQZXRlBlGzIlhOFocTJHxE bRtFJLhTGnaPD1D2QEpYSu4mSt5E= X-Google-Smtp-Source: AGHT+IEeQIAgaDXIQPmr03ESor4rL7E6xVRP8wCpzU753b4/2KbdPuCPiGhNUZD6+XLsoYh1ElwLe8EUOZFu5euHTz0= X-Received: by 2002:a05:622a:144:b0:458:2dba:55a7 with SMTP id d75a77b69052e-45b204d8444mr179326811cf.2.1727105059005; Mon, 23 Sep 2024 08:24:19 -0700 (PDT) MIME-Version: 1.0 References: <20240907193311.1342310-1-gakhil@marvell.com> <20240907193311.1342310-2-gakhil@marvell.com> In-Reply-To: <20240907193311.1342310-2-gakhil@marvell.com> From: Jerin Jacob Date: Mon, 23 Sep 2024 20:53:52 +0530 Message-ID: Subject: Re: [PATCH 1/9] rawdev: add API to get device from index To: Akhil Goyal Cc: dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com, hemant.agrawal@nxp.com, jerinj@marvell.com, hkalra@marvell.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 Sun, Sep 8, 2024 at 1:03=E2=80=AFAM Akhil Goyal wro= te: > > Added an internal API for PMDs to get raw device pointer > from a device id. > > Signed-off-by: Akhil Goyal > --- > lib/rawdev/rte_rawdev_pmd.h | 24 ++++++++++++++++++++++++ # This patch needs to go through the main tree. So please send this separate patch and rest of the patch as separate series. # verion.map update is missing for new API as INTERNAL section. > 1 file changed, 24 insertions(+) > > diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h > index 22b406444d..8339122348 100644 > --- a/lib/rawdev/rte_rawdev_pmd.h > +++ b/lib/rawdev/rte_rawdev_pmd.h > @@ -102,6 +102,30 @@ rte_rawdev_pmd_get_named_dev(const char *name) > return NULL; > } > > +/** > + * Get the rte_rawdev structure device pointer for given device ID. > + * > + * @param dev_id > + * raw device index. > + * > + * @return > + * - The rte_rawdev structure pointer for the given device ID. > + */ > +static inline struct rte_rawdev * > +rte_rawdev_pmd_get_dev(uint8_t dev_id) > +{ > + struct rte_rawdev *dev; > + > + if (dev_id >=3D RTE_RAWDEV_MAX_DEVS) > + return NULL; > + > + dev =3D &rte_rawdevs[dev_id]; > + if (dev->attached =3D=3D RTE_RAWDEV_ATTACHED) > + return dev; > + > + return NULL; > +} > + > /** > * Validate if the raw device index is a valid attached raw device. > * > -- > 2.25.1 >