Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ice/virtchnl.h
/* SPDX-License-Identifier: BSD-3-Clause */ | /* SPDX-License-Identifier: BSD-3-Clause */ | ||||
/* Copyright (c) 2022, Intel Corporation | /* Copyright (c) 2023, Intel Corporation | ||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions are met: | * modification, are permitted provided that the following conditions are met: | ||||
* | * | ||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | */ | ||||
VIRTCHNL_OP_GET_QOS_CAPS = 66, | VIRTCHNL_OP_GET_QOS_CAPS = 66, | ||||
VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP = 67, | VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP = 67, | ||||
/* opcode 68 through 70 are reserved */ | /* opcode 68 through 70 are reserved */ | ||||
VIRTCHNL_OP_ENABLE_QUEUES_V2 = 107, | VIRTCHNL_OP_ENABLE_QUEUES_V2 = 107, | ||||
VIRTCHNL_OP_DISABLE_QUEUES_V2 = 108, | VIRTCHNL_OP_DISABLE_QUEUES_V2 = 108, | ||||
VIRTCHNL_OP_MAP_QUEUE_VECTOR = 111, | VIRTCHNL_OP_MAP_QUEUE_VECTOR = 111, | ||||
VIRTCHNL_OP_CONFIG_QUEUE_BW = 112, | VIRTCHNL_OP_CONFIG_QUEUE_BW = 112, | ||||
VIRTCHNL_OP_CONFIG_QUANTA = 113, | VIRTCHNL_OP_CONFIG_QUANTA = 113, | ||||
VIRTCHNL_OP_FLOW_SUBSCRIBE = 114, | |||||
VIRTCHNL_OP_FLOW_UNSUBSCRIBE = 115, | |||||
/* opcode 116 through 128 are reserved */ | |||||
VIRTCHNL_OP_MAX, | VIRTCHNL_OP_MAX, | ||||
}; | }; | ||||
static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode) | static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode) | ||||
{ | { | ||||
switch (v_opcode) { | switch (v_opcode) { | ||||
case VIRTCHNL_OP_UNKNOWN: | case VIRTCHNL_OP_UNKNOWN: | ||||
return "VIRTCHNL_OP_UNKNOWN"; | return "VIRTCHNL_OP_UNKNOWN"; | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode) | ||||
case VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2: | case VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2: | ||||
return "VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2"; | return "VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2"; | ||||
case VIRTCHNL_OP_ENABLE_QUEUES_V2: | case VIRTCHNL_OP_ENABLE_QUEUES_V2: | ||||
return "VIRTCHNL_OP_ENABLE_QUEUES_V2"; | return "VIRTCHNL_OP_ENABLE_QUEUES_V2"; | ||||
case VIRTCHNL_OP_DISABLE_QUEUES_V2: | case VIRTCHNL_OP_DISABLE_QUEUES_V2: | ||||
return "VIRTCHNL_OP_DISABLE_QUEUES_V2"; | return "VIRTCHNL_OP_DISABLE_QUEUES_V2"; | ||||
case VIRTCHNL_OP_MAP_QUEUE_VECTOR: | case VIRTCHNL_OP_MAP_QUEUE_VECTOR: | ||||
return "VIRTCHNL_OP_MAP_QUEUE_VECTOR"; | return "VIRTCHNL_OP_MAP_QUEUE_VECTOR"; | ||||
case VIRTCHNL_OP_FLOW_SUBSCRIBE: | |||||
return "VIRTCHNL_OP_FLOW_SUBSCRIBE"; | |||||
case VIRTCHNL_OP_FLOW_UNSUBSCRIBE: | |||||
return "VIRTCHNL_OP_FLOW_UNSUBSCRIBE"; | |||||
case VIRTCHNL_OP_MAX: | case VIRTCHNL_OP_MAX: | ||||
return "VIRTCHNL_OP_MAX"; | return "VIRTCHNL_OP_MAX"; | ||||
default: | default: | ||||
return "Unsupported (update virtchnl.h)"; | return "Unsupported (update virtchnl.h)"; | ||||
} | } | ||||
} | } | ||||
static inline const char *virtchnl_stat_str(enum virtchnl_status_code v_status) | static inline const char *virtchnl_stat_str(enum virtchnl_status_code v_status) | ||||
▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | |||||
#define VIRTCHNL_VF_OFFLOAD_RSS_REG BIT(4) | #define VIRTCHNL_VF_OFFLOAD_RSS_REG BIT(4) | ||||
#define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR BIT(5) | #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR BIT(5) | ||||
#define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES BIT(6) | #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES BIT(6) | ||||
/* used to negotiate communicating link speeds in Mbps */ | /* used to negotiate communicating link speeds in Mbps */ | ||||
#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED BIT(7) | #define VIRTCHNL_VF_CAP_ADV_LINK_SPEED BIT(7) | ||||
/* BIT(8) is reserved */ | /* BIT(8) is reserved */ | ||||
#define VIRTCHNL_VF_LARGE_NUM_QPAIRS BIT(9) | #define VIRTCHNL_VF_LARGE_NUM_QPAIRS BIT(9) | ||||
#define VIRTCHNL_VF_OFFLOAD_CRC BIT(10) | #define VIRTCHNL_VF_OFFLOAD_CRC BIT(10) | ||||
#define VIRTCHNL_VF_OFFLOAD_FSUB_PF BIT(14) | |||||
#define VIRTCHNL_VF_OFFLOAD_VLAN_V2 BIT(15) | #define VIRTCHNL_VF_OFFLOAD_VLAN_V2 BIT(15) | ||||
#define VIRTCHNL_VF_OFFLOAD_VLAN BIT(16) | #define VIRTCHNL_VF_OFFLOAD_VLAN BIT(16) | ||||
#define VIRTCHNL_VF_OFFLOAD_RX_POLLING BIT(17) | #define VIRTCHNL_VF_OFFLOAD_RX_POLLING BIT(17) | ||||
#define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 BIT(18) | #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 BIT(18) | ||||
#define VIRTCHNL_VF_OFFLOAD_RSS_PF BIT(19) | #define VIRTCHNL_VF_OFFLOAD_RSS_PF BIT(19) | ||||
#define VIRTCHNL_VF_OFFLOAD_ENCAP BIT(20) | #define VIRTCHNL_VF_OFFLOAD_ENCAP BIT(20) | ||||
#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM BIT(21) | #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM BIT(21) | ||||
#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM BIT(22) | #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM BIT(22) | ||||
▲ Show 20 Lines • Show All 986 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
enum virtchnl_vfr_states { | enum virtchnl_vfr_states { | ||||
VIRTCHNL_VFR_INPROGRESS = 0, | VIRTCHNL_VFR_INPROGRESS = 0, | ||||
VIRTCHNL_VFR_COMPLETED, | VIRTCHNL_VFR_COMPLETED, | ||||
VIRTCHNL_VFR_VFACTIVE, | VIRTCHNL_VFR_VFACTIVE, | ||||
}; | }; | ||||
#define VIRTCHNL_MAX_NUM_PROTO_HDRS 32 | #define VIRTCHNL_MAX_NUM_PROTO_HDRS 32 | ||||
#define VIRTCHNL_MAX_NUM_PROTO_HDRS_W_MSK 16 | |||||
#define VIRTCHNL_MAX_SIZE_RAW_PACKET 1024 | #define VIRTCHNL_MAX_SIZE_RAW_PACKET 1024 | ||||
#define PROTO_HDR_SHIFT 5 | #define PROTO_HDR_SHIFT 5 | ||||
#define PROTO_HDR_FIELD_START(proto_hdr_type) \ | #define PROTO_HDR_FIELD_START(proto_hdr_type) \ | ||||
(proto_hdr_type << PROTO_HDR_SHIFT) | (proto_hdr_type << PROTO_HDR_SHIFT) | ||||
#define PROTO_HDR_FIELD_MASK ((1UL << PROTO_HDR_SHIFT) - 1) | #define PROTO_HDR_FIELD_MASK ((1UL << PROTO_HDR_SHIFT) - 1) | ||||
/* VF use these macros to configure each protocol header. | /* VF use these macros to configure each protocol header. | ||||
* Specify which protocol headers and protocol header fields base on | * Specify which protocol headers and protocol header fields base on | ||||
▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | struct virtchnl_proto_hdr { | ||||
* binary buffer in network order for specific header type. | * binary buffer in network order for specific header type. | ||||
* For example, if type = VIRTCHNL_PROTO_HDR_IPV4, a IPv4 | * For example, if type = VIRTCHNL_PROTO_HDR_IPV4, a IPv4 | ||||
* header is expected to be copied into the buffer. | * header is expected to be copied into the buffer. | ||||
*/ | */ | ||||
}; | }; | ||||
VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_proto_hdr); | VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_proto_hdr); | ||||
struct virtchnl_proto_hdr_w_msk { | |||||
/* see enum virtchnl_proto_hdr_type */ | |||||
s32 type; | |||||
u32 pad; | |||||
/** | |||||
* binary buffer in network order for specific header type. | |||||
* For example, if type = VIRTCHNL_PROTO_HDR_IPV4, a IPv4 | |||||
* header is expected to be copied into the buffer. | |||||
*/ | |||||
u8 buffer_spec[64]; | |||||
/* binary buffer for bit-mask applied to specific header type */ | |||||
u8 buffer_mask[64]; | |||||
}; | |||||
VIRTCHNL_CHECK_STRUCT_LEN(136, virtchnl_proto_hdr_w_msk); | |||||
struct virtchnl_proto_hdrs { | struct virtchnl_proto_hdrs { | ||||
u8 tunnel_level; | u8 tunnel_level; | ||||
/** | /** | ||||
* specify where protocol header start from. | * specify where protocol header start from. | ||||
* must be 0 when sending a raw packet request. | * must be 0 when sending a raw packet request. | ||||
* 0 - from the outer layer | * 0 - from the outer layer | ||||
* 1 - from the first inner layer | * 1 - from the first inner layer | ||||
* 2 - from the second inner layer | * 2 - from the second inner layer | ||||
* .... | * .... | ||||
*/ | */ | ||||
int count; | int count; | ||||
/** | /** | ||||
* number of proto layers, must < VIRTCHNL_MAX_NUM_PROTO_HDRS | * count must <= | ||||
* must be 0 for a raw packet request. | * VIRTCHNL_MAX_NUM_PROTO_HDRS + VIRTCHNL_MAX_NUM_PROTO_HDRS_W_MSK | ||||
* count = 0 : select raw | |||||
* 1 < count <= VIRTCHNL_MAX_NUM_PROTO_HDRS : select proto_hdr | |||||
* count > VIRTCHNL_MAX_NUM_PROTO_HDRS : select proto_hdr_w_msk | |||||
* last valid index = count - VIRTCHNL_MAX_NUM_PROTO_HDRS | |||||
*/ | */ | ||||
union { | union { | ||||
struct virtchnl_proto_hdr | struct virtchnl_proto_hdr | ||||
proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS]; | proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS]; | ||||
struct virtchnl_proto_hdr_w_msk | |||||
proto_hdr_w_msk[VIRTCHNL_MAX_NUM_PROTO_HDRS_W_MSK]; | |||||
struct { | struct { | ||||
u16 pkt_len; | u16 pkt_len; | ||||
u8 spec[VIRTCHNL_MAX_SIZE_RAW_PACKET]; | u8 spec[VIRTCHNL_MAX_SIZE_RAW_PACKET]; | ||||
u8 mask[VIRTCHNL_MAX_SIZE_RAW_PACKET]; | u8 mask[VIRTCHNL_MAX_SIZE_RAW_PACKET]; | ||||
} raw; | } raw; | ||||
}; | }; | ||||
}; | }; | ||||
VIRTCHNL_CHECK_STRUCT_LEN(2312, virtchnl_proto_hdrs); | VIRTCHNL_CHECK_STRUCT_LEN(2312, virtchnl_proto_hdrs); | ||||
struct virtchnl_rss_cfg { | struct virtchnl_rss_cfg { | ||||
struct virtchnl_proto_hdrs proto_hdrs; /* protocol headers */ | struct virtchnl_proto_hdrs proto_hdrs; /* protocol headers */ | ||||
/* see enum virtchnl_rss_algorithm; rss algorithm type */ | /* see enum virtchnl_rss_algorithm; rss algorithm type */ | ||||
s32 rss_algorithm; | s32 rss_algorithm; | ||||
u8 reserved[128]; /* reserve for future */ | u8 reserved[128]; /* reserve for future */ | ||||
}; | }; | ||||
VIRTCHNL_CHECK_STRUCT_LEN(2444, virtchnl_rss_cfg); | VIRTCHNL_CHECK_STRUCT_LEN(2444, virtchnl_rss_cfg); | ||||
/* action configuration for FDIR */ | /* action configuration for FDIR and FSUB */ | ||||
struct virtchnl_filter_action { | struct virtchnl_filter_action { | ||||
/* see enum virtchnl_action type */ | /* see enum virtchnl_action type */ | ||||
s32 type; | s32 type; | ||||
union { | union { | ||||
/* used for queue and qgroup action */ | /* used for queue and qgroup action */ | ||||
struct { | struct { | ||||
u16 index; | u16 index; | ||||
u8 region; | u8 region; | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | struct virtchnl_fdir_del { | ||||
u32 flow_id; /* INPUT */ | u32 flow_id; /* INPUT */ | ||||
/* see enum virtchnl_fdir_prgm_status; OUTPUT */ | /* see enum virtchnl_fdir_prgm_status; OUTPUT */ | ||||
s32 status; | s32 status; | ||||
}; | }; | ||||
VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_fdir_del); | VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_fdir_del); | ||||
/* Status returned to VF after VF requests FSUB commands | |||||
* VIRTCHNL_FSUB_SUCCESS | |||||
* VF FLOW related request is successfully done by PF | |||||
* The request can be OP_FLOW_SUBSCRIBE/UNSUBSCRIBE. | |||||
* | |||||
* VIRTCHNL_FSUB_FAILURE_RULE_NORESOURCE | |||||
* OP_FLOW_SUBSCRIBE request is failed due to no Hardware resource. | |||||
* | |||||
* VIRTCHNL_FSUB_FAILURE_RULE_EXIST | |||||
* OP_FLOW_SUBSCRIBE request is failed due to the rule is already existed. | |||||
* | |||||
* VIRTCHNL_FSUB_FAILURE_RULE_NONEXIST | |||||
* OP_FLOW_UNSUBSCRIBE request is failed due to this rule doesn't exist. | |||||
* | |||||
* VIRTCHNL_FSUB_FAILURE_RULE_INVALID | |||||
* OP_FLOW_SUBSCRIBE request is failed due to parameters validation | |||||
* or HW doesn't support. | |||||
*/ | |||||
enum virtchnl_fsub_prgm_status { | |||||
VIRTCHNL_FSUB_SUCCESS = 0, | |||||
VIRTCHNL_FSUB_FAILURE_RULE_NORESOURCE, | |||||
VIRTCHNL_FSUB_FAILURE_RULE_EXIST, | |||||
VIRTCHNL_FSUB_FAILURE_RULE_NONEXIST, | |||||
VIRTCHNL_FSUB_FAILURE_RULE_INVALID, | |||||
}; | |||||
/* VIRTCHNL_OP_FLOW_SUBSCRIBE | |||||
* VF sends this request to PF by filling out vsi_id, | |||||
* validate_only, priority, proto_hdrs and actions. | |||||
* PF will return flow_id | |||||
* if the request is successfully done and return status to VF. | |||||
*/ | |||||
struct virtchnl_flow_sub { | |||||
u16 vsi_id; /* INPUT */ | |||||
u8 validate_only; /* INPUT */ | |||||
/* 0 is the highest priority; INPUT */ | |||||
u8 priority; | |||||
u32 flow_id; /* OUTPUT */ | |||||
struct virtchnl_proto_hdrs proto_hdrs; /* INPUT */ | |||||
struct virtchnl_filter_action_set actions; /* INPUT */ | |||||
/* see enum virtchnl_fsub_prgm_status; OUTPUT */ | |||||
s32 status; | |||||
}; | |||||
VIRTCHNL_CHECK_STRUCT_LEN(2616, virtchnl_flow_sub); | |||||
/* VIRTCHNL_OP_FLOW_UNSUBSCRIBE | |||||
* VF sends this request to PF by filling out vsi_id | |||||
* and flow_id. PF will return status to VF. | |||||
*/ | |||||
struct virtchnl_flow_unsub { | |||||
u16 vsi_id; /* INPUT */ | |||||
u16 pad; | |||||
u32 flow_id; /* INPUT */ | |||||
/* see enum virtchnl_fsub_prgm_status; OUTPUT */ | |||||
s32 status; | |||||
}; | |||||
VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_flow_unsub); | |||||
/* VIRTCHNL_OP_GET_QOS_CAPS | /* VIRTCHNL_OP_GET_QOS_CAPS | ||||
* VF sends this message to get its QoS Caps, such as | * VF sends this message to get its QoS Caps, such as | ||||
* TC number, Arbiter and Bandwidth. | * TC number, Arbiter and Bandwidth. | ||||
*/ | */ | ||||
struct virtchnl_qos_cap_elem { | struct virtchnl_qos_cap_elem { | ||||
u8 tc_num; | u8 tc_num; | ||||
u8 tc_prio; | u8 tc_prio; | ||||
#define VIRTCHNL_ABITER_STRICT 0 | #define VIRTCHNL_ABITER_STRICT 0 | ||||
▲ Show 20 Lines • Show All 369 Lines • ▼ Show 20 Lines | virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode, | ||||
case VIRTCHNL_OP_DEL_RSS_CFG: | case VIRTCHNL_OP_DEL_RSS_CFG: | ||||
valid_len = sizeof(struct virtchnl_rss_cfg); | valid_len = sizeof(struct virtchnl_rss_cfg); | ||||
break; | break; | ||||
case VIRTCHNL_OP_ADD_FDIR_FILTER: | case VIRTCHNL_OP_ADD_FDIR_FILTER: | ||||
valid_len = sizeof(struct virtchnl_fdir_add); | valid_len = sizeof(struct virtchnl_fdir_add); | ||||
break; | break; | ||||
case VIRTCHNL_OP_DEL_FDIR_FILTER: | case VIRTCHNL_OP_DEL_FDIR_FILTER: | ||||
valid_len = sizeof(struct virtchnl_fdir_del); | valid_len = sizeof(struct virtchnl_fdir_del); | ||||
break; | |||||
case VIRTCHNL_OP_FLOW_SUBSCRIBE: | |||||
valid_len = sizeof(struct virtchnl_flow_sub); | |||||
break; | |||||
case VIRTCHNL_OP_FLOW_UNSUBSCRIBE: | |||||
valid_len = sizeof(struct virtchnl_flow_unsub); | |||||
break; | break; | ||||
case VIRTCHNL_OP_GET_QOS_CAPS: | case VIRTCHNL_OP_GET_QOS_CAPS: | ||||
break; | break; | ||||
case VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP: | case VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP: | ||||
valid_len = sizeof(struct virtchnl_queue_tc_mapping); | valid_len = sizeof(struct virtchnl_queue_tc_mapping); | ||||
if (msglen >= valid_len) { | if (msglen >= valid_len) { | ||||
struct virtchnl_queue_tc_mapping *q_tc = | struct virtchnl_queue_tc_mapping *q_tc = | ||||
(struct virtchnl_queue_tc_mapping *)msg; | (struct virtchnl_queue_tc_mapping *)msg; | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |