From patchwork Mon Mar 20 11:36:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: hfli@netitest.com X-Patchwork-Id: 125314 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id EEE01427E1; Mon, 20 Mar 2023 12:36:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 867C340A7F; Mon, 20 Mar 2023 12:36:10 +0100 (CET) Received: from smtpbgjp3.qq.com (smtpbgjp3.qq.com [54.92.39.34]) by mails.dpdk.org (Postfix) with ESMTP id 02E94406BC for ; Mon, 20 Mar 2023 12:36:07 +0100 (CET) X-QQ-mid: bizesmtp78t1679312163tlmnv8yq Received: from DESKTOPGF9TM7H ( [125.42.32.4]) by bizesmtp.qq.com (ESMTP) with SMTP id 0 for ; Mon, 20 Mar 2023 19:36:02 +0800 (CST) X-QQ-SSF: 00000000000000C0H000000A0000000 X-QQ-FEAT: 90EFqYDyPxBOaoNZFIixbrf4LnH06SjvpSnxykWfdVKyo5Gygv2DQxpvk/xjm t4lolN/fyHfaP0JQVNfQCyH/PYksEsegxqnG7bC0QwHxY8dOXH/4Kpobjba89Y7GEzWrzI+ h4Vme51XXcLyIzogYZbHqwbRvHHrBUNSSMBBynHKv9OiDBqL0s32LwZbv1lsgQNHrwYNor5 5LPcFXazgwDByj5AmZuvBsRngvwA+s1ipgBFsDrADIdpceuXLpBLU+cUfbQL3DXgzKEzby6 hndGxB2Cu0pk12RqgJyo9wL3y1GEqTw4/z3WSOuoVr8Q6VfAjQTbtyobyyGAniyKvlE4ILy XQY7xrUP0GXaAOv8MW7RyZJqDvoc5t5/nA54X5+/I7lv+LqUuRYc8Wc1+IK+Q== X-QQ-GoodBg: 0 From: To: References: In-Reply-To: Subject: =?eucgb2312_cn?b?u9i4tDogYWZfcGFja2V0IGNhbid0IHNlbmQgcGFja2V0IG1vcmUgdGhh?= =?eucgb2312_cn?b?biBmcmFtZWNudA==?= Date: Mon, 20 Mar 2023 19:36:02 +0800 Message-ID: <1CCF1B14C9842CED+002501d95b20$272f1b60$758d5220$@netitest.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: Adla2/m2oFOUykYESnWhnhHdvVELggAQ+sAw Content-Language: zh-cn X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:netitest.com:qybglogicsvr:qybglogicsvr5 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 Hi, The issue has been resolved when I patched new code from dpdk 22.12, my dpdk version is 19.11 static uint16_t @@ -213,7 +236,7 @@ } /* point at the next incoming frame */ - if (ppd->tp_status != TP_STATUS_AVAILABLE) { + if (!tx_ring_status_available(ppd->tp_status)) { if (poll(&pfd, 1, -1) < 0) break; @@ -236,7 +259,7 @@ * * This results in poll() returning POLLOUT. */ - if (ppd->tp_status != TP_STATUS_AVAILABLE) + if (!tx_ring_status_available(ppd->tp_status)) break; /* copy the tx frame data */ Thanks, Haifeng -----邮件原件----- 发件人: hfli@netitest.com 发送时间: 2023年3月20日 11:32 收件人: 'dev@dpdk.org' 主题: af_packet can't send packet more than framecnt Hi, I used af_packet interface, but found only can send packets successfully less than framecnt argument. E.g. if I pass “--vdev=eth_af_packet0,iface=tap0,blocksz=4096,framesz=2048, framecnt=512,qpairs=1,qdisc_bypass=0” to DPDK, the rte_eth_tx_burst only return 1 for 512 times, after that it always return 0. If I pass “--vdev=eth_af_packet0,iface=tap0,blocksz=4096,framesz=2048,framecnt=1024,q pairs=1,qdisc_bypass=0” to DPDK, the rte_eth_tx_burst only return 1 for 1024 times, after that it always return 0. BTW, I use busy loop mode in project, Is there any help for this? Thanks so much Haifeng Index: rte_eth_af_packet.c =================================================================== --- rte_eth_af_packet.c (版本 44115) +++ rte_eth_af_packet.c (版本 44128) @@ -169,6 +169,29 @@ } /* + * Check if there is an available frame in the ring + */ +static inline int +tx_ring_status_available(uint32_t tp_status) +{ + /* + * We eliminate the timestamp status from the packet status. + * This should only matter if timestamping is enabled on the socket, + * but there is a bug in the kernel which is fixed in newer releases. + * + * See the following kernel commit for reference: + * commit 171c3b151118a2fe0fc1e2a9d1b5a1570cfe82d2 + * net: packetmmap: fix only tx timestamp on request + */ + tp_status &= ~(TP_STATUS_TS_SOFTWARE | TP_STATUS_TS_RAW_HARDWARE); + + if (tp_status == TP_STATUS_AVAILABLE) + return 1; + + return 0; +} + +/* * Callback to handle sending packets through a real NIC. */