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 BA242A0C53; Wed, 3 Nov 2021 10:31:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A81EC4115F; Wed, 3 Nov 2021 10:31:44 +0100 (CET) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mails.dpdk.org (Postfix) with ESMTP id F33B540F35 for ; Wed, 3 Nov 2021 10:31:42 +0100 (CET) Received: by mail-wr1-f43.google.com with SMTP id c4so2515330wrd.9 for ; Wed, 03 Nov 2021 02:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y2APcnKaKuP23r8OAoeQGIUraaAEMPm15SrdwapNltE=; b=ipgb/FFa2nI2eHyB15XtVGtHgHdtHoc5YNs/gFuKpvHnIxtBti0+I+/0ylqrKQ8LgI dXtX9q3bp6aYfw81lmcuCKqCOJ3kBHRvJVG7CA2qpQ0VJad1KJspD25zAzUAKELxTlIt rz9tPLIJS8qthuultiWb7/+OVTBhvIXzLWkq9XU6VcAttcy0J4bqsb5ZR/0WytWuycFU X+dROlCMREDAXufqF9VpcJ1O+3Lf5y+Wk63he37huqL/3tH7bDn8d/ZEqM6cwzqLPPoL tjay1x5JFuet5uxBePHfKzvsYnwpVM53SrdBCIegcaM3Ynqa87fMZ8xnVjEvTDGEAVi1 IPRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Y2APcnKaKuP23r8OAoeQGIUraaAEMPm15SrdwapNltE=; b=MbA11M/SJ1gk/Pvo2K9ggs/hiYSg+NFtCDgM8JSp+OJsCwwqfMsbwFntRj7C/2WtSF hS0nfN0Vgg+VSZJncAjnVxixTFvjgSewyJAUttRPizbWoL0eWSxzlF+c/F35S61vsC/C kSofCO+P4w/IEYMlXWVB6gedZLDvxsC0VoLnDuxaPh8Ew6POb5g8jygqTYwXUvp3cORg /CTQD+docI1FBD9kfETbHGELxys/6mDhxO63WmvkiJUgtaG2i7QEVbfO99kE+URdK9ad OfyIoPDJGatg47FqygHZ1EozvNcspfMCSG55Y7Pva6pKzSl33uWiZsB7bP/2HUt1TBAH JWqg== X-Gm-Message-State: AOAM530dhD6wcM1VRfFpL7lJREILowaN7oKvRKZFDwuqzKXIzi904QWX aj7t0JbMJ+chCEJEFreZ2Ck= X-Google-Smtp-Source: ABdhPJxvgjsL6/R6JAYmDVX7jSjonhnL2JOUbiFGuIhpWd0SMVR1r6uA0100RRsjx/twYFB0Ao2aIw== X-Received: by 2002:a5d:64cc:: with SMTP id f12mr7533560wri.322.1635931902722; Wed, 03 Nov 2021 02:31:42 -0700 (PDT) Received: from tucornea-dev-machine.localdomain ([193.226.172.44]) by smtp.gmail.com with ESMTPSA id f24sm1310115wmb.33.2021.11.03.02.31.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Nov 2021 02:31:42 -0700 (PDT) From: Tudor Cornea To: ferruh.yigit@intel.com Cc: linville@tuxdriver.com, thomas@monjalon.net, pogonarumihai@gmail.com, dev@dpdk.org, Tudor Cornea Date: Wed, 3 Nov 2021 11:31:31 +0200 Message-Id: <1635931891-27283-1-git-send-email-tudor.cornea@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1635868044-69456-1-git-send-email-tudor.cornea@gmail.com> References: <1635868044-69456-1-git-send-email-tudor.cornea@gmail.com> Subject: [dpdk-dev] [PATCH v4] net/af_packet: fix ignoring full ring on tx 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" The poll call can return POLLERR which is ignored, or it can return POLLOUT, even if there are no free frames in the mmap-ed area. We can account for both of these cases by re-checking if the next frame is empty before writing into it. We have attempted to reproduce this issue with pktgen-dpdk, using the following configuration. pktgen -l 1-4 -n 4 --proc-type=primary --no-pci --no-telemetry \ --no-huge -m 512 \ --vdev=net_af_packet0,iface=eth1,blocksz=16384,framesz=8192, \ framecnt=2048,qpairs=1,qdisc_bypass=0 \ -- \ -P \ -T \ -m "3.0" \ -f themes/black-yellow.theme We configure a low tx rate (~ 335 packets / second) and a small packet size, of about 300 bytes from the pktgen CLI. set 0 size 300 set 0 rate 0.008 set 0 burst 1 start 0 After bringing the interface down, and up again, we seem to arrive in a state in which the tx rate is inconsistent, and does not recover. ifconfig eth1 down; sleep 7; ifconfig eth1 up [1] http://code.dpdk.org/pktgen-dpdk/pktgen-20.11.2/source/INSTALL.md Signed-off-by: Mihai Pogonaru Signed-off-by: Tudor Cornea Reviewed-by: Ferruh Yigit --- v4: * Updated comment regarding POLLERR Removed some extra details, and left notice about poll() returning POLLERR, in case of interface link down. v3: * Added check for POLLERR * Used tx_ring_status_available() for checking TP_STATUS_AVAILABLE --- drivers/net/af_packet/rte_eth_af_packet.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index 559f5a0..dd6d165 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -237,8 +237,16 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } /* point at the next incoming frame */ - if (!tx_ring_status_available(ppd->tp_status) && - poll(&pfd, 1, -1) < 0) + if (!tx_ring_status_available(ppd->tp_status)) { + if (poll(&pfd, 1, -1) < 0) + break; + + /* poll() can return POLLERR if the interface is down */ + if (pfd.revents & POLLERR) + break; + } + + if (!tx_ring_status_available(ppd->tp_status)) break; /* copy the tx frame data */ -- 2.7.4