]> Pileus Git - ~andy/linux/blob - drivers/staging/silicom/bypasslib/libbp_sd.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[~andy/linux] / drivers / staging / silicom / bypasslib / libbp_sd.h
1 /******************************************************************************/
2 /*                                                                            */
3 /* bypass library, Copyright (c) 2004 Silicom, Ltd                            */
4 /* Corporation.                                                               */
5 /*                                                                            */
6 /* This program is free software; you can redistribute it and/or modify       */
7 /* it under the terms of the GNU General Public License as published by       */
8 /* the Free Software Foundation, located in the file LICENSE.                 */
9 /*                                                                            */
10 /* Ver 1.0.0                                                                  */
11 /*                                                                            */
12 /* libbypass.h                                                                */
13 /*                                                                            */
14 /******************************************************************************/
15
16 /**
17  * is_bypass - check if device is a Bypass controlling device
18  * @if_index: network device index
19  *
20  * Output:
21  *  1 -  if device is bypass controlling device, 
22  *  0 -  if device is bypass slave device
23  * -1 -  device not support Bypass
24  **/
25 int is_bypass_sd(int if_index);
26
27 /**
28  * get_bypass_slave - get second port participate in the Bypass pair
29  * @if_index: network device index
30  *
31  * Output:
32  *  network device index of the slave device
33  * -1 - on failure (device not support Bypass or it's a slave device) 
34  **/
35 int get_bypass_slave_sd(int if_index);
36
37 /**
38  * get_bypass_caps - get second port participate in the Bypass pair
39  * @if_index: network device index
40  *
41  * Output:
42  * flags word on success;flag word is a 32-bit mask word with each bit defines different 
43  * capability as described bellow.
44  * Value of 1 for supporting this feature. 0 for not supporting this feature.
45  * -1 - on failure (if the device is not capable of the operation or not a Bypass device)
46  * Bit  feature                 description
47  * 
48  * 0    BP_CAP                  The interface is Bypass capable in general
49  * 
50  * 1    BP_STATUS_CAP           The interface can report of the current Bypass mode
51  * 
52  * 2    BP_STATUS_CHANGE_CAP    The interface can report on a change to bypass mode from 
53  *                              the last time the mode was defined
54  * 
55  * 3    SW_CTL_CAP                  The interface is Software controlled capable for bypass/non bypass modes.
56  * 
57  * 4    BP_DIS_CAP                  The interface is capable of disabling the Bypass mode at all times. 
58  *                              This mode will retain its mode even during power loss and also after 
59  *                              power recovery. This will overcome on any bypass operation due to 
60  *                              watchdog timeout or set bypass command.
61  * 
62  * 5    BP_DIS_STATUS_CAP           The interface can report of the current DIS_BP_CAP
63  * 
64  * 6    STD_NIC_CAP                 The interface is capable to be configured to operate as standard, non Bypass, 
65  *                              NIC interface (have direct connection to interfaces at all power modes)
66  * 
67  * 7    BP_PWOFF_NO_CAP         The interface can be in Bypass mode at power off state
68  * 
69  * 8    BP_PWOFF_OFF_CAP            The interface can disconnect the Bypass mode at power off state without 
70  *                              effecting all the other states of operation
71  * 
72  * 9    BP_PWOFF_CTL_CAP            The behavior of the Bypass mode at Power-off state can be controlled by 
73  *                              software without effecting any other state
74  * 
75  *10    BP_PWUP_ON_CAP          The interface can be in Bypass mode when power is turned on 
76  *                              (until the system take control of the bypass functionality)
77  * 
78  *11    BP_PWUP_OFF_CAP         The interface can disconnect from Bypass mode when power is turned on 
79  *                              (until the system take control of the bypass functionality)
80  * 
81  *12    BP_PWUP_CTL_CAP         The behavior of the Bypass mode at Power-up can be controlled by software
82  * 
83  *13    WD_CTL_CAP                  The interface has watchdog capabilities to turn to Bypass mode when not reset 
84  *                              for defined period of time.
85  * 
86  *14    WD_STATUS_CAP           The interface can report on the watchdog status (Active/inactive)
87  * 
88  *15    WD_TIMEOUT_CAP          The interface can report the time left till watchdog triggers to Bypass mode.
89  * 
90  *16-31 RESERVED        
91  *
92  * **/
93 int get_bypass_caps_sd(int if_index);
94
95 /**
96  * get_wd_set_caps - Obtain watchdog timer setting capabilities
97  * @if_index: network device index
98  *
99  * Output:
100  * 
101  * Set of numbers defining the various parameters of the watchdog capable 
102  * to be set to as described bellow.
103  * -1 - on failure (device not support Bypass or it's a slave device)
104  * 
105  * Bit  feature         description
106  * 
107  * 0-3  WD_MIN_TIME         The interface WD minimal time period  in 100mS units
108  * 
109  * 4    WD_STEP_TIME    The steps of the WD timer in 
110  *                      0 - for linear steps (WD_MIN_TIME * X)
111  *                      1 - for multiply by 2 from previous step (WD_MIN_TIME * 2^X)
112  * 
113  * 5-8  WD_STEP_COUNT   Number of steps the WD timer supports in 2^X 
114  *                      (X bit available for defining the value)
115  * 
116  * 
117  * 
118  **/
119 int get_wd_set_caps_sd(int if_index);
120
121 /**
122  * set_bypass - set Bypass state
123  * @if_index: network device index of the controlling device
124  * @bypass_mode:  bypass mode (1=on, 0=off) 
125  * Output:
126  *  0 - on success
127  * -1 - on failure (device not support Bypass or it's a slave device) 
128  **/
129 int set_bypass_sd(int if_index, int bypass_mode);
130
131 /**
132  * get_bypass - Get Bypass mode state
133  * @if_index: network device index of the controlling device
134  * Output:
135  *  0/1 - (off/on) on success
136  * -1 - on failure (device not support Bypass or it's a slave device) 
137  **/
138 int get_bypass_sd(int if_index);
139
140 /**
141  * get_bypass_change - Get change of Bypass mode state from last status check
142  * @if_index: network device index of the controlling device
143  * Output:
144  *  0/1 - (off/on) on success
145  * -1 - on failure (device not support Bypass or it's a slave device) 
146  **/
147 int get_bypass_change_sd(int if_index);
148
149 /**
150  * set_dis_bypass - Set Disable Bypass mode
151  * @if_index: network device index of the controlling device
152  * @dis_bypass: disable bypass(1=dis, 0=en)
153  * Output:
154  *  0 - on success
155  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
156  *                  or it's a slave device) 
157  **/
158 int set_dis_bypass_sd(int if_index, int dis_bypass);
159
160 /**
161  * get_dis_bypass - Get Disable Bypass mode state
162  * @if_index: network device index of the controlling device
163  * Output:
164  *  0/1 - on success (normal Bypass mode/ Disable bypass)
165  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
166  *                  or it's a slave device) 
167  **/
168 int get_dis_bypass_sd(int if_index);
169
170 /**
171  * set_bypass_pwoff - Set Bypass mode at power-off state
172  * @if_index: network device index of the controlling device
173  * @bypass_mode: bypass mode setting at power off state (1=BP en, 0=BP Dis)
174  * Output:
175  *  0 - on success 
176  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
177  *                  or it's a slave device) 
178  **/
179 int set_bypass_pwoff_sd(int if_index, int bypass_mode);
180
181 /**
182  * get_bypass_pwoff - Get Bypass mode state at power-off state
183  * @if_index: network device index of the controlling device
184  * Output:
185  *  0/1 - on success (Disable bypass at power off state / normal Bypass mode)
186  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
187  *                  or it's a slave device) 
188  **/
189 int get_bypass_pwoff_sd(int if_index);
190
191 /**
192  * set_bypass_pwup - Set Bypass mode at power-up state
193  * @if_index: network device index of the controlling device
194  * @bypass_mode: bypass mode setting at power up state (1=BP en, 0=BP Dis)
195  * Output:
196  *  0 - on success 
197  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
198  *                  or it's a slave device) 
199  **/
200 int set_bypass_pwup_sd(int if_index, int bypass_mode);
201
202 /**
203  * get_bypass_pwup - Get Bypass mode state at power-up state
204  * @if_index: network device index of the controlling device
205  * Output:
206  *  0/1 - on success (Disable bypass at power up state / normal Bypass mode)
207  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
208  *                  or it's a slave device) 
209  **/
210 int get_bypass_pwup_sd(int if_index);
211
212 /**
213  * set_bypass_wd - Set watchdog state
214  * @if_index: network device index of the controlling device
215  * @ms_timeout: requested timeout (in ms units), 0 for disabling the watchdog timer
216  * @ms_timeout_set(output): requested timeout (in ms units), 
217  *                          that the adapter supports and will be used by the watchdog
218  * Output:
219  * 0  - on success 
220  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
221  *                  or it's a slave device) 
222  **/
223 int set_bypass_wd_sd(int if_index, int ms_timeout, int *ms_timeout_set);
224
225 /**
226  * get_bypass_wd - Get watchdog state
227  * @if_index: network device index of the controlling device
228  * @ms_timeout (output): WDT timeout (in ms units), 
229  *                       -1 for unknown wdt status
230  *                        0 if WDT is disabled
231  * Output:
232  * 0  - on success
233  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
234  *                  or it's a slave device) 
235  **/
236 int get_bypass_wd_sd(int if_index, int *ms_timeout_set);
237
238 /**
239  * get_wd_expire_time - Get watchdog expire
240  * @if_index: network device index of the controlling device
241  * @ms_time_left (output): time left till watchdog time expire, 
242  *                       -1 if WDT has expired
243  *                       0  if WDT is disabled
244  * Output:
245  * 0  - on success
246  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
247  *                  or it's a slave device or unknown wdt status) 
248  **/
249 int get_wd_expire_time_sd(int if_index, int *ms_time_left);
250
251 /**
252  * reset_bypass_wd_timer - Reset watchdog timer
253  * @if_index: network device index of the controlling device
254  * 
255  * Output:
256  * 1  - on success
257  * 0 - watchdog is not configured
258  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
259  *                  or it's a slave device or unknown wdt status) 
260  **/
261 int reset_bypass_wd_timer_sd(int if_index);
262
263 /**
264  * set_std_nic - Standard NIC mode of operation
265  * @if_index: network device index of the controlling device
266  * @nic_mode: 0/1 (Default Bypass mode / Standard NIC mode)
267  * 
268  * Output:
269  * 0  - on success
270  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
271  *                  or it's a slave device) 
272  **/
273 int set_std_nic_sd(int if_index, int nic_mode);
274
275 /**
276  * get_std_nic - Get Standard NIC mode setting
277  * @if_index: network device index of the controlling device
278  * 
279  * Output:
280  * 0/1 (Default Bypass mode / Standard NIC mode) on success
281  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
282  *                  or it's a slave device) 
283  **/
284 int get_std_nic_sd(int if_index);
285
286 /**
287  * set_tx - set transmitter enable/disable 
288  * @if_index: network device index of the controlling device
289  * @tx_state: 0/1 (Transmit Disable / Transmit Enable)
290  * 
291  * Output:
292  * 0  - on success
293  * -1 - on failure (device is not capable of the operation ) 
294  **/
295 int set_tx_sd(int if_index, int tx_state);
296
297 /**
298  * get_std_nic - get transmitter state (disable / enable)
299  * @if_index: network device index of the controlling device
300  * 
301  * Output:
302  * 0/1 (ransmit Disable / Transmit Enable) on success
303  * -1 - on failure (device is not capable of the operation ordevice not support Bypass) 
304  **/
305 int get_tx_sd(int if_index);
306
307 /**
308  * set_tap - set TAP state
309  * @if_index: network device index of the controlling device
310  * @tap_mode: 1 tap mode , 0 normal nic mode 
311  * Output:
312  *  0 - on success
313  * -1 - on failure (device not support TAP or it's a slave device) 
314  **/
315 int set_tap_sd(int if_index, int tap_mode);
316
317 /**
318  * get_tap - Get TAP mode state
319  * @if_index: network device index of the controlling device
320  * Output:
321  *  0/1 - (off/on) on success
322  * -1 - on failure (device not support TAP or it's a slave device) 
323  **/
324 int get_tap_sd(int if_index);
325
326 /**
327  * get_tap_change - Get change of TAP mode state from last status check
328  * @if_index: network device index of the controlling device
329  * Output:
330  *  0/1 - (off/on) on success
331  * -1 - on failure (device not support TAP or it's a slave device) 
332  **/
333 int get_tap_change_sd(int if_index);
334
335 /**
336  * set_dis_tap - Set Disable TAP mode
337  * @if_index: network device index of the controlling device
338  * @dis_tap: disable tap(1=dis, 0=en)
339  * Output:
340  *  0 - on success
341  * -1 - on failure (device is not capable of the operation ordevice not support TAP 
342  *                  or it's a slave device) 
343  **/
344 int set_dis_tap_sd(int if_index, int dis_tap);
345
346 /**
347  * get_dis_tap - Get Disable TAP mode state
348  * @if_index: network device index of the controlling device
349  * Output:
350  *  0/1 - on success (normal TAP mode/ Disable TAP)
351  * -1 - on failure (device is not capable of the operation ordevice not support TAP 
352  *                  or it's a slave device) 
353  **/
354 int get_dis_tap_sd(int if_index);
355
356 /**
357  * set_tap_pwup - Set TAP mode at power-up state
358  * @if_index: network device index of the controlling device
359  * @bypass_mode: tap mode setting at power up state (1=TAP en, 0=TAP Dis)
360  * Output:
361  *  0 - on success 
362  * -1 - on failure (device is not capable of the operation ordevice not support TAP 
363  *                  or it's a slave device) 
364  **/
365 int set_tap_pwup_sd(int if_index, int tap_mode);
366
367 /**
368  * get_tap_pwup - Get TAP mode state at power-up state
369  * @if_index: network device index of the controlling device
370  * Output:
371  *  0/1 - on success (Disable TAP at power up state / normal TAP mode)
372  * -1 - on failure (device is not capable of the operation ordevice not support TAP 
373  *                  or it's a slave device) 
374  **/
375 int get_tap_pwup_sd(int if_index);
376
377 /**
378  * set_bp_disc - set Disconnect state
379  * @if_index: network device index of the controlling device
380  * @tap_mode: 1 disc mode , 0 non-disc mode 
381  * Output:
382  *  0 - on success
383  * -1 - on failure (device not support Disconnect or it's a slave device) 
384  **/
385 int set_bp_disc_sd(int if_index, int disc_mode);
386
387 /**
388  * get_bp_disc - Get Disconnect mode state
389  * @if_index: network device index of the controlling device
390  * Output:
391  *  0/1 - (off/on) on success
392  * -1 - on failure (device not support Disconnect or it's a slave device) 
393  **/
394 int get_bp_disc_sd(int if_index);
395
396 /**
397  * get_bp_disc_change - Get change of Disconnect mode state from last status check
398  * @if_index: network device index of the controlling device
399  * Output:
400  *  0/1 - (off/on) on success
401  * -1 - on failure (device not support Disconnect or it's a slave device) 
402  **/
403 int get_bp_disc_change_sd(int if_index);
404
405 /**
406  * set_bp_dis_disc - Set Disable Disconnect mode
407  * @if_index: network device index of the controlling device
408  * @dis_tap: disable tap(1=dis, 0=en)
409  * Output:
410  *  0 - on success
411  * -1 - on failure (device is not capable ofthe operation ordevice not support Disconnect 
412  *                  or it's a slave device) 
413  **/
414 int set_bp_dis_disc_sd(int if_index, int dis_disc);
415
416 /**
417  * get_dis_tap - Get Disable Disconnect mode state
418  * @if_index: network device index of the controlling device
419  * Output:
420  *  0/1 - on success (normal Disconnect mode/ Disable Disconnect)
421  * -1 - on failure (device is not capable of the operation ordevice not support Disconnect 
422  *                  or it's a slave device) 
423  **/
424 int get_bp_dis_disc_sd(int if_index);
425
426 /**
427  * set_bp_disc_pwup - Set Disconnect mode at power-up state
428  * @if_index: network device index of the controlling device
429  * @disc_mode: tap mode setting at power up state (1=Disc en, 0=Disc Dis)
430  * Output:
431  *  0 - on success 
432  * -1 - on failure (device is not capable of the operation ordevice not support Disconnect 
433  *                  or it's a slave device) 
434  **/
435 int set_bp_disc_pwup_sd(int if_index, int disc_mode);
436
437 /**
438  * get_bp_disc_pwup - Get Disconnect mode state at power-up state
439  * @if_index: network device index of the controlling device
440  * Output:
441  *  0/1 - on success (Disable Disconnect at power up state / normal Disconnect mode)
442  * -1 - on failure (device is not capable of the operation ordevice not support TAP 
443  *                  or it's a slave device) 
444  **/
445 int get_bp_disc_pwup_sd(int if_index);
446
447 /**
448  * set_wd_exp_mode - Set adapter state when WDT expired.
449  * @if_index: network device index of the controlling device
450  * @bypass_mode:  adapter mode (1=tap mode, 0=bypass mode) 
451  * Output:
452  *  0 - on success
453  * -1 - on failure (device not support Bypass or it's a slave device) 
454  **/
455 int set_wd_exp_mode_sd(int if_index, int bypass_mode);
456
457 /**
458  * get_wd_exp_mode - Get adapter state when WDT expired.
459  * @if_index: network device index of the controlling device
460  * Output:
461  *  0/1 - (bypass/tap) on success
462  * -1 - on failure (device not support Bypass or it's a slave device) 
463  **/
464 int get_wd_exp_mode_sd(int if_index);
465
466 /**
467  * set_wd_autoreset - reset WDT periodically.
468  * @if_index: network device index of the controlling device
469  * @bypass_mode:  adapter mode (1=tap mode, 0=bypass mode) 
470  * Output:
471  * 1  - on success
472  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
473  *                  or it's a slave device or unknown wdt status) 
474  **/
475 int set_wd_autoreset_sd(int if_index, int time);
476
477 /**
478  * set_wd_autoreset - reset WDT periodically.
479  * @if_index: network device index of the controlling device
480  * @bypass_mode:  adapter mode (1=tap mode, 0=bypass mode) 
481  * Output:
482  * 1  - on success
483  * -1 - on failure (device is not capable of the operation ordevice not support Bypass 
484  *                  or it's a slave device or unknown wdt status) 
485  **/
486 int get_wd_autoreset_sd(int if_index);
487
488 /**
489  * set_tpl - set TPL state
490  * @if_index: network device index of the controlling device
491  * @tpl_mode: 1 tpl mode , 0 normal nic mode 
492  * Output:
493  *  0 - on success
494  * -1 - on failure (device not support TPL) 
495  **/
496 int set_tpl_sd(int if_index, int tpl_mode);
497
498 /**
499  * get_tpl - Get TPL mode state
500  * @if_index: network device index of the controlling device
501  * Output:
502  *  0/1 - (off/on) on success
503  * -1 - on failure (device not support TPL or it's a slave device) 
504  **/
505 int get_tpl_sd(int if_index);
506
507 int get_bypass_info_sd(int if_index, struct bp_info *bp_info);
508 int bp_if_scan_sd(void);
509 /*int get_dev_num_sd(void);*/