/* Purpose of this file is to share functionality to allowlist or denylist * opcodes used in PF <-> VF communication. Group of opcodes: * - default -> should be always allowed after creating VF, * default_allowlist_opcodes * - opcodes needed by VF to work correctly, but not associated with caps -> * should be allowed after successful VF resources allocation, * working_allowlist_opcodes * - opcodes needed by VF when caps are activated * * Caps that don't use new opcodes (no opcodes should be allowed): * - VIRTCHNL_VF_OFFLOAD_WB_ON_ITR * - VIRTCHNL_VF_OFFLOAD_CRC * - VIRTCHNL_VF_OFFLOAD_RX_POLLING * - VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 * - VIRTCHNL_VF_OFFLOAD_ENCAP * - VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM * - VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM * - VIRTCHNL_VF_OFFLOAD_USO
*/
/* default opcodes to communicate with VF */ staticconst u32 default_allowlist_opcodes[] = {
VIRTCHNL_OP_GET_VF_RESOURCES, VIRTCHNL_OP_VERSION, VIRTCHNL_OP_RESET_VF,
};
/** * ice_vc_is_opcode_allowed - check if this opcode is allowed on this VF * @vf: pointer to VF structure * @opcode: virtchnl opcode * * Return true if message is allowed on this VF
*/ bool ice_vc_is_opcode_allowed(struct ice_vf *vf, u32 opcode)
{ if (opcode >= VIRTCHNL_OP_MAX) returnfalse;
return test_bit(opcode, vf->opcodes_allowlist);
}
/** * ice_vc_allowlist_opcodes - allowlist selected opcodes * @vf: pointer to VF structure * @opcodes: array of opocodes to allowlist * @size: size of opcodes array * * Function should be called to allowlist opcodes on VF.
*/ staticvoid
ice_vc_allowlist_opcodes(struct ice_vf *vf, const u32 *opcodes, size_t size)
{ unsignedint i;
for (i = 0; i < size; i++)
set_bit(opcodes[i], vf->opcodes_allowlist);
}
/** * ice_vc_set_working_allowlist - allowlist opcodes needed to by VF to work * @vf: pointer to VF structure * * allowlist opcodes that aren't associated with specific caps, but * are needed by VF to work.
*/ void ice_vc_set_working_allowlist(struct ice_vf *vf)
{
ice_vc_allowlist_opcodes(vf, working_allowlist_opcodes,
ARRAY_SIZE(working_allowlist_opcodes));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.