Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91f0ebf7 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller
Browse files

[DCCP] CCID: Improve CCID infrastructure



1. No need for ->ccid_init nor ->ccid_exit, this is what module_{init,exit}
   does and anynways neither ccid2 nor ccid3 were using it.

2. Rename struct ccid to struct ccid_operations and introduce struct ccid
   with a pointer to ccid_operations and rigth after it the rx or tx
   private state.

3. Remove the pointer to the state of the half connections from struct
   dccp_sock, now its derived thru ccid_priv() from the ccid pointer.

Now we also can implement the setsockopt for changing the CCID easily as
no ccid init routines can affect struct dccp_sock in any way that prevents
other CCIDs from working if a CCID switch operation is asked by apps.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f38c39d6
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -478,8 +478,6 @@ struct dccp_sock {
	__u32				dccps_mss_cache;
	struct dccp_options		dccps_options;
	struct dccp_ackvec		*dccps_hc_rx_ackvec;
	void				*dccps_hc_rx_ccid_private;
	void				*dccps_hc_tx_ccid_private;
	struct ccid			*dccps_hc_rx_ccid;
	struct ccid			*dccps_hc_tx_ccid;
	struct dccp_options_received	dccps_options_received;
+154 −34
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@

#include "ccid.h"

static struct ccid *ccids[CCID_MAX];
static struct ccid_operations *ccids[CCID_MAX];
#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
static atomic_t ccids_lockct = ATOMIC_INIT(0);
static DEFINE_SPINLOCK(ccids_lock);
@@ -55,82 +55,202 @@ static inline void ccids_read_unlock(void)
#define ccids_read_unlock() do { } while(0)
#endif

int ccid_register(struct ccid *ccid)
static kmem_cache_t *ccid_kmem_cache_create(int obj_size, const char *fmt,...)
{
	int err;
	kmem_cache_t *slab;
	char slab_name_fmt[32], *slab_name;
	va_list args;

	va_start(args, fmt);
	vsnprintf(slab_name_fmt, sizeof(slab_name_fmt), fmt, args);
	va_end(args);

	slab_name = kstrdup(slab_name_fmt, GFP_KERNEL);
	if (slab_name == NULL)
		return NULL;
	slab = kmem_cache_create(slab_name, sizeof(struct ccid) + obj_size, 0,
				 SLAB_HWCACHE_ALIGN, NULL, NULL);
	if (slab == NULL)
		kfree(slab_name);
	return slab;
}

static void ccid_kmem_cache_destroy(kmem_cache_t *slab)
{
	if (slab != NULL) {
		const char *name = kmem_cache_name(slab);

		kmem_cache_destroy(slab);
		kfree(name);
	}
}

int ccid_register(struct ccid_operations *ccid_ops)
{
	int err = -ENOBUFS;

	ccid_ops->ccid_hc_rx_slab =
			ccid_kmem_cache_create(ccid_ops->ccid_hc_rx_obj_size,
					       "%s_hc_rx_sock",
					       ccid_ops->ccid_name);
	if (ccid_ops->ccid_hc_rx_slab == NULL)
		goto out;

	ccid_ops->ccid_hc_tx_slab =
			ccid_kmem_cache_create(ccid_ops->ccid_hc_tx_obj_size,
					       "%s_hc_tx_sock",
					       ccid_ops->ccid_name);
	if (ccid_ops->ccid_hc_tx_slab == NULL)
		goto out_free_rx_slab;

	ccids_write_lock();
	err = -EEXIST;
	if (ccids[ccid->ccid_id] == NULL) {
		ccids[ccid->ccid_id] = ccid;
	if (ccids[ccid_ops->ccid_id] == NULL) {
		ccids[ccid_ops->ccid_id] = ccid_ops;
		err = 0;
	}
	ccids_write_unlock();
	if (err == 0)
	if (err != 0)
		goto out_free_tx_slab;

	pr_info("CCID: Registered CCID %d (%s)\n",
			ccid->ccid_id, ccid->ccid_name);
		ccid_ops->ccid_id, ccid_ops->ccid_name);
out:
	return err;
out_free_tx_slab:
	ccid_kmem_cache_destroy(ccid_ops->ccid_hc_tx_slab);
	ccid_ops->ccid_hc_tx_slab = NULL;
	goto out;
out_free_rx_slab:
	ccid_kmem_cache_destroy(ccid_ops->ccid_hc_rx_slab);
	ccid_ops->ccid_hc_rx_slab = NULL;
	goto out;
}

EXPORT_SYMBOL_GPL(ccid_register);

int ccid_unregister(struct ccid *ccid)
int ccid_unregister(struct ccid_operations *ccid_ops)
{
	ccids_write_lock();
	ccids[ccid->ccid_id] = NULL;
	ccids[ccid_ops->ccid_id] = NULL;
	ccids_write_unlock();

	ccid_kmem_cache_destroy(ccid_ops->ccid_hc_tx_slab);
	ccid_ops->ccid_hc_tx_slab = NULL;
	ccid_kmem_cache_destroy(ccid_ops->ccid_hc_rx_slab);
	ccid_ops->ccid_hc_rx_slab = NULL;

	pr_info("CCID: Unregistered CCID %d (%s)\n",
		ccid->ccid_id, ccid->ccid_name);
		ccid_ops->ccid_id, ccid_ops->ccid_name);
	return 0;
}

