Commit bfead3b2 authored by Jayamohan Kallickal's avatar Jayamohan Kallickal Committed by James Bottomley

[SCSI] be2iscsi: Adding msix and mcc_rings V3

This patch enables msix for be2iscsi. It also enables use
of mcc_rings for fw commands. Since the mcc eq creation is
dependent on msix I am sending as one patch
Signed-off-by: default avatarJayamohan Kallickal <jayamohank@serverengines.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent b4a9c7ed
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/blk-iopoll.h>
#define FW_VER_LEN 32 #define FW_VER_LEN 32
#define MCC_Q_LEN 128
#define MCC_CQ_LEN 256
struct be_dma_mem { struct be_dma_mem {
void *va; void *va;
...@@ -74,18 +76,14 @@ static inline void queue_tail_inc(struct be_queue_info *q) ...@@ -74,18 +76,14 @@ static inline void queue_tail_inc(struct be_queue_info *q)
struct be_eq_obj { struct be_eq_obj {
struct be_queue_info q; struct be_queue_info q;
char desc[32]; struct beiscsi_hba *phba;
struct be_queue_info *cq;
/* Adaptive interrupt coalescing (AIC) info */ struct blk_iopoll iopoll;
bool enable_aic;
u16 min_eqd; /* in usecs */
u16 max_eqd; /* in usecs */
u16 cur_eqd; /* in usecs */
}; };
struct be_mcc_obj { struct be_mcc_obj {
struct be_queue_info *q; struct be_queue_info q;
struct be_queue_info *cq; struct be_queue_info cq;
}; };
struct be_ctrl_info { struct be_ctrl_info {
...@@ -176,8 +174,4 @@ static inline void swap_dws(void *wrb, int len) ...@@ -176,8 +174,4 @@ static inline void swap_dws(void *wrb, int len)
} while (len); } while (len);
#endif /* __BIG_ENDIAN */ #endif /* __BIG_ENDIAN */
} }
extern void beiscsi_cq_notify(struct be_ctrl_info *ctrl, u16 qid, bool arm,
u16 num_popped);
#endif /* BEISCSI_H */ #endif /* BEISCSI_H */
This diff is collapsed.
...@@ -47,6 +47,8 @@ struct be_mcc_wrb { ...@@ -47,6 +47,8 @@ struct be_mcc_wrb {
#define CQE_FLAGS_VALID_MASK (1 << 31) #define CQE_FLAGS_VALID_MASK (1 << 31)
#define CQE_FLAGS_ASYNC_MASK (1 << 30) #define CQE_FLAGS_ASYNC_MASK (1 << 30)
#define CQE_FLAGS_COMPLETED_MASK (1 << 28)
#define CQE_FLAGS_CONSUMED_MASK (1 << 27)
/* Completion Status */ /* Completion Status */
#define MCC_STATUS_SUCCESS 0x0 #define MCC_STATUS_SUCCESS 0x0
...@@ -173,7 +175,7 @@ struct be_cmd_req_hdr { ...@@ -173,7 +175,7 @@ struct be_cmd_req_hdr {
u8 domain; /* dword 0 */ u8 domain; /* dword 0 */
u32 timeout; /* dword 1 */ u32 timeout; /* dword 1 */
u32 request_length; /* dword 2 */ u32 request_length; /* dword 2 */
u32 rsvd; /* dword 3 */ u32 rsvd0; /* dword 3 */
}; };
struct be_cmd_resp_hdr { struct be_cmd_resp_hdr {
...@@ -382,7 +384,6 @@ struct be_cmd_req_modify_eq_delay { ...@@ -382,7 +384,6 @@ struct be_cmd_req_modify_eq_delay {
#define ETH_ALEN 6 #define ETH_ALEN 6
struct be_cmd_req_get_mac_addr { struct be_cmd_req_get_mac_addr {
struct be_cmd_req_hdr hdr; struct be_cmd_req_hdr hdr;
u32 nic_port_count; u32 nic_port_count;
...@@ -417,14 +418,21 @@ int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl, ...@@ -417,14 +418,21 @@ int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q, int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q,
int type); int type);
int be_cmd_mccq_create(struct beiscsi_hba *phba,
struct be_queue_info *mccq,
struct be_queue_info *cq);
int be_poll_mcc(struct be_ctrl_info *ctrl); int be_poll_mcc(struct be_ctrl_info *ctrl);
unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl); unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
int be_cmd_get_mac_addr(struct be_ctrl_info *ctrl, u8 *mac_addr); struct beiscsi_hba *phba);
int be_cmd_get_mac_addr(struct beiscsi_hba *phba, u8 *mac_addr);
/*ISCSI Functuions */ /*ISCSI Functuions */
int be_cmd_fw_initialize(struct be_ctrl_info *ctrl); int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem); struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
int be_mcc_notify_wait(struct beiscsi_hba *phba);
int be_mbox_notify(struct be_ctrl_info *ctrl); int be_mbox_notify(struct be_ctrl_info *ctrl);
...@@ -531,6 +539,23 @@ struct amap_sol_cqe { ...@@ -531,6 +539,23 @@ struct amap_sol_cqe {
u8 valid; /* dword 3 */ u8 valid; /* dword 3 */
} __packed; } __packed;
#define SOL_ICD_INDEX_MASK 0x0003FFC0
struct amap_sol_cqe_ring {
u8 hw_sts[8]; /* dword 0 */
u8 i_sts[8]; /* dword 0 */
u8 i_resp[8]; /* dword 0 */
u8 i_flags[7]; /* dword 0 */
u8 s; /* dword 0 */
u8 i_exp_cmd_sn[32]; /* dword 1 */
u8 code[6]; /* dword 2 */
u8 icd_index[12]; /* dword 2 */
u8 rsvd[6]; /* dword 2 */
u8 i_cmd_wnd[8]; /* dword 2 */
u8 i_res_cnt[31]; /* dword 3 */
u8 valid; /* dword 3 */
} __packed;
/** /**
* Post WRB Queue Doorbell Register used by the host Storage * Post WRB Queue Doorbell Register used by the host Storage
...@@ -664,8 +689,8 @@ struct be_fw_cfg { ...@@ -664,8 +689,8 @@ struct be_fw_cfg {
#define OPCODE_COMMON_TCP_UPLOAD 56 #define OPCODE_COMMON_TCP_UPLOAD 56
#define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1 #define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1
/* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */ /* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */
#define CMD_ISCSI_CONNECTION_INVALIDATE 1 #define CMD_ISCSI_CONNECTION_INVALIDATE 0x8001
#define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 2 #define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 0x8002
#define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42 #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42
#define INI_WR_CMD 1 /* Initiator write command */ #define INI_WR_CMD 1 /* Initiator write command */
......
...@@ -67,11 +67,11 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep, ...@@ -67,11 +67,11 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep,
cmds_max = beiscsi_ep->phba->params.wrbs_per_cxn; cmds_max = beiscsi_ep->phba->params.wrbs_per_cxn;
} }
cls_session = iscsi_session_setup(&beiscsi_iscsi_transport, cls_session = iscsi_session_setup(&beiscsi_iscsi_transport,
shost, cmds_max, shost, cmds_max,
sizeof(*beiscsi_sess), sizeof(*beiscsi_sess),
sizeof(*io_task), sizeof(*io_task),
initial_cmdsn, ISCSI_MAX_TARGET); initial_cmdsn, ISCSI_MAX_TARGET);
if (!cls_session) if (!cls_session)
return NULL; return NULL;
sess = cls_session->dd_data; sess = cls_session->dd_data;
...@@ -297,7 +297,7 @@ int beiscsi_get_host_param(struct Scsi_Host *shost, ...@@ -297,7 +297,7 @@ int beiscsi_get_host_param(struct Scsi_Host *shost,
switch (param) { switch (param) {
case ISCSI_HOST_PARAM_HWADDRESS: case ISCSI_HOST_PARAM_HWADDRESS:
be_cmd_get_mac_addr(&phba->ctrl, phba->mac_address); be_cmd_get_mac_addr(phba, phba->mac_address);
len = sysfs_format_mac(buf, phba->mac_address, ETH_ALEN); len = sysfs_format_mac(buf, phba->mac_address, ETH_ALEN);
break; break;
default: default:
...@@ -377,16 +377,12 @@ int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn) ...@@ -377,16 +377,12 @@ int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn)
struct beiscsi_conn *beiscsi_conn = conn->dd_data; struct beiscsi_conn *beiscsi_conn = conn->dd_data;
struct beiscsi_endpoint *beiscsi_ep; struct beiscsi_endpoint *beiscsi_ep;
struct beiscsi_offload_params params; struct beiscsi_offload_params params;
struct iscsi_session *session = conn->session;
struct Scsi_Host *shost = iscsi_session_to_shost(session->cls_session);
struct beiscsi_hba *phba = iscsi_host_priv(shost);
memset(&params, 0, sizeof(struct beiscsi_offload_params)); memset(&params, 0, sizeof(struct beiscsi_offload_params));
beiscsi_ep = beiscsi_conn->ep; beiscsi_ep = beiscsi_conn->ep;
if (!beiscsi_ep) if (!beiscsi_ep)
SE_DEBUG(DBG_LVL_1, "In beiscsi_conn_start , no beiscsi_ep\n"); SE_DEBUG(DBG_LVL_1, "In beiscsi_conn_start , no beiscsi_ep\n");
free_mgmt_sgl_handle(phba, beiscsi_conn->plogin_sgl_handle);
beiscsi_conn->login_in_progress = 0; beiscsi_conn->login_in_progress = 0;
beiscsi_set_params_for_offld(beiscsi_conn, &params); beiscsi_set_params_for_offld(beiscsi_conn, &params);
beiscsi_offload_connection(beiscsi_conn, &params); beiscsi_offload_connection(beiscsi_conn, &params);
...@@ -498,6 +494,13 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, ...@@ -498,6 +494,13 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
SE_DEBUG(DBG_LVL_1, "shost is NULL \n"); SE_DEBUG(DBG_LVL_1, "shost is NULL \n");
return ERR_PTR(ret); return ERR_PTR(ret);
} }
if (phba->state) {
ret = -EBUSY;
SE_DEBUG(DBG_LVL_1, "The Adapet state is Not UP \n");
return ERR_PTR(ret);
}
ep = iscsi_create_endpoint(sizeof(struct beiscsi_endpoint)); ep = iscsi_create_endpoint(sizeof(struct beiscsi_endpoint));
if (!ep) { if (!ep) {
ret = -ENOMEM; ret = -ENOMEM;
......
This diff is collapsed.
...@@ -21,11 +21,9 @@ ...@@ -21,11 +21,9 @@
#ifndef _BEISCSI_MAIN_ #ifndef _BEISCSI_MAIN_
#define _BEISCSI_MAIN_ #define _BEISCSI_MAIN_
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/in.h> #include <linux/in.h>
#include <linux/blk-iopoll.h>
#include <scsi/scsi.h> #include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h> #include <scsi/scsi_device.h>
...@@ -35,12 +33,8 @@ ...@@ -35,12 +33,8 @@
#include <scsi/scsi_transport_iscsi.h> #include <scsi/scsi_transport_iscsi.h>
#include "be.h" #include "be.h"
#define DRV_NAME "be2iscsi" #define DRV_NAME "be2iscsi"
#define BUILD_STR "2.0.527.0" #define BUILD_STR "2.0.527.0"
#define BE_NAME "ServerEngines BladeEngine2" \ #define BE_NAME "ServerEngines BladeEngine2" \
"Linux iSCSI Driver version" BUILD_STR "Linux iSCSI Driver version" BUILD_STR
#define DRV_DESC BE_NAME " " "Driver" #define DRV_DESC BE_NAME " " "Driver"
...@@ -49,6 +43,8 @@ ...@@ -49,6 +43,8 @@
#define BE_DEVICE_ID1 0x212 #define BE_DEVICE_ID1 0x212
#define OC_DEVICE_ID1 0x702 #define OC_DEVICE_ID1 0x702
#define OC_DEVICE_ID2 0x703 #define OC_DEVICE_ID2 0x703
#define OC_DEVICE_ID3 0x712
#define OC_DEVICE_ID4 0x222
#define BE2_MAX_SESSIONS 64 #define BE2_MAX_SESSIONS 64
#define BE2_CMDS_PER_CXN 128 #define BE2_CMDS_PER_CXN 128
...@@ -63,6 +59,7 @@ ...@@ -63,6 +59,7 @@
#define BE2_IO_DEPTH \ #define BE2_IO_DEPTH \
(BE2_MAX_ICDS / 2 - (BE2_LOGOUTS + BE2_TMFS + BE2_NOPOUT_REQ)) (BE2_MAX_ICDS / 2 - (BE2_LOGOUTS + BE2_TMFS + BE2_NOPOUT_REQ))
#define MAX_CPUS 31
#define BEISCSI_SGLIST_ELEMENTS BE2_SGE #define BEISCSI_SGLIST_ELEMENTS BE2_SGE
#define BEISCSI_MAX_CMNDS 1024 /* Max IO's per Ctrlr sht->can_queue */ #define BEISCSI_MAX_CMNDS 1024 /* Max IO's per Ctrlr sht->can_queue */
...@@ -79,7 +76,7 @@ ...@@ -79,7 +76,7 @@
#define BE_SENSE_INFO_SIZE 258 #define BE_SENSE_INFO_SIZE 258
#define BE_ISCSI_PDU_HEADER_SIZE 64 #define BE_ISCSI_PDU_HEADER_SIZE 64
#define BE_MIN_MEM_SIZE 16384 #define BE_MIN_MEM_SIZE 16384
#define MAX_CMD_SZ 65536
#define IIOC_SCSI_DATA 0x05 /* Write Operation */ #define IIOC_SCSI_DATA 0x05 /* Write Operation */
#define DBG_LVL 0x00000001 #define DBG_LVL 0x00000001
...@@ -100,6 +97,8 @@ do { \ ...@@ -100,6 +97,8 @@ do { \
} \ } \
} while (0); } while (0);
#define BE_ADAPTER_UP 0x00000000
#define BE_ADAPTER_LINK_DOWN 0x00000001
/** /**
* hardware needs the async PDU buffers to be posted in multiples of 8 * hardware needs the async PDU buffers to be posted in multiples of 8
* So have atleast 8 of them by default * So have atleast 8 of them by default
...@@ -160,21 +159,19 @@ do { \ ...@@ -160,21 +159,19 @@ do { \
enum be_mem_enum { enum be_mem_enum {
HWI_MEM_ADDN_CONTEXT, HWI_MEM_ADDN_CONTEXT,
HWI_MEM_CQ,
HWI_MEM_EQ,
HWI_MEM_WRB, HWI_MEM_WRB,
HWI_MEM_WRBH, HWI_MEM_WRBH,
HWI_MEM_SGLH, /* 5 */ HWI_MEM_SGLH,
HWI_MEM_SGE, HWI_MEM_SGE,
HWI_MEM_ASYNC_HEADER_BUF, HWI_MEM_ASYNC_HEADER_BUF, /* 5 */
HWI_MEM_ASYNC_DATA_BUF, HWI_MEM_ASYNC_DATA_BUF,
HWI_MEM_ASYNC_HEADER_RING, HWI_MEM_ASYNC_HEADER_RING,
HWI_MEM_ASYNC_DATA_RING, /* 10 */ HWI_MEM_ASYNC_DATA_RING,
HWI_MEM_ASYNC_HEADER_HANDLE, HWI_MEM_ASYNC_HEADER_HANDLE,
HWI_MEM_ASYNC_DATA_HANDLE, HWI_MEM_ASYNC_DATA_HANDLE, /* 10 */
HWI_MEM_ASYNC_PDU_CONTEXT, HWI_MEM_ASYNC_PDU_CONTEXT,
ISCSI_MEM_GLOBAL_HEADER, ISCSI_MEM_GLOBAL_HEADER,
SE_MEM_MAX /* 15 */ SE_MEM_MAX
}; };
struct be_bus_address32 { struct be_bus_address32 {
...@@ -212,6 +209,9 @@ struct be_mem_descriptor { ...@@ -212,6 +209,9 @@ struct be_mem_descriptor {
struct sgl_handle { struct sgl_handle {
unsigned int sgl_index; unsigned int sgl_index;
unsigned int type;
unsigned int cid;
struct iscsi_task *task;
struct iscsi_sge *pfrag; struct iscsi_sge *pfrag;
}; };
...@@ -274,13 +274,17 @@ struct beiscsi_hba { ...@@ -274,13 +274,17 @@ struct beiscsi_hba {
struct pci_dev *pcidev; struct pci_dev *pcidev;
unsigned int state; unsigned int state;
unsigned short asic_revision; unsigned short asic_revision;
struct blk_iopoll iopoll; unsigned int num_cpus;
unsigned int nxt_cqid;
struct msix_entry msix_entries[MAX_CPUS + 1];
bool msix_enabled;
struct be_mem_descriptor *init_mem; struct be_mem_descriptor *init_mem;
unsigned short io_sgl_alloc_index; unsigned short io_sgl_alloc_index;
unsigned short io_sgl_free_index; unsigned short io_sgl_free_index;
unsigned short io_sgl_hndl_avbl; unsigned short io_sgl_hndl_avbl;
struct sgl_handle **io_sgl_hndl_base; struct sgl_handle **io_sgl_hndl_base;
struct sgl_handle **sgl_hndl_array;
unsigned short eh_sgl_alloc_index; unsigned short eh_sgl_alloc_index;
unsigned short eh_sgl_free_index; unsigned short eh_sgl_free_index;
...@@ -315,6 +319,7 @@ struct beiscsi_hba { ...@@ -315,6 +319,7 @@ struct beiscsi_hba {
unsigned short cid_alloc; unsigned short cid_alloc;
unsigned short cid_free; unsigned short cid_free;
unsigned short avlbl_cids; unsigned short avlbl_cids;
unsigned short iscsi_features;
spinlock_t cid_lock; spinlock_t cid_lock;
} fw_config; } fw_config;
...@@ -343,6 +348,7 @@ struct beiscsi_conn { ...@@ -343,6 +348,7 @@ struct beiscsi_conn {
unsigned short login_in_progress; unsigned short login_in_progress;
struct sgl_handle *plogin_sgl_handle; struct sgl_handle *plogin_sgl_handle;
struct beiscsi_session *beiscsi_sess; struct beiscsi_session *beiscsi_sess;
struct iscsi_task *task;
}; };
/* This structure is used by the chip */ /* This structure is used by the chip */
...@@ -390,7 +396,7 @@ struct beiscsi_io_task { ...@@ -390,7 +396,7 @@ struct beiscsi_io_task {
unsigned int flags; unsigned int flags;
unsigned short cid; unsigned short cid;
unsigned short header_len; unsigned short header_len;
itt_t libiscsi_itt;
struct be_cmd_bhs *cmd_bhs; struct be_cmd_bhs *cmd_bhs;
struct be_bus_address bhs_pa; struct be_bus_address bhs_pa;
unsigned short bhs_len; unsigned short bhs_len;
...@@ -599,7 +605,6 @@ struct amap_cq_db { ...@@ -599,7 +605,6 @@ struct amap_cq_db {
void beiscsi_process_eq(struct beiscsi_hba *phba); void beiscsi_process_eq(struct beiscsi_hba *phba);
struct iscsi_wrb { struct iscsi_wrb {
u32 dw[16]; u32 dw[16];
} __packed; } __packed;
...@@ -820,10 +825,12 @@ struct wrb_handle { ...@@ -820,10 +825,12 @@ struct wrb_handle {
}; };
struct hwi_context_memory { struct hwi_context_memory {
struct be_eq_obj be_eq; /* Adaptive interrupt coalescing (AIC) info */
struct be_queue_info be_cq; u16 min_eqd; /* in usecs */
struct be_queue_info be_mcc_cq; u16 max_eqd; /* in usecs */
struct be_queue_info be_mcc; u16 cur_eqd; /* in usecs */
struct be_eq_obj be_eq[MAX_CPUS];
struct be_queue_info be_cq[MAX_CPUS];
struct be_queue_info be_def_hdrq; struct be_queue_info be_def_hdrq;
struct be_queue_info be_def_dataq; struct be_queue_info be_def_dataq;
......
...@@ -35,7 +35,6 @@ unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl, ...@@ -35,7 +35,6 @@ unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl,
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_QUERY_FIRMWARE_CONFIG, sizeof(*req)); OPCODE_COMMON_QUERY_FIRMWARE_CONFIG, sizeof(*req));
status = be_mbox_notify(ctrl); status = be_mbox_notify(ctrl);
if (!status) { if (!status) {
struct be_fw_cfg *pfw_cfg; struct be_fw_cfg *pfw_cfg;
...@@ -58,7 +57,8 @@ unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl, ...@@ -58,7 +57,8 @@ unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl,
return status; return status;
} }
unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl) unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
struct beiscsi_hba *phba)
{ {
struct be_dma_mem nonemb_cmd; struct be_dma_mem nonemb_cmd;
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
...@@ -85,7 +85,6 @@ unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl) ...@@ -85,7 +85,6 @@ unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl)
sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd.dma)); sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd.dma));
sge->pa_lo = cpu_to_le32(nonemb_cmd.dma & 0xFFFFFFFF); sge->pa_lo = cpu_to_le32(nonemb_cmd.dma & 0xFFFFFFFF);
sge->len = cpu_to_le32(nonemb_cmd.size); sge->len = cpu_to_le32(nonemb_cmd.size);
status = be_mbox_notify(ctrl); status = be_mbox_notify(ctrl);
if (!status) { if (!status) {
struct be_mgmt_controller_attributes_resp *resp = nonemb_cmd.va; struct be_mgmt_controller_attributes_resp *resp = nonemb_cmd.va;
...@@ -95,21 +94,25 @@ unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl) ...@@ -95,21 +94,25 @@ unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl)
resp->params.hba_attribs.firmware_version_string); resp->params.hba_attribs.firmware_version_string);
SE_DEBUG(DBG_LVL_8, SE_DEBUG(DBG_LVL_8,
"Developer Build, not performing version check...\n"); "Developer Build, not performing version check...\n");
phba->fw_config.iscsi_features =
resp->params.hba_attribs.iscsi_features;
SE_DEBUG(DBG_LVL_8, " phba->fw_config.iscsi_features = %d\n",
phba->fw_config.iscsi_features);
} else } else
SE_DEBUG(DBG_LVL_1, " Failed in mgmt_check_supported_fw\n"); SE_DEBUG(DBG_LVL_1, " Failed in mgmt_check_supported_fw\n");
spin_unlock(&ctrl->mbox_lock);
if (nonemb_cmd.va) if (nonemb_cmd.va)
pci_free_consistent(ctrl->pdev, nonemb_cmd.size, pci_free_consistent(ctrl->pdev, nonemb_cmd.size,
nonemb_cmd.va, nonemb_cmd.dma); nonemb_cmd.va, nonemb_cmd.dma);
spin_unlock(&ctrl->mbox_lock);
return status; return status;
} }
unsigned char mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute) unsigned char mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute)
{ {
struct be_ctrl_info *ctrl = &phba->ctrl; struct be_ctrl_info *ctrl = &phba->ctrl;
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
struct iscsi_cleanup_req *req = embedded_payload(wrb); struct iscsi_cleanup_req *req = embedded_payload(wrb);
int status = 0; int status = 0;
...@@ -124,7 +127,7 @@ unsigned char mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute) ...@@ -124,7 +127,7 @@ unsigned char mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute)
req->hdr_ring_id = 0; req->hdr_ring_id = 0;
req->data_ring_id = 0; req->data_ring_id = 0;
status = be_mbox_notify(ctrl); status = be_mcc_notify_wait(phba);
if (status) if (status)
shost_printk(KERN_WARNING, phba->shost, shost_printk(KERN_WARNING, phba->shost,
" mgmt_epfw_cleanup , FAILED\n"); " mgmt_epfw_cleanup , FAILED\n");
...@@ -137,7 +140,7 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba, ...@@ -137,7 +140,7 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba,
{ {
struct be_dma_mem nonemb_cmd; struct be_dma_mem nonemb_cmd;
struct be_ctrl_info *ctrl = &phba->ctrl; struct be_ctrl_info *ctrl = &phba->ctrl;
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
struct be_sge *sge = nonembedded_sgl(wrb); struct be_sge *sge = nonembedded_sgl(wrb);
struct invalidate_commands_params_in *req; struct invalidate_commands_params_in *req;
int status = 0; int status = 0;
...@@ -169,7 +172,7 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba, ...@@ -169,7 +172,7 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba,
sge->pa_lo = cpu_to_le32(nonemb_cmd.dma & 0xFFFFFFFF); sge->pa_lo = cpu_to_le32(nonemb_cmd.dma & 0xFFFFFFFF);
sge->len = cpu_to_le32(nonemb_cmd.size); sge->len = cpu_to_le32(nonemb_cmd.size);
status = be_mbox_notify(ctrl); status = be_mcc_notify_wait(phba);
if (status) if (status)
SE_DEBUG(DBG_LVL_1, "ICDS Invalidation Failed\n"); SE_DEBUG(DBG_LVL_1, "ICDS Invalidation Failed\n");
spin_unlock(&ctrl->mbox_lock); spin_unlock(&ctrl->mbox_lock);
...@@ -186,7 +189,7 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba, ...@@ -186,7 +189,7 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba,
unsigned short savecfg_flag) unsigned short savecfg_flag)
{ {
struct be_ctrl_info *ctrl = &phba->ctrl; struct be_ctrl_info *ctrl = &phba->ctrl;
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
struct iscsi_invalidate_connection_params_in *req = struct iscsi_invalidate_connection_params_in *req =
embedded_payload(wrb); embedded_payload(wrb);
int status = 0; int status = 0;
...@@ -205,7 +208,7 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba, ...@@ -205,7 +208,7 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba,
else else
req->cleanup_type = CMD_ISCSI_CONNECTION_INVALIDATE; req->cleanup_type = CMD_ISCSI_CONNECTION_INVALIDATE;
req->save_cfg = savecfg_flag; req->save_cfg = savecfg_flag;
status = be_mbox_notify(ctrl); status = be_mcc_notify_wait(phba);
if (status) if (status)
SE_DEBUG(DBG_LVL_1, "Invalidation Failed\n"); SE_DEBUG(DBG_LVL_1, "Invalidation Failed\n");
...@@ -217,7 +220,7 @@ unsigned char mgmt_upload_connection(struct beiscsi_hba *phba, ...@@ -217,7 +220,7 @@ unsigned char mgmt_upload_connection(struct beiscsi_hba *phba,
unsigned short cid, unsigned int upload_flag) unsigned short cid, unsigned int upload_flag)
{ {
struct be_ctrl_info *ctrl = &phba->ctrl; struct be_ctrl_info *ctrl = &phba->ctrl;
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
struct tcp_upload_params_in *req = embedded_payload(wrb); struct tcp_upload_params_in *req = embedded_payload(wrb);
int status = 0; int status = 0;
...@@ -229,7 +232,7 @@ unsigned char mgmt_upload_connection(struct beiscsi_hba *phba, ...@@ -229,7 +232,7 @@ unsigned char mgmt_upload_connection(struct beiscsi_hba *phba,
OPCODE_COMMON_TCP_UPLOAD, sizeof(*req)); OPCODE_COMMON_TCP_UPLOAD, sizeof(*req));
req->id = (unsigned short)cid; req->id = (unsigned short)cid;
req->upload_type = (unsigned char)upload_flag; req->upload_type = (unsigned char)upload_flag;
status = be_mbox_notify(ctrl); status = be_mcc_notify_wait(phba);
if (status) if (status)
SE_DEBUG(DBG_LVL_1, "mgmt_upload_connection Failed\n"); SE_DEBUG(DBG_LVL_1, "mgmt_upload_connection Failed\n");
spin_unlock(&ctrl->mbox_lock); spin_unlock(&ctrl->mbox_lock);
...@@ -245,13 +248,14 @@ int mgmt_open_connection(struct beiscsi_hba *phba, ...@@ -245,13 +248,14 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
struct sockaddr_in *daddr_in = (struct sockaddr_in *)dst_addr; struct sockaddr_in *daddr_in = (struct sockaddr_in *)dst_addr;
struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr; struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr;
struct be_ctrl_info *ctrl = &phba->ctrl; struct be_ctrl_info *ctrl = &phba->ctrl;
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
struct tcp_connect_and_offload_in *req = embedded_payload(wrb); struct tcp_connect_and_offload_in *req = embedded_payload(wrb);
unsigned short def_hdr_id; unsigned short def_hdr_id;
unsigned short def_data_id; unsigned short def_data_id;
struct phys_addr template_address = { 0, 0 }; struct phys_addr template_address = { 0, 0 };
struct phys_addr *ptemplate_address; struct phys_addr *ptemplate_address;
int status = 0; int status = 0;
unsigned int i;
unsigned short cid = beiscsi_ep->ep_cid; unsigned short cid = beiscsi_ep->ep_cid;
phwi_ctrlr = phba->phwi_ctrlr; phwi_ctrlr = phba->phwi_ctrlr;
...@@ -296,14 +300,18 @@ int mgmt_open_connection(struct beiscsi_hba *phba, ...@@ -296,14 +300,18 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
} }
req->cid = cid; req->cid = cid;
req->cq_id = phwi_context->be_cq.id; i = phba->nxt_cqid++;
if (phba->nxt_cqid == phba->num_cpus)
phba->nxt_cqid = 0;
req->cq_id = phwi_context->be_cq[i].id;
SE_DEBUG(DBG_LVL_8, "i=%d cq_id=%d \n", i, req->cq_id);
req->defq_id = def_hdr_id; req->defq_id = def_hdr_id;
req->hdr_ring_id = def_hdr_id; req->hdr_ring_id = def_hdr_id;
req->data_ring_id = def_data_id; req->data_ring_id = def_data_id;
req->do_offload = 1; req->do_offload = 1;
req->dataout_template_pa.lo = ptemplate_address->lo; req->dataout_template_pa.lo = ptemplate_address->lo;
req->dataout_template_pa.hi = ptemplate_address->hi; req->dataout_template_pa.hi = ptemplate_address->hi;
status = be_mbox_notify(ctrl); status = be_mcc_notify_wait(phba);
if (!status) { if (!status) {
struct iscsi_endpoint *ep; struct iscsi_endpoint *ep;
struct tcp_connect_and_offload_out *ptcpcnct_out = struct tcp_connect_and_offload_out *ptcpcnct_out =
...@@ -311,7 +319,7 @@ int mgmt_open_connection(struct beiscsi_hba *phba, ...@@ -311,7 +319,7 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
ep = phba->ep_array[ptcpcnct_out->cid]; ep = phba->ep_array[ptcpcnct_out->cid];
beiscsi_ep = ep->dd_data; beiscsi_ep = ep->dd_data;
beiscsi_ep->fw_handle = 0; beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
beiscsi_ep->cid_vld = 1; beiscsi_ep->cid_vld = 1;
SE_DEBUG(DBG_LVL_8, "mgmt_open_connection Success\n"); SE_DEBUG(DBG_LVL_8, "mgmt_open_connection Success\n");
} else } else
...@@ -319,3 +327,30 @@ int mgmt_open_connection(struct beiscsi_hba *phba, ...@@ -319,3 +327,30 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
spin_unlock(&ctrl->mbox_lock); spin_unlock(&ctrl->mbox_lock);
return status; return status;
} }
int be_cmd_get_mac_addr(struct beiscsi_hba *phba, u8 *mac_addr)
{
struct be_ctrl_info *ctrl = &phba->ctrl;
struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
struct be_cmd_req_get_mac_addr *req = embedded_payload(wrb);
int status;
SE_DEBUG(DBG_LVL_8, "In be_cmd_get_mac_addr\n");
spin_lock(&ctrl->mbox_lock);
memset(wrb, 0, sizeof(*wrb));
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG,
sizeof(*req));
status = be_mcc_notify_wait(phba);
if (!status) {
struct be_cmd_resp_get_mac_addr *resp = embedded_payload(wrb);
memcpy(mac_addr, resp->mac_address, ETH_ALEN);
}
spin_unlock(&ctrl->mbox_lock);
return status;
}
...@@ -175,7 +175,9 @@ struct mgmt_hba_attributes { ...@@ -175,7 +175,9 @@ struct mgmt_hba_attributes {
u8 phy_port; u8 phy_port;
u32 firmware_post_status; u32 firmware_post_status;
u32 hba_mtu[8]; u32 hba_mtu[8];
u32 future_u32[4]; u8 iscsi_features;
u8 future_u8[3];
u32 future_u32[3];
} __packed; } __packed;
struct mgmt_controller_attributes { struct mgmt_controller_attributes {
...@@ -246,4 +248,8 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba, ...@@ -246,4 +248,8 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba,
unsigned short cid, unsigned short cid,
unsigned short issue_reset, unsigned short issue_reset,
unsigned short savecfg_flag); unsigned short savecfg_flag);
unsigned char mgmt_fw_cmd(struct be_ctrl_info *ctrl,
struct beiscsi_hba *phba,
char *buf, unsigned int len);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment