drivers/net/ethernet/qlogic/qed/qed_nvmetcp_fw_funcs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qed/qed_nvmetcp_fw_funcs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qed/qed_nvmetcp_fw_funcs.c- Extension
.c- Size
- 13363 bytes
- Lines
- 376
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/pci.hlinux/list.hlinux/mm.hlinux/types.hasm/byteorder.hlinux/qed/common_hsi.hlinux/qed/storage_common.hlinux/qed/nvmetcp_common.hlinux/qed/qed_nvmetcp_if.hqed_nvmetcp_fw_funcs.h
Detected Declarations
function nvmetcp_is_slow_sglfunction init_scsi_sgl_contextfunction calc_rw_task_sizefunction init_sqefunction init_nvmetcp_task_paramsfunction init_default_nvmetcp_taskfunction init_ustorm_task_contextsfunction set_local_completion_contextfunction init_rw_nvmetcp_taskfunction init_common_initiator_read_taskfunction init_nvmetcp_host_read_taskfunction init_common_initiator_write_taskfunction init_nvmetcp_host_write_taskfunction init_common_login_request_taskfunction init_nvmetcp_init_conn_req_taskfunction init_cleanup_task_nvmetcp
Annotated Snippet
if (task_params->tx_io_size) {
if (task_params->send_write_incapsule)
buf_size = calc_rw_task_size(task_params, task_type);
if (nvmetcp_is_slow_sgl(sgl_task_params->num_sges,
sgl_task_params->small_mid_sge))
num_sges = NVMETCP_WQE_NUM_SGES_SLOWIO;
else
num_sges = min((u16)sgl_task_params->num_sges,
(u16)SCSI_NUM_SGES_SLOW_SGL_THR);
}
SET_FIELD(task_params->sqe->flags, NVMETCP_WQE_NUM_SGES, num_sges);
SET_FIELD(task_params->sqe->contlen_cdbsize, NVMETCP_WQE_CONT_LEN, buf_size);
} break;
case NVMETCP_TASK_TYPE_HOST_READ: {
SET_FIELD(task_params->sqe->flags, NVMETCP_WQE_WQE_TYPE,
NVMETCP_WQE_TYPE_NORMAL);
SET_FIELD(task_params->sqe->contlen_cdbsize,
NVMETCP_WQE_CDB_SIZE_OR_NVMETCP_CMD, 1);
} break;
case NVMETCP_TASK_TYPE_INIT_CONN_REQUEST: {
SET_FIELD(task_params->sqe->flags, NVMETCP_WQE_WQE_TYPE,
NVMETCP_WQE_TYPE_MIDDLE_PATH);
if (task_params->tx_io_size) {
SET_FIELD(task_params->sqe->contlen_cdbsize, NVMETCP_WQE_CONT_LEN,
task_params->tx_io_size);
SET_FIELD(task_params->sqe->flags, NVMETCP_WQE_NUM_SGES,
min((u16)sgl_task_params->num_sges,
(u16)SCSI_NUM_SGES_SLOW_SGL_THR));
}
} break;
case NVMETCP_TASK_TYPE_CLEANUP:
SET_FIELD(task_params->sqe->flags, NVMETCP_WQE_WQE_TYPE,
NVMETCP_WQE_TYPE_TASK_CLEANUP);
default:
break;
}
}
/* The following function initializes of NVMeTCP task params */
static inline void
init_nvmetcp_task_params(struct e5_nvmetcp_task_context *context,
struct nvmetcp_task_params *task_params,
enum nvmetcp_task_type task_type)
{
context->ystorm_st_context.state.cccid = task_params->host_cccid;
SET_FIELD(context->ustorm_st_context.error_flags, USTORM_NVMETCP_TASK_ST_CTX_NVME_TCP, 1);
context->ustorm_st_context.nvme_tcp_opaque_lo = cpu_to_le32(task_params->opq.lo);
context->ustorm_st_context.nvme_tcp_opaque_hi = cpu_to_le32(task_params->opq.hi);
}
/* The following function initializes default values to all tasks */
static inline void
init_default_nvmetcp_task(struct nvmetcp_task_params *task_params,
void *pdu_header, void *nvme_cmd,
enum nvmetcp_task_type task_type)
{
struct e5_nvmetcp_task_context *context = task_params->context;
const u8 val_byte = context->mstorm_ag_context.cdu_validation;
u8 dw_index;
memset(context, 0, sizeof(*context));
init_nvmetcp_task_params(context, task_params,
(enum nvmetcp_task_type)task_type);
/* Swapping requirements used below, will be removed in future FW versions */
if (task_type == NVMETCP_TASK_TYPE_HOST_WRITE ||
task_type == NVMETCP_TASK_TYPE_HOST_READ) {
for (dw_index = 0;
dw_index < QED_NVMETCP_CMN_HDR_SIZE / sizeof(u32);
dw_index++)
context->ystorm_st_context.pdu_hdr.task_hdr.reg[dw_index] =
cpu_to_le32(__swab32(((u32 *)pdu_header)[dw_index]));
for (dw_index = QED_NVMETCP_CMN_HDR_SIZE / sizeof(u32);
dw_index < QED_NVMETCP_CMD_HDR_SIZE / sizeof(u32);
dw_index++)
context->ystorm_st_context.pdu_hdr.task_hdr.reg[dw_index] =
cpu_to_le32(__swab32(((u32 *)nvme_cmd)[dw_index - 2]));
} else {
for (dw_index = 0;
dw_index < QED_NVMETCP_NON_IO_HDR_SIZE / sizeof(u32);
dw_index++)
context->ystorm_st_context.pdu_hdr.task_hdr.reg[dw_index] =
cpu_to_le32(__swab32(((u32 *)pdu_header)[dw_index]));
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/pci.h`, `linux/list.h`, `linux/mm.h`, `linux/types.h`, `asm/byteorder.h`, `linux/qed/common_hsi.h`.
- Detected declarations: `function nvmetcp_is_slow_sgl`, `function init_scsi_sgl_context`, `function calc_rw_task_size`, `function init_sqe`, `function init_nvmetcp_task_params`, `function init_default_nvmetcp_task`, `function init_ustorm_task_contexts`, `function set_local_completion_context`, `function init_rw_nvmetcp_task`, `function init_common_initiator_read_task`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.