From patchwork Thu Feb 10 17:55:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12742263 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75951C433F5 for ; Thu, 10 Feb 2022 17:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245401AbiBJR5Q (ORCPT ); Thu, 10 Feb 2022 12:57:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243640AbiBJR5O (ORCPT ); Thu, 10 Feb 2022 12:57:14 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BEE0115A for ; Thu, 10 Feb 2022 09:57:15 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id y17so2477071plg.7 for ; Thu, 10 Feb 2022 09:57:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cFxNMZlPWQbTVuYU8JB6usCHQfrDU2aW/saZvvKOcjE=; b=ZPKKohc0v9VFscLQ/b4ZxMHz51YqKhpiziQvBJRnhTiSqg90OfDuBuZXp5cKq5E7la kd4tgoNStjPzmxNvgpa7TvPUw0fYtkNkjm9hm44Q3fG/I+oHertRIyIg5aZsXLAvmNia OiNyRm5tJbCm/NputnCh2+7FP6taDzxUYpg7tV53CDBGw6izjeTvIz675h3aTYca1EZ5 tztAH29QrRwdRqRxjo3A9aAkWzvpYz6mrnE6wSZUM3xoZ9UcjyvA6rPH+M3imtezj2Rq MUxNPk8hOLFWZMRomRX/syfSdgWJhslkVaPPLGfiD0sa1yRfoKOe18OFLpV/BwbgnWfQ X0eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cFxNMZlPWQbTVuYU8JB6usCHQfrDU2aW/saZvvKOcjE=; b=I42aUIhw0YA6lHBTdhy+CCydcE01Mza04A4qyJ3uzaJIhQpN0wMaOudGFJ6W7x/12M haOUPvKJBGXrdZnbhvMvh9qTiFFe2EV4M/XThD2RXZZDyVPiPwRqyATpJcYoQ0t/KgVk yHJEX9xanhGGUy3EdcHsW8UxEaq24WTeQCE5c939Jezzu+XoIlnAOc/w4zdTFLUkjkXw +1nNmhYdTsTWv5GDIgIF/KYeY6eOQwoWfnWXmcOZ27GciVY/aIxvP/WFmIfc94gitAPs fXqgtJbuLxHUhYYhO1VckaypxmjmxC9uqhPQH2dHiCtP1B3Mq2B55T5K6IBW/IP7YBDl 763g== X-Gm-Message-State: AOAM5308BUT3npGt/gyHW4C5iZu6ow4aff6oXMCI0yfw23ktiaV7VgwO 2LXgNYkHC/oj59/J3pmnrTv1T4ATNq8= X-Google-Smtp-Source: ABdhPJz7U59X2qlw5BTCc3gSWdpZzIP9uCX6KMe2M9oEB+kZPPuJOe12824GxuXhiwOzwTfHY/IS9A== X-Received: by 2002:a17:90a:348f:: with SMTP id p15mr4005552pjb.173.1644515834689; Thu, 10 Feb 2022 09:57:14 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:c3d8:67ff:656a:cfd9]) by smtp.gmail.com with ESMTPSA id t3sm26230634pfg.28.2022.02.10.09.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 09:57:14 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 1/4] af_packet: do not assume MAX_SKB_FRAGS is unsigned long Date: Thu, 10 Feb 2022 09:55:54 -0800 Message-Id: <20220210175557.1843151-2-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.1.265.g69c8d7142f-goog In-Reply-To: <20220210175557.1843151-1-eric.dumazet@gmail.com> References: <20220210175557.1843151-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet MAX_SKB_FRAGS is small, there is no point forcing it to be unsigned long. Signed-off-by: Eric Dumazet --- net/packet/af_packet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index ab87f22cc7ecde517ba4cd0b3804a28c3cccfc85..96ae70135bd94c4527e61621af35d6e8659ab9f7 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2606,8 +2606,8 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb, nr_frags = skb_shinfo(skb)->nr_frags; if (unlikely(nr_frags >= MAX_SKB_FRAGS)) { - pr_err("Packet exceed the number of skb frags(%lu)\n", - MAX_SKB_FRAGS); + pr_err("Packet exceed the number of skb frags(%d)\n", + (int)MAX_SKB_FRAGS); return -EFAULT; } From patchwork Thu Feb 10 17:55:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12742264 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11197C433EF for ; Thu, 10 Feb 2022 17:57:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245412AbiBJR5Q (ORCPT ); Thu, 10 Feb 2022 12:57:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245410AbiBJR5P (ORCPT ); Thu, 10 Feb 2022 12:57:15 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7C0325D7 for ; Thu, 10 Feb 2022 09:57:16 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id n23so11637988pfo.1 for ; Thu, 10 Feb 2022 09:57:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rIIGX3P8YWiAdhJvBY9NBTOCqxvy9xtRdDHIVkVhWGU=; b=DhB6TepfR6i4DI7ctCCzkjgl5EK2E1n0VP4xZE15qhGEtv3IAc2mcD/RQSBVfeJDks mtwKbeExfvo+sU/eZfa70KmCfJyR/zqBiYCv03o1Sv6Hm6/zvlrCBJLUyk8CkU6bG4C5 nh1DpqBgfUpqkOScQ7eG3IingipimNNfmpLJ8o197B2HZqZRYWvgw7/46byHpg4z2Pe9 AYW8Zy3FALXVmX1ejFTbMrRde6SpUynryjbX2D8swAnc48oqz91QbwoNykY92vFjc9RI PmjW5K/jm3bmOInV+N5+/6YlAp87GaqO5EfvF7nqNtLXaBqKF1TfaWpcIvACMxkVCEqv 1Tew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rIIGX3P8YWiAdhJvBY9NBTOCqxvy9xtRdDHIVkVhWGU=; b=gIPFJ8YTaZcouFp2OY42TI9sUH1If82SbUiXDXW3meQVeqnFFzolHFjNimAtbo0sd3 Uc7WpwDs8H/XbLWscD+iOjatPmRMz8RSTNUbWi6c11b/Xgd7XMXT5tbCyJyeR5NFr+rN zGYhI8QFeiPq3s9rdv+DpqvOsOAt38d4FQqA6cmcgHjzuc5D6NkpCDFF37pvHbh3pDXX en8tklBsnvvmoyfHTzJwJL2VLBCg0qroNPfk+D348oj+pzZ4eZh7Yqpz2OivgQczKBI0 cLmCAdTVnHnlnL5hlIi0bAfzZ2YOAOOVhDZ7v0zskn3qkx6BaAqmWE8BCvq6cnSk0fhj vc0Q== X-Gm-Message-State: AOAM533zU1Ir1r6mq9iXtFLuA7vq1BAdjmzHIS9TWoddymPKE2QDFiUF Z/Jvyq/cKTWZnIe+0aD38h8= X-Google-Smtp-Source: ABdhPJw3wqGJgc4rqukK5rrk0hsN/tSJgKgw9AaalF84jEIT/dv+S1JD7nwWqX4BjllUNpFvB/mdvQ== X-Received: by 2002:a05:6a00:22cb:: with SMTP id f11mr8554303pfj.75.1644515836448; Thu, 10 Feb 2022 09:57:16 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:c3d8:67ff:656a:cfd9]) by smtp.gmail.com with ESMTPSA id t3sm26230634pfg.28.2022.02.10.09.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 09:57:16 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 2/4] scsi: iscsi: do not assume MAX_SKB_FRAGS is unsigned long Date: Thu, 10 Feb 2022 09:55:55 -0800 Message-Id: <20220210175557.1843151-3-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.1.265.g69c8d7142f-goog In-Reply-To: <20220210175557.1843151-1-eric.dumazet@gmail.com> References: <20220210175557.1843151-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet We want to add a CONFIG_MAX_SKB_FRAGS option in the future, and this will change MAX_SKB_FRAGS to an int type. cxgbi_sock_tx_queue_up() has one pr_err() using %lu to print SKB_WR_LIST_SIZE. Signed-off-by: Eric Dumazet --- drivers/scsi/cxgbi/libcxgbi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h index 3687b5c0cf905827aa4ba70fbc21d42c15e7b3f7..ccf7ea612e1281bd3a3deb9fe5246549e257cc0d 100644 --- a/drivers/scsi/cxgbi/libcxgbi.h +++ b/drivers/scsi/cxgbi/libcxgbi.h @@ -382,7 +382,7 @@ static inline struct sk_buff *alloc_wr(int wrlen, int dlen, gfp_t gfp) * length of the gather list represented by an skb into the # of necessary WRs. * The extra two fragments are for iscsi bhs and payload padding. */ -#define SKB_WR_LIST_SIZE (MAX_SKB_FRAGS + 2) +#define SKB_WR_LIST_SIZE ((unsigned long)MAX_SKB_FRAGS + 2) static inline void cxgbi_sock_reset_wr_list(struct cxgbi_sock *csk) { From patchwork Thu Feb 10 17:55:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12742265 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 577AEC433F5 for ; Thu, 10 Feb 2022 17:57:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245425AbiBJR5V (ORCPT ); Thu, 10 Feb 2022 12:57:21 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245419AbiBJR5R (ORCPT ); Thu, 10 Feb 2022 12:57:17 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92B6F1A8 for ; Thu, 10 Feb 2022 09:57:18 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id t36so759821pfg.0 for ; Thu, 10 Feb 2022 09:57:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QpmmfLkt7bE7Igneras6kyssB20cZe/Vh0DXUgSq4sQ=; b=q0zM/n53n7Gd85knsfa/0fhD5dLLw/nOU2L+gFYFQ6aci52d9wMbQD6X7pHXDRwaAe WvSu8H82oTKH8ncVgmthJB8TwD/1b7WPqv3CobV3xHRyKq9Jk43HAEuMRhewOhgyhomW LXdlsH1Up1Rcii488T55kH+sBlyXJiNTGnfHa3fZwUc/a+K2I5B1QxzfhzPd04W7xdQL r0J8FHVOuHjDDySxZlIMtZgoAsH6VokudyAgJrxjG2L6mNPT8LHApXy8+YKKg3pS6Iny Jh5IDMlIaLIMZkrzEulZysfK7FD4VB+fyrliYieW2STx3uxmeFrwKhKJrdrGgRTKUZCF 6flg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QpmmfLkt7bE7Igneras6kyssB20cZe/Vh0DXUgSq4sQ=; b=MVAX6o0yeMjS3f3xJrLZcQxI/VK18kyaISMAe8paEYri/s6JaTpK7Wx+YKwNSEfQLY vJfpAkUSnXc4aOWmOkCmvUgRuhnzMVjkYEXlB3rseixDU0r71thNaV7ndaGL28xLc88e Z8JO7btZDfOrWudJb8H7Z5G+ktZLW4ZoDhI/0l9U2c3o3VhKHE/HnZ6VFu8I1oqFytOR wFJLcp1qlgoL5r6KwVaFHU4o8w4h7XRTff9kSLlnHONgV1KXpzmE7bhYfVPf6oAXZbeX wMt/zOwEYE6gUlEX8vjGuaXUUOgeUrTraHE3M2nN06hFE06g5S/bTRsm938Fy4/M7etD xu5w== X-Gm-Message-State: AOAM531udqCbvF3TT0Ag2DaOg6CqF3QOr3KsSeTQ62oRCS5U4vR8zeu0 rmX01qBhS0L6tcaXlziysuKldAdDzyY= X-Google-Smtp-Source: ABdhPJyvXNRGDwcyQ2KOKdNdmgjkycwxm3YUZ7LVNCwID4r0zVUzU0PRvjjQ8h7lvDR+XgaChVjPxQ== X-Received: by 2002:a63:6909:: with SMTP id e9mr7141747pgc.450.1644515838166; Thu, 10 Feb 2022 09:57:18 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:c3d8:67ff:656a:cfd9]) by smtp.gmail.com with ESMTPSA id t3sm26230634pfg.28.2022.02.10.09.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 09:57:17 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 3/4] net: mvpp2: get rid of hard coded assumptions Date: Thu, 10 Feb 2022 09:55:56 -0800 Message-Id: <20220210175557.1843151-4-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.1.265.g69c8d7142f-goog In-Reply-To: <20220210175557.1843151-1-eric.dumazet@gmail.com> References: <20220210175557.1843151-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet A driver should not assume anything about sizeof(struct skb_shared_info), or L1_CACHE_BYTES value. Commit 704e624f7b3e ("net: mvvp2: fix short frame size on s390") tried to fix this issue for s390, but it seems MVPP2_BM_SHORT_FRAME_SIZE, MVPP2_BM_LONG_FRAME_SIZE and MVPP2_BM_JUMBO_FRAME_SIZE should be precise. We want to be able to tweak MAX_SKB_FRAGS in the future, without breaking the build. Signed-off-by: Eric Dumazet --- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h index ad73a488fc5fb6de4ddbf980355e31944b980e08..3dc0132a1fd569f7e75bfbef586c65163f0466c7 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h @@ -938,9 +938,9 @@ enum mvpp22_ptp_packet_format { #define MVPP2_BM_COOKIE_POOL_OFFS 8 #define MVPP2_BM_COOKIE_CPU_OFFS 24 -#define MVPP2_BM_SHORT_FRAME_SIZE 736 /* frame size 128 */ -#define MVPP2_BM_LONG_FRAME_SIZE 2240 /* frame size 1664 */ -#define MVPP2_BM_JUMBO_FRAME_SIZE 10432 /* frame size 9856 */ +#define MVPP2_BM_SHORT_FRAME_SIZE (128 + MVPP2_SKB_HEADROOM + MVPP2_SKB_SHINFO_SIZE) /* frame size 128 */ +#define MVPP2_BM_LONG_FRAME_SIZE (1664 + MVPP2_SKB_HEADROOM + MVPP2_SKB_SHINFO_SIZE) /* frame size 1664 */ +#define MVPP2_BM_JUMBO_FRAME_SIZE (9856 + MVPP2_SKB_HEADROOM + MVPP2_SKB_SHINFO_SIZE) /* frame size 9856 */ /* BM short pool packet size * These value assure that for SWF the total number * of bytes allocated for each buffer will be 512 From patchwork Thu Feb 10 17:55:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12742266 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A20AC433FE for ; Thu, 10 Feb 2022 17:57:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245432AbiBJR5X (ORCPT ); Thu, 10 Feb 2022 12:57:23 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245426AbiBJR5T (ORCPT ); Thu, 10 Feb 2022 12:57:19 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65D3A25D1 for ; Thu, 10 Feb 2022 09:57:20 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id y8so8867925pfa.11 for ; Thu, 10 Feb 2022 09:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BPLJSUrEN/N+MaTI9DZxGaP3H2W+QXqIrXaMJvnCzAI=; b=D0s38nZctv6y3Y6yBFHMMoDyQq3siD/N9GOmtmDbo/amK/gNxJQIUXYbBFlSPBdI29 ueY/85mTTHPPp8o4ceg1qdlqdW+TW2YAGK2jdduKC8zl6Nbm79dbAUDb3mJJsd1IsAaU uOb+g4+fA8Isigr3Nnp3wjtatORQgmAvSHyzCRN6nQRi2b60Ml58wX+q9doP8QDtA3cM mShpzVnOhWMjPXrWxBCz4YdnSwj0W9RrPE+SjnUyZe8EscVicvuBi36W7Fjp9Vp/w4w6 WSO/pIYob/qfx3g4T0e7pWf/2ILVkZKEQar35kJ7941jno3i59KpKTn3kz1hpQPoDdv2 EGXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BPLJSUrEN/N+MaTI9DZxGaP3H2W+QXqIrXaMJvnCzAI=; b=zMhbn7Y203uQVgxW871h6iLB2WqQSDqXdMutnqqFbrwjvPEboywwDVANtqWvmlOTG+ e6m4rBt41+7n80xJFqPCMQoQ9vo5BOSvvcz8vXfnN5KLUj/EADHvwJlCYdYmkqNafUen MSlulL4TRSVxINIQ6T+5LmVEKxP2OR6iWeb2sa0QM7K08r5yEH52/n5e/92kPR5BhzBO TrNB0Tl1ZOmHRfL1bsFVkd4nVuneVJnwElaRDJq7wJZooBryXurU+0DgzALa8lVkMEEW 4HLymEgKU5TbW82wT1pDN4hjQEDpeJYAOSn6tRzcC2uNMewz5tWCZP051KcCxM264ZLQ qnsw== X-Gm-Message-State: AOAM5316aTE14AMumqJuS+lzgmFRFF+lqV78CF914hZBpI5dET1+dhW6 YMuATnXOTjRss07bf/7BBSE= X-Google-Smtp-Source: ABdhPJxYWvcZT6SSicN9DO4n8g1xQHUsar6mBQsHCusoN99ornS9SG5sUpdaLbeX0AqRwSUDhDWNmw== X-Received: by 2002:a63:2b49:: with SMTP id r70mr7092217pgr.111.1644515839856; Thu, 10 Feb 2022 09:57:19 -0800 (PST) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:c3d8:67ff:656a:cfd9]) by smtp.gmail.com with ESMTPSA id t3sm26230634pfg.28.2022.02.10.09.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 09:57:19 -0800 (PST) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Eric Dumazet , Coco Li , Eric Dumazet Subject: [PATCH net-next 4/4] net: introduce a config option to tweak MAX_SKB_FRAGS Date: Thu, 10 Feb 2022 09:55:57 -0800 Message-Id: <20220210175557.1843151-5-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.35.1.265.g69c8d7142f-goog In-Reply-To: <20220210175557.1843151-1-eric.dumazet@gmail.com> References: <20220210175557.1843151-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet Currently, MAX_SKB_FRAGS value is 17. For standard tcp sendmsg() traffic, no big deal because tcp_sendmsg() attempts order-3 allocations, stuffing 32768 bytes per frag. But with zero copy, we use order-0 pages. For BIG TCP to show its full potential, we add a config option to be able to fit up to 45 segments per skb. This is also needed for BIG TCP rx zerocopy, as zerocopy currently does not support skbs with frag list. We have used MAX_SKB_FRAGS=45 value for years at Google before we deployed 4K MTU, with no adverse effect. Back then, goal was to be able to receive full size (64KB) GRO packets without the frag_list overhead. By default we keep the old/legacy value of 17 until we get more coverage for the updated values. Sizes of struct skb_shared_info on 64bit arches MAX_SKB_FRAGS | sizeof(struct skb_shared_info) ---------------------------------------------- 17 320 21 320+64 = 384 25 320+128 = 448 29 320+192 = 512 33 320+256 = 576 37 320+320 = 640 41 320+384 = 704 45 320+448 = 768 This inflation might cause problems for drivers assuming they could pack both the incoming packet and skb_shared_info in half a page, using build_skb(). Signed-off-by: Eric Dumazet --- include/linux/skbuff.h | 14 ++------------ net/Kconfig | 12 ++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a5adbf6b51e86f955b7f4fcd4a65e38adce97601..6bba71532415019d33cd98e172b5469fa7a5c1bd 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -349,18 +349,8 @@ enum skb_drop_reason { SKB_DROP_REASON_MAX, }; -/* To allow 64K frame to be packed as single skb without frag_list we - * require 64K/PAGE_SIZE pages plus 1 additional page to allow for - * buffers which do not start on a page boundary. - * - * Since GRO uses frags we allocate at least 16 regardless of page - * size. - */ -#if (65536/PAGE_SIZE + 1) < 16 -#define MAX_SKB_FRAGS 16UL -#else -#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1) -#endif +#define MAX_SKB_FRAGS CONFIG_MAX_SKB_FRAGS + extern int sysctl_max_skb_frags; /* Set skb_shinfo(skb)->gso_size to this in case you want skb_segment to diff --git a/net/Kconfig b/net/Kconfig index 8a1f9d0287de3c32040eee03b60114c6e6d150bc..7b96047911ee78bf61e9a290ad430261e4fc91c8 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -253,6 +253,18 @@ config PCPU_DEV_REFCNT network device refcount are using per cpu variables if this option is set. This can be forced to N to detect underflows (with a performance drop). +config MAX_SKB_FRAGS + int "Maximum number of fragments per skb_shared_info" + range 17 45 + default 17 + help + Having more fragments per skb_shared_info can help GRO efficiency. + This helps BIG TCP workloads, but might expose bugs in some + legacy drivers. + This also increases memory overhead of small packets, + and in drivers using build_skb(). + If unsure, say 17. + config RPS bool depends on SMP && SYSFS