Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp667903lqh; Fri, 31 May 2024 12:32:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWCCkkK4jifYdsdVCznNBHukYfKdt8ykipirTHIkPel8KgCTTO2cOGhDRWIbcwVZUA0uDoPH5G2BfpC5eyN0xcUBxEkGv6pwbjEuJ429g== X-Google-Smtp-Source: AGHT+IEjYKVSnihqHIhuKi04JSQb6RcezaNXUT3nCd+Ayz7AQqSdCpStM8NnMhQy3jrgO1oN3TOP X-Received: by 2002:a17:906:6bc4:b0:a68:d2c:2a23 with SMTP id a640c23a62f3a-a6822049940mr200126566b.76.1717183946507; Fri, 31 May 2024 12:32:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717183946; cv=pass; d=google.com; s=arc-20160816; b=l67rshIKRKxTOprkZ5ugKkpUNb8My88w37myDYyw5WBhkJvjaAbITmG2LnaD1XcpZh ukNovu78gtu+MAGGlInCo8CVaT93DDb6B8iJ32CmTg5zIrNpnBFuo80HJ5qHiUqccfSV 6O2MnrSkGkHkplGzBuafY+Qz76ZR1hFisI3nUDkutD9GYVKy+0GGsJBv3QzhMG2es93z If4YQ4/HzSs9CfIazWPUrryinlqcwfBICex1JgySaPYMlJHJKKnpe+GVhjxGbB8TfQGp d2mIwDGaYTZfQWbAD9MUVtLGUhf4/bChRfnGB2j8ymawO/WYUL1O4d9qSFG4QnJUPk4D KSVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from; bh=GVrqvENuKp+u+7SIx5hyxBdXQKrD50lTClIqsj2wlOY=; fh=yPyBVueOlV0xh9WIpneyBjPV+wI+YQTxV6XUuh1OKK4=; b=CYYMQatHq5wDHGi6l8irzxEs/pN4mU2reqqwFMYZwmEigC1rjaVju4CVAKjl+o2iUj tLXttrvZuWXAqHI04I4mzcRevyIUDAsqAO2NUUWgLHU8pQJGwiP9Ep+DmNn4c5t3qRZ3 71XAABmrAxNcjVquuHpbS3WAqcgd18kw8W1IGwO9hw9rjnxjR7LCR6b4/j5/cZuHr/m5 bF/PL/BeILJQ8J27/hAmIFTPuAjZOFA3xHpZQxd9RqWDTcPm13P1VGl1htpkMqzi1hAU +nuSYu3D5otcN0yKxtcPytVAPATZrbvi5fW0FL14w8HQ48X4vxVcVPj0aEv8aZ4Z+YMw QOaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=vmware.com); spf=pass (google.com: domain of linux-kernel+bounces-197368-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197368-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a67eae709fesi120447266b.748.2024.05.31.12.32.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 12:32:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197368-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=vmware.com); spf=pass (google.com: domain of linux-kernel+bounces-197368-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197368-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3CD6B1F28BF2 for ; Fri, 31 May 2024 19:32:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D9D8F1822F2; Fri, 31 May 2024 19:31:11 +0000 (UTC) Received: from EX-PRD-EDGE02.vmware.com (EX-PRD-EDGE02.vmware.com [208.91.3.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA7C617F4E6; Fri, 31 May 2024 19:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=208.91.3.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717183871; cv=none; b=qNUDLpscpt4S/Xy8aN1C/JcdAnHZMNONMGwwPjCF0oTuuDG9i70UdpPB5KoBQ4TzSEujtX2PAGt/Bm2pZdnlaHPx05N+y843Co5dJEzrwFAdutnzaZncEwx9H5PyPOILhZ+nOE5NJyOsoeFf0hkBOXVFYXJrInzSLwACdsixTe0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717183871; c=relaxed/simple; bh=3bCL1drvVXayIisw5UlVqoTDdhd+lJaoXTKD8MTlFvY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fu4ahtxA2+RrlgXrRhdqDTnXsQh7R63s4taNxZYF1nLkxfuXWlKbRsqa95ggtZ6Mo3ctGBcLi9vn6ksQfmpDcNhBy22D08k+pIKMKXx/kydIOp9/nr1BGogi8BzDduJCgda3o2i3IIOqrcARc8ucEw1eIAxGqm/QxsbIkqc5ZdY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com; spf=pass smtp.mailfrom=vmware.com; arc=none smtp.client-ip=208.91.3.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vmware.com Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX-PRD-EDGE02.vmware.com (10.188.245.7) with Microsoft SMTP Server id 15.1.2375.34; Fri, 31 May 2024 12:30:34 -0700 Received: from htb-1n-eng-dhcp122.eng.vmware.com (unknown [10.172.6.252]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id F32802018B; Fri, 31 May 2024 12:30:55 -0700 (PDT) Received: by htb-1n-eng-dhcp122.eng.vmware.com (Postfix, from userid 0) id EF20AB04D3; Fri, 31 May 2024 12:30:55 -0700 (PDT) From: Ronak Doshi To: CC: Ronak Doshi , Broadcom internal kernel review list , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , open list Subject: [PATCH v2 net-next 3/4] vmxnet3: add command to allow disabling of offloads Date: Fri, 31 May 2024 12:30:48 -0700 Message-ID: <20240531193050.4132-4-ronak.doshi@broadcom.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20240531193050.4132-1-ronak.doshi@broadcom.com> References: <20240531193050.4132-1-ronak.doshi@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: SoftFail (EX-PRD-EDGE02.vmware.com: domain of transitioning ronak.doshi@broadcom.com discourages use of 10.113.161.72 as permitted sender) This patch adds a new command to disable certain offloads. This allows user to specify, using VM configuration, if certain offloads need to be disabled. Signed-off-by: Ronak Doshi Acked-by: Guolin Yang --- drivers/net/vmxnet3/vmxnet3_defs.h | 4 ++++ drivers/net/vmxnet3/vmxnet3_drv.c | 19 +++++++++++++++++++ drivers/net/vmxnet3/vmxnet3_int.h | 1 + 3 files changed, 24 insertions(+) diff --git a/drivers/net/vmxnet3/vmxnet3_defs.h b/drivers/net/vmxnet3/vmxnet3_defs.h index dcf1cf8e7a86..5c5148768039 100644 --- a/drivers/net/vmxnet3/vmxnet3_defs.h +++ b/drivers/net/vmxnet3/vmxnet3_defs.h @@ -126,6 +126,7 @@ enum { VMXNET3_CMD_GET_MAX_CAPABILITIES, VMXNET3_CMD_GET_DCR0_REG, VMXNET3_CMD_GET_TSRING_DESC_SIZE, + VMXNET3_CMD_GET_DISABLED_OFFLOADS, }; /* @@ -912,4 +913,7 @@ struct Vmxnet3_DriverShared { /* when new capability is introduced, update VMXNET3_CAP_MAX */ #define VMXNET3_CAP_MAX VMXNET3_CAP_VERSION_7_MAX +#define VMXNET3_OFFLOAD_TSO BIT(0) +#define VMXNET3_OFFLOAD_LRO BIT(1) + #endif /* _VMXNET3_DEFS_H_ */ diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 71677115628b..e26d223a659f 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -3645,6 +3645,15 @@ static void vmxnet3_declare_features(struct vmxnet3_adapter *adapter) { struct net_device *netdev = adapter->netdev; + unsigned long flags; + + if (VMXNET3_VERSION_GE_9(adapter)) { + spin_lock_irqsave(&adapter->cmd_lock, flags); + VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, + VMXNET3_CMD_GET_DISABLED_OFFLOADS); + adapter->disabledOffloads = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); + spin_unlock_irqrestore(&adapter->cmd_lock, flags); + } netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX | @@ -3662,6 +3671,16 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter) NETIF_F_GSO_UDP_TUNNEL_CSUM; } + if (adapter->disabledOffloads & VMXNET3_OFFLOAD_TSO) { + netdev->hw_features &= ~(NETIF_F_TSO | NETIF_F_TSO6); + netdev->hw_enc_features &= ~(NETIF_F_TSO | NETIF_F_TSO6); + } + + if (adapter->disabledOffloads & VMXNET3_OFFLOAD_LRO) { + netdev->hw_features &= ~(NETIF_F_LRO); + netdev->hw_enc_features &= ~(NETIF_F_LRO); + } + if (VMXNET3_VERSION_GE_7(adapter)) { unsigned long flags; diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index 68358e71526c..31e8db568db2 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h @@ -454,6 +454,7 @@ struct vmxnet3_adapter { /* Size of buffer in the ts ring */ u16 tx_ts_desc_size; u16 rx_ts_desc_size; + u32 disabledOffloads; }; #define VMXNET3_WRITE_BAR0_REG(adapter, reg, val) \ -- 2.11.0