From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 7472C43C3F;
	Thu, 29 Feb 2024 18:56:33 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 4EDB6402ED;
	Thu, 29 Feb 2024 18:56:33 +0100 (CET)
Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com
 [209.85.215.181])
 by mails.dpdk.org (Postfix) with ESMTP id 391AA402CD
 for <dev@dpdk.org>; Thu, 29 Feb 2024 18:56:32 +0100 (CET)
Received: by mail-pg1-f181.google.com with SMTP id
 41be03b00d2f7-5d8b276979aso923423a12.2
 for <dev@dpdk.org>; Thu, 29 Feb 2024 09:56:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709229391;
 x=1709834191; darn=dpdk.org; 
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=HxKO+7iW69X/HsbLYasuvMKxgliAZp74ovXjo+zdB/Q=;
 b=VSbzoMzVwsDemhAAYAWqglTyVMksYDBNvnS/YGsZtuRTWgrrDWJdVM2JLs4bUq+Rdt
 zmjjYmEzBeTT2+UP+4P2WrlnTGDtEA85DdAaGQ4QyH9d+/6pNaFyhtGi7g9yeR1mW1Ed
 RMcrr8Aa+uzhp3Iwi/HO/FbLYfclF9T+cFKjGU1UdadGlTJ2Xfziq+oh8qNLh8JfqUts
 OWcMs+lJqb6Rrm9vzagT+Tj8vG/m0m66d0NUjccEh6jDBttos3v+d7R9sK+77tE/oavP
 GKhoWgAzzayvtGyWfGgYfsshsV8wDuLXi057yER0HA8dCcCgv9AEhj48321Kgzzec/vE
 6RDQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1709229391; x=1709834191;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=HxKO+7iW69X/HsbLYasuvMKxgliAZp74ovXjo+zdB/Q=;
 b=V/9wPqAWwX2otZzgaokWduKQqxj5gKb8EnvU753z4y5Wq3ACd0gz+F10G0xk8zB+lq
 vPKomULZIn5/hUrzmwBQwy2Y9HdESoLIHWUNmpgMZ63DApLeezKlGkTDuZ0vPdF6v3i2
 H6teDvNwQNxztTJbos2g8rNywNVbgRuVvwIpiY/mMmz670PvdGlp7ipArhGLL2PyxOEs
 meZYlK6zVS8UL2Im7Zz+iTJcQYBmJqghR0KnhkiPVT9q19sITTVi/GtXnnNcIYPfyCmV
 Flo6cHVvHiEfN7ZUfX7RMuqimvhbdICdlfzGdTqwnm441OgTHppaPvAzc+aagjLic5GF
 bohQ==
X-Gm-Message-State: AOJu0YxsqCuLct/j0tNblw/BNoYLTwoir75JTl8kkoTpsJWt2/99c2Bx
 EoGIHrQbkO08sDjWw00doU+pW+MuP1IuhszTcGMnb+0PkF+JHqiFsByBnA8PFOmgaSamuJkZYau
 l
X-Google-Smtp-Source: AGHT+IGmVs6mY54llRhqtW6mU9hd72h/uJlg7GekUByYCY5y2GZs0yHIxuSI8jFIn/n5SRquoW/BFQ==
X-Received: by 2002:a17:903:2282:b0:1dc:c633:e6b1 with SMTP id
 b2-20020a170903228200b001dcc633e6b1mr3455693plh.49.1709229391285; 
 Thu, 29 Feb 2024 09:56:31 -0800 (PST)
Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141])
 by smtp.gmail.com with ESMTPSA id
 c7-20020a170902d48700b001db5079b705sm1782396plg.36.2024.02.29.09.56.30
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 29 Feb 2024 09:56:30 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH] net/tap: allow more that 4 queues
Date: Thu, 29 Feb 2024 09:56:18 -0800
Message-ID: <20240229175620.122949-1-stephen@networkplumber.org>
X-Mailer: git-send-email 2.43.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

The tap device needs to exchange file descriptors for tx and rx.
But the EAL MP layer has limit of 8 file descriptors per message.
The ideal resolution would be to increase the number of file
descriptors allowed for rte_mp_sendmsg(), but this would break
the ABI. Workaround the constraint by breaking into multiple messages.

Do not hide errors about MP message failures.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/tap/rte_eth_tap.c | 40 +++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 7 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 69d9da695bed..df18c328f498 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -863,21 +863,44 @@ tap_mp_req_on_rxtx(struct rte_eth_dev *dev)
 		msg.fds[fd_iterator++] = process_private->txq_fds[i];
 		msg.num_fds++;
 		request_param->txq_count++;
+
+		/* Need to break request into chunks */
+		if (fd_iterator >= RTE_MP_MAX_FD_NUM) {
+			err = rte_mp_sendmsg(&msg);
+			if (err < 0)
+				goto fail;
+
+			fd_iterator = 0;
+			msg.num_fds = 0;
+			request_param->txq_count = 0;
+		}
 	}
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		msg.fds[fd_iterator++] = process_private->rxq_fds[i];
 		msg.num_fds++;
 		request_param->rxq_count++;
+
+		if (fd_iterator >= RTE_MP_MAX_FD_NUM) {
+			err = rte_mp_sendmsg(&msg);
+			if (err < 0)
+				goto fail;
+
+			fd_iterator = 0;
+			msg.num_fds = 0;
+			request_param->rxq_count = 0;
+		}
 	}
 
-	err = rte_mp_sendmsg(&msg);
-	if (err < 0) {
-		TAP_LOG(ERR, "Failed to send start req to secondary %d",
-			rte_errno);
-		return -1;
+	if (msg.num_fds > 0) {
+		err = rte_mp_sendmsg(&msg);
+		if (err < 0)
+			goto fail;
 	}
 
 	return 0;
+fail:
+	TAP_LOG(ERR, "Failed to send start req to secondary %d", rte_errno);
+	return err;
 }
 
 static int
@@ -885,8 +908,11 @@ tap_dev_start(struct rte_eth_dev *dev)
 {
 	int err, i;
 
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		tap_mp_req_on_rxtx(dev);
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+		err = tap_mp_req_on_rxtx(dev);
+		if (err)
+			return err;
+	}
 
 	err = tap_intr_handle_set(dev, 1);
 	if (err)
-- 
2.43.0