return rc;
}
- sz = npc->flow_max_priority * sizeof(struct npc_mcam_ents_info);
- npc->flow_entry_info = plt_zmalloc(sz, 0);
- if (npc->flow_entry_info == NULL) {
- plt_err("flow_entry_info alloc failed");
- rc = NPC_ERR_NO_MEM;
- goto done;
- }
-
- sz = npc->flow_max_priority * sizeof(struct plt_bitmap *);
- npc->free_entries = plt_zmalloc(sz, 0);
- if (npc->free_entries == NULL) {
- plt_err("free_entries alloc failed");
- rc = NPC_ERR_NO_MEM;
- goto done;
- }
-
- sz = npc->flow_max_priority * sizeof(struct plt_bitmap *);
- npc->free_entries_rev = plt_zmalloc(sz, 0);
- if (npc->free_entries_rev == NULL) {
- plt_err("free_entries_rev alloc failed");
- rc = NPC_ERR_NO_MEM;
- goto done;
- }
-
- sz = npc->flow_max_priority * sizeof(struct plt_bitmap *);
- npc->live_entries = plt_zmalloc(sz, 0);
- if (npc->live_entries == NULL) {
- plt_err("live_entries alloc failed");
- rc = NPC_ERR_NO_MEM;
- goto done;
- }
-
- sz = npc->flow_max_priority * sizeof(struct plt_bitmap *);
- npc->live_entries_rev = plt_zmalloc(sz, 0);
- if (npc->live_entries_rev == NULL) {
- plt_err("live_entries_rev alloc failed");
- rc = NPC_ERR_NO_MEM;
- goto done;
- }
-
sz = npc->flow_max_priority * sizeof(struct npc_flow_list);
npc->flow_list = plt_zmalloc(sz, 0);
if (npc->flow_list == NULL) {
goto done;
}
+ sz = npc->flow_max_priority * sizeof(struct npc_prio_flow_list_head);
+ npc->prio_flow_list = plt_zmalloc(sz, 0);
+ if (npc->prio_flow_list == NULL) {
+ plt_err("prio_flow_list alloc failed");
+ rc = NPC_ERR_NO_MEM;
+ goto done;
+ }
+
npc_mem = mem;
for (idx = 0; idx < npc->flow_max_priority; idx++) {
TAILQ_INIT(&npc->flow_list[idx]);
-
- npc->free_entries[idx] =
- plt_bitmap_init(npc->mcam_entries, mem, bmap_sz);
- mem += bmap_sz;
-
- npc->free_entries_rev[idx] =
- plt_bitmap_init(npc->mcam_entries, mem, bmap_sz);
- mem += bmap_sz;
-
- npc->live_entries[idx] =
- plt_bitmap_init(npc->mcam_entries, mem, bmap_sz);
- mem += bmap_sz;
-
- npc->live_entries_rev[idx] =
- plt_bitmap_init(npc->mcam_entries, mem, bmap_sz);
- mem += bmap_sz;
-
- npc->flow_entry_info[idx].free_ent = 0;
- npc->flow_entry_info[idx].live_ent = 0;
- npc->flow_entry_info[idx].max_id = 0;
- npc->flow_entry_info[idx].min_id = ~(0);
+ TAILQ_INIT(&npc->prio_flow_list[idx]);
}
npc->rss_grps = NPC_RSS_GRPS;
done:
if (npc->flow_list)
plt_free(npc->flow_list);
- if (npc->live_entries_rev)
- plt_free(npc->live_entries_rev);
- if (npc->live_entries)
- plt_free(npc->live_entries);
- if (npc->free_entries_rev)
- plt_free(npc->free_entries_rev);
- if (npc->free_entries)
- plt_free(npc->free_entries);
- if (npc->flow_entry_info)
- plt_free(npc->flow_entry_info);
+ if (npc->prio_flow_list)
+ plt_free(npc->prio_flow_list);
if (npc_mem)
plt_free(npc_mem);
return rc;
npc->flow_list = NULL;
}
- if (npc->live_entries_rev) {
- plt_free(npc->live_entries_rev);
- npc->live_entries_rev = NULL;
- }
-
- if (npc->live_entries) {
- plt_free(npc->live_entries);
- npc->live_entries = NULL;
- }
-
- if (npc->free_entries_rev) {
- plt_free(npc->free_entries_rev);
- npc->free_entries_rev = NULL;
- }
-
- if (npc->free_entries) {
- plt_free(npc->free_entries);
- npc->free_entries = NULL;
- }
-
- if (npc->flow_entry_info) {
- plt_free(npc->flow_entry_info);
- npc->flow_entry_info = NULL;
+ if (npc->prio_flow_list) {
+ plt_free(npc->prio_flow_list);
+ npc->prio_flow_list = NULL;
}
return 0;
}
static int
-npc_parse_actions(struct npc *npc, const struct roc_npc_attr *attr,
+npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
const struct roc_npc_action actions[],
struct roc_npc_flow *flow)
{
+ struct npc *npc = roc_npc_to_npc_priv(roc_npc);
const struct roc_npc_action_mark *act_mark;
+ const struct roc_npc_action_meter *act_mtr;
const struct roc_npc_action_queue *act_q;
const struct roc_npc_action_vf *vf_act;
bool vlan_insert_action = false;
* NPC_SECURITY_ACTION_TYPE_INLINE_PROTOCOL &&
* session_protocol ==
* NPC_SECURITY_PROTOCOL_IPSEC
- *
- * RSS is not supported with inline ipsec. Get the
- * rq from associated conf, or make
- * ROC_NPC_ACTION_TYPE_QUEUE compulsory with this
- * action.
- * Currently, rq = 0 is assumed.
*/
req_act |= ROC_NPC_ACTION_TYPE_SEC;
rq = 0;
+
+ /* Special processing when with inline device */
+ if (roc_nix_inb_is_with_inl_dev(roc_npc->roc_nix) &&
+ roc_nix_inl_dev_is_probed()) {
+ rq = 0;
+ pf_func = nix_inl_dev_pffunc_get();
+ }
break;
case ROC_NPC_ACTION_TYPE_VLAN_STRIP:
req_act |= ROC_NPC_ACTION_TYPE_VLAN_STRIP;
case ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT:
req_act |= ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT;
break;
+ case ROC_NPC_ACTION_TYPE_METER:
+ act_mtr = (const struct roc_npc_action_meter *)
+ actions->conf;
+ flow->mtr_id = act_mtr->mtr_id;
+ req_act |= ROC_NPC_ACTION_TYPE_METER;
+ break;
default:
errcode = NPC_ERR_ACTION_NOTSUP;
goto err_exit;
}
static int
-npc_parse_rule(struct npc *npc, const struct roc_npc_attr *attr,
+npc_parse_rule(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
const struct roc_npc_item_info pattern[],
const struct roc_npc_action actions[], struct roc_npc_flow *flow,
struct npc_parse_state *pst)
{
+ struct npc *npc = roc_npc_to_npc_priv(roc_npc);
int err;
/* Check attr */
return err;
/* Check action */
- err = npc_parse_actions(npc, attr, actions, flow);
+ err = npc_parse_actions(roc_npc, attr, actions, flow);
if (err)
return err;
return 0;
struct npc_parse_state parse_state = {0};
int rc;
- rc = npc_parse_rule(npc, attr, pattern, actions, flow, &parse_state);
+ rc = npc_parse_rule(roc_npc, attr, pattern, actions, flow,
+ &parse_state);
if (rc)
return rc;
}
memset(flow, 0, sizeof(*flow));
- rc = npc_parse_rule(npc, attr, pattern, actions, flow, &parse_state);
+ rc = npc_parse_rule(roc_npc, attr, pattern, actions, flow,
+ &parse_state);
if (rc != 0) {
*errcode = rc;
goto err_exit;
roc_npc_flow_destroy(struct roc_npc *roc_npc, struct roc_npc_flow *flow)
{
struct npc *npc = roc_npc_to_npc_priv(roc_npc);
- struct plt_bitmap *bmap;
int rc;
rc = npc_rss_group_free(npc, flow);
TAILQ_REMOVE(&npc->flow_list[flow->priority], flow, next);
- bmap = npc->live_entries[flow->priority];
- plt_bitmap_clear(bmap, flow->mcam_id);
+ npc_delete_prio_list_entry(npc, flow);
plt_free(flow);
return 0;