From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 07/24] udp: Drop _splice from recv, send, sendto static buffer names Date: Fri, 25 Mar 2022 23:52:43 +0100 Message-ID: <20220325225300.2803584-8-sbrivio@redhat.com> In-Reply-To: <20220325225300.2803584-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2685526070493991073==" --===============2685526070493991073== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable It's already implied by the fact they don't have "l2" in their names, and dropping it improves readability a bit. Signed-off-by: Stefano Brivio --- udp.c | 52 +++++++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/udp.c b/udp.c index ccce005..ce536a6 100644 --- a/udp.c +++ b/udp.c @@ -254,14 +254,14 @@ static struct mmsghdr udp4_l2_mh_tap [UDP_TAP_FRAMES_M= EM]; static struct mmsghdr udp6_l2_mh_tap [UDP_TAP_FRAMES_MEM]; =20 /* recvmmsg()/sendmmsg() data for "spliced" connections */ -static struct iovec udp_splice_iov_recv [UDP_SPLICE_FRAMES]; -static struct mmsghdr udp_splice_mmh_recv [UDP_SPLICE_FRAMES]; +static struct iovec udp_iov_recv [UDP_SPLICE_FRAMES]; +static struct mmsghdr udp_mmh_recv [UDP_SPLICE_FRAMES]; =20 -static struct iovec udp_splice_iov_send [UDP_SPLICE_FRAMES]; -static struct mmsghdr udp_splice_mmh_send [UDP_SPLICE_FRAMES]; +static struct iovec udp_iov_send [UDP_SPLICE_FRAMES]; +static struct mmsghdr udp_mmh_send [UDP_SPLICE_FRAMES]; =20 -static struct iovec udp_splice_iov_sendto [UDP_SPLICE_FRAMES]; -static struct mmsghdr udp_splice_mmh_sendto [UDP_SPLICE_FRAMES]; +static struct iovec udp_iov_sendto [UDP_SPLICE_FRAMES]; +static struct mmsghdr udp_mmh_sendto [UDP_SPLICE_FRAMES]; =20 /** * udp_remap_to_tap() - Set delta for port translation to/from guest/tap @@ -552,14 +552,14 @@ static void udp_sock_handler_splice(struct ctx *c, unio= n epoll_ref ref, uint32_t events, struct timespec *now) { in_port_t src, dst =3D ref.r.p.udp.udp.port, send_dst =3D 0; - struct msghdr *mh =3D &udp_splice_mmh_recv[0].msg_hdr; + struct msghdr *mh =3D &udp_mmh_recv[0].msg_hdr; struct sockaddr_storage *sa_s =3D mh->msg_name; int s, v6 =3D ref.r.p.udp.udp.v6, n, i; =20 if (!(events & EPOLLIN)) return; =20 - n =3D recvmmsg(ref.r.s, udp_splice_mmh_recv, UDP_SPLICE_FRAMES, 0, NULL); + n =3D recvmmsg(ref.r.s, udp_mmh_recv, UDP_SPLICE_FRAMES, 0, NULL); =20 if (n <=3D 0) return; @@ -619,19 +619,19 @@ static void udp_sock_handler_splice(struct ctx *c, unio= n epoll_ref ref, if (ref.r.p.udp.udp.splice =3D=3D UDP_TO_NS || ref.r.p.udp.udp.splice =3D=3D UDP_TO_INIT) { for (i =3D 0; i < n; i++) { - struct msghdr *mh_s =3D &udp_splice_mmh_send[i].msg_hdr; + struct msghdr *mh_s =3D &udp_mmh_send[i].msg_hdr; =20 - mh_s->msg_iov->iov_len =3D udp_splice_mmh_recv[i].msg_len; + mh_s->msg_iov->iov_len =3D udp_mmh_recv[i].msg_len; } =20 - sendmmsg(s, udp_splice_mmh_send, n, MSG_NOSIGNAL); + sendmmsg(s, udp_mmh_send, n, MSG_NOSIGNAL); return; } =20 for (i =3D 0; i < n; i++) { - struct msghdr *mh_s =3D &udp_splice_mmh_sendto[i].msg_hdr; + struct msghdr *mh_s =3D &udp_mmh_sendto[i].msg_hdr; =20 - mh_s->msg_iov->iov_len =3D udp_splice_mmh_recv[i].msg_len; + mh_s->msg_iov->iov_len =3D udp_mmh_recv[i].msg_len; } =20 if (v6) { @@ -652,7 +652,7 @@ static void udp_sock_handler_splice(struct ctx *c, union = epoll_ref ref, }); } =20 - sendmmsg(s, udp_splice_mmh_sendto, n, MSG_NOSIGNAL); + sendmmsg(s, udp_mmh_sendto, n, MSG_NOSIGNAL); } =20 /** @@ -1097,7 +1097,7 @@ static void udp_splice_iov_init(void) struct iovec *iov; int i; =20 - for (i =3D 0, h =3D udp_splice_mmh_recv; i < UDP_SPLICE_FRAMES; i++, h++) { + for (i =3D 0, h =3D udp_mmh_recv; i < UDP_SPLICE_FRAMES; i++, h++) { struct msghdr *mh =3D &h->msg_hdr; =20 if (!i) { @@ -1105,40 +1105,34 @@ static void udp_splice_iov_init(void) mh->msg_namelen =3D sizeof(udp_splice_namebuf); } =20 - mh->msg_iov =3D &udp_splice_iov_recv[i]; + mh->msg_iov =3D &udp_iov_recv[i]; mh->msg_iovlen =3D 1; } - for (i =3D 0, iov =3D udp_splice_iov_recv; i < UDP_SPLICE_FRAMES; - i++, iov++) { + for (i =3D 0, iov =3D udp_iov_recv; i < UDP_SPLICE_FRAMES; i++, iov++) { iov->iov_base =3D udp_splice_buf[i]; iov->iov_len =3D sizeof(udp_splice_buf[i]); } =20 - for (i =3D 0, h =3D udp_splice_mmh_send; i < UDP_SPLICE_FRAMES; i++, h++) { + for (i =3D 0, h =3D udp_mmh_send; i < UDP_SPLICE_FRAMES; i++, h++) { struct msghdr *mh =3D &h->msg_hdr; =20 - mh->msg_iov =3D &udp_splice_iov_send[i]; + mh->msg_iov =3D &udp_iov_send[i]; mh->msg_iovlen =3D 1; } - for (i =3D 0, iov =3D udp_splice_iov_send; i < UDP_SPLICE_FRAMES; - i++, iov++) { + for (i =3D 0, iov =3D udp_iov_send; i < UDP_SPLICE_FRAMES; i++, iov++) iov->iov_base =3D udp_splice_buf[i]; - } =20 - for (i =3D 0, h =3D udp_splice_mmh_sendto; i < UDP_SPLICE_FRAMES; - i++, h++) { + for (i =3D 0, h =3D udp_mmh_sendto; i < UDP_SPLICE_FRAMES; i++, h++) { struct msghdr *mh =3D &h->msg_hdr; =20 mh->msg_name =3D &udp_splice_namebuf; mh->msg_namelen =3D sizeof(udp_splice_namebuf); =20 - mh->msg_iov =3D &udp_splice_iov_sendto[i]; + mh->msg_iov =3D &udp_iov_sendto[i]; mh->msg_iovlen =3D 1; } - for (i =3D 0, iov =3D udp_splice_iov_sendto; i < UDP_SPLICE_FRAMES; - i++, iov++) { + for (i =3D 0, iov =3D udp_iov_sendto; i < UDP_SPLICE_FRAMES; i++, iov++) iov->iov_base =3D udp_splice_buf[i]; - } } =20 /** --=20 2.35.1 --===============2685526070493991073==--