From: Mike Christie on
On 08/09/2010 12:53 PM, kxie(a)chelsio.com wrote:
> +void cxgbi_fill_iscsi_transport(struct iscsi_transport *itp)
> +{
> + /* owner and name should be set already */
> + itp->caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_HDRDGST
> + | CAP_DATADGST | CAP_DIGEST_OFFLOAD |
> + CAP_PADDING_OFFLOAD;
> + itp->param_mask = ISCSI_MAX_RECV_DLENGTH |
> + ISCSI_MAX_XMIT_DLENGTH |
> + ISCSI_HDRDGST_EN |
> + ISCSI_DATADGST_EN |
> + ISCSI_INITIAL_R2T_EN |
> + ISCSI_MAX_R2T |
> + ISCSI_IMM_DATA_EN |
> + ISCSI_FIRST_BURST |
> + ISCSI_MAX_BURST |
> + ISCSI_PDU_INORDER_EN |
> + ISCSI_DATASEQ_INORDER_EN |
> + ISCSI_ERL |
> + ISCSI_CONN_PORT |
> + ISCSI_CONN_ADDRESS |
> + ISCSI_EXP_STATSN |
> + ISCSI_PERSISTENT_PORT |
> + ISCSI_PERSISTENT_ADDRESS |
> + ISCSI_TARGET_NAME | ISCSI_TPGT |
> + ISCSI_USERNAME | ISCSI_PASSWORD |
> + ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
> + ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
> + ISCSI_LU_RESET_TMO | ISCSI_TGT_RESET_TMO |
> + ISCSI_PING_TMO | ISCSI_RECV_TMO |
> + ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME;
> + itp->host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS |
> + ISCSI_HOST_INITIATOR_NAME |
> + ISCSI_HOST_NETDEV_NAME;
> + itp->get_host_param = cxgbi_get_host_param;
> + itp->set_host_param = cxgbi_set_host_param;
> + /* session management */
> + itp->create_session = cxgbi_create_session;
> + itp->destroy_session = cxgbi_destroy_session;
> + itp->get_session_param = iscsi_session_get_param;
> + /* connection management */
> + itp->create_conn = cxgbi_create_conn;
> + itp->bind_conn = cxgbi_bind_conn;
> + itp->destroy_conn = iscsi_tcp_conn_teardown;
> + itp->start_conn = iscsi_conn_start;
> + itp->stop_conn = iscsi_conn_stop;
> + itp->get_conn_param = cxgbi_get_conn_param;
> + itp->set_param = cxgbi_set_conn_param;
> + itp->get_stats = cxgbi_get_conn_stats;
> + /* pdu xmit reqitp-> from user space */
> + itp->send_pdu = iscsi_conn_send_pdu;
> + /* task */
> + itp->init_task = iscsi_tcp_task_init;
> + itp->xmit_task = iscsi_tcp_task_xmit;
> + itp->cleanup_task = cxgbi_cleanup_task;
> +
> + /* pdu */
> + itp->alloc_pdu = cxgbi_conn_alloc_pdu;
> + itp->init_pdu = cxgbi_conn_init_pdu;
> + itp->xmit_pdu = cxgbi_conn_xmit_pdu;
> + itp->parse_pdu_itt = cxgbi_parse_pdu_itt;
> +
> + /* TCP connect/disconnect */
> + itp->ep_connect = cxgbi_ep_connect;
> + itp->ep_poll = cxgbi_ep_poll;
> + itp->ep_disconnect = cxgbi_ep_disconnect;
> + /* Error recovery timeout call */
> + itp->session_recovery_timedout = iscsi_session_recovery_timedout;
> +}
> +EXPORT_SYMBOL_GPL(cxgbi_fill_iscsi_transport);
> +
> +void cxgbi_fill_scsi_host_template(struct scsi_host_template *sht)
> +{
> + /*
> + * the following fields should be set already:
> + * module; name, proc_name, can_queue
> + */
> + sht->queuecommand = iscsi_queuecommand;
> + sht->change_queue_depth = iscsi_change_queue_depth;
> + sht->sg_tablesize = SG_ALL;
> + sht->max_sectors = 0xFFFF;
> + sht->cmd_per_lun = ISCSI_DEF_CMD_PER_LUN;
> + sht->eh_abort_handler = iscsi_eh_abort;
> + sht->eh_device_reset_handler = iscsi_eh_device_reset;
> + sht->eh_target_reset_handler = iscsi_eh_recover_target;
> + sht->target_alloc = iscsi_target_alloc;
> + sht->use_clustering = DISABLE_CLUSTERING;
> + sht->this_id = -1;
> +}
> +EXPORT_SYMBOL_GPL(cxgbi_fill_scsi_host_template);
> +

