Hi Javen, Thanks a lot for your help,But I still do not understand the semantics and exactly why we need to do all that ? Especially since i am registering my HBA driver as a class 'scsi' ,so as of now whenever i do an iscsi login /logout all i do is call ndi_devi_alloc/ndi_devi_online and a devfs_clean/ndi_devi_offline respectively and this works fine for me . I do NOT understand where/how exactly it might just break
Could you pls explain or point me to some relevant documentation ? Thanks Som --- Javen Wu <[EMAIL PROTECTED]> wrote: > Hi Som, > > Actually, your tran_bus_config() should > allocate/online immediate > children as persistent node before you call > ndi_busos_bus_config(). In one world, you have to > use > ndi_devi_alloc/ndi_devi_online to online all > immediate children as well. > I believe your HBA is able to discover the specific > target existence or > all attached targets by some vendor specific method. > Once HBA detect targets, you use ndi_devi_alloc() > and ndi_devi_online() > to configure your devices. > > Please refer to my below pseudo code: > > myxx_tran_bus_config(dev_info_t *parent, uint_t > flags, > ddi_bus_config_op_t op, void *arg, dev_info_t > **childp) > { > int ret = DDI_FAILURE; > /* > * get the softstate of your initiator > */ > myxx_softstate = (myxx_softs > *)ddi_get_soft_state(mpt_state, > ddi_get_instance(parent)); > if (myxx_softstate == NULL) { > return (NDI_FAILURE); > } > > ndi_devi_enter(parent, &circ1); > switch (op) { > case BUS_CONFIG_ONE: > /* parse target name out of name given */ > if ((ptr = strchr((char *)arg, '@')) == > NULL) { > ret = NDI_FAILURE; > break; > } > /* > * per the string to parse target and lun > */ > myxx_parse_target_lun(prt, &target, lun&) > ret = myxx_config_one(myxx_softstate, > target,lun); > break; > case BUS_CONFIG_DRIVER: > case BUS_CONFIG_ALL: > myxx_config_all(myxx_softstate); > ret = DDI_SUCCESS; > break; > default: > break; > } > /* > * Only when above configure success, then > invoke ndi_busop > */ > if (ret == NDI_SUCCESS) { > ret = ndi_busop_bus_config(parent, flags, > op, arg, childp, 0); > ndi_devi_exit(parent, circ1); > } > > int myxx_config_one(myxx_softs *myxx, int target, > int lun, dev_info_t > **childp) { > /* > * Check if the target+lun has already been in > your internel list > * if exist, just set childp pointer and return > success, if failed > go to next step > * to configure > */ > > .....code for search internal list... > if (find the node from internal list) { > set childp > return (NDI_SUCCESS); > } > > /* > * your discovery process to make sure the > target is there > */ > ....target discovery existence... > or just scsi_hba_probe() to probe the > target,lun > > if the target,lun exist we need configure the > device > ndi_devi_alloc() > scsi_hba_nodename_compatible_get() > if (ndi_prop_update_int(DDI_DEV_T_NONE, > *lun_dip, TARGET_PROP, (int)target) != > DDI_PROP_SUCCESS) { > ndi_rtn = NDI_FAILURE; > goto error_handle; > } > > if (ndi_prop_update_int(DDI_DEV_T_NONE, > *lun_dip, LUN_PROP, lun) != > DDI_PROP_SUCCESS) { > mpt_log(mpt, CE_WARN, "mpt driver unable > to create " > "property for target %d lun %d > (LUN_PROP)", > target, lun); > ndi_rtn = NDI_FAILURE; > goto error_handle; > } > > ret = ndi_devi_online(); > if (ret ==NDI_SUCCESS) > set the dip to childp; > return (ret); > > } > > void myxx_config_all() { > > discovery all attached iSCSI targets > for (each target) { > issue REPORT_LUN to get LUNs > for (each lun) { > myxx_config_one(); > > } > } > > > Above is just a rough pseduo codes for configuration > routine, hope it > can help you. > > BTW, I am not sure if you handle device offline, I > mean when a iscsi > target get gone, you can call ndi_devi_offline to > offline the target > devices. > > Javen > > Somnath kotur wrote: > > >Hi Javen, > > Yes that is right, atleast that is the only > >thing i could understand after looking at the src > >code,(esp the solaris iscsi initiator src) .So > below > >is what i am doing in my tran_bus_config. > > > >myxx_tran_bus_config(dev_info_t *parent, uint_t > flags, > > ddi_bus_config_op_t op, void *arg, dev_info_t > >**childp) > >{ > > return ndi_busop_bus_config(parent, flags, > > op, arg, childp, 0); > >} > > > >I figured that the implementation of > BUS_CONFIG_ONE > >and BUS_CONFIG_ALL was more relevant to it ,because > of > >the way it names its target(iqn way), i just use a > >targetID > > > > > >On hotplug i do an ndi_devi_alloc ,update the > >target/lun props and online it > > > > > >In my tran_tgt_init() i do as below : > > > > if (ndi_dev_is_persistent_node(tgt_dip) == 0) { > > > > (void) ndi_merge_node(tgt_dip, > >scsi_name_child); > > ddi_set_name_addr(tgt_dip, NULL); > > return (DDI_FAILURE); > > } > >// Then my driver scans through its internal list > of > >available targets looking for the same targetnumber > >input via the sd(struct scsi_device *) parameter > and > >if found returns DDI_SUCCESS. > > > > > >So, pls let me know what i am doing wrong and if so > >,how to correct it. > > > >Thanks > >Som > > > === message truncated === ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs _______________________________________________ driver-discuss mailing list driver-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/driver-discuss