Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 2 | /* |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 3 | * Copyright IBM Corp. 2007 |
| 4 | * Author(s): Utz Bacher <utz.bacher@de.ibm.com>, |
| 5 | * Frank Pavlic <fpavlic@de.ibm.com>, |
| 6 | * Thomas Spatzier <tspat@de.ibm.com>, |
| 7 | * Frank Blaschka <frank.blaschka@de.ibm.com> |
| 8 | */ |
| 9 | |
| 10 | #ifndef __QETH_CORE_H__ |
| 11 | #define __QETH_CORE_H__ |
| 12 | |
| 13 | #include <linux/if.h> |
| 14 | #include <linux/if_arp.h> |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 15 | #include <linux/etherdevice.h> |
| 16 | #include <linux/if_vlan.h> |
| 17 | #include <linux/ctype.h> |
| 18 | #include <linux/in6.h> |
| 19 | #include <linux/bitops.h> |
| 20 | #include <linux/seq_file.h> |
| 21 | #include <linux/ethtool.h> |
Lakhvich Dmitriy | fe5c802 | 2015-10-06 15:12:28 +0200 | [diff] [blame] | 22 | #include <linux/hashtable.h> |
Eugene Crosser | 41aeed5 | 2016-06-16 16:18:53 +0200 | [diff] [blame] | 23 | #include <linux/ip.h> |
Elena Reshetova | ae69592 | 2017-12-20 20:10:56 +0100 | [diff] [blame] | 24 | #include <linux/refcount.h> |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 25 | |
| 26 | #include <net/ipv6.h> |
| 27 | #include <net/if_inet6.h> |
| 28 | #include <net/addrconf.h> |
Julian Wiedmann | e517b64 | 2018-09-17 17:36:02 +0200 | [diff] [blame] | 29 | #include <net/tcp.h> |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 30 | |
| 31 | #include <asm/debug.h> |
| 32 | #include <asm/qdio.h> |
| 33 | #include <asm/ccwdev.h> |
| 34 | #include <asm/ccwgroup.h> |
Martin Schwidefsky | 6bcac50 | 2008-12-25 13:38:49 +0100 | [diff] [blame] | 35 | #include <asm/sysinfo.h> |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 36 | |
| 37 | #include "qeth_core_mpc.h" |
| 38 | |
| 39 | /** |
| 40 | * Debug Facility stuff |
| 41 | */ |
Peter Tiedemann | d11ba0c | 2008-04-01 10:26:58 +0200 | [diff] [blame] | 42 | enum qeth_dbf_names { |
| 43 | QETH_DBF_SETUP, |
Peter Tiedemann | d11ba0c | 2008-04-01 10:26:58 +0200 | [diff] [blame] | 44 | QETH_DBF_MSG, |
Peter Tiedemann | d11ba0c | 2008-04-01 10:26:58 +0200 | [diff] [blame] | 45 | QETH_DBF_CTRL, |
| 46 | QETH_DBF_INFOS /* must be last element */ |
| 47 | }; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 48 | |
Peter Tiedemann | d11ba0c | 2008-04-01 10:26:58 +0200 | [diff] [blame] | 49 | struct qeth_dbf_info { |
| 50 | char name[DEBUG_MAX_NAME_LEN]; |
| 51 | int pages; |
| 52 | int areas; |
| 53 | int len; |
| 54 | int level; |
| 55 | struct debug_view *view; |
| 56 | debug_info_t *id; |
| 57 | }; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 58 | |
Peter Tiedemann | d11ba0c | 2008-04-01 10:26:58 +0200 | [diff] [blame] | 59 | #define QETH_DBF_CTRL_LEN 256 |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 60 | |
| 61 | #define QETH_DBF_TEXT(name, level, text) \ |
Peter Tiedemann | d11ba0c | 2008-04-01 10:26:58 +0200 | [diff] [blame] | 62 | debug_text_event(qeth_dbf[QETH_DBF_##name].id, level, text) |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 63 | |
| 64 | #define QETH_DBF_HEX(name, level, addr, len) \ |
Peter Tiedemann | d11ba0c | 2008-04-01 10:26:58 +0200 | [diff] [blame] | 65 | debug_event(qeth_dbf[QETH_DBF_##name].id, level, (void *)(addr), len) |
| 66 | |
| 67 | #define QETH_DBF_MESSAGE(level, text...) \ |
| 68 | debug_sprintf_event(qeth_dbf[QETH_DBF_MSG].id, level, text) |
| 69 | |
| 70 | #define QETH_DBF_TEXT_(name, level, text...) \ |
Carsten Otte | 8e96c51 | 2010-06-21 22:57:03 +0000 | [diff] [blame] | 71 | qeth_dbf_longtext(qeth_dbf[QETH_DBF_##name].id, level, text) |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 72 | |
Carsten Otte | af03906 | 2010-06-21 22:57:04 +0000 | [diff] [blame] | 73 | #define QETH_CARD_TEXT(card, level, text) \ |
| 74 | debug_text_event(card->debug, level, text) |
| 75 | |
| 76 | #define QETH_CARD_HEX(card, level, addr, len) \ |
| 77 | debug_event(card->debug, level, (void *)(addr), len) |
| 78 | |
| 79 | #define QETH_CARD_MESSAGE(card, text...) \ |
| 80 | debug_sprintf_event(card->debug, level, text) |
| 81 | |
| 82 | #define QETH_CARD_TEXT_(card, level, text...) \ |
| 83 | qeth_dbf_longtext(card->debug, level, text) |
| 84 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 85 | #define SENSE_COMMAND_REJECT_BYTE 0 |
| 86 | #define SENSE_COMMAND_REJECT_FLAG 0x80 |
| 87 | #define SENSE_RESETTING_EVENT_BYTE 1 |
| 88 | #define SENSE_RESETTING_EVENT_FLAG 0x80 |
| 89 | |
| 90 | /* |
| 91 | * Common IO related definitions |
| 92 | */ |
| 93 | #define CARD_RDEV(card) card->read.ccwdev |
| 94 | #define CARD_WDEV(card) card->write.ccwdev |
| 95 | #define CARD_DDEV(card) card->data.ccwdev |
Kay Sievers | 2a0217d | 2008-10-10 21:33:09 +0200 | [diff] [blame] | 96 | #define CARD_BUS_ID(card) dev_name(&card->gdev->dev) |
| 97 | #define CARD_RDEV_ID(card) dev_name(&card->read.ccwdev->dev) |
| 98 | #define CARD_WDEV_ID(card) dev_name(&card->write.ccwdev->dev) |
| 99 | #define CARD_DDEV_ID(card) dev_name(&card->data.ccwdev->dev) |
| 100 | #define CHANNEL_ID(channel) dev_name(&channel->ccwdev->dev) |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 101 | |
| 102 | /** |
| 103 | * card stuff |
| 104 | */ |
| 105 | struct qeth_perf_stats { |
| 106 | unsigned int bufs_rec; |
| 107 | unsigned int bufs_sent; |
Julian Wiedmann | d2a274b | 2018-07-19 12:43:55 +0200 | [diff] [blame] | 108 | unsigned int buf_elements_sent; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 109 | |
| 110 | unsigned int skbs_sent_pack; |
| 111 | unsigned int bufs_sent_pack; |
| 112 | |
| 113 | unsigned int sc_dp_p; |
| 114 | unsigned int sc_p_dp; |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 115 | /* qdio_cq_handler: number of times called, time spent in */ |
| 116 | __u64 cq_start_time; |
| 117 | unsigned int cq_cnt; |
| 118 | unsigned int cq_time; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 119 | /* qdio_input_handler: number of times called, time spent in */ |
| 120 | __u64 inbound_start_time; |
| 121 | unsigned int inbound_cnt; |
| 122 | unsigned int inbound_time; |
| 123 | /* qeth_send_packet: number of times called, time spent in */ |
| 124 | __u64 outbound_start_time; |
| 125 | unsigned int outbound_cnt; |
| 126 | unsigned int outbound_time; |
| 127 | /* qdio_output_handler: number of times called, time spent in */ |
| 128 | __u64 outbound_handler_start_time; |
| 129 | unsigned int outbound_handler_cnt; |
| 130 | unsigned int outbound_handler_time; |
| 131 | /* number of calls to and time spent in do_QDIO for inbound queue */ |
| 132 | __u64 inbound_do_qdio_start_time; |
| 133 | unsigned int inbound_do_qdio_cnt; |
| 134 | unsigned int inbound_do_qdio_time; |
| 135 | /* number of calls to and time spent in do_QDIO for outbound queues */ |
| 136 | __u64 outbound_do_qdio_start_time; |
| 137 | unsigned int outbound_do_qdio_cnt; |
| 138 | unsigned int outbound_do_qdio_time; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 139 | unsigned int large_send_bytes; |
| 140 | unsigned int large_send_cnt; |
| 141 | unsigned int sg_skbs_sent; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 142 | /* initial values when measuring starts */ |
| 143 | unsigned long initial_rx_packets; |
| 144 | unsigned long initial_tx_packets; |
| 145 | /* inbound scatter gather data */ |
| 146 | unsigned int sg_skbs_rx; |
| 147 | unsigned int sg_frags_rx; |
| 148 | unsigned int sg_alloc_page_rx; |
Frank Blaschka | f61a0d0 | 2009-03-24 20:57:15 +0000 | [diff] [blame] | 149 | unsigned int tx_csum; |
Frank Blaschka | c3b4a74 | 2009-11-12 00:11:44 +0000 | [diff] [blame] | 150 | unsigned int tx_lin; |
Eugene Crosser | 6059c90 | 2016-06-16 16:18:57 +0200 | [diff] [blame] | 151 | unsigned int tx_linfail; |
Kittipon Meesompop | 3aade31 | 2018-04-26 09:42:19 +0200 | [diff] [blame] | 152 | unsigned int rx_csum; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 153 | }; |
| 154 | |
| 155 | /* Routing stuff */ |
| 156 | struct qeth_routing_info { |
| 157 | enum qeth_routing_types type; |
| 158 | }; |
| 159 | |
| 160 | /* IPA stuff */ |
| 161 | struct qeth_ipa_info { |
| 162 | __u32 supported_funcs; |
| 163 | __u32 enabled_funcs; |
| 164 | }; |
| 165 | |
Eugene Crosser | b4d72c0 | 2014-01-14 15:54:11 +0100 | [diff] [blame] | 166 | /* SETBRIDGEPORT stuff */ |
| 167 | enum qeth_sbp_roles { |
| 168 | QETH_SBP_ROLE_NONE = 0, |
| 169 | QETH_SBP_ROLE_PRIMARY = 1, |
| 170 | QETH_SBP_ROLE_SECONDARY = 2, |
| 171 | }; |
| 172 | |
| 173 | enum qeth_sbp_states { |
| 174 | QETH_SBP_STATE_INACTIVE = 0, |
| 175 | QETH_SBP_STATE_STANDBY = 1, |
| 176 | QETH_SBP_STATE_ACTIVE = 2, |
| 177 | }; |
| 178 | |
Eugene Crosser | 9f48b9d | 2014-01-14 15:54:13 +0100 | [diff] [blame] | 179 | #define QETH_SBP_HOST_NOTIFICATION 1 |
| 180 | |
Eugene Crosser | b4d72c0 | 2014-01-14 15:54:11 +0100 | [diff] [blame] | 181 | struct qeth_sbp_info { |
| 182 | __u32 supported_funcs; |
| 183 | enum qeth_sbp_roles role; |
Eugene Crosser | 9f48b9d | 2014-01-14 15:54:13 +0100 | [diff] [blame] | 184 | __u32 hostnotification:1; |
Eugene Crosser | 0db587b | 2015-05-18 14:27:55 +0200 | [diff] [blame] | 185 | __u32 reflect_promisc:1; |
| 186 | __u32 reflect_promisc_primary:1; |
Eugene Crosser | b4d72c0 | 2014-01-14 15:54:11 +0100 | [diff] [blame] | 187 | }; |
| 188 | |
Hans Wippel | a45b3fa | 2017-09-18 21:18:14 +0200 | [diff] [blame] | 189 | struct qeth_vnicc_info { |
| 190 | /* supported/currently configured VNICCs; updated in IPA exchanges */ |
| 191 | u32 sup_chars; |
| 192 | u32 cur_chars; |
Hans Wippel | caa1f0b | 2017-09-18 21:18:15 +0200 | [diff] [blame] | 193 | /* supported commands: bitmasks which VNICCs support respective cmd */ |
| 194 | u32 set_char_sup; |
Hans Wippel | 349d13d | 2017-09-18 21:18:16 +0200 | [diff] [blame] | 195 | u32 getset_timeout_sup; |
| 196 | /* timeout value for the learning characteristic */ |
| 197 | u32 learning_timeout; |
Hans Wippel | caa1f0b | 2017-09-18 21:18:15 +0200 | [diff] [blame] | 198 | /* characteristics wanted/configured by user */ |
| 199 | u32 wanted_chars; |
| 200 | /* has user explicitly enabled rx_bcast while online? */ |
| 201 | bool rx_bcast_enabled; |
Hans Wippel | a45b3fa | 2017-09-18 21:18:14 +0200 | [diff] [blame] | 202 | }; |
| 203 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 204 | static inline int qeth_is_ipa_supported(struct qeth_ipa_info *ipa, |
| 205 | enum qeth_ipa_funcs func) |
| 206 | { |
| 207 | return (ipa->supported_funcs & func); |
| 208 | } |
| 209 | |
| 210 | static inline int qeth_is_ipa_enabled(struct qeth_ipa_info *ipa, |
| 211 | enum qeth_ipa_funcs func) |
| 212 | { |
| 213 | return (ipa->supported_funcs & ipa->enabled_funcs & func); |
| 214 | } |
| 215 | |
| 216 | #define qeth_adp_supported(c, f) \ |
| 217 | qeth_is_ipa_supported(&c->options.adp, f) |
| 218 | #define qeth_adp_enabled(c, f) \ |
| 219 | qeth_is_ipa_enabled(&c->options.adp, f) |
| 220 | #define qeth_is_supported(c, f) \ |
| 221 | qeth_is_ipa_supported(&c->options.ipa4, f) |
| 222 | #define qeth_is_enabled(c, f) \ |
| 223 | qeth_is_ipa_enabled(&c->options.ipa4, f) |
| 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 | #define qeth_is_ipafunc_supported(c, prot, f) \ |
| 229 | ((prot == QETH_PROT_IPV6) ? \ |
| 230 | qeth_is_supported6(c, f) : qeth_is_supported(c, f)) |
| 231 | #define qeth_is_ipafunc_enabled(c, prot, f) \ |
| 232 | ((prot == QETH_PROT_IPV6) ? \ |
| 233 | qeth_is_enabled6(c, f) : qeth_is_enabled(c, f)) |
| 234 | |
Ursula Braun | 5113fec | 2010-05-16 21:15:14 +0000 | [diff] [blame] | 235 | #define QETH_IDX_FUNC_LEVEL_OSD 0x0101 |
Klaus-Dieter Wacker | 6298263 | 2010-07-22 23:15:03 +0000 | [diff] [blame] | 236 | #define QETH_IDX_FUNC_LEVEL_IQD 0x4108 |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 237 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 238 | #define QETH_BUFSIZE 4096 |
Julian Wiedmann | 45ca2fd | 2018-08-09 14:48:00 +0200 | [diff] [blame] | 239 | #define CCW_CMD_WRITE 0x01 |
| 240 | #define CCW_CMD_READ 0x02 |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 241 | |
| 242 | /** |
| 243 | * some more defs |
| 244 | */ |
| 245 | #define QETH_TX_TIMEOUT 100 * HZ |
| 246 | #define QETH_RCD_TIMEOUT 60 * HZ |
Frank Blaschka | b333293 | 2011-08-08 01:33:59 +0000 | [diff] [blame] | 247 | #define QETH_RECLAIM_WORK_TIME HZ |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 248 | #define QETH_MAX_PORTNO 15 |
| 249 | |
| 250 | /*IPv6 address autoconfiguration stuff*/ |
| 251 | #define UNIQUE_ID_IF_CREATE_ADDR_FAILED 0xfffe |
| 252 | #define UNIQUE_ID_NOT_BY_CARD 0x10000 |
| 253 | |
| 254 | /*****************************************************************************/ |
| 255 | /* QDIO queue and buffer handling */ |
| 256 | /*****************************************************************************/ |
| 257 | #define QETH_MAX_QUEUES 4 |
| 258 | #define QETH_IN_BUF_SIZE_DEFAULT 65536 |
Frank Blaschka | dcf4ae2 | 2011-03-14 15:39:47 -0700 | [diff] [blame] | 259 | #define QETH_IN_BUF_COUNT_DEFAULT 64 |
| 260 | #define QETH_IN_BUF_COUNT_HSDEFAULT 128 |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 261 | #define QETH_IN_BUF_COUNT_MIN 8 |
| 262 | #define QETH_IN_BUF_COUNT_MAX 128 |
| 263 | #define QETH_MAX_BUFFER_ELEMENTS(card) ((card)->qdio.in_buf_size >> 12) |
| 264 | #define QETH_IN_BUF_REQUEUE_THRESHOLD(card) \ |
Einar Lueck | 0284a0f | 2011-11-15 02:31:16 +0000 | [diff] [blame] | 265 | ((card)->qdio.in_buf_pool.buf_count / 2) |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 266 | |
| 267 | /* buffers we have to be behind before we get a PCI */ |
| 268 | #define QETH_PCI_THRESHOLD_A(card) ((card)->qdio.in_buf_pool.buf_count+1) |
| 269 | /*enqueued free buffers left before we get a PCI*/ |
| 270 | #define QETH_PCI_THRESHOLD_B(card) 0 |
| 271 | /*not used unless the microcode gets patched*/ |
| 272 | #define QETH_PCI_TIMER_VALUE(card) 3 |
| 273 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 274 | /* priority queing */ |
| 275 | #define QETH_PRIOQ_DEFAULT QETH_NO_PRIO_QUEUEING |
| 276 | #define QETH_DEFAULT_QUEUE 2 |
| 277 | #define QETH_NO_PRIO_QUEUEING 0 |
| 278 | #define QETH_PRIO_Q_ING_PREC 1 |
| 279 | #define QETH_PRIO_Q_ING_TOS 2 |
Stefan Raspl | d66cb37 | 2014-04-28 10:05:09 +0200 | [diff] [blame] | 280 | #define QETH_PRIO_Q_ING_SKB 3 |
| 281 | #define QETH_PRIO_Q_ING_VLAN 4 |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 282 | |
| 283 | /* Packing */ |
| 284 | #define QETH_LOW_WATERMARK_PACK 2 |
| 285 | #define QETH_HIGH_WATERMARK_PACK 5 |
| 286 | #define QETH_WATERMARK_PACK_FUZZ 1 |
| 287 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 288 | /* large receive scatter gather copy break */ |
| 289 | #define QETH_RX_SG_CB (PAGE_SIZE >> 1) |
Frank Blaschka | b333293 | 2011-08-08 01:33:59 +0000 | [diff] [blame] | 290 | #define QETH_RX_PULL_LEN 256 |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 291 | |
| 292 | struct qeth_hdr_layer3 { |
| 293 | __u8 id; |
| 294 | __u8 flags; |
| 295 | __u16 inbound_checksum; /*TSO:__u16 seqno */ |
| 296 | __u32 token; /*TSO: __u32 reserved */ |
| 297 | __u16 length; |
| 298 | __u8 vlan_prio; |
| 299 | __u8 ext_flags; |
| 300 | __u16 vlan_id; |
| 301 | __u16 frame_offset; |
Julian Wiedmann | a843383 | 2017-12-20 20:11:06 +0100 | [diff] [blame] | 302 | union { |
| 303 | /* TX: */ |
| 304 | u8 ipv6_addr[16]; |
| 305 | struct ipv4 { |
| 306 | u8 res[12]; |
| 307 | u32 addr; |
| 308 | } ipv4; |
| 309 | /* RX: */ |
| 310 | struct rx { |
| 311 | u8 res1[2]; |
| 312 | u8 src_mac[6]; |
| 313 | u8 res2[4]; |
| 314 | u16 vlan_id; |
| 315 | u8 res3[2]; |
| 316 | } rx; |
| 317 | } next_hop; |
| 318 | }; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 319 | |
| 320 | struct qeth_hdr_layer2 { |
| 321 | __u8 id; |
| 322 | __u8 flags[3]; |
| 323 | __u8 port_no; |
| 324 | __u8 hdr_length; |
| 325 | __u16 pkt_length; |
| 326 | __u16 seq_no; |
| 327 | __u16 vlan_id; |
| 328 | __u32 reserved; |
| 329 | __u8 reserved2[16]; |
| 330 | } __attribute__ ((packed)); |
| 331 | |
| 332 | struct qeth_hdr_osn { |
| 333 | __u8 id; |
| 334 | __u8 reserved; |
| 335 | __u16 seq_no; |
| 336 | __u16 reserved2; |
| 337 | __u16 control_flags; |
| 338 | __u16 pdu_length; |
| 339 | __u8 reserved3[18]; |
| 340 | __u32 ccid; |
| 341 | } __attribute__ ((packed)); |
| 342 | |
| 343 | struct qeth_hdr { |
| 344 | union { |
| 345 | struct qeth_hdr_layer2 l2; |
| 346 | struct qeth_hdr_layer3 l3; |
| 347 | struct qeth_hdr_osn osn; |
| 348 | } hdr; |
| 349 | } __attribute__ ((packed)); |
| 350 | |
| 351 | /*TCP Segmentation Offload header*/ |
| 352 | struct qeth_hdr_ext_tso { |
| 353 | __u16 hdr_tot_len; |
| 354 | __u8 imb_hdr_no; |
| 355 | __u8 reserved; |
| 356 | __u8 hdr_type; |
| 357 | __u8 hdr_version; |
| 358 | __u16 hdr_len; |
| 359 | __u32 payload_len; |
| 360 | __u16 mss; |
| 361 | __u16 dg_hdr_len; |
| 362 | __u8 padding[16]; |
| 363 | } __attribute__ ((packed)); |
| 364 | |
| 365 | struct qeth_hdr_tso { |
| 366 | struct qeth_hdr hdr; /*hdr->hdr.l3.xxx*/ |
| 367 | struct qeth_hdr_ext_tso ext; |
| 368 | } __attribute__ ((packed)); |
| 369 | |
| 370 | |
| 371 | /* flags for qeth_hdr.flags */ |
| 372 | #define QETH_HDR_PASSTHRU 0x10 |
| 373 | #define QETH_HDR_IPV6 0x80 |
| 374 | #define QETH_HDR_CAST_MASK 0x07 |
| 375 | enum qeth_cast_flags { |
| 376 | QETH_CAST_UNICAST = 0x06, |
| 377 | QETH_CAST_MULTICAST = 0x04, |
| 378 | QETH_CAST_BROADCAST = 0x05, |
| 379 | QETH_CAST_ANYCAST = 0x07, |
| 380 | QETH_CAST_NOCAST = 0x00, |
| 381 | }; |
| 382 | |
| 383 | enum qeth_layer2_frame_flags { |
| 384 | QETH_LAYER2_FLAG_MULTICAST = 0x01, |
| 385 | QETH_LAYER2_FLAG_BROADCAST = 0x02, |
| 386 | QETH_LAYER2_FLAG_UNICAST = 0x04, |
| 387 | QETH_LAYER2_FLAG_VLAN = 0x10, |
| 388 | }; |
| 389 | |
| 390 | enum qeth_header_ids { |
| 391 | QETH_HEADER_TYPE_LAYER3 = 0x01, |
| 392 | QETH_HEADER_TYPE_LAYER2 = 0x02, |
Julian Wiedmann | 0aef839 | 2018-10-12 17:27:15 +0200 | [diff] [blame] | 393 | QETH_HEADER_TYPE_L3_TSO = 0x03, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 394 | QETH_HEADER_TYPE_OSN = 0x04, |
Julian Wiedmann | 0aef839 | 2018-10-12 17:27:15 +0200 | [diff] [blame] | 395 | QETH_HEADER_TYPE_L2_TSO = 0x06, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 396 | }; |
| 397 | /* flags for qeth_hdr.ext_flags */ |
| 398 | #define QETH_HDR_EXT_VLAN_FRAME 0x01 |
| 399 | #define QETH_HDR_EXT_TOKEN_ID 0x02 |
| 400 | #define QETH_HDR_EXT_INCLUDE_VLAN_TAG 0x04 |
| 401 | #define QETH_HDR_EXT_SRC_MAC_ADDR 0x08 |
| 402 | #define QETH_HDR_EXT_CSUM_HDR_REQ 0x10 |
| 403 | #define QETH_HDR_EXT_CSUM_TRANSP_REQ 0x20 |
Frank Blaschka | f6b85b6 | 2010-05-11 19:34:45 +0000 | [diff] [blame] | 404 | #define QETH_HDR_EXT_UDP 0x40 /*bit off for TCP*/ |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 405 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 406 | enum qeth_qdio_buffer_states { |
| 407 | /* |
| 408 | * inbound: read out by driver; owned by hardware in order to be filled |
| 409 | * outbound: owned by driver in order to be filled |
| 410 | */ |
| 411 | QETH_QDIO_BUF_EMPTY, |
| 412 | /* |
| 413 | * inbound: filled by hardware; owned by driver in order to be read out |
| 414 | * outbound: filled by driver; owned by hardware in order to be sent |
| 415 | */ |
| 416 | QETH_QDIO_BUF_PRIMED, |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 417 | /* |
| 418 | * inbound: not applicable |
Frank Blaschka | b333293 | 2011-08-08 01:33:59 +0000 | [diff] [blame] | 419 | * outbound: identified to be pending in TPQ |
| 420 | */ |
| 421 | QETH_QDIO_BUF_PENDING, |
| 422 | /* |
| 423 | * inbound: not applicable |
| 424 | * outbound: found in completion queue |
| 425 | */ |
| 426 | QETH_QDIO_BUF_IN_CQ, |
| 427 | /* |
| 428 | * inbound: not applicable |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 429 | * outbound: handled via transfer pending / completion queue |
| 430 | */ |
| 431 | QETH_QDIO_BUF_HANDLED_DELAYED, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 432 | }; |
| 433 | |
| 434 | enum qeth_qdio_info_states { |
| 435 | QETH_QDIO_UNINITIALIZED, |
| 436 | QETH_QDIO_ALLOCATED, |
| 437 | QETH_QDIO_ESTABLISHED, |
| 438 | QETH_QDIO_CLEANING |
| 439 | }; |
| 440 | |
| 441 | struct qeth_buffer_pool_entry { |
| 442 | struct list_head list; |
| 443 | struct list_head init_list; |
| 444 | void *elements[QDIO_MAX_ELEMENTS_PER_BUFFER]; |
| 445 | }; |
| 446 | |
| 447 | struct qeth_qdio_buffer_pool { |
| 448 | struct list_head entry_list; |
| 449 | int buf_count; |
| 450 | }; |
| 451 | |
| 452 | struct qeth_qdio_buffer { |
| 453 | struct qdio_buffer *buffer; |
| 454 | /* the buffer pool entry currently associated to this buffer */ |
| 455 | struct qeth_buffer_pool_entry *pool_entry; |
Frank Blaschka | b333293 | 2011-08-08 01:33:59 +0000 | [diff] [blame] | 456 | struct sk_buff *rx_skb; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 457 | }; |
| 458 | |
| 459 | struct qeth_qdio_q { |
Sebastian Ott | 6d284bd | 2014-06-27 17:07:47 +0200 | [diff] [blame] | 460 | struct qdio_buffer *qdio_bufs[QDIO_MAX_BUFFERS_PER_Q]; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 461 | struct qeth_qdio_buffer bufs[QDIO_MAX_BUFFERS_PER_Q]; |
| 462 | int next_buf_to_init; |
Sebastian Ott | 6d284bd | 2014-06-27 17:07:47 +0200 | [diff] [blame] | 463 | }; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 464 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 465 | struct qeth_qdio_out_buffer { |
| 466 | struct qdio_buffer *buffer; |
| 467 | atomic_t state; |
| 468 | int next_element_to_fill; |
| 469 | struct sk_buff_head skb_list; |
Julian Wiedmann | 2aedd56 | 2017-04-11 16:11:15 +0200 | [diff] [blame] | 470 | int is_header[QDIO_MAX_ELEMENTS_PER_BUFFER]; |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 471 | |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 472 | struct qeth_qdio_out_q *q; |
| 473 | struct qeth_qdio_out_buffer *next_pending; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 474 | }; |
| 475 | |
| 476 | struct qeth_card; |
| 477 | |
| 478 | enum qeth_out_q_states { |
| 479 | QETH_OUT_Q_UNLOCKED, |
| 480 | QETH_OUT_Q_LOCKED, |
| 481 | QETH_OUT_Q_LOCKED_FLUSH, |
| 482 | }; |
| 483 | |
| 484 | struct qeth_qdio_out_q { |
Sebastian Ott | d445a4e | 2014-06-27 17:09:25 +0200 | [diff] [blame] | 485 | struct qdio_buffer *qdio_bufs[QDIO_MAX_BUFFERS_PER_Q]; |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 486 | struct qeth_qdio_out_buffer *bufs[QDIO_MAX_BUFFERS_PER_Q]; |
| 487 | struct qdio_outbuf_state *bufstates; /* convenience pointer */ |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 488 | int queue_no; |
| 489 | struct qeth_card *card; |
| 490 | atomic_t state; |
| 491 | int do_pack; |
| 492 | /* |
| 493 | * index of buffer to be filled by driver; state EMPTY or PACKING |
| 494 | */ |
| 495 | int next_buf_to_fill; |
| 496 | /* |
| 497 | * number of buffers that are currently filled (PRIMED) |
| 498 | * -> these buffers are hardware-owned |
| 499 | */ |
| 500 | atomic_t used_buffers; |
| 501 | /* indicates whether PCI flag must be set (or if one is outstanding) */ |
| 502 | atomic_t set_pci_flags_count; |
Sebastian Ott | d445a4e | 2014-06-27 17:09:25 +0200 | [diff] [blame] | 503 | }; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 504 | |
| 505 | struct qeth_qdio_info { |
| 506 | atomic_t state; |
| 507 | /* input */ |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 508 | int no_in_queues; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 509 | struct qeth_qdio_q *in_q; |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 510 | struct qeth_qdio_q *c_q; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 511 | struct qeth_qdio_buffer_pool in_buf_pool; |
| 512 | struct qeth_qdio_buffer_pool init_pool; |
| 513 | int in_buf_size; |
| 514 | |
| 515 | /* output */ |
| 516 | int no_out_queues; |
| 517 | struct qeth_qdio_out_q **out_qs; |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 518 | struct qdio_outbuf_state *out_bufstates; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 519 | |
| 520 | /* priority queueing */ |
| 521 | int do_prio_queueing; |
| 522 | int default_out_queue; |
| 523 | }; |
| 524 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 525 | /** |
| 526 | * buffer stuff for read channel |
| 527 | */ |
| 528 | #define QETH_CMD_BUFFER_NO 8 |
| 529 | |
| 530 | /** |
| 531 | * channel state machine |
| 532 | */ |
| 533 | enum qeth_channel_states { |
| 534 | CH_STATE_UP, |
| 535 | CH_STATE_DOWN, |
| 536 | CH_STATE_ACTIVATING, |
| 537 | CH_STATE_HALTED, |
| 538 | CH_STATE_STOPPED, |
| 539 | CH_STATE_RCD, |
| 540 | CH_STATE_RCD_DONE, |
| 541 | }; |
| 542 | /** |
| 543 | * card state machine |
| 544 | */ |
| 545 | enum qeth_card_states { |
| 546 | CARD_STATE_DOWN, |
| 547 | CARD_STATE_HARDSETUP, |
| 548 | CARD_STATE_SOFTSETUP, |
| 549 | CARD_STATE_UP, |
| 550 | CARD_STATE_RECOVER, |
| 551 | }; |
| 552 | |
| 553 | /** |
| 554 | * Protocol versions |
| 555 | */ |
| 556 | enum qeth_prot_versions { |
| 557 | QETH_PROT_IPV4 = 0x0004, |
| 558 | QETH_PROT_IPV6 = 0x0006, |
| 559 | }; |
| 560 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 561 | enum qeth_cmd_buffer_state { |
| 562 | BUF_STATE_FREE, |
| 563 | BUF_STATE_LOCKED, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 564 | }; |
| 565 | |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 566 | enum qeth_cq { |
| 567 | QETH_CQ_DISABLED = 0, |
| 568 | QETH_CQ_ENABLED = 1, |
| 569 | QETH_CQ_NOTAVAILABLE = 2, |
| 570 | }; |
| 571 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 572 | struct qeth_ipato { |
Julian Wiedmann | 7fbd949 | 2017-12-13 18:56:29 +0100 | [diff] [blame] | 573 | bool enabled; |
Julian Wiedmann | 02f510f | 2017-12-13 18:56:32 +0100 | [diff] [blame] | 574 | bool invert4; |
| 575 | bool invert6; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 576 | struct list_head entries; |
| 577 | }; |
| 578 | |
| 579 | struct qeth_channel; |
| 580 | |
| 581 | struct qeth_cmd_buffer { |
| 582 | enum qeth_cmd_buffer_state state; |
| 583 | struct qeth_channel *channel; |
| 584 | unsigned char *data; |
| 585 | int rc; |
Julian Wiedmann | 8f6637b | 2018-09-26 18:29:10 +0200 | [diff] [blame] | 586 | void (*callback)(struct qeth_card *card, struct qeth_channel *channel, |
| 587 | struct qeth_cmd_buffer *iob); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 588 | }; |
| 589 | |
Julian Wiedmann | 1c5b221 | 2018-02-09 11:03:50 +0100 | [diff] [blame] | 590 | static inline struct qeth_ipa_cmd *__ipa_cmd(struct qeth_cmd_buffer *iob) |
| 591 | { |
| 592 | return (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE); |
| 593 | } |
| 594 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 595 | /** |
| 596 | * definition of a qeth channel, used for read and write |
| 597 | */ |
| 598 | struct qeth_channel { |
| 599 | enum qeth_channel_states state; |
Julian Wiedmann | f15cdaf | 2018-08-09 14:48:03 +0200 | [diff] [blame] | 600 | struct ccw1 *ccw; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 601 | spinlock_t iob_lock; |
| 602 | wait_queue_head_t wait_q; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 603 | struct ccw_device *ccwdev; |
| 604 | /*command buffer for control data*/ |
| 605 | struct qeth_cmd_buffer iob[QETH_CMD_BUFFER_NO]; |
| 606 | atomic_t irq_pending; |
| 607 | int io_buf_no; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 608 | }; |
| 609 | |
| 610 | /** |
| 611 | * OSA card related definitions |
| 612 | */ |
| 613 | struct qeth_token { |
| 614 | __u32 issuer_rm_w; |
| 615 | __u32 issuer_rm_r; |
| 616 | __u32 cm_filter_w; |
| 617 | __u32 cm_filter_r; |
| 618 | __u32 cm_connection_w; |
| 619 | __u32 cm_connection_r; |
| 620 | __u32 ulp_filter_w; |
| 621 | __u32 ulp_filter_r; |
| 622 | __u32 ulp_connection_w; |
| 623 | __u32 ulp_connection_r; |
| 624 | }; |
| 625 | |
| 626 | struct qeth_seqno { |
| 627 | __u32 trans_hdr; |
| 628 | __u32 pdu_hdr; |
| 629 | __u32 pdu_hdr_ack; |
| 630 | __u16 ipa; |
| 631 | __u32 pkt_seqno; |
| 632 | }; |
| 633 | |
| 634 | struct qeth_reply { |
| 635 | struct list_head list; |
| 636 | wait_queue_head_t wait_q; |
| 637 | int (*callback)(struct qeth_card *, struct qeth_reply *, |
| 638 | unsigned long); |
| 639 | u32 seqno; |
| 640 | unsigned long offset; |
| 641 | atomic_t received; |
| 642 | int rc; |
| 643 | void *param; |
Elena Reshetova | ae69592 | 2017-12-20 20:10:56 +0100 | [diff] [blame] | 644 | refcount_t refcnt; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 645 | }; |
| 646 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 647 | struct qeth_card_blkt { |
| 648 | int time_total; |
| 649 | int inter_packet; |
| 650 | int inter_packet_jumbo; |
| 651 | }; |
| 652 | |
| 653 | #define QETH_BROADCAST_WITH_ECHO 0x01 |
| 654 | #define QETH_BROADCAST_WITHOUT_ECHO 0x02 |
| 655 | #define QETH_LAYER2_MAC_READ 0x01 |
| 656 | #define QETH_LAYER2_MAC_REGISTERED 0x02 |
| 657 | struct qeth_card_info { |
| 658 | unsigned short unit_addr2; |
| 659 | unsigned short cula; |
| 660 | unsigned short chpid; |
| 661 | __u16 func_level; |
| 662 | char mcl_level[QETH_MCL_LENGTH + 1]; |
| 663 | int guestlan; |
| 664 | int mac_bits; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 665 | enum qeth_card_types type; |
| 666 | enum qeth_link_types link_type; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 667 | int broadcast_capable; |
| 668 | int unique_id; |
Julian Wiedmann | c70eb09 | 2017-06-06 14:33:50 +0200 | [diff] [blame] | 669 | bool layer_enforced; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 670 | struct qeth_card_blkt blkt; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 671 | enum qeth_ipa_promisc_modes promisc_mode; |
Frank Blaschka | 1da74b1 | 2011-05-12 18:45:02 +0000 | [diff] [blame] | 672 | __u32 diagass_support; |
| 673 | __u32 hwtrap; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 674 | }; |
| 675 | |
Julian Wiedmann | 4fda335 | 2018-09-26 18:29:02 +0200 | [diff] [blame] | 676 | enum qeth_discipline_id { |
| 677 | QETH_DISCIPLINE_UNDETERMINED = -1, |
| 678 | QETH_DISCIPLINE_LAYER3 = 0, |
| 679 | QETH_DISCIPLINE_LAYER2 = 1, |
| 680 | }; |
| 681 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 682 | struct qeth_card_options { |
| 683 | struct qeth_routing_info route4; |
| 684 | struct qeth_ipa_info ipa4; |
| 685 | struct qeth_ipa_info adp; /*Adapter parameters*/ |
| 686 | struct qeth_routing_info route6; |
| 687 | struct qeth_ipa_info ipa6; |
Eugene Crosser | b4d72c0 | 2014-01-14 15:54:11 +0100 | [diff] [blame] | 688 | struct qeth_sbp_info sbp; /* SETBRIDGEPORT options */ |
Hans Wippel | a45b3fa | 2017-09-18 21:18:14 +0200 | [diff] [blame] | 689 | struct qeth_vnicc_info vnicc; /* VNICC options */ |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 690 | int fake_broadcast; |
Julian Wiedmann | 4fda335 | 2018-09-26 18:29:02 +0200 | [diff] [blame] | 691 | enum qeth_discipline_id layer; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 692 | int performance_stats; |
| 693 | int rx_sg_cb; |
Einar Lueck | d64ecc2 | 2009-11-12 00:11:41 +0000 | [diff] [blame] | 694 | enum qeth_ipa_isolation_modes isolation; |
Stefan Raspl | 0f54761 | 2013-01-21 02:30:20 +0000 | [diff] [blame] | 695 | enum qeth_ipa_isolation_modes prev_isolation; |
Ursula Braun | 76b11f8 | 2010-01-11 02:50:50 +0000 | [diff] [blame] | 696 | int sniffer; |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 697 | enum qeth_cq cq; |
Frank Blaschka | b333293 | 2011-08-08 01:33:59 +0000 | [diff] [blame] | 698 | char hsuid[9]; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 699 | }; |
| 700 | |
Julian Wiedmann | 4fda335 | 2018-09-26 18:29:02 +0200 | [diff] [blame] | 701 | #define IS_LAYER2(card) ((card)->options.layer == QETH_DISCIPLINE_LAYER2) |
| 702 | #define IS_LAYER3(card) ((card)->options.layer == QETH_DISCIPLINE_LAYER3) |
| 703 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 704 | /* |
| 705 | * thread bits for qeth_card thread masks |
| 706 | */ |
| 707 | enum qeth_threads { |
| 708 | QETH_RECOVER_THREAD = 1, |
| 709 | }; |
| 710 | |
| 711 | struct qeth_osn_info { |
| 712 | int (*assist_cb)(struct net_device *dev, void *data); |
| 713 | int (*data_cb)(struct sk_buff *skb); |
| 714 | }; |
| 715 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 716 | struct qeth_discipline { |
Julian Wiedmann | 2d2ebb3 | 2017-05-10 19:07:52 +0200 | [diff] [blame] | 717 | const struct device_type *devtype; |
Julian Wiedmann | d73ef32 | 2017-04-11 16:11:11 +0200 | [diff] [blame] | 718 | int (*process_rx_buffer)(struct qeth_card *card, int budget, int *done); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 719 | int (*recover)(void *ptr); |
Sebastian Ott | c041f2d487 | 2012-05-15 18:02:21 +0200 | [diff] [blame] | 720 | int (*setup) (struct ccwgroup_device *); |
| 721 | void (*remove) (struct ccwgroup_device *); |
| 722 | int (*set_online) (struct ccwgroup_device *); |
| 723 | int (*set_offline) (struct ccwgroup_device *); |
Sebastian Ott | c041f2d487 | 2012-05-15 18:02:21 +0200 | [diff] [blame] | 724 | int (*freeze)(struct ccwgroup_device *); |
| 725 | int (*thaw) (struct ccwgroup_device *); |
| 726 | int (*restore)(struct ccwgroup_device *); |
Julian Wiedmann | 942d698 | 2017-04-11 16:11:10 +0200 | [diff] [blame] | 727 | int (*do_ioctl)(struct net_device *dev, struct ifreq *rq, int cmd); |
Eugene Crosser | c044dc2 | 2014-01-29 09:23:48 +0100 | [diff] [blame] | 728 | int (*control_event_handler)(struct qeth_card *card, |
| 729 | struct qeth_ipa_cmd *cmd); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 730 | }; |
| 731 | |
| 732 | struct qeth_vlan_vid { |
| 733 | struct list_head list; |
| 734 | unsigned short vid; |
| 735 | }; |
| 736 | |
Lakhvich Dmitriy | 5f78e29 | 2016-06-16 16:18:58 +0200 | [diff] [blame] | 737 | enum qeth_addr_disposition { |
| 738 | QETH_DISP_ADDR_DELETE = 0, |
| 739 | QETH_DISP_ADDR_DO_NOTHING = 1, |
| 740 | QETH_DISP_ADDR_ADD = 2, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 741 | }; |
| 742 | |
Frank Blaschka | a1c3ed4 | 2010-09-07 21:14:42 +0000 | [diff] [blame] | 743 | struct qeth_rx { |
| 744 | int b_count; |
| 745 | int b_index; |
| 746 | struct qdio_buffer_element *b_element; |
| 747 | int e_offset; |
| 748 | int qdio_err; |
| 749 | }; |
| 750 | |
Eugene Crosser | 02d5cb5 | 2013-12-16 09:44:52 +0100 | [diff] [blame] | 751 | struct carrier_info { |
| 752 | __u8 card_type; |
| 753 | __u16 port_mode; |
| 754 | __u32 port_speed; |
| 755 | }; |
| 756 | |
Stefan Raspl | 45cbb2e | 2014-07-21 12:54:43 +0200 | [diff] [blame] | 757 | struct qeth_switch_info { |
| 758 | __u32 capabilities; |
| 759 | __u32 settings; |
| 760 | }; |
| 761 | |
Sebastian Ott | 6541aa5 | 2013-06-24 13:21:52 +0200 | [diff] [blame] | 762 | #define QETH_NAPI_WEIGHT NAPI_POLL_WEIGHT |
Frank Blaschka | a1c3ed4 | 2010-09-07 21:14:42 +0000 | [diff] [blame] | 763 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 764 | struct qeth_card { |
| 765 | struct list_head list; |
| 766 | enum qeth_card_states state; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 767 | spinlock_t lock; |
| 768 | struct ccwgroup_device *gdev; |
| 769 | struct qeth_channel read; |
| 770 | struct qeth_channel write; |
| 771 | struct qeth_channel data; |
| 772 | |
| 773 | struct net_device *dev; |
| 774 | struct net_device_stats stats; |
| 775 | |
| 776 | struct qeth_card_info info; |
| 777 | struct qeth_token token; |
| 778 | struct qeth_seqno seqno; |
| 779 | struct qeth_card_options options; |
| 780 | |
| 781 | wait_queue_head_t wait_q; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 782 | spinlock_t mclock; |
Jiri Pirko | 7ff0bcf | 2011-07-20 04:54:41 +0000 | [diff] [blame] | 783 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; |
Julian Wiedmann | d4ac024 | 2018-04-26 09:42:13 +0200 | [diff] [blame] | 784 | struct mutex vid_list_mutex; /* vid_list */ |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 785 | struct list_head vid_list; |
Lakhvich Dmitriy | fe5c802 | 2015-10-06 15:12:28 +0200 | [diff] [blame] | 786 | DECLARE_HASHTABLE(mac_htable, 4); |
Lakhvich Dmitriy | 5f78e29 | 2016-06-16 16:18:58 +0200 | [diff] [blame] | 787 | DECLARE_HASHTABLE(ip_htable, 4); |
| 788 | DECLARE_HASHTABLE(ip_mc_htable, 4); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 789 | struct work_struct kernel_thread_starter; |
| 790 | spinlock_t thread_mask_lock; |
| 791 | unsigned long thread_start_mask; |
| 792 | unsigned long thread_allowed_mask; |
| 793 | unsigned long thread_running_mask; |
Stefan Raspl | 65d8013 | 2013-04-07 22:19:27 +0000 | [diff] [blame] | 794 | struct task_struct *recovery_task; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 795 | spinlock_t ip_lock; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 796 | struct qeth_ipato ipato; |
| 797 | struct list_head cmd_waiter_list; |
| 798 | /* QDIO buffer handling */ |
| 799 | struct qeth_qdio_info qdio; |
| 800 | struct qeth_perf_stats perf_stats; |
Ursula Braun | 908abbb | 2010-07-22 23:15:06 +0000 | [diff] [blame] | 801 | int read_or_write_problem; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 802 | struct qeth_osn_info osn_info; |
Sebastian Ott | c041f2d487 | 2012-05-15 18:02:21 +0200 | [diff] [blame] | 803 | struct qeth_discipline *discipline; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 804 | atomic_t force_alloc_skb; |
Martin Schwidefsky | 6bcac50 | 2008-12-25 13:38:49 +0100 | [diff] [blame] | 805 | struct service_level qeth_service_level; |
Ursula Braun | 76b11f8 | 2010-01-11 02:50:50 +0000 | [diff] [blame] | 806 | struct qdio_ssqd_desc ssqd; |
Carsten Otte | af03906 | 2010-06-21 22:57:04 +0000 | [diff] [blame] | 807 | debug_info_t *debug; |
Frank Blaschka | c4949f0 | 2010-05-11 19:34:47 +0000 | [diff] [blame] | 808 | struct mutex conf_mutex; |
Ursula Braun | 9dc48cc | 2010-07-22 23:15:05 +0000 | [diff] [blame] | 809 | struct mutex discipline_mutex; |
Frank Blaschka | a1c3ed4 | 2010-09-07 21:14:42 +0000 | [diff] [blame] | 810 | struct napi_struct napi; |
| 811 | struct qeth_rx rx; |
Frank Blaschka | b333293 | 2011-08-08 01:33:59 +0000 | [diff] [blame] | 812 | struct delayed_work buffer_reclaim_work; |
| 813 | int reclaim_index; |
Stefan Raspl | 0f54761 | 2013-01-21 02:30:20 +0000 | [diff] [blame] | 814 | struct work_struct close_dev_work; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 815 | }; |
| 816 | |
| 817 | struct qeth_card_list_struct { |
| 818 | struct list_head list; |
| 819 | rwlock_t rwlock; |
| 820 | }; |
| 821 | |
Frank Blaschka | 1da74b1 | 2011-05-12 18:45:02 +0000 | [diff] [blame] | 822 | struct qeth_trap_id { |
| 823 | __u16 lparnr; |
| 824 | char vmname[8]; |
| 825 | __u8 chpid; |
| 826 | __u8 ssid; |
| 827 | __u16 devno; |
| 828 | } __packed; |
| 829 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 830 | /*some helper functions*/ |
| 831 | #define QETH_CARD_IFNAME(card) (((card)->dev)? (card)->dev->name : "") |
| 832 | |
Julian Wiedmann | ce28867 | 2018-06-29 19:45:53 +0200 | [diff] [blame] | 833 | static inline void qeth_scrub_qdio_buffer(struct qdio_buffer *buf, |
| 834 | unsigned int elements) |
| 835 | { |
| 836 | unsigned int i; |
| 837 | |
| 838 | for (i = 0; i < elements; i++) |
| 839 | memset(&buf->element[i], 0, sizeof(struct qdio_buffer_element)); |
| 840 | buf->element[14].sflags = 0; |
| 841 | buf->element[15].sflags = 0; |
| 842 | } |
| 843 | |
Eugene Crosser | 2863c61 | 2016-06-16 16:18:52 +0200 | [diff] [blame] | 844 | /** |
| 845 | * qeth_get_elements_for_range() - find number of SBALEs to cover range. |
| 846 | * @start: Start of the address range. |
| 847 | * @end: Address after the end of the range. |
| 848 | * |
| 849 | * Returns the number of pages, and thus QDIO buffer elements, needed to cover |
| 850 | * the specified address range. |
| 851 | */ |
| 852 | static inline int qeth_get_elements_for_range(addr_t start, addr_t end) |
| 853 | { |
Ursula Braun | 89271c6 | 2018-02-09 11:03:49 +0100 | [diff] [blame] | 854 | return PFN_UP(end) - PFN_DOWN(start); |
Eugene Crosser | 2863c61 | 2016-06-16 16:18:52 +0200 | [diff] [blame] | 855 | } |
| 856 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 857 | static inline int qeth_get_micros(void) |
| 858 | { |
Heiko Carstens | 1aae056 | 2013-01-30 09:49:40 +0100 | [diff] [blame] | 859 | return (int) (get_tod_clock() >> 12); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 860 | } |
| 861 | |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 862 | static inline int qeth_get_ip_version(struct sk_buff *skb) |
| 863 | { |
Julian Wiedmann | 19e36da | 2017-12-20 20:11:03 +0100 | [diff] [blame] | 864 | struct vlan_ethhdr *veth = vlan_eth_hdr(skb); |
| 865 | __be16 prot = veth->h_vlan_proto; |
Stefan Raspl | a9baf10 | 2014-03-19 07:58:02 +0100 | [diff] [blame] | 866 | |
Julian Wiedmann | 19e36da | 2017-12-20 20:11:03 +0100 | [diff] [blame] | 867 | if (prot == htons(ETH_P_8021Q)) |
| 868 | prot = veth->h_vlan_encapsulated_proto; |
| 869 | |
| 870 | switch (prot) { |
| 871 | case htons(ETH_P_IPV6): |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 872 | return 6; |
Julian Wiedmann | 19e36da | 2017-12-20 20:11:03 +0100 | [diff] [blame] | 873 | case htons(ETH_P_IP): |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 874 | return 4; |
| 875 | default: |
| 876 | return 0; |
| 877 | } |
| 878 | } |
| 879 | |
Julian Wiedmann | 6195b93 | 2018-04-26 09:42:17 +0200 | [diff] [blame] | 880 | static inline void qeth_rx_csum(struct qeth_card *card, struct sk_buff *skb, |
| 881 | u8 flags) |
| 882 | { |
| 883 | if ((card->dev->features & NETIF_F_RXCSUM) && |
Kittipon Meesompop | 3aade31 | 2018-04-26 09:42:19 +0200 | [diff] [blame] | 884 | (flags & QETH_HDR_EXT_CSUM_TRANSP_REQ)) { |
Julian Wiedmann | 6195b93 | 2018-04-26 09:42:17 +0200 | [diff] [blame] | 885 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
Kittipon Meesompop | 3aade31 | 2018-04-26 09:42:19 +0200 | [diff] [blame] | 886 | if (card->options.performance_stats) |
| 887 | card->perf_stats.rx_csum++; |
| 888 | } else { |
Julian Wiedmann | 6195b93 | 2018-04-26 09:42:17 +0200 | [diff] [blame] | 889 | skb->ip_summed = CHECKSUM_NONE; |
Kittipon Meesompop | 3aade31 | 2018-04-26 09:42:19 +0200 | [diff] [blame] | 890 | } |
Julian Wiedmann | 6195b93 | 2018-04-26 09:42:17 +0200 | [diff] [blame] | 891 | } |
| 892 | |
Kittipon Meesompop | 571f9dd8 | 2018-04-26 09:42:22 +0200 | [diff] [blame] | 893 | static inline void qeth_tx_csum(struct sk_buff *skb, u8 *flags, int ipv) |
Julian Wiedmann | 6195b93 | 2018-04-26 09:42:17 +0200 | [diff] [blame] | 894 | { |
| 895 | *flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ; |
Kittipon Meesompop | 571f9dd8 | 2018-04-26 09:42:22 +0200 | [diff] [blame] | 896 | if ((ipv == 4 && ip_hdr(skb)->protocol == IPPROTO_UDP) || |
| 897 | (ipv == 6 && ipv6_hdr(skb)->nexthdr == IPPROTO_UDP)) |
Julian Wiedmann | 6195b93 | 2018-04-26 09:42:17 +0200 | [diff] [blame] | 898 | *flags |= QETH_HDR_EXT_UDP; |
Julian Wiedmann | 6195b93 | 2018-04-26 09:42:17 +0200 | [diff] [blame] | 899 | } |
| 900 | |
Frank Blaschka | f90b744 | 2008-04-24 10:15:24 +0200 | [diff] [blame] | 901 | static inline void qeth_put_buffer_pool_entry(struct qeth_card *card, |
| 902 | struct qeth_buffer_pool_entry *entry) |
| 903 | { |
| 904 | list_add_tail(&entry->list, &card->qdio.in_buf_pool.entry_list); |
| 905 | } |
| 906 | |
Frank Blaschka | 1da74b1 | 2011-05-12 18:45:02 +0000 | [diff] [blame] | 907 | static inline int qeth_is_diagass_supported(struct qeth_card *card, |
| 908 | enum qeth_diags_cmds cmd) |
| 909 | { |
| 910 | return card->info.diagass_support & (__u32)cmd; |
| 911 | } |
| 912 | |
Kittipon Meesompop | a8155b0 | 2018-04-26 09:42:21 +0200 | [diff] [blame] | 913 | int qeth_send_simple_setassparms_prot(struct qeth_card *card, |
| 914 | enum qeth_ipa_funcs ipa_func, |
| 915 | u16 cmd_code, long data, |
| 916 | enum qeth_prot_versions prot); |
| 917 | /* IPv4 variant */ |
| 918 | static inline int qeth_send_simple_setassparms(struct qeth_card *card, |
| 919 | enum qeth_ipa_funcs ipa_func, |
| 920 | u16 cmd_code, long data) |
| 921 | { |
| 922 | return qeth_send_simple_setassparms_prot(card, ipa_func, cmd_code, |
| 923 | data, QETH_PROT_IPV4); |
| 924 | } |
| 925 | |
| 926 | static inline int qeth_send_simple_setassparms_v6(struct qeth_card *card, |
| 927 | enum qeth_ipa_funcs ipa_func, |
| 928 | u16 cmd_code, long data) |
| 929 | { |
| 930 | return qeth_send_simple_setassparms_prot(card, ipa_func, cmd_code, |
| 931 | data, QETH_PROT_IPV6); |
| 932 | } |
| 933 | |
Julian Wiedmann | 86c0cdb | 2018-07-11 17:42:41 +0200 | [diff] [blame] | 934 | int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb, |
| 935 | int ipv); |
| 936 | static inline struct qeth_qdio_out_q *qeth_get_tx_queue(struct qeth_card *card, |
| 937 | struct sk_buff *skb, |
| 938 | int ipv, int cast_type) |
| 939 | { |
| 940 | if (IS_IQD(card) && cast_type != RTN_UNICAST) |
| 941 | return card->qdio.out_qs[card->qdio.no_out_queues - 1]; |
| 942 | if (!card->qdio.do_prio_queueing) |
| 943 | return card->qdio.out_qs[card->qdio.default_out_queue]; |
| 944 | return card->qdio.out_qs[qeth_get_priority_queue(card, skb, ipv)]; |
| 945 | } |
| 946 | |
Sebastian Ott | c041f2d487 | 2012-05-15 18:02:21 +0200 | [diff] [blame] | 947 | extern struct qeth_discipline qeth_l2_discipline; |
| 948 | extern struct qeth_discipline qeth_l3_discipline; |
Sebastian Ott | b7169c5 | 2012-05-15 18:01:46 +0200 | [diff] [blame] | 949 | extern const struct attribute_group *qeth_generic_attr_groups[]; |
| 950 | extern const struct attribute_group *qeth_osn_attr_groups[]; |
Julian Wiedmann | 2d2ebb3 | 2017-05-10 19:07:52 +0200 | [diff] [blame] | 951 | extern const struct attribute_group qeth_device_attr_group; |
| 952 | extern const struct attribute_group qeth_device_blkt_group; |
| 953 | extern const struct device_type qeth_generic_devtype; |
Eugene Crosser | b4d72c0 | 2014-01-14 15:54:11 +0100 | [diff] [blame] | 954 | extern struct workqueue_struct *qeth_wq; |
Sebastian Ott | b7169c5 | 2012-05-15 18:01:46 +0200 | [diff] [blame] | 955 | |
Eugene Crosser | 511c244 | 2014-09-02 08:20:17 +0200 | [diff] [blame] | 956 | int qeth_card_hw_is_reachable(struct qeth_card *); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 957 | const char *qeth_get_cardname_short(struct qeth_card *); |
| 958 | int qeth_realloc_buffer_pool(struct qeth_card *, int); |
| 959 | int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id); |
| 960 | void qeth_core_free_discipline(struct qeth_card *); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 961 | |
| 962 | /* exports for qeth discipline device drivers */ |
| 963 | extern struct qeth_card_list_struct qeth_core_card_list; |
Frank Blaschka | 683d718 | 2008-08-01 16:39:13 +0200 | [diff] [blame] | 964 | extern struct kmem_cache *qeth_core_header_cache; |
Peter Tiedemann | d11ba0c | 2008-04-01 10:26:58 +0200 | [diff] [blame] | 965 | extern struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS]; |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 966 | |
Julian Wiedmann | d3d1b20 | 2018-07-19 12:43:51 +0200 | [diff] [blame] | 967 | struct net_device *qeth_clone_netdev(struct net_device *orig); |
Stefan Raspl | 65d8013 | 2013-04-07 22:19:27 +0000 | [diff] [blame] | 968 | void qeth_set_recovery_task(struct qeth_card *); |
| 969 | void qeth_clear_recovery_task(struct qeth_card *); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 970 | void qeth_set_allowed_threads(struct qeth_card *, unsigned long , int); |
| 971 | int qeth_threads_running(struct qeth_card *, unsigned long); |
| 972 | int qeth_wait_for_threads(struct qeth_card *, unsigned long); |
| 973 | int qeth_do_run_thread(struct qeth_card *, unsigned long); |
| 974 | void qeth_clear_thread_start_bit(struct qeth_card *, unsigned long); |
| 975 | void qeth_clear_thread_running_bit(struct qeth_card *, unsigned long); |
| 976 | int qeth_core_hardsetup_card(struct qeth_card *); |
| 977 | void qeth_print_status_message(struct qeth_card *); |
| 978 | int qeth_init_qdio_queues(struct qeth_card *); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 979 | int qeth_send_ipa_cmd(struct qeth_card *, struct qeth_cmd_buffer *, |
| 980 | int (*reply_cb) |
| 981 | (struct qeth_card *, struct qeth_reply *, unsigned long), |
| 982 | void *); |
| 983 | struct qeth_cmd_buffer *qeth_get_ipacmd_buffer(struct qeth_card *, |
| 984 | enum qeth_ipa_cmds, enum qeth_prot_versions); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 985 | struct sk_buff *qeth_core_get_next_skb(struct qeth_card *, |
Frank Blaschka | b333293 | 2011-08-08 01:33:59 +0000 | [diff] [blame] | 986 | struct qeth_qdio_buffer *, struct qdio_buffer_element **, int *, |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 987 | struct qeth_hdr **); |
| 988 | void qeth_schedule_recovery(struct qeth_card *); |
Julian Wiedmann | d73ef32 | 2017-04-11 16:11:11 +0200 | [diff] [blame] | 989 | int qeth_poll(struct napi_struct *napi, int budget); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 990 | void qeth_clear_ipacmd_list(struct qeth_card *); |
| 991 | int qeth_qdio_clear_card(struct qeth_card *, int); |
| 992 | void qeth_clear_working_pool_list(struct qeth_card *); |
| 993 | void qeth_clear_cmd_buffers(struct qeth_channel *); |
| 994 | void qeth_clear_qdio_buffers(struct qeth_card *); |
| 995 | void qeth_setadp_promisc_mode(struct qeth_card *); |
| 996 | struct net_device_stats *qeth_get_stats(struct net_device *); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 997 | int qeth_setadpparms_change_macaddr(struct qeth_card *); |
| 998 | void qeth_tx_timeout(struct net_device *); |
| 999 | void qeth_prepare_control_data(struct qeth_card *, int, |
| 1000 | struct qeth_cmd_buffer *); |
| 1001 | void qeth_release_buffer(struct qeth_channel *, struct qeth_cmd_buffer *); |
Julian Wiedmann | 73657a3 | 2018-08-09 14:47:58 +0200 | [diff] [blame] | 1002 | void qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 1003 | struct qeth_cmd_buffer *qeth_wait_for_buffer(struct qeth_channel *); |
Stefan Raspl | 45cbb2e | 2014-07-21 12:54:43 +0200 | [diff] [blame] | 1004 | int qeth_query_switch_attributes(struct qeth_card *card, |
| 1005 | struct qeth_switch_info *sw_info); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 1006 | int qeth_send_control_data(struct qeth_card *, int, struct qeth_cmd_buffer *, |
| 1007 | int (*reply_cb)(struct qeth_card *, struct qeth_reply*, unsigned long), |
| 1008 | void *reply_param); |
Julian Wiedmann | 40e6a22 | 2018-09-17 17:35:58 +0200 | [diff] [blame] | 1009 | unsigned int qeth_count_elements(struct sk_buff *skb, unsigned int data_offset); |
Julian Wiedmann | 7c2e9ba | 2017-09-18 21:18:18 +0200 | [diff] [blame] | 1010 | int qeth_do_send_packet_fast(struct qeth_qdio_out_q *queue, struct sk_buff *skb, |
Julian Wiedmann | cc309f8 | 2017-08-15 17:02:44 +0200 | [diff] [blame] | 1011 | struct qeth_hdr *hdr, unsigned int offset, |
Julian Wiedmann | 13ddacb | 2017-08-18 10:19:06 +0200 | [diff] [blame] | 1012 | unsigned int hd_len); |
| 1013 | int qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue, |
| 1014 | struct sk_buff *skb, struct qeth_hdr *hdr, |
Jens Remus | e878c5e | 2017-09-18 21:18:22 +0200 | [diff] [blame] | 1015 | unsigned int offset, unsigned int hd_len, |
| 1016 | int elements_needed); |
Julian Wiedmann | 942d698 | 2017-04-11 16:11:10 +0200 | [diff] [blame] | 1017 | int qeth_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
Ben Hutchings | df8b4ec | 2009-10-01 11:24:32 +0000 | [diff] [blame] | 1018 | int qeth_core_get_sset_count(struct net_device *, int); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 1019 | void qeth_core_get_ethtool_stats(struct net_device *, |
| 1020 | struct ethtool_stats *, u64 *); |
| 1021 | void qeth_core_get_strings(struct net_device *, u32, u8 *); |
| 1022 | void qeth_core_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); |
Carsten Otte | 8e96c51 | 2010-06-21 22:57:03 +0000 | [diff] [blame] | 1023 | void qeth_dbf_longtext(debug_info_t *id, int level, char *text, ...); |
Julian Wiedmann | 993e19c | 2017-04-11 16:11:17 +0200 | [diff] [blame] | 1024 | int qeth_core_ethtool_get_link_ksettings(struct net_device *netdev, |
| 1025 | struct ethtool_link_ksettings *cmd); |
Stefan Raspl | 0f54761 | 2013-01-21 02:30:20 +0000 | [diff] [blame] | 1026 | int qeth_set_access_ctrl_online(struct qeth_card *card, int fallback); |
Einar Lueck | 0da9581 | 2011-08-08 01:33:58 +0000 | [diff] [blame] | 1027 | int qeth_configure_cq(struct qeth_card *, enum qeth_cq); |
Frank Blaschka | 1da74b1 | 2011-05-12 18:45:02 +0000 | [diff] [blame] | 1028 | int qeth_hw_trap(struct qeth_card *, enum qeth_diags_trap_action); |
Stefan Raspl | 395672e0 | 2012-11-19 02:46:49 +0000 | [diff] [blame] | 1029 | void qeth_trace_features(struct qeth_card *); |
Stefan Raspl | 0f54761 | 2013-01-21 02:30:20 +0000 | [diff] [blame] | 1030 | void qeth_close_dev(struct qeth_card *); |
Thomas Richter | 4d7def2 | 2015-09-18 16:06:51 +0200 | [diff] [blame] | 1031 | int qeth_send_setassparms(struct qeth_card *, struct qeth_cmd_buffer *, __u16, |
| 1032 | long, |
| 1033 | int (*reply_cb)(struct qeth_card *, |
| 1034 | struct qeth_reply *, unsigned long), |
| 1035 | void *); |
Thomas Richter | 8f43fb0 | 2016-06-16 16:18:59 +0200 | [diff] [blame] | 1036 | int qeth_setassparms_cb(struct qeth_card *, struct qeth_reply *, unsigned long); |
Thomas Richter | b475e31 | 2015-12-11 12:27:54 +0100 | [diff] [blame] | 1037 | struct qeth_cmd_buffer *qeth_get_setassparms_cmd(struct qeth_card *, |
| 1038 | enum qeth_ipa_funcs, |
| 1039 | __u16, __u16, |
| 1040 | enum qeth_prot_versions); |
Thomas Richter | 8f43fb0 | 2016-06-16 16:18:59 +0200 | [diff] [blame] | 1041 | int qeth_set_features(struct net_device *, netdev_features_t); |
Julian Wiedmann | d025da9 | 2018-06-29 19:45:54 +0200 | [diff] [blame] | 1042 | void qeth_enable_hw_features(struct net_device *dev); |
Thomas Richter | 8f43fb0 | 2016-06-16 16:18:59 +0200 | [diff] [blame] | 1043 | netdev_features_t qeth_fix_features(struct net_device *, netdev_features_t); |
Julian Wiedmann | 6d69b1f | 2017-12-01 10:14:50 +0100 | [diff] [blame] | 1044 | netdev_features_t qeth_features_check(struct sk_buff *skb, |
| 1045 | struct net_device *dev, |
| 1046 | netdev_features_t features); |
Julian Wiedmann | ec61bd2 | 2017-06-20 16:00:34 +0200 | [diff] [blame] | 1047 | int qeth_vm_request_mac(struct qeth_card *card); |
Julian Wiedmann | ba86ceee | 2018-07-19 12:43:56 +0200 | [diff] [blame] | 1048 | int qeth_add_hw_header(struct qeth_card *card, struct sk_buff *skb, |
Julian Wiedmann | a7c2f4a | 2018-07-19 12:43:57 +0200 | [diff] [blame] | 1049 | struct qeth_hdr **hdr, unsigned int hdr_len, |
| 1050 | unsigned int proto_len, unsigned int *elements); |
Julian Wiedmann | 82bf5c0 | 2018-10-12 17:27:14 +0200 | [diff] [blame] | 1051 | void qeth_fill_tso_ext(struct qeth_hdr_tso *hdr, unsigned int payload_len, |
| 1052 | struct sk_buff *skb, unsigned int proto_len); |
Julian Wiedmann | fc69660 | 2018-09-17 17:35:55 +0200 | [diff] [blame] | 1053 | int qeth_xmit(struct qeth_card *card, struct sk_buff *skb, |
| 1054 | struct qeth_qdio_out_q *queue, int ipv, int cast_type, |
| 1055 | void (*fill_header)(struct qeth_card *card, struct qeth_hdr *hdr, |
| 1056 | struct sk_buff *skb, int ipv, int cast_type, |
| 1057 | unsigned int data_len)); |
Frank Blaschka | 4a71df5 | 2008-02-15 09:19:42 +0100 | [diff] [blame] | 1058 | |
| 1059 | /* exports for OSN */ |
| 1060 | int qeth_osn_assist(struct net_device *, void *, int); |
| 1061 | int qeth_osn_register(unsigned char *read_dev_no, struct net_device **, |
| 1062 | int (*assist_cb)(struct net_device *, void *), |
| 1063 | int (*data_cb)(struct sk_buff *)); |
| 1064 | void qeth_osn_deregister(struct net_device *); |
| 1065 | |
| 1066 | #endif /* __QETH_CORE_H__ */ |