// SPDX-License-Identifier: GPL-2.0-only /* * This file is part of the Emulex Linux Device Driver for Enterprise iSCSI * Host Bus Adapters. Refer to the README file included with this package * for driver version and adapter compatibility. * * Copyright (c) 2018 Broadcom. All Rights Reserved. * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * Contact Information: * [email protected] */ #include <scsi/libiscsi.h> #include <scsi/scsi_transport_iscsi.h> #include <scsi/scsi_transport.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h> #include <scsi/scsi_host.h> #include <scsi/scsi_netlink.h> #include <net/netlink.h> #include <scsi/scsi.h> #include "be_iscsi.h" extern struct iscsi_transport beiscsi_iscsi_transport; /** * beiscsi_session_create - creates a new iscsi session * @ep: pointer to iscsi ep * @cmds_max: max commands supported * @qdepth: max queue depth supported * @initial_cmdsn: initial iscsi CMDSN */ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep, u16 cmds_max, u16 qdepth, u32 initial_cmdsn) { … } /** * beiscsi_session_destroy - destroys iscsi session * @cls_session: pointer to iscsi cls session * * Destroys iSCSI session instance and releases * resources allocated for it. */ void beiscsi_session_destroy(struct iscsi_cls_session *cls_session) { … } /** * beiscsi_session_fail(): Closing session with appropriate error * @cls_session: ptr to session **/ void beiscsi_session_fail(struct iscsi_cls_session *cls_session) { … } /** * beiscsi_conn_create - create an instance of iscsi connection * @cls_session: ptr to iscsi_cls_session * @cid: iscsi cid */ struct iscsi_cls_conn * beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid) { … } /** * beiscsi_conn_bind - Binds iscsi session/connection with TCP connection * @cls_session: pointer to iscsi cls session * @cls_conn: pointer to iscsi cls conn * @transport_fd: EP handle(64 bit) * @is_leading: indicate if this is the session leading connection (MCS) * * This function binds the TCP Conn with iSCSI Connection and Session. */ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session, struct iscsi_cls_conn *cls_conn, u64 transport_fd, int is_leading) { … } static int beiscsi_iface_create_ipv4(struct beiscsi_hba *phba) { … } static int beiscsi_iface_create_ipv6(struct beiscsi_hba *phba) { … } void beiscsi_iface_create_default(struct beiscsi_hba *phba) { … } void beiscsi_iface_destroy_default(struct beiscsi_hba *phba) { … } /** * beiscsi_iface_config_vlan()- Set the VLAN TAG * @shost: Scsi Host for the driver instance * @iface_param: Interface paramters * * Set the VLAN TAG for the adapter or disable * the VLAN config * * returns * Success: 0 * Failure: Non-Zero Value **/ static int beiscsi_iface_config_vlan(struct Scsi_Host *shost, struct iscsi_iface_param_info *iface_param) { … } static int beiscsi_iface_config_ipv4(struct Scsi_Host *shost, struct iscsi_iface_param_info *info, void *data, uint32_t dt_len) { … } static int beiscsi_iface_config_ipv6(struct Scsi_Host *shost, struct iscsi_iface_param_info *iface_param, void *data, uint32_t dt_len) { … } int beiscsi_iface_set_param(struct Scsi_Host *shost, void *data, uint32_t dt_len) { … } static int __beiscsi_iface_get_param(struct beiscsi_hba *phba, struct iscsi_iface *iface, int param, char *buf) { … } int beiscsi_iface_get_param(struct iscsi_iface *iface, enum iscsi_param_type param_type, int param, char *buf) { … } /** * beiscsi_ep_get_param - get the iscsi parameter * @ep: pointer to iscsi ep * @param: parameter type identifier * @buf: buffer pointer * * returns iscsi parameter */ int beiscsi_ep_get_param(struct iscsi_endpoint *ep, enum iscsi_param param, char *buf) { … } int beiscsi_set_param(struct iscsi_cls_conn *cls_conn, enum iscsi_param param, char *buf, int buflen) { … } /** * beiscsi_get_port_state - Get the Port State * @shost : pointer to scsi_host structure * */ static void beiscsi_get_port_state(struct Scsi_Host *shost) { … } /** * beiscsi_get_port_speed - Get the Port Speed from Adapter * @shost : pointer to scsi_host structure * */ static void beiscsi_get_port_speed(struct Scsi_Host *shost) { … } /** * beiscsi_get_host_param - get the iscsi parameter * @shost: pointer to scsi_host structure * @param: parameter type identifier * @buf: buffer pointer * */ int beiscsi_get_host_param(struct Scsi_Host *shost, enum iscsi_host_param param, char *buf) { … } int beiscsi_get_macaddr(char *buf, struct beiscsi_hba *phba) { … } /** * beiscsi_conn_get_stats - get the iscsi stats * @cls_conn: pointer to iscsi cls conn * @stats: pointer to iscsi_stats structure * * returns iscsi stats */ void beiscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats) { … } /** * beiscsi_set_params_for_offld - get the parameters for offload * @beiscsi_conn: pointer to beiscsi_conn * @params: pointer to offload_params structure */ static void beiscsi_set_params_for_offld(struct beiscsi_conn *beiscsi_conn, struct beiscsi_offload_params *params) { … } /** * beiscsi_conn_start - offload of session to chip * @cls_conn: pointer to beiscsi_conn */ int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn) { … } /** * beiscsi_get_cid - Allocate a cid * @phba: The phba instance */ static int beiscsi_get_cid(struct beiscsi_hba *phba) { … } /** * beiscsi_put_cid - Free the cid * @phba: The phba for which the cid is being freed * @cid: The cid to free */ static void beiscsi_put_cid(struct beiscsi_hba *phba, unsigned short cid) { … } /** * beiscsi_free_ep - free endpoint * @beiscsi_ep: pointer to device endpoint struct */ static void beiscsi_free_ep(struct beiscsi_endpoint *beiscsi_ep) { … } /** * beiscsi_open_conn - Ask FW to open a TCP connection * @ep: pointer to device endpoint struct * @src_addr: The source IP address * @dst_addr: The Destination IP address * @non_blocking: blocking or non-blocking call * * Asks the FW to open a TCP connection */ static int beiscsi_open_conn(struct iscsi_endpoint *ep, struct sockaddr *src_addr, struct sockaddr *dst_addr, int non_blocking) { … } /** * beiscsi_ep_connect - Ask chip to create TCP Conn * @shost: Pointer to scsi_host structure * @dst_addr: The IP address of Target * @non_blocking: blocking or non-blocking call * * This routines first asks chip to create a connection and then allocates an EP */ struct iscsi_endpoint * beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, int non_blocking) { … } /** * beiscsi_ep_poll - Poll to see if connection is established * @ep: endpoint to be used * @timeout_ms: timeout specified in millisecs * * Poll to see if TCP connection established */ int beiscsi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms) { … } /** * beiscsi_flush_cq()- Flush the CQ created. * @phba: ptr device priv structure. * * Before the connection resource are freed flush * all the CQ enteries **/ static void beiscsi_flush_cq(struct beiscsi_hba *phba) { … } /** * beiscsi_conn_close - Invalidate and upload connection * @beiscsi_ep: pointer to device endpoint struct * * Returns 0 on success, -1 on failure. */ static int beiscsi_conn_close(struct beiscsi_endpoint *beiscsi_ep) { … } /** * beiscsi_ep_disconnect - Tears down the TCP connection * @ep: endpoint to be used * * Tears down the TCP connection */ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep) { … } umode_t beiscsi_attr_is_visible(int param_type, int param) { … }