MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bw_upcalls_send

Function bw_upcalls_send

freebsd/netinet/ip_mroute.c:2056–2100  ·  view source on GitHub ↗

* Send the pending bandwidth-related upcalls */

Source from the content-addressed store, hash-verified

2054 * Send the pending bandwidth-related upcalls
2055 */
2056static void
2057bw_upcalls_send(void)
2058{
2059 struct mbuf *m;
2060 int len = V_bw_upcalls_n * sizeof(V_bw_upcalls[0]);
2061 struct sockaddr_in k_igmpsrc = { sizeof k_igmpsrc, AF_INET };
2062 static struct igmpmsg igmpmsg = { 0, /* unused1 */
2063 0, /* unused2 */
2064 IGMPMSG_BW_UPCALL,/* im_msgtype */
2065 0, /* im_mbz */
2066 0, /* im_vif */
2067 0, /* unused3 */
2068 { 0 }, /* im_src */
2069 { 0 } }; /* im_dst */
2070
2071 MFC_LOCK_ASSERT();
2072
2073 if (V_bw_upcalls_n == 0)
2074 return; /* No pending upcalls */
2075
2076 V_bw_upcalls_n = 0;
2077
2078 /*
2079 * Allocate a new mbuf, initialize it with the header and
2080 * the payload for the pending calls.
2081 */
2082 m = m_gethdr(M_NOWAIT, MT_DATA);
2083 if (m == NULL) {
2084 log(LOG_WARNING, "bw_upcalls_send: cannot allocate mbuf\n");
2085 return;
2086 }
2087
2088 m_copyback(m, 0, sizeof(struct igmpmsg), (caddr_t)&igmpmsg);
2089 m_copyback(m, sizeof(struct igmpmsg), len, (caddr_t)&V_bw_upcalls[0]);
2090
2091 /*
2092 * Send the upcalls
2093 * XXX do we need to set the address in k_igmpsrc ?
2094 */
2095 MRTSTAT_INC(mrts_upcalls);
2096 if (socket_send(V_ip_mrouter, m, &k_igmpsrc) < 0) {
2097 log(LOG_WARNING, "bw_upcalls_send: ip_mrouter socket queue full\n");
2098 MRTSTAT_INC(mrts_upq_sockfull);
2099 }
2100}
2101
2102/*
2103 * Compute the timeout hash value for the bw_meter entries

Callers 3

bw_meter_prepare_upcallFunction · 0.85
bw_meter_processFunction · 0.85
expire_bw_upcalls_sendFunction · 0.85

Calls 4

m_copybackFunction · 0.85
socket_sendFunction · 0.70
m_gethdrFunction · 0.50
logFunction · 0.50

Tested by

no test coverage detected