| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /******************************************************************************* |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver |
|---|
| 4 | 5 | * Copyright(c) 2013 - 2014 Intel Corporation. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 7 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 8 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 11 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 12 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 13 | | - * more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License along |
|---|
| 16 | | - * with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | | - * |
|---|
| 18 | | - * The full GNU General Public License is included in this distribution in |
|---|
| 19 | | - * the file called "COPYING". |
|---|
| 20 | 6 | * |
|---|
| 21 | 7 | * Contact Information: |
|---|
| 22 | 8 | * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
|---|
| .. | .. |
|---|
| 62 | 48 | /* Error Codes */ |
|---|
| 63 | 49 | enum virtchnl_status_code { |
|---|
| 64 | 50 | VIRTCHNL_STATUS_SUCCESS = 0, |
|---|
| 65 | | - VIRTCHNL_ERR_PARAM = -5, |
|---|
| 51 | + VIRTCHNL_STATUS_ERR_PARAM = -5, |
|---|
| 52 | + VIRTCHNL_STATUS_ERR_NO_MEMORY = -18, |
|---|
| 66 | 53 | VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH = -38, |
|---|
| 67 | 54 | VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39, |
|---|
| 68 | 55 | VIRTCHNL_STATUS_ERR_INVALID_VF_ID = -40, |
|---|
| 69 | | - VIRTCHNL_STATUS_NOT_SUPPORTED = -64, |
|---|
| 56 | + VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR = -53, |
|---|
| 57 | + VIRTCHNL_STATUS_ERR_NOT_SUPPORTED = -64, |
|---|
| 70 | 58 | }; |
|---|
| 71 | 59 | |
|---|
| 60 | +/* Backward compatibility */ |
|---|
| 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 |
|---|
| 72 | 65 | #define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1 |
|---|
| 73 | 66 | #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2 |
|---|
| 74 | 67 | #define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3 |
|---|
| 75 | 68 | #define VIRTCHNL_LINK_SPEED_40GB_SHIFT 0x4 |
|---|
| 76 | 69 | #define VIRTCHNL_LINK_SPEED_20GB_SHIFT 0x5 |
|---|
| 77 | 70 | #define VIRTCHNL_LINK_SPEED_25GB_SHIFT 0x6 |
|---|
| 71 | +#define VIRTCHNL_LINK_SPEED_5GB_SHIFT 0x7 |
|---|
| 78 | 72 | |
|---|
| 79 | 73 | enum virtchnl_link_speed { |
|---|
| 80 | 74 | VIRTCHNL_LINK_SPEED_UNKNOWN = 0, |
|---|
| .. | .. |
|---|
| 84 | 78 | VIRTCHNL_LINK_SPEED_40GB = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT), |
|---|
| 85 | 79 | VIRTCHNL_LINK_SPEED_20GB = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT), |
|---|
| 86 | 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), |
|---|
| 87 | 83 | }; |
|---|
| 88 | 84 | |
|---|
| 89 | 85 | /* for hsplit_0 field of Rx HMC context */ |
|---|
| .. | .. |
|---|
| 165 | 161 | |
|---|
| 166 | 162 | VIRTCHNL_CHECK_STRUCT_LEN(20, virtchnl_msg); |
|---|
| 167 | 163 | |
|---|
| 168 | | -/* Message descriptions and data structures.*/ |
|---|
| 164 | +/* Message descriptions and data structures. */ |
|---|
| 169 | 165 | |
|---|
| 170 | 166 | /* VIRTCHNL_OP_VERSION |
|---|
| 171 | 167 | * VF posts its version number to the PF. PF responds with its version number |
|---|
| .. | .. |
|---|
| 252 | 248 | #define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000 |
|---|
| 253 | 249 | #define VIRTCHNL_VF_OFFLOAD_ADQ 0X00800000 |
|---|
| 254 | 250 | |
|---|
| 251 | +/* Define below the capability flags that are not offloads */ |
|---|
| 252 | +#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED 0x00000080 |
|---|
| 255 | 253 | #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \ |
|---|
| 256 | 254 | VIRTCHNL_VF_OFFLOAD_VLAN | \ |
|---|
| 257 | 255 | VIRTCHNL_VF_OFFLOAD_RSS_PF) |
|---|
| .. | .. |
|---|
| 334 | 332 | struct virtchnl_queue_pair_info qpair[1]; |
|---|
| 335 | 333 | }; |
|---|
| 336 | 334 | |
|---|
| 335 | +VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_vsi_queue_config_info); |
|---|
| 336 | + |
|---|
| 337 | 337 | /* VIRTCHNL_OP_REQUEST_QUEUES |
|---|
| 338 | 338 | * VF sends this message to request the PF to allocate additional queues to |
|---|
| 339 | 339 | * this VF. Each VF gets a guaranteed number of queues on init but asking for |
|---|
| .. | .. |
|---|
| 348 | 348 | struct virtchnl_vf_res_request { |
|---|
| 349 | 349 | u16 num_queue_pairs; |
|---|
| 350 | 350 | }; |
|---|
| 351 | | - |
|---|
| 352 | | -VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_vsi_queue_config_info); |
|---|
| 353 | 351 | |
|---|
| 354 | 352 | /* VIRTCHNL_OP_CONFIG_IRQ_MAP |
|---|
| 355 | 353 | * VF uses this message to map vectors to queues. |
|---|
| .. | .. |
|---|
| 573 | 571 | enum virtchnl_flow_type flow_type; |
|---|
| 574 | 572 | enum virtchnl_action action; |
|---|
| 575 | 573 | u32 action_meta; |
|---|
| 576 | | - __u8 field_flags; |
|---|
| 574 | + u8 field_flags; |
|---|
| 575 | + u8 pad[3]; |
|---|
| 577 | 576 | }; |
|---|
| 578 | 577 | |
|---|
| 579 | 578 | VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter); |
|---|
| .. | .. |
|---|
| 596 | 595 | struct virtchnl_pf_event { |
|---|
| 597 | 596 | enum virtchnl_event_codes event; |
|---|
| 598 | 597 | union { |
|---|
| 598 | + /* If the PF driver does not support the new speed reporting |
|---|
| 599 | + * capabilities then use link_event else use link_event_adv to |
|---|
| 600 | + * get the speed and link information. The ability to understand |
|---|
| 601 | + * new speeds is indicated by setting the capability flag |
|---|
| 602 | + * VIRTCHNL_VF_CAP_ADV_LINK_SPEED in vf_cap_flags parameter |
|---|
| 603 | + * in virtchnl_vf_resource struct and can be used to determine |
|---|
| 604 | + * which link event struct to use below. |
|---|
| 605 | + */ |
|---|
| 599 | 606 | struct { |
|---|
| 600 | 607 | enum virtchnl_link_speed link_speed; |
|---|
| 601 | 608 | bool link_status; |
|---|
| 602 | 609 | } link_event; |
|---|
| 610 | + struct { |
|---|
| 611 | + /* link_speed provided in Mbps */ |
|---|
| 612 | + u32 link_speed; |
|---|
| 613 | + u8 link_status; |
|---|
| 614 | + u8 pad[3]; |
|---|
| 615 | + } link_event_adv; |
|---|
| 603 | 616 | } event_data; |
|---|
| 604 | 617 | |
|---|
| 605 | 618 | int severity; |
|---|
| .. | .. |
|---|
| 624 | 637 | u16 ceq_idx; |
|---|
| 625 | 638 | u16 aeq_idx; |
|---|
| 626 | 639 | u8 itr_idx; |
|---|
| 640 | + u8 pad[3]; |
|---|
| 627 | 641 | }; |
|---|
| 628 | 642 | |
|---|
| 629 | 643 | VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_iwarp_qv_info); |
|---|
| .. | .. |
|---|
| 816 | 830 | case VIRTCHNL_OP_EVENT: |
|---|
| 817 | 831 | case VIRTCHNL_OP_UNKNOWN: |
|---|
| 818 | 832 | default: |
|---|
| 819 | | - return VIRTCHNL_ERR_PARAM; |
|---|
| 833 | + return VIRTCHNL_STATUS_ERR_PARAM; |
|---|
| 820 | 834 | } |
|---|
| 821 | 835 | /* few more checks */ |
|---|
| 822 | 836 | if (err_msg_format || valid_len != msglen) |
|---|