12e0bf125SRasesh Mody /* cnic_if.h: QLogic cnic core network driver. 2adfc5217SJeff Kirsher * 3c3661283SMichael Chan * Copyright (c) 2006-2014 Broadcom Corporation 42e0bf125SRasesh Mody * Copyright (c) 2014-2015 QLogic Corporation 5adfc5217SJeff Kirsher * 6adfc5217SJeff Kirsher * This program is free software; you can redistribute it and/or modify 7adfc5217SJeff Kirsher * it under the terms of the GNU General Public License as published by 8adfc5217SJeff Kirsher * the Free Software Foundation. 9adfc5217SJeff Kirsher * 10adfc5217SJeff Kirsher */ 11adfc5217SJeff Kirsher 12adfc5217SJeff Kirsher 13adfc5217SJeff Kirsher #ifndef CNIC_IF_H 14adfc5217SJeff Kirsher #define CNIC_IF_H 15adfc5217SJeff Kirsher 162e499d3cSBarak Witkowski #include "bnx2x/bnx2x_mfw_req.h" 172e499d3cSBarak Witkowski 1885fe7cd2SRasesh Mody #define CNIC_MODULE_VERSION "2.5.21" 1985fe7cd2SRasesh Mody #define CNIC_MODULE_RELDATE "January 29, 2015" 20adfc5217SJeff Kirsher 21adfc5217SJeff Kirsher #define CNIC_ULP_RDMA 0 22adfc5217SJeff Kirsher #define CNIC_ULP_ISCSI 1 23adfc5217SJeff Kirsher #define CNIC_ULP_FCOE 2 24adfc5217SJeff Kirsher #define CNIC_ULP_L4 3 25adfc5217SJeff Kirsher #define MAX_CNIC_ULP_TYPE_EXT 3 26adfc5217SJeff Kirsher #define MAX_CNIC_ULP_TYPE 4 27adfc5217SJeff Kirsher 28be1fefc2SMichael Chan /* Use CPU native page size up to 16K for cnic ring sizes. */ 29be1fefc2SMichael Chan #if (PAGE_SHIFT > 14) 30be1fefc2SMichael Chan #define CNIC_PAGE_BITS 14 31be1fefc2SMichael Chan #else 32be1fefc2SMichael Chan #define CNIC_PAGE_BITS PAGE_SHIFT 33be1fefc2SMichael Chan #endif 34be1fefc2SMichael Chan #define CNIC_PAGE_SIZE (1 << (CNIC_PAGE_BITS)) 35be1fefc2SMichael Chan #define CNIC_PAGE_ALIGN(addr) ALIGN(addr, CNIC_PAGE_SIZE) 36be1fefc2SMichael Chan #define CNIC_PAGE_MASK (~((CNIC_PAGE_SIZE) - 1)) 37be1fefc2SMichael Chan 38adfc5217SJeff Kirsher struct kwqe { 39adfc5217SJeff Kirsher u32 kwqe_op_flag; 40adfc5217SJeff Kirsher 41adfc5217SJeff Kirsher #define KWQE_QID_SHIFT 8 42adfc5217SJeff Kirsher #define KWQE_OPCODE_MASK 0x00ff0000 43adfc5217SJeff Kirsher #define KWQE_OPCODE_SHIFT 16 44adfc5217SJeff Kirsher #define KWQE_OPCODE(x) ((x & KWQE_OPCODE_MASK) >> KWQE_OPCODE_SHIFT) 45adfc5217SJeff Kirsher #define KWQE_LAYER_MASK 0x70000000 46adfc5217SJeff Kirsher #define KWQE_LAYER_SHIFT 28 47adfc5217SJeff Kirsher #define KWQE_FLAGS_LAYER_MASK_L2 (2<<28) 48adfc5217SJeff Kirsher #define KWQE_FLAGS_LAYER_MASK_L3 (3<<28) 49adfc5217SJeff Kirsher #define KWQE_FLAGS_LAYER_MASK_L4 (4<<28) 50adfc5217SJeff Kirsher #define KWQE_FLAGS_LAYER_MASK_L5_RDMA (5<<28) 51adfc5217SJeff Kirsher #define KWQE_FLAGS_LAYER_MASK_L5_ISCSI (6<<28) 52adfc5217SJeff Kirsher #define KWQE_FLAGS_LAYER_MASK_L5_FCOE (7<<28) 53adfc5217SJeff Kirsher 54adfc5217SJeff Kirsher u32 kwqe_info0; 55adfc5217SJeff Kirsher u32 kwqe_info1; 56adfc5217SJeff Kirsher u32 kwqe_info2; 57adfc5217SJeff Kirsher u32 kwqe_info3; 58adfc5217SJeff Kirsher u32 kwqe_info4; 59adfc5217SJeff Kirsher u32 kwqe_info5; 60adfc5217SJeff Kirsher u32 kwqe_info6; 61adfc5217SJeff Kirsher }; 62adfc5217SJeff Kirsher 63adfc5217SJeff Kirsher struct kwqe_16 { 64adfc5217SJeff Kirsher u32 kwqe_info0; 65adfc5217SJeff Kirsher u32 kwqe_info1; 66adfc5217SJeff Kirsher u32 kwqe_info2; 67adfc5217SJeff Kirsher u32 kwqe_info3; 68adfc5217SJeff Kirsher }; 69adfc5217SJeff Kirsher 70adfc5217SJeff Kirsher struct kcqe { 71adfc5217SJeff Kirsher u32 kcqe_info0; 72adfc5217SJeff Kirsher u32 kcqe_info1; 73adfc5217SJeff Kirsher u32 kcqe_info2; 74adfc5217SJeff Kirsher u32 kcqe_info3; 75adfc5217SJeff Kirsher u32 kcqe_info4; 76adfc5217SJeff Kirsher u32 kcqe_info5; 77adfc5217SJeff Kirsher u32 kcqe_info6; 78adfc5217SJeff Kirsher u32 kcqe_op_flag; 79adfc5217SJeff Kirsher #define KCQE_RAMROD_COMPLETION (0x1<<27) /* Everest */ 80adfc5217SJeff Kirsher #define KCQE_FLAGS_LAYER_MASK (0x7<<28) 81adfc5217SJeff Kirsher #define KCQE_FLAGS_LAYER_MASK_MISC (0<<28) 82adfc5217SJeff Kirsher #define KCQE_FLAGS_LAYER_MASK_L2 (2<<28) 83adfc5217SJeff Kirsher #define KCQE_FLAGS_LAYER_MASK_L3 (3<<28) 84adfc5217SJeff Kirsher #define KCQE_FLAGS_LAYER_MASK_L4 (4<<28) 85adfc5217SJeff Kirsher #define KCQE_FLAGS_LAYER_MASK_L5_RDMA (5<<28) 86adfc5217SJeff Kirsher #define KCQE_FLAGS_LAYER_MASK_L5_ISCSI (6<<28) 87adfc5217SJeff Kirsher #define KCQE_FLAGS_LAYER_MASK_L5_FCOE (7<<28) 88adfc5217SJeff Kirsher #define KCQE_FLAGS_NEXT (1<<31) 89adfc5217SJeff Kirsher #define KCQE_FLAGS_OPCODE_MASK (0xff<<16) 90adfc5217SJeff Kirsher #define KCQE_FLAGS_OPCODE_SHIFT (16) 91adfc5217SJeff Kirsher #define KCQE_OPCODE(op) \ 92adfc5217SJeff Kirsher (((op) & KCQE_FLAGS_OPCODE_MASK) >> KCQE_FLAGS_OPCODE_SHIFT) 93adfc5217SJeff Kirsher }; 94adfc5217SJeff Kirsher 95adfc5217SJeff Kirsher #define MAX_CNIC_CTL_DATA 64 96adfc5217SJeff Kirsher #define MAX_DRV_CTL_DATA 64 97adfc5217SJeff Kirsher 98adfc5217SJeff Kirsher #define CNIC_CTL_STOP_CMD 1 99adfc5217SJeff Kirsher #define CNIC_CTL_START_CMD 2 100adfc5217SJeff Kirsher #define CNIC_CTL_COMPLETION_CMD 3 101adfc5217SJeff Kirsher #define CNIC_CTL_STOP_ISCSI_CMD 4 1021d187b34SBarak Witkowski #define CNIC_CTL_FCOE_STATS_GET_CMD 5 1031d187b34SBarak Witkowski #define CNIC_CTL_ISCSI_STATS_GET_CMD 6 104adfc5217SJeff Kirsher 105adfc5217SJeff Kirsher #define DRV_CTL_IO_WR_CMD 0x101 106adfc5217SJeff Kirsher #define DRV_CTL_IO_RD_CMD 0x102 107adfc5217SJeff Kirsher #define DRV_CTL_CTX_WR_CMD 0x103 108adfc5217SJeff Kirsher #define DRV_CTL_CTXTBL_WR_CMD 0x104 109adfc5217SJeff Kirsher #define DRV_CTL_RET_L5_SPQ_CREDIT_CMD 0x105 110adfc5217SJeff Kirsher #define DRV_CTL_START_L2_CMD 0x106 111adfc5217SJeff Kirsher #define DRV_CTL_STOP_L2_CMD 0x107 112adfc5217SJeff Kirsher #define DRV_CTL_RET_L2_SPQ_CREDIT_CMD 0x10c 113adfc5217SJeff Kirsher #define DRV_CTL_ISCSI_STOPPED_CMD 0x10d 1141d187b34SBarak Witkowski #define DRV_CTL_ULP_REGISTER_CMD 0x10e 1151d187b34SBarak Witkowski #define DRV_CTL_ULP_UNREGISTER_CMD 0x10f 116adfc5217SJeff Kirsher 117adfc5217SJeff Kirsher struct cnic_ctl_completion { 118adfc5217SJeff Kirsher u32 cid; 119adfc5217SJeff Kirsher u8 opcode; 120adfc5217SJeff Kirsher u8 error; 121adfc5217SJeff Kirsher }; 122adfc5217SJeff Kirsher 123adfc5217SJeff Kirsher struct cnic_ctl_info { 124adfc5217SJeff Kirsher int cmd; 125adfc5217SJeff Kirsher union { 126adfc5217SJeff Kirsher struct cnic_ctl_completion comp; 127adfc5217SJeff Kirsher char bytes[MAX_CNIC_CTL_DATA]; 128adfc5217SJeff Kirsher } data; 129adfc5217SJeff Kirsher }; 130adfc5217SJeff Kirsher 131adfc5217SJeff Kirsher struct drv_ctl_spq_credit { 132adfc5217SJeff Kirsher u32 credit_count; 133adfc5217SJeff Kirsher }; 134adfc5217SJeff Kirsher 135adfc5217SJeff Kirsher struct drv_ctl_io { 136adfc5217SJeff Kirsher u32 cid_addr; 137adfc5217SJeff Kirsher u32 offset; 138adfc5217SJeff Kirsher u32 data; 139adfc5217SJeff Kirsher dma_addr_t dma_addr; 140adfc5217SJeff Kirsher }; 141adfc5217SJeff Kirsher 142adfc5217SJeff Kirsher struct drv_ctl_l2_ring { 143adfc5217SJeff Kirsher u32 client_id; 144adfc5217SJeff Kirsher u32 cid; 145adfc5217SJeff Kirsher }; 146adfc5217SJeff Kirsher 1472e499d3cSBarak Witkowski struct drv_ctl_register_data { 1482e499d3cSBarak Witkowski int ulp_type; 1492e499d3cSBarak Witkowski struct fcoe_capabilities fcoe_features; 1502e499d3cSBarak Witkowski }; 1512e499d3cSBarak Witkowski 152adfc5217SJeff Kirsher struct drv_ctl_info { 153adfc5217SJeff Kirsher int cmd; 154eddb7554STej Parkash int drv_state; 155eddb7554STej Parkash #define DRV_NOP 0 156eddb7554STej Parkash #define DRV_ACTIVE 1 157eddb7554STej Parkash #define DRV_INACTIVE 2 158eddb7554STej Parkash #define DRV_UNLOADED 3 159adfc5217SJeff Kirsher union { 160adfc5217SJeff Kirsher struct drv_ctl_spq_credit credit; 161adfc5217SJeff Kirsher struct drv_ctl_io io; 162adfc5217SJeff Kirsher struct drv_ctl_l2_ring ring; 1631d187b34SBarak Witkowski int ulp_type; 1642e499d3cSBarak Witkowski struct drv_ctl_register_data register_data; 165adfc5217SJeff Kirsher char bytes[MAX_DRV_CTL_DATA]; 166adfc5217SJeff Kirsher } data; 167adfc5217SJeff Kirsher }; 168adfc5217SJeff Kirsher 169adfc5217SJeff Kirsher struct cnic_ops { 170adfc5217SJeff Kirsher struct module *cnic_owner; 171adfc5217SJeff Kirsher /* Calls to these functions are protected by RCU. When 172adfc5217SJeff Kirsher * unregistering, we wait for any calls to complete before 173adfc5217SJeff Kirsher * continuing. 174adfc5217SJeff Kirsher */ 175adfc5217SJeff Kirsher int (*cnic_handler)(void *, void *); 176adfc5217SJeff Kirsher int (*cnic_ctl)(void *, struct cnic_ctl_info *); 177adfc5217SJeff Kirsher }; 178adfc5217SJeff Kirsher 179adfc5217SJeff Kirsher #define MAX_CNIC_VEC 8 180adfc5217SJeff Kirsher 181adfc5217SJeff Kirsher struct cnic_irq { 182adfc5217SJeff Kirsher unsigned int vector; 183adfc5217SJeff Kirsher void *status_blk; 184adfc5217SJeff Kirsher u32 status_blk_num; 185adfc5217SJeff Kirsher u32 status_blk_num2; 186adfc5217SJeff Kirsher u32 irq_flags; 187adfc5217SJeff Kirsher #define CNIC_IRQ_FL_MSIX 0x00000001 188adfc5217SJeff Kirsher }; 189adfc5217SJeff Kirsher 190adfc5217SJeff Kirsher struct cnic_eth_dev { 191adfc5217SJeff Kirsher struct module *drv_owner; 192adfc5217SJeff Kirsher u32 drv_state; 193adfc5217SJeff Kirsher #define CNIC_DRV_STATE_REGD 0x00000001 194adfc5217SJeff Kirsher #define CNIC_DRV_STATE_USING_MSIX 0x00000002 195adfc5217SJeff Kirsher #define CNIC_DRV_STATE_NO_ISCSI_OOO 0x00000004 196adfc5217SJeff Kirsher #define CNIC_DRV_STATE_NO_ISCSI 0x00000008 197adfc5217SJeff Kirsher #define CNIC_DRV_STATE_NO_FCOE 0x00000010 198ad9b4359SMichael Chan #define CNIC_DRV_STATE_HANDLES_IRQ 0x00000020 199adfc5217SJeff Kirsher u32 chip_id; 200adfc5217SJeff Kirsher u32 max_kwqe_pending; 201adfc5217SJeff Kirsher struct pci_dev *pdev; 202adfc5217SJeff Kirsher void __iomem *io_base; 203adfc5217SJeff Kirsher void __iomem *io_base2; 204adfc5217SJeff Kirsher const void *iro_arr; 205adfc5217SJeff Kirsher 206adfc5217SJeff Kirsher u32 ctx_tbl_offset; 207adfc5217SJeff Kirsher u32 ctx_tbl_len; 208adfc5217SJeff Kirsher int ctx_blk_size; 209adfc5217SJeff Kirsher u32 starting_cid; 210adfc5217SJeff Kirsher u32 max_iscsi_conn; 211adfc5217SJeff Kirsher u32 max_fcoe_conn; 212adfc5217SJeff Kirsher u32 max_rdma_conn; 213adfc5217SJeff Kirsher u32 fcoe_init_cid; 2140eb43b4bSBhanu Prakash Gollapudi u32 max_fcoe_exchanges; 215adfc5217SJeff Kirsher u32 fcoe_wwn_port_name_hi; 216adfc5217SJeff Kirsher u32 fcoe_wwn_port_name_lo; 217adfc5217SJeff Kirsher u32 fcoe_wwn_node_name_hi; 218adfc5217SJeff Kirsher u32 fcoe_wwn_node_name_lo; 219adfc5217SJeff Kirsher 220adfc5217SJeff Kirsher u16 iscsi_l2_client_id; 221adfc5217SJeff Kirsher u16 iscsi_l2_cid; 222adfc5217SJeff Kirsher u8 iscsi_mac[ETH_ALEN]; 223adfc5217SJeff Kirsher 224adfc5217SJeff Kirsher int num_irq; 225adfc5217SJeff Kirsher struct cnic_irq irq_arr[MAX_CNIC_VEC]; 226adfc5217SJeff Kirsher int (*drv_register_cnic)(struct net_device *, 227adfc5217SJeff Kirsher struct cnic_ops *, void *); 228adfc5217SJeff Kirsher int (*drv_unregister_cnic)(struct net_device *); 229adfc5217SJeff Kirsher int (*drv_submit_kwqes_32)(struct net_device *, 230adfc5217SJeff Kirsher struct kwqe *[], u32); 231adfc5217SJeff Kirsher int (*drv_submit_kwqes_16)(struct net_device *, 232adfc5217SJeff Kirsher struct kwqe_16 *[], u32); 233adfc5217SJeff Kirsher int (*drv_ctl)(struct net_device *, struct drv_ctl_info *); 234adfc5217SJeff Kirsher unsigned long reserved1[2]; 2351d187b34SBarak Witkowski union drv_info_to_mcp *addr_drv_info_to_mcp; 236adfc5217SJeff Kirsher }; 237adfc5217SJeff Kirsher 238adfc5217SJeff Kirsher struct cnic_sockaddr { 239adfc5217SJeff Kirsher union { 240adfc5217SJeff Kirsher struct sockaddr_in v4; 241adfc5217SJeff Kirsher struct sockaddr_in6 v6; 242adfc5217SJeff Kirsher } local; 243adfc5217SJeff Kirsher union { 244adfc5217SJeff Kirsher struct sockaddr_in v4; 245adfc5217SJeff Kirsher struct sockaddr_in6 v6; 246adfc5217SJeff Kirsher } remote; 247adfc5217SJeff Kirsher }; 248adfc5217SJeff Kirsher 249adfc5217SJeff Kirsher struct cnic_sock { 250adfc5217SJeff Kirsher struct cnic_dev *dev; 251adfc5217SJeff Kirsher void *context; 252adfc5217SJeff Kirsher u32 src_ip[4]; 253adfc5217SJeff Kirsher u32 dst_ip[4]; 254adfc5217SJeff Kirsher u16 src_port; 255adfc5217SJeff Kirsher u16 dst_port; 256adfc5217SJeff Kirsher u16 vlan_id; 2571409a932SJoe Perches unsigned char old_ha[ETH_ALEN]; 2581409a932SJoe Perches unsigned char ha[ETH_ALEN]; 259adfc5217SJeff Kirsher u32 mtu; 260adfc5217SJeff Kirsher u32 cid; 261adfc5217SJeff Kirsher u32 l5_cid; 262adfc5217SJeff Kirsher u32 pg_cid; 263adfc5217SJeff Kirsher int ulp_type; 264adfc5217SJeff Kirsher 265adfc5217SJeff Kirsher u32 ka_timeout; 266adfc5217SJeff Kirsher u32 ka_interval; 267adfc5217SJeff Kirsher u8 ka_max_probe_count; 268adfc5217SJeff Kirsher u8 tos; 269adfc5217SJeff Kirsher u8 ttl; 270adfc5217SJeff Kirsher u8 snd_seq_scale; 271adfc5217SJeff Kirsher u32 rcv_buf; 272adfc5217SJeff Kirsher u32 snd_buf; 273adfc5217SJeff Kirsher u32 seed; 274adfc5217SJeff Kirsher 275adfc5217SJeff Kirsher unsigned long tcp_flags; 276adfc5217SJeff Kirsher #define SK_TCP_NO_DELAY_ACK 0x1 277adfc5217SJeff Kirsher #define SK_TCP_KEEP_ALIVE 0x2 278adfc5217SJeff Kirsher #define SK_TCP_NAGLE 0x4 279adfc5217SJeff Kirsher #define SK_TCP_TIMESTAMP 0x8 280adfc5217SJeff Kirsher #define SK_TCP_SACK 0x10 281adfc5217SJeff Kirsher #define SK_TCP_SEG_SCALING 0x20 282adfc5217SJeff Kirsher unsigned long flags; 283adfc5217SJeff Kirsher #define SK_F_INUSE 0 284adfc5217SJeff Kirsher #define SK_F_OFFLD_COMPLETE 1 285adfc5217SJeff Kirsher #define SK_F_OFFLD_SCHED 2 286adfc5217SJeff Kirsher #define SK_F_PG_OFFLD_COMPLETE 3 287adfc5217SJeff Kirsher #define SK_F_CONNECT_START 4 288adfc5217SJeff Kirsher #define SK_F_IPV6 5 289adfc5217SJeff Kirsher #define SK_F_CLOSING 7 29023021c21SMichael Chan #define SK_F_HW_ERR 8 291adfc5217SJeff Kirsher 292adfc5217SJeff Kirsher atomic_t ref_count; 293adfc5217SJeff Kirsher u32 state; 294adfc5217SJeff Kirsher struct kwqe kwqe1; 295adfc5217SJeff Kirsher struct kwqe kwqe2; 296adfc5217SJeff Kirsher struct kwqe kwqe3; 297adfc5217SJeff Kirsher }; 298adfc5217SJeff Kirsher 299adfc5217SJeff Kirsher struct cnic_dev { 300adfc5217SJeff Kirsher struct net_device *netdev; 301adfc5217SJeff Kirsher struct pci_dev *pcidev; 302adfc5217SJeff Kirsher void __iomem *regview; 303adfc5217SJeff Kirsher struct list_head list; 304adfc5217SJeff Kirsher 305adfc5217SJeff Kirsher int (*register_device)(struct cnic_dev *dev, int ulp_type, 306adfc5217SJeff Kirsher void *ulp_ctx); 307adfc5217SJeff Kirsher int (*unregister_device)(struct cnic_dev *dev, int ulp_type); 308adfc5217SJeff Kirsher int (*submit_kwqes)(struct cnic_dev *dev, struct kwqe *wqes[], 309adfc5217SJeff Kirsher u32 num_wqes); 310adfc5217SJeff Kirsher int (*submit_kwqes_16)(struct cnic_dev *dev, struct kwqe_16 *wqes[], 311adfc5217SJeff Kirsher u32 num_wqes); 312adfc5217SJeff Kirsher 313adfc5217SJeff Kirsher int (*cm_create)(struct cnic_dev *, int, u32, u32, struct cnic_sock **, 314adfc5217SJeff Kirsher void *); 315adfc5217SJeff Kirsher int (*cm_destroy)(struct cnic_sock *); 316adfc5217SJeff Kirsher int (*cm_connect)(struct cnic_sock *, struct cnic_sockaddr *); 317adfc5217SJeff Kirsher int (*cm_abort)(struct cnic_sock *); 318adfc5217SJeff Kirsher int (*cm_close)(struct cnic_sock *); 319adfc5217SJeff Kirsher struct cnic_dev *(*cm_select_dev)(struct sockaddr_in *, int ulp_type); 320adfc5217SJeff Kirsher int (*iscsi_nl_msg_recv)(struct cnic_dev *dev, u32 msg_type, 321adfc5217SJeff Kirsher char *data, u16 data_size); 322adfc5217SJeff Kirsher unsigned long flags; 323adfc5217SJeff Kirsher #define CNIC_F_CNIC_UP 1 324adfc5217SJeff Kirsher #define CNIC_F_BNX2_CLASS 3 325adfc5217SJeff Kirsher #define CNIC_F_BNX2X_CLASS 4 326adfc5217SJeff Kirsher atomic_t ref_count; 3271409a932SJoe Perches u8 mac_addr[ETH_ALEN]; 328adfc5217SJeff Kirsher 329adfc5217SJeff Kirsher int max_iscsi_conn; 330adfc5217SJeff Kirsher int max_fcoe_conn; 331adfc5217SJeff Kirsher int max_rdma_conn; 332adfc5217SJeff Kirsher 3330eb43b4bSBhanu Prakash Gollapudi int max_fcoe_exchanges; 3340eb43b4bSBhanu Prakash Gollapudi 3351d187b34SBarak Witkowski union drv_info_to_mcp *stats_addr; 3362e499d3cSBarak Witkowski struct fcoe_capabilities *fcoe_cap; 3371d187b34SBarak Witkowski 338adfc5217SJeff Kirsher void *cnic_priv; 339adfc5217SJeff Kirsher }; 340adfc5217SJeff Kirsher 341adfc5217SJeff Kirsher #define CNIC_WR(dev, off, val) writel(val, dev->regview + off) 342adfc5217SJeff Kirsher #define CNIC_WR16(dev, off, val) writew(val, dev->regview + off) 343adfc5217SJeff Kirsher #define CNIC_WR8(dev, off, val) writeb(val, dev->regview + off) 344adfc5217SJeff Kirsher #define CNIC_RD(dev, off) readl(dev->regview + off) 345adfc5217SJeff Kirsher #define CNIC_RD16(dev, off) readw(dev->regview + off) 346adfc5217SJeff Kirsher 347adfc5217SJeff Kirsher struct cnic_ulp_ops { 348adfc5217SJeff Kirsher /* Calls to these functions are protected by RCU. When 349adfc5217SJeff Kirsher * unregistering, we wait for any calls to complete before 350adfc5217SJeff Kirsher * continuing. 351adfc5217SJeff Kirsher */ 352adfc5217SJeff Kirsher 353adfc5217SJeff Kirsher void (*cnic_init)(struct cnic_dev *dev); 354adfc5217SJeff Kirsher void (*cnic_exit)(struct cnic_dev *dev); 355adfc5217SJeff Kirsher void (*cnic_start)(void *ulp_ctx); 356adfc5217SJeff Kirsher void (*cnic_stop)(void *ulp_ctx); 357adfc5217SJeff Kirsher void (*indicate_kcqes)(void *ulp_ctx, struct kcqe *cqes[], 358adfc5217SJeff Kirsher u32 num_cqes); 359adfc5217SJeff Kirsher void (*indicate_netevent)(void *ulp_ctx, unsigned long event, u16 vid); 360adfc5217SJeff Kirsher void (*cm_connect_complete)(struct cnic_sock *); 361adfc5217SJeff Kirsher void (*cm_close_complete)(struct cnic_sock *); 362adfc5217SJeff Kirsher void (*cm_abort_complete)(struct cnic_sock *); 363adfc5217SJeff Kirsher void (*cm_remote_close)(struct cnic_sock *); 364adfc5217SJeff Kirsher void (*cm_remote_abort)(struct cnic_sock *); 365adfc5217SJeff Kirsher int (*iscsi_nl_send_msg)(void *ulp_ctx, u32 msg_type, 366adfc5217SJeff Kirsher char *data, u16 data_size); 3671d187b34SBarak Witkowski int (*cnic_get_stats)(void *ulp_ctx); 368adfc5217SJeff Kirsher struct module *owner; 369adfc5217SJeff Kirsher atomic_t ref_count; 370adfc5217SJeff Kirsher }; 371adfc5217SJeff Kirsher 3721ee1725bSJoe Perches int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); 373adfc5217SJeff Kirsher 3741ee1725bSJoe Perches int cnic_unregister_driver(int ulp_type); 375adfc5217SJeff Kirsher 376adfc5217SJeff Kirsher #endif 377