Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2154186iof; Tue, 7 Jun 2022 21:33:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzn9LFq2GhkRgPRyKJNZjjIhmVijRc3CI0HfT1FGROsOYz3ybfAMeMT0eozhMMPD2MAD0y X-Received: by 2002:a17:90b:4ac1:b0:1e6:7c82:9aee with SMTP id mh1-20020a17090b4ac100b001e67c829aeemr35404678pjb.234.1654662831827; Tue, 07 Jun 2022 21:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662831; cv=none; d=google.com; s=arc-20160816; b=t1oq6TGB/a7YlOjRl2gx597WUMRTqTUpqwW/vGIa9S4V7PXNTfOaVeFEnLlVOsRM7Q dn5I6BbcP3vnaqHsIIh1N3PgIfstMq1zHv10igsQsamcLIFvcniVahR9/x/Pfk+up9az Q98i6YWXiYbGjufHS57pr/oVHnR6Vq1opSv33dYweX2BJwaOksG5laWc/Am6obTYoSBG iH9Nq7QfK6LQUgzY1RjTIKUtfWK39+GsY8TECuyC/Q/76nqy+i1WUIM+C5aUmHR2bocC hxJl+0S/VRyqxPqxiWpg4pRlg5DYxm0VtSIVKlXzTLdMoqLsyhfVtl2GAqafoNX3Nnjf 2sRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=8jUo5ILLnzzIFtft13bYw8jpL7wDw6YblekTQ1WZdNs=; b=b+YCWh3q7ayI060wnjyYzIK4+Drp0jPkZdcprciGN34zROHIquI5KeM16YRPAKrb36 ANtJbuJox+9Z3VtFKJc6Z0fjLhkc6pmD/O1rYGuRh7NZu2RIFZmkzgoPHgiEURd2+CT1 /elN2xrrQ7FH/nWVWrVCMb0yDmUQiXit/k/+gulnS+6jcHJffEQhkKGTd5FI80RrirUu tsS3D20zqVZ2vs6hST1ja7m9B9q4najdJ8P9dQlyJhZxsOS6Neli4z2SObk3RFUoCylV 3BtfkVhOXlASEbprRQocen/TYkEZ3r5ecx+vTKAMro+fAj8qZf4rOsDhsWgXaqDNiSJ8 eNJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vmware.com header.s=s1024 header.b=eFOh+k7H; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j15-20020a170902da8f00b001569aeb7516si21110849plx.543.2022.06.07.21.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:33:51 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@vmware.com header.s=s1024 header.b=eFOh+k7H; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ACB7B23D9AF; Tue, 7 Jun 2022 21:02:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238530AbiFGIrH (ORCPT + 99 others); Tue, 7 Jun 2022 04:47:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238510AbiFGIqo (ORCPT ); Tue, 7 Jun 2022 04:46:44 -0400 Received: from EX-PRD-EDGE02.vmware.com (EX-PRD-EDGE02.vmware.com [208.91.3.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49824E5287; Tue, 7 Jun 2022 01:46:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=s1024; d=vmware.com; h=from:to:cc:subject:date:message-id:in-reply-to:mime-version: content-type; bh=8jUo5ILLnzzIFtft13bYw8jpL7wDw6YblekTQ1WZdNs=; b=eFOh+k7HdLV4xx3GEEULIXdp+MZ3g7KW1Ac6ttO51wBMZtf+rWReWWAz+aIyKx 8tl7zesemDpuAMEloY9AJFLRmRb330q6NvGW7JOsVZWVoS2nST5s5a63BZoutX TSkscoiPRHnygp+s36X5xvB8OI8b0p9LAK842Ix0Ia8D6TQ= Received: from sc9-mailhost1.vmware.com (10.113.161.71) by EX-PRD-EDGE02.vmware.com (10.188.245.7) with Microsoft SMTP Server id 15.1.2308.14; Tue, 7 Jun 2022 01:45:36 -0700 Received: from htb-1n-eng-dhcp122.eng.vmware.com (unknown [10.20.114.216]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 2811020194; Tue, 7 Jun 2022 01:45:42 -0700 (PDT) Received: by htb-1n-eng-dhcp122.eng.vmware.com (Postfix, from userid 0) id 2350FAA2B0; Tue, 7 Jun 2022 01:45:42 -0700 (PDT) From: Ronak Doshi To: CC: Ronak Doshi , VMware PV-Drivers Reviewers , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , open list Subject: [PATCH v2 net-next 6/8] vmxnet3: limit number of TXDs used for TSO packet Date: Tue, 7 Jun 2022 01:45:16 -0700 Message-ID: <20220607084518.30316-7-doshir@vmware.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220607084518.30316-1-doshir@vmware.com> References: <20220607084518.30316-1-doshir@vmware.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX-PRD-EDGE02.vmware.com: doshir@vmware.com does not designate permitted sender hosts) X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, vmxnet3 does not have a limit on number of descriptors used for a TSO packet. However, with UPT, for hardware performance reasons, this patch limits the number of transmit descriptors to 24 for a TSO packet. Signed-off-by: Ronak Doshi Acked-by: Guolin Yang --- drivers/net/vmxnet3/vmxnet3_defs.h | 2 ++ drivers/net/vmxnet3/vmxnet3_drv.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/net/vmxnet3/vmxnet3_defs.h b/drivers/net/vmxnet3/vmxnet3_defs.h index 415e4c9993ef..cb9dc72f2b3d 100644 --- a/drivers/net/vmxnet3/vmxnet3_defs.h +++ b/drivers/net/vmxnet3/vmxnet3_defs.h @@ -400,6 +400,8 @@ union Vmxnet3_GenericDesc { /* max # of tx descs for a non-tso pkt */ #define VMXNET3_MAX_TXD_PER_PKT 16 +/* max # of tx descs for a tso pkt */ +#define VMXNET3_MAX_TSO_TXD_PER_PKT 24 /* Max size of a single rx buffer */ #define VMXNET3_MAX_RX_BUF_SIZE ((1 << 14) - 1) diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 2ba263966989..6e013ae0b5ea 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -1061,6 +1061,23 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, } tq->stats.copy_skb_header++; } + if (unlikely(count > VMXNET3_MAX_TSO_TXD_PER_PKT)) { + /* tso pkts must not use more than + * VMXNET3_MAX_TSO_TXD_PER_PKT entries + */ + if (skb_linearize(skb) != 0) { + tq->stats.drop_too_many_frags++; + goto drop_pkt; + } + tq->stats.linearized++; + + /* recalculate the # of descriptors to use */ + count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1; + if (unlikely(count > VMXNET3_MAX_TSO_TXD_PER_PKT)) { + tq->stats.drop_too_many_frags++; + goto drop_pkt; + } + } if (skb->encapsulation) { vmxnet3_prepare_inner_tso(skb, &ctx); } else { -- 2.11.0