Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2173617pxb; Fri, 25 Mar 2022 12:24:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGpsKfaqixybOnYrSf+jRx+vHbGnXJUNGafJAinEAxDfkXbSoCqszUiMSRdr+oQtOUHScY X-Received: by 2002:a63:318a:0:b0:382:b763:c980 with SMTP id x132-20020a63318a000000b00382b763c980mr853162pgx.456.1648236268489; Fri, 25 Mar 2022 12:24:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648236268; cv=none; d=google.com; s=arc-20160816; b=jSzcaFr8chKg2RY/S7JYl6kzAKl095t5DR6PxW0khGx485QtJhFnH+DRdrHLwb3Yow Uoak1FT84N1hkHwq+WIm8ADfTQ8csVPGYk1PqDmeHT75zyQaMSHP4sHkoy58MOt/7u6Y NNqY70cYknPraKVBphdpjIhIzmVHtuBzdGI8ADtE6TZlWbck9ZuUL0azJQFSkL3jKcnj MWR4KjQYyIm4WSCwV3qh/JoWxhsB8IaxbfZ0VWXTR+XFtdcGb94Ehf3WDPddwao8XJFK UrN7u7+wf+oovWB7eC/61vvysGIL82fiWXBzuE49aMlYHX5UVsw1PqCblNaBayhGxbtW Gxkw== 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=rdqT0gv8UvOAyKnOhe+jgef46MyWNj6OhtWkxUiWu8M=; b=f2rpvjtmQiTfFn4RchuXgm+8VpdRQvkokH9LmuGlFZiRkto9keV+c7hbE2CqeGXUju XCaZ90rKZ2SbvDeydaiyta+u/UVopyuCS2/gU5Wq5HVQX8Ao0rCzfQdq+OCMzH8QoWtB dzNnrpCVrQbNPu20xckNlnVxXygri5azINlct7oD1+zp/iSMJfeU+fJigxy0VP08TEsK 7YFuhfkt+yZMAtW/O5lJ8b29xzyCZeSSQSkIuBVGZjQ1Sx3/wByytHe5FfeVWQFhcBmB ZBRqC+z7ZZdZCCAPLra2nA4fRBt4hkncDUFNksT1Pi+xDcXfYtD/8MRBqpTeCZwc3SfL zbLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="i/B+A2Rw"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id c1-20020a63da01000000b003816043ef48si2966617pgh.317.2022.03.25.12.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:24:28 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="i/B+A2Rw"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A97972921C9; Fri, 25 Mar 2022 11:32:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359555AbiCYPIj (ORCPT + 99 others); Fri, 25 Mar 2022 11:08:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359540AbiCYPHV (ORCPT ); Fri, 25 Mar 2022 11:07:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81ECDD95FA; Fri, 25 Mar 2022 08:05:42 -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 ams.source.kernel.org (Postfix) with ESMTPS id 19961B828FB; Fri, 25 Mar 2022 15:05:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A872C340EE; Fri, 25 Mar 2022 15:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648220739; bh=nlE5/yk8Wh13HMpIBgKjw5YvNTdmuJ9LRCKl5GPXncI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i/B+A2RwND+XIKCgMhUVupJkJL1D1ScW1Nio6gIywYt8nSWTVUp3pT0dZbQPPA7QB WPPBrFDjkbPQQtorYhvqEXXuTQXrbzNmqDzqUcMi7rC3d3M8bULTyDe3NzNVDKnzOT ku9yVv0AUJUXLm+fwoOdeR/OMim7YM8EjrOI0b2s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephane Graber , Jakub Kicinski Subject: [PATCH 4.14 11/17] drivers: net: xgene: Fix regression in CRC stripping Date: Fri, 25 Mar 2022 16:04:45 +0100 Message-Id: <20220325150417.091471376@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220325150416.756136126@linuxfoundation.org> References: <20220325150416.756136126@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 @@ -707,6 +707,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); @@ -728,12 +734,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;