Lines Matching defs:chain
13 * into the chain number. This is UAPI.
24 /* PSFP chain and block ID */
28 static int ocelot_chain_to_block(int chain, bool ingress)
33 if (chain == 0)
38 /* Backwards compatibility with older, single-chain tc-flower
41 if (chain == 0)
45 if (chain == VCAP_IS1_CHAIN(lookup))
50 if (chain == VCAP_IS2_CHAIN(lookup, pag))
53 if (chain == OCELOT_PSFP_CHAIN)
59 /* Caller must ensure this is a valid IS1 or IS2 chain first,
62 static int ocelot_chain_to_lookup(int chain)
64 /* Backwards compatibility with older, single-chain tc-flower
67 if (chain == 0)
70 return (chain / VCAP_LOOKUP) % 10;
73 /* Caller must ensure this is a valid IS2 chain first,
76 static int ocelot_chain_to_pag(int chain)
80 /* Backwards compatibility with older, single-chain tc-flower
83 if (chain == 0)
86 lookup = ocelot_chain_to_lookup(chain);
88 /* calculate PAG value as chain index relative to the first PAG */
89 return chain - VCAP_IS2_CHAIN(lookup, 0);
92 static bool ocelot_is_goto_target_valid(int goto_target, int chain,
102 if (chain == 0)
111 if (chain == VCAP_IS1_CHAIN(0))
114 if (chain == VCAP_IS1_CHAIN(1))
119 * value encoding a VCAP IS2 target chain.
121 if (chain == VCAP_IS1_CHAIN(2)) {
133 if (chain == VCAP_IS2_CHAIN(0, pag))
138 if (chain == VCAP_IS2_CHAIN(1, pag))
145 ocelot_find_vcap_filter_that_points_at(struct ocelot *ocelot, int chain)
151 block_id = ocelot_chain_to_block(chain, true);
160 filter->goto_target == chain)
165 if (filter->goto_target == chain)
240 int i, chain, egress_port;
249 chain = f->common.chain_index;
250 filter->block_id = ocelot_chain_to_block(chain, ingress);
252 NL_SET_ERR_MSG_MOD(extack, "Cannot offload to this chain");
256 filter->lookup = ocelot_chain_to_lookup(chain);
258 filter->pag = ocelot_chain_to_pag(chain);
490 "Gate action can only be offloaded to PSFP chain");
503 chain == 0 || filter->block_id == PSFP_BLOCK_ID) {
511 if (!ocelot_is_goto_target_valid(filter->goto_target, chain, ingress) &&
873 int chain = f->common.chain_index;
876 if (chain && !ocelot_find_vcap_filter_that_points_at(ocelot, chain)) {
877 NL_SET_ERR_MSG_MOD(extack, "No default GOTO action points to this chain");
881 block_id = ocelot_chain_to_block(chain, ingress);
883 NL_SET_ERR_MSG_MOD(extack, "Cannot offload to this chain");
929 NL_SET_ERR_MSG_MOD(extack, "PSFP chain is not supported in HW");