xref: /openbmc/linux/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h (revision 1149a5ed)
16f7efaabSkxie@chelsio.com /*
26f7efaabSkxie@chelsio.com  * cxgb3i.h: Chelsio S3xx iSCSI driver.
36f7efaabSkxie@chelsio.com  *
41149a5edSKaren Xie  * Copyright (c) 2008-2015 Chelsio Communications, Inc.
56f7efaabSkxie@chelsio.com  *
66f7efaabSkxie@chelsio.com  * This program is free software; you can redistribute it and/or modify
76f7efaabSkxie@chelsio.com  * it under the terms of the GNU General Public License as published by
86f7efaabSkxie@chelsio.com  * the Free Software Foundation.
96f7efaabSkxie@chelsio.com  *
106f7efaabSkxie@chelsio.com  * Written by: Karen Xie (kxie@chelsio.com)
116f7efaabSkxie@chelsio.com  */
126f7efaabSkxie@chelsio.com 
136f7efaabSkxie@chelsio.com #ifndef __CXGB3I_H__
146f7efaabSkxie@chelsio.com #define __CXGB3I_H__
156f7efaabSkxie@chelsio.com 
166f7efaabSkxie@chelsio.com #define CXGB3I_SCSI_HOST_QDEPTH 1024
176f7efaabSkxie@chelsio.com #define CXGB3I_MAX_LUN		512
186f7efaabSkxie@chelsio.com #define ISCSI_PDU_NONPAYLOAD_MAX \
196f7efaabSkxie@chelsio.com 	(sizeof(struct iscsi_hdr) + ISCSI_MAX_AHS_SIZE + 2*ISCSI_DIGEST_SIZE)
206f7efaabSkxie@chelsio.com 
216f7efaabSkxie@chelsio.com /*for TX: a skb must have a headroom of at least TX_HEADER_LEN bytes */
226f7efaabSkxie@chelsio.com #define CXGB3I_TX_HEADER_LEN \
236f7efaabSkxie@chelsio.com 	(sizeof(struct tx_data_wr) + sizeof(struct sge_opaque_hdr))
246f7efaabSkxie@chelsio.com 
256f7efaabSkxie@chelsio.com extern cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS];
266f7efaabSkxie@chelsio.com 
cxgb3i_get_private_ipv4addr(struct net_device * ndev)27716163ffSkxie@chelsio.com static inline unsigned int cxgb3i_get_private_ipv4addr(struct net_device *ndev)
28716163ffSkxie@chelsio.com {
29716163ffSkxie@chelsio.com 	return ((struct port_info *)(netdev_priv(ndev)))->iscsi_ipv4addr;
30716163ffSkxie@chelsio.com }
31716163ffSkxie@chelsio.com 
cxgb3i_set_private_ipv4addr(struct net_device * ndev,unsigned int addr)32716163ffSkxie@chelsio.com static inline void cxgb3i_set_private_ipv4addr(struct net_device *ndev,
33716163ffSkxie@chelsio.com 						unsigned int addr)
34716163ffSkxie@chelsio.com {
35716163ffSkxie@chelsio.com 	struct port_info *pi =  (struct port_info *)netdev_priv(ndev);
36716163ffSkxie@chelsio.com 
37716163ffSkxie@chelsio.com 	pi->iscsic.flags = addr ? 1 : 0;
38716163ffSkxie@chelsio.com 	pi->iscsi_ipv4addr = addr;
39716163ffSkxie@chelsio.com 	if (addr)
40716163ffSkxie@chelsio.com 		memcpy(pi->iscsic.mac_addr, ndev->dev_addr, ETH_ALEN);
41716163ffSkxie@chelsio.com }
426f7efaabSkxie@chelsio.com 
436f7efaabSkxie@chelsio.com struct cpl_iscsi_hdr_norss {
446f7efaabSkxie@chelsio.com 	union opcode_tid ot;
456f7efaabSkxie@chelsio.com 	u16 pdu_len_ddp;
466f7efaabSkxie@chelsio.com 	u16 len;
476f7efaabSkxie@chelsio.com 	u32 seq;
486f7efaabSkxie@chelsio.com 	u16 urg;
496f7efaabSkxie@chelsio.com 	u8 rsvd;
506f7efaabSkxie@chelsio.com 	u8 status;
516f7efaabSkxie@chelsio.com };
526f7efaabSkxie@chelsio.com 
536f7efaabSkxie@chelsio.com struct cpl_rx_data_ddp_norss {
546f7efaabSkxie@chelsio.com 	union opcode_tid ot;
556f7efaabSkxie@chelsio.com 	u16 urg;
566f7efaabSkxie@chelsio.com 	u16 len;
576f7efaabSkxie@chelsio.com 	u32 seq;
586f7efaabSkxie@chelsio.com 	u32 nxt_seq;
596f7efaabSkxie@chelsio.com 	u32 ulp_crc;
606f7efaabSkxie@chelsio.com 	u32 ddp_status;
616f7efaabSkxie@chelsio.com };
626f7efaabSkxie@chelsio.com #endif
63