From patchwork Tue Feb 20 23:03:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13564712 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6643D6BB28 for ; Tue, 20 Feb 2024 23:03:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708470235; cv=none; b=oyeJpaFWsC3JXDFdf5Gd3B6nSLuksToADGkmiUNNHH5pV49ADtBN49PNovyD7JpZkAao7X8PuMVt2V1WGxu1hhMkTjtc5PXYss5AYuwrcEHOgv7WsETelEROefhVpqeREESPCvg0xZYFakjC+HdhWb7of7T4kiMvamePi++Ro+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708470235; c=relaxed/simple; bh=6REJnN9KIW7QVmc5hPxHB0m/doYQI/wIWZdYF43roUI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=tovf+SOAOdmrmKeJsUQpMfwLDS2p71VaBFoCkjD0fKdWtCAljwrUXWPHYu7xZOeM+4R8K3FT4Wrvrb0g5regBkhOpIumqhjh8tjjP84gbyfx74iA6wJLbEVCh2EHiW6RDhF3HMa+oeoEj04jYNJ7nX1pX8nxo8BZ+H+whjIHx9s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=EU/zslDm; arc=none smtp.client-ip=209.85.219.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="EU/zslDm" Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-dcc4de7d901so5321340276.0 for ; Tue, 20 Feb 2024 15:03:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708470232; x=1709075032; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=WF1aJkX1duQ9Co4JzfEIj9U7FPQmrzc1aw7du0ExUAs=; b=EU/zslDmGTlmwA7bUqI9ogGbDu0e0OYGER4xE8VYAuEYCvE/oKOXX3jP1Rp1M8nvQ9 3cI7zLv04VE/6jemQMqHOIa0vIprrpbr8KJGr2QfOYyI/lV27E41bnGXRDVHz8Zez5ro DyQTvE+WkFaCa0DaFRhtp5yJd+0zyNGzBOJNg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708470232; x=1709075032; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WF1aJkX1duQ9Co4JzfEIj9U7FPQmrzc1aw7du0ExUAs=; b=DnYLLykuK3KTVMzLyFkebxcLtwJ9sdUzqES7id+esStQ6NHOV/RNmmDhDbDeaOjMLQ RFwe3qU0jUcKbv0gIvXqXudYhzQTUPEslk7hzv9kdFSFHyFovid+nowUp4fpGI22rICD utB2Qtkv725KmYEniHULmkvj4Lp+5+aBV4p+FJ8mUR/0/8AUqqLY0TOjKlJkGckApqx7 Hqhu6YJjFsoKaf/pJmVR6ItiWVeT0EyhQUcCAb3uSRcgEIpks6GEgxTO5t4DTxRJ8kEN 3hKMMhj+h4/AyEkbOvu8ANmt2KBnxYGrEIJieePH7RVVkjRWDGAZJ+3z5uW2rAZs9mOQ 9MVA== X-Gm-Message-State: AOJu0Yz4GkQA/oznA2FPtUl3dRUS1yKynJAfeuLrZMdWr+sn91QVHGKP JiU4tAs8wmDi6awZHi0fV+UrzQTnVCxmFEssBWnWYiT3TOpYs1U0DFn5t1xMNg== X-Google-Smtp-Source: AGHT+IHVGZMbJ4DjhPUObP/td0Pjsf7PYoVLomQbByj98sQ8iZ6Bz104LH3rPjmEb9j8w/q4IkVVsA== X-Received: by 2002:a0d:e816:0:b0:608:21a0:229c with SMTP id r22-20020a0de816000000b0060821a0229cmr8089953ywe.35.1708470232295; Tue, 20 Feb 2024 15:03:52 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id g10-20020ae9e10a000000b00785d7dda9easm3797966qkm.28.2024.02.20.15.03.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2024 15:03:51 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Kalesh AP Subject: [PATCH net-next 06/10] bnxt_en: Refactor bnxt_set_features() Date: Tue, 20 Feb 2024 15:03:13 -0800 Message-Id: <20240220230317.96341-7-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20240220230317.96341-1-michael.chan@broadcom.com> References: <20240220230317.96341-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Pavan Chebbi Refactor bnxt_set_features() function to have a common function to re-init. We'll need this to reinitialize when ntuple configuration changes. Reviewed-by: Kalesh AP Reviewed-by: Andy Gospodarek Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 95af3cd7dba0..2fe5262f6c41 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -12431,6 +12431,16 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev, return features; } +static int bnxt_reinit_features(struct bnxt *bp, bool irq_re_init, + bool link_re_init, u32 flags, bool update_tpa) +{ + bnxt_close_nic(bp, irq_re_init, link_re_init); + bp->flags = flags; + if (update_tpa) + bnxt_set_ring_params(bp); + return bnxt_open_nic(bp, irq_re_init, link_re_init); +} + static int bnxt_set_features(struct net_device *dev, netdev_features_t features) { struct bnxt *bp = netdev_priv(dev); @@ -12479,14 +12489,9 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features) return rc; } - if (re_init) { - bnxt_close_nic(bp, false, false); - bp->flags = flags; - if (update_tpa) - bnxt_set_ring_params(bp); + if (re_init) + return bnxt_reinit_features(bp, false, false, flags, update_tpa); - return bnxt_open_nic(bp, false, false); - } if (update_tpa) { bp->flags = flags; rc = bnxt_set_tpa(bp,