Lines Matching refs:vhca_buf

119 static void mlx5vf_buf_read_done(struct mlx5_vhca_data_buffer *vhca_buf)  in mlx5vf_buf_read_done()  argument
121 struct mlx5_vf_migration_file *migf = vhca_buf->migf; in mlx5vf_buf_read_done()
123 if (vhca_buf->stop_copy_chunk_num) { in mlx5vf_buf_read_done()
124 bool is_header = vhca_buf->dma_dir == DMA_NONE; in mlx5vf_buf_read_done()
125 u8 chunk_num = vhca_buf->stop_copy_chunk_num; in mlx5vf_buf_read_done()
129 migf->buf_header[chunk_num - 1] = vhca_buf; in mlx5vf_buf_read_done()
131 migf->buf[chunk_num - 1] = vhca_buf; in mlx5vf_buf_read_done()
134 list_del_init(&vhca_buf->buf_elm); in mlx5vf_buf_read_done()
149 list_del_init(&vhca_buf->buf_elm); in mlx5vf_buf_read_done()
150 list_add_tail(&vhca_buf->buf_elm, &vhca_buf->migf->avail_list); in mlx5vf_buf_read_done()
154 static ssize_t mlx5vf_buf_read(struct mlx5_vhca_data_buffer *vhca_buf, in mlx5vf_buf_read() argument
162 vhca_buf->start_pos + vhca_buf->length - *pos, *len); in mlx5vf_buf_read()
170 offset = *pos - vhca_buf->start_pos; in mlx5vf_buf_read()
173 page = mlx5vf_get_migration_page(vhca_buf, offset); in mlx5vf_buf_read()
189 if (*pos >= vhca_buf->start_pos + vhca_buf->length) in mlx5vf_buf_read()
190 mlx5vf_buf_read_done(vhca_buf); in mlx5vf_buf_read()
199 struct mlx5_vhca_data_buffer *vhca_buf; in mlx5vf_save_read() local
227 vhca_buf = mlx5vf_get_data_buff_from_pos(migf, *pos, in mlx5vf_save_read()
249 if (!vhca_buf) { in mlx5vf_save_read()
254 count = mlx5vf_buf_read(vhca_buf, &buf, &len, pos); in mlx5vf_save_read()
703 mlx5vf_append_page_to_mig_buf(struct mlx5_vhca_data_buffer *vhca_buf, in mlx5vf_append_page_to_mig_buf() argument
714 offset = *pos - vhca_buf->start_pos; in mlx5vf_append_page_to_mig_buf()
717 page = mlx5vf_get_migration_page(vhca_buf, offset - page_offset); in mlx5vf_append_page_to_mig_buf()
731 vhca_buf->length += page_len; in mlx5vf_append_page_to_mig_buf()
737 struct mlx5_vhca_data_buffer *vhca_buf, in mlx5vf_resume_read_image() argument
745 to_copy = min_t(size_t, *len, image_size - vhca_buf->length); in mlx5vf_resume_read_image()
748 ret = mlx5vf_append_page_to_mig_buf(vhca_buf, buf, &to_copy, pos, in mlx5vf_resume_read_image()
755 if (vhca_buf->length == image_size) { in mlx5vf_resume_read_image()
766 struct mlx5_vhca_data_buffer *vhca_buf, in mlx5vf_resume_read_header_data() argument
775 required_data = migf->record_size - vhca_buf->length; in mlx5vf_resume_read_header_data()
779 ret = mlx5vf_append_page_to_mig_buf(vhca_buf, buf, &to_copy, pos, in mlx5vf_resume_read_header_data()
786 if (vhca_buf->length == migf->record_size) { in mlx5vf_resume_read_header_data()
792 page = mlx5vf_get_migration_page(vhca_buf, 0); in mlx5vf_resume_read_header_data()
808 vhca_buf->length = 0; in mlx5vf_resume_read_header_data()
816 struct mlx5_vhca_data_buffer *vhca_buf, in mlx5vf_resume_read_header() argument
827 sizeof(struct mlx5_vf_migration_header) - vhca_buf->length); in mlx5vf_resume_read_header()
828 page = mlx5vf_get_migration_page(vhca_buf, 0); in mlx5vf_resume_read_header()
832 ret = copy_from_user(to_buff + vhca_buf->length, *buf, copy_len); in mlx5vf_resume_read_header()
842 vhca_buf->length += copy_len; in mlx5vf_resume_read_header()
843 if (vhca_buf->length == sizeof(struct mlx5_vf_migration_header)) { in mlx5vf_resume_read_header()
874 migf->max_pos += vhca_buf->length; in mlx5vf_resume_read_header()
875 vhca_buf->length = 0; in mlx5vf_resume_read_header()
887 struct mlx5_vhca_data_buffer *vhca_buf = migf->buf[0]; in mlx5vf_resume_write() local
948 if (vhca_buf->allocated_length < size) { in mlx5vf_resume_write()
949 mlx5vf_free_data_buffer(vhca_buf); in mlx5vf_resume_write()
959 vhca_buf = migf->buf[0]; in mlx5vf_resume_write()
962 vhca_buf->start_pos = migf->max_pos; in mlx5vf_resume_write()
967 ret = mlx5vf_resume_read_image(migf, vhca_buf, in mlx5vf_resume_write()
974 ret = mlx5vf_cmd_load_vhca_state(migf->mvdev, migf, vhca_buf); in mlx5vf_resume_write()
982 vhca_buf->length = 0; in mlx5vf_resume_write()