From: Simei Su <simei...@intel.com>

Customer has a requirement to use the legacy fixed size, single chunk
structure for ADI creation - one chunk for queue and one chunk for vector.
This is described in detail in customer case
https://issuetracker.google.com/issues/270157802.

On the other hand, upstream code review patch has been posted with
flex-array definitions. To accommodate the old style, the single chunk
structures are being renamed so that merger of upstream patches with
current code does not impact the existing workflows of the customer.

a) Define virtchnl2_non_flex_queue_reg_chunks with a single chunk in it.
b) Define virtchnl2_non_flex_vector_chunks with a single chunk in it.
c) Rename and modify virtchnl2_create_adi to use the above 2 new structs.
New structure is virtchnl2_non_flex_create_adi.

Signed-off-by: Shailendra Bhatnagar <shailendra.bhatna...@intel.com>
Signed-off-by: Simei Su <simei...@intel.com>
---
 drivers/common/idpf/base/virtchnl2.h | 66 ++++++++++++++++++----------
 1 file changed, 43 insertions(+), 23 deletions(-)

diff --git a/drivers/common/idpf/base/virtchnl2.h 
b/drivers/common/idpf/base/virtchnl2.h
index 7a099f5148..a19bb193c9 100644
--- a/drivers/common/idpf/base/virtchnl2.h
+++ b/drivers/common/idpf/base/virtchnl2.h
@@ -89,8 +89,8 @@
         * VIRTCHNL2_OP_GET_PTYPE_INFO_RAW
         */
        /* opcodes 529, 530, and 531 are reserved */
-#define                VIRTCHNL2_OP_CREATE_ADI                 532
-#define                VIRTCHNL2_OP_DESTROY_ADI                533
+#define                VIRTCHNL2_OP_NON_FLEX_CREATE_ADI        532
+#define                VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI       533
 #define                VIRTCHNL2_OP_LOOPBACK                   534
 #define                VIRTCHNL2_OP_ADD_MAC_ADDR               535
 #define                VIRTCHNL2_OP_DEL_MAC_ADDR               536
@@ -1061,14 +1061,34 @@ struct virtchnl2_sriov_vfs_info {
 
 VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_sriov_vfs_info);
 
-/* VIRTCHNL2_OP_CREATE_ADI
+/* structure to specify single chunk of queue */
+/* 'chunks' is fixed size(not flexible) and will be deprecated at some point */
+struct virtchnl2_non_flex_queue_reg_chunks {
+       __le16 num_chunks;
+       u8 reserved[6];
+       struct virtchnl2_queue_reg_chunk chunks[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(40, virtchnl2_non_flex_queue_reg_chunks);
+
+/* structure to specify single chunk of interrupt vector */
+/* 'vchunks' is fixed size(not flexible) and will be deprecated at some point 
*/
+struct virtchnl2_non_flex_vector_chunks {
+       __le16 num_vchunks;
+       u8 reserved[14];
+       struct virtchnl2_vector_chunk vchunks[1];
+};
+
+VIRTCHNL2_CHECK_STRUCT_LEN(48, virtchnl2_non_flex_vector_chunks);
+
+/* VIRTCHNL2_OP_NON_FLEX_CREATE_ADI
  * PF sends this message to CP to create ADI by filling in required
- * fields of virtchnl2_create_adi structure.
- * CP responds with the updated virtchnl2_create_adi structure containing the
- * necessary fields followed by chunks which in turn will have an array of
+ * fields of virtchnl2_non_flex_create_adi structure.
+ * CP responds with the updated virtchnl2_non_flex_create_adi structure 
containing
+ * the necessary fields followed by chunks which in turn will have an array of
  * num_chunks entries of virtchnl2_queue_chunk structures.
  */
-struct virtchnl2_create_adi {
+struct virtchnl2_non_flex_create_adi {
        /* PF sends PASID to CP */
        __le32 pasid;
        /*
@@ -1085,24 +1105,24 @@ struct virtchnl2_create_adi {
        u8 reserved[64];
        u8 pad[4];
        /* CP populates queue chunks */
-       struct virtchnl2_queue_reg_chunks chunks;
+       struct virtchnl2_non_flex_queue_reg_chunks chunks;
        /* PF sends vector chunks to CP */
-       struct virtchnl2_vector_chunks vchunks;
+       struct virtchnl2_non_flex_vector_chunks vchunks;
 };
 
-VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_create_adi);
+VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_non_flex_create_adi);
 
-/* VIRTCHNL2_OP_DESTROY_ADI
+/* VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI
  * PF sends this message to CP to destroy ADI by filling
  * in the adi_id in virtchnl2_destropy_adi structure.
  * CP responds with the status of the requested operation.
  */
-struct virtchnl2_destroy_adi {
+struct virtchnl2_non_flex_destroy_adi {
        __le16 adi_id;
        u8 reserved[2];
 };
 
-VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_destroy_adi);
+VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_non_flex_destroy_adi);
 
 /* Based on the descriptor type the PF supports, CP fills ptype_id_10 or
  * ptype_id_8 for flex and base descriptor respectively. If ptype_id_10 value
@@ -1566,10 +1586,10 @@ static inline const char *virtchnl2_op_str(__le32 
v_opcode)
                return "VIRTCHNL2_OP_EVENT";
        case VIRTCHNL2_OP_RESET_VF:
                return "VIRTCHNL2_OP_RESET_VF";
-       case VIRTCHNL2_OP_CREATE_ADI:
-               return "VIRTCHNL2_OP_CREATE_ADI";
-       case VIRTCHNL2_OP_DESTROY_ADI:
-               return "VIRTCHNL2_OP_DESTROY_ADI";
+       case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI:
+               return "VIRTCHNL2_OP_NON_FLEX_CREATE_ADI";
+       case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI:
+               return "VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI";
        case VIRTCHNL2_OP_ADD_QUEUE_GROUPS:
                return "VIRTCHNL2_OP_ADD_QUEUE_GROUPS";
        case VIRTCHNL2_OP_DEL_QUEUE_GROUPS:
@@ -1624,11 +1644,11 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct 
virtchnl2_version_info *ver, u3
                                      sizeof(struct virtchnl2_queue_reg_chunk);
                }
                break;
-       case VIRTCHNL2_OP_CREATE_ADI:
-               valid_len = sizeof(struct virtchnl2_create_adi);
+       case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI:
+               valid_len = sizeof(struct virtchnl2_non_flex_create_adi);
                if (msglen >= valid_len) {
-                       struct virtchnl2_create_adi *cadi =
-                               (struct virtchnl2_create_adi *)msg;
+                       struct virtchnl2_non_flex_create_adi *cadi =
+                               (struct virtchnl2_non_flex_create_adi *)msg;
 
                        if (cadi->chunks.num_chunks == 0) {
                                /* zero chunks is allowed as input */
@@ -1645,8 +1665,8 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct 
virtchnl2_version_info *ver, u3
                                      sizeof(struct virtchnl2_vector_chunk);
                }
                break;
-       case VIRTCHNL2_OP_DESTROY_ADI:
-               valid_len = sizeof(struct virtchnl2_destroy_adi);
+       case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI:
+               valid_len = sizeof(struct virtchnl2_non_flex_destroy_adi);
                break;
        case VIRTCHNL2_OP_DESTROY_VPORT:
        case VIRTCHNL2_OP_ENABLE_VPORT:
-- 
2.34.1

Reply via email to