54 #define ISCSI_LUN_ADDRESS_METHOD_SHIFT 6
55 #define ISCSI_LUN_ADDRESS_METHOD_MASK 0xc0
56 #define ISCSI_LUN_ADDR_METHOD_PERIPHERAL 0x0
57 #define ISCSI_LUN_ADDR_METHOD_FLAT 0x1
58 #define ISCSI_LUN_ADDR_METHOD_LOGICAL 0x2
59 #define ISCSI_LUN_ADDR_METHOD_EXTENDED 0x3
61 #define ISCSI_LUN_ADDR_SIMPLE_MAX 0xff
62 #define ISCSI_LUN_ADDR_FLAT_MAX 0x3fff
67 #define LOW_THRESH 0x10000000
68 #define HIGH_THRESH 0xefffffff
73 #define GT_WRAPPED(a_cmd_sn, b_cmd_sn) (((b_cmd_sn) > HIGH_THRESH) && \
74 ((a_cmd_sn) < LOW_THRESH))
79 #define GT_NOTWRAPPED(a,b) (((a) > (b)) && (((a) < HIGH_THRESH) || \
87 #define GT_WRAP(a,b) (GT_NOTWRAPPED((a), (b)) || GT_WRAPPED((a), (b)))
94 #define GTE_WRAP(a,b) ( ( (a)==(b) ) || GT_WRAP((a),(b)) )
117 typedef struct ocs_iscsi_mem_tracker_s {
146 typedef struct ocs_iscsi_lgn_retry_s {
159 char virt_buffer[64];
181 #define OCS_CNFG_CTX_COMPL_TIMEOUT (3 * 1000000)
236 #define OCS_ISCSI_MAX_LINK_STATE_CALLBACKS 2
242 #define OCS_CLUST_TARGET_KEY_RETCNT (9999)
243 typedef struct ocs_iscsi_cluster_tgt_info_s {
252 #define OCS_CLUST_TARGET_TTT (0xFFFFFF00)
260 typedef struct ocs_iscsi_cluster_sendtargets_s {
276 typedef struct ocs_iscsi_tgt_ip_s
288 #define OCS_MAX_IP 256
293 typedef struct ocs_iscsi_s {
334 #ifdef OCS_TEST_HAL_APIS
405 uint8_t *reject_reason);
415 uint32_t object_size,
417 uint32_t num_objects);
419 uint32_t obj_offset);
421 uint32_t arg_out_length);
#define OCS_ISCSI_ROUTE_TABLE_ENTRIES_MAX
Stores information needed IP addresses for targets.
int32_t ocs_iscsi_remove_ip_from_tbl(ocs_t *ocs, ocs_ip_address_subnet_t *ipsub, ocs_hal_portal_t portal)
Remove an IP address from the table.
ocs_link_state_e
enum identifying the link state.
int32_t ocs_iscsi_register_link_state_callback(ocs_t *ocs, ocs_link_state_cb_t cb)
Register to receive link state change notifications.
ocs_list_t ocs_list_link_t
ocs_lock_t lgn_queue_lock
ocs_pdu_process_rtn_e
iSCSI PDU processing return codes
ocs_iscsi_mem_tracker_t cxn_login_data
ocs_config_ctx_e
The types of mailbox operations we want to wait for.
void(* ocs_link_state_cb_t)(ocs_t *, ocs_link_state_e)
Template for a function to be called when the link state changes.
void ocs_iscsi_cluster_tgts_free(ocs_iscsi_t *iscsi)
iscsi cluster targets free
void ocs_scsi_pending_cleanup(ocs_node_t *node)
Clean up any IOs on the pending list when a connection goes down.
int32_t parse_mac_address(const char *src, uint8_t *dest)
Parse a string into a MAC address.
Structure used to hold the response entries of set_route_table command.
#define OCS_ISCSI_MAX_LINK_STATE_CALLBACKS
ocs_hal_rq_buffer_t * data
ocs_hal_ip_type_e
enum identifying the types of IP addresses.
ocs_iscsi_mem_tracker_t cxn_login_hdr
ocs_iscsi_cluster_tgt_t * ctgt_next
ocs_pdu_process_rtn_e ocs_iscsi_tgt_process_cmd_sn(ocs_iscsi_t *iscsi, ocs_cxn_t *cxn, ocs_hal_rq_buffer_t *hdr, uint32_t hdr_len, ocs_hal_rq_buffer_t *data, uint32_t data_len, uint8_t code, uint8_t *reject_reason)
Function to process unsolicited PDUs for a target.
void format_mac_address(uint8_t *address, char *buffer, int size)
Format a MAC address into a string.
void ocs_iscsi_ipsub_combine(ocs_ip_address_subnet_t *ipsub, ocs_ip_address_t *ip, ocs_ip_address_t *subnet)
Combines an iSCSI IP address and subnet into the combined structure.
ocs_hal_ip_address_t subnet
bool ocs_scsi_check_cxn_wq_full(ocs_t *ocs, ocs_cxn_t *cxn)
Check Connection WQ's full status.
void ocs_iscsi_cxn_req_invalidate(ocs_iscsi_t *iscsi)
int32_t ocs_scsi_io_dispatch(ocs_io_t *io, void *cb)
Attempt to dispatch an IO.
uint32_t ocs_hal_portal_t
void ocs_iscsi_convert_to_hal_ip(ocs_ip_address_t *ip, ocs_hal_ip_address_t *hal_ip)
Convert an iSCSI IP address to the HAL IP address.
void ocs_iscsi_uninitialize(ocs_iscsi_t *iscsi)
Indicate that HAL is not initialized.
int32_t ocs_iscsi_route_table_read(ocs_t *ocs, ocs_route_table_t *route_table)
ocs_ip_type_e ocs_iscsi_convert_to_ip_type(ocs_hal_ip_type_e ip_type)
Convert an HAL IP type to the iSCSI API value.
void ocs_target_io_aborted_nop_cmpl(ocs_cxn_t *cxn)
This function is called whenever a target NOP completes.
int32_t(* ocs_hal_unsol_cb_t)(void *, ocs_cxn_t *, ocs_hal_rq_buffer_t *, uint32_t, ocs_hal_rq_buffer_t *, uint32_t, uint8_t)
HAL unsolicited callback.
int32_t ocs_iscsi_is_ip_in_tbl(ocs_t *ocs, ocs_ip_address_subnet_t *ipsub)
Checks if an IP address/subnet is present in the table.
void ocs_iscsi_tracker_init(ocs_iscsi_mem_tracker_t *tracker)
Initialize the memory tracker.
ocs_hal_ip_address_t ip_addr
structure used to signal when a mailbox command callback is complete and passes the status and any ot...
Defines a wrapper for the RQ payload buffers so that we can place it back on the proper queue...
ocs_route_table_t route_table
int32_t(* ocs_scsi_io_cb_t)(ocs_io_t *io, ocs_scsi_io_status_e status, uint32_t flags, void *arg)
void ocs_iscsi_rx_buffers_free(ocs_iscsi_t *iscsi, ocs_hal_rq_buffer_t *header, ocs_hal_rq_buffer_t *payload)
Add a receive buffer pair to the Receive Queue, if an error is received, then queue the buffer...
int32_t ocs_iscsi_portal_del_vlan(ocs_t *ocs, ocs_hal_portal_t iface)
Delete iface handle and VLAN from portal_list.
int32_t ocs_iscsi_initialize(ocs_os_handle_t os, ocs_iscsi_t *iscsi, ocs_hal_t *hal, uint32_t device_instance)
Initialize the iSCSI device by setting up the chip.
int32_t ocs_iscsi_teardown(ocs_iscsi_t *iscsi)
Shut down the device.
int32_t ocs_iscsi_portal_read_vlan_ids(ocs_t *ocs, void *arg_out, uint32_t arg_out_length)
Read VLAN IDs to provided buffer.
ocs_list_t login_retry_busy
ocs_dma_t * ocs_iscsi_tracker_calc(ocs_iscsi_mem_tracker_t *tracker, uint32_t obj_offset)
Helper to return the pointers for a specific object in the group.
structure wrapping an IP address and subnet together with their type.
ocs_hal_rq_buffer_t * hdr
void format_ip_address(ocs_ip_type_e ip_type, uint8_t *address, char *buffer, int size)
Format an IP address into a string.
structure wrapping an IP address together with it's type.
ocs_iscsi_cluster_sendtargets_t clusttgt
void ocs_iscsi_ipsub_split(ocs_ip_address_subnet_t *ipsub, ocs_ip_address_t *ip, ocs_ip_address_t *subnet)
Splits an iSCSI IP address and subnet from the combined structure.
ocs_hal_unsol_cb_t unsol_ini
ocs_ip_type_e
enum identifying the types of IP addresses.
int32_t ocs_iscsi_interrupts_required(ocs_os_handle_t os, ocs_hal_t *hal)
Returns the number of interrupts needed for this adapter.
ocs_hal_ip_type_e ocs_iscsi_convert_to_hal_ip_type(ocs_ip_type_e ip_type)
Convert an iSCSI IP type to the HAL value.
ocs_iscsi_retry_type_e
The types of requests that may be retried.
int32_t ocs_iscsi_route_table_del_entry(ocs_t *ocs, ocs_ip_address_subnet_t *ipsub, ocs_ip_address_t *gateway)
Deletes an entry from a routing table.
ocs_hal_ip_address_t gateway
ocs_lock_t sess_queue_lock
int32_t ocs_iscsi_inet_pton4(const char *src, ocs_ip_address_t *ip)
Converts an IPv4 address from a string to the IP structure.
ocs_lock_t link_state_cb_lock
ocs_iscsi_lgn_retry_t * lgn_retry
void ocs_iscsi_unregister_link_state_callback(ocs_t *ocs, ocs_link_state_cb_t cb)
Unregister a link state change callback.
#define OCS_MAX_ISCSI_NAME
iSCSI object memory tracker
ocs_iscsi_tgt_ip_t * ip_info
int32_t ocs_iscsi_inet_pton6(const char *src, ocs_ip_address_t *ip)
Converts an IPv6 address from a string to the IP structure.
ocs_list_t login_retry_free
struct ocs_iscsi_s * iscsi
structure wrapping an IP address together with it's type.
int32_t ocs_iscsi_add_ip_to_tbl(ocs_t *ocs, char *desc, ocs_ip_address_subnet_t *ipsub, ocs_hal_portal_t portal)
Adds an IP address to the table.
int32_t ocs_iscsi_tracker_alloc(ocs_iscsi_t *iscsi, ocs_iscsi_mem_tracker_t *tracker, uint8_t zero, uint32_t object_size, uint32_t alignment, uint32_t num_objects)
Allocate a group of objects uses pages to minimize waste.
object to queue login requests waiting for buffers
void ocs_iscsi_convert_to_ip(ocs_ip_address_t *ip, ocs_hal_ip_address_t *hal_ip)
Convert an iSCSI IP address to the HAL IP address.
int32_t ocs_iscsi_send_tmf_resp(ocs_io_t *io, uint8_t response, ocs_scsi_io_cb_t cb, void *arg)
send TMF response data
ocs_iscsi_retry_type_e type
int32_t ocs_iscsi_route_table_add_entry(ocs_t *ocs, ocs_ip_address_subnet_t *ipsub, ocs_ip_address_t *gateway)
Adds an entry to a routing table.
void ocs_iscsi_tracker_free(ocs_iscsi_t *iscsi, ocs_iscsi_mem_tracker_t *tracker)
Free the memory associated with a memory tracker.