From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0051.outbound.protection.outlook.com [104.47.2.51]) by dpdk.org (Postfix) with ESMTP id 5C5711B5E5; Thu, 9 Nov 2017 23:31:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=9OKKUSweNfo00CZs8KaVFtSmjmAzw9U9bUPjv9bSJ38=; b=gqAq/chKNN8DhOO7A1AmtpGrEuVwOMKZAsvCbbPKa0K3eOYGaLhDsFfE1g2yxl4TJjJ/2Pi4LcH5c/BDE1pCd+qcGN+EpZ7DHx3dGtygIY4GcYZHVAyux/T1k1LZ4ywFSwqt+5hLxkf9OKBe1U6HCH8lQz0uA3GX7VF82ifcPHw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from yongseok-MBP.local (209.116.155.178) by HE1PR0501MB2043.eurprd05.prod.outlook.com (2603:10a6:3:35::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Thu, 9 Nov 2017 22:31:02 +0000 Date: Thu, 9 Nov 2017 14:30:30 -0800 From: Yongseok Koh To: Ori Kam Cc: adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com, dev@dpdk.org, stable@dpdk.org Message-ID: <20171109223029.GA3599@yongseok-MBP.local> References: <1510243472-24872-1-git-send-email-orika@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1510243472-24872-1-git-send-email-orika@mellanox.com> User-Agent: Mutt/1.7.2 (2016-11-26) X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: CY4PR1201CA0018.namprd12.prod.outlook.com (2603:10b6:910:16::28) To HE1PR0501MB2043.eurprd05.prod.outlook.com (2603:10a6:3:35::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9f6fa8ee-6bd7-4bd4-4599-08d527c18fb4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603253); SRVR:HE1PR0501MB2043; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 3:72QVb69ufrFqxui/p4WmFZheOurKvz5WnBhKMc0pxI6yluJFhuOOhnP0CQA6JrSXeVABz4jQt+rY5anOsb/4Yvv3i1h6dfkVb5LlFEVlaJ5n9jpvnidJaNGFjUOgr2v2wqOnv1xdCrPJXLQ9UDxzaHeMMgCxiNz5cJ4V9V1UxPTLmB32Ls8irGQyrKxQzXr4Yvmsb3HrlnJHixO0u5xNGuOPl9578NWFmwwxq4rwL8P3XW9s+x/PQdamedNQmMSs; 25:9+0/r5wcClueEEPhQrlI7cVYjs7Kf1obziyDwcbdXVKklIOHQ4wL4KVkR+k0FThBmw2hr8KSY+zAgIZeV90sjCePNi3g3E/zYTzTSJZaZYM1W4BjezxfwBl1iaAvaTaEx72ZkSehS5ZyvXQF+gvfjb0ukke4vvUTJjZkwbRL3t9nGMbhqbAKDyqlKZoAQT4AYzGGnCIQ1AkFk5JYA3+eUvNpiOTDcw6N3R3Nd25X26DOGDG5Fpq9eKvSZJznl3F2vNae5odcifQA8XBCyqySTXs799jLEst7ya1ycuiqP6Es14lqXdrFF8mvGsNppAmbLS5jEwRai+GGGD59wes0GA==; 31:ZYppWvR0pmigAtZSg8aUXJZGbX1ia0LDJhrBQ94XP6m+jzqSFtQGZ0cqcDur84DSNZx3RGoSLXm+ituGxKOemiTi2nFiXrFbqfupU5Y6bMhiLeOklUTzEcOX2UlPcrYnitl5hA00zSpMznunFIFlsbXSuYsR6UdnNHVJ7rCtXUryrZUr8atQGlXka+dv1RfuisMgSQA36BnehHhjyy3wETudgGZsNeQWZYYwPqppils= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2043: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2043; 20:r1saXH2KrjKpd53qHOV4W2BavJbpJ6fCS+WPTxZT8G030uHRKDriOTCkX+Ff+AVI2J3ikBZ2XTXE15LpRGbNzUH5zkzcxKQvPf3PLldihsmtqdiBkGyoaJrbhrly2guuIXD6PKaMi7svkPxJbMGgXGNz99T7r/onuq1cht8xPk90af4Ch1y8BHLvL323T4GoLpbAoh2eLsUPKR/QZMF5/5i/lCJKCzLwtb2gEc3EU7kfZE5aYS9PBmwT/i5jLSYr8CWx0lYKJrvQTSaE74pTQTv0pD9EeOwbIH/uvSiO3EWs65gmWduftIldLyMe9+UAhZ3ZYvRN68tCaJcIa0QT4WzEMspSMrn9bX/g7uSgY5YsOFify/mFbTvzhjs67m6/fR0abBq1Fjt2TlPlrcEdTrUZGJBs33GXTkDJmE692y5Io8O4RGjqv6AH4ThVB3iJrZOX5zQjFqigbq956X8kgrG/4mRGCg+1lSEj9FGMSg8hWuUHFqlbC7NaFnXvnz4e; 4:hiJ8+2oI12PaPcPxHE+eyCoptNlk8/aTTOrOFwJDUfrrVQVaa66s4Fi5guN2n0xs/5gHBZYjr2BTEmnrpG2sNOD1X6s+MC53Viq7wYqn9ZAz9ad1voJyF0CrTE0s/Q3EgZyV/Z8gsswpIhw/sq4jvH5AVFcVrZBxRLigdG5BnpdR/6GhG2e3c5ZgoXYv0SAoqrv/CuuCVoVIjYdOFOmxLsj5g9Ty8tPDBrep+0xuQHQfrfsCNPwa0D2SsntA1iScwsz10X4rZ9rxgfPgMLRJsw== X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(3231021)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR0501MB2043; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR0501MB2043; X-Forefront-PRVS: 0486A0CB86 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(376002)(199003)(24454002)(189002)(5660300001)(83506002)(101416001)(8936002)(229853002)(50466002)(23726003)(3846002)(53936002)(2950100002)(6666003)(6636002)(9686003)(6862004)(76176999)(55016002)(98436002)(6506006)(66066001)(47776003)(6246003)(50986999)(6116002)(4326008)(54356999)(58126008)(1076002)(16526018)(86362001)(33656002)(81156014)(68736007)(106356001)(81166006)(105586002)(25786009)(2906002)(97736004)(7736002)(16586007)(8676002)(305945005)(189998001)(316002)(478600001)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2043; H:yongseok-MBP.local; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2043; 23:WKNTzUADmXWBQpoqnbdIo5ROWVhzEY1OvVzDPi2?= =?us-ascii?Q?U+rJHqAhbRm6uasgmN/nDk4cCj9FCaDRJ0w6cad1FHzvaBVfnKn2ObJH5R/a?= =?us-ascii?Q?HDLhuu6yXZ/pYKKJkoIV1RtYjrnf5dheZBGv4J97gDYGcGDlIiQ4t0v/XYQO?= =?us-ascii?Q?y3h/NHWD00FAUksL/DCZqDDFgPHTUgye5vW0Y31nqb5ngLK4Pcu3hkqojJtj?= =?us-ascii?Q?EesfGUlEldq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BZM/TGMqqKzFeMGpIck7WovqSQYyMql1Bm4jCKsuAW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2017 22:31:02.2951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f6fa8ee-6bd7-4bd4-4599-08d527c18fb4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2043 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix number of segment calculation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 22:31:05 -0000 On Thu, Nov 09, 2017 at 06:04:32PM +0200, Ori Kam wrote: > The CRC size should be taken into consideration when computing > the number of mbuf segments for packet on the receive path. > Large packets can be dropped due to extra CRC length. > > Fixes: a1366b1a2be3 ("net/mlx5: add reference counter on DPDK Rx queues") > Cc: stable@dpdk.org > Cc: nelio.laranjeiro@6wind.com > > Signed-off-by: Ori Kam > --- > drivers/net/mlx5/mlx5_rxq.c | 7 +++++-- > 1 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > index 6b29aae..701925b 100644 > --- a/drivers/net/mlx5/mlx5_rxq.c > +++ b/drivers/net/mlx5/mlx5_rxq.c > @@ -887,6 +887,8 @@ struct mlx5_rxq_ctrl* > const uint16_t desc_n = > desc + priv->rx_vec_en * MLX5_VPMD_DESCS_PER_LOOP; > unsigned int mb_len = rte_pktmbuf_data_room_size(mp); > + uint8_t crc_size = > + !!(dev->data->dev_conf.rxmode.hw_strip_crc == 0) << 2; How about making it more explicit with ETHER_CRC_LEN? E.g. uint8_t crc_size = ETHER_CRC_LEN * (dev->data->dev_conf.rxmode.hw_strip_crc == 0); > > tmpl = rte_calloc_socket("RXQ", 1, > sizeof(*tmpl) + > @@ -900,12 +902,13 @@ struct mlx5_rxq_ctrl* > /* Enable scattered packets support for this queue if necessary. */ > assert(mb_len >= RTE_PKTMBUF_HEADROOM); You might want to make the same change for this assert? > if (dev->data->dev_conf.rxmode.max_rx_pkt_len <= > - (mb_len - RTE_PKTMBUF_HEADROOM)) { > + (mb_len - RTE_PKTMBUF_HEADROOM - crc_size)) { > tmpl->rxq.sges_n = 0; > } else if (dev->data->dev_conf.rxmode.enable_scatter) { > unsigned int size = > RTE_PKTMBUF_HEADROOM + > - dev->data->dev_conf.rxmode.max_rx_pkt_len; > + dev->data->dev_conf.rxmode.max_rx_pkt_len + > + crc_size; I think there's another bugs we didn't know. If scatter is required, RTE_PKTMBUF_HEADROOM is also reserved per every chained mbufs. So, it looks like mb_len should be "rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM" when it is declared in the beginning. Make sense? > /* > * Determine the number of SGEs needed for a full packet > * and round it to the next power of two. > */ > sges_n = log2above((size / mb_len) + !!(size % mb_len)); > tmpl->rxq.sges_n = sges_n; rxq.sges_n is 2bits, which means the max value is 3. So, if sges_n is larger than 3, it would just take the last 2bits and it will result in false error below. As we can't use sizeof() for bit-fields, this should be changed like: /* Check the maximum value of the bit-field. */ tmpl->rxq.sges_n = -1; tmpl->rxq.sges_n = RTE_MIN(tmpl->rxq.sges_n, sges_n); > /* Make sure rxq.sges_n did not overflow. */ > size = mb_len * (1 << tmpl->rxq.sges_n); > size -= RTE_PKTMBUF_HEADROOM; > if (size < dev->data->dev_conf.rxmode.max_rx_pkt_len) { > ERROR("%p: too many SGEs (%u) needed to handle" > " requested maximum packet size %u", > (void *)dev, > 1 << sges_n, > dev->data->dev_conf.rxmode.max_rx_pkt_len); > goto error; > } This may be unnecessary if we make right changes? Thanks, Yongseok