linux/drivers/scsi/cxgbi/libcxgbi.c

/*
 * libcxgbi.c: Chelsio common library for T3/T4 iSCSI driver.
 *
 * Copyright (c) 2010-2015 Chelsio Communications, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * Written by: Karen Xie ([email protected])
 * Written by: Rakesh Ranjan ([email protected])
 */

#define pr_fmt(fmt)

#include <linux/skbuff.h>
#include <linux/crypto.h>
#include <linux/scatterlist.h>
#include <linux/pci.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_host.h>
#include <linux/if_vlan.h>
#include <linux/inet.h>
#include <net/dst.h>
#include <net/route.h>
#include <net/ipv6.h>
#include <net/ip6_route.h>
#include <net/addrconf.h>

#include <linux/inetdevice.h>	/* ip_dev_find */
#include <linux/module.h>
#include <net/tcp.h>

static unsigned int dbg_level;

#include "libcxgbi.h"

#define DRV_MODULE_NAME
#define DRV_MODULE_DESC
#define DRV_MODULE_VERSION
#define DRV_MODULE_RELDATE

static char version[] =;

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_VERSION();
MODULE_LICENSE();

module_param(dbg_level, uint, 0644);
MODULE_PARM_DESC();


/*
 * cxgbi device management
 * maintains a list of the cxgbi devices
 */
static LIST_HEAD(cdev_list);
static DEFINE_MUTEX(cdev_mutex);

static LIST_HEAD(cdev_rcu_list);
static DEFINE_SPINLOCK(cdev_rcu_lock);

static inline void cxgbi_decode_sw_tag(u32 sw_tag, int *idx, int *age)
{}

int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base,
				unsigned int max_conn)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_device_portmap_cleanup(struct cxgbi_device *cdev)
{}
EXPORT_SYMBOL_GPL();

static inline void cxgbi_device_destroy(struct cxgbi_device *cdev)
{}

struct cxgbi_device *cxgbi_device_register(unsigned int extra,
					   unsigned int nports)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_device_unregister(struct cxgbi_device *cdev)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_device_unregister_all(unsigned int flag)
{}
EXPORT_SYMBOL_GPL();

struct cxgbi_device *cxgbi_device_find_by_lldev(void *lldev)
{}
EXPORT_SYMBOL_GPL();

struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *ndev,
						 int *port)
{}
EXPORT_SYMBOL_GPL();

struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *ndev,
						     int *port)
{}
EXPORT_SYMBOL_GPL();

static struct cxgbi_device *cxgbi_device_find_by_mac(struct net_device *ndev,
						     int *port)
{}

void cxgbi_hbas_remove(struct cxgbi_device *cdev)
{}
EXPORT_SYMBOL_GPL();

int cxgbi_hbas_add(struct cxgbi_device *cdev, u64 max_lun,
		unsigned int max_conns, const struct scsi_host_template *sht,
		struct scsi_transport_template *stt)
{}
EXPORT_SYMBOL_GPL();

/*
 * iSCSI offload
 *
 * - source port management
 *   To find a free source port in the port allocation map we use a very simple
 *   rotor scheme to look for the next free port.
 *
 *   If a source port has been specified make sure that it doesn't collide with
 *   our normal source port allocation map.  If it's outside the range of our
 *   allocation/deallocation scheme just let them use it.
 *
 *   If the source port is outside our allocation range, the caller is
 *   responsible for keeping track of their port usage.
 */

static struct cxgbi_sock *find_sock_on_port(struct cxgbi_device *cdev,
					    unsigned char port_id)
{}

static int sock_get_port(struct cxgbi_sock *csk)
{}

static void sock_put_port(struct cxgbi_sock *csk)
{}

/*
 * iscsi tcp connection
 */
void cxgbi_sock_free_cpl_skbs(struct cxgbi_sock *csk)
{}
EXPORT_SYMBOL_GPL();

static struct cxgbi_sock *cxgbi_sock_create(struct cxgbi_device *cdev)
{}

static struct rtable *find_route_ipv4(struct flowi4 *fl4,
				      __be32 saddr, __be32 daddr,
				      __be16 sport, __be16 dport, u8 tos,
				      int ifindex)
{}

static struct cxgbi_sock *
cxgbi_check_route(struct sockaddr *dst_addr, int ifindex)
{}

