From patchwork Sun Jun 4 14:28:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liming Sun X-Patchwork-Id: 1790105 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=bzgmDLLD; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QYzct4TQjz20Tj for ; Mon, 5 Jun 2023 00:28:46 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1q5oim-0002TX-8L; Sun, 04 Jun 2023 14:28:40 +0000 Received: from mail-dm6nam10on2056.outbound.protection.outlook.com ([40.107.93.56] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1q5oij-0002RA-KC for kernel-team@lists.ubuntu.com; Sun, 04 Jun 2023 14:28:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fIBFalSxcQkITlVq0T/WWU18DpSIRKkoUkbiCdx8evoNeHYt3ySXQAPqTO056kOpSGMz793PvC+EM+lcJI5jNOMfbTozetW0QYVXvTpE6zODSsJW6Rlfl/XgZe6qlO/x1fVBPtaNBVgKkhmoqdIdvVyNOmN9c6CF0MORic+0rrZNjUx3ceqZIty/IuXM1XaRLMMqRSgU9igkyCmYKVckyrK8uuKPAMEd5ONaYcqbTDKbiteUHpPRtstPwrCcUMNz2D1V1UctbworBVUTCMILOikAH49tO6dPi0HKpmfGHZK1RwCXDUvhzB5uXm2fURwtjEancpvf/SOLETDQO0DKbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HY1PjACoMhT6psbzEDrT1c/YVcERM/TNBUySFMTxjTw=; b=LEK65xRMnuW4z00cjXECnHk24xA7a1S7oqvaSsQJHuTJ+MoX3K39DwFVzXmQ23LnOQwPy70+83/MKfcjAVQWuF/bOAF/cYc+KTcnT4dCFVLSFovALwzZ20YBwRAC9RrDvhNc+g8yFU4YOS3NIvw330ewKBxpwzqZA4S5JfpJxMfTA0A9kuz6IkCrI6qM7mGGCgyf78YIbic2O6qIrW2ekH7iYvVP4Fx6acT4z7uq1t7ysIvqDIpjjo49fP++xxdo+6z8ybR6Dee18qGoJ3Z65LwS+uv0K9vG/S/OTbHw/rQnGb6O75/+YilEbn3fhTjriG4ed/RY/ATpn9kgi/ARqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=lists.ubuntu.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HY1PjACoMhT6psbzEDrT1c/YVcERM/TNBUySFMTxjTw=; b=bzgmDLLDODUJdwzhxmfePvkkbmoya11SnFdI3dQ5IpBP4I7h68P2NFESfbBZMCHFM0wpebzQzUQdnLDrCcSUIsnSbQSOhPHMCWqCn1JU5SF/GDn81IeS8ec2PmApVtu12oAnTCpXeBtKQmiQxKZybtx3hz66MAZGApUWQ/9stVM+UvbGG9POfH8YgvyaPCU6SJtM/lzZCMDOrA2yKUtiTf8CWJMQAunbgkA5hfkVQ3IWdCJtzZ6PjhTNj2spX0M5Q2szM0mjQjE3q/JBYnUidSY/vgheAO2vD8qhyDYZV/GglQVvGW+/3axGdKBwxXRTYpH2aBSyfapSYSgbigmrOQ== Received: from MW4PR03CA0019.namprd03.prod.outlook.com (2603:10b6:303:8f::24) by BL0PR12MB4947.namprd12.prod.outlook.com (2603:10b6:208:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.27; Sun, 4 Jun 2023 14:28:34 +0000 Received: from CO1NAM11FT090.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::78) by MW4PR03CA0019.outlook.office365.com (2603:10b6:303:8f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32 via Frontend Transport; Sun, 4 Jun 2023 14:28:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT090.mail.protection.outlook.com (10.13.175.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32 via Frontend Transport; Sun, 4 Jun 2023 14:28:34 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Sun, 4 Jun 2023 07:28:23 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sun, 4 Jun 2023 07:28:23 -0700 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Sun, 4 Jun 2023 07:28:22 -0700 From: Liming Sun To: Subject: [PATCH 2/2] [SRU][J:linux-bluefield][PATCH v2 2/2] UBUNTU: SAUCE: mlxbf-tmfifo: Drop jumbo frames Date: Sun, 4 Jun 2023 10:28:15 -0400 Message-ID: <20230604142815.151636-3-limings@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <0c5d1413dec7019a2ad8520920e8fcbef8ed72f2.1685455239.git.limings@nvidia.com> References: <0c5d1413dec7019a2ad8520920e8fcbef8ed72f2.1685455239.git.limings@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT090:EE_|BL0PR12MB4947:EE_ X-MS-Office365-Filtering-Correlation-Id: e9c5919b-347b-4241-1597-08db6507fa78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VPIJftzzcZzzvFbaueGNf/R12DOdphcex5F1s1KVNKx131I99K8FdSyDfJ3NonVz3+Dlp50Axz47nUuo1bzO+DqF89i/38cdGvN7KuNOxV0l6wucW/lPXg54dH3dMRiX0ZhxRK6LJxk1JzqXaT0x+y7vLnMvHBoovhubBxbrPrCS1be8pF6Q4NTl257+AmFBdwu7PD98GqWgnWGjgMqFqd0rGm0EDxbi8fT7pvynB+Tn8TZOR60PWaPQWIoJxrgWEVs7UGP6WrLgoXle7Z1ZrMbHUoOL1oqi4zyZ2VTPChQ+A8tT1vOpw8gidAuogJAgRuHTBv0XCGuFXK35Io3VCqFt+11roQPW8KxTgSx2wlrCmg6amiyd53UluaiBH5zIg8AKMLxoS381vZ6ZGU18AC0lm5lmb+LkxwecqNjoFZerz8XBM+0D1IEXYVcYkzcS51iz9zMR5ltJ2nAoyxzKFe1wftQnn0ETVdZwczl7M6Pz/Yq17p4X7h6GBatfz+eKJ+le5wOpginTwXXTEtYGgXO56YTRt9FWhLDGuzY7ilzqvCMudWSZrqs7CC2+9QNlH8ecZmAAOLppSJSOpMurV9RlL/XhXNWbvP4mIZaZPgoQIT7R4/EjxJAylGzkkrUWSA7I51mpKw2K9FpnAk6t1rx3ptQT08tgXUU9bvjwSN9hzHdjg/YI7Rl5jfqzD53m2rG6me5oh5BoFIpTL6LM+nRICaCeQQPgzL36+aCmRx/bdvZ+tf3A87dANCBwm/AnCiyiauLoA1DJljK00Dr319tE7gGfI8ZCKbNDNMNUmZ8= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(376002)(136003)(39850400004)(396003)(346002)(451199021)(40470700004)(46966006)(36840700001)(5660300002)(8676002)(8936002)(316002)(41300700001)(2906002)(6916009)(4326008)(70586007)(70206006)(966005)(7696005)(426003)(1076003)(26005)(336012)(186003)(36756003)(107886003)(2616005)(47076005)(83380400001)(6666004)(36860700001)(7636003)(356005)(478600001)(82310400005)(40460700003)(82740400003)(40480700001)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2023 14:28:34.2845 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9c5919b-347b-4241-1597-08db6507fa78 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT090.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4947 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Sun Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/2021749 This commit drops over-sized network packets to avoid tmfifo queue stuck. Signed-off-by: Liming Sun Change-Id: Ieb0186dcd892295f00fca58fafd39512197e2b83 --- drivers/platform/mellanox/mlxbf-tmfifo.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c index 88610f45456b..4f3226007e32 100644 --- a/drivers/platform/mellanox/mlxbf-tmfifo.c +++ b/drivers/platform/mellanox/mlxbf-tmfifo.c @@ -234,7 +234,7 @@ static u8 mlxbf_tmfifo_net_default_mac[ETH_ALEN] = { static efi_char16_t mlxbf_tmfifo_efi_name[] = L"RshimMacAddr"; /* Maximum L2 header length. */ -#define MLXBF_TMFIFO_NET_L2_OVERHEAD 36 +#define MLXBF_TMFIFO_NET_L2_OVERHEAD (ETH_HLEN + VLAN_HLEN) /* Supported virtio-net features. */ #define MLXBF_TMFIFO_NET_FEATURES \ @@ -773,13 +773,14 @@ static void mlxbf_tmfifo_rxtx_word(struct mlxbf_tmfifo_vring *vring, * flag is set. */ static void mlxbf_tmfifo_rxtx_header(struct mlxbf_tmfifo_vring *vring, - struct vring_desc *desc, + struct vring_desc **desc, bool is_rx, bool *vring_change) { struct mlxbf_tmfifo *fifo = vring->fifo; struct virtio_net_config *config; struct mlxbf_tmfifo_msg_hdr hdr; int vdev_id, hdr_len; + bool drop_rx = false; /* Read/Write packet header. */ if (is_rx) { @@ -801,8 +802,8 @@ static void mlxbf_tmfifo_rxtx_header(struct mlxbf_tmfifo_vring *vring, if (ntohs(hdr.len) > __virtio16_to_cpu(virtio_legacy_is_little_endian(), config->mtu) + - MLXBF_TMFIFO_NET_L2_OVERHEAD) - return; + MLXBF_TMFIFO_NET_L2_OVERHEAD) + drop_rx = true; } else { vdev_id = VIRTIO_ID_CONSOLE; hdr_len = 0; @@ -817,16 +818,25 @@ static void mlxbf_tmfifo_rxtx_header(struct mlxbf_tmfifo_vring *vring, if (!tm_dev2) return; - vring->desc = desc; + vring->desc = *desc; vring = &tm_dev2->vrings[MLXBF_TMFIFO_VRING_RX]; *vring_change = true; } + + if (drop_rx && !IS_VRING_DROP(vring)) { + if (vring->desc_head) + mlxbf_tmfifo_release_pkt(vring); + *desc = &vring->drop_desc; + vring->desc_head = *desc; + vring->desc = *desc; + } + vring->pkt_len = ntohs(hdr.len) + hdr_len; } else { /* Network virtio has an extra header. */ hdr_len = (vring->vdev_id == VIRTIO_ID_NET) ? sizeof(struct virtio_net_hdr) : 0; - vring->pkt_len = mlxbf_tmfifo_get_pkt_len(vring, desc); + vring->pkt_len = mlxbf_tmfifo_get_pkt_len(vring, *desc); hdr.type = (vring->vdev_id == VIRTIO_ID_NET) ? VIRTIO_ID_NET : VIRTIO_ID_CONSOLE; hdr.len = htons(vring->pkt_len - hdr_len); @@ -875,7 +885,7 @@ static bool mlxbf_tmfifo_rxtx_one_desc(struct mlxbf_tmfifo_vring *vring, /* Beginning of a packet. Start to Rx/Tx packet header. */ if (vring->pkt_len == 0) { - mlxbf_tmfifo_rxtx_header(vring, desc, is_rx, &vring_change); + mlxbf_tmfifo_rxtx_header(vring, &desc, is_rx, &vring_change); (*avail)--; /* Return if new packet is for another ring. */