Commit 83a66c22 authored by David S. Miller's avatar David S. Miller

Merge bk://kernel.bkbits.net/acme/net-2.5

into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents f3ed32e2 c07aef96
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> * Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* Copyright: (c) 1998-2000 Arnaldo Carvalho de Melo * Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
* *
* Based on sdladrv.c by Gene Kozin <genek@compuserve.com> * Based on sdladrv.c by Gene Kozin <genek@compuserve.com>
* *
...@@ -66,12 +66,6 @@ MODULE_AUTHOR("Arnaldo Carvalho de Melo"); ...@@ -66,12 +66,6 @@ MODULE_AUTHOR("Arnaldo Carvalho de Melo");
MODULE_DESCRIPTION("Cyclom 2x Sync Card Driver"); MODULE_DESCRIPTION("Cyclom 2x Sync Card Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/* Function Prototypes */
/* Module entry points. These are called by the OS and must be public. */
int init_module(void);
void cleanup_module(void);
/* Hardware-specific functions */ /* Hardware-specific functions */
static int load_cyc2x(cycxhw_t *hw, struct cycx_firmware *cfm, u32 len); static int load_cyc2x(cycxhw_t *hw, struct cycx_firmware *cfm, u32 len);
static void cycx_bootcfg(cycxhw_t *hw); static void cycx_bootcfg(cycxhw_t *hw);
...@@ -86,27 +80,19 @@ static u16 checksum(u8 *buf, u32 len); ...@@ -86,27 +80,19 @@ static u16 checksum(u8 *buf, u32 len);
#define wait_cyc(addr) cycx_exec(addr + CMD_OFFSET) #define wait_cyc(addr) cycx_exec(addr + CMD_OFFSET)
#define cyc2x_readb(b) readb(b)
#define cyc2x_readw(b) readw(b)
#define cyc2x_writeb(b, addr) writeb(b, addr)
#define cyc2x_writew(w, addr) writew(w, addr)
#define cyc2x_memcpy_toio(addr, buf, len) memcpy_toio((addr), buf, len)
#define cyc2x_memcpy_fromio(buf, addr, len) memcpy_fromio(buf, (addr), len)
/* Global Data */ /* Global Data */
/* private data */ /* private data */
static char modname[] = "cycx_drv"; static char modname[] = "cycx_drv";
static char fullname[] = "Cyclom 2X Support Module"; static char fullname[] = "Cyclom 2X Support Module";
static char copyright[] = "(c) 1998-2000 Arnaldo Carvalho de Melo " static char copyright[] = "(c) 1998-2003 Arnaldo Carvalho de Melo "
"<acme@conectiva.com.br>"; "<acme@conectiva.com.br>";
/* Hardware configuration options. /* Hardware configuration options.
* These are arrays of configuration options used by verification routines. * These are arrays of configuration options used by verification routines.
* The first element of each array is its size (i.e. number of options). * The first element of each array is its size (i.e. number of options).
*/ */
static u32 cyc2x_dpmbase_options[] = static u32 cyc2x_dpmbase_options[] = {
{
20, 20,
0xA0000, 0xA4000, 0xA8000, 0xAC000, 0xB0000, 0xB4000, 0xB8000, 0xA0000, 0xA4000, 0xA8000, 0xAC000, 0xB0000, 0xB4000, 0xB8000,
0xBC000, 0xC0000, 0xC4000, 0xC8000, 0xCC000, 0xD0000, 0xD4000, 0xBC000, 0xC0000, 0xC4000, 0xC8000, 0xCC000, 0xD0000, 0xD4000,
...@@ -204,14 +190,14 @@ int cycx_down(cycxhw_t *hw) ...@@ -204,14 +190,14 @@ int cycx_down(cycxhw_t *hw)
EXPORT_SYMBOL(cycx_inten); EXPORT_SYMBOL(cycx_inten);
void cycx_inten(cycxhw_t *hw) void cycx_inten(cycxhw_t *hw)
{ {
cyc2x_writeb(0, hw->dpmbase); writeb(0, hw->dpmbase);
} }
/* Generate an interrupt to adapter's CPU. */ /* Generate an interrupt to adapter's CPU. */
EXPORT_SYMBOL(cycx_intr); EXPORT_SYMBOL(cycx_intr);
void cycx_intr(cycxhw_t *hw) void cycx_intr(cycxhw_t *hw)
{ {
cyc2x_writew(0, hw->dpmbase + GEN_CYCX_INTR); writew(0, hw->dpmbase + GEN_CYCX_INTR);
} }
/* Execute Adapter Command. /* Execute Adapter Command.
...@@ -223,7 +209,7 @@ int cycx_exec(u32 addr) ...@@ -223,7 +209,7 @@ int cycx_exec(u32 addr)
u16 i = 0; u16 i = 0;
/* wait till addr content is zeroed */ /* wait till addr content is zeroed */
while (cyc2x_readw(addr)) { while (readw(addr)) {
udelay(1000); udelay(1000);
if (++i > 50) if (++i > 50)
...@@ -239,9 +225,9 @@ EXPORT_SYMBOL(cycx_peek); ...@@ -239,9 +225,9 @@ EXPORT_SYMBOL(cycx_peek);
int cycx_peek(cycxhw_t *hw, u32 addr, void *buf, u32 len) int cycx_peek(cycxhw_t *hw, u32 addr, void *buf, u32 len)
{ {
if (len == 1) if (len == 1)
*(u8*)buf = cyc2x_readb(hw->dpmbase + addr); *(u8*)buf = readb(hw->dpmbase + addr);
else else
cyc2x_memcpy_fromio(buf, hw->dpmbase + addr, len); memcpy_fromio(buf, hw->dpmbase + addr, len);
return 0; return 0;
} }
...@@ -252,9 +238,9 @@ EXPORT_SYMBOL(cycx_poke); ...@@ -252,9 +238,9 @@ EXPORT_SYMBOL(cycx_poke);
int cycx_poke(cycxhw_t *hw, u32 addr, void *buf, u32 len) int cycx_poke(cycxhw_t *hw, u32 addr, void *buf, u32 len)
{ {
if (len == 1) if (len == 1)
cyc2x_writeb(*(u8*)buf, hw->dpmbase + addr); writeb(*(u8*)buf, hw->dpmbase + addr);
else else
cyc2x_memcpy_toio(hw->dpmbase + addr, buf, len); memcpy_toio(hw->dpmbase + addr, buf, len);
return 0; return 0;
} }
...@@ -269,10 +255,10 @@ static int memory_exists(u32 addr) ...@@ -269,10 +255,10 @@ static int memory_exists(u32 addr)
int tries = 0; int tries = 0;
for (; tries < 3 ; tries++) { for (; tries < 3 ; tries++) {
cyc2x_writew(TEST_PATTERN, addr + 0x10); writew(TEST_PATTERN, addr + 0x10);
if (cyc2x_readw(addr + 0x10) == TEST_PATTERN) if (readw(addr + 0x10) == TEST_PATTERN)
if (cyc2x_readw(addr + 0x10) == TEST_PATTERN) if (readw(addr + 0x10) == TEST_PATTERN)
return 1; return 1;
delay_cycx(1); delay_cycx(1);
...@@ -289,7 +275,7 @@ static void reset_load(u32 addr, u8 *buffer, u32 cnt) ...@@ -289,7 +275,7 @@ static void reset_load(u32 addr, u8 *buffer, u32 cnt)
for (i = 0 ; i < cnt ; i++) { for (i = 0 ; i < cnt ; i++) {
/* for (j = 0 ; j < 50 ; j++); Delay - FIXME busy waiting... */ /* for (j = 0 ; j < 50 ; j++); Delay - FIXME busy waiting... */
cyc2x_writeb(*buffer++, pt_code++); writeb(*buffer++, pt_code++);
} }
} }
...@@ -298,8 +284,8 @@ static void reset_load(u32 addr, u8 *buffer, u32 cnt) ...@@ -298,8 +284,8 @@ static void reset_load(u32 addr, u8 *buffer, u32 cnt)
* o wait for reset code to copy it to right portion of memory */ * o wait for reset code to copy it to right portion of memory */
static int buffer_load(u32 addr, u8 *buffer, u32 cnt) static int buffer_load(u32 addr, u8 *buffer, u32 cnt)
{ {
cyc2x_memcpy_toio(addr + DATA_OFFSET, buffer, cnt); memcpy_toio(addr + DATA_OFFSET, buffer, cnt);
cyc2x_writew(GEN_BOOT_DAT, addr + CMD_OFFSET); writew(GEN_BOOT_DAT, addr + CMD_OFFSET);
return wait_cyc(addr); return wait_cyc(addr);
} }
...@@ -308,14 +294,14 @@ static int buffer_load(u32 addr, u8 *buffer, u32 cnt) ...@@ -308,14 +294,14 @@ static int buffer_load(u32 addr, u8 *buffer, u32 cnt)
static void cycx_start(u32 addr) static void cycx_start(u32 addr)
{ {
/* put in 0x30 offset the jump instruction to the code entry point */ /* put in 0x30 offset the jump instruction to the code entry point */
cyc2x_writeb(0xea, addr + 0x30); writeb(0xea, addr + 0x30);
cyc2x_writeb(0x00, addr + 0x31); writeb(0x00, addr + 0x31);
cyc2x_writeb(0xc4, addr + 0x32); writeb(0xc4, addr + 0x32);
cyc2x_writeb(0x00, addr + 0x33); writeb(0x00, addr + 0x33);
cyc2x_writeb(0x00, addr + 0x34); writeb(0x00, addr + 0x34);
/* cmd to start executing code */ /* cmd to start executing code */
cyc2x_writew(GEN_START, addr + CMD_OFFSET); writew(GEN_START, addr + CMD_OFFSET);
} }
/* Load and boot reset code. */ /* Load and boot reset code. */
...@@ -323,15 +309,15 @@ static void cycx_reset_boot(u32 addr, u8 *code, u32 len) ...@@ -323,15 +309,15 @@ static void cycx_reset_boot(u32 addr, u8 *code, u32 len)
{ {
u32 pt_start = addr + START_OFFSET; u32 pt_start = addr + START_OFFSET;
cyc2x_writeb(0xea, pt_start++); /* jmp to f000:3f00 */ writeb(0xea, pt_start++); /* jmp to f000:3f00 */
cyc2x_writeb(0x00, pt_start++); writeb(0x00, pt_start++);
cyc2x_writeb(0xfc, pt_start++); writeb(0xfc, pt_start++);
cyc2x_writeb(0x00, pt_start++); writeb(0x00, pt_start++);
cyc2x_writeb(0xf0, pt_start); writeb(0xf0, pt_start);
reset_load(addr, code, len); reset_load(addr, code, len);
/* 80186 was in hold, go */ /* 80186 was in hold, go */
cyc2x_writeb(0, addr + START_CPU); writeb(0, addr + START_CPU);
delay_cycx(1); delay_cycx(1);
} }
...@@ -342,15 +328,15 @@ static int cycx_data_boot(u32 addr, u8 *code, u32 len) ...@@ -342,15 +328,15 @@ static int cycx_data_boot(u32 addr, u8 *code, u32 len)
u32 i; u32 i;
/* boot buffer lenght */ /* boot buffer lenght */
cyc2x_writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16)); writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
cyc2x_writew(GEN_DEFPAR, pt_boot_cmd); writew(GEN_DEFPAR, pt_boot_cmd);
if (wait_cyc(addr) < 0) if (wait_cyc(addr) < 0)
return -1; return -1;
cyc2x_writew(0, pt_boot_cmd + sizeof(u16)); writew(0, pt_boot_cmd + sizeof(u16));
cyc2x_writew(0x4000, pt_boot_cmd + 2 * sizeof(u16)); writew(0x4000, pt_boot_cmd + 2 * sizeof(u16));
cyc2x_writew(GEN_SET_SEG, pt_boot_cmd); writew(GEN_SET_SEG, pt_boot_cmd);
if (wait_cyc(addr) < 0) if (wait_cyc(addr) < 0)
return -1; return -1;
...@@ -373,21 +359,22 @@ static int cycx_code_boot(u32 addr, u8 *code, u32 len) ...@@ -373,21 +359,22 @@ static int cycx_code_boot(u32 addr, u8 *code, u32 len)
u32 i; u32 i;
/* boot buffer lenght */ /* boot buffer lenght */
cyc2x_writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16)); writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
cyc2x_writew(GEN_DEFPAR, pt_boot_cmd); writew(GEN_DEFPAR, pt_boot_cmd);
if (wait_cyc(addr) < 0) if (wait_cyc(addr) < 0)
return -1; return -1;
cyc2x_writew(0x0000, pt_boot_cmd + sizeof(u16)); writew(0x0000, pt_boot_cmd + sizeof(u16));
cyc2x_writew(0xc400, pt_boot_cmd + 2 * sizeof(u16)); writew(0xc400, pt_boot_cmd + 2 * sizeof(u16));
cyc2x_writew(GEN_SET_SEG, pt_boot_cmd); writew(GEN_SET_SEG, pt_boot_cmd);
if (wait_cyc(addr) < 0) if (wait_cyc(addr) < 0)
return -1; return -1;
for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ) for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ)
if (buffer_load(addr, code + i,MIN(CFM_LOAD_BUFSZ,(len - i)))) { if (buffer_load(addr, code + i,
MIN(CFM_LOAD_BUFSZ, (len - i)))) {
printk(KERN_ERR "%s: Error !!\n", modname); printk(KERN_ERR "%s: Error !!\n", modname);
return -1; return -1;
} }
...@@ -478,11 +465,11 @@ static int load_cyc2x(cycxhw_t *hw, struct cycx_firmware *cfm, u32 len) ...@@ -478,11 +465,11 @@ static int load_cyc2x(cycxhw_t *hw, struct cycx_firmware *cfm, u32 len)
/* Load reset.bin */ /* Load reset.bin */
cycx_reset_boot(hw->dpmbase, reset_image, img_hdr->reset_size); cycx_reset_boot(hw->dpmbase, reset_image, img_hdr->reset_size);
/* reset is waiting for boot */ /* reset is waiting for boot */
cyc2x_writew(GEN_POWER_ON, pt_cycld); writew(GEN_POWER_ON, pt_cycld);
delay_cycx(1); delay_cycx(1);
for (j = 0 ; j < 3 ; j++) for (j = 0 ; j < 3 ; j++)
if (!cyc2x_readw(pt_cycld)) if (!readw(pt_cycld))
goto reset_loaded; goto reset_loaded;
else else
delay_cycx(1); delay_cycx(1);
...@@ -530,7 +517,7 @@ static int load_cyc2x(cycxhw_t *hw, struct cycx_firmware *cfm, u32 len) ...@@ -530,7 +517,7 @@ static int load_cyc2x(cycxhw_t *hw, struct cycx_firmware *cfm, u32 len)
static void cycx_bootcfg(cycxhw_t *hw) static void cycx_bootcfg(cycxhw_t *hw)
{ {
/* use fixed buffers */ /* use fixed buffers */
cyc2x_writeb(FIXED_BUFFERS, hw->dpmbase + CONF_OFFSET); writeb(FIXED_BUFFERS, hw->dpmbase + CONF_OFFSET);
} }
/* Detect Cyclom 2x adapter. /* Detect Cyclom 2x adapter.
...@@ -563,9 +550,9 @@ static int get_option_index(u32 *optlist, u32 optval) ...@@ -563,9 +550,9 @@ static int get_option_index(u32 *optlist, u32 optval)
/* Reset adapter's CPU. */ /* Reset adapter's CPU. */
static int reset_cyc2x(u32 addr) static int reset_cyc2x(u32 addr)
{ {
cyc2x_writeb(0, addr + RST_ENABLE); writeb(0, addr + RST_ENABLE);
delay_cycx(2); delay_cycx(2);
cyc2x_writeb(0, addr + RST_DISABLE); writeb(0, addr + RST_DISABLE);
delay_cycx(2); delay_cycx(2);
return memory_exists(addr); return memory_exists(addr);
...@@ -575,7 +562,7 @@ static int reset_cyc2x(u32 addr) ...@@ -575,7 +562,7 @@ static int reset_cyc2x(u32 addr)
static void delay_cycx(int sec) static void delay_cycx(int sec)
{ {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(sec*HZ); schedule_timeout(sec * HZ);
} }
/* Calculate 16-bit CRC using CCITT polynomial. */ /* Calculate 16-bit CRC using CCITT polynomial. */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> * Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* Copyright: (c) 1998-2001 Arnaldo Carvalho de Melo * Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
* *
* Based on sdlamain.c by Gene Kozin <genek@compuserve.com> & * Based on sdlamain.c by Gene Kozin <genek@compuserve.com> &
* Jaspreet Singh <jaspreet@sangoma.com> * Jaspreet Singh <jaspreet@sangoma.com>
...@@ -75,7 +75,7 @@ static int shutdown(struct wan_device *wandev); ...@@ -75,7 +75,7 @@ static int shutdown(struct wan_device *wandev);
static int ioctl(struct wan_device *wandev, unsigned cmd, unsigned long arg); static int ioctl(struct wan_device *wandev, unsigned cmd, unsigned long arg);
/* Miscellaneous functions */ /* Miscellaneous functions */
static irqreturn_t cycx_isr (int irq, void *dev_id, struct pt_regs *regs); static irqreturn_t cycx_isr(int irq, void *dev_id, struct pt_regs *regs);
/* Global Data /* Global Data
* Note: All data must be explicitly initialized!!! * Note: All data must be explicitly initialized!!!
...@@ -103,7 +103,7 @@ static struct cycx_device *card_array; /* adapter data space */ ...@@ -103,7 +103,7 @@ static struct cycx_device *card_array; /* adapter data space */
* < 0 error. * < 0 error.
* Context: process * Context: process
*/ */
int __init cyclomx_init (void) int __init cyclomx_init(void)
{ {
int cnt, err = -ENOMEM; int cnt, err = -ENOMEM;
...@@ -156,7 +156,7 @@ out: return err; ...@@ -156,7 +156,7 @@ out: return err;
* o unregister all adapters from the WAN router * o unregister all adapters from the WAN router
* o release all remaining system resources * o release all remaining system resources
*/ */
static void __exit cyclomx_cleanup (void) static void __exit cyclomx_cleanup(void)
{ {
int i = 0; int i = 0;
...@@ -316,7 +316,7 @@ static int ioctl(struct wan_device *wandev, unsigned cmd, unsigned long arg) ...@@ -316,7 +316,7 @@ static int ioctl(struct wan_device *wandev, unsigned cmd, unsigned long arg)
* o acknowledge Cyclom 2X hardware interrupt. * o acknowledge Cyclom 2X hardware interrupt.
* o call protocol-specific interrupt service routine, if any. * o call protocol-specific interrupt service routine, if any.
*/ */
static irqreturn_t cycx_isr (int irq, void *dev_id, struct pt_regs *regs) static irqreturn_t cycx_isr(int irq, void *dev_id, struct pt_regs *regs)
{ {
struct cycx_device *card = (struct cycx_device *)dev_id; struct cycx_device *card = (struct cycx_device *)dev_id;
...@@ -348,12 +348,10 @@ void cyclomx_set_state(struct cycx_device *card, int state) ...@@ -348,12 +348,10 @@ void cyclomx_set_state(struct cycx_device *card, int state)
case WAN_CONNECTED: case WAN_CONNECTED:
string_state = "connected!"; string_state = "connected!";
break; break;
case WAN_DISCONNECTED: case WAN_DISCONNECTED:
string_state = "disconnected!"; string_state = "disconnected!";
break; break;
} }
printk(KERN_INFO "%s: link %s\n", card->devname, string_state); printk(KERN_INFO "%s: link %s\n", card->devname, string_state);
card->wandev.state = state; card->wandev.state = state;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> * Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
* Copyright: (c) 1998-2001 Arnaldo Carvalho de Melo * Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
* *
* Based on sdla_x25.c by Gene Kozin <genek@compuserve.com> * Based on sdla_x25.c by Gene Kozin <genek@compuserve.com>
* *
...@@ -129,15 +129,15 @@ static int update(struct wan_device *wandev), ...@@ -129,15 +129,15 @@ static int update(struct wan_device *wandev),
del_if(struct wan_device *wandev, struct net_device *dev); del_if(struct wan_device *wandev, struct net_device *dev);
/* Network device interface */ /* Network device interface */
static int if_init (struct net_device *dev), static int if_init(struct net_device *dev),
if_open (struct net_device *dev), if_open(struct net_device *dev),
if_close (struct net_device *dev), if_close(struct net_device *dev),
if_header (struct sk_buff *skb, struct net_device *dev, if_header(struct sk_buff *skb, struct net_device *dev,
u16 type, void *daddr, void *saddr, unsigned len), u16 type, void *daddr, void *saddr, unsigned len),
if_rebuild_hdr (struct sk_buff *skb), if_rebuild_hdr(struct sk_buff *skb),
if_send (struct sk_buff *skb, struct net_device *dev); if_send(struct sk_buff *skb, struct net_device *dev);
static struct net_device_stats * if_stats (struct net_device *dev); static struct net_device_stats *if_stats(struct net_device *dev);
/* Interrupt handlers */ /* Interrupt handlers */
static void cyx_isr(struct cycx_device *card), static void cyx_isr(struct cycx_device *card),
...@@ -160,23 +160,23 @@ static int x25_configure(struct cycx_device *card, TX25Config *conf), ...@@ -160,23 +160,23 @@ static int x25_configure(struct cycx_device *card, TX25Config *conf),
x25_disconnect_response(struct cycx_device *card, u8 link, u8 lcn); x25_disconnect_response(struct cycx_device *card, u8 link, u8 lcn);
/* channel functions */ /* channel functions */
static int chan_connect (struct net_device *dev), static int chan_connect(struct net_device *dev),
chan_send (struct net_device *dev, struct sk_buff *skb); chan_send(struct net_device *dev, struct sk_buff *skb);
static void chan_disconnect (struct net_device *dev), static void chan_disconnect(struct net_device *dev),
chan_x25_send_event(struct net_device *dev, u8 event); chan_x25_send_event(struct net_device *dev, u8 event);
/* Miscellaneous functions */ /* Miscellaneous functions */
static void set_chan_state (struct net_device *dev, u8 state), static void set_chan_state(struct net_device *dev, u8 state),
chan_timer (unsigned long d); chan_timer(unsigned long d);
static void nibble_to_byte (u8 *s, u8 *d, u8 len, u8 nibble), static void nibble_to_byte(u8 *s, u8 *d, u8 len, u8 nibble),
reset_timer (struct net_device *dev); reset_timer(struct net_device *dev);
static u8 bps_to_speed_code (u32 bps); static u8 bps_to_speed_code(u32 bps);
static u8 log2 (u32 n); static u8 log2(u32 n);
static unsigned dec_to_uint (u8 *str, int len); static unsigned dec_to_uint(u8 *str, int len);
static struct net_device *get_dev_by_lcn(struct wan_device *wandev, s16 lcn); static struct net_device *get_dev_by_lcn(struct wan_device *wandev, s16 lcn);
static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev, static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev,
...@@ -354,7 +354,8 @@ static int new_if(struct wan_device *wandev, struct net_device *dev, ...@@ -354,7 +354,8 @@ static int new_if(struct wan_device *wandev, struct net_device *dev,
int err = 0; int err = 0;
if (!conf->name[0] || strlen(conf->name) > WAN_IFNAME_SZ) { if (!conf->name[0] || strlen(conf->name) > WAN_IFNAME_SZ) {
printk(KERN_INFO "%s: invalid interface name!\n",card->devname); printk(KERN_INFO "%s: invalid interface name!\n",
card->devname);
return -EINVAL; return -EINVAL;
} }
...@@ -539,7 +540,7 @@ static int if_close(struct net_device *dev) ...@@ -539,7 +540,7 @@ static int if_close(struct net_device *dev)
* set skb->protocol to 0 and discard packet later. * set skb->protocol to 0 and discard packet later.
* *
* Return: media header length. */ * Return: media header length. */
static int if_header (struct sk_buff *skb, struct net_device *dev, static int if_header(struct sk_buff *skb, struct net_device *dev,
u16 type, void *daddr, void *saddr, unsigned len) u16 type, void *daddr, void *saddr, unsigned len)
{ {
skb->protocol = type; skb->protocol = type;
...@@ -550,7 +551,7 @@ static int if_header (struct sk_buff *skb, struct net_device *dev, ...@@ -550,7 +551,7 @@ static int if_header (struct sk_buff *skb, struct net_device *dev,
/* * Re-build media header. /* * Re-build media header.
* Return: 1 physical address resolved. * Return: 1 physical address resolved.
* 0 physical address not resolved */ * 0 physical address not resolved */
static int if_rebuild_hdr (struct sk_buff *skb) static int if_rebuild_hdr(struct sk_buff *skb)
{ {
return 1; return 1;
} }
...@@ -570,7 +571,7 @@ static int if_rebuild_hdr (struct sk_buff *skb) ...@@ -570,7 +571,7 @@ static int if_rebuild_hdr (struct sk_buff *skb)
* bottom half" (with interrupts enabled). * bottom half" (with interrupts enabled).
* 2. Setting tbusy flag will inhibit further transmit requests from the * 2. Setting tbusy flag will inhibit further transmit requests from the
* protocol stack and can be used for flow control with protocol layer. */ * protocol stack and can be used for flow control with protocol layer. */
static int if_send (struct sk_buff *skb, struct net_device *dev) static int if_send(struct sk_buff *skb, struct net_device *dev)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
struct cycx_device *card = chan->card; struct cycx_device *card = chan->card;
...@@ -644,7 +645,7 @@ static int if_send (struct sk_buff *skb, struct net_device *dev) ...@@ -644,7 +645,7 @@ static int if_send (struct sk_buff *skb, struct net_device *dev)
/* Get Ethernet-style interface statistics. /* Get Ethernet-style interface statistics.
* Return a pointer to struct net_device_stats */ * Return a pointer to struct net_device_stats */
static struct net_device_stats *if_stats (struct net_device *dev) static struct net_device_stats *if_stats(struct net_device *dev)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
...@@ -1049,7 +1050,7 @@ static int x25_configure(struct cycx_device *card, TX25Config *conf) ...@@ -1049,7 +1050,7 @@ static int x25_configure(struct cycx_device *card, TX25Config *conf)
TX25Config conf[2]; TX25Config conf[2];
} x25_cmd_conf; } x25_cmd_conf;
memset (&x25_cmd_conf, 0, sizeof(x25_cmd_conf)); memset(&x25_cmd_conf, 0, sizeof(x25_cmd_conf));
x25_cmd_conf.nlinks = 2; x25_cmd_conf.nlinks = 2;
x25_cmd_conf.conf[0] = *conf; x25_cmd_conf.conf[0] = *conf;
/* FIXME: we need to find a way in the wanrouter framework /* FIXME: we need to find a way in the wanrouter framework
...@@ -1293,7 +1294,7 @@ static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev, ...@@ -1293,7 +1294,7 @@ static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev,
* Return: 0 connected * Return: 0 connected
* >0 connection in progress * >0 connection in progress
* <0 failure */ * <0 failure */
static int chan_connect (struct net_device *dev) static int chan_connect(struct net_device *dev)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
struct cycx_device *card = chan->card; struct cycx_device *card = chan->card;
...@@ -1318,7 +1319,7 @@ static int chan_connect (struct net_device *dev) ...@@ -1318,7 +1319,7 @@ static int chan_connect (struct net_device *dev)
/* Disconnect logical channel. /* Disconnect logical channel.
* o if SVC then clear X.25 call */ * o if SVC then clear X.25 call */
static void chan_disconnect (struct net_device *dev) static void chan_disconnect(struct net_device *dev)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
...@@ -1330,7 +1331,7 @@ static void chan_disconnect (struct net_device *dev) ...@@ -1330,7 +1331,7 @@ static void chan_disconnect (struct net_device *dev)
} }
/* Called by kernel timer */ /* Called by kernel timer */
static void chan_timer (unsigned long d) static void chan_timer(unsigned long d)
{ {
struct net_device *dev = (struct net_device *)d; struct net_device *dev = (struct net_device *)d;
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
...@@ -1343,7 +1344,7 @@ static void chan_timer (unsigned long d) ...@@ -1343,7 +1344,7 @@ static void chan_timer (unsigned long d)
} }
/* Set logical channel state. */ /* Set logical channel state. */
static void set_chan_state (struct net_device *dev, u8 state) static void set_chan_state(struct net_device *dev, u8 state)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
struct cycx_device *card = chan->card; struct cycx_device *card = chan->card;
...@@ -1367,15 +1368,12 @@ static void set_chan_state (struct net_device *dev, u8 state) ...@@ -1367,15 +1368,12 @@ static void set_chan_state (struct net_device *dev, u8 state)
chan_x25_send_event(dev, 1); chan_x25_send_event(dev, 1);
break; break;
case WAN_CONNECTING: case WAN_CONNECTING:
string_state = "connecting..."; string_state = "connecting...";
break; break;
case WAN_DISCONNECTING: case WAN_DISCONNECTING:
string_state = "disconnecting..."; string_state = "disconnecting...";
break; break;
case WAN_DISCONNECTED: case WAN_DISCONNECTED:
string_state = "disconnected!"; string_state = "disconnected!";
...@@ -1391,7 +1389,7 @@ static void set_chan_state (struct net_device *dev, u8 state) ...@@ -1391,7 +1389,7 @@ static void set_chan_state (struct net_device *dev, u8 state)
break; break;
} }
printk (KERN_INFO "%s: interface %s %s\n", card->devname, printk(KERN_INFO "%s: interface %s %s\n", card->devname,
dev->name, string_state); dev->name, string_state);
chan->state = state; chan->state = state;
} }
...@@ -1412,7 +1410,7 @@ static void set_chan_state (struct net_device *dev, u8 state) ...@@ -1412,7 +1410,7 @@ static void set_chan_state (struct net_device *dev, u8 state)
* the packet into 'complete sequence' using M-bit. * the packet into 'complete sequence' using M-bit.
* 2. When transmission is complete, an event notification should be issued * 2. When transmission is complete, an event notification should be issued
* to the router. */ * to the router. */
static int chan_send (struct net_device *dev, struct sk_buff *skb) static int chan_send(struct net_device *dev, struct sk_buff *skb)
{ {
x25_channel_t *chan = dev->priv; x25_channel_t *chan = dev->priv;
struct cycx_device *card = chan->card; struct cycx_device *card = chan->card;
...@@ -1463,7 +1461,7 @@ static void chan_x25_send_event(struct net_device *dev, u8 event) ...@@ -1463,7 +1461,7 @@ static void chan_x25_send_event(struct net_device *dev, u8 event)
} }
/* Convert line speed in bps to a number used by cyclom 2x code. */ /* Convert line speed in bps to a number used by cyclom 2x code. */
static u8 bps_to_speed_code (u32 bps) static u8 bps_to_speed_code(u32 bps)
{ {
u8 number = 0; /* defaults to the lowest (1200) speed ;> */ u8 number = 0; /* defaults to the lowest (1200) speed ;> */
...@@ -1480,7 +1478,7 @@ static u8 bps_to_speed_code (u32 bps) ...@@ -1480,7 +1478,7 @@ static u8 bps_to_speed_code (u32 bps)
} }
/* log base 2 */ /* log base 2 */
static u8 log2 (u32 n) static u8 log2(u32 n)
{ {
u8 log = 0; u8 log = 0;
...@@ -1497,7 +1495,7 @@ static u8 log2 (u32 n) ...@@ -1497,7 +1495,7 @@ static u8 log2 (u32 n)
/* Convert decimal string to unsigned integer. /* Convert decimal string to unsigned integer.
* If len != 0 then only 'len' characters of the string are converted. */ * If len != 0 then only 'len' characters of the string are converted. */
static unsigned dec_to_uint (u8 *str, int len) static unsigned dec_to_uint(u8 *str, int len)
{ {
unsigned val = 0; unsigned val = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment