Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2162917pxb; Fri, 25 Mar 2022 12:12:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2+wTzEYoOO2erAtbbG6myZjXnhY5pIgtywmJIr9vLgofES0XZ7NeyAf3qNyafQu7Wck/f X-Received: by 2002:a17:902:a3c3:b0:151:ec83:d88 with SMTP id q3-20020a170902a3c300b00151ec830d88mr13348845plb.9.1648235555498; Fri, 25 Mar 2022 12:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648235555; cv=none; d=google.com; s=arc-20160816; b=IA3pCsFM90xtaS54/eLnNbPyaN+qcZ9Uej1xH/ugJQFs0SE/3vHDdJYBeSL+PbaGNP PGCnBj4BKpm+S+qjvCfAD7jKkDRX6klHfXp4P5PN3+NGRObLrrjIO6+ULTd5toTjDAdu U40sk19Y0MVIMerdWajMo8QWoRUyrs7Jc/Lh5mkiRnf3zfIbGU0q5Iyg0Ucm7D9Abcuj wrA+jTR/i31lO3Bl/04hzkZ2Ys0hJKwlWZQMGk4cv2AZowJ+PmhZ0TFMksRaTelgd3tx 3lEcSPCS2/NK8K4R9IGXj1ErsXMxVlyjm3zvFL47V/urlz3ugdvKUuIgcpiG6qi6nIsV W7jw== 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=nxaYXVLH4T+lOABaTy8aSbhYXUrDds9s/JufPynEncBGYxdf5OStSCg/UgZgRiBLF8 R3huRpAd3HLmLYl3U4oUFQpnIuyhmmq838CKS+3N7RzAn3zO8ZnkYzOuTcBKFsWsnIO5 43moKactfZc3KdKqRHg0JfJ8ia1J2J5FDXDFFih6REIo/8ZgHnhu/6GN9wevn0pk/kfW 0L8jBIhwGqYaVpEsUhkvEUywD5KmY20aivKZq1Gg867BFJzf4TZJ0hZ45AvV2/l+CYf/ FjHPpgGppd0sYNsCsyh+/P1UXJZ/C6ZT04MOBueFQ7mweqKt4HpEVM0ZqLj30uipzWuW 1OLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cSWRVqgf; 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 b6-20020a170902e94600b00153b2d16401si3419195pll.9.2022.03.25.12.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:12:35 -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=cSWRVqgf; 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 721C220C180; Fri, 25 Mar 2022 11:16:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378600AbiCYPfL (ORCPT + 99 others); Fri, 25 Mar 2022 11:35:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377745AbiCYPYc (ORCPT ); Fri, 25 Mar 2022 11:24:32 -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 EFF5CE9976; Fri, 25 Mar 2022 08:18:52 -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 8E34360C86; Fri, 25 Mar 2022 15:18:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 963E4C340E9; Fri, 25 Mar 2022 15:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648221532; bh=cm0RYyJQcXqUnVI7HNk8immc7/DDIPAlvRgVNobGzO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cSWRVqgflFWDcR2w/bUMrZ074JRi+/tl6y0uhxMsgxQhERVm7GRoDUCBzQbT6Bciq mizAyWqS/5UwBvZ+pkS8M2QrgiG1tCGt+ABAaSNZbuvYqc0RGm1YWP8IVB1oj/7kAo ruI4O+i/4QSwxYiNZFdkWOle+khLtZsmCx8KfL9s= 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.17 19/39] drivers: net: xgene: Fix regression in CRC stripping Date: Fri, 25 Mar 2022 16:14:34 +0100 Message-Id: <20220325150420.793222251@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220325150420.245733653@linuxfoundation.org> References: <20220325150420.245733653@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;