> -----Original Message-----
> From: Xing, Beilei <beilei.x...@intel.com>
> Sent: Friday, April 21, 2023 2:51 PM
> To: Wu, Jingjing <jingjing...@intel.com>
> Cc: dev@dpdk.org; Liu, Mingxia <mingxia....@intel.com>; Xing, Beilei
> <beilei.x...@intel.com>
> Subject: [PATCH 03/10] common/idpf: support queue groups add/delete
> 
> From: Beilei Xing <beilei.x...@intel.com>
> 
> This patch adds queue group add/delete virtual channel support.
> 
> Signed-off-by: Mingxia Liu <mingxia....@intel.com>
> Signed-off-by: Beilei Xing <beilei.x...@intel.com>
> ---
>  drivers/common/idpf/idpf_common_virtchnl.c | 66
> ++++++++++++++++++++++
> drivers/common/idpf/idpf_common_virtchnl.h |  9 +++
>  drivers/common/idpf/version.map            |  2 +
>  3 files changed, 77 insertions(+)
> 
> diff --git a/drivers/common/idpf/idpf_common_virtchnl.c
> b/drivers/common/idpf/idpf_common_virtchnl.c
> index a4e129062e..76a658bb26 100644
> --- a/drivers/common/idpf/idpf_common_virtchnl.c
> +++ b/drivers/common/idpf/idpf_common_virtchnl.c
> @@ -359,6 +359,72 @@ idpf_vc_vport_destroy(struct idpf_vport *vport)
>       return err;
>  }
> 
> +int
> +idpf_vc_queue_grps_add(struct idpf_vport *vport,
> +                    struct virtchnl2_add_queue_groups
> *ptp_queue_grps_info,
> +                    uint8_t *ptp_queue_grps_out)
[Liu, Mingxia] Better to unify the abbreviation of "port to port" , this patch 
p2p is used, in the next patch p2p is used.
> +{
> +     struct idpf_adapter *adapter = vport->adapter;
> +     struct idpf_cmd_info args;
> +     int size, qg_info_size;
> +     int err = -1;
> +
> +     size = sizeof(*ptp_queue_grps_info) +
> +            (ptp_queue_grps_info->qg_info.num_queue_groups - 1) *
> +                sizeof(struct virtchnl2_queue_group_info);
> +
> +     memset(&args, 0, sizeof(args));
> +     args.ops = VIRTCHNL2_OP_ADD_QUEUE_GROUPS;
> +     args.in_args = (uint8_t *)ptp_queue_grps_info;
> +     args.in_args_size = size;
> +     args.out_buffer = adapter->mbx_resp;
> +     args.out_size = IDPF_DFLT_MBX_BUF_SIZE;
> +
> +     err = idpf_vc_cmd_execute(adapter, &args);
> +     if (err != 0) {
> +             DRV_LOG(ERR,
> +                     "Failed to execute command of
> VIRTCHNL2_OP_ADD_QUEUE_GROUPS");
> +             return err;
> +     }
> +
> +     rte_memcpy(ptp_queue_grps_out, args.out_buffer,
> IDPF_DFLT_MBX_BUF_SIZE);
> +     return 0;
> +}
> +
> +int idpf_vc_queue_grps_del(struct idpf_vport *vport,
> +                       uint16_t num_q_grps,
> +                       struct virtchnl2_queue_group_id *qg_ids) {
> +     struct idpf_adapter *adapter = vport->adapter;
> +     struct virtchnl2_delete_queue_groups *vc_del_q_grps;
> +     struct idpf_cmd_info args;
> +     int size;
> +     int err;
> +
> +     size = sizeof(*vc_del_q_grps) +
> +            (num_q_grps - 1) * sizeof(struct virtchnl2_queue_group_id);
> +     vc_del_q_grps = rte_zmalloc("vc_del_q_grps", size, 0);
> +
> +     vc_del_q_grps->vport_id = vport->vport_id;
> +     vc_del_q_grps->num_queue_groups = num_q_grps;
> +     memcpy(vc_del_q_grps->qg_ids, qg_ids,
> +            num_q_grps * sizeof(struct virtchnl2_queue_group_id));
> +
> +     memset(&args, 0, sizeof(args));
> +     args.ops = VIRTCHNL2_OP_DEL_QUEUE_GROUPS;
> +     args.in_args = (uint8_t *)vc_del_q_grps;
> +     args.in_args_size = size;
> +     args.out_buffer = adapter->mbx_resp;
> +     args.out_size = IDPF_DFLT_MBX_BUF_SIZE;
> +
> +     err = idpf_vc_cmd_execute(adapter, &args);
> +     if (err != 0)
> +             DRV_LOG(ERR, "Failed to execute command of
> +VIRTCHNL2_OP_DEL_QUEUE_GROUPS");
> +
> +     rte_free(vc_del_q_grps);
> +     return err;
> +}
> +
>  int
>  idpf_vc_rss_key_set(struct idpf_vport *vport)  { diff --git
> a/drivers/common/idpf/idpf_common_virtchnl.h
> b/drivers/common/idpf/idpf_common_virtchnl.h
> index d479d93c8e..bf1d014c8d 100644
> --- a/drivers/common/idpf/idpf_common_virtchnl.h
> +++ b/drivers/common/idpf/idpf_common_virtchnl.h
> @@ -64,4 +64,13 @@ int idpf_vc_ctlq_recv(struct idpf_ctlq_info *cq, u16
> *num_q_msg,  __rte_internal  int idpf_vc_ctlq_post_rx_buffs(struct
> idpf_hw *hw, struct idpf_ctlq_info *cq,
>                          u16 *buff_count, struct idpf_dma_mem **buffs);
> +__rte_internal
> +int idpf_vc_queue_grps_del(struct idpf_vport *vport,
> +                        uint16_t num_q_grps,
> +                        struct virtchnl2_queue_group_id *qg_ids);
> __rte_internal int
> +idpf_vc_queue_grps_add(struct idpf_vport *vport,
> +                    struct virtchnl2_add_queue_groups
> *ptp_queue_grps_info,
> +                    uint8_t *ptp_queue_grps_out);
>  #endif /* _IDPF_COMMON_VIRTCHNL_H_ */
> diff --git a/drivers/common/idpf/version.map
> b/drivers/common/idpf/version.map index 7076759024..aa67f7ee27
> 100644
> --- a/drivers/common/idpf/version.map
> +++ b/drivers/common/idpf/version.map
> @@ -48,6 +48,8 @@ INTERNAL {
>       idpf_vc_irq_map_unmap_config;
>       idpf_vc_one_msg_read;
>       idpf_vc_ptype_info_query;
> +     idpf_vc_queue_grps_add;
> +     idpf_vc_queue_grps_del;
>       idpf_vc_queue_switch;
>       idpf_vc_queues_ena_dis;
>       idpf_vc_rss_hash_get;
> --
> 2.26.2

Reply via email to