Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3713355ybv; Mon, 10 Feb 2020 05:10:29 -0800 (PST) X-Google-Smtp-Source: APXvYqxUJEcVIa+UozTU8TV9/QaKloX/yQKuMHY1scFiBWD+GcbFMCqZgRJ8meOcvonYnvnBxt82 X-Received: by 2002:a05:6808:658:: with SMTP id z24mr766447oih.91.1581340228899; Mon, 10 Feb 2020 05:10:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581340228; cv=none; d=google.com; s=arc-20160816; b=Lqd8mgrQM0662N3SK1JLdESDBMB/NxnkuuxmIyZKQTPWX8Tb1ivnQ6dTA3dR0bue47 Y4a3SCrpmDPxAqocFn11bvahmBoHIzk0q/Tg0l8CPr+2YY3mNvvkUL+iYwZ1Rnm43RtY VpGYynsqBj+mL5Kc9pCbEsvnaBXJ89KsKFwVuHyeFKIO7W8TZlVORV3Z0RGNqypT6m5N hnZYifQBLdloIQwjbmZ3MpMs/EB3Q1RdJqaga1X+uEKYLf/pBuscFYW8tCau/KYpqxck ER2iptRMVvNz8n97BhWgh0xrSkcEzJldmwWcZxdLs/ij2/yx4XCZZYUmi/1spjZDIWS/ Xe6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hih90dYp8xhoB4+nb9fub4UZQj/SZP4y+SgI0erwk2Y=; b=WK26sys9PCusY854cCW3imoBB+pkvM2CEnUI8aTmLK5n2UsWERKRmug/D0XbQTnO4J oFHsOPbb3WuO9g2sjKmlJJv+KWcgYqqe8zPWX+QQu1TVzwv+xprmAHeneiKJkmE3iv4S TycR0cO5UHXzuQBl9SbBfErTgOfCgoDZ1NYDiSYKbWeWCTtb2brdp9Q2Vw1icDpm0jAX QPh6bejC6TTsHtZzgn9Bfa57s3TfMmN1uzVAooirs+Ro82uqne8o+qRCIy1tsmQLYpmG U+RU6+AC6QGYd+0nvfSszuoSdqjACpPtJJz/1wJcVfIlw+VTp/EMweIw91qTACMqqkhz NqLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BQBzCyTH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g26si174224otn.180.2020.02.10.05.10.15; Mon, 10 Feb 2020 05:10:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BQBzCyTH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730859AbgBJNI7 (ORCPT + 99 others); Mon, 10 Feb 2020 08:08:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:36988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728580AbgBJMjZ (ORCPT ); Mon, 10 Feb 2020 07:39:25 -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 D723E20838; Mon, 10 Feb 2020 12:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338364; bh=xtSZXCFnBGOlSBUbv4suGCVpm9DZOtQ7P7M7K11ClNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BQBzCyTH7i83v57NdVxNtlvuXstO1n2eglw8N6PuN6qL5skqdn9kT6fnSCPYFXE/b KA1TQCkRQANHF7sac0rmxRWwJPlHyTWSIEj6hCTfSpafqedvQqRNBefGgCrZ5iZnbu O3PeOfVsS6dPelgbpHndEOtXxD/cGOeNpcXjrR38= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sven Auhagen , Lorenzo Bianconi , "David S. Miller" Subject: [PATCH 5.5 008/367] net: mvneta: fix XDP support if sw bm is used as fallback Date: Mon, 10 Feb 2020 04:28:41 -0800 Message-Id: <20200210122424.603705667@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: Lorenzo Bianconi [ Upstream commit 44efc78d0e464ce70b45b165c005f8bedc17952e ] In order to fix XDP support if sw buffer management is used as fallback for hw bm devices, define MVNETA_SKB_HEADROOM as maximum between XDP_PACKET_HEADROOM and NET_SKB_PAD and let the hw aligns the IP header to 4-byte boundary. Fix rx_offset_correction initialization if mvneta_bm_port_init fails in mvneta_resume routine Fixes: 0db51da7a8e9 ("net: mvneta: add basic XDP support") Tested-by: Sven Auhagen Signed-off-by: Lorenzo Bianconi Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/marvell/mvneta.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -324,8 +324,7 @@ ETH_HLEN + ETH_FCS_LEN, \ cache_line_size()) -#define MVNETA_SKB_HEADROOM (max(XDP_PACKET_HEADROOM, NET_SKB_PAD) + \ - NET_IP_ALIGN) +#define MVNETA_SKB_HEADROOM max(XDP_PACKET_HEADROOM, NET_SKB_PAD) #define MVNETA_SKB_PAD (SKB_DATA_ALIGN(sizeof(struct skb_shared_info) + \ MVNETA_SKB_HEADROOM)) #define MVNETA_SKB_SIZE(len) (SKB_DATA_ALIGN(len) + MVNETA_SKB_PAD) @@ -1167,6 +1166,7 @@ bm_mtu_err: mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short, 1 << pp->id); pp->bm_priv = NULL; + pp->rx_offset_correction = MVNETA_SKB_HEADROOM; mvreg_write(pp, MVNETA_ACC_MODE, MVNETA_ACC_MODE_EXT1); netdev_info(pp->dev, "fail to update MTU, fall back to software BM\n"); } @@ -4948,7 +4948,6 @@ static int mvneta_probe(struct platform_ SET_NETDEV_DEV(dev, &pdev->dev); pp->id = global_port_id++; - pp->rx_offset_correction = MVNETA_SKB_HEADROOM; /* Obtain access to BM resources if enabled and already initialized */ bm_node = of_parse_phandle(dn, "buffer-manager", 0); @@ -4973,6 +4972,10 @@ static int mvneta_probe(struct platform_ } of_node_put(bm_node); + /* sw buffer management */ + if (!pp->bm_priv) + pp->rx_offset_correction = MVNETA_SKB_HEADROOM; + err = mvneta_init(&pdev->dev, pp); if (err < 0) goto err_netdev; @@ -5130,6 +5133,7 @@ static int mvneta_resume(struct device * err = mvneta_bm_port_init(pdev, pp); if (err < 0) { dev_info(&pdev->dev, "use SW buffer management\n"); + pp->rx_offset_correction = MVNETA_SKB_HEADROOM; pp->bm_priv = NULL; } }