5 #include <linux/if_arp.h>
7 #include <linux/if_tr.h>
8 #include <linux/trdevice.h>
9 #include <linux/etherdevice.h>
10 #include <linux/if_vlan.h>
13 #include <linux/in6.h>
14 #include <net/if_inet6.h>
15 #include <net/addrconf.h>
18 #include <asm/bitops.h>
19 #include <asm/debug.h>
21 #include <asm/ccwdev.h>
22 #include <asm/ccwgroup.h>
26 #define VERSION_QETH_H "$Revision: 1.102 $"
28 #ifdef CONFIG_QETH_IPV6
29 #define QETH_VERSION_IPV6 ":IPv6"
31 #define QETH_VERSION_IPV6 ""
33 #ifdef CONFIG_QETH_VLAN
34 #define QETH_VERSION_VLAN ":VLAN"
36 #define QETH_VERSION_VLAN ""
40 * Debug Facility stuff
42 #define QETH_DBF_SETUP_NAME "qeth_setup"
43 #define QETH_DBF_SETUP_LEN 8
44 #define QETH_DBF_SETUP_INDEX 3
45 #define QETH_DBF_SETUP_NR_AREAS 1
46 #define QETH_DBF_SETUP_LEVEL 3
48 #define QETH_DBF_MISC_NAME "qeth_misc"
49 #define QETH_DBF_MISC_LEN 128
50 #define QETH_DBF_MISC_INDEX 1
51 #define QETH_DBF_MISC_NR_AREAS 1
52 #define QETH_DBF_MISC_LEVEL 2
54 #define QETH_DBF_DATA_NAME "qeth_data"
55 #define QETH_DBF_DATA_LEN 96
56 #define QETH_DBF_DATA_INDEX 3
57 #define QETH_DBF_DATA_NR_AREAS 1
58 #define QETH_DBF_DATA_LEVEL 2
60 #define QETH_DBF_CONTROL_NAME "qeth_control"
61 #define QETH_DBF_CONTROL_LEN 256
62 #define QETH_DBF_CONTROL_INDEX 3
63 #define QETH_DBF_CONTROL_NR_AREAS 2
64 #define QETH_DBF_CONTROL_LEVEL 2
66 #define QETH_DBF_TRACE_NAME "qeth_trace"
67 #define QETH_DBF_TRACE_LEN 8
68 #define QETH_DBF_TRACE_INDEX 2
69 #define QETH_DBF_TRACE_NR_AREAS 2
70 #define QETH_DBF_TRACE_LEVEL 3
72 #define QETH_DBF_SENSE_NAME "qeth_sense"
73 #define QETH_DBF_SENSE_LEN 64
74 #define QETH_DBF_SENSE_INDEX 1
75 #define QETH_DBF_SENSE_NR_AREAS 1
76 #define QETH_DBF_SENSE_LEVEL 2
78 #define QETH_DBF_QERR_NAME "qeth_qerr"
79 #define QETH_DBF_QERR_LEN 8
80 #define QETH_DBF_QERR_INDEX 1
81 #define QETH_DBF_QERR_NR_AREAS 2
82 #define QETH_DBF_QERR_LEVEL 2
84 #define QETH_DBF_TEXT(name,level,text) \
86 debug_text_event(qeth_dbf_##name,level,text); \
89 #define QETH_DBF_HEX(name,level,addr,len) \
91 debug_event(qeth_dbf_##name,level,(void*)(addr),len); \
94 #define QETH_DBF_TEXT_(name,level,text...) \
96 sprintf(qeth_dbf_text_buf, text); \
97 debug_text_event(qeth_dbf_##name,level,qeth_dbf_text_buf);\
100 #define QETH_DBF_SPRINTF(name,level,text...) \
102 debug_sprintf_event(qeth_dbf_trace, level, ##text ); \
103 debug_sprintf_event(qeth_dbf_trace, level, text ); \
107 * some more debug stuff
109 #define PRINTK_HEADER "qeth: "
111 #define HEXDUMP16(importance,header,ptr) \
112 PRINT_##importance(header "%02x %02x %02x %02x %02x %02x %02x %02x " \
113 "%02x %02x %02x %02x %02x %02x %02x %02x\n", \
114 *(((char*)ptr)),*(((char*)ptr)+1),*(((char*)ptr)+2), \
115 *(((char*)ptr)+3),*(((char*)ptr)+4),*(((char*)ptr)+5), \
116 *(((char*)ptr)+6),*(((char*)ptr)+7),*(((char*)ptr)+8), \
117 *(((char*)ptr)+9),*(((char*)ptr)+10),*(((char*)ptr)+11), \
118 *(((char*)ptr)+12),*(((char*)ptr)+13), \
119 *(((char*)ptr)+14),*(((char*)ptr)+15)); \
120 PRINT_##importance(header "%02x %02x %02x %02x %02x %02x %02x %02x " \
121 "%02x %02x %02x %02x %02x %02x %02x %02x\n", \
122 *(((char*)ptr)+16),*(((char*)ptr)+17), \
123 *(((char*)ptr)+18),*(((char*)ptr)+19), \
124 *(((char*)ptr)+20),*(((char*)ptr)+21), \
125 *(((char*)ptr)+22),*(((char*)ptr)+23), \
126 *(((char*)ptr)+24),*(((char*)ptr)+25), \
127 *(((char*)ptr)+26),*(((char*)ptr)+27), \
128 *(((char*)ptr)+28),*(((char*)ptr)+29), \
129 *(((char*)ptr)+30),*(((char*)ptr)+31));
132 qeth_hex_dump(unsigned char *buf, size_t len)
136 for (i = 0; i < len; i++) {
139 printk("%02x ", *(buf + i));
144 #define SENSE_COMMAND_REJECT_BYTE 0
145 #define SENSE_COMMAND_REJECT_FLAG 0x80
146 #define SENSE_RESETTING_EVENT_BYTE 1
147 #define SENSE_RESETTING_EVENT_FLAG 0x80
150 * Common IO related definitions
152 extern struct device *qeth_root_dev;
153 extern struct ccw_driver qeth_ccw_driver;
154 extern struct ccwgroup_driver qeth_ccwgroup_driver;
156 #define CARD_RDEV(card) card->read.ccwdev
157 #define CARD_WDEV(card) card->write.ccwdev
158 #define CARD_DDEV(card) card->data.ccwdev
159 #define CARD_BUS_ID(card) card->gdev->dev.bus_id
160 #define CARD_RDEV_ID(card) card->read.ccwdev->dev.bus_id
161 #define CARD_WDEV_ID(card) card->write.ccwdev->dev.bus_id
162 #define CARD_DDEV_ID(card) card->data.ccwdev->dev.bus_id
163 #define CHANNEL_ID(channel) channel->ccwdev->dev.bus_id
165 #define CARD_FROM_CDEV(cdev) (struct qeth_card *) \
166 ((struct ccwgroup_device *)cdev->dev.driver_data)\
172 #ifdef CONFIG_QETH_PERF_STATS
173 struct qeth_perf_stats {
174 unsigned int bufs_rec;
175 unsigned int bufs_sent;
177 unsigned int skbs_sent_pack;
178 unsigned int bufs_sent_pack;
180 unsigned int sc_dp_p;
181 unsigned int sc_p_dp;
183 __u64 inbound_start_time;
184 unsigned int inbound_cnt;
185 unsigned int inbound_time;
186 __u64 outbound_start_time;
187 unsigned int outbound_cnt;
188 unsigned int outbound_time;
190 #endif /* CONFIG_QETH_PERF_STATS */
193 struct qeth_routing_info {
194 enum qeth_routing_types type;
198 struct qeth_ipa_info {
199 __u32 supported_funcs;
204 qeth_is_ipa_supported(struct qeth_ipa_info *ipa, enum qeth_ipa_funcs func)
206 return (ipa->supported_funcs & func);
210 qeth_is_ipa_enabled(struct qeth_ipa_info *ipa, enum qeth_ipa_funcs func)
212 return (ipa->supported_funcs & ipa->enabled_funcs & func);
215 #define qeth_adp_supported(c,f) \
216 qeth_is_ipa_supported(&c->options.adp, f)
217 #define qeth_adp_enabled(c,f) \
218 qeth_is_ipa_enabled(&c->options.adp, f)
219 #define qeth_is_supported(c,f) \
220 qeth_is_ipa_supported(&c->options.ipa4, f)
221 #define qeth_is_enabled(c,f) \
222 qeth_is_ipa_enabled(&c->options.ipa4, f)
223 #ifdef CONFIG_QETH_IPV6
224 #define qeth_is_supported6(c,f) \
225 qeth_is_ipa_supported(&c->options.ipa6, f)
226 #define qeth_is_enabled6(c,f) \
227 qeth_is_ipa_enabled(&c->options.ipa6, f)
228 #else /* CONFIG_QETH_IPV6 */
229 #define qeth_is_supported6(c,f) 0
230 #define qeth_is_enabled6(c,f) 0
231 #endif /* CONFIG_QETH_IPV6 */
232 #define qeth_is_ipafunc_supported(c,prot,f) \
233 (prot==QETH_PROT_IPV6)? qeth_is_supported6(c,f):qeth_is_supported(c,f)
234 #define qeth_is_ipafunc_enabled(c,prot,f) \
235 (prot==QETH_PROT_IPV6)? qeth_is_enabled6(c,f):qeth_is_enabled(c,f)
238 #define QETH_IDX_FUNC_LEVEL_OSAE_ENA_IPAT 0x0101
239 #define QETH_IDX_FUNC_LEVEL_OSAE_DIS_IPAT 0x0101
240 #define QETH_IDX_FUNC_LEVEL_IQD_ENA_IPAT 0x4108
241 #define QETH_IDX_FUNC_LEVEL_IQD_DIS_IPAT 0x5108
243 #define QETH_MODELLIST_ARRAY \
244 {{0x1731,0x01,0x1732,0x01,QETH_CARD_TYPE_OSAE,1, \
245 QETH_IDX_FUNC_LEVEL_OSAE_ENA_IPAT, \
246 QETH_IDX_FUNC_LEVEL_OSAE_DIS_IPAT, \
247 QETH_MAX_QUEUES,0}, \
248 {0x1731,0x05,0x1732,0x05,QETH_CARD_TYPE_IQD,0, \
249 QETH_IDX_FUNC_LEVEL_IQD_ENA_IPAT, \
250 QETH_IDX_FUNC_LEVEL_IQD_DIS_IPAT, \
251 QETH_MAX_QUEUES,0x103}, \
254 #define QETH_REAL_CARD 1
255 #define QETH_VLAN_CARD 2
256 #define QETH_BUFSIZE 4096
261 #define IF_NAME_LEN 16
262 #define QETH_TX_TIMEOUT 100 * HZ
263 #define QETH_HEADER_SIZE 32
264 #define MAX_PORTNO 15
265 #define QETH_FAKE_LL_LEN ETH_HLEN
266 #define QETH_FAKE_LL_V6_ADDR_POS 24
268 /*IPv6 address autoconfiguration stuff*/
269 #define UNIQUE_ID_IF_CREATE_ADDR_FAILED 0xfffe
270 #define UNIQUE_ID_NOT_BY_CARD 0x10000
272 /*****************************************************************************/
273 /* QDIO queue and buffer handling */
274 /*****************************************************************************/
275 #define QETH_MAX_QUEUES 4
276 #define QETH_IN_BUF_SIZE_DEFAULT 65536
277 #define QETH_IN_BUF_COUNT_DEFAULT 16
278 #define QETH_IN_BUF_COUNT_MIN 8
279 #define QETH_IN_BUF_COUNT_MAX 128
280 #define QETH_MAX_BUFFER_ELEMENTS(card) ((card)->qdio.in_buf_size >> 12)
281 #define QETH_IN_BUF_REQUEUE_THRESHOLD(card) \
282 ((card)->qdio.in_buf_pool.buf_count / 4)
284 /* buffers we have to be behind before we get a PCI */
285 #define QETH_PCI_THRESHOLD_A(card) ((card)->qdio.in_buf_pool.buf_count+1)
286 /*enqueued free buffers left before we get a PCI*/
287 #define QETH_PCI_THRESHOLD_B(card) 0
288 /*not used unless the microcode gets patched*/
289 #define QETH_PCI_TIMER_VALUE(card) 3
291 #define QETH_MIN_INPUT_THRESHOLD 1
292 #define QETH_MAX_INPUT_THRESHOLD 500
293 #define QETH_MIN_OUTPUT_THRESHOLD 1
294 #define QETH_MAX_OUTPUT_THRESHOLD 300
296 /* priority queing */
297 #define QETH_PRIOQ_DEFAULT QETH_NO_PRIO_QUEUEING
298 #define QETH_DEFAULT_QUEUE 2
299 #define QETH_NO_PRIO_QUEUEING 0
300 #define QETH_PRIO_Q_ING_PREC 1
301 #define QETH_PRIO_Q_ING_TOS 2
302 #define IP_TOS_LOWDELAY 0x10
303 #define IP_TOS_HIGHTHROUGHPUT 0x08
304 #define IP_TOS_HIGHRELIABILITY 0x04
305 #define IP_TOS_NOTIMPORTANT 0x02
308 #define QETH_LOW_WATERMARK_PACK 2
309 #define QETH_HIGH_WATERMARK_PACK 5
310 #define QETH_WATERMARK_PACK_FUZZ 1
312 #define QETH_IP_HEADER_SIZE 40
314 #define QETH_EXT_HDR_VLAN_FRAME 0x01
315 #define QETH_EXT_HDR_TOKEN_ID 0x02
316 #define QETH_EXT_HDR_INCLUDE_VLAN_TAG 0x04
321 __u16 inbound_checksum;
329 } __attribute__ ((packed));
331 /* flags for qeth_hdr.flags */
332 #define QETH_HDR_PASSTHRU 0x10
333 #define QETH_HDR_IPV6 0x80
334 #define QETH_HDR_CAST_MASK 0x07
335 enum qeth_cast_flags {
336 QETH_CAST_UNICAST = 0x06,
337 QETH_CAST_MULTICAST = 0x04,
338 QETH_CAST_BROADCAST = 0x05,
339 QETH_CAST_ANYCAST = 0x07,
340 QETH_CAST_NOCAST = 0x00,
343 /* flags for qeth_hdr.ext_flags */
344 #define QETH_HDR_EXT_VLAN_FRAME 0x01
345 #define QETH_HDR_EXT_CSUM_HDR_REQ 0x10
346 #define QETH_HDR_EXT_CSUM_TRANSP_REQ 0x20
347 #define QETH_HDR_EXT_SRC_MAC_ADDR 0x08
350 qeth_is_last_sbale(struct qdio_buffer_element *sbale)
352 return (sbale->flags & SBAL_FLAGS_LAST_ENTRY);
355 enum qeth_qdio_buffer_states {
357 * inbound: read out by driver; owned by hardware in order to be filled
358 * outbound: owned by driver in order to be filled
362 * inbound: filled by hardware; owned by driver in order to be read out
363 * outbound: filled by driver; owned by hardware in order to be sent
365 QETH_QDIO_BUF_PRIMED,
367 * inbound only: an error condition has been detected for a buffer
368 * the buffer will be discarded (not read out)
373 enum qeth_qdio_info_states {
374 QETH_QDIO_UNINITIALIZED,
376 QETH_QDIO_ESTABLISHED,
379 struct qeth_buffer_pool_entry {
380 struct list_head list;
381 struct list_head init_list;
382 void *elements[QDIO_MAX_ELEMENTS_PER_BUFFER];
385 struct qeth_qdio_buffer_pool {
386 struct list_head entry_list;
390 struct qeth_qdio_buffer {
391 struct qdio_buffer *buffer;
392 volatile enum qeth_qdio_buffer_states state;
393 /* the buffer pool entry currently associated to this buffer */
394 struct qeth_buffer_pool_entry *pool_entry;
398 struct qdio_buffer qdio_bufs[QDIO_MAX_BUFFERS_PER_Q];
399 struct qeth_qdio_buffer bufs[QDIO_MAX_BUFFERS_PER_Q];
401 * buf_to_init means "buffer must be initialized by driver and must
402 * be made available for hardware" -> state is set to EMPTY
404 volatile int next_buf_to_init;
405 } __attribute__ ((aligned(256)));
407 struct qeth_qdio_out_buffer {
408 struct qdio_buffer *buffer;
409 volatile enum qeth_qdio_buffer_states state;
410 volatile int next_element_to_fill;
411 struct sk_buff_head skb_list;
416 struct qeth_qdio_out_q {
417 struct qdio_buffer qdio_bufs[QDIO_MAX_BUFFERS_PER_Q];
418 struct qeth_qdio_out_buffer bufs[QDIO_MAX_BUFFERS_PER_Q];
420 struct qeth_card *card;
422 volatile int do_pack;
424 * index of buffer to be filled by driver; state EMPTY or PACKING
426 volatile int next_buf_to_fill;
428 * number of buffers that are currently filled (PRIMED)
429 * -> these buffers are hardware-owned
431 atomic_t used_buffers;
432 /* indicates whether PCI flag must be set (or if one is outstanding) */
433 atomic_t set_pci_flags_count;
434 } __attribute__ ((aligned(256)));
436 struct qeth_qdio_info {
437 volatile enum qeth_qdio_info_states state;
439 struct qeth_qdio_q *in_q;
440 struct qeth_qdio_buffer_pool in_buf_pool;
441 struct qeth_qdio_buffer_pool init_pool;
446 struct qeth_qdio_out_q **out_qs;
448 /* priority queueing */
449 int do_prio_queueing;
450 int default_out_queue;
453 enum qeth_send_errors {
454 QETH_SEND_ERROR_NONE,
455 QETH_SEND_ERROR_LINK_FAILURE,
456 QETH_SEND_ERROR_RETRY,
457 QETH_SEND_ERROR_KICK_IT,
460 #define QETH_ETH_MAC_V4 0x0100 /* like v4 */
461 #define QETH_ETH_MAC_V6 0x3333 /* like v6 */
462 /* tr mc mac is longer, but that will be enough to detect mc frames */
463 #define QETH_TR_MAC_NC 0xc000 /* non-canonical */
464 #define QETH_TR_MAC_C 0x0300 /* canonical */
466 #define DEFAULT_ADD_HHLEN 0
467 #define MAX_ADD_HHLEN 1024
470 * buffer stuff for read channel
472 #define QETH_CMD_BUFFER_NO 8
475 * channel state machine
477 enum qeth_channel_states {
487 enum qeth_card_states {
489 CARD_STATE_HARDSETUP,
490 CARD_STATE_SOFTSETUP,
498 enum qeth_prot_versions {
499 QETH_PROT_SNA = 0x0001,
500 QETH_PROT_IPV4 = 0x0004,
501 QETH_PROT_IPV6 = 0x0006,
510 enum qeth_cmd_buffer_state {
516 * IP address and multicast list
519 struct list_head entry;
520 enum qeth_ip_types type;
521 enum qeth_ipa_setdelip_flags set_flags;
522 enum qeth_ipa_setdelip_flags del_flags;
525 enum qeth_prot_versions proto;
526 unsigned char mac[OSA_ADDR_LEN];
533 struct in6_addr addr;
539 struct qeth_ipato_entry {
540 struct list_head entry;
541 enum qeth_prot_versions proto;
550 struct list_head entries;
555 struct qeth_cmd_buffer {
556 enum qeth_cmd_buffer_state state;
557 struct qeth_channel *channel;
560 void (*callback) (struct qeth_channel *, struct qeth_cmd_buffer *);
565 * definition of a qeth channel, used for read and write
567 struct qeth_channel {
568 enum qeth_channel_states state;
571 wait_queue_head_t wait_q;
572 struct tasklet_struct irq_tasklet;
573 struct ccw_device *ccwdev;
574 /*command buffer for control data*/
575 struct qeth_cmd_buffer iob[QETH_CMD_BUFFER_NO];
576 atomic_t irq_pending;
577 volatile int io_buf_no;
582 * OSA card related definitions
589 __u32 cm_connection_w;
590 __u32 cm_connection_r;
593 __u32 ulp_connection_w;
594 __u32 ulp_connection_r;
605 struct list_head list;
606 wait_queue_head_t wait_q;
607 int (*callback)(struct qeth_card *,struct qeth_reply *,unsigned long);
612 struct qeth_card *card;
616 struct qeth_card_info {
618 char if_name[IF_NAME_LEN];
619 unsigned short unit_addr2;
621 unsigned short chpid;
623 char mcl_level[QETH_MCL_LENGTH + 1];
625 int portname_required;
628 enum qeth_card_types type;
629 enum qeth_link_types link_type;
630 int is_multicast_different;
633 int broadcast_capable;
638 struct qeth_card_options {
639 struct qeth_routing_info route4;
640 struct qeth_ipa_info ipa4;
641 struct qeth_ipa_info adp; /*Adapter parameters*/
642 #ifdef CONFIG_QETH_IPV6
643 struct qeth_routing_info route6;
644 struct qeth_ipa_info ipa6;
645 #endif /* QETH_IPV6 */
646 enum qeth_checksum_types checksum_type;
656 * thread bits for qeth_card thread masks
659 QETH_SET_IP_THREAD = 1,
660 QETH_SET_MC_THREAD = 2,
661 QETH_RECOVER_THREAD = 4,
665 struct list_head list;
666 enum qeth_card_states state;
669 /*hardware and sysfs stuff*/
670 struct ccwgroup_device *gdev;
671 struct qeth_channel read;
672 struct qeth_channel write;
673 struct qeth_channel data;
675 struct net_device *dev;
676 struct net_device_stats stats;
678 struct qeth_card_info info;
679 struct qeth_token token;
680 struct qeth_seqno seqno;
681 struct qeth_card_options options;
683 wait_queue_head_t wait_q;
684 #ifdef CONFIG_QETH_VLAN
686 struct vlan_group *vlangrp;
688 struct work_struct kernel_thread_starter;
689 spinlock_t thread_mask_lock;
690 volatile unsigned long thread_start_mask;
691 volatile unsigned long thread_allowed_mask;
692 volatile unsigned long thread_running_mask;
694 struct list_head ip_list;
695 struct list_head ip_tbd_list;
696 struct qeth_ipato ipato;
697 struct list_head cmd_waiter_list;
698 /* QDIO buffer handling */
699 struct qeth_qdio_info qdio;
700 #ifdef CONFIG_QETH_PERF_STATS
701 struct qeth_perf_stats perf_stats;
702 #endif /* CONFIG_QETH_PERF_STATS */
706 struct qeth_card_list_struct {
707 struct list_head list;
711 extern struct qeth_card_list_struct qeth_card_list;
713 /*some helper functions*/
716 qeth_get_ipa_adp_type(enum qeth_link_types link_type)
719 case QETH_LINK_TYPE_HSTR:
727 qeth_get_hlen(__u8 link_type)
729 #ifdef CONFIG_QETH_IPV6
731 case QETH_LINK_TYPE_HSTR:
732 case QETH_LINK_TYPE_LANE_TR:
733 return sizeof(struct qeth_hdr) + TR_HLEN;
735 #ifdef CONFIG_QETH_VLAN
736 return sizeof(struct qeth_hdr) + VLAN_ETH_HLEN;
738 return sizeof(struct qeth_hdr) + ETH_HLEN;
741 #else /* CONFIG_QETH_IPV6 */
742 #ifdef CONFIG_QETH_VLAN
743 return sizeof(struct qeth_hdr) + VLAN_HLEN;
745 return sizeof(struct qeth_hdr);
747 #endif /* CONFIG_QETH_IPV6 */
750 inline static unsigned short
751 qeth_get_netdev_flags(int cardtype)
754 case QETH_CARD_TYPE_IQD:
756 #ifdef CONFIG_QETH_IPV6
767 qeth_get_initial_mtu_for_card(struct qeth_card * card)
769 switch (card->info.type) {
770 case QETH_CARD_TYPE_UNKNOWN:
772 case QETH_CARD_TYPE_IQD:
773 return card->info.max_mtu;
774 case QETH_CARD_TYPE_OSAE:
775 switch (card->info.link_type) {
776 case QETH_LINK_TYPE_HSTR:
777 case QETH_LINK_TYPE_LANE_TR:
788 qeth_get_max_mtu_for_card(int cardtype)
791 case QETH_CARD_TYPE_UNKNOWN:
793 case QETH_CARD_TYPE_OSAE:
795 case QETH_CARD_TYPE_IQD:
803 qeth_get_mtu_out_of_mpc(int cardtype)
806 case QETH_CARD_TYPE_IQD:
814 qeth_get_mtu_outof_framesize(int framesize)
831 qeth_mtu_is_valid(struct qeth_card * card, int mtu)
833 switch (card->info.type) {
834 case QETH_CARD_TYPE_OSAE:
835 return ((mtu >= 576) && (mtu <= 61440));
836 case QETH_CARD_TYPE_IQD:
837 return ((mtu >= 576) &&
838 (mtu <= card->info.max_mtu + 4096 - 32));
839 case QETH_CARD_TYPE_UNKNOWN:
846 qeth_get_arphdr_type(int cardtype, int linktype)
849 case QETH_CARD_TYPE_OSAE:
851 case QETH_LINK_TYPE_LANE_TR:
852 case QETH_LINK_TYPE_HSTR:
853 return ARPHRD_IEEE802_TR;
857 case QETH_CARD_TYPE_IQD:
863 #ifdef CONFIG_QETH_PERF_STATS
865 qeth_get_micros(void)
867 return (int) (get_clock() >> 12);
872 qeth_get_qdio_q_format(struct qeth_card *card)
874 switch (card->info.type) {
875 case QETH_CARD_TYPE_IQD:
883 qeth_ipaddr4_to_string(const __u8 *addr, char *buf)
885 sprintf(buf, "%i.%i.%i.%i", addr[0], addr[1], addr[2], addr[3]);
889 qeth_string_to_ipaddr4(const char *buf, __u8 *addr)
891 const char *start, *end;
898 for (i = 0; i < 3; i++) {
899 if (!(end = strchr(start, '.')))
903 strncpy(abuf, start, len);
904 addr[i] = simple_strtoul(abuf, &tmp, 10);
909 addr[3] = simple_strtoul(abuf, &tmp, 10);
914 qeth_ipaddr6_to_string(const __u8 *addr, char *buf)
916 sprintf(buf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x"
917 ":%02x%02x:%02x%02x:%02x%02x:%02x%02x",
918 addr[0], addr[1], addr[2], addr[3],
919 addr[4], addr[5], addr[6], addr[7],
920 addr[8], addr[9], addr[10], addr[11],
921 addr[12], addr[13], addr[14], addr[15]);
925 qeth_string_to_ipaddr6(const char *buf, __u8 *addr)
927 const char *start, *end;
934 tmp_addr = (u16 *)addr;
936 for (i = 0; i < 7; i++) {
937 if (!(end = strchr(start, ':')))
941 strncpy(abuf, start, len);
942 tmp_addr[i] = simple_strtoul(abuf, &tmp, 16);
947 tmp_addr[7] = simple_strtoul(abuf, &tmp, 16);
952 qeth_ipaddr_to_string(enum qeth_prot_versions proto, const __u8 *addr,
955 if (proto == QETH_PROT_IPV4)
956 return qeth_ipaddr4_to_string(addr, buf);
957 else if (proto == QETH_PROT_IPV6)
958 return qeth_ipaddr6_to_string(addr, buf);
962 qeth_string_to_ipaddr(const char *buf, enum qeth_prot_versions proto,
965 if (proto == QETH_PROT_IPV4)
966 return qeth_string_to_ipaddr4(buf, addr);
967 else if (proto == QETH_PROT_IPV6)
968 return qeth_string_to_ipaddr6(buf, addr);
974 qeth_setrouting_v4(struct qeth_card *);
976 qeth_setrouting_v6(struct qeth_card *);
979 qeth_add_ipato_entry(struct qeth_card *, struct qeth_ipato_entry *);
982 qeth_del_ipato_entry(struct qeth_card *, enum qeth_prot_versions, u8 *, int);
985 qeth_add_vipa(struct qeth_card *, enum qeth_prot_versions, const u8 *);
988 qeth_del_vipa(struct qeth_card *, enum qeth_prot_versions, const u8 *);
991 qeth_add_rxip(struct qeth_card *, enum qeth_prot_versions, const u8 *);
994 qeth_del_rxip(struct qeth_card *, enum qeth_prot_versions, const u8 *);
997 qeth_schedule_recovery(struct qeth_card *);
1000 qeth_realloc_buffer_pool(struct qeth_card *, int);
1001 #endif /* __QETH_H__ */