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 8D2ABA034F; Mon, 11 Oct 2021 12:47:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 777E940E0F; Mon, 11 Oct 2021 12:47:02 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 5295840150 for ; Mon, 11 Oct 2021 12:47:01 +0200 (CEST) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id DD3B57F514; Mon, 11 Oct 2021 13:47:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru DD3B57F514 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633949220; bh=sDnWBNDhaO0GAlZFwozqlZlQuYZIzDMEbLQ7TaaA5L0=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=mWVf4vnsCygZloShHGwqwmp5EX9K+4qRgcfMMKvLgsU7eNrAiNxIRpAOqHWtHeea6 Wrs+uUCEMOmF40C5i4u2U8N4yxoyBFiS5cRKxNOQUw0SSt30mQxXwE87ll17mgoLAa PZbX1qfdlSGgwU+pxFd1FOQMSF1A1T5hFL/ugBDc= To: Xueming Li , dev@dpdk.org Cc: Jerin Jacob , Ferruh Yigit , Viacheslav Ovsiienko , Thomas Monjalon , Lior Margalit , Ananyev Konstantin References: <20210727034204.20649-1-xuemingl@nvidia.com> <20210930145602.763969-1-xuemingl@nvidia.com> <20210930145602.763969-2-xuemingl@nvidia.com> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: <9935af19-a827-8988-b772-a48af271b912@oktetlabs.ru> Date: Mon, 11 Oct 2021 13:47:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210930145602.763969-2-xuemingl@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v4 1/6] 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 9/30/21 5:55 PM, Xueming Li wrote: > In current DPDK framework, each RX queue is pre-loaded with mbufs for RX -> Rx > 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. It should be highlighted that it is a problem of some PMDs. Not all. > > This patch introduces shared RX queue. Ports with same configuration in "This patch introduces" -> "Introduce" RX -> Rx > a switch domain could share RX queue set by specifying sharing group. RX -> Rx > Polling any queue using same shared RX queue receives packets from all RX -> Rx > 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 must be polled on single thread or core. RX -> Rx > > Multiple groups is supported by group ID. is -> are > > Signed-off-by: Xueming Li > Cc: Jerin Jacob The patch should update release notes. > --- > Rx queue object could be used as shared Rx queue object, it's important > to clear all queue control callback api that using queue object: > https://mails.dpdk.org/archives/dev/2021-July/215574.html > --- > 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 4fce8cd1c97..69bc1d5719c 100644 > --- a/doc/guides/nics/features.rst > +++ b/doc/guides/nics/features.rst > @@ -626,6 +626,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 754184ddd4d..ebeb4c18512 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 ff6aa91c806..bc7ce65fa3d 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. It is a problem of some PMDs only. So, it must be rewritten to highlight it. > + 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. ``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 the shared Rx queue can return > + packets of all ports in the 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 61aa49efec6..73270c10492 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 afdc53b674c..d7ac625ee74 100644 > --- a/lib/ethdev/rte_ethdev.h > +++ b/lib/ethdev/rte_ethdev.h > @@ -1077,6 +1077,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 > @@ -1403,6 +1404,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 the 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 | \ > IMHO it should be squashed with the second patch to make it easier to review. Otherwise it is hard to understand what is shared_group and the offlaod which are dead in the patch.