cxgb3i - add handling of chip reset
PATCH 2/2 cxgb3i - add handling of chip reset
[PATCH 2/2 2.6.29-rc] cxgb3i - add support of chip reset
From: Karen Xie <[email protected]>
The cxgb3 driver would reset the chip due to an EEH event or a fatal error and notifies the upper layer modules (iscsi, rdma).
Upon receiving the notification the cxgb3i driver would
- close all the iscsi tcp connections and mark the associated sessions as failed due to connection error,
- re-initialize its offload functions,
- re-initialize the chip's ddp functions.
The iscsi error recovery mechanism will re-establish the tcp connection after reset.
This patch requires the the following cxgb3 patch in the linux-next git tree
(http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=commitdiff;h=cb0bc205959bf8c60acae9c71f3da0597e756f8e).
---
drivers/scsi/cxgb3i/cxgb3i.h | 10 + drivers/scsi/cxgb3i/cxgb3i_ddp.c | 258 +++++++++++++++++----------------- drivers/scsi/cxgb3i/cxgb3i_ddp.h | 5 - drivers/scsi/cxgb3i/cxgb3i_init.c | 25 +++ drivers/scsi/cxgb3i/cxgb3i_iscsi.c | 145 +++++++++++++------ drivers/scsi/cxgb3i/cxgb3i_offload.c | 102 +++++++++---- drivers/scsi/cxgb3i/cxgb3i_offload.h | 10 + drivers/scsi/cxgb3i/cxgb3i_pdu.c | 11 + drivers/scsi/cxgb3i/cxgb3i_pdu.h | 2 9 files changed, 338 insertions(+), 230 deletions(-)
drivers/scsi/cxgb3i/cxgb3i.h +6 -4
@@ -66,10 +66,12 @@ struct cxgb3i_hba {* @pdev: pointer to pci dev * @hba_cnt: # of hbas (the same as # of ports) * @hba: all the hbas on this adapter +* @flag: bit flag for adapter event/status * @tx_max_size: max. tx packet size supported * @rx_max_size: max. rx packet size supported * @tag_format: ddp tag format settings */ +#define CXGB3I_ADAPTER_FLAG_RESET 0x1struct cxgb3i_adapter {struct list_head list_head;spinlock_t lock;
@@ -78,6 +80,7 @@ struct cxgb3i_adapter {unsigned char hba_cnt;struct cxgb3i_hba *hba[MAX_NPORTS ]; +unsigned int flags;unsigned int tx_max_size;unsigned int rx_max_size;
@@ -137,10 +140,9 @@ struct cxgb3i_task_data {int cxgb3i_iscsi_init (void );void cxgb3i_iscsi_cleanup (void ); -struct cxgb3i_adapter *cxgb3i_adapter_add (struct t3cdev *); -void cxgb3i_adapter_remove (struct t3cdev *); -int cxgb3i_adapter_ulp_init (struct cxgb3i_adapter *); -void cxgb3i_adapter_ulp_cleanup (struct cxgb3i_adapter *); +struct cxgb3i_adapter *cxgb3i_adapter_find_by_tdev (struct t3cdev *); +void cxgb3i_adapter_open (struct t3cdev *); +void cxgb3i_adapter_close (struct t3cdev *);struct cxgb3i_hba *cxgb3i_hba_find_by_netdev (struct net_device *); struct cxgb3i_hba *cxgb3i_hba_host_add(struct cxgb3i_adapter *,
drivers/scsi/cxgb3i/cxgb3i_ddp.c +132 -126
362 lines not on this page · raw message
drivers/scsi/cxgb3i/cxgb3i_ddp.h +2 -3
@@ -286,7 +286,7 @@ static inline u32 cxgb3i_tag_nonrsvd_bits(struct cxgb3i_tag_format *tformat,int cxgb3i_ddp_tag_reserve (struct t3cdev *,unsigned int tid,struct cxgb3i_tag_format *,u32 *tag,struct cxgb3i_gather_list *,gfp_t gfp); -void cxgb3i_ddp_tag_release (struct t3cdev *,u32 tag); +int cxgb3i_ddp_tag_release (struct t3cdev *,u32 tag); struct cxgb3i_gather_list *cxgb3i_ddp_make_gl(unsigned int xferlen, struct scatterlist *sgl,
@@ -303,7 +303,6 @@ int cxgb3i_setup_conn_pagesize(struct t3cdev *, unsigned int tid, int reply,int cxgb3i_setup_conn_digest (struct t3cdev *,unsigned int tid,int hcrc,int dcrc,int reply);int cxgb3i_ddp_find_page_index (unsigned long pgsz); -int cxgb3i_adapter_ddp_init (struct t3cdev *,struct cxgb3i_tag_format *, +int cxgb3i_adapter_ddp_info (struct t3cdev *,struct cxgb3i_tag_format *,unsigned int *txsz,unsigned int *rxsz); -void cxgb3i_adapter_ddp_cleanup (struct t3cdev *);#endif
drivers/scsi/cxgb3i/cxgb3i_init.c +23 -2
@@ -26,6 +26,7 @@ MODULE_VERSION(DRV_MODULE_VERSION);static void open_s3_dev (struct t3cdev *);static void close_s3_dev (struct t3cdev *); +static void s3_err_handler (struct t3cdev *tdev,u32 status,u32 error);static cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS ];static struct cxgb3_client t3c_client = {
@@ -33,6 +34,7 @@ static struct cxgb3_client t3c_client = { .handlers = cxgb3i_cpl_handlers, .add = open_s3_dev, .remove = close_s3_dev, + .err_handler = s3_err_handler, };/**
@@ -49,7 +51,7 @@ static void open_s3_dev(struct t3cdev *t3dev) }cxgb3i_sdev_add (t3dev, &t3c_client); -cxgb3i_adapter_add (t3dev); +cxgb3i_adapter_open (t3dev); }/**
@@ -58,10 +60,29 @@ static void open_s3_dev(struct t3cdev *t3dev)*/ static void close_s3_dev (struct t3cdev *t3dev) { -cxgb3i_adapter_remove (t3dev); +cxgb3i_adapter_close (t3dev);cxgb3i_sdev_remove (t3dev); } +static void s3_err_handler (struct t3cdev *tdev,u32 status,u32 error) +{ +struct cxgb3i_adapter *snic =cxgb3i_adapter_find_by_tdev (tdev); + +cxgb3i_log_info ("snic 0x%p, tdev 0x%p, status 0x%x, err 0x%x.\n" , + snic, tdev, status, error); +if (!snic) +return ; + +switch (status) { +case OFFLOAD_STATUS_DOWN : + snic->flags |=CXGB3I_ADAPTER_FLAG_RESET ; +break ; +case OFFLOAD_STATUS_UP : + snic->flags &= ~CXGB3I_ADAPTER_FLAG_RESET ; +break ; + } +} +/** * cxgb3i_init_module - module init entry point *
drivers/scsi/cxgb3i/cxgb3i_iscsi.c +95 -50
191 lines not on this page · raw message
drivers/scsi/cxgb3i/cxgb3i_offload.c +65 -37
212 lines not on this page · raw message
drivers/scsi/cxgb3i/cxgb3i_offload.h +6 -4
@@ -135,6 +135,7 @@ enum c3cn_flags {C3CN_ABORT_RPL_PENDING ,/* expecting an abort reply */ C3CN_TX_DATA_SENT ,/* already sent a TX_DATA WR */ C3CN_ACTIVE_CLOSE_NEEDED ,/* need to be closed */ + C3CN_OFFLOAD_DOWN /* offload function off */ };/**
@@ -147,16 +148,17 @@ enum c3cn_flags {* @cdev: t3cdev adapter * @client: CPL client pointer * @ports: array of adapter ports -* @sport_map_next: next index into the port map -* @sport_map: source port map +* @sport_next: next port +* @sport_conn: source port connection */ struct cxgb3i_sdev_data {struct list_head list;struct t3cdev *cdev;struct cxgb3_client *client;struct adap_ports ports; -unsigned int sport_map_next; -unsigned long sport_map[0 ]; +spinlock_t lock; +unsigned int sport_next; +struct s3_conn *sport_conn[0 ]; };#define NDEV2CDATA (ndev) (*(struct cxgb3i_sdev_data **)&(ndev)->ec_ptr)#define CXGB3_SDEV_DATA (cdev) NDEV2CDATA((cdev)->lldev)
drivers/scsi/cxgb3i/cxgb3i_pdu.c +8 -3
@@ -483,13 +483,18 @@ void cxgb3i_conn_tx_open(struct s3_conn *c3cn) } } -void cxgb3i_conn_closing (struct s3_conn *c3cn) +void cxgb3i_conn_closing (struct s3_conn *c3cn,int error) {struct iscsi_conn *conn;read_lock (&c3cn->callback_lock); conn = c3cn->user_data; -if (conn && c3cn->state !=C3CN_STATE_ESTABLISHED ) -iscsi_conn_failure (conn,ISCSI_ERR_CONN_FAILED ); +if (conn && c3cn->state !=C3CN_STATE_ESTABLISHED ) { +if (error) +iscsi_session_failure (conn->session, +ISCSI_ERR_CONN_FAILED ); +else +iscsi_conn_failure (conn,ISCSI_ERR_CONN_FAILED ); + }read_unlock (&c3cn->callback_lock); }
drivers/scsi/cxgb3i/cxgb3i_pdu.h +1 -1
@@ -53,7 +53,7 @@ struct cpl_rx_data_ddp_norss {#define ULP2_FLAG_DCRC_ERROR 0x20#define ULP2_FLAG_PAD_ERROR 0x40 -void cxgb3i_conn_closing (struct s3_conn *c3cn); +void cxgb3i_conn_closing (struct s3_conn *c3cn,int );void cxgb3i_conn_pdu_ready (struct s3_conn *c3cn);void cxgb3i_conn_tx_open (struct s3_conn *c3cn);#endif
Quoted 50 lines · Karen Xie
[PATCH 2/2 2.6.29-rc] cxgb3i - add support of chip reset
From: Karen Xie <[email protected]>
The cxgb3 driver would reset the chip due to an EEH event or a fatal error and notifies the upper layer modules (iscsi, rdma).
Upon receiving the notification the cxgb3i driver would
- close all the iscsi tcp connections and mark the associated sessions as failed due to connection error,
- re-initialize its offload functions,
- re-initialize the chip's ddp functions.The iscsi error recovery mechanism will re-establish the tcp connection after reset.
This patch requires the the following cxgb3 patch in the linux-next git tree
(http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=commitdiff;h=cb0bc205959bf8c60acae9c71f3da0597e756f8e).static inline int ddp_find_unused_entries(struct
cxgb3i_ddp_info*ddp,drivers/scsi/cxgb3i/cxgb3i_ddp.c +6
-3@@ -439,14 +444,15 @@ EXPORT_SYMBOL_GPL(cxgb3i_ddp_tag_reserve);* @tag: ddp tag * ddp cleanup for a given ddp tag and release all the resources held */ -void cxgb3i_ddp_tag_release (struct t3cdev *tdev,u32 tag) +int cxgb3i_ddp_tag_release (struct t3cdev *tdev,u32 tag) {struct cxgb3i_ddp_info *ddp = tdev->ulp_iscsi;u32 idx; +int err = -EINVAL ;if (!ddp) {ddp_log_error ("release ddp tag 0x%x, ddp NULL.\n" , tag); -return ; +return err; } idx = (tag >>PPOD_IDX_SHIFT ) & ddp->idx_mask;@@ -457,17 +463,26 @@ void cxgb3i_ddp_tag_release(struct t3cdev *tdev, u32 tag)if (!gl) {ddp_log_error ("release ddp 0x%x, idx 0x%x, gl NULL.\n" , tag, idx); -return ; +return err; } npods = (gl->nelem +PPOD_PAGES_MAX -1 ) >>PPOD_PAGES_SHIFT ; +if (!npods) { + ddp_log_error("release ddp 0x%x, 0x%x, gl elem %u.\n",
drivers/scsi/cxgb3i/cxgb3i_ddp.c void cxgb3i_ddp_tag_release(struct t3cdev *tdev, u32 tag) · line 479
Quoted 10 lines
drivers/scsi/cxgb3i/cxgb3i_ddp.c +5
-1+ tag, idx, gl->nelem); +return err; + }ddp_log_debug ("ddp tag 0x%x, release idx 0x%x, npods %u.\n" , tag, idx, npods); -clear_ddp_map (ddp, idx, npods); +if (clear_ddp_map (ddp, tag, idx, npods) == npods) + err =0 ;ddp_unmark_entries (ddp, idx, npods);cxgb3i_ddp_release_gl (gl, ddp->pdev);
If this fails, do we leak this memory?
When is ddp_release called? Would it be called to clean up in situati this could fail?
drivers/scsi/cxgb3i/cxgb3i_iscsi.c static LIST_HEAD(cxgb3i_snic_list); · line 77
Quoted 3 lines
drivers/scsi/cxgb3i/cxgb3i_iscsi.c +3
-0+/** +* cxgb3i_adapter_remove - release all the resources held and cleanup any +* h/w settings
The docbook comment for the function description should only be one line. I think you did this in some other places.
Quoted 8 lines
drivers/scsi/cxgb3i/cxgb3i_pdu.c +1
-1-void cxgb3i_conn_closing (struct s3_conn *c3cn) +void cxgb3i_conn_closing (struct s3_conn *c3cn,int error) {struct iscsi_conn *conn;read_lock (&c3cn->callback_lock); conn = c3cn->user_data;
drivers/scsi/cxgb3i/cxgb3i_pdu.c void cxgb3i_conn_tx_open(struct s3_conn *c3cn) · line 499
Quoted 10 lines
drivers/scsi/cxgb3i/cxgb3i_pdu.c +7
-2-if (conn && c3cn->state !=C3CN_STATE_ESTABLISHED ) -iscsi_conn_failure (conn,ISCSI_ERR_CONN_FAILED ); +if (conn && c3cn->state !=C3CN_STATE_ESTABLISHED ) { +if (error) +iscsi_session_failure (conn->session, +ISCSI_ERR_CONN_FAILED ); +else +iscsi_conn_failure (conn,ISCSI_ERR_CONN_FAILED ); + }read_unlock (&c3cn->callback_lock);
If you have a ref to the conn, you can just use iscsi_conn_failure here. I thought when you got the pci error event you were just going to use the host session iter and loop over the session and fail them.
-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Wednesday, February 25, 2009 9:22 AM
To: Karen Xie
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2 2.6.29-rc] cxgb3i - add handling of chip reset
Quoted 5 lines · Karen Xie
[PATCH 2/2 2.6.29-rc] cxgb3i - add support of chip reset
From: Karen Xie <[email protected]>
The cxgb3 driver would reset the chip due to an EEH event or a fatal
error
Quoted 3 lines
and notifies the upper layer modules (iscsi, rdma).
Upon receiving the notification the cxgb3i driver would
- close all the iscsi tcp connections and mark the associated sessions
as
Quoted 5 lines
failed due to connection error,
- re-initialize its offload functions,
- re-initialize the chip's ddp functions.The iscsi error recovery mechanism will re-establish the tcp
connection after
Quoted 3 lines
reset.
This patch requires the the following cxgb3 patch in the linux-next
git tree
Quoted 1 line
(http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=commitdi
ff;h=cb0bc205959bf8c60acae9c71f3da0597e756f8e).
Quoted 5 lines
static inline int ddp_find_unused_entries(struct
cxgb3i_ddp_info
*ddp,
drivers/scsi/cxgb3i/cxgb3i_ddp.c void cxgb3i_ddp_tag_release(struct t3cdev *tdev,
Quoted 19 lines
drivers/scsi/cxgb3i/cxgb3i_ddp.c +3
-2@@ -439,14 +444,15 @@ EXPORT_SYMBOL_GPL(cxgb3i_ddp_tag_reserve);* @tag: ddp tag * ddp cleanup for a given ddp tag and release all the resources held */ -void cxgb3i_ddp_tag_release (struct t3cdev *tdev,u32 tag) +int cxgb3i_ddp_tag_release (struct t3cdev *tdev,u32 tag) {struct cxgb3i_ddp_info *ddp = tdev->ulp_iscsi;u32 idx; +int err = -EINVAL ;if (!ddp) {ddp_log_error ("release ddp tag 0x%x, ddp NULL.\n" , tag); -return ; +return err; } idx = (tag >>PPOD_IDX_SHIFT ) & ddp->idx_mask;@@ -457,17 +463,26 @@ void cxgb3i_ddp_tag_release(struct t3cdev *tdev,
u32 tag)
Review void cxgb3i_ddp_tag_release(struct t3cdev *tdev, · line 464
Quoted 2 lines
(quoted diff) +0
-0if (!gl) { ddp_log_error("release ddp 0x%x, idx 0x%x, gl
NULL.\n",
drivers/scsi/cxgb3i/cxgb3i_ddp.c void cxgb3i_ddp_tag_release(struct t3cdev *tdev, u32 tag)
Quoted 5 lines
drivers/scsi/cxgb3i/cxgb3i_ddp.c +1
-1tag, idx); -return ; +return err; } npods = (gl->nelem + PPOD_PAGES_MAX - 1) >>
PPOD_PAGES_SHIFT;
Review void cxgb3i_ddp_tag_release(struct t3cdev *tdev, · line 470
Quoted 2 lines
(quoted diff) +2
-0+ if (!npods) { + ddp_log_error("release ddp 0x%x, 0x%x, gl elem
%u.\n",
drivers/scsi/cxgb3i/cxgb3i_ddp.c void cxgb3i_ddp_tag_release(struct t3cdev *tdev, u32 tag)
Quoted 4 lines
drivers/scsi/cxgb3i/cxgb3i_ddp.c +3
-0+ tag, idx, gl->nelem); +return err; + } ddp_log_debug("ddp tag 0x%x, release idx 0x%x, npods
%u.\n",
drivers/scsi/cxgb3i/cxgb3i_ddp.c void cxgb3i_ddp_tag_release(struct t3cdev *tdev, u32 tag) · line 479
Quoted 6 lines
drivers/scsi/cxgb3i/cxgb3i_ddp.c +2
-1tag, idx, npods); -clear_ddp_map (ddp, idx, npods); +if (clear_ddp_map (ddp, tag, idx, npods) == npods) + err =0 ;ddp_unmark_entries (ddp, idx, npods);cxgb3i_ddp_release_gl (gl, ddp->pdev);
If this fails, do we leak this memory?
[Karen] The only memory allocated is the gl structure, even if it is not freed here, it will be freed at the cleanup of the ddp function.
When is ddp_release called? Would it be called to clean up in situati this could fail?
[Karen] it is called in cleanup_task().
Review void cxgb3i_ddp_tag_release(struct t3cdev *tdev, · line 481
Quoted 2 lines
(quoted diff) +2
-0+/** + * cxgb3i_adapter_remove - release all the resources held and cleanup
any
drivers/scsi/cxgb3i/cxgb3i_iscsi.c static LIST_HEAD(cxgb3i_snic_list); · line 77
Quoted 1 line
drivers/scsi/cxgb3i/cxgb3i_iscsi.c +1
-0+* h/w settings
The docbook comment for the function description should only be one line. I think you did this in some other places.
[Karen] Thanks, I will fix them.
Quoted 8 lines
drivers/scsi/cxgb3i/cxgb3i_pdu.c +1
-1-void cxgb3i_conn_closing (struct s3_conn *c3cn) +void cxgb3i_conn_closing (struct s3_conn *c3cn,int error) {struct iscsi_conn *conn;read_lock (&c3cn->callback_lock); conn = c3cn->user_data;
drivers/scsi/cxgb3i/cxgb3i_pdu.c void cxgb3i_conn_tx_open(struct s3_conn *c3cn) · line 499
Quoted 10 lines
drivers/scsi/cxgb3i/cxgb3i_pdu.c +7
-2-if (conn && c3cn->state !=C3CN_STATE_ESTABLISHED ) -iscsi_conn_failure (conn,ISCSI_ERR_CONN_FAILED ); +if (conn && c3cn->state !=C3CN_STATE_ESTABLISHED ) { +if (error) +iscsi_session_failure (conn->session, +ISCSI_ERR_CONN_FAILED ); +else +iscsi_conn_failure (conn,ISCSI_ERR_CONN_FAILED ); + }read_unlock (&c3cn->callback_lock);
If you have a ref to the conn, you can just use iscsi_conn_failure here.
I thought when you got the pci error event you were just going to use the host session iter and loop over the session and fail them.
[Karen] Yes, I could do it via iscsi_host_for_each_session() too.
Some other comments about the host and snic allocation.
drivers/scsi/cxgb3i/cxgb3i_iscsi.c static LIST_HEAD(cxgb3i_snic_list); · line 112
Quoted 6 lines · Karen Xie
drivers/scsi/cxgb3i/cxgb3i_iscsi.c +6
-0+/** +* cxgb3i_adapter_open - initiate or update a s3 adapter structure and +* any h/w settings +* @t3dev: t3cdev adapter +*/ +static inline int adapter_update (struct cxgb3i_adapter *snic)
The function name and comment got out of sync.
Quoted 16 lines
drivers/scsi/cxgb3i/cxgb3i_iscsi.c +3
-10-void cxgb3i_adapter_remove (struct t3cdev *t3dev) +void cxgb3i_adapter_open (struct t3cdev *t3dev) { -int i; -struct cxgb3i_adapter *snic; +struct cxgb3i_adapter *snic =cxgb3i_adapter_find_by_tdev (t3dev); +int err; -/* remove from the list */ -write_lock (&cxgb3i_snic_rwlock); -list_for_each_entry (snic, &cxgb3i_snic_list, list_head) { -if (snic->tdev == t3dev) { -list_del (&snic->list_head); -break ; - }
drivers/scsi/cxgb3i/cxgb3i_iscsi.c struct cxgb3i_adapter *cxgb3i_adapter_add(struct t3cdev *t3dev) · line 167
Quoted 10 lines
drivers/scsi/cxgb3i/cxgb3i_iscsi.c +10
-0+if (snic) + err =adapter_update (snic); +else { + snic =kzalloc (sizeof (*snic),GFP_KERNEL ); +if (snic) { +spin_lock_init (&snic->lock); + snic->tdev = t3dev; + err =adapter_add (snic); + }else + err = -ENOMEM ;
Does the snic represent the actual card. So if I had a dual ported card, I would have one snic and then have multple shosts/cxgb3i_hba for each port right?
It seemed strange because cxgb3i_hba_host_add sets the shost's parent to the pci device, and we get the pci device from the snic->pdev. And so I thought we see a pci device per port, so we would also should have a snic per port?
-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Wednesday, February 25, 2009 9:30 AM
To: Karen Xie
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2 2.6.29-rc] cxgb3i - add handling of chip reset
Some other comments about the host and snic allocation.
Quoted 2 lines · Karen Xie
+/**
+ *cxgb3i_adapter_open- initiate or update a s3 adapter structure
and
Quoted 4 lines
+ * any h/w settings
+ * @t3dev: t3cdev adapter
+ */
+static inline intadapter_update(struct cxgb3i_adapter *snic)
The function name and comment got out of sync.
[Karen] Thanks, will fix it.
drivers/scsi/cxgb3i/cxgb3i_iscsi.c struct cxgb3i_adapter *cxgb3i_adapter_add(struct t3cdev *t3dev)
Quoted 6 lines
drivers/scsi/cxgb3i/cxgb3i_iscsi.c +2
-3-void cxgb3i_adapter_remove (struct t3cdev *t3dev) +void cxgb3i_adapter_open (struct t3cdev *t3dev) { -int i; -struct cxgb3i_adapter *snic; + struct cxgb3i_adapter *snic =
cxgb3i_adapter_find_by_tdev(t3dev);
Quoted 10 lines
drivers/scsi/cxgb3i/cxgb3i_iscsi.c +1
-7+int err; -/* remove from the list */ -write_lock (&cxgb3i_snic_rwlock); -list_for_each_entry (snic, &cxgb3i_snic_list, list_head) { -if (snic->tdev == t3dev) { -list_del (&snic->list_head); -break ; - }
drivers/scsi/cxgb3i/cxgb3i_iscsi.c struct cxgb3i_adapter *cxgb3i_adapter_add(struct t3cdev *t3dev) · line 167
Quoted 10 lines
drivers/scsi/cxgb3i/cxgb3i_iscsi.c +10
-0+if (snic) + err =adapter_update (snic); +else { + snic =kzalloc (sizeof (*snic),GFP_KERNEL ); +if (snic) { +spin_lock_init (&snic->lock); + snic->tdev = t3dev; + err =adapter_add (snic); + }else + err = -ENOMEM ;
Does the snic represent the actual card. So if I had a dual ported card,
I would have one snic and then have multple shosts/cxgb3i_hba for each port right?
[Karen] Yes.
It seemed strange because cxgb3i_hba_host_add sets the shost's parent to
the pci device, and we get the pci device from the snic->pdev. And so I thought we see a pci device per port, so we would also should have a snic per port?
[Karen] Each port/cxgb3i_hba has a pointer point back to the snic/adapter. So one snic per adapter, each snic contains one or more ports, each port corresponds to one shost.