Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_driver.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2015, Emulex
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 #include "ocs.h"
34 #include "version.h"
35 #include "ocs_vpd.h"
36 #include "ocs_params.h"
37 
38 char ocs_version[] = "version: ocs_iscsi_ramd: " DRV_VERSION;
39 
41 uint32_t ocs_instance_count = 0;
42 
43 void ocs_mgmt_driver_list(ocs_textbuf_t *textbuf, void *driver);
44 void ocs_mgmt_driver_get_all(ocs_textbuf_t *textbuf, void *driver);
45 int ocs_mgmt_driver_get(ocs_textbuf_t *textbuf, char *parent, char *name, void *driver);
46 int ocs_mgmt_driver_exec(char *parent, char *action, void *arg_in, uint32_t arg_in_length,
47  void *arg_out, uint32_t arg_out_length, void *driver);
48 
51  .get_handler = ocs_mgmt_driver_get,
52  .get_all_handler = ocs_mgmt_driver_get_all,
53  .exec_handler = ocs_mgmt_driver_exec,
54 };
55 
56 /*
57  * PARAM_LIST: expand to initialized declarations
58  */
59 #define P(type, name, value, desc) type name = value;
60 PARAM_LIST
61 #undef P
62 
63 /**
64  * @brief Perform driver-wide initialization.
65  *
66  * @par
67  * This function is called prior to enumerating PCI devices, with subsequent calls
68  * to ocs_device_attach. For OCS, this function invokes the back end functions
69  * ocs_scsi_tgt_driver_init() and ocs_scsi_ini_driver_init()
70  *
71  * @return Returns 0 for success, or a negative error code value for failure.
72  */
73 int32_t
75 {
76  int32_t rc;
77 
78  ocs_thread_init();
79 
80  /* driver-wide init for target-server */
81  if (target) {
83  if (rc) {
84  ocs_log_err(NULL, "ocs_scsi_tgt_init failed rc=%d\n", rc);
85  return -1;
86  }
87  }
88 
89  /* driver-wide init for initiator-client */
90  if (initiator) {
91  rc = ocs_scsi_ini_driver_init(initiator);
92  if (rc) {
93  ocs_log_err(NULL, "ocs_scsi_ini_init failed rc=%d\n", rc);
95  return -ENOMEM;
96  }
97  }
98  return 0;
99 }
100 
101 /**
102  * @brief Perform device initialization complete.
103  *
104  * @par
105  * This function is called after all PCI device/functions have been enumerated.
106  *
107  * @return returns 0 for success, a negative error code value for failure.
108  */
109 int32_t
111 {
112  return 0;
113 }
114 
115 /**
116  * @brief Perform driver-wide shut down actions.
117  *
118  * @par
119  * This function is called prior to detaching devices during a driver
120  * unload.
121  *
122  * @return None.
123  */
124 void
126 {
127 }
128 
129 
130 /**
131  * @brief Returns a pointer to the ocs structure given the instance index.
132  *
133  * @par
134  * A pointer to an ocs structure is returned given an instance index.
135  *
136  * @param index Index to ocs_devices array.
137  *
138  * @return Returns ocs pointer.
139  */
140 
141 ocs_t *ocs_get_instance(uint32_t index)
142 {
143  if (index < ARRAY_SIZE(ocs_devices)) {
144  return ocs_devices[index];
145  }
146  return NULL;
147 }
148 
149 /**
150  * @brief Return the instance index of an opaque ocs structure.
151  *
152  * @par
153  * Returns the ocs instance index.
154  *
155  * @param os Pointer to the ocs instance.
156  *
157  * @return Pointer to the ocs instance index.
158  */
159 uint32_t
160 ocs_instance(void *os)
161 {
162  ocs_t *ocs = os;
163  return ocs->instance_index;
164 }
165 
166 
167 /**
168  * @brief Instantiate the PCI device.
169  *
170  * @par
171  * This is the PCI device probe entry point, called by the Linux PCI subsystem once for
172  * each matching device/function.
173  * @n @n
174  * The ocs structure is allocated, and initialized
175 
176  * @param nid NUMA node ID.
177  *
178  * @return Returns the pointer to the allocated OCS structure.
179  */
180 void *
181 ocs_device_alloc(uint32_t nid)
182 {
183  ocs_t *ocs;
184 
185  ocs = ocs_malloc(NULL, sizeof(ocs_t), OCS_M_NOWAIT | OCS_M_ZERO);
186  if (ocs == NULL) {
187  ocs_log_err(ocs, "memory allocation failed for ocs_t\n");
188  return NULL;
189  }
190  ocs->instance_index = ocs_instance_count;
191  ocs_devices[ocs->instance_index] = ocs;
193 
194  /* If enabled, initailize a RAM logging buffer */
195  if (logdest & 2) {
196  ocs->ramlog = ocs_ramlog_init(ocs, ramlog_size/OCS_RAMLOG_DEFAULT_BUFFERS,
198  /* If NULL was returned, then we'll simply skip using the ramlog but */
199  /* set logdest to 1 to ensure that we at least get default logging. */
200  if (ocs->ramlog == NULL) {
201  logdest = 1;
202  }
203  }
204 
205  /* initialize a saved ddump */
206  if (ddump_saved_size) {
207  if (ocs_textbuf_alloc(ocs, &ocs->ddump_saved, ddump_saved_size)) {
208  ocs_log_err(ocs, "failed to allocate memory for saved ddump\n");
209  }
210  }
211 
212  ocs->mgmt_functions = &driver_mgmt_functions;
213 
214 #if defined(ENABLE_LOCK_DEBUG)
215  ocs_lock_init(NULL, &ocs->ocs_os.locklist_lock, "locklist_lock[%d]", ocs->instance_index);
216  ocs_list_init(&ocs->ocs_os.locklist, ocs_lock_t, link);
217 #endif
218 
219  /* Save userspace mask value */
220  ocs->drv_ocs.uspace_thread_per_port = (uspacemask & (1U << 0)) == 0;
221  ocs->drv_ocs.uspace_threads_block = (uspacemask & (1U << 1)) == 0;
222 
223  return ocs;
224 }
225 
226 void
227 ocs_device_free(ocs_t *ocs)
228 {
229  if (ocs) {
230  ocs_textbuf_free(ocs, &ocs->ddump_saved);
231  ocs_ramlog_free(ocs, ocs->ramlog);
232  ocs_devices[ocs->instance_index] = NULL;
233 
234 #if defined(ENABLE_LOCK_DEBUG)
235  {
236  ocs_os_t *os = &ocs->ocs_os;
237  ocs_lock_t *l;
238  uint32_t count = 0;
239  ocs_list_foreach(&os->locklist, l) {
240  ocs_log_test(os, "%s not freed\n", l->name);
241  count++;
242  }
243  if (count == 0) {
244  ocs_log_debug(ocs, "all lock objects freed\n");
245  }
246  }
247 #endif
248 
249  ocs_free(NULL, ocs, sizeof(*ocs));
250  }
251 }
252 
253 /**
254  * @brief Returns the number of interrupts required per HBA.
255  *
256  * @param ocs Pointer to the ocs structure.
257  *
258  * @return Returns the number of interrupts.
259  */
260 int32_t
262 {
263  /* So we set the port type properly in ocs_hal_setup */
264  ocs->enable_ini = initiator;
265  ocs->enable_tgt = target;
266 
267  return ocs_iscsi_interrupts_required((ocs_os_handle_t)ocs, &ocs->hal);
268 }
269 
270 int32_t
271 ocs_device_attach(ocs_t *ocs)
272 {
273  unsigned int rc;
274 
275  /* any ocs initialization */
276  ocs->enable_ini = initiator;
277  ocs->enable_tgt = target;
279  ocs_list_init(&ocs->domain_list, ocs_domain_t, link);
280 
281  snprintf(ocs->display_name, sizeof(ocs->display_name), "[%s%d] ", "i", ocs->instance_index);
282 
283  /* copy the module paramaters to ocs */
284  ocs->ctrlmask = ctrlmask;
285  ocs->num_cxns = num_cxns;
286  ocs->num_tgts = num_tgts;
287  ocs->global_ramdisc = global_ramdisc;
288  ocs->num_scsi_ios = num_scsi_ios;
289  ocs_strcpy(ocs->local_ip, local_ip);
290  ocs_strcpy(ocs->local_subnet, local_subnet);
291  ocs_strcpy(ocs->gateway, gateway);
292  ocs->tcp_window_size = tcp_window_size;
293  ocs->tcp_window_scale = tcp_window_scale;
294  ocs->enable_sgl_chaining = (enable_sgl_chaining == 0 ? FALSE : TRUE);
295  ocs->enable_immediate_data = (enable_immediate_data == 0 ? FALSE : TRUE);
296  ocs->enable_hdr_digest = (enable_hdr_digest == 0 ? FALSE : TRUE);
297  ocs->enable_data_digest = (enable_data_digest == 0 ? FALSE : TRUE);
298  ocs->enable_jumbo_frame = (enable_jumbo_frame == 0 ? FALSE : TRUE);
299  ocs->max_cxns_per_session = OCS_ISCSI_MAX_CXNS_PER_SESSION;
300  ocs->driver_version = DRV_VERSION;
301  ocs->hal_war_version = hal_war_version;
302 
303  /* non-zero target IO timer not supported for iSCSI */
304  ocs->target_io_timer_sec = 0;
305 
306  if (max_sge_size < 1024 &&
307  max_sge_size > 65536) {
308  ocs_log_test(ocs, "Ignoring invalid max_sge_size\n");
309  } else {
310  ocs->max_sge_size = max_sge_size;
311  }
312  ocs->post_sgl_config = post_sgl_config;
313 
314  rc = ocs_iscsi_initialize((ocs_os_handle_t)ocs, &ocs->iscsi, &ocs->hal, ocs->instance_index);
315  if (rc) {
316  ocs_log_err(ocs, "ocs_iscsi_initialize failed\n");
317  }
318 
319  return rc;
320 }
321 
322 /**
323  * @brief Remove the PCI device instance.
324  *
325  * @par
326  * Called when the driver is unloaded, once for each PCI device/function instance.
327  *
328  * @param ocs Pointer to the ocs structure.
329  *
330  * @return None.
331  */
332 
333 int32_t
334 ocs_device_detach(ocs_t *ocs)
335 {
336  int32_t rc = 0;
337  if (ocs) {
338 
339  if (ocs->enable_tgt) {
341  }
342  if (ocs->enable_ini) {
344  }
345 
346  rc = ocs_iscsi_teardown(&ocs->iscsi);
347  if (rc) {
348  ocs_log_err(ocs, "ocs_iscsi_teardown() failed: %d\n", rc);
349  }
350  ocs_xport_free(ocs->xport);
351  ocs->xport = NULL;
352  }
353  return rc;
354 }
355 
356 int32_t
357 ocs_get_property(const char *prop_name, char *buffer, uint32_t buffer_len)
358 {
359  if (ocs_strcmp(prop_name, "num_tgts") == 0)
360  ocs_snprintf(buffer, buffer_len, "%d", num_tgts);
361  else if (ocs_strcmp(prop_name, "global_ramdisc") == 0)
362  ocs_snprintf(buffer, buffer_len, "%d", global_ramdisc);
363  else if (ocs_strcmp(prop_name, "ramdisc_size") == 0)
364  ocs_strncpy(buffer, ramdisc_size, buffer_len);
365  else if (ocs_strcmp(prop_name, "ramdisc_blocksize") == 0)
366  ocs_snprintf(buffer, buffer_len, "%d", ramdisc_blocksize);
367  else if (ocs_strcmp(prop_name, "num_luns") == 0)
368  ocs_snprintf(buffer, buffer_len, "%d", num_luns);
369  else if (ocs_strcmp(prop_name, "initiator") == 0)
370  ocs_snprintf(buffer, buffer_len, "%d", initiator);
371  else if (ocs_strcmp(prop_name, "target") == 0)
372  ocs_snprintf(buffer, buffer_len, "%d", target);
373  else if (ocs_strcmp(prop_name, "p_type") == 0)
374  ocs_snprintf(buffer, buffer_len, "%d", p_type);
375  else if (ocs_strcmp(prop_name, "dif_separate") == 0)
376  ocs_snprintf(buffer, buffer_len, "%d", 1);
377  else {
378  printf("Error: %s: unknown property %s\n", __func__, prop_name);
379  ocs_snprintf(buffer, buffer_len, "%s", "");
380  return -1;
381  }
382  return 0;
383 }
384 
385 const char *ocs_display_name(void *os)
386 {
387  ocs_t *ocs = os;
388  ocs_assert(ocs, "[?]");
389  return ocs->display_name;
390 }
391 
392 void ocs_mgmt_driver_list(ocs_textbuf_t *textbuf, void *object)
393 {
394  ocs_mgmt_start_unnumbered_section(textbuf, "driver");
395 
396  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "ctrlmask");
397  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "num_cxns");
398  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "num_tgts");
399  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "enable_sgl_chaining");
400  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "enable_immediate_data");
401  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "enable_hdr_digest");
402  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "enable_data_digest");
403  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "enable_jumbo_frame");
404  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "max_sge_size");
405  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "post_sgl_config");
406  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "local_ip");
407  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "local_subnet");
408  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "gateway");
409  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "tcp_window_size");
410  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "tcp_window_scale");
411  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "initiator");
412  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "target");
413  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "global_ramdisc");
414  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "ramdisc_size");
415  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "ramdisc_blocksize");
416  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "num_luns");
417  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "p_type");
418  ocs_mgmt_emit_property_name(textbuf, MGMT_MODE_RD, "num_scsi_ios");
419 
420  ocs_mgmt_end_unnumbered_section(textbuf, "driver");
421 
422  return;
423 }
424 
425 int ocs_mgmt_driver_get(ocs_textbuf_t *textbuf, char *parent, char *name, void *object)
426 {
427  char qualifier[80];
428  int retval = -1;
429 
430  ocs_mgmt_start_unnumbered_section(textbuf, "driver");
431 
432  snprintf(qualifier, sizeof(qualifier), "%s/driver", parent);
433 
434  /* If it doesn't start with my qualifier I don't know what to do with it */
435  if (ocs_strncmp(name, qualifier, strlen(qualifier)) == 0) {
436  char *unqualified_name = name + strlen(qualifier) +1;
437 
438  /* See if it's a value I can supply */
439  if (ocs_strcmp(unqualified_name, "ctrlmask") == 0) {
440  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "ctrlmask", "%d", ctrlmask);
441  retval = 0;
442  } else if (ocs_strcmp(unqualified_name, "num_cxns") == 0) {
443  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "num_cxns", "%d", num_cxns);
444  retval = 0;
445  } else if (ocs_strcmp(unqualified_name, "enable_sgl_chaining") == 0) {
446  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "enable_sgl_chaining", enable_sgl_chaining);
447  retval = 0;
448  } else if (ocs_strcmp(unqualified_name, "enable_immediate_data") == 0) {
449  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "enable_immediate_data", enable_immediate_data);
450  retval = 0;
451  } else if (ocs_strcmp(unqualified_name, "enable_hdr_digest") == 0) {
452  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "enable_hdr_digest", enable_hdr_digest);
453  retval = 0;
454  } else if (ocs_strcmp(unqualified_name, "enable_data_digest") == 0) {
455  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "enable_data_digest", enable_data_digest);
456  retval = 0;
457  } else if (ocs_strcmp(unqualified_name, "enable_jumbo_frame") == 0) {
458  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "enable_jumbo_frame", enable_jumbo_frame);
459  retval = 0;
460  } else if (ocs_strcmp(unqualified_name, "max_sge_size") == 0) {
461  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "max_sge_size", "%d", max_sge_size);
462  retval = 0;
463  } else if (ocs_strcmp(unqualified_name, "post_sgl_config") == 0) {
464  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "post_sgl_config", "%d", post_sgl_config);
465  retval = 0;
466  } else if (ocs_strcmp(unqualified_name, "local_ip") == 0) {
467  ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "local_ip", local_ip);
468  retval = 0;
469  } else if (ocs_strcmp(unqualified_name, "local_subnet") == 0) {
470  ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "local_subnet", local_subnet);
471  retval = 0;
472  } else if (ocs_strcmp(unqualified_name, "gateway") == 0) {
473  ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "gateway", gateway);
474  retval = 0;
475  } else if (ocs_strcmp(unqualified_name, "tcp_window_size") == 0) {
476  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "tcp_window_size", "%d", tcp_window_size);
477  retval = 0;
478  } else if (ocs_strcmp(unqualified_name, "tcp_window_scale") == 0) {
479  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "tcp_window_scale", "%d", tcp_window_scale);
480  retval = 0;
481  } else if (ocs_strcmp(unqualified_name, "num_tgts") == 0) {
482  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "num_tgts", "%d", num_tgts);
483  retval = 0;
484  } else if (ocs_strcmp(unqualified_name, "initiator") == 0) {
485  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "initiator", initiator);
486  retval = 0;
487  } else if (ocs_strcmp(unqualified_name, "target") == 0) {
488  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "target", target);
489  retval = 0;
490  } else if (ocs_strcmp(unqualified_name, "global_ramdisc") == 0) {
491  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "global_ramdisc", "%d", global_ramdisc);
492  retval = 0;
493  } else if (ocs_strcmp(unqualified_name, "ramdisc_size") == 0) {
494  ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "ramdisc_size", ramdisc_size);
495  retval = 0;
496  } else if (ocs_strcmp(unqualified_name, "ramdisc_blocksize") == 0) {
497  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "ramdisc_blocksize", "%d", ramdisc_blocksize);
498  retval = 0;
499  } else if (ocs_strcmp(unqualified_name, "num_luns") == 0) {
500  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "num_luns", "%d", num_luns);
501  retval = 0;
502  } else if (ocs_strcmp(unqualified_name, "p_type") == 0) {
503  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "p_type", "%d", p_type);
504  retval = 0;
505  } else if (ocs_strcmp(unqualified_name, "num_scsi_ios") == 0) {
506  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "num_scsi_ios", "%d", num_scsi_ios);
507  retval = 0;
508  }
509  }
510 
511  ocs_mgmt_end_unnumbered_section(textbuf, "driver");
512 
513  return retval;
514 }
515 
516 void ocs_mgmt_driver_get_all(ocs_textbuf_t *textbuf, void *object)
517 {
518  ocs_mgmt_start_unnumbered_section(textbuf, "driver");
519 
520  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "ctrlmask", "%d", ctrlmask);
521  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "num_cxns", "%d", num_cxns);
522  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "enable_sgl_chaining", enable_sgl_chaining);
523  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "enable_immediate_data", enable_immediate_data);
524  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "enable_hdr_digest", enable_hdr_digest);
525  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "enable_data_digest", enable_data_digest);
526  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "enable_jumbo_frame", enable_jumbo_frame);
527  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "max_sge_size", "%d", max_sge_size);
528  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "post_sgl_config", "%d", post_sgl_config);
529  ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "local_ip", local_ip);
530  ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "local_subnet", local_subnet);
531  ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "gateway", gateway);
532  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "tcp_window_size", "%d", tcp_window_size);
533  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "tcp_window_scale", "%d", tcp_window_scale);
534  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "num_tgts", "%d", num_tgts);
535  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "initiator", initiator);
536  ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "target", target);
537  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "global_ramdisc", "%d", global_ramdisc);
538  ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "ramdisc_size", ramdisc_size);
539  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "ramdisc_blocksize", "%d", ramdisc_blocksize);
540  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "num_luns", "%d", num_luns);
541  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "p_type", "%d", p_type);
542  ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "num_scsi_ios", "%d", num_scsi_ios);
543 
544  ocs_mgmt_end_unnumbered_section(textbuf, "driver");
545 }
546 
547 int ocs_mgmt_driver_set(char *parent, char *name, char *value)
548 {
549  return -1;
550 }
551 
552 
553 int ocs_mgmt_driver_exec(char *parent, char *action_name, void *arg_in,
554  uint32_t arg_in_length, void *arg_out, uint32_t arg_out_length, void *object)
555 {
556  return -1;
557 }
558 
559 /**
560  * @brief Perform driver-wide shutdown complete actions.
561  *
562  * @par
563  * This function is called shutdown for all devices has completed.
564  *
565  * @return None.
566  */
567 void
569 {
570 }
571 
int32_t ocs_device_detach(ocs_t *ocs)
Remove the PCI device instance.
Definition: ocs_driver.c:334
int32_t ocs_scsi_tgt_del_device(ocs_t *ocs)
Tears down the target members of the ocs structure.
Definition: ocs_ramd.c:836
const char * ocs_display_name(void *os)
Definition: ocs_driver.c:385
int32_t ocs_scsi_tgt_driver_init(void)
Driver-wide initialization for the target-server.
Definition: ocs_ramd.c:354
int32_t ocs_get_property(const char *prop_name, char *buffer, uint32_t buffer_len)
Definition: ocs_driver.c:357
ocs_t * ocs_get_instance(uint32_t index)
Returns a pointer to the ocs structure given the instance index.
Definition: ocs_driver.c:141
#define MAX_OCS_DEVICES
void ocs_device_shutdown(void)
Perform driver-wide shut down actions.
Definition: ocs_driver.c:125
int32_t ocs_scsi_ini_driver_init(int32_t initiator)
Initialize initiator client.
void ocs_mgmt_emit_int(ocs_textbuf_t *textbuf, int mode, const char *name, const char *fmt,...)
Generate a property with an integer value in a management XML document.
#define DRV_VERSION
Definition: ocs.h:45
static ocs_mgmt_functions_t driver_mgmt_functions
Definition: ocs_driver.c:49
static void ocs_device_lock_init(ocs_t *ocs)
Definition: ocs_drv_fc.h:187
ocs_t * ocs_devices[MAX_OCS_DEVICES]
Definition: ocs_driver.c:40
void * ocs_device_alloc(uint32_t nid)
Instantiate the PCI device.
Definition: ocs_driver.c:181
void ocs_device_free(ocs_t *ocs)
Definition: ocs_driver.c:227
const char * name
Definition: ocs_ddump.h:54
int ocs_mgmt_driver_exec(char *parent, char *action, void *arg_in, uint32_t arg_in_length, void *arg_out, uint32_t arg_out_length, void *driver)
Definition: ocs_driver.c:553
void ocs_mgmt_start_unnumbered_section(ocs_textbuf_t *textbuf, const char *name)
Generate the beginning of an unnumbered section in a management XML document.
int32_t ocs_device_interrupts_required(ocs_t *ocs)
Returns the number of interrupts required per HBA.
Definition: ocs_driver.c:261
void ocs_textbuf_free(ocs_t *ocs, ocs_textbuf_t *textbuf)
Definition: ocs_textbuf.c:213
int const char const char void ocs_mgmt_emit_boolean(ocs_textbuf_t *textbuf, int access, const char *name, const int value)
Generate a property with a boolean value in a management XML document.
int32_t ocs_device_attach(ocs_t *ocs)
Definition: ocs_driver.c:271
void ocs_ramlog_free(ocs_t *ocs, ocs_ramlog_t *ramlog)
Free a ramlog buffer.
Definition: ocs_ramlog.c:116
void ocs_device_shutdown_complete(void)
Perform driver-wide shutdown complete actions.
Definition: ocs_driver.c:568
#define ocs_list_init(head, type, link)
Definition: ocs_list.h:113
int ocs_mgmt_driver_set(char *parent, char *name, char *value)
Definition: ocs_driver.c:547
int32_t ocs_scsi_ini_del_device(ocs_t *ocs)
Tears down initiator members of ocs structure.
void ocs_mgmt_end_unnumbered_section(ocs_textbuf_t *textbuf, const char *name)
Generate the end of a section in a management XML document.
void ocs_mgmt_driver_list(ocs_textbuf_t *textbuf, void *driver)
Definition: ocs_driver.c:392
PARAM_LIST int32_t ocs_device_init(void)
Perform driver-wide initialization.
Definition: ocs_driver.c:74
uint32_t ocs_instance(void *os)
Return the instance index of an opaque ocs structure.
Definition: ocs_driver.c:160
ocs_mgmt_get_list_handler get_list_handler
Definition: ocs_mgmt.h:83
int32_t ocs_iscsi_initialize(ocs_os_handle_t os, ocs_iscsi_t *iscsi, ocs_hal_t *hal, uint32_t device_instance)
Initialize the iSCSI device by setting up the chip.
Definition: ocs_iscsi.c:1505
int32_t ocs_iscsi_teardown(ocs_iscsi_t *iscsi)
Shut down the device.
Definition: ocs_iscsi.c:1921
#define MGMT_MODE_RD
Definition: ocs_mgmt.h:47
char ocs_version[]
Definition: ocs_driver.c:38
#define OCS_RAMLOG_DEFAULT_BUFFERS
Definition: ocs_ramlog.h:46
int32_t ocs_iscsi_interrupts_required(ocs_os_handle_t os, ocs_hal_t *hal)
Returns the number of interrupts needed for this adapter.
Definition: ocs_iscsi.c:1459
void ocs_mgmt_driver_get_all(ocs_textbuf_t *textbuf, void *driver)
Definition: ocs_driver.c:516
void ocs_xport_free(ocs_xport_t *xport)
free a transport object
Definition: ocs_xport.c:471
#define ocs_assert(cond,...)
Definition: ocs_debug.h:163
int logdest
Definition: ocs_lnx.c:24
int32_t ocs_device_init_complete(void)
Perform device initialization complete.
Definition: ocs_driver.c:110
int32_t ocs_textbuf_alloc(ocs_t *ocs, ocs_textbuf_t *textbuf, uint32_t length)
Definition: ocs_textbuf.c:105
void ocs_mgmt_emit_string(ocs_textbuf_t *textbuf, int access, const char *name, const char *value)
Generate a property with a string value in a management XML document.
#define ocs_list_foreach(list, item)
Iterate a linked list.
Definition: ocs_list.h:428
#define OCS_ISCSI_MAX_CXNS_PER_SESSION
ocs_ramlog_t * ocs_ramlog_init(ocs_t *ocs, uint32_t buffer_len, uint32_t buffer_count)
Allocate a ramlog buffer.
Definition: ocs_ramlog.c:65
void ocs_mgmt_emit_property_name(ocs_textbuf_t *textbuf, int access, const char *name)
Generate a property, with no value, in a management XML document.
int ocs_mgmt_driver_get(ocs_textbuf_t *textbuf, char *parent, char *name, void *driver)
Definition: ocs_driver.c:425
uint32_t ocs_instance_count
Definition: ocs_driver.c:41