return 0;
}
+static int
+npc_parse_msns_action(struct roc_npc *roc_npc, const struct roc_npc_action *act,
+ struct roc_npc_flow *flow, uint8_t *has_msns_action)
+{
+ const struct roc_npc_sec_action *sec_action;
+ union {
+ uint64_t reg;
+ union nix_rx_vtag_action_u act;
+ } vtag_act;
+
+ if (roc_npc->roc_nix->custom_sa_action == 0 ||
+ roc_model_is_cn9k() == 1 || act->conf == NULL)
+ return 0;
+
+ *has_msns_action = true;
+ sec_action = act->conf;
+
+ vtag_act.reg = 0;
+ vtag_act.act.sa_xor = sec_action->sa_xor;
+ vtag_act.act.sa_hi = sec_action->sa_hi;
+ vtag_act.act.sa_lo = sec_action->sa_lo;
+
+ switch (sec_action->alg) {
+ case ROC_NPC_SEC_ACTION_ALG0:
+ break;
+ case ROC_NPC_SEC_ACTION_ALG1:
+ vtag_act.act.vtag1_valid = false;
+ vtag_act.act.vtag1_lid = ROC_NPC_SEC_ACTION_ALG1;
+ break;
+ case ROC_NPC_SEC_ACTION_ALG2:
+ vtag_act.act.vtag1_valid = false;
+ vtag_act.act.vtag1_lid = ROC_NPC_SEC_ACTION_ALG2;
+ break;
+ default:
+ return -1;
+ }
+
+ flow->vtag_action = vtag_act.reg;
+
+ return 0;
+}
+
static int
npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
const struct roc_npc_action actions[],
const struct roc_npc_action_queue *act_q;
const struct roc_npc_action_vf *vf_act;
bool vlan_insert_action = false;
+ uint8_t has_msns_act = 0;
int sel_act, req_act = 0;
uint16_t pf_func, vf_id;
+ struct roc_nix *roc_nix;
int errcode = 0;
int mark = 0;
int rq = 0;
+ int rc = 0;
/* Initialize actions */
flow->ctr_id = NPC_COUNTER_NONE;
*/
req_act |= ROC_NPC_ACTION_TYPE_SEC;
rq = 0;
+ roc_nix = roc_npc->roc_nix;
/* Special processing when with inline device */
- if (roc_nix_inb_is_with_inl_dev(roc_npc->roc_nix) &&
+ if (roc_nix_inb_is_with_inl_dev(roc_nix) &&
roc_nix_inl_dev_is_probed()) {
- rq = 0;
+ struct roc_nix_rq *inl_rq;
+
+ inl_rq = roc_nix_inl_dev_rq(roc_nix);
+ if (!inl_rq) {
+ errcode = NPC_ERR_INTERNAL;
+ goto err_exit;
+ }
+ rq = inl_rq->qid;
pf_func = nix_inl_dev_pffunc_get();
}
+ rc = npc_parse_msns_action(roc_npc, actions, flow,
+ &has_msns_act);
+ if (rc) {
+ errcode = NPC_ERR_ACTION_NOTSUP;
+ goto err_exit;
+ }
break;
case ROC_NPC_ACTION_TYPE_VLAN_STRIP:
req_act |= ROC_NPC_ACTION_TYPE_VLAN_STRIP;
goto err_exit;
}
+ if (has_msns_act && (vlan_insert_action ||
+ (req_act & ROC_NPC_ACTION_TYPE_VLAN_STRIP))) {
+ plt_err("Both MSNS and VLAN insert/strip action can't be supported"
+ " together");
+ errcode = NPC_ERR_ACTION_NOTSUP;
+ goto err_exit;
+ }
+
/* Both STRIP and INSERT actions are not supported */
if (vlan_insert_action && (req_act & ROC_NPC_ACTION_TYPE_VLAN_STRIP)) {
errcode = NPC_ERR_ACTION_NOTSUP;