brintos

brintos / linux-shallow public Read only

0
0
Text · 3.8 KiB · 7243eb9 Raw
87 lines · c
1/*2 * This file is provided under a dual BSD/GPLv2 license.  When using or3 *   redistributing this file, you may do so under either license.4 *5 *   GPL LICENSE SUMMARY6 *7 *   Copyright(c) 2012 Intel Corporation. All rights reserved.8 *   Copyright (C) 2015 EMC Corporation. All Rights Reserved.9 *10 *   This program is free software; you can redistribute it and/or modify11 *   it under the terms of version 2 of the GNU General Public License as12 *   published by the Free Software Foundation.13 *14 *   BSD LICENSE15 *16 *   Copyright(c) 2012 Intel Corporation. All rights reserved.17 *   Copyright (C) 2015 EMC Corporation. All Rights Reserved.18 *19 *   Redistribution and use in source and binary forms, with or without20 *   modification, are permitted provided that the following conditions21 *   are met:22 *23 *     * Redistributions of source code must retain the above copyright24 *       notice, this list of conditions and the following disclaimer.25 *     * Redistributions in binary form must reproduce the above copy26 *       notice, this list of conditions and the following disclaimer in27 *       the documentation and/or other materials provided with the28 *       distribution.29 *     * Neither the name of Intel Corporation nor the names of its30 *       contributors may be used to endorse or promote products derived31 *       from this software without specific prior written permission.32 *33 *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS34 *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT35 *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR36 *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT37 *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,38 *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT39 *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,40 *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY41 *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT42 *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE43 *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.44 *45 * PCIe NTB Transport Linux driver46 *47 * Contact Information:48 * Jon Mason <jon.mason@intel.com>49 */50 51struct ntb_transport_qp;52 53struct ntb_transport_client {54	struct device_driver driver;55	int (*probe)(struct device *client_dev);56	void (*remove)(struct device *client_dev);57};58 59int ntb_transport_register_client(struct ntb_transport_client *drvr);60void ntb_transport_unregister_client(struct ntb_transport_client *drvr);61int ntb_transport_register_client_dev(char *device_name);62void ntb_transport_unregister_client_dev(char *device_name);63 64struct ntb_queue_handlers {65	void (*rx_handler)(struct ntb_transport_qp *qp, void *qp_data,66			   void *data, int len);67	void (*tx_handler)(struct ntb_transport_qp *qp, void *qp_data,68			   void *data, int len);69	void (*event_handler)(void *data, int status);70};71 72unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp);73unsigned int ntb_transport_max_size(struct ntb_transport_qp *qp);74struct ntb_transport_qp *75ntb_transport_create_queue(void *data, struct device *client_dev,76			   const struct ntb_queue_handlers *handlers);77void ntb_transport_free_queue(struct ntb_transport_qp *qp);78int ntb_transport_rx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,79			     unsigned int len);80int ntb_transport_tx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,81			     unsigned int len);82void *ntb_transport_rx_remove(struct ntb_transport_qp *qp, unsigned int *len);83void ntb_transport_link_up(struct ntb_transport_qp *qp);84void ntb_transport_link_down(struct ntb_transport_qp *qp);85bool ntb_transport_link_query(struct ntb_transport_qp *qp);86unsigned int ntb_transport_tx_free_entry(struct ntb_transport_qp *qp);87