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 3DC0E45ADE; Tue, 8 Oct 2024 13:59:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C597C4027F; Tue, 8 Oct 2024 13:59:24 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 8BC614025C for ; Tue, 8 Oct 2024 13:59:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728388763; 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=ggmi/rRFfu2en6fHWbvFlpkxdkYB49roCS61DtZj8IY=; b=GnhJI1s0Qsc21/CWl1nUiSZv4tQ0s327cS15HX9i+wPUR0nwg0b2tdOP62QWq5SC17BNcj AcweYw8vRGgP0loTl7Q4/Oezc29V5+FCbJOXuV1dth7uLDx7FlL7MckqIp+s/t99WjumWL kI+cKxqm+TKZKeIqNVHaJeRp13p2hWY= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-44-3EVUkf4DNJC-jjSpGQVQJA-1; Tue, 08 Oct 2024 07:59:20 -0400 X-MC-Unique: 3EVUkf4DNJC-jjSpGQVQJA-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-539b0693028so2117953e87.0 for ; Tue, 08 Oct 2024 04:59:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728388758; x=1728993558; 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=ggmi/rRFfu2en6fHWbvFlpkxdkYB49roCS61DtZj8IY=; b=kJVTY8E0th6nn5vkTndXuBSypj6zap+bATSW+ikqtu8CsqmIOvtI5opszdi+ieEWYI XapFfY9GUs8QqOtKnma49hjSf2UuvEvTAtqX+U9FcRJX49Lz/zt/Sb3WuSuHFURKZroO a6b3/qY8N+PMrFO1RYdWvtiucmU817hZq84Mq3d558KJbVIW60HRitE7aJgtEXdzqqA2 +9eqrRr6cZUSwYMMHssmeNYOv4sbLQ3Mpz/tPO+Tzp9v/8+lSbquwkTC3SxwR4i29erB Tn38hYTOuRs2YFHp3P2vH1iJToJNZHUmptQlo9s84xYH1AKwIyL4pu1nrPEo8W+qdgop 6sLg== X-Gm-Message-State: AOJu0Yz3sWwG5rcyt8XhqQCLTGJGr00k2H0Y38Ff4chNHEb8bUpLK4KQ lBo/XZjvczQFZx/lrYIQFm+jxpMe/ZLjVCi9FVddjRBjjYvYx/87Rv0wJ+DyJ02UIZNqs/SKFw1 HYvghg0f6GD3FfeAssKAD2vlenRq6+K/egShicYsBLZt9V4UdebKltMXAcvuRlrTrYmPfThrRCt jcWDVtlbyzIIh4pT4= X-Received: by 2002:a05:6512:3d94:b0:539:9476:25a with SMTP id 2adb3069b0e04-539bdb05d23mr1034743e87.21.1728388758375; Tue, 08 Oct 2024 04:59:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAziiR/fDpf6HJg+Cnjo5Oc6ugtS/HAwgnGsVKENKAFmkuU/RQn3BfioN+GzOf893cHErRJPe7/PBVCDvVnd8= X-Received: by 2002:a05:6512:3d94:b0:539:9476:25a with SMTP id 2adb3069b0e04-539bdb05d23mr1034733e87.21.1728388757963; Tue, 08 Oct 2024 04:59:17 -0700 (PDT) MIME-Version: 1.0 References: <20240907193311.1342310-2-gakhil@marvell.com> <20241008074000.3745855-1-gakhil@marvell.com> In-Reply-To: <20241008074000.3745855-1-gakhil@marvell.com> From: David Marchand Date: Tue, 8 Oct 2024 13:59:06 +0200 Message-ID: Subject: Re: [PATCH v2] rawdev: add API to get device from index To: Akhil Goyal Cc: dev@dpdk.org, thomas@monjalon.net, hemant.agrawal@nxp.com, jerinj@marvell.com 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 Tue, Oct 8, 2024 at 9:40=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 > --- > - resend patch for main branch separated from rvu_lf raw driver > https://patches.dpdk.org/project/dpdk/list/?series=3D32949 > > lib/rawdev/rte_rawdev_pmd.h | 24 ++++++++++++++++++++++++ > 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; > +} > + This seems simple enough and we have the same kind of helper in other device class libraries. But I would like to better understand the driver API that requires this. --=20 David Marchand