Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/ip_reass.c
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/hash.h> | #include <sys/hash.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/limits.h> | #include <sys/limits.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/socket.h> | |||||
#include <net/if.h> | |||||
#include <net/if_var.h> | |||||
#include <net/rss_config.h> | #include <net/rss_config.h> | ||||
#include <net/netisr.h> | #include <net/netisr.h> | ||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/ip.h> | #include <netinet/ip.h> | ||||
#include <netinet/ip_var.h> | #include <netinet/ip_var.h> | ||||
#include <netinet/in_rss.h> | #include <netinet/in_rss.h> | ||||
▲ Show 20 Lines • Show All 542 Lines • ▼ Show 20 Lines | for (int i = 0; i < IPREASS_NHASH; i++) { | ||||
while(!TAILQ_EMPTY(&V_ipq[i].head)) | while(!TAILQ_EMPTY(&V_ipq[i].head)) | ||||
ipq_drop(&V_ipq[i], TAILQ_FIRST(&V_ipq[i].head)); | ipq_drop(&V_ipq[i], TAILQ_FIRST(&V_ipq[i].head)); | ||||
KASSERT(V_ipq[i].count == 0, | KASSERT(V_ipq[i].count == 0, | ||||
("%s: V_ipq[%d] count %d (V_ipq=%p)", __func__, i, | ("%s: V_ipq[%d] count %d (V_ipq=%p)", __func__, i, | ||||
V_ipq[i].count, V_ipq)); | V_ipq[i].count, V_ipq)); | ||||
IPQ_UNLOCK(i); | IPQ_UNLOCK(i); | ||||
} | } | ||||
} | } | ||||
/* | |||||
* Drain off all datagram fragments belonging to | |||||
* the given network interface. | |||||
*/ | |||||
static void | |||||
ipreass_cleanup(void *arg __unused, struct ifnet *ifp) | |||||
{ | |||||
struct ipq *fp, *temp; | |||||
struct mbuf *m; | |||||
bz: You can fold these two into one line. | |||||
int i; | |||||
Done Inline ActionsCan you add a KASSERT that ifp != NULL? bz: Can you add a KASSERT that ifp != NULL? | |||||
KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); | |||||
Done Inline ActionsI'd remove the blank line. bz: I'd remove the blank line. | |||||
#ifdef VIMAGE | |||||
if (ifp->if_vnet->vnet_state <= SI_SUB_PROTO_DOMAIN) { | |||||
/* the IP reassembly hash has or will soon be destroyed */ | |||||
return; | |||||
} | |||||
bzUnsubmitted Done Inline ActionsYou may want to go and have a look how "shutdown" is defined in if_detach_internal(). I think using the same logic here and in IPv6 is probably wise. bz: You may want to go and have a look how "shutdown" is defined in if_detach_internal(). I think… | |||||
hselaskyAuthorUnsubmitted Done Inline ActionsI'll update the code. hselasky: I'll update the code. | |||||
Done Inline ActionsThis block can be changed to: /* * Skip processing if IPv4 reassembly is not initialised * or torn down by ipreass_destroy(). */ if (V_ipq_zone == NULL) return; }}} bz: This block can be changed to:
{{{
/*
* Skip processing if IPv4 reassembly is not… | |||||
#endif | |||||
CURVNET_SET_QUIET(ifp->if_vnet); | |||||
Done Inline ActionsCan you do the assignment not on the declaration line; also the declaration could happen at the beginning of the function. Also Why is it mb and not just m? bz: Can you do the assignment not on the declaration line; also the declaration could happen at… | |||||
for (i = 0; i < IPREASS_NHASH; i++) { | |||||
IPQ_LOCK(i); | |||||
/* Scan fragment list. */ | |||||
TAILQ_FOREACH_SAFE(fp, &V_ipq[i].head, ipq_list, temp) { | |||||
for (m = fp->ipq_frags; m != NULL; m = m->m_nextpkt) { | |||||
if (m->m_pkthdr.rcvif == ifp) { | |||||
ipq_drop(&V_ipq[i], fp); | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
IPQ_UNLOCK(i); | |||||
} | |||||
CURVNET_RESTORE(); | |||||
} | |||||
EVENTHANDLER_DEFINE(ifnet_departure_event, ipreass_cleanup, NULL, 0); | |||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
/* | /* | ||||
* Destroy IP reassembly structures. | * Destroy IP reassembly structures. | ||||
*/ | */ | ||||
void | void | ||||
ipreass_destroy(void) | ipreass_destroy(void) | ||||
{ | { | ||||
ipreass_drain(); | ipreass_drain(); | ||||
uma_zdestroy(V_ipq_zone); | uma_zdestroy(V_ipq_zone); | ||||
Done Inline ActionsPlease add a V_ipq_zone = NULL; here. (If you really want to be fuzzy, you can use a temporary variable but VNET shutdown is single threaded so ...) bz: Please add a V_ipq_zone = NULL; here. (If you really want to be fuzzy, you can use a temporary… | |||||
for (int i = 0; i < IPREASS_NHASH; i++) | for (int i = 0; i < IPREASS_NHASH; i++) | ||||
mtx_destroy(&V_ipq[i].lock); | mtx_destroy(&V_ipq[i].lock); | ||||
} | } | ||||
#endif | #endif | ||||
/* | /* | ||||
* After maxnipq has been updated, propagate the change to UMA. The UMA zone | * After maxnipq has been updated, propagate the change to UMA. The UMA zone | ||||
* max has slightly different semantics than the sysctl, for historical | * max has slightly different semantics than the sysctl, for historical | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |
You can fold these two into one line.