From patchwork Tue Feb 20 23:03:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13564715 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (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 D676F6BB28 for ; Tue, 20 Feb 2024 23:03:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708470238; cv=none; b=sYFmGzzKzVoabxt1J9tXrHQ4R5BwudToXIhGPPJ2KpENFYcOE2VURSOOrliJTKsJlETOUY85i8e02poHWL+AVe460wAX3FcfgYnfNcMPeSGPRrXomBHsgPzTg1N8S9Fwa2T7GpoBibNircwicjQm8uNPsmvzJqVR389p8G4y2zo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708470238; c=relaxed/simple; bh=uKjXJ8tagpzlWX6TtQyZMesghBJXMI4EsEtJDHc88jU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=V4l6Uo/sQ6JOwCpB/CqB1al/wcj5DiJhol8ggF0EKcUTXRx7/BSFMWOTGJp6El4JBBSYV0FPTQjf0uJ7F+ACPiAX6ePwyvKPeAXITpCw53mUs0qaE8IRbbV3bDUMiYhReOq+UckWUJxFI3MZnAPk4+ilFS5dz9p7GAvZdQVvdpM= 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=O6R7Xm+M; arc=none smtp.client-ip=209.85.222.171 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="O6R7Xm+M" Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-7875dc24ecaso204454385a.3 for ; Tue, 20 Feb 2024 15:03:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708470236; x=1709075036; 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=ZF1BreLJO6/bZtgwW9u4DWy93rMTd3sKofzO0AJPhXE=; b=O6R7Xm+M5fw7zeVimoJAeBn++4GtCwkUiv2EjCnenYDvamXFQzASjZ2fam9D/IUziG Yfl5i7prziOdaoM+7TQUGNZNX2rWDR7VVD+72o1qdXzBQG1IW9jYbwRCL1FayJEGOMhG 9GTfpD+VLwBESHkxax3DxNszpnA8AJ0KMwxGI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708470236; x=1709075036; 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=ZF1BreLJO6/bZtgwW9u4DWy93rMTd3sKofzO0AJPhXE=; b=eJMWDopERWIP1TrfzJEomDbu7ii9H6EwPZokSNXdvIK3Z73OAnbeYDcY2s/2hx2ME1 EbEJkPEk3bq5ZHjZcG5WSAMYYNrko+hk7wecqHjTiGA7x7nd60kQj4AIJwSLnzdstn5Q 57WG2TUpzegA5C5Mb3huL7b0iePHUZXaJdLBxD9g1ubYYx7ON3AnUJccC28dk71gIR5Z L/C9FPs4z645571HSdn+RYF4PaQSGguFH3klU5qEHZvG94kMBMdPyFdgB6oBqd/nzKuX CxBv75TE9FTJb9nfw+xSVejXIxqosHH9YCUdJCcsvaB66icanTdYLka4fLIQ7Gu+M1Qp nKkw== X-Gm-Message-State: AOJu0Yx20HGWQnD0O8/sfAB2FMm9gPkju2k80vje1U+l0099KH2PYeBq oIt/EYJeuNBD92TzchtNIPyxnWCbNk+eIR2wchcRQVxp7wBTkb5+aCG53knT2w== X-Google-Smtp-Source: AGHT+IHK9qQG2QxamAzt/ayMqe0gkWyQUekUpbwaZYMvLvJv3dmiT0jfxACoTolV4gELvjOIpRXzRw== X-Received: by 2002:a37:c447:0:b0:787:1dbf:f703 with SMTP id h7-20020a37c447000000b007871dbff703mr17017994qkm.26.1708470235556; Tue, 20 Feb 2024 15:03:55 -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.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2024 15:03:55 -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, Somnath Kotur , Kalesh AP Subject: [PATCH net-next 08/10] bnxt_en: Provision for an additional VNIC for ntuple filters Date: Tue, 20 Feb 2024 15:03:15 -0800 Message-Id: <20240220230317.96341-9-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 On newer chips that support the ring table index method for ntuple filters, the current scheme of using the same VNIC for both RSS and ntuple filters will not work in all cases. An ntuple filter can only be directed to a destination ring if that destination ring is also in the RSS indirection table. To support ntuple filters with any arbitratry RSS indirection table that may only include a subset of the rings, we need to use a separate VNIC for ntuple filters. This patch provisions the additional VNIC. The next patch will allocate additional VNIC from firmware and set it up. Reviewed-by: Somnath Kotur Reviewed-by: Kalesh AP Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 33 +++++++++++++++++++---- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 +++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 8877043febd2..0ca9dd397622 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -4211,8 +4211,12 @@ static int bnxt_alloc_vnics(struct bnxt *bp) int num_vnics = 1; #ifdef CONFIG_RFS_ACCEL - if ((bp->flags & (BNXT_FLAG_RFS | BNXT_FLAG_CHIP_P5_PLUS)) == BNXT_FLAG_RFS) - num_vnics += bp->rx_nr_rings; + if (bp->flags & BNXT_FLAG_RFS) { + if (BNXT_SUPPORTS_NTUPLE_VNIC(bp)) + num_vnics++; + else if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS)) + num_vnics += bp->rx_nr_rings; + } #endif if (BNXT_CHIP_TYPE_NITRO_A0(bp)) @@ -7284,9 +7288,13 @@ static int bnxt_get_total_rss_ctxs(struct bnxt *bp, struct bnxt_hw_rings *hwr) { if (!hwr->grp) return 0; - if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) - return bnxt_get_nr_rss_ctxs(bp, hwr->grp); + if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) { + int rss_ctx = bnxt_get_nr_rss_ctxs(bp, hwr->grp); + if (BNXT_SUPPORTS_NTUPLE_VNIC(bp)) + rss_ctx *= hwr->vnic; + return rss_ctx; + } if (BNXT_VF(bp)) return BNXT_VF_MAX_RSS_CTX; if (!(bp->rss_cap & BNXT_RSS_CAP_NEW_RSS_CAP) && bnxt_rfs_supported(bp)) @@ -7312,6 +7320,8 @@ static void bnxt_check_rss_tbl_no_rmgr(struct bnxt *bp) static int bnxt_get_total_vnics(struct bnxt *bp, int rx_rings) { if (bp->flags & BNXT_FLAG_RFS) { + if (BNXT_SUPPORTS_NTUPLE_VNIC(bp)) + return 2; if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS)) return rx_rings + 1; } @@ -8962,6 +8972,10 @@ static int bnxt_hwrm_cfa_adv_flow_mgnt_qcaps(struct bnxt *bp) CFA_ADV_FLOW_MGNT_QCAPS_RESP_FLAGS_RFS_RING_TBL_IDX_V2_SUPPORTED) bp->fw_cap |= BNXT_FW_CAP_CFA_RFS_RING_TBL_IDX_V2; + if (flags & + CFA_ADV_FLOW_MGNT_QCAPS_RESP_FLAGS_RFS_RING_TBL_IDX_V3_SUPPORTED) + bp->fw_cap |= BNXT_FW_CAP_CFA_RFS_RING_TBL_IDX_V3; + if (flags & CFA_ADV_FLOW_MGNT_QCAPS_RESP_FLAGS_NTUPLE_FLOW_RX_EXT_IP_PROTO_SUPPORTED) bp->fw_cap |= BNXT_FW_CAP_CFA_NTUPLE_RX_EXT_IP_PROTO; @@ -12358,16 +12372,25 @@ static bool bnxt_rfs_capable(struct bnxt *bp) int max_vnics, max_rss_ctxs; hwr.rss_ctx = 1; + if (BNXT_SUPPORTS_NTUPLE_VNIC(bp)) { + /* 2 VNICS: default + Ntuple */ + hwr.vnic = 2; + hwr.rss_ctx = bnxt_get_nr_rss_ctxs(bp, bp->rx_nr_rings) * + hwr.vnic; + goto check_reserve_vnic; + } if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) return bnxt_rfs_supported(bp); if (!(bp->flags & BNXT_FLAG_MSIX_CAP) || !bnxt_can_reserve_rings(bp) || !bp->rx_nr_rings) return false; hwr.vnic = 1 + bp->rx_nr_rings; +check_reserve_vnic: max_vnics = bnxt_get_max_func_vnics(bp); max_rss_ctxs = bnxt_get_max_func_rss_ctxs(bp); - if (!(bp->rss_cap & BNXT_RSS_CAP_NEW_RSS_CAP)) + if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS) && + !(bp->rss_cap & BNXT_RSS_CAP_NEW_RSS_CAP)) hwr.rss_ctx = hwr.vnic; if (hwr.vnic > max_vnics || hwr.rss_ctx > max_rss_ctxs) { diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 328bbf72acaf..e9158407b181 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2328,12 +2328,16 @@ struct bnxt { #define BNXT_FW_CAP_BACKING_STORE_V2 BIT_ULL(36) #define BNXT_FW_CAP_VNIC_TUNNEL_TPA BIT_ULL(37) #define BNXT_FW_CAP_CFA_NTUPLE_RX_EXT_IP_PROTO BIT_ULL(38) + #define BNXT_FW_CAP_CFA_RFS_RING_TBL_IDX_V3 BIT_ULL(39) u32 fw_dbg_cap; #define BNXT_NEW_RM(bp) ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM) #define BNXT_PTP_USE_RTC(bp) (!BNXT_MH(bp) && \ ((bp)->fw_cap & BNXT_FW_CAP_PTP_RTC)) +#define BNXT_SUPPORTS_NTUPLE_VNIC(bp) \ + (BNXT_PF(bp) && ((bp)->fw_cap & BNXT_FW_CAP_CFA_RFS_RING_TBL_IDX_V3)) + u32 hwrm_spec_code; u16 hwrm_cmd_seq; u16 hwrm_cmd_kong_seq;