This source file includes following definitions.
- virtchnl_vc_validate_vf_msg
1
2
3
4
5
6
7
8
9
10
11
12
13 #ifndef _VIRTCHNL_H_
14 #define _VIRTCHNL_H_
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 enum virtchnl_status_code {
50 VIRTCHNL_STATUS_SUCCESS = 0,
51 VIRTCHNL_STATUS_ERR_PARAM = -5,
52 VIRTCHNL_STATUS_ERR_NO_MEMORY = -18,
53 VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH = -38,
54 VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39,
55 VIRTCHNL_STATUS_ERR_INVALID_VF_ID = -40,
56 VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR = -53,
57 VIRTCHNL_STATUS_ERR_NOT_SUPPORTED = -64,
58 };
59
60
61 #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
62 #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
63
64 #define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT 0x0
65 #define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1
66 #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2
67 #define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3
68 #define VIRTCHNL_LINK_SPEED_40GB_SHIFT 0x4
69 #define VIRTCHNL_LINK_SPEED_20GB_SHIFT 0x5
70 #define VIRTCHNL_LINK_SPEED_25GB_SHIFT 0x6
71 #define VIRTCHNL_LINK_SPEED_5GB_SHIFT 0x7
72
73 enum virtchnl_link_speed {
74 VIRTCHNL_LINK_SPEED_UNKNOWN = 0,
75 VIRTCHNL_LINK_SPEED_100MB = BIT(VIRTCHNL_LINK_SPEED_100MB_SHIFT),
76 VIRTCHNL_LINK_SPEED_1GB = BIT(VIRTCHNL_LINK_SPEED_1000MB_SHIFT),
77 VIRTCHNL_LINK_SPEED_10GB = BIT(VIRTCHNL_LINK_SPEED_10GB_SHIFT),
78 VIRTCHNL_LINK_SPEED_40GB = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT),
79 VIRTCHNL_LINK_SPEED_20GB = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT),
80 VIRTCHNL_LINK_SPEED_25GB = BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT),
81 VIRTCHNL_LINK_SPEED_2_5GB = BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT),
82 VIRTCHNL_LINK_SPEED_5GB = BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT),
83 };
84
85
86
87 enum virtchnl_rx_hsplit {
88 VIRTCHNL_RX_HSPLIT_NO_SPLIT = 0,
89 VIRTCHNL_RX_HSPLIT_SPLIT_L2 = 1,
90 VIRTCHNL_RX_HSPLIT_SPLIT_IP = 2,
91 VIRTCHNL_RX_HSPLIT_SPLIT_TCP_UDP = 4,
92 VIRTCHNL_RX_HSPLIT_SPLIT_SCTP = 8,
93 };
94
95
96
97
98
99
100 enum virtchnl_ops {
101
102
103
104
105
106
107 VIRTCHNL_OP_UNKNOWN = 0,
108 VIRTCHNL_OP_VERSION = 1,
109 VIRTCHNL_OP_RESET_VF = 2,
110 VIRTCHNL_OP_GET_VF_RESOURCES = 3,
111 VIRTCHNL_OP_CONFIG_TX_QUEUE = 4,
112 VIRTCHNL_OP_CONFIG_RX_QUEUE = 5,
113 VIRTCHNL_OP_CONFIG_VSI_QUEUES = 6,
114 VIRTCHNL_OP_CONFIG_IRQ_MAP = 7,
115 VIRTCHNL_OP_ENABLE_QUEUES = 8,
116 VIRTCHNL_OP_DISABLE_QUEUES = 9,
117 VIRTCHNL_OP_ADD_ETH_ADDR = 10,
118 VIRTCHNL_OP_DEL_ETH_ADDR = 11,
119 VIRTCHNL_OP_ADD_VLAN = 12,
120 VIRTCHNL_OP_DEL_VLAN = 13,
121 VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE = 14,
122 VIRTCHNL_OP_GET_STATS = 15,
123 VIRTCHNL_OP_RSVD = 16,
124 VIRTCHNL_OP_EVENT = 17,
125 VIRTCHNL_OP_IWARP = 20,
126 VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP = 21,
127 VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP = 22,
128 VIRTCHNL_OP_CONFIG_RSS_KEY = 23,
129 VIRTCHNL_OP_CONFIG_RSS_LUT = 24,
130 VIRTCHNL_OP_GET_RSS_HENA_CAPS = 25,
131 VIRTCHNL_OP_SET_RSS_HENA = 26,
132 VIRTCHNL_OP_ENABLE_VLAN_STRIPPING = 27,
133 VIRTCHNL_OP_DISABLE_VLAN_STRIPPING = 28,
134 VIRTCHNL_OP_REQUEST_QUEUES = 29,
135 VIRTCHNL_OP_ENABLE_CHANNELS = 30,
136 VIRTCHNL_OP_DISABLE_CHANNELS = 31,
137 VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
138 VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,
139 };
140
141
142
143
144
145
146 #define VIRTCHNL_CHECK_STRUCT_LEN(n, X) enum virtchnl_static_assert_enum_##X \
147 { virtchnl_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
148 #define VIRTCHNL_CHECK_UNION_LEN(n, X) enum virtchnl_static_asset_enum_##X \
149 { virtchnl_static_assert_##X = (n)/((sizeof(union X) == (n)) ? 1 : 0) }
150
151
152
153
154
155 struct virtchnl_msg {
156 u8 pad[8];
157 enum virtchnl_ops v_opcode;
158 enum virtchnl_status_code v_retval;
159 u32 vfid;
160 };
161
162 VIRTCHNL_CHECK_STRUCT_LEN(20, virtchnl_msg);
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178 #define VIRTCHNL_VERSION_MAJOR 1
179 #define VIRTCHNL_VERSION_MINOR 1
180 #define VIRTCHNL_VERSION_MINOR_NO_VF_CAPS 0
181
182 struct virtchnl_version_info {
183 u32 major;
184 u32 minor;
185 };
186
187 VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_version_info);
188
189 #define VF_IS_V10(_v) (((_v)->major == 1) && ((_v)->minor == 0))
190 #define VF_IS_V11(_ver) (((_ver)->major == 1) && ((_ver)->minor == 1))
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208 enum virtchnl_vsi_type {
209 VIRTCHNL_VSI_TYPE_INVALID = 0,
210 VIRTCHNL_VSI_SRIOV = 6,
211 };
212
213
214
215
216
217
218
219
220
221 struct virtchnl_vsi_resource {
222 u16 vsi_id;
223 u16 num_queue_pairs;
224 enum virtchnl_vsi_type vsi_type;
225 u16 qset_handle;
226 u8 default_mac_addr[ETH_ALEN];
227 };
228
229 VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
230
231
232
233
234
235 #define VIRTCHNL_VF_OFFLOAD_L2 0x00000001
236 #define VIRTCHNL_VF_OFFLOAD_IWARP 0x00000002
237 #define VIRTCHNL_VF_OFFLOAD_RSVD 0x00000004
238 #define VIRTCHNL_VF_OFFLOAD_RSS_AQ 0x00000008
239 #define VIRTCHNL_VF_OFFLOAD_RSS_REG 0x00000010
240 #define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR 0x00000020
241 #define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES 0x00000040
242 #define VIRTCHNL_VF_OFFLOAD_VLAN 0x00010000
243 #define VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
244 #define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
245 #define VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
246 #define VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000
247 #define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000
248 #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000
249 #define VIRTCHNL_VF_OFFLOAD_ADQ 0X00800000
250
251
252 #define VIRTCHNL_VF_CAP_ADV_LINK_SPEED 0x00000080
253 #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
254 VIRTCHNL_VF_OFFLOAD_VLAN | \
255 VIRTCHNL_VF_OFFLOAD_RSS_PF)
256
257 struct virtchnl_vf_resource {
258 u16 num_vsis;
259 u16 num_queue_pairs;
260 u16 max_vectors;
261 u16 max_mtu;
262
263 u32 vf_cap_flags;
264 u32 rss_key_size;
265 u32 rss_lut_size;
266
267 struct virtchnl_vsi_resource vsi_res[1];
268 };
269
270 VIRTCHNL_CHECK_STRUCT_LEN(36, virtchnl_vf_resource);
271
272
273
274
275
276
277
278
279 struct virtchnl_txq_info {
280 u16 vsi_id;
281 u16 queue_id;
282 u16 ring_len;
283 u16 headwb_enabled;
284 u64 dma_ring_addr;
285 u64 dma_headwb_addr;
286 };
287
288 VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_txq_info);
289
290
291
292
293
294
295
296
297 struct virtchnl_rxq_info {
298 u16 vsi_id;
299 u16 queue_id;
300 u32 ring_len;
301 u16 hdr_size;
302 u16 splithdr_enabled;
303 u32 databuffer_size;
304 u32 max_pkt_size;
305 u32 pad1;
306 u64 dma_ring_addr;
307 enum virtchnl_rx_hsplit rx_split_pos;
308 u32 pad2;
309 };
310
311 VIRTCHNL_CHECK_STRUCT_LEN(40, virtchnl_rxq_info);
312
313
314
315
316
317
318
319
320 struct virtchnl_queue_pair_info {
321
322 struct virtchnl_txq_info txq;
323 struct virtchnl_rxq_info rxq;
324 };
325
326 VIRTCHNL_CHECK_STRUCT_LEN(64, virtchnl_queue_pair_info);
327
328 struct virtchnl_vsi_queue_config_info {
329 u16 vsi_id;
330 u16 num_queue_pairs;
331 u32 pad;
332 struct virtchnl_queue_pair_info qpair[1];
333 };
334
335 VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_vsi_queue_config_info);
336
337
338
339
340
341
342
343
344
345
346
347
348 struct virtchnl_vf_res_request {
349 u16 num_queue_pairs;
350 };
351
352
353
354
355
356
357
358
359 struct virtchnl_vector_map {
360 u16 vsi_id;
361 u16 vector_id;
362 u16 rxq_map;
363 u16 txq_map;
364 u16 rxitr_idx;
365 u16 txitr_idx;
366 };
367
368 VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_vector_map);
369
370 struct virtchnl_irq_map_info {
371 u16 num_vectors;
372 struct virtchnl_vector_map vecmap[1];
373 };
374
375 VIRTCHNL_CHECK_STRUCT_LEN(14, virtchnl_irq_map_info);
376
377
378
379
380
381
382
383
384
385 struct virtchnl_queue_select {
386 u16 vsi_id;
387 u16 pad;
388 u32 rx_queues;
389 u32 tx_queues;
390 };
391
392 VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_select);
393
394
395
396
397
398
399
400
401
402
403
404
405
406 struct virtchnl_ether_addr {
407 u8 addr[ETH_ALEN];
408 u8 pad[2];
409 };
410
411 VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_ether_addr);
412
413 struct virtchnl_ether_addr_list {
414 u16 vsi_id;
415 u16 num_elements;
416 struct virtchnl_ether_addr list[1];
417 };
418
419 VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_ether_addr_list);
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435 struct virtchnl_vlan_filter_list {
436 u16 vsi_id;
437 u16 num_elements;
438 u16 vlan_id[1];
439 };
440
441 VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_vlan_filter_list);
442
443
444
445
446
447
448 struct virtchnl_promisc_info {
449 u16 vsi_id;
450 u16 flags;
451 };
452
453 VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_promisc_info);
454
455 #define FLAG_VF_UNICAST_PROMISC 0x00000001
456 #define FLAG_VF_MULTICAST_PROMISC 0x00000002
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475 struct virtchnl_rss_key {
476 u16 vsi_id;
477 u16 key_len;
478 u8 key[1];
479 };
480
481 VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_key);
482
483 struct virtchnl_rss_lut {
484 u16 vsi_id;
485 u16 lut_entries;
486 u8 lut[1];
487 };
488
489 VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_lut);
490
491
492
493
494
495
496
497
498 struct virtchnl_rss_hena {
499 u64 hena;
500 };
501
502 VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_rss_hena);
503
504
505
506
507
508
509
510
511 struct virtchnl_channel_info {
512 u16 count;
513 u16 offset;
514 u32 pad;
515 u64 max_tx_rate;
516 };
517
518 VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_channel_info);
519
520 struct virtchnl_tc_info {
521 u32 num_tc;
522 u32 pad;
523 struct virtchnl_channel_info list[1];
524 };
525
526 VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_tc_info);
527
528
529
530
531
532
533
534
535
536 struct virtchnl_l4_spec {
537 u8 src_mac[ETH_ALEN];
538 u8 dst_mac[ETH_ALEN];
539 __be16 vlan_id;
540 __be16 pad;
541 __be32 src_ip[4];
542 __be32 dst_ip[4];
543 __be16 src_port;
544 __be16 dst_port;
545 };
546
547 VIRTCHNL_CHECK_STRUCT_LEN(52, virtchnl_l4_spec);
548
549 union virtchnl_flow_spec {
550 struct virtchnl_l4_spec tcp_spec;
551 u8 buffer[128];
552 };
553
554 VIRTCHNL_CHECK_UNION_LEN(128, virtchnl_flow_spec);
555
556 enum virtchnl_action {
557
558 VIRTCHNL_ACTION_DROP = 0,
559 VIRTCHNL_ACTION_TC_REDIRECT,
560 };
561
562 enum virtchnl_flow_type {
563
564 VIRTCHNL_TCP_V4_FLOW = 0,
565 VIRTCHNL_TCP_V6_FLOW,
566 };
567
568 struct virtchnl_filter {
569 union virtchnl_flow_spec data;
570 union virtchnl_flow_spec mask;
571 enum virtchnl_flow_type flow_type;
572 enum virtchnl_action action;
573 u32 action_meta;
574 u8 field_flags;
575 };
576
577 VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
578
579
580
581
582
583
584 enum virtchnl_event_codes {
585 VIRTCHNL_EVENT_UNKNOWN = 0,
586 VIRTCHNL_EVENT_LINK_CHANGE,
587 VIRTCHNL_EVENT_RESET_IMPENDING,
588 VIRTCHNL_EVENT_PF_DRIVER_CLOSE,
589 };
590
591 #define PF_EVENT_SEVERITY_INFO 0
592 #define PF_EVENT_SEVERITY_CERTAIN_DOOM 255
593
594 struct virtchnl_pf_event {
595 enum virtchnl_event_codes event;
596 union {
597
598
599
600
601
602
603
604
605 struct {
606 enum virtchnl_link_speed link_speed;
607 bool link_status;
608 } link_event;
609 struct {
610
611 u32 link_speed;
612 u8 link_status;
613 } link_event_adv;
614 } event_data;
615
616 int severity;
617 };
618
619 VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_pf_event);
620
621
622
623
624
625
626
627
628
629
630
631
632
633 struct virtchnl_iwarp_qv_info {
634 u32 v_idx;
635 u16 ceq_idx;
636 u16 aeq_idx;
637 u8 itr_idx;
638 };
639
640 VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info);
641
642 struct virtchnl_iwarp_qvlist_info {
643 u32 num_vectors;
644 struct virtchnl_iwarp_qv_info qv_info[1];
645 };
646
647 VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_iwarp_qvlist_info);
648
649
650
651
652
653
654
655
656
657
658
659
660 enum virtchnl_vfr_states {
661 VIRTCHNL_VFR_INPROGRESS = 0,
662 VIRTCHNL_VFR_COMPLETED,
663 VIRTCHNL_VFR_VFACTIVE,
664 };
665
666
667
668
669
670
671
672
673
674
675 static inline int
676 virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
677 u8 *msg, u16 msglen)
678 {
679 bool err_msg_format = false;
680 int valid_len = 0;
681
682
683 switch (v_opcode) {
684 case VIRTCHNL_OP_VERSION:
685 valid_len = sizeof(struct virtchnl_version_info);
686 break;
687 case VIRTCHNL_OP_RESET_VF:
688 break;
689 case VIRTCHNL_OP_GET_VF_RESOURCES:
690 if (VF_IS_V11(ver))
691 valid_len = sizeof(u32);
692 break;
693 case VIRTCHNL_OP_CONFIG_TX_QUEUE:
694 valid_len = sizeof(struct virtchnl_txq_info);
695 break;
696 case VIRTCHNL_OP_CONFIG_RX_QUEUE:
697 valid_len = sizeof(struct virtchnl_rxq_info);
698 break;
699 case VIRTCHNL_OP_CONFIG_VSI_QUEUES:
700 valid_len = sizeof(struct virtchnl_vsi_queue_config_info);
701 if (msglen >= valid_len) {
702 struct virtchnl_vsi_queue_config_info *vqc =
703 (struct virtchnl_vsi_queue_config_info *)msg;
704 valid_len += (vqc->num_queue_pairs *
705 sizeof(struct
706 virtchnl_queue_pair_info));
707 if (vqc->num_queue_pairs == 0)
708 err_msg_format = true;
709 }
710 break;
711 case VIRTCHNL_OP_CONFIG_IRQ_MAP:
712 valid_len = sizeof(struct virtchnl_irq_map_info);
713 if (msglen >= valid_len) {
714 struct virtchnl_irq_map_info *vimi =
715 (struct virtchnl_irq_map_info *)msg;
716 valid_len += (vimi->num_vectors *
717 sizeof(struct virtchnl_vector_map));
718 if (vimi->num_vectors == 0)
719 err_msg_format = true;
720 }
721 break;
722 case VIRTCHNL_OP_ENABLE_QUEUES:
723 case VIRTCHNL_OP_DISABLE_QUEUES:
724 valid_len = sizeof(struct virtchnl_queue_select);
725 break;
726 case VIRTCHNL_OP_ADD_ETH_ADDR:
727 case VIRTCHNL_OP_DEL_ETH_ADDR:
728 valid_len = sizeof(struct virtchnl_ether_addr_list);
729 if (msglen >= valid_len) {
730 struct virtchnl_ether_addr_list *veal =
731 (struct virtchnl_ether_addr_list *)msg;
732 valid_len += veal->num_elements *
733 sizeof(struct virtchnl_ether_addr);
734 if (veal->num_elements == 0)
735 err_msg_format = true;
736 }
737 break;
738 case VIRTCHNL_OP_ADD_VLAN:
739 case VIRTCHNL_OP_DEL_VLAN:
740 valid_len = sizeof(struct virtchnl_vlan_filter_list);
741 if (msglen >= valid_len) {
742 struct virtchnl_vlan_filter_list *vfl =
743 (struct virtchnl_vlan_filter_list *)msg;
744 valid_len += vfl->num_elements * sizeof(u16);
745 if (vfl->num_elements == 0)
746 err_msg_format = true;
747 }
748 break;
749 case VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE:
750 valid_len = sizeof(struct virtchnl_promisc_info);
751 break;
752 case VIRTCHNL_OP_GET_STATS:
753 valid_len = sizeof(struct virtchnl_queue_select);
754 break;
755 case VIRTCHNL_OP_IWARP:
756
757
758
759
760 if (msglen)
761 valid_len = msglen;
762 else
763 err_msg_format = true;
764 break;
765 case VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP:
766 break;
767 case VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP:
768 valid_len = sizeof(struct virtchnl_iwarp_qvlist_info);
769 if (msglen >= valid_len) {
770 struct virtchnl_iwarp_qvlist_info *qv =
771 (struct virtchnl_iwarp_qvlist_info *)msg;
772 if (qv->num_vectors == 0) {
773 err_msg_format = true;
774 break;
775 }
776 valid_len += ((qv->num_vectors - 1) *
777 sizeof(struct virtchnl_iwarp_qv_info));
778 }
779 break;
780 case VIRTCHNL_OP_CONFIG_RSS_KEY:
781 valid_len = sizeof(struct virtchnl_rss_key);
782 if (msglen >= valid_len) {
783 struct virtchnl_rss_key *vrk =
784 (struct virtchnl_rss_key *)msg;
785 valid_len += vrk->key_len - 1;
786 }
787 break;
788 case VIRTCHNL_OP_CONFIG_RSS_LUT:
789 valid_len = sizeof(struct virtchnl_rss_lut);
790 if (msglen >= valid_len) {
791 struct virtchnl_rss_lut *vrl =
792 (struct virtchnl_rss_lut *)msg;
793 valid_len += vrl->lut_entries - 1;
794 }
795 break;
796 case VIRTCHNL_OP_GET_RSS_HENA_CAPS:
797 break;
798 case VIRTCHNL_OP_SET_RSS_HENA:
799 valid_len = sizeof(struct virtchnl_rss_hena);
800 break;
801 case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
802 case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING:
803 break;
804 case VIRTCHNL_OP_REQUEST_QUEUES:
805 valid_len = sizeof(struct virtchnl_vf_res_request);
806 break;
807 case VIRTCHNL_OP_ENABLE_CHANNELS:
808 valid_len = sizeof(struct virtchnl_tc_info);
809 if (msglen >= valid_len) {
810 struct virtchnl_tc_info *vti =
811 (struct virtchnl_tc_info *)msg;
812 valid_len += (vti->num_tc - 1) *
813 sizeof(struct virtchnl_channel_info);
814 if (vti->num_tc == 0)
815 err_msg_format = true;
816 }
817 break;
818 case VIRTCHNL_OP_DISABLE_CHANNELS:
819 break;
820 case VIRTCHNL_OP_ADD_CLOUD_FILTER:
821 valid_len = sizeof(struct virtchnl_filter);
822 break;
823 case VIRTCHNL_OP_DEL_CLOUD_FILTER:
824 valid_len = sizeof(struct virtchnl_filter);
825 break;
826
827 case VIRTCHNL_OP_EVENT:
828 case VIRTCHNL_OP_UNKNOWN:
829 default:
830 return VIRTCHNL_STATUS_ERR_PARAM;
831 }
832
833 if (err_msg_format || valid_len != msglen)
834 return VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH;
835
836 return 0;
837 }
838 #endif