Commit 574ad93f 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 0debd094 7f47833c
...@@ -141,18 +141,21 @@ static struct net_device_stats *if_stats(struct net_device *dev); ...@@ -141,18 +141,21 @@ 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),
tx_intr(struct cycx_device *card, TX25Cmd *cmd), tx_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
rx_intr(struct cycx_device *card, TX25Cmd *cmd), rx_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
log_intr(struct cycx_device *card, TX25Cmd *cmd), log_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
stat_intr(struct cycx_device *card, TX25Cmd *cmd), stat_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
connect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd), connect_confirm_intr(struct cycx_device *card,
disconnect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd), struct cycx_x25_cmd *cmd),
connect_intr(struct cycx_device *card, TX25Cmd *cmd), disconnect_confirm_intr(struct cycx_device *card,
disconnect_intr(struct cycx_device *card, TX25Cmd *cmd), struct cycx_x25_cmd *cmd),
spur_intr(struct cycx_device *card, TX25Cmd *cmd); connect_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
disconnect_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd),
spur_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd);
/* X.25 firmware interface functions */ /* X.25 firmware interface functions */
static int x25_configure(struct cycx_device *card, TX25Config *conf), static int x25_configure(struct cycx_device *card,
struct cycx_x25_config *conf),
x25_get_stats(struct cycx_device *card), x25_get_stats(struct cycx_device *card),
x25_send(struct cycx_device *card, u8 link, u8 lcn, u8 bitm, int len, x25_send(struct cycx_device *card, u8 link, u8 lcn, u8 bitm, int len,
void *buf), void *buf),
...@@ -185,8 +188,8 @@ static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev, ...@@ -185,8 +188,8 @@ static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev,
#ifdef CYCLOMX_X25_DEBUG #ifdef CYCLOMX_X25_DEBUG
static void hex_dump(char *msg, unsigned char *p, int len); static void hex_dump(char *msg, unsigned char *p, int len);
static void x25_dump_config(TX25Config *conf); static void x25_dump_config(struct cycx_x25_config *conf);
static void x25_dump_stats(TX25Stats *stats); static void x25_dump_stats(struct cycx_x25_stats *stats);
static void x25_dump_devs(struct wan_device *wandev); static void x25_dump_devs(struct wan_device *wandev);
#else #else
#define hex_dump(msg, p, len) #define hex_dump(msg, p, len)
...@@ -207,7 +210,7 @@ static void x25_dump_devs(struct wan_device *wandev); ...@@ -207,7 +210,7 @@ static void x25_dump_devs(struct wan_device *wandev);
* < 0 failure. */ * < 0 failure. */
int cyx_init(struct cycx_device *card, wandev_conf_t *conf) int cyx_init(struct cycx_device *card, wandev_conf_t *conf)
{ {
TX25Config cfg; struct cycx_x25_config cfg;
/* Verify configuration ID */ /* Verify configuration ID */
if (conf->config_id != WANCONFIG_X25) { if (conf->config_id != WANCONFIG_X25) {
...@@ -658,7 +661,7 @@ static struct net_device_stats *if_stats(struct net_device *dev) ...@@ -658,7 +661,7 @@ static struct net_device_stats *if_stats(struct net_device *dev)
/* X.25 Interrupt Service Routine. */ /* X.25 Interrupt Service Routine. */
static void cyx_isr(struct cycx_device *card) static void cyx_isr(struct cycx_device *card)
{ {
TX25Cmd cmd; struct cycx_x25_cmd cmd;
u16 z = 0; u16 z = 0;
card->in_isr = 1; card->in_isr = 1;
...@@ -708,7 +711,7 @@ static void cyx_isr(struct cycx_device *card) ...@@ -708,7 +711,7 @@ static void cyx_isr(struct cycx_device *card)
/* Transmit interrupt handler. /* Transmit interrupt handler.
* o Release socket buffer * o Release socket buffer
* o Clear 'tbusy' flag */ * o Clear 'tbusy' flag */
static void tx_intr(struct cycx_device *card, TX25Cmd *cmd) static void tx_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
{ {
struct net_device *dev; struct net_device *dev;
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
...@@ -739,7 +742,7 @@ static void tx_intr(struct cycx_device *card, TX25Cmd *cmd) ...@@ -739,7 +742,7 @@ static void tx_intr(struct cycx_device *card, TX25Cmd *cmd)
* expected on this channel. * expected on this channel.
* 2. If something goes wrong and X.25 packet has to be dropped (e.g. no * 2. If something goes wrong and X.25 packet has to be dropped (e.g. no
* socket buffers available) the whole packet sequence must be discarded. */ * socket buffers available) the whole packet sequence must be discarded. */
static void rx_intr(struct cycx_device *card, TX25Cmd *cmd) static void rx_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
{ {
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
struct net_device *dev; struct net_device *dev;
...@@ -823,7 +826,7 @@ static void rx_intr(struct cycx_device *card, TX25Cmd *cmd) ...@@ -823,7 +826,7 @@ static void rx_intr(struct cycx_device *card, TX25Cmd *cmd)
} }
/* Connect interrupt handler. */ /* Connect interrupt handler. */
static void connect_intr(struct cycx_device *card, TX25Cmd *cmd) static void connect_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
{ {
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
struct net_device *dev = NULL; struct net_device *dev = NULL;
...@@ -865,7 +868,8 @@ static void connect_intr(struct cycx_device *card, TX25Cmd *cmd) ...@@ -865,7 +868,8 @@ static void connect_intr(struct cycx_device *card, TX25Cmd *cmd)
} }
/* Connect confirm interrupt handler. */ /* Connect confirm interrupt handler. */
static void connect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd) static void connect_confirm_intr(struct cycx_device *card,
struct cycx_x25_cmd *cmd)
{ {
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
struct net_device *dev; struct net_device *dev;
...@@ -892,7 +896,8 @@ static void connect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd) ...@@ -892,7 +896,8 @@ static void connect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd)
} }
/* Disconnect confirm interrupt handler. */ /* Disconnect confirm interrupt handler. */
static void disconnect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd) static void disconnect_confirm_intr(struct cycx_device *card,
struct cycx_x25_cmd *cmd)
{ {
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
struct net_device *dev; struct net_device *dev;
...@@ -912,7 +917,7 @@ static void disconnect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd) ...@@ -912,7 +917,7 @@ static void disconnect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd)
} }
/* disconnect interrupt handler. */ /* disconnect interrupt handler. */
static void disconnect_intr(struct cycx_device *card, TX25Cmd *cmd) static void disconnect_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
{ {
struct wan_device *wandev = &card->wandev; struct wan_device *wandev = &card->wandev;
struct net_device *dev; struct net_device *dev;
...@@ -931,7 +936,7 @@ static void disconnect_intr(struct cycx_device *card, TX25Cmd *cmd) ...@@ -931,7 +936,7 @@ static void disconnect_intr(struct cycx_device *card, TX25Cmd *cmd)
} }
/* LOG interrupt handler. */ /* LOG interrupt handler. */
static void log_intr(struct cycx_device *card, TX25Cmd *cmd) static void log_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
{ {
#if CYCLOMX_X25_DEBUG #if CYCLOMX_X25_DEBUG
char bf[20]; char bf[20];
...@@ -959,7 +964,7 @@ static void log_intr(struct cycx_device *card, TX25Cmd *cmd) ...@@ -959,7 +964,7 @@ static void log_intr(struct cycx_device *card, TX25Cmd *cmd)
} }
/* STATISTIC interrupt handler. */ /* STATISTIC interrupt handler. */
static void stat_intr(struct cycx_device *card, TX25Cmd *cmd) static void stat_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
{ {
cycx_peek(&card->hw, cmd->buf, &card->u.x.stats, cycx_peek(&card->hw, cmd->buf, &card->u.x.stats,
sizeof(card->u.x.stats)); sizeof(card->u.x.stats));
...@@ -972,7 +977,7 @@ static void stat_intr(struct cycx_device *card, TX25Cmd *cmd) ...@@ -972,7 +977,7 @@ static void stat_intr(struct cycx_device *card, TX25Cmd *cmd)
/* Spurious interrupt handler. /* Spurious interrupt handler.
* o print a warning * o print a warning
* If number of spurious interrupts exceeded some limit, then ??? */ * If number of spurious interrupts exceeded some limit, then ??? */
static void spur_intr(struct cycx_device *card, TX25Cmd *cmd) static void spur_intr(struct cycx_device *card, struct cycx_x25_cmd *cmd)
{ {
printk(KERN_INFO "%s: spurious interrupt (0x%X)!\n", printk(KERN_INFO "%s: spurious interrupt (0x%X)!\n",
card->devname, cmd->command); card->devname, cmd->command);
...@@ -1000,7 +1005,7 @@ static void hex_dump(char *msg, unsigned char *p, int len) ...@@ -1000,7 +1005,7 @@ static void hex_dump(char *msg, unsigned char *p, int len)
static int x25_exec(struct cycx_device *card, int command, int link, static int x25_exec(struct cycx_device *card, int command, int link,
void *d1, int len1, void *d2, int len2) void *d1, int len1, void *d2, int len2)
{ {
TX25Cmd c; struct cycx_x25_cmd c;
unsigned long flags; unsigned long flags;
u32 addr = 0x1200 + 0x2E0 * link + 0x1E2; u32 addr = 0x1200 + 0x2E0 * link + 0x1E2;
u8 retry = MAX_CMD_RETRY; u8 retry = MAX_CMD_RETRY;
...@@ -1045,11 +1050,11 @@ static int x25_exec(struct cycx_device *card, int command, int link, ...@@ -1045,11 +1050,11 @@ static int x25_exec(struct cycx_device *card, int command, int link,
} }
/* Configure adapter. */ /* Configure adapter. */
static int x25_configure(struct cycx_device *card, TX25Config *conf) static int x25_configure(struct cycx_device *card, struct cycx_x25_config *conf)
{ {
struct { struct {
u16 nlinks; u16 nlinks;
TX25Config conf[2]; struct cycx_x25_config 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));
...@@ -1520,7 +1525,7 @@ static void reset_timer(struct net_device *dev) ...@@ -1520,7 +1525,7 @@ static void reset_timer(struct net_device *dev)
mod_timer(&chan->timer, jiffies+chan->idle_tmout*HZ); mod_timer(&chan->timer, jiffies+chan->idle_tmout*HZ);
} }
#ifdef CYCLOMX_X25_DEBUG #ifdef CYCLOMX_X25_DEBUG
static void x25_dump_config(TX25Config *conf) static void x25_dump_config(struct cycx_x25_config *conf)
{ {
printk(KERN_INFO "X.25 configuration\n"); printk(KERN_INFO "X.25 configuration\n");
printk(KERN_INFO "-----------------\n"); printk(KERN_INFO "-----------------\n");
...@@ -1542,7 +1547,7 @@ static void x25_dump_config(TX25Config *conf) ...@@ -1542,7 +1547,7 @@ static void x25_dump_config(TX25Config *conf)
printk(KERN_INFO "flags=0x%x\n", conf->flags); printk(KERN_INFO "flags=0x%x\n", conf->flags);
} }
static void x25_dump_stats(TX25Stats *stats) static void x25_dump_stats(struct cycx_x25_stats *stats)
{ {
printk(KERN_INFO "X.25 statistics\n"); printk(KERN_INFO "X.25 statistics\n");
printk(KERN_INFO "--------------\n"); printk(KERN_INFO "--------------\n");
......
...@@ -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 wanpipe.h by Gene Kozin <genek@compuserve.com> * Based on wanpipe.h by Gene Kozin <genek@compuserve.com>
* *
...@@ -62,7 +62,7 @@ struct cycx_device { ...@@ -62,7 +62,7 @@ struct cycx_device {
u32 hi_pvc; u32 hi_pvc;
u32 lo_svc; u32 lo_svc;
u32 hi_svc; u32 hi_svc;
TX25Stats stats; struct cycx_x25_stats stats;
spinlock_t lock; spinlock_t lock;
u32 connection_keys; u32 connection_keys;
} x; } x;
......
#ifndef _CYCX_X25_H
#define _CYCX_X25_H
/* /*
* cycx_x25.h Cyclom X.25 firmware API definitions. * cycx_x25.h Cyclom X.25 firmware API definitions.
* *
* 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 sdla_x25.h by Gene Kozin <74604.152@compuserve.com> * Based on sdla_x25.h by Gene Kozin <74604.152@compuserve.com>
* *
...@@ -20,9 +22,6 @@ ...@@ -20,9 +22,6 @@
* TX25Cmd & TX25Config structs * TX25Cmd & TX25Config structs
* typedef'ed * typedef'ed
*/ */
#ifndef _CYCX_X25_H
#define _CYCX_X25_H
#ifndef PACKED #ifndef PACKED
#define PACKED __attribute__((packed)) #define PACKED __attribute__((packed))
#endif #endif
...@@ -38,13 +37,12 @@ extern unsigned int cycx_debug; ...@@ -38,13 +37,12 @@ extern unsigned int cycx_debug;
/* Data Structures */ /* Data Structures */
/* X.25 Command Block. */ /* X.25 Command Block. */
typedef struct X25Cmd struct cycx_x25_cmd {
{
u16 command PACKED; u16 command PACKED;
u16 link PACKED; /* values: 0 or 1 */ u16 link PACKED; /* values: 0 or 1 */
u16 len PACKED; /* values: 0 thru 0x205 (517) */ u16 len PACKED; /* values: 0 thru 0x205 (517) */
u32 buf PACKED; u32 buf PACKED;
} TX25Cmd; };
/* Defines for the 'command' field. */ /* Defines for the 'command' field. */
#define X25_CONNECT_REQUEST 0x4401 #define X25_CONNECT_REQUEST 0x4401
...@@ -74,26 +72,45 @@ typedef struct X25Cmd ...@@ -74,26 +72,45 @@ typedef struct X25Cmd
#define X25_N2TRACEXC 0x4702 #define X25_N2TRACEXC 0x4702
#define X25_N3TRACEXC 0x4703 #define X25_N3TRACEXC 0x4703
typedef struct X25Config { /**
u8 link PACKED; /* link number */ * struct cycx_x25_config - cyclom2x x25 firmware configuration
u8 speed PACKED; /* line speed */ * @link - link number
u8 clock PACKED; /* internal/external */ * @speed - line speed
u8 n2 PACKED; /* # of level 2 retransm.(values: 1 thru FF) */ * @clock - internal/external
u8 n2win PACKED; /* level 2 window (values: 1 thru 7) */ * @n2 - # of level 2 retransm.(values: 1 thru FF)
u8 n3win PACKED; /* level 3 window (values: 1 thru 7) */ * @n2win - level 2 window (values: 1 thru 7)
u8 nvc PACKED; /* # of logical channels (values: 1 thru 64) */ * @n3win - level 3 window (values: 1 thru 7)
u8 pktlen PACKED; /* level 3 packet lenght - log base 2 of size */ * @nvc - # of logical channels (values: 1 thru 64)
u8 locaddr PACKED; /* my address */ * @pktlen - level 3 packet lenght - log base 2 of size
u8 remaddr PACKED; /* remote address */ * @locaddr - my address
u16 t1 PACKED; /* time, in seconds */ * @remaddr - remote address
u16 t2 PACKED; /* time, in seconds */ * @t1 - time, in seconds
u8 t21 PACKED; /* time, in seconds */ * @t2 - time, in seconds
u8 npvc PACKED; /* # of permanent virt. circuits (1 thru nvc) */ * @t21 - time, in seconds
u8 t23 PACKED; /* time, in seconds */ * @npvc - # of permanent virt. circuits (1 thru nvc)
u8 flags PACKED; /* see dosx25.doc, in portuguese, for details */ * @t23 - time, in seconds
} TX25Config; * @flags - see dosx25.doc, in portuguese, for details
*/
struct cycx_x25_config {
u8 link PACKED;
u8 speed PACKED;
u8 clock PACKED;
u8 n2 PACKED;
u8 n2win PACKED;
u8 n3win PACKED;
u8 nvc PACKED;
u8 pktlen PACKED;
u8 locaddr PACKED;
u8 remaddr PACKED;
u16 t1 PACKED;
u16 t2 PACKED;
u8 t21 PACKED;
u8 npvc PACKED;
u8 t23 PACKED;
u8 flags PACKED;
};
typedef struct X25Stats { struct cycx_x25_stats {
u16 rx_crc_errors PACKED; u16 rx_crc_errors PACKED;
u16 rx_over_errors PACKED; u16 rx_over_errors PACKED;
u16 n2_tx_frames PACKED; u16 n2_tx_frames PACKED;
...@@ -104,5 +121,5 @@ typedef struct X25Stats { ...@@ -104,5 +121,5 @@ typedef struct X25Stats {
u16 n3_rx_packets PACKED; u16 n3_rx_packets PACKED;
u16 tx_aborts PACKED; u16 tx_aborts PACKED;
u16 rx_aborts PACKED; u16 rx_aborts PACKED;
} TX25Stats; };
#endif /* _CYCX_X25_H */ #endif /* _CYCX_X25_H */
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