From 355206db206a1209119fa06d10c3c1fbd26d91da Mon Sep 17 00:00:00 2001 From: Silicom Ltd Date: Mon, 9 Jun 2014 14:56:27 +0000 Subject: [PATCH] Upstream release 5.0.65.1 --- COPYING_bsd | 14 + Makefile | 7 +- bits.h | 32 + bnx2x_reg.h | 32 + bp_ioctl.h | 2 +- bp_mod.c | 1672 ++++++++++++++++++++++++++++++++++++--------------- bp_mod.h | 50 +- bp_msg.h | 2 +- bp_proc.c | 1513 ---------------------------------------------- bp_util.c | 4 +- bp_util.h | 2 +- bpctl_start | 33 + bpctl_stop | 33 + bypass.h | 2 +- libbp_sd.h | 2 +- license | 290 --------- readme.txt | 0 release.txt | 77 ++- 18 files changed, 1463 insertions(+), 2304 deletions(-) create mode 100644 COPYING_bsd mode change 100644 => 100755 Makefile mode change 100644 => 100755 bits.h mode change 100644 => 100755 bnx2x_reg.h mode change 100644 => 100755 bp_ioctl.h mode change 100644 => 100755 bp_mod.c mode change 100644 => 100755 bp_mod.h mode change 100644 => 100755 bp_msg.h delete mode 100644 bp_proc.c mode change 100644 => 100755 bp_util.c mode change 100644 => 100755 bp_util.h mode change 100644 => 100755 bpctl_start mode change 100644 => 100755 bpctl_stop mode change 100644 => 100755 bypass.h mode change 100644 => 100755 libbp_sd.h delete mode 100644 license mode change 100644 => 100755 readme.txt mode change 100644 => 100755 release.txt diff --git a/COPYING_bsd b/COPYING_bsd new file mode 100644 index 0000000..5d8d3c2 --- /dev/null +++ b/COPYING_bsd @@ -0,0 +1,14 @@ +bp_ctl and its command line tools are licensed under the BSD 2-clause license + +* The BSD 2-clause license + +Copyright (c) 2010-2014, Silicom Ltd. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 index 4215465..c1b3028 --- a/Makefile +++ b/Makefile @@ -1,8 +1,6 @@ -MOD_VER=5.0.50 +MOD_VER=5.0.65.1 -MOD_VER=5.0.40.29-rb -INSTALL_MOD_PATH=/opt/rb # core driver files CFILES = bp_mod.c @@ -57,6 +55,7 @@ endif VSP := $(KOBJ)/include/generated/utsrelease.h \ $(KOBJ)/include/linux/utsrelease.h \ $(KOBJ)/include/linux/version.h \ +$(KOBJ)/include/generated/uapi/linux/version.h \ /boot/vmlinuz.version.h # Config file Search Path @@ -132,7 +131,7 @@ EXTRA_CFLAGS += -DDRIVER_NAME=$(DRIVER_NAME) EXTRA_CFLAGS += -DDRIVER_NAME_CAPS=$(shell echo $(DRIVER_NAME) | tr '[a-z]' '[A-Z]') # standard flags for module builds EXTRA_CFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall -EXTRA_CFLAGS += -I$(KSRC)/include -I. +EXTRA_CFLAGS += -I$(KSRC)/generated/uapi -I$(KSRC)/include -I. EXTRA_CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \ echo "-DMODVERSIONS -DEXPORT_SYMTAB \ -include $(KSRC)/include/linux/modversions.h") diff --git a/bits.h b/bits.h old mode 100644 new mode 100755 index 693c5e6..aa5daad --- a/bits.h +++ b/bits.h @@ -1,3 +1,35 @@ +/************************************************************************** + +Copyright (c) 2006-2013, Silicom +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Silicom nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +***************************************************************************/ #ifndef BITS_H #define BITS_H diff --git a/bnx2x_reg.h b/bnx2x_reg.h old mode 100644 new mode 100755 index 11abb12..b2da915 --- a/bnx2x_reg.h +++ b/bnx2x_reg.h @@ -1,3 +1,35 @@ +/************************************************************************** + +Copyright (c) 2006-2013, Silicom +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Silicom nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +***************************************************************************/ /* [R 19] Interrupt register #0 read */ diff --git a/bp_ioctl.h b/bp_ioctl.h old mode 100644 new mode 100755 index 015ebea..66bed7a --- a/bp_ioctl.h +++ b/bp_ioctl.h @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2005-2013, Silicom +Copyright (c) 2006-2013, Silicom All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/bp_mod.c b/bp_mod.c old mode 100644 new mode 100755 index 54317ed..6ae7a45 --- a/bp_mod.c +++ b/bp_mod.c @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2005-2013, Silicom +Copyright (c) 2006-2013, Silicom All rights reserved. Redistribution and use in source and binary forms, with or without @@ -175,9 +175,45 @@ typedef struct _bpctl_dev { #endif struct bypass_pfs_sd bypass_pfs_set; + char proc_dir[128]; } bpctl_dev_t; +int usec_delay_bp1(unsigned long x) { + struct timeval tv, tv_end; + do_gettimeofday(&tv); + udelay(x); + do_gettimeofday(&tv_end); + if (tv_end.tv_usec>tv.tv_usec) { + if ((tv_end.tv_usec-tv.tv_usec)<(x/2)) + return 0; + } else if ((~tv.tv_usec+tv_end.tv_usec)<(x/2)) + return 0; + return 1; + +} +void usec_delay_bp(unsigned long x) { + int i=2; + while (i--) { + if (usec_delay_bp1(x)) + return; + } + printk("bpmod: udelay failed!\n"); +} + + +void msec_delay_bp(unsigned long x){ + int i; + if (1) { + for (i = 0; i < 1000; i++) { + usec_delay_bp(x) ; + } + } else { + msleep(x); + } +} + + /*static bpctl_dev_t *bpctl_dev_a; @@ -204,189 +240,148 @@ int bp_proc_create(void); int is_bypass_fn(bpctl_dev_t *pbpctl_dev); int get_dev_idx_bsf(int bus, int slot, int func); -static unsigned long str_to_hex(char *p); -static int bp_device_event(struct notifier_block *unused, - unsigned long event, void *ptr) + +static int bp_get_dev_idx_bsf(struct net_device *dev, int *index) { - struct net_device *dev = ptr; -#ifdef BP_LINK_FAIL_NOTIFIER - static bpctl_dev_t *pbpctl_dev=NULL, *pbpctl_dev_m=NULL; - int dev_num=0, ret=0, ret_d=0, time_left=0; + struct ethtool_drvinfo drvinfo = {0}; + char *buf; + int bus, slot, func; + + if (dev->ethtool_ops && dev->ethtool_ops->get_drvinfo) + dev->ethtool_ops->get_drvinfo(dev, &drvinfo); + else + return -EOPNOTSUPP; + + if (!drvinfo.bus_info) + return -ENODATA; + if (!strcmp(drvinfo.bus_info, "N/A")) + return -ENODATA; + + buf = strchr(drvinfo.bus_info, ':'); + if (!buf) + return -EINVAL; + buf++; + if (sscanf(buf, "%x:%x.%x", &bus, &slot, &func) != 3) + return -EINVAL; + + *index = get_dev_idx_bsf(bus, slot, func); + return 0; +} + +static int bp_device_event(struct notifier_block *unused, + unsigned long event, void *ptr) +{ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) + struct net_device *dev = ptr; +#else + struct net_device *dev = netdev_notifier_info_to_dev(ptr); #endif - //printk("BP_PROC_SUPPORT event =%d %s %d\n", event,dev->name, dev->ifindex ); - //return NOTIFY_DONE; - if (!dev) - return NOTIFY_DONE; -#ifdef BP_PROC_SUPPORT - if (event==NETDEV_REGISTER) { - { - struct ethtool_drvinfo drvinfo; - // char *str=NULL; - char cbuf[32]; - char *buf=NULL; - char res[10]; - int i=0,j=0, ifindex, idx_dev=0; - int bus=0,slot=0,func=0; - ifindex=dev->ifindex; + static bpctl_dev_t *pbpctl_dev, *pbpctl_dev_m; + int dev_num = 0, ret = 0, ret_d = 0, time_left = 0; + /* printk("BP_PROC_SUPPORT event =%d %s %d\n", event,dev->name, dev->ifindex ); */ + /* return NOTIFY_DONE; */ + if (!dev) + return NOTIFY_DONE; - memset(res,0,10); - memset(&drvinfo,0,sizeof(struct ethtool_drvinfo)); + if (event == NETDEV_REGISTER) { + int idx_dev; - if (dev->ethtool_ops && dev->ethtool_ops->get_drvinfo) { - memset(&drvinfo, 0, sizeof(drvinfo)); - dev->ethtool_ops->get_drvinfo(dev, &drvinfo); - } else - return NOTIFY_DONE; - if (!drvinfo.bus_info) - return NOTIFY_DONE; - memcpy(&cbuf,drvinfo.bus_info,32); - buf= &cbuf[0]; + if (bp_get_dev_idx_bsf(dev, &idx_dev)) + return NOTIFY_DONE; - // while(*buf++){ + if (idx_dev == -1) + return NOTIFY_DONE; - /*if(*buf==':'){ - buf++; - break; - } */ - //} - for (j=0;j<32;j++) - if (buf[j]==':') - break; - if (++j>=32) { - return NOTIFY_DONE; - } - for (i=0;i<10;i++,j++) { - if (j>=32) - break; - if (buf[j]==':') - break; - res[i]=buf[j]; + bpctl_dev_arr[idx_dev].ifindex = dev->ifindex; + bpctl_dev_arr[idx_dev].ndev = dev; - } - if (++j>=32) { - return NOTIFY_DONE; - } + bypass_proc_remove_dev_sd(&bpctl_dev_arr[idx_dev]); + bypass_proc_create_dev_sd(&bpctl_dev_arr[idx_dev]); + return NOTIFY_DONE; + } + if (event == NETDEV_UNREGISTER) { + int idx_dev = 0; + for (idx_dev = 0; + ((bpctl_dev_arr[idx_dev].pdev != NULL) + && (idx_dev < device_num)); idx_dev++) { + if (bpctl_dev_arr[idx_dev].ndev == dev) { + bypass_proc_remove_dev_sd(&bpctl_dev_arr + [idx_dev]); + bpctl_dev_arr[idx_dev].ndev = NULL; - bus= str_to_hex(res); - memset(res,0,10); + return NOTIFY_DONE; - for (i=0;i<10;i++,j++) { - if (j>=32) - break; + } - if (buf[j]=='.') - break; - res[i]=buf[j]; + } + return NOTIFY_DONE; + } + if (event == NETDEV_CHANGENAME) { + int idx_dev = 0; + for (idx_dev = 0; + ((bpctl_dev_arr[idx_dev].pdev != NULL) + && (idx_dev < device_num)); idx_dev++) { + if (bpctl_dev_arr[idx_dev].ndev == dev) { + bypass_proc_remove_dev_sd(&bpctl_dev_arr + [idx_dev]); + bypass_proc_create_dev_sd(&bpctl_dev_arr + [idx_dev]); - } - if (++j>=32) { - return NOTIFY_DONE; - } - slot= str_to_hex(res); - func= str_to_hex(&buf[j]); - idx_dev=get_dev_idx_bsf(bus, slot, func) ; + return NOTIFY_DONE; + } + } + return NOTIFY_DONE; - if (idx_dev!=-1) { + } - bpctl_dev_arr[idx_dev].ifindex=ifindex; - bpctl_dev_arr[idx_dev].ndev=dev; + switch (event) { - bypass_proc_remove_dev_sd(&bpctl_dev_arr[idx_dev]); - bypass_proc_create_dev_sd(&bpctl_dev_arr[idx_dev]); + case NETDEV_CHANGE:{ + if (netif_carrier_ok(dev)) + return NOTIFY_DONE; + if (((dev_num = get_dev_idx(dev->ifindex)) == -1) || + (!(pbpctl_dev = &bpctl_dev_arr[dev_num]))) + return NOTIFY_DONE; - } + if ((is_bypass_fn(pbpctl_dev)) == 1) + pbpctl_dev_m = pbpctl_dev; + else + pbpctl_dev_m = get_master_port_fn(pbpctl_dev); + if (!pbpctl_dev_m) + return NOTIFY_DONE; + ret = bypass_status(pbpctl_dev_m); + if (ret == 1) + printk("bpmod: %s is in the Bypass mode now", + dev->name); + ret_d = disc_status(pbpctl_dev_m); + if (ret_d == 1) + printk + ("bpmod: %s is in the Disconnect mode now", + dev->name); + if (ret || ret_d) { + wdt_timer(pbpctl_dev_m, &time_left); + if (time_left == -1) + printk("; WDT has expired"); + printk(".\n"); - } - return NOTIFY_DONE; + } + return NOTIFY_DONE; - } - if (event==NETDEV_UNREGISTER) { - int idx_dev=0; - //if_scan(); - for (idx_dev = 0; ((bpctl_dev_arr[idx_dev].pdev!=NULL)&&(idx_devifindex))==-1)|| - (!(pbpctl_dev=&bpctl_dev_arr[dev_num]))) - return NOTIFY_DONE; - - if ((is_bypass_fn(pbpctl_dev))==1) - pbpctl_dev_m=pbpctl_dev; - else - pbpctl_dev_m=get_master_port_fn(pbpctl_dev); - if (!pbpctl_dev_m) - return NOTIFY_DONE; - ret=bypass_status(pbpctl_dev_m); - if (ret==1) - printk("bpmod: %s is in the Bypass mode now",dev->name); - ret_d=disc_status(pbpctl_dev_m); - if (ret_d==1) - printk("bpmod: %s is in the Disconnect mode now",dev->name); - if (ret||ret_d) { - wdt_timer(pbpctl_dev_m, &time_left); - if (time_left== -1) - printk("; WDT has expired"); - printk(".\n"); - - } - return NOTIFY_DONE; - - - } -#endif - - default: - return NOTIFY_DONE; - - } - return NOTIFY_DONE; + } + return NOTIFY_DONE; } -struct notifier_block bp_notifier_block = { +static struct notifier_block bp_notifier_block = { .notifier_call = bp_device_event, }; @@ -499,7 +494,7 @@ static void write_pulse(bpctl_dev_t *pbpctl_dev, } - usec_delay(PULSE_TIME); + usec_delay_bp(PULSE_TIME); if (pbpctl_dev->bp_10g9) { /*BP10G_WRITE_REG(pbpctl_dev, I2CCTL, ((ctrl_ext|BP10G_MDIO_DATA_OUT9)&~(BP10G_MCLK_DATA_OUT9)));*/ @@ -539,7 +534,7 @@ static void write_pulse(bpctl_dev_t *pbpctl_dev, // BP10G_WRITE_REG(pbpctl_dev, ESDP, (ctrl |BP10G_MDIO_DIR|BP10G_MDIO_DATA)); } - usec_delay(PULSE_TIME); + usec_delay_bp(PULSE_TIME); } else { if (pbpctl_dev->bp_10g9) { @@ -580,7 +575,7 @@ static void write_pulse(bpctl_dev_t *pbpctl_dev, // BP10G_WRITE_REG(pbpctl_dev, ESDP, ((ctrl |BP10G_MDIO_DIR)&~BP10G_MDIO_DATA)); } - usec_delay(PULSE_TIME); + usec_delay_bp(PULSE_TIME); if (pbpctl_dev->bp_10g9) { /* DATA 0 CLK 0 */ /*BP10G_WRITE_REG(pbpctl_dev, I2CCTL, (ctrl_ext&~(BP10G_MCLK_DATA_OUT9|BP10G_MDIO_DATA_OUT9)));*/ @@ -618,7 +613,7 @@ static void write_pulse(bpctl_dev_t *pbpctl_dev, //BP10G_WRITE_REG(pbpctl_dev, ESDP, ((ctrl |BP10G_MDIO_DIR)&~BP10G_MDIO_DATA)); } - usec_delay(PULSE_TIME); + usec_delay_bp(PULSE_TIME); } } @@ -684,7 +679,7 @@ static int read_pulse(bpctl_dev_t *pbpctl_dev, unsigned int ctrl_ext ,unsigned c } - usec_delay(PULSE_TIME); + usec_delay_bp(PULSE_TIME); if (pbpctl_dev->bp_10g9) { /*BP10G_WRITE_REG(pbpctl_dev, I2CCTL, (ctrl_ext|BP10G_MCLK_DATA_OUT9|BP10G_MDIO_DATA_OUT9));*/ /* DATA ? CLK 1*/ @@ -747,7 +742,7 @@ static int read_pulse(bpctl_dev_t *pbpctl_dev, unsigned int ctrl_ext ,unsigned c //ctrl_ext =readl((void *)((pbpctl_dev)->mem_map) + 0x28); - usec_delay(PULSE_TIME); + usec_delay_bp(PULSE_TIME); if (pbpctl_dev->bp_10g9) { if (ctrl_ext & BP10G_MDIO_DATA_IN9) ctrl_val |= 1<mem_map) + 0x28)) ; } - usec_delay(CMND_INTERVAL); + usec_delay_bp(CMND_INTERVAL); /*send sync cmd*/ write_pulse(pbpctl_dev,ctrl_ext,SYNC_CMD_VAL,SYNC_CMD_LEN); @@ -895,7 +890,7 @@ static void write_reg(bpctl_dev_t *pbpctl_dev, unsigned char value, unsigned cha // writel((0x0), (void *)(((pbpctl_dev)->mem_map) + 0x28)) ; } - usec_delay(CMND_INTERVAL*4); + usec_delay_bp(CMND_INTERVAL*4); if ((pbpctl_dev->wdt_status==WDT_STATUS_EN)&& @@ -1019,7 +1014,7 @@ static int read_reg(bpctl_dev_t *pbpctl_dev, unsigned char addr){ } - usec_delay(CMND_INTERVAL); + usec_delay_bp(CMND_INTERVAL); /*send sync cmd*/ write_pulse(pbpctl_dev,ctrl_ext,SYNC_CMD_VAL,SYNC_CMD_LEN); @@ -1063,7 +1058,7 @@ static int read_reg(bpctl_dev_t *pbpctl_dev, unsigned char addr){ // BP10G_WRITE_REG(pbpctl_dev, ESDP, (ctrl &~(BP10G_MDIO_DATA|BP10G_MDIO_DIR))); } - usec_delay(PULSE_TIME); + usec_delay_bp(PULSE_TIME); ctrl_value= read_pulse(pbpctl_dev,ctrl_ext,RD_DATA_LEN); @@ -1112,7 +1107,7 @@ static int read_reg(bpctl_dev_t *pbpctl_dev, unsigned char addr){ } - usec_delay(CMND_INTERVAL*4); + usec_delay_bp(CMND_INTERVAL*4); #ifdef BP_SYNC_FLAG spin_unlock_irqrestore(&pbpctl_dev->bypass_wr_lock, flags); #else @@ -1228,7 +1223,7 @@ static int wdt_pulse(bpctl_dev_t *pbpctl_dev){ } - usec_delay(WDT_INTERVAL); + usec_delay_bp(WDT_INTERVAL); if (pbpctl_dev->bp_10g9) { /* BP10G_WRITE_REG(pbpctl_dev, I2CCTL, (ctrl_ext&~(BP10G_MCLK_DATA_OUT9|BP10G_MDIO_DATA_OUT9)));*/ /* DATA 0 CLK 0 */ @@ -1273,7 +1268,7 @@ static int wdt_pulse(bpctl_dev_t *pbpctl_dev){ #ifdef BP_SYNC_FLAG spin_unlock_irqrestore(&pbpctl_dev->bypass_wr_lock, flags); #endif - usec_delay(CMND_INTERVAL*4); + usec_delay_bp(CMND_INTERVAL*4); return 0; } @@ -1295,11 +1290,11 @@ static void data_pulse(bpctl_dev_t *pbpctl_dev, unsigned char value){ BPCTLI_CTRL_EXT_SDP6_DIR| BPCTLI_CTRL_EXT_SDP7_DIR)&~(BPCTLI_CTRL_EXT_SDP6_DATA|BPCTLI_CTRL_EXT_SDP7_DATA))); - usec_delay(INIT_CMND_INTERVAL); + usec_delay_bp(INIT_CMND_INTERVAL); BPCTL_BP_WRITE_REG(pbpctl_dev, CTRL_EXT, ((ctrl_ext | BPCTLI_CTRL_EXT_SDP6_DIR| BPCTLI_CTRL_EXT_SDP7_DIR | BPCTLI_CTRL_EXT_SDP6_DATA)&~(BPCTLI_CTRL_EXT_SDP7_DATA))); - usec_delay(INIT_CMND_INTERVAL); + usec_delay_bp(INIT_CMND_INTERVAL); while (value) { @@ -1308,22 +1303,22 @@ static void data_pulse(bpctl_dev_t *pbpctl_dev, unsigned char value){ BPCTLI_CTRL_EXT_SDP7_DIR| BPCTLI_CTRL_EXT_SDP6_DATA| BPCTLI_CTRL_EXT_SDP7_DATA); - usec_delay(PULSE_INTERVAL); + usec_delay_bp(PULSE_INTERVAL); BPCTL_BP_WRITE_REG(pbpctl_dev, CTRL_EXT, (( ctrl_ext| BPCTLI_CTRL_EXT_SDP6_DIR| BPCTLI_CTRL_EXT_SDP7_DIR| BPCTLI_CTRL_EXT_SDP6_DATA)&~BPCTLI_CTRL_EXT_SDP7_DATA)); - usec_delay(PULSE_INTERVAL); + usec_delay_bp(PULSE_INTERVAL); value--; } - usec_delay(INIT_CMND_INTERVAL-PULSE_INTERVAL); + usec_delay_bp(INIT_CMND_INTERVAL-PULSE_INTERVAL); BPCTL_BP_WRITE_REG(pbpctl_dev, CTRL_EXT, (( ctrl_ext | BPCTLI_CTRL_EXT_SDP6_DIR| BPCTLI_CTRL_EXT_SDP7_DIR)&~(BPCTLI_CTRL_EXT_SDP6_DATA|BPCTLI_CTRL_EXT_SDP7_DATA))); - usec_delay(WDT_TIME_CNT); + usec_delay_bp(WDT_TIME_CNT); if (pbpctl_dev->wdt_status==WDT_STATUS_EN) pbpctl_dev->bypass_wdt_on_time=jiffies; #ifdef BP_SYNC_FLAG @@ -1353,12 +1348,12 @@ static int send_wdt_pulse(bpctl_dev_t *pbpctl_dev){ BPCTL_BP_WRITE_REG(pbpctl_dev, CTRL_EXT, ctrl_ext | /* 1 */ BPCTLI_CTRL_EXT_SDP7_DIR | BPCTLI_CTRL_EXT_SDP7_DATA); - usec_delay(PULSE_INTERVAL); + usec_delay_bp(PULSE_INTERVAL); BPCTL_BP_WRITE_REG(pbpctl_dev, CTRL_EXT, ((ctrl_ext | /* 0 */ BPCTLI_CTRL_EXT_SDP7_DIR)&~BPCTLI_CTRL_EXT_SDP7_DATA)); - usec_delay(PULSE_INTERVAL); + usec_delay_bp(PULSE_INTERVAL); if (pbpctl_dev->wdt_status==WDT_STATUS_EN) pbpctl_dev->bypass_wdt_on_time=jiffies; #ifdef BP_SYNC_FLAG @@ -1375,17 +1370,17 @@ void send_bypass_clear_pulse(bpctl_dev_t *pbpctl_dev, unsigned int value){ BPCTL_BP_WRITE_REG(pbpctl_dev, CTRL_EXT, ((ctrl_ext | /* 0 */ BPCTLI_CTRL_EXT_SDP6_DIR)&~BPCTLI_CTRL_EXT_SDP6_DATA)); - usec_delay(PULSE_INTERVAL); + usec_delay_bp(PULSE_INTERVAL); while (value) { BPCTL_BP_WRITE_REG(pbpctl_dev, CTRL_EXT, ctrl_ext | /* 1 */ BPCTLI_CTRL_EXT_SDP6_DIR | BPCTLI_CTRL_EXT_SDP6_DATA); - usec_delay(PULSE_INTERVAL); + usec_delay_bp(PULSE_INTERVAL); value--; } BPCTL_BP_WRITE_REG(pbpctl_dev, CTRL_EXT, ((ctrl_ext | /* 0 */ BPCTLI_CTRL_EXT_SDP6_DIR)&~BPCTLI_CTRL_EXT_SDP6_DATA)); - usec_delay(PULSE_INTERVAL); + usec_delay_bp(PULSE_INTERVAL); } /* #endif OLD_FW */ #ifdef BYPASS_DEBUG @@ -1939,7 +1934,7 @@ s32 bp75_get_hw_semaphore_generic(bpctl_dev_t *pbpctl_dev) if (!(swsm & BPCTLI_SWSM_SMBI)) break; - usec_delay(50); + usec_delay_bp(50); i++; } @@ -1958,7 +1953,7 @@ s32 bp75_get_hw_semaphore_generic(bpctl_dev_t *pbpctl_dev) if (BPCTL_READ_REG(pbpctl_dev, SWSM) & BPCTLI_SWSM_SWESMBI) break; - usec_delay(50); + usec_delay_bp(50); } if (i == timeout) { @@ -2058,7 +2053,7 @@ s32 bp75_read_phy_reg_mdic(bpctl_dev_t *pbpctl_dev, u32 offset, u16 *data) BPCTL_WRITE_REG(pbpctl_dev, MDIC, mdic); for (i = 0; i < (BPCTLI_GEN_POLL_TIMEOUT * 3); i++) { - usec_delay(50); + usec_delay_bp(50); mdic = BPCTL_READ_REG(pbpctl_dev, MDIC); if (mdic & BPCTLI_MDIC_READY) break; @@ -2095,7 +2090,7 @@ s32 bp75_write_phy_reg_mdic(bpctl_dev_t *pbpctl_dev, u32 offset, u16 data) BPCTL_WRITE_REG(pbpctl_dev, MDIC, mdic); for (i = 0; i < (BPCTLI_GEN_POLL_TIMEOUT * 3); i++) { - usec_delay(50); + usec_delay_bp(50); mdic = BPCTL_READ_REG(pbpctl_dev, MDIC); if (mdic & BPCTLI_MDIC_READY) break; @@ -2181,7 +2176,7 @@ static int set_tx (bpctl_dev_t *pbpctl_dev, int tx_state){ if (pbpctl_dev_m==NULL) return BP_NOT_CAP; - if (pbpctl_dev_m->bp_caps_ex&DISC_PORT_CAP_EX) { + if ((pbpctl_dev_m->bp_caps_ex&DISC_PORT_CAP_EX)&&(!pbpctl_dev->bp_10g9)) { ctrl = BPCTL_READ_REG(pbpctl_dev, CTRL); if (!tx_state) { if (pbpctl_dev->bp_540) { @@ -2281,6 +2276,7 @@ static int set_tx (bpctl_dev_t *pbpctl_dev, int tx_state){ else { if (pbpctl_dev->bp_10g9) { + BP10G_WRITE_REG(pbpctl_dev, ESDP, ((ctrl|BP10G_SDP3_DIR) &~BP10G_SDP3_DATA)); @@ -2706,17 +2702,17 @@ static int wdt_timer(bpctl_dev_t *pbpctl_dev, int *time_left){ static int wdt_timer_reload(bpctl_dev_t *pbpctl_dev){ - /* int ret=0; */ + int ret=0; if ((pbpctl_dev->bp_caps&WD_CTL_CAP)&& (pbpctl_dev->wdt_status!=WDT_STATUS_UNKNOWN)) { if (pbpctl_dev->wdt_status==WDT_STATUS_DIS) return 0; if (pbpctl_dev->bp_ext_ver>=PXG2BPI_VER) - /* ret= */ wdt_pulse(pbpctl_dev); + ret= wdt_pulse(pbpctl_dev); else if (INTEL_IF_SERIES(pbpctl_dev->subdevice)) - /* ret= */ wdt_pulse_int(pbpctl_dev); - else /* ret= */ send_wdt_pulse(pbpctl_dev); + ret=wdt_pulse_int(pbpctl_dev); + else ret=send_wdt_pulse(pbpctl_dev); //if (ret==-1) // mod_timer(&pbpctl_dev->bp_timer, jiffies+1); return 1; @@ -2918,6 +2914,7 @@ static int tx_status (bpctl_dev_t *pbpctl_dev){ } if (pbpctl_dev->bp_10g9) { + return((BP10G_READ_REG(pbpctl_dev,ESDP)&BP10G_SDP3_DATA)!=0?0:1); } else if (pbpctl_dev->bp_fiber5) { @@ -3687,6 +3684,8 @@ void bypass_caps_init (bpctl_dev_t *pbpctl_dev){ } if ((pbpctl_dev->subdevice&0xfe0)==0xb40) pbpctl_dev->bp_caps&= ~TPL_CAP; + if (pbpctl_dev->bp_10g9) + pbpctl_dev->bp_caps&= ~TPL_CAP; if (INTEL_IF_SERIES(pbpctl_dev->subdevice)) { pbpctl_dev->bp_caps|=(BP_CAP | BP_STATUS_CAP | SW_CTL_CAP | @@ -3726,6 +3725,9 @@ void bypass_caps_init (bpctl_dev_t *pbpctl_dev){ } } } + if (pbpctl_dev->bp_ext_ver>=0x9) + pbpctl_dev->bp_caps&= ~TPL_CAP; + if (pbpctl_dev->bp_ext_ver==PXG2BPI_VER) pbpctl_dev->bp_caps|=(BP_CAP|BP_STATUS_CAP|BP_STATUS_CHANGE_CAP|SW_CTL_CAP|BP_DIS_CAP|BP_DIS_STATUS_CAP| @@ -3765,7 +3767,7 @@ void bypass_caps_init (bpctl_dev_t *pbpctl_dev){ pbpctl_dev->bp_caps_ex|=TPL2_CAP_EX; pbpctl_dev->bp_caps|=TPL_CAP; pbpctl_dev->bp_tpl_flag=tpl2_flag_status(pbpctl_dev); - } + } } @@ -4642,20 +4644,26 @@ static void bp_tpl_timer_fn(unsigned long param){ mod_timer(&pbpctl_dev->bp_tpl_timer, jiffies+BP_LINK_MON_DELAY*HZ); } - +int get_tpl_fn(bpctl_dev_t *pbpctl_dev); void remove_bypass_tpl_auto(bpctl_dev_t *pbpctl_dev){ bpctl_dev_t *pbpctl_dev_b=NULL; if (!pbpctl_dev) return; + if (pbpctl_dev->bp_caps_ex&TPL2_CAP_EX) + return; + pbpctl_dev_b=get_status_port_fn(pbpctl_dev); if (pbpctl_dev->bp_caps&TPL_CAP) { - del_timer_sync(&pbpctl_dev->bp_tpl_timer); - pbpctl_dev->bp_tpl_flag=0; - pbpctl_dev_b=get_status_port_fn(pbpctl_dev); - if (pbpctl_dev_b) - set_tx(pbpctl_dev_b,1); - set_tx(pbpctl_dev,1); + if (get_tpl_fn(pbpctl_dev)) { + + del_timer_sync(&pbpctl_dev->bp_tpl_timer); + pbpctl_dev->bp_tpl_flag=0; + pbpctl_dev_b=get_status_port_fn(pbpctl_dev); + if (pbpctl_dev_b) + set_tx(pbpctl_dev_b,1); + set_tx(pbpctl_dev,1); + } } return; } @@ -4838,33 +4846,7 @@ int get_dev_idx_bsf(int bus, int slot, int func){ -static void str_low(char *str){ - int i; - for (i=0;i=65)&&(str[i]<=90)) - str[i]+=32; -} - -static unsigned long str_to_hex(char *p) { - unsigned long hex = 0; - unsigned long length = strlen(p), shift = 0; - unsigned char dig = 0; - - str_low(p); - length = strlen(p); - - if (length == 0 ) - return 0; - - do { - dig = p[--length]; - dig = dig<'a' ? (dig - '0') : (dig - 'a' + 0xa); - hex |= (dig<= 0x020618) - for_each_netdev(&init_net, dev) + for_each_netdev(&init_net, dev) #elif (LINUX_VERSION_CODE >= 0x20616) - for_each_netdev(dev) + for_each_netdev(dev) #else - for (dev = dev_base; dev; dev = dev->next) -#endif - { + for (dev = dev_base; dev; dev = dev->next) +#endif + { + int idx_dev; - struct ethtool_drvinfo drvinfo; - // char *str=NULL; - char cbuf[32]; - char *buf=NULL; - char res[10]; - int i=0, j=0; - int bus=0,slot=0,func=0; - ifindex=dev->ifindex; + if (bp_get_dev_idx_bsf(dev, &idx_dev)) + continue; + if (idx_dev == -1) + continue; - - memset(res,0,10); - memset(&drvinfo,0,sizeof(struct ethtool_drvinfo)); - - if (dev->ethtool_ops && dev->ethtool_ops->get_drvinfo) { - memset(&drvinfo, 0, sizeof(drvinfo)); - dev->ethtool_ops->get_drvinfo(dev, &drvinfo); - } else - continue; - if (!drvinfo.bus_info) - continue; - - memcpy(&cbuf,drvinfo.bus_info,32); - buf= &cbuf[0]; - - // while(*buf++){ - - /*if(*buf==':'){ - buf++; - break; - } */ - //} - - - for (j=0;j<32;j++) - if (buf[j]==':') - break; - if (++j>=32) { - continue; - } - for (i=0;i<10;i++,j++) { - if (j>=32) - break; - if (buf[j]==':') - break; - res[i]=buf[j]; - - } - if (++j>=32) { - continue; - } - - bus= str_to_hex(res); - memset(res,0,10); - - for (i=0;i<10;i++,j++) { - if (j>=32) - break; - - if (buf[j]=='.') - break; - res[i]=buf[j]; - - } - if (++j>=32) { - continue; - } - - slot= str_to_hex(res); - func= str_to_hex(&buf[j]); - idx_dev=get_dev_idx_bsf(bus, slot, func) ; - - - - if (idx_dev!=-1) { - - bpctl_dev_arr[idx_dev].ifindex=ifindex; - bpctl_dev_arr[idx_dev].ndev=dev; - - } - - } -#endif - //rtnl_unlock(); - //rcu_read_unlock(); - + bpctl_dev_arr[idx_dev].ifindex = dev->ifindex; + bpctl_dev_arr[idx_dev].ndev = dev; + } + /* rtnl_unlock(); */ + /* rcu_read_unlock(); */ } -#define REDBORDER_PATCH -#ifndef REDBORDER_PATCH + + + #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) static int device_ioctl(struct inode *inode, /* see include/linux/fs.h */ struct file *file, /* ditto */ @@ -5009,11 +4917,6 @@ static long device_ioctl(struct file *file, /* ditto */ unsigned long ioctl_param) #endif -#else -static int device_call_or_ioctl(unsigned int ioctl_num, - void *ioctl_param, - int kernel_ioctl /* boolean: 0 standard ioctl, 1 - kernel call */) -#endif { struct bpctl_cmd bpctl_cmd; int dev_idx=0; @@ -5046,12 +4949,6 @@ static int device_call_or_ioctl(unsigned int ioctl_num, ret=SUCCESS; goto bp_exit; } - -#ifdef REDBORDER_PATCH - if (kernel_ioctl) { - memcpy(&bpctl_cmd, argp, sizeof(struct bpctl_cmd)); - } else -#endif if (copy_from_user(&bpctl_cmd, argp, sizeof(struct bpctl_cmd))) { ret= -EFAULT; @@ -5060,11 +4957,6 @@ static int device_call_or_ioctl(unsigned int ioctl_num, if (ioctl_num==IOCTL_TX_MSG(GET_DEV_NUM)) { bpctl_cmd.out_param[0]= device_num; -#ifdef REDBORDER_PATCH - if (kernel_ioctl) { - memcpy(argp, &bpctl_cmd, sizeof(struct bpctl_cmd)); - } else -#endif if (copy_to_user(argp,(void *)&bpctl_cmd,sizeof(struct bpctl_cmd))) { ret=-EFAULT; goto bp_exit; @@ -5252,11 +5144,6 @@ static int device_call_or_ioctl(unsigned int ioctl_num, /*preempt_enable();*/ //rcu_read_unlock(); spin_unlock_irqrestore(&bpvm_lock, flags); -#ifdef REDBORDER_PATCH - if (kernel_ioctl) { - memcpy(argp, &bpctl_cmd, sizeof(struct bpctl_cmd)); - } else -#endif if (copy_to_user(argp, (void *)&bpctl_cmd, sizeof(struct bpctl_cmd))) { //unlock_bpctl(); //preempt_enable(); @@ -5395,11 +5282,6 @@ static int device_call_or_ioctl(unsigned int ioctl_num, bpcmd_exit: //rcu_read_unlock(); spin_unlock_irqrestore(&bpvm_lock, flags); -#ifdef REDBORDER_PATCH - if (kernel_ioctl) { - memcpy(argp, &bpctl_cmd, sizeof(struct bpctl_cmd)); - } else -#endif if (copy_to_user(argp, (void *)&bpctl_cmd, sizeof(struct bpctl_cmd))) ret= -EFAULT; ret= SUCCESS; @@ -5413,28 +5295,6 @@ static int device_call_or_ioctl(unsigned int ioctl_num, return ret; } -#ifdef REDBORDER_PATCH -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) -static int device_ioctl(struct inode *inode, /* see include/linux/fs.h */ - struct file *file, /* ditto */ - unsigned int ioctl_num, /* number and param for ioctl */ - unsigned long ioctl_param) -#else -static long device_ioctl(struct file *file, /* ditto */ - unsigned int ioctl_num, /* number and param for ioctl */ - unsigned long ioctl_param) -#endif - { - return device_call_or_ioctl(ioctl_num, (void *) ioctl_param, 0); -} - -int bpctl_kernel_ioctl(unsigned int ioctl_num, - void *ioctl_param) { - //printk("[BPCTL] set bypass request via kernel hook\n"); - return device_call_or_ioctl(ioctl_num, ioctl_param, 1); -} -EXPORT_SYMBOL(bpctl_kernel_ioctl); -#endif struct file_operations Fops = { .owner = THIS_MODULE, @@ -5532,7 +5392,10 @@ typedef enum { PEG2BPFI6, PEG2BPFI6LX, PEG2BPFI6ZX, + PEG2BPFI6FLXM, + PEG2BPFI6FLXMRB2, + PEG4BPI6FC, PEG4BPFI6FC, PEG4BPFI6FCLX, @@ -5565,7 +5428,13 @@ typedef enum { PE210G2BPI9CX4, PE210G2BPI9SR, PE210G2BPI9LR, + PE210G2BPI9SRD, + PE210G2BPI9LRD, PE210G2BPI9T, + M1E210G2BPI9SRDJP, + M1E210G2BPI9SRDJP1, + M1E210G2BPI9LRDJP, + M1E210G2BPI9LRDJP1, M2EG2BPFI6, M2EG2BPFI6LX, M2EG2BPFI6ZX, @@ -5588,12 +5457,18 @@ typedef enum { PE2G2BPi35, PAC1200BPi35, PE2G2BPFi35, + PE2G2BPFi35ARB2, PE2G2BPFi35LX, + PE2G2BPFi35ALXRB2, PE2G2BPFi35ZX, PE2G4BPi35, PE2G4BPi35L, + PE2G4BPi35ALRB2, PE2G4BPFi35, + PE2G4BPFi35ARB2, + PE2G4BPFi35CS, PE2G4BPFi35LX, + PE2G4BPFi35ALXRB2, PE2G4BPFi35ZX, PE2G6BPi35, @@ -5610,15 +5485,29 @@ typedef enum { M2E10G2BPI9LR, M2E10G2BPI9T, M6E2G8BPi80, - PE210G2DBi9SR, - PE210G2DBi9SRRB, - PE210G2DBi9LR, - PE210G2DBi9LRRB, + PE210G2DBi9SR, + PE210G2DBi9SRRB2, + + PE210G2DBi9LR, + + PE210G2DBi9LRRB2, PE310G4DBi940SR, + PE310G4DBi940SRRB2, + + PE310G4DBi940LR, + PE310G4DBi940LRRB2, + + PE310G4DBi940T, + PE310G4DBi940TRB2, + PE310G4BPi9T, PE310G4BPi9SR, PE310G4BPi9LR, + PE310G4BPi9SRD, + PE310G4BPi9LRD, + PE210G2BPi40, + PE310G4BPi40, M1E210G2BPI40T, M6E310G4BPi9SR, M6E310G4BPi9LR, @@ -5726,7 +5615,11 @@ dev_desc_t dev_desc[]={ {"Silicom Bypass PEG2BPFI6 series adapter"}, {"Silicom Bypass PEG2BPFI6LX series adapter"}, {"Silicom Bypass PEG2BPFI6ZX series adapter"}, + {"Silicom Bypass PEG2BPFI6FLXM series adapter"}, + {"Silicom Bypass PEG2BPFI6FLXMRB2 series adapter"}, + + {"Silicom Bypass PEG4BPI6FC series adapter"}, {"Silicom Bypass PEG4BPFI6FC series adapter"}, {"Silicom Bypass PEG4BPFI6FCLX series adapter"}, @@ -5765,7 +5658,14 @@ dev_desc_t dev_desc[]={ {"Silicom Bypass PE210G2BPI9CX4 series adapter"}, {"Silicom Bypass PE210G2BPI9SR series adapter"}, {"Silicom Bypass PE210G2BPI9LR series adapter"}, + {"Silicom Bypass PE210G2BPI9SRD series adapter"}, + {"Silicom Bypass PE210G2BPI9LRD series adapter"}, + {"Silicom Bypass PE210G2BPI9T series adapter"}, + {"Silicom Bypass M1E210G2BPI9SRDJP series adapter"}, + {"Silicom Bypass M1E210G2BPI9SRDJP1 series adapter"}, + {"Silicom Bypass M1E210G2BPI9LRDJP series adapter"}, + {"Silicom Bypass M1E210G2BPI9LRDJP1 series adapter"}, {"Silicom Bypass M2EG2BPFI6 series adapter"}, {"Silicom Bypass M2EG2BPFI6LX series adapter"}, @@ -5798,15 +5698,21 @@ dev_desc_t dev_desc[]={ {"Silicom Bypass PE2G2BPi35 series adapter"}, {"Silicom Bypass PAC1200BPi35 series adapter"}, {"Silicom Bypass PE2G2BPFi35 series adapter"}, + {"Silicom Bypass PE2G2BPFi35ARB2 series adapter"}, {"Silicom Bypass PE2G2BPFi35LX series adapter"}, + {"Silicom Bypass PE2G2BPFi35ALXRB2 series adapter"}, {"Silicom Bypass PE2G2BPFi35ZX series adapter"}, {"Silicom Bypass PE2G4BPi35 series adapter"}, {"Silicom Bypass PE2G4BPi35L series adapter"}, + {"Silicom Bypass PE2G4BPi35ALRB2 series adapter"}, {"Silicom Bypass PE2G4BPFi35 series adapter"}, + {"Silicom Bypass PE2G4BPFi35ARB2 series adapter"}, + {"Silicom Bypass PE2G4BPFi35CS series adapter"}, {"Silicom Bypass PE2G4BPFi35LX series adapter"}, + {"Silicom Bypass PE2G4BPFi35ALXRB2 series adapter"}, {"Silicom Bypass PE2G4BPFi35ZX series adapter"}, {"Silicom Bypass PE2G6BPi35 series adapter"}, @@ -5825,14 +5731,19 @@ dev_desc_t dev_desc[]={ {"Silicom Bypass M2E10G2BPI9T series adapter"}, {"Silicom Bypass MxE2G8BPi80 series adapter"}, {"Silicom Bypass PE210G2DBi9SR series adapter"}, - {"Silicom Bypass PE210G2DBi9SRRB series adapter"}, + {"Silicom Bypass PE210G2DBi9SRRB2 series adapter"}, {"Silicom Bypass PE210G2DBi9LR series adapter"}, - {"Silicom Bypass PE210G2DBi9LRRB series adapter"}, + {"Silicom Bypass PE210G2DBi9LRRB2 series adapter"}, {"Silicom Bypass PE310G4DBi9-SR series adapter"}, + {"Silicom Bypass PE310G4DBi9-SRRB2 series adapter"}, {"Silicom Bypass PE310G4BPi9T series adapter"}, {"Silicom Bypass PE310G4BPi9SR series adapter"}, {"Silicom Bypass PE310G4BPi9LR series adapter"}, + {"Silicom Bypass PE310G4BPi9SRD series adapter"}, + {"Silicom Bypass PE310G4BPi9LRD series adapter"}, + {"Silicom Bypass PE210G2BPi40T series adapter"}, + {"Silicom Bypass PE310G4BPi40T series adapter"}, {"Silicom Bypass M1E210G2BPI40T series adapter"}, {"Silicom Bypass M6E310G4BPi9SR series adapter"}, {"Silicom Bypass M6E310G4BPi9LR series adapter"}, @@ -5927,7 +5838,11 @@ static bpmod_info_t tx_ctl_pci_tbl[] = { {0x8086, 0x10e6, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PEG2BPFI6_SSID /*PCI_ANY_ID*/, PEG2BPFI6, "PEG2BPFI6"}, {0x8086, 0x10e6, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PEG2BPFI6LX_SSID /*PCI_ANY_ID*/, PEG2BPFI6LX, "PEG2BPFI6LX"}, {0x8086, 0x10e6, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PEG2BPFI6ZX_SSID /*PCI_ANY_ID*/, PEG2BPFI6ZX, "PEG2BPFI6ZX"}, + {0x8086, 0x10e7, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PEG2BPFI6FLXM_SSID /*PCI_ANY_ID*/, PEG2BPFI6FLXM, "PEG2BPFI6FLXM"}, + {0x8086, 0x10e7, 0x1b2e /*PCI_ANY_ID*/, SILICOM_PEG2BPFI6FLXM_SSID /*PCI_ANY_ID*/, PEG2BPFI6FLXMRB2, "PEG2BPFI6FLXMRB2"}, + + {0x8086, 0x10c9, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PEG4BPI6FC_SSID /*PCI_ANY_ID*/, PEG4BPI6FC, "PEG4BPI6FC"}, {0x8086, 0x10e6, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PEG4BPFI6FC_SSID /*PCI_ANY_ID*/, PEG4BPFI6FC, "PEG4BPFI6FC"}, {0x8086, 0x10e6, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PEG4BPFI6FCLX_SSID /*PCI_ANY_ID*/, PEG4BPFI6FCLX, "PEG4BPFI6FCLX"}, @@ -5986,11 +5901,26 @@ static bpmod_info_t tx_ctl_pci_tbl[] = { {0x8086, 0x10e6, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PEG2DBFI6LX_SSID /*PCI_ANY_ID*/, PEG2DBFI6LX, "PEG2DBFI6LX"}, {0x8086, 0x10e6, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PEG2DBFI6ZX_SSID /*PCI_ANY_ID*/, PEG2DBFI6ZX, "PEG2DBFI6ZX"}, - {0x8086, 0x10F9, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE210G2DBi9SR_SSID, PE210G2DBi9SR, "PE210G2DBi9SR"}, - //{0x8086, 0x10F9, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE210G2DBi9SRRB_SSID , PE210G2DBi9SRRB, "PE210G2DBi9SRRB"}, + {0x8086, 0x10F9, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE210G2DBi9SR_SSID, PE210G2DBi9SR, "PE210G2DBi9SR"}, + + + + {0x8086, 0x10F9, 0X1B2E /*PCI_ANY_ID*/, SILICOM_PE210G2DBi9SRRB_SSID , PE210G2DBi9SRRB2, "PE210G2DBi9SRRB2"}, {0x8086, 0x10F9, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE210G2DBi9LR_SSID , PE210G2DBi9LR, "PE210G2DBi9LR"}, - // {0x8086, 0x10F9, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE210G2DBi9LRRB_SSID , PE210G2DBi9LRRB, "PE210G2DBi9LRRB"}, + {0x8086, 0x10F9, 0X1B2E /*PCI_ANY_ID*/, SILICOM_PE210G2DBi9LRRB_SSID , PE210G2DBi9LRRB2, "PE210G2DBi9LRRB2"}, + {0x8086, 0x10F9, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE310G4DBi940SR_SSID , PE310G4DBi940SR, "PE310G4DBi9SR"}, + {0x8086, 0x10F9, 0X1B2E /*PCI_ANY_ID*/, SILICOM_PE310G4DBi940SR_SSID , PE310G4DBi940SRRB2, "PE310G4DBi9SRRB2"}, + + {0x8086, 0x10F9, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE310G4DBi940LR_SSID , PE310G4DBi940LR, "PE310G4DBi9LR"}, + {0x8086, 0x10F9, 0X1B2E /*PCI_ANY_ID*/, SILICOM_PE310G4DBi940LR_SSID , PE310G4DBi940LRRB2, "PE310G4DBi9LRRB2"}, + + {0x8086, 0x10F9, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE310G4DBi940T_SSID , PE310G4DBi940T, "PE310G4DBi9T"}, + {0x8086, 0x10F9, 0X1B2E /*PCI_ANY_ID*/, SILICOM_PE310G4DBi940T_SSID , PE310G4DBi940TRB2, "PE310G4DBi9TRB2"}, + + + + {0x8086, 0x10F9, SILICOM_SVID /*PCI_ANY_ID*/,SILICOM_PE310G4DBi9T_SSID , PE310G4DBi9T, "PE310G4DBi9T"}, @@ -5999,6 +5929,9 @@ static bpmod_info_t tx_ctl_pci_tbl[] = { {0x8086, 0x10Fb, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE310G4BPi9T_SSID, PE310G4BPi9T, "PE310G4BPi9T"}, {0x8086, 0x10Fb, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE310G4BPi9SR_SSID, PE310G4BPi9SR, "PE310G4BPi9SR"}, {0x8086, 0x10Fb, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE310G4BPi9LR_SSID, PE310G4BPi9LR, "PE310G4BPi9LR"}, + {0x8086, 0x10Fb, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE310G4BPi9SRD_SSID, PE310G4BPi9SRD, "PE310G4BPi9SRD"}, + {0x8086, 0x10Fb, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE310G4BPi9LRD_SSID, PE310G4BPi9LRD, "PE310G4BPi9LRD"}, + {0x8086, 0x10Fb, SILICOM_SVID, SILICOM_M6E310G4BPi9LR_SSID, M6E310G4BPi9LR, "M6E310G4BPi9LR"}, {0x8086, 0x10Fb, SILICOM_SVID, SILICOM_M6E310G4BPi9SR_SSID, M6E310G4BPi9SR, "M6E310G4BPi9SR"}, @@ -6021,16 +5954,33 @@ static bpmod_info_t tx_ctl_pci_tbl[] = { {0x8086, 0x1521, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PAC1200BPi35_SSID /*PCI_ANY_ID*/, PAC1200BPi35, "PAC1200BPi35"}, {0x8086, 0x1522, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE2G2BPFi35_SSID /*PCI_ANY_ID*/, PE2G2BPFi35, "PE2G2BPFi35"}, + {0x8086, 0x1522, 0x1B2E /*PCI_ANY_ID*/, SILICOM_PE2G2BPFi35_SSID /*PCI_ANY_ID*/, PE2G2BPFi35ARB2, "PE2G2BPFi35ARB2"}, + {0x8086, 0x1522, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE2G2BPFi35LX_SSID /*PCI_ANY_ID*/, PE2G2BPFi35LX, "PE2G2BPFi35LX"}, + {0x8086, 0x1522, 0x1B2E /*PCI_ANY_ID*/, SILICOM_PE2G2BPFi35LX_SSID /*PCI_ANY_ID*/, PE2G2BPFi35ALXRB2, "PE2G2BPFi35ALXRB2"}, + + {0x8086, 0x1522, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE2G2BPFi35ZX_SSID /*PCI_ANY_ID*/, PE2G2BPFi35ZX, "PE2G2BPFi35ZX"}, {0x8086, 0x1521, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE2G4BPi35_SSID /*PCI_ANY_ID*/, PE2G4BPi35, "PE2G4BPi35"}, + {0x8086, 0x1521, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE2G4BPi35L_SSID /*PCI_ANY_ID*/, PE2G4BPi35L, "PE2G4BPi35L"}, + {0x8086, 0x1521, 0x1B2E /*PCI_ANY_ID*/, SILICOM_PE2G4BPi35L_SSID /*PCI_ANY_ID*/, PE2G4BPi35ALRB2, "PE2G4BPi35ALRB2"}, {0x8086, 0x1522, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE2G4BPFi35_SSID /*PCI_ANY_ID*/, PE2G4BPFi35, "PE2G4BPFi35"}, + {0x8086, 0x1522, 0x1B2E /*PCI_ANY_ID*/, SILICOM_PE2G4BPFi35_SSID /*PCI_ANY_ID*/, PE2G4BPFi35ARB2, "PE2G4BPFi35ARB2"}, + + + + + {0x8086, 0x1522, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE2G4BPFi35CS_SSID /*PCI_ANY_ID*/, PE2G4BPFi35CS, "PE2G4BPFi35CS"}, + {0x8086, 0x1522, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE2G4BPFi35LX_SSID /*PCI_ANY_ID*/, PE2G4BPFi35LX, "PE2G4BPFi35LX"}, + {0x8086, 0x1522, 0x1B2E /*PCI_ANY_ID*/, SILICOM_PE2G4BPFi35LX_SSID /*PCI_ANY_ID*/, PE2G4BPFi35ALXRB2, "PE2G4BPFi35ALXRB2"}, + + {0x8086, 0x1522, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE2G4BPFi35ZX_SSID /*PCI_ANY_ID*/, PE2G4BPFi35ZX, "PE2G4BPFi35ZX"}, @@ -6180,8 +6130,17 @@ static bpmod_info_t tx_ctl_pci_tbl[] = { {0x8086, 0x10fb, SILICOM_SVID, SILICOM_PE210G2BPI9CX4_SSID, PE210G2BPI9CX4, "PE210G2BPI9CX4"}, {0x8086, 0x10fb, SILICOM_SVID, SILICOM_PE210G2BPI9SR_SSID, PE210G2BPI9SR, "PE210G2BPI9SR"}, {0x8086, 0x10fb, SILICOM_SVID, SILICOM_PE210G2BPI9LR_SSID, PE210G2BPI9LR, "PE210G2BPI9LR"}, + {0x8086, 0x10fb, SILICOM_SVID, SILICOM_PE210G2BPI9SRD_SSID, PE210G2BPI9SRD, "PE210G2BPI9SRD"}, + {0x8086, 0x10fb, SILICOM_SVID, SILICOM_PE210G2BPI9LRD_SSID, PE210G2BPI9LRD, "PE210G2BPI9LRD"}, {0x8086, 0x10fb, SILICOM_SVID, SILICOM_PE210G2BPI9T_SSID, PE210G2BPI9T, "PE210G2BPI9T"}, + {0x8086, 0x10fb, SILICOM_SVID, SILICOM_PE210G2BPI9T_SSID, PE210G2BPI9T, "PE210G2BPI9T"}, + {0x8086, 0x10fb, 0x1304, SILICOM_M1E210G2BPI9SRDJP_SSID, M1E210G2BPI9SRDJP, "M1E210G2BPI9SRDJP"}, + {0x8086, 0x10fb, 0x1304, SILICOM_M1E210G2BPI9SRDJP1_SSID, M1E210G2BPI9SRDJP1, "M1E210G2BPI9SRDJP1"}, + {0x8086, 0x10fb, 0x1304, SILICOM_M1E210G2BPI9LRDJP_SSID, M1E210G2BPI9LRDJP, "M1E210G2BPI9LRDJP"}, + {0x8086, 0x10fb, 0x1304, SILICOM_M1E210G2BPI9LRDJP1_SSID, M1E210G2BPI9LRDJP1, "M1E210G2BPI9LRDJP1"}, + + @@ -6206,6 +6165,8 @@ static bpmod_info_t tx_ctl_pci_tbl[] = { #endif {0x8086, 0x10C9, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_M6E2G8BPi80_SSID /*PCI_ANY_ID*/, M6E2G8BPi80, "MxE2G8BPi80"}, {0x8086, 0x1528, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE210G2BPi40_SSID /*PCI_ANY_ID*/, PE210G2BPi40, "PE210G2BPi40T"}, + {0x8086, 0x1528, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_PE310G4BPi40_SSID /*PCI_ANY_ID*/, PE310G4BPi40, "PE310G4BPi40T"}, + {0x8086, 0x1528, SILICOM_SVID /*PCI_ANY_ID*/, SILICOM_M1E210G2BPI40T_SSID /*PCI_ANY_ID*/, M1E210G2BPI40T, "M1E210G2BPi40T"}, @@ -6244,7 +6205,7 @@ static int __init bypass_init_module(void) if (!device_num) { printk("No such device\n"); unregister_chrdev(major_num, DEVICE_NAME); - return +1; + return -1; } @@ -6264,11 +6225,14 @@ static int __init bypass_init_module(void) tx_ctl_pci_tbl[idx].subvendor, tx_ctl_pci_tbl[idx].subdevice, pdev1))) { - bpctl_dev_arr[idx_dev].pdev=pdev1; + mmio_start = pci_resource_start (pdev1, 0); - mmio_len = pci_resource_len (pdev1, 0); + mmio_len = pci_resource_len (pdev1, 0); + if((!mmio_len)||(!mmio_start)) + continue; + bpctl_dev_arr[idx_dev].pdev=pdev1; bpctl_dev_arr[idx_dev].desc=dev_desc[tx_ctl_pci_tbl[idx].index].name; bpctl_dev_arr[idx_dev].name=tx_ctl_pci_tbl[idx].bp_name; @@ -6284,6 +6248,7 @@ static int __init bypass_init_module(void) #ifdef BP_SYNC_FLAG spin_lock_init(&bpctl_dev_arr[idx_dev].bypass_wr_lock); #endif + if (BP10G9_IF_SERIES(bpctl_dev_arr[idx_dev].subdevice)) bpctl_dev_arr[idx_dev].bp_10g9=1; if (BP10G_IF_SERIES(bpctl_dev_arr[idx_dev].subdevice)) @@ -6359,6 +6324,8 @@ static int __init bypass_init_module(void) atomic_set(&bpctl_dev_arr[idx_dev].wdt_busy,0); bpctl_dev_arr[idx_dev].bp_status_un=1; + + bypass_caps_init(&bpctl_dev_arr[idx_dev]); init_bypass_wd_auto(&bpctl_dev_arr[idx_dev]); @@ -6398,10 +6365,11 @@ static int __init bypass_init_module(void) spin_lock_init(&bpvm_lock); { - /* bpctl_dev_t *pbpctl_dev_c=NULL ; */ + bpctl_dev_t *pbpctl_dev_c=NULL ; for (idx_dev = 0; ((bpctl_dev_arr[idx_dev].pdev!=NULL)&&(idx_devsubdir; pde; pde = pde->next) { if (pde->namelen && (strcmp(name, pde->name) == 0)) { @@ -6958,7 +6927,9 @@ proc_getdir(char *name, struct proc_dir_entry *proc_dir) { break; } } - if (pde == (struct proc_dir_entry *) 0) { + if (pde == (struct proc_dir_entry *) 0) +#endif + { /* create the directory */ #if (LINUX_VERSION_CODE > 0x20300) pde = proc_mkdir(name, proc_dir); @@ -6993,6 +6964,7 @@ int bp_proc_create(void) + #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) ) int bypass_proc_create_entry_sd(struct pfs_unit_sd *pfs_unit_curr, @@ -7021,6 +6993,9 @@ bypass_proc_create_entry_sd(struct pfs_unit_sd *pfs_unit_curr, } + #endif + + int get_bypass_info_pfs (char *page, char **start, off_t off, int count, @@ -7040,49 +7015,27 @@ get_bypass_info_pfs (char *page, char **start, off_t off, int count, int get_bypass_slave_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; +{ + bpctl_dev_t * dev= (bpctl_dev_t *) data; int len=0; - bpctl_dev_t *pbp_device_block_slave=NULL; - int idx_dev=0; - struct net_device *net_slave_dev=NULL; - - if ((pbp_device_block->func==0)||(pbp_device_block->func==2)) { - for (idx_dev = 0; ((bpctl_dev_arr[idx_dev].pdev!=NULL)&&(idx_devbus)&& - (bpctl_dev_arr[idx_dev].slot==pbp_device_block->slot)) { - if ((pbp_device_block->func==0)&& - (bpctl_dev_arr[idx_dev].func==1)) { - pbp_device_block_slave=&bpctl_dev_arr[idx_dev]; - break; - } - if ((pbp_device_block->func==2)&& - (bpctl_dev_arr[idx_dev].func==3)) { - pbp_device_block_slave=&bpctl_dev_arr[idx_dev]; - break; - } - } - } - } else pbp_device_block_slave= pbp_device_block; - if (!pbp_device_block_slave) { - len=sprintf(page, "fail\n"); - *eof = 1; - return len; - } - net_slave_dev= pbp_device_block_slave->ndev; - if (net_slave_dev) { - if (net_slave_dev) - len = sprintf(page, "%s\n", net_slave_dev->name); + bpctl_dev_t *slave = get_status_port_fn(dev); + if (!slave) + slave = dev; + if (slave) { + if (slave->ndev) + len = sprintf(page, "%s\n", slave->ndev->name); else - len=sprintf(page, "fail\n"); - + len=sprintf(page, "fail\n"); } *eof = 1; return len; -} + +} + + int get_bypass_caps_pfs (char *page, char **start, off_t off, int count, @@ -7103,6 +7056,8 @@ get_bypass_caps_pfs (char *page, char **start, off_t off, int count, } + + int get_wd_set_caps_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7121,6 +7076,7 @@ get_wd_set_caps_pfs (char *page, char **start, off_t off, int count, } + int set_bypass_pfs(struct file *file, const char *buffer, unsigned long count, void *data) @@ -7155,6 +7111,7 @@ set_bypass_pfs(struct file *file, const char *buffer, return count; } + int set_tap_pfs(struct file *file, const char *buffer, unsigned long count, void *data) @@ -7187,6 +7144,8 @@ set_tap_pfs(struct file *file, const char *buffer, return count; } + + int set_disc_pfs(struct file *file, const char *buffer, unsigned long count, void *data) @@ -7221,6 +7180,7 @@ set_disc_pfs(struct file *file, const char *buffer, + int get_bypass_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7302,6 +7262,8 @@ get_bypass_change_pfs (char *page, char **start, off_t off, int count, } + + int get_tap_change_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7321,6 +7283,8 @@ get_tap_change_pfs (char *page, char **start, off_t off, int count, return len; } + + int get_disc_change_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7340,7 +7304,10 @@ get_disc_change_pfs (char *page, char **start, off_t off, int count, return len; } -#define isdigit(c) (c >= '0' && c <= '9') + + + + #define isdigit(c) (c >= '0' && c <= '9') __inline static int atoi( char **s) { int i = 0; @@ -7397,6 +7364,8 @@ get_bypass_wd_pfs (char *page, char **start, off_t off, int count, } + + int get_wd_expire_time_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7419,6 +7388,8 @@ get_wd_expire_time_pfs (char *page, char **start, off_t off, int count, return len; } + + int get_tpl_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7439,7 +7410,9 @@ get_tpl_pfs (char *page, char **start, off_t off, int count, return len; } -#ifdef PMC_FIX_FLAG + + + #ifdef PMC_FIX_FLAG int get_wait_at_pwup_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7460,6 +7433,8 @@ get_wait_at_pwup_pfs (char *page, char **start, off_t off, int count, return len; } + + int get_hw_reset_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7480,7 +7455,10 @@ get_hw_reset_pfs (char *page, char **start, off_t off, int count, return len; } -#endif /*PMC_WAIT_FLAG*/ + + + + #endif /*PMC_WAIT_FLAG*/ int @@ -7503,6 +7481,8 @@ reset_bypass_wd_pfs (char *page, char **start, off_t off, int count, return len; } + + int set_dis_bypass_pfs(struct file *file, const char *buffer, unsigned long count, void *data) @@ -7533,6 +7513,8 @@ set_dis_bypass_pfs(struct file *file, const char *buffer, return count; } + + int set_dis_tap_pfs(struct file *file, const char *buffer, unsigned long count, void *data) @@ -7563,6 +7545,8 @@ set_dis_tap_pfs(struct file *file, const char *buffer, return count; } + + int set_dis_disc_pfs(struct file *file, const char *buffer, unsigned long count, void *data) @@ -7594,6 +7578,8 @@ set_dis_disc_pfs(struct file *file, const char *buffer, } + + int get_dis_bypass_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7684,6 +7670,7 @@ set_bypass_pwup_pfs(struct file *file, const char *buffer, return count; } + int set_bypass_pwoff_pfs(struct file *file, const char *buffer, unsigned long count, void *data) @@ -7714,6 +7701,8 @@ set_bypass_pwoff_pfs(struct file *file, const char *buffer, } + + int set_tap_pwup_pfs(struct file *file, const char *buffer, unsigned long count, void *data) @@ -7742,6 +7731,9 @@ set_tap_pwup_pfs(struct file *file, const char *buffer, return count; } + + + int set_disc_pwup_pfs(struct file *file, const char *buffer, unsigned long count, void *data) @@ -7772,6 +7764,7 @@ set_disc_pwup_pfs(struct file *file, const char *buffer, } + int get_bypass_pwup_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7792,6 +7785,8 @@ get_bypass_pwup_pfs (char *page, char **start, off_t off, int count, return len; } + + int get_bypass_pwoff_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7906,6 +7901,8 @@ get_std_nic_pfs (char *page, char **start, off_t off, int count, return len; } + + int get_wd_exp_mode_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -7965,6 +7962,8 @@ set_wd_exp_mode_pfs(struct file *file, const char *buffer, + + int get_wd_autoreset_pfs (char *page, char **start, off_t off, int count, int *eof, void *data) @@ -8005,6 +8004,7 @@ set_wd_autoreset_pfs(struct file *file, const char *buffer, return count; } + int set_tpl_pfs(struct file *file, const char *buffer, unsigned long count, void *data) @@ -8036,7 +8036,7 @@ set_tpl_pfs(struct file *file, const char *buffer, return count; } -#ifdef PMC_FIX_FLAG + #ifdef PMC_FIX_FLAG int set_wait_at_pwup_pfs(struct file *file, const char *buffer, unsigned long count, void *data) @@ -8101,16 +8101,647 @@ set_hw_reset_pfs(struct file *file, const char *buffer, return count; } -#endif /*PMC_FIX_FLAG*/ + #endif /*PMC_FIX_FLAG*/ + #if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) ) + +static int user_on_off(const void __user *buffer, size_t count) +{ + + char kbuf[256]; + int length = 0; + + if (count > (sizeof(kbuf) - 1)) + return -1; + + if (copy_from_user(&kbuf, buffer, count)) + return -1; + + kbuf[count] = '\0'; + length = strlen(kbuf); + if (kbuf[length - 1] == '\n') + kbuf[--length] = '\0'; + + if (strcmp(kbuf, "on") == 0) + return 1; + if (strcmp(kbuf, "off") == 0) + return 0; + return 0; +} + #define RO_FOPS(name) \ +static int name##_open(struct inode *inode, struct file *file) \ +{ \ + return single_open(file, show_##name, PDE_DATA(inode));\ +} \ +static const struct file_operations name##_ops = { \ + .open = name##_open, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .release = single_release, \ +}; + + #define RW_FOPS(name) \ +static int name##_open(struct inode *inode, struct file *file) \ +{ \ + return single_open(file, show_##name, PDE_DATA(inode));\ +} \ +static const struct file_operations name##_ops = { \ + .open = name##_open, \ + .read = seq_read, \ + .write = name##_write, \ + .llseek = seq_lseek, \ + .release = single_release, \ +}; + +static int show_bypass_info(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + + seq_printf(m, "Name\t\t\t%s\n", dev->name); + seq_printf(m, "Firmware version\t0x%x\n", dev->bp_fw_ver); + return 0; +} +RO_FOPS(bypass_info) + +static int show_bypass_slave(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + bpctl_dev_t *slave = get_status_port_fn(dev); + if (!slave) + slave = dev; + if (!slave) + seq_printf(m, "fail\n"); + else if (slave->ndev) + seq_printf(m, "%s\n", slave->ndev->name); + return 0; +} +RO_FOPS(bypass_slave) + +static int show_bypass_caps(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_bypass_caps_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "-1\n"); + else + seq_printf(m, "0x%x\n", ret); + return 0; +} +RO_FOPS(bypass_caps) + +static ssize_t std_nic_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int bypass_param = user_on_off(buffer, count); + if (bypass_param < 0) + return -EINVAL; + + set_std_nic_fn(PDE_DATA(file_inode(file)), bypass_param); + return count; +} +static int show_std_nic(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_std_nic_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + else + seq_printf(m, "on\n"); + return 0; +} +RW_FOPS(std_nic) + + +static ssize_t bypass_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int bypass_param = user_on_off(buffer, count); + if (bypass_param < 0) + return -1; + + set_bypass_fn(PDE_DATA(file_inode(file)), bypass_param); + return count; +} +static int show_bypass(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_bypass_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 1) + seq_printf(m, "on\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + return 0; +} +RW_FOPS(bypass) + +static ssize_t tap_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int tap_param = user_on_off(buffer, count); + if (tap_param < 0) + return -1; + + set_tap_fn(PDE_DATA(file_inode(file)), tap_param); + return count; +} +static int show_tap(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_tap_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 1) + seq_printf(m, "on\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + return 0; +} +RW_FOPS(tap) + + +static ssize_t disc_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int tap_param = user_on_off(buffer, count); + if (tap_param < 0) + return -1; + + set_disc_fn(PDE_DATA(file_inode(file)), tap_param); + return count; +} +static int show_disc(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_disc_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 1) + seq_printf(m, "on\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + return 0; +} +RW_FOPS(disc) + +static int show_bypass_change(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_bypass_change_fn(dev); + if (ret == 1) + seq_printf(m, "on\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + else + seq_printf(m, "fail\n"); + return 0; +} +RO_FOPS(bypass_change) + +static int show_tap_change(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_tap_change_fn(dev); + if (ret == 1) + seq_printf(m, "on\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + else + seq_printf(m, "fail\n"); + return 0; +} +RO_FOPS(tap_change) + + + +static int show_disc_change(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_disc_change_fn(dev); + if (ret == 1) + seq_printf(m, "on\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + else + seq_printf(m, "fail\n"); + return 0; +} +RO_FOPS(disc_change) + +static int show_tpl(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_tpl_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 1) + seq_printf(m, "on\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + return 0; +} +static ssize_t tpl_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + bpctl_dev_t *dev = PDE_DATA(file_inode(file)); + int tpl_param = user_on_off(buffer, count); + if (tpl_param < 0) + return -1; + + set_tpl_fn(dev, tpl_param); + return count; +} + +RW_FOPS(tpl) + +static ssize_t wait_at_pwup_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + bpctl_dev_t *dev = PDE_DATA(file_inode(file)); + int tpl_param = user_on_off(buffer, count); + if (tpl_param < 0) + return -1; + + set_bp_wait_at_pwup_fn(dev, tpl_param); + return count; +} +static int show_wait_at_pwup(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_bp_wait_at_pwup_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 1) + seq_printf(m, "on\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + return 0; +} +RW_FOPS(wait_at_pwup) + +static ssize_t hw_reset_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + bpctl_dev_t *dev = PDE_DATA(file_inode(file)); + int tpl_param = user_on_off(buffer, count); + if (tpl_param < 0) + return -1; + + set_bp_hw_reset_fn(dev, tpl_param); + return count; +} + + +static int show_hw_reset(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_bp_hw_reset_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 1) + seq_printf(m, "on\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + return 0; +} +RW_FOPS(hw_reset) + +static ssize_t dis_bypass_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int bypass_param = user_on_off(buffer, count); + if (bypass_param < 0) + return -EINVAL; + + set_dis_bypass_fn(PDE_DATA(file_inode(file)), bypass_param); + return count; +} +static int show_dis_bypass(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_dis_bypass_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + else + seq_printf(m, "on\n"); + return 0; +} +RW_FOPS(dis_bypass) + +static ssize_t dis_tap_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int tap_param = user_on_off(buffer, count); + if (tap_param < 0) + return -EINVAL; + + set_dis_tap_fn(PDE_DATA(file_inode(file)), tap_param); + return count; +} + +static int show_dis_tap(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_dis_tap_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + else + seq_printf(m, "on\n"); + return 0; +} +RW_FOPS(dis_tap) + +static ssize_t dis_disc_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int tap_param = user_on_off(buffer, count); + if (tap_param < 0) + return -EINVAL; + + set_dis_disc_fn(PDE_DATA(file_inode(file)), tap_param); + return count; +} +static int show_dis_disc(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_dis_disc_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + else + seq_printf(m, "on\n"); + return 0; +} +RW_FOPS(dis_disc) + +static ssize_t bypass_pwup_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int bypass_param = user_on_off(buffer, count); + if (bypass_param < 0) + return -EINVAL; + + set_bypass_pwup_fn(PDE_DATA(file_inode(file)), bypass_param); + return count; +} +static int show_bypass_pwup(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_bypass_pwup_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + else + seq_printf(m, "on\n"); + return 0; +} +RW_FOPS(bypass_pwup) + +static ssize_t bypass_pwoff_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int bypass_param = user_on_off(buffer, count); + if (bypass_param < 0) + return -EINVAL; + + set_bypass_pwoff_fn(PDE_DATA(file_inode(file)), bypass_param); + return count; +} +static int show_bypass_pwoff(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_bypass_pwoff_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + else + seq_printf(m, "on\n"); + return 0; +} +RW_FOPS(bypass_pwoff) + +static ssize_t tap_pwup_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int tap_param = user_on_off(buffer, count); + if (tap_param < 0) + return -EINVAL; + + set_tap_pwup_fn(PDE_DATA(file_inode(file)), tap_param); + return count; +} +static int show_tap_pwup(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_tap_pwup_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + else + seq_printf(m, "on\n"); + return 0; +} +RW_FOPS(tap_pwup) + +static ssize_t disc_pwup_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int tap_param = user_on_off(buffer, count); + if (tap_param < 0) + return -EINVAL; + + set_disc_pwup_fn(PDE_DATA(file_inode(file)), tap_param); + return count; +} +static int show_disc_pwup(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_disc_pwup_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 0) + seq_printf(m, "off\n"); + else + seq_printf(m, "on\n"); + return 0; +} +RW_FOPS(disc_pwup) + + +static int show_reset_bypass_wd(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = reset_bypass_wd_timer_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (ret == 0) + seq_printf(m, "disable\n"); + else if (ret == 1) + seq_printf(m, "success\n"); + return 0; +} +RO_FOPS(reset_bypass_wd) + + + + + + +static ssize_t bypass_wd_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + bpctl_dev_t *dev = PDE_DATA(file_inode(file)); + int timeout; + int ret = kstrtoint_from_user(buffer, count, 10, &timeout); + if (ret) + return ret; + set_bypass_wd_fn(dev, timeout); + return count; +} + +static int show_bypass_wd(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = 0, timeout = 0; + + ret = get_bypass_wd_fn(dev, &timeout); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (timeout == -1) + seq_printf(m, "unknown\n"); + else if (timeout == 0) + seq_printf(m, "disable\n"); + else + seq_printf(m, "%d\n", timeout); + return 0; +} +RW_FOPS(bypass_wd) + +static int show_wd_expire_time(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = 0, timeout = 0; + ret = get_wd_expire_time_fn(dev, &timeout); + if (ret == BP_NOT_CAP) + seq_printf(m, "fail\n"); + else if (timeout == -1) + seq_printf(m, "expire\n"); + else if (timeout == 0) + seq_printf(m, "disable\n"); + else + seq_printf(m, "%d\n", timeout); + return 0; +} +RO_FOPS(wd_expire_time) + + + +static ssize_t wd_exp_mode_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + char kbuf[256]; + int bypass_param = 0, length = 0; + + if (count > (sizeof(kbuf) - 1)) + return -1; + + if (copy_from_user(&kbuf, buffer, count)) + return -1; + + kbuf[count] = '\0'; + length = strlen(kbuf); + if (kbuf[length - 1] == '\n') + kbuf[--length] = '\0'; + + if (strcmp(kbuf, "tap") == 0) + bypass_param = 1; + else if (strcmp(kbuf, "bypass") == 0) + bypass_param = 0; + else if (strcmp(kbuf, "disc") == 0) + bypass_param = 2; + + set_wd_exp_mode_fn(PDE_DATA(file_inode(file)), bypass_param); + + return count; +} +static int show_wd_exp_mode(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_wd_exp_mode_fn(dev); + if (ret == 1) + seq_printf(m, "tap\n"); + else if (ret == 0) + seq_printf(m, "bypass\n"); + else if (ret == 2) + seq_printf(m, "disc\n"); + else + seq_printf(m, "fail\n"); + return 0; +} +RW_FOPS(wd_exp_mode) + +static int show_wd_set_caps(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_wd_set_caps_fn(dev); + if (ret == BP_NOT_CAP) + seq_printf(m, "-1\n"); + else + seq_printf(m, "0x%x\n", ret); + return 0; +} +RO_FOPS(wd_set_caps) + + + +static ssize_t wd_autoreset_write(struct file *file, const char __user *buffer, + size_t count, loff_t *pos) +{ + int timeout; + int ret = kstrtoint_from_user(buffer, count, 10, &timeout); + if (ret) + return ret; + set_wd_autoreset_fn(PDE_DATA(file_inode(file)), timeout); + return count; +} +static int show_wd_autoreset(struct seq_file *m, void *v) +{ + bpctl_dev_t *dev = m->private; + int ret = get_wd_autoreset_fn(dev); + if (ret >= 0) + seq_printf(m, "%d\n", ret); + else + seq_printf(m, "fail\n"); + return 0; +} +RW_FOPS(wd_autoreset) + #endif + + + + + #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) ) int bypass_proc_create_dev_sd(bpctl_dev_t * pbp_device_block){ struct bypass_pfs_sd *current_pfs = &(pbp_device_block->bypass_pfs_set); static struct proc_dir_entry *procfs_dir=NULL; int ret=0; + if (!pbp_device_block->ndev) return -1; + sprintf(current_pfs->dir_name,"bypass_%s",pbp_device_block->ndev->name); if (!bp_procfs_dir) @@ -8355,29 +8986,124 @@ int bypass_proc_create_dev_sd(bpctl_dev_t * pbp_device_block){ return ret; } + #else +static int procfs_add(char *proc_name, const struct file_operations *fops, + bpctl_dev_t *dev) +{ + struct bypass_pfs_sd *pfs = &dev->bypass_pfs_set; + if (!proc_create_data(proc_name, 0644, pfs->bypass_entry, fops, dev)) + return -1; + return 0; +} + +int bypass_proc_create_dev_sd(bpctl_dev_t *pbp_device_block) +{ + struct bypass_pfs_sd *current_pfs = &(pbp_device_block->bypass_pfs_set); + static struct proc_dir_entry *procfs_dir = NULL; + int ret = 0; + + if (!pbp_device_block->ndev) + return -1; + sprintf(current_pfs->dir_name, "bypass_%s", + pbp_device_block->ndev->name); + + if (!bp_procfs_dir) + return -1; + + /* create device proc dir */ + procfs_dir = proc_mkdir(current_pfs->dir_name, bp_procfs_dir); + if (!procfs_dir) { + printk(KERN_DEBUG "Could not create procfs directory %s\n", + current_pfs->dir_name); + return -1; + } + current_pfs->bypass_entry = procfs_dir; + +#define ENTRY(x) ret |= procfs_add(#x, &x##_ops, pbp_device_block) + ENTRY(bypass_info); + if (pbp_device_block->bp_caps & SW_CTL_CAP) { + /* Create set param proc's */ + ENTRY(bypass_slave); + ENTRY(bypass_caps); + ENTRY(wd_set_caps); + ENTRY(bypass_wd); + ENTRY(wd_expire_time); + ENTRY(reset_bypass_wd); + ENTRY(std_nic); + if (pbp_device_block->bp_caps & BP_CAP) { + ENTRY(bypass); + ENTRY(dis_bypass); + ENTRY(bypass_pwup); + ENTRY(bypass_pwoff); + ENTRY(bypass_change); + } + if (pbp_device_block->bp_caps & TAP_CAP) { + ENTRY(tap); + ENTRY(dis_tap); + ENTRY(tap_pwup); + ENTRY(tap_change); + } + if (pbp_device_block->bp_caps & DISC_CAP) { + ENTRY(disc); + ENTRY(dis_disc); + ENTRY(disc_pwup); + ENTRY(disc_change); + } + + ENTRY(wd_exp_mode); + ENTRY(wd_autoreset); + ENTRY(tpl); +#ifdef PMC_FIX_FLAG + ENTRY(wait_at_pwup); + ENTRY(hw_reset); +#endif + } +#undef ENTRY + if (ret < 0) + printk(KERN_DEBUG "Create proc entry failed\n"); + + return ret; +} + + #endif + #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) ) int bypass_proc_remove_dev_sd(bpctl_dev_t * pbp_device_block){ struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set; - struct proc_dir_entry *pde = current_pfs->bypass_entry /*, *pde_curr=NULL */; - char name[256]; - - + struct proc_dir_entry *pde = current_pfs->bypass_entry, *pde_curr=NULL; + char name[256]; if (!pde) return 0; for (pde=pde->subdir; pde; ) { strcpy(name,pde->name); - /* pde_curr=pde; */ + pde_curr=pde; pde=pde->next; remove_proc_entry(name,current_pfs->bypass_entry); } if (!pde) remove_proc_entry(current_pfs->dir_name,bp_procfs_dir); + current_pfs->bypass_entry=NULL; return 0; } + #else + + +int bypass_proc_remove_dev_sd(bpctl_dev_t *pbp_device_block) +{ + + struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set; + remove_proc_subtree(current_pfs->dir_name, bp_procfs_dir); + current_pfs->bypass_entry = NULL; + return 0; +} + #endif + + +#endif //BP_PROC_SUPPORT diff --git a/bp_mod.h b/bp_mod.h old mode 100644 new mode 100755 index 2a8a63a..a5cb03f --- a/bp_mod.h +++ b/bp_mod.h @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2005-2013, Silicom +Copyright (c) 2006-2013, Silicom All rights reserved. Redistribution and use in source and binary forms, with or without @@ -55,20 +55,6 @@ POSSIBILITY OF SUCH DAMAGE. #endif -#define usec_delay(x) udelay(x) -#ifndef msec_delay_bp - #define msec_delay_bp(x) do { \ - int i; \ - if(1) { \ - for(i = 0; i < 1000; i++) \ - { \ - udelay(x) ; \ - } \ - } else { \ - msleep(x); \ - } } while(0) - -#endif #ifndef jiffies_to_msecs @@ -185,6 +171,8 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j) #define SILICOM_PE210G2DBi9LR_SSID 0x0189 #define SILICOM_PE210G2DBi9LRRB_SSID 0x0189 #define SILICOM_PE310G4DBi940SR_SSID 0x018C +#define SILICOM_PE310G4DBi940LR_SSID 0x018D +#define SILICOM_PE310G4DBi940T_SSID 0x018e #define SILICOM_PE310G4DBi9T_SSID 0x18e @@ -196,6 +184,12 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j) #define SILICOM_PE310G4BPi9SR_SSID 0x132 #define SILICOM_PE310G4BPi9LR_SSID 0x133 +#define SILICOM_PE310G4BPi9SRD_SSID 0x134 +#define SILICOM_PE310G4BPi9LRD_SSID 0x135 + + + + #define SILICOM_M6E310G4BPi9SR_SSID 0x0492 #define SILICOM_M6E310G4BPi9LR_SSID 0x0493 @@ -279,6 +273,7 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j) #define SILICOM_PE2G4BPi35L_SSID 0x03D0 #define SILICOM_PE2G4BPFi35_SSID 0x03D1 +#define SILICOM_PE2G4BPFi35CS_SSID 0x0b80 #define SILICOM_PE2G4BPFi35LX_SSID 0x03D2 #define SILICOM_PE2G4BPFi35ZX_SSID 0x03D3 @@ -334,9 +329,11 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j) #define SILICOM_M6E2G8BPi80_SSID 0x0470 #define SILICOM_PE210G2BPi40_SSID 0x01a0 #define SILICOM_M1E210G2BPI40T_SSID 0x0480 +#define SILICOM_PE310G4BPi40_SSID 0x01a4 #define PEG540_IF_SERIES(pid) \ ((pid==SILICOM_PE210G2BPi40_SSID) || \ + (pid==SILICOM_PE310G4BPi40_SSID) || \ (pid==SILICOM_M1E210G2BPI40T_SSID)) @@ -484,8 +481,19 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j) #define SILICOM_PE210G2BPI9CX4_SSID 0x121 #define SILICOM_PE210G2BPI9SR_SSID 0x122 #define SILICOM_PE210G2BPI9LR_SSID 0x123 +#define SILICOM_PE210G2BPI9LRD_SSID 0x125 +#define SILICOM_PE210G2BPI9SRD_SSID 0x124 #define SILICOM_PE210G2BPI9T_SSID 0x120 +#define SILICOM_M1E210G2BPI9SRDJP_SSID 0x1E00 +#define SILICOM_M1E210G2BPI9SRDJP1_SSID 0x1E10 +#define SILICOM_M1E210G2BPI9LRDJP_SSID 0x1F00 +#define SILICOM_M1E210G2BPI9LRDJP1_SSID 0x1F10 + + + + + #define DBI_IF_SERIES(pid) \ ((pid==SILICOM_PE10GDBISR_SSID)|| \ (pid==SILICOM_PE10GDBILR_SSID)|| \ @@ -574,6 +582,7 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j) (pid==SILICOM_M1E2G4BPFi35LX_SSID)|| \ (pid==SILICOM_M1E2G4BPFi35ZX_SSID)|| \ (pid==SILICOM_PE2G4BPFi35_SSID)|| \ +(pid==SILICOM_PE2G4BPFi35CS_SSID)|| \ (pid==SILICOM_PE2G4BPFi35LX_SSID)|| \ (pid==SILICOM_PE2G4BPFi35ZX_SSID)) @@ -596,6 +605,7 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j) (pid==SILICOM_M1E2G4BPFi35LX_SSID)|| \ (pid==SILICOM_M1E2G4BPFi35ZX_SSID)|| \ (pid==SILICOM_PE2G4BPFi35_SSID)|| \ +(pid==SILICOM_PE2G4BPFi35CS_SSID)|| \ (pid==SILICOM_PE2G4BPFi35LX_SSID)|| \ (pid==SILICOM_PE2G4BPFi35ZX_SSID)) @@ -612,17 +622,27 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j) (pid==SILICOM_PE210G2BPI9CX4_SSID)|| \ (pid==SILICOM_PE210G2BPI9SR_SSID)|| \ (pid==SILICOM_PE210G2BPI9LR_SSID)|| \ +(pid==SILICOM_PE210G2BPI9LRD_SSID)|| \ +(pid==SILICOM_PE210G2BPI9SRD_SSID)|| \ (pid==SILICOM_PE210G2DBi9SR_SSID)|| \ (pid==SILICOM_PE210G2DBi9SRRB_SSID)|| \ (pid==SILICOM_PE210G2DBi9LR_SSID)|| \ (pid==SILICOM_PE210G2DBi9LRRB_SSID)|| \ (pid==SILICOM_PE310G4DBi940SR_SSID)|| \ +(pid==SILICOM_PE310G4DBi940LR_SSID)|| \ +(pid==SILICOM_PE310G4DBi940T_SSID)|| \ (pid==SILICOM_PE310G4DBi9T_SSID)|| \ (pid==SILICOM_PE310G4BPi9T_SSID)|| \ (pid==SILICOM_PE310G4BPi9SR_SSID)|| \ +(pid==SILICOM_PE310G4BPi9SRD_SSID)|| \ (pid==SILICOM_M6E310G4BPi9SR_SSID)|| \ (pid==SILICOM_M6E310G4BPi9LR_SSID)|| \ (pid==SILICOM_PE310G4BPi9LR_SSID)|| \ +(pid==SILICOM_PE310G4BPi9LRD_SSID)|| \ +(pid==SILICOM_M1E210G2BPI9SRDJP_SSID)|| \ +(pid==SILICOM_M1E210G2BPI9SRDJP1_SSID)|| \ +(pid==SILICOM_M1E210G2BPI9LRDJP_SSID)|| \ +(pid==SILICOM_M1E210G2BPI9LRDJP1_SSID)|| \ (pid==SILICOM_PE210G2BPI9T_SSID)) diff --git a/bp_msg.h b/bp_msg.h old mode 100644 new mode 100755 index 22df083..f17d512 --- a/bp_msg.h +++ b/bp_msg.h @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2005-2013, Silicom +Copyright (c) 2006-2013, Silicom All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/bp_proc.c b/bp_proc.c deleted file mode 100644 index 65ce706..0000000 --- a/bp_proc.c +++ /dev/null @@ -1,1513 +0,0 @@ -/************************************************************************** - -Copyright (c) 2005-2013, Silicom -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Silicom nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -***************************************************************************/ - - -#include -#include -#include "bp_mod.h" - -#define BP_PROC_DIR "bypass" - -#ifdef BYPASS_SUPPORT - - #define GPIO6_SET_ENTRY_SD "gpio6_set" - #define GPIO6_CLEAR_ENTRY_SD "gpio6_clear" - - #define GPIO7_SET_ENTRY_SD "gpio7_set" - #define GPIO7_CLEAR_ENTRY_SD "gpio7_clear" - - #define PULSE_SET_ENTRY_SD "pulse_set" - #define ZERO_SET_ENTRY_SD "zero_set" - #define PULSE_GET1_ENTRY_SD "pulse_get1" - #define PULSE_GET2_ENTRY_SD "pulse_get2" - - #define CMND_ON_ENTRY_SD "cmnd_on" - #define CMND_OFF_ENTRY_SD "cmnd_off" - #define RESET_CONT_ENTRY_SD "reset_cont" - -/*COMMANDS*/ - #define BYPASS_INFO_ENTRY_SD "bypass_info" - - #define BYPASS_SLAVE_ENTRY_SD "bypass_slave" - #define BYPASS_CAPS_ENTRY_SD "bypass_caps" - #define WD_SET_CAPS_ENTRY_SD "wd_set_caps" - #define BYPASS_ENTRY_SD "bypass" - #define BYPASS_CHANGE_ENTRY_SD "bypass_change" - #define BYPASS_WD_ENTRY_SD "bypass_wd" - #define WD_EXPIRE_TIME_ENTRY_SD "wd_expire_time" - #define RESET_BYPASS_WD_ENTRY_SD "reset_bypass_wd" - #define DIS_BYPASS_ENTRY_SD "dis_bypass" - #define BYPASS_PWUP_ENTRY_SD "bypass_pwup" - #define BYPASS_PWOFF_ENTRY_SD "bypass_pwoff" - #define STD_NIC_ENTRY_SD "std_nic" - #define STD_NIC_ENTRY_SD "std_nic" - #define TAP_ENTRY_SD "tap" - #define TAP_CHANGE_ENTRY_SD "tap_change" - #define DIS_TAP_ENTRY_SD "dis_tap" - #define TAP_PWUP_ENTRY_SD "tap_pwup" - #define TWO_PORT_LINK_ENTRY_SD "two_port_link" - #define WD_EXP_MODE_ENTRY_SD "wd_exp_mode" - #define WD_AUTORESET_ENTRY_SD "wd_autoreset" - #define TPL_ENTRY_SD "tpl" - #define WAIT_AT_PWUP_ENTRY_SD "wait_at_pwup" - #define HW_RESET_ENTRY_SD "hw_reset" - #define DISC_ENTRY_SD "disc" - #define DISC_CHANGE_ENTRY_SD "disc_change" - #define DIS_DISC_ENTRY_SD "dis_disc" - #define DISC_PWUP_ENTRY_SD "disc_pwup" - - - - -#endif //bypass_support - - -static struct proc_dir_entry *bp_procfs_dir; - -static struct proc_dir_entry * -proc_getdir(char *name, struct proc_dir_entry *proc_dir) { - struct proc_dir_entry *pde = proc_dir; -#ifdef CONFIG_LOCK_KERNEL - lock_kernel(); -#endif - for (pde=pde->subdir; pde; pde = pde->next) { - if (pde->namelen && (strcmp(name, pde->name) == 0)) { - /* directory exists */ - break; - } - } - if (pde == (struct proc_dir_entry *) 0) { - /* create the directory */ -#if (LINUX_VERSION_CODE > 0x20300) - pde = proc_mkdir(name, proc_dir); -#else - pde = create_proc_entry(name, S_IFDIR, proc_dir); -#endif - if (pde == (struct proc_dir_entry *) 0) { -#ifdef CONFIG_LOCK_KERNEL - unlock_kernel(); -#endif - return(pde); - } - } -#ifdef CONFIG_LOCK_KERNEL - unlock_kernel(); -#endif - return(pde); -} - -int -bp_proc_create(void) -{ -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) ) - bp_procfs_dir = proc_getdir(BP_PROC_DIR, proc_net); -#else - bp_procfs_dir = proc_getdir(BP_PROC_DIR, init_net.proc_net); -#endif - - if (bp_procfs_dir == (struct proc_dir_entry *) 0) { - printk(KERN_DEBUG "Could not create procfs nicinfo directory %s\n", BP_PROC_DIR); - return -1; - } - return 0; -} - - - - -#ifdef BYPASS_SUPPORT - - -int -bypass_proc_create_entry_sd(struct pfs_unit *pfs_unit_curr, - char* proc_name, - write_proc_t *write_proc, - read_proc_t *read_proc, - struct proc_dir_entry *parent_pfs, - void *data - ) -{ - strcpy(pfs_unit_curr->proc_name,proc_name); - pfs_unit_curr->proc_entry= create_proc_entry(pfs_unit_curr->proc_name, - S_IFREG|S_IRUSR|S_IWUSR| - S_IRGRP|S_IWGRP| - S_IROTH|S_IWOTH, parent_pfs); - if (pfs_unit_curr->proc_entry == 0) { - - return -1; - } - - pfs_unit_curr->proc_entry->read_proc = read_proc; - pfs_unit_curr->proc_entry->write_proc = write_proc; - pfs_unit_curr->proc_entry->data = data; - - return 0; - - -} - -int -get_bypass_info_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - int len=0; - - len += sprintf(page, "Name\t\t\t%s\n", pbp_device_block->bp_name); - len += sprintf(page+len, "Firmware version\t0x%x\n", pbp_device_block->bp_fw_ver); - - *eof = 1; - return len; -} - - -int -get_bypass_slave_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - struct pci_dev *pci_slave_dev=pbp_device_block->bp_slave; - struct net_device *net_slave_dev; - int len=0; - - if (is_bypass_fn(pbp_device_block)) { - net_slave_dev=pci_get_drvdata(pci_slave_dev); - if (net_slave_dev) - len = sprintf(page, "%s\n", net_slave_dev->name); - else - len=sprintf(page, "fail\n"); - } else - len=sprintf(page, "fail\n"); - - *eof = 1; - return len; -} - -int -get_bypass_caps_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_bypass_caps_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "-1\n"); - else - len=sprintf(page, "0x%x\n", ret); - *eof = 1; - return len; - - -} - -int -get_wd_set_caps_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_wd_set_caps_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "-1\n"); - else - len=sprintf(page, "0x%x\n", ret); - *eof = 1; - return len; -} - - -int -set_bypass_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int bypass_param=0, length=0; - - if (count>(sizeof(kbuf)-1)) - return -1; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - - if (strcmp(kbuf,"on")==0) - bypass_param=1; - else if (strcmp(kbuf,"off")==0) - bypass_param=0; - - - set_bypass_fn (pbp_device_block, bypass_param); - - return count; -} - -int -set_tap_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int tap_param=0, length=0; - - if (count>(sizeof(kbuf)-1)) - return -1; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - if (strcmp(kbuf,"on")==0) - tap_param=1; - else if (strcmp(kbuf,"off")==0) - tap_param=0; - - set_tap_fn(pbp_device_block, tap_param); - - return count; -} - -int -set_disc_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int tap_param=0, length=0; - - if (count>(sizeof(kbuf)-1)) - return -1; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - if (strcmp(kbuf,"on")==0) - tap_param=1; - else if (strcmp(kbuf,"off")==0) - tap_param=0; - - set_disc_fn(pbp_device_block, tap_param); - - return count; -} - - - -int -get_bypass_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_bypass_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==1) - len=sprintf(page, "on\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - - *eof = 1; - return len; -} - -int -get_tap_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_tap_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==1) - len=sprintf(page, "on\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - - *eof = 1; - return len; -} - - -int -get_disc_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_disc_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==1) - len=sprintf(page, "on\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - - *eof = 1; - return len; -} - -int -get_bypass_change_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_bypass_change_fn (pbp_device_block); - if (ret==1) - len=sprintf(page, "on\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - else len=sprintf(page, "fail\n"); - - *eof = 1; - return len; -} - - -int -get_tap_change_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_tap_change_fn (pbp_device_block); - if (ret==1) - len=sprintf(page, "on\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - else len=sprintf(page, "fail\n"); - - *eof = 1; - return len; -} - -int -get_disc_change_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_disc_change_fn (pbp_device_block); - if (ret==1) - len=sprintf(page, "on\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - else len=sprintf(page, "fail\n"); - - *eof = 1; - return len; -} - - - -int -set_bypass_wd_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - unsigned int timeout=0; - char *timeout_ptr=kbuf; - - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - timeout_ptr=kbuf; - timeout=atoi(&timeout_ptr); - - set_bypass_wd_fn(pbp_device_block, timeout) ; - - return count; -} - -int -get_bypass_wd_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0, timeout=0; - - ret=get_bypass_wd_fn (pbp_device_block, &timeout); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (timeout==-1) - len=sprintf(page, "unknown\n"); - else if (timeout==0) - len=sprintf(page, "disable\n"); - else - len=sprintf(page, "%d\n", timeout); - - *eof = 1; - return len; -} - - -int -get_wd_expire_time_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0, timeout=0; - - ret=get_wd_expire_time_fn (pbp_device_block, &timeout); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (timeout==-1) - len=sprintf(page, "expire\n"); - else if (timeout==0) - len=sprintf(page, "disable\n"); - - else - len=sprintf(page, "%d\n", timeout); - *eof = 1; - return len; -} - -int -get_tpl_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_tpl_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==1) - len=sprintf(page, "on\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - - *eof = 1; - return len; -} - - #ifdef PMC_FIX_FLAG -int -get_wait_at_pwup_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_bp_wait_at_pwup_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==1) - len=sprintf(page, "on\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - - *eof = 1; - return len; -} - -int -get_hw_reset_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_bp_hw_reset_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==1) - len=sprintf(page, "on\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - - *eof = 1; - return len; -} - - #endif /*PMC_WAIT_FLAG*/ - - -int -reset_bypass_wd_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=reset_bypass_wd_timer_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==0) - len=sprintf(page, "disable\n"); - else if (ret==1) - len=sprintf(page, "success\n"); - - *eof = 1; - return len; -} - -int -set_dis_bypass_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int bypass_param=0, length=0; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - - if (strcmp(kbuf,"on")==0) - bypass_param=1; - else if (strcmp(kbuf,"off")==0) - bypass_param=0; - - set_dis_bypass_fn (pbp_device_block, bypass_param); - - return count; -} - -int -set_dis_tap_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int tap_param=0, length=0; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - - if (strcmp(kbuf,"on")==0) - tap_param=1; - else if (strcmp(kbuf,"off")==0) - tap_param=0; - - set_dis_tap_fn (pbp_device_block, tap_param); - - return count; -} - -int -set_dis_disc_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int tap_param=0, length=0; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - - if (strcmp(kbuf,"on")==0) - tap_param=1; - else if (strcmp(kbuf,"off")==0) - tap_param=0; - - set_dis_disc_fn (pbp_device_block, tap_param); - - return count; -} - - -int -get_dis_bypass_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_dis_bypass_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - else - len=sprintf(page, "on\n"); - - *eof = 1; - return len; -} - -int -get_dis_tap_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_dis_tap_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - else - len=sprintf(page, "on\n"); - - *eof = 1; - return len; -} - -int -get_dis_disc_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_dis_disc_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - else - len=sprintf(page, "on\n"); - - *eof = 1; - return len; -} - - -int -set_bypass_pwup_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int bypass_param=0, length=0; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - if (strcmp(kbuf,"on")==0) - bypass_param=1; - else if (strcmp(kbuf,"off")==0) - bypass_param=0; - - set_bypass_pwup_fn (pbp_device_block, bypass_param); - - return count; -} - -int -set_bypass_pwoff_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int bypass_param=0, length=0; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - if (strcmp(kbuf,"on")==0) - bypass_param=1; - else if (strcmp(kbuf,"off")==0) - bypass_param=0; - - set_bypass_pwoff_fn (pbp_device_block, bypass_param); - - return count; -} - - -int -set_tap_pwup_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int tap_param=0, length=0; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - if (strcmp(kbuf,"on")==0) - tap_param=1; - else if (strcmp(kbuf,"off")==0) - tap_param=0; - - set_tap_pwup_fn (pbp_device_block, tap_param); - - return count; -} -int -set_disc_pwup_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int tap_param=0, length=0; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - if (strcmp(kbuf,"on")==0) - tap_param=1; - else if (strcmp(kbuf,"off")==0) - tap_param=0; - - set_disc_pwup_fn (pbp_device_block, tap_param); - - return count; -} - - -int -get_bypass_pwup_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_bypass_pwup_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - else - len=sprintf(page, "on\n"); - - *eof = 1; - return len; -} - -int -get_bypass_pwoff_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_bypass_pwoff_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - else - len=sprintf(page, "on\n"); - - *eof = 1; - return len; -} - - -int -get_tap_pwup_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_tap_pwup_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - else - len=sprintf(page, "on\n"); - - *eof = 1; - return len; -} - -int -get_disc_pwup_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_disc_pwup_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - else - len=sprintf(page, "on\n"); - - *eof = 1; - return len; -} - - - -int -set_std_nic_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int bypass_param=0, length=0; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - - if (strcmp(kbuf,"on")==0) - bypass_param=1; - else if (strcmp(kbuf,"off")==0) - bypass_param=0; - - set_std_nic_fn (pbp_device_block, bypass_param); - - return count; -} - - -int -get_std_nic_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_std_nic_fn (pbp_device_block); - if (ret==BP_NOT_CAP) - len=sprintf(page, "fail\n"); - else if (ret==0) - len=sprintf(page, "off\n"); - else - len=sprintf(page, "on\n"); - - *eof = 1; - return len; -} - -int -get_wd_exp_mode_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_wd_exp_mode_fn (pbp_device_block); - if (ret==1) - len=sprintf(page, "tap\n"); - else if (ret==0) - len=sprintf(page, "bypass\n"); - else if (ret==2) - len=sprintf(page, "disc\n"); - - else len=sprintf(page, "fail\n"); - - *eof = 1; - return len; -} - -int -set_wd_exp_mode_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int bypass_param=0, length=0; - - if (count>(sizeof(kbuf)-1)) - return -1; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - - if (strcmp(kbuf,"tap")==0) - bypass_param=1; - else if (strcmp(kbuf,"bypass")==0) - bypass_param=0; - else if (strcmp(kbuf,"disc")==0) - bypass_param=2; - - set_wd_exp_mode_fn(pbp_device_block, bypass_param); - - return count; -} - - - -int -get_wd_autoreset_pfs (char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int len=0, ret=0; - - ret=get_wd_autoreset_fn (pbp_device_block); - if (ret>=0) - len=sprintf(page, "%d\n",ret); - else len=sprintf(page, "fail\n"); - - *eof = 1; - return len; -} - - -int -set_wd_autoreset_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - u32 timeout=0; - char *timeout_ptr=kbuf; - - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - timeout_ptr=kbuf; - timeout=atoi(&timeout_ptr); - - set_wd_autoreset_fn(pbp_device_block, timeout) ; - - return count; -} - -int -set_tpl_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int tpl_param=0, length=0; - - if (count>(sizeof(kbuf)-1)) - return -1; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - if (strcmp(kbuf,"on")==0) - tpl_param=1; - else if (strcmp(kbuf,"off")==0) - tpl_param=0; - - set_tpl_fn(pbp_device_block, tpl_param); - - return count; -} - #ifdef PMC_FIX_FLAG -int -set_wait_at_pwup_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int tpl_param=0, length=0; - - if (count>(sizeof(kbuf)-1)) - return -1; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - if (strcmp(kbuf,"on")==0) - tpl_param=1; - else if (strcmp(kbuf,"off")==0) - tpl_param=0; - - set_bp_wait_at_pwup_fn(pbp_device_block, tpl_param); - - return count; -} - -int -set_hw_reset_pfs(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - - char kbuf[256]; - bpctl_dev_t * pbp_device_block= (bpctl_dev_t *) data; - - int tpl_param=0, length=0; - - if (count>(sizeof(kbuf)-1)) - return -1; - - if (copy_from_user(&kbuf,buffer,count)) { - return -1; - } - - kbuf[count]='\0'; - length=strlen(kbuf); - if (kbuf[length-1]=='\n') - kbuf[--length]='\0'; - - if (strcmp(kbuf,"on")==0) - tpl_param=1; - else if (strcmp(kbuf,"off")==0) - tpl_param=0; - - set_bp_hw_reset_fn(pbp_device_block, tpl_param); - - return count; -} - - #endif /*PMC_FIX_FLAG*/ - - -int -bypass_proc_create_dev_sd(bpctl_dev_t * pbp_device_block){ - struct bypass_pfs_sd *current_pfs = &(pbp_device_block->bypass_pfs_set); - static struct proc_dir_entry *procfs_dir=NULL; - int ret=0; - - - sprintf(current_pfs->dir_name,"bypass_%s",dev->name); - - if (!bp_procfs_dir) - return -1; - - /* create device proc dir */ - procfs_dir = proc_getdir(current_pfs->dir_name,bp_procfs_dir); - if (procfs_dir == 0) { - printk(KERN_DEBUG "Could not create procfs directory %s\n", - current_pfs->dir_name); - return -1; - } - current_pfs->bypass_entry= procfs_dir; - - if (bypass_proc_create_entry(&(current_pfs->bypass_info), - BYPASS_INFO_ENTRY_SD, - NULL, /* write */ - get_bypass_info_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - if (pbp_device_block->bp_caps & SW_CTL_CAP) { - - - /* Create set param proc's */ - if (bypass_proc_create_entry_sd(&(current_pfs->bypass_slave), - BYPASS_SLAVE_ENTRY_SD, - NULL, /* write */ - get_bypass_slave_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - - if (bypass_proc_create_entry_sd(&(current_pfs->bypass_caps), - BYPASS_CAPS_ENTRY_SD, - NULL, /* write */ - get_bypass_caps_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - if (bypass_proc_create_entry_sd(&(current_pfs->wd_set_caps), - WD_SET_CAPS_ENTRY_SD, - NULL, /* write */ - get_wd_set_caps_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - if (bypass_proc_create_entry_sd(&(current_pfs->bypass_wd), - BYPASS_WD_ENTRY_SD, - set_bypass_wd_pfs, /* write */ - get_bypass_wd_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - - if (bypass_proc_create_entry_sd(&(current_pfs->wd_expire_time), - WD_EXPIRE_TIME_ENTRY_SD, - NULL, /* write */ - get_wd_expire_time_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - if (bypass_proc_create_entry_sd(&(current_pfs->reset_bypass_wd), - RESET_BYPASS_WD_ENTRY_SD, - NULL, /* write */ - reset_bypass_wd_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - if (bypass_proc_create_entry_sd(&(current_pfs->std_nic), - STD_NIC_ENTRY_SD, - set_std_nic_pfs, /* write */ - get_std_nic_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - - if (pbp_device_block->bp_caps & BP_CAP) { - if (bypass_proc_create_entry_sd(&(current_pfs->bypass), - BYPASS_ENTRY_SD, - set_bypass_pfs, /* write */ - get_bypass_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - if (bypass_proc_create_entry_sd(&(current_pfs->dis_bypass), - DIS_BYPASS_ENTRY_SD, - set_dis_bypass_pfs, /* write */ - get_dis_bypass_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - if (bypass_proc_create_entry_sd(&(current_pfs->bypass_pwup), - BYPASS_PWUP_ENTRY_SD, - set_bypass_pwup_pfs, /* write */ - get_bypass_pwup_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - if (bypass_proc_create_entry_sd(&(current_pfs->bypass_pwoff), - BYPASS_PWOFF_ENTRY_SD, - set_bypass_pwoff_pfs, /* write */ - get_bypass_pwoff_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - - if (bypass_proc_create_entry_sd(&(current_pfs->bypass_change), - BYPASS_CHANGE_ENTRY_SD, - NULL, /* write */ - get_bypass_change_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - } - - if (pbp_device_block->bp_caps & TAP_CAP) { - - if (bypass_proc_create_entry_sd(&(current_pfs->tap), - TAP_ENTRY_SD, - set_tap_pfs, /* write */ - get_tap_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - if (bypass_proc_create_entry_sd(&(current_pfs->dis_tap), - DIS_TAP_ENTRY_SD, - set_dis_tap_pfs, /* write */ - get_dis_tap_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - if (bypass_proc_create_entry_sd(&(current_pfs->tap_pwup), - TAP_PWUP_ENTRY_SD, - set_tap_pwup_pfs, /* write */ - get_tap_pwup_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - if (bypass_proc_create_entry_sd(&(current_pfs->tap_change), - TAP_CHANGE_ENTRY_SD, - NULL, /* write */ - get_tap_change_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - } - if (pbp_device_block->bp_caps & DISC_CAP) { - - if (bypass_proc_create_entry_sd(&(current_pfs->tap), - DISC_ENTRY_SD, - set_disc_pfs, /* write */ - get_disc_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; -#if 1 - - if (bypass_proc_create_entry_sd(&(current_pfs->dis_tap), - DIS_DISC_ENTRY_SD, - set_dis_disc_pfs, /* write */ - get_dis_disc_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; -#endif - - if (bypass_proc_create_entry_sd(&(current_pfs->tap_pwup), - DISC_PWUP_ENTRY_SD, - set_disc_pwup_pfs, /* write */ - get_disc_pwup_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - if (bypass_proc_create_entry_sd(&(current_pfs->tap_change), - DISC_CHANGE_ENTRY_SD, - NULL, /* write */ - get_disc_change_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - } - - - if (bypass_proc_create_entry_sd(&(current_pfs->wd_exp_mode), - WD_EXP_MODE_ENTRY_SD, - set_wd_exp_mode_pfs, /* write */ - get_wd_exp_mode_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - - if (bypass_proc_create_entry_sd(&(current_pfs->wd_autoreset), - WD_AUTORESET_ENTRY_SD, - set_wd_autoreset_pfs, /* write */ - get_wd_autoreset_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - if (bypass_proc_create_entry_sd(&(current_pfs->tpl), - TPL_ENTRY_SD, - set_tpl_pfs, /* write */ - get_tpl_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; -#ifdef PMC_FIX_FLAG - if (bypass_proc_create_entry_sd(&(current_pfs->tpl), - WAIT_AT_PWUP_ENTRY_SD, - set_wait_at_pwup_pfs, /* write */ - get_wait_at_pwup_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - if (bypass_proc_create_entry_sd(&(current_pfs->tpl), - HW_RESET_ENTRY_SD, - set_hw_reset_pfs, /* write */ - get_hw_reset_pfs, /* read */ - procfs_dir, - pbp_device_block)) - ret= -1; - -#endif - - } - if (ret<0) - printk(KERN_DEBUG "Create proc entry failed\n"); - - return ret; -} - -int -bypass_proc_remove_dev_sd(bpctl_dev_t * pbp_device_block){ - - struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set; - struct proc_dir_entry *pde = current_pfs->bypass_entry, *pde_curr=NULL; - char name[256]; - - - for (pde=pde->subdir; pde; ) { - strcpy(name,pde->name); - pde_curr=pde; - pde=pde->next; - remove_proc_entry(name,current_pfs->bypass_entry); - } - if (!pde) - remove_proc_entry(current_pfs->dir_name,bp_procfs_dir); - - return 0; -} - -#endif - - - - - - - - - - - - diff --git a/bp_util.c b/bp_util.c old mode 100644 new mode 100755 index 76432a7..c79711f --- a/bp_util.c +++ b/bp_util.c @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2005-2013, Silicom +Copyright (c) 2006-2013, Silicom All rights reserved. Redistribution and use in source and binary forms, with or without @@ -1234,7 +1234,7 @@ void get_bypass_caps_cmd(int file_desc,int if_index, int bus, int slot, int func for (i=0;bp_cap_array[i].flag;i++) { if (bpctl_cmd.status & bp_cap_array[i].flag) - printf("%s", bp_cap_array[i].desc); + printf(bp_cap_array[i].desc); } } diff --git a/bp_util.h b/bp_util.h old mode 100644 new mode 100755 index 2499cbc..216d25f --- a/bp_util.h +++ b/bp_util.h @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2005-2013, Silicom +Copyright (c) 2006-2013, Silicom All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/bpctl_start b/bpctl_start old mode 100644 new mode 100755 index 7f44f5e..520fe4b --- a/bpctl_start +++ b/bpctl_start @@ -1,3 +1,36 @@ +#************************************************************************** +# +# Copyright (c) 2006-2013, Silicom +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the Silicom nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +#*************************************************************************** + #!/bin/sh drv_name="bpctl_mod" dev_node="bpctl" diff --git a/bpctl_stop b/bpctl_stop old mode 100644 new mode 100755 index 6a8504e..d4b8b25 --- a/bpctl_stop +++ b/bpctl_stop @@ -1,3 +1,36 @@ +#************************************************************************** +# +# Copyright (c) 2006-2013, Silicom +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the Silicom nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +#*************************************************************************** + #!/bin/sh /sbin/rmmod bpctl_mod $* || exit 1 diff --git a/bypass.h b/bypass.h old mode 100644 new mode 100755 index 32f877f..30e950a --- a/bypass.h +++ b/bypass.h @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2005-2013, Silicom +Copyright (c) 2006-2013, Silicom All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/libbp_sd.h b/libbp_sd.h old mode 100644 new mode 100755 index f704904..fdd6abe --- a/libbp_sd.h +++ b/libbp_sd.h @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2005-2013, Silicom +Copyright (c) 2006-2013, Silicom All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/license b/license deleted file mode 100644 index 44e50a4..0000000 --- a/license +++ /dev/null @@ -1,290 +0,0 @@ - - - - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - - - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - diff --git a/readme.txt b/readme.txt old mode 100644 new mode 100755 diff --git a/release.txt b/release.txt old mode 100644 new mode 100755 index d7e2ced..629c832 --- a/release.txt +++ b/release.txt @@ -1,7 +1,80 @@ Release Notes Silicom Linux Bypass-SD Control Utility - Version 5.0.49 - 17/03/2013 + Version 5.0.65 + 09/06/2014 + +v5.0.65 +- Fixed problem with event notifier +(kernel 3.13 problem) + + +v5.0.64.1 +- Fixed problem with pci alloc failed +devices + +v5.0.64 +- Added support for +PEG2BPFI6-FLXM-SD-RB2 + + +v5.0.63 +- Added support for +PE2G2BPFi35A-SD-RB2 +PE2G2BPFi35A-LX-SD-RB2 +PE2G4BPi35LA-SD-RB2 +PE2G4BPFi35A-SD-RB2 +PE2G4BPFi35A-LX-SD-RB2 +PE10G2DBi-SR-SD-RB2 +PE10G2DBi-LR-SD-RB2 +PE310G4DBi9-SR-SD-RB2 +PE310G4DBi9-LR-SD-RB2 +PE310G4DBi9-T-SD-RB2 + + +v5.0.62 +- Added support for +M1E210G2BPi9-SRD-SD-JP +M1E210G2BPi9-SRDSD-JP1 +M1E210G2BPi9-LRD-SD-JP +M1E210G2BPi9-LRDSD-JP1 + + + +v5.0.61 +- Added support for PE310G4BPi9SRD, PE310G4BPi9LRD. + +v5.0.60 +- Fixed support for kernel 3.8. + +v5.0.59 +- Added support for kernel 3.10. + +v5.0.58 +- Fixed BP_PROC_SUPPORT flag. + +v5.0.57 +- Added support for PE210G2BPI9LRD, PE210G2BPI9SRD. + +v5.0.56 +- Added support for PE210G2BPi40. + +v5.0.55 +- Added support for PE2G4BPFi35-SD-CS. + +v5.0.54 +- Changed to BSD license + +v5.0.53 +- Fixed delay routine. + +v5.0.52 +- Added support for 3.8.0. + +v5.0.51 +- Fixed bypass_caps for 82599 group. +- Added workaround for abnormal delay issue. +- Fixed tpl clean routine. + v5.0.50 - Fixed bypass_caps for sc fiber group.