From: Andrew Deason Date: Sun, 21 Jul 2019 23:31:53 +0000 (-0500) Subject: rx: Introduce rxi_NetSend X-Git-Tag: openafs-devel-1_9_0~218 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=2a33a80f7026df6b5e47e42319c55d8b7155675a rx: Introduce rxi_NetSend Introduce a small wrapper around osi_NetSend, called rxi_NetSend. This small wrapper allows future commits to change the code around our osi_NetSend calls, without needing to change every single call site, or every implementation of osi_NetSend. Change most call sites to use rxi_NetSend, instead of osi_NetSend. Do not change a few callers in the platform-specific kernel shutdown sequence, since those call osi_NetSend for platform-specific reasons. This commit on its own does not change any behavior with osi_NetSend; it is just code reorganization. Change-Id: I0a7eb39d85d4e542c2832bb40191ab49fb02d067 Reviewed-on: https://gerrit.openafs.org/13717 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- diff --git a/src/afs/afs_mariner.c b/src/afs/afs_mariner.c index 30ec11e..0ae4d3c 100644 --- a/src/afs/afs_mariner.c +++ b/src/afs/afs_mariner.c @@ -104,7 +104,7 @@ afs_MarinerLog(char *astring, struct vcache *avc) dvec.iov_base = buf; dvec.iov_len = tp - buf; AFS_GUNLOCK(); - (void)osi_NetSend(afs_server->socket, &taddr, &dvec, 1, tp - buf, 0); + (void)rxi_NetSend(afs_server->socket, &taddr, &dvec, 1, tp - buf, 0); AFS_GLOCK(); osi_FreeSmallSpace(buf); } /*afs_MarinerLog */ diff --git a/src/rx/rx.c b/src/rx/rx.c index 37bdf2b..b12d759 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -4430,7 +4430,7 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np, #ifdef RX_ENABLE_LOCKS /* XXX Hack. Because we have to release the global call lock when sending - * packets (osi_NetSend) we drop all acks while we're traversing the tq + * packets (rxi_NetSend) we drop all acks while we're traversing the tq * in rxi_Start sending packets out because packets may move to the * freePacketQueue as result of being here! So we drop these packets until * we're safely out of the traversing. Really ugly! @@ -6502,7 +6502,7 @@ rxi_NatKeepAliveEvent(struct rxevent *event, void *arg1, tmpiov[0].iov_base = tbuffer; tmpiov[0].iov_len = 1 + sizeof(struct rx_header); - osi_NetSend(socket, &taddr, tmpiov, 1, 1 + sizeof(struct rx_header), 1); + rxi_NetSend(socket, &taddr, tmpiov, 1, 1 + sizeof(struct rx_header), 1); MUTEX_ENTER(&conn->conn_data_lock); /* We ran, so the handle is no longer needed to try to cancel ourselves. */ @@ -9413,3 +9413,10 @@ int rx_DumpCalls(FILE *outputFile, char *cookie) return 0; } #endif + +int +rxi_NetSend(osi_socket socket, void *addr, struct iovec *dvec, + int nvecs, int length, int istack) +{ + return osi_NetSend(socket, addr, dvec, nvecs, length, istack); +} diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index a61665c..d9822af 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -2158,7 +2158,7 @@ rxi_SendDebugPacket(struct rx_packet *apacket, osi_socket asocket, if (!waslocked) AFS_GLOCK(); afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, ICL_TYPE_STRING, - "before osi_NetSend()"); + "before rxi_NetSend()"); AFS_GUNLOCK(); } #else @@ -2167,14 +2167,14 @@ rxi_SendDebugPacket(struct rx_packet *apacket, osi_socket asocket, #endif #endif /* debug packets are not reliably delivered, hence the cast below. */ - (void)osi_NetSend(asocket, &taddr, apacket->wirevec, apacket->niovecs, + (void)rxi_NetSend(asocket, &taddr, apacket->wirevec, apacket->niovecs, apacket->length + RX_HEADER_SIZE, istack); #ifdef KERNEL #ifdef RX_KERNEL_TRACE if (ICL_SETACTIVE(afs_iclSetp)) { AFS_GLOCK(); afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, ICL_TYPE_STRING, - "after osi_NetSend()"); + "after rxi_NetSend()"); if (!waslocked) AFS_GUNLOCK(); } @@ -2311,7 +2311,7 @@ rxi_SendPacket(struct rx_call *call, struct rx_connection *conn, if (!waslocked) AFS_GLOCK(); afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, ICL_TYPE_STRING, - "before osi_NetSend()"); + "before rxi_NetSend()"); AFS_GUNLOCK(); } #else @@ -2320,7 +2320,7 @@ rxi_SendPacket(struct rx_call *call, struct rx_connection *conn, #endif #endif if ((code = - osi_NetSend(socket, &addr, p->wirevec, p->niovecs, + rxi_NetSend(socket, &addr, p->wirevec, p->niovecs, p->length + RX_HEADER_SIZE, istack)) != 0) { /* send failed, so let's hurry up the resend, eh? */ if (rx_stats_active) @@ -2341,7 +2341,7 @@ rxi_SendPacket(struct rx_call *call, struct rx_connection *conn, if (ICL_SETACTIVE(afs_iclSetp)) { AFS_GLOCK(); afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, ICL_TYPE_STRING, - "after osi_NetSend()"); + "after rxi_NetSend()"); if (!waslocked) AFS_GUNLOCK(); } @@ -2518,7 +2518,7 @@ rxi_SendPacketList(struct rx_call *call, struct rx_connection *conn, AFS_GUNLOCK(); #endif if ((code = - osi_NetSend(socket, &addr, &wirevec[0], len + 1, length, + rxi_NetSend(socket, &addr, &wirevec[0], len + 1, length, istack)) != 0) { /* send failed, so let's hurry up the resend, eh? */ if (rx_stats_active) @@ -2601,7 +2601,7 @@ rxi_SendRawAbort(osi_socket socket, afs_uint32 host, u_short port, addr.sin_len = sizeof(struct sockaddr_in); #endif - osi_NetSend(socket, &addr, iov, 2, + rxi_NetSend(socket, &addr, iov, 2, sizeof(struct rx_header) + sizeof(error), istack); } diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index 0af7ba8..8485f6e 100644 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -412,6 +412,8 @@ extern struct rx_packet *rxi_SplitJumboPacket(struct rx_packet *p, extern int osi_NetSend(osi_socket socket, void *addr, struct iovec *dvec, int nvecs, int length, int istack); #endif +extern int rxi_NetSend(osi_socket socket, void *addr, struct iovec *dvec, + int nvecs, int length, int istack); extern struct rx_packet *rxi_ReceiveDebugPacket(struct rx_packet *ap, osi_socket asocket, afs_uint32 ahost, short aport,