[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231225174403.GN5962@kernel.org>
Date: Mon, 25 Dec 2023 17:44:03 +0000
From: Simon Horman <horms@...nel.org>
To: Michael Chan <michael.chan@...adcom.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, pavan.chebbi@...adcom.com,
andrew.gospodarek@...adcom.com
Subject: Re: [PATCH net-next v2 10/13] bnxt_en: Refactor ntuple filter
removal logic in bnxt_cfg_ntp_filters().
On Fri, Dec 22, 2023 at 08:22:07PM -0800, Michael Chan wrote:
> Refactor the logic into a new function bnxt_del_ntp_filters(). The
> same call will be used when the user deletes an ntuple filter.
>
> The bnxt_hwrm_cfa_ntuple_filter_free() function to call fw to free
> the ntuple filter is exported so that the ethtool logic can call it.
>
> Reviewed-by: Vasundhara Volam <vasundhara-v.volam@...adcom.com>
> Reviewed-by: Andy Gospodarek <andrew.gospodarek@...adcom.com>
> Reviewed-by: Pavan Chebbi <pavan.chebbi@...adcom.com>
> Signed-off-by: Michael Chan <michael.chan@...adcom.com>
Reviewed-by: Simon Horman <horms@...nel.org>
...
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
...
> @@ -14011,6 +14011,21 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
> }
> #endif
>
> +void bnxt_del_ntp_filter(struct bnxt *bp, struct bnxt_ntuple_filter *fltr)
> +{
> + spin_lock_bh(&bp->ntp_fltr_lock);
> + if (!test_and_clear_bit(BNXT_FLTR_INSERTED, &fltr->base.state)) {
> + spin_unlock_bh(&bp->ntp_fltr_lock);
> + return;
> + }
> + hlist_del_rcu(&fltr->base.hash);
> + bp->ntp_fltr_count--;
> + spin_unlock_bh(&bp->ntp_fltr_lock);
> + bnxt_del_l2_filter(bp, fltr->l2_fltr);
> + clear_bit(fltr->base.sw_id, bp->ntp_fltr_bmap);
> + kfree_rcu(fltr, base.rcu);
> +}
> +
> static void bnxt_cfg_ntp_filters(struct bnxt *bp)
> {
> int i;
> @@ -14042,20 +14057,8 @@ static void bnxt_cfg_ntp_filters(struct bnxt *bp)
> set_bit(BNXT_FLTR_VALID, &fltr->base.state);
> }
>
> - if (del) {
> - spin_lock_bh(&bp->ntp_fltr_lock);
> - if (!test_and_clear_bit(BNXT_FLTR_INSERTED, &fltr->base.state)) {
> - spin_unlock_bh(&bp->ntp_fltr_lock);
> - continue;
> - }
> - hlist_del_rcu(&fltr->base.hash);
> - bp->ntp_fltr_count--;
> - spin_unlock_bh(&bp->ntp_fltr_lock);
> - bnxt_del_l2_filter(bp, fltr->l2_fltr);
> - synchronize_rcu();
Nice to see a use of synchronize_rcu() disappear :)
> - clear_bit(fltr->base.sw_id, bp->ntp_fltr_bmap);
> - kfree(fltr);
> - }
> + if (del)
> + bnxt_del_ntp_filter(bp, fltr);
> }
> }
> if (test_and_clear_bit(BNXT_HWRM_PF_UNLOAD_SP_EVENT, &bp->sp_event))
...
Powered by blists - more mailing lists