Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3051651rwe; Mon, 29 Aug 2022 05:10:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR7OPEyGj/CiDqQhEewNHK3XCzkreWE/4ACauGsh+P1oNtd3iyAXuD6V/p40upKgRSe6qe3J X-Received: by 2002:a05:6402:2694:b0:448:86a9:b6af with SMTP id w20-20020a056402269400b0044886a9b6afmr2352648edd.218.1661775036146; Mon, 29 Aug 2022 05:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661775036; cv=none; d=google.com; s=arc-20160816; b=oechJZ/wczj7GUXbLQ42RMHiRzQo+0VrsNpg3vaMvJB0KA2cWUwjsRrfcqJzBIdvUD UYoHaDQUvwbb+mGpz33KzpuK2EAKxf4p7xO52CxWrqH89A90Gs1QX4W4GsmVslmLKTTV iCpUV/Q9BsRVBAMc/tjwhcAngU9jHouU7/w1/QeLBq0x3C3Lp+3C0b5tC8N3lscWxXIf 5N25JD8/DX3w6Dyn5qq8CKXqM0EqWrBqn2VJqB6/ugRYR+3hSGZ0qqrClfS/VQ5lXjWC gJ1DIotbMStDEy8Hut76aoZe9//PjF3NdqBg/4ORqgBCDm2iLCtCRugzjRbE72ejozMa isjA== 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=8mpRket+nQoK4DhIpdw/ZpnaUixD+27tGDPp/du0BWQ=; b=v4JK80G8V2uVTuZz+VUR8DZnlquwl8Slow0oO1zPMVic6okg3nKzccGdABeyQaLl9Q xxhyPyE9fPNTTBdwo7USklTJdW6MW0YyU8uXw6XIWtm/IxoV5hOfph/gaXQ4F2Olbtp9 BdrRsBit1GvI/kqyZY4aO7wHMk3XRDqCn8BCYbNJV9MCtzzxxyNcv2eA+ZWUn1F1GVlm k1yOAz/iFy6kiek5Pc4qGtXym0bwD41S8V5F8JBUeyXunM9xPgnLxi9T+IDRG2RJcFqW 8lN7wGQqD6rEiVUHxj6/S+xhdAChpzM9a677Rg5pI4bN+c/G5mvGi2+mU3gfj6vd5KGj sgkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DZYW0uOA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i19-20020a1709064fd300b0073da0e4b911si6976871ejw.514.2022.08.29.05.10.09; Mon, 29 Aug 2022 05:10:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DZYW0uOA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231374AbiH2LWr (ORCPT + 99 others); Mon, 29 Aug 2022 07:22:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231738AbiH2LV3 (ORCPT ); Mon, 29 Aug 2022 07:21:29 -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 DD0306F261; Mon, 29 Aug 2022 04:14:06 -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 1E325B80DB5; Mon, 29 Aug 2022 11:13:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54473C433C1; Mon, 29 Aug 2022 11:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771619; bh=ilM81X9bYHzCIl7Y5JRsv5m6sk0E4ZL2agqH2ayJy2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZYW0uOADux0tGepdDgLqeEaa5Nxv+tZxIQBULK8eqMTaOI1f/iNihmL5vbU2GAfN +9AKkE7hOgtDzTbFfYlIvkbi1JIGZO50GztGPuNAJ1awYz27OeemLc3ToSF5jKtnlp coKM+1mgfEJx9soVbVISla1R94tOiPbhML12iSMs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Somnath Kotur , Pavan Chebbi , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 051/158] bnxt_en: Use PAGE_SIZE to init buffer when multi buffer XDP is not in use Date: Mon, 29 Aug 2022 12:58:21 +0200 Message-Id: <20220829105810.878458809@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105808.828227973@linuxfoundation.org> References: <20220829105808.828227973@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Pavan Chebbi [ Upstream commit 7dd3de7cb1d657a918c6b2bc673c71e318aa0c05 ] Using BNXT_PAGE_MODE_BUF_SIZE + offset as buffer length value is not sufficient when running single buffer XDP programs doing redirect operations. The stack will complain on missing skb tail room. Fix it by using PAGE_SIZE when calling xdp_init_buff() for single buffer programs. Fixes: b231c3f3414c ("bnxt: refactor bnxt_rx_xdp to separate xdp_init_buff/xdp_prepare_buff") Reviewed-by: Somnath Kotur Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 075c6206325ce..b1b17f9113006 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2130,6 +2130,7 @@ struct bnxt { #define BNXT_DUMP_CRASH 1 struct bpf_prog *xdp_prog; + u8 xdp_has_frags; struct bnxt_ptp_cfg *ptp_cfg; u8 ptp_all_rx_tstamp; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index f53387ed0167b..c3065ec0a4798 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -181,6 +181,7 @@ void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, struct xdp_buff *xdp) { struct bnxt_sw_rx_bd *rx_buf; + u32 buflen = PAGE_SIZE; struct pci_dev *pdev; dma_addr_t mapping; u32 offset; @@ -192,7 +193,10 @@ void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, mapping = rx_buf->mapping - bp->rx_dma_offset; dma_sync_single_for_cpu(&pdev->dev, mapping + offset, *len, bp->rx_dir); - xdp_init_buff(xdp, BNXT_PAGE_MODE_BUF_SIZE + offset, &rxr->xdp_rxq); + if (bp->xdp_has_frags) + buflen = BNXT_PAGE_MODE_BUF_SIZE + offset; + + xdp_init_buff(xdp, buflen, &rxr->xdp_rxq); xdp_prepare_buff(xdp, *data_ptr - offset, offset, *len, false); } @@ -397,8 +401,10 @@ static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog) netdev_warn(dev, "ethtool rx/tx channels must be combined to support XDP.\n"); return -EOPNOTSUPP; } - if (prog) + if (prog) { tx_xdp = bp->rx_nr_rings; + bp->xdp_has_frags = prog->aux->xdp_has_frags; + } tc = netdev_get_num_tc(dev); if (!tc) -- 2.35.1