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 C032F470D6 for ; Tue, 23 Dec 2025 23:30:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1109402CB; Tue, 23 Dec 2025 23:30:55 +0100 (CET) Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by mails.dpdk.org (Postfix) with ESMTP id 32BA54025A for ; Tue, 23 Dec 2025 23:30:55 +0100 (CET) Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-34c314af2d4so5273798a91.3 for ; Tue, 23 Dec 2025 14:30:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766529054; x=1767133854; darn=dpdk.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ZjGcwFmTn+mrZnRKhlxLpt8WM2jovbuT914YsgvDsKg=; b=WFCCmUH6pohabKNkFDVCazFgez4PG0a2Ng3TppO9LrEsy7qfHZ99BDYMQzZ2jd+xVY hzF7llUetMWBKxAJzXfeDPu5Ygt/l7M/ItEzsEp0Sgwa4GPST7VI0/LktBKs/EgCRLIe I28FhtpgZz6YgTuMQUkn0jTsumvUV5MkfLfxIm0hrnYRJnQs9aUayBZex4aDYhLLtnO+ KvLiUN6Y+R6zjFydEs1YX5DlvTnfzu/UMF2ln/vOwI5gsEuu56sp+qlGbZPt3ZD+MJOh qrdeEjKzsEQXT1ll1+OFzH/c6MATTfbOcnpmnuTK5YfRMF/fOEcTQUnggUATPMt5vHQ/ X0Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766529054; x=1767133854; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZjGcwFmTn+mrZnRKhlxLpt8WM2jovbuT914YsgvDsKg=; b=GdDFwWqYyfY3EewVh74CQJqJuJFbEwgSoegi2e+Y4mDtled1hEUzGtxI5FpdfC37KT QTCZdLVYJzUPLSwmINM7ZGdIUArWn9zcHlUGXW1zGrlwNFQhVST6itdXHvGAK/WE00A5 kkpF33fKpzVhMCxKj5+mLTlYsw3bPr7vR8+O7+87rCtIUmmRkBQMXmIahVi17WnltPV/ O918sehOl8ofQY2kSNftGnnQn9p2wMX6pSPK7jzQ+zRVZGmK1Z17X6eVa2j5nis4N0hJ fbuaG9ggQeZPDdgPVgOclBSV5UYDmcIx5hbbshDk+tjEFM/UHbrjieSHPnzqZQcKkJ09 l2XQ== X-Gm-Message-State: AOJu0YzuZk3JjX2pj0szXFL4tWNx+PO1oonVohbUBYWWdELaQq0DFkaY 6C98zrNmQBtaRIKMw5beibosEwnJr7upz2SQYzwuUI4AgZd1iflAm099bjTH9MOXQsXg3ZoaZOg /XLvuhX9Xj8VsjDlxG5CfUMgoeZeZPE0H8PO5AdTtRSjNfqDrCRYyJE2yrYabpkwEqWHR1i33pM EfmsMLc9+8yoMuDWVmQCOsxibeemgF6C+4wZZK3A== X-Google-Smtp-Source: AGHT+IGTrCkNG7IxZQ4M+MJGF3OOGYIfgw4xESBYciWk9PHJDtt53drfFuT0pf2VW/+QMsUSMuboItddLG/jrw== X-Received: from pgmm4.prod.google.com ([2002:a05:6a02:5504:b0:bfd:611e:2606]) (user=joshwash job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:3d0b:b0:35d:6b4e:91f7 with SMTP id adf61e73a8af0-376a84cd646mr15858579637.35.1766529054052; Tue, 23 Dec 2025 14:30:54 -0800 (PST) Date: Tue, 23 Dec 2025 14:30:48 -0800 In-Reply-To: <20251223223050.3870080-1-joshwash@google.com> Mime-Version: 1.0 References: <20251223223050.3870080-1-joshwash@google.com> X-Mailer: git-send-email 2.52.0.351.gbe84eed79e-goog Message-ID: <20251223223050.3870080-2-joshwash@google.com> Subject: [PATCH 23.11 2/3] net/gve: clean when insufficient Tx descriptors From: Joshua Washington To: stable@dpdk.org, Junfeng Guo , Jeroen de Borst , Rushil Gupta , Joshua Washington Cc: Ankit Garg Content-Type: text/plain; charset="UTF-8" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org A single packet can technically require more than 32 (free_thresh) descriptors to send. Count the number of descriptors needed to send out a packet in DQO Tx, and ensure that there are enough descriptors in the ring before writing. If there are not enough free descriptors, drop the packet and increment drop counters. Fixes: 4022f9999f56 ("net/gve: support basic Tx data path for DQO") Cc: stable@dpdk.org Signed-off-by: Joshua Washington Reviewed-by: Ankit Garg --- drivers/net/gve/gve_tx_dqo.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/net/gve/gve_tx_dqo.c b/drivers/net/gve/gve_tx_dqo.c index a4ba8c3536..8e75e4d570 100644 --- a/drivers/net/gve/gve_tx_dqo.c +++ b/drivers/net/gve/gve_tx_dqo.c @@ -74,6 +74,12 @@ gve_tx_clean_dqo(struct gve_tx_queue *txq) txq->complq_tail = next; } +static inline void +gve_tx_clean_descs_dqo(struct gve_tx_queue *txq, uint16_t nb_descs) { + while (--nb_descs) + gve_tx_clean_dqo(txq); +} + static uint16_t gve_tx_pkt_nb_data_descs(struct rte_mbuf *tx_pkt) { @@ -96,7 +102,6 @@ gve_tx_burst_dqo(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) struct rte_mbuf **sw_ring; struct rte_mbuf *tx_pkt; uint16_t mask, sw_mask; - uint16_t nb_to_clean; uint16_t first_sw_id; const char *reason; uint16_t nb_tx = 0; @@ -119,11 +124,9 @@ gve_tx_burst_dqo(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) { tx_pkt = tx_pkts[nb_tx]; - if (txq->nb_free <= txq->free_thresh) { - nb_to_clean = DQO_TX_MULTIPLIER * txq->rs_thresh; - while (nb_to_clean--) - gve_tx_clean_dqo(txq); - } + if (txq->nb_free <= txq->free_thresh) + gve_tx_clean_descs_dqo(txq, DQO_TX_MULTIPLIER * + txq->rs_thresh); if (txq->nb_free < tx_pkt->nb_segs) break; @@ -140,8 +143,16 @@ gve_tx_burst_dqo(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) csum = !!(ol_flags & GVE_TX_CKSUM_OFFLOAD_MASK_DQO); nb_descs = gve_tx_pkt_nb_data_descs(tx_pkt); - if (txq->nb_free < nb_descs) - break; + + /* Clean if there aren't enough descriptors to send the packet. */ + if (unlikely(txq->nb_free < nb_descs)) { + int nb_to_clean = RTE_MAX(DQO_TX_MULTIPLIER * txq->rs_thresh, + nb_descs); + + gve_tx_clean_descs_dqo(txq, nb_to_clean); + if (txq->nb_free < nb_descs) + break; + } do { if (sw_ring[sw_id] != NULL) -- 2.52.0.351.gbe84eed79e-goog