Rework second part of r357558. Unroll the macro and allocate memory in

sleepable manner before entering the epoch for the send.
This commit is contained in:
glebius 2020-02-21 04:18:15 +00:00
parent 977bcbb1e0
commit 8d6ef36daa

View File

@ -410,6 +410,7 @@ ngd_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
struct sockaddr_ng *const sap = (struct sockaddr_ng *) addr;
int len, error;
hook_p hook = NULL;
item_p item;
char hookname[NG_HOOKSIZ];
if ((pcbp == NULL) || (control != NULL)) {
@ -462,8 +463,10 @@ ngd_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
}
/* Send data. */
item = ng_package_data(m, NG_WAITOK);
m = NULL;
NET_EPOCH_ENTER(et);
NG_SEND_DATA_FLAGS(error, hook, m, NG_WAITOK);
NG_FWD_ITEM_HOOK(error, item, hook);
NET_EPOCH_EXIT(et);
release: