Re: [net-next PATCH V2] octeontx2-af: Install TC filter rules in hardware based on priority

From: Leon Romanovsky
Date: Mon Jul 17 2023 - 01:47:34 EST


On Sun, Jul 16, 2023 at 11:54:42PM +0530, Suman Ghosh wrote:
> As of today, hardware does not support installing tc filter
> rules based on priority. This patch fixes the issue and install
> the hardware rules based on priority. The final hardware rules
> will not be dependent on rule installation order, it will be strictly
> priority based, same as software.
>
> Signed-off-by: Suman Ghosh <sumang@xxxxxxxxxxx>
> ---
> Changes since v1:
> - Rebased the patch on top of current 'main' branch
>
> .../net/ethernet/marvell/octeontx2/af/mbox.h | 9 +-
> .../marvell/octeontx2/af/rvu_npc_fs.c | 9 +-
> .../marvell/octeontx2/af/rvu_switch.c | 6 +-
> .../marvell/octeontx2/nic/otx2_common.h | 11 +-
> .../marvell/octeontx2/nic/otx2_devlink.c | 1 -
> .../marvell/octeontx2/nic/otx2_ethtool.c | 1 +
> .../marvell/octeontx2/nic/otx2_flows.c | 2 +
> .../ethernet/marvell/octeontx2/nic/otx2_tc.c | 313 +++++++++++++-----
> 8 files changed, 248 insertions(+), 104 deletions(-)

<...>

> +static void otx2_tc_del_from_flow_list(struct otx2_flow_config *flow_cfg,
> + struct otx2_tc_flow *node)
> {
> + struct otx2_tc_flow *tmp;
> + struct list_head *pos, *n;

Please declared variables in rversed Christmas tree, in all places, thanks.

> +
> + list_for_each_safe(pos, n, &flow_cfg->flow_list_tc) {
> + tmp = list_entry(pos, struct otx2_tc_flow, list);
> + if (node == tmp) {
> + list_del(&node->list);
> + return;
> + }
> + }
> +}
> +
> +static int otx2_tc_add_to_flow_list(struct otx2_flow_config *flow_cfg,
> + struct otx2_tc_flow *node)
> +{
> + struct otx2_tc_flow *tmp;
> + struct list_head *pos, *n;
> + int index = 0;

Ditto.

> +

<...>

> +static int otx2_del_mcam_flow_entry(struct otx2_nic *nic, u16 entry, u16 *cntr_val)
> +{
> + struct npc_delete_flow_rsp __maybe_unused *rsp;

Why __maybe_unused? This keyword is usually used when in some CONFIG_*
option, it won't be used. It is not the case here.

> struct npc_delete_flow_req *req;
> int err;

<...>

> + ntuple = !!(nic->netdev->features & NETIF_F_NTUPLE);

No need in !! for bool variables.

Thanks