fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / s390 / net / lcs.h
index 36d9ebd..0e1e4a0 100644 (file)
@@ -6,8 +6,6 @@
 #include <linux/workqueue.h>
 #include <asm/ccwdev.h>
 
-#define VERSION_LCS_H "$Revision: 1.16 $"
-
 #define LCS_DBF_TEXT(level, name, text) \
        do { \
                debug_text_event(lcs_dbf_##name, level, text); \
@@ -24,11 +22,6 @@ do {                                       \
                debug_text_event(lcs_dbf_##name,level, debug_buffer);\
 } while (0)
 
-/**
- * some more definitions for debug or output stuff
- */
-#define PRINTK_HEADER          " lcs: "
-
 /**
  *     sysfs related stuff
  */
@@ -75,13 +68,17 @@ do {                                       \
 /**
  * LCS sense byte definitions
  */
+#define LCS_SENSE_BYTE_0               0
+#define LCS_SENSE_BYTE_1               1
+#define LCS_SENSE_BYTE_2               2
+#define LCS_SENSE_BYTE_3               3
 #define LCS_SENSE_INTERFACE_DISCONNECT 0x01
 #define LCS_SENSE_EQUIPMENT_CHECK      0x10
 #define LCS_SENSE_BUS_OUT_CHECK                0x20
 #define LCS_SENSE_INTERVENTION_REQUIRED 0x40
 #define LCS_SENSE_CMD_REJECT           0x80
-#define LCS_SENSE_RESETTING_EVENT      0x0080
-#define LCS_SENSE_DEVICE_ONLINE                0x0020
+#define LCS_SENSE_RESETTING_EVENT      0x80
+#define LCS_SENSE_DEVICE_ONLINE                0x20
 
 /**
  * LCS packet type definitions
@@ -97,7 +94,7 @@ do {                                       \
  */
 #define LCS_ILLEGAL_OFFSET             0xffff
 #define LCS_IOBUFFERSIZE               0x5000
-#define LCS_NUM_BUFFS                        /* needs to be power of 2 */
+#define LCS_NUM_BUFFS                  32      /* needs to be power of 2 */
 #define LCS_MAC_LENGTH                 6
 #define LCS_INVALID_PORT_NO            -1
 #define LCS_LANCMD_TIMEOUT_DEFAULT      5
@@ -125,22 +122,22 @@ do {                                       \
  * LCS Buffer states
  */
 enum lcs_buffer_states {
-       BUF_STATE_EMPTY,        /* buffer is empty */
-       BUF_STATE_LOCKED,       /* buffer is locked, don't touch */
-       BUF_STATE_READY,        /* buffer is ready for read/write */
-       BUF_STATE_PROCESSED,
+       LCS_BUF_STATE_EMPTY,    /* buffer is empty */
+       LCS_BUF_STATE_LOCKED,   /* buffer is locked, don't touch */
+       LCS_BUF_STATE_READY,    /* buffer is ready for read/write */
+       LCS_BUF_STATE_PROCESSED,
 };
 
 /**
  * LCS Channel State Machine declarations
  */
 enum lcs_channel_states {
-       CH_STATE_INIT,
-       CH_STATE_HALTED,
-       CH_STATE_STOPPED,
-       CH_STATE_RUNNING,
-       CH_STATE_SUSPENDED,
-       CH_STATE_CLEARED,
+       LCS_CH_STATE_INIT,
+       LCS_CH_STATE_HALTED,
+       LCS_CH_STATE_STOPPED,
+       LCS_CH_STATE_RUNNING,
+       LCS_CH_STATE_SUSPENDED,
+       LCS_CH_STATE_CLEARED,
 };
 
 /**
@@ -152,6 +149,11 @@ enum lcs_dev_states {
        DEV_STATE_RECOVER,
 };
 
+enum lcs_threads {
+       LCS_SET_MC_THREAD       = 1,
+       LCS_RECOVERY_THREAD     = 2,
+};
+
 /**
  * LCS struct declarations
  */
@@ -162,7 +164,7 @@ struct lcs_header {
 }  __attribute__ ((packed));
 
 struct lcs_ip_mac_pair {
-       __u32  ip_addr;
+       __be32  ip_addr;
        __u8   mac_addr[LCS_MAC_LENGTH];
        __u8   reserved[2];
 }  __attribute__ ((packed));
@@ -221,8 +223,8 @@ struct lcs_cmd {
                                struct lcs_ip_mac_pair
                                ip_mac_pair[32];
                                __u32     response_data;
-                       } lcs_ipass_ctlmsg;
-               } lcs_qipassist;
+                       } lcs_ipass_ctlmsg __attribute ((packed));
+               } lcs_qipassist __attribute__ ((packed));
 #endif /*CONFIG_IP_MULTICAST */
        } cmd __attribute__ ((packed));
 }  __attribute__ ((packed));
@@ -247,9 +249,11 @@ struct lcs_buffer {
 struct lcs_reply {
        struct list_head list;
        __u16 sequence_no;
+       atomic_t refcnt;
        /* Callback for completion notification. */
        void (*callback)(struct lcs_card *, struct lcs_cmd *);
        wait_queue_head_t wait_q;
+       struct lcs_card *card;
        int received;
        int rc;
 };
@@ -268,6 +272,7 @@ struct lcs_channel {
        int buf_idx;
 };
 
+
 /**
  * definition of the lcs card
  */
@@ -277,8 +282,9 @@ struct lcs_card {
        enum lcs_dev_states state;
        struct net_device *dev;
        struct net_device_stats stats;
-       unsigned short (*lan_type_trans)(struct sk_buff *skb,
+       __be16 (*lan_type_trans)(struct sk_buff *skb,
                                         struct net_device *dev);
+       struct ccwgroup_device *gdev;
        struct lcs_channel read;
        struct lcs_channel write;
        struct lcs_buffer *tx_buffer;
@@ -287,7 +293,11 @@ struct lcs_card {
        int lancmd_timeout;
 
        struct work_struct kernel_thread_starter;
-       unsigned long thread_mask;
+       spinlock_t mask_lock;
+       unsigned long thread_start_mask;
+       unsigned long thread_running_mask;
+       unsigned long thread_allowed_mask;
+       wait_queue_head_t wait_q;
 
 #ifdef CONFIG_IP_MULTICAST
        struct list_head ipm_list;
@@ -296,6 +306,7 @@ struct lcs_card {
        __u16 ip_assists_supported;
        __u16 ip_assists_enabled;
        __s8 lan_type;
+       __u32 pkt_seq;
        __u16 sequence_no;
        __s16 portno;
        /* Some info copied from probeinfo */