From 4db3af5c739b99ec1edf38f074a4b6e6717b02b1 Mon Sep 17 00:00:00 2001 From: Esben Nielsen Date: Tue, 23 Nov 2004 07:54:43 -0800 Subject: [ARCNET]: Fixes. As previously reported the ArcNet driver didn't work with Preempt and SMB on. They do now. I have changed the locking system from being a global arcnet lock to being a lock per device. I used the lock in dev->hard_start_xmit = arcnet_send_packet. Furthermore I added the 'CAP mode' encapsulation. As far as I see it it is the only encapsulation which actually makes ArcNet usefull over ethernet. Previously, the driver just ignored the hardware transmit status, now you can get hardware acknowledge and excessive nacks back to userspace via a raw socket. The capmode.c is nearly just a copy of arc-rawmode.c. The difference is that it inserts a ack_tx() handle into the general driver framework. Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- include/linux/arcdevice.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'include/linux/arcdevice.h') diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h index 9d2429f07a64..bd4364daf948 100644 --- a/include/linux/arcdevice.h +++ b/include/linux/arcdevice.h @@ -25,7 +25,6 @@ #define bool int #endif - /* * RECON_THRESHOLD is the maximum number of RECON messages to receive * within one minute before printing a "cabling problem" warning. The @@ -74,6 +73,7 @@ #define D_SKB 1024 /* show skb's */ #define D_SKB_SIZE 2048 /* show skb sizes */ #define D_TIMING 4096 /* show time needed to copy buffers to card */ +#define D_DEBUG 8192 /* Very detailed debug line for line */ #ifndef ARCNET_DEBUG_MAX #define ARCNET_DEBUG_MAX (127) /* change to ~0 if you want detailed debugging */ @@ -135,6 +135,7 @@ extern int arcnet_debug; #define TXACKflag 0x02 /* transmitted msg. ackd */ #define RECONflag 0x04 /* network reconfigured */ #define TESTflag 0x08 /* test flag */ +#define EXCNAKflag 0x08 /* excesive nak flag */ #define RESETflag 0x10 /* power-on-reset */ #define RES1flag 0x20 /* reserved - usually set by jumper */ #define RES2flag 0x40 /* reserved - usually set by jumper */ @@ -162,6 +163,8 @@ extern int arcnet_debug; #define RESETclear 0x08 /* power-on-reset */ #define CONFIGclear 0x10 /* system reconfigured */ +#define EXCNAKclear 0x0E /* Clear and acknowledge the excive nak bit */ + /* flags for "load test flags" command */ #define TESTload 0x08 /* test flag (diagnostic) */ @@ -187,6 +190,7 @@ extern int arcnet_debug; struct ArcProto { char suffix; /* a for RFC1201, e for ether-encap, etc. */ int mtu; /* largest possible packet */ + int is_ip; /* This is a ip plugin - not a raw thing */ void (*rx) (struct net_device * dev, int bufnum, struct archdr * pkthdr, int length); @@ -197,9 +201,11 @@ struct ArcProto { int (*prepare_tx) (struct net_device * dev, struct archdr * pkt, int length, int bufnum); int (*continue_tx) (struct net_device * dev, int bufnum); + int (*ack_tx) (struct net_device * dev, int acked); }; -extern struct ArcProto *arc_proto_map[256], *arc_proto_default, *arc_bcast_proto; +extern struct ArcProto *arc_proto_map[256], *arc_proto_default, + *arc_bcast_proto, *arc_raw_proto; extern struct ArcProto arc_proto_null; @@ -251,6 +257,10 @@ struct arcnet_local { char *card_name; /* card ident string */ int card_flags; /* special card features */ + + /* On preemtive and SMB a lock is needed */ + spinlock_t lock; + /* * Buffer management: an ARCnet card has 4 x 512-byte buffers, each of * which can be used for either sending or receiving. The new dynamic @@ -279,6 +289,8 @@ struct arcnet_local { int num_recons; /* number of RECONs between first and last. */ bool network_down; /* do we think the network is down? */ + bool excnak_pending; /* We just got an excesive nak interrupt */ + struct { uint16_t sequence; /* sequence number (incs with each packet) */ uint16_t aborted_seq; @@ -323,9 +335,10 @@ void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc); #endif #if (ARCNET_DEBUG_MAX & D_RX) || (ARCNET_DEBUG_MAX & D_TX) -void arcnet_dump_packet(struct net_device *dev, int bufnum, char *desc); +void arcnet_dump_packet(struct net_device *dev, int bufnum, char *desc, + int take_arcnet_lock); #else -#define arcnet_dump_packet(dev, bufnum, desc) ; +#define arcnet_dump_packet(dev, bufnum, desc,take_arcnet_lock) ; #endif void arcnet_unregister_proto(struct ArcProto *proto); -- cgit v1.2.3