WAN: Port LMC driver to generic HDLC
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
This commit is contained in:
parent
52e8a6a2d8
commit
64bef7630a
|
@ -61,7 +61,7 @@ config COSA
|
||||||
#
|
#
|
||||||
config LANMEDIA
|
config LANMEDIA
|
||||||
tristate "LanMedia Corp. SSI/V.35, T1/E1, HSSI, T3 boards"
|
tristate "LanMedia Corp. SSI/V.35, T1/E1, HSSI, T3 boards"
|
||||||
depends on PCI && VIRT_TO_BUS
|
depends on PCI && VIRT_TO_BUS && HDLC
|
||||||
---help---
|
---help---
|
||||||
Driver for the following Lan Media family of serial boards:
|
Driver for the following Lan Media family of serial boards:
|
||||||
|
|
||||||
|
@ -78,9 +78,8 @@ config LANMEDIA
|
||||||
- LMC 5245 board connects directly to a T3 circuit saving the
|
- LMC 5245 board connects directly to a T3 circuit saving the
|
||||||
additional external hardware.
|
additional external hardware.
|
||||||
|
|
||||||
To change setting such as syncPPP vs Cisco HDLC or clock source you
|
To change setting such as clock source you will need lmcctl.
|
||||||
will need lmcctl. It is available at <ftp://ftp.lanmedia.com/>
|
It is available at <ftp://ftp.lanmedia.com/> (broken link).
|
||||||
(broken link).
|
|
||||||
|
|
||||||
To compile this driver as a module, choose M here: the
|
To compile this driver as a module, choose M here: the
|
||||||
module will be called lmc.
|
module will be called lmc.
|
||||||
|
|
|
@ -26,7 +26,6 @@ obj-$(CONFIG_SEALEVEL_4021) += z85230.o sealevel.o
|
||||||
obj-$(CONFIG_COSA) += cosa.o
|
obj-$(CONFIG_COSA) += cosa.o
|
||||||
obj-$(CONFIG_FARSYNC) += farsync.o
|
obj-$(CONFIG_FARSYNC) += farsync.o
|
||||||
obj-$(CONFIG_DSCC4) += dscc4.o
|
obj-$(CONFIG_DSCC4) += dscc4.o
|
||||||
obj-$(CONFIG_LANMEDIA) += syncppp.o
|
|
||||||
obj-$(CONFIG_X25_ASY) += x25_asy.o
|
obj-$(CONFIG_X25_ASY) += x25_asy.o
|
||||||
|
|
||||||
obj-$(CONFIG_LANMEDIA) += lmc/
|
obj-$(CONFIG_LANMEDIA) += lmc/
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
/*
|
/*
|
||||||
* IFTYPE defines
|
* IFTYPE defines
|
||||||
*/
|
*/
|
||||||
#define LMC_PPP 1 /* use sppp interface */
|
#define LMC_PPP 1 /* use generic HDLC interface */
|
||||||
#define LMC_NET 2 /* use direct net interface */
|
#define LMC_NET 2 /* use direct net interface */
|
||||||
#define LMC_RAW 3 /* use direct net interface */
|
#define LMC_RAW 3 /* use direct net interface */
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -425,7 +425,7 @@ lmc_ds3_set_scram (lmc_softc_t * const sc, int ie)
|
||||||
static int
|
static int
|
||||||
lmc_ds3_get_link_status (lmc_softc_t * const sc)
|
lmc_ds3_get_link_status (lmc_softc_t * const sc)
|
||||||
{
|
{
|
||||||
u_int16_t link_status, link_status_11;
|
u16 link_status, link_status_11;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
lmc_mii_writereg (sc, 0, 17, 7);
|
lmc_mii_writereg (sc, 0, 17, 7);
|
||||||
|
@ -447,7 +447,7 @@ lmc_ds3_get_link_status (lmc_softc_t * const sc)
|
||||||
(link_status & LMC_FRAMER_REG0_OOFS)){
|
(link_status & LMC_FRAMER_REG0_OOFS)){
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if(sc->last_led_err[3] != 1){
|
if(sc->last_led_err[3] != 1){
|
||||||
u16 r1;
|
u16 r1;
|
||||||
lmc_mii_writereg (sc, 0, 17, 01); /* Turn on Xbit error as our cisco does */
|
lmc_mii_writereg (sc, 0, 17, 01); /* Turn on Xbit error as our cisco does */
|
||||||
r1 = lmc_mii_readreg (sc, 0, 18);
|
r1 = lmc_mii_readreg (sc, 0, 18);
|
||||||
r1 &= 0xfe;
|
r1 &= 0xfe;
|
||||||
|
@ -460,7 +460,7 @@ lmc_ds3_get_link_status (lmc_softc_t * const sc)
|
||||||
else {
|
else {
|
||||||
lmc_led_off(sc, LMC_DS3_LED3); /* turn on red LED */
|
lmc_led_off(sc, LMC_DS3_LED3); /* turn on red LED */
|
||||||
if(sc->last_led_err[3] == 1){
|
if(sc->last_led_err[3] == 1){
|
||||||
u16 r1;
|
u16 r1;
|
||||||
lmc_mii_writereg (sc, 0, 17, 01); /* Turn off Xbit error */
|
lmc_mii_writereg (sc, 0, 17, 01); /* Turn off Xbit error */
|
||||||
r1 = lmc_mii_readreg (sc, 0, 18);
|
r1 = lmc_mii_readreg (sc, 0, 18);
|
||||||
r1 |= 0x01;
|
r1 |= 0x01;
|
||||||
|
@ -538,20 +538,19 @@ lmc_ds3_watchdog (lmc_softc_t * const sc)
|
||||||
* SSI methods
|
* SSI methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void lmc_ssi_init(lmc_softc_t * const sc)
|
||||||
lmc_ssi_init (lmc_softc_t * const sc)
|
|
||||||
{
|
{
|
||||||
u_int16_t mii17;
|
u16 mii17;
|
||||||
int cable;
|
int cable;
|
||||||
|
|
||||||
sc->ictl.cardtype = LMC_CTL_CARDTYPE_LMC1000;
|
sc->ictl.cardtype = LMC_CTL_CARDTYPE_LMC1000;
|
||||||
|
|
||||||
mii17 = lmc_mii_readreg (sc, 0, 17);
|
mii17 = lmc_mii_readreg(sc, 0, 17);
|
||||||
|
|
||||||
cable = (mii17 & LMC_MII17_SSI_CABLE_MASK) >> LMC_MII17_SSI_CABLE_SHIFT;
|
cable = (mii17 & LMC_MII17_SSI_CABLE_MASK) >> LMC_MII17_SSI_CABLE_SHIFT;
|
||||||
sc->ictl.cable_type = cable;
|
sc->ictl.cable_type = cable;
|
||||||
|
|
||||||
lmc_gpio_mkoutput (sc, LMC_GEP_SSI_TXCLOCK);
|
lmc_gpio_mkoutput(sc, LMC_GEP_SSI_TXCLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -679,11 +678,11 @@ lmc_ssi_set_speed (lmc_softc_t * const sc, lmc_ctl_t * ctl)
|
||||||
static int
|
static int
|
||||||
lmc_ssi_get_link_status (lmc_softc_t * const sc)
|
lmc_ssi_get_link_status (lmc_softc_t * const sc)
|
||||||
{
|
{
|
||||||
u_int16_t link_status;
|
u16 link_status;
|
||||||
u_int32_t ticks;
|
u_int32_t ticks;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
int hw_hdsk = 1;
|
int hw_hdsk = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* missing CTS? Hmm. If we require CTS on, we may never get the
|
* missing CTS? Hmm. If we require CTS on, we may never get the
|
||||||
* link to come up, so omit it in this test.
|
* link to come up, so omit it in this test.
|
||||||
|
@ -718,9 +717,9 @@ lmc_ssi_get_link_status (lmc_softc_t * const sc)
|
||||||
}
|
}
|
||||||
else if (ticks == 0 ) { /* no clock found ? */
|
else if (ticks == 0 ) { /* no clock found ? */
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if(sc->last_led_err[3] != 1){
|
if (sc->last_led_err[3] != 1) {
|
||||||
sc->stats.tx_lossOfClockCnt++;
|
sc->extra_stats.tx_lossOfClockCnt++;
|
||||||
printk(KERN_WARNING "%s: Lost Clock, Link Down\n", sc->name);
|
printk(KERN_WARNING "%s: Lost Clock, Link Down\n", sc->name);
|
||||||
}
|
}
|
||||||
sc->last_led_err[3] = 1;
|
sc->last_led_err[3] = 1;
|
||||||
lmc_led_on (sc, LMC_MII16_LED3); /* turn ON red LED */
|
lmc_led_on (sc, LMC_MII16_LED3); /* turn ON red LED */
|
||||||
|
@ -885,19 +884,13 @@ write_av9110 (lmc_softc_t * sc, u_int32_t n, u_int32_t m, u_int32_t v,
|
||||||
| LMC_GEP_SSI_GENERATOR));
|
| LMC_GEP_SSI_GENERATOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void lmc_ssi_watchdog(lmc_softc_t * const sc)
|
||||||
lmc_ssi_watchdog (lmc_softc_t * const sc)
|
|
||||||
{
|
{
|
||||||
u_int16_t mii17 = lmc_mii_readreg (sc, 0, 17);
|
u16 mii17 = lmc_mii_readreg(sc, 0, 17);
|
||||||
if (((mii17 >> 3) & 7) == 7)
|
if (((mii17 >> 3) & 7) == 7)
|
||||||
{
|
lmc_led_off(sc, LMC_MII16_LED2);
|
||||||
lmc_led_off (sc, LMC_MII16_LED2);
|
else
|
||||||
}
|
lmc_led_on(sc, LMC_MII16_LED2);
|
||||||
else
|
|
||||||
{
|
|
||||||
lmc_led_on (sc, LMC_MII16_LED2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -927,7 +920,7 @@ lmc_t1_read (lmc_softc_t * const sc, int a)
|
||||||
static void
|
static void
|
||||||
lmc_t1_init (lmc_softc_t * const sc)
|
lmc_t1_init (lmc_softc_t * const sc)
|
||||||
{
|
{
|
||||||
u_int16_t mii16;
|
u16 mii16;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sc->ictl.cardtype = LMC_CTL_CARDTYPE_LMC1200;
|
sc->ictl.cardtype = LMC_CTL_CARDTYPE_LMC1200;
|
||||||
|
@ -1026,7 +1019,7 @@ lmc_t1_set_status (lmc_softc_t * const sc, lmc_ctl_t * ctl)
|
||||||
*/ static int
|
*/ static int
|
||||||
lmc_t1_get_link_status (lmc_softc_t * const sc)
|
lmc_t1_get_link_status (lmc_softc_t * const sc)
|
||||||
{
|
{
|
||||||
u_int16_t link_status;
|
u16 link_status;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
/* LMC5245 (DS3) & LMC1200 (DS1) LED definitions
|
/* LMC5245 (DS3) & LMC1200 (DS1) LED definitions
|
||||||
|
|
|
@ -36,9 +36,6 @@
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
|
|
||||||
#include <net/syncppp.h>
|
|
||||||
|
|
||||||
#include <asm/processor.h> /* Processor type for cache alignment. */
|
#include <asm/processor.h> /* Processor type for cache alignment. */
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/dma.h>
|
#include <asm/dma.h>
|
||||||
|
@ -50,48 +47,6 @@
|
||||||
#include "lmc_ioctl.h"
|
#include "lmc_ioctl.h"
|
||||||
#include "lmc_proto.h"
|
#include "lmc_proto.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* The compile-time variable SPPPSTUP causes the module to be
|
|
||||||
* compiled without referencing any of the sync ppp routines.
|
|
||||||
*/
|
|
||||||
#ifdef SPPPSTUB
|
|
||||||
#define SPPP_detach(d) (void)0
|
|
||||||
#define SPPP_open(d) 0
|
|
||||||
#define SPPP_reopen(d) (void)0
|
|
||||||
#define SPPP_close(d) (void)0
|
|
||||||
#define SPPP_attach(d) (void)0
|
|
||||||
#define SPPP_do_ioctl(d,i,c) -EOPNOTSUPP
|
|
||||||
#else
|
|
||||||
#define SPPP_attach(x) sppp_attach((x)->pd)
|
|
||||||
#define SPPP_detach(x) sppp_detach((x)->pd->dev)
|
|
||||||
#define SPPP_open(x) sppp_open((x)->pd->dev)
|
|
||||||
#define SPPP_reopen(x) sppp_reopen((x)->pd->dev)
|
|
||||||
#define SPPP_close(x) sppp_close((x)->pd->dev)
|
|
||||||
#define SPPP_do_ioctl(x, y, z) sppp_do_ioctl((x)->pd->dev, (y), (z))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// init
|
|
||||||
void lmc_proto_init(lmc_softc_t *sc) /*FOLD00*/
|
|
||||||
{
|
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_init in");
|
|
||||||
switch(sc->if_type){
|
|
||||||
case LMC_PPP:
|
|
||||||
sc->pd = kmalloc(sizeof(struct ppp_device), GFP_KERNEL);
|
|
||||||
if (!sc->pd) {
|
|
||||||
printk("lmc_proto_init(): kmalloc failure!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sc->pd->dev = sc->lmc_device;
|
|
||||||
sc->if_ptr = sc->pd;
|
|
||||||
break;
|
|
||||||
case LMC_RAW:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_init out");
|
|
||||||
}
|
|
||||||
|
|
||||||
// attach
|
// attach
|
||||||
void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/
|
void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/
|
||||||
{
|
{
|
||||||
|
@ -100,7 +55,6 @@ void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/
|
||||||
case LMC_PPP:
|
case LMC_PPP:
|
||||||
{
|
{
|
||||||
struct net_device *dev = sc->lmc_device;
|
struct net_device *dev = sc->lmc_device;
|
||||||
SPPP_attach(sc);
|
|
||||||
dev->do_ioctl = lmc_ioctl;
|
dev->do_ioctl = lmc_ioctl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -108,7 +62,7 @@ void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/
|
||||||
{
|
{
|
||||||
struct net_device *dev = sc->lmc_device;
|
struct net_device *dev = sc->lmc_device;
|
||||||
/*
|
/*
|
||||||
* They set a few basics because they don't use sync_ppp
|
* They set a few basics because they don't use HDLC
|
||||||
*/
|
*/
|
||||||
dev->flags |= IFF_POINTOPOINT;
|
dev->flags |= IFF_POINTOPOINT;
|
||||||
|
|
||||||
|
@ -124,88 +78,39 @@ void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_attach out");
|
lmc_trace(sc->lmc_device, "lmc_proto_attach out");
|
||||||
}
|
}
|
||||||
|
|
||||||
// detach
|
int lmc_proto_ioctl(lmc_softc_t *sc, struct ifreq *ifr, int cmd)
|
||||||
void lmc_proto_detach(lmc_softc_t *sc) /*FOLD00*/
|
|
||||||
{
|
{
|
||||||
switch(sc->if_type){
|
lmc_trace(sc->lmc_device, "lmc_proto_ioctl");
|
||||||
case LMC_PPP:
|
if (sc->if_type == LMC_PPP)
|
||||||
SPPP_detach(sc);
|
return hdlc_ioctl(sc->lmc_device, ifr, cmd);
|
||||||
break;
|
return -EOPNOTSUPP;
|
||||||
case LMC_RAW: /* Tell someone we're detaching? */
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// reopen
|
int lmc_proto_open(lmc_softc_t *sc)
|
||||||
void lmc_proto_reopen(lmc_softc_t *sc) /*FOLD00*/
|
|
||||||
{
|
{
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_reopen in");
|
int ret = 0;
|
||||||
switch(sc->if_type){
|
|
||||||
case LMC_PPP:
|
lmc_trace(sc->lmc_device, "lmc_proto_open in");
|
||||||
SPPP_reopen(sc);
|
|
||||||
break;
|
if (sc->if_type == LMC_PPP) {
|
||||||
case LMC_RAW: /* Reset the interface after being down, prerape to receive packets again */
|
ret = hdlc_open(sc->lmc_device);
|
||||||
break;
|
if (ret < 0)
|
||||||
default:
|
printk(KERN_WARNING "%s: HDLC open failed: %d\n",
|
||||||
break;
|
sc->name, ret);
|
||||||
}
|
}
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_reopen out");
|
|
||||||
|
lmc_trace(sc->lmc_device, "lmc_proto_open out");
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lmc_proto_close(lmc_softc_t *sc)
|
||||||
// ioctl
|
|
||||||
int lmc_proto_ioctl(lmc_softc_t *sc, struct ifreq *ifr, int cmd) /*FOLD00*/
|
|
||||||
{
|
{
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_ioctl out");
|
lmc_trace(sc->lmc_device, "lmc_proto_close in");
|
||||||
switch(sc->if_type){
|
|
||||||
case LMC_PPP:
|
|
||||||
return SPPP_do_ioctl (sc, ifr, cmd);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_ioctl out");
|
|
||||||
}
|
|
||||||
|
|
||||||
// open
|
if (sc->if_type == LMC_PPP)
|
||||||
void lmc_proto_open(lmc_softc_t *sc) /*FOLD00*/
|
hdlc_close(sc->lmc_device);
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_open in");
|
lmc_trace(sc->lmc_device, "lmc_proto_close out");
|
||||||
switch(sc->if_type){
|
|
||||||
case LMC_PPP:
|
|
||||||
ret = SPPP_open(sc);
|
|
||||||
if(ret < 0)
|
|
||||||
printk("%s: syncPPP open failed: %d\n", sc->name, ret);
|
|
||||||
break;
|
|
||||||
case LMC_RAW: /* We're about to start getting packets! */
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_open out");
|
|
||||||
}
|
|
||||||
|
|
||||||
// close
|
|
||||||
|
|
||||||
void lmc_proto_close(lmc_softc_t *sc) /*FOLD00*/
|
|
||||||
{
|
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_close in");
|
|
||||||
switch(sc->if_type){
|
|
||||||
case LMC_PPP:
|
|
||||||
SPPP_close(sc);
|
|
||||||
break;
|
|
||||||
case LMC_RAW: /* Interface going down */
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_close out");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__be16 lmc_proto_type(lmc_softc_t *sc, struct sk_buff *skb) /*FOLD00*/
|
__be16 lmc_proto_type(lmc_softc_t *sc, struct sk_buff *skb) /*FOLD00*/
|
||||||
|
@ -213,8 +118,8 @@ __be16 lmc_proto_type(lmc_softc_t *sc, struct sk_buff *skb) /*FOLD00*/
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_type in");
|
lmc_trace(sc->lmc_device, "lmc_proto_type in");
|
||||||
switch(sc->if_type){
|
switch(sc->if_type){
|
||||||
case LMC_PPP:
|
case LMC_PPP:
|
||||||
return htons(ETH_P_WAN_PPP);
|
return hdlc_type_trans(skb, sc->lmc_device);
|
||||||
break;
|
break;
|
||||||
case LMC_NET:
|
case LMC_NET:
|
||||||
return htons(ETH_P_802_2);
|
return htons(ETH_P_802_2);
|
||||||
break;
|
break;
|
||||||
|
@ -245,4 +150,3 @@ void lmc_proto_netif(lmc_softc_t *sc, struct sk_buff *skb) /*FOLD00*/
|
||||||
}
|
}
|
||||||
lmc_trace(sc->lmc_device, "lmc_proto_netif out");
|
lmc_trace(sc->lmc_device, "lmc_proto_netif out");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
#ifndef _LMC_PROTO_H_
|
#ifndef _LMC_PROTO_H_
|
||||||
#define _LMC_PROTO_H_
|
#define _LMC_PROTO_H_
|
||||||
|
|
||||||
void lmc_proto_init(lmc_softc_t *sc);
|
#include <linux/hdlc.h>
|
||||||
|
|
||||||
void lmc_proto_attach(lmc_softc_t *sc);
|
void lmc_proto_attach(lmc_softc_t *sc);
|
||||||
void lmc_proto_detach(lmc_softc_t *sc);
|
|
||||||
void lmc_proto_reopen(lmc_softc_t *sc);
|
|
||||||
int lmc_proto_ioctl(lmc_softc_t *sc, struct ifreq *ifr, int cmd);
|
int lmc_proto_ioctl(lmc_softc_t *sc, struct ifreq *ifr, int cmd);
|
||||||
void lmc_proto_open(lmc_softc_t *sc);
|
int lmc_proto_open(lmc_softc_t *sc);
|
||||||
void lmc_proto_close(lmc_softc_t *sc);
|
void lmc_proto_close(lmc_softc_t *sc);
|
||||||
__be16 lmc_proto_type(lmc_softc_t *sc, struct sk_buff *skb);
|
__be16 lmc_proto_type(lmc_softc_t *sc, struct sk_buff *skb);
|
||||||
void lmc_proto_netif(lmc_softc_t *sc, struct sk_buff *skb);
|
void lmc_proto_netif(lmc_softc_t *sc, struct sk_buff *skb);
|
||||||
int lmc_skb_rawpackets(char *buf, char **start, off_t offset, int len, int unused);
|
|
||||||
|
static inline lmc_softc_t* dev_to_sc(struct net_device *dev)
|
||||||
|
{
|
||||||
|
return (lmc_softc_t *)dev_to_hdlc(dev)->priv;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef _LMC_VAR_H_
|
#ifndef _LMC_VAR_H_
|
||||||
#define _LMC_VAR_H_
|
#define _LMC_VAR_H_
|
||||||
|
|
||||||
/* $Id: lmc_var.h,v 1.17 2000/04/06 12:16:47 asj Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997-2000 LAN Media Corporation (LMC)
|
* Copyright (c) 1997-2000 LAN Media Corporation (LMC)
|
||||||
* All rights reserved. www.lanmedia.com
|
* All rights reserved. www.lanmedia.com
|
||||||
|
@ -19,23 +17,6 @@
|
||||||
|
|
||||||
#include <linux/timer.h>
|
#include <linux/timer.h>
|
||||||
|
|
||||||
#ifndef __KERNEL__
|
|
||||||
typedef signed char s8;
|
|
||||||
typedef unsigned char u8;
|
|
||||||
|
|
||||||
typedef signed short s16;
|
|
||||||
typedef unsigned short u16;
|
|
||||||
|
|
||||||
typedef signed int s32;
|
|
||||||
typedef unsigned int u32;
|
|
||||||
|
|
||||||
typedef signed long long s64;
|
|
||||||
typedef unsigned long long u64;
|
|
||||||
|
|
||||||
#define BITS_PER_LONG 32
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* basic definitions used in lmc include files
|
* basic definitions used in lmc include files
|
||||||
*/
|
*/
|
||||||
|
@ -45,9 +26,6 @@ typedef struct lmc___media lmc_media_t;
|
||||||
typedef struct lmc___ctl lmc_ctl_t;
|
typedef struct lmc___ctl lmc_ctl_t;
|
||||||
|
|
||||||
#define lmc_csrptr_t unsigned long
|
#define lmc_csrptr_t unsigned long
|
||||||
#define u_int16_t u16
|
|
||||||
#define u_int8_t u8
|
|
||||||
#define tulip_uint32_t u32
|
|
||||||
|
|
||||||
#define LMC_REG_RANGE 0x80
|
#define LMC_REG_RANGE 0x80
|
||||||
|
|
||||||
|
@ -244,46 +222,8 @@ struct lmc___media {
|
||||||
|
|
||||||
#define STATCHECK 0xBEEFCAFE
|
#define STATCHECK 0xBEEFCAFE
|
||||||
|
|
||||||
/* Included in this structure are first
|
struct lmc_extra_statistics
|
||||||
* - standard net_device_stats
|
|
||||||
* - some other counters used for debug and driver performance
|
|
||||||
* evaluation -baz
|
|
||||||
*/
|
|
||||||
struct lmc_statistics
|
|
||||||
{
|
{
|
||||||
unsigned long rx_packets; /* total packets received */
|
|
||||||
unsigned long tx_packets; /* total packets transmitted */
|
|
||||||
unsigned long rx_bytes;
|
|
||||||
unsigned long tx_bytes;
|
|
||||||
|
|
||||||
unsigned long rx_errors; /* bad packets received */
|
|
||||||
unsigned long tx_errors; /* packet transmit problems */
|
|
||||||
unsigned long rx_dropped; /* no space in linux buffers */
|
|
||||||
unsigned long tx_dropped; /* no space available in linux */
|
|
||||||
unsigned long multicast; /* multicast packets received */
|
|
||||||
unsigned long collisions;
|
|
||||||
|
|
||||||
/* detailed rx_errors: */
|
|
||||||
unsigned long rx_length_errors;
|
|
||||||
unsigned long rx_over_errors; /* receiver ring buff overflow */
|
|
||||||
unsigned long rx_crc_errors; /* recved pkt with crc error */
|
|
||||||
unsigned long rx_frame_errors; /* recv'd frame alignment error */
|
|
||||||
unsigned long rx_fifo_errors; /* recv'r fifo overrun */
|
|
||||||
unsigned long rx_missed_errors; /* receiver missed packet */
|
|
||||||
|
|
||||||
/* detailed tx_errors */
|
|
||||||
unsigned long tx_aborted_errors;
|
|
||||||
unsigned long tx_carrier_errors;
|
|
||||||
unsigned long tx_fifo_errors;
|
|
||||||
unsigned long tx_heartbeat_errors;
|
|
||||||
unsigned long tx_window_errors;
|
|
||||||
|
|
||||||
/* for cslip etc */
|
|
||||||
unsigned long rx_compressed;
|
|
||||||
unsigned long tx_compressed;
|
|
||||||
|
|
||||||
/* -------------------------------------
|
|
||||||
* Custom stats & counters follow -baz */
|
|
||||||
u_int32_t version_size;
|
u_int32_t version_size;
|
||||||
u_int32_t lmc_cardtype;
|
u_int32_t lmc_cardtype;
|
||||||
|
|
||||||
|
@ -325,27 +265,26 @@ struct lmc_statistics
|
||||||
u_int32_t check;
|
u_int32_t check;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct lmc_xinfo {
|
typedef struct lmc_xinfo {
|
||||||
u_int32_t Magic0; /* BEEFCAFE */
|
u_int32_t Magic0; /* BEEFCAFE */
|
||||||
|
|
||||||
u_int32_t PciCardType;
|
u_int32_t PciCardType;
|
||||||
u_int32_t PciSlotNumber; /* PCI slot number */
|
u_int32_t PciSlotNumber; /* PCI slot number */
|
||||||
|
|
||||||
u_int16_t DriverMajorVersion;
|
u16 DriverMajorVersion;
|
||||||
u_int16_t DriverMinorVersion;
|
u16 DriverMinorVersion;
|
||||||
u_int16_t DriverSubVersion;
|
u16 DriverSubVersion;
|
||||||
|
|
||||||
u_int16_t XilinxRevisionNumber;
|
u16 XilinxRevisionNumber;
|
||||||
u_int16_t MaxFrameSize;
|
u16 MaxFrameSize;
|
||||||
|
|
||||||
u_int16_t t1_alarm1_status;
|
u16 t1_alarm1_status;
|
||||||
u_int16_t t1_alarm2_status;
|
u16 t1_alarm2_status;
|
||||||
|
|
||||||
int link_status;
|
int link_status;
|
||||||
u_int32_t mii_reg16;
|
u_int32_t mii_reg16;
|
||||||
|
|
||||||
u_int32_t Magic1; /* DEADBEEF */
|
u_int32_t Magic1; /* DEADBEEF */
|
||||||
} LMC_XINFO;
|
} LMC_XINFO;
|
||||||
|
|
||||||
|
|
||||||
|
@ -353,11 +292,10 @@ typedef struct lmc_xinfo {
|
||||||
* forward decl
|
* forward decl
|
||||||
*/
|
*/
|
||||||
struct lmc___softc {
|
struct lmc___softc {
|
||||||
void *if_ptr; /* General purpose pointer (used by SPPP) */
|
|
||||||
char *name;
|
char *name;
|
||||||
u8 board_idx;
|
u8 board_idx;
|
||||||
struct lmc_statistics stats;
|
struct lmc_extra_statistics extra_stats;
|
||||||
struct net_device *lmc_device;
|
struct net_device *lmc_device;
|
||||||
|
|
||||||
int hang, rxdesc, bad_packet, some_counter;
|
int hang, rxdesc, bad_packet, some_counter;
|
||||||
u_int32_t txgo;
|
u_int32_t txgo;
|
||||||
|
@ -381,7 +319,7 @@ struct lmc___softc {
|
||||||
unsigned int lmc_taint_tx, lmc_taint_rx;
|
unsigned int lmc_taint_tx, lmc_taint_rx;
|
||||||
int lmc_tx_start, lmc_txfull;
|
int lmc_tx_start, lmc_txfull;
|
||||||
int lmc_txbusy;
|
int lmc_txbusy;
|
||||||
u_int16_t lmc_miireg16;
|
u16 lmc_miireg16;
|
||||||
int lmc_ok;
|
int lmc_ok;
|
||||||
int last_link_status;
|
int last_link_status;
|
||||||
int lmc_cardtype;
|
int lmc_cardtype;
|
||||||
|
@ -408,8 +346,7 @@ struct lmc___softc {
|
||||||
u32 num_int;
|
u32 num_int;
|
||||||
|
|
||||||
spinlock_t lmc_lock;
|
spinlock_t lmc_lock;
|
||||||
u_int16_t if_type; /* PPP or NET */
|
u16 if_type; /* HDLC/PPP or NET */
|
||||||
struct ppp_device *pd;
|
|
||||||
|
|
||||||
/* Failure cases */
|
/* Failure cases */
|
||||||
u8 failed_ring;
|
u8 failed_ring;
|
||||||
|
@ -525,46 +462,9 @@ struct lmc___softc {
|
||||||
#define LMC_ADAP_SSI 4
|
#define LMC_ADAP_SSI 4
|
||||||
#define LMC_ADAP_T1 5
|
#define LMC_ADAP_T1 5
|
||||||
|
|
||||||
#define HDLC_HDR_LEN 4
|
|
||||||
#define HDLC_ADDR_LEN 1
|
|
||||||
#define HDLC_SLARP 0x8035
|
|
||||||
#define LMC_MTU 1500
|
#define LMC_MTU 1500
|
||||||
#define SLARP_LINECHECK 2
|
|
||||||
|
|
||||||
#define LMC_CRC_LEN_16 2 /* 16-bit CRC */
|
#define LMC_CRC_LEN_16 2 /* 16-bit CRC */
|
||||||
#define LMC_CRC_LEN_32 4
|
#define LMC_CRC_LEN_32 4
|
||||||
|
|
||||||
#ifdef LMC_HDLC
|
|
||||||
/* definition of an hdlc header. */
|
|
||||||
struct hdlc_hdr
|
|
||||||
{
|
|
||||||
u8 address;
|
|
||||||
u8 control;
|
|
||||||
u16 type;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* definition of a slarp header. */
|
|
||||||
struct slarp
|
|
||||||
{
|
|
||||||
long code;
|
|
||||||
union sl
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
ulong address;
|
|
||||||
ulong mask;
|
|
||||||
ushort unused;
|
|
||||||
} add;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
ulong mysequence;
|
|
||||||
ulong yoursequence;
|
|
||||||
ushort reliability;
|
|
||||||
ulong time;
|
|
||||||
} chk;
|
|
||||||
} t;
|
|
||||||
};
|
|
||||||
#endif /* LMC_HDLC */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _LMC_VAR_H_ */
|
#endif /* _LMC_VAR_H_ */
|
||||||
|
|
Loading…
Reference in New Issue