net/nfc/nci/hci.c
Source file repositories/reference/linux-study-clean/net/nfc/nci/hci.c
File Facts
- System
- Linux kernel
- Corpus path
net/nfc/nci/hci.c- Extension
.c- Size
- 19938 bytes
- Lines
- 806
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/skbuff.h../nfc.hnet/nfc/nci.hnet/nfc/nci_core.hlinux/nfc.hlinux/kcov.h
Detected Declarations
struct nci_datastruct nci_hci_create_pipe_paramsstruct nci_hci_create_pipe_respstruct nci_hci_delete_pipe_notistruct nci_hci_all_pipe_cleared_notistruct nci_hcp_messagestruct nci_hcp_packetfunction nci_hci_result_to_errnofunction nci_hci_reset_pipesfunction nci_hci_reset_pipes_per_hostfunction nci_hci_send_datafunction nci_hci_send_data_reqfunction nci_hci_send_eventfunction nci_hci_send_cmdfunction nci_hci_clear_all_pipesfunction nci_hci_event_receivedfunction nci_hci_cmd_receivedfunction nci_hci_resp_receivedfunction nci_hci_hcp_message_rxfunction nci_hci_msg_rx_workfunction nci_hci_data_received_cbfunction skb_queue_walkfunction skb_queue_walkfunction nci_hci_open_pipefunction nci_hci_create_pipefunction nci_hci_delete_pipefunction nci_hci_set_paramfunction nci_hci_get_paramfunction nci_hci_connect_gatefunction nci_hci_dev_connect_gatesfunction nci_hci_dev_session_initfunction nci_hci_deallocateexport nci_hci_send_eventexport nci_hci_send_cmdexport nci_hci_clear_all_pipesexport nci_hci_open_pipeexport nci_hci_set_paramexport nci_hci_get_paramexport nci_hci_connect_gateexport nci_hci_dev_session_init
Annotated Snippet
struct nci_data {
u8 conn_id;
u8 pipe;
u8 cmd;
const u8 *data;
u32 data_len;
} __packed;
struct nci_hci_create_pipe_params {
u8 src_gate;
u8 dest_host;
u8 dest_gate;
} __packed;
struct nci_hci_create_pipe_resp {
u8 src_host;
u8 src_gate;
u8 dest_host;
u8 dest_gate;
u8 pipe;
} __packed;
struct nci_hci_delete_pipe_noti {
u8 pipe;
} __packed;
struct nci_hci_all_pipe_cleared_noti {
u8 host;
} __packed;
struct nci_hcp_message {
u8 header; /* type -cmd,evt,rsp- + instruction */
u8 data[];
} __packed;
struct nci_hcp_packet {
u8 header; /* cbit+pipe */
struct nci_hcp_message message;
} __packed;
#define NCI_HCI_ANY_SET_PARAMETER 0x01
#define NCI_HCI_ANY_GET_PARAMETER 0x02
#define NCI_HCI_ANY_CLOSE_PIPE 0x04
#define NCI_HCI_ADM_CLEAR_ALL_PIPE 0x14
#define NCI_HFP_NO_CHAINING 0x80
#define NCI_NFCEE_ID_HCI 0x80
#define NCI_EVT_HOT_PLUG 0x03
#define NCI_HCI_ADMIN_PARAM_SESSION_IDENTITY 0x01
#define NCI_HCI_ADM_CREATE_PIPE 0x10
#define NCI_HCI_ADM_DELETE_PIPE 0x11
/* HCP headers */
#define NCI_HCI_HCP_PACKET_HEADER_LEN 1
#define NCI_HCI_HCP_MESSAGE_HEADER_LEN 1
#define NCI_HCI_HCP_HEADER_LEN 2
/* HCP types */
#define NCI_HCI_HCP_COMMAND 0x00
#define NCI_HCI_HCP_EVENT 0x01
#define NCI_HCI_HCP_RESPONSE 0x02
#define NCI_HCI_ADM_NOTIFY_PIPE_CREATED 0x12
#define NCI_HCI_ADM_NOTIFY_PIPE_DELETED 0x13
#define NCI_HCI_ADM_NOTIFY_ALL_PIPE_CLEARED 0x15
#define NCI_HCI_FRAGMENT 0x7f
#define NCI_HCP_HEADER(type, instr) ((((type) & 0x03) << 6) |\
((instr) & 0x3f))
#define NCI_HCP_MSG_GET_TYPE(header) ((header & 0xc0) >> 6)
#define NCI_HCP_MSG_GET_CMD(header) (header & 0x3f)
#define NCI_HCP_MSG_GET_PIPE(header) (header & 0x7f)
static int nci_hci_result_to_errno(u8 result)
{
switch (result) {
case NCI_HCI_ANY_OK:
return 0;
case NCI_HCI_ANY_E_REG_PAR_UNKNOWN:
return -EOPNOTSUPP;
case NCI_HCI_ANY_E_TIMEOUT:
return -ETIME;
default:
return -1;
}
}
Annotation
- Immediate include surface: `linux/skbuff.h`, `../nfc.h`, `net/nfc/nci.h`, `net/nfc/nci_core.h`, `linux/nfc.h`, `linux/kcov.h`.
- Detected declarations: `struct nci_data`, `struct nci_hci_create_pipe_params`, `struct nci_hci_create_pipe_resp`, `struct nci_hci_delete_pipe_noti`, `struct nci_hci_all_pipe_cleared_noti`, `struct nci_hcp_message`, `struct nci_hcp_packet`, `function nci_hci_result_to_errno`, `function nci_hci_reset_pipes`, `function nci_hci_reset_pipes_per_host`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.