mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
MINOR: mux_h1/h2: simplify the zero-copy Rx alignment
The transpory layer now respects buffer alignment, so we don't need to cheat anymore pretending we have some data at the head, adjusting the buffer's head is enough.
This commit is contained in:
parent
e0f24ee149
commit
c0960d1185
@ -1664,7 +1664,6 @@ static int h1_recv(struct h1c *h1c)
|
|||||||
|
|
||||||
max = buf_room_for_htx_data(&h1c->ibuf);
|
max = buf_room_for_htx_data(&h1c->ibuf);
|
||||||
if (max) {
|
if (max) {
|
||||||
int aligned = 0;
|
|
||||||
h1c->flags &= ~H1C_F_IN_FULL;
|
h1c->flags &= ~H1C_F_IN_FULL;
|
||||||
|
|
||||||
b_realign_if_empty(&h1c->ibuf);
|
b_realign_if_empty(&h1c->ibuf);
|
||||||
@ -1672,14 +1671,9 @@ static int h1_recv(struct h1c *h1c)
|
|||||||
/* try to pre-align the buffer like the rxbufs will be
|
/* try to pre-align the buffer like the rxbufs will be
|
||||||
* to optimize memory copies.
|
* to optimize memory copies.
|
||||||
*/
|
*/
|
||||||
h1c->ibuf.data = sizeof(struct htx);
|
|
||||||
aligned = 1;
|
|
||||||
}
|
|
||||||
ret = conn->xprt->rcv_buf(conn, &h1c->ibuf, max, 0);
|
|
||||||
if (aligned) {
|
|
||||||
h1c->ibuf.data -= sizeof(struct htx);
|
|
||||||
h1c->ibuf.head = sizeof(struct htx);
|
h1c->ibuf.head = sizeof(struct htx);
|
||||||
}
|
}
|
||||||
|
ret = conn->xprt->rcv_buf(conn, &h1c->ibuf, max, 0);
|
||||||
}
|
}
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
rcvd = 1;
|
rcvd = 1;
|
||||||
|
11
src/mux_h2.c
11
src/mux_h2.c
@ -2444,8 +2444,6 @@ static int h2_recv(struct h2c *h2c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
int aligned = 0;
|
|
||||||
|
|
||||||
b_realign_if_empty(buf);
|
b_realign_if_empty(buf);
|
||||||
if (!b_data(buf) && (h2c->proxy->options2 & PR_O2_USE_HTX)) {
|
if (!b_data(buf) && (h2c->proxy->options2 & PR_O2_USE_HTX)) {
|
||||||
/* HTX in use : try to pre-align the buffer like the
|
/* HTX in use : try to pre-align the buffer like the
|
||||||
@ -2457,9 +2455,7 @@ static int h2_recv(struct h2c *h2c)
|
|||||||
* have a few bytes there.
|
* have a few bytes there.
|
||||||
*/
|
*/
|
||||||
max = buf_room_for_htx_data(buf) + 9;
|
max = buf_room_for_htx_data(buf) + 9;
|
||||||
buf->head = 0;
|
buf->head = sizeof(struct htx) - 9;
|
||||||
buf->data = sizeof(struct htx) - 9;
|
|
||||||
aligned = 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
max = b_room(buf);
|
max = b_room(buf);
|
||||||
@ -2468,11 +2464,6 @@ static int h2_recv(struct h2c *h2c)
|
|||||||
ret = conn->xprt->rcv_buf(conn, buf, max, 0);
|
ret = conn->xprt->rcv_buf(conn, buf, max, 0);
|
||||||
else
|
else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
if (aligned) {
|
|
||||||
buf->data -= sizeof(struct htx) - 9;
|
|
||||||
buf->head = sizeof(struct htx) - 9;
|
|
||||||
}
|
|
||||||
} while (ret > 0);
|
} while (ret > 0);
|
||||||
|
|
||||||
if (h2_recv_allowed(h2c) && (b_data(buf) < buf->size))
|
if (h2_recv_allowed(h2c) && (b_data(buf) < buf->size))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user