#if IS_ENABLED(CONFIG_IPV6)
static struct rt6_info *find_route_ipv6(const struct in6_addr *saddr,
					const struct in6_addr *daddr,
					int ifindex)
{}

static struct cxgbi_sock *
cxgbi_check_route6(struct sockaddr *dst_addr, int ifindex)
{}
#endif /* IS_ENABLED(CONFIG_IPV6) */

void cxgbi_sock_established(struct cxgbi_sock *csk, unsigned int snd_isn,
			unsigned int opt)
{}
EXPORT_SYMBOL_GPL();

static void cxgbi_inform_iscsi_conn_closing(struct cxgbi_sock *csk)
{}

void cxgbi_sock_closed(struct cxgbi_sock *csk)
{}
EXPORT_SYMBOL_GPL();

static void need_active_close(struct cxgbi_sock *csk)
{}

void cxgbi_sock_fail_act_open(struct cxgbi_sock *csk, int errno)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_sock_act_open_req_arp_failure(void *handle, struct sk_buff *skb)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_sock_rcv_abort_rpl(struct cxgbi_sock *csk)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_sock_rcv_peer_close(struct cxgbi_sock *csk)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_sock_rcv_close_conn_rpl(struct cxgbi_sock *csk, u32 snd_nxt)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_sock_rcv_wr_ack(struct cxgbi_sock *csk, unsigned int credits,
			   unsigned int snd_una, int seq_chk)
{}
EXPORT_SYMBOL_GPL();

static unsigned int cxgbi_sock_find_best_mtu(struct cxgbi_sock *csk,
					     unsigned short mtu)
{}

unsigned int cxgbi_sock_select_mss(struct cxgbi_sock *csk, unsigned int pmtu)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_sock_skb_entail(struct cxgbi_sock *csk, struct sk_buff *skb)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_sock_purge_wr_queue(struct cxgbi_sock *csk)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_sock_check_wr_invariants(const struct cxgbi_sock *csk)
{}
EXPORT_SYMBOL_GPL();

static inline void
scmd_get_params(struct scsi_cmnd *sc, struct scatterlist **sgl,
		unsigned int *sgcnt, unsigned int *dlen,
		unsigned int prot)
{}

void cxgbi_ddp_set_one_ppod(struct cxgbi_pagepod *ppod,
			    struct cxgbi_task_tag_info *ttinfo,
			    struct scatterlist **sg_pp, unsigned int *sg_off)
{}
EXPORT_SYMBOL_GPL();

/*
 * APIs interacting with open-iscsi libraries
 */

int cxgbi_ddp_ppm_setup(void **ppm_pp, struct cxgbi_device *cdev,
			struct cxgbi_tag_format *tformat,
			unsigned int iscsi_size, unsigned int llimit,
			unsigned int start, unsigned int rsvd_factor,
			unsigned int edram_start, unsigned int edram_size)
{}
EXPORT_SYMBOL_GPL();

static int cxgbi_ddp_sgl_check(struct scatterlist *sgl, int nents)
{}

static int cxgbi_ddp_reserve(struct cxgbi_conn *cconn,
			     struct cxgbi_task_data *tdata, u32 sw_tag,
			     unsigned int xferlen)
{}

static void task_release_itt(struct iscsi_task *task, itt_t hdr_itt)
{}

static inline u32 cxgbi_build_sw_tag(u32 idx, u32 age)
{}

static int task_reserve_itt(struct iscsi_task *task, itt_t *hdr_itt)
{}

void cxgbi_parse_pdu_itt(struct iscsi_conn *conn, itt_t itt, int *idx, int *age)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_conn_tx_open(struct cxgbi_sock *csk)
{}
EXPORT_SYMBOL_GPL();

/*
 * pdu receive, interact with libiscsi_tcp
 */
static inline int read_pdu_skb(struct iscsi_conn *conn,
			       struct sk_buff *skb,
			       unsigned int offset,
			       int offloaded)
{}

static int
skb_read_pdu_bhs(struct cxgbi_sock *csk, struct iscsi_conn *conn,
		 struct sk_buff *skb)
{}

static int skb_read_pdu_data(struct iscsi_conn *conn, struct sk_buff *lskb,
			     struct sk_buff *skb, unsigned int offset)
{}

static void csk_return_rx_credits(struct cxgbi_sock *csk, int copied)
{}

void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk)
{}
EXPORT_SYMBOL_GPL();

static int sgl_seek_offset(struct scatterlist *sgl, unsigned int sgcnt,
				unsigned int offset, unsigned int *off,
				struct scatterlist **sgp)
{}

static int
sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset,
		  unsigned int dlen, struct page_frag *frags,
		  int frag_max, u32 *dlimit)
{}

static void cxgbi_task_data_sgl_check(struct iscsi_task *task)
{}

static int
cxgbi_task_data_sgl_read(struct iscsi_task *task, u32 offset, u32 count,
			 u32 *dlimit)
{}

int cxgbi_conn_alloc_pdu(struct iscsi_task *task, u8 op)
{}
EXPORT_SYMBOL_GPL();

static int
cxgbi_prep_iso_info(struct iscsi_task *task, struct sk_buff *skb,
		    u32 count)
{}

static inline void tx_skb_setmode(struct sk_buff *skb, int hcrc, int dcrc)
{}

static struct page *rsvd_page;

int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset,
			      unsigned int count)
{}
EXPORT_SYMBOL_GPL();

static int cxgbi_sock_tx_queue_up(struct cxgbi_sock *csk, struct sk_buff *skb)
{}

static int cxgbi_sock_send_skb(struct cxgbi_sock *csk, struct sk_buff *skb)
{}

int cxgbi_conn_xmit_pdu(struct iscsi_task *task)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_cleanup_task(struct iscsi_task *task)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_get_conn_stats(struct iscsi_cls_conn *cls_conn,
				struct iscsi_stats *stats)
{}
EXPORT_SYMBOL_GPL();

static int cxgbi_conn_max_xmit_dlength(struct iscsi_conn *conn)
{}

static int cxgbi_conn_max_recv_dlength(struct iscsi_conn *conn)
{}

int cxgbi_set_conn_param(struct iscsi_cls_conn *cls_conn,
			enum iscsi_param param, char *buf, int buflen)
{}
EXPORT_SYMBOL_GPL();

int cxgbi_get_ep_param(struct iscsi_endpoint *ep, enum iscsi_param param,
		       char *buf)
{}
EXPORT_SYMBOL_GPL();

struct iscsi_cls_conn *
cxgbi_create_conn(struct iscsi_cls_session *cls_session, u32 cid)
{}
EXPORT_SYMBOL_GPL();

int cxgbi_bind_conn(struct iscsi_cls_session *cls_session,
				struct iscsi_cls_conn *cls_conn,
				u64 transport_eph, int is_leading)
{}
EXPORT_SYMBOL_GPL();

struct iscsi_cls_session *cxgbi_create_session(struct iscsi_endpoint *ep,
						u16 cmds_max, u16 qdepth,
						u32 initial_cmdsn)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_destroy_session(struct iscsi_cls_session *cls_session)
{}
EXPORT_SYMBOL_GPL();

int cxgbi_set_host_param(struct Scsi_Host *shost, enum iscsi_host_param param,
			char *buf, int buflen)
{}
EXPORT_SYMBOL_GPL();

int cxgbi_get_host_param(struct Scsi_Host *shost, enum iscsi_host_param param,
			char *buf)
{}
EXPORT_SYMBOL_GPL();

struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *shost,
					struct sockaddr *dst_addr,
					int non_blocking)
{}
EXPORT_SYMBOL_GPL();

int cxgbi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_ep_disconnect(struct iscsi_endpoint *ep)
{}
EXPORT_SYMBOL_GPL();

int cxgbi_iscsi_init(struct iscsi_transport *itp,
			struct scsi_transport_template **stt)
{}
EXPORT_SYMBOL_GPL();

void cxgbi_iscsi_cleanup(struct iscsi_transport *itp,
			struct scsi_transport_template **stt)
{}
EXPORT_SYMBOL_GPL();

umode_t cxgbi_attr_is_visible(int param_type, int param)
{}
EXPORT_SYMBOL_GPL();

static int __init libcxgbi_init_module(void)
{}

static void __exit libcxgbi_exit_module(void)
{}

module_init();
module_exit(libcxgbi_exit_module);