1 /******************************************************************************/
3 /* bypass library, Copyright (c) 2004 Silicom, Ltd */
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. */
14 /******************************************************************************/
17 * is_bypass - check if device is a Bypass controlling device
18 * @if_index: network device index
21 * 1 - if device is bypass controlling device,
22 * 0 - if device is bypass slave device
23 * -1 - device not support Bypass
25 int is_bypass_sd(int if_index);
28 * get_bypass_slave - get second port participate in the Bypass pair
29 * @if_index: network device index
32 * network device index of the slave device
33 * -1 - on failure (device not support Bypass or it's a slave device)
35 int get_bypass_slave_sd(int if_index);
38 * get_bypass_caps - get second port participate in the Bypass pair
39 * @if_index: network device index
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
48 * 0 BP_CAP The interface is Bypass capable in general
50 * 1 BP_STATUS_CAP The interface can report of the current Bypass mode
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
55 * 3 SW_CTL_CAP The interface is Software controlled capable for bypass/non bypass modes.
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.
62 * 5 BP_DIS_STATUS_CAP The interface can report of the current DIS_BP_CAP
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)
67 * 7 BP_PWOFF_NO_CAP The interface can be in Bypass mode at power off state
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
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
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)
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)
81 *12 BP_PWUP_CTL_CAP The behavior of the Bypass mode at Power-up can be controlled by software
83 *13 WD_CTL_CAP The interface has watchdog capabilities to turn to Bypass mode when not reset
84 * for defined period of time.
86 *14 WD_STATUS_CAP The interface can report on the watchdog status (Active/inactive)
88 *15 WD_TIMEOUT_CAP The interface can report the time left till watchdog triggers to Bypass mode.
93 int get_bypass_caps_sd(int if_index);
96 * get_wd_set_caps - Obtain watchdog timer setting capabilities
97 * @if_index: network device index
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)
105 * Bit feature description
107 * 0-3 WD_MIN_TIME The interface WD minimal time period in 100mS units
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)
113 * 5-8 WD_STEP_COUNT Number of steps the WD timer supports in 2^X
114 * (X bit available for defining the value)
119 int get_wd_set_caps_sd(int if_index);
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)
127 * -1 - on failure (device not support Bypass or it's a slave device)
129 int set_bypass_sd(int if_index, int bypass_mode);
132 * get_bypass - Get Bypass mode state
133 * @if_index: network device index of the controlling device
135 * 0/1 - (off/on) on success
136 * -1 - on failure (device not support Bypass or it's a slave device)
138 int get_bypass_sd(int if_index);
141 * get_bypass_change - Get change of Bypass mode state from last status check
142 * @if_index: network device index of the controlling device
144 * 0/1 - (off/on) on success
145 * -1 - on failure (device not support Bypass or it's a slave device)
147 int get_bypass_change_sd(int if_index);
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)
155 * -1 - on failure (device is not capable of the operation ordevice not support Bypass
156 * or it's a slave device)
158 int set_dis_bypass_sd(int if_index, int dis_bypass);
161 * get_dis_bypass - Get Disable Bypass mode state
162 * @if_index: network device index of the controlling device
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)
168 int get_dis_bypass_sd(int if_index);
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)
176 * -1 - on failure (device is not capable of the operation ordevice not support Bypass
177 * or it's a slave device)
179 int set_bypass_pwoff_sd(int if_index, int bypass_mode);
182 * get_bypass_pwoff - Get Bypass mode state at power-off state
183 * @if_index: network device index of the controlling device
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)
189 int get_bypass_pwoff_sd(int if_index);
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)
197 * -1 - on failure (device is not capable of the operation ordevice not support Bypass
198 * or it's a slave device)
200 int set_bypass_pwup_sd(int if_index, int bypass_mode);
203 * get_bypass_pwup - Get Bypass mode state at power-up state
204 * @if_index: network device index of the controlling device
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)
210 int get_bypass_pwup_sd(int if_index);
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
220 * -1 - on failure (device is not capable of the operation ordevice not support Bypass
221 * or it's a slave device)
223 int set_bypass_wd_sd(int if_index, int ms_timeout, int *ms_timeout_set);
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
233 * -1 - on failure (device is not capable of the operation ordevice not support Bypass
234 * or it's a slave device)
236 int get_bypass_wd_sd(int if_index, int *ms_timeout_set);
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
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)
249 int get_wd_expire_time_sd(int if_index, int *ms_time_left);
252 * reset_bypass_wd_timer - Reset watchdog timer
253 * @if_index: network device index of the controlling device
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)
261 int reset_bypass_wd_timer_sd(int if_index);
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)
270 * -1 - on failure (device is not capable of the operation ordevice not support Bypass
271 * or it's a slave device)
273 int set_std_nic_sd(int if_index, int nic_mode);
276 * get_std_nic - Get Standard NIC mode setting
277 * @if_index: network device index of the controlling device
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)
284 int get_std_nic_sd(int if_index);
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)
293 * -1 - on failure (device is not capable of the operation )
295 int set_tx_sd(int if_index, int tx_state);
298 * get_std_nic - get transmitter state (disable / enable)
299 * @if_index: network device index of the controlling device
302 * 0/1 (ransmit Disable / Transmit Enable) on success
303 * -1 - on failure (device is not capable of the operation ordevice not support Bypass)
305 int get_tx_sd(int if_index);
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
313 * -1 - on failure (device not support TAP or it's a slave device)
315 int set_tap_sd(int if_index, int tap_mode);
318 * get_tap - Get TAP mode state
319 * @if_index: network device index of the controlling device
321 * 0/1 - (off/on) on success
322 * -1 - on failure (device not support TAP or it's a slave device)
324 int get_tap_sd(int if_index);
327 * get_tap_change - Get change of TAP mode state from last status check
328 * @if_index: network device index of the controlling device
330 * 0/1 - (off/on) on success
331 * -1 - on failure (device not support TAP or it's a slave device)
333 int get_tap_change_sd(int if_index);
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)
341 * -1 - on failure (device is not capable of the operation ordevice not support TAP
342 * or it's a slave device)
344 int set_dis_tap_sd(int if_index, int dis_tap);
347 * get_dis_tap - Get Disable TAP mode state
348 * @if_index: network device index of the controlling device
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)
354 int get_dis_tap_sd(int if_index);
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)
362 * -1 - on failure (device is not capable of the operation ordevice not support TAP
363 * or it's a slave device)
365 int set_tap_pwup_sd(int if_index, int tap_mode);
368 * get_tap_pwup - Get TAP mode state at power-up state
369 * @if_index: network device index of the controlling device
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)
375 int get_tap_pwup_sd(int if_index);
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
383 * -1 - on failure (device not support Disconnect or it's a slave device)
385 int set_bp_disc_sd(int if_index, int disc_mode);
388 * get_bp_disc - Get Disconnect mode state
389 * @if_index: network device index of the controlling device
391 * 0/1 - (off/on) on success
392 * -1 - on failure (device not support Disconnect or it's a slave device)
394 int get_bp_disc_sd(int if_index);
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
400 * 0/1 - (off/on) on success
401 * -1 - on failure (device not support Disconnect or it's a slave device)
403 int get_bp_disc_change_sd(int if_index);
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)
411 * -1 - on failure (device is not capable ofthe operation ordevice not support Disconnect
412 * or it's a slave device)
414 int set_bp_dis_disc_sd(int if_index, int dis_disc);
417 * get_dis_tap - Get Disable Disconnect mode state
418 * @if_index: network device index of the controlling device
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)
424 int get_bp_dis_disc_sd(int if_index);
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)
432 * -1 - on failure (device is not capable of the operation ordevice not support Disconnect
433 * or it's a slave device)
435 int set_bp_disc_pwup_sd(int if_index, int disc_mode);
438 * get_bp_disc_pwup - Get Disconnect mode state at power-up state
439 * @if_index: network device index of the controlling device
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)
445 int get_bp_disc_pwup_sd(int if_index);
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)
453 * -1 - on failure (device not support Bypass or it's a slave device)
455 int set_wd_exp_mode_sd(int if_index, int bypass_mode);
458 * get_wd_exp_mode - Get adapter state when WDT expired.
459 * @if_index: network device index of the controlling device
461 * 0/1 - (bypass/tap) on success
462 * -1 - on failure (device not support Bypass or it's a slave device)
464 int get_wd_exp_mode_sd(int if_index);
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)
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)
475 int set_wd_autoreset_sd(int if_index, int time);
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)
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)
486 int get_wd_autoreset_sd(int if_index);
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
494 * -1 - on failure (device not support TPL)
496 int set_tpl_sd(int if_index, int tpl_mode);
499 * get_tpl - Get TPL mode state
500 * @if_index: network device index of the controlling device
502 * 0/1 - (off/on) on success
503 * -1 - on failure (device not support TPL or it's a slave device)
505 int get_tpl_sd(int if_index);
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);*/