mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-16 15:34:48 +08:00
689d94ec20
To determine how many blocks sends in one command, the minimum value is selected from the hw_max_sectors of both devices. In target_xcopy_do_work, hw_max_sectors are used as blocks, not sectors; it also ignores the fact that sectors can be of different sizes, for example 512 and 4096 bytes. Because of this, a number of blocks can be transmitted that the device will not be able to accept. Change the selection of max transmission size into bytes. Reviewed-by: Konstantin Shelekhin <k.shelekhin@yadro.com> Reviewed-by: Dmitriy Bogdanov <d.bogdanov@yadro.com> Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com> Link: https://lore.kernel.org/r/20221114102500.88892-4-a.kovaleva@yadro.com Reviewed-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
69 lines
1.9 KiB
C
69 lines
1.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#include <target/target_core_base.h>
|
|
|
|
#define XCOPY_HDR_LEN 16
|
|
#define XCOPY_TARGET_DESC_LEN 32
|
|
#define XCOPY_SEGMENT_DESC_LEN 28
|
|
#define XCOPY_NAA_IEEE_REGEX_LEN 16
|
|
#define XCOPY_MAX_BYTES 16777216 /* 16 MB */
|
|
|
|
/*
|
|
* SPC4r37 6.4.6.1
|
|
* Table 150 — CSCD descriptor ID values
|
|
*/
|
|
#define XCOPY_CSCD_DESC_ID_LIST_OFF_MAX 0x07FF
|
|
|
|
enum xcopy_origin_list {
|
|
XCOL_SOURCE_RECV_OP = 0x01,
|
|
XCOL_DEST_RECV_OP = 0x02,
|
|
};
|
|
|
|
struct xcopy_op {
|
|
int op_origin;
|
|
|
|
struct se_cmd *xop_se_cmd;
|
|
struct se_device *src_dev;
|
|
unsigned char src_tid_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
|
|
struct se_device *dst_dev;
|
|
unsigned char dst_tid_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
|
|
unsigned char local_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
|
|
struct percpu_ref *remote_lun_ref;
|
|
|
|
sector_t src_lba;
|
|
sector_t dst_lba;
|
|
unsigned short stdi;
|
|
unsigned short dtdi;
|
|
unsigned short nolb;
|
|
|
|
u32 xop_data_bytes;
|
|
u32 xop_data_nents;
|
|
struct scatterlist *xop_data_sg;
|
|
struct work_struct xop_work;
|
|
};
|
|
|
|
/*
|
|
* Receive Copy Results Sevice Actions
|
|
*/
|
|
#define RCR_SA_COPY_STATUS 0x00
|
|
#define RCR_SA_RECEIVE_DATA 0x01
|
|
#define RCR_SA_OPERATING_PARAMETERS 0x03
|
|
#define RCR_SA_FAILED_SEGMENT_DETAILS 0x04
|
|
|
|
/*
|
|
* Receive Copy Results defs for Operating Parameters
|
|
*/
|
|
#define RCR_OP_MAX_TARGET_DESC_COUNT 0x2
|
|
#define RCR_OP_MAX_SG_DESC_COUNT 0x1
|
|
#define RCR_OP_MAX_DESC_LIST_LEN 1024
|
|
#define RCR_OP_MAX_SEGMENT_LEN 268435456 /* 256 MB */
|
|
#define RCR_OP_TOTAL_CONCURR_COPIES 0x1 /* Must be <= 16384 */
|
|
#define RCR_OP_MAX_CONCURR_COPIES 0x1 /* Must be <= 255 */
|
|
#define RCR_OP_DATA_SEG_GRAN_LOG2 9 /* 512 bytes in log 2 */
|
|
#define RCR_OP_INLINE_DATA_GRAN_LOG2 9 /* 512 bytes in log 2 */
|
|
#define RCR_OP_HELD_DATA_GRAN_LOG2 9 /* 512 bytes in log 2 */
|
|
|
|
extern int target_xcopy_setup_pt(void);
|
|
extern void target_xcopy_release_pt(void);
|
|
extern sense_reason_t target_do_xcopy(struct se_cmd *);
|
|
extern sense_reason_t target_do_receive_copy_results(struct se_cmd *);
|