Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lcs.h
Go to the documentation of this file.
1 /*lcs.h*/
2 
3 #include <linux/interrupt.h>
4 #include <linux/netdevice.h>
5 #include <linux/skbuff.h>
6 #include <linux/workqueue.h>
7 #include <asm/ccwdev.h>
8 
9 #define LCS_DBF_TEXT(level, name, text) \
10  do { \
11  debug_text_event(lcs_dbf_##name, level, text); \
12  } while (0)
13 
14 #define LCS_DBF_HEX(level,name,addr,len) \
15 do { \
16  debug_event(lcs_dbf_##name,level,(void*)(addr),len); \
17 } while (0)
18 
19 /* Allow to sort out low debug levels early to avoid wasted sprints */
20 static inline int lcs_dbf_passes(debug_info_t *dbf_grp, int level)
21 {
22  return (level <= dbf_grp->level);
23 }
24 
25 #define LCS_DBF_TEXT_(level,name,text...) \
26  do { \
27  if (lcs_dbf_passes(lcs_dbf_##name, level)) { \
28  sprintf(debug_buffer, text); \
29  debug_text_event(lcs_dbf_##name, level, debug_buffer); \
30  } \
31  } while (0)
32 
36 #define CARD_FROM_DEV(cdev) \
37  (struct lcs_card *) dev_get_drvdata( \
38  &((struct ccwgroup_device *)dev_get_drvdata(&cdev->dev))->dev);
39 
44  /* Device is not a channel */
46 
47  /* Device is a 2216 channel */
49 
50  /* Device is a 2216 channel */
52 
53  /* Device is a OSA2 card */
55 };
56 
60 #define LCS_CCW_WRITE 0x01
61 #define LCS_CCW_READ 0x02
62 #define LCS_CCW_TRANSFER 0x08
63 
67 #define LCS_CMD_STARTLAN 0x01
68 #define LCS_CMD_STOPLAN 0x02
69 #define LCS_CMD_LANSTAT 0x04
70 #define LCS_CMD_STARTUP 0x07
71 #define LCS_CMD_SHUTDOWN 0x08
72 #define LCS_CMD_QIPASSIST 0xb2
73 #define LCS_CMD_SETIPM 0xb4
74 #define LCS_CMD_DELIPM 0xb5
75 
76 #define LCS_INITIATOR_TCPIP 0x00
77 #define LCS_INITIATOR_LGW 0x01
78 #define LCS_STD_CMD_SIZE 16
79 #define LCS_MULTICAST_CMD_SIZE 404
80 
84 /* Not supported by LCS */
85 #define LCS_IPASS_ARP_PROCESSING 0x0001
86 #define LCS_IPASS_IN_CHECKSUM_SUPPORT 0x0002
87 #define LCS_IPASS_OUT_CHECKSUM_SUPPORT 0x0004
88 #define LCS_IPASS_IP_FRAG_REASSEMBLY 0x0008
89 #define LCS_IPASS_IP_FILTERING 0x0010
90 /* Supported by lcs 3172 */
91 #define LCS_IPASS_IPV6_SUPPORT 0x0020
92 #define LCS_IPASS_MULTICAST_SUPPORT 0x0040
93 
97 #define LCS_SENSE_BYTE_0 0
98 #define LCS_SENSE_BYTE_1 1
99 #define LCS_SENSE_BYTE_2 2
100 #define LCS_SENSE_BYTE_3 3
101 #define LCS_SENSE_INTERFACE_DISCONNECT 0x01
102 #define LCS_SENSE_EQUIPMENT_CHECK 0x10
103 #define LCS_SENSE_BUS_OUT_CHECK 0x20
104 #define LCS_SENSE_INTERVENTION_REQUIRED 0x40
105 #define LCS_SENSE_CMD_REJECT 0x80
106 #define LCS_SENSE_RESETTING_EVENT 0x80
107 #define LCS_SENSE_DEVICE_ONLINE 0x20
108 
112 #define LCS_FRAME_TYPE_CONTROL 0
113 #define LCS_FRAME_TYPE_ENET 1
114 #define LCS_FRAME_TYPE_TR 2
115 #define LCS_FRAME_TYPE_FDDI 7
116 #define LCS_FRAME_TYPE_AUTO -1
117 
121 #define LCS_ILLEGAL_OFFSET 0xffff
122 #define LCS_IOBUFFERSIZE 0x5000
123 #define LCS_NUM_BUFFS 32 /* needs to be power of 2 */
124 #define LCS_MAC_LENGTH 6
125 #define LCS_INVALID_PORT_NO -1
126 #define LCS_LANCMD_TIMEOUT_DEFAULT 5
127 
131 #define LCS_IPM_STATE_SET_REQUIRED 0
132 #define LCS_IPM_STATE_DEL_REQUIRED 1
133 #define LCS_IPM_STATE_ON_CARD 2
134 
139 #define LCS_IPASS_ARP_PROCESSING 0x0001
140 #define LCS_IPASS_INBOUND_CSUM_SUPP 0x0002
141 #define LCS_IPASS_OUTBOUND_CSUM_SUPP 0x0004
142 #define LCS_IPASS_IP_FRAG_REASSEMBLY 0x0008
143 #define LCS_IPASS_IP_FILTERING 0x0010
144 #define LCS_IPASS_IPV6_SUPPORT 0x0020
145 #define LCS_IPASS_MULTICAST_SUPPORT 0x0040
146 
151  LCS_BUF_STATE_EMPTY, /* buffer is empty */
152  LCS_BUF_STATE_LOCKED, /* buffer is locked, don't touch */
153  LCS_BUF_STATE_READY, /* buffer is ready for read/write */
155 };
156 
168 };
169 
177 };
178 
182 };
183 
187 struct lcs_header {
191 } __attribute__ ((packed));
197 } __attribute__ ((packed));
199 struct lcs_ipm_list {
200  struct list_head list;
203 };
204 
205 struct lcs_cmd {
213  union {
214  struct {
220  } lcs_std_cmd;
221  struct {
225  } lcs_startup;
226  struct {
227  __u8 lan_type;
228  __u8 portno;
240  } lcs_lanstat_cmd;
241 #ifdef CONFIG_IP_MULTICAST
242  struct {
243  __u8 lan_type;
244  __u8 portno;
245  __u16 num_ip_pairs;
248  __u16 version;
249  struct {
250  struct lcs_ip_mac_pair
251  ip_mac_pair[32];
252  __u32 response_data;
253  } lcs_ipass_ctlmsg __attribute ((packed));
254  } lcs_qipassist __attribute__ ((packed));
255 #endif /*CONFIG_IP_MULTICAST */
256  } cmd __attribute__ ((packed));
257 } __attribute__ ((packed));
262 struct lcs_card;
263 struct lcs_channel;
268 struct lcs_buffer {
270  void *data;
271  int count;
272  /* Callback for completion notification. */
273  void (*callback)(struct lcs_channel *, struct lcs_buffer *);
274 };
276 struct lcs_reply {
277  struct list_head list;
280  /* Callback for completion notification. */
281  void (*callback)(struct lcs_card *, struct lcs_cmd *);
283  struct lcs_card *card;
284  int received;
285  int rc;
286 };
287 
291 struct lcs_channel {
294  struct ccw1 ccws[LCS_NUM_BUFFS + 1];
298  int io_idx;
299  int buf_idx;
300 };
301 
302 
306 struct lcs_card {
310  struct net_device *dev;
313  struct net_device *dev);
321 
324  unsigned long thread_start_mask;
325  unsigned long thread_running_mask;
326  unsigned long thread_allowed_mask;
328 
329 #ifdef CONFIG_IP_MULTICAST
330  struct list_head ipm_list;
331 #endif
339  /* Some info copied from probeinfo */
344 } __attribute__ ((aligned(8)));