From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BF20C433E0 for ; Thu, 24 Dec 2020 16:00:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63EB22246B for ; Thu, 24 Dec 2020 16:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728666AbgLXP5j (ORCPT ); Thu, 24 Dec 2020 10:57:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728266AbgLXP5i (ORCPT ); Thu, 24 Dec 2020 10:57:38 -0500 Received: from mail-ua1-x935.google.com (mail-ua1-x935.google.com [IPv6:2607:f8b0:4864:20::935]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29E8AC061573 for ; Thu, 24 Dec 2020 07:56:58 -0800 (PST) Received: by mail-ua1-x935.google.com with SMTP id w7so780067uap.13 for ; Thu, 24 Dec 2020 07:56:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XRYO0lFUVOrah75uQXi2tgidobUUXCXbkVzNcCSUK7Y=; b=vD+85mxRjBfgH/Sr9fNWdZGEZkGCHFeLsjU3Ur+c3zJ5wpb8lGtmkFUlNYttDgBl3q pA+Xr1MSgCOJD31ItdxXMEyce5g0ByZJ9cV5+yoh1TlZ15r9KptXP5AmQAA5IDLtQhSo ufPxBCA+vBcRbjE/l97R4uobG1CxRofdyDygsn0r4YzTJg8fHwRFCRGXpRcV5HWb4UPy 822ceXGoh7xsp9/ALp7vqguO5tHDyI9vzdm+X9EY4dOxT5LvNdfSw1BnYqGU9VZB5pot qJt/EEOUvT0cHl2EwwDJ6Hu7uMhSyi+zlsutqz9l1oa6vxvhfH+qb8i8zb7TkPf/dwEh 7QGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XRYO0lFUVOrah75uQXi2tgidobUUXCXbkVzNcCSUK7Y=; b=XZT/IdY4sMZOgVaw5eBx3Ejiiy2j9FV1Fov1RA9bn+B+8rBLjNdMRGyBjItqngZbwx O0Kz0dvZ5l1BZlK1JMMw84VSzMy2lEQ8E4jTy84yhQXLvlyht0FH3JBewf4oiPQ845LL Ie+VMN7aprJGi4FUCTldCo+UrtUgl4hjBlx0tYbZ3206aN0ETH6edaUuARBAuCcMOPEM nSrK0Pto9iLCipAZ/ZN2nnymIL5qgbRhf304KZodxeMWf8fDQO5wHrs+duF3dmn+Nouf A0KPX7GhYN1pyP/OpUKzzFOtD0qB1V7Q1Lj475fegeKHQZEz/TDZbKdTADl7Ju245Twk 237Q== X-Gm-Message-State: AOAM532Hzbsto0LpZqHWzhW7GglZLl3raYmAPfT9ltkJpqzmrFlwhEzz ccboGOT4E11Jh7xWthbLkeMPkBZYIPU= X-Google-Smtp-Source: ABdhPJwmlVswiRCzCp8b33mjw5JxPXMhBKxKeMQpzEbqXvWUimj1yUpse5RfPVQp/1f+oUgCkzTvRQ== X-Received: by 2002:ab0:1866:: with SMTP id j38mr20116644uag.27.1608825415636; Thu, 24 Dec 2020 07:56:55 -0800 (PST) Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com. [209.85.217.48]) by smtp.gmail.com with ESMTPSA id z10sm3208037vsf.26.2020.12.24.07.56.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Dec 2020 07:56:54 -0800 (PST) Received: by mail-vs1-f48.google.com with SMTP id h6so1501601vsr.6 for ; Thu, 24 Dec 2020 07:56:54 -0800 (PST) X-Received: by 2002:a67:3201:: with SMTP id y1mr21661285vsy.22.1608825414045; Thu, 24 Dec 2020 07:56:54 -0800 (PST) MIME-Version: 1.0 References: <1608810533-8308-1-git-send-email-wangyunjian@huawei.com> In-Reply-To: <1608810533-8308-1-git-send-email-wangyunjian@huawei.com> From: Willem de Bruijn Date: Thu, 24 Dec 2020 10:56:16 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net] tun: fix return value when the number of iovs exceeds MAX_SKB_FRAGS To: wangyunjian Cc: Network Development , "Michael S. Tsirkin" , Jason Wang , Willem de Bruijn , virtualization@lists.linux-foundation.org, "Lilijun (Jerry)" , chenchanghu , xudingke , "huangbin (J)" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Dec 24, 2020 at 6:51 AM wangyunjian wrote: > > From: Yunjian Wang > > Currently the tun_napi_alloc_frags() function returns -ENOMEM when the > number of iovs exceeds MAX_SKB_FRAGS + 1. However this is inappropriate, > we should use -EMSGSIZE instead of -ENOMEM. > > Fixes: 90e33d459407 ("tun: enable napi_gro_frags() for TUN/TAP driver") > Signed-off-by: Yunjian Wang Acked-by: Willem de Bruijn It might be good to explain why the distinction matters: one denotes a transient failure that the caller (specifically vhost_net) can retry, the other a persistent failure due to bad packet geometry that should be dropped. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E350C433E0 for ; Thu, 24 Dec 2020 15:57:04 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 066FF223DB for ; Thu, 24 Dec 2020 15:57:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 066FF223DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 279EA867F4; Thu, 24 Dec 2020 15:57:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id psuJM0xB5xlu; Thu, 24 Dec 2020 15:57:02 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 7A34F85FC4; Thu, 24 Dec 2020 15:57:02 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 59FC9C1825; Thu, 24 Dec 2020 15:57:02 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8685CC0893 for ; Thu, 24 Dec 2020 15:57:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7A08886243 for ; Thu, 24 Dec 2020 15:57:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a56PQAFrrQnU for ; Thu, 24 Dec 2020 15:56:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 493B385B3B for ; Thu, 24 Dec 2020 15:56:57 +0000 (UTC) Received: by mail-vs1-f52.google.com with SMTP id s2so1514096vsk.2 for ; Thu, 24 Dec 2020 07:56:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XRYO0lFUVOrah75uQXi2tgidobUUXCXbkVzNcCSUK7Y=; b=vD+85mxRjBfgH/Sr9fNWdZGEZkGCHFeLsjU3Ur+c3zJ5wpb8lGtmkFUlNYttDgBl3q pA+Xr1MSgCOJD31ItdxXMEyce5g0ByZJ9cV5+yoh1TlZ15r9KptXP5AmQAA5IDLtQhSo ufPxBCA+vBcRbjE/l97R4uobG1CxRofdyDygsn0r4YzTJg8fHwRFCRGXpRcV5HWb4UPy 822ceXGoh7xsp9/ALp7vqguO5tHDyI9vzdm+X9EY4dOxT5LvNdfSw1BnYqGU9VZB5pot qJt/EEOUvT0cHl2EwwDJ6Hu7uMhSyi+zlsutqz9l1oa6vxvhfH+qb8i8zb7TkPf/dwEh 7QGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XRYO0lFUVOrah75uQXi2tgidobUUXCXbkVzNcCSUK7Y=; b=tlp+bRVkOmOkGxEEORqnPRtxpShoUiyGxzIYC/q4j5SUKVRr9hMGGPHUZYsrlU1byZ 8ANo5HyeDlSMND2JV/m/zi2hT8chy+mVKmJFEjij7mAVeRcb8Au86vtG1ub472EpYoGc VcVRPB4kcFMO/3zvritGzPrWtivCRjKrNkPVVO1+HgJe7WW9KZZ8IyNdicrB90OMPWfZ 4EnWzS5b28wiMZ51B3IFglNo8pAYNf3LHti77h9BfiGl9I5GGLPX/qc3yONbGSfCaHQq wK/NYo8JrVybHs7mUz29iSNo/szxB1PRTNdZlmE18cPUWscHHpLaabcIsZ9QUuFEEeOV RyMw== X-Gm-Message-State: AOAM531Hnl3yMkQ4insu09bbcQGBqGjnx9JxlwDMYsFkxvRs9WOksCKa FUhG60G7fDmRbdrEx+wWoa9GhvN1178= X-Google-Smtp-Source: ABdhPJxHW/Ak1ZOeDy4PeYdzn2C8bMNiYc+/jZrFmfiNYJCpVikrQJdwkegsRdiDy73tYAReAmDfGg== X-Received: by 2002:a67:80d3:: with SMTP id b202mr22634599vsd.2.1608825415448; Thu, 24 Dec 2020 07:56:55 -0800 (PST) Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com. [209.85.217.52]) by smtp.gmail.com with ESMTPSA id e3sm3805641vkh.11.2020.12.24.07.56.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Dec 2020 07:56:54 -0800 (PST) Received: by mail-vs1-f52.google.com with SMTP id q10so1474360vsr.13 for ; Thu, 24 Dec 2020 07:56:54 -0800 (PST) X-Received: by 2002:a67:3201:: with SMTP id y1mr21661285vsy.22.1608825414045; Thu, 24 Dec 2020 07:56:54 -0800 (PST) MIME-Version: 1.0 References: <1608810533-8308-1-git-send-email-wangyunjian@huawei.com> In-Reply-To: <1608810533-8308-1-git-send-email-wangyunjian@huawei.com> From: Willem de Bruijn Date: Thu, 24 Dec 2020 10:56:16 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net] tun: fix return value when the number of iovs exceeds MAX_SKB_FRAGS To: wangyunjian Cc: Willem de Bruijn , "Michael S. Tsirkin" , Network Development , "Lilijun \(Jerry\)" , virtualization@lists.linux-foundation.org, xudingke , "huangbin \(J\)" , chenchanghu X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Thu, Dec 24, 2020 at 6:51 AM wangyunjian wrote: > > From: Yunjian Wang > > Currently the tun_napi_alloc_frags() function returns -ENOMEM when the > number of iovs exceeds MAX_SKB_FRAGS + 1. However this is inappropriate, > we should use -EMSGSIZE instead of -ENOMEM. > > Fixes: 90e33d459407 ("tun: enable napi_gro_frags() for TUN/TAP driver") > Signed-off-by: Yunjian Wang Acked-by: Willem de Bruijn It might be good to explain why the distinction matters: one denotes a transient failure that the caller (specifically vhost_net) can retry, the other a persistent failure due to bad packet geometry that should be dropped. _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization