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 84DB8A0C4C; Mon, 9 Aug 2021 15:51:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E5474068A; Mon, 9 Aug 2021 15:51:26 +0200 (CEST) Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) by mails.dpdk.org (Postfix) with ESMTP id 627284003C for ; Mon, 9 Aug 2021 15:51:25 +0200 (CEST) Received: by mail-il1-f179.google.com with SMTP id x7so11491667ilh.10 for ; Mon, 09 Aug 2021 06:51:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VTagrCD3YYGQNSH/MvMcG6DrJr1sWlCiZTdeq4zBvBQ=; b=uTDOG/tquwJE8lS5H2wzhzm3pJXJhN5S2YUJa7iu6LBEXoxPFenWjjGYTA6X3XyTTn 4LYV5N0U0SLLWjINcePvh8A/cx5ilBZNUx8eNj8T9BsPdf+nokUjbfrGzybRXvHw91Kn lGlsyLl+Q++evItg1eEPmo3twqk57u46M3QJFM5sW08E5zGGcPOwmtp0+926oC9e1vJu eY7Uvq3ethFc7nWqD0p0uloDD39q5/skATmzrPBicab0Q1xKW+Y2DvQ2T/Y8pqYznU8Y kcF+D5a3yp92JzJS0L+5U8Gr/g9XyRxyFVMyIXoaCxUJB3ZprMON+lONgR3P8C03OJOc b5Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VTagrCD3YYGQNSH/MvMcG6DrJr1sWlCiZTdeq4zBvBQ=; b=OTpPPvEWtvSQT4GWfNZ190wUZEEXyyCOhZZ7z/j1s0baMt/zBm7qJOubs7bVDppGaD ZpWCRYLY4upb2kXckvl3e4aTuKy2U1aJl7joIDnp5dN6pzFlG/ZkXqPp710fm0k7XNFy 34sYSTvI1mfs2yh2xW0EO5K3wM6fwRlOGJSgH2/4zvpwMCYQJj++j852jRQ1HKZJG1YN ZND9gjzaVWjNxk7dwoNtnvwHAVz3DtNvTDGy3hHLUy/xwtY4yPXUMJZAYojIuQGhFsqE dzOQShRx27w9tXJ+5BcWiAv29AwYHvX+WOOLjUV6qzZ5kI/HxPw4mgqPdlIDWd5EGFbQ JT4Q== X-Gm-Message-State: AOAM530KdJ853x1jCsp5Y+X/+fRaHjcNzc19pDlSBOwLdkrSQ1JA8qnZ H8tPss4XzOCiHwr7sRguJL3QOIuLHwlPoif7RMQ= X-Google-Smtp-Source: ABdhPJxzPjoEZqika918gjR9OBrR19NPcXiEb9Ogdb+68/Ju7wUEuZV6IkKtd4QwWqdhjkGDpwixf9z9MzfAGrrERvk= X-Received: by 2002:a05:6e02:2146:: with SMTP id d6mr714929ilv.294.1628517084749; Mon, 09 Aug 2021 06:51:24 -0700 (PDT) MIME-Version: 1.0 References: <20210727034204.20649-1-xuemingl@nvidia.com> <20210809114716.22035-1-xuemingl@nvidia.com> In-Reply-To: <20210809114716.22035-1-xuemingl@nvidia.com> From: Jerin Jacob Date: Mon, 9 Aug 2021 19:20:58 +0530 Message-ID: To: Xueming Li Cc: dpdk-dev , Ferruh Yigit , Thomas Monjalon , Andrew Rybchenko Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v1] ethdev: introduce shared Rx queue 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 Sender: "dev" On Mon, Aug 9, 2021 at 5:18 PM Xueming Li wrote: > > In current DPDK framework, each RX queue is pre-loaded with mbufs for > incoming packets. When number of representors scale out in a switch > domain, the memory consumption became significant. Most important, > polling all ports leads to high cache miss, high latency and low > throughput. > > This patch introduces shared RX queue. Ports with same configuration in > a switch domain could share RX queue set by specifying sharing group. > Polling any queue using same shared RX queue receives packets from all > member ports. Source port is identified by mbuf->port. > > Port queue number in a shared group should be identical. Queue index is > 1:1 mapped in shared group. > > Share RX queue is supposed to be polled on same thread. > > Multiple groups is supported by group ID. Is this offload specific to the representor? If so can this name be changed specifically to representor? If it is for a generic case, how the flow ordering will be maintained? > > Signed-off-by: Xueming Li > --- > doc/guides/nics/features.rst | 11 +++++++++++ > doc/guides/nics/features/default.ini | 1 + > doc/guides/prog_guide/switch_representation.rst | 10 ++++++++++ > lib/ethdev/rte_ethdev.c | 1 + > lib/ethdev/rte_ethdev.h | 7 +++++++ > 5 files changed, 30 insertions(+) > > diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst > index a96e12d155..2e2a9b1554 100644 > --- a/doc/guides/nics/features.rst > +++ b/doc/guides/nics/features.rst > @@ -624,6 +624,17 @@ Supports inner packet L4 checksum. > ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_OUTER_UDP_CKSUM``. > > > +.. _nic_features_shared_rx_queue: > + > +Shared Rx queue > +--------------- > + > +Supports shared Rx queue for ports in same switch domain. > + > +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_SHARED_RXQ``. > +* **[provides] mbuf**: ``mbuf.port``. > + > + > .. _nic_features_packet_type_parsing: > > Packet type parsing > diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini > index 754184ddd4..ebeb4c1851 100644 > --- a/doc/guides/nics/features/default.ini > +++ b/doc/guides/nics/features/default.ini > @@ -19,6 +19,7 @@ Free Tx mbuf on demand = > Queue start/stop = > Runtime Rx queue setup = > Runtime Tx queue setup = > +Shared Rx queue = > Burst mode info = > Power mgmt address monitor = > MTU update = > diff --git a/doc/guides/prog_guide/switch_representation.rst b/doc/guides/prog_guide/switch_representation.rst > index ff6aa91c80..45bf5a3a10 100644 > --- a/doc/guides/prog_guide/switch_representation.rst > +++ b/doc/guides/prog_guide/switch_representation.rst > @@ -123,6 +123,16 @@ thought as a software "patch panel" front-end for applications. > .. [1] `Ethernet switch device driver model (switchdev) > `_ > > +- Memory usage of representors is huge when number of representor grows, > + because PMD always allocate mbuf for each descriptor of Rx queue. > + Polling the large number of ports brings more CPU load, cache miss and > + latency. Shared Rx queue can be used to share Rx queue between PF and > + representors in same switch domain. ``RTE_ETH_RX_OFFLOAD_SHARED_RXQ`` > + is present in Rx offloading capability of device info. Setting the > + offloading flag in device Rx mode or Rx queue configuration to enable > + shared Rx queue. Polling any member port of shared Rx queue can return > + packets of all ports in group, port ID is saved in ``mbuf.port``. > + > Basic SR-IOV > ------------ > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index 9d95cd11e1..1361ff759a 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -127,6 +127,7 @@ static const struct { > RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM), > RTE_RX_OFFLOAD_BIT2STR(RSS_HASH), > RTE_ETH_RX_OFFLOAD_BIT2STR(BUFFER_SPLIT), > + RTE_ETH_RX_OFFLOAD_BIT2STR(SHARED_RXQ), > }; > > #undef RTE_RX_OFFLOAD_BIT2STR > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h > index d2b27c351f..a578c9db9d 100644 > --- a/lib/ethdev/rte_ethdev.h > +++ b/lib/ethdev/rte_ethdev.h > @@ -1047,6 +1047,7 @@ struct rte_eth_rxconf { > uint8_t rx_drop_en; /**< Drop packets if no descriptors are available. */ > uint8_t rx_deferred_start; /**< Do not start queue with rte_eth_dev_start(). */ > uint16_t rx_nseg; /**< Number of descriptions in rx_seg array. */ > + uint32_t shared_group; /**< Shared port group index in switch domain. */ > /** > * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags. > * Only offloads set on rx_queue_offload_capa or rx_offload_capa > @@ -1373,6 +1374,12 @@ struct rte_eth_conf { > #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM 0x00040000 > #define DEV_RX_OFFLOAD_RSS_HASH 0x00080000 > #define RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT 0x00100000 > +/** > + * Rx queue is shared among ports in same switch domain to save memory, > + * avoid polling each port. Any port in group can be used to receive packets. > + * Real source port number saved in mbuf->port field. > + */ > +#define RTE_ETH_RX_OFFLOAD_SHARED_RXQ 0x00200000 > > #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ > DEV_RX_OFFLOAD_UDP_CKSUM | \ > -- > 2.25.1 >