Skip to content

Commit

Permalink
staging: add Silicom Bypass driver
Browse files Browse the repository at this point in the history
The Silicom Bypass Network Interface Cards (NICs) are network cards with
paired ports (2 or 4).  The pairs either act as a "wire" allowing the
network packets to pass or insert the device in between the two ports.
When paired with the on-board hardware watchdog or other failsafe, they
provide high availability for the network in the face of software
outages or maintenance.

Signed-off-by: Daniel Cotey <puff65537@bansheeslibrary.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
DanielC authored and Greg Kroah-Hartman committed Sep 8, 2012
1 parent 960cf81 commit 7040e55
Show file tree
Hide file tree
Showing 18 changed files with 13,382 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,6 @@ source "drivers/staging/omap-thermal/Kconfig"

source "drivers/staging/ramster/Kconfig"

source "drivers/staging/silicom/Kconfig"

endif # STAGING
1 change: 1 addition & 0 deletions drivers/staging/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/
obj-$(CONFIG_CSR_WIFI) += csr/
obj-$(CONFIG_OMAP_BANDGAP) += omap-thermal/
obj-$(CONFIG_ZCACHE2) += ramster/
obj-$(CONFIG_NET_VENDOR_SILICOM) += silicom/
43 changes: 43 additions & 0 deletions drivers/staging/silicom/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Silicom device configuration
#

config NET_VENDOR_SILICOM
bool "Silicom devices"
default y
depends on (SSB_POSSIBLE && HAS_DMA) || PCI
---help---
If you have a network card (Ethernet) belonging to this class,
say Y.

Note that the answer to this question does not directly affect
the kernel: saying N will just case the configurator to skip all
the questions regarding Silicom chipsets. If you say Y, you will be asked
for your specific chipset/driver in the following questions.

if NET_VENDOR_SILICOM

config SBYPASS
tristate "Silicom BypassCTL library support"
---help---
If you have a network (Ethernet) controller of this type, say Y

To compile this driver as a module, choose M here. The module
will be called bypass.

config BPCTL
tristate "Silicom BypassCTL net support"
depends on PCI
select SBYPASS
select NET_CORE
select MII
---help---
If you have a network (Ethernet) controller of this type, say Y
or M and read the Ethernet-HOWTO, available from
<http://www.tldp.org/docs.html#howto>.

To compile this driver as a module, choose M here. The module
will be called bpctl_mod.


endif # NET_VENDOR_SILICOM
9 changes: 9 additions & 0 deletions drivers/staging/silicom/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Makefile for the Bypass network device drivers.
#

obj-$(CONFIG_BPCTL) += bpctl_mod.o
obj-$(CONFIG_SBYPASS) += bypasslib/


bpctl_mod-objs := bp_mod.o bp_proc.o
14 changes: 14 additions & 0 deletions drivers/staging/silicom/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

Theory of Operation:

The Silicom Bypass Network Interface Cards (NICs) are network cards with paired ports (2 or 4).
The pairs either act as a "wire" allowing the network packets to pass or insert the device in
between the two ports. When paired with the on-board hardware watchdog or other failsafe,
they provide high availability for the network in the face of software outages or maintenance.

The software requirements are for a kernel level driver that interfaces with the bypass and watchdog,
as well as for control software. User control can be either the provided standalone executable
(/bin/bpctl) or the API exposed by the Silicom library.



7 changes: 7 additions & 0 deletions drivers/staging/silicom/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
TODO:
- checkpatch.pl cleanups
- locking audit
- single module with all functionality
- userland


56 changes: 56 additions & 0 deletions drivers/staging/silicom/bits.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/******************************************************************************/
/* */
/* Broadcom BCM5700 Linux Network Driver, Copyright (c) 2000 - 2004 Broadcom */
/* Corporation. */
/* All rights reserved. */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, located in the file LICENSE. */
/* */
/* History: */
/* 02/25/00 Hav Khauv Initial version. */
/******************************************************************************/

#ifndef BITS_H
#define BITS_H

/******************************************************************************/
/* Bit Mask definitions */
/******************************************************************************/

#define BIT_NONE 0x00
#define BIT_0 0x01
#define BIT_1 0x02
#define BIT_2 0x04
#define BIT_3 0x08
#define BIT_4 0x10
#define BIT_5 0x20
#define BIT_6 0x40
#define BIT_7 0x80
#define BIT_8 0x0100
#define BIT_9 0x0200
#define BIT_10 0x0400
#define BIT_11 0x0800
#define BIT_12 0x1000
#define BIT_13 0x2000
#define BIT_14 0x4000
#define BIT_15 0x8000
#define BIT_16 0x010000
#define BIT_17 0x020000
#define BIT_18 0x040000
#define BIT_19 0x080000
#define BIT_20 0x100000
#define BIT_21 0x200000
#define BIT_22 0x400000
#define BIT_23 0x800000
#define BIT_24 0x01000000
#define BIT_25 0x02000000
#define BIT_26 0x04000000
#define BIT_27 0x08000000
#define BIT_28 0x10000000
#define BIT_29 0x20000000
#define BIT_30 0x40000000
#define BIT_31 0x80000000

#endif /* BITS_H */
141 changes: 141 additions & 0 deletions drivers/staging/silicom/bp_ioctl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/******************************************************************************/
/* */
/* Silicom Bypass Control Utility, Copyright (c) 2005-2007 Silicom */
/* All rights reserved. */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, located in the file LICENSE. */
/* */
/* */
/******************************************************************************/

