]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
octeontx2-pf: Do not reallocate all ntuple filters
authorSubbaraya Sundeep <sbhatta@marvell.com>
Mon, 12 May 2025 12:52:37 +0000 (18:22 +0530)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 15 May 2025 10:37:59 +0000 (12:37 +0200)
If ntuple filters count is modified followed by
unicast filters count using devlink then the ntuple count
set by user is ignored and all the ntuple filters are
being reallocated. Fix this by storing the ntuple count
set by user. Without this patch, say if user tries
to modify ntuple count as 8 followed by ucast filter count as 4
using devlink commands then ntuple count is being reverted to
default value 16 i.e, not retaining user set value 8.

Fixes: 39c469188b6d ("octeontx2-pf: Add ucast filter count configurability via devlink.")
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/1747054357-5850-1-git-send-email-sbhatta@marvell.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c
drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c

index 1e88422825be7af5192709908c688deac0a077fe..d6b4b74e4002b128a1fcd5105ab922d63b339ffa 100644 (file)
@@ -356,6 +356,7 @@ struct otx2_flow_config {
        struct list_head        flow_list_tc;
        u8                      ucast_flt_cnt;
        bool                    ntuple;
+       u16                     ntuple_cnt;
 };
 
 struct dev_hw_ops {
index 33ec9a7f7c0339dabbc761619f4fdaaf0de5df12..e13ae5484c19cbb52dd3845aa37d2e98abac3d99 100644 (file)
@@ -41,6 +41,7 @@ static int otx2_dl_mcam_count_set(struct devlink *devlink, u32 id,
        if (!pfvf->flow_cfg)
                return 0;
 
+       pfvf->flow_cfg->ntuple_cnt = ctx->val.vu16;
        otx2_alloc_mcam_entries(pfvf, ctx->val.vu16);
 
        return 0;
index 47bfd1fb37d4bcac55ac660fd1756787bb38de61..64c6d9162ef644199703d7131624d6338d969779 100644 (file)
@@ -247,7 +247,7 @@ int otx2_mcam_entry_init(struct otx2_nic *pfvf)
        mutex_unlock(&pfvf->mbox.lock);
 
        /* Allocate entries for Ntuple filters */
-       count = otx2_alloc_mcam_entries(pfvf, OTX2_DEFAULT_FLOWCOUNT);
+       count = otx2_alloc_mcam_entries(pfvf, flow_cfg->ntuple_cnt);
        if (count <= 0) {
                otx2_clear_ntuple_flow_info(pfvf, flow_cfg);
                return 0;
@@ -307,6 +307,7 @@ int otx2_mcam_flow_init(struct otx2_nic *pf)
        INIT_LIST_HEAD(&pf->flow_cfg->flow_list_tc);
 
        pf->flow_cfg->ucast_flt_cnt = OTX2_DEFAULT_UNICAST_FLOWS;
+       pf->flow_cfg->ntuple_cnt = OTX2_DEFAULT_FLOWCOUNT;
 
        /* Allocate bare minimum number of MCAM entries needed for
         * unicast and ntuple filters.