All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ronak Doshi <doshir@vmware.com>
To: <netdev@vger.kernel.org>
Cc: Ronak Doshi <doshir@vmware.com>,
	VMware PV-Drivers Reviewers <pv-drivers@vmware.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: [PATCH net-next 6/8] vmxnet3: limit number of TXDs used for TSO packet
Date: Fri, 27 May 2022 18:17:56 -0700	[thread overview]
Message-ID: <20220528011758.7024-7-doshir@vmware.com> (raw)
In-Reply-To: <20220528011758.7024-1-doshir@vmware.com>

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 <doshir@vmware.com>
Acked-by: Guolin Yang <gyang@vmware.com>
---
 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


  parent reply	other threads:[~2022-05-28  1:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-28  1:17 [PATCH net-next 0/8] vmxnet3: upgrade to version 7 Ronak Doshi
2022-05-28  1:17 ` [PATCH net-next 1/8] vmxnet3: prepare for version 7 changes Ronak Doshi
2022-05-28  1:17 ` [PATCH net-next 2/8] vmxnet3: add support for capability registers Ronak Doshi
2022-05-28  1:17 ` [PATCH net-next 3/8] vmxnet3: add support for large passthrough BAR register Ronak Doshi
2022-05-28  1:17 ` [PATCH net-next 4/8] vmxnet3: add support for out of order rx completion Ronak Doshi
2022-05-28  1:17 ` [PATCH net-next 5/8] vmxnet3: add command to set ring buffer sizes Ronak Doshi
2022-05-28  1:17 ` Ronak Doshi [this message]
2022-05-28  1:17 ` [PATCH net-next 7/8] vmxnet3: use ext1 field to indicate encapsulated packet Ronak Doshi
2022-05-28  1:17 ` [PATCH net-next 8/8] vmxnet3: update to version 7 Ronak Doshi
2022-05-28  2:09 ` [PATCH net-next 0/8] vmxnet3: upgrade " Jakub Kicinski
  -- strict thread matches above, loose matches on Subject: below --
2022-06-06 18:03 Ronak Doshi
2022-06-06 18:03 ` [PATCH net-next 6/8] vmxnet3: limit number of TXDs used for TSO packet Ronak Doshi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220528011758.7024-7-doshir@vmware.com \
    --to=doshir@vmware.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pv-drivers@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.