Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2188838pxb; Fri, 25 Mar 2022 12:40:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyo6YfXK5Cd+TyayRhGo6KgVEVaLXB6yQfAwk/0Pva1/SvQfVX7FlhkJbabyauoPu3LT8Hh X-Received: by 2002:a63:1618:0:b0:382:b4f6:a1e7 with SMTP id w24-20020a631618000000b00382b4f6a1e7mr887921pgl.374.1648237239878; Fri, 25 Mar 2022 12:40:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648237239; cv=none; d=google.com; s=arc-20160816; b=0UTxTBZrVemIngwQ0igvWMj2TFhk6eDBfwm6keHIrRZhYbEBF+dWnK7xdx0ZYmU+11 w7d7v546pWjESKBDwQYvrUFUWzBBhcsly7BIGfMR/OWZijI8w/AZhV2prV3fH/eU5Vl+ f28BnMuN2YnoZuzlSAcZ6HFTIXgMtrKw9GYz7Y+2pmBLLDiIPaCUir+AiRZVGSjcdKfF Yq85lxgdTpzRPy+1oZsS3v8izVS+m/sejdvcmerC1fNJeb7ks/+jA7FDyrsQ0xEVqCgs JWrn+dol7wdZRN6OkzBy1vZlFs2yqIOQ/3I14MFVPgMMHQpEcs4ZvBNs6nJTXefmyxFR DLGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tuItjVwZGkL/Ck9ziVbF3oVzMDsLL814iJ4J8lVWfY8=; b=iDgaBBny+2IriaIVBsvbUbFjwO5jMCYutFC7NCPRuHqwjnAhok1cLgjBxOx9NOrqPK a6JdVvkBHY/DE7hi1KutTUIu7Rq44aWaZ9wQkB9R1sRubIelBuM5v3JZQgQKtqt79Fqm k5x2nmnMp+H/eDcfch5BehIx/7vn827Jeew7ves1IUzixQqhqWq9mAPo7x4iAaZCew+c OezCMmBvyT2DdT3VOmEByrIg04vGZ8QAI9QwFRz7F9nLcPqNTfkUDc74MMM4rW2VrzVM /Aya6ShDQtxfZbPqAmUhmGmVYiaJdqA1QBHrH9rVrB7x2U6OYAHShlZ8KkdbdhcbGuu3 /kyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J5Y6HjWZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x3-20020a63f703000000b00380605faa34si3293141pgh.1.2022.03.25.12.40.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:40:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J5Y6HjWZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2841F28F830; Fri, 25 Mar 2022 11:32:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359843AbiCYPMr (ORCPT + 99 others); Fri, 25 Mar 2022 11:12:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359789AbiCYPKJ (ORCPT ); Fri, 25 Mar 2022 11:10:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 925C9DB4B0; Fri, 25 Mar 2022 08:07:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F15E361C14; Fri, 25 Mar 2022 15:07:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0561EC340E9; Fri, 25 Mar 2022 15:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648220868; bh=cm0RYyJQcXqUnVI7HNk8immc7/DDIPAlvRgVNobGzO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J5Y6HjWZoB+RBh9fC7SBV+eqp+bPTYKGE3iYFWAjkwDfo8qyicAG3l2ZN09Ckyg+U q22VI9EdL6Tb2Y90xjgZjK7I2rkWRmXM0b81XXLMNW/WkYABrSZ4AckTPYTByCjn3S 3+VkguTH5ID8y2ugWIpQaJdvDu+5GT6Zs895kIrU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephane Graber , Jakub Kicinski Subject: [PATCH 5.4 16/29] drivers: net: xgene: Fix regression in CRC stripping Date: Fri, 25 Mar 2022 16:04:56 +0100 Message-Id: <20220325150419.054217588@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220325150418.585286754@linuxfoundation.org> References: <20220325150418.585286754@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 From: Stephane Graber commit e9e6faeafaa00da1851bcf47912b0f1acae666b4 upstream. All packets on ingress (except for jumbo) are terminated with a 4-bytes CRC checksum. It's the responsability of the driver to strip those 4 bytes. Unfortunately a change dating back to March 2017 re-shuffled some code and made the CRC stripping code effectively dead. This change re-orders that part a bit such that the datalen is immediately altered if needed. Fixes: 4902a92270fb ("drivers: net: xgene: Add workaround for errata 10GE_8/ENET_11") Cc: stable@vger.kernel.org Signed-off-by: Stephane Graber Tested-by: Stephane Graber Link: https://lore.kernel.org/r/20220322224205.752795-1-stgraber@ubuntu.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -696,6 +696,12 @@ static int xgene_enet_rx_frame(struct xg buf_pool->rx_skb[skb_index] = NULL; datalen = xgene_enet_get_data_len(le64_to_cpu(raw_desc->m1)); + + /* strip off CRC as HW isn't doing this */ + nv = GET_VAL(NV, le64_to_cpu(raw_desc->m0)); + if (!nv) + datalen -= 4; + skb_put(skb, datalen); prefetch(skb->data - NET_IP_ALIGN); skb->protocol = eth_type_trans(skb, ndev); @@ -717,12 +723,8 @@ static int xgene_enet_rx_frame(struct xg } } - nv = GET_VAL(NV, le64_to_cpu(raw_desc->m0)); - if (!nv) { - /* strip off CRC as HW isn't doing this */ - datalen -= 4; + if (!nv) goto skip_jumbo; - } slots = page_pool->slots - 1; head = page_pool->head;