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 85346A0C47 for ; Wed, 1 Dec 2021 16:38:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6DA1740140; Wed, 1 Dec 2021 16:38:57 +0100 (CET) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id AC6A640140 for ; Wed, 1 Dec 2021 16:38:56 +0100 (CET) Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 794DF3F1ED for ; Wed, 1 Dec 2021 15:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1638373136; bh=cx2hiUNEa9gFmyC7VCunJ67G9dmsluC1OX4VQScbwM0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=r6QY+GNeYsDGQ+QgEZVi2kelpGUXHEGTQARA9SWyRFyFImwNMW7dLCLHpDWl3QRSU UyCnrFRXPThQKWGasNgFt2pRjLjuPcTqDk1P9vffk8YPMX6eXgOix2fFlWJfyNt0bu mQdcxoS5er7gzokbevY6uyPl3RANPbrUrSv0miLXCA3apbU8Y270rsTed7Xg7sZQeN Sa+Z2Uxuj96i/9dmCLxv4kSA9Ih99L7rdTPD2AMkGbBrYnRcMp+Srxlaz0eqdov+RH MtVBkA+Nc124T7ig5zPgndxBQVw8tMGd528qmrBnGSiLu9uDPxI4zoLUpl5ekCCsy5 Kp2UEHkhETu4Q== Received: by mail-qv1-f70.google.com with SMTP id jn10-20020ad45dea000000b003bd74c93df4so34671623qvb.15 for ; Wed, 01 Dec 2021 07:38:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cx2hiUNEa9gFmyC7VCunJ67G9dmsluC1OX4VQScbwM0=; b=W3KJiQy0UPBhZAUHIUWGIfMoeblEJ8aR/SmSbZlbICPWnIBRlpehGOY+DVikB8QnAQ FOwr40KEHVv1rJmwb574o8ULLQlJ1dk5WdJdseNA2PV9QDLka5s1Ts+Vc+/QdiLm7Yku lUwJhN9ld5xUQeTLXFkiC4LLJPq9BLwbYcj9rTi6HFuRZLJgWXsCrqDlg+ondB/0ckVb hdQcoZXy2i2YJs/XW1pSCl548Dn2LWgM3Cr+MIthbprBang/EPMM+/96AFC1ZKrMF7bc oenvLLtgWiI4E4QUN59wgHRlEeBBA1wR23uyqJgjo2/llIqNYwrHN3S8tFXhjhHGR4io rQQQ== X-Gm-Message-State: AOAM532sLFBMD9idSaWaqz+XkInph5dnhtzI8xfNADg7e3B4FDjlVDUX CQEqgqUxXBlBU7idLeYGmi1Z1OZxSnCnY9GbXuZcH2mxZxy2mbx8J3maIGmoaKqhpUNof9+ZN6+ M4P59Y3PgkxaQpkfGXmhxBasz7TGTgSb4J+4UwX4R X-Received: by 2002:a05:6214:62b:: with SMTP id a11mr6979425qvx.26.1638373135308; Wed, 01 Dec 2021 07:38:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJweMp8gO48Ppprj+iMO+fP0r4XOtMJZhfIhvnzTo/qmyqT34lMvGfVT+arffP76yhsJrOpbqvG7A9mQb46dkzI= X-Received: by 2002:a05:6214:62b:: with SMTP id a11mr6979404qvx.26.1638373135080; Wed, 01 Dec 2021 07:38:55 -0800 (PST) MIME-Version: 1.0 References: <1638354725-116692-1-git-send-email-tudor.cornea@gmail.com> In-Reply-To: <1638354725-116692-1-git-send-email-tudor.cornea@gmail.com> From: Christian Ehrhardt Date: Wed, 1 Dec 2021 16:38:29 +0100 Message-ID: Subject: Re: [PATCH 19.11] net/af_packet: fix ignoring full ring on Tx To: Tudor Cornea Cc: stable@dpdk.org, Mihai Pogonaru 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 On Wed, Dec 1, 2021 at 12:02 PM Tudor Cornea wrote: > > [ upstream commit f86d553cc180f9a65e115edb5641a49bbf2cf2f0 ] Thanks, applied > 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 > > Fixes: 364e08f2bbc0 ("af_packet: add PMD for AF_PACKET-based virtual devices") > > Signed-off-by: Mihai Pogonaru > Signed-off-by: Tudor Cornea > Reviewed-by: Ferruh Yigit > --- > drivers/net/af_packet/rte_eth_af_packet.c | 26 ++++++++++++++++++++++++-- > 1 file changed, 24 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 00387ed..dbbe8e5 100644 > --- a/drivers/net/af_packet/rte_eth_af_packet.c > +++ b/drivers/net/af_packet/rte_eth_af_packet.c > @@ -213,8 +213,30 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > } > > /* point at the next incoming frame */ > - if ((ppd->tp_status != TP_STATUS_AVAILABLE) && > - (poll(&pfd, 1, -1) < 0)) > + if (ppd->tp_status != TP_STATUS_AVAILABLE) { > + if (poll(&pfd, 1, -1) < 0) > + break; > + > + /* poll() can return POLLERR if the interface is down */ > + if (pfd.revents & POLLERR) > + break; > + } > + > + /* > + * poll() will almost always return POLLOUT, even if there > + * are no extra buffers available > + * > + * This happens, because packet_poll() calls datagram_poll() > + * which checks the space left in the socket buffer and, > + * in the case of packet_mmap, the default socket buffer length > + * doesn't match the requested size for the tx_ring. > + * As such, there is almost always space left in socket buffer, > + * which doesn't seem to be correlated to the requested size > + * for the tx_ring in packet_mmap. > + * > + * This results in poll() returning POLLOUT. > + */ > + if (ppd->tp_status != TP_STATUS_AVAILABLE) > break; > > /* copy the tx frame data */ > -- > 2.7.4 > -- Christian Ehrhardt Staff Engineer, Ubuntu Server Canonical Ltd