Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is provided under a dual BSD/GPLv2 license.  When using or
0003  *   redistributing this file, you may do so under either license.
0004  *
0005  *   GPL LICENSE SUMMARY
0006  *
0007  *   Copyright(c) 2012 Intel Corporation. All rights reserved.
0008  *   Copyright (C) 2015 EMC Corporation. All Rights Reserved.
0009  *
0010  *   This program is free software; you can redistribute it and/or modify
0011  *   it under the terms of version 2 of the GNU General Public License as
0012  *   published by the Free Software Foundation.
0013  *
0014  *   BSD LICENSE
0015  *
0016  *   Copyright(c) 2012 Intel Corporation. All rights reserved.
0017  *   Copyright (C) 2015 EMC Corporation. All Rights Reserved.
0018  *
0019  *   Redistribution and use in source and binary forms, with or without
0020  *   modification, are permitted provided that the following conditions
0021  *   are met:
0022  *
0023  *     * Redistributions of source code must retain the above copyright
0024  *       notice, this list of conditions and the following disclaimer.
0025  *     * Redistributions in binary form must reproduce the above copy
0026  *       notice, this list of conditions and the following disclaimer in
0027  *       the documentation and/or other materials provided with the
0028  *       distribution.
0029  *     * Neither the name of Intel Corporation nor the names of its
0030  *       contributors may be used to endorse or promote products derived
0031  *       from this software without specific prior written permission.
0032  *
0033  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0034  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0035  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0036  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0037  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0038  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0039  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0040  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0041  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0042  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0043  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0044  *
0045  * PCIe NTB Transport Linux driver
0046  *
0047  * Contact Information:
0048  * Jon Mason <jon.mason@intel.com>
0049  */
0050 
0051 struct ntb_transport_qp;
0052 
0053 struct ntb_transport_client {
0054     struct device_driver driver;
0055     int (*probe)(struct device *client_dev);
0056     void (*remove)(struct device *client_dev);
0057 };
0058 
0059 int ntb_transport_register_client(struct ntb_transport_client *drvr);
0060 void ntb_transport_unregister_client(struct ntb_transport_client *drvr);
0061 int ntb_transport_register_client_dev(char *device_name);
0062 void ntb_transport_unregister_client_dev(char *device_name);
0063 
0064 struct ntb_queue_handlers {
0065     void (*rx_handler)(struct ntb_transport_qp *qp, void *qp_data,
0066                void *data, int len);
0067     void (*tx_handler)(struct ntb_transport_qp *qp, void *qp_data,
0068                void *data, int len);
0069     void (*event_handler)(void *data, int status);
0070 };
0071 
0072 unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp);
0073 unsigned int ntb_transport_max_size(struct ntb_transport_qp *qp);
0074 struct ntb_transport_qp *
0075 ntb_transport_create_queue(void *data, struct device *client_dev,
0076                const struct ntb_queue_handlers *handlers);
0077 void ntb_transport_free_queue(struct ntb_transport_qp *qp);
0078 int ntb_transport_rx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,
0079                  unsigned int len);
0080 int ntb_transport_tx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,
0081                  unsigned int len);
0082 void *ntb_transport_rx_remove(struct ntb_transport_qp *qp, unsigned int *len);
0083 void ntb_transport_link_up(struct ntb_transport_qp *qp);
0084 void ntb_transport_link_down(struct ntb_transport_qp *qp);
0085 bool ntb_transport_link_query(struct ntb_transport_qp *qp);
0086 unsigned int ntb_transport_tx_free_entry(struct ntb_transport_qp *qp);