From: Willy Tarreau Date: Thu, 30 Aug 2012 19:23:53 +0000 (+0200) Subject: MEDIUM: stream_interface: remove CAP_SPLTCP/CAP_SPLICE flags X-Git-Tag: v1.5-dev12~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=93b0f4f6c62c92ee8a99b4509bdc1421787126dd;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/types/stream_interface.h b/include/types/stream_interface.h index edc97d097b..8b069c8df6 100644 --- a/include/types/stream_interface.h +++ b/include/types/stream_interface.h @@ -69,7 +69,7 @@ enum { 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_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_INDEP_STR = 0x0040, /* independent streams = don't update rex on write */ 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 */ }; -#define SI_FL_CAP_SPLICE (SI_FL_CAP_SPLTCP) - struct stream_interface; /* operations available on a stream-interface */ diff --git a/src/proto_tcp.c b/src/proto_tcp.c index b793df393b..7998f400fd 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -473,8 +473,6 @@ int tcp_connect_server(struct stream_interface *si) conn_data_want_send(conn); /* prepare to send data if any */ 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); return SN_ERR_NONE; /* connection is OK */ diff --git a/src/session.c b/src/session.c index 07824191f4..774a8a3196 100644 --- a/src/session.c +++ b/src/session.c @@ -180,10 +180,6 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) /* add the various callbacks */ 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 * 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))) { si->exp = TICK_ETERNITY; si->state = SI_ST_CER; - si->flags &= ~SI_FL_CAP_SPLICE; fd_delete(si_fd(si)); 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->err_type |= SI_ET_CONN_ABRT; si->err_loc = target_srv(&s->target); - si->flags &= ~SI_FL_CAP_SPLICE; if (s->srv_error) s->srv_error(s, si); return 1; @@ -1867,7 +1861,8 @@ struct task *process_session(struct task *t) if (!(s->req->flags & (CF_KERN_SPLICING|CF_SHUTR)) && s->req->to_forward && (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) && (((s->fe->options2|s->be->options2) & PR_O2_SPLIC_REQ) || (((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)) && s->rep->to_forward && (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) && (((s->fe->options2|s->be->options2) & PR_O2_SPLIC_RTR) || (((s->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) && diff --git a/src/stream_interface.c b/src/stream_interface.c index cb33476ed0..b26e800b1c 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -1019,7 +1019,6 @@ void si_conn_recv_cb(struct connection *conn) if (ret < 0) { /* splice not supported on this end, let's disable it */ b->flags &= ~CF_KERN_SPLICING; - si->flags &= ~SI_FL_CAP_SPLICE; goto abort_splice; }