Chenmin Sun | 7f83738 | 2020-03-28 00:34:19 +0800 | [diff] [blame] | 1 | From a2c92bf26e724eacd52971c4a83861ada82a6cb4 Mon Sep 17 00:00:00 2001 |
| 2 | From: Chenmin Sun <chenmin.sun@intel.com> |
| 3 | Date: Fri, 17 Apr 2020 00:37:41 +0800 |
| 4 | Subject: [DPDK 03/17] common/iavf: support VSI mapping table |
| 5 | |
| 6 | Add an opcode for getting VSI mapping table. |
| 7 | Add an virtchnl event code for VF reset done. |
| 8 | |
| 9 | Signed-off-by: Beilei Xing <beilei.xing@intel.com> |
| 10 | Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com> |
| 11 | Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> |
| 12 | Signed-off-by: Chenmin Sun <chenmin.sun@intel.com> |
| 13 | |
| 14 | Acked-by: Beilei Xing <beilei.xing@intel.com> |
| 15 | --- |
| 16 | drivers/common/iavf/virtchnl.h | 30 ++++++++++++++++++++++++++++++ |
| 17 | 1 file changed, 30 insertions(+) |
| 18 | |
| 19 | diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h |
| 20 | index 83a7a7174..6f9cf18cb 100644 |
| 21 | --- a/drivers/common/iavf/virtchnl.h |
| 22 | +++ b/drivers/common/iavf/virtchnl.h |
| 23 | @@ -131,6 +131,7 @@ enum virtchnl_ops { |
| 24 | /* opcodes 34, 35, 36, 37 and 38 are reserved */ |
| 25 | VIRTCHNL_OP_DCF_CMD_DESC = 39, |
| 26 | VIRTCHNL_OP_DCF_CMD_BUFF = 40, |
| 27 | + VIRTCHNL_OP_DCF_GET_VSI_MAP = 42, |
| 28 | VIRTCHNL_OP_DCF_GET_PKG_INFO = 43, |
| 29 | }; |
| 30 | |
| 31 | @@ -645,6 +646,25 @@ struct virtchnl_filter { |
| 32 | |
| 33 | VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter); |
| 34 | |
| 35 | +/* VIRTCHNL_OP_DCF_GET_VSI_MAP |
| 36 | + * VF sends this message to get VSI mapping table. |
| 37 | + * PF responds with an indirect message containing VF's |
| 38 | + * HW VSI IDs. |
| 39 | + * The index of vf_vsi array is the logical VF ID, the |
| 40 | + * value of vf_vsi array is the VF's HW VSI ID with its |
| 41 | + * valid configuration. |
| 42 | + */ |
| 43 | +struct virtchnl_dcf_vsi_map { |
| 44 | + u16 pf_vsi; /* PF's HW VSI ID */ |
| 45 | + u16 num_vfs; /* The actual number of VFs allocated */ |
| 46 | +#define VIRTCHNL_DCF_VF_VSI_ID_S 0 |
| 47 | +#define VIRTCHNL_DCF_VF_VSI_ID_M (0xFFF << VIRTCHNL_DCF_VF_VSI_ID_S) |
| 48 | +#define VIRTCHNL_DCF_VF_VSI_VALID (1 << 15) |
| 49 | + u16 vf_vsi[1]; |
| 50 | +}; |
| 51 | + |
| 52 | +VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_dcf_vsi_map); |
| 53 | + |
| 54 | /* VIRTCHNL_OP_EVENT |
| 55 | * PF sends this message to inform the VF driver of events that may affect it. |
| 56 | * No direct response is expected from the VF, though it may generate other |
| 57 | @@ -655,6 +675,7 @@ enum virtchnl_event_codes { |
| 58 | VIRTCHNL_EVENT_LINK_CHANGE, |
| 59 | VIRTCHNL_EVENT_RESET_IMPENDING, |
| 60 | VIRTCHNL_EVENT_PF_DRIVER_CLOSE, |
| 61 | + VIRTCHNL_EVENT_DCF_VSI_MAP_UPDATE, |
| 62 | }; |
| 63 | |
| 64 | #define PF_EVENT_SEVERITY_INFO 0 |
| 65 | @@ -682,6 +703,10 @@ struct virtchnl_pf_event { |
| 66 | u32 link_speed; |
| 67 | u8 link_status; |
| 68 | } link_event_adv; |
| 69 | + struct { |
| 70 | + u16 vf_id; |
| 71 | + u16 vsi_id; |
| 72 | + } vf_vsi_map; |
| 73 | } event_data; |
| 74 | |
| 75 | int severity; |
| 76 | @@ -912,6 +937,11 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode, |
| 77 | return 0; |
| 78 | case VIRTCHNL_OP_DCF_GET_PKG_INFO: |
| 79 | break; |
| 80 | + case VIRTCHNL_OP_DCF_GET_VSI_MAP: |
| 81 | + /* The two opcodes are required by DCF without message buffer, |
| 82 | + * so the valid length keeps the default value 0. |
| 83 | + */ |
| 84 | + break; |
| 85 | /* These are always errors coming from the VF. */ |
| 86 | case VIRTCHNL_OP_EVENT: |
| 87 | case VIRTCHNL_OP_UNKNOWN: |
| 88 | -- |
| 89 | 2.17.1 |
| 90 | |