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 A073842BD5; Mon, 29 May 2023 19:39:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7AF2B40EDF; Mon, 29 May 2023 19:39:59 +0200 (CEST) Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com [209.85.222.49]) by mails.dpdk.org (Postfix) with ESMTP id 858AB40151 for ; Mon, 29 May 2023 19:39:58 +0200 (CEST) Received: by mail-ua1-f49.google.com with SMTP id a1e0cc1a2514c-78412128326so2646233241.1 for ; Mon, 29 May 2023 10:39:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685381998; x=1687973998; 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=20EWx0JRFY1IlgMDmRsx7OH9KksGWQXmUOcloULCxS4=; b=X8yeySW5Axv4+I92USEtu0hn+VRPxuUBwu6BRRbkReYQhhIpX0TIoFSjqQZZQQdrNN 2CBYVpOh6Jbu687obREWjUtR88BfFQhTvaLqwO4QayuPO3WS+0TtCvNpBgZbkvWE0YPu TdFgC/97hFEslsc7mpk0PaNn0jBQmJN6R6EDEu9uhi76EfOaCtycBLKy0ipg5PJG8KIy iI964NtF7kcKFqlzWKf62Ix+hiZ07VRDRZIKNHWk8w6rARsAemrvkCPUlVJK3uzw9eGi KfeKiCyPJZojk78PGKeRa5PxlFgjp4DBBV5NWJyi4bpXMTWXeQLxL0H9v1e7gStrPV8s dDGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685381998; x=1687973998; 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=20EWx0JRFY1IlgMDmRsx7OH9KksGWQXmUOcloULCxS4=; b=AwMUFDZ972nIy1pBfEsX1xrW80GKnGRNPr3XYwr9OHZgP3I+E0zdFpaibfNharvKjX 6EmjrdLOHtdGelrtFX5vv6+CDf0mSG9XMXpezLwVfWxzG7gE/R0y5W96UNcFQDHL7hcH TMwo0POYhlbSysiYouDKkSxWGpu2E2RNz7HvxZEgeAXA2JOB2QMwhMUl5LnsDsRzITub Fe3+sRJzInWOEY3/VxHDnLo4LulSCcDDJcSH2uWvRzJnbHRYe52cxzuL+sGhWqAyOYKZ bSFZMQr52j3diDXyDG6oIn86T7/dul8/PJXlg2iWoRxlDPkWPgzkUcWHB8oGGEIEWlSC YrOg== X-Gm-Message-State: AC+VfDxTIiDlpRpZ3SvxFCV/smOdzcOxCYtKcz4OPiPACsfPzQv6ewqu 2dt9VPxGku8BUvEC47A+hcJAKlinQqEXv/pQs/4AeG3erIBN5w== X-Google-Smtp-Source: ACHHUZ793xr9Vp3OEAnAzVM+yV7f3odFL+MhTy3bXSp15zRmjHD4y/yai8boMau6WXPd6vbFzv/OAzeR6E0t5LNby10= X-Received: by 2002:a05:6102:451:b0:437:e5ce:7e8f with SMTP id e17-20020a056102045100b00437e5ce7e8fmr3432611vsq.4.1685381997809; Mon, 29 May 2023 10:39:57 -0700 (PDT) MIME-Version: 1.0 References: <20230421060245.3136217-1-vattunuru@marvell.com> <20230421060245.3136217-3-vattunuru@marvell.com> In-Reply-To: <20230421060245.3136217-3-vattunuru@marvell.com> From: Jerin Jacob Date: Mon, 29 May 2023 23:09:32 +0530 Message-ID: Subject: Re: [PATCH 2/4] node: add a node to receive pkts from kernel To: Vamsi Attunuru Cc: dev@dpdk.org, jerinj@marvell.com, ndabilpuram@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 Fri, Apr 21, 2023 at 11:33=E2=80=AFAM Vamsi Attunuru wrote: > > Patch adds a node to receive packets from kernel > over a raw socket. Subjection suggestion: node/kernel_rx: support receving packet from kernel > > Signed-off-by: Vamsi Attunuru > --- > doc/guides/prog_guide/graph_lib.rst | 7 + > lib/node/kernel_recv.c | 277 ++++++++++++++++++++++++++++ > lib/node/kernel_recv_priv.h | 74 ++++++++ > lib/node/meson.build | 1 + > 4 files changed, 359 insertions(+) > > diff --git a/doc/guides/prog_guide/graph_lib.rst b/doc/guides/prog_guide/= graph_lib.rst > index b3b5b14827..1057f16de8 100644 > --- a/doc/guides/prog_guide/graph_lib.rst > +++ b/doc/guides/prog_guide/graph_lib.rst > @@ -402,3 +402,10 @@ on the raw socket. > > Aftering sending the burst of packets to kernel, this node redirects the= same > objects to pkt_drop node to free up the packet buffers. > + > +kernel_recv Better to change node name to kernel_rx > +~~~~~~~~~~~ > +This node receives packets from kernel over a raw socket interface. Uses= ``poll`` > +function to poll on the socket fd for ``POLLIN`` events to read the pack= ets from > +raw socket to stream buffer and does ``rte_node_next_stream_move()`` whe= n there > +are received packets. You can tell typical use case for punt and kernel_tx node. i.e expection path handling. Also, may consider chnage to kernel_tx for punt node. > diff --git a/lib/node/kernel_recv.c b/lib/node/kernel_recv.c > new file mode 100644 > index 0000000000..361dcc3b5f > --- /dev/null > +++ b/lib/node/kernel_recv.c > @@ -0,0 +1,277 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2023 Marvell International Ltd. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "ethdev_rx_priv.h" > +#include "kernel_recv_priv.h" > +#include "node_private.h" > + > +static struct kernel_recv_node_main kernel_recv_main; Try to remove global varible. > +#ifndef __INCLUDE_KERNEL_RECV_PRIV_H__ No need to add INCLUDE > +#define __INCLUDE_KERNEL_RECV_PRIV_H__ > + > +#define KERN_RECV_CACHE_COUNT 64 > + > +typedef struct kernel_recv_info { > + struct rte_mbuf *rx_bufs[KERN_RECV_CACHE_COUNT]; > + uint16_t cls_next; > + uint16_t idx; > + uint16_t cnt; > + int sock; > +} kernel_recv_info_t; > + > +/** > + * @internal > + * > + * Kernel Recv node context structure. Across the patch series, no need for Doxgen comments for internal functions= .