Commit f21912ed authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller
Browse files

net/tls: rename tls_device to tls_toe_device



Rename struct tls_device to struct tls_toe_device to avoid
confusion with normal, non-TOE offload.

No functional changes.

Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarJohn Hurley <john.hurley@netronome.com>
Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 25a3cd81
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ struct tls_scmd {
};

struct chtls_dev {
	struct tls_device tlsdev;
	struct tls_toe_device tlsdev;
	struct list_head list;
	struct cxgb4_lld_info *lldi;
	struct pci_dev *pdev;
@@ -363,7 +363,7 @@ enum {
#define TCP_PAGE(sk)   (sk->sk_frag.page)
#define TCP_OFF(sk)    (sk->sk_frag.offset)

static inline struct chtls_dev *to_chtls_dev(struct tls_device *tlsdev)
static inline struct chtls_dev *to_chtls_dev(struct tls_toe_device *tlsdev)
{
	return container_of(tlsdev, struct chtls_dev, tlsdev);
}
+10 −10
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ static void chtls_stop_listen(struct chtls_dev *cdev, struct sock *sk)
	mutex_unlock(&notify_mutex);
}

static int chtls_inline_feature(struct tls_device *dev)
static int chtls_inline_feature(struct tls_toe_device *dev)
{
	struct net_device *netdev;
	struct chtls_dev *cdev;
@@ -140,7 +140,7 @@ static int chtls_inline_feature(struct tls_device *dev)
	return 0;
}

static int chtls_create_hash(struct tls_device *dev, struct sock *sk)
static int chtls_create_hash(struct tls_toe_device *dev, struct sock *sk)
{
	struct chtls_dev *cdev = to_chtls_dev(dev);

@@ -149,7 +149,7 @@ static int chtls_create_hash(struct tls_device *dev, struct sock *sk)
	return 0;
}

static void chtls_destroy_hash(struct tls_device *dev, struct sock *sk)
static void chtls_destroy_hash(struct tls_toe_device *dev, struct sock *sk)
{
	struct chtls_dev *cdev = to_chtls_dev(dev);

@@ -161,7 +161,7 @@ static void chtls_free_uld(struct chtls_dev *cdev)
{
	int i;

	tls_unregister_device(&cdev->tlsdev);
	tls_toe_unregister_device(&cdev->tlsdev);
	kvfree(cdev->kmap.addr);
	idr_destroy(&cdev->hwtid_idr);
	for (i = 0; i < (1 << RSPQ_HASH_BITS); i++)
@@ -173,27 +173,27 @@ static void chtls_free_uld(struct chtls_dev *cdev)

static inline void chtls_dev_release(struct kref *kref)
{
	struct tls_toe_device *dev;
	struct chtls_dev *cdev;
	struct tls_device *dev;

	dev = container_of(kref, struct tls_device, kref);
	dev = container_of(kref, struct tls_toe_device, kref);
	cdev = to_chtls_dev(dev);
	chtls_free_uld(cdev);
}

static void chtls_register_dev(struct chtls_dev *cdev)
{
	struct tls_device *tlsdev = &cdev->tlsdev;
	struct tls_toe_device *tlsdev = &cdev->tlsdev;

	strlcpy(tlsdev->name, "chtls", TLS_DEVICE_NAME_MAX);
	strlcpy(tlsdev->name, "chtls", TLS_TOE_DEVICE_NAME_MAX);
	strlcat(tlsdev->name, cdev->lldi->ports[0]->name,
		TLS_DEVICE_NAME_MAX);
		TLS_TOE_DEVICE_NAME_MAX);
	tlsdev->feature = chtls_inline_feature;
	tlsdev->hash = chtls_create_hash;
	tlsdev->unhash = chtls_destroy_hash;
	tlsdev->release = chtls_dev_release;
	kref_init(&tlsdev->kref);
	tls_register_device(tlsdev);
	tls_toe_register_device(tlsdev);
	cdev->cdev_state = CHTLS_CDEV_STATE_UP;
}

+12 −12
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@

struct sock;

#define TLS_DEVICE_NAME_MAX		32
#define TLS_TOE_DEVICE_NAME_MAX		32

/*
 * This structure defines the routines for Inline TLS driver.
@@ -45,29 +45,29 @@ struct sock;
 *
 * @name: Its the name of registered Inline tls device
 * @dev_list: Inline tls device list
 * int (*feature)(struct tls_device *device);
 * int (*feature)(struct tls_toe_device *device);
 *     Called to return Inline TLS driver capability
 *
 * int (*hash)(struct tls_device *device, struct sock *sk);
 * int (*hash)(struct tls_toe_device *device, struct sock *sk);
 *     This function sets Inline driver for listen and program
 *     device specific functioanlity as required
 *
 * void (*unhash)(struct tls_device *device, struct sock *sk);
 * void (*unhash)(struct tls_toe_device *device, struct sock *sk);
 *     This function cleans listen state set by Inline TLS driver
 *
 * void (*release)(struct kref *kref);
 *     Release the registered device and allocated resources
 * @kref: Number of reference to tls_device
 * @kref: Number of reference to tls_toe_device
 */
struct tls_device {
	char name[TLS_DEVICE_NAME_MAX];
struct tls_toe_device {
	char name[TLS_TOE_DEVICE_NAME_MAX];
	struct list_head dev_list;
	int  (*feature)(struct tls_device *device);
	int  (*hash)(struct tls_device *device, struct sock *sk);
	void (*unhash)(struct tls_device *device, struct sock *sk);
	int  (*feature)(struct tls_toe_device *device);
	int  (*hash)(struct tls_toe_device *device, struct sock *sk);
	void (*unhash)(struct tls_toe_device *device, struct sock *sk);
	void (*release)(struct kref *kref);
	struct kref kref;
};

void tls_register_device(struct tls_device *device);
void tls_unregister_device(struct tls_device *device);
void tls_toe_register_device(struct tls_toe_device *device);
void tls_toe_unregister_device(struct tls_toe_device *device);
+7 −7
Original line number Diff line number Diff line
@@ -657,8 +657,8 @@ static void tls_hw_sk_destruct(struct sock *sk)

static int tls_hw_prot(struct sock *sk)
{
	struct tls_toe_device *dev;
	struct tls_context *ctx;
	struct tls_device *dev;
	int rc = 0;

	spin_lock_bh(&device_spinlock);
@@ -688,7 +688,7 @@ out:
static void tls_hw_unhash(struct sock *sk)
{
	struct tls_context *ctx = tls_get_ctx(sk);
	struct tls_device *dev;
	struct tls_toe_device *dev;

	spin_lock_bh(&device_spinlock);
	list_for_each_entry(dev, &device_list, dev_list) {
@@ -707,7 +707,7 @@ static void tls_hw_unhash(struct sock *sk)
static int tls_hw_hash(struct sock *sk)
{
	struct tls_context *ctx = tls_get_ctx(sk);
	struct tls_device *dev;
	struct tls_toe_device *dev;
	int err;

	err = ctx->sk_proto->hash(sk);
@@ -878,21 +878,21 @@ static size_t tls_get_info_size(const struct sock *sk)
	return size;
}

void tls_register_device(struct tls_device *device)
void tls_toe_register_device(struct tls_toe_device *device)
{
	spin_lock_bh(&device_spinlock);
	list_add_tail(&device->dev_list, &device_list);
	spin_unlock_bh(&device_spinlock);
}
EXPORT_SYMBOL(tls_register_device);
EXPORT_SYMBOL(tls_toe_register_device);

void tls_unregister_device(struct tls_device *device)
void tls_toe_unregister_device(struct tls_toe_device *device)
{
	spin_lock_bh(&device_spinlock);
	list_del(&device->dev_list);
	spin_unlock_bh(&device_spinlock);
}
EXPORT_SYMBOL(tls_unregister_device);
EXPORT_SYMBOL(tls_toe_unregister_device);

static struct tcp_ulp_ops tcp_tls_ulp_ops __read_mostly = {
	.name			= "tls",