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 A07FCA0C46; Mon, 20 Sep 2021 19:44:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5669D40DF7; Mon, 20 Sep 2021 19:44:29 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 8432F40DF5 for ; Mon, 20 Sep 2021 19:44:27 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10113"; a="222838083" X-IronPort-AV: E=Sophos;i="5.85,309,1624345200"; d="scan'208";a="222838083" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2021 10:44:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,309,1624345200"; d="scan'208";a="517932310" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga001.jf.intel.com with ESMTP; 20 Sep 2021 10:44:26 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 20 Sep 2021 10:44:25 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Mon, 20 Sep 2021 10:44:25 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.169) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Mon, 20 Sep 2021 10:44:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KD1Ski1PGVUsXKoAxEzKGuJdtYcd4BbJQGoMSiCGhs5HH/4/IuwA3uaVQASC0BYOrbV33cAwurkeEnCyZc7bigwWawkysJDTiGWWwj7mhh5uLpp0IKSa5KR8IBYwuK58B2P4/VndO8mUmIIeayogMIf48R5ZNL/YYzhledL/C9nvFy2ju5M4f1W5SOIz0qJb0nigU1kdMv3H9BFQK0S46Vc/7C/ehLHVUJCxHfZwPpKTlk02CmneaGEpm1xZovTzsHYvc2AHKE1alXaFOX142YEV01/Nem+FzikkgFx5K0Bvi7KwAzx6Tow1NWzjRTP9Rw0p3ZlPyB2YhdHiRfal/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Y+J6KHB3YL0JW4t5YAahbLE4Mosqaolmi2kxAQaO8EU=; b=ea894BhgratCvGXD4lbBcYoFs8QjSCii6TdnQS5f3ZMhUp1A7Ka+3D6+hGR+N6IX0BMriL0WQEq+uRMbAGgBpcSnd+8IhJ/n2Pbu53ayDBs+1DZygxXIf53oWYTZmwFD05Iqhg4J8+EO6or6sWzCvi8++z6NKDLk+BoJxL97eowmnjLtd6HbhYH4Q0eZ7Z5uus+0BCnHMKOUylvxfS+vfnvthl1cfhmtBlbRIvRk5KAHTQJS9pqfGJOEuIX3vUib4FNCARTVG+mCh0+2HBN1N2EJUj294C88wN5DeCb/jogyTUlBKgEzedNjPQph/MtOk6khCk0UkmiQChnjZNRYHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y+J6KHB3YL0JW4t5YAahbLE4Mosqaolmi2kxAQaO8EU=; b=RfnP9496/b9KQXPzSbc2gYHZ78PmmunJWbsmHdRW10I48YWgphD0VTqO7nsG6G12WSVapbHKOKpL6Ic/Ah3NN5XnPC73W/ssRnBD2W8W7kPb5O9Zrfwy1qh5CGvCZDYJJcWis0cJUwrOhaMVkHNLVIPos92TKQbeKoEPNEXlSXw= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB4966.namprd11.prod.outlook.com (2603:10b6:510:42::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Mon, 20 Sep 2021 17:44:24 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::747b:3a08:d1ec:31fc]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::747b:3a08:d1ec:31fc%5]) with mapi id 15.20.4523.018; Mon, 20 Sep 2021 17:44:24 +0000 To: Tudor Cornea CC: , , , References: <1629466761-127333-1-git-send-email-tudor.cornea@gmail.com> <1631540746-38443-1-git-send-email-tudor.cornea@gmail.com> From: Ferruh Yigit X-User: ferruhy Message-ID: <9ec3e2cb-412a-a48b-2567-7e5ad6b1153f@intel.com> Date: Mon, 20 Sep 2021 18:44:18 +0100 In-Reply-To: <1631540746-38443-1-git-send-email-tudor.cornea@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DB6PR07CA0102.eurprd07.prod.outlook.com (2603:10a6:6:2c::16) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 Received: from [192.168.0.206] (37.228.236.146) by DB6PR07CA0102.eurprd07.prod.outlook.com (2603:10a6:6:2c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Mon, 20 Sep 2021 17:44:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a9e470c4-a3e8-4f43-c04d-08d97c5e48fb X-MS-TrafficTypeDiagnostic: PH0PR11MB4966: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uOoIyaKH4Awjj1gmFu28GrREnCvsQ6c4yT1/x60GAYiGxPfA7DDctVSu3b2mCMKK7+acFjc+yDTOo2qX107OteFQSymwDc+IrCF8kPkTmFoy9ADr3XjIbgX5thK7f/7C9o3aH1LdIdmZZIgiZzt6+BQTt2ZfCyGWmGg+MxMFneVRhzxnhdSBp2NW4CnD1M580YVuKymx9Am9CyaaGv6s+Uc3zFHCjRFYdDT9IozqoEzORUh5ugUEWe6ZytwsrEeI0yWoqMSpIX+QOEaIdOsgrn0z58auaaUqBIFOOlVsIE7CgQL4nAzOtjirOW7XWGWy2jeYD//IwoSboahrKifGCzKVPVpWQW6pOzBgwtgCYx39HkLXdL/DYN6ym14UNUBdN4GnBvo5B75KjMJ7FOeqlDowy+Dix6ZAk83s7HRrXkf7AtnzeU4iohVB/pFt+2tHq+OpZlyeG5dGWWzhyOIEpt3aPyFSf0kUdImDzhxKD8xMUYC7QNbvukXGuobgu8v5sFhQE5rKoOmHvYzHIhIjMbMWLw6VxAmfbq33VZ4acOgfVtU6HIk7KrSx+8xcYlGgvXoYWJjMOaXttKjnieHVEh0V0BksIxVBXhS2FdVlNHIHAI+ZPpGCrL0CuJDbEEtv5iFduNyrExLGwnKngk1a8PySgCfr3ke43qSai5aKzkIbfGpcRbFRkf2WVaPn+YoCWiZbC6mL5admSNWWHBDPOw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(396003)(136003)(39860400002)(376002)(31686004)(4326008)(36756003)(6916009)(38100700002)(53546011)(44832011)(83380400001)(66476007)(66556008)(66946007)(31696002)(8676002)(2906002)(86362001)(26005)(8936002)(478600001)(186003)(16576012)(956004)(316002)(5660300002)(6486002)(2616005)(6666004)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YzBNN1dTdDdhdU5RZzhMd2dIVGt6andwQTZTR3A1TTJTTFhLaERrZGNJWG1w?= =?utf-8?B?S0NiRllBYzdWOU5aaGVQSkprV3ptV21VZGFNWDVqeUQ1dzJUSGI2TmE4YmVt?= =?utf-8?B?NVJ0R3FyV2lSTXpyNkRWcE5CeCs3MlhrTkNiNHAzZnJ0ZVdTR2ZxMUc2Q3lC?= =?utf-8?B?MWg4K1BIOEF1T0RPM2YzM0dSWnlZNVdWOEdtUld4a01yVW1Ta3hhSjZEMEdO?= =?utf-8?B?WE1DT2I0cS9oUlBVdS9CUU0yTE9jRFFucm56dkJOVkZyckY3bzJyMDViYVRP?= =?utf-8?B?b2REQy8ySlk1emsyMVRVVFBiV3BFTGZ0dUIweEhOUWZTQk4rTzdxb3RjQ2VC?= =?utf-8?B?Nm1RTGdrV21oRDcrcVhlSHFOZmpUdE8rOGo2Wk00Y0hsandHdDdFMEFkbUUx?= =?utf-8?B?NVRweDRER1YzeEZLNHlqb0pvYjdjZk9XbFJoclhFVC9EcU9pb3prMHJTLzRF?= =?utf-8?B?ck45SThmSTV3TFFuUXdVeWJtMW4vL3BSOEg1d01FbkdlYTcwR0syMzNhamdm?= =?utf-8?B?cU9JV0xuSnB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f-8?B?QytxbXBHUWw2clptZGl0OFptTHBQcytQNzNhKzN6RjFheVNlejJtZ2FydVV5?= =?utf-8?B?d3NxTmJTR1dQYThBSUpPd0VCZVh3VE54Wkhwejl4NlREYitCNllDcHJTZlo5?= =?utf-8?B?aEl5K2xrbjRHUzhGUlRxU1BhMmtuQnNJWjhEN0doSVlzWUk0K3Y0SmRacmpJ?= =?utf-8?B?WVZubHI0Y1UvN0MxQTl1MS9pMlAwaU14eHBpNnZVZWUwSTR4ODBVR2l3Wm8w?= =?utf-8?B?bVl4Z1hNWGczbFkwS0RNQnJJTW45aXZrY2oxVjcwdTZLQUg4aTh4eVBxRk5B?= =?utf-8?Q?3eJF5aOMmsX6EK93oA1jn48yMWKXW67+1JnRBop?= X-MS-Exchange-CrossTenant-Network-Message-Id: a9e470c4-a3e8-4f43-c04d-08d97c5e48fb X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2021 17:44:24.4048 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gVLlQX/7oYTlk5GRgflbMylbwLyhsKefweuotbR9h+oM9hbpy8O2jEpAmlH6hpCFOuBDfMyD4TH3lk/xqJ9ATQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4966 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] 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" On 9/13/2021 2:45 PM, Tudor Cornea wrote: > 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. > > Signed-off-by: Mihai Pogonaru > Signed-off-by: Tudor Cornea > --- > drivers/net/af_packet/rte_eth_af_packet.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c > index b73b211..087c196 100644 > --- a/drivers/net/af_packet/rte_eth_af_packet.c > +++ b/drivers/net/af_packet/rte_eth_af_packet.c > @@ -216,6 +216,25 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) > (poll(&pfd, 1, -1) < 0)) > break; > > + /* > + * Poll can return POLLERR if the interface is down > + * > + * It 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; > + If 'POLLOUT' doesn't indicate that there is space in the buffer, what is the point of the 'poll()' at all? What can we test/reproduce the mentioned behavior? Or is there a way to fix the behavior of poll() or use an alternative of it? OK to break on the 'POLLERR', I guess it can be detected in the 'pfd.revent'. > /* copy the tx frame data */ > pbuf = (uint8_t *) ppd + TPACKET2_HDRLEN - > sizeof(struct sockaddr_ll); >