Skip to content

Commit 403d0e6

Browse files
samasth-norwayjfvogel
authored andcommitted
Revert "selftests/net: add zerocopy support for PF_RDS test case"
This reverts commit dfb8434. There is no support for RDS_CMSG_ZCOPY_COOKIE in UEK. So we revert selftest code related to that. This avoids the selftest from compilation failure. Orabug: 37006889 Conflicts: tools/testing/selftests/net/msg_zerocopy.c Minor code rearrangement due to space. Signed-off-by: Samasth Norway Ananda <[email protected]> Reviewed-by: Gerd Rausch <[email protected]>
1 parent 1253dc5 commit 403d0e6

File tree

1 file changed

+4
-33
lines changed

1 file changed

+4
-33
lines changed

tools/testing/selftests/net/msg_zerocopy.c

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -169,39 +169,17 @@ static int do_accept(int fd)
169169
return fd;
170170
}
171171

172-
static void add_zcopy_cookie(struct msghdr *msg, uint32_t cookie)
173-
{
174-
struct cmsghdr *cm;
175-
176-
if (!msg->msg_control)
177-
error(1, errno, "NULL cookie");
178-
cm = (void *)msg->msg_control;
179-
cm->cmsg_len = CMSG_LEN(sizeof(cookie));
180-
cm->cmsg_level = SOL_RDS;
181-
cm->cmsg_type = RDS_CMSG_ZCOPY_COOKIE;
182-
memcpy(CMSG_DATA(cm), &cookie, sizeof(cookie));
183-
}
184-
185-
static bool do_sendmsg(int fd, struct msghdr *msg, bool do_zerocopy, int domain)
172+
static bool do_sendmsg(int fd, struct msghdr *msg, bool do_zerocopy)
186173
{
187174
int ret, len, i, flags;
188-
static uint32_t cookie;
189-
char ckbuf[CMSG_SPACE(sizeof(cookie))];
190175

191176
len = 0;
192177
for (i = 0; i < msg->msg_iovlen; i++)
193178
len += msg->msg_iov[i].iov_len;
194179

195180
flags = MSG_DONTWAIT;
196-
if (do_zerocopy) {
181+
if (do_zerocopy)
197182
flags |= MSG_ZEROCOPY;
198-
if (domain == PF_RDS) {
199-
memset(&msg->msg_control, 0, sizeof(msg->msg_control));
200-
msg->msg_controllen = CMSG_SPACE(sizeof(cookie));
201-
msg->msg_control = (struct cmsghdr *)ckbuf;
202-
add_zcopy_cookie(msg, ++cookie);
203-
}
204-
}
205183

206184
ret = sendmsg(fd, msg, flags);
207185
if (ret == -1 && errno == EAGAIN)
@@ -218,10 +196,6 @@ static bool do_sendmsg(int fd, struct msghdr *msg, bool do_zerocopy, int domain)
218196
if (do_zerocopy && ret)
219197
expected_completions++;
220198
}
221-
if (do_zerocopy && domain == PF_RDS) {
222-
msg->msg_control = NULL;
223-
msg->msg_controllen = 0;
224-
}
225199

226200
return true;
227201
}
@@ -248,9 +222,7 @@ static void do_sendmsg_corked(int fd, struct msghdr *msg)
248222
msg->msg_iov[0].iov_len = payload_len + extra_len;
249223
extra_len = 0;
250224

251-
do_sendmsg(fd, msg, do_zerocopy,
252-
(cfg_dst_addr.ss_family == AF_INET ?
253-
PF_INET : PF_INET6));
225+
do_sendmsg(fd, msg, do_zerocopy);
254226
}
255227

256228
do_setsockopt(fd, IPPROTO_UDP, UDP_CORK, 0);
@@ -376,7 +348,6 @@ static bool do_recv_completion(int fd)
376348
cm->cmsg_level, cm->cmsg_type);
377349

378350
serr = (void *) CMSG_DATA(cm);
379-
380351
if (serr->ee_origin != SO_EE_ORIGIN_ZEROCOPY)
381352
error(1, 0, "serr: wrong origin: %u", serr->ee_origin);
382353
if (serr->ee_errno != 0)
@@ -502,7 +473,7 @@ static void do_tx(int domain, int type, int protocol)
502473
if (cfg_cork)
503474
do_sendmsg_corked(fd, &msg);
504475
else
505-
do_sendmsg(fd, &msg, cfg_zerocopy, domain);
476+
do_sendmsg(fd, &msg, cfg_zerocopy);
506477

507478
if (cfg_zerocopy && sends_since_notify >= cfg_notification_limit)
508479
do_recv_completions(fd);

0 commit comments

Comments
 (0)