From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2065C352A4 for ; Mon, 10 Feb 2020 12:54:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C215720708 for ; Mon, 10 Feb 2020 12:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581339275; bh=uAeh9zkjHRT+u9dTO4iUkbDFjSg+FkJC2JZNbyTc5RU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PyRDucnD/XI7FPZa+QpfNzjqeeFq1MBcx++K5o28sSE6HNpjeiy69rJN/z/vaTJpn 79W2fPLWgAHatA9DwFuJh64XCDpgWXd1pDYlhJs5M7pXha0+qFH+3O1YKTDuYLUTKu y17UcZDbVlIwX/aezx2fR5gH+VpsRju+HlmLbPQM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727738AbgBJMyf (ORCPT ); Mon, 10 Feb 2020 07:54:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:45412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730115AbgBJMl6 (ORCPT ); Mon, 10 Feb 2020 07:41:58 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F162C20842; Mon, 10 Feb 2020 12:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338518; bh=uAeh9zkjHRT+u9dTO4iUkbDFjSg+FkJC2JZNbyTc5RU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gw/yQe4ogbA75tBPOUR9LNBIQZQQHVIy6qyhs1WQ+VqpJTZBodsh0+rKomrQI7o8p +rvoIhJFQtwSDoCDM2NT2OLvMw7WQhQ3jWNRAC3Jbz81EIP+792VdohEAXzCngzZrf jRPqRbtDCjuANmpDEvQdcsRQu73b3cnGuvhYa7J4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harini Katakam , "David S. Miller" Subject: [PATCH 5.5 328/367] net: macb: Remove unnecessary alignment check for TSO Date: Mon, 10 Feb 2020 04:34:01 -0800 Message-Id: <20200210122453.187341846@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Harini Katakam [ Upstream commit 41c1ef978c8d0259c6636e6d2d854777e92650eb ] The IP TSO implementation does NOT require the length to be a multiple of 8. That is only a requirement for UFO as per IP documentation. Hence, exit macb_features_check function in the beginning if the protocol is not UDP. Only when it is UDP, proceed further to the alignment checks. Update comments to reflect the same. Also remove dead code checking for protocol TCP when calculating header length. Fixes: 1629dd4f763c ("cadence: Add LSO support.") Signed-off-by: Harini Katakam Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/cadence/macb_main.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -1752,16 +1752,14 @@ static netdev_features_t macb_features_c /* Validate LSO compatibility */ - /* there is only one buffer */ - if (!skb_is_nonlinear(skb)) + /* there is only one buffer or protocol is not UDP */ + if (!skb_is_nonlinear(skb) || (ip_hdr(skb)->protocol != IPPROTO_UDP)) return features; /* length of header */ hdrlen = skb_transport_offset(skb); - if (ip_hdr(skb)->protocol == IPPROTO_TCP) - hdrlen += tcp_hdrlen(skb); - /* For LSO: + /* For UFO only: * When software supplies two or more payload buffers all payload buffers * apart from the last must be a multiple of 8 bytes in size. */