Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2016-2017, Mellanox Technologies. All rights reserved.
0003  * Copyright (c) 2016-2017, Dave Watson <davejwatson@fb.com>. All rights reserved.
0004  *
0005  * This software is available to you under a choice of one of two
0006  * licenses.  You may choose to be licensed under the terms of the GNU
0007  * General Public License (GPL) Version 2, available from the file
0008  * COPYING in the main directory of this source tree, or the
0009  * OpenIB.org BSD license below:
0010  *
0011  *     Redistribution and use in source and binary forms, with or
0012  *     without modification, are permitted provided that the following
0013  *     conditions are met:
0014  *
0015  *      - Redistributions of source code must retain the above
0016  *        copyright notice, this list of conditions and the following
0017  *        disclaimer.
0018  *
0019  *      - Redistributions in binary form must reproduce the above
0020  *        copyright notice, this list of conditions and the following
0021  *        disclaimer in the documentation and/or other materials
0022  *        provided with the distribution.
0023  *
0024  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0025  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0026  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0027  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
0028  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0029  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0030  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0031  * SOFTWARE.
0032  */
0033 
0034 #include <linux/kref.h>
0035 #include <linux/list.h>
0036 
0037 struct sock;
0038 
0039 #define TLS_TOE_DEVICE_NAME_MAX     32
0040 
0041 /*
0042  * This structure defines the routines for Inline TLS driver.
0043  * The following routines are optional and filled with a
0044  * null pointer if not defined.
0045  *
0046  * @name: Its the name of registered Inline tls device
0047  * @dev_list: Inline tls device list
0048  * int (*feature)(struct tls_toe_device *device);
0049  *     Called to return Inline TLS driver capability
0050  *
0051  * int (*hash)(struct tls_toe_device *device, struct sock *sk);
0052  *     This function sets Inline driver for listen and program
0053  *     device specific functioanlity as required
0054  *
0055  * void (*unhash)(struct tls_toe_device *device, struct sock *sk);
0056  *     This function cleans listen state set by Inline TLS driver
0057  *
0058  * void (*release)(struct kref *kref);
0059  *     Release the registered device and allocated resources
0060  * @kref: Number of reference to tls_toe_device
0061  */
0062 struct tls_toe_device {
0063     char name[TLS_TOE_DEVICE_NAME_MAX];
0064     struct list_head dev_list;
0065     int  (*feature)(struct tls_toe_device *device);
0066     int  (*hash)(struct tls_toe_device *device, struct sock *sk);
0067     void (*unhash)(struct tls_toe_device *device, struct sock *sk);
0068     void (*release)(struct kref *kref);
0069     struct kref kref;
0070 };
0071 
0072 int tls_toe_bypass(struct sock *sk);
0073 int tls_toe_hash(struct sock *sk);
0074 void tls_toe_unhash(struct sock *sk);
0075 
0076 void tls_toe_register_device(struct tls_toe_device *device);
0077 void tls_toe_unregister_device(struct tls_toe_device *device);