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 CEF9EA0524; Thu, 4 Feb 2021 18:02:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B8D4E240704; Thu, 4 Feb 2021 18:02:49 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id C4AC32406F3; Thu, 4 Feb 2021 18:02:47 +0100 (CET) IronPort-SDR: 7JsaLg0fACKb5jIcPQRzVpbopmtpWymGZlbuoepxg2MLwyggEgLZLak3RCBDwiLEtAy1iKQh62 lC274PBZAEjg== X-IronPort-AV: E=McAfee;i="6000,8403,9885"; a="178720708" X-IronPort-AV: E=Sophos;i="5.81,401,1610438400"; d="scan'208";a="178720708" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 09:02:46 -0800 IronPort-SDR: B9T8lzUuaiqpwYb3rSW5l+VILlWDTTLko6YqaX84+ujc+HeL11zGz/nh5fRDs00AGvfBl6F0h7 Qv7rGFm8XZSw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,401,1610438400"; d="scan'208";a="580349143" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga006.fm.intel.com with ESMTP; 04 Feb 2021 09:02:45 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 4 Feb 2021 09:02:45 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 4 Feb 2021 09:02:44 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Thu, 4 Feb 2021 09:02:44 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.170) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Thu, 4 Feb 2021 09:02:41 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nieHR+gZKc4VW9VJdtNaxqIBYxVUY4InC4XK0cvbLNAxQlMaWevCFqoXP04FfWtjuPUgHeHOiGdDbBzl+OUn4dQ9Y9a++toAOe4/a9VZH7ZHhJI2SM1Lw30jFekTCBKg69SNbj3bwD5NpLssyZCBDCr+2ZGXyQD2NrRgA6yrqkuPbCSDVWo4AFrmiVR7qLov9AlY+45F3+KHom4HQkvEeS1LfwjLZGe/D8g6TExdqs0M+lOjmGqHFhCePwmMoRdkv0fsAEeZd+0YBGuXoQrhS6w8mpPIJz2tS+1dDSjJcqouxn2wLB+utUoY1mcZY7MNzFnWHjuOmn1nCkl35PKH2Q== 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:X-MS-Exchange-SenderADCheck; bh=9Qputlvae9JhFl+Fs4le5g11sLaIj5p7NgNphrcN8cg=; b=TRhQDxn13sTxy5KAituLrBroL+v1mg9yDZBoQZpDInltPOyJV+sD0q+faxB416CM+865xiQ0vpswF1SlvHfM3rtVqpcuIn6/ck+QfeeUr+mbSrU/uoSxDkdTqf2BzUV7xp5hi3J0z6+RTt/VevuuoGOQ7dGIibaS5g4skkvVwa5nnQaU+3MTjFc2qaNOX4nXwtVCnlpQv6CNzMrPTmj4OlCmbiWMV6Ry6rZHe9NdViZBAk4F8ZOsjvHMbNgLvZTj0PtjdG/FEHEdWafJMo0KeuiB5k5PwhLke/RqBFKjxvhe6kDlY2TNsbCk/6OwnMkCYZf3jGzZyLRAaziXXOsQ4w== 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=9Qputlvae9JhFl+Fs4le5g11sLaIj5p7NgNphrcN8cg=; b=bfVbMTcuZeuY0widK1Gog3g2gO9l5411T1xWis6v/ucSqJooDHqlXarMS661F6BF9OvkZ4VMVJ2R2y1IrSaLqhAjzP2Xi1vC6bj++Dyhu1hDc/bePLG9NIj0lAt8FlFmanamvGtlG+Obma4WOw7Ix5kYJiEwHZf2xELSlYqXHOw= Received: from BYAPR11MB3751.namprd11.prod.outlook.com (2603:10b6:a03:f8::31) by BYAPR11MB2855.namprd11.prod.outlook.com (2603:10b6:a02:ca::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.24; Thu, 4 Feb 2021 17:02:33 +0000 Received: from BYAPR11MB3751.namprd11.prod.outlook.com ([fe80::31bb:895e:6e93:7e9d]) by BYAPR11MB3751.namprd11.prod.outlook.com ([fe80::31bb:895e:6e93:7e9d%7]) with mapi id 15.20.3805.026; Thu, 4 Feb 2021 17:02:33 +0000 From: "Ferriter, Cian" To: "Yigit, Ferruh" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH v2] net/pcap: fix infinite Rx with large files Thread-Index: AQHW+xX6t63nFJew6UKJOcPTPM7zDqpIOLLA Date: Thu, 4 Feb 2021 17:02:33 +0000 Message-ID: References: <20210203154920.2449179-1-ferruh.yigit@intel.com> <20210204165103.2355136-1-ferruh.yigit@intel.com> In-Reply-To: <20210204165103.2355136-1-ferruh.yigit@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [37.228.234.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 126d42c2-fefd-4e32-edf5-08d8c92eaa07 x-ms-traffictypediagnostic: BYAPR11MB2855: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2htyhmPbNeYQ33mGuwbOH4TNYCTMttQ4vz1yPYISItAtauQka/lXKCF3I4oa+SyMoZ4GWCOlYiRCkr93fm9IeWtxhygbBlglpyst9QS/aLmORUC1WRD5yGCHDieea/im1y/rb7660wi7EMyYfx/HCA3Ok4UT6PsAImTQggykUBkwFBuv6gnmCxNXD2LFwZkhkyYlvRRyZF8ctJitfxLQcSUfdanL4DHtfdtO6uSDCMX0KYu/iLbcItX5PM6Cyr5KaYS+kD5MNCrb1uZOcM2jyaRwFruWaaDK1UgVSP7+PiaOKhnjhbq7wP7ylvj64LPSkXMYBOGh28a94GOpjfeW49Da3FAJNNRto4EQubOsNM9WDUYYpn7QYLZcbUqX0iubLuXWx2LpUzQK5K7tZTZfkI5tCjfyISYXcyPMHHqdUGE+MMmSmO2c/IR8GY6uDe0ZtMV+Hxm7aXme+4ywCDWuhST3Hz/77I0kUYT+hC1ZDonPc8qfzLHc1LqVEcA8TrUyxWKq03017JoTgGcfcPEiYA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3751.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(39860400002)(136003)(396003)(376002)(366004)(6506007)(2906002)(54906003)(83380400001)(53546011)(8936002)(316002)(64756008)(66446008)(450100002)(478600001)(76116006)(186003)(66946007)(66476007)(8676002)(55016002)(6862004)(5660300002)(86362001)(9686003)(71200400001)(4326008)(66556008)(33656002)(7696005)(52536014)(26005)(6636002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?tRNVnDlziXa6/HxZ/zOPmKIE5HKNjGHkSI42OVPVXbUQzgVd6uoPEYTs/Fds?= =?us-ascii?Q?zlP4jjxLvwPaN0eA5IEz5BdKE3IlzJ/viFqZb/NfTiLjJ9NDY4VSliREOb+L?= =?us-ascii?Q?83wNuxnYuXzxEJI6BM/iBS/LuHn+IIGFu2ihvle5ZK3GrTS05ySFJQGpJaRx?= =?us-ascii?Q?xH9lgOQWTfyFc+tZO8T+Ob6JkoTvDhklyy19lwv6JFDwae4pzipQzUr1G6qf?= =?us-ascii?Q?yo0UzBchromXtsEHauts3zEQdtV5SaAl3WLhfkRLkkGIDjcbzUP0qTxqqJ/g?= =?us-ascii?Q?3uxp0aSc++1+s3WPJrcgUWXCFEfUA/IwHEZwNyG7ftmkWFLfSzo59x452xvR?= =?us-ascii?Q?2wIhxlub2vCdGkJavp42Fq8Qa6RAUVt+qVGsWS9duac++fIu1crgx3KadcRt?= =?us-ascii?Q?Q1jkpW3kSmonqjuaVBpat0xBIS5/FkrM/w+kPbEJcB079zQj1QqqBhHCq/VX?= =?us-ascii?Q?le4eNh9HN5k6qvrnaQmCXS6BFPzsJpM+B6Wwzmmpghz7TQQ24/4mQY1evEy7?= =?us-ascii?Q?T1ppwxZDu8msV/lThNgEP8IItb9y+dJrN8qtD8a4o4bUM5/CpuuCwNzJpXuj?= =?us-ascii?Q?N9/KoqGApkSOLcya4wmlYs/9o4/Ub2FRu6upvOClXLLxQp9sjhOU02X7qSDi?= =?us-ascii?Q?WFtsMFg5zbwnxBrmM9uzDE4QsnMRXbeH6fu7EDulzJeQYNIngChPLBZzHW8R?= =?us-ascii?Q?j6XneJg14NXbPwb/Q/2P/ojYebt5J0JENLQZISe93/FfAGxlxDOGv/GQRImB?= =?us-ascii?Q?fw9d0VP9l0BXa5r86iv7yTE0Gs77rxFv0xggcuVk1iOKqI/4eIWUFqW75xqp?= =?us-ascii?Q?oNIdGnOLAMJSUwI7JeII79OERgZNNRXDhczfNamyvucF4IZjhB4pMq0dBFsc?= =?us-ascii?Q?DlEr+jvzfyzhNJRa5oUaqQ5xHe7AhbWghBiUPMvXdVNU+iS3+cm7r9c+LnXL?= =?us-ascii?Q?Kcqljx6F2GI0Cq9EL+yeYkgMLbDKcNSM3RaajcoLplkvq3FwoV41A727R2Fh?= =?us-ascii?Q?nIsxDGPl1R0+F/GnUECBY+4D/X2RWVaBHdUSo5R7on/Ooyl9PRUjDz3eJImM?= =?us-ascii?Q?yNnJgL/H?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3751.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 126d42c2-fefd-4e32-edf5-08d8c92eaa07 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2021 17:02:33.0310 (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: NqNUgtzTjS2RuTML18JFNFpyVQiVY9k0aXYcizccCUfc2NZDVMhZ7la7fcw7F5OqkRpdY8hY0oibdRghAtDJ/Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2855 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] net/pcap: fix infinite Rx with large files 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 new error message looks great. As I've already given my ack, I'm happy for this to be applied. > -----Original Message----- > From: Yigit, Ferruh > Sent: Thursday 4 February 2021 16:51 > To: Ferriter, Cian > Cc: Yigit, Ferruh ; dev@dpdk.org; stable@dpdk.org > Subject: [PATCH v2] net/pcap: fix infinite Rx with large files >=20 > Packet forwarding is not working when infinite Rx feature is used with > large .pcap files that has high number of packets. >=20 > The problem is number of allocated mbufs are less than the infinite Rx > ring size, and all mbufs consumed to fill the ring, so there is no mbuf > left for forwarding. >=20 > Current logic can not detect that infinite Rx ring is not filled > completely and no more mbufs left, and setup continues which leads > silent fail on packet forwarding. >=20 > There isn't much can be done when there is not enough mbuf for the given > .pcap file, so additional checks added to detect the case and fail > explicitly with an error log. >=20 > Bugzilla ID: 595 > Fixes: a3f5252e5cbd ("net/pcap: enable infinitely Rx a pcap file") > Cc: stable@dpdk.org >=20 > Reported-by: Cian Ferriter > Signed-off-by: Ferruh Yigit > Acked-by: Cian Ferriter > --- > v2: > * Updated log message > --- > drivers/net/pcap/rte_eth_pcap.c | 40 ++++++++++++++++++++------------- > 1 file changed, 25 insertions(+), 15 deletions(-) >=20 > diff --git a/drivers/net/pcap/rte_eth_pcap.c > b/drivers/net/pcap/rte_eth_pcap.c > index c7751b7ba742..90f5d75ea87f 100644 > --- a/drivers/net/pcap/rte_eth_pcap.c > +++ b/drivers/net/pcap/rte_eth_pcap.c > @@ -735,6 +735,17 @@ eth_stats_reset(struct rte_eth_dev *dev) > return 0; > } >=20 > +static inline void > +infinite_rx_ring_free(struct rte_ring *pkts) > +{ > + struct rte_mbuf *bufs; > + > + while (!rte_ring_dequeue(pkts, (void **)&bufs)) > + rte_pktmbuf_free(bufs); > + > + rte_ring_free(pkts); > +} > + > static int > eth_dev_close(struct rte_eth_dev *dev) > { > @@ -753,7 +764,6 @@ eth_dev_close(struct rte_eth_dev *dev) > if (internals->infinite_rx) { > for (i =3D 0; i < dev->data->nb_rx_queues; i++) { > struct pcap_rx_queue *pcap_q =3D &internals- > >rx_queue[i]; > - struct rte_mbuf *pcap_buf; >=20 > /* > * 'pcap_q->pkts' can be NULL if 'eth_dev_close()' > @@ -762,11 +772,7 @@ eth_dev_close(struct rte_eth_dev *dev) > if (pcap_q->pkts =3D=3D NULL) > continue; >=20 > - while (!rte_ring_dequeue(pcap_q->pkts, > - (void **)&pcap_buf)) > - rte_pktmbuf_free(pcap_buf); > - > - rte_ring_free(pcap_q->pkts); > + infinite_rx_ring_free(pcap_q->pkts); > } > } >=20 > @@ -835,21 +841,25 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, > while (eth_pcap_rx(pcap_q, bufs, 1)) { > /* Check for multiseg mbufs. */ > if (bufs[0]->nb_segs !=3D 1) { > - rte_pktmbuf_free(*bufs); > - > - while (!rte_ring_dequeue(pcap_q->pkts, > - (void **)bufs)) > - rte_pktmbuf_free(*bufs); > - > - rte_ring_free(pcap_q->pkts); > - PMD_LOG(ERR, "Multiseg mbufs are not > supported in infinite_rx " > - "mode."); > + infinite_rx_ring_free(pcap_q->pkts); > + PMD_LOG(ERR, > + "Multiseg mbufs are not supported in > infinite_rx mode."); > return -EINVAL; > } >=20 > rte_ring_enqueue_bulk(pcap_q->pkts, > (void * const *)bufs, 1, NULL); > } > + > + if (rte_ring_count(pcap_q->pkts) < pcap_pkt_count) { > + infinite_rx_ring_free(pcap_q->pkts); > + PMD_LOG(ERR, > + "Not enough mbufs to accommodate packets > in pcap file. " > + "At least %" PRIu64 " mbufs per queue is > required.", > + pcap_pkt_count); > + return -EINVAL; > + } > + > /* > * Reset the stats for this queue since eth_pcap_rx calls > above > * didn't result in the application receiving packets. > -- > 2.29.2