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

Function sctp_input

freebsd/netinet/sctp_input.c:5806–5850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5804#endif
5805
5806int
5807sctp_input(struct mbuf **mp, int *offp, int proto SCTP_UNUSED)
5808{
5809 struct mbuf *m;
5810 int off;
5811
5812 m = *mp;
5813 off = *offp;
5814#if defined(SCTP_MCORE_INPUT) && defined(SMP)
5815 if (mp_ncpus > 1) {
5816 struct ip *ip;
5817 struct sctphdr *sh;
5818 int offset;
5819 int cpu_to_use;
5820 uint32_t flowid, tag;
5821
5822 if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
5823 flowid = m->m_pkthdr.flowid;
5824 } else {
5825 /*
5826 * No flow id built by lower layers fix it so we
5827 * create one.
5828 */
5829 offset = off + sizeof(struct sctphdr);
5830 if (SCTP_BUF_LEN(m) < offset) {
5831 if ((m = m_pullup(m, offset)) == NULL) {
5832 SCTP_STAT_INCR(sctps_hdrops);
5833 return (IPPROTO_DONE);
5834 }
5835 }
5836 ip = mtod(m, struct ip *);
5837 sh = (struct sctphdr *)((caddr_t)ip + off);
5838 tag = htonl(sh->v_tag);
5839 flowid = tag ^ ntohs(sh->dest_port) ^ ntohs(sh->src_port);
5840 m->m_pkthdr.flowid = flowid;
5841 M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE_HASH);
5842 }
5843 cpu_to_use = sctp_cpuarry[flowid % mp_ncpus];
5844 sctp_queue_to_mcore(m, off, cpu_to_use);
5845 return (IPPROTO_DONE);
5846 }
5847#endif
5848 sctp_input_with_port(m, off, 0);
5849 return (IPPROTO_DONE);
5850}
5851#endif

Callers

nothing calls this directly

Calls 3

m_pullupFunction · 0.85
sctp_queue_to_mcoreFunction · 0.85
sctp_input_with_portFunction · 0.85

Tested by

no test coverage detected