Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block
[linux-2.6] / drivers / s390 / net / qeth_fs.h
1 /*
2  * linux/drivers/s390/net/qeth_fs.h
3  *
4  * Linux on zSeries OSA Express and HiperSockets support.
5  *
6  * This header file contains definitions related to sysfs and procfs.
7  *
8  * Copyright 2000,2003 IBM Corporation
9  * Author(s): Thomas Spatzier <tspat@de.ibm.com>
10  *
11  */
12 #ifndef __QETH_FS_H__
13 #define __QETH_FS_H__
14
15 #ifdef CONFIG_PROC_FS
16 extern int
17 qeth_create_procfs_entries(void);
18
19 extern void
20 qeth_remove_procfs_entries(void);
21 #else
22 static inline int
23 qeth_create_procfs_entries(void)
24 {
25         return 0;
26 }
27
28 static inline void
29 qeth_remove_procfs_entries(void)
30 {
31 }
32 #endif /* CONFIG_PROC_FS */
33
34 extern int
35 qeth_create_device_attributes(struct device *dev);
36
37 extern void
38 qeth_remove_device_attributes(struct device *dev);
39
40 extern int
41 qeth_create_device_attributes_osn(struct device *dev);
42
43 extern void
44 qeth_remove_device_attributes_osn(struct device *dev);
45
46 extern int
47 qeth_create_driver_attributes(void);
48
49 extern void
50 qeth_remove_driver_attributes(void);
51
52 /*
53  * utility functions used in qeth_proc.c and qeth_sys.c
54  */
55
56 static inline const char *
57 qeth_get_checksum_str(struct qeth_card *card)
58 {
59         if (card->options.checksum_type == SW_CHECKSUMMING)
60                 return "sw";
61         else if (card->options.checksum_type == HW_CHECKSUMMING)
62                 return "hw";
63         else
64                 return "no";
65 }
66
67 static inline const char *
68 qeth_get_prioq_str(struct qeth_card *card, char *buf)
69 {
70         if (card->qdio.do_prio_queueing == QETH_NO_PRIO_QUEUEING)
71                 sprintf(buf, "always_q_%i", card->qdio.default_out_queue);
72         else
73                 strcpy(buf, (card->qdio.do_prio_queueing ==
74                                         QETH_PRIO_Q_ING_PREC)?
75                                 "by_prec." : "by_ToS");
76         return buf;
77 }
78
79 static inline const char *
80 qeth_get_bufsize_str(struct qeth_card *card)
81 {
82         if (card->qdio.in_buf_size == 16384)
83                 return "16k";
84         else if (card->qdio.in_buf_size == 24576)
85                 return "24k";
86         else if (card->qdio.in_buf_size == 32768)
87                 return "32k";
88         else if (card->qdio.in_buf_size == 40960)
89                 return "40k";
90         else
91                 return "64k";
92 }
93
94 static inline const char *
95 qeth_get_cardname(struct qeth_card *card)
96 {
97         if (card->info.guestlan) {
98                 switch (card->info.type) {
99                 case QETH_CARD_TYPE_OSAE:
100                         return " Guest LAN QDIO";
101                 case QETH_CARD_TYPE_IQD:
102                         return " Guest LAN Hiper";
103                 default:
104                         return " unknown";
105                 }
106         } else {
107                 switch (card->info.type) {
108                 case QETH_CARD_TYPE_OSAE:
109                         return " OSD Express";
110                 case QETH_CARD_TYPE_IQD:
111                         return " HiperSockets";
112                 case QETH_CARD_TYPE_OSN:
113                         return " OSN QDIO";
114                 default:
115                         return " unknown";
116                 }
117         }
118         return " n/a";
119 }
120
121 /* max length to be returned: 14 */
122 static inline const char *
123 qeth_get_cardname_short(struct qeth_card *card)
124 {
125         if (card->info.guestlan){
126                 switch (card->info.type){
127                 case QETH_CARD_TYPE_OSAE:
128                         return "GuestLAN QDIO";
129                 case QETH_CARD_TYPE_IQD:
130                         return "GuestLAN Hiper";
131                 default:
132                         return "unknown";
133                 }
134         } else {
135                 switch (card->info.type) {
136                 case QETH_CARD_TYPE_OSAE:
137                         switch (card->info.link_type) {
138                         case QETH_LINK_TYPE_FAST_ETH:
139                                 return "OSD_100";
140                         case QETH_LINK_TYPE_HSTR:
141                                 return "HSTR";
142                         case QETH_LINK_TYPE_GBIT_ETH:
143                                 return "OSD_1000";
144                         case QETH_LINK_TYPE_10GBIT_ETH:
145                                 return "OSD_10GIG";
146                         case QETH_LINK_TYPE_LANE_ETH100:
147                                 return "OSD_FE_LANE";
148                         case QETH_LINK_TYPE_LANE_TR:
149                                 return "OSD_TR_LANE";
150                         case QETH_LINK_TYPE_LANE_ETH1000:
151                                 return "OSD_GbE_LANE";
152                         case QETH_LINK_TYPE_LANE:
153                                 return "OSD_ATM_LANE";
154                         default:
155                                 return "OSD_Express";
156                         }
157                 case QETH_CARD_TYPE_IQD:
158                         return "HiperSockets";
159                 case QETH_CARD_TYPE_OSN:
160                         return "OSN";
161                 default:
162                         return "unknown";
163                 }
164         }
165         return "n/a";
166 }
167
168 #endif /* __QETH_FS_H__ */