sockets: make pr_aio_queue the default method

Call it directly instead of each time calling pr_aio_queue_notsupp() and
then doing the actual job.  The only user of non default method was
cxgbe(4).  It calls now into the default method in case of own method
failure.  This preserves existing behavior.

Reviewed by:		markj, jhb
Differential Revision:	https://reviews.freebsd.org/D48863
This commit is contained in:
Gleb Smirnoff 2025-02-10 11:30:45 -08:00
parent 09b435d3dc
commit 4a7f4f289c
4 changed files with 18 additions and 17 deletions

View file

@ -2219,11 +2219,16 @@ t4_aio_queue_tom(struct socket *so, struct kaiocb *job)
if (ulp_mode(toep) == ULP_MODE_TCPDDP ||
ulp_mode(toep) == ULP_MODE_NONE) {
error = t4_aio_queue_ddp(so, job);
if (error != EOPNOTSUPP)
return (error);
if (error == 0)
return (0);
else if (error != EOPNOTSUPP)
return (soaio_queue_generic(so, job));
}
return (t4_aio_queue_aiotx(so, job));
if (t4_aio_queue_aiotx(so, job) != 0)
return (soaio_queue_generic(so, job));
else
return (0);
}
static int

View file

@ -802,15 +802,16 @@ soo_aio_cancel(struct kaiocb *job)
static int
soo_aio_queue(struct file *fp, struct kaiocb *job)
{
struct socket *so;
struct socket *so = fp->f_data;
return (so->so_proto->pr_aio_queue(so, job));
}
int
soaio_queue_generic(struct socket *so, struct kaiocb *job)
{
struct sockbuf *sb;
sb_which which;
int error;
so = fp->f_data;
error = so->so_proto->pr_aio_queue(so, job);
if (error == 0)
return (0);
/* Lock through the socket, since this may be a listening socket. */
switch (job->uaiocb.aio_lio_opcode & (LIO_WRITE | LIO_READ)) {

View file

@ -58,12 +58,6 @@ pr_accept_notsupp(struct socket *so, struct sockaddr *sa)
return (EOPNOTSUPP);
}
static int
pr_aio_queue_notsupp(struct socket *so, struct kaiocb *job)
{
return (EOPNOTSUPP);
}
static int
pr_bind_notsupp(struct socket *so, struct sockaddr *nam, struct thread *td)
{
@ -190,10 +184,10 @@ pr_init(struct domain *dom, struct protosw *pr)
DEFAULT(pr_soreceive, soreceive_generic);
DEFAULT(pr_sopoll, sopoll_generic);
DEFAULT(pr_setsbopt, sbsetopt);
DEFAULT(pr_aio_queue, soaio_queue_generic);
#define NOTSUPP(foo) if (pr->foo == NULL) pr->foo = foo ## _notsupp
NOTSUPP(pr_accept);
NOTSUPP(pr_aio_queue);
NOTSUPP(pr_bind);
NOTSUPP(pr_bindat);
NOTSUPP(pr_connect);

View file

@ -526,6 +526,7 @@ struct socket *
struct socket *
sopeeloff(struct socket *);
int sopoll_generic(struct socket *so, int events, struct thread *td);
int soaio_queue_generic(struct socket *so, struct kaiocb *job);
int soreceive(struct socket *so, struct sockaddr **paddr, struct uio *uio,
struct mbuf **mp0, struct mbuf **controlp, int *flagsp);
int soreceive_stream(struct socket *so, struct sockaddr **paddr,