qedi_nvm_iscsi_cfg.h (6900B)
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * QLogic iSCSI Offload Driver 4 * Copyright (c) 2016 Cavium Inc. 5 */ 6 7#ifndef NVM_ISCSI_CFG_H 8#define NVM_ISCSI_CFG_H 9 10#define NUM_OF_ISCSI_TARGET_PER_PF 4 /* Defined as per the 11 * ISCSI IBFT constraint 12 */ 13#define NUM_OF_ISCSI_PF_SUPPORTED 4 /* One PF per Port - 14 * assuming 4 port card 15 */ 16 17#define NVM_ISCSI_CFG_DHCP_NAME_MAX_LEN 256 18 19union nvm_iscsi_dhcp_vendor_id { 20 u32 value[NVM_ISCSI_CFG_DHCP_NAME_MAX_LEN / 4]; 21 u8 byte[NVM_ISCSI_CFG_DHCP_NAME_MAX_LEN]; 22}; 23 24#define NVM_ISCSI_IPV4_ADDR_BYTE_LEN 4 25union nvm_iscsi_ipv4_addr { 26 u32 addr; 27 u8 byte[NVM_ISCSI_IPV4_ADDR_BYTE_LEN]; 28}; 29 30#define NVM_ISCSI_IPV6_ADDR_BYTE_LEN 16 31union nvm_iscsi_ipv6_addr { 32 u32 addr[4]; 33 u8 byte[NVM_ISCSI_IPV6_ADDR_BYTE_LEN]; 34}; 35 36struct nvm_iscsi_initiator_ipv4 { 37 union nvm_iscsi_ipv4_addr addr; /* 0x0 */ 38 union nvm_iscsi_ipv4_addr subnet_mask; /* 0x4 */ 39 union nvm_iscsi_ipv4_addr gateway; /* 0x8 */ 40 union nvm_iscsi_ipv4_addr primary_dns; /* 0xC */ 41 union nvm_iscsi_ipv4_addr secondary_dns; /* 0x10 */ 42 union nvm_iscsi_ipv4_addr dhcp_addr; /* 0x14 */ 43 44 union nvm_iscsi_ipv4_addr isns_server; /* 0x18 */ 45 union nvm_iscsi_ipv4_addr slp_server; /* 0x1C */ 46 union nvm_iscsi_ipv4_addr primay_radius_server; /* 0x20 */ 47 union nvm_iscsi_ipv4_addr secondary_radius_server; /* 0x24 */ 48 49 union nvm_iscsi_ipv4_addr rsvd[4]; /* 0x28 */ 50}; 51 52struct nvm_iscsi_initiator_ipv6 { 53 union nvm_iscsi_ipv6_addr addr; /* 0x0 */ 54 union nvm_iscsi_ipv6_addr subnet_mask; /* 0x10 */ 55 union nvm_iscsi_ipv6_addr gateway; /* 0x20 */ 56 union nvm_iscsi_ipv6_addr primary_dns; /* 0x30 */ 57 union nvm_iscsi_ipv6_addr secondary_dns; /* 0x40 */ 58 union nvm_iscsi_ipv6_addr dhcp_addr; /* 0x50 */ 59 60 union nvm_iscsi_ipv6_addr isns_server; /* 0x60 */ 61 union nvm_iscsi_ipv6_addr slp_server; /* 0x70 */ 62 union nvm_iscsi_ipv6_addr primay_radius_server; /* 0x80 */ 63 union nvm_iscsi_ipv6_addr secondary_radius_server; /* 0x90 */ 64 65 union nvm_iscsi_ipv6_addr rsvd[3]; /* 0xA0 */ 66 67 u32 config; /* 0xD0 */ 68#define NVM_ISCSI_CFG_INITIATOR_IPV6_SUBNET_MASK_PREFIX_MASK 0x000000FF 69#define NVM_ISCSI_CFG_INITIATOR_IPV6_SUBNET_MASK_PREFIX_OFFSET 0 70 71 u32 rsvd_1[3]; 72}; 73 74#define NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN 256 75union nvm_iscsi_name { 76 u32 value[NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN / 4]; 77 u8 byte[NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN]; 78}; 79 80#define NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN 256 81union nvm_iscsi_chap_name { 82 u32 value[NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN / 4]; 83 u8 byte[NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN]; 84}; 85 86#define NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN 16 /* md5 need per RFC1996 87 * is 16 octets 88 */ 89union nvm_iscsi_chap_password { 90 u32 value[NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN / 4]; 91 u8 byte[NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN]; 92}; 93 94union nvm_iscsi_lun { 95 u8 byte[8]; 96 u32 value[2]; 97}; 98 99struct nvm_iscsi_generic { 100 u32 ctrl_flags; /* 0x0 */ 101#define NVM_ISCSI_CFG_GEN_CHAP_ENABLED BIT(0) 102#define NVM_ISCSI_CFG_GEN_DHCP_TCPIP_CONFIG_ENABLED BIT(1) 103#define NVM_ISCSI_CFG_GEN_DHCP_ISCSI_CONFIG_ENABLED BIT(2) 104#define NVM_ISCSI_CFG_GEN_IPV6_ENABLED BIT(3) 105#define NVM_ISCSI_CFG_GEN_IPV4_FALLBACK_ENABLED BIT(4) 106#define NVM_ISCSI_CFG_GEN_ISNS_WORLD_LOGIN BIT(5) 107#define NVM_ISCSI_CFG_GEN_ISNS_SELECTIVE_LOGIN BIT(6) 108#define NVM_ISCSI_CFG_GEN_ADDR_REDIRECT_ENABLED BIT(7) 109#define NVM_ISCSI_CFG_GEN_CHAP_MUTUAL_ENABLED BIT(8) 110 111 u32 timeout; /* 0x4 */ 112#define NVM_ISCSI_CFG_GEN_DHCP_REQUEST_TIMEOUT_MASK 0x0000FFFF 113#define NVM_ISCSI_CFG_GEN_DHCP_REQUEST_TIMEOUT_OFFSET 0 114#define NVM_ISCSI_CFG_GEN_PORT_LOGIN_TIMEOUT_MASK 0xFFFF0000 115#define NVM_ISCSI_CFG_GEN_PORT_LOGIN_TIMEOUT_OFFSET 16 116 117 union nvm_iscsi_dhcp_vendor_id dhcp_vendor_id; /* 0x8 */ 118 u32 rsvd[62]; /* 0x108 */ 119}; 120 121struct nvm_iscsi_initiator { 122 struct nvm_iscsi_initiator_ipv4 ipv4; /* 0x0 */ 123 struct nvm_iscsi_initiator_ipv6 ipv6; /* 0x38 */ 124 125 union nvm_iscsi_name initiator_name; /* 0x118 */ 126 union nvm_iscsi_chap_name chap_name; /* 0x218 */ 127 union nvm_iscsi_chap_password chap_password; /* 0x318 */ 128 129 u32 generic_cont0; /* 0x398 */ 130#define NVM_ISCSI_CFG_INITIATOR_VLAN_MASK 0x0000FFFF 131#define NVM_ISCSI_CFG_INITIATOR_VLAN_OFFSET 0 132#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_MASK 0x00030000 133#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_OFFSET 16 134#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_4 1 135#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_6 2 136#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_4_AND_6 3 137 138 u32 ctrl_flags; 139#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_PRIORITY_V6 BIT(0) 140#define NVM_ISCSI_CFG_INITIATOR_VLAN_ENABLED BIT(1) 141 142 u32 rsvd[116]; /* 0x32C */ 143}; 144 145struct nvm_iscsi_target { 146 u32 ctrl_flags; /* 0x0 */ 147#define NVM_ISCSI_CFG_TARGET_ENABLED BIT(0) 148#define NVM_ISCSI_CFG_BOOT_TIME_LOGIN_STATUS BIT(1) 149 150 u32 generic_cont0; /* 0x4 */ 151#define NVM_ISCSI_CFG_TARGET_TCP_PORT_MASK 0x0000FFFF 152#define NVM_ISCSI_CFG_TARGET_TCP_PORT_OFFSET 0 153 154 u32 ip_ver; 155#define NVM_ISCSI_CFG_IPv4 4 156#define NVM_ISCSI_CFG_IPv6 6 157 158 u32 rsvd_1[7]; /* 0x24 */ 159 union nvm_iscsi_ipv4_addr ipv4_addr; /* 0x28 */ 160 union nvm_iscsi_ipv6_addr ipv6_addr; /* 0x2C */ 161 union nvm_iscsi_lun lun; /* 0x3C */ 162 163 union nvm_iscsi_name target_name; /* 0x44 */ 164 union nvm_iscsi_chap_name chap_name; /* 0x144 */ 165 union nvm_iscsi_chap_password chap_password; /* 0x244 */ 166 167 u32 rsvd_2[107]; /* 0x2C4 */ 168}; 169 170struct nvm_iscsi_block { 171 u32 id; /* 0x0 */ 172#define NVM_ISCSI_CFG_BLK_MAPPED_PF_ID_MASK 0x0000000F 173#define NVM_ISCSI_CFG_BLK_MAPPED_PF_ID_OFFSET 0 174#define NVM_ISCSI_CFG_BLK_CTRL_FLAG_MASK 0x00000FF0 175#define NVM_ISCSI_CFG_BLK_CTRL_FLAG_OFFSET 4 176#define NVM_ISCSI_CFG_BLK_CTRL_FLAG_IS_NOT_EMPTY BIT(0) 177#define NVM_ISCSI_CFG_BLK_CTRL_FLAG_PF_MAPPED BIT(1) 178 179 u32 rsvd_1[5]; /* 0x4 */ 180 181 struct nvm_iscsi_generic generic; /* 0x18 */ 182 struct nvm_iscsi_initiator initiator; /* 0x218 */ 183 struct nvm_iscsi_target target[NUM_OF_ISCSI_TARGET_PER_PF]; 184 /* 0x718 */ 185 186 u32 rsvd_2[58]; /* 0x1718 */ 187 /* total size - 0x1800 - 6K block */ 188}; 189 190struct nvm_iscsi_cfg { 191 u32 id; /* 0x0 */ 192#define NVM_ISCSI_CFG_BLK_VERSION_MINOR_MASK 0x000000FF 193#define NVM_ISCSI_CFG_BLK_VERSION_MAJOR_MASK 0x0000FF00 194#define NVM_ISCSI_CFG_BLK_SIGNATURE_MASK 0xFFFF0000 195#define NVM_ISCSI_CFG_BLK_SIGNATURE 0x49430000 /* IC - Iscsi 196 * Config 197 */ 198 199#define NVM_ISCSI_CFG_BLK_VERSION_MAJOR 0 200#define NVM_ISCSI_CFG_BLK_VERSION_MINOR 10 201#define NVM_ISCSI_CFG_BLK_VERSION ((NVM_ISCSI_CFG_BLK_VERSION_MAJOR << 8) | \ 202 NVM_ISCSI_CFG_BLK_VERSION_MINOR) 203 204 struct nvm_iscsi_block block[NUM_OF_ISCSI_PF_SUPPORTED]; /* 0x4 */ 205}; 206 207#endif