From patchwork Wed Jul 31 13:15:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13748794 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (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 6E14F4369A for ; Wed, 31 Jul 2024 13:15:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722431749; cv=none; b=NkD4/RQtUj3t8UehpKI/j/3pkmTFfCf9xXghGIx1pYgQA9v4dNn5jbwoRSGbH8coLr3I2xmzS6qJAOhFbw/WqzafRM09h+VG41JyfUt/AuQc+JTO+yoyEYjM91hboh8ikLjRe+4Q15pkiTiOCBTaEB6JbN4tYv89z5Lqgw20sfw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722431749; c=relaxed/simple; bh=OGp1/miJhRdYorPHp/x7QtdybzfAitsP3q0qYSuWOhU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OyTJ+WTcLMuRqAvj1b6gndQZX1ZfD5kUAmwFgJ9dxaYALMhTEOUo77J4MQ4OlVcyNV1kb+3P1IiMF2hPfxu09x2sIqwzfZYlQPzGAAYOWetRc7g3Gl9vx5omrT9pVBGA6No1we2T9IEd63I5nFikXGAR7axM4jK3wmH5BWCrj7s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=dba+sRbq; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="dba+sRbq" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-7afd1aeac83so806089a12.0 for ; Wed, 31 Jul 2024 06:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1722431747; x=1723036547; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JGQp1DrDWAPch6PwECH96r+ViRGpUT3tNGLOlIDiv8w=; b=dba+sRbqnNPXgoRjVk1Fzpm7u/YiFqod00AfQ5hwAcZHhWZ2f23XVUKUeGljbUanh4 zVfq/cidXk2t8btTOUbEOZ5i5b4PYsZKxwmey5WPtOtiZ1SyuQGPV5si3NvVzVERF7wO h5MVwN5X9phtbY21RUCV+Gee8kX+EnBDMGXSK3J6Fy7SXaf3qXZAWZbMNrQX31//DJmC v2MyFhvYZ8wykTtHTsGhL/aV8KoPr+4VLwxky6QAYZeD6eXEdaYBkDV/HDoyYG/sQTr1 DeG9r06wZbcKZ3q+FGvnD2nR1hxkFOr3ci2AX+03vT28uNGjcziQfHCF/uCgfMoQ8wyD bd8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722431747; x=1723036547; h=content-transfer-encoding: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=JGQp1DrDWAPch6PwECH96r+ViRGpUT3tNGLOlIDiv8w=; b=PjVVV8mrQxR0/8cWPRHmFmn2w/pCT7+MU/+jYZCzc4aAQx/Tvbshjq0TwjDKsIUCyh iCSFXzwzNtE8tIGd0TelCbdlgJuWpY0CC6Fahx2XLFKC+8sUdKq30C9LZPZLiPhPbIUF 6AySEYL901eB5UG5IYSDUhCXXjHv8s6xb1CrpNjvQTAhqm9nsGpn4nELNMCz/for6izU A+mwve0vmJId7OZk3HbyAmrJz8Ux69rjCIrcMgi5k4C1+gS9b7vItYWKj4baMwOqK4an GjOmzaUC6j4AYNXUO/wq6CXtAc6bJmzF3WOtJzz50JZFGCk2mmHKnJLCkbaS+UgqZgro lFfA== X-Gm-Message-State: AOJu0YyImLT2ulQ52jBmvvy91Ih28W2iXjmFhyDwB74vC2iHsXt8ArUj ZJPZ02NBCHERvDcQFfD8Fk6wbwBH5Dmi1DzfhSwoiEF32CeXZk+ev93YbLYL9BfJw0ducDBvT0I 2kGA= X-Google-Smtp-Source: AGHT+IFuwYShzSiZ0BmKL53X2OHzAVgWUqE39TF0r/lK1kQt142jBql63t/6lwsirJuCpODysDal5w== X-Received: by 2002:a17:90b:1c85:b0:2c8:2236:e2c3 with SMTP id 98e67ed59e1d1-2cfcab89df6mr8722592a91.17.1722431747424; Wed, 31 Jul 2024 06:15:47 -0700 (PDT) Received: from localhost (fwdproxy-prn-012.fbsv.net. [2a03:2880:ff:c::face:b00c]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cfdc451415sm1301857a91.22.2024.07.31.06.15.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 06:15:47 -0700 (PDT) From: David Wei To: netdev@vger.kernel.org Cc: Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Michael Chan , Somnath Kotur , David Wei Subject: [PATCH net-next v2 1/4] bnxt_en: Add support to call FW to update a VNIC Date: Wed, 31 Jul 2024 06:15:39 -0700 Message-ID: <20240731131542.3359733-2-dw@davidwei.uk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240731131542.3359733-1-dw@davidwei.uk> References: <20240731131542.3359733-1-dw@davidwei.uk> 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: Michael Chan Add the HWRM_VNIC_UPDATE message structures and the function to send the message to firmware. This message can be used when disabling and enabling a receive ring within a VNIC. The mru which is the maximum receive size of packets received by the VNIC can be updated. Signed-off-by: Michael Chan Signed-off-by: David Wei --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 20 ++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 3 ++ drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 37 +++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index ffa74c26ee53..52998065956e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -10086,6 +10086,26 @@ static int __bnxt_setup_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic) return rc; } +int bnxt_hwrm_vnic_update(struct bnxt *bp, struct bnxt_vnic_info *vnic, + u8 valid) +{ + struct hwrm_vnic_update_input *req; + int rc; + + rc = hwrm_req_init(bp, req, HWRM_VNIC_UPDATE); + if (rc) + return rc; + + req->vnic_id = cpu_to_le32(vnic->fw_vnic_id); + + if (valid & VNIC_UPDATE_REQ_ENABLES_MRU_VALID) + req->mru = cpu_to_le16(vnic->mru); + + req->enables = cpu_to_le32(valid); + + return hwrm_req_send(bp, req); +} + int bnxt_hwrm_vnic_rss_cfg_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic) { int rc; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 6bbdc718c3a7..5de67f718993 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1250,6 +1250,7 @@ struct bnxt_vnic_info { #define BNXT_MAX_CTX_PER_VNIC 8 u16 fw_rss_cos_lb_ctx[BNXT_MAX_CTX_PER_VNIC]; u16 fw_l2_ctx_id; + u16 mru; #define BNXT_MAX_UC_ADDRS 4 struct bnxt_l2_filter *l2_filters[BNXT_MAX_UC_ADDRS]; /* index 0 always dev_addr */ @@ -2838,6 +2839,8 @@ int bnxt_hwrm_free_wol_fltr(struct bnxt *bp); int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all); int bnxt_hwrm_func_qcaps(struct bnxt *bp); int bnxt_hwrm_fw_set_time(struct bnxt *); +int bnxt_hwrm_vnic_update(struct bnxt *bp, struct bnxt_vnic_info *vnic, + u8 valid); int bnxt_hwrm_vnic_rss_cfg_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic); int __bnxt_setup_vnic_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic); void bnxt_del_one_rss_ctx(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx, diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h index f219709f9563..933f48a62586 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h @@ -6510,6 +6510,43 @@ struct hwrm_vnic_alloc_output { u8 valid; }; +/* hwrm_vnic_update_input (size:256b/32B) */ +struct hwrm_vnic_update_input { + __le16 req_type; + __le16 cmpl_ring; + __le16 seq_id; + __le16 target_id; + __le64 resp_addr; + __le32 vnic_id; + __le32 enables; + #define VNIC_UPDATE_REQ_ENABLES_VNIC_STATE_VALID 0x1UL + #define VNIC_UPDATE_REQ_ENABLES_MRU_VALID 0x2UL + #define VNIC_UPDATE_REQ_ENABLES_METADATA_FORMAT_TYPE_VALID 0x4UL + u8 vnic_state; + #define VNIC_UPDATE_REQ_VNIC_STATE_NORMAL 0x0UL + #define VNIC_UPDATE_REQ_VNIC_STATE_DROP 0x1UL + #define VNIC_UPDATE_REQ_VNIC_STATE_LAST VNIC_UPDATE_REQ_VNIC_STATE_DROP + u8 metadata_format_type; + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_0 0x0UL + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_1 0x1UL + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_2 0x2UL + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_3 0x3UL + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_4 0x4UL + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_LAST VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_4 + __le16 mru; + u8 unused_1[4]; +}; + +/* hwrm_vnic_update_output (size:128b/16B) */ +struct hwrm_vnic_update_output { + __le16 error_code; + __le16 req_type; + __le16 seq_id; + __le16 resp_len; + u8 unused_0[7]; + u8 valid; +}; + /* hwrm_vnic_free_input (size:192b/24B) */ struct hwrm_vnic_free_input { __le16 req_type; From patchwork Wed Jul 31 13:15:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13748795 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (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 739461AD419 for ; Wed, 31 Jul 2024 13:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722431750; cv=none; b=Twl4iDVl7MZlu9RSgecCtSFlRfjqDzwxHxj7w+4fFdmx4TZAn8Sg/zbANmLtc7WEimcS7B7w6PKNXXXJOxkE1BKtBiZIeR0i6JpIJzvRUFxi/mdmYCVpD0KbfzBDzX/lh5KT52IChxtpobFALCSUEmJXQGFckWCI2W+i/oVp62A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722431750; c=relaxed/simple; bh=nV4ki4QhBStX81MtSCM80aOZNRBMYokwFEBdu4cHtMA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gt5k9lawjUOE4sM29LmOhDR1YuqbhG8ipS/bdDd0NR4cvtJLM96+BOgO6C8PgqaHLN/RL9X57gLcNSJAZCPc7CM7cA9dd2+hJxp0X/PtrIwV+4FIKtxYAmqeBMJ+yucvCuUuVBsSFKerr+4UzLfXMMkfkNkodHmi0TXFQYsO/Ec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=tva6NSVy; arc=none smtp.client-ip=209.85.216.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="tva6NSVy" Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-2cf78366187so3655093a91.3 for ; Wed, 31 Jul 2024 06:15:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1722431748; x=1723036548; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o/oKIVixDcENB/ht6EYBvQyg9lE3Ljw+hngvqeYpDhc=; b=tva6NSVygn/Y3kGRGpEhgAoFBKw08x26gf/xL5YqPSRFUKZYUNtciqTgQv97Y9oamb F3FfUS8LeVOlzOVFGZfKF7EjQ7D2ZSJ/zGOgNAstzLGcsPzcA5Bdlg1q66uBNch99WI1 Ee7Lo+GQ1AzJNLJEJie2U1CkVWWFiEumxlJfPzY3LAD2d77xZzAsxuASdVlc6PP6obwa BmTz7fk7atjCiskQNyP8yzd01TAaKspDhpykBS7kRFxZEMjdRI8GL2fQdPCoXTMjyTAx Nz9WHg064n/XGxfe/O1A1XcXBOJyj0v+kgA9oS9J4Hnf0fa2etCllxq17YsIR+Z4XUjs Sr0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722431748; x=1723036548; h=content-transfer-encoding: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=o/oKIVixDcENB/ht6EYBvQyg9lE3Ljw+hngvqeYpDhc=; b=IxYduZYCHsrtsd4qPYXQ/XUU9GM/I4fWY/SM8HoTxWFtARB4uQWQXsuDvZveapSGR7 P9q1e4hx7jMfB2TUaIDlFEwHNyQ1XwusWb/yRpJ4S2uemrqiEKbrG44fQRdZ4doFSFDV sTjYnzqJGvVdoi0fxTbTYo9Q5CVnQzuHWLLWKgFXz2qio0FBf4XrC6SrOSWbwf6YoS9w 2Hu+vpos3EU0dpZ/gKk8V/IeYcoU6TgkOWNKrSeAJuWew6RaK/Zl/r+ac/c35H+PiBy8 0A6j+bL+tckTol3vlzAAy0w9XEFfvnaKLSkBTiwnrs3FWyASV6dj1+mY9+N82GxA86Nq pjRg== X-Gm-Message-State: AOJu0YxfWCWWQZZQHEodPCc3tSFR2lIq05N7D0RXRy94WH5q6VretkPX Y9e8xBIww5KKuRFsAYHG+LbXBsFH6VH5e6No6/Q+lwKe5DdXC+3XU0cM31RwgIAPaToI60jBw1f RxZY= X-Google-Smtp-Source: AGHT+IFxfTTOBKfxnWbbHyuN+30WJE01HYq86IpscL4Dls32Mv4RRCg71kANjgBp1X+Y/nsc6D/zRA== X-Received: by 2002:a17:90a:eb07:b0:2c2:f6a2:a5f7 with SMTP id 98e67ed59e1d1-2cf7e1df038mr18906014a91.13.1722431748498; Wed, 31 Jul 2024 06:15:48 -0700 (PDT) Received: from localhost (fwdproxy-prn-009.fbsv.net. [2a03:2880:ff:9::face:b00c]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cfdc4cf655sm1272905a91.38.2024.07.31.06.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 06:15:48 -0700 (PDT) From: David Wei To: netdev@vger.kernel.org Cc: Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Michael Chan , Somnath Kotur , David Wei Subject: [PATCH net-next v2 2/4] bnxt_en: set vnic->mru in bnxt_hwrm_vnic_cfg() Date: Wed, 31 Jul 2024 06:15:40 -0700 Message-ID: <20240731131542.3359733-3-dw@davidwei.uk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240731131542.3359733-1-dw@davidwei.uk> References: <20240731131542.3359733-1-dw@davidwei.uk> 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 Set the newly added vnic->mru field in bnxt_hwrm_vnic_cfg(). Signed-off-by: David Wei --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 52998065956e..8822d7a17fbf 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -6579,7 +6579,8 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic) req->dflt_ring_grp = cpu_to_le16(bp->grp_info[grp_idx].fw_grp_id); req->lb_rule = cpu_to_le16(0xffff); vnic_mru: - req->mru = cpu_to_le16(bp->dev->mtu + ETH_HLEN + VLAN_HLEN); + vnic->mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN; + req->mru = cpu_to_le16(vnic->mru); req->vnic_id = cpu_to_le16(vnic->fw_vnic_id); #ifdef CONFIG_BNXT_SRIOV From patchwork Wed Jul 31 13:15:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13748796 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 EC00A1B14F9 for ; Wed, 31 Jul 2024 13:15:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722431752; cv=none; b=mPGsUtSJ13x2k9FlP0K4RYnZV8rE96gboqHbTZJxXTRsprRaGEhcM0Jh7OWEExw4BTuwG1mpNCY+e2eUu2sSobAGXqyfQNu72gb0N5g3QtgGXv9HuiCLan+Y/BTeQxiTSTjP8xDZkd8dAnffBMlSLAXkB/UCBjiSBgdBP+1wN/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722431752; c=relaxed/simple; bh=qo1WSz+DwSUqU7HhNHqK7kdtYZRK+oTo7qEoP+pgsvs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OxrhZwzV5VWOggfFkY097oq+Pqtv9ozJZYCRZbVYu7yvamBXrpe+ngxZBgOAtMgSXV33j//Cwwk6sfVFMFjNS6ZLQzYCgp+XCwBOlZHy4Xc9cB8kFQFDb7PEoZMj3nH616Ac9iUxgG1eBb4J5Hnz48niOlxz1FqTnqRDH0WKAJ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=uSsA3imR; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="uSsA3imR" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1ff3d5c6e9eso13724335ad.1 for ; Wed, 31 Jul 2024 06:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1722431750; x=1723036550; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uuFr+V/Moo3zBNEjQ8Mn/A7f6EiWmcuh1Yg65Fn2eZ8=; b=uSsA3imRVX0PcYZ2L6VUU3Sscmw7lDX89n7Yxd+Gl8lFbAMRWsuNoEqfJostGTinWD HAehYJVPrr/s6+5d8zttKoZWQ91Q41QYKD4wfY6Vk6v7cZgs5JmC4mIi15NClg06lt7I 3asjRLW1aVxUzjqttSkAT2rbL3rSIB/VTWWC1b5oTEaoGt8V2fNdWlREL3dJG0jMDW3f ZMuJ+jkXd9F9pfTxQeXCisBAJp7bfXqm0RoE68YmygCG10U5NQqbDoeQUz7U9K+Lly+g hYqA4y0xd+GwT7o2d+zOWbt4nMSWk2L10iCsJjLrRR9dYoPj8BkcyRfY0K1BWG6IPT+E eEbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722431750; x=1723036550; h=content-transfer-encoding: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=uuFr+V/Moo3zBNEjQ8Mn/A7f6EiWmcuh1Yg65Fn2eZ8=; b=qsOymifQG70DnpA7ng5LLpOiKTftkL2fJ3CpkQSdd8ZecJnb3gP6BqUFIzlLbtu9B7 zkICHohFNwBYm3shO+3/LsXzAguN/IMfMFHMiXb3kTU7tVFtkCPhNzMZUX5C2apGtuhQ wiZg1AZKSgX9xjh8ueGPw6uj3j+6PdOwgdV9KWGNRtKkPWtlj1q4cP9EtyBc7wG1WsWC hRFG1s6JB/8CkZkqfag8XW4PVzlxXfRAzgXNK4P7+0SCE5R8BzN2NyDkaQgFvL/TsP6p UFFeRyRIWFDocbcGDUNzPJ38svxYf7TZHyWSfsgqdVblAPuX7cIM21faHj6+t0UMAvc1 rxUA== X-Gm-Message-State: AOJu0YyWQq2A9czdA63FWrQXSaFsy4AdTnn3qFBELg4qx/E5lIUjW5Cq avS/oHq87k66JbE3iLBQq/lFCmU0BHLChlw6GOjQOBZcsnl/zFmbqCSzKZj8qX6Fxv+t3N54HWs 9JJY= X-Google-Smtp-Source: AGHT+IHW0IBl5fFZrLdxUlLX8ZYQqtD5Xmkh8QgTVIucuUD8sqTiyTM7WASWtjkGc1fkM0VQ3EEBEA== X-Received: by 2002:a17:902:e84a:b0:1fb:35c7:8ea4 with SMTP id d9443c01a7336-1ff04808980mr136504945ad.2.1722431749940; Wed, 31 Jul 2024 06:15:49 -0700 (PDT) Received: from localhost (fwdproxy-prn-116.fbsv.net. [2a03:2880:ff:74::face:b00c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fed7ee1241sm120743955ad.172.2024.07.31.06.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 06:15:49 -0700 (PDT) From: David Wei To: netdev@vger.kernel.org Cc: Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Michael Chan , Somnath Kotur , David Wei Subject: [PATCH net-next v2 3/4] bnxt_en: stop packet flow during bnxt_queue_stop/start Date: Wed, 31 Jul 2024 06:15:41 -0700 Message-ID: <20240731131542.3359733-4-dw@davidwei.uk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240731131542.3359733-1-dw@davidwei.uk> References: <20240731131542.3359733-1-dw@davidwei.uk> 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 The current implementation when resetting a queue while packets are flowing puts the queue into an inconsistent state. There needs to be some synchronisation with the FW. Add calls to bnxt_hwrm_vnic_update() to set the MRU for both the default and ntuple vnic during queue start/stop. When the MRU is set to 0, flow is stopped. Each Rx queue belongs to either the default or the ntuple vnic. With calling bnxt_hwrm_vnic_update() the calls to napi_enable() and napi_disable() must be removed for reset to work on a queue that has active traffic flowing e.g. iperf3. Co-developed-by: Somnath Kotur Signed-off-by: Somnath Kotur Signed-off-by: David Wei --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 8822d7a17fbf..ce60c9322fe6 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -15172,7 +15172,8 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx) struct bnxt *bp = netdev_priv(dev); struct bnxt_rx_ring_info *rxr, *clone; struct bnxt_cp_ring_info *cpr; - int rc; + struct bnxt_vnic_info *vnic; + int i, rc; rxr = &bp->rx_ring[idx]; clone = qmem; @@ -15197,11 +15198,16 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx) if (bp->flags & BNXT_FLAG_AGG_RINGS) bnxt_db_write(bp, &rxr->rx_agg_db, rxr->rx_agg_prod); - napi_enable(&rxr->bnapi->napi); - cpr = &rxr->bnapi->cp_ring; cpr->sw_stats->rx.rx_resets++; + for (i = 0; i <= BNXT_VNIC_NTUPLE; i++) { + vnic = &bp->vnic_info[i]; + vnic->mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN; + bnxt_hwrm_vnic_update(bp, vnic, + VNIC_UPDATE_REQ_ENABLES_MRU_VALID); + } + return 0; err_free_hwrm_rx_ring: @@ -15213,9 +15219,17 @@ static int bnxt_queue_stop(struct net_device *dev, void *qmem, int idx) { struct bnxt *bp = netdev_priv(dev); struct bnxt_rx_ring_info *rxr; + struct bnxt_vnic_info *vnic; + int i; + + for (i = 0; i <= BNXT_VNIC_NTUPLE; i++) { + vnic = &bp->vnic_info[i]; + vnic->mru = 0; + bnxt_hwrm_vnic_update(bp, vnic, + VNIC_UPDATE_REQ_ENABLES_MRU_VALID); + } rxr = &bp->rx_ring[idx]; - napi_disable(&rxr->bnapi->napi); bnxt_hwrm_rx_ring_free(bp, rxr, false); bnxt_hwrm_rx_agg_ring_free(bp, rxr, false); rxr->rx_next_cons = 0; From patchwork Wed Jul 31 13:15:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13748797 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 0AF011B1510 for ; Wed, 31 Jul 2024 13:15:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722431753; cv=none; b=kk8nwZZlD2EipasSpD6hYwdrD/i7j+eftfDCWczzqFlLu1mA2Acy4nrAlISCE5SK7xDvlcKAWl4vz+yAW+Uy/Mt1gJMJi6Lf1hg4AujDt7TD1QDOXUEuZKGuYPZIKH1HZjc0L7Dv1+TcLzqR+pGmQ1xvvuLYx156qL3wsSFQu20= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722431753; c=relaxed/simple; bh=tXrNhEtYj51EG3loVWDEE8cFvUlVg8YXAdF5iRelxyc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n4OAhcUJQ1MlvzpIWG65Mz52/kqwdCAYsG0nRsIHqkBNvRi5I+A9/pXCRim+Qu0vOybBQXDZicwJ0n2s0H+b1of3JbyS/+jma173Rc1Jq6ElvqhIwOLc9pwdZJZFkm7+IUW/K1Rgz8s2OWcenXlyM0ww2cbyglgI0cnc3OhUwZk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=NPzsenht; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="NPzsenht" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1fc6ee64512so40754715ad.0 for ; Wed, 31 Jul 2024 06:15:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1722431751; x=1723036551; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eXxjmz+occooGbVYmoKul8P4v5h5JtRlfw54Rb+UbI4=; b=NPzsenht2ZwKzrAfG0VWtA+SV3LnrKOVX1Kvsbe9KHvbdoxzvkBBGrP6IpOqIe1Ivm H3XZm11Ym/FKAnogmZtWW91c9bS6cy4ltjLiycO7378X5xpJcxPFlnrqo8sYJOzVi1vY bj3EgnFI95bQMM70nfdc3dFs69RbvNUH9D3uV1Qo6bgF68e2jmI5PF/4AGiw2/4impGG jI4Q87tAA0k0vXVsrD6rDdqLrbyhw0w/jfGrvEeLhbL6xi5VRPeS+r6eZQy8gbFRBj5K PFRLxvjphn04Ui7JR2OYkU/5g4GS7tcQiFNMWUH6mEJGsaU/tGa9bl3/ooOfUdT1v68p rBwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722431751; x=1723036551; h=content-transfer-encoding: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=eXxjmz+occooGbVYmoKul8P4v5h5JtRlfw54Rb+UbI4=; b=QQk4N08ibfth81uXXI8EHSVGUGNQhRBLSnbO4mn1/5SMB2SxmqIRhiC7qNYV90vL4c f9NQk3uvkM6Re882Wci1TtYzztcDcbos0h+7efh6zkgmYBheDFpNSG7nR+OLYXQPzEbE nO0dbdoN+/hK7l8p+ybRN9SGHNeqa4OW4GxmBC+VQJDuZZu9oW4qLhlpxdY8xiTYPB8I Q5emMOhad4H2KYHpTRYiaTGL7omXk6bigZ96N5nV1TkqMc6JCtj/S8/Lr9KNdiTG61rF HYWHTTRBImhKkDGcN5X2KugicZRBdLSpFKAafeBLn/xZIFEKvbvaDw9i3O4iCK+TlYHG cIaw== X-Gm-Message-State: AOJu0YxSpamx4Cypio4kCc8zQNqYNqmI0iXnZGHQnm6HXuyZdDkInfuZ F//abEOn5JrFQ9AIFvwAfyoc95LCOISHC7v5c+u1EE/gaS0RObHS4C+ff9XYU5RlIr4/x+SFwi4 jVtA= X-Google-Smtp-Source: AGHT+IHEb1JlgJH1dOdGirOsMzgi4Krr9MU8bpCrOmCnWKOPe34lEvBWwGFO8i8UCUI4QZkH3Qapcw== X-Received: by 2002:a17:903:228d:b0:1fd:74ca:df49 with SMTP id d9443c01a7336-1ff0484a657mr144810895ad.33.1722431750983; Wed, 31 Jul 2024 06:15:50 -0700 (PDT) Received: from localhost (fwdproxy-prn-115.fbsv.net. [2a03:2880:ff:73::face:b00c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fed7fa8806sm119888415ad.262.2024.07.31.06.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 06:15:50 -0700 (PDT) From: David Wei To: netdev@vger.kernel.org Cc: Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Michael Chan , Somnath Kotur , David Wei Subject: [PATCH net-next v2 4/4] bnxt_en: only set dev->queue_mgmt_ops if BNXT_SUPPORTS_NTUPLE_VNIC Date: Wed, 31 Jul 2024 06:15:42 -0700 Message-ID: <20240731131542.3359733-5-dw@davidwei.uk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240731131542.3359733-1-dw@davidwei.uk> References: <20240731131542.3359733-1-dw@davidwei.uk> 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 The queue API calls bnxt_hwrm_vnic_update() to stop/start the flow of packets. It can only be called if BNXT_SUPPORTS_NTUPLE_VNIC(), so key support for it by only setting queue_mgmt_ops if this is true. Signed-off-by: David Wei --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index ce60c9322fe6..2801ae94d87b 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -15713,7 +15713,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) dev->stat_ops = &bnxt_stat_ops; dev->watchdog_timeo = BNXT_TX_TIMEOUT; dev->ethtool_ops = &bnxt_ethtool_ops; - dev->queue_mgmt_ops = &bnxt_queue_mgmt_ops; pci_set_drvdata(pdev, dev); rc = bnxt_alloc_hwrm_resources(bp); @@ -15892,8 +15891,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) INIT_LIST_HEAD(&bp->usr_fltr_list); - if (BNXT_SUPPORTS_NTUPLE_VNIC(bp)) + if (BNXT_SUPPORTS_NTUPLE_VNIC(bp)) { bp->rss_cap |= BNXT_RSS_CAP_MULTI_RSS_CTX; + dev->queue_mgmt_ops = &bnxt_queue_mgmt_ops; + } rc = register_netdev(dev); if (rc)