get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/139200/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 139200,
    "url": "http://patches.dpdk.org/api/patches/139200/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240409034237.433270-2-stephen@networkplumber.org/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20240409034237.433270-2-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240409034237.433270-2-stephen@networkplumber.org",
    "date": "2024-04-09T03:40:30",
    "name": "[v8,1/8] net/tap: do not duplicate fd's",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "a91d7804bafb4f3ab72c34174fff0f4e19825550",
    "submitter": {
        "id": 27,
        "url": "http://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240409034237.433270-2-stephen@networkplumber.org/mbox/",
    "series": [
        {
            "id": 31709,
            "url": "http://patches.dpdk.org/api/series/31709/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31709",
            "date": "2024-04-09T03:40:29",
            "name": "net/tap: cleanups and fix BPF support",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/31709/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/139200/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/139200/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 4C3D543DD9;\n\tTue,  9 Apr 2024 05:42:48 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 65D89402EB;\n\tTue,  9 Apr 2024 05:42:43 +0200 (CEST)",
            "from mail-oo1-f42.google.com (mail-oo1-f42.google.com\n [209.85.161.42]) by mails.dpdk.org (Postfix) with ESMTP id DF99E4027B\n for <dev@dpdk.org>; Tue,  9 Apr 2024 05:42:40 +0200 (CEST)",
            "by mail-oo1-f42.google.com with SMTP id\n 006d021491bc7-5a9c875ceecso2887207eaf.2\n for <dev@dpdk.org>; Mon, 08 Apr 2024 20:42:40 -0700 (PDT)",
            "from hermes.lan (204-195-96-226.wavecable.com. [204.195.96.226])\n by smtp.gmail.com with ESMTPSA id\n gm24-20020a17090b101800b0029de90f4d44sm9238197pjb.9.2024.04.08.20.42.39\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 08 Apr 2024 20:42:39 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1712634160;\n x=1713238960; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=dNwVMgvhyvxrr3NLBqyD4/IUsTt8vuh5Spk86OIFLjU=;\n b=J5HKsbMU7hDeB0Ti9nRZc0f5qiCoZ6x6tbeDMGn59HtrL1CUrh1/lIZMWBnW9sWtxB\n 6zleCk0W69rqaJpO1JR2ihWaBy4MzEJR1ThRjck3CnF5l0Bs6N4E+GgbdrQs2l2ZUrkI\n YNDwwKobdBTaOU8kroBJgc58oXagakamEg0Lc2a8R+kII27zJ5KpZ5kwK2xbmISefbbE\n D1dDTufUiENmdZ/J6nHEVApSKTKHkMDovUDroneCn+nA81/6bXX8IW0mEZ19lcX8SUZl\n n8gH8FFZn1pYQomXdUYnrct4m9+wdL5k0BmcrbG7Lvl5hFrKjXWO05bDLJU3ku0K8iSI\n iKEQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1712634160; x=1713238960;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=dNwVMgvhyvxrr3NLBqyD4/IUsTt8vuh5Spk86OIFLjU=;\n b=HiLTZpRdxz8k1mPEfbYeiVswn/36ZqRkWIhuygDjA/qzHg/bCoF9Wm8dhBu1gWa77Y\n lBZPSHJSiv4eheUHmH98RcwMbLRHOes+HOEtw/TnBM0Riy2wzPMtoI1YktZ39Jw6flT1\n dR9LKZHfk24CfRVsEmX20/pXBENAv0nAAmxeKsSFS/nhg3fZ7aOOsSio0Rvw2DzxqLRS\n r/trtcXw8egRsvITE4swnfjgpA2SuwT5jZfNDJWExWdJ+KjTEfsqn4rz9/qMchmolRvM\n imZrVHj5XR/KvU3HmBew1ZSUxz/xyAhgdb0JAbRLlhj7+A5U5kvIrfZCGb8SQQNZNLgX\n 6z5Q==",
        "X-Gm-Message-State": "AOJu0YylbXEggzGTJj1iT4XvJLTQ1SPMmsdDFEsJGIVl9FpoeUp/c/Oa\n vc1KiBUV8Di4/as7+ZREFnJGltUG1XNcSsARx+4hf5W+EtuGw0976768jfoPrlODX3st8hLDuNB\n 6/Og=",
        "X-Google-Smtp-Source": "\n AGHT+IEm+pKyx6EGrAju4PrrvR7Vr3YmQAOUssyLtvjxqYlYuaZ5nmEWdGR8WytND8JtaCBA9lKrpw==",
        "X-Received": "by 2002:a05:6358:6b0b:b0:17f:837b:da8 with SMTP id\n y11-20020a0563586b0b00b0017f837b0da8mr10430457rwg.22.1712634159824;\n Mon, 08 Apr 2024 20:42:39 -0700 (PDT)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "dev@dpdk.org",
        "Cc": "Stephen Hemminger <stephen@networkplumber.org>",
        "Subject": "[PATCH v8 1/8] net/tap: do not duplicate fd's",
        "Date": "Mon,  8 Apr 2024 20:40:30 -0700",
        "Message-ID": "<20240409034237.433270-2-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20240409034237.433270-1-stephen@networkplumber.org>",
        "References": "<20240130034925.44869-1-stephen@networkplumber.org>\n <20240409034237.433270-1-stephen@networkplumber.org>",
        "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>,\n <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>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "The TAP device can use same file descriptopr for both rx and tx queues.\nThis allows up to 8 queues (versus 4).\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n drivers/net/tap/meson.build   |   2 +-\n drivers/net/tap/rte_eth_tap.c | 197 +++++++++++++++-------------------\n drivers/net/tap/rte_eth_tap.h |   3 +-\n drivers/net/tap/tap_flow.c    |   3 +-\n drivers/net/tap/tap_intr.c    |   7 +-\n 5 files changed, 92 insertions(+), 120 deletions(-)",
    "diff": "diff --git a/drivers/net/tap/meson.build b/drivers/net/tap/meson.build\nindex 5099ccdff1..9cd124d53e 100644\n--- a/drivers/net/tap/meson.build\n+++ b/drivers/net/tap/meson.build\n@@ -16,7 +16,7 @@ sources = files(\n \n deps = ['bus_vdev', 'gso', 'hash']\n \n-cflags += '-DTAP_MAX_QUEUES=16'\n+cflags += '-DTAP_MAX_QUEUES=8'\n \n # input array for meson symbol search:\n # [ \"MACRO to define if found\", \"header for the search\",\ndiff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c\nindex 69d9da695b..38a1b2d825 100644\n--- a/drivers/net/tap/rte_eth_tap.c\n+++ b/drivers/net/tap/rte_eth_tap.c\n@@ -124,8 +124,7 @@ enum ioctl_mode {\n /* Message header to synchronize queues via IPC */\n struct ipc_queues {\n \tchar port_name[RTE_DEV_NAME_MAX_LEN];\n-\tint rxq_count;\n-\tint txq_count;\n+\tint q_count;\n \t/*\n \t * The file descriptors are in the dedicated part\n \t * of the Unix message to be translated by the kernel.\n@@ -446,7 +445,7 @@ pmd_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)\n \t\tuint16_t data_off = rte_pktmbuf_headroom(mbuf);\n \t\tint len;\n \n-\t\tlen = readv(process_private->rxq_fds[rxq->queue_id],\n+\t\tlen = readv(process_private->fds[rxq->queue_id],\n \t\t\t*rxq->iovecs,\n \t\t\t1 + (rxq->rxmode->offloads & RTE_ETH_RX_OFFLOAD_SCATTER ?\n \t\t\t     rxq->nb_rx_desc : 1));\n@@ -643,7 +642,7 @@ tap_write_mbufs(struct tx_queue *txq, uint16_t num_mbufs,\n \t\t}\n \n \t\t/* copy the tx frame data */\n-\t\tn = writev(process_private->txq_fds[txq->queue_id], iovecs, k);\n+\t\tn = writev(process_private->fds[txq->queue_id], iovecs, k);\n \t\tif (n <= 0)\n \t\t\treturn -1;\n \n@@ -851,7 +850,6 @@ tap_mp_req_on_rxtx(struct rte_eth_dev *dev)\n \tstruct rte_mp_msg msg;\n \tstruct ipc_queues *request_param = (struct ipc_queues *)msg.param;\n \tint err;\n-\tint fd_iterator = 0;\n \tstruct pmd_process_private *process_private = dev->process_private;\n \tint i;\n \n@@ -859,16 +857,13 @@ tap_mp_req_on_rxtx(struct rte_eth_dev *dev)\n \tstrlcpy(msg.name, TAP_MP_REQ_START_RXTX, sizeof(msg.name));\n \tstrlcpy(request_param->port_name, dev->data->name, sizeof(request_param->port_name));\n \tmsg.len_param = sizeof(*request_param);\n-\tfor (i = 0; i < dev->data->nb_tx_queues; i++) {\n-\t\tmsg.fds[fd_iterator++] = process_private->txq_fds[i];\n-\t\tmsg.num_fds++;\n-\t\trequest_param->txq_count++;\n-\t}\n-\tfor (i = 0; i < dev->data->nb_rx_queues; i++) {\n-\t\tmsg.fds[fd_iterator++] = process_private->rxq_fds[i];\n-\t\tmsg.num_fds++;\n-\t\trequest_param->rxq_count++;\n-\t}\n+\n+\t/* rx and tx share file descriptors and nb_tx_queues == nb_rx_queues */\n+\tfor (i = 0; i < dev->data->nb_rx_queues; i++)\n+\t\tmsg.fds[i] = process_private->fds[i];\n+\n+\trequest_param->q_count = dev->data->nb_rx_queues;\n+\tmsg.num_fds = dev->data->nb_rx_queues;\n \n \terr = rte_mp_sendmsg(&msg);\n \tif (err < 0) {\n@@ -910,8 +905,6 @@ tap_mp_req_start_rxtx(const struct rte_mp_msg *request, __rte_unused const void\n \tstruct rte_eth_dev *dev;\n \tconst struct ipc_queues *request_param =\n \t\t(const struct ipc_queues *)request->param;\n-\tint fd_iterator;\n-\tint queue;\n \tstruct pmd_process_private *process_private;\n \n \tdev = rte_eth_dev_get_by_name(request_param->port_name);\n@@ -920,14 +913,13 @@ tap_mp_req_start_rxtx(const struct rte_mp_msg *request, __rte_unused const void\n \t\t\trequest_param->port_name);\n \t\treturn -1;\n \t}\n+\n \tprocess_private = dev->process_private;\n-\tfd_iterator = 0;\n-\tTAP_LOG(DEBUG, \"tap_attach rx_q:%d tx_q:%d\\n\", request_param->rxq_count,\n-\t\trequest_param->txq_count);\n-\tfor (queue = 0; queue < request_param->txq_count; queue++)\n-\t\tprocess_private->txq_fds[queue] = request->fds[fd_iterator++];\n-\tfor (queue = 0; queue < request_param->rxq_count; queue++)\n-\t\tprocess_private->rxq_fds[queue] = request->fds[fd_iterator++];\n+\tTAP_LOG(DEBUG, \"tap_attach q:%d\\n\", request_param->q_count);\n+\n+\tfor (int q = 0; q < request_param->q_count; q++)\n+\t\tprocess_private->fds[q] = request->fds[q];\n+\n \n \treturn 0;\n }\n@@ -1121,7 +1113,6 @@ tap_dev_close(struct rte_eth_dev *dev)\n \tint i;\n \tstruct pmd_internals *internals = dev->data->dev_private;\n \tstruct pmd_process_private *process_private = dev->process_private;\n-\tstruct rx_queue *rxq;\n \n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY) {\n \t\trte_free(dev->process_private);\n@@ -1141,19 +1132,18 @@ tap_dev_close(struct rte_eth_dev *dev)\n \t}\n \n \tfor (i = 0; i < RTE_PMD_TAP_MAX_QUEUES; i++) {\n-\t\tif (process_private->rxq_fds[i] != -1) {\n-\t\t\trxq = &internals->rxq[i];\n-\t\t\tclose(process_private->rxq_fds[i]);\n-\t\t\tprocess_private->rxq_fds[i] = -1;\n-\t\t\ttap_rxq_pool_free(rxq->pool);\n-\t\t\trte_free(rxq->iovecs);\n-\t\t\trxq->pool = NULL;\n-\t\t\trxq->iovecs = NULL;\n-\t\t}\n-\t\tif (process_private->txq_fds[i] != -1) {\n-\t\t\tclose(process_private->txq_fds[i]);\n-\t\t\tprocess_private->txq_fds[i] = -1;\n-\t\t}\n+\t\tstruct rx_queue *rxq = &internals->rxq[i];\n+\n+\t\tif (process_private->fds[i] == -1)\n+\t\t\tcontinue;\n+\n+\t\tclose(process_private->fds[i]);\n+\t\tprocess_private->fds[i] = -1;\n+\n+\t\ttap_rxq_pool_free(rxq->pool);\n+\t\trte_free(rxq->iovecs);\n+\t\trxq->pool = NULL;\n+\t\trxq->iovecs = NULL;\n \t}\n \n \tif (internals->remote_if_index) {\n@@ -1198,6 +1188,15 @@ tap_dev_close(struct rte_eth_dev *dev)\n \treturn 0;\n }\n \n+static void\n+tap_queue_close(struct pmd_process_private *process_private, uint16_t qid)\n+{\n+\tif (process_private->fds[qid] != -1) {\n+\t\tclose(process_private->fds[qid]);\n+\t\tprocess_private->fds[qid] = -1;\n+\t}\n+}\n+\n static void\n tap_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)\n {\n@@ -1206,15 +1205,16 @@ tap_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)\n \n \tif (!rxq)\n \t\treturn;\n+\n \tprocess_private = rte_eth_devices[rxq->in_port].process_private;\n-\tif (process_private->rxq_fds[rxq->queue_id] != -1) {\n-\t\tclose(process_private->rxq_fds[rxq->queue_id]);\n-\t\tprocess_private->rxq_fds[rxq->queue_id] = -1;\n-\t\ttap_rxq_pool_free(rxq->pool);\n-\t\trte_free(rxq->iovecs);\n-\t\trxq->pool = NULL;\n-\t\trxq->iovecs = NULL;\n-\t}\n+\n+\ttap_rxq_pool_free(rxq->pool);\n+\trte_free(rxq->iovecs);\n+\trxq->pool = NULL;\n+\trxq->iovecs = NULL;\n+\n+\tif (dev->data->tx_queues[qid] == NULL)\n+\t\ttap_queue_close(process_private, qid);\n }\n \n static void\n@@ -1225,12 +1225,10 @@ tap_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid)\n \n \tif (!txq)\n \t\treturn;\n-\tprocess_private = rte_eth_devices[txq->out_port].process_private;\n \n-\tif (process_private->txq_fds[txq->queue_id] != -1) {\n-\t\tclose(process_private->txq_fds[txq->queue_id]);\n-\t\tprocess_private->txq_fds[txq->queue_id] = -1;\n-\t}\n+\tprocess_private = rte_eth_devices[txq->out_port].process_private;\n+\tif (dev->data->rx_queues[qid] == NULL)\n+\t\ttap_queue_close(process_private, qid);\n }\n \n static int\n@@ -1482,52 +1480,34 @@ tap_setup_queue(struct rte_eth_dev *dev,\n \t\tuint16_t qid,\n \t\tint is_rx)\n {\n-\tint ret;\n-\tint *fd;\n-\tint *other_fd;\n-\tconst char *dir;\n+\tint fd, ret;\n \tstruct pmd_internals *pmd = dev->data->dev_private;\n \tstruct pmd_process_private *process_private = dev->process_private;\n \tstruct rx_queue *rx = &internals->rxq[qid];\n \tstruct tx_queue *tx = &internals->txq[qid];\n-\tstruct rte_gso_ctx *gso_ctx;\n+\tstruct rte_gso_ctx *gso_ctx = NULL;\n+\tconst char *dir = is_rx ? \"rx\" : \"tx\";\n \n-\tif (is_rx) {\n-\t\tfd = &process_private->rxq_fds[qid];\n-\t\tother_fd = &process_private->txq_fds[qid];\n-\t\tdir = \"rx\";\n-\t\tgso_ctx = NULL;\n-\t} else {\n-\t\tfd = &process_private->txq_fds[qid];\n-\t\tother_fd = &process_private->rxq_fds[qid];\n-\t\tdir = \"tx\";\n+\tif (is_rx)\n \t\tgso_ctx = &tx->gso_ctx;\n-\t}\n-\tif (*fd != -1) {\n+\n+\tfd = process_private->fds[qid];\n+\tif (fd != -1) {\n \t\t/* fd for this queue already exists */\n \t\tTAP_LOG(DEBUG, \"%s: fd %d for %s queue qid %d exists\",\n-\t\t\tpmd->name, *fd, dir, qid);\n+\t\t\tpmd->name, fd, dir, qid);\n \t\tgso_ctx = NULL;\n-\t} else if (*other_fd != -1) {\n-\t\t/* Only other_fd exists. dup it */\n-\t\t*fd = dup(*other_fd);\n-\t\tif (*fd < 0) {\n-\t\t\t*fd = -1;\n-\t\t\tTAP_LOG(ERR, \"%s: dup() failed.\", pmd->name);\n-\t\t\treturn -1;\n-\t\t}\n-\t\tTAP_LOG(DEBUG, \"%s: dup fd %d for %s queue qid %d (%d)\",\n-\t\t\tpmd->name, *other_fd, dir, qid, *fd);\n \t} else {\n-\t\t/* Both RX and TX fds do not exist (equal -1). Create fd */\n-\t\t*fd = tun_alloc(pmd, 0, 0);\n-\t\tif (*fd < 0) {\n-\t\t\t*fd = -1; /* restore original value */\n+\t\tfd = tun_alloc(pmd, 0, 0);\n+\t\tif (fd < 0) {\n \t\t\tTAP_LOG(ERR, \"%s: tun_alloc() failed.\", pmd->name);\n \t\t\treturn -1;\n \t\t}\n+\n \t\tTAP_LOG(DEBUG, \"%s: add %s queue for qid %d fd %d\",\n-\t\t\tpmd->name, dir, qid, *fd);\n+\t\t\tpmd->name, dir, qid, fd);\n+\n+\t\tprocess_private->fds[qid] = fd;\n \t}\n \n \ttx->mtu = &dev->data->mtu;\n@@ -1540,7 +1520,7 @@ tap_setup_queue(struct rte_eth_dev *dev,\n \n \ttx->type = pmd->type;\n \n-\treturn *fd;\n+\treturn fd;\n }\n \n static int\n@@ -1620,7 +1600,7 @@ tap_rx_queue_setup(struct rte_eth_dev *dev,\n \n \tTAP_LOG(DEBUG, \"  RX TUNTAP device name %s, qid %d on fd %d\",\n \t\tinternals->name, rx_queue_id,\n-\t\tprocess_private->rxq_fds[rx_queue_id]);\n+\t\tprocess_private->fds[rx_queue_id]);\n \n \treturn 0;\n \n@@ -1664,7 +1644,7 @@ tap_tx_queue_setup(struct rte_eth_dev *dev,\n \tTAP_LOG(DEBUG,\n \t\t\"  TX TUNTAP device name %s, qid %d on fd %d csum %s\",\n \t\tinternals->name, tx_queue_id,\n-\t\tprocess_private->txq_fds[tx_queue_id],\n+\t\tprocess_private->fds[tx_queue_id],\n \t\ttxq->csum ? \"on\" : \"off\");\n \n \treturn 0;\n@@ -2001,10 +1981,9 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,\n \tdev->intr_handle = pmd->intr_handle;\n \n \t/* Presetup the fds to -1 as being not valid */\n-\tfor (i = 0; i < RTE_PMD_TAP_MAX_QUEUES; i++) {\n-\t\tprocess_private->rxq_fds[i] = -1;\n-\t\tprocess_private->txq_fds[i] = -1;\n-\t}\n+\tfor (i = 0; i < RTE_PMD_TAP_MAX_QUEUES; i++)\n+\t\tprocess_private->fds[i] = -1;\n+\n \n \tif (pmd->type == ETH_TUNTAP_TYPE_TAP) {\n \t\tif (rte_is_zero_ether_addr(mac_addr))\n@@ -2332,7 +2311,6 @@ tap_mp_attach_queues(const char *port_name, struct rte_eth_dev *dev)\n \tstruct ipc_queues *request_param = (struct ipc_queues *)request.param;\n \tstruct ipc_queues *reply_param;\n \tstruct pmd_process_private *process_private = dev->process_private;\n-\tint queue, fd_iterator;\n \n \t/* Prepare the request */\n \tmemset(&request, 0, sizeof(request));\n@@ -2352,18 +2330,17 @@ tap_mp_attach_queues(const char *port_name, struct rte_eth_dev *dev)\n \tTAP_LOG(DEBUG, \"Received IPC reply for %s\", reply_param->port_name);\n \n \t/* Attach the queues from received file descriptors */\n-\tif (reply_param->rxq_count + reply_param->txq_count != reply->num_fds) {\n+\tif (reply_param->q_count != reply->num_fds) {\n \t\tTAP_LOG(ERR, \"Unexpected number of fds received\");\n \t\treturn -1;\n \t}\n \n-\tdev->data->nb_rx_queues = reply_param->rxq_count;\n-\tdev->data->nb_tx_queues = reply_param->txq_count;\n-\tfd_iterator = 0;\n-\tfor (queue = 0; queue < reply_param->rxq_count; queue++)\n-\t\tprocess_private->rxq_fds[queue] = reply->fds[fd_iterator++];\n-\tfor (queue = 0; queue < reply_param->txq_count; queue++)\n-\t\tprocess_private->txq_fds[queue] = reply->fds[fd_iterator++];\n+\tdev->data->nb_rx_queues = reply_param->q_count;\n+\tdev->data->nb_tx_queues = reply_param->q_count;\n+\n+\tfor (int q = 0; q < reply_param->q_count; q++)\n+\t\tprocess_private->fds[q] = reply->fds[q];\n+\n \tfree(reply);\n \treturn 0;\n }\n@@ -2393,25 +2370,19 @@ tap_mp_sync_queues(const struct rte_mp_msg *request, const void *peer)\n \n \t/* Fill file descriptors for all queues */\n \treply.num_fds = 0;\n-\treply_param->rxq_count = 0;\n-\tif (dev->data->nb_rx_queues + dev->data->nb_tx_queues >\n-\t\t\tRTE_MP_MAX_FD_NUM){\n-\t\tTAP_LOG(ERR, \"Number of rx/tx queues exceeds max number of fds\");\n+\treply_param->q_count = 0;\n+\n+\tRTE_ASSERT(dev->data->nb_rx_queues == dev->data->nb_tx_queues);\n+\tif (dev->data->nb_rx_queues > RTE_MP_MAX_FD_NUM) {\n+\t\tTAP_LOG(ERR, \"Number of rx/tx queues %u exceeds max number of fds %u\",\n+\t\t\tdev->data->nb_rx_queues, RTE_MP_MAX_FD_NUM);\n \t\treturn -1;\n \t}\n \n \tfor (queue = 0; queue < dev->data->nb_rx_queues; queue++) {\n-\t\treply.fds[reply.num_fds++] = process_private->rxq_fds[queue];\n-\t\treply_param->rxq_count++;\n-\t}\n-\tRTE_ASSERT(reply_param->rxq_count == dev->data->nb_rx_queues);\n-\n-\treply_param->txq_count = 0;\n-\tfor (queue = 0; queue < dev->data->nb_tx_queues; queue++) {\n-\t\treply.fds[reply.num_fds++] = process_private->txq_fds[queue];\n-\t\treply_param->txq_count++;\n+\t\treply.fds[reply.num_fds++] = process_private->fds[queue];\n+\t\treply_param->q_count++;\n \t}\n-\tRTE_ASSERT(reply_param->txq_count == dev->data->nb_tx_queues);\n \n \t/* Send reply */\n \tstrlcpy(reply.name, request->name, sizeof(reply.name));\ndiff --git a/drivers/net/tap/rte_eth_tap.h b/drivers/net/tap/rte_eth_tap.h\nindex 5ac93f93e9..dc8201020b 100644\n--- a/drivers/net/tap/rte_eth_tap.h\n+++ b/drivers/net/tap/rte_eth_tap.h\n@@ -96,8 +96,7 @@ struct pmd_internals {\n };\n \n struct pmd_process_private {\n-\tint rxq_fds[RTE_PMD_TAP_MAX_QUEUES];\n-\tint txq_fds[RTE_PMD_TAP_MAX_QUEUES];\n+\tint fds[RTE_PMD_TAP_MAX_QUEUES];\n };\n \n /* tap_intr.c */\ndiff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c\nindex fa50fe45d7..a78fd50cd4 100644\n--- a/drivers/net/tap/tap_flow.c\n+++ b/drivers/net/tap/tap_flow.c\n@@ -1595,8 +1595,9 @@ tap_flow_isolate(struct rte_eth_dev *dev,\n \t * If netdevice is there, setup appropriate flow rules immediately.\n \t * Otherwise it will be set when bringing up the netdevice (tun_alloc).\n \t */\n-\tif (!process_private->rxq_fds[0])\n+\tif (process_private->fds[0] == -1)\n \t\treturn 0;\n+\n \tif (set) {\n \t\tstruct rte_flow *remote_flow;\n \ndiff --git a/drivers/net/tap/tap_intr.c b/drivers/net/tap/tap_intr.c\nindex a9097def1a..1908f71f97 100644\n--- a/drivers/net/tap/tap_intr.c\n+++ b/drivers/net/tap/tap_intr.c\n@@ -68,9 +68,11 @@ tap_rx_intr_vec_install(struct rte_eth_dev *dev)\n \t}\n \tfor (i = 0; i < n; i++) {\n \t\tstruct rx_queue *rxq = pmd->dev->data->rx_queues[i];\n+\t\tint fd = process_private->fds[i];\n \n \t\t/* Skip queues that cannot request interrupts. */\n-\t\tif (!rxq || process_private->rxq_fds[i] == -1) {\n+\t\tif (!rxq || fd == -1) {\n+\t\t\t/* Use invalid intr_vec[] index to disable entry. */\n \t\t\t/* Use invalid intr_vec[] index to disable entry. */\n \t\t\tif (rte_intr_vec_list_index_set(intr_handle, i,\n \t\t\tRTE_INTR_VEC_RXTX_OFFSET + RTE_MAX_RXTX_INTR_VEC_ID))\n@@ -80,8 +82,7 @@ tap_rx_intr_vec_install(struct rte_eth_dev *dev)\n \t\tif (rte_intr_vec_list_index_set(intr_handle, i,\n \t\t\t\t\tRTE_INTR_VEC_RXTX_OFFSET + count))\n \t\t\treturn -rte_errno;\n-\t\tif (rte_intr_efds_index_set(intr_handle, count,\n-\t\t\t\t\t\t   process_private->rxq_fds[i]))\n+\t\tif (rte_intr_efds_index_set(intr_handle, count, fd))\n \t\t\treturn -rte_errno;\n \t\tcount++;\n \t}\n",
    "prefixes": [
        "v8",
        "1/8"
    ]
}