Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp933074pxb; Wed, 6 Apr 2022 04:41:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJDuUEu6toouCUqOYQegOwWB7K4KapspbHvQc3Fm4UVVmmnV/sBbZfJ80UHar/Gtvn/75N X-Received: by 2002:a05:6a00:2289:b0:4fb:1686:acd with SMTP id f9-20020a056a00228900b004fb16860acdmr8598208pfe.17.1649245315376; Wed, 06 Apr 2022 04:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649245315; cv=none; d=google.com; s=arc-20160816; b=ugkKGqFJkae0tPm0ChC0QyRJc6iqBhNiT5guBDFMChhKZ2bz3p1F5ceVU1j1Tgcm6v y8dvXB0LerRqz+GfPzsCvuGTPmmghyrJ4nPRwEZPL4wfW/dAv6y5ZFw2RiHkg1J3bQIZ sl5CIXMYwueammEyabv4vegMqUokCXmfBbR3E9cbxWmGpX8NkyXzQRduixIwotaz6Ttz seKjYLuwqryv8p5VJUfzz/BG2O1vvc4a8opBEvyYoTSpHJkYcT2zm37zIxVOZGR0leMr W7/SeKCdFvyRXDt6MacNS+5JpK3VykFHXShLBtcO+75PiiWfUF+LR5P9MteyxVGcKIpK etcw== 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=/JiRcq5fqOZ7yASw1zYcwdugDttMPwDd7rQn2nQcvLE=; b=UpcmsodlbRM5l4ZwRG4uIrFC+u7OEvnoytGys361DAPgdcu6ghYtynf43kgj42xc7y zGaJz1+8GCVi3+3gRiBq10wfq/v0CLsIZjxot4NLfSL3y1IR0DQtLxuc56SuYyjRvxvg x/PZjRUQ9ANcIlFF5Q4VqOR7oOPWOafBpPp4cRVMKtRuyFwvux1I9bmwWm3Nwp6snAM6 JEPOYgIdkv9gYpXSsxUXw889wZcO6AwxQdM4hzqwsGqnbC77QKtU86PVG5SRwOyhSS+Y khSU/xRv69JmXmwe5vYqcNThvg1DcPgZo3de8xEOs7qLvXwwRg4BMZFYOiDMWAYPwgLK UlcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="o903U/RF"; 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 bd34-20020a056a0027a200b004faa3ae3e94si14289504pfb.22.2022.04.06.04.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:41:55 -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="o903U/RF"; 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B046D614F5B; Wed, 6 Apr 2022 02:59:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1588110AbiDFAN7 (ORCPT + 99 others); Tue, 5 Apr 2022 20:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348970AbiDEJsu (ORCPT ); Tue, 5 Apr 2022 05:48:50 -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 1615B5FE3; Tue, 5 Apr 2022 02:38:31 -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 A60AE61577; Tue, 5 Apr 2022 09:38:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B813AC385A0; Tue, 5 Apr 2022 09:38:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151510; bh=z4YLGi9YbeaUcr0qIT52vIz3HIzSVT4EtDUKm8XN6nM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o903U/RFZf3sw7YA63YgII7AP+nBNW2xbTza+YNA7EQohMRtJI+tbiPGiqFvm7CRo lMuvGVArvjQUf2ugyTkig38EEe/pfCwHJjT2c6yRozDLvjCQwAfCzTJ0qodOSVyqiW hHQTVVXo2ob6lmvmC39lWgAZvBi+TiJvx/glQar4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Corinna Vinschen , Vinicius Costa Gomes , Sandeep Penigalapati , Tony Nguyen , Sasha Levin Subject: [PATCH 5.15 440/913] igb: refactor XDP registration Date: Tue, 5 Apr 2022 09:25:02 +0200 Message-Id: <20220405070353.035110076@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 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=no 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: Corinna Vinschen [ Upstream commit e62ad74aa534404b3ee7e250b114a3536ac56987 ] On changing the RX ring parameters igb uses a hack to avoid a warning when calling xdp_rxq_info_reg via igb_setup_rx_resources. It just clears the struct xdp_rxq_info content. Instead, change this to unregister if we're already registered. Align code to the igc code. Fixes: 9cbc948b5a20c ("igb: add XDP support") Signed-off-by: Corinna Vinschen Acked-by: Vinicius Costa Gomes Tested-by: Sandeep Penigalapati Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 ---- drivers/net/ethernet/intel/igb/igb_main.c | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index fb1029352c3e..3cbb5a89b336 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -961,10 +961,6 @@ static int igb_set_ringparam(struct net_device *netdev, memcpy(&temp_ring[i], adapter->rx_ring[i], sizeof(struct igb_ring)); - /* Clear copied XDP RX-queue info */ - memset(&temp_ring[i].xdp_rxq, 0, - sizeof(temp_ring[i].xdp_rxq)); - temp_ring[i].count = new_rx_count; err = igb_setup_rx_resources(&temp_ring[i]); if (err) { diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 82a712f77cb3..bf8ef81f6c0e 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -4345,7 +4345,18 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) { struct igb_adapter *adapter = netdev_priv(rx_ring->netdev); struct device *dev = rx_ring->dev; - int size; + int size, res; + + /* XDP RX-queue info */ + if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq)) + xdp_rxq_info_unreg(&rx_ring->xdp_rxq); + res = xdp_rxq_info_reg(&rx_ring->xdp_rxq, rx_ring->netdev, + rx_ring->queue_index, 0); + if (res < 0) { + dev_err(dev, "Failed to register xdp_rxq index %u\n", + rx_ring->queue_index); + return res; + } size = sizeof(struct igb_rx_buffer) * rx_ring->count; @@ -4368,14 +4379,10 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) rx_ring->xdp_prog = adapter->xdp_prog; - /* XDP RX-queue info */ - if (xdp_rxq_info_reg(&rx_ring->xdp_rxq, rx_ring->netdev, - rx_ring->queue_index, 0) < 0) - goto err; - return 0; err: + xdp_rxq_info_unreg(&rx_ring->xdp_rxq); vfree(rx_ring->rx_buffer_info); rx_ring->rx_buffer_info = NULL; dev_err(dev, "Unable to allocate memory for the Rx descriptor ring\n"); -- 2.34.1