#define _ROC_NIX_H_
/* Constants */
+#define ROC_NIX_BPF_LEVEL_IDX_INVALID 0xFF
+
enum roc_nix_rss_reta_sz {
ROC_NIX_RSS_RETA_SZ_64 = 64,
ROC_NIX_RSS_RETA_SZ_128 = 128,
ROC_NIX_VLAN_TYPE_OUTER = 0x02,
};
+enum roc_nix_bpf_level_flag {
+ ROC_NIX_BPF_LEVEL_F_LEAF = BIT(0),
+ ROC_NIX_BPF_LEVEL_F_MID = BIT(1),
+ ROC_NIX_BPF_LEVEL_F_TOP = BIT(2),
+};
+
struct roc_nix_vlan_config {
uint32_t type;
union {
bool __roc_api roc_nix_tm_is_user_hierarchy_enabled(struct roc_nix *nix);
int __roc_api roc_nix_tm_tree_type_get(struct roc_nix *nix);
+/* Ingress Policer API */
+uint8_t __roc_api
+roc_nix_bpf_level_to_idx(enum roc_nix_bpf_level_flag lvl_flag);
+
/* MAC */
int __roc_api roc_nix_mac_rxtx_start_stop(struct roc_nix *roc_nix, bool start);
int __roc_api roc_nix_mac_link_event_start_stop(struct roc_nix *roc_nix,
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "roc_api.h"
+#include "roc_priv.h"
+
+uint8_t
+roc_nix_bpf_level_to_idx(enum roc_nix_bpf_level_flag level_f)
+{
+ uint8_t idx;
+
+ if (level_f & ROC_NIX_BPF_LEVEL_F_LEAF)
+ idx = 0;
+ else if (level_f & ROC_NIX_BPF_LEVEL_F_MID)
+ idx = 1;
+ else if (level_f & ROC_NIX_BPF_LEVEL_F_TOP)
+ idx = 2;
+ else
+ idx = ROC_NIX_BPF_LEVEL_IDX_INVALID;
+ return idx;
+}
case NIX_ERR_OP_NOTSUP:
err_msg = "Operation not supported";
break;
+ case NIX_ERR_HW_NOTSUP:
+ err_msg = "Hardware does not support";
+ break;
case NIX_ERR_QUEUE_INVALID_RANGE:
err_msg = "Invalid Queue range";
break;