/* *------------------------------------------------------------------ * Copyright (c) 2018 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *------------------------------------------------------------------ */ #ifndef _AVF_VIRTCHNL_H_ #define _AVF_VIRTCHNL_H_ #define VIRTCHNL_VERSION_MAJOR 1 #define VIRTCHNL_VERSION_MINOR 1 #define foreach_avf_promisc_flags \ _(0, UNICAST_PROMISC, "unicast") \ _(1, MULTICAST_PROMISC, "multicast") enum { #define _(a, b, c) FLAG_VF_ ##b = (1 << a), foreach_avf_promisc_flags #undef _ }; #define AVFINT_DYN_CTLN(x) (0x00003800 + (0x4 * x)) #define AVFINT_ICR0 0x00004800 #define AVFINT_ICR0_ENA1 0x00005000 #define AVFINT_DYN_CTL0 0x00005C00 #define AVF_ARQBAH 0x00006000 #define AVF_ATQH 0x00006400 #define AVF_ATQLEN 0x00006800 #define AVF_ARQBAL 0x00006C00 #define AVF_ARQT 0x00007000 #define AVF_ARQH 0x00007400 #define AVF_ATQBAH 0x00007800 #define AVF_ATQBAL 0x00007C00 #define AVF_ARQLEN 0x00008000 #define AVF_ATQT 0x00008400 #define AVFGEN_RSTAT 0x00008800 #define AVF_QTX_TAIL(q) (0x00000000 + (0x4 * q)) #define AVF_QRX_TAIL(q) (0x00002000 + (0x4 * q)) #define AVF_AQ_F_DD (1 << 0) #define AVF_AQ_F_CMP (1 << 1) #define AVF_AQ_F_ERR (1 << 2) #define AVF_AQ_F_VFE (1 << 3) #define AVF_AQ_F_LB (1 << 9) #define AVF_AQ_F_RD (1 << 10) #define AVF_AQ_F_VFC (1 << 11) #define AVF_AQ_F_BUF (1 << 12) #define AVF_AQ_F_SI (1 << 13) #define AVF_AQ_F_EI (1 << 14) #define AVF_AQ_F_FE (1 << 15) #define foreach_virtchnl_op \ _ (0, UNKNOWN) \ _ (1, VERSION) \ _ (2, RESET_VF) \ _ (3, GET_VF_RESOURCES) \ _ (4, CONFIG_TX_QUEUE) \ _ (5, CONFIG_RX_QUEUE) \ _ (6, CONFIG_VSI_QUEUES) \ _ (7, CONFIG_IRQ_MAP) \ _ (8, ENABLE_QUEUES) \ _ (9, DISABLE_QUEUES) \ _ (10, ADD_ETH_ADDR) \ _ (11, DEL_ETH_ADDR) \ _ (12, ADD_VLAN) \ _ (13, DEL_VLAN) \ _ (14, CONFIG_PROMISCUOUS_MODE) \ _ (15, GET_STATS) \ _ (16, RSVD) \ _ (17, EVENT) \ _ (18, UNDEF_18) \ _ (19, UNDEF_19) \ _ (20, IWARP) \ _ (21, CONFIG_IWARP_IRQ_MAP) \ _ (22, RELEASE_IWARP_IRQ_MAP) \ _ (23, CONFIG_RSS_KEY) \ _ (24, CONFIG_RSS_LUT) \ _ (25, GET_RSS_HENA_CAPS) \ _ (26, SET_RSS_HENA) \ _ (27, ENABLE_VLAN_STRIPPING) \ _ (28, DISABLE_VLAN_STRIPPING) \ _ (29, REQUEST_QUEUES) \ _ (30, ENABLE_CHANNELS) \ _ (31, DISABLE_CHANNELS) \ _ (32, ADD_CLOUD_FILTER) \ _ (33, DEL_CLOUD_FILTER) \ _ (47, ADD_FDIR_FILTER) \ _ (48, DEL_FDIR_FILTER) \ _ (49, QUERY_FDIR_FILTER) \ _ (50, GET_MAX_RSS_QREGION) \ _ (51, GET_OFFLOAD_VLAN_V2_CAPS) \ _ (52, ADD_VLAN_V2) \ _ (53, DEL_VLAN_V2) \ _ (54, ENABLE_VLAN_STRIPPING_V2) \ _ (55, DISABLE_VLAN_STRIPPING_V2) \ _ (56, ENABLE_VLAN_INSERTION_V2) \ _ (57, DISABLE_VLAN_INSERTION_V2) \ _ (58, ENABLE_VLAN_FILTERING_V2) \ _ (59, DISABLE_VLAN_FILTERING_V2) \ _ (107, ENABLE_QUEUES_V2) \ _ (108, DISABLE_QUEUES_V2) \ _ (111, MAP_QUEUE_VECTOR) typedef enum { #define _(v,n) VIRTCHNL_OP_##n = v, foreach_virtchnl_op #undef _ VIRTCHNL_N_OPS, } virtchnl_ops_t; typedef enum { VIRTCHNL_STATUS_SUCCESS = 0, VIRTCHNL_STATUS_ERR_PARAM = -5, VIRTCHNL_STATUS_ERR_NO_MEMORY = -18, VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH = -38, VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39, VIRTCHNL_STATUS_ERR_INVALID_VF_ID = -40, VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR = -53, VIRTCHNL_STATUS_NOT_SUPPORTED = -64, } virtchnl_status_code_t; #define foreach_avf_vf_cap_flag \ _ (0, OFFLOAD_L2, "l2") \ _ (1, OFFLOAD_IWARP, "iwarp") \ _ (2, OFFLOAD_RSVD, "rsvd") \ _ (3, OFFLOAD_RSS_AQ, "rss-aq") \ _ (4, OFFLOAD_RSS_REG, "rss-reg") \ _ (5, OFFLOAD_WB_ON_ITR, "wb-on-itr") \ _ (6, OFFLOAD_REQ_QUEUES, "req-queues") \ _ (7, CAP_ADV_LINK_SPEED, "adv-link-speed") \ _ (9, LARGE_NUM_QPAIRS, "large-num-qpairs") \ _ (15, OFFLOAD_VLAN_V2, "vlan-v2") \ _ (16, OFFLOAD_VLAN, "vlan") \ _ (17, OFFLOAD_RX_POLLING, "rx-polling")