Can each module just set these callouts in the low level module?
static struct scsi_host_template cxgb3i_host_template = {
.module = THIS_MODULE,
.name = DRV_MODULE_NAME,
.proc_name = DRV_MODULE_NAME,
.can_queue = CXGB3I_SCSI_HOST_QDEPTH,
.queuecommand = iscsi_queuecommand;
.change_queue_depth = iscsi_change_queue_depth;

etc...

Can you just do that for the iscsi_transport callouts too? I think it is
more standard way of doing it in scsi drivers when there is no need to
dynamically do it.


If you build both drivers in the kernel instead of modules you get this
error message:

drivers/scsi/cxgbi/cxgb3i/built-in.o:(.bss+0x0): multiple definition of
`dbg_level'
drivers/scsi/cxgbi/libcxgbi.o:(.bss+0x0): first defined here
drivers/scsi/cxgbi/cxgb4i/built-in.o:(.bss+0x0): multiple definition of
`dbg_level'
drivers/scsi/cxgbi/libcxgbi.o:(.bss+0x0): first defined here
make[3]: *** [drivers/scsi/cxgbi/built-in.o] Error 1
make[2]: *** [drivers/scsi/cxgbi] Error 2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Karen Xie on
Sure, I will move the callouts for both iscsi_transport and
scsi_host_template to LLD.

Thanks,
Karen

-----Original Message-----
From: Mike Christie [mailto:michaelc(a)cs.wisc.edu]
Sent: Wednesday, August 11, 2010 11:28 AM
To: open-iscsi(a)googlegroups.com
Cc: Karen Xie; linux-kernel(a)vger.kernel.org; linux-scsi(a)vger.kernel.org;
Rakesh Ranjan; James.Bottomley(a)HansenPartnership.com
Subject: Re: [PATCH 1/3] libcxgbi: common library for cxgb3i and cxgb4i

On 08/09/2010 12:53 PM, kxie(a)chelsio.com wrote:
> +void cxgbi_fill_iscsi_transport(struct iscsi_transport *itp)
> +{
> + /* owner and name should be set already */
> + itp->caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T |
CAP_HDRDGST
> + | CAP_DATADGST | CAP_DIGEST_OFFLOAD |
> + CAP_PADDING_OFFLOAD;
> + itp->param_mask = ISCSI_MAX_RECV_DLENGTH |
> + ISCSI_MAX_XMIT_DLENGTH |
> + ISCSI_HDRDGST_EN |
> + ISCSI_DATADGST_EN |
> + ISCSI_INITIAL_R2T_EN |
> + ISCSI_MAX_R2T |
> + ISCSI_IMM_DATA_EN |
> + ISCSI_FIRST_BURST |
> + ISCSI_MAX_BURST |
> + ISCSI_PDU_INORDER_EN |
> + ISCSI_DATASEQ_INORDER_EN |
> + ISCSI_ERL |
> + ISCSI_CONN_PORT |
> + ISCSI_CONN_ADDRESS |
> + ISCSI_EXP_STATSN |
> + ISCSI_PERSISTENT_PORT |
> + ISCSI_PERSISTENT_ADDRESS |
> + ISCSI_TARGET_NAME | ISCSI_TPGT |
> + ISCSI_USERNAME | ISCSI_PASSWORD |
> + ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
> + ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
> + ISCSI_LU_RESET_TMO | ISCSI_TGT_RESET_TMO
|
> + ISCSI_PING_TMO | ISCSI_RECV_TMO |
> + ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME;
> + itp->host_param_mask = ISCSI_HOST_HWADDRESS |
ISCSI_HOST_IPADDRESS |
> + ISCSI_HOST_INITIATOR_NAME |
> + ISCSI_HOST_NETDEV_NAME;
> + itp->get_host_param = cxgbi_get_host_param;
> + itp->set_host_param = cxgbi_set_host_param;
> + /* session management */
> + itp->create_session = cxgbi_create_session;
> + itp->destroy_session = cxgbi_destroy_session;
> + itp->get_session_param = iscsi_session_get_param;
> + /* connection management */
> + itp->create_conn = cxgbi_create_conn;
> + itp->bind_conn = cxgbi_bind_conn;
> + itp->destroy_conn = iscsi_tcp_conn_teardown;
> + itp->start_conn = iscsi_conn_start;
> + itp->stop_conn = iscsi_conn_stop;
> + itp->get_conn_param = cxgbi_get_conn_param;
> + itp->set_param = cxgbi_set_conn_param;
> + itp->get_stats = cxgbi_get_conn_stats;
> + /* pdu xmit reqitp-> from user space */
> + itp->send_pdu = iscsi_conn_send_pdu;
> + /* task */
> + itp->init_task = iscsi_tcp_task_init;
> + itp->xmit_task = iscsi_tcp_task_xmit;
> + itp->cleanup_task = cxgbi_cleanup_task;
> +
> + /* pdu */
> + itp->alloc_pdu = cxgbi_conn_alloc_pdu;
> + itp->init_pdu = cxgbi_conn_init_pdu;
> + itp->xmit_pdu = cxgbi_conn_xmit_pdu;
> + itp->parse_pdu_itt = cxgbi_parse_pdu_itt;
> +
> + /* TCP connect/disconnect */
> + itp->ep_connect = cxgbi_ep_connect;
> + itp->ep_poll = cxgbi_ep_poll;
> + itp->ep_disconnect = cxgbi_ep_disconnect;
> + /* Error recovery timeout call */
> + itp->session_recovery_timedout =
iscsi_session_recovery_timedout;
> +}
> +EXPORT_SYMBOL_GPL(cxgbi_fill_iscsi_transport);
> +
> +void cxgbi_fill_scsi_host_template(struct scsi_host_template *sht)
> +{
> + /*
> + * the following fields should be set already:
> + * module; name, proc_name, can_queue
> + */
> + sht->queuecommand = iscsi_queuecommand;
> + sht->change_queue_depth = iscsi_change_queue_depth;
> + sht->sg_tablesize = SG_ALL;
> + sht->max_sectors = 0xFFFF;
> + sht->cmd_per_lun = ISCSI_DEF_CMD_PER_LUN;
> + sht->eh_abort_handler = iscsi_eh_abort;
> + sht->eh_device_reset_handler = iscsi_eh_device_reset;
> + sht->eh_target_reset_handler = iscsi_eh_recover_target;
> + sht->target_alloc = iscsi_target_alloc;
> + sht->use_clustering = DISABLE_CLUSTERING;
> + sht->this_id = -1;
> +}
> +EXPORT_SYMBOL_GPL(cxgbi_fill_scsi_host_template);
> +

Can each module just set these callouts in the low level module?
static struct scsi_host_template cxgb3i_host_template = {
.module = THIS_MODULE,
.name = DRV_MODULE_NAME,
.proc_name = DRV_MODULE_NAME,
.can_queue = CXGB3I_SCSI_HOST_QDEPTH,
.queuecommand = iscsi_queuecommand;
.change_queue_depth = iscsi_change_queue_depth;

etc...

Can you just do that for the iscsi_transport callouts too? I think it is

more standard way of doing it in scsi drivers when there is no need to
dynamically do it.


If you build both drivers in the kernel instead of modules you get this
error message:

drivers/scsi/cxgbi/cxgb3i/built-in.o:(.bss+0x0): multiple definition of
`dbg_level'
drivers/scsi/cxgbi/libcxgbi.o:(.bss+0x0): first defined here
drivers/scsi/cxgbi/cxgb4i/built-in.o:(.bss+0x0): multiple definition of
`dbg_level'
drivers/scsi/cxgbi/libcxgbi.o:(.bss+0x0): first defined here
make[3]: *** [drivers/scsi/cxgbi/built-in.o] Error 1
make[2]: *** [drivers/scsi/cxgbi] Error 2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Joe Perches on
On Thu, 2010-08-12 at 19:57 -0700, kxie(a)chelsio.com wrote:
> [PATCH v2 1/3] libcxgbi: common library for cxgb3i and cxgb4i
[]
> +#define libcxgbi_log_error cxgbi_dbg_error
> +#define libcxgbi_log_warn cxgbi_dbg_warn
> +#define libcxgbi_log_info cxgbi_dbg_info
> +#define libcxgbi_log_debug(flag, fmt, args...) \
> + cxgbi_dbg_print(flag, fmt, ## args)

I think this double indirection isn't useful and it would
be simpler/better to use pr_<level>

[]

> +#define cxgbi_dbg_print(level, fmt, args...) \
> + do { \
> + if (dbg_level & (level)) \
> + printk(KERN_INFO "cxgbi: %s - " fmt, \
> + __func__ , ## args); \
> + } while (0)
> +#define cxgbi_dbg_error(fmt, args...) \
> + printk(KERN_ERR "cxgbi: ERR! %s, " fmt, __func__ , ## args)
> +#define cxgbi_dbg_warn(fmt, args...) \
> + printk(KERN_WARNING "cxgbi: WARN! %s, " fmt, __func__ , ## args)
> +#define cxgbi_dbg_info(fmt, args...) \
> + printk(KERN_INFO "cxgbi: %s, " fmt, __func__ , ## args)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Karen Xie on
Thanks,

Will use pr_xxx instead.

Karen

-----Original Message-----
From: Joe Perches [mailto:joe(a)perches.com]
Sent: Thursday, August 12, 2010 8:22 PM
To: Karen Xie
Cc: linux-kernel(a)vger.kernel.org; linux-scsi(a)vger.kernel.org; open-iscsi(a)googlegroups.com; Rakesh Ranjan; James.Bottomley(a)HansenPartnership.com; michaelc(a)cs.wisc.edu
Subject: Re: [PATCH v2 1/3] libcxgbi: common library for cxgb3i and cxgb4i

On Thu, 2010-08-12 at 19:57 -0700, kxie(a)chelsio.com wrote:
> [PATCH v2 1/3] libcxgbi: common library for cxgb3i and cxgb4i
[]
> +#define libcxgbi_log_error cxgbi_dbg_error
> +#define libcxgbi_log_warn cxgbi_dbg_warn
> +#define libcxgbi_log_info cxgbi_dbg_info
> +#define libcxgbi_log_debug(flag, fmt, args...) \
> + cxgbi_dbg_print(flag, fmt, ## args)

I think this double indirection isn't useful and it would
be simpler/better to use pr_<level>

[]

> +#define cxgbi_dbg_print(level, fmt, args...) \
> + do { \
> + if (dbg_level & (level)) \
> + printk(KERN_INFO "cxgbi: %s - " fmt, \
> + __func__ , ## args); \
> + } while (0)
> +#define cxgbi_dbg_error(fmt, args...) \
> + printk(KERN_ERR "cxgbi: ERR! %s, " fmt, __func__ , ## args)
> +#define cxgbi_dbg_warn(fmt, args...) \
> + printk(KERN_WARNING "cxgbi: WARN! %s, " fmt, __func__ , ## args)
> +#define cxgbi_dbg_info(fmt, args...) \
> + printk(KERN_INFO "cxgbi: %s, " fmt, __func__ , ## args)