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

Commit e6934f3e authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'listener-refactoring-preparations'



Eric Dumazet says:

====================
tcp: listener refactoring preparations

This patch series makes changes to TCP/DCCP stacks so that
we can switch listener code to lockless mode.

This is done by marking const the listener socket in all
appropriate paths.

FastOpen code had to be changed to not dynamically allocate
a very small structure to make code simpler for following changes.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4c7e622d 0536fcc0
Loading
Loading
Loading
Loading
+4 −18
Original line number Original line Diff line number Diff line
@@ -382,25 +382,11 @@ static inline bool tcp_passive_fastopen(const struct sock *sk)
		tcp_sk(sk)->fastopen_rsk != NULL);
		tcp_sk(sk)->fastopen_rsk != NULL);
}
}


extern void tcp_sock_destruct(struct sock *sk);
static inline void fastopen_queue_tune(struct sock *sk, int backlog)

static inline int fastopen_init_queue(struct sock *sk, int backlog)
{
{
	struct request_sock_queue *queue =
	struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue;
	    &inet_csk(sk)->icsk_accept_queue;


	queue->fastopenq.max_qlen = backlog;
	if (queue->fastopenq == NULL) {
		queue->fastopenq = kzalloc(
		    sizeof(struct fastopen_queue),
		    sk->sk_allocation);
		if (queue->fastopenq == NULL)
			return -ENOMEM;

		sk->sk_destruct = tcp_sock_destruct;
		spin_lock_init(&queue->fastopenq->lock);
	}
	queue->fastopenq->max_qlen = backlog;
	return 0;
}
}


static inline void tcp_saved_syn_free(struct tcp_sock *tp)
static inline void tcp_saved_syn_free(struct tcp_sock *tp)
+1 −1
Original line number Original line Diff line number Diff line
@@ -26,7 +26,7 @@ int inet6_csk_bind_conflict(const struct sock *sk,
			    const struct inet_bind_bucket *tb, bool relax);
			    const struct inet_bind_bucket *tb, bool relax);


struct dst_entry *inet6_csk_route_req(const struct sock *sk, struct flowi6 *fl6,
struct dst_entry *inet6_csk_route_req(const struct sock *sk, struct flowi6 *fl6,
				      const struct request_sock *req);
				      const struct request_sock *req, u8 proto);


struct request_sock *inet6_csk_search_req(struct sock *sk,
struct request_sock *inet6_csk_search_req(struct sock *sk,
					  const __be16 rport,
					  const __be16 rport,
+3 −2
Original line number Original line Diff line number Diff line
@@ -41,7 +41,7 @@ struct inet_connection_sock_af_ops {
	int	    (*rebuild_header)(struct sock *sk);
	int	    (*rebuild_header)(struct sock *sk);
	void	    (*sk_rx_dst_set)(struct sock *sk, const struct sk_buff *skb);
	void	    (*sk_rx_dst_set)(struct sock *sk, const struct sk_buff *skb);
	int	    (*conn_request)(struct sock *sk, struct sk_buff *skb);
	int	    (*conn_request)(struct sock *sk, struct sk_buff *skb);
	struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb,
	struct sock *(*syn_recv_sock)(const struct sock *sk, struct sk_buff *skb,
				      struct request_sock *req,
				      struct request_sock *req,
				      struct dst_entry *dst);
				      struct dst_entry *dst);
	u16	    net_header_len;
	u16	    net_header_len;
@@ -268,7 +268,8 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum);


struct dst_entry *inet_csk_route_req(const struct sock *sk, struct flowi4 *fl4,
struct dst_entry *inet_csk_route_req(const struct sock *sk, struct flowi4 *fl4,
				     const struct request_sock *req);
				     const struct request_sock *req);
struct dst_entry *inet_csk_route_child_sock(struct sock *sk, struct sock *newsk,
struct dst_entry *inet_csk_route_child_sock(const struct sock *sk,
					    struct sock *newsk,
					    const struct request_sock *req);
					    const struct request_sock *req);


static inline void inet_csk_reqsk_queue_add(struct sock *sk,
static inline void inet_csk_reqsk_queue_add(struct sock *sk,
+1 −1
Original line number Original line Diff line number Diff line
@@ -199,7 +199,7 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk)
}
}


/* Caller must disable local BH processing. */
/* Caller must disable local BH processing. */
int __inet_inherit_port(struct sock *sk, struct sock *child);
int __inet_inherit_port(const struct sock *sk, struct sock *child);


void inet_put_port(struct sock *sk);
void inet_put_port(struct sock *sk);


+6 −10
Original line number Original line Diff line number Diff line
@@ -34,9 +34,9 @@ struct request_sock_ops {
	char		*slab_name;
	char		*slab_name;
	int		(*rtx_syn_ack)(const struct sock *sk,
	int		(*rtx_syn_ack)(const struct sock *sk,
				       struct request_sock *req);
				       struct request_sock *req);
	void		(*send_ack)(struct sock *sk, struct sk_buff *skb,
	void		(*send_ack)(const struct sock *sk, struct sk_buff *skb,
				    struct request_sock *req);
				    struct request_sock *req);
	void		(*send_reset)(struct sock *sk,
	void		(*send_reset)(const struct sock *sk,
				      struct sk_buff *skb);
				      struct sk_buff *skb);
	void		(*destructor)(struct request_sock *req);
	void		(*destructor)(struct request_sock *req);
	void		(*syn_ack_timeout)(const struct request_sock *req);
	void		(*syn_ack_timeout)(const struct request_sock *req);
@@ -129,9 +129,8 @@ struct listen_sock {
	atomic_t		qlen_dec; /* qlen = qlen_inc - qlen_dec */
	atomic_t		qlen_dec; /* qlen = qlen_inc - qlen_dec */
	atomic_t		young_dec;
	atomic_t		young_dec;


	u8			max_qlen_log ____cacheline_aligned_in_smp;
	u32			max_qlen_log ____cacheline_aligned_in_smp;
	u8			synflood_warned;
	u32			synflood_warned;
	/* 2 bytes hole, try to use */
	u32			hash_rnd;
	u32			hash_rnd;
	u32			nr_table_entries;
	u32			nr_table_entries;
	struct request_sock	*syn_table[0];
	struct request_sock	*syn_table[0];
@@ -181,11 +180,8 @@ struct request_sock_queue {
	struct request_sock	*rskq_accept_tail;
	struct request_sock	*rskq_accept_tail;
	u8			rskq_defer_accept;
	u8			rskq_defer_accept;
	struct listen_sock	*listen_opt;
	struct listen_sock	*listen_opt;
	struct fastopen_queue	*fastopenq; /* This is non-NULL iff TFO has been
	struct fastopen_queue	fastopenq;  /* Check max_qlen != 0 to determine
					     * enabled on this listener. Check
					     * if TFO is enabled.
					     * max_qlen != 0 in fastopen_queue
					     * to determine if TFO is enabled
					     * right at this moment.
					     */
					     */


	/* temporary alignment, our goal is to get rid of this lock */
	/* temporary alignment, our goal is to get rid of this lock */
Loading