EXPORT_SYMBOL_GPL(ccid_unregister);

struct ccid *ccid_init(unsigned char id, struct sock *sk)
struct ccid *ccid_new(unsigned char id, struct sock *sk, int rx, gfp_t gfp)
{
	struct ccid *ccid;
	struct ccid_operations *ccid_ops;
	struct ccid *ccid = NULL;

	ccids_read_lock();
#ifdef CONFIG_KMOD
	if (ccids[id] == NULL)
	if (ccids[id] == NULL) {
		/* We only try to load if in process context */
		ccids_read_unlock();
		if (gfp & GFP_ATOMIC)
			goto out;
		request_module("net-dccp-ccid-%d", id);
#endif
		ccids_read_lock();
	}
#endif
	ccid_ops = ccids[id];
	if (ccid_ops == NULL)
		goto out_unlock;

	ccid = ccids[id];
	if (ccid == NULL)
		goto out;
	if (!try_module_get(ccid_ops->ccid_owner))
		goto out_unlock;

	if (!try_module_get(ccid->ccid_owner))
		goto out_err;
	ccids_read_unlock();

	if (ccid->ccid_init != NULL && ccid->ccid_init(sk) != 0)
	ccid = kmem_cache_alloc(rx ? ccid_ops->ccid_hc_rx_slab :
				     ccid_ops->ccid_hc_tx_slab, gfp);
	if (ccid == NULL)
		goto out_module_put;
	ccid->ccid_ops = ccid_ops;
	if (rx) {
		memset(ccid + 1, 0, ccid_ops->ccid_hc_rx_obj_size);
		if (ccid->ccid_ops->ccid_hc_rx_init != NULL &&
		    ccid->ccid_ops->ccid_hc_rx_init(ccid, sk) != 0)
			goto out_free_ccid;
	} else {
		memset(ccid + 1, 0, ccid_ops->ccid_hc_tx_obj_size);
		if (ccid->ccid_ops->ccid_hc_tx_init != NULL &&
		    ccid->ccid_ops->ccid_hc_tx_init(ccid, sk) != 0)
			goto out_free_ccid;
	}
out:
	ccids_read_unlock();
	return ccid;
out_module_put:
	module_put(ccid->ccid_owner);
out_err:
out_unlock:
	ccids_read_unlock();
	goto out;
out_free_ccid:
	kmem_cache_free(rx ? ccid_ops->ccid_hc_rx_slab :
			ccid_ops->ccid_hc_tx_slab, ccid);
	ccid = NULL;
out_module_put:
	module_put(ccid_ops->ccid_owner);
	goto out;
}

EXPORT_SYMBOL_GPL(ccid_init);
EXPORT_SYMBOL_GPL(ccid_new);

struct ccid *ccid_hc_rx_new(unsigned char id, struct sock *sk, gfp_t gfp)
{
	return ccid_new(id, sk, 1, gfp);
}

EXPORT_SYMBOL_GPL(ccid_hc_rx_new);

void ccid_exit(struct ccid *ccid, struct sock *sk)
struct ccid *ccid_hc_tx_new(unsigned char id,struct sock *sk,  gfp_t gfp)
{
	return ccid_new(id, sk, 0, gfp);
}

EXPORT_SYMBOL_GPL(ccid_hc_tx_new);

