[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBsKF4r7bARMFNp0@corigine.com>
Date: Wed, 22 Mar 2023 15:00:55 +0100
From: Simon Horman <simon.horman@...igine.com>
To: Felix Fietkau <nbd@....name>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next 2/2] net: ethernet: mediatek: mtk_ppe: prefer
newly added l2 flows over existing ones
On Tue, Mar 21, 2023 at 02:36:09PM +0100, Felix Fietkau wrote:
> When a device is roaming between interfaces and a new flow entry is created,
> we should assume that its output device is more up to date than whatever
> entry existed already.
As per patch 1/2. checkpatch complains that the patch description
has lines more than 75 characters long.
That aside, this change looks good to me.
But I'm wondering if it is fixing a bug.
Or just improving something suboptimal (form a user experience POV).
>
> Signed-off-by: Felix Fietkau <nbd@....name>
> ---
> drivers/net/ethernet/mediatek/mtk_ppe.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
> index 6883eb34cd8b..5e150007bb7d 100644
> --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
> +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
> @@ -580,10 +580,20 @@ void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
> static int
> mtk_foe_entry_commit_l2(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
> {
> + struct mtk_flow_entry *prev;
> +
> entry->type = MTK_FLOW_TYPE_L2;
>
> - return rhashtable_insert_fast(&ppe->l2_flows, &entry->l2_node,
> - mtk_flow_l2_ht_params);
> + prev = rhashtable_lookup_get_insert_fast(&ppe->l2_flows, &entry->l2_node,
> + mtk_flow_l2_ht_params);
> + if (likely(!prev))
> + return 0;
> +
> + if (IS_ERR(prev))
> + return PTR_ERR(prev);
> +
> + return rhashtable_replace_fast(&ppe->l2_flows, &prev->l2_node,
> + &entry->l2_node, mtk_flow_l2_ht_params);
> }
>
> int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
> --
> 2.39.0
>
Powered by blists - more mailing lists