2 *------------------------------------------------------------------
3 * Copyright (c) 2018 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *------------------------------------------------------------------
18 #ifndef _AVF_VIRTCHNL_H_
19 #define _AVF_VIRTCHNL_H_
21 #define VIRTCHNL_VERSION_MAJOR 1
22 #define VIRTCHNL_VERSION_MINOR 1
25 #define AVFINT_DYN_CTLN(x) (0x00003800 + (0x4 * x))
26 #define AVFINT_ICR0 0x00004800
27 #define AVFINT_ICR0_ENA1 0x00005000
28 #define AVFINT_DYN_CTL0 0x00005C00
29 #define AVF_ARQBAH 0x00006000
30 #define AVF_ATQH 0x00006400
31 #define AVF_ATQLEN 0x00006800
32 #define AVF_ARQBAL 0x00006C00
33 #define AVF_ARQT 0x00007000
34 #define AVF_ARQH 0x00007400
35 #define AVF_ATQBAH 0x00007800
36 #define AVF_ATQBAL 0x00007C00
37 #define AVF_ARQLEN 0x00008000
38 #define AVF_ATQT 0x00008400
39 #define AVFGEN_RSTAT 0x00008800
40 #define AVF_QTX_TAIL(q) (0x00000000 + (0x4 * q))
41 #define AVF_QRX_TAIL(q) (0x00002000 + (0x4 * q))
43 #define AVF_AQ_F_DD (1 << 0)
44 #define AVF_AQ_F_CMP (1 << 1)
45 #define AVF_AQ_F_ERR (1 << 2)
46 #define AVF_AQ_F_VFE (1 << 3)
47 #define AVF_AQ_F_LB (1 << 9)
48 #define AVF_AQ_F_RD (1 << 10)
49 #define AVF_AQ_F_VFC (1 << 11)
50 #define AVF_AQ_F_BUF (1 << 12)
51 #define AVF_AQ_F_SI (1 << 13)
52 #define AVF_AQ_F_EI (1 << 14)
53 #define AVF_AQ_F_FE (1 << 15)
56 #define foreach_virtchnl_op \
60 _(3, GET_VF_RESOURCES) \
61 _(4, CONFIG_TX_QUEUE) \
62 _(5, CONFIG_RX_QUEUE) \
63 _(6, CONFIG_VSI_QUEUES) \
64 _(7, CONFIG_IRQ_MAP) \
66 _(9, DISABLE_QUEUES) \
71 _(14, CONFIG_PROMISCUOUS_MODE) \
78 _(21, CONFIG_IWARP_IRQ_MAP) \
79 _(22, RELEASE_IWARP_IRQ_MAP) \
80 _(23, CONFIG_RSS_KEY) \
81 _(24, CONFIG_RSS_LUT) \
82 _(25, GET_RSS_HENA_CAPS) \
84 _(27, ENABLE_VLAN_STRIPPING) \
85 _(28, DISABLE_VLAN_STRIPPING) \
86 _(29, REQUEST_QUEUES) \
87 _(30, ENABLE_CHANNELS) \
88 _(31, DISABLE_CHANNELS) \
89 _(32, ADD_CLOUD_FILTER) \
90 _(33, DEL_CLOUD_FILTER)
95 #define _(v,n) VIRTCHNL_OP_##n = v,
103 VIRTCHNL_STATUS_SUCCESS = 0,
104 VIRTCHNL_STATUS_ERR_PARAM = -5,
105 VIRTCHNL_STATUS_ERR_NO_MEMORY = -18,
106 VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH = -38,
107 VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39,
108 VIRTCHNL_STATUS_ERR_INVALID_VF_ID = -40,
109 VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR = -53,
110 VIRTCHNL_STATUS_NOT_SUPPORTED = -64,
111 } virtchnl_status_code_t;
113 #define foreach_avf_vf_cap_flag \
114 _( 0, OFFLOAD_L2, "l2") \
115 _( 1, OFFLOAD_IWARP, "iwarp") \
116 _( 2, OFFLOAD_RSVD, "rsvd") \
117 _( 3, OFFLOAD_RSS_AQ, "rss-aq") \
118 _( 4, OFFLOAD_RSS_REG, "rss-reg") \
119 _( 5, OFFLOAD_WB_ON_ITR, "wb-on-itr") \
120 _( 6, OFFLOAD_REQ_QUEUES, "req-queues") \
121 _( 7, CAP_ADV_LINK_SPEED, "adv-link-speed") \
122 _(16, OFFLOAD_VLAN, "vlan") \
123 _(17, OFFLOAD_RX_POLLING, "rx-polling") \
124 _(18, OFFLOAD_RSS_PCTYPE_V2, "rss-pctype-v2") \
125 _(19, OFFLOAD_RSS_PF, "rss-pf") \
126 _(20, OFFLOAD_ENCAP, "encap") \
127 _(21, OFFLOAD_ENCAP_CSUM, "encap-csum") \
128 _(22, OFFLOAD_RX_ENCAP_CSUM, "rx-encap-csum") \
129 _(23, OFFLOAD_ADQ, "offload-adq")
133 #define _(a, b, c) VIRTCHNL_VF_##b = (1 << a),
134 foreach_avf_vf_cap_flag
140 VIRTCHNL_VSI_TYPE_INVALID = 0,
141 VIRTCHNL_VSI_SRIOV = 6,
142 } virtchnl_vsi_type_t;
146 VIRTCHNL_VFR_INPROGRESS = 0,
147 VIRTCHNL_VFR_COMPLETED,
148 VIRTCHNL_VFR_VFACTIVE,
149 } virtchnl_vfr_states_t;
155 virtchnl_vsi_type_t vsi_type;
157 u8 default_mac_addr[6];
158 } virtchnl_vsi_resource_t;
166 u32 vf_offload_flags;
169 virtchnl_vsi_resource_t vsi_res[1];
170 } virtchnl_vf_resource_t;
174 VIRTCHNL_EVENT_UNKNOWN = 0,
175 VIRTCHNL_EVENT_LINK_CHANGE,
176 VIRTCHNL_EVENT_RESET_IMPENDING,
177 VIRTCHNL_EVENT_PF_DRIVER_CLOSE,
178 } virtchnl_event_codes_t;
180 #define foreach_virtchnl_link_speed \
181 _(1, 100MB, "100 Mbps") \
182 _(2, 1GB, "1 Gbps") \
183 _(3, 10GB, "10 Gbps") \
184 _(4, 40GB, "40 Gbps") \
185 _(5, 20GB, "20 Gbps") \
186 _(6, 25GB, "25 Gbps")
190 VIRTCHNL_LINK_SPEED_UNKNOWN = 0,
191 #define _(a,b,c) VIRTCHNL_LINK_SPEED_##b = (1 << a),
192 foreach_virtchnl_link_speed
194 } virtchnl_link_speed_t;
198 virtchnl_event_codes_t event;
203 virtchnl_link_speed_t link_speed;
213 } virtchnl_pf_event_t;
215 STATIC_ASSERT_SIZEOF (virtchnl_pf_event_t, 16);
221 } virtchnl_version_info_t;
232 virtchnl_ops_t v_opcode;
237 virtchnl_status_code_t v_retval;
253 STATIC_ASSERT_SIZEOF (avf_aq_desc_t, 32);
262 } virtchnl_txq_info_t;
264 STATIC_ASSERT_SIZEOF (virtchnl_txq_info_t, 24);
272 u16 splithdr_enabled;
279 } virtchnl_rxq_info_t;
281 STATIC_ASSERT_SIZEOF (virtchnl_rxq_info_t, 40);
285 virtchnl_txq_info_t txq;
286 virtchnl_rxq_info_t rxq;
287 } virtchnl_queue_pair_info_t;
294 virtchnl_queue_pair_info_t qpair[1];
295 } virtchnl_vsi_queue_config_info_t;
297 STATIC_ASSERT_SIZEOF (virtchnl_vsi_queue_config_info_t, 72);
305 } virtchnl_queue_select_t;
307 STATIC_ASSERT_SIZEOF (virtchnl_queue_select_t, 12);
317 } virtchnl_vector_map_t;
322 virtchnl_vector_map_t vecmap[1];
323 } virtchnl_irq_map_info_t;
325 STATIC_ASSERT_SIZEOF (virtchnl_irq_map_info_t, 14);
331 } virtchnl_ether_addr_t;
337 virtchnl_ether_addr_t list[1];
338 } virtchnl_ether_addr_list_t;
340 #define foreach_virtchnl_eth_stats \
346 _(rx_unknown_protocol)\
357 foreach_virtchnl_eth_stats
359 } virtchnl_eth_stats_t;
366 } virtchnl_rss_key_t;
368 STATIC_ASSERT_SIZEOF (virtchnl_rss_key_t, 6);
375 } virtchnl_rss_lut_t;
377 STATIC_ASSERT_SIZEOF (virtchnl_rss_lut_t, 6);
379 /* VIRTCHNL_OP_REQUEST_QUEUES */
383 } virtchnl_vf_res_request_t;
385 #endif /* AVF_VIRTCHNL_H */
388 * fd.io coding-style-patch-verification: ON
391 * eval: (c-set-style "gnu")