static void ccid_delete(struct ccid *ccid, struct sock *sk, int rx)
{
	struct ccid_operations *ccid_ops;

	if (ccid == NULL)
		return;

	ccid_ops = ccid->ccid_ops;
	if (rx) {
		if (ccid_ops->ccid_hc_rx_exit != NULL)
			ccid_ops->ccid_hc_rx_exit(sk);
		kmem_cache_free(ccid_ops->ccid_hc_rx_slab,  ccid);
	} else {
		if (ccid_ops->ccid_hc_tx_exit != NULL)
			ccid_ops->ccid_hc_tx_exit(sk);
		kmem_cache_free(ccid_ops->ccid_hc_tx_slab,  ccid);
	}
	ccids_read_lock();
	if (ccids[ccid_ops->ccid_id] != NULL)
		module_put(ccid_ops->ccid_owner);
	ccids_read_unlock();
}

	if (ccids[ccid->ccid_id] != NULL) {
		if (ccid->ccid_exit != NULL)
			ccid->ccid_exit(sk);
		module_put(ccid->ccid_owner);
void ccid_hc_rx_delete(struct ccid *ccid, struct sock *sk)
{
	ccid_delete(ccid, sk, 1);
}

	ccids_read_unlock();
EXPORT_SYMBOL_GPL(ccid_hc_rx_delete);

void ccid_hc_tx_delete(struct ccid *ccid, struct sock *sk)
{
	ccid_delete(ccid, sk, 0);
}

EXPORT_SYMBOL_GPL(ccid_exit);
EXPORT_SYMBOL_GPL(ccid_hc_tx_delete);
+50 −65
Original line number Diff line number Diff line
@@ -23,14 +23,16 @@

struct tcp_info;

struct ccid {
struct ccid_operations {
	unsigned char	ccid_id;
	const char	*ccid_name;
	struct module	*ccid_owner;
	int		(*ccid_init)(struct sock *sk);
	void		(*ccid_exit)(struct sock *sk);
	int		(*ccid_hc_rx_init)(struct sock *sk);
	int		(*ccid_hc_tx_init)(struct sock *sk);
	kmem_cache_t	*ccid_hc_rx_slab;
	__u32		ccid_hc_rx_obj_size;
	kmem_cache_t	*ccid_hc_tx_slab;
	__u32		ccid_hc_tx_obj_size;
	int		(*ccid_hc_rx_init)(struct ccid *ccid, struct sock *sk);
	int		(*ccid_hc_tx_init)(struct ccid *ccid, struct sock *sk);
	void		(*ccid_hc_rx_exit)(struct sock *sk);
	void		(*ccid_hc_tx_exit)(struct sock *sk);
	void		(*ccid_hc_rx_packet_recv)(struct sock *sk,
@@ -67,75 +69,58 @@ struct ccid {
						 int __user *optlen);
};

extern int	   ccid_register(struct ccid *ccid);
extern int	   ccid_unregister(struct ccid *ccid);
extern int ccid_register(struct ccid_operations *ccid_ops);
extern int ccid_unregister(struct ccid_operations *ccid_ops);

extern struct ccid *ccid_init(unsigned char id, struct sock *sk);
extern void	   ccid_exit(struct ccid *ccid, struct sock *sk);
struct ccid {
	struct ccid_operations *ccid_ops;
	char		       ccid_priv[0];
};

static inline void __ccid_get(struct ccid *ccid)
static inline void *ccid_priv(const struct ccid *ccid)
{
	__module_get(ccid->ccid_owner);
	return (void *)ccid->ccid_priv;
}

extern struct ccid *ccid_new(unsigned char id, struct sock *sk, int rx,
			     gfp_t gfp);

extern struct ccid *ccid_hc_rx_new(unsigned char id, struct sock *sk,
				   gfp_t gfp);
extern struct ccid *ccid_hc_tx_new(unsigned char id, struct sock *sk,
				   gfp_t gfp);

extern void ccid_hc_rx_delete(struct ccid *ccid, struct sock *sk);
extern void ccid_hc_tx_delete(struct ccid *ccid, struct sock *sk);

static inline int ccid_hc_tx_send_packet(struct ccid *ccid, struct sock *sk,
					 struct sk_buff *skb, int len)
{
	int rc = 0;
	if (ccid->ccid_hc_tx_send_packet != NULL)
		rc = ccid->ccid_hc_tx_send_packet(sk, skb, len);
	if (ccid->ccid_ops->ccid_hc_tx_send_packet != NULL)
		rc = ccid->ccid_ops->ccid_hc_tx_send_packet(sk, skb, len);
	return rc;
}

static inline void ccid_hc_tx_packet_sent(struct ccid *ccid, struct sock *sk,
					  int more, int len)
{
	if (ccid->ccid_hc_tx_packet_sent != NULL)
		ccid->ccid_hc_tx_packet_sent(sk, more, len);
}

static inline int ccid_hc_rx_init(struct ccid *ccid, struct sock *sk)
{
	int rc = 0;
	if (ccid->ccid_hc_rx_init != NULL)
		rc = ccid->ccid_hc_rx_init(sk);
	return rc;
}

static inline int ccid_hc_tx_init(struct ccid *ccid, struct sock *sk)
{
	int rc = 0;
	if (ccid->ccid_hc_tx_init != NULL)
		rc = ccid->ccid_hc_tx_init(sk);
	return rc;
}

static inline void ccid_hc_rx_exit(struct ccid *ccid, struct sock *sk)
{
	if (ccid != NULL && ccid->ccid_hc_rx_exit != NULL &&
	    dccp_sk(sk)->dccps_hc_rx_ccid_private != NULL)
		ccid->ccid_hc_rx_exit(sk);
}

static inline void ccid_hc_tx_exit(struct ccid *ccid, struct sock *sk)
{
	if (ccid != NULL && ccid->ccid_hc_tx_exit != NULL &&
	    dccp_sk(sk)->dccps_hc_tx_ccid_private != NULL)
		ccid->ccid_hc_tx_exit(sk);
	if (ccid->ccid_ops->ccid_hc_tx_packet_sent != NULL)
		ccid->ccid_ops->ccid_hc_tx_packet_sent(sk, more, len);
}

static inline void ccid_hc_rx_packet_recv(struct ccid *ccid, struct sock *sk,
					  struct sk_buff *skb)
{
	if (ccid->ccid_hc_rx_packet_recv != NULL)
		ccid->ccid_hc_rx_packet_recv(sk, skb);
	if (ccid->ccid_ops->ccid_hc_rx_packet_recv != NULL)
		ccid->ccid_ops->ccid_hc_rx_packet_recv(sk, skb);
}

static inline void ccid_hc_tx_packet_recv(struct ccid *ccid, struct sock *sk,
					  struct sk_buff *skb)
{
	if (ccid->ccid_hc_tx_packet_recv != NULL)
		ccid->ccid_hc_tx_packet_recv(sk, skb);
	if (ccid->ccid_ops->ccid_hc_tx_packet_recv != NULL)
		ccid->ccid_ops->ccid_hc_tx_packet_recv(sk, skb);
}

static inline int ccid_hc_tx_parse_options(struct ccid *ccid, struct sock *sk,
@@ -144,8 +129,8 @@ static inline int ccid_hc_tx_parse_options(struct ccid *ccid, struct sock *sk,
					   unsigned char* value)
{
	int rc = 0;
	if (ccid->ccid_hc_tx_parse_options != NULL)
		rc = ccid->ccid_hc_tx_parse_options(sk, option, len, idx,
	if (ccid->ccid_ops->ccid_hc_tx_parse_options != NULL)
		rc = ccid->ccid_ops->ccid_hc_tx_parse_options(sk, option, len, idx,
						    value);
	return rc;
}
@@ -156,37 +141,37 @@ static inline int ccid_hc_rx_parse_options(struct ccid *ccid, struct sock *sk,
					   unsigned char* value)
{
	int rc = 0;
	if (ccid->ccid_hc_rx_parse_options != NULL)
		rc = ccid->ccid_hc_rx_parse_options(sk, option, len, idx, value);
	if (ccid->ccid_ops->ccid_hc_rx_parse_options != NULL)
		rc = ccid->ccid_ops->ccid_hc_rx_parse_options(sk, option, len, idx, value);
	return rc;
}

static inline void ccid_hc_tx_insert_options(struct ccid *ccid, struct sock *sk,
					     struct sk_buff *skb)
{
	if (ccid->ccid_hc_tx_insert_options != NULL)
		ccid->ccid_hc_tx_insert_options(sk, skb);
	if (ccid->ccid_ops->ccid_hc_tx_insert_options != NULL)
		ccid->ccid_ops->ccid_hc_tx_insert_options(sk, skb);
}

static inline void ccid_hc_rx_insert_options(struct ccid *ccid, struct sock *sk,
					     struct sk_buff *skb)
{
	if (ccid->ccid_hc_rx_insert_options != NULL)
		ccid->ccid_hc_rx_insert_options(sk, skb);
	if (ccid->ccid_ops->ccid_hc_rx_insert_options != NULL)
		ccid->ccid_ops->ccid_hc_rx_insert_options(sk, skb);
}

static inline void ccid_hc_rx_get_info(struct ccid *ccid, struct sock *sk,
				       struct tcp_info *info)
{
	if (ccid->ccid_hc_rx_get_info != NULL)
		ccid->ccid_hc_rx_get_info(sk, info);
	if (ccid->ccid_ops->ccid_hc_rx_get_info != NULL)
		ccid->ccid_ops->ccid_hc_rx_get_info(sk, info);
}

static inline void ccid_hc_tx_get_info(struct ccid *ccid, struct sock *sk,
				       struct tcp_info *info)
{
	if (ccid->ccid_hc_tx_get_info != NULL)
		ccid->ccid_hc_tx_get_info(sk, info);
	if (ccid->ccid_ops->ccid_hc_tx_get_info != NULL)
		ccid->ccid_ops->ccid_hc_tx_get_info(sk, info);
}

static inline int ccid_hc_rx_getsockopt(struct ccid *ccid, struct sock *sk,
@@ -194,8 +179,8 @@ static inline int ccid_hc_rx_getsockopt(struct ccid *ccid, struct sock *sk,
					u32 __user *optval, int __user *optlen)
{
	int rc = -ENOPROTOOPT;
	if (ccid->ccid_hc_rx_getsockopt != NULL)
		rc = ccid->ccid_hc_rx_getsockopt(sk, optname, len,
	if (ccid->ccid_ops->ccid_hc_rx_getsockopt != NULL)
		rc = ccid->ccid_ops->ccid_hc_rx_getsockopt(sk, optname, len,
						 optval, optlen);
	return rc;
}
@@ -205,8 +190,8 @@ static inline int ccid_hc_tx_getsockopt(struct ccid *ccid, struct sock *sk,
					u32 __user *optval, int __user *optlen)
{
	int rc = -ENOPROTOOPT;
	if (ccid->ccid_hc_tx_getsockopt != NULL)
		rc = ccid->ccid_hc_tx_getsockopt(sk, optname, len,
	if (ccid->ccid_ops->ccid_hc_tx_getsockopt != NULL)
		rc = ccid->ccid_ops->ccid_hc_tx_getsockopt(sk, optname, len,
						 optval, optlen);
	return rc;
}
+8 −47
Original line number Diff line number Diff line
@@ -52,16 +52,6 @@ static int ccid2_debug;

static const int ccid2_seq_len = 128;

static inline struct ccid2_hc_tx_sock *ccid2_hc_tx_sk(const struct sock *sk)
{
	return dccp_sk(sk)->dccps_hc_tx_ccid_private;
}

static inline struct ccid2_hc_rx_sock *ccid2_hc_rx_sk(const struct sock *sk)
{
	return dccp_sk(sk)->dccps_hc_rx_ccid_private;
}

#ifdef CCID2_DEBUG
static void ccid2_hc_tx_check_sanity(const struct ccid2_hc_tx_sock *hctx)
{
@@ -707,19 +697,12 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
	ccid2_hc_tx_check_sanity(hctx);
}

static int ccid2_hc_tx_init(struct sock *sk)
static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk)
{
	struct dccp_sock *dp = dccp_sk(sk);
        struct ccid2_hc_tx_sock *hctx;
        struct ccid2_hc_tx_sock *hctx = ccid_priv(ccid);
	int seqcount = ccid2_seq_len;
	int i;

        dp->dccps_hc_tx_ccid_private = kzalloc(sizeof(*hctx), gfp_any());
        if (dp->dccps_hc_tx_ccid_private == NULL)
                return -ENOMEM;

        hctx = ccid2_hc_tx_sk(sk);

	/* XXX init variables with proper values */
	hctx->ccid2hctx_cwnd	  = 1;
	hctx->ccid2hctx_ssthresh  = 10;
@@ -728,11 +711,9 @@ static int ccid2_hc_tx_init(struct sock *sk)
	/* XXX init ~ to window size... */
	hctx->ccid2hctx_seqbuf = kmalloc(sizeof(*hctx->ccid2hctx_seqbuf) *
					 seqcount, gfp_any());
	if (hctx->ccid2hctx_seqbuf == NULL) {
		kfree(dp->dccps_hc_tx_ccid_private);
		dp->dccps_hc_tx_ccid_private = NULL;
	if (hctx->ccid2hctx_seqbuf == NULL)
		return -ENOMEM;
	}

	for (i = 0; i < (seqcount - 1); i++) {
		hctx->ccid2hctx_seqbuf[i].ccid2s_next =
					&hctx->ccid2hctx_seqbuf[i + 1];
@@ -763,15 +744,11 @@ static int ccid2_hc_tx_init(struct sock *sk)

static void ccid2_hc_tx_exit(struct sock *sk)
{
	struct dccp_sock *dp = dccp_sk(sk);
        struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);

	ccid2_hc_tx_kill_rto_timer(sk);

	kfree(hctx->ccid2hctx_seqbuf);

	kfree(dp->dccps_hc_tx_ccid_private);
	dp->dccps_hc_tx_ccid_private = NULL;
	hctx->ccid2hctx_seqbuf = NULL;
}

static void ccid2_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
@@ -791,33 +768,17 @@ static void ccid2_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
	}
}

static int ccid2_hc_rx_init(struct sock *sk)
{
	struct dccp_sock *dp = dccp_sk(sk);
        dp->dccps_hc_rx_ccid_private = kzalloc(sizeof(struct ccid2_hc_rx_sock),
					       gfp_any());
        return dp->dccps_hc_rx_ccid_private == NULL ? -ENOMEM : 0;
}

static void ccid2_hc_rx_exit(struct sock *sk)
{
	struct dccp_sock *dp = dccp_sk(sk);

	kfree(dp->dccps_hc_rx_ccid_private);
	dp->dccps_hc_rx_ccid_private = NULL;
}

static struct ccid ccid2 = {
static struct ccid_operations ccid2 = {
	.ccid_id		= 2,
	.ccid_name		= "ccid2",
	.ccid_owner		= THIS_MODULE,
	.ccid_hc_tx_obj_size	= sizeof(struct ccid2_hc_tx_sock),
	.ccid_hc_tx_init	= ccid2_hc_tx_init,
	.ccid_hc_tx_exit	= ccid2_hc_tx_exit,
	.ccid_hc_tx_send_packet	= ccid2_hc_tx_send_packet,
	.ccid_hc_tx_packet_sent	= ccid2_hc_tx_packet_sent,
	.ccid_hc_tx_packet_recv	= ccid2_hc_tx_packet_recv,
	.ccid_hc_rx_init	= ccid2_hc_rx_init,
	.ccid_hc_rx_exit	= ccid2_hc_rx_exit,
	.ccid_hc_rx_obj_size	= sizeof(struct ccid2_hc_rx_sock),
	.ccid_hc_rx_packet_recv	= ccid2_hc_rx_packet_recv,
};

+16 −0
Original line number Diff line number Diff line
@@ -20,6 +20,13 @@
#ifndef _DCCP_CCID2_H_
#define _DCCP_CCID2_H_

#include <linux/dccp.h>
#include <linux/timer.h>
#include <linux/types.h>
#include "../ccid.h"

struct sock;

struct ccid2_seq {
	u64			ccid2s_seq;
	unsigned long		ccid2s_sent;
@@ -66,4 +73,13 @@ struct ccid2_hc_rx_sock {
	int	ccid2hcrx_data;
};

static inline struct ccid2_hc_tx_sock *ccid2_hc_tx_sk(const struct sock *sk)
{
	return ccid_priv(dccp_sk(sk)->dccps_hc_tx_ccid);
}

static inline struct ccid2_hc_rx_sock *ccid2_hc_rx_sk(const struct sock *sk)
{
	return ccid_priv(dccp_sk(sk)->dccps_hc_rx_ccid);
}
#endif /* _DCCP_CCID2_H_ */
Loading