Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1936299pxj; Sat, 5 Jun 2021 07:29:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm28SCylVRvWZm1czVmaVnv2G2H2+4A50F/ZbyqR7zuE7caMBIWWNnB4yj7dSYBqnn4Yfe X-Received: by 2002:a05:6402:1705:: with SMTP id y5mr10479025edu.232.1622903395610; Sat, 05 Jun 2021 07:29:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622903395; cv=none; d=google.com; s=arc-20160816; b=Q0EDdW35j4LZDYsC6n8y+oNAKPKRoUXxP7POCpqNUxAw6jKy3H6b391oT1kKjhiMVy CWO35fGtHS9oU/M3o+L27/9rMO/o3Mlt6pQo2hwNFR34pITIbVC/HihsXgbTnJmL+rji eJJjKzq7CJz/eLjdcjeC6WoKPUFNRP6A3j+OlMpQ0JvZo3k1Tc8IMQDfrthh3qVeFu8B DNp2IxG7Q0j9pA7tdv6ZJMKOBbDzgwdfyYZmwCfoISo+dDKcrgLMUDe0+hbz8W6/QLsi CFi+fomF5M50U/kv9r62Knxom0bJZPI1nx5dqbAkO8qn7Eh+JNegz7oXXu/2z2578VGq AbNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=vKpVQsFxlUjGbbInkX9CTrcAmJCiKIsDRxv633gSOQ8=; b=SPZUlphV/UMVZd58EyBRBPfcdwy0xaJjpIHbsC6g+7LKMHKXTfNhbUwpwt7FpEKoJI Lyl6JLJ1IluNc2qVwXxzvlaOu2zu8Ux5EJQ5+g375ZoMFHusKczAIR86G7+SH6Lfp12M vCJt5Stu9f89pmqCL4Y4VdIv98z/m3GttIzcZjHPb4yJzSZn5X/E22hq033QGTAiXQYV Mlu1tGf7On5D1f6g3pKvZ0CO10SrJGbm8ND/CzP9apjK2taQShaJeuTr8gAXs0dWDi6X 9nL6eycAQTfD3UJuCI7YV2eRZmSq4B1J0UxkH4palMLaVFbofOhORmoturraQNGMyAl9 AVJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YrZyWBSQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq9si7249179ejb.720.2021.06.05.07.29.32; Sat, 05 Jun 2021 07:29:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YrZyWBSQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbhFEO1r (ORCPT + 99 others); Sat, 5 Jun 2021 10:27:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52845 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229957AbhFEO1q (ORCPT ); Sat, 5 Jun 2021 10:27:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622903158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vKpVQsFxlUjGbbInkX9CTrcAmJCiKIsDRxv633gSOQ8=; b=YrZyWBSQIR1ZAi3LSwcBwoGKV6mgz2qhlX7gq1dn1tfumXnmGDW0eyX2pfQFSgeE9dfuBN eYK3wWSEXlr2a+kLIxMDGMbC5nwaOB3+Ms3jmIvUc8TerhyoBHQYEjn13y2QwN4wxA6iNs qhFaYOocX1MsECb/JOYaJihAfDJQRuw= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-417-icJeaGOcOtentVPDQo23ig-1; Sat, 05 Jun 2021 10:25:56 -0400 X-MC-Unique: icJeaGOcOtentVPDQo23ig-1 Received: by mail-qv1-f69.google.com with SMTP id n17-20020ad444b10000b02902157677ec50so8936968qvt.12 for ; Sat, 05 Jun 2021 07:25:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=vKpVQsFxlUjGbbInkX9CTrcAmJCiKIsDRxv633gSOQ8=; b=l0u6IgP2L/H4kQixJBJKV1ywMibd70kpIUXMyB8WooVkFtmlgVRgPin68fizMqyh9O rTEQU5gRkJ4ImvtZ8AOah/Zl23x6WjF3fPi58Bowlf5jR7lbjazalpoM/UWGI6iny6RY oPlqY97wI2gi0b3c5f54LaTJe2xTHgjcWl/N+2SBXDezuCF6u3EfkHdqUhmfZe5Au2Xz HhH4i7kTGk6j07PGhuC1jUQ78rFOA+/z3HNRGledog5vEmupRzvNWbXb5+dm0Tm34r25 h27Liv/fDB+pY6yS73cPigZT7rk1hZQfhanu0nNzmxVbnnrNbPwTel3BDNZl24iNhpOF Zl1Q== X-Gm-Message-State: AOAM533EV3LdOE++Sx6AqQJGaBltcd7TWFzx/AEDJzmprzgSy9Q4yawW 6sndeUCkC5x5KaX0LN9SlpEybc8a9NH3Bzbvd2dNkZk7XgzGSCiQcrIFFfW7cEnGPMMLUhikm/t KSw8Qx+gG60c5brRixL9KwVGj X-Received: by 2002:a37:a682:: with SMTP id p124mr9166583qke.23.1622903155838; Sat, 05 Jun 2021 07:25:55 -0700 (PDT) X-Received: by 2002:a37:a682:: with SMTP id p124mr9166558qke.23.1622903155528; Sat, 05 Jun 2021 07:25:55 -0700 (PDT) Received: from [192.168.0.106] ([24.225.235.43]) by smtp.gmail.com with ESMTPSA id 137sm5174039qko.29.2021.06.05.07.25.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 05 Jun 2021 07:25:55 -0700 (PDT) Subject: Re: [PATCH net-next] net: tipc: fix FB_MTU eat two pages To: Menglong Dong Cc: ying.xue@windriver.com, David Miller , Jakub Kicinski , LKML , netdev , tipc-discussion@lists.sourceforge.net, Menglong Dong , Zeal Robot References: <20210604074419.53956-1-dong.menglong@zte.com.cn> From: Jon Maloy Message-ID: <998cce2c-b18d-59c1-df64-fc62856c63a1@redhat.com> Date: Sat, 5 Jun 2021 10:25:53 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/4/21 9:28 PM, Menglong Dong wrote: > Hello Maloy, > > On Sat, Jun 5, 2021 at 3:20 AM Jon Maloy wrote: >> > [...] >> Please don't add any extra file just for this little fix. We have enough >> files. >> Keep the macros in msg.h/c where they used to be. You can still add >> your copyright line to those files. >> Regarding the macros kept inside msg.c, they are there because we design >> by the principle of minimal exposure, even among our module internal files. >> Otherwise it is ok. >> > I don't want to add a new file too, but I found it's hard to define FB_MTU. I > tried to define it in msg.h, and 'crypto.h' should be included, which > 'BUF_HEADROOM' is defined in. However, 'msg.h' is already included in > 'crypto.h', so it doesn't work. > > I tried to define FB_MTU in 'crypto.h', but it feels weird to define > it here. And > FB_MTU is also used in 'bcast.c', so it can't be defined in 'msg.c'. > > I will see if there is a better solution. I think we can leverage the fact that this by definition is a node local message, and those are never encrypted. So, if you base FB_MTU on the non-crypto versions of BUF_HEADROOM and BUF_TAILROOM we should be safe. That will even give us better utilization of the space available. ///jon > > Thanks! > Menglong Dong > >>> @@ -0,0 +1,55 @@ >>> +/* SPDX-License-Identifier: GPL-2.0-only */ >>> +/* >>> + * Copyright 2021 ZTE Corporation. >>> + * All rights reserved. >>> + * >>> + * Redistribution and use in source and binary forms, with or without >>> + * modification, are permitted provided that the following conditions are met: >>> + * >>> + * 1. Redistributions of source code must retain the above copyright >>> + * notice, this list of conditions and the following disclaimer. >>> + * 2. Redistributions in binary form must reproduce the above copyright >>> + * notice, this list of conditions and the following disclaimer in the >>> + * documentation and/or other materials provided with the distribution. >>> + * 3. Neither the names of the copyright holders nor the names of its >>> + * contributors may be used to endorse or promote products derived from >>> + * this software without specific prior written permission. >>> + * >>> + * Alternatively, this software may be distributed under the terms of the >>> + * GNU General Public License ("GPL") version 2 as published by the Free >>> + * Software Foundation. >>> + * >>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" >>> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE >>> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >>> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >>> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE >>> + * POSSIBILITY OF SUCH DAMAGE. >>> + */ >>> + >>> +#ifndef _TIPC_MTU_H >>> +#define _TIPC_MTU_H >>> + >>> +#include >>> +#include "crypto.h" >>> + >>> +#ifdef CONFIG_TIPC_CRYPTO >>> +#define BUF_HEADROOM ALIGN(((LL_MAX_HEADER + 48) + EHDR_MAX_SIZE), 16) >>> +#define BUF_TAILROOM (TIPC_AES_GCM_TAG_SIZE) >>> +#define FB_MTU (PAGE_SIZE - \ >>> + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) - \ >>> + SKB_DATA_ALIGN(BUF_HEADROOM + BUF_TAILROOM + 3)) >>> +#else >>> +#define BUF_HEADROOM (LL_MAX_HEADER + 48) >>> +#define BUF_TAILROOM 16 >>> +#define FB_MTU (PAGE_SIZE - \ >>> + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) - \ >>> + SKB_DATA_ALIGN(BUF_HEADROOM + 3)) >>> +#endif >>> + >>> +#endif