MEDIUM: stream_interface: remove CAP_SPLTCP/CAP_SPLICE flags

These ones are implicitly handled by the connection's data layer, no need
to rely on them anymore and reaching them maintains undesired dependences
on stream-interface.
This commit is contained in:
Willy Tarreau 2012-08-30 21:23:53 +02:00 committed by Willy Tarreau
parent 986a9d2d12
commit 93b0f4f6c6
4 changed files with 5 additions and 14 deletions

View File

@ -69,7 +69,7 @@ enum {
SI_FL_ERR = 0x0002, /* a non-recoverable error has occurred */ SI_FL_ERR = 0x0002, /* a non-recoverable error has occurred */
SI_FL_WAIT_ROOM = 0x0004, /* waiting for space to store incoming data */ SI_FL_WAIT_ROOM = 0x0004, /* waiting for space to store incoming data */
SI_FL_WAIT_DATA = 0x0008, /* waiting for more data to send */ SI_FL_WAIT_DATA = 0x0008, /* waiting for more data to send */
SI_FL_CAP_SPLTCP = 0x0010, /* splicing possible from/to TCP */ /* unused 0x0010 */
SI_FL_DONT_WAKE = 0x0020, /* resync in progress, don't wake up */ SI_FL_DONT_WAKE = 0x0020, /* resync in progress, don't wake up */
SI_FL_INDEP_STR = 0x0040, /* independent streams = don't update rex on write */ SI_FL_INDEP_STR = 0x0040, /* independent streams = don't update rex on write */
SI_FL_NOLINGER = 0x0080, /* may close without lingering. One-shot. */ SI_FL_NOLINGER = 0x0080, /* may close without lingering. One-shot. */
@ -77,8 +77,6 @@ enum {
SI_FL_SRC_ADDR = 0x1000, /* get the source ip/port with getsockname */ SI_FL_SRC_ADDR = 0x1000, /* get the source ip/port with getsockname */
}; };
#define SI_FL_CAP_SPLICE (SI_FL_CAP_SPLTCP)
struct stream_interface; struct stream_interface;
/* operations available on a stream-interface */ /* operations available on a stream-interface */

View File

@ -473,8 +473,6 @@ int tcp_connect_server(struct stream_interface *si)
conn_data_want_send(conn); /* prepare to send data if any */ conn_data_want_send(conn); /* prepare to send data if any */
si->state = SI_ST_CON; si->state = SI_ST_CON;
if (conn->data->rcv_pipe && conn->data->snd_pipe)
si->flags |= SI_FL_CAP_SPLTCP; /* TCP supports splicing */
si->exp = tick_add_ifset(now_ms, be->timeout.connect); si->exp = tick_add_ifset(now_ms, be->timeout.connect);
return SN_ERR_NONE; /* connection is OK */ return SN_ERR_NONE; /* connection is OK */

View File

@ -180,10 +180,6 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
/* add the various callbacks */ /* add the various callbacks */
si_prepare_conn(&s->si[0], l->proto, l->data); si_prepare_conn(&s->si[0], l->proto, l->data);
if ((s->si[0].conn.data->rcv_pipe && s->si[0].conn.data->snd_pipe) &&
(addr->ss_family == AF_INET || addr->ss_family == AF_INET6))
s->si[0].flags = SI_FL_CAP_SPLTCP; /* TCP/TCPv6 splicing possible */
/* pre-initialize the other side's stream interface to an INIT state. The /* pre-initialize the other side's stream interface to an INIT state. The
* callbacks will be initialized before attempting to connect. * callbacks will be initialized before attempting to connect.
*/ */
@ -540,7 +536,6 @@ static int sess_update_st_con_tcp(struct session *s, struct stream_interface *si
if (unlikely(si->flags & (SI_FL_EXP|SI_FL_ERR))) { if (unlikely(si->flags & (SI_FL_EXP|SI_FL_ERR))) {
si->exp = TICK_ETERNITY; si->exp = TICK_ETERNITY;
si->state = SI_ST_CER; si->state = SI_ST_CER;
si->flags &= ~SI_FL_CAP_SPLICE;
fd_delete(si_fd(si)); fd_delete(si_fd(si));
conn_data_close(&si->conn); conn_data_close(&si->conn);
@ -567,7 +562,6 @@ static int sess_update_st_con_tcp(struct session *s, struct stream_interface *si
si_shutw(si); si_shutw(si);
si->err_type |= SI_ET_CONN_ABRT; si->err_type |= SI_ET_CONN_ABRT;
si->err_loc = target_srv(&s->target); si->err_loc = target_srv(&s->target);
si->flags &= ~SI_FL_CAP_SPLICE;
if (s->srv_error) if (s->srv_error)
s->srv_error(s, si); s->srv_error(s, si);
return 1; return 1;
@ -1867,7 +1861,8 @@ struct task *process_session(struct task *t)
if (!(s->req->flags & (CF_KERN_SPLICING|CF_SHUTR)) && if (!(s->req->flags & (CF_KERN_SPLICING|CF_SHUTR)) &&
s->req->to_forward && s->req->to_forward &&
(global.tune.options & GTUNE_USE_SPLICE) && (global.tune.options & GTUNE_USE_SPLICE) &&
(s->si[0].flags & s->si[1].flags & SI_FL_CAP_SPLICE) && (s->si[0].conn.data && s->si[0].conn.data->rcv_pipe && s->si[0].conn.data->snd_pipe) &&
(s->si[1].conn.data && s->si[1].conn.data->rcv_pipe && s->si[1].conn.data->snd_pipe) &&
(pipes_used < global.maxpipes) && (pipes_used < global.maxpipes) &&
(((s->fe->options2|s->be->options2) & PR_O2_SPLIC_REQ) || (((s->fe->options2|s->be->options2) & PR_O2_SPLIC_REQ) ||
(((s->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) && (((s->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) &&
@ -2012,7 +2007,8 @@ struct task *process_session(struct task *t)
if (!(s->rep->flags & (CF_KERN_SPLICING|CF_SHUTR)) && if (!(s->rep->flags & (CF_KERN_SPLICING|CF_SHUTR)) &&
s->rep->to_forward && s->rep->to_forward &&
(global.tune.options & GTUNE_USE_SPLICE) && (global.tune.options & GTUNE_USE_SPLICE) &&
(s->si[0].flags & s->si[1].flags & SI_FL_CAP_SPLICE) && (s->si[0].conn.data && s->si[0].conn.data->rcv_pipe && s->si[0].conn.data->snd_pipe) &&
(s->si[1].conn.data && s->si[1].conn.data->rcv_pipe && s->si[1].conn.data->snd_pipe) &&
(pipes_used < global.maxpipes) && (pipes_used < global.maxpipes) &&
(((s->fe->options2|s->be->options2) & PR_O2_SPLIC_RTR) || (((s->fe->options2|s->be->options2) & PR_O2_SPLIC_RTR) ||
(((s->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) && (((s->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) &&

View File

@ -1019,7 +1019,6 @@ void si_conn_recv_cb(struct connection *conn)
if (ret < 0) { if (ret < 0) {
/* splice not supported on this end, let's disable it */ /* splice not supported on this end, let's disable it */
b->flags &= ~CF_KERN_SPLICING; b->flags &= ~CF_KERN_SPLICING;
si->flags &= ~SI_FL_CAP_SPLICE;
goto abort_splice; goto abort_splice;
} }