^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*lcs.h*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/skbuff.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/refcount.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <asm/ccwdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define LCS_DBF_TEXT(level, name, text) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) debug_text_event(lcs_dbf_##name, level, text); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define LCS_DBF_HEX(level,name,addr,len) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) debug_event(lcs_dbf_##name,level,(void*)(addr),len); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define LCS_DBF_TEXT_(level,name,text...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) if (debug_level_enabled(lcs_dbf_##name, level)) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) sprintf(debug_buffer, text); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) debug_text_event(lcs_dbf_##name, level, debug_buffer); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * sysfs related stuff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define CARD_FROM_DEV(cdev) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) (struct lcs_card *) dev_get_drvdata( \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) &((struct ccwgroup_device *)dev_get_drvdata(&cdev->dev))->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * Enum for classifying detected devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) enum lcs_channel_types {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* Device is not a channel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) lcs_channel_type_none,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /* Device is a 2216 channel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) lcs_channel_type_parallel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /* Device is a 2216 channel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) lcs_channel_type_2216,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* Device is a OSA2 card */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) lcs_channel_type_osa2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * CCW commands used in this driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define LCS_CCW_WRITE 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #define LCS_CCW_READ 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define LCS_CCW_TRANSFER 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * LCS device status primitives
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define LCS_CMD_STARTLAN 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define LCS_CMD_STOPLAN 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #define LCS_CMD_LANSTAT 0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define LCS_CMD_STARTUP 0x07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #define LCS_CMD_SHUTDOWN 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define LCS_CMD_QIPASSIST 0xb2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define LCS_CMD_SETIPM 0xb4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define LCS_CMD_DELIPM 0xb5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #define LCS_INITIATOR_TCPIP 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define LCS_INITIATOR_LGW 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define LCS_STD_CMD_SIZE 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #define LCS_MULTICAST_CMD_SIZE 404
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * LCS IPASSIST MASKS,only used when multicast is switched on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) /* Not supported by LCS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #define LCS_IPASS_ARP_PROCESSING 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #define LCS_IPASS_IN_CHECKSUM_SUPPORT 0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #define LCS_IPASS_OUT_CHECKSUM_SUPPORT 0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define LCS_IPASS_IP_FRAG_REASSEMBLY 0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #define LCS_IPASS_IP_FILTERING 0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) /* Supported by lcs 3172 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define LCS_IPASS_IPV6_SUPPORT 0x0020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #define LCS_IPASS_MULTICAST_SUPPORT 0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * LCS sense byte definitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #define LCS_SENSE_BYTE_0 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #define LCS_SENSE_BYTE_1 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #define LCS_SENSE_BYTE_2 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #define LCS_SENSE_BYTE_3 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #define LCS_SENSE_INTERFACE_DISCONNECT 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) #define LCS_SENSE_EQUIPMENT_CHECK 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define LCS_SENSE_BUS_OUT_CHECK 0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define LCS_SENSE_INTERVENTION_REQUIRED 0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define LCS_SENSE_CMD_REJECT 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define LCS_SENSE_RESETTING_EVENT 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define LCS_SENSE_DEVICE_ONLINE 0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * LCS packet type definitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #define LCS_FRAME_TYPE_CONTROL 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #define LCS_FRAME_TYPE_ENET 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #define LCS_FRAME_TYPE_TR 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #define LCS_FRAME_TYPE_FDDI 7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #define LCS_FRAME_TYPE_AUTO -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * some more definitions,we will sort them later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #define LCS_ILLEGAL_OFFSET 0xffff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) #define LCS_IOBUFFERSIZE 0x5000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #define LCS_NUM_BUFFS 32 /* needs to be power of 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #define LCS_MAC_LENGTH 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #define LCS_INVALID_PORT_NO -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #define LCS_LANCMD_TIMEOUT_DEFAULT 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * Multicast state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define LCS_IPM_STATE_SET_REQUIRED 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #define LCS_IPM_STATE_DEL_REQUIRED 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #define LCS_IPM_STATE_ON_CARD 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * LCS IP Assist declarations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * seems to be only used for multicast
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #define LCS_IPASS_ARP_PROCESSING 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #define LCS_IPASS_INBOUND_CSUM_SUPP 0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #define LCS_IPASS_OUTBOUND_CSUM_SUPP 0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #define LCS_IPASS_IP_FRAG_REASSEMBLY 0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #define LCS_IPASS_IP_FILTERING 0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #define LCS_IPASS_IPV6_SUPPORT 0x0020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #define LCS_IPASS_MULTICAST_SUPPORT 0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * LCS Buffer states
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) enum lcs_buffer_states {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) LCS_BUF_STATE_EMPTY, /* buffer is empty */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) LCS_BUF_STATE_LOCKED, /* buffer is locked, don't touch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) LCS_BUF_STATE_READY, /* buffer is ready for read/write */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) LCS_BUF_STATE_PROCESSED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * LCS Channel State Machine declarations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) enum lcs_channel_states {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) LCS_CH_STATE_INIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) LCS_CH_STATE_HALTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) LCS_CH_STATE_STOPPED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) LCS_CH_STATE_RUNNING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) LCS_CH_STATE_SUSPENDED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) LCS_CH_STATE_CLEARED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) LCS_CH_STATE_ERROR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * LCS device state machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) enum lcs_dev_states {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) DEV_STATE_DOWN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) DEV_STATE_UP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) DEV_STATE_RECOVER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) enum lcs_threads {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) LCS_SET_MC_THREAD = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) LCS_RECOVERY_THREAD = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * LCS struct declarations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) struct lcs_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) __u16 offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) __u8 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) __u8 slot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) struct lcs_ip_mac_pair {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) __be32 ip_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) __u8 mac_addr[LCS_MAC_LENGTH];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) __u8 reserved[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) struct lcs_ipm_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) struct lcs_ip_mac_pair ipm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) __u8 ipm_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) struct lcs_cmd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) __u16 offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) __u8 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) __u8 slot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) __u8 cmd_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) __u8 initiator;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) __u16 sequence_no;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) __u16 return_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) __u8 lan_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) __u8 portno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) __u16 parameter_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) __u8 operator_flags[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) __u8 reserved[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) } lcs_std_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) __u16 unused1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) __u16 buff_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) __u8 unused2[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) } lcs_startup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) __u8 lan_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) __u8 portno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) __u8 unused[10];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) __u8 mac_addr[LCS_MAC_LENGTH];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) __u32 num_packets_deblocked;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) __u32 num_packets_blocked;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) __u32 num_packets_tx_on_lan;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) __u32 num_tx_errors_detected;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) __u32 num_tx_packets_disgarded;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) __u32 num_packets_rx_from_lan;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) __u32 num_rx_errors_detected;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) __u32 num_rx_discarded_nobuffs_avail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) __u32 num_rx_packets_too_large;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) } lcs_lanstat_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) #ifdef CONFIG_IP_MULTICAST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) __u8 lan_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) __u8 portno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) __u16 num_ip_pairs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) __u16 ip_assists_supported;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) __u16 ip_assists_enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) __u16 version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) struct lcs_ip_mac_pair
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) ip_mac_pair[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) __u32 response_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) } lcs_ipass_ctlmsg __attribute ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) } lcs_qipassist __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) #endif /*CONFIG_IP_MULTICAST */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) } cmd __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) * Forward declarations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) struct lcs_card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) struct lcs_channel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) * Definition of an lcs buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) struct lcs_buffer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) enum lcs_buffer_states state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) void *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) int count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) /* Callback for completion notification. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) void (*callback)(struct lcs_channel *, struct lcs_buffer *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) struct lcs_reply {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) __u16 sequence_no;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) refcount_t refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) /* Callback for completion notification. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) void (*callback)(struct lcs_card *, struct lcs_cmd *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) wait_queue_head_t wait_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) struct lcs_card *card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) struct timer_list timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) int received;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) * Definition of an lcs channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) struct lcs_channel {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) enum lcs_channel_states state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) struct ccw_device *ccwdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) struct ccw1 ccws[LCS_NUM_BUFFS + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) wait_queue_head_t wait_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) struct tasklet_struct irq_tasklet;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) struct lcs_buffer iob[LCS_NUM_BUFFS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) int io_idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) int buf_idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) * definition of the lcs card
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) struct lcs_card {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) spinlock_t ipm_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) enum lcs_dev_states state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) struct net_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) struct net_device_stats stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) __be16 (*lan_type_trans)(struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) struct ccwgroup_device *gdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) struct lcs_channel read;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) struct lcs_channel write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) struct lcs_buffer *tx_buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) int tx_emitted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) struct list_head lancmd_waiters;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) int lancmd_timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) struct work_struct kernel_thread_starter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) spinlock_t mask_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) unsigned long thread_start_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) unsigned long thread_running_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) unsigned long thread_allowed_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) wait_queue_head_t wait_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) #ifdef CONFIG_IP_MULTICAST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) struct list_head ipm_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) __u8 mac[LCS_MAC_LENGTH];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) __u16 ip_assists_supported;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) __u16 ip_assists_enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) __s8 lan_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) __u32 pkt_seq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) __u16 sequence_no;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) __s16 portno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) /* Some info copied from probeinfo */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) u8 device_forced;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) u8 max_port_no;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) u8 hint_port_no;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) s16 port_protocol_no;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) } __attribute__ ((aligned(8)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)