#ifndef BP_IOCTL_H
#define BP_IOCTL_H

#define BP_CAP 0x01 //BIT_0
#define BP_STATUS_CAP 0x02 //BIT_1
#define BP_STATUS_CHANGE_CAP 0x04 //BIT_2
#define SW_CTL_CAP 0x08 //BIT_3
#define BP_DIS_CAP 0x10 //BIT_4
#define BP_DIS_STATUS_CAP 0x20 //BIT_5
#define STD_NIC_CAP 0x40 //BIT_6
#define BP_PWOFF_ON_CAP 0x80 //BIT_7
#define BP_PWOFF_OFF_CAP 0x0100 //BIT_8
#define BP_PWOFF_CTL_CAP 0x0200 //BIT_9
#define BP_PWUP_ON_CAP 0x0400 //BIT_10
#define BP_PWUP_OFF_CAP 0x0800 //BIT_11
#define BP_PWUP_CTL_CAP 0x1000 //BIT_12
#define WD_CTL_CAP 0x2000 //BIT_13
#define WD_STATUS_CAP 0x4000 //BIT_14
#define WD_TIMEOUT_CAP 0x8000 //BIT_15
#define TX_CTL_CAP 0x10000 //BIT_16
#define TX_STATUS_CAP 0x20000 //BIT_17
#define TAP_CAP 0x40000 //BIT_18
#define TAP_STATUS_CAP 0x80000 //BIT_19
#define TAP_STATUS_CHANGE_CAP 0x100000 //BIT_20
#define TAP_DIS_CAP 0x200000 //BIT_21
#define TAP_DIS_STATUS_CAP 0x400000 //BIT_22
#define TAP_PWUP_ON_CAP 0x800000 //BIT_23
#define TAP_PWUP_OFF_CAP 0x1000000 //BIT 24
#define TAP_PWUP_CTL_CAP 0x2000000 //BIT 25
#define NIC_CAP_NEG 0x4000000 //BIT 26
#define TPL_CAP 0x8000000 //BIT 27
#define DISC_CAP 0x10000000 //BIT 28
#define DISC_DIS_CAP 0x20000000 //BIT 29
#define DISC_PWUP_CTL_CAP 0x40000000 //BIT 30

#define TPL2_CAP_EX 0x01
#define DISC_PORT_CAP_EX 0x02

#define WD_MIN_TIME_MASK(val) (val & 0xf)
#define WD_STEP_COUNT_MASK(val) ((val & 0xf) << 5)
#define WDT_STEP_TIME 0x10 //BIT_4

#define WD_MIN_TIME_GET(desc) (desc & 0xf)
#define WD_STEP_COUNT_GET(desc) (desc>>5) & 0xf

typedef enum {
IF_SCAN,
GET_DEV_NUM,
IS_BYPASS,
GET_BYPASS_SLAVE,
GET_BYPASS_CAPS,
GET_WD_SET_CAPS,
SET_BYPASS,
GET_BYPASS,
GET_BYPASS_CHANGE,
SET_BYPASS_WD,
GET_BYPASS_WD,
GET_WD_EXPIRE_TIME,
RESET_BYPASS_WD_TIMER,
SET_DIS_BYPASS,
GET_DIS_BYPASS,
SET_BYPASS_PWOFF,
GET_BYPASS_PWOFF,
SET_BYPASS_PWUP,
GET_BYPASS_PWUP,
SET_STD_NIC,
GET_STD_NIC,
SET_TX,
GET_TX,
SET_TAP,
GET_TAP,
GET_TAP_CHANGE,
SET_DIS_TAP,
GET_DIS_TAP,
SET_TAP_PWUP,
GET_TAP_PWUP,
SET_WD_EXP_MODE,
GET_WD_EXP_MODE,
SET_WD_AUTORESET,
GET_WD_AUTORESET,
SET_TPL,
GET_TPL,
SET_DISC,
GET_DISC,
GET_DISC_CHANGE,
SET_DIS_DISC,
GET_DIS_DISC,
SET_DISC_PWUP,
GET_DISC_PWUP,
GET_BYPASS_INFO = 100,
GET_BP_WAIT_AT_PWUP,
SET_BP_WAIT_AT_PWUP,
GET_BP_HW_RESET,
SET_BP_HW_RESET,
SET_DISC_PORT,
GET_DISC_PORT,
SET_DISC_PORT_PWUP,
GET_DISC_PORT_PWUP,
SET_BP_FORCE_LINK,
GET_BP_FORCE_LINK,
#ifdef BP_SELF_TEST
SET_BP_SELF_TEST = 200,
GET_BP_SELF_TEST,
#endif

} CMND_TYPE_SD;

/*
* The major device number. We can't rely on dynamic
* registration any more, because ioctls need to know
* it.
*/

#define MAGIC_NUM 'J'

/* for passing single values */
struct bpctl_cmd {
int status;
int data[8];
int in_param[8];
int out_param[8];
};

#define IOCTL_TX_MSG(cmd) _IOWR(MAGIC_NUM, cmd, struct bpctl_cmd)

#define DEVICE_NODE "/dev/bpctl0"
#define DEVICE_NAME "bpctl"

#endif
Loading

0 comments on commit 7040e55

Please sign in to comment.