MINOR: mux-quic: remove qcc_decode_qcs() call in XPRT
Slightly change the interface for qcc_recv() between MUX and XPRT. The MUX is now responsible to call qcc_decode_qcs(). This is cleaner as now the XPRT does not have to deal with an extra QCS parameter and the MUX will call qcc_decode_qcs() only if really needed. This change is possible since there is no extra buffering for out-of-order STREAM frames and the XPRT does not have to handle buffered frames.
This commit is contained in:
@ -25,10 +25,9 @@ void qcs_notify_recv(struct qcs *qcs);
|
||||
void qcs_notify_send(struct qcs *qcs);
|
||||
|
||||
int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset,
|
||||
char fin, char *data, struct qcs **out_qcs);
|
||||
char fin, char *data);
|
||||
int qcc_recv_max_data(struct qcc *qcc, uint64_t max);
|
||||
int qcc_recv_max_stream_data(struct qcc *qcc, uint64_t id, uint64_t max);
|
||||
int qcc_decode_qcs(struct qcc *qcc, struct qcs *qcs);
|
||||
void qcc_streams_sent_done(struct qcs *qcs, uint64_t data, uint64_t offset);
|
||||
|
||||
/* Bit shift to get the stream sub ID for internal use which is obtained
|
||||
|
@ -364,23 +364,41 @@ struct qcs *qcc_get_qcs(struct qcc *qcc, uint64_t id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Handle a new STREAM frame <strm_frm>. The frame content will be copied in
|
||||
* the buffer of the stream instance. The stream instance will be stored in
|
||||
* <out_qcs>. In case of success, the caller can immediatly call qcc_decode_qcs
|
||||
* to process the frame content.
|
||||
/* Decode the content of STREAM frames already received on the stream instance
|
||||
* <qcs>.
|
||||
*
|
||||
* Returns 0 on success else non-zero.
|
||||
*/
|
||||
static int qcc_decode_qcs(struct qcc *qcc, struct qcs *qcs)
|
||||
{
|
||||
TRACE_ENTER(QMUX_EV_QCS_RECV, qcc->conn, qcs);
|
||||
|
||||
if (qcc->app_ops->decode_qcs(qcs, qcs->flags & QC_SF_FIN_RECV, qcc->ctx) < 0) {
|
||||
TRACE_DEVEL("leaving on decoding error", QMUX_EV_QCS_RECV, qcc->conn, qcs);
|
||||
return 1;
|
||||
}
|
||||
|
||||
qcs_notify_recv(qcs);
|
||||
|
||||
TRACE_LEAVE(QMUX_EV_QCS_RECV, qcc->conn, qcs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Handle a new STREAM frame for stream with id <id>. Payload is pointed by
|
||||
* <data> with length <len> and represents the offset <offset>. <fin> is set if
|
||||
* the QUIC frame FIN bit is set.
|
||||
*
|
||||
* Returns 0 on success else non-zero.
|
||||
*/
|
||||
int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset,
|
||||
char fin, char *data, struct qcs **out_qcs)
|
||||
char fin, char *data)
|
||||
{
|
||||
struct qcs *qcs;
|
||||
enum ncb_ret ret;
|
||||
|
||||
TRACE_ENTER(QMUX_EV_QCC_RECV, qcc->conn);
|
||||
|
||||
*out_qcs = NULL;
|
||||
|
||||
qcs = qcc_get_qcs(qcc, id);
|
||||
if (!qcs) {
|
||||
if ((id >> QCS_ID_TYPE_SHIFT) <= qcc->strms[qcs_id_type(id)].largest_id) {
|
||||
@ -393,8 +411,6 @@ int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset,
|
||||
}
|
||||
}
|
||||
|
||||
*out_qcs = qcs;
|
||||
|
||||
if (offset + len <= qcs->rx.offset) {
|
||||
TRACE_DEVEL("leaving on already received offset", QMUX_EV_QCC_RECV|QMUX_EV_QCS_RECV, qcc->conn, qcs);
|
||||
return 0;
|
||||
@ -439,6 +455,9 @@ int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset,
|
||||
if (fin)
|
||||
qcs->flags |= QC_SF_FIN_RECV;
|
||||
|
||||
if (ncb_data(&qcs->rx.ncbuf, 0) && !(qcs->flags & QC_SF_DEM_FULL))
|
||||
qcc_decode_qcs(qcc, qcs);
|
||||
|
||||
TRACE_LEAVE(QMUX_EV_QCC_RECV, qcc->conn);
|
||||
return 0;
|
||||
}
|
||||
@ -487,27 +506,6 @@ int qcc_recv_max_stream_data(struct qcc *qcc, uint64_t id, uint64_t max)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Decode the content of STREAM frames already received on the stream instance
|
||||
* <qcs>.
|
||||
*
|
||||
* Returns 0 on success else non-zero.
|
||||
*/
|
||||
int qcc_decode_qcs(struct qcc *qcc, struct qcs *qcs)
|
||||
{
|
||||
TRACE_ENTER(QMUX_EV_QCS_RECV, qcc->conn, qcs);
|
||||
|
||||
if (qcc->app_ops->decode_qcs(qcs, qcs->flags & QC_SF_FIN_RECV, qcc->ctx) < 0) {
|
||||
TRACE_DEVEL("leaving on decoding error", QMUX_EV_QCS_RECV, qcc->conn, qcs);
|
||||
return 1;
|
||||
}
|
||||
|
||||
qcs_notify_recv(qcs);
|
||||
|
||||
TRACE_LEAVE(QMUX_EV_QCS_RECV, qcc->conn, qcs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qc_is_max_streams_needed(struct qcc *qcc)
|
||||
{
|
||||
return qcc->lfctl.cl_bidi_r > qcc->lfctl.ms_bidi_init / 2;
|
||||
|
@ -2158,19 +2158,16 @@ static int qc_handle_bidi_strm_frm(struct quic_rx_packet *pkt,
|
||||
struct quic_stream *strm_frm,
|
||||
struct quic_conn *qc)
|
||||
{
|
||||
struct qcs *qcs = NULL;
|
||||
int ret;
|
||||
|
||||
ret = qcc_recv(qc->qcc, strm_frm->id, strm_frm->len,
|
||||
strm_frm->offset.key, strm_frm->fin,
|
||||
(char *)strm_frm->data, &qcs);
|
||||
(char *)strm_frm->data);
|
||||
|
||||
/* frame rejected - packet must not be acknowledeged */
|
||||
if (ret)
|
||||
return 0;
|
||||
|
||||
if (qcs)
|
||||
qcc_decode_qcs(qc->qcc, qcs);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user